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/server.js CHANGED
@@ -20057,7 +20057,8 @@ function ensureState(roomId) {
20057
20057
  lastFrameBreakerAgentId: null,
20058
20058
  billingHaltedThisTurn: false,
20059
20059
  voiceWaiters: /* @__PURE__ */ new Map(),
20060
- voicePredone: /* @__PURE__ */ new Set()
20060
+ voicePredone: /* @__PURE__ */ new Set(),
20061
+ activeMessageId: null
20061
20062
  };
20062
20063
  _state.set(roomId, s);
20063
20064
  }
@@ -20184,6 +20185,7 @@ async function chairInterrupt(roomId) {
20184
20185
  }
20185
20186
  state.preWarmed = null;
20186
20187
  }
20188
+ state.activeMessageId = null;
20187
20189
  if (interruptedAgentId) {
20188
20190
  const recent = listRecentMessages(roomId, 8);
20189
20191
  for (let i = recent.length - 1; i >= 0; i--) {
@@ -20319,7 +20321,8 @@ function emitQueueUpdate(roomId, s) {
20319
20321
  round: {
20320
20322
  spoken: s.speakersThisTurn,
20321
20323
  total: s.maxSpeakersThisTurn
20322
- }
20324
+ },
20325
+ activeMessageId: s.activeMessageId
20323
20326
  };
20324
20327
  roomBus.emit(roomId, update);
20325
20328
  }
@@ -20350,6 +20353,7 @@ function tickRoom(roomId, opts) {
20350
20353
  }
20351
20354
  state.preWarmed = null;
20352
20355
  }
20356
+ state.activeMessageId = null;
20353
20357
  for (const [, waiter] of state.voiceWaiters) {
20354
20358
  waiter.resolve();
20355
20359
  }
@@ -20465,6 +20469,21 @@ async function runPickerThenPrewarm(roomId, _currentMessageId) {
20465
20469
  state.inflight.delete(sentinel);
20466
20470
  state.inflight.set(info.messageId, ac);
20467
20471
  }
20472
+ if (state.preWarmed !== preWarmed && state.activeMessageId === null) {
20473
+ state.activeMessageId = info.messageId;
20474
+ const m = getMessage(info.messageId);
20475
+ if (m) {
20476
+ const newMeta = { ...m.meta || {}, preWarmed: false };
20477
+ updateMessageBody(info.messageId, m.body, newMeta);
20478
+ roomBus.emit(roomId, {
20479
+ type: "message-updated",
20480
+ messageId: info.messageId,
20481
+ body: m.body,
20482
+ meta: newMeta
20483
+ });
20484
+ }
20485
+ emitQueueUpdate(roomId, state);
20486
+ }
20468
20487
  }
20469
20488
  // Chain trigger lives in pumpQueue's consume point, NOT here.
20470
20489
  // Rationale: B's `message-final` fires while B is still occupying
@@ -20699,9 +20718,25 @@ async function pumpQueue(roomId) {
20699
20718
  ac = state.preWarmed.abortController;
20700
20719
  streamPromise = state.preWarmed.promise;
20701
20720
  state.preWarmed = null;
20721
+ if (justConsumed.messageId) {
20722
+ state.activeMessageId = justConsumed.messageId;
20723
+ const m = getMessage(justConsumed.messageId);
20724
+ if (m) {
20725
+ const newMeta = { ...m.meta || {}, preWarmed: false };
20726
+ updateMessageBody(justConsumed.messageId, m.body, newMeta);
20727
+ roomBus.emit(roomId, {
20728
+ type: "message-updated",
20729
+ messageId: justConsumed.messageId,
20730
+ body: m.body,
20731
+ meta: newMeta
20732
+ });
20733
+ }
20734
+ emitQueueUpdate(roomId, state);
20735
+ }
20702
20736
  rlog(roomId, "speaker-prewarm-consumed", {
20703
20737
  agent: speaker.name,
20704
- agentId: speaker.id
20738
+ agentId: speaker.id,
20739
+ messageId: justConsumed.messageId || "(pending)"
20705
20740
  });
20706
20741
  schedulePreWarm(roomId, justConsumed.messageId);
20707
20742
  } else {
@@ -20726,6 +20761,8 @@ async function pumpQueue(roomId) {
20726
20761
  state.inflight.delete(sentinel);
20727
20762
  state.inflight.set(info.messageId, ac);
20728
20763
  }
20764
+ state.activeMessageId = info.messageId;
20765
+ emitQueueUpdate(roomId, state);
20729
20766
  },
20730
20767
  onMessageFinal: (info) => {
20731
20768
  schedulePreWarm(roomId, info.messageId);
@@ -20769,6 +20806,10 @@ async function pumpQueue(roomId) {
20769
20806
  if (val === ac) keysToDel.push(key);
20770
20807
  }
20771
20808
  for (const key of keysToDel) state.inflight.delete(key);
20809
+ if (state.activeMessageId) {
20810
+ state.activeMessageId = null;
20811
+ emitQueueUpdate(roomId, state);
20812
+ }
20772
20813
  }
20773
20814
  if (state.queue[0] !== entry) {
20774
20815
  continue;
@@ -25009,7 +25050,7 @@ function voicesRouter() {
25009
25050
  init_paths();
25010
25051
 
25011
25052
  // src/version.ts
25012
- var VERSION = "0.1.36";
25053
+ var VERSION = "0.1.37";
25013
25054
 
25014
25055
  // src/utils/render-picker-catalog.ts
25015
25056
  function renderPickerCatalog() {