is_shapes library

What a shape file uses to mark the fields a node is about, and to name a node, point at it exactly or by what it is about, say who wrote it, and take it back.

A shape is a Dart type, and binding is the analyzer checking that an offering's type can be assigned to an acceptor's (https://github.com/enspyrco/intersyntactic/issues/1069). Dart matches classes by name, so two modules that each declared a TurnId would have two types, neither of which can be passed for the other. These are declared once, here, for every module that needs them.

  • identity: marks the fields a node is about.
  • Value: the other half, what a node currently says, when a shape gathers it into one type that can be revised whole.
  • TurnId, SemanticAnchor, and the Target made of the two: a node, exactly and by what it is about.
  • EntryId: any recorded journal entry, which a TurnId gives its own.
  • ActorId: who wrote a node.
  • DecidedBy: whether a decision was the rules' or the person's.
  • MissionId and TrajectoryId: the mission a node is in, and the trajectory, its line of turns, within it.
  • Withdrawal: takes back a node its author wrote, of a shape that is Withdrawable.

The annotation shapes, a comment, a correction and an approval, are built on these in is_annotation_shapes. An annotation is a node an actor writes beside another node: it points at that node and never changes it.

A node can be named three ways, each answering one question:

  • What is it about? Its anchor, a SemanticAnchor: its shape and its identity fields.
  • What does it say? Its version: its shape and all its fields.
  • Which one, exactly? Its exact id, a TurnId: its parent and its bytes, so it names the node's whole history.

A node is never changed. A new node at an anchor that already has one is a new exact id, whatever made it: a message edited, a forecast reissued, a report run again. It is a new version only if it says something different. Every rule an annotation follows compares two of these: in is_annotation_shapes, an approval holds for a later node at its anchor with the same version, a correction is held when the node now at its anchor is another version than the one seen, and who saw what is the exact id alone.

A version has no type here yet. A reader compares what two nodes say itself, until a fixed byte layout for a shape's fields lets one hash name it (https://github.com/intersyntactic/shapes/issues/12). The "identity version" an anchor is hashed with is something else: a number on the shape, changed when the shape changes which fields are identity.

An id is a class with a library-private constructor, made by of, which hashes, or by parse, which returns null for a malformed one. So code holding one never asks whether it is well formed. Classes, not extension types, since a String can be cast to an extension type and skip every check. The two hashes are Sha256Names from is_content_id, made with its sha256, so every name in intersyntactic is made by one sha256 that can be checked in one place.

It imports only is_content_id, so a shape file may import it under import admission's pure list once both are on it (https://github.com/enspyrco/intersyntactic/issues/1046).

Classes

ActorId
Who wrote a node: a person, or an agent, by an id that stays the same for as long as they do, prefixed by the source that minted it, such as a Slack user (slack:T0001/U024BE7LH) or an agent (agent:<id>, an opaque id its install mints on first boot). An agent's name is not part of its id: the name can change, and the id never does.
EntryId
A recorded journal entry, of any kind: a turn, an event, an airlock decision, a chunk of a reply. It is the sha256 of the entry, the same digest as is_journal's EntryHash, so a reader asks the journal for the entry by it and checks that what comes back hashes to it.
Identity
The type of identity. Its constructor is private, so identity is the only one, and a reader looking for the metadata annotation looks for this type.
MissionId
A mission: one span of work under one set of rules, admitted from outside or started in the app, which ends. A Teams channel is a mission, started by its first thread.
SemanticAnchor
What a node is about: hashed from its shape and its identity fields, never its parent or its value. So a reference to one node still finds a later one at its anchor, which says something new about the same thing.
Target
A node, both exactly and by what it is about: the node that was seen, and its anchor.
TrajectoryId
A trajectory: one line of turns in a mission, the person's and the agent's alike, such as one thread of a Teams channel. It names the line, not who is on it: who wrote a turn is its ActorId.
TurnId
One exact node: the sha256 of its parent's id and its own bytes, like a git commit, so it names the node's whole history. Two nodes with the same fields in different places have different ids.
Value
What a node currently says, gathered into one type: the fields that are not identity, in a shape whose value can be revised whole.
Withdrawable
A shape whose nodes can be taken back. A shape says so by implementing it, and Withdrawal takes only these:
Withdrawal<T extends Withdrawable>
Takes back a T: the node at target, which by wrote.

Enums

DecidedBy
Who made a decision a record entry holds: the rules, or the person. So the record tells "the rules let it through" from "the person said yes", wherever something is decided: the airlock deciding a run, the docking port deciding an arrival.

Constants

identity → const Identity
Marks a field of a shape as identity: what the node is about. Every other field is its value: what it currently says.