Protocol: copy, part 2 of 2#
The copy commands a program sends to a running game, as the engine describes them: what each takes, what it answers and what it does. Back to all commands.
copy.flush#
copy.flush {max?: integer} -> {landed: [record], held: [record], refused: [record], batches: [record], runs: integer, max: integer, line: text, ms: number} · write
Lands the landing queue, the session's owner only (E0550 otherwise), in the order it was asked. From its head, a batch is the longest run of queued landings, up to max, that merge onto the game and onto each other as copy.land merges (by thing, part and field) and whose parts said overlap no other member's (one thing's part and another thing's never do); the batch is merged in queue order and tested once over the game, as copy.land tests one copy, saying every part its members say, with the saved tests once. Passing, each member is written as a change of its own in the session's journal and a landing of its own in the log (copy.landed), with its own lines, in queue order (the last also carries the run and the shots the test wrote), so project.undo takes back the last member alone, as after landings one by one; each copy is on what it landed. Failing, the batch is cut in two and each half tested on the game as it is then, the first half landed before the second is tried, down to the landing that fails, which is held with its test's sentence: a batch of K with one landing that fails costs at most 1 + 2 log2(K) runs. A landing that clashes with the game is refused (E0477, its sentence in refused), one with nothing to land too (E0478); one that another landing since its base said a part of is played alone too, so it lands by itself, as copy.land lands it. The same requests in the same order land the same way.
| Parameters | Type | Meaning |
|---|---|---|
max? | integer | The most landings one batch holds, 1 to 256. Left out: 64, a chosen number, not a measured one: a batch of 64 with one landing that fails costs at most 13 runs. Each flush answers its runs and what it held, so a real party's rate of failure can set it. |
| Result | Type | Meaning |
|---|---|---|
landed | [record] | One {copy, landing, change} per landing written, in the order landed. |
held | [record] | One {copy, line} per landing whose test failed: what it differs in that it did not say. |
refused | [record] | One {copy, code, line} per landing not tried: a clash with the game (E0477), nothing to land (E0478), a copy that is gone (E0473). |
batches | [record] | One {copies, runs, split} per batch: its members in queue order, the test runs it took, and split the sentence of each test of more than one landing that failed, after which they were cut in two. |
runs | integer | How many test runs the flush took in all. |
max | integer | The most landings a batch held in this flush (max, or 64). |
line | text | What it came to, in a sentence. |
ms | number | How long the flush took in the engine. |
copy.events#
copy.events {after?: integer, limit?: integer} -> {n: integer, started: number, next: integer, events: [record]} · read, read-only
What the party did, in order, for an editor's Party column and anyone watching it work: one event per copy made, working, asked to land, tested, landed, held, refused, queued, rebased, parked, given or dropped. working is found as the events are asked: a copy whose folder was saved since it was last seen, with the files, things and fields it changed of its base. Ask with after: the n of the last event seen, to have only what came since. The session keeps the last 10,000, in memory: served again, the stream starts again from n 0 with a later started, so a client that sees started change (or n below the after it asked with) lists afresh (copy.list {summary}).
| Parameters | Type | Meaning |
|---|---|---|
after? | integer | Only the events after this n. Left out: from the first kept. |
limit? | integer | At most this many events, up to 500; next then says where to go on. Left out: 500. |
| Result | Type | Meaning |
|---|---|---|
n | integer | The number of the last event: ask after it next. |
started | number | When this session's stream began, in seconds since 1970: another than before means the game was served again and the stream started again. |
next | integer | When more events come after these: the n of the last given, to ask after it. Else null. |
events | [record] | One {n, at, copy, who, what, ...} per event, oldest first: at the seconds since 1970, who the copy's hand's tag or null, what one of made {about}, working {files, things, fields}, asked {says}, tested {passes, line}, landed {landing, change, things, fields, claimed; batch when a queue landed it}, held {line}, refused {code, line, clashes}, queued {place}, rebased {landing, merged}, parked, given {hand, from, mode}, dropped, claimed {things, files, about}, released. things are the scene things it changed, fields each as thing.part.field (thing.part for a value that is not an inline table's field). |
copy.claim#
copy.claim {copy?: text, things?: [text], files?: [text], about?: text, release?: value} -> {copy: text, claims: record, others: [record]} · write
Puts a light claim of a copy on scene things and files, so two agents do not build the same thing: advisory. Everyone sees it (copy.list's claims, copy.events' claimed); a landing that touches a thing or file another copy claims lands as ever and says whose it was (copy.land's claimed); nothing waits on a claim, so a party cannot deadlock. Each call adds to the copy's claim; release ends it. It ends too when the copy lands what it claimed (that thing or file), or is dropped. In memory: the session's: served again, every claim is gone while the copies stay, and a client that sees copy.events' started change claims again. The owner claims for any copy; a copy's hand for its own.
| Parameters | Type | Meaning |
|---|---|---|
copy? | text | The copy that claims. Left out: the hand's own. |
things? | [text] | Scene things, by name, added to its claim. |
files? | [text] | Files, by their path from the project file's folder, added to its claim. |
about? | text | What it is doing with them, in a few words. |
release? | value | true: ends the copy's claim. |
| Result | Type | Meaning |
|---|---|---|
copy | text | The copy. |
claims | record | Its claim now, {things, files, about}, or null when it has none. |
others | [record] | Other copies' claims on the same things or files: {thing | file, copy, about} each. Nothing is refused for them. |
copy.diff#
copy.diff {copy?: text, landing?: integer, context?: integer} -> {files: [record], truncated: value, copy: text, landing: integer, undone: value} · read, read-only
What a copy changed, or what a landing wrote, line by line, for everyone (an editor's Landing panel): for copy, each file it changed, added or took away against its base, the files copy.list's files counts; for landing, each file that landing wrote against the files just before it, read from the texts the landing log keeps (.frost/copies/.texts, by hash), so it is answered after the game is served again too, with undone when project.undo took it back. Bounded: 400 lines in all and 400 characters a line, a line cut marked cut and truncated true when anything was left out (added and removed always count every line); a file that is not text gives its sizes, in bytes, and no hunks. Nothing is written. The texts of the most recent 256 landings are kept (about 27 KB a landing of Ballast: a chosen number); an older landing's diff, its texts let go as later ones landed, is refused in words saying so (E0551), its copy.landed entry with its counts and stages staying. A landing that is not there, or whose kept texts are gone (an older engine's, or removed), is refused in words (E0551), never guessed.
| Parameters | Type | Meaning |
|---|---|---|
copy? | text | The copy whose changes to show. Left out with no landing: the hand's own. |
landing? | integer | The landing whose writes to show, as copy.landed numbers them: in place of copy. |
context? | integer | Lines kept as they were shown around each change, 0 to 3. Left out: 0. |
| Result | Type | Meaning |
|---|---|---|
files | [record] | One {path, added, removed, binary, hunks} per file: added and removed its lines (bytes for one that is not text), hunks [{old_from, new_from, lines: [{op, text, cut?}]}] with op "+", "-" or " " and old_from, new_from the first line of each side, from 1. |
truncated | value | Whether lines, or the end of a line, were left out. |
copy | text | The copy, or the copy whose landing it was. |
landing | integer | For a landing: its number. |
undone | value | For a landing: whether project.undo took it back, retained in this session after journal eviction; null for one of an earlier session. |
copy.park#
copy.park {copy?: text} -> {copy: text, parked: value, was: text, step: integer, checksum: text, held: integer, ms: number} · write
Parks a copy: its game is let go, and its folder, its base and one moment of its game are kept (under 100 KB beyond its folder); the next command that reaches it wakes it from that moment, its game loaded again from its folder, as making one does, so it goes on as it would have. A copy is parked by itself too: idle ten minutes (looked at as each request is taken in), or the one idle longest when a seventeenth would be live. A copy busy with a command is not parked (E0481). The owner parks any copy; a copy's hand its own.
| Parameters | Type | Meaning |
|---|---|---|
copy? | text | The copy to park. Left out: the hand's own. |
| Result | Type | Meaning |
|---|---|---|
copy | text | The copy. |
parked | value | true. |
was | text | "live", or "parked" when it was parked already. |
step | integer | The step its game stood at. |
checksum | text | The world's checksum there. |
held | integer | The bytes it holds parked beyond its folder: the moment, and what it knows of its files, by hash. |
ms | number | How long parking it took in the engine. |
copy.give#
copy.give {copy: text, to: text, mode?: text} -> {copy: text, hand: integer, file: text, from: integer, mode: text} · write
Gives a copy to the hand of a tag, from the session's owner only (E0474 from anyone else): the hand is made (or found, for a tag given before) with a token of its own and a join file, as copy.make {for} makes one, and is in the copy from then on. The hand the copy had is in no game from then on: what it sends is refused (E0480), never carried out in the person's game. Refused (E0480) for a hand that is in another copy, and (E0481) for a copy found with no record. A copy found again after the game was served again has no hand until it is given one.
| Parameters | Type | Meaning |
|---|---|---|
copy | text | The copy to give. |
to | text | The tag of the hand to give it to, 1 to 64 characters. |
mode? | text | The hand's mode: "plan", "ask", "trial" or "free". Left out: "trial". |
| Result | Type | Meaning |
|---|---|---|
copy | text | The copy. |
hand | integer | The hand it is given to. |
file | text | That hand's join file, for frost mcp --join-file. |
from | integer | The hand it had, or null. |
mode | text | The hand's mode. |
Generated from Coldwave 0.0.1 r289, 2026-11-30 by the binary itself: do not edit by hand.