instar 1.3.61 → 1.3.62

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.
Files changed (31) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +44 -2
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  5. package/dist/config/ConfigDefaults.js +16 -0
  6. package/dist/config/ConfigDefaults.js.map +1 -1
  7. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  8. package/dist/core/PostUpdateMigrator.js +23 -0
  9. package/dist/core/PostUpdateMigrator.js.map +1 -1
  10. package/dist/core/SessionRefresh.d.ts +10 -0
  11. package/dist/core/SessionRefresh.d.ts.map +1 -1
  12. package/dist/core/SessionRefresh.js +12 -2
  13. package/dist/core/SessionRefresh.js.map +1 -1
  14. package/dist/core/types.d.ts +40 -0
  15. package/dist/core/types.d.ts.map +1 -1
  16. package/dist/core/types.js.map +1 -1
  17. package/dist/monitoring/ContextWedgeSentinel.d.ts +118 -0
  18. package/dist/monitoring/ContextWedgeSentinel.d.ts.map +1 -0
  19. package/dist/monitoring/ContextWedgeSentinel.js +238 -0
  20. package/dist/monitoring/ContextWedgeSentinel.js.map +1 -0
  21. package/dist/monitoring/SentinelNotifier.d.ts +1 -1
  22. package/dist/monitoring/SentinelNotifier.d.ts.map +1 -1
  23. package/dist/monitoring/SentinelNotifier.js.map +1 -1
  24. package/dist/monitoring/sentinelWiring.d.ts +23 -0
  25. package/dist/monitoring/sentinelWiring.d.ts.map +1 -1
  26. package/dist/monitoring/sentinelWiring.js +36 -0
  27. package/dist/monitoring/sentinelWiring.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/data/builtin-manifest.json +18 -18
  30. package/upgrades/1.3.62.md +89 -0
  31. package/upgrades/side-effects/context-wedge-sentinel.md +69 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA+RH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAksDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA0uNtE;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;AA+RH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAksDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6xNtE;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"}
@@ -5178,10 +5178,12 @@ export async function startServer(options) {
5178
5178
  // replace"). undefined when the corresponding sentinel is disabled.
5179
5179
  let socketRecoveryActive;
5180
5180
  let silenceRecoveryActive;
5181
+ let wedgeRecoveryActive;
5181
5182
  {
5182
5183
  const { SocketDisconnectSentinel } = await import('../monitoring/SocketDisconnectSentinel.js');
5183
5184
  const { ActiveWorkSilenceSentinel } = await import('../monitoring/ActiveWorkSilenceSentinel.js');
5184
- const { buildSocketDisconnectDeps, buildActiveWorkSilenceDeps, OutputActivityTracker, } = await import('../monitoring/sentinelWiring.js');
5185
+ const { ContextWedgeSentinel } = await import('../monitoring/ContextWedgeSentinel.js');
5186
+ const { buildSocketDisconnectDeps, buildActiveWorkSilenceDeps, buildContextWedgeDeps, OutputActivityTracker, } = await import('../monitoring/sentinelWiring.js');
5185
5187
  const { SentinelNotifier } = await import('../monitoring/SentinelNotifier.js');
5186
5188
  const sessionSurface = {
5187
5189
  captureOutput: (s, lines) => sessionManager.captureOutput(s, lines),
@@ -5249,6 +5251,45 @@ export async function startServer(options) {
5249
5251
  ? ' ActiveWorkSilenceSentinel enabled (silent-freeze watchdog — Telegram escalation ON, consolidated)'
5250
5252
  : ' ActiveWorkSilenceSentinel enabled (silent-freeze watchdog — logs only, Telegram escalation OFF)'));
5251
5253
  }
5254
+ // ── ContextWedgeSentinel — thinking-block-400 fast-fail wedge ──
5255
+ // Detection + audit ship default-ON (harmless housekeeping). The
5256
+ // destructive fresh-respawn is gated by autoRecovery (default OFF +
5257
+ // dryRun) and rides the Graduated Feature Rollout track. freshRespawn is
5258
+ // late-bound to _sessionRefresh (assigned later in boot) and only invoked
5259
+ // at recovery time; it uses fresh-mode so the new session never --resume-s
5260
+ // the corrupted transcript. Spec: docs/specs/context-wedge-sentinel.md.
5261
+ const wedgeCfg = config.monitoring?.contextWedgeSentinel ?? { enabled: true };
5262
+ if (wedgeCfg.enabled !== false) {
5263
+ const autoRecovery = wedgeCfg.autoRecovery ?? { enabled: false, dryRun: true };
5264
+ const wedgeSentinel = new ContextWedgeSentinel(buildContextWedgeDeps({
5265
+ sessions: sessionSurface,
5266
+ escalate: (name, text) => notifier.escalate('context-wedge', name, text),
5267
+ autoRecovery,
5268
+ freshRespawn: async (name) => {
5269
+ if (!_sessionRefresh)
5270
+ return false;
5271
+ const result = await _sessionRefresh.refreshSession({
5272
+ sessionName: name,
5273
+ fresh: true,
5274
+ reason: 'context-wedge-400',
5275
+ });
5276
+ return result.ok;
5277
+ },
5278
+ }), {
5279
+ enabled: wedgeCfg.enabled,
5280
+ tickIntervalMs: wedgeCfg.tickIntervalMs,
5281
+ confirmWindowMs: wedgeCfg.confirmWindowMs,
5282
+ });
5283
+ wedgeSentinel.on('detected', (e) => notifier.record('detected', 'context-wedge', e.sessionName));
5284
+ wedgeSentinel.on('recovered', (e) => notifier.record('recovered', 'context-wedge', e.sessionName, 'fresh respawn'));
5285
+ wedgeSentinel.on('dry-run', (e) => notifier.record('dry-run', 'context-wedge', e.sessionName, 'would fresh-respawn'));
5286
+ wedgeSentinel.on('false-alarm', (e) => notifier.record('false-alarm', 'context-wedge', e.sessionName, 'signature scrolled out of tail'));
5287
+ wedgeSentinel.on('recovery-error', (e) => notifier.record('recovery-error', 'context-wedge', e.sessionName, e.err instanceof Error ? e.err.message : String(e.err)));
5288
+ wedgeSentinel.start();
5289
+ wedgeRecoveryActive = (s) => wedgeSentinel.isRecoveryActive(s);
5290
+ const mode = autoRecovery.enabled ? (autoRecovery.dryRun ? 'auto-recover dry-run' : 'auto-recover LIVE') : 'detect-only';
5291
+ console.log(pc.green(` ContextWedgeSentinel enabled (thinking-block-400 wedge — ${mode})`));
5292
+ }
5252
5293
  }
5253
5294
  // Recompose the zombie-kill veto to include ALL four recovery sentinels now
5254
5295
  // that socket + silence exist (the interim set above covered only compaction
@@ -5259,7 +5300,8 @@ export async function startServer(options) {
5259
5300
  const composedRecoveryActive = (session) => compactionSentinel.isRecoveryActive(session.tmuxSession) ||
5260
5301
  rateLimitSentinel.isRecoveryActive(session.tmuxSession) ||
5261
5302
  (socketRecoveryActive?.(session.tmuxSession) ?? false) ||
5262
- (silenceRecoveryActive?.(session.tmuxSession) ?? false);
5303
+ (silenceRecoveryActive?.(session.tmuxSession) ?? false) ||
5304
+ (wedgeRecoveryActive?.(session.tmuxSession) ?? false);
5263
5305
  sessionManager.setActiveRecoveryChecker(composedRecoveryActive);
5264
5306
  // Trigger 1: PreCompact hook event — report to sentinel.
5265
5307
  hookEventReceiver.on('PreCompact', () => {