@agentshouse/mdruntime 0.1.0-cba6f2439bb25 → 0.1.0-cbb9cd3aced1a

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 (338) 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 +163 -109
  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 +12 -11
  20. package/dist/bootstrap.d.ts.map +1 -1
  21. package/dist/bootstrap.js +213 -89
  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 +34 -23
  37. package/dist/client.d.ts.map +1 -1
  38. package/dist/client.js +44 -56
  39. package/dist/collection.d.ts +26 -7
  40. package/dist/collection.d.ts.map +1 -1
  41. package/dist/collection.js +20 -19
  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 +287 -335
  48. package/dist/connection.d.ts +5 -143
  49. package/dist/connection.d.ts.map +1 -1
  50. package/dist/connection.js +112 -5257
  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 +1002 -925
  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 -1
  73. package/dist/durability.d.ts.map +1 -1
  74. package/dist/durability.js +7 -0
  75. package/dist/entry.d.ts +7 -2
  76. package/dist/entry.d.ts.map +1 -1
  77. package/dist/entry.js +38 -17
  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 +8 -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 -8
  94. package/dist/host.d.ts.map +1 -1
  95. package/dist/host.js +88 -44
  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 +38 -14
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +18 -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 +119 -31
  126. package/dist/memory.d.ts +19 -6
  127. package/dist/memory.d.ts.map +1 -1
  128. package/dist/memory.js +255 -104
  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/modal.d.ts +2 -0
  133. package/dist/modal.d.ts.map +1 -0
  134. package/dist/modal.js +11 -0
  135. package/dist/model.d.ts +2 -11
  136. package/dist/model.d.ts.map +1 -1
  137. package/dist/model.js +0 -23
  138. package/dist/models.d.ts +10 -0
  139. package/dist/models.d.ts.map +1 -0
  140. package/dist/models.js +153 -0
  141. package/dist/observation.d.ts +28 -13
  142. package/dist/observation.d.ts.map +1 -1
  143. package/dist/observation.js +185 -81
  144. package/dist/opened.d.ts +1 -1
  145. package/dist/opened.d.ts.map +1 -1
  146. package/dist/opened.js +5 -5
  147. package/dist/opening.d.ts +4 -0
  148. package/dist/opening.d.ts.map +1 -0
  149. package/dist/opening.js +53 -0
  150. package/dist/outcome.d.ts +17 -5
  151. package/dist/outcome.d.ts.map +1 -1
  152. package/dist/outcome.js +35 -2
  153. package/dist/overlay.d.ts +7 -2
  154. package/dist/overlay.d.ts.map +1 -1
  155. package/dist/overlay.js +48 -24
  156. package/dist/page-metadata.d.ts +8 -0
  157. package/dist/page-metadata.d.ts.map +1 -0
  158. package/dist/page-metadata.js +19 -0
  159. package/dist/parts.d.ts +4 -0
  160. package/dist/parts.d.ts.map +1 -0
  161. package/dist/parts.js +13 -0
  162. package/dist/paths.d.ts +1 -0
  163. package/dist/paths.d.ts.map +1 -1
  164. package/dist/paths.js +22 -0
  165. package/dist/preparation.d.ts +41 -0
  166. package/dist/preparation.d.ts.map +1 -0
  167. package/dist/preparation.js +314 -0
  168. package/dist/presence.d.ts +58 -0
  169. package/dist/presence.d.ts.map +1 -0
  170. package/dist/presence.js +231 -0
  171. package/dist/queries.d.ts +16 -0
  172. package/dist/queries.d.ts.map +1 -0
  173. package/dist/queries.js +308 -0
  174. package/dist/query.d.ts +14 -210
  175. package/dist/query.d.ts.map +1 -1
  176. package/dist/query.js +3 -505
  177. package/dist/questions.d.ts +30 -0
  178. package/dist/questions.d.ts.map +1 -0
  179. package/dist/questions.js +116 -0
  180. package/dist/queue.d.ts +40 -0
  181. package/dist/queue.d.ts.map +1 -0
  182. package/dist/queue.js +480 -0
  183. package/dist/reach.d.ts +16 -15
  184. package/dist/reach.d.ts.map +1 -1
  185. package/dist/reach.js +258 -149
  186. package/dist/react.d.ts +21 -3
  187. package/dist/react.d.ts.map +1 -1
  188. package/dist/react.js +33 -1
  189. package/dist/read.d.ts +7 -0
  190. package/dist/read.d.ts.map +1 -0
  191. package/dist/read.js +17 -0
  192. package/dist/readiness.d.ts +11 -19
  193. package/dist/readiness.d.ts.map +1 -1
  194. package/dist/readiness.js +7 -15
  195. package/dist/reads.d.ts +38 -10
  196. package/dist/reads.d.ts.map +1 -1
  197. package/dist/reads.js +164 -77
  198. package/dist/recovery.d.ts +3 -0
  199. package/dist/recovery.d.ts.map +1 -1
  200. package/dist/recovery.js +57 -1
  201. package/dist/refresh.d.ts +7 -5
  202. package/dist/refresh.d.ts.map +1 -1
  203. package/dist/refresh.js +35 -7
  204. package/dist/refusal.d.ts +5 -0
  205. package/dist/refusal.d.ts.map +1 -0
  206. package/dist/refusal.js +55 -0
  207. package/dist/replica.d.ts +11 -17
  208. package/dist/replica.d.ts.map +1 -1
  209. package/dist/replica.js +66 -36
  210. package/dist/retried.d.ts +30 -0
  211. package/dist/retried.d.ts.map +1 -0
  212. package/dist/retried.js +72 -0
  213. package/dist/room-draft.d.ts +34 -10
  214. package/dist/room-draft.d.ts.map +1 -1
  215. package/dist/room-draft.js +331 -111
  216. package/dist/room-drafts.d.ts +24 -0
  217. package/dist/room-drafts.d.ts.map +1 -0
  218. package/dist/room-drafts.js +220 -0
  219. package/dist/room-list.d.ts +10 -0
  220. package/dist/room-list.d.ts.map +1 -0
  221. package/dist/room-list.js +45 -0
  222. package/dist/rows.d.ts +16 -22
  223. package/dist/rows.d.ts.map +1 -1
  224. package/dist/rows.js +49 -186
  225. package/dist/runtime.d.ts +34 -0
  226. package/dist/runtime.d.ts.map +1 -0
  227. package/dist/runtime.js +1 -0
  228. package/dist/save.d.ts +42 -86
  229. package/dist/save.d.ts.map +1 -1
  230. package/dist/save.js +332 -228
  231. package/dist/saves.d.ts +34 -0
  232. package/dist/saves.d.ts.map +1 -0
  233. package/dist/saves.js +437 -0
  234. package/dist/search.d.ts +12 -63
  235. package/dist/search.d.ts.map +1 -1
  236. package/dist/search.js +9 -52
  237. package/dist/seed.d.ts +11 -2
  238. package/dist/seed.d.ts.map +1 -1
  239. package/dist/seed.js +71 -1
  240. package/dist/shared.d.ts +1 -7
  241. package/dist/shared.d.ts.map +1 -1
  242. package/dist/shared.js +13 -105
  243. package/dist/shown.d.ts +35 -0
  244. package/dist/shown.d.ts.map +1 -0
  245. package/dist/shown.js +313 -0
  246. package/dist/socket/admission.d.ts +7 -0
  247. package/dist/socket/admission.d.ts.map +1 -0
  248. package/dist/socket/admission.js +39 -0
  249. package/dist/socket/answers.d.ts +6 -0
  250. package/dist/socket/answers.d.ts.map +1 -0
  251. package/dist/socket/answers.js +20 -0
  252. package/dist/socket/lanes.d.ts +28 -0
  253. package/dist/socket/lanes.d.ts.map +1 -0
  254. package/dist/socket/lanes.js +103 -0
  255. package/dist/socket/reads.d.ts +10 -0
  256. package/dist/socket/reads.d.ts.map +1 -0
  257. package/dist/socket/reads.js +31 -0
  258. package/dist/socket/session.d.ts +38 -0
  259. package/dist/socket/session.d.ts.map +1 -0
  260. package/dist/socket/session.js +23 -0
  261. package/dist/socket.d.ts +67 -0
  262. package/dist/socket.d.ts.map +1 -0
  263. package/dist/socket.js +164 -0
  264. package/dist/source.d.ts +59 -0
  265. package/dist/source.d.ts.map +1 -0
  266. package/dist/source.js +93 -0
  267. package/dist/status.d.ts +0 -6
  268. package/dist/status.d.ts.map +1 -1
  269. package/dist/status.js +0 -6
  270. package/dist/store/installs.d.ts +30 -0
  271. package/dist/store/installs.d.ts.map +1 -0
  272. package/dist/store/installs.js +40 -0
  273. package/dist/store/readiness.d.ts +11 -0
  274. package/dist/store/readiness.d.ts.map +1 -0
  275. package/dist/store/readiness.js +68 -0
  276. package/dist/store/records.d.ts +224 -0
  277. package/dist/store/records.d.ts.map +1 -0
  278. package/dist/store/records.js +466 -0
  279. package/dist/store/room-held.d.ts +8 -0
  280. package/dist/store/room-held.d.ts.map +1 -0
  281. package/dist/store/room-held.js +17 -0
  282. package/dist/store/rooms-shown.d.ts +8 -0
  283. package/dist/store/rooms-shown.d.ts.map +1 -0
  284. package/dist/store/rooms-shown.js +13 -0
  285. package/dist/store/space.d.ts +11 -0
  286. package/dist/store/space.d.ts.map +1 -0
  287. package/dist/store/space.js +41 -0
  288. package/dist/store/watchers.d.ts +17 -0
  289. package/dist/store/watchers.d.ts.map +1 -0
  290. package/dist/store/watchers.js +56 -0
  291. package/dist/store/writes.d.ts +24 -0
  292. package/dist/store/writes.d.ts.map +1 -0
  293. package/dist/store/writes.js +125 -0
  294. package/dist/store.d.ts +115 -156
  295. package/dist/store.d.ts.map +1 -1
  296. package/dist/store.js +171 -394
  297. package/dist/stored.d.ts +72 -40
  298. package/dist/stored.d.ts.map +1 -1
  299. package/dist/stored.js +344 -212
  300. package/dist/surface.d.ts +92 -0
  301. package/dist/surface.d.ts.map +1 -0
  302. package/dist/surface.js +251 -0
  303. package/dist/sync.d.ts +19 -0
  304. package/dist/sync.d.ts.map +1 -0
  305. package/dist/sync.js +538 -0
  306. package/dist/tables.d.ts +118 -94
  307. package/dist/tables.d.ts.map +1 -1
  308. package/dist/tables.js +199 -321
  309. package/dist/tallies.d.ts +18 -0
  310. package/dist/tallies.d.ts.map +1 -0
  311. package/dist/tallies.js +128 -0
  312. package/dist/transfer.d.ts +0 -5
  313. package/dist/transfer.d.ts.map +1 -1
  314. package/dist/validation.d.ts +3 -4
  315. package/dist/validation.d.ts.map +1 -1
  316. package/dist/validation.js +42 -106
  317. package/dist/windows.d.ts +1 -12
  318. package/dist/windows.d.ts.map +1 -1
  319. package/dist/windows.js +2 -75
  320. package/dist/wire.d.ts +72 -9
  321. package/dist/wire.d.ts.map +1 -1
  322. package/dist/wire.js +26 -5
  323. package/package.json +3 -2
  324. package/dist/attempt.d.ts +0 -16
  325. package/dist/attempt.d.ts.map +0 -1
  326. package/dist/attempt.js +0 -70
  327. package/dist/fence.d.ts +0 -6
  328. package/dist/fence.d.ts.map +0 -1
  329. package/dist/fence.js +0 -10
  330. package/dist/fulltext.d.ts +0 -27
  331. package/dist/fulltext.d.ts.map +0 -1
  332. package/dist/fulltext.js +0 -370
  333. package/dist/log.d.ts +0 -5
  334. package/dist/log.d.ts.map +0 -1
  335. package/dist/log.js +0 -14
  336. package/dist/words.d.ts +0 -19
  337. package/dist/words.d.ts.map +0 -1
  338. package/dist/words.js +0 -156
package/dist/host.js CHANGED
@@ -1,7 +1,10 @@
1
- import { composeRuntime, } from './connection.js';
2
- import { queryKey } from './query.js';
1
+ import { queryKey } from '@agentshouse/mdmodel';
2
+ import { composeRuntime } from './connection.js';
3
+ import { untilAnswered } from './recovery.js';
3
4
  import { described } from './failure.js';
4
- import { AUTHORIZATION_ENDED, request, WIRE, } from './wire.js';
5
+ import { observed } from './observation.js';
6
+ import { answeredResult } from './outcome.js';
7
+ import { AUTHORIZATION_ENDED, WIRE, wireRequest, } from './wire.js';
5
8
  const NARROWED = new Set(['within', 'whole']);
6
9
  function answered(md, app, writtenBy, member, input) {
7
10
  switch (member) {
@@ -33,12 +36,20 @@ function answered(md, app, writtenBy, member, input) {
33
36
  return md.binaryFile.part(input[0], input[1]);
34
37
  case 'call':
35
38
  return md.call(input[0], input[1]);
39
+ case 'answered':
40
+ return md.answered(input[0]);
36
41
  case 'reached':
37
42
  return md.reached(input[0], input[1], input[2]);
38
- case 'log':
39
- return md.log();
40
43
  case 'cleanUp':
41
44
  return md.cleanUp();
45
+ case 'unsent':
46
+ return md.unsent();
47
+ case 'sent':
48
+ return md.sent();
49
+ case 'reset':
50
+ return md.reset();
51
+ case 'readAgain':
52
+ return md.readAgain();
42
53
  case 'persistence':
43
54
  return md.persistence();
44
55
  case 'retry':
@@ -68,19 +79,39 @@ function answered(md, app, writtenBy, member, input) {
68
79
  case 'conversation.send':
69
80
  return md.conversation.send(input[0], input[1], input[2]);
70
81
  case 'conversation.answer':
71
- return md.conversation.answer(input[0], input[1]);
82
+ return md.conversation.answer(input[0], input[1], input[2]);
72
83
  case 'conversation.interrupt':
73
- return md.conversation.interrupt(input[0]);
84
+ return md.conversation.interrupt(input[0], input[1]);
74
85
  case 'conversation.kill':
75
- return md.conversation.kill(input[0]);
76
- case 'conversation.cancel':
77
- return md.conversation.cancel(input[0], input[1]);
86
+ return md.conversation.kill(input[0], input[1]);
78
87
  case 'conversation.delete':
79
- return md.conversation.delete(input[0]);
88
+ return md.conversation.delete(input[0], input[1]);
89
+ case 'conversation.takeOut':
90
+ return md.conversation.takeOut(input[0], input[1], input[2]);
91
+ case 'conversation.decide':
92
+ return md.conversation.decide(input[0], input[1], input[2]);
93
+ case 'conversation.rename':
94
+ return md.conversation.rename(input[0], input[1], input[2]);
95
+ case 'conversation.option':
96
+ return md.conversation.option(input[0], input[1], input[2], input[3]);
97
+ case 'conversation.retry':
98
+ return md.conversation.retry(input[0], input[1], input[2]);
99
+ case 'conversation.pin':
100
+ return md.conversation.pin(input[0]);
101
+ case 'conversation.openTurn':
102
+ return md.conversation.openTurn(input[0], input[1]);
103
+ case 'conversation.dismissSuggestion':
104
+ return md.conversation.dismissSuggestion(input[0], input[1]);
105
+ case 'conversation.attach':
106
+ return md.conversation.attach(input[0]);
107
+ case 'conversation.attachment':
108
+ return md.conversation.attachment(input[0]);
80
109
  case 'chatDraft.write':
81
110
  return md.chatDraft.write(input[0], input[1], input[2]);
82
111
  case 'chatDraft.prepend':
83
112
  return md.chatDraft.prepend(input[0], input[1]);
113
+ case 'chatDraft.append':
114
+ return md.chatDraft.append(input[0], input[1]);
84
115
  case 'chatDraft.discard':
85
116
  return md.chatDraft.discard(input[0]);
86
117
  }
@@ -93,13 +124,10 @@ function attempted(work) {
93
124
  return Promise.reject(error);
94
125
  }
95
126
  }
96
- function answeredResult(value) {
97
- return typeof value === 'object' && value !== null && !('pending' in value);
98
- }
99
127
  function answeredMessage(value) {
100
128
  if (typeof value !== 'object' || value === null)
101
129
  return false;
102
- return !('result' in value) || answeredResult(value.result);
130
+ return 'result' in value ? answeredResult(value.result) : !('pending' in value);
103
131
  }
104
132
  export function serveMdRuntime(options) {
105
133
  const deploymentFacts = structuredClone(options.deploymentFacts);
@@ -114,16 +142,18 @@ export function serveMdRuntime(options) {
114
142
  const { md } = runtime;
115
143
  const attachments = new Map();
116
144
  let authorized = true;
145
+ let opening = null;
146
+ const opened = () => (opening ??= untilAnswered(() => md.loaded(), closing.signal, () => true, options.recovery));
117
147
  const watchFacts = (deliver) => {
118
148
  deliver(structuredClone(deploymentFacts));
119
149
  return () => { };
120
150
  };
121
- function attach(port, app, release, reach, code = 'stored', search = 'unused') {
151
+ function attach(port, options) {
122
152
  if (!authorized)
123
153
  throw new Error(AUTHORIZATION_ENDED);
154
+ const { app, release, reach, admission, code = 'stored' } = options;
124
155
  const writtenBy = release === undefined ? undefined : { app, release };
125
- let facts = { target: app, code, space: null, search };
126
- const view = runtime.within(reach ?? null, facts);
156
+ const view = runtime.within(reach ?? null, { target: app, code });
127
157
  const observations = new Map();
128
158
  const followed = new Set();
129
159
  const answeredKeys = new Set();
@@ -161,9 +191,16 @@ export function serveMdRuntime(options) {
161
191
  if (topic === 'query' && answeredMessage(value))
162
192
  answeredQuery(input[0]);
163
193
  };
194
+ const fail = (error) => {
195
+ if (!serving || resolved)
196
+ return;
197
+ observations.get(id)?.();
198
+ observations.delete(id);
199
+ send({ kind: 'failure', id, ...described(error) });
200
+ };
164
201
  observations.set(id, topic === 'deployment-facts'
165
202
  ? watchFacts(deliver)
166
- : (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
203
+ : (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver, fail));
167
204
  };
168
205
  const reply = async (id, query, pending) => {
169
206
  try {
@@ -179,6 +216,15 @@ export function serveMdRuntime(options) {
179
216
  send({ kind: 'failure', id, ...described(error) });
180
217
  }
181
218
  };
219
+ const admitted = admission === undefined
220
+ ? view.md
221
+ : {
222
+ ...view.md,
223
+ async call(name, input) {
224
+ const decided = await admission(name, input);
225
+ return 'refused' in decided ? decided.refused : view.md.call(name, decided.admitted);
226
+ },
227
+ };
182
228
  const serve = async (message) => {
183
229
  if (message.kind === 'hello')
184
230
  return;
@@ -188,8 +234,10 @@ export function serveMdRuntime(options) {
188
234
  return;
189
235
  }
190
236
  try {
191
- if (message.kind !== 'observe' || message.topic !== 'room-drafts')
237
+ if (message.kind !== 'observe')
192
238
  await md.loaded();
239
+ else if (message.topic !== 'room-drafts')
240
+ await opened();
193
241
  if (message.kind === 'observe') {
194
242
  if (serving)
195
243
  observe(message.id, message.topic, message.input);
@@ -202,13 +250,13 @@ export function serveMdRuntime(options) {
202
250
  return;
203
251
  }
204
252
  const { id, member, input } = message;
205
- const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ? view.md : md, app, writtenBy, member, input));
253
+ const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ? admitted : md, app, writtenBy, member, input));
206
254
  return reply(id, member === 'query' ? input[0] : undefined, pending);
207
255
  };
208
256
  port.addEventListener('message', (event) => {
209
257
  if (!serving)
210
258
  return;
211
- const message = request(event.data);
259
+ const message = wireRequest(event.data);
212
260
  if (message === null)
213
261
  return;
214
262
  void serve(message);
@@ -222,18 +270,6 @@ export function serveMdRuntime(options) {
222
270
  if (serving)
223
271
  view.narrow(next);
224
272
  },
225
- code(next, space) {
226
- if (!serving)
227
- return;
228
- facts = { ...facts, code: next, space };
229
- view.facts(facts);
230
- },
231
- search(next) {
232
- if (!serving)
233
- return;
234
- facts = { ...facts, search: next };
235
- view.facts(facts);
236
- },
237
273
  answered(queries, done) {
238
274
  const keys = queries.map(queryKey);
239
275
  if (keys.every((key) => answeredKeys.has(key)))
@@ -244,10 +280,18 @@ export function serveMdRuntime(options) {
244
280
  readiness(deliver) {
245
281
  if (!serving)
246
282
  return () => { };
247
- const stop = view.watch('readiness', [], (value) => {
248
- if (serving)
249
- deliver(value);
250
- });
283
+ let shown = null;
284
+ const stop = view.watch('readiness', [], (message) => {
285
+ if (!serving)
286
+ return;
287
+ if (shown !== null) {
288
+ shown.receive(message);
289
+ return;
290
+ }
291
+ shown = observed(message, () => { }, 'readiness');
292
+ shown.observation.subscribe((value) => deliver(value));
293
+ deliver(shown.observation.current());
294
+ }, () => { });
251
295
  const end = () => {
252
296
  followed.delete(end);
253
297
  stop();
@@ -259,15 +303,15 @@ export function serveMdRuntime(options) {
259
303
  }
260
304
  return {
261
305
  attach,
306
+ present(app, members) {
307
+ return md.presentation.edit(app, members);
308
+ },
262
309
  seed(entry) {
263
310
  runtime.seed(entry);
264
311
  },
265
312
  persisted(answer) {
266
313
  runtime.persisted(answer);
267
314
  },
268
- shown(onScreen) {
269
- runtime.shown(onScreen);
270
- },
271
315
  async endAuthorization(holder) {
272
316
  authorized = false;
273
317
  for (const [detach, send] of [...attachments]) {
@@ -279,9 +323,6 @@ export function serveMdRuntime(options) {
279
323
  await options.shell.dropGeneration();
280
324
  }
281
325
  },
282
- lose(locators) {
283
- return runtime.lose(locators);
284
- },
285
326
  stop() {
286
327
  return runtime.stop();
287
328
  },
@@ -289,3 +330,6 @@ export function serveMdRuntime(options) {
289
330
  }
290
331
  export { entrySeedOf } from './seed.js';
291
332
  export { createRecovery, retryDelay, } from './recovery.js';
333
+ export { replaces } from './observation.js';
334
+ export { undeclared } from './outcome.js';
335
+ export { wireAnswer, wireRequest, } from './wire.js';
@@ -1,5 +1,4 @@
1
1
  export declare function changeBatchIdentity(at?: number): string;
2
- export declare function identityTime(identity: string): number;
3
2
  export declare function roomDraftRevision(): string;
4
3
  export declare function chatDraftRevision(): string;
5
4
  export declare function transferIdentity(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
package/dist/identity.js CHANGED
@@ -10,9 +10,6 @@ export function changeBatchIdentity(at = Date.now()) {
10
10
  const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
11
11
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
12
12
  }
13
- export function identityTime(identity) {
14
- return Number.parseInt(identity.replaceAll('-', '').slice(0, 12), 16);
15
- }
16
13
  function randomIdentity() {
17
14
  const bytes = new Uint8Array(16);
18
15
  crypto.getRandomValues(bytes);
package/dist/index.d.ts CHANGED
@@ -1,27 +1,51 @@
1
- export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, DiscoveryScope, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldContent, HeldFile, HeldRevisions, HeldRoom, KeptReceipt, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, StreamReceipts, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
1
+ export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, AuthorityChange, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, SavedFacts, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, BootstrapPart, NotReady, HeldRoom, KeyedRequest, AgentEnvironment, ListedAgent, ListedConversation, ListedOwner, ListedSpaceRef, RoomList, RoomListEntry, SpaceListEntry, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomChange, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, SearchAnswer, SearchAsk, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnOperation, TypedPath, TypedSelection, } from './adapter.js';
2
2
  export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
3
- export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
4
- export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult, } from './connection.js';
3
+ export { heldFacts } from './conversation-row.js';
4
+ export type { ConversationAsk, ConversationHeld, ConversationLast, ConversationStart, } from './conversation-row.js';
5
+ export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationState, ConversationSurface, ConversationView, RequestDecision, RunningTurn, } from './conversation.js';
6
+ export type { MdRuntimeOptions } from './connection.js';
7
+ export { PAGE_METADATA_WORDS } from './page-metadata.js';
8
+ export { writeRule, type WriteRefusal } from './declaration.js';
9
+ export type { HistoryQuery } from './actions.js';
10
+ export type { AppRoom, AppTypedSelection } from './listing.js';
11
+ export type { ConnectionRefusal, ConnectionRefusalCode } from './socket.js';
12
+ export type { MdRuntime, RoomSchemas } from './surface.js';
13
+ export type { BinaryFileSurface, SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
5
14
  export type { Observation } from './observation.js';
6
- export type { AttachAnswer, BinaryAnswer, BinaryLinkAnswer, CallResult, DownloadAnswer, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
15
+ export type { DayFigures, Figures, FiguresResult, RoomFigures } from './figures.js';
16
+ export type { HeldApp, Holdings, RoomDocuments } from './holdings.js';
17
+ export type { PresentationSurface, RoomDraftSurface } from './room-drafts.js';
18
+ export type { AttachAnswer, BinaryAnswer, BinaryLinkAnswer, CallResult, ConversationAttachAnswer, DownloadAnswer, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
19
+ export { blobOf, declaredType } from './outcome.js';
7
20
  export type { BinaryFileRecord } from './binary.js';
8
21
  export type { RuntimeError } from './failure.js';
9
- export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
22
+ export { refusalError } from './failure.js';
23
+ export type { ChangedPart, FieldValue, Marks, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
10
24
  export type { SaveRefusal } from './save.js';
11
- export type { DocumentHit, DocumentPart, MessageHit, MessagePart, SearchCoverage, SearchHits, SearchPending, SearchRequest, SearchResult, SearchUndeclared, Snippet, } from './search.js';
25
+ export type { SearchFound, SearchHit, SearchRequest, SearchResult } from './search.js';
26
+ export { keptFile, keptLines } from './chat-types.js';
27
+ export { FIGURES_DAY_MS } from './figures.js';
12
28
  export { departure } from './change.js';
13
- export { partsAfter, partsChanges } from './room-draft.js';
29
+ export { definitionsIn, selected } from './collection.js';
30
+ export { lineEnded, partsAfter, partsChanges } from './room-draft.js';
14
31
  export { cutName, nameFrom, transliterated } from './name.js';
15
- export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
32
+ export { HISTORY_CONVERSATIONS } from './conversation.js';
33
+ export { contextFigure } from './context.js';
16
34
  export { changeBatchIdentity } from './identity.js';
17
35
  export { paced, ROW_WEIGHT, stepped } from './turn.js';
18
- export { entriesIn, patching, sortedKeys } from './shared.js';
19
- export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
20
- export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
21
- export type { RuntimeShell } from './durability.js';
22
- export type { CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Installation, InstallationAmount, InstallationPause, InstallationStep, Persistence, Readiness, ReadinessStatus, RefusedRoom, RoomCoverage, RoomPreparation, SearchObligation, Space, TargetCoverage, } from './readiness.js';
36
+ export { authoredAt, covered } from './paths.js';
37
+ export { untilAnswered } from './recovery.js';
38
+ export { createRetries, STEPS, retrying, Unanswered, uncertainError, type RetriedFailure, type Retries, type Step, } from './retried.js';
39
+ export { patching } from './shared.js';
40
+ export { acting, type Acting, type ActingRules, type Ended, type Lane, type LaneShown, type Send, } from './act-lanes.js';
41
+ export { expectation, expecting, type Descriptor, type Expectation, type Expected, type Expecting, } from './expectation.js';
42
+ export type { AppCode, HeldCode, RuntimeShell, UnsentKind, UnsentWork } from './durability.js';
43
+ export { leftToSend } from './durability.js';
44
+ export type { CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Installation, InstallationAmount, InstallationStep, Persistence, Readiness, ReadinessStatus, RoomCoverage, RoomPreparation, Space, TargetCoverage, } from './readiness.js';
45
+ export type { ObservedRead } from './reads.js';
23
46
  export type { AttentionEntry, SyncStatus } from './status.js';
24
- export type { Awaits, Backlink, CoveredRoom, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, PendingResult, PendingRoom, Predicate, QueryCoverage, QueryDocument, QueryGroup, QueryResult, QueryRows, Related, Select, Value, Where, } from './query.js';
47
+ export type { Direction, DocumentQuery, Filter, GroupKey, GroupOrder, GroupQuery, GroupSelect, Key, LocalQuery, OrderOptions, Predicate, Related, Select, Value, Where, } from '@agentshouse/mdmodel';
48
+ export type { Awaits, Backlink, CoveredRoom, DocumentResult, GroupResult, GroupTotal, PendingResult, PendingRoom, QueryCoverage, QueryDocument, QueryGroup, QueryResult, QueryRows, } from './query.js';
25
49
  export type { MdType, ModelIdentity, ModelSnapshot, ModelState, ModelResult, TypesResult, ValidationReceipt, } from './model.js';
26
50
  export type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';
27
51
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,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,EACjB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,eAAe,EACf,WAAW,EACX,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,KAAK,EACL,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,UAAU,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAA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gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,eAAe,EACf,YAAY,EACZ,eAAe,EACf,KAAK,EACL,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,SAAS,EACT,aAAa,EACb,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,22 @@
1
+ export { heldFacts } from './conversation-row.js';
2
+ export { PAGE_METADATA_WORDS } from './page-metadata.js';
3
+ export { writeRule } from './declaration.js';
4
+ export { blobOf, declaredType } from './outcome.js';
5
+ export { refusalError } from './failure.js';
6
+ export { keptFile, keptLines } from './chat-types.js';
7
+ export { FIGURES_DAY_MS } from './figures.js';
1
8
  export { departure } from './change.js';
2
- export { partsAfter, partsChanges } from './room-draft.js';
9
+ export { definitionsIn, selected } from './collection.js';
10
+ export { lineEnded, partsAfter, partsChanges } from './room-draft.js';
3
11
  export { cutName, nameFrom, transliterated } from './name.js';
4
- export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
12
+ export { HISTORY_CONVERSATIONS } from './conversation.js';
13
+ export { contextFigure } from './context.js';
5
14
  export { changeBatchIdentity } from './identity.js';
6
15
  export { paced, ROW_WEIGHT, stepped } from './turn.js';
7
- export { entriesIn, patching, sortedKeys } from './shared.js';
8
- export { attempts, identities, intentOf, } from './attempt.js';
9
- export { expectedList, expecting } from './expectation.js';
16
+ export { authoredAt, covered } from './paths.js';
17
+ export { untilAnswered } from './recovery.js';
18
+ export { createRetries, STEPS, retrying, Unanswered, uncertainError, } from './retried.js';
19
+ export { patching } from './shared.js';
20
+ export { acting, } from './act-lanes.js';
21
+ export { expectation, expecting, } from './expectation.js';
22
+ export { leftToSend } from './durability.js';
@@ -0,0 +1,60 @@
1
+ import type { AdapterFailure, Authorization, DiscoveredRoom, NotReady, RetryableRefusal } from './adapter.js';
2
+ import { type Reads } from './bootstrap.js';
3
+ import type { Installation, InstallationAmount, RoomCoverage } from './readiness.js';
4
+ import { advancement, type Refresher } from './refresh.js';
5
+ import type { ReplicaRecord } from './replica.js';
6
+ import type { Runtime } from './runtime.js';
7
+ import type { Live } from './socket.js';
8
+ import { type CoveredRoom, type InstallHold, type RuntimeStore, type Store } from './store.js';
9
+ import { type Unconfirmed } from './transfer.js';
10
+ type Standing = {
11
+ readonly key: number | null;
12
+ readonly confirmed: number;
13
+ };
14
+ export type Unheld = {
15
+ readonly staged: boolean;
16
+ };
17
+ export type Withheld = AdapterFailure | RetryableRefusal | NotReady | Unconfirmed;
18
+ type Landing = {
19
+ readonly kind: 'refreshed';
20
+ readonly from: Standing;
21
+ readonly remodelled: boolean;
22
+ } | {
23
+ readonly kind: 'bootstrapped';
24
+ readonly refreshed: boolean;
25
+ readonly from: Standing;
26
+ };
27
+ type Refreshed = {
28
+ kind: 'advanced';
29
+ record: ReplicaRecord;
30
+ from: Standing;
31
+ remodelled: boolean;
32
+ } | Exclude<Awaited<ReturnType<typeof advancement>>, {
33
+ kind: 'advanced';
34
+ }>;
35
+ export declare const ERASE_BATCH = 512;
36
+ export type InstallShare = {
37
+ readonly installing: boolean;
38
+ readonly downloading: boolean;
39
+ readonly bytes: InstallationAmount;
40
+ };
41
+ export declare function installShare(store: Store, { room, state }: RoomCoverage, held: ReadonlyMap<string, CoveredRoom>): InstallShare;
42
+ export declare function installationOf(installing: number, downloading: number, bytes: InstallationAmount): Installation;
43
+ export declare function roomInFlight(store: Store, locator: string): boolean;
44
+ export declare function sweep({ store, socket }: Runtime): void;
45
+ export declare function caughtUpTo(runtime: Runtime, locator: string): void;
46
+ export declare function catching(store: Store, locator: string): void;
47
+ export declare function standingAt(store: Store, locator: string, held: Pick<ReplicaRecord, 'key'> | undefined): Standing;
48
+ export declare function showing(system: Runtime, locator: string, roomVersion: string, held: string | undefined): void;
49
+ export declare function olderThan(system: Runtime, locator: string, roomVersion: string, held: string | undefined): boolean;
50
+ export declare function replaced(store: Store, locators: readonly string[]): void;
51
+ export declare function reachedBy({ store, socket }: Runtime, locator: string, roomVersion: string): Promise<boolean>;
52
+ export declare function behind({ store, socket }: Runtime, room: DiscoveredRoom): Promise<boolean>;
53
+ export declare function writtenAfter({ store, socket }: Runtime, locator: string, roomVersion: string, path: string): Promise<boolean>;
54
+ export declare function pullRefresh(runtime: Runtime, authorized: Authorization, record: ReplicaRecord, liveness: Live, hold: InstallHold, refresh: Refresher): Promise<Refreshed>;
55
+ export declare function pullBootstrap(runtime: Runtime, authorized: Authorization, room: DiscoveredRoom, local: RuntimeStore, liveness: Live, prior: ReplicaRecord | undefined, from?: Reads, unheld?: Unheld): Promise<import("./bootstrap.js").Bootstrapped | NotReady | import("./adapter.js").RevokedAuthorization | import("./adapter.js").RoomNotReadable | import("./adapter.js").TransportUncertainty | Unconfirmed | {
56
+ readonly kind: 'transport-uncertainty';
57
+ } | RetryableRefusal | import("./adapter.js").ScopedRefusal>;
58
+ export declare function publish(runtime: Runtime, local: RuntimeStore, room: DiscoveredRoom, reached: ReplicaRecord, landing: Landing, live: Live): Promise<boolean>;
59
+ export {};
60
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,QAAQ,EACR,gBAAgB,EAEjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAkC,KAAK,KAAK,EAAgB,MAAM,gBAAgB,CAAC;AAO1F,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAElB,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAmB,MAAM,cAAc,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,WAAW,EAEhB,KAAK,YAAY,EACjB,KAAK,KAAK,EAGX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAG9D,KAAK,QAAQ,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5E,MAAM,MAAM,MAAM,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAElD,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,gBAAgB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAElF,KAAK,OAAO,GACR;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ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