instar 1.3.589 → 1.3.591

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;AAmCH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAS3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAuBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAkH7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAsBtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAUT;AAyID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAg4CD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,cAAc,EAAE,cAAc,EAC9B,YAAY,CAAC,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,EAKhG,mBAAmB,CAAC,EAAE,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E,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,EAKhG,mBAAmB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,GACpD,IAAI,CA8eN;AA2lBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoodtE;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"}
@@ -13982,7 +13982,19 @@ export async function startServer(options) {
13982
13982
  // swap in the DURABLE per-session store; the OwnershipApplier (wired below)
13983
13983
  // materializes ownership on the target from the REPLICATED placement journal,
13984
13984
  // so a seat genuinely moves. Off → InMemory (today's exact behavior).
13985
- const durableOwnershipOn = resolveDevAgentGate(config.multiMachine?.durableOwnership?.enabled, config);
13985
+ // Pool-consistent activation (docs/specs/pool-consistent-multimachine-activation.md):
13986
+ // gating PURELY on the per-machine dev flag left the durable store DARK on a non-dev
13987
+ // pool machine (the Mini), so a transferred seat's ownership was never materialized
13988
+ // there → the seat died on arrival (caught by the live Laptop↔Mini proof, 2026-06-16).
13989
+ // The durable store MUST run on every machine that CONSUMES replicated placement
13990
+ // journals. So activate ALSO on the explicit, pool-consistent
13991
+ // `coherenceJournal.replication.enabled === true` signal — the SAME one that gates the
13992
+ // journalSyncApplier (~server.ts:16588). Invariant: a machine running the placement-
13993
+ // replication applier runs the ownership applier + durable store too (same placements).
13994
+ // Single-machine agents (no replication) stay on InMemory — strict no-op.
13995
+ const { shouldActivateDurableOwnership, isPlacementReplicationEnabled } = await import('../core/durableOwnershipActivation.js');
13996
+ const _replicationOn = isPlacementReplicationEnabled(config);
13997
+ const durableOwnershipOn = shouldActivateDurableOwnership(config, resolveDevAgentGate);
13986
13998
  let durableOwnershipStore = null;
13987
13999
  let ownershipStore;
13988
14000
  if (durableOwnershipOn) {
@@ -13992,7 +14004,7 @@ export async function startServer(options) {
13992
14004
  logger: (m) => console.log(pc.dim(` ${m}`)),
13993
14005
  });
13994
14006
  ownershipStore = durableOwnershipStore;
13995
- console.log(pc.dim(' [ownership] durable LocalSessionOwnershipStore active (dev-gate live) — transfer-fix §7.2'));
14007
+ console.log(pc.dim(` [ownership] durable LocalSessionOwnershipStore active (${_replicationOn ? 'pool: replication-on' : 'dev-gate'}) — transfer-fix §7.2`));
13996
14008
  }
13997
14009
  else {
13998
14010
  ownershipStore = new ownMod.InMemorySessionOwnershipStore();
@@ -14115,23 +14127,32 @@ export async function startServer(options) {
14115
14127
  // resolves the right owner on the next message — the step the in-memory store
14116
14128
  // never had. Off the hot path: ticked on an interval + once at boot (to adopt
14117
14129
  // a transfer that landed while we were down). Only when the durable store is
14118
- // active (dev-gate); InMemory has no cross-machine replication to apply.
14119
- if (durableOwnershipStore && _meshSelfId) {
14120
- const { OwnershipApplier } = await import('../core/OwnershipApplier.js');
14121
- const { CoherenceJournalReader } = await import('../core/CoherenceJournalReader.js');
14122
- const applier = new OwnershipApplier({
14123
- reader: new CoherenceJournalReader({ stateDir: config.stateDir }),
14124
- store: durableOwnershipStore,
14125
- selfMachineId: _meshSelfId,
14126
- logger: (m) => console.log(pc.dim(` ${m}`)),
14127
- });
14130
+ // active; InMemory has no cross-machine replication to apply.
14131
+ //
14132
+ // Construction is gated on the durable store ALONE — NOT on `_meshSelfId`. The
14133
+ // old `&& _meshSelfId` guard ran here, ~650 lines before `_meshSelfId` is assigned
14134
+ // in the boot sequence, so it was always null at this point and the applier was
14135
+ // never wired (the boot-ordering bug the live test caught). `selfMachineId` is now
14136
+ // a late-bound getter (label-only; materialization never needs it), so an early
14137
+ // tick is correct and later ticks label SELF/peer once the id resolves. The wiring
14138
+ // factory is extracted + unit-tested so this condition can never silently regress.
14139
+ // Spec: docs/specs/ownership-applier-meshself-ordering-fix.md.
14140
+ const { CoherenceJournalReader } = await import('../core/CoherenceJournalReader.js');
14141
+ const { wireOwnershipApplier } = await import('../core/ownershipApplierWiring.js');
14142
+ const ownershipApplier = wireOwnershipApplier({
14143
+ durableOwnershipStore,
14144
+ reader: new CoherenceJournalReader({ stateDir: config.stateDir }),
14145
+ getSelfMachineId: () => _meshSelfId,
14146
+ logger: (m) => console.log(pc.dim(` ${m}`)),
14147
+ });
14148
+ if (ownershipApplier) {
14128
14149
  try {
14129
- applier.tick();
14150
+ ownershipApplier.tick();
14130
14151
  }
14131
14152
  catch { /* @silent-fallback-ok — boot tick best-effort; the interval converges */ }
14132
14153
  const applierTimer = setInterval(() => {
14133
14154
  try {
14134
- const r = applier.tick();
14155
+ const r = ownershipApplier.tick();
14135
14156
  if (r.materialized)
14136
14157
  console.log(pc.dim(` [OwnershipApplier] materialized ${r.materialized}/${r.examined} topic(s) from replicated placements`));
14137
14158
  }