instar 1.3.827 → 1.3.829

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 (48) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +63 -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 +19 -1
  8. package/dist/core/RopeRecoveryProber.d.ts.map +1 -1
  9. package/dist/core/RopeRecoveryProber.js +19 -4
  10. package/dist/core/RopeRecoveryProber.js.map +1 -1
  11. package/dist/messaging/TelegramAdapter.d.ts +27 -1
  12. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  13. package/dist/messaging/TelegramAdapter.js +39 -8
  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.828.md +24 -0
  46. package/upgrades/1.3.829.md +26 -0
  47. package/upgrades/side-effects/attention-hub-formatting.md +65 -0
  48. 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,EAC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AAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,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;
@@ -5129,6 +5130,18 @@ export async function startServer(options) {
5129
5130
  const probeDryRun = meshCfg?.recoveryProbeDryRun !== false;
5130
5131
  const ropeProber = new RopeRecoveryProber({
5131
5132
  resolver: meshResolver,
5133
+ // Escalation bodies name machines by NICKNAME (rope-health alert
5134
+ // contract), never by raw machine id — resolved from the same
5135
+ // registry the targets come from.
5136
+ nicknameOf: (machineId) => {
5137
+ try {
5138
+ return idMgr.loadRegistry().machines?.[machineId]?.nickname ?? null;
5139
+ }
5140
+ catch {
5141
+ // @silent-fallback-ok — naming is cosmetic; prober falls back to the id.
5142
+ return null;
5143
+ }
5144
+ },
5132
5145
  // The same validated registry view the transport dials: resolve()
5133
5146
  // validates URL shape per kind + the LAN-subnet gate, so the probe
5134
5147
  // can never dial a forbidden host.
@@ -5180,14 +5193,44 @@ export async function startServer(options) {
5180
5193
  };
5181
5194
  }
5182
5195
  },
5183
- raiseAttention: (item) => telegram?.createAttentionItem({
5184
- id: item.id,
5185
- title: item.title,
5186
- summary: item.body.slice(0, 160),
5187
- description: item.body,
5188
- category: 'rope-recovery-probe',
5189
- priority: 'NORMAL',
5190
- 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
+ },
5191
5234
  }),
5192
5235
  recordMetric: (event) => {
5193
5236
  try {
@@ -21289,9 +21332,17 @@ export async function startServer(options) {
21289
21332
  // strict no-op inside tick(). MUTATES NOTHING. Own try/catch: a wiring
21290
21333
  // failure is logged non-fatal and the server runs without the evaluator.
21291
21334
  let machineCoherenceSentinel = null;
21335
+ let runMachineCoherenceEffects = null;
21292
21336
  try {
21293
21337
  const mcMod = await import('../monitoring/MachineCoherenceSentinel.js');
21338
+ const effMod = await import('../monitoring/machineCoherenceEffectsExecutor.js');
21339
+ runMachineCoherenceEffects = effMod.executeMachineCoherenceEffects;
21294
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}`));
21295
21346
  if (mcCfg.enabled) {
21296
21347
  machineCoherenceSentinel = new mcMod.MachineCoherenceSentinel({
21297
21348
  listCapacities: () => machinePoolRegistry?.getCapacities() ?? [],
@@ -21332,6 +21383,9 @@ export async function startServer(options) {
21332
21383
  // Telegram fault never crashes the shared presence tick (fail toward
21333
21384
  // silence). Defined OUTSIDE the tick body so the tick stays lean; the
21334
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.
21335
21389
  const executeMachineCoherenceEffects = (sentinel, tg) => {
21336
21390
  let effects;
21337
21391
  try {
@@ -21340,30 +21394,7 @@ export async function startServer(options) {
21340
21394
  catch {
21341
21395
  return;
21342
21396
  }
21343
- for (const eff of effects) {
21344
- void (async () => {
21345
- try {
21346
- if (eff.kind === 'raise') {
21347
- await tg?.createAttentionItem({
21348
- id: eff.itemId, title: eff.title, summary: eff.summary, description: eff.description,
21349
- category: 'machine-coherence', priority: 'HIGH', sourceContext: 'machine-coherence-guard',
21350
- });
21351
- }
21352
- else if (eff.kind === 'append') {
21353
- const item = tg?.getAttentionItem(eff.itemId);
21354
- if (item?.topicId !== undefined)
21355
- await tg?.sendToTopic(item.topicId, eff.text);
21356
- }
21357
- else if (eff.kind === 'resolve') {
21358
- const item = tg?.getAttentionItem(eff.itemId);
21359
- if (item?.topicId !== undefined)
21360
- await tg?.sendToTopic(item.topicId, eff.note);
21361
- await tg?.updateAttentionStatus(eff.itemId, 'DONE');
21362
- }
21363
- }
21364
- 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 */ }
21365
- })();
21366
- }
21397
+ runMachineCoherenceEffects?.(effects, { telegram: () => tg ?? null });
21367
21398
  };
21368
21399
  const peerPresenceTick = () => {
21369
21400
  void peerPresencePuller.pullOnce();