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§
- Action
Binding - Type-safe adapter from a control’s input value to an exported action.
- Action
Spec - One action a resource exports to the palette.
- Continuation
Key - Collision-free, provider-defined identity for one continuation target or handler. Tuple components remain separate; callers never join or hash them.
- Control
Invocation - A UI control’s inert request to invoke one advertised operation.
- Flat
Action - One (resource, action) pair produced by
flatten, addressable by a compositekeythe palette uses as its row id. - Resource
- One open/presented resource and the actions it exports. Resources
nest via
children. - Resource
Id - Stable identity of a resource within the publishing app instance
(e.g.
tube.video:dQw4w9WgXcQ,ebook.annotation:<uuid>). - Resource
Presentation - Bounded, declarative search presentation for a resource.
- Resource
Semantic Identity - Descriptive source-domain identity, independent of the live dispatch alias. This metadata grants no permission or authority.
- Resource
View Mount Spec - How a live resource-view provider accepts a compositor-owned mount.
- Resource
View Range Spec - Explicit range-navigation binding. Offsets retain the reference’s Chars or Bytes unit; the app validates them against its current text before moving.
- Resource
View Spec - An explicit presentation of a resource, separate from the actions used to open or mount it.
Enums§
- Action
Binding Error - Failure to construct or emit a control binding.
- Action
Input - How an
ActionSpecproduces its replayableEncodedActionwhen 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”.
- Continuation
Arguments - Continuation
Evidence - Continuation
Query
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
promptedspec 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§
- Args
Builder - Builds an action’s encoded form from arguments already bound against its
declared
params. - Need
Classifier - Classifies what one invocation is from its bound arguments.
- Risk
Classifier - Classifies the risk of one invocation from its bound arguments.