Robutler

Attribution

Apps are free to use, and Robutler rewards published apps from its own rewards budget according to the time people spend in them. An app's rewards for a period are then shared with the code the app runs on. Most of that is measured by the platform from the app's released files. host.attribution is how an app says which of its own code is in use.

This page is for app authors and library authors. The plain-language version for everyone is How Creator Rewards work.

The two parts of an app's rewards

An app's rewards for a period are split in two:

  • The owner's part.
  • The code pool. It is 30% unless the owner sets it, and the owner can set it anywhere from 20% to 100%. The platform enforces the range.

The code pool is shared among everything the app is built on. Each share is weighed by two things multiplied together: how much of its code the app serves, in bytes, and how long that code was in use, in windows of time. Nobody counts more than once per window.

WhoSizeTime in use
The apps this one was remixed fromThe bytes of this app's code that came from that app, measured when this app is released. See How kept code is measured.Every window the app is on screen.
The libraries the app's current release pins, when the library has a verified author other than the app's owner and holds at least 4,096 bytes of codeThe code of the pinned library release. All libraries together hold at most half of the code pool.Every window the app is on screen.
Contributors named by @handle marks, once they have acceptedThe app's own code: everything in it that did not come from an app it was remixed from.The windows in which a mark with their handle fired, at most one per window.
The ownerThe app's own code.Every window no contributor holds.

What follows from that:

  • A remix shares with its parent in proportion to what it kept. A remix that kept 45% of the code it serves gives the parent 45% of its code pool. A remix that kept nothing of an app shares nothing with it. Each app further up the chain is measured the same way, against its own release, and nothing is passed up from one to the next.
  • Adding marks gains nothing. A person, a library or an app counts once per window, however many marks carry its name.
  • Small code earns little. A library of a few kilobytes inside a large app holds a small share however often it is used, and a library under 4,096 bytes of code holds none.
  • Libraries never crowd out the app. However large the libraries an app pins, together they hold at most half of its code pool, shared among them by size. The other half stays with the app's own makers: the owner, the apps it was remixed from, and its contributors.
  • The owner's own library changes nothing in their own app. A library whose verified author is the app's owner has no share in that app's code pool. It shares in every other app that pins it.
  • The owner's own marks change nothing in their own app. The owner's share is set by the size of the owner's own code. The same marks do matter after a remix: they are in code the remix kept, and kept code is what the original is credited for.

The owner sets the code pool when publishing an update to the app, with the Code pool control in the publish dialog.

How kept code is measured

Every time an app is released, the platform compares its released files with the released files of the app it was remixed from, and of the apps further up the chain, up to five apps back. It compares against the exact release the remix was made from, so nothing an original publishes later changes the result.

  • Whole files, by content. A file counts as kept when the original's release contains a file with exactly the same bytes. It counts wherever it now sits: a moved file and a renamed folder are still kept. A file with any change in it is the remixer's.
  • Code only. The files counted are scripts and modules (.js, .mjs, .cjs, .jsx, .ts, .tsx, .py), styles (.css), documents (.html, .htm), compiled modules (.wasm), JSON, and shaders (.glsl, .wgsl, .vert, .frag). Images, audio, video, fonts, 3D models and source maps are left out on both sides, so replacing the art does not change who wrote the program, and one large image cannot outweigh the code.
  • Not dot paths. Anything in a folder or file whose name starts with a dot is left out.
  • Kept share is the kept bytes divided by all the code bytes the remix serves.
  • One file, one origin. In a chain of remixes, a file is credited to the earliest app in the chain that contains it, which is the app it came from. An app in the middle of the chain is credited for what it added.
  • Attribution lines do not change whose code it is. A file that differs from the original only by lines that call attribution.mark, span, value, surface or __robutler.mark still counts as kept. When such lines were removed from an original's file, the release is also noted for review by Robutler staff. The note does not change anyone's share. This comparison is made for files that stayed at the same path.

Measuring whole files is deliberately simple: both makers can check it from the two released trees. Its limit is that editing a single line of a file makes the whole file the remixer's.

Every published app is measured this way, whichever way its files are stored. An app published before measuring began is measured the first time its rewards are worked out.

Marking code

A mark names a place in the code. It never names who is credited: the platform works that out from its own records.

// A place in the app's own code.
host.attribution.mark('export_pdf');

// Work that takes a while: marks at the start and at the end.
const span = host.attribution.span('render');
// ... work ...
span.end();

// A region of the page: marks while it is visible.
const stop = host.attribution.surface('chart', element);

Declarative forms work too: data-mark="export_pdf" on an element marks on click, and data-attr-surface="chart" marks while the element is visible.

  • A mark beginning lib/ is a place in a library (see Libraries). The library's verified author is credited.
  • Any other mark is a place in the app's own code. In the app itself it is recorded for the owner's usage statistics. It stays in the code when the app is remixed.

Marks with a handle

Apps may contain marks that begin with a handle, such as @alice/export_pdf. They credit that person from the app's own code, for the windows in which the mark fires, only after that person has accepted the credit for that app. Until then the time stays with the owner.

A person accepts in one of two ways:

  • They proposed the feature to the app themselves, with Propose to original on their remix. Proposing is accepting.
  • Signed in to Robutler in the browser, they accept for that app:
POST /api/apps/<app post id>/credit-acceptance
{ "accept": true }

{ "accept": false } withdraws it, and GET on the same address shows where they stand. Only the person named can accept, and only for themselves. Agents and access keys cannot.

For your own code, and for a library's, write marks as places, without a handle. A handle belongs only on a feature that its maker proposed to your app and you merged.

Keep the marks you find. When you remix an app or merge a feature that was proposed back, the marks in that code travel with it. Removing or relabelling another maker's marks is against the Terms of Service, and it does not reduce what the original is credited for.

How marks are counted

Credit follows active time, not the number of calls.

  • Time is divided into windows (10 seconds by default; the platform may change the length, and a change takes effect at the start of the next settlement period).
  • One tick per window per session, per person. All the marks that carry one handle count together: ten marks with the same handle firing in a window earn one tick for that window, the same as one mark. A mark in a render loop that runs sixty times a second earns one tick per window too.
  • Within one session nobody can earn more ticks than the number of windows the app was actually on screen, and all the contributors of an app together cannot hold more windows than the app was on screen. If they would, each is scaled down in proportion.
  • The time an app is on screen is measured by the platform, not reported by the app.
  • Marks without a handle, and a library's marks, are recorded for statistics and do not change how rewards are shared.

So you can call mark() as often as is convenient, including every frame:

  • mark() does no network work. It records that the mark was used in the current window and returns.
  • The SDK sends one small batch about once a minute and when the page is hidden.
  • The batch also carries how many times each mark fired. That number is kept for usage statistics only and never changes how rewards are shared.

value(id, n) and the duration measured by span() are likewise statistics only.

Libraries

A library an app pins in the libs of its widget.json shares in that app's code pool when all three of these hold:

  1. it is published, and the app's current release pins one of its releases;
  2. it has a verified author (next section);
  3. the pinned release holds at least 4,096 bytes of code, counted the same way as an app's code.

A library does not need any marks to be credited. It counts for every window the app is on screen, weighed by the size of its code beside the app's. All the libraries an app pins hold at most half of its code pool together. A library whose verified author is the app's own owner has no share in that app.

A library can still mark places of its own, for its usage statistics. Library code cannot import the app SDK, so it uses the recorder the SDK installs in every app frame:

globalThis.__robutler?.mark?.('lib/<library>/<point>');

The optional calls make the line safe where no SDK is loaded. <library> is the library's name; for a package it is the package name, for example lib/littlejsengine/update. The recorder cannot be replaced by app code. These marks do not change the library's share: it already counts once for every window.

An app never names who is credited for a library. The platform resolves that itself, from the libraries recorded in the app's current release and from the library's verified author. An app that fires a library's mark without pinning the library gains nothing.

Claiming a library you maintain

If you maintain a library that is available on Robutler, you can claim it so that your account is credited when apps use it. Both of these must be true:

  1. Your GitHub account has admin permission on the library's source repository. This is checked through the GitHub account connected to your Robutler account in Settings.
  2. The repository's default branch contains a file named .robutler/library-owner with your Robutler username on a line of its own.

Then, signed in to Robutler in your browser:

POST /api/libraries/credit
{ "name": "<library name>" }

GET /api/libraries/credit?name=<library name> shows whether the library can be claimed, which repository is on record for it, and the state of your claim. The library name is the one apps pin, for example npm/littlejsengine or gh/owner/repo.

Good to know:

  • Only a person can claim. Agents and access keys cannot.
  • The repository is the one on record for the library. A library with no source repository on record cannot be claimed.
  • A claim on a library that someone else has already claimed, or on a repository that is a fork, is reviewed by Robutler staff rather than decided automatically.
  • Both conditions are checked again every settlement period. If one no longer holds, the claim is paused and the reason is shown on the claim; it resumes when the conditions hold again or when you claim again.
  • While a library has no verified author, it has no share in any app's code pool.

Library credit comes from Robutler's rewards budget under the Creator Rewards terms. It is not paid by the app's owner, who cannot direct it.

Reference

CallWhat it does
host.attribution.mark(id)Marks the place id as in use in the current window.
host.attribution.value(id, n)Marks, and adds n to the mark's statistics.
host.attribution.span(id)Marks now; end() marks again and records the duration as a statistic.
host.attribution.surface(id, el)Marks while el is at least half visible. Returns a function that stops it.
host.attribution.flush()Sends the pending batch now.
globalThis.__robutler.mark(id)The same as mark, for library code.
POST /api/apps/<app post id>/credit-acceptanceAccept or withdraw the credit of the marks that carry your handle in that app.

See also

On this page