Contents

Open App Definition (OAD) 0.2: Changes from 0.1#

Status: working draft.

This document lists what changed in OAD from draft 0.1 to draft 0.2, and why, for a reader who knows 0.1. It is grouped by subject. Each entry says what the change is, what it replaces, and whether a 0.1 definition has to change. Section numbers refer to the 0.2 chapters, core.md, contracts.md, expressions.md and validation.md, unless a reference says "above" or "below", in which case it means a section of this document.

Most of 0.2 answers questions that 0.1 left to each host: who acts when an app is shared, what a refusal says, what happens when a call is retried, how a source pages, what a control's events carry. Some answers are new features; many are behaviour that 0.1 implied and 0.2 now states.

1. Version and documents#

The version is 0.2. Documents say "oad": "0.2", "oadCatalog": "0.2", "oadDesign": "0.2", "oadHistory": "0.2" and "oadSignature": "0.2". The core catalog is version 0.2.0, and conformance fixtures live in conformance/0.2/. Before 1.0 every minor version is its own format: a host or tool states which versions it reads and refuses others with document.version, saying which versions it reads (core.md section 16). This replaces the 0.1 rule that a host rejects only a higher minor version. 0.1 definitions must change their oad value, and their core catalog range (^0.1.0 becomes ^0.2.0), together with the changes marked below.

changes.md is this document. It is new.

New reserved root names. grants and output are new expression roots (core.md section 3.4), and a local name bound by as, let or indexAs may not be a root name. 0.1 definitions that used grants or output as a local name must rename it.

2. Checking expressions#

Static types. Validation now infers the type of every expression where it can be known: from state entry types, field maps, catalog types, operation outputs, view inputs and view state, macro variables and function signatures. It reports only what is certain; any and unknown types pass, and nullability is not reported. Two new errors:

  • expression.unknownMember: a member access, or an index with a literal string, on a value whose type has no such property (an object with additionalProperties: false, or a field map), and an unknown name under a root (grants.x, env.x, user.x, error.x and a typed event.x) where no more specific diagnostic exists. Unknown names under state, input, view, sources, capabilities, flows and a part's state keep their own reference.* and part.notExported codes.
  • expression.typeMismatch: an operator or function applied to operands whose known types cannot be right, and a computed value whose known type cannot fit where it goes: a derive against its entry's type, a return against output, a written value against its target, a with field against the field map it feeds, a prop value against the prop's type, a part's driven input against what the parent can drive, a binding, a once key and a capability config; and conditions and guards that are not boolean (allow, if, when, where, becomes, a require entry's that) and each values that are not lists. A 0.1 definition with, say, "when": "state.count" or a misspelt env.tz now fails.

expressions.md gives every function and macro a signature and says how types flow through operators, conditionals, default, member access and list macros (section "Static types").

Why: in 0.1 a definition with a misspelled field inside an expression validated cleanly and failed only at run time, sometimes after a person had confirmed the action. 0.1 definitions that validated may now report errors where an expression was in fact wrong; correct definitions need no change.

3. Instances, people and who acts#

0.1 described one person using one app. 0.2 says what happens when an app is shared (core.md section 6.4).

Instances, owners and members. An app instance is one installation of a definition on a host: its state, its issued grants and its audit log. It has one owner (the person who installed it, or the person or organization host policy names); other people who use it are members. How people join is host policy; unless it says otherwise, a member holds access to every action that is not internal. A person with no access to an instance cannot load it (instance.forbidden), and sees nothing of its state or audit log. A principal holds full access when it holds access to every action; access names an action that is not internal or, as part.action, one a part exports, and an action that cannot be named is reached only through its own definition's steps and handlers and needs no access of its own; an instance grant is revoked by the owner, a personal grant by its person or the owner. A session is one principal's use of an instance on one device; locking the device or moving the app to the background does not end it. Replaces the 0.1 wording "a person who installs an app", and settles what session scope means. No change to definitions.

When a surface is active. A surface is active while a person has it open. An agent's connection alone does not make the app active: every rules, flow after timers and timed refreshes need a person's surface open or a background grant, while an agent's own calls run whenever it makes them. 0.1 used "active" without defining it. No change to definitions.

Updates. Running an instance with a definition of the same id and a different digest is an update, and so is a change in any part the instance resolves. Only the owner may update; anyone else is refused with the new code instance.forbidden. The host records each update in the audit log, with each part whose definition changed, applies the rule that a kept grant answers only the request it was asked for, and SHOULD show the owner what changed. A stored value that no longer conforms to its entry's type is replaced by initial, and the host SHOULD keep the old value, and the values of entries no longer declared, for the person they belong to: shared values for the owner, a user value for its person. Members SHOULD be told at their next use that the definition changed, also when only a part changed. Likewise a flow instance whose state the new definition no longer declares is put in the flow's initial state without running enter steps, and the resolution report says so. A host MAY refuse an update that does not descend from the running definition, by its history or signer. Why: in 0.1, two files with the same id silently shared stored state, and a member opening a changed shared app could not withdraw grants the owner had answered. No change to definitions.

Personal and instance grants. A new capability trait, personal, marks a provider that acts for one person (their device, accounts or files). A request on a personal capability is answered by each person for themselves and covers only what is done on their behalf, with its rate counted per person. Every other request, code included, is an instance request: answered once by the owner, covering the instance whoever uses it, with its rate counted per instance. Members are shown instance grants and are not asked. A member whose required personal request is declined cannot load the app; a required instance request the owner declines fails the load for everyone. A request declined only because nobody entitled was present is declined for that use and asked again later. With one person nothing changes. In the core catalog files, media, location, clipboard and share are personal; in the example finance catalog, accounts is. Replaces the 0.1 rule that every grant is approved by "a person who holds full access". No change to definitions.

Roles. The owner assigns roles and holds every declared role unless host policy says otherwise. A member holds the roles the host assigns and none by default. A person who delegates access to an agent MAY include roles they hold; the agent holds exactly those, and none by default. A directory's roles are not assumed to be the app's. Replaces "a person who installs an app for their own use holds every declared role". No change to definitions, but see the flow example below.

Who acts. One table (core.md section 6.4.4) replaces statements scattered across 0.1. An action from a surface runs as the invoking principal; a flow transition caused by a send runs as the principal who sent it, which is the user its allow sees. A becomes or changes trigger is tested where a change happens, with the values of that place, and there are three kinds of change: a write by work that has an acting principal (tested once, on behalf of that principal's person), the result of a source read (once, on behalf of the person the value belongs to), and a change of a session's environment (in that session, on behalf of its person, so the same rule can fire in several sessions; with no active session and a background grant held, once for the instance on behalf of the owner). A change made in one place fires no rule in another: one person's write never makes the app act for another person. With "initial": true, a becomes fires when a session opens while it is true, in that session. An every rule fires once per interval in each active session for its person, or once for the instance on behalf of the owner when no session is active and a background grant is held. A flow after transition runs once per flow instance: for a singleton flow or a flow over a shared collection on behalf of the owner, and for a flow over a collection that is not shared on behalf of the person whose collection holds the element. A rule fired by an event of a personal capability, or by an event its contract says belongs to a person, runs once for that person; any other capability event fires in each active session, or once for the owner with a background grant and no session. For the app principal, user.kind is app, user.id the definition's id, user.roles empty and user.onBehalfOf the person. A principal with no person stands in for its person: values are kept for it, and it holds no personal grant, so a personal call fails with grant.denied. A rule runs after the transaction that triggered it commits, in its own transaction; a rule beyond the cascade limit does not run, and rule.cascade is recorded against the work that started it, instead of failing an action that has already committed. Why: 0.1 did not say who user is in a flow transition or a timer, nor where a trigger with no invoking person fires, and every approval guard depends on it. No change to definitions, but an effect meant to happen once for each person needs user.person.id in its once key (section 5 below).

Access that ends. Access that is taken away or runs out ends at once: the host ends the sessions of a principal that no longer holds access, shows it nothing further, asks it nothing and runs nothing on its behalf (core.md section 6.4). Delegated access MAY name the resources an agent may read as well as the actions it may run; such limits bind agents, and a person who holds access to an instance sees what its surfaces show them. Why: 0.1 had one person for each app and never had to say what becomes of someone who is removed while they have the app open. No change.

Events are observed where they are raised. An app event is observed by rules at the place where it was raised, and by the surfaces of the person on whose behalf the work ran, that person's agents included; other people learn what changed through the state they can read (core.md sections 8.2 and 12.1). Why: on an instance that people share, an event is one person's work, and delivering it everywhere would run every person's rules on it and tell every person's agents of it. No change for an app that one person uses.

Principals with no person. A principal that acts for no person, such as an agent a host admits on its own account, stands in a person's place for the values kept for it, holds no personal grant, and cannot load an instance that has a required personal request (core.md sections 6.4.2 and 6.4.4). No change.

The person behind the principal. user.person is { "id", "name" } of the person the acting principal is or acts for, or null. A definition that records who owns something, or compares a stored person id with the caller, uses user.person.id, so work an agent does for a person belongs to the person. 0.1 definitions that compared stored ids with user.id work as before for people acting themselves; to let agents act for them, compare with user.person.id.

user in derive. Inside derive, user is the principal the value is read for: the acting principal during an action, rule, transition or can evaluation, the person using a visual or voice surface, or the agent reading a resource. A derived entry that reads user has one value per principal; to follow the person, read user.person. env.surface and env.invocation are null there. 0.1 did not say. No change.

Shared state is written only by actions. A binding, or a step written directly in a visual handler, may not target a shared stored entry (write.sharedDirect). Shared state changes through actions run from the handler, so every change passes an allow and an agent can make it on the same terms. Entries of other scopes may still be written directly. Why: with members, a binding to shared state let anyone who could open a view change any record with no guard. 0.1 definitions that bind to, or write from a handler to, a shared entry must move the write into an action.

Steps in a visual handler. A visual event handler holds only steps that stay with the person and the view: set, append, remove and patch (never on shared state), let, if, each, navigate, refresh and run. A call, code, send, emit or return step in a handler, at any depth, is an error (view.handlerStep). Every outside effect, flow event and app event therefore starts in an action, passes an allow, and can be done by an agent on the same terms. Replaces the 0.1 statement that a handler has the same semantics as an action body. 0.1 definitions whose handlers call capabilities, run code, send flow events, emit events or return must move those steps into an action and run it from the handler.

Confirmation cannot be bypassed. A run of an action with confirm from a rule, from a flow's steps, or from an action without confirm is now an error, action.confirmBypassed. A run from a visual handler or a voice intent is the person's own invocation and is allowed, and a confirmed action that runs another is not asked about twice. 0.1 definitions that ran a confirmed action from a rule, a flow or an unconfirmed action must change: give the calling action confirm, or invoke the confirmed action from a surface.

Confirmation says more. confirm may be { "message": dynamic value } as well as true or false. The message is shown beside the action, its input and who is asking, marked as the app's own words, and sees the roots allow sees. Confirmation is asked of the person of the calling principal, and an invocation with no person to ask fails with action.declined. When the answer arrives, access, input, allow and require are checked again. Why: a person confirming saw only the input, not what the app knew about it. No change.

Order of an invocation. An invocation is checked in a fixed order: that the action exists, is not internal, is exposed by the surface used and is covered by the caller's access (all refused alike with action.forbidden); its input; allow; require; confirmation; then the steps. In 0.1 a host could validate input before access and so tell an agent that a hidden action exists. No change.

Requirements with reasons. A new action field, require, lists { "that", "message" } entries checked after input validation and allow, and before confirmation and any step. The first that is not true fails the invocation with the new code action.refused and that entry's message. allow keeps the question of who may act; a refusal for allow (action.forbidden, flow.forbidden) MUST NOT carry the guard's text. A declined or unanswered confirmation now fails with the new code action.declined. Why: 0.1 had no readable refusal, so authors moved checks into fail steps that ran after the person had confirmed, and hosts showed raw guard expressions to agents. 0.1 definitions need not change, but an allow that tests the input or the state rather than the principal reads better as a require.

Asking in advance. New functions can(actionName, input?) and canSend(flowName, event, key?) tell a view or a step whether an invocation or a flow event would pass its checks, without running anything. They are not available in derive, nor in the guards they evaluate (allow, a require entry's that, a transition's if and allow), where they would recurse. Why: views copied guards from actions and flows, and the copies drifted. No change.

4. Grants#

Narrowing to operations. A capability grant request MAY carry operations, a list of operation and event names; the grant then covers only those, within its scopes. A parent may shorten a part's list. A name that is not an operation or event under one of the request's scopes is grant.operationUnknown. A request with operations on a capability with the egress trait permits egress only if the list names a read operation. Why: one scope often covers several operations (directory.read covers find as well as manager), and 0.1 could narrow them only by testing which input fields were present. No change.

where sees defaults. A grant's where is evaluated on the operation input after the contract's defaults are applied. 0.1 did not say, and a call that left out a defaulted field could be silently denied. No change.

Knowing what was granted. A new expression root, grants, gives for each request grants.<name>.held, whether a grant for it is in force for the person or instance acting, and grants.<name>.declined, whether a decline of it stands. A request that has not been answered yet is neither. Why: an app could not tell that an optional request was declined, so it offered features that would fail; and it must tell "said no" from "not asked yet", so that it keeps offering what a person has not refused. 0.1 definitions that used grants as a local name must rename it (section 1 above).

Asking less. Three rules say when a request is put to a person (core.md section 6, "When a request is asked"). A request whose scopes are all given by use is not asked: under such a scope nothing happens unless the person does it themselves at that moment in the host's interface (choosing a file, taking a photo, sharing), or has already handed the app the thing acted on (reading a file they chose), so the act is the consent, and the host issues the grant without a question and records that. The mark counts only from a catalog the host trusts. A required request is asked before the load completes. An optional request MAY wait: the host asks it later, and at the latest when the person's own work first needs it, holding that call for the answer. An answer stands, so a host never asks again for a request whose decline stands, and a revoked grant leaves its request declined; a request that was put to nobody, or got no decision, is declined for that use only. A host MAY take one act as the answer to all the requests it shows together, setting apart those that deserve a closer look. A person's confirmation of their own act MAY be asked at the control they activated. Why: 0.1 put every request to the person as its own question before the app opened, including permission to show a file picker that asks again by its nature, and people who are asked too often stop reading. No change to definitions; an app that hid an optional feature with grants.<name>.held should hide it with !grants.<name>.declined, or a host that asks later never gets to ask.

Contained requests are not asked. A request is contained when everything done under it stays inside the app (core.md section 6, "When a request is asked"), and it needs no answer: the host issues its grant without a question and records that nobody was asked, at the moments it issues a grant given by use. Every code request is contained, since its module runs in the host's sandbox and reaches nothing. A capability request is contained when the provider the host binds promises, for each scope requested, that it gives the app nothing of anyone's, changes nothing outside the instance, reaches no network, program or person, costs nothing and stops with the app, as a demonstration service with sample data does. Only the host makes that promise; a definition or a catalog cannot. The grant is otherwise like any other: limited as requested, shown with the app's other grants, revocable, and not issued again while a decline stands. A host MAY ask all the same. Why: 0.1 asked for every request, among them code a person cannot judge and sample data that is nobody's; an answer to those protects nothing, and people who meet such questions while trying a sample are put off. No change to definitions: a module still needs its request.

Part and parent requests. A call made by a part's steps is covered only by that part's requests, as the parent attenuated them, and a call by the parent's steps only by the parent's. Each request has its own rate. 0.1 did not say which of two requests on one capability covered a call. No change.

Code grants check the text at use. A host refuses to run a module whose text is not the text the grant was issued for, at the moment it runs it. 0.1 implied this through the rule on kept grants. No change.

Configuration left to the host. config is evaluated once, when the capability is bound for the instance, with the owner's env, and kept until an update. A required capability config field MAY be left out of a definition; the owner or host policy supplies it when the capability is bound (for a personal capability, each person when they answer, or host policy), the resolution report shows it, and it is part of what the approver answered. A host with no value reports the capability as missing. Why: 0.1 forced organization-specific values (a collection name) into a file meant to be shared. No change, though such values can now be removed.

Paid parts. The rule that an approver sees pricing before a paid provider is bound now covers paid control implementations too, and the host shows the terms in the review the approver answers (contracts.md section 5). No change.

Consent in history. A history entry MAY carry approvedBy: { "kind": "person", "id" }. A tool that applies a change widening what the app may do SHOULD record who agreed. No change.

5. Outside effects#

once. A call step MAY carry once, a key of 1 to 200 code points naming the effect. Within an instance, a call takes effect at most once per effect record, identified by the definition that made the call (root or part instance), the capability alias, the operation, the key and, for a personal capability, the person. A repeat with an equal input produces the recorded output, is audited as repeated, and does not count against rate; a repeat with a different input fails with the new code capability.onceMismatch; a call made while another with the same identity is in progress waits for its outcome. Failed calls are not recorded. The record is kept outside the action's transaction for at least 30 days, and the key is passed to the provider. once is allowed only on write and external operations (call.onceEffect). Why: an action that filed a report and then failed on a later step filed it again when retried, and nothing let an app prevent that. A key names the effect for the whole instance, so an effect that should happen once for each person includes user.person.id in its key. No change, but retried effects should gain once.

env.invocation. The id of the audit record of the outermost invocation, so app records can point at the audit log. No change.

Failure handling. call, run and code MAY carry orElse, the value bound to as when the step fails. A step with onError or orElse handles its own failure: after the onError steps finish normally, the action continues with the next step and as is orElse or null. return and fail end the whole action from any depth. When a run step fails, only the writes of the action it ran are discarded. 0.1 did not say whether the action continued after onError, and left as unbound. No change for definitions that relied on the reference host, which continued; helper actions that existed only to supply a fallback value can be replaced by orElse.

let step. { "let": name, "to": value } binds a local name for the steps that follow. Why: a value used twice (one uuid() for both an append and a send) needed a helper action. No change.

refresh step. { "refresh": "state.<name>" } asks for a sourced entry to be read again without waiting. Naming an entry that is not sourced is state.notSourced. Why: a "Try again" button could not be written. No change.

Sources. Several changes to sourced state (core.md section 7.1):

  • source.when reads the entry only while it is true; otherwise its status is idle and its value is kept.
  • source.pages (1 to 50, default 1) follows an operation's paging, joins the pages, and sets the new sources.<name>.partial when pages remained. It needs an operation that declares paging (state.sourceNotPaged otherwise).
  • refresh.on defaults to ["open", "change"] whenever it is absent, also when every is given. In 0.1 it was unclear whether every alone dropped them.
  • refresh.every needs a background grant to run with no surface active, like an every rule.
  • A sourced entry has one value per person, read on that person's behalf: open reads the value of the person whose session opens, change the value of each person whose with or when changed, refresh.every the value of each person with an active session (or the owner's, with no session and a background grant), a capability event the values of the persons it reaches, and a refresh step the acting person's value.
  • Following pages continues while next is present and not null.
  • At most one read per entry and person is in flight, a trigger during a read causes exactly one more, and a read that would exceed rate waits rather than fails.
  • The last value read is kept, per person, across restarts; values restored at load make no becomes edge.
  • The value is null until the first successful read whatever type says, and an output that does not conform to type is a failed read with state.invalidValue. type may be narrower than the operation's output.
  • sources.<name>.error is { "code", "message" } or null.

0.1 definitions that listed ["open", "change"] beside every only to keep the defaults may drop them; others need no change.

Environment changes. A change to env.online, env.today or a refresh of env.now re-evaluates the derived values, bindings, becomes triggers and source inputs that read it; a source whose input changes this way is read again when its refresh.on includes change. Each session has its own environment. No change.

Offline and scopes. session and device values are always available. A host that synchronizes user and shared values keeps a local copy and applies offline writes on reconnection under the entry's conflict policy. conflict and key are sibling fields of the state entry. merge works on the top level of the value, matching list elements by key, and an element changed on both sides is taken whole from the later write. device entries always use last write wins, and under reject a stale write whose base still equals what storage holds is not a conflict. No change.

Files across boundaries. A file reference's id must be unguessable (at least 128 random bits). A reference stays readable as long as stored state holds it, and a host that cannot keep the file makes reading it fail rather than leave it looking valid. A reference kept in shared state shares the file with every member whose grant covers reading it. A file reference in an operation input typed as the core catalog's FileRef, at any depth, is resolved by the host so the provider can read it; a vendor catalog names that type through its own uses (section 10 below). A file reference in an agent's tool input, at any depth, must be one the host issued to that agent for this instance, or the call is refused as invalid input; a host SHOULD check any value in its own reference form whatever its declared type. Hosts SHOULD let agents hand files to the host. Why: an agent-only app could not attach a file, and nothing stopped an agent from passing a made-up handle. No change.

6. State, steps and flows#

device scope and people. A device value belongs to one person on one device; another person using the same device does not see it. No change.

initial is evaluated once. A stored entry's initial is evaluated when the instance is created and the result is stored, so a later load sees the same value: a start date stays the day the app was installed. An entry an update adds is evaluated at that update. 0.1 said "evaluated once" without saying when. No change.

internal state. A state entry with internal: true is never an agent resource and never an export (state.internal if listed). Why: helper values leaked as agent resources unless every one was excluded by hand. No change.

Sensitivity follows data. A derived entry that reads a sensitive entry is itself sensitive, for agent resources, the audit log and the explanation alike, unless it sets sensitive: false to say the computed value may be shown. A new warning, state.sensitivityUnstated, flags a sourced entry on a high-sensitivity scope that does not state sensitive. Why: 0.1 redacted values computed from sensitive data in the audit log but exposed them to agents. 0.1 definitions whose derived entries read sensitive data and were meant to be readable by agents must add sensitive: false to them.

Redaction follows the value. In the audit log, a recorded input, output or message is redacted when it was computed from a sensitive value, and recorded in full when it was not, even if the same invocation read sensitive values elsewhere. "Computed from" is defined by references, not conditions: a value is so computed when the expression producing it refers to a sensitive entry, or to a local name, input field or event field that was so computed; a call or code output when its input was. A derived entry with sensitive: false, and a stored entry without sensitive: true, stop it. A message returned to an agent that was computed from a sensitive value the agent cannot read is replaced by the host's own words; a tool's output is returned as computed, so returning a sensitive value makes it readable by every principal that may call the action. No change.

Derived values in a transaction. A derived entry read during an action reflects that action's pending writes. 0.1 implied it. No change.

Optional inputs. An optional field with no default that the caller left out is absent from input; read it with has or default. 0.1 did not say. No change.

Keyed paths. A path may select one list element with [field=expression], as in state.answers[id=item.id].note, in the targets of set, append, remove and patch and in bind. A write that matches nothing fails with the new code state.noElement; a binding that matches nothing shows an empty, disabled control. Why: a row of a repeated list could not bind to its own element, so every editable list needed a change handler and an action per edit. No change.

patch and remove scope. In where, item and index are the element under test; in the with of a patch that has where, they are the element being patched. Both hide outer names. each steps and a node's each may name the position with indexAs. In 0.1, with could not see the element, and index meant two things in one step. 0.1 definitions whose patch ... with read an outer item or index must name the outer element with as or indexAs.

Flow state belongs to the flow. The state field of a collection flow is written only by the flow; a step that writes it fails with flow.fieldWrite. At run time the host compares the collection's elements by key before and after each write, so a computed write, a whole-collection set, a re-added element or a changed key cannot change a state either. An appended element may omit the field or give initial, and the host writes initial into elements appended without it. No enter steps run for a new element's initial state. Why: any action could set an approval's status to approved and skip every guard. 0.1 definitions that set the field to anything other than initial, or changed it outside the flow, must change.

Rule edges. The text now explains that a condition the edge depends on belongs inside becomes, because if is tested only when the edge happens. An every trigger may say "foreground": true: the rule then runs only while a surface is active, also when the app holds a background grant, and trigger.noBackground is not reported for it. Cascade depth counts only rules whose if held. An app that waits for a condition of the environment that may already hold when a session opens sets "initial": true, which then fires in that session. A schedule (every, refresh.every) that fell due several times while the app was not running, or across a clock jump, fires once when it resumes. No change, though rules that guard a becomes with if should be checked.

Work never waits on a person while it holds the app. Work on an instance is serial, and core.md section 8.2 now says so. A wait on a person (a call of an interactive operation, a confirmation, a request asked at the moment of a call) MUST NOT hold the instance: the work waits only while it has changed nothing, its turn then ends with nothing to commit while other work goes on, and it continues where it stopped once the person answered, with allow and require of the actions it is inside checked again against the state of that moment, the names it bound kept and env.now the time of continuing. It is not run again. A new error, action.waitsOnPerson, places such steps: a call of an interactive operation, and a visual handler's run of an action with confirm, come before every step of their work that changes anything, and are never in a rule, a flow's steps or an action those run. At run time, work that reaches such a step after a change, or in a rule or a flow, fails it (capability.unavailable, or action.declined for a confirmation) instead of waiting; a request asked at a call made after a change holds the instance no longer than a call's limit and then fails with grant.denied, while the question stays open for the next try. A schedule that fell due several times while other work ran fires once, and its audit record says how many times it fell due. This replaces the 0.1 sentence that a host SHOULD ask a confirmation before the work starts. Why: one person choosing a photo or answering a question held the app for everyone who shared it, for agents and for timers, for up to ten minutes. 0.1 definitions that write before taking a person's step, or ask a person in a rule or a flow, must take the person's step first, in an action a person or an agent starts, and move what must still hold after the answer into require.

A minimum for after. A host may hold a flow's after to the minimum interval it enforces for every. 0.1 gave hosts a minimum for every only, so two states that lead to each other after a very short time could keep a host busy without end. No change.

Parts. A driven input is read-only inside the part (a write fails with state.readonly), and its type must accept every value the parent can drive; at run time a driven value that does not conform is not written and the host reports state.invalidValue. An agent surface's include lists may name a part's exported action, state entry or event as part.name. A host may let a person start a part from a copy of an instance they own: only shared entries and that person's own user entries are copied, and the copy is recorded in the source instance's audit log. No change, though wrapper actions and re-emitted events that existed only to reach a part from an agent can go.

The resolution report. A declared surface is satisfied only when the host serves it. A part's request the parent declines with false is not put to the approver and is listed as declined by the including definition, not as missing; a request the parent attenuated and the approver granted as shown is satisfied, and degraded is kept for a grant narrower than what was shown. A type from a catalog the host cannot find is treated as any at run time and marked degraded. When meta.derivedFrom has a digest and the host holds the definition it names, the host verifies it and fails the load on a mismatch; otherwise the report says the origin is unverified. A part node's id addresses the node that stands for the embedded view, and the ids of nodes inside an embedded view are qualified by the part's name and a dot (savings.total). No change, except that a definition whose derivedFrom digest is wrong now fails to load where the host can check it.

Behaviour now stated. These were the reference host's readings and are now in the text: a singleton flow's bookkeeping lives with the instance and a collection flow's with the collection; action:<name> is raised on success, nested runs included, with { "input", "output" }; rules fire only in the session that made the write; install is an instance's first load, open runs when a session's first surface opens and close when its last closes; a failing if or where counts as false; each over a value that is not a list is expression.error; a return value is checked against output only when a return ran, and an action without one produces null; a request for an unavailable capability, or for code the host cannot run, is not asked and does not fail the load; a flow event for a missing element is flow.noTransition; an app may use its own codes in fail. No change.

The flow example. The flow example in core.md section 10 modelled "my manager" as a role, which let any manager approve anyone's request, and used an undeclared director role. It now stores requesterId and managerId on each request, lets only the requester (or their agent) submit, takes managerId from the directory rather than from input, compares it with user.id because the manager must approve in person, and declares every role the flow uses. state.requests is a shared list. Elsewhere a stored person id is compared with user.person.id, so an agent acting for the person passes. No change, but definitions copied from the old example have the same fault.

An action can say it was done. An action may carry done: { "message": dynamic value }, what the app says once the action has been done. Whoever invoked it from outside hears it, and nobody else: a person through a visual handler's run, for whom the host shows it for a moment outside the view; a person through a voice intent without its own reply; and an agent, whose tool result carries it beside the output. An action run by another action, a rule or a flow says nothing, and a parent that runs a part's action gets its output only. The message is evaluated once, after the steps succeeded, with the roots allow sees, the state as the steps left it, and output, the value the action produced; a message that cannot be evaluated is no message and the action still succeeds. A host cleans it to one line of plain text and cuts it at 200 characters, and validation warns about a longer literal message (action.doneTooLong). Why: almost every app says "Saved" or "Request sent" after a press whose result is not where the person looks, and 0.2 had no way to say it, so apps kept a text in state that never went away. No change: a definition without done behaves as before.

7. Audit log#

Record kinds. The audit log gains kinds for a delivered capability event (event), a visual handler (handler), a timer (timer) and an update (update); core.md section 15 lists every kind. A declined grant request is recorded (which request, who declined, when), and so is a load that failed because of it. A state change names as its cause the action whose step wrote it; an after transition names the transition that entered its state; a timed source read names its timer. Members read their own records in full and the rest in outline; the owner reads all. No change.

What the log holds and keeps. Routine refreshes of the environment, such as the minute tick of env.now, are not recorded. every firings under one minute apart are recorded as one record per minute with a count; writes to view state are not recorded, and successive keystroke writes from one binding form one record. A host may bound the log's size, but keeps the records of grants and updates for the life of the instance and SHOULD keep at least 90 days of the rest. No change.

8. Views#

View state. A view MAY declare state: entries of { "type", "initial", "description" }, read and written as view.<name>, evaluated when the view opens and gone when it leaves the navigation stack. Actions never see view, and view state is never a resource. Why: every form needed a session state entry per field, each of which was also an agent resource. No change, but form drafts in session state can move to view state.

Main navigation. The visual surface MAY carry navigation: 1 to 12 entries of { "view", "label", "icon", "when" } naming the app's main sections in order (and the forms of the next entry). A host draws the sections that are offered as the app's own navigation and marks the current one; choosing a section replaces the navigation stack with its view. A section's view takes no required input unless the section gives it, and two plain sections never name the same view (view.invalidNavigation). when decides what is offered, never what is allowed. A host MAY show more than one view of the stack at a time, such as a record beside the list it was opened from, and a navigate step of a handler that runs in a view below the top then first closes the views above it, while a handler that does not navigate closes nothing. Choosing the section that is already at the bottom of the stack returns to it. Why: 0.1 gave a host only a start view and a stack, so a host could not tell an app's sections from its forms, and every app looked like pages inside someone else's frame. No change; an app with several sections should list them.

Main sections from the app's data. A navigation entry MAY also be a repeated section, a section with each (the shape of a node's each) that offers one section for each element of a list, or a group, { "group", "when", "sections" }, a heading over 1 to 12 sections or repeated sections. A section MAY carry with, the input its view opens with, checked as a navigate step's with, and count, a whole number shown beside its label, such as unread messages. A section with with or each may name a view another section names; plain sections still name a view once. The host marks the section whose view and input are at the bottom of the stack, tells sections apart by keys that stay the same while an element keeps its each key, and offers at most 200 sections, saying how many a repeated section left out. Why: channels, folders, notebooks and projects are data, so a chat, mail, notes or planner app could not list them in its navigation and had to draw a list inside a view instead. No change; a section's view that takes a required input is now allowed when the section gives it with with.

An app of one view is a card. An app whose visual surface has exactly one view and no navigation is drawn as one card headed by the view's title (core.md section 12.2): with no bar and no page heading above it and the host's own parts outside it; when the body is one canvas, chart, table, list, diagram or group, that control is the card itself. The form follows from the definition, not from the host or a field of its own. Why: most small tools an assistant writes have one view, and a page around them said the app's name three times around something that is one card. No change; give the view a title, which heads the card.

Navigation returns to an open view. A navigate to a view already on the stack with equal input returns to it and closes the views above, instead of pushing a second copy; navigate: "back" followed by a named navigate replaces the current view. Why: going "home" after deleting an item pushed a copy, and Back then showed the deleted item. No change, though handlers that worked around it can be simplified.

A link to a main section goes to that section. A navigate to a view that the navigation offers as a section at that moment, with an input equal to the one that section opens with, chooses the section (core.md section 12.2): the navigation stack is replaced with that view, or returns to it and closes the views above when it is already at the bottom, as when the person chooses the section in the navigation. This holds for a handler's navigate step, a core:link with view and a host that opens a view for the person. A navigate to any other view, or to a section's view with another input, or to a section that is not offered, pushes the view or returns to it as before. Why: a home page whose links lead to the app's sections opened each one on top of the home page, often beside it in a narrow pane, with the home page still marked in the navigation, while choosing the same section in the navigation showed it in full. An author who lists a view as a main section has said it is a place of the app, and going there means the same from a link as from the navigation. No change to a definition; a link to a section no longer leaves a way back to the view it was followed from.

Failed expressions in views and elsewhere. A failing prop or title is absent (a required one gives the placeholder), a failing each.in repeats nothing, a failing binding shows an empty, disabled control, a failing source with or when is a failed read (not an idle source), a failing config member is left unsupplied, and a failing initial gives null. 0.1 said nothing for these positions. No change.

Handler failures. When a handler fails without handling the failure, the host SHOULD show the error's message at the control that raised the event, or in the form for a submit, and the handler's later steps do not run. No change.

Fallbacks. A fallback is a complete node: it takes nothing from the node it replaces but its place, and the outer when and each apply to whichever is drawn. A catalog the host cannot find no longer fails the load: its controls fall back and its capabilities are missing, which fails the load only if one is required. Validation still needs the catalog. degradeTo may name a contract in a catalog that the control's catalog uses (section 10 below). Why: a fallback could not save an app on a host that never installed the vendor's catalog. 0.1 definitions whose fallbacks relied on inheriting props or handlers must repeat them; the reference host never inherited them.

Actions of one control. A slot without scope variables is one node filled once with the names around it, and a control that draws a header of its own takes what a person can do with it as a slot named actions (contracts.md section 3). In the core catalog group, chart, table, list, canvas, diagram and alert have it, and button gains iconOnly, which draws its icon alone and keeps its label as its name; iconOnly without icon is prop.iconOnlyWithoutIcon. A host takes one press of a button at a time while its handler runs. Why: a button at the end of a chart's header, as apps commonly have, could only be drawn as a row above the chart, which reads as a separate thing. No change.

Control behaviour. A new section, contracts.md section 8, settles what the core controls left open: a select event's item is the app's own element at the picked position, and chart, table and list select payloads are typed; hidden keeps a node while when removes it, and disabled passes down; only the app opens a dialog, and a dialog may be drawn inside the app's region; table paging, sorting and selection; which inputs count toward a form; canvas coordinates and lengths; an unknown icon shows nothing; link declares activate; progress and chart series take a format; choice values may be strings, numbers or booleans; the format of a date input's value in each mode; keyboard descriptions follow an alternate role when the host uses one; slider and numberInput refuse a value off their step, and fileInput refuses a file its accept excludes. 0.1 definitions whose chart select handlers read only the plotted fields need no change; those that relied on choice values being strings still work.

Two warnings about how a view reads. A view whose body begins with a core:heading saying what the view's title says is reported (view.headingRepeatsTitle), because a host draws the title as the page's heading and the words would show twice. A child of core:tabs with nothing to name its tab, such as a plain core:stack, is reported (view.tabUnnamed), because its tab would be captioned by its position alone. Both are warnings: the definition stays valid. 0.1 definitions that do either should remove the heading, or wrap the panel in a core:group with a title.

A diagram control. The core catalog gains diagram, for explaining how parts connect: an architecture, a flow or a process. The app gives boxes (DiagramBox: id, label, detail, group, and a kind of box, person, store or outside), connections (DiagramConnection: from, to, label, id, a style of solid or dashed, and arrows forward, both or none) and optional groups (DiagramGroup), never positions, sizes or colours; the host lays the boxes out in bands, routes the lines and fits the drawing to the width it has. selected is bound and reported as a table's selection is: pressing a box raises select with { box, selected } and selects it, pressing it again or pressing empty space clears it. highlight names boxes and connections to keep strong while the rest is dimmed; a connection without an id counts as named when both its boxes are. A connection to a box the diagram does not have, a repeated box id, a group nobody declared and a highlight that names nothing are left out or drawn without the missing part, with a view diagnostic. At most 60 boxes, 120 connections and 12 groups are drawn; beyond that the rest is left out and the node is reported as degraded. Why: an app could only draw a diagram by placing shapes on a canvas by hand, which a model gets wrong and which never fits both a phone and a desktop. No change.

Charts say what their numbers are. chart gains unit (such as hours or kg, which a series may override with its own), categoryLabel and valueLabel (what the axes show), orientation (vertical, or horizontal for bars on their side, first category at the top) and goal (ChartGoal: a value and an optional label, drawn as a dashed line across a bar, line or area chart, with the value axis always reaching it). A unit is shown after plain numbers only, as written; orientation with a kind other than bar, and goal with pie or scatter, are ignored with a view diagnostic (contracts.md section 8.3). Why: only money and percentages could be said, bars could not lie on their side for a ranking or long names, and a target could not be shown, so models invented props such as yLabel and target that the check refused. No change.

A chart keeps what was selected where the app can clear it. chart gains selected, bindable, a ChartValue ({ item, series }: the value of the record's key field and the field of its series) or null, and itemKey, the field that names a record, else the category field. Pressing a bar, a point or a slice selects it, pressing it again or Escape clears it, and pressing empty space changes nothing; the host works out the new selection, writes it to selected when that is bound and keeps it in the view otherwise, as a diagram does, and select gains selected, the selection after it, null when the press or Escape cleared it. item and series always name the value the event is about, the one pressed or the one whose selection Escape cleared, and are never null; Escape is heard only by an app that gives selected, and for one that does not, the host clears its own mark without calling the handler. A chart that neither handles select nor binds selected offers no selection. A selection that names a record or a series the chart does not draw now marks nothing and is kept. The host outlines the selected value and says it is selected in the words of the point and the table of the data, and shows the place of the keys apart from it, only while the keyboard is in the plot. Why: a pressed value stayed outlined, and the app had no way to take the outline away when it forgot what was picked. 0.1 definitions that handle select hear every press as before, and never Escape, since they give no selected.

Formatted text. core:text gains format: plain, the default, or markdown, which reads a small subset of Markdown that every host reads the same way (contracts.md section 8.3): paragraphs and line breaks, strong, emphasis and code in a line, headings of levels 1 to 3, lists with one level inside an item, fenced blocks of code, quotations, rules, links and pipe tables. Everything else, HTML and images included, is shown as its characters. A link in it follows the rules of core:link with a url; nothing in it is fetched, and it never opens a view, runs an action or writes state. A host reads at most 20,000 characters, 500 blocks and list items, nesting 5 deep, and 100 rows and 12 columns of each table, and reports a text beyond them as degraded. The new warning prop.markdownInPlainText reports a literal plain text that is plainly written in Markdown (validation.md section 9). Why: replies from models, notes people write and descriptions from services commonly arrive in Markdown, and a plain text showed **, - and [words](address) literally. No change; a plain text is drawn as before.

Colors and tools in a choice. A ChoiceOption MAY carry icon, an IconName, and swatch, a color token name as a canvas shape's fill takes. A host draws a core:choice whose options all carry a swatch, or all an icon it draws, at most 12 of them, as a palette: small color dots or symbol buttons, one picked, still one radio group named by the choice's label, each option named by its own. A swatch whose name the design lacks falls back to accent and the node is reported as degraded, as a canvas fill is. core:multiChoice takes the same options and does not draw either. core:canvas gains a slot tools: such choices and icon-only buttons, which a host draws beside the surface, or above it where there is little width, outside the area that takes the pointer. A host shows no words saying an input is required when it is in no form, since nothing is submitted there. Why: apps drew color and tool pickers as shapes on a canvas, which grew with the column and were neither one tab stop nor announced as options. No change.

A path shape, and the limits of a scene. The core catalog's Shape gains path: points, a list of { x, y }, drawn as one line through them with round ends and joins, one point alone as a dot, with optional closed, fill, stroke, strokeWidth and opacity. A path is under the pointer on its line and inside its fill, and a point that is not two finite numbers is passed over. A host draws at most 5000 shapes and 50000 path points of a scene and reports a scene beyond them as degraded, saying how many were left out (contracts.md section 8.3). Why: a pen stroke had to be one line for each move of the pointer, so a whiteboard built from its strokes' points ran out of its expression budget after about 2500 points, some 40 seconds of drawing, and lost its canvas, tools and actions with it, and one that kept the lines met the 5000 shapes the reference host drew, which it left out without a word. A stroke is now one shape, and the cost of a scene follows the number of strokes, not of points. No change; the reference host already drew at most 5000 shapes.

Curves and round shapes on a canvas. The core catalog's Shape gains ellipse (radiusX, radiusY, rotation) and arc (radius, from and to in degrees clockwise from pointing right; with a fill, the wedge between the arc and its center), rect gains radius for rounded corners, and a point of a path may carry control points: cx and cy for a quadratic curve, or c1x, c1y, c2x and c2y for a cubic one (the type PathPoint). A curved point counts as one point against the limit of a scene. Every shape with a line gains dash (solid, dashed, dotted) and cap (round, flat, square), and rect, path and arc gain join (round, sharp, bevel); text gains weight (body or emphasis, as the design's type styles). What a shape leaves out is drawn as before, and the pointer finds each shape where it is drawn (contracts.md section 8.3). Why: a stretched circle, a rounded tile, a gauge or a smooth line had to be approximated with many points, which used up the canvas's points, cost expression budget and was not crisp on a large canvas. No change: a scene that uses none of these is drawn exactly as before.

A canvas follows the page's mode. Every color a core:canvas scene names, and its background, is drawn in the values of the page's mode, as every other control's colors are, and follows a change of mode while the app is open; a palette among its tools shows each color as the scene draws it. The canvas gains mode, light or dark, which keeps the scene in that mode's values whatever the page's, for a drawing whose colors mean something by themselves, such as one that must print as it shows (contracts.md section 8.3). Its card, title, tools and settings follow the page either way. Why: a scene kept the light values on a dark page, so a game board, a gauge or a whiteboard was a white panel in a dark app, while a token names a role, and a role has a color in each mode. No change on a light page, or where the design system has no dark mode.

Groups, symbols and motion on a canvas. The core catalog's Shape gains group (x, y, scale, rotation, opacity and shapes, drawn in a space of their own whose both axes are fractions of the width) and use, which places a drawing of the canvas's new prop symbols (a map from a name to shapes) as a group would, with one color of its own for the shapes of the symbol that name given. Groups and placements nest four deep; a placement of an unknown name or of a symbol inside itself is not drawn. The limits of a scene count every shape and point as often as it is drawn, and a pointer on a shape inside a group or a placement reports the outermost id. The canvas and every shape gain motion (the type Motion): none, a motion token's name, or { over, ease }, by which a shape that stays in the scene with the same id glides from its old values to its new ones, drawn by the host on its own clock, and at once for a person who asks for reduced motion (contracts.md section 8.3). Why: a game wrote a figure of several shapes out again wherever it appeared, sending the same rectangles on every tick, and made motion look smooth with a rule that fired twenty times a second. No change: a scene that uses none of these is drawn exactly as before.

Gradients and shadows on a canvas. A shape's fill may be a gradient (the type Fill): { "gradient": "linear" | "radial", "stops", "angle" }, two to eight color names or { color, opacity, at } stops across the shape's own box. Every shape, group and use gains shadow (low, medium, high), drawn from a new optional token group of design systems, shadow, whose levels give offset, blur and opacity; a design system that names none has the default design system's (contracts.md sections 6 and 8.3). A host may leave both out: it fills a gradient's shape with its first stop's color at that stop's opacity and draws no shadow. Why: a game drawn on a canvas looked plotted rather than made, as every fill was one flat color and nothing stood above the ground. No change: a scene that uses neither is drawn exactly as before, and a design system without shadow stays valid.

The keys of a canvas follow the game and are always released. When a canvas that takes keys leaves the drawing while it has the focus and another canvas that takes keys is drawn after it, a host SHOULD give that canvas the focus, and MUST NOT take the focus from outside its own document for it. When a canvas stops taking events while a key it reported pressed is still down (its surface loses the focus, or the canvas leaves the view, is hidden, is disabled, or a dialog is opened over it), the app hears that key's release then, once, and a release with no press before it is not reported; for a canvas that no longer raises events the host raises the release itself (contracts.md sections 8.2 and 8.3). Why: a game whose screens are separate canvases lost the keyboard at each change of screen until the person clicked, and a key held when its canvas went away stayed pressed for the app forever. No change.

A canvas keeps its picture through a frame that cannot be drawn. When a core:canvas that has drawn a scene in this visit of its view becomes the host's placeholder (its scene failed or does not fit), a host SHOULD keep showing the last picture it drew, at its size and in the same place, for a short time, and show the placeholder when no scene can be drawn within it; the kept picture raises no events, assistive technology is told once that the part cannot be shown, and the tree still holds the placeholder (contracts.md section 8.3).

Items that move between lists, and lists a person orders. core:list gains moveGroup, a name the app chooses, reorderable, and the event move. Lists of one view that share a moveGroup and handle move take items from each other: the host carries out the whole gesture, lets the person drag an item onto another list of the group, and MUST offer from each item a way to move it to each other list that needs no dragging, named by that list's label. A list that is reorderable and handles move lets a person put an item at a place of their choosing, within the list and, with a moveGroup, from another list of the group; the host MUST offer from each item a way without dragging to put it one place earlier and one place later, SHOULD offer the first and the last place, and, where it lets the person drag, shows where the item will stand. When an item is let go on another list or at another place, or that move is chosen, the host raises move on the list it lands in with { item, index, order }: item the element of the list it came from, and, when the list it lands in is reorderable, index its place there and order the itemKey of every item of that list in the new order, which the handler keeps with sortBy and indexOf; both are null for a list that is not reorderable. The item is found by its itemKey, so one without a key of its own stays where it is (contracts.md section 8.3). The new warnings prop.moveGroupUnhandled, event.moveWithoutGroup, prop.moveGroupAlone, prop.moveListUnnamed and prop.reorderableUnhandled report a list that names a group without handling move, handles it with neither a group nor reorderable, is alone in its group and not reorderable, has no label to be named by, or is reorderable without handling move (validation.md section 9). Why: a task board moved its cards with two arrow buttons on each, and people expect to drag them; a to-do list, a list of priorities and the cards of one column are kept in an order their owner chooses; a way without dragging keeps both moves open to everyone. No change: a list with neither moveGroup nor reorderable is drawn as before.

Pictures the app carries. A definition MAY carry its pictures in a new top-level member, assets: an object from asset name to an entry with type (PNG, JPEG, WebP or GIF), digest, and optionally data (the bytes as base64 in one canonical form), width, height, source and credit (core.md section 12.5). A remote prop refers to one as asset:logo, which is a third kind of value beside a web address and a reference the host issued (core.md section 6.3): loading it is not egress and needs no grant, and for a view of a part it names the part's own asset. An entry without data is valid, and the digest of a definition leaves data out (core.md section 16), so a host or tool can keep the bytes apart and put them back without changing the definition or anything pinned to its digest. Carried bytes are checked: canonical base64, the digest, the type read from the picture's header, at most 4096 pixels on a side, and width and height where given (validation.md section 9.1). Why: an app could show a picture only from the web, so a header photo asked the person a permission question, showed nothing on a host that loads nothing from the internet, and was lost when its address died. 0.1 definitions need no change.

Sizes every host accepts. core.md section 18.1 names the sizes every host MUST accept: 2,621,440 bytes for a definition without the data of its assets, 64 assets, and 1,048,576 characters of data for one asset and 2,621,440 for all of them. A larger definition is valid, and a validator warns about it. Why: 0.1 named no size, so an author could not know what every host would load. No change.

Where a carried picture was taken. A tool that adds a picture to a definition removes the location its metadata holds (EXIF GPS data and XMP GPS properties) before the digest is taken; a validator warns about a carried picture that still holds one; a host shows pictures as they are (core.md section 12.5). Why: a photo from a phone says where it was taken, and carried in an app that place went to everyone who received the file, unseen. No change.

A place named in words is part of where a picture was taken. Beside coordinates, the location a tool removes and a validator warns about includes the place a photo manager writes as words: the XMP properties photoshop:City, photoshop:State, photoshop:Country, Iptc4xmpCore:Location, Iptc4xmpCore:CountryCode, Iptc4xmpExt:LocationCreated and Iptc4xmpExt:LocationShown, and the IPTC datasets 2:26, 2:27, 2:90, 2:92, 2:95, 2:100 and 2:101; a title, caption, keywords, credit, author and copyright stay (core.md section 12.5). Why: with the coordinates gone, a photo that went through a photo manager still told its city and country. No change to definitions.

The size of a turned picture is the size it shows at. An asset's width and height are the size the picture shows at: for a JPEG or a PNG whose EXIF orientation is 5 to 8, the sides its header gives, swapped. A host shows a JPEG or a PNG turned as its orientation says; a WebP and a GIF show as stored (core.md section 12.5, "Orientation"). Why: a photo taken upright on a phone is stored on its side and every browser shows it upright, so the stored size told a host the wrong shape to keep room for. An entry that gives the stored size of a turned picture is now asset.sizeMismatch: give the two numbers the other way round, or leave both out.

9. Expressions#

These are defined in expressions.md.

  • let(name, value, body) binds a name inside an expression.
  • merge(a, b) and compact(map) combine maps and drop null members, so optional fields need no duplicated literals.
  • list.indexBy(x, key), a list macro in method form, and enumerate(list) build lookups and give positions.
  • formatNumber, formatDate and relativeTime format for people, using env.locale and env.timezone. Their results are for display only and vary between hosts.
  • plural(n, forms) picks the plural form for n in env.locale, for display.
  • atTime(date, "HH:MM", timezone?) and dateIn(datetime, timezone?) convert between local and UTC time.
  • matches(string, pattern) tests a pattern. Patterns here and in a type's pattern use a restricted dialect that matches in linear time; a pattern outside it is type.invalid or expression.syntax. Its meaning is defined by expressions.md alone, so an implementation that uses another engine translates ., \s, \S and \u. This replaces the 0.1 rule that a type's pattern is any ECMAScript regular expression. 0.1 definitions and catalogs whose patterns use backreferences, lookaround or other features outside the dialect must rewrite them.
  • Typical costs are tabulated so authors can judge what fits the budget.
  • Long strings are paid for. A function call costs 1 for every 1,024 code points of each string argument, comparing or ordering two strings costs the same for the shorter of them, and a pattern that is not a string literal costs a fixed 40 to compile. In 0.1 reading a long string cost nothing, so an expression within its budget could still keep a host busy for a long time. 0.1 definitions are affected only where they work on strings of 1,024 code points or more.
  • Macros in method form. x.has(...), x.default(...) and x.let(...) are syntax errors, as x.can(...) and x.canSend(...) are. In 0.1 the first two parsed and always failed when evaluated.
  • t(key, values?) gives the app's own text named key in the language the host shows, with its blanks filled from the map values (section 8.7). A text holds blanks written {name}, with {{ and }} for the braces themselves. An entry may instead be forms chosen by the value of one blank: =N for an exact number, a plural category, an exact text, true or false, and otherwise other. A number is written as formatNumber writes it, and an inserted value is kept in one piece inside text that reads the other way. t is only a global call with a string literal key and an optional map literal, so every use can be found without running the app; anything else is expression.syntax, and a variable or member named t is unaffected. It reads env.language and env.locale, and its result is for display only. Section 12 below describes the table of texts. New in 0.2.
  • can and canSend (section 3 above).

0.1 definitions that use any of these names as local names in list macros are unaffected; a macro variable may shadow anything.

10. Catalogs and contracts#

personal trait. Added to the closed set of traits (section 3 above).

Scopes given by use. A scope MAY carry consent: "use" (the default is asked): the contract's promise that nothing happens under the scope unless a person does it themselves at that moment in the host's interface, or has already handed the app the thing acted on. A capability with the background or egress trait may have no such scope, no event may have one, and an operation under one that is not interactive must have effect: "read" (contract.invalidConsent). In the core catalog files.pick, files.read, files.save, media.camera, media.microphone and share.send are given by use. An interactive operation is carried out in the host's own interface, which says which app is asking, and a host never completes one for the person. A host honours the mark only from a catalog it trusts, the core catalog among them, and treats the scope as asked otherwise (section 4 above). No change.

Paging and aggregates. An operation MAY declare paging: { "cursor", "next", "items" }, where the output is a map type declaring both fields, items is a list and cursor an optional string or string? input (contract.invalidPaging otherwise). core:records list declares it, and core:records gains count and aggregate (grouped count, sum, min, max and avg with a group limit and a truncated flag), both read under records.read. Why: a dashboard over a few thousand records could neither count them nor page through them. No change.

contains ignores letter case. A core:records condition with contains holds when the field contains the value once both are mapped to lower case by the Unicode default case conversion with no locale, with no normalization and no folding of accents (contracts.md section 9): "Refund for a cancelled booking" contains "refund". eq, ne, in and the ordering comparisons stay exact. 0.1 did not say whether case counted. Why: a search by the words a person types that minds capitals misses most of what they look for. 0.1 definitions that relied on a search minding capitals find more records.

Capability behaviour. A new section, contracts.md section 9, settles what the core capabilities left open: http paths are literal and never normalized, redirects are never followed, forbidden headers are refused and listed, and the response body for empty, binary and malformed content is defined; scheduler behaviour for past times, sessions and limits, and a wake belongs to the person on whose behalf it was scheduled, its rules acting for that person in one of their active sessions or, with none, unattended under the scheduler grant, with wake keys per instance (so a per-person wake includes user.person.id in its key) and a part's keys its own, and its scope says plainly that it lets the app run while closed; the current user for notify.send and directory.me is the person of the acting principal; record filter, sort, paging and aggregate semantics; who may read a file reference; an interactive operation is asked of the acting principal's person on an active surface of theirs, and fails with capability.unavailable when there is none. notify.send and notify.sendTo gain viewInput, so a notification can open a particular record. No change.

Catalogs may use other catalogs. A catalog MAY carry uses: { "catalogs": { alias: { "id", "version" } } }, as a definition does. Inside it, a type reference may be alias:TypeName, a requires entry's contract may be alias:contractName, and degradeTo may be alias:contractName, each with a version range. The graph of catalogs using catalogs must be acyclic (uses.catalogCycle). A control named in a used control's degradeTo is itself used, so its requires and pricing count. This is how a vendor contract declares a file input the host resolves and checks: it types the field with the core FileRef. Why: vendor catalogs copied core types such as FileRef and ChartSeries, and a host could not tell a copied file handle from plain data. Replaces the 0.1 catalogId:contractName form in requires. 0.1 catalogs that used that form must declare the other catalog in uses and refer to it by alias; catalogs with copied types should replace them with references.

Type schemas gain minItems, maxItems and uniqueItems. No change.

Known values and the icon vocabulary. A string type in a catalog's types MAY list known, the values every implementation should know (contracts.md section 1). It never refuses a value: a checker warns about a literal value outside the list (value.notKnown) and names the nearest known values by spelling. The core catalog's IconName is such a type, and its list is the icon vocabulary that meta.icon, a main section's icon, the icon control's name and a button's icon take; the vocabulary gains chart, dashboard, list, table, folder, tag, inbox and money, and for drawing apps undo, redo, eraser, line, rectangle, ellipse, text, pointer, hand and fill. A known type is checked wherever a prop's value holds it, such as the icon of each option of a choice. No change needed: a name outside the list is still valid, shows no symbol as before, and is now told.

Digests and sidecars. The digest of a resource that is not JSON, such as a code module or a control implementation, is sha256- and the base64url SHA-256 of its bytes; 0.1 defined digests only for JSON. A signature sidecar is named after the document's file name with .json replaced by .sig.json. Fetching a control's implementation module, or a code module's module.uri, is the host's act at install, checked against its digest, and is not egress. 0.1 sidecars named otherwise must be renamed; digests of JSON documents are unchanged.

The core catalog README is now named by the specification as the reference for core controls, their props and the core capabilities.

Smaller additions to the core controls. core:toggle takes an optional hint, a line of guidance shown with the setting, as core:choice and the other inputs do. The direction of core:stack now says what hosts already did: in a horizontal stack the first child, when it is a text, a heading or a stack, takes the room the others leave, and children that one each repeats are laid out alike. No change.

11. Voice#

The voice surface is now fully described (core.md section 12.3), though still marked as less proven than the others:

  • greeting is spoken when a voice session starts.
  • An intent has examples (required, with {slot} placeholders naming input fields of the action), an optional action (without one the intent only replies), and reply, spoken after success with the state after the action, input, the new root output, env and user in scope.
  • announce maps an app event (an emit name or flow:<name>) to words spoken when it is raised during a voice session.
  • Recognition is the host's job and examples are guidance, with a stated minimum: each example is recognized as written, slots are converted to their field's type, a host asks again when it cannot convert, never runs an action whose required input it could not fill, and says so when nothing fits.
  • When the action fails the host speaks the error's message, not the reply; for a confirm action it asks aloud and proceeds only on a clear yes.
  • A control's surfaces.voice support level is about reading views aloud and is independent of intents.

Why: 0.1 gave one example and a sentence, so replies could not see results, questions needed dummy actions and nothing could be announced. 0.1 definitions need no change, though actions that existed only to answer a question can become intents without action, and replies can read output.

12. An app's texts in several languages#

A localization table. A definition may carry its own texts in several languages in a top-level localization member: default, the language its plain texts are written in; strings, for each language a table from key to entry; and notes for whoever translates later (core.md section 12.6). An entry is a text with blanks written {name}, or forms chosen by the value of one blank. An expression shows an entry with t('key', { name: value }) (section 9 above). The default language is complete; the other languages may be partial, and a text one of them lacks is taken from a wider regional form of the same language and then from the default.

References in fixed places. In the places that hold plain text and never an expression (meta.name, meta.description, a grant request's reason, the descriptions, and the other places core.md section 12.6 lists), a value that is exactly =t('key') shows that key's text. Any other value is the literal text, as before.

The host chooses the language; direction and formats follow. A host shows the app in one of the app's own languages, chosen from the person's languages and from a choice the host keeps for the person. The rules use only five small tables printed in core.md Appendix A, so every host chooses alike (section 12.7). A script is never crossed: a reader of Traditional Chinese is not shown Simplified. The direction of the app, left-to-right or right-to-left, comes from the shown language and from nothing else: a definition cannot set it apart. env.language and env.direction are new, and env.locale is now the locale that formats numbers and dates beside the words shown, the shown language written for the person's region (section 3.5).

Kept grants. A kept grant whose reason is a reference holds while the reason's text, in the language the approver read, is unchanged (section 6, rule 5). Adding a language does not ask again.

Parts. A part has its own table and its own shown language (section 13).

Sizes. Every host accepts 64 languages, 2,000 keys in one language, 2,000 code points in one text and 24 forms in one entry (section 18.1).

An app read from right to left. A host lays out an app in the direction of its shown language and takes that direction from nothing else, never from the page or window around the app; the host's own sheets, dialogs and notices keep the direction of the host's words (contracts.md section 8.2.1). Alignment follows the app, and the order inside one text follows the text: the direction of its language where the host knows it, else the direction of its first strong character. A number, an amount or a date the host formats stays in one piece, and a telephone number, an email address, a web address and a number field read left to right in every app.

What never turns. A chart's plot, a diagram's layout and a canvas are the same in every language: axes, bars and lines keep their places, the boxes and connections of a diagram stand where they stood, and on a canvas x grows to the right and start is the left end of a text (contracts.md section 8.3). The words around them, such as a chart's title, legend and data table, follow the app.

Hidden characters in an app's text. What a host removes from an app's text before showing it depends on where the text goes (contracts.md section 8.2.1). Text shown in an element of its own keeps the joiners U+200C and U+200D, the direction marks and the isolates that are balanced on their line, and loses embeddings and overrides. Text put into a string, an identifier or an address on a sheet of the host, and a value a person approves or reads back keep only the two joiners, so a hidden mark cannot show the groups of a telephone number in another order than the value has.

What a host gives a session, and what a renderer is told. A host gives a session the person's languages, in order of preference, and the choice of language it kept for the person; with no list, the person's languages are the one locale the host gives (contracts.md section 8.2.1). Either may change while the app runs: env.language, env.direction and env.locale then change like any other env field, what reads them or calls t is worked out again, and the app keeps its state, the person's place in it, typed text and open dialogs. A text taken from another table than the shown language's is written with that table's formats and reads in that table's direction. A renderer is told the app's shown language and its direction, the locale the host's own figures are written in, the app's language tags when it carries more than one, the direction of each text whose language is known (a plain literal, or exactly one t call) and of a view's title, and the language and direction of a part that differ from those of the app around it. A fixed text is shown to a person in the language the app is shown to them in; where no person in a session reads it, such as an agent's tool descriptions and the name of the app's own principal, it is in the default language. No change for an app without localization: its env gains language, which is null, and direction, which is ltr.

The person chooses. A host that shows an app with more than one language offers the person, in its own interface around the app, the choice among the app's own languages or to follow their own languages again. It names each language in that language itself and keeps the choice for that app on that device (contracts.md section 8.2.1). The app is not asked: a definition cannot open, close or set that choice.

Validation. A validator checks the table and every use of its keys (validation.md section 9.2). Seven mistakes are errors, because the app would fail or show the wrong thing: a language tag that is not one (localization.tagInvalid, whose message gives the valid spelling), a strings without a table for the default language (localization.defaultMissing), a malformed entry (localization.entryInvalid), a t call or a reference that names a key the default language lacks (localization.keyUnknown, with the nearest keys), a t call whose values are not the blanks of its entry (localization.valuesMismatch), a translation that shows a blank the default entry lacks (localization.blankUnknown), and a reference in a fixed place to an entry that is not a plain text (localization.fixedNeedsPlainText). Ten more are warnings, each given once for a language or once for the document with a count and the first five keys, so an app with hundreds of missing translations gets one line for each language: localization.untranslated, localization.keyNotInDefault, localization.keyUnused, localization.sameAsDefault, localization.scriptUnclear, localization.fixedTextForm, localization.directionUndeclared (an app without localization whose texts mostly begin in a right-to-left script) and the three sizes above. A regional table may stay partial where a table of the same language gives the other texts. The checks that read a literal text, such as the length of a chart's unit or of a done message, Markdown in a plain text and a heading that repeats its view's title, also read each language's text where a value is exactly =t('key'), and name the language. The static type of env gains language (a string or null) and direction (a string). The explanation and the agent manifest show a reference in a fixed place as its text in the default language, and the explanation says which languages the app carries.

Conformance. conformance/0.2/languages/ holds rows for choosing the language, the formatting locale, direction, the tables a text is looked for in, and tags. conformance/0.2/expressions/texts.json holds vectors for t. conformance/0.2/semantic/ holds a valid document that names a key from every kind of place and an invalid document for each of the new codes.

Why: a 0.1 app was written in one language and could not say which, so a host could neither show it to a reader of another language nor know which way it reads. 0.1 definitions need no change: a definition without localization behaves as before, shown left-to-right with env.locale as the host gives it.

13. One file that holds what it includes#

Carried copies. A definition may carry whole copies of the definitions and design systems it refers to in a new top-level member, included (core.md section 4), so that one file opens alone wherever it is handed. In 0.1 a definition held only references, and a file whose parts lay elsewhere did not open alone.

Where a reference is looked up. A reference of uses.definitions or uses.design is looked up first among the carried copies of the file the referring document came in, then where the host looks otherwise. When a copy fits, it is used even where another place holds a higher version that fits, so the same file opens as the same app everywhere. A pinned digest is checked against the chosen copy as against any definition. The copies a file carries serve that file only: a definition found elsewhere does not see them, and a host never adds them to a registry or takes one for the definition of an instance because its id matches (core.md section 13). Nothing else changes: a part whose definition is carried is a part like any other.

Flat, and outside the digest. A carried definition has no included of its own; a tool that writes the carried form lifts the copies of copies to the one list, sets it to exactly what the references reach, in a fixed order, and changes no other member. The digest of a definition leaves out included as it leaves out the data of assets (section 16), so a pin, a signature, a grant and the digests of a history hold for a definition with its copies and without them.

The format's own documents are never carried. An id that begins with org.openappdefinition. belongs to the format: the core catalog and the default design system, which every host provides. A carried copy never has such an id, a reference to one is never looked up among the carried copies, and a tool that writes the carried form leaves such a document out, so a file cannot bring its own default look or hold the look to the default of the day it was written.

Sizes. The size of a definition does not count included. Every host accepts 16 carried definitions and 17 carried design systems, and carried copies that together are within the sizes of one definition (section 18.1).

Validation. Four errors and one warning are new (validation.md section 5): an entry that is not a definition or a design system of 0.2 with an id and a version (included.kind), two entries that are one document (included.duplicate), a carried definition with copies of its own (included.nested), a copy whose id begins with org.openappdefinition. (included.reserved), and a copy nothing resolves to (included.unused). Five warnings give the sizes above (validation.md section 9.1). A carried definition a part resolves to is checked as any included definition is.

Why: one file is the unit an app is handed over in, and a file that names what it includes without holding it does not open for the person it was handed to. 0.1 definitions need no change.

14. Reference tools#

These are not part of the standard, but they help with the move to 0.2. The reference implementation reads 0.2 only. oad upgrade <file> rewrites a 0.1 document to 0.2 where the change is mechanical and lists what needs a decision. oad catalog <file> [contract] prints a readable summary of a catalog or one contract. run, approve and serve-mcp accept --roles and --config alias.field=value. A sample document can give the records a core:records collection starts with, under $records; the reference records provider then answers every read of it, with its filters, sorting, paging, counts and aggregates, and keeps what the app writes. A sample cannot script a failure or an offline host: run takes --without <alias> to leave a capability unbound and --offline to start with no network connection. explain mentions the flow guards an action is subject to, require messages, the schedules of sourced entries and effective sensitivity.

For an app that carries its texts in several languages (section 12 above): run and approve take --language <tag,tag>, the languages of the person in front of the host in order of preference, and look takes the same, the languages of the person it looks as. A page in a browser says the languages of its browser, and the app is shown in the one chosen from them; an agent's session is given none and reads the app's default language. validate prints, for a definition with several languages, how many of the default language's keys each language has a text for. The authoring tools say the same count after every change, name the translations a new default text left behind, show only the default language's table in a whole read unless asked for others, and can look at the app as a reader of given languages. The reference shell draws the person's choice as a Language button beside App info in its bar (its globe alone where the bar is compact) and a Language row in App info, each the browser's own list of Match my device and the app's languages; an app drawn as a card is changed in App info. The frame that shows an app in a chat conversation says the person's languages and time zone to the tools that run the app, so the app is in the person's language there too, and it has one entry for the choice in its own line under the app.

15. Not in 0.2#

These were considered and left out of 0.2. They remain open.

  • Install-time parameters beyond capability config.
  • Per-person visibility of rows in shared state.
  • Sources scoped to a view.
  • An app event for a rejected conflicting write.
  • Grant lifetimes tied to app data, such as "until the trip".
  • Timers whose duration is an expression.
  • send with a computed event name.
  • Listing the holders of an app role.
  • A cell template per table column.
  • More required color tokens.
  • Contracts that extend a contract, generic record types, and asking for provider traits (such as offline queueing).
  • Event payloads for agents.
  • Not asking for a grant that only a control's fallback would have needed.
  • Sharing a live instance as a part.
  • A start time for every.
  • Currency conversion.
  • Which of an app's capabilities a control's requires is wired to, and whose rate its calls use.
  • How a signature's keyId leads to a key.
  • The words of a host itself in other languages: its hints, its sheets and its messages.
  • Carrying catalogs in included, fetching a definition from the address of a source hint, and one picture shared by an app and its carried copies.