@threadbase-sh/streamer 1.24.2 → 1.24.3

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
@@ -202,6 +202,7 @@ type WSMessage = {
202
202
  type: "permission";
203
203
  sessionId: string;
204
204
  prompt?: string;
205
+ detail?: string;
205
206
  options: PermissionOption[];
206
207
  cursor?: number;
207
208
  } | {
@@ -326,6 +327,7 @@ interface PTYManagerOptions {
326
327
  onReady?: (session: ManagedSession) => void;
327
328
  onPermissionChange?: (sessionId: string, gate: {
328
329
  prompt?: string;
330
+ detail?: string;
329
331
  options: PermissionOption[];
330
332
  cursor?: number;
331
333
  } | null) => void;
package/dist/index.d.ts CHANGED
@@ -202,6 +202,7 @@ type WSMessage = {
202
202
  type: "permission";
203
203
  sessionId: string;
204
204
  prompt?: string;
205
+ detail?: string;
205
206
  options: PermissionOption[];
206
207
  cursor?: number;
207
208
  } | {
@@ -326,6 +327,7 @@ interface PTYManagerOptions {
326
327
  onReady?: (session: ManagedSession) => void;
327
328
  onPermissionChange?: (sessionId: string, gate: {
328
329
  prompt?: string;
330
+ detail?: string;
329
331
  options: PermissionOption[];
330
332
  cursor?: number;
331
333
  } | null) => void;
package/dist/index.js CHANGED
@@ -1145,14 +1145,41 @@ function scrapePermissionGate(lines) {
1145
1145
  }
1146
1146
  if (options.length === 0) return null;
1147
1147
  let prompt;
1148
+ let promptLine = -1;
1148
1149
  for (let i = firstOptionLine - 1; i >= 0; i--) {
1149
1150
  const t = stripGutter(lines[i]).trim();
1150
1151
  if (t.length === 0) continue;
1151
1152
  if (BOX_ONLY_RE.test(lines[i].trim()) || FOOTER_RE.test(t) || PROMPT_ARROW_RE.test(t)) continue;
1152
1153
  prompt = t || void 0;
1154
+ promptLine = i;
1153
1155
  break;
1154
1156
  }
1155
- return { ...prompt ? { prompt } : {}, options, ...cursor !== void 0 ? { cursor } : {} };
1157
+ const detail = promptLine > 0 ? scrapeDetail(lines, promptLine) : void 0;
1158
+ return {
1159
+ ...prompt ? { prompt } : {},
1160
+ ...detail ? { detail } : {},
1161
+ options,
1162
+ ...cursor !== void 0 ? { cursor } : {}
1163
+ };
1164
+ }
1165
+ var MAX_DETAIL_LINES = 6;
1166
+ function scrapeDetail(lines, promptLine) {
1167
+ const collected = [];
1168
+ let blankRun = 0;
1169
+ for (let i = promptLine - 1; i >= 0; i--) {
1170
+ const t = stripGutter(lines[i]).trim();
1171
+ if (BOX_ONLY_RE.test(t)) break;
1172
+ if (t.length === 0) {
1173
+ blankRun++;
1174
+ if (blankRun >= 2) break;
1175
+ continue;
1176
+ }
1177
+ blankRun = 0;
1178
+ if (FOOTER_RE.test(t) || PROMPT_ARROW_RE.test(t)) continue;
1179
+ collected.push(t);
1180
+ if (collected.length >= MAX_DETAIL_LINES) break;
1181
+ }
1182
+ return collected.length > 0 ? collected.reverse().join("\n") : void 0;
1156
1183
  }
1157
1184
 
1158
1185
  // src/services/questions/detectQuestionFromScreen.ts
@@ -6319,6 +6346,7 @@ var StreamerServer = class {
6319
6346
  type: "permission",
6320
6347
  sessionId,
6321
6348
  ...gate.prompt ? { prompt: gate.prompt } : {},
6349
+ ...gate.detail ? { detail: gate.detail } : {},
6322
6350
  options: gate.options,
6323
6351
  ...gate.cursor !== void 0 ? { cursor: gate.cursor } : {}
6324
6352
  });