@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.d.cts CHANGED
@@ -2713,6 +2713,18 @@ declare class StreamManager {
2713
2713
  have?: ReadonlyArray<{
2714
2714
  jobId: string;
2715
2715
  lastSeq: number;
2716
+ /**
2717
+ * The prompt this job's turn drew, when the caller knows it.
2718
+ *
2719
+ * The caller's cache holds the PROMPT too (it renders the turn), and a
2720
+ * prompt is a message-table row rather than a stream event — so the
2721
+ * plan's empty-walk rescue has to be told which prompts are already on
2722
+ * screen. Marks are matched against the page of jobs this restore walks,
2723
+ * so a mark for an OLDER turn is not otherwise visible to that rescue,
2724
+ * and a cache deeper than one turn page would re-emit those prompts as
2725
+ * steer bubbles.
2726
+ */
2727
+ messageId?: string | null;
2716
2728
  }>;
2717
2729
  }): Promise<void>;
2718
2730
  /**
package/dist/index.d.ts CHANGED
@@ -2713,6 +2713,18 @@ declare class StreamManager {
2713
2713
  have?: ReadonlyArray<{
2714
2714
  jobId: string;
2715
2715
  lastSeq: number;
2716
+ /**
2717
+ * The prompt this job's turn drew, when the caller knows it.
2718
+ *
2719
+ * The caller's cache holds the PROMPT too (it renders the turn), and a
2720
+ * prompt is a message-table row rather than a stream event — so the
2721
+ * plan's empty-walk rescue has to be told which prompts are already on
2722
+ * screen. Marks are matched against the page of jobs this restore walks,
2723
+ * so a mark for an OLDER turn is not otherwise visible to that rescue,
2724
+ * and a cache deeper than one turn page would re-emit those prompts as
2725
+ * steer bubbles.
2726
+ */
2727
+ messageId?: string | null;
2716
2728
  }>;
2717
2729
  }): Promise<void>;
2718
2730
  /**
package/dist/index.js CHANGED
@@ -3409,6 +3409,7 @@ var StreamManager = class _StreamManager {
3409
3409
  const haveByJobId = new Map(
3410
3410
  (have ?? []).map((h) => [h.jobId, h.lastSeq])
3411
3411
  );
3412
+ const heldFromMarks = (have ?? []).map((h) => h.messageId).filter((id) => typeof id === "string" && id.length > 0);
3412
3413
  const superseded = () => gen !== this.generation;
3413
3414
  if (superseded()) return;
3414
3415
  const turn = this.turnCounter;
@@ -3436,7 +3437,8 @@ var StreamManager = class _StreamManager {
3436
3437
  activeJobId,
3437
3438
  turn,
3438
3439
  jobsRequest,
3439
- haveByJobId
3440
+ haveByJobId,
3441
+ heldFromMarks
3440
3442
  ))
3441
3443
  return;
3442
3444
  if (activeJobId) {
@@ -3633,7 +3635,7 @@ var StreamManager = class _StreamManager {
3633
3635
  session.isLoadingEarlierTurns = false;
3634
3636
  }
3635
3637
  }
3636
- async replayHistory(conversationId, gen, activeJobId, turn, jobsRequest, haveByJobId) {
3638
+ async replayHistory(conversationId, gen, activeJobId, turn, jobsRequest, haveByJobId, heldFromMarks) {
3637
3639
  const stopReplay = () => gen !== this.generation || this.viewTakenOverByLiveTurn() || this.turnStarted(turn);
3638
3640
  let complete = false;
3639
3641
  try {
@@ -3680,7 +3682,10 @@ var StreamManager = class _StreamManager {
3680
3682
  // primary cache scenario, a SETTLED conversation whose turns are all
3681
3683
  // held — and the empty-walk rescue would otherwise re-emit every one of
3682
3684
  // them as a steer bubble.
3683
- heldMessageIds: jobs.filter((j) => haveByJobId.has(j.job_id)).map((j) => j.message_id),
3685
+ heldMessageIds: [
3686
+ ...jobs.filter((j) => haveByJobId.has(j.job_id)).map((j) => j.message_id),
3687
+ ...heldFromMarks
3688
+ ],
3684
3689
  userMessages: userMessages.map((m) => ({
3685
3690
  id: m.id,
3686
3691
  content: m.content
@@ -3714,8 +3719,11 @@ var StreamManager = class _StreamManager {
3714
3719
  step.messageId
3715
3720
  );
3716
3721
  }
3717
- this.session.hasMoreTurns = page.hasMore;
3718
- this.session.oldestTurnCursor = page.nextBefore;
3722
+ const drewNothing = plan.length === 0;
3723
+ const holdsTurns = haveByJobId.size > 0;
3724
+ const noDrawableTurns = drewNothing && holdsTurns;
3725
+ this.session.hasMoreTurns = noDrawableTurns ? false : page.hasMore;
3726
+ this.session.oldestTurnCursor = noDrawableTurns ? null : page.nextBefore;
3719
3727
  this.oldestDrawnMessageId = plan[0]?.messageId ?? null;
3720
3728
  complete = true;
3721
3729
  if (stopReplay()) return false;