@nervur.org/installer-node 0.37.1 → 0.37.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cargo/worker.js CHANGED
@@ -2354,8 +2354,8 @@ var compileSchema = (schema) => {
2354
2354
  if (first !== void 0) return { why: first };
2355
2355
  if (!isPlain(schema)) return { why: "the schema is no object" };
2356
2356
  const patterns = new Map();
2357
- const refused15 = patternsOf(schema, patterns);
2358
- if (refused15 !== null) return refused15;
2357
+ const refused16 = patternsOf(schema, patterns);
2358
+ if (refused16 !== null) return refused16;
2359
2359
  return { schema: { admits: (value, at = "the value") => check(schema, value, at, patterns) } };
2360
2360
  };
2361
2361
  var admits = (schema, value, at = "the value") => {
@@ -2636,7 +2636,7 @@ var checkBlueprint = (value, node2, longest) => {
2636
2636
  };
2637
2637
  };
2638
2638
 
2639
- var GENOME_VERSION = "0.37.1";
2639
+ var GENOME_VERSION = "0.37.3";
2640
2640
 
2641
2641
  var endFrame = (asker, method3) => ({ end: { asker, method: method3 } });
2642
2642
 
@@ -3515,8 +3515,8 @@ var blueprintIn = (read8, gear, added3) => {
3515
3515
  if (!("data" in read8)) return { why: `the half's first frame is no data: ${read8.why}` };
3516
3516
  const first = read8.data;
3517
3517
  if (!isFields(first)) return { why: "the half's first frame is no blueprint" };
3518
- const { refused: refused15 } = first;
3519
- if (typeof refused15 === "string") return { why: `the half was refused: ${refused15}` };
3518
+ const { refused: refused16 } = first;
3519
+ if (typeof refused16 === "string") return { why: `the half was refused: ${refused16}` };
3520
3520
  if (first["blueprint"] === void 0) return { why: "the half's first frame is no blueprint" };
3521
3521
  const checked4 = checkBlueprint(first["blueprint"], "organ", gear.configuration.longestBudget);
3522
3522
  if ("why" in checked4) return { why: `the half's blueprint: ${checked4.why.join("; ")}` };
@@ -3696,7 +3696,7 @@ var keepHalf = (gear, id, host, connected, added3, failed) => {
3696
3696
 
3697
3697
  var EAR_BLUEPRINT = {
3698
3698
  name: "nervur.ear",
3699
- version: "0.37.1",
3699
+ version: "0.37.3",
3700
3700
  description: "The ear: it opens and seals the boxes of Quo, and the brain keeps every relation.",
3701
3701
  methods: {
3702
3702
  arrived: {
@@ -4265,13 +4265,13 @@ var readFaculty = (engine, crypto2, source, memory) => {
4265
4265
  };
4266
4266
  var facultyReaderOn = (engine, crypto2, memory) => (source) => readFaculty(engine.apart(), crypto2, source, memory);
4267
4267
 
4268
- var EAR_TEXT = "class Ear extends Faculty {\n static #bytes = {\n type: 'string',\n contentEncoding: 'base16',\n maxLength: 1048576,\n };\n static #arrival = { ...Ear.#bytes, maxLength: 1048576 + 1 };\n static #text = { type: 'string', minLength: 1 };\n static #name = { type: 'string', pattern: '^[0-9a-f]{128}$' };\n static #reference = { type: 'string', pattern: '^[a-z2-7]{26}$' };\n static #says = {\n anyOf: [{ type: 'object' }, { type: 'array' }, { type: 'string' }, { type: 'number' }, { type: 'boolean' }],\n };\n static #again = {\n type: 'object',\n properties: { node: Ear.#text, far: Ear.#text },\n required: ['node', 'far'],\n additionalProperties: false,\n };\n\n static blueprint = {\n name: 'nervur.ear',\n version: '0.37.1',\n description: 'The ear: it opens and seals the boxes of Quo, and the brain keeps every relation.',\n methods: {\n arrived: {\n description:\n \"A box arrived on an exchange, sent to the ward named, the public ward where none is: opened, judged by Quo and handed on, or replied. Answers `{opened: true}` where it handed on an ask it admitted on a relation, so the carrier counts what that ask came on as carried, and null otherwise. The brain's alone, with `answer`: what a node answered of an ask the ear handed on, sealed and replied on its exchange.\",\n kind: 'reading',\n args: {\n anyOf: [\n {\n type: 'object',\n properties: {\n exchange: { type: 'integer', minimum: 0 },\n bytes: Ear.#arrival,\n ward: Ear.#name,\n },\n required: ['exchange', 'bytes'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n exchange: { type: 'integer', minimum: 0 },\n door: {},\n admitted: {},\n front: { type: 'boolean' },\n answer: {},\n },\n required: ['exchange', 'door', 'admitted', 'answer'],\n additionalProperties: false,\n },\n ],\n },\n result: {\n anyOf: [\n { type: 'null' },\n {\n type: 'object',\n properties: { opened: { const: true } },\n required: ['opened'],\n additionalProperties: false,\n },\n ],\n },\n errors: ['refused'],\n },\n named: {\n description:\n \"The brain's alone, for its owners' `addresses`. Keeps the addresses of the organism's own an owner named, in place of those before, beside what `network` reports.\",\n kind: 'writing',\n askers: ['brain'],\n args: {\n type: 'object',\n properties: { at: { type: 'array', items: Ear.#text } },\n required: ['at'],\n additionalProperties: false,\n },\n result: { type: 'null' },\n errors: ['refused'],\n },\n addresses: {\n description: 'The addresses `network` last reported.',\n kind: 'writing',\n args: {\n type: 'object',\n properties: { addresses: { type: 'array', items: Ear.#text } },\n required: ['addresses'],\n additionalProperties: false,\n },\n result: { type: 'null' },\n errors: ['refused'],\n },\n line: {\n description:\n 'A line, accepted at an endpoint or held, that names `wards` came up or went down, told by `network` alone. The ear asks the brain `line {wards, up}`, up and down alike: on up the brain asks each lobe granted a standing on one of them `back`, and either way it asks the lobe that gave an occupant drawn through that line `line {far, up}`.',\n kind: 'reading',\n askers: ['network'],\n args: {\n type: 'object',\n properties: { wards: { type: 'array', items: Ear.#name }, up: { type: 'boolean' } },\n required: ['wards', 'up'],\n additionalProperties: false,\n },\n result: { type: 'null' },\n errors: ['refused'],\n },\n challenged: {\n description:\n 'A line `network` holds to `address` was challenged by its listener with `nonce` and `identity`, told by `network` alone. The ear asks the brain `lines {}` for the wards drawn through that address and `key` `prove {wards, nonce, identity}`, and answers `{proofs: [{ward, proof}]}`, each ward with its proof under that challenge alone; a line the brain holds no ward on is answered with none. It writes no cell.',\n kind: 'reading',\n askers: ['network'],\n args: {\n type: 'object',\n properties: {\n address: { type: 'string', minLength: 1 },\n nonce: { type: 'string', contentEncoding: 'base16', minLength: 32, maxLength: 32 },\n identity: { type: 'string', contentEncoding: 'base16', minLength: 32, maxLength: 32 },\n },\n required: ['address', 'nonce', 'identity'],\n additionalProperties: false,\n },\n result: {\n type: 'object',\n properties: {\n proofs: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n ward: Ear.#name,\n proof: { type: 'string', contentEncoding: 'base16', minLength: 64, maxLength: 64 },\n },\n required: ['ward', 'proof'],\n additionalProperties: false,\n },\n },\n },\n required: ['proofs'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n relisten: {\n description:\n \"The brain's alone, told once a change has landed that moved a line, a relation drawn through an address related or ended (`drop`, `left`, a lapse, a reinvite that replaced its keys). The ear asks the brain `lines {}` and `network` `listen {lines}`, durable, the whole set, which replaces the one kept. It writes no cell; it is writing so that it runs alone, behind the reading asks, and nothing waits on it.\",\n kind: 'writing',\n args: { type: 'object', properties: {}, additionalProperties: false },\n result: { type: 'null' },\n errors: ['refused'],\n },\n invite: {\n description:\n \"Draws an invitation to the asker alone, from a ward drawn fresh for it, or the public ward with `public`, kept by the brain for `waits`, null until it is knocked on or ended, and its relation for `lives`, null for good, each span any the asker names, and answers it beside its far organism's ID; the brain asks it with `anchor` for the next anchor. The invitation's text, which `key` has its ward sign whole, carries the two spans it names, `waits` and `lives`, so the side that accepts lapses it by its own clock, and the anchor's mark, `anchor: true`, where it is the next anchor's or, with `first`, the brain's alone, the first invitation. With `note`, free data of at most 4 KiB as its canonical text by default, `note` an owner's word over it, and never a secret, what the standing is for and to whom it is given: the brain keeps it beside the standing, null where none is named, and it never enters the invitation. With `says`, free data never null and never a secret, at most a quarter of the note's bound, 1 KiB by default, which the brain refuses past that bound: what the invitation says to whoever holds it before the yes, carried in the invitation beside its spans, and kept by neither brain but as the offer of a reference. With `again`, `{node, far}`, the brain's alone, the invitation gives again in its place the standing `node` gave of the far organism `far`: it is drawn as ever, and the brain replaces that standing's relation, keeping its far organism, its wires and its note, so `note` is never sent with it. A ward drawn fresh is reached at the address of its own the lobe wired to `relay` gives it, `address {}` answering `{at}`, and where none is wired, where the organism is. With `through`, the address of the organism always on, the ward is reached at that address alone, `at` is `[through]` and no relay is asked, and the brain is told beside the relation which address it was drawn through, so it alone keeps the lines; `through` is refused with `public` or `anchor`, and the brain's `reinvite` of a standing drawn through a line names that `through` again. With `refer`, the invitation is drawn exactly so, a line's or a relay's address among it, but `key` keeps it sealed behind a reference it draws by chance, 128 bits as twenty-six lowercase base32, which the brain holds for `waits` (null until redeemed or dropped), and the answer is `{link: {card, reference}, far}`, never the invitation: `card` is the ward drawn for it and where that ward is reached, so no two links name one ward. A stranger redeems the reference once, on that ward's zero head, by `#redeem {reference}`, which the ear answers itself, the reply's object the invitation; and while it waits reads its offer there as often as it asks, spending nothing, by `#offer {reference}`, the reply's object `{says, waits, lives}`: what the invitation says, null where nothing, what is left of its wait and how long its relation lives, each null for none. With `public` beside `refer`, as for a link on a domain, the invitation is still drawn on a ward fresh for it, and `card` is what `card` answers, the public ward and its addresses, whose zero head redeems it. `refer` is refused with `anchor` and `first`.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: {\n waits: { anyOf: [{ type: 'integer', minimum: 0 }, { type: 'null' }] },\n lives: { anyOf: [{ type: 'integer', minimum: 0 }, { type: 'null' }] },\n anchor: { type: 'boolean' },\n first: { type: 'boolean' },\n public: { type: 'boolean' },\n refer: { type: 'boolean' },\n through: Ear.#text,\n note: {},\n says: Ear.#says,\n again: Ear.#again,\n },\n required: ['waits', 'lives'],\n additionalProperties: false,\n },\n result: {\n anyOf: [\n {\n type: 'object',\n properties: { invitation: Ear.#text, far: Ear.#text },\n required: ['invitation', 'far'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n link: {\n type: 'object',\n properties: {\n card: {\n type: 'object',\n properties: { ward: Ear.#name, at: { type: 'array', items: Ear.#text } },\n required: ['ward', 'at'],\n additionalProperties: false,\n },\n reference: Ear.#reference,\n },\n required: ['card', 'reference'],\n additionalProperties: false,\n },\n far: Ear.#text,\n },\n required: ['link', 'far'],\n additionalProperties: false,\n },\n ],\n },\n errors: ['refused'],\n },\n card: {\n description:\n \"The brain's alone, for its owners' `card`. Answers `{ward, at}`, the public ward's name and the addresses `network` last reported, empty where none was: the very ward and addresses an invitation drawn with `public` carries. It writes no cell and asks no one.\",\n kind: 'reading',\n args: { type: 'object', properties: {}, additionalProperties: false },\n result: {\n type: 'object',\n properties: { ward: Ear.#name, at: { type: 'array', items: Ear.#text } },\n required: ['ward', 'at'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n ward: {\n description:\n \"The brain's alone, for its owners' `ward`. `key` draws a new ward, answered as `{name, sealed}`, which the brain lays in the ear's cell: an ask from far runs through the ear, which could write nothing until it ended.\",\n kind: 'reading',\n args: { type: 'object', properties: {}, additionalProperties: false },\n result: { type: 'object' },\n errors: ['refused'],\n },\n drop: {\n irreversible: true,\n description:\n \"Ends the asker's relation with a far organism. One it gave ends here, and an ask arriving while it ends hears `removed`; a standing it holds ends as the mouth's `drop` ends one, its `#leave` sent first. The brain takes a relation given through a line off its line when it ends. With `reference` instead of `far`, the reference the asker minted is taken off, so a `#redeem` or an `#offer` of it is silence; another node's or an unknown one is refused. The relation of its invitation stays, as any unknocked one does, and lapses by its `waits`.\",\n kind: 'reading',\n args: {\n anyOf: [\n {\n type: 'object',\n properties: { far: Ear.#text },\n required: ['far'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: { reference: Ear.#reference },\n required: ['reference'],\n additionalProperties: false,\n },\n ],\n },\n result: { type: 'null' },\n errors: ['refused'],\n },\n },\n placeholders: {\n brain: 'nervur.brain',\n network: 'nervur.network',\n front: null,\n key: 'nervur.key',\n relay: null,\n },\n };\n\n static #network = 'network';\n static #silence = { silence: true };\n static #redeem = '#redeem';\n static #offer = '#offer';\n static #handed = { handed: true };\n static #opened = { opened: true };\n static #zeros = '0'.repeat(64);\n static #lid = 32;\n\n static #at(data , key ) {\n return Ear.field(data, key) ?? null;\n }\n\n static #heard(answer ) {\n return 'result' in answer ? answer.result : undefined;\n }\n\n #refused({ code, message } ) {\n return this.error(code === 'busy' ? 'busy' : 'refused', message);\n }\n\n #choice(answer , seen , door ) {\n if (Ear.#at(Ear.#at(answer, 'error'), 'code') === 'silent') return Ear.#silence;\n const at = this.#reachedAt(door.at);\n return { object: this.codec.text(answer), seen, ...(at === undefined ? {} : { at }) };\n }\n\n static #described(admitted , answer ) {\n return Ear.#at(admitted, 'method') === null ? (Ear.#at(answer, 'result') ?? answer) : answer;\n }\n\n #reachedAt(own ) {\n const at = Array.isArray(own) ? own : this.cells.get(['addresses']);\n const named = this.cells.get(['named']);\n if (!Array.isArray(named) || named.length === 0) return Array.isArray(at) ? at : undefined;\n return [...(Array.isArray(at) ? at : []), ...named.filter((one) => !Array.isArray(at) || !at.includes(one))];\n }\n\n *#wired(placeholder ) {\n const read = yield {\n placeholder: 'nerves',\n method: 'read',\n args: {},\n };\n const wires = Ear.#heard(read);\n if (!Array.isArray(wires)) return undefined;\n return wires.some((wire) => Ear.#at(wire, 'placeholder') === placeholder && Ear.#at(wire, 'termination') !== null);\n }\n\n #argsOf(admitted ) {\n const text = Ear.#at(admitted, 'args');\n return typeof text === 'string' ? this.codec.read(text) : { why: 'the args are no text' };\n }\n\n *#lookup(heir , zero , door ) {\n if (door.drawn !== null) {\n const occupant = Ear.#at(door.drawn, 'occupant');\n const held = heir !== null && Ear.#at(occupant, 'heir') === heir;\n return { occupants: held ? { [heir]: occupant } : {}, zero: zero && Ear.#at(door.drawn, 'linked') === true };\n }\n if (heir !== null) {\n const relation = yield {\n placeholder: 'brain',\n method: 'relation',\n args: { heir },\n };\n const found = Ear.#heard(relation);\n if (found === undefined) return undefined;\n const held = found !== null && Ear.#at(found, 'ward') === null;\n return { occupants: held ? { [heir]: Ear.#at(found, 'occupant') } : {}, zero: false };\n }\n return { occupants: {}, zero };\n }\n\n *#doorOf(named , ward ) {\n if (typeof named !== 'string' || named === Ear.#at(ward, 'name')) return { ward, drawn: null, at: undefined };\n const relation = yield {\n placeholder: 'brain',\n method: 'relation',\n args: { ward: named },\n };\n const found = Ear.#heard(relation);\n if (found === undefined || found === null) return found;\n const kept = Ear.#at(found, 'ward');\n const own = { name: Ear.#at(kept, 'name'), sealed: Ear.#at(kept, 'sealed') };\n return { ward: own, drawn: found, at: Ear.field(kept, 'at') };\n }\n\n static #after(exchange , door , admitted ) {\n const { ward, at } = door;\n const kept = ['heir', 'by', 'seq', 'method', 'next', 'sealed'].map((name) => [name, Ear.#at(admitted, name)]);\n return {\n exchange,\n door: { ward, ...(at === undefined ? {} : { at }) },\n admitted: { ...Object.fromEntries(kept), args: '' },\n };\n }\n\n *#passed(heir , admitted , door , exchange ) {\n const args = this.#argsOf(admitted);\n const given = 'data' in args ? { args: args.data } : { args: null, refused: args.why };\n yield {\n placeholder: 'brain',\n method: 'pass',\n args: {\n heir,\n method: Ear.#at(admitted, 'method'),\n ...given,\n next: Ear.#at(admitted, 'next'),\n },\n after: Ear.#after(exchange, door, admitted),\n };\n return Ear.#opened;\n }\n\n *#front(admitted , door , exchange ) {\n const method = Ear.#at(admitted, 'method');\n if (method !== null && typeof method !== 'string') return Ear.#silence;\n if ((yield* this.#wired('front')) !== true) return Ear.#silence;\n const args = this.#argsOf(admitted);\n if ('why' in args) return this.#choice({ error: { code: 'refused', message: args.why } }, null, door);\n yield {\n placeholder: 'front',\n method,\n args: args.data,\n after: { ...Ear.#after(exchange, door, admitted), front: true },\n };\n return Ear.#handed;\n }\n\n #answered(args , door ) {\n const admitted = Ear.#at(args, 'admitted');\n const answer = Ear.#at(args, 'answer');\n if (Ear.#at(args, 'front') === true) return this.#choice(Ear.#described(admitted, answer), null, door);\n const heard = Ear.#at(answer, 'result');\n if (heard === null) return undefined;\n const seen = Ear.#at(heard, 'seen');\n return this.#choice(\n Ear.#described(admitted, Ear.#at(heard, 'answer')),\n typeof seen === 'string' ? seen : null,\n door,\n );\n }\n\n *#told(args ) {\n const kept = Ear.#at(args, 'door');\n const door = { ward: Ear.#at(kept, 'ward'), drawn: null, at: Ear.field(kept, 'at') };\n const choice = this.#answered(args, door);\n const reply = choice === undefined ? null : yield* this.#sealed(door.ward, Ear.#at(args, 'admitted'), choice);\n yield { placeholder: 'network', method: 'reply', args: { exchange: Ear.#at(args, 'exchange'), bytes: reply } };\n return null;\n }\n\n *#redeemed(door , admitted ) {\n const asked = this.#referenceOf(door, admitted);\n if (asked === null) return yield* this.#sealed(door.ward, admitted, Ear.#silence);\n const { reference } = asked;\n const kept = yield { placeholder: 'brain', method: 'redeem', args: asked };\n const heard = Ear.#heard(kept);\n if (heard === undefined) return undefined;\n const sealed = Ear.#at(heard, 'sealed');\n if (!(sealed instanceof Uint8Array)) return yield* this.#sealed(door.ward, admitted, Ear.#silence);\n const reply = yield* this.#key('redeem', { ward: door.ward, admitted, reference, sealed });\n const redeemed = Ear.#at(reply, 'reply');\n return redeemed instanceof Uint8Array ? redeemed : yield* this.#sealed(door.ward, admitted, Ear.#silence);\n }\n\n *#offered(door , admitted ) {\n const asked = this.#referenceOf(door, admitted);\n if (asked === null) return yield* this.#sealed(door.ward, admitted, Ear.#silence);\n const kept = yield { placeholder: 'brain', method: 'offered', args: asked };\n const heard = Ear.#heard(kept);\n if (heard === undefined) return undefined;\n const choice = heard === null ? Ear.#silence : { object: this.codec.text(heard), seen: null };\n return yield* this.#sealed(door.ward, admitted, choice);\n }\n\n #referenceOf(door , admitted ) {\n const args = this.#argsOf(admitted);\n const reference = 'data' in args ? Ear.#at(args.data, 'reference') : null;\n if (typeof reference !== 'string' || !/^[a-z2-7]{26}$/.test(reference)) return null;\n return { reference, ward: door.drawn === null ? null : Ear.#at(door.ward, 'name') };\n }\n\n *#key(method , args ) {\n const answer = yield { placeholder: 'key', method, args };\n return Ear.#heard(answer);\n }\n\n *#sealed(ward , admitted , choice ) {\n const chosen = yield* this.#key('choose', { ward, admitted, choice });\n const reply = Ear.#at(chosen, 'reply');\n if (reply instanceof Uint8Array) return reply;\n const silence = yield* this.#key('choose', { ward, admitted, choice: Ear.#silence });\n return Ear.#at(silence, 'reply');\n }\n\n #notNetwork(method ) {\n return this.error('refused', `${method} is network's alone, and ${this.stamp.asker} asks it`);\n }\n\n *arrived(args ) {\n if (this.stamp.asker === 'brain' && Ear.field(args, 'answer') !== undefined) return yield* this.#told(args);\n if (this.stamp.asker !== Ear.#network) return this.#notNetwork('arrived');\n const exchange = Ear.#at(args, 'exchange');\n const bytes = Ear.#at(args, 'bytes');\n const own = this.cells.get(['ward']);\n if (typeof exchange !== 'number' || !(bytes instanceof Uint8Array))\n return this.error('refused', 'arrived takes an exchange and its bytes');\n if (own === undefined) return this.error('refused', 'the ear holds no ward');\n const door = yield* this.#doorOf(Ear.#at(args, 'ward'), own);\n const box = bytes.length > 1048576 ? bytes.subarray(0, Ear.#lid) : bytes;\n const reply = door === undefined || door === null ? null : yield* this.#door(door, box, exchange);\n if (reply === Ear.#handed) return null;\n if (reply === Ear.#opened) return Ear.#opened;\n yield {\n placeholder: 'network',\n method: 'reply',\n args: { exchange, bytes: reply },\n };\n return null;\n }\n\n *#door(door , bytes , exchange ) {\n const { ward } = door;\n const opened = yield* this.#key('openHead', { ward, box: bytes });\n const named = opened === undefined || opened === null ? null : Ear.hex(Ear.#at(opened, 'head'));\n const zero = named === Ear.#zeros;\n const heir = named === null || zero ? null : named;\n const lookup = opened === undefined ? undefined : yield* this.#lookup(heir, zero, door);\n const arrival =\n lookup === undefined\n ? undefined\n : yield* this.#key('arrive', { ward, box: bytes, lookup, opened: opened ?? null });\n if (arrival === undefined || Ear.#at(arrival, 'refused') === true) return Ear.#at(arrival, 'reply');\n const admitted = Ear.#at(arrival, 'admitted');\n const method = Ear.#at(admitted, 'method');\n if (heir === null && method === Ear.#redeem) return (yield* this.#redeemed(door, admitted)) ?? null;\n if (heir === null && method === Ear.#offer) return (yield* this.#offered(door, admitted)) ?? null;\n if (heir === null && door.drawn !== null) return yield* this.#sealed(ward, admitted, Ear.#silence);\n const choice =\n heir === null\n ? yield* this.#front(admitted, door, exchange)\n : yield* this.#passed(heir, admitted, door, exchange);\n return choice === Ear.#handed || choice === Ear.#opened ? choice : yield* this.#sealed(ward, admitted, choice);\n }\n\n named(args ) {\n this.cells.set(['named'], Ear.#at(args, 'at') ?? []);\n return null;\n }\n\n addresses(args ) {\n if (this.stamp.asker !== Ear.#network) return this.#notNetwork('addresses');\n const addresses = Ear.#at(args, 'addresses');\n if (!Array.isArray(addresses)) return this.error('refused', 'addresses takes a list');\n this.cells.set(['addresses'], addresses);\n return null;\n }\n\n *#reached() {\n const wired = yield* this.#wired('relay');\n if (wired === undefined) return { why: 'the nerves answer no wiring' };\n if (!wired) return null;\n const answer = yield {\n placeholder: 'relay',\n method: 'address',\n args: {},\n };\n const heard = Ear.#heard(answer);\n const at = Ear.#at(heard, 'at');\n const through = Ear.#at(heard, 'through');\n const addresses = Array.isArray(at) && at.length > 0 && at.every((one) => typeof one === 'string' && one !== '');\n if (!addresses) return { why: 'the relay gives the ward no address' };\n if (through === null) return { at };\n return typeof through === 'string' && through !== '' ? { at, through } : { why: 'the relay names no line to hold' };\n }\n\n *#drawn(open , through ) {\n const own = this.cells.get(['ward']);\n if (own === undefined) return { why: 'the ear holds no ward' };\n if (open) return { ward: own, at: this.#reachedAt(undefined), kept: null };\n const drawn = yield* this.#key('draw', {});\n const ward = Ear.#at(drawn, 'ward');\n if (ward === null) return { why: 'key draws no ward' };\n if (through !== null) {\n const at = [through];\n return { ward, at, kept: { name: Ear.#at(ward, 'name'), sealed: Ear.#at(ward, 'sealed'), at, through } };\n }\n const reached = yield* this.#reached();\n if (reached !== null && 'why' in reached) return reached;\n const held = reached?.through === undefined ? {} : { through: reached.through };\n const at = reached === null ? {} : { at: reached.at, ...held };\n const kept = { name: Ear.#at(ward, 'name'), sealed: Ear.#at(ward, 'sealed'), ...at };\n return { ward, at: this.#reachedAt(reached?.at), kept };\n }\n\n #againRefusal(args , first ) {\n const again = Ear.#at(args, 'again');\n if (again === null) return null;\n if (this.stamp.asker !== 'brain') return \"again is the brain's alone\";\n if (typeof Ear.#at(again, 'node') !== 'string' || typeof Ear.#at(again, 'far') !== 'string')\n return 'again takes the node and the far organism of a standing';\n const open = first || Ear.#at(args, 'anchor') === true || Ear.#at(args, 'public') === true;\n return open ? 'an occupant given again is never an anchor, nor on the public ward' : null;\n }\n\n #holderOf(args ) {\n const again = Ear.#at(args, 'again');\n if (again === null) return { node: this.stamp.asker, note: Ear.#at(args, 'note') };\n return { node: Ear.#at(again, 'node'), again: Ear.#at(again, 'far') };\n }\n\n #lineOf(args , first ) {\n const asked = Ear.#at(args, 'through');\n if (asked === null) return { through: null };\n if (typeof asked !== 'string' || asked === '') return { why: 'through takes an address' };\n if (first || Ear.#at(args, 'anchor') === true || Ear.#at(args, 'public') === true)\n return { why: 'a ward reached through a line is never an anchor, nor the public ward' };\n return { through: asked };\n }\n\n #referRefusal(args , first ) {\n if (Ear.#at(args, 'refer') !== true) return null;\n return first || Ear.#at(args, 'anchor') === true ? \"a reference is never an anchor's\" : null;\n }\n\n *card() {\n if (this.stamp.asker !== 'brain') return this.error('refused', \"card is the brain's alone\");\n const card = yield* this.#cardOf();\n return 'why' in card ? this.error('refused', card.why) : card;\n }\n\n *ward() {\n if (this.stamp.asker !== 'brain') return this.error('refused', \"ward is the brain's alone\");\n const drawn = yield* this.#key('draw', {});\n const ward = Ear.#at(drawn, 'ward');\n if (ward === null) return this.error('refused', 'key draws no ward');\n return { name: Ear.#at(ward, 'name'), sealed: Ear.#at(ward, 'sealed') };\n }\n\n *invite(args ) {\n const waits = Ear.#at(args, 'waits');\n const lives = Ear.#at(args, 'lives');\n const marked = Ear.#at(args, 'anchor') === true ? { anchor: true } : {};\n const spans = [waits, lives].every((span) => span === null || typeof span === 'number');\n if (!spans) return this.error('refused', 'invite takes two spans');\n const says = Ear.field(args, 'says');\n if (says === null) return this.error('refused', 'says is never null: an invitation that says nothing names none');\n const first = Ear.#at(args, 'first') === true;\n if (first && this.stamp.asker !== 'brain') return this.error('refused', \"first is the brain's alone\");\n const refusal = this.#againRefusal(args, first);\n if (refusal !== null) return this.error('refused', refusal);\n const line = this.#lineOf(args, first);\n if ('why' in line) return this.error('refused', line.why);\n const barred = this.#referRefusal(args, first);\n if (barred !== null) return this.error('refused', barred);\n const { through } = line;\n const refer = Ear.#at(args, 'refer') === true;\n const open = Ear.#at(args, 'public') === true;\n const drawn = yield* this.#drawn(open && !refer, through);\n if ('why' in drawn) return this.error('refused', drawn.why);\n const at = drawn.at === undefined ? {} : { at: drawn.at };\n const said = says === undefined ? {} : { says };\n const beside = {\n ...(waits === null ? {} : { waits }),\n ...(lives === null ? {} : { lives }),\n ...said,\n ...(first || Ear.#at(args, 'anchor') === true ? { anchor: true } : {}),\n };\n const invited = yield* this.#key('invite', { ward: drawn.ward, ...at, beside });\n const text = Ear.#at(invited, 'invitation');\n const heir = Ear.#at(invited, 'heir');\n if (typeof text !== 'string' || typeof heir !== 'string') return this.error('refused', 'key draws no invitation');\n const ward = drawn.kept === null ? {} : { ward: drawn.kept };\n const kept = this.#holderOf(args);\n const named = first ? { first: true } : {};\n const related = yield {\n placeholder: 'brain',\n method: 'relate',\n args: { ...kept, heir, waits, lives, ...said, ...marked, ...ward, ...named },\n };\n if ('error' in related) return this.#refused(related.error);\n const far = Ear.#at(related.result, 'far');\n if (!refer) return { invitation: text, far };\n const name = Ear.#at(drawn.ward, 'name');\n const door = open ? yield* this.#cardOf() : { ward: name, at: Array.isArray(drawn.at) ? drawn.at : [] };\n if ('why' in door) return this.error('refused', door.why);\n const minted = { node: kept.node, waits, lives, says: says ?? null, far, ward: name, public: open };\n return yield* this.#referred(text, door, minted);\n }\n\n *#referred(\n text ,\n card ,\n minted \n \n \n \n \n \n \n \n ,\n ) {\n const referred = yield* this.#key('refer', { invitation: text });\n const reference = Ear.#at(referred, 'reference');\n const sealed = Ear.#at(referred, 'sealed');\n if (typeof reference !== 'string' || !(sealed instanceof Uint8Array))\n return this.error('refused', 'key keeps no reference');\n const kept = yield {\n placeholder: 'brain',\n method: 'refer',\n args: {\n node: minted.node,\n reference,\n sealed,\n waits: minted.waits,\n ward: minted.ward,\n public: minted.public,\n says: minted.says,\n lives: minted.lives,\n },\n };\n if ('error' in kept) return this.#refused(kept.error);\n return { link: { card, reference }, far: minted.far };\n }\n\n *#cardOf() {\n const drawn = yield* this.#drawn(true, null);\n if ('why' in drawn) return drawn;\n return { ward: Ear.#at(drawn.ward, 'name'), at: Array.isArray(drawn.at) ? drawn.at : [] };\n }\n\n *drop(args ) {\n const far = Ear.#at(args, 'far');\n const reference = Ear.#at(args, 'reference');\n if (typeof reference === 'string' && far === null) {\n const unrefer = yield {\n placeholder: 'brain',\n method: 'unrefer',\n args: { reference, node: this.stamp.asker },\n };\n return 'error' in unrefer ? this.#refused(unrefer.error) : null;\n }\n if (typeof far !== 'string' || reference !== null)\n return this.error('refused', 'drop takes a far organism or a reference');\n const ended = yield {\n placeholder: 'brain',\n method: 'end',\n args: { far, node: this.stamp.asker },\n };\n return 'error' in ended ? this.#refused(ended.error) : null;\n }\n\n *relisten(_args ) {\n if (this.stamp.asker !== 'brain') return this.error('refused', \"relisten is the brain's alone\");\n const held = yield { placeholder: 'brain', method: 'lines', args: {} };\n if ('error' in held) return this.#refused(held.error);\n if (!Array.isArray(held.result)) return this.error('refused', 'the brain answers no lines');\n const lines = held.result.map((line) => {\n const wards = Ear.#at(line, 'wards');\n const names = Array.isArray(wards) ? wards.map((ward) => Ear.#at(ward, 'name')) : [];\n return { address: Ear.#at(line, 'address'), wards: names };\n });\n const listened = yield {\n placeholder: Ear.#network,\n method: 'listen',\n args: { lines },\n durable: true,\n };\n return 'error' in listened ? this.#refused(listened.error) : null;\n }\n\n *challenged(args ) {\n if (this.stamp.asker !== Ear.#network) return this.#notNetwork('challenged');\n const [address, nonce, identity] = [Ear.#at(args, 'address'), Ear.#at(args, 'nonce'), Ear.#at(args, 'identity')];\n const held = yield { placeholder: 'brain', method: 'lines', args: {} };\n if ('error' in held) return this.#refused(held.error);\n const line = Array.isArray(held.result)\n ? held.result.find((one) => Ear.#at(one, 'address') === address)\n : undefined;\n const wards = Ear.#at(line, 'wards');\n if (!Array.isArray(wards) || wards.length === 0) return { proofs: [] };\n const proofs = Ear.#at(yield* this.#key('prove', { wards, nonce, identity }), 'proofs');\n if (!Array.isArray(proofs)) return this.error('refused', 'key proves no ward of the line');\n return { proofs: wards.map((ward, at) => ({ ward: Ear.#at(ward, 'name'), proof: proofs[at] ?? null })) };\n }\n\n *line(args ) {\n if (this.stamp.asker !== Ear.#network) return this.#notNetwork('line');\n const wards = Ear.#at(args, 'wards');\n const up = Ear.#at(args, 'up');\n if (!Array.isArray(wards) || typeof up !== 'boolean') return this.error('refused', 'line takes wards and up');\n const told = yield {\n placeholder: 'brain',\n method: 'line',\n args: { wards, up },\n };\n return 'error' in told ? this.#refused(told.error) : null;\n }\n}";
4268
+ var EAR_TEXT = "class Ear extends Faculty {\n static #bytes = {\n type: 'string',\n contentEncoding: 'base16',\n maxLength: 1048576,\n };\n static #arrival = { ...Ear.#bytes, maxLength: 1048576 + 1 };\n static #text = { type: 'string', minLength: 1 };\n static #name = { type: 'string', pattern: '^[0-9a-f]{128}$' };\n static #reference = { type: 'string', pattern: '^[a-z2-7]{26}$' };\n static #says = {\n anyOf: [{ type: 'object' }, { type: 'array' }, { type: 'string' }, { type: 'number' }, { type: 'boolean' }],\n };\n static #again = {\n type: 'object',\n properties: { node: Ear.#text, far: Ear.#text },\n required: ['node', 'far'],\n additionalProperties: false,\n };\n\n static blueprint = {\n name: 'nervur.ear',\n version: '0.37.3',\n description: 'The ear: it opens and seals the boxes of Quo, and the brain keeps every relation.',\n methods: {\n arrived: {\n description:\n \"A box arrived on an exchange, sent to the ward named, the public ward where none is: opened, judged by Quo and handed on, or replied. Answers `{opened: true}` where it handed on an ask it admitted on a relation, so the carrier counts what that ask came on as carried, and null otherwise. The brain's alone, with `answer`: what a node answered of an ask the ear handed on, sealed and replied on its exchange.\",\n kind: 'reading',\n args: {\n anyOf: [\n {\n type: 'object',\n properties: {\n exchange: { type: 'integer', minimum: 0 },\n bytes: Ear.#arrival,\n ward: Ear.#name,\n },\n required: ['exchange', 'bytes'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n exchange: { type: 'integer', minimum: 0 },\n door: {},\n admitted: {},\n front: { type: 'boolean' },\n answer: {},\n },\n required: ['exchange', 'door', 'admitted', 'answer'],\n additionalProperties: false,\n },\n ],\n },\n result: {\n anyOf: [\n { type: 'null' },\n {\n type: 'object',\n properties: { opened: { const: true } },\n required: ['opened'],\n additionalProperties: false,\n },\n ],\n },\n errors: ['refused'],\n },\n named: {\n description:\n \"The brain's alone, for its owners' `addresses`. Keeps the addresses of the organism's own an owner named, in place of those before, beside what `network` reports.\",\n kind: 'writing',\n askers: ['brain'],\n args: {\n type: 'object',\n properties: { at: { type: 'array', items: Ear.#text } },\n required: ['at'],\n additionalProperties: false,\n },\n result: { type: 'null' },\n errors: ['refused'],\n },\n addresses: {\n description: 'The addresses `network` last reported.',\n kind: 'writing',\n args: {\n type: 'object',\n properties: { addresses: { type: 'array', items: Ear.#text } },\n required: ['addresses'],\n additionalProperties: false,\n },\n result: { type: 'null' },\n errors: ['refused'],\n },\n line: {\n description:\n 'A line, accepted at an endpoint or held, that names `wards` came up or went down, told by `network` alone. The ear asks the brain `line {wards, up}`, up and down alike: on up the brain asks each lobe granted a standing on one of them `back`, and either way it asks the lobe that gave an occupant drawn through that line `line {far, up}`.',\n kind: 'reading',\n askers: ['network'],\n args: {\n type: 'object',\n properties: { wards: { type: 'array', items: Ear.#name }, up: { type: 'boolean' } },\n required: ['wards', 'up'],\n additionalProperties: false,\n },\n result: { type: 'null' },\n errors: ['refused'],\n },\n challenged: {\n description:\n 'A line `network` holds to `address` was challenged by its listener with `nonce` and `identity`, told by `network` alone. The ear asks the brain `lines {}` for the wards drawn through that address and `key` `prove {wards, nonce, identity}`, and answers `{proofs: [{ward, proof}]}`, each ward with its proof under that challenge alone; a line the brain holds no ward on is answered with none. It writes no cell.',\n kind: 'reading',\n askers: ['network'],\n args: {\n type: 'object',\n properties: {\n address: { type: 'string', minLength: 1 },\n nonce: { type: 'string', contentEncoding: 'base16', minLength: 32, maxLength: 32 },\n identity: { type: 'string', contentEncoding: 'base16', minLength: 32, maxLength: 32 },\n },\n required: ['address', 'nonce', 'identity'],\n additionalProperties: false,\n },\n result: {\n type: 'object',\n properties: {\n proofs: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n ward: Ear.#name,\n proof: { type: 'string', contentEncoding: 'base16', minLength: 64, maxLength: 64 },\n },\n required: ['ward', 'proof'],\n additionalProperties: false,\n },\n },\n },\n required: ['proofs'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n relisten: {\n description:\n \"The brain's alone, told once a change has landed that moved a line, a relation drawn through an address related or ended (`drop`, `left`, a lapse, a reinvite that replaced its keys). The ear asks the brain `lines {}` and `network` `listen {lines}`, durable, the whole set, which replaces the one kept. It writes no cell; it is writing so that it runs alone, behind the reading asks, and nothing waits on it.\",\n kind: 'writing',\n args: { type: 'object', properties: {}, additionalProperties: false },\n result: { type: 'null' },\n errors: ['refused'],\n },\n invite: {\n description:\n \"Draws an invitation to the asker alone, from a ward drawn fresh for it, or the public ward with `public`, kept by the brain for `waits`, null until it is knocked on or ended, and its relation for `lives`, null for good, each span any the asker names, and answers it beside its far organism's ID; the brain asks it with `anchor` for the next anchor. The invitation's text, which `key` has its ward sign whole, carries the two spans it names, `waits` and `lives`, so the side that accepts lapses it by its own clock, and the anchor's mark, `anchor: true`, where it is the next anchor's or, with `first`, the brain's alone, the first invitation. With `note`, free data of at most 4 KiB as its canonical text by default, `note` an owner's word over it, and never a secret, what the standing is for and to whom it is given: the brain keeps it beside the standing, null where none is named, and it never enters the invitation. With `says`, free data never null and never a secret, at most a quarter of the note's bound, 1 KiB by default, which the brain refuses past that bound: what the invitation says to whoever holds it before the yes, carried in the invitation beside its spans, and kept by neither brain but as the offer of a reference. With `again`, `{node, far}`, the brain's alone, the invitation gives again in its place the standing `node` gave of the far organism `far`: it is drawn as ever, and the brain replaces that standing's relation, keeping its far organism, its wires and its note, so `note` is never sent with it. A ward drawn fresh is reached at the address of its own the lobe wired to `relay` gives it, `address {}` answering `{at}`, and where none is wired, where the organism is. With `through`, the address of the organism always on, the ward is reached at that address alone, `at` is `[through]` and no relay is asked, and the brain is told beside the relation which address it was drawn through, so it alone keeps the lines; `through` is refused with `public` or `anchor`, and the brain's `reinvite` of a standing drawn through a line names that `through` again. With `refer`, the invitation is drawn exactly so, a line's or a relay's address among it, but `key` keeps it sealed behind a reference it draws by chance, 128 bits as twenty-six lowercase base32, which the brain holds for `waits` (null until redeemed or dropped), and the answer is `{link: {card, reference}, far}`, never the invitation: `card` is the ward drawn for it and where that ward is reached, so no two links name one ward. A stranger redeems the reference once, on that ward's zero head, by `#redeem {reference}`, which the ear answers itself, the reply's object the invitation; and while it waits reads its offer there as often as it asks, spending nothing, by `#offer {reference}`, the reply's object `{says, waits, lives}`: what the invitation says, null where nothing, what is left of its wait and how long its relation lives, each null for none. With `public` beside `refer`, as for a link on a domain, the invitation is still drawn on a ward fresh for it, and `card` is what `card` answers, the public ward and its addresses, whose zero head redeems it. `refer` is refused with `anchor` and `first`.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: {\n waits: { anyOf: [{ type: 'integer', minimum: 0 }, { type: 'null' }] },\n lives: { anyOf: [{ type: 'integer', minimum: 0 }, { type: 'null' }] },\n anchor: { type: 'boolean' },\n first: { type: 'boolean' },\n public: { type: 'boolean' },\n refer: { type: 'boolean' },\n through: Ear.#text,\n note: {},\n says: Ear.#says,\n again: Ear.#again,\n },\n required: ['waits', 'lives'],\n additionalProperties: false,\n },\n result: {\n anyOf: [\n {\n type: 'object',\n properties: { invitation: Ear.#text, far: Ear.#text },\n required: ['invitation', 'far'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n link: {\n type: 'object',\n properties: {\n card: {\n type: 'object',\n properties: { ward: Ear.#name, at: { type: 'array', items: Ear.#text } },\n required: ['ward', 'at'],\n additionalProperties: false,\n },\n reference: Ear.#reference,\n },\n required: ['card', 'reference'],\n additionalProperties: false,\n },\n far: Ear.#text,\n },\n required: ['link', 'far'],\n additionalProperties: false,\n },\n ],\n },\n errors: ['refused'],\n },\n card: {\n description:\n \"The brain's alone, for its owners' `card`. Answers `{ward, at}`, the public ward's name and the addresses `network` last reported, empty where none was: the very ward and addresses an invitation drawn with `public` carries. It writes no cell and asks no one.\",\n kind: 'reading',\n args: { type: 'object', properties: {}, additionalProperties: false },\n result: {\n type: 'object',\n properties: { ward: Ear.#name, at: { type: 'array', items: Ear.#text } },\n required: ['ward', 'at'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n ward: {\n description:\n \"The brain's alone, for its owners' `ward`. `key` draws a new ward, answered as `{name, sealed}`, which the brain lays in the ear's cell: an ask from far runs through the ear, which could write nothing until it ended.\",\n kind: 'reading',\n args: { type: 'object', properties: {}, additionalProperties: false },\n result: { type: 'object' },\n errors: ['refused'],\n },\n drop: {\n irreversible: true,\n description:\n \"Ends the asker's relation with a far organism. One it gave ends here, and an ask arriving while it ends hears `removed`; a standing it holds ends as the mouth's `drop` ends one, its `#leave` sent first. The brain takes a relation given through a line off its line when it ends. With `reference` instead of `far`, the reference the asker minted is taken off, so a `#redeem` or an `#offer` of it is silence; another node's or an unknown one is refused. The relation of its invitation stays, as any unknocked one does, and lapses by its `waits`.\",\n kind: 'reading',\n args: {\n anyOf: [\n {\n type: 'object',\n properties: { far: Ear.#text },\n required: ['far'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: { reference: Ear.#reference },\n required: ['reference'],\n additionalProperties: false,\n },\n ],\n },\n result: { type: 'null' },\n errors: ['refused'],\n },\n },\n placeholders: {\n brain: 'nervur.brain',\n network: 'nervur.network',\n front: null,\n key: 'nervur.key',\n relay: null,\n },\n };\n\n static #network = 'network';\n static #silence = { silence: true };\n static #redeem = '#redeem';\n static #offer = '#offer';\n static #handed = { handed: true };\n static #opened = { opened: true };\n static #zeros = '0'.repeat(64);\n static #lid = 32;\n\n static #at(data , key ) {\n return Ear.field(data, key) ?? null;\n }\n\n static #heard(answer ) {\n return 'result' in answer ? answer.result : undefined;\n }\n\n #refused({ code, message } ) {\n return this.error(code === 'busy' ? 'busy' : 'refused', message);\n }\n\n #choice(answer , seen , door ) {\n if (Ear.#at(Ear.#at(answer, 'error'), 'code') === 'silent') return Ear.#silence;\n const at = this.#reachedAt(door.at);\n return { object: this.codec.text(answer), seen, ...(at === undefined ? {} : { at }) };\n }\n\n static #described(admitted , answer ) {\n return Ear.#at(admitted, 'method') === null ? (Ear.#at(answer, 'result') ?? answer) : answer;\n }\n\n #reachedAt(own ) {\n const at = Array.isArray(own) ? own : this.cells.get(['addresses']);\n const named = this.cells.get(['named']);\n if (!Array.isArray(named) || named.length === 0) return Array.isArray(at) ? at : undefined;\n return [...(Array.isArray(at) ? at : []), ...named.filter((one) => !Array.isArray(at) || !at.includes(one))];\n }\n\n *#wired(placeholder ) {\n const read = yield {\n placeholder: 'nerves',\n method: 'read',\n args: {},\n };\n const wires = Ear.#heard(read);\n if (!Array.isArray(wires)) return undefined;\n return wires.some((wire) => Ear.#at(wire, 'placeholder') === placeholder && Ear.#at(wire, 'termination') !== null);\n }\n\n #argsOf(admitted ) {\n const text = Ear.#at(admitted, 'args');\n return typeof text === 'string' ? this.codec.read(text) : { why: 'the args are no text' };\n }\n\n *#lookup(heir , zero , door ) {\n if (door.drawn !== null) {\n const occupant = Ear.#at(door.drawn, 'occupant');\n const held = heir !== null && Ear.#at(occupant, 'heir') === heir;\n return { occupants: held ? { [heir]: occupant } : {}, zero: zero && Ear.#at(door.drawn, 'linked') === true };\n }\n if (heir !== null) {\n const relation = yield {\n placeholder: 'brain',\n method: 'relation',\n args: { heir },\n };\n const found = Ear.#heard(relation);\n if (found === undefined) return undefined;\n const held = found !== null && Ear.#at(found, 'ward') === null;\n return { occupants: held ? { [heir]: Ear.#at(found, 'occupant') } : {}, zero: false };\n }\n return { occupants: {}, zero };\n }\n\n *#doorOf(named , ward ) {\n if (typeof named !== 'string' || named === Ear.#at(ward, 'name')) return { ward, drawn: null, at: undefined };\n const relation = yield {\n placeholder: 'brain',\n method: 'relation',\n args: { ward: named },\n };\n const found = Ear.#heard(relation);\n if (found === undefined || found === null) return found;\n const kept = Ear.#at(found, 'ward');\n const own = { name: Ear.#at(kept, 'name'), sealed: Ear.#at(kept, 'sealed') };\n return { ward: own, drawn: found, at: Ear.field(kept, 'at') };\n }\n\n static #after(exchange , door , admitted ) {\n const { ward, at } = door;\n const kept = ['heir', 'by', 'seq', 'method', 'next', 'sealed'].map((name) => [name, Ear.#at(admitted, name)]);\n return {\n exchange,\n door: { ward, ...(at === undefined ? {} : { at }) },\n admitted: { ...Object.fromEntries(kept), args: '' },\n };\n }\n\n *#passed(heir , admitted , door , exchange ) {\n const args = this.#argsOf(admitted);\n const given = 'data' in args ? { args: args.data } : { args: null, refused: args.why };\n yield {\n placeholder: 'brain',\n method: 'pass',\n args: {\n heir,\n method: Ear.#at(admitted, 'method'),\n ...given,\n next: Ear.#at(admitted, 'next'),\n },\n after: Ear.#after(exchange, door, admitted),\n };\n return Ear.#opened;\n }\n\n *#front(admitted , door , exchange ) {\n const method = Ear.#at(admitted, 'method');\n if (method !== null && typeof method !== 'string') return Ear.#silence;\n if ((yield* this.#wired('front')) !== true) return Ear.#silence;\n const args = this.#argsOf(admitted);\n if ('why' in args) return this.#choice({ error: { code: 'refused', message: args.why } }, null, door);\n yield {\n placeholder: 'front',\n method,\n args: args.data,\n after: { ...Ear.#after(exchange, door, admitted), front: true },\n };\n return Ear.#handed;\n }\n\n #answered(args , door ) {\n const admitted = Ear.#at(args, 'admitted');\n const answer = Ear.#at(args, 'answer');\n if (Ear.#at(args, 'front') === true) return this.#choice(Ear.#described(admitted, answer), null, door);\n const heard = Ear.#at(answer, 'result');\n if (heard === null) return undefined;\n const seen = Ear.#at(heard, 'seen');\n return this.#choice(\n Ear.#described(admitted, Ear.#at(heard, 'answer')),\n typeof seen === 'string' ? seen : null,\n door,\n );\n }\n\n *#told(args ) {\n const kept = Ear.#at(args, 'door');\n const door = { ward: Ear.#at(kept, 'ward'), drawn: null, at: Ear.field(kept, 'at') };\n const choice = this.#answered(args, door);\n const reply = choice === undefined ? null : yield* this.#sealed(door.ward, Ear.#at(args, 'admitted'), choice);\n yield { placeholder: 'network', method: 'reply', args: { exchange: Ear.#at(args, 'exchange'), bytes: reply } };\n return null;\n }\n\n *#redeemed(door , admitted ) {\n const asked = this.#referenceOf(door, admitted);\n if (asked === null) return yield* this.#sealed(door.ward, admitted, Ear.#silence);\n const { reference } = asked;\n const kept = yield { placeholder: 'brain', method: 'redeem', args: asked };\n const heard = Ear.#heard(kept);\n if (heard === undefined) return undefined;\n const sealed = Ear.#at(heard, 'sealed');\n if (!(sealed instanceof Uint8Array)) return yield* this.#sealed(door.ward, admitted, Ear.#silence);\n const reply = yield* this.#key('redeem', { ward: door.ward, admitted, reference, sealed });\n const redeemed = Ear.#at(reply, 'reply');\n return redeemed instanceof Uint8Array ? redeemed : yield* this.#sealed(door.ward, admitted, Ear.#silence);\n }\n\n *#offered(door , admitted ) {\n const asked = this.#referenceOf(door, admitted);\n if (asked === null) return yield* this.#sealed(door.ward, admitted, Ear.#silence);\n const kept = yield { placeholder: 'brain', method: 'offered', args: asked };\n const heard = Ear.#heard(kept);\n if (heard === undefined) return undefined;\n const choice = heard === null ? Ear.#silence : { object: this.codec.text(heard), seen: null };\n return yield* this.#sealed(door.ward, admitted, choice);\n }\n\n #referenceOf(door , admitted ) {\n const args = this.#argsOf(admitted);\n const reference = 'data' in args ? Ear.#at(args.data, 'reference') : null;\n if (typeof reference !== 'string' || !/^[a-z2-7]{26}$/.test(reference)) return null;\n return { reference, ward: door.drawn === null ? null : Ear.#at(door.ward, 'name') };\n }\n\n *#key(method , args ) {\n const answer = yield { placeholder: 'key', method, args };\n return Ear.#heard(answer);\n }\n\n *#sealed(ward , admitted , choice ) {\n const chosen = yield* this.#key('choose', { ward, admitted, choice });\n const reply = Ear.#at(chosen, 'reply');\n if (reply instanceof Uint8Array) return reply;\n const silence = yield* this.#key('choose', { ward, admitted, choice: Ear.#silence });\n return Ear.#at(silence, 'reply');\n }\n\n #notNetwork(method ) {\n return this.error('refused', `${method} is network's alone, and ${this.stamp.asker} asks it`);\n }\n\n *arrived(args ) {\n if (this.stamp.asker === 'brain' && Ear.field(args, 'answer') !== undefined) return yield* this.#told(args);\n if (this.stamp.asker !== Ear.#network) return this.#notNetwork('arrived');\n const exchange = Ear.#at(args, 'exchange');\n const bytes = Ear.#at(args, 'bytes');\n const own = this.cells.get(['ward']);\n if (typeof exchange !== 'number' || !(bytes instanceof Uint8Array))\n return this.error('refused', 'arrived takes an exchange and its bytes');\n if (own === undefined) return this.error('refused', 'the ear holds no ward');\n const door = yield* this.#doorOf(Ear.#at(args, 'ward'), own);\n const box = bytes.length > 1048576 ? bytes.subarray(0, Ear.#lid) : bytes;\n const reply = door === undefined || door === null ? null : yield* this.#door(door, box, exchange);\n if (reply === Ear.#handed) return null;\n if (reply === Ear.#opened) return Ear.#opened;\n yield {\n placeholder: 'network',\n method: 'reply',\n args: { exchange, bytes: reply },\n };\n return null;\n }\n\n *#door(door , bytes , exchange ) {\n const { ward } = door;\n const opened = yield* this.#key('openHead', { ward, box: bytes });\n const named = opened === undefined || opened === null ? null : Ear.hex(Ear.#at(opened, 'head'));\n const zero = named === Ear.#zeros;\n const heir = named === null || zero ? null : named;\n const lookup = opened === undefined ? undefined : yield* this.#lookup(heir, zero, door);\n const arrival =\n lookup === undefined\n ? undefined\n : yield* this.#key('arrive', { ward, box: bytes, lookup, opened: opened ?? null });\n if (arrival === undefined || Ear.#at(arrival, 'refused') === true) return Ear.#at(arrival, 'reply');\n const admitted = Ear.#at(arrival, 'admitted');\n const method = Ear.#at(admitted, 'method');\n if (heir === null && method === Ear.#redeem) return (yield* this.#redeemed(door, admitted)) ?? null;\n if (heir === null && method === Ear.#offer) return (yield* this.#offered(door, admitted)) ?? null;\n if (heir === null && door.drawn !== null) return yield* this.#sealed(ward, admitted, Ear.#silence);\n const choice =\n heir === null\n ? yield* this.#front(admitted, door, exchange)\n : yield* this.#passed(heir, admitted, door, exchange);\n return choice === Ear.#handed || choice === Ear.#opened ? choice : yield* this.#sealed(ward, admitted, choice);\n }\n\n named(args ) {\n this.cells.set(['named'], Ear.#at(args, 'at') ?? []);\n return null;\n }\n\n addresses(args ) {\n if (this.stamp.asker !== Ear.#network) return this.#notNetwork('addresses');\n const addresses = Ear.#at(args, 'addresses');\n if (!Array.isArray(addresses)) return this.error('refused', 'addresses takes a list');\n this.cells.set(['addresses'], addresses);\n return null;\n }\n\n *#reached() {\n const wired = yield* this.#wired('relay');\n if (wired === undefined) return { why: 'the nerves answer no wiring' };\n if (!wired) return null;\n const answer = yield {\n placeholder: 'relay',\n method: 'address',\n args: {},\n };\n const heard = Ear.#heard(answer);\n const at = Ear.#at(heard, 'at');\n const through = Ear.#at(heard, 'through');\n const addresses = Array.isArray(at) && at.length > 0 && at.every((one) => typeof one === 'string' && one !== '');\n if (!addresses) return { why: 'the relay gives the ward no address' };\n if (through === null) return { at };\n return typeof through === 'string' && through !== '' ? { at, through } : { why: 'the relay names no line to hold' };\n }\n\n *#drawn(open , through ) {\n const own = this.cells.get(['ward']);\n if (own === undefined) return { why: 'the ear holds no ward' };\n if (open) return { ward: own, at: this.#reachedAt(undefined), kept: null };\n const drawn = yield* this.#key('draw', {});\n const ward = Ear.#at(drawn, 'ward');\n if (ward === null) return { why: 'key draws no ward' };\n if (through !== null) {\n const at = [through];\n return { ward, at, kept: { name: Ear.#at(ward, 'name'), sealed: Ear.#at(ward, 'sealed'), at, through } };\n }\n const reached = yield* this.#reached();\n if (reached !== null && 'why' in reached) return reached;\n const held = reached?.through === undefined ? {} : { through: reached.through };\n const at = reached === null ? {} : { at: reached.at, ...held };\n const kept = { name: Ear.#at(ward, 'name'), sealed: Ear.#at(ward, 'sealed'), ...at };\n return { ward, at: this.#reachedAt(reached?.at), kept };\n }\n\n #againRefusal(args , first ) {\n const again = Ear.#at(args, 'again');\n if (again === null) return null;\n if (this.stamp.asker !== 'brain') return \"again is the brain's alone\";\n if (typeof Ear.#at(again, 'node') !== 'string' || typeof Ear.#at(again, 'far') !== 'string')\n return 'again takes the node and the far organism of a standing';\n const open = first || Ear.#at(args, 'anchor') === true || Ear.#at(args, 'public') === true;\n return open ? 'an occupant given again is never an anchor, nor on the public ward' : null;\n }\n\n #holderOf(args ) {\n const again = Ear.#at(args, 'again');\n if (again === null) return { node: this.stamp.asker, note: Ear.#at(args, 'note') };\n return { node: Ear.#at(again, 'node'), again: Ear.#at(again, 'far') };\n }\n\n #lineOf(args , first ) {\n const asked = Ear.#at(args, 'through');\n if (asked === null) return { through: null };\n if (typeof asked !== 'string' || asked === '') return { why: 'through takes an address' };\n if (first || Ear.#at(args, 'anchor') === true || Ear.#at(args, 'public') === true)\n return { why: 'a ward reached through a line is never an anchor, nor the public ward' };\n return { through: asked };\n }\n\n #referRefusal(args , first ) {\n if (Ear.#at(args, 'refer') !== true) return null;\n return first || Ear.#at(args, 'anchor') === true ? \"a reference is never an anchor's\" : null;\n }\n\n *card() {\n if (this.stamp.asker !== 'brain') return this.error('refused', \"card is the brain's alone\");\n const card = yield* this.#cardOf();\n return 'why' in card ? this.error('refused', card.why) : card;\n }\n\n *ward() {\n if (this.stamp.asker !== 'brain') return this.error('refused', \"ward is the brain's alone\");\n const drawn = yield* this.#key('draw', {});\n const ward = Ear.#at(drawn, 'ward');\n if (ward === null) return this.error('refused', 'key draws no ward');\n return { name: Ear.#at(ward, 'name'), sealed: Ear.#at(ward, 'sealed') };\n }\n\n *invite(args ) {\n const waits = Ear.#at(args, 'waits');\n const lives = Ear.#at(args, 'lives');\n const marked = Ear.#at(args, 'anchor') === true ? { anchor: true } : {};\n const spans = [waits, lives].every((span) => span === null || typeof span === 'number');\n if (!spans) return this.error('refused', 'invite takes two spans');\n const says = Ear.field(args, 'says');\n if (says === null) return this.error('refused', 'says is never null: an invitation that says nothing names none');\n const first = Ear.#at(args, 'first') === true;\n if (first && this.stamp.asker !== 'brain') return this.error('refused', \"first is the brain's alone\");\n const refusal = this.#againRefusal(args, first);\n if (refusal !== null) return this.error('refused', refusal);\n const line = this.#lineOf(args, first);\n if ('why' in line) return this.error('refused', line.why);\n const barred = this.#referRefusal(args, first);\n if (barred !== null) return this.error('refused', barred);\n const { through } = line;\n const refer = Ear.#at(args, 'refer') === true;\n const open = Ear.#at(args, 'public') === true;\n const drawn = yield* this.#drawn(open && !refer, through);\n if ('why' in drawn) return this.error('refused', drawn.why);\n const at = drawn.at === undefined ? {} : { at: drawn.at };\n const said = says === undefined ? {} : { says };\n const beside = {\n ...(waits === null ? {} : { waits }),\n ...(lives === null ? {} : { lives }),\n ...said,\n ...(first || Ear.#at(args, 'anchor') === true ? { anchor: true } : {}),\n };\n const invited = yield* this.#key('invite', { ward: drawn.ward, ...at, beside });\n const text = Ear.#at(invited, 'invitation');\n const heir = Ear.#at(invited, 'heir');\n if (typeof text !== 'string' || typeof heir !== 'string') return this.error('refused', 'key draws no invitation');\n const ward = drawn.kept === null ? {} : { ward: drawn.kept };\n const kept = this.#holderOf(args);\n const named = first ? { first: true } : {};\n const related = yield {\n placeholder: 'brain',\n method: 'relate',\n args: { ...kept, heir, waits, lives, ...said, ...marked, ...ward, ...named },\n };\n if ('error' in related) return this.#refused(related.error);\n const far = Ear.#at(related.result, 'far');\n if (!refer) return { invitation: text, far };\n const name = Ear.#at(drawn.ward, 'name');\n const door = open ? yield* this.#cardOf() : { ward: name, at: Array.isArray(drawn.at) ? drawn.at : [] };\n if ('why' in door) return this.error('refused', door.why);\n const minted = { node: kept.node, waits, lives, says: says ?? null, far, ward: name, public: open };\n return yield* this.#referred(text, door, minted);\n }\n\n *#referred(\n text ,\n card ,\n minted \n \n \n \n \n \n \n \n ,\n ) {\n const referred = yield* this.#key('refer', { invitation: text });\n const reference = Ear.#at(referred, 'reference');\n const sealed = Ear.#at(referred, 'sealed');\n if (typeof reference !== 'string' || !(sealed instanceof Uint8Array))\n return this.error('refused', 'key keeps no reference');\n const kept = yield {\n placeholder: 'brain',\n method: 'refer',\n args: {\n node: minted.node,\n reference,\n sealed,\n waits: minted.waits,\n ward: minted.ward,\n public: minted.public,\n says: minted.says,\n lives: minted.lives,\n },\n };\n if ('error' in kept) return this.#refused(kept.error);\n return { link: { card, reference }, far: minted.far };\n }\n\n *#cardOf() {\n const drawn = yield* this.#drawn(true, null);\n if ('why' in drawn) return drawn;\n return { ward: Ear.#at(drawn.ward, 'name'), at: Array.isArray(drawn.at) ? drawn.at : [] };\n }\n\n *drop(args ) {\n const far = Ear.#at(args, 'far');\n const reference = Ear.#at(args, 'reference');\n if (typeof reference === 'string' && far === null) {\n const unrefer = yield {\n placeholder: 'brain',\n method: 'unrefer',\n args: { reference, node: this.stamp.asker },\n };\n return 'error' in unrefer ? this.#refused(unrefer.error) : null;\n }\n if (typeof far !== 'string' || reference !== null)\n return this.error('refused', 'drop takes a far organism or a reference');\n const ended = yield {\n placeholder: 'brain',\n method: 'end',\n args: { far, node: this.stamp.asker },\n };\n return 'error' in ended ? this.#refused(ended.error) : null;\n }\n\n *relisten(_args ) {\n if (this.stamp.asker !== 'brain') return this.error('refused', \"relisten is the brain's alone\");\n const held = yield { placeholder: 'brain', method: 'lines', args: {} };\n if ('error' in held) return this.#refused(held.error);\n if (!Array.isArray(held.result)) return this.error('refused', 'the brain answers no lines');\n const lines = held.result.map((line) => {\n const wards = Ear.#at(line, 'wards');\n const names = Array.isArray(wards) ? wards.map((ward) => Ear.#at(ward, 'name')) : [];\n return { address: Ear.#at(line, 'address'), wards: names };\n });\n const listened = yield {\n placeholder: Ear.#network,\n method: 'listen',\n args: { lines },\n durable: true,\n };\n return 'error' in listened ? this.#refused(listened.error) : null;\n }\n\n *challenged(args ) {\n if (this.stamp.asker !== Ear.#network) return this.#notNetwork('challenged');\n const [address, nonce, identity] = [Ear.#at(args, 'address'), Ear.#at(args, 'nonce'), Ear.#at(args, 'identity')];\n const held = yield { placeholder: 'brain', method: 'lines', args: {} };\n if ('error' in held) return this.#refused(held.error);\n const line = Array.isArray(held.result)\n ? held.result.find((one) => Ear.#at(one, 'address') === address)\n : undefined;\n const wards = Ear.#at(line, 'wards');\n if (!Array.isArray(wards) || wards.length === 0) return { proofs: [] };\n const proofs = Ear.#at(yield* this.#key('prove', { wards, nonce, identity }), 'proofs');\n if (!Array.isArray(proofs)) return this.error('refused', 'key proves no ward of the line');\n return { proofs: wards.map((ward, at) => ({ ward: Ear.#at(ward, 'name'), proof: proofs[at] ?? null })) };\n }\n\n *line(args ) {\n if (this.stamp.asker !== Ear.#network) return this.#notNetwork('line');\n const wards = Ear.#at(args, 'wards');\n const up = Ear.#at(args, 'up');\n if (!Array.isArray(wards) || typeof up !== 'boolean') return this.error('refused', 'line takes wards and up');\n const told = yield {\n placeholder: 'brain',\n method: 'line',\n args: { wards, up },\n };\n return 'error' in told ? this.#refused(told.error) : null;\n }\n}";
4269
4269
 
4270
4270
  var EAR_SOURCE = facultySource(EAR_TEXT);
4271
4271
 
4272
4272
  var MOUTH_BLUEPRINT = {
4273
4273
  name: "nervur.mouth",
4274
- version: "0.37.1",
4274
+ version: "0.37.3",
4275
4275
  description: "The mouth: it seals the asks of the relations this organism holds as the standing, and opens their replies; the brain keeps every standing.",
4276
4276
  methods: {
4277
4277
  accept: {
@@ -4429,7 +4429,7 @@ var MOUTH_BLUEPRINT = {
4429
4429
  placeholders: { brain: "nervur.brain", network: "nervur.network", key: "nervur.key" }
4430
4430
  };
4431
4431
 
4432
- var MOUTH_TEXT = "class Mouth extends Faculty {\n static #text = { type: 'string', minLength: 1 };\n static #named = { type: 'string', pattern: '^[0-9a-f]{2432}$' };\n static #bytes = { type: 'string', contentEncoding: 'base16' };\n\n static blueprint = {\n name: 'nervur.mouth',\n version: '0.37.1',\n description:\n 'The mouth: it seals the asks of the relations this organism holds as the standing, and opens their replies; the brain keeps every standing.',\n methods: {\n accept: {\n description:\n \"The organism accepts an invitation, at the ask of the asker, never the asker: the brain makes a far organism for its relation, keeps the standing as the organism's, and grants it to the asker by wiring the asker's placeholder to it, one wire each; an owner grants it to other lobes by `grant`. Its text is read past every ASCII whitespace, so one a mail wrapped or a hand spaced reads as it was written. The spans the invitation carries go to the brain, so the standing lapses here by this side's clock: unknocked past `waits`, bound past `lives`; and its anchor's mark, so it ends only once the far brain answered its owner's `drop`. With `note`, free data of at most 4 KiB as its canonical text by default and never a secret, what the organism holds, from whom and what for: the brain keeps it beside the standing as its own, null where none is named, and it never travels to the inviter; the asker's own note on it starts empty and is written through its `nerves`. With `node`, asked by the brain alone for an owner from afar, the standing is granted to that lobe rather than to the asker.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { invitation: Mouth.#text, placeholder: Mouth.#text, note: {}, node: Mouth.#text },\n required: ['invitation', 'placeholder'],\n additionalProperties: false,\n },\n result: {\n type: 'object',\n properties: { far: Mouth.#text },\n required: ['far'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n carry: {\n askers: ['brain'],\n description:\n \"The brain's alone: seals an ask on a standing, has the brain keep before its box goes what it needs kept, the bound its number lies below or the standing whole with its knock or probe, sends it to the first address that takes it, the same box again after the brain's pause where a door replied nothing, and answers what the asker hears, the standing moved, the being's newest addresses, and `answered` where the being's object came back, so the brain marks a standing fallen silent bound again.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: {\n far: Mouth.#text,\n standing: { type: 'object' },\n at: { anyOf: [{ type: 'array', items: Mouth.#text }, { type: 'null' }] },\n method: { anyOf: [Mouth.#text, { type: 'null' }] },\n args: {},\n timeout: { type: 'number', minimum: 0 },\n room: { type: 'integer', minimum: 1 },\n },\n required: ['far', 'standing', 'at', 'method', 'args', 'timeout', 'room'],\n additionalProperties: false,\n },\n result: {\n type: 'object',\n properties: {\n heard: {},\n standing: { type: 'object' },\n at: { anyOf: [{ type: 'array', items: Mouth.#text }, { type: 'null' }] },\n answered: { const: true },\n },\n required: ['heard', 'standing', 'at'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n cede: {\n askers: ['brain'],\n description:\n \"The brain's alone: has `key` seal a standing whole, its numbers as the brain hands them, with what the brain keeps `beside` it, to `to`, the public half of a key another organism's `taking` drew, and answers `{handed}`, which no lobe reads; refused where `to` is no named key.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { standing: { type: 'object' }, beside: { type: 'object' }, to: Mouth.#named },\n required: ['standing', 'beside', 'to'],\n additionalProperties: false,\n },\n result: { type: 'object' },\n errors: ['refused'],\n },\n drop: {\n irreversible: true,\n description:\n \"The asker gives up the standing of a far organism it is granted, accepted through the mouth: its wire and its note go and it is asked `left`; where it was the last lobe wired, the brain sends the inviting side one last letter, `#leave`, then forgets the standing whatever answers, with its notes, and asks each other lobe that was wired `left`. One its invitation marked an anchor's the brain first asks the far brain its owner's `drop`, and forgets only once it answered or had ended it; refused, with the far brain's why or as unheard, it is kept.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { far: Mouth.#text },\n required: ['far'],\n additionalProperties: false,\n },\n result: { type: 'null' },\n errors: ['refused'],\n },\n once: {\n description:\n \"Asks once with no relation: the ask goes on the zero head of the card's ward, at the first of its addresses that takes it, and the asker hears what the being answered. No far organism is made.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: {\n card: {\n type: 'object',\n properties: {\n ward: { type: 'string', pattern: '^[0-9a-f]{128}$' },\n at: { type: 'array', items: Mouth.#text },\n },\n required: ['ward', 'at'],\n additionalProperties: false,\n },\n method: Mouth.#text,\n args: { type: 'object' },\n },\n required: ['card'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n take: {\n askers: ['brain'],\n description:\n \"The brain's alone: has `key` open a standing `cede` handed by the key `taking` drew, the secret it sealed named in `taking`, and seal it again under this organism's record key, and answers `{standing, beside}`; refused where it is not sealed to that key.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: {\n taking: {\n type: 'object',\n properties: { key: Mouth.#named, sealed: Mouth.#bytes },\n required: ['key', 'sealed'],\n additionalProperties: false,\n },\n handed: Mouth.#bytes,\n },\n required: ['taking', 'handed'],\n additionalProperties: false,\n },\n result: { type: 'object' },\n errors: ['refused'],\n },\n taking: {\n askers: ['brain'],\n description:\n \"The brain's alone: has `key` draw a key a standing is handed to, and answers `{key, sealed}`, its public half and its secret sealed, which only that `key` opens.\",\n kind: 'reading',\n args: { type: 'object', properties: {}, additionalProperties: false },\n result: { type: 'object' },\n errors: ['refused'],\n },\n vouch: {\n askers: ['brain'],\n description:\n \"The brain's alone: reads a domain's vouch, `https://<domain>/.well-known/quo`, through `network`, and answers its body as bytes, or null where it answered no 200 or nothing at all.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { domain: Mouth.#text },\n required: ['domain'],\n additionalProperties: false,\n },\n result: { anyOf: [{ type: 'object' }, { type: 'null' }] },\n errors: ['refused'],\n },\n },\n placeholders: { brain: 'nervur.brain', network: 'nervur.network', key: 'nervur.key' },\n };\n\n static #ward = /^[0-9a-f]{128}$/;\n static #code = /^(?=.{1,64}$)[a-z0-9]+(-[a-z0-9]+)*$/;\n static #blank = /[\\t\\n\\f\\r]/gu;\n static #unreached = 'unreached';\n static #in = '#in';\n static #whole = '#whole';\n static #out = '#out';\n\n static #at(data , key ) {\n return Mouth.field(data, key) ?? null;\n }\n\n static #spans(given ) \n \n \n \n {\n let parsed = null;\n try {\n const outer = JSON.parse(given);\n const text = typeof outer === 'object' && outer !== null ? Reflect.get(outer, 'text') : null;\n parsed = typeof text === 'string' ? JSON.parse(text) : null;\n } catch {\n parsed = null;\n }\n const span = (key ) => {\n const value = typeof parsed === 'object' && parsed !== null ? Reflect.get(parsed, key) : null;\n return typeof value === 'number' && Number.isInteger(value) && value >= 0 ? value : null;\n };\n const marked = typeof parsed === 'object' && parsed !== null ? Reflect.get(parsed, 'anchor') : null;\n return { waits: span('waits'), lives: span('lives'), anchor: marked === true };\n }\n\n static #failed(code , message ) {\n return { error: { code, message } };\n }\n\n *#key(method , args ) {\n const answer = yield { placeholder: 'key', method, args };\n return 'result' in answer ? answer.result : { why: answer.error.message };\n }\n\n static #nervur(object ) {\n const keys = typeof object === 'object' && object !== null ? Object.keys(object) : [];\n if (keys.length !== 1) return false;\n if (keys[0] === 'result' || (keys[0] === '#pieces' && typeof Mouth.#at(object, '#pieces') === 'number'))\n return true;\n const failed = Mouth.#at(object, 'error');\n const code = Mouth.#at(failed, 'code');\n const whole = typeof failed === 'object' && failed !== null && Object.keys(failed).length === 2;\n return (\n whole && typeof code === 'string' && Mouth.#code.test(code) && typeof Mouth.#at(failed, 'message') === 'string'\n );\n }\n\n static #canonical(value ) {\n if (typeof value === 'number' && !Number.isFinite(value)) throw new TypeError('no data holds this number');\n if (Array.isArray(value)) return `[${value.map((one) => Mouth.#canonical(one)).join(',')}]`;\n if (typeof value !== 'object' || value === null) return JSON.stringify(value);\n const fields = Object.entries(value).toSorted(([one], [other]) => (one < other ? -1 : 1));\n return `{${fields.map(([key, one]) => `${JSON.stringify(key)}:${Mouth.#canonical(one)}`).join(',')}}`;\n }\n\n #read(object ) {\n const read = this.codec.read(object);\n if ('data' in read) return read;\n try {\n return this.codec.read(Mouth.#canonical(JSON.parse(object)));\n } catch {\n return read;\n }\n }\n\n #heard(read ) {\n const object = Mouth.#at(read, 'object');\n if (typeof object === 'string') {\n const answer = this.#read(object);\n if (!('data' in answer)) return Mouth.#failed('unavailable', `the being answered no data: ${answer.why}`);\n return Mouth.#nervur(answer.data) ? answer.data : { result: answer.data };\n }\n if (Mouth.#at(read, 'silence') === true) return Mouth.#failed('silent', 'the being said nothing');\n const word = Mouth.#at(read, 'quo');\n if (word === 'removed' || word === 'repeated') return Mouth.#failed(word, `the being's door said ${word}`);\n if (typeof word === 'string') return Mouth.#failed('unavailable', `the being's door said ${word}`);\n return Mouth.#failed('unavailable', 'no reply came, so the ask may have run');\n }\n\n *#sent(ward , addresses , box , timeout , landed ) {\n let carried = false;\n for (const [at, address] of addresses.entries()) {\n const sent = yield {\n placeholder: 'network',\n method: 'send',\n args: { address, ward, bytes: box },\n timeout,\n };\n const reply = 'result' in sent ? Mouth.#at(sent.result, 'reply') : null;\n if (reply !== null) {\n if (landed !== undefined) landed.at = at;\n return reply;\n }\n if ('error' in sent && sent.error.code === 'timeout') return 'timeout';\n carried ||= 'result' in sent;\n }\n return carried ? null : Mouth.#unreached;\n }\n\n *#kept(far , knock ) {\n const kept = yield {\n placeholder: 'brain',\n method: 'keep',\n args: { far, standing: knock },\n };\n return 'error' in kept ? kept.error.message : null;\n }\n\n *#lapsed(standing , pending ) {\n const lapsed = yield* this.#key('lapsed', { standing, pending });\n return typeof Mouth.#at(lapsed, 'why') === 'string' ? standing : lapsed;\n }\n\n *#past(\n first ,\n on ,\n ) {\n const silent = (read ) => Mouth.#at(Mouth.#at(read, 'read'), 'silence') === true;\n for (let rest = on.addresses; silent(first) && rest.length > 0; rest = rest.slice(1)) {\n const reply = yield* this.#sent(on.ward, rest.slice(0, 1), on.box, on.timeout);\n if (reply === null || reply === Mouth.#unreached || reply === 'timeout') continue;\n const read = yield* this.#key('read', { standing: on.moved, pending: on.pending, reply });\n if (typeof Mouth.#at(read, 'why') !== 'string' && !silent(read)) return read;\n }\n return first;\n }\n\n *#box(far , standing , newest , ask , timeout ) {\n const sealed = yield* this.#key('seal', { standing, ask });\n const why = Mouth.#at(sealed, 'why');\n if (typeof why === 'string') return { heard: Mouth.#failed('refused', why), standing, at: newest };\n const moved = Mouth.#at(sealed, 'standing');\n const pending = Mouth.#at(sealed, 'pending');\n const knock = Mouth.#at(pending, 'kind') === 'knock';\n const again = knock && Mouth.#at(standing, 'phase') === 'uncertain';\n const unkept = !again ? yield* this.#kept(far, moved) : null;\n if (unkept !== null) return { heard: Mouth.#failed('unavailable', unkept), standing, at: newest };\n const invitation = Mouth.#at(moved, 'invitation');\n const offered = Array.isArray(newest) ? newest : Mouth.#at(invitation, 'at');\n const addresses = Array.isArray(offered) ? offered : [];\n const ward = Mouth.#at(invitation, 'ward');\n const box = Mouth.#at(sealed, 'box');\n const landed = { at: 0 };\n let sent = yield* this.#sent(ward, addresses, box, timeout, landed);\n for (let tries = 0; sent === null; tries += 1) {\n const paused = yield { placeholder: 'brain', method: 'pause', args: { far, tries } };\n if ('error' in paused) return { heard: { error: paused.error }, standing: moved, at: newest };\n const left = Mouth.#at(paused.result, 'left');\n if (typeof left !== 'number' || left <= 0) break;\n sent = yield* this.#sent(ward, addresses, box, left, landed);\n }\n const reply = sent === Mouth.#unreached ? null : sent;\n if (reply === 'timeout')\n return {\n heard: Mouth.#failed('timeout', 'no reply came within the timeout'),\n standing: yield* this.#lapsed(moved, pending),\n at: newest,\n };\n const first = yield* this.#key('read', { standing: moved, pending, reply });\n const read = yield* this.#past(first, {\n ward,\n addresses: addresses.slice(landed.at + 1),\n box,\n timeout,\n moved,\n pending,\n });\n const unread = Mouth.#at(read, 'why');\n if (typeof unread === 'string') return { heard: Mouth.#failed('unavailable', unread), standing: moved, at: newest };\n const heard = Mouth.#at(read, 'read');\n const at = Mouth.#at(heard, 'at');\n const kept = Array.isArray(at) && at.length > 0 ? at : newest;\n return { read: heard, standing: Mouth.#at(read, 'standing'), at: kept, again };\n }\n\n #answered(heard ) {\n const failed = Mouth.#at(heard, 'error');\n const code = Mouth.#at(failed, 'code');\n const message = Mouth.#at(failed, 'message');\n if (typeof code === 'string') return this.error(code, typeof message === 'string' ? message : code);\n const plain = typeof heard === 'object' && heard !== null && Object.hasOwn(heard, 'result');\n return plain ? Mouth.#at(heard, 'result') : this.error('unavailable', 'the being answered no answer');\n }\n\n *once(args ) {\n const card = Mouth.#at(args, 'card');\n const ward = Mouth.#at(card, 'ward');\n const at = Mouth.#at(card, 'at');\n const method = Mouth.#at(args, 'method');\n const addresses = Array.isArray(at) ? at.filter((one) => typeof one === 'string') : null;\n if (\n typeof ward !== 'string' ||\n !Mouth.#ward.test(ward) ||\n addresses?.length !== (Array.isArray(at) ? at.length : -1)\n )\n return this.error('refused', 'once takes a card: a ward and its addresses');\n if (method !== null && typeof method !== 'string') return this.error('refused', 'the method of an ask is text');\n const given = method === null ? {} : (Mouth.#at(args, 'args') ?? {});\n const ask = { ...(method === null ? {} : { method }), args: this.codec.text(given) };\n const zero = yield* this.#key('askZero', { ward, ask });\n const why = Mouth.#at(zero, 'why');\n if (typeof why === 'string') return this.error('refused', why);\n const sent = yield* this.#sent(ward, addresses, Mouth.#at(zero, 'box'));\n const reply = sent === Mouth.#unreached ? null : sent;\n if (reply === 'timeout') return this.error('timeout', 'no reply came within the timeout');\n const pending = Mouth.#at(zero, 'pending');\n const read = yield* this.#key('readZero', { ward, pending, reply });\n const unread = Mouth.#at(read, 'why');\n if (typeof unread === 'string') return this.error('unavailable', unread);\n return this.#answered(this.#heard(read));\n }\n\n *accept(args ) {\n const given = Mouth.#at(args, 'invitation');\n const placeholder = Mouth.#at(args, 'placeholder');\n if (typeof given !== 'string' || typeof placeholder !== 'string')\n return this.error('refused', 'accept takes an invitation and a placeholder');\n const text = given.replace(Mouth.#blank, '');\n const named = Mouth.#at(args, 'node');\n if (named !== null && this.stamp.asker !== 'brain') return this.error('refused', \"node is the brain's alone\");\n const node = this.stamp.asker === 'brain' ? named : this.stamp.asker;\n if (typeof node !== 'string') return this.error('refused', 'the brain names the lobe it accepts for');\n const standing = yield* this.#key('standingOn', { invitation: text });\n const unsealed = Mouth.#at(standing, 'why');\n if (typeof unsealed === 'string') return this.error('refused', unsealed);\n const note = Mouth.#at(args, 'note');\n const { waits, lives, anchor } = Mouth.#spans(text);\n const stood = yield {\n placeholder: 'brain',\n method: 'stand',\n args: { node, placeholder, standing, note, waits, lives, anchor },\n };\n if ('error' in stood) return this.error('refused', stood.error.message);\n return { far: Mouth.#at(stood.result, 'far') };\n }\n\n *vouch(args ) {\n const domain = Mouth.#at(args, 'domain');\n if (typeof domain !== 'string') return this.error('refused', 'vouch takes a domain');\n const request = { method: 'GET', url: `https://${domain}/.well-known/quo`, headers: {}, body: new Uint8Array(0) };\n const sent = yield { placeholder: 'network', method: 'send', args: request };\n if ('error' in sent || Mouth.#at(sent.result, 'status') !== 200) return null;\n return { body: Mouth.#at(sent.result, 'body') };\n }\n\n *#handed(method , args ) {\n const answer = yield { placeholder: 'key', method, args };\n return 'result' in answer ? answer.result : this.error('refused', answer.error.message);\n }\n\n *taking() {\n return yield* this.#handed('taking', {});\n }\n\n *cede(args ) {\n return yield* this.#handed('cede', args);\n }\n\n *take(args ) {\n return yield* this.#handed('take', args);\n }\n\n *drop(args ) {\n const far = Mouth.#at(args, 'far');\n if (typeof far !== 'string') return this.error('refused', 'drop takes a far organism');\n const left = yield {\n placeholder: 'brain',\n method: 'leave',\n args: { node: this.stamp.asker, far },\n };\n return 'error' in left ? this.error('refused', left.error.message) : null;\n }\n\n *carry(args ) {\n const far = Mouth.#at(args, 'far');\n const method = Mouth.#at(args, 'method');\n const timeout = Mouth.#at(args, 'timeout');\n const room = Mouth.#at(args, 'room');\n if (typeof far !== 'string' || typeof timeout !== 'number' || typeof room !== 'number')\n return this.error('refused', 'carry takes a far organism, a timeout and the room of a box');\n const given = method === null ? {} : Mouth.#at(args, 'args');\n const ask = { ...(typeof method === 'string' ? { method } : {}), args: this.codec.text(given) };\n let sent = { standing: Mouth.#at(args, 'standing'), at: Mouth.#at(args, 'at') };\n if (typeof method !== 'string' || this.#cost(ask.args) <= room)\n sent = yield* this.#asked(far, Mouth.#at(sent, 'standing'), Mouth.#at(sent, 'at'), ask, timeout);\n else {\n for (let at = 0, from = 0; from < ask.args.length; at += 1) {\n const end = this.#end(ask.args, from, room);\n sent = yield* this.#next(far, sent, Mouth.#in, { at, part: ask.args.slice(from, end) }, timeout);\n if (Mouth.#broken(sent) && !Mouth.#repeated(sent)) return sent;\n from = end;\n }\n sent = yield* this.#next(far, sent, Mouth.#whole, { method, units: ask.args.length }, timeout);\n if (Mouth.#repeated(sent)) {\n const told = yield* this.#next(far, sent, Mouth.#out, {}, timeout);\n const length = Mouth.#at(Mouth.#at(told, 'heard'), 'result');\n sent = Mouth.#hearing(told, typeof length === 'number' ? { '#pieces': length } : Mouth.#at(sent, 'heard'));\n }\n }\n const units = Mouth.#at(Mouth.#at(sent, 'heard'), '#pieces');\n if (typeof units !== 'number' || Mouth.#broken(sent)) return sent;\n const parts = [];\n for (let from = 0; from < units;) {\n sent = yield* this.#next(far, sent, Mouth.#out, { from }, timeout);\n if (Mouth.#repeated(sent)) continue;\n const part = Mouth.#at(Mouth.#at(sent, 'heard'), 'result');\n if (Mouth.#broken(sent)) return sent;\n if (typeof part !== 'string' || part === '')\n return Mouth.#hearing(sent, Mouth.#failed('unavailable', 'a piece of the answer is no text'));\n parts.push(part);\n from += part.length;\n }\n const whole = parts.join('');\n const read = this.codec.read(whole);\n const heard =\n whole.length === units && 'data' in read\n ? read.data\n : Mouth.#failed('unavailable', 'the answer came back in pieces that make no whole');\n return Mouth.#hearing(sent, heard);\n }\n\n #cost(text ) {\n const bytes = this.codec.utf8(this.codec.text(text));\n if ('why' in bytes) throw new TypeError(bytes.why);\n return bytes.bytes.length - 2;\n }\n\n #end(text , from , room ) {\n let units = Math.min(text.length - from, room);\n for (;;) {\n let end = from + units;\n const last = text.charCodeAt(end - 1);\n if (end < text.length && last >= 0xd800 && last < 0xdc00) end += end - 1 > from ? -1 : 1;\n const cost = this.#cost(text.slice(from, end));\n if (cost <= room || units === 1) return end;\n units = Math.max(1, Math.floor(((end - from) * room) / cost));\n }\n }\n\n static #hearing(sent , heard ) {\n return { heard, standing: Mouth.#at(sent, 'standing'), at: Mouth.#at(sent, 'at'), answered: true };\n }\n\n *#next(far , before , method , args , timeout ) {\n const ask = { method, args: this.codec.text(args) };\n return yield* this.#asked(far, Mouth.#at(before, 'standing'), Mouth.#at(before, 'at'), ask, timeout);\n }\n\n static #broken(sent ) {\n return Mouth.#at(Mouth.#at(sent, 'heard'), 'error') !== null;\n }\n\n static #repeated(sent ) {\n return Mouth.#at(Mouth.#at(Mouth.#at(sent, 'heard'), 'error'), 'code') === 'repeated';\n }\n\n *#asked(far , standing , newest , ask , timeout ) {\n const first = yield* this.#box(far, standing, newest, ask, timeout);\n const read = Mouth.#at(first, 'read');\n const resolved = Mouth.#at(first, 'again') === true && Mouth.#at(read, 'nothing') !== true;\n const moved = Mouth.#at(first, 'standing');\n const last = resolved ? yield* this.#box(far, moved, Mouth.#at(first, 'at'), ask, timeout) : first;\n const heard = Mouth.#at(last, 'heard') ?? this.#heard(Mouth.#at(last, 'read'));\n const answered = typeof Mouth.#at(Mouth.#at(last, 'read'), 'object') === 'string' ? { answered: true } : {};\n return { heard, standing: Mouth.#at(last, 'standing'), at: Mouth.#at(last, 'at'), ...answered };\n }\n}";
4432
+ var MOUTH_TEXT = "class Mouth extends Faculty {\n static #text = { type: 'string', minLength: 1 };\n static #named = { type: 'string', pattern: '^[0-9a-f]{2432}$' };\n static #bytes = { type: 'string', contentEncoding: 'base16' };\n\n static blueprint = {\n name: 'nervur.mouth',\n version: '0.37.3',\n description:\n 'The mouth: it seals the asks of the relations this organism holds as the standing, and opens their replies; the brain keeps every standing.',\n methods: {\n accept: {\n description:\n \"The organism accepts an invitation, at the ask of the asker, never the asker: the brain makes a far organism for its relation, keeps the standing as the organism's, and grants it to the asker by wiring the asker's placeholder to it, one wire each; an owner grants it to other lobes by `grant`. Its text is read past every ASCII whitespace, so one a mail wrapped or a hand spaced reads as it was written. The spans the invitation carries go to the brain, so the standing lapses here by this side's clock: unknocked past `waits`, bound past `lives`; and its anchor's mark, so it ends only once the far brain answered its owner's `drop`. With `note`, free data of at most 4 KiB as its canonical text by default and never a secret, what the organism holds, from whom and what for: the brain keeps it beside the standing as its own, null where none is named, and it never travels to the inviter; the asker's own note on it starts empty and is written through its `nerves`. With `node`, asked by the brain alone for an owner from afar, the standing is granted to that lobe rather than to the asker.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { invitation: Mouth.#text, placeholder: Mouth.#text, note: {}, node: Mouth.#text },\n required: ['invitation', 'placeholder'],\n additionalProperties: false,\n },\n result: {\n type: 'object',\n properties: { far: Mouth.#text },\n required: ['far'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n carry: {\n askers: ['brain'],\n description:\n \"The brain's alone: seals an ask on a standing, has the brain keep before its box goes what it needs kept, the bound its number lies below or the standing whole with its knock or probe, sends it to the first address that takes it, the same box again after the brain's pause where a door replied nothing, and answers what the asker hears, the standing moved, the being's newest addresses, and `answered` where the being's object came back, so the brain marks a standing fallen silent bound again.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: {\n far: Mouth.#text,\n standing: { type: 'object' },\n at: { anyOf: [{ type: 'array', items: Mouth.#text }, { type: 'null' }] },\n method: { anyOf: [Mouth.#text, { type: 'null' }] },\n args: {},\n timeout: { type: 'number', minimum: 0 },\n room: { type: 'integer', minimum: 1 },\n },\n required: ['far', 'standing', 'at', 'method', 'args', 'timeout', 'room'],\n additionalProperties: false,\n },\n result: {\n type: 'object',\n properties: {\n heard: {},\n standing: { type: 'object' },\n at: { anyOf: [{ type: 'array', items: Mouth.#text }, { type: 'null' }] },\n answered: { const: true },\n },\n required: ['heard', 'standing', 'at'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n cede: {\n askers: ['brain'],\n description:\n \"The brain's alone: has `key` seal a standing whole, its numbers as the brain hands them, with what the brain keeps `beside` it, to `to`, the public half of a key another organism's `taking` drew, and answers `{handed}`, which no lobe reads; refused where `to` is no named key.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { standing: { type: 'object' }, beside: { type: 'object' }, to: Mouth.#named },\n required: ['standing', 'beside', 'to'],\n additionalProperties: false,\n },\n result: { type: 'object' },\n errors: ['refused'],\n },\n drop: {\n irreversible: true,\n description:\n \"The asker gives up the standing of a far organism it is granted, accepted through the mouth: its wire and its note go and it is asked `left`; where it was the last lobe wired, the brain sends the inviting side one last letter, `#leave`, then forgets the standing whatever answers, with its notes, and asks each other lobe that was wired `left`. One its invitation marked an anchor's the brain first asks the far brain its owner's `drop`, and forgets only once it answered or had ended it; refused, with the far brain's why or as unheard, it is kept.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { far: Mouth.#text },\n required: ['far'],\n additionalProperties: false,\n },\n result: { type: 'null' },\n errors: ['refused'],\n },\n once: {\n description:\n \"Asks once with no relation: the ask goes on the zero head of the card's ward, at the first of its addresses that takes it, and the asker hears what the being answered. No far organism is made.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: {\n card: {\n type: 'object',\n properties: {\n ward: { type: 'string', pattern: '^[0-9a-f]{128}$' },\n at: { type: 'array', items: Mouth.#text },\n },\n required: ['ward', 'at'],\n additionalProperties: false,\n },\n method: Mouth.#text,\n args: { type: 'object' },\n },\n required: ['card'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n take: {\n askers: ['brain'],\n description:\n \"The brain's alone: has `key` open a standing `cede` handed by the key `taking` drew, the secret it sealed named in `taking`, and seal it again under this organism's record key, and answers `{standing, beside}`; refused where it is not sealed to that key.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: {\n taking: {\n type: 'object',\n properties: { key: Mouth.#named, sealed: Mouth.#bytes },\n required: ['key', 'sealed'],\n additionalProperties: false,\n },\n handed: Mouth.#bytes,\n },\n required: ['taking', 'handed'],\n additionalProperties: false,\n },\n result: { type: 'object' },\n errors: ['refused'],\n },\n taking: {\n askers: ['brain'],\n description:\n \"The brain's alone: has `key` draw a key a standing is handed to, and answers `{key, sealed}`, its public half and its secret sealed, which only that `key` opens.\",\n kind: 'reading',\n args: { type: 'object', properties: {}, additionalProperties: false },\n result: { type: 'object' },\n errors: ['refused'],\n },\n vouch: {\n askers: ['brain'],\n description:\n \"The brain's alone: reads a domain's vouch, `https://<domain>/.well-known/quo`, through `network`, and answers its body as bytes, or null where it answered no 200 or nothing at all.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { domain: Mouth.#text },\n required: ['domain'],\n additionalProperties: false,\n },\n result: { anyOf: [{ type: 'object' }, { type: 'null' }] },\n errors: ['refused'],\n },\n },\n placeholders: { brain: 'nervur.brain', network: 'nervur.network', key: 'nervur.key' },\n };\n\n static #ward = /^[0-9a-f]{128}$/;\n static #code = /^(?=.{1,64}$)[a-z0-9]+(-[a-z0-9]+)*$/;\n static #blank = /[\\t\\n\\f\\r]/gu;\n static #unreached = 'unreached';\n static #in = '#in';\n static #whole = '#whole';\n static #out = '#out';\n\n static #at(data , key ) {\n return Mouth.field(data, key) ?? null;\n }\n\n static #spans(given ) \n \n \n \n {\n let parsed = null;\n try {\n const outer = JSON.parse(given);\n const text = typeof outer === 'object' && outer !== null ? Reflect.get(outer, 'text') : null;\n parsed = typeof text === 'string' ? JSON.parse(text) : null;\n } catch {\n parsed = null;\n }\n const span = (key ) => {\n const value = typeof parsed === 'object' && parsed !== null ? Reflect.get(parsed, key) : null;\n return typeof value === 'number' && Number.isInteger(value) && value >= 0 ? value : null;\n };\n const marked = typeof parsed === 'object' && parsed !== null ? Reflect.get(parsed, 'anchor') : null;\n return { waits: span('waits'), lives: span('lives'), anchor: marked === true };\n }\n\n static #failed(code , message ) {\n return { error: { code, message } };\n }\n\n *#key(method , args ) {\n const answer = yield { placeholder: 'key', method, args };\n return 'result' in answer ? answer.result : { why: answer.error.message };\n }\n\n static #nervur(object ) {\n const keys = typeof object === 'object' && object !== null ? Object.keys(object) : [];\n if (keys.length !== 1) return false;\n if (keys[0] === 'result' || (keys[0] === '#pieces' && typeof Mouth.#at(object, '#pieces') === 'number'))\n return true;\n const failed = Mouth.#at(object, 'error');\n const code = Mouth.#at(failed, 'code');\n const whole = typeof failed === 'object' && failed !== null && Object.keys(failed).length === 2;\n return (\n whole && typeof code === 'string' && Mouth.#code.test(code) && typeof Mouth.#at(failed, 'message') === 'string'\n );\n }\n\n static #canonical(value ) {\n if (typeof value === 'number' && !Number.isFinite(value)) throw new TypeError('no data holds this number');\n if (Array.isArray(value)) return `[${value.map((one) => Mouth.#canonical(one)).join(',')}]`;\n if (typeof value !== 'object' || value === null) return JSON.stringify(value);\n const fields = Object.entries(value).toSorted(([one], [other]) => (one < other ? -1 : 1));\n return `{${fields.map(([key, one]) => `${JSON.stringify(key)}:${Mouth.#canonical(one)}`).join(',')}}`;\n }\n\n #read(object ) {\n const read = this.codec.read(object);\n if ('data' in read) return read;\n try {\n return this.codec.read(Mouth.#canonical(JSON.parse(object)));\n } catch {\n return read;\n }\n }\n\n #heard(read ) {\n const object = Mouth.#at(read, 'object');\n if (typeof object === 'string') {\n const answer = this.#read(object);\n if (!('data' in answer)) return Mouth.#failed('unavailable', `the being answered no data: ${answer.why}`);\n return Mouth.#nervur(answer.data) ? answer.data : { result: answer.data };\n }\n if (Mouth.#at(read, 'silence') === true) return Mouth.#failed('silent', 'the being said nothing');\n const word = Mouth.#at(read, 'quo');\n if (word === 'removed' || word === 'repeated') return Mouth.#failed(word, `the being's door said ${word}`);\n if (typeof word === 'string') return Mouth.#failed('unavailable', `the being's door said ${word}`);\n return Mouth.#failed('unavailable', 'no reply came, so the ask may have run');\n }\n\n *#sent(ward , addresses , box , timeout , landed ) {\n let carried = false;\n for (const [at, address] of addresses.entries()) {\n const sent = yield {\n placeholder: 'network',\n method: 'send',\n args: { address, ward, bytes: box },\n timeout,\n };\n const reply = 'result' in sent ? Mouth.#at(sent.result, 'reply') : null;\n if (reply !== null) {\n if (landed !== undefined) landed.at = at;\n return reply;\n }\n if ('error' in sent && sent.error.code === 'timeout') return 'timeout';\n carried ||= 'result' in sent;\n }\n return carried ? null : Mouth.#unreached;\n }\n\n *#kept(far , knock ) {\n const kept = yield {\n placeholder: 'brain',\n method: 'keep',\n args: { far, standing: knock },\n };\n return 'error' in kept ? kept.error.message : null;\n }\n\n *#lapsed(standing , pending ) {\n const lapsed = yield* this.#key('lapsed', { standing, pending });\n return typeof Mouth.#at(lapsed, 'why') === 'string' ? standing : lapsed;\n }\n\n *#past(\n first ,\n on ,\n ) {\n const silent = (read ) => Mouth.#at(Mouth.#at(read, 'read'), 'silence') === true;\n for (let rest = on.addresses; silent(first) && rest.length > 0; rest = rest.slice(1)) {\n const reply = yield* this.#sent(on.ward, rest.slice(0, 1), on.box, on.timeout);\n if (reply === null || reply === Mouth.#unreached || reply === 'timeout') continue;\n const read = yield* this.#key('read', { standing: on.moved, pending: on.pending, reply });\n if (typeof Mouth.#at(read, 'why') !== 'string' && !silent(read)) return read;\n }\n return first;\n }\n\n *#box(far , standing , newest , ask , timeout ) {\n const sealed = yield* this.#key('seal', { standing, ask });\n const why = Mouth.#at(sealed, 'why');\n if (typeof why === 'string') return { heard: Mouth.#failed('refused', why), standing, at: newest };\n const moved = Mouth.#at(sealed, 'standing');\n const pending = Mouth.#at(sealed, 'pending');\n const knock = Mouth.#at(pending, 'kind') === 'knock';\n const again = knock && Mouth.#at(standing, 'phase') === 'uncertain';\n const unkept = !again ? yield* this.#kept(far, moved) : null;\n if (unkept !== null) return { heard: Mouth.#failed('unavailable', unkept), standing, at: newest };\n const invitation = Mouth.#at(moved, 'invitation');\n const offered = Array.isArray(newest) ? newest : Mouth.#at(invitation, 'at');\n const addresses = Array.isArray(offered) ? offered : [];\n const ward = Mouth.#at(invitation, 'ward');\n const box = Mouth.#at(sealed, 'box');\n const landed = { at: 0 };\n let sent = yield* this.#sent(ward, addresses, box, timeout, landed);\n for (let tries = 0; sent === null; tries += 1) {\n const paused = yield { placeholder: 'brain', method: 'pause', args: { far, tries } };\n if ('error' in paused) return { heard: { error: paused.error }, standing: moved, at: newest };\n const left = Mouth.#at(paused.result, 'left');\n if (typeof left !== 'number' || left <= 0) break;\n sent = yield* this.#sent(ward, addresses, box, left, landed);\n }\n const reply = sent === Mouth.#unreached ? null : sent;\n if (reply === 'timeout')\n return {\n heard: Mouth.#failed('timeout', 'no reply came within the timeout'),\n standing: yield* this.#lapsed(moved, pending),\n at: newest,\n };\n const first = yield* this.#key('read', { standing: moved, pending, reply });\n const read = yield* this.#past(first, {\n ward,\n addresses: addresses.slice(landed.at + 1),\n box,\n timeout,\n moved,\n pending,\n });\n const unread = Mouth.#at(read, 'why');\n if (typeof unread === 'string') return { heard: Mouth.#failed('unavailable', unread), standing: moved, at: newest };\n const heard = Mouth.#at(read, 'read');\n const at = Mouth.#at(heard, 'at');\n const kept = Array.isArray(at) && at.length > 0 ? at : newest;\n return { read: heard, standing: Mouth.#at(read, 'standing'), at: kept, again };\n }\n\n #answered(heard ) {\n const failed = Mouth.#at(heard, 'error');\n const code = Mouth.#at(failed, 'code');\n const message = Mouth.#at(failed, 'message');\n if (typeof code === 'string') return this.error(code, typeof message === 'string' ? message : code);\n const plain = typeof heard === 'object' && heard !== null && Object.hasOwn(heard, 'result');\n return plain ? Mouth.#at(heard, 'result') : this.error('unavailable', 'the being answered no answer');\n }\n\n *once(args ) {\n const card = Mouth.#at(args, 'card');\n const ward = Mouth.#at(card, 'ward');\n const at = Mouth.#at(card, 'at');\n const method = Mouth.#at(args, 'method');\n const addresses = Array.isArray(at) ? at.filter((one) => typeof one === 'string') : null;\n if (\n typeof ward !== 'string' ||\n !Mouth.#ward.test(ward) ||\n addresses?.length !== (Array.isArray(at) ? at.length : -1)\n )\n return this.error('refused', 'once takes a card: a ward and its addresses');\n if (method !== null && typeof method !== 'string') return this.error('refused', 'the method of an ask is text');\n const given = method === null ? {} : (Mouth.#at(args, 'args') ?? {});\n const ask = { ...(method === null ? {} : { method }), args: this.codec.text(given) };\n const zero = yield* this.#key('askZero', { ward, ask });\n const why = Mouth.#at(zero, 'why');\n if (typeof why === 'string') return this.error('refused', why);\n const sent = yield* this.#sent(ward, addresses, Mouth.#at(zero, 'box'));\n const reply = sent === Mouth.#unreached ? null : sent;\n if (reply === 'timeout') return this.error('timeout', 'no reply came within the timeout');\n const pending = Mouth.#at(zero, 'pending');\n const read = yield* this.#key('readZero', { ward, pending, reply });\n const unread = Mouth.#at(read, 'why');\n if (typeof unread === 'string') return this.error('unavailable', unread);\n return this.#answered(this.#heard(read));\n }\n\n *accept(args ) {\n const given = Mouth.#at(args, 'invitation');\n const placeholder = Mouth.#at(args, 'placeholder');\n if (typeof given !== 'string' || typeof placeholder !== 'string')\n return this.error('refused', 'accept takes an invitation and a placeholder');\n const text = given.replace(Mouth.#blank, '');\n const named = Mouth.#at(args, 'node');\n if (named !== null && this.stamp.asker !== 'brain') return this.error('refused', \"node is the brain's alone\");\n const node = this.stamp.asker === 'brain' ? named : this.stamp.asker;\n if (typeof node !== 'string') return this.error('refused', 'the brain names the lobe it accepts for');\n const standing = yield* this.#key('standingOn', { invitation: text });\n const unsealed = Mouth.#at(standing, 'why');\n if (typeof unsealed === 'string') return this.error('refused', unsealed);\n const note = Mouth.#at(args, 'note');\n const { waits, lives, anchor } = Mouth.#spans(text);\n const stood = yield {\n placeholder: 'brain',\n method: 'stand',\n args: { node, placeholder, standing, note, waits, lives, anchor },\n };\n if ('error' in stood) return this.error('refused', stood.error.message);\n return { far: Mouth.#at(stood.result, 'far') };\n }\n\n *vouch(args ) {\n const domain = Mouth.#at(args, 'domain');\n if (typeof domain !== 'string') return this.error('refused', 'vouch takes a domain');\n const request = { method: 'GET', url: `https://${domain}/.well-known/quo`, headers: {}, body: new Uint8Array(0) };\n const sent = yield { placeholder: 'network', method: 'send', args: request };\n if ('error' in sent || Mouth.#at(sent.result, 'status') !== 200) return null;\n return { body: Mouth.#at(sent.result, 'body') };\n }\n\n *#handed(method , args ) {\n const answer = yield { placeholder: 'key', method, args };\n return 'result' in answer ? answer.result : this.error('refused', answer.error.message);\n }\n\n *taking() {\n return yield* this.#handed('taking', {});\n }\n\n *cede(args ) {\n return yield* this.#handed('cede', args);\n }\n\n *take(args ) {\n return yield* this.#handed('take', args);\n }\n\n *drop(args ) {\n const far = Mouth.#at(args, 'far');\n if (typeof far !== 'string') return this.error('refused', 'drop takes a far organism');\n const left = yield {\n placeholder: 'brain',\n method: 'leave',\n args: { node: this.stamp.asker, far },\n };\n return 'error' in left ? this.error('refused', left.error.message) : null;\n }\n\n *carry(args ) {\n const far = Mouth.#at(args, 'far');\n const method = Mouth.#at(args, 'method');\n const timeout = Mouth.#at(args, 'timeout');\n const room = Mouth.#at(args, 'room');\n if (typeof far !== 'string' || typeof timeout !== 'number' || typeof room !== 'number')\n return this.error('refused', 'carry takes a far organism, a timeout and the room of a box');\n const given = method === null ? {} : Mouth.#at(args, 'args');\n const ask = { ...(typeof method === 'string' ? { method } : {}), args: this.codec.text(given) };\n let sent = { standing: Mouth.#at(args, 'standing'), at: Mouth.#at(args, 'at') };\n if (typeof method !== 'string' || this.#cost(ask.args) <= room)\n sent = yield* this.#asked(far, Mouth.#at(sent, 'standing'), Mouth.#at(sent, 'at'), ask, timeout);\n else {\n for (let at = 0, from = 0; from < ask.args.length; at += 1) {\n const end = this.#end(ask.args, from, room);\n sent = yield* this.#next(far, sent, Mouth.#in, { at, part: ask.args.slice(from, end) }, timeout);\n if (Mouth.#broken(sent) && !Mouth.#repeated(sent)) return sent;\n from = end;\n }\n sent = yield* this.#next(far, sent, Mouth.#whole, { method, units: ask.args.length }, timeout);\n if (Mouth.#repeated(sent)) {\n const told = yield* this.#next(far, sent, Mouth.#out, {}, timeout);\n const length = Mouth.#at(Mouth.#at(told, 'heard'), 'result');\n sent = Mouth.#hearing(told, typeof length === 'number' ? { '#pieces': length } : Mouth.#at(sent, 'heard'));\n }\n }\n const units = Mouth.#at(Mouth.#at(sent, 'heard'), '#pieces');\n if (typeof units !== 'number' || Mouth.#broken(sent)) return sent;\n const parts = [];\n for (let from = 0; from < units;) {\n sent = yield* this.#next(far, sent, Mouth.#out, { from }, timeout);\n if (Mouth.#repeated(sent)) continue;\n const part = Mouth.#at(Mouth.#at(sent, 'heard'), 'result');\n if (Mouth.#broken(sent)) return sent;\n if (typeof part !== 'string' || part === '')\n return Mouth.#hearing(sent, Mouth.#failed('unavailable', 'a piece of the answer is no text'));\n parts.push(part);\n from += part.length;\n }\n const whole = parts.join('');\n const read = this.codec.read(whole);\n const heard =\n whole.length === units && 'data' in read\n ? read.data\n : Mouth.#failed('unavailable', 'the answer came back in pieces that make no whole');\n return Mouth.#hearing(sent, heard);\n }\n\n #cost(text ) {\n const bytes = this.codec.utf8(this.codec.text(text));\n if ('why' in bytes) throw new TypeError(bytes.why);\n return bytes.bytes.length - 2;\n }\n\n #end(text , from , room ) {\n let units = Math.min(text.length - from, room);\n for (;;) {\n let end = from + units;\n const last = text.charCodeAt(end - 1);\n if (end < text.length && last >= 0xd800 && last < 0xdc00) end += end - 1 > from ? -1 : 1;\n const cost = this.#cost(text.slice(from, end));\n if (cost <= room || units === 1) return end;\n units = Math.max(1, Math.floor(((end - from) * room) / cost));\n }\n }\n\n static #hearing(sent , heard ) {\n return { heard, standing: Mouth.#at(sent, 'standing'), at: Mouth.#at(sent, 'at'), answered: true };\n }\n\n *#next(far , before , method , args , timeout ) {\n const ask = { method, args: this.codec.text(args) };\n return yield* this.#asked(far, Mouth.#at(before, 'standing'), Mouth.#at(before, 'at'), ask, timeout);\n }\n\n static #broken(sent ) {\n return Mouth.#at(Mouth.#at(sent, 'heard'), 'error') !== null;\n }\n\n static #repeated(sent ) {\n return Mouth.#at(Mouth.#at(Mouth.#at(sent, 'heard'), 'error'), 'code') === 'repeated';\n }\n\n *#asked(far , standing , newest , ask , timeout ) {\n const first = yield* this.#box(far, standing, newest, ask, timeout);\n const read = Mouth.#at(first, 'read');\n const resolved = Mouth.#at(first, 'again') === true && Mouth.#at(read, 'nothing') !== true;\n const moved = Mouth.#at(first, 'standing');\n const last = resolved ? yield* this.#box(far, moved, Mouth.#at(first, 'at'), ask, timeout) : first;\n const heard = Mouth.#at(last, 'heard') ?? this.#heard(Mouth.#at(last, 'read'));\n const answered = typeof Mouth.#at(Mouth.#at(last, 'read'), 'object') === 'string' ? { answered: true } : {};\n return { heard, standing: Mouth.#at(last, 'standing'), at: Mouth.#at(last, 'at'), ...answered };\n }\n}";
4433
4433
 
4434
4434
  var MOUTH_SOURCE = facultySource(MOUTH_TEXT);
4435
4435
 
@@ -4908,13 +4908,13 @@ var Library = class _Library extends Faculty {
4908
4908
  return this.error("refused", `the faculty names version ${JSON.stringify(named6 ?? null)}, not ${version2}`);
4909
4909
  const carried3 = yield* this.#assetsTaken(answered2, blueprint, at);
4910
4910
  if (typeof carried3 === "string") return this.error("refused", carried3);
4911
- const refused15 = _Library.keep(
4911
+ const refused16 = _Library.keep(
4912
4912
  this.cells,
4913
4913
  digest,
4914
4914
  { source, blueprint, road, label, ...carried3.kept, ...at.second === void 0 ? {} : { second: at.second } },
4915
4915
  carried3.bytes
4916
4916
  );
4917
- return refused15 === null ? { digest } : this.error("refused", refused15);
4917
+ return refused16 === null ? { digest } : this.error("refused", refused16);
4918
4918
  }
4919
4919
  #reroad(digest, road, version2) {
4920
4920
  const kept3 = this.cells.get(["faculty", digest]);
@@ -5268,13 +5268,13 @@ var Library = class _Library extends Faculty {
5268
5268
  if (!(named6 === void 0 && assets.length === 0) && _Library.assetsDigest(this.crypto, assets) !== named6)
5269
5269
  return this.error("refused", "the assets given are not the digest the faculty's blueprint names");
5270
5270
  const sorted = assets.toSorted((one, other) => one[0] < other[0] ? -1 : 1);
5271
- const refused15 = _Library.keep(
5271
+ const refused16 = _Library.keep(
5272
5272
  this.cells,
5273
5273
  digest,
5274
5274
  { source, blueprint, road, ...named6 === void 0 ? {} : { assets: sorted } },
5275
5275
  bytes7
5276
5276
  );
5277
- return refused15 === null ? { digest } : this.error("refused", refused15);
5277
+ return refused16 === null ? { digest } : this.error("refused", refused16);
5278
5278
  }
5279
5279
  *#addHand(args) {
5280
5280
  const [source, assets, second] = ["source", "assets", "second"].map((one) => _Library.field(args, one));
@@ -5299,7 +5299,7 @@ var Library = class _Library extends Faculty {
5299
5299
  const named6 = _Library.field(blueprint, "assets");
5300
5300
  if (named6 !== void 0 && _Library.assetsDigest(this.crypto, taken.assets) !== named6)
5301
5301
  return this.error("refused", "the assets carried are not the digest the faculty's blueprint names");
5302
- const refused15 = _Library.keep(
5302
+ const refused16 = _Library.keep(
5303
5303
  this.cells,
5304
5304
  digest,
5305
5305
  {
@@ -5311,7 +5311,7 @@ var Library = class _Library extends Faculty {
5311
5311
  },
5312
5312
  taken.bytes
5313
5313
  );
5314
- return refused15 === null ? { digest } : this.error("refused", refused15);
5314
+ return refused16 === null ? { digest } : this.error("refused", refused16);
5315
5315
  }
5316
5316
  *remove(args) {
5317
5317
  if (this.stamp.asker !== "brain")
@@ -5494,7 +5494,7 @@ var Library = class _Library extends Faculty {
5494
5494
 
5495
5495
  var LIBRARY_BLUEPRINT = {
5496
5496
  name: "nervur.library",
5497
- version: "0.37.1",
5497
+ version: "0.37.3",
5498
5498
  description: "The library: it keeps the organism's faculties with their assets, and its organs, as data, each version by its digest, and the versions its sources told it.",
5499
5499
  methods: {
5500
5500
  add: {
@@ -5751,13 +5751,13 @@ var LIBRARY_BLUEPRINT = {
5751
5751
  placeholders: { brain: "nervur.brain", mouth: "nervur.mouth", ear: "nervur.ear" }
5752
5752
  };
5753
5753
 
5754
- var LIBRARY_TEXT = "class Library extends Faculty {\n static #digest = { type: 'string', pattern: '^[0-9a-f]{64}$' };\n\n static #road = { type: 'string', minLength: 1, maxLength: 256 };\n\n static #assets = {\n type: 'array',\n items: { type: 'array', items: { type: 'string', minLength: 1 }, minItems: 2, maxItems: 2 },\n };\n\n static #faculty = {\n type: 'object',\n properties: {\n source: { type: 'string', minLength: 1 },\n digest: Library.#digest,\n blueprint: { type: 'object' },\n road: Library.#road,\n label: { type: 'string', minLength: 1, maxLength: 64 },\n assets: Library.#assets,\n },\n required: ['source', 'digest', 'blueprint', 'road'],\n additionalProperties: false,\n };\n\n static #organ = {\n type: 'object',\n properties: {\n id: { type: 'string', minLength: 1, maxLength: 64 },\n digest: Library.#digest,\n graph: { type: 'string', minLength: 1 },\n blueprint: { type: 'object' },\n reach: {},\n half: { anyOf: [Library.#digest, { type: 'null' }] },\n road: Library.#road,\n },\n required: ['id', 'digest', 'graph', 'blueprint', 'half', 'road'],\n additionalProperties: false,\n };\n\n static #asset = {\n type: 'object',\n properties: { digest: Library.#digest, bytes: { type: 'string', contentEncoding: 'base16' } },\n required: ['digest', 'bytes'],\n additionalProperties: false,\n };\n\n static #lobe = { type: 'string', pattern: '^[A-Z][A-Z0-9]*$', maxLength: 64 };\n\n static #given = {\n type: 'object',\n properties: {\n kind: { const: 'faculty' },\n given: {\n type: 'object',\n properties: {\n place: Library.#lobe,\n digest: Library.#digest,\n items: { type: 'array', items: { type: 'object' }, maxItems: 1001 },\n },\n required: ['place', 'digest', 'items'],\n additionalProperties: false,\n },\n },\n required: ['kind', 'given'],\n additionalProperties: false,\n };\n\n static #hand = {\n type: 'object',\n properties: {\n source: { type: 'string', minLength: 1 },\n assets: { type: 'array', items: { type: 'object' } },\n second: { type: 'boolean' },\n },\n required: ['source'],\n additionalProperties: false,\n };\n\n static #version = {\n type: 'string',\n pattern: '^(0|[1-9][0-9]*)\\\\.(0|[1-9][0-9]*)\\\\.(0|[1-9][0-9]*)$',\n };\n\n static #named = {\n type: 'string',\n pattern: '^[a-z][a-z0-9]*([.-][a-z0-9]+)*$',\n maxLength: 64,\n };\n\n static #half = {\n type: 'object',\n properties: {\n form: { enum: ['component', 'native'] },\n code: {\n anyOf: [\n { type: 'string', minLength: 1 },\n { type: 'string', contentEncoding: 'base16' },\n ],\n },\n },\n required: ['form', 'code'],\n additionalProperties: false,\n };\n\n static blueprint = {\n name: 'nervur.library',\n version: '0.37.1',\n description:\n \"The library: it keeps the organism's faculties with their assets, and its organs, as data, each version by its digest, and the versions its sources told it.\",\n methods: {\n add: {\n description:\n \"On an owner's ask through the brain alone. From a source, `road`, any lobe of the organism's own whose describe names `get` and `told`: a faculty by its label or an organ by its ID, at a version, read from it over a wire the library orders, its digest checked and its blueprint's version, and kept under the road `<lobe>@<version>`, with that lobe kept as a source of the owners' own where its `state` answers a name, once; a faculty whose blueprint names `assets` has each asset read whole by its path and checked against its SHA-256, and their canonical digest against the blueprint's, or none of it is kept. From a far source, `road`, the library holds a standing on: a faculty or an organ at a version it told, read over the standing, each digest checked against what it told, an organ by its graph.json alone, never its host half, a faculty's assets as from near. Or by an owner's hand, `source`: a faculty's text carried in the ask, with its `assets` where it has any, kept under the road `hand@<version>` by the same walls. Or a host half's form and code under the digest of its code. A code the library keeps already, added from another road, takes that road, all else as it stands; boot's laying changes no road. Answers the digest; refuses a code whose blueprint's name and version the library keeps under another digest, but with `second`, an owner's word on a faculty, which takes it as a name of its own, kept by its source.\",\n kind: 'writing',\n args: {\n anyOf: [\n {\n type: 'object',\n properties: {\n road: Library.#lobe,\n kind: { const: 'faculty' },\n label: Library.#named,\n version: Library.#version,\n second: { type: 'boolean' },\n },\n required: ['road', 'kind', 'label', 'version'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n road: Library.#lobe,\n kind: { const: 'organ' },\n id: Library.#named,\n version: Library.#version,\n },\n required: ['road', 'kind', 'id', 'version'],\n additionalProperties: false,\n },\n Library.#given,\n Library.#hand,\n ],\n },\n result: {\n type: 'object',\n properties: { digest: Library.#digest },\n required: ['digest'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n accept: {\n description:\n \"On an owner's ask through the brain alone: accepts a far source's invitation to a library's standing through the mouth, holding the relation itself on a placeholder of its own. It asks the far lobe at once what it told, `told`, and again at an add of a version not told it yet, since an organism that cannot be dialed can be told nothing. One that can names `tells`: since a relation runs one way, it draws through the ear a standing back on itself for the far lobe, the one before for that far lobe ended, and hands it as `told { tells }`, over which the far lobe tells each version it tells after, `changed`. With `note`, the owner's, which the brain keeps beside the standing, null where none is named. Answers the far organism the brain made up for it, the road an add names it by.\",\n kind: 'writing',\n args: {\n type: 'object',\n properties: { invitation: { type: 'string', minLength: 1 }, note: {}, tells: { const: true } },\n required: ['invitation'],\n additionalProperties: false,\n },\n result: {\n type: 'object',\n properties: { far: Library.#lobe },\n required: ['far'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n changed: {\n description:\n \"A source's word that its `main` holds a faculty or an organ at a version it never told: a near one's over its wire, a far one's over the occupant the library's `accept` gave it, by an ask; kept for the owners to see, by `list` with `told`, never added.\",\n kind: 'writing',\n args: {\n type: 'object',\n properties: {\n kind: { enum: ['faculty', 'organ'] },\n label: Library.#named,\n version: Library.#version,\n digest: Library.#digest,\n },\n required: ['kind', 'label', 'version', 'digest'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n remove: {\n irreversible: true,\n description:\n \"Deletes a version no lobe stands on with its assets no other kept faculty names, an organ's record, or a host half's code no organ names, on the brain's ask alone.\",\n kind: 'writing',\n args: Library.#byDigest(),\n errors: ['refused', 'used'],\n },\n spare: {\n description:\n \"On an owner's ask through the brain alone: keeps a version the library holds from the sweep, or, with `spared: false`, gives it back. An owner may still remove it.\",\n kind: 'writing',\n args: {\n type: 'object',\n properties: { digest: Library.#digest, spared: { type: 'boolean' } },\n required: ['digest'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n evidence: {\n description:\n \"The asset that carries a kept faculty's evidence, `evidence.json`, by its SHA-256, which `get` answers, or null where it carries none; refused to a far asker.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { faculty: Library.#digest },\n required: ['faculty'],\n additionalProperties: false,\n },\n result: {\n type: 'object',\n properties: { evidence: { anyOf: [Library.#digest, { type: 'null' }] } },\n required: ['evidence'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n get: {\n description:\n \"The version of a digest with its assets, an organ's record, an asset's bytes, or a host half's form and code, or null; refused to a far asker.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { digest: Library.#digest },\n required: ['digest'],\n additionalProperties: false,\n },\n result: {\n anyOf: [Library.#faculty, Library.#organ, Library.#asset, Library.#half, { type: 'null' }],\n },\n errors: ['refused'],\n },\n old: {\n description:\n \"The old versions the library keeps, on the brain's ask alone: of each name, a faculty's or an organ's blueprint name, every version but the newest by semver; the brain removes each no lobe stands on.\",\n kind: 'reading',\n args: { type: 'object', additionalProperties: false },\n result: { type: 'object', properties: { digests: { type: 'array', items: { type: 'string' } } } },\n },\n list: {\n description:\n \"The versions kept, by their blueprint's name, each with its road, an organ's marked, one an owner spared marked `spared`, a faculty a source or an owner's hand brought with no evidence marked `unproven`, a page at a time; with `told`, the versions the sources told, each with whether the library keeps it; refused to a far asker.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: {\n cursor: { anyOf: [{ type: 'string' }, { type: 'null' }] },\n limit: { type: 'integer', minimum: 1 },\n told: { type: 'boolean' },\n },\n additionalProperties: false,\n },\n result: {\n anyOf: [\n {\n type: 'object',\n properties: {\n faculties: { type: 'array', items: { type: 'object' } },\n cursor: { anyOf: [{ type: 'string' }, { type: 'null' }] },\n },\n required: ['faculties', 'cursor'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n told: { type: 'array', items: { type: 'object' } },\n cursor: { anyOf: [{ type: 'string' }, { type: 'null' }] },\n },\n required: ['told', 'cursor'],\n additionalProperties: false,\n },\n ],\n },\n errors: ['refused'],\n },\n },\n placeholders: { brain: 'nervur.brain', mouth: 'nervur.mouth', ear: 'nervur.ear' },\n };\n\n static #owner = 'brain';\n\n static #contract = ['get', 'told'];\n\n static #evidence = 'evidence.json';\n\n static #handRoad = 'hand';\n\n static #versionText = /^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$/;\n static #namedText = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/;\n static #lobeText = /^[A-Z][A-Z0-9]*$/;\n\n static #sent(value ) {\n if (value === undefined) return 'nothing';\n const read = JSON.stringify(value);\n return read.length > 64 ? `${read.slice(0, 63)}\u2026` : read;\n }\n\n #page() {\n return Math.min(1000, Math.floor(this.memory / 4 / 1024));\n }\n\n static #byDigest() {\n return {\n type: 'object',\n properties: { digest: Library.#digest },\n required: ['digest'],\n additionalProperties: false,\n };\n }\n\n static #digestIn(args ) {\n const digest = Library.field(args, 'digest');\n return typeof digest === 'string' && /^[0-9a-f]{64}$/.test(digest) ? digest : undefined;\n }\n\n static #utf8(text ) {\n const bytes = [];\n for (const char of text) {\n const point = char.codePointAt(0) ?? 0;\n if (point < 0x80) bytes.push(point);\n else if (point < 0x800) bytes.push(0xc0 | (point >> 6), 0x80 | (point & 0x3f));\n else if (point < 0x10000) bytes.push(0xe0 | (point >> 12), 0x80 | ((point >> 6) & 0x3f), 0x80 | (point & 0x3f));\n else\n bytes.push(\n 0xf0 | (point >> 18),\n 0x80 | ((point >> 12) & 0x3f),\n 0x80 | ((point >> 6) & 0x3f),\n 0x80 | (point & 0x3f),\n );\n }\n return new Uint8Array(bytes);\n }\n\n static digestOf(crypto , code ) {\n return Library.hex(crypto.sha256(typeof code === 'string' ? Library.#utf8(code) : code));\n }\n\n static assetsDigest(\n crypto ,\n assets ,\n ) {\n const sorted = assets.toSorted((one, other) => (one[0] < other[0] ? -1 : 1));\n return Library.digestOf(crypto, JSON.stringify(sorted));\n }\n\n static keep(\n cells ,\n digest ,\n kept ,\n bytes = new Map(),\n ) {\n if (!('source' in kept)) {\n if (cells.get(['half', digest]) === undefined) cells.set(['half', digest], { form: kept.form, code: kept.code });\n return null;\n }\n const { source, blueprint, road, label, assets, second } = kept;\n const name = Library.field(blueprint, 'name');\n if (typeof name !== 'string') throw new TypeError('a version kept is one whose blueprint is named');\n if (cells.get(['faculty', digest]) !== undefined) return null;\n const named = Library.field(blueprint, 'assets') !== undefined;\n if (named !== (assets !== undefined))\n return named\n ? `the blueprint of ${name} names assets the faculty carries not`\n : `${name} carries assets its blueprint names not`;\n for (const [, sha] of assets ?? [])\n if (!bytes.has(sha) && cells.get(['asset', sha]) === undefined)\n return `${name} has no bytes for its asset ${sha}`;\n const indexed = Library.#indexed(cells, name, Library.field(blueprint, 'version'), digest, second);\n if (typeof indexed === 'string') return indexed;\n for (const [, sha] of assets ?? []) {\n const held = bytes.get(sha);\n if (held !== undefined && cells.get(['asset', sha]) === undefined) cells.set(['asset', sha], held);\n }\n cells.set(['faculty', digest], {\n source,\n digest,\n blueprint,\n road,\n ...(label === undefined ? {} : { label }),\n ...(assets === undefined ? {} : { assets: assets.map(([path, sha]) => [path, sha]) }),\n ...(indexed.second === undefined ? {} : { second: indexed.second }),\n });\n cells.set(['name', name, digest], label ?? null);\n return null;\n }\n\n static #indexed(\n cells ,\n name ,\n version ,\n digest ,\n second ,\n ) {\n if (typeof version !== 'string') return `the blueprint of ${name} names no version`;\n const named = cells.get(['version', name, version]);\n if (typeof named !== 'string' || named === digest) {\n cells.set(['version', name, version], digest);\n return {};\n }\n if (second === undefined) return `the library keeps ${name} ${version} under another digest, ${named}`;\n const own = cells.get(['second', name, version, second]);\n if (typeof own === 'string' && own !== digest)\n return `the library keeps ${name} ${version} of ${second} under another digest, ${own}`;\n cells.set(['second', name, version, second], digest);\n return { second };\n }\n\n *add(args ) {\n if (this.stamp.asker !== Library.#owner)\n return this.error('refused', \"the library adds on an owner's ask through the brain alone\");\n if (Library.field(args, 'given') !== undefined) return yield* this.#addGiven(args);\n if (Library.field(args, 'source') !== undefined) return yield* this.#addHand(args);\n return yield* this.#addFrom(args);\n }\n\n *#read(source ) {\n const answered = yield { read: source };\n const read = 'result' in answered ? answered.result : undefined;\n const blueprint = Library.field(read, 'blueprint');\n if (blueprint !== undefined && typeof Library.field(blueprint, 'name') === 'string') return blueprint;\n const why = Library.field(read, 'why');\n return `the source is no faculty: ${typeof why === 'string' ? why : 'it declares no blueprint'}`;\n }\n\n static #fromArgs(\n args ,\n ) {\n const kind = Library.field(args, 'kind');\n const key = kind === 'organ' ? 'id' : 'label';\n const [road, named, version] = ['road', key, 'version'].map((one) => Library.field(args, one));\n const keys = typeof args === 'object' && args !== null ? Object.keys(args).length : 0;\n const second = Library.field(args, 'second');\n if ((kind !== 'faculty' && kind !== 'organ') || keys !== (second === undefined ? 4 : 5))\n return 'add takes a road, a kind, a faculty or an organ, its label or ID, and a version';\n if (second !== undefined && ((second !== true && second !== false) || kind !== 'faculty'))\n return `\\`second\\` is an owner's word on a faculty, true or false, not ${Library.#sent(second)}`;\n if (typeof road !== 'string' || road.length > 64 || !Library.#lobeText.test(road))\n return `a road is a lobe of this organism, by the ID the brain made up for it, not ${Library.#sent(road)}`;\n if (typeof named !== 'string' || named.length > 64 || !Library.#namedText.test(named))\n return `a ${key} is a folder's name, lowercase, not ${Library.#sent(named)}`;\n if (typeof version !== 'string' || !Library.#versionText.test(version))\n return `a version is three whole numbers joined by dots, not ${Library.#sent(version)}`;\n return { road, kind, named, version, second: second === true };\n }\n\n *#addFrom(args ) {\n const asked = Library.#fromArgs(args);\n if (typeof asked === 'string') return this.error('refused', asked);\n if (this.cells.get(['far', asked.road]) !== undefined) return yield* this.#addFar(asked);\n const { road, kind, named, version, second } = asked;\n const unreached = yield* this.#reach(road);\n if (unreached !== null) return this.error('refused', unreached);\n const got = yield {\n placeholder: road,\n method: 'get',\n args: { kind, label: named, version },\n };\n if ('error' in got)\n return this.error('refused', `the source ${road} answers ${got.error.code}: ${got.error.message}`);\n const from = `${road}@${version}`;\n const taken =\n kind === 'organ'\n ? this.#takeOrgan(got.result, named, version, from)\n : yield* this.#takeFaculty(got.result, from, {\n lobe: road,\n label: named,\n version,\n ...(second ? { second: road } : {}),\n });\n if (Library.#added(taken)) yield* this.#kindOf(road);\n return taken;\n }\n\n static #added(taken ) {\n return typeof taken === 'object' && taken !== null && 'digest' in taken;\n }\n\n *#kindOf(lobe ) {\n if (this.cells.get(['source', lobe]) !== undefined) return;\n const state = yield {\n placeholder: lobe,\n method: 'state',\n args: {},\n };\n const name = 'result' in state ? Library.field(state.result, 'name') : undefined;\n if (typeof name === 'string' && name !== '') this.cells.set(['source', lobe], 'owners');\n }\n\n *#reach(lobe ) {\n const order = { termination: lobe };\n const ordered = yield {\n placeholder: 'nerves',\n method: 'order',\n args: { order },\n };\n if ('error' in ordered) return `the library reaches no ${lobe}: ${ordered.error.message}`;\n const described = yield {\n placeholder: lobe,\n method: null,\n args: null,\n };\n const methods = 'result' in described ? Library.field(described.result, 'methods') : undefined;\n const lacking = Library.#contract.filter((method) => Library.field(methods, method) === undefined);\n if (lacking.length === 0) return null;\n yield {\n placeholder: 'nerves',\n method: 'unwire',\n args: { placeholder: lobe },\n };\n return `${lobe} is no source: its describe names no ${lacking.join(' and no ')}`;\n }\n\n *#takeFaculty(answered , road , at ) {\n const { label, version } = at;\n const source = Library.field(answered, 'source');\n const told = Library.field(answered, 'digest');\n if (typeof source !== 'string' || source === '') return this.error('refused', 'the source answered no source');\n const digest = Library.digestOf(this.crypto, source);\n if (told !== digest)\n return this.error('refused', `the source the source answered is not its digest, ${JSON.stringify(told ?? null)}`);\n if (this.cells.get(['faculty', digest]) !== undefined) return this.#reroad(digest, road, version);\n const blueprint = yield* this.#read(source);\n if (typeof blueprint === 'string') return this.error('refused', blueprint);\n const named = Library.field(blueprint, 'version');\n if (named !== version)\n return this.error('refused', `the faculty names version ${JSON.stringify(named ?? null)}, not ${version}`);\n const carried = yield* this.#assetsTaken(answered, blueprint, at);\n if (typeof carried === 'string') return this.error('refused', carried);\n const refused = Library.keep(\n this.cells,\n digest,\n { source, blueprint, road, label, ...carried.kept, ...(at.second === undefined ? {} : { second: at.second }) },\n carried.bytes,\n );\n return refused === null ? { digest } : this.error('refused', refused);\n }\n\n #reroad(digest , road , version ) {\n const kept = this.cells.get(['faculty', digest]);\n const named = Library.field(Library.field(kept, 'blueprint'), 'version');\n if (named !== version)\n return this.error('refused', `the faculty names version ${JSON.stringify(named ?? null)}, not ${version}`);\n if (Library.field(kept, 'road') === road) return { digest };\n const record = {};\n for (const field of ['source', 'digest', 'blueprint', 'label', 'assets', 'second']) {\n const value = Library.field(kept, field);\n if (value !== undefined) record[field] = value;\n }\n this.cells.set(['faculty', digest], { ...record, road });\n return { digest };\n }\n\n *#assetsTaken(\n answered ,\n blueprint ,\n at ,\n ) \n \n \n \n {\n const bytes = new Map ();\n const named = Library.field(blueprint, 'assets');\n const told = Library.field(answered, 'assets');\n if (named === undefined)\n return told === undefined ? { kept: {}, bytes } : 'the source answered assets the blueprint names not';\n const assets = this.#assetsOf(told);\n if (assets === null) return 'the source answered no assets whole: each a path and a SHA-256, one path once';\n if (Library.assetsDigest(this.crypto, assets) !== named)\n return `the assets are not the digest the blueprint names, ${JSON.stringify(named)}`;\n for (const [path, sha] of assets) {\n if (bytes.has(sha) || this.cells.get(['asset', sha]) !== undefined) continue;\n const got = yield {\n placeholder: at.lobe,\n method: 'get',\n args: { kind: 'faculty', label: at.label, version: at.version, path },\n };\n if ('error' in got)\n return `the source ${at.lobe} answers ${got.error.code} for the asset ${path}: ${got.error.message}`;\n const [given, digest, held] = ['path', 'digest', 'bytes'].map((one) => Library.field(got.result, one));\n if (given !== path || digest !== sha || !(held instanceof Uint8Array))\n return `the source answered another asset than ${path}`;\n if (Library.digestOf(this.crypto, held) !== sha) return `the asset ${path} is not its digest, ${sha}`;\n bytes.set(sha, held);\n }\n return { kept: { assets }, bytes };\n }\n\n static #json(text ) {\n try {\n const read = JSON.parse(text);\n return typeof read === 'object' && read !== null && !Array.isArray(read) ? read : null;\n } catch {\n return null;\n }\n }\n\n #takeOrgan(answered , id , version , road ) {\n const graph = Library.field(answered, 'blueprint');\n const half = Library.field(answered, 'half') ?? null;\n if (typeof graph !== 'string') return this.error('refused', \"the source answered no organ's graph.json\");\n if (half !== null && (typeof half !== 'string' || !/^[0-9a-f]{64}$/.test(half)))\n return this.error('refused', 'the source answered a built half that is no digest');\n const read = Library.#json(graph);\n const inner = Library.field(read, 'blueprint');\n const blueprint = inner !== undefined && Library.#json(JSON.stringify(inner)) !== null ? inner : read;\n const name = Library.field(blueprint, 'name');\n const named = Library.field(blueprint, 'version');\n if (blueprint === null || blueprint === undefined || typeof name !== 'string')\n return this.error('refused', 'its graph.json holds no blueprint, named');\n if (named !== version)\n return this.error('refused', `the organ names version ${JSON.stringify(named ?? null)}, not ${version}`);\n const digest = Library.digestOf(this.crypto, graph);\n const kept = this.#organAt(digest);\n if (kept !== undefined) {\n if (half !== null || kept['road'] !== road)\n this.cells.set(['organ', digest], { ...kept, ...(half === null ? {} : { half }), road });\n return { digest };\n }\n const clash = Library.#indexed(this.cells, name, named, digest, undefined);\n if (typeof clash === 'string') return this.error('refused', clash);\n const reach = inner === undefined ? undefined : Library.field(read, 'reach');\n this.cells.set(['organ', digest], {\n id,\n digest,\n graph,\n blueprint,\n ...(reach === undefined ? {} : { reach }),\n half,\n road,\n });\n this.cells.set(['name', name, digest], id);\n return { digest };\n }\n\n #assetsOf(data ) {\n if (!Array.isArray(data) || data.length > this.#page()) return null;\n const assets = [];\n for (const one of data) {\n const [path, sha] = Array.isArray(one) && one.length === 2 ? one : [];\n if (typeof path !== 'string' || path === '') return null;\n if (typeof sha !== 'string' || !/^[0-9a-f]{64}$/.test(sha)) return null;\n assets.push([path, sha]);\n }\n const sorted = assets.toSorted((one, other) => (one[0] < other[0] ? -1 : 1));\n return sorted.every((one, at) => sorted[at - 1]?.[0] !== one[0]) ? sorted : null;\n }\n\n #assetsNamed() {\n const named = new Set ();\n let cursor = null;\n do {\n const page = this.cells.range({\n prefix: ['faculty'],\n limit: this.#page(),\n ...(cursor === null ? {} : { cursor }),\n });\n for (const { value } of page.cells)\n for (const [, sha] of this.#assetsOf(Library.field(value, 'assets')) ?? []) named.add(sha);\n cursor = page.cursor;\n } while (cursor !== null);\n return named;\n }\n\n *accept(args ) {\n if (this.stamp.asker !== Library.#owner)\n return this.error('refused', \"the library accepts a standing on an owner's ask through the brain alone\");\n const invitation = Library.field(args, 'invitation');\n const note = Library.field(args, 'note');\n const keys = typeof args === 'object' && args !== null ? Object.keys(args).length : 0;\n const tells = Library.field(args, 'tells');\n const named = 1 + (note === undefined ? 0 : 1) + (tells === undefined ? 0 : 1);\n if (typeof invitation !== 'string' || invitation === '' || keys !== named || (tells ?? true) !== true)\n return this.error(\n 'refused',\n 'accept takes an invitation, a note where one is named, and `tells` where it can be told',\n );\n const held = this.cells.get(['standings']);\n const count = typeof held === 'number' ? held + 1 : 1;\n this.cells.set(['standings'], count);\n const placeholder = `far-${count}`;\n const accepted = yield* this.#accepted({ invitation, placeholder, note: note ?? null });\n if ('error' in accepted) return this.error('refused', `the mouth accepts no standing: ${accepted.error.message}`);\n const far = Library.field(accepted.result, 'far');\n if (typeof far !== 'string' || !Library.#lobeText.test(far))\n return this.error('refused', 'the mouth named no far organism');\n this.cells.set(['far', far], { placeholder });\n this.cells.set(['source', far], 'far');\n yield* this.#untold(far);\n if (tells === true) yield* this.#tellsBack(far, placeholder);\n else yield* this.#asksTold(far, placeholder);\n return { far };\n }\n\n *#accepted(args ) {\n const answer = yield { placeholder: 'mouth', method: 'accept', args };\n return answer;\n }\n\n *#tellsBack(far , placeholder ) {\n const invited = yield {\n placeholder: 'ear',\n method: 'invite',\n args: { waits: null, lives: null, note: { library: far } },\n };\n const tells = 'result' in invited ? Library.field(invited.result, 'invitation') : undefined;\n const back = 'result' in invited ? Library.field(invited.result, 'far') : undefined;\n if (typeof tells !== 'string') return;\n const asked = yield { placeholder, method: 'told', args: { tells } };\n if ('error' in asked) {\n if (typeof back === 'string') yield { placeholder: 'ear', method: 'drop', args: { far: back } };\n return;\n }\n this.#heardAll(far, asked.result);\n }\n\n *#asksTold(far , placeholder ) {\n const asked = yield { placeholder, method: 'told', args: {} };\n if ('result' in asked) this.#heardAll(far, asked.result);\n }\n\n #heardAll(far , answered ) {\n for (const one of Array.isArray(answered) ? answered.slice(0, this.#page()) : []) {\n const told = Library.#toldFar(one);\n if (told !== null) this.#heard(far, told.kind, told.label, told.version, told.digest);\n }\n }\n\n *#untold(far ) {\n let cursor = null;\n const seen = new Set ();\n const given = [];\n do {\n const page = yield {\n placeholder: 'nerves',\n method: 'relations',\n args: cursor === null ? {} : { cursor },\n };\n if ('error' in page) break;\n const relations = Library.field(page.result, 'relations');\n for (const one of Array.isArray(relations) ? relations : []) {\n const back = Library.field(one, 'far');\n const mine = Library.field(Library.field(one, 'note'), 'library') === far;\n if (Library.field(one, 'side') === 'occupant' && mine && typeof back === 'string') given.push(back);\n }\n const next = Library.field(page.result, 'cursor');\n cursor = typeof next === 'string' && !seen.has(next) ? next : null;\n if (cursor !== null) seen.add(cursor);\n } while (cursor !== null);\n for (const back of given) yield { placeholder: 'ear', method: 'drop', args: { far: back } };\n }\n\n #heard(far , kind , label , version , digest ) {\n const key = ['told', far, kind, label, version];\n if (this.cells.get(key) !== undefined) return;\n const telling = this.cells.get(['telling', far]) ?? { first: 0, next: 0 };\n let first = Number(Library.field(telling, 'first'));\n const next = Number(Library.field(telling, 'next'));\n for (; next - first >= this.#page(); first += 1) {\n const oldest = this.cells.get(['telling', far, first]);\n if (Array.isArray(oldest)) this.cells.delete(oldest);\n this.cells.delete(['telling', far, first]);\n }\n this.cells.set(['telling', far, next], key);\n this.cells.set(['telling', far], { first, next: next + 1 });\n this.cells.set(key, { digest, at: this.stamp.time });\n }\n\n static #isDigest(text ) {\n return typeof text === 'string' && /^[0-9a-f]{64}$/.test(text);\n }\n\n static #toldFar(one ) {\n const [kind, label, version, digest] = ['kind', 'label', 'version', 'digest'].map((name) =>\n Library.field(one, name),\n );\n if (kind !== 'faculty' && kind !== 'organ') return null;\n if (typeof label !== 'string' || label.length > 64 || !Library.#namedText.test(label)) return null;\n if (typeof version !== 'string' || !Library.#versionText.test(version)) return null;\n return Library.#isDigest(digest) ? { kind, label, version, digest } : null;\n }\n\n *#addFar(asked \n \n \n \n \n \n ) {\n const { road, kind, named, version, second } = asked;\n const placeholder = Library.field(this.cells.get(['far', road]), 'placeholder');\n if (this.#toldRowOf(road, kind, named, version) === undefined && typeof placeholder === 'string')\n yield* this.#asksTold(road, placeholder);\n const toldAt = this.#toldAt(road, kind, named, version);\n if (typeof toldAt === 'string') return this.error('refused', toldAt);\n const got = yield {\n placeholder: toldAt.placeholder,\n method: 'get',\n args: { kind, label: named, version },\n };\n if ('error' in got)\n return this.error('refused', `the far source ${road} answers ${got.error.code}: ${got.error.message}`);\n const at = { lobe: toldAt.placeholder, label: named, version, ...(second ? { second: road } : {}) };\n return yield* this.#takeFar(got.result, toldAt.told, { road, kind, named, version }, at);\n }\n\n #toldRowOf(road , kind , named , version ) {\n return Library.#toldRow(this.cells.get(['told', road, kind, named, version]));\n }\n\n #toldAt(road , kind , named , version ) {\n const told = this.#toldRowOf(road, kind, named, version);\n const placeholder = Library.field(this.cells.get(['far', road]), 'placeholder');\n if (told === undefined || typeof placeholder !== 'string')\n return `the far source ${road} told no ${kind} ${named} ${version}`;\n return { told, placeholder };\n }\n\n *#takeFar(\n answered ,\n told ,\n at \n \n \n \n \n ,\n asked ,\n ) {\n const { road, kind, named, version } = at;\n const from = `${road}@${version}`;\n const [source, graph] = ['source', 'blueprint'].map((one) => Library.field(answered, one));\n const matches = (code , name ) =>\n typeof code === 'string' && Library.digestOf(this.crypto, code) === Library.field(told, name);\n if (kind === 'faculty')\n return matches(source, 'digest')\n ? yield* this.#takeFaculty(\n { ...Library.#only(answered, 'assets'), source, digest: Library.field(told, 'digest') ?? null },\n from,\n asked,\n )\n : this.error('refused', `the source the far source ${road} answered is not the digest it told`);\n if (!matches(graph, 'digest'))\n return this.error('refused', `the organ the far source ${road} answered is not the digests it told`);\n return this.#takeOrgan({ blueprint: graph, half: null }, named, version, from);\n }\n\n static #only(answered , name ) {\n const found = Library.field(answered, name);\n return found === undefined ? {} : { [name]: found };\n }\n\n *changed(args ) {\n const [kind, label, version, digest] = ['kind', 'label', 'version', 'digest'].map((one) =>\n Library.field(args, one),\n );\n const keys = typeof args === 'object' && args !== null ? Object.keys(args).length : 0;\n if (\n (kind !== 'faculty' && kind !== 'organ') ||\n keys !== 4 ||\n typeof label !== 'string' ||\n !Library.#namedText.test(label) ||\n typeof version !== 'string' ||\n !Library.#versionText.test(version) ||\n !Library.#isDigest(digest)\n )\n return this.error('refused', `changed takes a kind, a label, a version and a digest, not ${Library.#sent(args)}`);\n const { asker, occupant } = this.stamp;\n if (occupant !== null && occupant.far === asker) {\n const road = Library.field(occupant.note, 'library');\n if (typeof road !== 'string' || this.cells.get(['far', road]) === undefined)\n return this.error('refused', 'changed comes over an occupant the library gave a far source');\n this.#heard(road, kind, label, version, digest);\n return null;\n }\n if (!Library.#lobeText.test(asker)) return this.error('refused', \"changed is a source's word\");\n const unreached = yield* this.#reach(asker);\n if (unreached !== null) return this.error('refused', unreached);\n this.#heard(asker, kind, label, version, digest);\n return null;\n }\n\n static #unbase64(text ) {\n if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(text)) return null;\n const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n const bytes = [];\n let [word, bits] = [0, 0];\n for (const char of text.replaceAll('=', '')) {\n word = (word << 6) | alphabet.indexOf(char);\n bits += 6;\n if (bits >= 8) {\n bits -= 8;\n bytes.push((word >> bits) & 0xff);\n word &= (1 << bits) - 1;\n }\n }\n return new Uint8Array(bytes);\n }\n\n static #givenAssets(\n crypto ,\n items ,\n ) {\n let source ;\n const bytes = new Map ();\n const assets = [];\n for (const item of items) {\n const sourceText = Library.field(item, 'source');\n if (typeof sourceText === 'string') {\n if (source !== undefined) return 'a faculty given holds one source';\n source = sourceText;\n continue;\n }\n const [path, digest, text, base64] = ['path', 'digest', 'text', 'base64'].map((one) => Library.field(item, one));\n const held =\n typeof text === 'string' ? Library.#utf8(text) : typeof base64 === 'string' ? Library.#unbase64(base64) : null;\n if (typeof path !== 'string' || path === '' || typeof digest !== 'string' || held === null)\n return 'a faculty given holds an asset that is none';\n if (Library.digestOf(crypto, held) !== digest) return `the asset ${path} is not its digest, ${digest}`;\n if (assets.some(([seen]) => seen === path)) return `the asset ${path} is given twice`;\n assets.push([path, digest]);\n bytes.set(digest, held);\n }\n return source === undefined ? 'a faculty given holds its source' : { source, bytes, assets };\n }\n\n *#addGiven(args ) {\n const given = Library.field(args, 'given');\n const [place, digest, items] = ['place', 'digest', 'items'].map((one) => Library.field(given, one));\n if (typeof place !== 'string' || typeof digest !== 'string')\n return this.error('refused', 'a faculty given names its place and its digest');\n const kind = this.cells.get(['source', place]);\n if (kind !== undefined && kind !== 'far')\n return this.error('refused', `the place ${place} is a source of the owners' own, which offers no faculty`);\n if (!Array.isArray(items)) return this.error('refused', 'a faculty given holds its items');\n const taken = Library.#givenAssets(this.crypto, items);\n if (typeof taken === 'string') return this.error('refused', taken);\n const { source, bytes, assets } = taken;\n if (Library.digestOf(this.crypto, source) !== digest)\n return this.error('refused', `the faculty given is not its digest, ${digest}`);\n const blueprint = yield* this.#read(source);\n if (typeof blueprint === 'string') return this.error('refused', blueprint);\n const version = Library.field(blueprint, 'version');\n if (typeof version !== 'string' || !Library.#versionText.test(version))\n return this.error('refused', `a version is three whole numbers joined by dots, not ${Library.#sent(version)}`);\n const road = `${place}@${version}`;\n if (this.cells.get(['faculty', digest]) !== undefined) return this.#reroad(digest, road, version);\n const named = Library.field(blueprint, 'assets');\n if (!(named === undefined && assets.length === 0) && Library.assetsDigest(this.crypto, assets) !== named)\n return this.error('refused', \"the assets given are not the digest the faculty's blueprint names\");\n const sorted = assets.toSorted((one, other) => (one[0] < other[0] ? -1 : 1));\n const refused = Library.keep(\n this.cells,\n digest,\n { source, blueprint, road, ...(named === undefined ? {} : { assets: sorted }) },\n bytes,\n );\n return refused === null ? { digest } : this.error('refused', refused);\n }\n\n *#addHand(args ) {\n const [source, assets, second] = ['source', 'assets', 'second'].map((one) => Library.field(args, one));\n if (typeof source !== 'string' || source === '') return this.error('refused', \"an owner's hand carries a source\");\n if (assets !== undefined && (!Array.isArray(assets) || assets.length > this.#page()))\n return this.error(\n 'refused',\n `assets carried are a list, of as many as a faculty holds, not ${Library.#sent(assets)}`,\n );\n if (second !== undefined && typeof second !== 'boolean')\n return this.error('refused', `\\`second\\` is an owner's word, true or false, not ${Library.#sent(second)}`);\n const taken = Library.#givenAssets(this.crypto, [{ source }, ...(assets ?? [])]);\n if (typeof taken === 'string') return this.error('refused', taken);\n const blueprint = yield* this.#read(source);\n if (typeof blueprint === 'string') return this.error('refused', blueprint);\n const version = Library.field(blueprint, 'version');\n if (typeof version !== 'string' || !Library.#versionText.test(version))\n return this.error('refused', `a version is three whole numbers joined by dots, not ${Library.#sent(version)}`);\n const road = `${Library.#handRoad}@${version}`;\n const digest = Library.digestOf(this.crypto, source);\n if (this.cells.get(['faculty', digest]) !== undefined) return this.#reroad(digest, road, version);\n const named = Library.field(blueprint, 'assets');\n if (named !== undefined && Library.assetsDigest(this.crypto, taken.assets) !== named)\n return this.error('refused', \"the assets carried are not the digest the faculty's blueprint names\");\n const refused = Library.keep(\n this.cells,\n digest,\n {\n source,\n blueprint,\n road,\n ...(named === undefined && taken.assets.length === 0\n ? {}\n : { assets: taken.assets.toSorted((one, other) => (one[0] < other[0] ? -1 : 1)) }),\n ...(second === true ? { second: Library.#handRoad } : {}),\n },\n taken.bytes,\n );\n return refused === null ? { digest } : this.error('refused', refused);\n }\n\n *remove(args ) {\n if (this.stamp.asker !== 'brain')\n return this.error('unavailable', \"the library removes a faculty on the brain's ask alone\");\n const digest = Library.#digestIn(args);\n if (digest === undefined) return this.error('refused', 'remove takes a digest');\n const record = this.cells.get(['faculty', digest]) ?? this.#organAt(digest);\n const blueprint = Library.field(record, 'blueprint');\n const name = Library.field(blueprint, 'name');\n const half = this.cells.get(['half', digest]) !== undefined;\n if (typeof name !== 'string' && !half) return this.error('refused', `the library keeps nothing under ${digest}`);\n const uses = yield {\n placeholder: 'brain',\n method: 'uses',\n args: { digest },\n };\n if ('error' in uses) return this.error(uses.error.code, uses.error.message);\n if (uses.result !== false) return this.error('used', `a lobe or an organ stands on ${digest}`);\n if (typeof name !== 'string') this.cells.delete(['half', digest]);\n else {\n this.cells.delete(['faculty', digest]);\n this.cells.delete(['organ', digest]);\n const held = this.#assetsOf(Library.field(record, 'assets')) ?? [];\n const named = held.length === 0 ? new Set () : this.#assetsNamed();\n for (const [, sha] of held) if (!named.has(sha)) this.cells.delete(['asset', sha]);\n this.cells.delete(['name', name, digest]);\n this.cells.delete(['spared', digest]);\n }\n return null;\n }\n\n spare(args ) {\n if (this.stamp.asker !== Library.#owner)\n return this.error('refused', \"the library spares a version on an owner's ask through the brain alone\");\n const digest = Library.#digestIn(args);\n const spared = Library.field(args, 'spared') ?? true;\n if (digest === undefined || typeof spared !== 'boolean')\n return this.error('refused', 'spare takes a digest, and `spared` where it gives one back');\n if (!this.#keeps(digest)) return this.error('refused', `the library keeps nothing under ${digest}`);\n if (spared) this.cells.set(['spared', digest], true);\n else this.cells.delete(['spared', digest]);\n return null;\n }\n\n #keeps(digest ) {\n return this.cells.get(['faculty', digest]) !== undefined || this.cells.get(['organ', digest]) !== undefined;\n }\n\n static proven(record ) {\n const road = Library.field(record, 'road');\n const taken = typeof road === 'string' && /^(?:hand|[A-Z][A-Z0-9]*)@/u.test(road);\n const assets = Library.field(record, 'assets');\n return (\n !taken || (Array.isArray(assets) && assets.some((one) => Array.isArray(one) && one[0] === Library.#evidence))\n );\n }\n\n #evidenceOf(record ) {\n const carried = this.#assetsOf(Library.field(record, 'assets')) ?? [];\n return carried.find(([path]) => path === Library.#evidence)?.[1] ?? null;\n }\n\n evidence(args ) {\n if (this.stamp.occupant !== null) return this.error('refused', 'evidence is kept from a far asker');\n const digest = Library.field(args, 'faculty');\n const record = Library.#isDigest(digest) ? this.cells.get(['faculty', digest]) : undefined;\n if (record === undefined) return this.error('refused', 'evidence takes the digest of a faculty the library keeps');\n return { evidence: this.#evidenceOf(record) };\n }\n\n old() {\n if (this.stamp.asker !== Library.#owner)\n return this.error('unavailable', 'the library names its old versions to the brain alone');\n return { digests: this.#olderIn() };\n }\n\n #olderIn() {\n const newest = new Map ();\n const older = [];\n let cursor = null;\n do {\n const page = this.cells.range({\n prefix: ['version'],\n limit: this.#page(),\n ...(cursor === null ? {} : { cursor }),\n });\n for (const { key, value } of page.cells) {\n const at = Library.#semver(key[2]);\n if (typeof value !== 'string' || at === null || !this.#keeps(value)) continue;\n const name = String(key[1]);\n const top = newest.get(name);\n if (top === undefined) newest.set(name, { at, digest: value });\n else if (Library.#newer(at, top.at)) {\n older.push(top.digest);\n newest.set(name, { at, digest: value });\n } else older.push(value);\n }\n cursor = page.cursor;\n } while (cursor !== null);\n return older.filter((digest) => this.cells.get(['spared', digest]) === undefined);\n }\n\n static #semver(version ) {\n if (typeof version !== 'string' || !Library.#versionText.test(version)) return null;\n return version.split('.').map(Number);\n }\n\n static #newer(one , other ) {\n for (let at = 0; at < 3; at += 1) if ((one[at] ?? 0) !== (other[at] ?? 0)) return (one[at] ?? 0) > (other[at] ?? 0);\n return false;\n }\n\n get(args ) {\n if (this.stamp.occupant !== null) return this.error('refused', 'get is kept from a far asker');\n const digest = Library.#digestIn(args);\n if (digest === undefined) return this.error('refused', 'get takes a digest');\n return (\n this.cells.get(['faculty', digest]) ??\n this.#organAt(digest) ??\n this.#assetAt(digest) ??\n this.cells.get(['half', digest]) ??\n null\n );\n }\n\n #assetAt(digest ) {\n const kept = this.cells.get(['asset', digest]);\n return kept instanceof Uint8Array ? { digest, bytes: kept } : undefined;\n }\n\n list(args ) {\n if (this.stamp.occupant !== null) return this.error('refused', 'list is kept from a far asker');\n const cursor = Library.field(args, 'cursor') ?? null;\n const most = this.#page();\n const limit = Library.field(args, 'limit') ?? most;\n const told = Library.field(args, 'told') ?? false;\n if (cursor !== null && typeof cursor !== 'string')\n return this.error('refused', `a cursor is a text, or null, not ${Library.#sent(cursor)}`);\n if (typeof limit !== 'number' || !Number.isInteger(limit) || limit < 1 || limit > most)\n return this.error('refused', `a limit is a whole number from 1 to ${most}, not ${Library.#sent(limit)}`);\n if (typeof told !== 'boolean') return this.error('refused', `told is true or false, not ${Library.#sent(told)}`);\n const page = this.cells.range({\n prefix: [told ? 'told' : 'name'],\n limit,\n ...(cursor === null ? {} : { cursor }),\n });\n if (told) return { told: page.cells.map((cell) => this.#told(cell)), cursor: page.cursor };\n const faculties = page.cells.map(({ key, value }) => {\n const digest = String(key[2]);\n const organ = this.#organAt(digest);\n const record = organ ?? this.cells.get(['faculty', digest]);\n const road = Library.field(record, 'road');\n return {\n name: String(key[1]),\n digest,\n ...(typeof value === 'string' ? { label: value } : {}),\n ...(typeof road === 'string' ? { road } : {}),\n ...(organ === undefined ? {} : { kind: 'organ' }),\n ...(this.cells.get(['spared', digest]) === undefined ? {} : { spared: true }),\n ...(organ === undefined && !Library.proven(record) ? { unproven: true } : {}),\n };\n });\n return { faculties, cursor: page.cursor };\n }\n\n #organAt(digest ) {\n const row = this.cells.get(['organ', digest]);\n if (row === undefined) return undefined;\n const record = {};\n for (const field of ['id', 'digest', 'graph', 'blueprint', 'reach', 'half', 'road']) {\n const value = Library.field(row, field);\n if (value !== undefined) record[field] = value;\n }\n return record;\n }\n\n static #toldRow(row ) {\n if (row === undefined) return undefined;\n const [digest, at] = ['digest', 'at'].map((one) => Library.field(row, one));\n return {\n ...(digest === undefined ? {} : { digest }),\n ...(at === undefined ? {} : { at }),\n };\n }\n\n #told({ key, value } ) {\n const row = Library.#toldRow(value) ?? {};\n const { at } = row;\n const { digest } = row;\n const kept =\n typeof digest === 'string' &&\n (this.cells.get(['faculty', digest]) !== undefined || this.cells.get(['organ', digest]) !== undefined);\n const [lobe = '', kind = '', label = '', version = ''] = key.slice(1).map(String);\n return {\n lobe,\n kind,\n label,\n version,\n digest: digest ?? null,\n at: at ?? null,\n kept,\n };\n }\n}";
5754
+ var LIBRARY_TEXT = "class Library extends Faculty {\n static #digest = { type: 'string', pattern: '^[0-9a-f]{64}$' };\n\n static #road = { type: 'string', minLength: 1, maxLength: 256 };\n\n static #assets = {\n type: 'array',\n items: { type: 'array', items: { type: 'string', minLength: 1 }, minItems: 2, maxItems: 2 },\n };\n\n static #faculty = {\n type: 'object',\n properties: {\n source: { type: 'string', minLength: 1 },\n digest: Library.#digest,\n blueprint: { type: 'object' },\n road: Library.#road,\n label: { type: 'string', minLength: 1, maxLength: 64 },\n assets: Library.#assets,\n },\n required: ['source', 'digest', 'blueprint', 'road'],\n additionalProperties: false,\n };\n\n static #organ = {\n type: 'object',\n properties: {\n id: { type: 'string', minLength: 1, maxLength: 64 },\n digest: Library.#digest,\n graph: { type: 'string', minLength: 1 },\n blueprint: { type: 'object' },\n reach: {},\n half: { anyOf: [Library.#digest, { type: 'null' }] },\n road: Library.#road,\n },\n required: ['id', 'digest', 'graph', 'blueprint', 'half', 'road'],\n additionalProperties: false,\n };\n\n static #asset = {\n type: 'object',\n properties: { digest: Library.#digest, bytes: { type: 'string', contentEncoding: 'base16' } },\n required: ['digest', 'bytes'],\n additionalProperties: false,\n };\n\n static #lobe = { type: 'string', pattern: '^[A-Z][A-Z0-9]*$', maxLength: 64 };\n\n static #given = {\n type: 'object',\n properties: {\n kind: { const: 'faculty' },\n given: {\n type: 'object',\n properties: {\n place: Library.#lobe,\n digest: Library.#digest,\n items: { type: 'array', items: { type: 'object' }, maxItems: 1001 },\n },\n required: ['place', 'digest', 'items'],\n additionalProperties: false,\n },\n },\n required: ['kind', 'given'],\n additionalProperties: false,\n };\n\n static #hand = {\n type: 'object',\n properties: {\n source: { type: 'string', minLength: 1 },\n assets: { type: 'array', items: { type: 'object' } },\n second: { type: 'boolean' },\n },\n required: ['source'],\n additionalProperties: false,\n };\n\n static #version = {\n type: 'string',\n pattern: '^(0|[1-9][0-9]*)\\\\.(0|[1-9][0-9]*)\\\\.(0|[1-9][0-9]*)$',\n };\n\n static #named = {\n type: 'string',\n pattern: '^[a-z][a-z0-9]*([.-][a-z0-9]+)*$',\n maxLength: 64,\n };\n\n static #half = {\n type: 'object',\n properties: {\n form: { enum: ['component', 'native'] },\n code: {\n anyOf: [\n { type: 'string', minLength: 1 },\n { type: 'string', contentEncoding: 'base16' },\n ],\n },\n },\n required: ['form', 'code'],\n additionalProperties: false,\n };\n\n static blueprint = {\n name: 'nervur.library',\n version: '0.37.3',\n description:\n \"The library: it keeps the organism's faculties with their assets, and its organs, as data, each version by its digest, and the versions its sources told it.\",\n methods: {\n add: {\n description:\n \"On an owner's ask through the brain alone. From a source, `road`, any lobe of the organism's own whose describe names `get` and `told`: a faculty by its label or an organ by its ID, at a version, read from it over a wire the library orders, its digest checked and its blueprint's version, and kept under the road `<lobe>@<version>`, with that lobe kept as a source of the owners' own where its `state` answers a name, once; a faculty whose blueprint names `assets` has each asset read whole by its path and checked against its SHA-256, and their canonical digest against the blueprint's, or none of it is kept. From a far source, `road`, the library holds a standing on: a faculty or an organ at a version it told, read over the standing, each digest checked against what it told, an organ by its graph.json alone, never its host half, a faculty's assets as from near. Or by an owner's hand, `source`: a faculty's text carried in the ask, with its `assets` where it has any, kept under the road `hand@<version>` by the same walls. Or a host half's form and code under the digest of its code. A code the library keeps already, added from another road, takes that road, all else as it stands; boot's laying changes no road. Answers the digest; refuses a code whose blueprint's name and version the library keeps under another digest, but with `second`, an owner's word on a faculty, which takes it as a name of its own, kept by its source.\",\n kind: 'writing',\n args: {\n anyOf: [\n {\n type: 'object',\n properties: {\n road: Library.#lobe,\n kind: { const: 'faculty' },\n label: Library.#named,\n version: Library.#version,\n second: { type: 'boolean' },\n },\n required: ['road', 'kind', 'label', 'version'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n road: Library.#lobe,\n kind: { const: 'organ' },\n id: Library.#named,\n version: Library.#version,\n },\n required: ['road', 'kind', 'id', 'version'],\n additionalProperties: false,\n },\n Library.#given,\n Library.#hand,\n ],\n },\n result: {\n type: 'object',\n properties: { digest: Library.#digest },\n required: ['digest'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n accept: {\n description:\n \"On an owner's ask through the brain alone: accepts a far source's invitation to a library's standing through the mouth, holding the relation itself on a placeholder of its own. It asks the far lobe at once what it told, `told`, and again at an add of a version not told it yet, since an organism that cannot be dialed can be told nothing. One that can names `tells`: since a relation runs one way, it draws through the ear a standing back on itself for the far lobe, the one before for that far lobe ended, and hands it as `told { tells }`, over which the far lobe tells each version it tells after, `changed`. With `note`, the owner's, which the brain keeps beside the standing, null where none is named. Answers the far organism the brain made up for it, the road an add names it by.\",\n kind: 'writing',\n args: {\n type: 'object',\n properties: { invitation: { type: 'string', minLength: 1 }, note: {}, tells: { const: true } },\n required: ['invitation'],\n additionalProperties: false,\n },\n result: {\n type: 'object',\n properties: { far: Library.#lobe },\n required: ['far'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n changed: {\n description:\n \"A source's word that its `main` holds a faculty or an organ at a version it never told: a near one's over its wire, a far one's over the occupant the library's `accept` gave it, by an ask; kept for the owners to see, by `list` with `told`, never added.\",\n kind: 'writing',\n args: {\n type: 'object',\n properties: {\n kind: { enum: ['faculty', 'organ'] },\n label: Library.#named,\n version: Library.#version,\n digest: Library.#digest,\n },\n required: ['kind', 'label', 'version', 'digest'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n remove: {\n irreversible: true,\n description:\n \"Deletes a version no lobe stands on with its assets no other kept faculty names, an organ's record, or a host half's code no organ names, on the brain's ask alone.\",\n kind: 'writing',\n args: Library.#byDigest(),\n errors: ['refused', 'used'],\n },\n spare: {\n description:\n \"On an owner's ask through the brain alone: keeps a version the library holds from the sweep, or, with `spared: false`, gives it back. An owner may still remove it.\",\n kind: 'writing',\n args: {\n type: 'object',\n properties: { digest: Library.#digest, spared: { type: 'boolean' } },\n required: ['digest'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n evidence: {\n description:\n \"The asset that carries a kept faculty's evidence, `evidence.json`, by its SHA-256, which `get` answers, or null where it carries none; refused to a far asker.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { faculty: Library.#digest },\n required: ['faculty'],\n additionalProperties: false,\n },\n result: {\n type: 'object',\n properties: { evidence: { anyOf: [Library.#digest, { type: 'null' }] } },\n required: ['evidence'],\n additionalProperties: false,\n },\n errors: ['refused'],\n },\n get: {\n description:\n \"The version of a digest with its assets, an organ's record, an asset's bytes, or a host half's form and code, or null; refused to a far asker.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: { digest: Library.#digest },\n required: ['digest'],\n additionalProperties: false,\n },\n result: {\n anyOf: [Library.#faculty, Library.#organ, Library.#asset, Library.#half, { type: 'null' }],\n },\n errors: ['refused'],\n },\n old: {\n description:\n \"The old versions the library keeps, on the brain's ask alone: of each name, a faculty's or an organ's blueprint name, every version but the newest by semver; the brain removes each no lobe stands on.\",\n kind: 'reading',\n args: { type: 'object', additionalProperties: false },\n result: { type: 'object', properties: { digests: { type: 'array', items: { type: 'string' } } } },\n },\n list: {\n description:\n \"The versions kept, by their blueprint's name, each with its road, an organ's marked, one an owner spared marked `spared`, a faculty a source or an owner's hand brought with no evidence marked `unproven`, a page at a time; with `told`, the versions the sources told, each with whether the library keeps it; refused to a far asker.\",\n kind: 'reading',\n args: {\n type: 'object',\n properties: {\n cursor: { anyOf: [{ type: 'string' }, { type: 'null' }] },\n limit: { type: 'integer', minimum: 1 },\n told: { type: 'boolean' },\n },\n additionalProperties: false,\n },\n result: {\n anyOf: [\n {\n type: 'object',\n properties: {\n faculties: { type: 'array', items: { type: 'object' } },\n cursor: { anyOf: [{ type: 'string' }, { type: 'null' }] },\n },\n required: ['faculties', 'cursor'],\n additionalProperties: false,\n },\n {\n type: 'object',\n properties: {\n told: { type: 'array', items: { type: 'object' } },\n cursor: { anyOf: [{ type: 'string' }, { type: 'null' }] },\n },\n required: ['told', 'cursor'],\n additionalProperties: false,\n },\n ],\n },\n errors: ['refused'],\n },\n },\n placeholders: { brain: 'nervur.brain', mouth: 'nervur.mouth', ear: 'nervur.ear' },\n };\n\n static #owner = 'brain';\n\n static #contract = ['get', 'told'];\n\n static #evidence = 'evidence.json';\n\n static #handRoad = 'hand';\n\n static #versionText = /^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$/;\n static #namedText = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/;\n static #lobeText = /^[A-Z][A-Z0-9]*$/;\n\n static #sent(value ) {\n if (value === undefined) return 'nothing';\n const read = JSON.stringify(value);\n return read.length > 64 ? `${read.slice(0, 63)}\u2026` : read;\n }\n\n #page() {\n return Math.min(1000, Math.floor(this.memory / 4 / 1024));\n }\n\n static #byDigest() {\n return {\n type: 'object',\n properties: { digest: Library.#digest },\n required: ['digest'],\n additionalProperties: false,\n };\n }\n\n static #digestIn(args ) {\n const digest = Library.field(args, 'digest');\n return typeof digest === 'string' && /^[0-9a-f]{64}$/.test(digest) ? digest : undefined;\n }\n\n static #utf8(text ) {\n const bytes = [];\n for (const char of text) {\n const point = char.codePointAt(0) ?? 0;\n if (point < 0x80) bytes.push(point);\n else if (point < 0x800) bytes.push(0xc0 | (point >> 6), 0x80 | (point & 0x3f));\n else if (point < 0x10000) bytes.push(0xe0 | (point >> 12), 0x80 | ((point >> 6) & 0x3f), 0x80 | (point & 0x3f));\n else\n bytes.push(\n 0xf0 | (point >> 18),\n 0x80 | ((point >> 12) & 0x3f),\n 0x80 | ((point >> 6) & 0x3f),\n 0x80 | (point & 0x3f),\n );\n }\n return new Uint8Array(bytes);\n }\n\n static digestOf(crypto , code ) {\n return Library.hex(crypto.sha256(typeof code === 'string' ? Library.#utf8(code) : code));\n }\n\n static assetsDigest(\n crypto ,\n assets ,\n ) {\n const sorted = assets.toSorted((one, other) => (one[0] < other[0] ? -1 : 1));\n return Library.digestOf(crypto, JSON.stringify(sorted));\n }\n\n static keep(\n cells ,\n digest ,\n kept ,\n bytes = new Map(),\n ) {\n if (!('source' in kept)) {\n if (cells.get(['half', digest]) === undefined) cells.set(['half', digest], { form: kept.form, code: kept.code });\n return null;\n }\n const { source, blueprint, road, label, assets, second } = kept;\n const name = Library.field(blueprint, 'name');\n if (typeof name !== 'string') throw new TypeError('a version kept is one whose blueprint is named');\n if (cells.get(['faculty', digest]) !== undefined) return null;\n const named = Library.field(blueprint, 'assets') !== undefined;\n if (named !== (assets !== undefined))\n return named\n ? `the blueprint of ${name} names assets the faculty carries not`\n : `${name} carries assets its blueprint names not`;\n for (const [, sha] of assets ?? [])\n if (!bytes.has(sha) && cells.get(['asset', sha]) === undefined)\n return `${name} has no bytes for its asset ${sha}`;\n const indexed = Library.#indexed(cells, name, Library.field(blueprint, 'version'), digest, second);\n if (typeof indexed === 'string') return indexed;\n for (const [, sha] of assets ?? []) {\n const held = bytes.get(sha);\n if (held !== undefined && cells.get(['asset', sha]) === undefined) cells.set(['asset', sha], held);\n }\n cells.set(['faculty', digest], {\n source,\n digest,\n blueprint,\n road,\n ...(label === undefined ? {} : { label }),\n ...(assets === undefined ? {} : { assets: assets.map(([path, sha]) => [path, sha]) }),\n ...(indexed.second === undefined ? {} : { second: indexed.second }),\n });\n cells.set(['name', name, digest], label ?? null);\n return null;\n }\n\n static #indexed(\n cells ,\n name ,\n version ,\n digest ,\n second ,\n ) {\n if (typeof version !== 'string') return `the blueprint of ${name} names no version`;\n const named = cells.get(['version', name, version]);\n if (typeof named !== 'string' || named === digest) {\n cells.set(['version', name, version], digest);\n return {};\n }\n if (second === undefined) return `the library keeps ${name} ${version} under another digest, ${named}`;\n const own = cells.get(['second', name, version, second]);\n if (typeof own === 'string' && own !== digest)\n return `the library keeps ${name} ${version} of ${second} under another digest, ${own}`;\n cells.set(['second', name, version, second], digest);\n return { second };\n }\n\n *add(args ) {\n if (this.stamp.asker !== Library.#owner)\n return this.error('refused', \"the library adds on an owner's ask through the brain alone\");\n if (Library.field(args, 'given') !== undefined) return yield* this.#addGiven(args);\n if (Library.field(args, 'source') !== undefined) return yield* this.#addHand(args);\n return yield* this.#addFrom(args);\n }\n\n *#read(source ) {\n const answered = yield { read: source };\n const read = 'result' in answered ? answered.result : undefined;\n const blueprint = Library.field(read, 'blueprint');\n if (blueprint !== undefined && typeof Library.field(blueprint, 'name') === 'string') return blueprint;\n const why = Library.field(read, 'why');\n return `the source is no faculty: ${typeof why === 'string' ? why : 'it declares no blueprint'}`;\n }\n\n static #fromArgs(\n args ,\n ) {\n const kind = Library.field(args, 'kind');\n const key = kind === 'organ' ? 'id' : 'label';\n const [road, named, version] = ['road', key, 'version'].map((one) => Library.field(args, one));\n const keys = typeof args === 'object' && args !== null ? Object.keys(args).length : 0;\n const second = Library.field(args, 'second');\n if ((kind !== 'faculty' && kind !== 'organ') || keys !== (second === undefined ? 4 : 5))\n return 'add takes a road, a kind, a faculty or an organ, its label or ID, and a version';\n if (second !== undefined && ((second !== true && second !== false) || kind !== 'faculty'))\n return `\\`second\\` is an owner's word on a faculty, true or false, not ${Library.#sent(second)}`;\n if (typeof road !== 'string' || road.length > 64 || !Library.#lobeText.test(road))\n return `a road is a lobe of this organism, by the ID the brain made up for it, not ${Library.#sent(road)}`;\n if (typeof named !== 'string' || named.length > 64 || !Library.#namedText.test(named))\n return `a ${key} is a folder's name, lowercase, not ${Library.#sent(named)}`;\n if (typeof version !== 'string' || !Library.#versionText.test(version))\n return `a version is three whole numbers joined by dots, not ${Library.#sent(version)}`;\n return { road, kind, named, version, second: second === true };\n }\n\n *#addFrom(args ) {\n const asked = Library.#fromArgs(args);\n if (typeof asked === 'string') return this.error('refused', asked);\n if (this.cells.get(['far', asked.road]) !== undefined) return yield* this.#addFar(asked);\n const { road, kind, named, version, second } = asked;\n const unreached = yield* this.#reach(road);\n if (unreached !== null) return this.error('refused', unreached);\n const got = yield {\n placeholder: road,\n method: 'get',\n args: { kind, label: named, version },\n };\n if ('error' in got)\n return this.error('refused', `the source ${road} answers ${got.error.code}: ${got.error.message}`);\n const from = `${road}@${version}`;\n const taken =\n kind === 'organ'\n ? this.#takeOrgan(got.result, named, version, from)\n : yield* this.#takeFaculty(got.result, from, {\n lobe: road,\n label: named,\n version,\n ...(second ? { second: road } : {}),\n });\n if (Library.#added(taken)) yield* this.#kindOf(road);\n return taken;\n }\n\n static #added(taken ) {\n return typeof taken === 'object' && taken !== null && 'digest' in taken;\n }\n\n *#kindOf(lobe ) {\n if (this.cells.get(['source', lobe]) !== undefined) return;\n const state = yield {\n placeholder: lobe,\n method: 'state',\n args: {},\n };\n const name = 'result' in state ? Library.field(state.result, 'name') : undefined;\n if (typeof name === 'string' && name !== '') this.cells.set(['source', lobe], 'owners');\n }\n\n *#reach(lobe ) {\n const order = { termination: lobe };\n const ordered = yield {\n placeholder: 'nerves',\n method: 'order',\n args: { order },\n };\n if ('error' in ordered) return `the library reaches no ${lobe}: ${ordered.error.message}`;\n const described = yield {\n placeholder: lobe,\n method: null,\n args: null,\n };\n const methods = 'result' in described ? Library.field(described.result, 'methods') : undefined;\n const lacking = Library.#contract.filter((method) => Library.field(methods, method) === undefined);\n if (lacking.length === 0) return null;\n yield {\n placeholder: 'nerves',\n method: 'unwire',\n args: { placeholder: lobe },\n };\n return `${lobe} is no source: its describe names no ${lacking.join(' and no ')}`;\n }\n\n *#takeFaculty(answered , road , at ) {\n const { label, version } = at;\n const source = Library.field(answered, 'source');\n const told = Library.field(answered, 'digest');\n if (typeof source !== 'string' || source === '') return this.error('refused', 'the source answered no source');\n const digest = Library.digestOf(this.crypto, source);\n if (told !== digest)\n return this.error('refused', `the source the source answered is not its digest, ${JSON.stringify(told ?? null)}`);\n if (this.cells.get(['faculty', digest]) !== undefined) return this.#reroad(digest, road, version);\n const blueprint = yield* this.#read(source);\n if (typeof blueprint === 'string') return this.error('refused', blueprint);\n const named = Library.field(blueprint, 'version');\n if (named !== version)\n return this.error('refused', `the faculty names version ${JSON.stringify(named ?? null)}, not ${version}`);\n const carried = yield* this.#assetsTaken(answered, blueprint, at);\n if (typeof carried === 'string') return this.error('refused', carried);\n const refused = Library.keep(\n this.cells,\n digest,\n { source, blueprint, road, label, ...carried.kept, ...(at.second === undefined ? {} : { second: at.second }) },\n carried.bytes,\n );\n return refused === null ? { digest } : this.error('refused', refused);\n }\n\n #reroad(digest , road , version ) {\n const kept = this.cells.get(['faculty', digest]);\n const named = Library.field(Library.field(kept, 'blueprint'), 'version');\n if (named !== version)\n return this.error('refused', `the faculty names version ${JSON.stringify(named ?? null)}, not ${version}`);\n if (Library.field(kept, 'road') === road) return { digest };\n const record = {};\n for (const field of ['source', 'digest', 'blueprint', 'label', 'assets', 'second']) {\n const value = Library.field(kept, field);\n if (value !== undefined) record[field] = value;\n }\n this.cells.set(['faculty', digest], { ...record, road });\n return { digest };\n }\n\n *#assetsTaken(\n answered ,\n blueprint ,\n at ,\n ) \n \n \n \n {\n const bytes = new Map ();\n const named = Library.field(blueprint, 'assets');\n const told = Library.field(answered, 'assets');\n if (named === undefined)\n return told === undefined ? { kept: {}, bytes } : 'the source answered assets the blueprint names not';\n const assets = this.#assetsOf(told);\n if (assets === null) return 'the source answered no assets whole: each a path and a SHA-256, one path once';\n if (Library.assetsDigest(this.crypto, assets) !== named)\n return `the assets are not the digest the blueprint names, ${JSON.stringify(named)}`;\n for (const [path, sha] of assets) {\n if (bytes.has(sha) || this.cells.get(['asset', sha]) !== undefined) continue;\n const got = yield {\n placeholder: at.lobe,\n method: 'get',\n args: { kind: 'faculty', label: at.label, version: at.version, path },\n };\n if ('error' in got)\n return `the source ${at.lobe} answers ${got.error.code} for the asset ${path}: ${got.error.message}`;\n const [given, digest, held] = ['path', 'digest', 'bytes'].map((one) => Library.field(got.result, one));\n if (given !== path || digest !== sha || !(held instanceof Uint8Array))\n return `the source answered another asset than ${path}`;\n if (Library.digestOf(this.crypto, held) !== sha) return `the asset ${path} is not its digest, ${sha}`;\n bytes.set(sha, held);\n }\n return { kept: { assets }, bytes };\n }\n\n static #json(text ) {\n try {\n const read = JSON.parse(text);\n return typeof read === 'object' && read !== null && !Array.isArray(read) ? read : null;\n } catch {\n return null;\n }\n }\n\n #takeOrgan(answered , id , version , road ) {\n const graph = Library.field(answered, 'blueprint');\n const half = Library.field(answered, 'half') ?? null;\n if (typeof graph !== 'string') return this.error('refused', \"the source answered no organ's graph.json\");\n if (half !== null && (typeof half !== 'string' || !/^[0-9a-f]{64}$/.test(half)))\n return this.error('refused', 'the source answered a built half that is no digest');\n const read = Library.#json(graph);\n const inner = Library.field(read, 'blueprint');\n const blueprint = inner !== undefined && Library.#json(JSON.stringify(inner)) !== null ? inner : read;\n const name = Library.field(blueprint, 'name');\n const named = Library.field(blueprint, 'version');\n if (blueprint === null || blueprint === undefined || typeof name !== 'string')\n return this.error('refused', 'its graph.json holds no blueprint, named');\n if (named !== version)\n return this.error('refused', `the organ names version ${JSON.stringify(named ?? null)}, not ${version}`);\n const digest = Library.digestOf(this.crypto, graph);\n const kept = this.#organAt(digest);\n if (kept !== undefined) {\n if (half !== null || kept['road'] !== road)\n this.cells.set(['organ', digest], { ...kept, ...(half === null ? {} : { half }), road });\n return { digest };\n }\n const clash = Library.#indexed(this.cells, name, named, digest, undefined);\n if (typeof clash === 'string') return this.error('refused', clash);\n const reach = inner === undefined ? undefined : Library.field(read, 'reach');\n this.cells.set(['organ', digest], {\n id,\n digest,\n graph,\n blueprint,\n ...(reach === undefined ? {} : { reach }),\n half,\n road,\n });\n this.cells.set(['name', name, digest], id);\n return { digest };\n }\n\n #assetsOf(data ) {\n if (!Array.isArray(data) || data.length > this.#page()) return null;\n const assets = [];\n for (const one of data) {\n const [path, sha] = Array.isArray(one) && one.length === 2 ? one : [];\n if (typeof path !== 'string' || path === '') return null;\n if (typeof sha !== 'string' || !/^[0-9a-f]{64}$/.test(sha)) return null;\n assets.push([path, sha]);\n }\n const sorted = assets.toSorted((one, other) => (one[0] < other[0] ? -1 : 1));\n return sorted.every((one, at) => sorted[at - 1]?.[0] !== one[0]) ? sorted : null;\n }\n\n #assetsNamed() {\n const named = new Set ();\n let cursor = null;\n do {\n const page = this.cells.range({\n prefix: ['faculty'],\n limit: this.#page(),\n ...(cursor === null ? {} : { cursor }),\n });\n for (const { value } of page.cells)\n for (const [, sha] of this.#assetsOf(Library.field(value, 'assets')) ?? []) named.add(sha);\n cursor = page.cursor;\n } while (cursor !== null);\n return named;\n }\n\n *accept(args ) {\n if (this.stamp.asker !== Library.#owner)\n return this.error('refused', \"the library accepts a standing on an owner's ask through the brain alone\");\n const invitation = Library.field(args, 'invitation');\n const note = Library.field(args, 'note');\n const keys = typeof args === 'object' && args !== null ? Object.keys(args).length : 0;\n const tells = Library.field(args, 'tells');\n const named = 1 + (note === undefined ? 0 : 1) + (tells === undefined ? 0 : 1);\n if (typeof invitation !== 'string' || invitation === '' || keys !== named || (tells ?? true) !== true)\n return this.error(\n 'refused',\n 'accept takes an invitation, a note where one is named, and `tells` where it can be told',\n );\n const held = this.cells.get(['standings']);\n const count = typeof held === 'number' ? held + 1 : 1;\n this.cells.set(['standings'], count);\n const placeholder = `far-${count}`;\n const accepted = yield* this.#accepted({ invitation, placeholder, note: note ?? null });\n if ('error' in accepted) return this.error('refused', `the mouth accepts no standing: ${accepted.error.message}`);\n const far = Library.field(accepted.result, 'far');\n if (typeof far !== 'string' || !Library.#lobeText.test(far))\n return this.error('refused', 'the mouth named no far organism');\n this.cells.set(['far', far], { placeholder });\n this.cells.set(['source', far], 'far');\n yield* this.#untold(far);\n if (tells === true) yield* this.#tellsBack(far, placeholder);\n else yield* this.#asksTold(far, placeholder);\n return { far };\n }\n\n *#accepted(args ) {\n const answer = yield { placeholder: 'mouth', method: 'accept', args };\n return answer;\n }\n\n *#tellsBack(far , placeholder ) {\n const invited = yield {\n placeholder: 'ear',\n method: 'invite',\n args: { waits: null, lives: null, note: { library: far } },\n };\n const tells = 'result' in invited ? Library.field(invited.result, 'invitation') : undefined;\n const back = 'result' in invited ? Library.field(invited.result, 'far') : undefined;\n if (typeof tells !== 'string') return;\n const asked = yield { placeholder, method: 'told', args: { tells } };\n if ('error' in asked) {\n if (typeof back === 'string') yield { placeholder: 'ear', method: 'drop', args: { far: back } };\n return;\n }\n this.#heardAll(far, asked.result);\n }\n\n *#asksTold(far , placeholder ) {\n const asked = yield { placeholder, method: 'told', args: {} };\n if ('result' in asked) this.#heardAll(far, asked.result);\n }\n\n #heardAll(far , answered ) {\n for (const one of Array.isArray(answered) ? answered.slice(0, this.#page()) : []) {\n const told = Library.#toldFar(one);\n if (told !== null) this.#heard(far, told.kind, told.label, told.version, told.digest);\n }\n }\n\n *#untold(far ) {\n let cursor = null;\n const seen = new Set ();\n const given = [];\n do {\n const page = yield {\n placeholder: 'nerves',\n method: 'relations',\n args: cursor === null ? {} : { cursor },\n };\n if ('error' in page) break;\n const relations = Library.field(page.result, 'relations');\n for (const one of Array.isArray(relations) ? relations : []) {\n const back = Library.field(one, 'far');\n const mine = Library.field(Library.field(one, 'note'), 'library') === far;\n if (Library.field(one, 'side') === 'occupant' && mine && typeof back === 'string') given.push(back);\n }\n const next = Library.field(page.result, 'cursor');\n cursor = typeof next === 'string' && !seen.has(next) ? next : null;\n if (cursor !== null) seen.add(cursor);\n } while (cursor !== null);\n for (const back of given) yield { placeholder: 'ear', method: 'drop', args: { far: back } };\n }\n\n #heard(far , kind , label , version , digest ) {\n const key = ['told', far, kind, label, version];\n if (this.cells.get(key) !== undefined) return;\n const telling = this.cells.get(['telling', far]) ?? { first: 0, next: 0 };\n let first = Number(Library.field(telling, 'first'));\n const next = Number(Library.field(telling, 'next'));\n for (; next - first >= this.#page(); first += 1) {\n const oldest = this.cells.get(['telling', far, first]);\n if (Array.isArray(oldest)) this.cells.delete(oldest);\n this.cells.delete(['telling', far, first]);\n }\n this.cells.set(['telling', far, next], key);\n this.cells.set(['telling', far], { first, next: next + 1 });\n this.cells.set(key, { digest, at: this.stamp.time });\n }\n\n static #isDigest(text ) {\n return typeof text === 'string' && /^[0-9a-f]{64}$/.test(text);\n }\n\n static #toldFar(one ) {\n const [kind, label, version, digest] = ['kind', 'label', 'version', 'digest'].map((name) =>\n Library.field(one, name),\n );\n if (kind !== 'faculty' && kind !== 'organ') return null;\n if (typeof label !== 'string' || label.length > 64 || !Library.#namedText.test(label)) return null;\n if (typeof version !== 'string' || !Library.#versionText.test(version)) return null;\n return Library.#isDigest(digest) ? { kind, label, version, digest } : null;\n }\n\n *#addFar(asked \n \n \n \n \n \n ) {\n const { road, kind, named, version, second } = asked;\n const placeholder = Library.field(this.cells.get(['far', road]), 'placeholder');\n if (this.#toldRowOf(road, kind, named, version) === undefined && typeof placeholder === 'string')\n yield* this.#asksTold(road, placeholder);\n const toldAt = this.#toldAt(road, kind, named, version);\n if (typeof toldAt === 'string') return this.error('refused', toldAt);\n const got = yield {\n placeholder: toldAt.placeholder,\n method: 'get',\n args: { kind, label: named, version },\n };\n if ('error' in got)\n return this.error('refused', `the far source ${road} answers ${got.error.code}: ${got.error.message}`);\n const at = { lobe: toldAt.placeholder, label: named, version, ...(second ? { second: road } : {}) };\n return yield* this.#takeFar(got.result, toldAt.told, { road, kind, named, version }, at);\n }\n\n #toldRowOf(road , kind , named , version ) {\n return Library.#toldRow(this.cells.get(['told', road, kind, named, version]));\n }\n\n #toldAt(road , kind , named , version ) {\n const told = this.#toldRowOf(road, kind, named, version);\n const placeholder = Library.field(this.cells.get(['far', road]), 'placeholder');\n if (told === undefined || typeof placeholder !== 'string')\n return `the far source ${road} told no ${kind} ${named} ${version}`;\n return { told, placeholder };\n }\n\n *#takeFar(\n answered ,\n told ,\n at \n \n \n \n \n ,\n asked ,\n ) {\n const { road, kind, named, version } = at;\n const from = `${road}@${version}`;\n const [source, graph] = ['source', 'blueprint'].map((one) => Library.field(answered, one));\n const matches = (code , name ) =>\n typeof code === 'string' && Library.digestOf(this.crypto, code) === Library.field(told, name);\n if (kind === 'faculty')\n return matches(source, 'digest')\n ? yield* this.#takeFaculty(\n { ...Library.#only(answered, 'assets'), source, digest: Library.field(told, 'digest') ?? null },\n from,\n asked,\n )\n : this.error('refused', `the source the far source ${road} answered is not the digest it told`);\n if (!matches(graph, 'digest'))\n return this.error('refused', `the organ the far source ${road} answered is not the digests it told`);\n return this.#takeOrgan({ blueprint: graph, half: null }, named, version, from);\n }\n\n static #only(answered , name ) {\n const found = Library.field(answered, name);\n return found === undefined ? {} : { [name]: found };\n }\n\n *changed(args ) {\n const [kind, label, version, digest] = ['kind', 'label', 'version', 'digest'].map((one) =>\n Library.field(args, one),\n );\n const keys = typeof args === 'object' && args !== null ? Object.keys(args).length : 0;\n if (\n (kind !== 'faculty' && kind !== 'organ') ||\n keys !== 4 ||\n typeof label !== 'string' ||\n !Library.#namedText.test(label) ||\n typeof version !== 'string' ||\n !Library.#versionText.test(version) ||\n !Library.#isDigest(digest)\n )\n return this.error('refused', `changed takes a kind, a label, a version and a digest, not ${Library.#sent(args)}`);\n const { asker, occupant } = this.stamp;\n if (occupant !== null && occupant.far === asker) {\n const road = Library.field(occupant.note, 'library');\n if (typeof road !== 'string' || this.cells.get(['far', road]) === undefined)\n return this.error('refused', 'changed comes over an occupant the library gave a far source');\n this.#heard(road, kind, label, version, digest);\n return null;\n }\n if (!Library.#lobeText.test(asker)) return this.error('refused', \"changed is a source's word\");\n const unreached = yield* this.#reach(asker);\n if (unreached !== null) return this.error('refused', unreached);\n this.#heard(asker, kind, label, version, digest);\n return null;\n }\n\n static #unbase64(text ) {\n if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(text)) return null;\n const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n const bytes = [];\n let [word, bits] = [0, 0];\n for (const char of text.replaceAll('=', '')) {\n word = (word << 6) | alphabet.indexOf(char);\n bits += 6;\n if (bits >= 8) {\n bits -= 8;\n bytes.push((word >> bits) & 0xff);\n word &= (1 << bits) - 1;\n }\n }\n return new Uint8Array(bytes);\n }\n\n static #givenAssets(\n crypto ,\n items ,\n ) {\n let source ;\n const bytes = new Map ();\n const assets = [];\n for (const item of items) {\n const sourceText = Library.field(item, 'source');\n if (typeof sourceText === 'string') {\n if (source !== undefined) return 'a faculty given holds one source';\n source = sourceText;\n continue;\n }\n const [path, digest, text, base64] = ['path', 'digest', 'text', 'base64'].map((one) => Library.field(item, one));\n const held =\n typeof text === 'string' ? Library.#utf8(text) : typeof base64 === 'string' ? Library.#unbase64(base64) : null;\n if (typeof path !== 'string' || path === '' || typeof digest !== 'string' || held === null)\n return 'a faculty given holds an asset that is none';\n if (Library.digestOf(crypto, held) !== digest) return `the asset ${path} is not its digest, ${digest}`;\n if (assets.some(([seen]) => seen === path)) return `the asset ${path} is given twice`;\n assets.push([path, digest]);\n bytes.set(digest, held);\n }\n return source === undefined ? 'a faculty given holds its source' : { source, bytes, assets };\n }\n\n *#addGiven(args ) {\n const given = Library.field(args, 'given');\n const [place, digest, items] = ['place', 'digest', 'items'].map((one) => Library.field(given, one));\n if (typeof place !== 'string' || typeof digest !== 'string')\n return this.error('refused', 'a faculty given names its place and its digest');\n const kind = this.cells.get(['source', place]);\n if (kind !== undefined && kind !== 'far')\n return this.error('refused', `the place ${place} is a source of the owners' own, which offers no faculty`);\n if (!Array.isArray(items)) return this.error('refused', 'a faculty given holds its items');\n const taken = Library.#givenAssets(this.crypto, items);\n if (typeof taken === 'string') return this.error('refused', taken);\n const { source, bytes, assets } = taken;\n if (Library.digestOf(this.crypto, source) !== digest)\n return this.error('refused', `the faculty given is not its digest, ${digest}`);\n const blueprint = yield* this.#read(source);\n if (typeof blueprint === 'string') return this.error('refused', blueprint);\n const version = Library.field(blueprint, 'version');\n if (typeof version !== 'string' || !Library.#versionText.test(version))\n return this.error('refused', `a version is three whole numbers joined by dots, not ${Library.#sent(version)}`);\n const road = `${place}@${version}`;\n if (this.cells.get(['faculty', digest]) !== undefined) return this.#reroad(digest, road, version);\n const named = Library.field(blueprint, 'assets');\n if (!(named === undefined && assets.length === 0) && Library.assetsDigest(this.crypto, assets) !== named)\n return this.error('refused', \"the assets given are not the digest the faculty's blueprint names\");\n const sorted = assets.toSorted((one, other) => (one[0] < other[0] ? -1 : 1));\n const refused = Library.keep(\n this.cells,\n digest,\n { source, blueprint, road, ...(named === undefined ? {} : { assets: sorted }) },\n bytes,\n );\n return refused === null ? { digest } : this.error('refused', refused);\n }\n\n *#addHand(args ) {\n const [source, assets, second] = ['source', 'assets', 'second'].map((one) => Library.field(args, one));\n if (typeof source !== 'string' || source === '') return this.error('refused', \"an owner's hand carries a source\");\n if (assets !== undefined && (!Array.isArray(assets) || assets.length > this.#page()))\n return this.error(\n 'refused',\n `assets carried are a list, of as many as a faculty holds, not ${Library.#sent(assets)}`,\n );\n if (second !== undefined && typeof second !== 'boolean')\n return this.error('refused', `\\`second\\` is an owner's word, true or false, not ${Library.#sent(second)}`);\n const taken = Library.#givenAssets(this.crypto, [{ source }, ...(assets ?? [])]);\n if (typeof taken === 'string') return this.error('refused', taken);\n const blueprint = yield* this.#read(source);\n if (typeof blueprint === 'string') return this.error('refused', blueprint);\n const version = Library.field(blueprint, 'version');\n if (typeof version !== 'string' || !Library.#versionText.test(version))\n return this.error('refused', `a version is three whole numbers joined by dots, not ${Library.#sent(version)}`);\n const road = `${Library.#handRoad}@${version}`;\n const digest = Library.digestOf(this.crypto, source);\n if (this.cells.get(['faculty', digest]) !== undefined) return this.#reroad(digest, road, version);\n const named = Library.field(blueprint, 'assets');\n if (named !== undefined && Library.assetsDigest(this.crypto, taken.assets) !== named)\n return this.error('refused', \"the assets carried are not the digest the faculty's blueprint names\");\n const refused = Library.keep(\n this.cells,\n digest,\n {\n source,\n blueprint,\n road,\n ...(named === undefined && taken.assets.length === 0\n ? {}\n : { assets: taken.assets.toSorted((one, other) => (one[0] < other[0] ? -1 : 1)) }),\n ...(second === true ? { second: Library.#handRoad } : {}),\n },\n taken.bytes,\n );\n return refused === null ? { digest } : this.error('refused', refused);\n }\n\n *remove(args ) {\n if (this.stamp.asker !== 'brain')\n return this.error('unavailable', \"the library removes a faculty on the brain's ask alone\");\n const digest = Library.#digestIn(args);\n if (digest === undefined) return this.error('refused', 'remove takes a digest');\n const record = this.cells.get(['faculty', digest]) ?? this.#organAt(digest);\n const blueprint = Library.field(record, 'blueprint');\n const name = Library.field(blueprint, 'name');\n const half = this.cells.get(['half', digest]) !== undefined;\n if (typeof name !== 'string' && !half) return this.error('refused', `the library keeps nothing under ${digest}`);\n const uses = yield {\n placeholder: 'brain',\n method: 'uses',\n args: { digest },\n };\n if ('error' in uses) return this.error(uses.error.code, uses.error.message);\n if (uses.result !== false) return this.error('used', `a lobe or an organ stands on ${digest}`);\n if (typeof name !== 'string') this.cells.delete(['half', digest]);\n else {\n this.cells.delete(['faculty', digest]);\n this.cells.delete(['organ', digest]);\n const held = this.#assetsOf(Library.field(record, 'assets')) ?? [];\n const named = held.length === 0 ? new Set () : this.#assetsNamed();\n for (const [, sha] of held) if (!named.has(sha)) this.cells.delete(['asset', sha]);\n this.cells.delete(['name', name, digest]);\n this.cells.delete(['spared', digest]);\n }\n return null;\n }\n\n spare(args ) {\n if (this.stamp.asker !== Library.#owner)\n return this.error('refused', \"the library spares a version on an owner's ask through the brain alone\");\n const digest = Library.#digestIn(args);\n const spared = Library.field(args, 'spared') ?? true;\n if (digest === undefined || typeof spared !== 'boolean')\n return this.error('refused', 'spare takes a digest, and `spared` where it gives one back');\n if (!this.#keeps(digest)) return this.error('refused', `the library keeps nothing under ${digest}`);\n if (spared) this.cells.set(['spared', digest], true);\n else this.cells.delete(['spared', digest]);\n return null;\n }\n\n #keeps(digest ) {\n return this.cells.get(['faculty', digest]) !== undefined || this.cells.get(['organ', digest]) !== undefined;\n }\n\n static proven(record ) {\n const road = Library.field(record, 'road');\n const taken = typeof road === 'string' && /^(?:hand|[A-Z][A-Z0-9]*)@/u.test(road);\n const assets = Library.field(record, 'assets');\n return (\n !taken || (Array.isArray(assets) && assets.some((one) => Array.isArray(one) && one[0] === Library.#evidence))\n );\n }\n\n #evidenceOf(record ) {\n const carried = this.#assetsOf(Library.field(record, 'assets')) ?? [];\n return carried.find(([path]) => path === Library.#evidence)?.[1] ?? null;\n }\n\n evidence(args ) {\n if (this.stamp.occupant !== null) return this.error('refused', 'evidence is kept from a far asker');\n const digest = Library.field(args, 'faculty');\n const record = Library.#isDigest(digest) ? this.cells.get(['faculty', digest]) : undefined;\n if (record === undefined) return this.error('refused', 'evidence takes the digest of a faculty the library keeps');\n return { evidence: this.#evidenceOf(record) };\n }\n\n old() {\n if (this.stamp.asker !== Library.#owner)\n return this.error('unavailable', 'the library names its old versions to the brain alone');\n return { digests: this.#olderIn() };\n }\n\n #olderIn() {\n const newest = new Map ();\n const older = [];\n let cursor = null;\n do {\n const page = this.cells.range({\n prefix: ['version'],\n limit: this.#page(),\n ...(cursor === null ? {} : { cursor }),\n });\n for (const { key, value } of page.cells) {\n const at = Library.#semver(key[2]);\n if (typeof value !== 'string' || at === null || !this.#keeps(value)) continue;\n const name = String(key[1]);\n const top = newest.get(name);\n if (top === undefined) newest.set(name, { at, digest: value });\n else if (Library.#newer(at, top.at)) {\n older.push(top.digest);\n newest.set(name, { at, digest: value });\n } else older.push(value);\n }\n cursor = page.cursor;\n } while (cursor !== null);\n return older.filter((digest) => this.cells.get(['spared', digest]) === undefined);\n }\n\n static #semver(version ) {\n if (typeof version !== 'string' || !Library.#versionText.test(version)) return null;\n return version.split('.').map(Number);\n }\n\n static #newer(one , other ) {\n for (let at = 0; at < 3; at += 1) if ((one[at] ?? 0) !== (other[at] ?? 0)) return (one[at] ?? 0) > (other[at] ?? 0);\n return false;\n }\n\n get(args ) {\n if (this.stamp.occupant !== null) return this.error('refused', 'get is kept from a far asker');\n const digest = Library.#digestIn(args);\n if (digest === undefined) return this.error('refused', 'get takes a digest');\n return (\n this.cells.get(['faculty', digest]) ??\n this.#organAt(digest) ??\n this.#assetAt(digest) ??\n this.cells.get(['half', digest]) ??\n null\n );\n }\n\n #assetAt(digest ) {\n const kept = this.cells.get(['asset', digest]);\n return kept instanceof Uint8Array ? { digest, bytes: kept } : undefined;\n }\n\n list(args ) {\n if (this.stamp.occupant !== null) return this.error('refused', 'list is kept from a far asker');\n const cursor = Library.field(args, 'cursor') ?? null;\n const most = this.#page();\n const limit = Library.field(args, 'limit') ?? most;\n const told = Library.field(args, 'told') ?? false;\n if (cursor !== null && typeof cursor !== 'string')\n return this.error('refused', `a cursor is a text, or null, not ${Library.#sent(cursor)}`);\n if (typeof limit !== 'number' || !Number.isInteger(limit) || limit < 1 || limit > most)\n return this.error('refused', `a limit is a whole number from 1 to ${most}, not ${Library.#sent(limit)}`);\n if (typeof told !== 'boolean') return this.error('refused', `told is true or false, not ${Library.#sent(told)}`);\n const page = this.cells.range({\n prefix: [told ? 'told' : 'name'],\n limit,\n ...(cursor === null ? {} : { cursor }),\n });\n if (told) return { told: page.cells.map((cell) => this.#told(cell)), cursor: page.cursor };\n const faculties = page.cells.map(({ key, value }) => {\n const digest = String(key[2]);\n const organ = this.#organAt(digest);\n const record = organ ?? this.cells.get(['faculty', digest]);\n const road = Library.field(record, 'road');\n return {\n name: String(key[1]),\n digest,\n ...(typeof value === 'string' ? { label: value } : {}),\n ...(typeof road === 'string' ? { road } : {}),\n ...(organ === undefined ? {} : { kind: 'organ' }),\n ...(this.cells.get(['spared', digest]) === undefined ? {} : { spared: true }),\n ...(organ === undefined && !Library.proven(record) ? { unproven: true } : {}),\n };\n });\n return { faculties, cursor: page.cursor };\n }\n\n #organAt(digest ) {\n const row = this.cells.get(['organ', digest]);\n if (row === undefined) return undefined;\n const record = {};\n for (const field of ['id', 'digest', 'graph', 'blueprint', 'reach', 'half', 'road']) {\n const value = Library.field(row, field);\n if (value !== undefined) record[field] = value;\n }\n return record;\n }\n\n static #toldRow(row ) {\n if (row === undefined) return undefined;\n const [digest, at] = ['digest', 'at'].map((one) => Library.field(row, one));\n return {\n ...(digest === undefined ? {} : { digest }),\n ...(at === undefined ? {} : { at }),\n };\n }\n\n #told({ key, value } ) {\n const row = Library.#toldRow(value) ?? {};\n const { at } = row;\n const { digest } = row;\n const kept =\n typeof digest === 'string' &&\n (this.cells.get(['faculty', digest]) !== undefined || this.cells.get(['organ', digest]) !== undefined);\n const [lobe = '', kind = '', label = '', version = ''] = key.slice(1).map(String);\n return {\n lobe,\n kind,\n label,\n version,\n digest: digest ?? null,\n at: at ?? null,\n kept,\n };\n }\n}";
5755
5755
 
5756
5756
  var LIBRARY_SOURCE = facultySource(LIBRARY_TEXT);
5757
5757
 
5758
5758
  var SCHEDULER_BLUEPRINT = {
5759
5759
  name: "nervur.scheduler",
5760
- version: "0.37.1",
5760
+ version: "0.37.3",
5761
5761
  description: "The scheduler: every lobe's alarms, over the brain's one durable wake.",
5762
5762
  methods: {
5763
5763
  set: {
@@ -5841,7 +5841,7 @@ var SCHEDULER_BLUEPRINT = {
5841
5841
  placeholders: { brain: "nervur.brain", cage: "nervur.cage" }
5842
5842
  };
5843
5843
 
5844
- var SCHEDULER_TEXT = "class Scheduler extends Faculty {\n static #count = { type: 'integer', minimum: 0 };\n\n static #cursor = { anyOf: [{ type: 'string' }, { type: 'null' }] };\n\n static #object(properties , required ) {\n return { type: 'object', properties, required, additionalProperties: false };\n }\n\n static blueprint = {\n name: 'nervur.scheduler',\n version: '0.37.1',\n description: \"The scheduler: every lobe's alarms, over the brain's one durable wake.\",\n methods: {\n set: {\n description:\n \"Keeps an alarm of the asker's: when, on the wall clock, which of its methods to ring, and its args. Answers the alarm's ID.\",\n kind: 'writing',\n args: Scheduler.#object({ at: Scheduler.#count, method: { type: 'string', minLength: 1 }, args: {} }, [\n 'at',\n 'method',\n ]),\n result: Scheduler.#object({ id: Scheduler.#count }, ['id']),\n errors: ['refused'],\n },\n cancel: {\n description:\n \"Removes an alarm of the asker's, by its ID; asked by the brain for an owner, an alarm of the lobe it names.\",\n kind: 'writing',\n args: Scheduler.#object({ id: Scheduler.#count, lobe: { type: 'string', minLength: 1 } }, ['id']),\n result: { type: 'null' },\n errors: ['refused'],\n },\n list: {\n description:\n \"The asker's own alarms, never another lobe's, a page at a time: `limit` of them, as many as a part of what this lobe holds at most where it names none, and never more.\",\n kind: 'reading',\n args: Scheduler.#object({ cursor: Scheduler.#cursor, limit: { type: 'integer', minimum: 1 } }, []),\n result: Scheduler.#object(\n {\n alarms: {\n type: 'array',\n items: Scheduler.#object(\n {\n id: Scheduler.#count,\n at: Scheduler.#count,\n method: { type: 'string' },\n args: {},\n },\n ['id', 'at', 'method', 'args'],\n ),\n },\n cursor: Scheduler.#cursor,\n },\n ['alarms', 'cursor'],\n ),\n errors: ['refused'],\n },\n now: {\n description: 'The time, on the wall clock, for a lobe deep in a long ask.',\n kind: 'reading',\n result: { type: 'number' },\n },\n wake: {\n askers: ['brain'],\n args: Scheduler.#object({}, []),\n description:\n \"The brain's alone, when its wake is due: ends every alarm due and posts its ring, a letter to its lobe, in this answer's batch, and waits on no lobe. One whose lobe is torn down ends unrung. Then it asks the brain the next wake.\",\n kind: 'writing',\n result: { type: 'null' },\n },\n },\n placeholders: { brain: 'nervur.brain', cage: 'nervur.cage' },\n };\n\n static #lives = Math.floor(Number.MAX_SAFE_INTEGER / 2);\n\n static #rings = 20;\n\n #page() {\n return Math.min(1000, Math.floor(this.memory / 4 / 1024));\n }\n\n static #sent(value ) {\n if (value === undefined) return 'nothing';\n const read = JSON.stringify(value);\n return read.length > 64 ? `${read.slice(0, 63)}\u2026` : read;\n }\n\n static #isCount(value ) {\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;\n }\n\n static #ask(placeholder , method , args ) {\n return { placeholder, method, args };\n }\n\n #earliest(limit ) {\n return this.cells.range({ prefix: ['due'], limit }).cells.map(({ key }) => {\n const [, at, lobe, id] = key;\n if (typeof at !== 'number' || typeof lobe !== 'string' || typeof id !== 'number')\n throw new TypeError(`the row ${JSON.stringify(key)} is no alarm's`);\n const kept = this.cells.get(['alarm', lobe, id]);\n const method = Scheduler.field(kept, 'method');\n if (typeof method !== 'string') throw new TypeError(`the alarm ${id} of ${lobe} is not kept`);\n return { lobe, id, at, method, args: Scheduler.field(kept, 'args') ?? null };\n });\n }\n\n #holds(lobe ) {\n return this.cells.range({ prefix: ['alarm', lobe], limit: 1 }).cells.length > 0;\n }\n\n #remove(lobe , id , at ) {\n this.cells.delete(['alarm', lobe, id]);\n this.cells.delete(['due', at, lobe, id]);\n }\n\n #coming(asked ) {\n return Scheduler.#isCount(asked) && asked > this.stamp.time;\n }\n\n *#wakeAt(at ) {\n const asked = yield Scheduler.#ask('brain', 'wake', { at });\n if ('result' in asked) this.cells.set(['wake'], at);\n return asked;\n }\n\n *#unwire(lobe ) {\n yield Scheduler.#ask('nerves', 'unwire', { placeholder: lobe });\n return null;\n }\n\n *#ring(lobe , method , args ) {\n const ring = { ...Scheduler.#ask(lobe, method, args), letter: { lives: Scheduler.#lives } };\n const rang = yield ring;\n if (!('error' in rang) || rang.error.code !== 'unavailable') return rang;\n const ordered = yield Scheduler.#ask('nerves', 'order', { order: { termination: lobe } });\n return 'error' in ordered ? rang : yield ring;\n }\n\n *set(args ) {\n const { asker } = this.stamp;\n if (asker === 'brain')\n return this.error('refused', 'the scheduler keeps the alarms of lobes, and the brain is none');\n const at = Scheduler.field(args, 'at');\n const method = Scheduler.field(args, 'method');\n if (!Scheduler.#isCount(at))\n return this.error(\n 'refused',\n `at is a time on the wall clock, whole milliseconds from 0, not ${Scheduler.#sent(at)}`,\n );\n if (typeof method !== 'string' || method === '')\n return this.error('refused', `method is the name of one of your methods, not ${Scheduler.#sent(method)}`);\n if (!this.#holds(asker)) {\n const ordered = yield Scheduler.#ask('nerves', 'order', {\n order: { termination: asker },\n });\n if ('error' in ordered) return this.error(ordered.error.code, ordered.error.message);\n }\n const next = this.cells.get(['next']);\n const id = (Scheduler.#isCount(next) ? next : 0) + 1;\n this.cells.set(['next'], id);\n const given = Scheduler.field(args, 'args');\n this.cells.set(['alarm', asker, id], { at, method, args: given === undefined ? {} : given });\n this.cells.set(['due', at, asker, id], null);\n const asked = this.cells.get(['wake']);\n if (this.#coming(asked) && asked <= at) return { id };\n const woken = yield* this.#wakeAt(this.#earliest(1)[0]?.at ?? at);\n return 'error' in woken ? this.error(woken.error.code, woken.error.message) : { id };\n }\n\n *cancel(args ) {\n const { asker } = this.stamp;\n const lobe = asker === 'brain' ? Scheduler.field(args, 'lobe') : asker;\n const id = Scheduler.field(args, 'id');\n if (typeof lobe !== 'string') return this.error('refused', 'an owner names the lobe whose alarm ends');\n const kept = Scheduler.#isCount(id) ? this.cells.get(['alarm', lobe, id]) : undefined;\n const at = Scheduler.field(kept, 'at');\n if (!Scheduler.#isCount(id) || !Scheduler.#isCount(at))\n return this.error('refused', `${lobe} holds no alarm ${JSON.stringify(id ?? null)}`);\n this.#remove(lobe, id, at);\n if (!this.#holds(lobe)) yield* this.#unwire(lobe);\n const first = this.#earliest(1)[0]?.at ?? null;\n const asked = this.cells.get(['wake']);\n if (!Scheduler.#isCount(asked) || (this.#coming(asked) && first !== null && first <= asked)) return null;\n const woken = yield* this.#wakeAt(first);\n return 'error' in woken ? this.error(woken.error.code, woken.error.message) : null;\n }\n\n list(args ) {\n const cursor = Scheduler.field(args, 'cursor') ?? null;\n const most = this.#page();\n const limit = Scheduler.field(args, 'limit') ?? most;\n if (cursor !== null && typeof cursor !== 'string')\n return this.error('refused', `a cursor is a text, or null, not ${Scheduler.#sent(cursor)}`);\n if (!Scheduler.#isCount(limit) || limit < 1 || limit > most)\n return this.error('refused', `a limit is a whole number from 1 to ${most}, not ${Scheduler.#sent(limit)}`);\n const prefix = ['alarm', this.stamp.asker];\n const page = this.cells.range({ prefix, limit, ...(cursor === null ? {} : { cursor }) });\n const alarms = page.cells.map(({ key, value }) => ({\n id: key[2] ?? null,\n at: Scheduler.field(value, 'at') ?? null,\n method: Scheduler.field(value, 'method') ?? null,\n args: Scheduler.field(value, 'args') ?? null,\n }));\n return { alarms, cursor: page.cursor };\n }\n\n now() {\n return this.stamp.time;\n }\n\n *wake() {\n const now = this.stamp.time;\n const due = this.#earliest(Scheduler.#rings + 1).filter((alarm) => alarm.at <= now);\n const ringing = due.slice(0, Scheduler.#rings);\n const touched = new Set ();\n for (const { lobe, id, at, method, args } of ringing) {\n const rang = yield* this.#ring(lobe, method, args);\n if ('error' in rang && rang.error.code !== 'unavailable') continue;\n this.#remove(lobe, id, at);\n touched.add(lobe);\n }\n for (const lobe of touched) if (!this.#holds(lobe)) yield* this.#unwire(lobe);\n const later = this.#earliest(Scheduler.#rings + 1).find((alarm) => alarm.at > now);\n const times = [...(due.length > ringing.length ? [now] : []), ...(later === undefined ? [] : [later.at])];\n yield* this.#wakeAt(times.length === 0 ? null : Math.min(...times));\n return null;\n }\n}";
5844
+ var SCHEDULER_TEXT = "class Scheduler extends Faculty {\n static #count = { type: 'integer', minimum: 0 };\n\n static #cursor = { anyOf: [{ type: 'string' }, { type: 'null' }] };\n\n static #object(properties , required ) {\n return { type: 'object', properties, required, additionalProperties: false };\n }\n\n static blueprint = {\n name: 'nervur.scheduler',\n version: '0.37.3',\n description: \"The scheduler: every lobe's alarms, over the brain's one durable wake.\",\n methods: {\n set: {\n description:\n \"Keeps an alarm of the asker's: when, on the wall clock, which of its methods to ring, and its args. Answers the alarm's ID.\",\n kind: 'writing',\n args: Scheduler.#object({ at: Scheduler.#count, method: { type: 'string', minLength: 1 }, args: {} }, [\n 'at',\n 'method',\n ]),\n result: Scheduler.#object({ id: Scheduler.#count }, ['id']),\n errors: ['refused'],\n },\n cancel: {\n description:\n \"Removes an alarm of the asker's, by its ID; asked by the brain for an owner, an alarm of the lobe it names.\",\n kind: 'writing',\n args: Scheduler.#object({ id: Scheduler.#count, lobe: { type: 'string', minLength: 1 } }, ['id']),\n result: { type: 'null' },\n errors: ['refused'],\n },\n list: {\n description:\n \"The asker's own alarms, never another lobe's, a page at a time: `limit` of them, as many as a part of what this lobe holds at most where it names none, and never more.\",\n kind: 'reading',\n args: Scheduler.#object({ cursor: Scheduler.#cursor, limit: { type: 'integer', minimum: 1 } }, []),\n result: Scheduler.#object(\n {\n alarms: {\n type: 'array',\n items: Scheduler.#object(\n {\n id: Scheduler.#count,\n at: Scheduler.#count,\n method: { type: 'string' },\n args: {},\n },\n ['id', 'at', 'method', 'args'],\n ),\n },\n cursor: Scheduler.#cursor,\n },\n ['alarms', 'cursor'],\n ),\n errors: ['refused'],\n },\n now: {\n description: 'The time, on the wall clock, for a lobe deep in a long ask.',\n kind: 'reading',\n result: { type: 'number' },\n },\n wake: {\n askers: ['brain'],\n args: Scheduler.#object({}, []),\n description:\n \"The brain's alone, when its wake is due: ends every alarm due and posts its ring, a letter to its lobe, in this answer's batch, and waits on no lobe. One whose lobe is torn down ends unrung. Then it asks the brain the next wake.\",\n kind: 'writing',\n result: { type: 'null' },\n },\n },\n placeholders: { brain: 'nervur.brain', cage: 'nervur.cage' },\n };\n\n static #lives = Math.floor(Number.MAX_SAFE_INTEGER / 2);\n\n static #rings = 20;\n\n #page() {\n return Math.min(1000, Math.floor(this.memory / 4 / 1024));\n }\n\n static #sent(value ) {\n if (value === undefined) return 'nothing';\n const read = JSON.stringify(value);\n return read.length > 64 ? `${read.slice(0, 63)}\u2026` : read;\n }\n\n static #isCount(value ) {\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;\n }\n\n static #ask(placeholder , method , args ) {\n return { placeholder, method, args };\n }\n\n #earliest(limit ) {\n return this.cells.range({ prefix: ['due'], limit }).cells.map(({ key }) => {\n const [, at, lobe, id] = key;\n if (typeof at !== 'number' || typeof lobe !== 'string' || typeof id !== 'number')\n throw new TypeError(`the row ${JSON.stringify(key)} is no alarm's`);\n const kept = this.cells.get(['alarm', lobe, id]);\n const method = Scheduler.field(kept, 'method');\n if (typeof method !== 'string') throw new TypeError(`the alarm ${id} of ${lobe} is not kept`);\n return { lobe, id, at, method, args: Scheduler.field(kept, 'args') ?? null };\n });\n }\n\n #holds(lobe ) {\n return this.cells.range({ prefix: ['alarm', lobe], limit: 1 }).cells.length > 0;\n }\n\n #remove(lobe , id , at ) {\n this.cells.delete(['alarm', lobe, id]);\n this.cells.delete(['due', at, lobe, id]);\n }\n\n #coming(asked ) {\n return Scheduler.#isCount(asked) && asked > this.stamp.time;\n }\n\n *#wakeAt(at ) {\n const asked = yield Scheduler.#ask('brain', 'wake', { at });\n if ('result' in asked) this.cells.set(['wake'], at);\n return asked;\n }\n\n *#unwire(lobe ) {\n yield Scheduler.#ask('nerves', 'unwire', { placeholder: lobe });\n return null;\n }\n\n *#ring(lobe , method , args ) {\n const ring = { ...Scheduler.#ask(lobe, method, args), letter: { lives: Scheduler.#lives } };\n const rang = yield ring;\n if (!('error' in rang) || rang.error.code !== 'unavailable') return rang;\n const ordered = yield Scheduler.#ask('nerves', 'order', { order: { termination: lobe } });\n return 'error' in ordered ? rang : yield ring;\n }\n\n *set(args ) {\n const { asker } = this.stamp;\n if (asker === 'brain')\n return this.error('refused', 'the scheduler keeps the alarms of lobes, and the brain is none');\n const at = Scheduler.field(args, 'at');\n const method = Scheduler.field(args, 'method');\n if (!Scheduler.#isCount(at))\n return this.error(\n 'refused',\n `at is a time on the wall clock, whole milliseconds from 0, not ${Scheduler.#sent(at)}`,\n );\n if (typeof method !== 'string' || method === '')\n return this.error('refused', `method is the name of one of your methods, not ${Scheduler.#sent(method)}`);\n if (!this.#holds(asker)) {\n const ordered = yield Scheduler.#ask('nerves', 'order', {\n order: { termination: asker },\n });\n if ('error' in ordered) return this.error(ordered.error.code, ordered.error.message);\n }\n const next = this.cells.get(['next']);\n const id = (Scheduler.#isCount(next) ? next : 0) + 1;\n this.cells.set(['next'], id);\n const given = Scheduler.field(args, 'args');\n this.cells.set(['alarm', asker, id], { at, method, args: given === undefined ? {} : given });\n this.cells.set(['due', at, asker, id], null);\n const asked = this.cells.get(['wake']);\n if (this.#coming(asked) && asked <= at) return { id };\n const woken = yield* this.#wakeAt(this.#earliest(1)[0]?.at ?? at);\n return 'error' in woken ? this.error(woken.error.code, woken.error.message) : { id };\n }\n\n *cancel(args ) {\n const { asker } = this.stamp;\n const lobe = asker === 'brain' ? Scheduler.field(args, 'lobe') : asker;\n const id = Scheduler.field(args, 'id');\n if (typeof lobe !== 'string') return this.error('refused', 'an owner names the lobe whose alarm ends');\n const kept = Scheduler.#isCount(id) ? this.cells.get(['alarm', lobe, id]) : undefined;\n const at = Scheduler.field(kept, 'at');\n if (!Scheduler.#isCount(id) || !Scheduler.#isCount(at))\n return this.error('refused', `${lobe} holds no alarm ${JSON.stringify(id ?? null)}`);\n this.#remove(lobe, id, at);\n if (!this.#holds(lobe)) yield* this.#unwire(lobe);\n const first = this.#earliest(1)[0]?.at ?? null;\n const asked = this.cells.get(['wake']);\n if (!Scheduler.#isCount(asked) || (this.#coming(asked) && first !== null && first <= asked)) return null;\n const woken = yield* this.#wakeAt(first);\n return 'error' in woken ? this.error(woken.error.code, woken.error.message) : null;\n }\n\n list(args ) {\n const cursor = Scheduler.field(args, 'cursor') ?? null;\n const most = this.#page();\n const limit = Scheduler.field(args, 'limit') ?? most;\n if (cursor !== null && typeof cursor !== 'string')\n return this.error('refused', `a cursor is a text, or null, not ${Scheduler.#sent(cursor)}`);\n if (!Scheduler.#isCount(limit) || limit < 1 || limit > most)\n return this.error('refused', `a limit is a whole number from 1 to ${most}, not ${Scheduler.#sent(limit)}`);\n const prefix = ['alarm', this.stamp.asker];\n const page = this.cells.range({ prefix, limit, ...(cursor === null ? {} : { cursor }) });\n const alarms = page.cells.map(({ key, value }) => ({\n id: key[2] ?? null,\n at: Scheduler.field(value, 'at') ?? null,\n method: Scheduler.field(value, 'method') ?? null,\n args: Scheduler.field(value, 'args') ?? null,\n }));\n return { alarms, cursor: page.cursor };\n }\n\n now() {\n return this.stamp.time;\n }\n\n *wake() {\n const now = this.stamp.time;\n const due = this.#earliest(Scheduler.#rings + 1).filter((alarm) => alarm.at <= now);\n const ringing = due.slice(0, Scheduler.#rings);\n const touched = new Set ();\n for (const { lobe, id, at, method, args } of ringing) {\n const rang = yield* this.#ring(lobe, method, args);\n if ('error' in rang && rang.error.code !== 'unavailable') continue;\n this.#remove(lobe, id, at);\n touched.add(lobe);\n }\n for (const lobe of touched) if (!this.#holds(lobe)) yield* this.#unwire(lobe);\n const later = this.#earliest(Scheduler.#rings + 1).find((alarm) => alarm.at > now);\n const times = [...(due.length > ringing.length ? [now] : []), ...(later === undefined ? [] : [later.at])];\n yield* this.#wakeAt(times.length === 0 ? null : Math.min(...times));\n return null;\n }\n}";
5845
5845
 
5846
5846
  var SCHEDULER_SOURCE = facultySource(SCHEDULER_TEXT);
5847
5847
 
@@ -11366,8 +11366,8 @@ var makeKept = (engine, memory, code2) => {
11366
11366
  if (found !== void 0) return found;
11367
11367
  const source = code2(digest);
11368
11368
  if (source === null) throw new Error(`the faculty ${digest} is not kept`);
11369
- const refused15 = keep4(digest, source);
11370
- if (refused15 !== null) throw new Error(`the faculty ${digest} does not compile: ${refused15.why}`);
11369
+ const refused16 = keep4(digest, source);
11370
+ if (refused16 !== null) throw new Error(`the faculty ${digest} does not compile: ${refused16.why}`);
11371
11371
  const modules = kept3.get(digest);
11372
11372
  if (modules === void 0) throw new Error(`the faculty ${digest} is not kept`);
11373
11373
  return modules;
@@ -12410,12 +12410,12 @@ var shaped = (part, kinds) => (_cells, key2) => {
12410
12410
  throw new Error(`${part}: the row ${JSON.stringify(key2)} is not as the ${part} wrote it.`);
12411
12411
  };
12412
12412
  var putRow = (cells, key2, value, part) => {
12413
- const refused15 = cells.set(key2, value);
12414
- if (refused15 !== null) throw new Error(`${part}: the row ${key2.join(" ")} is not written: ${refused15.why}`);
12413
+ const refused16 = cells.set(key2, value);
12414
+ if (refused16 !== null) throw new Error(`${part}: the row ${key2.join(" ")} is not written: ${refused16.why}`);
12415
12415
  };
12416
12416
  var dropRow = (cells, key2, part) => {
12417
- const refused15 = cells.delete(key2);
12418
- if (refused15 !== null) throw new Error(`${part}: the row ${key2.join(" ")} is not dropped: ${refused15.why}`);
12417
+ const refused16 = cells.delete(key2);
12418
+ if (refused16 !== null) throw new Error(`${part}: the row ${key2.join(" ")} is not dropped: ${refused16.why}`);
12419
12419
  };
12420
12420
  var eachRow = (cells, rows, part, visit) => {
12421
12421
  for (let cursor; ; ) {
@@ -12678,8 +12678,8 @@ var prepare = ({ host, handle, statements }, sql) => {
12678
12678
  var step2 = (connection, statement, params, keep4) => {
12679
12679
  const { host, handle } = connection;
12680
12680
  for (const [at, value] of params.entries()) {
12681
- const refused15 = bindOne(connection, statement, at + 1, value);
12682
- if (refused15 !== null) return refused15;
12681
+ const refused16 = bindOne(connection, statement, at + 1, value);
12682
+ if (refused16 !== null) return refused16;
12683
12683
  }
12684
12684
  const width = host.exports.num("sqlite3_column_count", [statement]);
12685
12685
  const rows = [];
@@ -12842,8 +12842,8 @@ var makeImports = (module, gear, memory) => {
12842
12842
  continue;
12843
12843
  }
12844
12844
  const wasiCall = one.module === "wasi_snapshot_preview1";
12845
- const refused15 = () => wasiCall ? NO_SUCH_CALL : -NO_SUCH_CALL;
12846
- const answer = answers[one.name] ?? (wasiCall || NO_FILES.test(one.name) ? refused15 : void 0);
12845
+ const refused16 = () => wasiCall ? NO_SUCH_CALL : -NO_SUCH_CALL;
12846
+ const answer = answers[one.name] ?? (wasiCall || NO_FILES.test(one.name) ? refused16 : void 0);
12847
12847
  if (answer === void 0 || one.module !== "env" && !wasiCall) {
12848
12848
  throw new Error(`The build imports ${one.module}.${one.name}, which no answer is written for.`);
12849
12849
  }
@@ -13209,8 +13209,8 @@ var ioEntries = (memory, table, kept3) => {
13209
13209
  }),
13210
13210
  entry("xWrite", "i(iiij)", (file, buffer, amount2, offset) => {
13211
13211
  if (kept3() || !isCount(offset) || !isCount(amount2)) return SQLITE_IOERR_WRITE;
13212
- const refused15 = fileOf3(file).write(offset, memory.read(buffer, amount2));
13213
- return refused15 === null ? SQLITE_OK : SQLITE_IOERR_WRITE;
13212
+ const refused16 = fileOf3(file).write(offset, memory.read(buffer, amount2));
13213
+ return refused16 === null ? SQLITE_OK : SQLITE_IOERR_WRITE;
13214
13214
  }),
13215
13215
  cutEntry(memory, table, kept3),
13216
13216
  entry("xSync", "i(ii)", (file) => {
@@ -14303,7 +14303,7 @@ var SET_SEQUENCE = "insert or replace into sequence (id, last) values (1, ?)";
14303
14303
  var GET = "select value from cells where key = ?";
14304
14304
  var COUNT2 = "select count(*) from cells where key >= ? and key < ?";
14305
14305
  var NTH = "select key from cells where key >= ? and key < ? order by key limit 1 offset ?";
14306
- var OUTSIDE = "select value from cells not indexed where value >= x'00' and value < x'01'";
14306
+ var OUTSIDE = "select value from cells where value >= x'00' and value < x'01'";
14307
14307
  var REFERENCE2 = "select value from cells where key = ? and value >= x'00' and value < x'01'";
14308
14308
  var NAMED = "select 1 from cells where value = ? and value >= x'00' and value < x'01' limit 1";
14309
14309
  var WEIGHT = "select length(key) + length(value), case when value >= x'00' and value < x'01' then value end from cells where key = ?";
@@ -14472,6 +14472,7 @@ var namedOut = (db) => {
14472
14472
  return named6;
14473
14473
  };
14474
14474
  var swept = (outside2, named6) => {
14475
+ if (named6 === null) return;
14475
14476
  for (const file of outside2.pages.list(OUT))
14476
14477
  if (!named6.has(file) && !outside2.laid.has(file)) outside2.pages.remove(file);
14477
14478
  };
@@ -14717,6 +14718,40 @@ var walked = (db, after2, lost) => {
14717
14718
  })();
14718
14719
  };
14719
14720
 
14721
+ var refused2 = (name2) => ({
14722
+ why: `a held store writes ${name2} not: only its log and the values out of line it lays`
14723
+ });
14724
+ var readOnly = (name2, file) => ({
14725
+ read: (offset, length2) => file.read(offset, length2),
14726
+ write: () => refused2(name2),
14727
+ size: () => file.size(),
14728
+ truncate: () => refused2(name2),
14729
+ flush: () => file.flush(),
14730
+ close: () => file.close()
14731
+ });
14732
+ var heldLayer = (pages, log) => {
14733
+ const laid4 = new Set();
14734
+ const writable = (name2) => name2 === log || laid4.has(name2);
14735
+ return {
14736
+ ready: () => pages.ready(),
14737
+ exists: (name2) => pages.exists(name2),
14738
+ list: (prefix) => pages.list(prefix),
14739
+ open: (name2) => {
14740
+ const lays = !pages.exists(name2);
14741
+ if (lays && name2 !== log && !name2.startsWith(OUT)) return refused2(name2);
14742
+ const opened5 = pages.open(name2);
14743
+ if ("why" in opened5) return opened5;
14744
+ if (lays) laid4.add(name2);
14745
+ return writable(name2) ? opened5 : { file: readOnly(name2, opened5.file) };
14746
+ },
14747
+ remove: (name2) => {
14748
+ if (!writable(name2)) return refused2(name2);
14749
+ laid4.delete(name2);
14750
+ return pages.remove(name2);
14751
+ }
14752
+ };
14753
+ };
14754
+
14720
14755
  var blobOf = (value, field) => {
14721
14756
  if (!(value instanceof Uint8Array)) throw new Error(`store: ${field} is not a blob.`);
14722
14757
  return value;
@@ -14858,20 +14893,20 @@ var stoppedBy = (state, failure) => {
14858
14893
  return { why: `Nothing is committed: ${failure.why} (${failure.code}). The store is stopped.` };
14859
14894
  };
14860
14895
  var apart2 = async (db, state, committing, batches) => {
14861
- const refused15 = new Map();
14896
+ const refused16 = new Map();
14862
14897
  for (const [at, batch] of batches.entries()) {
14863
14898
  const letting = new Map();
14864
14899
  await unwalked(committing.helds);
14865
14900
  if (state.phase !== "open") return { why: `The store is ${standing(state)}.` };
14866
14901
  const failure = writtenWhole(db, [batch], state.sequence + 1, letting, committing.helds);
14867
14902
  if (failure !== null && !isDamage(failure)) return stoppedBy(state, failure);
14868
- if (failure !== null) refused15.set(at, `the write meets a page that reads not: ${failure.why} (${failure.code})`);
14903
+ if (failure !== null) refused16.set(at, `the write meets a page that reads not: ${failure.why} (${failure.code})`);
14869
14904
  else {
14870
14905
  const lost = await landOf(db, state, committing, state.sequence + 1, letting);
14871
14906
  if (lost !== null) return lost;
14872
14907
  }
14873
14908
  }
14874
- return { sequence: state.sequence, refused: refused15 };
14909
+ return { sequence: state.sequence, refused: refused16 };
14875
14910
  };
14876
14911
  var once = (batch) => {
14877
14912
  const last = new Map();
@@ -14906,9 +14941,9 @@ var settle3 = async (db, state, owing, logPages) => {
14906
14941
  if (failure !== null) stop(state, `the log was not copied: ${failure.why}`);
14907
14942
  state.pages = freed2 ? pages : Math.max(state.pages, pages);
14908
14943
  };
14909
- var closeOf = async (db, state, owing, keepFiles, witness, refused15) => {
14944
+ var closeOf = async (db, state, owing, keepFiles, witness, refused16) => {
14910
14945
  if (state.phase === "closed") return;
14911
- const kept3 = refused15 || state.phase === "stopped" || await copyLog(db, owing, 0) !== null;
14946
+ const kept3 = refused16 || state.phase === "stopped" || await copyLog(db, owing, 0) !== null;
14912
14947
  if (kept3) keepFiles();
14913
14948
  await witness.close();
14914
14949
  state.phase = "closed";
@@ -14929,6 +14964,7 @@ var rewrapOf = async (state, backing, bootKey, next) => {
14929
14964
  };
14930
14965
  var makeStore = (db, last, beside) => {
14931
14966
  const { owing, size, keepFiles, madeLog, stopped, logPages, backing, bootKey, outside: outside2, named: named6, witness } = beside;
14967
+ const trialHeld = beside.held;
14932
14968
  const taking3 = takingOf();
14933
14969
  const stopping = (why) => {
14934
14970
  taking3.stop(why);
@@ -15033,13 +15069,13 @@ var makeStore = (db, last, beside) => {
15033
15069
  live("sweep");
15034
15070
  swept(outside2, named6);
15035
15071
  },
15036
- close: (refused15 = false) => {
15072
+ close: (refused16 = false) => {
15037
15073
  closing2 = true;
15038
15074
  taking3.stop("the store closes");
15039
15075
  return queued(async () => {
15040
15076
  await backups;
15041
- await closeOf(db, state, owing, keepFiles, witness, refused15);
15042
- if (refused15 && state.sequence === last) madeLog();
15077
+ await closeOf(db, state, owing, keepFiles, witness, refused16 || trialHeld);
15078
+ if (refused16 && state.sequence === last) madeLog();
15043
15079
  });
15044
15080
  }
15045
15081
  };
@@ -15181,7 +15217,7 @@ var databaseOf = async (gear, dataKey, bootKey, cipher2) => {
15181
15217
  const madeLog = () => {
15182
15218
  if (!logStood) gear.pages.remove(LOG2);
15183
15219
  };
15184
- const refused15 = (why) => {
15220
+ const refused16 = (why) => {
15185
15221
  installed.keepFiles();
15186
15222
  db.close();
15187
15223
  madeLog();
@@ -15193,17 +15229,19 @@ var databaseOf = async (gear, dataKey, bootKey, cipher2) => {
15193
15229
  const told = witnessed(witnessing);
15194
15230
  const failure = keyed(db, dataKey, told === 0, cipher2);
15195
15231
  const last = failure ?? readSequence(db);
15196
- if (typeof last !== "number") return refused15(refusalOf(last));
15197
- if (last < told) return refused15("damaged");
15198
- const named6 = namedOut(db);
15199
- if ("why" in named6) return refused15(refusalOf(named6));
15200
- if (!mapsOpen(db)) return refused15("damaged");
15201
- if (await land(installed.owing) !== null) return refused15("damaged");
15232
+ if (typeof last !== "number") return refused16(refusalOf(last));
15233
+ if (last < told) return refused16("damaged");
15234
+ const references = namedOut(db);
15235
+ const named6 = "why" in references ? null : references;
15236
+ if (!mapsOpen(db)) return refused16("damaged");
15237
+ if (await land(installed.owing) !== null) return refused16("damaged");
15202
15238
  const { owing, size, keepFiles } = installed;
15203
- const logPages = gear.logPages ?? LOG_PAGES;
15239
+ const held2 = gear.held === true;
15240
+ const logPages = held2 ? Number.POSITIVE_INFINITY : gear.logPages ?? LOG_PAGES;
15204
15241
  const bootKeyHeld = { current: bootKey };
15205
- const witness = witnessOf(witnessing);
15242
+ const witness = held2 ? unwatched : witnessOf(witnessing);
15206
15243
  const beside = {
15244
+ held: held2,
15207
15245
  owing,
15208
15246
  size,
15209
15247
  keepFiles,
@@ -15244,30 +15282,33 @@ var createStore = async (gear, bootKey, cipher2 = CIPHER) => {
15244
15282
  if ("why" in found && found.why === "held") return found;
15245
15283
  const dataKey = gear.chance.draw(KEY_SIZE5);
15246
15284
  const header = sealHeader(gear.crypto, bootKey, dataKey, (length2) => gear.chance.draw(length2), cipher2);
15247
- const refused15 = await writeHeader(gear.pages, header);
15248
- if (refused15 !== null) {
15285
+ const refused16 = await writeHeader(gear.pages, header);
15286
+ if (refused16 !== null) {
15249
15287
  dataKey.fill(0);
15250
- return { why: refused15 };
15288
+ return { why: refused16 };
15251
15289
  }
15252
15290
  const made2 = await databaseOf(gear, dataKey, bootKey, cipher2);
15253
15291
  if ("why" in made2) discarded(gear.pages);
15254
15292
  return made2;
15255
15293
  };
15256
- var openStore = (gear, bootKey, form = FORM) => rekeyedOr(
15257
- gear,
15258
- bootKey,
15259
- form,
15260
- async () => {
15261
- const opened5 = await headerOpened(gear.pages, gear.crypto, bootKey);
15262
- if ("why" in opened5) return opened5;
15263
- if (!CIPHERS.includes(opened5.cipher)) return { why: "unknown form" };
15264
- return wholeOr(await databaseOf(gear, opened5.dataKey, bootKey, opened5.cipher));
15265
- },
15266
- (cipher2) => {
15267
- if (cipher2 !== null && !CIPHERS.includes(cipher2)) return Promise.resolve({ why: "unknown form" });
15268
- return discarded(gear.pages) ? createStore(gear, bootKey, cipher2 ?? CIPHER) : Promise.resolve({ why: "held" });
15269
- }
15270
- );
15294
+ var openStore = (given2, bootKey, form = FORM) => {
15295
+ const gear = given2.held === true ? { ...given2, pages: heldLayer(given2.pages, LOG2) } : given2;
15296
+ return rekeyedOr(
15297
+ gear,
15298
+ bootKey,
15299
+ form,
15300
+ async () => {
15301
+ const opened5 = await headerOpened(gear.pages, gear.crypto, bootKey);
15302
+ if ("why" in opened5) return opened5;
15303
+ if (!CIPHERS.includes(opened5.cipher)) return { why: "unknown form" };
15304
+ return wholeOr(await databaseOf(gear, opened5.dataKey, bootKey, opened5.cipher));
15305
+ },
15306
+ (cipher2) => {
15307
+ if (cipher2 !== null && !CIPHERS.includes(cipher2)) return Promise.resolve({ why: "unknown form" });
15308
+ return discarded(gear.pages) ? createStore(gear, bootKey, cipher2 ?? CIPHER) : Promise.resolve({ why: "held" });
15309
+ }
15310
+ );
15311
+ };
15271
15312
  var restoreStore = (gear, temporaryKey, bootKey, form) => restoredFrom(gear, temporaryKey, form, () => createStore(gear, bootKey));
15272
15313
 
15273
15314
  var ADDITIONAL = utf8Bytes("nervur log record");
@@ -15672,9 +15713,9 @@ var orderOn = (cells, holds3, node2, order, throughBrain) => {
15672
15713
  const wire2 = wireAt(cells, node2, id);
15673
15714
  if (order.placeholder === void 0 && wire2 !== void 0 && wire2.termination !== order.termination)
15674
15715
  return { why: `the placeholder ${id} is wired to ${wire2.termination}` };
15675
- const refused15 = refusedWire(row === void 0 ? null : row.expects, target, order.termination) ?? refusedSkin(declaredIn(cells), owner, id, target) ??
15716
+ const refused16 = refusedWire(row === void 0 ? null : row.expects, target, order.termination) ?? refusedSkin(declaredIn(cells), owner, id, target) ??
15676
15717
  (throughBrain ? null : refusedChild(cells, owner, id, target));
15677
- if (refused15 !== null) return refused15;
15718
+ if (refused16 !== null) return refused16;
15678
15719
  const reused = wire2 !== void 0 && wire2.termination === order.termination;
15679
15720
  if (row === void 0) putPlaceholder(cells, node2, id, { expects: null, declared: false });
15680
15721
  putWired(cells, {
@@ -15817,16 +15858,16 @@ var wiresFor = (cells, node2, held2, wiring2) => {
15817
15858
  const declares = declaredIn(cells, { id: node2.id, held: held2 });
15818
15859
  const refusal3 = (id, expects, termination) => {
15819
15860
  const target = targetOf(termination);
15820
- const refused15 = refusedWire(expects, target, termination);
15821
- if (refused15 !== null || target === void 0) return refused15;
15861
+ const refused16 = refusedWire(expects, target, termination);
15862
+ if (refused16 !== null || target === void 0) return refused16;
15822
15863
  return refusedSkin(declares, node2, id, target) ?? refusedChild(cells, node2, id, target);
15823
15864
  };
15824
15865
  const wires = new Map();
15825
15866
  for (const [id, termination] of Object.entries(wiring2)) {
15826
15867
  const expects = held2.get(id);
15827
15868
  if (expects === void 0) return { why: `the node ${node2.id} holds no placeholder ${id}` };
15828
- const refused15 = refusal3(id, expects, termination);
15829
- if (refused15 !== null) return refused15;
15869
+ const refused16 = refusal3(id, expects, termination);
15870
+ if (refused16 !== null) return refused16;
15830
15871
  wires.set(id, termination);
15831
15872
  }
15832
15873
  for (const id of objectsOf(node2))
@@ -17309,8 +17350,8 @@ var occupantsOn = (cells, wards) => {
17309
17350
 
17310
17351
  var invitedKey = (node2, heir) => ["invited", node2, heir];
17311
17352
  var waits = (relation2) => relation2 !== void 0 && relation2.far !== null && relation2.node !== null && !relation2.occupant.spent && !relation2.again;
17312
- var done = (refused15, key2) => {
17313
- if (refused15 !== null) throw new Error(`brain: the row ${key2.join(" ")} is not written: ${refused15.why}`);
17353
+ var done = (refused16, key2) => {
17354
+ if (refused16 !== null) throw new Error(`brain: the row ${key2.join(" ")} is not written: ${refused16.why}`);
17314
17355
  };
17315
17356
  var keepWaiting = (cells, before4, after2) => {
17316
17357
  if (waits(before4) && !(waits(after2) && after2.node === before4.node)) {
@@ -17580,8 +17621,8 @@ var anchorOf = (cells) => {
17580
17621
  };
17581
17622
  var owned = (cells) => anchorOf(cells) !== null;
17582
17623
  var putAnchor = (cells, anchor) => {
17583
- const refused15 = cells.set(ANCHOR, "lobe" in anchor ? { lobe: anchor.lobe } : { heir: anchor.heir });
17584
- if (refused15 !== null) throw new Error(`brain: the anchor is not written: ${refused15.why}`);
17624
+ const refused16 = cells.set(ANCHOR, "lobe" in anchor ? { lobe: anchor.lobe } : { heir: anchor.heir });
17625
+ if (refused16 !== null) throw new Error(`brain: the anchor is not written: ${refused16.why}`);
17585
17626
  };
17586
17627
  var anchorNode = (cells) => {
17587
17628
  const anchor = anchorOf(cells);
@@ -17976,8 +18017,8 @@ var LOBES_METHOD = {
17976
18017
  budget: 100
17977
18018
  };
17978
18019
 
17979
- var NERVUR_GUIDE = "# Nervur's guide\n\nWhat Nervur is and how an organism works, whole, in a few pages: the model a person or a model holds before it touches\nanything, and the model an adopter builds from. The brain carries this guide as its own, so a model present at an\norganism reads it first. How to install, own and build on Nervur, each path with its commands and code, stands beside it\nin `authoring.md`, which travels with it in the genome's `docs/` and which the brain carries beside it, answered by\n`authoring`. What each version of Nervur changed, from 0.31.0, stands beside them in `changelog.md`. Where the exact\ndetail matters, it is in `authoring.md`, in each faculty's own guide, and in what its node answers a **describe**, an\nask naming no method: what it may be asked.\n\n## The bet\n\nSoftware as a graph, never accounts. Every person, group and agent is an **organism** on a device of its own, and\norganisms ask each other over **Quo**, never through a server they share. A shop keeps what it knows of its customer in\nits own organism; the person keeps the rest in their home. Nervur grows by being many small organisms on the devices\nthat already exist, never by one growing big.\n\nTrust is what is scarce, never code: a shape is worth what it makes certain, who may ask whom, what ran and what it\nchanged. The primitives are few: the organism, the relation, the ask, the letter and the owner.\n\nThe genome is a kernel, as Linux is: small, slow to change, built for decades, with no opinion of what stands on it, and\n**the owner is root**. Code starts with nothing, and an owner can give it everything: a faculty's power comes by wires\nand organs, never by opening the cage. A **wall** stands only where it protects someone other than the owner, or where a\npromise cannot be proven without it, as purity, closed cells, keys never exchanged and an ask ending once. Every other\nlimit is a **default** an owner can change, and one no owner's word can move is a gap. So of any limit, ask who it\nlimits, and build powerful things on Nervur: what people do with it is theirs.\n\n## The organism\n\nAn organism lives on one **device**, the machine, in an account of its own there: an account of an operating system, one\nsite of a browser, a phone's app or an edge's durable object. It is sealed. It has two doors and no third: the **ear**,\nwhere every being enters over Quo, and the installer's **door**, where the device reaches it (install, boot, update,\nwipe). Everything else that touches the world or the host is an **organ**.\n\nA device gives it two **zones**:\n\n- **The self**, the organism's own account: `key` (the boot key), `store` (primordial memory, encrypted), `cage` (runs\n every lobe's ask, keeps time) and presence (the console, the screen). The self keeps.\n- **The body**, the work account: `shell`, `disk`, `network` and every repo's organ. The self starts programs as the\n body, never the other way, so nothing the body runs reads the key or the memory. The body forgets: a backup carries\n the self alone, and what the body held comes back from the world. A backup is an older life, of which a lobe is told\n first; what a damaged store still opens a salvage reads at the door, with no boot; a move, sealed to one device, is\n the same life elsewhere, and the copy it left stops; a rekey is a move onto itself, a new data key that costs no\n relation, where a rewrap moves the boot key alone. Who an organism is stands apart from where it is: an owner names\n the addresses it is reached at, ahead of a move.\n\nA host has a body where it has `shell` and `disk`. A server, a desktop, a Pi and a NAS have one; a browser, a phone's\napp and an edge do not.\n\n## Nodes and the graph\n\nEverything in an organism is a **node**, under an ID, with one **termination** where every ask to it arrives:\n\n- **An organ**: a driver. Its **graph half** is its **blueprint**, what a node declares of itself, its name, its version\n and its methods, and its **reach**, what of its host it touches, both held by the brain; its **host half** is code\n running on the device. It holds no cells and declares no placeholders.\n- **A lobe**: an instance of a **faculty**, pure code. It lives only inside an ask and keeps nothing between asks but\n its **cells**, its own partition of memory. It keeps its ID, wires, relations and cells across its faculty's versions.\n- **A far organism**: stands for one relation over Quo, one way, and nothing more.\n\nThe **core** is there from the first install and never torn down: the organs `key`, `store`, `cage` and `network`, and\nthe lobes `brain`, `scheduler`, `ear`, `mouth` and `library`. Everything else is **periphery**.\n\nNodes meet only through **wires**. A node declares **placeholders**, its needs; a wire joins one placeholder to one\ntermination, one way. The **brain** alone writes wiring and checks only that the blueprint name a placeholder expects is\nthe one it gets: a wire says who reaches whom, and code reaches only what its wires give it. A declaration wires\nnothing, whatever ID it carries: a lobe starts with its `cells` and `nerves`, and every other wire is named, in the\n`wiring` given at its creation or by an order, and what stands unwired an owner sees in `state`. Connection comes only\nfrom connection: a lobe orders a wire by its `nerves`, its placeholders with their wires and statuses, only to its own\nchildren and to who asked it, and every other wire is an owner's word, through `brain`, which an owner can give a lobe.\nA lobe that declares a placeholder named after an organ is that organ's **skin lobe**: the only way an organ meets the\ngraph. A lobe may raise **children** through its `nerves`; a child reaches nothing its parent does not, and power only\nnarrows down the line.\n\n## The ask\n\nNodes meet only through the **ask**: a method, its args (data) and a timeout, sent over a placeholder. The brain carries\nevery ask and stamps it with the asker's ID, the time, a fresh 32-byte seed and the lobe memory. Every ask ends exactly\nonce, with `{result}` or `{error: {code, message}}`.\n\n- **Whole or nothing.** A lobe's writes take effect in one batch when it answers. If the brain answers in its place\n (timeout, fault, busy), nothing it wrote remains. An answer reaches its asker only once its batch is on disk, so an\n answer always means it happened. What a lobe already sent to the world stays sent.\n- **From far.** Only a far side's own answer says what happened there. Any other exit may have run, and where no reply\n came may still run until the next ask on that relation is answered; `repeated` says the door took it, so it will not\n run again. An ask that must not run twice carries a key of its asker's.\n- **Reading and writing.** A reading method writes nothing and runs beside others; a writing method runs alone.\n- **Signal or letter.** A **signal** lives in memory and is lost in a crash. A **letter** is kept in primordial memory\n until the lobe takes it, exactly once. An ask whose loss matters is a letter.\n- **Durable asks** go to organs: the brain sends them again whenever the organ reconnects, as \"keep listening\".\n- **Time.** A **budget** bounds the real time a run works, watched from outside it; a **timeout** bounds waiting. Past\n either the run is cut, nothing it wrote lands, and the asker hears `timeout`. An asker names a timeout only where an\n answer is worth no longer; otherwise it waits as long as it may, and an inner ask never outlives the outer one. A run\n that must pause, before a retry or while it holds its lobe, asks its `nerves` `wait {ms}`, answered `null` once the\n span has passed, or `timeout` where its ask's time ends first; it waits as on any ask, spending no budget. Work\n longer than one ask answers at once and ends later, by an ask back or a **job**, which a node answers at once to an\n asker it cannot ask back, and which the asker gives back to ask how the work ended; what is long is cut into pieces\n judged by progress, never by one slow piece.\n- **Queues.** One queue per lobe, asks started in the order they arrive; each asker holds a share, and one over its\n share alone meets `busy`. No wait inside an organism closes a circle: a run waits on any one of the asks it has in\n flight, an ask queued waits on the runs ahead of it in its lobe, and a move of a version waits for the runs of its\n lobe. An ask, or a move, that could start only once a run ended that waits on it, its own run or another lobe's,\n through any number of lobes, queues or the brain, is answered `refused` at once instead of waiting; a run racing two\n asks is never refused for the one it may not need, and one awaiting both hears the one on the circle refused the\n moment the other answers. A\n reading ask that starts beside other readers waits on none of them. Across organisms nothing tells such a circle, so\n it ends at its timeouts.\n- **Status.** Every termination is not ready, connected, unavailable or far, and status flows into each placeholder\n wired to it.\n\n## Ownership\n\nThere are no roles in the brain. Whoever asks the brain is an **owner**: whoever is **present** at the device (the\nconsole or the screen the configuration names present), whoever holds a relation the brain emitted, from afar, and a\nlobe an owner wired to `brain`, which holds what that owner gave it. Every other being reaches only the lobe that\ninvited it. A relation to the brain is owning; a relation to a lobe is belonging, buying or following, and roles live in\nlobes.\n\n- **Presence wins over the graph and never over the account**. The present lobes, the console's and the screen's, are\n one person and hold their relations alike. A model at the console is present as a person is, and holds no more, and\n moves no skin of presence. It reaches the organism by `nervur mcp`, the console's MCP form: a tool for each method of\n each node the console holds, its args, result and kind from the method's blueprint, and the portrait at connect. A\n method marked irreversible, one that tears down, drops or deletes, is hinted destructive and made as the console makes\n it: who must approve what is the organism's to say, and its **harness**'s to ask, the files an agent works by, its\n instructions, hooks, settings and skills. A job is followed as a task.\n- **Another account owns nothing** without the boot key, nor does the device while the organism is down; whoever can\n become every account of a machine holds every organism on it.\n- **The anchor** is the owner no other owner drops: the present lobe, or the first invitation's knock where there is\n none. It leaves only by passing on, and the person present may take a far anchor back by dropping it.\n- An owner reaches a lobe through the brain's `ask`; the lobe sees `brain` as its asker. Among the brain's methods:\n create and move lobes, add organs, wire, invite owners, accept standings, back up, upgrade, read `state`.\n- **A secret is held from strangers and siblings, never from owners.** A lobe's cells are a wall against other lobes and\n the far side, and a default against accident for owners: `state` shows none, so a secret stays out of everyday tools\n and a harness's model, as `ps` prints no process's memory. An owner reads all a lobe holds by a deliberate act that\n shows, a move to a faculty that tells, or a backup.\n- The brain counts and enforces, and never judges. It keeps the organism's **character**, `{name, voice, goals}`, and\n answers every owner its **portrait**: this guide, the character, each lobe with its guide, and the first page of its\n `state`.\n\n## Beings and Quo\n\nQuo is its own spec: asks and replies as data, never code. An organism has a public **ward** (its name) and a fresh ward\nfor each relation it opens to a stranger, so no two strangers can link it by its name, or, where a **relay** is wired, a\nlobe that gives each ward an address of its own, by where it is reached. What a wire shows, and where it asks from, is\nthe network's and the owner's to cover.\n\n- A lobe **invites** through the ear, with **spans**, how long the invitation waits and how long the relation lives, and\n a **note** (free JSON on what the relation is for, never sent). The invitation's text, its spans and what it says\n among it, is signed whole by the ward drawn for it, so no one who carries it changes a word unseen; the signature\n says the text is the ward's own, never whose the ward is. The other organism **accepts** through its mouth; its\n first **knock** that announces a key binds the relation. A relation runs one way: the side that accepted asks, the\n side that invited answers.\n- A **link** is an invitation kept behind a one-time reference: short enough for a QR, it names the ward drawn for it\n and where that ward is reached, so a link names no one, and it is redeemed once on that ward's **zero head**, Quo's\n name for where whoever holds no relation asks. Before the yes its holder reads its **offer** there, spending nothing:\n what the inviter says with it, how long it waits and how long the relation lives. A link on a domain names the public\n ward, where a name is meant to be known.\n- An **end** is a relation as one side holds it, in Quo's words: the **occupant**, the end a lobe gave, which answers,\n and the **standing**, the end the organism holds, granted to the lobes the owner wires, which ask. The brain alone\n keeps ends and their notes; a lobe keeps no copy. An owner hands a standing to another of its organisms, the place it\n asks told nothing: there `taking` draws a key, here `cede` forgets the standing and answers it sealed to that key, and\n there `take` keeps it. Its addresses, its keys and the count of its numbers go on as from one device, so nothing the\n place receives tells it the standing moved. An app or a window of the owner's asks it.\n- The ear opens each box with `key` and never decides; a stranger hears silence, and it keeps no place while a node\n answers. An ask over a relation runs at most once, and one taken already hears `repeated`; a stranger's ask on the\n zero head changes nothing by default, since nothing tells its copy from a second ask, so a change goes over a\n relation. A relation ends from either side, never half. A **box**, one ask or one reply, sealed, is at most 1 MiB;\n more crosses in pieces.\n- A lobe never sees a ward or a key, only an ID. At most one lobe is the ear's `front`, answering strangers the\n organism's public part alike, what it may be asked among it.\n- An organism that cannot be dialed holds a **line** to one always on, and asks travel both ways over it.\n\n## Code: faculties, the library, versions\n\nA **faculty** is one module the cage runs, in the engine's language, JavaScript, extending `Faculty`, its static\n`blueprint` naming its name, version and methods. Its source is one string named by its SHA-256, the **digest**, so the\nversion is inside the digest. Each ask runs on a fresh instance in a cage with no clock, no randomness, no I/O: chance\ncomes from the stamp's seed, time from the stamp, the world only by asks. A faculty proves itself by **evidence**:\npieces of its world replayed exactly. Code is logic and data is cells.\n\nThe **library** keeps every code by its digest and never runs one. Code enters by four **roads** alone, always taken on\nan owner's word, never given:\n\n1. **The genome's**: the default faculties, at install and upgrade.\n2. **The installer's**: the host's organs and the faculties it ships, from its **channel**, the host's own way of\n shipping code: the floor's among them, the console's and the screen's skins and what it gives them by name, the\n floor's look for the window, and the repo faculties, the jailer and the repo lobe.\n3. **A source's**: everything else, from any lobe an owner names that answers `get` and `told`. A repo lobe is Nervur's\n own: it tells a version once a tagged commit holds it, and its `versions.json` names each version's digest. The\n library asks the source (local, or far over a library's standing) for the text, hashes it itself and keeps it only if\n the digest matches and the name and version were never kept under another digest, an owner's `second` taking another\n author's as a name of its own, by its source. A faculty a far place offers is held as given by that place, for its\n asker to create sealed.\n4. **An owner's hand**: a faculty's text an owner's `add` carries itself, kept under `hand@<version>`, by the same\n walls. It is how a bare host gets its first source.\n\nA faculty from a source carries its evidence as an **asset**, a file it carries as part of its version, data that runs\nnothing, so the proof outlives its repo; one with none stays allowed, shown as unproven. What the genome or the\ninstaller lays is proven by the release that ships it.\n\nAn owner **creates** a lobe on a kept digest, naming its wires, and **moves** it to another version in place, or to\nanother faculty's; the move asks the new version `migrate` once, keeps the old one if it fails, and leaves what the new\nversion declares anew unwired for the owner to wire. A landed move keeps one step back until the owner settles it, goes\nback or moves again, and no size of a lobe stops it. The library keeps no old version no lobe or step names, but one an\nowner spares: each boot, and each lobe leaving a version, sweeps them, so a version an owner adds stays for a lobe to\nmove to, an older one too. A version removed keeps its digest, so no other text ever takes it. Lobes that decide who\nsomeone is or what code is (brain, library, ear, mouth) are **immutable**: they move only with the genome. A present\nlobe decides no one: the person present moves the console's or the screen's skin to any faculty by `version`, never a\nmodel or a far owner; the choice is the home's, so an upgrade moves only a skin no one chose, and\n`nervur start --floor`, at the device, lays again the one its **port** gave, the installer for its kind of host, its\ndesign with it, so no skin and no design holds anyone captive.\n\n## Organs\n\nAn organ is `{blueprint, reach, half, code?}`. Its host half is a WebAssembly **component** given exactly the imports\nits reach names, or a **native half** built for one host. No host half's program ever crosses Quo: a **repo's organ**\ncomes only from a repo lobe of the organism's own, pulled and built in its body through `shell`, then added by an\nowner's `addOrgan` under a fixed ID. A host without a body takes faculties only, and organs from its installer and the\nhalves its embedder's build brings, a site's, an app's or a pilot's, each admitted by `addOrgan`. A host half that fails\nshows unavailable and restarts alone. An organ's judgment lives in its skin lobes, which hold its secrets and settings.\nLogic lives in lobes, drivers in organs; a new use case is a new plain lobe composing skin lobes, seldom a new organ.\n\nThe organs Nervur holds: `network` carries Quo and the web; the console asks its present lobe `line` with each line\ntyped; `shell` runs programs as the body; `disk` keeps files under one folder.\n\n## Building well\n\nWhat Nervur leaves to whoever builds, as a builder holds it; nothing here binds an organism.\n\n- **Code is logic, data is cells.** A faculty is one module, written in any language that yields it and bundled by its\n repo's build. A table, a content or a model it serves is laid in its lobe's cells, by `migrate` or by asks, never in\n its source, so a version carries only what changed of the logic.\n- **Logic in lobes, drivers in organs.** Whatever can be decided is decided in a lobe over an organ; heavy computation,\n running a model or transcoding media, is a driver's work and stands in an organ, its host half native code of its\n owner's where it must be, as a driver on a Pi that moves a robot, its source in its owner's repo, built on the Pi, its\n reach the motor's device. The shape that repeats is a plain lobe composing skin lobes: the skin lobes hold what\n reaches the world and its secrets, and the plain lobe holds the use case, reaching the world only by asking them and\n beings.\n- **Signal or letter.** An ask whose loss matters is a letter; one asked again anyway is a signal. An ask back, a letter\n taken again or a durable ask sent again is a cue to read cells, never proof that something happened once: a node that\n owes one and meets `unavailable` drops it, the asker's cells staying the truth, or posts it as a letter that waits for\n the asker's switch on.\n- **Once, far.** What an ask sent far did stays done, so an ask that must not run twice, a payment, carries a key of its\n asker's, which the far lobe keeps and answers once. On a window of one, an asker who must know an earlier box will not\n still run asks once more. A lobe working step by step names its next step in its answer.\n- **Choosing by the nerves.** A lobe reads its statuses and answers `unavailable`, takes another path, or orders its\n wiring again; at `left` it forgets what it keeps of that far organism, as a token. Whoever knocks first holds the\n relation, so a note on an occupant is a belief rooted in the handing over. A lobe that needs more asks at once to one\n being has its organism hold more standings.\n- **Skin lobes.** Every use of an organ is a skin lobe of its own: `network` has the ear, the mouth and the web's,\n `shell` the jailer and every lobe that runs programs. A skin lobe lets a secret reach its organ only as an ask's\n input, never in words the organ keeps. A lobe stands before an organ for other lobes only where they must share what\n it keeps, as one account's token, and is then their skin lobe's plain asker as any other. An organ's long work answers\n at once and asks its skin lobe back; a skin lobe serving another lobe asks it back in turn, by a letter where it must\n not be lost, and never asks its organ again from inside the organ's ask back, which waits on its answer: it keeps what\n follows in its cells and starts it by an alarm, which the scheduler keeps.\n- **Long work.** Work longer than one ask is made of pieces, each its own ask well within the longest timeout, and is\n judged by progress: a piece that times out is asked again, and the whole fails only once it moved not for the span it\n may stand still, never because one piece was slow.\n- **Two organisms nobody can dial** both hold lines to one always on, which passes each ask down the line that proved\n its ward and carries the reply back, unread. A relay, which gives a ward an address of its own, is a repo's, which the\n genome neither holds nor forbids.\n- **A builder delivers into its buyer's repo.** The buyer's repo lobe invites the builder with a writer's standing\n scoped to the folders it delivers, a note and a span; the builder's repo lobe pulls the scope, writes in what it\n delivers and pushes, and the buyer's lobe guards it. The standing ends and the builder's lobe is torn down, so the\n builder keeps nothing of the buyer's, and the buyer keeps what was delivered. An update is a job again, on the buyer's\n word, and a version enters the buyer's library from the buyer's own repo lobe.\n\n## Repos\n\nAn adopter builds on Nervur changing nothing of it: it writes faculties and organs in its own repos, and its nodes act\nonly through asks. What else it changes is its own. What travels as code stands in a **repo**. A repo is its lobes\nand its bytes, kept by the **repo faculties**, the floor's skins of `shell` and `disk`, in `@nervur.org/floor`:\n\n- **The jailer**, `nervur.repos`, one per organism with a body, laid on demand: it alone runs git, keeps each repo's\n bytes at `repos/<name>`, grants each folder to one repo lobe, and lends the genome at\n `repos/node_modules/@nervur.org/genome`, one folder up from every repo, at the version the organism runs; the genome\n carries this guide, `authoring.md` and `changelog.md` in its `docs/`.\n- **A repo lobe**, on `nervur.repo`, one per repo per organism: it commits, pulls and pushes git bundles over standings,\n and guards its own `main` by two checks, Nervur's check of the parts and the repo's own `conform`, the choices its\n owners hold it to, as the lobe's owner chose it, never a writer. Standings on it are a **reader's** (pull), a\n **writer's** (pull and push), optionally scoped to folders, or a **library's** (read what was told). Only `main` and\n its tags move between lobes.\n- **Its commands and keys.** A repo declares commands alone, the scripts of its `package.json`. Keys belong to a copy of\n the repo, never to the repo: its repo lobe keeps them in its cells, never answered and masked in all it tells, and has\n `.env` written from them before each run. What protects a command is its key, never a role: a script without its key\n fails by its own words. An owner asks `run`, `setToken` and `credential`; a credential renews itself before it expires\n and ends with its standing. A lobe an owner wires to the repo lobe may run and commit, but while a writer's standing\n stands on it only the one it names `author` commits; a **runner**, a far organism by its invitation, runs the scripts\n it names alone.\n\n**Authoring and running stand apart**. Authors work on their own organism, in their own repo lobe, gated at the commit,\nand push along their standings. Code runs only where the owners ask it: a reader, a writer or a library never reaches\n`run`, a key or a runner's invitation. They meet at a release alone: a version leaves by its digest, and an owner moves\na lobe to it. A release is published only by a `run` of the publish script on a repo lobe, at an owner's ask or a\nrunner's, on an organism its owner chooses, an authoring one among them. A gate runs the tests of the code that came,\nwhich are the writer's, so it catches a mistake and never a writer: what an owner holds against writers is written in\n`conform`.\n\nA repo's version is its root `package.json`'s; a commit that raises it is tagged `v<version>` and that tag **tells**\nevery part it holds, whose bytes never change after. A repo names no genome: the organism lends it. Its conventions are\nfolders: `faculties/`, `organs/`, `designs/`; everything else is its owners' own, packages included. Its commands are\nits `package.json` scripts, `gate` and `conform` always. Its **harness**, skills among it, says how it is authored, for\nmodels alone, and Nervur shapes nothing of it; a faculty's **guide**, in its blueprint, says how it is run and used,\nread by the owners, a lobe wired to it and whoever holds a standing on its lobe.\n\n**Authoring a repo, anywhere.** A session authors a repo opened in that repo's own folder. Everything it needs is there:\nNervur's guide and the two papers beside it, one folder up in the lent genome's `docs/`, and the repo's own harness,\nskills and gate in the repo. Its harness, its owners' own for whatever agent they bring, takes this guide in at the\nstart of every session, from the genome lent one folder up, at `repos/node_modules/@nervur.org/genome/docs/`, so whoever\nauthors starts holding Nervur, on any organism. Nervur lends knowledge alone, the guide and the papers beside it, for\nany agent and any model, and lays no harness. A repo begins empty, or as the child of a lobe that raises repo lobes and\nlays its owners' boilerplate, harness among it, as its first commit, to be pulled and authored. How a faculty is run is\nits blueprint's `guide`, never a skill.\n\n## The screen and looks\n\nA screen's **home** is the organism it is of, and a **place** is any lobe its person stands on, a far organism's or one\nof their own, as its window draws it. A person sees through the **screen**:\nlobes answer **trees** as data from a reading `draw`, the screen composes them, diffs and patches; no script, style or\naddress can be written in a tree, and a region a sealed lobe draws is drawn for the lobe whose slot asked it, which\nhears its presses; a gesture is another hand on a control the keyboard reaches. A lobe may be created **sealed**, by\nwhoever creates it: it hears and answers, reads its own cells and its faculty's assets, and orders no wire, so code\nanother wrote runs and reaches nothing. A place answers what its describe offers; the floor's window draws a place with\nno `draw` of its own as its methods and a field for each argument, so one describe gives its forms as it gives Quo's\ndescribe and the console's tools. The **window**, the screen's skin lobe, draws in a **design** (tokens, themes,\ncomponents built into a **look** faculty), which is no part of the genome: it creates its design lobes sealed and\nwears the design its port gave it by the name `design` until an owner's `wear` chooses another. What a window hands\nthe host to lay above the page stands outside every tree, where no place's tree or sheet covers or presses it, and no\ntree of a place forges a consent the window holds. The floor's window is the least that lets a person use what Nervur\npromises from a screen: it shows the organism and a place by what they describe, carries a press past the person's\nyes where it binds them, takes a link only with a yes that knows who invites and what they say, and leaves what it\ntook. It says the warnings and every consent in the home's own words and lays a way out above the page; a note its\ncaller gives at a link's yes is kept beside the standing and never sent to the place; and at a place it took, a press\nthe person consents to ends the standing whole and returns them to the home. Everything else a person meets, pages\nlaid out of parts, boards, lists and words in their language, is built in a window or a design of one's own: Where\nNervur stops, below, says how. A site is another repo's, and in a\nbrowser a page embeds the installer as plain files.\n\n## Hosts\n\nOne genome on every host; only host halves differ. The engine is QuickJS and the store SQLite with every page encrypted,\neverywhere, and they are named in one place alone. The Node installer serves servers, desktops, Pis and NASes, with a\nbody and `nervur install`, `nervur update`; the browser's has none, its boot key a file of the site. A phone's app\nembeds the browser port, its store in the app's own files and its boot key in the keychain; an edge, its boot key drawn\nand kept in its object's own storage, is laid from another machine from its port's **cargo**, the genome and that host's\nparts built into the files the host's runtime takes, by a **pilot**, a repo's faculty and organ that lay and keep an\norganism on a host from another machine, or by hand, and a server where no one is present by `nervur install --claim`,\nand either is claimed by whoever names its **claim**, a secret drawn and set on the host as it is laid, by which the\norganism's first invitation is fetched. On a server the machine is root's: ports, DNS and services are laid outside the\ngraph by its holder, never by the organism. A server holds as many organisms as it has accounts, one for each, each with\na **body** of its own, a second account where its organs run, so none sees another's files; its administrator prepares\neach person's two accounts once, and the person installs alone. Authoring's _A server_ says what each of the\nadministrator and the person does, for a machine you own, one you hold an account on, and one laid for you.\n\nA new version is tried before it is kept: the old store is laid aside untouched, with the old package on a machine,\nand the new version boots in place on a copy of it, a clone where the disk gives one, so an update costs what its own\nmoves change, never the size of the store; the version boots with the world held, and it is kept or the old comes back\nby itself. The update asks nothing of the organism but its stop, so it moves one no one is present at as it moves one\nowned at its console. Until 1.0.0 it is abrupt: a run\nthe body has going is lost to it as to a crash, and its lobe told so. What the installer ships, its organs' halves and\nits faculties, moves at the new version's first boot, a lobe an owner moved to a later version staying. From afar\n`upgrade` names a version and its digest, and nothing else lands. Until 1.0.0 every organism also moves itself to the\nnewest: its process asks the channel it was laid from or last updated by as it starts and every hour, and runs the same\nupdate onto a newer version, saying what it did in its log and asking no one; one laid from a package at hand has no\nchannel and checks nothing. A start, a trial and a stop wait on the organism's silence, never on a span: while it opens\nor ends it tells it lives, so a store that takes long to open is waited for, and a process that tells nothing for the\nlongest wait, or ends unasked, fails the step with why.\n\nTwo moves stand apart. A faculty's new version is its author's: its `migrate` converts its own cells by its own logic,\nand Nervur only runs it. Nervur's own new version knows no faculty, and from 1.0.0 breaks no contract one stands on.\nUntil 1.0.0 Nervur goes forward only: a genome names its floor, `FLOOR`, the oldest release whose store it carries\nforward, and refuses a store a genome below it last booted, saying to move to the floor first. Until every organism has\ncrossed it, one `nervur update` carries an organism whatever release it runs: below the floor, the floor's own package\nopens its store in place first, then the newest version tries it; a step that fails brings the old back by itself, and\nthe update says why. On a machine, `nervur update` walks the floors in turn, and a backup from below the floor is\nrestored by the floor's own release, then updated. Each floor carries its own, so no machine's organism is stranded,\nhowever long it slept. A browser and a phone carry no earlier release beside their files: their floor is the release a\nsite or an app serves, so a store a release below the genome's floor kept, and a backup or a move laid there that a\nrelease below it wrote, is refused as it stands, saying the installer carries no floor, nothing opened and the store\nuntouched.\n\n## The floor and the licence\n\nAbove the genome and the ports everything is faculties and organs and the data they carry, and the genome names\nnothing built of them, so all of it, Nervur's own defaults among it, can be built again or replaced by anyone.\n\nThe **floor** is only what the genome and the ports cannot work without: the default skins of the organs a port lays,\nthe console's terminal and the screen's window, the two skins of presence, and the repo faculties of `shell` and\n`disk`, the jailer and the repo lobe, which a port with a body lays the first time an owner wants a repo; and the\nplain look the window draws with. The window is the least that lets a person live with no design: it draws the\norganism and each place by what they describe, carries a press past the person's yes where the press binds them,\ntakes a link only with a yes that knows who invites and what they say, and leaves a place it took. Its own words are\nEnglish; a design says them in any other language. Each of the floor's faculties stands on what the genome publishes\nalone, as any repo does, and holds no privilege: the genome lays no skin, a port names the floor's in its\nconfiguration, as an owner's word could name another repo's, and a skin's text whose row is damaged reads from the\nbytes the port gave.\n\n## Where Nervur stops\n\nNervur gives the mechanics no one could build alone, and nothing more: an organism and its keys, an invitation taken\nand its keys kept in the cells, asks one way over it, the owner as root, the cage, the store, backups and moves, the\nscreen's safety, and the ports that lay it on each host. Everything a person meets, holds or is offered is built on it\nby whoever builds, in faculties, organs, designs and apps of their own: a list of places blocked, a report, a page of\nwhat a person can do with a place, a board of many, a keeper of boot keys, a copy of an organism kept somewhere safe,\nwords in every language, a page laid out as one likes. Nervur will not build these for anyone, however often they are\nasked: each is one way among many, and the first one built into the kernel would close the rest. What is asked of\nNervur is weighed by one question: without it, with no design and no app, does something Nervur already\npromises break, or could no one build it on what is published? Three answers alone say yes: nothing published reaches\nit; it can be built, but what Nervur promises could then not be proven; or the only way to build it breaks a promise,\na key held outside the cage, a wait where something could tell, two of a person's relations linked. Easier, faster,\nnicer or often asked is not one of them. What enters comes with its proof, a test played from outside as a stranger\nplays it, failing before and holding after. Where the answer is no, the answer is how to build it, in\n`authoring.md`, never a change to Nervur.\n\nNervur is Bookarest Digital SRL's, under the Functional Source License (`FSL-1.1-ALv2`): anyone reads it, uses it and\nearns with what they build on it; no one sells Nervur itself or a rival made of it; each version becomes Apache-2.0 two\nyears after it is published.\n\n## Where to look\n\n| To know | Open |\n| --------------------------------------- | --------------------------------------------------------- |\n| how to install, own and build on Nervur | `authoring.md`, beside this guide |\n| what each version changed | `changelog.md`, beside this guide |\n| how a faculty is run and used | its `guide`, in its blueprint, and its node's describe |\n| what an organism is and holds now | the brain's `portrait` and `state` |\n| how a repo is authored and released | `authoring.md`, then the repo's harness, its skills first |\n| what crosses between two organisms | Quo's own spec, by its chapter |\n";
17980
- var NERVUR_AUTHORING = "# Building on Nervur\n\nHow to install, own and build with Nervur as it stands at this version: each path from nothing to running, with the\ncommands and the code it takes. It is written for an agent that builds on Nervur, and for the person beside it. Read\nNervur's guide first, `guide.md` beside this file: it holds the model, and this holds the how.\n\nEvery command, method, field and file named here exists as written. Where a shape is not built yet, this paper says so.\n\n## The map\n\n**What exists.** The genome is the kernel every organism runs, on every host. The floor is only what the genome and\nthe ports cannot work without, the default skins of the organs a port lays: the console's terminal, the screen's\nwindow and the floor's look and design it draws with, and the repo faculties, the jailer `nervur.repos` and the repo\nlobe `nervur.repo`, which keep your repos on a host with a body. A port lays them on one kind of host. Everything else\nis yours, built in repos of your own as faculties, organs, designs and apps: Where Nervur stops, below, says what that\nis and how.\n\n| Package | What it is |\n| ------------------------------- | ----------------------------------------------------------------------------------- |\n| `nervur` | the `nervur` command, for a machine |\n| `@nervur.org/installer-node` | the Node port: Mac, Linux, a Pi, a NAS, a server; and the edge's cargo |\n| `@nervur.org/installer-browser` | the browser port: files a website serves, its visitors' organisms in their tabs |\n| `@nervur.org/installer-phone` | the phone port: the browser port inside an app, with its keychain and its push |\n| `@nervur.org/genome` | the kernel; its `faculty`, `standard`, `evidence` and `kit` exports are a builder's |\n| `@nervur.org/floor` | the floor's faculties, the repo faculties among them, and the design kit |\n\nEvery package stands on npm, and none needs a token to be read.\n\n**What each host gives.**\n\n| Host | Body (`shell`, `disk`) | Dialed by others | Runs in the background | Woken by |\n| ---------------------- | ---------------------- | ------------------------ | -------------------------- | ------------ |\n| Mac, Linux desktop | yes | where no router hides it | a service, at every boot | - |\n| Server, Pi, NAS | yes | yes, with `--public` | a service, always on | - |\n| Browser (a site's tab) | no | never | asleep when no tab is open | Web Push |\n| Phone (an app) | no | never | no | APNs or FCM |\n| Edge (a Worker) | no | yes, at its domain | woken by what arrives | what arrives |\n\nOnly a host with a body keeps repos, runs programs and builds organs. A host without one takes faculties alone, by its\nlibrary's standing on a far repo lobe, and the organs its port brings. An organism nobody can dial, a\nbrowser, a phone or a laptop behind a router, holds a line to one always on, and is reached through it.\n\n**Where each step is proven today.** The Node port runs on a Mac and on Linux; a clean Linux machine, a real Pi and\nWindows are not proven yet. The browser port is proven on Chromium; on Safari, on a Mac and on an iPhone in the\nsimulator, its seams hold in a worker, an organism stands from a link, a tab left and opened again keeps it, and a far\nside asks it down a held line; a link taken and a press are not proven there yet, nor a real iPhone. A browser session\nthat keeps nothing, a private window, gives the port no store, so no organism stands there. No pilot is published: an\nedge is laid by hand (An edge, by hand) or by a pilot you write (Pilots).\n\n## Where Nervur stops\n\nNervur gives what no one could build alone: an organism and its keys, an invitation taken and its keys kept in the\ncells, asks one way over it, the owner as root, the cage and the store, backups, moves and the hand of a standing, the\nscreen's safety, and the ports. It builds nothing a faculty, an organ, a design or an app of yours could build on\nthose, however often it is asked, because each such thing is one way among many and the first built into the kernel\nwould close the others. Before you ask Nervur for something, ask the guide's one question: without it, with no design\nand no app, does something Nervur already promises break, or could no one build it on what is published? It is a gap\nonly where nothing published reaches it, where building it leaves a promise unproven, or where your only way breaks a\npromise; then it comes with a test, played from outside, that fails today. Otherwise it is yours to build, and the\ntable below says how. A request that fails this question is answered with this section, never with a change.\n\n**Your own window is the road to most of it.** The screen's present lobe, the floor's `nervur.window`, is a faculty\nlike any other. Each host names the one an organism is born wearing: a desktop's first install by\n`nervur install --faculties <package>`, a package of yours exporting `WINDOW` in the shape `@nervur.org/floor` exports\nit; a site by its own `/.well-known/quo`, and a phone's app by its `quo.json`, as A site that serves the browser port\nand A phone tell. The person present then moves it to any faculty by `version`.\nWrite your own, standing on what the floor's stands on, the screen's organ, the brain's asks and the window's contract\nthis paper tells whole (A window of your own), or wrap the floor's behind a design. The floor's\nwindow is the least that lets a person live with no design: it draws the organism and each place by what they\ndescribe, carries a press past the person's yes where the press binds them, takes a link only with a yes that knows who\ninvites and what they say, and has one leave, at a place it took. Whatever else a person meets at their home, its\npages, its words, its lists, its choices, is that lobe's and its design's, never Nervur's.\n\n| You want | Build it as | On what Nervur gives |\n| ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |\n| a place a person can block, and refuse it again | your window keeps the wards and the domains it refused in its cells, and refuses a link of one before it is taken | a link's card names its ward and its domain before anything is spent |\n| a report of a place | your window or design links to where you send reports, with the place's ward | the standing's ward, read by your window |\n| a page of what a person can do with a place | your design draws it, its presses asked of your window, which asks the brain | the brain's `drop`, `note`, `reinvite`, `hand`; a press is the window's |\n| a name the person goes by at each place | your window gives the note it wants at the yes: `accept` takes a `note`, kept beside the standing and never sent to the place, and the brain's `note` sets it anew | `accept`'s `note`, the brain's `note`, kept beside the standing and never sent |\n| a place named as the person would | your window reads the standing's note and the domain that vouched for it, and keeps the name it gives in its cells | the brain's `note` and `accept`'s `note` |\n| the places the person stands on, together | your window reads the relations it holds and draws them as it likes | relations are standings, the brain's `ends`; a press is the window's |\n| a board of widgets of many places | your design lays `slot`s naming placeholders of your window, each wired to a place's lobe | a slot draws the lobe its placeholder is wired to |\n| a page of parts made from what a lobe says of its methods | your design draws components named for shapes you choose, from a field of your own your faculties' seats carry | the describe and its free seat fields, the tree, a press the window carries |\n| a theme, a language, a name kept for the person | your window keeps them in its cells and draws by them | what the host tells: the device's language and theme, the screen's size |\n| the home's words in many languages | a design on the owners' road words itself by key, in any language | a design's words by key, handed the person's language |\n| a page of the organism's state, lobes and library, laid out as you like | your design's `organism` component draws what the window hands it, or your window asks the brain's `state`, `lobes` and `ends` and the library's `list` and draws them | the organism's describe, the brain's asks, the library's `list` |\n| a site's pages that draw what its visitor holds | the site's pages ask the standings the browser holds and draw the answers with their own markup | the browser port's page module, `standings()`, `ask`, `watch`; the vouch |\n| a phone app's screen | the app's page draws in your window and your design | the page module, `data-quo-link`, the window's `accept` |\n| a hand-off to the web | your window shows a link a method answers, as the home's own words, opening only on a yes | a link of the world with its ask, `world {say, yes, no}` |\n| a far lobe that tells a window \"my answers changed\" | your window invites the lobe by the ear's `invite` and hands it the invitation; the lobe accepts it through its mouth and, at each change, asks over it a method your window declares, which draws again | the ear's `invite` (`through` where your home cannot be dialed), the mouth's `accept`, asks over a relation |\n| a lobe that asks for another over some of its standings | a faculty that invites to itself, is granted the standings the owner `order`s it, and forwards the device's asks over them | the ear's `invite` and `refer`, the brain's `order`, a lobe's `nerves` |\n| the places of another home you own, seen here | your window asks that home's brain, which you own, and draws what it answers | an owner's asks afar, the brain's `state` and `ends` there |\n| a consent screen that says more | your design draws it from what the window hands it, or your own window draws its own landing; the yes is the window's `accept`, with the note you want | the link's offer, read before the yes, spending nothing |\n| a keeper of a server's boot key | a faculty that keeps each device's key in its cells and answers the unlocker's four asks, `keep`, `open`, `admit` and `rewrap`, as A server tells | the remote boot mode and the asks its unlocker makes |\n| a copy of a home kept safe, on a drive or afar | a faculty or an app that asks `backup` and `backupPiece` and keeps the sealed bytes where it likes; `nervur restore` or a port's `lay` brings it back as an older life | the brain's `backup`, `backupPiece`, a named key; the ports' restore |\n\nNervur keeps the screen safe whatever window you write: a design's tree is checked and reaches nothing of the organism,\nand a press is carried by the window and never forged by a tree. What your window hands the host to lay above the page,\n`way` (A window of your own), stands outside every tree, and no place's tree or sheet covers or presses it. Whether a\npress waits for the person's yes, and what stands above the page, are your window's own. Everything else is yours.\n\n## Installing and owning\n\n### A machine: Mac, Linux, a Pi\n\nOne script lays Nervur on a machine with nothing on it, Node included: `install/install.sh` for a Mac, Linux or a Pi,\n`install/install.ps1` for Windows, both in the package `nervur`. Run from a copy of it:\n\n```sh\nsh install.sh\n```\n\nOn Windows, in PowerShell:\n\n```powershell\npowershell -NoProfile -ExecutionPolicy Bypass -File install.ps1\n```\n\nNo address of ours serves the scripts yet: take them from the package `nervur` on npm, its `install/` folder. What the\nscripts do:\n\n- They take Node's own distribution for the machine from Node's site, `nodejs.org`, or from a mirror of it that\n `NERVUR_NODE` names, checked against the digest Node publishes for it, which the script pins. Nervur publishes no\n Node: the digest, not the address, is what is trusted.\n- The Node they lay moves with Nervur. They mark its folder with an empty `.nervur-node`, and an update that lays a\n version pinning another Node lays that one first, taken as the script takes it, from Node's site or the mirror\n `NERVUR_NODE` names (for an update, a `file:` address names a folder), and checked against the digest that version\n pins. It becomes the one that runs only once it stands whole beside, so a cut leaves the old Node or the new; on\n Windows, where a cut in the instant the program moves can leave the new one beside, running the script again lays\n it. A Node that does not match the digest, or a site that gives none, refuses the update, nothing changed. A Node of\n your own, as under `npm install -g nervur`, never moves; remove the mark to keep the script's Node as it stands.\n- They pack `nervur` from the channel, npm's own registry unless `NERVUR_CHANNEL` names another, and install that file\n with Nervur's scope alone mapped to the channel, so every other package comes from npm's own registry. npm's own\n registry is sent no token. A channel you name that reads with one is given it as `NPM_TOKEN`, named to npm for that\n channel alone and kept nowhere.\n- They lay both at `NERVUR_ROOT`: `~/.local/share/nervur` by default, `%LOCALAPPDATA%\\Nervur\\command` on Windows, whole\n or not at all, and put the command on the `PATH` of every later shell (`$NERVUR_ROOT/bin` in `~/.profile`, and in\n `~/.zprofile` on a Mac; the folder itself in the user's `Path` on Windows). A second run finds the command laid and\n lays nothing again. What the script lays every account reads and runs, and a folder above it that stood before is\n left as it was.\n- They run `nervur install` with the words given them: `sh install.sh --boot file`, and after `sh -s --` where the\n script is piped. Piped, the script asks a passphrase at the terminal it runs in (`/dev/tty`).\n- With no terminal at all, under cloud-init or another program, the boot mode is still the host's default: `file` where\n no person sits, a server, a Pi, Linux over `ssh`, so it installs asking nothing; `present` on a Mac or Linux inside a\n graphical session, which reads its passphrase from standard input and is refused with none, so name `--boot file` or\n another mode there.\n- They keep a token nowhere, so a later `nervur update` reads a channel you named with the token npm's configuration\n names.\n\n**With Node 22 or any newer already**, its newest patch, npm is the road. Nervur runs on every Node line Node itself\nstill supports, and each version is proven on the oldest of them:\n\n```sh\nnpm install -g nervur\nnervur install\nnervur state\n```\n\n`nervur install` takes the package from the registry your npm names, npm's own by default, and the organism moves\nitself as new versions come: it asks that registry as it starts and every hour. `--channel <registry>` names another\nregistry for one install or update, a mirror of your own, and the organism then asks that one.\n\nWhere Node belongs to root, make npm's global folder your account's first: `npm config set prefix ~/.nervur/installer`,\nwith `~/.nervur/installer/bin` on your `PATH`.\n\n`nervur install` lays the organism in `~/.nervur/organism/`, listening on port 9110 on loopback, and a service of your\naccount: a launchd agent on a Mac, a systemd user unit on Linux and a Pi. Whoever is present at the account owns it.\n\n**A design to be born in.** `nervur install --design <quo.json>` hands the installer the file a site writes for its\norganism: its `organism.design` names the design, and `design.json` with `design/` stand beside it. It is read and\nchecked as a site's is, refused whole where it fails, and the organism wears it from its first screen; with none handed\nit wears the floor's, and an owner's `wear` moves either. Handed again over an organism already laid, it lays the\ndesign too: the organism starts again and wears it, unless an owner's `wear` chose another. The same file may name the\nclass of the screen's size, `size`, as a site's does: the organism's folder keeps it, and the screen is drawn and told\nin that class whatever the window's width; with none named the class is the width's. A file that names a `size` and no\ndesign is taken too: the organism wears the floor's design under it.\n\n**The boot mode** is how the organism gets its boot key at each boot, chosen at the first install, moved by any later\n`nervur install --boot <mode>`:\n\n| Mode | What it is | Its price |\n| ---------- | ------------------------------------------------------------ | ----------------------------------------------------------------- |\n| `present` | a passphrase, asked twice; the default where a person sits | after every reboot it waits for `nervur start` and the passphrase |\n| `file` | `boot.key` in the organism's folder; the default on a server | whoever reads that file owns the organism: keep a copy off it |\n| `keyring` | the login keychain on a Mac, Secret Service on Linux | the account's keychain holds the key |\n| `hardware` | sealed to a Mac's Secure Enclave; refused elsewhere | the organism opens on that Mac alone |\n| `remote` | keepers over Quo, each `--keeper <invitation-file>`, `--end` | a keeper answers it; else the chain ends at `--end`, `present` |\n\nA keeper is any organism, built of whatever you choose, that draws the invitation the device takes and answers the\ndevice's unlocker over the relation it gives, each device apart by the relation that asks. Its four methods take text\nargs, the key as the 64 hexadecimal digits of its 32 bytes and the fingerprint as the device words it: `keep {key,\nfingerprint}` takes the device's key and the first fingerprint it boots, once; `open {fingerprint}` answers the key to a\nfingerprint admitted and refuses any other; `admit {key, fingerprint}` admits one more, as after an upgrade, and\n`rewrap {key, next}` moves the key, each for whoever shows the key the keeper holds. A refusal is the error `refused`,\nand an ask taken answers null, `open` aside. A keeper's check stops a changed device, not a thief: a fingerprint is the\ndevice's own word for what it runs.\n\n### A server\n\nA server is a machine with many accounts, and Nervur keeps three parts of it apart. The **machine** is its\nadministrator's, whoever holds root: its accounts, ports, firewall, domain, TLS and services are laid by that person,\noutside the graph, never by an organism. The **self** is the organism's own account: it boots the organism and keeps\nits folder, its store and its boot key to itself. The **body** is a second account, the **work account**, where every\norgan runs but the self's own, `shell`, `disk`, `network` and every repo's organ, and whatever they start, git, npm\nor an agent. Nothing the body starts reads the self's folder, its store or its boot key.\n\nOne account holds one organism. Another organism on the same machine takes another account, and its own body, and the\ntwo never see each other. Which of these are you?\n\n- **You own the machine.** You are its administrator and every person on it, with one organism or several: _You own the\n machine_.\n- **Another person administers it, and you install.** A company's server, where you hold an account and no root: _You\n hold an account_, after _What the administrator prepares_, which is that person's page.\n- **Someone lays your organism for you,** and you may never log in to the machine: _Laid for you_.\n\n#### What the administrator prepares\n\nRoot prepares each person once, and installs no Nervur. Nothing below is written by an organism: an organism that\ncould make accounts could make any account.\n\n1. **The person's account**, an ordinary one: its own home, its own group, no `sudo`. This is the self.\n2. **The work account**, another, with no login shell and no password, named by you: `bob-work` for `bob`. This is the\n body. It is a second account of the machine, never a second login: nobody signs in as it, by a password, a key or\n `su`, and the person's organism alone starts programs as it.\n3. **One rule**, so the person's account starts programs as the work account, asking no password, and never the other\n way. In a file of `/etc/sudoers.d/`, mode `0440`, checked with `visudo -c`:\n\n ```text\n bob ALL=(bob-work) NOPASSWD: ALL\n ```\n\n4. **Lingering**, so the person's organism starts at every boot with no one logged in, and after the machine restarts:\n `loginctl enable-linger bob`. Without it the install says so and the organism starts only while its account has a\n session.\n\nOn Debian and the systems that follow it the accounts are made so:\n\n```sh\nuseradd --create-home --shell /bin/bash bob\nuseradd --create-home --shell /usr/sbin/nologin bob-work\n```\n\nBesides these, the person needs:\n\n- **A Node every account runs**, 24 or newer, laid by the machine, such as the distribution's own or one under\n `/usr/local`: the body runs on the Node the install runs on, so a Node kept in a person's home would close the body\n out.\n- **A way in:** their public key in the account's `~/.ssh/authorized_keys`, and, where the machine limits who may sign\n in, their name in `AllowUsers`. Nervur asks nothing more of SSH.\n- **A port block**: an organism takes the port it is given, its web the one after it and its WebSocket the one after\n that, `9120`, `9121` and `9122`. Two organisms cannot hold one port, and the second says so plainly, naming the port,\n so give each person a block of their own.\n\nGive each person, in one message: the machine's name, their account and their work account's name, their port, and what\nis open to the world. The machine's other parts stay yours: opening a port, routing a domain to it,\nTLS and a proxy.\n\nWhat stays yours, and is worth a line each: the machine's **swap and memory**, an organism at rest holding some 650 MiB\nresident and its body more under work, so budget each person's organism that, and cap each account with the machine's\nown tools if one must not starve the others; **`hidepid`** on `/proc`, so an account sees no other account's\nprocesses, which it otherwise sees by their command lines; and **every person's leaving**, below.\n\n#### You own the machine\n\nYou hold root, so you prepare for yourself what an administrator prepares for others, and install as that account.\nNever as root: the organism would be root, and so would everything its body starts. The install says so where the\naccount is root, and lays it all the same.\n\n- **One organism, and nothing on the machine you do not trust:** an ordinary account is enough. Install with no\n `--work`: the body runs as the same account, and the install says what that costs, that any program `shell` starts may\n read the organism's folder, its store and its boot key.\n- **Anything you do not fully trust runs on it**, an agent, a repo's build, a faculty someone else wrote: lay the closed\n body. Prepare the two accounts as above, then install with `--work`.\n- **Several organisms:** one account each, a pair for each if you want each body closed, each with its own port block.\n They never see each other, whoever lays them. The accounts are yours to name: `ops` and `ops-work`, `lab` and\n `lab-work`.\n\nThen the same steps as the person's, below, as that account.\n\n#### You hold an account\n\nAn administrator prepared your account. Log in as it, then:\n\n```sh\nnpm config set prefix ~/.nervur/installer\nexport PATH=\"$HOME/.nervur/installer/bin:$PATH\"\nnpm install -g nervur\nnervur install --port 9120 --work bob-work\nnervur state\n```\n\nThe first two lines make npm's global folder your own, where the machine's Node belongs to root. The install proves,\nbefore it lays anything, that your work account starts programs for you and runs the Node, and refuses naming what is\nmissing: the rule the administrator lays, or the folder the work account does not pass. It opens your home to be passed\nand never listed, as it does its own folder, and nothing else of yours. What it lays is yours and the work account's:\nno other account of the machine lists or reads the organism's folder, its store, its key or its service's files, and\nnone lists the folders of code beside them, which the work account reads by name.\n\nYour home stays as private as the folders in it: the install opens only the way through, so keep what is private in\nfolders of mode `700`.\n\nFrom then on the organism is yours alone: `nervur state`, `nervur stop`, `nervur start`, `nervur backup`,\n`nervur update`, and `nervur wipe` to end it, which removes the organism and the body's folder it made and nothing of\nanyone else's. Whoever is present at your account owns it. It starts again by itself when the machine restarts, and an\nadministrator who removes you ends it with you.\n\n#### Reaching it\n\nA server is reached by others: `nervur install --public <host>` listens on every interface and announces\n`tcp://<host>:9110`. Organisms that cannot be dialed hold lines to it over a WebSocket: `--ws ws://<host>:9112/quo` with\nthat port open, or `--ws wss://<host>/quo` behind a TLS proxy of the machine forwarding to `ws://127.0.0.1:9112/quo`.\nBoth ports follow the organism's own: with `--port 9120` they are 9120 and 9122. Opening them, DNS, TLS and the proxy\nare the administrator's, never the organism's.\n\n#### Laid for you\n\nThe administrator may also lay the organism for a person who never logs in to the machine, a colleague, a team, an\nagent, or a customer's server laid by cloud-init or a pilot. The administrator prepares the accounts as above, then\nruns the person's install as the person's account, with a claim. A server laid from afar is claimed as an edge is: its\nlayer draws a claim and names its file at the first install, and whoever names that claim takes the anchor from\nwherever it stands.\n\n```sh\nopenssl rand -hex 32 > claim.txt # drawn by whoever lays the server, kept until the anchor is taken\nnervur install --boot file --claim claim.txt\n```\n\nNo one is present then, so the configuration names no present lobe and no anchor, and the console holds nothing of the\nbrain. The organism serves its web from its first boot, on the port after `--port`, 9111, and answers\n`POST /.nervur/claim` with `Authorization: Bearer <claim>` with its newest first invitation, `{\"invitation\": \"\u2026\"}`;\nevery other asker, and the claim before the first invitation is handed, hears a path that is none, so it is asked\nagain. Whoever accepts that invitation holds the anchor; the anchor passed on, the claim gives no one the organism. The\nweb listens on loopback unless `--public` names a host, so from afar the machine's proxy forwards `https://<host>` to\n`http://127.0.0.1:9111` with TLS: over plain http the claim and the invitation cross in clear. Until the anchor is taken\nwhoever reads the claim holds the organism, wherever the layer put it, user data a cloud's metadata service serves among\nthem. The claim is a first install's word: a later install names the same claim or none. A `nervur reclaim` at the\nmachine forgets it, and the console is present and the anchor again.\n\n#### When a person leaves\n\nThe person ends their own organism with `nervur wipe`, which asks them to type `wipe`, then removes it, its store and\nthe body's folder it made. The machine is the administrator's to clear, in this order, so nothing of the person still\nruns when their account goes:\n\n1. Turn lingering off and end the account's session: `loginctl disable-linger bob`, then `loginctl terminate-user bob`.\n2. Remove both accounts and their homes: `userdel -r bob`, `userdel -r bob-work`.\n3. Remove the rule: the file of `/etc/sudoers.d/` made for them.\n\nAn account removed without its person's `wipe` takes the organism with it, store and key, and no one holds a copy: a\nperson who may be asked takes a `nervur backup` first, and every other organism on the machine stands as it did.\n\n### A browser\n\nA browser holds its visitor's organism, a home in a tab, in a worker of the site; the site serves the browser port as\nplain files. See The browser and the web.\n\n### A phone\n\nAn app embeds the browser port in its web view: it adds `@nervur.org/installer-phone` and Capacitor, runs\n`nervur-phone-lay www organs.json` before `cap sync`, and loads `nervur/page.js` as a site does. The store stands in the\napp's own files, the boot key in the iOS keychain or the Android Keystore; native organs are the app's plugins, named in\n`organs.json` by digest. The design the app's organism is born in is named as a site names it, `organism.design`, in a\n`quo.json` handed to the same command, each file told by its name, `nervur-phone-lay www organs.json quo.json`, or\n`nervur-phone-lay www quo.json` for an app with no organ, with the design's files laid in `www/nervur` as a site lays\nthem; the same `quo.json` names the class of the screen's size, `size`, as a site's file does. The window the organism\nwears is named there too, `organism.window`, as a site names it, its source handed to the same command as a file named\n`window.js`, `nervur-phone-lay www quo.json window.js`, which lays it at `www/nervur/window/faculty.js`. It needs iOS\n17.4 or a current Android System WebView. Whoever holds the app is present and owns it; the package's `sample/` is a\nwhole app.\n\nThe app's page is the organism's own screen: `<div data-quo-screen></div>` is the person's screen, what the window lays\nabove the page standing there as on a desktop. Beside it the page holds `<div data-quo-link></div>` and takes a link\nthe device hands it after its `#`, at its load or while open: the consent is drawn there, a yes redeems and accepts and\nthe screen draws what the window's `accept` answers, a no keeps nothing, and the element is left empty, saying `none`,\nthe link taken out of the address, with no load of the page.\n\n### An edge, and any host laid from afar\n\nWhere no one is present, an organism is laid from another machine. The Node port gives the edge's cargo: a Cloudflare\nWorker whose organism lives in one Durable Object. Whoever lays it draws one secret and sets it on the Worker, `CLAIM`,\nwith `DOMAIN` and, where wanted, `PLACE` or `WITHIN`. The boot key is the object's own: drawn at its first boot and kept\nin its storage, the same at every boot after, so no layer holds it, and whoever holds the Cloudflare account holds the\norganism. No one is present, so the organism names no anchor: it keeps its first invitation and answers it to whoever\nnames the claim, and whoever accepts that invitation holds the anchor. It keeps that same invitation through every\nrestart of its object, an eviction after a few idle seconds among them, so one fetched and accepted is still the one to\nknock on whenever its owner first asks; another is drawn only where the organism comes to be reached at other addresses,\nand that one ends the one before. The Worker answers these routes, each by\n`Authorization: Bearer <CLAIM>`, and to anyone else as a path that is none:\n\n| Route | What it does |\n| ----------------------- | -------------------------------------------------------------------------------------------- |\n| `POST /.nervur/claim` | the newest first invitation |\n| `POST /.nervur/lay` | a backup's bytes, with `x-nervur-key`, or a move's file with none; `?over` replaces a store |\n| `POST /.nervur/arrive` | draws the key a move is sealed to, answering `{\"key\": \"<hex>\"}` |\n| `POST /.nervur/stay` | the old copy's word that the new one never ran |\n| `POST /.nervur/reclaim` | `{\"challenge\"}`; then again with `x-nervur-signature`, a recovery key's signature as 128 hex |\n\nAn edge moves to a version by being laid again, the store tried and kept or brought back, and is wiped\nby deleting what was laid. A machine laid from afar is a machine, claimed by `nervur install --claim` (A server).\n\n**An edge, by hand.** The cargo stands in the published `@nervur.org/installer-node`, under `cargo/`: `worker.js`, the\nmain module, beside the WebAssembly modules it imports, every file named by `cargo/manifest.json`\n(`{\"main\": \"worker.js\", \"files\": [...]}`). The Worker binds one SQLite Durable Object, the class `Edge`, as `EDGE`, and\nruns without Node compatibility. It takes Cloudflare's own tool, `wrangler`, signed in to your account:\n`npx wrangler login` opens a browser to sign in, or, on a machine with none, `CLOUDFLARE_API_TOKEN` names an API token\nmade in the dashboard from its template \"Edit Cloudflare Workers\", with `CLOUDFLARE_ACCOUNT_ID` your account's ID. An\naccount answers at `<your subdomain>.workers.dev` once its subdomain is chosen, once, in the dashboard's Workers page;\n`workers_dev = true` serves the Worker there. In a folder holding the cargo's files:\n\n```sh\nnpm pack @nervur.org/installer-node && tar -xzf nervur.org-installer-node-*.tgz\ncd package/cargo\nnpx wrangler login # or: export CLOUDFLARE_API_TOKEN=... CLOUDFLARE_ACCOUNT_ID=...\ncat > wrangler.toml <<'EOF'\nname = \"acme-edge\"\nmain = \"worker.js\"\ncompatibility_date = \"2026-07-01\"\nworkers_dev = true\nno_bundle = true\nfind_additional_modules = true\nrules = [{ type = \"CompiledWasm\", globs = [\"**/*.wasm\"] }]\n\n[[durable_objects.bindings]]\nname = \"EDGE\"\nclass_name = \"Edge\"\n\n[[migrations]]\ntag = \"v1\"\nnew_sqlite_classes = [\"Edge\"]\n\n[vars]\nDOMAIN = \"acme-edge.<your subdomain>.workers.dev\"\nEOF\nopenssl rand -hex 32 > claim.txt # keep it off this machine too\nnpx wrangler deploy\nnpx wrangler secret put CLAIM < claim.txt\nuntil curl -fsS -X POST -H \"Authorization: Bearer $(cat claim.txt)\" https://acme-edge.<your subdomain>.workers.dev/.nervur/claim > claimed.json; do sleep 5; done\nnode -pe 'JSON.parse(require(\"fs\").readFileSync(\"claimed.json\", \"utf8\")).invitation' > invitation.txt\nnervur accept edge --text invitation=invitation.txt # on your machine: you hold the anchor\nnervur ask edge state\n```\n\n`DOMAIN` is the host the Worker answers at, a domain of your own routed to it or its `workers.dev` name. Where wanted,\n`[vars]` names where the organism lives: `PLACE`, a Durable Object location hint, one of `wnam`, `enam`, `sam`, `weur`,\n`eeur`, `apac`, `oc`, `afr`, `me`, the region the object is placed nearest at its first ask, where it stays for life, a\nlater `PLACE` moving nothing; or `WITHIN`, a jurisdiction, `eu` or `fedramp`, whose data never leaves it. `WITHIN` names\nthe object itself, so changing it later reaches another, empty object, never the organism: set it before the first\ndeploy, and never after. The claim is a path that is none until the organism has booted and handed its first invitation,\nso it is asked again. `claim.txt` lays, moves and reclaims the edge by the routes above, and opens no backup: one\ncarried off to open elsewhere names a public key of yours, the brain's `backup {keys}`, whose secret opens it there, on\nanother edge as `x-nervur-key`. A new version is the same `wrangler deploy` in a newer package's cargo, with the same\n`wrangler.toml`; the claim and the boot key stay.\n\n### A container\n\nA container with a disk that outlives it is a machine: install as on Linux, `--boot file` or `keyring`, the folder\n`~/.nervur` on its volume. Nervur ships no image.\n\n### Owning from afar\n\nAn organism invites an owner by the brain's `invite`, and the other organism accepts it under a name of its own:\n\n```sh\nnervur ask brain invite '{\"waits\":null,\"lives\":null}' > invitation.txt # on the server\nnervur accept server --text invitation=invitation.txt # on the laptop\nnervur ask server state\n```\n\n`waits` is how long the invitation waits for its knock and `lives` how long the relation lives, in milliseconds, `null`\nfor no end. `\"anchor\": true` makes the next anchor, who passes the anchor on. The person present may\nalways take a far anchor back by dropping it.\n\n## Using an organism\n\n### The command\n\n`nervur` alone prints every command. On a machine:\n\n| Command | What it does |\n| ------------------------------------------- | ------------------------------------------------------------------------------- |\n| `install [version] [digest]`, `update` | one act: lays the organism, or moves it to a version, tried before it is kept |\n| `start [--floor]`, `stop` | starts and stops it; `--floor` lays the shipped console and window again |\n| `state`, `card`, `version`, `screen` | the state in full; its card; the versions; the screen's address on this machine |\n| `ask <placeholder> [method] [args]` | asks over a placeholder the console holds, `brain` the organism's own |\n| `lobe <lobe> [method] [args]` | asks a lobe through the brain; no method describes it |\n| `accept <placeholder> <invitation> [note]` | accepts an invitation; `accept <link> [placeholder] [note]` takes a link |\n| `offer <link>` | reads a link's offer, what it says and its spans, and spends nothing |\n| `forget <placeholder>`, `relations`, `ends` | ends an accepted relation; lists them; every occupant and standing |\n| `backup [file]`, `salvage [file]` | a backup to a file of yours; what still opens of a damaged store |\n| `restore <file> [salt]` | a backup restored where no organism stands, as a new life |\n| `arrive`, `move <key> [file]`, `stay` | a move to another device (Life across devices) |\n| `rewrap`, `rekey [--cipher <name>]` | a new boot key; a new boot key and data key |\n| `reclaim` | reclaims the organism by a recovery key |\n| `repos` | lays the jailer, the first time you want a repo |\n| `mcp` | serves MCP on standard input and output to a model present at the device |\n| `wipe` | destroys the organism and all it holds, once you type `wipe` |\n\n`args` is one word of JSON: `'{\"lives\": null}'`. `--text <field>=<file>` gives a file's text as one field of the args,\nso a secret stays out of the shell's history:\n`nervur lobe <repo> setToken '{\"name\":\"NPM_TOKEN\"}' --text value=token.txt`. `--json` prints each answer as data, for\nprograms. `--follow`, on `ask` and `lobe`, waits for the end of a job the answer names, printing the job whole and\nexiting on its code. `--home <folder>` names another organism's folder, for tests.\n\n### The brain's asks\n\nAn owner reaches the organism through the brain; each is `nervur ask brain <method> '<args>'`, or the same ask over a\nplaceholder of an organism owned from afar:\n\n| Group | Methods |\n| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |\n| Faculties and lobes | `create {faculty, wiring?, cells?, sealed?}`, `version {lobe, faculty, settled?}`, `settle`, `switchOff`, `switchOn`, `tearDown`, `lobes` |\n| Organs | `addOrgan {id, blueprint, reach, half}`, `removeOrgan`, `settleOrgan` |\n| Wiring | `order {node, order: {termination, placeholder?, until?}, note?}`, `unwire` |\n| Reaching | `ask {lobe, method, args, timeout}` |\n| Owners | `invite {waits, lives, anchor?, refer?, public?, through?, note?}`, `drop`, `recoveryKeys {keys}` |\n| Keys | `rewrap`, `rekey`, `move {to}` |\n| Who and where | `ward`, `addresses {at}`, `hand {far, at}`; `card` reads them |\n| Ends | `accept {relation, invitation?, link?, note?, lobe?}`, `note`, `reinvite`, `drop`; `taking`, `cede {far, to}`, `take {handed, key, relation}` |\n| Life | `backup {keys?}`, `backupPiece {mark, at, length}`, `upgrade {version, digest}`, `time {at}` |\n| Limits | `limit {name, lobe?, value?}`, `limits` |\n| Letters | `repost`, `forget`, `cancel` |\n| State and character | `state {cursor?}`, `ends`, `card`, `character`, `setCharacter`, `portrait` |\n\nEach method's blueprint says the rest: `nervur ask brain` describes them all. `lobe <id> ...` is the brain's `ask`.\n\n**Limits are defaults.** Every bound an owner meets moves by `limit`: for one lobe, or for every lobe with no\nword of its own. Among them `longestBudget`, `longestTimeout`, `lobeMemory`, `queue.share`, `letters.attempts`, `space`,\n`invitations`, `note`, `still`, `within`, `migrate`, `changes` and `tree.nodes`. `limits` reads the words kept. The\norganism's time is set by `time {at}`, milliseconds since 1970.\n\n### The console, the screen and a model\n\nThe console is the terminal's lines: whatever `nervur` types after the command is a line to the console's present lobe.\nThe screen is the window: `nervur screen` names its page on `127.0.0.1`, open to this account's programs alone: this\nhome's own, asked of the organism where it runs, or in words why this home's screen is not available, as when another\norganism of the account holds its port. It shows the organism, its lobes, the library and the place the person stands\non; a lobe is at `/~/<ID>`. What more a person is offered there, other homes, devices let in, lists and choices, is a\nwindow's of your own (Where Nervur stops). Only a host where a person sits holds a screen: a Mac, Windows, Linux inside\na graphical session, or any machine whose first install said `--screen`; on a server, a Pi\nor Linux over `ssh`, `nervur screen` answers that the host holds none, and the organism is owned at its console or from\nafar. A browser draws in the site's page, a phone in its app; an edge draws nothing.\n\nA model is present at the console as a person is, and holds no more: `nervur mcp` serves it the tools `ask` and `lobe`,\neach typed at the console, and the resources `nervur://portrait`, `nervur://guide` and `nervur://state`. A method marked\n`irreversible` is hinted destructive. `portrait` answers Nervur's guide, the organism's character and each lobe with its\nown guide.\n\n## Life across devices and years\n\n- **A backup** carries the self, never the body: `nervur backup <file>`, never written over, says how it opens: by the\n passphrase and the salt it names, or by a copy of `boot.key`. The brain's `backup {keys}` adds public keys, as\n `nervur arrive` shows them, whose secrets open it too. A repo with no lobe elsewhere stays behind, and the backup\n names it first: keep a lobe of every repo on a second organism.\n- **Taking a backup by asks**, from a faculty, an app or afar: `backup` answers at once `{sequence, mark}`, and the\n organism writes on, however large it is. Ask `backupPiece {mark, at, length}` from `at: 0`, each `at` the one before\n plus the bytes it gave: a piece answers once its bytes are written, so no ask waits on the whole. The piece that\n holds the last byte adds `bytes`, the size, `unread`, each cell left out, and `lost`; then `backupPiece` at `bytes`\n answers no bytes and takes the backup from beside the store. A writing that failed answers the next piece with why.\n A move's pieces go the same way, and its ask at `bytes` answers the last piece and stops the old copy.\n- **A restore** is a new life: `nervur restore <file> [salt]` where no organism stands. With the salt the\n backup named, it asks the passphrase it was made under; without, it reads the boot key it was made under as hex on\n standard input, `nervur restore <file> < boot.key`. Lobes, cells and wiring stand, and its repos are laid under its\n own home; every relation the organism gave is dropped, listed by `ends` and `state` as `ungiven` until it is\n reinvited or dropped; standings it holds go on.\n- **A move** is the same life elsewhere, every relation whole: `nervur arrive` on the new device shows a key;\n `nervur move <key> [file]` on the old seals the organism to it and stops the old copy for good;\n `nervur restore <file>` on the new opens it. `nervur stay` on the old undoes the stop while the new copy never ran.\n From afar, the brain's `move {to}` then `backupPiece` carry it; an edge arrives by `POST /.nervur/arrive` and\n `/.nervur/lay`. The key is the whole of what decides where the organism goes: whoever swaps it on its way gets the\n organism. So the person compares the key the new device shows with the one the move names before it goes; an app\n that carries the key can make that easy, showing both sides a few words or digits drawn from the key's SHA-256 for\n the person to match, and refusing until they match.\n- **A standing handed** moves one relation the organism holds to another organism its owner asks, the place told\n nothing: the brain's `taking` there answers `{key, until}`, a key that stands until then beside any other drawn,\n `cede {far, to}` here forgets the standing and answers it sealed to that key, the same bytes again for\n `removedKeysSpan`, and `take {handed, key, relation, lobe?, note?}` there keeps and grants it as `accept` does, its\n numbers going on; a backup of this copy from before the hand is a stranger at the place once the new holder had two\n asks answered.\n- **Keys.** `nervur rewrap` changes the boot key alone; `nervur rekey` changes the data key too, so a former holder of\n the key opens nothing written after.\n- **Recovery keys** prove the right to reclaim and open nothing:\n `nervur ask brain recoveryKeys '{\"keys\":[\"<ed25519 public key, hex>\"]}'`. A set replacing another holds only after a\n week by default, the install's word `recoveryKeyDelay` moving it, so whoever took a device cannot replace them before\n the owners reclaim. `nervur reclaim` shows a challenge; sign it with a key's secret off the device and type\n the signature back, taking whatever time signing needs: the challenge stands until its signature or a refusal ends\n it, even where the host lets the organism go meanwhile, as an edge does when idle. Every relation to the brain ends,\n and the anchor is taken anew.\n- **An update** is tried before it is kept: `nervur update [version] [digest]` stops the organism, a run going lost\n to it as to a crash, keeps the old package and store aside, boots the new version in place on a copy of the store\n as a trial with the world held, and keeps it or brings the old back by itself; that boot moves the installer's\n organs and the lobes on its faculties, and the update says what moved and what stayed, run again where one stayed.\n It is the same on a\n machine no one is present at, laid with `--claim`. A version older than the one running is a move onto it. From\n afar: `upgrade {version, digest}`. Until 1.0.0 every organism updates itself too: its process asks the registry it was\n laid from or last updated by, npm's own unless `--channel` named another for an act, as it starts and every hour, and\n runs `nervur update` onto a newer version, its outcome in `organism.log`; one laid from a package at hand\n (`--package`) has no channel and checks nothing. A start, a trial and a stop wait on the process's silence, so an\n organism whose store takes long to open is waited for. A browser and a phone try each version at its first boot\n against a copy of the store, an edge when laid again.\n- **The way back** always stands: `nervur stop`, then `nervur start --floor`, lays the console and window the installer\n ships, whatever skin was chosen, and the window wears the installer's design again, whatever design was worn: the\n design lobe that was worn stands, and is worn again from the home.\n- **A damaged store** is read by `nervur salvage [file]`, with no boot. `nervur wipe` ends the organism for\n good.\n\n## A repo to build in\n\nEverything you build stands in a repo, kept by a repo lobe on your organism, on a host with a body: the floor's repo\nfaculties, which the Node port lays the first time you want a repo.\n\n**What it holds**:\n\n```text\npackage.json its version, and its scripts: gate and conform always\ntools/conform.mjs the repo's own rules, run over what would enter main\nfaculties/<label>/ a faculty each: faculty.js, versions.json, its tests and evidence\norgans/<id>/ an organ each: graph.json, host/build\ndesigns/<name>/ a design each: design.json, tokens/, skin/, components/, versions.json\nREADME.md, LICENSE.md, .gitignore\n```\n\nAny other folder is its owners' own, packages among them, and Nervur reads none of it. No `package.json` names\n`@nervur.org/genome`, and `@nervur.org/floor` names none among its dependencies, so nothing installed shadows the lent\none: the organism lends the genome it runs at `repos/node_modules/@nervur.org/genome`, one folder up from every repo, so\n`import { replay } from '@nervur.org/genome/evidence'` resolves in its tests and build. The lent genome\ncarries Nervur's guide, this paper and the changelog in its `docs/`: an agent authoring a repo reads them at\n`../node_modules/@nervur.org/genome/docs/`, at the organism's version. `.env` is written from the copy's keys before\neach run, so `.gitignore` names it, and every `dist/`.\n\n**Its scripts** are the only commands a repo lobe runs: `gate`, run before each commit, and `conform`, the\nrepo's own rules; by convention also `format`, `lint`, `types`, `test`, `build`, `release`, `text` (writes each\nfaculty's `faculty.js` and `versions.json`) and, for a design repo, `design`.\n\n**Making one.** One command makes the repo and its repo lobe, on a host with a body, and answers the lobe:\n\n```sh\nfield() { node -pe \"JSON.parse(require('fs').readFileSync(0,'utf8')).result$1\"; }\nrepo=$(nervur repo acme --starter --json | field .lobe)\n```\n\n`nervur repo acme` lays the jailer, `nervur.repos`, the lobe that alone runs git, where the organism has none (a first\nrepo is the first time anyone wants one, and no install lays it), set up at the disk's folder; creates a repo lobe on the\nfaculty `nervur.repo`, wired to the jailer and to the organism's ear, mouth, scheduler and library; grants it the folder\n`acme`, a lowercase name that begins with a letter and may carry its domain, as `example.com`; and begins it with its\n`init`, waiting for that job's end as `--follow` does. Said in a line, it names the repo lobe; with `--json` it answers\n`{\"result\": {\"folder\", \"jailer\", \"lobe\", \"init\"}}`, `init` the job whole. It exits on the code the `init` ended on, and\na repo lobe holding the folder then is yours to begin again by the same command. `nervur repos` alone lays the jailer.\n\nRun again, it makes nothing twice: a jailer that stands is used, a folder a repo lobe holds already answers that lobe,\nand a repo lobe whose `init` failed begins again. A folder the jailer holds granted to no lobe is refused, and a name the\njailer refuses leaves no lobe made.\n\n`--starter` lays a `package.json` with `gate` and `conform`, `tools/conform.mjs`, one faculty, `com.example.acme`, and\na `.gitignore` keeping out `.env` and `node_modules/`, as the first commit; `README.md` and `LICENSE.md` are yours to\nwrite; without it the repo begins empty, for the first commit to fill. The folder is `repos/acme` under the disk's\nfolder; author it there with your own editor and agent, or write through the lobe.\n\n**Committing.** `commit {message, files?, paths?, executable?, gate?}` writes `files` (path to text), runs the gate,\nthen the two checks: Nervur's check of the parts and your `conform`. Any red refuses the whole and puts every\nfile back. A commit with no `files` commits what the folder holds. Name `paths` instead, each a file or a folder of the\nrepo, and it commits the changes of those paths alone, added, changed or removed, leaving the rest of the folder as it\nstands: the way for a session to commit its own work where another works in the same folder. The gate still runs on the\nfolder as it stands, the two checks on the repo as that commit leaves it, and `paths` holding no change refuse it. The\ngate runs after `npm ci` where a\n`package-lock.json` stands, so `node_modules` is the lockfile's, and nothing patched there by hand survives. A commit is\na job: it answers `{job}` at once, and `job {job}` reads it whole, its `ended` `{code, out, err}` once it ends, code 0\ncommitted. `--follow` waits for that end, told by the organism and never asked again, prints the job whole and exits on\nits code:\n\n```sh\nnervur lobe \"$repo\" commit '{\"message\":\"reminders\"}' --follow\n```\n\nA `build`, a `pull`, a `push` and an `init` are jobs alike.\n\n**Telling a version.** The repo's version is its root `package.json`'s `version`. A commit that raises it is tagged\n`v<version>`, and the tag tells every faculty, organ and design version its commit holds; from then those bytes never\nchange. A part's version stays in progress, free to change, until a tag tells it. A told version that\nmust change takes a new version.\n\n**Into the library.** The library takes a told version from the repo lobe, by its label, checks the digest, and keeps it\nunder the road `<repo lobe>@<version>`. A lobe is then created on its digest:\n\n```sh\noffer='{\"road\":\"'\"$repo\"'\",\"kind\":\"faculty\",\"label\":\"com.example.reminders\",\"version\":\"0.1.0\"}'\ndigest=$(nervur lobe library add \"$offer\" --json | field .digest)\nlobe=$(nervur ask brain create '{\"faculty\":\"'\"$digest\"'\",\"wiring\":{\"scheduler\":\"scheduler\"}}' --json | field .id)\n```\n\nA faculty's text held in a file enters by your hand instead:\n`nervur lobe library add \"$(node -p 'JSON.stringify({source: require(\"fs\").readFileSync(\"faculty.js\", \"utf8\")})')\"`,\nkept under `hand@<version>`, by the Node every install lays. Before a lobe stands, the floor's window and terminal show\nthe faculty as the library keeps it: its placeholders, the organs it becomes a skin lobe of, whether it talks to the\nworld.\n\n## A faculty\n\nA faculty is one module of JavaScript: its default export a class extending `Faculty` from `nervur:faculty`, its static\n`blueprint` naming its name and version. Its source is named by its SHA-256, the digest. Each ask runs on\na fresh instance, in a cage with no clock, no chance and no I/O: time and chance come from the stamp, the world only by\nasks. Whatever must last stands in its cells. The cage holds the language's own objects and nothing of a browser's or\nNode's: no `URL`, no `TextEncoder`, no `Intl`, no timer. What `@nervur.org/genome/standard` gives works there as on the\nhost, so a faculty that bundles it checks a tree as the screen does; any other module it bundles must reach for no more.\n\n### A whole example\n\nA reminder faculty: it keeps reminders, sets an alarm with the scheduler by a letter, is rung once, and draws itself.\n\n```js\nimport { Faculty } from 'nervur:faculty';\n\nexport default class Reminders extends Faculty {\n static blueprint = {\n name: 'com.example.reminders',\n version: '0.1.0',\n description: 'Keeps reminders and rings each once, at its time.',\n guide: 'Ask `add` with a text and a wall time in milliseconds; `list` reads them; the screen draws them.',\n methods: {\n add: {\n description: 'Keeps a reminder and sets its alarm. Answers its id.',\n kind: 'writing',\n args: {\n type: 'object',\n properties: { text: { type: 'string', minLength: 1, maxLength: 200 }, at: { type: 'integer', minimum: 0 } },\n required: ['text', 'at'],\n additionalProperties: false,\n },\n result: { type: 'object', properties: { id: { type: 'integer' } }, required: ['id'] },\n errors: ['refused'],\n },\n list: { description: 'Every reminder, the rung ones marked.', kind: 'reading' },\n ring: { description: \"The scheduler's alone: a reminder's time came.\", kind: 'writing', askers: ['scheduler'] },\n draw: { description: 'The reminders as a tree.', kind: 'reading' },\n },\n placeholders: { scheduler: 'nervur.scheduler' },\n };\n\n *add(args) {\n const refused = this.checked('add', args);\n if (refused !== undefined) return refused;\n if (args.at <= this.stamp.time) return this.error('refused', 'a reminder rings later than now');\n const id = (this.cells.get(['next']) ?? 0) + 1;\n this.cells.set(['next'], id);\n this.cells.set(['reminder', id], { text: args.text, at: args.at, rung: false });\n // A letter: the alarm is set exactly once, whatever happens after this answer.\n yield {\n placeholder: 'scheduler',\n method: 'set',\n args: { at: args.at, method: 'ring', args: { id } },\n letter: { lives: 86_400_000 },\n };\n return { id };\n }\n\n list() {\n return this.cells.range({ prefix: ['reminder'] }).cells.map(({ key, value }) => ({ id: key[1], ...value }));\n }\n\n ring(args) {\n const kept = this.cells.get(['reminder', args.id]);\n if (kept === undefined) return null;\n this.cells.set(['reminder', args.id], { ...kept, rung: true });\n return null;\n }\n\n draw() {\n const rows = this.list().map((one) => ({\n t: 'li',\n a: {},\n k: String(one.id),\n c: [one.rung ? `${one.text} (rung)` : one.text],\n }));\n return {\n t: 'main',\n a: {},\n c: [\n { t: 'h1', a: {}, c: ['Reminders'] },\n { t: 'ul', a: {}, c: rows },\n ],\n };\n }\n}\n```\n\nSaved as `faculties/com.example.reminders/faculty.js`, with `versions.json` naming its digest, committed under a raised\nversion, added to the library and created with `wiring: {\"scheduler\": \"scheduler\"}`, it runs:\n`nervur lobe <ID> add '{\"text\":\"Call home\",\"at\":1893456000000}'`, and the screen shows it at `/~/<ID>`.\n\n### The blueprint\n\nA blueprint holds `name`, `version`, `methods`, and where wanted `description`, `guide`, `openGuide`, `placeholders`\nand `assets`; the standard refuses any other field.\n\n- **`name`**: a publisher's reverse domain of two labels or more, then the capability, lowercase:\n `com.example.reminders`. The folder under `faculties/` is its label, the same name.\n- **`version`**: three whole numbers. One name and version names one digest for ever.\n- **`guide`**: prose on how the faculty is run and used, read by its owners, by a lobe wired to it and by whoever holds\n a standing on its lobe, never by a stranger unless `openGuide` is true. Say there what a skill would say:\n how it is run is the guide's, never a harness's.\n- **`placeholders`**: each need, a fixed ID (lowercase words joined by dashes) to the blueprint name it expects, or\n `null` for any. A declaration wires nothing: the owner names each wire at `create` or by `order`.\n- **`methods`**: each by a camelCase name, never one opening with `#`, nor `then`, nor a base class name (`stamp`,\n `cells`, `nerves`, `codec`, `crypto`, `quo`, `cage`, `memory`, `ask`, `error`, `describe`, `checked`). Each method\n holds `kind` (`reading` or `writing`, required), and where wanted `description`, `args` and `result` (JSON Schema of\n the standard's subset; `args` an object schema), `errors` (its own codes, none of the genome's), `budget` (ms, only\n where its work must be bounded shorter: with none it works up to the longest budget), `askers` (the fixed IDs alone\n that may ask it, held by the brain), `irreversible` (`true`, or the name of the arg naming what it ends) and `seat`\n (data beside it for a person, below).\n\nA schema's `pattern` is an I-Regexp (RFC 9485): no `(?:\u2026)`, no lookaround, no `\\d`, `\\w`, `\\s` or `\\b`; write `[0-9]`.\n\n**A seat** is data a method carries for whoever draws it for a person: `{for, label, ...}`. `for` is `person`,\n`machine` or `both`; `label` an object of language tag to text, at most 32 tags of at most 500 characters each. Any\nother field is free data the genome gives no meaning, for a window or a design of yours to read; the whole seat, as\ntext, holds at most 16,384 characters. An organ's method carries none. The floor's window draws only the methods\nseated `for` a `person` or `both`, each by its `label` in the person's language, else its primary subtag, else the\nfirst the seat holds, and never one seated for a `machine`; a window of your own reads the seat as it chooses.\n\n**The person's language.** The floor's window picks the seat's words. What a method answers is the place's to word: a\nplace that declares a writing method `told` is asked it, `told({size, language, standard})`, when a person first walks\nto it and again only where one moved; it keeps them by `this.stamp.occupant`, the standing that told them. A place that\ndraws hears the same three as `args.told` of each draw. `size` is the class of the screen's size, `compact`, `medium`\nor `expanded`; the language is the one the person's screen tells; `standard` the standard's version. The host tells a\nplace nothing else of the screen.\n\n### A door of another kit\n\nA door of any Quo kit is shown as a Nervur place is where its describe speaks this language. The describe is Quo's,\n`{lang, asks}`, with `lang` the text `nervur.blueprint`; beside them it may hold `name`, `version` and `description`,\nas a blueprint does. Each entry of `asks` holds `method` and, as a blueprint's method does, `kind`, `description`,\n`args`, `result`, `irreversible` and `seat`:\n\n```json\n{\n \"lang\": \"nervur.blueprint\",\n \"name\": \"com.example.accounts\",\n \"version\": \"1.0.0\",\n \"asks\": [\n { \"method\": \"balance\", \"kind\": \"reading\", \"seat\": { \"for\": \"person\", \"label\": { \"en\": \"Balance\" } } },\n {\n \"method\": \"closeAccount\",\n \"kind\": \"writing\",\n \"irreversible\": true,\n \"seat\": { \"for\": \"person\", \"label\": { \"en\": \"Close the account\" } }\n }\n ]\n}\n```\n\n`kind` says what an ask does: a `reading` changes nothing, a `writing` may, and `irreversible` says it cannot be\nundone; an entry that says no `kind`, as a describe of no `lang` does, is an ask whose effect its door did not say.\nThe floor's window asks a `reading` by itself, to draw and to draw again, a `writing` only by the person's press, one\ndeclared `irreversible` only past its consent, and one with no `kind` only by the person's own press, said first as\nan ask that may change something, one press one ask. `args` is a flat object schema of the standard's subset.\n\n### Methods, cells and the stamp\n\n- A method takes its args and answers data, or `this.error(code, message)`. An error code is lowercase words\n joined by dashes. The genome's own codes are `timeout`, `unavailable`, `busy`, `fault`, `silent`, `removed`,\n `repeated`; a method that throws is a `fault`.\n- **The brain checks no args**. Open a method with `this.checked(method, args)`, which answers `refused` where\n the args do not meet the blueprint's schema, and nothing where they do.\n- **Writing and reading.** A writing method runs alone, and its writes land in one batch when it answers: an answer\n always means it happened, and a timeout, fault or `busy` leaves nothing written. A reading method writes no\n cell, may ask any node and runs beside others. An ask that could start only once a run waiting on it ended hears\n `refused` at once: one back to its own lobe, through a wire to itself, another lobe or the brain, unless both are\n reading and it can start beside the run; and one that meets another run waiting the other way, two lobes asking\n each other or a loop through more. A writing method that needs its own lobe's answer reads its cells instead, or\n posts a letter, which is never waited on. A run may have several asks in flight: racing them (`Promise.race`) is\n never refused for the one it may not need, and awaiting all of them (`Promise.all`) where one would wait on a run\n that waits on you hears that one `refused` the moment the others have answered. A move of a lobe's version, or a\n settle, asked while a run of that lobe waits on you, is refused at once.\n- **Waiting.** A run that must pause, before a retry or while it holds its lobe, asks its own `nerves`:\n `await this.ask('nerves', 'wait', { ms })`, answered `null` once `ms` has passed, or `timeout` where the ask's time\n ends first. It spends none of the run's budget, and the run keeps its place in its lobe. Never pause by asking your\n own lobe and letting the timeout run out: that ask is refused at once.\n- **Cells.** `this.cells.get(key)`, `set(key, value)`, `delete(key)` and\n `range({prefix?, from?, to?, limit?, cursor?})`, a page of at most 1,000, 100 by default, with its `cursor`. A key\n is a tuple of scalars, kept in order. Size what you read at once by `this.memory`, the lobe memory, never a number of\n your own.\n- **The stamp**: `this.stamp.asker`, the ID of who asks (`brain` for an owner); `time`, ms since 1970; `seed`,\n 32 fresh bytes, the only chance; `occupant`, `{far, note}` on an ask from far, else null; `memory`.\n- **Tools.** `this.codec` (`text`, `read`, `base64`, `utf8`, `utf8Text`, in place of `TextEncoder`), `this.crypto`\n (`sha256`, `hkdf`, Ed25519, X25519, ML-KEM, AES), `this.quo` (`readInvitation(text, schemes)`, which checks the\n invitation's signature in the cryptography Nervur ships, the same on every host: an invitation from an organism whose\n port brought another for new invitations reads as none here, and only that organism's own accept reads it),\n `this.cage.run`.\n- **Imports.** The module imports `nervur:faculty` alone; bundle every other module into it.\n\n### Asking\n\nA method asks a node over one of its placeholders, and the brain carries it. Two forms answer alike:\n\n```js\nconst answer = await this.ask('scheduler', 'now', {}); // in an async method\nconst answer = yield { placeholder: 'scheduler', method: 'now', args: {} }; // in a generator method\n```\n\nAn answer is `{result}` or `{error: {code, message}}`. An ask names a `timeout` in ms only where an answer is worth no\nlonger. Options: `letter: {lives}` posts it as a letter to a lobe; `durable: true` marks it durable to an\norgan's method so marked. `this.nerves.read()` answers its placeholders, their wires and statuses, its relations and the\norganism's level; `this.nerves.order({termination, placeholder?, until?})` orders a wire, only to its own children and\nto who asked it; `this.nerves.unwire(placeholder)` lets one go.\n\n### Signals, letters and alarms\n\n- **A signal** lives in memory and is lost in a crash. **A letter** is kept until the lobe takes it, exactly once: its\n asker hears `null` at once, and the answer reaches no one. An ask whose loss matters is a letter.\n- **Alarms** are the scheduler's: `set {at, method, args?}` rings the asker's own `method` with `args` at the\n wall time `at`, as a letter, exactly once through any reboot. Post `set` as a letter. `cancel {id}`, `list`, `now`. A\n ring answered `{again: <time>}` sets the same ring again at that time. Name the ringing method's\n `askers: [\"scheduler\"]`, as the example does, so no one else rings it.\n- **An ask back, a letter taken again or a durable ask sent again is a cue to read cells,** never proof that something\n happened once.\n\n### Long work, jobs and pieces\n\nWork longer than one ask answers at once. Where the node can ask its asker back, it orders a wire back through\n`nerves` and asks it when the work ends; where it cannot, as for an owner, it answers `{job}`, and the asker reads\n`job {job}`, `ended` null while it runs, then holding its exit code. One ask back tells how a job ended:\n`done {job, kind, code, out, err}`. What is longer still is cut into pieces, each its own ask, judged by progress: a\npiece that times out is asked again, and the whole fails only once it stood still for its span. A lobe working\nstep by step keeps its next step in its cells and starts it by an alarm.\n\n### The brain's words\n\nThe base class answers each of these by doing nothing. Declare in your blueprint each one you act on: but `migrate`,\nthe brain asks a word only of a lobe whose blueprint declares it, so a method of that name the blueprint leaves out is\nnever run. None but the brain asks them:\n\n| Word | When |\n| ----------------------------- | --------------------------------------------------------------------------------- |\n| `migrate {from}` | a move to this version, `from` the digest left; it converts the old cells |\n| `left {far, note}` | an occupant this lobe gave ended: forget what you kept of it |\n| `silent {placeholder, since}` | a standing it holds fell silent |\n| `back {placeholder}` | a far organism's line, an organ, or a lobe it reaches is back: deliver what waits |\n| `line {far, up}` | the line an occupant it gave is reached through came up or went down |\n| `restored {at, commit}` | the organism came back from a backup |\n\nEvery word the brain adds after 1.0.0 opens with `#`, which no method takes.\n\n### Describe and draw\n\n- **`describe()`** answers an ask naming no method: the blueprint by default. Define your own to answer by state or by\n who asks; the brain strips the guide for whoever may not read it (`guide`, above).\n- **`draw(args)`**, a reading method, answers a tree the screen draws: `{t, a, k?, press?, c}`, `t` an\n allowed element, `a` its attributes, `k` a key unique among siblings, `c` its children, each a tree or a text. A draw\n reads its cells and its args alone: the brain refuses every ask it makes. A lobe that declares `draw` a reading is\n drawn by it; one without is drawn by the window from its describe, a page of its methods, its reading ones with what\n they answered and its writing ones each a form with a field for each arg. See What a tree may hold for the elements,\n presses and inputs, and A window of your own for who carries a press.\n\n### Evidence and tests\n\nA faculty proves itself by evidence: pieces of its world, each `{says, cells, asks, yields}`, each ask\n`{stamp, method, args, given, answer}`, `given` the asks the lobe makes, in order, each\n`{placeholder, method, args, answer}`. Replayed in a fresh runtime, every answer and the cells it yields must be\nthose it says. A stamp is `{asker, time, seed, occupant?, memory?}`, `seed` 32 bytes. A given ask the lobe posts as a\nletter carries its `letter: {lives}`, held to the letter it posts; a run of `this.cage.run` the host cut stands among\n`given` as `{cut: n}`, the ask's `n`th run from 1. Evidence is data, so write it as data, never as the\n`Piece` or `Asked` types of `@nervur.org/genome/evidence`, which are what the replay reads it into.\n\nIt ships as an asset: `faculties/<label>/assets/evidence.json`, whose asset path is `evidence.json`, so the proof\noutlives its repo; one with none is allowed and shown `unproven`. Its text is data's one text, RFC 8785, bytes\nwritten as `{\"$bytes\":\"<lowercase hex>\"}`: write it by `dataText` and read it by `readText`, both of\n`@nervur.org/genome/standard`. The evidence, beside the faculty:\n\n```js\n// faculties/com.example.reminders/evidence.mjs\nconst stamp = (asker, time) => ({ asker, time, seed: new Uint8Array(32) });\nconst set = {\n placeholder: 'scheduler',\n method: 'set',\n args: { at: 5000, method: 'ring', args: { id: 1 } },\n letter: { lives: 86_400_000 },\n};\n\nexport default [\n {\n says: 'A reminder is kept, its alarm set by a letter, and its ring marks it rung.',\n cells: [],\n asks: [\n {\n stamp: stamp('brain', 1000),\n method: 'add',\n args: { text: 'Call home', at: 5000 },\n given: [{ ...set, answer: { result: null } }],\n answer: { result: { id: 1 } },\n },\n {\n stamp: stamp('brain', 1001),\n method: 'add',\n args: { text: 'Late', at: 10 },\n given: [],\n answer: { error: { code: 'refused' } },\n },\n { stamp: stamp('scheduler', 5000), method: 'ring', args: { id: 1 }, given: [], answer: { result: null } },\n ],\n yields: [\n { key: ['next'], value: 1 },\n { key: ['reminder', 1], value: { text: 'Call home', at: 5000, rung: true } },\n ],\n },\n];\n```\n\nIts test replays what ships, the asset:\n\n```js\n// faculties/com.example.reminders/reminders.test.mjs\nimport assert from 'node:assert/strict';\nimport { readFileSync } from 'node:fs';\nimport { test } from 'node:test';\nimport { replay } from '@nervur.org/genome/evidence';\nimport { readText } from '@nervur.org/genome/standard';\n\nconst text = (path) => readFileSync(new URL(path, import.meta.url), 'utf8');\n\ntest('The reminders hold their evidence', () => {\n const evidence = readText(text('./assets/evidence.json'));\n assert.ok('data' in evidence, evidence.why);\n assert.deepEqual(replay(text('./faculty.js'), evidence.data).missed, []);\n});\n```\n\n`replay(source, evidence)` answers `{missed, made}`: each piece that did not hold, with why, and every ask the lobe\nmade, its timeout and letter with it, for a test to read. `readSkin(source)` reads a source as the first install does,\nits blueprint and digest or why it is refused. `@nervur.org/genome/kit` holds more: `rigOver` runs organisms on the real\nengine, `hosting` and `lobeOf` a class on a recording host. A gate runs the tests,\n`\"gate\": \"node tools/conform.mjs && node --test\"`.\n\n**Assets.** Every file under `assets/`, a hidden name aside, is an asset by its path there. A faculty with any names\ntheir digest in its blueprint as `assets`, a string of 64 lowercase hex: the SHA-256 of the canonical JSON of the\n`[path, sha256]` pairs sorted by path, each `sha256` that of the file's bytes, a text's with LF line ends.\nNervur's check of the parts refuses a blueprint whose `assets` is not that digest, and assets with none. The repo lobe\ntells and serves them, so a faculty that comes by a repo arrives proven, each version with the assets it was told with,\nhowever a later version changes them; one added by hand carries them,\n`add {source, assets}`, each asset `{path, digest, text}` or `{path, digest, base64}`.\n\n### Its text and its versions\n\n`faculty.js` is the text as it ships, committed; `versions.json` maps each version to the SHA-256 of that text, in\nlowercase hex. Nervur's check of the parts refuses a `faculty.js` that is not the text `versions.json` names at its\nversion, and a told entry changed. A faculty written in plain JavaScript is its own text; one written\nin TypeScript, or in many modules, is bundled into one module by the repo's `text` script, `nervur:faculty` kept\nexternal, `@nervur.org/genome/faculty` aliased to it. Every other module is bundled in, what it takes of\n`@nervur.org/genome/standard` among them, so the text is all the code the faculty runs, and a genome whose bundled code\nmoved moves the text: a version a tag told keeps its committed `faculty.js`, and a text rebuilt otherwise takes a new\nversion, as the check refuses the told one changed. The assets digest stands\ninside the text, so it is written first, then the text's digest. The steps after any bundling, for a blueprint that\nholds `assets: '<64 hex>'`, any at first, where the faculty has assets:\n\n```js\n// tools/text.mjs, the script \"text\": each faculty's evidence asset, its blueprint's assets digest, its versions.json\nimport { createHash } from 'node:crypto';\nimport { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { pathToFileURL } from 'node:url';\nimport { dataText } from '@nervur.org/genome/standard';\n\nconst sha = (bytes) => createHash('sha256').update(bytes).digest('hex');\nconst canonical = (bytes) =>\n bytes.includes(0) ? bytes : Buffer.from(bytes.toString('latin1').replace(/\\r\\n?/gu, '\\n'), 'latin1');\nconst filesIn = (at, below = '') =>\n readdirSync(`${at}/${below}`, { withFileTypes: true })\n .filter((entry) => !entry.name.startsWith('.'))\n .flatMap((entry) => {\n const path = below === '' ? entry.name : `${below}/${entry.name}`;\n return entry.isDirectory() ? filesIn(at, path) : [path];\n });\n\nfor (const label of readdirSync('faculties')) {\n const at = `faculties/${label}`;\n if (existsSync(`${at}/evidence.mjs`)) {\n const { default: evidence } = await import(pathToFileURL(`${at}/evidence.mjs`).href);\n mkdirSync(`${at}/assets`, { recursive: true });\n writeFileSync(`${at}/assets/evidence.json`, `${dataText(evidence)}\\n`);\n }\n let text = readFileSync(`${at}/faculty.js`, 'utf8');\n if (existsSync(`${at}/assets`)) {\n const pairs = filesIn(`${at}/assets`)\n .map((path) => [path, sha(canonical(readFileSync(`${at}/assets/${path}`)))])\n .toSorted((one, other) => (one[0] < other[0] ? -1 : 1));\n const named = /\\bassets\\s*:\\s*['\"][0-9a-f]{64}['\"]/u;\n if (!named.test(text)) throw new Error(`${at}: its blueprint names no assets: '<64 hex>'`);\n text = text.replace(named, `assets: '${sha(JSON.stringify(pairs))}'`);\n writeFileSync(`${at}/faculty.js`, text);\n }\n const blueprint = text.slice(text.search(/\\bstatic\\s+blueprint\\s*=/u));\n const version = /\\bversion\\s*:\\s*['\"]([^'\"\\n]+)['\"]/u.exec(blueprint)[1];\n const path = `${at}/versions.json`;\n const versions = existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : {};\n versions[version] = sha(text);\n writeFileSync(path, `${JSON.stringify(versions, null, 2)}\\n`);\n}\n```\n\n### Moving a lobe\n\nA lobe outlives its faculty's versions: its ID, wires, relations and cells stay. An owner moves it by\n`version {lobe, faculty}`, `faculty` the new digest; the new version's `migrate {from}` runs once, and a failure leaves\nthe lobe where it stood. The move keeps one step back until `settle`, a move back, or another move; a\nlobe too big to keep twice moves with `settled: true`. A placeholder the new version declares anew stands unwired for\nthe owner to wire. Lay what a lobe serves, a table, a content, a model, in its cells by `migrate` or by asks, never in\nits source, so a version carries only what changed of the logic; a `migrate` that reads `assets` reads the new\nversion's.\n\n### Patterns\n\n- **A plain lobe composing skin lobes.** The shape that repeats: skin lobes hold what reaches the world and its secrets,\n and a plain lobe holds the use case, asking them and beings. A new use case is a new plain lobe, seldom a new organ.\n- **Signal or letter.** Asked again anyway: a signal. Its loss matters: a letter. A node that owes an ask back and meets\n `unavailable` drops it, the asker's cells staying the truth, or posts it as a letter.\n- **Once, far.** What an ask sent far did stays done, and only the far side's own answer says what happened there. An\n ask that must not run twice, a payment, carries a key of its asker's, which the far lobe keeps and answers once. On a\n window of one, an ask answered closes every earlier box, which then hears `repeated`.\n- **Skin lobes.** Every use of an organ is a skin lobe of its own. A secret reaches its organ only as an ask's\n input. An organ's long work answers at once and asks its skin lobe back; the skin lobe never asks its organ again from\n inside that ask back, which waits on its answer: it keeps what follows in its cells and starts it by an alarm.\n- **Choosing by the nerves.** Read your statuses and answer `unavailable`, take another path, or order your wiring\n again; at `left`, forget what you kept of that far organism.\n- **Children.** A lobe raises children through its `nerves`; a child reaches nothing its parent does not.\n- **Roles are a lobe's**: a relation to a brain is owning; to a lobe, belonging, buying or following, allowed\n by the lobe's cells and the end's note.\n\n## An organ\n\nAn organ is a driver: its judgment lives in its skin lobes, and it holds no cells and declares no placeholder.\nBuild one only for what no lobe can do: a device, a program, heavy computation. On a host with a body an organ comes\nonly from a repo of the organism's own, pulled and built in its body, then admitted by an owner; a host\nwithout one runs the halves its embedder's build brought.\n\n**Its shape** is `{blueprint, reach, half: {form, digest}}`. Its blueprint names its methods with no `kind`,\nand `durable: true` where an ask should be sent again at each reconnect. `reach` is free data the half reads, given at\n`addOrgan`. The half is a WebAssembly `component`, given exactly the imports its reach names, or a `native` program for\none host. The Node port runs native halves alone today; a component is refused there.\n\n**In a repo**: `organs/<id>/graph.json`, its blueprint (as `{blueprint}` or the blueprint itself), and\n`organs/<id>/host/`, one standalone program in any language whose executable `build` leaves it at `host/half`.\nA native half speaks the bridge: one JSON value a line on its standard input and output, each bytes in it\nwritten `{\"$bytes\":n}` and its n bytes following the newline as they are, its reach as its one argument. Its first frame\nis its blueprint; it is asked `{\"ask\": n, \"asker\", \"method\", \"args\"}` and answers `{\"answer\": n, \"result\"}` or\n`{\"answer\": n, \"error\": {\"code\", \"message\"}}`; it asks its skin lobes\n`{\"ask\": n, \"placeholder\", \"method\", \"args\", \"timeout\"}`; and it may say its status, `{\"status\": \"unavailable\"}`,\n`not ready` or `connected`.\n\n```text\norgans/lamp/graph.json {\"blueprint\":{\"name\":\"com.example.lamp\",\"version\":\"0.1.0\",\"methods\":{\"ping\":{}}}}\norgans/lamp/host/half.sh\norgans/lamp/host/build #!/bin/sh\n cp half.sh half\n```\n\n```sh\n#!/bin/sh\n# organs/lamp/host/half.sh: answers every ask \"pong\"\nprintf '%s\\n' '{\"blueprint\":{\"name\":\"com.example.lamp\",\"version\":\"0.1.0\",\"methods\":{\"ping\":{}}}}'\nwhile IFS= read -r line; do\n n=$(printf '%s' \"$line\" | sed -n 's/.*\"ask\":\\([0-9]*\\).*/\\1/p')\n [ -n \"$n\" ] && printf '{\"answer\":%s,\"result\":\"pong\"}\\n' \"$n\"\ndone\n```\n\n**Building and adding it.** Commit it with `host/build` executable and the version raised, so the tag tells it; build it\nin the body; read its half's digest; add it under its fixed ID:\n\n```sh\nnervur lobe \"$repo\" commit '{\"message\":\"the lamp\",\"files\":{...},\"executable\":[\"organs/lamp/host/build\"]}'\nnervur lobe \"$repo\" build '{\"organ\":\"lamp\",\"version\":\"0.1.0\"}'\nnervur lobe \"$repo\" get '{\"kind\":\"organ\",\"label\":\"lamp\",\"version\":\"0.1.0\"}' # its half names the digest\nnervur ask brain addOrgan '{\"id\":\"lamp\",\"blueprint\":{...},\"reach\":{\"account\":\"<the shell account>\"},\"half\":{\"form\":\"native\",\"digest\":\"<digest>\"}}'\n```\n\nA reach naming `account` runs the half in the body, as that account; `nervur state` shows the shell's. `addOrgan` again\nunder the same ID is a release: its wires, skin lobes and durable asks stay. A half that fails shows\nunavailable and restarts alone.\n\n**Its skin lobe** declares a placeholder named by the organ's ID, expecting its blueprint name, and is wired to\nit at `create`:\n\n```js\nstatic blueprint = {\n name: 'com.example.lamp-skin',\n version: '0.1.0',\n methods: { ping: { kind: 'reading' } },\n placeholders: { lamp: 'com.example.lamp' },\n};\nasync ping() {\n const answer = await this.ask('lamp', 'ping', {});\n return 'result' in answer ? answer.result : this.error(answer.error.code, answer.error.message);\n}\n```\n\nThe organs Nervur holds: `network`, for Quo and the web, every host; `shell` runs programs as the body and `disk` keeps\nfiles under one folder, on a host with a body; the console and the screen, presence.\n\n## Designs and looks\n\nA **design** is a repo's design system: tokens, themes, skin and components. Its components build into a **look**, a\nfaculty the window wears, by the design kit `@nervur.org/floor/design`.\n\n### A design folder\n\n```text\ndesigns/plain/design.json {\"name\":\"plain\",\"version\":\"0.1.0\",\"publisher\":\"com.acme\",\n \"themes\":[\"light\",\"dark\"],\"tints\":[\"red\"],\n \"densities\":{\"regular\":1},\"defaults\":{\"tint\":\"red\",\"density\":\"regular\"},\n \"classes\":[\"plain-badge\"]}\ndesigns/plain/tokens/light.json {\"--plain-text\":\"#111111\",\"--plain-surface\":\"#ffffff\"}\ndesigns/plain/tokens/dark.json {\"--plain-text\":\"#eeeeee\",\"--plain-surface\":\"#000000\"}\ndesigns/plain/tokens/tints.json {\"red\":{\"light\":{\"--plain-accent\":\"#b00020\"},\"dark\":{\"--plain-accent\":\"#ff6b81\"}}}\ndesigns/plain/skin/layers.json {\"lobes\":[\"base.css\"],\"home\":[]}\ndesigns/plain/skin/base.css .plain-badge { color: var(--plain-accent); }\ndesigns/plain/components/badge.ts export default (args, theme) => ({ t: 'span', a: { class: 'plain-badge' }, c: [args.label] });\ndesigns/plain/words/en.json {\"back\":\"Back\",\"read\":\"You are read as {name}.\",\n \"days\":{\"1\":\"{count} day\",\"other\":\"{count} days\"}}\ndesigns/plain/versions.json {\"0.1.0\":{\"data\":\"<digest>\",\"look\":\"<digest>\"}}\ndesigns/plain/DESIGN.md its story\n```\n\nOptional: `fonts/`, with `fonts/fonts.json` as\n`{\"faces\":[{\"family\":\"Serif\",\"weight\":\"400\",\"style\":\"normal\",\"range\":\"U+0000-00FF\",\"file\":\"serif.woff2\",\"licence\":\"OFL.txt\"}]}`,\neach `file` and `licence` a file of `fonts/` named from there; `icons/` and `figures/`, its pictures.\n\n**A figure in a component.** The window serves every picture of the design it wears by its digest and its kind, the\nSHA-256 of the file's bytes and its extension, one of `avif`, `gif`, `jpg`, `png`, `webp` (no SVG, which would run its\nscripts at the screen's address). A component names one in `img{src}` by both, never by path:\n\n```ts\n// designs/plain/components/logo.ts: figures/logo.png, its digest from `shasum -a 256 figures/logo.png`\nconst LOGO = { asset: '<sha256 of figures/logo.png>', ext: 'png' };\nexport default (args) => ({ t: 'img', a: { src: LOGO, alt: args.label, width: 120, height: 40 }, c: [] });\n```\n\nA font is laid by its face in `fonts/fonts.json`, the screen writing its `@font-face`. A sheet's `url()` may name a\nfile of the design from `skin/`, `url('../figures/grain.png')`: the screen lays it as that file, by its digest, as an\n`img` names one.\n\n- **Tokens** stand in both themes, tints as accents over both. The light tokens lie on the root, the dark where the\n device prefers it, and either where `data-theme` names it, as a site sets it on its pages, so a sheet that reads the\n tokens follows it with nothing more.\n- **The skin** has two layers: `lobes`, what every lobe's root wears, whose every selector names a class, an attribute\n or `:host` and never an element alone; and `home`, the home's own chrome. A class a component writes is declared in\n `classes` and styled by some rule. A class is a lowercase letter, then lowercase letters, digits and dashes, forty\n characters at most, so `plain-badge` and never `plain_badge` or `plain__row`, and a tree names eight at most; the\n build refuses any other, naming it. A sheet loads nothing outside the design: no `@import`, no `url()` but `data:`, a\n fragment or a file of the design.\n- **A component** is a file directly in `components/`, its default export a plain function\n `(args, theme, state, words)` that answers a tree from its args alone; `theme` is `light` or `dark`, `state` the\n region's local state. A file opening with `_` is a helper; a component may draw another by importing it.\n- **Words** are optional: `words/`, a file for each language `design.json` names in `languages`, as\n `\"languages\":[\"en\",\"ro\"]`, the first the design's own. A key is a letter, then letters, digits, dots, dashes and\n underscores. A word is a text with places, `{name}`, or a count's forms keyed `other`, whole numbers and the plural\n categories `zero`, `one`, `two`, `few` and `many`: a count takes its number's form, else the one its language's rule\n names (Romanian's `few` for 2 to 19, Russian's `few` and `many`), else `other`; the look carries the rules, by primary\n subtag, and a language it knows not takes a number's form or `other`. A component names a key, never a text:\n `words('read', { name })` is that word in the person's language, else its primary subtag, else the design's own, its\n places filled, and `words('days', { count })` the form of that count. A month is a word, `month.1`. What the args hold\n is drawn as it is. Words build into the look beside the components and are no asset. A design on a stranger's road is\n handed no language, so its words are empty.\n- **What the floor's window asks of a design.** It wears only a design that draws `surround`, `organism` and `lobe`,\n with the args `SCREEN_COMPONENTS` of `@nervur.org/floor/design` gives as data: for each component its `args` as a\n schema, the `presses` the window answers from its tree, the `slots` it lays and whether wearing `required` it. Each\n draw is `draw {component, args, theme, state?, lang?}`, `lang` the person's language. `surround {title, route, back?,\n warnings, main, consent?}` is what the floor's window draws around a page where it has something to say: `route` each\n step `{label, path}`, `warnings` lines in the home's words, `main` the args its slot `main` carries, laid as\n `{t: 'slot', a: {placeholder: 'main'}, args: main, c: []}`, and `consent {say, yes, no, yesSay?, noSay?}` the consent\n the window asks, `yes` and `no` two presses the surround lays as they are handed. `organism` is the organism's page,\n its `state`, `organs`, `lobes` and, at home, its `relations`, `faculties` and `about`, with the presses\n `about {faculty}`, `create {faculty}` and `page {cursor}`; a far organism's page is its own, whole, with no press.\n `lobe` is a lobe's page, its `reading` methods with what each answered and its `writing` methods with their `args`,\n each with its seat's `label` where it has one, and `written`, what the last press that wrote answered, with the\n presses `read {path, method}` and `write {path, method}`. A design on a stranger's road writes no word of its own, so\n the window hands it every word it needs, the home's, English: the surround's, the consent's `yesSay` and `noSay`, and\n a seat's `label` in the person's language. A window of your own asks of its designs what it chooses.\n\n### Building its look\n\nThe kit builds the look from the folder's files, as text or bytes; a design repo's `design` script runs it, and the\nrepo lobe asks it as `npm run --silent design -- designs/<name> --look <file>`, reading the look's source from that\nfile:\n\n```js\n// tools/design.mjs, the script \"design\": \"node tools/design.mjs\"\nimport { readdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { stripTypeScriptTypes } from 'node:module';\nimport { join } from 'node:path';\nimport { buildLook } from '@nervur.org/floor/design';\n\nconst [folder, flag, out] = process.argv.slice(2);\nconst filesIn = (within = '') =>\n readdirSync(join(folder, within), { withFileTypes: true }).flatMap((entry) => {\n const path = within === '' ? entry.name : `${within}/${entry.name}`;\n return entry.isDirectory() ? filesIn(path) : [path];\n });\n// The kit takes each file as text or bytes: bytes here, so fonts and figures travel whole.\nconst files = Object.fromEntries(filesIn().map((path) => [path, readFileSync(join(folder, path))]));\nconst look = buildLook(files, (typescript) => stripTypeScriptTypes(typescript, { mode: 'strip' }));\nif ('why' in look) {\n console.error(look.why);\n process.exit(1);\n}\nif (flag === '--look') writeFileSync(out, look.source);\nelse writeFileSync(join(folder, 'versions.json'), look.versions);\n```\n\n`buildLook(files, strip)` answers `{name, version, label, text, source, versions, screen}`, or `{why}`: the look's name\n`<publisher>.<name>-look` (`com.acme.plain-look`), its library label `<name>.look` (`plain.look`), its source, and\n`screen`, whether it draws `surround`, `organism` and `lobe`, which the floor's window wears it by.\n`designAssets(files)` answers `{assets, digest}`. `versions` is the text of the design's `versions.json`, its version\nnaming `data`, that digest, and `look`, the SHA-256 of the look's source; `npm run design -- designs/<name>` writes it,\nand the tag tells it. Then the repo lobe builds it and the library takes it:\n\n```sh\nnervur lobe \"$repo\" build '{\"design\":\"plain\",\"version\":\"0.1.0\"}'\nnervur lobe library add '{\"road\":\"'\"$repo\"'\",\"kind\":\"faculty\",\"label\":\"plain.look\",\"version\":\"0.1.0\"}'\n```\n\nThe kit puts `draw {component, args, theme, state?, lang?}`, `files`, `set {tint?, density?}` and `design` into every\nlook; no author writes them. The kit takes each file as text or bytes, so `fonts/`, `icons/` and `figures/` travel as\nassets by digest, which a component names by digest (A figure in a component).\n\n### How a design is worn\n\nWearing is wiring. The window wears the design lobe wired to its `design`, the one its port gave at birth until\nthe person chooses another, by the window's `wear {design}` naming a look's digest; it creates every design lobe sealed,\nso a design, a stranger's above all, draws and reaches nothing of the organism. Before it wears one it judges the\nlook's sheets: one that `@import`s, or whose `url()` names an address that is no `data:` URI, no fragment and no file of\nthe design, is refused, saying the sheet and the address. Whatever design it wears, the floor's window keeps every\nwarning and confirm in the home's own words, and lays its way out above every page.\n\n**What the host lays outside every tree.** Two roots stand above the page, each a shadow root under a host of its own\nbeside `body`. Each wears what the window's own surround wears of the design the home wears, its tokens and fonts, its\n`lobes` sheets, then its `home` sheets, and no sheet of a place:\n\n| Host | What stands in its root |\n| ---------------- | --------------------------------------------------------------------- |\n| `nervur-way-out` | the way out, a `button` holding `svg` |\n| `nervur-said` | what the home answered of a press it refused: a `p` of `role=\"alert\"` |\n\nThey hold standard elements and no class. The floor's design dresses them by its `lobes` sheet, whose rules name each\nelement under `:host`, here the host itself. A design whose sheets style classes alone leaves them as the device draws\nthem, legible and bare: it dresses `:host button` and the rest in a `lobes` sheet, or names the two hosts in a `home`\nsheet. The home places each host on the screen by the host's own style, which no sheet moves.\n\n### What a tree may hold\n\nA tree is data: no script, handler, style or address can be written in it. The allowlist, `ATTRIBUTES` of the\nkit, names:\n\n- **Plain elements**:\n `div span p h1 h2 h3 h4 header footer main nav aside section article ul dl dt dd strong em small mark s sub sup`,\n `abbr q blockquote br hr figure figcaption legend table caption thead tbody tfoot tr summary`.\n- **With attributes of their own**: `ol{start}`, `li{value}`, `img{src, alt, width, height}` (a picture by its digest),\n `audio{src, controls}`, `time{datetime, deadline, shows}`, `data{value, ref, field}`, `a{href}`, `pre`, `code`,\n `meter{value min max low high}`, `progress{value max}`, `button{disabled copies}`, `label{for}`,\n `input{type name autocomplete value placeholder min max step maxlength minlength checked disabled required readonly\n enter}`, `textarea{name autocomplete placeholder rows maxlength minlength disabled required readonly}`, both with\n the typing hints `autocorrect` (`on off`), `autocapitalize` (`off none on sentences words characters`),\n `spellcheck` (`true false`), `inputmode` (`none text decimal numeric tel search email url`) and `enterkeyhint`\n (`enter done go next previous search send`), `select{name disabled}`, `option{value selected}`, `fieldset{disabled}`,\n `th{scope colspan}`, `td{colspan}`, `details{open}`, `slot{placeholder}`, and a subset of SVG. There is no `form`\n element: a `fieldset` is a form, and a press sends the named fields of the nearest one it stands in, or, standing in\n none, those of its root that stand in none.\n- **Global attributes**: `class id title lang dir hidden role aria-label aria-hidden aria-current aria-live aria-busy`,\n `aria-pressed` (`true false mixed`), `aria-expanded` and `aria-invalid` (`true false`), `aria-describedby` (an id),\n the gestures `swipe-left swipe-right swipe-up swipe-down hold drag drop`, `morph` and `opens`.\n `opens`, a flag, marks the element a page opens at: a page drawn whole, and the first draw of a place walked to, is\n brought into view at the first element that carries it once its design has laid it out, its sheets and its faces\n read, and again as they land, until the person scrolls, presses or types; any other patch never moves\n the page, so a person's own scrolling stays theirs. With no element marked, the page opens where the engine opens it.\n- **Inputs**: `text search number range checkbox radio date time email tel color file`.\n\n**A press** stands on a `button`, `input`, `select`, `textarea` or `summary`: `press: {method, args, to?}` asks the lobe\nthat drew it, or the lobe its placeholder `to` reaches. Typed text leaves only as the fields the pressed method's args\nname. `{method: 'local', args: {region, state, field?}}` changes only the region's local state on the device.\nFrom the moment a press is sent until the home answers it, the screen marks its control `aria-busy=\"true\"`, over\nwhatever your tree says, and ignores further presses of that control; every other control stays live. Style\n`[aria-busy='true']` in your sheets to show a press on its way; the floor's design dims it.\nA `slot`, `{t: 'slot', a: {placeholder}, args, k, c: []}`, draws there the lobe that placeholder is wired to, with those\nargs.\n\n- **The return key**: an input's `enter` names by id a `button` with a press in the same tree, which the person sees;\n the return key in that field makes that button's press, its fields gathered as a click gathers them.\n- **A copy**: a button's `copies` names by id an element of the same tree the person sees; pressed, the screen puts\n that element's text, or a field's value, on the device's clipboard, and the lobe hears nothing. Copy only what is\n shown: a text kept beside it is never copied.\n- **A link of the world** (`https:`, `mailto:`) never navigates the screen: the home says where it leads in its own\n words above the page and opens it outside only on the person's yes there. Those words are English; a window of your\n own words them in another language by answering `world {say, yes, no}` in every `see`: `say` holds\n `{href}` where the screen puts the address, and `yes` and `no` are the two buttons. The person must read where the\n link leads, so words whose `say` lacks `{href}`, or that are not three non-empty texts, are not taken and the English\n stands; the words of one sight stand until a sight hands others or none.\n\n- **A file** a person gives: a `file` input whose name the method's args declare reaches the lobe as\n `{name, type, size, sha256}`, never its bytes; the method's seat says `intent: \"channel\"`, a free field of the seat\n the floor's window reads, and answers `{channel: {kind: \"upload\", url, expires}}`, the host PUTs the bytes there once\n and the window asks the lobe `landed {sha256, landed}`. A file the other way:\n `{channel: {kind: \"file\", size, sha256, ext, url, expires}}`, `ext` a picture's or a sound's kind; with no `url` and\n `expires`, the bytes are a lobe of the home's own, which answers its reading method `piece {sha256, at, length}` with\n them.\n- **A deadline**: `{t: 'time', a: {datetime: '\u2026', deadline: '2026-01-01T10:00Z'}}` is counted down by the screen; the\n lobe hears nothing, and judges lateness by its stamp.\n- **An instant**: `{t: 'time', a: {datetime: '2026-01-01T10:00Z'}, c: []}`, with no text and no deadline, is written by\n the screen in the person's language and the device's zone, its day and its time of day; `shows: 'day'` or\n `shows: 'time'` writes one alone. No lobe knows the zone a person reads in.\n- **Caps**: a tree holds at most 5,000 nodes, 64 deep, a key of 200 and a text of 20,000, and no sound, each an owner's\n word over `tree.*`.\n\n## A window of your own\n\nThe screen's present lobe, the **window**, is a faculty like any other: it keeps the route the person walked, answers\nwhat the screen shows there, and carries each press. The floor's is `nervur.window`; its source is `WINDOW_SOURCE` of\n`@nervur.org/floor`, one module importing `nervur:faculty` alone, to read or to start from. A host names the window an\norganism is born wearing (Where Nervur stops); this section is all it asks of one. What the floor's window answers\nbelow is one way to answer it; what any window must answer is said so.\n\n### Its wiring\n\nA window declares the placeholders `screen`, expecting `nervur.screen`, and `brain`, expecting `nervur.brain`, and\nwhere it wants them `design` (expecting any blueprint, a look's), `mouth` (`nervur.mouth`) and `ear` (`nervur.ear`),\nwhich the port wires to the organism's own. **Presence wins:** the screen's organ, `this.stamp.asker` `screen`, is\nthe one asker whose walks, sights and presses are the person's, so a window answers it alone for each and refuses\nevery other asker; nothing but its organ speaks through it. It holds the relations its owners hold, each wired by the\nbrain under the placeholder the console holds it by: a relation is a placeholder of its own nerves\n(`this.nerves.read()`), never one of its own (`screen`, `brain`, `design`, `mouth`, `ear`). `design` is the one wire\nof a present lobe that only the window moves, by `this.nerves.order({termination, placeholder: 'design'})`; the port\nwires it at birth, and at each connect the brain asks `back {placeholder: 'screen'}`, where the floor's window lays\nthe design its port gave unless the person chose another. At `left {far, note}` it forgets all it kept of that\nrelation.\n\n### Routes and the walk\n\nA route is the path the person walked: `[]` the home, `[{relation}]` an organism or a far lobe seen through a relation\nthe window holds, `[{lobe}]` a lobe at home, `[{relation}, {lobe}]` a lobe of that organism. Its text is `/`, `/org`,\n`/~/A24`, `/org/A24`, a lobe's ID percent-encoded; `routeText(route)` and `routeOf(text)` of\n`@nervur.org/genome/screen` write and read it, each answering `{why}` for what is none.\n\n- **`open {route}`** or **`open {lobe}`**, with `told?`: the walk; answers `{route, text}`. The floor's way out walks\n home by `open {route: []}`. **`root {}`** answers the route walked.\n- **A relation is a place** where its knock's describe names another blueprint than `nervur.brain`: a far lobe,\n `/<relation>` its page, nothing under it. The floor's window describes a far lobe once at a walk and keeps the\n describe and what its `state` answered, so a sight asks no describe and each press is one ask over the kept\n describe; it asks the far lobe over the relation itself, as its own methods, and a far organism through its brain.\n- **`told {size, language, standard}`** is what the host tells a place of its screen, `size` one of `compact`,\n `medium`, `expanded`: at a walk a window asks a far lobe that declares a writing method `told` those three and\n nothing else, the first time and again only where one moved; the host lays the same under `told` in the args of every\n draw it asks over a relation (`withTold`).\n\n### What `see` answers\n\n**`see {route?, args?}`**, `args` closed: `{cursor?, cells?, theme?, lang?}`, the place in a long list, the cells\ndigest the screen holds of the lobe, `light` or `dark`, and the person's language tag. It answers\n`{route, text, tree, main, version, design, way?, world?, channel?}`:\n\n- `tree`: the root the screen draws. The floor's is `surround {title, route, back?, warnings, main, consent?}` drawn\n by its design only where the window has something to say, a warning or a consent; else the slot alone,\n `{t: 'main', a: {}, c: [{t: 'slot', a: {placeholder: 'main'}, args, c: []}]}`.\n- `main`: `{lobe, over, args}`, the lobe that draws the slot `main`, over which relation (null at home), with which\n args. The host draws it by **`show {lobe, args, over?}`**, which answers `{tree, wires}`: the lobe's `draw` through\n the brain's `ask`, or over the relation, and the lobe wired at each of its placeholders, where the screen draws its\n slots by `show` again. For a page the floor's window draws from a describe, `lobe` is its design lobe and `args`\n `{component, args, theme, lang}`; for a lobe that declares `draw`, that lobe, its relation and `{}`.\n- `version`: the version the lobe's describe says, null for an organism, which a press that writes carries back as\n `seen`.\n- `design`: the lobe wired at the window's `design`, the design it wears, or null for none. The host dresses the home\n by this lobe whatever drew the page, and draws a window that names none with no design's sheet.\n- `way`: `{at, say?, leave?}`, what the window hands the host to lay above the page, outside every tree, where no\n place's tree or sheet covers or presses it, `at` one of `top-start`, `top-end`, `bottom-start` and `bottom-end`. The\n floor's window hands its way out and a place's leave there (The floor's leave and way out); a window of your own\n hands what it chooses, or none.\n- `world`: `{say, yes, no}`, the words of the ask before a link of the world opens (What a tree may hold); the floor's\n window hands none.\n- `channel`: the checked shape of a file or an upload the last press of the place answered, for the host to follow,\n until it posts **`landed {id, landed, why?}`**; a file whose bytes a lobe of the home holds is read by\n **`piece {id, at}`**.\n\nA host's own press `page {cursor}`, which the floor's design lays to turn a long list, asks `see` again with that\ncursor and reaches no window method. The floor's window asks the design it wears `surround`, `organism` and `lobe` alone\n(Designs and looks).\n\n### Presses\n\nA press in a tree is `{method, args, to?}` on its element. The host gives each press a number and carries it as\n`postsOf(press, {id, seen, cells, values})` of `@nervur.org/genome/screen` says, `values` the fields committed\naround it: posts answered one before the next, each an ask of the window.\n\n- **`read {path, method}`**: one post, `read {path, method, cells, values?}`, `path` the route's text of the lobe; the\n answer or error is kept under the lobe, the method and `cells`, and drawn by every sight until the cells move.\n- **`write {path, method}`**: three posts. `write {id, path, method, values, seen, declared?, consented?}` keeps the\n press before anything leaves and answers `{id}`; `send {id}` marks it sent, committed before any ask of the lobe\n leaves, and answers `{method, sending: true}` once, `{method, unknown: true}` for a press sent and not answered,\n which is never sent again, what was kept for one answered, `{method, asking: true}` for one held for the\n consent, or `{method, taken: true}` for a yes whose consent another yes took, which asks nothing; `deliver {id}`,\n posted only after `sending`, describes the lobe, answers `stale` with the version that stands where it is no longer\n `seen`, fits the values to the method's `args` and asks the lobe once, answering\n `{method, answer}` or `{method, error}`. Fitting leaves out an empty text in a property not required, parses a\n number or an integer, takes a boolean from its checkbox, parses JSON and keeps an enum; a value that fits not is\n refused in plain words and the lobe is not asked.\n- **`ask {path, method, args?, consented?}`**: the declared ask, the same three posts with the args the press names\n as its values, `declared: true`.\n- **`local {region, state, field?}`**: one post; it merges `state` into the region's local state at the route\n walked, a null dropping a key, bounded by the window's memory and forgotten at the next walk; no lobe hears it, and\n a component is handed it as `state`. `field` names the key that holds what a person types, posted at each key.\n- **Any other press** is `press {lobe, method, args, values?, to?, over?}`, `lobe` the lobe it reaches: the window\n reads the describe first, holds it for the consent where it binds the person, and asks the lobe that drew it, or the\n one wired at its `to`, with of `values` those its method's args name. Where `lobe` is the window's own design lobe,\n the press is the window's own act; the floor's are `create {faculty}`, `about {faculty}` and `leave {relation}`.\n\n**Whose a press is.** A region a lobe's root draws is that lobe's; a region a sealed lobe draws is drawn for the lobe\nwhose slot asked it, and a press there reaches that lobe (`pressAt`). Every design lobe is sealed, so a press in what\na design draws reaches the window, never the design.\n\n**The fleeting stays on the device.** Typing, scrolling and focus reach no lobe. Typed text leaves only as the fields\nthe pressed method's args name, from the nearest `fieldset` the press stands in, else from its root's fields that\nstand in none; a field a `local` press names stays in the region's local state.\n\n### The consent\n\nThe floor's window holds a press for its consent where the method's describe declares `irreversible`, or where it is\nan ask a place's describe names and says nothing of (no `kind`); so is its leave. Held, it asks the lobe nothing: the\nwindow sets the local state of the region `#consent` of the route, `{asking, lobe, args, label?, irreversible?}`,\n`args` the values fitted, and answers `{method, asking: true}`; the surround is then drawn with\n`consent {say, yes, no, yesSay, noSay}`, in the home's words. `yes` is the same ask,\n`{method: 'ask', args: {path, method, args, consented: true}}`; `no` the `local` press that clears the region, every\nvalue null. A consent holds only while the window's own local state still asks for that\nmethod of that lobe. The first yes sent takes it, `taken` naming its press in the region's state, and the consent stays\ndrawn until that ask is answered, then is spent: a second yes meanwhile, from another tab, asks nothing, and a yes\nafter asks the consent anew. A `local` press may clear `#consent` and never set it, so no tree a\nplace draws forges a yes, and `deliver` refuses a press that binds the person with none. No method of a place is named\n`#consent`. A window of your own holds back what it chooses; the local state of a region is yours to keep the same\nway, which no tree of a place sets.\n\n### The floor's leave and way out\n\n`way.leave` is `{press: {method: 'leave', args: {relation}}, say}` at a place the window took, a far lobe, `say` the\nhome's word; the host lays it beside the way out and carries it as a press of the design lobe over no relation, while\nthe window's `way` still holds it. Unconsented, `leave {relation}` sets `#consent` with `asking: 'leave'` and answers\n`{asking: 'leave'}`, the surround carrying a consent whose `yes` is the same press with `consented: true`; consented, it\nends the standing whole by the brain's `drop {far}`, forgets what it kept of the place, walks the person home where the\nroute stood on it, and answers `{left: relation}`. A relation that reaches a far organism is an owner's standing,\nnever left so. A place whose far lobe answers `removed`, and a knock never answered, end the same way.\n\nThe floor's way out stands at `bottom-end` above every page but the home's own, `way.say` its word, and walks home.\n\n### Links\n\nThe host reads a link into `{card, reference}` and draws the consent itself, outside every tree; the window gives it\nthree asks, each the screen's alone:\n\n- **`offer {card, reference}`**: the mouth's `once` asks `#offer` of the card's ward on its zero head, spending\n nothing; answers `{says, waits, lives}`, `{reached: false}`, or null where the place gave no offer.\n- **`redeem {card, reference}`**: the same for `#redeem`; answers `{invitation}`, or `refused` in words that say\n whether to try again.\n- **`accept {invitation, placeholder, note?}`**, the person's yes: refused for one of the window's own placeholders\n and one it holds; the mouth accepts with `note`, kept beside the standing and never sent, and the first ask over it,\n a describe, is the knock, one never answered ending the standing whole by `drop` and refused. A knock naming another\n blueprint than `nervur.brain` makes the relation a far lobe. Answers `{far, route, text}`, where the host walks.\n\n### What the host lays\n\nThe host lays what a window answers, whatever window it is; these are its calls, of `@nervur.org/genome/screen`.\n\n- **The design.** `worn {}` answers what the design lobe wired at `design` answers its `files`, asked again where the\n lobe a sight names as `design` moved; the host lays it by\n `laid(files, settings, access)`, which answers `{sheets, lobes, home, classes, access, fonts?, dropped}`: each sheet\n `{digest, text}`, served at `SHEET_PATH` (`/.nervur/skin/`) as `<digest>.css`, the digests a `lobes` root and the\n `home` root wear in order, the access sheet last in both, and the classes each may draw. A picture and a font are\n served at `ASSET_PATH` (`/.nervur/asset/`) as `<digest>.<ext>`, fonts under families named `f-<digest>`; the light\n tokens lie on `:root, :host`, the dark under `prefers-color-scheme: dark`, each again under `data-theme`, which wins.\n- **Who wears the home's chrome.** `dressOf(road)` answers `home` for a lobe whose faculty came by the genome's road,\n the installer's or the owners' own source, `lobes` for any other: a root wears the lobes' skin alone, or that and the\n home's chrome, so a stranger never dresses as the home. A class stands only where a sheet of the layer its root wears\n names it. A window hands `lang` only in the draws of the design it wears, the home's; a look drawn with none finds\n every word empty.\n- **The person's access.** Four tokens, `access-text-size` 0.75 to 3, `access-contrast` 0 to 1, `access-leading` 1 to\n 2.5 and `access-motion` 0 to 1, clamped by `clampAccess` and laid last in every root, `!important`, by\n `accessSheet`; a design's own token of an `--access-` name is dropped, and its sheets read them by `var()`.\n- **Motion** is data: a design's `--<design>-<kind>-duration` (in `ms` or `s`) and `--<design>-<kind>-easing` for\n `enter`, `leave`, `move` and `change`, read by `motionTokensOf(tokens, design)`, a token missing no motion; each patch\n tells its kinds by its diff, and `motionOf(ops, motion, accessMotion)` scales them by `access-motion`, 0 stilling\n all. `morph` flies a named node from where it stood to where a patch puts it.\n- **Gestures** are another hand on a drawn control, never a new press: `swipe-left`, `swipe-right`, `swipe-up`,\n `swipe-down` and `hold` each name by id a `button` or `summary` with a press, `drag` a `select` with a `name`, whose\n options an element's `drop` stands for; the first of that id within the element, not hidden from a person. A tree\n whose gesture names none is refused.\n- **Addresses.** A tree's `a{href}` names a path of the screen's own (on a browser's host, the site's), `#id` within\n the page, or a link of the world, `https:` with a host and no credentials or `mailto:`, opened only on the person's\n yes; nothing else reaches the screen.\n- **What the surface tells.** The device's theme and language, the width, which the host makes a size class, whether\n the person asks for no motion, which the host plays as none: the window hears them as `see`'s `theme` and `lang` and\n `open`'s `told`, and nothing else of the device.\n\n### A design for the floor's window\n\nA design the floor's window wears draws `surround`, `organism` and `lobe` from their args alone. The plain design above\nbecomes one with three components; `surround` lays the consent's presses as handed and the slot `main`:\n\n```ts\n// designs/plain/components/surround.ts\nexport default (args) => ({\n t: 'div',\n a: {},\n c: [\n { t: 'h1', a: {}, c: [args.title] },\n ...args.warnings.map((line, at) => ({ t: 'p', a: { role: 'status' }, k: `w${at}`, c: [line] })),\n ...(args.consent === undefined\n ? []\n : [\n { t: 'p', a: {}, k: 'say', c: [args.consent.say] },\n { t: 'button', a: {}, k: 'yes', press: args.consent.yes, c: [args.consent.yesSay] },\n { t: 'button', a: {}, k: 'no', press: args.consent.no, c: [args.consent.noSay] },\n ]),\n { t: 'main', a: {}, k: 'main', c: [{ t: 'slot', a: { placeholder: 'main' }, args: args.main, c: [] }] },\n ],\n});\n```\n\n`organism.ts` and `lobe.ts` draw theirs the same way, a link an `a{href}` to a `path`, a press laid as handed, a\nwriting method a `fieldset` with a field named after each arg and a button pressing `write {path, method}`. The\nfloor's own design is the whole example: `FLOOR_FILES` of `@nervur.org/floor` holds its data by path and\n`FLOOR_LOOK_SOURCE` its look, every component built in.\n\n## The browser and the web\n\n### A site that serves the browser port\n\nA site serves the port as plain files, with no step of Nervur's. Lay the package's `dist/` at any path of the\nsite's origin, here `/nervur`: `/nervur/<digest>/*` served `Cache-Control: public, max-age=31536000, immutable`, the\nloader `/nervur/page.js` revalidated, and `/nervur/keeper.js` with the header `Service-Worker-Allowed: /`.\n`dist/quo.json` names the loader's digest, to pin it. A page then holds the organism:\n\n```html\n<div data-quo-link></div>\n<div data-quo-screen></div>\n<script type=\"module\" src=\"/nervur/page.js\"></script>\n```\n\nWith no more, the visitor's organism installs and boots in a worker, and the screen is born in the floor. Every tab of\nthe site shares that one organism, and closing any tab disturbs no other: each keeps its pages, and only an ask left\nunanswered by the tab that closed ends as `unavailable`, since whether it was done is not known. The element's words:\n\n| Attribute | What it draws |\n| ----------------- | ------------------------------------------------ |\n| `data-quo-screen` | the person's screen: the organism and its places |\n| `data-quo-link` | where a link landing on this page is taken |\n\nThe element says back `data-quo`: `waking`, `drawn`, `none` or `failed`, with `data-quo-why` in words. Its own content\nstands until the first tree replaces it, so a loader and an empty state are the site's markup. The page module exports\n`standings()` (`{relation, domain, note}` each), `ask(standing, method, args?)`, which answers what the lobe answered,\nor `{error}`, `watch(standing, method, args, heard)`, which calls `heard` with the answer now and with each one that\ndiffers, asked again at each notice the organism gives the page that a lobe of it committed, and answers the function\nthat stops it, `timings()`, `wake(key)` and `lay`, `arrive`, `stay`, `lasting` and `wipe`: the organism is the site's\nbackend in the tab, and the site's own pages draw what it answers in their own markup. `wipe()` removes the organism\nfrom this browser for ever, its store, its way back and its key, where it runs in no tab: null, or `{why}`. It is the\none way out of a store no version the site serves boots, and of a design chosen that draws nothing.\n\n**A window of the site's own.** A site names the window its visitors' organisms wear in its `/.well-known/quo`,\n`\"organism\": {\"window\": {\"name\": \"com.acme.window\", \"version\": \"1.0.0\", \"text\": \"<sha256>\"}}`, `text` the SHA-256 in\nhex of the faculty's source, which it serves beside the loader, at `/nervur/window/faculty.js`. Every boot reads what\nthe site names then: the source checked against `text` and read as a faculty declaring a placeholder `screen` and one\n`brain`, as the floor's window does, it stands as the screen's present lobe on the road `com.acme.window@1.0.0`, its\n`mouth` and `ear` wired to the organism's own where it declares them, given the site's design, else the floor's. A\ndeploy that names another moves each visitor's organism to it at its next boot, unless its person moved their window\nby `version`, which stands. A window that fails is refused whole: the organism wears the floor's, and the refusal is\nsaid among the warnings it boots with. A site that names none wears the floor's window, and nothing is said. Write it\nas any faculty, the floor's `WINDOW_SOURCE` of `@nervur.org/floor` being one to start from.\n\n**The port's note.** Where the browser declines to persist the store, the port says so in the screen's element, in a\n`p[data-quo-note=\"store\"]` beside the caged tree, which the site's own sheet styles. It is said in the home's words,\nwhich are English, once, and the port never writes it again: a site in another language words it itself, hiding it with\nits sheet and saying its own where it appears, or replacing its text as it is laid:\n\n```js\nconst screen = document.querySelector('[data-quo-screen]');\nnew MutationObserver(() => {\n const note = screen.querySelector('p[data-quo-note=\"store\"]');\n if (note !== null && note.lang !== document.documentElement.lang) {\n note.textContent = 'Dieser Browser kann l\xF6schen, was dein Organismus h\xE4lt \u2026';\n note.lang = document.documentElement.lang;\n }\n}).observe(screen, { childList: true, subtree: true });\n```\n\nAn app that says it in a place of its own reads whether the browser keeps the store from the organism's `state`, the\nvitals' `disk.persisted`.\n\n**The page's consent.** A link's consent is drawn by the page itself, outside every tree, under a head that names the\nhome, in the home's words and dressed by the home's layer, legible with no sheet. It says what the link's offer says,\nas the place's own word, how long the invitation waits and how long its relation lives, and draws no field: the yes\nkeeps the domain that vouched in the standing's note, and a note you want kept beside the standing is one your own\nlanding gives the window's `accept` at the yes (Where Nervur stops).\n\n**A page author never** styles inside the `nervur-lobe` element the screen stands in, never forbids `blob:` styles or\nfonts or a worker of its own origin in its content security policy, and serves no script it does not trust: whoever\nserves the origin's code reaches what the origin keeps, the boot key among it.\n\n### `/.well-known/quo` and links\n\nA site's vouch is plain JSON it writes by hand, served `Access-Control-Allow-Origin: *`:\n`{wards, cards, links?, size?, organism?}`. `wards` are the wards the domain names its own, `cards` each `{ward, at}`,\nthe first the one a link on the domain names; `links` is the path where a link lands; `organism` names the installer's\nversion and digest, the design the visitor's organism is born in, `design: {name, version, data, look, tint}`, and the\nwindow it wears, `window: {name, version, text}` (A site that serves the browser port). `size` is the class of the\nscreen's size, `compact`, `medium` or `expanded`, where the host names one: every draw, and everything a place is told\nof the screen, then carries that class whatever the width, and a change of width moves nothing. With none named, or\nanything else, the class is the width's. A phone's app names it in its `quo.json`, a desktop's install in the file its\n`--design` hands.\n\nA link carries a card and a reference, never the invitation. On a domain it is\n`https://<domain><path>#<reference>`, `/quo` the path where the vouch names none, the reference twenty-six lowercase\nbase32. Elsewhere it is `web+quo:<reference>@<ward>?at=<address>`. A lobe draws one by the ear's `invite` with\n`refer: true`, and `public: true` for a link on a domain; whoever is handed it redeems the reference once on the zero\nhead by `#redeem`, and accepts at its owner's word. On the site's page, the landing in `data-quo-link` reads the\nlink's offer, draws the consent, and on a yes redeems, accepts and draws what the window's `accept` answers; a no keeps\nnothing, and either way the link is taken out of the address. The landing takes a link whole after\nthe `#` too, `web+quo:` or one on any domain, as a camera or a paste hands it, at the page's load or while it stands\nopen, its fragment changed, at once, with no load. A desktop's screen takes a link the same way, whole after\nthe `#` of its own address, `http://127.0.0.1:<port>/#<link>`, and draws the same consent above the page in the home's\nwords; a bare reference is no link there, since that page stands on no site's domain. A link pressed on a\ndesktop, on a page of the web or in a message, reaches that screen by the handler an install lays for `web+quo:`, which\nruns `nervur open <link>`: it opens the screen at the link in the person's own browser, where the consent is asked, and\nwhere no screen answers it opens a page saying so, and nothing is accepted. `nervur accept <link>`, typed at the\nconsole, takes the link by the same steps and is its owner's own word and asks nothing.\n\n**One ask from a script.** A build that reads a place as a stranger asks its front once on the zero head by `askOnce`\nof `@nervur.org/genome/quo`, as the mouth's `once` asks: `askOnce(card, method, args, {carry, draw, crypto?})`\nanswers what the being answered, `{result}` or `{error}`, `silent` for silence and `unavailable` where no address\ncarried the ask. The genome reaches no host, so the script hands the carrier, a box to a ward at an address\nanswered `{reply}` (the reply's bytes, or null for nothing) or `{why}`, and the chance; the box goes to the card's\naddresses in turn until one replies. Over `ws` and `wss`, one frame body a message (Quo's frame, `frameOf` and\n`readBody`):\n\n```js\nimport { askOnce, cardOfVouch, frameOf, readBody } from '@nervur.org/genome/quo';\nimport { unhex } from '@nervur.org/genome/standard';\n\nconst carry = (address, ward, box) =>\n new Promise((done) => {\n if (!/^wss?:/.test(address)) return done({ why: 'this script carries ws and wss alone' });\n const socket = Object.assign(new WebSocket(address, 'quo'), { binaryType: 'arraybuffer' });\n const end = (answer) => (clearTimeout(timer), socket.close(), done(answer));\n const timer = setTimeout(() => end({ why: 'no reply within a minute' }), 60_000);\n socket.onopen = () => socket.send(frameOf({ kind: 'ask', id: 1, ward: unhex(ward).bytes, box }).subarray(4));\n socket.onmessage = ({ data }) => {\n const frame = readBody(new Uint8Array(data));\n if (frame?.id === 1 && frame.kind !== 'ask') end({ reply: frame.kind === 'reply' ? frame.box : null });\n };\n socket.onerror = () => end({ why: 'the line did not open' });\n });\nconst card = cardOfVouch('example.com', await (await fetch('https://example.com/.well-known/quo')).text());\nconst draw = (length) => crypto.getRandomValues(new Uint8Array(length));\nconst answer = await askOnce(card, 'spec', {}, { carry, draw });\n```\n\n### A faculty in a site, whole\n\nA guestbook at `example.com`: each visitor's organism, in its tab, holds a standing on a lobe of the site's server, and\nsigns over it. Four pieces tie together by one card, the server organism's public ward and its addresses.\n\n**1. The server**, reached by browsers over `wss` alone, behind a TLS proxy of the machine forwarding\n`https://example.com/quo` to `ws://127.0.0.1:9112/quo`:\n\n```sh\nnervur install --public example.com --ws wss://example.com/quo\nnervur card --json # {\"result\":{\"ward\":\"<ward>\",\"at\":[\"tcp://example.com:9110\",\"wss://example.com/quo\"]}}\n```\n\n**2. The faculty** draws a link for one visitor by the ear, and answers each visitor over the relation the link\nbecomes, by `this.stamp.occupant`:\n\n```js\nimport { Faculty } from 'nervur:faculty';\n\nexport default class Guestbook extends Faculty {\n static blueprint = {\n name: 'com.example.guestbook',\n version: '0.1.0',\n methods: {\n link: { kind: 'reading', description: 'A one-time link for a visitor: its reference.' },\n sign: {\n kind: 'writing',\n args: {\n type: 'object',\n properties: { text: { type: 'string', minLength: 1, maxLength: 200 } },\n required: ['text'],\n additionalProperties: false,\n },\n },\n entries: { kind: 'reading', description: 'The fifty oldest entries, each its text.' },\n draw: { kind: 'reading' },\n },\n placeholders: { ear: 'nervur.ear' },\n };\n\n async link() {\n const args = { waits: 604_800_000, lives: null, refer: true, public: true, note: { role: 'guest' } };\n const drawn = await this.ask('ear', 'invite', args);\n return 'result' in drawn\n ? { reference: drawn.result.link.reference }\n : this.error(drawn.error.code, drawn.error.message);\n }\n\n sign(args) {\n const refused = this.checked('sign', args);\n if (refused !== undefined) return refused;\n if (this.stamp.occupant === null) return this.error('refused', 'a guest signs over the link it took');\n this.cells.set(['entry', this.stamp.time, this.stamp.occupant.far], args.text);\n return null;\n }\n\n entries() {\n return this.cells.range({ prefix: ['entry'], limit: 50 }).cells.map(({ value }) => value);\n }\n\n draw() {\n const rows = this.cells.range({ prefix: ['entry'], limit: 50 }).cells.map(({ key, value }) => ({\n t: 'li',\n a: {},\n k: `${key[1]}-${key[2]}`,\n c: [value],\n }));\n return {\n t: 'main',\n a: {},\n c: [\n { t: 'ul', a: {}, c: rows },\n { t: 'textarea', a: { name: 'text', placeholder: 'Say hello' }, c: [] },\n { t: 'button', a: {}, press: { method: 'sign', args: {} }, c: ['Sign'] },\n ],\n };\n }\n}\n```\n\nCreated wired to the ear, `create {faculty, wiring: {\"ear\": \"ear\"}}`, it draws one link a visitor:\n`nervur lobe <ID> link --json` answers `{\"result\":{\"reference\":\"<26 base32>\"}}`, so the site's own server, on the same\nmachine, asks it at each visitor's press and hands `https://example.com/quo#<reference>`. A link is redeemed once.\n\n**3. The vouch**, `https://example.com/.well-known/quo`, served `Access-Control-Allow-Origin: *`, names the card of\nstep 1 as the domain's own; the visitor's worker takes a link only for a ward the vouch names:\n\n```json\n{\n \"wards\": [\"<ward>\"],\n \"cards\": [{ \"ward\": \"<ward>\", \"at\": [\"wss://example.com/quo\"] }],\n \"links\": \"/quo\"\n}\n```\n\n**4. The pages**, beside the browser port at `/nervur` (A site that serves the browser port). `/quo`, where a link\nlands, holds `<div data-quo-link></div>` and loads `/nervur/page.js`: it draws the consent, and on a yes the visitor's\norganism redeems the reference on the public ward's zero head and accepts the invitation. `/guestbook` reads the\nstanding the domain gave through the page module and draws the entries in its own markup, each signing asked over that\nstanding:\n\n```html\n<ul id=\"entries\"></ul>\n<textarea id=\"text\"></textarea>\n<button id=\"sign\">Sign</button>\n<script type=\"module\">\n import { ask, standings } from '/nervur/page.js';\n\n const standing = (await standings()).find((one) => one.domain === 'example.com');\n const list = document.getElementById('entries');\n const show = async () => {\n const heard = await ask(standing, 'entries');\n if (!Array.isArray(heard)) return;\n list.replaceChildren(...heard.map((text) => Object.assign(document.createElement('li'), { textContent: text })));\n };\n if (standing !== undefined) {\n await show();\n document.getElementById('sign').onclick = async () => {\n await ask(standing, 'sign', { text: document.getElementById('text').value });\n await show();\n };\n }\n</script>\n```\n\nThe same standing is a place on the visitor's screen too, where the guestbook's own `draw` draws it.\n\n### Push\n\nA closed browser is woken by Web Push: on a person's press, the page's `wake(key)` subscribes under the key\nyour sender signs with and answers `{endpoint, keys}` to the page's own code. Keeping subscriptions and sending to them\nis a faculty's, over `network`, since a push is a web request. A push says only that something waits: the keeper reads\nnone of it and shows one notice in the words `{title, body}` the site serves at `waits.json` beside the keeper. A phone\nis woken by APNs or FCM, to the token its page's `wake()` answers; sending is your own code, with your keys at Apple and\nGoogle, as for the web.\n\n### The web from a lobe\n\nA skin lobe of `network` reaches the web outside Quo. Bodies are bytes, in pieces of at most a mebibyte:\n\n```js\n// A request: answered by its response, or by {request} to take it piece by piece.\nconst sent = yield { placeholder: 'network', method: 'send', args: { method: 'GET', url: 'https://example.com/', headers: {}, body: new Uint8Array(0) } };\n// sent.result: {status, headers, body, more} or {request}; then take {request, piece} from 0, or send {request, body, more} for an upload.\n\n// A path served: network asks this lobe back for each request.\nyield { placeholder: 'network', method: 'listen', args: { path: '/hooks' }, durable: true }; // answers {url}\narrived(args) { return { status: 200, headers: {}, body: this.codec.utf8('ok').bytes, more: false }; }\n```\n\nA served request arrives as `arrived {request, method, path, query, headers, body, more}`, then\n`piece {request, body, more}`; the first answer that is no null is the response, its body piece 0, and each piece\nafter it `network` asks as `rest {request, piece}` by its number, from 1, one asked ahead while the last goes, answered\n`{body, more}`; and `gone {request}` where the request broke. Bytes kept a piece a cell are served by number:\n`rest({ piece }) { return { body: this.cells.get(['blob', piece]), more: piece + 1 < count }; }`, a reading method that\nkeeps no cursor and commits nothing. Declare `network: 'nervur.network'` among the placeholders, and declare `arrived`,\n`piece`, `rest` and `gone` with `askers: [\"network\"]`. A host is served only where it is reached: a machine with\n`--public`, or an edge at its domain; a browser and a phone serve nothing.\n\n## Talking to the world\n\n- **Inviting.** A lobe invites to itself alone, through the ear: `ear` `invite {waits, lives, note?}`\n answers `{invitation, far}`, `far` the ID that will stand for the relation. `note` is free JSON on what the relation\n is for, kept by the brain and never sent. `says` is free JSON too, what the inviter wants known before the yes, a\n name, a purpose: it travels in the invitation, and a link's holder reads it with both spans by `#offer`, spending\n nothing. The invitation is Quo's `{text, sig}`: its text holds Quo's fields, both spans, `says` and the anchor's\n mark, and the ward drawn for it signs that text whole, so whoever carries it can change none of it and an accepting\n organism refuses one whose signature fails. The signature proves the text is the ward's own, never whose the ward\n is: a link on a domain says that by the domain's vouch. With `through: <address>` the ward is reached through an\n organism always on; with `refer: true` it answers a link, `{link: {card, reference}, far}`.\n- **Being asked from far.** Every ask over a relation the lobe gave carries `this.stamp.occupant`, `{far, note}`, the\n note given at the invitation with the lobe's own note merged over it. A role is read from that note and the\n lobe's cells. `left {far, note}` says the relation ended.\n- **Asking far.** A lobe wired to `mouth` accepts: `mouth` `accept {invitation, placeholder, note?}` answers `{far}`,\n and the lobe asks `placeholder` as any node. `once {card, method?, args?}` asks once with no relation, on the zero\n head; `drop {far}` ends a relation either way. An owner accepts for a lobe by the brain's\n `accept {relation, invitation, lobe}`.\n- **The public part.** At most one lobe is the ear's `front`, set by an owner's order:\n `nervur ask brain order '{\"node\":\"ear\",\"order\":{\"termination\":\"<ID>\",\"placeholder\":\"front\"}}'`. It answers strangers\n on the organism's public ward alike, and by default nothing a stranger asks changes anything: every run is a reading\n one, and only the ear's `invite` runs as ever, so the front hands out invitations and links, and a change goes over a\n relation the front invites the stranger to; a stranger's write through it answers\n `refused: A reading ask writes no cells.`. An owner's word `changes`, by `limit`, lifts that for the front,\n a repeat then its risk. From the command line, a stranger asks a front by the card its owner hands, the `result` of\n `nervur card --json` there:\n `nervur ask mouth once '{\"card\":{\"ward\":\"<ward>\",\"at\":[\"tcp://example.com:9110\"]},\"method\":\"list\"}'`.\n- **What a lobe never sees** is a ward or a key, only IDs. An ask over a relation runs at most once; one taken\n already hears `repeated`. A box is 1 MiB, more crossing in pieces.\n- **Reserved words.** No method opens with `#`. Quo and Nervur keep `#in`, `#whole`, `#out`, `#pieces`, `#leave` and\n `#redeem` and `#offer`, and the brain's words above.\n\n## Pilots\n\nA pilot lays an organism on a host from afar. It is a repo's, never a port's: the port gives it the cargo, the claim and\nwhat its channel lays, and nothing else. Nervur publishes no pilot; write one as any\nfaculty and organ:\n\n- **An edge.** It automates An edge, by hand: a skin lobe of `network` (the provider's API is a web request) and of an\n organ that reads the cargo's files. It draws `CLAIM` from its stamp's seed, uploads the Worker in one request, the\n same binding, migration and secret as `wrangler.toml` names (Cloudflare's script upload takes them as\n its metadata, beside each file as a module, `application/wasm` for each `.wasm`), opens its domain, asks\n `POST /.nervur/claim` and accepts the first invitation through `mouth`, so its organism holds the anchor. It\n lays a new version by laying again, and reaches the other routes of the cargo for a backup, a move or a reclaim. Its\n provider token is a key of its own, kept in its cells and never answered.\n- **A machine.** It draws the claim from its stamp's seed, has the machine run\n `nervur install --boot file --claim <file>`, by cloud-init or a skin lobe of `shell` over `ssh`, asks\n `POST /.nervur/claim` through the machine's proxy and accepts the first invitation through `mouth`, as for an edge.\n- **What a pilot keeps** is its own: the places it laid, each claim until the anchor is passed on. The claim opens\n nothing and proves only that its holder could lay the host.\n\n## Releasing and owning\n\n- **A release** is a version told: raise the root `package.json`'s version in a commit, which the repo lobe tags\n `v<version>`. What leaves a repo is a version by its digest; an owner moves a lobe to it by `version`. A\n package is published only by a `run` of a publish script on a repo lobe, with the keys of that copy, at an owner's or\n a runner's ask. Keys are a copy's: `setToken {name, value}` keeps one in the lobe's cells, written to\n `.env` before each run, never answered.\n- **Sharing a repo.** A repo lobe's `invite {standing}` gives a `reader` (pull), a `writer` (pull and push), a `library`\n (read what was told) or a `runner` (runs the `scripts` it names); a reader's or writer's may name `scope`, folders of\n the repo. Another organism takes a repo by a repo lobe's `accept`; a library by the library's\n `accept {invitation}`, then `add` naming that far road.\n- **Delivering into a buyer's repo.** The buyer's repo lobe invites the builder with a writer's standing scoped to the\n folders it delivers, a note and a span. The builder's repo lobe pulls the scope, commits and pushes; the buyer's lobe\n checks it by both checks and its gate before it lands. The standing ends and the builder keeps nothing of\n the buyer's; a version enters the buyer's library from the buyer's own repo lobe.\n- **Updating lobes.** A new version enters the library, then `version {lobe, faculty}` moves each lobe, its `migrate`\n running; `settle` when it holds, or move back. `nervur update` moves the lobes on the installer's own faculties alone,\n each on an older version than it ships, never a lobe on a repo's faculty.\n- **Authoring with an agent.** Open the repo's own folder. Nervur's guide, this paper and the changelog stand one folder\n up in the lent genome's `docs/`; the repo's harness, its skills, its gate stand in the repo, its owners' own. Code\n runs only where its owners ask it.\n";
18020
+ var NERVUR_GUIDE = "# Nervur's guide\n\nWhat Nervur is and how an organism works, whole, in a few pages: the model a person or a model holds before it touches\nanything, and the model an adopter builds from. The brain carries this guide as its own, so a model present at an\norganism reads it first. How to install, own and build on Nervur, each path with its commands and code, stands beside it\nin `authoring.md`, which travels with it in the genome's `docs/` and which the brain carries beside it, answered by\n`authoring`. What each version of Nervur changed, from 0.31.0, stands beside them in `changelog.md`. Where the exact\ndetail matters, it is in `authoring.md`, in each faculty's own guide, and in what its node answers a **describe**, an\nask naming no method: what it may be asked.\n\n## The bet\n\nSoftware as a graph, never accounts. Every person, group and agent is an **organism** on a device of its own, and\norganisms ask each other over **Quo**, never through a server they share. A shop keeps what it knows of its customer in\nits own organism; the person keeps the rest in their home. Nervur grows by being many small organisms on the devices\nthat already exist, never by one growing big.\n\nTrust is what is scarce, never code: a shape is worth what it makes certain, who may ask whom, what ran and what it\nchanged. The primitives are few: the organism, the relation, the ask, the letter and the owner.\n\nThe genome is a kernel, as Linux is: small, slow to change, built for decades, with no opinion of what stands on it, and\n**the owner is root**. Code starts with nothing, and an owner can give it everything: a faculty's power comes by wires\nand organs, never by opening the cage. A **wall** stands only where it protects someone other than the owner, or where a\npromise cannot be proven without it, as purity, closed cells, keys never exchanged and an ask ending once. Every other\nlimit is a **default** an owner can change, and one no owner's word can move is a gap. So of any limit, ask who it\nlimits, and build powerful things on Nervur: what people do with it is theirs.\n\n## The organism\n\nAn organism lives on one **device**, the machine, in an account of its own there: an account of an operating system, one\nsite of a browser, a phone's app or an edge's durable object. It is sealed. It has two doors and no third: the **ear**,\nwhere every being enters over Quo, and the installer's **door**, where the device reaches it (install, boot, update,\nwipe). Everything else that touches the world or the host is an **organ**.\n\nA device gives it two **zones**:\n\n- **The self**, the organism's own account: `key` (the boot key), `store` (primordial memory, encrypted), `cage` (runs\n every lobe's ask, keeps time) and presence (the console, the screen). The self keeps.\n- **The body**, the work account: `shell`, `disk`, `network` and every repo's organ. The self starts programs as the\n body, never the other way, so nothing the body runs reads the key or the memory. The body forgets: a backup carries\n the self alone, and what the body held comes back from the world. A backup is an older life, of which a lobe is told\n first; what a damaged store still opens a salvage reads at the door, with no boot; a move, sealed to one device, is\n the same life elsewhere, and the copy it left stops; a rekey is a move onto itself, a new data key that costs no\n relation, where a rewrap moves the boot key alone. Who an organism is stands apart from where it is: an owner names\n the addresses it is reached at, ahead of a move.\n\nA host has a body where it has `shell` and `disk`. A server, a desktop, a Pi and a NAS have one; a browser, a phone's\napp and an edge do not.\n\n## Nodes and the graph\n\nEverything in an organism is a **node**, under an ID, with one **termination** where every ask to it arrives:\n\n- **An organ**: a driver. Its **graph half** is its **blueprint**, what a node declares of itself, its name, its version\n and its methods, and its **reach**, what of its host it touches, both held by the brain; its **host half** is code\n running on the device. It holds no cells and declares no placeholders.\n- **A lobe**: an instance of a **faculty**, pure code. It lives only inside an ask and keeps nothing between asks but\n its **cells**, its own partition of memory. It keeps its ID, wires, relations and cells across its faculty's versions.\n- **A far organism**: stands for one relation over Quo, one way, and nothing more.\n\nThe **core** is there from the first install and never torn down: the organs `key`, `store`, `cage` and `network`, and\nthe lobes `brain`, `scheduler`, `ear`, `mouth` and `library`. Everything else is **periphery**.\n\nNodes meet only through **wires**. A node declares **placeholders**, its needs; a wire joins one placeholder to one\ntermination, one way. The **brain** alone writes wiring and checks only that the blueprint name a placeholder expects is\nthe one it gets: a wire says who reaches whom, and code reaches only what its wires give it. A declaration wires\nnothing, whatever ID it carries: a lobe starts with its `cells` and `nerves`, and every other wire is named, in the\n`wiring` given at its creation or by an order, and what stands unwired an owner sees in `state`. Connection comes only\nfrom connection: a lobe orders a wire by its `nerves`, its placeholders with their wires and statuses, only to its own\nchildren and to who asked it, and every other wire is an owner's word, through `brain`, which an owner can give a lobe.\nA lobe that declares a placeholder named after an organ is that organ's **skin lobe**: the only way an organ meets the\ngraph. A lobe may raise **children** through its `nerves`; a child reaches nothing its parent does not, and power only\nnarrows down the line.\n\n## The ask\n\nNodes meet only through the **ask**: a method, its args (data) and a timeout, sent over a placeholder. The brain carries\nevery ask and stamps it with the asker's ID, the time, a fresh 32-byte seed and the lobe memory. Every ask ends exactly\nonce, with `{result}` or `{error: {code, message}}`.\n\n- **Whole or nothing.** A lobe's writes take effect in one batch when it answers. If the brain answers in its place\n (timeout, fault, busy), nothing it wrote remains. An answer reaches its asker only once its batch is on disk, so an\n answer always means it happened. What a lobe already sent to the world stays sent.\n- **From far.** Only a far side's own answer says what happened there. Any other exit may have run, and where no reply\n came may still run until the next ask on that relation is answered; `repeated` says the door took it, so it will not\n run again. An ask that must not run twice carries a key of its asker's.\n- **Reading and writing.** A reading method writes nothing and runs beside others; a writing method runs alone.\n- **Signal or letter.** A **signal** lives in memory and is lost in a crash. A **letter** is kept in primordial memory\n until the lobe takes it, exactly once. An ask whose loss matters is a letter.\n- **Durable asks** go to organs: the brain sends them again whenever the organ reconnects, as \"keep listening\".\n- **Time.** A **budget** bounds the real time a run works, watched from outside it; a **timeout** bounds waiting. Past\n either the run is cut, nothing it wrote lands, and the asker hears `timeout`. An asker names a timeout only where an\n answer is worth no longer; otherwise it waits as long as it may, and an inner ask never outlives the outer one. A run\n that must pause, before a retry or while it holds its lobe, asks its `nerves` `wait {ms}`, answered `null` once the\n span has passed, or `timeout` where its ask's time ends first; it waits as on any ask, spending no budget. Work\n longer than one ask answers at once and ends later, by an ask back or a **job**, which a node answers at once to an\n asker it cannot ask back, and which the asker gives back to ask how the work ended; what is long is cut into pieces\n judged by progress, never by one slow piece.\n- **Queues.** One queue per lobe, asks started in the order they arrive; each asker holds a share, and one over its\n share alone meets `busy`. No wait inside an organism closes a circle: a run waits on any one of the asks it has in\n flight, an ask queued waits on the runs ahead of it in its lobe, and a move of a version waits for the runs of its\n lobe. An ask, or a move, that could start only once a run ended that waits on it, its own run or another lobe's,\n through any number of lobes, queues or the brain, is answered `refused` at once instead of waiting; a run racing two\n asks is never refused for the one it may not need, and one awaiting both hears the one on the circle refused the\n moment the other answers. A\n reading ask that starts beside other readers waits on none of them. Across organisms nothing tells such a circle, so\n it ends at its timeouts.\n- **Status.** Every termination is not ready, connected, unavailable or far, and status flows into each placeholder\n wired to it.\n\n## Ownership\n\nThere are no roles in the brain. Whoever asks the brain is an **owner**: whoever is **present** at the device (the\nconsole or the screen the configuration names present), whoever holds a relation the brain emitted, from afar, and a\nlobe an owner wired to `brain`, which holds what that owner gave it. Every other being reaches only the lobe that\ninvited it. A relation to the brain is owning; a relation to a lobe is belonging, buying or following, and roles live in\nlobes.\n\n- **Presence wins over the graph and never over the account**. The present lobes, the console's and the screen's, are\n one person and hold their relations alike. A model at the console is present as a person is, and holds no more, and\n moves no skin of presence. It reaches the organism by `nervur mcp`, the console's MCP form: a tool for each method of\n each node the console holds, its args, result and kind from the method's blueprint, and the portrait at connect. A\n method marked irreversible, one that tears down, drops or deletes, is hinted destructive and made as the console makes\n it: who must approve what is the organism's to say, and its **harness**'s to ask, the files an agent works by, its\n instructions, hooks, settings and skills. A job is followed as a task.\n- **Another account owns nothing** without the boot key, nor does the device while the organism is down; whoever can\n become every account of a machine holds every organism on it.\n- **The anchor** is the owner no other owner drops: the present lobe, or the first invitation's knock where there is\n none. It leaves only by passing on, and the person present may take a far anchor back by dropping it.\n- An owner reaches a lobe through the brain's `ask`; the lobe sees `brain` as its asker. Among the brain's methods:\n create and move lobes, add organs, wire, invite owners, accept standings, back up, upgrade, read `state`.\n- **A secret is held from strangers and siblings, never from owners.** A lobe's cells are a wall against other lobes and\n the far side, and a default against accident for owners: `state` shows none, so a secret stays out of everyday tools\n and a harness's model, as `ps` prints no process's memory. An owner reads all a lobe holds by a deliberate act that\n shows, a move to a faculty that tells, or a backup.\n- The brain counts and enforces, and never judges. It keeps the organism's **character**, `{name, voice, goals}`, and\n answers every owner its **portrait**: this guide, the character, each lobe with its guide, and the first page of its\n `state`.\n\n## Beings and Quo\n\nQuo is its own spec: asks and replies as data, never code. An organism has a public **ward** (its name) and a fresh ward\nfor each relation it opens to a stranger, so no two strangers can link it by its name, or, where a **relay** is wired, a\nlobe that gives each ward an address of its own, by where it is reached. What a wire shows, and where it asks from, is\nthe network's and the owner's to cover.\n\n- A lobe **invites** through the ear, with **spans**, how long the invitation waits and how long the relation lives, and\n a **note** (free JSON on what the relation is for, never sent). The invitation's text, its spans and what it says\n among it, is signed whole by the ward drawn for it, so no one who carries it changes a word unseen; the signature\n says the text is the ward's own, never whose the ward is. The other organism **accepts** through its mouth; its\n first **knock** that announces a key binds the relation. A relation runs one way: the side that accepted asks, the\n side that invited answers.\n- A **link** is an invitation kept behind a one-time reference: short enough for a QR, it names the ward drawn for it\n and where that ward is reached, so a link names no one, and it is redeemed once on that ward's **zero head**, Quo's\n name for where whoever holds no relation asks. Before the yes its holder reads its **offer** there, spending nothing:\n what the inviter says with it, how long it waits and how long the relation lives. A link on a domain names the public\n ward, where a name is meant to be known.\n- An **end** is a relation as one side holds it, in Quo's words: the **occupant**, the end a lobe gave, which answers,\n and the **standing**, the end the organism holds, granted to the lobes the owner wires, which ask. The brain alone\n keeps ends and their notes; a lobe keeps no copy. An owner hands a standing to another of its organisms, the place it\n asks told nothing: there `taking` draws a key, here `cede` forgets the standing and answers it sealed to that key, and\n there `take` keeps it. Its addresses, its keys and the count of its numbers go on as from one device, so nothing the\n place receives tells it the standing moved. An app or a window of the owner's asks it.\n- The ear opens each box with `key` and never decides; a stranger hears silence, and it keeps no place while a node\n answers. An ask over a relation runs at most once, and one taken already hears `repeated`; a stranger's ask on the\n zero head changes nothing by default, since nothing tells its copy from a second ask, so a change goes over a\n relation. A relation ends from either side, never half. A **box**, one ask or one reply, sealed, is at most 1 MiB;\n more crosses in pieces.\n- A lobe never sees a ward or a key, only an ID. At most one lobe is the ear's `front`, answering strangers the\n organism's public part alike, what it may be asked among it.\n- An organism that cannot be dialed holds a **line** to one always on, and asks travel both ways over it.\n\n## Code: faculties, the library, versions\n\nA **faculty** is one module the cage runs, in the engine's language, JavaScript, extending `Faculty`, its static\n`blueprint` naming its name, version and methods. Its source is one string named by its SHA-256, the **digest**, so the\nversion is inside the digest. Each ask runs on a fresh instance in a cage with no clock, no randomness, no I/O: chance\ncomes from the stamp's seed, time from the stamp, the world only by asks. A faculty proves itself by **evidence**:\npieces of its world replayed exactly. Code is logic and data is cells.\n\nThe **library** keeps every code by its digest and never runs one. Code enters by four **roads** alone, always taken on\nan owner's word, never given:\n\n1. **The genome's**: the default faculties, at install and upgrade.\n2. **The installer's**: the host's organs and the faculties it ships, from its **channel**, the host's own way of\n shipping code: the floor's among them, the console's and the screen's skins and what it gives them by name, the\n floor's look for the window, and the repo faculties, the jailer and the repo lobe.\n3. **A source's**: everything else, from any lobe an owner names that answers `get` and `told`. A repo lobe is Nervur's\n own: it tells a version once a tagged commit holds it, and its `versions.json` names each version's digest. The\n library asks the source (local, or far over a library's standing) for the text, hashes it itself and keeps it only if\n the digest matches and the name and version were never kept under another digest, an owner's `second` taking another\n author's as a name of its own, by its source. A faculty a far place offers is held as given by that place, for its\n asker to create sealed.\n4. **An owner's hand**: a faculty's text an owner's `add` carries itself, kept under `hand@<version>`, by the same\n walls. It is how a bare host gets its first source.\n\nA faculty from a source carries its evidence as an **asset**, a file it carries as part of its version, data that runs\nnothing, so the proof outlives its repo; one with none stays allowed, shown as unproven. What the genome or the\ninstaller lays is proven by the release that ships it.\n\nAn owner **creates** a lobe on a kept digest, naming its wires, and **moves** it to another version in place, or to\nanother faculty's; the move asks the new version `migrate` once, keeps the old one if it fails, and leaves what the new\nversion declares anew unwired for the owner to wire. A landed move keeps one step back until the owner settles it, goes\nback or moves again, and no size of a lobe stops it. The library keeps no old version no lobe or step names, but one an\nowner spares: each boot, and each lobe leaving a version, sweeps them, so a version an owner adds stays for a lobe to\nmove to, an older one too. A version removed keeps its digest, so no other text ever takes it. Lobes that decide who\nsomeone is or what code is (brain, library, ear, mouth) are **immutable**: they move only with the genome. A present\nlobe decides no one: the person present moves the console's or the screen's skin to any faculty by `version`, never a\nmodel or a far owner; the choice is the home's, so an upgrade moves only a skin no one chose, and\n`nervur start --floor`, at the device, lays again the one its **port** gave, the installer for its kind of host, its\ndesign with it, so no skin and no design holds anyone captive.\n\n## Organs\n\nAn organ is `{blueprint, reach, half, code?}`. Its host half is a WebAssembly **component** given exactly the imports\nits reach names, or a **native half** built for one host. No host half's program ever crosses Quo: a **repo's organ**\ncomes only from a repo lobe of the organism's own, pulled and built in its body through `shell`, then added by an\nowner's `addOrgan` under a fixed ID. A host without a body takes faculties only, and organs from its installer and the\nhalves its embedder's build brings, a site's, an app's or a pilot's, each admitted by `addOrgan`. A host half that fails\nshows unavailable and restarts alone. An organ's judgment lives in its skin lobes, which hold its secrets and settings.\nLogic lives in lobes, drivers in organs; a new use case is a new plain lobe composing skin lobes, seldom a new organ.\n\nThe organs Nervur holds: `network` carries Quo and the web; the console asks its present lobe `line` with each line\ntyped; `shell` runs programs as the body; `disk` keeps files under one folder.\n\n## Building well\n\nWhat Nervur leaves to whoever builds, as a builder holds it; nothing here binds an organism.\n\n- **Code is logic, data is cells.** A faculty is one module, written in any language that yields it and bundled by its\n repo's build. A table, a content or a model it serves is laid in its lobe's cells, by `migrate` or by asks, never in\n its source, so a version carries only what changed of the logic.\n- **Logic in lobes, drivers in organs.** Whatever can be decided is decided in a lobe over an organ; heavy computation,\n running a model or transcoding media, is a driver's work and stands in an organ, its host half native code of its\n owner's where it must be, as a driver on a Pi that moves a robot, its source in its owner's repo, built on the Pi, its\n reach the motor's device. The shape that repeats is a plain lobe composing skin lobes: the skin lobes hold what\n reaches the world and its secrets, and the plain lobe holds the use case, reaching the world only by asking them and\n beings.\n- **Signal or letter.** An ask whose loss matters is a letter; one asked again anyway is a signal. An ask back, a letter\n taken again or a durable ask sent again is a cue to read cells, never proof that something happened once: a node that\n owes one and meets `unavailable` drops it, the asker's cells staying the truth, or posts it as a letter that waits for\n the asker's switch on.\n- **Once, far.** What an ask sent far did stays done, so an ask that must not run twice, a payment, carries a key of its\n asker's, which the far lobe keeps and answers once. On a window of one, an asker who must know an earlier box will not\n still run asks once more. A lobe working step by step names its next step in its answer.\n- **Choosing by the nerves.** A lobe reads its statuses and answers `unavailable`, takes another path, or orders its\n wiring again; at `left` it forgets what it keeps of that far organism, as a token. Whoever knocks first holds the\n relation, so a note on an occupant is a belief rooted in the handing over. A lobe that needs more asks at once to one\n being has its organism hold more standings.\n- **Skin lobes.** Every use of an organ is a skin lobe of its own: `network` has the ear, the mouth and the web's,\n `shell` the jailer and every lobe that runs programs. A skin lobe lets a secret reach its organ only as an ask's\n input, never in words the organ keeps. A lobe stands before an organ for other lobes only where they must share what\n it keeps, as one account's token, and is then their skin lobe's plain asker as any other. An organ's long work answers\n at once and asks its skin lobe back; a skin lobe serving another lobe asks it back in turn, by a letter where it must\n not be lost, and never asks its organ again from inside the organ's ask back, which waits on its answer: it keeps what\n follows in its cells and starts it by an alarm, which the scheduler keeps.\n- **Long work.** Work longer than one ask is made of pieces, each its own ask well within the longest timeout, and is\n judged by progress: a piece that times out is asked again, and the whole fails only once it moved not for the span it\n may stand still, never because one piece was slow.\n- **Two organisms nobody can dial** both hold lines to one always on, which passes each ask down the line that proved\n its ward and carries the reply back, unread. A relay, which gives a ward an address of its own, is a repo's, which the\n genome neither holds nor forbids.\n- **A builder delivers into its buyer's repo.** The buyer's repo lobe invites the builder with a writer's standing\n scoped to the folders it delivers, a note and a span; the builder's repo lobe pulls the scope, writes in what it\n delivers and pushes, and the buyer's lobe guards it. The standing ends and the builder's lobe is torn down, so the\n builder keeps nothing of the buyer's, and the buyer keeps what was delivered. An update is a job again, on the buyer's\n word, and a version enters the buyer's library from the buyer's own repo lobe.\n\n## Repos\n\nAn adopter builds on Nervur changing nothing of it: it writes faculties and organs in its own repos, and its nodes act\nonly through asks. What else it changes is its own. What travels as code stands in a **repo**. A repo is its lobes\nand its bytes, kept by the **repo faculties**, the floor's skins of `shell` and `disk`, in `@nervur.org/floor`:\n\n- **The jailer**, `nervur.repos`, one per organism with a body, laid on demand: it alone runs git, keeps each repo's\n bytes at `repos/<name>`, grants each folder to one repo lobe, and lends the genome at\n `repos/node_modules/@nervur.org/genome`, one folder up from every repo, at the version the organism runs; the genome\n carries this guide, `authoring.md` and `changelog.md` in its `docs/`.\n- **A repo lobe**, on `nervur.repo`, one per repo per organism: it commits, pulls and pushes git bundles over standings,\n and guards its own `main` by two checks, Nervur's check of the parts and the repo's own `conform`, the choices its\n owners hold it to, as the lobe's owner chose it, never a writer. Standings on it are a **reader's** (pull), a\n **writer's** (pull and push), optionally scoped to folders, or a **library's** (read what was told). Only `main` and\n its tags move between lobes.\n- **Its commands and keys.** A repo declares commands alone, the scripts of its `package.json`. Keys belong to a copy of\n the repo, never to the repo: its repo lobe keeps them in its cells, never answered and masked in all it tells, and has\n `.env` written from them before each run. What protects a command is its key, never a role: a script without its key\n fails by its own words. An owner asks `run`, `setToken` and `credential`; a credential renews itself before it expires\n and ends with its standing. A lobe an owner wires to the repo lobe may run and commit, but while a writer's standing\n stands on it only the one it names `author` commits; a **runner**, a far organism by its invitation, runs the scripts\n it names alone.\n\n**Authoring and running stand apart**. Authors work on their own organism, in their own repo lobe, gated at the commit,\nand push along their standings. Code runs only where the owners ask it: a reader, a writer or a library never reaches\n`run`, a key or a runner's invitation. They meet at a release alone: a version leaves by its digest, and an owner moves\na lobe to it. A release is published only by a `run` of the publish script on a repo lobe, at an owner's ask or a\nrunner's, on an organism its owner chooses, an authoring one among them. A gate runs the tests of the code that came,\nwhich are the writer's, so it catches a mistake and never a writer: what an owner holds against writers is written in\n`conform`.\n\nA repo's version is its root `package.json`'s; a commit that raises it is tagged `v<version>` and that tag **tells**\nevery part it holds, whose bytes never change after. A repo names no genome: the organism lends it. Its conventions are\nfolders: `faculties/`, `organs/`, `designs/`; everything else is its owners' own, packages included. Its commands are\nits `package.json` scripts, `gate` and `conform` always. Its **harness**, skills among it, says how it is authored, for\nmodels alone, and Nervur shapes nothing of it; a faculty's **guide**, in its blueprint, says how it is run and used,\nread by the owners, a lobe wired to it and whoever holds a standing on its lobe.\n\n**Authoring a repo, anywhere.** A session authors a repo opened in that repo's own folder. Everything it needs is there:\nNervur's guide and the two papers beside it, one folder up in the lent genome's `docs/`, and the repo's own harness,\nskills and gate in the repo. Its harness, its owners' own for whatever agent they bring, takes this guide in at the\nstart of every session, from the genome lent one folder up, at `repos/node_modules/@nervur.org/genome/docs/`, so whoever\nauthors starts holding Nervur, on any organism. Nervur lends knowledge alone, the guide and the papers beside it, for\nany agent and any model, and lays no harness. A repo begins empty, or as the child of a lobe that raises repo lobes and\nlays its owners' boilerplate, harness among it, as its first commit, to be pulled and authored. How a faculty is run is\nits blueprint's `guide`, never a skill.\n\n## The screen and looks\n\nA screen's **home** is the organism it is of, and a **place** is any lobe its person stands on, a far organism's or one\nof their own, as its window draws it. A person sees through the **screen**:\nlobes answer **trees** as data from a reading `draw`, the screen composes them, diffs and patches; no script, style or\naddress can be written in a tree, and a region a sealed lobe draws is drawn for the lobe whose slot asked it, which\nhears its presses; a gesture is another hand on a control the keyboard reaches. A lobe may be created **sealed**, by\nwhoever creates it: it hears and answers, reads its own cells and its faculty's assets, and orders no wire, so code\nanother wrote runs and reaches nothing. A place answers what its describe offers; the floor's window draws a place with\nno `draw` of its own as its methods and a field for each argument, so one describe gives its forms as it gives Quo's\ndescribe and the console's tools. The **window**, the screen's skin lobe, draws in a **design** (tokens, themes,\ncomponents built into a **look** faculty), which is no part of the genome: it creates its design lobes sealed and\nwears the design its port gave it by the name `design` until an owner's `wear` chooses another. What a window hands\nthe host to lay above the page stands outside every tree, where no place's tree or sheet covers or presses it, and no\ntree of a place forges a consent the window holds. The floor's window is the least that lets a person use what Nervur\npromises from a screen: it shows the organism and a place by what they describe, carries a press past the person's\nyes where it binds them, takes a link only with a yes that knows who invites and what they say, and leaves what it\ntook. It says the warnings and every consent in the home's own words and lays a way out above the page; a note its\ncaller gives at a link's yes is kept beside the standing and never sent to the place; and at a place it took, a press\nthe person consents to ends the standing whole and returns them to the home. Everything else a person meets, pages\nlaid out of parts, boards, lists and words in their language, is built in a window or a design of one's own: Where\nNervur stops, below, says how. A site is another repo's, and in a\nbrowser a page embeds the installer as plain files.\n\n## Hosts\n\nOne genome on every host; only host halves differ. The engine is QuickJS and the store SQLite with every page encrypted,\neverywhere, and they are named in one place alone. The Node installer serves servers, desktops, Pis and NASes, with a\nbody and `nervur install`, `nervur update`; the browser's has none, its boot key a file of the site. A phone's app\nembeds the browser port, its store in the app's own files and its boot key in the keychain; an edge, its boot key drawn\nand kept in its object's own storage, is laid from another machine from its port's **cargo**, the genome and that host's\nparts built into the files the host's runtime takes, by a **pilot**, a repo's faculty and organ that lay and keep an\norganism on a host from another machine, or by hand, and a server where no one is present by `nervur install --claim`,\nand either is claimed by whoever names its **claim**, a secret drawn and set on the host as it is laid, by which the\norganism's first invitation is fetched. On a server the machine is root's: ports, DNS and services are laid outside the\ngraph by its holder, never by the organism. A server holds as many organisms as it has accounts, one for each, each with\na **body** of its own, a second account where its organs run, so none sees another's files; its administrator prepares\neach person's two accounts once, and the person installs alone. Authoring's _A server_ says what each of the\nadministrator and the person does, for a machine you own, one you hold an account on, and one laid for you.\n\nA new version is tried before it is kept: it boots in place on the store itself, held, writing nothing of it but its\nlog and the values it lays, so the store's log as it stood is the whole way back, kept aside with the old package on a\nmachine. Nothing of the store is copied, and an update costs what its own moves change, never the size of the store;\nthe version boots with the world held, and it is kept or the old comes back by itself. The update asks nothing of the\norganism but its stop, so it moves one no one is present at as it moves one owned at its console. Until 1.0.0 it is\nabrupt: a run the body has going is lost to it as to a crash, and its lobe told so. What the installer ships, its\norgans' halves and its faculties, moves at the new version's first boot, a lobe an owner moved to a later version\nstaying. From afar `upgrade` names a version and its digest, and nothing else lands. An organism never moves itself:\na version lands only where an owner names it, and nothing asks for a newer one on a clock. A start, a trial and a\nstop wait on the organism's silence, never on a span: while it opens or ends it tells it lives, so a store that takes\nlong to open is waited for, and a process that tells nothing for the longest wait, or ends unasked, fails the step\nwith why.\n\nTwo moves stand apart. A faculty's new version is its author's: its `migrate` converts its own cells by its own logic,\nand Nervur only runs it. Nervur's own new version knows no faculty, and from 1.0.0 breaks no contract one stands on.\nUntil 1.0.0 Nervur goes forward only: a genome names its floor, `FLOOR`, the oldest release whose store it carries\nforward, and refuses a store a genome below it last booted, saying to move to the floor first: update it to the\nfloor's release, then to the newest. No installer carries an older release to do that for you, so a store, a backup\nor a move from below the floor is refused as it stands, nothing opened and the store untouched.\n\n## The floor and the licence\n\nAbove the genome and the ports everything is faculties and organs and the data they carry, and the genome names\nnothing built of them, so all of it, Nervur's own defaults among it, can be built again or replaced by anyone.\n\nThe **floor** is only what the genome and the ports cannot work without: the default skins of the organs a port lays,\nthe console's terminal and the screen's window, the two skins of presence, and the repo faculties of `shell` and\n`disk`, the jailer and the repo lobe, which a port with a body lays the first time an owner wants a repo; and the\nplain look the window draws with. The window is the least that lets a person live with no design: it draws the\norganism and each place by what they describe, carries a press past the person's yes where the press binds them,\ntakes a link only with a yes that knows who invites and what they say, and leaves a place it took. Its own words are\nEnglish; a design says them in any other language. Each of the floor's faculties stands on what the genome publishes\nalone, as any repo does, and holds no privilege: the genome lays no skin, a port names the floor's in its\nconfiguration, as an owner's word could name another repo's, and a skin's text whose row is damaged reads from the\nbytes the port gave.\n\n## Where Nervur stops\n\nNervur gives the mechanics no one could build alone, and nothing more: an organism and its keys, an invitation taken\nand its keys kept in the cells, asks one way over it, the owner as root, the cage, the store, backups and moves, the\nscreen's safety, and the ports that lay it on each host. Everything a person meets, holds or is offered is built on it\nby whoever builds, in faculties, organs, designs and apps of their own: a list of places blocked, a report, a page of\nwhat a person can do with a place, a board of many, a keeper of boot keys, a copy of an organism kept somewhere safe,\nwords in every language, a page laid out as one likes. Nervur will not build these for anyone, however often they are\nasked: each is one way among many, and the first one built into the kernel would close the rest. What is asked of\nNervur is weighed by one question: without it, with no design and no app, does something Nervur already\npromises break, or could no one build it on what is published? Three answers alone say yes: nothing published reaches\nit; it can be built, but what Nervur promises could then not be proven; or the only way to build it breaks a promise,\na key held outside the cage, a wait where something could tell, two of a person's relations linked. Easier, faster,\nnicer or often asked is not one of them. What enters comes with its proof, a test played from outside as a stranger\nplays it, failing before and holding after. Where the answer is no, the answer is how to build it, in\n`authoring.md`, never a change to Nervur.\n\nNervur is Bookarest Digital SRL's, under the Functional Source License (`FSL-1.1-ALv2`): anyone reads it, uses it and\nearns with what they build on it; no one sells Nervur itself or a rival made of it; each version becomes Apache-2.0 two\nyears after it is published.\n\n## Where to look\n\n| To know | Open |\n| --------------------------------------- | --------------------------------------------------------- |\n| how to install, own and build on Nervur | `authoring.md`, beside this guide |\n| what each version changed | `changelog.md`, beside this guide |\n| how a faculty is run and used | its `guide`, in its blueprint, and its node's describe |\n| what an organism is and holds now | the brain's `portrait` and `state` |\n| how a repo is authored and released | `authoring.md`, then the repo's harness, its skills first |\n| what crosses between two organisms | Quo's own spec, by its chapter |\n";
18021
+ var NERVUR_AUTHORING = "# Building on Nervur\n\nHow to install, own and build with Nervur as it stands at this version: each path from nothing to running, with the\ncommands and the code it takes. It is written for an agent that builds on Nervur, and for the person beside it. Read\nNervur's guide first, `guide.md` beside this file: it holds the model, and this holds the how.\n\nEvery command, method, field and file named here exists as written. Where a shape is not built yet, this paper says so.\n\n## The map\n\n**What exists.** The genome is the kernel every organism runs, on every host. The floor is only what the genome and\nthe ports cannot work without, the default skins of the organs a port lays: the console's terminal, the screen's\nwindow and the floor's look and design it draws with, and the repo faculties, the jailer `nervur.repos` and the repo\nlobe `nervur.repo`, which keep your repos on a host with a body. A port lays them on one kind of host. Everything else\nis yours, built in repos of your own as faculties, organs, designs and apps: Where Nervur stops, below, says what that\nis and how.\n\n| Package | What it is |\n| ------------------------------- | ----------------------------------------------------------------------------------- |\n| `nervur` | the `nervur` command, for a machine |\n| `@nervur.org/installer-node` | the Node port: Mac, Linux, a Pi, a NAS, a server; and the edge's cargo |\n| `@nervur.org/installer-browser` | the browser port: files a website serves, its visitors' organisms in their tabs |\n| `@nervur.org/installer-phone` | the phone port: the browser port inside an app, with its keychain and its push |\n| `@nervur.org/genome` | the kernel; its `faculty`, `standard`, `evidence` and `kit` exports are a builder's |\n| `@nervur.org/floor` | the floor's faculties, the repo faculties among them, and the design kit |\n\nEvery package stands on npm, and none needs a token to be read.\n\n**What each host gives.**\n\n| Host | Body (`shell`, `disk`) | Dialed by others | Runs in the background | Woken by |\n| ---------------------- | ---------------------- | ------------------------ | -------------------------- | ------------ |\n| Mac, Linux desktop | yes | where no router hides it | a service, at every boot | - |\n| Server, Pi, NAS | yes | yes, with `--public` | a service, always on | - |\n| Browser (a site's tab) | no | never | asleep when no tab is open | Web Push |\n| Phone (an app) | no | never | no | APNs or FCM |\n| Edge (a Worker) | no | yes, at its domain | woken by what arrives | what arrives |\n\nOnly a host with a body keeps repos, runs programs and builds organs. A host without one takes faculties alone, by its\nlibrary's standing on a far repo lobe, and the organs its port brings. An organism nobody can dial, a\nbrowser, a phone or a laptop behind a router, holds a line to one always on, and is reached through it.\n\n**Where each step is proven today.** The Node port runs on a Mac and on Linux; a clean Linux machine, a real Pi and\nWindows are not proven yet. The browser port is proven on Chromium; on Safari, on a Mac and on an iPhone in the\nsimulator, its seams hold in a worker, an organism stands from a link, a tab left and opened again keeps it, and a far\nside asks it down a held line; a link taken and a press are not proven there yet, nor a real iPhone. A browser session\nthat keeps nothing, a private window, gives the port no store, so no organism stands there. No pilot is published: an\nedge is laid by hand (An edge, by hand) or by a pilot you write (Pilots).\n\n## Where Nervur stops\n\nNervur gives what no one could build alone: an organism and its keys, an invitation taken and its keys kept in the\ncells, asks one way over it, the owner as root, the cage and the store, backups, moves and the hand of a standing, the\nscreen's safety, and the ports. It builds nothing a faculty, an organ, a design or an app of yours could build on\nthose, however often it is asked, because each such thing is one way among many and the first built into the kernel\nwould close the others. Before you ask Nervur for something, ask the guide's one question: without it, with no design\nand no app, does something Nervur already promises break, or could no one build it on what is published? It is a gap\nonly where nothing published reaches it, where building it leaves a promise unproven, or where your only way breaks a\npromise; then it comes with a test, played from outside, that fails today. Otherwise it is yours to build, and the\ntable below says how. A request that fails this question is answered with this section, never with a change.\n\n**Your own window is the road to most of it.** The screen's present lobe, the floor's `nervur.window`, is a faculty\nlike any other. Each host names the one an organism is born wearing: a desktop's first install by\n`nervur install --faculties <package>`, a package of yours exporting `WINDOW` in the shape `@nervur.org/floor` exports\nit; a site by its own `/.well-known/quo`, and a phone's app by its `quo.json`, as A site that serves the browser port\nand A phone tell. The person present then moves it to any faculty by `version`.\nWrite your own, standing on what the floor's stands on, the screen's organ, the brain's asks and the window's contract\nthis paper tells whole (A window of your own), or wrap the floor's behind a design. The floor's\nwindow is the least that lets a person live with no design: it draws the organism and each place by what they\ndescribe, carries a press past the person's yes where the press binds them, takes a link only with a yes that knows who\ninvites and what they say, and has one leave, at a place it took. Whatever else a person meets at their home, its\npages, its words, its lists, its choices, is that lobe's and its design's, never Nervur's.\n\n| You want | Build it as | On what Nervur gives |\n| ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |\n| a place a person can block, and refuse it again | your window keeps the wards and the domains it refused in its cells, and refuses a link of one before it is taken | a link's card names its ward and its domain before anything is spent |\n| a report of a place | your window or design links to where you send reports, with the place's ward | the standing's ward, read by your window |\n| a page of what a person can do with a place | your design draws it, its presses asked of your window, which asks the brain | the brain's `drop`, `note`, `reinvite`, `hand`; a press is the window's |\n| a name the person goes by at each place | your window gives the note it wants at the yes: `accept` takes a `note`, kept beside the standing and never sent to the place, and the brain's `note` sets it anew | `accept`'s `note`, the brain's `note`, kept beside the standing and never sent |\n| a place named as the person would | your window reads the standing's note and the domain that vouched for it, and keeps the name it gives in its cells | the brain's `note` and `accept`'s `note` |\n| the places the person stands on, together | your window reads the relations it holds and draws them as it likes | relations are standings, the brain's `ends`; a press is the window's |\n| a board of widgets of many places | your design lays `slot`s naming placeholders of your window, each wired to a place's lobe | a slot draws the lobe its placeholder is wired to |\n| a page of parts made from what a lobe says of its methods | your design draws components named for shapes you choose, from a field of your own your faculties' seats carry | the describe and its free seat fields, the tree, a press the window carries |\n| a theme, a language, a name kept for the person | your window keeps them in its cells and draws by them | what the host tells: the device's language and theme, the screen's size |\n| the home's words in many languages | a design on the owners' road words itself by key, in any language | a design's words by key, handed the person's language |\n| a page of the organism's state, lobes and library, laid out as you like | your design's `organism` component draws what the window hands it, or your window asks the brain's `state`, `lobes` and `ends` and the library's `list` and draws them | the organism's describe, the brain's asks, the library's `list` |\n| a site's pages that draw what its visitor holds | the site's pages ask the standings the browser holds and draw the answers with their own markup | the browser port's page module, `standings()`, `ask`, `watch`; the vouch |\n| a phone app's screen | the app's page draws in your window and your design | the page module, `data-quo-link`, the window's `accept` |\n| a hand-off to the web | your window shows a link a method answers, as the home's own words, opening only on a yes | a link of the world with its ask, `world {say, yes, no}` |\n| a far lobe that tells a window \"my answers changed\" | your window invites the lobe by the ear's `invite` and hands it the invitation; the lobe accepts it through its mouth and, at each change, asks over it a method your window declares, which draws again | the ear's `invite` (`through` where your home cannot be dialed), the mouth's `accept`, asks over a relation |\n| a lobe that asks for another over some of its standings | a faculty that invites to itself, is granted the standings the owner `order`s it, and forwards the device's asks over them | the ear's `invite` and `refer`, the brain's `order`, a lobe's `nerves` |\n| the places of another home you own, seen here | your window asks that home's brain, which you own, and draws what it answers | an owner's asks afar, the brain's `state` and `ends` there |\n| a consent screen that says more | your design draws it from what the window hands it, or your own window draws its own landing; the yes is the window's `accept`, with the note you want | the link's offer, read before the yes, spending nothing |\n| a keeper of a server's boot key | a faculty that keeps each device's key in its cells and answers the unlocker's four asks, `keep`, `open`, `admit` and `rewrap`, as A server tells | the remote boot mode and the asks its unlocker makes |\n| a copy of a home kept safe, on a drive or afar | a faculty or an app that asks `backup` and `backupPiece` and keeps the sealed bytes where it likes; `nervur restore` or a port's `lay` brings it back as an older life | the brain's `backup`, `backupPiece`, a named key; the ports' restore |\n\nNervur keeps the screen safe whatever window you write: a design's tree is checked and reaches nothing of the organism,\nand a press is carried by the window and never forged by a tree. What your window hands the host to lay above the page,\n`way` (A window of your own), stands outside every tree, and no place's tree or sheet covers or presses it. Whether a\npress waits for the person's yes, and what stands above the page, are your window's own. Everything else is yours.\n\n## Installing and owning\n\n### A machine: Mac, Linux, a Pi\n\nOne script lays Nervur on a machine with nothing on it, Node included: `install/install.sh` for a Mac, Linux or a Pi,\n`install/install.ps1` for Windows, both in the package `nervur`. Run from a copy of it:\n\n```sh\nsh install.sh\n```\n\nOn Windows, in PowerShell:\n\n```powershell\npowershell -NoProfile -ExecutionPolicy Bypass -File install.ps1\n```\n\nNo address of ours serves the scripts yet: take them from the package `nervur` on npm, its `install/` folder. What the\nscripts do:\n\n- They take Node's own distribution for the machine from Node's site, `nodejs.org`, or from a mirror of it that\n `NERVUR_NODE` names, checked against the digest Node publishes for it, which the script pins. Nervur publishes no\n Node: the digest, not the address, is what is trusted.\n- The Node they lay moves with Nervur. They mark its folder with an empty `.nervur-node`, and an update that lays a\n version pinning another Node lays that one first, taken as the script takes it, from Node's site or the mirror\n `NERVUR_NODE` names (for an update, a `file:` address names a folder), and checked against the digest that version\n pins. It becomes the one that runs only once it stands whole beside, so a cut leaves the old Node or the new; on\n Windows, where a cut in the instant the program moves can leave the new one beside, running the script again lays\n it. A Node that does not match the digest, or a site that gives none, refuses the update, nothing changed. A Node of\n your own, as under `npm install -g nervur`, never moves; remove the mark to keep the script's Node as it stands.\n- They pack `nervur` from the channel, npm's own registry unless `NERVUR_CHANNEL` names another, and install that file\n with Nervur's scope alone mapped to the channel, so every other package comes from npm's own registry. npm's own\n registry is sent no token. A channel you name that reads with one is given it as `NPM_TOKEN`, named to npm for that\n channel alone and kept nowhere.\n- They lay both at `NERVUR_ROOT`: `~/.local/share/nervur` by default, `%LOCALAPPDATA%\\Nervur\\command` on Windows, whole\n or not at all, and put the command on the `PATH` of every later shell (`$NERVUR_ROOT/bin` in `~/.profile`, and in\n `~/.zprofile` on a Mac; the folder itself in the user's `Path` on Windows). A second run finds the command laid and\n lays nothing again. What the script lays every account reads and runs, and a folder above it that stood before is\n left as it was.\n- They run `nervur install` with the words given them: `sh install.sh --boot file`, and after `sh -s --` where the\n script is piped. Piped, the script asks a passphrase at the terminal it runs in (`/dev/tty`).\n- With no terminal at all, under cloud-init or another program, the boot mode is still the host's default: `file` where\n no person sits, a server, a Pi, Linux over `ssh`, so it installs asking nothing; `present` on a Mac or Linux inside a\n graphical session, which reads its passphrase from standard input and is refused with none, so name `--boot file` or\n another mode there.\n- They keep a token nowhere, so a later `nervur update` reads a channel you named with the token npm's configuration\n names.\n\n**With Node 22 or any newer already**, its newest patch, npm is the road. Nervur runs on every Node line Node itself\nstill supports, and each version is proven on the oldest of them:\n\n```sh\nnpm install -g nervur\nnervur install\nnervur state\n```\n\n`nervur install` takes the package from the registry your npm names, npm's own by default. `--channel <registry>`\nnames another registry for one install or update, a mirror of your own. The organism never updates itself: a new\nversion lands when you run `nervur update`, or ask `upgrade` from afar.\n\nWhere Node belongs to root, make npm's global folder your account's first: `npm config set prefix ~/.nervur/installer`,\nwith `~/.nervur/installer/bin` on your `PATH`.\n\n`nervur install` lays the organism in `~/.nervur/organism/`, listening on port 9110 on loopback, and a service of your\naccount: a launchd agent on a Mac, a systemd user unit on Linux and a Pi. Whoever is present at the account owns it.\n\n**A design to be born in.** `nervur install --design <quo.json>` hands the installer the file a site writes for its\norganism: its `organism.design` names the design, and `design.json` with `design/` stand beside it. It is read and\nchecked as a site's is, refused whole where it fails, and the organism wears it from its first screen; with none handed\nit wears the floor's, and an owner's `wear` moves either. Handed again over an organism already laid, it lays the\ndesign too: the organism starts again and wears it, unless an owner's `wear` chose another. The same file may name the\nclass of the screen's size, `size`, as a site's does: the organism's folder keeps it, and the screen is drawn and told\nin that class whatever the window's width; with none named the class is the width's. A file that names a `size` and no\ndesign is taken too: the organism wears the floor's design under it.\n\n**The boot mode** is how the organism gets its boot key at each boot, chosen at the first install, moved by any later\n`nervur install --boot <mode>`:\n\n| Mode | What it is | Its price |\n| ---------- | ------------------------------------------------------------ | ----------------------------------------------------------------- |\n| `present` | a passphrase, asked twice; the default where a person sits | after every reboot it waits for `nervur start` and the passphrase |\n| `file` | `boot.key` in the organism's folder; the default on a server | whoever reads that file owns the organism: keep a copy off it |\n| `keyring` | the login keychain on a Mac, Secret Service on Linux | the account's keychain holds the key |\n| `hardware` | sealed to a Mac's Secure Enclave; refused elsewhere | the organism opens on that Mac alone |\n| `remote` | keepers over Quo, each `--keeper <invitation-file>`, `--end` | a keeper answers it; else the chain ends at `--end`, `present` |\n\nA keeper is any organism, built of whatever you choose, that draws the invitation the device takes and answers the\ndevice's unlocker over the relation it gives, each device apart by the relation that asks. Its four methods take text\nargs, the key as the 64 hexadecimal digits of its 32 bytes and the fingerprint as the device words it: `keep {key,\nfingerprint}` takes the device's key and the first fingerprint it boots, once; `open {fingerprint}` answers the key to a\nfingerprint admitted and refuses any other; `admit {key, fingerprint}` admits one more, as after an upgrade, and\n`rewrap {key, next}` moves the key, each for whoever shows the key the keeper holds. A refusal is the error `refused`,\nand an ask taken answers null, `open` aside. A keeper's check stops a changed device, not a thief: a fingerprint is the\ndevice's own word for what it runs.\n\n### A server\n\nA server is a machine with many accounts, and Nervur keeps three parts of it apart. The **machine** is its\nadministrator's, whoever holds root: its accounts, ports, firewall, domain, TLS and services are laid by that person,\noutside the graph, never by an organism. The **self** is the organism's own account: it boots the organism and keeps\nits folder, its store and its boot key to itself. The **body** is a second account, the **work account**, where every\norgan runs but the self's own, `shell`, `disk`, `network` and every repo's organ, and whatever they start, git, npm\nor an agent. Nothing the body starts reads the self's folder, its store or its boot key.\n\nOne account holds one organism. Another organism on the same machine takes another account, and its own body, and the\ntwo never see each other. Which of these are you?\n\n- **You own the machine.** You are its administrator and every person on it, with one organism or several: _You own the\n machine_.\n- **Another person administers it, and you install.** A company's server, where you hold an account and no root: _You\n hold an account_, after _What the administrator prepares_, which is that person's page.\n- **Someone lays your organism for you,** and you may never log in to the machine: _Laid for you_.\n\n#### What the administrator prepares\n\nRoot prepares each person once, and installs no Nervur. Nothing below is written by an organism: an organism that\ncould make accounts could make any account.\n\n1. **The person's account**, an ordinary one: its own home, its own group, no `sudo`. This is the self.\n2. **The work account**, another, with no login shell and no password, named by you: `bob-work` for `bob`. This is the\n body. It is a second account of the machine, never a second login: nobody signs in as it, by a password, a key or\n `su`, and the person's organism alone starts programs as it.\n3. **One rule**, so the person's account starts programs as the work account, asking no password, and never the other\n way. In a file of `/etc/sudoers.d/`, mode `0440`, checked with `visudo -c`:\n\n ```text\n bob ALL=(bob-work) NOPASSWD: ALL\n ```\n\n4. **Lingering**, so the person's organism starts at every boot with no one logged in, and after the machine restarts:\n `loginctl enable-linger bob`. Without it the install says so and the organism starts only while its account has a\n session.\n\nOn Debian and the systems that follow it the accounts are made so:\n\n```sh\nuseradd --create-home --shell /bin/bash bob\nuseradd --create-home --shell /usr/sbin/nologin bob-work\n```\n\nBesides these, the person needs:\n\n- **A Node every account runs**, 24 or newer, laid by the machine, such as the distribution's own or one under\n `/usr/local`: the body runs on the Node the install runs on, so a Node kept in a person's home would close the body\n out.\n- **A way in:** their public key in the account's `~/.ssh/authorized_keys`, and, where the machine limits who may sign\n in, their name in `AllowUsers`. Nervur asks nothing more of SSH.\n- **A port block**: an organism takes the port it is given, its web the one after it and its WebSocket the one after\n that, `9120`, `9121` and `9122`. Two organisms cannot hold one port, and the second says so plainly, naming the port,\n so give each person a block of their own.\n\nGive each person, in one message: the machine's name, their account and their work account's name, their port, and what\nis open to the world. The machine's other parts stay yours: opening a port, routing a domain to it,\nTLS and a proxy.\n\nWhat stays yours, and is worth a line each: the machine's **swap and memory**, an organism at rest holding some 650 MiB\nresident and its body more under work, so budget each person's organism that, and cap each account with the machine's\nown tools if one must not starve the others; **`hidepid`** on `/proc`, so an account sees no other account's\nprocesses, which it otherwise sees by their command lines; and **every person's leaving**, below.\n\n#### You own the machine\n\nYou hold root, so you prepare for yourself what an administrator prepares for others, and install as that account.\nNever as root: the organism would be root, and so would everything its body starts. The install says so where the\naccount is root, and lays it all the same.\n\n- **One organism, and nothing on the machine you do not trust:** an ordinary account is enough. Install with no\n `--work`: the body runs as the same account, and the install says what that costs, that any program `shell` starts may\n read the organism's folder, its store and its boot key.\n- **Anything you do not fully trust runs on it**, an agent, a repo's build, a faculty someone else wrote: lay the closed\n body. Prepare the two accounts as above, then install with `--work`.\n- **Several organisms:** one account each, a pair for each if you want each body closed, each with its own port block.\n They never see each other, whoever lays them. The accounts are yours to name: `ops` and `ops-work`, `lab` and\n `lab-work`.\n\nThen the same steps as the person's, below, as that account.\n\n#### You hold an account\n\nAn administrator prepared your account. Log in as it, then:\n\n```sh\nnpm config set prefix ~/.nervur/installer\nexport PATH=\"$HOME/.nervur/installer/bin:$PATH\"\nnpm install -g nervur\nnervur install --port 9120 --work bob-work\nnervur state\n```\n\nThe first two lines make npm's global folder your own, where the machine's Node belongs to root. The install proves,\nbefore it lays anything, that your work account starts programs for you and runs the Node, and refuses naming what is\nmissing: the rule the administrator lays, or the folder the work account does not pass. It opens your home to be passed\nand never listed, as it does its own folder, and nothing else of yours. What it lays is yours and the work account's:\nno other account of the machine lists or reads the organism's folder, its store, its key or its service's files, and\nnone lists the folders of code beside them, which the work account reads by name.\n\nYour home stays as private as the folders in it: the install opens only the way through, so keep what is private in\nfolders of mode `700`.\n\nFrom then on the organism is yours alone: `nervur state`, `nervur stop`, `nervur start`, `nervur backup`,\n`nervur update`, and `nervur wipe` to end it, which removes the organism and the body's folder it made and nothing of\nanyone else's. Whoever is present at your account owns it. It starts again by itself when the machine restarts, and an\nadministrator who removes you ends it with you.\n\n#### Reaching it\n\nA server is reached by others: `nervur install --public <host>` listens on every interface and announces\n`tcp://<host>:9110`. Organisms that cannot be dialed hold lines to it over a WebSocket: `--ws ws://<host>:9112/quo` with\nthat port open, or `--ws wss://<host>/quo` behind a TLS proxy of the machine forwarding to `ws://127.0.0.1:9112/quo`.\nBoth ports follow the organism's own: with `--port 9120` they are 9120 and 9122. Opening them, DNS, TLS and the proxy\nare the administrator's, never the organism's.\n\n#### Laid for you\n\nThe administrator may also lay the organism for a person who never logs in to the machine, a colleague, a team, an\nagent, or a customer's server laid by cloud-init or a pilot. The administrator prepares the accounts as above, then\nruns the person's install as the person's account, with a claim. A server laid from afar is claimed as an edge is: its\nlayer draws a claim and names its file at the first install, and whoever names that claim takes the anchor from\nwherever it stands.\n\n```sh\nopenssl rand -hex 32 > claim.txt # drawn by whoever lays the server, kept until the anchor is taken\nnervur install --boot file --claim claim.txt\n```\n\nNo one is present then, so the configuration names no present lobe and no anchor, and the console holds nothing of the\nbrain. The organism serves its web from its first boot, on the port after `--port`, 9111, and answers\n`POST /.nervur/claim` with `Authorization: Bearer <claim>` with its newest first invitation, `{\"invitation\": \"\u2026\"}`;\nevery other asker, and the claim before the first invitation is handed, hears a path that is none, so it is asked\nagain. Whoever accepts that invitation holds the anchor; the anchor passed on, the claim gives no one the organism. The\nweb listens on loopback unless `--public` names a host, so from afar the machine's proxy forwards `https://<host>` to\n`http://127.0.0.1:9111` with TLS: over plain http the claim and the invitation cross in clear. Until the anchor is taken\nwhoever reads the claim holds the organism, wherever the layer put it, user data a cloud's metadata service serves among\nthem. The claim is a first install's word: a later install names the same claim or none. A `nervur reclaim` at the\nmachine forgets it, and the console is present and the anchor again.\n\n#### When a person leaves\n\nThe person ends their own organism with `nervur wipe`, which asks them to type `wipe`, then removes it, its store and\nthe body's folder it made. The machine is the administrator's to clear, in this order, so nothing of the person still\nruns when their account goes:\n\n1. Turn lingering off and end the account's session: `loginctl disable-linger bob`, then `loginctl terminate-user bob`.\n2. Remove both accounts and their homes: `userdel -r bob`, `userdel -r bob-work`.\n3. Remove the rule: the file of `/etc/sudoers.d/` made for them.\n\nAn account removed without its person's `wipe` takes the organism with it, store and key, and no one holds a copy: a\nperson who may be asked takes a `nervur backup` first, and every other organism on the machine stands as it did.\n\n### A browser\n\nA browser holds its visitor's organism, a home in a tab, in a worker of the site; the site serves the browser port as\nplain files. See The browser and the web.\n\n### A phone\n\nAn app embeds the browser port in its web view: it adds `@nervur.org/installer-phone` and Capacitor, runs\n`nervur-phone-lay www organs.json` before `cap sync`, and loads `nervur/page.js` as a site does. The store stands in the\napp's own files, the boot key in the iOS keychain or the Android Keystore; native organs are the app's plugins, named in\n`organs.json` by digest. The design the app's organism is born in is named as a site names it, `organism.design`, in a\n`quo.json` handed to the same command, each file told by its name, `nervur-phone-lay www organs.json quo.json`, or\n`nervur-phone-lay www quo.json` for an app with no organ, with the design's files laid in `www/nervur` as a site lays\nthem; the same `quo.json` names the class of the screen's size, `size`, as a site's file does. The window the organism\nwears is named there too, `organism.window`, as a site names it, its source handed to the same command as a file named\n`window.js`, `nervur-phone-lay www quo.json window.js`, which lays it at `www/nervur/window/faculty.js`. It needs iOS\n17.4 or a current Android System WebView. Whoever holds the app is present and owns it; the package's `sample/` is a\nwhole app.\n\nThe app's page is the organism's own screen: `<div data-quo-screen></div>` is the person's screen, what the window lays\nabove the page standing there as on a desktop. Beside it the page holds `<div data-quo-link></div>` and takes a link\nthe device hands it after its `#`, at its load or while open: the consent is drawn there, a yes redeems and accepts and\nthe screen draws what the window's `accept` answers, a no keeps nothing, and the element is left empty, saying `none`,\nthe link taken out of the address, with no load of the page.\n\n### An edge, and any host laid from afar\n\nWhere no one is present, an organism is laid from another machine. The Node port gives the edge's cargo: a Cloudflare\nWorker whose organism lives in one Durable Object. Whoever lays it draws one secret and sets it on the Worker, `CLAIM`,\nwith `DOMAIN` and, where wanted, `PLACE` or `WITHIN`. The boot key is the object's own: drawn at its first boot and kept\nin its storage, the same at every boot after, so no layer holds it, and whoever holds the Cloudflare account holds the\norganism. No one is present, so the organism names no anchor: it keeps its first invitation and answers it to whoever\nnames the claim, and whoever accepts that invitation holds the anchor. It keeps that same invitation through every\nrestart of its object, an eviction after a few idle seconds among them, so one fetched and accepted is still the one to\nknock on whenever its owner first asks; another is drawn only where the organism comes to be reached at other addresses,\nand that one ends the one before. The Worker answers these routes, each by\n`Authorization: Bearer <CLAIM>`, and to anyone else as a path that is none:\n\n| Route | What it does |\n| ----------------------- | -------------------------------------------------------------------------------------------- |\n| `POST /.nervur/claim` | the newest first invitation |\n| `POST /.nervur/lay` | a backup's bytes, with `x-nervur-key`, or a move's file with none; `?over` replaces a store |\n| `POST /.nervur/arrive` | draws the key a move is sealed to, answering `{\"key\": \"<hex>\"}` |\n| `POST /.nervur/stay` | the old copy's word that the new one never ran |\n| `POST /.nervur/reclaim` | `{\"challenge\"}`; then again with `x-nervur-signature`, a recovery key's signature as 128 hex |\n\nAn edge moves to a version by being laid again, the store tried and kept or brought back, and is wiped\nby deleting what was laid. A machine laid from afar is a machine, claimed by `nervur install --claim` (A server).\n\n**An edge, by hand.** The cargo stands in the published `@nervur.org/installer-node`, under `cargo/`: `worker.js`, the\nmain module, beside the WebAssembly modules it imports, every file named by `cargo/manifest.json`\n(`{\"main\": \"worker.js\", \"files\": [...]}`). The Worker binds one SQLite Durable Object, the class `Edge`, as `EDGE`, and\nruns without Node compatibility. It takes Cloudflare's own tool, `wrangler`, signed in to your account:\n`npx wrangler login` opens a browser to sign in, or, on a machine with none, `CLOUDFLARE_API_TOKEN` names an API token\nmade in the dashboard from its template \"Edit Cloudflare Workers\", with `CLOUDFLARE_ACCOUNT_ID` your account's ID. An\naccount answers at `<your subdomain>.workers.dev` once its subdomain is chosen, once, in the dashboard's Workers page;\n`workers_dev = true` serves the Worker there. In a folder holding the cargo's files:\n\n```sh\nnpm pack @nervur.org/installer-node && tar -xzf nervur.org-installer-node-*.tgz\ncd package/cargo\nnpx wrangler login # or: export CLOUDFLARE_API_TOKEN=... CLOUDFLARE_ACCOUNT_ID=...\ncat > wrangler.toml <<'EOF'\nname = \"acme-edge\"\nmain = \"worker.js\"\ncompatibility_date = \"2026-07-01\"\nworkers_dev = true\nno_bundle = true\nfind_additional_modules = true\nrules = [{ type = \"CompiledWasm\", globs = [\"**/*.wasm\"] }]\n\n[[durable_objects.bindings]]\nname = \"EDGE\"\nclass_name = \"Edge\"\n\n[[migrations]]\ntag = \"v1\"\nnew_sqlite_classes = [\"Edge\"]\n\n[vars]\nDOMAIN = \"acme-edge.<your subdomain>.workers.dev\"\nEOF\nopenssl rand -hex 32 > claim.txt # keep it off this machine too\nnpx wrangler deploy\nnpx wrangler secret put CLAIM < claim.txt\nuntil curl -fsS -X POST -H \"Authorization: Bearer $(cat claim.txt)\" https://acme-edge.<your subdomain>.workers.dev/.nervur/claim > claimed.json; do sleep 5; done\nnode -pe 'JSON.parse(require(\"fs\").readFileSync(\"claimed.json\", \"utf8\")).invitation' > invitation.txt\nnervur accept edge --text invitation=invitation.txt # on your machine: you hold the anchor\nnervur ask edge state\n```\n\n`DOMAIN` is the host the Worker answers at, a domain of your own routed to it or its `workers.dev` name. Where wanted,\n`[vars]` names where the organism lives: `PLACE`, a Durable Object location hint, one of `wnam`, `enam`, `sam`, `weur`,\n`eeur`, `apac`, `oc`, `afr`, `me`, the region the object is placed nearest at its first ask, where it stays for life, a\nlater `PLACE` moving nothing; or `WITHIN`, a jurisdiction, `eu` or `fedramp`, whose data never leaves it. `WITHIN` names\nthe object itself, so changing it later reaches another, empty object, never the organism: set it before the first\ndeploy, and never after. The claim is a path that is none until the organism has booted and handed its first invitation,\nso it is asked again. `claim.txt` lays, moves and reclaims the edge by the routes above, and opens no backup: one\ncarried off to open elsewhere names a public key of yours, the brain's `backup {keys}`, whose secret opens it there, on\nanother edge as `x-nervur-key`. A new version is the same `wrangler deploy` in a newer package's cargo, with the same\n`wrangler.toml`; the claim and the boot key stay.\n\n### A container\n\nA container with a disk that outlives it is a machine: install as on Linux, `--boot file` or `keyring`, the folder\n`~/.nervur` on its volume. Nervur ships no image.\n\n### Owning from afar\n\nAn organism invites an owner by the brain's `invite`, and the other organism accepts it under a name of its own:\n\n```sh\nnervur ask brain invite '{\"waits\":null,\"lives\":null}' > invitation.txt # on the server\nnervur accept server --text invitation=invitation.txt # on the laptop\nnervur ask server state\n```\n\n`waits` is how long the invitation waits for its knock and `lives` how long the relation lives, in milliseconds, `null`\nfor no end. `\"anchor\": true` makes the next anchor, who passes the anchor on. The person present may\nalways take a far anchor back by dropping it.\n\n## Using an organism\n\n### The command\n\n`nervur` alone prints every command. On a machine:\n\n| Command | What it does |\n| ------------------------------------------- | ------------------------------------------------------------------------------- |\n| `install [version] [digest]`, `update` | one act: lays the organism, or moves it to a version, tried before it is kept |\n| `start [--floor]`, `stop` | starts and stops it; `--floor` lays the shipped console and window again |\n| `state`, `card`, `version`, `screen` | the state in full; its card; the versions; the screen's address on this machine |\n| `ask <placeholder> [method] [args]` | asks over a placeholder the console holds, `brain` the organism's own |\n| `lobe <lobe> [method] [args]` | asks a lobe through the brain; no method describes it |\n| `accept <placeholder> <invitation> [note]` | accepts an invitation; `accept <link> [placeholder] [note]` takes a link |\n| `offer <link>` | reads a link's offer, what it says and its spans, and spends nothing |\n| `forget <placeholder>`, `relations`, `ends` | ends an accepted relation; lists them; every occupant and standing |\n| `backup [file]`, `salvage [file]` | a backup to a file of yours; what still opens of a damaged store |\n| `restore <file> [salt]` | a backup restored where no organism stands, as a new life |\n| `arrive`, `move <key> [file]`, `stay` | a move to another device (Life across devices) |\n| `rewrap`, `rekey [--cipher <name>]` | a new boot key; a new boot key and data key |\n| `reclaim` | reclaims the organism by a recovery key |\n| `repos` | lays the jailer, the first time you want a repo |\n| `mcp` | serves MCP on standard input and output to a model present at the device |\n| `wipe` | destroys the organism and all it holds, once you type `wipe` |\n\n`args` is one word of JSON: `'{\"lives\": null}'`. `--text <field>=<file>` gives a file's text as one field of the args,\nso a secret stays out of the shell's history:\n`nervur lobe <repo> setToken '{\"name\":\"NPM_TOKEN\"}' --text value=token.txt`. `--json` prints each answer as data, for\nprograms. `--follow`, on `ask` and `lobe`, waits for the end of a job the answer names, printing the job whole and\nexiting on its code. `--home <folder>` names a test's organism, under the host's temporary folder alone: an account\nholds one organism, in its home, and the command refuses a second anywhere else.\n\n### The brain's asks\n\nAn owner reaches the organism through the brain; each is `nervur ask brain <method> '<args>'`, or the same ask over a\nplaceholder of an organism owned from afar:\n\n| Group | Methods |\n| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |\n| Faculties and lobes | `create {faculty, wiring?, cells?, sealed?}`, `version {lobe, faculty, settled?}`, `settle`, `switchOff`, `switchOn`, `tearDown`, `lobes` |\n| Organs | `addOrgan {id, blueprint, reach, half}`, `removeOrgan`, `settleOrgan` |\n| Wiring | `order {node, order: {termination, placeholder?, until?}, note?}`, `unwire` |\n| Reaching | `ask {lobe, method, args, timeout}` |\n| Owners | `invite {waits, lives, anchor?, refer?, public?, through?, note?}`, `drop`, `recoveryKeys {keys}` |\n| Keys | `rewrap`, `rekey`, `move {to}` |\n| Who and where | `ward`, `addresses {at}`, `hand {far, at}`; `card` reads them |\n| Ends | `accept {relation, invitation?, link?, note?, lobe?}`, `note`, `reinvite`, `drop`; `taking`, `cede {far, to}`, `take {handed, key, relation}` |\n| Life | `backup {keys?}`, `backupPiece {mark, at, length}`, `upgrade {version, digest}`, `time {at}` |\n| Limits | `limit {name, lobe?, value?}`, `limits` |\n| Letters | `repost`, `forget`, `cancel` |\n| State and character | `state {cursor?}`, `ends`, `card`, `character`, `setCharacter`, `portrait` |\n\nEach method's blueprint says the rest: `nervur ask brain` describes them all. `lobe <id> ...` is the brain's `ask`.\n\n**Limits are defaults.** Every bound an owner meets moves by `limit`: for one lobe, or for every lobe with no\nword of its own. Among them `longestBudget`, `longestTimeout`, `lobeMemory`, `queue.share`, `letters.attempts`, `space`,\n`invitations`, `note`, `still`, `within`, `migrate`, `changes` and `tree.nodes`. `limits` reads the words kept. The\norganism's time is set by `time {at}`, milliseconds since 1970.\n\n### The console, the screen and a model\n\nThe console is the terminal's lines: whatever `nervur` types after the command is a line to the console's present lobe.\nThe screen is the window: `nervur screen` names its page on `127.0.0.1`, open to this account's programs alone: this\nhome's own, asked of the organism where it runs, or in words why this home's screen is not available, as when another\norganism of the account holds its port. It shows the organism, its lobes, the library and the place the person stands\non; a lobe is at `/~/<ID>`. What more a person is offered there, other homes, devices let in, lists and choices, is a\nwindow's of your own (Where Nervur stops). Only a host where a person sits holds a screen: a Mac, Windows, Linux inside\na graphical session, or any machine whose first install said `--screen`; on a server, a Pi\nor Linux over `ssh`, `nervur screen` answers that the host holds none, and the organism is owned at its console or from\nafar. A browser draws in the site's page, a phone in its app; an edge draws nothing.\n\nA model is present at the console as a person is, and holds no more: `nervur mcp` serves it the tools `ask` and `lobe`,\neach typed at the console, and the resources `nervur://portrait`, `nervur://guide` and `nervur://state`. A method marked\n`irreversible` is hinted destructive. `portrait` answers Nervur's guide, the organism's character and each lobe with its\nown guide.\n\n## Life across devices and years\n\n- **A backup** carries the self, never the body: `nervur backup <file>`, never written over, says how it opens: by the\n passphrase and the salt it names, or by a copy of `boot.key`. The brain's `backup {keys}` adds public keys, as\n `nervur arrive` shows them, whose secrets open it too. A repo with no lobe elsewhere stays behind, and the backup\n names it first: keep a lobe of every repo on a second organism.\n- **Taking a backup by asks**, from a faculty, an app or afar: `backup` answers at once `{sequence, mark}`, and the\n organism writes on, however large it is. Ask `backupPiece {mark, at, length}` from `at: 0`, each `at` the one before\n plus the bytes it gave: a piece answers once its bytes are written, so no ask waits on the whole. The piece that\n holds the last byte adds `bytes`, the size, `unread`, each cell left out, and `lost`; then `backupPiece` at `bytes`\n answers no bytes and takes the backup from beside the store. A writing that failed answers the next piece with why.\n A move's pieces go the same way, and its ask at `bytes` answers the last piece and stops the old copy.\n- **A restore** is a new life: `nervur restore <file> [salt]` where no organism stands. With the salt the\n backup named, it asks the passphrase it was made under; without, it reads the boot key it was made under as hex on\n standard input, `nervur restore <file> < boot.key`. Lobes, cells and wiring stand, and its repos are laid under its\n own home; every relation the organism gave is dropped, listed by `ends` and `state` as `ungiven` until it is\n reinvited or dropped; standings it holds go on.\n- **A move** is the same life elsewhere, every relation whole: `nervur arrive` on the new device shows a key;\n `nervur move <key> [file]` on the old seals the organism to it and stops the old copy for good;\n `nervur restore <file>` on the new opens it. `nervur stay` on the old undoes the stop while the new copy never ran.\n From afar, the brain's `move {to}` then `backupPiece` carry it; an edge arrives by `POST /.nervur/arrive` and\n `/.nervur/lay`. The key is the whole of what decides where the organism goes: whoever swaps it on its way gets the\n organism. So the person compares the key the new device shows with the one the move names before it goes; an app\n that carries the key can make that easy, showing both sides a few words or digits drawn from the key's SHA-256 for\n the person to match, and refusing until they match.\n- **A standing handed** moves one relation the organism holds to another organism its owner asks, the place told\n nothing: the brain's `taking` there answers `{key, until}`, a key that stands until then beside any other drawn,\n `cede {far, to}` here forgets the standing and answers it sealed to that key, the same bytes again for\n `removedKeysSpan`, and `take {handed, key, relation, lobe?, note?}` there keeps and grants it as `accept` does, its\n numbers going on; a backup of this copy from before the hand is a stranger at the place once the new holder had two\n asks answered.\n- **Keys.** `nervur rewrap` changes the boot key alone; `nervur rekey` changes the data key too, so a former holder of\n the key opens nothing written after.\n- **Recovery keys** prove the right to reclaim and open nothing:\n `nervur ask brain recoveryKeys '{\"keys\":[\"<ed25519 public key, hex>\"]}'`. A set replacing another holds only after a\n week by default, the install's word `recoveryKeyDelay` moving it, so whoever took a device cannot replace them before\n the owners reclaim. `nervur reclaim` shows a challenge; sign it with a key's secret off the device and type\n the signature back, taking whatever time signing needs: the challenge stands until its signature or a refusal ends\n it, even where the host lets the organism go meanwhile, as an edge does when idle. Every relation to the brain ends,\n and the anchor is taken anew.\n- **An update** is tried before it is kept: `nervur update [version] [digest]` stops the organism, a run going lost\n to it as to a crash, keeps the old package and the store's log aside, boots the new version in place on the store\n itself as a trial with the world held, which writes nothing of the store but its log and the values it lays, and\n keeps it or brings the old back by itself, so an update copies nothing of the store, whatever its size; that boot\n moves the installer's organs and the lobes on its faculties, and the update says what moved and what stayed, run\n again where one stayed. It is the same on a machine no one is present at, laid with `--claim`. A version older than\n the one running is a move onto it. From afar: `upgrade {version, digest}`. Nothing else moves it: an organism never\n updates itself. A start, a trial and a stop wait on the process's silence, so an organism whose store takes long to\n open is waited for. A browser and a phone try each version at its first boot the same way, an edge when laid again.\n- **The way back** always stands: `nervur stop`, then `nervur start --floor`, lays the console and window the installer\n ships, whatever skin was chosen, and the window wears the installer's design again, whatever design was worn: the\n design lobe that was worn stands, and is worn again from the home.\n- **A damaged store** is read by `nervur salvage [file]`, with no boot. `nervur wipe` ends the organism for\n good.\n\n## A repo to build in\n\nEverything you build stands in a repo, kept by a repo lobe on your organism, on a host with a body: the floor's repo\nfaculties, which the Node port lays the first time you want a repo.\n\n**What it holds**:\n\n```text\npackage.json its version, and its scripts: gate and conform always\ntools/conform.mjs the repo's own rules, run over what would enter main\nfaculties/<label>/ a faculty each: faculty.js, versions.json, its tests and evidence\norgans/<id>/ an organ each: graph.json, host/build\ndesigns/<name>/ a design each: design.json, tokens/, skin/, components/, versions.json\nREADME.md, LICENSE.md, .gitignore\n```\n\nAny other folder is its owners' own, packages among them, and Nervur reads none of it. No `package.json` names\n`@nervur.org/genome`, and `@nervur.org/floor` names none among its dependencies, so nothing installed shadows the lent\none: the organism lends the genome it runs at `repos/node_modules/@nervur.org/genome`, one folder up from every repo, so\n`import { replay } from '@nervur.org/genome/evidence'` resolves in its tests and build. The lent genome\ncarries Nervur's guide, this paper and the changelog in its `docs/`: an agent authoring a repo reads them at\n`../node_modules/@nervur.org/genome/docs/`, at the organism's version. `.env` is written from the copy's keys before\neach run, so `.gitignore` names it, and every `dist/`.\n\n**Its scripts** are the only commands a repo lobe runs: `gate`, run before each commit, and `conform`, the\nrepo's own rules; by convention also `format`, `lint`, `types`, `test`, `build`, `release`, `text` (writes each\nfaculty's `faculty.js` and `versions.json`) and, for a design repo, `design`.\n\n**Making one.** One command makes the repo and its repo lobe, on a host with a body, and answers the lobe:\n\n```sh\nfield() { node -pe \"JSON.parse(require('fs').readFileSync(0,'utf8')).result$1\"; }\nrepo=$(nervur repo acme --starter --json | field .lobe)\n```\n\n`nervur repo acme` lays the jailer, `nervur.repos`, the lobe that alone runs git, where the organism has none (a first\nrepo is the first time anyone wants one, and no install lays it), set up at the disk's folder; creates a repo lobe on the\nfaculty `nervur.repo`, wired to the jailer and to the organism's ear, mouth, scheduler and library; grants it the folder\n`acme`, a lowercase name that begins with a letter and may carry its domain, as `example.com`; and begins it with its\n`init`, waiting for that job's end as `--follow` does. Said in a line, it names the repo lobe; with `--json` it answers\n`{\"result\": {\"folder\", \"jailer\", \"lobe\", \"init\"}}`, `init` the job whole. It exits on the code the `init` ended on, and\na repo lobe holding the folder then is yours to begin again by the same command. `nervur repos` alone lays the jailer.\n\nRun again, it makes nothing twice: a jailer that stands is used, a folder a repo lobe holds already answers that lobe,\nand a repo lobe whose `init` failed begins again. A folder the jailer holds granted to no lobe is refused, and a name the\njailer refuses leaves no lobe made.\n\n`--starter` lays a `package.json` with `gate` and `conform`, `tools/conform.mjs`, one faculty, `com.example.acme`, and\na `.gitignore` keeping out `.env` and `node_modules/`, as the first commit; `README.md` and `LICENSE.md` are yours to\nwrite; without it the repo begins empty, for the first commit to fill. The folder is `repos/acme` under the disk's\nfolder; author it there with your own editor and agent, or write through the lobe.\n\n**Committing.** `commit {message, files?, paths?, executable?, gate?}` writes `files` (path to text), runs the gate,\nthen the two checks: Nervur's check of the parts and your `conform`. Any red refuses the whole and puts every\nfile back. A commit with no `files` commits what the folder holds. Name `paths` instead, each a file or a folder of the\nrepo, and it commits the changes of those paths alone, added, changed or removed, leaving the rest of the folder as it\nstands: the way for a session to commit its own work where another works in the same folder. The gate still runs on the\nfolder as it stands, the two checks on the repo as that commit leaves it, and `paths` holding no change refuse it. The\ngate runs after `npm ci` where a\n`package-lock.json` stands, so `node_modules` is the lockfile's, and nothing patched there by hand survives. A commit is\na job: it answers `{job}` at once, and `job {job}` reads it whole, its `ended` `{code, out, err}` once it ends, code 0\ncommitted. `--follow` waits for that end, told by the organism and never asked again, prints the job whole and exits on\nits code:\n\n```sh\nnervur lobe \"$repo\" commit '{\"message\":\"reminders\"}' --follow\n```\n\nA `build`, a `pull`, a `push` and an `init` are jobs alike.\n\n**Telling a version.** The repo's version is its root `package.json`'s `version`. A commit that raises it is tagged\n`v<version>`, and the tag tells every faculty, organ and design version its commit holds; from then those bytes never\nchange. A part's version stays in progress, free to change, until a tag tells it. A told version that\nmust change takes a new version.\n\n**Into the library.** The library takes a told version from the repo lobe, by its label, checks the digest, and keeps it\nunder the road `<repo lobe>@<version>`. A lobe is then created on its digest:\n\n```sh\noffer='{\"road\":\"'\"$repo\"'\",\"kind\":\"faculty\",\"label\":\"com.example.reminders\",\"version\":\"0.1.0\"}'\ndigest=$(nervur lobe library add \"$offer\" --json | field .digest)\nlobe=$(nervur ask brain create '{\"faculty\":\"'\"$digest\"'\",\"wiring\":{\"scheduler\":\"scheduler\"}}' --json | field .id)\n```\n\nA faculty's text held in a file enters by your hand instead:\n`nervur lobe library add \"$(node -p 'JSON.stringify({source: require(\"fs\").readFileSync(\"faculty.js\", \"utf8\")})')\"`,\nkept under `hand@<version>`, by the Node every install lays. Before a lobe stands, the floor's window and terminal show\nthe faculty as the library keeps it: its placeholders, the organs it becomes a skin lobe of, whether it talks to the\nworld.\n\n## A faculty\n\nA faculty is one module of JavaScript: its default export a class extending `Faculty` from `nervur:faculty`, its static\n`blueprint` naming its name and version. Its source is named by its SHA-256, the digest. Each ask runs on\na fresh instance, in a cage with no clock, no chance and no I/O: time and chance come from the stamp, the world only by\nasks. Whatever must last stands in its cells. The cage holds the language's own objects and nothing of a browser's or\nNode's: no `URL`, no `TextEncoder`, no `Intl`, no timer. What `@nervur.org/genome/standard` gives works there as on the\nhost, so a faculty that bundles it checks a tree as the screen does; any other module it bundles must reach for no more.\n\n### A whole example\n\nA reminder faculty: it keeps reminders, sets an alarm with the scheduler by a letter, is rung once, and draws itself.\n\n```js\nimport { Faculty } from 'nervur:faculty';\n\nexport default class Reminders extends Faculty {\n static blueprint = {\n name: 'com.example.reminders',\n version: '0.1.0',\n description: 'Keeps reminders and rings each once, at its time.',\n guide: 'Ask `add` with a text and a wall time in milliseconds; `list` reads them; the screen draws them.',\n methods: {\n add: {\n description: 'Keeps a reminder and sets its alarm. Answers its id.',\n kind: 'writing',\n args: {\n type: 'object',\n properties: { text: { type: 'string', minLength: 1, maxLength: 200 }, at: { type: 'integer', minimum: 0 } },\n required: ['text', 'at'],\n additionalProperties: false,\n },\n result: { type: 'object', properties: { id: { type: 'integer' } }, required: ['id'] },\n errors: ['refused'],\n },\n list: { description: 'Every reminder, the rung ones marked.', kind: 'reading' },\n ring: { description: \"The scheduler's alone: a reminder's time came.\", kind: 'writing', askers: ['scheduler'] },\n draw: { description: 'The reminders as a tree.', kind: 'reading' },\n },\n placeholders: { scheduler: 'nervur.scheduler' },\n };\n\n *add(args) {\n const refused = this.checked('add', args);\n if (refused !== undefined) return refused;\n if (args.at <= this.stamp.time) return this.error('refused', 'a reminder rings later than now');\n const id = (this.cells.get(['next']) ?? 0) + 1;\n this.cells.set(['next'], id);\n this.cells.set(['reminder', id], { text: args.text, at: args.at, rung: false });\n // A letter: the alarm is set exactly once, whatever happens after this answer.\n yield {\n placeholder: 'scheduler',\n method: 'set',\n args: { at: args.at, method: 'ring', args: { id } },\n letter: { lives: 86_400_000 },\n };\n return { id };\n }\n\n list() {\n return this.cells.range({ prefix: ['reminder'] }).cells.map(({ key, value }) => ({ id: key[1], ...value }));\n }\n\n ring(args) {\n const kept = this.cells.get(['reminder', args.id]);\n if (kept === undefined) return null;\n this.cells.set(['reminder', args.id], { ...kept, rung: true });\n return null;\n }\n\n draw() {\n const rows = this.list().map((one) => ({\n t: 'li',\n a: {},\n k: String(one.id),\n c: [one.rung ? `${one.text} (rung)` : one.text],\n }));\n return {\n t: 'main',\n a: {},\n c: [\n { t: 'h1', a: {}, c: ['Reminders'] },\n { t: 'ul', a: {}, c: rows },\n ],\n };\n }\n}\n```\n\nSaved as `faculties/com.example.reminders/faculty.js`, with `versions.json` naming its digest, committed under a raised\nversion, added to the library and created with `wiring: {\"scheduler\": \"scheduler\"}`, it runs:\n`nervur lobe <ID> add '{\"text\":\"Call home\",\"at\":1893456000000}'`, and the screen shows it at `/~/<ID>`.\n\n### The blueprint\n\nA blueprint holds `name`, `version`, `methods`, and where wanted `description`, `guide`, `openGuide`, `placeholders`\nand `assets`; the standard refuses any other field.\n\n- **`name`**: a publisher's reverse domain of two labels or more, then the capability, lowercase:\n `com.example.reminders`. The folder under `faculties/` is its label, the same name.\n- **`version`**: three whole numbers. One name and version names one digest for ever.\n- **`guide`**: prose on how the faculty is run and used, read by its owners, by a lobe wired to it and by whoever holds\n a standing on its lobe, never by a stranger unless `openGuide` is true. Say there what a skill would say:\n how it is run is the guide's, never a harness's.\n- **`placeholders`**: each need, a fixed ID (lowercase words joined by dashes) to the blueprint name it expects, or\n `null` for any. A declaration wires nothing: the owner names each wire at `create` or by `order`.\n- **`methods`**: each by a camelCase name, never one opening with `#`, nor `then`, nor a base class name (`stamp`,\n `cells`, `nerves`, `codec`, `crypto`, `quo`, `cage`, `memory`, `ask`, `error`, `describe`, `checked`). Each method\n holds `kind` (`reading` or `writing`, required), and where wanted `description`, `args` and `result` (JSON Schema of\n the standard's subset; `args` an object schema), `errors` (its own codes, none of the genome's), `budget` (ms, only\n where its work must be bounded shorter: with none it works up to the longest budget), `askers` (the fixed IDs alone\n that may ask it, held by the brain), `irreversible` (`true`, or the name of the arg naming what it ends) and `seat`\n (data beside it for a person, below).\n\nA schema's `pattern` is an I-Regexp (RFC 9485): no `(?:\u2026)`, no lookaround, no `\\d`, `\\w`, `\\s` or `\\b`; write `[0-9]`.\n\n**A seat** is data a method carries for whoever draws it for a person: `{for, label, ...}`. `for` is `person`,\n`machine` or `both`; `label` an object of language tag to text, at most 32 tags of at most 500 characters each. Any\nother field is free data the genome gives no meaning, for a window or a design of yours to read; the whole seat, as\ntext, holds at most 16,384 characters. An organ's method carries none. The floor's window draws only the methods\nseated `for` a `person` or `both`, each by its `label` in the person's language, else its primary subtag, else the\nfirst the seat holds, and never one seated for a `machine`; a window of your own reads the seat as it chooses.\n\n**The person's language.** The floor's window picks the seat's words. What a method answers is the place's to word: a\nplace that declares a writing method `told` is asked it, `told({size, language, standard})`, when a person first walks\nto it and again only where one moved; it keeps them by `this.stamp.occupant`, the standing that told them. A place that\ndraws hears the same three as `args.told` of each draw. `size` is the class of the screen's size, `compact`, `medium`\nor `expanded`; the language is the one the person's screen tells; `standard` the standard's version. The host tells a\nplace nothing else of the screen.\n\n### A door of another kit\n\nA door of any Quo kit is shown as a Nervur place is where its describe speaks this language. The describe is Quo's,\n`{lang, asks}`, with `lang` the text `nervur.blueprint`; beside them it may hold `name`, `version` and `description`,\nas a blueprint does. Each entry of `asks` holds `method` and, as a blueprint's method does, `kind`, `description`,\n`args`, `result`, `irreversible` and `seat`:\n\n```json\n{\n \"lang\": \"nervur.blueprint\",\n \"name\": \"com.example.accounts\",\n \"version\": \"1.0.0\",\n \"asks\": [\n { \"method\": \"balance\", \"kind\": \"reading\", \"seat\": { \"for\": \"person\", \"label\": { \"en\": \"Balance\" } } },\n {\n \"method\": \"closeAccount\",\n \"kind\": \"writing\",\n \"irreversible\": true,\n \"seat\": { \"for\": \"person\", \"label\": { \"en\": \"Close the account\" } }\n }\n ]\n}\n```\n\n`kind` says what an ask does: a `reading` changes nothing, a `writing` may, and `irreversible` says it cannot be\nundone; an entry that says no `kind`, as a describe of no `lang` does, is an ask whose effect its door did not say.\nThe floor's window asks a `reading` by itself, to draw and to draw again, a `writing` only by the person's press, one\ndeclared `irreversible` only past its consent, and one with no `kind` only by the person's own press, said first as\nan ask that may change something, one press one ask. `args` is a flat object schema of the standard's subset.\n\n### Methods, cells and the stamp\n\n- A method takes its args and answers data, or `this.error(code, message)`. An error code is lowercase words\n joined by dashes. The genome's own codes are `timeout`, `unavailable`, `busy`, `fault`, `silent`, `removed`,\n `repeated`; a method that throws is a `fault`.\n- **The brain checks no args**. Open a method with `this.checked(method, args)`, which answers `refused` where\n the args do not meet the blueprint's schema, and nothing where they do.\n- **Writing and reading.** A writing method runs alone, and its writes land in one batch when it answers: an answer\n always means it happened, and a timeout, fault or `busy` leaves nothing written. A reading method writes no\n cell, may ask any node and runs beside others. An ask that could start only once a run waiting on it ended hears\n `refused` at once: one back to its own lobe, through a wire to itself, another lobe or the brain, unless both are\n reading and it can start beside the run; and one that meets another run waiting the other way, two lobes asking\n each other or a loop through more. A writing method that needs its own lobe's answer reads its cells instead, or\n posts a letter, which is never waited on. A run may have several asks in flight: racing them (`Promise.race`) is\n never refused for the one it may not need, and awaiting all of them (`Promise.all`) where one would wait on a run\n that waits on you hears that one `refused` the moment the others have answered. A move of a lobe's version, or a\n settle, asked while a run of that lobe waits on you, is refused at once.\n- **Waiting.** A run that must pause, before a retry or while it holds its lobe, asks its own `nerves`:\n `await this.ask('nerves', 'wait', { ms })`, answered `null` once `ms` has passed, or `timeout` where the ask's time\n ends first. It spends none of the run's budget, and the run keeps its place in its lobe. Never pause by asking your\n own lobe and letting the timeout run out: that ask is refused at once.\n- **Cells.** `this.cells.get(key)`, `set(key, value)`, `delete(key)` and\n `range({prefix?, from?, to?, limit?, cursor?})`, a page of at most 1,000, 100 by default, with its `cursor`. A key\n is a tuple of scalars, kept in order. Size what you read at once by `this.memory`, the lobe memory, never a number of\n your own.\n- **The stamp**: `this.stamp.asker`, the ID of who asks (`brain` for an owner); `time`, ms since 1970; `seed`,\n 32 fresh bytes, the only chance; `occupant`, `{far, note}` on an ask from far, else null; `memory`.\n- **Tools.** `this.codec` (`text`, `read`, `base64`, `utf8`, `utf8Text`, in place of `TextEncoder`), `this.crypto`\n (`sha256`, `hkdf`, Ed25519, X25519, ML-KEM, AES), `this.quo` (`readInvitation(text, schemes)`, which checks the\n invitation's signature in the cryptography Nervur ships, the same on every host: an invitation from an organism whose\n port brought another for new invitations reads as none here, and only that organism's own accept reads it),\n `this.cage.run`.\n- **Imports.** The module imports `nervur:faculty` alone; bundle every other module into it.\n\n### Asking\n\nA method asks a node over one of its placeholders, and the brain carries it. Two forms answer alike:\n\n```js\nconst answer = await this.ask('scheduler', 'now', {}); // in an async method\nconst answer = yield { placeholder: 'scheduler', method: 'now', args: {} }; // in a generator method\n```\n\nAn answer is `{result}` or `{error: {code, message}}`. An ask names a `timeout` in ms only where an answer is worth no\nlonger. Options: `letter: {lives}` posts it as a letter to a lobe; `durable: true` marks it durable to an\norgan's method so marked. `this.nerves.read()` answers its placeholders, their wires and statuses, its relations and the\norganism's level; `this.nerves.order({termination, placeholder?, until?})` orders a wire, only to its own children and\nto who asked it; `this.nerves.unwire(placeholder)` lets one go.\n\n### Signals, letters and alarms\n\n- **A signal** lives in memory and is lost in a crash. **A letter** is kept until the lobe takes it, exactly once: its\n asker hears `null` at once, and the answer reaches no one. An ask whose loss matters is a letter.\n- **Alarms** are the scheduler's: `set {at, method, args?}` rings the asker's own `method` with `args` at the\n wall time `at`, as a letter, exactly once through any reboot. Post `set` as a letter. `cancel {id}`, `list`, `now`. A\n ring answered `{again: <time>}` sets the same ring again at that time. Name the ringing method's\n `askers: [\"scheduler\"]`, as the example does, so no one else rings it.\n- **An ask back, a letter taken again or a durable ask sent again is a cue to read cells,** never proof that something\n happened once.\n\n### Long work, jobs and pieces\n\nWork longer than one ask answers at once. Where the node can ask its asker back, it orders a wire back through\n`nerves` and asks it when the work ends; where it cannot, as for an owner, it answers `{job}`, and the asker reads\n`job {job}`, `ended` null while it runs, then holding its exit code. One ask back tells how a job ended:\n`done {job, kind, code, out, err}`. What is longer still is cut into pieces, each its own ask, judged by progress: a\npiece that times out is asked again, and the whole fails only once it stood still for its span. A lobe working\nstep by step keeps its next step in its cells and starts it by an alarm.\n\n### The brain's words\n\nThe base class answers each of these by doing nothing. Declare in your blueprint each one you act on: but `migrate`,\nthe brain asks a word only of a lobe whose blueprint declares it, so a method of that name the blueprint leaves out is\nnever run. None but the brain asks them:\n\n| Word | When |\n| ----------------------------- | --------------------------------------------------------------------------------- |\n| `migrate {from}` | a move to this version, `from` the digest left; it converts the old cells |\n| `left {far, note}` | an occupant this lobe gave ended: forget what you kept of it |\n| `silent {placeholder, since}` | a standing it holds fell silent |\n| `back {placeholder}` | a far organism's line, an organ, or a lobe it reaches is back: deliver what waits |\n| `line {far, up}` | the line an occupant it gave is reached through came up or went down |\n| `restored {at, commit}` | the organism came back from a backup |\n\nEvery word the brain adds after 1.0.0 opens with `#`, which no method takes.\n\n### Describe and draw\n\n- **`describe()`** answers an ask naming no method: the blueprint by default. Define your own to answer by state or by\n who asks; the brain strips the guide for whoever may not read it (`guide`, above).\n- **`draw(args)`**, a reading method, answers a tree the screen draws: `{t, a, k?, press?, c}`, `t` an\n allowed element, `a` its attributes, `k` a key unique among siblings, `c` its children, each a tree or a text. A draw\n reads its cells and its args alone: the brain refuses every ask it makes. A lobe that declares `draw` a reading is\n drawn by it; one without is drawn by the window from its describe, a page of its methods, its reading ones with what\n they answered and its writing ones each a form with a field for each arg. See What a tree may hold for the elements,\n presses and inputs, and A window of your own for who carries a press.\n\n### Evidence and tests\n\nA faculty proves itself by evidence: pieces of its world, each `{says, cells, asks, yields}`, each ask\n`{stamp, method, args, given, answer}`, `given` the asks the lobe makes, in order, each\n`{placeholder, method, args, answer}`. Replayed in a fresh runtime, every answer and the cells it yields must be\nthose it says. A stamp is `{asker, time, seed, occupant?, memory?}`, `seed` 32 bytes. A given ask the lobe posts as a\nletter carries its `letter: {lives}`, held to the letter it posts; a run of `this.cage.run` the host cut stands among\n`given` as `{cut: n}`, the ask's `n`th run from 1. Evidence is data, so write it as data, never as the\n`Piece` or `Asked` types of `@nervur.org/genome/evidence`, which are what the replay reads it into.\n\nIt ships as an asset: `faculties/<label>/assets/evidence.json`, whose asset path is `evidence.json`, so the proof\noutlives its repo; one with none is allowed and shown `unproven`. Its text is data's one text, RFC 8785, bytes\nwritten as `{\"$bytes\":\"<lowercase hex>\"}`: write it by `dataText` and read it by `readText`, both of\n`@nervur.org/genome/standard`. The evidence, beside the faculty:\n\n```js\n// faculties/com.example.reminders/evidence.mjs\nconst stamp = (asker, time) => ({ asker, time, seed: new Uint8Array(32) });\nconst set = {\n placeholder: 'scheduler',\n method: 'set',\n args: { at: 5000, method: 'ring', args: { id: 1 } },\n letter: { lives: 86_400_000 },\n};\n\nexport default [\n {\n says: 'A reminder is kept, its alarm set by a letter, and its ring marks it rung.',\n cells: [],\n asks: [\n {\n stamp: stamp('brain', 1000),\n method: 'add',\n args: { text: 'Call home', at: 5000 },\n given: [{ ...set, answer: { result: null } }],\n answer: { result: { id: 1 } },\n },\n {\n stamp: stamp('brain', 1001),\n method: 'add',\n args: { text: 'Late', at: 10 },\n given: [],\n answer: { error: { code: 'refused' } },\n },\n { stamp: stamp('scheduler', 5000), method: 'ring', args: { id: 1 }, given: [], answer: { result: null } },\n ],\n yields: [\n { key: ['next'], value: 1 },\n { key: ['reminder', 1], value: { text: 'Call home', at: 5000, rung: true } },\n ],\n },\n];\n```\n\nIts test replays what ships, the asset:\n\n```js\n// faculties/com.example.reminders/reminders.test.mjs\nimport assert from 'node:assert/strict';\nimport { readFileSync } from 'node:fs';\nimport { test } from 'node:test';\nimport { replay } from '@nervur.org/genome/evidence';\nimport { readText } from '@nervur.org/genome/standard';\n\nconst text = (path) => readFileSync(new URL(path, import.meta.url), 'utf8');\n\ntest('The reminders hold their evidence', () => {\n const evidence = readText(text('./assets/evidence.json'));\n assert.ok('data' in evidence, evidence.why);\n assert.deepEqual(replay(text('./faculty.js'), evidence.data).missed, []);\n});\n```\n\n`replay(source, evidence)` answers `{missed, made}`: each piece that did not hold, with why, and every ask the lobe\nmade, its timeout and letter with it, for a test to read. `readSkin(source)` reads a source as the first install does,\nits blueprint and digest or why it is refused. `@nervur.org/genome/kit` holds more: `rigOver` runs organisms on the real\nengine, `hosting` and `lobeOf` a class on a recording host. A gate runs the tests,\n`\"gate\": \"node tools/conform.mjs && node --test\"`.\n\n**Assets.** Every file under `assets/`, a hidden name aside, is an asset by its path there. A faculty with any names\ntheir digest in its blueprint as `assets`, a string of 64 lowercase hex: the SHA-256 of the canonical JSON of the\n`[path, sha256]` pairs sorted by path, each `sha256` that of the file's bytes, a text's with LF line ends.\nNervur's check of the parts refuses a blueprint whose `assets` is not that digest, and assets with none. The repo lobe\ntells and serves them, so a faculty that comes by a repo arrives proven, each version with the assets it was told with,\nhowever a later version changes them; one added by hand carries them,\n`add {source, assets}`, each asset `{path, digest, text}` or `{path, digest, base64}`.\n\n### Its text and its versions\n\n`faculty.js` is the text as it ships, committed; `versions.json` maps each version to the SHA-256 of that text, in\nlowercase hex. Nervur's check of the parts refuses a `faculty.js` that is not the text `versions.json` names at its\nversion, and a told entry changed. A faculty written in plain JavaScript is its own text; one written\nin TypeScript, or in many modules, is bundled into one module by the repo's `text` script, `nervur:faculty` kept\nexternal, `@nervur.org/genome/faculty` aliased to it. Every other module is bundled in, what it takes of\n`@nervur.org/genome/standard` among them, so the text is all the code the faculty runs, and a genome whose bundled code\nmoved moves the text: a version a tag told keeps its committed `faculty.js`, and a text rebuilt otherwise takes a new\nversion, as the check refuses the told one changed. The assets digest stands\ninside the text, so it is written first, then the text's digest. The steps after any bundling, for a blueprint that\nholds `assets: '<64 hex>'`, any at first, where the faculty has assets:\n\n```js\n// tools/text.mjs, the script \"text\": each faculty's evidence asset, its blueprint's assets digest, its versions.json\nimport { createHash } from 'node:crypto';\nimport { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { pathToFileURL } from 'node:url';\nimport { dataText } from '@nervur.org/genome/standard';\n\nconst sha = (bytes) => createHash('sha256').update(bytes).digest('hex');\nconst canonical = (bytes) =>\n bytes.includes(0) ? bytes : Buffer.from(bytes.toString('latin1').replace(/\\r\\n?/gu, '\\n'), 'latin1');\nconst filesIn = (at, below = '') =>\n readdirSync(`${at}/${below}`, { withFileTypes: true })\n .filter((entry) => !entry.name.startsWith('.'))\n .flatMap((entry) => {\n const path = below === '' ? entry.name : `${below}/${entry.name}`;\n return entry.isDirectory() ? filesIn(at, path) : [path];\n });\n\nfor (const label of readdirSync('faculties')) {\n const at = `faculties/${label}`;\n if (existsSync(`${at}/evidence.mjs`)) {\n const { default: evidence } = await import(pathToFileURL(`${at}/evidence.mjs`).href);\n mkdirSync(`${at}/assets`, { recursive: true });\n writeFileSync(`${at}/assets/evidence.json`, `${dataText(evidence)}\\n`);\n }\n let text = readFileSync(`${at}/faculty.js`, 'utf8');\n if (existsSync(`${at}/assets`)) {\n const pairs = filesIn(`${at}/assets`)\n .map((path) => [path, sha(canonical(readFileSync(`${at}/assets/${path}`)))])\n .toSorted((one, other) => (one[0] < other[0] ? -1 : 1));\n const named = /\\bassets\\s*:\\s*['\"][0-9a-f]{64}['\"]/u;\n if (!named.test(text)) throw new Error(`${at}: its blueprint names no assets: '<64 hex>'`);\n text = text.replace(named, `assets: '${sha(JSON.stringify(pairs))}'`);\n writeFileSync(`${at}/faculty.js`, text);\n }\n const blueprint = text.slice(text.search(/\\bstatic\\s+blueprint\\s*=/u));\n const version = /\\bversion\\s*:\\s*['\"]([^'\"\\n]+)['\"]/u.exec(blueprint)[1];\n const path = `${at}/versions.json`;\n const versions = existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : {};\n versions[version] = sha(text);\n writeFileSync(path, `${JSON.stringify(versions, null, 2)}\\n`);\n}\n```\n\n### Moving a lobe\n\nA lobe outlives its faculty's versions: its ID, wires, relations and cells stay. An owner moves it by\n`version {lobe, faculty}`, `faculty` the new digest; the new version's `migrate {from}` runs once, and a failure leaves\nthe lobe where it stood. The move keeps one step back until `settle`, a move back, or another move; a\nlobe too big to keep twice moves with `settled: true`. A placeholder the new version declares anew stands unwired for\nthe owner to wire. Lay what a lobe serves, a table, a content, a model, in its cells by `migrate` or by asks, never in\nits source, so a version carries only what changed of the logic; a `migrate` that reads `assets` reads the new\nversion's.\n\n### Patterns\n\n- **A plain lobe composing skin lobes.** The shape that repeats: skin lobes hold what reaches the world and its secrets,\n and a plain lobe holds the use case, asking them and beings. A new use case is a new plain lobe, seldom a new organ.\n- **Signal or letter.** Asked again anyway: a signal. Its loss matters: a letter. A node that owes an ask back and meets\n `unavailable` drops it, the asker's cells staying the truth, or posts it as a letter.\n- **Once, far.** What an ask sent far did stays done, and only the far side's own answer says what happened there. An\n ask that must not run twice, a payment, carries a key of its asker's, which the far lobe keeps and answers once. On a\n window of one, an ask answered closes every earlier box, which then hears `repeated`.\n- **Skin lobes.** Every use of an organ is a skin lobe of its own. A secret reaches its organ only as an ask's\n input. An organ's long work answers at once and asks its skin lobe back; the skin lobe never asks its organ again from\n inside that ask back, which waits on its answer: it keeps what follows in its cells and starts it by an alarm.\n- **Choosing by the nerves.** Read your statuses and answer `unavailable`, take another path, or order your wiring\n again; at `left`, forget what you kept of that far organism.\n- **Children.** A lobe raises children through its `nerves`; a child reaches nothing its parent does not.\n- **Roles are a lobe's**: a relation to a brain is owning; to a lobe, belonging, buying or following, allowed\n by the lobe's cells and the end's note.\n\n## An organ\n\nAn organ is a driver: its judgment lives in its skin lobes, and it holds no cells and declares no placeholder.\nBuild one only for what no lobe can do: a device, a program, heavy computation. On a host with a body an organ comes\nonly from a repo of the organism's own, pulled and built in its body, then admitted by an owner; a host\nwithout one runs the halves its embedder's build brought.\n\n**Its shape** is `{blueprint, reach, half: {form, digest}}`. Its blueprint names its methods with no `kind`,\nand `durable: true` where an ask should be sent again at each reconnect. `reach` is free data the half reads, given at\n`addOrgan`. The half is a WebAssembly `component`, given exactly the imports its reach names, or a `native` program for\none host. The Node port runs native halves alone today; a component is refused there.\n\n**In a repo**: `organs/<id>/graph.json`, its blueprint (as `{blueprint}` or the blueprint itself), and\n`organs/<id>/host/`, one standalone program in any language whose executable `build` leaves it at `host/half`.\nA native half speaks the bridge: one JSON value a line on its standard input and output, each bytes in it\nwritten `{\"$bytes\":n}` and its n bytes following the newline as they are, its reach as its one argument. Its first frame\nis its blueprint; it is asked `{\"ask\": n, \"asker\", \"method\", \"args\"}` and answers `{\"answer\": n, \"result\"}` or\n`{\"answer\": n, \"error\": {\"code\", \"message\"}}`; it asks its skin lobes\n`{\"ask\": n, \"placeholder\", \"method\", \"args\", \"timeout\"}`; and it may say its status, `{\"status\": \"unavailable\"}`,\n`not ready` or `connected`.\n\n```text\norgans/lamp/graph.json {\"blueprint\":{\"name\":\"com.example.lamp\",\"version\":\"0.1.0\",\"methods\":{\"ping\":{}}}}\norgans/lamp/host/half.sh\norgans/lamp/host/build #!/bin/sh\n cp half.sh half\n```\n\n```sh\n#!/bin/sh\n# organs/lamp/host/half.sh: answers every ask \"pong\"\nprintf '%s\\n' '{\"blueprint\":{\"name\":\"com.example.lamp\",\"version\":\"0.1.0\",\"methods\":{\"ping\":{}}}}'\nwhile IFS= read -r line; do\n n=$(printf '%s' \"$line\" | sed -n 's/.*\"ask\":\\([0-9]*\\).*/\\1/p')\n [ -n \"$n\" ] && printf '{\"answer\":%s,\"result\":\"pong\"}\\n' \"$n\"\ndone\n```\n\n**Building and adding it.** Commit it with `host/build` executable and the version raised, so the tag tells it; build it\nin the body; read its half's digest; add it under its fixed ID:\n\n```sh\nnervur lobe \"$repo\" commit '{\"message\":\"the lamp\",\"files\":{...},\"executable\":[\"organs/lamp/host/build\"]}'\nnervur lobe \"$repo\" build '{\"organ\":\"lamp\",\"version\":\"0.1.0\"}'\nnervur lobe \"$repo\" get '{\"kind\":\"organ\",\"label\":\"lamp\",\"version\":\"0.1.0\"}' # its half names the digest\nnervur ask brain addOrgan '{\"id\":\"lamp\",\"blueprint\":{...},\"reach\":{\"account\":\"<the shell account>\"},\"half\":{\"form\":\"native\",\"digest\":\"<digest>\"}}'\n```\n\nA reach naming `account` runs the half in the body, as that account; `nervur state` shows the shell's. `addOrgan` again\nunder the same ID is a release: its wires, skin lobes and durable asks stay. A half that fails shows\nunavailable and restarts alone.\n\n**Its skin lobe** declares a placeholder named by the organ's ID, expecting its blueprint name, and is wired to\nit at `create`:\n\n```js\nstatic blueprint = {\n name: 'com.example.lamp-skin',\n version: '0.1.0',\n methods: { ping: { kind: 'reading' } },\n placeholders: { lamp: 'com.example.lamp' },\n};\nasync ping() {\n const answer = await this.ask('lamp', 'ping', {});\n return 'result' in answer ? answer.result : this.error(answer.error.code, answer.error.message);\n}\n```\n\nThe organs Nervur holds: `network`, for Quo and the web, every host; `shell` runs programs as the body and `disk` keeps\nfiles under one folder, on a host with a body; the console and the screen, presence.\n\n## Designs and looks\n\nA **design** is a repo's design system: tokens, themes, skin and components. Its components build into a **look**, a\nfaculty the window wears, by the design kit `@nervur.org/floor/design`.\n\n### A design folder\n\n```text\ndesigns/plain/design.json {\"name\":\"plain\",\"version\":\"0.1.0\",\"publisher\":\"com.acme\",\n \"themes\":[\"light\",\"dark\"],\"tints\":[\"red\"],\n \"densities\":{\"regular\":1},\"defaults\":{\"tint\":\"red\",\"density\":\"regular\"},\n \"classes\":[\"plain-badge\"]}\ndesigns/plain/tokens/light.json {\"--plain-text\":\"#111111\",\"--plain-surface\":\"#ffffff\"}\ndesigns/plain/tokens/dark.json {\"--plain-text\":\"#eeeeee\",\"--plain-surface\":\"#000000\"}\ndesigns/plain/tokens/tints.json {\"red\":{\"light\":{\"--plain-accent\":\"#b00020\"},\"dark\":{\"--plain-accent\":\"#ff6b81\"}}}\ndesigns/plain/skin/layers.json {\"lobes\":[\"base.css\"],\"home\":[]}\ndesigns/plain/skin/base.css .plain-badge { color: var(--plain-accent); }\ndesigns/plain/components/badge.ts export default (args, theme) => ({ t: 'span', a: { class: 'plain-badge' }, c: [args.label] });\ndesigns/plain/words/en.json {\"back\":\"Back\",\"read\":\"You are read as {name}.\",\n \"days\":{\"1\":\"{count} day\",\"other\":\"{count} days\"}}\ndesigns/plain/versions.json {\"0.1.0\":{\"data\":\"<digest>\",\"look\":\"<digest>\"}}\ndesigns/plain/DESIGN.md its story\n```\n\nOptional: `fonts/`, with `fonts/fonts.json` as\n`{\"faces\":[{\"family\":\"Serif\",\"weight\":\"400\",\"style\":\"normal\",\"range\":\"U+0000-00FF\",\"file\":\"serif.woff2\",\"licence\":\"OFL.txt\"}]}`,\neach `file` and `licence` a file of `fonts/` named from there; `icons/` and `figures/`, its pictures.\n\n**A figure in a component.** The window serves every picture of the design it wears by its digest and its kind, the\nSHA-256 of the file's bytes and its extension, one of `avif`, `gif`, `jpg`, `png`, `webp` (no SVG, which would run its\nscripts at the screen's address). A component names one in `img{src}` by both, never by path:\n\n```ts\n// designs/plain/components/logo.ts: figures/logo.png, its digest from `shasum -a 256 figures/logo.png`\nconst LOGO = { asset: '<sha256 of figures/logo.png>', ext: 'png' };\nexport default (args) => ({ t: 'img', a: { src: LOGO, alt: args.label, width: 120, height: 40 }, c: [] });\n```\n\nA font is laid by its face in `fonts/fonts.json`, the screen writing its `@font-face`. A sheet's `url()` may name a\nfile of the design from `skin/`, `url('../figures/grain.png')`: the screen lays it as that file, by its digest, as an\n`img` names one.\n\n- **Tokens** stand in both themes, tints as accents over both. The light tokens lie on the root, the dark where the\n device prefers it, and either where `data-theme` names it, as a site sets it on its pages, so a sheet that reads the\n tokens follows it with nothing more.\n- **The skin** has two layers: `lobes`, what every lobe's root wears, whose every selector names a class, an attribute\n or `:host` and never an element alone; and `home`, the home's own chrome. A class a component writes is declared in\n `classes` and styled by some rule. A class is a lowercase letter, then lowercase letters, digits and dashes, forty\n characters at most, so `plain-badge` and never `plain_badge` or `plain__row`, and a tree names eight at most; the\n build refuses any other, naming it. A sheet loads nothing outside the design: no `@import`, no `url()` but `data:`, a\n fragment or a file of the design.\n- **A component** is a file directly in `components/`, its default export a plain function\n `(args, theme, state, words)` that answers a tree from its args alone; `theme` is `light` or `dark`, `state` the\n region's local state. A file opening with `_` is a helper; a component may draw another by importing it.\n- **Words** are optional: `words/`, a file for each language `design.json` names in `languages`, as\n `\"languages\":[\"en\",\"ro\"]`, the first the design's own. A key is a letter, then letters, digits, dots, dashes and\n underscores. A word is a text with places, `{name}`, or a count's forms keyed `other`, whole numbers and the plural\n categories `zero`, `one`, `two`, `few` and `many`: a count takes its number's form, else the one its language's rule\n names (Romanian's `few` for 2 to 19, Russian's `few` and `many`), else `other`; the look carries the rules, by primary\n subtag, and a language it knows not takes a number's form or `other`. A component names a key, never a text:\n `words('read', { name })` is that word in the person's language, else its primary subtag, else the design's own, its\n places filled, and `words('days', { count })` the form of that count. A month is a word, `month.1`. What the args hold\n is drawn as it is. Words build into the look beside the components and are no asset. A design on a stranger's road is\n handed no language, so its words are empty.\n- **What the floor's window asks of a design.** It wears only a design that draws `surround`, `organism` and `lobe`,\n with the args `SCREEN_COMPONENTS` of `@nervur.org/floor/design` gives as data: for each component its `args` as a\n schema, the `presses` the window answers from its tree, the `slots` it lays and whether wearing `required` it. Each\n draw is `draw {component, args, theme, state?, lang?}`, `lang` the person's language. `surround {title, route, back?,\n warnings, main, consent?}` is what the floor's window draws around a page where it has something to say: `route` each\n step `{label, path}`, `warnings` lines in the home's words, `main` the args its slot `main` carries, laid as\n `{t: 'slot', a: {placeholder: 'main'}, args: main, c: []}`, and `consent {say, yes, no, yesSay?, noSay?}` the consent\n the window asks, `yes` and `no` two presses the surround lays as they are handed. `organism` is the organism's page,\n its `state`, `organs`, `lobes` and, at home, its `relations`, `faculties` and `about`, with the presses\n `about {faculty}`, `create {faculty}` and `page {cursor}`; a far organism's page is its own, whole, with no press.\n `lobe` is a lobe's page, its `reading` methods with what each answered and its `writing` methods with their `args`,\n each with its seat's `label` where it has one, and `written`, what the last press that wrote answered, with the\n presses `read {path, method}` and `write {path, method}`. A design on a stranger's road writes no word of its own, so\n the window hands it every word it needs, the home's, English: the surround's, the consent's `yesSay` and `noSay`, and\n a seat's `label` in the person's language. A window of your own asks of its designs what it chooses.\n\n### Building its look\n\nThe kit builds the look from the folder's files, as text or bytes; a design repo's `design` script runs it, and the\nrepo lobe asks it as `npm run --silent design -- designs/<name> --look <file>`, reading the look's source from that\nfile:\n\n```js\n// tools/design.mjs, the script \"design\": \"node tools/design.mjs\"\nimport { readdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { stripTypeScriptTypes } from 'node:module';\nimport { join } from 'node:path';\nimport { buildLook } from '@nervur.org/floor/design';\n\nconst [folder, flag, out] = process.argv.slice(2);\nconst filesIn = (within = '') =>\n readdirSync(join(folder, within), { withFileTypes: true }).flatMap((entry) => {\n const path = within === '' ? entry.name : `${within}/${entry.name}`;\n return entry.isDirectory() ? filesIn(path) : [path];\n });\n// The kit takes each file as text or bytes: bytes here, so fonts and figures travel whole.\nconst files = Object.fromEntries(filesIn().map((path) => [path, readFileSync(join(folder, path))]));\nconst look = buildLook(files, (typescript) => stripTypeScriptTypes(typescript, { mode: 'strip' }));\nif ('why' in look) {\n console.error(look.why);\n process.exit(1);\n}\nif (flag === '--look') writeFileSync(out, look.source);\nelse writeFileSync(join(folder, 'versions.json'), look.versions);\n```\n\n`buildLook(files, strip)` answers `{name, version, label, text, source, versions, screen}`, or `{why}`: the look's name\n`<publisher>.<name>-look` (`com.acme.plain-look`), its library label `<name>.look` (`plain.look`), its source, and\n`screen`, whether it draws `surround`, `organism` and `lobe`, which the floor's window wears it by.\n`designAssets(files)` answers `{assets, digest}`. `versions` is the text of the design's `versions.json`, its version\nnaming `data`, that digest, and `look`, the SHA-256 of the look's source; `npm run design -- designs/<name>` writes it,\nand the tag tells it. Then the repo lobe builds it and the library takes it:\n\n```sh\nnervur lobe \"$repo\" build '{\"design\":\"plain\",\"version\":\"0.1.0\"}'\nnervur lobe library add '{\"road\":\"'\"$repo\"'\",\"kind\":\"faculty\",\"label\":\"plain.look\",\"version\":\"0.1.0\"}'\n```\n\nThe kit puts `draw {component, args, theme, state?, lang?}`, `files`, `set {tint?, density?}` and `design` into every\nlook; no author writes them. The kit takes each file as text or bytes, so `fonts/`, `icons/` and `figures/` travel as\nassets by digest, which a component names by digest (A figure in a component).\n\n### How a design is worn\n\nWearing is wiring. The window wears the design lobe wired to its `design`, the one its port gave at birth until\nthe person chooses another, by the window's `wear {design}` naming a look's digest; it creates every design lobe sealed,\nso a design, a stranger's above all, draws and reaches nothing of the organism. Before it wears one it judges the\nlook's sheets: one that `@import`s, or whose `url()` names an address that is no `data:` URI, no fragment and no file of\nthe design, is refused, saying the sheet and the address. Whatever design it wears, the floor's window keeps every\nwarning and confirm in the home's own words, and lays its way out above every page.\n\n**What the host lays outside every tree.** Two roots stand above the page, each a shadow root under a host of its own\nbeside `body`. Each wears what the window's own surround wears of the design the home wears, its tokens and fonts, its\n`lobes` sheets, then its `home` sheets, and no sheet of a place:\n\n| Host | What stands in its root |\n| ---------------- | --------------------------------------------------------------------- |\n| `nervur-way-out` | the way out, a `button` holding `svg` |\n| `nervur-said` | what the home answered of a press it refused: a `p` of `role=\"alert\"` |\n\nThey hold standard elements and no class. The floor's design dresses them by its `lobes` sheet, whose rules name each\nelement under `:host`, here the host itself. A design whose sheets style classes alone leaves them as the device draws\nthem, legible and bare: it dresses `:host button` and the rest in a `lobes` sheet, or names the two hosts in a `home`\nsheet. The home places each host on the screen by the host's own style, which no sheet moves.\n\n### What a tree may hold\n\nA tree is data: no script, handler, style or address can be written in it. The allowlist, `ATTRIBUTES` of the\nkit, names:\n\n- **Plain elements**:\n `div span p h1 h2 h3 h4 header footer main nav aside section article ul dl dt dd strong em small mark s sub sup`,\n `abbr q blockquote br hr figure figcaption legend table caption thead tbody tfoot tr summary`.\n- **With attributes of their own**: `ol{start}`, `li{value}`, `img{src, alt, width, height}` (a picture by its digest),\n `audio{src, controls}`, `time{datetime, deadline, shows}`, `data{value, ref, field}`, `a{href}`, `pre`, `code`,\n `meter{value min max low high}`, `progress{value max}`, `button{disabled copies}`, `label{for}`,\n `input{type name autocomplete value placeholder min max step maxlength minlength checked disabled required readonly\n enter}`, `textarea{name autocomplete placeholder rows maxlength minlength disabled required readonly}`, both with\n the typing hints `autocorrect` (`on off`), `autocapitalize` (`off none on sentences words characters`),\n `spellcheck` (`true false`), `inputmode` (`none text decimal numeric tel search email url`) and `enterkeyhint`\n (`enter done go next previous search send`), `select{name disabled}`, `option{value selected}`, `fieldset{disabled}`,\n `th{scope colspan}`, `td{colspan}`, `details{open}`, `slot{placeholder}`, and a subset of SVG. There is no `form`\n element: a `fieldset` is a form, and a press sends the named fields of the nearest one it stands in, or, standing in\n none, those of its root that stand in none.\n- **Global attributes**: `class id title lang dir hidden role aria-label aria-hidden aria-current aria-live aria-busy`,\n `aria-pressed` (`true false mixed`), `aria-expanded` and `aria-invalid` (`true false`), `aria-describedby` (an id),\n the gestures `swipe-left swipe-right swipe-up swipe-down hold drag drop`, `morph` and `opens`.\n `opens`, a flag, marks the element a page opens at: a page drawn whole, and the first draw of a place walked to, is\n brought into view at the first element that carries it once its design has laid it out, its sheets and its faces\n read, and again as they land, until the person scrolls, presses or types; any other patch never moves\n the page, so a person's own scrolling stays theirs. With no element marked, the page opens where the engine opens it.\n- **Inputs**: `text search number range checkbox radio date time email tel color file`.\n\n**A press** stands on a `button`, `input`, `select`, `textarea` or `summary`: `press: {method, args, to?}` asks the lobe\nthat drew it, or the lobe its placeholder `to` reaches. Typed text leaves only as the fields the pressed method's args\nname. `{method: 'local', args: {region, state, field?}}` changes only the region's local state on the device.\nFrom the moment a press is sent until the home answers it, the screen marks its control `aria-busy=\"true\"`, over\nwhatever your tree says, and ignores further presses of that control; every other control stays live. Style\n`[aria-busy='true']` in your sheets to show a press on its way; the floor's design dims it.\nA `slot`, `{t: 'slot', a: {placeholder}, args, k, c: []}`, draws there the lobe that placeholder is wired to, with those\nargs.\n\n- **The return key**: an input's `enter` names by id a `button` with a press in the same tree, which the person sees;\n the return key in that field makes that button's press, its fields gathered as a click gathers them.\n- **A copy**: a button's `copies` names by id an element of the same tree the person sees; pressed, the screen puts\n that element's text, or a field's value, on the device's clipboard, and the lobe hears nothing. Copy only what is\n shown: a text kept beside it is never copied.\n- **A link of the world** (`https:`, `mailto:`) never navigates the screen: the home says where it leads in its own\n words above the page and opens it outside only on the person's yes there. Those words are English; a window of your\n own words them in another language by answering `world {say, yes, no}` in every `see`: `say` holds\n `{href}` where the screen puts the address, and `yes` and `no` are the two buttons. The person must read where the\n link leads, so words whose `say` lacks `{href}`, or that are not three non-empty texts, are not taken and the English\n stands; the words of one sight stand until a sight hands others or none.\n\n- **A file** a person gives: a `file` input whose name the method's args declare reaches the lobe as\n `{name, type, size, sha256}`, never its bytes; the method's seat says `intent: \"channel\"`, a free field of the seat\n the floor's window reads, and answers `{channel: {kind: \"upload\", url, expires}}`, the host PUTs the bytes there once\n and the window asks the lobe `landed {sha256, landed}`. A file the other way:\n `{channel: {kind: \"file\", size, sha256, ext, url, expires}}`, `ext` a picture's or a sound's kind; with no `url` and\n `expires`, the bytes are a lobe of the home's own, which answers its reading method `piece {sha256, at, length}` with\n them.\n- **A deadline**: `{t: 'time', a: {datetime: '\u2026', deadline: '2026-01-01T10:00Z'}}` is counted down by the screen; the\n lobe hears nothing, and judges lateness by its stamp.\n- **An instant**: `{t: 'time', a: {datetime: '2026-01-01T10:00Z'}, c: []}`, with no text and no deadline, is written by\n the screen in the person's language and the device's zone, its day and its time of day; `shows: 'day'` or\n `shows: 'time'` writes one alone. No lobe knows the zone a person reads in.\n- **Caps**: a tree holds at most 5,000 nodes, 64 deep, a key of 200 and a text of 20,000, and no sound, each an owner's\n word over `tree.*`.\n\n## A window of your own\n\nThe screen's present lobe, the **window**, is a faculty like any other: it keeps the route the person walked, answers\nwhat the screen shows there, and carries each press. The floor's is `nervur.window`; its source is `WINDOW_SOURCE` of\n`@nervur.org/floor`, one module importing `nervur:faculty` alone, to read or to start from. A host names the window an\norganism is born wearing (Where Nervur stops); this section is all it asks of one. What the floor's window answers\nbelow is one way to answer it; what any window must answer is said so.\n\n### Its wiring\n\nA window declares the placeholders `screen`, expecting `nervur.screen`, and `brain`, expecting `nervur.brain`, and\nwhere it wants them `design` (expecting any blueprint, a look's), `mouth` (`nervur.mouth`) and `ear` (`nervur.ear`),\nwhich the port wires to the organism's own. **Presence wins:** the screen's organ, `this.stamp.asker` `screen`, is\nthe one asker whose walks, sights and presses are the person's, so a window answers it alone for each and refuses\nevery other asker; nothing but its organ speaks through it. It holds the relations its owners hold, each wired by the\nbrain under the placeholder the console holds it by: a relation is a placeholder of its own nerves\n(`this.nerves.read()`), never one of its own (`screen`, `brain`, `design`, `mouth`, `ear`). `design` is the one wire\nof a present lobe that only the window moves, by `this.nerves.order({termination, placeholder: 'design'})`; the port\nwires it at birth, and at each connect the brain asks `back {placeholder: 'screen'}`, where the floor's window lays\nthe design its port gave unless the person chose another. At `left {far, note}` it forgets all it kept of that\nrelation.\n\n### Routes and the walk\n\nA route is the path the person walked: `[]` the home, `[{relation}]` an organism or a far lobe seen through a relation\nthe window holds, `[{lobe}]` a lobe at home, `[{relation}, {lobe}]` a lobe of that organism. Its text is `/`, `/org`,\n`/~/A24`, `/org/A24`, a lobe's ID percent-encoded; `routeText(route)` and `routeOf(text)` of\n`@nervur.org/genome/screen` write and read it, each answering `{why}` for what is none.\n\n- **`open {route}`** or **`open {lobe}`**, with `told?`: the walk; answers `{route, text}`. The floor's way out walks\n home by `open {route: []}`. **`root {}`** answers the route walked.\n- **A relation is a place** where its knock's describe names another blueprint than `nervur.brain`: a far lobe,\n `/<relation>` its page, nothing under it. The floor's window describes a far lobe once at a walk and keeps the\n describe and what its `state` answered, so a sight asks no describe and each press is one ask over the kept\n describe; it asks the far lobe over the relation itself, as its own methods, and a far organism through its brain.\n- **`told {size, language, standard}`** is what the host tells a place of its screen, `size` one of `compact`,\n `medium`, `expanded`: at a walk a window asks a far lobe that declares a writing method `told` those three and\n nothing else, the first time and again only where one moved; the host lays the same under `told` in the args of every\n draw it asks over a relation (`withTold`).\n\n### What `see` answers\n\n**`see {route?, args?}`**, `args` closed: `{cursor?, cells?, theme?, lang?}`, the place in a long list, the cells\ndigest the screen holds of the lobe, `light` or `dark`, and the person's language tag. It answers\n`{route, text, tree, main, version, design, way?, world?, channel?}`:\n\n- `tree`: the root the screen draws. The floor's is `surround {title, route, back?, warnings, main, consent?}` drawn\n by its design only where the window has something to say, a warning or a consent; else the slot alone,\n `{t: 'main', a: {}, c: [{t: 'slot', a: {placeholder: 'main'}, args, c: []}]}`.\n- `main`: `{lobe, over, args}`, the lobe that draws the slot `main`, over which relation (null at home), with which\n args. The host draws it by **`show {lobe, args, over?}`**, which answers `{tree, wires}`: the lobe's `draw` through\n the brain's `ask`, or over the relation, and the lobe wired at each of its placeholders, where the screen draws its\n slots by `show` again. For a page the floor's window draws from a describe, `lobe` is its design lobe and `args`\n `{component, args, theme, lang}`; for a lobe that declares `draw`, that lobe, its relation and `{}`.\n- `version`: the version the lobe's describe says, null for an organism, which a press that writes carries back as\n `seen`.\n- `design`: the lobe wired at the window's `design`, the design it wears, or null for none. The host dresses the home\n by this lobe whatever drew the page, and draws a window that names none with no design's sheet.\n- `way`: `{at, say?, leave?}`, what the window hands the host to lay above the page, outside every tree, where no\n place's tree or sheet covers or presses it, `at` one of `top-start`, `top-end`, `bottom-start` and `bottom-end`. The\n floor's window hands its way out and a place's leave there (The floor's leave and way out); a window of your own\n hands what it chooses, or none.\n- `world`: `{say, yes, no}`, the words of the ask before a link of the world opens (What a tree may hold); the floor's\n window hands none.\n- `channel`: the checked shape of a file or an upload the last press of the place answered, for the host to follow,\n until it posts **`landed {id, landed, why?}`**; a file whose bytes a lobe of the home holds is read by\n **`piece {id, at}`**.\n\nA host's own press `page {cursor}`, which the floor's design lays to turn a long list, asks `see` again with that\ncursor and reaches no window method. The floor's window asks the design it wears `surround`, `organism` and `lobe` alone\n(Designs and looks).\n\n### Presses\n\nA press in a tree is `{method, args, to?}` on its element. The host gives each press a number and carries it as\n`postsOf(press, {id, seen, cells, values})` of `@nervur.org/genome/screen` says, `values` the fields committed\naround it: posts answered one before the next, each an ask of the window.\n\n- **`read {path, method}`**: one post, `read {path, method, cells, values?}`, `path` the route's text of the lobe; the\n answer or error is kept under the lobe, the method and `cells`, and drawn by every sight until the cells move.\n- **`write {path, method}`**: three posts. `write {id, path, method, values, seen, declared?, consented?}` keeps the\n press before anything leaves and answers `{id}`; `send {id}` marks it sent, committed before any ask of the lobe\n leaves, and answers `{method, sending: true}` once, `{method, unknown: true}` for a press sent and not answered,\n which is never sent again, what was kept for one answered, `{method, asking: true}` for one held for the\n consent, or `{method, taken: true}` for a yes whose consent another yes took, which asks nothing; `deliver {id}`,\n posted only after `sending`, describes the lobe, answers `stale` with the version that stands where it is no longer\n `seen`, fits the values to the method's `args` and asks the lobe once, answering\n `{method, answer}` or `{method, error}`. Fitting leaves out an empty text in a property not required, parses a\n number or an integer, takes a boolean from its checkbox, parses JSON and keeps an enum; a value that fits not is\n refused in plain words and the lobe is not asked.\n- **`ask {path, method, args?, consented?}`**: the declared ask, the same three posts with the args the press names\n as its values, `declared: true`.\n- **`local {region, state, field?}`**: one post; it merges `state` into the region's local state at the route\n walked, a null dropping a key, bounded by the window's memory and forgotten at the next walk; no lobe hears it, and\n a component is handed it as `state`. `field` names the key that holds what a person types, posted at each key.\n- **Any other press** is `press {lobe, method, args, values?, to?, over?}`, `lobe` the lobe it reaches: the window\n reads the describe first, holds it for the consent where it binds the person, and asks the lobe that drew it, or the\n one wired at its `to`, with of `values` those its method's args name. Where `lobe` is the window's own design lobe,\n the press is the window's own act; the floor's are `create {faculty}`, `about {faculty}` and `leave {relation}`.\n\n**Whose a press is.** A region a lobe's root draws is that lobe's; a region a sealed lobe draws is drawn for the lobe\nwhose slot asked it, and a press there reaches that lobe (`pressAt`). Every design lobe is sealed, so a press in what\na design draws reaches the window, never the design.\n\n**The fleeting stays on the device.** Typing, scrolling and focus reach no lobe. Typed text leaves only as the fields\nthe pressed method's args name, from the nearest `fieldset` the press stands in, else from its root's fields that\nstand in none; a field a `local` press names stays in the region's local state.\n\n### The consent\n\nThe floor's window holds a press for its consent where the method's describe declares `irreversible`, or where it is\nan ask a place's describe names and says nothing of (no `kind`); so is its leave. Held, it asks the lobe nothing: the\nwindow sets the local state of the region `#consent` of the route, `{asking, lobe, args, label?, irreversible?}`,\n`args` the values fitted, and answers `{method, asking: true}`; the surround is then drawn with\n`consent {say, yes, no, yesSay, noSay}`, in the home's words. `yes` is the same ask,\n`{method: 'ask', args: {path, method, args, consented: true}}`; `no` the `local` press that clears the region, every\nvalue null. A consent holds only while the window's own local state still asks for that\nmethod of that lobe. The first yes sent takes it, `taken` naming its press in the region's state, and the consent stays\ndrawn until that ask is answered, then is spent: a second yes meanwhile, from another tab, asks nothing, and a yes\nafter asks the consent anew. A `local` press may clear `#consent` and never set it, so no tree a\nplace draws forges a yes, and `deliver` refuses a press that binds the person with none. No method of a place is named\n`#consent`. A window of your own holds back what it chooses; the local state of a region is yours to keep the same\nway, which no tree of a place sets.\n\n### The floor's leave and way out\n\n`way.leave` is `{press: {method: 'leave', args: {relation}}, say}` at a place the window took, a far lobe, `say` the\nhome's word; the host lays it beside the way out and carries it as a press of the design lobe over no relation, while\nthe window's `way` still holds it. Unconsented, `leave {relation}` sets `#consent` with `asking: 'leave'` and answers\n`{asking: 'leave'}`, the surround carrying a consent whose `yes` is the same press with `consented: true`; consented, it\nends the standing whole by the brain's `drop {far}`, forgets what it kept of the place, walks the person home where the\nroute stood on it, and answers `{left: relation}`. A relation that reaches a far organism is an owner's standing,\nnever left so. A place whose far lobe answers `removed`, and a knock never answered, end the same way.\n\nThe floor's way out stands at `bottom-end` above every page but the home's own, `way.say` its word, and walks home.\n\n### Links\n\nThe host reads a link into `{card, reference}` and draws the consent itself, outside every tree; the window gives it\nthree asks, each the screen's alone:\n\n- **`offer {card, reference}`**: the mouth's `once` asks `#offer` of the card's ward on its zero head, spending\n nothing; answers `{says, waits, lives}`, `{reached: false}`, or null where the place gave no offer.\n- **`redeem {card, reference}`**: the same for `#redeem`; answers `{invitation}`, or `refused` in words that say\n whether to try again.\n- **`accept {invitation, placeholder, note?}`**, the person's yes: refused for one of the window's own placeholders\n and one it holds; the mouth accepts with `note`, kept beside the standing and never sent, and the first ask over it,\n a describe, is the knock, one never answered ending the standing whole by `drop` and refused. A knock naming another\n blueprint than `nervur.brain` makes the relation a far lobe. Answers `{far, route, text}`, where the host walks.\n\n### What the host lays\n\nThe host lays what a window answers, whatever window it is; these are its calls, of `@nervur.org/genome/screen`.\n\n- **The design.** `worn {}` answers what the design lobe wired at `design` answers its `files`, asked again where the\n lobe a sight names as `design` moved; the host lays it by\n `laid(files, settings, access)`, which answers `{sheets, lobes, home, classes, access, fonts?, dropped}`: each sheet\n `{digest, text}`, served at `SHEET_PATH` (`/.nervur/skin/`) as `<digest>.css`, the digests a `lobes` root and the\n `home` root wear in order, the access sheet last in both, and the classes each may draw. A picture and a font are\n served at `ASSET_PATH` (`/.nervur/asset/`) as `<digest>.<ext>`, fonts under families named `f-<digest>`; the light\n tokens lie on `:root, :host`, the dark under `prefers-color-scheme: dark`, each again under `data-theme`, which wins.\n- **Who wears the home's chrome.** `dressOf(road)` answers `home` for a lobe whose faculty came by the genome's road,\n the installer's or the owners' own source, `lobes` for any other: a root wears the lobes' skin alone, or that and the\n home's chrome, so a stranger never dresses as the home. A class stands only where a sheet of the layer its root wears\n names it. A window hands `lang` only in the draws of the design it wears, the home's; a look drawn with none finds\n every word empty.\n- **The person's access.** Four tokens, `access-text-size` 0.75 to 3, `access-contrast` 0 to 1, `access-leading` 1 to\n 2.5 and `access-motion` 0 to 1, clamped by `clampAccess` and laid last in every root, `!important`, by\n `accessSheet`; a design's own token of an `--access-` name is dropped, and its sheets read them by `var()`.\n- **Motion** is data: a design's `--<design>-<kind>-duration` (in `ms` or `s`) and `--<design>-<kind>-easing` for\n `enter`, `leave`, `move` and `change`, read by `motionTokensOf(tokens, design)`, a token missing no motion; each patch\n tells its kinds by its diff, and `motionOf(ops, motion, accessMotion)` scales them by `access-motion`, 0 stilling\n all. `morph` flies a named node from where it stood to where a patch puts it.\n- **Gestures** are another hand on a drawn control, never a new press: `swipe-left`, `swipe-right`, `swipe-up`,\n `swipe-down` and `hold` each name by id a `button` or `summary` with a press, `drag` a `select` with a `name`, whose\n options an element's `drop` stands for; the first of that id within the element, not hidden from a person. A tree\n whose gesture names none is refused.\n- **Addresses.** A tree's `a{href}` names a path of the screen's own (on a browser's host, the site's), `#id` within\n the page, or a link of the world, `https:` with a host and no credentials or `mailto:`, opened only on the person's\n yes; nothing else reaches the screen.\n- **What the surface tells.** The device's theme and language, the width, which the host makes a size class, whether\n the person asks for no motion, which the host plays as none: the window hears them as `see`'s `theme` and `lang` and\n `open`'s `told`, and nothing else of the device.\n\n### A design for the floor's window\n\nA design the floor's window wears draws `surround`, `organism` and `lobe` from their args alone. The plain design above\nbecomes one with three components; `surround` lays the consent's presses as handed and the slot `main`:\n\n```ts\n// designs/plain/components/surround.ts\nexport default (args) => ({\n t: 'div',\n a: {},\n c: [\n { t: 'h1', a: {}, c: [args.title] },\n ...args.warnings.map((line, at) => ({ t: 'p', a: { role: 'status' }, k: `w${at}`, c: [line] })),\n ...(args.consent === undefined\n ? []\n : [\n { t: 'p', a: {}, k: 'say', c: [args.consent.say] },\n { t: 'button', a: {}, k: 'yes', press: args.consent.yes, c: [args.consent.yesSay] },\n { t: 'button', a: {}, k: 'no', press: args.consent.no, c: [args.consent.noSay] },\n ]),\n { t: 'main', a: {}, k: 'main', c: [{ t: 'slot', a: { placeholder: 'main' }, args: args.main, c: [] }] },\n ],\n});\n```\n\n`organism.ts` and `lobe.ts` draw theirs the same way, a link an `a{href}` to a `path`, a press laid as handed, a\nwriting method a `fieldset` with a field named after each arg and a button pressing `write {path, method}`. The\nfloor's own design is the whole example: `FLOOR_FILES` of `@nervur.org/floor` holds its data by path and\n`FLOOR_LOOK_SOURCE` its look, every component built in.\n\n## The browser and the web\n\n### A site that serves the browser port\n\nA site serves the port as plain files, with no step of Nervur's. Lay the package's `dist/` at any path of the\nsite's origin, here `/nervur`: `/nervur/<digest>/*` served `Cache-Control: public, max-age=31536000, immutable`, the\nloader `/nervur/page.js` revalidated, and `/nervur/keeper.js` with the header `Service-Worker-Allowed: /`.\n`dist/quo.json` names the loader's digest, to pin it. A page then holds the organism:\n\n```html\n<div data-quo-link></div>\n<div data-quo-screen></div>\n<script type=\"module\" src=\"/nervur/page.js\"></script>\n```\n\nWith no more, the visitor's organism installs and boots in a worker, and the screen is born in the floor. Every tab of\nthe site shares that one organism, and closing any tab disturbs no other: each keeps its pages, and only an ask left\nunanswered by the tab that closed ends as `unavailable`, since whether it was done is not known. The element's words:\n\n| Attribute | What it draws |\n| ----------------- | ------------------------------------------------ |\n| `data-quo-screen` | the person's screen: the organism and its places |\n| `data-quo-link` | where a link landing on this page is taken |\n\nThe element says back `data-quo`: `waking`, `drawn`, `none` or `failed`, with `data-quo-why` in words. Its own content\nstands until the first tree replaces it, so a loader and an empty state are the site's markup. The page module exports\n`standings()` (`{relation, domain, note}` each), `ask(standing, method, args?)`, which answers what the lobe answered,\nor `{error}`, `watch(standing, method, args, heard)`, which calls `heard` with the answer now and with each one that\ndiffers, asked again at each notice the organism gives the page that a lobe of it committed, and answers the function\nthat stops it, `timings()`, `wake(key)` and `lay`, `arrive`, `stay`, `lasting` and `wipe`: the organism is the site's\nbackend in the tab, and the site's own pages draw what it answers in their own markup. `wipe()` removes the organism\nfrom this browser for ever, its store, its way back and its key, where it runs in no tab: null, or `{why}`. It is the\none way out of a store no version the site serves boots, and of a design chosen that draws nothing.\n\n**A window of the site's own.** A site names the window its visitors' organisms wear in its `/.well-known/quo`,\n`\"organism\": {\"window\": {\"name\": \"com.acme.window\", \"version\": \"1.0.0\", \"text\": \"<sha256>\"}}`, `text` the SHA-256 in\nhex of the faculty's source, which it serves beside the loader, at `/nervur/window/faculty.js`. Every boot reads what\nthe site names then: the source checked against `text` and read as a faculty declaring a placeholder `screen` and one\n`brain`, as the floor's window does, it stands as the screen's present lobe on the road `com.acme.window@1.0.0`, its\n`mouth` and `ear` wired to the organism's own where it declares them, given the site's design, else the floor's. A\ndeploy that names another moves each visitor's organism to it at its next boot, unless its person moved their window\nby `version`, which stands. A window that fails is refused whole: the organism wears the floor's, and the refusal is\nsaid among the warnings it boots with. A site that names none wears the floor's window, and nothing is said. Write it\nas any faculty, the floor's `WINDOW_SOURCE` of `@nervur.org/floor` being one to start from.\n\n**The port's note.** Where the browser declines to persist the store, the port says so in the screen's element, in a\n`p[data-quo-note=\"store\"]` beside the caged tree, which the site's own sheet styles. It is said in the home's words,\nwhich are English, once, and the port never writes it again: a site in another language words it itself, hiding it with\nits sheet and saying its own where it appears, or replacing its text as it is laid:\n\n```js\nconst screen = document.querySelector('[data-quo-screen]');\nnew MutationObserver(() => {\n const note = screen.querySelector('p[data-quo-note=\"store\"]');\n if (note !== null && note.lang !== document.documentElement.lang) {\n note.textContent = 'Dieser Browser kann l\xF6schen, was dein Organismus h\xE4lt \u2026';\n note.lang = document.documentElement.lang;\n }\n}).observe(screen, { childList: true, subtree: true });\n```\n\nAn app that says it in a place of its own reads whether the browser keeps the store from the organism's `state`, the\nvitals' `disk.persisted`.\n\n**The page's consent.** A link's consent is drawn by the page itself, outside every tree, under a head that names the\nhome, in the home's words and dressed by the home's layer, legible with no sheet. It says what the link's offer says,\nas the place's own word, how long the invitation waits and how long its relation lives, and draws no field: the yes\nkeeps the domain that vouched in the standing's note, and a note you want kept beside the standing is one your own\nlanding gives the window's `accept` at the yes (Where Nervur stops).\n\n**A page author never** styles inside the `nervur-lobe` element the screen stands in, never forbids `blob:` styles or\nfonts or a worker of its own origin in its content security policy, and serves no script it does not trust: whoever\nserves the origin's code reaches what the origin keeps, the boot key among it.\n\n### `/.well-known/quo` and links\n\nA site's vouch is plain JSON it writes by hand, served `Access-Control-Allow-Origin: *`:\n`{wards, cards, links?, size?, organism?}`. `wards` are the wards the domain names its own, `cards` each `{ward, at}`,\nthe first the one a link on the domain names; `links` is the path where a link lands; `organism` names the installer's\nversion and digest, the design the visitor's organism is born in, `design: {name, version, data, look, tint}`, and the\nwindow it wears, `window: {name, version, text}` (A site that serves the browser port). `size` is the class of the\nscreen's size, `compact`, `medium` or `expanded`, where the host names one: every draw, and everything a place is told\nof the screen, then carries that class whatever the width, and a change of width moves nothing. With none named, or\nanything else, the class is the width's. A phone's app names it in its `quo.json`, a desktop's install in the file its\n`--design` hands.\n\nA link carries a card and a reference, never the invitation. On a domain it is\n`https://<domain><path>#<reference>`, `/quo` the path where the vouch names none, the reference twenty-six lowercase\nbase32. Elsewhere it is `web+quo:<reference>@<ward>?at=<address>`. A lobe draws one by the ear's `invite` with\n`refer: true`, and `public: true` for a link on a domain; whoever is handed it redeems the reference once on the zero\nhead by `#redeem`, and accepts at its owner's word. On the site's page, the landing in `data-quo-link` reads the\nlink's offer, draws the consent, and on a yes redeems, accepts and draws what the window's `accept` answers; a no keeps\nnothing, and either way the link is taken out of the address. The landing takes a link whole after\nthe `#` too, `web+quo:` or one on any domain, as a camera or a paste hands it, at the page's load or while it stands\nopen, its fragment changed, at once, with no load. A desktop's screen takes a link the same way, whole after\nthe `#` of its own address, `http://127.0.0.1:<port>/#<link>`, and draws the same consent above the page in the home's\nwords; a bare reference is no link there, since that page stands on no site's domain. A link pressed on a\ndesktop, on a page of the web or in a message, reaches that screen by the handler an install lays for `web+quo:`, which\nruns `nervur open <link>`: it opens the screen at the link in the person's own browser, where the consent is asked, and\nwhere no screen answers it opens a page saying so, and nothing is accepted. `nervur accept <link>`, typed at the\nconsole, takes the link by the same steps and is its owner's own word and asks nothing.\n\n**One ask from a script.** A build that reads a place as a stranger asks its front once on the zero head by `askOnce`\nof `@nervur.org/genome/quo`, as the mouth's `once` asks: `askOnce(card, method, args, {carry, draw, crypto?})`\nanswers what the being answered, `{result}` or `{error}`, `silent` for silence and `unavailable` where no address\ncarried the ask. The genome reaches no host, so the script hands the carrier, a box to a ward at an address\nanswered `{reply}` (the reply's bytes, or null for nothing) or `{why}`, and the chance; the box goes to the card's\naddresses in turn until one replies. Over `ws` and `wss`, one frame body a message (Quo's frame, `frameOf` and\n`readBody`):\n\n```js\nimport { askOnce, cardOfVouch, frameOf, readBody } from '@nervur.org/genome/quo';\nimport { unhex } from '@nervur.org/genome/standard';\n\nconst carry = (address, ward, box) =>\n new Promise((done) => {\n if (!/^wss?:/.test(address)) return done({ why: 'this script carries ws and wss alone' });\n const socket = Object.assign(new WebSocket(address, 'quo'), { binaryType: 'arraybuffer' });\n const end = (answer) => (clearTimeout(timer), socket.close(), done(answer));\n const timer = setTimeout(() => end({ why: 'no reply within a minute' }), 60_000);\n socket.onopen = () => socket.send(frameOf({ kind: 'ask', id: 1, ward: unhex(ward).bytes, box }).subarray(4));\n socket.onmessage = ({ data }) => {\n const frame = readBody(new Uint8Array(data));\n if (frame?.id === 1 && frame.kind !== 'ask') end({ reply: frame.kind === 'reply' ? frame.box : null });\n };\n socket.onerror = () => end({ why: 'the line did not open' });\n });\nconst card = cardOfVouch('example.com', await (await fetch('https://example.com/.well-known/quo')).text());\nconst draw = (length) => crypto.getRandomValues(new Uint8Array(length));\nconst answer = await askOnce(card, 'spec', {}, { carry, draw });\n```\n\n### A faculty in a site, whole\n\nA guestbook at `example.com`: each visitor's organism, in its tab, holds a standing on a lobe of the site's server, and\nsigns over it. Four pieces tie together by one card, the server organism's public ward and its addresses.\n\n**1. The server**, reached by browsers over `wss` alone, behind a TLS proxy of the machine forwarding\n`https://example.com/quo` to `ws://127.0.0.1:9112/quo`:\n\n```sh\nnervur install --public example.com --ws wss://example.com/quo\nnervur card --json # {\"result\":{\"ward\":\"<ward>\",\"at\":[\"tcp://example.com:9110\",\"wss://example.com/quo\"]}}\n```\n\n**2. The faculty** draws a link for one visitor by the ear, and answers each visitor over the relation the link\nbecomes, by `this.stamp.occupant`:\n\n```js\nimport { Faculty } from 'nervur:faculty';\n\nexport default class Guestbook extends Faculty {\n static blueprint = {\n name: 'com.example.guestbook',\n version: '0.1.0',\n methods: {\n link: { kind: 'reading', description: 'A one-time link for a visitor: its reference.' },\n sign: {\n kind: 'writing',\n args: {\n type: 'object',\n properties: { text: { type: 'string', minLength: 1, maxLength: 200 } },\n required: ['text'],\n additionalProperties: false,\n },\n },\n entries: { kind: 'reading', description: 'The fifty oldest entries, each its text.' },\n draw: { kind: 'reading' },\n },\n placeholders: { ear: 'nervur.ear' },\n };\n\n async link() {\n const args = { waits: 604_800_000, lives: null, refer: true, public: true, note: { role: 'guest' } };\n const drawn = await this.ask('ear', 'invite', args);\n return 'result' in drawn\n ? { reference: drawn.result.link.reference }\n : this.error(drawn.error.code, drawn.error.message);\n }\n\n sign(args) {\n const refused = this.checked('sign', args);\n if (refused !== undefined) return refused;\n if (this.stamp.occupant === null) return this.error('refused', 'a guest signs over the link it took');\n this.cells.set(['entry', this.stamp.time, this.stamp.occupant.far], args.text);\n return null;\n }\n\n entries() {\n return this.cells.range({ prefix: ['entry'], limit: 50 }).cells.map(({ value }) => value);\n }\n\n draw() {\n const rows = this.cells.range({ prefix: ['entry'], limit: 50 }).cells.map(({ key, value }) => ({\n t: 'li',\n a: {},\n k: `${key[1]}-${key[2]}`,\n c: [value],\n }));\n return {\n t: 'main',\n a: {},\n c: [\n { t: 'ul', a: {}, c: rows },\n { t: 'textarea', a: { name: 'text', placeholder: 'Say hello' }, c: [] },\n { t: 'button', a: {}, press: { method: 'sign', args: {} }, c: ['Sign'] },\n ],\n };\n }\n}\n```\n\nCreated wired to the ear, `create {faculty, wiring: {\"ear\": \"ear\"}}`, it draws one link a visitor:\n`nervur lobe <ID> link --json` answers `{\"result\":{\"reference\":\"<26 base32>\"}}`, so the site's own server, on the same\nmachine, asks it at each visitor's press and hands `https://example.com/quo#<reference>`. A link is redeemed once.\n\n**3. The vouch**, `https://example.com/.well-known/quo`, served `Access-Control-Allow-Origin: *`, names the card of\nstep 1 as the domain's own; the visitor's worker takes a link only for a ward the vouch names:\n\n```json\n{\n \"wards\": [\"<ward>\"],\n \"cards\": [{ \"ward\": \"<ward>\", \"at\": [\"wss://example.com/quo\"] }],\n \"links\": \"/quo\"\n}\n```\n\n**4. The pages**, beside the browser port at `/nervur` (A site that serves the browser port). `/quo`, where a link\nlands, holds `<div data-quo-link></div>` and loads `/nervur/page.js`: it draws the consent, and on a yes the visitor's\norganism redeems the reference on the public ward's zero head and accepts the invitation. `/guestbook` reads the\nstanding the domain gave through the page module and draws the entries in its own markup, each signing asked over that\nstanding:\n\n```html\n<ul id=\"entries\"></ul>\n<textarea id=\"text\"></textarea>\n<button id=\"sign\">Sign</button>\n<script type=\"module\">\n import { ask, standings } from '/nervur/page.js';\n\n const standing = (await standings()).find((one) => one.domain === 'example.com');\n const list = document.getElementById('entries');\n const show = async () => {\n const heard = await ask(standing, 'entries');\n if (!Array.isArray(heard)) return;\n list.replaceChildren(...heard.map((text) => Object.assign(document.createElement('li'), { textContent: text })));\n };\n if (standing !== undefined) {\n await show();\n document.getElementById('sign').onclick = async () => {\n await ask(standing, 'sign', { text: document.getElementById('text').value });\n await show();\n };\n }\n</script>\n```\n\nThe same standing is a place on the visitor's screen too, where the guestbook's own `draw` draws it.\n\n### Push\n\nA closed browser is woken by Web Push: on a person's press, the page's `wake(key)` subscribes under the key\nyour sender signs with and answers `{endpoint, keys}` to the page's own code. Keeping subscriptions and sending to them\nis a faculty's, over `network`, since a push is a web request. A push says only that something waits: the keeper reads\nnone of it and shows one notice in the words `{title, body}` the site serves at `waits.json` beside the keeper. A phone\nis woken by APNs or FCM, to the token its page's `wake()` answers; sending is your own code, with your keys at Apple and\nGoogle, as for the web.\n\n### The web from a lobe\n\nA skin lobe of `network` reaches the web outside Quo. Bodies are bytes, in pieces of at most a mebibyte:\n\n```js\n// A request: answered by its response, or by {request} to take it piece by piece.\nconst sent = yield { placeholder: 'network', method: 'send', args: { method: 'GET', url: 'https://example.com/', headers: {}, body: new Uint8Array(0) } };\n// sent.result: {status, headers, body, more} or {request}; then take {request, piece} from 0, or send {request, body, more} for an upload.\n\n// A path served: network asks this lobe back for each request.\nyield { placeholder: 'network', method: 'listen', args: { path: '/hooks' }, durable: true }; // answers {url}\narrived(args) { return { status: 200, headers: {}, body: this.codec.utf8('ok').bytes, more: false }; }\n```\n\nA served request arrives as `arrived {request, method, path, query, headers, body, more}`, then\n`piece {request, body, more}`; the first answer that is no null is the response, its body piece 0, and each piece\nafter it `network` asks as `rest {request, piece}` by its number, from 1, one asked ahead while the last goes, answered\n`{body, more}`; and `gone {request}` where the request broke. Bytes kept a piece a cell are served by number:\n`rest({ piece }) { return { body: this.cells.get(['blob', piece]), more: piece + 1 < count }; }`, a reading method that\nkeeps no cursor and commits nothing. Declare `network: 'nervur.network'` among the placeholders, and declare `arrived`,\n`piece`, `rest` and `gone` with `askers: [\"network\"]`. A host is served only where it is reached: a machine with\n`--public`, or an edge at its domain; a browser and a phone serve nothing.\n\n## Talking to the world\n\n- **Inviting.** A lobe invites to itself alone, through the ear: `ear` `invite {waits, lives, note?}`\n answers `{invitation, far}`, `far` the ID that will stand for the relation. `note` is free JSON on what the relation\n is for, kept by the brain and never sent. `says` is free JSON too, what the inviter wants known before the yes, a\n name, a purpose: it travels in the invitation, and a link's holder reads it with both spans by `#offer`, spending\n nothing. The invitation is Quo's `{text, sig}`: its text holds Quo's fields, both spans, `says` and the anchor's\n mark, and the ward drawn for it signs that text whole, so whoever carries it can change none of it and an accepting\n organism refuses one whose signature fails. The signature proves the text is the ward's own, never whose the ward\n is: a link on a domain says that by the domain's vouch. With `through: <address>` the ward is reached through an\n organism always on; with `refer: true` it answers a link, `{link: {card, reference}, far}`.\n- **Being asked from far.** Every ask over a relation the lobe gave carries `this.stamp.occupant`, `{far, note}`, the\n note given at the invitation with the lobe's own note merged over it. A role is read from that note and the\n lobe's cells. `left {far, note}` says the relation ended.\n- **Asking far.** A lobe wired to `mouth` accepts: `mouth` `accept {invitation, placeholder, note?}` answers `{far}`,\n and the lobe asks `placeholder` as any node. `once {card, method?, args?}` asks once with no relation, on the zero\n head; `drop {far}` ends a relation either way. An owner accepts for a lobe by the brain's\n `accept {relation, invitation, lobe}`.\n- **The public part.** At most one lobe is the ear's `front`, set by an owner's order:\n `nervur ask brain order '{\"node\":\"ear\",\"order\":{\"termination\":\"<ID>\",\"placeholder\":\"front\"}}'`. It answers strangers\n on the organism's public ward alike, and by default nothing a stranger asks changes anything: every run is a reading\n one, and only the ear's `invite` runs as ever, so the front hands out invitations and links, and a change goes over a\n relation the front invites the stranger to; a stranger's write through it answers\n `refused: A reading ask writes no cells.`. An owner's word `changes`, by `limit`, lifts that for the front,\n a repeat then its risk. From the command line, a stranger asks a front by the card its owner hands, the `result` of\n `nervur card --json` there:\n `nervur ask mouth once '{\"card\":{\"ward\":\"<ward>\",\"at\":[\"tcp://example.com:9110\"]},\"method\":\"list\"}'`.\n- **What a lobe never sees** is a ward or a key, only IDs. An ask over a relation runs at most once; one taken\n already hears `repeated`. A box is 1 MiB, more crossing in pieces.\n- **Reserved words.** No method opens with `#`. Quo and Nervur keep `#in`, `#whole`, `#out`, `#pieces`, `#leave` and\n `#redeem` and `#offer`, and the brain's words above.\n\n## Pilots\n\nA pilot lays an organism on a host from afar. It is a repo's, never a port's: the port gives it the cargo, the claim and\nwhat its channel lays, and nothing else. Nervur publishes no pilot; write one as any\nfaculty and organ:\n\n- **An edge.** It automates An edge, by hand: a skin lobe of `network` (the provider's API is a web request) and of an\n organ that reads the cargo's files. It draws `CLAIM` from its stamp's seed, uploads the Worker in one request, the\n same binding, migration and secret as `wrangler.toml` names (Cloudflare's script upload takes them as\n its metadata, beside each file as a module, `application/wasm` for each `.wasm`), opens its domain, asks\n `POST /.nervur/claim` and accepts the first invitation through `mouth`, so its organism holds the anchor. It\n lays a new version by laying again, and reaches the other routes of the cargo for a backup, a move or a reclaim. Its\n provider token is a key of its own, kept in its cells and never answered.\n- **A machine.** It draws the claim from its stamp's seed, has the machine run\n `nervur install --boot file --claim <file>`, by cloud-init or a skin lobe of `shell` over `ssh`, asks\n `POST /.nervur/claim` through the machine's proxy and accepts the first invitation through `mouth`, as for an edge.\n- **What a pilot keeps** is its own: the places it laid, each claim until the anchor is passed on. The claim opens\n nothing and proves only that its holder could lay the host.\n\n## Releasing and owning\n\n- **A release** is a version told: raise the root `package.json`'s version in a commit, which the repo lobe tags\n `v<version>`. What leaves a repo is a version by its digest; an owner moves a lobe to it by `version`. A\n package is published only by a `run` of a publish script on a repo lobe, with the keys of that copy, at an owner's or\n a runner's ask. Keys are a copy's: `setToken {name, value}` keeps one in the lobe's cells, written to\n `.env` before each run, never answered.\n- **Sharing a repo.** A repo lobe's `invite {standing}` gives a `reader` (pull), a `writer` (pull and push), a `library`\n (read what was told) or a `runner` (runs the `scripts` it names); a reader's or writer's may name `scope`, folders of\n the repo. Another organism takes a repo by a repo lobe's `accept`; a library by the library's\n `accept {invitation}`, then `add` naming that far road.\n- **Delivering into a buyer's repo.** The buyer's repo lobe invites the builder with a writer's standing scoped to the\n folders it delivers, a note and a span. The builder's repo lobe pulls the scope, commits and pushes; the buyer's lobe\n checks it by both checks and its gate before it lands. The standing ends and the builder keeps nothing of\n the buyer's; a version enters the buyer's library from the buyer's own repo lobe.\n- **Updating lobes.** A new version enters the library, then `version {lobe, faculty}` moves each lobe, its `migrate`\n running; `settle` when it holds, or move back. `nervur update` moves the lobes on the installer's own faculties alone,\n each on an older version than it ships, never a lobe on a repo's faculty.\n- **Authoring with an agent.** Open the repo's own folder. Nervur's guide, this paper and the changelog stand one folder\n up in the lent genome's `docs/`; the repo's harness, its skills, its gate stand in the repo, its owners' own. Code\n runs only where its owners ask it.\n";
17981
18022
 
17982
18023
  var REFUSED2 = ["refused"];
17983
18024
  var STANDING_METHODS = {
@@ -18698,8 +18739,8 @@ var writeDurable = (cells, kept3) => {
18698
18739
  };
18699
18740
  var keepDurable = (gear, held2, kept3, flushed) => {
18700
18741
  const cells = cellsOf2(gear.cache, BRAIN, true);
18701
- const refused15 = writeDurable(cells, kept3);
18702
- if (refused15 !== null) return flushed(error("refused", `the durable ask is not kept: ${refused15.why}`));
18742
+ const refused16 = writeDurable(cells, kept3);
18743
+ if (refused16 !== null) return flushed(error("refused", `the durable ask is not kept: ${refused16.why}`));
18703
18744
  gear.commits.add(
18704
18745
  cells.batch(),
18705
18746
  () => flushed(null),
@@ -19633,11 +19674,11 @@ var postLetter = (hold5, post, lives, enqueue2, join3) => {
19633
19674
  const cells = cellsOf2(gear.cache, BRAIN, true);
19634
19675
  const number = nextNumber(hold5, cells);
19635
19676
  const kept3 = { asker: post.from, method: post.method, args: post.args };
19636
- const refused15 = cells.set(keyOf7({ lobe: node2.id, number }), {
19677
+ const refused16 = cells.set(keyOf7({ lobe: node2.id, number }), {
19637
19678
  ...kept3,
19638
19679
  until: gear.time.wall() + lives
19639
19680
  });
19640
- if (refused15 !== null) return post.done(error("refused", `the letter is not kept: ${refused15.why}`));
19681
+ if (refused16 !== null) return post.done(error("refused", `the letter is not kept: ${refused16.why}`));
19641
19682
  const laid4 = join3.post(cells.batch(), () => takeLetters(hold5, node2.id, enqueue2));
19642
19683
  if (!laid4) return post.done(error("refused", "a letter is posted only while a lobe answers a writing ask"));
19643
19684
  post.done(result(null));
@@ -20649,7 +20690,7 @@ var ownNoteChange = (lobe, args) => (cells) => {
20649
20690
  };
20650
20691
 
20651
20692
  var SALT2 = 32;
20652
- var refused2 = (why) => ({ answer: error("refused", why) });
20693
+ var refused3 = (why) => ({ answer: error("refused", why) });
20653
20694
  var endLastNext = (serving, cells) => {
20654
20695
  const map = mapOf(cells);
20655
20696
  for (const heir of nextAnchors(cells)) {
@@ -20679,33 +20720,33 @@ var relateChange = (serving, args) => (cells) => {
20679
20720
  note: noteIn(args)
20680
20721
  };
20681
20722
  const tooLong = noteRefusal(cells, asked3.node, asked3.note) ?? (args["says"] === void 0 ? null : saysRefusal(cells, asked3.node, args["says"]));
20682
- if (tooLong !== null) return refused2(tooLong);
20723
+ if (tooLong !== null) return refused3(tooLong);
20683
20724
  const anchor = args["anchor"] === true;
20684
20725
  const inviter = serving.inviting.current;
20685
20726
  if (anchor && (asked3.node !== BRAIN || asked3.lives !== null))
20686
- return refused2("the next anchor is invited to the brain alone, and lives for good");
20727
+ return refused3("the next anchor is invited to the brain alone, and lives for good");
20687
20728
  if (anchor && (inviter === null || inviter !== anchorNode(cells)))
20688
- return refused2("the next anchor is invited by the anchor alone");
20729
+ return refused3("the next anchor is invited by the anchor alone");
20689
20730
  const first = args["first"] === true;
20690
20731
  if (first && (asked3.node !== BRAIN || anchor || owned(cells) || args["again"] !== void 0))
20691
- return refused2("the first invitation is the brain's while not owned, never the next anchor's nor given again");
20732
+ return refused3("the first invitation is the brain's while not owned, never the next anchor's nor given again");
20692
20733
  const last = anchor ? endLastNext(serving, cells) : null;
20693
20734
  if (last !== null) return { answer: error("busy", last) };
20694
20735
  const again2 = typeof args["again"] === "string" ? args["again"] : null;
20695
- if (again2 !== null && anchor) return refused2("the next anchor is never given again");
20736
+ if (again2 !== null && anchor) return refused3("the next anchor is never given again");
20696
20737
  const barred = again2 === null ? null : againRefusal(serving, cells, asked3.node, again2);
20697
20738
  if (barred !== null) return { answer: barred };
20698
20739
  const full = again2 === null ? serving.gear.space.drawing(asked3.node) : null;
20699
20740
  if (full !== null) return { answer: error("busy", full) };
20700
20741
  const wall = serving.gear.time.wall();
20701
20742
  const related = again2 === null ? relate(cells, mapOf(cells), asked3, wall) : relateAgain(cells, { ...asked3, far: again2 }, wall);
20702
- if ("why" in related) return refused2(related.why);
20743
+ if ("why" in related) return refused3(related.why);
20703
20744
  if (anchor && inviter !== null) markNextAnchor(cells, asked3.heir, inviter);
20704
20745
  if (first) endUnbound(cells, mapOf(cells), wall, new Set([asked3.heir]));
20705
20746
  return { answer: result(related) };
20706
20747
  };
20707
20748
 
20708
- var refused3 = (why) => ({ answer: error("refused", why) });
20749
+ var refused4 = (why) => ({ answer: error("refused", why) });
20709
20750
  var isSpan2 = (one) => one === null || typeof one === "number";
20710
20751
  var keptOf2 = (reference, value) => {
20711
20752
  if (value === void 0) return void 0;
@@ -20715,13 +20756,6 @@ var keptOf2 = (reference, value) => {
20715
20756
  throw new Error(`brain: the reference ${reference} is not as the brain kept it.`);
20716
20757
  return { node: node2, sealed, until, ward: ward3, says, lives };
20717
20758
  };
20718
- var carryReferences = (cells) => {
20719
- for (const { key: key2, value } of rowsIn(cells, { prefix: ["reference"] }, "brain")) {
20720
- const row = isFields(value) ? value : void 0;
20721
- if (row !== void 0 && row["says"] === void 0 && row["lives"] === void 0)
20722
- putRow(cells, key2, { ...row, says: null, lives: null }, "brain");
20723
- }
20724
- };
20725
20759
  var lapsed2 = (kept3, wall) => kept3.until !== null && kept3.until <= wall;
20726
20760
  var sweep = (cells, wall) => {
20727
20761
  for (const { key: key2, value } of rowsIn(cells, { prefix: ["reference"] }, "brain")) {
@@ -20744,10 +20778,10 @@ var referChange = (serving, args) => (cells) => {
20744
20778
  sweep(cells, wall);
20745
20779
  const [reference, waits2] = [textAt2(args, "reference"), maybeNumberAt(args, "waits")];
20746
20780
  if (rowAt(cells, ["reference", reference], "brain") !== void 0)
20747
- return refused3(`the reference ${reference} is kept`);
20781
+ return refused4(`the reference ${reference} is kept`);
20748
20782
  const ward3 = textAt2(args, "ward");
20749
20783
  const none = noteOnWard(cells, ward3, reference);
20750
- if (none !== null) return refused3(none);
20784
+ if (none !== null) return refused4(none);
20751
20785
  putRow(
20752
20786
  cells,
20753
20787
  ["reference", reference],
@@ -20782,7 +20816,7 @@ var offerRead = (serving, args, done2) => {
20782
20816
  var unreferChange = (args) => (cells) => {
20783
20817
  const [reference, node2] = [textAt2(args, "reference"), textAt2(args, "node")];
20784
20818
  const kept3 = keptOf2(reference, rowAt(cells, ["reference", reference], "brain"));
20785
- if (kept3 === void 0 || kept3.node !== node2) return refused3(`the node ${node2} kept no reference ${reference}`);
20819
+ if (kept3 === void 0 || kept3.node !== node2) return refused4(`the node ${node2} kept no reference ${reference}`);
20786
20820
  dropRow(cells, ["reference", reference], "brain");
20787
20821
  return { answer: result(null) };
20788
20822
  };
@@ -20940,7 +20974,7 @@ var lineTold = (serving, args, done2) => {
20940
20974
 
20941
20975
  var EAR_METHODS = askedBy(EAR);
20942
20976
  var SEEN = 32;
20943
- var refused4 = (why) => ({ answer: error("refused", why) });
20977
+ var refused5 = (why) => ({ answer: error("refused", why) });
20944
20978
  var endRefusal = (cells, node2, far) => {
20945
20979
  const direction = heldDirection(cells, node2, far);
20946
20980
  if (direction === void 0) return `the node ${node2} holds no relation of the far organism ${far}`;
@@ -20950,7 +20984,7 @@ var endChange = (serving, args) => (cells) => {
20950
20984
  const far = textAt2(args, "far");
20951
20985
  const node2 = textAt2(args, "node");
20952
20986
  const why = endRefusal(cells, node2, far);
20953
- if (why !== null) return refused4(why);
20987
+ if (why !== null) return refused5(why);
20954
20988
  const { time: time2, configuration } = serving.gear;
20955
20989
  const ended5 = endRelation(cells, mapOf(cells), heirAt(cells, far), time2.wall(), configuration.removedKeysSpan);
20956
20990
  if (ended5 === null) return { answer: result(null) };
@@ -20986,7 +21020,7 @@ var ended3 = (serving, args, done2, joined9 = []) => {
20986
21020
  if (heir === void 0 || !serving.flying.has(heir))
20987
21021
  return closing(serving, heir === void 0 ? [] : [heir], endChange(serving, args), done2, joined9);
20988
21022
  const why = endRefusal(cells, node2, far);
20989
- if (why !== null) return serving.change(() => refused4(why), done2, joined9);
21023
+ if (why !== null) return serving.change(() => refused5(why), done2, joined9);
20990
21024
  answeredEnd(serving, { heir, far, node: node2 }, done2, joined9);
20991
21025
  };
20992
21026
  var answeredEnd = (serving, mark, done2, joined9) => {
@@ -21108,7 +21142,7 @@ var dispatch = (serving, args, relation2, joined9, told) => {
21108
21142
  told(answer);
21109
21143
  } : told;
21110
21144
  const refusal3 = typeof args["refused"] === "string" ? args["refused"] : null;
21111
- if (refusal3 !== null) return serving.change(() => refused4(refusal3), heard2, joined9);
21145
+ if (refusal3 !== null) return serving.change(() => refused5(refusal3), heard2, joined9);
21112
21146
  if (method3 === LEAVE) return leaveFrom(serving, { far, node: node2 }, joined9, heard2);
21113
21147
  if (node2 === BRAIN) return serving.answer(far, method3, args["args"] ?? null, heard2, joined9, binds);
21114
21148
  const timeout = beingTimeout(
@@ -21120,7 +21154,7 @@ var leaveFrom = (serving, ending, joined9, heard2) => {
21120
21154
  const cells = serving.gear.cells();
21121
21155
  const { far, node: node2 } = ending;
21122
21156
  if (node2 === BRAIN && far === anchorNode(cells))
21123
- return serving.change(() => refused4("the anchor leaves only by passing"), heard2, joined9);
21157
+ return serving.change(() => refused5("the anchor leaves only by passing"), heard2, joined9);
21124
21158
  answeredEnd(serving, { heir: heirAt(cells, far), far, node: node2 }, heard2, joined9);
21125
21159
  };
21126
21160
  var serveEar = (serving, method3, args, done2) => {
@@ -21351,7 +21385,7 @@ var declaredBy = (library, organs, shipped) => {
21351
21385
  };
21352
21386
 
21353
21387
  var NOTHING = { get: () => null, range: () => [] };
21354
- var refused5 = (why) => ({ answer: error("refused", why) });
21388
+ var refused6 = (why) => ({ answer: error("refused", why) });
21355
21389
  var pastTheLongest = (gear, kept3) => {
21356
21390
  const { longestBudget } = gear.configuration;
21357
21391
  for (const [name2, method3] of Object.entries(kept3.methods))
@@ -21382,11 +21416,11 @@ var skinned = (gear, cells, lobe, wiring2) => {
21382
21416
  var createChange = (gear, args, parent) => (cells) => {
21383
21417
  const digest = textAt2(args, "faculty");
21384
21418
  const kept3 = keptAt2(gear.partition(LIBRARY), digest, gear.shipped);
21385
- if (kept3 === void 0) return refused5(`the library keeps no faculty ${digest}`);
21419
+ if (kept3 === void 0) return refused6(`the library keeps no faculty ${digest}`);
21386
21420
  const past = pastTheLongest(gear, kept3);
21387
- if (past !== null) return refused5(past);
21421
+ if (past !== null) return refused6(past);
21388
21422
  const compiled3 = gear.runner.keep(digest, kept3.source);
21389
- if (compiled3 !== null) return refused5(`the faculty is not kept: ${compiled3.why}`);
21423
+ if (compiled3 !== null) return refused6(`the faculty is not kept: ${compiled3.why}`);
21390
21424
  const map = mapOf(cells);
21391
21425
  const id = map.madeUp();
21392
21426
  if (parent !== void 0) putParent(cells, id, parent);
@@ -21396,12 +21430,12 @@ var createChange = (gear, args, parent) => (cells) => {
21396
21430
  kept3.placeholders,
21397
21431
  wiringOf(maybeRecordAt(args, "wiring"))
21398
21432
  );
21399
- if (added3 !== null) return refused5(added3.why);
21433
+ if (added3 !== null) return refused6(added3.why);
21400
21434
  const reach = map.order(BRAIN, { termination: id, until: null }, false);
21401
- if ("why" in reach) return refused5(reach.why);
21435
+ if ("why" in reach) return refused6(reach.why);
21402
21436
  if (parent === void 0) skinned(gear, cells, id, maybeRecordAt(args, "wiring"));
21403
21437
  const first = firstCells(id, listAt2(args, "cells"));
21404
- if (typeof first === "string") return refused5(first);
21438
+ if (typeof first === "string") return refused6(first);
21405
21439
  return {
21406
21440
  answer: result({ id }),
21407
21441
  extra: first.batch(),
@@ -21424,7 +21458,7 @@ var withEnds = (carry, change) => (cells) => {
21424
21458
  };
21425
21459
  };
21426
21460
 
21427
- var refused6 = (why) => ({ answer: error("refused", why) });
21461
+ var refused7 = (why) => ({ answer: error("refused", why) });
21428
21462
  var named5 = (fields) => ({
21429
21463
  lobe: textAt2(fields, "lobe"),
21430
21464
  number: numberAt2(fields, "number")
@@ -21432,8 +21466,8 @@ var named5 = (fields) => ({
21432
21466
  var repostChange = (kit, fields) => (cells) => {
21433
21467
  const { lobe, number } = named5(fields);
21434
21468
  const dead = deadAt(cells, lobe, number);
21435
- if (dead === void 0) return refused6(`no dead letter ${number} of ${lobe} is kept`);
21436
- if (kit.map().node(lobe)?.kind !== "lobe") return refused6(`the lobe ${lobe} is none`);
21469
+ if (dead === void 0) return refused7(`no dead letter ${number} of ${lobe} is kept`);
21470
+ if (kit.map().node(lobe)?.kind !== "lobe") return refused7(`the lobe ${lobe} is none`);
21437
21471
  unbury(cells, dead);
21438
21472
  const span = limitIn(cells, "letters.span", lobe) ?? kit.gear.configuration.letters.span;
21439
21473
  const until = Math.max(dead.until, Math.min(kit.gear.time.wall() + span, LIFTED));
@@ -21447,7 +21481,7 @@ var forgetChange = (carry, fields) => (cells) => {
21447
21481
  unbury(cells, dead);
21448
21482
  return { answer: result(null) };
21449
21483
  }
21450
- if (letterAt(cells, lobe, number) === void 0) return refused6(`no letter ${number} of ${lobe} is kept`);
21484
+ if (letterAt(cells, lobe, number) === void 0) return refused7(`no letter ${number} of ${lobe} is kept`);
21451
21485
  if (carry().taking(lobe, number))
21452
21486
  return { answer: error("busy", `the lobe ${lobe} takes the letter ${number} now`) };
21453
21487
  dropLetter(cells, { lobe, number });
@@ -21460,7 +21494,7 @@ var cancelChange = (carry, fields) => (cells) => {
21460
21494
  method: textAt2(fields, "method")
21461
21495
  };
21462
21496
  if (durableAt(cells, at) === void 0)
21463
- return refused6(`no durable ask ${at.method} of ${at.asker} to ${at.organ} is kept`);
21497
+ return refused7(`no durable ask ${at.method} of ${at.asker} to ${at.organ} is kept`);
21464
21498
  dropDurable(cells, at);
21465
21499
  return {
21466
21500
  answer: result(null),
@@ -21554,8 +21588,8 @@ var toldRestored = (cells, map) => {
21554
21588
  for (const { id, kind, core } of map.nodes()) {
21555
21589
  if (kind !== "lobe" || core) continue;
21556
21590
  const letter2 = { asker: BRAIN, method: "restored", args: said, until: Number.MAX_SAFE_INTEGER };
21557
- const refused15 = cells.set(["letter", id, 0], letter2);
21558
- if (refused15 !== null) throw new Error(`brain: the word to ${id} is not kept: ${refused15.why}`);
21591
+ const refused16 = cells.set(["letter", id, 0], letter2);
21592
+ if (refused16 !== null) throw new Error(`brain: the word to ${id} is not kept: ${refused16.why}`);
21559
21593
  }
21560
21594
  };
21561
21595
  var MOVED = "the organism moved";
@@ -21565,16 +21599,16 @@ var restoredIn = (cells) => {
21565
21599
  return isFields(restored) && salvaged !== void 0 ? { ...restored, salvaged } : restored;
21566
21600
  };
21567
21601
  var wallKept = (now) => (cells) => {
21568
- const refused15 = cells.set(["wall"], now);
21569
- return { answer: refused15 === null ? result(null) : error("refused", refused15.why) };
21602
+ const refused16 = cells.set(["wall"], now);
21603
+ return { answer: refused16 === null ? result(null) : error("refused", refused16.why) };
21570
21604
  };
21571
21605
  var timeSaid = (clock, fields) => (cells) => {
21572
21606
  const at = fields["at"];
21573
21607
  if (typeof at !== "number" || !Number.isSafeInteger(at) || at < 0)
21574
21608
  return { answer: error("refused", "the time said is no count of milliseconds") };
21575
21609
  const correction = clock.correctionFor(at);
21576
- const refused15 = cells.set(["clock"], correction) ?? cells.set(["wall"], at);
21577
- if (refused15 !== null) return { answer: error("refused", refused15.why) };
21610
+ const refused16 = cells.set(["clock"], correction) ?? cells.set(["wall"], at);
21611
+ if (refused16 !== null) return { answer: error("refused", refused16.why) };
21578
21612
  return { answer: result(null), after: () => clock.said(correction, at) };
21579
21613
  };
21580
21614
  var unreadOf = (key2) => ({ lobe: String(keyOf2(key2)?.key[0] ?? null), key: hex(key2) });
@@ -21740,28 +21774,28 @@ var sharePresent = (cells, map) => {
21740
21774
  }
21741
21775
  }
21742
21776
  };
21743
- var refused7 = (why) => ({ answer: error("refused", why) });
21777
+ var refused8 = (why) => ({ answer: error("refused", why) });
21744
21778
  var standingOrder = (kit, cells, node2, order, note2) => {
21745
21779
  const far = order.termination;
21746
21780
  const placeholder = order.placeholder ?? far;
21747
21781
  const tooLong = noteRefusal(cells, node2, note2);
21748
- if (tooLong !== null) return refused7(tooLong);
21782
+ if (tooLong !== null) return refused8(tooLong);
21749
21783
  const map = mapOf(cells);
21750
21784
  if (map.node(node2)?.kind !== "lobe")
21751
- return refused7(`the node ${node2} is no lobe, and a lobe alone is wired to a standing`);
21752
- if (kit.standings.ended.has(far)) return refused7(`the standing ${far} is ending`);
21753
- if (order.until !== null) return refused7("the wire of a standing has no time to live");
21785
+ return refused8(`the node ${node2} is no lobe, and a lobe alone is wired to a standing`);
21786
+ if (kit.standings.ended.has(far)) return refused8(`the standing ${far} is ending`);
21787
+ if (order.until !== null) return refused8("the wire of a standing has no time to live");
21754
21788
  const held2 = map.reaching(far).find((wire2) => wire2.node === node2);
21755
21789
  if (held2 !== void 0 && held2.placeholder !== placeholder)
21756
- return refused7(`${node2} reaches the standing ${far} by ${held2.placeholder} already, one wire each`);
21790
+ return refused8(`${node2} reaches the standing ${far} by ${held2.placeholder} already, one wire each`);
21757
21791
  if (held2 !== void 0) {
21758
21792
  putGrant(cells, far, node2, note2);
21759
21793
  return { answer: result({ placeholder }) };
21760
21794
  }
21761
21795
  const why = grantTo(cells, far, { lobe: node2, placeholder, note: note2 });
21762
- if (why !== null) return refused7(why);
21796
+ if (why !== null) return refused8(why);
21763
21797
  const shared = grantBeside(cells, far, node2, placeholder);
21764
- return shared === null ? { answer: result({ placeholder }) } : refused7(shared);
21798
+ return shared === null ? { answer: result({ placeholder }) } : refused8(shared);
21765
21799
  };
21766
21800
  var revokeOne = (kit, cells, far, lobe) => {
21767
21801
  const map = mapOf(cells);
@@ -22134,8 +22168,8 @@ var newWard = (kit, waiter, then) => kit.gear.carry().ask(
22134
22168
  if ("error" in drawn4) return then(drawn4);
22135
22169
  const laying = () => {
22136
22170
  const ear2 = kit.gear.partition(EAR);
22137
- const refused15 = ear2.set(["ward"], drawn4.result);
22138
- return refused15 === null ? { answer: result(null), extra: ear2.batch() } : { answer: error("refused", refused15.why) };
22171
+ const refused16 = ear2.set(["ward"], drawn4.result);
22172
+ return refused16 === null ? { answer: result(null), extra: ear2.batch() } : { answer: error("refused", refused16.why) };
22139
22173
  };
22140
22174
  kit.change(laying, then);
22141
22175
  },
@@ -22510,7 +22544,7 @@ var readOf2 = (cells, map, counts2, lobe, method3, args, level) => {
22510
22544
  const read8 = method3 === "relation" ? readRelation : readRelations;
22511
22545
  return read8(cells, map, counts2, lobe, fieldsOf(args, "args"));
22512
22546
  };
22513
- var refused8 = (why) => ({
22547
+ var refused9 = (why) => ({
22514
22548
  answer: error("refused", why)
22515
22549
  });
22516
22550
  var nervesChange = (lobe, method3, args, asked3) => (cells) => {
@@ -22518,20 +22552,20 @@ var nervesChange = (lobe, method3, args, asked3) => (cells) => {
22518
22552
  if (method3 === "order") {
22519
22553
  const order = orderOf(recordAt(args, "order"));
22520
22554
  const moves = anchorOrderRefusal(cells, map, lobe, order);
22521
- if (moves !== null) return refused8(moves);
22555
+ if (moves !== null) return refused9(moves);
22522
22556
  const unconnected = map.refusedOwn(lobe, order.termination, asked3);
22523
- if (unconnected !== null) return refused8(unconnected.why);
22557
+ if (unconnected !== null) return refused9(unconnected.why);
22524
22558
  const ordered = map.order(lobe, order, false);
22525
- return "why" in ordered ? refused8(ordered.why) : { answer: result(ordered) };
22559
+ return "why" in ordered ? refused9(ordered.why) : { answer: result(ordered) };
22526
22560
  }
22527
22561
  const placeholder = textAt2(args, "placeholder");
22528
22562
  const wired3 = map.wire(lobe, placeholder)?.termination;
22529
22563
  if (wired3 !== void 0 && map.node(wired3)?.direction === "standing")
22530
- return refused8(`the wire of ${placeholder} reaches a standing, which the mouth's drop gives up`);
22564
+ return refused9(`the wire of ${placeholder} reaches a standing, which the mouth's drop gives up`);
22531
22565
  const leaves = anchorWireRefusal(cells, map, lobe, placeholder);
22532
- if (leaves !== null) return refused8(leaves);
22566
+ if (leaves !== null) return refused9(leaves);
22533
22567
  const unwired = map.unwire(lobe, placeholder, false);
22534
- return unwired === null ? { answer: result(null) } : refused8(unwired.why);
22568
+ return unwired === null ? { answer: result(null) } : refused9(unwired.why);
22535
22569
  };
22536
22570
 
22537
22571
  var granteeOf = (kit, named6) => {
@@ -23418,7 +23452,7 @@ var turnsOf = () => {
23418
23452
  busy: () => busy || waiting.length > 0
23419
23453
  };
23420
23454
  };
23421
- var refused9 = (why) => error("refused", why);
23455
+ var refused10 = (why) => error("refused", why);
23422
23456
  var refusalOver = (map, id, name2) => {
23423
23457
  const node2 = map.node(id);
23424
23458
  if (node2 === void 0) return name2 === null ? `the node ${id} is none` : null;
@@ -23473,7 +23507,7 @@ var backOf = (cells, added3) => {
23473
23507
  var addChange = (kit, added3, blueprint, back) => (cells) => {
23474
23508
  const standing3 = added3.id === NETWORK ? networkConfigured(kit.gear.configuration) : void 0;
23475
23509
  const why = placeOrgan(cells, added3, blueprint, standing3);
23476
- if (why !== null) return { answer: refused9(why) };
23510
+ if (why !== null) return { answer: refused10(why) };
23477
23511
  const ended5 = endUnmarked(cells, added3.id, blueprint.methods);
23478
23512
  const after2 = () => {
23479
23513
  for (const { organ: organ3, asker, method: method3 } of ended5) kit.gear.carry().ended(organ3, asker, method3);
@@ -23492,7 +23526,7 @@ var goBack = (kit, back, blueprint) => {
23492
23526
  var removeChange = (kit, id) => (cells) => {
23493
23527
  const map = mapOf(cells);
23494
23528
  const why = refusalOver(map, id, null) ?? map.remove(id)?.why ?? null;
23495
- if (why !== null) return { answer: refused9(why) };
23529
+ if (why !== null) return { answer: refused10(why) };
23496
23530
  dropOrgan(cells, id);
23497
23531
  dropDurables(cells, id);
23498
23532
  return { answer: result(null), after: () => kit.gear.halves.stop(id) };
@@ -23501,7 +23535,7 @@ var settleOrgan = (kit, args, settled3) => {
23501
23535
  const id = textAt2(args, "id");
23502
23536
  kit.change((cells) => {
23503
23537
  const organ3 = organAt(cells, id);
23504
- if (organ3?.last === void 0) return { answer: refused9(`the organ ${id} keeps no step back`) };
23538
+ if (organ3?.last === void 0) return { answer: refused10(`the organ ${id} keeps no step back`) };
23505
23539
  const { last: _left, ...kept3 } = organ3;
23506
23540
  dropOrgan(cells, id);
23507
23541
  putOrgan(cells, kept3);
@@ -23524,17 +23558,17 @@ var endingTurn = (next) => (answer, heard2) => {
23524
23558
  };
23525
23559
  var addOrgan = (kit, args, settled3, done2, joined9) => {
23526
23560
  const checked4 = args["id"] === NETWORK ? networkBlueprint(kit, args["blueprint"]) : checkBlueprint(args["blueprint"] ?? null, "organ", kit.gear.configuration.longestBudget);
23527
- if ("why" in checked4) return settled3(refused9(`the organ's blueprint: ${checked4.why.join("; ")}`));
23561
+ if ("why" in checked4) return settled3(refused10(`the organ's blueprint: ${checked4.why.join("; ")}`));
23528
23562
  const { blueprint } = checked4;
23529
23563
  const added3 = addedOf(args);
23530
23564
  if (Object.keys(blueprint.placeholders ?? {}).length > 0)
23531
- return settled3(refused9(`the organ ${added3.id} declares placeholders, and an organ declares no need`));
23565
+ return settled3(refused10(`the organ ${added3.id} declares placeholders, and an organ declares no need`));
23532
23566
  kit.turns.take((next) => {
23533
23567
  const ended5 = endingTurn(next);
23534
23568
  const why = refusalOver(kit.map(), added3.id, blueprint.name) ?? (added3.id === NETWORK && kit.gear.releasesNetwork !== true ? "this host's carriers stand in the organism's own process, and have no host half to release" : null);
23535
- if (why !== null) return ended5(refused9(why), settled3);
23569
+ if (why !== null) return ended5(refused10(why), settled3);
23536
23570
  admitting(kit, organsWith(kit, added3.id, added3), (refusal3) => {
23537
- if (refusal3 !== null) return ended5(refused9(refusal3), settled3);
23571
+ if (refusal3 !== null) return ended5(refused10(refusal3), settled3);
23538
23572
  whenRemoved(kit.removals, added3.half.digest, () => {
23539
23573
  const back = backOf(kit.gear.cells(), added3);
23540
23574
  kit.change(addChange(kit, added3, blueprint, back), (answer) => ended5(answer, done2), joined9);
@@ -23547,15 +23581,15 @@ var removeOrgan = (kit, args, settled3, done2, joined9) => {
23547
23581
  kit.turns.take((next) => {
23548
23582
  const ended5 = endingTurn(next);
23549
23583
  const why = refusalOver(kit.map(), id, null);
23550
- if (why !== null) return ended5(refused9(why), settled3);
23584
+ if (why !== null) return ended5(refused10(why), settled3);
23551
23585
  admitting(kit, organsWith(kit, id, null), (refusal3) => {
23552
- if (refusal3 !== null) return ended5(refused9(refusal3), settled3);
23586
+ if (refusal3 !== null) return ended5(refused10(refusal3), settled3);
23553
23587
  kit.change(removeChange(kit, id), (answer) => ended5(answer, done2), joined9);
23554
23588
  });
23555
23589
  });
23556
23590
  };
23557
23591
 
23558
- var refused10 = (done2, why) => done2(error("refused", why));
23592
+ var refused11 = (done2, why) => done2(error("refused", why));
23559
23593
  var saysIn = (args) => args["says"] === void 0 ? {} : { says: args["says"] };
23560
23594
  var invite2 = (serving, asker, args, { done: done2, settled: settled3, joined: joined9, waiter }) => {
23561
23595
  const anchor = args["anchor"] === true;
@@ -23569,11 +23603,11 @@ var invite2 = (serving, asker, args, { done: done2, settled: settled3, joined: j
23569
23603
  if (!anchor)
23570
23604
  return carry.ask(BRAIN, EAR, "invite", asked3, longestTimeout, done2, joined9, void 0, void 0, waiter);
23571
23605
  if (anchorNode(serving.gear.cells()) !== asker)
23572
- return refused10(settled3, `the anchor alone invites the next anchor, and ${asker} is not the anchor`);
23573
- if (lives !== null) return refused10(settled3, "the next anchor's relation lives for good");
23606
+ return refused11(settled3, `the anchor alone invites the next anchor, and ${asker} is not the anchor`);
23607
+ if (lives !== null) return refused11(settled3, "the next anchor's relation lives for good");
23574
23608
  const { inviting } = serving;
23575
23609
  if (inviting.current !== null)
23576
- return refused10(settled3, "the next anchor is invited one at a time, and one is being drawn");
23610
+ return refused11(settled3, "the next anchor is invited one at a time, and one is being drawn");
23577
23611
  inviting.current = asker;
23578
23612
  const drawn4 = (answer) => {
23579
23613
  inviting.current = null;
@@ -23584,7 +23618,7 @@ var invite2 = (serving, asker, args, { done: done2, settled: settled3, joined: j
23584
23618
  var dropOccupant = (serving, lobe, far, { done: done2, settled: settled3, joined: joined9 }) => {
23585
23619
  const cells = serving.gear.cells();
23586
23620
  if (typeof far !== "string" || lobe === BRAIN || heldDirection(cells, lobe, far) !== "occupant")
23587
- return refused10(settled3, `the lobe ${lobe} gave no occupant of ${String(far)}`);
23621
+ return refused11(settled3, `the lobe ${lobe} gave no occupant of ${String(far)}`);
23588
23622
  ended3(serving, { far, node: lobe }, done2, joined9);
23589
23623
  };
23590
23624
  var drop2 = (serving, asker, args, heard2) => {
@@ -23594,9 +23628,9 @@ var drop2 = (serving, asker, args, heard2) => {
23594
23628
  const cells = serving.gear.cells();
23595
23629
  const direction = heldDirection(cells, BRAIN, far);
23596
23630
  if (direction === "standing") return serving.forget(far, done2, joined9, args["gone"] === true);
23597
- if (direction !== "occupant") return refused10(settled3, `the brain holds no relation of ${far}`);
23631
+ if (direction !== "occupant") return refused11(settled3, `the brain holds no relation of ${far}`);
23598
23632
  if (far === anchorNode(cells))
23599
- return presentOrgan(cells, asker) === void 0 ? refused10(settled3, `the anchor leaves only by passing, and ${asker} drops it`) : anchorDropped(serving, asker, far, done2, joined9);
23633
+ return presentOrgan(cells, asker) === void 0 ? refused11(settled3, `the anchor leaves only by passing, and ${asker} drops it`) : anchorDropped(serving, asker, far, done2, joined9);
23600
23634
  const ending = { far, node: BRAIN };
23601
23635
  if (asker !== far) return endedWhenLanded(serving, ending, done2, joined9);
23602
23636
  serving.change(
@@ -23686,13 +23720,13 @@ var occupants = (cells, map, args) => {
23686
23720
  });
23687
23721
  };
23688
23722
 
23689
- var refused11 = (why) => ({ answer: error("refused", why) });
23723
+ var refused12 = (why) => ({ answer: error("refused", why) });
23690
23724
  var switchChange = (gear, lobe, off) => (cells) => {
23691
23725
  const map = mapOf(cells);
23692
23726
  const node2 = map.node(lobe);
23693
- if (node2 === void 0 || node2.kind !== "lobe") return refused11(`the node ${lobe} is no lobe`);
23694
- if (node2.core) return refused11(`the core lobe ${lobe} is never switched off or on`);
23695
- if (map.off(lobe) === off) return refused11(`the lobe ${lobe} is switched ${off ? "off" : "on"} already`);
23727
+ if (node2 === void 0 || node2.kind !== "lobe") return refused12(`the node ${lobe} is no lobe`);
23728
+ if (node2.core) return refused12(`the core lobe ${lobe} is never switched off or on`);
23729
+ if (map.off(lobe) === off) return refused12(`the lobe ${lobe} is switched ${off ? "off" : "on"} already`);
23696
23730
  map.switched(lobe, off);
23697
23731
  return {
23698
23732
  answer: result(null),
@@ -23793,7 +23827,7 @@ var droppedWithLobe = (cells, lobe) => {
23793
23827
  };
23794
23828
  var noStep = (lobe) => error("refused", `the lobe ${lobe} holds no step back`);
23795
23829
 
23796
- var refused12 = (why) => ({ answer: error("refused", why) });
23830
+ var refused13 = (why) => ({ answer: error("refused", why) });
23797
23831
  var endRelations = (cells, map, gear, lobe) => {
23798
23832
  const afters = [];
23799
23833
  for (const { far } of everyHeld(cells, lobe))
@@ -23810,11 +23844,11 @@ var emptied = (partition) => {
23810
23844
  var tearChange = (gear, lobe) => (cells) => {
23811
23845
  const map = mapOf(cells);
23812
23846
  const node2 = map.node(lobe);
23813
- if (node2 === void 0 || node2.kind !== "lobe") return refused12(`the node ${lobe} is no lobe`);
23814
- if (node2.core) return refused12(`the core lobe ${lobe} is never torn down`);
23847
+ if (node2 === void 0 || node2.kind !== "lobe") return refused13(`the node ${lobe} is no lobe`);
23848
+ if (node2.core) return refused13(`the core lobe ${lobe} is never torn down`);
23815
23849
  const afters = endRelations(cells, map, gear, lobe);
23816
23850
  const removed = map.remove(lobe);
23817
- if (removed !== null) return refused12(removed.why);
23851
+ if (removed !== null) return refused13(removed.why);
23818
23852
  dropPresent(cells, lobe);
23819
23853
  droppedWithLobe(cells, lobe);
23820
23854
  buryLetters(cells, lobe);
@@ -23859,7 +23893,7 @@ var tornDown = (serving, gear, lobe, done2, joined9) => {
23859
23893
  const plain2 = standings.filter((far) => !marked.includes(far));
23860
23894
  const change = withEnds(gear.carry, tearChange(gear, lobe));
23861
23895
  releaseAll(serving, marked, (why) => {
23862
- if (why !== null) return serving.change(() => refused12(`${lobe} holds an anchor's relation: ${why}`), done2, joined9);
23896
+ if (why !== null) return serving.change(() => refused13(`${lobe} holds an anchor's relation: ${why}`), done2, joined9);
23863
23897
  for (const heir of heirs) serving.ending.add(heir);
23864
23898
  releaseAll(serving, plain2, () => whenLanded(serving, heirs, () => closing(serving, heirs, change, done2, joined9)));
23865
23899
  });
@@ -23870,7 +23904,7 @@ var movingOver = () => ({
23870
23904
  versions: new Map(),
23871
23905
  migrating: new Map()
23872
23906
  });
23873
- var refused13 = (why) => ({
23907
+ var refused14 = (why) => ({
23874
23908
  answer: error("refused", why)
23875
23909
  });
23876
23910
  var boundOf = (kit, lobe) => limitIn(kit.gear.partition("brain"), "lobeMemory", lobe) ?? kit.gear.configuration.lobeMemory;
@@ -23891,9 +23925,9 @@ var checked2 = (kit, move2) => () => {
23891
23925
  const { lobe, digest } = move2;
23892
23926
  const kept3 = keptAt2(kit.gear.partition(LIBRARY), digest, kit.gear.shipped);
23893
23927
  const why = refusal2(kit, move2, kept3);
23894
- if (why !== null) return refused13(why);
23928
+ if (why !== null) return refused14(why);
23895
23929
  const compiled3 = kept3 === void 0 ? null : kit.gear.runner.keep(digest, kept3.source);
23896
- if (compiled3 !== null) return refused13(`the faculty is not kept: ${compiled3.why}`);
23930
+ if (compiled3 !== null) return refused14(`the faculty is not kept: ${compiled3.why}`);
23897
23931
  const brain = kit.gear.partition("brain");
23898
23932
  return {
23899
23933
  answer: result({
@@ -23934,13 +23968,13 @@ var committed = (kit, move2, kept3, from, migrated) => (cells) => {
23934
23968
  const held2 = new Set(map.placeholders(lobe).map(({ id }) => id));
23935
23969
  stepped2(kit, cells, move2, from, migrated);
23936
23970
  const moved3 = map.move(lobe, digest, kept3.placeholders, kept3.name);
23937
- if (moved3 !== null) return refused13(moved3.why);
23971
+ if (moved3 !== null) return refused14(moved3.why);
23938
23972
  if (!move2.genome) chosenBy(cells, kit.gear.configuration, lobe, digest);
23939
23973
  const named6 = presentOrgan(cells, lobe) === void 0 ? wiring2 : { [BRAIN]: BRAIN, ...wiring2 };
23940
23974
  for (const [placeholder, termination] of Object.entries(named6))
23941
23975
  if (!held2.has(placeholder) && Object.hasOwn(kept3.placeholders, placeholder)) {
23942
23976
  const wired3 = map.order(lobe, { placeholder, termination, until: null }, false);
23943
- if ("why" in wired3) return refused13(wired3.why);
23977
+ if ("why" in wired3) return refused14(wired3.why);
23944
23978
  }
23945
23979
  if (migrated.apart) {
23946
23980
  const keep4 = !move2.settled && !move2.genome;
@@ -24032,7 +24066,7 @@ var wentBack = (kit, lobe, told) => (cells) => {
24032
24066
  if (step4 === void 0 || kept3 === void 0) return { answer: noStep(lobe) };
24033
24067
  const map = mapOf(cells);
24034
24068
  const moved3 = map.move(lobe, step4.faculty, kept3.placeholders, step4.blueprint);
24035
- if (moved3 !== null) return refused13(moved3.why);
24069
+ if (moved3 !== null) return refused14(moved3.why);
24036
24070
  chosenBy(cells, kit.gear.configuration, lobe, step4.faculty);
24037
24071
  const standing3 = new Set(map.placeholders(lobe).map(({ id }) => id));
24038
24072
  for (const { placeholder, termination, until } of step4.wires)
@@ -24358,8 +24392,8 @@ var keptWake = (cells) => {
24358
24392
  return found.value;
24359
24393
  };
24360
24394
  var keeping = (at, armed) => (own2) => {
24361
- const refused15 = at === null ? own2.delete(WAKE) : own2.set(WAKE, at);
24362
- if (refused15 !== null) return { answer: error("refused", refused15.why) };
24395
+ const refused16 = at === null ? own2.delete(WAKE) : own2.set(WAKE, at);
24396
+ if (refused16 !== null) return { answer: error("refused", refused16.why) };
24363
24397
  return { answer: result(null), after: armed };
24364
24398
  };
24365
24399
  var ringAt = (gear, held2, at, ring, booting = false) => {
@@ -24554,7 +24588,7 @@ var makeSweep = (gear, removals) => {
24554
24588
  };
24555
24589
 
24556
24590
  var unavailable2 = (done2, message2) => done2(error("unavailable", message2));
24557
- var refused14 = (done2, message2) => done2(error("refused", message2));
24591
+ var refused15 = (done2, message2) => done2(error("refused", message2));
24558
24592
  var refusalOf2 = (kit, asker, method3, args, binds) => {
24559
24593
  if (kit.leaving.current !== null && method3 !== "backupPiece" && asker !== EAR)
24560
24594
  return error("refused", "the organism is leaving, and gives the pieces of its move alone");
@@ -24582,7 +24616,7 @@ var run = (kit, asker, method3, args, reply2) => {
24582
24616
  var nerves = (kit, lobe, method3, args, done2, join3, span) => {
24583
24617
  if (!isNervesMethod(method3)) return unavailable2(done2, `nerves answers no ${method3}`);
24584
24618
  const why = nervesRefusal(method3, args);
24585
- if (why !== null) return refused14(done2, why);
24619
+ if (why !== null) return refused15(done2, why);
24586
24620
  if (method3 === "wait") {
24587
24621
  const ms = numberAt2(fieldsOf(args, "args"), "ms");
24588
24622
  if (span !== void 0 && ms >= span) return;
@@ -24594,9 +24628,9 @@ var nerves = (kit, lobe, method3, args, done2, join3, span) => {
24594
24628
  return done2(assetsFor(kit.gear.cells(), kit.gear.partition(LIBRARY), lobe, kit.moving.migrating.get(lobe)));
24595
24629
  const read8 = readOf2(kit.gear.cells(), kit.map(), kit.counts(), lobe, method3, args, level);
24596
24630
  if (read8 !== void 0) return done2(read8);
24597
- if (kit.map().sealed(lobe)) return refused14(done2, `the lobe ${lobe} is sealed: nerves answers it its reads alone`);
24631
+ if (kit.map().sealed(lobe)) return refused15(done2, `the lobe ${lobe} is sealed: nerves answers it its reads alone`);
24598
24632
  if (join3?.still === true)
24599
- return refused14(done2, "a stranger's ask on the zero head changes nothing: nerves answers it its reads alone");
24633
+ return refused15(done2, "a stranger's ask on the zero head changes nothing: nerves answers it its reads alone");
24600
24634
  if (method3 === "note") {
24601
24635
  if (join3 === null) return kit.change(ownNoteChange(lobe, fieldsOf(args, "args")), done2);
24602
24636
  const cells = kit.gear.cells();
@@ -24604,7 +24638,7 @@ var nerves = (kit, lobe, method3, args, done2, join3, span) => {
24604
24638
  if ("error" in outcome2.answer) return done2(outcome2.answer);
24605
24639
  if (!join3.post(cells.batch(), () => {
24606
24640
  }))
24607
- return refused14(done2, "the ask the note is made in is over, or reads alone");
24641
+ return refused15(done2, "the ask the note is made in is over, or reads alone");
24608
24642
  return done2(outcome2.answer);
24609
24643
  }
24610
24644
  if (method3 === "hand") return hand(kit, lobe, fieldsOf(args, "args"), done2);
@@ -24806,12 +24840,12 @@ var keptIn2 = (cells) => ({
24806
24840
  });
24807
24841
  var ridingTime = (commits, brain, clock) => ({
24808
24842
  ...commits,
24809
- add: (batch, done2, refused15) => {
24843
+ add: (batch, done2, refused16) => {
24810
24844
  const cells = brain();
24811
- if (batch.length === 0 || cells.set(["wall"], clock.wall()) !== null) return commits.add(batch, done2, refused15);
24845
+ if (batch.length === 0 || cells.set(["wall"], clock.wall()) !== null) return commits.add(batch, done2, refused16);
24812
24846
  const kept3 = cells.batch();
24813
24847
  const keeps = batch.some(({ key: key2 }) => kept3.some((one) => compareBytes(one.key, key2) === 0));
24814
- commits.add(keeps ? batch : [...batch, ...kept3], done2, refused15);
24848
+ commits.add(keeps ? batch : [...batch, ...kept3], done2, refused16);
24815
24849
  }
24816
24850
  });
24817
24851
 
@@ -24834,7 +24868,7 @@ var genomeIn = (cells) => {
24834
24868
  return found;
24835
24869
  };
24836
24870
  var layGenome = (cells) => putRow(cells, ROW4, GENOME_VERSION, "brain");
24837
- var FLOOR = "0.33.0";
24871
+ var FLOOR = "0.37.2";
24838
24872
  var BELOW_FLOOR = "below the floor";
24839
24873
  var keepGenome = (cells) => {
24840
24874
  const kept3 = genomeIn(cells);
@@ -25055,8 +25089,8 @@ var shelfOver = (library) => ({
25055
25089
  return found?.value;
25056
25090
  },
25057
25091
  set: (key2, value) => {
25058
- const refused15 = library.set(key2, value);
25059
- if (refused15 !== null) throw new Error(`boot: the library's row is not kept: ${refused15.why}`);
25092
+ const refused16 = library.set(key2, value);
25093
+ if (refused16 !== null) throw new Error(`boot: the library's row is not kept: ${refused16.why}`);
25060
25094
  }
25061
25095
  });
25062
25096
  var keepInLibrary = (crypto2, library, kept3, bytes7) => {
@@ -25068,8 +25102,8 @@ var keepInLibrary = (crypto2, library, kept3, bytes7) => {
25068
25102
  why: `the assets of the faculty are not the digest its blueprint names, ${JSON.stringify(named6 ?? null)}`
25069
25103
  };
25070
25104
  }
25071
- const refused15 = Library.keep(shelfOver(library), digest, kept3, bytes7);
25072
- return refused15 === null ? digest : { why: refused15 };
25105
+ const refused16 = Library.keep(shelfOver(library), digest, kept3, bytes7);
25106
+ return refused16 === null ? digest : { why: refused16 };
25073
25107
  };
25074
25108
  var GENOME_ROAD = `genome@${GENOME_VERSION}`;
25075
25109
  var shelveDefault = (gear, library, source) => {
@@ -25400,7 +25434,7 @@ var movePortHalves = (gear, shelves, update2) => {
25400
25434
  const held2 = new Map(everyOrgan(shelves.brain).map((organ3) => [organ3.id, standing2(organ3.half.digest, organ3.reach)]));
25401
25435
  const present = new Set(presentLobes(shelves.brain).flatMap((lobe) => presentOrgan(shelves.brain, lobe) ?? []));
25402
25436
  const moved3 = [];
25403
- const refused15 = [];
25437
+ const refused16 = [];
25404
25438
  const moving = [];
25405
25439
  for (const [id, named6] of Object.entries(organs).toSorted(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) {
25406
25440
  const own2 = present.has(id);
@@ -25410,13 +25444,13 @@ var movePortHalves = (gear, shelves, update2) => {
25410
25444
  const why = at === void 0 ? addDefault(gear, shelves, id, named6) : placeDefault(gear, shelves, id, named6);
25411
25445
  if (own2) continue;
25412
25446
  if (why !== null) {
25413
- refused15.push(`the organ ${id} stays on the half it stands on: ${why}`);
25447
+ refused16.push(`the organ ${id} stays on the half it stands on: ${why}`);
25414
25448
  continue;
25415
25449
  }
25416
25450
  moved3.push(`the organ ${id} ${at === void 0 ? "is added" : "moves"} on its half ${named6.half.digest}`);
25417
25451
  moving.push(id);
25418
25452
  }
25419
- return { moved: moved3, refused: refused15, organs: moving };
25453
+ return { moved: moved3, refused: refused16, organs: moving };
25420
25454
  };
25421
25455
  var keepPresent = (configuration, brain, map) => {
25422
25456
  const named6 = configuration.presentLobes ?? [];
@@ -25493,7 +25527,7 @@ var movesOfShipped = (gear, map, brain, library) => {
25493
25527
  const shipped = shippingOf(gear);
25494
25528
  const present = new Set(presentLobes(brain));
25495
25529
  const moves = [];
25496
- const refused15 = [];
25530
+ const refused16 = [];
25497
25531
  for (const node2 of map.nodes()) {
25498
25532
  const to = node2.kind === "lobe" ? shipped.get(node2.blueprint) : void 0;
25499
25533
  if (to === void 0 || node2.core || present.has(node2.id) || node2.faculty === null || node2.faculty === to.digest)
@@ -25509,7 +25543,7 @@ var movesOfShipped = (gear, map, brain, library) => {
25509
25543
  });
25510
25544
  const why = typeof kept3 === "string" ? gear.keep(kept3, to.source)?.why : kept3.why;
25511
25545
  if (why !== void 0) {
25512
- refused15.push(`${stays}: ${why}`);
25546
+ refused16.push(`${stays}: ${why}`);
25513
25547
  continue;
25514
25548
  }
25515
25549
  moves.push({
@@ -25519,7 +25553,7 @@ var movesOfShipped = (gear, map, brain, library) => {
25519
25553
  said: { moved: `the lobe ${node2.id} moves to ${to.name} ${to.text}`, stays }
25520
25554
  });
25521
25555
  }
25522
- return { moves, refused: refused15 };
25556
+ return { moves, refused: refused16 };
25523
25557
  };
25524
25558
  var movesWithTheGenome = (gear, map, brain, library, update2) => {
25525
25559
  const own2 = [...movesOfDefaults(gear, map, library), ...movesOfPresent(gear, map, brain, library)];
@@ -25561,8 +25595,8 @@ var keepWard = (gear, ear2, key2) => {
25561
25595
  const form = formsOver(crypto2, gear.forms).fresh;
25562
25596
  const ward3 = makeWard(form.crypto, wardSeed(form.crypto, chance.draw(32)), draw);
25563
25597
  const sealing = { crypto: crypto2, draw, record: drawRecordKey(key2, chance) };
25564
- const refused15 = ear2.set(["ward"], sealWard(sealing, keysOf(form.crypto, ward3).name, ward3, form.name));
25565
- if (refused15 !== null) throw new Error(`boot: the ward is not written: ${refused15.why}`);
25598
+ const refused16 = ear2.set(["ward"], sealWard(sealing, keysOf(form.crypto, ward3).name, ward3, form.name));
25599
+ if (refused16 !== null) throw new Error(`boot: the ward is not written: ${refused16.why}`);
25566
25600
  };
25567
25601
  var shelved = (gear, library, source) => {
25568
25602
  const kept3 = shelveDefault(gear, library, source);
@@ -25570,8 +25604,8 @@ var shelved = (gear, library, source) => {
25570
25604
  };
25571
25605
  var buildCore = (map, defaults) => {
25572
25606
  for (const { node: node2, placeholders } of coreOf(defaults)) {
25573
- const refused15 = map.add(node2, placeholders, {});
25574
- if (refused15 !== null) throw new Error(`boot: the core node ${node2.id} is refused: ${refused15.why}`);
25607
+ const refused16 = map.add(node2, placeholders, {});
25608
+ if (refused16 !== null) throw new Error(`boot: the core node ${node2.id} is refused: ${refused16.why}`);
25575
25609
  }
25576
25610
  for (const [node2, wiring2] of CORE_WIRING)
25577
25611
  for (const [placeholder, termination] of Object.entries(wiring2)) {
@@ -25592,8 +25626,8 @@ var keepListen = (cells) => {
25592
25626
  args: {},
25593
25627
  timeout: SIGNAL_WAIT
25594
25628
  };
25595
- const refused15 = writeDurable(cells, kept3);
25596
- if (refused15 !== null) throw new Error(`boot: the ear's listen is not kept: ${refused15.why}`);
25629
+ const refused16 = writeDurable(cells, kept3);
25630
+ if (refused16 !== null) throw new Error(`boot: the ear's listen is not kept: ${refused16.why}`);
25597
25631
  };
25598
25632
  var firstInstall = async (cache, gear) => {
25599
25633
  if (holdsMap(cache)) return { why: "the store holds a map: the genome is installed already" };
@@ -25613,8 +25647,8 @@ var firstInstall = async (cache, gear) => {
25613
25647
  const organs = addDefaults(gear, { brain: cells, library });
25614
25648
  if (organs !== null) return organs;
25615
25649
  const warnings = keepGivenAll(gear, { brain: cells, library });
25616
- const [refused15] = keepChannel(gear, library);
25617
- if (refused15 !== void 0) return { why: `a default faculty of ${refused15.road} is refused: ${refused15.why}` };
25650
+ const [refused16] = keepChannel(gear, library);
25651
+ if (refused16 !== void 0) return { why: `a default faculty of ${refused16.road} is refused: ${refused16.why}` };
25618
25652
  const anchor = takeAnchor(gear, { brain: cells, library });
25619
25653
  if (anchor !== null) return anchor;
25620
25654
  keepListen(cells);
@@ -25661,7 +25695,6 @@ var boot = async (cache, gear, carry) => {
25661
25695
  if (gear.stays === true) written3(cells.delete(["moved"]));
25662
25696
  const backwards = keepGenome(cells);
25663
25697
  if (backwards !== null) return backwards;
25664
- carryReferences(cells);
25665
25698
  const map = mapOf(cells);
25666
25699
  const library = cellsOf2(cache, LIBRARY, true);
25667
25700
  const shelves = { brain: cells, library };
@@ -25967,11 +26000,11 @@ var commitOnce = async (parts, given2) => {
25967
26000
  parts.stopped = true;
25968
26001
  history.drop(last + 1);
25969
26002
  } else {
25970
- const { refused: refused15 } = answer;
25971
- landed4 = refused15 === void 0 ? batches : batches.filter((_, at) => !refused15.has(at));
26003
+ const { refused: refused16 } = answer;
26004
+ landed4 = refused16 === void 0 ? batches : batches.filter((_, at) => !refused16.has(at));
25972
26005
  if (landed4.length === 0) history.drop(last + 1);
25973
26006
  update(heat, landed4);
25974
- if (refused15 === void 0) parts.spaces.landed(moved3);
26007
+ if (refused16 === void 0) parts.spaces.landed(moved3);
25975
26008
  else parts.spaces.forget();
25976
26009
  }
25977
26010
  } finally {
@@ -26041,9 +26074,9 @@ var makeCommits = (committer, time2, window) => {
26041
26074
  }
26042
26075
  };
26043
26076
  return {
26044
- add: (batch, done2, refused15) => {
26077
+ add: (batch, done2, refused16) => {
26045
26078
  if (queue2.length === 0) arrival4 = time2.steady();
26046
- queue2.push({ batch, done: done2, refused: refused15 });
26079
+ queue2.push({ batch, done: done2, refused: refused16 });
26047
26080
  },
26048
26081
  due: () => queue2.length === 0 ? null : arrival4 + window,
26049
26082
  flush: () => {
@@ -26811,8 +26844,8 @@ var bodyFrozen = (body2) => {
26811
26844
  var STOPPED_ROW = keyBytes([BRAIN, "moved"]);
26812
26845
  var storeOf = (halves, start3, stopped) => {
26813
26846
  const { kind } = start3.init;
26814
- if (kind === "first-install" || kind === "boot") return halves.store(kind, start3.key, stopped);
26815
- if (kind === "reclaim") return halves.store("boot", start3.key, stopped);
26847
+ if (kind === "first-install" || kind === "boot") return halves.store(kind, start3.key, stopped, trial(start3));
26848
+ if (kind === "reclaim") return halves.store("boot", start3.key, stopped, false);
26816
26849
  if (start3.init.kind === "move") return halves.restore(null, start3.key, stopped);
26817
26850
  if (start3.init.kind !== "backup") throw new Error("organism: an init the door does not hold");
26818
26851
  return halves.restore(start3.init.temporaryKey, start3.key, stopped);
@@ -26887,15 +26920,15 @@ var begin3 = async (start3, halves, body2, stopped) => {
26887
26920
  var movedWithTheGenome = async (body2, booted) => {
26888
26921
  const warnings = [...booted.warnings];
26889
26922
  const moved3 = [...booted.shipped.moved];
26890
- const refused15 = [...booted.shipped.refused];
26923
+ const refused16 = [...booted.shipped.refused];
26891
26924
  for (const { lobe, faculty, wiring: wiring2, said } of booted.moves) {
26892
26925
  const answer = await new Promise((done2) => body2.brain.withTheGenome(lobe, faculty, wiring2, done2));
26893
26926
  if (said === void 0) {
26894
26927
  if ("error" in answer) warnings.push(`the lobe ${lobe} stays on its version: ${answer.error.message}`);
26895
- } else if ("error" in answer) refused15.push(`${said.stays}: ${answer.error.message}`);
26928
+ } else if ("error" in answer) refused16.push(`${said.stays}: ${answer.error.message}`);
26896
26929
  else moved3.push(said.moved);
26897
26930
  }
26898
- return { booted: { ...booted, warnings, moves: [], shipped: { ...booted.shipped, moved: moved3, refused: refused15 } } };
26931
+ return { booted: { ...booted, warnings, moves: [], shipped: { ...booted.shipped, moved: moved3, refused: refused16 } } };
26899
26932
  };
26900
26933
  var halvesNamed = (cells) => [
26901
26934
  ...new Set(
@@ -26954,15 +26987,24 @@ var deviceHalves = (start3, wasm, lobes) => {
26954
26987
  const { fills, configuration } = start3;
26955
26988
  const { engine, crypto: crypto2, codec } = fills;
26956
26989
  const memory = configuration.lobeMemory;
26957
- const gearOf = async (stopped) => {
26990
+ const gearOf = async (stopped, held2 = false) => {
26958
26991
  const ready = await fills.pages.ready();
26959
26992
  if (ready !== null) return { why: `the page layer is not ready: ${ready.why}` };
26960
26993
  const { witnessEachCommit = false } = configuration;
26961
- return { pages: fills.pages, time: fills.time, chance: fills.chance, crypto: crypto2, wasm, stopped, witnessEachCommit };
26994
+ return {
26995
+ pages: fills.pages,
26996
+ time: fills.time,
26997
+ chance: fills.chance,
26998
+ crypto: crypto2,
26999
+ wasm,
27000
+ stopped,
27001
+ witnessEachCommit,
27002
+ held: held2
27003
+ };
26962
27004
  };
26963
27005
  return {
26964
- store: async (kind, key2, stopped) => {
26965
- const gear = await gearOf(stopped);
27006
+ store: async (kind, key2, stopped, held2) => {
27007
+ const gear = await gearOf(stopped, held2);
26966
27008
  if ("why" in gear) return gear;
26967
27009
  return kind === "first-install" ? createStore(gear, key2) : openStore(gear, key2);
26968
27010
  },
@@ -30133,6 +30175,7 @@ var objectPages = (storage, flushed = () => void 0) => {
30133
30175
  }
30134
30176
  };
30135
30177
  };
30178
+ var LOG3 = "primordial-wal";
30136
30179
  var BEFORE_FILES = "nervur_before_files";
30137
30180
  var BEFORE_CHUNKS = "nervur_before_chunks";
30138
30181
  var beforeMade = (sql) => {
@@ -30142,18 +30185,19 @@ var beforeMade = (sql) => {
30142
30185
  `CREATE TABLE IF NOT EXISTS ${BEFORE_CHUNKS} (name TEXT NOT NULL, at INTEGER NOT NULL, bytes BLOB NOT NULL, PRIMARY KEY (name, at))`
30143
30186
  );
30144
30187
  };
30145
- var copiedTables = (sql, from, to) => {
30146
- for (const at of [0, 1]) sql.exec(`DELETE FROM ${to[at]}`);
30147
- sql.exec(`INSERT INTO ${to[0]} (name, size) SELECT name, size FROM ${from[0]}`);
30148
- sql.exec(`INSERT INTO ${to[1]} (name, at, bytes) SELECT name, at, bytes FROM ${from[1]}`);
30188
+ var logCopied = (sql, from, to) => {
30189
+ for (const at of [0, 1]) sql.exec(`DELETE FROM ${to[at]} WHERE name = ?`, LOG3);
30190
+ sql.exec(`INSERT INTO ${to[0]} (name, size) SELECT name, size FROM ${from[0]} WHERE name = ?`, LOG3);
30191
+ sql.exec(`INSERT INTO ${to[1]} (name, at, bytes) SELECT name, at, bytes FROM ${from[1]} WHERE name = ?`, LOG3);
30149
30192
  };
30150
30193
  var copiedBefore = ({ sql }) => {
30151
30194
  beforeMade(sql);
30152
- copiedTables(sql, [FILES, CHUNKS], [BEFORE_FILES, BEFORE_CHUNKS]);
30195
+ for (const table of [BEFORE_FILES, BEFORE_CHUNKS]) sql.exec(`DELETE FROM ${table}`);
30196
+ logCopied(sql, [FILES, CHUNKS], [BEFORE_FILES, BEFORE_CHUNKS]);
30153
30197
  };
30154
30198
  var fromBefore = ({ sql }) => {
30155
30199
  beforeMade(sql);
30156
- copiedTables(sql, [BEFORE_FILES, BEFORE_CHUNKS], [FILES, CHUNKS]);
30200
+ logCopied(sql, [BEFORE_FILES, BEFORE_CHUNKS], [FILES, CHUNKS]);
30157
30201
  };
30158
30202
  var beforeDropped = ({ sql }) => {
30159
30203
  beforeMade(sql);
@@ -30283,7 +30327,7 @@ var tried = async (storage, version2, trial2) => {
30283
30327
  return null;
30284
30328
  };
30285
30329
 
30286
- var INSTALLER_VERSION = "0.37.1";
30330
+ var INSTALLER_VERSION = "0.37.3";
30287
30331
 
30288
30332
  var BACKUP2 = "primordial.backup";
30289
30333
  var LAID = "nervur_laid";
@@ -30393,13 +30437,13 @@ var openDoor = async (opening) => {
30393
30437
  const init = opening.init ?? initOf(opening.storage);
30394
30438
  const version2 = opening.version ?? INSTALLER_VERSION;
30395
30439
  if (init.kind === "boot" && init.trial !== true && ranOn(opening.storage) !== version2) {
30396
- const refused15 = await tried(opening.storage, version2, async () => {
30440
+ const refused16 = await tried(opening.storage, version2, async () => {
30397
30441
  const trial2 = await started(opening, { kind: "boot", trial: true }, opened5.key);
30398
30442
  if ("why" in trial2) return trial2;
30399
30443
  await trial2.running.stop();
30400
30444
  return null;
30401
30445
  });
30402
- if (refused15 !== null) return refused15;
30446
+ if (refused16 !== null) return refused16;
30403
30447
  }
30404
30448
  const running = await started(opening, init, opened5.key);
30405
30449
  if (!("why" in running) && init.kind !== "boot" && init.kind !== "reclaim") await keptOn(opening.storage, version2);
@@ -30578,11 +30622,11 @@ var EdgeObject = class {
30578
30622
  });
30579
30623
  await this.#running?.stop();
30580
30624
  this.#running = null;
30581
- const refused15 = await layBackup(this.#ctx.storage, pieces(request2.body), key2);
30582
- let why = refused15?.why ?? null;
30625
+ const refused16 = await layBackup(this.#ctx.storage, pieces(request2.body), key2);
30626
+ let why = refused16?.why ?? null;
30583
30627
  await this.#ctx.blockConcurrencyWhile(async () => {
30584
30628
  const booted = await this.#boot();
30585
- if (refused15 !== null) return;
30629
+ if (refused16 !== null) return;
30586
30630
  why = booted;
30587
30631
  if (booted !== null) await this.#boot();
30588
30632
  });
@@ -30670,8 +30714,8 @@ var EdgeObject = class {
30670
30714
  const running = this.#running;
30671
30715
  if (running === null) return new Response("the organism is not running", { status: 503 });
30672
30716
  if (request2.headers.get("upgrade")?.toLowerCase() !== "websocket") return running.carriers.web.arrive(request2);
30673
- const refused15 = handshake(request2.method, request2.headers, url2, LINE_PATH);
30674
- if (refused15 !== null) return new Response(null, { status: refused15.status });
30717
+ const refused16 = handshake(request2.method, request2.headers, url2, LINE_PATH);
30718
+ if (refused16 !== null) return new Response(null, { status: refused16.status });
30675
30719
  const { client, server } = this.#bundled.pair();
30676
30720
  this.#ctx.acceptWebSocket(server);
30677
30721
  accepted(running.carriers.lines, server, request2.headers.get("cf-connecting-ip") ?? void 0);