lean_ctx/core/addons/mod.rs
1//! Addon ecosystem: community extensions for lean-ctx (#858).
2//!
3//! An **addon** packages an external MCP server (+ metadata) behind a small
4//! [`lean-ctx-addon.toml`](manifest) manifest, so a third-party tool plugs into
5//! lean-ctx's MCP gateway with a single `lean-ctx addon add` — no fork, no
6//! recompile. Addons are user-global and reuse the gateway trust model
7//! (`[gateway]` is global-only and opt-in; see [`crate::core::gateway`]).
8//!
9//! Layers:
10//! - [`manifest`] — the `lean-ctx-addon.toml` contract (also the registry entry shape).
11//! - [`registry`] — the curated catalog (bundled, with optional user override).
12//! - [`store`] — what is installed locally (`<data_dir>/addons/installed.json`).
13//! - [`install`] — wires an addon into the gateway and records it in the store.
14//! - [`scaffold`] — `addon init` starter manifest generator (DX, P4).
15//!
16//! Security (#863, P1):
17//! - [`capabilities`] — the declared `[capabilities]` permission model that
18//! drives the per-addon sandbox + env allowlist + install consent.
19//! - [`trust`] — trust tier (`verified`) + static risk assessment of the wiring.
20//! - [`audit`] — capability-coherence + malware heuristics + the verified/paid
21//! gate (#403): does the declared `[capabilities]` match the wiring, and is the
22//! wiring free of malicious patterns?
23//! - [`commerce`] — sellable-addon model (`[pricing]`) + the mandatory paid
24//! listing gate (Track B): no addon is sold without clearing the audit.
25//! - [`binhash`] — SHA-256 binary pinning for stdio addons (refuse a swapped
26//! executable at spawn).
27//! - [`policy`] — the global-only `[addons]` install policy floor + the gate.
28//! - [`signing`] — Ed25519 signing for the user-override registry.
29//! - [`revocation`] — central kill-switch that blocks a revoked addon from
30//! running (install, catalog build, every proxy call).
31//! - [`integrity`] — install-time wiring hash + local re-verify (the lockfile).
32//! - [`meter`] — per-addon / per-tool usage metering (analytics + billing base, P5).
33//! - [`sandbox`] — per-addon OS sandbox for spawned stdio servers.
34//! - [`runtime`] — redaction + audit of untrusted addon tool output.
35
36pub mod audit;
37pub mod binhash;
38pub mod capabilities;
39pub mod commerce;
40pub mod env_scrub;
41pub mod install;
42pub mod integrity;
43pub mod manifest;
44pub mod meter;
45pub mod policy;
46pub mod registry;
47pub mod revocation;
48pub mod runtime;
49pub mod sandbox;
50pub mod scaffold;
51pub mod signing;
52pub mod store;
53pub mod trust;
54
55pub use audit::{AuditReport, AuditVerdict};
56pub use capabilities::{AddonCapabilities, FilesystemAccess, NetworkAccess};
57pub use commerce::{AddonPricing, PaidGate, PricingModel, paid_listing_gate};
58pub use manifest::{AddonManifest, AddonMcp, AddonMeta};
59pub use policy::{AddonPolicy, AddonsConfig};
60pub use sandbox::SandboxMode;
61pub use store::{InstalledAddon, InstalledStore};
62pub use trust::{RiskFinding, RiskLevel, TrustTier};