brazen 0.0.21

A stateless, swiss-army-knife adapter for every LLM provider and protocol.
Documentation
# One crate, one product: `cargo install brazen` builds the `bz` command — the
# balls→bl pattern (a single package with a `[lib]` and a renamed `[[bin]]`). The
# pure pipeline + canonical types + seam traits are the library; the impure native
# wiring (`ureq` HTTP, `libc` SIGPIPE/isatty, the XDG files) is confined to the
# `bz` bin (`src/main.rs`) and `src/native/`.
#
# The "lib is network-free" invariant (arch §9.5, §10) used to be the crate graph's
# — a separate `bz` crate held `ureq`/`libc` so the lib literally could not link
# them (bl-c420). Collapsing to one publishable crate means `ureq`/`libc` are now
# crate-wide deps, so the compiler can no longer forbid them in a pure module; the
# invariant is re-established as an executable one by `tests/purity.rs`, which fails
# if any library module (everything under `src/` except `main.rs` and `native/`)
# imports `ureq`/`libc`/`std::net` (bl-c1e2).
[package]
name = "brazen"
version = "0.0.21"
edition = "2021"
# Dependency-driven MSRV floor: `ureq` 3 requires Rust 1.85, so the crate cannot
# build on less regardless of our (conservative, edition-2021) code — verified by a
# 1.85-toolchain build. A CI msrv job pins it (bl-a360).
rust-version = "1.85"
license = "MIT"
authors = ["mudbungie <mudbungie@gmail.com>"]
repository = "https://github.com/mudbungie/brazen"
homepage = "https://github.com/mudbungie/brazen"
documentation = "https://docs.rs/brazen"
keywords = ["llm", "ai", "openai", "anthropic", "cli"]
categories = ["command-line-utilities", "api-bindings"]
description = "A stateless, swiss-army-knife adapter for every LLM provider and protocol."
readme = "README.md"
# What goes to crates.io: an ALLOWLIST, and never an `exclude` (bl-e087). The two
# failure modes are not symmetric. A missing entry HERE costs a build nobody can
# complete — loud, immediate, and fixed by a patch release. A missing `exclude`
# entry costs a PUBLICATION, and `cargo publish` is irreversible: a yanked version
# stays downloadable forever. With a denylist every file class added to the tree
# tomorrow ships by DEFAULT and the author who adds it is the one who has to
# remember; with an allowlist the default is silence and the tree cannot leak a
# class nobody thought about. That matters more here than in most crates: this
# repo tracks `scripts/leak-fixtures/`, a corpus of deliberately fabricated
# secrets whose whole purpose is to look real, and `specs/auth.md` +
# `tests/fixtures/` carry the Claude-Code OAuth recipe.
#
# The list is the crate's own build inputs and the files the registry renders,
# and nothing else. `src/**` is the lib and the bin. `data/defaults.toml` is
# `include_str!`'d at `src/config/load.rs` and `SKILL.md` at
# `src/run/discovery.rs` — both are BUILD inputs, and dropping either breaks the
# published crate for everyone who downloads it. Cargo adds
# `Cargo.toml`/`Cargo.lock` itself.
#
# `!src/tests/**` is the one subtraction inside `src`, and it earns itself three
# times over: that module `include_bytes!`s `tests/fixtures/`, which is
# apparatus and does not ship, so it could not COMPILE from the package; it is
# 1.4 MB, an order of magnitude more than everything else here put together; and
# it carries the operator-owned Claude-session recipe verbatim. No other
# `#[cfg(test)]` module in `src` reads anything outside `src`, so no other one
# needs naming — and `tests/packaged_files.rs` proves that rather than trusting
# it, by requiring every embed of every SHIPPED source file to ship as well.
#
# Deliberately absent, each because it is apparatus or commentary rather than a
# build input: `tests/**` and its fixtures, `specs/**` (a ~500 KB design tree
# addressed to whoever works in this repo), `scripts/**` (the gate, and the
# fabricated-secret corpus under `leak-fixtures/`), `examples/**` (a delegate
# program the OPERATOR runs on their own box, not an input to this crate; the
# README's link to it resolves against the repository), `.github/**`,
# `.githooks/**`, `.claude/**`, `Makefile`, `AGENTS.md`, `release-plz.toml`,
# `deny.toml`. `tests/packaged_files.rs` holds this shape in both directions,
# over the real `cargo package --list`.
#
# The leading `/` on the bare filenames is load-bearing: these are
# gitignore-style patterns, so a pattern with no slash matches that basename at
# ANY depth — a bare `README.md` also ships `scripts/leak-fixtures/README.md`,
# the index of the fabricated-secret corpus, out of a list naming no `scripts`
# entry (measured in yog, bl-8340). The same unanchored rule is what the
# retired `exclude = ["tests", ...]` tripped over in the other direction: it
# matched `src/native/tests/` as well, silently dropping source from the
# package. A pattern containing a slash is already anchored to the package root.
include = [
    "src/**",
    "!src/tests/**",
    "data/**",
    "/SKILL.md",
    "/README.md",
    "/LICENSE",
    "/CHANGELOG.md",
]

[lib]
name = "brazen"
path = "src/lib.rs"

# The CLI command is `bz` (the token-thrifty sugar), built from the same crate —
# exactly how the `balls` crate ships the `bl` command.
[[bin]]
name = "bz"
path = "src/main.rs"

# Build-time trust roots (arch §12). DEFAULT OFF, secure-by-default (owner ruling
# bl-770f): the plain build trusts only ureq's bundled Mozilla `webpki-roots` — a
# self-contained binary, no OS/corporate store. `native-certs` flips ureq to its
# platform-verifier (OS-native cert verification via `rustls-platform-verifier`) so
# enterprises building from source trust their own roots — `cargo install brazen
# --features native-certs`. The feature-gated wiring lives entirely in
# `src/native/transport.rs` (the coverage-excluded shim); the pure lib never sees it.
#
# `socks-proxy` (arch §10). DEFAULT OFF, mirroring `native-certs`: the plain build
# already honors HTTP/HTTPS CONNECT proxies from `HTTP_PROXY`/`HTTPS_PROXY`/
# `ALL_PROXY`/`NO_PROXY` (ureq reads them in `Config::default()` — no feature, no
# code), which covers the common corporate proxy. `socks-proxy` forwards to
# `ureq/socks-proxy` so a `socks5://`/`socks4://` `ALL_PROXY` is honored too, rather
# than silently ignored — `cargo install brazen --features socks-proxy`. Pure
# additive: zero brazen code is gated on it (it only flips a ureq dep), so the
# default dependency surface and 100% coverage are untouched.
#
# `native-host` (yog DESIGN §16.7 U-brazen; bl-547d). DEFAULT OFF: an embedding host
# (yog, lernie) that links the `brazen` lib needs the `bz` binary's native capability
# — the impure `Transport`/`CredStore`/`ModelCache` impls behind the lib's seams —
# without a system-installed `bz`. This feature re-exposes `src/native/` (the same
# coverage-excluded, purity-exempt shim the `bz` bin owns) as the `brazen::native`
# module, so a host can wire a `Host` and drive `brazen::run`/`generate`/`serve` in
# process. Pure code-gating: no dep changes (`ureq`/`libc` are already crate-wide),
# so the default surface, dependency graph, and 100% coverage are untouched. NO semver
# stability on the exposed impls (pin an exact version) — the feature IS the purity
# boundary, enforced by `tests/purity.rs`.
[features]
default = []
native-certs = ["ureq/platform-verifier"]
socks-proxy = ["ureq/socks-proxy"]
native-host = []

[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = "1"
toml = "0.8"
# PKCE S256 (RFC 7636): challenge = BASE64URL-NOPAD(SHA256(verifier)). Both are
# pure-Rust, no C deps (the musl/cross-compile story, arch §10, holds), and their
# code is not counted toward the lib's 100% line coverage — only our call sites.
# `sha2` is `default-features = false` — PKCE needs only the no_std `Sha256::digest`,
# not its `std` Write impl (audit bl-2936). `base64` uses two engines —
# `URL_SAFE_NO_PAD` (PKCE) and `STANDARD` (`-f` media parts, §5.5) — and is also
# pulled transitively by `ureq`, so it adds no extra crate.
sha2 = { version = "0.10", default-features = false }
base64 = "0.22"

# --- Impure shim deps: used ONLY by the `bz` bin (`src/main.rs`) + `src/native/`. ---
# The pure library never imports these — enforced now by `tests/purity.rs`, since a
# single crate can no longer let the crate graph enforce it (bl-c1e2, was bl-c420).

# The blocking, rustls-backed HTTP client — the ONLY user of `ureq` (`src/native/
# transport.rs`), behind the lib's `Transport` seam. `rustls` TLS (`ring` crypto +
# bundled `webpki-roots`) — no OpenSSL/system lib/`pkg-config` (`ring`'s C/asm is
# vendored + statically linked), no async runtime (arch §10), so the single-binary
# musl/Windows/macOS story holds.
ureq = { version = "3", default-features = false, features = ["rustls"] }

# Unix-only: restore the default SIGPIPE disposition + isatty probes (arch §5.8,
# §5.5). `libc` carries no C deps; used only in `src/main.rs`.
[target.'cfg(unix)'.dependencies]
libc = "0.2"

# Test-only: a throwaway tempdir to root the real `XdgCredStore`/`XdgModelCache` so
# their atomic-write / 0600 / 0700 invariants are verified without touching
# `$XDG_DATA_HOME` (bl-5b5a).
[dev-dependencies]
tempfile = "3"
# Test-only: `tests/interface_parity.rs` parses `src/lib.rs` + the `bz` bin sources
# as syntax trees to derive the public surface and the CLI-reachable set mechanically
# (arch §9.8). Already in the lock graph via `serde_derive`, so it adds no new build
# cost; never shipped (dev-only).
syn = { version = "2", features = ["full", "parsing", "visit"] }