@threadbase-sh/streamer 1.44.2 → 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/cli.cjs CHANGED
@@ -143309,6 +143309,7 @@ var ConversationCache = class _ConversationCache {
143309
143309
  this.onAgentFileDetected = options?.onAgentFileDetected;
143310
143310
  db.exec(SCHEMA);
143311
143311
  runSqliteMigrations(db, this.migrationsDir);
143312
+ const LIST_COLUMNS = "id, file_path, project_id, project_path, project_name, title, model, account, branch, message_count, last_activity, first_message, last_message, preview, source, provider";
143312
143313
  this.stmts = {
143313
143314
  getById: db.prepare("SELECT id FROM conversation_meta WHERE id = ?"),
143314
143315
  getFullById: db.prepare("SELECT * FROM conversation_meta WHERE id = ?"),
@@ -143389,17 +143390,17 @@ var ConversationCache = class _ConversationCache {
143389
143390
  WHERE conversation_tail.updated_at < excluded.updated_at
143390
143391
  `),
143391
143392
  list: db.prepare(
143392
- "SELECT * FROM conversation_meta ORDER BY last_activity DESC LIMIT ? OFFSET ?"
143393
+ `SELECT ${LIST_COLUMNS} FROM conversation_meta ORDER BY last_activity DESC LIMIT ? OFFSET ?`
143393
143394
  ),
143394
143395
  count: db.prepare("SELECT COUNT(*) as n FROM conversation_meta"),
143395
143396
  listByProject: db.prepare(
143396
- "SELECT * FROM conversation_meta WHERE project_path = ? ORDER BY last_activity DESC LIMIT ? OFFSET ?"
143397
+ `SELECT ${LIST_COLUMNS} FROM conversation_meta WHERE project_path = ? ORDER BY last_activity DESC LIMIT ? OFFSET ?`
143397
143398
  ),
143398
143399
  countByProject: db.prepare(
143399
143400
  "SELECT COUNT(*) as n FROM conversation_meta WHERE project_path = ?"
143400
143401
  ),
143401
143402
  listByProvider: db.prepare(
143402
- "SELECT * FROM conversation_meta WHERE provider = ? ORDER BY last_activity DESC LIMIT ? OFFSET ?"
143403
+ `SELECT ${LIST_COLUMNS} FROM conversation_meta WHERE provider = ? ORDER BY last_activity DESC LIMIT ? OFFSET ?`
143403
143404
  ),
143404
143405
  countByProvider: db.prepare("SELECT COUNT(*) as n FROM conversation_meta WHERE provider = ?"),
143405
143406
  deleteById: db.prepare("DELETE FROM conversation_meta WHERE id = ?"),
@@ -147567,7 +147568,12 @@ function managedToResponse(s3, ptyAttached) {
147567
147568
  // the durable registry, so it is a previous run's session with no process
147568
147569
  // behind it — `resumable`, and `historical` rather than `managed`
147569
147570
  // (docs/plans/live-sessions-persistence-plan.md §4, Phase 1).
147570
- lifecycle: ptyAttached ? "attached" : s3.rehydrated ? "resumable" : s3.failureReason != null ? "failed" : "completed",
147571
+ // A session this run itself put on hold (grace timer, explicit hold_session,
147572
+ // idle reaper) is the other exception: the PTY is gone the same way an exit
147573
+ // leaves it gone, but the conversation is still resumable, not terminal —
147574
+ // `putOnHold` records that by leaving `statusSource: "shutdown"` (the only
147575
+ // place either runner sets it), so it is checked here alongside `rehydrated`.
147576
+ lifecycle: ptyAttached ? "attached" : s3.rehydrated || s3.statusSource === "shutdown" ? "resumable" : s3.failureReason != null ? "failed" : "completed",
147571
147577
  lifecycleSource: ptyAttached ? s3.reconciled ? "reconcile" : "spawn" : s3.rehydrated ? "reconcile" : "exit",
147572
147578
  // We own its PTY, so `status` is the authoritative signal — no inferred
147573
147579
  // `activity` is attached for managed sessions.
@@ -148421,7 +148427,14 @@ var StreamerServer = class {
148421
148427
  // even though the registry has one — the name only appeared after a
148422
148428
  // restart rebuilt the row as a stub. Guarded so a runner that has not
148423
148429
  // derived one yet cannot blank a name set by enrichResumedSessionAsync.
148424
- ...session.sessionName != null && { sessionName: session.sessionName }
148430
+ ...session.sessionName != null && { sessionName: session.sessionName },
148431
+ // Without mirroring this, SessionStore's copy is frozen at whatever
148432
+ // `addManaged` saw at spawn ("spawn") forever, because updateManaged
148433
+ // is a partial merge — so managedToResponse can never tell a
148434
+ // grace-timer/idle-reaper hold (statusSource "shutdown") apart from a
148435
+ // genuine process exit ("process-exit"), and reports both as
148436
+ // `lifecycle: "completed"`. See managedToResponse in session-store.ts.
148437
+ ...session.statusSource != null && { statusSource: session.statusSource }
148425
148438
  });
148426
148439
  this.managedSessionsRepo?.recordStatus(
148427
148440
  session.id,