caisson-tools 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.
- caisson_tools-0.1.0/.gitignore +21 -0
- caisson_tools-0.1.0/LICENSE +202 -0
- caisson_tools-0.1.0/NOTICE +6 -0
- caisson_tools-0.1.0/PKG-INFO +69 -0
- caisson_tools-0.1.0/README.md +55 -0
- caisson_tools-0.1.0/hatch_build.py +41 -0
- caisson_tools-0.1.0/pyproject.toml +33 -0
- caisson_tools-0.1.0/src/caisson_tools/__init__.py +1 -0
- caisson_tools-0.1.0/src/caisson_tools/_revision.txt +1 -0
- caisson_tools-0.1.0/src/caisson_tools/agentctl-commands.json +1 -0
- caisson_tools-0.1.0/src/caisson_tools/allowlist_syntax.py +44 -0
- caisson_tools-0.1.0/src/caisson_tools/browser.py +36 -0
- caisson_tools-0.1.0/src/caisson_tools/common.py +174 -0
- caisson_tools-0.1.0/src/caisson_tools/context.py +36 -0
- caisson_tools-0.1.0/src/caisson_tools/environment.py +92 -0
- caisson_tools-0.1.0/src/caisson_tools/management.py +113 -0
- caisson_tools-0.1.0/src/caisson_tools/manifest.py +41 -0
- caisson_tools-0.1.0/src/caisson_tools/ops.py +839 -0
- caisson_tools-0.1.0/src/caisson_tools/podman.py +325 -0
- caisson_tools-0.1.0/src/caisson_tools/remote.py +158 -0
- caisson_tools-0.1.0/src/caisson_tools/secrets.py +100 -0
- caisson_tools-0.1.0/src/caisson_tools/serve.py +160 -0
- caisson_tools-0.1.0/src/caisson_tools/terminal.py +194 -0
- caisson_tools-0.1.0/src/caisson_tools/transport.py +370 -0
- caisson_tools-0.1.0/src/caisson_tools/user.py +789 -0
- caisson_tools-0.1.0/src/caisson_tools/version.py +37 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/bin/
|
|
2
|
+
/mgmt/bin/
|
|
3
|
+
*.tfstate*
|
|
4
|
+
.terraform/
|
|
5
|
+
*.tfvars
|
|
6
|
+
*.tfvars.json
|
|
7
|
+
!*.tfvars.example
|
|
8
|
+
tfplan
|
|
9
|
+
*.tfplan
|
|
10
|
+
.DS_Store
|
|
11
|
+
.env
|
|
12
|
+
/deploy/
|
|
13
|
+
__pycache__/
|
|
14
|
+
*.pyc
|
|
15
|
+
/.workstation-image.tar
|
|
16
|
+
/.venv/
|
|
17
|
+
/caisson-tools/.venv/
|
|
18
|
+
/caisson-tools/dist/
|
|
19
|
+
/caisson-tools/caisson-ops/dist/
|
|
20
|
+
/.pytest_cache/
|
|
21
|
+
/caisson-tools/.pytest_cache/
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition,
|
|
54
|
+
"submitted" means any form of electronic, verbal, or written
|
|
55
|
+
communication sent to the Licensor or its representatives, including
|
|
56
|
+
but not limited to communication on electronic mailing lists,
|
|
57
|
+
source code control systems, and issue tracking systems that are
|
|
58
|
+
managed by, or on behalf of, the Licensor for the purpose of discussing
|
|
59
|
+
and improving the Work, but excluding communication that is conspicuously
|
|
60
|
+
marked or otherwise designated in writing by the copyright owner as
|
|
61
|
+
"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 do
|
|
118
|
+
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
|
|
158
|
+
be liable to You for damages, including any direct, indirect,
|
|
159
|
+
special, incidental, or consequential damages of any character
|
|
160
|
+
arising as a result of this License or out of the use or inability
|
|
161
|
+
to use the Work (including but not limited to damages for loss of
|
|
162
|
+
goodwill, work stoppage, computer failure or malfunction, or any
|
|
163
|
+
and all 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 [yyyy] [name of copyright owner]
|
|
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
|
+
https://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,69 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: caisson-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Laptop-side workspace and agent CLI for Caisson
|
|
5
|
+
Author: Tetrel Security
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
License-File: NOTICE
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Requires-Dist: click<9,>=8.1
|
|
11
|
+
Requires-Dist: prompt-toolkit<4,>=3.0.48
|
|
12
|
+
Requires-Dist: rich<16,>=13.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# Caisson CLI
|
|
16
|
+
|
|
17
|
+
Create and use personal cloud workspaces from your laptop. Files persist when
|
|
18
|
+
you stop a workspace; coding agents run in an isolated sandbox.
|
|
19
|
+
|
|
20
|
+
For a prepared Podman worker, install `caisson-tools` on both client and worker.
|
|
21
|
+
The package includes the `caisson-podman` worker helper.
|
|
22
|
+
For the default managed GCP deployment, you need access from your administrator, Tailscale, OpenSSH, and
|
|
23
|
+
[uv](https://docs.astral.sh/uv/getting-started/installation/).
|
|
24
|
+
Management uses HTTPS on the tailnet. If the `tailscale` CLI isn't on your
|
|
25
|
+
PATH, or your server isn't named `caisson`, set the full DNS name with
|
|
26
|
+
`caisson config set target https://caisson.YOUR-TAILNET.ts.net`. The default
|
|
27
|
+
target is `https://caisson`. For Podman, save `local` or `ssh://[user@]host`
|
|
28
|
+
instead. `caisson config show` prints the saved target; `--target` overrides
|
|
29
|
+
it without changing it. Management traffic always uses HTTPS, even when the
|
|
30
|
+
target is written as `http://server`.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
uv tool install caisson-tools
|
|
34
|
+
caisson ls
|
|
35
|
+
caisson new dev # create and start billable compute
|
|
36
|
+
caisson enroll dev # approve Tailscale on first use
|
|
37
|
+
caisson agent dev # open your coding agent
|
|
38
|
+
caisson stop dev # stop compute; keep files
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`caisson` runs an interactive prompt with tab completion; `use dev` selects a
|
|
42
|
+
workspace there. The first start can take a few minutes. Configure your own
|
|
43
|
+
inference credentials in the agent; outbound access starts blocked. Run
|
|
44
|
+
`caisson -w dev allowlist lists` to see what you can enable. Verify any
|
|
45
|
+
first-use host-key fingerprint with your administrator.
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
caisson shell dev # agent sandbox shell
|
|
49
|
+
caisson -w dev copy-to ./notes.txt # laptop → agent
|
|
50
|
+
caisson -w dev copy-from results.json # agent → laptop
|
|
51
|
+
caisson -w dev package install ripgrep # install in the agent
|
|
52
|
+
caisson web dev # browser UI
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If asked to pair the browser, run `caisson -w dev pair`.
|
|
56
|
+
Use `caisson -w dev package remove ripgrep` to uninstall it; `package gc`
|
|
57
|
+
frees unused space but discards older profile generations.
|
|
58
|
+
Files on your laptop aren't mounted in the agent; upload them as needed.
|
|
59
|
+
`caisson destroy dev` permanently deletes the workspace and all its files.
|
|
60
|
+
Run `caisson --help` for more commands; `caisson version` shows the package
|
|
61
|
+
version and Git build revision.
|
|
62
|
+
|
|
63
|
+
## Operators
|
|
64
|
+
|
|
65
|
+
For deployment and access management, see the
|
|
66
|
+
[caisson-ops package](https://pypi.org/project/caisson-ops/).
|
|
67
|
+
|
|
68
|
+
Copyright 2026 Tetrel Security. Apache-2.0 applies to `caisson-tools/`
|
|
69
|
+
(including `caisson-ops/`) only, not the rest of the repository.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Caisson CLI
|
|
2
|
+
|
|
3
|
+
Create and use personal cloud workspaces from your laptop. Files persist when
|
|
4
|
+
you stop a workspace; coding agents run in an isolated sandbox.
|
|
5
|
+
|
|
6
|
+
For a prepared Podman worker, install `caisson-tools` on both client and worker.
|
|
7
|
+
The package includes the `caisson-podman` worker helper.
|
|
8
|
+
For the default managed GCP deployment, you need access from your administrator, Tailscale, OpenSSH, and
|
|
9
|
+
[uv](https://docs.astral.sh/uv/getting-started/installation/).
|
|
10
|
+
Management uses HTTPS on the tailnet. If the `tailscale` CLI isn't on your
|
|
11
|
+
PATH, or your server isn't named `caisson`, set the full DNS name with
|
|
12
|
+
`caisson config set target https://caisson.YOUR-TAILNET.ts.net`. The default
|
|
13
|
+
target is `https://caisson`. For Podman, save `local` or `ssh://[user@]host`
|
|
14
|
+
instead. `caisson config show` prints the saved target; `--target` overrides
|
|
15
|
+
it without changing it. Management traffic always uses HTTPS, even when the
|
|
16
|
+
target is written as `http://server`.
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
uv tool install caisson-tools
|
|
20
|
+
caisson ls
|
|
21
|
+
caisson new dev # create and start billable compute
|
|
22
|
+
caisson enroll dev # approve Tailscale on first use
|
|
23
|
+
caisson agent dev # open your coding agent
|
|
24
|
+
caisson stop dev # stop compute; keep files
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`caisson` runs an interactive prompt with tab completion; `use dev` selects a
|
|
28
|
+
workspace there. The first start can take a few minutes. Configure your own
|
|
29
|
+
inference credentials in the agent; outbound access starts blocked. Run
|
|
30
|
+
`caisson -w dev allowlist lists` to see what you can enable. Verify any
|
|
31
|
+
first-use host-key fingerprint with your administrator.
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
caisson shell dev # agent sandbox shell
|
|
35
|
+
caisson -w dev copy-to ./notes.txt # laptop → agent
|
|
36
|
+
caisson -w dev copy-from results.json # agent → laptop
|
|
37
|
+
caisson -w dev package install ripgrep # install in the agent
|
|
38
|
+
caisson web dev # browser UI
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If asked to pair the browser, run `caisson -w dev pair`.
|
|
42
|
+
Use `caisson -w dev package remove ripgrep` to uninstall it; `package gc`
|
|
43
|
+
frees unused space but discards older profile generations.
|
|
44
|
+
Files on your laptop aren't mounted in the agent; upload them as needed.
|
|
45
|
+
`caisson destroy dev` permanently deletes the workspace and all its files.
|
|
46
|
+
Run `caisson --help` for more commands; `caisson version` shows the package
|
|
47
|
+
version and Git build revision.
|
|
48
|
+
|
|
49
|
+
## Operators
|
|
50
|
+
|
|
51
|
+
For deployment and access management, see the
|
|
52
|
+
[caisson-ops package](https://pypi.org/project/caisson-ops/).
|
|
53
|
+
|
|
54
|
+
Copyright 2026 Tetrel Security. Apache-2.0 applies to `caisson-tools/`
|
|
55
|
+
(including `caisson-ops/`) only, not the rest of the repository.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Bake source provenance into wheels and preserve it through source distributions."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import subprocess
|
|
5
|
+
import tempfile
|
|
6
|
+
|
|
7
|
+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def source_revision(root):
|
|
11
|
+
stamp = root / "src/caisson_tools/_revision.txt"
|
|
12
|
+
if stamp.is_file():
|
|
13
|
+
# An sdist carries the original build's identity, even without .git.
|
|
14
|
+
return stamp.read_text().strip()
|
|
15
|
+
try:
|
|
16
|
+
def git(*args):
|
|
17
|
+
return subprocess.check_output(
|
|
18
|
+
["git", "-C", str(root), *args], text=True, stderr=subprocess.DEVNULL,
|
|
19
|
+
).strip()
|
|
20
|
+
|
|
21
|
+
# Do not borrow an unrelated enclosing checkout's identity.
|
|
22
|
+
git("ls-files", "--error-unmatch", "--", "pyproject.toml")
|
|
23
|
+
revision = git("rev-parse", "HEAD")
|
|
24
|
+
# uv places an untracked .ok marker at the checkout root before the
|
|
25
|
+
# build hook runs. It is cache bookkeeping, not a source edit.
|
|
26
|
+
dirty = git("status", "--porcelain", "--", ":(top,glob)**", ":(exclude,top).ok")
|
|
27
|
+
return revision + ("-dirty" if dirty else "")
|
|
28
|
+
except (OSError, subprocess.CalledProcessError):
|
|
29
|
+
return "unknown"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class CustomBuildHook(BuildHookInterface):
|
|
33
|
+
def initialize(self, version, build_data):
|
|
34
|
+
self.temporary = tempfile.TemporaryDirectory(prefix="caisson-build-")
|
|
35
|
+
stamp = Path(self.temporary.name) / "_revision.txt"
|
|
36
|
+
stamp.write_text(source_revision(Path(self.root)) + "\n")
|
|
37
|
+
target = "src/caisson_tools" if self.target_name == "sdist" else "caisson_tools"
|
|
38
|
+
build_data["force_include"][str(stamp)] = f"{target}/_revision.txt"
|
|
39
|
+
|
|
40
|
+
def finalize(self, version, build_data, artifact_path):
|
|
41
|
+
self.temporary.cleanup()
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.26"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "caisson-tools"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Laptop-side workspace and agent CLI for Caisson"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
13
|
+
authors = [{ name = "Tetrel Security" }]
|
|
14
|
+
dependencies = ["click>=8.1,<9", "prompt-toolkit>=3.0.48,<4", "rich>=13.9,<16"]
|
|
15
|
+
|
|
16
|
+
[project.scripts]
|
|
17
|
+
caisson = "caisson_tools.user:main"
|
|
18
|
+
caisson-podman = "caisson_tools.podman:main"
|
|
19
|
+
|
|
20
|
+
[tool.hatch.build.targets.wheel]
|
|
21
|
+
packages = ["src/caisson_tools"]
|
|
22
|
+
|
|
23
|
+
[tool.hatch.build.hooks.custom]
|
|
24
|
+
path = "hatch_build.py"
|
|
25
|
+
|
|
26
|
+
[tool.hatch.build.targets.sdist]
|
|
27
|
+
include = ["/src", "/hatch_build.py", "/README.md", "/LICENSE", "/NOTICE", "/pyproject.toml"]
|
|
28
|
+
|
|
29
|
+
[dependency-groups]
|
|
30
|
+
dev = ["pytest>=8,<10", "build>=1.2", "hatchling>=1.26"]
|
|
31
|
+
|
|
32
|
+
[tool.ruff]
|
|
33
|
+
line-length = 100
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Caisson's laptop-side tools. No cloud SDK is imported by the user CLI."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
91db73d61592abc5771aeeb6236556862164373b
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"commands":[["version","show the Git revision of the workstation runtime"],["up","recreate VM/proxy; preserve private guest disk"],["switch-agent opencode|claude","switch agent; build Claude on demand, preserve disk"],["down","stop VM/proxy; preserve private guest disk"],["disk-grow GIB","grow stopped guest disk to total size in GiB"],["status","show VM and proxy state (JSON)"],["shell","interactive shell in /home/agent"],["agent [--directory PATH]","open the selected OpenCode or Claude terminal UI"],["exec [--root] -- COMMAND [ARG...]","run a guest command"],["pair","Show pairing link and QR code."],["logs [--follow|--no-follow]","recent VM console (optionally follow)"],["proxy-logs [--follow|--no-follow]","recent proxy traffic (optionally follow)"],["allowlist","manage outbound allowlists"],["creds","Manage proxy credentials."],["tool","manage optional agent tools"],["package","manage agent Nix packages from the workstation"],["copy-to LOCAL AGENT_PATH","copy local files into the agent"],["copy-from AGENT_PATH LOCAL","copy agent files to the local machine"]],"allowlist":[["show [LIST]","show domains and method grants"],["add URL|DOMAIN [...] [--methods METHODS]","grant GET/HEAD by default; METHODS is GET,POST or all"],["rm DOMAIN [...]","remove standalone domains"],["lists","show fleet and tool-owned lists and enabled state"],["enable LIST [...]","enable fleet or tool-owned lists"],["disable LIST [...]","disable fleet or tool-owned lists"],["reset","clear all grants, including fleet defaults"]],"groups":{"creds":{"help":"Manage proxy credentials.","epilog":"","arguments":[],"options":[],"commands":{"list":{"help":"show configured credential presets","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]},"configure":{"help":"securely enter a key for a credential preset","epilog":"","arguments":[{"name":"preset","help":"credential preset name","nargs":null,"required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"add":{"help":"add a custom credential rule","epilog":"","arguments":[],"options":[{"name":"url","help":"HTTPS URL; rule covers its entire hostname","nargs":null,"required":true,"default":null,"choices":null,"flags":["--url"],"flag":false,"multiple":false},{"name":"header","help":"","nargs":null,"required":false,"default":"Authorization","choices":null,"flags":["--header"],"flag":false,"multiple":false},{"name":"placeholder","help":"exact complete guest header value","nargs":null,"required":false,"default":null,"choices":null,"flags":["--placeholder"],"flag":false,"multiple":false},{"name":"inject","help":"inject if absent; Authorization uses Bearer KEY","nargs":0,"required":false,"default":false,"choices":null,"flags":["--inject"],"flag":true,"multiple":false},{"name":"remove_header","help":"header to remove when injecting (repeatable)","nargs":null,"required":false,"default":[],"choices":null,"flags":["--remove-header"],"flag":false,"multiple":true},{"name":"value","help":"header value; raw key for Bearer injection","nargs":null,"required":false,"default":null,"choices":null,"flags":["--value"],"flag":false,"multiple":false},{"name":"env","help":"reference an environment variable in host agentd","nargs":null,"required":false,"default":null,"choices":null,"flags":["--env"],"flag":false,"multiple":false},{"name":"prompt","help":"securely prompt for a literal value","nargs":0,"required":false,"default":false,"choices":null,"flags":["--prompt"],"flag":true,"multiple":false}],"commands":{},"exclusive":[{"required":true,"names":["placeholder","inject"]},{"required":true,"names":["value","env","prompt"]}]},"rm":{"help":"remove a preset or custom credential rule","epilog":"","arguments":[{"name":"preset","help":"","nargs":"?","required":false,"default":null,"choices":null}],"options":[{"name":"url","help":"HTTPS URL; rule covers its entire hostname","nargs":null,"required":false,"default":null,"choices":null,"flags":["--url"],"flag":false,"multiple":false},{"name":"header","help":"","nargs":null,"required":false,"default":"Authorization","choices":null,"flags":["--header"],"flag":false,"multiple":false},{"name":"placeholder","help":"exact complete guest header value","nargs":null,"required":false,"default":null,"choices":null,"flags":["--placeholder"],"flag":false,"multiple":false},{"name":"inject","help":"inject if absent; Authorization uses Bearer KEY","nargs":0,"required":false,"default":false,"choices":null,"flags":["--inject"],"flag":true,"multiple":false}],"commands":{},"exclusive":[{"required":false,"names":["placeholder","inject"]}]}},"exclusive":[]},"allowlist":{"help":"manage outbound allowlists","epilog":"","arguments":[],"options":[],"commands":{"show":{"help":"show domains and method grants","epilog":"","arguments":[{"name":"list","help":"fleet or tool-owned list (omit for current policy)","nargs":"?","required":false,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"add":{"help":"grant GET/HEAD by default; METHODS is GET,POST or all","epilog":"","arguments":[{"name":"targets","help":"domain or HTTPS URL (whole hostname)","nargs":"+","required":true,"default":null,"choices":null}],"options":[{"name":"methods","help":"comma-separated methods, or all","nargs":null,"required":false,"default":"GET,HEAD","choices":null,"flags":["--methods"],"flag":false,"multiple":false}],"commands":{},"exclusive":[]},"rm":{"help":"remove standalone domains","epilog":"","arguments":[{"name":"targets","help":"domain or HTTPS URL (whole hostname)","nargs":"+","required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"lists":{"help":"show fleet and tool-owned lists and enabled state","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]},"enable":{"help":"enable fleet or tool-owned lists","epilog":"","arguments":[{"name":"lists","help":"fleet or tool-owned list names","nargs":"+","required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"disable":{"help":"disable fleet or tool-owned lists","epilog":"","arguments":[{"name":"lists","help":"fleet or tool-owned list names","nargs":"+","required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"reset":{"help":"clear all grants, including fleet defaults","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]}},"exclusive":[]},"tool":{"help":"manage optional agent tools","epilog":"","arguments":[],"options":[],"commands":{"list":{"help":"show available tools and enabled state","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]},"install":{"help":"build on host and add to guest profile (no activation)","epilog":"","arguments":[{"name":"name","help":"tool name","nargs":null,"required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"enable":{"help":"install, allow runtime endpoints, and connect MCP","epilog":"","arguments":[{"name":"name","help":"tool name","nargs":null,"required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"disable":{"help":"revoke runtime allowlist and disable MCP; keep package","epilog":"","arguments":[{"name":"name","help":"tool name","nargs":null,"required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]}},"exclusive":[]},"package":{"help":"manage agent Nix packages from the workstation","epilog":"","arguments":[],"options":[],"commands":{"install":{"help":"build packages on host and add to guest profile offline","epilog":"","arguments":[{"name":"names","help":"attribute names from the host image's pinned nixpkgs","nargs":"+","required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"remove":{"help":"remove named guest profile entries (does not reclaim space)","epilog":"","arguments":[{"name":"names","help":"installed profile names (see: agentctl exec -- nix profile list)","nargs":"+","required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"gc":{"help":"wipe guest profile rollback history and collect unreachable guest store paths","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]}},"exclusive":[]}},"runtime":{"version":{"help":"show the Git revision of the workstation runtime","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]},"up":{"help":"recreate VM/proxy; preserve private guest disk","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]},"switch-agent":{"help":"switch agent; build Claude on demand, preserve disk","epilog":"","arguments":[{"name":"agent","help":"agent runtime to switch to; private disk is preserved","nargs":null,"required":true,"default":null,"choices":["opencode","claude"]}],"options":[],"commands":{},"exclusive":[]},"down":{"help":"stop VM/proxy; preserve private guest disk","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]},"disk-grow":{"help":"grow stopped guest disk to total size in GiB","epilog":"","arguments":[{"name":"gib","help":"total guest disk size in GiB (1\u20131000); guest must be stopped","nargs":null,"required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"status":{"help":"show VM and proxy state (JSON)","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]},"shell":{"help":"interactive shell in /home/agent","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]},"agent":{"help":"open the selected OpenCode or Claude terminal UI","epilog":"","arguments":[],"options":[{"name":"directory","help":"guest working directory (relative paths start in /home/agent)","nargs":null,"required":false,"default":"/home/agent","choices":null,"flags":["--directory"],"flag":false,"multiple":false}],"commands":{},"exclusive":[]},"exec":{"help":"run a guest command","epilog":"","arguments":[{"name":"command","help":"guest command and arguments; put -- before the command","nargs":"...","required":false,"default":null,"choices":null}],"options":[{"name":"root","help":"run as guest root, never host root","nargs":0,"required":false,"default":false,"choices":null,"flags":["--root"],"flag":true,"multiple":false}],"commands":{},"exclusive":[],"passthrough":true},"pair":{"help":"Show pairing link and QR code.","epilog":"","arguments":[],"options":[],"commands":{},"exclusive":[]},"logs":{"help":"recent VM console (optionally follow)","epilog":"Default: print recent log entries and exit. Use -f/--follow to stream.","arguments":[],"options":[{"name":"follow","help":"keep streaming new log entries","nargs":0,"required":false,"default":false,"choices":null,"flags":["-f","--follow"],"flag":true,"multiple":false},{"name":"no_follow","help":"print recent log entries and exit","nargs":0,"required":false,"default":false,"choices":null,"flags":["--no-follow"],"flag":true,"multiple":false}],"commands":{},"exclusive":[{"required":false,"names":["follow","no_follow"]}]},"proxy-logs":{"help":"recent proxy traffic (optionally follow)","epilog":"Default: print recent log entries and exit. Use -f/--follow to stream.","arguments":[],"options":[{"name":"follow","help":"keep streaming new log entries","nargs":0,"required":false,"default":false,"choices":null,"flags":["-f","--follow"],"flag":true,"multiple":false},{"name":"no_follow","help":"print recent log entries and exit","nargs":0,"required":false,"default":false,"choices":null,"flags":["--no-follow"],"flag":true,"multiple":false}],"commands":{},"exclusive":[{"required":false,"names":["follow","no_follow"]}]},"copy-to":{"help":"copy local files into the agent","epilog":"agentctl runs on the workstation: LOCAL is a workstation path. Copies directories recursively.","arguments":[{"name":"local","help":"source path on the machine running this command","nargs":null,"required":true,"default":null,"choices":null},{"name":"agent_path","help":"destination path in the agent; relative paths start in /home/agent","nargs":null,"required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]},"copy-from":{"help":"copy agent files to the local machine","epilog":"agentctl runs on the workstation: LOCAL is a workstation path. Copies directories recursively.","arguments":[{"name":"agent_path","help":"source path in the agent; relative paths start in /home/agent","nargs":null,"required":true,"default":null,"choices":null},{"name":"local","help":"destination path on the machine running this command","nargs":null,"required":true,"default":null,"choices":null}],"options":[],"commands":{},"exclusive":[]}},"catalogs":{"preset":["tavily"],"lists":["tavily"],"tools":["chunkhound","tavily"]}}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Dependency-free domain and method parsing for workspace config and proxy policy."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
DEFAULT_METHODS = frozenset(("GET", "HEAD"))
|
|
7
|
+
WILDCARD_METHODS = frozenset(("*",))
|
|
8
|
+
DOMAIN_LABEL = re.compile(r"[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?")
|
|
9
|
+
METHOD_NAME = re.compile(r"[A-Za-z][A-Za-z0-9_-]{0,31}")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def normalize_domain(domain):
|
|
13
|
+
if not isinstance(domain, str):
|
|
14
|
+
raise ValueError("invalid allowlist domain: " + repr(domain))
|
|
15
|
+
domain = domain.lower()
|
|
16
|
+
value = domain.removeprefix(".")
|
|
17
|
+
if len(value) > 253 or "." not in value or any(
|
|
18
|
+
not DOMAIN_LABEL.fullmatch(label) for label in value.split(".")
|
|
19
|
+
):
|
|
20
|
+
raise ValueError("invalid allowlist domain: " + domain)
|
|
21
|
+
return domain
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def method_names(values, *, allow_wildcard=False):
|
|
25
|
+
"""Parse individual method tokens; only the text policy accepts the `all` alias."""
|
|
26
|
+
if allow_wildcard and values and all(value == "*" for value in values):
|
|
27
|
+
return WILDCARD_METHODS
|
|
28
|
+
if not values or any(not isinstance(value, str) or value.upper() == "ALL" or not METHOD_NAME.fullmatch(value)
|
|
29
|
+
for value in values):
|
|
30
|
+
raise ValueError("methods must be comma-separated HTTP methods, 'all', or '*'")
|
|
31
|
+
grants = frozenset(value.upper() for value in values)
|
|
32
|
+
if "CONNECT" in grants:
|
|
33
|
+
raise ValueError("CONNECT is proxy transport, not an allowed request method")
|
|
34
|
+
return grants
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def methods(value):
|
|
38
|
+
"""Parse the textual policy and CLI form, including comma separators and aliases."""
|
|
39
|
+
if not isinstance(value, str):
|
|
40
|
+
raise ValueError("methods must be a string")
|
|
41
|
+
value = value.upper()
|
|
42
|
+
if value in {"*", "ALL"}:
|
|
43
|
+
return WILDCARD_METHODS
|
|
44
|
+
return method_names([part.strip() for part in value.split(",")])
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Shared laptop browser launching with a printable fallback."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from urllib.parse import urlsplit
|
|
5
|
+
import webbrowser
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def show_url(text, *, no_open_browser=False, extra_ports=()):
|
|
11
|
+
"""Print a URL, then try the platform's default browser."""
|
|
12
|
+
url = text.strip()
|
|
13
|
+
try:
|
|
14
|
+
parsed = urlsplit(url)
|
|
15
|
+
valid = (
|
|
16
|
+
parsed.scheme == "https"
|
|
17
|
+
and parsed.hostname
|
|
18
|
+
and re.fullmatch(r"[A-Za-z0-9.-]+", parsed.hostname)
|
|
19
|
+
and not parsed.username
|
|
20
|
+
and not parsed.password
|
|
21
|
+
and not any(c.isspace() or not c.isprintable() for c in url)
|
|
22
|
+
and (parsed.port in (None, 443) or parsed.port in extra_ports)
|
|
23
|
+
)
|
|
24
|
+
except ValueError:
|
|
25
|
+
valid = False
|
|
26
|
+
if not valid:
|
|
27
|
+
raise click.ClickException("No valid HTTPS browser URL was returned")
|
|
28
|
+
click.echo(url)
|
|
29
|
+
if no_open_browser:
|
|
30
|
+
return
|
|
31
|
+
try:
|
|
32
|
+
opened = webbrowser.open(url)
|
|
33
|
+
except (OSError, webbrowser.Error):
|
|
34
|
+
opened = False
|
|
35
|
+
if not opened:
|
|
36
|
+
click.echo("Could not open a browser. Open the URL above manually.", err=True)
|