world
The world namespace: 197 functions.
globals/world/__contributeWire
world.__contributeWire()
The calls world.contribute makes beyond this engine: each VCS call
answers (ok, payload) the way an awaited __spacetime_vcs call does;
readCommit(world, id) answers one commit of a world as ZeroMind stores
it, each manifest entry's reference table in the zero/refs/v2 form
(deps with their sites, and worlds), as its JSON;
contributeUpdate(origin, branch, head, mergeParent, entriesJson, removedJson, message) advances the existing branch of an open pull
request by one commit on head (__spacetime_vcs.contributeUpdate);
units() lists the world's install units (world_vcs.engagement's
engineOps().installs), and prState(c) reads the state of the pull
request a contribution link names (engagement.prStateOf).
pull(req) sends one pull request review op of the trusted
zeromind.engage bridge (pullThread, pullComment, pullReview,
pullUpdate, pullChecks, pullCheck) and answers what ZeroMind
answered, raising its refusal; runTests(opts) runs suites as
tests.run(opts) does, and session() answers where this engine
stands: { world, branch, head, localHead, changes, untracked },
head the published commit its branch head is (nil while that head is
unpublished), localHead the branch head as this session names it,
changes the paths staged, or tracked and changed, in its working tree,
untracked the paths its working tree holds that no commit tracks.
standing(origin) answers where this account stands on origin as a
proposer (zeromind.world's ownForks): may_push, whether it holds a
role there that pushes a branch, and forks, its own forks of origin,
each { guid, title, visibility, draft }; fork(origin) forks origin
into this account's worlds and answers the fork's record; each raises
with ZeroMind's reason. deleteBranch(world, branch) deletes a branch
of a world this account maintains, answering (ok, payload).
prMerge(world, number, strategy) merges a pull request through the
trusted zeromind.engage bridge (pullMerge), which waits for
ZeroMind's own answer, answering (ok, payload): ZeroMind's merge
response as JSON, or the reason it did not merge.
globals/world/__isAlreadyPublished
world.__isAlreadyPublished(world: any)
Graft the VCS public API (add, add_all, unstage, discard,
discardFile,
commit, push, head, vcsStatus, log, show, diff, affirm,
trash, restore, stash, stashes, stashPop, stashDrop,
reset, list, installLibrary, updateLibrary, uninstallLibrary,
installAsset) onto the supplied world namespace. The prelude
calls this once at boot.
Parameters
worldany— The target namespace — typically the engine'sworldglobal.
require("modules.world_vcs").installInto(world)
globals/world/add
world.add(paths: string | { string }, opts: AddOpts?) -> AddReport
Stage one path's manifest row, or each of a list of paths,
expanding to the full asset family if a path lives inside a composite
asset. Idempotent at (stage, manifest_row). A list stages every row
its paths select once, so naming several files of one asset stages
that asset's family once, as git add a b c does. Pass { force = true } to bypass
the .zmignore / .gitignore gate — same intent as
git add -f. Without force, attempts to stage an ignored
path (or a path whose .refs points at an ignored dep)
error.
{ stage = "<name>" } stages into the named area, shared with
whoever else names it, instead of the caller's own, so a commit
naming that area freezes these paths and leaves every other area's
staged.
Staging is advisory, and a path is staged in one area at a time.
Naming a path another staging area holds takes it from that area,
whichever account opened it and whether or not its session is open,
and the report names the area, its account and whether that session
is working now in released. A take from an area of another account
warns, naming that account, the area and its session; a take from
another agent or engine of the caller's own account does not. A
staged path a caller of another account is writing now is named in
written and warned about the same way.
A staged source that references an asset whose current version no
commit holds needs that version committed with it. The asset is
staged beside the source, taken from any other area holding it, and
named in carried.
A .scene stages as its files on disk hold it, in edit and in play
alike; live entity edits nobody saved stay in the session, and a
notice names them with the calls that keep or drop them.
An installed asset is staged by its root path: every row of the install
(its files, its dependencies under /zero/source/deps/) is staged with
it, as world.vcsStatus().installs lists it. A path that is one of the
other rows of an install raises, naming the install and its root. A
file the world changed inside an install held as one record (under the
install's root, or under a dependency it places in
/zero/source/deps/) stages with the changed rows beneath that root,
and the root itself is left out: the record is the row that versions
it. Naming the destination of such an install stages its record
(<root>.pull) when the record changed, so an install, an update and
an uninstall each reach a commit by the path world.vcsStatus lists
them under. A file
world.vcsStatus lists with the reason references moved stages like
any change: its row carries its live reference table and its bytes are
the ones the branch head already holds.
Parameters
pathsstring | { string }— The path to stage, or a non-empty list of paths. Each must be a non-empty string; a gate refusing any of them refuses the call before anything is staged.{ renormalize = true }first restates every folder asset's row at or beneath the named paths from the files beneath it, asgit add --renormalizedoes: a folder whose stated version is not the folder hash of its files is staged at the hash its files hold, and a folder that already states it is left out.optsAddOpts(optional) — Optional{ force: boolean?, renormalize: boolean?, stage: string? }. Defaults to{ force = false }on the calling caller's own staging area.
Returns AddReport — What the call staged: staged lists the rows the paths name (the asset family of a path inside an asset; otherwise the path and every changed row beneath it, deletions included, so a deleted asset folder stages the deletion of each of its files), leaving out with a warning naming it each path no row at or beneath which holds a change, carried the referenced assets staged beside them because no commit holds their current version, released each path taken from another staging area (stage, its account, same_account, its session and whether that session is live), and written each staged path a caller of another account is writing now (by, account). Each carried row, and each released and written row of another account, is also written to the caller as a warning.
world.add("/source/foo.luau")
world.add({ "/source/a.luau", "/source/b.luau" })
world.add("/source/scene_dirty/entities/42.json", { force = true })
world.add("/source/fauna.module", { stage = "fauna" })
world.add("/source/fauna.module", { renormalize = true })
globals/world/add_all
world.add_all(opts: AddAllOpts?) -> ({ string }, AddAllReport)
Stage every dirty manifest row, whoever wrote it, skipping any
path that matches .zmignore / .gitignore. Paths that match an
ignore pattern are skipped; world.add(path, { force = true }) is the
explicit way to override the gate for an individual path.
Rows still flagged conflicted by world.pullAsset are held back
too: resolve them (edit + world.add(path), or
world.resolvePullConflict) and re-run.
Staging is advisory. The working tree is one per branch and staging
areas are not, and a path is staged in one area at a time: a path
another staging area holds is taken from that area, whichever account
opened it and whether or not its session is open, and named in
released with the area, its account, its session and whether that
session is live. A row another caller is writing is staged like any
other. The calling account's own agents and engines never warn each
other: their areas and their writes are the account's own. A take
from another account's area warns once per area, naming the account,
the area and its session, and saying that account is working on the
paths now when its session is open; a staged path a caller of another
account is writing now warns once per caller and is named in
written.
Each staged path brings its asset family. A file world.vcsStatus
lists with the reason references moved is staged too. The call reads the
working tree a fixed number of times and stages and releases in
batches, so its cost follows the size of the dirty set.
A scene stages as its files on disk hold it, in edit and in play
alike: live entity edits nobody saved stay in the session, and a
notice names each scene holding some, with the calls that write
them into scene.json (sceneAuthoring acceptChanges,
layers.active:save()) or drop them.
Parameters
optsAddAllOpts(optional) — Optional{ stage: string? }.stagenames the staging area to stage into; omitted, the call stages into the calling caller's own area.
Returns ({ string }, AddAllReport) — The paths that were held back: the conflicted ones. Empty when none were. The second value reports the call in full: staged lists the paths it added to the staging area, held lists every held-back path with its reason ("conflicted"), released lists each path taken from another staging area (stage, account, same_account, session, live), and written each staged path a caller of another account is writing now (by, account).
world.add_all()
world.add_all({ stage = "fauna" })
local held, report = world.add_all()
globals/world/affirm
world.affirm(token: string)
Consume an XXX-XXX-XXX-style affirmation token returned by
a destructive op surface (e.g. vfs.remove). The destruction
commits atomically with the pending-row delete; the token is
one-shot. Errors verbatim on expiry / wrong-user.
Parameters
tokenstring— The affirmation token.
world.affirm("ABC-DEF-GHI")
globals/world/args
world.args -> any
Returns any
globals/world/assetInstallable
world.assetInstallable(opts: AssetInstallableOpts) -> AssetInstallableReport
Report whether one published asset can be installed on its own,
without raising. world.previewInstall plans a real install and
raises when the closure will not resolve; this answers the prior
question — does this guid name something ZeroMind will hand over by
itself — as a verdict a caller can branch on. Content that ships
inside a larger library (a module inside a package, a material
inside a system) carries its own published identity, so the answer
is per asset rather than per library. Reads only.
Parameters
optsAssetInstallableOpts—{ guid }names the asset;refasks about it as a branch, a tag or a commit id of the world it is published from holds it.
Returns AssetInstallableReport — An AssetInstallableReport — installable, a verdict, a one-line detail, and the closure's nodes / tree_children / deps shape when one resolved.
world.assetInstallable({ guid = asset.guid("@builtin::materials.neon") })
globals/world/avatar_default_edit
world.avatar_default_edit -> any
Returns any
globals/world/avatar_default_play
world.avatar_default_play -> any
Returns any
globals/world/awaitCommit
world.awaitCommit(commitId: string, seconds: number?) -> { state: string, landed: boolean, lines: { string } }
Wait, for at most seconds (default 90), until the commit
world.commit returned is on the branch, and say where it stands.
state is landed once it is a commit of the world, sealed while it
is sealed behind its derived outputs, and absent when it was
unsealed. A sealed answer ends the wait early when a required output
failed or the commit's landing was refused, since neither moves on its
own. lines states it the way zm commit prints it: that the commit is
sealed and not on the branch, what it waits on, and the commands that
move it (zm derived retry, zm derived provide, zm unseal).
Parameters
commitIdstring— The idworld.commitreturned.secondsnumber(optional) — How long to wait for it to land; 0 reads where it stands now.
Returns { state: string, landed: boolean, lines: { string } } — { state, landed, lines }.
local id = world.commit("add the rock"); local where = world.awaitCommit(id); if not where.landed then print(table.concat(where.lines, "\n")) end
globals/world/awaitOutgoingSync
world.awaitOutgoingSync()
Wait until every /source write this session made has reached
the branch it was written against. Raises naming the paths that did
not land. add / commit / push / checkout / merge / pull
already wait on their own; call this before rebinding after a burst
of writes, which world.checkout and world.swap refuse over.
Returns Nothing. Raises when a write did not land.
world.awaitOutgoingSync() ; world.checkout("main")
globals/world/beforeCommit
world.beforeCommit(name: string, fn: ((any) -> ())?)
Open-or-resume a staging area, set the message, and materialise
the commit. Commits ONLY what's already staged via world.add /
world.add_all — git semantics, not git commit -a. The reducer
auto-deletes the stage row on success so a subsequent
world.commit opens a fresh one.
Where derive hooks compute outputs for the staged content, the commit
is sealed under its id first and lands once every required output is
computed. The id this returns can name a commit that has not landed
yet: world.vcsStatus().sealed lists the sealed commits with what each
waits on, and world.unseal returns one to the staging area. When an
older sealed commit holds a refusal, this commit queues behind it and
the call says so.
{ stage = "<name>" } materialises one of the caller's own staging
areas, so the commit carries the paths staged under that name and
leaves every other caller's staged. When a commit from another
caller has landed since the area was opened, this brings the area
onto the branch head there is now and commits it there.
A staged scene is frozen as staged. Live entity edits its overlay holds that nobody saved stay in the session, and a notice names them once the commit lands.
Pre-flight .zmignore refs gate: every staged source's
aggregated deps (via asset.deps, which recurses composite
asset folders) are checked against the live ignore set. If
any dep target's path is currently ignored AND the dep target
is not itself in the stage, the commit is refused. This
mirrors the closure invariant — a commit whose deps can't
resolve cleanly shouldn't land. Force-staging the dep
alongside (world.add(dep, { force = true })) makes the
ignored dep satisfy the gate.
Run fn at the start of every world.commit, before the commit
reads what is staged — the moment to write content that belongs in
the commit being made, and stage it. fn receives { stage }, the
staging area the commit materialises (nil for the caller's own), to
pass to world.add. Registering a name again replaces what it held,
and fn = nil removes it. A hook that raises refuses the commit,
naming the hook.
Parameters
namestring— What identifies the hook.fn((any) -> ())(optional) — The hook, or nil to remove it.
Returns The newly-allocated commit id (ULID string).
local id = world.commit("feat: ship widget")
local id = world.commit("fauna: the swallow colony", { stage = "fauna" })
world.beforeCommit("procgen.diskcache", function(ctx) ... end)
globals/world/bind
world.bind(worldGuid: string, opts: { profile: string?, mode: string?, branch: string?, commit: string? }?) -> { [string]: any }
Bind a world on an engine that booted with no world and waits for one
(native --await-world, awaitWorld=1 in a browser launch, the Android
world chooser). The world is loaded in this process, the way a boot that
names it loads it, in the profile and mode opts names. The load is
asynchronous; the answer says whether it started. Its progress is
world.syncStatus().binding, and world.guid() names the world once it
is bound. Until a world is bound, a /source write is refused.
Parameters
worldGuidstring— The guid of the world to bind.opts{ profile: string?, mode: string?, branch: string?, commit: string? }(optional) —{ profile?, mode?, branch?, commit? }:profileis"editor"(edit the world) or"runtime"(play it), the engine's own when omitted;modeis"edit"or"play"("edit"for an editor,"play"for a runtime);branchis the branch to open;commitis the ref a runtime plays.
Returns { [string]: any } — { ok = true, worldGuid, profile, mode } or { ok = false, reason }.
world.bind("6b861afe-eb47-458d-89e1-ff0ec832958c", { profile = "editor" })
globals/world/branches
world.branches() -> { { branch: string, commit_id: string, current: boolean } }
Every branch this world has, with the commit each one's head
names and which one this session is on — git branch --list. Sorted
by name. A branch exists for everyone in the world; which one you are
on is yours alone, so current is true for at most one row here and
says nothing about where anybody else is.
Returns { { branch: string, commit_id: string, current: boolean } } — Array of { branch, commit_id, current }.
for _, b in ipairs(world.branches()) do print(b.branch, b.commit_id) end
globals/world/camera_default_edit
world.camera_default_edit -> any
Returns any
globals/world/camera_default_play
world.camera_default_play -> any
Returns any
globals/world/checkUpdates
world.checkUpdates() -> ({ UpdateReport }, { UpdateSkip })
Discover which units of this world have an update available. Read-only — makes no local mutation and no VCS write. A unit is one of:
- a library: a marker (
/source/libs/@<name>,@builtinincluded) whoserequested_ref(defaultmain) now resolves in the library's world to a commit other than the marker'sresolved_commit.@builtinis compared with the published commit of it this engine runs instead, when the engine names one: a pin older than it is reported withbehind_engine = trueandtonaming that commit when moving it there changes an asset the world's own content names, or one such an asset reaches through the library's reference tables (other than an engine-owned part a play of the world runs at the engine's own version whatever the pin names; a component counts, since a play runs the pinned version of it); an older pin whose move changes none of them, and a pin at it or newer than it, are current. A world on an older@builtinis hidden from players. Apply withworld.updateLibrary(name). - an installed asset: an install root (the asset that was installed;
its reference table marks it) whose recorded version differs from the
newest version of that asset at its origin, one lookup per root.
Apply with
world.update(<root path>)(zeromind.update), which installs the root's new closure with each dependency at the version the new root records. - a dependency an install record places (under
/source/deps/): the release the record states for it differs from the newest release of that asset in the dependency's own origin world. The entry names the dependency's path asroot_pathand the install that places it asplaced_by. Apply withworld.update(<dependency path>), which writes that install's record again at the version it holds with the dependency at the new release, and each file of the install written against the old release runs against the new one.
Installed assets whose origin world is a library's world are part of that library's unit. A pulled row that no table marks as an install root (an install older than the marks, content forked from another world) is not reported.
Returns ({ UpdateReport }, { UpdateSkip }) — Two values: an array of UpdateReport (libraries first), each { kind = "library", library, from, to, behind_engine? } or { kind = "asset", root_path, root_guid, display_name, from, to }, empty when everything is current; and an array of { name, reason } for the units whose origin could not be reached, which never fail the whole call.
local reports, skipped = world.checkUpdates()
globals/world/checkout
world.checkout(branch: string, opts: { follow: boolean? }?) -> string
Switch this session to another branch — git checkout <branch>.
The branch must already exist (create one with world.createBranch).
The tree is replaced by the branch's own content. Which branch this
session is on is this session's alone; the branch itself is shared,
so others may be on the one you move onto.
Your uncommitted changes and staged entries come with you, as git
keeps them across a switch: each lands on branch as it read
before. When the switch would replace a path you changed with a
different version, the call refuses with git's message naming the
paths and nothing moves — commit or stash them first. A file your
.zmignore / .gitignore rules ignore that neither branch tracks
never refuses the switch: it comes with you where branch holds no
copy of its own, and otherwise each branch keeps its own copy. An
ignored path a branch tracks is a tracked file like any other.
Another caller's uncommitted changes stay on the branch they were
made on.
The switch is all or nothing: a write of yours still on its way to
the branch you leave is waited for, and one that does not arrive
refuses the switch before anything moves; a switch refused after
your changes moved puts them back, and names each path that does not
read as it did.
A switch made in play takes down the running world and ends its play
session: while that session holds unaccepted changes the switch is
refused before anything moves, with the accounting
engine.mode = "edit" gives, and engine.discardPlayChanges() arms
the next switch past it.
Returns only once the branch's content has landed, so world.head,
world.log, world.commit and the VFS all target the new branch
immediately afterwards.
In an agent's own client the user's client switches to the branch
once this one has, unless opts.follow is false (its play/edit mode
stays its own); it switches on its own time, and a switch it could
not make is told to you as a notice. A switch to the branch this
client is already on moves nothing.
Parameters
branchstring— The branch to switch to.opts{ follow: boolean? }(optional) — Optional{ follow: boolean? }.
Returns string — The branch now checked out.
world.checkout("feature")
world.checkout("feature", { follow = false })
globals/world/checkoutPaths
world.checkoutPaths(rev: string, paths: { string }, opts: CheckoutPathsOpts?) -> { string }
Write paths as a revision holds them, and stage them: git checkout <rev> -- <path>.... rev is any revision world.revParse
reads. Each path comes back as the asset the revision records: its
asset guid, its bytes and its kind, so what refers to it by guid keeps
resolving, and restoring it again gives the same asset again. A folder,
a composite asset's or a plain directory, brings back every file the
revision holds beneath it, so a deleted component, module or package
comes back whole; a file beneath it the revision does not hold stays.
A file whose folder asset was deleted brings the folder back with it.
Binary files come back by their content. A path whose version is the
branch head's reads clean afterwards and leaves the staging area; any
other is staged. The paths that name nothing the
revision holds are refused together, naming each, and nothing is
written. Returns once the working copy holds every written path as the
revision records it, and every file whose reference table pins a
written path is derived again, so it names the version the working
copy holds and world.vcsStatus lists it as references moved when
that differs from the head's.
Parameters
revstring— The revision to read.paths{ string }— The paths to write: files, composite asset folders or directories.optsCheckoutPathsOpts(optional) — OptionalCheckoutPathsOpts:stage = falsewrites the working tree and leaves the staging area as it was (git restore --source <rev> -- <path>).
Returns { string } — The paths written, as the revision names them.
world.checkoutPaths("HEAD~1", { "/source/foo.luau" })
world.checkoutPaths("HEAD", { "/source/Doom.component", "/source/notes.md" })
world.checkoutPaths("HEAD~2", { "/source/levels" }, { stage = false })
globals/world/checkoutSide
world.checkoutSide(path: string, side: string)
Take one side of an unmerged path — git checkout --ours|--theirs <path>. The path holds the side's whole content afterwards; a merge
conflict's side is the session branch (ours) or the branch merged
in (theirs), an installed asset's update conflict's side is your
local version (ours) or the upstream one (theirs). Record the
resolution with world.add and commit.
A merge conflict's side is that branch's committed version: its
bytes, its asset guid, its kind and its references, so what refers
to the asset by guid keeps resolving. Text, binary and composite
assets alike: a composite asset (a .scene, .package,
.component … folder) is taken whole — name its folder and the
folder and every file in it come from that side. A side that deleted
the path leaves it a pending delete. Taking a side again replaces
the earlier choice.
A file of an install the world holds as one record (<dest>.pull)
that the world wrote over, the file an update lists under
conflicted when the world's edit of it conflicts with the version
the install moved to: theirs takes the world's file out, so the
install's file of that version stands at the path, and ours keeps
the world's file.
Parameters
pathstring— The unmerged path, or the composite asset folder holding one.sidestring—oursortheirs.
world.checkoutSide("/source/foo.luau", "theirs")
globals/world/commit
world.commit(message: string, opts: CommitOpts?) -> string
Parameters
messagestringoptsCommitOpts(optional)
Returns string
globals/world/conflicts
world.conflicts() -> { ConflictEntry }
List every locally-pulled row currently flagged conflicted —
the findable surface world.pullAsset leaves behind on an
unresolved merge. Read-only.
Returns { ConflictEntry } — An array of ConflictEntry, one per conflicted row. Empty when nothing is conflicted.
local list = world.conflicts()
globals/world/connectedUsers
world.connectedUsers -> any
Returns any
globals/world/contentRequirements
world.contentRequirements(scope: { string }?) -> { ContentRequirement }
List the world's unmet content requirements: user-authored assets
whose type-declared content constraints are not yet satisfied (an
empty README, a .metadata with no description or tags — the
empty-skeleton state a fresh create emits for the author to fill, and
a description the type asks for that still starts with the
[[describe]] placeholder, which describes = true marks on the
row; world.push asks for a description only of the assets the push
changes).
The same walk world.push gates on, over the whole world: the
push refuses over every row whose asset it publishes, and
world.publishBlockers reports those rows as the content class
beside the other two. Empty list = every checked asset meets its type's
contract. A write into an asset reports the rows its type's
type.yaml requirements give for that asset as it lands:
contentRequirements on the vfs.write report and on the MCP
write_file / edit_file result.
Parameters
scope{ string }(optional) — Asset paths to restrict the check to — pass a status read's dirty + staged paths to check only content that would actually publish (a per-file path matches its containing asset; each path resolves directly, with no world enumeration). Omit for the full-world walk the push gate performs.
Returns { ContentRequirement } — Array of ContentRequirement rows — { asset, typeName, detail, path, describes?, file?, remedy? }, where path is the asset the row is about and remedy the action its type's validate hook names for it.
for _, r in ipairs(world.contentRequirements()) do print(r.asset, r.detail) end
globals/world/contribute
world.contribute(opts: ContributeOpts?) -> { ContributeOutcome }
Send improvements to installed content back upstream — git subtree push ending in a pull request. For each targeted origin
world: the diverging subtree is remapped to the origin's canonical
paths, three-way merged against the origin's CURRENT content
(regions the origin also changed become local conflicts to
resolve first), pushed as a contrib-<id> branch and opened as a
pull request on the origin, which stays open: merge is opt-in, and
zm.prMerge merges. A change inside a folder asset (an asset inside
an installed package) publishes a new version of that folder under
the version its descriptor states (package.yaml of a .package),
so a root inside a package sends the package's descriptor with it
when this world changed it, and a refusal of a version the origin
already published (RELEASE_VERSION_TAKEN) names the descriptor in
this world to state a new version: in. An account holding a role
on the origin that pushes a branch there pushes the branch into the
origin; any other
account proposes from its own fork of the origin: the branch goes to
its public or unlisted fork (made the first time, then reused; the
world this engine is bound to is never that fork), and the pull
request is opened on the origin from <fork>:<branch>, so the origin
is written to only when its maintainer merges. Such an outcome names
the fork as source_world, forked when this call made it, and a
fork that is private or a draft is refused (SOURCE_PRIVATE) with
nothing sent. Each refusal ZeroMind answers a proposal from outside
with reaches the outcome's detail by its code (SOURCE_PRIVATE,
SOURCE_NOT_A_FORK, CONTRIBUTOR_BLOCKED, PROPOSAL_LIMIT_REACHED,
PROPOSAL_TOO_LARGE, RATE_LIMITED) with what to do. Each install
root the pull request covers keeps it as its contribution link, and
while that pull request reads open it stays the root's one pull
request: a later call sends the root's files as they stand now to
that pull request, advancing its branch by one commit whose tree is
the main of the world holding the branch (the origin, or the fork)
with the contribution laid over it (a file an earlier push changed
that the root no longer changes is put back as that main holds it,
and a main that moved since is merged in), in an outcome of its own (status = "open", its pr_number and branch, the root's paths, updated = true, or updated = false when the pull request already held the
files as they stand and nothing was pushed; roots sharing one pull
request share the outcome), while the origin's other roots go as one
new pull request; a merged or closed one, or one whose state cannot be
read, leaves the root to contribute afresh, and a root whose pull
request is found merged is first pulled again, so the call sends only
what its origin still lacks. dryRun answers the same way,
with plan for the roots it would send (naming the pull request a
root would be added to), and writes nothing. The Luau
a call sends is held to the script check a push of this world holds
the same files to: a root carrying an error a push would refuse is not
sent, and its outcome reads error naming each site. With merge = true the pull request is merged as it opens
when authorized — a refusal leaves it open and reported, never a
failure, its detail naming what the merge answered and the state and
mergeability the pull request reads after it; a merge whose answer is
not merged while the pull request reads merged goes on as merged — and
after a merge the local fork re-pulls so its origin pins advance and the
asset no longer reads as ahead.
Parameters
optsContributeOpts(optional) — OptionalContributeOpts—targets(origin world guids; default all ahead; one naming the world a dependency an install placed was published from, the guid of itsdeps/<guid>/folder, takes that dependency's changes, which with no target go to a pull request the dependency's root keeps open there and otherwise to the install's world),roots(install roots; default every installed asset ahead),merge(default false),title,description,dryRun.
Returns { ContributeOutcome } — Array of ContributeOutcome: for each targeted origin, one for the roots sent as a new pull request, and one per distinct open pull request some of its roots were added to (each names its pull request and only its own paths); status is open unless merged.
local r = world.contribute({})
globals/world/convertInstalls
world.convertInstalls(opts: { only: string?, dryRun: boolean? }?) -> { { root_path: string, rows_removed: number, overrides_kept: number, files_added: number, completion: string? } }
Bring installs that stand as pulled rows (an earlier engine landed each
file as a row of the world) into one record row each, the form
world.installAsset writes now. The record is built from the rows
themselves, written, and once this engine has materialized the install
from it the unchanged rows are taken out of the world; a file changed
since the install stays a row of the world. Nothing is committed: rows
that were committed leave as deletions in the next commit. Returns one
entry per install, and with dryRun writes nothing. Once the rows are
taken out the record is stated again from the published version it
names, so an install the old engine cut short holds every file of the
version: files_added counts the files that added, and completion
says why the record stayed as the rows stated it (the published
version unreachable, or an asset of it that does not load as its type).
Each install converts whole or not at all: when neither the published
version nor the record the rows state runs, the record is taken out and
the rows are written back, and once every other install is converted
the call raises naming each install that stands as it did and why.
The files stay where they stand and the call yields between its steps, so
it never holds a frame: a run that outlasts the execute budget continues
as a task.
Parameters
opts{ only: string?, dryRun: boolean? }(optional) —{ only?: string, dryRun?: boolean }:onlynames one install by its root path.
Returns { { root_path: string, rows_removed: number, overrides_kept: number, files_added: number, completion: string? } } — { { root_path, rows_removed, overrides_kept, files_added, completion? } }.
world.convertInstalls({ dryRun = true })
globals/world/createBranch
world.createBranch(name: string, fromCommit: string?, opts: { force: boolean? }?)
Create a branch — git branch <name> [<start>]. The branch
starts at fromCommit (defaults to the session branch's HEAD)
and gets its own working tree, materialized from that commit.
The session stays on its current branch; move onto it with
world.checkout("<branch>") (git checkout). With
{ force = true } (git branch -f) an existing branch is pointed
at fromCommit and its working tree rewritten to it, in one
transaction; that refuses only when the branch's working tree holds
uncommitted changes, which the rewrite would lose.
Parameters
namestring— The new branch name.fromCommitstring(optional) — Commit id to start at. Defaults toworld.head().opts{ force: boolean? }(optional) — Optional{ force: boolean? }.
world.createBranch("feature")
world.createBranch("feature", world.revParse("HEAD~1"), { force = true })
globals/world/deleteBranch
world.deleteBranch(branch: string, opts: DeleteBranchOpts?)
Delete a branch — git branch -d|-D <name>. Drops the branch and
the working tree it owns; its commits are left alone, since deleting
a branch is dropping the name and the tree under it, not rewriting
history. Without opts.force (-d) it refuses a branch whose
commits the session's branch does not hold, and one whose working
tree holds uncommitted changes, naming them, since those go with the
tree; { force = true } (-D) deletes it regardless. Refuses the
branch this session is on (check out another first) and the world's
last branch.
Parameters
branchstring— The branch to delete.optsDeleteBranchOpts(optional) — OptionalDeleteBranchOpts—force.
world.deleteBranch("feature")
world.deleteBranch("experiment", { force = true })
globals/world/derive
world.derive(name: string, spec: any?)
Register a computation whose output lands in the commit with the
content it is computed from. The hook (scope = "asset")
computes output inside each staged asset matches accepts, from the
asset as staged. Its fingerprint and compute are entries of
module, run on a worker.
Staging starts the work, and a required output that is not computed
holds the commit that carries it: world.commit seals the commit and
returns its id at once, and the commit lands with the outputs once
they are computed. When every required output is computed already,
world.commit returns after the commit landed. spec = nil removes it.
Parameters
namestring— What identifies the hook.specany(optional) — The hook, or nil to remove it.
world.derive("thumbs", { scope = "asset", output = "thumb.png", matches = function(ref) return ref.type == "texture" end, module = "@root::thumbs", fingerprint = "fingerprint", compute = "compute" })
globals/world/diff
world.diff(...: string) -> any
Mirror git diff's CLI arg shape. Returns per-file diffs
by default; pass --stat for summary stats, --name-only for
just paths. Positional commit ids drive the two sources;
--staged pivots to staged-vs-HEAD. ---separated args
scope the diff to specific paths, each read as world.add reads a
path: a relative one names the file under /zero/source, and both
sides of the diff compare the file at that one path. An absolute path
before -- scopes the diff the same way. --stage=<name> reads the named
staging area in place of the calling caller's own. A working-tree
file a .zmignore / .gitignore rule matches is left out, as
world.vcsStatus() leaves it out of dirty; --ignored diffs those
files too. A file the staging area holds and a path named after --
are diffed whatever rule matches them.
Parameters
...string— Variadic string args: flags, commit ids,--, path filters.
Returns any — Array of DiffFile tables (or string-list for --name-only).
local files = world.diff()
local files = world.diff("--staged")
local files = world.diff("abc", "def")
local names = world.diff("--name-only")
local files = world.diff("--staged", "--stage=fauna")
local names = world.diff("--name-only", "--ignored")
globals/world/diffUpstream
world.diffUpstream(root: string) -> { UpdateFile }
What your copy of an installed asset changed against the version
it was installed from — the diff zm diff <root> upstream prints.
One UpdateFile per file under root whose content differs from
its origin version (for an install's root, the files of the
dependencies it placed too, wherever they were moved), with the unified diff from the origin version
to yours for a text file (diff and hunks are nil for a binary
one). Empty when the installed asset holds no change of yours.
Parameters
rootstring— The installed asset's root path (or any path inside it).
Returns { UpdateFile } — Array of UpdateFile, sorted by path.
for _, f in ipairs(world.diffUpstream("/source/Doom.component")) do print(f.diff) end
globals/world/discard
world.discard(opts: StageOpts?)
Drop a staging area without committing. Live manifest dirty flags are preserved so the user can re-stage later. No-op if the area doesn't exist.
Parameters
optsStageOpts(optional) — Optional{ stage: string? }naming the staging area to drop. Omitted, the call drops the calling caller's own area.
world.discard()
world.discard({ stage = "fauna" })
globals/world/discardAll
world.discardAll(scope: string?) -> DiscardAllResult
Discard every change under a path in one operation — the whole
working tree by default. Every file edited since its commit goes back
to the committed version, every deletion comes back, and every file
no commit holds, an uncommitted install included, leaves the tree.
Each goes to trash first, where world.restore(<handle>) brings it
back. The paths a staging area holds stay, a staged file edited since
it was staged goes back to its staged copy, and a change another
account is making, a dependency another install records, and a file
listed only because its references moved (its bytes are the committed
ones) stay as well: they are named in kept. One backend operation takes the whole
scope back, and the call returns once the working copy reads as the
committed content. Every reference table that records a version taken
back, by this discard or an earlier operation, is derived again, so a
file whose table that leaves at the head's reads as the head holds it
and is neither discarded nor kept.
Parameters
scopestring(optional) — The VFS path to discard beneath; omitted, every path.
Returns DiscardAllResult — { discarded, paths, kept } — how many rows went back, which, and which rows under the scope stayed: another account or another install holds them, or only their references moved.
world.discardAll()
world.discardAll("/source/hud")
globals/world/discardFile
world.discardFile(path: string)
Discard a path's unstaged working edits, taking it back to what
it was staged or committed as — the git restore <path> shape. A
folder takes every file beneath it back with it, and a deleted
path comes back as its committed version. The stage is the
baseline when the path is staged, the last commit when it is not,
and where neither holds anything at or beneath the path there is
nothing to come back to, so the path goes away. A path that does hold
committed or staged content stays: the files no commit holds beneath
it (a new file in a folder, a scene's autosave overlay) are left where
they are, and where they are its only change the call raises naming
them and world.discardAll, which takes them out. Staging is left
exactly as it was; world.unstage
is the verb that changes it. One shot: edited bytes that revert to
a committed version are snapshotted to trash first, so that case is
recoverable via world.restore(<handle>); a deletion taken back
throws nothing away and leaves no trash entry. Returns once the
working copy reads as the reverted content: text reads back as
committed, and binary bytes are served at the committed version on
the next read. Errors when nothing at or beneath the path is dirty
(nothing to discard).
An installed asset is discarded by its root path, which puts the whole
install back at the version the branch head holds as one unit: its rows
leave the staging area and then return to their committed version, or go
away when no commit holds them. A dependency another install records too
stays. Another row of an install raises, naming the install and its
root. An install the world holds as one record (<dest>.pull) goes
back to what that record states: a file of it the world wrote comes
back as the install's file, the record staying as it is, and its
destination puts the record back at its staged or committed version
with every file of it the world wrote. A file of it the staging area
holds keeps its staged version. A file whose only difference from the
head is its reference table
(listed with the reason references moved) raises too, naming what
moved its references and the undo: moving the library pin back
(world.updateLibrary, or discarding the pin marker) or reverting the
moved asset. Every reference table that records a version the discard
takes back is derived again once it lands, so a file that references
the discarded asset reads as the head holds it when the asset does; a
file listed only for a table recording a version taken back earlier
is derived again the same way, and its discard is done when that
leaves it as the head holds it.
Parameters
pathstring— The VFS path whose unstaged edits to discard.
world.discardFile("/source/foo.luau")
world.discardFile("/source/Doom.component")
globals/world/dropDerived
world.dropDerived(outputPath: string, opts: { stage: string? }?) -> number
Leave the derived output at outputPath out of the commit. Only
an output whose hook is best-effort can be dropped; a required one is
refused, naming the other ways out (retry, provide, unseal), except
one whose asset holds no input file in the tree the commit lands on
nor in the working tree: the commit removes that asset, and its
output settles empty.
Parameters
outputPathstring— The output's VFS path.opts{ stage: string? }(optional) — Optional{ stage: string? }naming the staging area.
Returns number — How many reservations were dropped.
world.dropDerived("/zero/source/gold.material/extra.json")
globals/world/dropOwedWrites
world.dropOwedWrites(path: string?) -> { string }
Give up the changes this session still owes the world at path
and beneath it: the writes and removals vfs.pendingWrites() lists
there (a write the world never took included), the ones
world.syncStatus() names as conflicts or losses, and every stored
record of them on this machine, so no later boot re-applies one. Each
path then reads as the world's row holds it: the row's content, or
nothing where the world has no row. Returns the paths given up. The
bytes of a given-up change are not kept.
Parameters
pathstring(optional) — Canonical/sourcepath; defaults to the whole source tree.
Returns { string } — The paths given up, sorted.
world.dropOwedWrites()
world.dropOwedWrites("/zero/source/hud")
globals/world/fetch
world.fetch(branch: string?) -> FetchResult
Update the origin/<branch> remote-tracking ref — git fetch.
Mirrors the world's ZeroMind branch head into the local commit
history (no working-tree change) and reports how the session
branch relates to it: behind origin commits to pull, ahead
local commits to push, diverged when both, and sealed the
caller's sealed commits, which join the branch once their outputs
land and are ahead of origin beside ahead. A stale installed
pin or out-of-band ZeroMind change shows up here as behind —
reconcile with world.pull().
Parameters
branchstring(optional) — Remote branch to fetch. Defaults to the session branch.
Returns FetchResult — A FetchResult table.
local f = world.fetch()
globals/world/foldCopy
world.foldCopy(opts: { copy: string, into: string, dryRun: boolean? }) -> FoldCopyReport
Recovery for installed content that was copied by accident instead
of edited in place: fold the copy back into the installed asset it was
copied from. Editing installed content in place is the normal flow
(the install becomes a modified install zm pr create offers back);
a copy is a new asset with its own guid, disconnected from the
install, and nothing reconnects it on its own. This call does, when
asked: each file of copy is written over the file at the same path
inside into (the installed asset keeps its guid and becomes a
modified install), every reference this world authors that names the
copy or a file in it is rewritten to name the installed asset, and
the copy is removed. Nothing is committed. into must be installed
content (an install's root or a dependency it placed, as
world.installs() lists them, or an asset inside one); copy must not
be.
Parameters
opts{ copy: string, into: string, dryRun: boolean? }—{ copy: string, into: string, dryRun: boolean? };dryRunreports what would be written and changes nothing.
Returns FoldCopyReport — A FoldCopyReport.
world.foldCopy({ copy = "/source/vendor/pythonParser.module", into = "/source/deps/240544fe-7bcf-4c3f-b866-ffb7be8c55a9/Toolkit.package/modules/pythonParser.module", dryRun = true })
globals/world/forkLive
world.forkLive(opts: { source: string, sourceBranch: string?, maxBatches: number? }) -> number
Seed THIS (empty) world's live content from another world by
copying its whole manifest as clean Pulled rows — the
in-engine half of "fork a world". Provenance is preserved: each
row points at the content's ORIGINAL owner (a fork of a
fork-of-A still points at A), so the fork never claims to have
authored what it pulled. The copy runs server-side in bounded
batches (idempotent + resumable), looping until the source is
fully mirrored. Pair with world.add_all() + world.commit() +
world.push() to publish the fork.
Parameters
opts{ source: string, sourceBranch: string?, maxBatches: number? }—{ source, sourceBranch?, maxBatches? }—sourceis the source world GUID; branches default to"main";maxBatchescaps the batch loop (default 60 ⇒ up to ~120k entries).
Returns number — The number of pulled (dirty) rows now staged-pending on the fork.
world.forkLive({ source = "e89aa92e-4c1f-460e-acd8-73859dd3a346" })
globals/world/forkStatus
world.forkStatus() -> { ForkStatus }
Per-asset "ahead of origin" report — the fork analogue of git
status against an upstream. Every file of installed content whose
content diverges from the version it was installed at is listed: a
file of an install the world changed or added inside it, and a row
an earlier engine pulled whose content left its pinned version. The
list is partitioned by the world each change goes back to, as
world.contribute with no target sends it: a change to an install, a
change to a dependency it placed included, goes to the world the
install was published from, a change to a dependency whose root keeps
a pull request open in the world the dependency was published from
goes to that world (its entries name the dependency's root), and a
pulled row to the world that authored it. This is information for
judgment: decide whether a change belongs upstream, then
world.contribute.
Returns { ForkStatus } — Array of ForkStatus partitions.
for _, f in ipairs(world.forkStatus()) do print(f.origin_world, #f.entries) end
globals/world/head
world.head() -> string?
Return the current branch HEAD commit id, or nil if the branch has no commits yet.
Returns string? — The commit id string, or nil.
local id = world.head()
globals/world/installAsset
world.installAsset(opts: InstallAssetOpts) -> InstallAssetResult
Install a published asset into this world, pulling the asset and
every dependency it closes over and writing them into the source tree.
The world holds the install as ONE entry, the asset at its root path,
which stands for every file of the version and every dependency placed
beside it; every engine materializes the install's files from it, so a
file of the install is a change of the world only once it is edited.
The installed files are ordinary files: edit, move and rename them with
the usual tools, and zm status lists the install as ahead of its
upstream, which zm pr create <root> offers back to the world it came
from.
Returns once this engine has materialized the install and it runs.
Installing an asset where the world already holds it is safe to repeat:
rows at this version are left as they are, and rows of an earlier
version are moved to this one. A file of the world's own over a file of
the install whose version moves takes the new version: one holding the
installed bytes or the new ones leaves, so the new version's file
stands, and an edited text file takes the three-way merge of its edit
with the new version; a merge that conflicts keeps the world's file
and is named in conflicted. The root lands at at, else where the
world already installed it, else at /source/<name>; a copy of it the
world holds at this version anywhere else (another install's
dependency under /source/deps/) moves there, so the world holds the
asset once and everything that depends on it resolves to the moved
copy. A path holding another asset, or local
edits to this one, refuses the install. An install that does not
materialize, or does not run, puts the world's record back as it was:
a record it wrote where the world held none comes out again, so the
world holds nothing of it, and the record the world held for the
install is written back as it stood, so the world holds the install it
held. Either way the same install can simply be run again.
Parameters
optsInstallAssetOpts—{ guid }names the root asset to install;refinstalls it as a branch, a tag or a commit id of the world it is published from holds it, in place of the version that world ships. A ref that world does not resolve, or whose commit holds no version of the asset, refuses the install, naming the ref and why.
Returns InstallAssetResult — { assets_written, blobs_downloaded, root_guid, root_path, root_version, requires, deps, pending, problems, notices, releases, outcome, moved_from, record, files, merged_files, conflicted, timings }. requires lists the name require loads each installed module by: the root's own when the root is a module, else each module directly in it (require("modules.ringLayout") for a module installed at /zero/source/modules/ringLayout.module). releases names each dependency that runs as more than one copy, each loaded on its own: one the install lands at two releases, and one it lands in a recorded version's folder beside the copy the world's name reaches, with the release each runs and the files running it. For an install that moved the version the world held, merged_files names each file of the world's own that took the new version or its merge, and conflicted each whose edit conflicts with it. notices, when present, names each file the installed root's type requires that the published content lacks, and each finding a dependency's type's validate hook states for it; the install lands with either. record is the path of the install's row, files the number of files and folders it states, assets_written the number of them the install placed (the files the user deleted from the install stay deleted and are not counted; 0 when the asset was already present), timings the seconds each step took. outcome is installed, updated or already_present; moved_from names the copy the root moved from, nil when it moved from nowhere. blobs_downloaded counts the blobs the install fetched (bytes already cached cost none); pending lists the written paths still unreadable when the wait for them stalled, and is empty when every one reads back; problems names each reference site in the installed content that resolved to nothing in the world it was published from, and each file a folder version the install wrote holds at its version that ZeroMind gave no entry for, and is empty when every site resolves and every written folder holds all of its files. A folder version lands holding every file its version states: a file the closure leaves out of it is read from that version of the folder, and, when that version cannot be read, from the version of the folder holding it. A folder no read answers for is a line in problems naming it, its version and why the read failed.
local r = world.installAsset({ guid = assetGuid })
globals/world/installLibrary
world.installLibrary(opts: InstallLibraryOpts) -> InstallLibraryResult
Declarative cross-world dependency. Writes a single marker
file at /source/libs/@<name> whose body is the
zero/world-import/v1 JSON. The next commit ships it as one
regular manifest entry; ZM's import-derivation pass at
finalize-time decodes the marker and stamps the new commit's
imports[]. Unmodified library content never ships in the
importing world's tree: the engine fetches the pinned commit
from ZeroMind and mounts it as @<name>::<path>. The call
returns once the library is mounted (require("@<name>::…")
resolves and library.list() lists it), and raises naming why
when it does not mount, leaving the marker as it was before the
call. A marker already there whose library is mounted is
refused (move it with world.updateLibrary); one whose library
never mounted is replaced, so running the install again repairs it.
Parameters
optsInstallLibraryOpts— SeeInstallLibraryOpts.opts.worldis the upstream world's guid (required).opts.commitis the upstream commit_id to pin (optional; resolvesopts.reformainif omitted).opts.asis the local library name (defaults to the upstream world's slug).opts.refis the human-meaningful ref recorded in the marker.
Returns InstallLibraryResult summarising the install.
world.installLibrary({ world = "guid", as = "combat" })
globals/world/installedAssets
world.installedAssets() -> { InstalledAsset }
Every asset this world carries from ZeroMind, keyed by the
published guid it was pulled from. The read that answers "what is
actually in this world" by identity rather than by path — an
installed asset's local name can be chosen by the installer, so a
path is not the thing to check a pull against.
Every install is in it, whichever form it is stored in: each install
world.installs() lists and each dependency it placed, committed or
not, from the moment world.installAsset returns.
Returns { InstalledAsset } — An array of InstalledAsset sorted by local path, one per installed asset and dependency whose content the world holds (a deletion the next commit carries is none of them).
for _, a in ipairs(world.installedAssets()) do print(a.asset_guid, a.path) end
globals/world/installedLibraries
world.installedLibraries() -> { LibraryMarker }
The libraries this world has installed: one row per library marker
under /zero/source/libs, @builtin among them, sorted by name.
Returns { LibraryMarker } — { name, world_guid, requested_ref?, resolved_commit } per library: its name with the @, the world it comes from, the ref that was asked for and the commit it is pinned at.
for _, lib in ipairs(world.installedLibraries()) do print(lib.name, lib.resolved_commit) end
globals/world/installs
world.installs(opts: { rows: boolean? }?) -> { InstallInfo }
The installs this world holds, one entry each, committed or not,
whichever form each is stored in: record (one row, every engine
materializes the files from it) or rows (an earlier engine landed one
row per file, and world.convertInstalls brings it into one record).
Each names the version it was installed at (version, and version_id,
the id ZeroMind gives that asset version) and how many of its files
the world changed or added. An asset installed at more than one place
names the other places in also_at. A dependency the install keeps in
a recorded version's folder while the world holds another copy of the
asset where its name reaches (two releases running, each loaded on its
own) is named under releases. An install world.uninstall
removed is not listed, though its record stays while it places a
dependency something else uses.
Parameters
opts{ rows: boolean? }(optional) —{ rows: boolean? }:rows = falseleaves the row installs out, which reads no row of the world.
Returns { InstallInfo } — An array of InstallInfo sorted by path.
for _, i in ipairs(world.installs()) do print(i.root_path, i.form, i.files) end
globals/world/leave
world.leave() -> { [string]: any }
Leave the world world.bind bound and return the engine to waiting
for one: the world unloads, its content leaves /source, and another
world.bind binds the next. Asynchronous; the answer says whether the
leave started, and world.waitState().waiting reads true once it is done.
A leave made in play ends the play session: while that session holds
unaccepted changes the leave is refused with the accounting
engine.mode = "edit" gives, and engine.discardPlayChanges() arms the
next leave past it.
Returns { [string]: any } — { ok = true, worldGuid } or { ok = false, reason }.
world.leave()
globals/world/list
world.list() -> { WorldEntry }
List every world the authenticated user has access to.
Reads ZeroMind's GET /v1/me/worlds through the trusted ZeroMind
bridge, which answers without the world's live session, so an engine
bound to a world, an engine waiting for one and an offline engine
answer it alike. Flattens each entry to one record per world with
the role promoted to a top-level field.
Returns { WorldEntry } — Array of WorldEntry records.
local worlds = world.list()
globals/world/loading_screen
world.loading_screen -> any
Returns any
globals/world/log
world.log(opts: LogOpts?) -> { CommitRow }
The history of the session branch, newest first — git log:
every commit reachable from HEAD through both parent edges, so a
merged branch's commits and a pulled commit appear along with the
commits recorded on this branch. opts.rev starts the history at
another revision (git log <rev>). Pass opts.path to get the
per-path history (git log -- <path>): only the commits that
touched that file, newest-first.
Parameters
optsLogOpts(optional) — Optional.opts.limitcaps the number of commits (default 50, 0 = all).opts.revnames where the history starts.opts.pathscopes the log to one file.
Returns { CommitRow } — Array of CommitRow tables.
local commits = world.log({ limit = 20 })
local merged = world.log({ rev = "feature" })
local touched = world.log({ path = "/source/foo.luau" })
globals/world/merge
world.merge(sourceBranch: string, opts: MergeOpts?) -> MergeResult
Merge another branch into the session branch — git merge <source>. The merge runs locally in the world's SpacetimeDB clone
and is abortable with world.mergeAbort; nothing reaches ZeroMind
until the result is pushed. When the session branch's head is in
the source's history the head fast-forwards onto it (unless
opts.noFf); otherwise a two-parent merge commit lands
(opts.ffOnly refuses that). Local changes follow git's rule: one
on a path the merge does not rewrite stays in the working tree, and
one on a path it does rewrite refuses the merge with git's message
naming the paths. A scene's unsaved live edits are a local change
to its scene.json: a fast-forward refuses over a scene whose
scene.json it rewrites, naming the scene and how to save or
discard the edits, and a merge commit refuses over any scene holding
them. A staged entry refuses a merge commit. Conflicts →
git-style markers are projected into each conflicting text file,
the cleanly-merged remainder is applied as working-tree changes, and
world.vcsStatus().unmerged lists what needs attention: resolve
each path (edit out the markers, or take one side whole), then
world.add + world.commit — that commit records the merge
(second parent = the source head) and clears the unmerged set.
Parameters
sourceBranchstring— The branch to merge in.optsMergeOpts(optional) — OptionalMergeOpts—ffOnly,noFf.
Returns MergeResult — A MergeResult — status is fast_forward or clean (with commit), conflicts (with conflicts), or up_to_date.
local r = world.merge("feature")
local r = world.merge("feature", { noFf = true })
globals/world/mergeAbort
world.mergeAbort()
Abort the in-progress merge — git merge --abort. Clears the
unmerged set and restores the working tree to the pre-merge state
(the target head's committed content; the branch head never moved
during a conflicted merge). Errors when no merge is in progress.
world.mergeAbort()
globals/world/offLoaded
world.offLoaded(handle: number) -> boolean
Stop a callback registered with world.onLoaded from running.
Parameters
handlenumber— The handleworld.onLoadedreturned.
Returns boolean — true when the handle matched a registered callback.
world.offLoaded(h)
globals/world/offSaved
world.offSaved(handle: number) -> boolean
Stop a callback registered with world.onSaved from running.
Parameters
handlenumber— The handleworld.onSavedreturned.
Returns boolean — true when the handle matched a registered callback.
world.offSaved(h)
globals/world/offUnloaded
world.offUnloaded(handle: number) -> boolean
Stop a callback registered with world.onUnloaded from running.
Parameters
handlenumber— The handleworld.onUnloadedreturned.
Returns boolean — true when the handle matched a registered callback.
world.offUnloaded(h)
globals/world/onLoaded
world.onLoaded(cb: (...any) -> ()) -> number
Register a callback to run after a world finishes loading.
Parameters
cb(...any) -> ()— Called when the event fires, with whatever the event supplies.
Returns number — Handle for world.offLoaded.
local h = world.onLoaded(function() log.info("loaded") end)
globals/world/onSaved
world.onSaved(cb: (...any) -> ()) -> number
Register a callback to run after a world is saved.
Parameters
cb(...any) -> ()— Called when the event fires, with whatever the event supplies.
Returns number — Handle for world.offSaved.
local h = world.onSaved(function() log.info("saved") end)
globals/world/onUnloaded
world.onUnloaded(cb: (...any) -> ()) -> number
Register a callback to run after a world is unloaded.
Parameters
cb(...any) -> ()— Called when the event fires, with whatever the event supplies.
Returns number — Handle for world.offUnloaded.
local h = world.onUnloaded(function() log.info("unloaded") end)
globals/world/orientation
world.orientation -> string
Returns string
globals/world/prCheck
world.prCheck(worldGuid: string?, number: number, opts: { suites: { string }?, name: string? }?) -> any
Run test suites against a pull request's head in this engine and
post the result on it as a check. The engine holds the head when it is
bound to the request's source world, on its source branch, at the
commit the request stands at, with nothing uncommitted and nothing
untracked: for a branch of this world,
world.checkout(<source branch>); for a proposal from a fork, an
engine on the fork. Anything else is refused, naming what
differs. The suites run as tests.run({ suites }) runs them (left
out, every suite the world holds). The check is failure when a test
failed, success when the tests that ran all passed, and error when
the run reached no verdict (a suite asked for that matched none, or
every test skipped); its summary is the counts, the runner's note and
the failing tests.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.opts{ suites: { string }?, name: string? }(optional) — Optional{ suites, name }: the suite names to run, and the check's name (defaulttests).
Returns any — { check, head, stats, failures }: the check as ZeroMind stored it, the commit it ran on, the run's counts and its failing tests.
world.prCheck(originGuid, 3, { suites = { "door" } })
globals/world/prChecks
world.prChecks(worldGuid: string?, number: number) -> any
The checks on a pull request — gh pr checks: each test result
posted on its head (head), then those posted on heads it has moved
past (outdated). Each names its poster and poster_relation
(author, member of the world, or outside); one another account
posted carries untrusted = true.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.
Returns any — { head, checks, warning }.
local c = world.prChecks(originGuid, 3)
globals/world/prClose
world.prClose(worldGuid: string?, number: number, opts: { reason: string?, comment: string? }?) -> any
Close a pull request without merging it — gh pr close. reason
is not_planned, duplicate, superseded or withdrawn; left out,
ZeroMind records withdrawn for a close by its author and
not_planned for one by the world's owner. comment is posted on
its thread first, so the author reads why. An open or draft request
closes; a closed or merged one is refused, naming its state, before
anything is posted. A closed request is reopened with
world.prReopen.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.opts{ reason: string?, comment: string? }(optional) — Optional{ reason, comment }.
Returns any — The pull request as ZeroMind then states it (state, close_reason, closed_by), marked by who opened it, with closing_comment when a comment was posted.
world.prClose(originGuid, 3, { reason = "superseded", comment = "Landed in #4 instead." })
world.prClose(nil, 3)
globals/world/prComment
world.prComment(worldGuid: string?, number: number, body: string, opts: { path: string?, parent: string? }?) -> any
Comment on a pull request's thread — gh pr comment. The author
and the world's owner read it in world.prView. The world this
engine is bound to is kept as the one the thread was written in from,
so a reply in it reaches the agents working there.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.bodystring— The comment, 1 to 10000 characters.opts{ path: string?, parent: string? }(optional) — Optional{ path, parent }:paththe file the comment is about (relative to the world's root),parentthe id of the comment it replies to.
Returns any — The comment as ZeroMind stored it.
world.prComment(originGuid, 3, "The hinge reads well; the door mesh is still the old one.")
world.prComment(nil, 3, "This table is unused.", { path = "door.component/init.luau" })
globals/world/prConflicts
world.prConflicts(worldGuid: string?, number: number) -> any
Read a pull request's conflicts — what stands between it and a
merge. Returns the mergeability verdict, the merge base, both
heads, and one entry per conflicting path. A conflicting TEXT path
carries marked_text: the same <<<<<<< / ======= / >>>>>>>
rendering a merge leaves in the working tree, with the source and
target sides laid against their common ancestor. Resolve a path by
writing the settled bytes back to it and committing on the source
branch; the pull request re-analyses on the next read. A binary
path carries the two sides' hashes and no text — pick a side.
A mergeable pull request returns an empty conflict list.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the bound world.numbernumber— The pull request number.
Returns any — Decoded ZeroMind conflicts response.
local c = world.prConflicts(nil, 3)
for _, m in ipairs(world.prConflicts(originGuid, 3).markers) do print(m.path, m.marked_text) end
globals/world/prList
world.prList(worldGuid: string?, number: number?) -> any
List a world's pull requests, or fetch one. The list is
{ pulls, total, warning }, and one pull request is its record with
warning. A pull request's title and description are its
author's: each one another account opened carries untrusted = true,
each this engine's own account opened untrusted = false. One pull
request's reviews (each reviewing account's latest verdict) and
checks are marked the same way, by reviewer and by poster.
Parameters
worldGuidstring(optional) — The world whose pull requests to read. Defaults to the session world.numbernumber(optional) — A specific pull request number. Omit for the list.
Returns any — Decoded ZeroMind response, marked.
local prs = world.prList()
globals/world/prMerge
world.prMerge(worldGuid: string, number: number, strategy: string?) -> any
Merge a pull request — the agent-side merge button. The answer
carries the merged pull_request record with warning: its title
and description are its author's, and the record carries
untrusted = true when another account opened it. The merge waits
for ZeroMind's own answer. A merge that does not answer merged is read
back: a pull request that reads merged then answers { pull_request }
as read, and any other raises naming what the merge answered and the
state and mergeability the pull request reads.
Parameters
worldGuidstring— The world the pull request lives in.numbernumber— The pull request number.strategystring(optional) —merge(default),squash, orfast_forward.
Returns any — Decoded ZeroMind merge response, its pull request marked.
world.prMerge(originGuid, 3)
globals/world/prOpen
world.prOpen(opts: PrOpenOpts) -> any
Open a pull request — gh pr create. Proposes the work on one
(world, branch) pair to another. Defaults make the common cases one
argument: from a fork, the target is the world it was forked from, so
world.prOpen({ title = "..." }) proposes your work upstream. In an
ordinary world the target is the same world, so you get a
branch → main pull request.
The PR lives in — and is numbered by — the world it targets, exactly
as a forge numbers pull requests on the upstream repository. That is
also where world.prList finds it.
Parameters
optsPrOpenOpts—title(required), plusdescription,sourceWorld,sourceBranch,targetWorld,targetBranchto address any leg explicitly.
Returns any — The decoded ZeroMind pull request.
world.prOpen({ title = "fix the door hinge" })
world.prOpen({ title = "port the fix", targetWorld = otherGuid })
globals/world/prReopen
world.prReopen(worldGuid: string?, number: number) -> any
Reopen a closed pull request — gh pr reopen. The world's
contributors reopen any; its author's account reopens one its own
account closed. A pull request that is open, draft or merged is
refused, naming its state.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.
Returns any — The pull request as ZeroMind then states it, marked by who opened it.
world.prReopen(originGuid, 3)
globals/world/prReview
world.prReview(worldGuid: string?, number: number, verdict: string, body: string?, opts: { expectedHead: string? }?) -> any
Review a pull request — gh pr review. verdict is approve
(ready to merge as it stands), request_changes (needs changes first)
or comment (a remark with no verdict). The review is pinned to the
head the pull request stands at; a later push leaves it outdated. A
review never merges or closes the request, and its author's own
account is refused (OWN_CONTENT).
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.verdictstring—approve|request_changes|comment.bodystring(optional) — Optional text, at most 16 KiB.opts{ expectedHead: string? }(optional) — Optional{ expectedHead }: the head you read (world.prView'sanalyzed_source_head); ZeroMind refuses the review (CONFLICT) when the request has moved past it.
Returns any — The review as ZeroMind stored it, version naming the head it judged.
world.prReview(originGuid, 3, "approve", "Ran the door suite; it passes.")
world.prReview(nil, 3, "request_changes", "The hinge angle is clamped twice.")
globals/world/prView
world.prView(worldGuid: string?, number: number, opts: { after: string?, limit: number? }?) -> any
Read one pull request in full — gh pr view. Returns the record
plus a LIVE re-analysis against the current branch heads: mergeability
(clean / conflicts / fast_forwardable / up_to_date /
unrelated), conflict_count, and diff — every path the request
adds, modifies or deletes with its checksums. Read this before merging:
it is what tells you WHAT the request changes. Its title and
description are the author's: the record carries untrusted = true
when another account opened it, and warning says what that means.
The review rides with it: comments (a page of the thread, oldest
first, each with the path it is about and the parent it replies
to; comments_next_cursor while more follow), reviews (every
reviewing account's verdict on every head it judged, newest first:
verdict, body, version the head, outdated once the request
moved past it) and checks (each test result posted on its head,
checks_head, then those on heads it moved past, outdated). Each
comment, review and check another account wrote carries untrusted = true. When the review cannot be read, thread_error says why, and
reviews and checks are the record's own: each reviewing account's
latest verdict (reviewer, verdict, head, outdated) and the
checks on its head, each marked the same way.
Parameters
worldGuidstring(optional) — The world the pull request lives in (its target world). Defaults to the session world.numbernumber— The pull request number.opts{ after: string?, limit: number? }(optional) — Optional{ after, limit }:afteracomments_next_cursorto read the thread after,limitthe page's size (1 to 200).
Returns any — The decoded pull request view, with its review.
world.prView(nil, 1)
world.prView(originGuid, 3, { after = view.comments_next_cursor })
globals/world/previewInstall
world.previewInstall(opts: InstallAssetOpts) -> PreviewResult
Preview what installing an asset WOULD write, without writing
anything. Fetches + decodes the closure and plans placement (the
same helpers world.installAsset uses), returning a flat node
list plus rollup totals. A truncated closure is reported (not
raised) so a caller can surface it and block import.
Parameters
optsInstallAssetOpts—{ guid, at?, ref? }— same shape as installAsset.
Returns PreviewResult: nodes, totals, a truncated flag, the other worlds the content reaches into, and a line for each folder version whose files no read gave.
world.previewInstall({ guid = "..." })
globals/world/provideDerived
world.provideDerived(outputPath: string, opts: { stage: string? }?) -> number
Take the file at outputPath as the derived output: the file you
wrote is staged as it stands, and the reservation is settled done
with the fingerprint authored, which no recomputation replaces.
Parameters
outputPathstring— The output's VFS path; the file must exist.opts{ stage: string? }(optional) — Optional{ stage: string? }naming the staging area.
Returns number — How many reservations the file filled.
world.provideDerived("/zero/source/gold.material/preview.png")
globals/world/publishBlockers
world.publishBlockers(opts: StageOpts?) -> { PublishBlockerClass }
List every reason world.push would refuse to publish this
world, as one entry per blocker class: script errors in user
content (script), assets that don't meet their type's content
requirements (content), guids two of the world's own assets state
between them, each path named (sharedGuid), computed asset references a component or
scene entrypoint reaches (staticPin), and the conditions the
publish gate refuses on: a component or scene entrypoint reaching a
dynamic resolve over require/tools.use (gameplayPath), a reference
pinned to an asset the world no longer holds (references), a
reference that names nothing a published world holds, with the file
and line carrying it (unresolvedReferences), a
reference of the world's own file recorded before the world pinned
the library it names (pinPending, which the commit that takes the
file clears by deriving its table at the pin), an error-severity
problem recorded on published content (problems), and an installed
package that content the push publishes requires while the commit
holds no install record of it, so a copy of the published world opens
without it (installs, cleared by staging the package's folder). The
publish gate's classes (gameplayPath, references,
unresolvedReferences, pinPending, problems, installs) are read
over the tree the push releases:
the branch head's commit, each file with the reference table that
commit froze for it, so a file the commit holds and the working tree
no longer does is named, and its class's remedy names the zm add of
its path that stages its removal. A world with no commit yet is read
as the engine holds it, the tree its first commit freezes.
Each class
carries the same title the refusal prints, one items entry per
offending subject (an asset identity, or a <path>:<line> site),
and the single remedy covering that class. This is the account
world.push composes its refusal from, so it names the same
blockers with no push attempted — and in full, where a refusal
bounds how many of a class it prints. zm status prints this list.
One more class blocks the next commit rather than the publish, and
carries blocks = "commit": staleReferences, the files the caller's
staged set holds or leaves out whose references do not resolve in it
(a file whose references moved with a staged change and is left out, or
a staged file stating a version the staged set leaves out). It is the
class world.commit refuses with; world.push never reads it, since
a push publishes what is committed. Empty list = the caller commits
and publishes.
Parameters
optsStageOpts(optional) — Optional{ stage: string? }naming the staging area the read acts on, so acontentitem another area holds names that area in itsstage. Omitted, the read acts on the calling caller's own area.
Returns { PublishBlockerClass } — Array of PublishBlockerClass entries, empty when nothing blocks.
for _, c in ipairs(world.publishBlockers()) do
for _, i in ipairs(c.items) do print(c.kind, i.subject, i.detail) end
end
globals/world/pull
world.pull(branch: string?, opts: PullOpts?) -> PullResult
git pull: fetch origin/<branch> (default the session branch)
and merge it into the session branch. When the session branch is
strictly behind, its head fast-forwards to the fetched commit; when both
sides moved, a two-parent merge commit lands with the same
conflict/marker/resolve flow as world.merge (resolve the unmerged
paths, then world.add + world.commit; abortable with
world.mergeAbort); when the fetched commit is already in the session
branch's history nothing changes. opts.ffOnly refuses anything but a
fast-forward; opts.noFf always makes a merge commit. Local changes
follow git's rule, as world.merge's do, unsaved scene edits
included. A branch origin does not
hold raises.
Parameters
branchstring(optional) — The origin branch to pull. Defaults to the session branch.optsPullOpts(optional) —{ ffOnly?, noFf? }.
Returns PullResult — A PullResult table: status is up_to_date, fast_forward (commit the new head), clean (commit the merge commit) or conflicts (conflicts).
local r = world.pull()
local r = world.pull("feature")
local r = world.pull("main", { ffOnly = true })
globals/world/pullAsset
world.pullAsset(opts: PullAssetOpts?) -> PullAssetResult
Pull upstream changes into a previously-installed asset. Re-resolves
the root's transitive closure at opts.ref (default latest) and lands
only what differs from what the world holds (M.__updateRowPlan):
- A file the world never edited (its bytes equal the version it installed) lands whole when its version, its reference table or a stale conflict flag differs from the closure's: bytes and table are written to the pulled row in one step, text and binary alike, and the write reaches source whatever the engine's mode.
- A file the world edited is reconciled from
(row.origin_checksum, row.checksum, entry.checksum)(M.__reconcileDecision):noop(upstream unmoved) leaves it alone,convergedadvances its origin pointer, andmergeruns a three-wayvcs.merge3over (base, local, theirs): a clean result is written and the origin pointer advances, a conflicted result is written WITH markers and the row is flagged conflicted (base + theirs checksums recorded forworld.resolvePullConflict). A binary file the world edited that upstream changed too is flagged conflicted with the structured base/theirs checksums (no marker write). - A folder moves to the closure's version and takes its table.
- A row flagged conflicted that holds the bytes it installed carries no local content: it does not block the pull, and the pull clears it.
Closure drift: an entry the original install never landed is pulled fresh (added). A locally-pulled row nested under the root's own directory whose origin entry disappeared from the closure is removed when it holds the bytes it installed (pruned), or flagged conflicted when it carries edits.
Parameters
optsPullAssetOpts(optional) — SeePullAssetOpts.opts.guidoropts.pathis required;opts.refpins the re-resolve to a branch, a tag or a commit id of the world the asset is published from (defaults to the version that world ships).
Returns PullAssetResult summarising what merged, conflicted, was pruned, and was newly added, the version of the root it landed (root_version), and the reference sites in the pulled content that resolved to nothing where it was published (problems).
world.pullAsset({ guid = "..." })
globals/world/push
world.push(commitId: string?, opts: PushOpts?) -> (string? | PushQueued, string)
Publish the current branch to ZeroMind. The no-argument form
is a git merge --squash push: EVERY unpushed commit on the
branch collapses into a SINGLE ZeroMind commit (latest content
per path, parented on the branch's current remote HEAD). Because
only the merged final state's bytes are uploaded, a superseded or
lost intermediate-commit blob can never break the push — this is
what makes a churn-heavy world publishable. The local commit
history is preserved as the editing journal; on success every
squashed commit shares the one remote commit id. The explicit
commitId form still pushes that single commit verbatim via
publish_commit (advanced / chain-replay use; its parent must
already be on the remote). While commits are sealed behind derived
outputs, the ready ones land first and the push is queued on the
newest one left that can land. A sealed commit the backend refuses to
land holds only the commits sealed after it that stage a path it
stages; the push publishes the branch without them, and when none of
the sealed commits can land it publishes at once. A push that leaves
sealed commits out warns naming each, with its refusal or the refused
commit it is queued behind, and the zm unseal that returns a commit
to the staging area. With
opts.wait the call waits for the queued push to run and answers
what it answered: the commit id and verdict when it published, a
raise carrying ZeroMind's refusal when it was refused or a sealed
commit it waits for could not land, and a raise saying the push is
still queued, with what it waits on, or still being sent, with its
outcome not known, when the wait ended first. The queued push runs
whatever the wait answers, and zm status states a refused one.
A folder asset of an install that holds a file the world edited,
added or deleted is published as a version of its own under this
world: the checksum its files add up to, each unedited file of it
carried at the version its origin world published
(worldVcs.__installEditsFor). Content of the world that references
the edited asset names that version.
Parameters
commitIdstring(optional) — Optional. A single commit to push verbatim. Omit for the squash push of the whole unpushed stack (the normal path). A push only moves the remote branch forward, as git's does: a remote head no local commit holds raises git's! [rejected] <branch> -> <branch> (fetch first), and one the local head does not descend from raises(non-fast-forward);world.pull()first.opts.forceisgit push --force: a branch whose head is already published moves the remote branch there regardless (a Maintainer's call). A branch with commits not yet published is refused with force, nothing sent (pull first), and so is force withcommitId: force moves the session branch.optsPushOpts(optional) — OptionalPushOpts:stagenames a staging area, the way every other staging verb takes it,forceforces the move, andwait(seconds, ortruefor 120) waits for a queued push to run. The pre-push content gate refuses over every asset the push publishes that falls short of its type's contract, whichever area staged it, and names beside each one the other area holding it, when one does. Omitted, the call acts on the calling caller's own area.
Returns (string? | PushQueued, string) — Two values: the ZeroMind-allocated commit id, and the verdict. "published" with the new commit id when this call published; "already-published" when ZeroMind already carries what this call would have published — the state a push asks for, so it returns rather than raising. That verdict carries the commit's existing ZeroMind id when the publish names one (the single-commit form), and a nil id when it names none (the whole-stack form, which reports a chain). A squash whose merged final state carries dep.unresolved problems takes the slow path inside the same call: the engine re-resolves each pending literal against its live asset index and submits the resolutions to the publish procedure, which completes the push. A reference literal that still resolves to nothing is published with the asset holding it and stays a problem recorded on that asset, while a dep pin the squash severed raises instead; either way the engine names each one with its path, line, reference and reason. A publish ZeroMind refuses raises with ZeroMind's code and message and the action that clears it, chosen by the code: a branch that moved under this push names world.pull(), and a release version already taken names a new version, or, for an asset this world installed from another world as one row per file, the world.convertInstalls call that publishes its changes as this world's.
local zmId = world.push()
local zmId, verdict = world.push()
local queue, verdict = world.push() -- verdict "queued" while commits are sealed
local zmId, verdict = world.push(nil, { wait = 120 }) -- waits for a queued push to run
world.push("01HABC...")
globals/world/reidentify
world.reidentify(path: string) -> { path: string, previousGuid: string, guid: string, rederived: { string } }
Give the asset at path a guid of its own when another asset of
this world states the same guid (the sharedGuid class
world.publishBlockers and zm status report). The asset keeps its
path and its bytes and takes a freshly minted guid (its files are
removed and written back); the other asset
keeps the guid they shared. Every reference table the world authored is
then derived again, so each reference resolves the asset its literal
names at the version that asset holds: a reference that means this
asset follows it to its new guid, and one that means the other keeps
the shared guid.
Parameters
pathstring— The asset to give its own guid: the copy of the pair.
Returns { path: string, previousGuid: string, guid: string, rederived: { string } } — { path, previousGuid, guid, rederived }, where rederived lists the files whose reference table changed.
local r = world.reidentify("/source/systems/movement/CapsuleWalker.component")
globals/world/reload
world.reload() -> { started: boolean?, guid: string?, branch: string?, error: string? }
Run the bound world again from the top, the way a fresh boot into it
would: the world unloads, its content is taken again, its entrypoint and
startup scene run. The load is asynchronous; the answer says whether it
started. An engine with no world bound answers { error }.
Returns { started: boolean?, guid: string?, branch: string?, error: string? } — { started = true, guid, branch } or { error = string }.
world.reload()
globals/world/remoteBranches
world.remoteBranches() -> { { branch: string, commit_id: string, origin_head: string } }
Origin's branches as the last fetch of each recorded them — git branch -r. One row per branch of this world that world.fetch has
fetched: branch is origin/<name>, commit_id the local commit
that names origin's head, origin_head that head's ZeroMind id.
Returns { { branch: string, commit_id: string, origin_head: string } } — Array of { branch, commit_id, origin_head }, sorted by branch.
for _, r in ipairs(world.remoteBranches()) do print(r.branch) end
globals/world/removeUnusedDeps
world.removeUnusedDeps(opts: { dryRun: boolean?, only: any? }?) -> RemoveUnusedReport
Remove the dependency copies under /zero/source/deps/ that
nothing in this world uses, or with dryRun only list them. A
dependency is used when an install record lists it, when a source of
the world (its own content or an install's) has a reference site that
runs a copy in it, or when a used dependency has such a site. A site
runs one copy of what it names, so a recorded version's copy under
versions/ is used only by the sites that run that version. A
dependency an install placed is deleted from that install's record;
one the world holds as files of its own (written by hand, or left by
an earlier engine's install) is removed as files. Nothing is
committed: removed files leave as deletions in the next commit, and a
changed install record is a change the next commit carries. The
engine posts a notice whenever the world comes to hold unused
dependencies, naming them.
Parameters
opts{ dryRun: boolean?, only: any? }(optional) —{ dryRun?: boolean, only?: string | { string } }:onlyholds the call to the dependencies at or under those paths.
Returns RemoveUnusedReport — { dry_run, removed = { { path, guid?, files, placed_by?, modified } }, failed = { { path, reason } }, note }: removed lists what went (with dryRun, what a call without it removes), and modified the files in a dependency this world changed or wrote.
world.removeUnusedDeps({ dryRun = true })
world.removeUnusedDeps()
world.removeUnusedDeps({ only = "/zero/source/deps/0d6c9a2e-4b1f-4c3e-9a7d-2f5e8b1c4d6a" })
globals/world/renameBranch
world.renameBranch(oldName: string, newName: string, opts: { force: boolean? }?)
Rename a branch — git branch -m <old> <new>. The branch's
head and history, and your uncommitted changes on it, go to
newName; when oldName is the branch this session is on, the
session moves with it. Another caller's uncommitted changes on
oldName keep that branch in place beside the renamed one.
Parameters
oldNamestring— The branch to rename.newNamestring— Its new name.opts{ force: boolean? }(optional)
world.renameBranch("feature", "feature-2")
globals/world/reset
world.reset(target: string, opts: ResetOpts?) -> ResetResult
Move the session branch's head to target — git reset [--soft|--mixed|--hard] <commit>. target is any revision
world.revParse reads (a commit id, HEAD~1, a branch, ...).
opts.mode: soft keeps the staged entries and the working tree
and stages every path whose committed version the move changed;
mixed (the default) empties your staging area and keeps the
working tree, so a path the move changed reads as a local change;
hard empties your staging area and brings the working tree to
the new head: every path the move changed, every path your account
changed, and every file of your account's that no commit holds
(an uncommitted install and a scene's autosave overlay included),
each to trash first. A write this session owes the world and the
world is not taking is given up (world.dropOwedWrites). The local
changes of another account stay and are listed in kept. A target equal to HEAD moves nothing, so
world.reset("HEAD") unstages everything and world.reset("HEAD", { mode = "hard" }) discards your local changes. Non-destructive
for history: every commit the head leaves behind becomes a trash
entry that re-attaches it (in chain order).
opts.stage names a staging area, any caller's: world.reset("HEAD", { stage = name }) empties that area, its staged changes and the
outputs it reserves for them, and moves nothing else; the working
tree keeps every edit. emptied says what it held. The name reaches
the area of your account, and when that holds nothing the areas other
accounts hold under it, each named in a warning. A sealed commit of
that name stays sealed (world.unseal returns it to the emptied
name). With a stage named, a target other than HEAD and the soft
and hard modes are refused: they move the branch or the tree, which
a staging area does not hold.
Parameters
targetstring— The revision to move the head to.optsResetOpts(optional) — OptionalResetOpts:mode,stage.
Returns ResetResult — A ResetResult — the new head, its subject line, and the commits left behind.
world.reset("HEAD~1")
world.reset("01HABC...", { mode = "hard" })
world.reset("HEAD", { stage = "client:#chapter4" })
globals/world/resolveConflict
world.resolveConflict(path: string, mode: string, content: string?) -> ResolveResult
Resolve one /source record this session owes the world, one
path at a time: a conflicted one, or one whose write or removal the
server refused or the queue gave up on (unsaved_writes in
world.syncStatus()), which waiting never carries and which holds a
world.swap or world.checkout away from the world until it is
settled here.
mode is merge | apply | take-local | take-backend |
discard. merge returns { merged, clean } and mutates nothing
— a clean merge can be finalized with apply, and a conflicted one
carries <<<<<<< / ======= / >>>>>>> markers to edit first. apply
writes the finalized content to /source; take-local writes the
retained local bytes; take-backend / discard keep the backend
head. For a removal (deleted in world.syncStatus().conflicts),
take-local removes the path again and merge errors, since a
removal holds no content to merge. A move or a folder row the server
refused or the queue gave up on is settled at either of its paths:
take-backend / discard give it up and show the world's rows at its
paths again, and the other modes error, since it holds no content of
its own; vfs.move makes the move again. Errors when the record is absent,
a merge has no common ancestor, hits binary content or has sides
that differ from the ancestor by more than the line diff's step
bound (the error names the path), or a write fails.
Parameters
pathstring— Canonical/sourcepath of the conflicted record.modestring— One of merge | apply | take-local | take-backend | discard.contentstring(optional) — Finalized bytes forapplymode.
Returns ResolveResult
world.resolveConflict("/zero/source/foo.luau", "take-local")
local r = world.resolveConflict(p, "merge"); if r.clean then world.resolveConflict(p, "apply", r.merged) end
globals/world/resolvePullConflict
world.resolvePullConflict(path: string, choice: string)
Resolve a conflicted row. A TEXT conflict is one where the file
currently contains conflict markers (world.pullAsset writes
markers only for a text three-way merge that didn't resolve
cleanly); a BINARY/composite conflict has no markers — the local
bytes were left untouched.
choice = "theirs" fetches clean upstream text by content hash
(conflict_theirs_blob_sha256 — path/rename-independent, since
blobs are content-addressed) and overwrites the local file with it
before clearing the flag. It errors, refusing to guess, when the
row records no theirs blob (a binary/composite conflict — a text
blob read can't address theirs for those; keep "ours" or
re-install the asset instead).
choice = "ours" keeps the local side. When the file carries
conflict markers, the local side is reconstructed from them (the
marker writers put ours first, so dropping each block's base and
theirs sections restores your bytes exactly) and written back;
a marker-free file is kept as-is. Either way the flag clears.
Either way, staging the resolved file (world.add) is the normal
git-add path once this returns — this call only clears the
manifest-level flag and (for "theirs") the file content.
Parameters
pathstring— The conflicted row's local VFS path.choicestring—"ours"or"theirs".
world.resolvePullConflict("/source/combat/rules.luau", "theirs")
globals/world/restore
world.restore(handle: any?)
Restore one trash entry by row_id. Errors verbatim on
handler-not-yet-implemented / world-mismatch. An entry holding content
(a discarded edit, a removed file or folder) returns once the working
copy holds that content again, and every file whose reference table
pins it is derived again, so it names the version the world now holds
and world.vcsStatus lists it as references moved, as after a local
write of that content.
Parameters
handleany(optional) — The trash row id. May be a number or a numeric string.
world.restore(42)
globals/world/retryDerived
world.retryDerived(outputPath: string, opts: { stage: string? }?) -> number
Compute the derived output at outputPath again, on the staging
area or on a sealed commit that reserves it. A reservation that
failed, was dropped or is done is reserved anew and computed from
the inputs as they stand; a sealed commit waiting on it lands when
it is done.
Parameters
outputPathstring— The output's VFS path, aszm statusnames it.opts{ stage: string? }(optional) — Optional{ stage: string? }naming the staging area.
Returns number — How many reservations were computed again.
world.retryDerived("/zero/source/gold.material/preview.png")
globals/world/revParse
world.revParse(rev: string) -> string
The commit a revision names — git rev-parse <rev>. A revision
is HEAD, a branch, origin/<branch> (as the last fetch of that
branch recorded it), the name of a branch only origin holds once it
is fetched (world.fetch(branch), such as a pull request's source
branch), a commit id, a ZeroMind commit id (the published commit a
fetch, a push or a pull request names) or a unique prefix of either,
each optionally followed by ~N (N first parents back), ^ (the
first parent) or ^2 (a merge commit's second parent). Raises git's
message for a revision that names nothing, HEAD on a branch with no
commit included.
Parameters
revstring— The revision.
Returns string — The commit id.
local id = world.revParse("HEAD~1")
globals/world/revertUpdate
world.revertUpdate(library: string)
Revert a library update the working tree holds, as one change: the
pin marker goes back to the version the branch head holds, every
file whose table moved with it is derived again against that pin, and
the versions the move recorded leave, so the tree reads as the head does. The update leaves the staging area
first. A file you edited after the update keeps your edit; only its
table goes back. world.vcsStatus().updates lists the updates.
Parameters
librarystring— The library whose update to revert ("@builtin").
world.revertUpdate("@builtin")
globals/world/reviewUpdate
world.reviewUpdate(unit: string, opts: ReviewUpdateOpts?) -> UpdateReview
Review what updating one unit changes, writing nothing: the update
itself, never a preview of the asset. Answers the versions the unit
moves from (what the world holds) and to (what its origin holds at
opts.ref, default the ref world.checkUpdates compares it with), then
commits: the commits of the origin world in between, newest first, each
{ id, message, author, date } (more is true past 200), then the files.
modified names up front each file the world holds uncommitted changes
to (a dirty or staged row) that the update touches, { path, outcome }
with outcome merges or conflicts.
- An installed asset (
unitis its root path, asworld.checkUpdatesreports it; a path inside the install stands for its root): the commits that change the install's files, back to the one that moved the root from the version the world holds;fileslists each file the update adds, changes or removes,{ path, change, diff, hunks, local_edit }, wherelocal_editisnone, ormerges/conflictsfor a file the world edited since it was installed. An install that stands as one record keeps the world's edit of a file when it updates, so each edited file the update changes or removes readsconflicts. - A library (
@builtin,@combat, with or without the@): the commits from the pinned commit to the new one andsummarycounts of the library files that change and of this world's files whose references move with the pin (they readreferences movedin status and are committed with the marker).opts.files = trueaddsfiles(each changed library file with its diff) andmoving(those paths).
opts.commits = false reads no commits, and opts.files = false for an
install leaves out files and its diffs: { commits = false, files = false } is the check before an update, answering modified and the
counts alone. When a version of the install's root cannot be read the
commit list stops there, more is true and commits_error says why.
Parameters
unitstring— A library name or an install root path.optsReviewUpdateOpts(optional) —{ ref?, files?, commits? }.
Returns UpdateReview: { kind, unit, from, to, commits, more, commits_error?, files?, moving?, modified, summary }; modified is one { path, outcome = "merges" | "conflicts" } per file holding uncommitted changes of its own that the update touches; summary counts added, changed, removed, modified, and merges / conflicts for an install or moving for a library.
local r = world.reviewUpdate("@builtin")
local r = world.reviewUpdate("/zero/source/Fire.module")
local r = world.reviewUpdate("/zero/source/Fire.module", { commits = false, files = false })
globals/world/show
world.show(...: string) -> any
Mirror git show's CLI arg shape. Default returns commit
metadata + full diff vs parent. world.show("commit:/path")
returns just the bytes. Flags: --stat, --name-only.
Parameters
...string— Variadic string args: commit id, optional path, optional flags.
Returns any — Either a ShowResult table or a string (for commit:/path).
local r = world.show("abc123")
local r = world.show("--stat", "abc123")
local bytes = world.show("abc123:/foo.luau")
globals/world/stageVersion
world.stageVersion(rev: string, path: string, opts: StageOpts?) -> boolean
Make the staging area's entry for path the version revision
rev holds — git reset <rev> -- <path> (zm restore --staged --source <rev>). When that version is the one the branch head
holds (both lacking the path included), the path is unstaged, as
the index then matches HEAD there; otherwise a revision that lacks
the path stages its deletion. The working tree is untouched.
Parameters
revstring— Any revisionworld.revParsereads.pathstring— The path to stage.optsStageOpts(optional) — OptionalStageOpts—stage, the staging area.
Returns boolean — true when the staging area holds an entry for the path afterwards, false when the path ended unstaged.
world.stageVersion("HEAD~1", "/source/foo.luau")
globals/world/startup_scene
world.startup_scene -> any
Returns any
globals/world/stash
world.stash(label: string?) -> StashPushResult
Stash the caller's uncommitted changes — git stash push. The
caller's dirty + staged state on the session branch is saved into
a stash row (label names it), and each stashed path goes back to
its committed version, unstaged. Binary and large content is saved
by its stored blob, so applying the stash brings it back
byte-identical. A path no commit holds keeps its working content in
the tree, as git leaves an untracked file, and is listed under
kept, with its reason in reasons. A folder asset goes back together with the committed paths
beneath it, and those paths are listed under stashed with it. A
path that cannot be taken back raises, naming it and every path
still holding its working content; the stash is saved either way.
Parameters
labelstring(optional) — Optional. Free-form text label for the stash.
Returns StashPushResult — A StashPushResult.
local r = world.stash("wip widget refactor")
globals/world/stashApply
world.stashApply(ref: any?) -> StashApplyResult
Apply a stash and keep it — git stash apply [<stash>].
Author-only. ref is a row id, stash@{n}, or nil for the
caller's newest stash. Stashed content is written back and staged
entries are staged again. Every file whose reference table pins
content the apply wrote back is derived again, so it names the version
the working copy holds, as after a local write of that content. Each
stashed path is listed by what the apply did with it: under
restored a file written back and a folder
asset a file beneath it came back with, under skipped a path left
as it is, with its reason in reasons. Refuses, writing nothing,
when a path the stash restores holds a different local change.
Parameters
refany(optional) — Optional stash reference.
Returns StashApplyResult — A StashApplyResult.
local r = world.stashApply()
globals/world/stashDrop
world.stashDrop(ref: any?) -> number
Drop a stash — git stash drop [<stash>]. Author-only. ref
is a row id, stash@{n}, or nil for the caller's newest stash.
The dropped stash goes to trash, where world.restore brings it
back under a new row id.
Parameters
refany(optional) — Optional stash reference.
Returns number — The row id of the dropped stash.
world.stashDrop()
globals/world/stashPop
world.stashPop(ref: any?) -> StashApplyResult
Apply a stash and drop it — git stash pop [<stash>].
Author-only. ref is a row id, stash@{n}, or nil for the
caller's newest stash. Applies as world.stashApply does; a
refused apply keeps the stash. The dropped stash goes to trash.
Parameters
refany(optional) — Optional stash reference.
Returns StashApplyResult — A StashApplyResult.
local r = world.stashPop()
globals/world/stashes
world.stashes() -> { StashRow }
List every stash row in the world. Anyone with read access
sees every stash; the per-row author_hex makes it clear
which entries the caller can pop / drop themselves.
Returns { StashRow } — Array of StashRow tables.
local rows = world.stashes()
globals/world/status
world.status -> any
Returns any
globals/world/status_text
world.status_text -> any
Returns any
globals/world/syncStatus
world.syncStatus() -> SyncStatus
Read the durable-sync status: { subscribed, content_synced, content_sync_held, world_entry_held, outgoing_synced, uploads_outstanding, uploads_in_flight, progress, pending_writes, unrecorded_writes, owed_paths, unsaved_writes, held_uploads, uploads_abandoned, conflicts, binding }. Content sync runs in two
directions and each has its own answer: content_synced is incoming,
true once the world's content has been applied to this client and so
has every change to it the world's stream delivered since
(progress.unapplied counts the delivered changes still waiting), and
it says nothing about this session's own changes. outgoing_synced is
outgoing, true once every /source change this session made has
reached the world: nothing queued, uploading, held for another
attempt, unreflected by the manifest, kept in a durable record or a
conflict, or refused. Read outgoing_synced to know whether your
work is saved; uploads_outstanding counts the upload jobs it still
waits on, and uploads_in_flight the ones among them a flush has
taken and is carrying to the world. Both booleans read false with no
world subscribed.
content_sync_held is true while vfs.holdContentSync(true) holds
the content sync, which keeps content_synced false until released.
world_entry_held is true while world.holdEntry(true) holds the
world entry: a world load whose content is ready waits before the
world's entrypoint runs and its startup scene loads, with
binding.step reading entryHeld, until it is released.
owed_paths lists the /source paths this session wrote or removed
that the server has not taken yet, the same list vfs.pendingWrites()
returns.
conflicts maps each conflicted /source path to { base_sha, local_sha, backend_sha, isBinary, deleted };
deleted is true when the author's side is a removal of the path.
unsaved_writes lists the /source paths this session wrote,
removed or moved whose change the server never took (a move names
its source and its destination; a move the server refused shows the
world's rows at both again while the world holds its source), and
uploads_abandoned counts the uploads
the queue stopped carrying — read those two to tell a queue working
through a backlog from one that gave content up, which
pending_writes alone reads the same for. held_uploads lists the
owed changes whose upload failed and is being tried again, as
{ path, reason } (a move as { path, from, reason }): a stage or
commit of other content goes ahead past them, one naming such a path
waits on it and reports the reason, and removing a held write's path
ends its hold. unrecorded_writes lists
the owed paths whose durable record this machine could not store,
which a restart loses; pending_writes counts the owed records it
did store. binding names which
world holds /source — bound, unbound, binding,
session_only, waiting (no world, waiting for world.bind), or
unclassified before the boot has decided — and,
when a load attempt is on record,
which attempt is running, the step it is held at and for how long,
what the last one answered, and whether the load stopped. Read
binding to tell a world that is still coming from one that was
never asked for: subscribed answers false for both. Synchronous.
Returns SyncStatus
local s = world.syncStatus(); print(s.outgoing_synced, s.uploads_outstanding)
local s = world.syncStatus(); print(s.pending_writes)
local s = world.syncStatus(); for _, p in ipairs(s.unsaved_writes) do print(p) end
local s = world.syncStatus(); if s.binding.awaiting_world then print(s.binding.state, s.binding.attempt) end
globals/world/trash
world.trash() -> { TrashRow }
List trash entries for the world. Anyone with read access
to the world can list trash — recovery is a shared safety net,
not a privacy boundary. The handle (row_id) feeds back into
world.restore. A whole world deleted from ZeroMind is held in
ZeroMind's own trash, which zeromind.trashedWorlds lists and
zeromind.restoreWorld restores from.
Returns { TrashRow } — Array of TrashRow tables.
local rows = world.trash()
globals/world/trashEmpty
world.trashEmpty() -> number
Permanently delete the trash entries your own operations put
there — zm trash empty — in one transaction. Entries other
callers' operations trashed stay restorable. An emptied entry cannot
be restored.
Returns number — The number of entries deleted.
local n = world.trashEmpty()
globals/world/uninstall
world.uninstall(path: string, opts: { dryRun: boolean? }?) -> UninstallReport
Remove the install whose root is path (one entry of the world)
together with the dependencies
it placed or used that nothing else in the world uses. A dependency
something else uses stays, and kept names what uses it; the install's
record then stays only to place it, and world.installs() no longer
lists the install. Installing the asset again puts its files back. A file of
the install or of a dependency this world changed or wrote itself
stays where it stands as a file of the world, listed in
kept_modified. Library content (/zero/source/libs, @builtin) is
never touched. Nothing is committed: the install's removal (or its new
state) is the change the next commit carries. world.installs() lists
the installs. An install whose record another install's record places
(carried_by names that install) leaves through that install's
record, which is written again naming the record deleted. When the
files of another install run the install's root (that install was
installed while the root stood, so its own install placed no copy),
the root's copy is handed to it: the uninstalled install stops being an
install of its own, its copy moves to
/zero/source/deps/<world>/<name>, where a fresh install of the
remaining install places it, the remaining install's record places it
there with every dependency the uninstalled install placed, and
handed_to names the remaining install while kept names the root
with the files that run it. The world then stands as if only the
remaining install had been installed, and nothing it runs goes missing.
Parameters
pathstring— The install's root, e.g./zero/source/skate_physics.package.opts{ dryRun: boolean? }(optional) —{ dryRun?: boolean }: list what would go and stay, change nothing.
Returns UninstallReport — { root, dry_run, removed = { { path, reason } }, kept = { { path, reason, users } }, kept_modified = { path }, carried_by?, handed_to?, moved_to?, note }.
world.uninstall("/zero/source/skate_physics.package", { dryRun = true })
world.uninstall("/zero/source/skate_physics.package")
globals/world/uninstallLibrary
world.uninstallLibrary(name: string) -> string
Delete the library marker file. name accepts "@combat"
or "combat" (the leading @ is the convention carried by
the on-disk path).
Parameters
namestring— The library name, with or without the leading@.
Returns string — The marker path that was removed.
world.uninstallLibrary("@combat")
globals/world/unseal
world.unseal(commitId: string?) -> string
Return a sealed commit to the staging area it was sealed from, with
its message kept, so its paths can be changed and committed again. A
commit world.commit sealed lands by itself once its required derived
outputs are computed; this is the way out of one that cannot land.
Parameters
commitIdstring(optional) — The sealed commit's id. Omitted, the oldest sealed commit holding a failure, else the newest.
Returns string — The id of the commit returned.
world.unseal()
globals/world/unstage
world.unstage(path: string, opts: StageOpts?) -> UnstageReport
Remove a path from the staging area. Live manifest dirty
state is untouched. A path is staged in one area at a time: a path the
calling area does not hold that another staging area does is taken
out of that area, whichever account opened it, and named in the
report; a take from an area of another account warns, naming that
account, the area and its session. An installed asset is unstaged by
its root path, which takes every row of the install out of the area;
another row of an install raises, naming the install and its root.
The destination of an install held as one record unstages that
record (<path>.pull), the row world.add stages for the same path.
Parameters
pathstring— The path to unstage.optsStageOpts(optional) — Optional{ stage: string? }naming the staging area the path was staged into. Omitted, the call acts on the calling caller's own area.
Returns UnstageReport — { released }: each path taken out of another staging area (stage, account, same_account, session, live). Empty when the calling area held the path.
world.unstage("/source/foo.luau")
world.unstage("/source/foo.luau", { stage = "fauna" })
globals/world/update
world.update(units: (string | { string })?, opts: UpdateOpts?) -> UpdateResult
Apply updates. With no units, every unit world.checkUpdates
lists; a name or a list of names (library names and install root
paths, mixed) updates those. A library moves its pin
(world.updateLibrary), an installed asset pulls its new closure
(world.pullAsset), one unit at a time: a unit that fails is reported in
its entry and the rest still run, and an install whose local edits
conflict lists the conflicted paths. Each unit is checked against the
files of the world that require it: a library's repinned files, and for
an installed asset every file outside it whose references name it (the
world's own and other installs alike). An installed asset whose new
version leaves such a file not loading (its reload fails, or a site of
it names a version the world holds nowhere) or holding a new analyser
error is not updated, and its error names each file and why;
allowBreaking moves it anyway and names them in broken. Nothing is
staged, committed or
pushed: the updated files wait in world.status(), to_commit lists
every path the updates changed or moved, and warnings names each file
holding uncommitted changes that an update merged into or conflicted.
A dependency an install record places moves inside that record, every
other dependency the record places staying at its release; a unit
answers ok only for a move it made, and a move the record cannot make
is reported in its entry naming the install and the releases.
Parameters
units(string | { string })(optional) — Nil, a unit name, or a list of names.optsUpdateOpts(optional) —{ ref?, allowBreaking? }: a branch name or commit id every unit is updated to, and whether an installed asset moves even when files that require it break.
Returns UpdateResult — { results, to_commit, skipped, warnings, note, summary }: results holds one { unit, kind, from, to, ok, error?, merged?, conflicted?, added?, pruned?, moving?, broken?, problems? } per unit, skipped the units the check could not read, warnings one { unit, path, outcome = "merged" | "conflicted" } per modified file an update touched, and note says nothing was committed.
local r = world.update()
local r = world.update("@combat")
local r = world.update({ "@builtin", "/zero/source/Fire.module" })
globals/world/updateLibrary
world.updateLibrary(name: string, ref: string?) -> UpdateLibraryResult
Move an installed library to the newest commit of a ref. Resolves
ref in the world the library's marker at /source/libs/@<name>
names; with no ref, @builtin moves to the published commit of it
this engine runs (main when the engine names none), a pin newer than
that commit staying where it is, and every other
library to main. When that is the commit the marker
already holds nothing is written, even when requested_ref differs;
an imported library the engine does not hold at that commit is
mounted and waited for, and a mount that fails raises naming why.
A commit that does not hold an asset the world's own sources require
is refused before anything moves: the error names each such asset with
every source and line requiring it, and the pin stays where it was
until those sources require what the commit holds.
Otherwise the marker is rewritten with the new commit (other marker
fields are kept), the call waits until the engine holds the library at
that commit (@builtin: its pin table is read; another library: its
content is mounted), and the reference tables of the world's own
sources that name the library are derived again. Each source whose table
moved is listed by world.vcsStatus with the reason references moved
and is committed with the marker: a commit holding the marker and
leaving one of them out is refused, naming each. Discarding the marker
puts the pin and its tables back. Works for @builtin
and for every library world.installLibrary wrote. A failed wait puts
the old marker back, waits for the library at the old commit and
raises, saying where it ended. One move per library runs at a time, and
none runs while play is running or in a runtime-profile session.
Parameters
namestring— The library name, with or without the leading@.refstring(optional) — A branch name or commit id of the library's world; defaults to the engine's own commit for@builtinand tomainfor every other library.
Returns UpdateLibraryResult — { name, from, to, changed, rederived, broken, kept, conflicts }: the commits the pin moved between, whether it moved, the source paths whose reference table was derived again (each one to commit with the marker), the repinned files left holding a new error, and the library's files the world edited: kept where the new commit left the file as it was, conflicts where the new commit changed or removed it too. The world's edit stays at its path in both cases.
local r = world.updateLibrary("@builtin")
globals/world/vcsStatus
world.vcsStatus(opts: StatusOpts?) -> StatusResult
Return the working-tree VCS status: dirty paths, staged
entries, untracked paths, any unmerged ones, and the ignored rows
counted by kind. ignored_summary holds one entry per kind: each
scene's autosave overlay (kind = "overlay", root its scene_dirty
folder) and each .zmignore / .gitignore line that ignores rows
(kind = "rule", file and rule naming it), with its count.
ignored lists those rows one by one when the read is made with
{ ignored = true } (git status --ignored), and is empty otherwise.
A file whose bytes are the ones the branch head holds and whose
reference table is not (a library pin moved, or an asset it references
was renamed, moved or got new bytes) is listed like any change, with
reason = "references moved": in staged when the area holds it, in
dirty otherwise. world.add / world.add_all stage it and it is
committed with the change that moved it. A table that differs only in
the install record the engine writes (an installed asset marked as the
root of its install) is listed the same way with
reason = "install recorded".
An untracked path is one with no committed version behind it, and
it appears in dirty as well — git add . picks up new files too.
Named vcsStatus (not status) because world.status() is the
runtime-snapshot accessor owned by world_status.module; the
source-control surface keeps its own VCS-specific name so the
two never shadow each other.
Each dirty[i].dirtied_by is the identity the row was written
under, which every session of one account shares;
dirtied_by_caller is the stable caller key of the call that wrote
it, dirtied_by_name the name that caller goes by on the world's
roster now,
and writer says what the row is to the calling caller: "you",
"other" (a caller whose session is open), "ended" (a caller
whose session has ended) or "unattributed". dirty_since_micros is the
microsecond timestamp of the first write of the current dirty run.
dirtied_by_account is the account the row's writer acts for and
same_account whether that is the calling caller's account.
local_identity is this connection's identity and
local_caller the calling caller's own stable key, local_name
the name it goes by now, local_account the account it acts for.
claimed_by_other_stages names the paths some other staging area
holds and who holds each: the area, its owner_account, whether
that is the caller's (same_account), the session holding it and
whether that session is open now (live). Staging is advisory: a
staging call that stages one of them takes it out of that area.
reserved_by_other_stages names each other unsealed staging area that
holds reservations (the derived outputs, such as previews, it waits on
for the changes it stages): the area, caller_name, its account and
session, total and the count in each state (by_state). A
reservation leaves its area with the change it was reserved for, and
world.reset("HEAD", { stage = name }) empties an area, its
reservations with it. stage_exists says whether the reported area
exists.
writer_accounts_refusal is set when the world's backend module
predates the record of writers' accounts. stage names the area
staged is the set of, so a caller reads which name reaches its own
staged rows.
Parameters
optsStatusOpts(optional) — Optional{ stage: string?, ignored: boolean? }.stagenames the staging area whose staged set to report; omitted, the read reports the calling caller's own area. The dirty, ignored and untracked sets are the world's working tree and read the same whichever area is named.ignored = truelists every ignored row inignored.
Returns StatusResult — A StatusResult table.
local s = world.vcsStatus()
local s = world.vcsStatus({ stage = "fauna" })
local rows = world.vcsStatus({ ignored = true }).ignored
globals/world/waitState
world.waitState() -> { [string]: any }?
Where an engine that booted with no world stands: nil on an engine
booted with its world; otherwise { waiting, source, chooser, next?, bound?, leaving, binds, leaves }, where waiting is true while no world
is bound, source is what asked for the wait (launcher for the world
chooser, await_world for a bare wait), chooser is true while the world
chooser is on screen, next says what binds a world from here while the
engine waits, bound is the bind that holds the engine ({ worldGuid, profile, mode, branch?, commit? }), and binds / leaves count the
binds and leaves made in this process. The state block of every execute
response carries chooser and next as world.waiting while the
engine waits.
Returns { [string]: any }? — The wait's state, or nil.
if world.waitState() and world.waitState().waiting then world.bind(guid) end
typed/builtin//modules/world_sync/world/dropOwedWrites
world.dropOwedWrites(path: string?) -> { string }
Give up the changes this session still owes the world at path
and beneath it: the writes and removals vfs.pendingWrites() lists
there (a write the world never took included), the ones
world.syncStatus() names as conflicts or losses, and every stored
record of them on this machine, so no later boot re-applies one. Each
path then reads as the world's row holds it: the row's content, or
nothing where the world has no row. Returns the paths given up. The
bytes of a given-up change are not kept.
Parameters
pathstring(optional) — Canonical/sourcepath; defaults to the whole source tree.
Returns { string } — The paths given up, sorted.
world.dropOwedWrites()
world.dropOwedWrites("/zero/source/hud")
typed/builtin//modules/world_sync/world/resolveConflict
world.resolveConflict(path: string, mode: string, content: string?) -> ResolveResult
Resolve one /source record this session owes the world, one
path at a time: a conflicted one, or one whose write or removal the
server refused or the queue gave up on (unsaved_writes in
world.syncStatus()), which waiting never carries and which holds a
world.swap or world.checkout away from the world until it is
settled here.
mode is merge | apply | take-local | take-backend |
discard. merge returns { merged, clean } and mutates nothing
— a clean merge can be finalized with apply, and a conflicted one
carries <<<<<<< / ======= / >>>>>>> markers to edit first. apply
writes the finalized content to /source; take-local writes the
retained local bytes; take-backend / discard keep the backend
head. For a removal (deleted in world.syncStatus().conflicts),
take-local removes the path again and merge errors, since a
removal holds no content to merge. A move or a folder row the server
refused or the queue gave up on is settled at either of its paths:
take-backend / discard give it up and show the world's rows at its
paths again, and the other modes error, since it holds no content of
its own; vfs.move makes the move again. Errors when the record is absent,
a merge has no common ancestor, hits binary content or has sides
that differ from the ancestor by more than the line diff's step
bound (the error names the path), or a write fails.
Parameters
pathstring— Canonical/sourcepath of the conflicted record.modestring— One of merge | apply | take-local | take-backend | discard.contentstring(optional) — Finalized bytes forapplymode.
Returns ResolveResult
world.resolveConflict("/zero/source/foo.luau", "take-local")
local r = world.resolveConflict(p, "merge"); if r.clean then world.resolveConflict(p, "apply", r.merged) end
typed/builtin//modules/world_sync/world/syncStatus
world.syncStatus() -> SyncStatus
Read the durable-sync status: { subscribed, content_synced, content_sync_held, world_entry_held, outgoing_synced, uploads_outstanding, uploads_in_flight, progress, pending_writes, unrecorded_writes, owed_paths, unsaved_writes, held_uploads, uploads_abandoned, conflicts, binding }. Content sync runs in two
directions and each has its own answer: content_synced is incoming,
true once the world's content has been applied to this client and so
has every change to it the world's stream delivered since
(progress.unapplied counts the delivered changes still waiting), and
it says nothing about this session's own changes. outgoing_synced is
outgoing, true once every /source change this session made has
reached the world: nothing queued, uploading, held for another
attempt, unreflected by the manifest, kept in a durable record or a
conflict, or refused. Read outgoing_synced to know whether your
work is saved; uploads_outstanding counts the upload jobs it still
waits on, and uploads_in_flight the ones among them a flush has
taken and is carrying to the world. Both booleans read false with no
world subscribed.
content_sync_held is true while vfs.holdContentSync(true) holds
the content sync, which keeps content_synced false until released.
world_entry_held is true while world.holdEntry(true) holds the
world entry: a world load whose content is ready waits before the
world's entrypoint runs and its startup scene loads, with
binding.step reading entryHeld, until it is released.
owed_paths lists the /source paths this session wrote or removed
that the server has not taken yet, the same list vfs.pendingWrites()
returns.
conflicts maps each conflicted /source path to { base_sha, local_sha, backend_sha, isBinary, deleted };
deleted is true when the author's side is a removal of the path.
unsaved_writes lists the /source paths this session wrote,
removed or moved whose change the server never took (a move names
its source and its destination; a move the server refused shows the
world's rows at both again while the world holds its source), and
uploads_abandoned counts the uploads
the queue stopped carrying — read those two to tell a queue working
through a backlog from one that gave content up, which
pending_writes alone reads the same for. held_uploads lists the
owed changes whose upload failed and is being tried again, as
{ path, reason } (a move as { path, from, reason }): a stage or
commit of other content goes ahead past them, one naming such a path
waits on it and reports the reason, and removing a held write's path
ends its hold. unrecorded_writes lists
the owed paths whose durable record this machine could not store,
which a restart loses; pending_writes counts the owed records it
did store. binding names which
world holds /source — bound, unbound, binding,
session_only, waiting (no world, waiting for world.bind), or
unclassified before the boot has decided — and,
when a load attempt is on record,
which attempt is running, the step it is held at and for how long,
what the last one answered, and whether the load stopped. Read
binding to tell a world that is still coming from one that was
never asked for: subscribed answers false for both. Synchronous.
Returns SyncStatus
local s = world.syncStatus(); print(s.outgoing_synced, s.uploads_outstanding)
local s = world.syncStatus(); print(s.pending_writes)
local s = world.syncStatus(); for _, p in ipairs(s.unsaved_writes) do print(p) end
local s = world.syncStatus(); if s.binding.awaiting_world then print(s.binding.state, s.binding.attempt) end
typed/builtin//modules/world_vcs/dependencies/world/removeUnusedDeps
world.removeUnusedDeps(opts: { dryRun: boolean?, only: any? }?) -> RemoveUnusedReport
Remove the dependency copies under /zero/source/deps/ that
nothing in this world uses, or with dryRun only list them. A
dependency is used when an install record lists it, when a source of
the world (its own content or an install's) has a reference site that
runs a copy in it, or when a used dependency has such a site. A site
runs one copy of what it names, so a recorded version's copy under
versions/ is used only by the sites that run that version. A
dependency an install placed is deleted from that install's record;
one the world holds as files of its own (written by hand, or left by
an earlier engine's install) is removed as files. Nothing is
committed: removed files leave as deletions in the next commit, and a
changed install record is a change the next commit carries. The
engine posts a notice whenever the world comes to hold unused
dependencies, naming them.
Parameters
opts{ dryRun: boolean?, only: any? }(optional) —{ dryRun?: boolean, only?: string | { string } }:onlyholds the call to the dependencies at or under those paths.
Returns RemoveUnusedReport — { dry_run, removed = { { path, guid?, files, placed_by?, modified } }, failed = { { path, reason } }, note }: removed lists what went (with dryRun, what a call without it removes), and modified the files in a dependency this world changed or wrote.
world.removeUnusedDeps({ dryRun = true })
world.removeUnusedDeps()
world.removeUnusedDeps({ only = "/zero/source/deps/0d6c9a2e-4b1f-4c3e-9a7d-2f5e8b1c4d6a" })
typed/builtin//modules/world_vcs/dependencies/world/uninstall
world.uninstall(path: string, opts: { dryRun: boolean? }?) -> UninstallReport
Remove the install whose root is path (one entry of the world)
together with the dependencies
it placed or used that nothing else in the world uses. A dependency
something else uses stays, and kept names what uses it; the install's
record then stays only to place it, and world.installs() no longer
lists the install. Installing the asset again puts its files back. A file of
the install or of a dependency this world changed or wrote itself
stays where it stands as a file of the world, listed in
kept_modified. Library content (/zero/source/libs, @builtin) is
never touched. Nothing is committed: the install's removal (or its new
state) is the change the next commit carries. world.installs() lists
the installs. An install whose record another install's record places
(carried_by names that install) leaves through that install's
record, which is written again naming the record deleted. When the
files of another install run the install's root (that install was
installed while the root stood, so its own install placed no copy),
the root's copy is handed to it: the uninstalled install stops being an
install of its own, its copy moves to
/zero/source/deps/<world>/<name>, where a fresh install of the
remaining install places it, the remaining install's record places it
there with every dependency the uninstalled install placed, and
handed_to names the remaining install while kept names the root
with the files that run it. The world then stands as if only the
remaining install had been installed, and nothing it runs goes missing.
Parameters
pathstring— The install's root, e.g./zero/source/skate_physics.package.opts{ dryRun: boolean? }(optional) —{ dryRun?: boolean }: list what would go and stay, change nothing.
Returns UninstallReport — { root, dry_run, removed = { { path, reason } }, kept = { { path, reason, users } }, kept_modified = { path }, carried_by?, handed_to?, moved_to?, note }.
world.uninstall("/zero/source/skate_physics.package", { dryRun = true })
world.uninstall("/zero/source/skate_physics.package")
typed/builtin//modules/world_vcs/world/add
world.add(paths: string | { string }, opts: AddOpts?) -> AddReport
Stage one path's manifest row, or each of a list of paths,
expanding to the full asset family if a path lives inside a composite
asset. Idempotent at (stage, manifest_row). A list stages every row
its paths select once, so naming several files of one asset stages
that asset's family once, as git add a b c does. Pass { force = true } to bypass
the .zmignore / .gitignore gate — same intent as
git add -f. Without force, attempts to stage an ignored
path (or a path whose .refs points at an ignored dep)
error.
{ stage = "<name>" } stages into the named area, shared with
whoever else names it, instead of the caller's own, so a commit
naming that area freezes these paths and leaves every other area's
staged.
Staging is advisory, and a path is staged in one area at a time.
Naming a path another staging area holds takes it from that area,
whichever account opened it and whether or not its session is open,
and the report names the area, its account and whether that session
is working now in released. A take from an area of another account
warns, naming that account, the area and its session; a take from
another agent or engine of the caller's own account does not. A
staged path a caller of another account is writing now is named in
written and warned about the same way.
A staged source that references an asset whose current version no
commit holds needs that version committed with it. The asset is
staged beside the source, taken from any other area holding it, and
named in carried.
A .scene stages as its files on disk hold it, in edit and in play
alike; live entity edits nobody saved stay in the session, and a
notice names them with the calls that keep or drop them.
An installed asset is staged by its root path: every row of the install
(its files, its dependencies under /zero/source/deps/) is staged with
it, as world.vcsStatus().installs lists it. A path that is one of the
other rows of an install raises, naming the install and its root. A
file the world changed inside an install held as one record (under the
install's root, or under a dependency it places in
/zero/source/deps/) stages with the changed rows beneath that root,
and the root itself is left out: the record is the row that versions
it. Naming the destination of such an install stages its record
(<root>.pull) when the record changed, so an install, an update and
an uninstall each reach a commit by the path world.vcsStatus lists
them under. A file
world.vcsStatus lists with the reason references moved stages like
any change: its row carries its live reference table and its bytes are
the ones the branch head already holds.
Parameters
pathsstring | { string }— The path to stage, or a non-empty list of paths. Each must be a non-empty string; a gate refusing any of them refuses the call before anything is staged.{ renormalize = true }first restates every folder asset's row at or beneath the named paths from the files beneath it, asgit add --renormalizedoes: a folder whose stated version is not the folder hash of its files is staged at the hash its files hold, and a folder that already states it is left out.optsAddOpts(optional) — Optional{ force: boolean?, renormalize: boolean?, stage: string? }. Defaults to{ force = false }on the calling caller's own staging area.
Returns AddReport — What the call staged: staged lists the rows the paths name (the asset family of a path inside an asset; otherwise the path and every changed row beneath it, deletions included, so a deleted asset folder stages the deletion of each of its files), leaving out with a warning naming it each path no row at or beneath which holds a change, carried the referenced assets staged beside them because no commit holds their current version, released each path taken from another staging area (stage, its account, same_account, its session and whether that session is live), and written each staged path a caller of another account is writing now (by, account). Each carried row, and each released and written row of another account, is also written to the caller as a warning.
world.add("/source/foo.luau")
world.add({ "/source/a.luau", "/source/b.luau" })
world.add("/source/scene_dirty/entities/42.json", { force = true })
world.add("/source/fauna.module", { stage = "fauna" })
world.add("/source/fauna.module", { renormalize = true })
typed/builtin//modules/world_vcs/world/add_all
world.add_all(opts: AddAllOpts?) -> ({ string }, AddAllReport)
Stage every dirty manifest row, whoever wrote it, skipping any
path that matches .zmignore / .gitignore. Paths that match an
ignore pattern are skipped; world.add(path, { force = true }) is the
explicit way to override the gate for an individual path.
Rows still flagged conflicted by world.pullAsset are held back
too: resolve them (edit + world.add(path), or
world.resolvePullConflict) and re-run.
Staging is advisory. The working tree is one per branch and staging
areas are not, and a path is staged in one area at a time: a path
another staging area holds is taken from that area, whichever account
opened it and whether or not its session is open, and named in
released with the area, its account, its session and whether that
session is live. A row another caller is writing is staged like any
other. The calling account's own agents and engines never warn each
other: their areas and their writes are the account's own. A take
from another account's area warns once per area, naming the account,
the area and its session, and saying that account is working on the
paths now when its session is open; a staged path a caller of another
account is writing now warns once per caller and is named in
written.
Each staged path brings its asset family. A file world.vcsStatus
lists with the reason references moved is staged too. The call reads the
working tree a fixed number of times and stages and releases in
batches, so its cost follows the size of the dirty set.
A scene stages as its files on disk hold it, in edit and in play
alike: live entity edits nobody saved stay in the session, and a
notice names each scene holding some, with the calls that write
them into scene.json (sceneAuthoring acceptChanges,
layers.active:save()) or drop them.
Parameters
optsAddAllOpts(optional) — Optional{ stage: string? }.stagenames the staging area to stage into; omitted, the call stages into the calling caller's own area.
Returns ({ string }, AddAllReport) — The paths that were held back: the conflicted ones. Empty when none were. The second value reports the call in full: staged lists the paths it added to the staging area, held lists every held-back path with its reason ("conflicted"), released lists each path taken from another staging area (stage, account, same_account, session, live), and written each staged path a caller of another account is writing now (by, account).
world.add_all()
world.add_all({ stage = "fauna" })
local held, report = world.add_all()
typed/builtin//modules/world_vcs/world/affirm
world.affirm(token: string)
Consume an XXX-XXX-XXX-style affirmation token returned by
a destructive op surface (e.g. vfs.remove). The destruction
commits atomically with the pending-row delete; the token is
one-shot. Errors verbatim on expiry / wrong-user.
Parameters
tokenstring— The affirmation token.
world.affirm("ABC-DEF-GHI")
typed/builtin//modules/world_vcs/world/assetInstallable
world.assetInstallable(opts: AssetInstallableOpts) -> AssetInstallableReport
Report whether one published asset can be installed on its own,
without raising. world.previewInstall plans a real install and
raises when the closure will not resolve; this answers the prior
question — does this guid name something ZeroMind will hand over by
itself — as a verdict a caller can branch on. Content that ships
inside a larger library (a module inside a package, a material
inside a system) carries its own published identity, so the answer
is per asset rather than per library. Reads only.
Parameters
optsAssetInstallableOpts—{ guid }names the asset;refasks about it as a branch, a tag or a commit id of the world it is published from holds it.
Returns AssetInstallableReport — An AssetInstallableReport — installable, a verdict, a one-line detail, and the closure's nodes / tree_children / deps shape when one resolved.
world.assetInstallable({ guid = asset.guid("@builtin::materials.neon") })
typed/builtin//modules/world_vcs/world/awaitCommit
world.awaitCommit(commitId: string, seconds: number?) -> { state: string, landed: boolean, lines: { string } }
Wait, for at most seconds (default 90), until the commit
world.commit returned is on the branch, and say where it stands.
state is landed once it is a commit of the world, sealed while it
is sealed behind its derived outputs, and absent when it was
unsealed. A sealed answer ends the wait early when a required output
failed or the commit's landing was refused, since neither moves on its
own. lines states it the way zm commit prints it: that the commit is
sealed and not on the branch, what it waits on, and the commands that
move it (zm derived retry, zm derived provide, zm unseal).
Parameters
commitIdstring— The idworld.commitreturned.secondsnumber(optional) — How long to wait for it to land; 0 reads where it stands now.
Returns { state: string, landed: boolean, lines: { string } } — { state, landed, lines }.
local id = world.commit("add the rock"); local where = world.awaitCommit(id); if not where.landed then print(table.concat(where.lines, "\n")) end
typed/builtin//modules/world_vcs/world/awaitOutgoingSync
world.awaitOutgoingSync()
Wait until every /source write this session made has reached
the branch it was written against. Raises naming the paths that did
not land. add / commit / push / checkout / merge / pull
already wait on their own; call this before rebinding after a burst
of writes, which world.checkout and world.swap refuse over.
Returns Nothing. Raises when a write did not land.
world.awaitOutgoingSync() ; world.checkout("main")
typed/builtin//modules/world_vcs/world/beforeCommit
world.beforeCommit(name: string, fn: ((any) -> ())?)
Open-or-resume a staging area, set the message, and materialise
the commit. Commits ONLY what's already staged via world.add /
world.add_all — git semantics, not git commit -a. The reducer
auto-deletes the stage row on success so a subsequent
world.commit opens a fresh one.
Where derive hooks compute outputs for the staged content, the commit
is sealed under its id first and lands once every required output is
computed. The id this returns can name a commit that has not landed
yet: world.vcsStatus().sealed lists the sealed commits with what each
waits on, and world.unseal returns one to the staging area. When an
older sealed commit holds a refusal, this commit queues behind it and
the call says so.
{ stage = "<name>" } materialises one of the caller's own staging
areas, so the commit carries the paths staged under that name and
leaves every other caller's staged. When a commit from another
caller has landed since the area was opened, this brings the area
onto the branch head there is now and commits it there.
A staged scene is frozen as staged. Live entity edits its overlay holds that nobody saved stay in the session, and a notice names them once the commit lands.
Pre-flight .zmignore refs gate: every staged source's
aggregated deps (via asset.deps, which recurses composite
asset folders) are checked against the live ignore set. If
any dep target's path is currently ignored AND the dep target
is not itself in the stage, the commit is refused. This
mirrors the closure invariant — a commit whose deps can't
resolve cleanly shouldn't land. Force-staging the dep
alongside (world.add(dep, { force = true })) makes the
ignored dep satisfy the gate.
Run fn at the start of every world.commit, before the commit
reads what is staged — the moment to write content that belongs in
the commit being made, and stage it. fn receives { stage }, the
staging area the commit materialises (nil for the caller's own), to
pass to world.add. Registering a name again replaces what it held,
and fn = nil removes it. A hook that raises refuses the commit,
naming the hook.
Parameters
namestring— What identifies the hook.fn((any) -> ())(optional) — The hook, or nil to remove it.
Returns The newly-allocated commit id (ULID string).
local id = world.commit("feat: ship widget")
local id = world.commit("fauna: the swallow colony", { stage = "fauna" })
world.beforeCommit("procgen.diskcache", function(ctx) ... end)
typed/builtin//modules/world_vcs/world/branches
world.branches() -> { { branch: string, commit_id: string, current: boolean } }
Every branch this world has, with the commit each one's head
names and which one this session is on — git branch --list. Sorted
by name. A branch exists for everyone in the world; which one you are
on is yours alone, so current is true for at most one row here and
says nothing about where anybody else is.
Returns { { branch: string, commit_id: string, current: boolean } } — Array of { branch, commit_id, current }.
for _, b in ipairs(world.branches()) do print(b.branch, b.commit_id) end
typed/builtin//modules/world_vcs/world/checkUpdates
world.checkUpdates() -> ({ UpdateReport }, { UpdateSkip })
Discover which units of this world have an update available. Read-only — makes no local mutation and no VCS write. A unit is one of:
- a library: a marker (
/source/libs/@<name>,@builtinincluded) whoserequested_ref(defaultmain) now resolves in the library's world to a commit other than the marker'sresolved_commit.@builtinis compared with the published commit of it this engine runs instead, when the engine names one: a pin older than it is reported withbehind_engine = trueandtonaming that commit when moving it there changes an asset the world's own content names, or one such an asset reaches through the library's reference tables (other than an engine-owned part a play of the world runs at the engine's own version whatever the pin names; a component counts, since a play runs the pinned version of it); an older pin whose move changes none of them, and a pin at it or newer than it, are current. A world on an older@builtinis hidden from players. Apply withworld.updateLibrary(name). - an installed asset: an install root (the asset that was installed;
its reference table marks it) whose recorded version differs from the
newest version of that asset at its origin, one lookup per root.
Apply with
world.update(<root path>)(zeromind.update), which installs the root's new closure with each dependency at the version the new root records. - a dependency an install record places (under
/source/deps/): the release the record states for it differs from the newest release of that asset in the dependency's own origin world. The entry names the dependency's path asroot_pathand the install that places it asplaced_by. Apply withworld.update(<dependency path>), which writes that install's record again at the version it holds with the dependency at the new release, and each file of the install written against the old release runs against the new one.
Installed assets whose origin world is a library's world are part of that library's unit. A pulled row that no table marks as an install root (an install older than the marks, content forked from another world) is not reported.
Returns ({ UpdateReport }, { UpdateSkip }) — Two values: an array of UpdateReport (libraries first), each { kind = "library", library, from, to, behind_engine? } or { kind = "asset", root_path, root_guid, display_name, from, to }, empty when everything is current; and an array of { name, reason } for the units whose origin could not be reached, which never fail the whole call.
local reports, skipped = world.checkUpdates()
typed/builtin//modules/world_vcs/world/checkout
world.checkout(branch: string, opts: { follow: boolean? }?) -> string
Switch this session to another branch — git checkout <branch>.
The branch must already exist (create one with world.createBranch).
The tree is replaced by the branch's own content. Which branch this
session is on is this session's alone; the branch itself is shared,
so others may be on the one you move onto.
Your uncommitted changes and staged entries come with you, as git
keeps them across a switch: each lands on branch as it read
before. When the switch would replace a path you changed with a
different version, the call refuses with git's message naming the
paths and nothing moves — commit or stash them first. A file your
.zmignore / .gitignore rules ignore that neither branch tracks
never refuses the switch: it comes with you where branch holds no
copy of its own, and otherwise each branch keeps its own copy. An
ignored path a branch tracks is a tracked file like any other.
Another caller's uncommitted changes stay on the branch they were
made on.
The switch is all or nothing: a write of yours still on its way to
the branch you leave is waited for, and one that does not arrive
refuses the switch before anything moves; a switch refused after
your changes moved puts them back, and names each path that does not
read as it did.
A switch made in play takes down the running world and ends its play
session: while that session holds unaccepted changes the switch is
refused before anything moves, with the accounting
engine.mode = "edit" gives, and engine.discardPlayChanges() arms
the next switch past it.
Returns only once the branch's content has landed, so world.head,
world.log, world.commit and the VFS all target the new branch
immediately afterwards.
In an agent's own client the user's client switches to the branch
once this one has, unless opts.follow is false (its play/edit mode
stays its own); it switches on its own time, and a switch it could
not make is told to you as a notice. A switch to the branch this
client is already on moves nothing.
Parameters
branchstring— The branch to switch to.opts{ follow: boolean? }(optional) — Optional{ follow: boolean? }.
Returns string — The branch now checked out.
world.checkout("feature")
world.checkout("feature", { follow = false })
typed/builtin//modules/world_vcs/world/checkoutPaths
world.checkoutPaths(rev: string, paths: { string }, opts: CheckoutPathsOpts?) -> { string }
Write paths as a revision holds them, and stage them: git checkout <rev> -- <path>.... rev is any revision world.revParse
reads. Each path comes back as the asset the revision records: its
asset guid, its bytes and its kind, so what refers to it by guid keeps
resolving, and restoring it again gives the same asset again. A folder,
a composite asset's or a plain directory, brings back every file the
revision holds beneath it, so a deleted component, module or package
comes back whole; a file beneath it the revision does not hold stays.
A file whose folder asset was deleted brings the folder back with it.
Binary files come back by their content. A path whose version is the
branch head's reads clean afterwards and leaves the staging area; any
other is staged. The paths that name nothing the
revision holds are refused together, naming each, and nothing is
written. Returns once the working copy holds every written path as the
revision records it, and every file whose reference table pins a
written path is derived again, so it names the version the working
copy holds and world.vcsStatus lists it as references moved when
that differs from the head's.
Parameters
revstring— The revision to read.paths{ string }— The paths to write: files, composite asset folders or directories.optsCheckoutPathsOpts(optional) — OptionalCheckoutPathsOpts:stage = falsewrites the working tree and leaves the staging area as it was (git restore --source <rev> -- <path>).
Returns { string } — The paths written, as the revision names them.
world.checkoutPaths("HEAD~1", { "/source/foo.luau" })
world.checkoutPaths("HEAD", { "/source/Doom.component", "/source/notes.md" })
world.checkoutPaths("HEAD~2", { "/source/levels" }, { stage = false })
typed/builtin//modules/world_vcs/world/checkoutSide
world.checkoutSide(path: string, side: string)
Take one side of an unmerged path — git checkout --ours|--theirs <path>. The path holds the side's whole content afterwards; a merge
conflict's side is the session branch (ours) or the branch merged
in (theirs), an installed asset's update conflict's side is your
local version (ours) or the upstream one (theirs). Record the
resolution with world.add and commit.
A merge conflict's side is that branch's committed version: its
bytes, its asset guid, its kind and its references, so what refers
to the asset by guid keeps resolving. Text, binary and composite
assets alike: a composite asset (a .scene, .package,
.component … folder) is taken whole — name its folder and the
folder and every file in it come from that side. A side that deleted
the path leaves it a pending delete. Taking a side again replaces
the earlier choice.
A file of an install the world holds as one record (<dest>.pull)
that the world wrote over, the file an update lists under
conflicted when the world's edit of it conflicts with the version
the install moved to: theirs takes the world's file out, so the
install's file of that version stands at the path, and ours keeps
the world's file.
Parameters
pathstring— The unmerged path, or the composite asset folder holding one.sidestring—oursortheirs.
world.checkoutSide("/source/foo.luau", "theirs")
typed/builtin//modules/world_vcs/world/commit
world.commit(message: string, opts: CommitOpts?) -> string
Parameters
messagestringoptsCommitOpts(optional)
Returns string
typed/builtin//modules/world_vcs/world/conflicts
world.conflicts() -> { ConflictEntry }
List every locally-pulled row currently flagged conflicted —
the findable surface world.pullAsset leaves behind on an
unresolved merge. Read-only.
Returns { ConflictEntry } — An array of ConflictEntry, one per conflicted row. Empty when nothing is conflicted.
local list = world.conflicts()
typed/builtin//modules/world_vcs/world/contentRequirements
world.contentRequirements(scope: { string }?) -> { ContentRequirement }
List the world's unmet content requirements: user-authored assets
whose type-declared content constraints are not yet satisfied (an
empty README, a .metadata with no description or tags — the
empty-skeleton state a fresh create emits for the author to fill, and
a description the type asks for that still starts with the
[[describe]] placeholder, which describes = true marks on the
row; world.push asks for a description only of the assets the push
changes).
The same walk world.push gates on, over the whole world: the
push refuses over every row whose asset it publishes, and
world.publishBlockers reports those rows as the content class
beside the other two. Empty list = every checked asset meets its type's
contract. A write into an asset reports the rows its type's
type.yaml requirements give for that asset as it lands:
contentRequirements on the vfs.write report and on the MCP
write_file / edit_file result.
Parameters
scope{ string }(optional) — Asset paths to restrict the check to — pass a status read's dirty + staged paths to check only content that would actually publish (a per-file path matches its containing asset; each path resolves directly, with no world enumeration). Omit for the full-world walk the push gate performs.
Returns { ContentRequirement } — Array of ContentRequirement rows — { asset, typeName, detail, path, describes?, file?, remedy? }, where path is the asset the row is about and remedy the action its type's validate hook names for it.
for _, r in ipairs(world.contentRequirements()) do print(r.asset, r.detail) end
typed/builtin//modules/world_vcs/world/contribute
world.contribute(opts: ContributeOpts?) -> { ContributeOutcome }
Send improvements to installed content back upstream — git subtree push ending in a pull request. For each targeted origin
world: the diverging subtree is remapped to the origin's canonical
paths, three-way merged against the origin's CURRENT content
(regions the origin also changed become local conflicts to
resolve first), pushed as a contrib-<id> branch and opened as a
pull request on the origin, which stays open: merge is opt-in, and
zm.prMerge merges. A change inside a folder asset (an asset inside
an installed package) publishes a new version of that folder under
the version its descriptor states (package.yaml of a .package),
so a root inside a package sends the package's descriptor with it
when this world changed it, and a refusal of a version the origin
already published (RELEASE_VERSION_TAKEN) names the descriptor in
this world to state a new version: in. An account holding a role
on the origin that pushes a branch there pushes the branch into the
origin; any other
account proposes from its own fork of the origin: the branch goes to
its public or unlisted fork (made the first time, then reused; the
world this engine is bound to is never that fork), and the pull
request is opened on the origin from <fork>:<branch>, so the origin
is written to only when its maintainer merges. Such an outcome names
the fork as source_world, forked when this call made it, and a
fork that is private or a draft is refused (SOURCE_PRIVATE) with
nothing sent. Each refusal ZeroMind answers a proposal from outside
with reaches the outcome's detail by its code (SOURCE_PRIVATE,
SOURCE_NOT_A_FORK, CONTRIBUTOR_BLOCKED, PROPOSAL_LIMIT_REACHED,
PROPOSAL_TOO_LARGE, RATE_LIMITED) with what to do. Each install
root the pull request covers keeps it as its contribution link, and
while that pull request reads open it stays the root's one pull
request: a later call sends the root's files as they stand now to
that pull request, advancing its branch by one commit whose tree is
the main of the world holding the branch (the origin, or the fork)
with the contribution laid over it (a file an earlier push changed
that the root no longer changes is put back as that main holds it,
and a main that moved since is merged in), in an outcome of its own (status = "open", its pr_number and branch, the root's paths, updated = true, or updated = false when the pull request already held the
files as they stand and nothing was pushed; roots sharing one pull
request share the outcome), while the origin's other roots go as one
new pull request; a merged or closed one, or one whose state cannot be
read, leaves the root to contribute afresh, and a root whose pull
request is found merged is first pulled again, so the call sends only
what its origin still lacks. dryRun answers the same way,
with plan for the roots it would send (naming the pull request a
root would be added to), and writes nothing. The Luau
a call sends is held to the script check a push of this world holds
the same files to: a root carrying an error a push would refuse is not
sent, and its outcome reads error naming each site. With merge = true the pull request is merged as it opens
when authorized — a refusal leaves it open and reported, never a
failure, its detail naming what the merge answered and the state and
mergeability the pull request reads after it; a merge whose answer is
not merged while the pull request reads merged goes on as merged — and
after a merge the local fork re-pulls so its origin pins advance and the
asset no longer reads as ahead.
Parameters
optsContributeOpts(optional) — OptionalContributeOpts—targets(origin world guids; default all ahead; one naming the world a dependency an install placed was published from, the guid of itsdeps/<guid>/folder, takes that dependency's changes, which with no target go to a pull request the dependency's root keeps open there and otherwise to the install's world),roots(install roots; default every installed asset ahead),merge(default false),title,description,dryRun.
Returns { ContributeOutcome } — Array of ContributeOutcome: for each targeted origin, one for the roots sent as a new pull request, and one per distinct open pull request some of its roots were added to (each names its pull request and only its own paths); status is open unless merged.
local r = world.contribute({})
typed/builtin//modules/world_vcs/world/convertInstalls
world.convertInstalls(opts: { only: string?, dryRun: boolean? }?) -> { { root_path: string, rows_removed: number, overrides_kept: number, files_added: number, completion: string? } }
Bring installs that stand as pulled rows (an earlier engine landed each
file as a row of the world) into one record row each, the form
world.installAsset writes now. The record is built from the rows
themselves, written, and once this engine has materialized the install
from it the unchanged rows are taken out of the world; a file changed
since the install stays a row of the world. Nothing is committed: rows
that were committed leave as deletions in the next commit. Returns one
entry per install, and with dryRun writes nothing. Once the rows are
taken out the record is stated again from the published version it
names, so an install the old engine cut short holds every file of the
version: files_added counts the files that added, and completion
says why the record stayed as the rows stated it (the published
version unreachable, or an asset of it that does not load as its type).
Each install converts whole or not at all: when neither the published
version nor the record the rows state runs, the record is taken out and
the rows are written back, and once every other install is converted
the call raises naming each install that stands as it did and why.
The files stay where they stand and the call yields between its steps, so
it never holds a frame: a run that outlasts the execute budget continues
as a task.
Parameters
opts{ only: string?, dryRun: boolean? }(optional) —{ only?: string, dryRun?: boolean }:onlynames one install by its root path.
Returns { { root_path: string, rows_removed: number, overrides_kept: number, files_added: number, completion: string? } } — { { root_path, rows_removed, overrides_kept, files_added, completion? } }.
world.convertInstalls({ dryRun = true })
typed/builtin//modules/world_vcs/world/createBranch
world.createBranch(name: string, fromCommit: string?, opts: { force: boolean? }?)
Create a branch — git branch <name> [<start>]. The branch
starts at fromCommit (defaults to the session branch's HEAD)
and gets its own working tree, materialized from that commit.
The session stays on its current branch; move onto it with
world.checkout("<branch>") (git checkout). With
{ force = true } (git branch -f) an existing branch is pointed
at fromCommit and its working tree rewritten to it, in one
transaction; that refuses only when the branch's working tree holds
uncommitted changes, which the rewrite would lose.
Parameters
namestring— The new branch name.fromCommitstring(optional) — Commit id to start at. Defaults toworld.head().opts{ force: boolean? }(optional) — Optional{ force: boolean? }.
world.createBranch("feature")
world.createBranch("feature", world.revParse("HEAD~1"), { force = true })
typed/builtin//modules/world_vcs/world/deleteBranch
world.deleteBranch(branch: string, opts: DeleteBranchOpts?)
Delete a branch — git branch -d|-D <name>. Drops the branch and
the working tree it owns; its commits are left alone, since deleting
a branch is dropping the name and the tree under it, not rewriting
history. Without opts.force (-d) it refuses a branch whose
commits the session's branch does not hold, and one whose working
tree holds uncommitted changes, naming them, since those go with the
tree; { force = true } (-D) deletes it regardless. Refuses the
branch this session is on (check out another first) and the world's
last branch.
Parameters
branchstring— The branch to delete.optsDeleteBranchOpts(optional) — OptionalDeleteBranchOpts—force.
world.deleteBranch("feature")
world.deleteBranch("experiment", { force = true })
typed/builtin//modules/world_vcs/world/derive
world.derive(name: string, spec: any?)
Register a computation whose output lands in the commit with the
content it is computed from. The hook (scope = "asset")
computes output inside each staged asset matches accepts, from the
asset as staged. Its fingerprint and compute are entries of
module, run on a worker.
Staging starts the work, and a required output that is not computed
holds the commit that carries it: world.commit seals the commit and
returns its id at once, and the commit lands with the outputs once
they are computed. When every required output is computed already,
world.commit returns after the commit landed. spec = nil removes it.
Parameters
namestring— What identifies the hook.specany(optional) — The hook, or nil to remove it.
world.derive("thumbs", { scope = "asset", output = "thumb.png", matches = function(ref) return ref.type == "texture" end, module = "@root::thumbs", fingerprint = "fingerprint", compute = "compute" })
typed/builtin//modules/world_vcs/world/diff
world.diff(...: string) -> any
Mirror git diff's CLI arg shape. Returns per-file diffs
by default; pass --stat for summary stats, --name-only for
just paths. Positional commit ids drive the two sources;
--staged pivots to staged-vs-HEAD. ---separated args
scope the diff to specific paths, each read as world.add reads a
path: a relative one names the file under /zero/source, and both
sides of the diff compare the file at that one path. An absolute path
before -- scopes the diff the same way. --stage=<name> reads the named
staging area in place of the calling caller's own. A working-tree
file a .zmignore / .gitignore rule matches is left out, as
world.vcsStatus() leaves it out of dirty; --ignored diffs those
files too. A file the staging area holds and a path named after --
are diffed whatever rule matches them.
Parameters
...string— Variadic string args: flags, commit ids,--, path filters.
Returns any — Array of DiffFile tables (or string-list for --name-only).
local files = world.diff()
local files = world.diff("--staged")
local files = world.diff("abc", "def")
local names = world.diff("--name-only")
local files = world.diff("--staged", "--stage=fauna")
local names = world.diff("--name-only", "--ignored")
typed/builtin//modules/world_vcs/world/diffUpstream
world.diffUpstream(root: string) -> { UpdateFile }
What your copy of an installed asset changed against the version
it was installed from — the diff zm diff <root> upstream prints.
One UpdateFile per file under root whose content differs from
its origin version (for an install's root, the files of the
dependencies it placed too, wherever they were moved), with the unified diff from the origin version
to yours for a text file (diff and hunks are nil for a binary
one). Empty when the installed asset holds no change of yours.
Parameters
rootstring— The installed asset's root path (or any path inside it).
Returns { UpdateFile } — Array of UpdateFile, sorted by path.
for _, f in ipairs(world.diffUpstream("/source/Doom.component")) do print(f.diff) end
typed/builtin//modules/world_vcs/world/discard
world.discard(opts: StageOpts?)
Drop a staging area without committing. Live manifest dirty flags are preserved so the user can re-stage later. No-op if the area doesn't exist.
Parameters
optsStageOpts(optional) — Optional{ stage: string? }naming the staging area to drop. Omitted, the call drops the calling caller's own area.
world.discard()
world.discard({ stage = "fauna" })
typed/builtin//modules/world_vcs/world/discardAll
world.discardAll(scope: string?) -> DiscardAllResult
Discard every change under a path in one operation — the whole
working tree by default. Every file edited since its commit goes back
to the committed version, every deletion comes back, and every file
no commit holds, an uncommitted install included, leaves the tree.
Each goes to trash first, where world.restore(<handle>) brings it
back. The paths a staging area holds stay, a staged file edited since
it was staged goes back to its staged copy, and a change another
account is making, a dependency another install records, and a file
listed only because its references moved (its bytes are the committed
ones) stay as well: they are named in kept. One backend operation takes the whole
scope back, and the call returns once the working copy reads as the
committed content. Every reference table that records a version taken
back, by this discard or an earlier operation, is derived again, so a
file whose table that leaves at the head's reads as the head holds it
and is neither discarded nor kept.
Parameters
scopestring(optional) — The VFS path to discard beneath; omitted, every path.
Returns DiscardAllResult — { discarded, paths, kept } — how many rows went back, which, and which rows under the scope stayed: another account or another install holds them, or only their references moved.
world.discardAll()
world.discardAll("/source/hud")
typed/builtin//modules/world_vcs/world/discardFile
world.discardFile(path: string)
Discard a path's unstaged working edits, taking it back to what
it was staged or committed as — the git restore <path> shape. A
folder takes every file beneath it back with it, and a deleted
path comes back as its committed version. The stage is the
baseline when the path is staged, the last commit when it is not,
and where neither holds anything at or beneath the path there is
nothing to come back to, so the path goes away. A path that does hold
committed or staged content stays: the files no commit holds beneath
it (a new file in a folder, a scene's autosave overlay) are left where
they are, and where they are its only change the call raises naming
them and world.discardAll, which takes them out. Staging is left
exactly as it was; world.unstage
is the verb that changes it. One shot: edited bytes that revert to
a committed version are snapshotted to trash first, so that case is
recoverable via world.restore(<handle>); a deletion taken back
throws nothing away and leaves no trash entry. Returns once the
working copy reads as the reverted content: text reads back as
committed, and binary bytes are served at the committed version on
the next read. Errors when nothing at or beneath the path is dirty
(nothing to discard).
An installed asset is discarded by its root path, which puts the whole
install back at the version the branch head holds as one unit: its rows
leave the staging area and then return to their committed version, or go
away when no commit holds them. A dependency another install records too
stays. Another row of an install raises, naming the install and its
root. An install the world holds as one record (<dest>.pull) goes
back to what that record states: a file of it the world wrote comes
back as the install's file, the record staying as it is, and its
destination puts the record back at its staged or committed version
with every file of it the world wrote. A file of it the staging area
holds keeps its staged version. A file whose only difference from the
head is its reference table
(listed with the reason references moved) raises too, naming what
moved its references and the undo: moving the library pin back
(world.updateLibrary, or discarding the pin marker) or reverting the
moved asset. Every reference table that records a version the discard
takes back is derived again once it lands, so a file that references
the discarded asset reads as the head holds it when the asset does; a
file listed only for a table recording a version taken back earlier
is derived again the same way, and its discard is done when that
leaves it as the head holds it.
Parameters
pathstring— The VFS path whose unstaged edits to discard.
world.discardFile("/source/foo.luau")
world.discardFile("/source/Doom.component")
typed/builtin//modules/world_vcs/world/dropDerived
world.dropDerived(outputPath: string, opts: { stage: string? }?) -> number
Leave the derived output at outputPath out of the commit. Only
an output whose hook is best-effort can be dropped; a required one is
refused, naming the other ways out (retry, provide, unseal), except
one whose asset holds no input file in the tree the commit lands on
nor in the working tree: the commit removes that asset, and its
output settles empty.
Parameters
outputPathstring— The output's VFS path.opts{ stage: string? }(optional) — Optional{ stage: string? }naming the staging area.
Returns number — How many reservations were dropped.
world.dropDerived("/zero/source/gold.material/extra.json")
typed/builtin//modules/world_vcs/world/fetch
world.fetch(branch: string?) -> FetchResult
Update the origin/<branch> remote-tracking ref — git fetch.
Mirrors the world's ZeroMind branch head into the local commit
history (no working-tree change) and reports how the session
branch relates to it: behind origin commits to pull, ahead
local commits to push, diverged when both, and sealed the
caller's sealed commits, which join the branch once their outputs
land and are ahead of origin beside ahead. A stale installed
pin or out-of-band ZeroMind change shows up here as behind —
reconcile with world.pull().
Parameters
branchstring(optional) — Remote branch to fetch. Defaults to the session branch.
Returns FetchResult — A FetchResult table.
local f = world.fetch()
typed/builtin//modules/world_vcs/world/foldCopy
world.foldCopy(opts: { copy: string, into: string, dryRun: boolean? }) -> FoldCopyReport
Recovery for installed content that was copied by accident instead
of edited in place: fold the copy back into the installed asset it was
copied from. Editing installed content in place is the normal flow
(the install becomes a modified install zm pr create offers back);
a copy is a new asset with its own guid, disconnected from the
install, and nothing reconnects it on its own. This call does, when
asked: each file of copy is written over the file at the same path
inside into (the installed asset keeps its guid and becomes a
modified install), every reference this world authors that names the
copy or a file in it is rewritten to name the installed asset, and
the copy is removed. Nothing is committed. into must be installed
content (an install's root or a dependency it placed, as
world.installs() lists them, or an asset inside one); copy must not
be.
Parameters
opts{ copy: string, into: string, dryRun: boolean? }—{ copy: string, into: string, dryRun: boolean? };dryRunreports what would be written and changes nothing.
Returns FoldCopyReport — A FoldCopyReport.
world.foldCopy({ copy = "/source/vendor/pythonParser.module", into = "/source/deps/240544fe-7bcf-4c3f-b866-ffb7be8c55a9/Toolkit.package/modules/pythonParser.module", dryRun = true })
typed/builtin//modules/world_vcs/world/forkLive
world.forkLive(opts: { source: string, sourceBranch: string?, maxBatches: number? }) -> number
Seed THIS (empty) world's live content from another world by
copying its whole manifest as clean Pulled rows — the
in-engine half of "fork a world". Provenance is preserved: each
row points at the content's ORIGINAL owner (a fork of a
fork-of-A still points at A), so the fork never claims to have
authored what it pulled. The copy runs server-side in bounded
batches (idempotent + resumable), looping until the source is
fully mirrored. Pair with world.add_all() + world.commit() +
world.push() to publish the fork.
Parameters
opts{ source: string, sourceBranch: string?, maxBatches: number? }—{ source, sourceBranch?, maxBatches? }—sourceis the source world GUID; branches default to"main";maxBatchescaps the batch loop (default 60 ⇒ up to ~120k entries).
Returns number — The number of pulled (dirty) rows now staged-pending on the fork.
world.forkLive({ source = "e89aa92e-4c1f-460e-acd8-73859dd3a346" })
typed/builtin//modules/world_vcs/world/forkStatus
world.forkStatus() -> { ForkStatus }
Per-asset "ahead of origin" report — the fork analogue of git
status against an upstream. Every file of installed content whose
content diverges from the version it was installed at is listed: a
file of an install the world changed or added inside it, and a row
an earlier engine pulled whose content left its pinned version. The
list is partitioned by the world each change goes back to, as
world.contribute with no target sends it: a change to an install, a
change to a dependency it placed included, goes to the world the
install was published from, a change to a dependency whose root keeps
a pull request open in the world the dependency was published from
goes to that world (its entries name the dependency's root), and a
pulled row to the world that authored it. This is information for
judgment: decide whether a change belongs upstream, then
world.contribute.
Returns { ForkStatus } — Array of ForkStatus partitions.
for _, f in ipairs(world.forkStatus()) do print(f.origin_world, #f.entries) end
typed/builtin//modules/world_vcs/world/head
world.head() -> string?
Return the current branch HEAD commit id, or nil if the branch has no commits yet.
Returns string? — The commit id string, or nil.
local id = world.head()
typed/builtin//modules/world_vcs/world/installAsset
world.installAsset(opts: InstallAssetOpts) -> InstallAssetResult
Install a published asset into this world, pulling the asset and
every dependency it closes over and writing them into the source tree.
The world holds the install as ONE entry, the asset at its root path,
which stands for every file of the version and every dependency placed
beside it; every engine materializes the install's files from it, so a
file of the install is a change of the world only once it is edited.
The installed files are ordinary files: edit, move and rename them with
the usual tools, and zm status lists the install as ahead of its
upstream, which zm pr create <root> offers back to the world it came
from.
Returns once this engine has materialized the install and it runs.
Installing an asset where the world already holds it is safe to repeat:
rows at this version are left as they are, and rows of an earlier
version are moved to this one. A file of the world's own over a file of
the install whose version moves takes the new version: one holding the
installed bytes or the new ones leaves, so the new version's file
stands, and an edited text file takes the three-way merge of its edit
with the new version; a merge that conflicts keeps the world's file
and is named in conflicted. The root lands at at, else where the
world already installed it, else at /source/<name>; a copy of it the
world holds at this version anywhere else (another install's
dependency under /source/deps/) moves there, so the world holds the
asset once and everything that depends on it resolves to the moved
copy. A path holding another asset, or local
edits to this one, refuses the install. An install that does not
materialize, or does not run, puts the world's record back as it was:
a record it wrote where the world held none comes out again, so the
world holds nothing of it, and the record the world held for the
install is written back as it stood, so the world holds the install it
held. Either way the same install can simply be run again.
Parameters
optsInstallAssetOpts—{ guid }names the root asset to install;refinstalls it as a branch, a tag or a commit id of the world it is published from holds it, in place of the version that world ships. A ref that world does not resolve, or whose commit holds no version of the asset, refuses the install, naming the ref and why.
Returns InstallAssetResult — { assets_written, blobs_downloaded, root_guid, root_path, root_version, requires, deps, pending, problems, notices, releases, outcome, moved_from, record, files, merged_files, conflicted, timings }. requires lists the name require loads each installed module by: the root's own when the root is a module, else each module directly in it (require("modules.ringLayout") for a module installed at /zero/source/modules/ringLayout.module). releases names each dependency that runs as more than one copy, each loaded on its own: one the install lands at two releases, and one it lands in a recorded version's folder beside the copy the world's name reaches, with the release each runs and the files running it. For an install that moved the version the world held, merged_files names each file of the world's own that took the new version or its merge, and conflicted each whose edit conflicts with it. notices, when present, names each file the installed root's type requires that the published content lacks, and each finding a dependency's type's validate hook states for it; the install lands with either. record is the path of the install's row, files the number of files and folders it states, assets_written the number of them the install placed (the files the user deleted from the install stay deleted and are not counted; 0 when the asset was already present), timings the seconds each step took. outcome is installed, updated or already_present; moved_from names the copy the root moved from, nil when it moved from nowhere. blobs_downloaded counts the blobs the install fetched (bytes already cached cost none); pending lists the written paths still unreadable when the wait for them stalled, and is empty when every one reads back; problems names each reference site in the installed content that resolved to nothing in the world it was published from, and each file a folder version the install wrote holds at its version that ZeroMind gave no entry for, and is empty when every site resolves and every written folder holds all of its files. A folder version lands holding every file its version states: a file the closure leaves out of it is read from that version of the folder, and, when that version cannot be read, from the version of the folder holding it. A folder no read answers for is a line in problems naming it, its version and why the read failed.
local r = world.installAsset({ guid = assetGuid })
typed/builtin//modules/world_vcs/world/installLibrary
world.installLibrary(opts: InstallLibraryOpts) -> InstallLibraryResult
Declarative cross-world dependency. Writes a single marker
file at /source/libs/@<name> whose body is the
zero/world-import/v1 JSON. The next commit ships it as one
regular manifest entry; ZM's import-derivation pass at
finalize-time decodes the marker and stamps the new commit's
imports[]. Unmodified library content never ships in the
importing world's tree: the engine fetches the pinned commit
from ZeroMind and mounts it as @<name>::<path>. The call
returns once the library is mounted (require("@<name>::…")
resolves and library.list() lists it), and raises naming why
when it does not mount, leaving the marker as it was before the
call. A marker already there whose library is mounted is
refused (move it with world.updateLibrary); one whose library
never mounted is replaced, so running the install again repairs it.
Parameters
optsInstallLibraryOpts— SeeInstallLibraryOpts.opts.worldis the upstream world's guid (required).opts.commitis the upstream commit_id to pin (optional; resolvesopts.reformainif omitted).opts.asis the local library name (defaults to the upstream world's slug).opts.refis the human-meaningful ref recorded in the marker.
Returns InstallLibraryResult summarising the install.
world.installLibrary({ world = "guid", as = "combat" })
typed/builtin//modules/world_vcs/world/installedAssets
world.installedAssets() -> { InstalledAsset }
Every asset this world carries from ZeroMind, keyed by the
published guid it was pulled from. The read that answers "what is
actually in this world" by identity rather than by path — an
installed asset's local name can be chosen by the installer, so a
path is not the thing to check a pull against.
Every install is in it, whichever form it is stored in: each install
world.installs() lists and each dependency it placed, committed or
not, from the moment world.installAsset returns.
Returns { InstalledAsset } — An array of InstalledAsset sorted by local path, one per installed asset and dependency whose content the world holds (a deletion the next commit carries is none of them).
for _, a in ipairs(world.installedAssets()) do print(a.asset_guid, a.path) end
typed/builtin//modules/world_vcs/world/installedLibraries
world.installedLibraries() -> { LibraryMarker }
The libraries this world has installed: one row per library marker
under /zero/source/libs, @builtin among them, sorted by name.
Returns { LibraryMarker } — { name, world_guid, requested_ref?, resolved_commit } per library: its name with the @, the world it comes from, the ref that was asked for and the commit it is pinned at.
for _, lib in ipairs(world.installedLibraries()) do print(lib.name, lib.resolved_commit) end
typed/builtin//modules/world_vcs/world/installs
world.installs(opts: { rows: boolean? }?) -> { InstallInfo }
The installs this world holds, one entry each, committed or not,
whichever form each is stored in: record (one row, every engine
materializes the files from it) or rows (an earlier engine landed one
row per file, and world.convertInstalls brings it into one record).
Each names the version it was installed at (version, and version_id,
the id ZeroMind gives that asset version) and how many of its files
the world changed or added. An asset installed at more than one place
names the other places in also_at. A dependency the install keeps in
a recorded version's folder while the world holds another copy of the
asset where its name reaches (two releases running, each loaded on its
own) is named under releases. An install world.uninstall
removed is not listed, though its record stays while it places a
dependency something else uses.
Parameters
opts{ rows: boolean? }(optional) —{ rows: boolean? }:rows = falseleaves the row installs out, which reads no row of the world.
Returns { InstallInfo } — An array of InstallInfo sorted by path.
for _, i in ipairs(world.installs()) do print(i.root_path, i.form, i.files) end
typed/builtin//modules/world_vcs/world/list
world.list() -> { WorldEntry }
List every world the authenticated user has access to.
Reads ZeroMind's GET /v1/me/worlds through the trusted ZeroMind
bridge, which answers without the world's live session, so an engine
bound to a world, an engine waiting for one and an offline engine
answer it alike. Flattens each entry to one record per world with
the role promoted to a top-level field.
Returns { WorldEntry } — Array of WorldEntry records.
local worlds = world.list()
typed/builtin//modules/world_vcs/world/log
world.log(opts: LogOpts?) -> { CommitRow }
The history of the session branch, newest first — git log:
every commit reachable from HEAD through both parent edges, so a
merged branch's commits and a pulled commit appear along with the
commits recorded on this branch. opts.rev starts the history at
another revision (git log <rev>). Pass opts.path to get the
per-path history (git log -- <path>): only the commits that
touched that file, newest-first.
Parameters
optsLogOpts(optional) — Optional.opts.limitcaps the number of commits (default 50, 0 = all).opts.revnames where the history starts.opts.pathscopes the log to one file.
Returns { CommitRow } — Array of CommitRow tables.
local commits = world.log({ limit = 20 })
local merged = world.log({ rev = "feature" })
local touched = world.log({ path = "/source/foo.luau" })
typed/builtin//modules/world_vcs/world/merge
world.merge(sourceBranch: string, opts: MergeOpts?) -> MergeResult
Merge another branch into the session branch — git merge <source>. The merge runs locally in the world's SpacetimeDB clone
and is abortable with world.mergeAbort; nothing reaches ZeroMind
until the result is pushed. When the session branch's head is in
the source's history the head fast-forwards onto it (unless
opts.noFf); otherwise a two-parent merge commit lands
(opts.ffOnly refuses that). Local changes follow git's rule: one
on a path the merge does not rewrite stays in the working tree, and
one on a path it does rewrite refuses the merge with git's message
naming the paths. A scene's unsaved live edits are a local change
to its scene.json: a fast-forward refuses over a scene whose
scene.json it rewrites, naming the scene and how to save or
discard the edits, and a merge commit refuses over any scene holding
them. A staged entry refuses a merge commit. Conflicts →
git-style markers are projected into each conflicting text file,
the cleanly-merged remainder is applied as working-tree changes, and
world.vcsStatus().unmerged lists what needs attention: resolve
each path (edit out the markers, or take one side whole), then
world.add + world.commit — that commit records the merge
(second parent = the source head) and clears the unmerged set.
Parameters
sourceBranchstring— The branch to merge in.optsMergeOpts(optional) — OptionalMergeOpts—ffOnly,noFf.
Returns MergeResult — A MergeResult — status is fast_forward or clean (with commit), conflicts (with conflicts), or up_to_date.
local r = world.merge("feature")
local r = world.merge("feature", { noFf = true })
typed/builtin//modules/world_vcs/world/mergeAbort
world.mergeAbort()
Abort the in-progress merge — git merge --abort. Clears the
unmerged set and restores the working tree to the pre-merge state
(the target head's committed content; the branch head never moved
during a conflicted merge). Errors when no merge is in progress.
world.mergeAbort()
typed/builtin//modules/world_vcs/world/prCheck
world.prCheck(worldGuid: string?, number: number, opts: { suites: { string }?, name: string? }?) -> any
Run test suites against a pull request's head in this engine and
post the result on it as a check. The engine holds the head when it is
bound to the request's source world, on its source branch, at the
commit the request stands at, with nothing uncommitted and nothing
untracked: for a branch of this world,
world.checkout(<source branch>); for a proposal from a fork, an
engine on the fork. Anything else is refused, naming what
differs. The suites run as tests.run({ suites }) runs them (left
out, every suite the world holds). The check is failure when a test
failed, success when the tests that ran all passed, and error when
the run reached no verdict (a suite asked for that matched none, or
every test skipped); its summary is the counts, the runner's note and
the failing tests.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.opts{ suites: { string }?, name: string? }(optional) — Optional{ suites, name }: the suite names to run, and the check's name (defaulttests).
Returns any — { check, head, stats, failures }: the check as ZeroMind stored it, the commit it ran on, the run's counts and its failing tests.
world.prCheck(originGuid, 3, { suites = { "door" } })
typed/builtin//modules/world_vcs/world/prChecks
world.prChecks(worldGuid: string?, number: number) -> any
The checks on a pull request — gh pr checks: each test result
posted on its head (head), then those posted on heads it has moved
past (outdated). Each names its poster and poster_relation
(author, member of the world, or outside); one another account
posted carries untrusted = true.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.
Returns any — { head, checks, warning }.
local c = world.prChecks(originGuid, 3)
typed/builtin//modules/world_vcs/world/prClose
world.prClose(worldGuid: string?, number: number, opts: { reason: string?, comment: string? }?) -> any
Close a pull request without merging it — gh pr close. reason
is not_planned, duplicate, superseded or withdrawn; left out,
ZeroMind records withdrawn for a close by its author and
not_planned for one by the world's owner. comment is posted on
its thread first, so the author reads why. An open or draft request
closes; a closed or merged one is refused, naming its state, before
anything is posted. A closed request is reopened with
world.prReopen.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.opts{ reason: string?, comment: string? }(optional) — Optional{ reason, comment }.
Returns any — The pull request as ZeroMind then states it (state, close_reason, closed_by), marked by who opened it, with closing_comment when a comment was posted.
world.prClose(originGuid, 3, { reason = "superseded", comment = "Landed in #4 instead." })
world.prClose(nil, 3)
typed/builtin//modules/world_vcs/world/prComment
world.prComment(worldGuid: string?, number: number, body: string, opts: { path: string?, parent: string? }?) -> any
Comment on a pull request's thread — gh pr comment. The author
and the world's owner read it in world.prView. The world this
engine is bound to is kept as the one the thread was written in from,
so a reply in it reaches the agents working there.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.bodystring— The comment, 1 to 10000 characters.opts{ path: string?, parent: string? }(optional) — Optional{ path, parent }:paththe file the comment is about (relative to the world's root),parentthe id of the comment it replies to.
Returns any — The comment as ZeroMind stored it.
world.prComment(originGuid, 3, "The hinge reads well; the door mesh is still the old one.")
world.prComment(nil, 3, "This table is unused.", { path = "door.component/init.luau" })
typed/builtin//modules/world_vcs/world/prConflicts
world.prConflicts(worldGuid: string?, number: number) -> any
Read a pull request's conflicts — what stands between it and a
merge. Returns the mergeability verdict, the merge base, both
heads, and one entry per conflicting path. A conflicting TEXT path
carries marked_text: the same <<<<<<< / ======= / >>>>>>>
rendering a merge leaves in the working tree, with the source and
target sides laid against their common ancestor. Resolve a path by
writing the settled bytes back to it and committing on the source
branch; the pull request re-analyses on the next read. A binary
path carries the two sides' hashes and no text — pick a side.
A mergeable pull request returns an empty conflict list.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the bound world.numbernumber— The pull request number.
Returns any — Decoded ZeroMind conflicts response.
local c = world.prConflicts(nil, 3)
for _, m in ipairs(world.prConflicts(originGuid, 3).markers) do print(m.path, m.marked_text) end
typed/builtin//modules/world_vcs/world/prList
world.prList(worldGuid: string?, number: number?) -> any
List a world's pull requests, or fetch one. The list is
{ pulls, total, warning }, and one pull request is its record with
warning. A pull request's title and description are its
author's: each one another account opened carries untrusted = true,
each this engine's own account opened untrusted = false. One pull
request's reviews (each reviewing account's latest verdict) and
checks are marked the same way, by reviewer and by poster.
Parameters
worldGuidstring(optional) — The world whose pull requests to read. Defaults to the session world.numbernumber(optional) — A specific pull request number. Omit for the list.
Returns any — Decoded ZeroMind response, marked.
local prs = world.prList()
typed/builtin//modules/world_vcs/world/prMerge
world.prMerge(worldGuid: string, number: number, strategy: string?) -> any
Merge a pull request — the agent-side merge button. The answer
carries the merged pull_request record with warning: its title
and description are its author's, and the record carries
untrusted = true when another account opened it. The merge waits
for ZeroMind's own answer. A merge that does not answer merged is read
back: a pull request that reads merged then answers { pull_request }
as read, and any other raises naming what the merge answered and the
state and mergeability the pull request reads.
Parameters
worldGuidstring— The world the pull request lives in.numbernumber— The pull request number.strategystring(optional) —merge(default),squash, orfast_forward.
Returns any — Decoded ZeroMind merge response, its pull request marked.
world.prMerge(originGuid, 3)
typed/builtin//modules/world_vcs/world/prOpen
world.prOpen(opts: PrOpenOpts) -> any
Open a pull request — gh pr create. Proposes the work on one
(world, branch) pair to another. Defaults make the common cases one
argument: from a fork, the target is the world it was forked from, so
world.prOpen({ title = "..." }) proposes your work upstream. In an
ordinary world the target is the same world, so you get a
branch → main pull request.
The PR lives in — and is numbered by — the world it targets, exactly
as a forge numbers pull requests on the upstream repository. That is
also where world.prList finds it.
Parameters
optsPrOpenOpts—title(required), plusdescription,sourceWorld,sourceBranch,targetWorld,targetBranchto address any leg explicitly.
Returns any — The decoded ZeroMind pull request.
world.prOpen({ title = "fix the door hinge" })
world.prOpen({ title = "port the fix", targetWorld = otherGuid })
typed/builtin//modules/world_vcs/world/prReopen
world.prReopen(worldGuid: string?, number: number) -> any
Reopen a closed pull request — gh pr reopen. The world's
contributors reopen any; its author's account reopens one its own
account closed. A pull request that is open, draft or merged is
refused, naming its state.
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.
Returns any — The pull request as ZeroMind then states it, marked by who opened it.
world.prReopen(originGuid, 3)
typed/builtin//modules/world_vcs/world/prReview
world.prReview(worldGuid: string?, number: number, verdict: string, body: string?, opts: { expectedHead: string? }?) -> any
Review a pull request — gh pr review. verdict is approve
(ready to merge as it stands), request_changes (needs changes first)
or comment (a remark with no verdict). The review is pinned to the
head the pull request stands at; a later push leaves it outdated. A
review never merges or closes the request, and its author's own
account is refused (OWN_CONTENT).
Parameters
worldGuidstring(optional) — The world the pull request lives in. Defaults to the session world.numbernumber— The pull request number.verdictstring—approve|request_changes|comment.bodystring(optional) — Optional text, at most 16 KiB.opts{ expectedHead: string? }(optional) — Optional{ expectedHead }: the head you read (world.prView'sanalyzed_source_head); ZeroMind refuses the review (CONFLICT) when the request has moved past it.
Returns any — The review as ZeroMind stored it, version naming the head it judged.
world.prReview(originGuid, 3, "approve", "Ran the door suite; it passes.")
world.prReview(nil, 3, "request_changes", "The hinge angle is clamped twice.")
typed/builtin//modules/world_vcs/world/prView
world.prView(worldGuid: string?, number: number, opts: { after: string?, limit: number? }?) -> any
Read one pull request in full — gh pr view. Returns the record
plus a LIVE re-analysis against the current branch heads: mergeability
(clean / conflicts / fast_forwardable / up_to_date /
unrelated), conflict_count, and diff — every path the request
adds, modifies or deletes with its checksums. Read this before merging:
it is what tells you WHAT the request changes. Its title and
description are the author's: the record carries untrusted = true
when another account opened it, and warning says what that means.
The review rides with it: comments (a page of the thread, oldest
first, each with the path it is about and the parent it replies
to; comments_next_cursor while more follow), reviews (every
reviewing account's verdict on every head it judged, newest first:
verdict, body, version the head, outdated once the request
moved past it) and checks (each test result posted on its head,
checks_head, then those on heads it moved past, outdated). Each
comment, review and check another account wrote carries untrusted = true. When the review cannot be read, thread_error says why, and
reviews and checks are the record's own: each reviewing account's
latest verdict (reviewer, verdict, head, outdated) and the
checks on its head, each marked the same way.
Parameters
worldGuidstring(optional) — The world the pull request lives in (its target world). Defaults to the session world.numbernumber— The pull request number.opts{ after: string?, limit: number? }(optional) — Optional{ after, limit }:afteracomments_next_cursorto read the thread after,limitthe page's size (1 to 200).
Returns any — The decoded pull request view, with its review.
world.prView(nil, 1)
world.prView(originGuid, 3, { after = view.comments_next_cursor })
typed/builtin//modules/world_vcs/world/previewInstall
world.previewInstall(opts: InstallAssetOpts) -> PreviewResult
Preview what installing an asset WOULD write, without writing
anything. Fetches + decodes the closure and plans placement (the
same helpers world.installAsset uses), returning a flat node
list plus rollup totals. A truncated closure is reported (not
raised) so a caller can surface it and block import.
Parameters
optsInstallAssetOpts—{ guid, at?, ref? }— same shape as installAsset.
Returns PreviewResult: nodes, totals, a truncated flag, the other worlds the content reaches into, and a line for each folder version whose files no read gave.
world.previewInstall({ guid = "..." })
typed/builtin//modules/world_vcs/world/provideDerived
world.provideDerived(outputPath: string, opts: { stage: string? }?) -> number
Take the file at outputPath as the derived output: the file you
wrote is staged as it stands, and the reservation is settled done
with the fingerprint authored, which no recomputation replaces.
Parameters
outputPathstring— The output's VFS path; the file must exist.opts{ stage: string? }(optional) — Optional{ stage: string? }naming the staging area.
Returns number — How many reservations the file filled.
world.provideDerived("/zero/source/gold.material/preview.png")
typed/builtin//modules/world_vcs/world/publishBlockers
world.publishBlockers(opts: StageOpts?) -> { PublishBlockerClass }
List every reason world.push would refuse to publish this
world, as one entry per blocker class: script errors in user
content (script), assets that don't meet their type's content
requirements (content), guids two of the world's own assets state
between them, each path named (sharedGuid), computed asset references a component or
scene entrypoint reaches (staticPin), and the conditions the
publish gate refuses on: a component or scene entrypoint reaching a
dynamic resolve over require/tools.use (gameplayPath), a reference
pinned to an asset the world no longer holds (references), a
reference that names nothing a published world holds, with the file
and line carrying it (unresolvedReferences), a
reference of the world's own file recorded before the world pinned
the library it names (pinPending, which the commit that takes the
file clears by deriving its table at the pin), an error-severity
problem recorded on published content (problems), and an installed
package that content the push publishes requires while the commit
holds no install record of it, so a copy of the published world opens
without it (installs, cleared by staging the package's folder). The
publish gate's classes (gameplayPath, references,
unresolvedReferences, pinPending, problems, installs) are read
over the tree the push releases:
the branch head's commit, each file with the reference table that
commit froze for it, so a file the commit holds and the working tree
no longer does is named, and its class's remedy names the zm add of
its path that stages its removal. A world with no commit yet is read
as the engine holds it, the tree its first commit freezes.
Each class
carries the same title the refusal prints, one items entry per
offending subject (an asset identity, or a <path>:<line> site),
and the single remedy covering that class. This is the account
world.push composes its refusal from, so it names the same
blockers with no push attempted — and in full, where a refusal
bounds how many of a class it prints. zm status prints this list.
One more class blocks the next commit rather than the publish, and
carries blocks = "commit": staleReferences, the files the caller's
staged set holds or leaves out whose references do not resolve in it
(a file whose references moved with a staged change and is left out, or
a staged file stating a version the staged set leaves out). It is the
class world.commit refuses with; world.push never reads it, since
a push publishes what is committed. Empty list = the caller commits
and publishes.
Parameters
optsStageOpts(optional) — Optional{ stage: string? }naming the staging area the read acts on, so acontentitem another area holds names that area in itsstage. Omitted, the read acts on the calling caller's own area.
Returns { PublishBlockerClass } — Array of PublishBlockerClass entries, empty when nothing blocks.
for _, c in ipairs(world.publishBlockers()) do
for _, i in ipairs(c.items) do print(c.kind, i.subject, i.detail) end
end
typed/builtin//modules/world_vcs/world/pull
world.pull(branch: string?, opts: PullOpts?) -> PullResult
git pull: fetch origin/<branch> (default the session branch)
and merge it into the session branch. When the session branch is
strictly behind, its head fast-forwards to the fetched commit; when both
sides moved, a two-parent merge commit lands with the same
conflict/marker/resolve flow as world.merge (resolve the unmerged
paths, then world.add + world.commit; abortable with
world.mergeAbort); when the fetched commit is already in the session
branch's history nothing changes. opts.ffOnly refuses anything but a
fast-forward; opts.noFf always makes a merge commit. Local changes
follow git's rule, as world.merge's do, unsaved scene edits
included. A branch origin does not
hold raises.
Parameters
branchstring(optional) — The origin branch to pull. Defaults to the session branch.optsPullOpts(optional) —{ ffOnly?, noFf? }.
Returns PullResult — A PullResult table: status is up_to_date, fast_forward (commit the new head), clean (commit the merge commit) or conflicts (conflicts).
local r = world.pull()
local r = world.pull("feature")
local r = world.pull("main", { ffOnly = true })
typed/builtin//modules/world_vcs/world/pullAsset
world.pullAsset(opts: PullAssetOpts?) -> PullAssetResult
Pull upstream changes into a previously-installed asset. Re-resolves
the root's transitive closure at opts.ref (default latest) and lands
only what differs from what the world holds (M.__updateRowPlan):
- A file the world never edited (its bytes equal the version it installed) lands whole when its version, its reference table or a stale conflict flag differs from the closure's: bytes and table are written to the pulled row in one step, text and binary alike, and the write reaches source whatever the engine's mode.
- A file the world edited is reconciled from
(row.origin_checksum, row.checksum, entry.checksum)(M.__reconcileDecision):noop(upstream unmoved) leaves it alone,convergedadvances its origin pointer, andmergeruns a three-wayvcs.merge3over (base, local, theirs): a clean result is written and the origin pointer advances, a conflicted result is written WITH markers and the row is flagged conflicted (base + theirs checksums recorded forworld.resolvePullConflict). A binary file the world edited that upstream changed too is flagged conflicted with the structured base/theirs checksums (no marker write). - A folder moves to the closure's version and takes its table.
- A row flagged conflicted that holds the bytes it installed carries no local content: it does not block the pull, and the pull clears it.
Closure drift: an entry the original install never landed is pulled fresh (added). A locally-pulled row nested under the root's own directory whose origin entry disappeared from the closure is removed when it holds the bytes it installed (pruned), or flagged conflicted when it carries edits.
Parameters
optsPullAssetOpts(optional) — SeePullAssetOpts.opts.guidoropts.pathis required;opts.refpins the re-resolve to a branch, a tag or a commit id of the world the asset is published from (defaults to the version that world ships).
Returns PullAssetResult summarising what merged, conflicted, was pruned, and was newly added, the version of the root it landed (root_version), and the reference sites in the pulled content that resolved to nothing where it was published (problems).
world.pullAsset({ guid = "..." })
typed/builtin//modules/world_vcs/world/push
world.push(commitId: string?, opts: PushOpts?) -> (string? | PushQueued, string)
Publish the current branch to ZeroMind. The no-argument form
is a git merge --squash push: EVERY unpushed commit on the
branch collapses into a SINGLE ZeroMind commit (latest content
per path, parented on the branch's current remote HEAD). Because
only the merged final state's bytes are uploaded, a superseded or
lost intermediate-commit blob can never break the push — this is
what makes a churn-heavy world publishable. The local commit
history is preserved as the editing journal; on success every
squashed commit shares the one remote commit id. The explicit
commitId form still pushes that single commit verbatim via
publish_commit (advanced / chain-replay use; its parent must
already be on the remote). While commits are sealed behind derived
outputs, the ready ones land first and the push is queued on the
newest one left that can land. A sealed commit the backend refuses to
land holds only the commits sealed after it that stage a path it
stages; the push publishes the branch without them, and when none of
the sealed commits can land it publishes at once. A push that leaves
sealed commits out warns naming each, with its refusal or the refused
commit it is queued behind, and the zm unseal that returns a commit
to the staging area. With
opts.wait the call waits for the queued push to run and answers
what it answered: the commit id and verdict when it published, a
raise carrying ZeroMind's refusal when it was refused or a sealed
commit it waits for could not land, and a raise saying the push is
still queued, with what it waits on, or still being sent, with its
outcome not known, when the wait ended first. The queued push runs
whatever the wait answers, and zm status states a refused one.
A folder asset of an install that holds a file the world edited,
added or deleted is published as a version of its own under this
world: the checksum its files add up to, each unedited file of it
carried at the version its origin world published
(worldVcs.__installEditsFor). Content of the world that references
the edited asset names that version.
Parameters
commitIdstring(optional) — Optional. A single commit to push verbatim. Omit for the squash push of the whole unpushed stack (the normal path). A push only moves the remote branch forward, as git's does: a remote head no local commit holds raises git's! [rejected] <branch> -> <branch> (fetch first), and one the local head does not descend from raises(non-fast-forward);world.pull()first.opts.forceisgit push --force: a branch whose head is already published moves the remote branch there regardless (a Maintainer's call). A branch with commits not yet published is refused with force, nothing sent (pull first), and so is force withcommitId: force moves the session branch.optsPushOpts(optional) — OptionalPushOpts:stagenames a staging area, the way every other staging verb takes it,forceforces the move, andwait(seconds, ortruefor 120) waits for a queued push to run. The pre-push content gate refuses over every asset the push publishes that falls short of its type's contract, whichever area staged it, and names beside each one the other area holding it, when one does. Omitted, the call acts on the calling caller's own area.
Returns (string? | PushQueued, string) — Two values: the ZeroMind-allocated commit id, and the verdict. "published" with the new commit id when this call published; "already-published" when ZeroMind already carries what this call would have published — the state a push asks for, so it returns rather than raising. That verdict carries the commit's existing ZeroMind id when the publish names one (the single-commit form), and a nil id when it names none (the whole-stack form, which reports a chain). A squash whose merged final state carries dep.unresolved problems takes the slow path inside the same call: the engine re-resolves each pending literal against its live asset index and submits the resolutions to the publish procedure, which completes the push. A reference literal that still resolves to nothing is published with the asset holding it and stays a problem recorded on that asset, while a dep pin the squash severed raises instead; either way the engine names each one with its path, line, reference and reason. A publish ZeroMind refuses raises with ZeroMind's code and message and the action that clears it, chosen by the code: a branch that moved under this push names world.pull(), and a release version already taken names a new version, or, for an asset this world installed from another world as one row per file, the world.convertInstalls call that publishes its changes as this world's.
local zmId = world.push()
local zmId, verdict = world.push()
local queue, verdict = world.push() -- verdict "queued" while commits are sealed
local zmId, verdict = world.push(nil, { wait = 120 }) -- waits for a queued push to run
world.push("01HABC...")
typed/builtin//modules/world_vcs/world/reidentify
world.reidentify(path: string) -> { path: string, previousGuid: string, guid: string, rederived: { string } }
Give the asset at path a guid of its own when another asset of
this world states the same guid (the sharedGuid class
world.publishBlockers and zm status report). The asset keeps its
path and its bytes and takes a freshly minted guid (its files are
removed and written back); the other asset
keeps the guid they shared. Every reference table the world authored is
then derived again, so each reference resolves the asset its literal
names at the version that asset holds: a reference that means this
asset follows it to its new guid, and one that means the other keeps
the shared guid.
Parameters
pathstring— The asset to give its own guid: the copy of the pair.
Returns { path: string, previousGuid: string, guid: string, rederived: { string } } — { path, previousGuid, guid, rederived }, where rederived lists the files whose reference table changed.
local r = world.reidentify("/source/systems/movement/CapsuleWalker.component")
typed/builtin//modules/world_vcs/world/remoteBranches
world.remoteBranches() -> { { branch: string, commit_id: string, origin_head: string } }
Origin's branches as the last fetch of each recorded them — git branch -r. One row per branch of this world that world.fetch has
fetched: branch is origin/<name>, commit_id the local commit
that names origin's head, origin_head that head's ZeroMind id.
Returns { { branch: string, commit_id: string, origin_head: string } } — Array of { branch, commit_id, origin_head }, sorted by branch.
for _, r in ipairs(world.remoteBranches()) do print(r.branch) end
typed/builtin//modules/world_vcs/world/renameBranch
world.renameBranch(oldName: string, newName: string, opts: { force: boolean? }?)
Rename a branch — git branch -m <old> <new>. The branch's
head and history, and your uncommitted changes on it, go to
newName; when oldName is the branch this session is on, the
session moves with it. Another caller's uncommitted changes on
oldName keep that branch in place beside the renamed one.
Parameters
oldNamestring— The branch to rename.newNamestring— Its new name.opts{ force: boolean? }(optional)
world.renameBranch("feature", "feature-2")
typed/builtin//modules/world_vcs/world/reset
world.reset(target: string, opts: ResetOpts?) -> ResetResult
Move the session branch's head to target — git reset [--soft|--mixed|--hard] <commit>. target is any revision
world.revParse reads (a commit id, HEAD~1, a branch, ...).
opts.mode: soft keeps the staged entries and the working tree
and stages every path whose committed version the move changed;
mixed (the default) empties your staging area and keeps the
working tree, so a path the move changed reads as a local change;
hard empties your staging area and brings the working tree to
the new head: every path the move changed, every path your account
changed, and every file of your account's that no commit holds
(an uncommitted install and a scene's autosave overlay included),
each to trash first. A write this session owes the world and the
world is not taking is given up (world.dropOwedWrites). The local
changes of another account stay and are listed in kept. A target equal to HEAD moves nothing, so
world.reset("HEAD") unstages everything and world.reset("HEAD", { mode = "hard" }) discards your local changes. Non-destructive
for history: every commit the head leaves behind becomes a trash
entry that re-attaches it (in chain order).
opts.stage names a staging area, any caller's: world.reset("HEAD", { stage = name }) empties that area, its staged changes and the
outputs it reserves for them, and moves nothing else; the working
tree keeps every edit. emptied says what it held. The name reaches
the area of your account, and when that holds nothing the areas other
accounts hold under it, each named in a warning. A sealed commit of
that name stays sealed (world.unseal returns it to the emptied
name). With a stage named, a target other than HEAD and the soft
and hard modes are refused: they move the branch or the tree, which
a staging area does not hold.
Parameters
targetstring— The revision to move the head to.optsResetOpts(optional) — OptionalResetOpts:mode,stage.
Returns ResetResult — A ResetResult — the new head, its subject line, and the commits left behind.
world.reset("HEAD~1")
world.reset("01HABC...", { mode = "hard" })
world.reset("HEAD", { stage = "client:#chapter4" })
typed/builtin//modules/world_vcs/world/resolvePullConflict
world.resolvePullConflict(path: string, choice: string)
Resolve a conflicted row. A TEXT conflict is one where the file
currently contains conflict markers (world.pullAsset writes
markers only for a text three-way merge that didn't resolve
cleanly); a BINARY/composite conflict has no markers — the local
bytes were left untouched.
choice = "theirs" fetches clean upstream text by content hash
(conflict_theirs_blob_sha256 — path/rename-independent, since
blobs are content-addressed) and overwrites the local file with it
before clearing the flag. It errors, refusing to guess, when the
row records no theirs blob (a binary/composite conflict — a text
blob read can't address theirs for those; keep "ours" or
re-install the asset instead).
choice = "ours" keeps the local side. When the file carries
conflict markers, the local side is reconstructed from them (the
marker writers put ours first, so dropping each block's base and
theirs sections restores your bytes exactly) and written back;
a marker-free file is kept as-is. Either way the flag clears.
Either way, staging the resolved file (world.add) is the normal
git-add path once this returns — this call only clears the
manifest-level flag and (for "theirs") the file content.
Parameters
pathstring— The conflicted row's local VFS path.choicestring—"ours"or"theirs".
world.resolvePullConflict("/source/combat/rules.luau", "theirs")
typed/builtin//modules/world_vcs/world/restore
world.restore(handle: any?)
Restore one trash entry by row_id. Errors verbatim on
handler-not-yet-implemented / world-mismatch. An entry holding content
(a discarded edit, a removed file or folder) returns once the working
copy holds that content again, and every file whose reference table
pins it is derived again, so it names the version the world now holds
and world.vcsStatus lists it as references moved, as after a local
write of that content.
Parameters
handleany(optional) — The trash row id. May be a number or a numeric string.
world.restore(42)
typed/builtin//modules/world_vcs/world/retryDerived
world.retryDerived(outputPath: string, opts: { stage: string? }?) -> number
Compute the derived output at outputPath again, on the staging
area or on a sealed commit that reserves it. A reservation that
failed, was dropped or is done is reserved anew and computed from
the inputs as they stand; a sealed commit waiting on it lands when
it is done.
Parameters
outputPathstring— The output's VFS path, aszm statusnames it.opts{ stage: string? }(optional) — Optional{ stage: string? }naming the staging area.
Returns number — How many reservations were computed again.
world.retryDerived("/zero/source/gold.material/preview.png")
typed/builtin//modules/world_vcs/world/revParse
world.revParse(rev: string) -> string
The commit a revision names — git rev-parse <rev>. A revision
is HEAD, a branch, origin/<branch> (as the last fetch of that
branch recorded it), the name of a branch only origin holds once it
is fetched (world.fetch(branch), such as a pull request's source
branch), a commit id, a ZeroMind commit id (the published commit a
fetch, a push or a pull request names) or a unique prefix of either,
each optionally followed by ~N (N first parents back), ^ (the
first parent) or ^2 (a merge commit's second parent). Raises git's
message for a revision that names nothing, HEAD on a branch with no
commit included.
Parameters
revstring— The revision.
Returns string — The commit id.
local id = world.revParse("HEAD~1")
typed/builtin//modules/world_vcs/world/revertUpdate
world.revertUpdate(library: string)
Revert a library update the working tree holds, as one change: the
pin marker goes back to the version the branch head holds, every
file whose table moved with it is derived again against that pin, and
the versions the move recorded leave, so the tree reads as the head does. The update leaves the staging area
first. A file you edited after the update keeps your edit; only its
table goes back. world.vcsStatus().updates lists the updates.
Parameters
librarystring— The library whose update to revert ("@builtin").
world.revertUpdate("@builtin")
typed/builtin//modules/world_vcs/world/reviewUpdate
world.reviewUpdate(unit: string, opts: ReviewUpdateOpts?) -> UpdateReview
Review what updating one unit changes, writing nothing: the update
itself, never a preview of the asset. Answers the versions the unit
moves from (what the world holds) and to (what its origin holds at
opts.ref, default the ref world.checkUpdates compares it with), then
commits: the commits of the origin world in between, newest first, each
{ id, message, author, date } (more is true past 200), then the files.
modified names up front each file the world holds uncommitted changes
to (a dirty or staged row) that the update touches, { path, outcome }
with outcome merges or conflicts.
- An installed asset (
unitis its root path, asworld.checkUpdatesreports it; a path inside the install stands for its root): the commits that change the install's files, back to the one that moved the root from the version the world holds;fileslists each file the update adds, changes or removes,{ path, change, diff, hunks, local_edit }, wherelocal_editisnone, ormerges/conflictsfor a file the world edited since it was installed. An install that stands as one record keeps the world's edit of a file when it updates, so each edited file the update changes or removes readsconflicts. - A library (
@builtin,@combat, with or without the@): the commits from the pinned commit to the new one andsummarycounts of the library files that change and of this world's files whose references move with the pin (they readreferences movedin status and are committed with the marker).opts.files = trueaddsfiles(each changed library file with its diff) andmoving(those paths).
opts.commits = false reads no commits, and opts.files = false for an
install leaves out files and its diffs: { commits = false, files = false } is the check before an update, answering modified and the
counts alone. When a version of the install's root cannot be read the
commit list stops there, more is true and commits_error says why.
Parameters
unitstring— A library name or an install root path.optsReviewUpdateOpts(optional) —{ ref?, files?, commits? }.
Returns UpdateReview: { kind, unit, from, to, commits, more, commits_error?, files?, moving?, modified, summary }; modified is one { path, outcome = "merges" | "conflicts" } per file holding uncommitted changes of its own that the update touches; summary counts added, changed, removed, modified, and merges / conflicts for an install or moving for a library.
local r = world.reviewUpdate("@builtin")
local r = world.reviewUpdate("/zero/source/Fire.module")
local r = world.reviewUpdate("/zero/source/Fire.module", { commits = false, files = false })
typed/builtin//modules/world_vcs/world/show
world.show(...: string) -> any
Mirror git show's CLI arg shape. Default returns commit
metadata + full diff vs parent. world.show("commit:/path")
returns just the bytes. Flags: --stat, --name-only.
Parameters
...string— Variadic string args: commit id, optional path, optional flags.
Returns any — Either a ShowResult table or a string (for commit:/path).
local r = world.show("abc123")
local r = world.show("--stat", "abc123")
local bytes = world.show("abc123:/foo.luau")
typed/builtin//modules/world_vcs/world/stageVersion
world.stageVersion(rev: string, path: string, opts: StageOpts?) -> boolean
Make the staging area's entry for path the version revision
rev holds — git reset <rev> -- <path> (zm restore --staged --source <rev>). When that version is the one the branch head
holds (both lacking the path included), the path is unstaged, as
the index then matches HEAD there; otherwise a revision that lacks
the path stages its deletion. The working tree is untouched.
Parameters
revstring— Any revisionworld.revParsereads.pathstring— The path to stage.optsStageOpts(optional) — OptionalStageOpts—stage, the staging area.
Returns boolean — true when the staging area holds an entry for the path afterwards, false when the path ended unstaged.
world.stageVersion("HEAD~1", "/source/foo.luau")
typed/builtin//modules/world_vcs/world/stash
world.stash(label: string?) -> StashPushResult
Stash the caller's uncommitted changes — git stash push. The
caller's dirty + staged state on the session branch is saved into
a stash row (label names it), and each stashed path goes back to
its committed version, unstaged. Binary and large content is saved
by its stored blob, so applying the stash brings it back
byte-identical. A path no commit holds keeps its working content in
the tree, as git leaves an untracked file, and is listed under
kept, with its reason in reasons. A folder asset goes back together with the committed paths
beneath it, and those paths are listed under stashed with it. A
path that cannot be taken back raises, naming it and every path
still holding its working content; the stash is saved either way.
Parameters
labelstring(optional) — Optional. Free-form text label for the stash.
Returns StashPushResult — A StashPushResult.
local r = world.stash("wip widget refactor")
typed/builtin//modules/world_vcs/world/stashApply
world.stashApply(ref: any?) -> StashApplyResult
Apply a stash and keep it — git stash apply [<stash>].
Author-only. ref is a row id, stash@{n}, or nil for the
caller's newest stash. Stashed content is written back and staged
entries are staged again. Every file whose reference table pins
content the apply wrote back is derived again, so it names the version
the working copy holds, as after a local write of that content. Each
stashed path is listed by what the apply did with it: under
restored a file written back and a folder
asset a file beneath it came back with, under skipped a path left
as it is, with its reason in reasons. Refuses, writing nothing,
when a path the stash restores holds a different local change.
Parameters
refany(optional) — Optional stash reference.
Returns StashApplyResult — A StashApplyResult.
local r = world.stashApply()
typed/builtin//modules/world_vcs/world/stashDrop
world.stashDrop(ref: any?) -> number
Drop a stash — git stash drop [<stash>]. Author-only. ref
is a row id, stash@{n}, or nil for the caller's newest stash.
The dropped stash goes to trash, where world.restore brings it
back under a new row id.
Parameters
refany(optional) — Optional stash reference.
Returns number — The row id of the dropped stash.
world.stashDrop()
typed/builtin//modules/world_vcs/world/stashPop
world.stashPop(ref: any?) -> StashApplyResult
Apply a stash and drop it — git stash pop [<stash>].
Author-only. ref is a row id, stash@{n}, or nil for the
caller's newest stash. Applies as world.stashApply does; a
refused apply keeps the stash. The dropped stash goes to trash.
Parameters
refany(optional) — Optional stash reference.
Returns StashApplyResult — A StashApplyResult.
local r = world.stashPop()
typed/builtin//modules/world_vcs/world/stashes
world.stashes() -> { StashRow }
List every stash row in the world. Anyone with read access
sees every stash; the per-row author_hex makes it clear
which entries the caller can pop / drop themselves.
Returns { StashRow } — Array of StashRow tables.
local rows = world.stashes()
typed/builtin//modules/world_vcs/world/trash
world.trash() -> { TrashRow }
List trash entries for the world. Anyone with read access
to the world can list trash — recovery is a shared safety net,
not a privacy boundary. The handle (row_id) feeds back into
world.restore. A whole world deleted from ZeroMind is held in
ZeroMind's own trash, which zeromind.trashedWorlds lists and
zeromind.restoreWorld restores from.
Returns { TrashRow } — Array of TrashRow tables.
local rows = world.trash()
typed/builtin//modules/world_vcs/world/trashEmpty
world.trashEmpty() -> number
Permanently delete the trash entries your own operations put
there — zm trash empty — in one transaction. Entries other
callers' operations trashed stay restorable. An emptied entry cannot
be restored.
Returns number — The number of entries deleted.
local n = world.trashEmpty()
typed/builtin//modules/world_vcs/world/uninstallLibrary
world.uninstallLibrary(name: string) -> string
Delete the library marker file. name accepts "@combat"
or "combat" (the leading @ is the convention carried by
the on-disk path).
Parameters
namestring— The library name, with or without the leading@.
Returns string — The marker path that was removed.
world.uninstallLibrary("@combat")
typed/builtin//modules/world_vcs/world/unseal
world.unseal(commitId: string?) -> string
Return a sealed commit to the staging area it was sealed from, with
its message kept, so its paths can be changed and committed again. A
commit world.commit sealed lands by itself once its required derived
outputs are computed; this is the way out of one that cannot land.
Parameters
commitIdstring(optional) — The sealed commit's id. Omitted, the oldest sealed commit holding a failure, else the newest.
Returns string — The id of the commit returned.
world.unseal()
typed/builtin//modules/world_vcs/world/unstage
world.unstage(path: string, opts: StageOpts?) -> UnstageReport
Remove a path from the staging area. Live manifest dirty
state is untouched. A path is staged in one area at a time: a path the
calling area does not hold that another staging area does is taken
out of that area, whichever account opened it, and named in the
report; a take from an area of another account warns, naming that
account, the area and its session. An installed asset is unstaged by
its root path, which takes every row of the install out of the area;
another row of an install raises, naming the install and its root.
The destination of an install held as one record unstages that
record (<path>.pull), the row world.add stages for the same path.
Parameters
pathstring— The path to unstage.optsStageOpts(optional) — Optional{ stage: string? }naming the staging area the path was staged into. Omitted, the call acts on the calling caller's own area.
Returns UnstageReport — { released }: each path taken out of another staging area (stage, account, same_account, session, live). Empty when the calling area held the path.
world.unstage("/source/foo.luau")
world.unstage("/source/foo.luau", { stage = "fauna" })
typed/builtin//modules/world_vcs/world/update
world.update(units: (string | { string })?, opts: UpdateOpts?) -> UpdateResult
Apply updates. With no units, every unit world.checkUpdates
lists; a name or a list of names (library names and install root
paths, mixed) updates those. A library moves its pin
(world.updateLibrary), an installed asset pulls its new closure
(world.pullAsset), one unit at a time: a unit that fails is reported in
its entry and the rest still run, and an install whose local edits
conflict lists the conflicted paths. Each unit is checked against the
files of the world that require it: a library's repinned files, and for
an installed asset every file outside it whose references name it (the
world's own and other installs alike). An installed asset whose new
version leaves such a file not loading (its reload fails, or a site of
it names a version the world holds nowhere) or holding a new analyser
error is not updated, and its error names each file and why;
allowBreaking moves it anyway and names them in broken. Nothing is
staged, committed or
pushed: the updated files wait in world.status(), to_commit lists
every path the updates changed or moved, and warnings names each file
holding uncommitted changes that an update merged into or conflicted.
A dependency an install record places moves inside that record, every
other dependency the record places staying at its release; a unit
answers ok only for a move it made, and a move the record cannot make
is reported in its entry naming the install and the releases.
Parameters
units(string | { string })(optional) — Nil, a unit name, or a list of names.optsUpdateOpts(optional) —{ ref?, allowBreaking? }: a branch name or commit id every unit is updated to, and whether an installed asset moves even when files that require it break.
Returns UpdateResult — { results, to_commit, skipped, warnings, note, summary }: results holds one { unit, kind, from, to, ok, error?, merged?, conflicted?, added?, pruned?, moving?, broken?, problems? } per unit, skipped the units the check could not read, warnings one { unit, path, outcome = "merged" | "conflicted" } per modified file an update touched, and note says nothing was committed.
local r = world.update()
local r = world.update("@combat")
local r = world.update({ "@builtin", "/zero/source/Fire.module" })
typed/builtin//modules/world_vcs/world/updateLibrary
world.updateLibrary(name: string, ref: string?) -> UpdateLibraryResult
Move an installed library to the newest commit of a ref. Resolves
ref in the world the library's marker at /source/libs/@<name>
names; with no ref, @builtin moves to the published commit of it
this engine runs (main when the engine names none), a pin newer than
that commit staying where it is, and every other
library to main. When that is the commit the marker
already holds nothing is written, even when requested_ref differs;
an imported library the engine does not hold at that commit is
mounted and waited for, and a mount that fails raises naming why.
A commit that does not hold an asset the world's own sources require
is refused before anything moves: the error names each such asset with
every source and line requiring it, and the pin stays where it was
until those sources require what the commit holds.
Otherwise the marker is rewritten with the new commit (other marker
fields are kept), the call waits until the engine holds the library at
that commit (@builtin: its pin table is read; another library: its
content is mounted), and the reference tables of the world's own
sources that name the library are derived again. Each source whose table
moved is listed by world.vcsStatus with the reason references moved
and is committed with the marker: a commit holding the marker and
leaving one of them out is refused, naming each. Discarding the marker
puts the pin and its tables back. Works for @builtin
and for every library world.installLibrary wrote. A failed wait puts
the old marker back, waits for the library at the old commit and
raises, saying where it ended. One move per library runs at a time, and
none runs while play is running or in a runtime-profile session.
Parameters
namestring— The library name, with or without the leading@.refstring(optional) — A branch name or commit id of the library's world; defaults to the engine's own commit for@builtinand tomainfor every other library.
Returns UpdateLibraryResult — { name, from, to, changed, rederived, broken, kept, conflicts }: the commits the pin moved between, whether it moved, the source paths whose reference table was derived again (each one to commit with the marker), the repinned files left holding a new error, and the library's files the world edited: kept where the new commit left the file as it was, conflicts where the new commit changed or removed it too. The world's edit stays at its path in both cases.
local r = world.updateLibrary("@builtin")
typed/builtin//modules/world_vcs/world/vcsStatus
world.vcsStatus(opts: StatusOpts?) -> StatusResult
Return the working-tree VCS status: dirty paths, staged
entries, untracked paths, any unmerged ones, and the ignored rows
counted by kind. ignored_summary holds one entry per kind: each
scene's autosave overlay (kind = "overlay", root its scene_dirty
folder) and each .zmignore / .gitignore line that ignores rows
(kind = "rule", file and rule naming it), with its count.
ignored lists those rows one by one when the read is made with
{ ignored = true } (git status --ignored), and is empty otherwise.
A file whose bytes are the ones the branch head holds and whose
reference table is not (a library pin moved, or an asset it references
was renamed, moved or got new bytes) is listed like any change, with
reason = "references moved": in staged when the area holds it, in
dirty otherwise. world.add / world.add_all stage it and it is
committed with the change that moved it. A table that differs only in
the install record the engine writes (an installed asset marked as the
root of its install) is listed the same way with
reason = "install recorded".
An untracked path is one with no committed version behind it, and
it appears in dirty as well — git add . picks up new files too.
Named vcsStatus (not status) because world.status() is the
runtime-snapshot accessor owned by world_status.module; the
source-control surface keeps its own VCS-specific name so the
two never shadow each other.
Each dirty[i].dirtied_by is the identity the row was written
under, which every session of one account shares;
dirtied_by_caller is the stable caller key of the call that wrote
it, dirtied_by_name the name that caller goes by on the world's
roster now,
and writer says what the row is to the calling caller: "you",
"other" (a caller whose session is open), "ended" (a caller
whose session has ended) or "unattributed". dirty_since_micros is the
microsecond timestamp of the first write of the current dirty run.
dirtied_by_account is the account the row's writer acts for and
same_account whether that is the calling caller's account.
local_identity is this connection's identity and
local_caller the calling caller's own stable key, local_name
the name it goes by now, local_account the account it acts for.
claimed_by_other_stages names the paths some other staging area
holds and who holds each: the area, its owner_account, whether
that is the caller's (same_account), the session holding it and
whether that session is open now (live). Staging is advisory: a
staging call that stages one of them takes it out of that area.
reserved_by_other_stages names each other unsealed staging area that
holds reservations (the derived outputs, such as previews, it waits on
for the changes it stages): the area, caller_name, its account and
session, total and the count in each state (by_state). A
reservation leaves its area with the change it was reserved for, and
world.reset("HEAD", { stage = name }) empties an area, its
reservations with it. stage_exists says whether the reported area
exists.
writer_accounts_refusal is set when the world's backend module
predates the record of writers' accounts. stage names the area
staged is the set of, so a caller reads which name reaches its own
staged rows.
Parameters
optsStatusOpts(optional) — Optional{ stage: string?, ignored: boolean? }.stagenames the staging area whose staged set to report; omitted, the read reports the calling caller's own area. The dirty, ignored and untracked sets are the world's working tree and read the same whichever area is named.ignored = truelists every ignored row inignored.
Returns StatusResult — A StatusResult table.
local s = world.vcsStatus()
local s = world.vcsStatus({ stage = "fauna" })
local rows = world.vcsStatus({ ignored = true }).ignored