conexgram 0.1.0__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.
Files changed (32) hide show
  1. conexgram-0.1.0/LICENSE +21 -0
  2. conexgram-0.1.0/PKG-INFO +484 -0
  3. conexgram-0.1.0/README.md +458 -0
  4. conexgram-0.1.0/conexgram/__init__.py +3 -0
  5. conexgram-0.1.0/conexgram/__main__.py +5 -0
  6. conexgram-0.1.0/conexgram/agents.py +33 -0
  7. conexgram-0.1.0/conexgram/app.py +319 -0
  8. conexgram-0.1.0/conexgram/cli.py +139 -0
  9. conexgram-0.1.0/conexgram/codex_runner.py +280 -0
  10. conexgram-0.1.0/conexgram/commands.py +1014 -0
  11. conexgram-0.1.0/conexgram/config.py +276 -0
  12. conexgram-0.1.0/conexgram/message_format.py +21 -0
  13. conexgram-0.1.0/conexgram/paths.py +21 -0
  14. conexgram-0.1.0/conexgram/progress.py +89 -0
  15. conexgram-0.1.0/conexgram/service.py +130 -0
  16. conexgram-0.1.0/conexgram/session_store.py +415 -0
  17. conexgram-0.1.0/conexgram/setup_wizard.py +117 -0
  18. conexgram-0.1.0/conexgram/telegram_api.py +237 -0
  19. conexgram-0.1.0/conexgram.egg-info/PKG-INFO +484 -0
  20. conexgram-0.1.0/conexgram.egg-info/SOURCES.txt +30 -0
  21. conexgram-0.1.0/conexgram.egg-info/dependency_links.txt +1 -0
  22. conexgram-0.1.0/conexgram.egg-info/entry_points.txt +2 -0
  23. conexgram-0.1.0/conexgram.egg-info/top_level.txt +1 -0
  24. conexgram-0.1.0/pyproject.toml +43 -0
  25. conexgram-0.1.0/setup.cfg +4 -0
  26. conexgram-0.1.0/tests/test_app.py +73 -0
  27. conexgram-0.1.0/tests/test_codex_runner.py +81 -0
  28. conexgram-0.1.0/tests/test_commands.py +252 -0
  29. conexgram-0.1.0/tests/test_config.py +49 -0
  30. conexgram-0.1.0/tests/test_message_format.py +17 -0
  31. conexgram-0.1.0/tests/test_session_store.py +28 -0
  32. conexgram-0.1.0/tests/test_telegram_api.py +19 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alday Global
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,484 @@
1
+ Metadata-Version: 2.4
2
+ Name: conexgram
3
+ Version: 0.1.0
4
+ Summary: Run Codex CLI from Telegram
5
+ Author: Alday Global
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/aanoval/conexgram
8
+ Project-URL: Repository, https://github.com/aanoval/conexgram
9
+ Project-URL: Issues, https://github.com/aanoval/conexgram/issues
10
+ Keywords: codex,telegram,cli,remote,gateway
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Environment :: Console
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Operating System :: MacOS
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Topic :: Communications :: Chat
21
+ Classifier: Topic :: Software Development :: Build Tools
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Dynamic: license-file
26
+
27
+ # Conexgram
28
+
29
+ [![CI](https://github.com/aanoval/conexgram/actions/workflows/ci.yml/badge.svg)](https://github.com/aanoval/conexgram/actions/workflows/ci.yml)
30
+ [![PyPI](https://img.shields.io/pypi/v/conexgram.svg)](https://pypi.org/project/conexgram/)
31
+ [![Python](https://img.shields.io/pypi/pyversions/conexgram.svg)](https://pypi.org/project/conexgram/)
32
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
33
+
34
+ Run Codex CLI from Telegram.
35
+
36
+ Conexgram keeps coding sessions running on your own computer and lets you manage them from your phone.
37
+
38
+ > Your code, credentials, and compute stay local.
39
+
40
+ ```text
41
+ Telegram -> Conexgram -> Codex CLI -> your local workspace -> Telegram
42
+ ```
43
+
44
+ ## Install in 3 minutes
45
+
46
+ Recommended:
47
+
48
+ ```bash
49
+ curl -fsSL https://conexgram.com/install.sh | bash
50
+ ```
51
+
52
+ Or with `pipx`:
53
+
54
+ ```bash
55
+ pipx install conexgram
56
+ conexgram setup
57
+ conexgram doctor --fix
58
+ conexgram install-service
59
+ ```
60
+
61
+ Run in the foreground instead of installing a service:
62
+
63
+ ```bash
64
+ conexgram run
65
+ ```
66
+
67
+ Then send `/start` or `/settings` to your Telegram bot.
68
+
69
+ If the bot says you are unauthorized, it will show your Telegram user ID and chat ID. Add one of those IDs to `~/.conexgram/config.json`.
70
+
71
+ ## Why Conexgram?
72
+
73
+ Conexgram is useful when you want Codex to stay attached to your real local workspace while Telegram becomes the remote control surface. It is a good fit when you want to inspect a codebase, continue a session, check progress, or run supervised automation without opening your laptop.
74
+
75
+ Good fits:
76
+
77
+ - personal remote coding assistant for your workstation
78
+ - lightweight DevOps helper for trusted private machines
79
+ - Telegram-controlled Codex sessions for long-running work
80
+ - local-first bridge for future multi-agent workflows
81
+
82
+ ## Features
83
+
84
+ - Telegram bot -> Codex CLI bridge
85
+ - Persistent Codex sessions per chat or per user
86
+ - Session controls like `/new`, `/status`, `/sessions`, `/switch`, `/workspace`
87
+ - Runtime controls like `/model`, `/reasoning`, `/mode`, `/preset`, `/fast`
88
+ - Progress UX like `/typing`, `/progress`, `/silent`, `/tail`
89
+ - Telegram file upload into the active workspace
90
+ - Optional local file send-back with `/sendfile`
91
+ - Works in the foreground or as an auto-start service on macOS, Linux, or Windows
92
+ - No third-party Python dependencies
93
+ - Small modular Python internals with room for future agent routing
94
+
95
+ ## How it works
96
+
97
+ ```text
98
+ Telegram message
99
+ -> Telegram Bot API
100
+ -> Conexgram on your machine
101
+ -> Codex CLI
102
+ -> final response
103
+ -> Telegram reply
104
+ ```
105
+
106
+ ## What you can do from Telegram
107
+
108
+ - Start and resume Codex sessions
109
+ - Switch between safe, work, fast, power, and Computer Access presets
110
+ - Change model and reasoning effort per session
111
+ - Upload files into the active workspace
112
+ - Send local files back to Telegram
113
+ - Watch long-running tasks with typing and progress indicators
114
+ - Stop a running Codex turn from your phone
115
+
116
+ Conexgram keeps two layers of state:
117
+
118
+ - **Gateway session**: local session record managed by Conexgram
119
+ - **Codex thread**: actual Codex CLI thread id used for resume/continuation
120
+
121
+ ## Security model
122
+
123
+ Conexgram is remote-control software. Treat it like operator tooling, not a public chatbot.
124
+
125
+ - Your code, credentials, and compute stay on your own machine
126
+ - Telegram access should be restricted with `allowed_user_ids` or `allowed_chat_ids`
127
+ - Workspace mode is the recommended default
128
+ - Full access and Computer Access require explicit local opt-in
129
+
130
+ Read more in [docs/security.md](docs/security.md).
131
+
132
+ ## Requirements
133
+
134
+ - Python 3.11+
135
+ - `codex` CLI installed and authenticated
136
+ - A Telegram bot token from BotFather
137
+ - Your Telegram user id or allowed chat id
138
+
139
+ Quick check:
140
+
141
+ ```bash
142
+ codex --version
143
+ codex exec --help
144
+ python3 --version
145
+ ```
146
+
147
+ ## Source checkout
148
+
149
+ If you want to run from a source clone:
150
+
151
+ ```bash
152
+ git clone https://github.com/aanoval/conexgram.git
153
+ cd conexgram
154
+ python3 -m conexgram setup
155
+ python3 -m conexgram doctor --fix
156
+ python3 -m conexgram run
157
+ ```
158
+
159
+ ## Install from source
160
+
161
+ ```bash
162
+ git clone https://github.com/aanoval/conexgram.git
163
+ cd conexgram
164
+ python3 -m conexgram init-config
165
+ ```
166
+
167
+ For a guided setup:
168
+
169
+ ```bash
170
+ python3 -m conexgram setup
171
+ ```
172
+
173
+ Or edit config manually:
174
+
175
+ ```bash
176
+ nano ~/.conexgram/config.json
177
+ ```
178
+
179
+ Then validate:
180
+
181
+ ```bash
182
+ python3 -m conexgram doctor
183
+ ```
184
+
185
+ Run:
186
+
187
+ ```bash
188
+ python3 -m conexgram run
189
+ ```
190
+
191
+ You can also use the entry script:
192
+
193
+ ```bash
194
+ python3 gateway.py run
195
+ ```
196
+
197
+ ## One-tap auto-start install
198
+
199
+ Create and edit `~/.conexgram/config.json` first, then run the installer for your platform.
200
+ If the config does not exist yet, `./scripts/install.sh` starts the guided setup first.
201
+
202
+ macOS or Linux:
203
+
204
+ ```bash
205
+ ./scripts/install.sh
206
+ ```
207
+
208
+ macOS direct installer:
209
+
210
+ ```bash
211
+ ./scripts/install_launch_agent.sh
212
+ ```
213
+
214
+ Linux user systemd installer:
215
+
216
+ ```bash
217
+ ./scripts/install_linux_systemd.sh
218
+ ```
219
+
220
+ Windows PowerShell:
221
+
222
+ ```powershell
223
+ powershell -ExecutionPolicy Bypass -File .\scripts\install_windows.ps1
224
+ ```
225
+
226
+ The installers register Conexgram to launch automatically at login and start it immediately.
227
+
228
+ If Conexgram was installed with `pipx`, you can also use:
229
+
230
+ ```bash
231
+ conexgram install-service
232
+ conexgram uninstall-service
233
+ ```
234
+
235
+ ## Example config
236
+
237
+ Key fields:
238
+
239
+ - `telegram.bot_token`
240
+ - `telegram.allowed_user_ids`
241
+ - `telegram.allowed_chat_ids`
242
+ - `codex.binary`
243
+ - `codex.default_working_dir`
244
+ - `codex.additional_writable_dirs`
245
+ - `codex.workspace_roots`
246
+ - `codex.model`
247
+ - `codex.reasoning_effort` (optional; leave empty to use the Codex default)
248
+ - `codex.mode`
249
+ - `codex.full_access`
250
+ - `codex.allow_runtime_full_access`
251
+ - `progress.typing_indicator`
252
+ - `progress.progress_messages`
253
+
254
+ Troubleshooting: see `docs/troubleshooting.md`.
255
+
256
+ Generate a fresh config:
257
+
258
+ ```bash
259
+ python3 -m conexgram example-config
260
+ ```
261
+
262
+ ## Commands
263
+
264
+ Common commands first:
265
+
266
+ - `/new [working_dir]` — start a fresh Codex session
267
+ - `/status` — show the active session
268
+ - `/sessions` — list recent sessions
269
+ - `/workspace [list|switch <path_or_number>|<path>]` — show or set allowed workspace
270
+ - `/settings` — show a friendly settings panel
271
+ - `/tail` — show the latest Codex output for this session
272
+ - `/stop` — stop the running Codex process
273
+
274
+ Full command set:
275
+
276
+ - `/new [working_dir]` — start a fresh Codex session
277
+ - `/status` — show the active session
278
+ - `/sessions` — list recent sessions
279
+ - `/switch <number_or_id>` — switch active session
280
+ - `/cwd [path]` — show or set working directory before Codex thread starts
281
+ - `/workspace [list|switch <path_or_number>|<path>]` — show or set allowed workspace
282
+ - `/model [name|default]` — show or set model for this session
283
+ - `/models` — list configured model presets
284
+ - `/reasoning default|low|medium|high|xhigh` — set reasoning effort, or reset to the Codex default
285
+ - `/mode safe|workspace|full|<preset>` — set execution mode or preset
286
+ - `/preset list|safe|work|fast|power|computer` — apply a common setup
287
+ - `/fast on|off` — toggle fast mode
288
+ - `/fullaccess status|on|off` — inspect or toggle full access if config allows it
289
+ - `/computer status|on|off` — user-friendly alias for full access
290
+ - `/settings` — show a friendly settings panel
291
+ - `/permissions` — show effective local access settings
292
+ - `/typing status|on|off|default` — control typing indicator for this session
293
+ - `/progress status|on|off|default` — control long-running progress messages
294
+ - `/silent status|on|off|default` — quickly silence or restore progress UX
295
+ - `/rename <title>` — rename active session
296
+ - `/summary` — show active session summary
297
+ - `/reset` — start a fresh default session
298
+ - `/logs [gateway|launchd]` — send a local log file
299
+ - `/tail` — show the latest Codex output for this session
300
+ - `/doctor` — run setup checks from Telegram
301
+ - `/version` — show Conexgram, Python, and Codex details
302
+ - `/config` — show config summary
303
+ - `/quota` — show Codex usage and rate-limit status
304
+ - `/codexstatus` — alias for `/quota`
305
+ - `/codex <args>` — run a native Codex CLI command, for example `/codex --version`
306
+ - `/sendfile <path> [caption]` — send a local file to Telegram
307
+ - `/stop` — stop the running Codex process
308
+ - `/help` — show help
309
+
310
+ Any non-command text is forwarded to the active Codex session.
311
+
312
+ ## Progress UX
313
+
314
+ Conexgram can show Telegram's `typing...` indicator while Codex is running. Telegram only displays each typing action briefly, so Conexgram refreshes it every few seconds.
315
+
316
+ Default:
317
+
318
+ ```json
319
+ {
320
+ "progress": {
321
+ "typing_indicator": true,
322
+ "typing_interval_seconds": 4,
323
+ "progress_messages": true,
324
+ "progress_interval_seconds": 60
325
+ }
326
+ }
327
+ ```
328
+
329
+ Set both values to `false` to keep the bot silent until Codex returns the final answer:
330
+
331
+ ```json
332
+ {
333
+ "progress": {
334
+ "typing_indicator": false,
335
+ "progress_messages": false
336
+ }
337
+ }
338
+ ```
339
+
340
+ Allowed Telegram users can also change progress UX per session:
341
+
342
+ ```text
343
+ /typing off
344
+ /progress off
345
+ /silent on
346
+ /silent default
347
+ ```
348
+
349
+ ## Security notes
350
+
351
+ Conexgram can expose meaningful access to your local machine through Codex CLI.
352
+
353
+ Recommended defaults:
354
+
355
+ - keep the bot private
356
+ - use `allowed_user_ids` and/or `allowed_chat_ids`
357
+ - leave `full_access` as `false` unless you explicitly want unrestricted Codex execution
358
+ - leave `allow_runtime_full_access` as `false` unless you want Telegram users to toggle full access
359
+ - set `workspace_roots` so `/workspace`, `/cwd`, and `/sendfile` stay inside known folders
360
+ - run it on a dedicated machine or workspace if possible
361
+
362
+ When `codex.full_access=true`, Conexgram adds:
363
+
364
+ ```bash
365
+ --dangerously-bypass-approvals-and-sandbox
366
+ ```
367
+
368
+ Only enable that if you understand the risk.
369
+
370
+ ### Runtime full access from Telegram
371
+
372
+ Telegram users cannot enable full access by default. The machine owner must opt in locally first:
373
+
374
+ ```json
375
+ {
376
+ "codex": {
377
+ "full_access": false,
378
+ "allow_runtime_full_access": true
379
+ }
380
+ }
381
+ ```
382
+
383
+ After restarting Conexgram, allowed Telegram users can toggle it:
384
+
385
+ ```text
386
+ /fullaccess on
387
+ /fullaccess off
388
+ /fullaccess status
389
+ /mode full
390
+ /mode safe
391
+ ```
392
+
393
+ Keep `allow_runtime_full_access=false` if the Telegram bot should never be able to switch Codex into unrestricted local execution.
394
+
395
+ For non-technical users, `/computer` is the friendly alias:
396
+
397
+ ```text
398
+ /computer status
399
+ /computer on
400
+ /computer off
401
+ /confirm computer
402
+ ```
403
+
404
+ Common presets:
405
+
406
+ ```text
407
+ /preset safe
408
+ /preset work
409
+ /preset fast
410
+ /preset power
411
+ /preset computer
412
+ ```
413
+
414
+ `/preset computer` also requires `allow_runtime_full_access=true`.
415
+
416
+ Conexgram is unofficial and is not affiliated with OpenAI.
417
+
418
+ ## Auto-start services
419
+
420
+ macOS uses a LaunchAgent:
421
+
422
+ ```bash
423
+ ./scripts/install_launch_agent.sh
424
+ ```
425
+
426
+ Stop macOS:
427
+
428
+ ```bash
429
+ launchctl bootout "gui/$(id -u)/com.conexgram.agent"
430
+ ```
431
+
432
+ Linux uses a user systemd service:
433
+
434
+ ```bash
435
+ systemctl --user status conexgram.service
436
+ systemctl --user disable --now conexgram.service
437
+ ```
438
+
439
+ Windows uses a Scheduled Task:
440
+
441
+ ```powershell
442
+ Get-ScheduledTask -TaskName Conexgram
443
+ Stop-ScheduledTask -TaskName Conexgram
444
+ ```
445
+
446
+ Logs:
447
+
448
+ ```text
449
+ ~/.conexgram/gateway.log
450
+ ~/.conexgram/logs/
451
+ ```
452
+
453
+ ## Internal structure
454
+
455
+ Key modules:
456
+
457
+ - `conexgram/app.py` — gateway loop and Telegram update processing
458
+ - `conexgram/commands.py` — Telegram slash commands
459
+ - `conexgram/codex_runner.py` — Codex CLI execution and JSON event parsing
460
+ - `conexgram/progress.py` — typing indicator and long-running progress messages
461
+ - `conexgram/session_store.py` — local session persistence
462
+ - `conexgram/agents.py` — future multi-agent profile primitives
463
+
464
+ ## Packaging
465
+
466
+ For users:
467
+
468
+ ```bash
469
+ pipx install conexgram
470
+ ```
471
+
472
+ For local editable development:
473
+
474
+ ```bash
475
+ pip install -e .
476
+ conexgram --help
477
+ ```
478
+
479
+ Release details: see `docs/pypi-release.md`.
480
+ Curl installer details: see `docs/curl-install.md`.
481
+
482
+ ## Project status
483
+
484
+ Conexgram is intentionally small and focused. The goal is a clean, understandable bridge for remote Codex usage over Telegram — not a full remote agent platform.