Vision  ·  For builders Contour, Valence, Foundry Private release
For builders

Contour, Valence, Foundry

Three instruments for building inside Vision

Abstract

Vision is FMVision’s own browser: the browser and launcher for the studio’s sites, worlds and workspaces. We describe three instruments for building inside it. Contour is a lightweight interface framework of HTML templates, explicit state and targeted DOM updates. Valence is for backend services that declare their capabilities. Foundry builds a Vision app from a brief. The three share one principle. The figures that follow are live, so that the reader may put it to the test.

Say what you mean, and let the machine do only that.

1The principle

FMVision ships meaning, not results. A world in Vision is not a recording of a world. It is the source of one: a few hundred kilobytes of text, from which the device grows everything else. There are no dependencies, no build step and no shipped assets.11A whole ocean world, Shark Reef, goes live about 100 ms after about 108 KB. The numbers are in §6.

The same rule can be applied to the building of apps. An app has three things to say: what it shows, what it is permitted to do, and what it is for. If each is stated plainly, the machine is left with nothing to guess, and nothing is shipped that was not meant.

The three instruments take one statement each. Contour takes the view: a template, and the state it depends on. Valence takes the permissions: a service declares its capabilities. Foundry takes the purpose: a brief, in sentences. Fig. 1 shows the path from the brief to a running workspace.

Block diagram: a brief passes to Foundry, which builds an app made of a Contour view and Valence services; the app runs in a workspace in Vision, where a per-workspace check is applied. BRIEF sentences what it is for FOUNDRY builds the app APP CONTOUR VIEW template, explicit state VALENCE SERVICES declared capabilities WORKSPACE in Vision CHECK per workspace MESSAGE SIGNAL Block diagram: a brief passes to Foundry, which builds an app made of a Contour view and Valence services; the app runs in a workspace in Vision, where a per-workspace check is applied. BRIEF sentences MESSAGE FOUNDRY builds the app APP CONTOUR VIEW template, state VALENCE SERVICES declared capabilities SIGNAL WORKSPACE in Vision CHECK per workspace
Fig. 1Schematic of building inside Vision, after the classic diagram of a communication system. The brief is the message. The path it travels is marked. The check enters at the workspace and nowhere else.

The remaining sections take the boxes in turn. In each we prefer a working demonstration to a description, since a demonstration cannot say more than it does.

2Contour

Contour is a lightweight interface framework. It has three parts, and all three are in plain sight: an HTML template, a state that is stated outright, and updates that go to the nodes which depend on what changed and to no others.

The idea is easiest to judge while it runs. Fig. 2 is a small tab strip of the kind Vision has, in which every tab carries a human name and a tab can be parked.22In Vision, Park frees a tab’s memory and restores the tab on selection. In the figure, parking only sets a flag; there is no memory to free. It is built on this page from one template and one state object. Select a tab, or park one. The state is printed beside the view as it changes, and every node of the document that the update wrote to is outlined.

State, printed as it stands

      
nodes touched: 0 of 0 last: none update:
Fig. 2A live miniature. Select a tab or park one; selecting a parked tab restores it. Outlined: the nodes actually written by the last update, as counted by the browser’s own observer. This is the page’s own miniature of the idea, not Contour.

The miniature is about fifty lines of plain JavaScript written for this page, and the instruments around it take somewhat more. It is not Contour, and its code is not Contour’s. The count beneath it is not taken on the miniature’s word, either: a separate observer watches the view and reports what was in fact written.33The outlines are drawn on a layer outside the observed view, so that marking a node does not count as touching it.

For comparison, the figure can be switched to rebuild its whole view on every change, which is the simplest way to be correct. What appears on screen is identical. The count is not, and a reader using the keyboard will find that the rebuilt view has dropped the focus as well.


    

Listing 1The update routine of Fig. 2, printed from the running page. Line 4 is the whole idea: a value that has not changed leaves its node alone.

Nothing here is clever. The template says where state appears, the state says what is true, and the update compares and writes. What is not said is not done.

3Valence

Valence is for the other half of an app: the backend services it relies on. A Valence service declares its capabilities. What it may do is written down beside what it does, where a person or a machine can read it before anything runs.

A declaration is what makes a check possible. Vision checks navigation and native capabilities per workspace, not once for the whole browser.44A workspace also loads only what it needs. See Table 1. The rule of such a check is as plain as a rule can be:

granted = asked ∧ declared (1)

Fig. 3 lets the reader try Eq. (1). One column holds a declaration; the next, what a workspace asks for. Both can be changed. A request for something undeclared is refused, and the refusal is the only event of interest in the table.

Service: reading-list recordsAn illustrative sketch, not the API
CapabilityKindDeclaredAskedResult
asked 0granted 0refused 0
Fig. 3A declaration and a check, live. Tick or clear either column; each row is decided by Eq. (1) alone. The service and the wording of its capabilities are ours, made for this figure.

We stress the label on the figure. The real interfaces are not public, and none is shown here. What the figure does show truly is the shape of the arrangement: the permissions are a short text, the check is one line, and a capability nobody declared cannot be had by asking.

4Foundry

Foundry builds a Vision app from a brief. The brief is prose: a few sentences on what the app is for. Fig. 4 sets a brief beside the shape of what comes out, which is a workspace with a human name in its tab, a view, and the services it declares.

The brief
A reading list for the studio.a Each entry has a title, a note and a state: unread, reading or done.b I want to add an entry, change its state, and export the list as a file.c It needs nothing from the network.d
What comes out, in outline
Fig. 4A brief, and the outline of what it becomes. Letters tie each part of the result to the sentence that asked for it. A drawing of the idea: the brief is our example, and no procedure is implied.

We show the two ends and not the middle. Fig. 4 documents no procedure, and we give no commands and no timings here. What it is meant to convey is correspondence: each part of the result can be traced to a sentence of the brief, and what the brief did not ask for does not appear. The last sentence of the brief asks for nothing from the network, and the last line of the declaration is empty.

5Where it runs

An app built this way runs as a workspace in Vision. Vision is a Rust and Tauri host on the system WebKit of macOS, with WebGL for worlds written by hand in GLSL. An iPad build and a Windows preview exist. Table 1 collects what a workspace can rely on.

Table 1What a workspace can rely on

MatterWhat Vision does
LoadingA workspace loads only what it needs.
ChecksNavigation and native capabilities are checked per workspace.
TabsEvery app has a human name in the tab strip. ⌘L reveals the address.
ParkParking a tab frees its memory. Selecting it restores it.
TelemetryFirst-party only: load times and frame pacing. Never URLs, history, page contents, form values or credentials.
AdvertisingNo ad networks. No tracking scripts.
HostRust and Tauri on the system WebKit of macOS. An iPad build and a Windows preview exist.

The launcher is Vision’s opening page and its New Tab. It keeps a Developer Tools section, whose shelf is given in Table 2. We name every entry and describe only those we can speak for here.

Table 2The Developer Tools shelf of the launcher

  1. 1Contourinterface framework, §2
  2. 2Temper
  3. 3Refactory
  4. 4Manifest
  5. 5Valencedeclared services, §3
  6. 6Porter
  7. 7Weave
  8. 8Relay
  9. 9Disk Atlasstorage map

6Measure

A principle should be weighed. The numbers we have come from worlds, not from apps, and we give no others.55We have no measurements of Contour, Valence or Foundry to report, and so we report none. Shark Reef, a whole ocean world, goes live about 100 ms after about 108 KB. The compiled ocean it replaced took 12 s and 120 MB. Silfra, a whole world of rift, walls, boulders, water and light, is about 360 KB of source.

Table 3 sets these down and Fig. 5 draws them to scale. The last row is this page, which weighs itself when it opens.

Table 3Weights and times

ObjectShipped asWeightUntil live
Shark Reefsource≈ 108 KB≈ 100 ms
The ocean it replacedcompiled120 MB12 s
Silfrasource≈ 360 KB·
This pagesource, one file··

A dot marks a quantity we have not measured. The weight of this page is computed in the reader’s browser on opening.

(a) Weight, to scalefull width = 120 MB
The ocean it replaced120 MB
Shark Reef≈ 108 KB
Silfra≈ 360 KB
This page·
(b) Time until live, to scalefull width = 12 s
The ocean it replaced12 s
Shark Reef≈ 100 ms
(c) Weight, magnified 240 timesfull width = 500 KB
The ocean it replaced240 widths
Shark Reef≈ 108 KB
Silfra≈ 360 KB
This page·
0100200300400500 KB
Fig. 5The entries of Table 3, drawn to scale. In (a) the true length of the mark for Shark Reef is less than a pixel; it is drawn as the smallest mark that can be seen. In (c) the scale is magnified until the sources can be read; at that scale the compiled ocean would run for 240 widths of the figure.

We draw one conclusion and no more. Where the thing shipped is a statement of what is meant, it is small, and the smallness is not an economy made afterwards. It is what is left when nothing else was said.

Vision is in private release.

Contour, Valence and Foundry are inside it. If you build things, and would rather say what you mean, we would like to hear from you.

Request an invitation Private release. Coming to Mac.