instar 1.3.799 → 1.3.801

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 (84) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +76 -3
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/BackupManager.d.ts.map +1 -1
  5. package/dist/core/BackupManager.js +8 -0
  6. package/dist/core/BackupManager.js.map +1 -1
  7. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  8. package/dist/core/PostUpdateMigrator.js +50 -2
  9. package/dist/core/PostUpdateMigrator.js.map +1 -1
  10. package/dist/core/ProactiveSwapMonitor.d.ts +10 -0
  11. package/dist/core/ProactiveSwapMonitor.d.ts.map +1 -1
  12. package/dist/core/ProactiveSwapMonitor.js +39 -0
  13. package/dist/core/ProactiveSwapMonitor.js.map +1 -1
  14. package/dist/core/SessionManager.d.ts +5 -0
  15. package/dist/core/SessionManager.d.ts.map +1 -1
  16. package/dist/core/SessionManager.js +28 -0
  17. package/dist/core/SessionManager.js.map +1 -1
  18. package/dist/core/machineCoherenceManifest.d.ts +10 -0
  19. package/dist/core/machineCoherenceManifest.d.ts.map +1 -1
  20. package/dist/core/machineCoherenceManifest.js +58 -0
  21. package/dist/core/machineCoherenceManifest.js.map +1 -1
  22. package/dist/core/types.d.ts +31 -0
  23. package/dist/core/types.d.ts.map +1 -1
  24. package/dist/core/types.js.map +1 -1
  25. package/dist/messaging/TelegramAdapter.d.ts +37 -0
  26. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  27. package/dist/messaging/TelegramAdapter.js +108 -0
  28. package/dist/messaging/TelegramAdapter.js.map +1 -1
  29. package/dist/monitoring/ExternalHogScanTick.d.ts +9 -0
  30. package/dist/monitoring/ExternalHogScanTick.d.ts.map +1 -1
  31. package/dist/monitoring/ExternalHogScanTick.js +29 -0
  32. package/dist/monitoring/ExternalHogScanTick.js.map +1 -1
  33. package/dist/monitoring/PromiseBeacon.d.ts +6 -0
  34. package/dist/monitoring/PromiseBeacon.d.ts.map +1 -1
  35. package/dist/monitoring/PromiseBeacon.js +42 -6
  36. package/dist/monitoring/PromiseBeacon.js.map +1 -1
  37. package/dist/monitoring/guardManifest.d.ts.map +1 -1
  38. package/dist/monitoring/guardManifest.js +31 -0
  39. package/dist/monitoring/guardManifest.js.map +1 -1
  40. package/dist/monitoring/guardPosture.d.ts.map +1 -1
  41. package/dist/monitoring/guardPosture.js +22 -0
  42. package/dist/monitoring/guardPosture.js.map +1 -1
  43. package/dist/monitoring/selfaction/anchor.d.ts +82 -0
  44. package/dist/monitoring/selfaction/anchor.d.ts.map +1 -0
  45. package/dist/monitoring/selfaction/anchor.js +113 -0
  46. package/dist/monitoring/selfaction/anchor.js.map +1 -0
  47. package/dist/monitoring/selfaction/governor.d.ts +242 -0
  48. package/dist/monitoring/selfaction/governor.d.ts.map +1 -0
  49. package/dist/monitoring/selfaction/governor.js +1475 -0
  50. package/dist/monitoring/selfaction/governor.js.map +1 -0
  51. package/dist/monitoring/selfaction/policies.d.ts +86 -0
  52. package/dist/monitoring/selfaction/policies.d.ts.map +1 -0
  53. package/dist/monitoring/selfaction/policies.js +339 -0
  54. package/dist/monitoring/selfaction/policies.js.map +1 -0
  55. package/dist/monitoring/selfaction/types.d.ts +208 -0
  56. package/dist/monitoring/selfaction/types.d.ts.map +1 -0
  57. package/dist/monitoring/selfaction/types.js +11 -0
  58. package/dist/monitoring/selfaction/types.js.map +1 -0
  59. package/dist/scaffold/templates.d.ts.map +1 -1
  60. package/dist/scaffold/templates.js +7 -0
  61. package/dist/scaffold/templates.js.map +1 -1
  62. package/dist/server/AgentServer.d.ts.map +1 -1
  63. package/dist/server/AgentServer.js +6 -0
  64. package/dist/server/AgentServer.js.map +1 -1
  65. package/dist/server/CapabilityIndex.d.ts.map +1 -1
  66. package/dist/server/CapabilityIndex.js +9 -0
  67. package/dist/server/CapabilityIndex.js.map +1 -1
  68. package/dist/server/routes.d.ts +4 -0
  69. package/dist/server/routes.d.ts.map +1 -1
  70. package/dist/server/routes.js +186 -0
  71. package/dist/server/routes.js.map +1 -1
  72. package/dist/testing/selfActionRegistry.d.ts +16 -0
  73. package/dist/testing/selfActionRegistry.d.ts.map +1 -1
  74. package/dist/testing/selfActionRegistry.js +16 -0
  75. package/dist/testing/selfActionRegistry.js.map +1 -1
  76. package/package.json +2 -2
  77. package/scripts/lint-emit-without-admit.js +303 -0
  78. package/src/data/builtin-manifest.json +66 -66
  79. package/src/data/state-coherence-registry.json +1296 -1241
  80. package/src/scaffold/templates.ts +7 -0
  81. package/upgrades/1.3.800.md +28 -0
  82. package/upgrades/1.3.801.md +38 -0
  83. package/upgrades/side-effects/attention-single-topic-routing.md +123 -0
  84. package/upgrades/side-effects/self-action-governor.md +111 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwDH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAU3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAyBjG,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,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAUT;AAyID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAA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CAAC,CAuzmBtE;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"}
@@ -2815,10 +2815,15 @@ async function ensureAgentAttentionTopic(telegram, state) {
2815
2815
  return;
2816
2816
  }
2817
2817
  try {
2818
- const topic = await telegram.createForumTopic(`${TOPIC_STYLE.ALERT.emoji} Attention`, TOPIC_STYLE.ALERT.color, // Yellow needs user action
2818
+ // find-or-create: on a fresh install an attention item raised BEFORE this
2819
+ // boot path completes may have self-healed the hub already (single-topic
2820
+ // routing) — reuse it by name instead of minting a duplicate.
2821
+ const topic = await telegram.findOrCreateForumTopic(`${TOPIC_STYLE.ALERT.emoji} Attention`, TOPIC_STYLE.ALERT.color, // Yellow — needs user action
2819
2822
  { origin: 'system', bounded: true, label: 'boot-attention' });
2820
2823
  state.set('agent-attention-topic', topic.topicId);
2821
- await telegram.sendToTopic(topic.topicId, `This is your agent's direct line to you — for things that genuinely need your attention.\n\nBlocked tasks, critical errors, memory pressure, quota alerts, and anything where your agent can't proceed without you.`);
2824
+ if (!topic.reused) {
2825
+ await telegram.sendToTopic(topic.topicId, `This is your agent's direct line to you — for things that genuinely need your attention.\n\nBlocked tasks, critical errors, memory pressure, quota alerts, and anything where your agent can't proceed without you.`);
2826
+ }
2822
2827
  console.log(pc.green(` Created Agent Attention topic: ${topic.topicId}`));
2823
2828
  }
2824
2829
  catch (err) {
@@ -6462,6 +6467,9 @@ export async function startServer(options) {
6462
6467
  getFormatMode: () => config
6463
6468
  .telegramFormatMode,
6464
6469
  getLintStrict: () => config.telegramLintStrict,
6470
+ // Single-alerts-topic routing: resolve the boot-created Attention hub
6471
+ // live from state so attention items land there (never per-item topics).
6472
+ getAttentionHubTopicId: () => state.get('agent-attention-topic') ?? null,
6465
6473
  }, config.stateDir);
6466
6474
  console.log(pc.green(` Telegram send-only mode (${isStandbyTelegram ? 'standby' : lifelineOwnsPolling ? 'lifeline owns polling (lease detected)' : 'lifeline owns polling'})`));
6467
6475
  // Resolve any topic names still using the fallback "topic-NNNN" pattern
@@ -6541,6 +6549,9 @@ export async function startServer(options) {
6541
6549
  getFormatMode: () => config
6542
6550
  .telegramFormatMode,
6543
6551
  getLintStrict: () => config.telegramLintStrict,
6552
+ // Single-alerts-topic routing: resolve the boot-created Attention hub
6553
+ // live from state so attention items land there (never per-item topics).
6554
+ getAttentionHubTopicId: () => state.get('agent-attention-topic') ?? null,
6544
6555
  }, config.stateDir);
6545
6556
  telegram.intelligence = sharedIntelligence ?? null;
6546
6557
  await telegram.start();
@@ -16734,6 +16745,60 @@ export async function startServer(options) {
16734
16745
  });
16735
16746
  }
16736
16747
  // ── OrphanedWorkSentinel (the silent-uncommitted-death backstop) ──────────
16748
+ // ── SelfActionGovernor (unified-self-action-backpressure Increment B) ──
16749
+ // ONE in-process admission chokepoint every registered self-triggered
16750
+ // action rides (age-kill, external-hog kill, proactive swap, beacon
16751
+ // notify/liveness). Ships OBSERVE-ONLY on every class, fleet-wide (FD1):
16752
+ // admit() records would-deny verdicts and always allows; the per-class
16753
+ // enforce flip is the operator's later action. INIT-ONCE process-global
16754
+ // anchor; emergencyDisable is read LIVE (PATCH /config applies with no
16755
+ // restart). Construction is guarded — a failure leaves the module-level
16756
+ // governor uninitialized (disabled-passthrough admits), never a dead boot.
16757
+ let _selfActionGovernor;
16758
+ try {
16759
+ const { initSelfActionGovernor } = await import('../monitoring/selfaction/governor.js');
16760
+ _selfActionGovernor = initSelfActionGovernor({
16761
+ stateDir: config.stateDir,
16762
+ readEmergencyDisable: () => liveConfig.get('intelligence.selfActionGovernor.emergencyDisable', config.intelligence?.selfActionGovernor?.emergencyDisable ?? false) === true,
16763
+ readClassesConfig: () => liveConfig.get('intelligence.selfActionGovernor.classes', (config.intelligence?.selfActionGovernor?.classes ?? undefined)),
16764
+ // Census discipline (spec SC6-1): governor-owned, sampled OFF the hot
16765
+ // path (the governor's own slow tick), INDEPENDENT of any governed
16766
+ // controller's candidate enumeration — the STATE-store read, never the
16767
+ // reaper's own listRunningSessions.
16768
+ readCensus: () => ({
16769
+ value: state.listSessions({ status: 'running' }).length,
16770
+ asOf: Date.now(),
16771
+ confidence: 'high',
16772
+ }),
16773
+ configuredSessionCap: () => config.sessions?.maxSessions,
16774
+ // FD9 level gate input: the REGISTERED machine count (not online peers).
16775
+ registeredMachineCount: () => Math.max(1, machinePoolRegistry?.getCapacities().length ?? 1),
16776
+ emitAttention: (item) => {
16777
+ void telegram?.createAttentionItem({
16778
+ id: item.id,
16779
+ title: item.title,
16780
+ summary: item.body.slice(0, 160),
16781
+ description: item.body,
16782
+ category: 'self-action-governor',
16783
+ priority: item.priority,
16784
+ sourceContext: item.sourceContext,
16785
+ });
16786
+ },
16787
+ });
16788
+ guardRegistry.register('intelligence.selfActionGovernor.enabled', () => _selfActionGovernor.guardRuntimeStatus());
16789
+ console.log(pc.dim(' SelfActionGovernor initialized (observe-only — unified self-action backpressure)'));
16790
+ }
16791
+ catch (err) {
16792
+ console.error('[self-action-governor] init failed (admits pass through this boot):', err instanceof Error ? err.message : String(err));
16793
+ _selfActionGovernor = undefined;
16794
+ DegradationReporter.getInstance().report({
16795
+ feature: 'SelfActionGovernor',
16796
+ primary: 'self-action admission chokepoint (observe-only would-deny measurement)',
16797
+ fallback: 'governor uninitialized for this boot — every admit resolves disabled-passthrough (allow)',
16798
+ reason: `init failed: ${err instanceof Error ? err.message : String(err)}`,
16799
+ impact: 'Self-action would-deny telemetry is not collected this boot; the retrofitted emit paths behave exactly as before (observe mode never blocks anyway).',
16800
+ });
16801
+ }
16737
16802
  // Detects agent worktrees with uncommitted work whose owning session is dead
16738
16803
  // + settled, records them durably, and raises ONE deduped agent-health notice
16739
16804
  // — the case the PromiseBeacon escalation ladder can't see (nothing registered
@@ -17495,7 +17560,15 @@ export async function startServer(options) {
17495
17560
  ...(() => {
17496
17561
  try {
17497
17562
  return {
17498
- coherenceAdvert: buildCoherenceAdvert({ boot: config, liveGet: (path, fallback) => liveConfig.get(path, fallback) }, { instarVersion: ProcessIntegrity.getInstance()?.runningVersion ?? 'unknown', beatSeq: _coherenceBeatSeq++ }),
17563
+ coherenceAdvert: buildCoherenceAdvert({
17564
+ boot: config,
17565
+ liveGet: (path, fallback) => liveConfig.get(path, fallback),
17566
+ // unified-self-action-backpressure INT7-1: the mode
17567
+ // rows read `demoted` from governor RUNTIME state —
17568
+ // a config-only read would advertise `enforce` on a
17569
+ // runtime-demoted machine and defeat the skew alarm.
17570
+ governorClassMode: (controllerId) => _selfActionGovernor?.getClassMode(controllerId) ?? 'observe',
17571
+ }, { instarVersion: ProcessIntegrity.getInstance()?.runningVersion ?? 'unknown', beatSeq: _coherenceBeatSeq++ }),
17499
17572
  };
17500
17573
  }
17501
17574
  catch {