@twinsearth/w2m-dsh-plugin 1.1.1 → 1.1.3
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +75 -0
- package/codex/mcp-servers.toml +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/src/plugin/fleet-target.mjs +23 -2
- package/src/plugin/fleet-target.mjs.bak-arch2 +812 -0
- package/src/plugin/fleet-target.mjs.bak-archive +812 -0
- package/src/plugin/tools.mjs +13 -1
- package/src/relay/state.mjs +38 -3
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
},
|
|
6
6
|
"metadata": {
|
|
7
7
|
"description": "The w2m fleet plugins: one account, many machines, any of Windows, macOS or Linux.",
|
|
8
|
-
"version": "1.1.
|
|
8
|
+
"version": "1.1.3"
|
|
9
9
|
},
|
|
10
10
|
"plugins": [
|
|
11
11
|
{
|
|
12
12
|
"name": "w2m-fleet",
|
|
13
13
|
"source": "./",
|
|
14
14
|
"description": "Read fleet state and dispatch commands across the machines registered to one account. Read-only MCP surface: the five exposed tools cannot change anything.",
|
|
15
|
-
"version": "1.1.
|
|
15
|
+
"version": "1.1.3",
|
|
16
16
|
"author": {
|
|
17
17
|
"name": "TwinsEarth"
|
|
18
18
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "w2m-fleet",
|
|
3
3
|
"description": "Drive the same project on online Windows, macOS and Linux machines from one account: read fleet state, dispatch commands and read results. The MCP surface is deliberately read-only.",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.3",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TwinsEarth"
|
|
7
7
|
},
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here.
|
|
4
4
|
|
|
5
|
+
## [1.1.3] — 2026-10-17
|
|
6
|
+
|
|
7
|
+
**A machine offline for more than 72 hours leaves the list. It is not deleted, and it comes back on its own.**
|
|
8
|
+
|
|
9
|
+
### The rule, and why hiding is not deleting
|
|
10
|
+
|
|
11
|
+
`readFleet` filters the roster at **the read path only**:
|
|
12
|
+
|
|
13
|
+
* a machine whose `last_seen` is at least **72 hours** old is **not shown** by `w2m_devices` or the composer;
|
|
14
|
+
* `records` still carries **every device the relay sent**, so nothing is lost and no bookkeeping is required;
|
|
15
|
+
* a **missing or unparseable** `last_seen` is **not** archived -- an unknown age must not be read as "gone for three
|
|
16
|
+
days", or a relay that omits the field would empty the list;
|
|
17
|
+
* `include_stale: true` shows the archived machines, which is the operator's audit route;
|
|
18
|
+
* the machine returns by reporting again: the same record with a fresh timestamp is listed, with no re-pairing.
|
|
19
|
+
|
|
20
|
+
Because the relay already stops leasing machines that are offline (v1.1.2), a hidden machine is also not a dispatch
|
|
21
|
+
target -- the list and the dispatch agree, from one notion of liveness plus this display rule.
|
|
22
|
+
|
|
23
|
+
### The fixtures were the reason this took two attempts
|
|
24
|
+
|
|
25
|
+
The first attempt changed nothing in the filter and failed 8 tests: `fleet-target`'s roster fixtures carried **fixed
|
|
26
|
+
dates** (`2026-10-09` … `2026-10-11`), which are more than 72 hours old *now*, so a correct filter archived all three
|
|
27
|
+
machines. Making the timestamps **relative** (`Date.now() - 60s` …) fixed all 8 without touching a single assertion,
|
|
28
|
+
which is the evidence that the filter was right and the fixture was the stale part.
|
|
29
|
+
|
|
30
|
+
### Verified
|
|
31
|
+
|
|
32
|
+
`test/fleet-target.test.mjs` gains four assertions -- hidden from the list, **records kept**, returns on its own and
|
|
33
|
+
`include_stale` shows it meanwhile, unknown age not archived -- for **45 pass, 0 fail**. `test/tools.test.mjs` 115 and
|
|
34
|
+
`test/relay.test.mjs` 160 remain green.
|
|
35
|
+
|
|
36
|
+
## [1.1.2] — 2026-10-17
|
|
37
|
+
|
|
38
|
+
**A dispatch that names no machines now goes to the machines that are online. The rule that decides "online" had been
|
|
39
|
+
written three times and the three copies are now one.**
|
|
40
|
+
|
|
41
|
+
### The defect
|
|
42
|
+
|
|
43
|
+
The relay built a lease for **every paired device**, including a machine whose agent had stopped heartbeating days
|
|
44
|
+
earlier. That lease expired, `partial` became the only verdict the task could reach, and a fleet whose live machines
|
|
45
|
+
agreed reported *"incomplete"* forever. Observed on 2026-10-17:
|
|
46
|
+
|
|
47
|
+
aggregate: partial counts: { ok: 3, expired: 4 }
|
|
48
|
+
|
|
49
|
+
So "all machines agree" was **unreachable** while a stale entry existed, and no amount of re-running could fix it.
|
|
50
|
+
|
|
51
|
+
### The fix: one definition, three call sites
|
|
52
|
+
|
|
53
|
+
`device.online === true` alone is **not** the answer -- the flag stays true until the sweep runs. The real rule was
|
|
54
|
+
already computed, in two places, as `device.online === true && !silent`, and the target list was about to become a
|
|
55
|
+
third copy. It is now a method:
|
|
56
|
+
|
|
57
|
+
isOnlineDevice(device, nowMs = this.nowMs())
|
|
58
|
+
|
|
59
|
+
used by `deviceStatus`, `publicDevice` and the default target list. `simtMs === null` (no contact ever observed) is
|
|
60
|
+
**not** silent, so an unknown age cannot be read as "gone".
|
|
61
|
+
|
|
62
|
+
### `include_offline` is the escape hatch, and it is reachable
|
|
63
|
+
|
|
64
|
+
`w2m_run` gains `include_offline` (boolean, **default false**) and puts it on the wire only when asked, so a default
|
|
65
|
+
dispatch sends the same bytes as before. The relay records it on the task, and a probe against a live `RabbitState`
|
|
66
|
+
confirmed the field is accepted and stored (`recorded: true`) rather than rejected as unknown.
|
|
67
|
+
|
|
68
|
+
### Deliberately NOT in this release
|
|
69
|
+
|
|
70
|
+
**The 72-hour archive rule is deferred to 1.1.3.** The read-path filter is written and correct, but eight
|
|
71
|
+
`fleet-target` fixtures carry fixed old timestamps and would need their intent reviewed one by one; shipping it with
|
|
72
|
+
those fixtures patched blindly is how a green suite stops meaning anything. A machine that has been offline for days is
|
|
73
|
+
therefore **hidden from dispatch** by this release (it is not online) but still **listed** by `w2m_devices`.
|
|
74
|
+
|
|
75
|
+
### Verified
|
|
76
|
+
|
|
77
|
+
`test/relay.test.mjs` 160 pass, `test/tools.test.mjs` 115 pass, `test/fleet-target.test.mjs` 41 pass -- 316 tests, 0
|
|
78
|
+
fail, after the change. The 72h filter was measured, found to break 8 fixtures, and rolled back rather than shipped.
|
|
79
|
+
|
|
5
80
|
## [1.1.1] — 2026-10-17
|
|
6
81
|
|
|
7
82
|
**The fleet is now installable from Claude Code, Codex and OpenAI's plugin surface -- and the parts that still need a
|
package/codex/mcp-servers.toml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twinsearth/w2m-dsh-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Run one project across your own Windows and macOS machines from a single DeepSeek account, through 11 w2m_* tools. Four coordination modes (replicate, split, broadcast, pipeline) and six aggregate verdicts (consistent, divergent, divergent-platform, failed, partial, unverifiable). P2P hole punching by default, with a bundled relay, STUN responder and ledger fallback, so the fleet needs no third-party service. Joining needs a pairing code plus autoStartAgent: true; installing alone does not join.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "twinsearth-w2m-dsh",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.3",
|
|
5
5
|
"description": "Run one project across your own Windows and macOS machines from a single DeepSeek account, through 11 w2m_* tools. Four coordination modes (replicate, split, broadcast, pipeline) and six aggregate verdicts (consistent, divergent, divergent-platform, failed, partial, unverifiable). P2P hole punching by default, with a bundled relay, STUN responder and ledger fallback, so the fleet needs no third-party service. Joining needs a pairing code plus autoStartAgent: true; installing alone does not join.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -156,6 +156,15 @@ export function isSelectableDevice(device) {
|
|
|
156
156
|
* @param {string|null} localMachineId This machine's id, for the "this machine" mark.
|
|
157
157
|
* @returns {object}
|
|
158
158
|
*/
|
|
159
|
+
/**
|
|
160
|
+
* v1.1.3: how long a machine may be unheard from before it leaves the list.
|
|
161
|
+
*
|
|
162
|
+
* The operator's rule: offline for 72 hours is no longer shown, **nothing is deleted**, and it comes back on its own
|
|
163
|
+
* once it reports again. Hiding and deleting are deliberately different -- deleting would throw away the history of a
|
|
164
|
+
* machine that is merely switched off, and re-pairing would be the only way back.
|
|
165
|
+
*/
|
|
166
|
+
const ARCHIVE_AFTER_MS = 72 * 60 * 60 * 1000;
|
|
167
|
+
|
|
159
168
|
export function describeTargetMachine(device, localMachineId = null) {
|
|
160
169
|
const machineId = typeof device?.machine_id === 'string' && device.machine_id !== '' ? device.machine_id : null;
|
|
161
170
|
return {
|
|
@@ -343,7 +352,7 @@ export function dispatchSelectionFields(selection, mode) {
|
|
|
343
352
|
* fields rather than this module's projection of them.
|
|
344
353
|
*/
|
|
345
354
|
export async function readFleet(deps) {
|
|
346
|
-
const { rabbitUrl, token = null, localMachineId = null, signal, request } = deps;
|
|
355
|
+
const { rabbitUrl, token = null, localMachineId = null, signal, request, include_stale = false } = deps;
|
|
347
356
|
if (typeof rabbitUrl !== 'string' || rabbitUrl === '') {
|
|
348
357
|
return {
|
|
349
358
|
ok: false,
|
|
@@ -397,7 +406,18 @@ export async function readFleet(deps) {
|
|
|
397
406
|
const records = Array.isArray(result.json?.devices)
|
|
398
407
|
? result.json.devices
|
|
399
408
|
: (Array.isArray(result.json?.machines) ? result.json.machines : []);
|
|
400
|
-
const
|
|
409
|
+
const allMachines = records.map((record) => describeTargetMachine(record, localMachineId));
|
|
410
|
+
/**
|
|
411
|
+
* Archived means "not shown", never "removed": `records` still carries every device, so a caller that asks for the
|
|
412
|
+
* archived ones receives them. A missing or unparseable timestamp is NOT archived -- "unknown" must not be read as
|
|
413
|
+
* "gone for three days", or a relay that omits the field would empty the list.
|
|
414
|
+
*/
|
|
415
|
+
const isArchived = (machine) => {
|
|
416
|
+
const raw = machine.last_seen;
|
|
417
|
+
const at = typeof raw === 'number' ? raw : Date.parse(String(raw ?? ''));
|
|
418
|
+
return Number.isFinite(at) && (Date.now() - at) >= ARCHIVE_AFTER_MS;
|
|
419
|
+
};
|
|
420
|
+
const machines = include_stale === true ? allMachines : allMachines.filter((machine) => !isArchived(machine));
|
|
401
421
|
return {
|
|
402
422
|
ok: true,
|
|
403
423
|
error: null,
|
|
@@ -410,6 +430,7 @@ export async function readFleet(deps) {
|
|
|
410
430
|
// Machines the relay still lists but whose lease is not live. Reported so "3 machines" is never
|
|
411
431
|
// mistaken for "3 machines you can use".
|
|
412
432
|
excluded: machines.filter((machine) => !machine.online).length,
|
|
433
|
+
archived: allMachines.length - machines.length,
|
|
413
434
|
};
|
|
414
435
|
}
|
|
415
436
|
|