dsh-free-model 0.0.0-stage → 2.1.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/LICENSE +21 -0
- package/README.md +159 -2
- package/README_EN.md +71 -0
- package/SECURITY-AUDIT.md +113 -0
- package/client.js +2523 -0
- package/cordis.patch.yml +8 -0
- package/icon.svg +1 -0
- package/index.js +684 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +67 -4
- package/src/chan-relay.js +193 -0
- package/src/egress.js +793 -0
- package/src/key.js +24 -0
- package/src/store.js +166 -0
- package/src/trust.js +179 -0
- package/vendor/channel-pack/LICENSE +21 -0
- package/vendor/channel-pack/NOTICE.md +53 -0
- package/vendor/channel-pack/pack.js +68531 -0
- package/vendor/channel-pack/qoder-auth-wasm.wasm +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ebony-Vinyl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,160 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 模型接入 (Our Free Model) — channels-only fork
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **DSH 插件**(DeepSeek Harness · cordis bundle,`dsh-plugin`)——
|
|
4
|
+
> [`Ebony-Vinyl/dsh-our-free-model`](https://github.com/Ebony-Vinyl/dsh-our-free-model) **2.1.0** 的精简 fork。
|
|
5
|
+
> 只保留「把外部账号接进来」这一条车道:**十三个账号渠道 + 数据看板 + 运行日志 + 本地网关**。
|
|
6
|
+
> 上游的匿名免费车道、EAC 协付车道、聚合渠道、省 Token、路由与发布/更新通道全部移除。
|
|
7
|
+
> 设置页里的入口名是 **模型接入**(英文界面 **Model Access**);npm 包名与仓库同名(`dsh-free-model`),
|
|
8
|
+
> 而 cordis 的 loader 条目 id 仍是 `our-free-model`——设置命名空间与状态目录都挂在 id 上,所以改包名不搬数据。
|
|
9
|
+
|
|
10
|
+
## 保留了什么
|
|
11
|
+
|
|
12
|
+
四个设置页(导航栏从九页降到四页):
|
|
13
|
+
|
|
14
|
+
| 页面 | 作用 |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| **白嫖模型接入** | 十三张渠道卡:CodeArts、CodeBuddy / WorkBuddy(国内 + 国际)、LobsterAI、Qoder / Qoder CN、TRAE、Cline、Loomy、Raccoon、MiniMax Code、ZCode、Gemini。浏览器登录、账号池、续期、积分查询与一键领取、每日自动签到、逐模型开关、余额查询。 |
|
|
17
|
+
| **数据看板** | 渠道包自己的逐请求 Token 账本:今日 / 全部消耗、平均生成速度、首字延迟、缓存命中率、成功率、账号透视、模型性能表。 |
|
|
18
|
+
| **运行日志** | 逐条请求明细:结果、耗时、首字、速度、Token 细分;失败行悬停看原因。 |
|
|
19
|
+
| **网关设置** | 渠道包的本地 OpenAI 兼容网关(开关、端点、密钥、模型数)+ 本插件的局域网中继(可选绑定地址/端口、独立中继密钥、轮换)+ 出口代理分区(订阅分流或单个 http/socks5 出口)。 |
|
|
20
|
+
|
|
21
|
+
## 移除了什么,以及为什么
|
|
22
|
+
|
|
23
|
+
| 移除 | 原因 |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| **免费模型**页:匿名 opencode 车道 + Kilo 免费池 | 第三方灰产通道(伪装客户端 + 池化公共凭据),随时可能失效或改协议;不想要。 |
|
|
26
|
+
| **EAC 模型**页:GitHub 授权协付车道 | 依赖仓库方网关与 star 授权。 |
|
|
27
|
+
| **聚合渠道**页(76 家自带 Key 的提供商) | 与插件自己的模型适配器(`src/adapter.js`)绑定,随它一起移除。 |
|
|
28
|
+
| **省 Token**页 | 压缩管线(RTK / 提示词瘦身 / 本地应答)跑在同一个适配器里。 |
|
|
29
|
+
| **路由**页(combo 降级链) | 由同一个适配器提供。 |
|
|
30
|
+
| 公告中心、自更新、热重载 | 上游发布清单签名验不过;一个 fork 也不该让别人替你换掉本机字节。 |
|
|
31
|
+
| 本地转发(18899)与局域网转发 | 转发的正是被删掉的那条车道。 |
|
|
32
|
+
| `packages/standalone/`(独立 Web 产品)、`worker/`(EAC 的 Cloudflare 授权网关)、`feed/` + `catalog/`(公告源与发布清单) | 三块卫星全部 `import` 被删车道,留着就是一套永远跑不起来的代码。 |
|
|
33
|
+
|
|
34
|
+
规模变化:`src/` 从 **58 个模块 → 5 个**(`store/key/chan-relay/egress/trust`),宿主 `index.js` 从 **2343 行 → 684 行**,离线测试从 45 个套件 → 8 个。
|
|
35
|
+
|
|
36
|
+
## 安装
|
|
37
|
+
|
|
38
|
+
**命令行(纯 dsh web)**
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
dsh plugin --profile web add dsh-free-model # 从 npm 装(公开发布)
|
|
42
|
+
dsh plugin --profile web add /绝对路径/dsh-free-model # 或从本仓目录装
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
安装后重启应用一次。`--profile` 填实际使用的 profile 名。
|
|
46
|
+
|
|
47
|
+
**DSHEAC AIO / 桌面端**:桌面端启动 web 前有一道 profile 闸门,只放行 dsh 自己在
|
|
48
|
+
`.dsh-module-fallback` 下生成的链接;profile 目录树里出现任何其它符号链接或 junction
|
|
49
|
+
会直接拒绝启动(`PROFILE_UPGRADE_REQUIRED`)。所以**不要用 `link:` 依赖、不要建 junction**,
|
|
50
|
+
用应用内插件管理器,或放一个真实目录:
|
|
51
|
+
|
|
52
|
+
1. 把仓库内容复制到 `<profile>/node_modules/dsh-free-model/`
|
|
53
|
+
(必需:`index.js`、`client.js`、`src/`、`vendor/channel-pack/`、`locale/`、`icon.svg`、
|
|
54
|
+
`cordis.patch.yml`、`package.json`;上游文档里的 `adapter/` 在本 fork 已不存在)
|
|
55
|
+
2. `dependencies` 里写 `"dsh-free-model": "2.1.0"`(跟随 `package.json` 的 `version`),不要写 `link:`
|
|
56
|
+
3. `dsh.profile.bundles` 末尾追加 `"dsh-free-model"`
|
|
57
|
+
|
|
58
|
+
> npm 包名是 `dsh-free-model`(与仓库同名);**loader 条目 id 仍是 `our-free-model`**
|
|
59
|
+
> (`cordis.patch.yml` 里的 `id:`),所以设置命名空间与状态目录 `~/.dsh/our-free-model/` 不随包名变化。
|
|
60
|
+
|
|
61
|
+
不要再往 `cordis.patch.yml` 加条目:被 `dsh.profile.bundles` 引用的包,其自带 patch 层会自动生效,
|
|
62
|
+
两处同时注册会报 `duplicate loader entry id: our-free-model`。
|
|
63
|
+
|
|
64
|
+
### 从上游版本切换过来
|
|
65
|
+
|
|
66
|
+
上游的包名是 `dsh-our-free-model`,本 fork 发布为 **`dsh-free-model`**,两者可以并存但不能同时注册
|
|
67
|
+
(loader 条目 id 都是 `our-free-model`,会报 `duplicate loader entry id`)。切换步骤:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
dsh plugin --profile web remove dsh-our-free-model # 卸掉上游
|
|
71
|
+
dsh plugin --profile web add dsh-free-model # 装上 fork(npm)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**先备份 `~/.dsh/our-free-model/`**:账号与密钥在渠道包自己的凭据库里,目录名与条目 id 在本 fork 里**没变**,
|
|
75
|
+
所以切回来仍然是同一份配置。
|
|
76
|
+
|
|
77
|
+
> ⚠️ 覆盖安装的教训(2026-10-11 实测踩到):手工把 fork 拷进 `node_modules/<包名>/` 后,
|
|
78
|
+
> **只要在这个 profile 里再跑一次 `pnpm install`(插件管理器装/卸别的插件就会跑),
|
|
79
|
+
> 手工那份就会被按 lockfile 清掉或换回 registry 版**。长期固定就发 registry(本 fork 已发布 `dsh-free-model`)。
|
|
80
|
+
|
|
81
|
+
## 配置
|
|
82
|
+
|
|
83
|
+
唯一的状态文件是 `~/.dsh/our-free-model/settings.json`(0600)。本 fork 只读这三个键:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"egress": {
|
|
88
|
+
"enabled": false,
|
|
89
|
+
"mode": "subscription",
|
|
90
|
+
"url": "",
|
|
91
|
+
"mihomoPath": ""
|
|
92
|
+
},
|
|
93
|
+
"chanGateway": {
|
|
94
|
+
"relay": { "enabled": false, "host": "127.0.0.1", "port": 18326, "key": "" }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
2.1.0 写下的其它键(`enabled`、`forward`、`tokenSaver`、`aggregate`、`combos`、
|
|
100
|
+
`announcementsAcked`…)会被原样保留但不再生效——`JsonStore` 把文件合并到默认值之上,
|
|
101
|
+
所以你已有的出口地址与中继密钥在升级时不会丢。
|
|
102
|
+
|
|
103
|
+
### HTTP 面
|
|
104
|
+
|
|
105
|
+
全部经信任围栏,前缀 `/api/our-free-model`:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
GET /summary 四个页面要的文档(settings.egress / channels / version / outlet)
|
|
109
|
+
GET /outlet 当前出口节点与延迟(读数,失败也只是缺读数)
|
|
110
|
+
GET /egress/url 订阅地址本身——只在页面点「显示/复制」时读
|
|
111
|
+
POST /settings 只接受 egress 分区
|
|
112
|
+
GET /chan-gateway 中继与网关状态(不含密钥)
|
|
113
|
+
POST /chan-gateway/apply 改绑定地址/端口
|
|
114
|
+
GET /chan-gateway/key 中继密钥(按需读)
|
|
115
|
+
POST /chan-gateway/rotate 轮换中继密钥
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
数据看板与运行日志**不经过这里**:渠道包自己持有逐请求账本,浏览器半身直接走 shell 的
|
|
119
|
+
`connection` RPC(`usage.tokenLedger` / `usage.tokenLedgerHistory`)。
|
|
120
|
+
|
|
121
|
+
## 安全
|
|
122
|
+
|
|
123
|
+
- **凭据**:账号 token 进渠道包自己的凭据目录,页面永远拿不到明文;订阅地址按凭据对待,只在点「显示」时读取,常规 payload 里只有打码后的 host。
|
|
124
|
+
- **局域网中继是唯一对外监听**:默认关;开启后必须用独立的中继密钥(与本机网关密钥不通用)。**能连上这台机器的人都能消耗你的渠道额度**——只在可信网络启用,必要时用防火墙限制来源网段。
|
|
125
|
+
- **信任围栏**:插件路由优先级高于内核 `/api`,所以内置了与内核一致的准入检查——优先复用 composition 的 `connection` 服务,缺失时退回结构化围栏(Host 必须回环、拒绝跨站标记、Origin/Referer 必须同源)。
|
|
126
|
+
- 本 fork 不再向任何上游插件地址发请求:出口只剩模型 provider(以及你启用的出口代理)。
|
|
127
|
+
- **出网面审计**:见 [`SECURITY-AUDIT.md`](SECURITY-AUDIT.md)——13 家渠道的域名与 TLS 证书主体、两处不带凭据的第三方调用、本地暴露面与已知风险;复跑 `node scripts/egress-audit.mjs --tls`(只读)。
|
|
128
|
+
|
|
129
|
+
## 测试
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npm test # 8 个离线套件,无需网络、不花额度
|
|
133
|
+
node scripts/host-smoke-test.mjs # 只跑宿主 HTTP 面
|
|
134
|
+
node scripts/client-lint.mjs # 只跑浏览器半身(字典键一一对应 + CSS 规则可达)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
| 套件 | 覆盖 |
|
|
138
|
+
| --- | --- |
|
|
139
|
+
| `client-lint` | 浏览器半身:注册、双语字典键一一对应且无冗余、每条 CSS 规则可达、发出的 `ofm_*` 类都有定义 |
|
|
140
|
+
| `host-smoke` | 宿主 HTTP 面全量:四个页面的数据、出口校验、中继密钥生成/轮换/落盘、**被删路由必须 404** |
|
|
141
|
+
| `trust` / `chan-relay` / `egress` | 三个宿主模块各自的契约 |
|
|
142
|
+
| `channel-pack` / `channel-network` | 渠道包挂载、十三个 provider 注册、积分、图片计价、代理与 OAuth 生命周期 |
|
|
143
|
+
|
|
144
|
+
上游的 45 个套件里,其余的都在测被删掉的车道,已一并移除。
|
|
145
|
+
|
|
146
|
+
## 渠道包
|
|
147
|
+
|
|
148
|
+
`vendor/channel-pack/` 是一个完整子项目(有自己的 `package.json`、TypeScript 源码、
|
|
149
|
+
测试与构建脚本),`pack.js` 是它的打包产物:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npm run channel-pack # 从 vendor/channel-pack/src 重新打包(需要 esbuild)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
来源、授权与改造说明见 `vendor/channel-pack/NOTICE.md`。
|
|
156
|
+
|
|
157
|
+
## 许可
|
|
158
|
+
|
|
159
|
+
本仓库 MIT(见 `LICENSE`);渠道包部分见 `vendor/channel-pack/LICENSE` 与 `NOTICE.md`。
|
|
160
|
+
所有渠道账号、额度与积分规则归各提供商所有,请遵守各自的服务条款。
|
package/README_EN.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Model Access (Our Free Model) — channels-only fork
|
|
2
|
+
|
|
3
|
+
> **A DSH plugin** (DeepSeek Harness · cordis bundle, `dsh-plugin`) —
|
|
4
|
+
> a trimmed fork of [`Ebony-Vinyl/dsh-our-free-model`](https://github.com/Ebony-Vinyl/dsh-our-free-model) **2.1.0**.
|
|
5
|
+
> One lane survives: **bring your own account channels** — thirteen providers, plus a token
|
|
6
|
+
> dashboard, a per-request log and a local gateway. Upstream's anonymous free lane, the EAC
|
|
7
|
+
> co-paid lane, the aggregate lane, the token savers, the routing chains and the whole
|
|
8
|
+
> release/update channel are gone.
|
|
9
|
+
> The settings entry reads **模型接入** in Chinese, **Model Access** in English; the npm package is
|
|
10
|
+
> `dsh-free-model` (same as the repository), while the cordis loader entry id stays `our-free-model`
|
|
11
|
+
> — the settings namespace and the state directory hang off that id, so renaming the package moves no data.
|
|
12
|
+
|
|
13
|
+
## What survives
|
|
14
|
+
|
|
15
|
+
Four settings pages (down from nine):
|
|
16
|
+
|
|
17
|
+
| Page | What it does |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| **Free channels** | Thirteen account cards — CodeArts, CodeBuddy / WorkBuddy (CN + intl), LobsterAI, Qoder / Qoder CN, TRAE, Cline, Loomy, Raccoon, MiniMax Code, ZCode, Gemini: browser login, account pool, renewal, credit lookup and one-click claim, daily auto check-in, per-model switches, balance. |
|
|
20
|
+
| **Dashboard** | The pack's own per-request token ledger: today / all-time usage, average throughput, TTFT, cache hit rate, success rate, account pivot, per-model table. |
|
|
21
|
+
| **Request log** | Every request in detail: result, duration, TTFT, speed, token breakdown; hover a failed row for the reason. |
|
|
22
|
+
| **Gateway** | The pack's local OpenAI-compatible gateway (switch, endpoint, key, model count), this plugin's LAN relay (bind address/port, its own key, rotation), and the egress-outlet section. |
|
|
23
|
+
|
|
24
|
+
## What was removed and why
|
|
25
|
+
|
|
26
|
+
| Removed | Why |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| **Free models** page: the anonymous opencode lane + Kilo free pool | Third-party grey channel (client impersonation + pooled public credentials); can break at any time. |
|
|
29
|
+
| **EAC models** page: the GitHub-gated co-paid lane | Depends on the repository owner's gateway and a star grant. |
|
|
30
|
+
| **Aggregate** page (76 bring-your-own-key providers) | Served by the plugin's own adapter, which this fork removes. |
|
|
31
|
+
| **Token savers** page | The compaction pipeline runs inside that same adapter. |
|
|
32
|
+
| **Routing** page (combo fallback chains) | Same adapter. |
|
|
33
|
+
| Announcement centre, self-updater, hot reload | Upstream release signatures did not verify; and a fork should not let a remote party swap its bytes. |
|
|
34
|
+
| Local forward listener (18899) and the LAN forward | They forwarded the deleted lane. |
|
|
35
|
+
| `packages/standalone/`, `worker/`, `feed/`, `catalog/` | All three satellite products `import` the deleted lane; keeping them means shipping code that can never run. |
|
|
36
|
+
|
|
37
|
+
Sizes: `src/` went from **58 modules to 5**, the host `index.js` from **2343 to 684 lines**,
|
|
38
|
+
and the offline suites from 45 to 7.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
dsh plugin --profile web add dsh-free-model # from npm
|
|
44
|
+
dsh plugin --profile web add /absolute/path/dsh-free-model # or from a checkout
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Restart the app once. On the desktop build, do **not** use `link:` dependencies or junctions
|
|
48
|
+
(the profile gate rejects them); copy a real directory into
|
|
49
|
+
`<profile>/node_modules/dsh-free-model/`, add `"dsh-free-model": "2.1.0"` to
|
|
50
|
+
`dependencies`, and append `"dsh-free-model"` to `dsh.profile.bundles`.
|
|
51
|
+
The loader entry id stays `our-free-model` (`id:` in `cordis.patch.yml`), so the settings
|
|
52
|
+
namespace and the state directory `~/.dsh/our-free-model/` are unaffected by the package name.
|
|
53
|
+
|
|
54
|
+
Note that upstream's `adapter/` directory no longer exists in this fork.
|
|
55
|
+
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
The only state file is `~/.dsh/our-free-model/settings.json` (0600); this fork reads three
|
|
59
|
+
keys — `egress`, `chanGateway.relay` and `version`. Keys written by 2.1.0 are preserved but
|
|
60
|
+
inert, so an upgrade keeps your outlet address and relay key.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm test # 7 offline suites: no network, no quota
|
|
64
|
+
node scripts/host-smoke-test.mjs # the host HTTP surface only
|
|
65
|
+
node scripts/client-lint.mjs # the browser half only
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
MIT (`LICENSE`); the vendored channel pack is covered by `vendor/channel-pack/LICENSE` and
|
|
71
|
+
`NOTICE.md`. All channel accounts, quotas and credit rules belong to their providers.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# 出网面安全审计(egress audit)
|
|
2
|
+
|
|
3
|
+
> 审计对象:本 fork 装机副本(当时装成 `~/.dsh/profiles/web/node_modules/dsh-our-free-model`,
|
|
4
|
+
> 现已作为 npm 包 **`dsh-free-model@2.1.0`** 发布,装机路径随之变为 `~/.dsh/profiles/web/node_modules/dsh-free-model`)。
|
|
5
|
+
> 审计日期:**2026-10-11**。审计方式:静态列出全部出网域名 + 对每个域名在本机直连握手看 TLS 证书主体。
|
|
6
|
+
> 复跑工具:`node scripts/egress-audit.mjs --tls`(只读、不写文件、不修改系统)。
|
|
7
|
+
> 2026-10-12 复核:只是**改包名**(`dsh-free-model`)与 id 引用,出网面零变化,域名表结论仍然有效;`client.js` 哈希已随改名更新。
|
|
8
|
+
|
|
9
|
+
审计时的产物指纹(要复现同期结论请先比对):
|
|
10
|
+
|
|
11
|
+
| 文件 | sha256 |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `index.js` | `179e679a7932fc0993d3bbc10785133d18304e583fb872e07e0322cbbd0aaec9` |
|
|
14
|
+
| `client.js` | `585ffeb810fb3bd7275e1ac7a8b5edd604e5955370ea94725c3c39fa19240bba` |
|
|
15
|
+
| `vendor/channel-pack/pack.js` | `18c7629f2e65c894b46e24e95b6dfa45397fa1f4490590a645c1e1058264daa9` |
|
|
16
|
+
|
|
17
|
+
## 结论
|
|
18
|
+
|
|
19
|
+
**是直连对应服务提供商。** 全部业务出网都是 HTTPS 到厂商自家域名,TLS 证书主体为厂商本人;**没有第三方中转、没有回传作者服务器、没有遥测**。仅有两处外部辅助调用(模型能力元数据、出口 IP 探测),都不携带账号凭据。
|
|
20
|
+
|
|
21
|
+
## 一、13 个渠道的出网域名与证书主体
|
|
22
|
+
|
|
23
|
+
下表"证书主体"取自**本机直连握手**(域名 → TLS 证书的 Subject/Issuer),用来证明流量终点不是中间人。
|
|
24
|
+
|
|
25
|
+
| 渠道 | 出网主机 | 证书主体(实测) |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| CodeArts(华为) | `codearts.huaweicloud.com`、`opengw.developer.huaweicloud.com`、`snap-access.cn-north-4.myhuaweicloud.com`、`devcloud.cn-north-4.huaweicloud.com`、`auth.huaweicloud.com`、`sts.cn-north-4.myhuaweicloud.com` | `Huawei Software Technologies Co., Ltd.`(GlobalSign) |
|
|
28
|
+
| CodeBuddy / WorkBuddy / Buddy(腾讯) | `copilot.tencent.com`、`www.codebuddy.cn`、`www.workbuddy.ai` | `Tencent Technology (Shenzhen) Company Limited`(DigiCert) |
|
|
29
|
+
| Qoder / Qoder CN(阿里) | `qoder.com`、`qoder.cn`、`gateway.qoder.com.cn`、`openapi.qoder.com.cn`、`openapi.qoder.sh`、`api2.qoder.sh`、`api2-v2.qoder.sh` | `*.qoder.com.cn` / `*.qoder.sh` / `qoder.com` |
|
|
30
|
+
| TRAE(字节) | `api.trae.cn`、`www.trae.cn`、`api.trae.com.cn`、`trae-api-cn.mchost.guru` | `*.trae.cn` / `*.trae.com.cn` / `*.mchost.guru`(DV 证书,不含企业名) |
|
|
31
|
+
| Cline | `api.cline.bot`、`app.cline.bot`、`cline.bot`;登录 `api.workos.com` | `api.cline.bot`(Google Trust Services) |
|
|
32
|
+
| LobsterAI(网易有道) | `lobsterai-server.youdao.com`、`lobsterai.youdao.com`、`api-overmind.youdao.com`、`pub-g1-gz.alb.ntes53.netease.com`(ALB 回源) | `网易有道信息技术(北京)有限公司` / `*.youdao.com`(ALB 主机也发 Youdao 证书) |
|
|
33
|
+
| Loomy(讯飞) | `loomy.xunfei.cn`、`loomyad.xunfei.cn`、`account.xfinfr.com`;微信扫码 `open.weixin.qq.com` / `long.open.weixin.qq.com` | `合肥科讯创想软件开发有限公司` / `科大讯飞股份有限公司`;微信为腾讯 |
|
|
34
|
+
| Raccoon(小浣熊) | `xiaohuanxiong.com`;登录页静态资源 `o.alicdn.com` | `*.xiaohuanxiong.com`;阿里 CDN `Alibaba (China) Technology Co., Ltd.` |
|
|
35
|
+
| MiniMax Code | `agent.minimax.cn`、`account.minimax.cn` | `*.minimax.cn`(DNSPod DV) |
|
|
36
|
+
| ZCode(智谱 z.ai) | `zcode.z.ai`、`api.z.ai`、`chat.z.ai` | `*.z.ai`(Sectigo DV) |
|
|
37
|
+
| Gemini(Google) | `daily-cloudcode-pa.googleapis.com`、`daily-cloudcode-pa.sandbox.googleapis.com`、`www.googleapis.com`、`oauth2.googleapis.com`、`accounts.google.com` | Google(**本机直连不通**,需代理才能握手;域名与用途由源码与官方 SDK 对齐) |
|
|
38
|
+
|
|
39
|
+
## 二、仅有的外部(非厂商)调用
|
|
40
|
+
|
|
41
|
+
| 主机 | 用途 | 是否带凭据 | 在我们这份里的状态 |
|
|
42
|
+
| --- | --- | --- | --- |
|
|
43
|
+
| `https://models.dev/api.json` | Cline 车道取**模型能力元数据**(上下文/推理档位) | 否(只有 `Accept: application/json`) | 有效(Cline 在用) |
|
|
44
|
+
| `http://ip-api.com/json/?fields=…` | **明文 HTTP**,查出口 IP,仅供 OpenCode 车道的「测试代理」按钮 | 否 | 车道已禁用(`disableOpencode`),不会触发 |
|
|
45
|
+
| `http://www.gstatic.com/generate_204` | 生成的 mihomo 配置里的连通性探测 URL | 否 | 只在你启用「出口代理」时才存在,且是写入配置文本,不主动请求 |
|
|
46
|
+
|
|
47
|
+
代码注释里出现的 `github.com` / `gitee.com` / `blog.csdn.net` / `bigmodel.cn` 是**参考实现出处**,不是请求目标。
|
|
48
|
+
|
|
49
|
+
## 三、"直连"是怎么保证的
|
|
50
|
+
|
|
51
|
+
渠道出网的代理决策顺序(`vendor/channel-pack/src/channel-fetch.ts`):
|
|
52
|
+
|
|
53
|
+
1. 目标 `127.0.0.1` / `::1` → 永不加代理;
|
|
54
|
+
2. **插件出口代理**(本项目「网关设置」里的出口分区)——默认关闭;
|
|
55
|
+
3. **环境代理** `HTTPS_PROXY` / `HTTP_PROXY` / `ALL_PROXY`——本机 dsh 进程没有任何 `*_proxy`;
|
|
56
|
+
4. Windows 系统代理——Linux 分支不读;
|
|
57
|
+
5. 否则**直连**。
|
|
58
|
+
|
|
59
|
+
因此当前渠道请求是直连厂商;桌面环境里那个 `127.0.0.1:7897`(GNOME 手动代理)**不会被渠道请求使用**。需要给 Google 系(Gemini)或 OpenCode 用车时,才需要配环境代理或启用出口。
|
|
60
|
+
|
|
61
|
+
## 四、本机暴露面
|
|
62
|
+
|
|
63
|
+
| 面 | 状态 |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| dsh 本体 | `127.0.0.1:3080`(仅回环) |
|
|
66
|
+
| 渠道包本地 OpenAI 网关 | `127.0.0.1:8326`,**必须带 API key**(无 key 实测 `401`);key 文件 `~/.dsh/openai-gateway/api-key` 权限 `600` |
|
|
67
|
+
| 局域网中继 / 本地转发 | `18326` / `18899` **未监听**(默认关闭) |
|
|
68
|
+
| OAuth / 回调服务器 | 全部 `listen 127.0.0.1`(Gemini 另有一个 `::1`) |
|
|
69
|
+
| 浏览器半身 | 只 `fetch` 本机插件 API,不发任何外部请求 |
|
|
70
|
+
| 插件 HTTP 面 | 有信任围栏(Host 必须回环 + 拒跨站 + Origin/Referer 同源);无同源头的请求实测 `401`,外部网页无法借你已登录的账号发请求 |
|
|
71
|
+
|
|
72
|
+
## 五、凭据面
|
|
73
|
+
|
|
74
|
+
- 账号 token 存在 `~/.dsh/.credentials.yaml`(`600`),由内核凭据服务保管;渠道页只拿 `credentialRef` 与**脱敏**身份(手机号形如 `130******00`),token 不回传浏览器。
|
|
75
|
+
- 渠道包状态 `~/.dsh/channel-pack/state.json` 与账本 `token-ledger.json` 权限 `644`,内容只有账号引用、昵称与用量,**没有密钥**(要更严可 `chmod 600`)。
|
|
76
|
+
|
|
77
|
+
## 六、打包产物与可读源码
|
|
78
|
+
|
|
79
|
+
`vendor/channel-pack/pack.js` 是 2.9 MB 打包产物,仓库里同时带可读 `src/*.ts`。用工具做域名差集:
|
|
80
|
+
|
|
81
|
+
- **产物有、源码无**:只有 `github.com`(注释里的参考仓库)与 WHATWG/W3C/IETF 规范链接(错误信息格式化用)。
|
|
82
|
+
- **源码有、产物无**:`www.codebuddy.cn`(仅登录页常量 `WEBSITE_HOME`,源码里未被引用,被 tree-shake)、`blog.csdn.net`/`bigmodel.cn`(注释)。
|
|
83
|
+
|
|
84
|
+
这一步只能证明**域名面**一致,加上行为套件(13 家注册、无 OpenCode 预热、RPC 失败关闭)。**不能从字节上证明 `pack.js` 与源码逐行等价**。
|
|
85
|
+
|
|
86
|
+
## 七、边界与已知风险(要知情)
|
|
87
|
+
|
|
88
|
+
1. **ZCode 会向厂商补发存活事件**:`POST https://zcode.z.ai/api/v1/event/report`,事件仅 `app_launch`、`app_daily_active`。收件方是 z.ai 本家,但这是**伪装成官方 IDE 客户端**的行为——属厂商 ToS/风控风险,不是第三方外泄。
|
|
89
|
+
2. **DV 证书不含企业名**的几家(Qoder 部分主机、TRAE、z.ai、MiniMax、小浣熊、Cline、models.dev):只能靠域名归属与源码用途判断,本次未能用证书主体反证。
|
|
90
|
+
3. **Google 系主机直连不通**(`www.googleapis.com`、`oauth2.googleapis.com`、`accounts.google.com`、`daily-cloudcode-pa*.googleapis.com` 握手失败),需要代理;因此它们的证书主体本次未取到。
|
|
91
|
+
4. 插件与 dsh **同进程**、以你的用户身份拥有完整文件权限(所有 dsh 插件皆如此)。本次审的是**出网与凭据面**,不是运行沙箱。
|
|
92
|
+
5. 上游代码是第三方;**渠道包更新后本审计作废**,需要重跑 `node scripts/egress-audit.mjs --tls`。
|
|
93
|
+
|
|
94
|
+
## 八、怎么复跑
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# 1) 静态:域名清单 + 明文 http + listen 绑定 + 产物↔源码差集(离线,秒级)
|
|
98
|
+
node scripts/egress-audit.mjs
|
|
99
|
+
|
|
100
|
+
# 2) 联网:对上面每个域名做 TLS 握手,打印证书主体(约 1–2 分钟)
|
|
101
|
+
node scripts/egress-audit.mjs --tls
|
|
102
|
+
|
|
103
|
+
# 3) 审装机副本而不是仓库
|
|
104
|
+
node scripts/egress-audit.mjs --root ~/.dsh/profiles/web/node_modules/dsh-free-model --tls
|
|
105
|
+
|
|
106
|
+
# 4) 运行时监听面(找有没有 0.0.0.0)
|
|
107
|
+
ss -ltn
|
|
108
|
+
|
|
109
|
+
# 5) 本地网关是否要钥(期望 401)
|
|
110
|
+
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8326/v1/models
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
工具只读、不改任何文件;`--json` 可输出结构化结果供别的脚本消费。
|