@vendian/cli 0.0.25 → 0.0.26
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 +36 -20
- 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.26" : 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;
|
|
@@ -2823,6 +2823,8 @@ async function runServeDashboard({ env, platform, agentsDir, collectionId }) {
|
|
|
2823
2823
|
let overlayActive = false;
|
|
2824
2824
|
let ctrlCArmed = false;
|
|
2825
2825
|
let ctrlCArmTimer = null;
|
|
2826
|
+
let dashboardClosed = false;
|
|
2827
|
+
let exitPromptActive = false;
|
|
2826
2828
|
let selectedIdx = 0;
|
|
2827
2829
|
const agentRowMap = /* @__PURE__ */ new Map();
|
|
2828
2830
|
function agentDisplayList() {
|
|
@@ -2850,7 +2852,7 @@ async function runServeDashboard({ env, platform, agentsDir, collectionId }) {
|
|
|
2850
2852
|
return serveDebugEntries(state.logs, maxLines);
|
|
2851
2853
|
}
|
|
2852
2854
|
function redraw() {
|
|
2853
|
-
if (overlayActive) return;
|
|
2855
|
+
if (dashboardClosed || overlayActive) return;
|
|
2854
2856
|
drawHeader({ env, platform, serveState: state });
|
|
2855
2857
|
term.moveTo(1, SERVE_CONTENT_ROW);
|
|
2856
2858
|
term.eraseDisplayBelow();
|
|
@@ -3022,6 +3024,7 @@ async function runServeDashboard({ env, platform, agentsDir, collectionId }) {
|
|
|
3022
3024
|
env,
|
|
3023
3025
|
platform,
|
|
3024
3026
|
onProgress: (msg) => {
|
|
3027
|
+
if (dashboardClosed) return;
|
|
3025
3028
|
state = { ...state, activity: msg || "Preparing\u2026" };
|
|
3026
3029
|
redraw();
|
|
3027
3030
|
}
|
|
@@ -3031,10 +3034,12 @@ async function runServeDashboard({ env, platform, agentsDir, collectionId }) {
|
|
|
3031
3034
|
attachServeChild(
|
|
3032
3035
|
child,
|
|
3033
3036
|
(updater) => {
|
|
3037
|
+
if (dashboardClosed) return;
|
|
3034
3038
|
state = updater(state);
|
|
3035
3039
|
redraw();
|
|
3036
3040
|
},
|
|
3037
3041
|
({ message } = {}) => {
|
|
3042
|
+
if (dashboardClosed) return;
|
|
3038
3043
|
if (!state.stopped) state = { ...state, stopped: true, activity: message || "Stopped" };
|
|
3039
3044
|
redraw();
|
|
3040
3045
|
},
|
|
@@ -3046,23 +3051,39 @@ async function runServeDashboard({ env, platform, agentsDir, collectionId }) {
|
|
|
3046
3051
|
}
|
|
3047
3052
|
return new Promise((resolve) => {
|
|
3048
3053
|
function openAgentLog(idx) {
|
|
3049
|
-
if (idx < 0 || idx >= state.agents.length) return;
|
|
3054
|
+
if (dashboardClosed || exitPromptActive || idx < 0 || idx >= state.agents.length) return;
|
|
3050
3055
|
overlayActive = true;
|
|
3051
3056
|
const ag = agentDisplayList()[idx];
|
|
3052
3057
|
showAgentLog({ agent: ag, state, env, platform }).then(() => {
|
|
3058
|
+
if (dashboardClosed) return;
|
|
3053
3059
|
overlayActive = false;
|
|
3054
3060
|
term.clear();
|
|
3055
3061
|
redraw();
|
|
3056
3062
|
});
|
|
3057
3063
|
}
|
|
3064
|
+
function clearCtrlCArm() {
|
|
3065
|
+
ctrlCArmed = false;
|
|
3066
|
+
if (ctrlCArmTimer) {
|
|
3067
|
+
clearTimeout(ctrlCArmTimer);
|
|
3068
|
+
ctrlCArmTimer = null;
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
function detachDashboardHandlers() {
|
|
3072
|
+
term.off("key", handleKey);
|
|
3073
|
+
term.off("mouse", handleMouse);
|
|
3074
|
+
}
|
|
3075
|
+
function finish(next) {
|
|
3076
|
+
if (dashboardClosed) return;
|
|
3077
|
+
dashboardClosed = true;
|
|
3078
|
+
clearCtrlCArm();
|
|
3079
|
+
detachDashboardHandlers();
|
|
3080
|
+
resolve(next);
|
|
3081
|
+
}
|
|
3058
3082
|
function handleKey(name) {
|
|
3059
3083
|
if (name === "CTRL_C") {
|
|
3060
3084
|
if (ctrlCArmed) {
|
|
3061
|
-
clearTimeout(ctrlCArmTimer);
|
|
3062
3085
|
child?.kill("SIGINT");
|
|
3063
|
-
|
|
3064
|
-
term.off("mouse", handleMouse);
|
|
3065
|
-
resolve("exit");
|
|
3086
|
+
finish("exit");
|
|
3066
3087
|
return;
|
|
3067
3088
|
}
|
|
3068
3089
|
ctrlCArmed = true;
|
|
@@ -3089,9 +3110,7 @@ async function runServeDashboard({ env, platform, agentsDir, collectionId }) {
|
|
|
3089
3110
|
openAgentLog(selectedIdx);
|
|
3090
3111
|
} else if (name === "s" || name === "S") {
|
|
3091
3112
|
child?.kill("SIGINT");
|
|
3092
|
-
|
|
3093
|
-
term.off("mouse", handleMouse);
|
|
3094
|
-
resolve("home");
|
|
3113
|
+
finish("home");
|
|
3095
3114
|
}
|
|
3096
3115
|
}
|
|
3097
3116
|
function handleMouse(name, data) {
|
|
@@ -3112,16 +3131,13 @@ async function runServeDashboard({ env, platform, agentsDir, collectionId }) {
|
|
|
3112
3131
|
if (child) {
|
|
3113
3132
|
child.once("exit", () => {
|
|
3114
3133
|
setTimeout(() => {
|
|
3115
|
-
if (
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
resolve("home");
|
|
3123
|
-
});
|
|
3124
|
-
}
|
|
3134
|
+
if (dashboardClosed || overlayActive) return;
|
|
3135
|
+
exitPromptActive = true;
|
|
3136
|
+
detachDashboardHandlers();
|
|
3137
|
+
redraw();
|
|
3138
|
+
term("\n");
|
|
3139
|
+
term.gray(" Your agents have stopped. Press any key to go back\u2026");
|
|
3140
|
+
term.once("key", () => finish("home"));
|
|
3125
3141
|
}, 600);
|
|
3126
3142
|
});
|
|
3127
3143
|
}
|