@oxecli/oxe 1.0.33 → 1.0.34
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/engine.js +13 -10
- package/package.json +1 -1
package/dist/engine.js
CHANGED
|
@@ -159,6 +159,15 @@ export class InferenceEngine {
|
|
|
159
159
|
process.stdout.write(mutedMarkdown(text) + "\n\n");
|
|
160
160
|
this.workRows = displayRows(text) + 1;
|
|
161
161
|
}
|
|
162
|
+
clearWorkLine() {
|
|
163
|
+
if (!this.workActive || this.workRows < 1)
|
|
164
|
+
return;
|
|
165
|
+
for (let i = 0; i < this.workRows; i++) {
|
|
166
|
+
process.stdout.write("\x1b[1A\x1b[2K");
|
|
167
|
+
}
|
|
168
|
+
this.workActive = false;
|
|
169
|
+
this.workRows = 0;
|
|
170
|
+
}
|
|
162
171
|
async streamOnce(inputItems, stats, story, previousResponseId) {
|
|
163
172
|
let content = "";
|
|
164
173
|
let committedLen = 0;
|
|
@@ -294,7 +303,10 @@ export class InferenceEngine {
|
|
|
294
303
|
// the elapsed "Thought for Xs" (mirrors Python's `still_thinking` handling).
|
|
295
304
|
const stillThinking = thinkingStart !== null;
|
|
296
305
|
finishThinking(stillThinking);
|
|
297
|
-
|
|
306
|
+
if (this.interrupted && !this.queryHasOutput)
|
|
307
|
+
this.clearWorkLine();
|
|
308
|
+
else
|
|
309
|
+
reportWorking();
|
|
298
310
|
if (content.slice(committedLen))
|
|
299
311
|
printAiChunk(content.slice(committedLen));
|
|
300
312
|
}
|
|
@@ -591,15 +603,6 @@ export class InferenceEngine {
|
|
|
591
603
|
stripOrphanCalls(inputItems);
|
|
592
604
|
}
|
|
593
605
|
catch (err) {
|
|
594
|
-
if (this.interrupted && !this.queryHasOutput) {
|
|
595
|
-
const fallback = "What else can I help with?";
|
|
596
|
-
process.stdout.write(aiMarkdown(fallback) + "\n\n" + summary() + "\n");
|
|
597
|
-
story.push({ type: "assistant", text: fallback });
|
|
598
|
-
story.push({ type: "footer", text: footerText() });
|
|
599
|
-
attachFooter(conversation);
|
|
600
|
-
attachFooter(inputItems);
|
|
601
|
-
return;
|
|
602
|
-
}
|
|
603
606
|
if (this.interrupted)
|
|
604
607
|
throw new Error("interrupt");
|
|
605
608
|
if (err?.message === "interrupt" || err?.message === "eof") {
|