edge.versions()

The versions() method of the edge object lists the saved versions of a deployed route: one entry for each deployment that the history recorded, newest first. Its sub-function edge.versions.load() writes one of them into the agent folder as a file, so that you can read it or diff it with your own tools.

Every deploy is recorded as a version, together with its optional note from edge.save.limit({ message }). The same history feeds the versions viewer (the ?? URL suffix), Smart Undo and edge.size({ version }).

Syntax

js
await edge.versions()
await edge.versions(options)

await edge.versions.load(ref)
await edge.versions.load(ref, options)

Parameters

options Optional

An object with this property:

route Optional

A string: the route whose history to read. The default is Code.D[0]. It is not checked against Code.D, and it is used as written, so pass the route the way Code.D holds it: my-site, my-site/docs or example.com. A longer spelling such as my-site.rt.ht probably finds nothing.

ref (for load() only)

Which version to write:

A number

The version with that n: 0 is the newest.

A string

A SHA prefix. It selects the first, that is the newest, version whose full SHA starts with it. The comparison is case-sensitive and does not check for ambiguity. A string of digits such as '2' is a SHA prefix, not an index, and '' matches the newest version.

Return value

edge.versions() returns a Promise that resolves to an array of objects, newest first, with at most 100 entries:

js
[
  { n: 0, sha: 'a1b2c3d', date: '2026-10-04T12:00:00.000Z', editor: '', message: 'Hero: tighter spacing', deleted: false },
  …
]
n

A number: the position in the list. 0 is the newest version.

sha

A string: the first 7 hexadecimal characters of the version's identifier.

date

A string: an ISO date. It is the date of the history entry, which is written a little after the deploy returns, so it is slightly later than the time of the deploy.

editor

A string: the lowercased email address of the editor who saved the version, when an editor saved it and you are the owner. Otherwise ''.

message

A string: the 💬 deploy note, or '' when there was none. For older entries without the usual prefix, the first line of their message.

deleted

A boolean value: true for an entry that records a deletion. The list stops at the newest deletion, so in practice every entry has deleted: false.

edge.versions.load() returns a Promise that resolves to an object:

file

A string: the name of the file it wrote, 🕐.<n>.<sha7>.html.

n, sha, date, message

As above, for the version it wrote.

ok

A boolean value: false when the saved version could not be decoded into source. The file then holds the raw saved text, or is empty when the version could not be fetched, instead of HTML.

Exceptions

RejectionWhen
Error('Unauthenticated.')You are not signed in.
Error with the server's message, or 'Unable to load deployment history.'The history did not answer with a list.
TypeErrorCode.D is empty and no route was given. Pass route or set Code.D.
Error('Agent Folder Share is not active.')load() without an active share.
Error('No version <ref> — edge.versions() lists <count>.')load() found no version for ref.

Usage notes

edge.versions.load()

load() needs an active Agent Folder Share, which works in Chrome and Edge on desktop. It downloads the saved state of that version, decodes its source and writes it into the root of the work folder as 🕐.<n>.<sha7>.html, overwriting a file with the same name. The file has the same shape as 📄.html.

Examples

Listing the three newest versions

Write this to io.eval.js and read io.eval.json. It needs a signed-in account and a route in Code.D.

js
(await edge.versions()).slice(0, 3)

Writing a version to disk and diffing it

js
await edge.versions.load(1)   // { file: '🕐.1.a1b2c3d.html', n: 1, sha: 'a1b2c3d', date, message, ok: true }

Then compare it with the current source in the shared folder:

plain
diff 🕐.1.*.html 📄.html

Reading the history of another route

js
await edge.versions({ route: 'my-site/docs' })

Specifications

Not part of any specification. edge.versions() is an RTCode.io playground function.

Availability

FeaturePlaygroundRTEdge.netNotes
edge.versions()YesNoNeeds a signed-in account and a route.
edge.versions.load()YesNoAlso needs Agent Folder Share: Chrome or Edge on desktop, in a top-level playground.

See also