instar 1.3.590 → 1.3.592

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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AE,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,CAupdtE;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"}
@@ -9173,6 +9173,24 @@ export async function startServer(options) {
9173
9173
  if (subscriptionPool.size() > 0) {
9174
9174
  console.log(pc.green(` Subscription pool: ${subscriptionPool.size()} account(s) registered`));
9175
9175
  }
9176
+ // POOL-AWARE QUOTA THROTTLE wiring (docs/specs/POOL-AWARE-QUOTA-THROTTLE-SPEC.md):
9177
+ // give the global quota brake the SAME placeability predicate the placement layer
9178
+ // (selectAccount) uses, reading the LIVE SubscriptionPool. Effect: the brake never
9179
+ // stops the whole agent while a placeable account has headroom (the 2026-06-15
9180
+ // "one maxed account stalls everything while reserves sit idle" bug), and never
9181
+ // allows work placement can't land (the 90–95% respawn-loop band — selectAccount's
9182
+ // soft threshold is stricter than the shutdown threshold). Only for a genuine pool
9183
+ // (>1 account); a solo agent keeps the legacy single-account gating untouched.
9184
+ if (quotaTracker && subscriptionPool.size() > 1) {
9185
+ const { poolHeadroom } = await import('../core/QuotaAwareScheduler.js');
9186
+ // poolHeadroom shares placement's exact eligibility predicate, so a throttle
9187
+ // "allow" always corresponds to a placeable account, AND it gates on the
9188
+ // MOST-HEADROOM account (not the use-it-or-lose-it drain-first winner) — so
9189
+ // non-critical work runs whenever ANY account has room, while placement still
9190
+ // drains the soonest-to-reset account. Clamps + degraded signal are built in.
9191
+ quotaTracker.setPoolQuotaProvider(() => poolHeadroom(subscriptionPool.list(), { nowMs: Date.now() }));
9192
+ console.log(pc.green(' Pool-aware quota throttle: wired (placement-shared eligibility, most-headroom gating)'));
9193
+ }
9176
9194
  // ── Live credential re-pointing — census consumer re-routing (WS5.2 Step 6) ──
9177
9195
  // The CredentialLocationLedger is the machine-local source of truth for "which account is in
9178
9196
  // which config-home slot" once re-pointing is enabled. The CredentialLocationGate re-routes
@@ -14127,23 +14145,32 @@ export async function startServer(options) {
14127
14145
  // resolves the right owner on the next message — the step the in-memory store
14128
14146
  // never had. Off the hot path: ticked on an interval + once at boot (to adopt
14129
14147
  // a transfer that landed while we were down). Only when the durable store is
14130
- // active (dev-gate); InMemory has no cross-machine replication to apply.
14131
- if (durableOwnershipStore && _meshSelfId) {
14132
- const { OwnershipApplier } = await import('../core/OwnershipApplier.js');
14133
- const { CoherenceJournalReader } = await import('../core/CoherenceJournalReader.js');
14134
- const applier = new OwnershipApplier({
14135
- reader: new CoherenceJournalReader({ stateDir: config.stateDir }),
14136
- store: durableOwnershipStore,
14137
- selfMachineId: _meshSelfId,
14138
- logger: (m) => console.log(pc.dim(` ${m}`)),
14139
- });
14148
+ // active; InMemory has no cross-machine replication to apply.
14149
+ //
14150
+ // Construction is gated on the durable store ALONE — NOT on `_meshSelfId`. The
14151
+ // old `&& _meshSelfId` guard ran here, ~650 lines before `_meshSelfId` is assigned
14152
+ // in the boot sequence, so it was always null at this point and the applier was
14153
+ // never wired (the boot-ordering bug the live test caught). `selfMachineId` is now
14154
+ // a late-bound getter (label-only; materialization never needs it), so an early
14155
+ // tick is correct and later ticks label SELF/peer once the id resolves. The wiring
14156
+ // factory is extracted + unit-tested so this condition can never silently regress.
14157
+ // Spec: docs/specs/ownership-applier-meshself-ordering-fix.md.
14158
+ const { CoherenceJournalReader } = await import('../core/CoherenceJournalReader.js');
14159
+ const { wireOwnershipApplier } = await import('../core/ownershipApplierWiring.js');
14160
+ const ownershipApplier = wireOwnershipApplier({
14161
+ durableOwnershipStore,
14162
+ reader: new CoherenceJournalReader({ stateDir: config.stateDir }),
14163
+ getSelfMachineId: () => _meshSelfId,
14164
+ logger: (m) => console.log(pc.dim(` ${m}`)),
14165
+ });
14166
+ if (ownershipApplier) {
14140
14167
  try {
14141
- applier.tick();
14168
+ ownershipApplier.tick();
14142
14169
  }
14143
14170
  catch { /* @silent-fallback-ok — boot tick best-effort; the interval converges */ }
14144
14171
  const applierTimer = setInterval(() => {
14145
14172
  try {
14146
- const r = applier.tick();
14173
+ const r = ownershipApplier.tick();
14147
14174
  if (r.materialized)
14148
14175
  console.log(pc.dim(` [OwnershipApplier] materialized ${r.materialized}/${r.examined} topic(s) from replicated placements`));
14149
14176
  }