Skip to main content

Module capability

Module capability 

Source
Expand description

The canonical capability model and its registry: the one place a capability is defined. MCP, HTTP, OpenAPI, the CLI’s introspection and the generated documentation are projections of what lives here and define nothing of their own.

Two sources feed the registry: typed executable capabilities written in Rust (builtin) and declarative objects the repository’s layer declares (declarative). Both normalise into the same Capability descriptor; a consumer cannot tell, and need not care, which source an entry came from except through its provenance.

use majordomus_cli::capability::{builtin, CapabilityRegistry, HttpMethod};

// the application composed from its modules, validated on the way in
let registry = CapabilityRegistry::builder()
    .with_modules(builtin::modules())
    .build()
    .expect("the composed application is valid");

// one descriptor, and every projection is a way of asking for it
let by_id = registry.get("repository.info").expect("a canonical id");
let by_route = registry
    .by_http(HttpMethod::Get, "/api/v1/repository")
    .expect("the route it declares");
let by_tool = registry
    .by_mcp_tool("majordomus_repository")
    .expect("the MCP tool it declares");
assert_eq!(by_id.id, by_route.id);
assert_eq!(by_id.id, by_tool.id);

// and nothing was told about it: the exposures are on the descriptor itself
assert_eq!(by_id.exposure.http.as_ref().unwrap().path, "/api/v1/repository");

Re-exports§

pub use closure::Finding;
pub use closure::Matrix as ProjectionMatrix;
pub use closure::Projection;
pub use closure::Row as ProjectionRow;
pub use executor::CapabilityExecutor;
pub use handler::CapabilityError;
pub use handler::Context;
pub use handler::Executable;
pub use handler::Handler;
pub use model::Availability;
pub use model::BenchmarkPolicy;
pub use model::BenchmarkPrecondition;
pub use model::CachePolicy;
pub use model::Capability;
pub use model::CapabilityId;
pub use model::CapabilityKind;
pub use model::CliExposure;
pub use model::Concurrency;
pub use model::Effect;
pub use model::ExecutionPolicy;
pub use model::Exposure;
pub use model::Hints;
pub use model::HttpExposure;
pub use model::HttpMethod;
pub use model::McpExposure;
pub use model::McpResource;
pub use model::ModuleId;
pub use model::Provenance;
pub use model::SkillExposure;
pub use model::Stability;
pub use model::Visibility;
pub use model::WaiverReason;
pub use model::RESERVED_SKILL_NAMES;
pub use registry::CapabilityRegistry;
pub use registry::Entry;
pub use registry::RegistryError;
pub use schema::CanonicalSchema;

Modules§

builtin
The executable capabilities this executable ships: one Rust module per capability module, each owning its typed inputs and outputs, its handlers, its benchmark cases and its module() composition; modules composes the application from them with compose_modules!, and that list is the only root composition there is. Adding a capability to an existing module touches that module’s file alone; every projection, benchmark target and generated document follows from the descriptor.
closure
Projection closure: a declared exposure is answered by the surface that would carry it.
executor
The one execution path.
handler
What a capability’s behaviour is, and what it is allowed to know.
model
The descriptor: everything a projection may say about a capability, and nothing else.
readings
The latest reading of a source, handed over at once.
registry
The registry: every capability, once, validated, in a deterministic order, with the lookups projections need. Built at one place per process from the builtin executables and the repository’s declarative objects; nothing else adds to it.
rustdoc
Rust doc comments, translated into the CommonMark every projection promises.
schema
One schema per type, and every projection reads it.

Structs§

CaseContext
What a case provider may look at: the repository’s index, so that a case can name an object that exists (objects.get needs a real URI) and skip itself when the repository holds nothing it could ask for.
ModuleDescriptor
One module: its identity, what it is for, and the executables it composes. The module stamps its id on every capability it carries, and the registry refuses a capability whose id namespace is not its module.
NamedCase
One representative input, named so that results and baselines can refer to it.

Traits§

BenchmarkCases
Representative inputs of a capability’s input type. Implemented once per input type; the capability! macro requires it, so a new capability without a benchmark case is a compile error, not a coverage report.

Type Aliases§

CaseProvider
The type-erased case provider an executable carries.