instar 1.3.1087 → 1.3.1089

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 (69) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +60 -30
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/AutonomousSessions.d.ts +2 -0
  5. package/dist/core/AutonomousSessions.d.ts.map +1 -1
  6. package/dist/core/AutonomousSessions.js +3 -0
  7. package/dist/core/AutonomousSessions.js.map +1 -1
  8. package/dist/core/GuardPostureStore.d.ts.map +1 -1
  9. package/dist/core/GuardPostureStore.js +1 -0
  10. package/dist/core/GuardPostureStore.js.map +1 -1
  11. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  12. package/dist/core/PostUpdateMigrator.js +15 -1
  13. package/dist/core/PostUpdateMigrator.js.map +1 -1
  14. package/dist/core/types.d.ts +2 -0
  15. package/dist/core/types.d.ts.map +1 -1
  16. package/dist/core/types.js.map +1 -1
  17. package/dist/data/standards-guard-index.json +1 -1
  18. package/dist/data/standards-guard-index.meta.json +2 -2
  19. package/dist/data/standards-registry.meta.json +1 -1
  20. package/dist/monitoring/AgentWorktreeReaper.d.ts +69 -4
  21. package/dist/monitoring/AgentWorktreeReaper.d.ts.map +1 -1
  22. package/dist/monitoring/AgentWorktreeReaper.js +135 -18
  23. package/dist/monitoring/AgentWorktreeReaper.js.map +1 -1
  24. package/dist/monitoring/AutonomousHeartbeatRunStateStore.d.ts +24 -0
  25. package/dist/monitoring/AutonomousHeartbeatRunStateStore.d.ts.map +1 -0
  26. package/dist/monitoring/AutonomousHeartbeatRunStateStore.js +121 -0
  27. package/dist/monitoring/AutonomousHeartbeatRunStateStore.js.map +1 -0
  28. package/dist/monitoring/AutonomousProgressHeartbeat.d.ts +28 -3
  29. package/dist/monitoring/AutonomousProgressHeartbeat.d.ts.map +1 -1
  30. package/dist/monitoring/AutonomousProgressHeartbeat.js +155 -33
  31. package/dist/monitoring/AutonomousProgressHeartbeat.js.map +1 -1
  32. package/dist/monitoring/GuardRegistry.d.ts +4 -0
  33. package/dist/monitoring/GuardRegistry.d.ts.map +1 -1
  34. package/dist/monitoring/GuardRegistry.js.map +1 -1
  35. package/dist/monitoring/OrphanedWorkSentinel.d.ts +33 -3
  36. package/dist/monitoring/OrphanedWorkSentinel.d.ts.map +1 -1
  37. package/dist/monitoring/OrphanedWorkSentinel.js +90 -9
  38. package/dist/monitoring/OrphanedWorkSentinel.js.map +1 -1
  39. package/dist/monitoring/WorktreeEnumerationFailureStore.d.ts +13 -0
  40. package/dist/monitoring/WorktreeEnumerationFailureStore.d.ts.map +1 -0
  41. package/dist/monitoring/WorktreeEnumerationFailureStore.js +103 -0
  42. package/dist/monitoring/WorktreeEnumerationFailureStore.js.map +1 -0
  43. package/dist/monitoring/agentWorktreeGit.d.ts.map +1 -1
  44. package/dist/monitoring/agentWorktreeGit.js +18 -3
  45. package/dist/monitoring/agentWorktreeGit.js.map +1 -1
  46. package/dist/monitoring/guardManifest.js +2 -2
  47. package/dist/monitoring/guardManifest.js.map +1 -1
  48. package/dist/monitoring/guardPostureView.d.ts +5 -2
  49. package/dist/monitoring/guardPostureView.d.ts.map +1 -1
  50. package/dist/monitoring/guardPostureView.js +17 -2
  51. package/dist/monitoring/guardPostureView.js.map +1 -1
  52. package/dist/monitoring/orphanedWorkGit.d.ts.map +1 -1
  53. package/dist/monitoring/orphanedWorkGit.js.map +1 -1
  54. package/dist/monitoring/worktreeEnumeration.d.ts +63 -0
  55. package/dist/monitoring/worktreeEnumeration.d.ts.map +1 -0
  56. package/dist/monitoring/worktreeEnumeration.js +37 -0
  57. package/dist/monitoring/worktreeEnumeration.js.map +1 -0
  58. package/dist/scaffold/templates.js +2 -2
  59. package/package.json +1 -1
  60. package/src/data/builtin-manifest.json +19 -19
  61. package/src/data/standards-guard-index.json +1 -1
  62. package/src/data/standards-guard-index.meta.json +2 -2
  63. package/src/data/standards-registry.meta.json +1 -1
  64. package/src/data/state-coherence-registry.json +36 -0
  65. package/src/scaffold/templates.ts +2 -2
  66. package/upgrades/1.3.1088.md +37 -0
  67. package/upgrades/1.3.1089.md +34 -0
  68. package/upgrades/side-effects/autonomous-heartbeat-restart-cap.md +136 -0
  69. package/upgrades/side-effects/guard-enumeration-fail-visible.md +78 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8EH,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;AA8H7D,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;AAuID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA+rDD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,oBAAoB,GAAG,IAAI,GACxC;IACD,YAAY,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CA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,13 @@ export async function startServer(options) {
13772
13772
  const ahEnabled = resolveDevAgentGate(ahRawCfg.enabled, config);
13773
13773
  if (ahEnabled && telegram) {
13774
13774
  const { AutonomousProgressHeartbeat } = await import('../monitoring/AutonomousProgressHeartbeat.js');
13775
+ const { AutonomousHeartbeatRunStateStore } = await import('../monitoring/AutonomousHeartbeatRunStateStore.js');
13775
13776
  const { activeAutonomousJobs, autonomousRunRemainingForTopic, readAutonomousRunMarkers, } = await import('../core/AutonomousSessions.js');
13776
13777
  const { ParallelActivityIndex: AHParallelActivityIndex } = await import('../core/ParallelActivityIndex.js');
13777
13778
  // Own ParallelActivityIndex (focus source) — fetched ONCE per tick
13778
13779
  // and indexed by topic inside the deps closure.
13779
13780
  const ahActivityIndex = new AHParallelActivityIndex({ stateDir: config.stateDir });
13781
+ const ahRunStateStore = new AutonomousHeartbeatRunStateStore(path.join(config.stateDir, 'state', 'autonomous-heartbeat.json'));
13780
13782
  const localTelegram2 = telegram;
13781
13783
  const autonomousHeartbeat = new AutonomousProgressHeartbeat({
13782
13784
  listActiveAutonomousRuns: () => {
@@ -13823,6 +13825,24 @@ export async function startServer(options) {
13823
13825
  };
13824
13826
  })(),
13825
13827
  proxyCoordinator,
13828
+ runStateStore: ahRunStateStore,
13829
+ // The spec's rollback/tuning contract is tick-live. The old
13830
+ // constructor-only snapshot meant an operator edit to the
13831
+ // silence threshold was invisible until server restart.
13832
+ getConfig: () => {
13833
+ // Read only this non-secret block. Calling loadConfig here
13834
+ // would re-run binary discovery + secret merge every minute.
13835
+ const disk = JSON.parse(fs.readFileSync(path.join(config.stateDir, 'config.json'), 'utf8'));
13836
+ const live = disk.monitoring?.autonomousHeartbeat ?? {};
13837
+ return {
13838
+ enabled: resolveDevAgentGate(live.enabled, config),
13839
+ dryRun: live.dryRun !== false,
13840
+ silenceThresholdMinutes: live.silenceThresholdMinutes,
13841
+ tickIntervalMs: live.tickIntervalMs,
13842
+ maxHeartbeatsPerRun: live.maxHeartbeatsPerRun,
13843
+ recentOutputChangeWindowMs: live.recentOutputChangeWindowMs,
13844
+ };
13845
+ },
13826
13846
  sendMessage: async (topicId, text, metadata) => {
13827
13847
  const url = `http://localhost:${config.port}/telegram/reply/${topicId}`;
13828
13848
  const response = await fetch(url, {
@@ -17692,15 +17712,21 @@ export async function startServer(options) {
17692
17712
  // disabled. Observability at GET /worktrees/agent-reaper.
17693
17713
  const { AgentWorktreeReaper } = await import('../monitoring/AgentWorktreeReaper.js');
17694
17714
  const { makeAgentWorktreeReaperDeps } = await import('../monitoring/agentWorktreeGit.js');
17715
+ const { WorktreeEnumerationFailureStore } = await import('../monitoring/WorktreeEnumerationFailureStore.js');
17695
17716
  const _agentWorktreesDir = path.join(path.dirname(config.stateDir), '.worktrees');
17696
- const agentWorktreeReaper = new AgentWorktreeReaper(makeAgentWorktreeReaperDeps({
17697
- instarRepo: config.projectDir,
17698
- worktreesDir: _agentWorktreesDir,
17699
- // Multi-commit squash-merge detection via GitHub merged-PR state (default
17700
- // on; fail-safe to cherry-only). Off only if explicitly disabled in config.
17701
- githubMergeCheck: config.monitoring?.agentWorktreeReaper?.githubMergeCheck ?? true,
17702
- }), config.monitoring?.agentWorktreeReaper);
17717
+ const _worktreeEnumerationFailureStore = new WorktreeEnumerationFailureStore(path.join(config.stateDir, 'state', 'worktree-enumeration-failures.json'));
17718
+ const agentWorktreeReaper = new AgentWorktreeReaper({
17719
+ ...makeAgentWorktreeReaperDeps({
17720
+ instarRepo: config.projectDir,
17721
+ worktreesDir: _agentWorktreesDir,
17722
+ // Multi-commit squash-merge detection via GitHub merged-PR state (default
17723
+ // on; fail-safe to cherry-only). Off only if explicitly disabled in config.
17724
+ githubMergeCheck: config.monitoring?.agentWorktreeReaper?.githubMergeCheck ?? true,
17725
+ }),
17726
+ failureHistory: _worktreeEnumerationFailureStore.forGuard('agent-worktree-reaper'),
17727
+ }, config.monitoring?.agentWorktreeReaper);
17703
17728
  agentWorktreeReaper.start();
17729
+ guardRegistry.register('monitoring.agentWorktreeReaper.enabled', () => agentWorktreeReaper.guardStatus());
17704
17730
  if (config.monitoring?.agentWorktreeReaper?.enabled) {
17705
17731
  console.log(pc.green(config.monitoring.agentWorktreeReaper.dryRun === false
17706
17732
  ? ' AgentWorktreeReaper enabled (stale-worktree reclaim — LIVE)'
@@ -17906,30 +17932,34 @@ export async function startServer(options) {
17906
17932
  try {
17907
17933
  const { OrphanedWorkSentinel } = await import('../monitoring/OrphanedWorkSentinel.js');
17908
17934
  const { makeOrphanedWorkSentinelDeps } = await import('../monitoring/orphanedWorkGit.js');
17909
- orphanedWorkSentinel = new OrphanedWorkSentinel(makeOrphanedWorkSentinelDeps({
17910
- instarRepo: config.projectDir,
17911
- worktreesDir: _agentWorktreesDir,
17912
- stateDir: path.join(config.stateDir, 'state'),
17913
- raiseAttention: telegram
17914
- ? (event) => {
17915
- const slug = event.path.split('/').filter(Boolean).pop() ?? 'worktree';
17916
- void telegram.createAttentionItem({
17917
- id: `orphaned-work:${slug}:${event.workSig}`,
17918
- title: `Stranded work in worktree "${slug}"`,
17919
- summary: 'A build/session died with uncommitted changes — revive the worktree to finish, or discard.',
17920
- description: `Worktree ${event.path} (branch ${event.branch ?? 'detached'}) has uncommitted changes ` +
17921
- `but its owning session is gone. The work is still on disk` +
17922
- `${event.preserved ? ' and a preservation patch was written' : ''}. ` +
17923
- `Open the worktree to finish + commit, or discard if no longer needed.`,
17924
- category: 'agent-health',
17925
- priority: 'NORMAL',
17926
- sourceContext: `orphaned-work:${slug}`,
17927
- });
17928
- }
17929
- : () => { },
17930
- now: () => Date.now(),
17931
- }), { ...config.monitoring?.orphanedWorkSentinel, enabled: _orphanedWorkEnabled });
17935
+ orphanedWorkSentinel = new OrphanedWorkSentinel({
17936
+ ...makeOrphanedWorkSentinelDeps({
17937
+ instarRepo: config.projectDir,
17938
+ worktreesDir: _agentWorktreesDir,
17939
+ stateDir: path.join(config.stateDir, 'state'),
17940
+ raiseAttention: telegram
17941
+ ? (event) => {
17942
+ const slug = event.path.split('/').filter(Boolean).pop() ?? 'worktree';
17943
+ void telegram.createAttentionItem({
17944
+ id: `orphaned-work:${slug}:${event.workSig}`,
17945
+ title: `Stranded work in worktree "${slug}"`,
17946
+ summary: 'A build/session died with uncommitted changes revive the worktree to finish, or discard.',
17947
+ description: `Worktree ${event.path} (branch ${event.branch ?? 'detached'}) has uncommitted changes ` +
17948
+ `but its owning session is gone. The work is still on disk` +
17949
+ `${event.preserved ? ' and a preservation patch was written' : ''}. ` +
17950
+ `Open the worktree to finish + commit, or discard if no longer needed.`,
17951
+ category: 'agent-health',
17952
+ priority: 'NORMAL',
17953
+ sourceContext: `orphaned-work:${slug}`,
17954
+ });
17955
+ }
17956
+ : () => { },
17957
+ now: () => Date.now(),
17958
+ }),
17959
+ failureHistory: _worktreeEnumerationFailureStore.forGuard('orphaned-work-sentinel'),
17960
+ }, { ...config.monitoring?.orphanedWorkSentinel, enabled: _orphanedWorkEnabled });
17932
17961
  orphanedWorkSentinel.start();
17962
+ guardRegistry.register('monitoring.orphanedWorkSentinel.enabled', () => orphanedWorkSentinel.guardStatus());
17933
17963
  if (_orphanedWorkEnabled) {
17934
17964
  console.log(pc.green(' OrphanedWorkSentinel enabled (silent-uncommitted-death backstop — signal-only)'));
17935
17965
  }