@dmsdc-ai/aigentry-telepty 0.1.3 → 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.
@@ -1 +1 @@
1
- {"topic": "Critique and verify the Foreground-Only Session Lifecycle for telepty. The user proposes that all AI workers/sessions MUST run in visible, physical terminal windows. When the user closes the window, the session dies. No invisible background sessions exist. What are the edge cases, UX flaws, or technical limitations of this approach?", "speakers": ["claude", "gemini", "codex"], "role_preset": "critic"}
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"}
@@ -13,27 +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 inject a command into another session:**
17
- - For a single session: Run `telepty inject <target_session_id> "<message or command>"`.
18
- - For broadcasting to ALL active sessions: Run `telepty broadcast "<message or command>"`.
19
- - For multicasting to multiple specific sessions: Run `telepty multicast <id1>,<id2> "<message or command>"`.
20
- 4. **To update telepty:**
21
- - Run `telepty update`.
22
- 5. **To publish a JSON event to the Event Bus (/api/bus):**
23
- - Use `curl` to post directly to the local daemon (it will relay to all active clients).
24
- - First, get the token: `TOKEN=$(cat ~/.telepty/config.json | grep authToken | cut -d '"' -f 4)`
25
- - Then run:
26
- ```bash
27
- curl -X POST http://127.0.0.1:3848/api/bus/publish \
28
- -H "Content-Type: application/json" \
29
- -H "x-telepty-token: $TOKEN" \
30
- -d '{"type": "my_event", "payload": "data"}'
31
- ```
32
- - (Modify the JSON payload structure according to the user's specific request.)
33
- 6. **To subscribe to the Event Bus (Listen for JSON events):**
34
- - If the user wants to wait for and listen to messages from other agents, simply run `telepty listen`.
35
- - Run it in the background and redirect output to a log file so you can periodically check it:
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:
36
30
  ```bash
37
- nohup telepty listen > .telepty_bus_events.log 2>&1 &
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": "..."}'
38
33
  ```
39
- - Inform the user that the agent is now listening, and any received JSON messages will be saved to `.telepty_bus_events.log` in the current directory. (You can read this file using `read_file` to see what messages arrived).
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; }
@@ -519,7 +524,7 @@ Usage:
519
524
  telepty spawn --id <id> <command> [args...] Spawn a new background CLI
520
525
  telepty list List all active sessions
521
526
  telepty attach [id] Attach to a session (Interactive picker if no ID)
522
- telepty inject <id> "<prompt>" Inject text into a single session
527
+ telepty inject [--no-enter] <id> "<prompt>" Inject text into a single session
523
528
  telepty multicast <id1,id2> "<prompt>" Inject text into multiple specific sessions
524
529
  telepty broadcast "<prompt>" Inject text into ALL active sessions
525
530
  telepty listen Listen to the event bus and print JSON to stdout
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
6
  "telepty": "cli.js",