plan: keep default crate wasm-clean; split tokio features for local

The default crate (no features) must compile to wasm32-unknown-unknown
so the downstream TS/Python adapter story works — a wasm-compiled
alktty is the protocol layer for a sandboxed adapter. The local feature
is inherently non-wasm (portable-pty + tokio::process need a real OS)
and enabling it on wasm is a build error by design.

Cargo.toml:
- tokio: drop features = ["full"], use the wasm-clean subset alkcall
  uses (rt, sync, io-util, macros) with default-features = false
- local feature adds tokio/process + tokio/rt-multi-thread
- document the wasm constraint in the [features] comment

Plan:
- Decision 1: add WASM target subsection recording the constraint
- Phase 0: mark the tokio feature split as done
- Risks: add WASM-target-regression risk with a cargo-check CI mitigation
This commit is contained in:
2026-08-17 09:23:21 +00:00
parent 2086817a90
commit 66caa309ef
2 changed files with 62 additions and 6 deletions
+11 -2
View File
@@ -15,11 +15,20 @@ name = "alktty"
[features]
default = []
local = ["dep:portable-pty", "dep:tokio-util"]
# `local` is inherently non-wasm (portable-pty + tokio::process need a real
# OS). The default crate (no features) targets `wasm32-unknown-unknown`;
# enabling `local` on wasm is a build error by design — use a real OS for
# the local-process backend. The protocol crate (wire, negotiation,
# control, backend trait, adapter, session, channels) stays wasm-clean so
# downstream TS/Python adapters can compile it in a sandbox.
local = ["dep:portable-pty", "dep:tokio-util", "tokio/process", "tokio/rt-multi-thread"]
[dependencies]
alkcall = "0.1.1"
tokio = { version = "1", features = ["full"] }
# Minimal, wasm-clean tokio features. `local` adds `process` +
# `rt-multi-thread` (non-wasm). Do NOT use `features = ["full"]` — it
# pulls in `signal`/`fs`/`net` which break `wasm32-unknown-unknown`.
tokio = { version = "1", default-features = false, features = ["rt", "sync", "io-util", "macros"] }
bytes = "1"
futures = "0.3"
futures-core = "0.3"