@quo-systems/quo 0.1.1 → 0.2.0

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.
Files changed (46) hide show
  1. package/SPEC.md +185 -114
  2. package/dist/being/index.d.ts +1 -1
  3. package/dist/being/index.js +1 -1
  4. package/dist/being/silence.d.ts +6 -1
  5. package/dist/being/silence.js +25 -7
  6. package/dist/being/types.d.ts +8 -4
  7. package/dist/being/types.js +1 -1
  8. package/dist/conformance/beings.d.ts +1 -1
  9. package/dist/conformance/beings.js +5 -5
  10. package/dist/conformance/estate.js +12 -6
  11. package/dist/conformance/index.js +14 -12
  12. package/dist/harbor/core.d.ts +6 -1
  13. package/dist/harbor/core.js +11 -2
  14. package/dist/harbor/memory.d.ts +5 -1
  15. package/dist/harbor/memory.js +7 -2
  16. package/dist/ward/door.d.ts +6 -2
  17. package/dist/ward/door.js +55 -35
  18. package/dist/ward/ground.d.ts +4 -1
  19. package/dist/ward/heirs.d.ts +4 -2
  20. package/dist/ward/heirs.js +20 -3
  21. package/dist/ward/owner.js +6 -4
  22. package/dist/ward/partition.d.ts +6 -0
  23. package/dist/ward/partition.js +2 -0
  24. package/dist/ward/seal.d.ts +3 -1
  25. package/dist/ward/seal.js +6 -2
  26. package/dist/ward/stance.d.ts +2 -2
  27. package/dist/ward/stance.js +21 -12
  28. package/dist/ward/ward.js +7 -7
  29. package/package.json +19 -31
  30. package/src/being/index.ts +1 -1
  31. package/src/being/silence.ts +26 -8
  32. package/src/being/types.ts +13 -3
  33. package/src/conformance/beings.ts +5 -5
  34. package/src/conformance/estate.ts +11 -6
  35. package/src/conformance/index.ts +14 -12
  36. package/src/harbor/core.ts +11 -2
  37. package/src/harbor/memory.ts +6 -1
  38. package/src/ward/door.ts +54 -32
  39. package/src/ward/ground.ts +6 -2
  40. package/src/ward/heirs.ts +20 -5
  41. package/src/ward/owner.ts +4 -3
  42. package/src/ward/partition.ts +10 -0
  43. package/src/ward/seal.ts +8 -5
  44. package/src/ward/stance.ts +20 -14
  45. package/src/ward/ward.ts +9 -9
  46. package/vectors/framing.json +7 -1
package/SPEC.md CHANGED
@@ -94,9 +94,13 @@ gap in Quo or a leak into the ward. The shape is `Ground` in
94
94
 
95
95
  Returned:
96
96
 
97
- - **The door.** One call: sealed bytes in, sealed bytes out. Always bytes:
97
+ - **The door.** One call: sealed bytes in, sealed bytes out, and one bit
98
+ beside them, `heard`: whether a key this door holds spoke. Always bytes:
98
99
  when the ask did not open, the reply is silence sealed to whatever ephemeral
99
- pk the bytes carried, and noise when they carried none.
100
+ pk the bytes carried, and noise when they carried none. The bit is all a
101
+ harbor learns from an arrival, never a reason: a pk that only ever brings
102
+ strangers' bytes is the harbor's to rate or refuse, and what a bound key
103
+ hears is sealed to its own lid.
100
104
  - **The ask.** One call: method and args in, object or silence out.
101
105
  In-process and unsealed. This is the one unsealed ask in Quo, and the only
102
106
  way a ward is piloted. Judgment, catching, and the return table are not
@@ -132,10 +136,10 @@ stance
132
136
  occupants.invite(id) -> invitation | null awaitable: a key is minted
133
137
  occupants.remove(id) -> nothing
134
138
 
135
- standings.knock(invitation, method?, args?, wanted?) -> object | silence | unreached
139
+ standings.knock(invitation, method?, args?, wanted?) -> object | silence | word
136
140
  standings.take(id, invitation) -> id | null awaitable: it waits for the relation
137
141
  standings[id] -> standing | undefined
138
- standings[id].ask(method?, args?, wanted?) -> object | silence | unreached
142
+ standings[id].ask(method?, args?, wanted?) -> object | silence | word
139
143
  standings.remove(id) -> nothing
140
144
 
141
145
  wanted = { time? } what this one ask may spend, in milliseconds. optional,
@@ -150,16 +154,16 @@ Return table.
150
154
  | | null | the id already names a record, occupant or standing, or is a reserved word |
151
155
  | remove(id) | nothing | always. removing what is not there is nothing |
152
156
  | knock(inv, m, a, w) | object | the far being answered |
153
- | | silence | no ward claims the invitation, or she removed the id, or another consumed it, or the far being chose silence |
154
- | | | or the invitation is not one, or the wait ran out |
155
- | | unreached | her ward could not reach the far door, or could not seal the args |
157
+ | | silence | no ward claims the invitation, or another consumed it, or the far being chose silence |
158
+ | | word | why not, when the far door or her own ward can say: removed, absent, unannounced, repeated, |
159
+ | | | threw, unreached, late, invitation. see "Silence, the words, error" |
156
160
  | take(id, inv) | id | she knocked with this invitation and was answered, and the id is fresh |
157
161
  | | null | no answered knock on this invitation, or the id already names a record, or is a reserved word |
158
162
  | standings[id] | standing | the record exists |
159
163
  | | undefined | it does not. not an error |
160
164
  | ask(m, a, w) | object | she answered |
161
- | | silence | she, or her ward, said nothing; or the wait ran out |
162
- | | unreached | her ward could not reach the far door, or could not seal the args |
165
+ | | silence | she chose to say nothing, or bytes came back that are not Quo's |
166
+ | | word | why not: removed, absent, repeated, threw, unreached, late, dropped |
163
167
 
164
168
  Ask, knock, invite and take are awaitable. Async where the language has it,
165
169
  blocking where it does not. Every ask she makes is a new call.
@@ -175,16 +179,19 @@ The asker has three shapes and no fourth, and nothing else ever reaches her.
175
179
  `OWNER` and `PUBLIC` are reserved words: invite and take refuse them, so no
176
180
  occupant can ever wear either name.
177
181
 
178
- ## Silence, unreached, error
182
+ ## Silence, the words, error
179
183
 
180
- Three words for "no object came back", and only three. Everything in Quo
181
- that can go wrong ends in one of them, and a being who knows the three never
182
- needs a fourth.
184
+ Three kinds of answer to "no object came back", and only three. Everything in
185
+ Quo that can go wrong ends in one of them, and a being who knows the three
186
+ never needs a fourth.
183
187
 
184
188
  ```
185
189
  error an object. hers. { error: ... }, or any shape her output schema declares.
186
- silence the ward's word. heard. bytes came back, or would have, and said nothing.
187
- unreached the ward's word. not heard. nothing came back. nothing is known to have been delivered.
190
+ silence the ward's silence. bytes came back, or would have, and said nothing.
191
+ it is what a stranger hears, and what she hears when
192
+ the far being chose to say nothing.
193
+ a word the ward's word. one of nine, said only to someone the ward can name,
194
+ and never to a stranger: why no object came.
188
195
  ```
189
196
 
190
197
  - An **error** is an ordinary answer. Quo never reads it, never makes it,
@@ -192,42 +199,75 @@ unreached the ward's word. not heard. nothing came back. nothing is known to
192
199
  `{ error: 'unknown ask' }` for an ask she did not declare or hid; the
193
200
  owner's asks answer error objects for what they refuse; both are hers to
194
201
  read like any object.
195
- - **Silence** is not blindly retryable: the far being may have done the work
196
- and the answer was lost.
202
+ - **Silence** names no reason, by law. It is what the door says to bytes it
203
+ cannot admit, so that a stranger learns nothing, and what a being says
204
+ when she chooses to say nothing. It is not blindly retryable: the far
205
+ being may have done the work and the answer was lost.
206
+ - **A word** names the reason. It is said to a key the door has bound, sealed
207
+ to that key's lid, or by her own ward to her, in process. Nobody else ever
208
+ hears one. A word is not an object: it carries nothing but its name, a
209
+ being cannot make one, and one that comes out of a being is read as her
210
+ having thrown.
211
+
212
+ The nine words, and who says them:
213
+
214
+ ```
215
+ the door, to a key it has bound, on the wire as { quo: word }
216
+ removed the relation this key spoke for was removed by the being who invited it
217
+ absent the being who invited it did not come back this run; her cells wait
218
+ unannounced the knock announced no key of her own, so it bound nothing
219
+ repeated the number was already honoured, or is at or below the span
220
+ threw she threw, or answered a shape that is not hers to make
221
+
222
+ her own ward, to her, and never on the wire
223
+ unreached no far door was reached. nothing is known to have been delivered.
224
+ late the wait ran out. the far door may have heard and be working still.
225
+ invitation the invitation is not one. nothing was sent.
226
+ dropped she dropped the standing, and asked on what she held. nothing was sent.
227
+ ```
228
+
197
229
  - **Unreached** is safe to retry: nothing is known to have been delivered.
198
- It carries no reason. What she may know is that nothing came back, and
199
- that is all. In one case the far ward heard and died before it could
200
- answer, and the wire says nothing about it; asking again asks under the
201
- next number and is heard, so the retry is safe all the same. See Closed.
202
-
203
- Who says what. A being says objects and silence, never unreached: the shape
204
- is the ward's, and a ward that sees it come out of a being reads it as
205
- silence. A ward says all three to its own being, and only objects and
206
- silence on the wire: unreached never crosses, it is the wire's nothing
207
- turned into a word. A harbor says nothing at all; it returns bytes or
208
- nothing, and does not know the word silence. The owner hears objects: a
209
- silence a being met is `{ error: 'silence' }` and an unreached is
210
- `{ error: 'unreached' }`, because the owner is piloting and an object is
230
+ In one case the far ward heard and died before it could answer, and the
231
+ wire says nothing about it; asking again asks under the next number and
232
+ is heard, so the retry is safe all the same. See Closed.
233
+ - **Late** is not unreached, and the difference is the whole reason there are
234
+ two words: a bound that expired promises nothing about delivery.
235
+ - **Removed**, **absent**, **unannounced** and **repeated** are refusals: the
236
+ ask reached no being and nothing was written. They are said only because
237
+ the key that asked has already proven who it is, so a reason to it is an
238
+ oracle to nobody. **Threw** is a choice: she was reached, and the number is
239
+ spent.
240
+
241
+ Who says what. A being says objects and silence, never a word: the shape is
242
+ the ward's, and a ward that sees one come out of a being answers `threw`. A
243
+ ward says all three to its own being, and on the wire objects, silence and
244
+ the five door words, each sealed to the lid of the key that asked; the four
245
+ ward words never cross, they are her own ward's and are said in process. A
246
+ harbor says nothing at all; it returns bytes or nothing, and does not know
247
+ any of these words. What it learns from an arrival is one bit, `heard`,
248
+ beside the bytes the door hands it: whether a key the door holds spoke. The
249
+ owner hears objects: a silence a being met is `{ error: 'silence' }` and a
250
+ word is `{ error: word }`, because the owner is piloting and an object is
211
251
  what a shell can print. The ask pointer answers the value silence only when
212
252
  the ward itself threw.
213
253
 
214
- ### What her ward turns into silence
254
+ ### What her ward says to her
215
255
 
216
- Before or after the wire, her own ward answers silence in five cases, and
217
- tells her nothing about which.
256
+ Before or after the wire, her own ward answers on its own in five cases,
257
+ and each says what it is.
218
258
 
219
259
  ```
220
260
  S1 the invitation is not one a shape that is not a ward pk, a heir with no secret, a secret with no heir.
221
- nothing is sent.
261
+ nothing is sent. the word is `invitation`.
222
262
  S2 the standing is gone she held a standing, dropped it, and asked on what she held.
223
- nothing is sent. an ask issued while it stood is answered.
263
+ nothing is sent. an ask issued while it stood is answered. the word is `dropped`.
224
264
  S3 the wait ran out the ask's time was spent and no reply was read.
225
265
  what comes back late is not read. the number is spent.
226
- an ask still waiting at its lane when the wait ran out is never sent.
266
+ an ask still waiting at its lane when the wait ran out is never sent. the word is `late`.
227
267
  S4 the reply is not one bytes came back that do not open, or are not signed by the ward they
228
- were sent to, or are not `{ silence }` nor `{ object, seen }` with an
229
- object present and seen a digest or null. the number is spent.
230
- S5 the far door said silence every case in the next list.
268
+ were sent to, or are none of the three reply shapes. the number is spent.
269
+ not Quo's bytes: silence.
270
+ S5 the far door answered silence, or a word, exactly as the door said it.
231
271
  ```
232
272
 
233
273
  And unreached in two: `U1` the args are not a value, or could not be
@@ -236,69 +276,83 @@ sealed, so nothing left;
236
276
  taken all the same, and the gap it leaves in the count is harmless: the door
237
277
  honours any number above its mark.
238
278
 
239
- ### What the door turns into silence
279
+ ### What the door says
240
280
 
241
- The door answers one silence in thirteen cases. The first ten are refusals:
242
- the ask reached no being, and nothing was written, spent, rotated or
243
- touched. The last three are choices: the ask reached her, so the number is
244
- spent and the keys are rotated, and what she wrote in her cells is hers.
281
+ The door judges thirteen cases, in this order, and the first case met is
282
+ the answer. The first seven are strangers: bytes the door cannot admit, met
283
+ with one silence whatever the case, and nothing written. The next three are
284
+ refusals to a key the door has bound: still nothing written, but a word,
285
+ because the asker has proven who it is. The last three are choices: the ask
286
+ reached her, so the number is spent and the keys are rotated, and what she
287
+ wrote in her cells is hers.
245
288
 
246
289
  ```
247
- refusals
290
+ strangers: silence, nothing written, heard false
248
291
  D1 the box does not open wrong padlock, garbage, too short. the reply is sealed to the lid if
249
292
  the bytes carried one, and is noise otherwise. a lid that will not
250
293
  take a seal, a small-order point, is no lid: noise.
251
294
  D2 the payload is malformed by or next not 64 hex, method not a string, args not an object, seq
252
- below one, time not a whole number above zero.
295
+ below one, time not a whole number above zero, hops not a whole
296
+ number or at zero.
253
297
  D3 for nobody, and nobody is home no public being on this ward.
254
298
  D4 for nobody, signature fails the payload names a key it was not signed with.
255
- D5 the heir is not held never minted here, or forgotten because the id was removed.
299
+ D5 the heir is not held never minted here, and not one she removed either.
256
300
  D6 the key is not admitted not the key held for the heir, and not the key it announced. a
257
- forged key, an unannounced key, a heir already spent.
258
- D7 she is not there the occupant record is gone, or the being did not come back this run.
259
- D8 signature fails under an admitted key.
260
- D9 a knock announces nothing the heir is fresh and next is null. it binds nothing.
261
- D10 the number is refused already honoured, or at or below the span.
262
- choices
263
- D11 she threw
301
+ forged key, an unannounced key, a heir already spent. a heir she
302
+ removed, under a key that was not the one she removed.
303
+ D7 signature fails under an admitted key, or under the key held for a heir she removed.
304
+ refusals to a bound key: a word, nothing written, heard true
305
+ D8 she is not there `removed`: the occupant record is gone, and this is the key it was
306
+ bound to when it went. `absent`: the being did not come back this run.
307
+ D9 a knock announces nothing `unannounced`: the heir is fresh and next is null. it binds nothing.
308
+ D10 the number is refused `repeated`: already honoured, or at or below the span.
309
+ choices: the number spent, the keys rotated, heard true
310
+ D11 she threw `threw`
264
311
  D12 she answered silence on a named ask, or on the empty ask. nothing at all is silence too.
265
- D13 she answered an unreached shape
312
+ D13 she answered a word `threw`: a word is not hers to make.
266
313
  ```
267
314
 
268
- A refusal is judged in that order, and the first case met is the answer.
269
- The signature is verified before the number is spent, so a stranger cannot
270
- burn a number she could not sign for; a refusal at D9 or D10 has passed the
271
- signature and still writes nothing.
315
+ The signature is verified before anything is written and before any word is
316
+ said, so a stranger cannot burn a number she could not sign for and cannot
317
+ hear a word she could not sign for. The public being is asked by strangers
318
+ only, and a stranger hears silence for whatever she then does: her choices
319
+ are hers, and her insides are not a stranger's to read.
320
+
321
+ A removed relation leaves the door one thing: the keys it held for that
322
+ heir when the id went, kept apart from the heirs under `gone` in the
323
+ partition, bounded, oldest out. That is what lets the door say `removed` to
324
+ the one party who can sign as those keys, and silence to everyone else.
325
+ Nothing else survives a removal.
272
326
 
273
327
  ### The law of one silence
274
328
 
275
- 1. Every case above is one reply: `{ silence: true }`, sealed to the lid the
276
- ask came with, signed by the ward key. Same bytes, same length. A
277
- stranger cannot tell a refusal from a choice, nor one refusal from
278
- another, nor any of them from a being who chose to say nothing.
329
+ 1. Every stranger's case is one reply: `{ silence: true }`, sealed to the
330
+ lid the ask came with, signed by the ward key. Same bytes, same length.
331
+ A stranger cannot tell one refusal from another, nor any of them from a
332
+ being who chose to say nothing.
279
333
  The door equalizes the bytes and not the time it took to write them. The
280
- ten refusals are cheap and alike; a choice ran a being first, and a being
281
- is code this document does not bound. So whoever holds a standing may
282
- learn from a clock that she was reached and said nothing, rather than
283
- refused at the door. A stranger holds no standing and reaches no choice,
284
- which is why the refusals are the ones made alike. Equalizing the time
285
- would mean waiting out the allowance ceiling on every silence, and the
286
- door will not buy that.
334
+ seven cases are cheap and alike. A word, to a key the door has bound, is
335
+ another length, and may be: whoever hears it has already proven who they
336
+ are.
287
337
  2. A refusal writes nothing. No number, no key, no heir, no cell, no bind.
288
338
  The same bytes presented again meet the same refusal, and a stranger who
289
- knocks a thousand times leaves no mark.
339
+ knocks a thousand times leaves no mark. This holds for the three
340
+ refusals a bound key hears just the same: a word costs nothing.
290
341
  3. A choice writes what a heard ask writes. The number is spent and the keys
291
342
  rotate, so the relation goes on: the next ask on it is answered, and a
292
- silence never kills a standing.
293
- 4. Silence leaves the caller's record as it was. A silent named answer
294
- leaves `seen` untouched; a silent empty ask leaves `blueprint` and
295
- `digest` untouched.
296
- 5. Her ward never confuses her. Silence and unreached are told apart
297
- always, and by nothing else: silence is bytes the far ward wrote, or a
298
- bound her ward rang; unreached is the wire's nothing. A ward never
299
- answers nothing, so that nothing always means unreached.
300
- 6. Nobody enforces what a being does with silence. It is one value she
301
- compares against, and the base class hands it to her unchanged.
343
+ silence or a `threw` never kills a standing.
344
+ 4. Silence and a word leave the caller's record as it was. A silent named
345
+ answer leaves `seen` untouched; a silent empty ask leaves `blueprint` and
346
+ `digest` untouched; a word moves neither, and her keys do not rotate on
347
+ one.
348
+ 5. Her ward never confuses her. Silence, a word and unreached are told apart
349
+ always, and by nothing else: silence is bytes the far ward wrote and
350
+ chose to say nothing with; a word is a reason, from the far door or her
351
+ own ward; unreached is the wire's nothing. A ward never answers nothing,
352
+ so that nothing always means unreached.
353
+ 6. Nobody enforces what a being does with silence or a word. Each is one
354
+ value she compares against, and the base class hands them to her
355
+ unchanged.
302
356
 
303
357
  `test/silence.test.ts` asserts every numbered line above, by its number.
304
358
 
@@ -324,15 +378,17 @@ nothing was written down that a harbor would later have to lie about. This
324
378
  holds all the way down: a container read through her cells is part of her
325
379
  cells. The guard is `src/ward/cells.ts`.
326
380
 
327
- ### Silence and unreached
381
+ ### Silence and the words
328
382
 
329
- Two of the three words for "no object came back". The chapter "Silence,
330
- unreached, error" is the whole of them; here only the values. Silence is one
331
- distinguished value. Null is an answer. Unreached is a second distinguished
332
- value, her ward's own word. Neither is an object, and neither carries
333
- anything. In this kit silence is the symbol `quo.silence` and unreached is a
334
- frozen object under the symbol key `quo.unreached`, both from
335
- `src/being/silence.ts`.
383
+ Two of the three kinds of "no object came back". The chapter "Silence, the
384
+ words, error" is the whole of them; here only the values. Silence is one
385
+ distinguished value. Null is an answer. A word is a second kind of
386
+ distinguished value, her ward's own, nine of them, `unreached` among them.
387
+ None is an object, and none carries anything but its name. In this kit
388
+ silence is the symbol `quo.silence` and a word is a frozen object under the
389
+ symbol key `quo.word` holding its name, both from `src/being/silence.ts`;
390
+ `isWord` and `wordOf` read them, and `isUnreached` is the one word a being
391
+ asks about most.
336
392
 
337
393
  ### Blueprint, schema, digest
338
394
 
@@ -670,13 +726,15 @@ Every arrival is judged by the door, and named by it or falls silent.
670
726
  2. For nobody: find the public being, verify the signature under the key the
671
727
  payload names, and dispatch as `{}`. Nothing is written.
672
728
  3. For a heir: admit the signer if it is the key held for that heir or the
673
- key that key announced. Find the being who minted the id and check she
674
- still holds the occupant. Verify the signature. Only then spend the
675
- number and settle the keys, so a stranger cannot burn a number she could
676
- not sign for, and the same bytes twice rotate nothing. Dispatch as
677
- `{ id }`.
678
- 4. Catch every throw and answer silence. Treat an unreached shape coming out
679
- of a being as silence.
729
+ key that key announced, or the key held when she removed the id. Verify
730
+ the signature. Only then say anything or write anything: a removed
731
+ relation is `removed`, a being not back this run is `absent`, a knock
732
+ with no key is `unannounced`, a number already honoured is `repeated`,
733
+ and none of those writes. Else spend the number and settle the keys, so
734
+ a stranger cannot burn a number she could not sign for, and the same
735
+ bytes twice rotate nothing. Dispatch as `{ id }`.
736
+ 4. Catch every throw and answer `threw` to a bound key, silence at the
737
+ public being. Treat a word coming out of a being as a throw.
680
738
  5. On every answered named ask, run her describe for that asker in process,
681
739
  hash it, and put the digest next to the object in the reply. One trip. A
682
740
  describe that throws or falls silent costs the digest and nothing else.
@@ -684,7 +742,7 @@ Every arrival is judged by the door, and named by it or falls silent.
684
742
  6. Answer by the same call the ask came in on.
685
743
 
686
744
  A stranger is bytes the ward cannot admit, and every way of being one is
687
- listed, with a number, under "Silence, unreached, error". The public being
745
+ listed, with a number, under "Silence, the words, error". The public being
688
746
  is the one door a stranger may walk through, and only because she chose it.
689
747
 
690
748
  ### Inner and outer
@@ -729,7 +787,8 @@ ask on the wire box = ephemeral X25519 pk (32) || AES-GCM( payload || si
729
787
  refused at zero, and nothing sets it.
730
788
  reply on the wire box = ephemeral X25519 pk (32) || AES-GCM( reply || signature (64) )
731
789
  sealed to the ask's ephemeral pk, signed by the ward key
732
- reply = JSON { object, seen } | { silence: true }
790
+ reply = JSON { object, seen } | { silence: true } | { quo: word }
791
+ word: removed | absent | unannounced | repeated | threw. only to a key the door bound.
733
792
  ```
734
793
 
735
794
  Nothing rides outside the box, and `to` is the reason to say so. A heir is
@@ -819,6 +878,8 @@ partition
819
878
  answered <ward>:<heir> | public:<ward> -> true knocked and answered
820
879
  minted the last eight pks her side minted
821
880
  heirs heir pk -> { being, id, current, announced, fresh, mark, spent } the door's view of every occupant
881
+ gone heir pk -> { current, announced } the keys held when an id was removed, bounded, so their
882
+ holder hears `removed` and nobody else hears a thing
822
883
  public the one public being's key, or null
823
884
  ```
824
885
 
@@ -852,8 +913,9 @@ before the restart can be taken after it; a door that restarts still refuses
852
913
  what it already honoured.
853
914
 
854
915
  A constructor that throws on a restart takes only herself down: she is
855
- absent this run, no door, so silence at her door, and her cells sit untouched
856
- waiting for the run that can read them. The ward is up and so is everyone
916
+ absent this run, no door, so `absent` at her door to the keys she bound and
917
+ silence to strangers, and her cells sit untouched waiting for the run that
918
+ can read them. The ward is up and so is everyone
857
919
  else. A class the harbor no longer knows is the same absence, and so is a
858
920
  class the harbor holds at a body the cells were not written for: which body
859
921
  a ward reboots on is the harbor's decision, and a ward cannot tell an old
@@ -972,7 +1034,8 @@ Not stressed with:
972
1034
  from nothing else. There is no estate. The far being is sovereign: she may
973
1035
  fall silent on the ask after the knock, and nobody is told.
974
1036
  - Blacklists, rate limits, and what to do with a pk that keeps knocking with
975
- garbage. Its own.
1037
+ garbage. The door says `heard` or not beside every reply; the rest is the
1038
+ harbor's.
976
1039
 
977
1040
  ## The harbor
978
1041
 
@@ -1004,7 +1067,9 @@ The harbor:
1004
1067
  never answers nothing on its own patience; it waits, and the ward's bound
1005
1068
  ends the ask.
1006
1069
  - Receives bytes from the wire for a ward pk it holds, hands them to that
1007
- one door, and returns what the door returned.
1070
+ one door, and returns what the door returned. Beside the bytes the door
1071
+ says whether a key it holds spoke; the harbor may count that per pk and
1072
+ act on it, and learns nothing more.
1008
1073
  - Vouches: the seed stays secret, the partition is reached by this ward
1009
1074
  alone, the ask reaches its root owner alone, the device is the harbor's
1010
1075
  to defend. How is the device's business. Custody is this vouch: two
@@ -1147,7 +1212,7 @@ class. Her ward does all of that, and she trusts it blindly: what the ward
1147
1212
  names is true.
1148
1213
 
1149
1214
  She asks her standings by method and args and gets back an object, silence,
1150
- or unreached. She invites whom she wants, in her own time, and removes them
1215
+ or a word. She invites whom she wants, in her own time, and removes them
1151
1216
  when she decides. She knocks with invitations she was given and takes the
1152
1217
  ones she wants. She answers every ask her ward brings her with an object or
1153
1218
  silence; an error is an ordinary object, and she never throws outward. She
@@ -1160,9 +1225,10 @@ only the ward instantiates.
1160
1225
 
1161
1226
  ### Her obligations
1162
1227
 
1163
- 1. Args are one object. A throw is silence outside: the ward is in the
1164
- middle of every call and catches, always, in every language. An error is
1165
- an object her output schema declares.
1228
+ 1. Args are one object. A throw is the word `threw` outside, to whoever the
1229
+ door has bound, and silence to a stranger: the ward is in the middle of
1230
+ every call and catches, always, in every language. An error is an object
1231
+ her output schema declares.
1166
1232
  2. No lifecycle. Construction with the stance is birth. A restart is silent.
1167
1233
  3. The empty ask is hers. Who gets what blueprint is her decision. She obeys
1168
1234
  the shape, never a content. The empty ask must be safe to repeat: her
@@ -1327,7 +1393,7 @@ alone, one JavaScript file and one declaration file per source file with
1327
1393
  every relative import rewritten, and the exports map points there, types
1328
1394
  beside default. The
1329
1395
  build runs before every gate and every publish and is never tracked;
1330
- nothing under `test/` or `estate/` imports it except through the package
1396
+ nothing under `test/` or `dock/` imports it except through the package
1331
1397
  name, which is how a consumer does. `test/package.test.ts` is the one
1332
1398
  suite that meets the package as a stranger: it packs the tarball,
1333
1399
  installs it into an empty folder, and imports every entry point under
@@ -1347,7 +1413,7 @@ test/ the suites.
1347
1413
  vectors/ fixed inputs and outputs: the arithmetic, Quo's own framing, the frames on the wire.
1348
1414
  ```
1349
1415
 
1350
- `estate/` sits beside `src` and is not Quo: the beings, screens, model sides
1416
+ `dock/` sits beside `src` and is not Quo: the beings, screens, model sides
1351
1417
  and real harbors built on it, each folder with its own document. This
1352
1418
  document does not read them, and they may not add a word to it. Its one
1353
1419
  claim on them is that every harbor there passes `src/conformance/` untouched.
@@ -1414,10 +1480,11 @@ passes the same suite. Those tests are the checklist, not the mock.
1414
1480
  replay, a restart, and every byte on the wire inspected for anything inner.
1415
1481
  - `test/public.test.ts`: the public being, what the door does and does not
1416
1482
  do for her.
1417
- - `test/silence.test.ts`: the chapter "Silence, unreached, error" by its
1418
- numbers: the five silences and two unreacheds of her ward, the thirteen
1419
- cases of the door with a partition snapshot under each, hops refused at
1420
- zero, and the six lines of the law of one silence.
1483
+ - `test/silence.test.ts`: the chapter "Silence, the words, error" by its
1484
+ numbers: the five cases and two unreacheds of her ward, the thirteen
1485
+ cases of the door with a partition snapshot under each, seven strangers
1486
+ met with one silence and six bound keys hearing their word, hops refused
1487
+ at zero, and the six lines of the law of one silence.
1421
1488
  - `test/blueprint.test.ts`: blueprints and instantiation through a real
1422
1489
  ward. What a boot leaves behind, what a restart brings back when the code
1423
1490
  moved under the cells, the gate and the door, the reserved ids.
@@ -1608,8 +1675,12 @@ Decided here, so that the answer is not rediscovered:
1608
1675
  - **blueprint**: her interface as she chooses to show it to one asker.
1609
1676
  - **digest**: SHA-256 over the JCS of a blueprint. Per relation.
1610
1677
  - **seen**: the digest her ward last saw arrive with an answer.
1611
- - **silence**: the far side said nothing. Not retryable blindly.
1612
- - **unreached**: her ward could not reach the far door. Retryable.
1678
+ - **silence**: the far side said nothing, or the door would not admit the
1679
+ bytes. Names no reason. Not retryable blindly.
1680
+ - **word**: the ward's reason, said only to a key the door has bound or by
1681
+ her own ward to her. Nine: removed, absent, unannounced, repeated, threw,
1682
+ unreached, late, invitation, dropped.
1683
+ - **unreached**: the word for no far door reached. Retryable.
1613
1684
  - **notes**: hers, inside every occupant record. Quo never reads it.
1614
1685
  - **partition**: the ward's files. Everything durable, every secret.
1615
1686
  - **ward record**: what a harbor keeps to boot one ward again: seed,
@@ -1,5 +1,5 @@
1
1
  export { Being, type AskSpec } from './being.ts';
2
- export { silence, isSilence, unreached, isUnreached } from './silence.ts';
2
+ export { silence, isSilence, unreached, isUnreached, word, isWord, wordOf, DOOR_WORDS, isDoorWord } from './silence.ts';
3
3
  export { digest, canonical } from './digest.ts';
4
4
  export { OWNER, PUBLIC, RESERVED_IDS } from './types.ts';
5
5
  export type * from './types.ts';
@@ -1,6 +1,6 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // @quo-systems/quo — the Being side. What a being author imports, if anything.
3
3
  export { Being } from './being.js';
4
- export { silence, isSilence, unreached, isUnreached } from './silence.js';
4
+ export { silence, isSilence, unreached, isUnreached, word, isWord, wordOf, DOOR_WORDS, isDoorWord } from './silence.js';
5
5
  export { digest, canonical } from './digest.js';
6
6
  export { OWNER, PUBLIC, RESERVED_IDS } from './types.js';
@@ -1,5 +1,10 @@
1
- import { type Unreached } from './types.ts';
1
+ import { type DoorWord, type Unreached, type Word, type WordName } from './types.ts';
2
2
  export declare const silence: unique symbol;
3
3
  export declare const isSilence: (x: unknown) => x is typeof silence;
4
+ export declare const DOOR_WORDS: readonly DoorWord[];
5
+ export declare const isDoorWord: (s: unknown) => s is DoorWord;
6
+ export declare const word: <W extends WordName>(name: W) => Word<W>;
7
+ export declare const isWord: (x: unknown) => x is Word;
8
+ export declare const wordOf: (x: Word) => WordName;
4
9
  export declare const unreached: () => Unreached;
5
10
  export declare const isUnreached: (x: unknown) => x is Unreached;
@@ -1,11 +1,29 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // Silence is one distinguished value. Null is an answer. Silence is no answer.
3
- import { UNREACHED_KEY } from './types.js';
3
+ //
4
+ // The ward's words are the other distinguished values: what her ward tells
5
+ // her when no object came back and it knows why. Each is one frozen object
6
+ // under one symbol key, so a being cannot make one by accident, none of them
7
+ // crosses an edge as a value, and a being who compares against them needs
8
+ // no fourth shape. `unreached` is one of them.
9
+ import { WORD_KEY } from './types.js';
4
10
  export const silence = Symbol.for('quo.silence');
5
11
  export const isSilence = (x) => x === silence;
6
- // Unreached is the ward's own word: no far door was reached. It carries no
7
- // reason. Safe to retry, because nothing was delivered. A being cannot
8
- // produce it: a ward that sees it come out of a being treats it as silence.
9
- const UNREACHED = Object.freeze({ [UNREACHED_KEY]: true });
10
- export const unreached = () => UNREACHED;
11
- export const isUnreached = (x) => x !== null && typeof x === 'object' && x[UNREACHED_KEY] === true;
12
+ // The words a door says to a key it has bound, and no other. They ride on
13
+ // the wire as `{ quo: word }`, so a reply is checked against this list.
14
+ export const DOOR_WORDS = ['removed', 'absent', 'unannounced', 'repeated', 'threw'];
15
+ export const isDoorWord = (s) => typeof s === 'string' && DOOR_WORDS.includes(s);
16
+ const WORDS = new Map();
17
+ export const word = (name) => {
18
+ let w = WORDS.get(name);
19
+ if (!w)
20
+ WORDS.set(name, (w = Object.freeze({ [WORD_KEY]: name })));
21
+ return w;
22
+ };
23
+ export const isWord = (x) => x !== null && typeof x === 'object' && typeof x[WORD_KEY] === 'string';
24
+ export const wordOf = (x) => x[WORD_KEY];
25
+ // Unreached: no far door was reached. Nothing is known to have been
26
+ // delivered, so asking again is safe. A being cannot produce it: a ward that
27
+ // sees a word come out of a being reads it as her having thrown.
28
+ export const unreached = () => word('unreached');
29
+ export const isUnreached = (x) => isWord(x) && wordOf(x) === 'unreached';
@@ -45,11 +45,15 @@ export type Cells = {
45
45
  [hers: string]: Json;
46
46
  };
47
47
  export type Silence = typeof silence;
48
- export type Unreached = {
49
- readonly [K in typeof UNREACHED_KEY]: true;
48
+ export type DoorWord = 'removed' | 'absent' | 'unannounced' | 'repeated' | 'threw';
49
+ export type WardWord = 'unreached' | 'late' | 'invitation' | 'dropped';
50
+ export type WordName = DoorWord | WardWord;
51
+ export declare const WORD_KEY: unique symbol;
52
+ export type Word<W extends WordName = WordName> = {
53
+ readonly [K in typeof WORD_KEY]: W;
50
54
  };
51
- export declare const UNREACHED_KEY: unique symbol;
52
- export type Answer = Json | Silence | Unreached;
55
+ export type Unreached = Word<'unreached'>;
56
+ export type Answer = Json | Silence | Word;
53
57
  export type Reply = Json | Silence;
54
58
  export type Wanted = {
55
59
  time?: number;
@@ -13,4 +13,4 @@
13
13
  export const OWNER = 'OWNER';
14
14
  export const PUBLIC = 'PUBLIC';
15
15
  export const RESERVED_IDS = [OWNER, PUBLIC];
16
- export const UNREACHED_KEY = Symbol.for('quo.unreached');
16
+ export const WORD_KEY = Symbol.for('quo.word');
@@ -85,7 +85,7 @@ export declare class Customer extends Being {
85
85
  };
86
86
  };
87
87
  };
88
- join(invitation: Invitation): Promise<typeof import("../being/silence.ts").silence | import("../being/types.ts").Unreached | import("../being/types.ts").Json>;
88
+ join(invitation: Invitation): Promise<typeof import("../being/silence.ts").silence | import("../being/types.ts").Word | import("../being/types.ts").Json>;
89
89
  buy(item: string): Promise<import("../being/types.ts").Answer>;
90
90
  learn(): Promise<import("../being/types.ts").Answer>;
91
91
  hi(_args: JsonObject, asker: Asker): {