blobhub workflow deploy as a definition of the widget category,
beside workflow, playground and listener definitions. A widget versions with its revision and travels with a branch, as
the revision’s workflows do. Mission Control, the screen of the Missions app, is one:
the custom widget mission-control, which the app deploys with its workflows.
A custom widget is code from a blob, running in the browser of whoever opens the playground. It runs walled off, in a
frame on an origin of its own, and is handed no credential of any kind. It reaches its playground only through a bridge
the page holds, and through it reads and changes nothing outside its own playground’s revision and selected session,
with two exceptions: it may read a person’s display name and avatar (people.get), and it may start a workflow defined
elsewhere, one it lists and the viewer can run, which runs in the selected session. It can do no more than it declares
and no more than the viewer may. Whoever installs it confirms what it declares, including what it does outside the
page, such as copying to the clipboard or opening a link, and the playground’s details pane shows it (Trust at
install). The Security Model states each
rule the platform enforces and the risks that remain.
On a playground
The playground’s library pane lists the revision’s widgets beside the built-in ones, under each widget’sgroup
(default Custom). A widget whose group is a built-in group’s name, such as Data, is listed in that group, after
its built-in widgets, and any other group comes after the built-in groups. A widget created and never uploaded is listed
with its alias as its name and marked Install incomplete. Listing and placing a widget downloads none of its code: the
pane reads the revision’s widget rows (see What is stored). A placed widget is an ordinary component
of the playground definition whose type is the widget
definition’s alias alone: the widget order-board is placed as order-board. Every built-in type holds a dot, as
widget.thread does, and an alias cannot hold one: it matches ^[a-z0-9_-]{6,42}$. A type without a dot is therefore
this blob’s own widget, a widget definition in the playground’s own revision. A form for placing a widget shared from
another blob may come later.
The host draws the widget’s header itself: its name, its alias chip, its actions as icon buttons, its type and, for a
viewer who can edit the revision, Remove. The widget may set the alias chip’s text and the actions with
ui.header; the type is the alias the widget is
deployed under, which the widget cannot change. When the header runs out of room, the alias chip gives way first, then
the name, and the type last, so the widget’s own text never pushes out its type; the actions and Remove never shrink,
and the details pane’s Type always shows the type in full. Below the header is a frame on an origin of the widget’s own,
https://<label>.widgets.playground.blobhub.io/, where <label> is derived from the blob and the widget’s alias: one
origin per widget of every blob, the same for every revision and every viewer. With no session selected, the frame stays
live and the widget draws what it likes, a session picker of its own included when it declares sessions: select (see
When the session changes). A click on
the header selects the widget, since a click inside its frame never reaches the page. A press on one of its
actions, with a click, Enter or Space, only pushes ui.action to the widget and does not select it; Space also
presses it on a free-form layout’s
canvas. Its ports are edited in the details pane like any built-in widget’s, and the pane’s Permissions
section shows, read-only, the line each of its permissions is shown as (Permissions), the same
lines as an open row of the Widgets tab.
Everything a widget shows or changes travels over the bridge, a MessagePort the frame’s bootstrap relays to the host:
the widget’s requests, the host’s replies, and the events the host pushes. The host makes every API call itself, inside
the page, with the viewer’s own login, and hands back data only: nothing the frame receives is a token, key, cookie or
API address. Every call is pinned by the host to the playground’s revision and its selected session at the moment of the
call, and the host takes neither from what the widget sends. The Bridge
Protocol lists every call, event and refusal.
A form does not submit inside a widget: the frame’s sandbox attribute lacks allow-forms, so the browser stops a
submission before its submit event fires. A <form>’s submit handler (React’s onSubmit included) never runs, and a
submit button does nothing beyond its own click handler. Send on the click of a type="button" button, and on Enter
in a single-line field with a keydown handler.
The frame says why.
A component naming an alias the revision does not hold shows This revision has no widget named <alias>., never an
empty cell. Any other type the playground has no widget for, such as a retired built-in’s, shows
This playground has no widget of type <type>., and a component with no type, or a type of "", shows
This widget has no type. In each case a save keeps the component as stored, its type included.
widget.yaml
A widget’s project carries a widget.yaml (JSON works too) that describes the widget. It holds exactly these keys; any
other key is refused:
The CLI writes the rest of the definition itself:
type, version, bridge, files and content_hash
(see The definition). An Order Board, which shows the orders in the selected session and approves
one at a click:
iconnames the widget’s icon: a react-icons export name as react-icons 5.3.0 spells it, such asLuLineChartorGoGraph. The playground’s library pane draws it beside the widget. The server and the CLI check only its shape, a capital letter, then 1 to 63 ASCII letters or digits, never whether the icon exists. A widget without anicon, or with a name the page cannot find, such asLuChartLine, which react-icons 5.3.0 does not have, draws the default icon,LuPuzzle, and nothing is refused. The CLI refuses aniconkey with no value; leave it out instead.portsuse the built-in widgets’ port shape,{category, route, value: {type, ...}}, and their value types (component_alias,workflow_alias,choice,integer,text,messageand the rest), so the details pane edits them with the editors it already has. Hereordersnames the component whose output the board shows. Width and height are ports the widget declares itself, as every built-in does; these two takewidget.html’s default and range.permissionslets the board read the selected session’s objects, list the revision’s sessions, and startapprove-order, a workflow of its own revision, when the viewer clicks its button.librariesloads React and react-dom from the platform’s library catalog at exactly these versions; anything else the widget imports must be bundled into its own files.
The definition
blobhub workflow build packs widget.yaml and the build directory into one JSON document and writes it to the
manifest entry’s source. That document is the widget definition blobhub workflow deploy uploads. For the Order
Board, with the code shortened:
type,versionandbridgeare fixed;bridgeis the major version of the bridge protocol the widget was built for.filesis the build output, each relative path mapped to{type, text}for a text file or{type, base64}for a binary one.entrynames the ES module the frame imports. The build stands alone: one module with its own dynamic imports inlined, plus stylesheets with their assets inlined, since the frame loads the files fromblob:URLs, which cannot resolve a relative import.content_hashidentifies the build: the CLI computes it, the server recomputes it, and the viewer’s page caches the code by it.
The rules
The server checks a widget definition when it is uploaded, in this order, and the first failure is the answer. Each rule refuses with400 invalid_widget unless it names another code:
- Keys:
type,version,label,bridge,entry,filesandcontent_hashare required;description,group,icon,ports,permissionsandlibrariesare optional; any other key is refused. type,version,bridge:"widget_definition","1.0.0", and the integer1(not a boolean, not1.0).label,group: strings of 1 to 64 characters.description: a string of at most 500 characters.icon: a string matching[A-Z][A-Za-z0-9]{1,63}in full, ASCII only.ports: a list; each an object with a stringcategory, a stringroute, and avalueobject whosetypeis a string; routes unique; other port keys allowed. The category and value-type vocabularies are not checked.permissions: an object with only the keys and values of Permissions:objects,graphandfileswithreadorwrite;threadswithreadorpost;sessionswithreadorselect;clipboardwithwrite;notificationswithshow;executions, a list, each entry a workflow reference of one of its three shapes; andlinks, either exactly["*"]or a list of at most 16 hosts, none repeated and none"*". Each host is at most 253 characters,*.included, and matches in full, ASCII only,(\*\.)?([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]([a-z0-9-]{0,61}[a-z0-9])?: two or more lowercase labels, the last starting with a letter, and*.only as the whole first label.libraries: an object of non-empty names to versions matching[0-9]+\.[0-9]+\.[0-9]+in full. The server checks only the shape;deployanddiffcheck the names and versions against the library catalog, andbuilddoes against a catalog given with--library-catalog.files: a non-empty object. Each path matches[A-Za-z0-9._-]+(/[A-Za-z0-9._-]+)*in full and has no..segment. Each value is{type, text}or{type, base64}: exactly one oftextandbase64, no other key,typea non-empty string,texta string,base64a string that decodes as standard base64.entry: a key offileswhosetypeistext/javascript.- Size: the canonical form of the whole document,
content_hashincluded, is at mostworkflow.widget_definition_bytes; refused with400 widget_definition_too_largeand alimitobject. - Hash:
content_hashequals the hash computed below; refused with400 widget_hash_mismatch. - Listing row: the canonical form of the widget’s listing row (see What is stored) is at most 262,144 bytes (256 KiB).
permissions.objects, files["a/b.js"].base64 or
ports[2].route, and nothing is stored. invalid_widget means the document needs fixing; widget_hash_mismatch
means it needs rebuilding, since only blobhub workflow build recomputes the hash. blobhub workflow deploy checks the
same rules before it uploads anything, and is stricter, never looser: for example, it refuses .. anywhere in a path.
The canonical form and the hash
The canonical form of a document isjson.dumps(doc, sort_keys=True, separators=(",", ":"), ensure_ascii=False)
encoded as UTF-8. content_hash is "sha256:" followed by the lowercase hex SHA-256 of the canonical form of the
document without content_hash. The byte size checked against the limit is the length of the canonical form of the
whole document, content_hash included. In Python, for a document doc:
What is stored
The revision keeps the uploaded document’s canonical form byte for byte, with no defaults filled, so the stored document hashes to its owncontent_hash. Download Definition
returns it as definition_object.
List Definitions with category: widget serves each widget’s
listing row: the document without files, with its defaults filled. The row holds label, description and icon
(each only when the document has one), group (default Custom), ports (default []), permissions (default {}),
libraries (default {}), bridge, entry, content_hash, and byte_size, the length of the document’s canonical
form. It is everything the library pane and the details pane need; no listing carries files. Each upload replaces the
row’s copy of the document, so an upload without description or icon removes it from the row.
Create Definition writes a stub,
{"type": "widget_definition", "version": "1.0.0"}, which is not yet a widget. A widget row without content_hash was
created and never uploaded: it is not deployed, and a placed widget naming it shows
Install incomplete: the widget <alias> was never uploaded. When the revision’s widget rows cannot be listed, every
custom widget on the playground shows This widget could not be loaded., as does a widget whose stored document
cannot be downloaded.
A widget’s row also carries created_at and updated_at, both ISO 8601 times. Create Definition writes the same time
to both. Each accepted upload sets updated_at to its own time and leaves created_at, so updated_at moves with
every deploy that uploads the widget. blobhub workflow deploy uploads a widget only when its hash differs from the
stored one, so a deploy that leaves the widget unchanged leaves its updated_at too. A refused upload writes nothing,
and a rename (Update Definition) leaves updated_at as it was.
Permissions
permissions is a widget’s whole reach. A key left out grants nothing, and so does a definition with no
permissions.
Shown as is the line the permission draws, word for word, wherever a widget’s permissions are shown: the output of
blobhub workflow deploy and push, the playground’s
details pane, and an open row of the Widgets tab. A widget that declares no permissions reads
This widget asks for no permissions.
write implies read, post implies read, and select implies read. hello, session.get, session.follow,
people.get and ui.header need no permission, and neither does ui.open to a named route, debugger or profile,
since the host builds that link itself. Each call is described under
Calls.
Each executions entry is a workflow reference in
one of its three shapes: {definition}, a definition in the playground’s own revision; {blob, revision, definition};
or {org, blob, revision, definition}. A widget starts only the workflows this list names, and only an entry that is a
well-formed workflow reference counts: BlobHub neither starts nor shows any other entry of a stored document. A
workflow_alias port adds none: a workflow one of the widget’s ports names starts only when the list names it too.
links is either ["*"] alone, which allows any https host, or a list of hosts, such as docs.example.com. *. may
stand only as a host’s whole first label, as in *.example.com; quote such a host, and "*", in widget.yaml, since a
bare * starts a YAML alias. Rule 5 of The rules gives a host’s exact form. ui.open takes only an
https URL with no user or password that reads the same with and without a base, so https:a.com/x is refused with
invalid_params, and it opens exactly the URL it checked. A URL whose host links does not name is refused with
forbidden and {permission: ["links"]}. Matching reads the host alone, so any port passes, and since no entry is an
IP address, a URL whose host is one opens only under ["*"]. The Bridge
Protocol gives the details.
forbidden a call whose permission the widget did not declare, and a write by a
viewer who cannot write in the session. A write’s refusal carries the selected session’s status in its data
(Refusals), which tells a reader apart from a session
that closed under the call. The API, called with the viewer’s own login, enforces the viewer’s rights, and a
call it refuses answers api_error, whose data carries the API’s status, and its error code and reasons when
the API names them (see Refusals). So a reader’s
widget can only read, whatever it declared.
The bridge has no call that reads or changes anything in other blobs, other revisions or other organizations, account or
organization settings, definitions, listeners, schedules, or a session’s lifecycle (creating, closing or deleting one),
so these are out of a widget’s reach by construction rather than by policy. Two calls are the exception:
executions.start may start a workflow the widget lists under executions, defined in another blob or organization,
which starts only if the viewer can run it and runs in the selected session; and people.get answers a person’s
display name and avatar, and nothing more of them.
Nor is there a permission for the network. The frame’s headers allow connections only to its own origin, so data reaches
a widget only through the bridge; a browser still leaves two ways out that no header closes, a frame navigating itself
and WebRTC, which the Security Model names.
Trust at install
What a widget may do is settled before it runs: declared in itswidget.yaml, confirmed by whoever installs it, and
shown to every viewer on the playground and in the blob’s Widgets tab.
- Declared.
widget.yaml’spermissionsnames everything the widget may do, including what reaches past the frame: copying to the clipboard, showing a notification and opening a link to an outside address (Permissions). The host refuses a call whose permission the widget did not declare withforbidden, and itsdatanames thepermissionthe call needs. - Confirmed at install. When a widget’s granted permissions differ from the deployed definition’s,
blobhub workflow deployandblobhub workflow pushprint its lines and refuse before any write withWIDGET_NOT_CONFIRMED, naming--yes; with--yesthey print the same lines and install it. They compare grants, not text, so a removed permission counts, and a new widget asking for none is not listed. Neither waits on input, so a terminal and a script behave the same. Installing takes the right to edit the revision, so the confirmation is the installer’s. A direct call to Upload Definition Content installs a widget without it, and--yespassed by a script installs one without anyone reading the lines; the Security Model names this. - Shown. Every viewer sees the same lines, word for word, the Shown as column of Permissions: the details pane’s Permissions section and an open row of the Widgets tab show what the widget reads, what it writes as the viewer, which workflows it starts as the viewer, and what it does outside the page.
- Checked at each call. Besides a call’s params and its session, the host checks only the declaration, the viewer’s
own rights and the placed widget’s rate budgets: a
reader’s widget still only reads, and the API enforces the rest of the viewer’s rights. A write, a workflow start, a
copy, an opened link or a notification happens when the widget calls, on load or on a timer as well as after a click;
the host asks for no click and draws no dialog. A press on one of the widget’s header actions, Space on a free-form
canvas included, only sends
ui.actionto it. The browser’s own rules still apply: it may refuse a new tab, a clipboard write or a notification prompt that no click preceded. That is a result, not an error:ui.openanswers{opened: false},ui.copy{copied: false}andui.notify{shown: false}. The browser is asked for notification permission only by aui.notifymade while the page holds its activation from a click or key press (ui.notify).
Deploying
A widget is a definition entry in the workflow blob’s manifest:sourceis the packed definition document, whichbuildwrites anddeployuploads. Commit it: an install then needs no Node and no build directory.widget.sourcenames thewidget.yaml, andwidget.buildthe directory the widget project’s own build wrote. Both resolve against the manifest’s directory.- An entry with
category: widgetand nowidget:binding deploys its committedsourceas it stands.
build packs.
Libraries and Theme says how to build one module that
loads.
buildpacks every entry with awidget:binding. It readswidget.yaml, walks the build directory in sorted order (skipping any path with a segment that begins with., refusing symlinks), types each file from a fixed table of extensions, assembles the document, computescontent_hash, checks it, and writes it tosource, reportingbuilt widget/<alias> (<bytes> bytes, <content_hash>). It makes no API call, so it reports the size without a verdict. It checks libraries only against a catalog given with--library-catalog, a file or anhttp(s)URL; a catalog named by URL is fetched, the one requestbuildcan make. Without a catalog, a widget that declares libraries drawsWIDGET_LIBRARIES_UNVERIFIED.deployuploads the document atsourceas it stands and never packs. Before any write it checks every widget: the rules above, its libraries againsthttps://blobhub.io/libs/catalog.json(or--library-catalog) when it declares any, its entry’s imports, and its size against the blob’sworkflow.widget_definition_bytes. It deploys widgets after workflows and before playgrounds and listeners, and uploads a widget only when its hash differs from the stored one. When the build directory still exists and packs to a different document,deploywarns that the build is stale (WIDGET_SOURCE_STALE, andstalewith--json) and uploads the source regardless; a build directory that exists but cannot be packed stops the deploy before any write. When a widget’s granted permissions differ from the deployed definition’s,deployprints its lines and refuses withWIDGET_NOT_CONFIRMEDunless given--yes(Trust at install).diffcompares hashes without downloading a widget. It reportsdeployed,body_changedwhen the local hash differs from the stored one,build_stalewhen the build directory packs to a different hash,compile_errorwhen it cannot be packed, andvalidation_errorfrom the same checks asdeploy.lsmarks a widget created but never uploaded(not deployed)(deployed: falsewith--json), the one the Widgets tab shows asInstall incomplete.pullwrites each deployed widget’s document to itssource, and skips one not deployed, leaving its local source as it is (not_deployedwith--json).
push uploads a widget’s document as it stands, without deploy’s offline checks of
anything but its permissions, and confirms a widget whose permissions changed as deploy does: it prints the widget’s
lines and refuses with WIDGET_NOT_CONFIRMED unless given --yes. prune deletes a
widget no manifest entry claims, as for any other definition; check and
eject skip widgets.
Before it uploads anything, deploy refuses a widget that breaks the rules, asks for a permission outside the
vocabulary, is larger than the blob’s workflow.widget_definition_bytes, names a library or version the catalog lacks,
or whose entry imports a relative path, a URL, or a bare name no declared library answers to. Only the entry module is
read, and a computed import(expr) draws the advisory WIDGET_IMPORT_UNVERIFIED. Error codes lists
the WIDGET_* codes.
There is no local runner. A widget is developed by deploying it to a real playground, and a deploy is what a viewer’s
page picks up; a playground already open gets it at its next load. The page downloads a widget’s code once per
content_hash, keeps the code of up to 32 builds, dropping the oldest, and loads every later view of a kept build from
there, so a new build reaches a viewer with its new hash. Where the browser offers no Cache Storage, the page downloads
the code on every view.
The Widgets tab
A workflow blob’s Widgets tab, after Playgrounds, lists the selected revision’s widgets, one row each; a revision with none readsNo widgets in this revision. Install one with blobhub workflow deploy --yes. Its columns are
Alias; Label, a link that opens the row in place; Group; Permissions, what the widget declares in short,
in the order of Permissions: key: level, a list’s count as its lines count it, and links: * for any
site, as in objects: write · executions: 2 · links: *, or a muted None for a widget that declares none; and
Updated, when the widget was last uploaded, or created if it never was (see What is stored). A
widget created and never uploaded reads Install incomplete in the grid.
A selected row opens in place. It shows the widget’s description, its properties with its icon among them, its
permissions in the lines of the Shown as column of Permissions, one line per permission and a list’s
items beneath it, and the row’s JSON. The details pane’s Permissions section shows the same lines. A widget created
and never uploaded reads Install incomplete in both, since its permissions are not known: its open row’s properties
are only its alias, label and group, with Install incomplete where its permissions go, beside the row’s JSON.
A person who can edit the revision can delete the widget there. Delete asks
Are you sure that you would like to delete widget <alias>? and, once confirmed, removes the widget’s definition from
the revision; a playground that places the widget shows This revision has no widget named <alias>. when it next loads.
The tab only reads and deletes: a widget is installed and updated with blobhub workflow deploy.
Limits
workflow.widgets_per_revision: how many widget definitions one revision may hold. Creating one more is refused withlimit_exceeded.workflow.widget_definition_bytes: the size of one widget definition’s canonical form. A larger upload is refused withwidget_definition_too_largeand alimitobject, anddeployrefuses it before uploading (WIDGET_TOO_LARGE).
The kit
BlobHub builds its own widgets, Mission Control among them, with a kit: React hooks over the bridge, the shared components BlobHub’s widgets are made of, the theme and a build preset. The kit is not yet public, so a widget is built against the bridge protocol these pages document, in plain JavaScript or with any framework that builds to one ES module.See also
- Bridge Protocol: the entry, the wire format, every call, event and refusal, and a widget written without the kit.
- Libraries and Theme: the library catalog, the import map, building one module, and BlobHub’s light and dark look.
- Security Model: the frame and its origin, the rules the platform enforces, and the risks that remain.
- Widgets: the built-in widgets.

