diff --git a/AGENTS.md b/AGENTS.md index c9b0b3c..17084e9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -203,6 +203,15 @@ cargo publish --dry-run --allow-dirty # before a release If feature flags are added, also run `cargo test --all-features` and `cargo clippy --all-features --all-targets -- -D warnings`. +Before a release, also verify the wasm target (the crate is +WASM-clean by construction — no net/fs/process tokio features): + +```bash +cargo check --target wasm32-unknown-unknown +cargo clippy --target wasm32-unknown-unknown -- -D warnings +cargo semver-checks check-release # before a release +``` + ## Architecture Context - `docs/architecture/` — the authoritative spec. Read it before diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1bb768a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,65 @@ +# Changelog + +All notable changes to this crate are documented here. The format is +based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and +this crate adheres to [Semantic Versioning](https://semver.org/). + +## [0.1.1] - 2026-08-17 + +A minor release that renames the ALPN prefix from `alknet/` to `alk/` +and drops the `alktype` dependency. No public API changes — verified +with `cargo semver-checks` (196 checks pass, no semver update +required). + +### Changed + +- **ALPN prefix renamed.** All ALPN strings changed from + `alknet/` to `alk/`: `alknet/call` → `alk/call`, + `alknet/channels` → `alk/channels`. The rename landed before the + first published consumer (alktty), so no interop break exists. + `CHANNELS_ALPN` is now `b"alk/channels"`; `CallAdapter::alpn()` + returns `b"alk/call"`; `derive_alpn_from_op_name` derives + `alk/` from `channels//(sub|pub)` op names. ADR-004 + amended with the rename rationale. See Review 003. +- **`alktype` dependency dropped.** The only usage + (`alktype::validation::build_validator`) was a thin wrapper over + `jsonschema::options().build()`; the call site now uses `jsonschema` + directly. The crate is leaner — no `alktype` (and no transitive + `indexmap`/`hashbrown 0.17`) in the dependency tree. +- **`tokio` features slimmed.** `features = ["full"]` replaced with + `["rt", "sync", "time", "io-util", "macros"]` — the crate uses no + net/fs/process features. This unblocks `wasm32-unknown-unknown`. +- **WASM support.** The crate now compiles for + `wasm32-unknown-unknown` (verified with `cargo check` and `cargo + clippy` on the wasm target). `uuid` gained the `rng-getrandom` + feature and `getrandom 0.4` the `wasm_js` feature so request-ID + generation works on wasm. + +### Added + +- **BAST document for the chunk header.** + `docs/architecture/chunk-header.bast.json` is the machine-readable + wire-format spec for the channels 8-byte chunk header + (`[channel_id: u32 BE][length: u32 BE]`). BAST is plain JSON — + consumable by any language; the `alktype` crate compiles it into + readers/writers/validators, and future codegen derives + language-specific implementations. Embedded in the crate as + `channels::wire::CHUNK_HEADER_BAST` so downstream Rust crates can + consume it without a file lookup. The hand-rolled + `parse_header`/`write_header` functions remain the hot path; the + BAST document is the contract. + +## [0.1.0] - 2026-08-14 + +Initial crates.io release. The unification of `alknet-call` (structured +JSON RPC: operations, streaming subscriptions, service discovery) and +`alknet-channels` (multiplexing proxy: N logical channels over one +transport stream, channel 0 pre-negotiated as the call protocol). +Vendored core types (`Connection`, `ProtocolHandler`, `BiStream`, +`BidiStreamSource`, `AuthContext`, `IdentityProvider`, `Capabilities`, +`OwnershipProvider`), the `Pub` operation type / `HandlerKind::Sink` +(ADR-046), the channels protocol with openable-ALPNs-as-operations +(ADR-047), and the `ChannelClient` transport-agnostic client. + +[0.1.1]: https://git.alk.dev/alkdev/alkcall/releases/tag/v0.1.1 +[0.1.0]: https://git.alk.dev/alkdev/alkcall/releases/tag/v0.1.0 diff --git a/Cargo.lock b/Cargo.lock index 0cbd160..033f412 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,6 +32,7 @@ dependencies = [ "async-trait", "bytes", "futures", + "getrandom 0.4.3", "jsonschema", "parking_lot", "serde", @@ -149,16 +150,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys", -] - [[package]] name = "fancy-regex" version = "0.18.0" @@ -306,8 +297,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi 6.0.0", + "wasm-bindgen", ] [[package]] @@ -516,17 +509,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a86d3146ed3995b5913c414f6664344b9617457320782e64f0bb44afd49d74" -[[package]] -name = "mio" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" -dependencies = [ - "libc", - "wasi", - "windows-sys", -] - [[package]] name = "num" version = "0.4.3" @@ -821,16 +803,6 @@ dependencies = [ "zmij", ] -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - [[package]] name = "slab" version = "0.4.12" @@ -843,16 +815,6 @@ version = "1.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" -[[package]] -name = "socket2" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" -dependencies = [ - "libc", - "windows-sys", -] - [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -929,14 +891,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" dependencies = [ "bytes", - "libc", - "mio", - "parking_lot", "pin-project-lite", - "signal-hook-registry", - "socket2", "tokio-macros", - "windows-sys", ] [[package]] @@ -1007,9 +963,19 @@ checksum = "bf3923a6f5c4c6382e0b653c4117f48d631ea17f38ed86e2a828e6f7412f5239" dependencies = [ "getrandom 0.4.3", "js-sys", + "uuid-rng-internal", "wasm-bindgen", ] +[[package]] +name = "uuid-rng-internal" +version = "1.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb6e4d912010d7646ef4e5a0ba89bafc6d9f8fd617c53433fe2aa86d26a3b77" +dependencies = [ + "getrandom 0.4.3", +] + [[package]] name = "uuid-simd" version = "0.8.0" @@ -1032,12 +998,6 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - [[package]] name = "wasip2" version = "1.0.4+wasi-0.2.12" @@ -1098,15 +1058,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link", -] - [[package]] name = "wit-bindgen" version = "0.57.1" diff --git a/Cargo.toml b/Cargo.toml index 511065d..148874c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ readme = "README.md" repository = "https://git.alk.dev/alkdev/alkcall" keywords = ["rpc", "json-rpc", "multiplexing", "wire-format", "alpn"] categories = ["network-programming", "asynchronous", "encoding"] -exclude = [".opencode/", "docs/reviews/", "docs/research/", "docs/sdd_process.md", "Cargo.lock"] +exclude = [".opencode/", "AGENTS.md", "docs/reviews/", "docs/sdd_process.md", "Cargo.lock"] [lib] name = "alkcall" @@ -19,13 +19,14 @@ default = [] [dependencies] jsonschema = { version = "0.46", default-features = false } -tokio = { version = "1", features = ["full"] } +tokio = { version = "1", features = ["rt", "sync", "time", "io-util", "macros"] } serde = { version = "1", features = ["derive"] } serde_json = "1" async-trait = "0.1" tracing = "0.1" thiserror = "2" -uuid = { version = "1", features = ["v4"] } +uuid = { version = "1", features = ["v4", "rng-getrandom"] } +getrandom = { version = "0.4", features = ["wasm_js"] } futures = "0.3" parking_lot = "0.12" bytes = "1"