instar 1.3.101 → 1.3.102

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;AAmSH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAquDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAq1OtE;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;AAmSH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAquDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAu3OtE;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"}
@@ -8464,6 +8464,38 @@ export async function startServer(options) {
8464
8464
  sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
8465
8465
  log: (line) => console.log(pc.dim(` [session-router] ${line}`)),
8466
8466
  });
8467
+ // ── B (HTTP presence transport): pull each peer's self-capacity over
8468
+ // the signed /mesh/rpc channel and record it into the pool registry.
8469
+ // This is the credential-less presence path — a standby that cannot
8470
+ // push a git-synced MachineHeartbeat (no write access to the shared
8471
+ // agent repo) still appears ONLINE to the router purely over its
8472
+ // tunnel. Symmetric: every mesh machine runs one, so each maintains its
8473
+ // own HTTP-sourced view of peer liveness, parallel to (and idempotent
8474
+ // with) the git-synced refreshPool path for credentialed peers.
8475
+ // 'session-status' is a read-class command (RBAC: any registered peer),
8476
+ // so it authenticates off the mutual identity established at pairing —
8477
+ // no router role, no epoch fence required.
8478
+ const presenceMod = await import('../core/PeerPresencePuller.js');
8479
+ const peerPresencePuller = new presenceMod.PeerPresencePuller({
8480
+ selfMachineId: meshSelfId,
8481
+ listPeers: () => meshIdMgr
8482
+ .getActiveMachines()
8483
+ .filter((m) => !m.entry.revokedAt)
8484
+ .map((m) => ({ machineId: m.machineId, url: peerUrl(m.machineId) })),
8485
+ fetchPeerCapacity: async (machineId, url) => {
8486
+ const res = await meshClient.send({ machineId, url }, { type: 'session-status' }, 0);
8487
+ if (res.ok && res.result && typeof res.result === 'object') {
8488
+ return res.result;
8489
+ }
8490
+ return null;
8491
+ },
8492
+ recordHeartbeat: (obs) => { machinePoolRegistry?.recordHeartbeat(obs); },
8493
+ log: (line) => console.log(pc.dim(` [peer-presence] ${line}`)),
8494
+ });
8495
+ void peerPresencePuller.pullOnce();
8496
+ const peerPresenceTimer = setInterval(() => { void peerPresencePuller.pullOnce(); }, 30_000);
8497
+ if (typeof peerPresenceTimer.unref === 'function')
8498
+ peerPresenceTimer.unref();
8467
8499
  _sessionPoolStage = () => {
8468
8500
  try {
8469
8501
  const fallback = (config.multiMachine?.sessionPool ?? {});