dsh-provider-proxy 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -116
- package/lib/client.js +28 -5
- package/lib/client.js.map +2 -2
- package/lib/index.js +26 -11
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,116 +1,119 @@
|
|
|
1
|
-
# dsh-provider-proxy
|
|
2
|
-
|
|
3
|
-
给 **DeepSeek Harness**(`0.2.0-rc.1` 及以上)用的插件:在 **设置** 里为**每个 provider 单独配置**「这个 provider 要不要走代理」,填写代理类型 + IP/端口。只有被你打开开关的 provider 走代理,其余 provider 和 DSH 的其它流量保持原来的直连路径。
|
|
4
|
-
|
|
5
|
-
支持官方桌面版(DSH Desktop)与 `dsh web`。
|
|
6
|
-
|
|
7
|
-
## 安装
|
|
8
|
-
|
|
9
|
-
先确保已构建过产物(`lib/index.js`、`lib/client.js`):
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
npm install
|
|
13
|
-
npm run build
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
桌面版(**必须先完整打开一次桌面版以初始化 profile,然后完全退出**,否则安装命令会拒绝执行):
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
dsh plugin --profile desktop add
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Web:
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
dsh plugin --profile web add
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
安装后重启对应应用。设置项写在 `$DSH_HOME/profiles/<profile>/cordis.patch.yml`。
|
|
29
|
-
|
|
30
|
-
## 使用
|
|
31
|
-
|
|
32
|
-
打开 **设置**,左侧导航里会出现一项 **Provider 代理**(英文界面为 *Provider Proxy*)。
|
|
33
|
-
页面里每个 provider 一张卡片,各自独立配置:
|
|
34
|
-
|
|
35
|
-
| 字段 | 说明 |
|
|
36
|
-
| --- | --- |
|
|
37
|
-
| 开关 | 该 provider 是否走代理 |
|
|
38
|
-
| 类型 | `HTTP` / `HTTPS
|
|
39
|
-
| IP / 主机 | 只填主机名或 IP,不要带 `http://` 或路径 |
|
|
40
|
-
| 端口 | 1–65535 的整数 |
|
|
41
|
-
| 用户名 |
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
>
|
|
51
|
-
>
|
|
52
|
-
>
|
|
53
|
-
>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- `llm-
|
|
61
|
-
- `
|
|
62
|
-
- `
|
|
63
|
-
- `
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
npm run
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
1
|
+
# dsh-provider-proxy [](https://dsh.market/)
|
|
2
|
+
|
|
3
|
+
给 **DeepSeek Harness**(`0.2.0-rc.1` 及以上)用的插件:在 **设置** 里为**每个 provider 单独配置**「这个 provider 要不要走代理」,填写代理类型 + IP/端口。只有被你打开开关的 provider 走代理,其余 provider 和 DSH 的其它流量保持原来的直连路径。
|
|
4
|
+
|
|
5
|
+
支持官方桌面版(DSH Desktop)与 `dsh web`。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
先确保已构建过产物(`lib/index.js`、`lib/client.js`):
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install
|
|
13
|
+
npm run build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
桌面版(**必须先完整打开一次桌面版以初始化 profile,然后完全退出**,否则安装命令会拒绝执行):
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
dsh plugin --profile desktop add dsh-provider-proxy
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Web:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
dsh plugin --profile web add dsh-provider-proxy
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
安装后重启对应应用。设置项写在 `$DSH_HOME/profiles/<profile>/cordis.patch.yml`。
|
|
29
|
+
|
|
30
|
+
## 使用
|
|
31
|
+
|
|
32
|
+
打开 **设置**,左侧导航里会出现一项 **Provider 代理**(英文界面为 *Provider Proxy*)。
|
|
33
|
+
页面里每个 provider 一张卡片,各自独立配置:
|
|
34
|
+
|
|
35
|
+
| 字段 | 说明 |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| 开关 | 该 provider 是否走代理 |
|
|
38
|
+
| 类型 | `HTTP` / `HTTPS` / `SOCKS5` |
|
|
39
|
+
| IP / 主机 | 只填主机名或 IP,不要带 `http://` 或路径 |
|
|
40
|
+
| 端口 | 1–65535 的整数 |
|
|
41
|
+
| 用户名 | 可选(SOCKS5 用,需与密码同时填写) |
|
|
42
|
+
| 密码 | 可选(SOCKS5 用)。作为 SOCKS5 认证口令发给代理 |
|
|
43
|
+
|
|
44
|
+
列表只包含**已激活**的 provider(`llm.listProviders()` 能列出的那些)。仅在配置里声明、
|
|
45
|
+
但没有实际注册的可配置 provider 不显示——它的请求根本不会被发出去。
|
|
46
|
+
已经在 `providers` 里配过代理的条目即使暂时不激活也仍然保留,避免已保存的设置悄悄消失。
|
|
47
|
+
|
|
48
|
+
保存立即对新请求生效,不需要重启;正在进行中的流会继续用它启动时的那条连接。
|
|
49
|
+
|
|
50
|
+
> **为什么是独立设置页,而不是内嵌在 Models 的 provider 卡片里?**
|
|
51
|
+
> 本插件最早按卡片内嵌(`settings.models.provider-card`)实现,但那个槽位是 keyed 的、
|
|
52
|
+
> 按 provider 命名空间派发,第三方注册在 0.2.0-rc.1 上始终匹配不上——不报错、不发请求、
|
|
53
|
+
> 界面上什么都不出现。独立分区(`settings.section`)是同一 profile 下
|
|
54
|
+
> `dsh-llm-retry-settings` 已被验证可用的机制。
|
|
55
|
+
|
|
56
|
+
## 它是怎么工作的
|
|
57
|
+
|
|
58
|
+
0.2.0 没有「给单个 provider 注入 transport」的官方口子,这是核对过源码的结论:
|
|
59
|
+
|
|
60
|
+
- `llm-deepseek` 直接调用全局 `fetch`,请求参数里没有 `dispatcher`;
|
|
61
|
+
- `llm-pi-ai` 走 pi-ai SDK 自己的 HTTP,DSH 无法配置;
|
|
62
|
+
- `LlmCallControls` 只有 `reasoningEffort` / `temperature` / `maxTokens` / `stop`;
|
|
63
|
+
- `llm/stream` 拦截的是**已解码的** `StreamChunk`,发生在 HTTP 之后;
|
|
64
|
+
- `ctx.web` 只服务 `web_search` / `web_fetch`,与 provider 流量无关;
|
|
65
|
+
- 官方的 `@deepseek-ai/dsh-http-proxy` 是**库**不是插件:`installGlobalProxy` 是模块私有函数,没有 service、没有 Config、只有从环境变量解析出的一份进程级策略。
|
|
66
|
+
|
|
67
|
+
所以请求在唯一还能拿到线索的地方被路由:`llm/stream` waterfall 的 `options.provider`。用一个 `AsyncLocalStorage` 把选中的 dispatcher 带到流上,再由一层很薄的 `globalThis.fetch` 包装把它交给 fetch。
|
|
68
|
+
|
|
69
|
+
两个关键点:
|
|
70
|
+
|
|
71
|
+
1. **每个 provider 各自持有一个 dispatcher**(而不是共用一个),所以即使两个 provider 指向同一个上游主机,也不可能互相串用对方的代理。
|
|
72
|
+
2. **流的惰性消费必须被处理**:adapter 的 HTTP 调用通常发生在后续的 `next()` 里,那时 `als.run()` 早已返回。所以每次迭代器的 `next/return/throw` 都会被重新包进作用域里 —— 这正是旧版实现在这里踩过的坑,仓库里有对应的回归测试。
|
|
73
|
+
|
|
74
|
+
代价是这一个全局 `fetch` 包装:作用域之外的行为与原生完全一致,作用域之内若调用方已经自带 `dispatcher` 也不会被覆盖。
|
|
75
|
+
|
|
76
|
+
## 已知限制
|
|
77
|
+
|
|
78
|
+
- **SOCKS5 由 `undici` 内置的 `Socks5ProxyAgent` 实现**(RFC 1928 / RFC 1929),API 稳定性标记为 *Experimental*;`undici` 若在未来移除,需要同步调整。
|
|
79
|
+
- **SOCKS5 的用户名必须与密码同时填写。** 只填用户名会被拒绝并给出提示,而不是静默降级为无认证——否则在强制认证的代理端,报错会指向代理而真正原因是设置缺项。
|
|
80
|
+
- **SOCKS5 不支持 `socks://` 别名与 SOCKS5 over TLS**(`proxyTls`)。
|
|
81
|
+
- **上游若绕过 `globalThis.fetch` 自行建连,则不受影响。** `llm-deepseek` 确认是调用时解析全局 `fetch`;`llm-pi-ai` 走外部 SDK,抓取 `fetch` 的时机未能在源码层面确证。
|
|
82
|
+
- **不支持 PAC**,也不读取系统代理设置。
|
|
83
|
+
- **不改写 `baseURL`** —— 反向代理/中转请直接在 provider 上配置。
|
|
84
|
+
- **代理不可达时**请求照常失败,DSH 既有的重试与错误码语义不变。
|
|
85
|
+
- **SOCKS5 代理密码以明文随设置写入 `cordis.patch.yml`。** 它只会作为选项传给 `Socks5ProxyAgent`,不会出现在日志或诊断报告里的代理 URL 中。
|
|
86
|
+
- **HTTP/HTTPS 代理仍只支持用户名**,密码只对 SOCKS5 生效。
|
|
87
|
+
|
|
88
|
+
## 如何验证代理确实生效
|
|
89
|
+
|
|
90
|
+
插件本身不显示出口 IP。可靠的判断方式是在代理端看日志,或临时把端口改成
|
|
91
|
+
一个没人监听的端口——如果请求失败并报 `ECONNREFUSED 127.0.0.1:<该端口>`,
|
|
92
|
+
就说明请求确实是被代理承载的(直连时报错会指向目标站点)。
|
|
93
|
+
|
|
94
|
+
仓库里的 `tests/proxy-routing-proof.test.ts` 就是用这个思路做的:起一个会记录
|
|
95
|
+
连接的假代理,断言「启用的路由收到 1 次连接、未配置的 provider 收到 0 次」。
|
|
96
|
+
|
|
97
|
+
## 开发
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
npm run build # 构建 lib/index.js 与 lib/client.js
|
|
101
|
+
npm test # 82 个用例,跑的是构建产物
|
|
102
|
+
npm run typecheck # 类型检查(仅覆盖 src/)
|
|
103
|
+
npm run verify # 上面三件事,按顺序
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`lib/` 是构建产物,不入库;包上的 `prepare` 脚本会在 `npm publish` 以及从 git
|
|
107
|
+
地址安装时自动重建。直接 `dsh plugin add <克隆目录>` 前请先执行
|
|
108
|
+
`npm install && npm run build`。
|
|
109
|
+
|
|
110
|
+
浏览器半必须输出 client module system 的 lazy-CJS factory 格式(脚本本身只注册工厂,所有副作用都在工厂闭包里执行),`scripts/build.mjs` 负责这件事,格式与 DSH 自带插件一致。
|
|
111
|
+
|
|
112
|
+
## 发布
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
npm run verify # 先确认全绿
|
|
116
|
+
npm version patch # 0.2.0 -> 0.2.1
|
|
117
|
+
npm publish
|
|
118
|
+
git push --follow-tags
|
|
119
|
+
```
|
package/lib/client.js
CHANGED
|
@@ -180,7 +180,7 @@ function view(route) {
|
|
|
180
180
|
host: route?.host ?? "",
|
|
181
181
|
port: route?.port ?? 0,
|
|
182
182
|
username: route?.username ?? "",
|
|
183
|
-
|
|
183
|
+
password: route?.password ?? ""
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
var diagnostics = [];
|
|
@@ -412,7 +412,7 @@ function renderPage(ctx) {
|
|
|
412
412
|
(protocol) => h("option", { key: protocol, value: protocol }, protocol.toUpperCase())
|
|
413
413
|
)
|
|
414
414
|
),
|
|
415
|
-
route.protocol === "socks5" ? t.
|
|
415
|
+
route.protocol === "socks5" ? t.socks5Hint : void 0
|
|
416
416
|
),
|
|
417
417
|
field(
|
|
418
418
|
t.host,
|
|
@@ -453,7 +453,26 @@ function renderPage(ctx) {
|
|
|
453
453
|
value: route.username,
|
|
454
454
|
onChange: (event) => bind(row.id, "username")(event.target.value)
|
|
455
455
|
})
|
|
456
|
-
)
|
|
456
|
+
),
|
|
457
|
+
// Only SOCKS5 authenticates in-band, so only SOCKS5 shows this field.
|
|
458
|
+
//
|
|
459
|
+
// The password is stored on the route and therefore written into the
|
|
460
|
+
// settings file with the rest of the config. It is handed to
|
|
461
|
+
// Socks5ProxyAgent as an option, never embedded in the proxy URL that
|
|
462
|
+
// the diagnostics surface.
|
|
463
|
+
route.protocol === "socks5" ? field(
|
|
464
|
+
t.password,
|
|
465
|
+
h("input", {
|
|
466
|
+
className: import_client.default.input,
|
|
467
|
+
style: S.input,
|
|
468
|
+
disabled,
|
|
469
|
+
type: "password",
|
|
470
|
+
autocomplete: "off",
|
|
471
|
+
value: route.password,
|
|
472
|
+
onChange: (event) => bind(row.id, "password")(event.target.value)
|
|
473
|
+
}),
|
|
474
|
+
t.passwordHint
|
|
475
|
+
) : void 0
|
|
457
476
|
);
|
|
458
477
|
});
|
|
459
478
|
return h(
|
|
@@ -492,8 +511,10 @@ var EN = {
|
|
|
492
511
|
host: "IP / host",
|
|
493
512
|
port: "Port",
|
|
494
513
|
username: "Username",
|
|
514
|
+
password: "Password",
|
|
495
515
|
hostHint: "Host or IP only, without scheme or path.",
|
|
496
|
-
|
|
516
|
+
passwordHint: "Sent to the SOCKS5 proxy for authentication; stored with this setting.",
|
|
517
|
+
socks5Hint: "SOCKS5 tunnels the connection; the proxy resolves the target host name.",
|
|
497
518
|
on: "proxied",
|
|
498
519
|
live: "active",
|
|
499
520
|
off: "direct",
|
|
@@ -508,8 +529,10 @@ var ZH = {
|
|
|
508
529
|
host: "IP / \u4E3B\u673A",
|
|
509
530
|
port: "\u7AEF\u53E3",
|
|
510
531
|
username: "\u7528\u6237\u540D",
|
|
532
|
+
password: "\u5BC6\u7801",
|
|
511
533
|
hostHint: "\u53EA\u586B\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4E0D\u8981\u5E26\u534F\u8BAE\u524D\u7F00\u6216\u8DEF\u5F84\u3002",
|
|
512
|
-
|
|
534
|
+
passwordHint: "\u4EC5\u4F5C\u4E3A SOCKS5 \u8BA4\u8BC1\u53E3\u4EE4\u53D1\u9001\u7ED9\u4EE3\u7406\uFF1B\u968F\u8BE5\u8BBE\u7F6E\u4E00\u8D77\u4FDD\u5B58\u3002",
|
|
535
|
+
socks5Hint: "SOCKS5 \u4F1A\u5EFA\u7ACB\u96A7\u9053\uFF0C\u76EE\u6807\u57DF\u540D\u7531\u4EE3\u7406\u7AEF\u89E3\u6790\u3002",
|
|
513
536
|
on: "\u8D70\u4EE3\u7406",
|
|
514
537
|
live: "\u542F\u7528\u4E2D",
|
|
515
538
|
off: "\u76F4\u8FDE",
|
package/lib/client.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/client.css", "../src/client.ts"],
|
|
4
|
-
"sourcesContent": ["\nvar __dshMap = {\"root\":\"1b9ac577_root\",\"lead\":\"4a359f22_lead\",\"empty\":\"ffd21b3b_empty\",\"card\":\"16611c9b_card\",\"cardActive\":\"2d004466_cardActive\",\"cardHead\":\"640fee25_cardHead\",\"cardTitles\":\"f6fe8b3f_cardTitles\",\"name\":\"f9d2db09_name\",\"id\":\"c90ce2e0_id\",\"pillOn\":\"75541864_pillOn\",\"pillLive\":\"3097d90f_pillLive\",\"pillOff\":\"a58f86be_pillOff\",\"toggle\":\"e5b81c4b_toggle\",\"field\":\"f4d34839_field\",\"label\":\"a4061c91_label\",\"hint\":\"13bd3ec9_hint\",\"input\":\"851d7bd9_input\",\"diag\":\"f92a10d9_diag\",\"diagSummary\":\"5b66e072_diagSummary\",\"diagList\":\"dc8d3a6f_diagList\"};\nvar __dshStyles = (globalThis.__dshPluginStyles || (globalThis.__dshPluginStyles = new Set()));\nif (!__dshStyles.has(\"dsh-provider-proxy/client.css\")) {\n __dshStyles.add(\"dsh-provider-proxy/client.css\");\n var __dshStyle = document.createElement('style');\n __dshStyle.setAttribute('data-plugin-css', \"dsh-provider-proxy/client.css\");\n __dshStyle.textContent = \"/* dsh-provider-proxy \u2014 provider proxy settings page.\\n Tokens only: no literal colours, matching the shared --dsw-* system. */\\n\\n.1b9ac577_root {\\n display: flex;\\n flex-direction: column;\\n gap: 12px;\\n max-width: 640px;\\n}\\n\\n.4a359f22_lead {\\n margin: 0 0 4px;\\n font-size: 12px;\\n line-height: 1.6;\\n color: var(--dsw-alias-label-secondary);\\n}\\n\\n.ffd21b3b_empty {\\n margin: 0;\\n padding: 16px;\\n border: 1px dashed var(--dsw-alias-border-l1);\\n border-radius: 8px;\\n font-size: 12px;\\n text-align: center;\\n color: var(--dsw-alias-state-idle-primary);\\n}\\n\\n/* ---- provider card ---- */\\n\\n.16611c9b_card,\\n.2d004466_cardActive {\\n display: flex;\\n flex-direction: column;\\n gap: 10px;\\n padding: 12px 14px;\\n border: 1px solid var(--dsw-alias-border-l1);\\n border-radius: 10px;\\n background: var(--dsw-alias-bg-layer-1);\\n}\\n\\n.2d004466_cardActive {\\n border-color: var(--dsw-alias-state-success-primary);\\n background: var(--dsw-alias-bg-layer-2);\\n}\\n\\n.640fee25_cardHead {\\n display: flex;\\n align-items: center;\\n justify-content: space-between;\\n gap: 12px;\\n}\\n\\n.f6fe8b3f_cardTitles {\\n display: flex;\\n align-items: baseline;\\n gap: 8px;\\n min-width: 0;\\n}\\n\\n.f9d2db09_name {\\n overflow: hidden;\\n font-size: 13px;\\n font-weight: 600;\\n white-space: nowrap;\\n text-overflow: ellipsis;\\n color: var(--dsw-alias-label-primary);\\n}\\n\\n.c90ce2e0_id {\\n flex: none;\\n padding: 1px 6px;\\n border-radius: 4px;\\n background: var(--dsw-alias-bg-layer-2);\\n font-family: ui-monospace, monospace;\\n font-size: 11px;\\n color: var(--dsw-alias-label-secondary);\\n}\\n\\n/* ---- status pill ---- */\\n\\n.75541864_pillOn,\\n.3097d90f_pillLive,\\n.a58f86be_pillOff {\\n flex: none;\\n padding: 2px 8px;\\n border-radius: 999px;\\n font-size: 11px;\\n font-weight: 500;\\n white-space: nowrap;\\n}\\n\\n.75541864_pillOn {\\n background: var(--dsw-alias-state-success-primary);\\n color: var(--dsw-alias-bg-base);\\n}\\n\\n.3097d90f_pillLive {\\n border: 1px solid var(--dsw-alias-border-l2);\\n color: var(--dsw-alias-label-secondary);\\n}\\n\\n.a58f86be_pillOff {\\n color: var(--dsw-alias-state-idle-primary);\\n}\\n\\n/* ---- toggle ---- */\\n\\n.e5b81c4b_toggle {\\n display: flex;\\n align-items: center;\\n gap: 8px;\\n padding-top: 2px;\\n font-size: 12px;\\n color: var(--dsw-alias-label-primary);\\n cursor: pointer;\\n}\\n\\n.e5b81c4b_toggle input {\\n accent-color: var(--dsw-alias-brand-primary);\\n cursor: pointer;\\n}\\n\\n/* ---- fields ---- */\\n\\n.f4d34839_field {\\n display: grid;\\n grid-template-columns: 96px 1fr;\\n align-items: center;\\n gap: 10px;\\n font-size: 12px;\\n}\\n\\n.a4061c91_label {\\n color: var(--dsw-alias-label-secondary);\\n}\\n\\n.13bd3ec9_hint {\\n grid-column: 2;\\n margin-top: -2px;\\n font-size: 11px;\\n color: var(--dsw-alias-state-warn-primary);\\n}\\n\\n.851d7bd9_input {\\n box-sizing: border-box;\\n width: 100%;\\n min-width: 0;\\n padding: 5px 8px;\\n border: 1px solid var(--dsw-alias-border-l1);\\n border-radius: 6px;\\n outline: none;\\n background: var(--dsw-alias-bg-layer-1);\\n color: var(--dsw-alias-label-primary);\\n font: inherit;\\n font-size: 12px;\\n transition: border-color 120ms ease, background 120ms ease;\\n}\\n\\n.851d7bd9_input:hover:not(:disabled) {\\n border-color: var(--dsw-alias-border-l2);\\n}\\n\\n.851d7bd9_input:focus {\\n border-color: var(--dsw-alias-brand-primary);\\n}\\n\\n.851d7bd9_input:disabled {\\n color: var(--dsw-alias-state-idle-primary);\\n background: var(--dsw-alias-bg-layer-2);\\n cursor: not-allowed;\\n}\\n\\n/* ---- diagnostics ---- */\\n\\n.f92a10d9_diag {\\n margin-top: 2px;\\n padding: 8px 10px;\\n border: 1px solid var(--dsw-alias-border-l1);\\n border-radius: 8px;\\n font-size: 11px;\\n color: var(--dsw-alias-label-secondary);\\n}\\n\\n.5b66e072_diagSummary {\\n cursor: pointer;\\n color: var(--dsw-alias-state-warn-primary);\\n}\\n\\n.dc8d3a6f_diagList {\\n margin: 6px 0 0;\\n padding-left: 18px;\\n font-family: ui-monospace, monospace;\\n word-break: break-all;\\n}\\n\";\n document.head.appendChild(__dshStyle);\n}\nmodule.exports = __dshMap;\nmodule.exports.default = __dshMap;\nmodule.exports.__esModule = true;\n", "/**\n * dsh-provider-proxy \u2014 browser half.\n *\n * Contributes ONE settings page (a `settings.section` list entry) that lists\n * every known provider with its proxy switch, type, host, port and username.\n *\n * This replaces an earlier attempt to render into each provider card on the\n * Models page (`settings.models.provider-card`). That seat is keyed and\n * dispatched per provider namespace, and a third-party registration never\n * matched it on this build: no error, no request, simply no output. A\n * `settings.section` entry is a plain list contribution with an `id`, which is\n * the shape the shipped `dsh-llm-retry-settings` plugin uses successfully in\n * this same desktop profile.\n *\n * The whole bundle runs inside the client module system's lazy-CJS factory:\n * executing the script only REGISTERS the factory, and every side effect\n * (including the CSS injection) happens at materialization.\n */\n\n// The CSS-Modules build turns this sheet into a hashed class map AND injects it\n// at materialization. The binding is what the component reads; importing it for\n// side effects only would leave `styles` undefined at render time.\nimport styles from './client.css'\n\ntype Protocol = 'http' | 'https' | 'socks5'\n\ntype RouteValue = {\n enabled: boolean\n protocol: Protocol\n host: string\n port: number\n username: string\n passwordRef: string\n}\n\n/** The provider rows we know about, and which of them are actually live. */\ntype ProviderRow = { id: string; name: string; live: boolean }\n\n/**\n * React, resolved from the client module table.\n *\n * React is NOT a Cordis service and is not reachable from `ctx` \u2014 reading it\n * there produced a silently null component. The module table is the only route:\n * the build leaves `react` external, so this compiles to a `require(\"react\")`\n * inside the factory closure, answered from the shell-seeded baseline.\n *\n * Resolved lazily on first render so merely REGISTERING the bundle \u2014 which is\n * all a script evaluation does \u2014 never materializes React.\n */\nlet ReactCache: unknown\n\nfunction react(): any {\n if (ReactCache === undefined) {\n ReactCache = ((): unknown => {\n try {\n return require('react')\n } catch {\n return (globalThis as Record<string, unknown>).React\n }\n })()\n }\n return ReactCache\n}\n\nconst PROTOCOLS: Protocol[] = ['http', 'https', 'socks5']\n\n/** Our own settings namespace; the profile entry id created by the bundle patch. */\nconst NAMESPACE = 'provider-proxy'\n\n/**\n * Cordis services this half needs.\n *\n * ONLY `slots` is declared. That is the complete set this release actually\n * offers on a client fiber: `layout, locale, sessions, slots, theme, timer,\n * uiWorkspace, workspaces`.\n *\n * A declared service that never arrives leaves the fiber PENDING forever, and\n * that is NOT a client-only failure \u2014 it is reported as\n * web boot: 1 entry did not activate\n * dsh-provider-proxy: pending (waiting for service: settingsScope)\n * which fails the whole Desktop boot. `settingsScope` and `configForms` were\n * both guessed and both are absent here, so neither may be declared.\n *\n * Settings are therefore reached through `ctx.get(name)` \u2014 the framework's own\n * non-throwing lookup \u2014 and the page degrades to read-only when it is absent.\n */\nconst PLUGINS = ['slots']\n\nexport const inject = PLUGINS\n\nexport function apply(ctx: any): void {\n // The settings shell declares `settings.section` on its own fiber, so\n // `slots.inject` waits for that declaration and the contribution is removed\n // when the panel is torn down.\n ctx.slots.inject('settings.section', () =>\n ctx.slots.register(\n {\n name: 'settings.section',\n id: NAMESPACE,\n order: 20,\n label: () => (localeOf(ctx) === 'zh' ? 'Provider \u4EE3\u7406' : 'Provider \u4EE3\u7406'),\n },\n () => renderPage(ctx),\n ),\n )\n}\n\n/**\n * Pick the dictionary.\n *\n * Chinese is the default, not English: this plugin is written for a\n * Chinese-speaking operator, and a page that renders in the wrong language is\n * worse than one that never matches the shell's locale.\n *\n * `ctx.locale` is not injected \u2014 declaring a service that this release does not\n * provide left the fiber PENDING and failed the whole Desktop boot \u2014 so the\n * locale is probed with the non-throwing `ctx.get`, then the browser's own\n * language, and only then English.\n */\nfunction localeOf(ctx: any): string {\n try {\n const service = optionalService(ctx, 'locale')\n const snapshot = service?.getSnapshot?.() ?? service?.getLocale?.()\n const id = typeof snapshot?.locale === 'string' ? snapshot.locale : undefined\n if (id !== undefined) return id.toLowerCase().startsWith('zh') ? 'zh' : 'en'\n } catch {\n // fall through to the browser language\n }\n const browser = globalThis.navigator?.language\n if (typeof browser === 'string' && browser.toLowerCase().startsWith('zh')) return 'zh'\n return browser === undefined ? 'zh' : 'en'\n}\n\n/**\n * Look a service up WITHOUT declaring it in `inject`.\n *\n * `ctx.get(name)` is the framework's own optional lookup: it returns undefined\n * instead of throwing, and \u2014 unlike a declared service \u2014 it cannot leave the\n * fiber PENDING. That is what makes an optional integration safe here: this\n * release has no settings service at all, so the page simply shows its fields\n * and reports that saving is unavailable.\n */\nfunction optionalService(ctx: any, ...names: string[]): any {\n for (const name of names) {\n try {\n const found = typeof ctx?.get === 'function' ? ctx.get(name) : undefined\n if (found !== undefined && found !== null) return found\n } catch {\n // try the next spelling\n }\n }\n return undefined\n}\n\n/** The settings form for this plugin's namespace, when one exists. */\nfunction formOf(ctx: any): any {\n const forms = optionalService(ctx, 'configForms', 'settingsScope')\n if (forms === undefined) return undefined\n try {\n if (typeof forms.get === 'function') return forms.get(NAMESPACE)\n // A settingsScope-style service is already bound to one namespace.\n if (typeof forms.getSnapshot === 'function' || typeof forms.bind === 'function') return forms\n } catch {\n return undefined\n }\n return undefined\n}\n\nfunction readConfig(ctx: any): { value: any; revision: number } {\n const form = formOf(ctx)\n if (form === undefined) return { value: {}, revision: 0 }\n try {\n const snapshot = form.getSnapshot?.()\n return {\n value: snapshot?.value ?? snapshot?.user ?? {},\n revision: snapshot?.revision ?? 0,\n }\n } catch {\n return { value: {}, revision: 0 }\n }\n}\n\nasync function writeConfig(ctx: any, ops: readonly unknown[]): Promise<void> {\n const form = formOf(ctx)\n if (typeof form?.mutate !== 'function') {\n throw new Error('dsh-provider-proxy: settings transport unavailable')\n }\n await form.mutate(ops as any[], readConfig(ctx).revision)\n}\n\n/**\n * The provider rows, read from the Host.\n *\n * This release exposes no client-facing LLM service, so the page cannot ask for\n * the directory itself. The Host serves it at this same-origin endpoint, where\n * `ctx.llm.listProviders()` / `listConfigurableProviders()` actually live. The\n * list is therefore automatic \u2014 the user never types a route id.\n *\n * Only ACTIVE routes are shown. A provider this deployment merely *offers* \u2014\n * declared but not registered, so nothing would ever be sent through it \u2014 is\n * not the user's business on this page, and listing it only invites them to\n * configure a proxy for a route that cannot be selected. A provider that is\n * already configured is kept regardless, so a saved setting never silently\n * disappears from view.\n */\nfunction knownProviders(configured: Record<string, RouteValue>, published: ProviderRow[]): ProviderRow[] {\n const rows = new Map<string, ProviderRow>()\n for (const row of published) {\n if (row.live) rows.set(row.id, row)\n }\n for (const [id, route] of Object.entries(configured)) {\n if (rows.has(id)) continue\n rows.set(id, { id, name: id, live: route?.enabled === true })\n }\n return [...rows.values()].sort(byName)\n}\n\n/**\n * Where the Host publishes the live provider catalogue.\n */\nconst CATALOG_PATH = '/dsh-provider-proxy/providers'\n\n/**\n * The setter the lazy catalogue initializer resolves through.\n *\n * It is republished after every render, so the newest one always wins, and a\n * promise that settles after an unmount writes to a harmless no-op.\n */\nlet catalogueSetter: ((rows: ProviderRow[]) => void) | undefined = () => {}\n\n/** Read the Host's provider catalogue. Same-origin, so no token is needed. */\nasync function fetchProviders(): Promise<ProviderRow[]> {\n const response = await globalThis.fetch(CATALOG_PATH, { headers: { accept: 'application/json' } })\n if (!response.ok) throw new Error(`Host answered ${response.status}`)\n const body = await response.json()\n const list = Array.isArray(body?.providers) ? body.providers : []\n return list\n .filter((row: any) => typeof row?.id === 'string' && row.id.length > 0)\n .map((row: any) => ({\n id: row.id,\n name: typeof row.name === 'string' && row.name.length > 0 ? row.name : row.id,\n live: row.live === true,\n }))\n}\n\nconst byName = (a: ProviderRow, b: ProviderRow): number => a.name.localeCompare(b.name)\n\nfunction view(route: Partial<RouteValue> | undefined): RouteValue {\n return {\n enabled: route?.enabled === true,\n protocol: PROTOCOLS.includes(route?.protocol as Protocol) ? (route!.protocol as Protocol) : 'http',\n host: route?.host ?? '',\n port: route?.port ?? 0,\n username: route?.username ?? '',\n passwordRef: route?.passwordRef ?? '',\n }\n}\n\n/** The provider directory, cached module-side. See renderPage. */\nlet directoryCache: ProviderRow[] | undefined\n\n/**\n * Everything the page learned about its own wiring, rendered verbatim.\n *\n * The browser side of a plugin has no other diagnostic channel \u2014 the Host log\n * never sees it \u2014 so a silent failure had to be diagnosed by inference. This\n * panel is what proved that `remote.settings` and `remote.llm` do not exist in\n * this release, and that the catalogue had to come from the Host endpoint.\n *\n * Cleared at the start of every render so the panel shows the CURRENT state\n * rather than an ever-growing log of the session.\n */\nlet diagnostics: string[] = []\n\nfunction note(message: string): void {\n if (!diagnostics.includes(message)) diagnostics.push(message)\n}\n\n/**\n * Layout constants, applied as INLINE styles.\n *\n * The page is rendered into the settings panel, and the CSS-Modules pipeline\n * that feeds the stylesheet has broken twice in ways that were invisible from\n * the source: the class map failed to bind at all, and a shared class prefix\n * silently merged two rules. Both left the page readable but laid out as one\n * unstyled block.\n *\n * Structure is therefore expressed as inline styles, which cannot be lost by\n * the bundle, and the stylesheet is kept for the purely decorative parts. A\n * theme token that is not defined simply resolves to `unset`, so an unknown\n * token costs colour, never layout.\n */\nconst S = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: '12px',\n maxWidth: '720px',\n },\n card: {\n display: 'flex',\n flexDirection: 'column',\n gap: '12px',\n padding: '14px 16px',\n marginBottom: '12px',\n border: '1px solid var(--dsw-alias-border-l1)',\n borderRadius: '10px',\n background: 'var(--dsw-alias-bg-layer-1)',\n },\n cardActive: {\n borderColor: 'var(--dsw-alias-state-success-primary)',\n background: 'var(--dsw-alias-bg-layer-2)',\n },\n head: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: '12px',\n },\n titles: { display: 'flex', alignItems: 'baseline', gap: '8px', minWidth: '0' },\n name: {\n fontSize: '14px',\n fontWeight: '600',\n color: 'var(--dsw-alias-label-primary)',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n },\n id: {\n flex: 'none',\n padding: '1px 6px',\n borderRadius: '4px',\n background: 'var(--dsw-alias-bg-layer-2)',\n fontFamily: 'ui-monospace, monospace',\n fontSize: '11px',\n color: 'var(--dsw-alias-label-secondary)',\n },\n pill: {\n flex: 'none',\n padding: '2px 10px',\n borderRadius: '999px',\n fontSize: '11px',\n fontWeight: '500',\n whiteSpace: 'nowrap',\n },\n pillOn: {\n background: 'var(--dsw-alias-state-success-primary)',\n color: 'var(--dsw-alias-bg-base)',\n },\n pillLive: {\n border: '1px solid var(--dsw-alias-border-l2)',\n color: 'var(--dsw-alias-label-secondary)',\n },\n pillOff: { color: 'var(--dsw-alias-state-idle-primary)' },\n toggle: {\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n fontSize: '12px',\n color: 'var(--dsw-alias-label-primary)',\n },\n field: {\n display: 'grid',\n gridTemplateColumns: '88px 1fr',\n alignItems: 'center',\n gap: '10px',\n fontSize: '12px',\n },\n label: { color: 'var(--dsw-alias-label-secondary)' },\n input: {\n boxSizing: 'border-box',\n width: '100%',\n minWidth: '0',\n padding: '6px 8px',\n border: '1px solid var(--dsw-alias-border-l1)',\n borderRadius: '6px',\n outline: 'none',\n background: 'var(--dsw-alias-bg-layer-1)',\n color: 'var(--dsw-alias-label-primary)',\n font: 'inherit',\n fontSize: '12px',\n },\n} as const\n\nfunction renderPage(ctx: any): unknown {\n const React = react()\n if (React === undefined || typeof React.createElement !== 'function') return null\n\n const h = React.createElement\n const t = stringsFor(ctx)\n diagnostics = []\n\n // `useState` is only reached after the React check, so the early return above\n // cannot desync the hooks order.\n let snapshot: { value: any; revision: number }\n try {\n snapshot = readConfig(ctx)\n } catch {\n snapshot = { value: {}, revision: 0 }\n }\n const configured = (snapshot.value?.providers ?? {}) as Record<string, RouteValue>\n note(\n formOf(ctx) === undefined\n ? '\u8BBE\u7F6E\uFF1A\u672A\u627E\u5230 configForms \u670D\u52A1\uFF0C\u53EA\u80FD\u663E\u793A\u3001\u65E0\u6CD5\u4FDD\u5B58'\n : `\u8BBE\u7F6E\uFF1A\u6B63\u5E38\uFF08\u4FEE\u8BA2\u53F7 ${snapshot.revision}\uFF0C${Object.keys(configured).length} \u4E2A provider\uFF09`,\n )\n\n // The provider catalogue comes from the Host over a same-origin endpoint, so\n // it arrives asynchronously. The initial state is a LAZY initializer, so the\n // fetch starts from `useState(() => \u2026)` instead of by calling a setter during\n // render: a render must have no side effects, and doing so also shifted the\n // hook order between passes.\n const [state, setState] = (React.useState ?? ((fn: any) => [fn(), () => {}]))(() => {\n void fetchProviders()\n .then(rows => catalogueSetter?.(rows))\n .catch((error: any) => {\n note(`provider \u5217\u8868\u83B7\u53D6\u5931\u8D25\uFF1A${error?.message ?? error}`)\n catalogueSetter?.([])\n })\n return { rows: undefined as ProviderRow[] | undefined, pending: true }\n })\n // The setter is published right after the hook so the initializer's promise\n // can reach it. It is re-published on every render, so the latest wins.\n catalogueSetter = rows => setState({ rows, pending: false })\n\n const published = state.rows ?? []\n note(\n `provider \u5217\u8868\uFF1A\u6765\u81EA Host \u5171 ${published.length} \u4E2A\uFF08${published.map((r: ProviderRow) => r.id).join('\u3001') || '\u65E0'}\uFF09`,\n )\n // Local draft, layered over the stored config.\n //\n // Without it a checkbox does not change until the panel remounts: the value\n // is read from the settings store, which only updates when the page is\n // rebuilt. The draft makes the control respond immediately, then reconciles\n // with the store so a refused write is visible rather than silently lost.\n const [draft, setDraft] = (React.useState ?? ((v: any) => [v, () => {}]))({})\n const edit = (id: string, field: string, value: unknown) =>\n setDraft((current: any) => ({ ...current, [id]: { ...current[id], [field]: value } }))\n\n const rows = knownProviders({ ...configured, ...draft }, published)\n\n /**\n * Persist one field. The control is already showing the new value, so this\n * only has to succeed quietly; a refusal is reported in the diagnostics.\n */\n const save = (id: string, field: string, value: unknown) => {\n void writeConfig(ctx, [{ op: 'set', path: ['providers', id, field], value }])\n .then(() => {\n note(`\u5DF2\u4FDD\u5B58 ${id}.${field} = ${JSON.stringify(value)}`)\n })\n .catch((error: any) => {\n note(`\u4FDD\u5B58\u5931\u8D25 ${id}.${field}\uFF1A${error?.message ?? error}`)\n // Drop the optimistic value so the stored state shows through again.\n setDraft((current: any) => {\n const next = { ...current }\n delete next[id]\n return next\n })\n })\n }\n\n /** One control: update the draft instantly, persist in the background. */\n const bind = (id: string, field: string) => (value: unknown) => {\n edit(id, field, value)\n save(id, field, value)\n }\n\n const field = (label: string, control: unknown, hint?: string): unknown =>\n h(\n 'label',\n { className: styles.field, style: S.field, key: label },\n h('span', { className: styles.label, style: S.label }, label),\n control,\n hint === undefined\n ? null\n : h(\n 'span',\n { className: styles.hint, style: { gridColumn: '2', fontSize: '11px' } },\n hint,\n ),\n )\n\n // ALWAYS an array: a single element is not iterable, and spreading one threw\n // \"Spread syntax requires ...iterable[Symbol.iterator]\" on an empty list.\n const body: unknown[] = rows.length === 0\n ? [\n h(\n 'p',\n {\n className: styles.empty,\n key: 'empty',\n style: {\n margin: '0',\n padding: '16px',\n border: '1px dashed var(--dsw-alias-border-l1)',\n borderRadius: '8px',\n fontSize: '12px',\n textAlign: 'center',\n color: 'var(--dsw-alias-state-idle-primary)',\n },\n },\n t.empty,\n ),\n ]\n : rows.map(row => {\n // The MERGED value, so a just-typed value shows immediately.\n const route = view({ ...configured[row.id], ...draft[row.id] })\n const disabled = !route.enabled\n return h(\n 'section',\n {\n className: route.enabled ? styles.cardActive : styles.card,\n style: route.enabled ? { ...S.card, ...S.cardActive } : S.card,\n key: row.id,\n },\n h(\n 'header',\n { className: styles.cardHead, style: S.head },\n h(\n 'div',\n { className: styles.cardTitles, style: S.titles },\n h('span', { className: styles.name, style: S.name }, row.name),\n h('span', { className: styles.id, style: S.id }, row.id),\n ),\n h(\n 'span',\n {\n className: route.enabled ? styles.pillOn : row.live ? styles.pillLive : styles.pillOff,\n style: {\n ...S.pill,\n ...(route.enabled ? S.pillOn : row.live ? S.pillLive : S.pillOff),\n },\n },\n route.enabled ? t.on : row.live ? t.live : t.off,\n ),\n ),\n h(\n 'label',\n { className: styles.toggle, style: S.toggle },\n h('input', {\n type: 'checkbox',\n checked: route.enabled,\n onChange: (event: any) => bind(row.id, 'enabled')(event.target.checked === true),\n }),\n h('span', null, t.useProxy),\n ),\n field(\n t.protocol,\n h(\n 'select',\n {\n className: styles.input,\n style: S.input,\n disabled,\n value: route.protocol,\n onChange: (event: any) => bind(row.id, 'protocol')(event.target.value),\n },\n ...PROTOCOLS.map(protocol =>\n h('option', { key: protocol, value: protocol }, protocol.toUpperCase()),\n ),\n ),\n route.protocol === 'socks5' ? t.socks5Unsupported : undefined,\n ),\n field(\n t.host,\n h('input', {\n className: styles.input,\n style: S.input,\n disabled,\n placeholder: '127.0.0.1',\n value: route.host,\n onChange: (event: any) => bind(row.id, 'host')(event.target.value),\n }),\n t.hostHint,\n ),\n field(\n t.port,\n h('input', {\n className: styles.input,\n style: S.input,\n disabled,\n type: 'number',\n min: 1,\n max: 65535,\n placeholder: '7890',\n value: route.port === 0 ? '' : String(route.port),\n onChange: (event: any) => {\n const parsed = Number.parseInt(event.target.value, 10)\n bind(row.id, 'port')(Number.isNaN(parsed) ? 0 : parsed)\n },\n }),\n ),\n field(\n t.username,\n h('input', {\n className: styles.input,\n style: S.input,\n disabled,\n autocomplete: 'off',\n value: route.username,\n onChange: (event: any) => bind(row.id, 'username')(event.target.value),\n }),\n ),\n )\n })\n\n return h(\n 'div',\n { className: styles.root, style: S.root },\n h('p', { className: styles.lead, style: { margin: '0 0 4px', fontSize: '12px', lineHeight: '1.6', color: 'var(--dsw-alias-label-secondary)' } }, t.lead),\n ...body,\n h(\n 'details',\n {\n className: styles.diag,\n key: 'diag',\n style: {\n marginTop: '4px',\n padding: '8px 10px',\n border: '1px solid var(--dsw-alias-border-l1)',\n borderRadius: '8px',\n fontSize: '11px',\n color: 'var(--dsw-alias-label-secondary)',\n },\n },\n h('summary', { className: styles.diagSummary }, t.diagnostics),\n h(\n 'ul',\n { className: styles.diagList, style: { margin: '6px 0 0', paddingLeft: '18px' } },\n ...(diagnostics.length === 0\n ? [h('li', { key: 'none' }, t.diagPending)]\n : diagnostics.map((line, index) => h('li', { key: `d${index}` }, line))),\n ),\n ),\n )\n}\n\nconst EN = {\n lead: 'Route selected model providers through your own forward proxy. Other providers stay direct.',\n empty: 'No providers found yet.',\n useProxy: 'Use a proxy for this provider',\n protocol: 'Type',\n host: 'IP / host',\n port: 'Port',\n username: 'Username',\n hostHint: 'Host or IP only, without scheme or path.',\n socks5Unsupported: 'SOCKS5 is not implemented yet; use HTTP or HTTPS.',\n on: 'proxied',\n live: 'active',\n off: 'direct',\n diagnostics: 'Connection diagnostics',\n diagPending: '(collecting\u2026)',\n}\n\nconst ZH = {\n lead: '\u8BA9\u6307\u5B9A\u7684 provider \u8D70\u4F60\u81EA\u5DF1\u7684\u6B63\u5411\u4EE3\u7406\uFF0C\u5176\u5B83 provider \u4FDD\u6301\u76F4\u8FDE\u3002',\n empty: '\u6CA1\u6709\u68C0\u6D4B\u5230\u4EFB\u4F55 provider\u3002',\n useProxy: '\u4E3A\u8BE5 provider \u542F\u7528\u4EE3\u7406',\n protocol: '\u7C7B\u578B',\n host: 'IP / \u4E3B\u673A',\n port: '\u7AEF\u53E3',\n username: '\u7528\u6237\u540D',\n hostHint: '\u53EA\u586B\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4E0D\u8981\u5E26\u534F\u8BAE\u524D\u7F00\u6216\u8DEF\u5F84\u3002',\n socks5Unsupported: 'SOCKS5 \u5C1A\u672A\u5B9E\u73B0\uFF0C\u8BF7\u6539\u7528 HTTP \u6216 HTTPS\u3002',\n on: '\u8D70\u4EE3\u7406',\n live: '\u542F\u7528\u4E2D',\n off: '\u76F4\u8FDE',\n diagnostics: '\u8FDE\u63A5\u8BCA\u65AD',\n diagPending: '\uFF08\u6B63\u5728\u6536\u96C6\u2026\uFF09',\n}\n\n/**\n * Pick the dictionary for this render.\n *\n * The shell's own locale dictionary wins when it carries a translated entry, so\n * the page follows the application language instead of second-guessing it.\n * Chinese is the fallback because that is the operator's language.\n */\nfunction stringsFor(ctx: any): Record<string, string> {\n const language = localeOf(ctx)\n const bundled = language === 'zh' ? ZH : EN\n const translated = ((): Record<string, string> | undefined => {\n try {\n const service = optionalService(ctx, 'locale')\n const bound = service?.bind?.('dshProviderProxy')\n const value = typeof bound === 'function' ? bound('title') : undefined\n if (typeof value === 'string' && value.length > 0) return { title: value } as never\n } catch {\n // no locale dictionary available\n }\n return undefined\n })()\n return { ...bundled, ...(translated ?? {}) }\n}\n\n/**\n * The client module system's resolver.\n *\n * The loader calls `factory(require)` and that parameter shadows Node's\n * `require` inside the emitted CJS, so this describes the module-table\n * resolver, not Node's.\n */\ndeclare function require(specifier: string): unknown\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,4BAAAA,SAAA;AAAA;AACA,QAAI,WAAW,EAAC,QAAO,iBAAgB,QAAO,iBAAgB,SAAQ,kBAAiB,QAAO,iBAAgB,cAAa,uBAAsB,YAAW,qBAAoB,cAAa,uBAAsB,QAAO,iBAAgB,MAAK,eAAc,UAAS,mBAAkB,YAAW,qBAAoB,WAAU,oBAAmB,UAAS,mBAAkB,SAAQ,kBAAiB,SAAQ,kB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EACJ,MAAM;AAAA,EACN,KAAK;AAAA,EACL,aAAa;AAAA,EACb,aAAa;AACf;AAEA,IAAM,KAAK;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,KAAK;AAAA,EACL,aAAa;AAAA,EACb,aAAa;AACf;AASA,SAAS,WAAW,KAAkC;AACpD,QAAM,WAAW,SAAS,GAAG;AAC7B,QAAM,UAAU,aAAa,OAAO,KAAK;AACzC,QAAM,cAAc,MAA0C;AAC5D,QAAI;AACF,YAAM,UAAU,gBAAgB,KAAK,QAAQ;AAC7C,YAAM,QAAQ,SAAS,OAAO,kBAAkB;AAChD,YAAM,QAAQ,OAAO,UAAU,aAAa,MAAM,OAAO,IAAI;AAC7D,UAAI,OAAO,UAAU,YAAY,MAAM,SAAS,EAAG,QAAO,EAAE,OAAO,MAAM;AAAA,IAC3E,QAAQ;AAAA,IAER;AACA,WAAO;AAAA,EACT,GAAG;AACH,SAAO,EAAE,GAAG,SAAS,GAAI,cAAc,CAAC,EAAG;AAC7C;",
|
|
4
|
+
"sourcesContent": ["\nvar __dshMap = {\"root\":\"1b9ac577_root\",\"lead\":\"4a359f22_lead\",\"empty\":\"ffd21b3b_empty\",\"card\":\"16611c9b_card\",\"cardActive\":\"2d004466_cardActive\",\"cardHead\":\"640fee25_cardHead\",\"cardTitles\":\"f6fe8b3f_cardTitles\",\"name\":\"f9d2db09_name\",\"id\":\"c90ce2e0_id\",\"pillOn\":\"75541864_pillOn\",\"pillLive\":\"3097d90f_pillLive\",\"pillOff\":\"a58f86be_pillOff\",\"toggle\":\"e5b81c4b_toggle\",\"field\":\"f4d34839_field\",\"label\":\"a4061c91_label\",\"hint\":\"13bd3ec9_hint\",\"input\":\"851d7bd9_input\",\"diag\":\"f92a10d9_diag\",\"diagSummary\":\"5b66e072_diagSummary\",\"diagList\":\"dc8d3a6f_diagList\"};\nvar __dshStyles = (globalThis.__dshPluginStyles || (globalThis.__dshPluginStyles = new Set()));\nif (!__dshStyles.has(\"dsh-provider-proxy/client.css\")) {\n __dshStyles.add(\"dsh-provider-proxy/client.css\");\n var __dshStyle = document.createElement('style');\n __dshStyle.setAttribute('data-plugin-css', \"dsh-provider-proxy/client.css\");\n __dshStyle.textContent = \"/* dsh-provider-proxy \u2014 provider proxy settings page.\\n Tokens only: no literal colours, matching the shared --dsw-* system. */\\n\\n.1b9ac577_root {\\n display: flex;\\n flex-direction: column;\\n gap: 12px;\\n max-width: 640px;\\n}\\n\\n.4a359f22_lead {\\n margin: 0 0 4px;\\n font-size: 12px;\\n line-height: 1.6;\\n color: var(--dsw-alias-label-secondary);\\n}\\n\\n.ffd21b3b_empty {\\n margin: 0;\\n padding: 16px;\\n border: 1px dashed var(--dsw-alias-border-l1);\\n border-radius: 8px;\\n font-size: 12px;\\n text-align: center;\\n color: var(--dsw-alias-state-idle-primary);\\n}\\n\\n/* ---- provider card ---- */\\n\\n.16611c9b_card,\\n.2d004466_cardActive {\\n display: flex;\\n flex-direction: column;\\n gap: 10px;\\n padding: 12px 14px;\\n border: 1px solid var(--dsw-alias-border-l1);\\n border-radius: 10px;\\n background: var(--dsw-alias-bg-layer-1);\\n}\\n\\n.2d004466_cardActive {\\n border-color: var(--dsw-alias-state-success-primary);\\n background: var(--dsw-alias-bg-layer-2);\\n}\\n\\n.640fee25_cardHead {\\n display: flex;\\n align-items: center;\\n justify-content: space-between;\\n gap: 12px;\\n}\\n\\n.f6fe8b3f_cardTitles {\\n display: flex;\\n align-items: baseline;\\n gap: 8px;\\n min-width: 0;\\n}\\n\\n.f9d2db09_name {\\n overflow: hidden;\\n font-size: 13px;\\n font-weight: 600;\\n white-space: nowrap;\\n text-overflow: ellipsis;\\n color: var(--dsw-alias-label-primary);\\n}\\n\\n.c90ce2e0_id {\\n flex: none;\\n padding: 1px 6px;\\n border-radius: 4px;\\n background: var(--dsw-alias-bg-layer-2);\\n font-family: ui-monospace, monospace;\\n font-size: 11px;\\n color: var(--dsw-alias-label-secondary);\\n}\\n\\n/* ---- status pill ---- */\\n\\n.75541864_pillOn,\\n.3097d90f_pillLive,\\n.a58f86be_pillOff {\\n flex: none;\\n padding: 2px 8px;\\n border-radius: 999px;\\n font-size: 11px;\\n font-weight: 500;\\n white-space: nowrap;\\n}\\n\\n.75541864_pillOn {\\n background: var(--dsw-alias-state-success-primary);\\n color: var(--dsw-alias-bg-base);\\n}\\n\\n.3097d90f_pillLive {\\n border: 1px solid var(--dsw-alias-border-l2);\\n color: var(--dsw-alias-label-secondary);\\n}\\n\\n.a58f86be_pillOff {\\n color: var(--dsw-alias-state-idle-primary);\\n}\\n\\n/* ---- toggle ---- */\\n\\n.e5b81c4b_toggle {\\n display: flex;\\n align-items: center;\\n gap: 8px;\\n padding-top: 2px;\\n font-size: 12px;\\n color: var(--dsw-alias-label-primary);\\n cursor: pointer;\\n}\\n\\n.e5b81c4b_toggle input {\\n accent-color: var(--dsw-alias-brand-primary);\\n cursor: pointer;\\n}\\n\\n/* ---- fields ---- */\\n\\n.f4d34839_field {\\n display: grid;\\n grid-template-columns: 96px 1fr;\\n align-items: center;\\n gap: 10px;\\n font-size: 12px;\\n}\\n\\n.a4061c91_label {\\n color: var(--dsw-alias-label-secondary);\\n}\\n\\n.13bd3ec9_hint {\\n grid-column: 2;\\n margin-top: -2px;\\n font-size: 11px;\\n color: var(--dsw-alias-state-warn-primary);\\n}\\n\\n.851d7bd9_input {\\n box-sizing: border-box;\\n width: 100%;\\n min-width: 0;\\n padding: 5px 8px;\\n border: 1px solid var(--dsw-alias-border-l1);\\n border-radius: 6px;\\n outline: none;\\n background: var(--dsw-alias-bg-layer-1);\\n color: var(--dsw-alias-label-primary);\\n font: inherit;\\n font-size: 12px;\\n transition: border-color 120ms ease, background 120ms ease;\\n}\\n\\n.851d7bd9_input:hover:not(:disabled) {\\n border-color: var(--dsw-alias-border-l2);\\n}\\n\\n.851d7bd9_input:focus {\\n border-color: var(--dsw-alias-brand-primary);\\n}\\n\\n.851d7bd9_input:disabled {\\n color: var(--dsw-alias-state-idle-primary);\\n background: var(--dsw-alias-bg-layer-2);\\n cursor: not-allowed;\\n}\\n\\n/* ---- diagnostics ---- */\\n\\n.f92a10d9_diag {\\n margin-top: 2px;\\n padding: 8px 10px;\\n border: 1px solid var(--dsw-alias-border-l1);\\n border-radius: 8px;\\n font-size: 11px;\\n color: var(--dsw-alias-label-secondary);\\n}\\n\\n.5b66e072_diagSummary {\\n cursor: pointer;\\n color: var(--dsw-alias-state-warn-primary);\\n}\\n\\n.dc8d3a6f_diagList {\\n margin: 6px 0 0;\\n padding-left: 18px;\\n font-family: ui-monospace, monospace;\\n word-break: break-all;\\n}\\n\";\n document.head.appendChild(__dshStyle);\n}\nmodule.exports = __dshMap;\nmodule.exports.default = __dshMap;\nmodule.exports.__esModule = true;\n", "/**\r\n * dsh-provider-proxy \u2014 browser half.\r\n *\r\n * Contributes ONE settings page (a `settings.section` list entry) that lists\r\n * every known provider with its proxy switch, type, host, port and username.\r\n *\r\n * This replaces an earlier attempt to render into each provider card on the\r\n * Models page (`settings.models.provider-card`). That seat is keyed and\r\n * dispatched per provider namespace, and a third-party registration never\r\n * matched it on this build: no error, no request, simply no output. A\r\n * `settings.section` entry is a plain list contribution with an `id`, which is\r\n * the shape the shipped `dsh-llm-retry-settings` plugin uses successfully in\r\n * this same desktop profile.\r\n *\r\n * The whole bundle runs inside the client module system's lazy-CJS factory:\r\n * executing the script only REGISTERS the factory, and every side effect\r\n * (including the CSS injection) happens at materialization.\r\n */\r\n\r\n// The CSS-Modules build turns this sheet into a hashed class map AND injects it\r\n// at materialization. The binding is what the component reads; importing it for\r\n// side effects only would leave `styles` undefined at render time.\r\nimport styles from './client.css'\r\n\r\ntype Protocol = 'http' | 'https' | 'socks5'\r\n\r\ntype RouteValue = {\r\n enabled: boolean\r\n protocol: Protocol\r\n host: string\r\n port: number\r\n username: string\r\n password: string\r\n}\r\n\r\n/** The provider rows we know about, and which of them are actually live. */\r\ntype ProviderRow = { id: string; name: string; live: boolean }\r\n\r\n/**\r\n * React, resolved from the client module table.\r\n *\r\n * React is NOT a Cordis service and is not reachable from `ctx` \u2014 reading it\r\n * there produced a silently null component. The module table is the only route:\r\n * the build leaves `react` external, so this compiles to a `require(\"react\")`\r\n * inside the factory closure, answered from the shell-seeded baseline.\r\n *\r\n * Resolved lazily on first render so merely REGISTERING the bundle \u2014 which is\r\n * all a script evaluation does \u2014 never materializes React.\r\n */\r\nlet ReactCache: unknown\r\n\r\nfunction react(): any {\r\n if (ReactCache === undefined) {\r\n ReactCache = ((): unknown => {\r\n try {\r\n return require('react')\r\n } catch {\r\n return (globalThis as Record<string, unknown>).React\r\n }\r\n })()\r\n }\r\n return ReactCache\r\n}\r\n\r\nconst PROTOCOLS: Protocol[] = ['http', 'https', 'socks5']\r\n\r\n/** Our own settings namespace; the profile entry id created by the bundle patch. */\r\nconst NAMESPACE = 'provider-proxy'\r\n\r\n/**\r\n * Cordis services this half needs.\r\n *\r\n * ONLY `slots` is declared. That is the complete set this release actually\r\n * offers on a client fiber: `layout, locale, sessions, slots, theme, timer,\r\n * uiWorkspace, workspaces`.\r\n *\r\n * A declared service that never arrives leaves the fiber PENDING forever, and\r\n * that is NOT a client-only failure \u2014 it is reported as\r\n * web boot: 1 entry did not activate\r\n * dsh-provider-proxy: pending (waiting for service: settingsScope)\r\n * which fails the whole Desktop boot. `settingsScope` and `configForms` were\r\n * both guessed and both are absent here, so neither may be declared.\r\n *\r\n * Settings are therefore reached through `ctx.get(name)` \u2014 the framework's own\r\n * non-throwing lookup \u2014 and the page degrades to read-only when it is absent.\r\n */\r\nconst PLUGINS = ['slots']\r\n\r\nexport const inject = PLUGINS\r\n\r\nexport function apply(ctx: any): void {\r\n // The settings shell declares `settings.section` on its own fiber, so\r\n // `slots.inject` waits for that declaration and the contribution is removed\r\n // when the panel is torn down.\r\n ctx.slots.inject('settings.section', () =>\r\n ctx.slots.register(\r\n {\r\n name: 'settings.section',\r\n id: NAMESPACE,\r\n order: 20,\r\n label: () => (localeOf(ctx) === 'zh' ? 'Provider \u4EE3\u7406' : 'Provider \u4EE3\u7406'),\r\n },\r\n () => renderPage(ctx),\r\n ),\r\n )\r\n}\r\n\r\n/**\r\n * Pick the dictionary.\r\n *\r\n * Chinese is the default, not English: this plugin is written for a\r\n * Chinese-speaking operator, and a page that renders in the wrong language is\r\n * worse than one that never matches the shell's locale.\r\n *\r\n * `ctx.locale` is not injected \u2014 declaring a service that this release does not\r\n * provide left the fiber PENDING and failed the whole Desktop boot \u2014 so the\r\n * locale is probed with the non-throwing `ctx.get`, then the browser's own\r\n * language, and only then English.\r\n */\r\nfunction localeOf(ctx: any): string {\r\n try {\r\n const service = optionalService(ctx, 'locale')\r\n const snapshot = service?.getSnapshot?.() ?? service?.getLocale?.()\r\n const id = typeof snapshot?.locale === 'string' ? snapshot.locale : undefined\r\n if (id !== undefined) return id.toLowerCase().startsWith('zh') ? 'zh' : 'en'\r\n } catch {\r\n // fall through to the browser language\r\n }\r\n const browser = globalThis.navigator?.language\r\n if (typeof browser === 'string' && browser.toLowerCase().startsWith('zh')) return 'zh'\r\n return browser === undefined ? 'zh' : 'en'\r\n}\r\n\r\n/**\r\n * Look a service up WITHOUT declaring it in `inject`.\r\n *\r\n * `ctx.get(name)` is the framework's own optional lookup: it returns undefined\r\n * instead of throwing, and \u2014 unlike a declared service \u2014 it cannot leave the\r\n * fiber PENDING. That is what makes an optional integration safe here: this\r\n * release has no settings service at all, so the page simply shows its fields\r\n * and reports that saving is unavailable.\r\n */\r\nfunction optionalService(ctx: any, ...names: string[]): any {\r\n for (const name of names) {\r\n try {\r\n const found = typeof ctx?.get === 'function' ? ctx.get(name) : undefined\r\n if (found !== undefined && found !== null) return found\r\n } catch {\r\n // try the next spelling\r\n }\r\n }\r\n return undefined\r\n}\r\n\r\n/** The settings form for this plugin's namespace, when one exists. */\r\nfunction formOf(ctx: any): any {\r\n const forms = optionalService(ctx, 'configForms', 'settingsScope')\r\n if (forms === undefined) return undefined\r\n try {\r\n if (typeof forms.get === 'function') return forms.get(NAMESPACE)\r\n // A settingsScope-style service is already bound to one namespace.\r\n if (typeof forms.getSnapshot === 'function' || typeof forms.bind === 'function') return forms\r\n } catch {\r\n return undefined\r\n }\r\n return undefined\r\n}\r\n\r\nfunction readConfig(ctx: any): { value: any; revision: number } {\r\n const form = formOf(ctx)\r\n if (form === undefined) return { value: {}, revision: 0 }\r\n try {\r\n const snapshot = form.getSnapshot?.()\r\n return {\r\n value: snapshot?.value ?? snapshot?.user ?? {},\r\n revision: snapshot?.revision ?? 0,\r\n }\r\n } catch {\r\n return { value: {}, revision: 0 }\r\n }\r\n}\r\n\r\nasync function writeConfig(ctx: any, ops: readonly unknown[]): Promise<void> {\r\n const form = formOf(ctx)\r\n if (typeof form?.mutate !== 'function') {\r\n throw new Error('dsh-provider-proxy: settings transport unavailable')\r\n }\r\n await form.mutate(ops as any[], readConfig(ctx).revision)\r\n}\r\n\r\n/**\r\n * The provider rows, read from the Host.\r\n *\r\n * This release exposes no client-facing LLM service, so the page cannot ask for\r\n * the directory itself. The Host serves it at this same-origin endpoint, where\r\n * `ctx.llm.listProviders()` / `listConfigurableProviders()` actually live. The\r\n * list is therefore automatic \u2014 the user never types a route id.\r\n *\r\n * Only ACTIVE routes are shown. A provider this deployment merely *offers* \u2014\r\n * declared but not registered, so nothing would ever be sent through it \u2014 is\r\n * not the user's business on this page, and listing it only invites them to\r\n * configure a proxy for a route that cannot be selected. A provider that is\r\n * already configured is kept regardless, so a saved setting never silently\r\n * disappears from view.\r\n */\r\nfunction knownProviders(configured: Record<string, RouteValue>, published: ProviderRow[]): ProviderRow[] {\r\n const rows = new Map<string, ProviderRow>()\r\n for (const row of published) {\r\n if (row.live) rows.set(row.id, row)\r\n }\r\n for (const [id, route] of Object.entries(configured)) {\r\n if (rows.has(id)) continue\r\n rows.set(id, { id, name: id, live: route?.enabled === true })\r\n }\r\n return [...rows.values()].sort(byName)\r\n}\r\n\r\n/**\r\n * Where the Host publishes the live provider catalogue.\r\n */\r\nconst CATALOG_PATH = '/dsh-provider-proxy/providers'\r\n\r\n/**\r\n * The setter the lazy catalogue initializer resolves through.\r\n *\r\n * It is republished after every render, so the newest one always wins, and a\r\n * promise that settles after an unmount writes to a harmless no-op.\r\n */\r\nlet catalogueSetter: ((rows: ProviderRow[]) => void) | undefined = () => {}\r\n\r\n/** Read the Host's provider catalogue. Same-origin, so no token is needed. */\r\nasync function fetchProviders(): Promise<ProviderRow[]> {\r\n const response = await globalThis.fetch(CATALOG_PATH, { headers: { accept: 'application/json' } })\r\n if (!response.ok) throw new Error(`Host answered ${response.status}`)\r\n const body = await response.json()\r\n const list = Array.isArray(body?.providers) ? body.providers : []\r\n return list\r\n .filter((row: any) => typeof row?.id === 'string' && row.id.length > 0)\r\n .map((row: any) => ({\r\n id: row.id,\r\n name: typeof row.name === 'string' && row.name.length > 0 ? row.name : row.id,\r\n live: row.live === true,\r\n }))\r\n}\r\n\r\nconst byName = (a: ProviderRow, b: ProviderRow): number => a.name.localeCompare(b.name)\r\n\r\nfunction view(route: Partial<RouteValue> | undefined): RouteValue {\r\n return {\r\n enabled: route?.enabled === true,\r\n protocol: PROTOCOLS.includes(route?.protocol as Protocol) ? (route!.protocol as Protocol) : 'http',\r\n host: route?.host ?? '',\r\n port: route?.port ?? 0,\r\n username: route?.username ?? '',\r\n password: route?.password ?? '',\r\n }\r\n}\r\n\r\n/** The provider directory, cached module-side. See renderPage. */\r\nlet directoryCache: ProviderRow[] | undefined\r\n\r\n/**\r\n * Everything the page learned about its own wiring, rendered verbatim.\r\n *\r\n * The browser side of a plugin has no other diagnostic channel \u2014 the Host log\r\n * never sees it \u2014 so a silent failure had to be diagnosed by inference. This\r\n * panel is what proved that `remote.settings` and `remote.llm` do not exist in\r\n * this release, and that the catalogue had to come from the Host endpoint.\r\n *\r\n * Cleared at the start of every render so the panel shows the CURRENT state\r\n * rather than an ever-growing log of the session.\r\n */\r\nlet diagnostics: string[] = []\r\n\r\nfunction note(message: string): void {\r\n if (!diagnostics.includes(message)) diagnostics.push(message)\r\n}\r\n\r\n/**\r\n * Layout constants, applied as INLINE styles.\r\n *\r\n * The page is rendered into the settings panel, and the CSS-Modules pipeline\r\n * that feeds the stylesheet has broken twice in ways that were invisible from\r\n * the source: the class map failed to bind at all, and a shared class prefix\r\n * silently merged two rules. Both left the page readable but laid out as one\r\n * unstyled block.\r\n *\r\n * Structure is therefore expressed as inline styles, which cannot be lost by\r\n * the bundle, and the stylesheet is kept for the purely decorative parts. A\r\n * theme token that is not defined simply resolves to `unset`, so an unknown\r\n * token costs colour, never layout.\r\n */\r\nconst S = {\r\n root: {\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: '12px',\r\n maxWidth: '720px',\r\n },\r\n card: {\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: '12px',\r\n padding: '14px 16px',\r\n marginBottom: '12px',\r\n border: '1px solid var(--dsw-alias-border-l1)',\r\n borderRadius: '10px',\r\n background: 'var(--dsw-alias-bg-layer-1)',\r\n },\r\n cardActive: {\r\n borderColor: 'var(--dsw-alias-state-success-primary)',\r\n background: 'var(--dsw-alias-bg-layer-2)',\r\n },\r\n head: {\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'space-between',\r\n gap: '12px',\r\n },\r\n titles: { display: 'flex', alignItems: 'baseline', gap: '8px', minWidth: '0' },\r\n name: {\r\n fontSize: '14px',\r\n fontWeight: '600',\r\n color: 'var(--dsw-alias-label-primary)',\r\n overflow: 'hidden',\r\n textOverflow: 'ellipsis',\r\n whiteSpace: 'nowrap',\r\n },\r\n id: {\r\n flex: 'none',\r\n padding: '1px 6px',\r\n borderRadius: '4px',\r\n background: 'var(--dsw-alias-bg-layer-2)',\r\n fontFamily: 'ui-monospace, monospace',\r\n fontSize: '11px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n },\r\n pill: {\r\n flex: 'none',\r\n padding: '2px 10px',\r\n borderRadius: '999px',\r\n fontSize: '11px',\r\n fontWeight: '500',\r\n whiteSpace: 'nowrap',\r\n },\r\n pillOn: {\r\n background: 'var(--dsw-alias-state-success-primary)',\r\n color: 'var(--dsw-alias-bg-base)',\r\n },\r\n pillLive: {\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n },\r\n pillOff: { color: 'var(--dsw-alias-state-idle-primary)' },\r\n toggle: {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: '8px',\r\n fontSize: '12px',\r\n color: 'var(--dsw-alias-label-primary)',\r\n },\r\n field: {\r\n display: 'grid',\r\n gridTemplateColumns: '88px 1fr',\r\n alignItems: 'center',\r\n gap: '10px',\r\n fontSize: '12px',\r\n },\r\n label: { color: 'var(--dsw-alias-label-secondary)' },\r\n input: {\r\n boxSizing: 'border-box',\r\n width: '100%',\r\n minWidth: '0',\r\n padding: '6px 8px',\r\n border: '1px solid var(--dsw-alias-border-l1)',\r\n borderRadius: '6px',\r\n outline: 'none',\r\n background: 'var(--dsw-alias-bg-layer-1)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n font: 'inherit',\r\n fontSize: '12px',\r\n },\r\n} as const\r\n\r\nfunction renderPage(ctx: any): unknown {\r\n const React = react()\r\n if (React === undefined || typeof React.createElement !== 'function') return null\r\n\r\n const h = React.createElement\r\n const t = stringsFor(ctx)\r\n diagnostics = []\r\n\r\n // `useState` is only reached after the React check, so the early return above\r\n // cannot desync the hooks order.\r\n let snapshot: { value: any; revision: number }\r\n try {\r\n snapshot = readConfig(ctx)\r\n } catch {\r\n snapshot = { value: {}, revision: 0 }\r\n }\r\n const configured = (snapshot.value?.providers ?? {}) as Record<string, RouteValue>\r\n note(\r\n formOf(ctx) === undefined\r\n ? '\u8BBE\u7F6E\uFF1A\u672A\u627E\u5230 configForms \u670D\u52A1\uFF0C\u53EA\u80FD\u663E\u793A\u3001\u65E0\u6CD5\u4FDD\u5B58'\r\n : `\u8BBE\u7F6E\uFF1A\u6B63\u5E38\uFF08\u4FEE\u8BA2\u53F7 ${snapshot.revision}\uFF0C${Object.keys(configured).length} \u4E2A provider\uFF09`,\r\n )\r\n\r\n // The provider catalogue comes from the Host over a same-origin endpoint, so\r\n // it arrives asynchronously. The initial state is a LAZY initializer, so the\r\n // fetch starts from `useState(() => \u2026)` instead of by calling a setter during\r\n // render: a render must have no side effects, and doing so also shifted the\r\n // hook order between passes.\r\n const [state, setState] = (React.useState ?? ((fn: any) => [fn(), () => {}]))(() => {\r\n void fetchProviders()\r\n .then(rows => catalogueSetter?.(rows))\r\n .catch((error: any) => {\r\n note(`provider \u5217\u8868\u83B7\u53D6\u5931\u8D25\uFF1A${error?.message ?? error}`)\r\n catalogueSetter?.([])\r\n })\r\n return { rows: undefined as ProviderRow[] | undefined, pending: true }\r\n })\r\n // The setter is published right after the hook so the initializer's promise\r\n // can reach it. It is re-published on every render, so the latest wins.\r\n catalogueSetter = rows => setState({ rows, pending: false })\r\n\r\n const published = state.rows ?? []\r\n note(\r\n `provider \u5217\u8868\uFF1A\u6765\u81EA Host \u5171 ${published.length} \u4E2A\uFF08${published.map((r: ProviderRow) => r.id).join('\u3001') || '\u65E0'}\uFF09`,\r\n )\r\n // Local draft, layered over the stored config.\r\n //\r\n // Without it a checkbox does not change until the panel remounts: the value\r\n // is read from the settings store, which only updates when the page is\r\n // rebuilt. The draft makes the control respond immediately, then reconciles\r\n // with the store so a refused write is visible rather than silently lost.\r\n const [draft, setDraft] = (React.useState ?? ((v: any) => [v, () => {}]))({})\r\n const edit = (id: string, field: string, value: unknown) =>\r\n setDraft((current: any) => ({ ...current, [id]: { ...current[id], [field]: value } }))\r\n\r\n const rows = knownProviders({ ...configured, ...draft }, published)\r\n\r\n /**\r\n * Persist one field. The control is already showing the new value, so this\r\n * only has to succeed quietly; a refusal is reported in the diagnostics.\r\n */\r\n const save = (id: string, field: string, value: unknown) => {\r\n void writeConfig(ctx, [{ op: 'set', path: ['providers', id, field], value }])\r\n .then(() => {\r\n note(`\u5DF2\u4FDD\u5B58 ${id}.${field} = ${JSON.stringify(value)}`)\r\n })\r\n .catch((error: any) => {\r\n note(`\u4FDD\u5B58\u5931\u8D25 ${id}.${field}\uFF1A${error?.message ?? error}`)\r\n // Drop the optimistic value so the stored state shows through again.\r\n setDraft((current: any) => {\r\n const next = { ...current }\r\n delete next[id]\r\n return next\r\n })\r\n })\r\n }\r\n\r\n /** One control: update the draft instantly, persist in the background. */\r\n const bind = (id: string, field: string) => (value: unknown) => {\r\n edit(id, field, value)\r\n save(id, field, value)\r\n }\r\n\r\n const field = (label: string, control: unknown, hint?: string): unknown =>\r\n h(\r\n 'label',\r\n { className: styles.field, style: S.field, key: label },\r\n h('span', { className: styles.label, style: S.label }, label),\r\n control,\r\n hint === undefined\r\n ? null\r\n : h(\r\n 'span',\r\n { className: styles.hint, style: { gridColumn: '2', fontSize: '11px' } },\r\n hint,\r\n ),\r\n )\r\n\r\n // ALWAYS an array: a single element is not iterable, and spreading one threw\r\n // \"Spread syntax requires ...iterable[Symbol.iterator]\" on an empty list.\r\n const body: unknown[] = rows.length === 0\r\n ? [\r\n h(\r\n 'p',\r\n {\r\n className: styles.empty,\r\n key: 'empty',\r\n style: {\r\n margin: '0',\r\n padding: '16px',\r\n border: '1px dashed var(--dsw-alias-border-l1)',\r\n borderRadius: '8px',\r\n fontSize: '12px',\r\n textAlign: 'center',\r\n color: 'var(--dsw-alias-state-idle-primary)',\r\n },\r\n },\r\n t.empty,\r\n ),\r\n ]\r\n : rows.map(row => {\r\n // The MERGED value, so a just-typed value shows immediately.\r\n const route = view({ ...configured[row.id], ...draft[row.id] })\r\n const disabled = !route.enabled\r\n return h(\r\n 'section',\r\n {\r\n className: route.enabled ? styles.cardActive : styles.card,\r\n style: route.enabled ? { ...S.card, ...S.cardActive } : S.card,\r\n key: row.id,\r\n },\r\n h(\r\n 'header',\r\n { className: styles.cardHead, style: S.head },\r\n h(\r\n 'div',\r\n { className: styles.cardTitles, style: S.titles },\r\n h('span', { className: styles.name, style: S.name }, row.name),\r\n h('span', { className: styles.id, style: S.id }, row.id),\r\n ),\r\n h(\r\n 'span',\r\n {\r\n className: route.enabled ? styles.pillOn : row.live ? styles.pillLive : styles.pillOff,\r\n style: {\r\n ...S.pill,\r\n ...(route.enabled ? S.pillOn : row.live ? S.pillLive : S.pillOff),\r\n },\r\n },\r\n route.enabled ? t.on : row.live ? t.live : t.off,\r\n ),\r\n ),\r\n h(\r\n 'label',\r\n { className: styles.toggle, style: S.toggle },\r\n h('input', {\r\n type: 'checkbox',\r\n checked: route.enabled,\r\n onChange: (event: any) => bind(row.id, 'enabled')(event.target.checked === true),\r\n }),\r\n h('span', null, t.useProxy),\r\n ),\r\n field(\r\n t.protocol,\r\n h(\r\n 'select',\r\n {\r\n className: styles.input,\r\n style: S.input,\r\n disabled,\r\n value: route.protocol,\r\n onChange: (event: any) => bind(row.id, 'protocol')(event.target.value),\r\n },\r\n ...PROTOCOLS.map(protocol =>\r\n h('option', { key: protocol, value: protocol }, protocol.toUpperCase()),\r\n ),\r\n ),\r\n route.protocol === 'socks5' ? t.socks5Hint : undefined,\r\n ),\r\n field(\r\n t.host,\r\n h('input', {\r\n className: styles.input,\r\n style: S.input,\r\n disabled,\r\n placeholder: '127.0.0.1',\r\n value: route.host,\r\n onChange: (event: any) => bind(row.id, 'host')(event.target.value),\r\n }),\r\n t.hostHint,\r\n ),\r\n field(\r\n t.port,\r\n h('input', {\r\n className: styles.input,\r\n style: S.input,\r\n disabled,\r\n type: 'number',\r\n min: 1,\r\n max: 65535,\r\n placeholder: '7890',\r\n value: route.port === 0 ? '' : String(route.port),\r\n onChange: (event: any) => {\r\n const parsed = Number.parseInt(event.target.value, 10)\r\n bind(row.id, 'port')(Number.isNaN(parsed) ? 0 : parsed)\r\n },\r\n }),\r\n ),\r\n field(\r\n t.username,\r\n h('input', {\r\n className: styles.input,\r\n style: S.input,\r\n disabled,\r\n autocomplete: 'off',\r\n value: route.username,\r\n onChange: (event: any) => bind(row.id, 'username')(event.target.value),\r\n }),\r\n ),\r\n // Only SOCKS5 authenticates in-band, so only SOCKS5 shows this field.\r\n //\r\n // The password is stored on the route and therefore written into the\r\n // settings file with the rest of the config. It is handed to\r\n // Socks5ProxyAgent as an option, never embedded in the proxy URL that\r\n // the diagnostics surface.\r\n route.protocol === 'socks5'\r\n ? field(\r\n t.password,\r\n h('input', {\r\n className: styles.input,\r\n style: S.input,\r\n disabled,\r\n type: 'password',\r\n autocomplete: 'off',\r\n value: route.password,\r\n onChange: (event: any) => bind(row.id, 'password')(event.target.value),\r\n }),\r\n t.passwordHint,\r\n )\r\n : undefined,\r\n )\r\n })\r\n\r\n return h(\r\n 'div',\r\n { className: styles.root, style: S.root },\r\n h('p', { className: styles.lead, style: { margin: '0 0 4px', fontSize: '12px', lineHeight: '1.6', color: 'var(--dsw-alias-label-secondary)' } }, t.lead),\r\n ...body,\r\n h(\r\n 'details',\r\n {\r\n className: styles.diag,\r\n key: 'diag',\r\n style: {\r\n marginTop: '4px',\r\n padding: '8px 10px',\r\n border: '1px solid var(--dsw-alias-border-l1)',\r\n borderRadius: '8px',\r\n fontSize: '11px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n },\r\n },\r\n h('summary', { className: styles.diagSummary }, t.diagnostics),\r\n h(\r\n 'ul',\r\n { className: styles.diagList, style: { margin: '6px 0 0', paddingLeft: '18px' } },\r\n ...(diagnostics.length === 0\r\n ? [h('li', { key: 'none' }, t.diagPending)]\r\n : diagnostics.map((line, index) => h('li', { key: `d${index}` }, line))),\r\n ),\r\n ),\r\n )\r\n}\r\n\r\nconst EN = {\r\n lead: 'Route selected model providers through your own forward proxy. Other providers stay direct.',\r\n empty: 'No providers found yet.',\r\n useProxy: 'Use a proxy for this provider',\r\n protocol: 'Type',\r\n host: 'IP / host',\r\n port: 'Port',\r\n username: 'Username',\r\n password: 'Password',\r\n hostHint: 'Host or IP only, without scheme or path.',\r\n passwordHint: 'Sent to the SOCKS5 proxy for authentication; stored with this setting.',\r\n socks5Hint: 'SOCKS5 tunnels the connection; the proxy resolves the target host name.',\r\n on: 'proxied',\r\n live: 'active',\r\n off: 'direct',\r\n diagnostics: 'Connection diagnostics',\r\n diagPending: '(collecting\u2026)',\r\n}\r\n\r\nconst ZH = {\r\n lead: '\u8BA9\u6307\u5B9A\u7684 provider \u8D70\u4F60\u81EA\u5DF1\u7684\u6B63\u5411\u4EE3\u7406\uFF0C\u5176\u5B83 provider \u4FDD\u6301\u76F4\u8FDE\u3002',\r\n empty: '\u6CA1\u6709\u68C0\u6D4B\u5230\u4EFB\u4F55 provider\u3002',\r\n useProxy: '\u4E3A\u8BE5 provider \u542F\u7528\u4EE3\u7406',\r\n protocol: '\u7C7B\u578B',\r\n host: 'IP / \u4E3B\u673A',\r\n port: '\u7AEF\u53E3',\r\n username: '\u7528\u6237\u540D',\r\n password: '\u5BC6\u7801',\r\n hostHint: '\u53EA\u586B\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4E0D\u8981\u5E26\u534F\u8BAE\u524D\u7F00\u6216\u8DEF\u5F84\u3002',\r\n passwordHint: '\u4EC5\u4F5C\u4E3A SOCKS5 \u8BA4\u8BC1\u53E3\u4EE4\u53D1\u9001\u7ED9\u4EE3\u7406\uFF1B\u968F\u8BE5\u8BBE\u7F6E\u4E00\u8D77\u4FDD\u5B58\u3002',\r\n socks5Hint: 'SOCKS5 \u4F1A\u5EFA\u7ACB\u96A7\u9053\uFF0C\u76EE\u6807\u57DF\u540D\u7531\u4EE3\u7406\u7AEF\u89E3\u6790\u3002',\r\n on: '\u8D70\u4EE3\u7406',\r\n live: '\u542F\u7528\u4E2D',\r\n off: '\u76F4\u8FDE',\r\n diagnostics: '\u8FDE\u63A5\u8BCA\u65AD',\r\n diagPending: '\uFF08\u6B63\u5728\u6536\u96C6\u2026\uFF09',\r\n}\r\n\r\n/**\r\n * Pick the dictionary for this render.\r\n *\r\n * The shell's own locale dictionary wins when it carries a translated entry, so\r\n * the page follows the application language instead of second-guessing it.\r\n * Chinese is the fallback because that is the operator's language.\r\n */\r\nfunction stringsFor(ctx: any): Record<string, string> {\r\n const language = localeOf(ctx)\r\n const bundled = language === 'zh' ? ZH : EN\r\n const translated = ((): Record<string, string> | undefined => {\r\n try {\r\n const service = optionalService(ctx, 'locale')\r\n const bound = service?.bind?.('dshProviderProxy')\r\n const value = typeof bound === 'function' ? bound('title') : undefined\r\n if (typeof value === 'string' && value.length > 0) return { title: value } as never\r\n } catch {\r\n // no locale dictionary available\r\n }\r\n return undefined\r\n })()\r\n return { ...bundled, ...(translated ?? {}) }\r\n}\r\n\r\n/**\r\n * The client module system's resolver.\r\n *\r\n * The loader calls `factory(require)` and that parameter shadows Node's\r\n * `require` inside the emitted CJS, so this describes the module-table\r\n * resolver, not Node's.\r\n */\r\ndeclare function require(specifier: string): unknown\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,4BAAAA,SAAA;AAAA;AACA,QAAI,WAAW,EAAC,QAAO,iBAAgB,QAAO,iBAAgB,SAAQ,kBAAiB,QAAO,iBAAgB,cAAa,uBAAsB,YAAW,qBAAoB,cAAa,uBAAsB,QAAO,iBAAgB,MAAK,eAAc,UAAS,mBAAkB,YAAW,qBAAoB,WAAU,oBAAmB,UAAS,mBAAkB,SAAQ,kBAAiB,SAAQ,kBAAiB,QAAO,iBAAgB,SAAQ,kBAAiB,QAAO,iBAAgB,eAAc,wBAAuB,YAAW,oBAAmB;AAC3iB,QAAI,cAAe,WAAW,sBAAsB,WAAW,oBAAoB,oBAAI,IAAI;AAC3F,QAAI,CAAC,YAAY,IAAI,+BAA+B,GAAG;AACrD,kBAAY,IAAI,+BAA+B;AAC3C,mBAAa,SAAS,cAAc,OAAO;AAC/C,iBAAW,aAAa,mBAAmB,+BAA+B;AAC1E,iBAAW,cAAc;AACzB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;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,KAAK;AAAA,EACL,aAAa;AAAA,EACb,aAAa;AACf;AAEA,IAAM,KAAK;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,KAAK;AAAA,EACL,aAAa;AAAA,EACb,aAAa;AACf;AASA,SAAS,WAAW,KAAkC;AACpD,QAAM,WAAW,SAAS,GAAG;AAC7B,QAAM,UAAU,aAAa,OAAO,KAAK;AACzC,QAAM,cAAc,MAA0C;AAC5D,QAAI;AACF,YAAM,UAAU,gBAAgB,KAAK,QAAQ;AAC7C,YAAM,QAAQ,SAAS,OAAO,kBAAkB;AAChD,YAAM,QAAQ,OAAO,UAAU,aAAa,MAAM,OAAO,IAAI;AAC7D,UAAI,OAAO,UAAU,YAAY,MAAM,SAAS,EAAG,QAAO,EAAE,OAAO,MAAM;AAAA,IAC3E,QAAQ;AAAA,IAER;AACA,WAAO;AAAA,EACT,GAAG;AACH,SAAO,EAAE,GAAG,SAAS,GAAI,cAAc,CAAC,EAAG;AAC7C;",
|
|
6
6
|
"names": ["module", "rows", "field", "styles"]
|
|
7
7
|
}
|
package/lib/index.js
CHANGED
|
@@ -103,7 +103,7 @@ function acquireFetchRouter() {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// src/proxy-table.ts
|
|
106
|
-
import { ProxyAgent } from "undici";
|
|
106
|
+
import { ProxyAgent, Socks5ProxyAgent } from "undici";
|
|
107
107
|
|
|
108
108
|
// src/config.ts
|
|
109
109
|
import { createRequire } from "node:module";
|
|
@@ -1010,8 +1010,8 @@ var ProviderProxyRoute = z.object({
|
|
|
1010
1010
|
port: z.number().default(0),
|
|
1011
1011
|
/** Optional proxy username. */
|
|
1012
1012
|
username: z.string().default(""),
|
|
1013
|
-
/**
|
|
1014
|
-
|
|
1013
|
+
/** SOCKS5 proxy password. Only used when `protocol` is `socks5`. */
|
|
1014
|
+
password: z.string().default("")
|
|
1015
1015
|
});
|
|
1016
1016
|
var Config = z.object({
|
|
1017
1017
|
/** Per-provider proxy routes, keyed by provider route id (e.g. `sensenova`). */
|
|
@@ -1042,7 +1042,21 @@ function proxyUrl(route) {
|
|
|
1042
1042
|
const host = route.host.includes(":") && !route.host.startsWith("[") ? `[${route.host}]` : route.host;
|
|
1043
1043
|
return `${route.protocol}://${auth}${host}:${route.port}`;
|
|
1044
1044
|
}
|
|
1045
|
-
|
|
1045
|
+
function displayOrigin(route, url) {
|
|
1046
|
+
if (route.protocol !== "socks5") return new URL(url).origin;
|
|
1047
|
+
const host = route.host.includes(":") && !route.host.startsWith("[") ? `[${route.host}]` : route.host;
|
|
1048
|
+
return `${route.protocol}://${host}:${route.port}`;
|
|
1049
|
+
}
|
|
1050
|
+
function createDispatcher(route, url, password) {
|
|
1051
|
+
if (route.protocol === "socks5") {
|
|
1052
|
+
const auth = {};
|
|
1053
|
+
if (route.username.length > 0) auth.username = route.username;
|
|
1054
|
+
if (password.length > 0) auth.password = password;
|
|
1055
|
+
return new Socks5ProxyAgent(url, auth);
|
|
1056
|
+
}
|
|
1057
|
+
return new ProxyAgent({ uri: url });
|
|
1058
|
+
}
|
|
1059
|
+
function createProxyTable(config) {
|
|
1046
1060
|
const entries = /* @__PURE__ */ new Map();
|
|
1047
1061
|
const problems = /* @__PURE__ */ new Map();
|
|
1048
1062
|
for (const [provider, raw] of Object.entries(config ?? {})) {
|
|
@@ -1054,21 +1068,22 @@ async function createProxyTable(config, options = {}) {
|
|
|
1054
1068
|
continue;
|
|
1055
1069
|
}
|
|
1056
1070
|
if (!route.enabled) continue;
|
|
1057
|
-
if (route.protocol === "socks5") {
|
|
1058
|
-
problems.set(
|
|
1071
|
+
if (route.protocol === "socks5" && route.username.length > 0 && route.password.length === 0) {
|
|
1072
|
+
problems.set(
|
|
1073
|
+
provider,
|
|
1074
|
+
"dsh-provider-proxy: SOCKS5 \u914D\u7F6E\u4E86\u7528\u6237\u540D\u4F46\u6CA1\u6709\u5BC6\u7801\uFF1B\u8BF7\u8865\u5168\u5BC6\u7801\u6216\u6E05\u7A7A\u7528\u6237\u540D"
|
|
1075
|
+
);
|
|
1059
1076
|
continue;
|
|
1060
1077
|
}
|
|
1061
|
-
const password = options.resolvePassword?.(provider, route.passwordRef);
|
|
1062
|
-
void password;
|
|
1063
1078
|
const url = proxyUrl(route);
|
|
1064
1079
|
let dispatcher;
|
|
1065
1080
|
try {
|
|
1066
|
-
dispatcher =
|
|
1081
|
+
dispatcher = createDispatcher(route, url, route.password);
|
|
1067
1082
|
} catch (error) {
|
|
1068
1083
|
problems.set(provider, error instanceof Error ? error.message : String(error));
|
|
1069
1084
|
continue;
|
|
1070
1085
|
}
|
|
1071
|
-
entries.set(provider, { provider, proxyOrigin:
|
|
1086
|
+
entries.set(provider, { provider, proxyOrigin: displayOrigin(route, url), dispatcher });
|
|
1072
1087
|
}
|
|
1073
1088
|
return { entries, problems };
|
|
1074
1089
|
}
|
|
@@ -1098,7 +1113,7 @@ function apply(ctx, config) {
|
|
|
1098
1113
|
} catch {
|
|
1099
1114
|
}
|
|
1100
1115
|
const rebuild = async () => {
|
|
1101
|
-
const next =
|
|
1116
|
+
const next = createProxyTable(plainProviders(config));
|
|
1102
1117
|
const previous = current;
|
|
1103
1118
|
current = next.entries;
|
|
1104
1119
|
problems = next.problems;
|
package/lib/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/fetch-router.ts", "../src/proxy-table.ts", "../src/config.ts", "../node_modules/@deepseek-ai/schemastery/lib/index.mjs", "../node_modules/@deepseek-ai/cosmokit/lib/index.js", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Provider-scoped fetch routing.\n *\n * DeepSeek Harness 0.2.0-rc.2 offers no supported seam for giving one LLM\n * provider its own transport:\n *\n * - `llm-deepseek` calls the unqualified global `fetch` with no `dispatcher`;\n * - `llm-pi-ai` delegates to the pi-ai SDK, whose HTTP layer DSH cannot\n * configure (its own source notes a fetch/dispatcher hook does not exist);\n * - `LlmCallControls` carries only reasoningEffort/temperature/maxTokens/stop;\n * - `llm/stream` intercepts already-decoded `StreamChunk`s, i.e. after HTTP;\n * - `ctx.web` serves `web_search`/`web_fetch` only, never provider traffic;\n * - the official `@deepseek-ai/dsh-http-proxy` is a library with a private\n * installer: one process-wide policy from env vars, no service, no Config.\n *\n * So the request is routed where the only available signal actually is: the\n * `llm/stream` waterfall, whose `options.provider` names the route. An\n * AsyncLocalStorage scope carries the chosen dispatcher over the stream, and a\n * thin `globalThis.fetch` wrapper applies it. Because every provider gets its\n * OWN dispatcher instance, one provider's proxy can never be picked up by\n * another provider's call \u2014 including two providers that resolve to the same\n * upstream host.\n *\n * IMPORTANT \u2014 one undici realm only. Node's built-in `fetch` uses an internal\n * undici and REJECTS a dispatcher built by the npm `undici` package with\n * `invalid onRequestStart method`, and vice versa. Every dispatcher here is\n * built from the npm `undici` that this module imports, so the wrapper must\n * dispatch through THAT same package's `fetch` rather than re-entering Node's.\n * The proxy therefore receives an absolute-form request line\n * (`GET http://host/path HTTP/1.1`), which is how an HTTP forward proxy is\n * addressed; an `https:` target is tunnelled with CONNECT.\n *\n * In-flight streams keep the dispatcher they started on; a configuration\n * change only affects new requests.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport { fetch as undiciFetch } from 'undici'\n\n/** Undici dispatcher, kept structurally typed so this file needs no undici types. */\nexport interface DispatcherLike {\n close(): Promise<void>\n}\n\nexport interface RouterStore {\n dispatcher: DispatcherLike\n}\n\n/** Shared across every plugin instance in one process, keyed so copies cooperate. */\nconst STATE_KEY = Symbol.for('dsh-provider-proxy.fetch-router.v1')\n\ninterface RouterState {\n owners: number\n storage: AsyncLocalStorage<RouterStore>\n originalFetch: typeof globalThis.fetch\n routedFetch: typeof globalThis.fetch\n descriptor?: PropertyDescriptor\n}\n\nfunction installSharedRouter(): RouterState {\n const current = (globalThis as Record<symbol, RouterState | undefined>)[STATE_KEY]\n if (current !== undefined) {\n current.owners += 1\n return current\n }\n\n if (typeof globalThis.fetch !== 'function') {\n throw new Error('dsh-provider-proxy: this Node runtime does not expose global fetch')\n }\n\n const storage = new AsyncLocalStorage<RouterStore>()\n const originalFetch = globalThis.fetch\n const descriptor = Object.getOwnPropertyDescriptor(globalThis, 'fetch')\n\n const routedFetch = function routedFetch(\n this: unknown,\n input: Parameters<typeof globalThis.fetch>[0],\n init?: Parameters<typeof globalThis.fetch>[1],\n ): ReturnType<typeof globalThis.fetch> {\n const active = storage.getStore()\n // No scope, or a caller that already picked a dispatcher: stay out of the way.\n if (active === undefined) return originalFetch.call(globalThis, input, init)\n if (init !== undefined && init !== null && (init as { dispatcher?: unknown }).dispatcher !== undefined) {\n return originalFetch.call(globalThis, input, init)\n }\n // Same undici realm as the dispatcher \u2014 Node's own fetch would reject it.\n // The init is passed through structurally: the DOM `RequestInit` and the\n // undici one disagree on `body`/`duplex`, so both are erased here.\n return undiciFetch(input as never, {\n ...(init as Record<string, unknown> | undefined),\n dispatcher: active.dispatcher as never,\n } as never) as never\n }\n\n Object.defineProperty(globalThis, 'fetch', {\n ...(descriptor ?? { configurable: true, enumerable: true, writable: true }),\n value: routedFetch,\n })\n\n const state: RouterState = { owners: 1, storage, originalFetch, routedFetch, descriptor }\n Object.defineProperty(globalThis, STATE_KEY, {\n configurable: true,\n value: state,\n })\n return state\n}\n\n/**\n * Re-apply the AsyncLocalStorage scope to every iterator operation.\n *\n * This is essential, not cosmetic: an adapter's stream is consumed lazily, so\n * the HTTP call typically happens inside a later `next()`, long after\n * `als.run(...)` returned. Without wrapping the iterator, every request would\n * silently fall back to the default dispatcher.\n */\nfunction contextualIterable(\n storage: AsyncLocalStorage<RouterStore>,\n store: RouterStore,\n factory: () => AsyncIterable<unknown>,\n): AsyncIterable<unknown> {\n return {\n [Symbol.asyncIterator]() {\n let iterator: AsyncIterator<unknown> | undefined\n\n const ensureIterator = (): AsyncIterator<unknown> => {\n if (iterator !== undefined) return iterator\n const iterable = factory()\n if (iterable === null || typeof iterable?.[Symbol.asyncIterator] !== 'function') {\n throw new TypeError('dsh-provider-proxy: llm/stream next() did not return an AsyncIterable')\n }\n iterator = iterable[Symbol.asyncIterator]()\n return iterator\n }\n\n const invoke = (method: 'next' | 'return' | 'throw', value?: unknown): Promise<IteratorResult<unknown>> =>\n storage.run(store, () => {\n // A stream abandoned before its first next() must not touch the adapter.\n if (method === 'return' && iterator === undefined) return Promise.resolve({ done: true, value })\n if (method === 'throw' && iterator === undefined) return Promise.reject(value)\n const target = ensureIterator()\n const operation = target[method]\n if (typeof operation !== 'function') {\n if (method === 'return') return Promise.resolve({ done: true, value })\n return Promise.reject(value)\n }\n return Promise.resolve(Reflect.apply(operation, target, method === 'next' ? [] : [value]))\n })\n\n return {\n next: (value?: unknown) => invoke('next', value),\n return: (value?: unknown) => invoke('return', value),\n throw: (value?: unknown) => invoke('throw', value),\n [Symbol.asyncIterator]() {\n return this\n },\n }\n },\n }\n}\n\nexport interface FetchRouter {\n /** Run one synchronous callback inside the provider's scope. */\n run(dispatcher: DispatcherLike, callback: () => unknown): unknown\n /** Wrap a lazy stream so every consumption step keeps the scope. */\n wrap(dispatcher: DispatcherLike, factory: () => AsyncIterable<unknown>): AsyncIterable<unknown>\n /** Release this holder; the shim is removed once the last holder releases. */\n release(): void\n}\n\n/** Install (or share) the single process-wide fetch shim. */\nexport function acquireFetchRouter(): FetchRouter {\n const state = installSharedRouter()\n let released = false\n\n return {\n run(dispatcher, callback) {\n return state.storage.run({ dispatcher }, callback)\n },\n wrap(dispatcher, factory) {\n return contextualIterable(state.storage, { dispatcher }, factory)\n },\n release() {\n if (released) return\n released = true\n state.owners -= 1\n if (state.owners !== 0) return\n\n if (globalThis.fetch === state.routedFetch) {\n if (state.descriptor === undefined) delete (globalThis as { fetch?: unknown }).fetch\n else Object.defineProperty(globalThis, 'fetch', state.descriptor)\n }\n delete (globalThis as Record<symbol, unknown>)[STATE_KEY]\n state.storage.disable()\n },\n }\n}", "/**\n * The proxy table: one dispatcher per enabled provider.\n *\n * A dispatcher is created per provider rather than shared, so a proxied\n * provider can never leak its transport into another provider's call even when\n * both resolve to the same upstream host.\n */\n\nimport { ProxyAgent } from 'undici'\n\nimport { normalizeRoute, type ProviderProxyRouteValue } from './config.js'\nimport type { DispatcherLike } from './fetch-router.js'\n\nexport interface RouteEntry {\n provider: string\n /** Normalized proxy origin, for diagnostics only. Never logged with credentials. */\n proxyOrigin: string\n dispatcher: DispatcherLike\n}\n\nfunction proxyUrl(route: ProviderProxyRouteValue): string {\n const auth =\n route.username.length === 0\n ? ''\n : `${encodeURIComponent(route.username).replace(/%3A/gi, ':')}@`\n // IPv6 literals need brackets in a URL authority.\n const host = route.host.includes(':') && !route.host.startsWith('[') ? `[${route.host}]` : route.host\n return `${route.protocol}://${auth}${host}:${route.port}`\n}\n\n/**\n * Build the dispatchers for every enabled, valid route.\n *\n * Invalid routes are skipped rather than thrown: one mistyped provider must not\n * stop the others from proxying. The caller surfaces the reason through\n * `problems`, which the Client shows instead of failing the whole table.\n */\nexport async function createProxyTable(\n config: { readonly [provider: string]: Partial<ProviderProxyRouteValue> } | undefined,\n options: { resolvePassword?: (provider: string, ref: string) => string | undefined } = {},\n): Promise<{ entries: Map<string, RouteEntry>; problems: Map<string, string> }> {\n const entries = new Map<string, RouteEntry>()\n const problems = new Map<string, string>()\n\n for (const [provider, raw] of Object.entries(config ?? {})) {\n let route: ProviderProxyRouteValue\n try {\n route = normalizeRoute(provider, raw)\n } catch (error) {\n problems.set(provider, error instanceof Error ? error.message : String(error))\n continue\n }\n if (!route.enabled) continue\n\n if (route.protocol === 'socks5') {\n // undici's ProxyAgent speaks HTTP CONNECT to an HTTP proxy only; a SOCKS5\n // endpoint needs a custom connector. Reported, never silently mis-routed.\n problems.set(provider, 'dsh-provider-proxy: socks5 \u6682\u672A\u5B9E\u73B0\uFF0C\u8BF7\u6539\u7528 http \u6216 https')\n continue\n }\n\n const password = options.resolvePassword?.(provider, route.passwordRef)\n void password // Reserved: credentials are injected as a header, never in the URL.\n\n const url = proxyUrl(route)\n let dispatcher: DispatcherLike\n try {\n dispatcher = new ProxyAgent({ uri: url }) as unknown as DispatcherLike\n } catch (error) {\n problems.set(provider, error instanceof Error ? error.message : String(error))\n continue\n }\n entries.set(provider, { provider, proxyOrigin: new URL(url).origin, dispatcher })\n }\n\n return { entries, problems }\n}\n\n/** Close every dispatcher, ignoring individual failures. */\nexport async function closeTable(entries: Map<string, RouteEntry>): Promise<void> {\n const closing = [...entries.values()].map(entry => entry.dispatcher.close().catch(() => undefined))\n await Promise.allSettled(closing)\n entries.clear()\n}\n\nexport { proxyUrl }", "/**\n * Plugin Config.\n *\n * Shape notes, all verified against DeepSeek Harness 0.2.0-rc.2:\n *\n * - `schemastery` is NOT guaranteed to be resolvable from a profile-hoisted\n * install, so the real package is preferred at runtime when `createRequire`\n * can see it and a bundled fallback is used otherwise. The reference plugin\n * `dsh-llm-retry-settings` does exactly this.\n * - Every editable field is `.volatile()` so a settings write is committed\n * into the running fiber WITHOUT remounting the plugin; the Host then\n * rebuilds its proxy table. Ordinary (non-volatile) fields would restart the\n * plugin instead, which is not what a settings page wants.\n * - The proxy password never lives in this Config. `passwordRef` is only the\n * NAME of a credential held by the credentials service; the secret itself is\n * written through `ctx.remote.credentials.set`, the same way the Models page\n * stores provider API keys. A `role('secret')` field would keep the value out\n * of settings responses but would still write it into cordis.patch.yml.\n */\n\nimport { createRequire } from 'node:module'\n\n// Imported statically so the bundler inlines it, making the package\n// self-contained. `loadSchemastery` below still PREFERS the profile's own copy\n// when one is reachable, so a DSH-provided instance stays authoritative; this\n// bundled copy is only the fallback that lets the plugin load at all.\nimport * as BundledSchema from '@deepseek-ai/schemastery'\n\ntype SchemaLike = {\n object: (...args: any[]) => any\n string: (...args: any[]) => any\n boolean: (...args: any[]) => any\n number: (...args: any[]) => any\n dict: (...args: any[]) => any\n union: (...args: any[]) => any\n}\n\n/**\n * Resolve the schemastery module for this fiber.\n *\n * A profile installation hoists dependencies next to the profile rather than\n * under this package, so a bare `import` can fail even when the Host itself\n * uses schemastery. `createRequire` resolves against this file's real\n * location, which is the best available view of the installation tree.\n *\n * When that finds nothing \u2014 a plain `npm install` of this package, which pulls\n * no schemastery \u2014 the BUNDLED copy is used, so the plugin still loads instead\n * of throwing at require time.\n */\nfunction loadSchemastery(): SchemaLike {\n try {\n const require = createRequire(import.meta.url)\n const candidate = require('@deepseek-ai/schemastery')\n const live = (candidate as { default?: SchemaLike })?.default ?? (candidate as SchemaLike)\n if (live && typeof live.object === 'function') return live\n } catch {\n // Fall through to the bundled copy below.\n }\n // The static import is only a fallback; what it actually exposes is decided at\n // runtime, which this structural type deliberately does not pin.\n const bundled = (BundledSchema as { default?: unknown }).default ?? BundledSchema\n if (typeof (bundled as SchemaLike).object === 'function') return bundled as SchemaLike\n throw new Error('dsh-provider-proxy: no usable @deepseek-ai/schemastery in this installation')\n}\n\nconst z = loadSchemastery()\n\n/** Apply `.volatile()` when the resolved schemastery supports it. */\nfunction vol<T>(field: T): T {\n const volatile = (field as { volatile?: () => unknown }).volatile\n return typeof volatile === 'function' ? (volatile.call(field) as T) : field\n}\n\n/** Forward-compatible passthrough for schemastery extensions used below. */\nfunction stepMin<T extends { step?: (n: number) => T; min?: (n: number) => T }>(field: T, step?: number): T {\n let out = field\n if (step !== undefined && typeof out.step === 'function') out = out.step(step)\n return out\n}\n\n/** Supported forward-proxy transports. */\nexport const PROTOCOLS = ['http', 'https', 'socks5'] as const\nexport type Protocol = (typeof PROTOCOLS)[number]\n\n/**\n * One provider's proxy settings. Keyed by provider route id.\n *\n * `port` is deliberately NOT constrained by schemastery's min/max: an unset\n * proxy is `0` (meaning \"no port chosen yet\"), and a bound of 1 here would make\n * that default fail to parse. The real range check lives in `normalizeRoute`,\n * which runs only when a route is actually enabled, so the error can name the\n * provider instead of surfacing a bare schema path.\n */\nexport const ProviderProxyRoute = z.object({\n /** Whether this provider's calls are routed through the proxy below. */\n enabled: z.boolean().default(false),\n /** Proxy transport. `socks5` is accepted but only honoured when the socks helper loaded. */\n protocol: z.union(PROTOCOLS).default('http'),\n /** Proxy host or IP, without scheme, port, or path. */\n host: z.string().default(''),\n /** Proxy port. 0 means \"not configured\"; enabled routes require 1-65535. */\n port: z.number().default(0),\n /** Optional proxy username. */\n username: z.string().default(''),\n /** NAME of the credentials-service record holding the proxy password. Never the password. */\n passwordRef: z.string().default(''),\n})\n\nexport const Config = z.object({\n /** Per-provider proxy routes, keyed by provider route id (e.g. `sensenova`). */\n providers: vol(z.dict(ProviderProxyRoute).default({})),\n})\n\nexport interface ProviderProxyRouteValue {\n enabled: boolean\n protocol: Protocol\n host: string\n port: number\n username: string\n passwordRef: string\n}\n\nexport interface ConfigShape {\n providers: { readonly [provider: string]: ProviderProxyRouteValue }\n}\n\n/**\n * Validate one route and return the normalized value, or throw with a\n * field-scoped message. Used by both the Host (before opening a dispatcher)\n * and the settings form (before writing), so an invalid value never reaches\n * disk or the network.\n */\nexport function normalizeRoute(\n provider: string,\n raw: Partial<ProviderProxyRouteValue> | undefined,\n): ProviderProxyRouteValue {\n const route = ProviderProxyRoute(raw ?? {})\n const value = typeof (route as { get?: () => unknown }).get === 'function'\n ? (route as unknown as { get: () => ProviderProxyRouteValue }).get()\n : (route as ProviderProxyRouteValue)\n\n if (!value.enabled) return { ...value, port: value.port || 0 }\n\n const host = value.host.trim()\n if (host.length === 0) {\n throw new TypeError(`dsh-provider-proxy: provider \"${provider}\" \u542F\u7528\u4E86\u4EE3\u7406\uFF0C\u4F46\u672A\u586B\u5199\u4EE3\u7406\u5730\u5740`)\n }\n if (/^[a-z][a-z0-9+.-]*:\\/\\//i.test(host) || host.includes('/')) {\n throw new TypeError(`dsh-provider-proxy: provider \"${provider}\" \u7684\u4EE3\u7406\u5730\u5740\u53EA\u586B\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4E0D\u8981\u5E26\u534F\u8BAE\u524D\u7F00\u6216\u8DEF\u5F84`)\n }\n if (!Number.isInteger(value.port) || value.port < 1 || value.port > 65535) {\n throw new TypeError(\n `dsh-provider-proxy: provider \"${provider}\" \u7684\u4EE3\u7406\u7AEF\u53E3\u65E0\u6548\uFF08\u9700\u4E3A 1-65535 \u7684\u6574\u6570\uFF09`,\n )\n }\n return { ...value, host, username: value.username.trim() }\n}", "import { Binary, clone, createVolatile, deepEqual, filterKeys, isNullable, isPlainObject, isVolatile, pick, valueMap } from \"@deepseek-ai/cosmokit\";\n//#region lib/types/index.js\nconst kSchema = Symbol.for(\"schemastery\");\nconst kValidationError = Symbol.for(\"ValidationError\");\nglobalThis.__schemastery_index__ ??= 0;\nglobalThis.__schemastery_refs__ = void 0;\nvar ValidationError = class extends TypeError {\n\toptions;\n\tname = \"ValidationError\";\n\tconstructor(message, options) {\n\t\tlet prefix = \"$\";\n\t\tfor (const segment of options.path || []) if (typeof segment === \"string\") prefix += \".\" + segment;\n\t\telse if (typeof segment === \"number\") prefix += \"[\" + segment + \"]\";\n\t\telse if (typeof segment === \"symbol\") prefix += `[Symbol(${segment.toString()})]`;\n\t\tif (prefix.startsWith(\".\")) prefix = prefix.slice(1);\n\t\tsuper((prefix === \"$\" ? \"\" : `${prefix} `) + message);\n\t\tthis.options = options;\n\t}\n\tstatic is(error) {\n\t\treturn !!error?.[kValidationError];\n\t}\n};\nObject.defineProperty(ValidationError.prototype, kValidationError, { value: true });\nconst Schema = function(options) {\n\tconst schema = function(data, options = {}) {\n\t\treturn Schema.resolve(data, schema, options)[0];\n\t};\n\tif (options.refs) {\n\t\tconst refs = valueMap(options.refs, (options) => new Schema(options));\n\t\tconst getRef = (uid) => refs[uid];\n\t\tfor (const key in refs) {\n\t\t\tconst options = refs[key];\n\t\t\toptions.sKey = getRef(options.sKey);\n\t\t\toptions.inner = getRef(options.inner);\n\t\t\toptions.list = options.list && options.list.map(getRef);\n\t\t\toptions.dict = options.dict && valueMap(options.dict, getRef);\n\t\t}\n\t\treturn refs[options.uid];\n\t}\n\tObject.assign(schema, options);\n\tif (typeof schema.callback === \"string\") try {\n\t\tschema.callback = new Function(\"return \" + schema.callback)();\n\t} catch {}\n\tObject.defineProperty(schema, \"uid\", { value: globalThis.__schemastery_index__++ });\n\tObject.setPrototypeOf(schema, Schema.prototype);\n\tschema.meta ||= {};\n\tschema.toString = schema.toString.bind(schema);\n\treturn schema;\n};\nSchema.prototype = Object.create(Function.prototype);\nSchema.prototype[kSchema] = true;\nObject.defineProperty(Schema.prototype, \"~standard\", { get() {\n\treturn {\n\t\tversion: 1,\n\t\tvendor: \"schemastery\",\n\t\tvalidate: (value) => {\n\t\t\ttry {\n\t\t\t\treturn { value: Schema.resolve(value, this, {})[0] };\n\t\t\t} catch (error) {\n\t\t\t\tif (ValidationError.is(error)) return { issues: [{\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tpath: error.options.path\n\t\t\t\t}] };\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t};\n} });\nSchema.ValidationError = ValidationError;\nSchema.prototype.toJSON = function toJSON() {\n\tif (globalThis.__schemastery_refs__) {\n\t\tglobalThis.__schemastery_refs__[this.uid] ??= JSON.parse(JSON.stringify({ ...this }));\n\t\treturn this.uid;\n\t}\n\tglobalThis.__schemastery_refs__ = { [this.uid]: { ...this } };\n\tglobalThis.__schemastery_refs__[this.uid] = JSON.parse(JSON.stringify({ ...this }));\n\tconst result = {\n\t\tuid: this.uid,\n\t\trefs: globalThis.__schemastery_refs__\n\t};\n\tglobalThis.__schemastery_refs__ = void 0;\n\treturn result;\n};\nSchema.prototype.set = function set(key, value) {\n\tthis.dict[key] = value;\n\treturn this;\n};\nSchema.prototype.push = function push(value) {\n\tthis.list.push(value);\n\treturn this;\n};\nfunction mergeDesc(original, messages) {\n\tconst result = typeof original === \"string\" ? { \"\": original } : { ...original };\n\tfor (const locale in messages) {\n\t\tconst value = messages[locale];\n\t\tif (value?.$description || value?.$desc) result[locale] = value.$description || value.$desc;\n\t\telse if (typeof value === \"string\") result[locale] = value;\n\t}\n\treturn result;\n}\nfunction getInner(value) {\n\treturn value?.$value ?? value?.$inner;\n}\nfunction extractKeys(data) {\n\treturn filterKeys(data ?? {}, (key) => !key.startsWith(\"$\"));\n}\nSchema.prototype.i18n = function i18n(messages) {\n\tconst schema = Schema(this);\n\tconst desc = mergeDesc(schema.meta.description, messages);\n\tif (Object.keys(desc).length) schema.meta.description = desc;\n\tif (schema.dict) schema.dict = valueMap(schema.dict, (inner, key) => {\n\t\treturn inner.i18n(valueMap(messages, (data) => getInner(data)?.[key] ?? data?.[key]));\n\t});\n\tif (schema.list) schema.list = schema.list.map((inner, index) => {\n\t\treturn inner.i18n(valueMap(messages, (data = {}) => {\n\t\t\tif (Array.isArray(getInner(data))) return getInner(data)[index];\n\t\t\tif (Array.isArray(data)) return data[index];\n\t\t\treturn extractKeys(data);\n\t\t}));\n\t});\n\tif (schema.inner) schema.inner = schema.inner.i18n(valueMap(messages, (data) => {\n\t\tif (getInner(data)) return getInner(data);\n\t\treturn extractKeys(data);\n\t}));\n\tif (schema.sKey) schema.sKey = schema.sKey.i18n(valueMap(messages, (data) => data?.$key));\n\treturn schema;\n};\nSchema.prototype.extra = function extra(key, value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"required\",\n\t\"disabled\",\n\t\"collapse\",\n\t\"hidden\",\n\t\"loose\"\n]) Object.assign(Schema.prototype, { [key](value = true) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nSchema.prototype.deprecated = function deprecated() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"deprecated\",\n\t\ttype: \"danger\"\n\t});\n\treturn schema;\n};\nSchema.prototype.experimental = function experimental() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"experimental\",\n\t\ttype: \"warning\"\n\t});\n\treturn schema;\n};\nSchema.prototype.pattern = function pattern(regexp) {\n\tconst schema = Schema(this);\n\tconst pattern = pick(regexp, [\"source\", \"flags\"]);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\tpattern\n\t};\n\treturn schema;\n};\nSchema.prototype.simplify = function simplify(value) {\n\tif (isVolatile(value)) value = value.get();\n\tif (deepEqual(value, this.meta.default, this.type === \"dict\")) return null;\n\tif (isNullable(value)) return value;\n\tif (this.type === \"object\" || this.type === \"dict\") {\n\t\tconst result = {};\n\t\tfor (const key in value) {\n\t\t\tconst item = (this.type === \"object\" ? this.dict[key] : this.inner)?.simplify(value[key]);\n\t\t\tif (this.type === \"dict\" || !isNullable(item)) result[key] = item;\n\t\t}\n\t\tif (deepEqual(result, this.meta.default, this.type === \"dict\")) return null;\n\t\treturn result;\n\t} else if (this.type === \"array\" || this.type === \"tuple\") {\n\t\tconst result = [];\n\t\tvalue.forEach((value, index) => {\n\t\t\tconst schema = this.type === \"array\" ? this.inner : this.list[index];\n\t\t\tconst item = schema ? schema.simplify(value) : value;\n\t\t\tresult.push(item);\n\t\t});\n\t\treturn result;\n\t} else if (this.type === \"intersect\") {\n\t\tconst result = {};\n\t\tfor (const item of this.list) Object.assign(result, item.simplify(value));\n\t\treturn result;\n\t} else if (this.type === \"union\") for (const schema of this.list) try {\n\t\tSchema.resolve(value, schema, {});\n\t\treturn schema.simplify(value);\n\t} catch {}\n\treturn value;\n};\nSchema.prototype.toString = function toString(inline) {\n\treturn formatters[this.type]?.(this, inline) ?? `Schema<${this.type}>`;\n};\nSchema.prototype.role = function role(role, extra) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\trole,\n\t\textra\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"default\",\n\t\"link\",\n\t\"comment\",\n\t\"description\",\n\t\"max\",\n\t\"min\",\n\t\"step\"\n]) Object.assign(Schema.prototype, { [key](value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nSchema.prototype.volatile = function volatile() {\n\tif (this.meta.volatile) throw new TypeError(\"volatile schema is already wrapped\");\n\treturn this.extra(\"volatile\", true);\n};\nconst resolvers = {};\nconst checkedVolatile = Symbol(\"checked-volatile-schema\");\nfunction validateVolatileSchema(schema, path = [], blocked = false, seen = /* @__PURE__ */ new Map()) {\n\tconst states = seen.get(schema) ?? /* @__PURE__ */ new Set();\n\tif (states.has(blocked)) return;\n\tstates.add(blocked);\n\tseen.set(schema, states);\n\tif (schema.meta?.volatile && blocked) throw new ValidationError(\"volatile fields require a fixed object path without an enclosing volatile field\", { path });\n\tconst nested = blocked || !!schema.meta?.volatile;\n\tif (schema.dict) for (const [key, child] of Object.entries(schema.dict)) validateVolatileSchema(child, [...path, key], nested, seen);\n\tif (schema.sKey) validateVolatileSchema(schema.sKey, [...path, \"<key>\"], true, seen);\n\tif (schema.inner && (schema.type !== \"lazy\" || schema.inner[kSchema])) validateVolatileSchema(schema.inner, [...path, \"*\"], true, seen);\n\tif (schema.list) for (let index = 0; index < schema.list.length; index++) validateVolatileSchema(schema.list[index], [...path, String(index)], true, seen);\n}\nSchema.extend = function extend(type, resolve) {\n\tresolvers[type] = resolve;\n};\nSchema.resolve = function resolve(data, schema, options = {}, strict = false) {\n\tif (!schema) return [data];\n\tif (!options[checkedVolatile]) {\n\t\tvalidateVolatileSchema(schema, options.path);\n\t\toptions = {\n\t\t\t...options,\n\t\t\t[checkedVolatile]: true\n\t\t};\n\t}\n\tif (schema.meta?.volatile) {\n\t\tconst inner = Schema(schema);\n\t\tinner.meta = {\n\t\t\t...schema.meta,\n\t\t\tvolatile: false\n\t\t};\n\t\tconst [value, adapted] = Schema.resolve(data, inner, options, strict);\n\t\ttry {\n\t\t\treturn [createVolatile(value), adapted];\n\t\t} catch (error) {\n\t\t\tthrow new ValidationError(error instanceof Error ? error.message : String(error), options);\n\t\t}\n\t}\n\tif (options.ignore?.(data, schema)) return [data];\n\tif (isNullable(data) && schema.type !== \"lazy\") {\n\t\tif (schema.meta.required) throw new ValidationError(`missing required value`, options);\n\t\tlet current = schema;\n\t\tlet fallback = schema.meta.default;\n\t\twhile (current?.type === \"intersect\" && isNullable(fallback)) {\n\t\t\tcurrent = current.list[0];\n\t\t\tfallback = current?.meta.default;\n\t\t}\n\t\tif (isNullable(fallback)) return [data];\n\t\tdata = clone(fallback);\n\t}\n\tconst callback = resolvers[schema.type];\n\tif (!callback) throw new ValidationError(`unsupported type \"${schema.type}\"`, options);\n\ttry {\n\t\treturn callback(data, schema, options, strict);\n\t} catch (error) {\n\t\tif (!schema.meta.loose) throw error;\n\t\treturn [schema.meta.default];\n\t}\n};\nSchema.from = function from(source) {\n\tif (isNullable(source)) return Schema.any();\n\telse if ([\n\t\t\"string\",\n\t\t\"number\",\n\t\t\"boolean\"\n\t].includes(typeof source)) return Schema.const(source).required();\n\telse if (source[kSchema]) return source;\n\telse if (typeof source === \"function\") switch (source) {\n\t\tcase String: return Schema.string().required();\n\t\tcase Number: return Schema.number().required();\n\t\tcase Boolean: return Schema.boolean().required();\n\t\tcase Function: return Schema.function().required();\n\t\tdefault: return Schema.is(source).required();\n\t}\n\telse throw new TypeError(`cannot infer schema from ${source}`);\n};\nSchema.lazy = function lazy(builder) {\n\tconst toJSON = () => {\n\t\tif (!schema.inner[kSchema]) {\n\t\t\tschema.inner = schema.builder();\n\t\t\tschema.inner.meta = {\n\t\t\t\t...schema.meta,\n\t\t\t\t...schema.inner.meta\n\t\t\t};\n\t\t}\n\t\treturn schema.inner.toJSON();\n\t};\n\tconst schema = new Schema({\n\t\ttype: \"lazy\",\n\t\tbuilder,\n\t\tinner: { toJSON }\n\t});\n\treturn schema;\n};\nSchema.natural = function natural() {\n\treturn Schema.number().step(1).min(0);\n};\nSchema.percent = function percent() {\n\treturn Schema.number().step(.01).min(0).max(1).role(\"slider\");\n};\nSchema.date = function date() {\n\treturn Schema.union([Schema.is(Date), Schema.transform(Schema.string().role(\"datetime\"), (value, options) => {\n\t\tconst date = new Date(value);\n\t\tif (isNaN(+date)) throw new ValidationError(`invalid date \"${value}\"`, options);\n\t\treturn date;\n\t}, true)]);\n};\nSchema.regExp = function regExp(flag = \"\") {\n\treturn Schema.union([Schema.is(RegExp), Schema.transform(Schema.string().role(\"regexp\", { flag }), (value, options) => {\n\t\ttry {\n\t\t\treturn new RegExp(value, flag);\n\t\t} catch (e) {\n\t\t\tthrow new ValidationError(e.message, options);\n\t\t}\n\t}, true)]);\n};\nSchema.arrayBuffer = function arrayBuffer(encoding) {\n\treturn Schema.union([\n\t\tSchema.is(ArrayBuffer),\n\t\tSchema.is(SharedArrayBuffer),\n\t\tSchema.transform(Schema.any(), (value, options) => {\n\t\t\tif (Binary.isSource(value)) return Binary.fromSource(value);\n\t\t\tthrow new ValidationError(`expected ArrayBufferSource but got ${value}`, options);\n\t\t}, true),\n\t\t...encoding ? [Schema.transform(Schema.string(), (value, options) => {\n\t\t\ttry {\n\t\t\t\treturn encoding === \"base64\" ? Binary.fromBase64(value) : Binary.fromHex(value);\n\t\t\t} catch (e) {\n\t\t\t\tthrow new ValidationError(e.message, options);\n\t\t\t}\n\t\t}, true)] : []\n\t]);\n};\nSchema.extend(\"lazy\", (data, schema, options, strict) => {\n\tif (!schema.inner[kSchema]) {\n\t\tschema.inner = schema.builder();\n\t\tschema.inner.meta = {\n\t\t\t...schema.meta,\n\t\t\t...schema.inner.meta\n\t\t};\n\t\tvalidateVolatileSchema(schema.inner, options.path, true);\n\t}\n\treturn Schema.resolve(data, schema.inner, options, strict);\n});\nSchema.extend(\"any\", (data) => {\n\treturn [data];\n});\nSchema.extend(\"never\", (data, _, options) => {\n\tthrow new ValidationError(`expected nullable but got ${data}`, options);\n});\nSchema.extend(\"const\", (data, { value }, options) => {\n\tif (deepEqual(data, value)) return [value];\n\tthrow new ValidationError(`expected ${value} but got ${data}`, options);\n});\nfunction checkWithinRange(data, meta, description, options, skipMin = false) {\n\tconst { max = Infinity, min = -Infinity } = meta;\n\tif (data > max) throw new ValidationError(`expected ${description} <= ${max} but got ${data}`, options);\n\tif (data < min && !skipMin) throw new ValidationError(`expected ${description} >= ${min} but got ${data}`, options);\n}\nSchema.extend(\"string\", (data, { meta }, options) => {\n\tif (typeof data !== \"string\") throw new ValidationError(`expected string but got ${data}`, options);\n\tif (meta.pattern) {\n\t\tconst regexp = new RegExp(meta.pattern.source, meta.pattern.flags);\n\t\tif (!regexp.test(data)) throw new ValidationError(`expect string to match regexp ${regexp}`, options);\n\t}\n\tcheckWithinRange(data.length, meta, \"string length\", options);\n\treturn [data];\n});\nfunction decimalShift(data, digits) {\n\tconst str = data.toString();\n\tif (str.includes(\"e\")) return data * Math.pow(10, digits);\n\tconst index = str.indexOf(\".\");\n\tif (index === -1) return data * Math.pow(10, digits);\n\tconst frac = str.slice(index + 1);\n\tconst integer = str.slice(0, index);\n\tif (frac.length <= digits) return +(integer + frac.padEnd(digits, \"0\"));\n\treturn +(integer + frac.slice(0, digits) + \".\" + frac.slice(digits));\n}\nfunction isMultipleOf(data, min, step) {\n\tstep = Math.abs(step);\n\tif (!/^\\d+\\.\\d+$/.test(step.toString())) return (data - min) % step === 0;\n\tconst index = step.toString().indexOf(\".\");\n\tconst digits = step.toString().slice(index + 1).length;\n\treturn Math.abs(decimalShift(data, digits) - decimalShift(min, digits)) % decimalShift(step, digits) === 0;\n}\nSchema.extend(\"number\", (data, { meta }, options) => {\n\tif (typeof data !== \"number\") throw new ValidationError(`expected number but got ${data}`, options);\n\tcheckWithinRange(data, meta, \"number\", options);\n\tconst { step } = meta;\n\tif (step && !isMultipleOf(data, meta.min ?? 0, step)) throw new ValidationError(`expected number multiple of ${step} but got ${data}`, options);\n\treturn [data];\n});\nSchema.extend(\"boolean\", (data, _, options) => {\n\tif (typeof data === \"boolean\") return [data];\n\tthrow new ValidationError(`expected boolean but got ${data}`, options);\n});\nSchema.extend(\"bitset\", (data, { bits, meta }, options) => {\n\tlet value = 0, keys = [];\n\tif (typeof data === \"number\") {\n\t\tvalue = data;\n\t\tfor (const key in bits) if (data & bits[key]) keys.push(key);\n\t} else if (Array.isArray(data)) {\n\t\tkeys = data;\n\t\tfor (const key of keys) {\n\t\t\tif (typeof key !== \"string\") throw new ValidationError(`expected string but got ${key}`, options);\n\t\t\tif (key in bits) value |= bits[key];\n\t\t}\n\t} else throw new ValidationError(`expected number or array but got ${data}`, options);\n\tif (value === meta.default) return [value];\n\treturn [value, keys];\n});\nSchema.extend(\"function\", (data, _, options) => {\n\tif (typeof data === \"function\") return [data];\n\tthrow new ValidationError(`expected function but got ${data}`, options);\n});\nSchema.extend(\"is\", (data, { constructor }, options) => {\n\tif (typeof constructor === \"function\") {\n\t\tif (data instanceof constructor) return [data];\n\t\tthrow new ValidationError(`expected ${constructor.name} but got ${data}`, options);\n\t} else {\n\t\tif (isNullable(data)) throw new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t\tlet prototype = Object.getPrototypeOf(data);\n\t\twhile (prototype) {\n\t\t\tif (prototype.constructor?.name === constructor) return [data];\n\t\t\tprototype = Object.getPrototypeOf(prototype);\n\t\t}\n\t\tthrow new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t}\n});\nfunction property(data, key, schema, options) {\n\ttry {\n\t\tconst [value, adapted] = Schema.resolve(data[key], schema, {\n\t\t\t...options,\n\t\t\tpath: [...options.path || [], key]\n\t\t});\n\t\tif (adapted !== void 0) data[key] = adapted;\n\t\treturn value;\n\t} catch (e) {\n\t\tif (!options?.autofix) throw e;\n\t\tdelete data[key];\n\t\treturn schema.meta.volatile ? createVolatile(schema.meta.default) : schema.meta.default;\n\t}\n}\nSchema.extend(\"array\", (data, { inner, meta }, options) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tcheckWithinRange(data.length, meta, \"array length\", options, !isNullable(inner.meta.default));\n\treturn [data.map((_, index) => property(data, index, inner, options))];\n});\nSchema.extend(\"dict\", (data, { inner, sKey }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in data) {\n\t\tlet rKey;\n\t\ttry {\n\t\t\trKey = Schema.resolve(key, sKey, options)[0];\n\t\t} catch (error) {\n\t\t\tif (strict) continue;\n\t\t\tthrow error;\n\t\t}\n\t\tresult[rKey] = property(data, key, inner, options);\n\t\tdata[rKey] = data[key];\n\t\tif (key !== rKey) delete data[key];\n\t}\n\treturn [result];\n});\nSchema.extend(\"tuple\", (data, { list }, options, strict) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tconst result = list.map((inner, index) => property(data, index, inner, options));\n\tif (strict) return [result];\n\tresult.push(...data.slice(list.length));\n\treturn [result];\n});\nfunction merge(result, data) {\n\tfor (const key in data) {\n\t\tif (key in result) continue;\n\t\tresult[key] = data[key];\n\t}\n}\nSchema.extend(\"object\", (data, { dict }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in dict) {\n\t\tconst value = property(data, key, dict[key], options);\n\t\tif (!isNullable(value) || key in data) result[key] = value;\n\t}\n\tif (!strict) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"union\", (data, { list, toString }, options, strict) => {\n\tconst messages = [];\n\tfor (const inner of list) try {\n\t\treturn Schema.resolve(data, inner, options, strict);\n\t} catch (error) {\n\t\tmessages.push(error);\n\t}\n\tthrow new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n});\nSchema.extend(\"intersect\", (data, { list, toString }, options, strict) => {\n\tif (!list.length) return [data];\n\tlet result;\n\tfor (const inner of list) {\n\t\tconst value = Schema.resolve(data, inner, options, true)[0];\n\t\tif (isNullable(value)) continue;\n\t\tif (isNullable(result)) result = value;\n\t\telse if (typeof result !== typeof value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t\telse if (typeof value === \"object\") merge(result ??= {}, value);\n\t\telse if (result !== value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t}\n\tif (!strict && isPlainObject(data)) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"transform\", (data, { inner, callback, preserve }, options) => {\n\tconst [result, adapted = data] = Schema.resolve(data, inner, options, true);\n\tif (preserve) return [callback(result)];\n\telse return [callback(result), callback(adapted)];\n});\nconst formatters = {};\nfunction defineMethod(name, keys, format) {\n\tformatters[name] = format;\n\tObject.assign(Schema, { [name](...args) {\n\t\tconst schema = new Schema({ type: name });\n\t\tkeys.forEach((key, index) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase \"sKey\":\n\t\t\t\t\tschema.sKey = args[index] ?? Schema.string();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inner\":\n\t\t\t\t\tschema.inner = Schema.from(args[index]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"list\":\n\t\t\t\t\tschema.list = args[index].map(Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dict\":\n\t\t\t\t\tschema.dict = valueMap(args[index], Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bits\":\n\t\t\t\t\tschema.bits = {};\n\t\t\t\t\tfor (const key in args[index]) {\n\t\t\t\t\t\tif (typeof args[index][key] !== \"number\") continue;\n\t\t\t\t\t\tschema.bits[key] = args[index][key];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"callback\": {\n\t\t\t\t\tconst callback = schema.callback = args[index];\n\t\t\t\t\tcallback[\"toJSON\"] ||= () => callback.toString();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"constructor\": {\n\t\t\t\t\tconst constructor = schema.constructor = args[index];\n\t\t\t\t\tif (typeof constructor === \"function\") constructor[\"toJSON\"] ||= () => constructor[\"name\"];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: schema[key] = args[index];\n\t\t\t}\n\t\t});\n\t\tif (name === \"object\" || name === \"dict\") schema.meta.default = {};\n\t\telse if (name === \"array\" || name === \"tuple\") schema.meta.default = [];\n\t\telse if (name === \"bitset\") schema.meta.default = 0;\n\t\treturn schema;\n\t} });\n}\ndefineMethod(\"is\", [\"constructor\"], ({ constructor }) => {\n\tif (typeof constructor === \"function\") return constructor.name;\n\telse return constructor;\n});\ndefineMethod(\"any\", [], () => \"any\");\ndefineMethod(\"never\", [], () => \"never\");\ndefineMethod(\"const\", [\"value\"], ({ value }) => typeof value === \"string\" ? JSON.stringify(value) : value);\ndefineMethod(\"string\", [], () => \"string\");\ndefineMethod(\"number\", [], () => \"number\");\ndefineMethod(\"boolean\", [], () => \"boolean\");\ndefineMethod(\"bitset\", [\"bits\"], () => \"bitset\");\ndefineMethod(\"function\", [], () => \"function\");\ndefineMethod(\"array\", [\"inner\"], ({ inner }) => `${inner.toString(true)}[]`);\ndefineMethod(\"dict\", [\"inner\", \"sKey\"], ({ inner, sKey }) => `{ [key: ${sKey.toString()}]: ${inner.toString()} }`);\ndefineMethod(\"tuple\", [\"list\"], ({ list }) => `[${list.map((inner) => inner.toString()).join(\", \")}]`);\ndefineMethod(\"object\", [\"dict\"], ({ dict }) => {\n\tif (Object.keys(dict).length === 0) return \"{}\";\n\treturn `{ ${Object.entries(dict).map(([key, inner]) => {\n\t\treturn `${key}${inner.meta.required ? \"\" : \"?\"}: ${inner.toString()}`;\n\t}).join(\", \")} }`;\n});\ndefineMethod(\"union\", [\"list\"], ({ list }, inline) => {\n\tconst result = list.map(({ toString: format }) => format()).join(\" | \");\n\treturn inline ? `(${result})` : result;\n});\ndefineMethod(\"intersect\", [\"list\"], ({ list }) => {\n\treturn `${list.map((inner) => inner.toString(true)).join(\" & \")}`;\n});\ndefineMethod(\"transform\", [\n\t\"inner\",\n\t\"callback\",\n\t\"preserve\"\n], ({ inner }, isInner) => inner.toString(isInner));\n//#endregion\nexport { Schema as default };\n", "//#region lib/types/misc.js\n/** No-op callback returning `undefined` at runtime and `any` at type level. */\nfunction noop() {}\n/** Return true when a value is `null` or `undefined`. */\nfunction isNullable(value) {\n\treturn value === null || value === void 0;\n}\n/** Return true when a value is neither `null` nor `undefined`. */\nfunction isNonNullable(value) {\n\treturn !isNullable(value);\n}\n/** Return true for non-array object values. */\nfunction isPlainObject(data) {\n\treturn data && typeof data === \"object\" && !Array.isArray(data);\n}\n/** Filter object entries and return a new object. */\nfunction filterKeys(object, filter) {\n\treturn Object.fromEntries(Object.entries(object).filter(([key, value]) => filter(key, value)));\n}\n/** Map object values while preserving the original key set. */\nfunction mapValues(object, transform) {\n\treturn Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transform(value, key)]));\n}\n/** Pick selected keys from an object, optionally including `undefined` values. */\nfunction pick(source, keys, forced) {\n\tif (!keys) return { ...source };\n\tconst result = {};\n\tfor (const key of keys) if (forced || source[key] !== void 0) result[key] = source[key];\n\treturn result;\n}\n/** Omit selected keys from a shallow object copy. */\nfunction omit(source, keys) {\n\tif (!keys) return { ...source };\n\tconst result = { ...source };\n\tfor (const key of keys) Reflect.deleteProperty(result, key);\n\treturn result;\n}\n/** Define a non-enumerable writable property and return the object. */\nfunction defineProperty(object, key, value) {\n\treturn Object.defineProperty(object, key, {\n\t\twritable: true,\n\t\tvalue,\n\t\tenumerable: false\n\t});\n}\n//#endregion\n//#region lib/types/array.js\n/** Return true when every item in `array2` is present in `array1`. */\nfunction contain(array1, array2) {\n\treturn array2.every((item) => array1.includes(item));\n}\n/** Return items that appear in both arrays. */\nfunction intersection(array1, array2) {\n\treturn array1.filter((item) => array2.includes(item));\n}\n/** Return items from `array1` that do not appear in `array2`. */\nfunction difference(array1, array2) {\n\treturn array1.filter((item) => !array2.includes(item));\n}\n/** Return the set-union of two arrays while preserving first occurrence order. */\nfunction union(array1, array2) {\n\treturn Array.from(new Set([...array1, ...array2]));\n}\n/** Remove duplicate values while preserving first occurrence order. */\nfunction deduplicate(array) {\n\treturn [...new Set(array)];\n}\n/** Remove one item from an array and report whether it was found. */\nfunction remove(list, item) {\n\tconst index = list?.indexOf(item);\n\tif (index >= 0) {\n\t\tlist.splice(index, 1);\n\t\treturn true;\n\t} else return false;\n}\n/** Normalize nullish, scalar, or array input to an array. */\nfunction makeArray(source) {\n\treturn Array.isArray(source) ? source : isNullable(source) ? [] : [source];\n}\n//#endregion\n//#region lib/types/volatile.js\n/** Shared config references used by schema validators and plugin runtimes. */\nconst write = Symbol.for(\"cosmokit.volatile.write\");\nfunction snapshot(value, ancestors = /* @__PURE__ */ new Set()) {\n\tif (typeof value === \"function\") throw new TypeError(\"volatile config cannot contain functions\");\n\tif (value === null || typeof value !== \"object\") return value;\n\tif (ancestors.has(value)) throw new TypeError(\"volatile config cannot contain cycles\");\n\tancestors.add(value);\n\ttry {\n\t\tif (Array.isArray(value)) return Object.freeze(value.map((item) => snapshot(item, ancestors)));\n\t\tif (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) throw new TypeError(\"volatile config objects must be plain objects or arrays\");\n\t\treturn Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, snapshot(item, ancestors)])));\n\t} finally {\n\t\tancestors.delete(value);\n\t}\n}\n/**\n* Create a detached reference containing an immutable copy of the supplied data.\n* @param value - validated config data; class instances and functions are unsupported.\n* @returns a reference whose value is updated only by its owning runtime.\n*/\nfunction createVolatile(value) {\n\tlet current = snapshot(value);\n\treturn Object.freeze({\n\t\tget: () => current,\n\t\t[write]: (value) => {\n\t\t\tcurrent = value;\n\t\t}\n\t});\n}\n/**\n* Identify references across ESM/CJS copies of the shared library.\n* @param value - a parsed config value.\n* @returns whether the value implements the shared reference protocol.\n*/\nfunction isVolatile(value) {\n\treturn typeof value === \"object\" && value !== null && write in value;\n}\n/**\n* Collect config references without descending into their snapshots or opaque objects.\n* @internal\n* @param value - parsed config; cyclic ordinary fields are visited once per path.\n* @returns references and their object-key paths, including an empty path for a root reference.\n*/\nfunction volatileEntries(value) {\n\tconst ancestors = /* @__PURE__ */ new Set();\n\tfunction visit(value, path) {\n\t\tif (isVolatile(value)) return [{\n\t\t\tpath,\n\t\t\tref: value\n\t\t}];\n\t\tif (!value || typeof value !== \"object\" || ancestors.has(value)) return [];\n\t\tif (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return [];\n\t\tancestors.add(value);\n\t\ttry {\n\t\t\treturn Object.entries(value).flatMap(([key, child]) => visit(child, [...path, key]));\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t}\n\treturn visit(value, []);\n}\n/**\n* Commit an already validated immutable snapshot from another reference.\n* @internal\n* @param target - the owning plugin's stable reference.\n* @param source - a newly parsed candidate reference.\n*/\nfunction updateVolatile(target, source) {\n\ttarget[write](source.get());\n}\n//#endregion\n//#region lib/types/types.js\n/** Test values using `instanceof` with a `toStringTag` fallback. */\nfunction is(type, value) {\n\tif (arguments.length === 1) return (value) => is(type, value);\n\treturn type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;\n}\nfunction isArrayBufferLike(value) {\n\treturn is(\"ArrayBuffer\", value) || is(\"SharedArrayBuffer\", value);\n}\nfunction isArrayBufferSource(value) {\n\treturn isArrayBufferLike(value) || ArrayBuffer.isView(value);\n}\n/** Binary source detection and base64/hex conversion helpers. */\nvar Binary;\n(function(Binary) {\n\tBinary.is = isArrayBufferLike;\n\tBinary.isSource = isArrayBufferSource;\n\tfunction fromSource(source) {\n\t\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\t\telse return source;\n\t}\n\tBinary.fromSource = fromSource;\n\tfunction toBase64(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"base64\");\n\t\tlet binary = \"\";\n\t\tconst bytes = new Uint8Array(source);\n\t\tfor (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]);\n\t\treturn btoa(binary);\n\t}\n\tBinary.toBase64 = toBase64;\n\tfunction fromBase64(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"base64\"));\n\t\treturn Uint8Array.from(atob(source), (c) => c.charCodeAt(0));\n\t}\n\tBinary.fromBase64 = fromBase64;\n\tfunction toHex(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"hex\");\n\t\treturn Array.from(new Uint8Array(source), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n\t}\n\tBinary.toHex = toHex;\n\tfunction fromHex(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"hex\"));\n\t\tconst hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1);\n\t\tconst buffer = [];\n\t\tfor (let i = 0; i < hex.length; i += 2) buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16));\n\t\treturn Uint8Array.from(buffer).buffer;\n\t}\n\tBinary.fromHex = fromHex;\n})(Binary || (Binary = {}));\n/** Decode a base64 string into binary data. */\nconst base64ToArrayBuffer = Binary.fromBase64;\n/** Encode binary data as base64. */\nconst arrayBufferToBase64 = Binary.toBase64;\n/** Decode a hex string into binary data. */\nconst hexToArrayBuffer = Binary.fromHex;\n/** Encode binary data as hex. */\nconst arrayBufferToHex = Binary.toHex;\n/** Deep-clone common JavaScript values while preserving prototypes and cycles. */\nfunction clone(source, refs = /* @__PURE__ */ new Map()) {\n\tif (!source || typeof source !== \"object\") return source;\n\tif (is(\"Date\", source)) return new Date(source.valueOf());\n\tif (is(\"RegExp\", source)) return new RegExp(source.source, source.flags);\n\tif (isArrayBufferLike(source)) return source.slice(0);\n\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\tconst cached = refs.get(source);\n\tif (cached) return cached;\n\tif (Array.isArray(source)) {\n\t\tconst result = [];\n\t\trefs.set(source, result);\n\t\tsource.forEach((value, index) => {\n\t\t\tresult[index] = Reflect.apply(clone, null, [value, refs]);\n\t\t});\n\t\treturn result;\n\t}\n\tconst result = Object.create(Object.getPrototypeOf(source));\n\trefs.set(source, result);\n\tfor (const key of Reflect.ownKeys(source)) {\n\t\tconst descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) };\n\t\tif (\"value\" in descriptor) descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs]);\n\t\tReflect.defineProperty(result, key, descriptor);\n\t}\n\treturn result;\n}\n/**\n* Compare values recursively, treating two volatile references as equal regardless of value.\n* Strict comparison distinguishes null/undefined, treats opaque objects by identity,\n* compares URLs by normalized href, treats array holes as undefined, and considers distinct cyclic structures unequal.\n* @param a - first value.\n* @param b - second value.\n* @param strict - whether to require strict data equality outside volatile references.\n* @returns whether the values compare equal.\n*/\nfunction deepEqual(a, b, strict) {\n\tconst ancestors = /* @__PURE__ */ new Set();\n\tfunction compare(a, b) {\n\t\tif (a === b) return true;\n\t\tif (isVolatile(a) || isVolatile(b)) return isVolatile(a) && isVolatile(b);\n\t\tif (!strict && isNullable(a) && isNullable(b)) return true;\n\t\tif (typeof a !== typeof b || typeof a !== \"object\" || !a || !b) return false;\n\t\tif (ancestors.has(a)) return false;\n\t\tfunction check(test, then) {\n\t\t\treturn test(a) ? test(b) ? then(a, b) : false : test(b) ? false : void 0;\n\t\t}\n\t\tancestors.add(a);\n\t\ttry {\n\t\t\treturn check(Array.isArray, (a, b) => {\n\t\t\t\tif (a.length !== b.length) return false;\n\t\t\t\tfor (let index = 0; index < a.length; index++) if (!compare(a[index], b[index])) return false;\n\t\t\t\treturn true;\n\t\t\t}) ?? check(is(\"Date\"), (a, b) => a.valueOf() === b.valueOf()) ?? check(is(\"URL\"), (a, b) => a.href === b.href) ?? check(is(\"RegExp\"), (a, b) => a.source === b.source && a.flags === b.flags) ?? check(isArrayBufferLike, (a, b) => {\n\t\t\t\tif (a.byteLength !== b.byteLength) return false;\n\t\t\t\tconst viewA = new Uint8Array(a);\n\t\t\t\tconst viewB = new Uint8Array(b);\n\t\t\t\tfor (let i = 0; i < viewA.length; i++) if (viewA[i] !== viewB[i]) return false;\n\t\t\t\treturn true;\n\t\t\t}) ?? ((!strict || [a, b].every((value) => Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null)) && Object.keys({\n\t\t\t\t...a,\n\t\t\t\t...b\n\t\t\t}).every((key) => compare(a[key], b[key])));\n\t\t} finally {\n\t\t\tancestors.delete(a);\n\t\t}\n\t}\n\treturn compare(a, b);\n}\n//#endregion\n//#region lib/types/string.js\n/** Uppercase the first character of a string. */\nfunction capitalize(source) {\n\treturn source.charAt(0).toUpperCase() + source.slice(1);\n}\n/** Lowercase the first character of a string. */\nfunction uncapitalize(source) {\n\treturn source.charAt(0).toLowerCase() + source.slice(1);\n}\n/** Convert dash or underscore delimited text to camelCase. */\nfunction camelCase(source) {\n\treturn source.replace(/[_-][a-z]/g, (str) => str.slice(1).toUpperCase());\n}\nfunction tokenize(source, delimiters, delimiter) {\n\tconst output = [];\n\tlet state = 0;\n\tfor (let i = 0; i < source.length; i++) {\n\t\tconst code = source.charCodeAt(i);\n\t\tif (code >= 65 && code <= 90) {\n\t\t\tif (state === 1) {\n\t\t\t\tconst next = source.charCodeAt(i + 1);\n\t\t\t\tif (next >= 97 && next <= 122) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t} else {\n\t\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t}\n\t\t\tstate = 1;\n\t\t} else if (code >= 97 && code <= 122) {\n\t\t\toutput.push(code);\n\t\t\tstate = 2;\n\t\t} else if (delimiters.includes(code)) {\n\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\tstate = 0;\n\t\t} else output.push(code);\n\t}\n\treturn String.fromCharCode(...output);\n}\n/** Convert text to dash-delimited parameter case. */\nfunction paramCase(source) {\n\treturn tokenize(source, [45, 95], 45);\n}\n/** Convert text to underscore-delimited snake case. */\nfunction snakeCase(source) {\n\treturn tokenize(source, [45, 95], 95);\n}\n/** Runtime alias for `camelCase`. */\nconst camelize = camelCase;\n/** Runtime alias for `paramCase`. */\nconst hyphenate = paramCase;\n/** Format a property key as a JavaScript member access suffix. */\nfunction formatProperty(key) {\n\tif (typeof key !== \"string\") return `[${key.toString()}]`;\n\treturn /^[a-z_$][\\w$]*$/i.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`;\n}\n/** Remove one trailing slash from a path string. */\nfunction trimSlash(source) {\n\treturn source.replace(/\\/$/, \"\");\n}\n/** Ensure a path starts with `/` and has no trailing slash. */\nfunction sanitize(source) {\n\tif (!source.startsWith(\"/\")) source = \"/\" + source;\n\treturn trimSlash(source);\n}\n//#endregion\n//#region lib/types/time.js\n/** Time constants plus parsing and formatting helpers. */\nvar Time;\n(function(Time) {\n\tTime.millisecond = 1;\n\tTime.second = 1e3;\n\tTime.minute = Time.second * 60;\n\tTime.hour = Time.minute * 60;\n\tTime.day = Time.hour * 24;\n\tTime.week = Time.day * 7;\n\tlet timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();\n\tfunction setTimezoneOffset(offset) {\n\t\ttimezoneOffset = offset;\n\t}\n\tTime.setTimezoneOffset = setTimezoneOffset;\n\tfunction getTimezoneOffset() {\n\t\treturn timezoneOffset;\n\t}\n\tTime.getTimezoneOffset = getTimezoneOffset;\n\tfunction getDateNumber(date = /* @__PURE__ */ new Date(), offset) {\n\t\tif (typeof date === \"number\") date = new Date(date);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn Math.floor((date.valueOf() / Time.minute - offset) / 1440);\n\t}\n\tTime.getDateNumber = getDateNumber;\n\tfunction fromDateNumber(value, offset) {\n\t\tconst date = new Date(value * Time.day);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn new Date(+date + offset * Time.minute);\n\t}\n\tTime.fromDateNumber = fromDateNumber;\n\tconst numeric = /\\d+(?:\\.\\d+)?/.source;\n\tconst timeRegExp = new RegExp(`^${[\n\t\t\"w(?:eek(?:s)?)?\",\n\t\t\"d(?:ay(?:s)?)?\",\n\t\t\"h(?:our(?:s)?)?\",\n\t\t\"m(?:in(?:ute)?(?:s)?)?\",\n\t\t\"s(?:ec(?:ond)?(?:s)?)?\"\n\t].map((unit) => `(${numeric}${unit})?`).join(\"\")}$`);\n\tfunction parseTime(source) {\n\t\tconst capture = timeRegExp.exec(source);\n\t\tif (!capture) return 0;\n\t\treturn (parseFloat(capture[1]) * Time.week || 0) + (parseFloat(capture[2]) * Time.day || 0) + (parseFloat(capture[3]) * Time.hour || 0) + (parseFloat(capture[4]) * Time.minute || 0) + (parseFloat(capture[5]) * Time.second || 0);\n\t}\n\tTime.parseTime = parseTime;\n\tfunction parseDate(date) {\n\t\tconst parsed = parseTime(date);\n\t\tif (parsed) date = Date.now() + parsed;\n\t\telse if (/^\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${date}`;\n\t\telse if (/^\\d{1,2}-\\d{1,2}-\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).getFullYear()}-${date}`;\n\t\treturn date ? new Date(date) : /* @__PURE__ */ new Date();\n\t}\n\tTime.parseDate = parseDate;\n\tfunction format(ms) {\n\t\tconst abs = Math.abs(ms);\n\t\tif (abs >= Time.day - Time.hour / 2) return Math.round(ms / Time.day) + \"d\";\n\t\telse if (abs >= Time.hour - Time.minute / 2) return Math.round(ms / Time.hour) + \"h\";\n\t\telse if (abs >= Time.minute - Time.second / 2) return Math.round(ms / Time.minute) + \"m\";\n\t\telse if (abs >= Time.second) return Math.round(ms / Time.second) + \"s\";\n\t\treturn ms + \"ms\";\n\t}\n\tTime.format = format;\n\tfunction toDigits(source, length = 2) {\n\t\treturn source.toString().padStart(length, \"0\");\n\t}\n\tTime.toDigits = toDigits;\n\tfunction template(template, time = /* @__PURE__ */ new Date()) {\n\t\treturn template.replace(\"yyyy\", time.getFullYear().toString()).replace(\"yy\", time.getFullYear().toString().slice(2)).replace(\"MM\", toDigits(time.getMonth() + 1)).replace(\"dd\", toDigits(time.getDate())).replace(\"hh\", toDigits(time.getHours())).replace(\"mm\", toDigits(time.getMinutes())).replace(\"ss\", toDigits(time.getSeconds())).replace(\"SSS\", toDigits(time.getMilliseconds(), 3));\n\t}\n\tTime.template = template;\n})(Time || (Time = {}));\n//#endregion\nexport { Binary, Time, arrayBufferToBase64, arrayBufferToHex, base64ToArrayBuffer, camelCase, camelize, capitalize, clone, contain, createVolatile, deduplicate, deepEqual, defineProperty, difference, filterKeys, formatProperty, hexToArrayBuffer, hyphenate, intersection, is, isNonNullable, isNullable, isPlainObject, isVolatile, makeArray, mapValues, mapValues as valueMap, noop, omit, paramCase, pick, remove, sanitize, snakeCase, trimSlash, uncapitalize, union, updateVolatile, volatileEntries };\n", "/**\n * dsh-provider-proxy \u2014 Host half.\n *\n * Routes the model calls of the providers the user enabled through that\n * provider's own forward proxy. Every other provider, and all other DSH\n * traffic, keeps using the normal network path.\n */\n\nimport { acquireFetchRouter } from './fetch-router.js'\nimport { closeTable, createProxyTable, type RouteEntry } from './proxy-table.js'\nimport type { ProviderProxyRouteValue } from './config.js'\n\nexport const name = 'dsh-provider-proxy'\nexport const inject = ['llm']\n\n/**\n * The Config this fiber receives.\n *\n * It is NOT `ConfigShape`: under the Loader `providers` is a Volatile REFERENCE,\n * not the dictionary, so it has to be read through `.get()`. Declaring the plain\n * shape here made the two incompatible and hid every real value.\n */\ninterface ProxyConfig {\n /** The provider dictionary, or the Volatile wrapper around it. */\n readonly providers?: unknown\n}\n\nfunction plainProviders(\n config: ProxyConfig | undefined,\n): Record<string, Partial<ProviderProxyRouteValue>> {\n const raw = config?.providers\n if (raw === undefined) return {}\n // Under the Loader this is a Volatile reference; read it fresh every time so\n // a settings write is visible to the next request without a remount.\n const snapshot = (raw as { get?: () => unknown }).get\n const value = typeof snapshot === 'function' ? snapshot.call(raw) : raw\n return (value ?? {}) as Record<string, Partial<ProviderProxyRouteValue>>\n}\n\nexport function apply(ctx: any, config?: ProxyConfig): void {\n const router = acquireFetchRouter()\n let current = new Map<string, RouteEntry>()\n let problems = new Map<string, string>()\n let closed = false\n\n // One line on activation so a user can tell \"mounted\" from \"not mounted\" in\n // the Host log without guessing. Never prints a credential.\n try {\n ctx.logger.info('dsh-provider-proxy mounted (pid %d)', process.pid)\n } catch {\n // A context without a logger still works; the diagnostics getter remains.\n }\n\n const rebuild = async (): Promise<void> => {\n const next = await createProxyTable(plainProviders(config))\n const previous = current\n current = next.entries\n problems = next.problems\n // Retire the previous table only after the new one is live, so an in-flight\n // stream keeps a dispatcher that still works.\n void closeTable(previous)\n }\n\n const ready = rebuild()\n\n /**\n * The provider catalogue, read from `ctx.llm` where it is actually available.\n *\n * The browser has no LLM service in this release, so the page cannot ask for\n * this list itself. Serving it from the Host is the supported path: the\n * `webServer` service is confirmed live, and the shipped dsh-llm-retry-settings\n * registers its routes the same way.\n */\n const catalog = (): { providers: { id: string; name: string; live: boolean }[] } => {\n const live = new Set<string>()\n const out: { id: string; name: string; live: boolean }[] = []\n const seen = new Set<string>()\n try {\n for (const entry of ctx.llm?.listProviders?.() ?? []) {\n const id = entry?.id\n if (typeof id !== 'string' || id.length === 0) continue\n live.add(id)\n if (seen.has(id)) continue\n seen.add(id)\n const name = typeof entry?.name === 'string' && entry.name.length > 0 ? entry.name : id\n out.push({ id, name, live: true })\n }\n } catch {\n // no llm service in this composition\n }\n try {\n for (const entry of ctx.llm?.listConfigurableProviders?.() ?? []) {\n const id = entry?.provider\n if (typeof id !== 'string' || id.length === 0) continue\n const name =\n typeof entry.displayName === 'string' && entry.displayName.length > 0 ? entry.displayName : id\n const existing = out.find(row => row.id === id)\n if (existing === undefined) out.push({ id, name, live: live.has(id) })\n else existing.name = name\n }\n } catch {\n // ignore\n }\n out.sort((a, b) => a.name.localeCompare(b.name))\n return { providers: out }\n }\n\n // The page reads this same-origin JSON endpoint for the provider list. Mounted\n // inside an optional child so a composition without a web server still runs.\n ctx.inject?.(['webServer'], (wctx: any) => {\n try {\n wctx?.webServer?.register?.({\n kind: 'exact',\n path: '/dsh-provider-proxy/providers',\n handler: (_req: unknown, res: any) => {\n try {\n const text = JSON.stringify({ ...catalog(), problems: Object.fromEntries(problems) })\n res.writeHead(200, {\n 'content-type': 'application/json; charset=utf-8',\n 'cache-control': 'no-store',\n 'content-length': Buffer.byteLength(text),\n })\n res.end(text)\n } catch (error) {\n res.writeHead(500, { 'content-type': 'application/json' })\n res.end(JSON.stringify({ providers: [], error: String(error) }))\n }\n },\n })\n } catch (error) {\n // The page degrades to whatever is already configured.\n void error\n }\n })\n\n ctx.effect(() => {\n const stop = ctx.on(\n 'llm/stream',\n (options: { provider?: string }, next: () => AsyncIterable<unknown>) => {\n const provider = options?.provider\n if (typeof provider !== 'string') return next()\n const route = current.get(provider)\n if (route === undefined) return next()\n // The stream is consumed lazily; wrap it so the scope survives.\n return router.wrap(route.dispatcher, next as () => AsyncIterable<unknown>)\n },\n { global: true },\n )\n\n const onConfig = (): void => {\n void rebuild()\n }\n ctx.on('loader/volatile-update', onConfig, { global: true })\n\n return async () => {\n stop()\n if (closed) return\n closed = true\n await ready.catch(() => undefined)\n await closeTable(current)\n current = new Map()\n router.release()\n }\n }, 'dsh-provider-proxy: provider-scoped proxy routing')\n\n // Diagnostics, exported for the Host log and for tests. Never includes a\n // password: `proxyOrigin` is the sanitized origin only.\n Object.defineProperty(ctx, 'providerProxyState', {\n configurable: true,\n get: () => ({\n routes: [...current.values()].map(entry => ({\n provider: entry.provider,\n proxyOrigin: entry.proxyOrigin,\n })),\n problems: Object.fromEntries(problems),\n }),\n })\n}\n\nexport { acquireFetchRouter } from './fetch-router.js'\nexport { createProxyTable, closeTable, proxyUrl } from './proxy-table.js'\nexport { Config, ProviderProxyRoute, normalizeRoute, PROTOCOLS } from './config.js'"],
|
|
5
|
-
"mappings": ";;;;;;;AAoCA,SAAS,yBAAyB;AAClC,SAAS,SAAS,mBAAmB;AAYrC,IAAM,YAAY,uBAAO,IAAI,oCAAoC;AAUjE,SAAS,sBAAmC;AAC1C,QAAM,UAAW,WAAuD,SAAS;AACjF,MAAI,YAAY,QAAW;AACzB,YAAQ,UAAU;AAClB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,WAAW,UAAU,YAAY;AAC1C,UAAM,IAAI,MAAM,oEAAoE;AAAA,EACtF;AAEA,QAAM,UAAU,IAAI,kBAA+B;AACnD,QAAM,gBAAgB,WAAW;AACjC,QAAM,aAAa,OAAO,yBAAyB,YAAY,OAAO;AAEtE,QAAM,cAAc,SAASA,aAE3B,OACA,MACqC;AACrC,UAAM,SAAS,QAAQ,SAAS;AAEhC,QAAI,WAAW,OAAW,QAAO,cAAc,KAAK,YAAY,OAAO,IAAI;AAC3E,QAAI,SAAS,UAAa,SAAS,QAAS,KAAkC,eAAe,QAAW;AACtG,aAAO,cAAc,KAAK,YAAY,OAAO,IAAI;AAAA,IACnD;AAIA,WAAO,YAAY,OAAgB;AAAA,MACjC,GAAI;AAAA,MACJ,YAAY,OAAO;AAAA,IACrB,CAAU;AAAA,EACZ;AAEA,SAAO,eAAe,YAAY,SAAS;AAAA,IACzC,GAAI,cAAc,EAAE,cAAc,MAAM,YAAY,MAAM,UAAU,KAAK;AAAA,IACzE,OAAO;AAAA,EACT,CAAC;AAED,QAAM,QAAqB,EAAE,QAAQ,GAAG,SAAS,eAAe,aAAa,WAAW;AACxF,SAAO,eAAe,YAAY,WAAW;AAAA,IAC3C,cAAc;AAAA,IACd,OAAO;AAAA,EACT,CAAC;AACD,SAAO;AACT;AAUA,SAAS,mBACP,SACA,OACA,SACwB;AACxB,S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AS;AACjC,YAAM,WAAW,OAAO;AACxB,gBAAU,oBAAI,IAAI;AAClB,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,mDAAmD;AAItD,SAAO,eAAe,KAAK,sBAAsB;AAAA,IAC/C,cAAc;AAAA,IACd,KAAK,OAAO;AAAA,MACV,QAAQ,CAAC,GAAG,QAAQ,OAAO,CAAC,EAAE,IAAI,YAAU;AAAA,QAC1C,UAAU,MAAM;AAAA,QAChB,aAAa,MAAM;AAAA,MACrB,EAAE;AAAA,MACF,UAAU,OAAO,YAAY,QAAQ;AAAA,IACvC;AAAA,EACF,CAAC;AACH;",
|
|
4
|
+
"sourcesContent": ["/**\n * Provider-scoped fetch routing.\n *\n * DeepSeek Harness 0.2.0-rc.2 offers no supported seam for giving one LLM\n * provider its own transport:\n *\n * - `llm-deepseek` calls the unqualified global `fetch` with no `dispatcher`;\n * - `llm-pi-ai` delegates to the pi-ai SDK, whose HTTP layer DSH cannot\n * configure (its own source notes a fetch/dispatcher hook does not exist);\n * - `LlmCallControls` carries only reasoningEffort/temperature/maxTokens/stop;\n * - `llm/stream` intercepts already-decoded `StreamChunk`s, i.e. after HTTP;\n * - `ctx.web` serves `web_search`/`web_fetch` only, never provider traffic;\n * - the official `@deepseek-ai/dsh-http-proxy` is a library with a private\n * installer: one process-wide policy from env vars, no service, no Config.\n *\n * So the request is routed where the only available signal actually is: the\n * `llm/stream` waterfall, whose `options.provider` names the route. An\n * AsyncLocalStorage scope carries the chosen dispatcher over the stream, and a\n * thin `globalThis.fetch` wrapper applies it. Because every provider gets its\n * OWN dispatcher instance, one provider's proxy can never be picked up by\n * another provider's call \u2014 including two providers that resolve to the same\n * upstream host.\n *\n * IMPORTANT \u2014 one undici realm only. Node's built-in `fetch` uses an internal\n * undici and REJECTS a dispatcher built by the npm `undici` package with\n * `invalid onRequestStart method`, and vice versa. Every dispatcher here is\n * built from the npm `undici` that this module imports, so the wrapper must\n * dispatch through THAT same package's `fetch` rather than re-entering Node's.\n * The proxy therefore receives an absolute-form request line\n * (`GET http://host/path HTTP/1.1`), which is how an HTTP forward proxy is\n * addressed; an `https:` target is tunnelled with CONNECT.\n *\n * In-flight streams keep the dispatcher they started on; a configuration\n * change only affects new requests.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport { fetch as undiciFetch } from 'undici'\n\n/** Undici dispatcher, kept structurally typed so this file needs no undici types. */\nexport interface DispatcherLike {\n close(): Promise<void>\n}\n\nexport interface RouterStore {\n dispatcher: DispatcherLike\n}\n\n/** Shared across every plugin instance in one process, keyed so copies cooperate. */\nconst STATE_KEY = Symbol.for('dsh-provider-proxy.fetch-router.v1')\n\ninterface RouterState {\n owners: number\n storage: AsyncLocalStorage<RouterStore>\n originalFetch: typeof globalThis.fetch\n routedFetch: typeof globalThis.fetch\n descriptor?: PropertyDescriptor\n}\n\nfunction installSharedRouter(): RouterState {\n const current = (globalThis as Record<symbol, RouterState | undefined>)[STATE_KEY]\n if (current !== undefined) {\n current.owners += 1\n return current\n }\n\n if (typeof globalThis.fetch !== 'function') {\n throw new Error('dsh-provider-proxy: this Node runtime does not expose global fetch')\n }\n\n const storage = new AsyncLocalStorage<RouterStore>()\n const originalFetch = globalThis.fetch\n const descriptor = Object.getOwnPropertyDescriptor(globalThis, 'fetch')\n\n const routedFetch = function routedFetch(\n this: unknown,\n input: Parameters<typeof globalThis.fetch>[0],\n init?: Parameters<typeof globalThis.fetch>[1],\n ): ReturnType<typeof globalThis.fetch> {\n const active = storage.getStore()\n // No scope, or a caller that already picked a dispatcher: stay out of the way.\n if (active === undefined) return originalFetch.call(globalThis, input, init)\n if (init !== undefined && init !== null && (init as { dispatcher?: unknown }).dispatcher !== undefined) {\n return originalFetch.call(globalThis, input, init)\n }\n // Same undici realm as the dispatcher \u2014 Node's own fetch would reject it.\n // The init is passed through structurally: the DOM `RequestInit` and the\n // undici one disagree on `body`/`duplex`, so both are erased here.\n return undiciFetch(input as never, {\n ...(init as Record<string, unknown> | undefined),\n dispatcher: active.dispatcher as never,\n } as never) as never\n }\n\n Object.defineProperty(globalThis, 'fetch', {\n ...(descriptor ?? { configurable: true, enumerable: true, writable: true }),\n value: routedFetch,\n })\n\n const state: RouterState = { owners: 1, storage, originalFetch, routedFetch, descriptor }\n Object.defineProperty(globalThis, STATE_KEY, {\n configurable: true,\n value: state,\n })\n return state\n}\n\n/**\n * Re-apply the AsyncLocalStorage scope to every iterator operation.\n *\n * This is essential, not cosmetic: an adapter's stream is consumed lazily, so\n * the HTTP call typically happens inside a later `next()`, long after\n * `als.run(...)` returned. Without wrapping the iterator, every request would\n * silently fall back to the default dispatcher.\n */\nfunction contextualIterable(\n storage: AsyncLocalStorage<RouterStore>,\n store: RouterStore,\n factory: () => AsyncIterable<unknown>,\n): AsyncIterable<unknown> {\n return {\n [Symbol.asyncIterator]() {\n let iterator: AsyncIterator<unknown> | undefined\n\n const ensureIterator = (): AsyncIterator<unknown> => {\n if (iterator !== undefined) return iterator\n const iterable = factory()\n if (iterable === null || typeof iterable?.[Symbol.asyncIterator] !== 'function') {\n throw new TypeError('dsh-provider-proxy: llm/stream next() did not return an AsyncIterable')\n }\n iterator = iterable[Symbol.asyncIterator]()\n return iterator\n }\n\n const invoke = (method: 'next' | 'return' | 'throw', value?: unknown): Promise<IteratorResult<unknown>> =>\n storage.run(store, () => {\n // A stream abandoned before its first next() must not touch the adapter.\n if (method === 'return' && iterator === undefined) return Promise.resolve({ done: true, value })\n if (method === 'throw' && iterator === undefined) return Promise.reject(value)\n const target = ensureIterator()\n const operation = target[method]\n if (typeof operation !== 'function') {\n if (method === 'return') return Promise.resolve({ done: true, value })\n return Promise.reject(value)\n }\n return Promise.resolve(Reflect.apply(operation, target, method === 'next' ? [] : [value]))\n })\n\n return {\n next: (value?: unknown) => invoke('next', value),\n return: (value?: unknown) => invoke('return', value),\n throw: (value?: unknown) => invoke('throw', value),\n [Symbol.asyncIterator]() {\n return this\n },\n }\n },\n }\n}\n\nexport interface FetchRouter {\n /** Run one synchronous callback inside the provider's scope. */\n run(dispatcher: DispatcherLike, callback: () => unknown): unknown\n /** Wrap a lazy stream so every consumption step keeps the scope. */\n wrap(dispatcher: DispatcherLike, factory: () => AsyncIterable<unknown>): AsyncIterable<unknown>\n /** Release this holder; the shim is removed once the last holder releases. */\n release(): void\n}\n\n/** Install (or share) the single process-wide fetch shim. */\nexport function acquireFetchRouter(): FetchRouter {\n const state = installSharedRouter()\n let released = false\n\n return {\n run(dispatcher, callback) {\n return state.storage.run({ dispatcher }, callback)\n },\n wrap(dispatcher, factory) {\n return contextualIterable(state.storage, { dispatcher }, factory)\n },\n release() {\n if (released) return\n released = true\n state.owners -= 1\n if (state.owners !== 0) return\n\n if (globalThis.fetch === state.routedFetch) {\n if (state.descriptor === undefined) delete (globalThis as { fetch?: unknown }).fetch\n else Object.defineProperty(globalThis, 'fetch', state.descriptor)\n }\n delete (globalThis as Record<symbol, unknown>)[STATE_KEY]\n state.storage.disable()\n },\n }\n}", "/**\r\n * The proxy table: one dispatcher per enabled provider.\r\n *\r\n * A dispatcher is created per provider rather than shared, so a proxied\r\n * provider can never leak its transport into another provider's call even when\r\n * both resolve to the same upstream host.\r\n *\r\n * Two transports are supported, and they come from the SAME npm undici instance\r\n * (the build leaves `undici` external), which is what lets both be handed to\r\n * `undiciFetch` by the router:\r\n *\r\n * - `http`/`https` \u2192 `ProxyAgent`, which speaks HTTP CONNECT to an HTTP proxy;\r\n * - `socks5` \u2192 `Socks5ProxyAgent`, undici's built-in RFC 1928/1929 client,\r\n * which tunnels the target instead of forwarding to it.\r\n */\r\n\r\nimport { ProxyAgent, Socks5ProxyAgent } from 'undici'\r\n\r\nimport { normalizeRoute, type ProviderProxyRouteValue } from './config.js'\r\nimport type { DispatcherLike } from './fetch-router.js'\r\n\r\nexport interface RouteEntry {\r\n provider: string\r\n /** Normalized proxy origin, for diagnostics only. Never logged with credentials. */\r\n proxyOrigin: string\r\n dispatcher: DispatcherLike\r\n}\r\n\r\nfunction proxyUrl(route: ProviderProxyRouteValue): string {\r\n const auth =\r\n route.username.length === 0\r\n ? ''\r\n : `${encodeURIComponent(route.username).replace(/%3A/gi, ':')}@`\r\n // IPv6 literals need brackets in a URL authority.\r\n const host = route.host.includes(':') && !route.host.startsWith('[') ? `[${route.host}]` : route.host\r\n return `${route.protocol}://${auth}${host}:${route.port}`\r\n}\r\n\r\n/**\r\n * A credential-free origin, for diagnostics only.\r\n *\r\n * `new URL(url).origin` is NOT usable for socks5: socks5 is a non-special\r\n * scheme, and WHATWG URL serializes the origin of a non-special scheme as the\r\n * string `'null'` (the same rule that made `gopher` return `'null'` in Node\r\n * 15). That value is surfaced verbatim in `ctx.providerProxyState` and in the\r\n * settings page's diagnostics, so it would hide which proxy a SOCKS5 provider\r\n * is using. HTTP keeps using `.origin`, which is what it already did.\r\n *\r\n * Credentials are never part of this string: it is built from host and port.\r\n */\r\nfunction displayOrigin(route: ProviderProxyRouteValue, url: string): string {\r\n if (route.protocol !== 'socks5') return new URL(url).origin\r\n const host = route.host.includes(':') && !route.host.startsWith('[') ? `[${route.host}]` : route.host\r\n return `${route.protocol}://${host}:${route.port}`\r\n}\r\n\r\n/**\r\n * Build the dispatcher for one route.\r\n *\r\n * SOCKS5 authentication is passed as options rather than through the URL so the\r\n * password never appears in the proxy address. `Socks5ProxyAgent` also accepts\r\n * userinfo in the URL, but `proxyUrl()` already emits the username there for\r\n * the HTTP case, and the explicit option takes precedence \u2014 so the password\r\n * stays out of the string that is logged and reported.\r\n */\r\nfunction createDispatcher(\r\n route: ProviderProxyRouteValue,\r\n url: string,\r\n password: string,\r\n): DispatcherLike {\r\n if (route.protocol === 'socks5') {\r\n const auth: { username?: string; password?: string } = {}\r\n if (route.username.length > 0) auth.username = route.username\r\n if (password.length > 0) auth.password = password\r\n return new Socks5ProxyAgent(url, auth) as unknown as DispatcherLike\r\n }\r\n return new ProxyAgent({ uri: url }) as unknown as DispatcherLike\r\n}\r\n\r\n/**\r\n * Build the dispatchers for every enabled, valid route.\r\n *\r\n * Invalid routes are skipped rather than thrown: one mistyped provider must not\r\n * stop the others from proxying. The caller surfaces the reason through\r\n * `problems`, which the Client shows instead of failing the whole table.\r\n */\r\nexport function createProxyTable(\r\n config: { readonly [provider: string]: Partial<ProviderProxyRouteValue> } | undefined,\r\n): { entries: Map<string, RouteEntry>; problems: Map<string, string> } {\r\n const entries = new Map<string, RouteEntry>()\r\n const problems = new Map<string, string>()\r\n\r\n for (const [provider, raw] of Object.entries(config ?? {})) {\r\n let route: ProviderProxyRouteValue\r\n try {\r\n route = normalizeRoute(provider, raw)\r\n } catch (error) {\r\n problems.set(provider, error instanceof Error ? error.message : String(error))\r\n continue\r\n }\r\n if (!route.enabled) continue\r\n\r\n // A SOCKS5 username without a password must be REFUSED, not downgraded.\r\n //\r\n // undici's Socks5Client only offers USERNAME_PASSWORD when both parts are\r\n // present (`if (options.username && options.password)`); with a username\r\n // alone it quietly advertises NO_AUTH. Against a proxy that requires\r\n // authentication the user would then be told \"Authentication failed\" \u2014 a\r\n // wrong diagnosis pointing at the proxy rather than at the missing setting.\r\n if (route.protocol === 'socks5' && route.username.length > 0 && route.password.length === 0) {\r\n problems.set(\r\n provider,\r\n 'dsh-provider-proxy: SOCKS5 \u914D\u7F6E\u4E86\u7528\u6237\u540D\u4F46\u6CA1\u6709\u5BC6\u7801\uFF1B\u8BF7\u8865\u5168\u5BC6\u7801\u6216\u6E05\u7A7A\u7528\u6237\u540D',\r\n )\r\n continue\r\n }\r\n\r\n const url = proxyUrl(route)\r\n let dispatcher: DispatcherLike\r\n try {\r\n dispatcher = createDispatcher(route, url, route.password)\r\n } catch (error) {\r\n problems.set(provider, error instanceof Error ? error.message : String(error))\r\n continue\r\n }\r\n entries.set(provider, { provider, proxyOrigin: displayOrigin(route, url), dispatcher })\r\n }\r\n\r\n return { entries, problems }\r\n}\r\n\r\n/** Close every dispatcher, ignoring individual failures. */\r\nexport async function closeTable(entries: Map<string, RouteEntry>): Promise<void> {\r\n const closing = [...entries.values()].map(entry => entry.dispatcher.close().catch(() => undefined))\r\n await Promise.allSettled(closing)\r\n entries.clear()\r\n}\r\n\r\nexport { proxyUrl }", "/**\r\n * Plugin Config.\r\n *\r\n * Shape notes, all verified against DeepSeek Harness 0.2.0-rc.2:\r\n *\r\n * - `schemastery` is NOT guaranteed to be resolvable from a profile-hoisted\r\n * install, so the real package is preferred at runtime when `createRequire`\r\n * can see it and a bundled fallback is used otherwise. The reference plugin\r\n * `dsh-llm-retry-settings` does exactly this.\r\n * - Every editable field is `.volatile()` so a settings write is committed\r\n * into the running fiber WITHOUT remounting the plugin; the Host then\r\n * rebuilds its proxy table. Ordinary (non-volatile) fields would restart the\r\n * plugin instead, which is not what a settings page wants.\r\n * - The SOCKS5 proxy password lives directly on the route as `password`, so the\r\n * settings page writes it into cordis.patch.yml in the clear. It is only ever\r\n * handed to `Socks5ProxyAgent` as an option, never embedded in the proxy URL\r\n * that is logged or shown in the diagnostics.\r\n */\r\n\r\nimport { createRequire } from 'node:module'\r\n\r\n// Imported statically so the bundler inlines it, making the package\r\n// self-contained. `loadSchemastery` below still PREFERS the profile's own copy\r\n// when one is reachable, so a DSH-provided instance stays authoritative; this\r\n// bundled copy is only the fallback that lets the plugin load at all.\r\nimport * as BundledSchema from '@deepseek-ai/schemastery'\r\n\r\ntype SchemaLike = {\r\n object: (...args: any[]) => any\r\n string: (...args: any[]) => any\r\n boolean: (...args: any[]) => any\r\n number: (...args: any[]) => any\r\n dict: (...args: any[]) => any\r\n union: (...args: any[]) => any\r\n}\r\n\r\n/**\r\n * Resolve the schemastery module for this fiber.\r\n *\r\n * A profile installation hoists dependencies next to the profile rather than\r\n * under this package, so a bare `import` can fail even when the Host itself\r\n * uses schemastery. `createRequire` resolves against this file's real\r\n * location, which is the best available view of the installation tree.\r\n *\r\n * When that finds nothing \u2014 a plain `npm install` of this package, which pulls\r\n * no schemastery \u2014 the BUNDLED copy is used, so the plugin still loads instead\r\n * of throwing at require time.\r\n */\r\nfunction loadSchemastery(): SchemaLike {\r\n try {\r\n const require = createRequire(import.meta.url)\r\n const candidate = require('@deepseek-ai/schemastery')\r\n const live = (candidate as { default?: SchemaLike })?.default ?? (candidate as SchemaLike)\r\n if (live && typeof live.object === 'function') return live\r\n } catch {\r\n // Fall through to the bundled copy below.\r\n }\r\n // The static import is only a fallback; what it actually exposes is decided at\r\n // runtime, which this structural type deliberately does not pin.\r\n const bundled = (BundledSchema as { default?: unknown }).default ?? BundledSchema\r\n if (typeof (bundled as SchemaLike).object === 'function') return bundled as SchemaLike\r\n throw new Error('dsh-provider-proxy: no usable @deepseek-ai/schemastery in this installation')\r\n}\r\n\r\nconst z = loadSchemastery()\r\n\r\n/** Apply `.volatile()` when the resolved schemastery supports it. */\r\nfunction vol<T>(field: T): T {\r\n const volatile = (field as { volatile?: () => unknown }).volatile\r\n return typeof volatile === 'function' ? (volatile.call(field) as T) : field\r\n}\r\n\r\n/** Forward-compatible passthrough for schemastery extensions used below. */\r\nfunction stepMin<T extends { step?: (n: number) => T; min?: (n: number) => T }>(field: T, step?: number): T {\r\n let out = field\r\n if (step !== undefined && typeof out.step === 'function') out = out.step(step)\r\n return out\r\n}\r\n\r\n/** Supported forward-proxy transports. */\r\nexport const PROTOCOLS = ['http', 'https', 'socks5'] as const\r\nexport type Protocol = (typeof PROTOCOLS)[number]\r\n\r\n/**\r\n * One provider's proxy settings. Keyed by provider route id.\r\n *\r\n * `port` is deliberately NOT constrained by schemastery's min/max: an unset\r\n * proxy is `0` (meaning \"no port chosen yet\"), and a bound of 1 here would make\r\n * that default fail to parse. The real range check lives in `normalizeRoute`,\r\n * which runs only when a route is actually enabled, so the error can name the\r\n * provider instead of surfacing a bare schema path.\r\n */\r\nexport const ProviderProxyRoute = z.object({\r\n /** Whether this provider's calls are routed through the proxy below. */\r\n enabled: z.boolean().default(false),\r\n /** Proxy transport. `socks5` is accepted but only honoured when the socks helper loaded. */\r\n protocol: z.union(PROTOCOLS).default('http'),\r\n /** Proxy host or IP, without scheme, port, or path. */\r\n host: z.string().default(''),\r\n /** Proxy port. 0 means \"not configured\"; enabled routes require 1-65535. */\r\n port: z.number().default(0),\r\n /** Optional proxy username. */\r\n username: z.string().default(''),\r\n /** SOCKS5 proxy password. Only used when `protocol` is `socks5`. */\r\n password: z.string().default(''),\r\n})\r\n\r\nexport const Config = z.object({\r\n /** Per-provider proxy routes, keyed by provider route id (e.g. `sensenova`). */\r\n providers: vol(z.dict(ProviderProxyRoute).default({})),\r\n})\r\n\r\nexport interface ProviderProxyRouteValue {\r\n enabled: boolean\r\n protocol: Protocol\r\n host: string\r\n port: number\r\n username: string\r\n password: string\r\n}\r\n\r\nexport interface ConfigShape {\r\n providers: { readonly [provider: string]: ProviderProxyRouteValue }\r\n}\r\n\r\n/**\r\n * Validate one route and return the normalized value, or throw with a\r\n * field-scoped message. Used by both the Host (before opening a dispatcher)\r\n * and the settings form (before writing), so an invalid value never reaches\r\n * disk or the network.\r\n */\r\nexport function normalizeRoute(\r\n provider: string,\r\n raw: Partial<ProviderProxyRouteValue> | undefined,\r\n): ProviderProxyRouteValue {\r\n const route = ProviderProxyRoute(raw ?? {})\r\n const value = typeof (route as { get?: () => unknown }).get === 'function'\r\n ? (route as unknown as { get: () => ProviderProxyRouteValue }).get()\r\n : (route as ProviderProxyRouteValue)\r\n\r\n if (!value.enabled) return { ...value, port: value.port || 0 }\r\n\r\n const host = value.host.trim()\r\n if (host.length === 0) {\r\n throw new TypeError(`dsh-provider-proxy: provider \"${provider}\" \u542F\u7528\u4E86\u4EE3\u7406\uFF0C\u4F46\u672A\u586B\u5199\u4EE3\u7406\u5730\u5740`)\r\n }\r\n if (/^[a-z][a-z0-9+.-]*:\\/\\//i.test(host) || host.includes('/')) {\r\n throw new TypeError(`dsh-provider-proxy: provider \"${provider}\" \u7684\u4EE3\u7406\u5730\u5740\u53EA\u586B\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4E0D\u8981\u5E26\u534F\u8BAE\u524D\u7F00\u6216\u8DEF\u5F84`)\r\n }\r\n if (!Number.isInteger(value.port) || value.port < 1 || value.port > 65535) {\r\n throw new TypeError(\r\n `dsh-provider-proxy: provider \"${provider}\" \u7684\u4EE3\u7406\u7AEF\u53E3\u65E0\u6548\uFF08\u9700\u4E3A 1-65535 \u7684\u6574\u6570\uFF09`,\r\n )\r\n }\r\n return { ...value, host, username: value.username.trim() }\r\n}", "import { Binary, clone, createVolatile, deepEqual, filterKeys, isNullable, isPlainObject, isVolatile, pick, valueMap } from \"@deepseek-ai/cosmokit\";\n//#region lib/types/index.js\nconst kSchema = Symbol.for(\"schemastery\");\nconst kValidationError = Symbol.for(\"ValidationError\");\nglobalThis.__schemastery_index__ ??= 0;\nglobalThis.__schemastery_refs__ = void 0;\nvar ValidationError = class extends TypeError {\n\toptions;\n\tname = \"ValidationError\";\n\tconstructor(message, options) {\n\t\tlet prefix = \"$\";\n\t\tfor (const segment of options.path || []) if (typeof segment === \"string\") prefix += \".\" + segment;\n\t\telse if (typeof segment === \"number\") prefix += \"[\" + segment + \"]\";\n\t\telse if (typeof segment === \"symbol\") prefix += `[Symbol(${segment.toString()})]`;\n\t\tif (prefix.startsWith(\".\")) prefix = prefix.slice(1);\n\t\tsuper((prefix === \"$\" ? \"\" : `${prefix} `) + message);\n\t\tthis.options = options;\n\t}\n\tstatic is(error) {\n\t\treturn !!error?.[kValidationError];\n\t}\n};\nObject.defineProperty(ValidationError.prototype, kValidationError, { value: true });\nconst Schema = function(options) {\n\tconst schema = function(data, options = {}) {\n\t\treturn Schema.resolve(data, schema, options)[0];\n\t};\n\tif (options.refs) {\n\t\tconst refs = valueMap(options.refs, (options) => new Schema(options));\n\t\tconst getRef = (uid) => refs[uid];\n\t\tfor (const key in refs) {\n\t\t\tconst options = refs[key];\n\t\t\toptions.sKey = getRef(options.sKey);\n\t\t\toptions.inner = getRef(options.inner);\n\t\t\toptions.list = options.list && options.list.map(getRef);\n\t\t\toptions.dict = options.dict && valueMap(options.dict, getRef);\n\t\t}\n\t\treturn refs[options.uid];\n\t}\n\tObject.assign(schema, options);\n\tif (typeof schema.callback === \"string\") try {\n\t\tschema.callback = new Function(\"return \" + schema.callback)();\n\t} catch {}\n\tObject.defineProperty(schema, \"uid\", { value: globalThis.__schemastery_index__++ });\n\tObject.setPrototypeOf(schema, Schema.prototype);\n\tschema.meta ||= {};\n\tschema.toString = schema.toString.bind(schema);\n\treturn schema;\n};\nSchema.prototype = Object.create(Function.prototype);\nSchema.prototype[kSchema] = true;\nObject.defineProperty(Schema.prototype, \"~standard\", { get() {\n\treturn {\n\t\tversion: 1,\n\t\tvendor: \"schemastery\",\n\t\tvalidate: (value) => {\n\t\t\ttry {\n\t\t\t\treturn { value: Schema.resolve(value, this, {})[0] };\n\t\t\t} catch (error) {\n\t\t\t\tif (ValidationError.is(error)) return { issues: [{\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tpath: error.options.path\n\t\t\t\t}] };\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t};\n} });\nSchema.ValidationError = ValidationError;\nSchema.prototype.toJSON = function toJSON() {\n\tif (globalThis.__schemastery_refs__) {\n\t\tglobalThis.__schemastery_refs__[this.uid] ??= JSON.parse(JSON.stringify({ ...this }));\n\t\treturn this.uid;\n\t}\n\tglobalThis.__schemastery_refs__ = { [this.uid]: { ...this } };\n\tglobalThis.__schemastery_refs__[this.uid] = JSON.parse(JSON.stringify({ ...this }));\n\tconst result = {\n\t\tuid: this.uid,\n\t\trefs: globalThis.__schemastery_refs__\n\t};\n\tglobalThis.__schemastery_refs__ = void 0;\n\treturn result;\n};\nSchema.prototype.set = function set(key, value) {\n\tthis.dict[key] = value;\n\treturn this;\n};\nSchema.prototype.push = function push(value) {\n\tthis.list.push(value);\n\treturn this;\n};\nfunction mergeDesc(original, messages) {\n\tconst result = typeof original === \"string\" ? { \"\": original } : { ...original };\n\tfor (const locale in messages) {\n\t\tconst value = messages[locale];\n\t\tif (value?.$description || value?.$desc) result[locale] = value.$description || value.$desc;\n\t\telse if (typeof value === \"string\") result[locale] = value;\n\t}\n\treturn result;\n}\nfunction getInner(value) {\n\treturn value?.$value ?? value?.$inner;\n}\nfunction extractKeys(data) {\n\treturn filterKeys(data ?? {}, (key) => !key.startsWith(\"$\"));\n}\nSchema.prototype.i18n = function i18n(messages) {\n\tconst schema = Schema(this);\n\tconst desc = mergeDesc(schema.meta.description, messages);\n\tif (Object.keys(desc).length) schema.meta.description = desc;\n\tif (schema.dict) schema.dict = valueMap(schema.dict, (inner, key) => {\n\t\treturn inner.i18n(valueMap(messages, (data) => getInner(data)?.[key] ?? data?.[key]));\n\t});\n\tif (schema.list) schema.list = schema.list.map((inner, index) => {\n\t\treturn inner.i18n(valueMap(messages, (data = {}) => {\n\t\t\tif (Array.isArray(getInner(data))) return getInner(data)[index];\n\t\t\tif (Array.isArray(data)) return data[index];\n\t\t\treturn extractKeys(data);\n\t\t}));\n\t});\n\tif (schema.inner) schema.inner = schema.inner.i18n(valueMap(messages, (data) => {\n\t\tif (getInner(data)) return getInner(data);\n\t\treturn extractKeys(data);\n\t}));\n\tif (schema.sKey) schema.sKey = schema.sKey.i18n(valueMap(messages, (data) => data?.$key));\n\treturn schema;\n};\nSchema.prototype.extra = function extra(key, value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"required\",\n\t\"disabled\",\n\t\"collapse\",\n\t\"hidden\",\n\t\"loose\"\n]) Object.assign(Schema.prototype, { [key](value = true) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nSchema.prototype.deprecated = function deprecated() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"deprecated\",\n\t\ttype: \"danger\"\n\t});\n\treturn schema;\n};\nSchema.prototype.experimental = function experimental() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"experimental\",\n\t\ttype: \"warning\"\n\t});\n\treturn schema;\n};\nSchema.prototype.pattern = function pattern(regexp) {\n\tconst schema = Schema(this);\n\tconst pattern = pick(regexp, [\"source\", \"flags\"]);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\tpattern\n\t};\n\treturn schema;\n};\nSchema.prototype.simplify = function simplify(value) {\n\tif (isVolatile(value)) value = value.get();\n\tif (deepEqual(value, this.meta.default, this.type === \"dict\")) return null;\n\tif (isNullable(value)) return value;\n\tif (this.type === \"object\" || this.type === \"dict\") {\n\t\tconst result = {};\n\t\tfor (const key in value) {\n\t\t\tconst item = (this.type === \"object\" ? this.dict[key] : this.inner)?.simplify(value[key]);\n\t\t\tif (this.type === \"dict\" || !isNullable(item)) result[key] = item;\n\t\t}\n\t\tif (deepEqual(result, this.meta.default, this.type === \"dict\")) return null;\n\t\treturn result;\n\t} else if (this.type === \"array\" || this.type === \"tuple\") {\n\t\tconst result = [];\n\t\tvalue.forEach((value, index) => {\n\t\t\tconst schema = this.type === \"array\" ? this.inner : this.list[index];\n\t\t\tconst item = schema ? schema.simplify(value) : value;\n\t\t\tresult.push(item);\n\t\t});\n\t\treturn result;\n\t} else if (this.type === \"intersect\") {\n\t\tconst result = {};\n\t\tfor (const item of this.list) Object.assign(result, item.simplify(value));\n\t\treturn result;\n\t} else if (this.type === \"union\") for (const schema of this.list) try {\n\t\tSchema.resolve(value, schema, {});\n\t\treturn schema.simplify(value);\n\t} catch {}\n\treturn value;\n};\nSchema.prototype.toString = function toString(inline) {\n\treturn formatters[this.type]?.(this, inline) ?? `Schema<${this.type}>`;\n};\nSchema.prototype.role = function role(role, extra) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\trole,\n\t\textra\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"default\",\n\t\"link\",\n\t\"comment\",\n\t\"description\",\n\t\"max\",\n\t\"min\",\n\t\"step\"\n]) Object.assign(Schema.prototype, { [key](value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nSchema.prototype.volatile = function volatile() {\n\tif (this.meta.volatile) throw new TypeError(\"volatile schema is already wrapped\");\n\treturn this.extra(\"volatile\", true);\n};\nconst resolvers = {};\nconst checkedVolatile = Symbol(\"checked-volatile-schema\");\nfunction validateVolatileSchema(schema, path = [], blocked = false, seen = /* @__PURE__ */ new Map()) {\n\tconst states = seen.get(schema) ?? /* @__PURE__ */ new Set();\n\tif (states.has(blocked)) return;\n\tstates.add(blocked);\n\tseen.set(schema, states);\n\tif (schema.meta?.volatile && blocked) throw new ValidationError(\"volatile fields require a fixed object path without an enclosing volatile field\", { path });\n\tconst nested = blocked || !!schema.meta?.volatile;\n\tif (schema.dict) for (const [key, child] of Object.entries(schema.dict)) validateVolatileSchema(child, [...path, key], nested, seen);\n\tif (schema.sKey) validateVolatileSchema(schema.sKey, [...path, \"<key>\"], true, seen);\n\tif (schema.inner && (schema.type !== \"lazy\" || schema.inner[kSchema])) validateVolatileSchema(schema.inner, [...path, \"*\"], true, seen);\n\tif (schema.list) for (let index = 0; index < schema.list.length; index++) validateVolatileSchema(schema.list[index], [...path, String(index)], true, seen);\n}\nSchema.extend = function extend(type, resolve) {\n\tresolvers[type] = resolve;\n};\nSchema.resolve = function resolve(data, schema, options = {}, strict = false) {\n\tif (!schema) return [data];\n\tif (!options[checkedVolatile]) {\n\t\tvalidateVolatileSchema(schema, options.path);\n\t\toptions = {\n\t\t\t...options,\n\t\t\t[checkedVolatile]: true\n\t\t};\n\t}\n\tif (schema.meta?.volatile) {\n\t\tconst inner = Schema(schema);\n\t\tinner.meta = {\n\t\t\t...schema.meta,\n\t\t\tvolatile: false\n\t\t};\n\t\tconst [value, adapted] = Schema.resolve(data, inner, options, strict);\n\t\ttry {\n\t\t\treturn [createVolatile(value), adapted];\n\t\t} catch (error) {\n\t\t\tthrow new ValidationError(error instanceof Error ? error.message : String(error), options);\n\t\t}\n\t}\n\tif (options.ignore?.(data, schema)) return [data];\n\tif (isNullable(data) && schema.type !== \"lazy\") {\n\t\tif (schema.meta.required) throw new ValidationError(`missing required value`, options);\n\t\tlet current = schema;\n\t\tlet fallback = schema.meta.default;\n\t\twhile (current?.type === \"intersect\" && isNullable(fallback)) {\n\t\t\tcurrent = current.list[0];\n\t\t\tfallback = current?.meta.default;\n\t\t}\n\t\tif (isNullable(fallback)) return [data];\n\t\tdata = clone(fallback);\n\t}\n\tconst callback = resolvers[schema.type];\n\tif (!callback) throw new ValidationError(`unsupported type \"${schema.type}\"`, options);\n\ttry {\n\t\treturn callback(data, schema, options, strict);\n\t} catch (error) {\n\t\tif (!schema.meta.loose) throw error;\n\t\treturn [schema.meta.default];\n\t}\n};\nSchema.from = function from(source) {\n\tif (isNullable(source)) return Schema.any();\n\telse if ([\n\t\t\"string\",\n\t\t\"number\",\n\t\t\"boolean\"\n\t].includes(typeof source)) return Schema.const(source).required();\n\telse if (source[kSchema]) return source;\n\telse if (typeof source === \"function\") switch (source) {\n\t\tcase String: return Schema.string().required();\n\t\tcase Number: return Schema.number().required();\n\t\tcase Boolean: return Schema.boolean().required();\n\t\tcase Function: return Schema.function().required();\n\t\tdefault: return Schema.is(source).required();\n\t}\n\telse throw new TypeError(`cannot infer schema from ${source}`);\n};\nSchema.lazy = function lazy(builder) {\n\tconst toJSON = () => {\n\t\tif (!schema.inner[kSchema]) {\n\t\t\tschema.inner = schema.builder();\n\t\t\tschema.inner.meta = {\n\t\t\t\t...schema.meta,\n\t\t\t\t...schema.inner.meta\n\t\t\t};\n\t\t}\n\t\treturn schema.inner.toJSON();\n\t};\n\tconst schema = new Schema({\n\t\ttype: \"lazy\",\n\t\tbuilder,\n\t\tinner: { toJSON }\n\t});\n\treturn schema;\n};\nSchema.natural = function natural() {\n\treturn Schema.number().step(1).min(0);\n};\nSchema.percent = function percent() {\n\treturn Schema.number().step(.01).min(0).max(1).role(\"slider\");\n};\nSchema.date = function date() {\n\treturn Schema.union([Schema.is(Date), Schema.transform(Schema.string().role(\"datetime\"), (value, options) => {\n\t\tconst date = new Date(value);\n\t\tif (isNaN(+date)) throw new ValidationError(`invalid date \"${value}\"`, options);\n\t\treturn date;\n\t}, true)]);\n};\nSchema.regExp = function regExp(flag = \"\") {\n\treturn Schema.union([Schema.is(RegExp), Schema.transform(Schema.string().role(\"regexp\", { flag }), (value, options) => {\n\t\ttry {\n\t\t\treturn new RegExp(value, flag);\n\t\t} catch (e) {\n\t\t\tthrow new ValidationError(e.message, options);\n\t\t}\n\t}, true)]);\n};\nSchema.arrayBuffer = function arrayBuffer(encoding) {\n\treturn Schema.union([\n\t\tSchema.is(ArrayBuffer),\n\t\tSchema.is(SharedArrayBuffer),\n\t\tSchema.transform(Schema.any(), (value, options) => {\n\t\t\tif (Binary.isSource(value)) return Binary.fromSource(value);\n\t\t\tthrow new ValidationError(`expected ArrayBufferSource but got ${value}`, options);\n\t\t}, true),\n\t\t...encoding ? [Schema.transform(Schema.string(), (value, options) => {\n\t\t\ttry {\n\t\t\t\treturn encoding === \"base64\" ? Binary.fromBase64(value) : Binary.fromHex(value);\n\t\t\t} catch (e) {\n\t\t\t\tthrow new ValidationError(e.message, options);\n\t\t\t}\n\t\t}, true)] : []\n\t]);\n};\nSchema.extend(\"lazy\", (data, schema, options, strict) => {\n\tif (!schema.inner[kSchema]) {\n\t\tschema.inner = schema.builder();\n\t\tschema.inner.meta = {\n\t\t\t...schema.meta,\n\t\t\t...schema.inner.meta\n\t\t};\n\t\tvalidateVolatileSchema(schema.inner, options.path, true);\n\t}\n\treturn Schema.resolve(data, schema.inner, options, strict);\n});\nSchema.extend(\"any\", (data) => {\n\treturn [data];\n});\nSchema.extend(\"never\", (data, _, options) => {\n\tthrow new ValidationError(`expected nullable but got ${data}`, options);\n});\nSchema.extend(\"const\", (data, { value }, options) => {\n\tif (deepEqual(data, value)) return [value];\n\tthrow new ValidationError(`expected ${value} but got ${data}`, options);\n});\nfunction checkWithinRange(data, meta, description, options, skipMin = false) {\n\tconst { max = Infinity, min = -Infinity } = meta;\n\tif (data > max) throw new ValidationError(`expected ${description} <= ${max} but got ${data}`, options);\n\tif (data < min && !skipMin) throw new ValidationError(`expected ${description} >= ${min} but got ${data}`, options);\n}\nSchema.extend(\"string\", (data, { meta }, options) => {\n\tif (typeof data !== \"string\") throw new ValidationError(`expected string but got ${data}`, options);\n\tif (meta.pattern) {\n\t\tconst regexp = new RegExp(meta.pattern.source, meta.pattern.flags);\n\t\tif (!regexp.test(data)) throw new ValidationError(`expect string to match regexp ${regexp}`, options);\n\t}\n\tcheckWithinRange(data.length, meta, \"string length\", options);\n\treturn [data];\n});\nfunction decimalShift(data, digits) {\n\tconst str = data.toString();\n\tif (str.includes(\"e\")) return data * Math.pow(10, digits);\n\tconst index = str.indexOf(\".\");\n\tif (index === -1) return data * Math.pow(10, digits);\n\tconst frac = str.slice(index + 1);\n\tconst integer = str.slice(0, index);\n\tif (frac.length <= digits) return +(integer + frac.padEnd(digits, \"0\"));\n\treturn +(integer + frac.slice(0, digits) + \".\" + frac.slice(digits));\n}\nfunction isMultipleOf(data, min, step) {\n\tstep = Math.abs(step);\n\tif (!/^\\d+\\.\\d+$/.test(step.toString())) return (data - min) % step === 0;\n\tconst index = step.toString().indexOf(\".\");\n\tconst digits = step.toString().slice(index + 1).length;\n\treturn Math.abs(decimalShift(data, digits) - decimalShift(min, digits)) % decimalShift(step, digits) === 0;\n}\nSchema.extend(\"number\", (data, { meta }, options) => {\n\tif (typeof data !== \"number\") throw new ValidationError(`expected number but got ${data}`, options);\n\tcheckWithinRange(data, meta, \"number\", options);\n\tconst { step } = meta;\n\tif (step && !isMultipleOf(data, meta.min ?? 0, step)) throw new ValidationError(`expected number multiple of ${step} but got ${data}`, options);\n\treturn [data];\n});\nSchema.extend(\"boolean\", (data, _, options) => {\n\tif (typeof data === \"boolean\") return [data];\n\tthrow new ValidationError(`expected boolean but got ${data}`, options);\n});\nSchema.extend(\"bitset\", (data, { bits, meta }, options) => {\n\tlet value = 0, keys = [];\n\tif (typeof data === \"number\") {\n\t\tvalue = data;\n\t\tfor (const key in bits) if (data & bits[key]) keys.push(key);\n\t} else if (Array.isArray(data)) {\n\t\tkeys = data;\n\t\tfor (const key of keys) {\n\t\t\tif (typeof key !== \"string\") throw new ValidationError(`expected string but got ${key}`, options);\n\t\t\tif (key in bits) value |= bits[key];\n\t\t}\n\t} else throw new ValidationError(`expected number or array but got ${data}`, options);\n\tif (value === meta.default) return [value];\n\treturn [value, keys];\n});\nSchema.extend(\"function\", (data, _, options) => {\n\tif (typeof data === \"function\") return [data];\n\tthrow new ValidationError(`expected function but got ${data}`, options);\n});\nSchema.extend(\"is\", (data, { constructor }, options) => {\n\tif (typeof constructor === \"function\") {\n\t\tif (data instanceof constructor) return [data];\n\t\tthrow new ValidationError(`expected ${constructor.name} but got ${data}`, options);\n\t} else {\n\t\tif (isNullable(data)) throw new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t\tlet prototype = Object.getPrototypeOf(data);\n\t\twhile (prototype) {\n\t\t\tif (prototype.constructor?.name === constructor) return [data];\n\t\t\tprototype = Object.getPrototypeOf(prototype);\n\t\t}\n\t\tthrow new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t}\n});\nfunction property(data, key, schema, options) {\n\ttry {\n\t\tconst [value, adapted] = Schema.resolve(data[key], schema, {\n\t\t\t...options,\n\t\t\tpath: [...options.path || [], key]\n\t\t});\n\t\tif (adapted !== void 0) data[key] = adapted;\n\t\treturn value;\n\t} catch (e) {\n\t\tif (!options?.autofix) throw e;\n\t\tdelete data[key];\n\t\treturn schema.meta.volatile ? createVolatile(schema.meta.default) : schema.meta.default;\n\t}\n}\nSchema.extend(\"array\", (data, { inner, meta }, options) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tcheckWithinRange(data.length, meta, \"array length\", options, !isNullable(inner.meta.default));\n\treturn [data.map((_, index) => property(data, index, inner, options))];\n});\nSchema.extend(\"dict\", (data, { inner, sKey }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in data) {\n\t\tlet rKey;\n\t\ttry {\n\t\t\trKey = Schema.resolve(key, sKey, options)[0];\n\t\t} catch (error) {\n\t\t\tif (strict) continue;\n\t\t\tthrow error;\n\t\t}\n\t\tresult[rKey] = property(data, key, inner, options);\n\t\tdata[rKey] = data[key];\n\t\tif (key !== rKey) delete data[key];\n\t}\n\treturn [result];\n});\nSchema.extend(\"tuple\", (data, { list }, options, strict) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tconst result = list.map((inner, index) => property(data, index, inner, options));\n\tif (strict) return [result];\n\tresult.push(...data.slice(list.length));\n\treturn [result];\n});\nfunction merge(result, data) {\n\tfor (const key in data) {\n\t\tif (key in result) continue;\n\t\tresult[key] = data[key];\n\t}\n}\nSchema.extend(\"object\", (data, { dict }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in dict) {\n\t\tconst value = property(data, key, dict[key], options);\n\t\tif (!isNullable(value) || key in data) result[key] = value;\n\t}\n\tif (!strict) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"union\", (data, { list, toString }, options, strict) => {\n\tconst messages = [];\n\tfor (const inner of list) try {\n\t\treturn Schema.resolve(data, inner, options, strict);\n\t} catch (error) {\n\t\tmessages.push(error);\n\t}\n\tthrow new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n});\nSchema.extend(\"intersect\", (data, { list, toString }, options, strict) => {\n\tif (!list.length) return [data];\n\tlet result;\n\tfor (const inner of list) {\n\t\tconst value = Schema.resolve(data, inner, options, true)[0];\n\t\tif (isNullable(value)) continue;\n\t\tif (isNullable(result)) result = value;\n\t\telse if (typeof result !== typeof value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t\telse if (typeof value === \"object\") merge(result ??= {}, value);\n\t\telse if (result !== value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t}\n\tif (!strict && isPlainObject(data)) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"transform\", (data, { inner, callback, preserve }, options) => {\n\tconst [result, adapted = data] = Schema.resolve(data, inner, options, true);\n\tif (preserve) return [callback(result)];\n\telse return [callback(result), callback(adapted)];\n});\nconst formatters = {};\nfunction defineMethod(name, keys, format) {\n\tformatters[name] = format;\n\tObject.assign(Schema, { [name](...args) {\n\t\tconst schema = new Schema({ type: name });\n\t\tkeys.forEach((key, index) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase \"sKey\":\n\t\t\t\t\tschema.sKey = args[index] ?? Schema.string();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inner\":\n\t\t\t\t\tschema.inner = Schema.from(args[index]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"list\":\n\t\t\t\t\tschema.list = args[index].map(Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dict\":\n\t\t\t\t\tschema.dict = valueMap(args[index], Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bits\":\n\t\t\t\t\tschema.bits = {};\n\t\t\t\t\tfor (const key in args[index]) {\n\t\t\t\t\t\tif (typeof args[index][key] !== \"number\") continue;\n\t\t\t\t\t\tschema.bits[key] = args[index][key];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"callback\": {\n\t\t\t\t\tconst callback = schema.callback = args[index];\n\t\t\t\t\tcallback[\"toJSON\"] ||= () => callback.toString();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"constructor\": {\n\t\t\t\t\tconst constructor = schema.constructor = args[index];\n\t\t\t\t\tif (typeof constructor === \"function\") constructor[\"toJSON\"] ||= () => constructor[\"name\"];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: schema[key] = args[index];\n\t\t\t}\n\t\t});\n\t\tif (name === \"object\" || name === \"dict\") schema.meta.default = {};\n\t\telse if (name === \"array\" || name === \"tuple\") schema.meta.default = [];\n\t\telse if (name === \"bitset\") schema.meta.default = 0;\n\t\treturn schema;\n\t} });\n}\ndefineMethod(\"is\", [\"constructor\"], ({ constructor }) => {\n\tif (typeof constructor === \"function\") return constructor.name;\n\telse return constructor;\n});\ndefineMethod(\"any\", [], () => \"any\");\ndefineMethod(\"never\", [], () => \"never\");\ndefineMethod(\"const\", [\"value\"], ({ value }) => typeof value === \"string\" ? JSON.stringify(value) : value);\ndefineMethod(\"string\", [], () => \"string\");\ndefineMethod(\"number\", [], () => \"number\");\ndefineMethod(\"boolean\", [], () => \"boolean\");\ndefineMethod(\"bitset\", [\"bits\"], () => \"bitset\");\ndefineMethod(\"function\", [], () => \"function\");\ndefineMethod(\"array\", [\"inner\"], ({ inner }) => `${inner.toString(true)}[]`);\ndefineMethod(\"dict\", [\"inner\", \"sKey\"], ({ inner, sKey }) => `{ [key: ${sKey.toString()}]: ${inner.toString()} }`);\ndefineMethod(\"tuple\", [\"list\"], ({ list }) => `[${list.map((inner) => inner.toString()).join(\", \")}]`);\ndefineMethod(\"object\", [\"dict\"], ({ dict }) => {\n\tif (Object.keys(dict).length === 0) return \"{}\";\n\treturn `{ ${Object.entries(dict).map(([key, inner]) => {\n\t\treturn `${key}${inner.meta.required ? \"\" : \"?\"}: ${inner.toString()}`;\n\t}).join(\", \")} }`;\n});\ndefineMethod(\"union\", [\"list\"], ({ list }, inline) => {\n\tconst result = list.map(({ toString: format }) => format()).join(\" | \");\n\treturn inline ? `(${result})` : result;\n});\ndefineMethod(\"intersect\", [\"list\"], ({ list }) => {\n\treturn `${list.map((inner) => inner.toString(true)).join(\" & \")}`;\n});\ndefineMethod(\"transform\", [\n\t\"inner\",\n\t\"callback\",\n\t\"preserve\"\n], ({ inner }, isInner) => inner.toString(isInner));\n//#endregion\nexport { Schema as default };\n", "//#region lib/types/misc.js\n/** No-op callback returning `undefined` at runtime and `any` at type level. */\nfunction noop() {}\n/** Return true when a value is `null` or `undefined`. */\nfunction isNullable(value) {\n\treturn value === null || value === void 0;\n}\n/** Return true when a value is neither `null` nor `undefined`. */\nfunction isNonNullable(value) {\n\treturn !isNullable(value);\n}\n/** Return true for non-array object values. */\nfunction isPlainObject(data) {\n\treturn data && typeof data === \"object\" && !Array.isArray(data);\n}\n/** Filter object entries and return a new object. */\nfunction filterKeys(object, filter) {\n\treturn Object.fromEntries(Object.entries(object).filter(([key, value]) => filter(key, value)));\n}\n/** Map object values while preserving the original key set. */\nfunction mapValues(object, transform) {\n\treturn Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transform(value, key)]));\n}\n/** Pick selected keys from an object, optionally including `undefined` values. */\nfunction pick(source, keys, forced) {\n\tif (!keys) return { ...source };\n\tconst result = {};\n\tfor (const key of keys) if (forced || source[key] !== void 0) result[key] = source[key];\n\treturn result;\n}\n/** Omit selected keys from a shallow object copy. */\nfunction omit(source, keys) {\n\tif (!keys) return { ...source };\n\tconst result = { ...source };\n\tfor (const key of keys) Reflect.deleteProperty(result, key);\n\treturn result;\n}\n/** Define a non-enumerable writable property and return the object. */\nfunction defineProperty(object, key, value) {\n\treturn Object.defineProperty(object, key, {\n\t\twritable: true,\n\t\tvalue,\n\t\tenumerable: false\n\t});\n}\n//#endregion\n//#region lib/types/array.js\n/** Return true when every item in `array2` is present in `array1`. */\nfunction contain(array1, array2) {\n\treturn array2.every((item) => array1.includes(item));\n}\n/** Return items that appear in both arrays. */\nfunction intersection(array1, array2) {\n\treturn array1.filter((item) => array2.includes(item));\n}\n/** Return items from `array1` that do not appear in `array2`. */\nfunction difference(array1, array2) {\n\treturn array1.filter((item) => !array2.includes(item));\n}\n/** Return the set-union of two arrays while preserving first occurrence order. */\nfunction union(array1, array2) {\n\treturn Array.from(new Set([...array1, ...array2]));\n}\n/** Remove duplicate values while preserving first occurrence order. */\nfunction deduplicate(array) {\n\treturn [...new Set(array)];\n}\n/** Remove one item from an array and report whether it was found. */\nfunction remove(list, item) {\n\tconst index = list?.indexOf(item);\n\tif (index >= 0) {\n\t\tlist.splice(index, 1);\n\t\treturn true;\n\t} else return false;\n}\n/** Normalize nullish, scalar, or array input to an array. */\nfunction makeArray(source) {\n\treturn Array.isArray(source) ? source : isNullable(source) ? [] : [source];\n}\n//#endregion\n//#region lib/types/volatile.js\n/** Shared config references used by schema validators and plugin runtimes. */\nconst write = Symbol.for(\"cosmokit.volatile.write\");\nfunction snapshot(value, ancestors = /* @__PURE__ */ new Set()) {\n\tif (typeof value === \"function\") throw new TypeError(\"volatile config cannot contain functions\");\n\tif (value === null || typeof value !== \"object\") return value;\n\tif (ancestors.has(value)) throw new TypeError(\"volatile config cannot contain cycles\");\n\tancestors.add(value);\n\ttry {\n\t\tif (Array.isArray(value)) return Object.freeze(value.map((item) => snapshot(item, ancestors)));\n\t\tif (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) throw new TypeError(\"volatile config objects must be plain objects or arrays\");\n\t\treturn Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, snapshot(item, ancestors)])));\n\t} finally {\n\t\tancestors.delete(value);\n\t}\n}\n/**\n* Create a detached reference containing an immutable copy of the supplied data.\n* @param value - validated config data; class instances and functions are unsupported.\n* @returns a reference whose value is updated only by its owning runtime.\n*/\nfunction createVolatile(value) {\n\tlet current = snapshot(value);\n\treturn Object.freeze({\n\t\tget: () => current,\n\t\t[write]: (value) => {\n\t\t\tcurrent = value;\n\t\t}\n\t});\n}\n/**\n* Identify references across ESM/CJS copies of the shared library.\n* @param value - a parsed config value.\n* @returns whether the value implements the shared reference protocol.\n*/\nfunction isVolatile(value) {\n\treturn typeof value === \"object\" && value !== null && write in value;\n}\n/**\n* Collect config references without descending into their snapshots or opaque objects.\n* @internal\n* @param value - parsed config; cyclic ordinary fields are visited once per path.\n* @returns references and their object-key paths, including an empty path for a root reference.\n*/\nfunction volatileEntries(value) {\n\tconst ancestors = /* @__PURE__ */ new Set();\n\tfunction visit(value, path) {\n\t\tif (isVolatile(value)) return [{\n\t\t\tpath,\n\t\t\tref: value\n\t\t}];\n\t\tif (!value || typeof value !== \"object\" || ancestors.has(value)) return [];\n\t\tif (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return [];\n\t\tancestors.add(value);\n\t\ttry {\n\t\t\treturn Object.entries(value).flatMap(([key, child]) => visit(child, [...path, key]));\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t}\n\treturn visit(value, []);\n}\n/**\n* Commit an already validated immutable snapshot from another reference.\n* @internal\n* @param target - the owning plugin's stable reference.\n* @param source - a newly parsed candidate reference.\n*/\nfunction updateVolatile(target, source) {\n\ttarget[write](source.get());\n}\n//#endregion\n//#region lib/types/types.js\n/** Test values using `instanceof` with a `toStringTag` fallback. */\nfunction is(type, value) {\n\tif (arguments.length === 1) return (value) => is(type, value);\n\treturn type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;\n}\nfunction isArrayBufferLike(value) {\n\treturn is(\"ArrayBuffer\", value) || is(\"SharedArrayBuffer\", value);\n}\nfunction isArrayBufferSource(value) {\n\treturn isArrayBufferLike(value) || ArrayBuffer.isView(value);\n}\n/** Binary source detection and base64/hex conversion helpers. */\nvar Binary;\n(function(Binary) {\n\tBinary.is = isArrayBufferLike;\n\tBinary.isSource = isArrayBufferSource;\n\tfunction fromSource(source) {\n\t\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\t\telse return source;\n\t}\n\tBinary.fromSource = fromSource;\n\tfunction toBase64(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"base64\");\n\t\tlet binary = \"\";\n\t\tconst bytes = new Uint8Array(source);\n\t\tfor (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]);\n\t\treturn btoa(binary);\n\t}\n\tBinary.toBase64 = toBase64;\n\tfunction fromBase64(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"base64\"));\n\t\treturn Uint8Array.from(atob(source), (c) => c.charCodeAt(0));\n\t}\n\tBinary.fromBase64 = fromBase64;\n\tfunction toHex(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"hex\");\n\t\treturn Array.from(new Uint8Array(source), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n\t}\n\tBinary.toHex = toHex;\n\tfunction fromHex(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"hex\"));\n\t\tconst hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1);\n\t\tconst buffer = [];\n\t\tfor (let i = 0; i < hex.length; i += 2) buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16));\n\t\treturn Uint8Array.from(buffer).buffer;\n\t}\n\tBinary.fromHex = fromHex;\n})(Binary || (Binary = {}));\n/** Decode a base64 string into binary data. */\nconst base64ToArrayBuffer = Binary.fromBase64;\n/** Encode binary data as base64. */\nconst arrayBufferToBase64 = Binary.toBase64;\n/** Decode a hex string into binary data. */\nconst hexToArrayBuffer = Binary.fromHex;\n/** Encode binary data as hex. */\nconst arrayBufferToHex = Binary.toHex;\n/** Deep-clone common JavaScript values while preserving prototypes and cycles. */\nfunction clone(source, refs = /* @__PURE__ */ new Map()) {\n\tif (!source || typeof source !== \"object\") return source;\n\tif (is(\"Date\", source)) return new Date(source.valueOf());\n\tif (is(\"RegExp\", source)) return new RegExp(source.source, source.flags);\n\tif (isArrayBufferLike(source)) return source.slice(0);\n\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\tconst cached = refs.get(source);\n\tif (cached) return cached;\n\tif (Array.isArray(source)) {\n\t\tconst result = [];\n\t\trefs.set(source, result);\n\t\tsource.forEach((value, index) => {\n\t\t\tresult[index] = Reflect.apply(clone, null, [value, refs]);\n\t\t});\n\t\treturn result;\n\t}\n\tconst result = Object.create(Object.getPrototypeOf(source));\n\trefs.set(source, result);\n\tfor (const key of Reflect.ownKeys(source)) {\n\t\tconst descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) };\n\t\tif (\"value\" in descriptor) descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs]);\n\t\tReflect.defineProperty(result, key, descriptor);\n\t}\n\treturn result;\n}\n/**\n* Compare values recursively, treating two volatile references as equal regardless of value.\n* Strict comparison distinguishes null/undefined, treats opaque objects by identity,\n* compares URLs by normalized href, treats array holes as undefined, and considers distinct cyclic structures unequal.\n* @param a - first value.\n* @param b - second value.\n* @param strict - whether to require strict data equality outside volatile references.\n* @returns whether the values compare equal.\n*/\nfunction deepEqual(a, b, strict) {\n\tconst ancestors = /* @__PURE__ */ new Set();\n\tfunction compare(a, b) {\n\t\tif (a === b) return true;\n\t\tif (isVolatile(a) || isVolatile(b)) return isVolatile(a) && isVolatile(b);\n\t\tif (!strict && isNullable(a) && isNullable(b)) return true;\n\t\tif (typeof a !== typeof b || typeof a !== \"object\" || !a || !b) return false;\n\t\tif (ancestors.has(a)) return false;\n\t\tfunction check(test, then) {\n\t\t\treturn test(a) ? test(b) ? then(a, b) : false : test(b) ? false : void 0;\n\t\t}\n\t\tancestors.add(a);\n\t\ttry {\n\t\t\treturn check(Array.isArray, (a, b) => {\n\t\t\t\tif (a.length !== b.length) return false;\n\t\t\t\tfor (let index = 0; index < a.length; index++) if (!compare(a[index], b[index])) return false;\n\t\t\t\treturn true;\n\t\t\t}) ?? check(is(\"Date\"), (a, b) => a.valueOf() === b.valueOf()) ?? check(is(\"URL\"), (a, b) => a.href === b.href) ?? check(is(\"RegExp\"), (a, b) => a.source === b.source && a.flags === b.flags) ?? check(isArrayBufferLike, (a, b) => {\n\t\t\t\tif (a.byteLength !== b.byteLength) return false;\n\t\t\t\tconst viewA = new Uint8Array(a);\n\t\t\t\tconst viewB = new Uint8Array(b);\n\t\t\t\tfor (let i = 0; i < viewA.length; i++) if (viewA[i] !== viewB[i]) return false;\n\t\t\t\treturn true;\n\t\t\t}) ?? ((!strict || [a, b].every((value) => Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null)) && Object.keys({\n\t\t\t\t...a,\n\t\t\t\t...b\n\t\t\t}).every((key) => compare(a[key], b[key])));\n\t\t} finally {\n\t\t\tancestors.delete(a);\n\t\t}\n\t}\n\treturn compare(a, b);\n}\n//#endregion\n//#region lib/types/string.js\n/** Uppercase the first character of a string. */\nfunction capitalize(source) {\n\treturn source.charAt(0).toUpperCase() + source.slice(1);\n}\n/** Lowercase the first character of a string. */\nfunction uncapitalize(source) {\n\treturn source.charAt(0).toLowerCase() + source.slice(1);\n}\n/** Convert dash or underscore delimited text to camelCase. */\nfunction camelCase(source) {\n\treturn source.replace(/[_-][a-z]/g, (str) => str.slice(1).toUpperCase());\n}\nfunction tokenize(source, delimiters, delimiter) {\n\tconst output = [];\n\tlet state = 0;\n\tfor (let i = 0; i < source.length; i++) {\n\t\tconst code = source.charCodeAt(i);\n\t\tif (code >= 65 && code <= 90) {\n\t\t\tif (state === 1) {\n\t\t\t\tconst next = source.charCodeAt(i + 1);\n\t\t\t\tif (next >= 97 && next <= 122) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t} else {\n\t\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t}\n\t\t\tstate = 1;\n\t\t} else if (code >= 97 && code <= 122) {\n\t\t\toutput.push(code);\n\t\t\tstate = 2;\n\t\t} else if (delimiters.includes(code)) {\n\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\tstate = 0;\n\t\t} else output.push(code);\n\t}\n\treturn String.fromCharCode(...output);\n}\n/** Convert text to dash-delimited parameter case. */\nfunction paramCase(source) {\n\treturn tokenize(source, [45, 95], 45);\n}\n/** Convert text to underscore-delimited snake case. */\nfunction snakeCase(source) {\n\treturn tokenize(source, [45, 95], 95);\n}\n/** Runtime alias for `camelCase`. */\nconst camelize = camelCase;\n/** Runtime alias for `paramCase`. */\nconst hyphenate = paramCase;\n/** Format a property key as a JavaScript member access suffix. */\nfunction formatProperty(key) {\n\tif (typeof key !== \"string\") return `[${key.toString()}]`;\n\treturn /^[a-z_$][\\w$]*$/i.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`;\n}\n/** Remove one trailing slash from a path string. */\nfunction trimSlash(source) {\n\treturn source.replace(/\\/$/, \"\");\n}\n/** Ensure a path starts with `/` and has no trailing slash. */\nfunction sanitize(source) {\n\tif (!source.startsWith(\"/\")) source = \"/\" + source;\n\treturn trimSlash(source);\n}\n//#endregion\n//#region lib/types/time.js\n/** Time constants plus parsing and formatting helpers. */\nvar Time;\n(function(Time) {\n\tTime.millisecond = 1;\n\tTime.second = 1e3;\n\tTime.minute = Time.second * 60;\n\tTime.hour = Time.minute * 60;\n\tTime.day = Time.hour * 24;\n\tTime.week = Time.day * 7;\n\tlet timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();\n\tfunction setTimezoneOffset(offset) {\n\t\ttimezoneOffset = offset;\n\t}\n\tTime.setTimezoneOffset = setTimezoneOffset;\n\tfunction getTimezoneOffset() {\n\t\treturn timezoneOffset;\n\t}\n\tTime.getTimezoneOffset = getTimezoneOffset;\n\tfunction getDateNumber(date = /* @__PURE__ */ new Date(), offset) {\n\t\tif (typeof date === \"number\") date = new Date(date);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn Math.floor((date.valueOf() / Time.minute - offset) / 1440);\n\t}\n\tTime.getDateNumber = getDateNumber;\n\tfunction fromDateNumber(value, offset) {\n\t\tconst date = new Date(value * Time.day);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn new Date(+date + offset * Time.minute);\n\t}\n\tTime.fromDateNumber = fromDateNumber;\n\tconst numeric = /\\d+(?:\\.\\d+)?/.source;\n\tconst timeRegExp = new RegExp(`^${[\n\t\t\"w(?:eek(?:s)?)?\",\n\t\t\"d(?:ay(?:s)?)?\",\n\t\t\"h(?:our(?:s)?)?\",\n\t\t\"m(?:in(?:ute)?(?:s)?)?\",\n\t\t\"s(?:ec(?:ond)?(?:s)?)?\"\n\t].map((unit) => `(${numeric}${unit})?`).join(\"\")}$`);\n\tfunction parseTime(source) {\n\t\tconst capture = timeRegExp.exec(source);\n\t\tif (!capture) return 0;\n\t\treturn (parseFloat(capture[1]) * Time.week || 0) + (parseFloat(capture[2]) * Time.day || 0) + (parseFloat(capture[3]) * Time.hour || 0) + (parseFloat(capture[4]) * Time.minute || 0) + (parseFloat(capture[5]) * Time.second || 0);\n\t}\n\tTime.parseTime = parseTime;\n\tfunction parseDate(date) {\n\t\tconst parsed = parseTime(date);\n\t\tif (parsed) date = Date.now() + parsed;\n\t\telse if (/^\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${date}`;\n\t\telse if (/^\\d{1,2}-\\d{1,2}-\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).getFullYear()}-${date}`;\n\t\treturn date ? new Date(date) : /* @__PURE__ */ new Date();\n\t}\n\tTime.parseDate = parseDate;\n\tfunction format(ms) {\n\t\tconst abs = Math.abs(ms);\n\t\tif (abs >= Time.day - Time.hour / 2) return Math.round(ms / Time.day) + \"d\";\n\t\telse if (abs >= Time.hour - Time.minute / 2) return Math.round(ms / Time.hour) + \"h\";\n\t\telse if (abs >= Time.minute - Time.second / 2) return Math.round(ms / Time.minute) + \"m\";\n\t\telse if (abs >= Time.second) return Math.round(ms / Time.second) + \"s\";\n\t\treturn ms + \"ms\";\n\t}\n\tTime.format = format;\n\tfunction toDigits(source, length = 2) {\n\t\treturn source.toString().padStart(length, \"0\");\n\t}\n\tTime.toDigits = toDigits;\n\tfunction template(template, time = /* @__PURE__ */ new Date()) {\n\t\treturn template.replace(\"yyyy\", time.getFullYear().toString()).replace(\"yy\", time.getFullYear().toString().slice(2)).replace(\"MM\", toDigits(time.getMonth() + 1)).replace(\"dd\", toDigits(time.getDate())).replace(\"hh\", toDigits(time.getHours())).replace(\"mm\", toDigits(time.getMinutes())).replace(\"ss\", toDigits(time.getSeconds())).replace(\"SSS\", toDigits(time.getMilliseconds(), 3));\n\t}\n\tTime.template = template;\n})(Time || (Time = {}));\n//#endregion\nexport { Binary, Time, arrayBufferToBase64, arrayBufferToHex, base64ToArrayBuffer, camelCase, camelize, capitalize, clone, contain, createVolatile, deduplicate, deepEqual, defineProperty, difference, filterKeys, formatProperty, hexToArrayBuffer, hyphenate, intersection, is, isNonNullable, isNullable, isPlainObject, isVolatile, makeArray, mapValues, mapValues as valueMap, noop, omit, paramCase, pick, remove, sanitize, snakeCase, trimSlash, uncapitalize, union, updateVolatile, volatileEntries };\n", "/**\r\n * dsh-provider-proxy \u2014 Host half.\r\n *\r\n * Routes the model calls of the providers the user enabled through that\r\n * provider's own forward proxy. Every other provider, and all other DSH\r\n * traffic, keeps using the normal network path.\r\n */\r\n\r\nimport { acquireFetchRouter } from './fetch-router.js'\r\nimport { closeTable, createProxyTable, type RouteEntry } from './proxy-table.js'\r\nimport type { ProviderProxyRouteValue } from './config.js'\r\n\r\nexport const name = 'dsh-provider-proxy'\r\nexport const inject = ['llm']\r\n\r\n/**\r\n * The Config this fiber receives.\r\n *\r\n * It is NOT `ConfigShape`: under the Loader `providers` is a Volatile REFERENCE,\r\n * not the dictionary, so it has to be read through `.get()`. Declaring the plain\r\n * shape here made the two incompatible and hid every real value.\r\n */\r\ninterface ProxyConfig {\r\n /** The provider dictionary, or the Volatile wrapper around it. */\r\n readonly providers?: unknown\r\n}\r\n\r\nfunction plainProviders(\r\n config: ProxyConfig | undefined,\r\n): Record<string, Partial<ProviderProxyRouteValue>> {\r\n const raw = config?.providers\r\n if (raw === undefined) return {}\r\n // Under the Loader this is a Volatile reference; read it fresh every time so\r\n // a settings write is visible to the next request without a remount.\r\n const snapshot = (raw as { get?: () => unknown }).get\r\n const value = typeof snapshot === 'function' ? snapshot.call(raw) : raw\r\n return (value ?? {}) as Record<string, Partial<ProviderProxyRouteValue>>\r\n}\r\n\r\nexport function apply(ctx: any, config?: ProxyConfig): void {\r\n const router = acquireFetchRouter()\r\n let current = new Map<string, RouteEntry>()\r\n let problems = new Map<string, string>()\r\n let closed = false\r\n\r\n // One line on activation so a user can tell \"mounted\" from \"not mounted\" in\r\n // the Host log without guessing. Never prints a credential.\r\n try {\r\n ctx.logger.info('dsh-provider-proxy mounted (pid %d)', process.pid)\r\n } catch {\r\n // A context without a logger still works; the diagnostics getter remains.\r\n }\r\n\r\n const rebuild = async (): Promise<void> => {\r\n const next = createProxyTable(plainProviders(config))\r\n const previous = current\r\n current = next.entries\r\n problems = next.problems\r\n // Retire the previous table only after the new one is live, so an in-flight\r\n // stream keeps a dispatcher that still works.\r\n void closeTable(previous)\r\n }\r\n\r\n const ready = rebuild()\r\n\r\n /**\r\n * The provider catalogue, read from `ctx.llm` where it is actually available.\r\n *\r\n * The browser has no LLM service in this release, so the page cannot ask for\r\n * this list itself. Serving it from the Host is the supported path: the\r\n * `webServer` service is confirmed live, and the shipped dsh-llm-retry-settings\r\n * registers its routes the same way.\r\n */\r\n const catalog = (): { providers: { id: string; name: string; live: boolean }[] } => {\r\n const live = new Set<string>()\r\n const out: { id: string; name: string; live: boolean }[] = []\r\n const seen = new Set<string>()\r\n try {\r\n for (const entry of ctx.llm?.listProviders?.() ?? []) {\r\n const id = entry?.id\r\n if (typeof id !== 'string' || id.length === 0) continue\r\n live.add(id)\r\n if (seen.has(id)) continue\r\n seen.add(id)\r\n const name = typeof entry?.name === 'string' && entry.name.length > 0 ? entry.name : id\r\n out.push({ id, name, live: true })\r\n }\r\n } catch {\r\n // no llm service in this composition\r\n }\r\n try {\r\n for (const entry of ctx.llm?.listConfigurableProviders?.() ?? []) {\r\n const id = entry?.provider\r\n if (typeof id !== 'string' || id.length === 0) continue\r\n const name =\r\n typeof entry.displayName === 'string' && entry.displayName.length > 0 ? entry.displayName : id\r\n const existing = out.find(row => row.id === id)\r\n if (existing === undefined) out.push({ id, name, live: live.has(id) })\r\n else existing.name = name\r\n }\r\n } catch {\r\n // ignore\r\n }\r\n out.sort((a, b) => a.name.localeCompare(b.name))\r\n return { providers: out }\r\n }\r\n\r\n // The page reads this same-origin JSON endpoint for the provider list. Mounted\r\n // inside an optional child so a composition without a web server still runs.\r\n ctx.inject?.(['webServer'], (wctx: any) => {\r\n try {\r\n wctx?.webServer?.register?.({\r\n kind: 'exact',\r\n path: '/dsh-provider-proxy/providers',\r\n handler: (_req: unknown, res: any) => {\r\n try {\r\n const text = JSON.stringify({ ...catalog(), problems: Object.fromEntries(problems) })\r\n res.writeHead(200, {\r\n 'content-type': 'application/json; charset=utf-8',\r\n 'cache-control': 'no-store',\r\n 'content-length': Buffer.byteLength(text),\r\n })\r\n res.end(text)\r\n } catch (error) {\r\n res.writeHead(500, { 'content-type': 'application/json' })\r\n res.end(JSON.stringify({ providers: [], error: String(error) }))\r\n }\r\n },\r\n })\r\n } catch (error) {\r\n // The page degrades to whatever is already configured.\r\n void error\r\n }\r\n })\r\n\r\n ctx.effect(() => {\r\n const stop = ctx.on(\r\n 'llm/stream',\r\n (options: { provider?: string }, next: () => AsyncIterable<unknown>) => {\r\n const provider = options?.provider\r\n if (typeof provider !== 'string') return next()\r\n const route = current.get(provider)\r\n if (route === undefined) return next()\r\n // The stream is consumed lazily; wrap it so the scope survives.\r\n return router.wrap(route.dispatcher, next as () => AsyncIterable<unknown>)\r\n },\r\n { global: true },\r\n )\r\n\r\n const onConfig = (): void => {\r\n void rebuild()\r\n }\r\n ctx.on('loader/volatile-update', onConfig, { global: true })\r\n\r\n return async () => {\r\n stop()\r\n if (closed) return\r\n closed = true\r\n await ready.catch(() => undefined)\r\n await closeTable(current)\r\n current = new Map()\r\n router.release()\r\n }\r\n }, 'dsh-provider-proxy: provider-scoped proxy routing')\r\n\r\n // Diagnostics, exported for the Host log and for tests. Never includes a\r\n // password: `proxyOrigin` is the sanitized origin only.\r\n Object.defineProperty(ctx, 'providerProxyState', {\r\n configurable: true,\r\n get: () => ({\r\n routes: [...current.values()].map(entry => ({\r\n provider: entry.provider,\r\n proxyOrigin: entry.proxyOrigin,\r\n })),\r\n problems: Object.fromEntries(problems),\r\n }),\r\n })\r\n}\r\n\r\nexport { acquireFetchRouter } from './fetch-router.js'\r\nexport { createProxyTable, closeTable, proxyUrl } from './proxy-table.js'\r\nexport { Config, ProviderProxyRoute, normalizeRoute, PROTOCOLS } from './config.js'"],
|
|
5
|
+
"mappings": ";;;;;;;AAoCA,SAAS,yBAAyB;AAClC,SAAS,SAAS,mBAAmB;AAYrC,IAAM,YAAY,uBAAO,IAAI,oCAAoC;AAUjE,SAAS,sBAAmC;AAC1C,QAAM,UAAW,WAAuD,SAAS;AACjF,MAAI,YAAY,QAAW;AACzB,YAAQ,UAAU;AAClB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,WAAW,UAAU,YAAY;AAC1C,UAAM,IAAI,MAAM,oEAAoE;AAAA,EACtF;AAEA,QAAM,UAAU,IAAI,kBAA+B;AACnD,QAAM,gBAAgB,WAAW;AACjC,QAAM,aAAa,OAAO,yBAAyB,YAAY,OAAO;AAEtE,QAAM,cAAc,SAASA,aAE3B,OACA,MACqC;AACrC,UAAM,SAAS,QAAQ,SAAS;AAEhC,QAAI,WAAW,OAAW,QAAO,cAAc,KAAK,YAAY,OAAO,IAAI;AAC3E,QAAI,SAAS,UAAa,SAAS,QAAS,KAAkC,eAAe,QAAW;AACtG,aAAO,cAAc,KAAK,YAAY,OAAO,IAAI;AAAA,IACnD;AAIA,WAAO,YAAY,OAAgB;AAAA,MACjC,GAAI;AAAA,MACJ,YAAY,OAAO;AAAA,IACrB,CAAU;AAAA,EACZ;AAEA,SAAO,eAAe,YAAY,SAAS;AAAA,IACzC,GAAI,cAAc,EAAE,cAAc,MAAM,YAAY,MAAM,UAAU,KAAK;AAAA,IACzE,OA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AAgB,mBAAmB,CAAC;AACzD,gBAAI,IAAI,KAAK,UAAU,EAAE,WAAW,CAAC,GAAG,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC;AAAA,UACjE;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,SAAS,OAAO;AAEd,WAAK;AAAA,IACP;AAAA,EACF,CAAC;AAED,MAAI,OAAO,MAAM;AACf,UAAM,OAAO,IAAI;AAAA,MACf;AAAA,MACA,CAAC,SAAgC,SAAuC;AACtE,cAAM,WAAW,SAAS;AAC1B,YAAI,OAAO,aAAa,SAAU,QAAO,KAAK;AAC9C,cAAM,QAAQ,QAAQ,IAAI,QAAQ;AAClC,YAAI,UAAU,OAAW,QAAO,KAAK;AAErC,eAAO,OAAO,KAAK,MAAM,YAAY,IAAoC;AAAA,MAC3E;AAAA,MACA,EAAE,QAAQ,KAAK;AAAA,IACjB;AAEA,UAAM,WAAW,MAAY;AAC3B,WAAK,QAAQ;AAAA,IACf;AACA,QAAI,GAAG,0BAA0B,UAAU,EAAE,QAAQ,KAAK,CAAC;AAE3D,WAAO,YAAY;AACjB,WAAK;AACL,UAAI,OAAQ;AACZ,eAAS;AACT,YAAM,MAAM,MAAM,MAAM,MAAS;AACjC,YAAM,WAAW,OAAO;AACxB,gBAAU,oBAAI,IAAI;AAClB,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,mDAAmD;AAItD,SAAO,eAAe,KAAK,sBAAsB;AAAA,IAC/C,cAAc;AAAA,IACd,KAAK,OAAO;AAAA,MACV,QAAQ,CAAC,GAAG,QAAQ,OAAO,CAAC,EAAE,IAAI,YAAU;AAAA,QAC1C,UAAU,MAAM;AAAA,QAChB,aAAa,MAAM;AAAA,MACrB,EAAE;AAAA,MACF,UAAU,OAAO,YAAY,QAAQ;AAAA,IACvC;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": ["routedFetch", "value", "value", "Binary", "result", "a", "b", "Time", "date", "template", "options", "pattern", "value", "extra", "resolve", "toJSON", "date", "toString", "name", "key", "require", "volatile", "snapshot", "name"]
|
|
7
7
|
}
|