@nervur.org/installer-phone 0.37.2 → 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.
@@ -2620,7 +2620,7 @@ var checkBlueprint = (value, node2, longest) => {
2620
2620
  };
2621
2621
  };
2622
2622
 
2623
- var GENOME_VERSION = "0.37.2";
2623
+ var GENOME_VERSION = "0.37.3";
2624
2624
 
2625
2625
  var endFrame = (asker, method3) => ({ end: { asker, method: method3 } });
2626
2626
 
@@ -3577,7 +3577,7 @@ var keepHalf = (gear, id, host, connected, added3, failed2) => {
3577
3577
 
3578
3578
  var EAR_BLUEPRINT = {
3579
3579
  name: "nervur.ear",
3580
- version: "0.37.2",
3580
+ version: "0.37.3",
3581
3581
  description: "The ear: it opens and seals the boxes of Quo, and the brain keeps every relation.",
3582
3582
  methods: {
3583
3583
  arrived: {
@@ -4146,13 +4146,13 @@ var readFaculty = (engine, crypto2, source, memory) => {
4146
4146
  };
4147
4147
  var facultyReaderOn = (engine, crypto2, memory) => (source) => readFaculty(engine.apart(), crypto2, source, memory);
4148
4148
 
4149
- 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.2',\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}";
4149
+ 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}";
4150
4150
 
4151
4151
  var EAR_SOURCE = facultySource(EAR_TEXT);
4152
4152
 
4153
4153
  var MOUTH_BLUEPRINT = {
4154
4154
  name: "nervur.mouth",
4155
- version: "0.37.2",
4155
+ version: "0.37.3",
4156
4156
  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.",
4157
4157
  methods: {
4158
4158
  accept: {
@@ -4310,7 +4310,7 @@ var MOUTH_BLUEPRINT = {
4310
4310
  placeholders: { brain: "nervur.brain", network: "nervur.network", key: "nervur.key" }
4311
4311
  };
4312
4312
 
4313
- 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.2',\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}";
4313
+ 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}";
4314
4314
 
4315
4315
  var MOUTH_SOURCE = facultySource(MOUTH_TEXT);
4316
4316
 
@@ -5614,7 +5614,7 @@ var Library = class _Library extends Faculty {
5614
5614
 
5615
5615
  var LIBRARY_BLUEPRINT = {
5616
5616
  name: "nervur.library",
5617
- version: "0.37.2",
5617
+ version: "0.37.3",
5618
5618
  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.",
5619
5619
  methods: {
5620
5620
  add: {
@@ -5871,13 +5871,13 @@ var LIBRARY_BLUEPRINT = {
5871
5871
  placeholders: { brain: "nervur.brain", mouth: "nervur.mouth", ear: "nervur.ear" }
5872
5872
  };
5873
5873
 
5874
- 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.2',\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}";
5874
+ 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}";
5875
5875
 
5876
5876
  var LIBRARY_SOURCE = facultySource(LIBRARY_TEXT);
5877
5877
 
5878
5878
  var SCHEDULER_BLUEPRINT = {
5879
5879
  name: "nervur.scheduler",
5880
- version: "0.37.2",
5880
+ version: "0.37.3",
5881
5881
  description: "The scheduler: every lobe's alarms, over the brain's one durable wake.",
5882
5882
  methods: {
5883
5883
  set: {
@@ -5961,7 +5961,7 @@ var SCHEDULER_BLUEPRINT = {
5961
5961
  placeholders: { brain: "nervur.brain", cage: "nervur.cage" }
5962
5962
  };
5963
5963
 
5964
- 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.2',\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}";
5964
+ 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}";
5965
5965
 
5966
5966
  var SCHEDULER_SOURCE = facultySource(SCHEDULER_TEXT);
5967
5967
 
@@ -18134,8 +18134,8 @@ var LOBES_METHOD = {
18134
18134
  budget: 100
18135
18135
  };
18136
18136
 
18137
- 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. Until 1.0.0 every organism also\nmoves itself to the newest: its process asks the channel it was laid from or last updated by as it starts and every\nhour, and runs the same update onto a newer version, saying what it did in its log and asking no one; one laid from a\npackage at hand has no channel and checks nothing. A start, a trial and a stop wait on the organism's silence, never on\na span: while it opens or ends it tells it lives, so a store that takes long to open is waited for, and a process that\ntells nothing for the longest 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";
18138
- 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 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\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 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";
18137
+ 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";
18138
+ 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";
18139
18139
 
18140
18140
  var REFUSED2 = ["refused"];
18141
18141
  var STANDING_METHODS = {
@@ -20250,10 +20250,10 @@ var guided = (gear, sending) => {
20250
20250
  const node2 = termination === void 0 ? void 0 : map.node(termination);
20251
20251
  const stranger = from === EAR && placeholder === FRONT;
20252
20252
  if (node2?.kind !== "lobe" || !stranger && gear.guides?.(from, node2.id) === true) return sending;
20253
- const crossed2 = stranger ? gear.toward ?? ((answer) => answer) : (answer) => answer;
20253
+ const crossed = stranger ? gear.toward ?? ((answer) => answer) : (answer) => answer;
20254
20254
  return {
20255
20255
  ...sending,
20256
- done: (answer) => done2(crossed2(stripped(answer)))
20256
+ done: (answer) => done2(crossed(stripped(answer)))
20257
20257
  };
20258
20258
  };
20259
20259
  var stripped = (answer) => {
@@ -20873,13 +20873,6 @@ var keptOf2 = (reference, value) => {
20873
20873
  throw new Error(`brain: the reference ${reference} is not as the brain kept it.`);
20874
20874
  return { node: node2, sealed, until, ward: ward3, says, lives };
20875
20875
  };
20876
- var carryReferences = (cells) => {
20877
- for (const { key: key2, value } of rowsIn(cells, { prefix: ["reference"] }, "brain")) {
20878
- const row = isFields(value) ? value : void 0;
20879
- if (row !== void 0 && row["says"] === void 0 && row["lives"] === void 0)
20880
- putRow(cells, key2, { ...row, says: null, lives: null }, "brain");
20881
- }
20882
- };
20883
20876
  var lapsed2 = (kept3, wall) => kept3.until !== null && kept3.until <= wall;
20884
20877
  var sweep = (cells, wall) => {
20885
20878
  for (const { key: key2, value } of rowsIn(cells, { prefix: ["reference"] }, "brain")) {
@@ -24992,7 +24985,7 @@ var genomeIn = (cells) => {
24992
24985
  return found;
24993
24986
  };
24994
24987
  var layGenome = (cells) => putRow(cells, ROW4, GENOME_VERSION, "brain");
24995
- var FLOOR = "0.33.0";
24988
+ var FLOOR = "0.37.2";
24996
24989
  var BELOW_FLOOR = "below the floor";
24997
24990
  var keepGenome = (cells) => {
24998
24991
  const kept3 = genomeIn(cells);
@@ -25819,7 +25812,6 @@ var boot = async (cache, gear, carry) => {
25819
25812
  if (gear.stays === true) written3(cells.delete(["moved"]));
25820
25813
  const backwards = keepGenome(cells);
25821
25814
  if (backwards !== null) return backwards;
25822
- carryReferences(cells);
25823
25815
  const map = mapOf(cells);
25824
25816
  const library = cellsOf2(cache, LIBRARY, true);
25825
25817
  const shelves = { brain: cells, library };
@@ -27417,7 +27409,7 @@ var FLOOR_FILES = [
27417
27409
  "design.json",
27418
27410
  `{
27419
27411
  "name": "floor",
27420
- "version": "0.37.2",
27412
+ "version": "0.37.3",
27421
27413
  "publisher": "nervur",
27422
27414
  "description": "The genome's one design: plain, clean and accessible, host-agnostic, given away with the packages. Its look is the describe look.",
27423
27415
  "languages": [
@@ -27550,7 +27542,7 @@ var FLOOR_FILES = [
27550
27542
 
27551
27543
  var FLOOR_LOOK_SOURCE = `import { Faculty } from 'nervur:faculty';
27552
27544
  export default class FloorLook extends Faculty {
27553
- static #identity = {"design":"floor","name":"nervur.floor-look","version":"0.37.2","description":"The genome's one design: plain, clean and accessible, host-agnostic, given away with the packages. Its look is the describe look.","components":["lobe","organism","surround"],"tints":["blue"],"densities":["compact","regular","roomy"]};
27545
+ static #identity = {"design":"floor","name":"nervur.floor-look","version":"0.37.3","description":"The genome's one design: plain, clean and accessible, host-agnostic, given away with the packages. Its look is the describe look.","components":["lobe","organism","surround"],"tints":["blue"],"densities":["compact","regular","roomy"]};
27554
27546
  static #components = (() => {
27555
27547
  const $m = {};
27556
27548
  $m["_tree.ts"] = (() => {
@@ -28015,8 +28007,8 @@ return { "lobe": $m["lobe.ts"].default, "organism": $m["organism.ts"].default, "
28015
28007
 
28016
28008
  static blueprint = {
28017
28009
  name: "nervur.floor-look",
28018
- version: "0.37.2",
28019
- assets: "fb3f6dbd54fcf45ee1f97b9abb2c9bdfbdcd219a7e64e7ec47b9d450714d7587",
28010
+ version: "0.37.3",
28011
+ assets: "c5490e1db5464b9b077ae0fff44c367afec74879e29f0dd6d1aa3f2d1cb01fa9",
28020
28012
  ...FloorLook.#rest(),
28021
28013
  };
28022
28014
 
@@ -28646,7 +28638,7 @@ var WINDOW2 = {
28646
28638
 
28647
28639
  var LONGEST_TIMEOUT = 1e4;
28648
28640
 
28649
- var INSTALLER_VERSION = "0.37.2";
28641
+ var INSTALLER_VERSION = "0.37.3";
28650
28642
 
28651
28643
  var ROAD = `installers@${INSTALLER_VERSION}`;
28652
28644
  var SKIN = { ...WINDOW2, road: ROAD };
@@ -31729,6 +31721,14 @@ var opfsUnlocker = (folder, chance) => ({
31729
31721
  admit: () => Promise.resolve(null)
31730
31722
  });
31731
31723
 
31724
+ var numbersOf2 = (version2) => version2.split(".").map(Number);
31725
+ var isOlder = (version2, than) => {
31726
+ if (version2 === null) return true;
31727
+ const [one, other] = [numbersOf2(version2), numbersOf2(than)];
31728
+ const at2 = one.findIndex((number, index) => number !== other[index]);
31729
+ return at2 !== -1 && (one[at2] ?? 0) < (other[at2] ?? 0);
31730
+ };
31731
+
31732
31732
  var isFields2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
31733
31733
  var decoder = new TextDecoder();
31734
31734
  var encoder = new TextEncoder();
@@ -31848,65 +31848,6 @@ var dressed = async (own3, read9) => {
31848
31848
  };
31849
31849
  };
31850
31850
 
31851
- var numbersOf2 = (version2) => version2.split(".").map(Number);
31852
- var isOlder = (version2, than) => {
31853
- if (version2 === null) return true;
31854
- const [one, other] = [numbersOf2(version2), numbersOf2(than)];
31855
- const at2 = one.findIndex((number, index) => number !== other[index]);
31856
- return at2 !== -1 && (one[at2] ?? 0) < (other[at2] ?? 0);
31857
- };
31858
-
31859
- var belowFloor = async (root2) => {
31860
- const last = await ranOn(root2);
31861
- return last !== null && isOlder(last, FLOOR) ? { below: `the store was last kept by ${last}` } : null;
31862
- };
31863
- var backupBelow = (kind, why) => (kind === "backup" || kind === "move") && why === BELOW_FLOOR ? { below: `the ${kind === "move" ? "move" : "backup"} laid was written by a genome` } : null;
31864
- var STOP = 1;
31865
- var isObject2 = (value) => typeof value === "object" && value !== null;
31866
- var wordsOf2 = (data, field = "why") => typeof data[field] === "string" ? data[field] : "it said no why";
31867
- var floorOpened = (spawn) => new Promise((done2) => {
31868
- const worker = spawn();
31869
- let settled3 = false;
31870
- const settle6 = (why) => {
31871
- if (settled3) return;
31872
- settled3 = true;
31873
- worker.end();
31874
- done2(why);
31875
- };
31876
- worker.failed((why) => settle6({ why }));
31877
- worker.hear((data) => {
31878
- if (!isObject2(data)) return;
31879
- if (data["id"] === STOP) {
31880
- const answer = data["answer"];
31881
- const error2 = isObject2(answer) ? answer["error"] : void 0;
31882
- settle6(isObject2(error2) ? { why: `its stop failed: ${wordsOf2(error2, "message")}` } : null);
31883
- return;
31884
- }
31885
- const { standing: standing5 } = data;
31886
- if (standing5 === "booted") worker.post({ id: STOP, stop: true });
31887
- else if (standing5 === "refused" || standing5 === "stopped") settle6({ why: wordsOf2(data) });
31888
- else if (standing5 === "unkept") settle6({ why: "it found no files of the site" });
31889
- else if (standing5 === "arriving") settle6({ why: "it found a store awaiting its move" });
31890
- });
31891
- });
31892
- var crossed = async (floor, what) => {
31893
- const below2 = `${what}, below the floor ${FLOOR}`;
31894
- const carried3 = await floor?.() ?? { why: "this build carries no floor" };
31895
- if ("why" in carried3) return { why: `${below2}, and ${carried3.why}` };
31896
- if (carried3.version !== FLOOR) return { why: `${below2}, and the build carries ${carried3.version} as its floor` };
31897
- const opened4 = await carried3.open();
31898
- return opened4 === null ? null : { why: `${below2}, which the floor's worker did not cross: ${opened4.why}` };
31899
- };
31900
- var throughFloor = async (floor, tick, once2, begun) => {
31901
- const first = await once2(begun, []);
31902
- if (first === void 0) return null;
31903
- const from = tick();
31904
- const crossing2 = await crossed(floor, first.below);
31905
- if (crossing2 !== null) return crossing2;
31906
- const again2 = await once2(tick(), [{ step: "floor", ms: Math.max(1, Math.round(tick() - from)) }]);
31907
- return again2 === void 0 ? null : { why: `the floor's worker left it below the floor ${FLOOR}: ${again2.below}` };
31908
- };
31909
-
31910
31851
  var RELATION2 = /^[a-z](?:[a-z0-9-]{0,62}[a-z0-9])?$/u;
31911
31852
  var relationsOf2 = async (askWindow) => {
31912
31853
  const answer = await askWindow("standings", {});
@@ -34321,11 +34262,10 @@ var screenHalf = (post = none, reaches2 = NOWHERE, tick = () => 0, said = SILENT
34321
34262
  };
34322
34263
  };
34323
34264
 
34324
- var stopwatch = (tick, begun, waited, crossed2) => {
34265
+ var stopwatch = (tick, begun, waited) => {
34325
34266
  const timings = [
34326
34267
  { step: "modules", ms: Math.max(1, Math.round(begun)) },
34327
- { step: "lock", ms: Math.max(1, Math.round(waited)) },
34328
- ...crossed2
34268
+ { step: "lock", ms: Math.max(1, Math.round(waited)) }
34329
34269
  ];
34330
34270
  const timed = async (step4, work) => {
34331
34271
  const from = tick();
@@ -34445,14 +34385,17 @@ var filesOf = async (env) => {
34445
34385
  return [];
34446
34386
  }
34447
34387
  };
34448
- var run2 = async (env, begun, waited, crossed2) => {
34449
- const { timings, timed } = stopwatch(env.tick, begun, waited, crossed2);
34388
+ var belowFloor = (what) => `${what}, below the floor ${FLOOR}, and this build carries no release but its own: open it with ${FLOOR} first`;
34389
+ var refusalOf3 = (kind, why) => (kind === "backup" || kind === "move") && why === BELOW_FLOOR ? belowFloor(`the ${kind} laid was written by a genome`) : why;
34390
+ var run2 = async (env, begun, waited) => {
34391
+ const { timings, timed } = stopwatch(env.tick, begun, waited);
34450
34392
  const [root2, store] = await filesOf(env);
34451
34393
  if (root2 === void 0 || store === void 0) return;
34452
34394
  const named7 = await initOf(env, root2, store);
34453
34395
  if (named7 === null) return;
34454
- const below2 = named7.kind === "boot" ? await belowFloor(root2) : null;
34455
- if (below2 !== null) return below2;
34396
+ const last = named7.kind === "boot" ? await ranOn(root2) : null;
34397
+ if (last !== null && isOlder(last, FLOOR))
34398
+ return env.post({ standing: "refused", why: belowFloor(`the store was last kept by ${last}`) });
34456
34399
  const worn2 = await timed("design", () => dressed(env.own, windowReader(env.quickjs)));
34457
34400
  let up2 = false;
34458
34401
  const half = screenHalf(
@@ -34476,7 +34419,7 @@ var run2 = async (env, begun, waited, crossed2) => {
34476
34419
  ended: ended5
34477
34420
  });
34478
34421
  const stood = await openedOn({ root: root2, store, init: named7, opening, timed });
34479
- if ("why" in stood) return backupBelow(named7.kind, stood.why) ?? env.post({ standing: "refused", why: stood.why });
34422
+ if ("why" in stood) return env.post({ standing: "refused", why: refusalOf3(named7.kind, stood.why) });
34480
34423
  const { opened: opened4, init } = stood;
34481
34424
  await laidKept(root2, init, opened4.door).catch(async (thrown2) => {
34482
34425
  await opened4.door.stop();
@@ -34489,18 +34432,16 @@ var run2 = async (env, begun, waited, crossed2) => {
34489
34432
  };
34490
34433
  var startOrganism2 = async (env) => {
34491
34434
  const begun = env.tick();
34492
- const once2 = (asked3, crossed2) => locked(env, () => run2(env, begun, env.tick() - asked3, crossed2));
34493
- const refused18 = await throughFloor(env.floor, env.tick, once2, begun).catch((thrown2) => ({
34494
- why: thrown2 instanceof Error ? thrown2.message : String(thrown2)
34495
- }));
34496
- if (refused18 !== null) env.post({ standing: "refused", why: refused18.why });
34435
+ await locked(env, () => run2(env, begun, env.tick() - begun)).catch(
34436
+ (thrown2) => env.post({ standing: "refused", why: thrown2 instanceof Error ? thrown2.message : String(thrown2) })
34437
+ );
34497
34438
  };
34498
34439
 
34499
- var isObject3 = (value) => typeof value === "object" && value !== null;
34440
+ var isObject2 = (value) => typeof value === "object" && value !== null;
34500
34441
  var storageOf = (scope) => {
34501
- const navigator = isObject3(scope) ? scope["navigator"] : void 0;
34502
- const storage = isObject3(navigator) ? navigator["storage"] : void 0;
34503
- return isObject3(storage) && "getDirectory" in storage && "estimate" in storage ? storageFrom(storage) : null;
34442
+ const navigator = isObject2(scope) ? scope["navigator"] : void 0;
34443
+ const storage = isObject2(navigator) ? navigator["storage"] : void 0;
34444
+ return isObject2(storage) && "getDirectory" in storage && "estimate" in storage ? storageFrom(storage) : null;
34504
34445
  };
34505
34446
  var storageFrom = (storage) => {
34506
34447
  const { getDirectory, estimate, persisted } = storage;
@@ -34513,7 +34454,7 @@ var storageFrom = (storage) => {
34513
34454
  },
34514
34455
  estimate: async () => {
34515
34456
  const found = await Reflect.apply(estimate, storage, []);
34516
- return isObject3(found) ? {
34457
+ return isObject2(found) ? {
34517
34458
  ...typeof found["usage"] === "number" ? { usage: found["usage"] } : {},
34518
34459
  ...typeof found["quota"] === "number" ? { quota: found["quota"] } : {}
34519
34460
  } : {};
@@ -34521,18 +34462,18 @@ var storageFrom = (storage) => {
34521
34462
  persisted: async () => typeof persisted === "function" && await Reflect.apply(persisted, storage, []) === true
34522
34463
  };
34523
34464
  };
34524
- var isFolder = (value) => isObject3(value) && value["kind"] === "directory" && typeof value["getFileHandle"] === "function" && typeof value["getDirectoryHandle"] === "function" && typeof value["removeEntry"] === "function" && typeof value["values"] === "function";
34465
+ var isFolder = (value) => isObject2(value) && value["kind"] === "directory" && typeof value["getFileHandle"] === "function" && typeof value["getDirectoryHandle"] === "function" && typeof value["removeEntry"] === "function" && typeof value["values"] === "function";
34525
34466
 
34526
- var isObject4 = (value) => typeof value === "object" && value !== null;
34467
+ var isObject3 = (value) => typeof value === "object" && value !== null;
34527
34468
  var NAME3 = "nervur-design";
34528
34469
  var at = (digest) => `https://kept.invalid/${digest}`;
34529
34470
  var openerOf = (storage) => {
34530
- const open2 = isObject4(storage) ? storage["open"] : void 0;
34471
+ const open2 = isObject3(storage) ? storage["open"] : void 0;
34531
34472
  if (typeof open2 !== "function") return null;
34532
34473
  return async () => {
34533
34474
  try {
34534
34475
  const cache = await Reflect.apply(open2, storage, [NAME3]);
34535
- if (!isObject4(cache)) return null;
34476
+ if (!isObject3(cache)) return null;
34536
34477
  const call = (name2, args) => {
34537
34478
  const one = cache[name2];
34538
34479
  return typeof one === "function" ? Promise.resolve(Reflect.apply(one, cache, args)) : Promise.reject(new Error(name2));
@@ -34573,18 +34514,18 @@ var keptIn3 = (storage) => {
34573
34514
  if (cache === null || !Array.isArray(keys)) return;
34574
34515
  const named7 = new Set(digests.map(at));
34575
34516
  for (const key2 of keys)
34576
- if (isObject4(key2) && typeof key2["url"] === "string" && !named7.has(key2["url"])) await cache.delete(key2);
34517
+ if (isObject3(key2) && typeof key2["url"] === "string" && !named7.has(key2["url"])) await cache.delete(key2);
34577
34518
  } catch {
34578
34519
  }
34579
34520
  }
34580
34521
  };
34581
34522
  };
34582
34523
 
34583
- var isObject5 = (value) => typeof value === "object" && value !== null;
34524
+ var isObject4 = (value) => typeof value === "object" && value !== null;
34584
34525
  var locksOf = (navigator) => {
34585
34526
  const { locks } = navigator;
34586
- const request2 = isObject5(locks) ? locks["request"] : void 0;
34587
- if (!isObject5(locks) || typeof request2 !== "function") return null;
34527
+ const request2 = isObject4(locks) ? locks["request"] : void 0;
34528
+ if (!isObject4(locks) || typeof request2 !== "function") return null;
34588
34529
  const call = (name2, options, run3) => Reflect.apply(request2, locks, [name2, options, run3]);
34589
34530
  return {
34590
34531
  request: (name2, options, run3) => call(name2, options, run3),
@@ -34594,7 +34535,6 @@ var locksOf = (navigator) => {
34594
34535
  var SQLITE = "sqlite3.wasm";
34595
34536
  var QUICKJS = "emscripten-module.wasm";
34596
34537
  var PAGE7 = "page.js";
34597
- var FLOOR2 = "floor.json";
34598
34538
  var textOf7 = async (url2) => {
34599
34539
  try {
34600
34540
  const response2 = await fetch(url2, { redirect: "error", credentials: "omit", cache: "no-store" });
@@ -34660,49 +34600,16 @@ var ownOf = (url2, caches) => ({
34660
34600
  domain: new URL(url2).hostname,
34661
34601
  kept: keptIn3(caches)
34662
34602
  });
34663
- var spawnedOf = (Worker, at2) => {
34664
- const worker = Reflect.construct(Worker, [at2, { type: "module" }]);
34665
- const call = (method3, args) => {
34666
- const found = isObject5(worker) ? Reflect.get(worker, method3) : void 0;
34667
- if (typeof found === "function") Reflect.apply(found, worker, args);
34668
- };
34669
- return {
34670
- hear: (heard3) => call("addEventListener", ["message", (event) => heard3(isObject5(event) ? event["data"] : null)]),
34671
- failed: (heard3) => call("addEventListener", [
34672
- "error",
34673
- (event) => {
34674
- const message = isObject5(event) ? event["message"] : void 0;
34675
- heard3(typeof message === "string" && message !== "" ? message : `its worker at ${at2.pathname} did not run`);
34676
- }
34677
- ]),
34678
- post: (message) => call("postMessage", [message]),
34679
- end: () => call("terminate", [])
34680
- };
34681
- };
34682
- var floorOf = (scope, url2) => async () => {
34683
- const { Worker } = scope;
34684
- if (typeof Worker !== "function") return { why: "this browser starts no worker inside a worker" };
34685
- const said = await fetch(new URL(FLOOR2, url2), {
34686
- redirect: "error",
34687
- credentials: "omit",
34688
- cache: "force-cache"
34689
- }).then((response2) => response2.ok ? response2.json() : null).catch(() => null);
34690
- if (said === null) return { why: "this build carries no floor" };
34691
- if (!isObject5(said) || typeof said["version"] !== "string" || typeof said["worker"] !== "string")
34692
- return { why: `the installer's ${FLOOR2} names no floor` };
34693
- const at2 = new URL(said["worker"], url2);
34694
- return { version: said["version"], open: () => floorOpened(() => spawnedOf(Worker, at2)) };
34695
- };
34696
34603
  var tickOf = (clock) => {
34697
- const now = isObject5(clock) ? clock["now"] : void 0;
34604
+ const now = isObject4(clock) ? clock["now"] : void 0;
34698
34605
  const read9 = typeof now === "function" ? Reflect.apply(now, clock, []) : 0;
34699
34606
  return typeof read9 === "number" ? read9 : 0;
34700
34607
  };
34701
34608
  var scopeOf = (scope, url2, given2) => {
34702
- if (!isObject5(scope)) return null;
34609
+ if (!isObject4(scope)) return null;
34703
34610
  const { navigator, postMessage, addEventListener } = scope;
34704
34611
  const storage = given2?.storage ?? storageOf(scope);
34705
- const locks = given2?.locks ?? (isObject5(navigator) ? locksOf(navigator) : null);
34612
+ const locks = given2?.locks ?? (isObject4(navigator) ? locksOf(navigator) : null);
34706
34613
  if (storage === null || locks === null || typeof postMessage !== "function" || typeof addEventListener !== "function")
34707
34614
  return null;
34708
34615
  const hashes = new Map();
@@ -34717,7 +34624,6 @@ var scopeOf = (scope, url2, given2) => {
34717
34624
  digest: () => folderDigest(hashes, url2),
34718
34625
  vouch: (domain) => textOf7(`${new URL(url2).protocol === "http:" ? "http" : "https"}://${domain}/.well-known/quo`),
34719
34626
  own: ownOf(url2, scope["caches"]),
34720
- floor: floorOf(scope, url2),
34721
34627
  now: () => ( new Date()).toISOString(),
34722
34628
  performance: scope["performance"],
34723
34629
  tick: () => tickOf(scope["performance"]),
@@ -34727,7 +34633,7 @@ var scopeOf = (scope, url2, given2) => {
34727
34633
  },
34728
34634
  hear: (heard3) => void Reflect.apply(addEventListener, scope, [
34729
34635
  "message",
34730
- (event) => heard3(isObject5(event) ? event["data"] : null)
34636
+ (event) => heard3(isObject4(event) ? event["data"] : null)
34731
34637
  ])
34732
34638
  };
34733
34639
  };
@@ -34767,16 +34673,16 @@ var lineOf2 = (name2) => {
34767
34673
  listen: (heard3) => channel.addEventListener("message", (event) => heard3(Reflect.get(event, "data")))
34768
34674
  };
34769
34675
  };
34770
- var isObject6 = (value) => typeof value === "object" && value !== null;
34676
+ var isObject5 = (value) => typeof value === "object" && value !== null;
34771
34677
  var askedOver = (line2) => {
34772
34678
  const waiting = new Map();
34773
34679
  let next = 0;
34774
34680
  line2.listen((data) => {
34775
- if (!isObject6(data) || typeof data["answered"] !== "number") return;
34681
+ if (!isObject5(data) || typeof data["answered"] !== "number") return;
34776
34682
  const waiter = waiting.get(data["answered"]);
34777
34683
  waiting.delete(data["answered"]);
34778
34684
  if (typeof data["why"] === "string") waiter?.fail(new Error(data["why"]));
34779
- else waiter?.done(isObject6(data["result"]) ? data["result"] : {});
34685
+ else waiter?.done(isObject5(data["result"]) ? data["result"] : {});
34780
34686
  });
34781
34687
  return (method3, args = {}) => new Promise((done2, fail) => {
34782
34688
  next += 1;
@@ -34925,19 +34831,19 @@ var nativeStorage = (native) => ({
34925
34831
  persisted: () => Promise.resolve(true)
34926
34832
  });
34927
34833
 
34928
- var isObject7 = (value) => typeof value === "object" && value !== null;
34834
+ var isObject6 = (value) => typeof value === "object" && value !== null;
34929
34835
  var dataOf2 = (value) => JSON.parse(JSON.stringify(value));
34930
34836
  var broughtIn = (text7) => {
34931
34837
  if (text7 === null) return [];
34932
34838
  const read9 = JSON.parse(text7);
34933
34839
  if (!Array.isArray(read9)) return [];
34934
34840
  return read9.flatMap(
34935
- (one) => isObject7(one) && typeof one["plugin"] === "string" && typeof one["digest"] === "string" && isObject7(one["blueprint"]) ? [{ plugin: one["plugin"], digest: one["digest"], blueprint: dataOf2(one["blueprint"]) }] : []
34841
+ (one) => isObject6(one) && typeof one["plugin"] === "string" && typeof one["digest"] === "string" && isObject6(one["blueprint"]) ? [{ plugin: one["plugin"], digest: one["digest"], blueprint: dataOf2(one["blueprint"]) }] : []
34936
34842
  );
34937
34843
  };
34938
34844
  var answerOf6 = async (native, plugin, ask, method3, args) => {
34939
34845
  try {
34940
- const result2 = await native("organ", { plugin, method: method3, args: isObject7(args) ? args : {} });
34846
+ const result2 = await native("organ", { plugin, method: method3, args: isObject6(args) ? args : {} });
34941
34847
  return { answer: ask, result: dataOf2(result2) };
34942
34848
  } catch (thrown2) {
34943
34849
  return {