privateboard 0.1.36 → 0.1.37

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.js CHANGED
@@ -20824,7 +20824,8 @@ function ensureState(roomId) {
20824
20824
  lastFrameBreakerAgentId: null,
20825
20825
  billingHaltedThisTurn: false,
20826
20826
  voiceWaiters: /* @__PURE__ */ new Map(),
20827
- voicePredone: /* @__PURE__ */ new Set()
20827
+ voicePredone: /* @__PURE__ */ new Set(),
20828
+ activeMessageId: null
20828
20829
  };
20829
20830
  _state.set(roomId, s);
20830
20831
  }
@@ -20951,6 +20952,7 @@ async function chairInterrupt(roomId) {
20951
20952
  }
20952
20953
  state.preWarmed = null;
20953
20954
  }
20955
+ state.activeMessageId = null;
20954
20956
  if (interruptedAgentId) {
20955
20957
  const recent = listRecentMessages(roomId, 8);
20956
20958
  for (let i = recent.length - 1; i >= 0; i--) {
@@ -21086,7 +21088,8 @@ function emitQueueUpdate(roomId, s) {
21086
21088
  round: {
21087
21089
  spoken: s.speakersThisTurn,
21088
21090
  total: s.maxSpeakersThisTurn
21089
- }
21091
+ },
21092
+ activeMessageId: s.activeMessageId
21090
21093
  };
21091
21094
  roomBus.emit(roomId, update);
21092
21095
  }
@@ -21117,6 +21120,7 @@ function tickRoom(roomId, opts) {
21117
21120
  }
21118
21121
  state.preWarmed = null;
21119
21122
  }
21123
+ state.activeMessageId = null;
21120
21124
  for (const [, waiter] of state.voiceWaiters) {
21121
21125
  waiter.resolve();
21122
21126
  }
@@ -21232,6 +21236,21 @@ async function runPickerThenPrewarm(roomId, _currentMessageId) {
21232
21236
  state.inflight.delete(sentinel);
21233
21237
  state.inflight.set(info.messageId, ac);
21234
21238
  }
21239
+ if (state.preWarmed !== preWarmed && state.activeMessageId === null) {
21240
+ state.activeMessageId = info.messageId;
21241
+ const m = getMessage(info.messageId);
21242
+ if (m) {
21243
+ const newMeta = { ...m.meta || {}, preWarmed: false };
21244
+ updateMessageBody(info.messageId, m.body, newMeta);
21245
+ roomBus.emit(roomId, {
21246
+ type: "message-updated",
21247
+ messageId: info.messageId,
21248
+ body: m.body,
21249
+ meta: newMeta
21250
+ });
21251
+ }
21252
+ emitQueueUpdate(roomId, state);
21253
+ }
21235
21254
  }
21236
21255
  // Chain trigger lives in pumpQueue's consume point, NOT here.
21237
21256
  // Rationale: B's `message-final` fires while B is still occupying
@@ -21466,9 +21485,25 @@ async function pumpQueue(roomId) {
21466
21485
  ac = state.preWarmed.abortController;
21467
21486
  streamPromise = state.preWarmed.promise;
21468
21487
  state.preWarmed = null;
21488
+ if (justConsumed.messageId) {
21489
+ state.activeMessageId = justConsumed.messageId;
21490
+ const m = getMessage(justConsumed.messageId);
21491
+ if (m) {
21492
+ const newMeta = { ...m.meta || {}, preWarmed: false };
21493
+ updateMessageBody(justConsumed.messageId, m.body, newMeta);
21494
+ roomBus.emit(roomId, {
21495
+ type: "message-updated",
21496
+ messageId: justConsumed.messageId,
21497
+ body: m.body,
21498
+ meta: newMeta
21499
+ });
21500
+ }
21501
+ emitQueueUpdate(roomId, state);
21502
+ }
21469
21503
  rlog(roomId, "speaker-prewarm-consumed", {
21470
21504
  agent: speaker.name,
21471
- agentId: speaker.id
21505
+ agentId: speaker.id,
21506
+ messageId: justConsumed.messageId || "(pending)"
21472
21507
  });
21473
21508
  schedulePreWarm(roomId, justConsumed.messageId);
21474
21509
  } else {
@@ -21493,6 +21528,8 @@ async function pumpQueue(roomId) {
21493
21528
  state.inflight.delete(sentinel);
21494
21529
  state.inflight.set(info.messageId, ac);
21495
21530
  }
21531
+ state.activeMessageId = info.messageId;
21532
+ emitQueueUpdate(roomId, state);
21496
21533
  },
21497
21534
  onMessageFinal: (info) => {
21498
21535
  schedulePreWarm(roomId, info.messageId);
@@ -21536,6 +21573,10 @@ async function pumpQueue(roomId) {
21536
21573
  if (val === ac) keysToDel.push(key);
21537
21574
  }
21538
21575
  for (const key of keysToDel) state.inflight.delete(key);
21576
+ if (state.activeMessageId) {
21577
+ state.activeMessageId = null;
21578
+ emitQueueUpdate(roomId, state);
21579
+ }
21539
21580
  }
21540
21581
  if (state.queue[0] !== entry) {
21541
21582
  continue;
@@ -25776,7 +25817,7 @@ function voicesRouter() {
25776
25817
  init_paths();
25777
25818
 
25778
25819
  // src/version.ts
25779
- var VERSION = "0.1.36";
25820
+ var VERSION = "0.1.37";
25780
25821
 
25781
25822
  // src/utils/render-picker-catalog.ts
25782
25823
  function renderPickerCatalog() {