coterm 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.
coterm-0.1.0/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Coterm CLI
2
+ Copyright (C) 2026 Coterm
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+
17
+ The canonical GNU AGPLv3 license text is available from the GNU Project:
18
+ https://www.gnu.org/licenses/agpl-3.0.txt
@@ -0,0 +1,2 @@
1
+ include README.md
2
+ include LICENSE
coterm-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.4
2
+ Name: coterm
3
+ Version: 0.1.0
4
+ Summary: Coterm CLI runtime
5
+ Author: Coterm
6
+ License-Expression: AGPL-3.0-or-later
7
+ Project-URL: Homepage, https://github.com/Heipiao/coterm
8
+ Project-URL: Repository, https://github.com/Heipiao/coterm
9
+ Project-URL: Issues, https://github.com/Heipiao/coterm/issues
10
+ Keywords: coterm,cli,agent,terminal,remote
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Topic :: Terminals
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: websockets>=12.0
25
+ Requires-Dist: claude-agent-sdk>=0.1.49
26
+ Requires-Dist: qrcode>=7.4.2
27
+ Dynamic: license-file
28
+
29
+ # Coterm CLI
30
+
31
+ Coterm CLI is the local runtime for Coterm. It creates a session on a Coterm Hub, prints a pairing QR code, and runs the agent in your local terminal environment.
32
+
33
+ This package is designed to ship as an independent product:
34
+
35
+ - publish the source on GitHub
36
+ - distribute the CLI on PyPI with `pip install coterm`
37
+ - let users override the Hub with environment variables while keeping a built-in default
38
+
39
+ Source repository:
40
+
41
+ - `https://github.com/Heipiao/coterm`
42
+
43
+ ## License
44
+
45
+ This project is licensed under the GNU Affero General Public License v3.0 or later.
46
+
47
+ If you distribute a modified version of Coterm CLI, you must provide the corresponding source code under the AGPL as well.
48
+
49
+ AGPL is stricter than GPL for server software: if someone modifies Coterm CLI and lets users interact with that modified version over a network, they must also offer the corresponding source code for that running version.
50
+
51
+ ## Requirements
52
+
53
+ - Python 3.10 or newer
54
+ - A reachable Coterm Hub
55
+ - Claude installed and available on `PATH` for the current alpha implementation
56
+
57
+ ## Hub Configuration
58
+
59
+ Coterm CLI has a built-in default Hub:
60
+
61
+ ```text
62
+ http://127.0.0.1:18083
63
+ ```
64
+
65
+ You can override it with environment variables:
66
+
67
+ ```bash
68
+ export COTERM_HUB=http://your-hub.example.com
69
+ ```
70
+
71
+ Coterm CLI also accepts `COTERM_HUB_BASE_URL`.
72
+
73
+ Hub resolution order is:
74
+
75
+ 1. `--hub`
76
+ 2. `COTERM_HUB`
77
+ 3. `COTERM_HUB_BASE_URL`
78
+ 4. saved config in `~/.coterm/config.json`
79
+ 5. built-in default `http://127.0.0.1:18083`
80
+
81
+ ## Install
82
+
83
+ Install from a published package:
84
+
85
+ ```bash
86
+ pip install coterm
87
+ ```
88
+
89
+ Install from a cloned repository:
90
+
91
+ ```bash
92
+ cd coterm/cli
93
+ pip install .
94
+ ```
95
+
96
+ ## Quick Start
97
+
98
+ Check prerequisites:
99
+
100
+ ```bash
101
+ coterm doctor
102
+ ```
103
+
104
+ Point the CLI at your Hub if you are not using the default:
105
+
106
+ ```bash
107
+ export COTERM_HUB=http://your-hub.example.com
108
+ ```
109
+
110
+ Save Hub credentials if your Hub requires them:
111
+
112
+ ```bash
113
+ coterm auth login --hub http://127.0.0.1:18083
114
+ ```
115
+
116
+ Start a session:
117
+
118
+ ```bash
119
+ coterm
120
+ ```
121
+
122
+ This will:
123
+
124
+ 1. Create a session on the configured Hub
125
+ 2. Create a pairing token
126
+ 3. Print a QR code and pairing code
127
+ 4. Start the local agent runtime
128
+
129
+ On the mobile side, the user scans the QR code or enters the pairing code to bind the iPhone to that session.
130
+
131
+ ## Commands
132
+
133
+ ```bash
134
+ coterm
135
+ coterm doctor
136
+ coterm version
137
+ coterm auth status
138
+ coterm auth login --hub http://127.0.0.1:18083
139
+ coterm hub status
140
+ ```
141
+
142
+ ## Configuration
143
+
144
+ Coterm CLI reads configuration from CLI flags, environment variables, and `~/.coterm/config.json`.
145
+
146
+ Important environment variables:
147
+
148
+ - `COTERM_HUB` or `COTERM_HUB_BASE_URL`: Hub base URL
149
+ - `COTERM_AUTH_TOKEN`: Hub auth token
150
+ - `COTERM_DEVICE_ID`: Override the generated local device id
151
+ - `COTERM_HOME`: Override config directory, default `~/.coterm`
152
+ - `COTERM_CLAUDE_BIN`: Path to the `claude` executable
153
+ - `COTERM_WORKING_DIR`: Default working directory
154
+
155
+ Resolution order for Hub configuration is:
156
+
157
+ 1. CLI argument
158
+ 2. Environment variable
159
+ 3. Saved config
160
+ 4. Built-in default `http://127.0.0.1:18083`
161
+
162
+ ## Product Notes
163
+
164
+ This package is designed to be independently installable. However, today it still depends on external runtime prerequisites:
165
+
166
+ - A Hub must already exist or be separately installable
167
+ - Claude must be installed separately
168
+ - Authentication setup depends on your Hub deployment model
169
+
170
+ For production distribution, treat `coterm-cli` and `coterm-hub` as separate deliverables unless you intentionally publish both.
171
+
172
+ At the moment:
173
+
174
+ - `coterm` is the user-facing runtime package
175
+ - `coterm-hub` should be installed separately if you want local Hub management
176
+ - `coterm hub start` should only be documented as supported when `coterm-hub` is actually installed
coterm-0.1.0/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # Coterm CLI
2
+
3
+ Coterm CLI is the local runtime for Coterm. It creates a session on a Coterm Hub, prints a pairing QR code, and runs the agent in your local terminal environment.
4
+
5
+ This package is designed to ship as an independent product:
6
+
7
+ - publish the source on GitHub
8
+ - distribute the CLI on PyPI with `pip install coterm`
9
+ - let users override the Hub with environment variables while keeping a built-in default
10
+
11
+ Source repository:
12
+
13
+ - `https://github.com/Heipiao/coterm`
14
+
15
+ ## License
16
+
17
+ This project is licensed under the GNU Affero General Public License v3.0 or later.
18
+
19
+ If you distribute a modified version of Coterm CLI, you must provide the corresponding source code under the AGPL as well.
20
+
21
+ AGPL is stricter than GPL for server software: if someone modifies Coterm CLI and lets users interact with that modified version over a network, they must also offer the corresponding source code for that running version.
22
+
23
+ ## Requirements
24
+
25
+ - Python 3.10 or newer
26
+ - A reachable Coterm Hub
27
+ - Claude installed and available on `PATH` for the current alpha implementation
28
+
29
+ ## Hub Configuration
30
+
31
+ Coterm CLI has a built-in default Hub:
32
+
33
+ ```text
34
+ http://127.0.0.1:18083
35
+ ```
36
+
37
+ You can override it with environment variables:
38
+
39
+ ```bash
40
+ export COTERM_HUB=http://your-hub.example.com
41
+ ```
42
+
43
+ Coterm CLI also accepts `COTERM_HUB_BASE_URL`.
44
+
45
+ Hub resolution order is:
46
+
47
+ 1. `--hub`
48
+ 2. `COTERM_HUB`
49
+ 3. `COTERM_HUB_BASE_URL`
50
+ 4. saved config in `~/.coterm/config.json`
51
+ 5. built-in default `http://127.0.0.1:18083`
52
+
53
+ ## Install
54
+
55
+ Install from a published package:
56
+
57
+ ```bash
58
+ pip install coterm
59
+ ```
60
+
61
+ Install from a cloned repository:
62
+
63
+ ```bash
64
+ cd coterm/cli
65
+ pip install .
66
+ ```
67
+
68
+ ## Quick Start
69
+
70
+ Check prerequisites:
71
+
72
+ ```bash
73
+ coterm doctor
74
+ ```
75
+
76
+ Point the CLI at your Hub if you are not using the default:
77
+
78
+ ```bash
79
+ export COTERM_HUB=http://your-hub.example.com
80
+ ```
81
+
82
+ Save Hub credentials if your Hub requires them:
83
+
84
+ ```bash
85
+ coterm auth login --hub http://127.0.0.1:18083
86
+ ```
87
+
88
+ Start a session:
89
+
90
+ ```bash
91
+ coterm
92
+ ```
93
+
94
+ This will:
95
+
96
+ 1. Create a session on the configured Hub
97
+ 2. Create a pairing token
98
+ 3. Print a QR code and pairing code
99
+ 4. Start the local agent runtime
100
+
101
+ On the mobile side, the user scans the QR code or enters the pairing code to bind the iPhone to that session.
102
+
103
+ ## Commands
104
+
105
+ ```bash
106
+ coterm
107
+ coterm doctor
108
+ coterm version
109
+ coterm auth status
110
+ coterm auth login --hub http://127.0.0.1:18083
111
+ coterm hub status
112
+ ```
113
+
114
+ ## Configuration
115
+
116
+ Coterm CLI reads configuration from CLI flags, environment variables, and `~/.coterm/config.json`.
117
+
118
+ Important environment variables:
119
+
120
+ - `COTERM_HUB` or `COTERM_HUB_BASE_URL`: Hub base URL
121
+ - `COTERM_AUTH_TOKEN`: Hub auth token
122
+ - `COTERM_DEVICE_ID`: Override the generated local device id
123
+ - `COTERM_HOME`: Override config directory, default `~/.coterm`
124
+ - `COTERM_CLAUDE_BIN`: Path to the `claude` executable
125
+ - `COTERM_WORKING_DIR`: Default working directory
126
+
127
+ Resolution order for Hub configuration is:
128
+
129
+ 1. CLI argument
130
+ 2. Environment variable
131
+ 3. Saved config
132
+ 4. Built-in default `http://127.0.0.1:18083`
133
+
134
+ ## Product Notes
135
+
136
+ This package is designed to be independently installable. However, today it still depends on external runtime prerequisites:
137
+
138
+ - A Hub must already exist or be separately installable
139
+ - Claude must be installed separately
140
+ - Authentication setup depends on your Hub deployment model
141
+
142
+ For production distribution, treat `coterm-cli` and `coterm-hub` as separate deliverables unless you intentionally publish both.
143
+
144
+ At the moment:
145
+
146
+ - `coterm` is the user-facing runtime package
147
+ - `coterm-hub` should be installed separately if you want local Hub management
148
+ - `coterm hub start` should only be documented as supported when `coterm-hub` is actually installed
@@ -0,0 +1,51 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "coterm"
7
+ description = "Coterm CLI runtime"
8
+ readme = "README.md"
9
+ requires-python = ">=3.10"
10
+ license = "AGPL-3.0-or-later"
11
+ license-files = ["LICENSE"]
12
+ authors = [
13
+ {name = "Coterm"},
14
+ ]
15
+ keywords = ["coterm", "cli", "agent", "terminal", "remote"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Topic :: Software Development",
26
+ "Topic :: Terminals",
27
+ ]
28
+ dynamic = ["version"]
29
+ dependencies = [
30
+ "websockets>=12.0",
31
+ "claude-agent-sdk>=0.1.49",
32
+ "qrcode>=7.4.2",
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/Heipiao/coterm"
37
+ Repository = "https://github.com/Heipiao/coterm"
38
+ Issues = "https://github.com/Heipiao/coterm/issues"
39
+
40
+ [project.scripts]
41
+ coterm = "coterm_cli.main:main"
42
+ coterm-cli = "coterm_cli.main:main"
43
+
44
+ [tool.setuptools.package-dir]
45
+ "" = "src"
46
+
47
+ [tool.setuptools.packages.find]
48
+ where = ["src"]
49
+
50
+ [tool.setuptools.dynamic]
51
+ version = {attr = "coterm_cli.__version__"}
coterm-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.4
2
+ Name: coterm
3
+ Version: 0.1.0
4
+ Summary: Coterm CLI runtime
5
+ Author: Coterm
6
+ License-Expression: AGPL-3.0-or-later
7
+ Project-URL: Homepage, https://github.com/Heipiao/coterm
8
+ Project-URL: Repository, https://github.com/Heipiao/coterm
9
+ Project-URL: Issues, https://github.com/Heipiao/coterm/issues
10
+ Keywords: coterm,cli,agent,terminal,remote
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Topic :: Terminals
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: websockets>=12.0
25
+ Requires-Dist: claude-agent-sdk>=0.1.49
26
+ Requires-Dist: qrcode>=7.4.2
27
+ Dynamic: license-file
28
+
29
+ # Coterm CLI
30
+
31
+ Coterm CLI is the local runtime for Coterm. It creates a session on a Coterm Hub, prints a pairing QR code, and runs the agent in your local terminal environment.
32
+
33
+ This package is designed to ship as an independent product:
34
+
35
+ - publish the source on GitHub
36
+ - distribute the CLI on PyPI with `pip install coterm`
37
+ - let users override the Hub with environment variables while keeping a built-in default
38
+
39
+ Source repository:
40
+
41
+ - `https://github.com/Heipiao/coterm`
42
+
43
+ ## License
44
+
45
+ This project is licensed under the GNU Affero General Public License v3.0 or later.
46
+
47
+ If you distribute a modified version of Coterm CLI, you must provide the corresponding source code under the AGPL as well.
48
+
49
+ AGPL is stricter than GPL for server software: if someone modifies Coterm CLI and lets users interact with that modified version over a network, they must also offer the corresponding source code for that running version.
50
+
51
+ ## Requirements
52
+
53
+ - Python 3.10 or newer
54
+ - A reachable Coterm Hub
55
+ - Claude installed and available on `PATH` for the current alpha implementation
56
+
57
+ ## Hub Configuration
58
+
59
+ Coterm CLI has a built-in default Hub:
60
+
61
+ ```text
62
+ http://127.0.0.1:18083
63
+ ```
64
+
65
+ You can override it with environment variables:
66
+
67
+ ```bash
68
+ export COTERM_HUB=http://your-hub.example.com
69
+ ```
70
+
71
+ Coterm CLI also accepts `COTERM_HUB_BASE_URL`.
72
+
73
+ Hub resolution order is:
74
+
75
+ 1. `--hub`
76
+ 2. `COTERM_HUB`
77
+ 3. `COTERM_HUB_BASE_URL`
78
+ 4. saved config in `~/.coterm/config.json`
79
+ 5. built-in default `http://127.0.0.1:18083`
80
+
81
+ ## Install
82
+
83
+ Install from a published package:
84
+
85
+ ```bash
86
+ pip install coterm
87
+ ```
88
+
89
+ Install from a cloned repository:
90
+
91
+ ```bash
92
+ cd coterm/cli
93
+ pip install .
94
+ ```
95
+
96
+ ## Quick Start
97
+
98
+ Check prerequisites:
99
+
100
+ ```bash
101
+ coterm doctor
102
+ ```
103
+
104
+ Point the CLI at your Hub if you are not using the default:
105
+
106
+ ```bash
107
+ export COTERM_HUB=http://your-hub.example.com
108
+ ```
109
+
110
+ Save Hub credentials if your Hub requires them:
111
+
112
+ ```bash
113
+ coterm auth login --hub http://127.0.0.1:18083
114
+ ```
115
+
116
+ Start a session:
117
+
118
+ ```bash
119
+ coterm
120
+ ```
121
+
122
+ This will:
123
+
124
+ 1. Create a session on the configured Hub
125
+ 2. Create a pairing token
126
+ 3. Print a QR code and pairing code
127
+ 4. Start the local agent runtime
128
+
129
+ On the mobile side, the user scans the QR code or enters the pairing code to bind the iPhone to that session.
130
+
131
+ ## Commands
132
+
133
+ ```bash
134
+ coterm
135
+ coterm doctor
136
+ coterm version
137
+ coterm auth status
138
+ coterm auth login --hub http://127.0.0.1:18083
139
+ coterm hub status
140
+ ```
141
+
142
+ ## Configuration
143
+
144
+ Coterm CLI reads configuration from CLI flags, environment variables, and `~/.coterm/config.json`.
145
+
146
+ Important environment variables:
147
+
148
+ - `COTERM_HUB` or `COTERM_HUB_BASE_URL`: Hub base URL
149
+ - `COTERM_AUTH_TOKEN`: Hub auth token
150
+ - `COTERM_DEVICE_ID`: Override the generated local device id
151
+ - `COTERM_HOME`: Override config directory, default `~/.coterm`
152
+ - `COTERM_CLAUDE_BIN`: Path to the `claude` executable
153
+ - `COTERM_WORKING_DIR`: Default working directory
154
+
155
+ Resolution order for Hub configuration is:
156
+
157
+ 1. CLI argument
158
+ 2. Environment variable
159
+ 3. Saved config
160
+ 4. Built-in default `http://127.0.0.1:18083`
161
+
162
+ ## Product Notes
163
+
164
+ This package is designed to be independently installable. However, today it still depends on external runtime prerequisites:
165
+
166
+ - A Hub must already exist or be separately installable
167
+ - Claude must be installed separately
168
+ - Authentication setup depends on your Hub deployment model
169
+
170
+ For production distribution, treat `coterm-cli` and `coterm-hub` as separate deliverables unless you intentionally publish both.
171
+
172
+ At the moment:
173
+
174
+ - `coterm` is the user-facing runtime package
175
+ - `coterm-hub` should be installed separately if you want local Hub management
176
+ - `coterm hub start` should only be documented as supported when `coterm-hub` is actually installed
@@ -0,0 +1,25 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ src/coterm.egg-info/PKG-INFO
6
+ src/coterm.egg-info/SOURCES.txt
7
+ src/coterm.egg-info/dependency_links.txt
8
+ src/coterm.egg-info/entry_points.txt
9
+ src/coterm.egg-info/requires.txt
10
+ src/coterm.egg-info/top_level.txt
11
+ src/coterm_cli/__init__.py
12
+ src/coterm_cli/__main__.py
13
+ src/coterm_cli/adapter.py
14
+ src/coterm_cli/bootstrap.py
15
+ src/coterm_cli/claude_adapter.py
16
+ src/coterm_cli/commands.py
17
+ src/coterm_cli/config.py
18
+ src/coterm_cli/hub_client.py
19
+ src/coterm_cli/main.py
20
+ src/coterm_cli/models.py
21
+ src/coterm_cli/process.py
22
+ src/coterm_cli/qr.py
23
+ src/coterm_cli/runtime.py
24
+ src/coterm_cli/session.py
25
+ src/coterm_cli/user_config.py
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ coterm = coterm_cli.main:main
3
+ coterm-cli = coterm_cli.main:main
@@ -0,0 +1,3 @@
1
+ websockets>=12.0
2
+ claude-agent-sdk>=0.1.49
3
+ qrcode>=7.4.2
@@ -0,0 +1 @@
1
+ coterm_cli
@@ -0,0 +1,3 @@
1
+ """Coterm CLI runtime package."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ from .main import main
2
+
3
+
4
+ if __name__ == "__main__":
5
+ main()
@@ -0,0 +1,32 @@
1
+ from __future__ import annotations
2
+
3
+ from abc import ABC, abstractmethod
4
+ from collections.abc import AsyncIterator
5
+
6
+ from .models import AgentEvent, PermissionDecision
7
+
8
+
9
+ class AgentAdapter(ABC):
10
+ @abstractmethod
11
+ async def start(self) -> None:
12
+ raise NotImplementedError
13
+
14
+ @abstractmethod
15
+ async def stop(self) -> None:
16
+ raise NotImplementedError
17
+
18
+ @abstractmethod
19
+ async def send_user_message(self, message_id: str, content: str) -> None:
20
+ raise NotImplementedError
21
+
22
+ @abstractmethod
23
+ async def send_permission_decision(self, request_id: str, decision: PermissionDecision) -> None:
24
+ raise NotImplementedError
25
+
26
+ @abstractmethod
27
+ async def cancel_current_turn(self) -> None:
28
+ raise NotImplementedError
29
+
30
+ @abstractmethod
31
+ async def events(self) -> AsyncIterator[AgentEvent]:
32
+ raise NotImplementedError