@dmsdc-ai/aigentry-telepty 0.0.5 → 0.0.6

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 CHANGED
@@ -1,5 +1,34 @@
1
- # aigentry-telepty
1
+ # @dmsdc-ai/aigentry-telepty
2
2
 
3
- **Personal PTY-based remote prompt injection daemon for AI CLIs.**
3
+ **Cross-machine PTY-based remote prompt injection daemon for AI CLIs.**
4
4
 
5
- `telepty` (Tele-Prompt) is a lightweight, personal background daemon that bridges the gap between the network and interactive AI command-line interfaces.
5
+ `telepty` (Tele-Prompt) is a lightweight background daemon that bridges the gap between the network and interactive AI command-line interfaces. It allows you to seamlessly share, attach to, and inject commands into terminal sessions across different machines.
6
+
7
+ ## One-Click Installation
8
+
9
+ To install and set up `telepty` on any machine (macOS, Linux, or Windows):
10
+
11
+ ### The Universal Installer (Windows/macOS/Linux)
12
+ Open your terminal (or PowerShell/CMD) and run:
13
+ ```bash
14
+ npx --yes @dmsdc-ai/aigentry-telepty@latest telepty-install
15
+ ```
16
+ *This single command 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).*
17
+
18
+ ## Seamless Usage
19
+
20
+ 1. **Start a background session:**
21
+ ```bash
22
+ telepty spawn --id "my-session" bash
23
+ ```
24
+
25
+ 2. **Attach to a session (Local or Remote):**
26
+ ```bash
27
+ telepty attach
28
+ ```
29
+ *telepty will automatically discover active sessions on your local machine and across your Tailscale network!*
30
+
31
+ 3. **Inject commands remotely:**
32
+ ```bash
33
+ telepty inject my-session "echo 'Hello from nowhere!'"
34
+ ```
package/install.js ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync, spawn } = require('child_process');
4
+ const os = require('os');
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+
8
+ console.log("šŸš€ Installing @dmsdc-ai/aigentry-telepty...");
9
+
10
+ function run(cmd) {
11
+ try {
12
+ execSync(cmd, { stdio: 'inherit' });
13
+ } catch (e) {
14
+ console.error(`āŒ Command failed: ${cmd}`);
15
+ process.exit(1);
16
+ }
17
+ }
18
+
19
+ // 1. Install globally via npm
20
+ console.log("šŸ“¦ Installing package globally...");
21
+ run("npm install -g @dmsdc-ai/aigentry-telepty");
22
+
23
+ // 2. Find executable
24
+ let teleptyPath = '';
25
+ try {
26
+ teleptyPath = execSync(os.platform() === 'win32' ? 'where telepty' : 'which telepty', { encoding: 'utf8' }).split('\n')[0].trim();
27
+ } catch (e) {
28
+ teleptyPath = 'telepty'; // fallback
29
+ }
30
+
31
+ // 3. Setup OS-specific autostart or background daemon
32
+ const platform = os.platform();
33
+
34
+ if (platform === 'win32') {
35
+ console.log("āš™ļø Setting up Windows background process...");
36
+ // Launch daemon in background detaching from current console
37
+ const subprocess = spawn(teleptyPath, ['daemon'], {
38
+ detached: true,
39
+ stdio: 'ignore',
40
+ windowsHide: true
41
+ });
42
+ subprocess.unref();
43
+ console.log("āœ… Windows daemon started in background.");
44
+
45
+ } else if (platform === 'darwin') {
46
+ console.log("āš™ļø Setting up macOS launchd service...");
47
+ const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', 'com.aigentry.telepty.plist');
48
+ fs.mkdirSync(path.dirname(plistPath), { recursive: true });
49
+
50
+ const plistContent = `<?xml version="1.0" encoding="UTF-8"?>
51
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
52
+ <plist version="1.0">
53
+ <dict>
54
+ <key>Label</key>
55
+ <string>com.aigentry.telepty</string>
56
+ <key>ProgramArguments</key>
57
+ <array>
58
+ <string>${teleptyPath}</string>
59
+ <string>daemon</string>
60
+ </array>
61
+ <key>RunAtLoad</key>
62
+ <true/>
63
+ <key>KeepAlive</key>
64
+ <true/>
65
+ </dict>
66
+ </plist>`;
67
+
68
+ fs.writeFileSync(plistPath, plistContent);
69
+ try { execSync(`launchctl unload "${plistPath}" 2>/dev/null`); } catch(e){}
70
+ run(`launchctl load "${plistPath}"`);
71
+ console.log("āœ… macOS LaunchAgent installed and started.");
72
+
73
+ } else {
74
+ // Linux
75
+ try {
76
+ // Check if systemd is available and running as root/sudo
77
+ execSync('systemctl --version', { stdio: 'ignore' });
78
+ if (process.getuid && process.getuid() === 0) {
79
+ console.log("āš™ļø Setting up systemd service for Linux...");
80
+ const serviceContent = `[Unit]
81
+ Description=Telepty Daemon
82
+ After=network.target
83
+
84
+ [Service]
85
+ ExecStart=${teleptyPath} daemon
86
+ Restart=always
87
+ User=${process.env.SUDO_USER || process.env.USER || 'root'}
88
+ Environment=PATH=/usr/bin:/usr/local/bin:$PATH
89
+ Environment=NODE_ENV=production
90
+
91
+ [Install]
92
+ WantedBy=multi-user.target`;
93
+
94
+ fs.writeFileSync('/etc/systemd/system/telepty.service', serviceContent);
95
+ run('systemctl daemon-reload');
96
+ run('systemctl enable telepty');
97
+ run('systemctl start telepty');
98
+ console.log("āœ… Systemd service installed and started.");
99
+ process.exit(0);
100
+ }
101
+ } catch(e) {}
102
+
103
+ // Fallback for Linux without systemd or non-root
104
+ console.log("āš ļø Skipping systemd (no root or no systemd). Starting in background...");
105
+ const subprocess = spawn(teleptyPath, ['daemon'], {
106
+ detached: true,
107
+ stdio: 'ignore'
108
+ });
109
+ subprocess.unref();
110
+ console.log("āœ… Linux daemon started in background using nohup equivalent.");
111
+ }
112
+
113
+ console.log("\nšŸŽ‰ Installation complete! Telepty daemon is running.");
114
+ console.log("šŸ‘‰ Try running: telepty attach\n");
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
- "telepty": "cli.js"
6
+ "telepty": "cli.js",
7
+ "telepty-install": "install.js"
7
8
  },
8
9
  "scripts": {
9
10
  "test": "echo \"Error: no test specified\" && exit 1"
package/install.sh DELETED
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -e
3
-
4
- echo "šŸš€ Installing aigentry-telepty..."
5
- if ! command -v npm &> /dev/null; then
6
- echo "āŒ Error: npm is not installed. Please install Node.js first."
7
- exit 1
8
- fi
9
-
10
- npm install -g git+https://github.com/dmsdc-ai/aigentry-telepty.git
11
-
12
- # Set up systemd service if systemd is available
13
- if command -v systemctl &> /dev/null && [ -d "/etc/systemd/system" ] && [ "$EUID" -eq 0 ]; then
14
- echo "āš™ļø Setting up systemd service..."
15
- TELEPTY_PATH=$(which telepty)
16
- cat <<SYSTEMD_EOF > /etc/systemd/system/telepty.service
17
- [Unit]
18
- Description=Telepty Daemon
19
- After=network.target tailscaled.service
20
-
21
- [Service]
22
- ExecStart=$TELEPTY_PATH daemon
23
- Restart=always
24
- User=$SUDO_USER
25
- Environment=PATH=/usr/bin:/usr/local/bin:$PATH
26
- Environment=NODE_ENV=production
27
-
28
- [Install]
29
- WantedBy=multi-user.target
30
- SYSTEMD_EOF
31
-
32
- systemctl daemon-reload
33
- systemctl enable telepty
34
- systemctl start telepty
35
- echo "āœ… Systemd service installed and started. Daemon will run automatically on boot."
36
- else
37
- echo "āš ļø Skipping systemd setup (requires root and systemd). Starting daemon in background..."
38
- nohup telepty daemon > /dev/null 2>&1 &
39
- echo "āœ… Daemon started in background. (Note: It will not auto-start on reboot)"
40
- fi
41
-
42
- echo "šŸŽ‰ Installation complete!"
43
- echo "You can now use 'telepty spawn --id <name> <command>' to create sessions."