@threadbase-sh/streamer 1.44.3 → 1.44.4

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.
package/dist/index.js CHANGED
@@ -9774,7 +9774,12 @@ function managedToResponse(s, ptyAttached) {
9774
9774
  // the durable registry, so it is a previous run's session with no process
9775
9775
  // behind it — `resumable`, and `historical` rather than `managed`
9776
9776
  // (docs/plans/live-sessions-persistence-plan.md §4, Phase 1).
9777
- lifecycle: ptyAttached ? "attached" : s.rehydrated ? "resumable" : s.failureReason != null ? "failed" : "completed",
9777
+ // A session this run itself put on hold (grace timer, explicit hold_session,
9778
+ // idle reaper) is the other exception: the PTY is gone the same way an exit
9779
+ // leaves it gone, but the conversation is still resumable, not terminal —
9780
+ // `putOnHold` records that by leaving `statusSource: "shutdown"` (the only
9781
+ // place either runner sets it), so it is checked here alongside `rehydrated`.
9782
+ lifecycle: ptyAttached ? "attached" : s.rehydrated || s.statusSource === "shutdown" ? "resumable" : s.failureReason != null ? "failed" : "completed",
9778
9783
  lifecycleSource: ptyAttached ? s.reconciled ? "reconcile" : "spawn" : s.rehydrated ? "reconcile" : "exit",
9779
9784
  // We own its PTY, so `status` is the authoritative signal — no inferred
9780
9785
  // `activity` is attached for managed sessions.
@@ -10625,7 +10630,14 @@ var StreamerServer = class {
10625
10630
  // even though the registry has one — the name only appeared after a
10626
10631
  // restart rebuilt the row as a stub. Guarded so a runner that has not
10627
10632
  // derived one yet cannot blank a name set by enrichResumedSessionAsync.
10628
- ...session.sessionName != null && { sessionName: session.sessionName }
10633
+ ...session.sessionName != null && { sessionName: session.sessionName },
10634
+ // Without mirroring this, SessionStore's copy is frozen at whatever
10635
+ // `addManaged` saw at spawn ("spawn") forever, because updateManaged
10636
+ // is a partial merge — so managedToResponse can never tell a
10637
+ // grace-timer/idle-reaper hold (statusSource "shutdown") apart from a
10638
+ // genuine process exit ("process-exit"), and reports both as
10639
+ // `lifecycle: "completed"`. See managedToResponse in session-store.ts.
10640
+ ...session.statusSource != null && { statusSource: session.statusSource }
10629
10641
  });
10630
10642
  this.managedSessionsRepo?.recordStatus(
10631
10643
  session.id,