@dmsdc-ai/aigentry-telepty 0.1.13 → 0.1.14
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.js +28 -24
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -57,23 +57,27 @@ function startDetachedDaemon() {
|
|
|
57
57
|
cp.unref();
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
NO_UPDATE_NOTIFIER: '1',
|
|
67
|
-
TELEPTY_DISABLE_UPDATE_NOTIFIER: '1'
|
|
68
|
-
}
|
|
69
|
-
});
|
|
60
|
+
function renderInteractiveHeader() {
|
|
61
|
+
const runtimeInfo = getRuntimeInfo(__dirname);
|
|
62
|
+
console.clear();
|
|
63
|
+
console.log('\x1b[36m\x1b[1m⚡ Telepty Agent Manager\x1b[0m\n');
|
|
64
|
+
console.log(`\x1b[90mVersion ${runtimeInfo.version} Updated ${runtimeInfo.updatedAtLabel}\x1b[0m\n`);
|
|
65
|
+
}
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
function runUpdateInstall() {
|
|
68
|
+
if (process.env.TELEPTY_SKIP_PACKAGE_UPDATE === '1') {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const updateCommand = process.env.TELEPTY_UPDATE_COMMAND || 'npm install -g @dmsdc-ai/aigentry-telepty@latest';
|
|
73
|
+
execSync(updateCommand, { stdio: 'inherit' });
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
async function repairLocalDaemon(options = {}) {
|
|
77
|
+
if (process.env.TELEPTY_SKIP_DAEMON_REPAIR === '1') {
|
|
78
|
+
return { stopped: 0, failed: 0, meta: null, skipped: true };
|
|
79
|
+
}
|
|
80
|
+
|
|
77
81
|
const restart = options.restart !== false;
|
|
78
82
|
const results = cleanupDaemonProcesses();
|
|
79
83
|
|
|
@@ -243,10 +247,7 @@ async function manageInteractiveAttach(sessionId, targetHost) {
|
|
|
243
247
|
}
|
|
244
248
|
|
|
245
249
|
async function manageInteractive() {
|
|
246
|
-
|
|
247
|
-
console.clear();
|
|
248
|
-
console.log('\x1b[36m\x1b[1m⚡ Telepty Agent Manager\x1b[0m\n');
|
|
249
|
-
console.log(`\x1b[90mVersion ${runtimeInfo.version} Updated ${runtimeInfo.updatedAtLabel}\x1b[0m\n`);
|
|
250
|
+
renderInteractiveHeader();
|
|
250
251
|
|
|
251
252
|
while (true) {
|
|
252
253
|
const response = await prompts({
|
|
@@ -269,12 +270,15 @@ async function manageInteractive() {
|
|
|
269
270
|
if (response.action === 'update') {
|
|
270
271
|
console.log('\n\x1b[36m🔄 Updating telepty to the latest version...\x1b[0m');
|
|
271
272
|
try {
|
|
272
|
-
|
|
273
|
+
runUpdateInstall();
|
|
273
274
|
console.log('\n\x1b[32m✅ Update complete! Restarting daemon...\x1b[0m');
|
|
274
|
-
await repairLocalDaemon({ restart: true });
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
const repairResult = await repairLocalDaemon({ restart: true });
|
|
276
|
+
if (repairResult.skipped) {
|
|
277
|
+
console.log('\x1b[36m↻ Refreshing telepty without daemon restart...\x1b[0m\n');
|
|
278
|
+
} else {
|
|
279
|
+
console.log('\x1b[36m↻ Returning to telepty...\x1b[0m\n');
|
|
280
|
+
}
|
|
281
|
+
renderInteractiveHeader();
|
|
278
282
|
} catch (e) {
|
|
279
283
|
console.error(`\n❌ Update failed: ${e.message}\n`);
|
|
280
284
|
}
|
|
@@ -429,9 +433,9 @@ async function main() {
|
|
|
429
433
|
if (cmd === 'update') {
|
|
430
434
|
console.log('\x1b[36m🔄 Updating telepty to the latest version...\x1b[0m');
|
|
431
435
|
try {
|
|
432
|
-
|
|
436
|
+
runUpdateInstall();
|
|
433
437
|
console.log('\n\x1b[32m✅ Update complete! Restarting daemon...\x1b[0m');
|
|
434
|
-
|
|
438
|
+
await repairLocalDaemon({ restart: true });
|
|
435
439
|
console.log('🎉 You are now using the latest version.');
|
|
436
440
|
} catch (e) {
|
|
437
441
|
console.error('\n❌ Update failed. Please try running: npm install -g @dmsdc-ai/aigentry-telepty@latest');
|