@graview/core 0.2.4 → 0.2.6

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 (248) 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/archived-seen.d.ts.map +1 -1
  6. package/dist/archived-seen.js +1 -0
  7. package/dist/archived-seen.js.map +1 -1
  8. package/dist/arrangement.d.ts +2 -0
  9. package/dist/arrangement.d.ts.map +1 -1
  10. package/dist/arrangement.js +1 -1
  11. package/dist/arrangement.js.map +1 -1
  12. package/dist/arranging.js +2 -2
  13. package/dist/arranging.js.map +1 -1
  14. package/dist/binding-served.d.ts +21 -3
  15. package/dist/binding-served.d.ts.map +1 -1
  16. package/dist/binding-served.js +46 -2
  17. package/dist/binding-served.js.map +1 -1
  18. package/dist/binding-ungranted.d.ts +2 -1
  19. package/dist/binding-ungranted.d.ts.map +1 -1
  20. package/dist/binding-ungranted.js +9 -5
  21. package/dist/binding-ungranted.js.map +1 -1
  22. package/dist/binding.d.ts +14 -0
  23. package/dist/binding.d.ts.map +1 -1
  24. package/dist/binding.js +159 -19
  25. package/dist/binding.js.map +1 -1
  26. package/dist/check.d.ts +3 -0
  27. package/dist/check.d.ts.map +1 -1
  28. package/dist/check.js +3 -0
  29. package/dist/check.js.map +1 -1
  30. package/dist/cited.d.ts +55 -0
  31. package/dist/cited.d.ts.map +1 -0
  32. package/dist/cited.js +48 -0
  33. package/dist/cited.js.map +1 -0
  34. package/dist/cli/check/cites.d.ts +4 -0
  35. package/dist/cli/check/cites.d.ts.map +1 -0
  36. package/dist/cli/check/cites.js +35 -0
  37. package/dist/cli/check/cites.js.map +1 -0
  38. package/dist/cli/check/context-of.d.ts +12 -0
  39. package/dist/cli/check/context-of.d.ts.map +1 -0
  40. package/dist/cli/check/context-of.js +25 -0
  41. package/dist/cli/check/context-of.js.map +1 -0
  42. package/dist/cli/check/index.d.ts +1 -0
  43. package/dist/cli/check/index.d.ts.map +1 -1
  44. package/dist/cli/check/index.js +1 -0
  45. package/dist/cli/check/index.js.map +1 -1
  46. package/dist/cli/check/policy.d.ts +1 -1
  47. package/dist/cli/check/policy.d.ts.map +1 -1
  48. package/dist/cli/check/policy.js +42 -11
  49. package/dist/cli/check/policy.js.map +1 -1
  50. package/dist/cli/check.d.ts.map +1 -1
  51. package/dist/cli/check.js +4 -12
  52. package/dist/cli/check.js.map +1 -1
  53. package/dist/cli/create.d.ts.map +1 -1
  54. package/dist/cli/create.js +7 -1
  55. package/dist/cli/create.js.map +1 -1
  56. package/dist/cli/index.d.ts +1 -1
  57. package/dist/cli/index.d.ts.map +1 -1
  58. package/dist/cli/index.js +42 -3
  59. package/dist/cli/index.js.map +1 -1
  60. package/dist/clock.d.ts +2 -1
  61. package/dist/clock.d.ts.map +1 -1
  62. package/dist/clock.js +2 -2
  63. package/dist/clock.js.map +1 -1
  64. package/dist/compose-change.d.ts +33 -0
  65. package/dist/compose-change.d.ts.map +1 -0
  66. package/dist/compose-change.js +43 -0
  67. package/dist/compose-change.js.map +1 -0
  68. package/dist/compose-home.d.ts +46 -6
  69. package/dist/compose-home.d.ts.map +1 -1
  70. package/dist/compose-home.js +189 -47
  71. package/dist/compose-home.js.map +1 -1
  72. package/dist/compose.d.ts +6 -4
  73. package/dist/compose.d.ts.map +1 -1
  74. package/dist/compose.js +18 -39
  75. package/dist/compose.js.map +1 -1
  76. package/dist/composer-check.d.ts +16 -0
  77. package/dist/composer-check.d.ts.map +1 -0
  78. package/dist/composer-check.js +48 -0
  79. package/dist/composer-check.js.map +1 -0
  80. package/dist/composer.d.ts +19 -0
  81. package/dist/composer.d.ts.map +1 -0
  82. package/dist/composer.js +49 -0
  83. package/dist/composer.js.map +1 -0
  84. package/dist/document/blocks.js +1 -1
  85. package/dist/document/blocks.js.map +1 -1
  86. package/dist/document/compile.d.ts.map +1 -1
  87. package/dist/document/compile.js +10 -6
  88. package/dist/document/compile.js.map +1 -1
  89. package/dist/document/compiled.d.ts.map +1 -1
  90. package/dist/document/compiled.js +6 -0
  91. package/dist/document/compiled.js.map +1 -1
  92. package/dist/document/computed-values.d.ts +4 -1
  93. package/dist/document/computed-values.d.ts.map +1 -1
  94. package/dist/document/computed-values.js +3 -3
  95. package/dist/document/computed-values.js.map +1 -1
  96. package/dist/document/describe-place.js +5 -5
  97. package/dist/document/describe-place.js.map +1 -1
  98. package/dist/document/design-findings.d.ts.map +1 -1
  99. package/dist/document/design-findings.js +2 -1
  100. package/dist/document/design-findings.js.map +1 -1
  101. package/dist/document/edit.d.ts +1 -1
  102. package/dist/document/edit.d.ts.map +1 -1
  103. package/dist/document/edit.js +188 -158
  104. package/dist/document/edit.js.map +1 -1
  105. package/dist/document/expr/evaluate.d.ts +3 -1
  106. package/dist/document/expr/evaluate.d.ts.map +1 -1
  107. package/dist/document/expr/evaluate.js +54 -9
  108. package/dist/document/expr/evaluate.js.map +1 -1
  109. package/dist/document/expr/typing.d.ts.map +1 -1
  110. package/dist/document/expr/typing.js +1 -0
  111. package/dist/document/expr/typing.js.map +1 -1
  112. package/dist/document/expr/when.d.ts +9 -0
  113. package/dist/document/expr/when.d.ts.map +1 -1
  114. package/dist/document/expr/when.js +22 -0
  115. package/dist/document/expr/when.js.map +1 -1
  116. package/dist/document/field-spec.d.ts.map +1 -1
  117. package/dist/document/field-spec.js +6 -1
  118. package/dist/document/field-spec.js.map +1 -1
  119. package/dist/document/format-findings.d.ts.map +1 -1
  120. package/dist/document/format-findings.js +8 -0
  121. package/dist/document/format-findings.js.map +1 -1
  122. package/dist/document/graview-template.d.ts.map +1 -1
  123. package/dist/document/graview-template.js +3 -1
  124. package/dist/document/graview-template.js.map +1 -1
  125. package/dist/document/instantiate-template.d.ts.map +1 -1
  126. package/dist/document/instantiate-template.js +16 -1
  127. package/dist/document/instantiate-template.js.map +1 -1
  128. package/dist/document/rules.d.ts.map +1 -1
  129. package/dist/document/rules.js +13 -9
  130. package/dist/document/rules.js.map +1 -1
  131. package/dist/document/schema.d.ts +5 -0
  132. package/dist/document/schema.d.ts.map +1 -1
  133. package/dist/document/schema.js +7 -0
  134. package/dist/document/schema.js.map +1 -1
  135. package/dist/document/template.d.ts.map +1 -1
  136. package/dist/document/template.js +2 -1
  137. package/dist/document/template.js.map +1 -1
  138. package/dist/document/uncited-findings.d.ts +9 -0
  139. package/dist/document/uncited-findings.d.ts.map +1 -0
  140. package/dist/document/uncited-findings.js +10 -0
  141. package/dist/document/uncited-findings.js.map +1 -0
  142. package/dist/document.schema.json +12 -2
  143. package/dist/graph/graph.d.ts.map +1 -1
  144. package/dist/graph/graph.js +4 -0
  145. package/dist/graph/graph.js.map +1 -1
  146. package/dist/index.d.ts +4 -3
  147. package/dist/index.d.ts.map +1 -1
  148. package/dist/index.js +5 -3
  149. package/dist/index.js.map +1 -1
  150. package/dist/invariants/engine.js +2 -2
  151. package/dist/invariants/engine.js.map +1 -1
  152. package/dist/invariants/types.d.ts +4 -0
  153. package/dist/invariants/types.d.ts.map +1 -1
  154. package/dist/jobs.js +1 -1
  155. package/dist/jobs.js.map +1 -1
  156. package/dist/lines.d.ts.map +1 -1
  157. package/dist/lines.js +3 -2
  158. package/dist/lines.js.map +1 -1
  159. package/dist/linked.js +1 -1
  160. package/dist/linked.js.map +1 -1
  161. package/dist/mutations/define-mutation.d.ts +8 -0
  162. package/dist/mutations/define-mutation.d.ts.map +1 -1
  163. package/dist/mutations/define-mutation.js +23 -1
  164. package/dist/mutations/define-mutation.js.map +1 -1
  165. package/dist/mutations/invalid-arguments.d.ts.map +1 -1
  166. package/dist/mutations/invalid-arguments.js +3 -0
  167. package/dist/mutations/invalid-arguments.js.map +1 -1
  168. package/dist/ops/undo.d.ts.map +1 -1
  169. package/dist/ops/undo.js +18 -3
  170. package/dist/ops/undo.js.map +1 -1
  171. package/dist/past.d.ts.map +1 -1
  172. package/dist/past.js +1 -0
  173. package/dist/past.js.map +1 -1
  174. package/dist/permissions/policy.d.ts +19 -18
  175. package/dist/permissions/policy.d.ts.map +1 -1
  176. package/dist/permissions/policy.js +27 -22
  177. package/dist/permissions/policy.js.map +1 -1
  178. package/dist/permissions/types.d.ts.map +1 -1
  179. package/dist/permissions/types.js +3 -0
  180. package/dist/permissions/types.js.map +1 -1
  181. package/dist/persistence/memory.d.ts.map +1 -1
  182. package/dist/persistence/memory.js +6 -0
  183. package/dist/persistence/memory.js.map +1 -1
  184. package/dist/persistence/sql.d.ts.map +1 -1
  185. package/dist/persistence/sql.js +18 -0
  186. package/dist/persistence/sql.js.map +1 -1
  187. package/dist/persistence/types.d.ts +10 -0
  188. package/dist/persistence/types.d.ts.map +1 -1
  189. package/dist/refused.d.ts.map +1 -1
  190. package/dist/refused.js +3 -0
  191. package/dist/refused.js.map +1 -1
  192. package/dist/scaffold/index.d.ts +1 -1
  193. package/dist/scaffold/index.d.ts.map +1 -1
  194. package/dist/scaffold/index.js +1 -1
  195. package/dist/scaffold/index.js.map +1 -1
  196. package/dist/scaffold/project.d.ts +7 -0
  197. package/dist/scaffold/project.d.ts.map +1 -1
  198. package/dist/scaffold/project.js +21 -2
  199. package/dist/scaffold/project.js.map +1 -1
  200. package/dist/schema/cites.d.ts +30 -0
  201. package/dist/schema/cites.d.ts.map +1 -0
  202. package/dist/schema/cites.js +70 -0
  203. package/dist/schema/cites.js.map +1 -0
  204. package/dist/schema/define-node.d.ts +3 -1
  205. package/dist/schema/define-node.d.ts.map +1 -1
  206. package/dist/schema/define-node.js +12 -3
  207. package/dist/schema/define-node.js.map +1 -1
  208. package/dist/schema/schema.d.ts.map +1 -1
  209. package/dist/schema/schema.js +3 -0
  210. package/dist/schema/schema.js.map +1 -1
  211. package/dist/search.js +1 -1
  212. package/dist/search.js.map +1 -1
  213. package/dist/seen.d.ts +8 -0
  214. package/dist/seen.d.ts.map +1 -1
  215. package/dist/seen.js +2 -2
  216. package/dist/seen.js.map +1 -1
  217. package/dist/shown-list.d.ts +2 -0
  218. package/dist/shown-list.d.ts.map +1 -1
  219. package/dist/shown-list.js +2 -1
  220. package/dist/shown-list.js.map +1 -1
  221. package/dist/store.d.ts +33 -7
  222. package/dist/store.d.ts.map +1 -1
  223. package/dist/store.js +102 -48
  224. package/dist/store.js.map +1 -1
  225. package/dist/subscriptions.d.ts.map +1 -1
  226. package/dist/subscriptions.js +5 -3
  227. package/dist/subscriptions.js.map +1 -1
  228. package/dist/sync/engine.js +1 -1
  229. package/dist/sync/engine.js.map +1 -1
  230. package/dist/tidying.d.ts +2 -0
  231. package/dist/tidying.d.ts.map +1 -1
  232. package/dist/tidying.js +2 -0
  233. package/dist/tidying.js.map +1 -1
  234. package/dist/version.d.ts +1 -1
  235. package/dist/version.js +1 -1
  236. package/dist/who.d.ts.map +1 -1
  237. package/dist/who.js +7 -3
  238. package/dist/who.js.map +1 -1
  239. package/dist/workflows/policies.d.ts +2 -1
  240. package/dist/workflows/policies.d.ts.map +1 -1
  241. package/dist/workflows/policies.js +3 -2
  242. package/dist/workflows/policies.js.map +1 -1
  243. package/dist/workflows/triggered.d.ts.map +1 -1
  244. package/dist/workflows/triggered.js +2 -1
  245. package/dist/workflows/triggered.js.map +1 -1
  246. package/dist/workflows/values.js +1 -1
  247. package/dist/workflows/values.js.map +1 -1
  248. 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";
@@ -20,14 +20,14 @@ import { namesMade, resolveMade } from "./mutations/made.js";
20
20
  import { OperationLog } from "./ops/log.js";
21
21
  import { lineageOf } from "./ops/lineage.js";
22
22
  import { KEEP_LINK, keepLinkMutation, keepLinkVia } from "./mutations/keep-link.js";
23
- import { BIND_PERSON, BINDING } from "./binding-served.js";
23
+ import { BINDING, boundAtHorizon, isBindingAct } from "./binding-served.js";
24
24
  import { PERSON_SEAT } from "./graph/archived.js";
25
25
  import { ActRefusal } from "./refused.js";
26
26
  import { advisoryVoterOf, signedOutSeat, SIGN_IN_TO_VOTE, VOTE_SUGGESTION, VOTING, voteSuggestionMutation } from "./mutations/vote-suggestion.js";
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";
@@ -229,8 +229,12 @@ export class Store {
229
229
  voter;
230
230
  /** "Propose changes" (Roadmap f-proposals-for-review), when the app declared no act by that name. */
231
231
  proposer;
232
- /** "Bind a person" (Roadmap f-invite-binds-existing-person): answered where a kind is the people, offered by no list. */
233
- binder;
232
+ /** "Bind a person" and "Move a person" (Roadmap f-invite-binds-existing-person, f-rebind-after-acting), by name: answered where a kind is the people, offered by no list. */
233
+ binders = new Map();
234
+ /** Whether an act is one `@graview/core/binding` made: judged by it, and offered by no list. */
235
+ isBinder(mutation) {
236
+ return mutation !== undefined && this.binders.get(mutation.name) === mutation;
237
+ }
234
238
  invariants;
235
239
  invariantOptions;
236
240
  policy;
@@ -287,6 +291,18 @@ export class Store {
287
291
  ticked;
288
292
  /** The app's time zone (`StoreOptions.timeZone`): the day today() reads is the date there. */
289
293
  timeZone;
294
+ /** The zone the app declares (`StoreOptions.appTimeZone`): what the rule language reads an instant on. */
295
+ appTimeZone;
296
+ /**
297
+ * THE ZONE THE STORE'S DAY IS IN: the app's, else UTC's where the host
298
+ * gave only its own clock (`timeZone` with `appTimeZone: null`), else none
299
+ * — the clock as it reads. What `today()` says, the day rules are judged
300
+ * on, and the midnight `tickEachDay` turns it at: an app with no zone keeps
301
+ * UTC's day on every host.
302
+ */
303
+ get dayTimeZone() {
304
+ return this.appTimeZone ?? (this.timeZone ? "UTC" : undefined);
305
+ }
290
306
  /** Where this store stands in the past, when it is one (`pastOf`): read, never changed. */
291
307
  past;
292
308
  /** How often `pastOf` keeps a point to fold from, in ops (`StoreOptions.pastEvery`). */
@@ -301,9 +317,10 @@ export class Store {
301
317
  this.invariants = options.invariants ?? [];
302
318
  this.invariantOptions = options.invariantOptions ?? {};
303
319
  this.timeZone = options.timeZone;
320
+ this.appTimeZone = options.appTimeZone === null ? undefined : (options.appTimeZone ?? options.timeZone);
304
321
  // A store that knows its app's zone begins on the day there, so the first turn of the day says what it moved.
305
- if (this.timeZone)
306
- this.ticked = { day: isoToday(this.timeZone), on: isoToday(this.timeZone) };
322
+ if (this.dayTimeZone)
323
+ this.ticked = { day: isoToday(this.dayTimeZone), on: isoToday(this.dayTimeZone) };
307
324
  this.policy = options.policy;
308
325
  this.publishing = options.publishing;
309
326
  this.tidying = options.tidying;
@@ -328,7 +345,7 @@ export class Store {
328
345
  throw new GraphError(`Duplicate mutation "${mutation.name}"`);
329
346
  }
330
347
  // 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)
348
+ if (isBindingAct(mutation.name))
332
349
  continue;
333
350
  this.mutations.set(mutation.name, mutation);
334
351
  }
@@ -340,7 +357,7 @@ export class Store {
340
357
  * invariants — and by the policy, through the acts that already write or
341
358
  * create the kind (see `permits`). Nothing an app declares is replaced.
342
359
  */
343
- for (const mutation of options.past ? [] : deriveMutations(options.schema, (options.mutations ?? []).filter((mutation) => mutation.name !== BIND_PERSON))) {
360
+ for (const mutation of options.past ? [] : deriveMutations(options.schema, (options.mutations ?? []).filter((mutation) => !isBindingAct(mutation.name)))) {
344
361
  this.mutations.set(mutation.name, mutation);
345
362
  }
346
363
  // "Keep this link" (FR-172): answered by every store, offered by no list. An app's own `keep-link` keeps its name.
@@ -552,11 +569,13 @@ export class Store {
552
569
  // "Type text" (Roadmap f-collab-text): answered by every store once `@graview/core/typing` is loaded, and offered by no list.
553
570
  if (name === TYPE_TEXT && !this.typer && TYPING.typeText && !this.past && !this.mutations.has(name))
554
571
  this.mutations.set(name, (this.typer = TYPING.typeText(this)));
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.
556
- if (name === BIND_PERSON && !this.binder && BINDING.act && !this.past) {
557
- const binder = BINDING.act(this);
558
- if (binder)
559
- this.mutations.set(name, (this.binder = binder));
572
+ // "Bind a person" and "Move a person" (Roadmap f-invite-binds-existing-person, f-rebind-after-acting): answered where a kind is the people once the host loads `@graview/core/binding`, and offered by no list.
573
+ if (isBindingAct(name) && !this.binders.has(name) && BINDING.act && !this.past) {
574
+ const binder = BINDING.act(this, name);
575
+ if (binder) {
576
+ this.binders.set(name, binder);
577
+ this.mutations.set(name, binder);
578
+ }
560
579
  }
561
580
  return this.mutations.has(name) ? name : (actSpelledAs(name, this.mutations.keys()) ?? name);
562
581
  }
@@ -633,7 +652,7 @@ export class Store {
633
652
  return mutation.derived !== undefined && this.modules.disabledKinds.has(mutation.derived.kind);
634
653
  }
635
654
  allMutations() {
636
- return [...this.mutations.values(), ...(this.publisher ? [this.publisher] : [])].filter((mutation) => mutation !== this.keeper && mutation !== this.typer && mutation !== this.voter && mutation !== this.proposer && mutation !== this.binder && !this.mutationDisabled(mutation));
655
+ return [...this.mutations.values(), ...(this.publisher ? [this.publisher] : [])].filter((mutation) => mutation !== this.keeper && mutation !== this.typer && mutation !== this.voter && mutation !== this.proposer && !this.isBinder(mutation) && !this.mutationDisabled(mutation));
637
656
  }
638
657
  /** The declared acts a derived act resolves its permission through; keeping a link, those that make or break its relation. */
639
658
  viaOf(mutation, call, principal) {
@@ -649,7 +668,7 @@ export class Store {
649
668
  if (mutation !== undefined && mutation === this.typer) {
650
669
  // 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`).
651
670
  const served = principal === undefined || isSystem(principal) ? this.graph : seenBy(this, principal).graph;
652
- const allows = (writer) => !this.mutationDisabled(writer) && wouldRun(writer, this.schema, served, call?.args["node"], call?.args["field"], principal && meIn(this.schema, principal));
671
+ const allows = (writer) => !this.mutationDisabled(writer) && wouldRun(writer, this.schema, served, call?.args["node"], call?.args["field"], principal && meIn(this.schema, this.seated(principal)));
653
672
  return TYPING.via(this.schema, [...this.mutations.values()], this.subjectKindOf(call, principal), call?.args["field"], allows);
654
673
  }
655
674
  if (!mutation?.derived)
@@ -743,7 +762,7 @@ export class Store {
743
762
  if (nobody)
744
763
  return { ok: false, refusal: nobody };
745
764
  // Binding a seat to a person is judged by `@graview/core/binding`, which made the act: the host, or a grant that names it.
746
- if (mutation && mutation === this.binder)
765
+ if (mutation && this.isBinder(mutation))
747
766
  return BINDING.judged(this, call, principal);
748
767
  // Publishing is the declaration's `publishers`, not a grant's.
749
768
  if (mutation && mutation === this.publisher)
@@ -827,7 +846,7 @@ export class Store {
827
846
  return false;
828
847
  call = this.spelledCall(call);
829
848
  const mutation = this.mutations.get(call.name);
830
- if (!mutation || mutation === this.proposer || mutation === this.voter || mutation === this.binder || this.refusesAgent(call, principal) || this.namesTurnedOff(call, principal))
849
+ if (!mutation || mutation === this.proposer || mutation === this.voter || this.isBinder(mutation) || this.refusesAgent(call, principal) || this.namesTurnedOff(call, principal))
831
850
  return false;
832
851
  return !this.permits(call, principal).ok && proposes(this.policy, principal, call.name, this.subjectKindOf(call, principal));
833
852
  }
@@ -1313,7 +1332,8 @@ export class Store {
1313
1332
  * that day, and an app in New York about New York's.
1314
1333
  */
1315
1334
  today() {
1316
- return this.pinned() ?? (this.ticked && this.ticked.on === isoToday(this.timeZone) ? this.ticked.day : undefined) ?? (this.timeZone ? isoToday(this.timeZone) : undefined);
1335
+ const zone = this.dayTimeZone;
1336
+ return this.pinned() ?? (this.ticked && this.ticked.on === isoToday(zone) ? this.ticked.day : undefined) ?? (zone ? isoToday(zone) : undefined);
1317
1337
  }
1318
1338
  /** The day `invariantOptions` pins, if it pins one: a tick does not move it. */
1319
1339
  pinned() {
@@ -1331,7 +1351,7 @@ export class Store {
1331
1351
  // A rule written as a function reads the day from its context too, as `openStore` handed it (W-186): the app's, where the store knows its zone and the call hands no context of its own.
1332
1352
  const base = linking ?? given;
1333
1353
  const judged = this.timeZone && today !== undefined && context === undefined && !(base && "today" in base) ? { ...base, today } : linking;
1334
- return { ...this.invariantOptions, ...(judged === undefined ? {} : { context: judged }), ...(today === undefined ? {} : { today }) };
1354
+ return { ...this.invariantOptions, ...(judged === undefined ? {} : { context: judged }), ...(today === undefined ? {} : { today }), ...(this.appTimeZone && this.invariantOptions.timeZone === undefined ? { timeZone: this.appTimeZone } : {}) };
1335
1355
  }
1336
1356
  /**
1337
1357
  * THE DAY TURNED (FR-176). Rules are judged on every change and once on
@@ -1357,8 +1377,8 @@ export class Store {
1357
1377
  const pinned = this.pinned();
1358
1378
  if (pinned !== undefined)
1359
1379
  return { day: pinned, was: pinned, appeared: [], cleared: [] };
1360
- const day = dayOf(now, this.timeZone);
1361
- const on = isoToday(this.timeZone);
1380
+ const day = dayOf(now, this.dayTimeZone);
1381
+ const on = isoToday(this.dayTimeZone);
1362
1382
  // What stood is judged on the day the store was last ticked to, even when the clock has just left it: the turn at midnight says what it moved.
1363
1383
  if (this.ticked)
1364
1384
  this.ticked = { day: this.ticked.day, on };
@@ -1472,15 +1492,15 @@ export class Store {
1472
1492
  wouldDo(calls, author = this.by) {
1473
1493
  const as = withValidProfile(author);
1474
1494
  const person = this.personFor(as);
1475
- return person ? this.withPersonMade(as, person.id).compiledEach(calls, as) : this.compiledEach(calls, as);
1495
+ return person ? this.withPersonMade(as).compiledEach(calls, as) : this.compiledEach(calls, as);
1476
1496
  }
1477
1497
  /**
1478
1498
  * THE STORE AS IT WOULD BE WITH A PROFILE'S PERSON MADE: one copy, kept
1479
1499
  * while this store's `version` stands, so every call a face asks of it in
1480
1500
  * one look — each act over every chosen record — is judged on the same copy.
1481
1501
  */
1482
- withPersonMade(author, person) {
1483
- const key = JSON.stringify([this.version, this.log.length, actingAs(author).id, person, profileOf(author)?.name]);
1502
+ withPersonMade(author) {
1503
+ const key = JSON.stringify([this.version, this.log.length, actingAs(author).id, seatPersonOf(author), profileOf(author)?.name]);
1484
1504
  if (this.personMade?.key === key)
1485
1505
  return this.personMade.twin;
1486
1506
  const twin = this.rehearsal();
@@ -1509,7 +1529,7 @@ export class Store {
1509
1529
  permittedTo(call, as) {
1510
1530
  // A vote is judged with no policy too: a shared seat's vote is refused whether or not the app says who may do what (Roadmap f-votes-shared-seat).
1511
1531
  const voting = this.voter !== undefined && this.mutations.get(call.name) === this.voter;
1512
- const binding = this.binder !== undefined && this.mutations.get(call.name) === this.binder;
1532
+ const binding = this.isBinder(this.mutations.get(call.name));
1513
1533
  const verdict = this.policy || (this.publisher && call.name === PUBLISH) || voting || binding || this.mutations.get(call.name) === this.proposer ? this.judged(call, as) : undefined;
1514
1534
  // Rehearsing a proposal, an act its author may propose stands as the reviewer's would (Roadmap f-proposals-for-review).
1515
1535
  if (verdict && !verdict.ok && !(this.proposing && this.mayPropose(call, as)))
@@ -1532,7 +1552,7 @@ export class Store {
1532
1552
  if (missing)
1533
1553
  throw missing;
1534
1554
  // An act takes only the kinds it names: its subject's, and each record argument's. Binding a person says its own refusal.
1535
- if (definition !== this.binder)
1555
+ if (!this.isBinder(definition))
1536
1556
  this.keepsToItsKinds(definition, call);
1537
1557
  let compiled;
1538
1558
  try {
@@ -1545,7 +1565,7 @@ export class Store {
1545
1565
  throw error;
1546
1566
  }
1547
1567
  // Whose record a person is, only binding says (Roadmap f-invite-binds-existing-person): no other act writes the mark.
1548
- if (definition !== this.binder && compiled.primitives.some((one) => (one.op === "add-node" && Object.hasOwn(one.node, PERSON_SEAT)) || (one.op === "patch-node" && Object.hasOwn(one.after, PERSON_SEAT)))) {
1568
+ if (!this.isBinder(definition) && compiled.primitives.some((one) => (one.op === "add-node" && Object.hasOwn(one.node, PERSON_SEAT)) || (one.op === "patch-node" && Object.hasOwn(one.after, PERSON_SEAT)))) {
1549
1569
  throw new ActRefusal(`"${definition.title ?? definition.name}" cannot say whose record a person is: only binding an account to it does.`);
1550
1570
  }
1551
1571
  if (isAutomated(as)) {
@@ -1575,7 +1595,7 @@ export class Store {
1575
1595
  wouldApply(call, author, land) {
1576
1596
  const as = withValidProfile(author);
1577
1597
  const person = this.personFor(as);
1578
- const store = person ? this.withPersonMade(as, person.id) : this;
1598
+ const store = person ? this.withPersonMade(as) : this;
1579
1599
  const was = store.rehearsing;
1580
1600
  store.rehearsing = true;
1581
1601
  try {
@@ -1636,7 +1656,7 @@ export class Store {
1636
1656
  judgedAs(author) {
1637
1657
  const as = withValidProfile(author);
1638
1658
  const person = this.personFor(as);
1639
- return person ? this.withPersonMade(as, person.id) : this;
1659
+ return person ? this.withPersonMade(as) : this;
1640
1660
  }
1641
1661
  /**
1642
1662
  * HOW MANY TIMES THIS STORE HAS TOLD ITS SUBSCRIBERS SOMETHING, or would
@@ -2366,12 +2386,31 @@ export class Store {
2366
2386
  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
2387
  return { ok: false, ops: [], blockedBy: [], includeBatches: [], message, ...(check.reason ? { reason: check.reason } : {}) };
2368
2388
  }
2389
+ /** The record a seat was bound to just before `seq`: from the bindings where the log begins, through every one it holds since. Undefined where it was bound to none. */
2390
+ boundWhen(seat, seq) {
2391
+ let record = [...boundAtHorizon(this)].find(([, one]) => one === seat)?.[0];
2392
+ for (const op of this.log.all()) {
2393
+ if (op.seq >= seq)
2394
+ break;
2395
+ for (const primitive of op.primitives) {
2396
+ if (primitive.op === "add-node" && primitive.node[PERSON_SEAT] === seat)
2397
+ record = primitive.node.id;
2398
+ else if (primitive.op === "patch-node" && Object.hasOwn(primitive.after, PERSON_SEAT)) {
2399
+ if (primitive.after[PERSON_SEAT] === seat)
2400
+ record = primitive.id;
2401
+ else if (record === primitive.id)
2402
+ record = undefined;
2403
+ }
2404
+ }
2405
+ }
2406
+ return record;
2407
+ }
2369
2408
  /** Why a binding among these ops stays (`BINDING.undo`), or nothing. */
2370
2409
  bindingKept(ops) {
2371
2410
  for (const target of ops) {
2372
2411
  // Judged as the change its undo chain begins with, however often it was taken back and put back.
2373
2412
  const root = this.rootOf(target);
2374
- if (root.mutation?.name !== BIND_PERSON)
2413
+ if (!isBindingAct(root.mutation?.name))
2375
2414
  continue;
2376
2415
  const kept = BINDING.undo ? BINDING.undo(this, target, root) : "This binding cannot be taken back here.";
2377
2416
  if (kept)
@@ -2450,7 +2489,13 @@ export class Store {
2450
2489
  * it" is everybody's to run, and undoing Ann's was taking back her vote.
2451
2490
  */
2452
2491
  /* What the act wrote as them: the profile's person, where they were one. */
2453
- const names = (value) => JSON.stringify(value).includes(JSON.stringify(meOf(this.seated(judged.author))));
2492
+ // Or the record the seat was bound to last, where it is bound to none now: what it did is still theirs.
2493
+ const seatOfAuthor = seatPersonOf(judged.author);
2494
+ const doneAs = meOf(this.seated(judged.author)) ?? (seatOfAuthor === undefined ? undefined : everBound(this).get(seatOfAuthor));
2495
+ // And the record it was done as then: a person moved to another record since still did what they did as the first (Roadmap f-rebind-after-acting).
2496
+ const doneAsThen = seatOfAuthor === undefined ? undefined : this.boundWhen(seatOfAuthor, judged.seq);
2497
+ const named = (value, id) => id !== undefined && (JSON.stringify(value) ?? "").includes(JSON.stringify(id));
2498
+ const names = (value) => named(value, doneAs) || (doneAsThen !== doneAs && named(value, doneAsThen));
2454
2499
  const verdict = by !== undefined && by !== actingAs(author).id && !isSystem(author) && !names(judged.mutation.args) && names(judged.primitives)
2455
2500
  ? { ok: false, refusal: { mutation: judged.mutation.name, wouldNeed: [], message: "it was done as somebody else." } }
2456
2501
  : this.judged(judged.mutation, author, true);
@@ -2477,27 +2522,35 @@ export class Store {
2477
2522
  return at;
2478
2523
  }
2479
2524
  /**
2480
- * THE RECORD A PROFILE'S PERSON WOULD BE, where one can be made (`meOf`):
2481
- * of the people kind, its name in the kind's name field. As Graview Cloud
2482
- * makes a member's: the id and the name, and where the kind asks for more,
2483
- * none, since nobody is there to answer. And none where this id was ever a
2484
- * record: one removed stays removed.
2525
+ * THE RECORD A PROFILE'S PERSON WOULD BE, where one can be made: of the
2526
+ * people kind, its name in the kind's name field, and the seat as its mark
2527
+ * (`PERSON_SEAT`), which is what ties it to the profile and is served to
2528
+ * that seat and the host alone. Its id is its own (`mintPersonId`, from
2529
+ * the batch it is made in). As Graview Cloud makes a
2530
+ * member's: the id and the name, and where the kind asks for more, none,
2531
+ * since nobody is there to answer. And none where the seat was ever bound
2532
+ * to a record: one removed stays removed, one unbound stays unbound.
2485
2533
  */
2486
- personFor(author) {
2534
+ personFor(author, batch = PREVIEW_BATCH) {
2487
2535
  author = this.seated(author);
2488
2536
  const profile = profileOf(author);
2489
- const id = meOf(author);
2490
- if (!profile || id === undefined)
2537
+ const seat = bindable(author) ? seatPersonOf(author) : undefined;
2538
+ if (!profile || seat === undefined || meOf(author) !== undefined)
2491
2539
  return undefined;
2492
2540
  const people = this.schema.definitions.find((definition) => definition.people);
2493
- if (!people || this.graph.has(id) || recordsOf(this.log).kindOf(id) !== undefined)
2541
+ if (!people || this.graph.personBoundTo(seat) !== undefined || everBound(this).has(seat))
2494
2542
  return undefined;
2543
+ // A record an earlier version made, not yet migrated (`@graview/ship`'s `migrateProfilePeople`): never a second one beside it.
2544
+ const records = recordsOf(this.log);
2545
+ if (this.graph.has(seat) || records.kindOf(seat) !== undefined)
2546
+ return undefined;
2547
+ const id = mintPersonId(people.kind, batch, profile.id, (one) => this.graph.has(one) || records.kindOf(one) !== undefined);
2495
2548
  const fields = people.fields;
2496
2549
  const shape = fields.shape ?? {};
2497
2550
  const words = Object.keys(shape).filter((field) => shape[field].safeParse("x").success && !shape[field].safeParse(1).success);
2498
2551
  const named = words.includes("name") ? "name" : (words.find((field) => !shape[field].safeParse(undefined).success) ?? words[0]);
2499
2552
  const node = { ...people.defaults, id, kind: people.kind, ...(named ? { [named]: profile.name } : {}) };
2500
- return fields.safeParse(node).success ? { id, name: profile.name, node } : undefined;
2553
+ return fields.safeParse(node).success ? { id, name: profile.name, node: { ...node, [PERSON_SEAT]: seat } } : undefined;
2501
2554
  }
2502
2555
  /**
2503
2556
  * A SEAT THAT CAN BE NOBODY HERE, where a kind is the people: a profile with
@@ -2520,10 +2573,10 @@ export class Store {
2520
2573
  if (actingAs(author).id === undefined)
2521
2574
  return kept({ id: "", kind: people.kind });
2522
2575
  const id = meOf(author);
2523
- if (id === undefined)
2576
+ if (id === undefined && !profileOf(author))
2524
2577
  return true;
2525
- const kind = this.graph.getNode(id)?.kind;
2526
- if (kind !== undefined && this.schema.tryDefinition(kind)?.people)
2578
+ const kind = id === undefined ? undefined : this.graph.getNode(id)?.kind;
2579
+ if (id !== undefined && kind !== undefined && this.schema.tryDefinition(kind)?.people)
2527
2580
  return kept({ id, kind });
2528
2581
  if (!profileOf(author))
2529
2582
  return false;
@@ -2536,7 +2589,8 @@ export class Store {
2536
2589
  return true;
2537
2590
  if (this.modules.disabledKinds.has(person.kind) && !isSystem(author))
2538
2591
  return false;
2539
- return this.graph.has(person.id) ? seesId(this, author)(person.id) : sees(this.policy, author, person, { out: () => [], in: () => [] }, recordsOf(this.log), fieldsJudged(this));
2592
+ // A person not made yet is judged as the seat's own: the seat bound to it, as it will be.
2593
+ 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));
2540
2594
  }
2541
2595
  /**
2542
2596
  * WHY AN ACT DONE AS `$me` IS NOT THIS SEAT'S: its profile has no person
@@ -2550,7 +2604,7 @@ export class Store {
2550
2604
  }
2551
2605
  /** 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. */
2552
2606
  personToMake(author, batch, options) {
2553
- const person = this.personFor(author);
2607
+ const person = this.personFor(author, batch);
2554
2608
  if (!person)
2555
2609
  return undefined;
2556
2610
  return {