instar 1.3.129 → 1.3.130

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;AAwvDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAs+OtE;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;AAwvDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAi/OtE;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"}
@@ -7995,7 +7995,7 @@ export async function startServer(options) {
7995
7995
  // for v1 (advisory; spawn-denial-primary is a tracked follow-up) — and note
7996
7996
  // an over-eager tier can only reap a GENUINELY-idle session sooner, never a
7997
7997
  // working one (the classifier protects working sessions regardless of tier).
7998
- const { SessionReaper, fileAuditSink } = await import('../monitoring/SessionReaper.js');
7998
+ const { SessionReaper, computePressure, reaperAuditSink } = await import('../monitoring/SessionReaper.js');
7999
7999
  const _os = await import('node:os');
8000
8000
  const _resolveTopic = (tmuxSession) => {
8001
8001
  const t = telegram?.getTopicForSession(tmuxSession);
@@ -8069,13 +8069,21 @@ export async function startServer(options) {
8069
8069
  pressure: () => {
8070
8070
  const total = _os.totalmem();
8071
8071
  const freePct = total > 0 ? (_os.freemem() / total) * 100 : 100;
8072
- const tier = freePct < 5 ? 'critical' : freePct < 12 ? 'moderate' : 'normal';
8073
- return { tier, inputs: { freePct: Math.round(freePct * 10) / 10 } };
8072
+ // CPU pressure: 1-min load average ÷ core count. The overall tier is the
8073
+ // WORST of memory and CPU, so a CPU-bound box (the common case) raises
8074
+ // pressure even when free memory is fine. cores unknown ⇒ memory-only.
8075
+ const cores = _os.cpus()?.length ?? 0;
8076
+ const loadPerCore = cores > 0 ? _os.loadavg()[0] / cores : null;
8077
+ const rcfg = config.monitoring?.sessionReaper;
8078
+ return computePressure({ freePct, loadPerCore }, {
8079
+ cpuModerateLoadPerCore: rcfg?.cpuModerateLoadPerCore ?? 1.0,
8080
+ cpuCriticalLoadPerCore: rcfg?.cpuCriticalLoadPerCore ?? 1.5,
8081
+ });
8074
8082
  },
8075
8083
  terminate: (id, reason) => sessionManager.terminateSession(id, reason),
8076
8084
  markReaping: (id) => sessionManager.markReaping(id),
8077
8085
  clearReaping: (id) => sessionManager.clearReaping(id),
8078
- audit: fileAuditSink(config.stateDir),
8086
+ audit: reaperAuditSink(config.stateDir),
8079
8087
  }, config.monitoring?.sessionReaper);
8080
8088
  sessionReaper.start();
8081
8089
  // ── Unkillability backstop (UNIFIED-SESSION-LIFECYCLE §P5) ───────────────