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/boot.js CHANGED
@@ -20820,7 +20820,8 @@ function ensureState(roomId) {
20820
20820
  lastFrameBreakerAgentId: null,
20821
20821
  billingHaltedThisTurn: false,
20822
20822
  voiceWaiters: /* @__PURE__ */ new Map(),
20823
- voicePredone: /* @__PURE__ */ new Set()
20823
+ voicePredone: /* @__PURE__ */ new Set(),
20824
+ activeMessageId: null
20824
20825
  };
20825
20826
  _state.set(roomId, s);
20826
20827
  }
@@ -20947,6 +20948,7 @@ async function chairInterrupt(roomId) {
20947
20948
  }
20948
20949
  state.preWarmed = null;
20949
20950
  }
20951
+ state.activeMessageId = null;
20950
20952
  if (interruptedAgentId) {
20951
20953
  const recent = listRecentMessages(roomId, 8);
20952
20954
  for (let i = recent.length - 1; i >= 0; i--) {
@@ -21082,7 +21084,8 @@ function emitQueueUpdate(roomId, s) {
21082
21084
  round: {
21083
21085
  spoken: s.speakersThisTurn,
21084
21086
  total: s.maxSpeakersThisTurn
21085
- }
21087
+ },
21088
+ activeMessageId: s.activeMessageId
21086
21089
  };
21087
21090
  roomBus.emit(roomId, update);
21088
21091
  }
@@ -21113,6 +21116,7 @@ function tickRoom(roomId, opts) {
21113
21116
  }
21114
21117
  state.preWarmed = null;
21115
21118
  }
21119
+ state.activeMessageId = null;
21116
21120
  for (const [, waiter] of state.voiceWaiters) {
21117
21121
  waiter.resolve();
21118
21122
  }
@@ -21228,6 +21232,21 @@ async function runPickerThenPrewarm(roomId, _currentMessageId) {
21228
21232
  state.inflight.delete(sentinel);
21229
21233
  state.inflight.set(info.messageId, ac);
21230
21234
  }
21235
+ if (state.preWarmed !== preWarmed && state.activeMessageId === null) {
21236
+ state.activeMessageId = info.messageId;
21237
+ const m = getMessage(info.messageId);
21238
+ if (m) {
21239
+ const newMeta = { ...m.meta || {}, preWarmed: false };
21240
+ updateMessageBody(info.messageId, m.body, newMeta);
21241
+ roomBus.emit(roomId, {
21242
+ type: "message-updated",
21243
+ messageId: info.messageId,
21244
+ body: m.body,
21245
+ meta: newMeta
21246
+ });
21247
+ }
21248
+ emitQueueUpdate(roomId, state);
21249
+ }
21231
21250
  }
21232
21251
  // Chain trigger lives in pumpQueue's consume point, NOT here.
21233
21252
  // Rationale: B's `message-final` fires while B is still occupying
@@ -21462,9 +21481,25 @@ async function pumpQueue(roomId) {
21462
21481
  ac = state.preWarmed.abortController;
21463
21482
  streamPromise = state.preWarmed.promise;
21464
21483
  state.preWarmed = null;
21484
+ if (justConsumed.messageId) {
21485
+ state.activeMessageId = justConsumed.messageId;
21486
+ const m = getMessage(justConsumed.messageId);
21487
+ if (m) {
21488
+ const newMeta = { ...m.meta || {}, preWarmed: false };
21489
+ updateMessageBody(justConsumed.messageId, m.body, newMeta);
21490
+ roomBus.emit(roomId, {
21491
+ type: "message-updated",
21492
+ messageId: justConsumed.messageId,
21493
+ body: m.body,
21494
+ meta: newMeta
21495
+ });
21496
+ }
21497
+ emitQueueUpdate(roomId, state);
21498
+ }
21465
21499
  rlog(roomId, "speaker-prewarm-consumed", {
21466
21500
  agent: speaker.name,
21467
- agentId: speaker.id
21501
+ agentId: speaker.id,
21502
+ messageId: justConsumed.messageId || "(pending)"
21468
21503
  });
21469
21504
  schedulePreWarm(roomId, justConsumed.messageId);
21470
21505
  } else {
@@ -21489,6 +21524,8 @@ async function pumpQueue(roomId) {
21489
21524
  state.inflight.delete(sentinel);
21490
21525
  state.inflight.set(info.messageId, ac);
21491
21526
  }
21527
+ state.activeMessageId = info.messageId;
21528
+ emitQueueUpdate(roomId, state);
21492
21529
  },
21493
21530
  onMessageFinal: (info) => {
21494
21531
  schedulePreWarm(roomId, info.messageId);
@@ -21532,6 +21569,10 @@ async function pumpQueue(roomId) {
21532
21569
  if (val === ac) keysToDel.push(key);
21533
21570
  }
21534
21571
  for (const key of keysToDel) state.inflight.delete(key);
21572
+ if (state.activeMessageId) {
21573
+ state.activeMessageId = null;
21574
+ emitQueueUpdate(roomId, state);
21575
+ }
21535
21576
  }
21536
21577
  if (state.queue[0] !== entry) {
21537
21578
  continue;
@@ -25772,7 +25813,7 @@ function voicesRouter() {
25772
25813
  init_paths();
25773
25814
 
25774
25815
  // src/version.ts
25775
- var VERSION = "0.1.36";
25816
+ var VERSION = "0.1.37";
25776
25817
 
25777
25818
  // src/utils/render-picker-catalog.ts
25778
25819
  function renderPickerCatalog() {