Expand description
§Tilo ACTION model
The state layer behind Ctrl+K and cross-peer collaboration: a serializable, replayable unit of CRDT mutation.
§Play locally, replay anywhere
An Action is a value that deterministically mutates a CRDT
Doc. Applied to the local replica, its
ActionEnvelope is replicated; a peer starting from the same state
replays it and lands on the identical
document — the executor pins the Automerge actor id (from
the action’s ActionId) and commit timestamp on every apply, so
the resulting change is content-addressed identical everywhere.
Replayable Action values are strictly not presentation and mutate
only shared CRDT state. The wider resource/action protocol also describes
client-local OperationKind::View and external
OperationKind::Effect operations. Those use the same typed descriptors,
permission checks and invocation receipts, but are dispatched through the
toolkit’s operation handler instead of being replayed as document history.
§Resources
An app publishes the tree of ResourceSpecs it currently has open (a
video → its comments; a book → its annotations) through the toolkit’s
PublishesResources. Each resource exports ActionSpecs; the
palette lists them, and choosing one
dispatches the underlying action.
§The action API
A resource tree is only useful to the app that built it until someone
else can reach it. api is that reach: api::survey turns a
live tree into inert, stably-addressed descriptors, and
api::invoke performs one attributed to the caller — so another
session acts on an app without the app growing a remote-control
surface of its own.
§Remote use
remote carries the action API across machines: a versioned, transport-neutral
vocabulary for listing, invoking, observing and cancelling another peer’s
actions, and the remote::ActionProvider trait a peer implements to answer
it. The caller is always the actor the transport authenticated, and
invocations are idempotent per InvocationId.
§Execution locus
Each action declares an ExecutionLocus: ClientLocal (this
client applies + replicates; peers replay) or ServerPreferred
(route to an authoritative host). dispatch honours
it against an ActionTransport and refuses
the operation when no host answers.
§Sharing this vocabulary with the compositor
params is the same vocabulary the compositor’s headless
action API speaks — ParamType, ActionParam, ArgValue, and the
strict ActionArgs::bind — lifted into one definition rather than left to
converge by accident. The wire spellings of text / integer / boolean
and the bind semantics (unknown argument refused, first failure wins,
nothing partial reaches an action) are unchanged from that surface, and the
const constructors keep a const PARAMS: &[ActionParam] = &[…] compiling
as written.
Two additive extensions: ParamType::Number, because the
app-side arguments this replaces are overwhelmingly fractional and rounding
them would discard the values they exist to carry; and
ActionParam::choices, which turns a prose list into something a caller
can read and binding can enforce. The string fields are
Cow<'static, str> rather than &'static str because an
app builds its parameters per frame out of live document state — a const
declaration is Cow::Borrowed and costs nothing.
§Plain vocabulary
The parts of Tilo’s resource vocabulary that need no store, document or
CRDT live here too: the smallest splice between two texts (splice_between),
the scope a search looks within (ScopeDecl), the kind an item’s address
names (item_kind), the name a workspace emoji is written by
(custom_emoji_name), the catalogue key a kind is named under
(message_key), the id of a history entry (HistoryEntryId), the named
scopes the app framework is profiled by (profiling).
tilo-resource publishes them where they have always been; the toolkit reads
them here, with or without that model.
Re-exports§
pub use action::Action;pub use action::ActionError;pub use action::ActionStep;pub use action::Declined;pub use action::Doc;pub use action::EncodedAction;pub use action::ExecutionLocus;pub use action::MAX_TEXT_BYTES;pub use action::OperationKind;pub use action::RECALL_SUMMARY_BYTES;pub use action::asks_first;pub use action::codes;pub use action::undo_takes_back;pub use api::ActionDescriptor;pub use api::ActionEffect;pub use api::ApiError;pub use api::InputSpec;pub use api::NOT_THE_ASKED_PERSON;pub use api::ResourceViewDescriptor;pub use appearance::Appearance;pub use appearance::AppearanceError;pub use appearance::Persona;pub use content::CONTENT_PART_THRESHOLD;pub use content::CONTENT_REFERENCE_KEY;pub use content::ContentParts;pub use content::MissingContent;pub use content::current;pub use content::register;pub use context::ActionApp;pub use context::ActionContext;pub use context::ActionFacet;pub use context::ActionInvoker;pub use context::ActionResource;pub use context::CHANGE_MESSAGE_PREFIX;pub use context::CONTINUATION_PREFIX;pub use context::Cause;pub use context::ChangeKind;pub use context::InvokerDevice;pub use context::PLACE_FACET;pub use context::RISK_FACET;pub use context::WorkGroup;pub use contract::AGENTS_AUDIENCE_TAG;pub use contract::ARGUMENT_RISK_TAG;pub use contract::ATTENDED_TAG;pub use contract::ActionContract;pub use contract::ActionNeed;pub use contract::Audience;pub use contract::Availability;pub use contract::CARRIER_TAG;pub use contract::COMPENSATED_UNDO_TAG;pub use contract::ConfirmationPolicy;pub use contract::DOCUMENT_READ_TAG;pub use contract::ExecutionMode;pub use contract::HOST_RENDER_TAG;pub use contract::HOST_UNSUPPORTED_CODE;pub use contract::HOUSEKEEPING_TAG;pub use contract::INCOMING_MESSAGE_FACET;pub use contract::INCOMING_MESSAGE_TAG;pub use contract::IRREVERSIBLE_TAG;pub use contract::MAX_OFFLOAD_CPU_TIME_MS;pub use contract::MAX_OFFLOAD_MEMORY_BYTES;pub use contract::MAX_OFFLOAD_OUTPUT_BYTES;pub use contract::MEMBER_OWN_TAG;pub use contract::MIN_OFFLOAD_MEMORY_BYTES;pub use contract::OPENS_HIT_TAG;pub use contract::OPENS_PATH_EXTENSION_PREFIX;pub use contract::OPENS_PATH_TAG;pub use contract::ORIGIN_FACET;pub use contract::OUTSIDE_CAPABILITY_PREFIX;pub use contract::OWN_DEVICE_SCOPE;pub use contract::Offload;pub use contract::PEOPLE_AUDIENCE_TAG;pub use contract::READERS_FACET;pub use contract::REQUIRES_HOST_PREFIX;pub use contract::REQUIRES_NATIVE_PATHS_TAG;pub use contract::RESOURCE_READ_TAG;pub use contract::ROOT_ONLY_TAG;pub use contract::ROUTED_CHANGE_TAG;pub use contract::ResultSpec;pub use contract::RetryPolicy;pub use contract::RiskLevel;pub use contract::SCREEN_PLACE_TAG;pub use contract::SCREEN_TAG;pub use contract::SEARCH_KIND_PREFIX;pub use contract::SEARCH_TAG;pub use contract::SECRET_ANSWER_TAG;pub use contract::UNTRUSTED_CONTENT_TAG;pub use contract::action_node;pub use contract::phrase_is_meaningful;pub use contract::resource_node;pub use draft::Draft;pub use draft::DraftEdit;pub use draft::DraftField;pub use draft::DraftLayout;pub use draft::DraftValue;pub use draft::MessageRole;pub use entry::ActionItem;pub use entry::Described;pub use entry::Did;pub use entry::EditOp;pub use entry::FieldEdit;pub use entry::GroupOf;pub use entry::HistoryOp;pub use entry::HistoryStep;pub use entry::PathStep;pub use entry::Scalar;pub use entry::VerbCall;pub use envelope::ActionEnvelope;pub use executor::ActionTransport;pub use executor::CompensatingScope;pub use executor::Dispatched;pub use executor::EntryReader;pub use executor::HostDecision;pub use executor::LocalTransport;pub use executor::UNDONE_KEY;pub use executor::Verified;pub use executor::apply_local;pub use executor::apply_local_by;pub use executor::apply_local_with_context;pub use executor::await_compensation;pub use executor::await_settlement;pub use executor::commit_written;pub use executor::current_step;pub use executor::dispatch;pub use executor::dispatch_by;pub use executor::dispatch_by_with_context;pub use executor::dispatch_with_context;pub use executor::entry_message;pub use executor::entry_of;pub use executor::envelope_at;pub use executor::invoking_context;pub use executor::open_step;pub use executor::reading_invoking_context;pub use executor::replay;pub use executor::replay_decoded;pub use executor::replaying_as;pub use executor::settle_compensation;pub use executor::verify_change;pub use executor::with_invoking_context;pub use framework::FrameworkChange;pub use interaction::INTERACTION_VERSION;pub use interaction::InteractionAction;pub use interaction::InteractionAnchor;pub use interaction::InteractionGridRange;pub use interaction::InteractionPhase;pub use interaction::InteractionTextRange;pub use interaction::InteractionUpdate;pub use interaction::InteractionViolation;pub use interaction::MAX_ANCHOR_ITEMS;pub use interaction::MAX_DETAIL_BYTES;pub use interaction::MAX_ID_BYTES;pub use interaction::MAX_INTERACTION_BYTES;pub use interaction::MAX_LABEL_BYTES;pub use interaction::SemanticInteraction;pub use key::ActionKey;pub use key::CREATE_ACTION;pub use outcome::ActionFailure;pub use outcome::ActionOutput;pub use outcome::CONTENT_RESOURCE_KIND;pub use outcome::EffectReceiptStatus;pub use outcome::InvocationUpdate;pub use outcome::content_hash;pub use outcome::content_resource;pub use outcome::named_reference;pub use params::ARGUMENTS_JSON_PREFIX;pub use params::ActionArgs;pub use params::ActionParam;pub use params::ArgError;pub use params::ArgValue;pub use params::ArgViolation;pub use params::CHOICE_LABELS_ANNOTATION;pub use params::CONTENT_ANNOTATION;pub use params::PEOPLE_ANNOTATION;pub use params::PICK_ANNOTATION;pub use params::PLACE_ANNOTATION;pub use params::ParamType;pub use params::Pick;pub use params::RESOURCE_KINDS_ANNOTATION;pub use params::SHAPED_BY_ANNOTATION;pub use params::picked_address_schema;pub use params::picked_resource_schema;pub use params::place_schema;pub use params::resource_reference_schema;pub use params::shaped_by_schema;pub use params::validate_json_schema;pub use protocol::ContractViolation;pub use protocol::validate_surface;pub use protocol::validate_surface_contracts;pub use registry::ActionRegistry;pub use registry::DecodePayload;pub use registry::decode_json;pub use registry::decode_payload;pub use resource::ActionBinding;pub use resource::ActionBindingError;pub use resource::ActionInput;pub use resource::ActionSpec;pub use resource::ActionState;pub use resource::ActionType;pub use resource::ArgsBuilder;pub use resource::Collects;pub use resource::ContinuationArguments;pub use resource::ContinuationEvidence;pub use resource::ContinuationKey;pub use resource::ContinuationQuery;pub use resource::Exports;pub use resource::FlatAction;pub use resource::ListedRow;pub use resource::NESTED_RESOURCE_FACET;pub use resource::Noun;pub use resource::PROMPTED_PARAM;pub use resource::ReadingRow;pub use resource::ResourcePresentation;pub use resource::ResourceSemanticIdentity;pub use resource::ResourceSpec;pub use resource::ResourceType;pub use resource::ResourceViewMountSpec;pub use resource::ResourceViewRangeSpec;pub use resource::ResourceViewSpec;pub use resource::RunBy;pub use resource::SEMANTIC_OPERATION_TYPE;pub use resource::Target;pub use resource::action_label;pub use resource::app_label;pub use resource::flatten;pub use resource::kind_is_a_drawn_control;pub use resource::kind_mirrors_a_control;pub use resource::listed_for_people;pub use resource::listed_row;pub use resource::listed_row_problems;pub use resource::sole_text_argument;pub use row_status::RowStatus;pub use row_status::apply_row_statuses;pub use schema::CatalogueSchemaEntry;pub use schema::ContextRequirement;pub use schema::PRESENCE_VIEW_TAG;pub use schema::REQUIRES_TAG_PREFIX;pub use schema::catalogue_schema;pub use schema::catalogue_schema_bytes;pub use selection::BOUND_RESOURCE_PREFIX;pub use selection::MAX_EXCERPT_BYTES;pub use selection::MAX_EXCERPT_CHARS;pub use selection::MAX_SELECTED_ITEMS;pub use selection::SelectionAnchor;pub use selection::SelectionPlace;pub use selection::SelectionSubject;pub use selection::excerpt_of;pub use selection::logical_resource_id;pub use send_to::Recipient;pub use send_to::RecipientKind;pub use send_to::recipients_matching;pub use step::Step;pub use step::StepKind;pub use tilo_action_policy as policy;
Modules§
- action
- The
Actiontrait and its serializable envelope-side vocabulary. - agent_
disclosure - Actions an agent is never shown, because the resource they sit on is disclosed only through a private view.
- api
- The action API: how a member that is not the app enumerates what it has open and performs one of its exported operations.
- appearance
- The name and avatar a bot shows for one action, as a webhook does: a bridge posts a Discord user’s message under that user’s name. The bot stays the author; an appearance is presentation recorded in provenance, never identity. A value that fails validation refuses the invocation; it is never cleaned up, so what a reader sees is exactly what the bot sent.
- compact
- The compact form a history entry takes in a change message.
- content
- Large parts of a recorded action, kept as content and named by reference.
- context
- The history entry an action carries into its committed change.
- contract
- Machine-readable operational semantics for exported actions.
- document_
sync - Which records a device is sent when it joins a workspace, and which it asks for when it needs them.
- draft
- Every invocation as a draft a person can read, change and confirm.
- entry
- What a committed action did, as data.
- envelope
- The
ActionEnvelope: what actually replicates. - executor
- Applying, replaying, and dispatching actions.
- field_
type - The type of a field or value, the same whichever language declared it.
- framework
- Changes the framework makes to a record, which no app action produces.
- group_
form - How a group’s payload is written: its members, with what they share written once.
- interaction
- Semantic, transient presence for an action invocation.
- key
- Naming an action as data, and what kind of action it is.
- noun
- What a resource is, in the words people use for it: its type’s noun, the name of the app whose type it is, and whether it is that app’s root.
- offload
- Where an admitted offloadable invocation runs.
- opened_
by - Which agent run opened a window, as everyone who sees the window is told.
- outcome
- Typed invocation identity, progress, failure, and successful results.
- outside_
document - What may be published outside a document’s own actions: views and effects, never a document mutation, which reaches the document through the resource’s own action.
- params
- Typed action parameters: what an invocation must carry, and the strict bind that checks it before anything runs.
- prefill
- Offering a parameter’s current value: what the action’s own state knows it would act with, which a surface fills and a caller may change.
- profiling
- Bounded observations of named scopes in the real code on this thread.
- protocol
- Runtime validation for an application’s published protocol surface.
- published
- What an application publishes of its actions: the inert, typed shape one action has on the wire, and what its invocation must carry.
- reaction
- Reactions as a reader sees them: who answered something with which emoji. The record a thing keeps its reactions in is the resource model’s; what a reaction strip shows is plain data any view can draw.
- receipt
- Receipts of effects outside the workspace’s documents.
- registry
- The
ActionRegistry:type_id→ decoder, so a replaying peer can turn anEncodedActionback into a liveBox<dyn Action>without knowing the concrete type at the call site. An app registers each action type once; the registry is the same boundary the OS-wide global-search backend plugs into to enumerate action types across apps. - remote
- Using another peer’s actions: a transport-neutral vocabulary.
- resource
- The nested Resource tree an app publishes, and the **
ActionSpec**s each resource exports. - row_
status - What a published row’s actions are like now: a service or a surface says of one row’s state (a process that cannot be killed, a window only a foreign reader may look at) what its published spec carries.
- run
- A person’s run: the changes of one continuous act, which History lists as one row and undo takes back as one step.
- schema
- Presence-independent catalogue schema.
- selection
- What a person has selected, carried to whoever is asked to act on it.
- selectors
- Reading a published resource the way a skill’s selector reads it.
- send_to
- Who a message sent from a window goes to: a person, an agent the workspace keeps, an agent the send makes, a conversation, or the one place a report goes.
- stamp
- What a resource store’s change names in its message: the action that made it, which every holder judges the change against, and which history and undo group it by.
- step
- What an actor’s step is, as data: which kind of work it does, and on what.
- surface
- A resource kind’s public surface as data: its verbs with their
parameters, kinds and the value each answers with, and its fields with
their schema. An app’s
surface.tomlholds it (written bytilolang surfacefrom the code), and it is what a receiver without the app knows about the app’s changes, and what another language compiles its actions and types against. - task_
step - What an agent’s run is doing now, as the steps every run takes.
- terminal_
text - What a program printed to a terminal, as plain text: the run output a person or an agent reads outside the terminal (History’s command views, the parsers that find errors and links in a run) without the escape sequences that drew it.
- tree
- The workspace’s published tree as a caller names it: an address of nested resources ending in an action, the names a resource goes by among the others under its parent, and which resource or action a name picks.
Macros§
- read_
through_ json_ value - Serde for a JSON-only type whose reading goes through one
serde_json::Value. - readable_
through_ json_ value - Serde for a type kept as JSON and in a binary format: in a human-readable
format (JSON, a
serde_json::Value, serde’s buffered content) it is read and written through oneValue, by functions compiled once in the crate that declares it; in any other (postcard) by its derived code, unchanged. - tagged_
through_ json_ value - Serde for an enum written as one object whose
$tagfield names the variant, beside the variant’s own fields: the form of#[serde(tag = "...")], the same JSON field for field and in order.
Structs§
- Acting
- Who made a change, and who they acted for, as a tree: an automation a person
set up, run by an agent, for two people, is
Automation(1) for [Agent(1) for [Person(Q), Person(X)]]. - Action
Address - The stable address of one exported operation: which resource, which action. Both halves are the app’s own ids — no screen position, no list index — so the same address names the same operation across layouts, themes, resolutions, and a caller with no display can work from ids and labels alone.
- Action
Id - A globally-unique id minted per dispatched action. Its 16 bytes double as the deterministic Automerge actor id, making replay content-addressed identical across replicas.
- Control
Invocation - A UI control’s inert request to invoke one advertised operation.
- History
Entry Id - One entry of a history as people read it. Opaque: only ever compared for equality (revert/restore callbacks pass it back to the caller). The caller picks the byte layout — UUID-v4 today, a content hash later.
- Invocation
Id - Stable key carried from admission through completion and used to deduplicate retry-safe calls.
- Person
Id - A person’s id: the lowercase hex of their root public key, bare.
- Presence
Id - One presence in a shared record: a person’s window or a host-minted
execution. Each presence owns its own view state (caret, selection,
Find), and the app builds that presence’s resource tree from it
(the toolkit’s
PublishesResources::resources_for). - Refusal
- Why an action declined to run, in the user’s words, and, where a caller acts on the reason rather than reads it, a stable code naming it.
- Resource
Id - Stable identity of a resource within the publishing app instance
(e.g.
tube.video:dQw4w9WgXcQ,ebook.annotation:<uuid>). - Scope
Decl - Splice
- A splice in characters: at
at,deletecharacters give way toinsert.
Enums§
- Action
Kind - What an action is able to do, derived by the framework from the action’s code and never declared by an app.
- Actor
- Who made a change: a member, an automation running for one, or an app acting by itself.
- Member
Id - A person, agent or bot in a workspace.
Constants§
- COMMENTS_
FIELD - The field a resource’s comments live in: an action that only comments
is placed below it (
ActionContract::field), where someone who may only comment is granted changes. The field holding comments, wherever a model keeps them. The Commenter preset covers it at any depth, so field edits and verbs published on it are what a commenter may do. - KEY_SEP
- Field separator inside a flattened composite key — a unit-separator control char never appears in a resource or action id.
- MAX_
CUSTOM_ NAME - The longest workspace emoji name, in characters.
- MAX_
PRESENCE_ ID_ BYTES - Upper bound on a
PresenceIdin bytes. Presences key bounded per-view maps in app workers; they are never free text. - MODERATION_
FIELD - The field a resource’s comments live in: an action that only comments
is placed below it (
ActionContract::field), where someone who may only comment is granted changes. The field node every app’s moderation actions sit under (acting on other people’s content: removing their message, locking a channel). One rule on it covers every app’s moderation, so presets need no list of verbs.
Functions§
- change_
hex - The history id of a change, as a history spells an entry’s id: the first 16 bytes of the change’s 32, lower-case hex.
- common_
ends - How long a run
aandbshare at their start, and how long a run they share at their end after it (the two never overlap). - common_
text_ ends common_endsof two texts, in bytes, on character boundaries: the texts are compared byte by byte, never decoded into characters.- custom_
emoji_ name - The name of the workspace emoji
emojiwrites as:name:, when it is one. - entry_
hex - The history id
bytesspells: lower-case hex. - entry_
id - The history id
hexspells, in either case: 32 hex characters, else none. - in_
words - A declared name in words, lower case:
TodoListandtodo_listaretodo list. - item_
form_ of - The item form (
<kind>/<field>/<item>) of an item’s stable address (<kind>.<field>:<item>): what an app that publishes its items in the item form publishes the item a stable link names under.Nonefor an address that names no item of a collection (tl:app:root-x). - item_
kind - The kind an item published under
resource_idhas,<kind>.<field>, read from its id,<kind>/<field>/<item>;Nonefor an id naming no item of a top-level collection. - message_
key - The catalogue key a kind’s name is stored under: the kind’s own spelling
with its separators as dashes, so
add-app.questionreads asadd-app-question. Kinds are unique across the system, so the key names one resource type. - noun_
key - The catalogue key a kind’s noun is stored under:
message_keyand-noun, one message with$count({ $count -> [one] person *[other] people }). A type whose name English cannot pluralise writes it; a catalogue that does not hold it leaves the derived noun. - plural
- What several of
nounare called:notes,entries,boxes,people. A noun that already names several keeps the form it is (tasks), and so does one English counts no number of. - scope_
contains - Whether
anchorisscopeor lies beneath it in the anchor path. - singular
- What one of
nounis called:notefornotes,entryforentries,personforpeople,taskfortasks. A noun that names one keeps the form it is. - splice_
between - The smallest splice, in characters, that turns
beforeintoafter: what the two share at their start and end is kept. - stable_
item_ address - The stable address (
kind:id) of the item an item resource id names:<kind>.<field>:<item>for<kind>/<field>/<item>— the address an action’s resource parameter takes. An app that publishes an item under its stable address resolves a link written in the older item form through this;Nonefor an id naming no item of a top-level collection. - valid_
custom_ emoji_ name - Whether
namecan name a workspace emoji: 2 to 32 ASCII letters, digits and underscores, as Discord names its custom emoji, so the same name works on both sides of the bridge.