@graview/core 0.1.3 → 0.1.4

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 (97) hide show
  1. package/dist/app.d.ts +9 -1
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js.map +1 -1
  4. package/dist/capabilities.js +1 -1
  5. package/dist/capabilities.js.map +1 -1
  6. package/dist/cli/check/policy.d.ts.map +1 -1
  7. package/dist/cli/check/policy.js +40 -0
  8. package/dist/cli/check/policy.js.map +1 -1
  9. package/dist/cli/index.d.ts +2 -1
  10. package/dist/cli/index.d.ts.map +1 -1
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/document/canonical.d.ts +2 -1
  13. package/dist/document/canonical.d.ts.map +1 -1
  14. package/dist/document/canonical.js +2 -1
  15. package/dist/document/canonical.js.map +1 -1
  16. package/dist/document/diff.d.ts.map +1 -1
  17. package/dist/document/diff.js +3 -1
  18. package/dist/document/diff.js.map +1 -1
  19. package/dist/document/edit.d.ts +7 -1
  20. package/dist/document/edit.d.ts.map +1 -1
  21. package/dist/document/edit.js +46 -2
  22. package/dist/document/edit.js.map +1 -1
  23. package/dist/document/index.d.ts +1 -1
  24. package/dist/document/index.d.ts.map +1 -1
  25. package/dist/document/migrate.d.ts.map +1 -1
  26. package/dist/document/migrate.js +3 -2
  27. package/dist/document/migrate.js.map +1 -1
  28. package/dist/document/patch.d.ts.map +1 -1
  29. package/dist/document/patch.js +2 -5
  30. package/dist/document/patch.js.map +1 -1
  31. package/dist/document/schema.d.ts +10 -10
  32. package/dist/index.d.ts +7 -6
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +5 -4
  35. package/dist/index.js.map +1 -1
  36. package/dist/integrity.d.ts.map +1 -1
  37. package/dist/integrity.js +35 -5
  38. package/dist/integrity.js.map +1 -1
  39. package/dist/invariants/types.d.ts +1 -1
  40. package/dist/invariants/types.d.ts.map +1 -1
  41. package/dist/mutations/define-mutation.d.ts +22 -2
  42. package/dist/mutations/define-mutation.d.ts.map +1 -1
  43. package/dist/mutations/define-mutation.js +18 -5
  44. package/dist/mutations/define-mutation.js.map +1 -1
  45. package/dist/mutations/node-ref.d.ts +5 -2
  46. package/dist/mutations/node-ref.d.ts.map +1 -1
  47. package/dist/mutations/node-ref.js +28 -7
  48. package/dist/mutations/node-ref.js.map +1 -1
  49. package/dist/mutations/types.d.ts +2 -2
  50. package/dist/mutations/types.d.ts.map +1 -1
  51. package/dist/ops/log.d.ts +11 -0
  52. package/dist/ops/log.d.ts.map +1 -1
  53. package/dist/ops/log.js.map +1 -1
  54. package/dist/ops/served.d.ts +80 -0
  55. package/dist/ops/served.d.ts.map +1 -0
  56. package/dist/ops/served.js +316 -0
  57. package/dist/ops/served.js.map +1 -0
  58. package/dist/ops/types.d.ts +8 -0
  59. package/dist/ops/types.d.ts.map +1 -1
  60. package/dist/ops/withheld.d.ts +63 -8
  61. package/dist/ops/withheld.d.ts.map +1 -1
  62. package/dist/ops/withheld.js +198 -22
  63. package/dist/ops/withheld.js.map +1 -1
  64. package/dist/ops/writers.d.ts +29 -0
  65. package/dist/ops/writers.d.ts.map +1 -0
  66. package/dist/ops/writers.js +98 -0
  67. package/dist/ops/writers.js.map +1 -0
  68. package/dist/permissions/sight.d.ts +15 -2
  69. package/dist/permissions/sight.d.ts.map +1 -1
  70. package/dist/permissions/sight.js +34 -5
  71. package/dist/permissions/sight.js.map +1 -1
  72. package/dist/presence.d.ts +24 -2
  73. package/dist/presence.d.ts.map +1 -1
  74. package/dist/presence.js +26 -1
  75. package/dist/presence.js.map +1 -1
  76. package/dist/refusal.d.ts +9 -5
  77. package/dist/refusal.d.ts.map +1 -1
  78. package/dist/refusal.js +9 -5
  79. package/dist/refusal.js.map +1 -1
  80. package/dist/schema/json-schema.d.ts.map +1 -1
  81. package/dist/schema/json-schema.js +27 -1
  82. package/dist/schema/json-schema.js.map +1 -1
  83. package/dist/schema/schema.d.ts +19 -4
  84. package/dist/schema/schema.d.ts.map +1 -1
  85. package/dist/schema/schema.js.map +1 -1
  86. package/dist/seen.d.ts +54 -1
  87. package/dist/seen.d.ts.map +1 -1
  88. package/dist/seen.js +457 -25
  89. package/dist/seen.js.map +1 -1
  90. package/dist/store.d.ts +90 -10
  91. package/dist/store.d.ts.map +1 -1
  92. package/dist/store.js +146 -35
  93. package/dist/store.js.map +1 -1
  94. package/dist/testing.js.map +1 -1
  95. package/dist/version.d.ts +1 -1
  96. package/dist/version.js +1 -1
  97. package/package.json +2 -2
package/dist/store.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { IntelligenceProviderDeclaration } from "./app.js";
2
- import { Graph } from "./graph/graph.js";
2
+ import { Graph, GraphError, MissingRecordError } from "./graph/graph.js";
3
3
  import { type ModuleMap, type ModuleProjection } from "./modules.js";
4
4
  import { type GraphDiff } from "./graph/diff.js";
5
5
  import { type Primitive } from "./graph/primitives.js";
@@ -128,6 +128,37 @@ export interface ApplyOptions {
128
128
  readonly intent?: string;
129
129
  /** What the change came through — `web`, `mcp:<client>`, `view:<name>`, `api`, `cli` — recorded on each op (FR-06). */
130
130
  readonly via?: Via;
131
+ /**
132
+ * A HOST'S LAST WORD, BY WHAT THE CHANGE WOULD DO. Asked once the calls
133
+ * (or the undo) are compiled and applied, before anything is kept, with
134
+ * the store's own plan of them: no second rehearsal on a copy. Whatever
135
+ * it throws goes on up as it was thrown, and the graph, the log and the
136
+ * subscribers are as if the change was never asked. Returning keeps it.
137
+ */
138
+ readonly admit?: (planned: PlannedChange) => void;
139
+ }
140
+ /**
141
+ * WHAT A CHANGE WOULD DO, before it is kept (`ApplyOptions.admit`): its
142
+ * ops and their primitives, the records and links it adds, removes and
143
+ * changes — a removed record's links counted among the links removed —
144
+ * and how many the store would hold after it.
145
+ */
146
+ export interface PlannedChange {
147
+ readonly ops: readonly Operation[];
148
+ readonly primitives: readonly Primitive[];
149
+ readonly added: {
150
+ readonly nodes: number;
151
+ readonly edges: number;
152
+ };
153
+ readonly removed: {
154
+ readonly nodes: number;
155
+ readonly edges: number;
156
+ };
157
+ readonly changed: {
158
+ readonly nodes: number;
159
+ };
160
+ readonly nodesAfter: number;
161
+ readonly edgesAfter: number;
131
162
  }
132
163
  export interface Preview<S extends AnySchema> {
133
164
  readonly diff: GraphDiff<NodeOfSchema<S>>;
@@ -255,6 +286,15 @@ export interface AdoptResult<S extends AnySchema> {
255
286
  readonly error: unknown;
256
287
  }[];
257
288
  }
289
+ /**
290
+ * A CALL NAMES AN ACT THE APP DOES NOT HAVE. Its message lists every act
291
+ * the store has, for the developer reading it; `mutation` is the name the
292
+ * call gave, so a surface that tells a person can say only that (FR-46).
293
+ */
294
+ export declare class UnknownMutationError extends GraphError {
295
+ readonly mutation: string;
296
+ constructor(mutation: string, registered: readonly string[]);
297
+ }
258
298
  export declare class Store<S extends AnySchema> {
259
299
  readonly schema: S;
260
300
  readonly graph: Graph<S>;
@@ -282,6 +322,13 @@ export declare class Store<S extends AnySchema> {
282
322
  private readonly now;
283
323
  private readonly validate;
284
324
  private readonly mintBatch;
325
+ /**
326
+ * THE TAG THIS STORE MINTS ITS OWN BATCHES UNDER — `batch:<tag>:<n>` —
327
+ * when it mints them its default way; undefined when `batchIds` says
328
+ * otherwise. A server that takes batch ids from clients refuses this tag
329
+ * from one, so nothing the store lands later joins a client's batch.
330
+ */
331
+ readonly batchTag: string | undefined;
285
332
  private counter;
286
333
  /** The default op id generator's count. */
287
334
  private opCount;
@@ -356,14 +403,38 @@ export declare class Store<S extends AnySchema> {
356
403
  */
357
404
  private namesTurnedOff;
358
405
  /**
359
- * A CALL THAT NAMES A RECORD THE CALLER MAY NOT SEE IS REFUSED (FR-02),
360
- * before any grant is read: an act on a record is a way of reading it —
361
- * its preview, its refusal, what its rules say after — and a seat that
362
- * could act on what it may not see could learn it that way. Only a
363
- * record that is there is judged; an id that names nothing is the act's
364
- * own to refuse. The sentence names the act, never the record or its kind.
365
- */
366
- private namesUnseen;
406
+ * AN ACT'S SENTENCE IS WORDED FROM ITS AUTHOR'S VIEW (FR-55). `describe`
407
+ * reads the graph to name what the act touched ("Point at Venue"); read
408
+ * from the whole store, it named a record the author may not see by its
409
+ * label, and so told the author whether a guessed id was real. Read from
410
+ * the store as the author is served it, such a record is named only by
411
+ * what the author wrote, as one that does not exist is. A reader who sees
412
+ * more reads the author's sentence as the author would have. With nothing
413
+ * kept from the author, the store's own graph.
414
+ */
415
+ private wordedFor;
416
+ /**
417
+ * AN ACT'S OWN REFUSAL, AS ITS CALLER MAY READ IT (FR-55). An act's body
418
+ * may refuse in its own words, worded from what it read — "Freya Davies
419
+ * is already booked" — and what it read may be a record its caller may
420
+ * not see. Such a refusal is said without its words: the act, and that it
421
+ * could not be done. The store's own refusals already name nothing.
422
+ */
423
+ private refusalWordedFor;
424
+ /**
425
+ * A CALL THAT NAMES A RECORD THAT IS NOT THERE FOR ITS CALLER IS REFUSED
426
+ * AS MISSING (FR-02, FR-55) — one that does not exist, and one the caller
427
+ * may not see, alike: the same `MissingRecordError`, the same sentence,
428
+ * reason `missing`. Ids are minted from labels, so a seat can guess one,
429
+ * and a refusal that told a hidden record from an absent one would tell
430
+ * it which guesses were real. An act on a record is also a way of reading
431
+ * it — its preview, what its rules say after — so a hidden one is never
432
+ * acted on by a seat that may not see it. Asked of each call as it is
433
+ * about to run, so a record an earlier call in the same gesture made is
434
+ * there. The sentence names the act, never the id: it says the same of a
435
+ * hidden record and an absent one, and says back nothing the seat sent.
436
+ */
437
+ missingFor(call: MutationCall, principal?: Principal): MissingRecordError | undefined;
367
438
  /**
368
439
  * Whether a principal may run ANY act of a module drawn only for those
369
440
  * who administer it. This is the one question the interface asks before
@@ -430,7 +501,9 @@ export declare class Store<S extends AnySchema> {
430
501
  * is a button that appears broken.
431
502
  */
432
503
  wouldChange(call: MutationCall): boolean;
433
- preview(call: MutationCall, context?: InvariantContext): Preview<S>;
504
+ preview(call: MutationCall, context?: InvariantContext, options?: {
505
+ readonly author?: Principal;
506
+ }): Preview<S>;
434
507
  /**
435
508
  * What several calls would do as one gesture, without doing any of it
436
509
  * (FR-18): each compiles on the graph the one before it left, as
@@ -537,6 +610,10 @@ export declare class Store<S extends AnySchema> {
537
610
  undo(batchIds: string | readonly string[], options?: ApplyOptions): ApplyResult<S>;
538
611
  /** `undo` itself, kept apart for the same reason as `applying`. */
539
612
  private undoing;
613
+ /** A change not kept: the graph as it was, and the log cut back to where it stood. */
614
+ private putBack;
615
+ /** Asks the host's `admit`, when there is one, with the change as planned; one it refuses is put back, and its word goes on up. */
616
+ private admitted;
540
617
  /** Redo is the undo of an undo — no separate stack exists. */
541
618
  redo(undoBatchId: string, options?: ApplyOptions): ApplyResult<S>;
542
619
  /**
@@ -625,6 +702,9 @@ export declare class Store<S extends AnySchema> {
625
702
  * 1000). It is moved back to the start of the gesture it would split, so
626
703
  * a batch is never half behind it.
627
704
  *
705
+ * The checkpoint keeps who made each record behind it (`creators`), so a
706
+ * store opened on it knows a record's maker without the archived ops.
707
+ *
628
708
  * Nothing moves until `compact` is handed the checkpoint, so a host can
629
709
  * archive what is behind it first. A store whose graph does not verify
630
710
  * against its log is not compacted: the checkpoint would vouch for a
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,KAAK,EAAc,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAA0C,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAA6C,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5F,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,k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AAC,MAAM;IAoBd,QAAQ,IAAI,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAI1C;;;;;;;OAOG;IACH,MAAM,IAAI,YAAY;IAQtB;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,OAAO,GAAE,cAAmB,GAAG,KAAK,GAAG,SAAS;IAwB3D;;;;;;OAMG;IACH,OAAO,CAAC,UAAU,EAAE,KAAK,GAAG,UAAU;CAGvC;AAED,8DAA8D;AAC9D,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,gHAAgH;IAChH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,0FAA0F;IAC1F,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB"}
package/dist/store.js CHANGED
@@ -1,5 +1,5 @@
1
- import { readingOf, seenBy, seesId } from "./seen.js";
2
- import { Graph, GraphError } from "./graph/graph.js";
1
+ import { hidesFrom, readingOf, seatLens, seenBy, seesId } from "./seen.js";
2
+ import { Graph, GraphError, MissingRecordError } from "./graph/graph.js";
3
3
  import { resolveModules } from "./modules.js";
4
4
  import { diffSnapshots, EMPTY_DIFF, isEmptyDiff } from "./graph/diff.js";
5
5
  import { invert, normalise, writesOf } from "./graph/primitives.js";
@@ -7,17 +7,20 @@ import { LabelIndex, refusalFor } from "./labels.js";
7
7
  import { nodeRefArgs } from "./mutations/node-ref.js";
8
8
  import { verifyFold } from "./integrity.js";
9
9
  import { evaluate } from "./invariants/engine.js";
10
- import { compileMutation } from "./mutations/define-mutation.js";
10
+ import { compileMutation, READ_BEFORE_REFUSING } from "./mutations/define-mutation.js";
11
11
  import { deriveMutations, derivedVia } from "./mutations/derive-edits.js";
12
12
  import { OperationLog } from "./ops/log.js";
13
13
  import { actingAs, isSystem, permits, permittedMutations } from "./permissions/policy.js";
14
- import { redact } from "./ops/withheld.js";
14
+ import { namesUnseen, redact } from "./ops/withheld.js";
15
15
  import { nounOf } from "./schema/define-node.js";
16
+ import { creatorsBefore } from "./permissions/sight.js";
16
17
  import { PermissionDeniedError } from "./permissions/types.js";
17
18
  import { checkUndo, UndoBlockedError, undoPrimitives } from "./ops/undo.js";
18
19
  import { validateGraph } from "./validate-graph.js";
19
20
  import { tellTheWatchItsNames, tellTheWatchOfAStore, tellTheWatchOfAnAuthor, tellTheWatchOfARefusal } from "./watched.js";
20
21
  const HUMAN = { kind: "human" };
22
+ /** The host itself, which sees what it keeps: the principal a question is asked as when no seat is named. */
23
+ const SYSTEM = { kind: "system" };
21
24
  /** Who turns a module off or on: the workspace itself, `system · modules` (FR-12). */
22
25
  export const MODULES_AUTHOR = { kind: "system", id: "modules", name: "Modules" };
23
26
  /**
@@ -58,6 +61,19 @@ export class ReceiveError extends Error {
58
61
  this.name = "ReceiveError";
59
62
  }
60
63
  }
64
+ /**
65
+ * A CALL NAMES AN ACT THE APP DOES NOT HAVE. Its message lists every act
66
+ * the store has, for the developer reading it; `mutation` is the name the
67
+ * call gave, so a surface that tells a person can say only that (FR-46).
68
+ */
69
+ export class UnknownMutationError extends GraphError {
70
+ mutation;
71
+ constructor(mutation, registered) {
72
+ super(`Unknown mutation "${mutation}"`, `Registered: ${registered.join(", ") || "(none)"}`);
73
+ this.mutation = mutation;
74
+ this.name = "UnknownMutationError";
75
+ }
76
+ }
61
77
  /**
62
78
  * A tag nobody else's store is using, for this store's batch ids. Drawn
63
79
  * from the platform's random source where there is one, which every page
@@ -100,6 +116,13 @@ export class Store {
100
116
  now;
101
117
  validate;
102
118
  mintBatch;
119
+ /**
120
+ * THE TAG THIS STORE MINTS ITS OWN BATCHES UNDER — `batch:<tag>:<n>` —
121
+ * when it mints them its default way; undefined when `batchIds` says
122
+ * otherwise. A server that takes batch ids from clients refuses this tag
123
+ * from one, so nothing the store lands later joins a client's batch.
124
+ */
125
+ batchTag;
103
126
  counter = 0;
104
127
  /** The default op id generator's count. */
105
128
  opCount = 0;
@@ -122,6 +145,7 @@ export class Store {
122
145
  this.now = options.now ?? (() => new Date().toISOString());
123
146
  this.validate = options.validate ?? true;
124
147
  const tag = storeTag();
148
+ this.batchTag = options.batchIds ? undefined : tag;
125
149
  this.mintBatch = options.batchIds ?? ((kind) => `${kind}:${tag}:${++this.counter}`);
126
150
  for (const mutation of options.mutations ?? []) {
127
151
  if (this.mutations.has(mutation.name)) {
@@ -271,7 +295,7 @@ export class Store {
271
295
  mutation(name) {
272
296
  const found = this.mutations.get(name);
273
297
  if (!found) {
274
- throw new GraphError(`Unknown mutation "${name}"`, `Registered: ${[...this.mutations.keys()].join(", ") || "(none)"}`);
298
+ throw new UnknownMutationError(name, [...this.mutations.keys()]);
275
299
  }
276
300
  // A refusal is a result: the mutation exists, and this workspace has its
277
301
  // module off — which is a different sentence from "unknown".
@@ -328,10 +352,10 @@ export class Store {
328
352
  * repair as the starter seat, which may only add, and the press met
329
353
  * "starter may not take-off here" (W-110).
330
354
  */
331
- const narrowed = this.refusesAgent(call, principal) ?? this.namesTurnedOff(call) ?? this.namesUnseen(call, principal);
355
+ const narrowed = this.refusesAgent(call, principal) ?? this.namesTurnedOff(call, principal);
332
356
  if (narrowed)
333
357
  return { ok: false, refusal: narrowed };
334
- return permits(this.policy, principal, call.name, this.subjectKindOf(call), this.viaOf(this.mutations.get(call.name)), this.subjectIdOf(call), this.words);
358
+ return permits(this.policy, principal, call.name, this.subjectKindOf(call, principal), this.viaOf(this.mutations.get(call.name)), this.subjectIdOf(call), this.words);
335
359
  }
336
360
  /** How the policy's refusals name an act and a kind: by title and noun, never by id. */
337
361
  get words() {
@@ -367,10 +391,13 @@ export class Store {
367
391
  * the core owns — a rename that takes any kind — must not reach into a
368
392
  * district the workspace does not have. The sentence names the act.
369
393
  */
370
- namesTurnedOff(call) {
394
+ namesTurnedOff(call, principal = SYSTEM) {
371
395
  const off = this.modules.disabledKinds;
372
396
  if (off.size === 0)
373
397
  return undefined;
398
+ // A seat the module's records are kept from is not told they are there: naming one is naming nothing (FR-55).
399
+ if (!isSystem(principal))
400
+ return undefined;
374
401
  const mutation = this.mutations.get(call.name);
375
402
  if (!mutation)
376
403
  return undefined;
@@ -389,16 +416,53 @@ export class Store {
389
416
  };
390
417
  }
391
418
  /**
392
- * A CALL THAT NAMES A RECORD THE CALLER MAY NOT SEE IS REFUSED (FR-02),
393
- * before any grant is read: an act on a record is a way of reading it —
394
- * its preview, its refusal, what its rules say after — and a seat that
395
- * could act on what it may not see could learn it that way. Only a
396
- * record that is there is judged; an id that names nothing is the act's
397
- * own to refuse. The sentence names the act, never the record or its kind.
419
+ * AN ACT'S SENTENCE IS WORDED FROM ITS AUTHOR'S VIEW (FR-55). `describe`
420
+ * reads the graph to name what the act touched ("Point at Venue"); read
421
+ * from the whole store, it named a record the author may not see by its
422
+ * label, and so told the author whether a guessed id was real. Read from
423
+ * the store as the author is served it, such a record is named only by
424
+ * what the author wrote, as one that does not exist is. A reader who sees
425
+ * more reads the author's sentence as the author would have. With nothing
426
+ * kept from the author, the store's own graph.
398
427
  */
399
- namesUnseen(call, principal) {
400
- if (!this.policy?.sees?.length || isSystem(principal))
401
- return undefined;
428
+ wordedFor(author) {
429
+ if (author === undefined || !hidesFrom(this, author))
430
+ return {};
431
+ // And a seat that writes a value naming what it may not see has written its own words, though the store held them already.
432
+ const hidden = seesId(this, author);
433
+ return { describeWith: seenBy(this, author).graph, keepUnchanged: (value) => namesUnseen(value, hidden) };
434
+ }
435
+ /**
436
+ * AN ACT'S OWN REFUSAL, AS ITS CALLER MAY READ IT (FR-55). An act's body
437
+ * may refuse in its own words, worded from what it read — "Freya Davies
438
+ * is already booked" — and what it read may be a record its caller may
439
+ * not see. Such a refusal is said without its words: the act, and that it
440
+ * could not be done. The store's own refusals already name nothing.
441
+ */
442
+ refusalWordedFor(error, author, calls) {
443
+ if (!hidesFrom(this, author) || error instanceof PermissionDeniedError || error instanceof MissingRecordError || error === null || typeof error !== "object")
444
+ return error;
445
+ const read = error[READ_BEFORE_REFUSING] ?? [];
446
+ const visible = seesId(this, author);
447
+ if (!read.some((id) => this.graph.has(id) && !visible(id)))
448
+ return error;
449
+ const title = calls.length === 1 ? (this.mutations.get(calls[0].name)?.title ?? calls[0].name) : undefined;
450
+ return new GraphError(title ? `“${title}” could not be done as asked.` : "This change could not be done as asked.");
451
+ }
452
+ /**
453
+ * A CALL THAT NAMES A RECORD THAT IS NOT THERE FOR ITS CALLER IS REFUSED
454
+ * AS MISSING (FR-02, FR-55) — one that does not exist, and one the caller
455
+ * may not see, alike: the same `MissingRecordError`, the same sentence,
456
+ * reason `missing`. Ids are minted from labels, so a seat can guess one,
457
+ * and a refusal that told a hidden record from an absent one would tell
458
+ * it which guesses were real. An act on a record is also a way of reading
459
+ * it — its preview, what its rules say after — so a hidden one is never
460
+ * acted on by a seat that may not see it. Asked of each call as it is
461
+ * about to run, so a record an earlier call in the same gesture made is
462
+ * there. The sentence names the act, never the id: it says the same of a
463
+ * hidden record and an absent one, and says back nothing the seat sent.
464
+ */
465
+ missingFor(call, principal = HUMAN) {
402
466
  const mutation = this.mutations.get(call.name);
403
467
  if (!mutation)
404
468
  return undefined;
@@ -415,14 +479,15 @@ export class Store {
415
479
  add(call.args[mutation.subject.arg]);
416
480
  for (const ref of nodeRefArgs(mutation.input))
417
481
  add(call.args[ref.name]);
418
- const visible = seesId(this, principal);
419
- if (![...named].some((id) => this.graph.has(id) && !visible(id)))
482
+ if (named.size === 0)
420
483
  return undefined;
421
- return {
422
- mutation: call.name,
423
- message: `Not permitted: “${mutation.title ?? call.name}” names a record you may not see.`,
424
- wouldNeed: [],
425
- };
484
+ const visible = seesId(this, principal);
485
+ for (const id of named) {
486
+ if (this.graph.has(id) && visible(id))
487
+ continue;
488
+ return new MissingRecordError(id, `“${mutation.title ?? call.name}” names a record that is not there.`);
489
+ }
490
+ return undefined;
426
491
  }
427
492
  /**
428
493
  * Whether a principal may run ANY act of a module drawn only for those
@@ -541,7 +606,7 @@ export class Store {
541
606
  * refuses that case rather than allowing it: the safe reading of "I could
542
607
  * not tell what this acts on" is no.
543
608
  */
544
- subjectKindOf(call) {
609
+ subjectKindOf(call, principal = SYSTEM) {
545
610
  const definition = this.mutations.get(call.name);
546
611
  const subject = definition?.subject;
547
612
  if (!subject)
@@ -555,6 +620,9 @@ export class Store {
555
620
  */
556
621
  if (typeof id !== "string")
557
622
  return subject.kinds !== "*" && subject.kinds.length === 1 ? subject.kinds[0] : undefined;
623
+ // A record the principal may not see is judged as one that is not there: its kind is not the policy's to read aloud (FR-55).
624
+ if (!isSystem(principal) && !seesId(this, principal)(id))
625
+ return undefined;
558
626
  return this.graph.getNode(id)?.kind;
559
627
  }
560
628
  /** Current violations, evaluated fresh — nothing is cached or stale. */
@@ -590,9 +658,9 @@ export class Store {
590
658
  return true;
591
659
  }
592
660
  }
593
- preview(call, context) {
661
+ preview(call, context, options = {}) {
594
662
  const definition = this.mutation(call.name);
595
- const compiled = compileMutation(this.graph, definition, call.args);
663
+ const compiled = compileMutation(this.graph, definition, call.args, this.wordedFor(options.author));
596
664
  return this.previewPrimitives(compiled.primitives, {
597
665
  reads: compiled.reads,
598
666
  writes: compiled.writes,
@@ -691,6 +759,7 @@ export class Store {
691
759
  const intents = [];
692
760
  const before = this.violations();
693
761
  const rollback = this.graph.snapshot();
762
+ const kept = this.log.length;
694
763
  /*
695
764
  * Permission is checked for the WHOLE gesture before any of it runs.
696
765
  *
@@ -720,7 +789,7 @@ export class Store {
720
789
  * was brought in for, and the narrower of the two wins.
721
790
  */
722
791
  for (const call of calls) {
723
- const refusal = this.refusesAgent(call, author) ?? this.namesTurnedOff(call);
792
+ const refusal = this.refusesAgent(call, author) ?? this.namesTurnedOff(call, author);
724
793
  if (refusal) {
725
794
  tellTheWatchOfARefusal(refusal, author.id);
726
795
  throw new PermissionDeniedError(refusal);
@@ -730,7 +799,10 @@ export class Store {
730
799
  try {
731
800
  for (const call of calls) {
732
801
  const definition = this.mutation(call.name);
733
- const compiled = compileMutation(this.graph, definition, call.args);
802
+ const missing = this.missingFor(call, author);
803
+ if (missing)
804
+ throw missing;
805
+ const compiled = compileMutation(this.graph, definition, call.args, this.wordedFor(author));
734
806
  /*
735
807
  * AN ACT THAT DID NOTHING DOES NOT GO IN THE HISTORY.
736
808
  *
@@ -768,6 +840,8 @@ export class Store {
768
840
  inverse: [...compiled.primitives].reverse().map(normalise).map(invert),
769
841
  reads: compiled.reads,
770
842
  writes: compiled.writes,
843
+ // Which records its sentence read, so a reader who may not see one is not handed the sentence (FR-55).
844
+ ...(definition.describe !== undefined && compiled.described && compiled.described.length > 0 ? { described: compiled.described } : {}),
771
845
  at: this.now(),
772
846
  ...(options.via !== undefined ? { via: options.via } : {}),
773
847
  };
@@ -783,13 +857,15 @@ export class Store {
783
857
  }
784
858
  }
785
859
  catch (error) {
786
- this.graph.load(rollback);
787
- throw error;
860
+ // A batch refused part way keeps none of it: the graph, and the ops it had logged before the refusal.
861
+ this.putBack(rollback, kept);
862
+ throw this.refusalWordedFor(error, author, calls);
788
863
  }
864
+ const diff = diffSnapshots(rollback, this.graph.snapshot());
865
+ this.admitted(options, ops, allPrimitives, diff, rollback, kept);
789
866
  const after = this.violations();
790
867
  const beforeKeys = new Set(before.map(violationKey));
791
868
  const afterKeys = new Set(after.map(violationKey));
792
- const diff = diffSnapshots(rollback, this.graph.snapshot());
793
869
  this.notify(diff, ops);
794
870
  return {
795
871
  batch,
@@ -1056,7 +1132,7 @@ export class Store {
1056
1132
  */
1057
1133
  const sighted = (this.policy?.sees?.length ?? 0) > 0 && !isSystem(author);
1058
1134
  if (sighted) {
1059
- const seen = checkUndo(readingOf(redact(this.log.all(), seesId(this, author)), () => this.log.epochs()), ids);
1135
+ const seen = checkUndo(readingOf(redact(this.log.all(), seatLens(this, author)), () => this.log.epochs()), ids);
1060
1136
  if (!seen.ok)
1061
1137
  throw new UndoBlockedError(seen);
1062
1138
  }
@@ -1094,6 +1170,7 @@ export class Store {
1094
1170
  const rollback = this.graph.snapshot();
1095
1171
  const before = this.violations();
1096
1172
  const ops = [];
1173
+ const kept = this.log.length;
1097
1174
  for (const target of [...check.ops].sort((a, b) => b.seq - a.seq)) {
1098
1175
  const op = {
1099
1176
  id: this.nextId(),
@@ -1115,10 +1192,11 @@ export class Store {
1115
1192
  this.log.append(op);
1116
1193
  ops.push(op);
1117
1194
  }
1195
+ const diff = diffSnapshots(rollback, this.graph.snapshot());
1196
+ this.admitted(options, ops, ops.flatMap((op) => [...op.primitives]), diff, rollback, kept);
1118
1197
  const after = this.violations();
1119
1198
  const beforeKeys = new Set(before.map(violationKey));
1120
1199
  const afterKeys = new Set(after.map(violationKey));
1121
- const diff = diffSnapshots(rollback, this.graph.snapshot());
1122
1200
  this.notify(diff, ops);
1123
1201
  return {
1124
1202
  batch,
@@ -1133,6 +1211,33 @@ export class Store {
1133
1211
  violationsAfter: after,
1134
1212
  };
1135
1213
  }
1214
+ /** A change not kept: the graph as it was, and the log cut back to where it stood. */
1215
+ putBack(rollback, kept) {
1216
+ this.graph.load(rollback);
1217
+ if (this.log.length > kept)
1218
+ this.log.truncate(kept);
1219
+ }
1220
+ /** Asks the host's `admit`, when there is one, with the change as planned; one it refuses is put back, and its word goes on up. */
1221
+ admitted(options, ops, primitives, diff, rollback, kept) {
1222
+ if (!options.admit || ops.length === 0)
1223
+ return;
1224
+ const size = this.graph.size;
1225
+ try {
1226
+ options.admit({
1227
+ ops,
1228
+ primitives,
1229
+ added: { nodes: diff.addedNodes.length, edges: diff.addedEdges.length },
1230
+ removed: { nodes: diff.removedNodes.length, edges: diff.removedEdges.length },
1231
+ changed: { nodes: diff.changedNodes.length },
1232
+ nodesAfter: size.nodes,
1233
+ edgesAfter: size.edges,
1234
+ });
1235
+ }
1236
+ catch (error) {
1237
+ this.putBack(rollback, kept);
1238
+ throw error;
1239
+ }
1240
+ }
1136
1241
  /** Redo is the undo of an undo — no separate stack exists. */
1137
1242
  redo(undoBatchId, options = {}) {
1138
1243
  return this.undo(undoBatchId, options);
@@ -1377,6 +1482,9 @@ export class Store {
1377
1482
  * 1000). It is moved back to the start of the gesture it would split, so
1378
1483
  * a batch is never half behind it.
1379
1484
  *
1485
+ * The checkpoint keeps who made each record behind it (`creators`), so a
1486
+ * store opened on it knows a record's maker without the archived ops.
1487
+ *
1380
1488
  * Nothing moves until `compact` is handed the checkpoint, so a host can
1381
1489
  * archive what is behind it first. A store whose graph does not verify
1382
1490
  * against its log is not compacted: the checkpoint would vouch for a
@@ -1404,7 +1512,10 @@ export class Store {
1404
1512
  const verified = this.verify();
1405
1513
  if (!verified.ok)
1406
1514
  throw new GraphError(`Cannot compact a store that does not verify: ${verified.reason}`);
1407
- return this.log.checkpointAt(this.schema, seq, { validate: this.validate });
1515
+ const checkpoint = this.log.checkpointAt(this.schema, seq, { validate: this.validate });
1516
+ // Who made each record behind it, so a store opened on it still knows (an `own` sight reads the log for it).
1517
+ const creators = creatorsBefore(this.log, seq);
1518
+ return Object.keys(creators).length > 0 ? { ...checkpoint, creators } : checkpoint;
1408
1519
  }
1409
1520
  /**
1410
1521
  * MOVES THE UNDO HORIZON TO `checkpoint` (FR-23): the ops and epochs