instar 1.3.828 → 1.3.830

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 (47) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +51 -32
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  5. package/dist/core/PostUpdateMigrator.js +29 -1
  6. package/dist/core/PostUpdateMigrator.js.map +1 -1
  7. package/dist/core/RopeRecoveryProber.d.ts +9 -1
  8. package/dist/core/RopeRecoveryProber.d.ts.map +1 -1
  9. package/dist/core/RopeRecoveryProber.js +4 -4
  10. package/dist/core/RopeRecoveryProber.js.map +1 -1
  11. package/dist/messaging/TelegramAdapter.d.ts +10 -1
  12. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  13. package/dist/messaging/TelegramAdapter.js +6 -4
  14. package/dist/messaging/TelegramAdapter.js.map +1 -1
  15. package/dist/monitoring/MachineCoherenceSentinel.d.ts +49 -0
  16. package/dist/monitoring/MachineCoherenceSentinel.d.ts.map +1 -1
  17. package/dist/monitoring/MachineCoherenceSentinel.js +73 -5
  18. package/dist/monitoring/MachineCoherenceSentinel.js.map +1 -1
  19. package/dist/monitoring/RopeHealthMonitor.d.ts.map +1 -1
  20. package/dist/monitoring/RopeHealthMonitor.js +12 -0
  21. package/dist/monitoring/RopeHealthMonitor.js.map +1 -1
  22. package/dist/monitoring/machineCoherenceAnchors.d.ts +152 -0
  23. package/dist/monitoring/machineCoherenceAnchors.d.ts.map +1 -0
  24. package/dist/monitoring/machineCoherenceAnchors.js +296 -0
  25. package/dist/monitoring/machineCoherenceAnchors.js.map +1 -0
  26. package/dist/monitoring/machineCoherenceEffectsExecutor.d.ts +50 -0
  27. package/dist/monitoring/machineCoherenceEffectsExecutor.d.ts.map +1 -0
  28. package/dist/monitoring/machineCoherenceEffectsExecutor.js +56 -0
  29. package/dist/monitoring/machineCoherenceEffectsExecutor.js.map +1 -0
  30. package/dist/monitoring/machineCoherenceEpisode.d.ts +30 -0
  31. package/dist/monitoring/machineCoherenceEpisode.d.ts.map +1 -1
  32. package/dist/monitoring/machineCoherenceEpisode.js.map +1 -1
  33. package/dist/monitoring/machineCoherenceEpisodeManager.d.ts +65 -3
  34. package/dist/monitoring/machineCoherenceEpisodeManager.d.ts.map +1 -1
  35. package/dist/monitoring/machineCoherenceEpisodeManager.js +275 -15
  36. package/dist/monitoring/machineCoherenceEpisodeManager.js.map +1 -1
  37. package/dist/monitoring/ropeSinkRouter.d.ts +60 -0
  38. package/dist/monitoring/ropeSinkRouter.d.ts.map +1 -0
  39. package/dist/monitoring/ropeSinkRouter.js +66 -0
  40. package/dist/monitoring/ropeSinkRouter.js.map +1 -0
  41. package/dist/scaffold/templates.js +2 -2
  42. package/package.json +1 -1
  43. package/src/data/builtin-manifest.json +19 -19
  44. package/src/scaffold/templates.ts +2 -2
  45. package/upgrades/1.3.829.md +26 -0
  46. package/upgrades/1.3.830.md +16 -0
  47. package/upgrades/side-effects/calm-transient-episode-alerting.md +57 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyDH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAU3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AA0BjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA6H7D,OAAO,KAAK,EAAW,oBAAoB,EAAe,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAgFtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,EAA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,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,GACP,IAAI,CAssBN;AAgmBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoznBtE;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"}
@@ -5118,6 +5118,7 @@ export async function startServer(options) {
5118
5118
  if (probeEnabled && meshEnabled()) {
5119
5119
  const { RopeRecoveryProber } = await import('../core/RopeRecoveryProber.js');
5120
5120
  const { buildRopeProbeCommand, parseProbeResponse } = await import('../core/ropeProbeContract.js');
5121
+ const ropeSinkMod = await import('../monitoring/ropeSinkRouter.js');
5121
5122
  const probeClientMod = await import('../core/MeshRpcClient.js');
5122
5123
  const { getFeatureMetricsRecorder } = await import('../core/CircuitBreakingIntelligenceProvider.js');
5123
5124
  let probeNonce = 0;
@@ -5192,14 +5193,44 @@ export async function startServer(options) {
5192
5193
  };
5193
5194
  }
5194
5195
  },
5195
- raiseAttention: (item) => telegram?.createAttentionItem({
5196
- id: item.id,
5197
- title: item.title,
5198
- summary: item.body.slice(0, 160),
5199
- description: item.body,
5200
- category: 'rope-recovery-probe',
5201
- priority: 'NORMAL',
5202
- sourceContext: 'rope-recovery-probe',
5196
+ // calm-alerting M-P3: the typed-class sink router (extracted,
5197
+ // unit-tested module — src/monitoring/ropeSinkRouter.ts). Routes
5198
+ // on the SOURCE-DECLARED class; demotes informational content
5199
+ // only under the LIVE delivery-true conjunction; both-class
5200
+ // (peer,kind) 24 h dedupe with visible count appends.
5201
+ raiseAttention: ropeSinkMod.makeRopeSinkRouter({
5202
+ telegram: () => telegram ?? null,
5203
+ digestConfigured: () => {
5204
+ const rhCfg = config.monitoring?.ropeHealth;
5205
+ return rhCfg?.enabled !== false && typeof rhCfg?.digestTopicId === 'number';
5206
+ },
5207
+ digestRunnableHere: () => {
5208
+ // A live JobScheduler handle in THIS process with the digest
5209
+ // job loaded + enabled — the lease read is NOT the conjunct
5210
+ // (a promoted standby holds the lease with no scheduler).
5211
+ try {
5212
+ return !!scheduler && scheduler.getJobs().some((j) => j.slug === 'rope-health-digest' && j.enabled !== false);
5213
+ }
5214
+ catch {
5215
+ return false;
5216
+ }
5217
+ },
5218
+ selfNickname: () => {
5219
+ try {
5220
+ return machinePoolRegistry?.getCapacities().find((c) => c.machineId === selfMachineId)?.nickname ?? 'this machine';
5221
+ }
5222
+ catch {
5223
+ return 'this machine';
5224
+ }
5225
+ },
5226
+ audit: (row) => {
5227
+ try {
5228
+ const p = path.join(config.stateDir, '..', 'logs', 'sentinel-events.jsonl');
5229
+ fs.mkdirSync(path.dirname(p), { recursive: true });
5230
+ fs.appendFileSync(p, JSON.stringify(row) + '\n');
5231
+ }
5232
+ catch { /* @silent-fallback-ok: audit is observability, never authority */ }
5233
+ },
5203
5234
  }),
5204
5235
  recordMetric: (event) => {
5205
5236
  try {
@@ -21301,9 +21332,17 @@ export async function startServer(options) {
21301
21332
  // strict no-op inside tick(). MUTATES NOTHING. Own try/catch: a wiring
21302
21333
  // failure is logged non-fatal and the server runs without the evaluator.
21303
21334
  let machineCoherenceSentinel = null;
21335
+ let runMachineCoherenceEffects = null;
21304
21336
  try {
21305
21337
  const mcMod = await import('../monitoring/MachineCoherenceSentinel.js');
21338
+ const effMod = await import('../monitoring/machineCoherenceEffectsExecutor.js');
21339
+ runMachineCoherenceEffects = effMod.executeMachineCoherenceEffects;
21306
21340
  const mcCfg = mcMod.resolveMachineCoherenceConfig(config);
21341
+ // calm-alerting M-P1 config invariant (warn-only): the progress window
21342
+ // must exceed the restart-cascade dampener window with margin.
21343
+ const sanityMsg = mcMod.checkCalmAlertingConfigSanity(config, mcCfg);
21344
+ if (sanityMsg)
21345
+ console.warn(pc.yellow(` ⚠ ${sanityMsg}`));
21307
21346
  if (mcCfg.enabled) {
21308
21347
  machineCoherenceSentinel = new mcMod.MachineCoherenceSentinel({
21309
21348
  listCapacities: () => machinePoolRegistry?.getCapacities() ?? [],
@@ -21344,6 +21383,9 @@ export async function startServer(options) {
21344
21383
  // Telegram fault never crashes the shared presence tick (fail toward
21345
21384
  // silence). Defined OUTSIDE the tick body so the tick stays lean; the
21346
21385
  // sentinel already gates effects to raiser && live posture.
21386
+ // calm-alerting M-P2: extracted to the injectable, unit-tested
21387
+ // machineCoherenceEffectsExecutor module (the pass-through fix for the
21388
+ // original hardcoded-HIGH bug lives there); this thin shim only drains.
21347
21389
  const executeMachineCoherenceEffects = (sentinel, tg) => {
21348
21390
  let effects;
21349
21391
  try {
@@ -21352,30 +21394,7 @@ export async function startServer(options) {
21352
21394
  catch {
21353
21395
  return;
21354
21396
  }
21355
- for (const eff of effects) {
21356
- void (async () => {
21357
- try {
21358
- if (eff.kind === 'raise') {
21359
- await tg?.createAttentionItem({
21360
- id: eff.itemId, title: eff.title, summary: eff.summary, description: eff.description,
21361
- category: 'machine-coherence', priority: 'HIGH', sourceContext: 'machine-coherence-guard',
21362
- });
21363
- }
21364
- else if (eff.kind === 'append') {
21365
- const item = tg?.getAttentionItem(eff.itemId);
21366
- if (item?.topicId !== undefined)
21367
- await tg?.sendToTopic(item.topicId, eff.text);
21368
- }
21369
- else if (eff.kind === 'resolve') {
21370
- const item = tg?.getAttentionItem(eff.itemId);
21371
- if (item?.topicId !== undefined)
21372
- await tg?.sendToTopic(item.topicId, eff.note);
21373
- await tg?.updateAttentionStatus(eff.itemId, 'DONE');
21374
- }
21375
- }
21376
- catch { /* @silent-fallback-ok: episode effect execution is best-effort; a Telegram send/create fault must never crash the presence tick — the next reconcile re-derives from durable episode state */ }
21377
- })();
21378
- }
21397
+ runMachineCoherenceEffects?.(effects, { telegram: () => tg ?? null });
21379
21398
  };
21380
21399
  const peerPresenceTick = () => {
21381
21400
  void peerPresencePuller.pullOnce();