@agentshouse/mdruntime 0.1.0-c44866799613e → 0.1.0-c44d5cc00aee5

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 (314) hide show
  1. package/README.md +18 -17
  2. package/dist/acceptance.d.ts +3 -0
  3. package/dist/acceptance.d.ts.map +1 -0
  4. package/dist/acceptance.js +299 -0
  5. package/dist/act-lanes.d.ts +30 -0
  6. package/dist/act-lanes.d.ts.map +1 -0
  7. package/dist/act-lanes.js +225 -0
  8. package/dist/actions.d.ts +26 -0
  9. package/dist/actions.d.ts.map +1 -0
  10. package/dist/actions.js +302 -0
  11. package/dist/adapter.d.ts +110 -112
  12. package/dist/adapter.d.ts.map +1 -1
  13. package/dist/attached-model.d.ts +3 -11
  14. package/dist/attached-model.d.ts.map +1 -1
  15. package/dist/attached-model.js +28 -51
  16. package/dist/bootstrap.d.ts +15 -18
  17. package/dist/bootstrap.d.ts.map +1 -1
  18. package/dist/bootstrap.js +252 -158
  19. package/dist/cell.d.ts +6 -0
  20. package/dist/cell.d.ts.map +1 -0
  21. package/dist/cell.js +9 -0
  22. package/dist/chain.d.ts +2 -1
  23. package/dist/chain.d.ts.map +1 -1
  24. package/dist/change-set.d.ts +4 -0
  25. package/dist/change-set.d.ts.map +1 -1
  26. package/dist/change-set.js +6 -0
  27. package/dist/change.d.ts +1 -0
  28. package/dist/change.d.ts.map +1 -1
  29. package/dist/change.js +4 -2
  30. package/dist/chat-types.d.ts +3 -0
  31. package/dist/chat-types.d.ts.map +1 -0
  32. package/dist/chat-types.js +11 -0
  33. package/dist/client.d.ts +27 -21
  34. package/dist/client.d.ts.map +1 -1
  35. package/dist/client.js +36 -17
  36. package/dist/collection.d.ts +23 -7
  37. package/dist/collection.d.ts.map +1 -1
  38. package/dist/collection.js +13 -19
  39. package/dist/compile.d.ts +8 -6
  40. package/dist/compile.d.ts.map +1 -1
  41. package/dist/compile.js +288 -329
  42. package/dist/connection.d.ts +5 -143
  43. package/dist/connection.d.ts.map +1 -1
  44. package/dist/connection.js +109 -5104
  45. package/dist/context.d.ts +2 -0
  46. package/dist/context.d.ts.map +1 -0
  47. package/dist/context.js +7 -0
  48. package/dist/conversation-live.d.ts +143 -0
  49. package/dist/conversation-live.d.ts.map +1 -0
  50. package/dist/conversation-live.js +254 -0
  51. package/dist/conversation-row.d.ts +33 -0
  52. package/dist/conversation-row.d.ts.map +1 -0
  53. package/dist/conversation-row.js +53 -0
  54. package/dist/conversation.d.ts +65 -48
  55. package/dist/conversation.d.ts.map +1 -1
  56. package/dist/conversation.js +987 -838
  57. package/dist/declaration.d.ts +10 -0
  58. package/dist/declaration.d.ts.map +1 -0
  59. package/dist/declaration.js +24 -0
  60. package/dist/discovery.d.ts +10 -0
  61. package/dist/discovery.d.ts.map +1 -0
  62. package/dist/discovery.js +150 -0
  63. package/dist/durability.d.ts +19 -1
  64. package/dist/durability.d.ts.map +1 -1
  65. package/dist/durability.js +4 -0
  66. package/dist/entry.d.ts +3 -2
  67. package/dist/entry.d.ts.map +1 -1
  68. package/dist/entry.js +19 -9
  69. package/dist/expectation.d.ts +26 -13
  70. package/dist/expectation.d.ts.map +1 -1
  71. package/dist/expectation.js +72 -19
  72. package/dist/failure.d.ts +3 -0
  73. package/dist/failure.d.ts.map +1 -1
  74. package/dist/failure.js +6 -0
  75. package/dist/figures.d.ts +49 -0
  76. package/dist/figures.d.ts.map +1 -0
  77. package/dist/figures.js +197 -0
  78. package/dist/holdings.d.ts +29 -0
  79. package/dist/holdings.d.ts.map +1 -0
  80. package/dist/holdings.js +95 -0
  81. package/dist/host.d.ts +21 -8
  82. package/dist/host.d.ts.map +1 -1
  83. package/dist/host.js +73 -40
  84. package/dist/identity.d.ts +0 -1
  85. package/dist/identity.d.ts.map +1 -1
  86. package/dist/identity.js +0 -3
  87. package/dist/index.d.ts +34 -12
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +16 -5
  90. package/dist/install.d.ts +54 -0
  91. package/dist/install.d.ts.map +1 -0
  92. package/dist/install.js +530 -0
  93. package/dist/lifecycle.d.ts +7 -0
  94. package/dist/lifecycle.d.ts.map +1 -0
  95. package/dist/lifecycle.js +277 -0
  96. package/dist/listing.d.ts +48 -0
  97. package/dist/listing.d.ts.map +1 -0
  98. package/dist/listing.js +139 -0
  99. package/dist/live.d.ts +5 -4
  100. package/dist/live.d.ts.map +1 -1
  101. package/dist/live.js +64 -23
  102. package/dist/locks.d.ts +7 -0
  103. package/dist/locks.d.ts.map +1 -0
  104. package/dist/locks.js +32 -0
  105. package/dist/lost.d.ts +5 -0
  106. package/dist/lost.d.ts.map +1 -0
  107. package/dist/lost.js +49 -0
  108. package/dist/media.d.ts +2 -2
  109. package/dist/media.d.ts.map +1 -1
  110. package/dist/media.js +23 -13
  111. package/dist/memory.d.ts +17 -7
  112. package/dist/memory.d.ts.map +1 -1
  113. package/dist/memory.js +210 -97
  114. package/dist/messages.d.ts +33 -5
  115. package/dist/messages.d.ts.map +1 -1
  116. package/dist/messages.js +104 -36
  117. package/dist/model.d.ts +2 -11
  118. package/dist/model.d.ts.map +1 -1
  119. package/dist/model.js +0 -23
  120. package/dist/models.d.ts +10 -0
  121. package/dist/models.d.ts.map +1 -0
  122. package/dist/models.js +153 -0
  123. package/dist/observation.d.ts +4 -3
  124. package/dist/observation.d.ts.map +1 -1
  125. package/dist/observation.js +23 -17
  126. package/dist/opened.d.ts +1 -1
  127. package/dist/opened.d.ts.map +1 -1
  128. package/dist/opened.js +5 -5
  129. package/dist/opening.d.ts +4 -0
  130. package/dist/opening.d.ts.map +1 -0
  131. package/dist/opening.js +53 -0
  132. package/dist/outcome.d.ts +7 -4
  133. package/dist/outcome.d.ts.map +1 -1
  134. package/dist/outcome.js +18 -0
  135. package/dist/overlay.d.ts +6 -1
  136. package/dist/overlay.d.ts.map +1 -1
  137. package/dist/overlay.js +47 -21
  138. package/dist/page-metadata.d.ts +8 -0
  139. package/dist/page-metadata.d.ts.map +1 -0
  140. package/dist/page-metadata.js +19 -0
  141. package/dist/parts.d.ts +4 -0
  142. package/dist/parts.d.ts.map +1 -0
  143. package/dist/parts.js +13 -0
  144. package/dist/paths.d.ts +2 -0
  145. package/dist/paths.d.ts.map +1 -1
  146. package/dist/paths.js +26 -0
  147. package/dist/preparation.d.ts +20 -0
  148. package/dist/preparation.d.ts.map +1 -0
  149. package/dist/preparation.js +227 -0
  150. package/dist/presence.d.ts +52 -0
  151. package/dist/presence.d.ts.map +1 -0
  152. package/dist/presence.js +220 -0
  153. package/dist/queries.d.ts +16 -0
  154. package/dist/queries.d.ts.map +1 -0
  155. package/dist/queries.js +282 -0
  156. package/dist/query.d.ts +14 -210
  157. package/dist/query.d.ts.map +1 -1
  158. package/dist/query.js +3 -505
  159. package/dist/questions.d.ts +29 -0
  160. package/dist/questions.d.ts.map +1 -0
  161. package/dist/questions.js +115 -0
  162. package/dist/queue.d.ts +40 -0
  163. package/dist/queue.d.ts.map +1 -0
  164. package/dist/queue.js +450 -0
  165. package/dist/reach.d.ts +15 -12
  166. package/dist/reach.d.ts.map +1 -1
  167. package/dist/reach.js +240 -149
  168. package/dist/react.d.ts +15 -2
  169. package/dist/react.d.ts.map +1 -1
  170. package/dist/react.js +33 -1
  171. package/dist/read.d.ts +7 -0
  172. package/dist/read.d.ts.map +1 -0
  173. package/dist/read.js +17 -0
  174. package/dist/readiness.d.ts +4 -19
  175. package/dist/readiness.d.ts.map +1 -1
  176. package/dist/readiness.js +4 -10
  177. package/dist/reads.d.ts +38 -10
  178. package/dist/reads.d.ts.map +1 -1
  179. package/dist/reads.js +163 -85
  180. package/dist/recovery.d.ts +3 -0
  181. package/dist/recovery.d.ts.map +1 -1
  182. package/dist/recovery.js +57 -1
  183. package/dist/refresh.d.ts +7 -5
  184. package/dist/refresh.d.ts.map +1 -1
  185. package/dist/refresh.js +35 -7
  186. package/dist/refusal.d.ts +5 -0
  187. package/dist/refusal.d.ts.map +1 -0
  188. package/dist/refusal.js +55 -0
  189. package/dist/replica.d.ts +12 -18
  190. package/dist/replica.d.ts.map +1 -1
  191. package/dist/replica.js +64 -34
  192. package/dist/retried.d.ts +30 -0
  193. package/dist/retried.d.ts.map +1 -0
  194. package/dist/retried.js +72 -0
  195. package/dist/room-draft.d.ts +24 -10
  196. package/dist/room-draft.d.ts.map +1 -1
  197. package/dist/room-draft.js +142 -106
  198. package/dist/room-drafts.d.ts +24 -0
  199. package/dist/room-drafts.d.ts.map +1 -0
  200. package/dist/room-drafts.js +217 -0
  201. package/dist/rows.d.ts +14 -21
  202. package/dist/rows.d.ts.map +1 -1
  203. package/dist/rows.js +49 -186
  204. package/dist/runtime.d.ts +34 -0
  205. package/dist/runtime.d.ts.map +1 -0
  206. package/dist/runtime.js +1 -0
  207. package/dist/save.d.ts +42 -84
  208. package/dist/save.d.ts.map +1 -1
  209. package/dist/save.js +349 -170
  210. package/dist/saves.d.ts +32 -0
  211. package/dist/saves.d.ts.map +1 -0
  212. package/dist/saves.js +410 -0
  213. package/dist/search.d.ts +12 -63
  214. package/dist/search.d.ts.map +1 -1
  215. package/dist/search.js +9 -52
  216. package/dist/seed.d.ts +11 -2
  217. package/dist/seed.d.ts.map +1 -1
  218. package/dist/seed.js +71 -1
  219. package/dist/shared.d.ts +1 -7
  220. package/dist/shared.d.ts.map +1 -1
  221. package/dist/shared.js +13 -105
  222. package/dist/shown.d.ts +33 -0
  223. package/dist/shown.d.ts.map +1 -0
  224. package/dist/shown.js +302 -0
  225. package/dist/socket/admission.d.ts +7 -0
  226. package/dist/socket/admission.d.ts.map +1 -0
  227. package/dist/socket/admission.js +39 -0
  228. package/dist/socket/answers.d.ts +6 -0
  229. package/dist/socket/answers.d.ts.map +1 -0
  230. package/dist/socket/answers.js +20 -0
  231. package/dist/socket/lanes.d.ts +28 -0
  232. package/dist/socket/lanes.d.ts.map +1 -0
  233. package/dist/socket/lanes.js +103 -0
  234. package/dist/socket/reads.d.ts +10 -0
  235. package/dist/socket/reads.d.ts.map +1 -0
  236. package/dist/socket/reads.js +31 -0
  237. package/dist/socket/session.d.ts +38 -0
  238. package/dist/socket/session.d.ts.map +1 -0
  239. package/dist/socket/session.js +23 -0
  240. package/dist/socket.d.ts +67 -0
  241. package/dist/socket.d.ts.map +1 -0
  242. package/dist/socket.js +164 -0
  243. package/dist/source.d.ts +54 -0
  244. package/dist/source.d.ts.map +1 -0
  245. package/dist/source.js +82 -0
  246. package/dist/status.d.ts +4 -5
  247. package/dist/status.d.ts.map +1 -1
  248. package/dist/status.js +3 -7
  249. package/dist/store/installs.d.ts +30 -0
  250. package/dist/store/installs.d.ts.map +1 -0
  251. package/dist/store/installs.js +34 -0
  252. package/dist/store/readiness.d.ts +10 -0
  253. package/dist/store/readiness.d.ts.map +1 -0
  254. package/dist/store/readiness.js +52 -0
  255. package/dist/store/records.d.ts +214 -0
  256. package/dist/store/records.d.ts.map +1 -0
  257. package/dist/store/records.js +438 -0
  258. package/dist/store/room-held.d.ts +8 -0
  259. package/dist/store/room-held.d.ts.map +1 -0
  260. package/dist/store/room-held.js +17 -0
  261. package/dist/store/space.d.ts +11 -0
  262. package/dist/store/space.d.ts.map +1 -0
  263. package/dist/store/space.js +41 -0
  264. package/dist/store/watchers.d.ts +17 -0
  265. package/dist/store/watchers.d.ts.map +1 -0
  266. package/dist/store/watchers.js +56 -0
  267. package/dist/store/writes.d.ts +24 -0
  268. package/dist/store/writes.d.ts.map +1 -0
  269. package/dist/store/writes.js +125 -0
  270. package/dist/store.d.ts +120 -171
  271. package/dist/store.d.ts.map +1 -1
  272. package/dist/store.js +166 -414
  273. package/dist/stored.d.ts +62 -57
  274. package/dist/stored.d.ts.map +1 -1
  275. package/dist/stored.js +317 -239
  276. package/dist/surface.d.ts +88 -0
  277. package/dist/surface.d.ts.map +1 -0
  278. package/dist/surface.js +220 -0
  279. package/dist/sync.d.ts +19 -0
  280. package/dist/sync.d.ts.map +1 -0
  281. package/dist/sync.js +535 -0
  282. package/dist/tables.d.ts +126 -65
  283. package/dist/tables.d.ts.map +1 -1
  284. package/dist/tables.js +250 -113
  285. package/dist/tallies.d.ts +18 -0
  286. package/dist/tallies.d.ts.map +1 -0
  287. package/dist/tallies.js +128 -0
  288. package/dist/transfer.d.ts +0 -5
  289. package/dist/transfer.d.ts.map +1 -1
  290. package/dist/validation.d.ts +3 -4
  291. package/dist/validation.d.ts.map +1 -1
  292. package/dist/validation.js +42 -100
  293. package/dist/windows.d.ts +1 -12
  294. package/dist/windows.d.ts.map +1 -1
  295. package/dist/windows.js +2 -75
  296. package/dist/wire.d.ts +65 -9
  297. package/dist/wire.d.ts.map +1 -1
  298. package/dist/wire.js +22 -5
  299. package/package.json +3 -2
  300. package/dist/attempt.d.ts +0 -16
  301. package/dist/attempt.d.ts.map +0 -1
  302. package/dist/attempt.js +0 -70
  303. package/dist/fence.d.ts +0 -6
  304. package/dist/fence.d.ts.map +0 -1
  305. package/dist/fence.js +0 -10
  306. package/dist/fulltext.d.ts +0 -27
  307. package/dist/fulltext.d.ts.map +0 -1
  308. package/dist/fulltext.js +0 -368
  309. package/dist/log.d.ts +0 -5
  310. package/dist/log.d.ts.map +0 -1
  311. package/dist/log.js +0 -14
  312. package/dist/words.d.ts +0 -19
  313. package/dist/words.d.ts.map +0 -1
  314. package/dist/words.js +0 -150
@@ -0,0 +1,282 @@
1
+ import { identityOf } from '@agentshouse/mdmodel';
2
+ import { ROOM_TOTALS } from './figures.js';
3
+ import { roomInFlight } from './install.js';
4
+ import { compositionFor, roomFacts } from './listing.js';
5
+ import { lockedRooms } from './locks.js';
6
+ import { OFFLINE, UNCERTAIN, failure } from './outcome.js';
7
+ import { connectionNow, prepare, roomsOfReach } from './preparation.js';
8
+ import { planWithin, } from './query.js';
9
+ import { planReach } from './reach.js';
10
+ import { refuse } from './refusal.js';
11
+ import { documentKey } from './rows.js';
12
+ import { searchPlanOf } from './search.js';
13
+ import { seedApplies, seededResult, watchSeeded } from './seed.js';
14
+ import { capped, MAXIMUM_WINDOW } from './windows.js';
15
+ const QUERY_BYTES = 1 << 20;
16
+ function everyRoom({ presence }, held) {
17
+ return [
18
+ ...new Set([
19
+ ...presence.rooms().map(({ locator }) => locator),
20
+ ...held.rooms.keys(),
21
+ ...held.queues.keys(),
22
+ ]),
23
+ ];
24
+ }
25
+ function reachedRooms(runtime, plan, held) {
26
+ const reached = plan.reach === null ? null : roomsOfReach(plan.reach);
27
+ const named = plan.rooms ?? (reached === null ? everyRoom(runtime, held) : [...reached]);
28
+ return [...new Set(named)]
29
+ .filter((locator) => (reached === null || reached.has(locator)) && !plan.locked.includes(locator))
30
+ .sort();
31
+ }
32
+ function awaited({ socket, presence }, locator) {
33
+ return (!socket.session.now().roomsListed || presence.room(locator)?.replica.admission === 'admitted');
34
+ }
35
+ function coveredRooms(runtime, locators, whole, held) {
36
+ const { store, socket } = runtime;
37
+ if (locators.length === 0 && whole && !socket.session.now().roomsListed)
38
+ return { pending: [] };
39
+ const pending = [];
40
+ const coverage = [];
41
+ const overlay = [];
42
+ const read = [];
43
+ for (const locator of locators) {
44
+ const replica = held.rooms.get(locator);
45
+ if (replica === undefined) {
46
+ if (awaited(runtime, locator))
47
+ pending.push({ room: locator, awaits: 'acquisition' });
48
+ continue;
49
+ }
50
+ if (!replica.indexed) {
51
+ pending.push({ room: locator, awaits: 'preparation' });
52
+ continue;
53
+ }
54
+ coverage.push({
55
+ room: locator,
56
+ generation: replica.transfer,
57
+ current: !roomInFlight(store, locator),
58
+ });
59
+ read.push({ locator, key: replica.key });
60
+ for (const id of held.queues.get(locator) ?? [])
61
+ overlay.push(id);
62
+ }
63
+ if (pending.length > 0)
64
+ return { pending };
65
+ return { coverage: { rooms: coverage, overlay }, rooms: read };
66
+ }
67
+ function covered(runtime, plan, held) {
68
+ return coveredRooms(runtime, reachedRooms(runtime, plan, held), plan.rooms === null && plan.reach === null, held);
69
+ }
70
+ function awaitPreparation(runtime, cover) {
71
+ if (!('pending' in cover))
72
+ return;
73
+ const waiting = cover.pending.filter(({ awaits }) => awaits === 'preparation');
74
+ if (waiting.length > 0) {
75
+ prepare(runtime, waiting.map(({ room }) => room));
76
+ }
77
+ }
78
+ export async function figuresCover(runtime) {
79
+ const held = await runtime.store.covering();
80
+ const locked = await lockedRooms(runtime);
81
+ const cover = coveredRooms(runtime, everyRoom(runtime, held)
82
+ .filter((locator) => !locked.includes(locator))
83
+ .sort(), true, held);
84
+ awaitPreparation(runtime, cover);
85
+ return 'pending' in cover ? cover : { rooms: cover.rooms };
86
+ }
87
+ function sameCover(left, right) {
88
+ return JSON.stringify(left) === JSON.stringify(right);
89
+ }
90
+ async function windowRows(local, plan, rooms, unchanged) {
91
+ const first = await local.query(plan, rooms, QUERY_BYTES);
92
+ if (first.more === undefined || !('documents' in first)) {
93
+ const { more: _more, ...rows } = first;
94
+ return rows;
95
+ }
96
+ const documents = [...first.documents];
97
+ for (let more = first.more; more !== undefined;) {
98
+ if (!unchanged())
99
+ return null;
100
+ const page = await local.query({
101
+ ...plan,
102
+ after: { text: more, values: JSON.parse(more) },
103
+ limit: plan.limit === null ? null : plan.limit - documents.length,
104
+ total: false,
105
+ }, rooms, QUERY_BYTES);
106
+ if (!('documents' in page))
107
+ return null;
108
+ documents.push(...page.documents);
109
+ more = page.more;
110
+ if (more === undefined) {
111
+ return {
112
+ documents,
113
+ ...(page.next === undefined ? {} : { next: page.next }),
114
+ ...(first.total === undefined ? {} : { total: first.total }),
115
+ };
116
+ }
117
+ }
118
+ return null;
119
+ }
120
+ function freeTextAsked(plan) {
121
+ return plan.shape.kind === 'documents' && (plan.shape.sections !== null || plan.shape.preamble);
122
+ }
123
+ async function composedRooms(runtime, plan, rooms) {
124
+ if (!freeTextAsked(plan))
125
+ return rooms;
126
+ const held = await runtime.store.rooms(rooms.map(({ locator }) => locator));
127
+ return rooms.map((room) => {
128
+ const stored = held.get(room.locator);
129
+ return stored === undefined
130
+ ? room
131
+ : { ...room, composition: compositionFor(runtime, stored.record) };
132
+ });
133
+ }
134
+ async function coveredRows(runtime, plan, cover) {
135
+ const { store } = runtime;
136
+ for (;;) {
137
+ const before = await cover();
138
+ if ('pending' in before)
139
+ return { pending: before };
140
+ const local = await store.open();
141
+ const keys = before.rooms.map(({ key }) => key);
142
+ const changes = local.changes(keys);
143
+ const current = () => local.changes(keys) === changes;
144
+ const rows = await windowRows(local, plan, await composedRooms(runtime, plan, before.rooms), current);
145
+ const after = await cover();
146
+ if (rows !== null && sameCover(before, after))
147
+ return { rows, cover: before, current };
148
+ }
149
+ }
150
+ function keyedOf(rows, coverage) {
151
+ if ('groups' in rows) {
152
+ return {
153
+ result: { ...rows, coverage },
154
+ keys: rows.groups.map((group) => JSON.stringify(group.key)),
155
+ };
156
+ }
157
+ return {
158
+ result: { ...rows, coverage },
159
+ keys: rows.documents.map((document) => documentKey(document.room, document.path)),
160
+ };
161
+ }
162
+ export async function answeredPlan(runtime, plan, cover) {
163
+ const answered = await coveredRows(runtime, plan, cover);
164
+ if ('pending' in answered) {
165
+ const pending = answered.pending;
166
+ return { result: pending, keys: [], current: () => true };
167
+ }
168
+ const held = answered.cover;
169
+ return { ...keyedOf(answered.rows, held.coverage), current: answered.current };
170
+ }
171
+ async function coverNow(runtime, plan) {
172
+ const cover = covered(runtime, plan, await runtime.store.covering());
173
+ awaitPreparation(runtime, cover);
174
+ return cover;
175
+ }
176
+ export async function rowsQuery(runtime, plan) {
177
+ const held = await runtime.store.covering();
178
+ const before = covered(runtime, plan, held);
179
+ awaitPreparation(runtime, before);
180
+ const seeded = seedApplies(runtime, plan, held);
181
+ if (seeded !== null)
182
+ return seededResult(seeded).result;
183
+ if ('pending' in before)
184
+ return before;
185
+ const answered = await coveredRows(runtime, plan, () => coverNow(runtime, plan));
186
+ if ('pending' in answered)
187
+ return answered.pending;
188
+ const shownCover = answered.cover;
189
+ return { ...answered.rows, coverage: shownCover.coverage };
190
+ }
191
+ export async function planned(runtime, input, reach) {
192
+ const plan = planWithin(input, await roomFacts(runtime, reach), planReach(reach));
193
+ const named = plan.paths !== null &&
194
+ plan.rooms !== null &&
195
+ plan.paths.length * plan.rooms.length <= MAXIMUM_WINDOW;
196
+ return plan.limit === null && named ? plan : { ...plan, limit: capped(plan.limit) };
197
+ }
198
+ export async function roomTallies(runtime, rooms, since) {
199
+ return runtime.store.ask({
200
+ kind: 'replica.tallies',
201
+ totals: { ...(await planned(runtime, ROOM_TOTALS, null)), limit: null },
202
+ rooms,
203
+ since,
204
+ });
205
+ }
206
+ export function watchPlan(runtime, plan, deliver, fail) {
207
+ return watchSeeded(runtime, plan, deliver, (behind, answered) => runtime.liveQueries.watch(plan, identityOf(plan), (held) => {
208
+ const cover = covered(runtime, plan, held);
209
+ awaitPreparation(runtime, cover);
210
+ return behind(cover, held);
211
+ }, answered, fail));
212
+ }
213
+ export function watchPlanned(runtime, planning, deliver, fail) {
214
+ let stop = null;
215
+ let stopped = false;
216
+ planning.then((plan) => {
217
+ if (!stopped)
218
+ stop = watchPlan(runtime, plan, deliver, fail);
219
+ }, (error) => {
220
+ if (!stopped)
221
+ fail(error);
222
+ });
223
+ return () => {
224
+ stopped = true;
225
+ stop?.();
226
+ };
227
+ }
228
+ export async function searched(runtime, input, reach) {
229
+ const { store, socket } = runtime;
230
+ const { session } = socket;
231
+ const asked = searchPlanOf(input);
232
+ await socket.ready;
233
+ const search = socket.search();
234
+ if (search === undefined) {
235
+ return {
236
+ kind: 'undeclared',
237
+ code: 'action-undeclared',
238
+ fields: { name: 'search' },
239
+ retryable: false,
240
+ };
241
+ }
242
+ if (socket.closed() ||
243
+ session.now().refusal !== null ||
244
+ (await connectionNow(runtime)) !== 'connected')
245
+ return OFFLINE;
246
+ const reached = reach === null ? null : new Set(reach.rooms);
247
+ const named = asked.rooms === null
248
+ ? reached === null
249
+ ? null
250
+ : [...reached]
251
+ : asked.rooms.filter((room) => reached === null || reached.has(room));
252
+ const held = named === null ? null : await store.rooms(named);
253
+ const rooms = named === null ? null : named.filter((room) => held.has(room)).sort();
254
+ if (rooms !== null && rooms.length === 0)
255
+ return { kind: 'found', documents: [] };
256
+ try {
257
+ await socket.authorize();
258
+ }
259
+ catch {
260
+ return UNCERTAIN;
261
+ }
262
+ const { closed, authorization, refusal } = session.now();
263
+ if (closed || authorization === undefined || refusal !== null)
264
+ return UNCERTAIN;
265
+ try {
266
+ const result = await search(authorization, { text: asked.text, rooms });
267
+ if (result.kind === 'revoked-authorization')
268
+ await refuse(runtime, 'revoked-authorization');
269
+ if (result.kind === 'rejected')
270
+ return result;
271
+ if (result.kind !== 'found')
272
+ return failure(result);
273
+ const kept = rooms === null ? null : new Set(rooms);
274
+ return {
275
+ kind: 'found',
276
+ documents: result.documents.filter((hit) => kept === null || kept.has(hit.room)),
277
+ };
278
+ }
279
+ catch {
280
+ return UNCERTAIN;
281
+ }
282
+ }
package/dist/query.d.ts CHANGED
@@ -1,93 +1,7 @@
1
- import { type Definition } from '@agentshouse/mdmodel';
1
+ import { type HeldRooms, type QueryPlan } from '@agentshouse/mdmodel';
2
2
  import type { HeadChange } from './adapter.js';
3
3
  import type { BinaryFileRecord } from './binary.js';
4
4
  import type { Open } from './open.js';
5
- export type Value = string | number | boolean | null;
6
- export type Predicate = Value | {
7
- $eq: Value;
8
- } | {
9
- $ne: Value;
10
- } | {
11
- $in: readonly Value[];
12
- } | {
13
- $nin: readonly Value[];
14
- } | {
15
- $gt?: Value;
16
- $gte?: Value;
17
- $lt?: Value;
18
- $lte?: Value;
19
- } | {
20
- $all: readonly Value[];
21
- } | {
22
- $size: number;
23
- } | {
24
- $exists: boolean;
25
- };
26
- export type Where = {
27
- $and?: readonly Where[];
28
- $or?: readonly Where[];
29
- [field: string]: Predicate | readonly Where[] | undefined;
30
- };
31
- export type Related = {
32
- types?: readonly string[];
33
- where?: Where;
34
- pathPrefix?: string;
35
- };
36
- export type Filter = {
37
- rooms?: readonly string[];
38
- types?: readonly string[];
39
- where?: Where;
40
- pathPrefix?: string;
41
- folder?: string;
42
- paths?: readonly string[];
43
- hop?: Related & {
44
- field: string;
45
- };
46
- backlinks?: Related & {
47
- field?: string;
48
- };
49
- };
50
- export type Key = 'room' | 'path' | 'type' | 'folder' | {
51
- field: string;
52
- };
53
- export type Select = 'all' | {
54
- fields?: 'all' | readonly string[];
55
- sections?: 'all' | readonly string[];
56
- preamble?: true;
57
- markdown?: true;
58
- backlinks?: true;
59
- change?: true;
60
- fileId?: true;
61
- revision?: true;
62
- };
63
- export type OrderOptions = {
64
- nulls?: 'first' | 'last';
65
- stringSort?: 'lexical' | 'locale';
66
- locale?: string;
67
- localeOptions?: Readonly<Record<string, unknown>>;
68
- };
69
- export type Direction = 'asc' | 'desc';
70
- export type DocumentQuery = Filter & {
71
- select: Select;
72
- orderBy?: readonly ({
73
- by: Key;
74
- direction?: Direction;
75
- } & OrderOptions)[];
76
- limit?: number;
77
- after?: string;
78
- total?: true;
79
- };
80
- export type GroupQuery = Filter & {
81
- groupBy: readonly Exclude<Key, 'path'>[];
82
- orderBy?: readonly {
83
- by: 'count' | Exclude<Key, 'path'>;
84
- direction?: Direction;
85
- }[];
86
- limit?: number;
87
- after?: string;
88
- total?: true;
89
- };
90
- export type LocalQuery = DocumentQuery | GroupQuery;
91
5
  export type Backlink = {
92
6
  path: string;
93
7
  type: string;
@@ -106,10 +20,20 @@ export type QueryDocument = {
106
20
  fileId?: string | null;
107
21
  revision?: string | null;
108
22
  binaryFile?: BinaryFileRecord;
23
+ size?: number | null;
24
+ created?: string | null;
25
+ };
26
+ export type GroupTotal = {
27
+ count: number;
28
+ size: number;
109
29
  };
110
30
  export type QueryGroup = {
111
31
  key: readonly unknown[];
112
32
  count: number;
33
+ documents?: GroupTotal;
34
+ files?: GroupTotal;
35
+ updated?: string | null;
36
+ greatest?: unknown;
113
37
  };
114
38
  export type CoveredRoom = {
115
39
  room: string;
@@ -118,7 +42,6 @@ export type CoveredRoom = {
118
42
  };
119
43
  export type QueryCoverage = {
120
44
  rooms: readonly CoveredRoom[];
121
- indexes: readonly string[];
122
45
  overlay: readonly string[];
123
46
  };
124
47
  export type Awaits = Open<'acquisition' | 'preparation' | 'unlock'>;
@@ -147,138 +70,19 @@ export type GroupResult = GroupRows & {
147
70
  coverage: QueryCoverage;
148
71
  };
149
72
  export type QueryResult = DocumentResult | GroupResult | PendingResult;
150
- export type QueryErrorCode = 'invalid-query' | 'unknown-type' | 'unknown-field' | 'wrong-kind';
151
- export type RoomFacts = {
152
- locator: string;
153
- available: boolean;
154
- types: readonly Definition[];
155
- };
156
- export type HeldRooms = {
157
- listed: boolean;
158
- rooms: readonly RoomFacts[];
159
- };
160
- export type Test = {
161
- op: 'eq';
162
- value: Value;
163
- } | {
164
- op: 'ne';
165
- value: Value;
166
- } | {
167
- op: 'in';
168
- values: readonly Value[];
169
- } | {
170
- op: 'nin';
171
- values: readonly Value[];
172
- } | {
173
- op: 'range';
174
- bounds: readonly (readonly ['gt' | 'gte' | 'lt' | 'lte', Value])[];
175
- } | {
176
- op: 'all';
177
- values: readonly Value[];
178
- } | {
179
- op: 'size';
180
- size: number;
181
- } | {
182
- op: 'exists';
183
- exists: boolean;
184
- };
185
- export type Condition = {
186
- every: readonly Condition[];
187
- } | {
188
- some: readonly Condition[];
189
- } | {
190
- field: string;
191
- test: Test;
192
- };
193
- export type Scope = {
194
- types: readonly string[] | null;
195
- where: Condition | null;
196
- pathPrefix: string | null;
197
- };
198
- export type KeyPlan = {
199
- of: 'room';
200
- } | {
201
- of: 'path';
202
- } | {
203
- of: 'type';
204
- } | {
205
- of: 'folder';
206
- } | {
207
- of: 'field';
208
- field: string;
209
- };
210
- export type DocumentShape = {
211
- kind: 'documents';
212
- fields: 'all' | readonly string[] | null;
213
- sections: 'all' | readonly string[] | null;
214
- preamble: boolean;
215
- markdown: boolean;
216
- backlinks: boolean;
217
- change: boolean;
218
- fileId: boolean;
219
- revision: boolean;
220
- orderBy: readonly {
221
- key: KeyPlan;
222
- options: OrderOptions & {
223
- direction: Direction;
224
- };
225
- }[];
226
- };
227
- export type GroupShape = {
228
- kind: 'groups';
229
- groupBy: readonly KeyPlan[];
230
- orderBy: readonly {
231
- by: 'count' | number;
232
- direction: Direction;
233
- }[];
234
- };
235
73
  export type PlanArea = {
236
74
  room: string;
237
75
  path: string;
238
- types: readonly string[];
76
+ open: readonly string[];
239
77
  };
240
78
  export type PlanReach = {
241
79
  rooms: readonly string[];
242
80
  documents: readonly string[];
243
81
  areas: readonly PlanArea[];
244
82
  };
245
- export type Continuation = {
246
- text: string;
247
- values: readonly unknown[] | null;
248
- };
249
- export type Plan = {
250
- key: string;
251
- rooms: readonly string[] | null;
83
+ export type Plan = QueryPlan & {
252
84
  reach: PlanReach | null;
253
85
  locked: readonly string[];
254
- root: Scope;
255
- folder: string | null;
256
- paths: readonly string[] | null;
257
- hop: (Scope & {
258
- field: string;
259
- }) | null;
260
- backlinks: (Scope & {
261
- field: string | null;
262
- }) | null;
263
- shape: DocumentShape | GroupShape;
264
- limit: number | null;
265
- after: Continuation | null;
266
- total: boolean;
267
86
  };
268
- export declare class QueryError extends Error {
269
- readonly code: QueryErrorCode;
270
- readonly retryable = false;
271
- constructor(code: QueryErrorCode, at: string, problem: string);
272
- }
273
- type Entries = Readonly<Record<string, unknown>>;
274
- export declare function invalid(at: string, problem: string): never;
275
- export declare function plain(value: unknown): value is Entries;
276
- export declare function known(value: Entries, allowed: readonly string[], at: string): void;
277
- export declare function flag(input: unknown, at: string): boolean;
278
- export declare function planOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
279
- export declare function limitOf(input: unknown): number | null;
280
- export declare function filterOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
281
- export declare function queryKey(query: unknown): string;
282
- export declare function identityOf(plan: Plan): string;
283
- export {};
87
+ export declare function planWithin(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
284
88
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EAGhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAA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