instar 0.24.1 → 0.24.3

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 (60) hide show
  1. package/.claude/hooks/auto-approve-claude-edits.py +72 -0
  2. package/dist/cli.js +0 -0
  3. package/dist/commands/init.d.ts.map +1 -1
  4. package/dist/commands/init.js +95 -4
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/commands/server.d.ts.map +1 -1
  7. package/dist/commands/server.js +35 -5
  8. package/dist/commands/server.js.map +1 -1
  9. package/dist/commands/setup.d.ts.map +1 -1
  10. package/dist/commands/setup.js +23 -10
  11. package/dist/commands/setup.js.map +1 -1
  12. package/dist/core/PostUpdateMigrator.d.ts +27 -0
  13. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  14. package/dist/core/PostUpdateMigrator.js +420 -0
  15. package/dist/core/PostUpdateMigrator.js.map +1 -1
  16. package/dist/core/ResponseReviewGate.d.ts +182 -0
  17. package/dist/core/ResponseReviewGate.d.ts.map +1 -0
  18. package/dist/core/ResponseReviewGate.js +956 -0
  19. package/dist/core/ResponseReviewGate.js.map +1 -0
  20. package/dist/core/SessionManager.d.ts +9 -0
  21. package/dist/core/SessionManager.d.ts.map +1 -1
  22. package/dist/core/SessionManager.js +39 -0
  23. package/dist/core/SessionManager.js.map +1 -1
  24. package/dist/core/StateManager.d.ts +1 -0
  25. package/dist/core/StateManager.d.ts.map +1 -1
  26. package/dist/core/StateManager.js +14 -0
  27. package/dist/core/StateManager.js.map +1 -1
  28. package/dist/core/TopicResumeMap.d.ts +4 -3
  29. package/dist/core/TopicResumeMap.d.ts.map +1 -1
  30. package/dist/core/TopicResumeMap.js +7 -8
  31. package/dist/core/TopicResumeMap.js.map +1 -1
  32. package/dist/data/http-hook-templates.d.ts +19 -19
  33. package/dist/data/http-hook-templates.d.ts.map +1 -1
  34. package/dist/data/http-hook-templates.js +28 -118
  35. package/dist/data/http-hook-templates.js.map +1 -1
  36. package/dist/lifeline/ServerSupervisor.d.ts +1 -0
  37. package/dist/lifeline/ServerSupervisor.d.ts.map +1 -1
  38. package/dist/lifeline/ServerSupervisor.js +22 -0
  39. package/dist/lifeline/ServerSupervisor.js.map +1 -1
  40. package/dist/lifeline/TelegramLifeline.d.ts +3 -5
  41. package/dist/lifeline/TelegramLifeline.d.ts.map +1 -1
  42. package/dist/lifeline/TelegramLifeline.js +15 -18
  43. package/dist/lifeline/TelegramLifeline.js.map +1 -1
  44. package/dist/monitoring/StallTriageNurse.js +1 -1
  45. package/dist/monitoring/StallTriageNurse.js.map +1 -1
  46. package/dist/monitoring/StallTriageNurse.types.d.ts +3 -1
  47. package/dist/monitoring/StallTriageNurse.types.d.ts.map +1 -1
  48. package/dist/monitoring/TriageOrchestrator.js +1 -1
  49. package/dist/monitoring/TriageOrchestrator.js.map +1 -1
  50. package/dist/server/routes.d.ts.map +1 -1
  51. package/dist/server/routes.js +8 -4
  52. package/dist/server/routes.js.map +1 -1
  53. package/package.json +1 -1
  54. package/src/data/builtin-manifest.json +62 -62
  55. package/src/data/http-hook-templates.ts +34 -126
  56. package/upgrades/0.24.0.md +41 -0
  57. package/upgrades/0.24.1.md +16 -25
  58. package/upgrades/0.24.2.md +13 -0
  59. package/upgrades/0.24.3.md +25 -0
  60. package/upgrades/NEXT.md +35 -0
@@ -441,7 +441,7 @@ async function spawnSessionForTopic(sessionManager, telegram, sessionName, topic
441
441
  // Proactive UUID save — schedule discovery after spawn.
442
442
  // Prefer authoritative claudeSessionId from hook events (populated within seconds).
443
443
  // Falls back to mtime-based JSONL scan only when there's no ambiguity.
444
- if (_topicResumeMap && !resumeSessionId) {
444
+ if (_topicResumeMap) {
445
445
  setTimeout(() => {
446
446
  try {
447
447
  // Check if hook events have already populated the authoritative UUID
@@ -464,7 +464,7 @@ async function spawnSessionForTopic(sessionManager, telegram, sessionName, topic
464
464
  * Respawn a session for a topic, including thread history in the bootstrap.
465
465
  * This prevents "thread drift" where respawned sessions lose context.
466
466
  */
467
- async function respawnSessionForTopic(sessionManager, telegram, targetSession, topicId, latestMessage, topicMemory, userProfile, recoveryPrompt) {
467
+ async function respawnSessionForTopic(sessionManager, telegram, targetSession, topicId, latestMessage, topicMemory, userProfile, recoveryPrompt, options) {
468
468
  console.log(`[telegram→session] Session "${targetSession}" needs respawn for topic ${topicId}`);
469
469
  // Save the old session's Claude UUID before respawning so --resume can reattach context
470
470
  if (_topicResumeMap) {
@@ -490,7 +490,9 @@ async function respawnSessionForTopic(sessionManager, telegram, targetSession, t
490
490
  : latestMessage;
491
491
  const newSessionName = await spawnSessionForTopic(sessionManager, telegram, topicName, topicId, effectiveMessage, topicMemory, userProfile);
492
492
  telegram.registerTopicSession(topicId, newSessionName, topicName);
493
- await telegram.sendToTopic(topicId, `Session respawned.`);
493
+ if (!options?.silent) {
494
+ await telegram.sendToTopic(topicId, `Session respawned.`);
495
+ }
494
496
  console.log(`[telegram→session] Respawned "${newSessionName}" for topic ${topicId}`);
495
497
  }
496
498
  /**
@@ -2351,7 +2353,7 @@ export async function startServer(options) {
2351
2353
  }));
2352
2354
  },
2353
2355
  sendToTopic: (topicId, text) => telegram.sendToTopic(topicId, text),
2354
- respawnSession: (name, topicId) => respawnSessionForTopic(sessionManager, telegram, name, topicId, undefined, topicMemory),
2356
+ respawnSession: (name, topicId, options) => respawnSessionForTopic(sessionManager, telegram, name, topicId, undefined, topicMemory, undefined, undefined, options),
2355
2357
  clearStallForTopic: (topicId) => telegram.clearStallTracking(topicId),
2356
2358
  }, {
2357
2359
  config: config.monitoring.triage,
@@ -2382,7 +2384,7 @@ export async function startServer(options) {
2382
2384
  }));
2383
2385
  },
2384
2386
  sendToTopic: (topicId, text) => telegram.sendToTopic(topicId, text),
2385
- respawnSession: (name, topicId) => respawnSessionForTopic(sessionManager, telegram, name, topicId, undefined, topicMemory),
2387
+ respawnSession: (name, topicId, options) => respawnSessionForTopic(sessionManager, telegram, name, topicId, undefined, topicMemory, undefined, undefined, options),
2386
2388
  clearStallForTopic: (topicId) => telegram.clearStallTracking(topicId),
2387
2389
  spawnTriageSession: (name, options) => sessionManager.spawnTriageSession(name, options),
2388
2390
  getTriageSessionUuid: (sessionName) => {
@@ -3629,6 +3631,34 @@ export async function startServer(options) {
3629
3631
  // Graceful shutdown
3630
3632
  const shutdown = async () => {
3631
3633
  console.log('\nShutting down...');
3634
+ // Save resume UUIDs for ALL active topic-linked sessions before exit.
3635
+ // Without this, server restarts lose all resume mappings because:
3636
+ // 1. Resume entries are consumed (removed) on spawn
3637
+ // 2. Proactive save may not have run yet
3638
+ // 3. beforeSessionKill doesn't fire for bulk process exit
3639
+ if (_topicResumeMap && telegram) {
3640
+ try {
3641
+ const runningSessions = sessionManager.listRunningSessions();
3642
+ const topicSessions = telegram.getAllTopicSessions?.();
3643
+ if (topicSessions) {
3644
+ let saved = 0;
3645
+ for (const [topicId, sessionName] of topicSessions) {
3646
+ const session = runningSessions.find(s => s.tmuxSession === sessionName);
3647
+ const uuid = _topicResumeMap.findUuidForSession(sessionName, session?.claudeSessionId ?? undefined);
3648
+ if (uuid) {
3649
+ _topicResumeMap.save(topicId, uuid, sessionName);
3650
+ saved++;
3651
+ }
3652
+ }
3653
+ if (saved > 0) {
3654
+ console.log(`[shutdown] Saved ${saved} resume UUID(s) for active sessions`);
3655
+ }
3656
+ }
3657
+ }
3658
+ catch (err) {
3659
+ console.error('[shutdown] Failed to save resume UUIDs:', err);
3660
+ }
3661
+ }
3632
3662
  gitSync?.stop();
3633
3663
  coordinator.stop();
3634
3664
  coherenceMonitor.stop();