@astralform/js 9.6.0 → 9.7.0

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
@@ -3462,6 +3462,7 @@ var StreamManager = class _StreamManager {
3462
3462
  const haveByJobId = new Map(
3463
3463
  (have ?? []).map((h) => [h.jobId, h.lastSeq])
3464
3464
  );
3465
+ const heldFromMarks = (have ?? []).map((h) => h.messageId).filter((id) => typeof id === "string" && id.length > 0);
3465
3466
  const superseded = () => gen !== this.generation;
3466
3467
  if (superseded()) return;
3467
3468
  const turn = this.turnCounter;
@@ -3489,7 +3490,8 @@ var StreamManager = class _StreamManager {
3489
3490
  activeJobId,
3490
3491
  turn,
3491
3492
  jobsRequest,
3492
- haveByJobId
3493
+ haveByJobId,
3494
+ heldFromMarks
3493
3495
  ))
3494
3496
  return;
3495
3497
  if (activeJobId) {
@@ -3686,7 +3688,7 @@ var StreamManager = class _StreamManager {
3686
3688
  session.isLoadingEarlierTurns = false;
3687
3689
  }
3688
3690
  }
3689
- async replayHistory(conversationId, gen, activeJobId, turn, jobsRequest, haveByJobId) {
3691
+ async replayHistory(conversationId, gen, activeJobId, turn, jobsRequest, haveByJobId, heldFromMarks) {
3690
3692
  const stopReplay = () => gen !== this.generation || this.viewTakenOverByLiveTurn() || this.turnStarted(turn);
3691
3693
  let complete = false;
3692
3694
  try {
@@ -3733,7 +3735,10 @@ var StreamManager = class _StreamManager {
3733
3735
  // primary cache scenario, a SETTLED conversation whose turns are all
3734
3736
  // held — and the empty-walk rescue would otherwise re-emit every one of
3735
3737
  // them as a steer bubble.
3736
- heldMessageIds: jobs.filter((j) => haveByJobId.has(j.job_id)).map((j) => j.message_id),
3738
+ heldMessageIds: [
3739
+ ...jobs.filter((j) => haveByJobId.has(j.job_id)).map((j) => j.message_id),
3740
+ ...heldFromMarks
3741
+ ],
3737
3742
  userMessages: userMessages.map((m) => ({
3738
3743
  id: m.id,
3739
3744
  content: m.content
@@ -3767,8 +3772,11 @@ var StreamManager = class _StreamManager {
3767
3772
  step.messageId
3768
3773
  );
3769
3774
  }
3770
- this.session.hasMoreTurns = page.hasMore;
3771
- this.session.oldestTurnCursor = page.nextBefore;
3775
+ const drewNothing = plan.length === 0;
3776
+ const holdsTurns = haveByJobId.size > 0;
3777
+ const noDrawableTurns = drewNothing && holdsTurns;
3778
+ this.session.hasMoreTurns = noDrawableTurns ? false : page.hasMore;
3779
+ this.session.oldestTurnCursor = noDrawableTurns ? null : page.nextBefore;
3772
3780
  this.oldestDrawnMessageId = plan[0]?.messageId ?? null;
3773
3781
  complete = true;
3774
3782
  if (stopReplay()) return false;