@vendian/cli 0.0.29 → 0.0.30
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/cli-wrapper.mjs +41 -9
- package/package.json +1 -1
package/cli-wrapper.mjs
CHANGED
|
@@ -1107,7 +1107,7 @@ import path8 from "node:path";
|
|
|
1107
1107
|
import readlinePromises from "node:readline/promises";
|
|
1108
1108
|
|
|
1109
1109
|
// src/version.js
|
|
1110
|
-
var CLI_VERSION = true ? "0.0.
|
|
1110
|
+
var CLI_VERSION = true ? "0.0.30" : process.env.npm_package_version || "0.0.0-dev";
|
|
1111
1111
|
|
|
1112
1112
|
// src/npm-update.js
|
|
1113
1113
|
var NPM_CHECK_INTERVAL_MS = 30 * 60 * 1e3;
|
|
@@ -3253,7 +3253,7 @@ async function runServeDashboard({ env, platform, agentsDir, collectionId }) {
|
|
|
3253
3253
|
if (dashboardClosed || exitPromptActive || agents.length === 0 || idx !== clampedIdx) return;
|
|
3254
3254
|
overlayActive = true;
|
|
3255
3255
|
const ag = agents[clampedIdx];
|
|
3256
|
-
showAgentLog({ agent: ag, state, env, platform }).then(() => {
|
|
3256
|
+
showAgentLog({ agent: ag, getState: () => state, env, platform }).then(() => {
|
|
3257
3257
|
if (dashboardClosed) return;
|
|
3258
3258
|
overlayActive = false;
|
|
3259
3259
|
term.clear();
|
|
@@ -3411,14 +3411,23 @@ async function runServeDashboard({ env, platform, agentsDir, collectionId }) {
|
|
|
3411
3411
|
}
|
|
3412
3412
|
});
|
|
3413
3413
|
}
|
|
3414
|
-
async function showAgentLog({ agent,
|
|
3415
|
-
const
|
|
3416
|
-
const agentObj = state.agents.find((a) => (a.relativePath || ".") === agent.path);
|
|
3417
|
-
const runtime = agentObj ? agentRuntimeStatus(agentObj, state.agentRunState) : { status: "unknown", label: "offline" };
|
|
3418
|
-
const status = friendlyStatus(runtime.status);
|
|
3414
|
+
async function showAgentLog({ agent, getState, env, platform }) {
|
|
3415
|
+
const liveState = typeof getState === "function" ? getState : () => getState;
|
|
3419
3416
|
let scrollOffset = 0;
|
|
3417
|
+
let autoScroll = true;
|
|
3420
3418
|
const visibleCount = Math.max(8, (term.height || 24) - 14);
|
|
3419
|
+
function currentLogs() {
|
|
3420
|
+
return agentLogEntries(liveState().agentLogs, agent.path);
|
|
3421
|
+
}
|
|
3421
3422
|
function draw() {
|
|
3423
|
+
const state = liveState();
|
|
3424
|
+
const logs = currentLogs();
|
|
3425
|
+
const agentObj = state.agents.find((a) => (a.relativePath || ".") === agent.path);
|
|
3426
|
+
const runtime = agentObj ? agentRuntimeStatus(agentObj, state.agentRunState) : { status: "unknown", label: "offline" };
|
|
3427
|
+
const status = friendlyStatus(runtime.status);
|
|
3428
|
+
if (autoScroll) {
|
|
3429
|
+
scrollOffset = Math.max(0, logs.length - visibleCount);
|
|
3430
|
+
}
|
|
3422
3431
|
term.clear();
|
|
3423
3432
|
drawHeader({ env, platform, serveState: state });
|
|
3424
3433
|
term("\n");
|
|
@@ -3483,27 +3492,50 @@ async function showAgentLog({ agent, state, env, platform }) {
|
|
|
3483
3492
|
term.gray(" scroll ");
|
|
3484
3493
|
term.brightBlue.bold("PgUp/PgDn");
|
|
3485
3494
|
term.gray(" page ");
|
|
3486
|
-
|
|
3487
|
-
|
|
3495
|
+
if (autoScroll) {
|
|
3496
|
+
term.brightBlue.bold("Esc");
|
|
3497
|
+
term.gray(" back ");
|
|
3498
|
+
term.cyan("\u2193 live\n");
|
|
3499
|
+
} else {
|
|
3500
|
+
term.brightBlue.bold("Esc");
|
|
3501
|
+
term.gray(" back ");
|
|
3502
|
+
term.gray("\u2193 ");
|
|
3503
|
+
term.brightBlue.bold("End");
|
|
3504
|
+
term.gray(" resume live\n");
|
|
3505
|
+
}
|
|
3488
3506
|
}
|
|
3489
3507
|
draw();
|
|
3508
|
+
let overlayDone = false;
|
|
3509
|
+
const redrawInterval = setInterval(() => {
|
|
3510
|
+
if (!overlayDone) draw();
|
|
3511
|
+
}, 500);
|
|
3490
3512
|
await new Promise((resolve) => {
|
|
3491
3513
|
function handler(name) {
|
|
3514
|
+
const logs = currentLogs();
|
|
3492
3515
|
const maxOff = Math.max(0, logs.length - visibleCount);
|
|
3493
3516
|
if (name === "ESCAPE") {
|
|
3494
3517
|
term.off("key", handler);
|
|
3518
|
+
overlayDone = true;
|
|
3519
|
+
clearInterval(redrawInterval);
|
|
3495
3520
|
resolve();
|
|
3496
3521
|
} else if (name === "UP") {
|
|
3522
|
+
autoScroll = false;
|
|
3497
3523
|
scrollOffset = Math.max(0, scrollOffset - 1);
|
|
3498
3524
|
draw();
|
|
3499
3525
|
} else if (name === "DOWN") {
|
|
3500
3526
|
scrollOffset = Math.min(maxOff, scrollOffset + 1);
|
|
3527
|
+
if (scrollOffset >= maxOff) autoScroll = true;
|
|
3501
3528
|
draw();
|
|
3502
3529
|
} else if (name === "PAGE_UP") {
|
|
3530
|
+
autoScroll = false;
|
|
3503
3531
|
scrollOffset = Math.max(0, scrollOffset - visibleCount);
|
|
3504
3532
|
draw();
|
|
3505
3533
|
} else if (name === "PAGE_DOWN") {
|
|
3506
3534
|
scrollOffset = Math.min(maxOff, scrollOffset + visibleCount);
|
|
3535
|
+
if (scrollOffset >= maxOff) autoScroll = true;
|
|
3536
|
+
draw();
|
|
3537
|
+
} else if (name === "END") {
|
|
3538
|
+
autoScroll = true;
|
|
3507
3539
|
draw();
|
|
3508
3540
|
}
|
|
3509
3541
|
}
|