@oxecli/oxe 1.0.56 → 1.0.57
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 +2 -2
- package/dist/ui.js +38 -22
- package/package.json +1 -1
package/dist/engine.js
CHANGED
|
@@ -43,7 +43,7 @@ export class InferenceEngine {
|
|
|
43
43
|
keyData;
|
|
44
44
|
client;
|
|
45
45
|
workActive = false;
|
|
46
|
-
workRows =
|
|
46
|
+
workRows = 0;
|
|
47
47
|
inQuery = false;
|
|
48
48
|
activeAbort = null;
|
|
49
49
|
interrupted = false;
|
|
@@ -403,7 +403,7 @@ export class InferenceEngine {
|
|
|
403
403
|
return [conversation, false];
|
|
404
404
|
const started = Date.now();
|
|
405
405
|
const comp = new Spinner();
|
|
406
|
-
comp.start(
|
|
406
|
+
comp.start(`Compacting conversation ${tickDuration(0)}`);
|
|
407
407
|
const compTimer = setInterval(() => {
|
|
408
408
|
comp.update(`Compacting conversation ${tickDuration((Date.now() - started) / 1000)}`);
|
|
409
409
|
}, 100);
|
package/dist/ui.js
CHANGED
|
@@ -334,11 +334,10 @@ export function aiMarkdown(text) {
|
|
|
334
334
|
return markdownToAnsi(text);
|
|
335
335
|
}
|
|
336
336
|
export function mutedMarkdown(text) {
|
|
337
|
-
|
|
337
|
+
return markdownToAnsi(text)
|
|
338
338
|
.split("\n")
|
|
339
339
|
.map((l) => `\x1b[2m${l}\x1b[0m`)
|
|
340
340
|
.join("\n");
|
|
341
|
-
return markdownToAnsi(dimmed);
|
|
342
341
|
}
|
|
343
342
|
// ---------------------------------------------------------------------------
|
|
344
343
|
// Panel Rendering
|
|
@@ -377,15 +376,8 @@ function panelString(content, title = "", subtitle = "", expand = true, borderSt
|
|
|
377
376
|
for (let i = 0; i < styledLines.length; i++) {
|
|
378
377
|
const line = styledLines[i];
|
|
379
378
|
const plain = plainLines[i] ?? "";
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const truncated = line.slice(0, innerW);
|
|
383
|
-
out.push(`\x1b[${borderStyle}m│\x1b[0m ${truncated} \x1b[${borderStyle}m│\x1b[0m`);
|
|
384
|
-
}
|
|
385
|
-
else {
|
|
386
|
-
const pad = Math.max(innerW - plain.length, 0);
|
|
387
|
-
out.push(`\x1b[${borderStyle}m│\x1b[0m ${line}${" ".repeat(pad)} \x1b[${borderStyle}m│\x1b[0m`);
|
|
388
|
-
}
|
|
379
|
+
const pad = Math.max(innerW - plain.length, 0);
|
|
380
|
+
out.push(`\x1b[${borderStyle}m│\x1b[0m ${line}${" ".repeat(pad)} \x1b[${borderStyle}m│\x1b[0m`);
|
|
389
381
|
}
|
|
390
382
|
const bottom = `╰${embed(subtitle, "center")}╯`;
|
|
391
383
|
out.push(`\x1b[${borderStyle}m${bottom}\x1b[0m`);
|
|
@@ -1002,6 +994,20 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
1002
994
|
}
|
|
1003
995
|
cursor += text.length;
|
|
1004
996
|
};
|
|
997
|
+
// A paste span is treated as a single atomic "block" only when it collapses
|
|
998
|
+
// to a marker (large pastes). Small inline pastes behave like normal text.
|
|
999
|
+
const spanCollapsed = (span) => {
|
|
1000
|
+
return shouldCollapsePaste(buffer.slice(span[0], span[1]));
|
|
1001
|
+
};
|
|
1002
|
+
const deleteWholeSpan = (span) => {
|
|
1003
|
+
const [start, end] = span;
|
|
1004
|
+
buffer = buffer.slice(0, start) + buffer.slice(end);
|
|
1005
|
+
const delta = start - end;
|
|
1006
|
+
pasteSpans = pasteSpans
|
|
1007
|
+
.filter(([s, e]) => s !== start || e !== end)
|
|
1008
|
+
.map(([s, e]) => (s >= end ? [s + delta, e + delta] : [s, e]));
|
|
1009
|
+
cursor = start;
|
|
1010
|
+
};
|
|
1005
1011
|
const backspace = () => {
|
|
1006
1012
|
if (cursor <= 0)
|
|
1007
1013
|
return;
|
|
@@ -1010,14 +1016,8 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
1010
1016
|
histIdx = hist.length;
|
|
1011
1017
|
}
|
|
1012
1018
|
const containing = pasteSpans.find(([s, e]) => s < cursor && cursor <= e);
|
|
1013
|
-
if (containing) {
|
|
1014
|
-
|
|
1015
|
-
buffer = buffer.slice(0, start) + buffer.slice(end);
|
|
1016
|
-
const delta = start - end;
|
|
1017
|
-
pasteSpans = pasteSpans
|
|
1018
|
-
.filter(([s, e]) => s !== start || e !== end)
|
|
1019
|
-
.map(([s, e]) => (s >= end ? [s + delta, e + delta] : [s, e]));
|
|
1020
|
-
cursor = start;
|
|
1019
|
+
if (containing && spanCollapsed(containing)) {
|
|
1020
|
+
deleteWholeSpan(containing);
|
|
1021
1021
|
return;
|
|
1022
1022
|
}
|
|
1023
1023
|
const before = Array.from(buffer.slice(0, cursor));
|
|
@@ -1049,7 +1049,7 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
1049
1049
|
histIdx = hist.length;
|
|
1050
1050
|
}
|
|
1051
1051
|
const containing = pasteSpans.find(([s, e]) => s <= cursor && cursor < e);
|
|
1052
|
-
if (containing) {
|
|
1052
|
+
if (containing && spanCollapsed(containing)) {
|
|
1053
1053
|
const [start, end] = containing;
|
|
1054
1054
|
buffer = buffer.slice(0, start) + buffer.slice(end);
|
|
1055
1055
|
const delta = start - end;
|
|
@@ -1059,6 +1059,22 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
1059
1059
|
return;
|
|
1060
1060
|
}
|
|
1061
1061
|
buffer = buffer.slice(0, cursor) + buffer.slice(cursor + 1);
|
|
1062
|
+
const deletedAt = cursor;
|
|
1063
|
+
const adjusted = [];
|
|
1064
|
+
for (const [s, e] of pasteSpans) {
|
|
1065
|
+
if (deletedAt >= s && deletedAt < e) {
|
|
1066
|
+
const ne = e - 1;
|
|
1067
|
+
if (s < ne)
|
|
1068
|
+
adjusted.push([s, ne]);
|
|
1069
|
+
}
|
|
1070
|
+
else if (deletedAt < s) {
|
|
1071
|
+
adjusted.push([s - 1, e - 1]);
|
|
1072
|
+
}
|
|
1073
|
+
else {
|
|
1074
|
+
adjusted.push([s, e]);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
pasteSpans = adjusted.filter(([s, e]) => s < e);
|
|
1062
1078
|
};
|
|
1063
1079
|
const deleteWordBefore = () => {
|
|
1064
1080
|
if (cursor <= 0)
|
|
@@ -1075,7 +1091,7 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
1075
1091
|
if (cursor <= 0)
|
|
1076
1092
|
return;
|
|
1077
1093
|
for (const [s, e] of pasteSpans) {
|
|
1078
|
-
if (s < cursor && cursor <= e) {
|
|
1094
|
+
if (s < cursor && cursor <= e && spanCollapsed([s, e])) {
|
|
1079
1095
|
cursor = s;
|
|
1080
1096
|
return;
|
|
1081
1097
|
}
|
|
@@ -1086,7 +1102,7 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
1086
1102
|
if (cursor >= buffer.length)
|
|
1087
1103
|
return;
|
|
1088
1104
|
for (const [s, e] of pasteSpans) {
|
|
1089
|
-
if (s <= cursor && cursor < e) {
|
|
1105
|
+
if (s <= cursor && cursor < e && spanCollapsed([s, e])) {
|
|
1090
1106
|
cursor = e;
|
|
1091
1107
|
return;
|
|
1092
1108
|
}
|