返回 CodeWhale
TERMUX.md
根目录 / docs / TERMUX.md
1 # Termux / Android arm64 Support
2
3 Codewhale provides an Android arm64 build and archive path for
4 [Termux](https://termux.dev). Treat Termux support as a preview until the
5 real-device runtime QA tracked in #4236 and #4242 is complete. This document
6 covers the install path and the platform-specific behavior differences you
7 should know about.
8
9 ## Installation
10
11 Use the Android-specific GitHub release archive. The
12 [v0.9.11 release](https://github.com/Hmbown/CodeWhale/releases/tag/v0.9.11)
13 includes `codewhale-android-arm64.tar.gz`; device support remains **preview**.
14 Follow [the Android / Termux installation steps](INSTALL.md#android--termux-arm64)
15 to verify the archive against the matching `codewhale-bundles-sha256.txt`, then
16 run the bundled installer with `PREFIX="$PREFIX"` so commands go into
17 `$PREFIX/bin`. Use `codewhale update` for an existing direct installation;
18 keep package-managed files under their package manager's control.
19
20 If a release has no compatible Android archive or you are validating a source
21 build, Cargo remains a preview fallback inside Termux:
22
23 ```sh
24 pkg install -y rust clang pkg-config make git
25 cargo install codewhale-cli --locked
26 ```
27
28 The general macOS/Linux web installer is not the Android installation route.
29 Do not install `codewhale-linux-arm64` in Termux: Android uses Bionic libc and
30 a separate build target. A Linux release asset is not an Android binary.
31
32 ## Platform behavior on Android
33
34 Codewhale's security model has three distinct layers on Android:
35
36 1. **Android's app sandbox** — Android assigns Termux its own app UID and
37 applies the platform's SELinux and seccomp protections. Commands started by
38 Codewhale inherit that app boundary and any storage or other permissions the
39 user has granted to Termux. See the
40 [Android application sandbox](https://source.android.com/docs/security/app-sandbox)
41 and [Termux filesystem layout](https://github.com/termux/termux-packages/wiki/Termux-file-system-layout).
42 2. **Codewhale's per-command sandbox backend** — Seatbelt (macOS) or the
43 opt-in bubblewrap wrapper (Linux) can further narrow what a child command
44 may access. Codewhale does not currently provide that additional layer on
45 Android.
46 3. **Codewhale's own gates** — workspace trust, approval prompts,
47 `allow_shell`/`disallowed-tools`, and the file-tool permission system.
48 These share the cross-platform application code path; their Android
49 behavior still needs the real-device QA tracked below.
50
51 ### Codewhale sandbox backend: none
52
53 Codewhale's existing Seatbelt and Linux bubblewrap integrations do not target
54 Android. Consequently, `codewhale doctor --json` reports the sandbox as
55 `{"available": false, "kind": null}` on Android. That status describes the
56 absence of an additional Codewhale child-process sandbox; it does not mean
57 Android or Termux provides no OS isolation.
58
59 - `get_platform_sandbox()` returns `None` on Android.
60 - No Linux-only bubblewrap wrapper is compiled into the Android build — it is
61 `#[cfg(target_os = "linux")]`-gated and Rust
62 treats `android` as a distinct target from `linux`.
63 - Shell commands retain Termux's Android app boundary but receive no
64 Codewhale-specific filesystem narrowing. Treat every location available to
65 Termux, including user-granted shared storage, as potentially available to a
66 command that you approve.
67
68 ### Approvals: still apply
69
70 Codewhale's approval system (interactive prompts for risky actions,
71 `allow_shell`, `--disallowed-tools`) is implemented at the application layer,
72 independently of the OS sandbox. The Android code path is present, but its
73 interactive behavior still needs the real-device QA tracked in #4242.
74
75 ### Secret storage: file-backed
76
77 Codewhale's Termux/native build has no supported OS keyring backend (the
78 desktop Secret Service/dbus integration is unavailable, and Codewhale does not
79 yet integrate [Android Keystore](https://developer.android.com/privacy-and-security/keystore)).
80 It therefore falls back to **file-backed secret storage**: plaintext JSON files under
81 `~/.codewhale/secrets/` (Termux home directory), protected only by `0600`
82 file permissions — they are **not encrypted at rest**. On single-user
83 Termux this uses the same Unix permission mode as `~/.ssh` private keys; it is
84 not encrypted at rest.
85
86 - Keys saved through setup, `/provider`, or `codewhale auth set` are written to
87 `~/.codewhale/config.toml` and mirrored to
88 `~/.codewhale/secrets/secrets.json`. Treat both as plaintext sensitive
89 files.
90 - `codewhale auth status --provider <id>` reports which secret backend is
91 active for a provider.
92
93 ### Self-update
94
95 `codewhale update` on Android requests the `codewhale-android-arm64`
96 release asset — never the Linux arm64
97 assets. The GNU libc (glibc) compatibility preflight is Linux-only and is
98 skipped entirely on Android (Bionic libc).
99
100 ## Known limitations (first Termux release)
101
102 | Feature | Status | Notes |
103 |---------|--------|-------|
104 | Android app sandbox | ✅ inherited | Per-app UID plus Android platform protections |
105 | Codewhale command sandbox | ❌ unavailable | No bubblewrap/Seatbelt backend on Android |
106 | Codewhale keyring backend | ❌ unavailable | Falls back to file-backed secrets |
107 | Approvals / gates | ⚠️ implemented | Device QA pending |
108 | File tools | ⚠️ implemented | Device QA pending |
109 | Self-update | ⚠️ asset selection implemented | Published-asset and device QA pending |
110 | Shell execution | ⚠️ app boundary only | No Codewhale-specific narrowing; runtime QA pending |
111
112 ## Related issues
113
114 - #4236 — Epic: official Termux / Android arm64 support
115 - #4238 — Make Android sandbox and secret-store behavior explicit
116 - #4240 — Build and bundle Android arm64 release assets
117 - #4241 — Teach updater to select Android assets on Termux
118 - #4242 — Run Termux runtime QA
119
119 lines MARKDOWN