@dmsdc-ai/aigentry-telepty 0.0.9 → 0.0.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.
@@ -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');
@@ -118,6 +137,8 @@ async function manageInteractive() {
118
137
  ]);
119
138
  if (!id || !command) continue;
120
139
 
140
+ await ensureDaemonRunning();
141
+
121
142
  const cols = process.stdout.columns || 80;
122
143
  const rows = process.stdout.rows || 30;
123
144
  try {
@@ -218,6 +239,7 @@ async function main() {
218
239
  }
219
240
 
220
241
  if (cmd === 'list') {
242
+ await ensureDaemonRunning();
221
243
  try {
222
244
  const res = await fetchWithAuth(`${DAEMON_URL}/api/sessions`);
223
245
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
@@ -239,6 +261,7 @@ async function main() {
239
261
  }
240
262
 
241
263
  if (cmd === 'spawn') {
264
+ await ensureDaemonRunning();
242
265
  const idIndex = args.indexOf('--id');
243
266
  if (idIndex === -1 || !args[idIndex + 1]) { console.error('❌ Usage: telepty spawn --id <session_id> <command> [args...]'); process.exit(1); }
244
267
  const sessionId = args[idIndex + 1];
@@ -262,6 +285,7 @@ async function main() {
262
285
  }
263
286
 
264
287
  if (cmd === 'attach') {
288
+ await ensureDaemonRunning();
265
289
  let sessionId = args[1];
266
290
  let targetHost = REMOTE_HOST;
267
291
 
@@ -342,6 +366,7 @@ async function main() {
342
366
  }
343
367
 
344
368
  if (cmd === 'inject') {
369
+ await ensureDaemonRunning();
345
370
  const sessionId = args[1]; const prompt = args.slice(2).join(' ');
346
371
  if (!sessionId || !prompt) { console.error('❌ Usage: telepty inject <session_id> "<prompt text>"'); process.exit(1); }
347
372
  try {
@@ -356,6 +381,7 @@ async function main() {
356
381
  }
357
382
 
358
383
  if (cmd === 'multicast') {
384
+ await ensureDaemonRunning();
359
385
  const sessionIdsRaw = args[1]; const prompt = args.slice(2).join(' ');
360
386
  if (!sessionIdsRaw || !prompt) { console.error('❌ Usage: telepty multicast <id1,id2,...> "<prompt text>"'); process.exit(1); }
361
387
  const sessionIds = sessionIdsRaw.split(',').map(s => s.trim()).filter(s => s);
@@ -374,6 +400,7 @@ async function main() {
374
400
  }
375
401
 
376
402
  if (cmd === 'broadcast') {
403
+ await ensureDaemonRunning();
377
404
  const prompt = args.slice(1).join(' ');
378
405
  if (!prompt) { console.error('❌ Usage: telepty broadcast "<prompt text>"'); process.exit(1); }
379
406
  try {
package/install.ps1 CHANGED
@@ -1,33 +1,33 @@
1
- Write-Host "🚀 Installing @dmsdc-ai/aigentry-telepty..." -ForegroundColor Cyan
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 "⚠️ Node.js/npm not found. Attempting to install via winget..." -ForegroundColor Yellow
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 "🔄 Refreshing environment variables..." -ForegroundColor Cyan
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 " winget not found. Please install Node.js manually: https://nodejs.org/" -ForegroundColor Red
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 "📦 Installing telepty globally..." -ForegroundColor Cyan
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 "⚙️ Setting up Windows background process..." -ForegroundColor Cyan
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 " Failed to locate telepty executable after installation." -ForegroundColor Red
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 " Windows daemon started in background." -ForegroundColor Green
30
+ Write-Host "Success: Windows daemon started in background." -ForegroundColor Green
31
31
 
32
- Write-Host "`n🎉 Installation complete! Telepty daemon is running." -ForegroundColor Cyan
33
- Write-Host "👉 Try running: telepty attach" -ForegroundColor Yellow
32
+ Write-Host "`nInstallation complete! Telepty daemon is running." -ForegroundColor Cyan
33
+ Write-Host "Next step: Try running: telepty attach" -ForegroundColor Yellow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
6
  "telepty": "cli.js",