@threadbase-sh/streamer 1.36.3 → 1.36.4

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.cjs CHANGED
@@ -141048,6 +141048,9 @@ var import_path22 = require("path");
141048
141048
  init_logger();
141049
141049
 
141050
141050
  // src/services/questions/detectPermissionGate.ts
141051
+ function permissionContentKey(gate) {
141052
+ return `${gate.prompt ?? ""}::${gate.detail ?? ""}::${gate.options.map((o) => `${o.index}.${o.label}`).join(",")}::${gate.cursor ?? ""}`;
141053
+ }
141051
141054
  var OSC_777_PERMISSION_RE = /\x1b\]777;notify;Claude Code;[^\x07\x1b]*needs your permission/;
141052
141055
  var OSC_777_WAITING_RE = /\x1b\]777;notify;Claude Code;[^\x07\x1b]*waiting for your input/;
141053
141056
  function hasPermissionOsc(rawData) {
@@ -144070,6 +144073,11 @@ var StreamerServer = class {
144070
144073
  // to pendingQuestions; mobile answers it by sending the option index via
144071
144074
  // /input { keys }. Cleared when the gate closes.
144072
144075
  pendingPermission = /* @__PURE__ */ new Map();
144076
+ // Content key (prompt + detail + options + cursor) of the permission gate
144077
+ // currently broadcast for a session — mirrors pendingQuestionKey so a PTY
144078
+ // repaint of the same gate doesn't re-broadcast on every tick. Cleared
144079
+ // alongside pendingPermission.
144080
+ pendingPermissionKey = /* @__PURE__ */ new Map();
144073
144081
  scanner = null;
144074
144082
  // Set when better-sqlite3 is unusable (e.g. node ABI mismatch made
144075
144083
  // ConversationCache.open throw), or when config.scannerPersistent is false
@@ -144367,6 +144375,7 @@ var StreamerServer = class {
144367
144375
  this.cancelPendingQuestion(session.id);
144368
144376
  }
144369
144377
  this.pendingPermission.delete(session.id);
144378
+ this.pendingPermissionKey.delete(session.id);
144370
144379
  this.contendedSessions.delete(session.id);
144371
144380
  this.rememberSelfPtyEnded(session.id);
144372
144381
  }
@@ -146403,10 +146412,14 @@ var StreamerServer = class {
146403
146412
  if (gate === null) {
146404
146413
  if (!this.pendingPermission.has(sessionId)) return;
146405
146414
  this.pendingPermission.delete(sessionId);
146415
+ this.pendingPermissionKey.delete(sessionId);
146406
146416
  this.wsHub.broadcast({ type: "permission_cancelled", sessionId });
146407
146417
  return;
146408
146418
  }
146419
+ const key = permissionContentKey(gate);
146420
+ if (this.pendingPermissionKey.get(sessionId) === key) return;
146409
146421
  this.pendingPermission.set(sessionId, gate);
146422
+ this.pendingPermissionKey.set(sessionId, key);
146410
146423
  const subscriberCount = this.sessionSubscribers.get(sessionId)?.size ?? 0;
146411
146424
  this.log.info(
146412
146425
  `[ws.broadcast_permission] ${sessionId.slice(0, 8)} subscribers=${subscriberCount}`,