Skip to main content

Module resource

Module resource 

Expand description

The nested Resource tree an app publishes, and the **ActionSpec**s each resource exports.

A Resource is something the app currently has open/presented (a playing video, an open book); resources nest — a video owns its comments, a book its annotations. Each exports ActionSpecs: the operations Ctrl+K offers for it.

The split that matters: Resource/ActionSpec is presentation — local, per-frame, with human labels and (for a prompted action) a closure. The EncodedAction an ActionSpec yields is the action — serializable, replayable. Presentation never crosses a boundary; only the action does.

§The typed projection

A spec also carries a serializable projection of itself: a typed params list and a builder that turns bound ActionArgs into that same EncodedAction. That is what lets a caller with no window enumerate the surface (see crate::wire) and invoke it by name — the presentation stays local, but a faithful description of it can now cross.

The projection is derived from the same closure the palette uses: immediate projects to zero parameters returning its pre-encoded action, and prompted projects to one required Text parameter named PROMPTED_PARAM that calls the app’s closure. An affordance, its palette row, and an external invocation therefore run through one function and produce the same action.

typed constructs an action whose argument has a domain type (a number in 0..=1, a fixed set of filter names) instead of relying on a lenient prose parser.

Structs§

ActionBinding
Type-safe adapter from a control’s input value to an exported action.
ActionSpec
One action a resource exports to the palette.
ContinuationKey
Collision-free, provider-defined identity for one continuation target or handler. Tuple components remain separate; callers never join or hash them.
ControlInvocation
A UI control’s inert request to invoke one advertised operation.
FlatAction
One (resource, action) pair produced by flatten, addressable by a composite key the palette uses as its row id.
Resource
One open/presented resource and the actions it exports. Resources nest via children.
ResourceId
Stable identity of a resource within the publishing app instance (e.g. tube.video:dQw4w9WgXcQ, ebook.annotation:<uuid>).
ResourcePresentation
Bounded, declarative search presentation for a resource.
ResourceSemanticIdentity
Descriptive source-domain identity, independent of the live dispatch alias. This metadata grants no permission or authority.
ResourceViewMountSpec
How a live resource-view provider accepts a compositor-owned mount.
ResourceViewRangeSpec
Explicit range-navigation binding. Offsets retain the reference’s Chars or Bytes unit; the app validates them against its current text before moving.
ResourceViewSpec
An explicit presentation of a resource, separate from the actions used to open or mount it.

Enums§

ActionBindingError
Failure to construct or emit a control binding.
ActionInput
How an ActionSpec produces its replayable EncodedAction when chosen.
Collects
What kind of thing an action’s one text argument names. Words are what the asker says outright; a content hash addresses bytes already in this machine’s blob store (nobody types one, it names something an earlier operation produced). Declared on the spec rather than inferred, so a caller with no screen can tell “give me a new name” from “give me the image to place”.
ContinuationArguments
ContinuationEvidence
ContinuationQuery

Constants§

INVALID_ARGUMENTS_TYPE
Inert envelope produced when the legacy one-field palette cannot satisfy a typed contract. Hosts recognize it as a refusal; it is never registered or dispatched as an application operation.
KEY_SEP
Field separator inside a flattened composite key — a unit-separator control char never appears in a resource or action id.
PROMPTED_PARAM
The parameter name a prompted spec projects its single free-text argument under.

Functions§

flatten
Depth-first flatten of a resource forest into every exported action, parents before children — what the palette lists.

Type Aliases§

ArgsBuilder
Builds an action’s encoded form from arguments already bound against its declared params.
NeedClassifier
Classifies what one invocation is from its bound arguments.
RiskClassifier
Classifies the risk of one invocation from its bound arguments.