@dmsdc-ai/aigentry-telepty 0.1.9 → 0.1.10
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/README.md +6 -0
- package/cli.js +13 -5
- package/interactive-terminal.js +18 -1
- package/package.json +5 -4
- package/runtime-info.js +41 -0
package/README.md
CHANGED
|
@@ -20,6 +20,12 @@ Open PowerShell as Administrator and run:
|
|
|
20
20
|
iwr -useb https://raw.githubusercontent.com/dmsdc-ai/aigentry-telepty/main/install.ps1 | iex
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
You can also launch the installer through npm without downloading the script first:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx --yes @dmsdc-ai/aigentry-telepty@latest
|
|
27
|
+
```
|
|
28
|
+
|
|
23
29
|
*These single commands will install the package globally and automatically configure it to run as a background service specific to your OS (`systemd` for Linux, `launchd` for macOS, or a detached background process for Windows).*
|
|
24
30
|
The installer now stops older local telepty daemons before starting the new one, so updates do not leave duplicate background processes behind.
|
|
25
31
|
|
package/cli.js
CHANGED
|
@@ -10,7 +10,8 @@ const updateNotifier = require('update-notifier');
|
|
|
10
10
|
const pkg = require('./package.json');
|
|
11
11
|
const { getConfig } = require('./auth');
|
|
12
12
|
const { cleanupDaemonProcesses } = require('./daemon-control');
|
|
13
|
-
const { attachInteractiveTerminal } = require('./interactive-terminal');
|
|
13
|
+
const { attachInteractiveTerminal, getTerminalSize } = require('./interactive-terminal');
|
|
14
|
+
const { getRuntimeInfo } = require('./runtime-info');
|
|
14
15
|
const { runInteractiveSkillInstaller } = require('./skill-installer');
|
|
15
16
|
const args = process.argv.slice(2);
|
|
16
17
|
|
|
@@ -144,7 +145,10 @@ async function manageInteractiveAttach(sessionId, targetHost) {
|
|
|
144
145
|
console.log(`\n\x1b[32mEntered room '${sessionId}'.\x1b[0m\n`);
|
|
145
146
|
cleanupTerminal = attachInteractiveTerminal(process.stdin, process.stdout, {
|
|
146
147
|
onData: (d) => ws.send(JSON.stringify({ type: 'input', data: d.toString() })),
|
|
147
|
-
onResize: () =>
|
|
148
|
+
onResize: () => {
|
|
149
|
+
const size = getTerminalSize(process.stdout, { cols: 80, rows: 30 });
|
|
150
|
+
ws.send(JSON.stringify({ type: 'resize', cols: size.cols, rows: size.rows }));
|
|
151
|
+
}
|
|
148
152
|
});
|
|
149
153
|
});
|
|
150
154
|
ws.on('message', m => {
|
|
@@ -178,8 +182,10 @@ async function manageInteractiveAttach(sessionId, targetHost) {
|
|
|
178
182
|
}
|
|
179
183
|
|
|
180
184
|
async function manageInteractive() {
|
|
185
|
+
const runtimeInfo = getRuntimeInfo(__dirname);
|
|
181
186
|
console.clear();
|
|
182
187
|
console.log('\x1b[36m\x1b[1m⚡ Telepty Agent Manager\x1b[0m\n');
|
|
188
|
+
console.log(`\x1b[90mVersion ${runtimeInfo.version} Updated ${runtimeInfo.updatedAtLabel}\x1b[0m\n`);
|
|
183
189
|
|
|
184
190
|
while (true) {
|
|
185
191
|
const response = await prompts({
|
|
@@ -518,7 +524,8 @@ async function main() {
|
|
|
518
524
|
child.write(data.toString());
|
|
519
525
|
},
|
|
520
526
|
onResize: () => {
|
|
521
|
-
|
|
527
|
+
const size = getTerminalSize(process.stdout, { cols: 120, rows: 40 });
|
|
528
|
+
child.resize(size.cols, size.rows);
|
|
522
529
|
}
|
|
523
530
|
});
|
|
524
531
|
|
|
@@ -594,10 +601,11 @@ async function main() {
|
|
|
594
601
|
ws.send(JSON.stringify({ type: 'input', data: data.toString() }));
|
|
595
602
|
},
|
|
596
603
|
onResize: () => {
|
|
604
|
+
const size = getTerminalSize(process.stdout, { cols: 80, rows: 30 });
|
|
597
605
|
ws.send(JSON.stringify({
|
|
598
606
|
type: 'resize',
|
|
599
|
-
cols:
|
|
600
|
-
rows:
|
|
607
|
+
cols: size.cols,
|
|
608
|
+
rows: size.rows
|
|
601
609
|
}));
|
|
602
610
|
}
|
|
603
611
|
});
|
package/interactive-terminal.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
function getTerminalSize(output, fallback = {}) {
|
|
4
|
+
const envCols = Number.parseInt(process.env.COLUMNS || '', 10);
|
|
5
|
+
const envRows = Number.parseInt(process.env.LINES || '', 10);
|
|
6
|
+
const fallbackCols = Number.isInteger(fallback.cols) && fallback.cols > 0 ? fallback.cols : 120;
|
|
7
|
+
const fallbackRows = Number.isInteger(fallback.rows) && fallback.rows > 0 ? fallback.rows : 40;
|
|
8
|
+
|
|
9
|
+
const cols = Number.isInteger(output && output.columns) && output.columns > 0
|
|
10
|
+
? output.columns
|
|
11
|
+
: (Number.isInteger(envCols) && envCols > 0 ? envCols : fallbackCols);
|
|
12
|
+
const rows = Number.isInteger(output && output.rows) && output.rows > 0
|
|
13
|
+
? output.rows
|
|
14
|
+
: (Number.isInteger(envRows) && envRows > 0 ? envRows : fallbackRows);
|
|
15
|
+
|
|
16
|
+
return { cols, rows };
|
|
17
|
+
}
|
|
18
|
+
|
|
3
19
|
function removeListener(stream, eventName, handler) {
|
|
4
20
|
if (!handler || !stream) {
|
|
5
21
|
return;
|
|
@@ -50,5 +66,6 @@ function attachInteractiveTerminal(input, output, handlers = {}) {
|
|
|
50
66
|
}
|
|
51
67
|
|
|
52
68
|
module.exports = {
|
|
53
|
-
attachInteractiveTerminal
|
|
69
|
+
attachInteractiveTerminal,
|
|
70
|
+
getTerminalSize
|
|
54
71
|
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dmsdc-ai/aigentry-telepty",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"main": "daemon.js",
|
|
5
5
|
"bin": {
|
|
6
|
+
"aigentry-telepty": "install.js",
|
|
6
7
|
"telepty": "cli.js",
|
|
7
8
|
"telepty-install": "install.js"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
10
|
-
"test": "node --test test/auth.test.js test/daemon.test.js test/daemon-singleton.test.js test/cli.test.js test/skill-installer.test.js test/interactive-terminal.test.js",
|
|
11
|
-
"test:watch": "node --test --watch test/auth.test.js test/daemon.test.js test/daemon-singleton.test.js test/cli.test.js test/skill-installer.test.js test/interactive-terminal.test.js",
|
|
12
|
-
"test:ci": "node --test --test-reporter=spec test/auth.test.js test/daemon.test.js test/daemon-singleton.test.js test/cli.test.js test/skill-installer.test.js test/interactive-terminal.test.js"
|
|
11
|
+
"test": "node --test test/auth.test.js test/daemon.test.js test/daemon-singleton.test.js test/cli.test.js test/skill-installer.test.js test/interactive-terminal.test.js test/runtime-info.test.js",
|
|
12
|
+
"test:watch": "node --test --watch test/auth.test.js test/daemon.test.js test/daemon-singleton.test.js test/cli.test.js test/skill-installer.test.js test/interactive-terminal.test.js test/runtime-info.test.js",
|
|
13
|
+
"test:ci": "node --test --test-reporter=spec test/auth.test.js test/daemon.test.js test/daemon-singleton.test.js test/cli.test.js test/skill-installer.test.js test/interactive-terminal.test.js test/runtime-info.test.js"
|
|
13
14
|
},
|
|
14
15
|
"keywords": [],
|
|
15
16
|
"author": "",
|
package/runtime-info.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
function pad(value) {
|
|
7
|
+
return String(value).padStart(2, '0');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function formatTimestamp(date) {
|
|
11
|
+
const year = date.getFullYear();
|
|
12
|
+
const month = pad(date.getMonth() + 1);
|
|
13
|
+
const day = pad(date.getDate());
|
|
14
|
+
const hours = pad(date.getHours());
|
|
15
|
+
const minutes = pad(date.getMinutes());
|
|
16
|
+
const seconds = pad(date.getSeconds());
|
|
17
|
+
const offsetMinutes = -date.getTimezoneOffset();
|
|
18
|
+
const sign = offsetMinutes >= 0 ? '+' : '-';
|
|
19
|
+
const absoluteOffset = Math.abs(offsetMinutes);
|
|
20
|
+
const offsetHours = pad(Math.floor(absoluteOffset / 60));
|
|
21
|
+
const offsetRemainder = pad(absoluteOffset % 60);
|
|
22
|
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds} ${sign}${offsetHours}:${offsetRemainder}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getRuntimeInfo(packageRoot = __dirname) {
|
|
26
|
+
const packageJsonPath = path.join(packageRoot, 'package.json');
|
|
27
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
28
|
+
const packageStat = fs.statSync(packageJsonPath);
|
|
29
|
+
const updatedAt = packageStat.mtime;
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
version: pkg.version || 'unknown',
|
|
33
|
+
updatedAt,
|
|
34
|
+
updatedAtLabel: formatTimestamp(updatedAt)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = {
|
|
39
|
+
formatTimestamp,
|
|
40
|
+
getRuntimeInfo
|
|
41
|
+
};
|