@dmsdc-ai/aigentry-telepty 0.0.9 → 0.0.11
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/.github/workflows/test-install.yml +32 -0
- package/cli.js +31 -5
- package/install.ps1 +10 -10
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Test Installation Scripts
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [ "main" ]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [ "main" ]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test-windows:
|
|
10
|
+
runs-on: windows-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v3
|
|
13
|
+
- name: Run Install Script
|
|
14
|
+
shell: powershell
|
|
15
|
+
run: |
|
|
16
|
+
./install.ps1
|
|
17
|
+
|
|
18
|
+
test-ubuntu:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v3
|
|
22
|
+
- name: Run Install Script
|
|
23
|
+
run: |
|
|
24
|
+
bash ./install.sh
|
|
25
|
+
|
|
26
|
+
test-macos:
|
|
27
|
+
runs-on: macos-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v3
|
|
30
|
+
- name: Run Install Script
|
|
31
|
+
run: |
|
|
32
|
+
bash ./install.sh
|
package/cli.js
CHANGED
|
@@ -60,6 +60,25 @@ async function discoverSessions() {
|
|
|
60
60
|
return allSessions;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
async function ensureDaemonRunning() {
|
|
64
|
+
if (REMOTE_HOST !== '127.0.0.1') return; // Only auto-start local daemon
|
|
65
|
+
try {
|
|
66
|
+
const res = await fetchWithAuth(`${DAEMON_URL}/api/sessions`);
|
|
67
|
+
if (res.ok) return; // Already running
|
|
68
|
+
} catch (e) {
|
|
69
|
+
// Not running, let's start it
|
|
70
|
+
process.stdout.write('\x1b[33m⚙️ Auto-starting local telepty daemon...\x1b[0m\n');
|
|
71
|
+
const cp = spawn(process.argv[0], [process.argv[1], 'daemon'], {
|
|
72
|
+
detached: true,
|
|
73
|
+
stdio: 'ignore'
|
|
74
|
+
});
|
|
75
|
+
cp.unref();
|
|
76
|
+
|
|
77
|
+
// Wait a brief moment for the daemon to boot up
|
|
78
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
63
82
|
async function manageInteractive() {
|
|
64
83
|
console.clear();
|
|
65
84
|
console.log('\x1b[36m\x1b[1m⚡ Telepty Agent Manager\x1b[0m\n');
|
|
@@ -70,11 +89,10 @@ async function manageInteractive() {
|
|
|
70
89
|
name: 'action',
|
|
71
90
|
message: 'What would you like to do?',
|
|
72
91
|
choices: [
|
|
73
|
-
{ title: '
|
|
74
|
-
{ title: '
|
|
75
|
-
{ title: '
|
|
76
|
-
{ title: '📋 List
|
|
77
|
-
{ title: '⚙️ Start background daemon', value: 'daemon' },
|
|
92
|
+
{ title: '🖥️ Enter a room (Attach to session)', value: 'attach' },
|
|
93
|
+
{ title: '➕ Create a new room (Spawn session)', value: 'spawn' },
|
|
94
|
+
{ title: '💬 Send message to a room (Inject command)', value: 'inject' },
|
|
95
|
+
{ title: '📋 View all open rooms (List sessions)', value: 'list' },
|
|
78
96
|
{ title: '❌ Exit', value: 'exit' }
|
|
79
97
|
]
|
|
80
98
|
});
|
|
@@ -118,6 +136,8 @@ async function manageInteractive() {
|
|
|
118
136
|
]);
|
|
119
137
|
if (!id || !command) continue;
|
|
120
138
|
|
|
139
|
+
await ensureDaemonRunning();
|
|
140
|
+
|
|
121
141
|
const cols = process.stdout.columns || 80;
|
|
122
142
|
const rows = process.stdout.rows || 30;
|
|
123
143
|
try {
|
|
@@ -218,6 +238,7 @@ async function main() {
|
|
|
218
238
|
}
|
|
219
239
|
|
|
220
240
|
if (cmd === 'list') {
|
|
241
|
+
await ensureDaemonRunning();
|
|
221
242
|
try {
|
|
222
243
|
const res = await fetchWithAuth(`${DAEMON_URL}/api/sessions`);
|
|
223
244
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
@@ -239,6 +260,7 @@ async function main() {
|
|
|
239
260
|
}
|
|
240
261
|
|
|
241
262
|
if (cmd === 'spawn') {
|
|
263
|
+
await ensureDaemonRunning();
|
|
242
264
|
const idIndex = args.indexOf('--id');
|
|
243
265
|
if (idIndex === -1 || !args[idIndex + 1]) { console.error('❌ Usage: telepty spawn --id <session_id> <command> [args...]'); process.exit(1); }
|
|
244
266
|
const sessionId = args[idIndex + 1];
|
|
@@ -262,6 +284,7 @@ async function main() {
|
|
|
262
284
|
}
|
|
263
285
|
|
|
264
286
|
if (cmd === 'attach') {
|
|
287
|
+
await ensureDaemonRunning();
|
|
265
288
|
let sessionId = args[1];
|
|
266
289
|
let targetHost = REMOTE_HOST;
|
|
267
290
|
|
|
@@ -342,6 +365,7 @@ async function main() {
|
|
|
342
365
|
}
|
|
343
366
|
|
|
344
367
|
if (cmd === 'inject') {
|
|
368
|
+
await ensureDaemonRunning();
|
|
345
369
|
const sessionId = args[1]; const prompt = args.slice(2).join(' ');
|
|
346
370
|
if (!sessionId || !prompt) { console.error('❌ Usage: telepty inject <session_id> "<prompt text>"'); process.exit(1); }
|
|
347
371
|
try {
|
|
@@ -356,6 +380,7 @@ async function main() {
|
|
|
356
380
|
}
|
|
357
381
|
|
|
358
382
|
if (cmd === 'multicast') {
|
|
383
|
+
await ensureDaemonRunning();
|
|
359
384
|
const sessionIdsRaw = args[1]; const prompt = args.slice(2).join(' ');
|
|
360
385
|
if (!sessionIdsRaw || !prompt) { console.error('❌ Usage: telepty multicast <id1,id2,...> "<prompt text>"'); process.exit(1); }
|
|
361
386
|
const sessionIds = sessionIdsRaw.split(',').map(s => s.trim()).filter(s => s);
|
|
@@ -374,6 +399,7 @@ async function main() {
|
|
|
374
399
|
}
|
|
375
400
|
|
|
376
401
|
if (cmd === 'broadcast') {
|
|
402
|
+
await ensureDaemonRunning();
|
|
377
403
|
const prompt = args.slice(1).join(' ');
|
|
378
404
|
if (!prompt) { console.error('❌ Usage: telepty broadcast "<prompt text>"'); process.exit(1); }
|
|
379
405
|
try {
|
package/install.ps1
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
Write-Host "
|
|
1
|
+
Write-Host "Installing @dmsdc-ai/aigentry-telepty..." -ForegroundColor Cyan
|
|
2
2
|
|
|
3
3
|
# 1. Check for Node.js/npm and install if missing
|
|
4
4
|
if (!(Get-Command npm -ErrorAction SilentlyContinue)) {
|
|
5
|
-
Write-Host "
|
|
5
|
+
Write-Host "Warning: Node.js/npm not found. Attempting to install via winget..." -ForegroundColor Yellow
|
|
6
6
|
if (Get-Command winget -ErrorAction SilentlyContinue) {
|
|
7
7
|
winget install OpenJS.NodeJS --accept-package-agreements --accept-source-agreements
|
|
8
|
-
Write-Host "
|
|
8
|
+
Write-Host "Refreshing environment variables..." -ForegroundColor Cyan
|
|
9
9
|
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
|
10
10
|
} else {
|
|
11
|
-
Write-Host "
|
|
11
|
+
Write-Host "Error: winget not found. Please install Node.js manually: https://nodejs.org/" -ForegroundColor Red
|
|
12
12
|
exit 1
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
# 2. Install telepty via npm
|
|
17
|
-
Write-Host "
|
|
17
|
+
Write-Host "Installing telepty globally..." -ForegroundColor Cyan
|
|
18
18
|
npm install -g @dmsdc-ai/aigentry-telepty
|
|
19
19
|
|
|
20
20
|
# 3. Setup Daemon
|
|
21
|
-
Write-Host "
|
|
21
|
+
Write-Host "Setting up Windows background process..." -ForegroundColor Cyan
|
|
22
22
|
$teleptyCmd = Get-Command telepty -ErrorAction SilentlyContinue
|
|
23
23
|
if (!$teleptyCmd) {
|
|
24
|
-
Write-Host "
|
|
24
|
+
Write-Host "Error: Failed to locate telepty executable after installation." -ForegroundColor Red
|
|
25
25
|
exit 1
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
$teleptyPath = $teleptyCmd.Source
|
|
29
29
|
Start-Process -FilePath node -ArgumentList "$teleptyPath daemon" -WindowStyle Hidden
|
|
30
|
-
Write-Host "
|
|
30
|
+
Write-Host "Success: Windows daemon started in background." -ForegroundColor Green
|
|
31
31
|
|
|
32
|
-
Write-Host "`
|
|
33
|
-
Write-Host "
|
|
32
|
+
Write-Host "`nInstallation complete! Telepty daemon is running." -ForegroundColor Cyan
|
|
33
|
+
Write-Host "Next step: Try running: telepty attach" -ForegroundColor Yellow
|