@agentshouse/mdruntime 0.1.0-c3903a68dcbbf → 0.1.0-c56daf494ecb4

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 (178) hide show
  1. package/AGENTS.md +184 -92
  2. package/README.md +22 -12
  3. package/dist/adapter.d.ts +125 -63
  4. package/dist/adapter.d.ts.map +1 -1
  5. package/dist/adapter.js +1 -9
  6. package/dist/attached-model.d.ts +11 -0
  7. package/dist/attached-model.d.ts.map +1 -0
  8. package/dist/attached-model.js +47 -0
  9. package/dist/attempt.d.ts +16 -0
  10. package/dist/attempt.d.ts.map +1 -0
  11. package/dist/attempt.js +70 -0
  12. package/dist/binary.d.ts +23 -0
  13. package/dist/binary.d.ts.map +1 -0
  14. package/dist/binary.js +8 -0
  15. package/dist/bootstrap.d.ts +20 -6
  16. package/dist/bootstrap.d.ts.map +1 -1
  17. package/dist/bootstrap.js +93 -39
  18. package/dist/change-set.d.ts.map +1 -1
  19. package/dist/change-set.js +20 -17
  20. package/dist/change.d.ts +15 -0
  21. package/dist/change.d.ts.map +1 -1
  22. package/dist/change.js +26 -1
  23. package/dist/chat/acts.d.ts +34 -0
  24. package/dist/chat/acts.d.ts.map +1 -0
  25. package/dist/chat/acts.js +36 -0
  26. package/dist/chat/context.d.ts +3 -0
  27. package/dist/chat/context.d.ts.map +1 -0
  28. package/dist/chat/context.js +10 -0
  29. package/dist/chat/input.d.ts +9 -0
  30. package/dist/chat/input.d.ts.map +1 -0
  31. package/dist/chat/input.js +99 -0
  32. package/dist/chat/kit.d.ts +60 -0
  33. package/dist/chat/kit.d.ts.map +1 -0
  34. package/dist/chat/kit.js +123 -0
  35. package/dist/chat/lasting.d.ts +6 -0
  36. package/dist/chat/lasting.d.ts.map +1 -0
  37. package/dist/chat/lasting.js +19 -0
  38. package/dist/chat/list.d.ts +26 -0
  39. package/dist/chat/list.d.ts.map +1 -0
  40. package/dist/chat/list.js +62 -0
  41. package/dist/chat/markdown.d.ts +20 -0
  42. package/dist/chat/markdown.d.ts.map +1 -0
  43. package/dist/chat/markdown.js +188 -0
  44. package/dist/chat/message.d.ts +6 -0
  45. package/dist/chat/message.d.ts.map +1 -0
  46. package/dist/chat/message.js +192 -0
  47. package/dist/chat/messages.d.ts +21 -0
  48. package/dist/chat/messages.d.ts.map +1 -0
  49. package/dist/chat/messages.js +151 -0
  50. package/dist/chat/name.d.ts +6 -0
  51. package/dist/chat/name.d.ts.map +1 -0
  52. package/dist/chat/name.js +37 -0
  53. package/dist/chat/opened.d.ts +11 -0
  54. package/dist/chat/opened.d.ts.map +1 -0
  55. package/dist/chat/opened.js +17 -0
  56. package/dist/chat/overlay.d.ts +31 -0
  57. package/dist/chat/overlay.d.ts.map +1 -0
  58. package/dist/chat/overlay.js +97 -0
  59. package/dist/chat/parts.d.ts +57 -0
  60. package/dist/chat/parts.d.ts.map +1 -0
  61. package/dist/chat/parts.js +119 -0
  62. package/dist/chat/process.d.ts +20 -0
  63. package/dist/chat/process.d.ts.map +1 -0
  64. package/dist/chat/process.js +32 -0
  65. package/dist/chat/provider.d.ts +63 -0
  66. package/dist/chat/provider.d.ts.map +1 -0
  67. package/dist/chat/provider.js +645 -0
  68. package/dist/chat/question.d.ts +9 -0
  69. package/dist/chat/question.d.ts.map +1 -0
  70. package/dist/chat/question.js +80 -0
  71. package/dist/chat/questions.d.ts +31 -0
  72. package/dist/chat/questions.d.ts.map +1 -0
  73. package/dist/chat/questions.js +111 -0
  74. package/dist/chat/read.d.ts +5 -0
  75. package/dist/chat/read.d.ts.map +1 -0
  76. package/dist/chat/read.js +13 -0
  77. package/dist/chat/ready.d.ts +33 -0
  78. package/dist/chat/ready.d.ts.map +1 -0
  79. package/dist/chat/ready.js +91 -0
  80. package/dist/chat/style.d.ts +4 -0
  81. package/dist/chat/style.d.ts.map +1 -0
  82. package/dist/chat/style.js +302 -0
  83. package/dist/chat.d.ts +14 -0
  84. package/dist/chat.d.ts.map +1 -0
  85. package/dist/chat.js +8 -0
  86. package/dist/client.d.ts +17 -13
  87. package/dist/client.d.ts.map +1 -1
  88. package/dist/client.js +68 -31
  89. package/dist/collection.d.ts +6 -13
  90. package/dist/collection.d.ts.map +1 -1
  91. package/dist/collection.js +56 -29
  92. package/dist/connection.d.ts +28 -33
  93. package/dist/connection.d.ts.map +1 -1
  94. package/dist/connection.js +951 -745
  95. package/dist/conversation.d.ts +32 -13
  96. package/dist/conversation.d.ts.map +1 -1
  97. package/dist/conversation.js +293 -108
  98. package/dist/entry.d.ts +17 -0
  99. package/dist/entry.d.ts.map +1 -0
  100. package/dist/entry.js +156 -0
  101. package/dist/expectation.d.ts +21 -0
  102. package/dist/expectation.d.ts.map +1 -0
  103. package/dist/expectation.js +70 -0
  104. package/dist/failure.d.ts +13 -0
  105. package/dist/failure.d.ts.map +1 -0
  106. package/dist/failure.js +19 -0
  107. package/dist/host.d.ts +9 -3
  108. package/dist/host.d.ts.map +1 -1
  109. package/dist/host.js +49 -68
  110. package/dist/identity.d.ts +3 -0
  111. package/dist/identity.d.ts.map +1 -1
  112. package/dist/identity.js +13 -1
  113. package/dist/index.d.ts +9 -5
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +3 -1
  116. package/dist/memory.d.ts +14 -7
  117. package/dist/memory.d.ts.map +1 -1
  118. package/dist/memory.js +137 -46
  119. package/dist/model.d.ts +13 -12
  120. package/dist/model.d.ts.map +1 -1
  121. package/dist/model.js +6 -3
  122. package/dist/observation.d.ts +2 -0
  123. package/dist/observation.d.ts.map +1 -1
  124. package/dist/observation.js +24 -14
  125. package/dist/open.d.ts +2 -0
  126. package/dist/open.d.ts.map +1 -0
  127. package/dist/open.js +1 -0
  128. package/dist/outcome.d.ts +32 -23
  129. package/dist/outcome.d.ts.map +1 -1
  130. package/dist/outcome.js +41 -1
  131. package/dist/overlay.d.ts +14 -3
  132. package/dist/overlay.d.ts.map +1 -1
  133. package/dist/overlay.js +75 -37
  134. package/dist/paths.d.ts +0 -1
  135. package/dist/paths.d.ts.map +1 -1
  136. package/dist/paths.js +0 -16
  137. package/dist/query.d.ts +12 -3
  138. package/dist/query.d.ts.map +1 -1
  139. package/dist/query.js +78 -36
  140. package/dist/reach.d.ts +42 -0
  141. package/dist/reach.d.ts.map +1 -0
  142. package/dist/reach.js +294 -0
  143. package/dist/react.d.ts +41 -0
  144. package/dist/react.d.ts.map +1 -0
  145. package/dist/react.js +64 -0
  146. package/dist/read-side.d.ts +4 -0
  147. package/dist/read-side.d.ts.map +1 -1
  148. package/dist/read-side.js +125 -56
  149. package/dist/refresh.d.ts +12 -1
  150. package/dist/refresh.d.ts.map +1 -1
  151. package/dist/refresh.js +44 -36
  152. package/dist/replica.d.ts +9 -6
  153. package/dist/replica.d.ts.map +1 -1
  154. package/dist/replica.js +83 -68
  155. package/dist/room-draft.d.ts +29 -9
  156. package/dist/room-draft.d.ts.map +1 -1
  157. package/dist/room-draft.js +137 -26
  158. package/dist/rows.d.ts +7 -2
  159. package/dist/rows.d.ts.map +1 -1
  160. package/dist/rows.js +85 -40
  161. package/dist/save.d.ts +27 -3
  162. package/dist/save.d.ts.map +1 -1
  163. package/dist/save.js +435 -86
  164. package/dist/search.d.ts +3 -2
  165. package/dist/search.d.ts.map +1 -1
  166. package/dist/status.d.ts +2 -2
  167. package/dist/status.d.ts.map +1 -1
  168. package/dist/status.js +0 -8
  169. package/dist/store.d.ts +41 -25
  170. package/dist/store.d.ts.map +1 -1
  171. package/dist/store.js +315 -191
  172. package/dist/wire.d.ts +58 -19
  173. package/dist/wire.d.ts.map +1 -1
  174. package/dist/wire.js +65 -67
  175. package/package.json +31 -7
  176. package/dist/attachment.d.ts +0 -3
  177. package/dist/attachment.d.ts.map +0 -1
  178. package/dist/attachment.js +0 -8
package/dist/query.js CHANGED
@@ -1,7 +1,12 @@
1
+ import { pointerFacts, } from '@agentshouse/mdmodel';
2
+ import { referenceField } from './model.js';
1
3
  import { normalize } from './paths.js';
2
4
  export class QueryError extends Error {
5
+ code;
6
+ retryable = false;
3
7
  constructor(code, at, problem) {
4
8
  super(`${code} at ${at}: ${problem}`);
9
+ this.code = code;
5
10
  }
6
11
  }
7
12
  const RANGE = ['$gt', '$gte', '$lt', '$lte'];
@@ -11,6 +16,7 @@ const RELATED = ['types', 'where', 'pathPrefix', 'field'];
11
16
  const PARTS = ['fields', 'sections', 'preamble', 'markdown', 'backlinks', 'change'];
12
17
  const ORDER = ['by', 'direction', 'nulls', 'stringSort', 'locale', 'localeOptions'];
13
18
  const CALENDAR_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
19
+ const STRAY_ESCAPE = /~(?![01])/u;
14
20
  export function invalid(at, problem) {
15
21
  throw new QueryError('invalid-query', at, problem);
16
22
  }
@@ -68,23 +74,29 @@ function calendarDate(value) {
68
74
  const date = new Date(Date.UTC(year, month - 1, day));
69
75
  return (date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day);
70
76
  }
71
- function fits(spec, value) {
72
- const item = spec.kind === 'list' ? spec.of : spec;
73
- if (item.kind === 'number')
77
+ function itemOf(facts) {
78
+ return facts.type === 'array' ? facts.items : facts;
79
+ }
80
+ function fits(facts, value) {
81
+ const item = itemOf(facts);
82
+ if (item?.type === undefined)
83
+ return true;
84
+ if (item.values !== undefined)
85
+ return item.values.includes(value);
86
+ if (item.type === 'number')
74
87
  return typeof value === 'number';
75
- if (typeof value !== 'string')
88
+ if (item.type === 'integer')
89
+ return Number.isSafeInteger(value);
90
+ if (item.type === 'boolean')
91
+ return typeof value === 'boolean';
92
+ if (item.type !== 'string' || typeof value !== 'string')
76
93
  return false;
77
- if (item.kind === 'enum')
78
- return item.values.includes(value);
79
- if (item.kind === 'date')
80
- return calendarDate(value);
81
- if (item.kind === 'reference')
94
+ if (item.reference !== undefined)
82
95
  return value !== '' && normalize(value) === value;
96
+ if (item.format === 'date')
97
+ return calendarDate(value);
83
98
  return true;
84
99
  }
85
- function reference(spec) {
86
- return spec.kind === 'reference' || (spec.kind === 'list' && spec.of.kind === 'reference');
87
- }
88
100
  function typing(facts, rooms, types, at) {
89
101
  const read = rooms === null ? facts.rooms : facts.rooms.filter((room) => rooms.includes(room.locator));
90
102
  const acquiring = !facts.listed &&
@@ -102,22 +114,46 @@ function typing(facts, rooms, types, at) {
102
114
  types: types === null ? declared : declared.filter((type) => types.includes(type.name)),
103
115
  };
104
116
  }
105
- function specs(typed, field, at) {
106
- const declared = typed.types.flatMap((type) => Object.hasOwn(type.fields, field) ? [type.fields[field]] : []);
117
+ function pointer(input, at) {
118
+ if (typeof input !== 'string' || !input.startsWith('/') || STRAY_ESCAPE.test(input)) {
119
+ invalid(at, 'expects a JSON Pointer');
120
+ }
121
+ return input;
122
+ }
123
+ function specs(typed, input, at) {
124
+ const field = pointer(input, at);
125
+ const declared = typed.types.flatMap((type) => {
126
+ const spec = pointerFacts(type, field);
127
+ return spec === undefined ? [] : [spec];
128
+ });
107
129
  if (declared.length === 0 && !typed.untyped) {
108
130
  throw new QueryError('unknown-field', at, `no MD Type it reads declares ${field}`);
109
131
  }
110
- return declared;
132
+ if (!declared.some((spec) => spec.conditional))
133
+ return declared;
134
+ return declared.map((spec) => ({
135
+ facts: { prose: false },
136
+ through: several(spec),
137
+ conditional: true,
138
+ }));
139
+ }
140
+ function several(spec) {
141
+ return spec.through || spec.facts.type === 'array';
142
+ }
143
+ function single(spec) {
144
+ return spec.facts.type !== undefined && spec.facts.type !== 'array';
145
+ }
146
+ function every(declared, holds) {
147
+ return declared.length > 0 && declared.every(holds);
111
148
  }
112
149
  function kind(declared, checked, at) {
113
- if (checked === null || declared.length === 0 || declared.some((spec) => fits(spec, checked))) {
150
+ if (checked === null ||
151
+ declared.length === 0 ||
152
+ declared.some((spec) => fits(spec.facts, checked))) {
114
153
  return;
115
154
  }
116
155
  throw new QueryError('wrong-kind', at, `${JSON.stringify(checked)} is not of its field's kind`);
117
156
  }
118
- function listed(declared, list) {
119
- return declared.length > 0 && declared.every((spec) => (spec.kind === 'list') === list);
120
- }
121
157
  function test(declared, input, at) {
122
158
  if (!plain(input)) {
123
159
  const equal = value(input, at);
@@ -131,8 +167,11 @@ function test(declared, input, at) {
131
167
  const stray = operators.find((operator) => !RANGE.includes(operator));
132
168
  if (stray !== undefined)
133
169
  invalid(place(at, stray), 'cannot join a range');
134
- if (listed(declared, true))
170
+ if (every(declared, (spec) => spec.facts.type === 'array'))
135
171
  invalid(at, 'a range on a list');
172
+ if (every(declared, (spec) => spec.facts.type === 'boolean' || spec.facts.type === 'object')) {
173
+ throw new QueryError('wrong-kind', at, 'its field does not compare in order');
174
+ }
136
175
  return {
137
176
  op: 'range',
138
177
  bounds: RANGE.filter((operator) => operators.includes(operator)).map((operator) => {
@@ -165,7 +204,7 @@ function test(declared, input, at) {
165
204
  return { op: 'nin', values: compared };
166
205
  if (compared.includes(null))
167
206
  invalid(where, 'a list holds no null');
168
- if (listed(declared, false))
207
+ if (every(declared, single))
169
208
  invalid(where, 'the field is not a list');
170
209
  return { op: 'all', values: compared };
171
210
  }
@@ -173,7 +212,7 @@ function test(declared, input, at) {
173
212
  if (!Number.isSafeInteger(operand) || operand < 0) {
174
213
  invalid(where, 'expects a nonnegative integer');
175
214
  }
176
- if (listed(declared, false))
215
+ if (every(declared, single))
177
216
  invalid(where, 'the field is not a list');
178
217
  return { op: 'size', size: operand };
179
218
  }
@@ -186,7 +225,7 @@ function condition(typed, input, at) {
186
225
  invalid(at, 'expects an object of field predicates');
187
226
  const conditions = [];
188
227
  for (const name of Object.keys(input).sort()) {
189
- const where = place(at, name);
228
+ const where = name.startsWith('/') ? `${at}${name}` : place(at, name);
190
229
  const entry = input[name];
191
230
  if (name === '$and' || name === '$or') {
192
231
  const nested = list(entry, where).map((item, index) => condition(typed, item, `${where}[${index}]`));
@@ -215,19 +254,19 @@ function scope(facts, rooms, input, at) {
215
254
  pathPrefix: input.pathPrefix === undefined ? null : directory(input.pathPrefix, place(at, 'pathPrefix')),
216
255
  };
217
256
  }
218
- function referenceField(typed, field, at) {
219
- if (typeof field !== 'string')
220
- invalid(at, 'expects a field name');
257
+ function referenceName(typed, field, at) {
221
258
  const declared = specs(typed, field, at);
222
- if (declared.length > 0 && !declared.some(reference))
259
+ if (declared.length > 0 &&
260
+ !declared.some((spec) => spec.conditional || referenceField(spec.facts))) {
223
261
  invalid(at, 'not a reference field');
262
+ }
224
263
  return field;
225
264
  }
226
265
  function hopOf(facts, rooms, root, input) {
227
266
  if (!plain(input))
228
267
  invalid('hop', 'expects an object');
229
268
  known(input, RELATED, 'hop');
230
- const field = referenceField(root, input.field, 'hop.field');
269
+ const field = referenceName(root, input.field, 'hop.field');
231
270
  const { types, where, pathPrefix } = scope(facts, rooms, input, 'hop');
232
271
  return { types, where, pathPrefix, field };
233
272
  }
@@ -236,14 +275,16 @@ function backlinksOf(facts, rooms, input) {
236
275
  invalid('backlinks', 'expects an object');
237
276
  known(input, RELATED, 'backlinks');
238
277
  const { typed, types, where, pathPrefix } = scope(facts, rooms, input, 'backlinks');
239
- const field = input.field === undefined ? null : referenceField(typed, input.field, 'backlinks.field');
278
+ const field = input.field === undefined ? null : referenceName(typed, input.field, 'backlinks.field');
240
279
  return { types, where, pathPrefix, field };
241
280
  }
242
281
  function keyPlan(typed, input, at, path) {
243
282
  if (input === 'room' || input === 'type' || (path && input === 'path'))
244
283
  return { of: input };
245
- if (plain(input) && typeof input.field === 'string' && Object.keys(input).length === 1) {
246
- specs(typed, input.field, place(at, 'field'));
284
+ if (plain(input) && Object.hasOwn(input, 'field') && Object.keys(input).length === 1) {
285
+ if (specs(typed, input.field, place(at, 'field')).some(several)) {
286
+ invalid(place(at, 'field'), 'a path that can hold several values');
287
+ }
247
288
  return { of: 'field', field: input.field };
248
289
  }
249
290
  return invalid(at, path ? 'expects room, path, type or a field' : 'expects room, type or a field');
@@ -301,10 +342,10 @@ function parts(typed, input, at, fields) {
301
342
  return 'all';
302
343
  const named = list(input, at);
303
344
  named.forEach((name, index) => {
304
- if (typeof name !== 'string')
305
- invalid(`${at}[${index}]`, 'expects a name');
306
345
  if (fields)
307
346
  specs(typed, name, `${at}[${index}]`);
347
+ else if (typeof name !== 'string')
348
+ invalid(`${at}[${index}]`, 'expects a name');
308
349
  });
309
350
  return named;
310
351
  }
@@ -372,7 +413,7 @@ function groupShape(typed, input) {
372
413
  });
373
414
  return { kind: 'groups', groupBy, orderBy };
374
415
  }
375
- export function planOf(input, facts) {
416
+ export function planOf(input, facts, reach = null) {
376
417
  if (!plain(input))
377
418
  invalid('query', 'expects a query object');
378
419
  const grouped = input.groupBy !== undefined;
@@ -386,6 +427,7 @@ export function planOf(input, facts) {
386
427
  const { typed, ...root } = scope(facts, rooms, input, '');
387
428
  return {
388
429
  rooms,
430
+ reach,
389
431
  root,
390
432
  hop: input.hop === undefined ? null : hopOf(facts, rooms, typed, input.hop),
391
433
  backlinks: input.backlinks === undefined ? null : backlinksOf(facts, rooms, input.backlinks),
@@ -401,11 +443,11 @@ export function limitOf(input) {
401
443
  }
402
444
  return input;
403
445
  }
404
- export function filterOf(input, facts) {
446
+ export function filterOf(input, facts, reach = null) {
405
447
  if (!plain(input))
406
448
  invalid('documents', 'expects a filter object');
407
449
  known(input, FILTER, '');
408
- return planOf({ ...input, select: {} }, facts);
450
+ return planOf({ ...input, select: {} }, facts, reach);
409
451
  }
410
452
  function canonical(value) {
411
453
  if (Array.isArray(value))
@@ -0,0 +1,42 @@
1
+ import type { ReferrerScope } from './adapter.js';
2
+ import type { MdRuntime, RuntimeTopic } from './connection.js';
3
+ import type { Plan, PlanReach, QueryResult } from './query.js';
4
+ import type { SearchResult } from './search.js';
5
+ export type ReachedDocument = {
6
+ readonly room: string;
7
+ readonly path: string;
8
+ };
9
+ export type PortReach = {
10
+ readonly rooms: readonly string[];
11
+ readonly documents: readonly ReachedDocument[];
12
+ readonly conversations: boolean;
13
+ };
14
+ export type Deliver = (message: unknown) => void;
15
+ export type Watch = (topic: RuntimeTopic, input: readonly unknown[], deliver: Deliver) => () => void;
16
+ export type RuntimeView = {
17
+ md: MdRuntime;
18
+ watch: Watch;
19
+ };
20
+ export type NarrowedView = RuntimeView & {
21
+ narrow(reach: PortReach | null): void;
22
+ };
23
+ export type Reachable = RuntimeView & {
24
+ plan(input: unknown, reach: PortReach | null): Plan;
25
+ query(plan: Plan): Promise<QueryResult>;
26
+ watchPlan(plan: Plan, deliver: (message: unknown) => void): () => void;
27
+ search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
28
+ referrerScope(referrer: unknown): ReferrerScope | null;
29
+ };
30
+ export declare function holds(reach: PortReach | null, room: string): boolean;
31
+ export declare function governs(reach: PortReach | null, room: {
32
+ readonly locator: string;
33
+ readonly typedSelection: {
34
+ roots: readonly string[];
35
+ } | null;
36
+ }): {
37
+ readonly collection: boolean;
38
+ readonly selection: boolean;
39
+ };
40
+ export declare function planReach(reach: PortReach | null): PlanReach | null;
41
+ export declare function narrowed(runtime: Reachable, given: PortReach | null): NarrowedView;
42
+ //# sourceMappingURL=reach.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reach.d.ts","sourceRoot":"","sources":["../src/reach.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAW,SAAS,EAAe,YAAY,EAAc,MAAM,iBAAiB,CAAC;AAajG,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAU/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAA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EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,GAC/F;IAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAU/D;AA2BD,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CASnE;AA8ED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,YAAY,CA4KlF"}
package/dist/reach.js ADDED
@@ -0,0 +1,294 @@
1
+ import { unheldView } from './conversation.js';
2
+ import { modelTypes, NO_MODEL } from './model.js';
3
+ import { applied, observing } from './observation.js';
4
+ import { runtimeError } from './failure.js';
5
+ import { failure, undeclared, } from './outcome.js';
6
+ import { beneath } from './paths.js';
7
+ import { reconciled } from './read-side.js';
8
+ import { moveTarget, readParts, staleWrite, } from './room-draft.js';
9
+ import { documentKey } from './rows.js';
10
+ const UNHELD_TYPES = { collection: modelTypes(NO_MODEL), typedSelection: null };
11
+ function unconversed(name) {
12
+ return () => Promise.resolve(undeclared(name));
13
+ }
14
+ const NO_CONVERSATION = {
15
+ list: () => Promise.resolve([]),
16
+ read: (conversation) => Promise.resolve(unheldView(conversation)),
17
+ create: unconversed('conversation.create'),
18
+ send: unconversed('conversation.send'),
19
+ answer: unconversed('conversation.answer'),
20
+ interrupt: unconversed('conversation.interrupt'),
21
+ kill: unconversed('conversation.kill'),
22
+ cancel: unconversed('conversation.cancel'),
23
+ delete: unconversed('conversation.delete'),
24
+ };
25
+ const NO_CHAT_DRAFT = {
26
+ write: () => Promise.resolve(),
27
+ discard: () => Promise.resolve(),
28
+ };
29
+ export function holds(reach, room) {
30
+ return (reach === null ||
31
+ reach.rooms.includes(room) ||
32
+ reach.documents.some((document) => document.room === room));
33
+ }
34
+ function wholly(reach, room) {
35
+ return reach === null || reach.rooms.includes(room);
36
+ }
37
+ export function governs(reach, room) {
38
+ if (wholly(reach, room.locator)) {
39
+ return { collection: true, selection: room.typedSelection !== null };
40
+ }
41
+ const selected = (path) => room.typedSelection?.roots.some((root) => beneath(root, path)) ?? false;
42
+ const paths = reach.documents
43
+ .filter((document) => document.room === room.locator)
44
+ .map(({ path }) => path);
45
+ return { collection: paths.some((path) => !selected(path)), selection: paths.some(selected) };
46
+ }
47
+ function covers(reach, room, path) {
48
+ return (reach === null ||
49
+ reach.rooms.includes(room) ||
50
+ reach.documents.some((document) => document.room === room && document.path === path));
51
+ }
52
+ function conversing(reach) {
53
+ return reach === null || reach.conversations;
54
+ }
55
+ function refers(reach, scope) {
56
+ if (reach === null)
57
+ return true;
58
+ if (scope === null)
59
+ return false;
60
+ if (scope.kind === 'conversations')
61
+ return reach.conversations;
62
+ return scope.path === undefined
63
+ ? wholly(reach, scope.locator)
64
+ : covers(reach, scope.locator, scope.path);
65
+ }
66
+ function unreachedReference(fileRef) {
67
+ return { kind: 'absent', code: 'binary-file-absent', fields: { fileRef }, retryable: false };
68
+ }
69
+ export function planReach(reach) {
70
+ return reach === null
71
+ ? null
72
+ : {
73
+ rooms: [...new Set(reach.rooms)].sort(),
74
+ documents: [
75
+ ...new Set(reach.documents.map(({ room, path }) => documentKey(room, path))),
76
+ ].sort(),
77
+ };
78
+ }
79
+ function roomsWithin(reach, rooms) {
80
+ return rooms.filter((room) => wholly(reach, room.locator));
81
+ }
82
+ function typesWithin(reach, room, types) {
83
+ if (room === undefined)
84
+ return structuredClone(UNHELD_TYPES);
85
+ const governed = governs(reach, room);
86
+ return {
87
+ collection: governed.collection ? types.collection : modelTypes(NO_MODEL),
88
+ typedSelection: governed.selection ? types.typedSelection : null,
89
+ };
90
+ }
91
+ function moves(reach, room, move) {
92
+ return move === undefined || covers(reach, room, moveTarget(move));
93
+ }
94
+ function draftWithin(reach, draft) {
95
+ return covers(reach, draft.room, draft.path) && moves(reach, draft.room, draft.parts.move);
96
+ }
97
+ function draftsWithin(reach, drafts) {
98
+ return drafts.filter((draft) => draftWithin(reach, draft));
99
+ }
100
+ function shownDraft(reach, draft) {
101
+ return draft !== null && draftWithin(reach, draft) ? draft : null;
102
+ }
103
+ function writeWithin(reach, write) {
104
+ return write.outcome === 'written'
105
+ ? { outcome: 'written', roomDraft: shownDraft(reach, write.roomDraft) }
106
+ : staleWrite(shownDraft(reach, write.current));
107
+ }
108
+ function savedWithin(reach, room, result) {
109
+ if (reach === null || result.outcome === 'saved')
110
+ return result;
111
+ const { file, location, referrers, ...refusal } = result;
112
+ const hidden = file !== undefined && !covers(reach, room, file);
113
+ return {
114
+ ...refusal,
115
+ ...(file === undefined || hidden ? {} : { file }),
116
+ ...(location === undefined || hidden ? {} : { location }),
117
+ ...(referrers === undefined
118
+ ? {}
119
+ : { referrers: referrers.filter((path) => covers(reach, room, path)) }),
120
+ };
121
+ }
122
+ function statusWithin(reach, status) {
123
+ return {
124
+ ...status,
125
+ attentionRequired: status.attentionRequired.filter((entry) => covers(reach, entry.room, entry.path)),
126
+ };
127
+ }
128
+ function queueWithin(reach, room, entries) {
129
+ return entries.filter(({ batch }) => batch.changes.every((change) => covers(reach, room, change.path) &&
130
+ (change.kind !== 'move' || covers(reach, room, change.to))));
131
+ }
132
+ function unreached(room) {
133
+ return runtimeError('room-not-held', `No Local Replica for ${room}`);
134
+ }
135
+ export function narrowed(runtime, given) {
136
+ const { md, watch } = runtime;
137
+ let reach = given;
138
+ const open = new Set();
139
+ function following(begin) {
140
+ let stop = begin();
141
+ const restart = () => {
142
+ stop();
143
+ stop = begin();
144
+ };
145
+ open.add(restart);
146
+ return () => {
147
+ open.delete(restart);
148
+ stop();
149
+ };
150
+ }
151
+ const within = (topic, input, deliver) => {
152
+ if (topic === 'rooms') {
153
+ return following(() => watch(topic, input, (rooms) => deliver(roomsWithin(reach, rooms))));
154
+ }
155
+ if (topic === 'sync-status') {
156
+ return following(() => watch(topic, input, (status) => deliver(statusWithin(reach, status))));
157
+ }
158
+ if (topic === 'room-drafts') {
159
+ return following(() => watch(topic, input, (drafts) => deliver(draftsWithin(reach, drafts))));
160
+ }
161
+ if (topic === 'queue') {
162
+ const room = input[0];
163
+ return following(() => {
164
+ if (!holds(reach, room)) {
165
+ deliver([]);
166
+ return () => { };
167
+ }
168
+ return watch(topic, input, (entries) => deliver(queueWithin(reach, room, entries)));
169
+ });
170
+ }
171
+ if (topic === 'query') {
172
+ const plan = runtime.plan(input[0], reach);
173
+ let held = null;
174
+ return following(() => {
175
+ let first = true;
176
+ return runtime.watchPlan({ ...plan, reach: planReach(reach) }, (message) => {
177
+ if (!first) {
178
+ held = applied(held, message);
179
+ deliver(message);
180
+ return;
181
+ }
182
+ first = false;
183
+ if (held === null) {
184
+ held = message;
185
+ deliver(message);
186
+ return;
187
+ }
188
+ const next = reconciled(held, message);
189
+ if (next === null)
190
+ return;
191
+ held = next.keyed;
192
+ deliver(next.change);
193
+ });
194
+ });
195
+ }
196
+ if (topic === 'conversation') {
197
+ return following(() => {
198
+ if (conversing(reach))
199
+ return watch(topic, input, deliver);
200
+ deliver(unheldView(input[0]));
201
+ return () => { };
202
+ });
203
+ }
204
+ if (topic === 'conversations' || topic === 'agents') {
205
+ return following(() => {
206
+ if (conversing(reach))
207
+ return watch(topic, input, deliver);
208
+ deliver([]);
209
+ return () => { };
210
+ });
211
+ }
212
+ return watch(topic, input, deliver);
213
+ };
214
+ const conversation = () => (conversing(reach) ? md.conversation : NO_CONVERSATION);
215
+ const chatDraft = () => (conversing(reach) ? md.chatDraft : NO_CHAT_DRAFT);
216
+ const view = {
217
+ ...md,
218
+ rooms: () => roomsWithin(reach, md.rooms()),
219
+ query: ((input) => runtime.query(runtime.plan(input, reach))),
220
+ search: (input) => runtime.search(input, reach),
221
+ types(room) {
222
+ if (wholly(reach, room))
223
+ return md.types(room);
224
+ if (!holds(reach, room))
225
+ return structuredClone(UNHELD_TYPES);
226
+ const listed = md.rooms().find(({ locator }) => locator === room);
227
+ return typesWithin(reach, listed, md.types(room));
228
+ },
229
+ async save(room, roomDrafts, writtenBy) {
230
+ if (!holds(reach, room))
231
+ throw unreached(room);
232
+ const outside = roomDrafts.find(({ path }) => !covers(reach, room, path) ||
233
+ !moves(reach, room, md.roomDraft.read(room, path)?.parts.move));
234
+ if (outside !== undefined) {
235
+ return { outcome: 'refused', code: 'stale', retryable: false, file: outside.path };
236
+ }
237
+ return savedWithin(reach, room, await md.save(room, roomDrafts, writtenBy));
238
+ },
239
+ history: (room, path, query) => covers(reach, room, path)
240
+ ? md.history(room, path, query)
241
+ : Promise.resolve(failure({ kind: 'room-not-readable', locator: room })),
242
+ binaryFile: {
243
+ read: (room, path, revision) => covers(reach, room, path)
244
+ ? md.binaryFile.read(room, path, revision)
245
+ : Promise.resolve(failure({ kind: 'room-not-readable', locator: room })),
246
+ readReference: (reference) => refers(reach, runtime.referrerScope(reference.referrer))
247
+ ? md.binaryFile.readReference(reference)
248
+ : Promise.resolve(unreachedReference(reference.fileRef)),
249
+ },
250
+ reached: (room, roomVersion, path) => (path === undefined ? wholly(reach, room) : covers(reach, room, path)) &&
251
+ md.reached(room, roomVersion, path),
252
+ log: () => (reach === null ? md.log() : ''),
253
+ roomDraft: {
254
+ list: () => md.roomDraft.list().then((drafts) => draftsWithin(reach, drafts)),
255
+ read: (room, path) => covers(reach, room, path) ? shownDraft(reach, md.roomDraft.read(room, path)) : null,
256
+ async write(room, path, revision, parts) {
257
+ if (!covers(reach, room, path) || !moves(reach, room, readParts(parts).move)) {
258
+ throw unreached(room);
259
+ }
260
+ return writeWithin(reach, await md.roomDraft.write(room, path, revision, parts));
261
+ },
262
+ async discard(room, path, revision) {
263
+ if (!covers(reach, room, path))
264
+ return staleWrite(null);
265
+ return writeWithin(reach, await md.roomDraft.discard(room, path, revision));
266
+ },
267
+ },
268
+ conversation: {
269
+ list: () => conversation().list(),
270
+ read: (id, options) => conversation().read(id, options),
271
+ create: (input) => conversation().create(input),
272
+ send: (id) => conversation().send(id),
273
+ answer: (id, answer) => conversation().answer(id, answer),
274
+ interrupt: (id) => conversation().interrupt(id),
275
+ kill: (id) => conversation().kill(id),
276
+ cancel: (id, turn) => conversation().cancel(id, turn),
277
+ delete: (id) => conversation().delete(id),
278
+ },
279
+ chatDraft: {
280
+ write: (id, draft, revision) => chatDraft().write(id, draft, revision),
281
+ discard: (id) => chatDraft().discard(id),
282
+ },
283
+ observe: observing(within),
284
+ };
285
+ return {
286
+ md: view,
287
+ watch: within,
288
+ narrow(next) {
289
+ reach = next;
290
+ for (const restart of [...open])
291
+ restart();
292
+ },
293
+ };
294
+ }
@@ -0,0 +1,41 @@
1
+ import type { MdRuntimeClient } from './client.js';
2
+ import type { AppRoom, ConnectionRefusal, SaveResult } from './connection.js';
3
+ import type { Member, ServiceMode } from './adapter.js';
4
+ import type { ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
5
+ import { type RuntimeError } from './failure.js';
6
+ import type { QueueEntry } from './outcome.js';
7
+ import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult } from './query.js';
8
+ import type { RoomDraft, RoomDraftParts } from './room-draft.js';
9
+ import type { SyncStatus } from './status.js';
10
+ type Client = MdRuntimeClient | null;
11
+ export type Observed<T> = {
12
+ readonly state: 'loading';
13
+ } | {
14
+ readonly state: 'ready';
15
+ readonly value: T;
16
+ };
17
+ export declare function useObserve(client: Client, topic: 'deployment-facts'): Observed<unknown>;
18
+ export declare function useObserve(client: Client, topic: 'rooms'): Observed<readonly AppRoom[]>;
19
+ export declare function useObserve(client: Client, topic: 'connection-refusal'): Observed<ConnectionRefusal | null>;
20
+ export declare function useObserve(client: Client, topic: 'storage-loss'): Observed<string | null>;
21
+ export declare function useObserve(client: Client, topic: 'sync-status'): Observed<SyncStatus>;
22
+ export declare function useObserve(client: Client, topic: 'service-mode'): Observed<ServiceMode>;
23
+ export declare function useObserve(client: Client, topic: 'member'): Observed<Member | null>;
24
+ export declare function useObserve(client: Client, topic: 'query', query: DocumentQuery): Observed<DocumentResult>;
25
+ export declare function useObserve(client: Client, topic: 'query', query: GroupQuery): Observed<GroupResult>;
26
+ export declare function useObserve(client: Client, topic: 'queue', locator: string): Observed<readonly QueueEntry[]>;
27
+ export declare function useObserve(client: Client, topic: 'room-drafts'): Observed<readonly RoomDraft[]>;
28
+ export declare function useObserve(client: Client, topic: 'presentation'): Observed<unknown>;
29
+ export declare function useObserve(client: Client, topic: 'conversation', conversation: string, options: ConversationOptions): Observed<ConversationView>;
30
+ export declare function useObserve(client: Client, topic: 'conversations'): Observed<readonly ConversationEntry[]>;
31
+ export declare function useObserve(client: Client, topic: 'agents'): Observed<readonly ConversationAgent[]>;
32
+ export type Saving = {
33
+ readonly busy: boolean;
34
+ readonly outcome: SaveResult | null;
35
+ readonly failure: RuntimeError | null;
36
+ save(room: string, roomDrafts: ReadonlyMap<string, RoomDraftParts>): Promise<SaveResult>;
37
+ };
38
+ export declare function saveRoomDrafts(client: MdRuntimeClient, room: string, roomDrafts: ReadonlyMap<string, RoomDraftParts>): Promise<SaveResult>;
39
+ export declare function useSave(client: MdRuntimeClient): Saving;
40
+ export {};
41
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAkB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,c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