@agentshouse/mdruntime 0.1.0-c94cfdbdb6f68 → 0.1.0-c95dc33df5c05

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 (364) hide show
  1. package/README.md +19 -16
  2. package/dist/acceptance.d.ts +6 -0
  3. package/dist/acceptance.d.ts.map +1 -0
  4. package/dist/acceptance.js +389 -0
  5. package/dist/actions.d.ts +20 -0
  6. package/dist/actions.d.ts.map +1 -0
  7. package/dist/actions.js +250 -0
  8. package/dist/adapter.d.ts +140 -85
  9. package/dist/adapter.d.ts.map +1 -1
  10. package/dist/attached-model.d.ts +7 -10
  11. package/dist/attached-model.d.ts.map +1 -1
  12. package/dist/attached-model.js +40 -41
  13. package/dist/binary.d.ts +0 -5
  14. package/dist/binary.d.ts.map +1 -1
  15. package/dist/binary.js +1 -1
  16. package/dist/bootstrap.d.ts +30 -11
  17. package/dist/bootstrap.d.ts.map +1 -1
  18. package/dist/bootstrap.js +319 -111
  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 +12 -0
  23. package/dist/chain.d.ts.map +1 -0
  24. package/dist/chain.js +64 -0
  25. package/dist/change-set.d.ts +9 -16
  26. package/dist/change-set.d.ts.map +1 -1
  27. package/dist/change-set.js +11 -89
  28. package/dist/change.d.ts +32 -1
  29. package/dist/change.d.ts.map +1 -1
  30. package/dist/change.js +10 -1
  31. package/dist/chat-types.d.ts +5 -0
  32. package/dist/chat-types.d.ts.map +1 -0
  33. package/dist/chat-types.js +13 -0
  34. package/dist/client.d.ts +30 -11
  35. package/dist/client.d.ts.map +1 -1
  36. package/dist/client.js +83 -7
  37. package/dist/collection.d.ts +11 -21
  38. package/dist/collection.d.ts.map +1 -1
  39. package/dist/collection.js +39 -321
  40. package/dist/compile.d.ts +16 -0
  41. package/dist/compile.d.ts.map +1 -0
  42. package/dist/compile.js +717 -0
  43. package/dist/connection.d.ts +7 -137
  44. package/dist/connection.d.ts.map +1 -1
  45. package/dist/connection.js +98 -3600
  46. package/dist/context.d.ts +2 -0
  47. package/dist/context.d.ts.map +1 -0
  48. package/dist/{chat/context.js → context.js} +1 -4
  49. package/dist/conversation-row.d.ts +33 -0
  50. package/dist/conversation-row.d.ts.map +1 -0
  51. package/dist/conversation-row.js +53 -0
  52. package/dist/conversation.d.ts +37 -18
  53. package/dist/conversation.d.ts.map +1 -1
  54. package/dist/conversation.js +573 -287
  55. package/dist/digest.d.ts +7 -0
  56. package/dist/digest.d.ts.map +1 -0
  57. package/dist/digest.js +113 -0
  58. package/dist/discovery.d.ts +10 -0
  59. package/dist/discovery.d.ts.map +1 -0
  60. package/dist/discovery.js +175 -0
  61. package/dist/durability.d.ts +16 -4
  62. package/dist/durability.d.ts.map +1 -1
  63. package/dist/durability.js +5 -0
  64. package/dist/entry.d.ts +5 -2
  65. package/dist/entry.d.ts.map +1 -1
  66. package/dist/entry.js +33 -29
  67. package/dist/figures.d.ts +48 -0
  68. package/dist/figures.d.ts.map +1 -0
  69. package/dist/figures.js +197 -0
  70. package/dist/file.d.ts +2 -19
  71. package/dist/file.d.ts.map +1 -1
  72. package/dist/file.js +7 -122
  73. package/dist/holdings.d.ts +29 -0
  74. package/dist/holdings.d.ts.map +1 -0
  75. package/dist/holdings.js +95 -0
  76. package/dist/host.d.ts +4 -7
  77. package/dist/host.d.ts.map +1 -1
  78. package/dist/host.js +67 -39
  79. package/dist/identity.d.ts +0 -2
  80. package/dist/identity.d.ts.map +1 -1
  81. package/dist/identity.js +0 -6
  82. package/dist/index.d.ts +31 -13
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +10 -2
  85. package/dist/install.d.ts +56 -0
  86. package/dist/install.d.ts.map +1 -0
  87. package/dist/install.js +560 -0
  88. package/dist/job.d.ts +33 -0
  89. package/dist/job.d.ts.map +1 -0
  90. package/dist/job.js +54 -0
  91. package/dist/lifecycle.d.ts +7 -0
  92. package/dist/lifecycle.d.ts.map +1 -0
  93. package/dist/lifecycle.js +267 -0
  94. package/dist/listing.d.ts +53 -0
  95. package/dist/listing.d.ts.map +1 -0
  96. package/dist/listing.js +175 -0
  97. package/dist/live.d.ts +23 -0
  98. package/dist/live.d.ts.map +1 -0
  99. package/dist/live.js +165 -0
  100. package/dist/locks.d.ts +9 -0
  101. package/dist/locks.d.ts.map +1 -0
  102. package/dist/locks.js +61 -0
  103. package/dist/log.d.ts +1 -0
  104. package/dist/log.d.ts.map +1 -1
  105. package/dist/lost.d.ts +5 -0
  106. package/dist/lost.d.ts.map +1 -0
  107. package/dist/lost.js +61 -0
  108. package/dist/media.d.ts +8 -0
  109. package/dist/media.d.ts.map +1 -0
  110. package/dist/media.js +218 -0
  111. package/dist/memory.d.ts +14 -6
  112. package/dist/memory.d.ts.map +1 -1
  113. package/dist/memory.js +237 -105
  114. package/dist/messages.d.ts +52 -0
  115. package/dist/messages.d.ts.map +1 -0
  116. package/dist/messages.js +168 -0
  117. package/dist/model.d.ts +8 -10
  118. package/dist/model.d.ts.map +1 -1
  119. package/dist/model.js +6 -18
  120. package/dist/models.d.ts +14 -0
  121. package/dist/models.d.ts.map +1 -0
  122. package/dist/models.js +193 -0
  123. package/dist/name.d.ts +4 -0
  124. package/dist/name.d.ts.map +1 -0
  125. package/dist/name.js +122 -0
  126. package/dist/observation.d.ts +15 -2
  127. package/dist/observation.d.ts.map +1 -1
  128. package/dist/observation.js +91 -2
  129. package/dist/opened.d.ts +22 -0
  130. package/dist/opened.d.ts.map +1 -0
  131. package/dist/opened.js +107 -0
  132. package/dist/opening.d.ts +4 -0
  133. package/dist/opening.d.ts.map +1 -0
  134. package/dist/opening.js +56 -0
  135. package/dist/outcome.d.ts +44 -9
  136. package/dist/outcome.d.ts.map +1 -1
  137. package/dist/outcome.js +41 -2
  138. package/dist/overlay.d.ts +3 -5
  139. package/dist/overlay.d.ts.map +1 -1
  140. package/dist/overlay.js +98 -172
  141. package/dist/{chat/parts.d.ts → parts.d.ts} +11 -9
  142. package/dist/parts.d.ts.map +1 -0
  143. package/dist/{chat/parts.js → parts.js} +45 -46
  144. package/dist/paths.d.ts +1 -0
  145. package/dist/paths.d.ts.map +1 -1
  146. package/dist/paths.js +4 -0
  147. package/dist/preparation.d.ts +20 -0
  148. package/dist/preparation.d.ts.map +1 -0
  149. package/dist/preparation.js +226 -0
  150. package/dist/queries.d.ts +16 -0
  151. package/dist/queries.d.ts.map +1 -0
  152. package/dist/queries.js +272 -0
  153. package/dist/query.d.ts +21 -206
  154. package/dist/query.d.ts.map +1 -1
  155. package/dist/query.js +3 -493
  156. package/dist/{chat/questions.d.ts → questions.d.ts} +5 -2
  157. package/dist/questions.d.ts.map +1 -0
  158. package/dist/{chat/questions.js → questions.js} +12 -1
  159. package/dist/reach.d.ts +20 -9
  160. package/dist/reach.d.ts.map +1 -1
  161. package/dist/reach.js +278 -103
  162. package/dist/react.d.ts +10 -2
  163. package/dist/react.d.ts.map +1 -1
  164. package/dist/{chat/read.d.ts → read.d.ts} +2 -0
  165. package/dist/read.d.ts.map +1 -0
  166. package/dist/{chat/read.js → read.js} +4 -0
  167. package/dist/readiness.d.ts +14 -17
  168. package/dist/readiness.d.ts.map +1 -1
  169. package/dist/readiness.js +2 -8
  170. package/dist/reads.d.ts +35 -10
  171. package/dist/reads.d.ts.map +1 -1
  172. package/dist/reads.js +136 -84
  173. package/dist/recovery.d.ts +3 -2
  174. package/dist/recovery.d.ts.map +1 -1
  175. package/dist/recovery.js +43 -8
  176. package/dist/refresh.d.ts +18 -15
  177. package/dist/refresh.d.ts.map +1 -1
  178. package/dist/refresh.js +143 -58
  179. package/dist/refusal.d.ts +5 -0
  180. package/dist/refusal.d.ts.map +1 -0
  181. package/dist/refusal.js +56 -0
  182. package/dist/replica.d.ts +54 -36
  183. package/dist/replica.d.ts.map +1 -1
  184. package/dist/replica.js +313 -188
  185. package/dist/room-draft.d.ts +25 -6
  186. package/dist/room-draft.d.ts.map +1 -1
  187. package/dist/room-draft.js +158 -71
  188. package/dist/room-drafts.d.ts +24 -0
  189. package/dist/room-drafts.d.ts.map +1 -0
  190. package/dist/room-drafts.js +216 -0
  191. package/dist/rows.d.ts +31 -31
  192. package/dist/rows.d.ts.map +1 -1
  193. package/dist/rows.js +59 -123
  194. package/dist/runtime.d.ts +42 -0
  195. package/dist/runtime.d.ts.map +1 -0
  196. package/dist/runtime.js +1 -0
  197. package/dist/save.d.ts +52 -14
  198. package/dist/save.d.ts.map +1 -1
  199. package/dist/save.js +518 -185
  200. package/dist/saves.d.ts +70 -0
  201. package/dist/saves.d.ts.map +1 -0
  202. package/dist/saves.js +1004 -0
  203. package/dist/search.d.ts +12 -95
  204. package/dist/search.d.ts.map +1 -1
  205. package/dist/search.js +10 -266
  206. package/dist/seed.d.ts +11 -2
  207. package/dist/seed.d.ts.map +1 -1
  208. package/dist/seed.js +71 -0
  209. package/dist/shared.d.ts +7 -3
  210. package/dist/shared.d.ts.map +1 -1
  211. package/dist/shared.js +119 -66
  212. package/dist/shown.d.ts +31 -0
  213. package/dist/shown.d.ts.map +1 -0
  214. package/dist/shown.js +294 -0
  215. package/dist/socket/admission.d.ts +7 -0
  216. package/dist/socket/admission.d.ts.map +1 -0
  217. package/dist/socket/admission.js +39 -0
  218. package/dist/socket/answers.d.ts +6 -0
  219. package/dist/socket/answers.d.ts.map +1 -0
  220. package/dist/socket/answers.js +20 -0
  221. package/dist/socket/lanes.d.ts +20 -0
  222. package/dist/socket/lanes.d.ts.map +1 -0
  223. package/dist/socket/lanes.js +77 -0
  224. package/dist/socket/reads.d.ts +10 -0
  225. package/dist/socket/reads.d.ts.map +1 -0
  226. package/dist/socket/reads.js +31 -0
  227. package/dist/socket/rooms.d.ts +43 -0
  228. package/dist/socket/rooms.d.ts.map +1 -0
  229. package/dist/socket/rooms.js +90 -0
  230. package/dist/socket/session.d.ts +39 -0
  231. package/dist/socket/session.d.ts.map +1 -0
  232. package/dist/socket/session.js +23 -0
  233. package/dist/socket.d.ts +70 -0
  234. package/dist/socket.d.ts.map +1 -0
  235. package/dist/socket.js +175 -0
  236. package/dist/source.d.ts +61 -0
  237. package/dist/source.d.ts.map +1 -0
  238. package/dist/source.js +81 -0
  239. package/dist/status.d.ts +4 -5
  240. package/dist/status.d.ts.map +1 -1
  241. package/dist/status.js +3 -7
  242. package/dist/store/fences.d.ts +16 -0
  243. package/dist/store/fences.d.ts.map +1 -0
  244. package/dist/store/fences.js +26 -0
  245. package/dist/store/installs.d.ts +30 -0
  246. package/dist/store/installs.d.ts.map +1 -0
  247. package/dist/store/installs.js +34 -0
  248. package/dist/store/readiness.d.ts +10 -0
  249. package/dist/store/readiness.d.ts.map +1 -0
  250. package/dist/store/readiness.js +52 -0
  251. package/dist/store/records.d.ts +212 -0
  252. package/dist/store/records.d.ts.map +1 -0
  253. package/dist/store/records.js +408 -0
  254. package/dist/store/room-held.d.ts +8 -0
  255. package/dist/store/room-held.d.ts.map +1 -0
  256. package/dist/store/room-held.js +17 -0
  257. package/dist/store/space.d.ts +11 -0
  258. package/dist/store/space.d.ts.map +1 -0
  259. package/dist/store/space.js +43 -0
  260. package/dist/store/watchers.d.ts +17 -0
  261. package/dist/store/watchers.d.ts.map +1 -0
  262. package/dist/store/watchers.js +57 -0
  263. package/dist/store/writes.d.ts +24 -0
  264. package/dist/store/writes.d.ts.map +1 -0
  265. package/dist/store/writes.js +125 -0
  266. package/dist/store.d.ts +106 -164
  267. package/dist/store.d.ts.map +1 -1
  268. package/dist/store.js +136 -752
  269. package/dist/stored.d.ts +156 -0
  270. package/dist/stored.d.ts.map +1 -0
  271. package/dist/stored.js +637 -0
  272. package/dist/surface.d.ts +88 -0
  273. package/dist/surface.d.ts.map +1 -0
  274. package/dist/surface.js +222 -0
  275. package/dist/sync.d.ts +20 -0
  276. package/dist/sync.d.ts.map +1 -0
  277. package/dist/sync.js +531 -0
  278. package/dist/tables.d.ts +415 -0
  279. package/dist/tables.d.ts.map +1 -0
  280. package/dist/tables.js +740 -0
  281. package/dist/tallies.d.ts +18 -0
  282. package/dist/tallies.d.ts.map +1 -0
  283. package/dist/tallies.js +129 -0
  284. package/dist/transfer.d.ts +0 -5
  285. package/dist/transfer.d.ts.map +1 -1
  286. package/dist/turn.d.ts +4 -2
  287. package/dist/turn.d.ts.map +1 -1
  288. package/dist/turn.js +46 -22
  289. package/dist/validation.d.ts +29 -0
  290. package/dist/validation.d.ts.map +1 -0
  291. package/dist/validation.js +104 -0
  292. package/dist/windows.d.ts +1 -16
  293. package/dist/windows.d.ts.map +1 -1
  294. package/dist/windows.js +2 -79
  295. package/dist/wire.d.ts +34 -6
  296. package/dist/wire.d.ts.map +1 -1
  297. package/dist/wire.js +12 -2
  298. package/package.json +18 -19
  299. package/AGENTS.md +0 -299
  300. package/dist/chat/acts.d.ts +0 -33
  301. package/dist/chat/acts.d.ts.map +0 -1
  302. package/dist/chat/acts.js +0 -36
  303. package/dist/chat/context.d.ts +0 -3
  304. package/dist/chat/context.d.ts.map +0 -1
  305. package/dist/chat/earlier.d.ts +0 -10
  306. package/dist/chat/earlier.d.ts.map +0 -1
  307. package/dist/chat/earlier.js +0 -54
  308. package/dist/chat/input.d.ts +0 -9
  309. package/dist/chat/input.d.ts.map +0 -1
  310. package/dist/chat/input.js +0 -99
  311. package/dist/chat/kit.d.ts +0 -61
  312. package/dist/chat/kit.d.ts.map +0 -1
  313. package/dist/chat/kit.js +0 -123
  314. package/dist/chat/lasting.d.ts +0 -6
  315. package/dist/chat/lasting.d.ts.map +0 -1
  316. package/dist/chat/lasting.js +0 -19
  317. package/dist/chat/list.d.ts +0 -27
  318. package/dist/chat/list.d.ts.map +0 -1
  319. package/dist/chat/list.js +0 -99
  320. package/dist/chat/markdown.d.ts +0 -20
  321. package/dist/chat/markdown.d.ts.map +0 -1
  322. package/dist/chat/markdown.js +0 -188
  323. package/dist/chat/message.d.ts +0 -6
  324. package/dist/chat/message.d.ts.map +0 -1
  325. package/dist/chat/message.js +0 -192
  326. package/dist/chat/messages.d.ts +0 -22
  327. package/dist/chat/messages.d.ts.map +0 -1
  328. package/dist/chat/messages.js +0 -155
  329. package/dist/chat/name.d.ts +0 -6
  330. package/dist/chat/name.d.ts.map +0 -1
  331. package/dist/chat/name.js +0 -37
  332. package/dist/chat/opened.d.ts +0 -11
  333. package/dist/chat/opened.d.ts.map +0 -1
  334. package/dist/chat/opened.js +0 -17
  335. package/dist/chat/overlay.d.ts +0 -31
  336. package/dist/chat/overlay.d.ts.map +0 -1
  337. package/dist/chat/overlay.js +0 -97
  338. package/dist/chat/parts.d.ts.map +0 -1
  339. package/dist/chat/process.d.ts +0 -20
  340. package/dist/chat/process.d.ts.map +0 -1
  341. package/dist/chat/process.js +0 -32
  342. package/dist/chat/provider.d.ts +0 -63
  343. package/dist/chat/provider.d.ts.map +0 -1
  344. package/dist/chat/provider.js +0 -628
  345. package/dist/chat/question.d.ts +0 -9
  346. package/dist/chat/question.d.ts.map +0 -1
  347. package/dist/chat/question.js +0 -69
  348. package/dist/chat/questions.d.ts.map +0 -1
  349. package/dist/chat/read.d.ts.map +0 -1
  350. package/dist/chat/ready.d.ts +0 -34
  351. package/dist/chat/ready.d.ts.map +0 -1
  352. package/dist/chat/ready.js +0 -91
  353. package/dist/chat/style.d.ts +0 -4
  354. package/dist/chat/style.d.ts.map +0 -1
  355. package/dist/chat/style.js +0 -302
  356. package/dist/chat.d.ts +0 -14
  357. package/dist/chat.d.ts.map +0 -1
  358. package/dist/chat.js +0 -8
  359. package/dist/fence.d.ts +0 -6
  360. package/dist/fence.d.ts.map +0 -1
  361. package/dist/fence.js +0 -10
  362. package/dist/read-side.d.ts +0 -27
  363. package/dist/read-side.d.ts.map +0 -1
  364. package/dist/read-side.js +0 -824
@@ -0,0 +1,560 @@
1
+ import { attachedModel } from './attached-model.js';
2
+ import { bootstrapRoom } from './bootstrap.js';
3
+ import { refusedForSpace } from './durability.js';
4
+ import { name, usable } from './listing.js';
5
+ import { NO_MODEL } from './model.js';
6
+ import { advancement } from './refresh.js';
7
+ import { recoverReads, statusShown } from './shown.js';
8
+ import { NO_INSTALL, } from './store.js';
9
+ import { unconfirmed } from './transfer.js';
10
+ import { ROW_WEIGHT, yielded } from './turn.js';
11
+ // Bytes still arriving are reported at most this often, so readiness is not rebuilt for every chunk the network hands over while a slow link still moves the figure.
12
+ const ARRIVAL_REPORT_MS = 250;
13
+ const NOTHING_HELD = { bytes: 0 };
14
+ export const ERASE_BATCH = 512;
15
+ function transferGone(held) {
16
+ return {
17
+ ...held,
18
+ transfer: null,
19
+ arrived: null,
20
+ streaming: false,
21
+ underived: 0,
22
+ unindexed: [],
23
+ };
24
+ }
25
+ function amountOf(held, kept) {
26
+ if (held.transfer !== null) {
27
+ const owed = held.unindexed.reduce((sum, part) => sum + part.bytes, 0);
28
+ return {
29
+ done: held.transfer.done.bytes - Math.ceil(owed),
30
+ total: Math.max(held.arrived ?? 0, held.transfer.done.bytes),
31
+ };
32
+ }
33
+ return { done: kept, total: held.arrived ?? kept };
34
+ }
35
+ function setBack(held) {
36
+ const now = amountOf(held, NOTHING_HELD.bytes);
37
+ const earlier = held.startedOver;
38
+ return {
39
+ ...held,
40
+ startedOver: {
41
+ done: Math.max(now.done, earlier?.done ?? 0),
42
+ total: Math.max(now.total, earlier?.total ?? 0),
43
+ },
44
+ };
45
+ }
46
+ function owedIndexes(held, bytes, text) {
47
+ if (bytes <= 0 || text <= 0)
48
+ return held;
49
+ return { ...held, unindexed: [...held.unindexed, { bytes, text }] };
50
+ }
51
+ function built(held, done, text) {
52
+ const owed = [...held.unindexed];
53
+ let left = text;
54
+ while (!done && left > 0 && owed.length > 0) {
55
+ const [first] = owed;
56
+ if (left >= first.text) {
57
+ left -= first.text;
58
+ owed.shift();
59
+ continue;
60
+ }
61
+ owed[0] = {
62
+ bytes: (first.bytes * (first.text - left)) / first.text,
63
+ text: first.text - left,
64
+ };
65
+ left = 0;
66
+ }
67
+ return { ...held, unindexed: done ? [] : owed };
68
+ }
69
+ function batchEnd(entries, from, bytes) {
70
+ let end = from;
71
+ let spent = 0;
72
+ while (end < entries.length) {
73
+ const size = (entries[end].content?.length ?? 0) + ROW_WEIGHT;
74
+ if (spent + size > bytes && end > from)
75
+ break;
76
+ spent += size;
77
+ end += 1;
78
+ }
79
+ return end;
80
+ }
81
+ export function installationOf(store, coverage, held) {
82
+ const rooms = { done: 0, total: 0 };
83
+ const bytes = { done: 0, total: 0 };
84
+ let installing = 0;
85
+ let downloading = false;
86
+ for (const { room, state } of coverage) {
87
+ if (state === 'unadmitted')
88
+ continue;
89
+ rooms.total += 1;
90
+ if (state === 'complete')
91
+ rooms.done += 1;
92
+ const install = store.installs.of(room);
93
+ const underway = state === 'acquiring' || (install.installing && state !== 'complete');
94
+ if (underway)
95
+ installing += 1;
96
+ if (underway && (install.streaming || install.arrived === null))
97
+ downloading = true;
98
+ const kept = underway ? NOTHING_HELD.bytes : (held.get(room)?.bytes ?? NOTHING_HELD.bytes);
99
+ const now = amountOf(install, kept);
100
+ const earlier = underway ? install.startedOver : null;
101
+ bytes.done += Math.max(now.done, earlier?.done ?? 0);
102
+ bytes.total += Math.max(now.total, earlier?.total ?? 0);
103
+ }
104
+ const step = installing === 0
105
+ ? null
106
+ : downloading
107
+ ? 'downloading'
108
+ : bytes.done < bytes.total
109
+ ? 'writing'
110
+ : 'replaying';
111
+ return { step, rooms, bytes };
112
+ }
113
+ export function roomInFlight(store, locator) {
114
+ const { catching, transfer } = store.installs.of(locator);
115
+ return catching || transfer !== null;
116
+ }
117
+ function installing(runtime, locator) {
118
+ runtime.store.installs.change(locator, (held) => ({ ...held, installing: true }));
119
+ runtime.store.readiness.queue();
120
+ }
121
+ function installed(runtime, locator) {
122
+ if (!runtime.store.installs.of(locator).installing)
123
+ return;
124
+ runtime.store.installs.change(locator, (held) => ({ ...held, installing: false }));
125
+ runtime.store.readiness.queue();
126
+ }
127
+ export function sweep({ store, socket, journal }) {
128
+ if (store.device.now().sweeping || socket.closed())
129
+ return;
130
+ store.device.set({ sweeping: true });
131
+ void (async () => {
132
+ try {
133
+ while (!socket.closed() && (await store.durably((local) => local.erase(null, ERASE_BATCH)))) {
134
+ await yielded();
135
+ }
136
+ }
137
+ catch {
138
+ journal.record('erasure failed');
139
+ }
140
+ finally {
141
+ store.device.set({ sweeping: false });
142
+ }
143
+ })();
144
+ }
145
+ export function forgetInstall(store, locator) {
146
+ store.installs.change(locator, ({ installing }) => ({ ...NO_INSTALL, installing }));
147
+ }
148
+ export function caughtUpTo(runtime, locator) {
149
+ if (!runtime.store.installs.of(locator).catching)
150
+ return;
151
+ runtime.store.installs.change(locator, (held) => ({ ...held, catching: false }));
152
+ recoverReads(runtime);
153
+ }
154
+ export function catching(store, locator) {
155
+ store.installs.change(locator, (held) => ({ ...held, catching: true }));
156
+ }
157
+ export function confirmedAgain(store, locator) {
158
+ store.installs.change(locator, (held) => ({
159
+ ...held,
160
+ confirmations: held.confirmations + 1,
161
+ }));
162
+ }
163
+ export function standingAt(store, locator, held) {
164
+ return { key: held?.key ?? null, confirmed: store.installs.of(locator).confirmations };
165
+ }
166
+ function standsAt(store, locator, held, from) {
167
+ const now = standingAt(store, locator, held);
168
+ return now.key === from.key && now.confirmed === from.confirmed;
169
+ }
170
+ function shownAt({ store, socket }, locator, held) {
171
+ const raised = store.installs.of(locator).highest ?? undefined;
172
+ if (held === undefined || raised === undefined)
173
+ return held ?? raised;
174
+ return socket.reads.reached(locator, held, raised) ? held : raised;
175
+ }
176
+ export function showing(system, locator, roomVersion, held) {
177
+ const at = shownAt(system, locator, held);
178
+ if (at === undefined || !system.socket.reads.reached(locator, at, roomVersion)) {
179
+ system.store.installs.change(locator, (room) => ({ ...room, highest: roomVersion }));
180
+ }
181
+ }
182
+ export function olderThan(system, locator, roomVersion, held) {
183
+ const { store, socket } = system;
184
+ if (store.installs.of(locator).beyondHorizon)
185
+ return false;
186
+ const at = shownAt(system, locator, held);
187
+ return (at !== undefined &&
188
+ socket.reads.reached(locator, at, roomVersion) &&
189
+ !socket.reads.reached(locator, roomVersion, at));
190
+ }
191
+ async function older(runtime, locator, roomVersion) {
192
+ const { store } = runtime;
193
+ if (store.installs.of(locator).beyondHorizon)
194
+ return false;
195
+ return olderThan(runtime, locator, roomVersion, (await store.record(locator))?.roomVersion);
196
+ }
197
+ export function replaced(store, locators) {
198
+ for (const locator of locators) {
199
+ store.installs.change(locator, (held) => ({ ...held, highest: null, beyondHorizon: true }));
200
+ }
201
+ }
202
+ export async function reachedBy({ store, socket }, locator, roomVersion) {
203
+ const held = await store.record(locator);
204
+ return held !== undefined && socket.reads.reached(locator, held.roomVersion, roomVersion);
205
+ }
206
+ export async function behind({ store, socket }, room) {
207
+ const held = (await store.record(room.locator))?.roomVersion;
208
+ return held !== undefined && !socket.reads.reached(room.locator, held, room.roomVersion);
209
+ }
210
+ export async function writtenAfter({ store, socket }, locator, roomVersion, path) {
211
+ const held = await store.record(locator);
212
+ if (held === undefined)
213
+ return false;
214
+ const [entry] = await (await store.open()).entries(held.key, 'confirmed', [path]);
215
+ const written = entry?.written ?? undefined;
216
+ return (written !== undefined &&
217
+ socket.reads.reached(locator, written, roomVersion) &&
218
+ !socket.reads.reached(locator, roomVersion, written));
219
+ }
220
+ async function writtenLater(runtime, local, locator, key, paths, roomVersion, heldAt) {
221
+ if (paths.length === 0)
222
+ return new Set();
223
+ const { reached } = runtime.socket.reads;
224
+ const behindShown = heldAt === undefined
225
+ ? await older(runtime, locator, roomVersion)
226
+ : olderThan(runtime, locator, roomVersion, heldAt);
227
+ if (!behindShown)
228
+ return new Set();
229
+ const entries = await local.entries(key, 'confirmed', paths);
230
+ return new Set(entries.flatMap(({ path, written }) => written !== null &&
231
+ reached(locator, written, roomVersion) &&
232
+ !reached(locator, roomVersion, written)
233
+ ? [path]
234
+ : []));
235
+ }
236
+ function remodel(runtime, answers, held) {
237
+ const answer = answers?.collection;
238
+ if (answer === undefined)
239
+ return held;
240
+ return { collection: attachedModel(answer, runtime.roomTypes) };
241
+ }
242
+ function refreshingOf(runtime, local, locator, key, composition, liveness, replaying = false, heldAt) {
243
+ const { store } = runtime;
244
+ const write = replaying ? store.finishingWrite : store.exclusive;
245
+ return {
246
+ turn() {
247
+ if (replaying)
248
+ installing(runtime, locator);
249
+ },
250
+ prior: async (paths) => new Map((await local.entries(key, 'refreshed', paths)).map((entry) => [entry.path, entry])),
251
+ later: (paths, roomVersion) => writtenLater(runtime, local, locator, key, paths, roomVersion, heldAt),
252
+ async stage(page) {
253
+ for (let written = 0;;) {
254
+ const end = batchEnd(page.entries, written, store.stageBytes());
255
+ const last = end === page.entries.length;
256
+ const entries = page.entries.slice(written, end);
257
+ const staged = await write(async () => {
258
+ if (!liveness())
259
+ return false;
260
+ await store.refreshPage(local, key, composition, last
261
+ ? { ...page, entries }
262
+ : { entries, removals: [], folders: [], folderRemovals: [] });
263
+ return true;
264
+ });
265
+ if (!staged)
266
+ return false;
267
+ if (last)
268
+ return true;
269
+ written = end;
270
+ }
271
+ },
272
+ };
273
+ }
274
+ export async function pullRefresh(runtime, authorized, record, liveness, hold, refresh) {
275
+ if (!liveness())
276
+ return unconfirmed;
277
+ const { store, journal } = runtime;
278
+ const from = standingAt(store, record.locator, record);
279
+ const local = await store.open();
280
+ try {
281
+ await store.exclusive(() => local.unrefresh(record.key));
282
+ const result = await advancement(async (authorization, request) => {
283
+ hold.release();
284
+ try {
285
+ return await refresh(authorization, request);
286
+ }
287
+ finally {
288
+ hold.take();
289
+ }
290
+ }, authorized, record, (models, kept) => (liveness() ? remodel(runtime, models, kept) : kept), liveness, refreshingOf(runtime, local, record.locator, record.key, store.composed(record), liveness, false, record.roomVersion));
291
+ if (result.kind !== 'advanced') {
292
+ journal.record(`transfer refresh ${record.locator} ${result.kind}`);
293
+ return result;
294
+ }
295
+ journal.record(`transfer refresh ${record.locator} ${result.record.roomVersion}`);
296
+ return {
297
+ kind: 'advanced',
298
+ record: result.record,
299
+ from,
300
+ remodelled: result.record.model !== record.model,
301
+ };
302
+ }
303
+ catch (error) {
304
+ if (refusedForSpace(error))
305
+ return unconfirmed;
306
+ journal.record(`transfer refresh ${record.locator} transport-uncertainty`);
307
+ throw error;
308
+ }
309
+ }
310
+ async function abandoned(runtime, local, locator) {
311
+ await local.abandon(locator);
312
+ runtime.store.installs.change(locator, (held) => transferGone(setBack(held)));
313
+ recoverReads(runtime);
314
+ sweep(runtime);
315
+ }
316
+ function staging(runtime, local, liveness, unheld) {
317
+ const { store, socket } = runtime;
318
+ const derived = async (locator, key, composition) => {
319
+ store.installs.change(locator, (held) => ({ ...held, underived: 0 }));
320
+ for (;;) {
321
+ if (!liveness())
322
+ return false;
323
+ const done = await store.finishingWrite(async () => liveness() ? store.rederive(local, key, composition) : null);
324
+ if (done === null)
325
+ return false;
326
+ store.installs.change(locator, (held) => built(held, done.done, done.text));
327
+ runtime.store.readiness.queue();
328
+ if (done.done)
329
+ return true;
330
+ }
331
+ };
332
+ return {
333
+ held: (locator) => store.installs.of(locator).transfer,
334
+ async turn(locator, step) {
335
+ installing(runtime, locator);
336
+ return step === 'downloading' ? socket.heldStream() : () => { };
337
+ },
338
+ unqueued: socket.unqueued,
339
+ queued: socket.queued,
340
+ arriving(locator) {
341
+ let ended = false;
342
+ return {
343
+ at(bytes) {
344
+ if (ended)
345
+ return;
346
+ store.installs.change(locator, (held) => ({
347
+ ...held,
348
+ arrived: bytes,
349
+ streaming: true,
350
+ }));
351
+ if (!store.installs.arrivalDue(performance.now(), ARRIVAL_REPORT_MS))
352
+ return;
353
+ runtime.store.readiness.queue();
354
+ },
355
+ end() {
356
+ if (ended)
357
+ return;
358
+ ended = true;
359
+ if (!store.installs.of(locator).streaming)
360
+ return;
361
+ store.installs.change(locator, (held) => ({ ...held, streaming: false }));
362
+ runtime.store.readiness.queue();
363
+ },
364
+ };
365
+ },
366
+ streamed: socket.streamed,
367
+ async stage(record, page, composition) {
368
+ const { locator } = record;
369
+ installing(runtime, locator);
370
+ if (!liveness())
371
+ return null;
372
+ const key = await store.startingWrite(async () => {
373
+ if (!liveness())
374
+ return null;
375
+ return local.stage(record, composition, page);
376
+ });
377
+ if (key === null || !liveness())
378
+ return null;
379
+ const before = store.installs.of(locator);
380
+ const prior = before.transfer?.done.bytes ?? 0;
381
+ const held = { ...record, key };
382
+ const text = page.entries.reduce((sum, entry) => sum + (entry.content?.length ?? 0), 0);
383
+ const owed = text + before.underived;
384
+ store.installs.change(locator, (room) => ({
385
+ ...owedIndexes(room, record.done.bytes - prior, text),
386
+ transfer: held,
387
+ underived: owed,
388
+ }));
389
+ if (before.transfer === null)
390
+ recoverReads(runtime);
391
+ installing(runtime, locator);
392
+ recoverReads(runtime);
393
+ if (owed < store.deriveBytes())
394
+ return held;
395
+ return (await derived(locator, key, composition)) ? held : null;
396
+ },
397
+ async resume(record, parts, composition) {
398
+ const { locator } = record;
399
+ installing(runtime, locator);
400
+ if (!liveness())
401
+ return null;
402
+ const prior = unheld === undefined ? await store.record(locator) : undefined;
403
+ const published = prior !== undefined && prior.replica.selection === record.selection ? prior.key : null;
404
+ const kept = unheld?.staged ?? (await local.held()).staged.has(locator);
405
+ if (published === null && !kept)
406
+ return { record: null, staged: new Set() };
407
+ const resumed = await store.startingWrite(async () => {
408
+ if (!liveness())
409
+ return null;
410
+ return local.resume(record, composition, parts.map((part) => part.id), published);
411
+ });
412
+ if (resumed === null || !liveness())
413
+ return null;
414
+ const parted = new Set(resumed.staged);
415
+ if (resumed.key === null)
416
+ return { record: null, staged: parted };
417
+ const bytes = parts.reduce((sum, part) => sum + (parted.has(part.id) ? part.bytes : 0), 0);
418
+ const held = {
419
+ ...record,
420
+ transfer: resumed.transfer,
421
+ key: resumed.key,
422
+ done: { bytes },
423
+ };
424
+ store.installs.change(locator, (room) => ({ ...room, transfer: held }));
425
+ recoverReads(runtime);
426
+ return { record: held, staged: parted };
427
+ },
428
+ derive: derived,
429
+ async refreshing(locator, key, composition) {
430
+ await store.exclusive(() => local.unrefresh(key));
431
+ return refreshingOf(runtime, local, locator, key, composition, liveness, true);
432
+ },
433
+ abandon: (locator) => store.exclusive(async () => {
434
+ if (liveness())
435
+ await abandoned(runtime, local, locator);
436
+ }),
437
+ setAside: async (locator) => {
438
+ if (!liveness())
439
+ return;
440
+ store.installs.change(locator, (held) => transferGone(setBack(held)));
441
+ recoverReads(runtime);
442
+ },
443
+ release: (key) => store.exclusive(async () => {
444
+ await local.release(key);
445
+ sweep(runtime);
446
+ }),
447
+ };
448
+ }
449
+ export async function pullBootstrap(runtime, authorized, room, local, liveness, prior, from = runtime.socket.reads, unheld) {
450
+ if (!liveness())
451
+ return unconfirmed;
452
+ const { store, journal } = runtime;
453
+ if (prior !== undefined) {
454
+ catching(store, room.locator);
455
+ recoverReads(runtime);
456
+ }
457
+ try {
458
+ const result = await bootstrapRoom(from, authorized, room, {
459
+ collection: prior?.model ?? runtime.socket.rooms.standing(room.locator).unheldModel ?? NO_MODEL,
460
+ }, runtime.builtIn, runtime.typedPaths, (models, held) => (liveness() ? remodel(runtime, models, held) : held), liveness, staging(runtime, local, liveness, unheld));
461
+ const detail = result.kind === 'staged' ? result.record.roomVersion : result.kind;
462
+ journal.record(`transfer bootstrap ${room.locator} ${detail}`);
463
+ if (result.kind === 'staged' &&
464
+ (await older(runtime, room.locator, result.record.roomVersion))) {
465
+ caughtUpTo(runtime, room.locator);
466
+ installed(runtime, room.locator);
467
+ await abandoned(runtime, local, room.locator);
468
+ journal.record(`transfer bootstrap ${room.locator} older than shown`);
469
+ return { kind: 'transport-uncertainty' };
470
+ }
471
+ if (result.kind !== 'staged') {
472
+ caughtUpTo(runtime, room.locator);
473
+ installed(runtime, room.locator);
474
+ }
475
+ return result;
476
+ }
477
+ catch (error) {
478
+ caughtUpTo(runtime, room.locator);
479
+ installed(runtime, room.locator);
480
+ if (refusedForSpace(error))
481
+ return unconfirmed;
482
+ journal.record(`transfer bootstrap ${room.locator} transport-uncertainty`);
483
+ throw error;
484
+ }
485
+ }
486
+ export function publish(runtime, local, room, reached, landing, live) {
487
+ const { store } = runtime;
488
+ const landed = store.exclusive(async () => {
489
+ if (!live()) {
490
+ caughtUpTo(runtime, room.locator);
491
+ return true;
492
+ }
493
+ const work = await store.work(room.locator);
494
+ const prior = work.replica;
495
+ if (!standsAt(store, room.locator, prior?.record, landing.from)) {
496
+ if (landing.kind === 'refreshed') {
497
+ await local.unrefresh(reached.key);
498
+ return false;
499
+ }
500
+ caughtUpTo(runtime, room.locator);
501
+ await abandoned(runtime, local, room.locator);
502
+ return false;
503
+ }
504
+ const record = landing.kind === 'refreshed' && prior !== undefined
505
+ ? {
506
+ ...prior.record,
507
+ roomVersion: reached.roomVersion,
508
+ ...(landing.remodelled ? { model: reached.model } : {}),
509
+ }
510
+ : reached;
511
+ let set;
512
+ try {
513
+ set = await runtime.settle(local, room.locator, work, record, work.queue, landing.kind === 'refreshed'
514
+ ? {
515
+ room: true,
516
+ view: 'refreshed',
517
+ commit: { refreshed: true },
518
+ }
519
+ : {
520
+ room: true,
521
+ view: landing.refreshed ? 'refreshed' : 'confirmed',
522
+ commit: {
523
+ published: { from: prior?.record.key ?? null },
524
+ ...(landing.refreshed ? { refreshed: true } : {}),
525
+ },
526
+ });
527
+ }
528
+ catch (error) {
529
+ if (!refusedForSpace(error))
530
+ throw error;
531
+ caughtUpTo(runtime, room.locator);
532
+ return true;
533
+ }
534
+ if (landing.kind === 'bootstrapped') {
535
+ runtime.socket.rooms.readied(room.locator);
536
+ store.installs.change(room.locator, (held) => ({
537
+ ...transferGone(held),
538
+ highest: null,
539
+ beyondHorizon: false,
540
+ startedOver: null,
541
+ catching: false,
542
+ }));
543
+ runtime.socket.rooms.stand(room.locator, { unheldModel: null });
544
+ if (prior !== undefined && prior.record.key !== record.key)
545
+ sweep(runtime);
546
+ void name(runtime, room.locator);
547
+ }
548
+ usable(runtime, room);
549
+ void runtime.store.changed(set);
550
+ await runtime.unpair(local);
551
+ void statusShown(runtime);
552
+ if (landing.kind === 'bootstrapped' && work.queue.length > 0) {
553
+ runtime.submitLater(room.locator);
554
+ }
555
+ return true;
556
+ });
557
+ return landing.kind === 'refreshed'
558
+ ? landed
559
+ : landed.finally(() => installed(runtime, room.locator));
560
+ }
package/dist/job.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ type Job = {
2
+ readonly label: string;
3
+ readonly kind: 'started' | 'scheduled' | 'ended';
4
+ readonly state: string;
5
+ readonly next: string | null;
6
+ };
7
+ export type RunningJob = {
8
+ readonly name: string;
9
+ readonly running_since: string;
10
+ };
11
+ export type JobMarker = {
12
+ readonly said: string;
13
+ readonly at: string;
14
+ };
15
+ export type OpenJob<At = string | null> = {
16
+ readonly name: string;
17
+ readonly started: At;
18
+ };
19
+ export declare function jobOf(said: string): Job;
20
+ export declare function closeLast(open: {
21
+ readonly key: string;
22
+ }[], key: string): void;
23
+ export declare function markerMoved<Kept extends {
24
+ readonly key: string;
25
+ }>(open: Kept[], said: string, opened: (job: Job, key: string) => Kept | null): void;
26
+ export declare function openJobs<At>(markers: readonly {
27
+ readonly said: string;
28
+ readonly at: At;
29
+ }[]): readonly OpenJob<At>[];
30
+ export declare function jobsRunning(jobs: readonly RunningJob[], now: number): string[];
31
+ export declare function sessionEnded(jobs: readonly RunningJob[], now: number): string;
32
+ export {};
33
+ //# sourceMappingURL=job.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,KAAK,GAAG,GAAG;IACT,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,MAAM,MAAM,OAAO,CAAC,EAAE,GAAG,MAAM,GAAG,IAAI,IAAI;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAA;CAAE,CAAC;AAQ1F,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CASvC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAG7E;AAED,wBAAgB,WAAW,CAAC,IAAI,SAAS;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAC/D,IAAI,EAAE,IAAI,EAAE,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,GAC7C,IAAI,CASN;AAED,wBAAgB,QAAQ,CAAC,EAAE,EACzB,OAAO,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAA;CAAE,EAAE,GAC7D,SAAS,OAAO,CAAC,EAAE,CAAC,EAAE,CAQxB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAM9E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7E"}
package/dist/job.js ADDED
@@ -0,0 +1,54 @@
1
+ const NEXT_RUN = 'next run ';
2
+ const MINUTE = 60_000;
3
+ const ENDED = 'Session ended.';
4
+ export function jobOf(said) {
5
+ const at = said.lastIndexOf(': ');
6
+ const label = at === -1 ? said : said.slice(0, at);
7
+ const state = at === -1 ? '' : said.slice(at + 2);
8
+ if (state === 'running')
9
+ return { label, kind: 'started', state, next: null };
10
+ if (state === 'scheduled')
11
+ return { label, kind: 'scheduled', state, next: null };
12
+ return state.startsWith(NEXT_RUN)
13
+ ? { label, kind: 'scheduled', state, next: state.slice(NEXT_RUN.length) }
14
+ : { label, kind: 'ended', state, next: null };
15
+ }
16
+ export function closeLast(open, key) {
17
+ const at = open.map((one) => one.key).lastIndexOf(key);
18
+ if (at !== -1)
19
+ open.splice(at, 1);
20
+ }
21
+ export function markerMoved(open, said, opened) {
22
+ const job = jobOf(said);
23
+ const started = `job\u0000${job.label}`;
24
+ const schedule = `schedule\u0000${job.label}`;
25
+ if (job.kind === 'ended')
26
+ closeLast(open, started);
27
+ if (job.kind !== 'started')
28
+ closeLast(open, schedule);
29
+ if (job.kind === 'ended')
30
+ return;
31
+ const kept = opened(job, job.kind === 'started' ? started : schedule);
32
+ if (kept !== null)
33
+ open.push(kept);
34
+ }
35
+ export function openJobs(markers) {
36
+ const open = [];
37
+ for (const { said, at } of markers) {
38
+ markerMoved(open, said, (job, key) => job.kind === 'started' ? { key, name: job.label, started: at } : null);
39
+ }
40
+ return open.map(({ name, started }) => ({ name, started }));
41
+ }
42
+ export function jobsRunning(jobs, now) {
43
+ return jobs.map((job) => {
44
+ const since = Date.parse(job.running_since);
45
+ const ran = Number.isNaN(since) ? 0 : Math.floor((now - since) / MINUTE);
46
+ return ran >= 1 ? `${job.name} (${ran} min)` : job.name;
47
+ });
48
+ }
49
+ export function sessionEnded(jobs, now) {
50
+ if (jobs.length === 0)
51
+ return ENDED;
52
+ const counted = jobs.length === 1 ? '1 background job' : `${jobs.length} background jobs`;
53
+ return `${ENDED} ${counted} stopped: ${jobsRunning(jobs, now).join(', ')}`;
54
+ }
@@ -0,0 +1,7 @@
1
+ import type { Runtime } from './runtime.js';
2
+ export declare function scheduleCurrency(runtime: Runtime): void;
3
+ export declare function spaceFreed(runtime: Runtime): void;
4
+ export declare function close({ store, socket, conversations, recovery, liveQueries, figures }: Runtime): void;
5
+ export declare function stop(runtime: Runtime): Promise<void>;
6
+ export declare function start(runtime: Runtime, signal: AbortSignal | undefined): void;
7
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA8M5C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,QAOhD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,QAS1C;AAED,wBAAgB,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,OAAO,QAQ9F;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,iBAS1C;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,QAwCtE"}