@dmsdc-ai/aigentry-telepty 0.1.4 → 0.1.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.
@@ -0,0 +1,58 @@
1
+ # telepty-allow
2
+
3
+ Allow inject on an LLM CLI (or any command) via telepty.
4
+
5
+ ## Instructions
6
+
7
+ ### Usage
8
+ ```bash
9
+ telepty allow [--id <session_id>] -- <command> [args...]
10
+ ```
11
+
12
+ ### Examples
13
+ ```bash
14
+ # Claude Code with custom session ID
15
+ telepty allow --id my-claude -- claude
16
+
17
+ # Codex with auto-generated ID
18
+ telepty allow -- codex
19
+
20
+ # Gemini with custom ID
21
+ telepty allow --id gemini-main -- gemini
22
+
23
+ # Any shell command
24
+ telepty allow --id dev-shell -- bash
25
+ ```
26
+
27
+ ### What it does
28
+ 1. Registers the session with the telepty daemon
29
+ 2. Spawns the command locally via `node-pty` (preserves isTTY, raw mode, colors)
30
+ 3. Connects to daemon as WebSocket owner for inject reception
31
+ 4. Sets `TELEPTY_SESSION_ID` env var inside the process
32
+
33
+ ### Key behaviors
34
+ - **isTTY preserved**: TUI apps (claude, codex, gemini) work normally
35
+ - **Daemon fault-tolerant**: if daemon dies, the CLI keeps running (inject unavailable until reconnect)
36
+ - **Session auto-cleanup**: when the command exits, session is deregistered
37
+
38
+ ### After allowing, from another terminal:
39
+ ```bash
40
+ # List sessions
41
+ telepty list
42
+
43
+ # Inject into the session
44
+ telepty inject <session_id> "your prompt here"
45
+
46
+ # Attach to watch output
47
+ telepty attach <session_id>
48
+ ```
49
+
50
+ ## Execute
51
+ If the user provides arguments, run the allow command for them:
52
+
53
+ ```bash
54
+ cd /Users/duckyoungkim/projects/aigentry-telepty
55
+ node cli.js allow $ARGUMENTS
56
+ ```
57
+
58
+ If no arguments, show the usage guide above and ask what they want to run.
@@ -0,0 +1,22 @@
1
+ # telepty-attach
2
+
3
+ Attach to an active telepty session to observe its output in real-time.
4
+
5
+ ## Instructions
6
+
7
+ ### Execute
8
+ ```bash
9
+ cd /Users/duckyoungkim/projects/aigentry-telepty && node cli.js attach $ARGUMENTS
10
+ ```
11
+
12
+ ### If no arguments
13
+ 1. List available sessions: `node cli.js list`
14
+ 2. Ask the user which session to attach to
15
+
16
+ ### Notes
17
+ - For **spawned** sessions: you can both view output and send input
18
+ - For **wrapped** sessions: input from attached clients is forwarded to the owner as inject
19
+ - Press `Ctrl+C` to detach without killing the session
20
+
21
+ ## Arguments
22
+ - `$ARGUMENTS`: session ID to attach to
@@ -0,0 +1,34 @@
1
+ # telepty-inject
2
+
3
+ Inject a prompt into a telepty session (spawned or wrapped).
4
+
5
+ ## Instructions
6
+
7
+ Parse `$ARGUMENTS` to extract target session ID and prompt text.
8
+
9
+ ### Format
10
+ ```
11
+ <session_id> <prompt text>
12
+ ```
13
+
14
+ ### Execute
15
+ ```bash
16
+ cd /Users/duckyoungkim/projects/aigentry-telepty && node cli.js inject $ARGUMENTS
17
+ ```
18
+
19
+ ### If no arguments
20
+ 1. List available sessions: `node cli.js list`
21
+ 2. Ask the user which session to target and what to inject
22
+
23
+ ### Multicast (multiple targets)
24
+ ```bash
25
+ node cli.js multicast <id1>,<id2> "<prompt>"
26
+ ```
27
+
28
+ ### Broadcast (all sessions)
29
+ ```bash
30
+ node cli.js broadcast "<prompt>"
31
+ ```
32
+
33
+ ## Arguments
34
+ - `$ARGUMENTS`: `<session_id> "<prompt>"` or empty for interactive mode
@@ -0,0 +1,22 @@
1
+ # telepty-list
2
+
3
+ List all active telepty sessions with their types and status.
4
+
5
+ ## Instructions
6
+
7
+ 1. Run:
8
+ ```bash
9
+ cd /Users/duckyoungkim/projects/aigentry-telepty && node cli.js list
10
+ ```
11
+
12
+ 2. If the daemon is not running, tell the user and suggest `/project:telepty-start`.
13
+
14
+ 3. Format the output as a clear table showing:
15
+ - Session ID
16
+ - Type (spawned / wrapped)
17
+ - Command
18
+ - Active clients
19
+ - Created time
20
+
21
+ ## Arguments
22
+ - `$ARGUMENTS`: ignored
@@ -0,0 +1,73 @@
1
+ # telepty-manual-test
2
+
3
+ Guided manual test of the telepty enable (inject) feature. Runs step-by-step verification.
4
+
5
+ ## Instructions
6
+
7
+ Execute each step sequentially, verifying results before proceeding.
8
+
9
+ ### Step 1: Ensure daemon is running
10
+ ```bash
11
+ cd /Users/duckyoungkim/projects/aigentry-telepty
12
+ curl -s http://127.0.0.1:3848/api/sessions 2>/dev/null || node daemon.js &
13
+ sleep 1
14
+ ```
15
+
16
+ ### Step 2: Register a wrapped session via API
17
+ ```bash
18
+ TOKEN=$(cat ~/.telepty/config.json 2>/dev/null | grep authToken | cut -d '"' -f 4)
19
+ curl -s -X POST http://127.0.0.1:3848/api/sessions/register \
20
+ -H "Content-Type: application/json" \
21
+ -H "x-telepty-token: $TOKEN" \
22
+ -d '{"session_id": "manual-test-1", "command": "test", "cwd": "'"$(pwd)"'"}'
23
+ ```
24
+ **Verify**: response has `type: "wrapped"` and status 201.
25
+
26
+ ### Step 3: Check session listing
27
+ ```bash
28
+ curl -s http://127.0.0.1:3848/api/sessions -H "x-telepty-token: $TOKEN" | python3 -m json.tool
29
+ ```
30
+ **Verify**: `manual-test-1` appears with `type: "wrapped"`.
31
+
32
+ ### Step 4: Test inject without owner (should fail)
33
+ ```bash
34
+ curl -s -X POST http://127.0.0.1:3848/api/sessions/manual-test-1/inject \
35
+ -H "Content-Type: application/json" \
36
+ -H "x-telepty-token: $TOKEN" \
37
+ -d '{"prompt": "hello"}'
38
+ ```
39
+ **Verify**: returns 503 with "not connected" error.
40
+
41
+ ### Step 5: Clean up test session
42
+ ```bash
43
+ curl -s -X DELETE http://127.0.0.1:3848/api/sessions/manual-test-1 \
44
+ -H "x-telepty-token: $TOKEN"
45
+ ```
46
+ **Verify**: returns status "closing".
47
+
48
+ ### Step 6: Verify session removed
49
+ ```bash
50
+ curl -s http://127.0.0.1:3848/api/sessions -H "x-telepty-token: $TOKEN"
51
+ ```
52
+ **Verify**: `manual-test-1` no longer in the list.
53
+
54
+ ### Step 7: Run automated tests
55
+ ```bash
56
+ npm test
57
+ ```
58
+ **Verify**: all 25 tests pass.
59
+
60
+ ### Report
61
+ Summarize all verification results in a table:
62
+
63
+ | Step | Check | Result |
64
+ |------|-------|--------|
65
+ | 2 | Register returns 201 + wrapped | ? |
66
+ | 3 | Session in list with type | ? |
67
+ | 4 | Inject without owner = 503 | ? |
68
+ | 5 | DELETE returns closing | ? |
69
+ | 6 | Session removed | ? |
70
+ | 7 | All tests pass | ? |
71
+
72
+ ## Arguments
73
+ - `$ARGUMENTS`: ignored
@@ -0,0 +1,25 @@
1
+ # telepty-start
2
+
3
+ Start the telepty daemon process.
4
+
5
+ ## Instructions
6
+
7
+ 1. Check if daemon is already running:
8
+ ```bash
9
+ curl -s http://127.0.0.1:3848/api/sessions 2>/dev/null && echo "RUNNING" || echo "NOT RUNNING"
10
+ ```
11
+
12
+ 2. If not running, start it:
13
+ ```bash
14
+ cd /Users/duckyoungkim/projects/aigentry-telepty && node daemon.js &
15
+ ```
16
+
17
+ 3. Verify it started:
18
+ ```bash
19
+ sleep 1 && curl -s http://127.0.0.1:3848/api/sessions
20
+ ```
21
+
22
+ 4. Report status.
23
+
24
+ ## Arguments
25
+ - `$ARGUMENTS`: optional port override (e.g., "3849")
@@ -0,0 +1,25 @@
1
+ # telepty-test
2
+
3
+ Run the telepty automated test suite and report results.
4
+
5
+ ## Instructions
6
+
7
+ 1. Run the full test suite:
8
+ ```bash
9
+ cd /Users/duckyoungkim/projects/aigentry-telepty && npm test
10
+ ```
11
+
12
+ 2. Parse the output and report:
13
+ - Total tests, passed, failed
14
+ - If any failures: show the failing test name and error message
15
+ - If all pass: confirm with count
16
+
17
+ 3. If tests fail, investigate:
18
+ - Read the failing test in `test/daemon.test.js`
19
+ - Check if daemon.js has related issues
20
+ - Suggest or apply fixes
21
+ - Re-run tests to confirm
22
+
23
+ ## Arguments
24
+ - No arguments: run all tests
25
+ - `$ARGUMENTS`: if provided, use as a grep filter to run specific tests (e.g., "wrap", "register", "inject")
@@ -0,0 +1,82 @@
1
+ # telepty
2
+
3
+ Help the user interact with the `telepty` daemon — check session IDs, list active sessions, inject commands, send bus events, and manage terminal windows.
4
+
5
+ ## Trigger
6
+
7
+ When the user asks about their current session ID, wants to check/list active sessions, inject a prompt into a session, send a JSON event via the bus, subscribe to the bus, rename a session, or update telepty.
8
+
9
+ ## Instructions
10
+
11
+ ### 1. Check Current Session ID
12
+ - Run: `echo $TELEPTY_SESSION_ID`
13
+ - If empty: this shell is NOT inside a telepty session.
14
+ - If set: display it. This is the ID other agents use to target this session.
15
+
16
+ ### 2. List All Sessions
17
+ - Run: `telepty list`
18
+
19
+ ### 3. Send a Message to Another Agent
20
+ Choose ONE of three methods based on intent:
21
+
22
+ **Method A: Prompt Injection (Active Interruption)**
23
+ The receiving AI will IMMEDIATELY read and execute the message as a prompt.
24
+ ```bash
25
+ telepty inject <target_session_id> "<prompt text>"
26
+ ```
27
+ For multiple targets: `telepty multicast <id1>,<id2> "<prompt>"`
28
+
29
+ **Method B: Log Injection (Visual Notification)**
30
+ The message appears on the receiving terminal screen for the user to see, but the AI does NOT execute it as a prompt.
31
+ ```bash
32
+ telepty inject <target_session_id> "echo '\x1b[33m[Message from $TELEPTY_SESSION_ID]\x1b[0m <message text>'"
33
+ ```
34
+
35
+ **Method C: Background JSON Bus (Passive/Silent)**
36
+ Structured data transfer that won't disturb the receiving terminal screen.
37
+ ```bash
38
+ TOKEN=$(cat ~/.telepty/config.json | grep authToken | cut -d '"' -f 4)
39
+ curl -s -X POST http://127.0.0.1:3848/api/bus/publish \
40
+ -H "Content-Type: application/json" \
41
+ -H "x-telepty-token: $TOKEN" \
42
+ -d '{"type": "bg_message", "payload": "..."}'
43
+ ```
44
+
45
+ ### 4. Subscribe to the Event Bus
46
+ ```bash
47
+ nohup telepty listen > .telepty_bus_events.log 2>&1 &
48
+ ```
49
+
50
+ ### 5. Open a New Ghostty Terminal Window
51
+ Physically spawn a new terminal window already attached to a telepty session:
52
+ ```bash
53
+ cat << 'EOF' > /tmp/telepty-auto.command
54
+ #!/bin/bash
55
+ telepty spawn --id <ID> <CMD>
56
+ EOF
57
+ chmod +x /tmp/telepty-auto.command
58
+ open -a Ghostty /tmp/telepty-auto.command || open /tmp/telepty-auto.command
59
+ ```
60
+
61
+ ### 6. Terminal Title Convention
62
+ Each telepty session displays its ID in the Ghostty tab title:
63
+ - Local: `⚡ telepty :: {session_id}`
64
+ - Remote: `⚡ telepty :: {session_id} @ {host}`
65
+
66
+ ### 7. Allow Inject on a CLI
67
+ Run any command with inject allowed:
68
+ ```bash
69
+ # With custom session ID
70
+ telepty allow --id my-claude -- claude
71
+ telepty allow --id codex-main -- codex
72
+ telepty allow --id gemini-1 -- gemini
73
+
74
+ # Auto-generated session ID
75
+ telepty allow -- bash
76
+ ```
77
+ The process runs locally (isTTY preserved), but registers with the daemon so inject works.
78
+
79
+ ### 8. Update
80
+ ```bash
81
+ telepty update
82
+ ```
@@ -33,5 +33,23 @@ When the user asks about their current session ID, wants to check active session
33
33
  ```
34
34
  4. **To subscribe to the Event Bus (Listen for JSON events):**
35
35
  - Run `nohup telepty listen > .telepty_bus_events.log 2>&1 &`
36
- 5. **To update telepty:**
36
+ 5. **To physically OPEN a new Terminal Window for the user (macOS):**
37
+ - If the user asks you to "open a new telepty terminal" or "방 파줘", you can physically spawn a new Ghostty/Terminal window on their screen that is already attached to a telepty session.
38
+ - Run this shell command (replace `<ID>` and `<CMD>`):
39
+ ```bash
40
+ cat << 'EOF' > /tmp/telepty-auto.command
41
+ #!/bin/bash
42
+ telepty spawn --id <ID> <CMD>
43
+ EOF
44
+ chmod +x /tmp/telepty-auto.command
45
+ open -a Ghostty /tmp/telepty-auto.command || open /tmp/telepty-auto.command
46
+ ```
47
+ 6. **To rename a session:**
48
+ - Run `telepty rename <old_id> <new_id>`
49
+ - This updates the session key, Ghostty tab title, and broadcasts a `session_rename` event on the bus.
50
+ 7. **Terminal Title Convention:**
51
+ - Each telepty session displays its ID in the Ghostty tab title.
52
+ - Local: `⚡ telepty :: {session_id}`
53
+ - Remote: `⚡ telepty :: {session_id} @ {host}`
54
+ 8. **To update telepty:**
37
55
  - Run `telepty update`.
@@ -1,32 +1,26 @@
1
- name: Test Installation Scripts
1
+ name: Regression Tests
2
2
  on:
3
3
  push:
4
4
  branches: [ "main" ]
5
5
  pull_request:
6
6
  branches: [ "main" ]
7
+ workflow_dispatch:
7
8
 
8
9
  jobs:
9
- test-windows:
10
- runs-on: windows-latest
10
+ test:
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest, windows-latest]
15
+ node: [20]
16
+ runs-on: ${{ matrix.os }}
11
17
  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
18
+ - uses: actions/checkout@v4
19
+ - uses: actions/setup-node@v4
20
+ with:
21
+ node-version: ${{ matrix.node }}
22
+ cache: npm
23
+ - name: Install dependencies
24
+ run: npm ci
25
+ - name: Run regression suite
26
+ run: npm run test:ci
package/README.md CHANGED
@@ -39,3 +39,19 @@ iwr -useb https://raw.githubusercontent.com/dmsdc-ai/aigentry-telepty/main/insta
39
39
  ```bash
40
40
  telepty inject my-session "echo 'Hello from nowhere!'"
41
41
  ```
42
+
43
+ ## Testing
44
+
45
+ Run the full regression suite locally:
46
+
47
+ ```bash
48
+ npm test
49
+ ```
50
+
51
+ Keep the suite running while you work:
52
+
53
+ ```bash
54
+ npm run test:watch
55
+ ```
56
+
57
+ The automated suite covers config generation, daemon HTTP APIs, WebSocket attach/output flow, bus events, session deletion regressions, and CLI smoke tests against a real daemon process.