@graview/core 0.2.3 → 0.2.5

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 (190) hide show
  1. package/dist/across-copies.d.ts +3 -0
  2. package/dist/across-copies.d.ts.map +1 -0
  3. package/dist/across-copies.js +39 -0
  4. package/dist/across-copies.js.map +1 -0
  5. package/dist/binding-served.d.ts +11 -2
  6. package/dist/binding-served.d.ts.map +1 -1
  7. package/dist/binding-served.js +19 -0
  8. package/dist/binding-served.js.map +1 -1
  9. package/dist/binding.d.ts +25 -0
  10. package/dist/binding.d.ts.map +1 -1
  11. package/dist/binding.js +128 -19
  12. package/dist/binding.js.map +1 -1
  13. package/dist/capabilities.js +1 -1
  14. package/dist/capabilities.js.map +1 -1
  15. package/dist/catalog.d.ts.map +1 -1
  16. package/dist/catalog.js +37 -1
  17. package/dist/catalog.js.map +1 -1
  18. package/dist/check.d.ts +3 -0
  19. package/dist/check.d.ts.map +1 -1
  20. package/dist/check.js +3 -0
  21. package/dist/check.js.map +1 -1
  22. package/dist/cited.d.ts +55 -0
  23. package/dist/cited.d.ts.map +1 -0
  24. package/dist/cited.js +48 -0
  25. package/dist/cited.js.map +1 -0
  26. package/dist/cli/check/cites.d.ts +4 -0
  27. package/dist/cli/check/cites.d.ts.map +1 -0
  28. package/dist/cli/check/cites.js +35 -0
  29. package/dist/cli/check/cites.js.map +1 -0
  30. package/dist/cli/check/context-of.d.ts +12 -0
  31. package/dist/cli/check/context-of.d.ts.map +1 -0
  32. package/dist/cli/check/context-of.js +25 -0
  33. package/dist/cli/check/context-of.js.map +1 -0
  34. package/dist/cli/check/index.d.ts +1 -0
  35. package/dist/cli/check/index.d.ts.map +1 -1
  36. package/dist/cli/check/index.js +1 -0
  37. package/dist/cli/check/index.js.map +1 -1
  38. package/dist/cli/check/policy.d.ts.map +1 -1
  39. package/dist/cli/check/policy.js +28 -3
  40. package/dist/cli/check/policy.js.map +1 -1
  41. package/dist/cli/check.d.ts.map +1 -1
  42. package/dist/cli/check.js +4 -12
  43. package/dist/cli/check.js.map +1 -1
  44. package/dist/cli/index.d.ts +1 -1
  45. package/dist/cli/index.d.ts.map +1 -1
  46. package/dist/cli/index.js +42 -3
  47. package/dist/cli/index.js.map +1 -1
  48. package/dist/compose-change.d.ts +33 -0
  49. package/dist/compose-change.d.ts.map +1 -0
  50. package/dist/compose-change.js +43 -0
  51. package/dist/compose-change.js.map +1 -0
  52. package/dist/compose-home.d.ts +46 -6
  53. package/dist/compose-home.d.ts.map +1 -1
  54. package/dist/compose-home.js +189 -47
  55. package/dist/compose-home.js.map +1 -1
  56. package/dist/compose.d.ts +6 -4
  57. package/dist/compose.d.ts.map +1 -1
  58. package/dist/compose.js +18 -39
  59. package/dist/compose.js.map +1 -1
  60. package/dist/composer-check.d.ts +16 -0
  61. package/dist/composer-check.d.ts.map +1 -0
  62. package/dist/composer-check.js +48 -0
  63. package/dist/composer-check.js.map +1 -0
  64. package/dist/composer.d.ts +19 -0
  65. package/dist/composer.d.ts.map +1 -0
  66. package/dist/composer.js +49 -0
  67. package/dist/composer.js.map +1 -0
  68. package/dist/css/faces-words.d.ts.map +1 -1
  69. package/dist/css/faces-words.js +2 -0
  70. package/dist/css/faces-words.js.map +1 -1
  71. package/dist/css/faces.d.ts +1 -1
  72. package/dist/css/faces.d.ts.map +1 -1
  73. package/dist/css/sanitize.d.ts +5 -1
  74. package/dist/css/sanitize.d.ts.map +1 -1
  75. package/dist/css/sanitize.js +16 -1
  76. package/dist/css/sanitize.js.map +1 -1
  77. package/dist/document/compile.d.ts.map +1 -1
  78. package/dist/document/compile.js +5 -2
  79. package/dist/document/compile.js.map +1 -1
  80. package/dist/document/compiled.d.ts.map +1 -1
  81. package/dist/document/compiled.js +6 -0
  82. package/dist/document/compiled.js.map +1 -1
  83. package/dist/document/design-findings.d.ts.map +1 -1
  84. package/dist/document/design-findings.js +2 -1
  85. package/dist/document/design-findings.js.map +1 -1
  86. package/dist/document/edit.d.ts +1 -1
  87. package/dist/document/edit.d.ts.map +1 -1
  88. package/dist/document/edit.js +184 -152
  89. package/dist/document/edit.js.map +1 -1
  90. package/dist/document/expr/evaluate.d.ts +3 -1
  91. package/dist/document/expr/evaluate.d.ts.map +1 -1
  92. package/dist/document/expr/evaluate.js +29 -1
  93. package/dist/document/expr/evaluate.js.map +1 -1
  94. package/dist/document/expr/typing.d.ts.map +1 -1
  95. package/dist/document/expr/typing.js +1 -0
  96. package/dist/document/expr/typing.js.map +1 -1
  97. package/dist/document/field-spec.d.ts.map +1 -1
  98. package/dist/document/field-spec.js +6 -1
  99. package/dist/document/field-spec.js.map +1 -1
  100. package/dist/document/format-findings.d.ts.map +1 -1
  101. package/dist/document/format-findings.js +8 -0
  102. package/dist/document/format-findings.js.map +1 -1
  103. package/dist/document/instantiate-template.d.ts.map +1 -1
  104. package/dist/document/instantiate-template.js +16 -1
  105. package/dist/document/instantiate-template.js.map +1 -1
  106. package/dist/document/rules.d.ts.map +1 -1
  107. package/dist/document/rules.js +4 -0
  108. package/dist/document/rules.js.map +1 -1
  109. package/dist/document/schema.d.ts +5 -0
  110. package/dist/document/schema.d.ts.map +1 -1
  111. package/dist/document/schema.js +7 -0
  112. package/dist/document/schema.js.map +1 -1
  113. package/dist/document/uncited-findings.d.ts +9 -0
  114. package/dist/document/uncited-findings.d.ts.map +1 -0
  115. package/dist/document/uncited-findings.js +10 -0
  116. package/dist/document/uncited-findings.js.map +1 -0
  117. package/dist/document.schema.json +12 -2
  118. package/dist/graph/graph.d.ts.map +1 -1
  119. package/dist/graph/graph.js +4 -0
  120. package/dist/graph/graph.js.map +1 -1
  121. package/dist/index.d.ts +5 -4
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +6 -4
  124. package/dist/index.js.map +1 -1
  125. package/dist/mutations/define-mutation.d.ts +8 -0
  126. package/dist/mutations/define-mutation.d.ts.map +1 -1
  127. package/dist/mutations/define-mutation.js +23 -1
  128. package/dist/mutations/define-mutation.js.map +1 -1
  129. package/dist/mutations/invalid-arguments.d.ts.map +1 -1
  130. package/dist/mutations/invalid-arguments.js +3 -0
  131. package/dist/mutations/invalid-arguments.js.map +1 -1
  132. package/dist/ops/revisions.d.ts.map +1 -1
  133. package/dist/ops/revisions.js +10 -3
  134. package/dist/ops/revisions.js.map +1 -1
  135. package/dist/ops/undo.d.ts.map +1 -1
  136. package/dist/ops/undo.js +49 -1
  137. package/dist/ops/undo.js.map +1 -1
  138. package/dist/permissions/policy.d.ts +19 -18
  139. package/dist/permissions/policy.d.ts.map +1 -1
  140. package/dist/permissions/policy.js +27 -22
  141. package/dist/permissions/policy.js.map +1 -1
  142. package/dist/permissions/types.d.ts.map +1 -1
  143. package/dist/permissions/types.js +3 -0
  144. package/dist/permissions/types.js.map +1 -1
  145. package/dist/persistence/memory.d.ts.map +1 -1
  146. package/dist/persistence/memory.js +6 -0
  147. package/dist/persistence/memory.js.map +1 -1
  148. package/dist/persistence/sql.d.ts.map +1 -1
  149. package/dist/persistence/sql.js +18 -0
  150. package/dist/persistence/sql.js.map +1 -1
  151. package/dist/persistence/types.d.ts +10 -0
  152. package/dist/persistence/types.d.ts.map +1 -1
  153. package/dist/refused.d.ts.map +1 -1
  154. package/dist/refused.js +3 -0
  155. package/dist/refused.js.map +1 -1
  156. package/dist/schema/cites.d.ts +30 -0
  157. package/dist/schema/cites.d.ts.map +1 -0
  158. package/dist/schema/cites.js +70 -0
  159. package/dist/schema/cites.js.map +1 -0
  160. package/dist/schema/files.d.ts +28 -0
  161. package/dist/schema/files.d.ts.map +1 -1
  162. package/dist/schema/files.js +13 -1
  163. package/dist/schema/files.js.map +1 -1
  164. package/dist/schema/reading.d.ts.map +1 -1
  165. package/dist/schema/reading.js +3 -2
  166. package/dist/schema/reading.js.map +1 -1
  167. package/dist/schema/schema.d.ts.map +1 -1
  168. package/dist/schema/schema.js +3 -0
  169. package/dist/schema/schema.js.map +1 -1
  170. package/dist/seen.d.ts +8 -0
  171. package/dist/seen.d.ts.map +1 -1
  172. package/dist/seen.js +6 -4
  173. package/dist/seen.js.map +1 -1
  174. package/dist/store.d.ts +12 -5
  175. package/dist/store.d.ts.map +1 -1
  176. package/dist/store.js +74 -35
  177. package/dist/store.js.map +1 -1
  178. package/dist/tidying.d.ts +2 -0
  179. package/dist/tidying.d.ts.map +1 -1
  180. package/dist/tidying.js +2 -0
  181. package/dist/tidying.js.map +1 -1
  182. package/dist/version.d.ts +1 -1
  183. package/dist/version.js +1 -1
  184. package/dist/views/types.d.ts +7 -0
  185. package/dist/views/types.d.ts.map +1 -1
  186. package/dist/views/types.js.map +1 -1
  187. package/dist/who.d.ts.map +1 -1
  188. package/dist/who.js +7 -3
  189. package/dist/who.js.map +1 -1
  190. package/package.json +5 -1
package/dist/store.js CHANGED
@@ -1,4 +1,4 @@
1
- import { hidesFrom, readingOf, seatLens, seenBy, seesEveryRecord, seesId } from "./seen.js";
1
+ import { everBound, hidesFrom, readingOf, seatLens, seenBy, seesEveryRecord, seesId } from "./seen.js";
2
2
  import { isoToday } from "./days.js";
3
3
  import { Graph, GraphError, MissingRecordError } from "./graph/graph.js";
4
4
  import { resolveModules } from "./modules.js";
@@ -10,7 +10,7 @@ import { LabelIndex, refusalFor } from "./labels.js";
10
10
  import { heldRefKinds, nodeRefArgs } from "./mutations/node-ref.js";
11
11
  import { verifyFold } from "./integrity.js";
12
12
  import { evaluate } from "./invariants/engine.js";
13
- import { compileMutation } from "./mutations/define-mutation.js";
13
+ import { compileMutation, mintPersonId } from "./mutations/define-mutation.js";
14
14
  import { wouldRun } from "./mutations/would-run.js";
15
15
  import { actSpelledAs, nearestAct } from "./mutations/act-spelling.js";
16
16
  import { InvalidArguments } from "./mutations/invalid-arguments.js";
@@ -27,7 +27,7 @@ import { advisoryVoterOf, signedOutSeat, SIGN_IN_TO_VOTE, VOTE_SUGGESTION, VOTIN
27
27
  import { TYPE_TEXT, TYPING } from "./text/typing-hook.js";
28
28
  import { DECLINES, isAutomated, isTidyingActor, tidyingRefusal } from "./ops/tidying.js";
29
29
  import { nameOfAuthor } from "./who.js";
30
- import { actingAs, boundPersonOf, grantsTo, isSystem, meIn, meOf, ownsId, permits, profileOf, rolesSaid, seatedIn, withValidProfile, permittedMutations, proposes, subjectKinds } from "./permissions/policy.js";
30
+ import { actingAs, asBoundTo, bindable, boundPersonOf, grantsTo, isSystem, meIn, meOf, ownsId, permits, profileOf, rolesSaid, seatedIn, seatPersonOf, withValidProfile, permittedMutations, proposes, subjectKinds } from "./permissions/policy.js";
31
31
  import { MOST_PROPOSED, PROPOSE_CHANGES, proposeChangesMutation } from "./mutations/propose-changes.js";
32
32
  import { namesUnseen, redact } from "./ops/withheld.js";
33
33
  import { writersBehind } from "./ops/writers.js";
@@ -327,6 +327,9 @@ export class Store {
327
327
  if (this.mutations.has(mutation.name)) {
328
328
  throw new GraphError(`Duplicate mutation "${mutation.name}"`);
329
329
  }
330
+ // A name the framework keeps for an act of its own is never an app's (`binding-act-taken`): the framework's answers it.
331
+ if (mutation.name === BIND_PERSON)
332
+ continue;
330
333
  this.mutations.set(mutation.name, mutation);
331
334
  }
332
335
  /*
@@ -337,7 +340,7 @@ export class Store {
337
340
  * invariants — and by the policy, through the acts that already write or
338
341
  * create the kind (see `permits`). Nothing an app declares is replaced.
339
342
  */
340
- for (const mutation of options.past ? [] : deriveMutations(options.schema, options.mutations ?? [])) {
343
+ for (const mutation of options.past ? [] : deriveMutations(options.schema, (options.mutations ?? []).filter((mutation) => mutation.name !== BIND_PERSON))) {
341
344
  this.mutations.set(mutation.name, mutation);
342
345
  }
343
346
  // "Keep this link" (FR-172): answered by every store, offered by no list. An app's own `keep-link` keeps its name.
@@ -550,7 +553,7 @@ export class Store {
550
553
  if (name === TYPE_TEXT && !this.typer && TYPING.typeText && !this.past && !this.mutations.has(name))
551
554
  this.mutations.set(name, (this.typer = TYPING.typeText(this)));
552
555
  // "Bind a person" (Roadmap f-invite-binds-existing-person): answered where a kind is the people once the host loads `@graview/core/binding`, and offered by no list.
553
- if (name === BIND_PERSON && !this.binder && BINDING.act && !this.past && !this.mutations.has(name)) {
556
+ if (name === BIND_PERSON && !this.binder && BINDING.act && !this.past) {
554
557
  const binder = BINDING.act(this);
555
558
  if (binder)
556
559
  this.mutations.set(name, (this.binder = binder));
@@ -646,7 +649,7 @@ export class Store {
646
649
  if (mutation !== undefined && mutation === this.typer) {
647
650
  // Through an act that could run on this record now: its module on, its own rule holding for the record as this principal is served it (`wouldRun`).
648
651
  const served = principal === undefined || isSystem(principal) ? this.graph : seenBy(this, principal).graph;
649
- const allows = (writer) => !this.mutationDisabled(writer) && wouldRun(writer, this.schema, served, call?.args["node"], call?.args["field"], principal && meIn(this.schema, principal));
652
+ const allows = (writer) => !this.mutationDisabled(writer) && wouldRun(writer, this.schema, served, call?.args["node"], call?.args["field"], principal && meIn(this.schema, this.seated(principal)));
650
653
  return TYPING.via(this.schema, [...this.mutations.values()], this.subjectKindOf(call, principal), call?.args["field"], allows);
651
654
  }
652
655
  if (!mutation?.derived)
@@ -1469,15 +1472,15 @@ export class Store {
1469
1472
  wouldDo(calls, author = this.by) {
1470
1473
  const as = withValidProfile(author);
1471
1474
  const person = this.personFor(as);
1472
- return person ? this.withPersonMade(as, person.id).compiledEach(calls, as) : this.compiledEach(calls, as);
1475
+ return person ? this.withPersonMade(as).compiledEach(calls, as) : this.compiledEach(calls, as);
1473
1476
  }
1474
1477
  /**
1475
1478
  * THE STORE AS IT WOULD BE WITH A PROFILE'S PERSON MADE: one copy, kept
1476
1479
  * while this store's `version` stands, so every call a face asks of it in
1477
1480
  * one look — each act over every chosen record — is judged on the same copy.
1478
1481
  */
1479
- withPersonMade(author, person) {
1480
- const key = JSON.stringify([this.version, this.log.length, actingAs(author).id, person, profileOf(author)?.name]);
1482
+ withPersonMade(author) {
1483
+ const key = JSON.stringify([this.version, this.log.length, actingAs(author).id, seatPersonOf(author), profileOf(author)?.name]);
1481
1484
  if (this.personMade?.key === key)
1482
1485
  return this.personMade.twin;
1483
1486
  const twin = this.rehearsal();
@@ -1572,7 +1575,7 @@ export class Store {
1572
1575
  wouldApply(call, author, land) {
1573
1576
  const as = withValidProfile(author);
1574
1577
  const person = this.personFor(as);
1575
- const store = person ? this.withPersonMade(as, person.id) : this;
1578
+ const store = person ? this.withPersonMade(as) : this;
1576
1579
  const was = store.rehearsing;
1577
1580
  store.rehearsing = true;
1578
1581
  try {
@@ -1633,7 +1636,7 @@ export class Store {
1633
1636
  judgedAs(author) {
1634
1637
  const as = withValidProfile(author);
1635
1638
  const person = this.personFor(as);
1636
- return person ? this.withPersonMade(as, person.id) : this;
1639
+ return person ? this.withPersonMade(as) : this;
1637
1640
  }
1638
1641
  /**
1639
1642
  * HOW MANY TIMES THIS STORE HAS TOLD ITS SUBSCRIBERS SOMETHING, or would
@@ -2264,6 +2267,10 @@ export class Store {
2264
2267
  throw new UndoBlockedError(seen);
2265
2268
  }
2266
2269
  const check = this.canUndo(ids);
2270
+ // A binding its seat has acted as says so first to the host, which alone takes one back, whatever else stands in the way (Roadmap f-unbind-person).
2271
+ const keptBinding = check.ok || !isSystem(author) ? undefined : this.bindingKept(check.ops);
2272
+ if (keptBinding)
2273
+ this.refuse(keptBinding, author.id, true);
2267
2274
  if (!check.ok) {
2268
2275
  throw new UndoBlockedError(sighted
2269
2276
  ? { ok: false, ops: [], blockedBy: [], includeBatches: [], message: "Cannot undo on its own — a later change you cannot see depends on it, which only somebody who can see it can take back." }
@@ -2343,11 +2350,35 @@ export class Store {
2343
2350
  if (kept)
2344
2351
  return kept.refusal ? { ok: false, refusal: kept.refusal } : { ok: true };
2345
2352
  const check = this.canUndo(batchIds);
2353
+ const keptBinding = check.ok || !isSystem(principal) ? undefined : this.bindingKept(check.ops);
2354
+ if (keptBinding)
2355
+ return { ok: false, refusal: keptBinding };
2356
+ // What stands in the way, as this seat may be told it: in words, judged over what it sees, as `undo` says it.
2346
2357
  if (!check.ok)
2347
- return { ok: false, check };
2358
+ return { ok: false, check: isSystem(principal) ? check : this.toldCheck(check, typeof batchIds === "string" ? [batchIds] : batchIds, principal) };
2348
2359
  const refusal = this.undoRefusal(check.ops, principal);
2349
2360
  return refusal ? { ok: false, refusal } : { ok: true };
2350
2361
  }
2362
+ /** An undo check as a seat other than the host is told it: its sentence, over the log as that seat sees it, and no op. */
2363
+ toldCheck(check, ids, principal) {
2364
+ const sighted = (this.policy?.sees?.length ?? 0) > 0;
2365
+ const seen = sighted ? checkUndo(readingOf(redact(this.log.all(), seatLens(this, principal)), () => this.log.epochs()), ids) : check;
2366
+ const message = seen.ok ? "Cannot undo on its own — a later change you cannot see depends on it, which only somebody who can see it can take back." : seen.message;
2367
+ return { ok: false, ops: [], blockedBy: [], includeBatches: [], message, ...(check.reason ? { reason: check.reason } : {}) };
2368
+ }
2369
+ /** Why a binding among these ops stays (`BINDING.undo`), or nothing. */
2370
+ bindingKept(ops) {
2371
+ for (const target of ops) {
2372
+ // Judged as the change its undo chain begins with, however often it was taken back and put back.
2373
+ const root = this.rootOf(target);
2374
+ if (root.mutation?.name !== BIND_PERSON)
2375
+ continue;
2376
+ const kept = BINDING.undo ? BINDING.undo(this, target, root) : "This binding cannot be taken back here.";
2377
+ if (kept)
2378
+ return { mutation: "undo", wouldNeed: [], message: kept };
2379
+ }
2380
+ return undefined;
2381
+ }
2351
2382
  /** What refuses `author` taking these ops back, or nothing: what you may undo is what you may have done. */
2352
2383
  undoRefusal(ops, author) {
2353
2384
  // Asked of `@graview/core/tidying`; a store that has not loaded it offers no way back it cannot judge.
@@ -2360,13 +2391,9 @@ export class Store {
2360
2391
  * did to whoever is bound there next. Judged by `@graview/core/binding`;
2361
2392
  * a store that has not loaded it takes no binding back.
2362
2393
  */
2363
- for (const target of ops) {
2364
- if (target.undoes !== undefined || target.mutation?.name !== BIND_PERSON)
2365
- continue;
2366
- const kept = BINDING.undo ? BINDING.undo(this, target) : "This binding cannot be taken back here.";
2367
- if (kept)
2368
- return { mutation: "undo", wouldNeed: [], message: kept };
2369
- }
2394
+ const kept = this.bindingKept(ops);
2395
+ if (kept)
2396
+ return kept;
2370
2397
  if (this.policy || this.publisher) {
2371
2398
  for (const target of ops) {
2372
2399
  /*
@@ -2423,7 +2450,10 @@ export class Store {
2423
2450
  * it" is everybody's to run, and undoing Ann's was taking back her vote.
2424
2451
  */
2425
2452
  /* What the act wrote as them: the profile's person, where they were one. */
2426
- const names = (value) => JSON.stringify(value).includes(JSON.stringify(meOf(this.seated(judged.author))));
2453
+ // Or the record the seat was bound to last, where it is bound to none now: what it did is still theirs.
2454
+ const seatOfAuthor = seatPersonOf(judged.author);
2455
+ const doneAs = meOf(this.seated(judged.author)) ?? (seatOfAuthor === undefined ? undefined : everBound(this).get(seatOfAuthor));
2456
+ const names = (value) => doneAs !== undefined && (JSON.stringify(value) ?? "").includes(JSON.stringify(doneAs));
2427
2457
  const verdict = by !== undefined && by !== actingAs(author).id && !isSystem(author) && !names(judged.mutation.args) && names(judged.primitives)
2428
2458
  ? { ok: false, refusal: { mutation: judged.mutation.name, wouldNeed: [], message: "it was done as somebody else." } }
2429
2459
  : this.judged(judged.mutation, author, true);
@@ -2450,27 +2480,35 @@ export class Store {
2450
2480
  return at;
2451
2481
  }
2452
2482
  /**
2453
- * THE RECORD A PROFILE'S PERSON WOULD BE, where one can be made (`meOf`):
2454
- * of the people kind, its name in the kind's name field. As Graview Cloud
2455
- * makes a member's: the id and the name, and where the kind asks for more,
2456
- * none, since nobody is there to answer. And none where this id was ever a
2457
- * record: one removed stays removed.
2483
+ * THE RECORD A PROFILE'S PERSON WOULD BE, where one can be made: of the
2484
+ * people kind, its name in the kind's name field, and the seat as its mark
2485
+ * (`PERSON_SEAT`), which is what ties it to the profile and is served to
2486
+ * that seat and the host alone. Its id is its own (`mintPersonId`, from
2487
+ * the batch it is made in). As Graview Cloud makes a
2488
+ * member's: the id and the name, and where the kind asks for more, none,
2489
+ * since nobody is there to answer. And none where the seat was ever bound
2490
+ * to a record: one removed stays removed, one unbound stays unbound.
2458
2491
  */
2459
- personFor(author) {
2492
+ personFor(author, batch = PREVIEW_BATCH) {
2460
2493
  author = this.seated(author);
2461
2494
  const profile = profileOf(author);
2462
- const id = meOf(author);
2463
- if (!profile || id === undefined)
2495
+ const seat = bindable(author) ? seatPersonOf(author) : undefined;
2496
+ if (!profile || seat === undefined || meOf(author) !== undefined)
2464
2497
  return undefined;
2465
2498
  const people = this.schema.definitions.find((definition) => definition.people);
2466
- if (!people || this.graph.has(id) || recordsOf(this.log).kindOf(id) !== undefined)
2499
+ if (!people || this.graph.personBoundTo(seat) !== undefined || everBound(this).has(seat))
2467
2500
  return undefined;
2501
+ // A record an earlier version made, not yet migrated (`@graview/ship`'s `migrateProfilePeople`): never a second one beside it.
2502
+ const records = recordsOf(this.log);
2503
+ if (this.graph.has(seat) || records.kindOf(seat) !== undefined)
2504
+ return undefined;
2505
+ const id = mintPersonId(people.kind, batch, profile.id, (one) => this.graph.has(one) || records.kindOf(one) !== undefined);
2468
2506
  const fields = people.fields;
2469
2507
  const shape = fields.shape ?? {};
2470
2508
  const words = Object.keys(shape).filter((field) => shape[field].safeParse("x").success && !shape[field].safeParse(1).success);
2471
2509
  const named = words.includes("name") ? "name" : (words.find((field) => !shape[field].safeParse(undefined).success) ?? words[0]);
2472
2510
  const node = { ...people.defaults, id, kind: people.kind, ...(named ? { [named]: profile.name } : {}) };
2473
- return fields.safeParse(node).success ? { id, name: profile.name, node } : undefined;
2511
+ return fields.safeParse(node).success ? { id, name: profile.name, node: { ...node, [PERSON_SEAT]: seat } } : undefined;
2474
2512
  }
2475
2513
  /**
2476
2514
  * A SEAT THAT CAN BE NOBODY HERE, where a kind is the people: a profile with
@@ -2493,10 +2531,10 @@ export class Store {
2493
2531
  if (actingAs(author).id === undefined)
2494
2532
  return kept({ id: "", kind: people.kind });
2495
2533
  const id = meOf(author);
2496
- if (id === undefined)
2534
+ if (id === undefined && !profileOf(author))
2497
2535
  return true;
2498
- const kind = this.graph.getNode(id)?.kind;
2499
- if (kind !== undefined && this.schema.tryDefinition(kind)?.people)
2536
+ const kind = id === undefined ? undefined : this.graph.getNode(id)?.kind;
2537
+ if (id !== undefined && kind !== undefined && this.schema.tryDefinition(kind)?.people)
2500
2538
  return kept({ id, kind });
2501
2539
  if (!profileOf(author))
2502
2540
  return false;
@@ -2509,7 +2547,8 @@ export class Store {
2509
2547
  return true;
2510
2548
  if (this.modules.disabledKinds.has(person.kind) && !isSystem(author))
2511
2549
  return false;
2512
- return this.graph.has(person.id) ? seesId(this, author)(person.id) : sees(this.policy, author, person, { out: () => [], in: () => [] }, recordsOf(this.log), fieldsJudged(this));
2550
+ // A person not made yet is judged as the seat's own: the seat bound to it, as it will be.
2551
+ return this.graph.has(person.id) ? seesId(this, author)(person.id) : sees(this.policy, asBoundTo(author, person.id), person, { out: () => [], in: () => [] }, recordsOf(this.log), fieldsJudged(this));
2513
2552
  }
2514
2553
  /**
2515
2554
  * WHY AN ACT DONE AS `$me` IS NOT THIS SEAT'S: its profile has no person
@@ -2523,7 +2562,7 @@ export class Store {
2523
2562
  }
2524
2563
  /** The op that makes a profile's person on first use: by the account's own hand, so it is what the account made (`own`), and no other's. */
2525
2564
  personToMake(author, batch, options) {
2526
- const person = this.personFor(author);
2565
+ const person = this.personFor(author, batch);
2527
2566
  if (!person)
2528
2567
  return undefined;
2529
2568
  return {