@oxecli/oxe 1.0.40 → 1.0.42
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.js +17 -4
- package/dist/engine.js +0 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { loadOrPrompt, default_reasoning_effort, max_action_chars, max_resume_history_items, } from "./config.js";
|
|
4
|
+
import { loadOrPrompt, default_reasoning_effort, default_model, max_action_chars, max_resume_history_items, } from "./config.js";
|
|
4
5
|
import { InferenceEngine, estimateTokens } from "./engine.js";
|
|
5
6
|
import { saveSession, loadSession, listSessions, nextSessionId, conversationLabel, COMMAND_HELP, toolOutputFailed, } from "./sessions.js";
|
|
6
7
|
import { clearScreen, enableAnsi, askBottomPrompt, userDisplayText, aiMarkdown, mutedMarkdown, messageText, formatToolAction, truncateEllipsis, renderPanel, renderTableString, enableRawStdin, disableRawStdin, waitRawKey, } from "./ui.js";
|
|
7
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
const packageInfo = require("../package.json");
|
|
8
11
|
function truncateLabel(s) {
|
|
9
12
|
const t = String(s || "(conversation)").trim();
|
|
10
13
|
return t.length > 60 ? t.slice(0, 57) + "..." : t;
|
|
@@ -18,9 +21,16 @@ export class CLI {
|
|
|
18
21
|
interruptPending = false;
|
|
19
22
|
constructor() {
|
|
20
23
|
clearScreen();
|
|
21
|
-
|
|
24
|
+
this.renderHeader();
|
|
22
25
|
this.config = null;
|
|
23
26
|
}
|
|
27
|
+
renderHeader(model = default_model) {
|
|
28
|
+
const version = packageInfo.version ?? "unknown";
|
|
29
|
+
renderPanel("[bold white]Terminal coding agent[/bold white]\n\n" +
|
|
30
|
+
`[dim]Version[/dim] ${version}\n` +
|
|
31
|
+
`[dim]Model[/dim] ${model}\n` +
|
|
32
|
+
`[dim]Engine[/dim] Ready`, "Oxe", "", false, "90", "left");
|
|
33
|
+
}
|
|
24
34
|
saveSession(engine) {
|
|
25
35
|
if (!this.inputItems.length)
|
|
26
36
|
return;
|
|
@@ -333,7 +343,7 @@ export class CLI {
|
|
|
333
343
|
this.sessionId = sid;
|
|
334
344
|
engine.reasoningEffort = String(rec["reasoning_effort"] ?? default_reasoning_effort);
|
|
335
345
|
clearScreen();
|
|
336
|
-
|
|
346
|
+
this.renderHeader(engine.modelName);
|
|
337
347
|
process.stdout.write("\n");
|
|
338
348
|
process.stdout.write(`\x1b[2mResumed:\x1b[0m ${truncateLabel(rec["label"])}\n`);
|
|
339
349
|
process.stdout.write("\n");
|
|
@@ -375,7 +385,7 @@ export class CLI {
|
|
|
375
385
|
this.story = [];
|
|
376
386
|
this.sessionId = null;
|
|
377
387
|
clearScreen();
|
|
378
|
-
|
|
388
|
+
this.renderHeader(engine.modelName);
|
|
379
389
|
continue;
|
|
380
390
|
}
|
|
381
391
|
if (lower.startsWith("/resume")) {
|
|
@@ -419,6 +429,9 @@ export class CLI {
|
|
|
419
429
|
}
|
|
420
430
|
if (err?.message === "interrupt") {
|
|
421
431
|
const wasActive = queryStarted || engine.inQuery;
|
|
432
|
+
if (wasActive && !engine.queryHasOutput) {
|
|
433
|
+
process.stdout.write(aiMarkdown("What else can I help with?") + "\n");
|
|
434
|
+
}
|
|
422
435
|
engine.inQuery = false;
|
|
423
436
|
// Drop the pending user message/story entry that was never run.
|
|
424
437
|
if (this.inputItems.length && this.inputItems[this.inputItems.length - 1]["role"] === "user") {
|
package/dist/engine.js
CHANGED
|
@@ -614,11 +614,6 @@ export class InferenceEngine {
|
|
|
614
614
|
if (this.interrupted) {
|
|
615
615
|
this.workActive = false;
|
|
616
616
|
this.workRows = 0;
|
|
617
|
-
if (!this.queryHasOutput) {
|
|
618
|
-
const fallback = "What else can I help with?";
|
|
619
|
-
process.stdout.write(aiMarkdown(fallback) + "\n\n");
|
|
620
|
-
story.push({ type: "assistant", text: fallback });
|
|
621
|
-
}
|
|
622
617
|
}
|
|
623
618
|
if (this.interrupted)
|
|
624
619
|
throw new Error("interrupt");
|