dsh-clash-subscription 0.2.3 → 0.4.2-probe.5
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 +2 -223
- package/index.js +1 -710
- package/package.json +6 -62
- package/LICENSE +0 -21
- package/client.js +0 -786
- package/cordis.patch.yml +0 -5
- package/icon.svg +0 -14
- package/lib/core.js +0 -496
- package/lib/discovery.js +0 -94
- package/lib/install.js +0 -171
- package/lib/routes.js +0 -262
- package/lib/routing.js +0 -173
- package/lib/subscription.js +0 -138
- package/locale/en.json +0 -6
- package/locale/zh.json +0 -6
package/README.md
CHANGED
|
@@ -1,224 +1,3 @@
|
|
|
1
|
-
# dsh-clash-subscription
|
|
1
|
+
# dsh-clash-subscription publish probe
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> existing profile's saved config keeps applying). Settings page: **Settings → Clash proxy**.
|
|
5
|
-
|
|
6
|
-
Give DeepSeek Harness its own outbound proxy: import a Clash/mihomo subscription,
|
|
7
|
-
and the plugin runs a **private core** and points the Harness' outbound policy at it.
|
|
8
|
-
`web_fetch`, search/fetch providers, LLM transports and shells then reach blocked
|
|
9
|
-
sites automatically — **no desktop Clash app, no system proxy, no per-command
|
|
10
|
-
`HTTPS_PROXY`**.
|
|
11
|
-
|
|
12
|
-
## Install
|
|
13
|
-
|
|
14
|
-
The bundle must be present in **two** places in the profile manifest. Only one of them is
|
|
15
|
-
enough to make the settings page appear to exist, and the plugin then silently does nothing.
|
|
16
|
-
|
|
17
|
-
```jsonc
|
|
18
|
-
// ~/.dsh/profiles/<profile>/package.json
|
|
19
|
-
{
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"dsh-clash-subscription": "0.2.3" // ← the package must be installed
|
|
22
|
-
},
|
|
23
|
-
"dsh": {
|
|
24
|
-
"profile": {
|
|
25
|
-
"bundles": [
|
|
26
|
-
// ... other bundles ...
|
|
27
|
-
"dsh-clash-subscription" // ← and it must be listed as a bundle
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
With only the `bundles` entry the host fails at startup with:
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
dsh: cannot resolve profile bundle "dsh-clash-subscription" from the dsh installation or
|
|
38
|
-
<profile dir>; run 'dsh plugin --profile <profile> install' if its dependency is not installed
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Then install and **fully restart the Harness** — the host loads plugin code at boot:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
cd ~/.dsh/profiles/<profile>
|
|
45
|
-
pnpm install --config.minimumReleaseAge=0
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Split routing
|
|
49
|
-
|
|
50
|
-
| Destination | Path |
|
|
51
|
-
| --- | --- |
|
|
52
|
-
| Loopback `127.0.0.1`, `::1`, localhost | direct (never in the tunnel: the Web UI and every plugin route live there) |
|
|
53
|
-
| LAN `10/8`, `172.16/12`, `192.168/16`, `169.254/16` | direct |
|
|
54
|
-
| Chinese addresses (`GEOIP,CN`) | direct |
|
|
55
|
-
| Everything else | proxy, through the selected subscription node |
|
|
56
|
-
|
|
57
|
-
Domestic sites therefore behave exactly as before; only traffic that would otherwise
|
|
58
|
-
be blocked reaches a node.
|
|
59
|
-
|
|
60
|
-
## No defaults, no borrowed configuration
|
|
61
|
-
|
|
62
|
-
The subscription URL has **no default value and no fallback**. The plugin never reads
|
|
63
|
-
another client's profile, subscription, or node selection. The only machine-level
|
|
64
|
-
information it uses is:
|
|
65
|
-
|
|
66
|
-
- an existing mihomo-compatible executable, so you need not type a path to a core the
|
|
67
|
-
machine already has; and
|
|
68
|
-
- downloaded GeoIP/GeoSite databases, because the core needs them before it can
|
|
69
|
-
classify a single connection — the alternative is a download over the very tunnel
|
|
70
|
-
those databases are required to establish.
|
|
71
|
-
|
|
72
|
-
Both are optional. Without them you point `corePath` at a binary and the core falls
|
|
73
|
-
back to a built-in domestic domain list.
|
|
74
|
-
|
|
75
|
-
## How it works
|
|
76
|
-
|
|
77
|
-
It does not reimplement transport. It reuses the Harness' own outbound policy module
|
|
78
|
-
`@deepseek-ai/dsh-http-proxy`:
|
|
79
|
-
|
|
80
|
-
1. **The core parses the subscription.** The config carries a `proxy-providers` entry
|
|
81
|
-
and mihomo downloads it itself, so anytls / hysteria2 / vless / ss / trojan all work
|
|
82
|
-
without a parser or a schema to track.
|
|
83
|
-
2. **The policy is loaded from the installation, not the profile.** A profile-installed
|
|
84
|
-
plugin resolves bare specifiers from its own `node_modules`; resolving
|
|
85
|
-
`dsh-http-proxy` from the dsh installation's manifest yields the *same module
|
|
86
|
-
instance the host loaded*. Node's `fetch` resolves undici's global dispatcher, and
|
|
87
|
-
`dsh-subprocess` asks this same module for a child's environment — one instance, so
|
|
88
|
-
one install covers `ctx.web`, the LLM transports and every spawned child.
|
|
89
|
-
3. **A working node is chosen at startup.** A fresh `PROXY` group starts on `DIRECT`,
|
|
90
|
-
which would send foreign traffic straight out, so the plugin measures latency in
|
|
91
|
-
batches, skips dead nodes (a provider can report a node alive long after it stopped
|
|
92
|
-
serving), and never selects `DIRECT`.
|
|
93
|
-
4. **Geo databases are reused, never re-downloaded.** A missing database makes the core
|
|
94
|
-
fetch one from GitHub at startup — the exact connection it needs the database to
|
|
95
|
-
establish — so an existing copy is reused and a missing one is reported instead of
|
|
96
|
-
retried.
|
|
97
|
-
|
|
98
|
-
## Packaged builds and the installation root
|
|
99
|
-
|
|
100
|
-
The plugin must load its proxy policy from the **Harness installation**, not from the
|
|
101
|
-
profile: that is what makes it the same `undici` instance the host already routes through.
|
|
102
|
-
A packaged Desktop build keeps the app inside a single archive file:
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
<install dir>\resources\app.asar\dsh\node_modules\@deepseek-ai\dsh-desktop-host\lib\index.js
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Note `app.asar`, not `app`. 0.2.2 only recognised `resources/app/dsh` and `app/dsh`, so on
|
|
109
|
-
every packaged build it reported `cannot locate the dsh installation root from the process
|
|
110
|
-
arguments`, never spawned the core, and — because the readiness check did not inspect the
|
|
111
|
-
installation root — retried the same failure on every boot with nothing on the panel.
|
|
112
|
-
|
|
113
|
-
0.2.3 tries four sources in order:
|
|
114
|
-
|
|
115
|
-
| # | Source | Use |
|
|
116
|
-
| --- | --- | --- |
|
|
117
|
-
| 1 | `DSH_INSTALL_ROOT` / `DSH_APP_ROOT` | explicit override, always wins |
|
|
118
|
-
| 2 | `process.argv` | the host passes its own entry script, which lives in the installation |
|
|
119
|
-
| 3 | `process.execPath` | a launcher may omit the entry script entirely |
|
|
120
|
-
| 4 | fixed positions beside the executable | `<exe dir>/resources/app.asar/dsh`, `resources/app/dsh`, `app.asar.unpacked/dsh` |
|
|
121
|
-
|
|
122
|
-
The first release also failed here in a second way: `Config` is derived from the same
|
|
123
|
-
locator, so when it returned nothing the config schema was `undefined` and the settings
|
|
124
|
-
section never appeared. Both come from one root cause.
|
|
125
|
-
|
|
126
|
-
If your layout is none of the above, point the variable at the directory that holds the
|
|
127
|
-
dsh package manifest and the plugin will use it:
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
export DSH_INSTALL_ROOT="/opt/deepseek-harness/resources/app.asar/dsh"
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
## Configuration
|
|
134
|
-
|
|
135
|
-
Install the bundle, then set the subscription in **Settings → Clash proxy**.
|
|
136
|
-
|
|
137
|
-
| Field | Default | Meaning |
|
|
138
|
-
| --- | --- | --- |
|
|
139
|
-
| `subscriptionUrl` | empty | Subscription URL. `clash://install-config?url=…` import links are accepted. Required. |
|
|
140
|
-
| `node` | empty | Preferred node name; empty picks the lowest-latency working node |
|
|
141
|
-
| `corePath` | empty | mihomo/clash executable; empty searches the usual install locations |
|
|
142
|
-
| `mode` | `rule` | `rule` keeps domestic traffic direct; `global` proxies everything |
|
|
143
|
-
| `autoStart` | `true` | Start the core and install the policy when the plugin loads |
|
|
144
|
-
| `speedTestMinutes` | `30` | Re-measure interval; `0` disables the cycle |
|
|
145
|
-
| `speedTestCount` | `8` | Nodes measured per cycle |
|
|
146
|
-
| `dnsServers` | empty | Resolvers for the core's own lookups, comma separated |
|
|
147
|
-
| `directDomains` | empty | Domain suffixes that must stay direct |
|
|
148
|
-
| `proxyDomains` | empty | Domain suffixes that must always use the node |
|
|
149
|
-
| `dataDir` | `<DSH_HOME>/data/dsh-clash-proxy` | Core config, subscription cache, geo databases |
|
|
150
|
-
|
|
151
|
-
Ports are allocated free on every start, so the plugin never collides with another
|
|
152
|
-
Clash instance, and it only ever stops the process it started.
|
|
153
|
-
|
|
154
|
-
## UI
|
|
155
|
-
|
|
156
|
-
A page in **Settings → Clash proxy**, with live status, the node table with measured
|
|
157
|
-
latency, the subscription field with a pre-save reachability check, and the
|
|
158
|
-
speed-test cycle. Saving writes through the Harness config editor, so the rest of the
|
|
159
|
-
profile patch stays intact; a routing-relevant change restarts the core, a timing
|
|
160
|
-
change only re-arms the cycle.
|
|
161
|
-
|
|
162
|
-
## Tool
|
|
163
|
-
|
|
164
|
-
One model-facing tool, `clash_proxy`:
|
|
165
|
-
|
|
166
|
-
- `status` — core, policy, node table, current node, live traffic
|
|
167
|
-
- `import` — probe a URL, restart the core on it, install the policy
|
|
168
|
-
- `start` / `stop` — bring routing up or take it down
|
|
169
|
-
- `select` — switch the exit node by name
|
|
170
|
-
- `test` — measure one node, or the current one
|
|
171
|
-
- `refresh` — re-download the subscription
|
|
172
|
-
|
|
173
|
-
## Verification
|
|
174
|
-
|
|
175
|
-
One judgement counts:
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
curl -s http://127.0.0.1:<host port>/clash-proxy/status \
|
|
179
|
-
| grep -o '"routingVerified":"[a-z]*"'
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
- `active` — this plugin's dispatcher is live: outbound requests really go through it.
|
|
183
|
-
- `none` — no policy installed yet (no subscription, or `start` never ran).
|
|
184
|
-
- `lost` — something replaced the dispatcher afterwards (a restart, another plugin).
|
|
185
|
-
|
|
186
|
-
`routingVerified` compares undici's live global dispatcher with the instance this plugin
|
|
187
|
-
installed, so it cannot be satisfied by a flag. A successful `import`, or being able to
|
|
188
|
-
fetch a foreign host, is **not** sufficient proof on its own.
|
|
189
|
-
|
|
190
|
-
## Tests
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
node test/unit.mjs # offline assertions: no network, no core, no profile writes
|
|
194
|
-
node test/client-sim.mjs # executes the client bundle in a simulated module loader
|
|
195
|
-
node test/e2e.mjs "<subscription url>" # real core + real subscription
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
`test/e2e.mjs` asserts the three promises above: the core boots, `fetch` reaches
|
|
199
|
-
foreign hosts once the policy is installed, and domestic plus loopback traffic stays
|
|
200
|
-
direct.
|
|
201
|
-
|
|
202
|
-
## Known limits
|
|
203
|
-
|
|
204
|
-
- **This process and its children only.** It is the Harness' outbound policy, not a
|
|
205
|
-
system VPN; other applications are unaffected (which is part of why domestic sites
|
|
206
|
-
stay unchanged).
|
|
207
|
-
- **Worker threads do not receive the policy.** `dsh-http-proxy` deliberately withholds
|
|
208
|
-
a possibly credential-bearing proxy URL from model-authored scripts; the plugin
|
|
209
|
-
keeps that boundary.
|
|
210
|
-
- **A plugin that builds its own transport bypasses it.** A fetch provider using
|
|
211
|
-
`node:https` and its own DNS lookup does not read undici's dispatcher, so it will not
|
|
212
|
-
be proxied.
|
|
213
|
-
- **Node quality is the subscription's.** Automatic selection measures latency once;
|
|
214
|
-
later congestion still needs a manual `select` or `test`.
|
|
215
|
-
- **No bundled core.** Bring a mihomo/clash binary; the plugin does not redistribute one.
|
|
216
|
-
- **An unrecognised installation layout stops routing, not just the panel.** If
|
|
217
|
-
`status.blocker` mentions the installation root, set `DSH_INSTALL_ROOT`; everything
|
|
218
|
-
downstream (routing, the tool, the settings section) needs that root.
|
|
219
|
-
- **One profile at a time.** Each profile has its own `dependencies` and `bundles`; a
|
|
220
|
-
machine with several profiles needs the package installed in each of them.
|
|
221
|
-
|
|
222
|
-
## License
|
|
223
|
-
|
|
224
|
-
MIT
|
|
3
|
+
This version exists only to verify the publish pipeline. It is not a release.
|