instar 1.3.249 → 1.3.251

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.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA2SH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAgxDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAi0QtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA2SH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAgxDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA02QtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -9233,6 +9233,56 @@ export async function startServer(options) {
9233
9233
  const h = coordinator.getSyncStatus().leaseHolder;
9234
9234
  return h && h !== meshSelfId ? peerUrl(h) : null;
9235
9235
  };
9236
+ // ── Self-nickname convergence (§L4, 2026-06-04 live-caught fix) ──
9237
+ // `updateNickname` (PATCH /pool/machines) is local-only, so a rename applied on a
9238
+ // PEER's registry never reaches the owning machine — leaving that machine unable to
9239
+ // resolve its OWN nickname (the laptop's self-entry was nickname=None, so "move it
9240
+ // back to the laptop" silently failed on the very machine that runs the relocation
9241
+ // check). Periodically adopt our own nickname from a peer's authoritative /pool view
9242
+ // and persist it, making getCapacities() SYMMETRIC so the recognizer, the transfer
9243
+ // route, and /pool all resolve self. No-ops once the local nickname is known.
9244
+ const selfNickMod = await import('../core/SelfNicknameResolver.js');
9245
+ const convergeSelfNickname = async () => {
9246
+ try {
9247
+ if (!machinePoolRegistry)
9248
+ return;
9249
+ const localCaps = machinePoolRegistry.getCapacities();
9250
+ if (localCaps.find((c) => c.machineId === meshSelfId)?.nickname?.trim())
9251
+ return; // already known
9252
+ // Collect peers' authoritative /pool views (they carry this machine's nickname).
9253
+ const peerCapacities = [];
9254
+ for (const m of meshIdMgr.getActiveMachines()) {
9255
+ if (m.machineId === meshSelfId)
9256
+ continue;
9257
+ const url = peerUrl(m.machineId);
9258
+ if (!url)
9259
+ continue;
9260
+ try {
9261
+ const r = await fetch(`${url}/pool`, { headers: { Authorization: `Bearer ${config.authToken}` } });
9262
+ if (!r.ok)
9263
+ continue;
9264
+ const j = (await r.json());
9265
+ if (j.machines)
9266
+ peerCapacities.push(j.machines);
9267
+ }
9268
+ catch {
9269
+ /* @silent-fallback-ok — best-effort peer fetch; convergence retries on the timer */
9270
+ }
9271
+ }
9272
+ const resolved = selfNickMod.resolveSelfNickname({ selfMachineId: meshSelfId, localCapacities: localCaps, peerCapacities });
9273
+ if (resolved) {
9274
+ meshIdMgr.updateNickname(meshSelfId, resolved);
9275
+ console.log(pc.green(` [self-nickname] adopted "${resolved}" for ${meshSelfId} from a peer's view (was unset locally)`));
9276
+ }
9277
+ }
9278
+ catch {
9279
+ /* @silent-fallback-ok — convergence is best-effort; never blocks startup */
9280
+ }
9281
+ };
9282
+ void convergeSelfNickname();
9283
+ const selfNickTimer = setInterval(() => { void convergeSelfNickname(); }, 60_000);
9284
+ if (typeof selfNickTimer.unref === 'function')
9285
+ selfNickTimer.unref();
9236
9286
  // This machine participates in the session pool, so a read-only standby may
9237
9287
  // persist the PER-SESSION state of sessions it's handed (the pool's owner-side
9238
9288
  // resume only fires for CAS-confirmed owned sessions, and only past 'dark').