ankka-surface¶
A surface is the representation of what a person last asked for: a shape, the thing it is about, a few modifiers, an act begun and not committed, the last few requests, and the devices showing it. It is held on the server as an ankka event sourced entity, so every device a person has renders the same thing, any of them can change it, and moving from a laptop to a phone to a television is opening the app there.
Why the server holds it¶
An interface that does not navigate, where one region takes whatever shape answers the last request, needs one place that says what that shape is now. When that place is a device, a television steered from a phone and a hand-off from one device to another both need a third party to carry the state between them. The server is already that third party, so the surface lives there and every device is a renderer of it and, if it wants, a steerer of it.
Two halves, one contract¶
| Half | Package | What it holds |
|---|---|---|
surface/ |
com.thinkmorestupidless:ankka-surface_3, Scala |
the entity, a view of its rows, the endpoint that serves and streams them, the interpreter seam, and the vocabulary a consumer declares |
device/ |
ankka-surface on npm, TypeScript |
the model a renderer reads and the calls a steering device makes; no framework and no runtime dependency |
The two halves speak one HTTP API. A renderer written in any other language reads the same JSON.
Nothing in either half names a product, a shape, an anchor kind or a modifier key. Those words are the consumer's, declared as a vocabulary, and the surface refuses a move that uses a word the vocabulary lacks.
The shape, in five lines¶
- A consumer declares a vocabulary and registers four components in its own ankka service: the surface entity, its rows, and optionally the focus entity and its rows.
- A device moves the surface: one change with as many parts as it names, applied together, which raises the surface's version by one.
- A device says words; the consumer's interpreter turns them into a move, or into a reason it could not. An act it hears becomes pending, and committing it is the consumer's own route.
- Every device streams the surface over server-sent events and takes a row only at a higher version than the one it holds.
- Focus, where the attention is now, is kept beside the surface as its latest value only, so a device in a room can follow a thumb on a phone.
An example¶
Every page uses one vocabulary: the shapes home, shelf and item, the anchor kinds theme and
market, the modifier key time, the pending kind forecast, and the focus keys card and
outcome. The owner is ada.
open ada's surface home version 1
move "anything about Newcastle this weekend"
shelf · theme:newcastle · time=this weekend version 2
say "make me a sandwich" not understood; nothing changes version 2
move pending forecast outcome=Yes, estimate=70 shown on every device
show kitchen-tv, in a room the television renders it too, hiding what is personal
Your first surface does each of these with curl.
Where to start¶
- Trying it. Your first surface registers a surface in a service and drives it over HTTP.
- Understanding it. How ankka-surface works is the overview; The surface and its moves is the model everything else follows; The surface never acts, Devices and Focus complete it.
- Building the server half. Declare a vocabulary, Write an interpreter and Serve surfaces.
- Building a device. Render and steer on a device, Hear before you say and Follow the focus.
- Looking something up. The HTTP API, the device package, the Scala API and the glossary.
- Checking what is missing. Limitations.
For models and agents¶
This documentation is published in forms a model can read directly. llms.txt at the site root lists
every page with a one-sentence description, llms-full.txt holds every page in one file, and each page
is also served as Markdown at its own path with a .md suffix. The same pages are rendered as an agent
skill, ankka-surface, in
the repository.