@oxecli/oxe 1.0.41 → 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 +15 -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")) {
|
|
@@ -420,7 +430,7 @@ export class CLI {
|
|
|
420
430
|
if (err?.message === "interrupt") {
|
|
421
431
|
const wasActive = queryStarted || engine.inQuery;
|
|
422
432
|
if (wasActive && !engine.queryHasOutput) {
|
|
423
|
-
process.stdout.write(aiMarkdown("What else can I help with?") + "\n
|
|
433
|
+
process.stdout.write(aiMarkdown("What else can I help with?") + "\n");
|
|
424
434
|
}
|
|
425
435
|
engine.inQuery = false;
|
|
426
436
|
// Drop the pending user message/story entry that was never run.
|