@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/index.d.cts CHANGED
@@ -1195,6 +1195,7 @@ declare class StreamerServer {
1195
1195
  private selfPtyEndedAt;
1196
1196
  private pendingQuestionKey;
1197
1197
  private pendingPermission;
1198
+ private pendingPermissionKey;
1198
1199
  private scanner;
1199
1200
  private scannerPersistenceDisabled;
1200
1201
  private allScanners;
package/dist/index.d.ts CHANGED
@@ -1195,6 +1195,7 @@ declare class StreamerServer {
1195
1195
  private selfPtyEndedAt;
1196
1196
  private pendingQuestionKey;
1197
1197
  private pendingPermission;
1198
+ private pendingPermissionKey;
1198
1199
  private scanner;
1199
1200
  private scannerPersistenceDisabled;
1200
1201
  private allScanners;
package/dist/index.js CHANGED
@@ -1397,6 +1397,9 @@ import { existsSync as existsSync3 } from "fs";
1397
1397
  import { basename as basename2 } from "path";
1398
1398
 
1399
1399
  // src/services/questions/detectPermissionGate.ts
1400
+ function permissionContentKey(gate) {
1401
+ return `${gate.prompt ?? ""}::${gate.detail ?? ""}::${gate.options.map((o) => `${o.index}.${o.label}`).join(",")}::${gate.cursor ?? ""}`;
1402
+ }
1400
1403
  var OSC_777_PERMISSION_RE = /\x1b\]777;notify;Claude Code;[^\x07\x1b]*needs your permission/;
1401
1404
  var OSC_777_WAITING_RE = /\x1b\]777;notify;Claude Code;[^\x07\x1b]*waiting for your input/;
1402
1405
  function hasPermissionOsc(rawData) {
@@ -6848,6 +6851,11 @@ var StreamerServer = class {
6848
6851
  // to pendingQuestions; mobile answers it by sending the option index via
6849
6852
  // /input { keys }. Cleared when the gate closes.
6850
6853
  pendingPermission = /* @__PURE__ */ new Map();
6854
+ // Content key (prompt + detail + options + cursor) of the permission gate
6855
+ // currently broadcast for a session — mirrors pendingQuestionKey so a PTY
6856
+ // repaint of the same gate doesn't re-broadcast on every tick. Cleared
6857
+ // alongside pendingPermission.
6858
+ pendingPermissionKey = /* @__PURE__ */ new Map();
6851
6859
  scanner = null;
6852
6860
  // Set when better-sqlite3 is unusable (e.g. node ABI mismatch made
6853
6861
  // ConversationCache.open throw), or when config.scannerPersistent is false
@@ -7145,6 +7153,7 @@ var StreamerServer = class {
7145
7153
  this.cancelPendingQuestion(session.id);
7146
7154
  }
7147
7155
  this.pendingPermission.delete(session.id);
7156
+ this.pendingPermissionKey.delete(session.id);
7148
7157
  this.contendedSessions.delete(session.id);
7149
7158
  this.rememberSelfPtyEnded(session.id);
7150
7159
  }
@@ -9181,10 +9190,14 @@ var StreamerServer = class {
9181
9190
  if (gate === null) {
9182
9191
  if (!this.pendingPermission.has(sessionId)) return;
9183
9192
  this.pendingPermission.delete(sessionId);
9193
+ this.pendingPermissionKey.delete(sessionId);
9184
9194
  this.wsHub.broadcast({ type: "permission_cancelled", sessionId });
9185
9195
  return;
9186
9196
  }
9197
+ const key = permissionContentKey(gate);
9198
+ if (this.pendingPermissionKey.get(sessionId) === key) return;
9187
9199
  this.pendingPermission.set(sessionId, gate);
9200
+ this.pendingPermissionKey.set(sessionId, key);
9188
9201
  const subscriberCount = this.sessionSubscribers.get(sessionId)?.size ?? 0;
9189
9202
  this.log.info(
9190
9203
  `[ws.broadcast_permission] ${sessionId.slice(0, 8)} subscribers=${subscriberCount}`,