StructOp Handbook
Contents Examples Commands
Handbook / What is StructOp?

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#

How declarations, providers and native libraries fit togetherApplication declarations use ability kinds that a provider defines. A provider comes from the signed index or from structop bind. Each provider version holds a schema of ability kinds, attributes and types, and templates of C or Rust code with placeholders. Declarations are checked against the schema, the templates are filled to produce generated source, and the toolchain compiles it, linking any native library or crate, into the executable application.Declarationsability "print"Provider sourcessigned index orstructop bindProvider (one version)Schemaability kinds,attributes, typesTemplatesC or Rust codewith placeholdersGenerated sourcemain.c or main.rsToolchaincc or CargoNative libraryC library or crateExecutable application
A provider is the link between declarations and target-language code.
  1. Declarations name ability kinds, such as print, that a provider defines.
  2. A provider reaches the project from the signed index, or is written by structop bind for a native library.
  3. Each provider version defines its ability kinds and supplies the target-language code for them.
  4. Declarations are checked against the provider, which then supplies the generated source.
  5. 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
$ 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  required

Discovery 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#

ProviderMaintained byWhat you need
Official: StructOp/c, rust, curses, bracket-lib, gtk2, gtk3, gtk-rsStructOpNo key
Community providers approved in the signed indexTheir publishersNo key
Private providersTheir publishersA 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.