telemux 1.0.1__tar.gz → 1.0.3__tar.gz
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.
Potentially problematic release.
This version of telemux might be problematic. Click here for more details.
- {telemux-1.0.1/src/telemux.egg-info → telemux-1.0.3}/PKG-INFO +20 -21
- {telemux-1.0.1 → telemux-1.0.3}/README.md +19 -20
- {telemux-1.0.1 → telemux-1.0.3}/pyproject.toml +1 -1
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux/__init__.py +1 -1
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux/listener.py +1 -1
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux/shell_functions.sh +14 -7
- {telemux-1.0.1 → telemux-1.0.3/src/telemux.egg-info}/PKG-INFO +20 -21
- {telemux-1.0.1 → telemux-1.0.3}/CHANGELOG.md +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/LICENSE +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/MANIFEST.in +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/examples/ai-agent-question.sh +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/examples/deployment-approval.sh +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/examples/long-build-notify.sh +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/setup.cfg +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux/cleanup.py +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux/cli.py +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux/config.py +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux/control.py +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux/installer.py +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux.egg-info/SOURCES.txt +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux.egg-info/dependency_links.txt +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux.egg-info/entry_points.txt +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux.egg-info/requires.txt +0 -0
- {telemux-1.0.1 → telemux-1.0.3}/src/telemux.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: telemux
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Bidirectional Telegram integration for tmux sessions - monitor commands and interact with agents
|
|
5
5
|
Author-email: Marco Almazan <marco@example.com>
|
|
6
6
|
License: MIT
|
|
@@ -124,8 +124,8 @@ telemux logs
|
|
|
124
124
|
# Send a simple notification
|
|
125
125
|
tg_alert "Build complete!"
|
|
126
126
|
|
|
127
|
-
# Send a message and receive replies
|
|
128
|
-
tg_agent "
|
|
127
|
+
# Send a message and receive replies (auto-detects tmux session name)
|
|
128
|
+
tg_agent "Ready to deploy to production?"
|
|
129
129
|
# Reply via Telegram: "session-name: yes"
|
|
130
130
|
# The reply appears directly in your terminal
|
|
131
131
|
|
|
@@ -189,27 +189,26 @@ tg_alert "Deploy complete
|
|
|
189
189
|
|
|
190
190
|
### `tg_agent`
|
|
191
191
|
|
|
192
|
-
Send messages and receive replies via Telegram:
|
|
192
|
+
Send messages and receive replies via Telegram (automatically uses your tmux session name):
|
|
193
193
|
|
|
194
194
|
```bash
|
|
195
|
-
tg_agent "
|
|
195
|
+
tg_agent "Message text"
|
|
196
196
|
```
|
|
197
197
|
|
|
198
198
|
**Examples:**
|
|
199
199
|
|
|
200
200
|
```bash
|
|
201
|
-
# Ask a question
|
|
202
|
-
tg_agent "
|
|
201
|
+
# Ask a question (inside a tmux session named "deploy")
|
|
202
|
+
tg_agent "Ready to deploy to production?"
|
|
203
203
|
|
|
204
204
|
# Wait for user response via Telegram
|
|
205
|
-
# User replies: "
|
|
205
|
+
# User replies: "deploy: yes, proceed"
|
|
206
206
|
# Reply appears in your terminal
|
|
207
207
|
|
|
208
|
-
# Use in scripts
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
fi
|
|
208
|
+
# Use in scripts (inside a tmux session named "approval")
|
|
209
|
+
tg_agent "Approve release v2.0?"
|
|
210
|
+
# Returns the session name, user responds via Telegram
|
|
211
|
+
# Check incoming message for approval
|
|
213
212
|
```
|
|
214
213
|
|
|
215
214
|
### `tg_done`
|
|
@@ -233,10 +232,10 @@ TeleMux uses **session-based routing** for bidirectional communication:
|
|
|
233
232
|
|
|
234
233
|
```bash
|
|
235
234
|
# In tmux session named "deploy"
|
|
236
|
-
tg_agent "
|
|
235
|
+
tg_agent "Should I proceed with deployment?"
|
|
237
236
|
```
|
|
238
237
|
|
|
239
|
-
This sends a message to Telegram with instructions on how to reply.
|
|
238
|
+
This sends a message to Telegram with instructions on how to reply. The session name is automatically detected.
|
|
240
239
|
|
|
241
240
|
### Replying from Telegram
|
|
242
241
|
|
|
@@ -368,11 +367,11 @@ fi
|
|
|
368
367
|
|
|
369
368
|
```bash
|
|
370
369
|
#!/bin/bash
|
|
371
|
-
# Deployment with approval
|
|
370
|
+
# Deployment with approval (run in tmux session named "deploy")
|
|
372
371
|
|
|
373
|
-
tg_agent "
|
|
372
|
+
tg_agent "Ready to deploy v2.0 to production?"
|
|
374
373
|
|
|
375
|
-
# User responds via Telegram: "
|
|
374
|
+
# User responds via Telegram: "deploy: yes"
|
|
376
375
|
# Response appears in terminal
|
|
377
376
|
|
|
378
377
|
read -p "Proceed with deployment? " response
|
|
@@ -386,19 +385,19 @@ fi
|
|
|
386
385
|
|
|
387
386
|
```bash
|
|
388
387
|
#!/bin/bash
|
|
389
|
-
# Complex workflow with multiple checkpoints
|
|
388
|
+
# Complex workflow with multiple checkpoints (run in tmux session named "migration")
|
|
390
389
|
|
|
391
390
|
tg_alert "Starting migration workflow..."
|
|
392
391
|
|
|
393
392
|
# Step 1: Backup
|
|
394
|
-
tg_agent "
|
|
393
|
+
tg_agent "Backup database before migration?"
|
|
395
394
|
# Wait for approval...
|
|
396
395
|
|
|
397
396
|
# Step 2: Migration
|
|
398
397
|
./run-migration.sh && tg_done
|
|
399
398
|
|
|
400
399
|
# Step 3: Verification
|
|
401
|
-
tg_agent "
|
|
400
|
+
tg_agent "Verify migration results?"
|
|
402
401
|
# Wait for verification...
|
|
403
402
|
|
|
404
403
|
tg_alert "Migration workflow complete!"
|
|
@@ -86,8 +86,8 @@ telemux logs
|
|
|
86
86
|
# Send a simple notification
|
|
87
87
|
tg_alert "Build complete!"
|
|
88
88
|
|
|
89
|
-
# Send a message and receive replies
|
|
90
|
-
tg_agent "
|
|
89
|
+
# Send a message and receive replies (auto-detects tmux session name)
|
|
90
|
+
tg_agent "Ready to deploy to production?"
|
|
91
91
|
# Reply via Telegram: "session-name: yes"
|
|
92
92
|
# The reply appears directly in your terminal
|
|
93
93
|
|
|
@@ -151,27 +151,26 @@ tg_alert "Deploy complete
|
|
|
151
151
|
|
|
152
152
|
### `tg_agent`
|
|
153
153
|
|
|
154
|
-
Send messages and receive replies via Telegram:
|
|
154
|
+
Send messages and receive replies via Telegram (automatically uses your tmux session name):
|
|
155
155
|
|
|
156
156
|
```bash
|
|
157
|
-
tg_agent "
|
|
157
|
+
tg_agent "Message text"
|
|
158
158
|
```
|
|
159
159
|
|
|
160
160
|
**Examples:**
|
|
161
161
|
|
|
162
162
|
```bash
|
|
163
|
-
# Ask a question
|
|
164
|
-
tg_agent "
|
|
163
|
+
# Ask a question (inside a tmux session named "deploy")
|
|
164
|
+
tg_agent "Ready to deploy to production?"
|
|
165
165
|
|
|
166
166
|
# Wait for user response via Telegram
|
|
167
|
-
# User replies: "
|
|
167
|
+
# User replies: "deploy: yes, proceed"
|
|
168
168
|
# Reply appears in your terminal
|
|
169
169
|
|
|
170
|
-
# Use in scripts
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
fi
|
|
170
|
+
# Use in scripts (inside a tmux session named "approval")
|
|
171
|
+
tg_agent "Approve release v2.0?"
|
|
172
|
+
# Returns the session name, user responds via Telegram
|
|
173
|
+
# Check incoming message for approval
|
|
175
174
|
```
|
|
176
175
|
|
|
177
176
|
### `tg_done`
|
|
@@ -195,10 +194,10 @@ TeleMux uses **session-based routing** for bidirectional communication:
|
|
|
195
194
|
|
|
196
195
|
```bash
|
|
197
196
|
# In tmux session named "deploy"
|
|
198
|
-
tg_agent "
|
|
197
|
+
tg_agent "Should I proceed with deployment?"
|
|
199
198
|
```
|
|
200
199
|
|
|
201
|
-
This sends a message to Telegram with instructions on how to reply.
|
|
200
|
+
This sends a message to Telegram with instructions on how to reply. The session name is automatically detected.
|
|
202
201
|
|
|
203
202
|
### Replying from Telegram
|
|
204
203
|
|
|
@@ -330,11 +329,11 @@ fi
|
|
|
330
329
|
|
|
331
330
|
```bash
|
|
332
331
|
#!/bin/bash
|
|
333
|
-
# Deployment with approval
|
|
332
|
+
# Deployment with approval (run in tmux session named "deploy")
|
|
334
333
|
|
|
335
|
-
tg_agent "
|
|
334
|
+
tg_agent "Ready to deploy v2.0 to production?"
|
|
336
335
|
|
|
337
|
-
# User responds via Telegram: "
|
|
336
|
+
# User responds via Telegram: "deploy: yes"
|
|
338
337
|
# Response appears in terminal
|
|
339
338
|
|
|
340
339
|
read -p "Proceed with deployment? " response
|
|
@@ -348,19 +347,19 @@ fi
|
|
|
348
347
|
|
|
349
348
|
```bash
|
|
350
349
|
#!/bin/bash
|
|
351
|
-
# Complex workflow with multiple checkpoints
|
|
350
|
+
# Complex workflow with multiple checkpoints (run in tmux session named "migration")
|
|
352
351
|
|
|
353
352
|
tg_alert "Starting migration workflow..."
|
|
354
353
|
|
|
355
354
|
# Step 1: Backup
|
|
356
|
-
tg_agent "
|
|
355
|
+
tg_agent "Backup database before migration?"
|
|
357
356
|
# Wait for approval...
|
|
358
357
|
|
|
359
358
|
# Step 2: Migration
|
|
360
359
|
./run-migration.sh && tg_done
|
|
361
360
|
|
|
362
361
|
# Step 3: Verification
|
|
363
|
-
tg_agent "
|
|
362
|
+
tg_agent "Verify migration results?"
|
|
364
363
|
# Wait for verification...
|
|
365
364
|
|
|
366
365
|
tg_alert "Migration workflow complete!"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "telemux"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.3"
|
|
8
8
|
description = "Bidirectional Telegram integration for tmux sessions - monitor commands and interact with agents"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.7"
|
|
@@ -243,7 +243,7 @@ def process_update(update: Dict[str, Any], bot_token: str, chat_id: str) -> None
|
|
|
243
243
|
# tmux send-keys interprets special characters like $(), ``, &&, ;
|
|
244
244
|
# Without sanitization, malicious input could execute arbitrary commands
|
|
245
245
|
safe_response = shlex.quote(response)
|
|
246
|
-
formatted_message = f"{safe_response}\n # Respond using
|
|
246
|
+
formatted_message = f"{safe_response}\n # Respond using: tg_agent \"your response\""
|
|
247
247
|
|
|
248
248
|
# Send message to tmux session
|
|
249
249
|
result = subprocess.run(
|
|
@@ -41,18 +41,25 @@ tg_alert() {
|
|
|
41
41
|
|
|
42
42
|
# Bidirectional agent alert - sends message and can receive replies
|
|
43
43
|
tg_agent() {
|
|
44
|
-
local
|
|
45
|
-
local message="$2"
|
|
44
|
+
local message="$*"
|
|
46
45
|
|
|
47
|
-
if [[ -z "$
|
|
48
|
-
echo "Usage: tg_agent <
|
|
46
|
+
if [[ -z "$message" ]]; then
|
|
47
|
+
echo "Usage: tg_agent <message>"
|
|
49
48
|
return 1
|
|
50
49
|
fi
|
|
51
50
|
|
|
52
|
-
#
|
|
51
|
+
# Auto-detect tmux session name
|
|
53
52
|
local tmux_session="$(tmux display-message -p '#S' 2>/dev/null || echo 'unknown')"
|
|
53
|
+
local agent_name="${tmux_session}"
|
|
54
54
|
local msg_id="${tmux_session}"
|
|
55
55
|
|
|
56
|
+
# Check if we're in a tmux session
|
|
57
|
+
if [[ -z "$TMUX" ]]; then
|
|
58
|
+
echo "Warning: Not in a tmux session. Using 'terminal' as session name."
|
|
59
|
+
agent_name="terminal"
|
|
60
|
+
msg_id="terminal"
|
|
61
|
+
fi
|
|
62
|
+
|
|
56
63
|
# Record mapping for listener daemon (backward compatibility)
|
|
57
64
|
# NOTE: New routing doesn't require this, but kept for transition period
|
|
58
65
|
mkdir -p "$HOME/.telemux/message_queue"
|
|
@@ -61,12 +68,12 @@ tg_agent() {
|
|
|
61
68
|
# Send to Telegram with identifier
|
|
62
69
|
curl -s -X POST "https://api.telegram.org/bot${TELEMUX_TG_BOT_TOKEN}/sendMessage" \
|
|
63
70
|
-d chat_id="${TELEMUX_TG_CHAT_ID}" \
|
|
64
|
-
-d text="[>] <b>[${agent_name}
|
|
71
|
+
-d text="[>] <b>[${agent_name}]</b>
|
|
65
72
|
|
|
66
73
|
${message}
|
|
67
74
|
|
|
68
75
|
<i>Reply with: ${msg_id}: your response</i>" \
|
|
69
|
-
-d parse_mode="HTML" > /dev/null && echo "Agent
|
|
76
|
+
-d parse_mode="HTML" > /dev/null && echo "Agent message sent from: ${msg_id}"
|
|
70
77
|
|
|
71
78
|
echo "$msg_id" # Return message ID
|
|
72
79
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: telemux
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Bidirectional Telegram integration for tmux sessions - monitor commands and interact with agents
|
|
5
5
|
Author-email: Marco Almazan <marco@example.com>
|
|
6
6
|
License: MIT
|
|
@@ -124,8 +124,8 @@ telemux logs
|
|
|
124
124
|
# Send a simple notification
|
|
125
125
|
tg_alert "Build complete!"
|
|
126
126
|
|
|
127
|
-
# Send a message and receive replies
|
|
128
|
-
tg_agent "
|
|
127
|
+
# Send a message and receive replies (auto-detects tmux session name)
|
|
128
|
+
tg_agent "Ready to deploy to production?"
|
|
129
129
|
# Reply via Telegram: "session-name: yes"
|
|
130
130
|
# The reply appears directly in your terminal
|
|
131
131
|
|
|
@@ -189,27 +189,26 @@ tg_alert "Deploy complete
|
|
|
189
189
|
|
|
190
190
|
### `tg_agent`
|
|
191
191
|
|
|
192
|
-
Send messages and receive replies via Telegram:
|
|
192
|
+
Send messages and receive replies via Telegram (automatically uses your tmux session name):
|
|
193
193
|
|
|
194
194
|
```bash
|
|
195
|
-
tg_agent "
|
|
195
|
+
tg_agent "Message text"
|
|
196
196
|
```
|
|
197
197
|
|
|
198
198
|
**Examples:**
|
|
199
199
|
|
|
200
200
|
```bash
|
|
201
|
-
# Ask a question
|
|
202
|
-
tg_agent "
|
|
201
|
+
# Ask a question (inside a tmux session named "deploy")
|
|
202
|
+
tg_agent "Ready to deploy to production?"
|
|
203
203
|
|
|
204
204
|
# Wait for user response via Telegram
|
|
205
|
-
# User replies: "
|
|
205
|
+
# User replies: "deploy: yes, proceed"
|
|
206
206
|
# Reply appears in your terminal
|
|
207
207
|
|
|
208
|
-
# Use in scripts
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
fi
|
|
208
|
+
# Use in scripts (inside a tmux session named "approval")
|
|
209
|
+
tg_agent "Approve release v2.0?"
|
|
210
|
+
# Returns the session name, user responds via Telegram
|
|
211
|
+
# Check incoming message for approval
|
|
213
212
|
```
|
|
214
213
|
|
|
215
214
|
### `tg_done`
|
|
@@ -233,10 +232,10 @@ TeleMux uses **session-based routing** for bidirectional communication:
|
|
|
233
232
|
|
|
234
233
|
```bash
|
|
235
234
|
# In tmux session named "deploy"
|
|
236
|
-
tg_agent "
|
|
235
|
+
tg_agent "Should I proceed with deployment?"
|
|
237
236
|
```
|
|
238
237
|
|
|
239
|
-
This sends a message to Telegram with instructions on how to reply.
|
|
238
|
+
This sends a message to Telegram with instructions on how to reply. The session name is automatically detected.
|
|
240
239
|
|
|
241
240
|
### Replying from Telegram
|
|
242
241
|
|
|
@@ -368,11 +367,11 @@ fi
|
|
|
368
367
|
|
|
369
368
|
```bash
|
|
370
369
|
#!/bin/bash
|
|
371
|
-
# Deployment with approval
|
|
370
|
+
# Deployment with approval (run in tmux session named "deploy")
|
|
372
371
|
|
|
373
|
-
tg_agent "
|
|
372
|
+
tg_agent "Ready to deploy v2.0 to production?"
|
|
374
373
|
|
|
375
|
-
# User responds via Telegram: "
|
|
374
|
+
# User responds via Telegram: "deploy: yes"
|
|
376
375
|
# Response appears in terminal
|
|
377
376
|
|
|
378
377
|
read -p "Proceed with deployment? " response
|
|
@@ -386,19 +385,19 @@ fi
|
|
|
386
385
|
|
|
387
386
|
```bash
|
|
388
387
|
#!/bin/bash
|
|
389
|
-
# Complex workflow with multiple checkpoints
|
|
388
|
+
# Complex workflow with multiple checkpoints (run in tmux session named "migration")
|
|
390
389
|
|
|
391
390
|
tg_alert "Starting migration workflow..."
|
|
392
391
|
|
|
393
392
|
# Step 1: Backup
|
|
394
|
-
tg_agent "
|
|
393
|
+
tg_agent "Backup database before migration?"
|
|
395
394
|
# Wait for approval...
|
|
396
395
|
|
|
397
396
|
# Step 2: Migration
|
|
398
397
|
./run-migration.sh && tg_done
|
|
399
398
|
|
|
400
399
|
# Step 3: Verification
|
|
401
|
-
tg_agent "
|
|
400
|
+
tg_agent "Verify migration results?"
|
|
402
401
|
# Wait for verification...
|
|
403
402
|
|
|
404
403
|
tg_alert "Migration workflow complete!"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|