@agentshouse/mdruntime 0.1.0-c5fe3b2cddda7 → 0.1.0-c6197367d5fad

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 (332) hide show
  1. package/README.md +21 -19
  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 +156 -89
  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 +20 -60
  16. package/dist/authored.d.ts +88 -0
  17. package/dist/authored.d.ts.map +1 -0
  18. package/dist/authored.js +345 -0
  19. package/dist/bootstrap.d.ts +9 -5
  20. package/dist/bootstrap.d.ts.map +1 -1
  21. package/dist/bootstrap.js +204 -85
  22. package/dist/cell.d.ts +6 -0
  23. package/dist/cell.d.ts.map +1 -0
  24. package/dist/cell.js +9 -0
  25. package/dist/chain.d.ts +2 -1
  26. package/dist/chain.d.ts.map +1 -1
  27. package/dist/change-set.d.ts +4 -0
  28. package/dist/change-set.d.ts.map +1 -1
  29. package/dist/change-set.js +6 -0
  30. package/dist/change.d.ts +5 -0
  31. package/dist/change.d.ts.map +1 -1
  32. package/dist/change.js +7 -2
  33. package/dist/chat-types.d.ts +3 -0
  34. package/dist/chat-types.d.ts.map +1 -0
  35. package/dist/chat-types.js +11 -0
  36. package/dist/client.d.ts +33 -23
  37. package/dist/client.d.ts.map +1 -1
  38. package/dist/client.js +43 -56
  39. package/dist/collection.d.ts +26 -4
  40. package/dist/collection.d.ts.map +1 -1
  41. package/dist/collection.js +19 -2
  42. package/dist/column.d.ts +5 -0
  43. package/dist/column.d.ts.map +1 -0
  44. package/dist/column.js +9 -0
  45. package/dist/compile.d.ts +8 -6
  46. package/dist/compile.d.ts.map +1 -1
  47. package/dist/compile.js +286 -336
  48. package/dist/connection.d.ts +5 -142
  49. package/dist/connection.d.ts.map +1 -1
  50. package/dist/connection.js +111 -4993
  51. package/dist/context.d.ts +2 -0
  52. package/dist/context.d.ts.map +1 -0
  53. package/dist/context.js +7 -0
  54. package/dist/conversation-live.d.ts +150 -0
  55. package/dist/conversation-live.d.ts.map +1 -0
  56. package/dist/conversation-live.js +259 -0
  57. package/dist/conversation-row.d.ts +40 -0
  58. package/dist/conversation-row.d.ts.map +1 -0
  59. package/dist/conversation-row.js +66 -0
  60. package/dist/conversation.d.ts +72 -51
  61. package/dist/conversation.d.ts.map +1 -1
  62. package/dist/conversation.js +1001 -926
  63. package/dist/declaration.d.ts +10 -0
  64. package/dist/declaration.d.ts.map +1 -0
  65. package/dist/declaration.js +24 -0
  66. package/dist/discovery.d.ts +11 -0
  67. package/dist/discovery.d.ts.map +1 -0
  68. package/dist/discovery.js +157 -0
  69. package/dist/download.d.ts +6 -0
  70. package/dist/download.d.ts.map +1 -0
  71. package/dist/download.js +42 -0
  72. package/dist/durability.d.ts +20 -0
  73. package/dist/durability.d.ts.map +1 -1
  74. package/dist/durability.js +7 -0
  75. package/dist/entry.d.ts +2 -2
  76. package/dist/entry.d.ts.map +1 -1
  77. package/dist/entry.js +18 -8
  78. package/dist/expectation.d.ts +26 -13
  79. package/dist/expectation.d.ts.map +1 -1
  80. package/dist/expectation.js +72 -19
  81. package/dist/failure.d.ts +3 -0
  82. package/dist/failure.d.ts.map +1 -1
  83. package/dist/failure.js +6 -0
  84. package/dist/figures.d.ts +49 -0
  85. package/dist/figures.d.ts.map +1 -0
  86. package/dist/figures.js +199 -0
  87. package/dist/file.d.ts +1 -1
  88. package/dist/file.d.ts.map +1 -1
  89. package/dist/file.js +3 -2
  90. package/dist/holdings.d.ts +29 -0
  91. package/dist/holdings.d.ts.map +1 -0
  92. package/dist/holdings.js +95 -0
  93. package/dist/host.d.ts +21 -7
  94. package/dist/host.d.ts.map +1 -1
  95. package/dist/host.js +83 -41
  96. package/dist/identity.d.ts +0 -1
  97. package/dist/identity.d.ts.map +1 -1
  98. package/dist/identity.js +0 -3
  99. package/dist/index.d.ts +37 -14
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +17 -5
  102. package/dist/install.d.ts +60 -0
  103. package/dist/install.d.ts.map +1 -0
  104. package/dist/install.js +537 -0
  105. package/dist/lifecycle.d.ts +7 -0
  106. package/dist/lifecycle.d.ts.map +1 -0
  107. package/dist/lifecycle.js +282 -0
  108. package/dist/listing.d.ts +52 -0
  109. package/dist/listing.d.ts.map +1 -0
  110. package/dist/listing.js +152 -0
  111. package/dist/live.d.ts +9 -6
  112. package/dist/live.d.ts.map +1 -1
  113. package/dist/live.js +118 -36
  114. package/dist/loaded.d.ts +5 -0
  115. package/dist/loaded.d.ts.map +1 -0
  116. package/dist/loaded.js +40 -0
  117. package/dist/locks.d.ts +7 -0
  118. package/dist/locks.d.ts.map +1 -0
  119. package/dist/locks.js +32 -0
  120. package/dist/lost.d.ts +5 -0
  121. package/dist/lost.d.ts.map +1 -0
  122. package/dist/lost.js +49 -0
  123. package/dist/media.d.ts +19 -2
  124. package/dist/media.d.ts.map +1 -1
  125. package/dist/media.js +105 -27
  126. package/dist/memory.d.ts +18 -6
  127. package/dist/memory.d.ts.map +1 -1
  128. package/dist/memory.js +214 -91
  129. package/dist/messages.d.ts +35 -5
  130. package/dist/messages.d.ts.map +1 -1
  131. package/dist/messages.js +109 -39
  132. package/dist/model.d.ts +2 -10
  133. package/dist/model.d.ts.map +1 -1
  134. package/dist/model.js +0 -14
  135. package/dist/models.d.ts +10 -0
  136. package/dist/models.d.ts.map +1 -0
  137. package/dist/models.js +153 -0
  138. package/dist/observation.d.ts +28 -13
  139. package/dist/observation.d.ts.map +1 -1
  140. package/dist/observation.js +185 -81
  141. package/dist/opened.d.ts +1 -1
  142. package/dist/opened.d.ts.map +1 -1
  143. package/dist/opened.js +5 -5
  144. package/dist/opening.d.ts +4 -0
  145. package/dist/opening.d.ts.map +1 -0
  146. package/dist/opening.js +53 -0
  147. package/dist/outcome.d.ts +17 -2
  148. package/dist/outcome.d.ts.map +1 -1
  149. package/dist/outcome.js +35 -2
  150. package/dist/overlay.d.ts +7 -2
  151. package/dist/overlay.d.ts.map +1 -1
  152. package/dist/overlay.js +48 -24
  153. package/dist/page-metadata.d.ts +8 -0
  154. package/dist/page-metadata.d.ts.map +1 -0
  155. package/dist/page-metadata.js +19 -0
  156. package/dist/parts.d.ts +4 -0
  157. package/dist/parts.d.ts.map +1 -0
  158. package/dist/parts.js +13 -0
  159. package/dist/paths.d.ts +1 -0
  160. package/dist/paths.d.ts.map +1 -1
  161. package/dist/paths.js +22 -0
  162. package/dist/preparation.d.ts +41 -0
  163. package/dist/preparation.d.ts.map +1 -0
  164. package/dist/preparation.js +314 -0
  165. package/dist/presence.d.ts +58 -0
  166. package/dist/presence.d.ts.map +1 -0
  167. package/dist/presence.js +231 -0
  168. package/dist/queries.d.ts +16 -0
  169. package/dist/queries.d.ts.map +1 -0
  170. package/dist/queries.js +308 -0
  171. package/dist/query.d.ts +14 -210
  172. package/dist/query.d.ts.map +1 -1
  173. package/dist/query.js +3 -505
  174. package/dist/questions.d.ts +30 -0
  175. package/dist/questions.d.ts.map +1 -0
  176. package/dist/questions.js +116 -0
  177. package/dist/queue.d.ts +40 -0
  178. package/dist/queue.d.ts.map +1 -0
  179. package/dist/queue.js +480 -0
  180. package/dist/reach.d.ts +16 -15
  181. package/dist/reach.d.ts.map +1 -1
  182. package/dist/reach.js +257 -148
  183. package/dist/react.d.ts +19 -3
  184. package/dist/react.d.ts.map +1 -1
  185. package/dist/react.js +33 -1
  186. package/dist/read.d.ts +7 -0
  187. package/dist/read.d.ts.map +1 -0
  188. package/dist/read.js +17 -0
  189. package/dist/readiness.d.ts +9 -6
  190. package/dist/readiness.d.ts.map +1 -1
  191. package/dist/readiness.js +3 -5
  192. package/dist/reads.d.ts +39 -0
  193. package/dist/reads.d.ts.map +1 -0
  194. package/dist/reads.js +178 -0
  195. package/dist/recovery.d.ts +3 -1
  196. package/dist/recovery.d.ts.map +1 -1
  197. package/dist/recovery.js +38 -8
  198. package/dist/refresh.d.ts +2 -1
  199. package/dist/refresh.d.ts.map +1 -1
  200. package/dist/refresh.js +31 -3
  201. package/dist/refusal.d.ts +5 -0
  202. package/dist/refusal.d.ts.map +1 -0
  203. package/dist/refusal.js +55 -0
  204. package/dist/replica.d.ts +11 -16
  205. package/dist/replica.d.ts.map +1 -1
  206. package/dist/replica.js +66 -32
  207. package/dist/retried.d.ts +30 -0
  208. package/dist/retried.d.ts.map +1 -0
  209. package/dist/retried.js +72 -0
  210. package/dist/room-draft.d.ts +34 -10
  211. package/dist/room-draft.d.ts.map +1 -1
  212. package/dist/room-draft.js +331 -111
  213. package/dist/room-drafts.d.ts +24 -0
  214. package/dist/room-drafts.d.ts.map +1 -0
  215. package/dist/room-drafts.js +220 -0
  216. package/dist/room-list.d.ts +10 -0
  217. package/dist/room-list.d.ts.map +1 -0
  218. package/dist/room-list.js +45 -0
  219. package/dist/rows.d.ts +16 -22
  220. package/dist/rows.d.ts.map +1 -1
  221. package/dist/rows.js +49 -186
  222. package/dist/runtime.d.ts +34 -0
  223. package/dist/runtime.d.ts.map +1 -0
  224. package/dist/runtime.js +1 -0
  225. package/dist/save.d.ts +42 -86
  226. package/dist/save.d.ts.map +1 -1
  227. package/dist/save.js +332 -228
  228. package/dist/saves.d.ts +34 -0
  229. package/dist/saves.d.ts.map +1 -0
  230. package/dist/saves.js +437 -0
  231. package/dist/search.d.ts +12 -63
  232. package/dist/search.d.ts.map +1 -1
  233. package/dist/search.js +9 -52
  234. package/dist/seed.d.ts +11 -2
  235. package/dist/seed.d.ts.map +1 -1
  236. package/dist/seed.js +71 -1
  237. package/dist/shared.d.ts +1 -6
  238. package/dist/shared.d.ts.map +1 -1
  239. package/dist/shared.js +13 -95
  240. package/dist/shown.d.ts +35 -0
  241. package/dist/shown.d.ts.map +1 -0
  242. package/dist/shown.js +313 -0
  243. package/dist/socket/admission.d.ts +7 -0
  244. package/dist/socket/admission.d.ts.map +1 -0
  245. package/dist/socket/admission.js +39 -0
  246. package/dist/socket/answers.d.ts +6 -0
  247. package/dist/socket/answers.d.ts.map +1 -0
  248. package/dist/socket/answers.js +20 -0
  249. package/dist/socket/lanes.d.ts +28 -0
  250. package/dist/socket/lanes.d.ts.map +1 -0
  251. package/dist/socket/lanes.js +103 -0
  252. package/dist/socket/reads.d.ts +10 -0
  253. package/dist/socket/reads.d.ts.map +1 -0
  254. package/dist/socket/reads.js +31 -0
  255. package/dist/socket/session.d.ts +38 -0
  256. package/dist/socket/session.d.ts.map +1 -0
  257. package/dist/socket/session.js +23 -0
  258. package/dist/socket.d.ts +67 -0
  259. package/dist/socket.d.ts.map +1 -0
  260. package/dist/socket.js +164 -0
  261. package/dist/source.d.ts +59 -0
  262. package/dist/source.d.ts.map +1 -0
  263. package/dist/source.js +93 -0
  264. package/dist/status.d.ts +0 -2
  265. package/dist/status.d.ts.map +1 -1
  266. package/dist/status.js +0 -6
  267. package/dist/store/installs.d.ts +30 -0
  268. package/dist/store/installs.d.ts.map +1 -0
  269. package/dist/store/installs.js +40 -0
  270. package/dist/store/readiness.d.ts +11 -0
  271. package/dist/store/readiness.d.ts.map +1 -0
  272. package/dist/store/readiness.js +68 -0
  273. package/dist/store/records.d.ts +224 -0
  274. package/dist/store/records.d.ts.map +1 -0
  275. package/dist/store/records.js +466 -0
  276. package/dist/store/room-held.d.ts +8 -0
  277. package/dist/store/room-held.d.ts.map +1 -0
  278. package/dist/store/room-held.js +17 -0
  279. package/dist/store/rooms-shown.d.ts +8 -0
  280. package/dist/store/rooms-shown.d.ts.map +1 -0
  281. package/dist/store/rooms-shown.js +13 -0
  282. package/dist/store/space.d.ts +11 -0
  283. package/dist/store/space.d.ts.map +1 -0
  284. package/dist/store/space.js +41 -0
  285. package/dist/store/watchers.d.ts +17 -0
  286. package/dist/store/watchers.d.ts.map +1 -0
  287. package/dist/store/watchers.js +56 -0
  288. package/dist/store/writes.d.ts +24 -0
  289. package/dist/store/writes.d.ts.map +1 -0
  290. package/dist/store/writes.js +125 -0
  291. package/dist/store.d.ts +115 -143
  292. package/dist/store.d.ts.map +1 -1
  293. package/dist/store.js +171 -364
  294. package/dist/stored.d.ts +72 -35
  295. package/dist/stored.d.ts.map +1 -1
  296. package/dist/stored.js +337 -197
  297. package/dist/surface.d.ts +92 -0
  298. package/dist/surface.d.ts.map +1 -0
  299. package/dist/surface.js +251 -0
  300. package/dist/sync.d.ts +19 -0
  301. package/dist/sync.d.ts.map +1 -0
  302. package/dist/sync.js +538 -0
  303. package/dist/tables.d.ts +118 -67
  304. package/dist/tables.d.ts.map +1 -1
  305. package/dist/tables.js +199 -278
  306. package/dist/tallies.d.ts +18 -0
  307. package/dist/tallies.d.ts.map +1 -0
  308. package/dist/tallies.js +128 -0
  309. package/dist/validation.d.ts.map +1 -1
  310. package/dist/validation.js +9 -12
  311. package/dist/windows.d.ts +1 -12
  312. package/dist/windows.d.ts.map +1 -1
  313. package/dist/windows.js +2 -75
  314. package/dist/wire.d.ts +72 -9
  315. package/dist/wire.d.ts.map +1 -1
  316. package/dist/wire.js +26 -5
  317. package/package.json +3 -2
  318. package/dist/attempt.d.ts +0 -16
  319. package/dist/attempt.d.ts.map +0 -1
  320. package/dist/attempt.js +0 -70
  321. package/dist/fence.d.ts +0 -6
  322. package/dist/fence.d.ts.map +0 -1
  323. package/dist/fence.js +0 -10
  324. package/dist/fulltext.d.ts +0 -27
  325. package/dist/fulltext.d.ts.map +0 -1
  326. package/dist/fulltext.js +0 -370
  327. package/dist/log.d.ts +0 -5
  328. package/dist/log.d.ts.map +0 -1
  329. package/dist/log.js +0 -14
  330. package/dist/words.d.ts +0 -19
  331. package/dist/words.d.ts.map +0 -1
  332. package/dist/words.js +0 -156
package/dist/bootstrap.js CHANGED
@@ -1,54 +1,34 @@
1
+ import { declared } from './declaration.js';
1
2
  import { transferIdentity } from './identity.js';
2
3
  import { advancement, pageEntries } from './refresh.js';
3
4
  import { entriesIn } from './shared.js';
5
+ import { compositionOf } from './replica.js';
4
6
  import { unconfirmed } from './transfer.js';
5
7
  const NOTHING_PRIOR = () => Promise.resolve(new Map());
8
+ const PARTS_IN_FLIGHT = 6;
6
9
  function textOf(page) {
7
10
  let text = 0;
8
11
  for (const [, content] of entriesIn(page.documents))
9
12
  text += content.length;
10
13
  return text;
11
14
  }
12
- async function pageOf(page) {
15
+ async function pageOf(page, part) {
13
16
  return {
14
17
  entries: await pageEntries(page, [], page.roomVersion, NOTHING_PRIOR),
15
18
  folders: page.folders ?? [],
19
+ ...(part === undefined ? {} : { part }),
16
20
  };
17
21
  }
18
- function heldTogether(first, second) {
19
- if (first === null)
20
- return second;
21
- return {
22
- async files(after, limit) {
23
- const [left, right] = await Promise.all([
24
- first.files(after, limit),
25
- second.files(after, limit),
26
- ]);
27
- const merged = new Map([...left, ...right].map((file) => [file.path, file]));
28
- return [...merged.values()]
29
- .sort((one, other) => (one.path < other.path ? -1 : one.path > other.path ? 1 : 0))
30
- .slice(0, limit);
31
- },
32
- async contents(paths) {
33
- const [left, right] = await Promise.all([first.contents(paths), second.contents(paths)]);
34
- return new Map([...left, ...right]);
35
- },
36
- };
37
- }
38
- const NO_CONTENT = {
39
- files: () => Promise.resolve([]),
40
- contents: () => Promise.resolve(new Map()),
41
- };
42
- export async function bootstrapRoom(adapter, authorization, room, held, builtIn, remodel, continuing, staging, reuse) {
22
+ export async function bootstrapRoom(adapter, authorization, room, held, builtIn, typedPaths, remodel, continuing, staging) {
43
23
  if (staging.held(room.locator) !== null)
44
24
  await staging.abandon(room.locator);
45
- const begun = (pool) => started(adapter, authorization, room, held, builtIn, remodel, continuing, staging, pool);
46
- const first = await begun(reuse);
25
+ const begun = () => started(adapter, authorization, room, held, builtIn, typedPaths, remodel, continuing, staging);
26
+ const first = await begun();
47
27
  if (first.kind !== 'expired')
48
28
  return first;
49
29
  await staging.setAside(room.locator);
50
30
  try {
51
- const replacement = await begun(heldTogether(reuse, first.held));
31
+ const replacement = await begun();
52
32
  if (replacement.kind !== 'expired')
53
33
  return replacement;
54
34
  await staging.abandon(room.locator);
@@ -65,29 +45,25 @@ function dropped(ahead) {
65
45
  dropped(next);
66
46
  }, () => { });
67
47
  }
68
- function compositionFor(room, models, builtIn) {
69
- return {
70
- model: models.collection,
71
- selection: room.typedSelection === undefined
72
- ? null
73
- : { roots: room.typedSelection.roots, model: builtIn },
74
- };
75
- }
76
- async function started(adapter, authorization, room, held, builtIn, remodel, continuing, staging, pool) {
48
+ async function started(adapter, authorization, room, held, builtIn, typedPaths, remodel, continuing, staging) {
49
+ const mode = { paged: false };
77
50
  let outcome;
78
51
  try {
79
- outcome = await bundle(adapter, authorization, room, held, builtIn, remodel, continuing, staging, pool);
52
+ outcome = await bundle(adapter, authorization, room, held, builtIn, typedPaths, remodel, continuing, staging, mode);
80
53
  }
81
54
  catch (error) {
82
- await staging.abandon(room.locator).catch(() => { });
55
+ await stopped(staging, room.locator, mode).catch(() => { });
83
56
  throw error;
84
57
  }
85
58
  if (outcome.kind !== 'staged' && outcome.kind !== 'expired') {
86
- await staging.abandon(room.locator);
59
+ await stopped(staging, room.locator, mode);
87
60
  }
88
61
  return outcome;
89
62
  }
90
- async function bundle(adapter, authorization, room, held, builtIn, remodel, continuing, staging, pool) {
63
+ function stopped(staging, locator, mode) {
64
+ return mode.paged ? staging.abandon(locator) : staging.setAside(locator);
65
+ }
66
+ async function bundle(adapter, authorization, room, held, builtIn, typedPaths, remodel, continuing, staging, mode) {
91
67
  const locator = room.locator;
92
68
  const selection = room.replica.selection;
93
69
  const ending = new AbortController();
@@ -100,7 +76,6 @@ async function bundle(adapter, authorization, room, held, builtIn, remodel, cont
100
76
  ...(token === null
101
77
  ? { arriving: (bytes) => arriving.at(bytes) }
102
78
  : { pageToken: token }),
103
- ...(pool === null ? {} : { held: pool }),
104
79
  });
105
80
  const fetching = (token) => {
106
81
  const fetched = (async () => {
@@ -110,7 +85,7 @@ async function bundle(adapter, authorization, room, held, builtIn, remodel, cont
110
85
  return { page, next: null, written: () => { } };
111
86
  const written = staging.queued(textOf(page));
112
87
  const later = page.pageToken;
113
- if (later === undefined) {
88
+ if (later === undefined && page.parts === undefined) {
114
89
  downloaded();
115
90
  arriving.end();
116
91
  }
@@ -131,12 +106,19 @@ async function bundle(adapter, authorization, room, held, builtIn, remodel, cont
131
106
  if (!continuing())
132
107
  return unconfirmed;
133
108
  const page = fetched.page;
134
- if (page.kind === 'beyond-horizon') {
135
- const key = transfer?.key ?? null;
136
- return { kind: 'expired', held: key === null ? NO_CONTENT : staging.content(key), key };
137
- }
109
+ if (page.kind === 'beyond-horizon')
110
+ return { kind: 'expired', key: transfer?.key ?? null };
138
111
  if (page.kind !== 'bootstrap')
139
112
  return page;
113
+ if (transfer === null && page.parts !== undefined) {
114
+ const parted = await parts(page, page.parts);
115
+ if (parted.kind !== 'parted')
116
+ return parted;
117
+ transfer = parted.transfer;
118
+ continue;
119
+ }
120
+ if (transfer === null)
121
+ mode.paged = true;
140
122
  const models = remodel(page.models, transfer?.models ?? held);
141
123
  const staged = await staging.stage({
142
124
  locator,
@@ -151,7 +133,7 @@ async function bundle(adapter, authorization, room, held, builtIn, remodel, cont
151
133
  done: { bytes: (transfer?.done.bytes ?? 0) + (page.bytes ?? 0) },
152
134
  models,
153
135
  key: transfer?.key ?? null,
154
- }, await pageOf(page), compositionFor(room, models, builtIn));
136
+ }, await pageOf(page), compositionOf(models.collection, room.typedSelection, builtIn, typedPaths));
155
137
  if (staged === null)
156
138
  return unconfirmed;
157
139
  transfer = staged;
@@ -169,42 +151,179 @@ async function bundle(adapter, authorization, room, held, builtIn, remodel, cont
169
151
  }
170
152
  if (transfer === null)
171
153
  return unconfirmed;
172
- const installed = transfer;
173
- const composition = compositionFor(room, installed.models, builtIn);
174
- if (!(await staging.derive(locator, installed.key, composition)))
175
- return unconfirmed;
176
- await staging.turn(locator, 'replaying');
177
- if (!continuing())
178
- return unconfirmed;
179
- const record = {
180
- locator,
181
- name: room.name,
182
- handle: room.handle,
183
- operations: room.operations,
184
- replica: room.replica,
185
- model: installed.models.collection,
186
- typedSelection: room.typedSelection ?? null,
187
- providerOwnedPaths: room.providerOwnedPaths,
188
- roomVersion: installed.from,
189
- transfer: installed.transfer,
190
- inventory: installed.done,
191
- key: installed.key,
192
- };
193
- const last = installed.last;
194
- const refresh = adapter.refresh;
195
- const reconciled = last === installed.from &&
196
- (staging.streamed || adapter.reached(locator, last, room.roomVersion))
197
- ? { kind: 'still-current' }
198
- : refresh === undefined
199
- ? unconfirmed
200
- : await advancement(refresh, authorization, record, remodel, continuing, await staging.refreshing(locator, record.key, composition));
201
- if (reconciled.kind === 'advanced') {
202
- return { kind: 'staged', record: reconciled.record, refreshed: true };
154
+ return installed(transfer);
155
+ async function parts(head, listed) {
156
+ const models = remodel(head.models, held);
157
+ const composition = compositionOf(models.collection, room.typedSelection, builtIn, typedPaths);
158
+ const resumed = await staging.resume({
159
+ locator,
160
+ transfer: transferIdentity(),
161
+ selection,
162
+ from: head.roomVersion,
163
+ last: head.roomVersion,
164
+ done: { bytes: 0 },
165
+ models,
166
+ key: null,
167
+ }, listed, composition);
168
+ if (resumed === null)
169
+ return unconfirmed;
170
+ let staged = resumed.record ?? {
171
+ locator,
172
+ transfer: transferIdentity(),
173
+ selection,
174
+ from: head.roomVersion,
175
+ last: head.roomVersion,
176
+ done: { bytes: 0 },
177
+ models,
178
+ key: null,
179
+ };
180
+ const wanted = listed.filter((part) => !resumed.staged.has(part.id));
181
+ let arrived = staged.done.bytes;
182
+ const partial = new Map();
183
+ const report = () => {
184
+ let bytes = arrived;
185
+ for (const held of partial.values())
186
+ bytes += held;
187
+ arriving.at(bytes);
188
+ };
189
+ report();
190
+ const arrivals = [];
191
+ let woken = null;
192
+ let next = 0;
193
+ let flying = 0;
194
+ let halted = false;
195
+ let stopped = false;
196
+ let admitted = Promise.resolve();
197
+ const fetched = () => {
198
+ if ((next < wanted.length && !halted) || flying > 0)
199
+ return;
200
+ downloaded();
201
+ arriving.end();
202
+ };
203
+ const landed = (one) => {
204
+ flying -= 1;
205
+ if (stopped)
206
+ one.written();
207
+ else
208
+ arrivals.push(one);
209
+ woken?.();
210
+ ask();
211
+ fetched();
212
+ };
213
+ const fetch = async (part) => {
214
+ let written = () => { };
215
+ const admission = admitted.then(async () => {
216
+ await staging.unqueued();
217
+ written = staging.queued(part.bytes);
218
+ });
219
+ admitted = admission;
220
+ await admission;
221
+ const page = continuing()
222
+ ? await adapter.bootstrap(authorization, {
223
+ locator,
224
+ selection,
225
+ signal: ending.signal,
226
+ pageToken: part.id,
227
+ arriving: (bytes) => {
228
+ partial.set(part.id, Math.min(bytes, part.bytes));
229
+ report();
230
+ },
231
+ })
232
+ : unconfirmed;
233
+ landed({ part, page, written });
234
+ };
235
+ const ask = () => {
236
+ while (!stopped && !halted && flying < PARTS_IN_FLIGHT && next < wanted.length) {
237
+ const part = wanted[next];
238
+ next += 1;
239
+ flying += 1;
240
+ fetch(part).catch((error) => landed({ part, page: unconfirmed, written: () => { }, error }));
241
+ }
242
+ };
243
+ let failed = null;
244
+ ask();
245
+ fetched();
246
+ try {
247
+ for (;;) {
248
+ while (arrivals.length === 0) {
249
+ if (flying === 0 && (halted || next >= wanted.length))
250
+ break;
251
+ await new Promise((wake) => (woken = wake));
252
+ woken = null;
253
+ }
254
+ const one = arrivals.shift();
255
+ if (one === undefined)
256
+ break;
257
+ const { part, page, written, error } = one;
258
+ try {
259
+ if (error !== undefined)
260
+ throw error;
261
+ if (!continuing())
262
+ return unconfirmed;
263
+ if (page.kind !== 'bootstrap') {
264
+ halted = true;
265
+ failed ??= page.kind === 'beyond-horizon' ? unconfirmed : page;
266
+ continue;
267
+ }
268
+ partial.delete(part.id);
269
+ arrived += part.bytes;
270
+ report();
271
+ const kept = await staging.stage({ ...staged, done: { bytes: staged.done.bytes + part.bytes } }, await pageOf({ ...page, roomVersion: head.roomVersion }, part.id), composition);
272
+ if (kept === null)
273
+ return unconfirmed;
274
+ staged = kept;
275
+ }
276
+ finally {
277
+ written();
278
+ }
279
+ }
280
+ }
281
+ finally {
282
+ stopped = true;
283
+ for (const one of arrivals.splice(0))
284
+ one.written();
285
+ }
286
+ if (failed !== null)
287
+ return failed;
288
+ if (staged.key === null) {
289
+ const empty = await staging.stage(staged, { entries: [], folders: [] }, composition);
290
+ if (empty === null)
291
+ return unconfirmed;
292
+ staged = empty;
293
+ }
294
+ return { kind: 'parted', transfer: staged };
203
295
  }
204
- if (reconciled.kind === 'still-current')
205
- return { kind: 'staged', record, refreshed: false };
206
- if (reconciled.kind === 'beyond-horizon') {
207
- return { kind: 'expired', held: staging.content(record.key), key: record.key };
296
+ async function installed(transfer) {
297
+ const composition = compositionOf(transfer.models.collection, room.typedSelection, builtIn, typedPaths);
298
+ if (!(await staging.derive(locator, transfer.key, composition)))
299
+ return unconfirmed;
300
+ await staging.turn(locator, 'replaying');
301
+ if (!continuing())
302
+ return unconfirmed;
303
+ const record = {
304
+ locator,
305
+ declaration: declared(room),
306
+ model: transfer.models.collection,
307
+ roomVersion: transfer.from,
308
+ transfer: transfer.transfer,
309
+ inventory: transfer.done,
310
+ key: transfer.key,
311
+ };
312
+ const last = transfer.last;
313
+ const refresh = adapter.refresh;
314
+ const reconciled = last === transfer.from &&
315
+ (staging.streamed || adapter.reached(locator, last, room.roomVersion))
316
+ ? { kind: 'still-current' }
317
+ : refresh === undefined
318
+ ? unconfirmed
319
+ : await advancement(refresh, authorization, record, remodel, continuing, await staging.refreshing(locator, record.key, composition));
320
+ if (reconciled.kind === 'advanced') {
321
+ return { kind: 'staged', record: reconciled.record, refreshed: true };
322
+ }
323
+ if (reconciled.kind === 'still-current')
324
+ return { kind: 'staged', record, refreshed: false };
325
+ if (reconciled.kind === 'beyond-horizon')
326
+ return { kind: 'expired', key: record.key };
327
+ return reconciled;
208
328
  }
209
- return reconciled;
210
329
  }
package/dist/cell.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export type Cell<T> = {
2
+ now(): T;
3
+ set(change: Partial<T>): void;
4
+ };
5
+ export declare function createCell<T extends object>(first: T): Cell<T>;
6
+ //# sourceMappingURL=cell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell.d.ts","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IACpB,GAAG,IAAI,CAAC,CAAC;IACT,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAQ9D"}
package/dist/cell.js ADDED
@@ -0,0 +1,9 @@
1
+ export function createCell(first) {
2
+ let held = first;
3
+ return {
4
+ now: () => held,
5
+ set(change) {
6
+ held = { ...held, ...change };
7
+ },
8
+ };
9
+ }
package/dist/chain.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
1
2
  import type { MdRuntimeClient } from './client.js';
2
- import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
3
+ import type { DocumentResult, GroupResult, PendingResult } from './query.js';
3
4
  type Rows = DocumentResult | GroupResult;
4
5
  export type WindowAnswer = Rows | PendingResult;
5
6
  export type WindowChain = {
@@ -1 +1 @@
1
- {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,UAAU,EACV,WAAW,EACX,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,KAA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eSet = {
12
12
  queues: readonly string[];
13
13
  presentations: readonly string[];
14
14
  conversations: readonly string[];
15
+ unindexed: readonly string[];
16
+ due: readonly string[];
15
17
  };
16
18
  type Changed = {
17
19
  documents?: readonly string[] | null;
@@ -19,6 +21,8 @@ type Changed = {
19
21
  room?: boolean;
20
22
  queue?: boolean;
21
23
  presentation?: string;
24
+ unindexed?: boolean;
25
+ due?: boolean;
22
26
  };
23
27
  export declare function changeSet(locator: string, changed?: Changed): ChangeSet;
24
28
  export declare function conversationChangeSet(conversations: readonly string[]): ChangeSet;
@@ -1 +1 @@
1
- {"version":3,"file":"change-set.d.ts","sourceRoot":"","sources":["../src/change-set.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAExF,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,SAAS,cAAc,EAAE,CAAC;IACrC,MAAM,EAAE,SAAS;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACrD,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IACrC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OA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AAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY,GAAG,SAAS,CAiB3E;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAWjF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAWrE;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAI9E"}
@@ -11,6 +11,8 @@ export function changeSet(locator, changed = {}) {
11
11
  queues: changed.queue ? [locator] : [],
12
12
  presentations: changed.presentation === undefined ? [] : [changed.presentation],
13
13
  conversations: [],
14
+ unindexed: changed.unindexed ? [locator] : [],
15
+ due: changed.due ? [locator] : [],
14
16
  };
15
17
  }
16
18
  export function conversationChangeSet(conversations) {
@@ -21,6 +23,8 @@ export function conversationChangeSet(conversations) {
21
23
  queues: [],
22
24
  presentations: [],
23
25
  conversations: [...new Set(conversations)],
26
+ unindexed: [],
27
+ due: [],
24
28
  };
25
29
  }
26
30
  export function mergeChangeSets(sets) {
@@ -31,6 +35,8 @@ export function mergeChangeSets(sets) {
31
35
  queues: [...new Set(sets.flatMap((set) => set.queues))],
32
36
  presentations: [...new Set(sets.flatMap((set) => set.presentations))],
33
37
  conversations: [...new Set(sets.flatMap((set) => set.conversations))],
38
+ unindexed: [...new Set(sets.flatMap((set) => set.unindexed))],
39
+ due: [...new Set(sets.flatMap((set) => set.due))],
34
40
  };
35
41
  }
36
42
  export function touches(set, locator, path) {
package/dist/change.d.ts CHANGED
@@ -50,8 +50,13 @@ type Arriving = {
50
50
  readonly path: string;
51
51
  readonly revision?: string;
52
52
  readonly fileId?: string;
53
+ readonly created?: string;
53
54
  readonly change?: HeadChange;
54
55
  };
56
+ export type PartChange = Extract<Change, {
57
+ readonly kind: 'field' | 'section' | 'preamble';
58
+ }>;
59
+ export declare function isPart(change: Change): change is PartChange;
55
60
  export type RoomMove = {
56
61
  readonly source: {
57
62
  readonly room: string;
@@ -1 +1 @@
1
- {"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../src/change.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,MAAM,MAAM,GACd;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC5E;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC5E;IAAE,QAA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B,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAO3E;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOpF"}
package/dist/change.js CHANGED
@@ -1,3 +1,6 @@
1
+ export function isPart(change) {
2
+ return change.kind === 'field' || change.kind === 'section' || change.kind === 'preamble';
3
+ }
1
4
  function frozen(value) {
2
5
  if (Array.isArray(value))
3
6
  return Object.freeze(value.map((item) => frozen(item)));
@@ -22,7 +25,8 @@ export function leaving(batch, locator) {
22
25
  }
23
26
  export function landing(changes, index, path) {
24
27
  let at = path;
25
- for (const change of changes.slice(index + 1)) {
28
+ for (let next = index + 1; next < changes.length; next += 1) {
29
+ const change = changes[next];
26
30
  if (change.path !== at)
27
31
  continue;
28
32
  if (change.kind === 'remove')
@@ -34,7 +38,8 @@ export function landing(changes, index, path) {
34
38
  }
35
39
  export function departure(changes, index) {
36
40
  let at = changes[index].path;
37
- for (const change of changes.slice(0, index).reverse()) {
41
+ for (let earlier = index - 1; earlier >= 0; earlier -= 1) {
42
+ const change = changes[earlier];
38
43
  if (change.kind === 'move' && change.to === at)
39
44
  at = change.path;
40
45
  }
@@ -0,0 +1,3 @@
1
+ export declare function keptFile(line: string): string | null;
2
+ export declare function keptLines(body: string): string[];
3
+ //# sourceMappingURL=chat-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-types.d.ts","sourceRoot":"","sources":["../src/chat-types.ts"],"names":[],"mappings":"AAIA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEpD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAKhD"}
@@ -0,0 +1,11 @@
1
+ const KEPT_LINE = /^\[([^\]\n]+)\]\(\1\)$/u;
2
+ const TOO_BIG_LINE = /^\[too big to keep: [^\n]*\]$/u;
3
+ export function keptFile(line) {
4
+ return KEPT_LINE.exec(line)?.[1] ?? null;
5
+ }
6
+ export function keptLines(body) {
7
+ const trimmed = body.replace(/\n+$/u, '');
8
+ const at = trimmed.lastIndexOf('\n\n');
9
+ const lines = (at === -1 ? trimmed : trimmed.slice(at + 2)).split('\n');
10
+ return lines.every((line) => keptFile(line) !== null || TOO_BIG_LINE.test(line)) ? lines : [];
11
+ }
package/dist/client.d.ts CHANGED
@@ -1,15 +1,26 @@
1
- import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
2
- import type { Member, ServiceMode } from './adapter.js';
3
- import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
1
+ import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
2
+ import type { HistoryQuery } from './actions.js';
3
+ import type { AppRoom } from './listing.js';
4
+ import type { ConnectionRefusal } from './socket.js';
5
+ import type { RoomSchemas } from './surface.js';
6
+ import type { SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
7
+ import type { ListedAgent, Member, RoomList, ServiceMode } from './adapter.js';
8
+ import type { UnsentWork } from './durability.js';
9
+ import type { ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView } from './conversation.js';
4
10
  import { type Observation } from './observation.js';
5
- import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
6
- import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
11
+ import { type AttachAnswer, type BinaryAnswer, type CallResult, type DownloadAnswer, type HistoryAnswer, type QueueEntry, type Resolution } from './outcome.js';
12
+ import type { FiguresResult } from './figures.js';
13
+ import type { Holdings } from './holdings.js';
14
+ import type { DocumentResult, GroupResult, PendingResult } from './query.js';
7
15
  import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
8
16
  import type { SearchRequest, SearchResult } from './search.js';
9
17
  import type { Readiness } from './readiness.js';
18
+ import type { ObservedRead } from './reads.js';
10
19
  import type { SyncStatus } from './status.js';
11
20
  import { type RuntimePort } from './wire.js';
21
+ export type BuildFile = (name: string) => Promise<Blob | null>;
12
22
  export type MdRuntimeClient = {
23
+ buildFile(name: string): Promise<Blob | null>;
13
24
  rooms(): Promise<readonly AppRoom[]>;
14
25
  query: {
15
26
  (query: DocumentQuery): Promise<DocumentResult | PendingResult>;
@@ -30,22 +41,10 @@ export type MdRuntimeClient = {
30
41
  write(value: unknown): Promise<void>;
31
42
  edit(members: Readonly<Record<string, unknown>>): Promise<void>;
32
43
  };
33
- conversation: {
34
- list(): Promise<readonly ConversationEntry[]>;
35
- read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
36
- create(input: unknown): Promise<CallResult>;
37
- send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
38
- answer(conversation: string, answer: unknown): Promise<CallResult>;
39
- interrupt(conversation: string): Promise<CallResult>;
40
- kill(conversation: string): Promise<CallResult>;
41
- cancel(conversation: string, turn: string): Promise<CallResult>;
42
- delete(conversation: string): Promise<CallResult>;
43
- };
44
- chatDraft: {
45
- write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
46
- prepend(conversation: string, draft: ChatDraft): Promise<void>;
47
- discard(conversation: string): Promise<void>;
44
+ conversation: ConversationSurface & {
45
+ pageMetadata(app: string, address: string): Promise<string>;
48
46
  };
47
+ chatDraft: ChatDraftSurface;
49
48
  history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
50
49
  resolve(room: string, path: string, destination: string): Promise<Resolution>;
51
50
  binaryFile: {
@@ -54,11 +53,15 @@ export type MdRuntimeClient = {
54
53
  download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
55
54
  };
56
55
  call(name: string, input: unknown): Promise<CallResult>;
56
+ answered(operation: string): Promise<boolean>;
57
57
  reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
58
- log(): Promise<string>;
59
58
  persistence(): Promise<boolean>;
60
59
  retry(): Promise<void>;
61
60
  cleanUp(): Promise<number>;
61
+ unsent(): Promise<readonly UnsentWork[]>;
62
+ sent(): Promise<void>;
63
+ reset(): Promise<void>;
64
+ readAgain(): Promise<void>;
62
65
  observe: {
63
66
  (topic: 'deployment-facts'): Promise<Observation<unknown>>;
64
67
  (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
@@ -68,6 +71,8 @@ export type MdRuntimeClient = {
68
71
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
69
72
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
70
73
  (topic: 'member'): Promise<Observation<Member | null>>;
74
+ (topic: 'time-zone'): Promise<Observation<string | null>>;
75
+ (topic: 'authority-changes'): Promise<Observation<number>>;
71
76
  (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
72
77
  (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
73
78
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
@@ -76,15 +81,20 @@ export type MdRuntimeClient = {
76
81
  (topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
77
82
  (topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
78
83
  (topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
84
+ (topic: 'listed-agents'): Promise<Observation<readonly ListedAgent[]>>;
85
+ (topic: 'room-list'): Promise<Observation<RoomList | null>>;
86
+ (topic: 'figures'): Promise<Observation<FiguresResult>>;
87
+ (topic: 'holdings'): Promise<Observation<Holdings>>;
88
+ (topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
79
89
  };
80
90
  reauthorize(): Promise<void>;
81
91
  settled(): Promise<void>;
82
92
  };
83
- export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
93
+ export declare function connectMdRuntime(port: RuntimePort, buildFile?: BuildFile): MdRuntimeClient;
84
94
  export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
85
95
  export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
86
96
  export { roomDraftRevision } from './identity.js';
87
- export { defineRoomMedia, ROOM_MEDIA } from './media.js';
97
+ export { defineRoomMedia, ROOM_MEDIA, viewFile } from './media.js';
88
98
  export type { Observation } from './observation.js';
89
99
  export type { Open } from './open.js';
90
100
  export { unanswered, type RuntimePort, type WireMember } from './wire.js';