instar 1.3.155 → 1.3.157

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;AAoSH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAwvDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAyvPtE;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;AAqSH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAqwDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA0vPtE;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"}
@@ -59,6 +59,7 @@ import { TriageOrchestrator } from '../monitoring/TriageOrchestrator.js';
59
59
  import { SessionMonitor } from '../monitoring/SessionMonitor.js';
60
60
  import { SessionRecovery } from '../monitoring/SessionRecovery.js';
61
61
  import { MultiMachineCoordinator } from '../core/MultiMachineCoordinator.js';
62
+ import { isRemotelyHandled } from '../core/SessionRouter.js';
62
63
  import { resolveAdvertisedMeshUrl, advertiseSelfMeshUrl } from '../core/MeshUrlAdvertiser.js';
63
64
  import { GitSyncManager } from '../core/GitSync.js';
64
65
  import { RegistrySyncDebouncer } from '../core/RegistrySyncDebouncer.js';
@@ -309,6 +310,10 @@ let _topicResumeMap = null;
309
310
  // is byte-identical to today's always-local dispatch. Set once in startServer().
310
311
  let _sessionRouter = null;
311
312
  let _sessionPoolStage = () => 'dark';
313
+ /** This machine's mesh id — lets the inbound dispatch tell a REMOTE placement
314
+ * (forward/spawn on another machine → must NOT also dispatch locally) from a
315
+ * self placement. Set once in startServer()'s mesh block. */
316
+ let _meshSelfId = null;
312
317
  /** Multi-Machine Session Pool §L4: per-topic placement pin store ("move this to <nickname>"). */
313
318
  let _topicPinStore = null;
314
319
  /** Recognize + apply a "move/run this on <nickname>" relocation on inbound; returns handled=true when the message WAS a relocation command (so it must not also be dispatched). */
@@ -1202,11 +1207,20 @@ getHubDeps) {
1202
1207
  payload: text,
1203
1208
  topicMetadata: _topicPinStore?.asTopicMetadata(String(topicId)),
1204
1209
  });
1205
- if (outcome.action === 'forwarded' || outcome.action === 'duplicate') {
1210
+ // Routing-decision observability — the live transfer path is otherwise a black
1211
+ // box (the recognizer logs its pin, but route()'s actual placement/forward
1212
+ // decision was invisible; that hid the bug below from the first live test).
1213
+ console.log(`[session-pool] route topic ${topicId} → action=${outcome.action} owner=${outcome.owner ?? '?'} self=${_meshSelfId ?? '?'}`);
1214
+ // Short-circuit local dispatch whenever the session ended up on ANOTHER machine
1215
+ // (forward/duplicate, OR a fresh remote 'spawned'/'owner-dead-replaced'). Before
1216
+ // this, only 'forwarded'/'duplicate' were caught, so a just-moved topic was
1217
+ // spawned on the target AND injected into the stale local session
1218
+ // (double-dispatch — the bug the first live transfer test surfaced, 2026-05-31).
1219
+ if (isRemotelyHandled(outcome, _meshSelfId)) {
1206
1220
  console.log(`[session-pool] topic ${topicId} handled by owner ${outcome.owner ?? '?'} (${outcome.action}) — not dispatching locally`);
1207
1221
  return;
1208
1222
  }
1209
- // 'handled-locally' / 'spawned'(self) / 'owner-dead-replaced' / 'queued' /
1223
+ // 'handled-locally' / 'spawned'(self) / 'owner-dead-replaced'(self) / 'queued' /
1210
1224
  // 'placement-blocked' → fall through to the existing local dispatch below.
1211
1225
  }
1212
1226
  catch (err) {
@@ -8741,6 +8755,7 @@ export async function startServer(options) {
8741
8755
  now: () => Date.now(),
8742
8756
  });
8743
8757
  const peerUrl = (machineId) => meshIdMgr.getActiveMachines().find((m) => m.machineId === machineId)?.entry.lastKnownUrl ?? null;
8758
+ _meshSelfId = meshSelfId;
8744
8759
  _sessionRouter = new routerMod.SessionRouter({
8745
8760
  selfMachineId: meshSelfId,
8746
8761
  placement: new placeMod.PlacementExecutor(),