Have an agent show a scene

An agent reads the catalog, says a scene with scenes.show, and reads back what the person did with it. It never writes markup, and it cannot make the screen do anything a scene cannot say.

The loop

  1. dynamic-ui.catalog answers everything a scene can say. Read it first.
  2. dynamic-ui.scene.from makes a scene from what an engine or a graph answered: the agent runs the engine with its own tools and hands the answer over.
  3. dynamic-ui.scene.check reads a scene and keeps nothing: it answers that it reads, or the code and where.
  4. dynamic-ui.scenes.show keeps the scene and shows it.
  5. dynamic-ui.scenes.get answers the scene as it stands and the acts done to it, with who did each.

When a person answers a figure on the stage, everything made from it waits, drawn faint. The agent reads the answer among the acts, runs the engine again and says the scene under the same id; the stage moves from one to the other.

Say a scene

The whole input of dynamic-ui.scenes.show. Sending the same requestKey again with the same input changes nothing.

scenes.show
{
  "scene": {
    "schemaVersion": "hopper.dynamic-ui.scene.v1",
    "id": "example.first-scene",
    "say": "A studio, the person who runs it, and one thing they made.",
    "form": {
      "kind": "ring"
    },
    "things": [
      {
        "id": "person:ada",
        "kind": "person",
        "label": "Ada Example",
        "sub": "Runs the studio",
        "facts": [
          {
            "label": "Since",
            "value": "2021"
          }
        ]
      },
      {
        "id": "org:studio",
        "kind": "organization",
        "label": "Example Studio",
        "facts": [
          {
            "label": "Makes",
            "value": "Short films"
          }
        ]
      },
      {
        "id": "work:first-film",
        "kind": "work",
        "of": "person:ada",
        "label": "The first film",
        "sub": "Four minutes",
        "at": "2026-03-01T00:00:00.000Z"
      }
    ],
    "ties": [
      {
        "from": "person:ada",
        "to": "org:studio",
        "kind": "runs",
        "label": "runs"
      }
    ]
  },
  "by": "agent",
  "requestKey": "first-scene-0001"
}

Act on it

An agent can do what a person can: open, close, play, stop, change the form, answer. The act is kept beside the person’s own.

scenes.act
{
  "id": "example.first-scene",
  "act": {
    "act": "open",
    "id": "person:ada"
  },
  "by": "agent",
  "requestKey": "first-scene-0002"
}

What an agent may change

An agent’s key reads everything. It changes something only where the person granted it. The app’s own entry for agents grants these 5 unless the person says otherwise:

  • dynamic-ui.scenes.show
  • dynamic-ui.scenes.act
  • dynamic-ui.scenes.choose
  • dynamic-ui.sources.read
  • dynamic-ui.shapes.keep

Removing a scene is the person’s and is never granted to an agent.

Every operation

The app has 30 operations: 20 reads and 10 changes.

dynamic-ui.status
How Dynamic UI stands, in one sentence: which scene is showing and who said it, how many scenes and views are kept, and which apps on this computer can say a scene now.
dynamic-ui.catalog
What a scene can say, for whoever composes one: the kinds of thing and how each is drawn, the forms, the fields that matter and what each does on the screen, the acts, the players a thing can play in, the shapes a model can have, what a scene can be made from, the limits, and every refusal with what it means. Read this before writing a scene.
dynamic-ui.scene.check
Check a scene without showing it: whether the stage would take it, or the refusal (a code and where). Nothing is kept and nothing is repaired.
dynamic-ui.scene.from
Make a scene from what an engine or a graph already answered, without showing it: a FactGraph run with its explanation (from: run: what was given, what each rule worked out, the receipt), a Graph Computer program and a run of it (from: program: each step and how it stands, the run's verification), or a graph release or Graph Query answer (from: graph: things and ties, each carrying where it is held). The engine is not asked here: whoever calls ran it and hands over its answer. Nothing is kept; show the scene with scenes.show.
dynamic-ui.showing
The scene on the stage now, as it stands after everything done to it, with who said it and the last acts done to it (newest first). Null when nothing is showing.
dynamic-ui.scenes.list
The scenes kept, newest first: each by its id, with who said it last, how many things and ties it has and how it stands, and which one is showing.
dynamic-ui.scenes.get
One kept scene, whole, as it stands now, with the last acts done to it.
dynamic-ui.scenes.show
Say a scene and put it on the stage. It is kept under its own id: said again with the same id, the stage moves from how it stood to how it now stands (things with the same ids travel). A scene the stage would not take is refused with its code and nothing changes. by is who says it (an agent's name, an app).
dynamic-ui.scenes.act
Do one act to a kept scene, as a person pressing would: open a thing, close, play, stop, or stand the things in another form. The scene kept is the scene after the act, so whoever reads it next sees what is open. An act that cannot be done changes nothing and says so.
dynamic-ui.scenes.choose
Put a kept scene on the stage, or with no id take the stage down.
dynamic-ui.scenes.remove
Stop keeping a scene. If it was showing, nothing is showing.
dynamic-ui.shapes.keep
Keep a shape a model can name: a gzipped hopper.dynamic-ui.mesh.v1 in base64. It is kept under the sha256 of its bytes, which is what a thing's shape.digest says, so keeping the same shape twice keeps one. Bytes that are not a mesh are refused and nothing is kept.
dynamic-ui.shapes.get
One kept shape by its digest: its bytes in base64, as the stage asks for them when a model is drawn.
dynamic-ui.shapes.list
The shapes kept, each by its digest with its size and how many triangles it has. Nothing here says which scenes name it.
dynamic-ui.parts.list
The library of parts a view is made of, as a short list: each part's name (set.name), what it is for in a sentence, and the words it is chosen by. Read this to choose; then ask for the parts chosen by name with dynamic-ui.parts.get. The sets: stage (a scene on the stage), draw (a drawing walked through a step at a time), plain (words, facts, a table, actions, a form), kit (the Design Library kit's blocks: tables, charts, boards, chat, trees and the rest).
dynamic-ui.parts.get
Up to twelve parts in full, by name: what fills each (with, as a JSON schema), one filled in as an example where the part has one, and what it sends back when a person does something on it. A name the library does not have is listed under unknown.
dynamic-ui.parts.find
The parts a request most likely wants, by its words alone: each part is scored by the words of the request found in its name, the words it is chosen by and its sentence. No model is asked. Use it to narrow the library to a few before reading them in full.
dynamic-ui.view.brief
Everything a model needs to write a view, as one text: the view's contract in a few lines, the library as a line a part, and up to twelve parts in full. Name the parts (names), or give the request in words (ask) and the parts its words fit best are the ones given in full. Hand the text and the request to any model, check what it writes with dynamic-ui.view.check, and give it back the issues until it reads.
dynamic-ui.view.check
Check a view without showing it: whether the page would take it, or the refusal. VIEW_UNREADABLE is the screen itself said wrongly, PART_UNKNOWN names a part the library does not have, PART_UNREADABLE is a part filled in wrongly, each with where. Nothing is kept and nothing is repaired.
dynamic-ui.view.suggest
Make a view for some plain data by asking the library which of its parts the data is: rows of records are a table, one record is facts, names with one figure each are bars, a scene is the stage, and data that holds several things under names gets a part for each. Nothing is shown or kept. chose says which part was taken for what and what else fitted, so the view can be changed before it is shown. Null when no part fits.
dynamic-ui.views.list
The views kept, newest first: each by its id, with its name, who said it last and the parts it is made of.
dynamic-ui.views.get
One kept view, whole, as it stands after everything done on it, with the last things done on it (newest first). What a person pressed, sent or moved to is read here: a row pressed, a form sent with what was filled in, a step moved to.
dynamic-ui.views.show
Say a view and keep it under its own id: a whole screen as data, made of parts from the library. Said again with the same id, the screen changes from how it stood to how it now stands. A view the page would not take is refused with its code and nothing changes. by is who says it (an agent's name, an app).
dynamic-ui.views.act
Do one thing on a kept view, as a person would: go to one of its places, dismiss what stands over it, or do something on a part (did is that part's own: { row } on a table, { press } on actions, { send } on a form, { step } on a drawing, a scene act on the stage). It is kept as done whether or not it changes the view, since a press is an answer to whoever said the view.
dynamic-ui.views.change
Change a kept view without saying it again, in up to forty small changes applied in order: { part, with } fills a part anew; { part, set: { field: value } } sets a few fields of what it holds; { part, to, add: [...] } adds items to a list it holds (a chat's said, a table's rows); { put: <part>, before? } adds or replaces a part; { drop: id } takes one away; { head: { title?, meta?, place? } }; { over: <layer> | null }; { toast: { id, says } }. The result is read whole against the contract: when any change does not read, nothing is changed and the answer says which change and where (ok: false, a code and issues).
dynamic-ui.views.done
What has been done on a kept view, newest first, without the view itself: the cheap read for whoever waits on a person. after (a time as this operation gave it) leaves out what was already read. revision says whether the view has changed.
dynamic-ui.views.remove
Stop keeping a view.
dynamic-ui.sources.list
The apps on this computer that can say what they hold as a scene, and whether each is running now.
dynamic-ui.sources.read
Ask an app running on this computer for its scene, over its own door, and put it on the stage. open asks it for one thing open, by that thing's id in the scene, so what belongs to it comes with it; what was playing keeps playing. Refused when the app is not running or what it answers is not a scene.
dynamic-ui.graph.records
The app's public records as its graph would project them: each scene kept (its id, who said it, how many things and ties, when) and the apps scenes are read from. Nothing a scene holds is in it.