@threadbase-sh/streamer 1.24.2 → 1.24.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 +43 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +43 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +43 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -138849,14 +138849,41 @@ function scrapePermissionGate(lines) {
|
|
|
138849
138849
|
}
|
|
138850
138850
|
if (options.length === 0) return null;
|
|
138851
138851
|
let prompt;
|
|
138852
|
+
let promptLine = -1;
|
|
138852
138853
|
for (let i = firstOptionLine - 1; i >= 0; i--) {
|
|
138853
138854
|
const t2 = stripGutter(lines[i]).trim();
|
|
138854
138855
|
if (t2.length === 0) continue;
|
|
138855
138856
|
if (BOX_ONLY_RE.test(lines[i].trim()) || FOOTER_RE.test(t2) || PROMPT_ARROW_RE.test(t2)) continue;
|
|
138856
138857
|
prompt = t2 || void 0;
|
|
138858
|
+
promptLine = i;
|
|
138857
138859
|
break;
|
|
138858
138860
|
}
|
|
138859
|
-
|
|
138861
|
+
const detail = promptLine > 0 ? scrapeDetail(lines, promptLine) : void 0;
|
|
138862
|
+
return {
|
|
138863
|
+
...prompt ? { prompt } : {},
|
|
138864
|
+
...detail ? { detail } : {},
|
|
138865
|
+
options,
|
|
138866
|
+
...cursor !== void 0 ? { cursor } : {}
|
|
138867
|
+
};
|
|
138868
|
+
}
|
|
138869
|
+
var MAX_DETAIL_LINES = 6;
|
|
138870
|
+
function scrapeDetail(lines, promptLine) {
|
|
138871
|
+
const collected = [];
|
|
138872
|
+
let blankRun = 0;
|
|
138873
|
+
for (let i = promptLine - 1; i >= 0; i--) {
|
|
138874
|
+
const t2 = stripGutter(lines[i]).trim();
|
|
138875
|
+
if (BOX_ONLY_RE.test(t2)) break;
|
|
138876
|
+
if (t2.length === 0) {
|
|
138877
|
+
blankRun++;
|
|
138878
|
+
if (blankRun >= 2) break;
|
|
138879
|
+
continue;
|
|
138880
|
+
}
|
|
138881
|
+
blankRun = 0;
|
|
138882
|
+
if (FOOTER_RE.test(t2) || PROMPT_ARROW_RE.test(t2)) continue;
|
|
138883
|
+
collected.push(t2);
|
|
138884
|
+
if (collected.length >= MAX_DETAIL_LINES) break;
|
|
138885
|
+
}
|
|
138886
|
+
return collected.length > 0 ? collected.reverse().join("\n") : void 0;
|
|
138860
138887
|
}
|
|
138861
138888
|
|
|
138862
138889
|
// src/services/questions/detectQuestionFromScreen.ts
|
|
@@ -141683,6 +141710,19 @@ var ConversationWatcher = class {
|
|
|
141683
141710
|
void entry.watcher.close();
|
|
141684
141711
|
this.files.delete(filePath);
|
|
141685
141712
|
}
|
|
141713
|
+
/**
|
|
141714
|
+
* Re-drive the tail read for a file that's already being tailed. A per-file
|
|
141715
|
+
* chokidar handle can die silently (fs.watch stops firing after inode churn)
|
|
141716
|
+
* while the coarser directory watcher keeps reporting changes — calling this
|
|
141717
|
+
* from the directory-event path makes the tail self-healing. Reads are
|
|
141718
|
+
* offset-based and coalesced, so a redundant poke after a normal change
|
|
141719
|
+
* event is a cheap stat + no-op. Returns false for untailed paths.
|
|
141720
|
+
*/
|
|
141721
|
+
poke(filePath) {
|
|
141722
|
+
if (!this.files.has(filePath)) return false;
|
|
141723
|
+
void this.readNewLines(filePath);
|
|
141724
|
+
return true;
|
|
141725
|
+
}
|
|
141686
141726
|
/**
|
|
141687
141727
|
* Watch a directory of conversation JSONL files. Fires
|
|
141688
141728
|
* onConversationChanged for any add/change/unlink event so the caller
|
|
@@ -142757,6 +142797,7 @@ var StreamerServer = class {
|
|
|
142757
142797
|
}
|
|
142758
142798
|
},
|
|
142759
142799
|
onConversationChanged: (filePath) => {
|
|
142800
|
+
this.fileWatcher.poke(filePath);
|
|
142760
142801
|
this.cache?.invalidateByFilePath(filePath, { skipIfTailed: true });
|
|
142761
142802
|
this.markScannerStaleDebounced();
|
|
142762
142803
|
this.log.debug?.(`Scanner invalidated by directory event: ${filePath}`, {
|
|
@@ -144140,6 +144181,7 @@ var StreamerServer = class {
|
|
|
144140
144181
|
type: "permission",
|
|
144141
144182
|
sessionId,
|
|
144142
144183
|
...gate.prompt ? { prompt: gate.prompt } : {},
|
|
144184
|
+
...gate.detail ? { detail: gate.detail } : {},
|
|
144143
144185
|
options: gate.options,
|
|
144144
144186
|
...gate.cursor !== void 0 ? { cursor: gate.cursor } : {}
|
|
144145
144187
|
});
|