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//! - [`bootstrap`] — `[install]` block executor: provisions an addon's upstream
15//! package via a pinned package manager (uv/pip/cargo/npm/brew/dotnet) on `add`,
16//! uninstalls it on `remove` (#1105, Phase 2). Never goes through a shell.
17//! - [`scaffold`] — `addon init` starter manifest generator (DX, P4).
18//!
19//! Security (#863, P1):
20//! - [`capabilities`] — the declared `[capabilities]` permission model that
21//! drives the per-addon sandbox + env allowlist + install consent.
22//! - [`trust`] — trust tier (`verified`) + static risk assessment of the wiring.
23//! - [`audit`] — capability-coherence + malware heuristics + the verified/paid
24//! gate (#403): does the declared `[capabilities]` match the wiring, and is the
25//! wiring free of malicious patterns?
26//! - [`commerce`] — sellable-addon model (`[pricing]`) + the mandatory paid
27//! listing gate (Track B): no addon is sold without clearing the audit.
28//! - [`binhash`] — SHA-256 binary pinning for stdio addons (refuse a swapped
29//! executable at spawn).
30//! - [`policy`] — the global-only `[addons]` install policy floor + the gate.
31//! - [`signing`] — Ed25519 signing for the user-override registry.
32//! - [`revocation`] — central kill-switch that blocks a revoked addon from
33//! running (install, catalog build, every proxy call).
34//! - [`integrity`] — install-time wiring hash + local re-verify (the lockfile).
35//! - [`meter`] — per-addon / per-tool usage metering (analytics + billing base, P5).
36//! - [`sandbox`] — per-addon OS sandbox for spawned stdio servers.
37//! - [`runtime`] — redaction + audit of untrusted addon tool output.
38
39pub mod audit;
40pub mod binhash;
41pub mod bootstrap;
42pub mod capabilities;
43pub mod commerce;
44pub mod env_scrub;
45pub mod health;
46pub mod install;
47pub mod integrity;
48pub mod manifest;
49pub mod meter;
50pub mod policy;
51pub mod registry;
52pub mod revocation;
53pub mod runtime;
54pub mod sandbox;
55pub mod scaffold;
56pub mod signing;
57pub mod store;
58pub mod trust;
59
60pub use audit::{AuditReport, AuditVerdict};
61pub use bootstrap::{AddonInstall, BootstrapStatus, InstallReceipt, Manager};
62pub use capabilities::{AddonCapabilities, FilesystemAccess, NetworkAccess};
63pub use commerce::{AddonPricing, PaidGate, PricingModel, paid_listing_gate};
64pub use health::ProbeReport;
65pub use manifest::{AddonManifest, AddonMcp, AddonMeta};
66pub use policy::{AddonPolicy, AddonsConfig};
67pub use sandbox::SandboxMode;
68pub use store::{InstalledAddon, InstalledStore};
69pub use trust::{RiskFinding, RiskLevel, TrustTier};