@oxecli/oxe 1.0.111 → 1.0.112
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 +0 -13
- package/dist/ui.js +21 -4
- package/package.json +1 -1
package/dist/engine.js
CHANGED
|
@@ -11,10 +11,6 @@ import { takePendingDiffOutput } from "./tools.js";
|
|
|
11
11
|
// ---------------------------------------------------------------------------
|
|
12
12
|
const tokenEstCache = new Map();
|
|
13
13
|
const tokenEstCacheMax = 4096;
|
|
14
|
-
/** Minimum time (ms) a tool's "Working"/"Running" status stays visible after
|
|
15
|
-
* the tool returns, so instant tools (write_file/edit_file) are still seen to
|
|
16
|
-
* stream when called before the result replaces the status line. */
|
|
17
|
-
const MIN_TOOL_STATUS_MS = 350;
|
|
18
14
|
export function estimateTokens(items) {
|
|
19
15
|
let total = 0;
|
|
20
16
|
for (const item of items) {
|
|
@@ -596,7 +592,6 @@ export class InferenceEngine {
|
|
|
596
592
|
dockTransientStart("flush");
|
|
597
593
|
const toolSpinner = new Spinner();
|
|
598
594
|
toolSpinner.startDots(`\x1b[90m╰─\x1b[0m ${c.name === "bash" ? "Running" : "Working"}`);
|
|
599
|
-
const t0 = Date.now();
|
|
600
595
|
const rawResult = await this.runTool(c.name, c.arguments, this.activeAbort?.signal);
|
|
601
596
|
// A tool call was made, which interrupts any current working phase,
|
|
602
597
|
// so the next agent iteration may commit a fresh "Worked for …" block.
|
|
@@ -605,14 +600,6 @@ export class InferenceEngine {
|
|
|
605
600
|
toolSpinner.stop();
|
|
606
601
|
throw new Error("interrupt");
|
|
607
602
|
}
|
|
608
|
-
// Keep the status line streaming for at least MIN_TOOL_STATUS_MS so
|
|
609
|
-
// even instant tools (write_file/edit_file) visibly show their
|
|
610
|
-
// "Working" indicator when called, then swap to the result. The
|
|
611
|
-
// spinner's own timer animates the dots during this window.
|
|
612
|
-
const elapsed = Date.now() - t0;
|
|
613
|
-
if (elapsed < MIN_TOOL_STATUS_MS) {
|
|
614
|
-
await new Promise((res) => setTimeout(res, MIN_TOOL_STATUS_MS - elapsed));
|
|
615
|
-
}
|
|
616
603
|
const failed = toolOutputFailed(c.name, rawResult);
|
|
617
604
|
const action = formatToolResult(rawResult, failed);
|
|
618
605
|
const diff = takePendingDiffOutput();
|
package/dist/ui.js
CHANGED
|
@@ -173,6 +173,19 @@ export function truncateStyled(text, maxVisible) {
|
|
|
173
173
|
}
|
|
174
174
|
return out;
|
|
175
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Truncate styled text to at most `maxVisible` visible characters and, if
|
|
178
|
+
* truncated, append a visible ellipsis "…" so the cut is obvious. Used by the
|
|
179
|
+
* panel frame so long titles/subtitles shrink to the box instead of overflowing.
|
|
180
|
+
*/
|
|
181
|
+
export function truncateStyledEllipsis(text, maxVisible) {
|
|
182
|
+
if (maxVisible <= 0)
|
|
183
|
+
return "";
|
|
184
|
+
if (plainLen(text) <= maxVisible)
|
|
185
|
+
return text;
|
|
186
|
+
const dot = maxVisible > 1 ? "…" : "";
|
|
187
|
+
return truncateStyled(text, Math.max(1, maxVisible - (dot ? 1 : 0))) + dot;
|
|
188
|
+
}
|
|
176
189
|
/**
|
|
177
190
|
* Wrap a styled (ANSI) string into lines of at most `width` visible characters,
|
|
178
191
|
* wrapping whole words onto new lines and splitting any single word longer than
|
|
@@ -563,13 +576,17 @@ function panelString(content, title = "", subtitle = "", expand = true, borderSt
|
|
|
563
576
|
const embed = (text, align) => {
|
|
564
577
|
if (!text)
|
|
565
578
|
return "─".repeat(Math.max(boxW - 2, 0));
|
|
566
|
-
|
|
579
|
+
// Truncate the title/subtitle so the frame always scales down to the box
|
|
580
|
+
// width (matching the prompt field): a long subtitle used to overflow the
|
|
581
|
+
// bottom border on narrow/scaled terminals. Ellipsis marks the cut.
|
|
582
|
+
const prefix = align === "left" ? "───" : "";
|
|
583
|
+
const avail = Math.max(boxW - 2 - plainLen(prefix), 0);
|
|
584
|
+
const inner = ` ${truncateStyledEllipsis(text, Math.max(avail - 2, 0))} `;
|
|
567
585
|
if (align === "left") {
|
|
568
|
-
const
|
|
569
|
-
const fill = Math.max(boxW - 2 - plainLen(prefix) - plainLen(inner), 0);
|
|
586
|
+
const fill = Math.max(avail - plainLen(inner), 0);
|
|
570
587
|
return `${prefix}${inner}${"─".repeat(fill)}`;
|
|
571
588
|
}
|
|
572
|
-
const fill = Math.max(
|
|
589
|
+
const fill = Math.max(avail - plainLen(inner), 0);
|
|
573
590
|
const left = Math.floor(fill / 2);
|
|
574
591
|
const right = fill - left;
|
|
575
592
|
return `${"─".repeat(left)}${inner}${"─".repeat(right)}`;
|