Skip to main content
Version: 0.7.0

Blocks

A block is a unit together with what makes it usable — its parameters, the channels it offers — held as a fragment of declaration to be placed into a project. Reuse is by copy: placing a block expands it into ordinary declarations, and the block does not survive the act.

block: acquisition-head
model: 1
unit:
kind: interface
exec: components/acquire
args: [ "--device", "${instrument}" ]
parameters:
instrument: { type: string, required: true, label: "The acquisition head this copy drives" }
channels:
acquisition-head: { transport: local, clients: single, unit: acquisition-head }
KeyHolds
blockthe fragment's own name, which is how its unit and its channels are named inside it
modelthe description model it is written against
unitone unit declaration
parametersthe parameters of that unit's own group
channelsthe channels it offers, where it offers any

A block declares into its own group, never into shared. A fragment cannot know what a project holds in common.

Placing one​

yoke-compose block add <source> --as <name>

Expansion does three things, and nothing else.

  1. The unit is written under the name it was placed as. Its program is read from the project at the path exec names and its digest is written beside it; a block carries no digest.
  2. The parameter group is renamed to the placed name. A ${…} reference is left as it is: a name is resolved in the group named after the unit being launched, and that group was renamed with it.
  3. The channels are written. A channel named as the block, or beginning with its name and -, follows the rename — acquisition-head becomes acquire-2, acquisition-head-ui becomes acquire-2-ui — and a channel's unit naming the block's unit follows it too. Any other channel keeps its name.

Refused, leaving the project as it was: a name a unit or a channel already holds; a block whose model is not the project's — a block is never migrated on the way in; a block declaring into shared; a program that is not there; and whatever the gate refuses once the expansion is written.

Where a block comes from​

A path the invocation names, and nothing else. The source is a file, or a directory holding exactly one .yaml; several are refused, naming them. Nothing resolves a name to a location, nothing is searched when the path is not there, and there is no registry. A site that shares blocks shares a directory.

The record​

Updating a block does not update the projects that used it. What answers which projects took this, and at what point is blocks.yaml, beside the descriptor and never packaged, one entry per placement:

placements:
- block: acquisition-head
placed_as: acquire-2
source: ../blocks/acquisition-head.yaml
digest: "sha256:6b21…"
placed_at: "2026-10-15T10:04:11Z"

The digest is of the block's file as it was read. Nothing consults the record while the project is built.

Saving one​

yoke-compose block save <unit> <destination>

The reverse, leaving the project untouched: the unit, the parameters of its group and the channels it serves, written into a block named after the unit and stating the project's model. The unit is written without its digest. A destination already there is refused.