Provider architecture
Providers extend what StructOp applications can do. They let StructOp use existing native ecosystems instead of recreating every capability inside the engine.
On this page
Providers and abilities#
- Declarations name ability kinds, such as
print, that a provider defines. - A provider reaches the project from the signed index, or is written by
structop bindfor a native library. - Each provider version defines its ability kinds and supplies the target-language code for them.
- Declarations are checked against the provider, which then supplies the generated source.
- The toolchain compiles that source and links any native library or crate it calls.
A provider is a versioned package that defines ability kinds for one target language. An ability is a declaration of one of those kinds, such as ability "print" "Greet". The provider decides what attributes the kind accepts and what code it becomes; the project decides when it runs and what it is given.
Provider schemas#
A provider’s schema, provider.st, declares each ability kind with its attributes, their types and their rules, and validate enforces them before any code is generated. structop schema prints what the project’s providers accept, and -json prints the same for tools:
$ structop schema print
every ability also accepts:
depends_on AddressList
enabled Bool
provider StructOp/c 2.2.1 (C)
ability print
message String required
provider StructOp/rust 2.2.1 (Rust)
ability print
message String requiredDiscovery and installation#
The provider registry lists the available providers and versions. A project names its providers in intent.st; structop init installs them into .structop/providers/ and records the exact versions in .structop/providers.lock. Later commands verify the project copy before using it.
Approved providers are listed in a signed index, and init checks the signature before it trusts an entry. Official providers and approved community providers need no key; private providers need a read-only credential from their publisher. No StructOp installer is published yet, so How providers reach you describes what the release will do.
Versions#
Each provider version is its own folder and does not change once projects use it. version = "@latest" selects the newest approved version that this StructOp can run at the first init, which locks it; a version that needs a newer StructOp is passed over with a note. structop init -upgrade selects a newer one. A withdrawn version is refused.
Official and community providers#
| Provider | Maintained by | What you need |
|---|---|---|
Official: StructOp/c, rust, curses, bracket-lib, gtk2, gtk3, gtk-rs | StructOp | No key |
| Community providers approved in the signed index | Their publishers | No key |
| Private providers | Their publishers | A read-only credential |
Catalogue review covers a community provider’s registration and provenance. Evaluate a provider’s code and templates before using it to build an application.
Native library integrations#
structop bind turns a C library header or a Rust crate into a provider. Functions become ability kinds, handles and enums keep their meaning, and callbacks become handler lists. See C libraries and Rust crates.
Target compatibility#
Every concrete provider declares its implementation language. The portable families pair a C and a Rust provider with the same vocabulary, and init installs and locks both. A project that names a concrete provider directly must use that provider’s language.
Provider development#
A provider is a folder with provider.st and one template per ability kind. Anatomy of a provider describes the format, and Publishing a provider describes how to register one in the community catalogue.
Provider licensing#
Official providers come under the StructOp licence terms. A community provider states its own licence in its registration, and the registry shows it on the provider’s page.