@twinsearth/w2m-dsh-plugin 0.19.0 → 0.20.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/CHANGELOG.md +40 -0
- package/package.json +1 -1
- package/src/agent/fleet-scale.mjs +72 -0
- package/src/plugin/tools.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,46 @@ All notable changes to this project are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.20.0] — 2026-10-15
|
|
8
|
+
|
|
9
|
+
**Version skew is refuted too, and the direct-path failure is now counted instead of read one at a time.**
|
|
10
|
+
|
|
11
|
+
### Third hypothesis, third refutation
|
|
12
|
+
|
|
13
|
+
The previous release established that this machine runs plugin **0.9.5** while the source tree is **0.19.0**,
|
|
14
|
+
and that the failing `P2P_PUNCH_FAILED` is raised by the plugin process. The natural next step was to suspect a
|
|
15
|
+
digest name that 0.9.5 used and later versions removed.
|
|
16
|
+
|
|
17
|
+
**Measured, and refuted:** reading `crypto.mjs`, `p2p.mjs` and `p2p-node.mjs` **at tag `v0.9.5`** through the
|
|
18
|
+
API shows the same two digest names the current tree uses — `blake2s256` and `sha256`. Then a search for
|
|
19
|
+
**dynamic** algorithm arguments (`createHash(variable)`) across `src/` found **none**: every `createHash` and
|
|
20
|
+
`createHmac` in this codebase is called with a string literal.
|
|
21
|
+
|
|
22
|
+
**So there is no call in this codebase that can produce `Digest method not supported`.** Three hypotheses have
|
|
23
|
+
now been measured and excluded — BLAKE2s, the wider primitive set, and version skew — and the cause remains
|
|
24
|
+
**UNVERIFIED**. What is *not* in doubt is where it is raised: the plugin process on this machine, running
|
|
25
|
+
0.9.5 while the source under study is 0.20.0.
|
|
26
|
+
|
|
27
|
+
### What this release delivers instead of a fourth guess
|
|
28
|
+
|
|
29
|
+
`p2pReasons()` and `classifyP2PReason()` turn the P2P reason strings into a **count**, because the finding that
|
|
30
|
+
matters was invisible in every individual report: **twelve of twelve tasks travelled by relay, and no aggregate
|
|
31
|
+
anywhere said so.**
|
|
32
|
+
|
|
33
|
+
* `relay_only_share` is the fleet's avoidable latency as one number, and it is **`null`** for an empty
|
|
34
|
+
denominator — "no lease carried a p2p block" and "every lease failed" must not look alike.
|
|
35
|
+
* an unrecognised code is counted as `OTHER` **with the raw code travelling with it**, so a new refusal name
|
|
36
|
+
is reported rather than swallowed.
|
|
37
|
+
* a missing reason is distinguished from a present one, because *"no reason recorded" is not "no failure"*.
|
|
38
|
+
|
|
39
|
+
### The version skew is still unresolved and still blocks diagnosis
|
|
40
|
+
|
|
41
|
+
The installed plugin is **0.9.5**; the source is **0.20.0**. Until they match, every source-level conclusion
|
|
42
|
+
about this machine's P2P behaviour is read from code that is not running. This needs a person: updating the
|
|
43
|
+
plugin installs files into the DSH profile, which is outside what this session changes on its own.
|
|
44
|
+
|
|
45
|
+
**7 new tests, 0 failures.**
|
|
46
|
+
|
|
7
47
|
## [0.19.0] — 2026-10-15
|
|
8
48
|
|
|
9
49
|
**The plugin this machine runs is 0.9.5. The source tree is 0.18.0. Every source-level conclusion about the P2P failure was read from code that may not have run.**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twinsearth/w2m-dsh-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "DSH: Windows2MacOS — drive the same project on online Windows and macOS machines from one DeepSeek account, across networks and regions. P2P hole punching is the default path (relay + shared server as rendezvous, ledger and fallback), with a bundled STUN responder, Tailscale/public-VPS/tunnel shapes, Rabbit relay + per-machine Localside + eight DSH tools (replicate / split), nine aggregate verdicts and signed requests.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -111,6 +111,78 @@ export function isFleetFailure(entry) {
|
|
|
111
111
|
return classifyLease(entry).outcome === LEASE_OUTCOME.NO_RESULT;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/** Refusal codes the relay writes into `p2p.reason`, grouped by what they mean for a fleet. */
|
|
115
|
+
export const P2P_FAILURE_KIND = Object.freeze({
|
|
116
|
+
NO_CANDIDATES: 'no candidate address was known, so no punch was attempted',
|
|
117
|
+
PUNCH_FAILED: 'a punch was attempted and did not complete',
|
|
118
|
+
PUNCH_TIMEOUT: 'a punch was attempted and nothing answered in time',
|
|
119
|
+
LEASE_NOT_RUNNABLE: 'the lease was not in a state to be handed the command',
|
|
120
|
+
REVERSE_DIAL: 'the reverse dial did not complete',
|
|
121
|
+
BLOCKED: 'a local condition stopped the direct path',
|
|
122
|
+
OTHER: 'a reason the table does not classify',
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Classify one `p2p.reason` string.
|
|
127
|
+
*
|
|
128
|
+
* Reasons are prose with a machine-readable prefix (`P2P_NO_CANDIDATES: ...`), and reading them one at a time
|
|
129
|
+
* is how a fleet's direct-path problem stays invisible: the sample that prompted this had **twelve of twelve
|
|
130
|
+
* tasks on the relay** and no aggregate anywhere that said so.
|
|
131
|
+
*
|
|
132
|
+
* Returns `OTHER` for anything unrecognised rather than throwing or guessing, and the raw reason travels with
|
|
133
|
+
* the classification so a new code is reported rather than swallowed.
|
|
134
|
+
*/
|
|
135
|
+
export function classifyP2PReason(reason) {
|
|
136
|
+
if (typeof reason !== 'string' || reason === '') {
|
|
137
|
+
return { kind: null, code: null, detail: 'no reason recorded, which is not the same as no failure' };
|
|
138
|
+
}
|
|
139
|
+
const code = (reason.split(':')[0] ?? '').trim();
|
|
140
|
+
if (code === 'P2P_NO_CANDIDATES') return { kind: P2P_FAILURE_KIND.NO_CANDIDATES, code, detail: reason };
|
|
141
|
+
if (code === 'P2P_PUNCH_FAILED') return { kind: P2P_FAILURE_KIND.PUNCH_FAILED, code, detail: reason };
|
|
142
|
+
if (code === 'P2P_PUNCH_TIMEOUT') return { kind: P2P_FAILURE_KIND.PUNCH_TIMEOUT, code, detail: reason };
|
|
143
|
+
if (code === 'P2P_LEASE_NOT_RUNNABLE') return { kind: P2P_FAILURE_KIND.LEASE_NOT_RUNNABLE, code, detail: reason };
|
|
144
|
+
if (code.startsWith('P2P_REVERSE_DIAL')) return { kind: P2P_FAILURE_KIND.REVERSE_DIAL, code, detail: reason };
|
|
145
|
+
if (code.startsWith('P2P_UNAVAILABLE') || code.startsWith('P2P_CRYPTO')) return { kind: P2P_FAILURE_KIND.BLOCKED, code, detail: reason };
|
|
146
|
+
return { kind: P2P_FAILURE_KIND.OTHER, code, detail: reason };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Count why the direct path was not used, across a set of reports.
|
|
151
|
+
*
|
|
152
|
+
* The number worth acting on is `relay_only_share`: the fraction of leases that travelled by relay while a
|
|
153
|
+
* direct path was nominally configured. That is the fleet's avoidable latency, and it is invisible in any
|
|
154
|
+
* single report.
|
|
155
|
+
*/
|
|
156
|
+
export function p2pReasons(reports) {
|
|
157
|
+
const byCode = new Map();
|
|
158
|
+
let leasesWithP2P = 0;
|
|
159
|
+
let onRelay = 0;
|
|
160
|
+
let onDirect = 0;
|
|
161
|
+
for (const report of Array.isArray(reports) ? reports : []) {
|
|
162
|
+
for (const m of Array.isArray(report?.machines) ? report.machines : []) {
|
|
163
|
+
const p = m?.p2p;
|
|
164
|
+
if (p === null || p === undefined || typeof p !== 'object') continue;
|
|
165
|
+
leasesWithP2P += 1;
|
|
166
|
+
if (p.encrypted === true || (p.peer !== null && p.peer !== undefined)) onDirect += 1;
|
|
167
|
+
else onRelay += 1;
|
|
168
|
+
const c = classifyP2PReason(p.reason ?? p.encryption_reason ?? null);
|
|
169
|
+
if (c.code !== null) byCode.set(c.code, (byCode.get(c.code) ?? 0) + 1);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
leases_with_p2p: leasesWithP2P,
|
|
174
|
+
on_relay: onRelay,
|
|
175
|
+
on_direct: onDirect,
|
|
176
|
+
// Null rather than 0 for an empty denominator, for the same reason every other rate here is: "no leases"
|
|
177
|
+
// and "every lease failed" must not look alike.
|
|
178
|
+
relay_only_share: leasesWithP2P === 0 ? null : Math.round((onRelay / leasesWithP2P) * 1000) / 1000,
|
|
179
|
+
by_code: Object.fromEntries([...byCode].sort((a, b) => b[1] - a[1])),
|
|
180
|
+
detail: leasesWithP2P === 0
|
|
181
|
+
? 'no lease carried a p2p block, so nothing can be said about the direct path'
|
|
182
|
+
: `${onRelay} of ${leasesWithP2P} lease(s) used the relay; ${byCode.size} distinct reason code(s)`,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
114
186
|
/**
|
|
115
187
|
* Summarise a set of task reports.
|
|
116
188
|
*
|
package/src/plugin/tools.mjs
CHANGED
|
@@ -185,7 +185,7 @@ const MAX_STAGES = 16;
|
|
|
185
185
|
* `package.json` during `scripts/pack.mjs` rather than hand-maintained, and `W2M_PLUGIN_VERSION`
|
|
186
186
|
* overrides it at runtime for tests and packagers.
|
|
187
187
|
*/
|
|
188
|
-
const PLUGIN_VERSION = '0.
|
|
188
|
+
const PLUGIN_VERSION = '0.20.0';
|
|
189
189
|
|
|
190
190
|
/** How long any single HTTP call may take before it is aborted, in milliseconds. */
|
|
191
191
|
const DEFAULT_REQUEST_TIMEOUT_MS = 15_000;
|