@oxecli/oxe 1.0.54 → 1.0.56

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 CHANGED
@@ -172,7 +172,7 @@ export class InferenceEngine {
172
172
  workStatus.start(`Working ${tickDuration(0)}`);
173
173
  const workTimer = setInterval(() => {
174
174
  workStatus.update(`Working ${tickDuration((Date.now() - workingStarted) / 1000)}`);
175
- }, 500);
175
+ }, 100);
176
176
  let workingReported = false;
177
177
  let response = null;
178
178
  let etype = null;
@@ -406,7 +406,7 @@ export class InferenceEngine {
406
406
  comp.start("Compacting conversation `0s`");
407
407
  const compTimer = setInterval(() => {
408
408
  comp.update(`Compacting conversation ${tickDuration((Date.now() - started) / 1000)}`);
409
- }, 500);
409
+ }, 100);
410
410
  let compacted;
411
411
  try {
412
412
  compacted = await this.compactHistory(conversation);
package/dist/ui.js CHANGED
@@ -429,12 +429,13 @@ export function renderTableString(rows, opts = {}) {
429
429
  // Durations & Text Formatting
430
430
  // ---------------------------------------------------------------------------
431
431
  export function formatDuration(seconds) {
432
- const total = Math.max(0, Math.round(seconds * 10) / 10);
433
- if (total < 60)
434
- return `${total}s`;
435
- const mins = Math.floor(total / 60);
436
- const secs = Math.round(total % 60);
437
- return `${mins}m ${secs}s`;
432
+ const s = Math.max(0, seconds);
433
+ if (s < 60) {
434
+ return `${s.toFixed(1)}s`;
435
+ }
436
+ const mins = Math.floor(s / 60);
437
+ const remSecs = (s % 60).toFixed(1);
438
+ return `${mins}m ${remSecs}s`;
438
439
  }
439
440
  export function tickDuration(seconds) {
440
441
  return `\x1b[22;37m${formatDuration(seconds)}\x1b[2m`;
@@ -829,6 +830,47 @@ export function renderBufferWithCursor(buffer, pasteSpans, prefix, label, cursor
829
830
  const totalRows = body.length + 2;
830
831
  return { frame, cursorRow, cursorCol, totalRows };
831
832
  }
833
+ export function isShiftEnterKey(str, key) {
834
+ if (!key)
835
+ return false;
836
+ const seq = key.sequence || str || "";
837
+ if (key.shift &&
838
+ (key.name === "return" ||
839
+ key.name === "enter" ||
840
+ key.name === "linefeed" ||
841
+ seq === "\r" ||
842
+ seq === "\n")) {
843
+ return true;
844
+ }
845
+ if (seq === "\x1b[13;2u" ||
846
+ seq === "\x1b[13;2~" ||
847
+ seq === "\x1b[13;2_" ||
848
+ seq === "\x1b[27;2;13~" ||
849
+ seq === "\x1bOM") {
850
+ return true;
851
+ }
852
+ if (!key.ctrl && (str === "\n" || seq === "\n" || key.name === "linefeed")) {
853
+ return true;
854
+ }
855
+ return false;
856
+ }
857
+ export const isNewlineKey = isShiftEnterKey;
858
+ export function isSubmitEnterKey(str, key) {
859
+ if (!key)
860
+ return false;
861
+ if (isShiftEnterKey(str, key))
862
+ return false;
863
+ const seq = key.sequence || str || "";
864
+ if ((key.name === "return" ||
865
+ key.name === "enter" ||
866
+ seq === "\r" ||
867
+ seq === "\x1b[13u" ||
868
+ seq === "\x1b[13;1u") &&
869
+ !key.shift) {
870
+ return true;
871
+ }
872
+ return false;
873
+ }
832
874
  export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
833
875
  return new Promise((resolve, reject) => {
834
876
  const isTTY = process.stdin.isTTY;
@@ -1106,46 +1148,6 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
1106
1148
  }
1107
1149
  }
1108
1150
  };
1109
- const isNewlineKey = (key) => {
1110
- if (!key)
1111
- return false;
1112
- if (key.ctrl && key.name === "j")
1113
- return true;
1114
- if (key.name === "enter")
1115
- return !!(key.shift || key.ctrl || key.meta);
1116
- if (key.name === "return")
1117
- return !!(key.shift || key.ctrl || key.meta);
1118
- const seq = key.sequence || "";
1119
- if (/^\x1b\[13;([2-9]|\d{2,})u$/.test(seq))
1120
- return true;
1121
- if (/^\x1b\[13;([2-9]|\d{2,})~$/.test(seq))
1122
- return true;
1123
- if (key.name === "f3" && key.shift)
1124
- return true;
1125
- return false;
1126
- };
1127
- const isModifiedEnterInput = (str, key) => {
1128
- const value = str || "";
1129
- const sequence = key?.sequence || "";
1130
- if (value === "\n" || value === "\x0a")
1131
- return true;
1132
- if (key?.name === "linefeed" || (key?.ctrl && key?.name === "j"))
1133
- return true;
1134
- return (/^\x1b\[13;(?:[2-9]|\d{2,})(?:u|~)$/.test(value) ||
1135
- /^\x1b\[13;(?:[2-9]|\d{2,})(?:u|~)$/.test(sequence));
1136
- };
1137
- const isSubmitEnterKey = (key) => {
1138
- if (!key)
1139
- return false;
1140
- if ((key.name === "return" || key.name === "enter") &&
1141
- !(key.shift || key.ctrl || key.meta)) {
1142
- return true;
1143
- }
1144
- const seq = key.sequence || "";
1145
- if (seq === "\x1b[13u" || /^\x1b\[13;1u$/.test(seq))
1146
- return true;
1147
- return false;
1148
- };
1149
1151
  const consumeBracketedPaste = (str, key) => {
1150
1152
  const start = "\x1b[200~";
1151
1153
  const end = "\x1b[201~";
@@ -1262,14 +1264,12 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
1262
1264
  repaint();
1263
1265
  return;
1264
1266
  }
1265
- if (isNewlineKey(key) ||
1266
- isModifiedEnterInput(str, key) ||
1267
- (pasteBurst && isSubmitEnterKey(key))) {
1267
+ if (isNewlineKey(str, key) || (pasteBurst && isSubmitEnterKey(str, key))) {
1268
1268
  insert("\n");
1269
1269
  repaint();
1270
1270
  return;
1271
1271
  }
1272
- if (isSubmitEnterKey(key)) {
1272
+ if (isSubmitEnterKey(str, key)) {
1273
1273
  if (buffer.trim()) {
1274
1274
  settle([buffer, pasteSpans], false);
1275
1275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxecli/oxe",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },