@dmsdc-ai/aigentry-telepty 0.1.2 → 0.1.4
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/.deliberation_request.json +1 -1
- package/.gemini/skills/telepty/SKILL.md +21 -16
- package/cli.js +35 -3
- package/clipboard_image.png +0 -0
- package/daemon.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"topic": "
|
|
1
|
+
{"topic": "Brainstorming and critiquing the 3 communication modes in telepty (Prompt Injection, Visual Log, Background JSON). What crucial interaction pattern between human users and AI agents is missing from this list? Consider synchronous vs asynchronous, blocking vs non-blocking, and explicit handshakes.", "speakers": ["claude", "codex", "gemini"], "role_preset": "brainstorm"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Help the user interact with the `telepty` daemon, check their current session ID, list active sessions, and inject commands or JSON events into remote or local PTY sessions. All operations are performed using standard CLI commands or `curl`.
|
|
5
5
|
|
|
6
6
|
**Trigger:**
|
|
7
|
-
When the user asks about their current session ID, wants to check active sessions, wants to inject a prompt/command into a specific session, wants to send a JSON event via the bus, or wants to update telepty.
|
|
7
|
+
When the user asks about their current session ID, wants to check active sessions, wants to inject a prompt/command into a specific session, wants to send a JSON event via the bus, wants to subscribe/listen to the bus, or wants to update telepty.
|
|
8
8
|
|
|
9
9
|
**Instructions:**
|
|
10
10
|
1. **To check the current session ID:**
|
|
@@ -13,20 +13,25 @@ When the user asks about their current session ID, wants to check active session
|
|
|
13
13
|
- If it has a value, output it clearly.
|
|
14
14
|
2. **To list all sessions:**
|
|
15
15
|
- Run `telepty list`.
|
|
16
|
-
3. **To
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
16
|
+
3. **To send a message/command to another agent, you must choose ONE of three methods depending on the user's intent:**
|
|
17
|
+
|
|
18
|
+
**Method A: Prompt Injection (Active Interruption)**
|
|
19
|
+
- Use this when you want the receiving AI to IMMEDIATELY read and execute the message as a prompt.
|
|
20
|
+
- Run: `telepty inject <target_session_id> "<prompt text>"`
|
|
21
|
+
- (For multiple: `telepty multicast <id1>,<id2> "<prompt>"`)
|
|
22
|
+
|
|
23
|
+
**Method B: Log Injection (Visual Notification)**
|
|
24
|
+
- Use this when you want the message to appear immediately on the receiving terminal's screen for the user to see, but WITHOUT forcing the AI to execute it as a prompt.
|
|
25
|
+
- Run: `telepty inject <target_session_id> "echo '\x1b[33m[📬 Message from $TELEPTY_SESSION_ID]\x1b[0m <message text>'"`
|
|
26
|
+
|
|
27
|
+
**Method C: Background JSON Bus (Passive/Silent)**
|
|
28
|
+
- Use this for structured data transfer that the other AI will read later from its log file, without disturbing its current terminal screen.
|
|
29
|
+
- Run:
|
|
26
30
|
```bash
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-H "x-telepty-token: $TOKEN" \
|
|
30
|
-
-d '{"type": "my_event", "payload": "data"}'
|
|
31
|
+
TOKEN=$(cat ~/.telepty/config.json | grep authToken | cut -d '"' -f 4)
|
|
32
|
+
curl -s -X POST http://127.0.0.1:3848/api/bus/publish -H "Content-Type: application/json" -H "x-telepty-token: $TOKEN" -d '{"type": "bg_message", "payload": "..."}'
|
|
31
33
|
```
|
|
32
|
-
|
|
34
|
+
4. **To subscribe to the Event Bus (Listen for JSON events):**
|
|
35
|
+
- Run `nohup telepty listen > .telepty_bus_events.log 2>&1 &`
|
|
36
|
+
5. **To update telepty:**
|
|
37
|
+
- Run `telepty update`.
|
package/cli.js
CHANGED
|
@@ -440,11 +440,16 @@ async function main() {
|
|
|
440
440
|
}
|
|
441
441
|
|
|
442
442
|
if (cmd === 'inject') {
|
|
443
|
+
// Check for --no-enter flag
|
|
444
|
+
const noEnterIndex = args.indexOf('--no-enter');
|
|
445
|
+
const noEnter = noEnterIndex !== -1;
|
|
446
|
+
if (noEnter) args.splice(noEnterIndex, 1);
|
|
447
|
+
|
|
443
448
|
const sessionId = args[1]; const prompt = args.slice(2).join(' ');
|
|
444
|
-
if (!sessionId || !prompt) { console.error('❌ Usage: telepty inject <session_id> "<prompt text>"'); process.exit(1); }
|
|
449
|
+
if (!sessionId || !prompt) { console.error('❌ Usage: telepty inject [--no-enter] <session_id> "<prompt text>"'); process.exit(1); }
|
|
445
450
|
try {
|
|
446
451
|
const res = await fetchWithAuth(`${DAEMON_URL}/api/sessions/${encodeURIComponent(sessionId)}/inject`, {
|
|
447
|
-
method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt })
|
|
452
|
+
method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt, no_enter: noEnter })
|
|
448
453
|
});
|
|
449
454
|
const data = await res.json();
|
|
450
455
|
if (!res.ok) { console.error(`❌ Error: ${data.error}`); return; }
|
|
@@ -485,6 +490,32 @@ async function main() {
|
|
|
485
490
|
return;
|
|
486
491
|
}
|
|
487
492
|
|
|
493
|
+
if (cmd === 'listen') {
|
|
494
|
+
await ensureDaemonRunning();
|
|
495
|
+
console.log('\x1b[36m👂 Listening to the telepty event bus...\x1b[0m');
|
|
496
|
+
const wsUrl = `ws://${REMOTE_HOST}:${PORT}/api/bus?token=${encodeURIComponent(TOKEN)}`;
|
|
497
|
+
const ws = new WebSocket(wsUrl);
|
|
498
|
+
|
|
499
|
+
ws.on('open', () => {
|
|
500
|
+
// connected
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
ws.on('message', (message) => {
|
|
504
|
+
// Print raw JSON to stdout so agents can parse it
|
|
505
|
+
console.log(message.toString());
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
ws.on('close', () => {
|
|
509
|
+
console.error('\x1b[31m❌ Disconnected from event bus.\x1b[0m');
|
|
510
|
+
process.exit(1);
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
ws.on('error', (err) => {
|
|
514
|
+
console.error('\x1b[31m❌ WebSocket error:\x1b[0m', err.message);
|
|
515
|
+
});
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
|
|
488
519
|
console.log(`
|
|
489
520
|
\x1b[1maigentry-telepty\x1b[0m - Remote PTY Control
|
|
490
521
|
|
|
@@ -493,9 +524,10 @@ Usage:
|
|
|
493
524
|
telepty spawn --id <id> <command> [args...] Spawn a new background CLI
|
|
494
525
|
telepty list List all active sessions
|
|
495
526
|
telepty attach [id] Attach to a session (Interactive picker if no ID)
|
|
496
|
-
telepty inject <id> "<prompt>"
|
|
527
|
+
telepty inject [--no-enter] <id> "<prompt>" Inject text into a single session
|
|
497
528
|
telepty multicast <id1,id2> "<prompt>" Inject text into multiple specific sessions
|
|
498
529
|
telepty broadcast "<prompt>" Inject text into ALL active sessions
|
|
530
|
+
telepty listen Listen to the event bus and print JSON to stdout
|
|
499
531
|
telepty update Update telepty to the latest version
|
|
500
532
|
`);
|
|
501
533
|
}
|
|
Binary file
|
package/daemon.js
CHANGED
|
@@ -151,12 +151,12 @@ app.post('/api/sessions/broadcast/inject', (req, res) => {
|
|
|
151
151
|
|
|
152
152
|
app.post('/api/sessions/:id/inject', (req, res) => {
|
|
153
153
|
const { id } = req.params;
|
|
154
|
-
const { prompt } = req.body;
|
|
154
|
+
const { prompt, no_enter } = req.body;
|
|
155
155
|
const session = sessions[id];
|
|
156
156
|
if (!session) return res.status(404).json({ error: 'Session not found' });
|
|
157
157
|
if (!prompt) return res.status(400).json({ error: 'prompt is required' });
|
|
158
158
|
try {
|
|
159
|
-
session.ptyProcess.write(`${prompt}\r`);
|
|
159
|
+
session.ptyProcess.write(no_enter ? prompt : `${prompt}\r`);
|
|
160
160
|
console.log(`[INJECT] Wrote to session ${id}`);
|
|
161
161
|
res.json({ success: true });
|
|
162
162
|
} catch (err) {
|