@agentshouse/mdruntime 0.1.0-ca6edc1abd618 → 0.1.0-ca92b54804c33

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 (149) hide show
  1. package/README.md +2 -2
  2. package/dist/adapter.d.ts +101 -70
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/attached-model.d.ts +3 -10
  5. package/dist/attached-model.d.ts.map +1 -1
  6. package/dist/attached-model.js +29 -47
  7. package/dist/bootstrap.d.ts +16 -14
  8. package/dist/bootstrap.d.ts.map +1 -1
  9. package/dist/bootstrap.js +272 -129
  10. package/dist/chain.d.ts +2 -1
  11. package/dist/chain.d.ts.map +1 -1
  12. package/dist/change.d.ts +1 -0
  13. package/dist/change.d.ts.map +1 -1
  14. package/dist/client.d.ts +13 -9
  15. package/dist/client.d.ts.map +1 -1
  16. package/dist/client.js +54 -6
  17. package/dist/collection.d.ts +7 -4
  18. package/dist/collection.d.ts.map +1 -1
  19. package/dist/collection.js +23 -17
  20. package/dist/compile.d.ts +1 -6
  21. package/dist/compile.d.ts.map +1 -1
  22. package/dist/compile.js +108 -243
  23. package/dist/connection.d.ts +14 -11
  24. package/dist/connection.d.ts.map +1 -1
  25. package/dist/connection.js +2264 -1933
  26. package/dist/context.d.ts +2 -0
  27. package/dist/context.d.ts.map +1 -0
  28. package/dist/context.js +7 -0
  29. package/dist/conversation.d.ts +21 -17
  30. package/dist/conversation.d.ts.map +1 -1
  31. package/dist/conversation.js +405 -253
  32. package/dist/durability.d.ts +6 -1
  33. package/dist/durability.d.ts.map +1 -1
  34. package/dist/entry.d.ts +3 -2
  35. package/dist/entry.d.ts.map +1 -1
  36. package/dist/entry.js +18 -8
  37. package/dist/file.d.ts +2 -11
  38. package/dist/file.d.ts.map +1 -1
  39. package/dist/file.js +6 -4
  40. package/dist/host.d.ts +3 -7
  41. package/dist/host.d.ts.map +1 -1
  42. package/dist/host.js +26 -29
  43. package/dist/identity.d.ts +0 -1
  44. package/dist/identity.d.ts.map +1 -1
  45. package/dist/identity.js +0 -3
  46. package/dist/index.d.ts +12 -9
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +4 -1
  49. package/dist/job.d.ts +14 -0
  50. package/dist/job.d.ts.map +1 -0
  51. package/dist/job.js +28 -0
  52. package/dist/live.d.ts +5 -4
  53. package/dist/live.d.ts.map +1 -1
  54. package/dist/live.js +62 -20
  55. package/dist/media.d.ts +8 -0
  56. package/dist/media.d.ts.map +1 -0
  57. package/dist/media.js +218 -0
  58. package/dist/memory.d.ts +12 -5
  59. package/dist/memory.d.ts.map +1 -1
  60. package/dist/memory.js +216 -85
  61. package/dist/messages.d.ts +3 -3
  62. package/dist/messages.d.ts.map +1 -1
  63. package/dist/messages.js +20 -19
  64. package/dist/model.d.ts +8 -10
  65. package/dist/model.d.ts.map +1 -1
  66. package/dist/model.js +5 -17
  67. package/dist/observation.d.ts +3 -2
  68. package/dist/observation.d.ts.map +1 -1
  69. package/dist/observation.js +8 -3
  70. package/dist/outcome.d.ts +13 -5
  71. package/dist/outcome.d.ts.map +1 -1
  72. package/dist/outcome.js +16 -2
  73. package/dist/overlay.d.ts +1 -0
  74. package/dist/overlay.d.ts.map +1 -1
  75. package/dist/overlay.js +11 -0
  76. package/dist/paths.d.ts +1 -0
  77. package/dist/paths.d.ts.map +1 -1
  78. package/dist/paths.js +4 -0
  79. package/dist/query.d.ts +8 -207
  80. package/dist/query.d.ts.map +1 -1
  81. package/dist/query.js +3 -505
  82. package/dist/reach.d.ts +18 -11
  83. package/dist/reach.d.ts.map +1 -1
  84. package/dist/reach.js +195 -126
  85. package/dist/react.d.ts +3 -1
  86. package/dist/react.d.ts.map +1 -1
  87. package/dist/readiness.d.ts +3 -17
  88. package/dist/readiness.d.ts.map +1 -1
  89. package/dist/readiness.js +4 -10
  90. package/dist/recovery.d.ts +1 -0
  91. package/dist/recovery.d.ts.map +1 -1
  92. package/dist/recovery.js +35 -1
  93. package/dist/refresh.d.ts +7 -5
  94. package/dist/refresh.d.ts.map +1 -1
  95. package/dist/refresh.js +33 -5
  96. package/dist/replica.d.ts +10 -8
  97. package/dist/replica.d.ts.map +1 -1
  98. package/dist/replica.js +52 -20
  99. package/dist/room-draft.d.ts +21 -5
  100. package/dist/room-draft.d.ts.map +1 -1
  101. package/dist/room-draft.js +98 -51
  102. package/dist/rows.d.ts +18 -16
  103. package/dist/rows.d.ts.map +1 -1
  104. package/dist/rows.js +45 -153
  105. package/dist/save.d.ts +2 -0
  106. package/dist/save.d.ts.map +1 -1
  107. package/dist/save.js +22 -13
  108. package/dist/search.d.ts +12 -63
  109. package/dist/search.d.ts.map +1 -1
  110. package/dist/search.js +9 -52
  111. package/dist/shared.d.ts +0 -1
  112. package/dist/shared.d.ts.map +1 -1
  113. package/dist/shared.js +0 -10
  114. package/dist/status.d.ts +4 -5
  115. package/dist/status.d.ts.map +1 -1
  116. package/dist/status.js +3 -7
  117. package/dist/store.d.ts +101 -61
  118. package/dist/store.d.ts.map +1 -1
  119. package/dist/store.js +153 -161
  120. package/dist/stored.d.ts +66 -55
  121. package/dist/stored.d.ts.map +1 -1
  122. package/dist/stored.js +341 -273
  123. package/dist/tables.d.ts +90 -63
  124. package/dist/tables.d.ts.map +1 -1
  125. package/dist/tables.js +174 -98
  126. package/dist/transfer.d.ts +0 -5
  127. package/dist/transfer.d.ts.map +1 -1
  128. package/dist/validation.d.ts +3 -4
  129. package/dist/validation.d.ts.map +1 -1
  130. package/dist/validation.js +42 -100
  131. package/dist/windows.d.ts +1 -12
  132. package/dist/windows.d.ts.map +1 -1
  133. package/dist/windows.js +2 -75
  134. package/dist/wire.d.ts +17 -8
  135. package/dist/wire.d.ts.map +1 -1
  136. package/dist/wire.js +5 -2
  137. package/package.json +2 -2
  138. package/dist/fence.d.ts +0 -6
  139. package/dist/fence.d.ts.map +0 -1
  140. package/dist/fence.js +0 -10
  141. package/dist/fulltext.d.ts +0 -27
  142. package/dist/fulltext.d.ts.map +0 -1
  143. package/dist/fulltext.js +0 -368
  144. package/dist/reads.d.ts +0 -11
  145. package/dist/reads.d.ts.map +0 -1
  146. package/dist/reads.js +0 -100
  147. package/dist/words.d.ts +0 -19
  148. package/dist/words.d.ts.map +0 -1
  149. package/dist/words.js +0 -150
@@ -9,52 +9,60 @@ export function returnedBy(kind) {
9
9
  export function staleWrite(current) {
10
10
  return { outcome: 'stale', code: 'stale', retryable: false, current };
11
11
  }
12
- function malformed() {
13
- throw runtimeError('room-draft-malformed');
12
+ function malformed(at, needs) {
13
+ throw runtimeError('room-draft-malformed', at === undefined ? 'room-draft-malformed' : `room-draft-malformed at ${at}: ${needs}`);
14
14
  }
15
15
  function plain(value) {
16
16
  return typeof value === 'object' && value !== null && !Array.isArray(value);
17
17
  }
18
- function text(value) {
19
- return typeof value === 'string' ? value : malformed();
18
+ function text(value, at) {
19
+ return typeof value === 'string' ? value : malformed(at, 'text');
20
20
  }
21
- function optionalText(value) {
22
- return value === undefined ? undefined : text(value);
21
+ function optionalText(value, at) {
22
+ return value === undefined ? undefined : text(value, at);
23
23
  }
24
- function markdownBase(value) {
25
- return value === null ? null : optionalText(value);
24
+ function markdownBase(value, at) {
25
+ return value === null ? null : optionalText(value, at);
26
26
  }
27
- function entries(value, each) {
27
+ function entries(value, at, each) {
28
28
  if (!plain(value))
29
- malformed();
29
+ malformed(at, 'an object of named values');
30
30
  const read = {};
31
31
  for (const [name, item] of Object.entries(value))
32
- read[name] = each(item);
32
+ read[name] = each(item, `${at}.${name}`);
33
33
  return read;
34
34
  }
35
- function fieldValue(value) {
35
+ function frontmatter(item, at) {
36
+ return frontmatterValue(item) ? item : malformed(at, 'a frontmatter value');
37
+ }
38
+ function fieldValue(value, at) {
36
39
  if (value === null)
37
40
  return null;
38
41
  if (!plain(value) || !Object.hasOwn(value, 'value') || !frontmatterValue(value.value)) {
39
- malformed();
42
+ malformed(at, '{ value } with a frontmatter value, or null where the document lacks it');
40
43
  }
41
44
  return { value: value.value };
42
45
  }
43
- function textPart(value) {
46
+ function textPart(value, at) {
44
47
  if (!plain(value))
45
- malformed();
46
- const base = optionalText(value.base);
47
- return { value: text(value.value), ...(base === undefined ? {} : { base }) };
48
+ malformed(at, '{ value, base }');
49
+ const base = optionalText(value.base, `${at}.base`);
50
+ return { value: text(value.value, `${at}.value`), ...(base === undefined ? {} : { base }) };
48
51
  }
49
- function creationOf(value) {
52
+ function creationOf(value, at) {
50
53
  if (!plain(value))
51
- malformed();
54
+ malformed(at, '{ type, fields, sections }, or { markdown }');
52
55
  if (Object.hasOwn(value, 'markdown'))
53
- return { markdown: text(value.markdown) };
54
- const fields = entries(value.fields, (item) => (frontmatterValue(item) ? item : malformed()));
55
- return { type: text(value.type), fields, sections: entries(value.sections, text) };
56
+ return { markdown: text(value.markdown, `${at}.markdown`) };
57
+ if (typeof value.type !== 'string')
58
+ malformed(`${at}.type`, 'a type name, or markdown in place of type, fields and sections');
59
+ return {
60
+ type: value.type,
61
+ fields: entries(value.fields, `${at}.fields`, frontmatter),
62
+ sections: entries(value.sections, `${at}.sections`, text),
63
+ };
56
64
  }
57
- const PART_NAMES = new Set([
65
+ const PART_NAMES = [
58
66
  'fields',
59
67
  'sections',
60
68
  'preamble',
@@ -63,52 +71,57 @@ const PART_NAMES = new Set([
63
71
  'move',
64
72
  'removal',
65
73
  'file',
66
- ]);
67
- export function readParts(value) {
68
- if (!plain(value) || Object.keys(value).some((name) => !PART_NAMES.has(name)))
69
- malformed();
74
+ ];
75
+ const NAMED_PARTS = `a part named ${PART_NAMES.slice(0, -1).join(', ')} or ${PART_NAMES.at(-1)}`;
76
+ export function readParts(value, path) {
77
+ if (!plain(value))
78
+ malformed(path, 'an object of parts');
79
+ const unknown = Object.keys(value).find((name) => !PART_NAMES.includes(name));
80
+ if (unknown !== undefined)
81
+ malformed(`${path} ${unknown}`, NAMED_PARTS);
70
82
  const parts = {};
71
83
  if (value.fields !== undefined) {
72
- parts.fields = entries(value.fields, (item) => {
84
+ parts.fields = entries(value.fields, `${path} fields`, (item, at) => {
73
85
  if (!plain(item) || !Object.hasOwn(item, 'value') || !frontmatterValue(item.value)) {
74
- malformed();
86
+ malformed(at, '{ value, base } with a frontmatter value');
75
87
  }
76
88
  return item.base === undefined
77
89
  ? { value: item.value }
78
- : { value: item.value, base: fieldValue(item.base) };
90
+ : { value: item.value, base: fieldValue(item.base, `${at}.base`) };
79
91
  });
80
92
  }
81
93
  if (value.sections !== undefined)
82
- parts.sections = entries(value.sections, textPart);
94
+ parts.sections = entries(value.sections, `${path} sections`, textPart);
83
95
  if (value.preamble !== undefined)
84
- parts.preamble = textPart(value.preamble);
96
+ parts.preamble = textPart(value.preamble, `${path} preamble`);
85
97
  if (value.markdown !== undefined)
86
- parts.markdown = textPart(value.markdown);
98
+ parts.markdown = textPart(value.markdown, `${path} markdown`);
87
99
  if (value.creation !== undefined)
88
- parts.creation = creationOf(value.creation);
100
+ parts.creation = creationOf(value.creation, `${path} creation`);
89
101
  if (value.move !== undefined) {
90
102
  if (!plain(value.move))
91
- malformed();
92
- const base = markdownBase(value.move.base);
93
- const room = optionalText(value.move.room);
103
+ malformed(`${path} move`, '{ to, room, base }');
104
+ const base = markdownBase(value.move.base, `${path} move.base`);
105
+ const room = optionalText(value.move.room, `${path} move.room`);
94
106
  parts.move = {
95
- to: text(value.move.to),
107
+ to: text(value.move.to, `${path} move.to`),
96
108
  ...(room === undefined ? {} : { room }),
97
109
  ...(base === undefined ? {} : { base }),
98
110
  };
99
111
  }
100
112
  if (value.removal !== undefined) {
101
113
  if (!plain(value.removal))
102
- malformed();
103
- const base = markdownBase(value.removal.base);
114
+ malformed(`${path} removal`, '{ base }');
115
+ const base = markdownBase(value.removal.base, `${path} removal.base`);
104
116
  parts.removal = base === undefined ? {} : { base };
105
117
  }
106
118
  if (value.file !== undefined) {
107
119
  if (!plain(value.file) || !(value.file.blob instanceof Blob))
108
- malformed();
120
+ malformed(`${path} file`, '{ blob, base } with a Blob');
109
121
  if (Object.keys(value).length > 1)
110
122
  throw runtimeError('room-draft-file-exclusive');
111
- parts.file = { blob: value.file.blob };
123
+ const base = markdownBase(value.file.base, `${path} file.base`);
124
+ parts.file = base === undefined ? { blob: value.file.blob } : { blob: value.file.blob, base };
112
125
  }
113
126
  return parts;
114
127
  }
@@ -292,18 +305,22 @@ export async function heldFile(blob, base) {
292
305
  };
293
306
  }
294
307
  export function binaryBase(visible, path) {
295
- return visible?.binaries[path] === undefined ? null : (visible.revisions[path] ?? null);
308
+ const binary = visible?.binaries[path];
309
+ if (binary === undefined)
310
+ return null;
311
+ return visible?.revisions[path] ?? (binary.state === 'pending' ? binary.localId : null);
296
312
  }
297
- export function changedParts(path, report) {
313
+ export function changedParts(path, parts, visible) {
314
+ const report = underneath(parts, path, visible);
315
+ const made = parts.file?.base === null;
298
316
  return [
299
- ...(report.creation === undefined ? [] : [{ path, part: 'creation' }]),
300
317
  ...named(report.fields).map(([name]) => ({ path, part: 'field', name })),
301
318
  ...named(report.sections).map(([name]) => ({ path, part: 'section', name })),
302
319
  ...(report.preamble === undefined ? [] : [{ path, part: 'preamble' }]),
303
320
  ...(report.markdown === undefined ? [] : [{ path, part: 'markdown' }]),
304
321
  ...(report.move === undefined ? [] : [{ path, part: 'move' }]),
305
322
  ...(report.removal === undefined ? [] : [{ path, part: 'removal' }]),
306
- ...(report.file === undefined ? [] : [{ path, part: 'file' }]),
323
+ ...(report.file === undefined || made ? [] : [{ path, part: 'file' }]),
307
324
  ];
308
325
  }
309
326
  function joined(existing, returned) {
@@ -313,7 +330,7 @@ function joined(existing, returned) {
313
330
  merged[name] = part;
314
331
  return Object.keys(merged).length === 0 ? undefined : merged;
315
332
  }
316
- function ended(text) {
333
+ export function lineEnded(text) {
317
334
  return text === '' || text.endsWith('\n') ? text : `${text}\n`;
318
335
  }
319
336
  function frontmatterOf(fields) {
@@ -337,7 +354,7 @@ export function partsAfter(markdown, parts) {
337
354
  ];
338
355
  if (pieces.length === 0)
339
356
  return markdown;
340
- return `${ended(markdown)}\n${pieces.map(ended).join('')}`;
357
+ return `${lineEnded(markdown)}\n${pieces.map(lineEnded).join('')}`;
341
358
  }
342
359
  export function returnedInto(existing, returned) {
343
360
  if (existing === undefined)
@@ -380,6 +397,36 @@ export function moveTarget(move) {
380
397
  const to = normalize(move.to);
381
398
  return to === null || to === '' ? move.to : to;
382
399
  }
400
+ export function readSavedParts(named) {
401
+ const read = named.map(({ path, parts }) => ({ path, parts: readParts(parts, path) }));
402
+ read.forEach(({ path }, at) => {
403
+ if (path === '' || normalize(path) !== path)
404
+ malformed(path, 'a path inside the Room, such as notes/a.md');
405
+ if (read.findIndex((one) => one.path === path) !== at)
406
+ malformed(path, 'each path once in one save');
407
+ });
408
+ return read;
409
+ }
410
+ export function partsChanges(named) {
411
+ const changes = [];
412
+ const preconditions = [];
413
+ for (const { path, parts } of readSavedParts(named)) {
414
+ const parted = held(undefined, parts);
415
+ const made = changesOf(path, parted);
416
+ changes.push(...made.changes);
417
+ preconditions.push(...made.bases);
418
+ for (const change of made.changes) {
419
+ if (change.kind === 'create')
420
+ preconditions.push({ kind: 'absent', path });
421
+ if (change.kind === 'move')
422
+ preconditions.push({ kind: 'absent', path: change.to });
423
+ }
424
+ const revision = parted.markdown?.base ?? parted.move?.base ?? parted.removal?.base;
425
+ if (typeof revision === 'string')
426
+ preconditions.push({ kind: 'revision', path, revision });
427
+ }
428
+ return { changes, preconditions };
429
+ }
383
430
  export function changesOf(path, parts) {
384
431
  const changes = [];
385
432
  const bases = [];
@@ -399,11 +446,11 @@ export function changesOf(path, parts) {
399
446
  bases.push({ kind: 'field', path, name, value: part.base?.value });
400
447
  }
401
448
  for (const [name, part] of named(parts.sections)) {
402
- changes.push({ kind: 'section', path, name, value: part.value });
449
+ changes.push({ kind: 'section', path, name, value: lineEnded(part.value) });
403
450
  bases.push({ kind: 'section', path, name, value: part.base });
404
451
  }
405
452
  if (parts.preamble !== undefined) {
406
- changes.push({ kind: 'preamble', path, value: parts.preamble.value });
453
+ changes.push({ kind: 'preamble', path, value: lineEnded(parts.preamble.value) });
407
454
  bases.push({ kind: 'preamble', path, value: parts.preamble.base });
408
455
  }
409
456
  if (parts.markdown !== undefined) {
@@ -415,7 +462,7 @@ export function changesOf(path, parts) {
415
462
  if (base !== null && at !== path)
416
463
  changes.push({ kind: 'move', path, to: at });
417
464
  changes.push({ kind: 'binary', path: at, ...file });
418
- if (base === null && at !== path)
465
+ if (base === null)
419
466
  bases.push({ kind: 'absent', path: at });
420
467
  return { changes, bases };
421
468
  }
package/dist/rows.d.ts CHANGED
@@ -1,27 +1,28 @@
1
+ import { type HeldValue } from '@agentshouse/mdmodel';
2
+ import type { SavedFacts } from './adapter.js';
1
3
  import { type Composition } from './collection.js';
2
- export type ValueKind = 'string' | 'number' | 'boolean' | 'null' | 'array' | 'object' | 'undefined';
3
- type HeldValue = {
4
- readonly form: string;
5
- readonly held: number;
6
- readonly item: number;
7
- readonly kind: ValueKind;
8
- readonly value: string | number | null;
9
- readonly size: number | null;
10
- readonly single: boolean;
11
- };
12
- type LinkKind = 'field' | 'section' | 'body';
4
+ type LinkKind = 'field' | 'link';
13
5
  type HeldLink = {
14
6
  readonly kind: LinkKind;
15
- readonly form: string;
7
+ readonly keys: string;
8
+ readonly places: string;
16
9
  readonly target: string;
17
10
  readonly field: string;
18
11
  };
19
- export type Derived = {
12
+ export type Described = {
20
13
  readonly type: string | null;
21
14
  readonly declared: string | null;
22
15
  readonly queried: boolean;
23
16
  readonly folder: string;
24
17
  readonly fields: string | null;
18
+ readonly links: string | null;
19
+ };
20
+ export type Held = {
21
+ readonly type: string | null;
22
+ readonly fields: Readonly<Record<string, unknown>> | null;
23
+ readonly links: readonly string[];
24
+ };
25
+ export type Derived = {
25
26
  readonly values: readonly HeldValue[];
26
27
  readonly links: readonly HeldLink[];
27
28
  };
@@ -29,9 +30,10 @@ export declare function documentKey(room: string, path: string): string;
29
30
  export declare function roomOfKey(key: string): string;
30
31
  export declare function pathOfKey(key: string): string;
31
32
  export declare function markdownPath(path: string): boolean;
32
- export declare function settingsTextPath(path: string): boolean;
33
33
  export declare function folderOf(path: string): string;
34
- export declare function kindOf(value: unknown): ValueKind;
35
- export declare function derived(path: string, content: string | null, composition: Composition): Derived;
34
+ export declare function writtenFacts(path: string, content: string, composition: Composition): SavedFacts | null;
35
+ export declare function described(path: string, content: string | null, facts: SavedFacts | null): Described;
36
+ export declare function heldOf(path: string, content: string | null, facts: SavedFacts | null): Held;
37
+ export declare function derived(path: string, held: Held, composition: Composition): Derived;
36
38
  export {};
37
39
  //# sourceMappingURL=rows.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../src/rows.ts"],"names":[],"mappings":"AAWA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9D,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEpG,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,KAAK,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7C,KAAK,QAAQ,GAAG;IACd,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;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GAAG,MAAM,CAE7C;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAaD,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,WAAW,GACvB,UAAU,GAAG,IAAI,CAQnB;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,KAAK,EAAE,UAAU,GAAG,IAAI,GACvB,SAAS,CAeX;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI,CAK3F;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAYnF"}
package/dist/rows.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ARRAY_INDEX, bodyAfterFrontmatter, bodyLinks, escapePointer, parseFrontmatter, references, sectionReferences, target, } from '@agentshouse/mdmodel';
1
+ import { byCodePoint, documentFacts, indexed, parse } from '@agentshouse/mdmodel';
2
2
  import { governing } from './collection.js';
3
3
  import { definitionOf } from './model.js';
4
4
  function keyOf(...parts) {
@@ -16,171 +16,63 @@ export function pathOfKey(key) {
16
16
  export function markdownPath(path) {
17
17
  return path.endsWith('.md');
18
18
  }
19
- export function settingsTextPath(path) {
20
- return /^settings\/.+\.ya?ml$/u.test(path);
21
- }
22
19
  export function folderOf(path) {
23
20
  return path.slice(0, Math.max(path.lastIndexOf('/'), 0));
24
21
  }
25
- function plainObject(value) {
26
- return typeof value === 'object' && value !== null && !Array.isArray(value);
27
- }
28
- function compared(reading, exact, value) {
29
- if (!reading.references.has(exact))
22
+ function byKey(_key, value) {
23
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
30
24
  return value;
31
- return (typeof value === 'string' ? target(reading.path, value) : null) ?? undefined;
32
- }
33
- export function kindOf(value) {
34
- if (value === undefined)
35
- return 'undefined';
36
- if (value === null)
37
- return 'null';
38
- if (Array.isArray(value))
39
- return 'array';
40
- if (typeof value === 'object')
41
- return 'object';
42
- return typeof value;
25
+ return Object.fromEntries(Object.entries(value).sort(([one], [other]) => byCodePoint(one, other)));
43
26
  }
44
- function scalarOf(value) {
45
- if (typeof value === 'string' || typeof value === 'number')
46
- return value;
47
- if (typeof value === 'boolean')
48
- return value ? 1 : 0;
49
- if (Array.isArray(value))
50
- return JSON.stringify(value);
51
- return null;
27
+ function fieldsText(fields) {
28
+ return JSON.stringify(fields, byKey);
52
29
  }
53
- function held(reading, form, value, single) {
54
- const at = reading.reached.get(form) ?? 0;
55
- reading.reached.set(form, at + 1);
56
- const kind = kindOf(value);
57
- reading.values.push({
58
- form,
59
- held: at,
60
- item: -1,
61
- kind,
62
- value: scalarOf(value),
63
- size: Array.isArray(value) ? value.length : null,
64
- single,
65
- });
66
- if (!Array.isArray(value))
67
- return;
68
- value.forEach((item, index) => {
69
- const itemKind = kindOf(item);
70
- reading.values.push({
71
- form,
72
- held: at,
73
- item: index,
74
- kind: itemKind,
75
- value: itemKind === 'array' ? null : scalarOf(item),
76
- size: null,
77
- single: false,
78
- });
30
+ export function writtenFacts(path, content, composition) {
31
+ const model = governing(composition, path);
32
+ const facts = documentFacts(path, parse(content, path), {
33
+ types: model.status === 'unavailable' ? {} : model.types,
79
34
  });
35
+ return facts === null
36
+ ? null
37
+ : { ...facts, fields: JSON.parse(fieldsText(facts.fields)) };
80
38
  }
81
- function record(reading, node, forms, exact) {
82
- const value = Array.isArray(node)
83
- ? node.map((item, index) => compared(reading, `${exact}/${index}`, item))
84
- : compared(reading, exact, node);
85
- for (const form of forms) {
86
- if (form.pending)
87
- continue;
88
- held(reading, form.text, value, !form.through && value !== undefined && !plainObject(value));
89
- }
90
- if (Array.isArray(node) || plainObject(node) || !reading.references.has(exact))
91
- return;
92
- const found = compared(reading, exact, node);
93
- if (typeof found !== 'string')
94
- return;
95
- const field = forms
96
- .map((form) => form.text)
97
- .reduce((left, right) => (right.length < left.length ? right : left));
98
- const known = reading.targets.get(`${field}\u0000${found}`);
99
- const kept = known ?? { field, target: found, forms: new Set() };
100
- for (const form of forms)
101
- kept.forms.add(form.text);
102
- reading.targets.set(`${field}\u0000${found}`, kept);
103
- }
104
- function walk(reading, node, forms, exact) {
105
- record(reading, node, forms, exact);
106
- if (Array.isArray(node)) {
107
- node.forEach((item, index) => walk(reading, item, forms.flatMap((form) => [
108
- ...(form.pending
109
- ? []
110
- : [{ text: `${form.text}/${index}`, through: form.through, pending: false }]),
111
- { text: form.text, through: true, pending: true },
112
- ]), `${exact}/${index}`));
113
- return;
114
- }
115
- if (!plainObject(node))
116
- return;
117
- for (const [key, value] of Object.entries(node)) {
118
- const segment = escapePointer(key);
119
- walk(reading, value, forms.flatMap((form) => form.pending && ARRAY_INDEX.test(key)
120
- ? []
121
- : [{ text: `${form.text}/${segment}`, through: form.through, pending: false }]), `${exact}/${segment}`);
122
- }
123
- }
124
- function bodyTargets(path, content) {
125
- const seen = new Set();
126
- const found = [];
127
- for (const { target: reached } of bodyLinks(bodyAfterFrontmatter(content), path)) {
128
- if (seen.has(reached))
129
- continue;
130
- seen.add(reached);
131
- found.push({ kind: 'body', form: '', target: reached, field: '' });
132
- }
133
- return found;
134
- }
135
- function typedRows(path, content, document, composition) {
136
- const definition = definitionOf(governing(composition, path), document.type);
137
- const reading = {
138
- path,
139
- references: new Set(definition === undefined ? [] : references(document, definition).map((one) => one.pointer)),
140
- values: [],
141
- reached: new Map(),
142
- targets: new Map(),
143
- };
144
- for (const [name, value] of Object.entries(document.fields)) {
145
- const segment = escapePointer(name);
146
- walk(reading, value, [{ text: `/${segment}`, through: false, pending: false }], `/${segment}`);
147
- }
148
- const links = [];
149
- for (const { field, target: reached, forms } of reading.targets.values()) {
150
- for (const form of [...forms].sort()) {
151
- links.push({ kind: 'field', form, target: reached, field });
152
- }
153
- }
154
- if (definition !== undefined) {
155
- const sectioned = new Set();
156
- for (const { target: reached } of sectionReferences(path, content, definition)) {
157
- if (reached === null || sectioned.has(reached))
158
- continue;
159
- sectioned.add(reached);
160
- links.push({ kind: 'section', form: '', target: reached, field: '' });
161
- }
162
- }
163
- return { values: reading.values, links: [...links, ...bodyTargets(path, content)] };
164
- }
165
- export function derived(path, content, composition) {
39
+ export function described(path, content, facts) {
166
40
  const folder = folderOf(path);
167
- const unread = { values: [], links: [], fields: null, folder, type: null };
41
+ const unread = { type: null, fields: null, links: null, folder };
168
42
  if (content === null)
169
43
  return { ...unread, declared: null, queried: true };
170
- const read = parseFrontmatter(content, path);
171
- const declared = read.ok ? (read.frontmatter.type ?? 'any') : null;
172
- if (!markdownPath(path)) {
173
- return { ...unread, declared, queried: true, links: bodyTargets(path, content) };
174
- }
175
- if (!read.ok)
176
- return { ...unread, declared, queried: false };
177
- const document = read.frontmatter;
44
+ if (facts === null)
45
+ return { ...unread, declared: null, queried: !markdownPath(path) };
46
+ const links = JSON.stringify(facts.links);
47
+ if (!markdownPath(path))
48
+ return { ...unread, declared: facts.type, queried: true, links };
178
49
  return {
179
- type: document.type ?? 'any',
180
- declared,
50
+ type: facts.type,
51
+ declared: facts.type,
181
52
  queried: true,
182
53
  folder,
183
- fields: JSON.stringify(document.fields),
184
- ...typedRows(path, content, document, composition),
54
+ fields: fieldsText(facts.fields),
55
+ links,
185
56
  };
186
57
  }
58
+ export function heldOf(path, content, facts) {
59
+ if (content === null || facts === null)
60
+ return { type: null, fields: null, links: [] };
61
+ return markdownPath(path)
62
+ ? { type: facts.type, fields: facts.fields, links: facts.links }
63
+ : { type: null, fields: null, links: facts.links };
64
+ }
65
+ export function derived(path, held, composition) {
66
+ const stored = held.links.map((target) => ({
67
+ kind: 'link',
68
+ keys: '',
69
+ places: '',
70
+ target,
71
+ field: '',
72
+ }));
73
+ if (held.type === null || held.fields === null)
74
+ return { values: [], links: stored };
75
+ const definition = definitionOf(governing(composition, path), held.type);
76
+ const { values, links: fields } = indexed(path, held.fields, definition);
77
+ return { values, links: [...fields, ...stored] };
78
+ }
package/dist/save.d.ts CHANGED
@@ -21,6 +21,7 @@ export type SaveInput = {
21
21
  providerOwnedPaths: readonly string[];
22
22
  providerLimits: readonly ProviderLimit[];
23
23
  visible: VisibleLayer;
24
+ folders: ReadonlySet<string>;
24
25
  handle: string;
25
26
  changes: readonly Change[];
26
27
  bases: readonly Precondition[];
@@ -75,6 +76,7 @@ export type MoveSide = {
75
76
  operations: OperationScopes;
76
77
  providerOwnedPaths: readonly string[];
77
78
  visible: VisibleLayer;
79
+ folders: ReadonlySet<string>;
78
80
  queued: ReadonlySet<string>;
79
81
  unmodeled: boolean;
80
82
  validate: Validator;
@@ -1 +1 @@
1
- {"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../src/save.ts"],"names":[],"mappings":"AACA,OAAO,EAkBL,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAKL,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EAEjB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,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