kosa8-cli 0.22.1__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.
@@ -0,0 +1,52 @@
1
+ /bin/
2
+ /dist/
3
+ /dist-gov/
4
+ # Stray binaries from an ad-hoc `go build ./cmd/...` in the repo root.
5
+ /kosa8
6
+ /kosa8d
7
+ /kosa8-guestd
8
+ *.test
9
+ *.out
10
+ .DS_Store
11
+ /guest/build/
12
+ *.vzvmsave
13
+ *.img
14
+ # The guest kernel is checked in (guest/kernel): it is the one artifact
15
+ # that cannot be fetched cheaply, and without it the image cannot be built.
16
+ !/guest/kernel/*
17
+ *.iso
18
+ vmlinux*
19
+ bzImage*
20
+ .idea/
21
+ .vscode/
22
+ dist/
23
+ docs/_site/
24
+
25
+ # Rendered promo films and their parts (scripts/brand).
26
+ /build/
27
+ __pycache__/
28
+
29
+ # Local build output and tool state
30
+ /kosa8.exe
31
+ .wrangler/
32
+ .claude/
33
+
34
+ # Marketing binaries (decks, PDFs, images, video) are generated or large;
35
+ # they are backed up in the private R2 bucket kosa8-archive under marketing/.
36
+ /marketing/**/*.pdf
37
+ /marketing/**/*.pptx
38
+ /marketing/**/*.gif
39
+ /marketing/**/*.png
40
+ /marketing/**/*.jpg
41
+ /marketing/**/*.jpeg
42
+ /marketing/**/*.mp4
43
+ /marketing/**/*.mov
44
+ /marketing/**/*.webm
45
+ /marketing/**/*.zip
46
+
47
+ # Dependencies, as a directory or a symlink to one (a symlink is not
48
+ # matched by "node_modules/").
49
+ node_modules
50
+
51
+ # Local release output (scripts/release/release.sh)
52
+ /dist-release/
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.5
2
+ Name: kosa8-cli
3
+ Version: 0.22.1
4
+ Summary: The kosa8 CLI in one command: uvx kosa8-cli init. Downloads the kosa8 release binary for this platform, checks it against the release's checksums.txt, and runs it.
5
+ Project-URL: Homepage, https://kosa8.com
6
+ Project-URL: Source, https://github.com/AzmxAI/kosa8/tree/main/packaging/pypi
7
+ License: Proprietary
8
+ Keywords: ai-agents,cli,kosa8,microvm,sandbox,serverless
9
+ Classifier: Environment :: Console
10
+ Classifier: Operating System :: MacOS
11
+ Classifier: Operating System :: Microsoft :: Windows
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+
16
+ # kosa8-cli (PyPI)
17
+
18
+ The kosa8 CLI as a one-shot command, for people and agents without it installed:
19
+
20
+ ```sh
21
+ uvx kosa8-cli init # sign in (free Starter, no card) and run a first command on kosa8 Cloud
22
+ uvx kosa8-cli run "echo hi" # one serverless run in a fresh microVM
23
+ uvx kosa8-cli migrate scan # what changes to move E2B, Daytona or Modal code to kosa8
24
+ uvx --from kosa8-cli kosa8 … # the same, under the command's own name
25
+ ```
26
+
27
+ (`kosa8` on PyPI is the Python SDK; this package is only the CLI.)
28
+
29
+ The wheel holds no binary. On first run it downloads the kosa8 release this package version names
30
+ (`kosa8_<version>_<os>_<arch>` from https://github.com/AzmxAI/kosa8-releases), checks its SHA-256
31
+ against that release's `checksums.txt`, refuses to run on a mismatch, and caches it
32
+ (`~/.cache/kosa8/pypi/<version>`, `%LOCALAPPDATA%\kosa8\pypi` on Windows). Standard library only.
33
+
34
+ - `KOSA8_VERSION=0.22.0 uvx kosa8-cli …` runs another release.
35
+ - `KOSA8_PYPI_CACHE` moves the cache.
36
+
37
+ For a lasting install (with the local engine and `kosa8 self-update`): https://kosa8.com/install
38
+
39
+ ## Releasing (owner only; nothing here publishes by itself)
40
+
41
+ 1. Set `version` in `pyproject.toml` and `__version__` in `kosa8_cli/__init__.py` to the CLI release, after that release is published.
42
+ 2. `python3 -m unittest discover -s tests` here.
43
+ 3. `uv build && uv publish` (or `python -m build && twine upload dist/*`) — only when the owner says "publish".
@@ -0,0 +1,28 @@
1
+ # kosa8-cli (PyPI)
2
+
3
+ The kosa8 CLI as a one-shot command, for people and agents without it installed:
4
+
5
+ ```sh
6
+ uvx kosa8-cli init # sign in (free Starter, no card) and run a first command on kosa8 Cloud
7
+ uvx kosa8-cli run "echo hi" # one serverless run in a fresh microVM
8
+ uvx kosa8-cli migrate scan # what changes to move E2B, Daytona or Modal code to kosa8
9
+ uvx --from kosa8-cli kosa8 … # the same, under the command's own name
10
+ ```
11
+
12
+ (`kosa8` on PyPI is the Python SDK; this package is only the CLI.)
13
+
14
+ The wheel holds no binary. On first run it downloads the kosa8 release this package version names
15
+ (`kosa8_<version>_<os>_<arch>` from https://github.com/AzmxAI/kosa8-releases), checks its SHA-256
16
+ against that release's `checksums.txt`, refuses to run on a mismatch, and caches it
17
+ (`~/.cache/kosa8/pypi/<version>`, `%LOCALAPPDATA%\kosa8\pypi` on Windows). Standard library only.
18
+
19
+ - `KOSA8_VERSION=0.22.0 uvx kosa8-cli …` runs another release.
20
+ - `KOSA8_PYPI_CACHE` moves the cache.
21
+
22
+ For a lasting install (with the local engine and `kosa8 self-update`): https://kosa8.com/install
23
+
24
+ ## Releasing (owner only; nothing here publishes by itself)
25
+
26
+ 1. Set `version` in `pyproject.toml` and `__version__` in `kosa8_cli/__init__.py` to the CLI release, after that release is published.
27
+ 2. `python3 -m unittest discover -s tests` here.
28
+ 3. `uv build && uv publish` (or `python -m build && twine upload dist/*`) — only when the owner says "publish".
@@ -0,0 +1,128 @@
1
+ # Copyright (c) 2026 kosa8. All rights reserved. Proprietary; see LICENSE.
2
+ """``uvx kosa8-cli …``: the kosa8 CLI without installing it.
3
+
4
+ Runs the kosa8 release this package version names, downloaded once from
5
+ https://github.com/AzmxAI/kosa8-releases, checked against that release's
6
+ checksums.txt (a mismatch, or an asset missing from it, runs nothing), and
7
+ cached under ~/.cache/kosa8/pypi/<version> (%LOCALAPPDATA%\\kosa8\\pypi on
8
+ Windows). Only the standard library; no binary in the wheel.
9
+
10
+ KOSA8_VERSION runs another release; KOSA8_PYPI_CACHE moves the cache.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import hashlib
16
+ import os
17
+ import platform
18
+ import shutil
19
+ import subprocess
20
+ import sys
21
+ import tarfile
22
+ import tempfile
23
+ import urllib.request
24
+ import zipfile
25
+ from typing import Dict, Optional
26
+
27
+ __version__ = "0.22.1"
28
+
29
+ RELEASES = os.environ.get("KOSA8_RELEASES_URL", "https://github.com/AzmxAI/kosa8-releases/releases/download")
30
+
31
+
32
+ def target(system: Optional[str] = None, machine: Optional[str] = None) -> Dict[str, str]:
33
+ """The release's os, arch, archive kind and executable name for a platform."""
34
+ system = (system or platform.system()).lower()
35
+ machine = (machine or platform.machine()).lower()
36
+ o = {"darwin": "darwin", "linux": "linux", "windows": "windows"}.get(system)
37
+ a = {"x86_64": "amd64", "amd64": "amd64", "arm64": "arm64", "aarch64": "arm64"}.get(machine)
38
+ if not o or not a:
39
+ raise RuntimeError(f"kosa8 has no build for {system}/{machine}; see https://kosa8.com/install")
40
+ return {"os": o, "arch": a, "ext": "tar.gz" if o == "linux" else "zip", "exe": "kosa8.exe" if o == "windows" else "kosa8"}
41
+
42
+
43
+ def asset_name(version: str, t: Dict[str, str]) -> str:
44
+ return f"kosa8_{version}_{t['os']}_{t['arch']}.{t['ext']}"
45
+
46
+
47
+ def expected_sum(checksums: str, asset: str) -> str:
48
+ """The asset's SHA-256 from checksums.txt, by exact name ("" if absent)."""
49
+ for line in checksums.splitlines():
50
+ parts = line.split()
51
+ if len(parts) >= 2 and parts[1] in (asset, "*" + asset):
52
+ return parts[0].lower()
53
+ return ""
54
+
55
+
56
+ def cache_dir(version: str) -> str:
57
+ base = os.environ.get("KOSA8_PYPI_CACHE")
58
+ if not base:
59
+ if os.name == "nt":
60
+ base = os.path.join(os.environ.get("LOCALAPPDATA") or os.path.expanduser("~\\AppData\\Local"), "kosa8", "pypi")
61
+ else:
62
+ base = os.path.join(os.environ.get("XDG_CACHE_HOME") or os.path.expanduser("~/.cache"), "kosa8", "pypi")
63
+ return os.path.join(base, version)
64
+
65
+
66
+ def _get(url: str) -> bytes:
67
+ req = urllib.request.Request(url, headers={"User-Agent": "kosa8-pypi"})
68
+ with urllib.request.urlopen(req, timeout=120) as r: # noqa: S310 (https, fixed host)
69
+ return r.read()
70
+
71
+
72
+ def ensure_binary(version: str) -> str:
73
+ """The checked kosa8 binary for version, downloaded once."""
74
+ t = target()
75
+ d = cache_dir(version)
76
+ exe = os.path.join(d, t["exe"])
77
+ if os.path.exists(exe):
78
+ return exe
79
+ asset = asset_name(version, t)
80
+ base = f"{RELEASES}/v{version}"
81
+ print(f"kosa8: downloading {asset} (once; cached in {d})", file=sys.stderr)
82
+ sums = _get(f"{base}/checksums.txt").decode("utf-8", "replace")
83
+ want = expected_sum(sums, asset)
84
+ if not want:
85
+ raise RuntimeError(f"checksums.txt has no entry for {asset}; refusing to run an unverified binary")
86
+ data = _get(f"{base}/{asset}")
87
+ got = hashlib.sha256(data).hexdigest()
88
+ if got != want:
89
+ raise RuntimeError(f"checksum mismatch for {asset} (want {want}, got {got}); refusing to run it")
90
+ os.makedirs(d, exist_ok=True)
91
+ tmp = tempfile.mkdtemp(prefix=".x-", dir=d)
92
+ try:
93
+ path = os.path.join(tmp, asset)
94
+ with open(path, "wb") as f:
95
+ f.write(data)
96
+ member = t["exe"]
97
+ if t["ext"] == "zip":
98
+ with zipfile.ZipFile(path) as z:
99
+ z.extract(member, tmp)
100
+ else:
101
+ with tarfile.open(path, "r:gz") as tf:
102
+ m = tf.getmember(member)
103
+ if not m.isfile():
104
+ raise RuntimeError(f"{asset} has no {member}")
105
+ with tf.extractfile(m) as src, open(os.path.join(tmp, member), "wb") as dst: # type: ignore[union-attr]
106
+ shutil.copyfileobj(src, dst)
107
+ out = os.path.join(tmp, member)
108
+ os.chmod(out, 0o755)
109
+ os.replace(out, exe)
110
+ finally:
111
+ shutil.rmtree(tmp, ignore_errors=True)
112
+ return exe
113
+
114
+
115
+ def main() -> None:
116
+ try:
117
+ exe = ensure_binary(os.environ.get("KOSA8_VERSION") or __version__)
118
+ except Exception as e: # noqa: BLE001 (any failure ends here, said once)
119
+ print(f"kosa8: {e}\n Install it another way: https://kosa8.com/install", file=sys.stderr)
120
+ sys.exit(1)
121
+ args = [exe, *sys.argv[1:]]
122
+ if os.name == "nt":
123
+ sys.exit(subprocess.call(args))
124
+ os.execv(exe, args)
125
+
126
+
127
+ if __name__ == "__main__":
128
+ main()
@@ -0,0 +1,3 @@
1
+ from . import main
2
+
3
+ main()
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.18"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "kosa8-cli"
7
+ version = "0.22.1"
8
+ description = "The kosa8 CLI in one command: uvx kosa8-cli init. Downloads the kosa8 release binary for this platform, checks it against the release's checksums.txt, and runs it."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "Proprietary" }
12
+ keywords = ["kosa8", "sandbox", "microvm", "ai-agents", "cli", "serverless"]
13
+ classifiers = [
14
+ "Environment :: Console",
15
+ "Operating System :: MacOS",
16
+ "Operating System :: POSIX :: Linux",
17
+ "Operating System :: Microsoft :: Windows",
18
+ ]
19
+ dependencies = []
20
+
21
+ [project.urls]
22
+ Homepage = "https://kosa8.com"
23
+ Source = "https://github.com/AzmxAI/kosa8/tree/main/packaging/pypi"
24
+
25
+ # `uvx kosa8-cli …` runs the command named like the package; `kosa8` is the
26
+ # same, for `uvx --from kosa8-cli kosa8 …` and a `pip install`.
27
+ [project.scripts]
28
+ kosa8-cli = "kosa8_cli:main"
29
+ kosa8 = "kosa8_cli:main"
30
+
31
+ [tool.hatch.build.targets.wheel]
32
+ packages = ["kosa8_cli"]
@@ -0,0 +1,32 @@
1
+ import os
2
+ import sys
3
+ import unittest
4
+
5
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
6
+
7
+ import kosa8_cli # noqa: E402
8
+
9
+
10
+ class Kosa8CLITest(unittest.TestCase):
11
+ def test_asset_names_match_the_release(self):
12
+ t = kosa8_cli.target
13
+ self.assertEqual(kosa8_cli.asset_name("0.22.1", t("Darwin", "arm64")), "kosa8_0.22.1_darwin_arm64.zip")
14
+ self.assertEqual(kosa8_cli.asset_name("0.22.1", t("Linux", "x86_64")), "kosa8_0.22.1_linux_amd64.tar.gz")
15
+ self.assertEqual(kosa8_cli.asset_name("0.22.1", t("Linux", "aarch64")), "kosa8_0.22.1_linux_arm64.tar.gz")
16
+ self.assertEqual(kosa8_cli.asset_name("0.22.1", t("Windows", "AMD64")), "kosa8_0.22.1_windows_amd64.zip")
17
+ with self.assertRaises(RuntimeError):
18
+ t("SunOS", "sparc")
19
+
20
+ def test_checksums_by_exact_name(self):
21
+ sums = "aaa kosa8_0.22.1_linux_amd64.tar.gz.sig\nBBB kosa8_0.22.1_linux_amd64.tar.gz\n"
22
+ self.assertEqual(kosa8_cli.expected_sum(sums, "kosa8_0.22.1_linux_amd64.tar.gz"), "bbb")
23
+ self.assertEqual(kosa8_cli.expected_sum(sums, "kosa8_0.22.1_darwin_arm64.zip"), "")
24
+
25
+ def test_versions_agree(self):
26
+ here = os.path.join(os.path.dirname(__file__), "..", "pyproject.toml")
27
+ with open(here) as f:
28
+ self.assertIn(f'version = "{kosa8_cli.__version__}"', f.read())
29
+
30
+
31
+ if __name__ == "__main__":
32
+ unittest.main()