@agentshouse/mdruntime 0.1.0-cd26b960b7262 → 0.1.0-cd35ccee27a19

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 (153) hide show
  1. package/dist/acceptance.d.ts +0 -3
  2. package/dist/acceptance.d.ts.map +1 -1
  3. package/dist/acceptance.js +58 -135
  4. package/dist/actions.js +5 -5
  5. package/dist/adapter.d.ts +26 -45
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/bootstrap.d.ts +1 -1
  8. package/dist/bootstrap.d.ts.map +1 -1
  9. package/dist/bootstrap.js +6 -19
  10. package/dist/change-set.d.ts +4 -0
  11. package/dist/change-set.d.ts.map +1 -1
  12. package/dist/change-set.js +6 -0
  13. package/dist/client.d.ts +4 -11
  14. package/dist/client.d.ts.map +1 -1
  15. package/dist/client.js +21 -8
  16. package/dist/collection.d.ts +22 -4
  17. package/dist/collection.d.ts.map +1 -1
  18. package/dist/collection.js +12 -2
  19. package/dist/connection.d.ts.map +1 -1
  20. package/dist/connection.js +17 -13
  21. package/dist/conversation-live.d.ts +5 -5
  22. package/dist/conversation-live.d.ts.map +1 -1
  23. package/dist/conversation-live.js +7 -6
  24. package/dist/conversation.d.ts +18 -6
  25. package/dist/conversation.d.ts.map +1 -1
  26. package/dist/conversation.js +115 -82
  27. package/dist/declaration.d.ts +10 -0
  28. package/dist/declaration.d.ts.map +1 -0
  29. package/dist/declaration.js +24 -0
  30. package/dist/discovery.d.ts.map +1 -1
  31. package/dist/discovery.js +11 -38
  32. package/dist/failure.d.ts +1 -0
  33. package/dist/failure.d.ts.map +1 -1
  34. package/dist/failure.js +3 -0
  35. package/dist/host.d.ts +17 -2
  36. package/dist/host.d.ts.map +1 -1
  37. package/dist/host.js +34 -4
  38. package/dist/index.d.ts +6 -4
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +4 -2
  41. package/dist/install.d.ts +0 -2
  42. package/dist/install.d.ts.map +1 -1
  43. package/dist/install.js +47 -63
  44. package/dist/lifecycle.d.ts +1 -1
  45. package/dist/lifecycle.d.ts.map +1 -1
  46. package/dist/lifecycle.js +28 -24
  47. package/dist/listing.d.ts +6 -11
  48. package/dist/listing.d.ts.map +1 -1
  49. package/dist/listing.js +25 -62
  50. package/dist/live.d.ts.map +1 -1
  51. package/dist/live.js +3 -1
  52. package/dist/locks.d.ts +2 -4
  53. package/dist/locks.d.ts.map +1 -1
  54. package/dist/locks.js +10 -38
  55. package/dist/lost.d.ts.map +1 -1
  56. package/dist/lost.js +10 -21
  57. package/dist/memory.d.ts +4 -2
  58. package/dist/memory.d.ts.map +1 -1
  59. package/dist/memory.js +22 -9
  60. package/dist/messages.d.ts +0 -3
  61. package/dist/messages.d.ts.map +1 -1
  62. package/dist/messages.js +5 -17
  63. package/dist/model.d.ts +0 -1
  64. package/dist/model.d.ts.map +1 -1
  65. package/dist/model.js +0 -5
  66. package/dist/models.d.ts +4 -8
  67. package/dist/models.d.ts.map +1 -1
  68. package/dist/models.js +97 -136
  69. package/dist/opened.d.ts +1 -1
  70. package/dist/opened.d.ts.map +1 -1
  71. package/dist/opened.js +2 -2
  72. package/dist/opening.d.ts.map +1 -1
  73. package/dist/opening.js +6 -4
  74. package/dist/overlay.d.ts +2 -1
  75. package/dist/overlay.d.ts.map +1 -1
  76. package/dist/overlay.js +32 -21
  77. package/dist/page-metadata.d.ts +8 -0
  78. package/dist/page-metadata.d.ts.map +1 -0
  79. package/dist/page-metadata.js +19 -0
  80. package/dist/parts.d.ts +3 -52
  81. package/dist/parts.d.ts.map +1 -1
  82. package/dist/parts.js +15 -120
  83. package/dist/preparation.d.ts.map +1 -1
  84. package/dist/preparation.js +20 -13
  85. package/dist/presence.d.ts +52 -0
  86. package/dist/presence.d.ts.map +1 -0
  87. package/dist/presence.js +220 -0
  88. package/dist/queries.d.ts.map +1 -1
  89. package/dist/queries.js +4 -6
  90. package/dist/queue.d.ts +40 -0
  91. package/dist/queue.d.ts.map +1 -0
  92. package/dist/queue.js +455 -0
  93. package/dist/reach.d.ts.map +1 -1
  94. package/dist/reach.js +23 -4
  95. package/dist/reads.d.ts.map +1 -1
  96. package/dist/reads.js +4 -1
  97. package/dist/refresh.js +2 -2
  98. package/dist/refusal.d.ts.map +1 -1
  99. package/dist/refusal.js +5 -3
  100. package/dist/replica.d.ts +5 -11
  101. package/dist/replica.d.ts.map +1 -1
  102. package/dist/replica.js +12 -14
  103. package/dist/room-draft.d.ts +3 -3
  104. package/dist/room-draft.d.ts.map +1 -1
  105. package/dist/room-draft.js +33 -49
  106. package/dist/room-drafts.js +3 -3
  107. package/dist/rows.d.ts.map +1 -1
  108. package/dist/rows.js +3 -4
  109. package/dist/runtime.d.ts +7 -16
  110. package/dist/runtime.d.ts.map +1 -1
  111. package/dist/save.d.ts +41 -90
  112. package/dist/save.d.ts.map +1 -1
  113. package/dist/save.js +220 -110
  114. package/dist/saves.d.ts +2 -40
  115. package/dist/saves.d.ts.map +1 -1
  116. package/dist/saves.js +106 -698
  117. package/dist/seed.js +2 -2
  118. package/dist/shown.d.ts +4 -3
  119. package/dist/shown.d.ts.map +1 -1
  120. package/dist/shown.js +24 -26
  121. package/dist/socket.d.ts +0 -3
  122. package/dist/socket.d.ts.map +1 -1
  123. package/dist/socket.js +0 -5
  124. package/dist/store/records.d.ts +2 -2
  125. package/dist/store/records.d.ts.map +1 -1
  126. package/dist/store/records.js +2 -3
  127. package/dist/store.d.ts +8 -5
  128. package/dist/store.d.ts.map +1 -1
  129. package/dist/store.js +32 -12
  130. package/dist/stored.d.ts.map +1 -1
  131. package/dist/stored.js +3 -3
  132. package/dist/surface.d.ts.map +1 -1
  133. package/dist/surface.js +8 -8
  134. package/dist/sync.d.ts.map +1 -1
  135. package/dist/sync.js +55 -66
  136. package/dist/tables.d.ts +0 -4
  137. package/dist/tables.d.ts.map +1 -1
  138. package/dist/tables.js +1 -4
  139. package/dist/validation.d.ts.map +1 -1
  140. package/dist/validation.js +2 -2
  141. package/dist/wire.d.ts +40 -4
  142. package/dist/wire.d.ts.map +1 -1
  143. package/dist/wire.js +12 -3
  144. package/package.json +3 -2
  145. package/dist/job.d.ts +0 -33
  146. package/dist/job.d.ts.map +0 -1
  147. package/dist/job.js +0 -54
  148. package/dist/socket/rooms.d.ts +0 -44
  149. package/dist/socket/rooms.d.ts.map +0 -1
  150. package/dist/socket/rooms.js +0 -90
  151. package/dist/store/fences.d.ts +0 -16
  152. package/dist/store/fences.d.ts.map +0 -1
  153. package/dist/store/fences.js +0 -26
package/dist/save.js CHANGED
@@ -1,11 +1,11 @@
1
- import { definitionOf } from './model.js';
2
- import { apply, ARRAY_INDEX, ATTACHMENT, links, parse, pointerSegments, references, relative, relativize, retarget, roomReferences, serialize, target, } from '@agentshouse/mdmodel';
1
+ import { apply, ARRAY_INDEX, ATTACHMENT, create, links, parse, pointerSegments, references, relative, relativize, retarget, roomReferences, serialize, target, } from '@agentshouse/mdmodel';
3
2
  import { immutable, leaving, queuedFile, departure, } from './change.js';
4
- import { collectionOf, documentsOf, governing, } from './collection.js';
5
- import { changeBatchIdentity } from './identity.js';
3
+ import { collectionOf, definitionsAt, documentsOf, governing, } from './collection.js';
4
+ import { changeBatchIdentity, roomDraftRevision } from './identity.js';
6
5
  import { overlaying } from './overlay.js';
7
- import { ancestors, authoredAt, covered, normalize } from './paths.js';
6
+ import { ancestors } from './paths.js';
8
7
  import { entriesIn, sorting } from './shared.js';
8
+ import { changedParts, changesOf, moveTarget, withdrawnDrafts, } from './room-draft.js';
9
9
  import { paced, ROW_WEIGHT, stepped } from './turn.js';
10
10
  import { validatedCollection } from './validation.js';
11
11
  function refuse(code, file, location) {
@@ -42,13 +42,13 @@ function repointed(document, definition, from, to, moves, settled) {
42
42
  }
43
43
  if (changes.length === 0)
44
44
  return [];
45
- const applied = apply(document, changes);
45
+ const applied = apply(document, changes, definition);
46
46
  if (applied.outcome !== 'applied')
47
47
  return [];
48
48
  const next = applied.document;
49
49
  return [...names].map((name) => ({ kind: 'field', path: from, name, value: next.fields[name] }));
50
50
  }
51
- function edited(document, changes) {
51
+ function edited(document, changes, definition) {
52
52
  const parts = new Map();
53
53
  for (const change of changes) {
54
54
  if (change.kind === 'preamble')
@@ -63,7 +63,7 @@ function edited(document, changes) {
63
63
  }
64
64
  if (parts.size === 0)
65
65
  return document;
66
- const applied = apply(document, [...parts.values()]);
66
+ const applied = apply(document, [...parts.values()], definition);
67
67
  return applied.outcome === 'applied' ? applied.document : document;
68
68
  }
69
69
  function bodies(path, before, after) {
@@ -78,7 +78,7 @@ function bodies(path, before, after) {
78
78
  }
79
79
  return changes;
80
80
  }
81
- function relinks(path, moved, before, moves) {
81
+ function relinks(path, moved, before, moves, definition) {
82
82
  const changes = [];
83
83
  for (const link of links(before, path)) {
84
84
  const destination = moves.get(link.target) ?? link.target;
@@ -91,7 +91,7 @@ function relinks(path, moved, before, moves) {
91
91
  }
92
92
  if (changes.length === 0)
93
93
  return { kind: 'changes', changes: [] };
94
- const applied = apply(before, changes);
94
+ const applied = apply(before, changes, definition);
95
95
  if (applied.outcome === 'refuse') {
96
96
  return {
97
97
  kind: 'refused',
@@ -155,13 +155,13 @@ function* rewrites(changes, visible) {
155
155
  if (settled.has(path))
156
156
  continue;
157
157
  const moved = moves.get(path) ?? path;
158
- const definition = definitionOf(governing(visible.collection.composition, path), document.type);
158
+ const definition = definitionsAt(visible.collection.composition, path)(document.type);
159
159
  const repointing = repointed(document, definition, path, moved, moves, settled);
160
160
  added.push(...repointing);
161
161
  const own = parts.get(path) ?? [];
162
162
  const relinked = moved === path && own.length === 0 && cannotLink(document.content, names)
163
163
  ? { kind: 'changes', changes: [] }
164
- : relinks(path, moved, edited(document, own.map((index) => merged[index])), moves);
164
+ : relinks(path, moved, edited(document, own.map((index) => merged[index]), definition), moves, definition);
165
165
  if (relinked.kind === 'refused')
166
166
  return relinked;
167
167
  const keyed = new Map();
@@ -230,10 +230,10 @@ function crossed(document, definition, path, to) {
230
230
  }
231
231
  return changes;
232
232
  }
233
- function rewritten(path, document, changes) {
233
+ function rewritten(path, document, changes, definition) {
234
234
  if (changes.length === 0)
235
235
  return [];
236
- const applied = apply(document, changes);
236
+ const applied = apply(document, changes, definition);
237
237
  if (applied.outcome !== 'applied')
238
238
  return [];
239
239
  const after = applied.document;
@@ -248,7 +248,7 @@ function rewritten(path, document, changes) {
248
248
  function roomPathOf(handle, path) {
249
249
  return `/rooms/${handle}/${path}`;
250
250
  }
251
- export function* leavingRewritten(batch, visible) {
251
+ function* leavingRewritten(batch, visible) {
252
252
  const between = batch.between;
253
253
  if (between === undefined)
254
254
  return batch;
@@ -257,8 +257,8 @@ export function* leavingRewritten(batch, visible) {
257
257
  for (const [path, document] of yield* documentsOf(visible.collection)) {
258
258
  if (moved.has(path))
259
259
  continue;
260
- const definition = definitionOf(governing(visible.collection.composition, path), document.type);
261
- derived.push(...rewritten(path, document, crossed(document, definition, path, (named) => moved.get(named))));
260
+ const definition = definitionsAt(visible.collection.composition, path)(document.type);
261
+ derived.push(...rewritten(path, document, crossed(document, definition, path, (named) => moved.get(named)), definition));
262
262
  yield ROW_WEIGHT + visible.collection.text[path].length;
263
263
  }
264
264
  if (derived.length === 0)
@@ -300,7 +300,7 @@ function* incoming(collection, removed, candidates) {
300
300
  for (const [path, document] of candidates === null
301
301
  ? yield* documentsOf(collection)
302
302
  : read(candidates)) {
303
- const definition = definitionOf(governing(collection.composition, path), document.type);
303
+ const definition = definitionsAt(collection.composition, path)(document.type);
304
304
  for (const { value, to } of definition === undefined ? [] : references(document, definition)) {
305
305
  if (to.includes(ATTACHMENT))
306
306
  continue;
@@ -343,18 +343,9 @@ function guard(changes, input, removing) {
343
343
  const occupied = (path) => input.folders.has(path) ? path : (ancestors(path).find((one) => existing.has(one)) ?? null);
344
344
  for (const [index, change] of changes.entries()) {
345
345
  for (const path of affected(change)) {
346
- const normalized = normalize(path);
347
- if (normalized === null || normalized === '')
348
- return refuse('room-root', path);
349
- if (covered(input.providerOwnedPaths, normalized) ||
350
- (input.authoredPaths !== undefined && !authoredAt(input.authoredPaths, normalized))) {
351
- return refuse('provider-owned-path', normalized);
352
- }
353
- if (!input.pathRule(normalized))
354
- return refuse('invalid-path', normalized);
355
- for (const operation of change.kind === 'remove' ? removing : WRITE)
356
- if (!input.local && !covered(input.operations[operation], normalized))
357
- return refuse(`${operation}-grant`, normalized);
346
+ const refused = input.rule(path, change.kind === 'remove' ? removing : WRITE);
347
+ if (refused !== null)
348
+ return refuse(refused.code, refused.path);
358
349
  }
359
350
  if (change.kind === 'create' || change.kind === 'arrival') {
360
351
  const taken = existing.has(change.path) ? change.path : occupied(change.path);
@@ -415,9 +406,9 @@ function guard(changes, input, removing) {
415
406
  return null;
416
407
  }
417
408
  function unrevised(input, path) {
418
- return (!input.local && input.queued?.has(path) !== true && input.visible.revisions[path] === undefined);
409
+ return !input.local && !input.queued.has(path) && input.visible.revisions[path] === undefined;
419
410
  }
420
- export function queuedDocuments(queue) {
411
+ function queuedDocuments(queue) {
421
412
  const paths = new Set();
422
413
  for (const batch of queue) {
423
414
  for (const change of batch.changes) {
@@ -553,19 +544,16 @@ function* exceeding(limits, changes, effective, resulting) {
553
544
  function shellRelative(text, path, handle, definition) {
554
545
  if (!text.includes(`/rooms/${handle}/`))
555
546
  return null;
556
- const parsed = parse(text, path);
547
+ const parsed = parse(text, path, definition);
557
548
  if (!parsed.ok)
558
549
  return null;
559
550
  const result = relativize(parsed.document, path, handle, definition(parsed.document.type));
560
551
  return result.outcome === 'applied' && result.document.content !== text ? result.document : null;
561
552
  }
562
553
  function relativeField(path, name, value, handle, definition) {
563
- const opened = parse('---\n---\n');
564
- if (definition === undefined ||
565
- !opened.ok ||
566
- !JSON.stringify(value ?? null).includes(`/rooms/${handle}/`))
554
+ if (definition === undefined || !JSON.stringify(value ?? null).includes(`/rooms/${handle}/`))
567
555
  return value;
568
- const held = apply(opened.document, [{ kind: 'field', name, value, prior: undefined }]);
556
+ const held = apply(create(definition.name, definition), [{ kind: 'field', name, value, prior: undefined }], definition);
569
557
  if (held.outcome !== 'applied')
570
558
  return value;
571
559
  const result = relativize(held.document, path, handle, definition);
@@ -573,7 +561,7 @@ function relativeField(path, name, value, handle, definition) {
573
561
  }
574
562
  function relativeChanges(input) {
575
563
  const { handle, composition, visible } = input;
576
- const typed = (path) => (type) => definitionOf(governing(composition, path), type);
564
+ const typed = (path) => definitionsAt(composition, path);
577
565
  const body = (path, text) => shellRelative(text, path, handle, () => undefined)?.content ?? text;
578
566
  return input.changes.map((change) => {
579
567
  const definition = typed(change.path);
@@ -602,7 +590,7 @@ function relativeChanges(input) {
602
590
  });
603
591
  }
604
592
  function unqueueable(file) {
605
- return { kind: 'refused', refusal: { code: 'unknown-revision', retryable: false, file } };
593
+ return refuse('unknown-revision', file);
606
594
  }
607
595
  function isPart(change) {
608
596
  return change.kind === 'field' || change.kind === 'section' || change.kind === 'preamble';
@@ -610,8 +598,9 @@ function isPart(change) {
610
598
  function touched(change) {
611
599
  return change.kind === 'move' ? [change.path, change.to] : [change.path];
612
600
  }
613
- function partsApplied(content, path, changes) {
614
- const parsed = parse(content, path);
601
+ function partsApplied(content, path, changes, composition) {
602
+ const definitions = definitionsAt(composition, path);
603
+ const parsed = parse(content, path, definitions);
615
604
  if (!parsed.ok)
616
605
  return null;
617
606
  const document = parsed.document;
@@ -634,12 +623,12 @@ function partsApplied(content, path, changes) {
634
623
  else
635
624
  parts.set('preamble', { kind: 'preamble', value: change.value, prior: document.preamble });
636
625
  }
637
- const applied = apply(document, [...parts.values()]);
626
+ const applied = apply(document, [...parts.values()], definitions(document.type));
638
627
  return applied.outcome === 'applied' ? serialize(applied.document) : null;
639
628
  }
640
- function settledParts(changes, deferred) {
629
+ function settledParts(changes, deferred, composition) {
641
630
  for (const [held, parts] of deferred) {
642
- const content = partsApplied(held.content, held.path, parts);
631
+ const content = partsApplied(held.content, held.path, parts, composition);
643
632
  if (content === null)
644
633
  return held.path;
645
634
  changes[changes.indexOf(held)] = { ...held, content };
@@ -714,7 +703,9 @@ function* relinked(batch, move, before, after, appending) {
714
703
  for (const change of derived.changes) {
715
704
  if (change === move)
716
705
  continue;
717
- const unsettled = isPart(change) ? null : settledParts(changes, deferred);
706
+ const unsettled = isPart(change)
707
+ ? null
708
+ : settledParts(changes, deferred, after.collection.composition);
718
709
  if (unsettled !== null)
719
710
  return unqueueable(unsettled);
720
711
  const outcome = folded(changes, change, appending, deferred);
@@ -725,7 +716,7 @@ function* relinked(batch, move, before, after, appending) {
725
716
  if (outcome !== 'skipped')
726
717
  changed = true;
727
718
  }
728
- const unsettled = settledParts(changes, deferred);
719
+ const unsettled = settledParts(changes, deferred, after.collection.composition);
729
720
  if (unsettled !== null)
730
721
  return unqueueable(unsettled);
731
722
  if (!changed)
@@ -786,11 +777,10 @@ function withdrawnFile(batch, change, at) {
786
777
  ];
787
778
  return immutable({ ...batch, id: changeBatchIdentity(), changes, preconditions });
788
779
  }
789
- export function* requeuing(queue, changes, visible, changeable, state) {
780
+ function* requeuing(queue, changes, visible, changeable, state) {
790
781
  const next = [...queue];
791
782
  const origins = new Map();
792
783
  const withdrawn = new Map();
793
- const owners = new Set();
794
784
  const queued = new Set();
795
785
  const kept = [];
796
786
  const originOf = (batch) => origins.get(batch) ?? batch.id;
@@ -836,7 +826,6 @@ export function* requeuing(queue, changes, visible, changeable, state) {
836
826
  if (replaced !== null)
837
827
  origins.set(replaced, origin);
838
828
  }
839
- owners.add(originOf(owner));
840
829
  next.splice(index, following.length, ...rebuilt.filter((batch) => batch !== null));
841
830
  queued.add(change.path);
842
831
  }
@@ -846,52 +835,9 @@ export function* requeuing(queue, changes, visible, changeable, state) {
846
835
  changes: kept,
847
836
  queued,
848
837
  withdrawn,
849
- owners,
850
838
  };
851
839
  }
852
- function covering(precondition) {
853
- return precondition.kind === 'field' ||
854
- precondition.kind === 'section' ||
855
- precondition.kind === 'preamble'
856
- ? identity(precondition)
857
- : `path ${precondition.path}`;
858
- }
859
- export function joined(queue, owner, extra) {
860
- const later = new Set(queue.slice(queue.indexOf(owner) + 1).flatMap((batch) => batch.changes.flatMap(touched)));
861
- const clash = extra.changes.flatMap(touched).find((path) => later.has(path));
862
- if (clash !== undefined)
863
- return unqueueable(clash);
864
- const changes = [...owner.changes];
865
- const deferred = new Map();
866
- for (const change of extra.changes) {
867
- const unsettled = isPart(change) ? null : settledParts(changes, deferred);
868
- if (unsettled !== null)
869
- return unqueueable(unsettled);
870
- if (folded(changes, change, true, deferred) === 'refused')
871
- return unqueueable(change.path);
872
- }
873
- const unsettled = settledParts(changes, deferred);
874
- if (unsettled !== null)
875
- return unqueueable(unsettled);
876
- const held = new Set(owner.preconditions.map(covering));
877
- const written = new Set(owner.changes.flatMap((change) => change.kind === 'create' || change.kind === 'replace' ? [change.path] : []));
878
- const preconditions = [
879
- ...owner.preconditions,
880
- ...extra.preconditions.filter((precondition) => {
881
- const key = covering(precondition);
882
- return (!held.has(key) && (key === `path ${precondition.path}` || !written.has(precondition.path)));
883
- }),
884
- ];
885
- const batch = immutable({
886
- ...owner,
887
- ...(extra.validation === undefined ? {} : { validation: extra.validation }),
888
- id: changeBatchIdentity(),
889
- changes,
890
- preconditions,
891
- });
892
- return { kind: 'joined', batch, queue: queue.map((item) => (item === owner ? batch : item)) };
893
- }
894
- export function* limiting(queue, batch, limits, state) {
840
+ function* limiting(queue, batch, limits, state) {
895
841
  const at = queue.indexOf(batch);
896
842
  const rewritten = yield* providerRewritten(batch, yield* state(queue.slice(0, at)));
897
843
  const limited = yield* exceeding(limits, batch.changes, rewritten.changes, yield* state(queue.slice(0, at + 1)));
@@ -921,7 +867,7 @@ function touchedLibrary(resulting, touched, composition) {
921
867
  if (binaries.has(path))
922
868
  known.set(path, { type: undefined, binary: true });
923
869
  else if (content !== undefined && content !== null) {
924
- const read = parse(content, path);
870
+ const read = parse(content, path, definitionsAt(composition, path));
925
871
  if (read.ok)
926
872
  known.set(path, { type: read.document.type ?? 'any', binary: false });
927
873
  await pace(content.length + ROW_WEIGHT);
@@ -985,10 +931,11 @@ function placed(reference) {
985
931
  function roomReferencesIn(path, content, composition) {
986
932
  if (content === undefined)
987
933
  return [];
988
- const parsed = parse(content, path);
934
+ const definitions = definitionsAt(composition, path);
935
+ const parsed = parse(content, path, definitions);
989
936
  if (!parsed.ok)
990
937
  return [];
991
- return roomReferences(parsed.document, definitionOf(governing(composition, path), parsed.document.type));
938
+ return roomReferences(parsed.document, definitions(parsed.document.type));
992
939
  }
993
940
  function* admittedRooms(changes, visible, resulting, composition) {
994
941
  const from = new Map();
@@ -1039,7 +986,7 @@ async function batching(input) {
1039
986
  return refusal;
1040
987
  const preconditions = await stepped(preconditionsOf(changes, input.visible, input.bases));
1041
988
  const predicted = await stepped(anticipated(changes, preconditions, rewritten.changes, input.visible));
1042
- const resulting = await stepped(overlaying(input.visible, [{ id: '', baseRoomVersion: input.baseRoomVersion, ...predicted }]));
989
+ const resulting = await stepped(overlaying(input.visible, [{ id: '', baseRoomVersion: input.baseRoomVersion, ...predicted }], input.composition));
1043
990
  const judged = await judging(input.visible, resulting, input.composition, input.validate, new Set(changes.filter((change) => change.kind === 'remove').map((change) => change.path)), [...new Set(predicted.changes.flatMap(affected))]);
1044
991
  if (judged.kind === 'refused')
1045
992
  return judged;
@@ -1061,7 +1008,7 @@ async function batching(input) {
1061
1008
  }),
1062
1009
  };
1063
1010
  }
1064
- export const MOVE_DOCUMENTS = 'move-documents';
1011
+ const MOVE_DOCUMENTS = 'move-documents';
1065
1012
  function heldAt(visible, path) {
1066
1013
  return visible.documents[path] !== undefined || visible.binaries[path] !== undefined;
1067
1014
  }
@@ -1070,7 +1017,7 @@ function arrivingText(path, to, source, moved) {
1070
1017
  const document = source.visible.collection.document(path);
1071
1018
  if (document === undefined)
1072
1019
  return content;
1073
- const definition = definitionOf(governing(source.composition, path), document.type);
1020
+ const definition = definitionsAt(source.composition, path)(document.type);
1074
1021
  const changes = crossed(document, definition, path, (named, href) => {
1075
1022
  const at = moved.get(named);
1076
1023
  if (at !== undefined)
@@ -1079,7 +1026,7 @@ function arrivingText(path, to, source, moved) {
1079
1026
  });
1080
1027
  if (changes.length === 0)
1081
1028
  return content;
1082
- const applied = apply(document, changes);
1029
+ const applied = apply(document, changes, definition);
1083
1030
  return applied.outcome === 'applied' ? serialize(applied.document) : content;
1084
1031
  }
1085
1032
  function arrivalOf({ path, to }, source, moved) {
@@ -1112,9 +1059,9 @@ function arrivalOf({ path, to }, source, moved) {
1112
1059
  };
1113
1060
  }
1114
1061
  async function moving(input) {
1115
- const { source, destination, moves, pathRule } = input;
1062
+ const { source, destination, moves } = input;
1116
1063
  const removals = moves.map(({ path }) => ({ kind: 'remove', path }));
1117
- const leaves = guard(removals, { ...source, local: input.local, bases: [], pathRule }, MOVE_OUT);
1064
+ const leaves = guard(removals, { ...source, local: input.local, bases: [] }, MOVE_OUT);
1118
1065
  if (leaves !== null)
1119
1066
  return leaves;
1120
1067
  const uploading = moves.find(({ path }) => source.visible.binaries[path]?.state === 'pending');
@@ -1122,7 +1069,7 @@ async function moving(input) {
1122
1069
  return refuse('unknown-revision', uploading.path);
1123
1070
  const moved = new Map(moves.map(({ path, to }) => [path, to]));
1124
1071
  const arrivals = moves.map((move) => arrivalOf(move, source, moved));
1125
- const arrives = guard(arrivals, { ...destination, local: input.local, bases: [], pathRule }, WRITE);
1072
+ const arrives = guard(arrivals, { ...destination, local: input.local, bases: [] }, WRITE);
1126
1073
  if (arrives !== null)
1127
1074
  return arrives;
1128
1075
  const bound = input.providerLimits.find((limit) => limit.name === MOVE_DOCUMENTS)?.value;
@@ -1151,7 +1098,7 @@ async function moving(input) {
1151
1098
  between,
1152
1099
  };
1153
1100
  const effective = await stepped(leavingRewritten(leavingBatch, source.visible));
1154
- const left = await stepped(overlaying(source.visible, [effective]));
1101
+ const left = await stepped(overlaying(source.visible, [effective], source.composition));
1155
1102
  const sourceJudged = await judging(source.visible, left, source.composition, source.validate, new Set(moves.map(({ path }) => path)), [...new Set(effective.changes.map((change) => change.path))]);
1156
1103
  if (sourceJudged.kind === 'refused')
1157
1104
  return sourceJudged;
@@ -1163,7 +1110,7 @@ async function moving(input) {
1163
1110
  ...written,
1164
1111
  between,
1165
1112
  };
1166
- const arrived = await stepped(overlaying(destination.visible, [arrivingBatch]));
1113
+ const arrived = await stepped(overlaying(destination.visible, [arrivingBatch], destination.composition));
1167
1114
  const destinationJudged = await judging(destination.visible, arrived, destination.composition, destination.validate, new Set(), moves.map(({ to }) => to));
1168
1115
  if (destinationJudged.kind === 'refused')
1169
1116
  return destinationJudged;
@@ -1173,9 +1120,172 @@ async function moving(input) {
1173
1120
  return limited;
1174
1121
  return { kind: 'moved', leaving: immutable(leavingBatch), arriving: immutable(arrivingBatch) };
1175
1122
  }
1176
- export function buildMove(input) {
1177
- return moving(input);
1123
+ function changedUnderneath(saved, visible) {
1124
+ const parts = saved.flatMap(({ path, parts: held }) => changedParts(path, held, visible));
1125
+ return parts.length === 0
1126
+ ? null
1127
+ : { kind: 'refused', refusal: { code: 'changed-underneath', retryable: false, parts } };
1128
+ }
1129
+ function sideOf(room, visible) {
1130
+ const { record } = room;
1131
+ return {
1132
+ room: record.locator,
1133
+ handle: record.declaration.handle,
1134
+ baseRoomVersion: record.roomVersion,
1135
+ composition: room.composition,
1136
+ rule: room.rule,
1137
+ visible,
1138
+ folders: room.folders,
1139
+ queued: queuedDocuments(room.queue),
1140
+ unmodeled: !room.modelled,
1141
+ validate: room.validate,
1142
+ };
1143
+ }
1144
+ function carriedDrafts(ask, from, into) {
1145
+ return new Map(ask.saved.flatMap(({ path, parts }) => {
1146
+ const record = from.drafts.get(path);
1147
+ if (parts.move === undefined || record === undefined || ask.consumed.has(path))
1148
+ return [];
1149
+ const to = moveTarget(parts.move);
1150
+ if (into.drafts.has(to))
1151
+ return [];
1152
+ const locator = into.record.locator;
1153
+ return [[path, { ...record, locator, path: to, revision: roomDraftRevision() }]];
1154
+ }));
1155
+ }
1156
+ async function plannedMove(ask, source, into) {
1157
+ const destination = into.record.locator;
1158
+ const mixed = ask.saved.find(({ parts }) => Object.keys(parts).length !== 1 || parts.move?.room !== destination);
1159
+ if (mixed !== undefined)
1160
+ return refuse('mixed-room-move', mixed.path);
1161
+ const leavingVisible = await stepped(source.replay(source.queue));
1162
+ const changed = changedUnderneath(ask.saved, leavingVisible);
1163
+ if (changed !== null)
1164
+ return changed;
1165
+ const moves = ask.saved.map(({ path, parts }) => ({ path, to: moveTarget(parts.move) }));
1166
+ const built = await moving({
1167
+ source: sideOf(source, leavingVisible),
1168
+ destination: sideOf(into, await stepped(into.replay(into.queue))),
1169
+ moves,
1170
+ providerLimits: ask.providerLimits,
1171
+ local: ask.local,
1172
+ ...(ask.writtenBy === undefined ? {} : { writtenBy: ask.writtenBy }),
1173
+ });
1174
+ if (built.kind === 'refused')
1175
+ return built;
1176
+ const { id } = built.leaving;
1177
+ const carried = carriedDrafts(ask, source, into);
1178
+ return {
1179
+ kind: 'planned',
1180
+ identifier: id,
1181
+ rooms: [
1182
+ {
1183
+ locator: source.record.locator,
1184
+ queue: [...source.queue, built.leaving],
1185
+ saved: new Map([[id, ask.saved]]),
1186
+ consumed: [...ask.consumed, ...carried.keys()],
1187
+ carried: [],
1188
+ },
1189
+ {
1190
+ locator: destination,
1191
+ queue: [...into.queue, built.arriving],
1192
+ saved: new Map([
1193
+ [id, [...carried.values()].map(({ path }) => ({ path, parts: {} }))],
1194
+ ]),
1195
+ consumed: [],
1196
+ carried: [...carried.values()],
1197
+ },
1198
+ ],
1199
+ };
1200
+ }
1201
+ async function plannedWithin(ask, room) {
1202
+ const { record } = room;
1203
+ const visible = await stepped(room.replay(room.queue));
1204
+ const changed = changedUnderneath(ask.saved, visible);
1205
+ if (changed !== null)
1206
+ return changed;
1207
+ const parts = ask.saved.map(({ path, parts: held }) => changesOf(path, held));
1208
+ const changes = parts.flatMap(({ changes: made }) => made);
1209
+ const requeue = await stepped(requeuing(room.queue, changes, visible, (batch) => room.changeable.has(batch.id), room.replay));
1210
+ if (requeue.kind === 'refused')
1211
+ return requeue;
1212
+ const foreign = [...requeue.withdrawn.keys()].some((origin) => {
1213
+ const writer = room.queue.find((batch) => batch.id === origin)?.writtenBy;
1214
+ return writer?.app !== ask.writtenBy?.app || writer?.release !== ask.writtenBy?.release;
1215
+ });
1216
+ if (foreign)
1217
+ return unqueueable([...requeue.queued].at(-1));
1218
+ const input = {
1219
+ local: ask.local,
1220
+ baseRoomVersion: record.roomVersion,
1221
+ composition: room.composition,
1222
+ rule: room.rule,
1223
+ providerLimits: ask.providerLimits,
1224
+ handle: record.declaration.handle,
1225
+ visible,
1226
+ folders: room.folders,
1227
+ changes,
1228
+ bases: parts.flatMap(({ bases }) => bases),
1229
+ queued: queuedDocuments(room.queue),
1230
+ writtenBy: ask.writtenBy,
1231
+ unmodeled: !room.modelled,
1232
+ validate: room.validate,
1233
+ };
1234
+ const rewritten = requeue.withdrawn.size > 0;
1235
+ if (rewritten) {
1236
+ const whole = await batching({
1237
+ ...input,
1238
+ providerLimits: [],
1239
+ queued: new Set([...input.queued, ...requeue.queued]),
1240
+ });
1241
+ if (whole.kind === 'refused')
1242
+ return whole;
1243
+ }
1244
+ const own = !rewritten
1245
+ ? await batching(input)
1246
+ : requeue.changes.length === 0
1247
+ ? null
1248
+ : await batching({
1249
+ ...input,
1250
+ visible: await stepped(room.replay(requeue.queue)),
1251
+ changes: requeue.changes,
1252
+ queued: queuedDocuments(requeue.queue),
1253
+ });
1254
+ if (own?.kind === 'refused')
1255
+ return own;
1256
+ const queue = own === null ? requeue.queue : [...requeue.queue, own.batch];
1257
+ const saved = new Map();
1258
+ for (const [origin, rebuilt] of requeue.withdrawn) {
1259
+ if (rebuilt === null)
1260
+ continue;
1261
+ const limited = await stepped(limiting(queue, rebuilt, ask.providerLimits, room.replay));
1262
+ if (limited !== null)
1263
+ return { kind: 'refused', refusal: limited };
1264
+ saved.set(rebuilt.id, withdrawnDrafts(room.saved.get(origin) ?? [], changes));
1265
+ }
1266
+ if (own !== null) {
1267
+ saved.set(own.batch.id, ask.saved.filter(({ path }) => !requeue.queued.has(path)));
1268
+ }
1269
+ const carried = carriedDrafts(ask, room, room);
1270
+ return {
1271
+ kind: 'planned',
1272
+ identifier: own?.batch.id ??
1273
+ [...requeue.withdrawn].map(([origin, rebuilt]) => rebuilt?.id ?? origin).at(-1),
1274
+ rooms: [
1275
+ {
1276
+ locator: record.locator,
1277
+ queue,
1278
+ saved,
1279
+ consumed: [...ask.consumed, ...carried.keys()],
1280
+ carried: [...carried.values()],
1281
+ },
1282
+ ],
1283
+ };
1284
+ }
1285
+ export function destination(locator, saved) {
1286
+ const into = saved.find(({ parts }) => parts.move?.room !== undefined && parts.move.room !== locator);
1287
+ return into?.parts.move?.room ?? null;
1178
1288
  }
1179
- export function buildBatch(input) {
1180
- return batching(input);
1289
+ export function planSave(ask, room, into) {
1290
+ return into === undefined ? plannedWithin(ask, room) : plannedMove(ask, room, into);
1181
1291
  }
package/dist/saves.d.ts CHANGED
@@ -1,11 +1,9 @@
1
- import { type ChangeSet } from './change-set.js';
2
1
  import { type ChangeBatch, type WrittenBy } from './change.js';
3
2
  import { type AttachAnswer, type BinaryLinkAnswer, type HeldBinaryAnswer, type HeldShownAnswer } from './outcome.js';
4
- import { type HeldReplica, type ReplicaRecord, type Slice, type VisibleLayer } from './replica.js';
5
- import { type ReturnReason, type RoomDraftParts } from './room-draft.js';
3
+ import { type RoomDraftParts } from './room-draft.js';
6
4
  import type { Runtime } from './runtime.js';
7
5
  import { type SaveRefusal } from './save.js';
8
- import type { AuthoredWrite, CommittedWrite, PendingState, RoomCommit, RuntimeStore, Store, StoredEntry, View, Work } from './store.js';
6
+ import type { Store } from './store.js';
9
7
  export type SaveResult = {
10
8
  outcome: 'saved';
11
9
  identifier: string;
@@ -27,42 +25,6 @@ export type BinaryFileSurface = {
27
25
  attach(room: string, file: File): Promise<AttachAnswer>;
28
26
  part(file: string, part: number): Promise<Uint8Array | null>;
29
27
  };
30
- export type Leaving = {
31
- batch: ChangeBatch;
32
- returned: ReturnReason | null;
33
- };
34
- export declare function withdrawable(states: ReadonlyMap<string, PendingState>): (batch: ChangeBatch) => boolean;
35
- export declare function sliceAt(store: Store, record: ReplicaRecord, view: View, queue: readonly ChangeBatch[], extra?: Iterable<string>, moved?: Iterable<string>): Promise<Slice>;
36
- export declare function landedWhole(store: Store, locator: string, batch: ChangeBatch, confirmedLayer: Slice, current?: Readonly<Record<string, string>>): Promise<boolean>;
37
- export type Settling = {
38
- leaving?: readonly Leaving[];
39
- room?: boolean;
40
- view?: View;
41
- commit?: Pick<RoomCommit, 'published' | 'refreshed'>;
42
- changes?: {
43
- readonly set: readonly StoredEntry[];
44
- readonly removed: readonly string[];
45
- };
46
- };
47
- export declare function preparedAfter(runtime: Runtime, locator: string, answer: CommittedWrite): void;
48
- export declare function replayed(store: Store, record: ReplicaRecord, confirmedLayer: Slice, queue: readonly ChangeBatch[]): import("./turn.js").Later<import("./replica.js").Replayed>;
49
- export declare function overlayDiff(record: ReplicaRecord, before: HeldReplica | undefined, visible: VisibleLayer, touched: ReadonlySet<string>): Promise<{
50
- overlay: NonNullable<RoomCommit['overlay']>;
51
- touched: ReadonlySet<string>;
52
- }>;
53
- export type Settlement = {
54
- readonly locator: string;
55
- readonly left: readonly ChangeBatch[];
56
- readonly commit: {
57
- readonly rooms: readonly RoomCommit[];
58
- readonly writes: readonly AuthoredWrite[];
59
- };
60
- apply(answer: CommittedWrite): ChangeSet;
61
- };
62
- export declare function settle(runtime: Runtime, local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<ChangeSet>;
63
- export declare function together(runtime: Runtime, local: RuntimeStore, settlements: readonly Settlement[]): Promise<ChangeSet>;
64
- export declare function settlement(runtime: Runtime, local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling?: Settling): Promise<Settlement>;
65
- export declare function unpairing(runtime: Runtime, local: RuntimeStore, locator: string, batches: readonly ChangeBatch[]): Promise<Settlement>;
66
28
  export declare function saveRoomDrafts(runtime: Runtime, locator: string, named: readonly SavedRoomDraft[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
67
29
  export declare function saveParts(runtime: Runtime, locator: string, named: readonly SavedParts[], writtenBy: WrittenBy | undefined): Promise<SaveResult>;
68
30
  export declare function batchFile(store: Store, batch: ChangeBatch): (localId: string) => Promise<Blob>;
@@ -1 +1 @@
1
- {"version":3,"file":"saves.d.ts","sourceRoot":"","sources":["../src/saves.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AAQrB,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAErB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,cAAc,CAAC;AAItB,OAAO,EAWL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAYL,KAAK,YAAY,EACjB,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAQL,KAAK,WAAW,EAEjB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EAEd,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,KAAK,EACL,WAAW,EAEX,IAAI,EACJ,IAAI,EACL,MAAM,YAAY,CAAC;AAKpB,MAAM,MAAM,UAAU,GAClB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACxC,CAAC;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GAAG,WAAW,CAAC,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ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