open-terminal-agent 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.
- open_terminal_agent-0.1.0/LICENSE +202 -0
- open_terminal_agent-0.1.0/MANIFEST.in +23 -0
- open_terminal_agent-0.1.0/PKG-INFO +321 -0
- open_terminal_agent-0.1.0/README.md +282 -0
- open_terminal_agent-0.1.0/ot.spec +114 -0
- open_terminal_agent-0.1.0/packaging/ot_entry.py +10 -0
- open_terminal_agent-0.1.0/pyproject.toml +87 -0
- open_terminal_agent-0.1.0/setup.cfg +4 -0
- open_terminal_agent-0.1.0/src/open_terminal_agent.egg-info/PKG-INFO +321 -0
- open_terminal_agent-0.1.0/src/open_terminal_agent.egg-info/SOURCES.txt +89 -0
- open_terminal_agent-0.1.0/src/open_terminal_agent.egg-info/dependency_links.txt +1 -0
- open_terminal_agent-0.1.0/src/open_terminal_agent.egg-info/entry_points.txt +3 -0
- open_terminal_agent-0.1.0/src/open_terminal_agent.egg-info/requires.txt +20 -0
- open_terminal_agent-0.1.0/src/open_terminal_agent.egg-info/top_level.txt +1 -0
- open_terminal_agent-0.1.0/src/openterminal/__init__.py +3 -0
- open_terminal_agent-0.1.0/src/openterminal/agent.py +363 -0
- open_terminal_agent-0.1.0/src/openterminal/app.py +52 -0
- open_terminal_agent-0.1.0/src/openterminal/approval.py +40 -0
- open_terminal_agent-0.1.0/src/openterminal/backend.py +66 -0
- open_terminal_agent-0.1.0/src/openterminal/banner.py +40 -0
- open_terminal_agent-0.1.0/src/openterminal/cli.py +419 -0
- open_terminal_agent-0.1.0/src/openterminal/cmdset.py +49 -0
- open_terminal_agent-0.1.0/src/openterminal/config.py +157 -0
- open_terminal_agent-0.1.0/src/openterminal/connections.py +240 -0
- open_terminal_agent-0.1.0/src/openterminal/connections_db.py +240 -0
- open_terminal_agent-0.1.0/src/openterminal/core.py +1923 -0
- open_terminal_agent-0.1.0/src/openterminal/headless.py +289 -0
- open_terminal_agent-0.1.0/src/openterminal/history_db.py +79 -0
- open_terminal_agent-0.1.0/src/openterminal/local_pty.py +181 -0
- open_terminal_agent-0.1.0/src/openterminal/local_win.py +171 -0
- open_terminal_agent-0.1.0/src/openterminal/policy.py +241 -0
- open_terminal_agent-0.1.0/src/openterminal/render.py +41 -0
- open_terminal_agent-0.1.0/src/openterminal/secrets_store.py +46 -0
- open_terminal_agent-0.1.0/src/openterminal/shell_integration.py +1031 -0
- open_terminal_agent-0.1.0/src/openterminal/shell_session.py +320 -0
- open_terminal_agent-0.1.0/src/openterminal/skills/__init__.py +45 -0
- open_terminal_agent-0.1.0/src/openterminal/skills/markdown-tables/SKILL.md +247 -0
- open_terminal_agent-0.1.0/src/openterminal/ssh_pty.py +290 -0
- open_terminal_agent-0.1.0/src/openterminal/sysprobe.py +164 -0
- open_terminal_agent-0.1.0/src/openterminal/taskview.py +184 -0
- open_terminal_agent-0.1.0/src/openterminal/term_frontend.py +1372 -0
- open_terminal_agent-0.1.0/src/openterminal/token_est.py +49 -0
- open_terminal_agent-0.1.0/src/openterminal/transcript.py +26 -0
- open_terminal_agent-0.1.0/src/openterminal/web/__init__.py +1 -0
- open_terminal_agent-0.1.0/src/openterminal/web/frontend/index.html +30 -0
- open_terminal_agent-0.1.0/src/openterminal/web/frontend/static/app.js +2503 -0
- open_terminal_agent-0.1.0/src/openterminal/web/frontend/static/md_lite.js +117 -0
- open_terminal_agent-0.1.0/src/openterminal/web/frontend/static/pad_ledger.js +43 -0
- open_terminal_agent-0.1.0/src/openterminal/web/frontend/static/style.css +549 -0
- open_terminal_agent-0.1.0/src/openterminal/web/frontend/static/ui/ui.css +1 -0
- open_terminal_agent-0.1.0/src/openterminal/web/frontend/static/ui/ui.js +6122 -0
- open_terminal_agent-0.1.0/src/openterminal/web/frontend/vendor/addon-fit.js +2 -0
- open_terminal_agent-0.1.0/src/openterminal/web/frontend/vendor/xterm.css +8 -0
- open_terminal_agent-0.1.0/src/openterminal/web/frontend/vendor/xterm.js +8 -0
- open_terminal_agent-0.1.0/src/openterminal/web/protocol.py +41 -0
- open_terminal_agent-0.1.0/src/openterminal/web/server.py +308 -0
- open_terminal_agent-0.1.0/src/openterminal/web/worker.py +54 -0
- open_terminal_agent-0.1.0/tests/test_agent_flow.py +212 -0
- open_terminal_agent-0.1.0/tests/test_agent_prompt.py +20 -0
- open_terminal_agent-0.1.0/tests/test_approval.py +34 -0
- open_terminal_agent-0.1.0/tests/test_backend.py +58 -0
- open_terminal_agent-0.1.0/tests/test_cli_helpers.py +678 -0
- open_terminal_agent-0.1.0/tests/test_cmdset.py +58 -0
- open_terminal_agent-0.1.0/tests/test_config.py +94 -0
- open_terminal_agent-0.1.0/tests/test_connections.py +362 -0
- open_terminal_agent-0.1.0/tests/test_core.py +62 -0
- open_terminal_agent-0.1.0/tests/test_headless.py +202 -0
- open_terminal_agent-0.1.0/tests/test_history_db.py +45 -0
- open_terminal_agent-0.1.0/tests/test_hook_classify_live.py +227 -0
- open_terminal_agent-0.1.0/tests/test_hook_halfline.py +163 -0
- open_terminal_agent-0.1.0/tests/test_local_pty.py +76 -0
- open_terminal_agent-0.1.0/tests/test_local_win.py +135 -0
- open_terminal_agent-0.1.0/tests/test_model_provider.py +30 -0
- open_terminal_agent-0.1.0/tests/test_policy.py +144 -0
- open_terminal_agent-0.1.0/tests/test_secrets_store.py +48 -0
- open_terminal_agent-0.1.0/tests/test_shell_integration.py +409 -0
- open_terminal_agent-0.1.0/tests/test_shell_protocol.py +143 -0
- open_terminal_agent-0.1.0/tests/test_skills.py +125 -0
- open_terminal_agent-0.1.0/tests/test_ssh_known_hosts.py +83 -0
- open_terminal_agent-0.1.0/tests/test_ssh_live.py +53 -0
- open_terminal_agent-0.1.0/tests/test_ssh_session.py +35 -0
- open_terminal_agent-0.1.0/tests/test_sysprobe.py +110 -0
- open_terminal_agent-0.1.0/tests/test_taskview.py +209 -0
- open_terminal_agent-0.1.0/tests/test_term_capture.py +715 -0
- open_terminal_agent-0.1.0/tests/test_term_frontend.py +399 -0
- open_terminal_agent-0.1.0/tests/test_term_render.py +503 -0
- open_terminal_agent-0.1.0/tests/test_token_est.py +29 -0
- open_terminal_agent-0.1.0/tests/test_transcript.py +15 -0
- open_terminal_agent-0.1.0/tests/test_web_protocol.py +89 -0
- open_terminal_agent-0.1.0/tests/test_web_server.py +196 -0
- open_terminal_agent-0.1.0/tests/test_web_worker.py +1862 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 jeean404
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# sdist 清单:显式声明非代码资源的去留,防 setuptools 行为漂移。
|
|
2
|
+
# wheel 侧由 pyproject 的 [tool.setuptools.package-data] 覆盖;此处保 sdist
|
|
3
|
+
# 与 wheel 同源,并把 React 源码工程(frontend/ui/,含 node_modules)挡在包外
|
|
4
|
+
# —— 其构建产物已提交在 frontend/static/ui/,运行时只 serve 产物。
|
|
5
|
+
|
|
6
|
+
include README.md
|
|
7
|
+
include LICENSE
|
|
8
|
+
include pyproject.toml
|
|
9
|
+
include ot.spec
|
|
10
|
+
recursive-include packaging *.py
|
|
11
|
+
|
|
12
|
+
# Web 前端运行时资源(index.html + static/(含 static/ui/ 产物)+ vendor/)
|
|
13
|
+
include src/openterminal/web/frontend/index.html
|
|
14
|
+
recursive-include src/openterminal/web/frontend/static *.css *.js
|
|
15
|
+
recursive-include src/openterminal/web/frontend/vendor *.css *.js
|
|
16
|
+
|
|
17
|
+
# 内置 Agent Skills
|
|
18
|
+
recursive-include src/openterminal/skills *.md
|
|
19
|
+
|
|
20
|
+
# 明确排除前端源码工程与构建缓存
|
|
21
|
+
prune src/openterminal/web/frontend/ui
|
|
22
|
+
global-exclude *.py[cod]
|
|
23
|
+
global-exclude .DS_Store
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: open-terminal-agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Natural-language terminal agent over local or SSH shells
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Environment :: Console
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Intended Audience :: System Administrators
|
|
10
|
+
Classifier: Operating System :: MacOS
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: System :: Shells
|
|
17
|
+
Classifier: Topic :: System :: Systems Administration
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: deepagents>=0.7.15
|
|
22
|
+
Requires-Dist: langchain-anthropic>=1.7.2
|
|
23
|
+
Requires-Dist: langchain-openai>=1.0
|
|
24
|
+
Requires-Dist: asyncssh>=2.24.0
|
|
25
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
26
|
+
Requires-Dist: prompt_toolkit>=3.0.0
|
|
27
|
+
Requires-Dist: rich>=13.0.0
|
|
28
|
+
Requires-Dist: socksio>=1.0.0
|
|
29
|
+
Requires-Dist: pywinpty>=2.2; sys_platform == "win32"
|
|
30
|
+
Requires-Dist: keyring>=25.0.0
|
|
31
|
+
Requires-Dist: fastapi>=0.110
|
|
32
|
+
Requires-Dist: uvicorn>=0.27
|
|
33
|
+
Requires-Dist: tiktoken>=0.7
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
|
|
37
|
+
Requires-Dist: httpx>=0.27; extra == "dev"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# OpenTerminal
|
|
41
|
+
|
|
42
|
+
[](https://github.com/jeean404/OpenTerminal/actions/workflows/ci.yml)
|
|
43
|
+
[](LICENSE)
|
|
44
|
+
[中文文档](README.zh-CN.md)
|
|
45
|
+
|
|
46
|
+
**Tell your terminal what you want in plain language — it does the work.**
|
|
47
|
+
|
|
48
|
+
OpenTerminal lives in your terminal (and your browser). Type a normal sentence
|
|
49
|
+
like *"check which files are eating the most space"* and it figures out the
|
|
50
|
+
right commands, runs them, and sums up the results. Plain commands still work
|
|
51
|
+
exactly as you'd expect. It can hop to your remote servers over SSH too, so
|
|
52
|
+
you can leave Xshell behind.
|
|
53
|
+
|
|
54
|
+
<div align="center">
|
|
55
|
+
<img src="docs/images/demo-web.gif" width="860" alt="OpenTerminal demo: natural language task → analysis → approval → execution → summary">
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
Here's what happens in the demo above:
|
|
59
|
+
|
|
60
|
+
1. You type **"在 /tmp 下新建一个名叫 ot-demo 的文件夹"** (plain language);
|
|
61
|
+
2. The AI first shows its **analysis** — what it's about to do and why;
|
|
62
|
+
3. Creating a folder changes the system, so an **approval panel** pops up — nothing runs without your OK;
|
|
63
|
+
4. You hit **执行 (Execute)** — the command runs with its output shown verbatim;
|
|
64
|
+
5. A **summary** card wraps up what was done.
|
|
65
|
+
|
|
66
|
+
> ⚠️ **Beta**: OpenTerminal runs real commands on real machines — including
|
|
67
|
+
> production servers. Every state-changing command needs your approval (see
|
|
68
|
+
> [Security model](#security-model)), but please still read what you're approving.
|
|
69
|
+
|
|
70
|
+
## Why you might like it
|
|
71
|
+
|
|
72
|
+
- **Say it, don't grep it.** Natural language in, correct commands out — with
|
|
73
|
+
the analysis shown before anything runs.
|
|
74
|
+
- **It knows your systems.** Ubuntu→apt, CentOS 7→yum, Rocky/Fedora→dnf,
|
|
75
|
+
Alpine→apk, macOS→brew. Same request, right dialect for each machine.
|
|
76
|
+
- **It doesn't get sloppy.** Read-only commands run by themselves; anything
|
|
77
|
+
destructive waits for your approval; catastrophic commands (`rm -rf /`,
|
|
78
|
+
fork bombs, …) are refused outright. Failed attempts get a bounded
|
|
79
|
+
self-correction budget (10 turns), not infinite retry loops.
|
|
80
|
+
- **Your shell stays yours.** Persistent session (`cd`, exports, venv all
|
|
81
|
+
survive), and full-screen programs like vim/top/tmux take over the
|
|
82
|
+
terminal natively — the pipeline is a true PTY passthrough, so
|
|
83
|
+
they just work inline.
|
|
84
|
+
- **Two ways in.** A single-pipeline terminal (`ot`), or `ot web` — a
|
|
85
|
+
browser UI with a server sidebar and multi-tab terminals, sharing the
|
|
86
|
+
same core.
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
Pick whichever suits you — a pre-built binary (no Python needed), a package
|
|
91
|
+
manager, or from source.
|
|
92
|
+
|
|
93
|
+
### Pre-built binaries (macOS & Windows)
|
|
94
|
+
|
|
95
|
+
Download from [Releases](https://github.com/jeean404/OpenTerminal/releases),
|
|
96
|
+
unpack, and put the `ot` executable on your `PATH`. Replace `vX.Y.Z` with the
|
|
97
|
+
latest tag:
|
|
98
|
+
|
|
99
|
+
| Platform | Asset |
|
|
100
|
+
|---|---|
|
|
101
|
+
| macOS (Apple Silicon) | `ot-vX.Y.Z-macos-arm64.tar.gz` |
|
|
102
|
+
| macOS (Intel) | `ot-vX.Y.Z-macos-x86_64.tar.gz` |
|
|
103
|
+
| Windows (x64) | `ot-vX.Y.Z-windows-x64.zip` |
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
# macOS
|
|
107
|
+
tar -xzf ot-vX.Y.Z-macos-arm64.tar.gz
|
|
108
|
+
sudo mv ot/ot /usr/local/bin/ot # or any directory on your PATH
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
On Windows, unzip and add the `ot` folder to your `PATH`, then run `ot.exe`.
|
|
112
|
+
|
|
113
|
+
> **Intel Macs**: GitHub retired its Intel macOS runners, so the x86_64 binary
|
|
114
|
+
> is built and attached manually per release. If a release is missing it,
|
|
115
|
+
> install from PyPI with `pipx install open-terminal-agent` (see below), which works
|
|
116
|
+
> on both architectures.
|
|
117
|
+
|
|
118
|
+
> **macOS Gatekeeper** — the binaries are ad-hoc signed (not notarized), so
|
|
119
|
+
> the first launch may be blocked with *“ot cannot be opened.”* Clear the
|
|
120
|
+
> quarantine flag once with `xattr -cr "$(command -v ot)"`, or right-click →
|
|
121
|
+
> Open. The first run also triggers a one-time OS security scan; later runs
|
|
122
|
+
> start in under a second (the AI stack is loaded lazily on the first AI
|
|
123
|
+
> task, which takes a few extra seconds once).
|
|
124
|
+
|
|
125
|
+
> **Windows SmartScreen** — you may see *“Windows protected your PC”* (the
|
|
126
|
+
> binary is unsigned). Click **More info → Run anyway**.
|
|
127
|
+
|
|
128
|
+
### pipx / uv (from PyPI)
|
|
129
|
+
|
|
130
|
+
The Python package is `open-terminal-agent` (it installs the `ot` command):
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
pipx install open-terminal-agent
|
|
134
|
+
# or
|
|
135
|
+
uv tool install open-terminal-agent
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Requires Python 3.11+.
|
|
139
|
+
|
|
140
|
+
### From source (development)
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
conda create -n openterminal python=3.12 -y # or any virtualenv
|
|
144
|
+
conda activate openterminal
|
|
145
|
+
pip install -e .
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Then set up your model gateway (see below) and run it:
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
mkdir -p ~/.openterminal && cp .env.example ~/.openterminal/.env
|
|
152
|
+
# edit ~/.openterminal/.env — point it at a model gateway
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Quick start
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
ot # terminal — local shell + main menu (connect / manage hosts)
|
|
159
|
+
ot web # browser terminal — server sidebar + multi-tab UI (default http://127.0.0.1:8080)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
More ways to connect:
|
|
163
|
+
|
|
164
|
+
```sh
|
|
165
|
+
ot connect prod-web # a host from ~/.ssh/config
|
|
166
|
+
ot ssh deploy@host:2222 # or user@host:port directly
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Model gateway configuration
|
|
170
|
+
|
|
171
|
+
OpenTerminal talks to any Anthropic-compatible gateway. On startup it loads
|
|
172
|
+
`.env` from the current directory, then `~/.openterminal/.env`, then
|
|
173
|
+
`~/.openterminal/config.toml`. **None of these are required** — defaults:
|
|
174
|
+
|
|
175
|
+
- Protocol: `anthropic` (default) or `openai` (OpenAI-compatible protocol)
|
|
176
|
+
- Gateway: `http://127.0.0.1:15721` (Anthropic-compatible protocol; the `openai`
|
|
177
|
+
provider defaults to the official endpoint)
|
|
178
|
+
- Model: `claude-sonnet-4-6` (`gpt-5` under the `openai` provider)
|
|
179
|
+
- API key: from the `ANTHROPIC_API_KEY` environment variable
|
|
180
|
+
(`OPENAI_API_KEY` under the `openai` provider)
|
|
181
|
+
|
|
182
|
+
Optional `~/.openterminal/config.toml` (every field may be omitted):
|
|
183
|
+
|
|
184
|
+
```toml
|
|
185
|
+
[model]
|
|
186
|
+
provider = "anthropic" # anthropic | openai (OpenAI-compatible protocol)
|
|
187
|
+
base_url = "http://127.0.0.1:15721"
|
|
188
|
+
model = "claude-sonnet-4-6"
|
|
189
|
+
api_key_env = "ANTHROPIC_API_KEY"
|
|
190
|
+
|
|
191
|
+
# OpenAI-compatible protocol example (any OpenAI-compatible gateway works;
|
|
192
|
+
# the defaults of the four fields above switch to an openai set with the
|
|
193
|
+
# provider — explicit fields always win):
|
|
194
|
+
# provider = "openai"
|
|
195
|
+
# base_url = "https://api.openai.com/v1"
|
|
196
|
+
# model = "gpt-5"
|
|
197
|
+
# api_key_env = "OPENAI_API_KEY"
|
|
198
|
+
|
|
199
|
+
[shell]
|
|
200
|
+
timeout_default = 120 # per-command wait budget (seconds)
|
|
201
|
+
max_output_bytes = 102400 # per-command output truncation
|
|
202
|
+
max_tool_turns = 10 # agent tool-call turn budget
|
|
203
|
+
|
|
204
|
+
[policy]
|
|
205
|
+
mode = "tiered" # tiered | approve-all | deny-all
|
|
206
|
+
# auto_extra / approve_extra / deny_extra append exact-match custom rules
|
|
207
|
+
|
|
208
|
+
[target.prod-web]
|
|
209
|
+
mode = "ssh"
|
|
210
|
+
host = "prod-web.example.com"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Config directory can be moved with `OPENTERMINAL_HOME` (the test suite uses
|
|
214
|
+
this for isolation). Transcripts go to `~/.openterminal/sessions/`; host
|
|
215
|
+
profiles are cached in `~/.openterminal/hosts.toml`.
|
|
216
|
+
|
|
217
|
+
## Day-to-day use
|
|
218
|
+
|
|
219
|
+
**In the terminal** — just type. A normal sentence becomes a task; a plain
|
|
220
|
+
command runs in your real shell. `!` forces a command, `?` forces a task.
|
|
221
|
+
`/target` switch host, `/system` override the detected dialect, `/clear`
|
|
222
|
+
new task, `/model` show model, `/exit` quit. Ctrl+C interrupts a running
|
|
223
|
+
task and returns you to the prompt.
|
|
224
|
+
|
|
225
|
+
**In the browser** (`ot web`) — pick a server from the sidebar (local or
|
|
226
|
+
direct SSH), open as many tabs as you like, and work in the Agent view or
|
|
227
|
+
plain Shell view. Passwords and host keys are entered in browser dialogs;
|
|
228
|
+
remembered passwords go through the OS credential store, so reconnecting is
|
|
229
|
+
password-free.
|
|
230
|
+
|
|
231
|
+
**LAN access**: `ot web --host 0.0.0.0 --token <TOKEN>` — a token is
|
|
232
|
+
mandatory for non-loopback binds. Config: `[web] host/port/token` in
|
|
233
|
+
`config.toml`.
|
|
234
|
+
|
|
235
|
+
## Security model
|
|
236
|
+
|
|
237
|
+
The rule of thumb: **looking is free; changing things needs your OK; disasters
|
|
238
|
+
are refused.**
|
|
239
|
+
|
|
240
|
+
Three tiers (`src/openterminal/policy.py`):
|
|
241
|
+
|
|
242
|
+
- **auto** — read-only stuff runs on its own: `ls`/`cat`/`df`/`ps`,
|
|
243
|
+
`git status/log`, `find` without `-exec/-delete`, …
|
|
244
|
+
- **approve** — anything that modifies the system: deleting files, writing
|
|
245
|
+
files, installing packages, `systemctl`, `sudo`, network config, plus
|
|
246
|
+
anything the static rules can't confidently judge. A panel opens:
|
|
247
|
+
`y` execute / `e` edit / `n` reject / `a` allow for this session (in the
|
|
248
|
+
web UI it's a button, with a second confirm for high-risk commands).
|
|
249
|
+
- **deny** — the catastrophic stuff is refused and the reason is fed back to
|
|
250
|
+
the model so it changes course: `rm -rf /`, mkfs, `dd` to block devices,
|
|
251
|
+
fork bombs, shutdown, redirects to /dev devices, …
|
|
252
|
+
|
|
253
|
+
Rejected and failed commands aren't retried verbatim: the agent is prompted
|
|
254
|
+
to retry a failure at most once and never re-skin a rejected command, and
|
|
255
|
+
tool-call turns are budget-bounded.
|
|
256
|
+
|
|
257
|
+
## Architecture
|
|
258
|
+
|
|
259
|
+
<div align="center">
|
|
260
|
+
<img src="docs/images/architecture.svg" width="860" alt="OpenTerminal architecture">
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
Full docs: [Architecture](docs/architecture.md) · [Design notes](docs/design.md) ·
|
|
264
|
+
[Flow diagrams](docs/flows.md)
|
|
265
|
+
|
|
266
|
+
Three layers: the natural-language front end (terminal or web), a
|
|
267
|
+
deepagents (LangGraph) agent, and persistent shell sessions. Natural
|
|
268
|
+
language goes straight to the agent for multi-turn tool use; command
|
|
269
|
+
execution is a sub-capability of the agent, over the same session. The
|
|
270
|
+
tiered policy is enforced as agent middleware, so the approval gate can't
|
|
271
|
+
be bypassed by prompt content.
|
|
272
|
+
|
|
273
|
+
Display is a **single pipeline**: PTY bytes go straight to the terminal,
|
|
274
|
+
shell-integration hooks keep the books via in-band OSC markers (history /
|
|
275
|
+
exit codes / AI context), and agent tool commands are injected into the
|
|
276
|
+
same PTY via `__ot_exec__`, so their output lands in place. A per-session
|
|
277
|
+
lock keeps commands strictly serial — one PTY is one interactive shell, so
|
|
278
|
+
concurrent agent `execute` calls queue up. BEGIN/END sentinel slicing
|
|
279
|
+
(`shell_session.py`) remains only for non-display paths such as headless
|
|
280
|
+
`ot exec` and capability probes.
|
|
281
|
+
|
|
282
|
+
There is **no model-level long-term memory** — the agent's checkpointer is
|
|
283
|
+
in-memory and cleared on restart. What persists is factual state:
|
|
284
|
+
|
|
285
|
+
| Store | Location | Contents |
|
|
286
|
+
|---|---|---|
|
|
287
|
+
| Config | `~/.openterminal/config.toml` | gateway / shell budgets / policy / targets |
|
|
288
|
+
| Connections | `~/.openterminal/connections.db` | remembered connections |
|
|
289
|
+
| Command history | `~/.openterminal/history.db` | per-target history, replayed into the shell on reconnect |
|
|
290
|
+
| Passwords | OS credential store (keyring) | never written to plaintext files |
|
|
291
|
+
| Host profiles | `~/.openterminal/hosts.toml` | per-host system profile cache |
|
|
292
|
+
| Transcripts | `~/.openterminal/sessions/<date>/` | JSONL of inputs/commands/approvals/summaries |
|
|
293
|
+
| Host keys | `~/.ssh/known_hosts` | written after TOFU confirmation |
|
|
294
|
+
|
|
295
|
+
## Testing
|
|
296
|
+
|
|
297
|
+
```sh
|
|
298
|
+
pytest -q # Python suite (platform-gated tests auto-skip)
|
|
299
|
+
node --test tests/js/*.test.cjs # static frontend
|
|
300
|
+
cd src/openterminal/web/frontend/ui && npm ci && npm test # React island
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Real-sshd tests are opt-in:
|
|
304
|
+
|
|
305
|
+
```sh
|
|
306
|
+
OT_TEST_SSH=1 OT_TEST_SSH_HOST=127.0.0.1 OT_TEST_SSH_PORT=2222 pytest -m ssh
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Contributing
|
|
310
|
+
|
|
311
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Issues and pull requests are welcome.
|
|
312
|
+
|
|
313
|
+
## Acknowledgments
|
|
314
|
+
|
|
315
|
+
- [deepagents](https://github.com/langchain-ai/deepagents) & LangGraph — agent runtime
|
|
316
|
+
- [xterm.js](https://xtermjs.org/) — browser terminal (vendored in `web/frontend/vendor/`)
|
|
317
|
+
- [asyncssh](https://github.com/ronf/asyncssh) — SSH client
|
|
318
|
+
|
|
319
|
+
## License
|
|
320
|
+
|
|
321
|
+
[Apache License 2.0](LICENSE)
|