@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.cjs CHANGED
@@ -9811,7 +9811,12 @@ function managedToResponse(s, ptyAttached) {
9811
9811
  // the durable registry, so it is a previous run's session with no process
9812
9812
  // behind it — `resumable`, and `historical` rather than `managed`
9813
9813
  // (docs/plans/live-sessions-persistence-plan.md §4, Phase 1).
9814
- lifecycle: ptyAttached ? "attached" : s.rehydrated ? "resumable" : s.failureReason != null ? "failed" : "completed",
9814
+ // A session this run itself put on hold (grace timer, explicit hold_session,
9815
+ // idle reaper) is the other exception: the PTY is gone the same way an exit
9816
+ // leaves it gone, but the conversation is still resumable, not terminal —
9817
+ // `putOnHold` records that by leaving `statusSource: "shutdown"` (the only
9818
+ // place either runner sets it), so it is checked here alongside `rehydrated`.
9819
+ lifecycle: ptyAttached ? "attached" : s.rehydrated || s.statusSource === "shutdown" ? "resumable" : s.failureReason != null ? "failed" : "completed",
9815
9820
  lifecycleSource: ptyAttached ? s.reconciled ? "reconcile" : "spawn" : s.rehydrated ? "reconcile" : "exit",
9816
9821
  // We own its PTY, so `status` is the authoritative signal — no inferred
9817
9822
  // `activity` is attached for managed sessions.
@@ -10662,7 +10667,14 @@ var StreamerServer = class {
10662
10667
  // even though the registry has one — the name only appeared after a
10663
10668
  // restart rebuilt the row as a stub. Guarded so a runner that has not
10664
10669
  // derived one yet cannot blank a name set by enrichResumedSessionAsync.
10665
- ...session.sessionName != null && { sessionName: session.sessionName }
10670
+ ...session.sessionName != null && { sessionName: session.sessionName },
10671
+ // Without mirroring this, SessionStore's copy is frozen at whatever
10672
+ // `addManaged` saw at spawn ("spawn") forever, because updateManaged
10673
+ // is a partial merge — so managedToResponse can never tell a
10674
+ // grace-timer/idle-reaper hold (statusSource "shutdown") apart from a
10675
+ // genuine process exit ("process-exit"), and reports both as
10676
+ // `lifecycle: "completed"`. See managedToResponse in session-store.ts.
10677
+ ...session.statusSource != null && { statusSource: session.statusSource }
10666
10678
  });
10667
10679
  this.managedSessionsRepo?.recordStatus(
10668
10680
  session.id,