tmuxd
tmuxd = 一个 Python 库,把 tmux 和 ttyd 拼成"活得比连接久、还能被程序往里敲的终端"。
ttyd tmux new -A -s work 这条命令大家都写过:tmux 让会话活着,ttyd 让你在浏览器里看见。
拼是拼上了,但拼出来的东西没有把手——会话是谁开的、开在哪个目录、还活着没有,一概问不到;
想从外面往里投喂一条指令,只能 ssh 进去敲 tmux send-keys。
from tmuxd import Tmuxd
t = Tmuxd(port=12345, token="changeme") # 这行之后:ttyd 起来了,tmux 还没有
s = t.session(id="id5", cwd="~/proj", cmd="claude")
s.send("把测试跑一遍", enter=True)
print(s.url) # http://localhost:12345/?arg=id5
四行。那个 URL 发给谁,谁在浏览器里就进了这个终端 —— 看得见,也能直接接手敲。
- 核心是库,不是服务 —— CLI 和 HTTP 都只是套在外面的壳,HTTP 默认不开
- 会话模型小到一句话 —— 一个 id、一个启动目录、一条启动命令,没有第四个字段
- 门面短命,屋子长命 —— ttyd 是你进程的子进程,tmux 会话谁的都不是,你退了它还在
- 不读,只写 —— 没有 capture / run / 输出流;读归人(打开 URL)或归 ssh
- 全部可读可写 —— 这一层不做权限,要区分谁能看谁能写,往有身份的上层去锁
- 不碰你自己的 tmux —— 只探测二进制,一律
-L开专属池;你的tmux ls一个不多一个不少 - 没有自己发明的路径 —— 进终端的地址就是 ttyd 原生的
?arg=<id>
pip install tmuxd
tmuxd start # 想让网页入口活得比脚本久,就用 CLI 起一个常驻的
tmuxd new -s work -c ~/proj
tmuxd url -t work
设计文档:docs/v1/works
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tmuxd-1.0.0.tar.gz
(70.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
tmuxd-1.0.0-py3-none-any.whl
(32.3 kB
view details)
File details
Details for the file tmuxd-1.0.0.tar.gz.
File metadata
- Download URL: tmuxd-1.0.0.tar.gz
- Upload date:
- Size: 70.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66ac589c65dc875a57034c161d716262e76d725a49654bc99c92dda7fdcd6a28
|
|
| MD5 |
13e7c8480f4e3725c73ce1053ac94ef6
|
|
| BLAKE2b-256 |
0c4aff1ececefe2740df5e86f72f694cf857b8aa578ee8e798af944a10082b75
|
File details
Details for the file tmuxd-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tmuxd-1.0.0-py3-none-any.whl
- Upload date:
- Size: 32.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07164e37e7089d8f825b60f11bc96b0be40dcdeeb75077b8e2ae40d6180ccea0
|
|
| MD5 |
1ae9b4a9d87a85cf16404131e1f1eb77
|
|
| BLAKE2b-256 |
9e9a928a73edb9e1af9b5922104225a5e147fb4823bdeb353bec010ef7c8e0ec
|