instar 1.3.416 → 1.3.418

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;AAaH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQ3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAuBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAiG7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AA6JtD,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA05BD,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,GAC/F,IAAI,CAyUN;AA2lBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAqjUtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,C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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"}
@@ -25,6 +25,7 @@ import { JobScheduler } from '../scheduler/JobScheduler.js';
25
25
  import { IntegrationGate } from '../scheduler/IntegrationGate.js';
26
26
  import { JobRunHistory } from '../scheduler/JobRunHistory.js';
27
27
  import { AgentServer } from '../server/AgentServer.js';
28
+ import { BootHealthBeacon } from '../server/BootHealthBeacon.js';
28
29
  import { TelegramAdapter, TOPIC_STYLE, selectTopicEmoji } from '../messaging/TelegramAdapter.js';
29
30
  import { getTelegramInboundDir } from '../messaging/shared/telegramInboundFiles.js';
30
31
  import { RelationshipManager } from '../core/RelationshipManager.js';
@@ -2060,6 +2061,29 @@ export async function startServer(options) {
2060
2061
  console.log();
2061
2062
  // Set up file logging for observability
2062
2063
  setupServerLog(config.stateDir);
2064
+ // ── Boot health beacon (topic 21816 root cause #1 — Liveness Before Load) ──
2065
+ // The heavy boot below (TopicMemory/SemanticMemory load + session reconcile)
2066
+ // runs BEFORE AgentServer binds its port, so for minutes nothing answers
2067
+ // /health and the supervisor can mistake a slow boot for a dead process →
2068
+ // the restart loop. This minimal beacon answers /health from the very start
2069
+ // of boot; it is closed at the handoff just before server.start(). Dark by
2070
+ // default (monitoring.bootHealthBeacon.enabled); the grace bump (#979) covers
2071
+ // the window until this is enabled. Belt-and-suspenders, not a boot reorder.
2072
+ let bootBeacon;
2073
+ if (config.monitoring?.bootHealthBeacon?.enabled) {
2074
+ try {
2075
+ bootBeacon = new BootHealthBeacon(config.port);
2076
+ await bootBeacon.start();
2077
+ console.log(pc.dim(' Boot health beacon: answering /health during boot'));
2078
+ }
2079
+ catch (err) {
2080
+ // @silent-fallback-ok — the boot beacon is best-effort liveness; a bind
2081
+ // failure must NEVER block the server boot (the startupGrace bump still
2082
+ // covers the health window). Logged here, not swallowed silently.
2083
+ bootBeacon = undefined;
2084
+ console.error(' Boot health beacon failed to start (non-fatal):', err instanceof Error ? err.message : err);
2085
+ }
2086
+ }
2063
2087
  // ── Shadow installation detection (v0.9.72) ────────────────────────
2064
2088
  // The Luna Incident: a local `npm install instar` created node_modules/
2065
2089
  // in the project directory, shadowing the global binary. AutoUpdater
@@ -11394,6 +11418,18 @@ export async function startServer(options) {
11394
11418
  console.log(pc.yellow(' [tunnel] boot-recovery: relay episode was in flight at last shutdown — rotating credentials before serving'));
11395
11419
  await tunnel.recoverPendingRotation();
11396
11420
  }
11421
+ // Hand off from the boot beacon to the real server: stop() fully releases the
11422
+ // port (force-closes lingering sockets, awaits 'close') BEFORE listen, so the
11423
+ // gap is sub-second and the supervisor never observes a hole. No-op if the
11424
+ // beacon was never started (dark) or already failed.
11425
+ try {
11426
+ await bootBeacon?.stop();
11427
+ }
11428
+ catch (err) {
11429
+ // @silent-fallback-ok — a beacon stop failure must not stop the real server
11430
+ // from binding; logged, and the OS releases the listening socket regardless.
11431
+ console.error(' Boot health beacon stop failed (continuing to bind real server):', err instanceof Error ? err.message : err);
11432
+ }
11397
11433
  await server.start();
11398
11434
  void taskFlowSweeper;
11399
11435
  void taskFlowDueWaker;