@agentshouse/mdruntime 0.1.0-ca1eff92bbe73 → 0.1.0-ca2c50e56e0b8

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 (358) hide show
  1. package/README.md +29 -14
  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 +321 -0
  11. package/dist/adapter.d.ts +291 -92
  12. package/dist/adapter.d.ts.map +1 -1
  13. package/dist/attached-model.d.ts +6 -10
  14. package/dist/attached-model.d.ts.map +1 -1
  15. package/dist/attached-model.js +35 -41
  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/binary.d.ts +22 -0
  20. package/dist/binary.d.ts.map +1 -0
  21. package/dist/binary.js +15 -0
  22. package/dist/bootstrap.d.ts +37 -5
  23. package/dist/bootstrap.d.ts.map +1 -1
  24. package/dist/bootstrap.js +324 -52
  25. package/dist/cell.d.ts +6 -0
  26. package/dist/cell.d.ts.map +1 -0
  27. package/dist/cell.js +9 -0
  28. package/dist/chain.d.ts +12 -0
  29. package/dist/chain.d.ts.map +1 -0
  30. package/dist/chain.js +64 -0
  31. package/dist/change-set.d.ts +13 -14
  32. package/dist/change-set.d.ts.map +1 -1
  33. package/dist/change-set.js +17 -56
  34. package/dist/change.d.ts +50 -0
  35. package/dist/change.d.ts.map +1 -1
  36. package/dist/change.js +39 -0
  37. package/dist/chat-types.d.ts +3 -0
  38. package/dist/chat-types.d.ts.map +1 -0
  39. package/dist/chat-types.js +11 -0
  40. package/dist/client.d.ts +64 -27
  41. package/dist/client.d.ts.map +1 -1
  42. package/dist/client.js +161 -35
  43. package/dist/collection.d.ts +35 -14
  44. package/dist/collection.d.ts.map +1 -1
  45. package/dist/collection.js +68 -54
  46. package/dist/column.d.ts +5 -0
  47. package/dist/column.d.ts.map +1 -0
  48. package/dist/column.js +9 -0
  49. package/dist/compile.d.ts +18 -0
  50. package/dist/compile.d.ts.map +1 -0
  51. package/dist/compile.js +723 -0
  52. package/dist/connection.d.ts +8 -104
  53. package/dist/connection.d.ts.map +1 -1
  54. package/dist/connection.js +115 -2097
  55. package/dist/context.d.ts +2 -0
  56. package/dist/context.d.ts.map +1 -0
  57. package/dist/context.js +7 -0
  58. package/dist/conversation-live.d.ts +149 -0
  59. package/dist/conversation-live.d.ts.map +1 -0
  60. package/dist/conversation-live.js +259 -0
  61. package/dist/conversation-row.d.ts +40 -0
  62. package/dist/conversation-row.d.ts.map +1 -0
  63. package/dist/conversation-row.js +66 -0
  64. package/dist/conversation.d.ts +96 -47
  65. package/dist/conversation.d.ts.map +1 -1
  66. package/dist/conversation.js +1133 -546
  67. package/dist/declaration.d.ts +10 -0
  68. package/dist/declaration.d.ts.map +1 -0
  69. package/dist/declaration.js +24 -0
  70. package/dist/digest.d.ts +7 -0
  71. package/dist/digest.d.ts.map +1 -0
  72. package/dist/digest.js +113 -0
  73. package/dist/discovery.d.ts +12 -0
  74. package/dist/discovery.d.ts.map +1 -0
  75. package/dist/discovery.js +175 -0
  76. package/dist/download.d.ts +6 -0
  77. package/dist/download.d.ts.map +1 -0
  78. package/dist/download.js +42 -0
  79. package/dist/durability.d.ts +24 -1
  80. package/dist/durability.d.ts.map +1 -1
  81. package/dist/durability.js +12 -0
  82. package/dist/entry.d.ts +34 -0
  83. package/dist/entry.d.ts.map +1 -0
  84. package/dist/entry.js +190 -0
  85. package/dist/expectation.d.ts +34 -0
  86. package/dist/expectation.d.ts.map +1 -0
  87. package/dist/expectation.js +123 -0
  88. package/dist/failure.d.ts +16 -0
  89. package/dist/failure.d.ts.map +1 -0
  90. package/dist/failure.js +27 -0
  91. package/dist/figures.d.ts +49 -0
  92. package/dist/figures.d.ts.map +1 -0
  93. package/dist/figures.js +199 -0
  94. package/dist/file.d.ts +2 -19
  95. package/dist/file.d.ts.map +1 -1
  96. package/dist/file.js +8 -122
  97. package/dist/holdings.d.ts +29 -0
  98. package/dist/holdings.d.ts.map +1 -0
  99. package/dist/holdings.js +95 -0
  100. package/dist/host.d.ts +33 -3
  101. package/dist/host.d.ts.map +1 -1
  102. package/dist/host.js +221 -34
  103. package/dist/house-query.d.ts +18 -0
  104. package/dist/house-query.d.ts.map +1 -0
  105. package/dist/house-query.js +54 -0
  106. package/dist/identity.d.ts +3 -0
  107. package/dist/identity.d.ts.map +1 -1
  108. package/dist/identity.js +13 -1
  109. package/dist/index.d.ts +47 -10
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +23 -0
  112. package/dist/install.d.ts +60 -0
  113. package/dist/install.d.ts.map +1 -0
  114. package/dist/install.js +537 -0
  115. package/dist/lifecycle.d.ts +7 -0
  116. package/dist/lifecycle.d.ts.map +1 -0
  117. package/dist/lifecycle.js +290 -0
  118. package/dist/listing.d.ts +60 -0
  119. package/dist/listing.d.ts.map +1 -0
  120. package/dist/listing.js +168 -0
  121. package/dist/live.d.ts +25 -0
  122. package/dist/live.d.ts.map +1 -0
  123. package/dist/live.js +206 -0
  124. package/dist/loaded.d.ts +7 -0
  125. package/dist/loaded.d.ts.map +1 -0
  126. package/dist/loaded.js +46 -0
  127. package/dist/locks.d.ts +7 -0
  128. package/dist/locks.d.ts.map +1 -0
  129. package/dist/locks.js +34 -0
  130. package/dist/lost.d.ts +5 -0
  131. package/dist/lost.d.ts.map +1 -0
  132. package/dist/lost.js +49 -0
  133. package/dist/media.d.ts +24 -0
  134. package/dist/media.d.ts.map +1 -0
  135. package/dist/media.js +352 -0
  136. package/dist/memory.d.ts +29 -8
  137. package/dist/memory.d.ts.map +1 -1
  138. package/dist/memory.js +359 -104
  139. package/dist/messages.d.ts +63 -0
  140. package/dist/messages.d.ts.map +1 -0
  141. package/dist/messages.js +169 -0
  142. package/dist/modal.d.ts +2 -0
  143. package/dist/modal.d.ts.map +1 -0
  144. package/dist/modal.js +11 -0
  145. package/dist/model.d.ts +16 -14
  146. package/dist/model.d.ts.map +1 -1
  147. package/dist/model.js +12 -14
  148. package/dist/models.d.ts +10 -0
  149. package/dist/models.d.ts.map +1 -0
  150. package/dist/models.js +153 -0
  151. package/dist/name.d.ts +3 -0
  152. package/dist/name.d.ts.map +1 -0
  153. package/dist/name.js +118 -0
  154. package/dist/observation.d.ts +44 -9
  155. package/dist/observation.d.ts.map +1 -1
  156. package/dist/observation.js +271 -33
  157. package/dist/online.d.ts +7 -0
  158. package/dist/online.d.ts.map +1 -0
  159. package/dist/online.js +29 -0
  160. package/dist/open.d.ts +2 -0
  161. package/dist/open.d.ts.map +1 -0
  162. package/dist/open.js +1 -0
  163. package/dist/opened.d.ts +22 -0
  164. package/dist/opened.d.ts.map +1 -0
  165. package/dist/opened.js +107 -0
  166. package/dist/opening.d.ts +4 -0
  167. package/dist/opening.d.ts.map +1 -0
  168. package/dist/opening.js +69 -0
  169. package/dist/outcome.d.ts +95 -5
  170. package/dist/outcome.d.ts.map +1 -1
  171. package/dist/outcome.js +114 -1
  172. package/dist/overlay.d.ts +21 -6
  173. package/dist/overlay.d.ts.map +1 -1
  174. package/dist/overlay.js +170 -190
  175. package/dist/page-metadata.d.ts +8 -0
  176. package/dist/page-metadata.d.ts.map +1 -0
  177. package/dist/page-metadata.js +19 -0
  178. package/dist/parts.d.ts +6 -0
  179. package/dist/parts.d.ts.map +1 -0
  180. package/dist/parts.js +36 -0
  181. package/dist/paths.d.ts +2 -0
  182. package/dist/paths.d.ts.map +1 -1
  183. package/dist/paths.js +26 -0
  184. package/dist/preparation.d.ts +46 -0
  185. package/dist/preparation.d.ts.map +1 -0
  186. package/dist/preparation.js +344 -0
  187. package/dist/presence.d.ts +58 -0
  188. package/dist/presence.d.ts.map +1 -0
  189. package/dist/presence.js +231 -0
  190. package/dist/queries.d.ts +16 -0
  191. package/dist/queries.d.ts.map +1 -0
  192. package/dist/queries.js +287 -0
  193. package/dist/query.d.ts +51 -181
  194. package/dist/query.d.ts.map +1 -1
  195. package/dist/query.js +3 -490
  196. package/dist/questions.d.ts +30 -0
  197. package/dist/questions.d.ts.map +1 -0
  198. package/dist/questions.js +117 -0
  199. package/dist/queue.d.ts +40 -0
  200. package/dist/queue.d.ts.map +1 -0
  201. package/dist/queue.js +480 -0
  202. package/dist/reach.d.ts +30 -5
  203. package/dist/reach.d.ts.map +1 -1
  204. package/dist/reach.js +459 -91
  205. package/dist/react.d.ts +49 -20
  206. package/dist/react.d.ts.map +1 -1
  207. package/dist/react.js +45 -21
  208. package/dist/read.d.ts +7 -0
  209. package/dist/read.d.ts.map +1 -0
  210. package/dist/read.js +17 -0
  211. package/dist/readiness.d.ts +65 -0
  212. package/dist/readiness.d.ts.map +1 -0
  213. package/dist/readiness.js +34 -0
  214. package/dist/reads.d.ts +39 -0
  215. package/dist/reads.d.ts.map +1 -0
  216. package/dist/reads.js +178 -0
  217. package/dist/recovery.d.ts +29 -0
  218. package/dist/recovery.d.ts.map +1 -0
  219. package/dist/recovery.js +255 -0
  220. package/dist/refresh.d.ts +20 -7
  221. package/dist/refresh.d.ts.map +1 -1
  222. package/dist/refresh.js +155 -59
  223. package/dist/refusal.d.ts +5 -0
  224. package/dist/refusal.d.ts.map +1 -0
  225. package/dist/refusal.js +55 -0
  226. package/dist/replica.d.ts +53 -33
  227. package/dist/replica.d.ts.map +1 -1
  228. package/dist/replica.js +362 -165
  229. package/dist/retried.d.ts +30 -0
  230. package/dist/retried.d.ts.map +1 -0
  231. package/dist/retried.js +72 -0
  232. package/dist/room-draft.d.ts +85 -14
  233. package/dist/room-draft.d.ts.map +1 -1
  234. package/dist/room-draft.js +502 -96
  235. package/dist/room-drafts.d.ts +24 -0
  236. package/dist/room-drafts.d.ts.map +1 -0
  237. package/dist/room-drafts.js +222 -0
  238. package/dist/room-list.d.ts +10 -0
  239. package/dist/room-list.d.ts.map +1 -0
  240. package/dist/room-list.js +45 -0
  241. package/dist/rows.d.ts +33 -35
  242. package/dist/rows.d.ts.map +1 -1
  243. package/dist/rows.js +64 -124
  244. package/dist/running.d.ts +5 -0
  245. package/dist/running.d.ts.map +1 -0
  246. package/dist/running.js +10 -0
  247. package/dist/runtime.d.ts +35 -0
  248. package/dist/runtime.d.ts.map +1 -0
  249. package/dist/runtime.js +1 -0
  250. package/dist/save.d.ts +48 -22
  251. package/dist/save.d.ts.map +1 -1
  252. package/dist/save.js +994 -215
  253. package/dist/saves.d.ts +34 -0
  254. package/dist/saves.d.ts.map +1 -0
  255. package/dist/saves.js +457 -0
  256. package/dist/search.d.ts +15 -54
  257. package/dist/search.d.ts.map +1 -1
  258. package/dist/search.js +10 -121
  259. package/dist/seed.d.ts +25 -0
  260. package/dist/seed.d.ts.map +1 -0
  261. package/dist/seed.js +145 -0
  262. package/dist/shared.d.ts +10 -0
  263. package/dist/shared.d.ts.map +1 -0
  264. package/dist/shared.js +339 -0
  265. package/dist/shown.d.ts +35 -0
  266. package/dist/shown.d.ts.map +1 -0
  267. package/dist/shown.js +326 -0
  268. package/dist/socket/admission.d.ts +7 -0
  269. package/dist/socket/admission.d.ts.map +1 -0
  270. package/dist/socket/admission.js +39 -0
  271. package/dist/socket/answers.d.ts +6 -0
  272. package/dist/socket/answers.d.ts.map +1 -0
  273. package/dist/socket/answers.js +20 -0
  274. package/dist/socket/lanes.d.ts +28 -0
  275. package/dist/socket/lanes.d.ts.map +1 -0
  276. package/dist/socket/lanes.js +103 -0
  277. package/dist/socket/reads.d.ts +10 -0
  278. package/dist/socket/reads.d.ts.map +1 -0
  279. package/dist/socket/reads.js +31 -0
  280. package/dist/socket/session.d.ts +41 -0
  281. package/dist/socket/session.d.ts.map +1 -0
  282. package/dist/socket/session.js +26 -0
  283. package/dist/socket.d.ts +68 -0
  284. package/dist/socket.d.ts.map +1 -0
  285. package/dist/socket.js +165 -0
  286. package/dist/source.d.ts +59 -0
  287. package/dist/source.d.ts.map +1 -0
  288. package/dist/source.js +93 -0
  289. package/dist/status.d.ts +7 -4
  290. package/dist/status.d.ts.map +1 -1
  291. package/dist/status.js +3 -15
  292. package/dist/store/installs.d.ts +30 -0
  293. package/dist/store/installs.d.ts.map +1 -0
  294. package/dist/store/installs.js +40 -0
  295. package/dist/store/readiness.d.ts +11 -0
  296. package/dist/store/readiness.d.ts.map +1 -0
  297. package/dist/store/readiness.js +68 -0
  298. package/dist/store/records.d.ts +227 -0
  299. package/dist/store/records.d.ts.map +1 -0
  300. package/dist/store/records.js +468 -0
  301. package/dist/store/room-held.d.ts +8 -0
  302. package/dist/store/room-held.d.ts.map +1 -0
  303. package/dist/store/room-held.js +17 -0
  304. package/dist/store/rooms-shown.d.ts +8 -0
  305. package/dist/store/rooms-shown.d.ts.map +1 -0
  306. package/dist/store/rooms-shown.js +13 -0
  307. package/dist/store/space.d.ts +11 -0
  308. package/dist/store/space.d.ts.map +1 -0
  309. package/dist/store/space.js +41 -0
  310. package/dist/store/watchers.d.ts +17 -0
  311. package/dist/store/watchers.d.ts.map +1 -0
  312. package/dist/store/watchers.js +56 -0
  313. package/dist/store/writes.d.ts +24 -0
  314. package/dist/store/writes.d.ts.map +1 -0
  315. package/dist/store/writes.js +125 -0
  316. package/dist/store.d.ts +115 -92
  317. package/dist/store.d.ts.map +1 -1
  318. package/dist/store.js +173 -384
  319. package/dist/stored.d.ts +174 -0
  320. package/dist/stored.d.ts.map +1 -0
  321. package/dist/stored.js +785 -0
  322. package/dist/surface.d.ts +94 -0
  323. package/dist/surface.d.ts.map +1 -0
  324. package/dist/surface.js +255 -0
  325. package/dist/sync.d.ts +21 -0
  326. package/dist/sync.d.ts.map +1 -0
  327. package/dist/sync.js +557 -0
  328. package/dist/tables.d.ts +376 -0
  329. package/dist/tables.d.ts.map +1 -0
  330. package/dist/tables.js +499 -0
  331. package/dist/tallies.d.ts +18 -0
  332. package/dist/tallies.d.ts.map +1 -0
  333. package/dist/tallies.js +128 -0
  334. package/dist/transfer.d.ts +0 -5
  335. package/dist/transfer.d.ts.map +1 -1
  336. package/dist/turn.d.ts +9 -0
  337. package/dist/turn.d.ts.map +1 -0
  338. package/dist/turn.js +75 -0
  339. package/dist/validation.d.ts +29 -0
  340. package/dist/validation.d.ts.map +1 -0
  341. package/dist/validation.js +98 -0
  342. package/dist/windows.d.ts +11 -0
  343. package/dist/windows.d.ts.map +1 -0
  344. package/dist/windows.js +16 -0
  345. package/dist/wire.d.ts +248 -37
  346. package/dist/wire.d.ts.map +1 -1
  347. package/dist/wire.js +93 -33
  348. package/package.json +27 -15
  349. package/AGENTS.md +0 -244
  350. package/dist/attachment.d.ts +0 -3
  351. package/dist/attachment.d.ts.map +0 -1
  352. package/dist/attachment.js +0 -8
  353. package/dist/log.d.ts +0 -5
  354. package/dist/log.d.ts.map +0 -1
  355. package/dist/log.js +0 -14
  356. package/dist/read-side.d.ts +0 -18
  357. package/dist/read-side.d.ts.map +0 -1
  358. package/dist/read-side.js +0 -433
package/dist/change.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { BinaryFile, HeadChange } from './adapter.js';
1
2
  export type Change = {
2
3
  readonly kind: 'field';
3
4
  readonly path: string;
@@ -25,6 +26,13 @@ export type Change = {
25
26
  readonly kind: 'replace';
26
27
  readonly path: string;
27
28
  readonly content: string;
29
+ } | {
30
+ readonly kind: 'binary';
31
+ readonly path: string;
32
+ readonly localId: string;
33
+ readonly byteLength: number;
34
+ readonly mediaType: string;
35
+ readonly sha256: string;
28
36
  } | {
29
37
  readonly kind: 'move';
30
38
  readonly path: string;
@@ -32,6 +40,37 @@ export type Change = {
32
40
  } | {
33
41
  readonly kind: 'remove';
34
42
  readonly path: string;
43
+ } | (Arriving & {
44
+ readonly content: string;
45
+ }) | (Arriving & {
46
+ readonly binary: BinaryFile;
47
+ });
48
+ type Arriving = {
49
+ readonly kind: 'arrival';
50
+ readonly path: string;
51
+ readonly revision?: string;
52
+ readonly fileId?: string;
53
+ readonly created?: string;
54
+ readonly change?: HeadChange;
55
+ };
56
+ export type PartChange = Extract<Change, {
57
+ readonly kind: 'field' | 'section' | 'preamble';
58
+ }>;
59
+ export declare function isPart(change: Change): change is PartChange;
60
+ export type RoomMove = {
61
+ readonly source: {
62
+ readonly room: string;
63
+ readonly baseRoomVersion: string;
64
+ };
65
+ readonly destination: {
66
+ readonly room: string;
67
+ readonly baseRoomVersion: string;
68
+ readonly handle: string;
69
+ };
70
+ readonly moves: readonly {
71
+ readonly path: string;
72
+ readonly to: string;
73
+ }[];
35
74
  };
36
75
  export type Precondition = {
37
76
  readonly kind: 'field';
@@ -51,6 +90,10 @@ export type Precondition = {
51
90
  readonly kind: 'revision';
52
91
  readonly path: string;
53
92
  readonly revision: string;
93
+ } | {
94
+ readonly kind: 'content';
95
+ readonly path: string;
96
+ readonly content: string;
54
97
  } | {
55
98
  readonly kind: 'present';
56
99
  readonly path: string;
@@ -69,6 +112,13 @@ export type ChangeBatch = {
69
112
  readonly changes: readonly Change[];
70
113
  readonly preconditions: readonly Precondition[];
71
114
  readonly writtenBy?: WrittenBy;
115
+ readonly between?: RoomMove;
72
116
  };
73
117
  export declare function immutable(batch: ChangeBatch): ChangeBatch;
118
+ export declare function partnerOf(batch: ChangeBatch, locator: string): string | null;
119
+ export declare function leaving(batch: ChangeBatch, locator: string): boolean;
120
+ export declare function landing(changes: readonly Change[], index: number, path: string): string | null;
121
+ export declare function departure(changes: readonly Change[], index: number): string;
122
+ export declare function queuedFile(batch: ChangeBatch, path: string, localId: string): number;
123
+ export {};
74
124
  //# sourceMappingURL=change.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../src/change.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GACd;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM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OAAO,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS9F;AAED,wBAAgB,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)));
@@ -11,3 +14,39 @@ function frozen(value) {
11
14
  export function immutable(batch) {
12
15
  return frozen(batch);
13
16
  }
17
+ export function partnerOf(batch, locator) {
18
+ const between = batch.between;
19
+ if (between === undefined)
20
+ return null;
21
+ return between.source.room === locator ? between.destination.room : between.source.room;
22
+ }
23
+ export function leaving(batch, locator) {
24
+ return batch.between?.source.room === locator;
25
+ }
26
+ export function landing(changes, index, path) {
27
+ let at = path;
28
+ for (let next = index + 1; next < changes.length; next += 1) {
29
+ const change = changes[next];
30
+ if (change.path !== at)
31
+ continue;
32
+ if (change.kind === 'remove')
33
+ return null;
34
+ if (change.kind === 'move')
35
+ at = change.to;
36
+ }
37
+ return at;
38
+ }
39
+ export function departure(changes, index) {
40
+ let at = changes[index].path;
41
+ for (let earlier = index - 1; earlier >= 0; earlier -= 1) {
42
+ const change = changes[earlier];
43
+ if (change.kind === 'move' && change.to === at)
44
+ at = change.path;
45
+ }
46
+ return at;
47
+ }
48
+ export function queuedFile(batch, path, localId) {
49
+ return batch.changes.findIndex((change, index) => change.kind === 'binary' &&
50
+ change.localId === localId &&
51
+ landing(batch.changes, index, change.path) === path);
52
+ }
@@ -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 UNKEPT_LINE = /^\[(?:too big to keep|not kept, [^:\n]+): [^\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 || UNKEPT_LINE.test(line)) ? lines : [];
11
+ }
package/dist/client.d.ts CHANGED
@@ -1,70 +1,107 @@
1
- import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedRoomDraft, SaveResult } from './connection.js';
2
- import type { HistoryResult, ServiceMode } from './adapter.js';
3
- import type { ChatDraft, 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 { CallResult, QueueEntry } from './outcome.js';
6
- import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult } from './query.js';
11
+ import { type AttachAnswer, type BinaryAnswer, type CallResult, type DownloadAnswer, type HistoryAnswer, type QueueEntry, type Resolution, type ShownAnswer } 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';
17
+ import type { HouseQuery, HouseQueryOptions, HouseQueryResult } from './house-query.js';
18
+ import type { Readiness } from './readiness.js';
19
+ import type { ObservedRead } from './reads.js';
9
20
  import type { SyncStatus } from './status.js';
10
21
  import { type RuntimePort } from './wire.js';
22
+ export type BuiltFile = Blob | string;
23
+ export type BuildFile = (name: string) => Promise<BuiltFile | null>;
11
24
  export type MdRuntimeClient = {
25
+ buildFile(name: string): Promise<BuiltFile | null>;
12
26
  rooms(): Promise<readonly AppRoom[]>;
13
27
  query: {
14
- (query: DocumentQuery): Promise<DocumentResult>;
15
- (query: GroupQuery): Promise<GroupResult>;
28
+ (query: DocumentQuery): Promise<DocumentResult | PendingResult>;
29
+ (query: GroupQuery): Promise<GroupResult | PendingResult>;
16
30
  };
17
31
  search(request: SearchRequest): Promise<SearchResult>;
32
+ queryHouse(query: HouseQuery, options?: HouseQueryOptions): Promise<HouseQueryResult>;
18
33
  types(locator: string): Promise<RoomSchemas>;
19
34
  roomDraft: {
20
35
  list(): Promise<readonly RoomDraft[]>;
21
36
  read(room: string, path: string): Promise<RoomDraft | null>;
22
- write(room: string, path: string, revision: string | null, parts: RoomDraftParts): Promise<RoomDraftWrite>;
37
+ write(room: string, path: string, revision: string | null, parts: RoomDraftParts, next?: string): Promise<RoomDraftWrite>;
23
38
  discard(room: string, path: string, revision: string): Promise<RoomDraftWrite>;
24
39
  };
25
40
  save(room: string, roomDrafts: readonly SavedRoomDraft[]): Promise<SaveResult>;
41
+ saveParts(room: string, parts: readonly SavedParts[]): Promise<SaveResult>;
26
42
  presentation: {
27
43
  read(): Promise<unknown>;
28
44
  write(value: unknown): Promise<void>;
45
+ edit(members: Readonly<Record<string, unknown>>): Promise<void>;
29
46
  };
30
- conversation: {
31
- list(): Promise<readonly ConversationEntry[]>;
32
- read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
33
- create(input: unknown): Promise<CallResult>;
34
- send(conversation: string): Promise<CallResult>;
35
- answer(conversation: string, answer: unknown): Promise<CallResult>;
36
- interrupt(conversation: string): Promise<CallResult>;
37
- kill(conversation: string): Promise<CallResult>;
38
- cancel(conversation: string, turn: string): Promise<CallResult>;
39
- delete(conversation: string): Promise<CallResult>;
47
+ conversation: ConversationSurface & {
48
+ pageMetadata(app: string, address: string): Promise<string>;
40
49
  };
41
- chatDraft: {
42
- write(conversation: string, draft: ChatDraft): Promise<void>;
43
- discard(conversation: string): Promise<void>;
50
+ chatDraft: ChatDraftSurface;
51
+ history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
52
+ resolve(room: string, path: string, destination: string): Promise<Resolution>;
53
+ binaryFile: {
54
+ read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
55
+ show(room: string, path: string, revision?: string): Promise<ShownAnswer>;
56
+ attach(room: string, file: File): Promise<AttachAnswer>;
57
+ download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
44
58
  };
45
- history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryResult>;
46
59
  call(name: string, input: unknown): Promise<CallResult>;
60
+ answered(operation: string): Promise<boolean>;
47
61
  reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
48
- log(): Promise<string>;
49
62
  persistence(): Promise<boolean>;
63
+ retry(): Promise<void>;
64
+ cleanUp(): Promise<number>;
65
+ unsent(): Promise<readonly UnsentWork[]>;
66
+ sent(): Promise<void>;
67
+ reset(): Promise<void>;
68
+ readAgain(): Promise<void>;
50
69
  observe: {
51
70
  (topic: 'deployment-facts'): Promise<Observation<unknown>>;
52
71
  (topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
72
+ (topic: 'readiness'): Promise<Observation<Readiness>>;
53
73
  (topic: 'connection-refusal'): Promise<Observation<ConnectionRefusal | null>>;
54
74
  (topic: 'storage-loss'): Promise<Observation<string | null>>;
55
75
  (topic: 'sync-status'): Promise<Observation<SyncStatus>>;
56
76
  (topic: 'service-mode'): Promise<Observation<ServiceMode>>;
57
- (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult>>;
58
- (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult>>;
77
+ (topic: 'member'): Promise<Observation<Member | null>>;
78
+ (topic: 'time-zone'): Promise<Observation<string | null>>;
79
+ (topic: 'authority-changes'): Promise<Observation<number>>;
80
+ (topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
81
+ (topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
59
82
  (topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
60
83
  (topic: 'room-drafts'): Promise<Observation<readonly RoomDraft[]>>;
61
84
  (topic: 'presentation'): Promise<Observation<unknown>>;
62
85
  (topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
63
86
  (topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
87
+ (topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
88
+ (topic: 'listed-agents'): Promise<Observation<readonly ListedAgent[]>>;
89
+ (topic: 'room-list'): Promise<Observation<RoomList | null>>;
90
+ (topic: 'figures'): Promise<Observation<FiguresResult>>;
91
+ (topic: 'holdings'): Promise<Observation<Holdings>>;
92
+ (topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
64
93
  };
65
94
  reauthorize(): Promise<void>;
95
+ settled(): Promise<void>;
66
96
  };
67
- export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
97
+ export declare function connectMdRuntime(port: RuntimePort, buildFile?: BuildFile): MdRuntimeClient;
98
+ export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
99
+ export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
100
+ export { roomDraftRevision } from './identity.js';
101
+ export { atAddress, importedFile } from './loaded.js';
102
+ export { defineRoomMedia, ROOM_MEDIA, viewFile } from './media.js';
103
+ export { shownModal } from './modal.js';
68
104
  export type { Observation } from './observation.js';
69
- export type { RuntimePort } from './wire.js';
105
+ export type { Open } from './open.js';
106
+ export { unanswered, undelivered, type RuntimePort, type WireMember } from './wire.js';
70
107
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAY,KAAK,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU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
@@ -1,22 +1,34 @@
1
- import { observed } from './observation.js';
2
- import { answer, AUTHORIZATION_ENDED, PORT_CLOSED, } from './wire.js';
3
- export function connectMdRuntime(port) {
1
+ import { handedCopy, handedLink } from './download.js';
2
+ import { pageMetadataBlock } from './page-metadata.js';
3
+ import { appRooms, observed } from './observation.js';
4
+ import { runtimeError } from './failure.js';
5
+ import { blobOf, } from './outcome.js';
6
+ import { AUTHORIZATION_ENDED, PORT_CLOSED, wireAnswer, } from './wire.js';
7
+ // React renders an arrived value in a later task and opens what that render observes as it commits, so this many frames opening nothing mean the page drew what it observes.
8
+ const SETTLED_FRAMES = 2;
9
+ function refused(refusal) {
10
+ return runtimeError(refusal.code);
11
+ }
12
+ const UNBUILT = () => Promise.resolve(null);
13
+ export function connectMdRuntime(port, buildFile = UNBUILT) {
4
14
  let sequence = 0;
5
15
  let refusal = null;
6
16
  let ended = null;
7
17
  const calls = new Map();
8
18
  const opening = new Map();
9
19
  const observations = new Map();
20
+ let drawing = null;
21
+ let settling = null;
10
22
  const send = (message) => {
11
23
  port.postMessage(message);
12
24
  };
13
- function begin(id, topic, first) {
25
+ function begin(id, topic, input, first) {
14
26
  const handle = observed(first, () => {
15
27
  observations.delete(id);
16
28
  if (refusal === null)
17
29
  send({ kind: 'stop', id });
18
- }, topic === 'query');
19
- observations.set(id, { topic, handle });
30
+ }, topic);
31
+ observations.set(id, { topic, input, handle });
20
32
  return handle.observation;
21
33
  }
22
34
  function refuse(reported) {
@@ -25,10 +37,10 @@ export function connectMdRuntime(port) {
25
37
  if (topic === 'connection-refusal')
26
38
  handle.receive(reported);
27
39
  }
28
- const failure = new Error(reported.reason);
40
+ const failure = refused(reported);
29
41
  for (const [id, waiting] of opening) {
30
42
  if (waiting.topic === 'connection-refusal')
31
- waiting.settle(begin(id, waiting.topic, reported));
43
+ waiting.settle(begin(id, waiting.topic, waiting.input, reported));
32
44
  else
33
45
  waiting.fail(failure);
34
46
  }
@@ -36,12 +48,12 @@ export function connectMdRuntime(port) {
36
48
  for (const waiting of calls.values())
37
49
  waiting.fail(failure);
38
50
  calls.clear();
51
+ drawing?.();
39
52
  }
40
- function end(reason) {
53
+ function end(failure) {
41
54
  if (ended !== null)
42
55
  return;
43
- ended = reason;
44
- const failure = new Error(reason);
56
+ ended = failure;
45
57
  for (const waiting of opening.values())
46
58
  waiting.fail(failure);
47
59
  opening.clear();
@@ -51,9 +63,10 @@ export function connectMdRuntime(port) {
51
63
  for (const { handle } of observations.values())
52
64
  handle.end();
53
65
  observations.clear();
66
+ drawing?.();
54
67
  }
55
68
  port.addEventListener('message', (event) => {
56
- const message = answer(event.data);
69
+ const message = wireAnswer(event.data);
57
70
  if (message === null)
58
71
  return;
59
72
  if (message.kind === 'refusal') {
@@ -61,7 +74,11 @@ export function connectMdRuntime(port) {
61
74
  return;
62
75
  }
63
76
  if (message.kind === 'ended') {
64
- end(AUTHORIZATION_ENDED);
77
+ for (const { topic, handle } of observations.values()) {
78
+ if (topic === 'member' || topic === 'time-zone')
79
+ handle.receive(null);
80
+ }
81
+ end(runtimeError('authorization-ended', AUTHORIZATION_ENDED));
65
82
  return;
66
83
  }
67
84
  if (message.kind === 'event') {
@@ -71,31 +88,34 @@ export function connectMdRuntime(port) {
71
88
  const waiting = opening.get(message.id);
72
89
  if (waiting !== undefined) {
73
90
  opening.delete(message.id);
74
- if (message.kind === 'failure')
75
- waiting.fail(new Error(message.message));
91
+ if (message.kind === 'failure') {
92
+ waiting.fail(runtimeError(message.code, message.message, message.retryable));
93
+ }
76
94
  else
77
- waiting.settle(begin(message.id, waiting.topic, message.value));
95
+ waiting.settle(begin(message.id, waiting.topic, waiting.input, message.value));
96
+ drawing?.();
78
97
  return;
79
98
  }
80
99
  const called = calls.get(message.id);
81
100
  if (called === undefined)
82
101
  return;
83
102
  calls.delete(message.id);
84
- if (message.kind === 'failure')
85
- called.fail(new Error(message.message));
103
+ if (message.kind === 'failure') {
104
+ called.fail(runtimeError(message.code, message.message, message.retryable));
105
+ }
86
106
  else
87
107
  called.settle(message.value);
88
108
  });
89
109
  port.addEventListener('close', () => {
90
- end(PORT_CLOSED);
110
+ end(runtimeError('port-closed', PORT_CLOSED));
91
111
  });
92
112
  port.start();
93
113
  send({ kind: 'hello' });
94
114
  function ask(member, input) {
95
115
  if (ended !== null)
96
- return Promise.reject(new Error(ended));
116
+ return Promise.reject(ended);
97
117
  if (refusal !== null)
98
- return Promise.reject(new Error(refusal.reason));
118
+ return Promise.reject(refused(refusal));
99
119
  const id = (sequence += 1);
100
120
  return new Promise((settle, fail) => {
101
121
  calls.set(id, { settle: settle, fail });
@@ -104,55 +124,161 @@ export function connectMdRuntime(port) {
104
124
  }
105
125
  function watch(topic, input) {
106
126
  if (ended !== null)
107
- return Promise.reject(new Error(ended));
127
+ return Promise.reject(ended);
108
128
  const id = (sequence += 1);
109
129
  if (refusal !== null) {
110
130
  return topic === 'connection-refusal'
111
- ? Promise.resolve(begin(id, topic, refusal))
112
- : Promise.reject(new Error(refusal.reason));
131
+ ? Promise.resolve(begin(id, topic, input, refusal))
132
+ : Promise.reject(refused(refusal));
113
133
  }
114
134
  return new Promise((settle, fail) => {
115
- opening.set(id, { topic, settle, fail });
135
+ opening.set(id, { topic, input, settle, fail });
116
136
  send({ kind: 'observe', id, topic, input });
137
+ drawing?.();
138
+ });
139
+ }
140
+ function streamed(answer) {
141
+ if (answer.kind !== 'binary')
142
+ return answer;
143
+ const { file, byteLength, mediaType } = answer;
144
+ let part = 0;
145
+ let received = 0;
146
+ const stream = new ReadableStream({
147
+ async pull(controller) {
148
+ const bytes = await ask('binaryFile.part', [file, part]);
149
+ if (bytes === null) {
150
+ if (received === byteLength)
151
+ controller.close();
152
+ else
153
+ controller.error(runtimeError('binary-file-absent', 'The file ended early'));
154
+ return;
155
+ }
156
+ part += 1;
157
+ received += bytes.byteLength;
158
+ controller.enqueue(bytes);
159
+ },
160
+ }, { highWaterMark: 0 });
161
+ return { kind: 'binary', stream, byteLength, mediaType };
162
+ }
163
+ async function download(room, path, revision) {
164
+ const linked = await handedLink(path, () => ask('binaryFile.link', [room, path, revision]));
165
+ if (linked.kind !== 'absent')
166
+ return linked;
167
+ const read = streamed(await ask('binaryFile.read', [room, path, revision]));
168
+ if (read.kind !== 'binary')
169
+ return read;
170
+ return handedCopy(await blobOf(read), path.slice(path.lastIndexOf('/') + 1));
171
+ }
172
+ function settled() {
173
+ if (settling !== null)
174
+ return settling;
175
+ settling = new Promise((resolve) => {
176
+ let moved = 0;
177
+ const check = () => {
178
+ moved += 1;
179
+ if (opening.size > 0)
180
+ return;
181
+ const at = moved;
182
+ const waited = (frames) => {
183
+ requestAnimationFrame(() => {
184
+ if (frames < SETTLED_FRAMES) {
185
+ waited(frames + 1);
186
+ return;
187
+ }
188
+ if (moved !== at || opening.size > 0)
189
+ return;
190
+ drawing = null;
191
+ resolve();
192
+ });
193
+ };
194
+ waited(1);
195
+ };
196
+ drawing = check;
197
+ check();
117
198
  });
199
+ return settling;
118
200
  }
119
201
  return {
120
- rooms: () => ask('rooms', []),
202
+ buildFile,
203
+ rooms: () => ask('rooms', []).then(appRooms),
121
204
  query: ((query) => ask('query', [query])),
122
205
  search: (request) => ask('search', [request]),
206
+ queryHouse: (query, options) => ask('queryHouse', options === undefined ? [query] : [query, options]),
123
207
  types: (locator) => ask('types', [locator]),
124
208
  roomDraft: {
125
209
  list: () => ask('roomDraft.list', []),
126
210
  read: (room, path) => ask('roomDraft.read', [room, path]),
127
- write: (room, path, revision, parts) => ask('roomDraft.write', [room, path, revision, parts]),
211
+ write: (room, path, revision, parts, next) => ask('roomDraft.write', next === undefined ? [room, path, revision, parts] : [room, path, revision, parts, next]),
128
212
  discard: (room, path, revision) => ask('roomDraft.discard', [room, path, revision]),
129
213
  },
130
214
  save: (room, roomDrafts) => ask('save', [room, roomDrafts]),
215
+ saveParts: (room, parts) => ask('saveParts', [room, parts]),
131
216
  presentation: {
132
217
  read: () => ask('presentation.read', []),
133
218
  write: (value) => ask('presentation.write', [value]),
219
+ edit: (members) => ask('presentation.edit', [members]),
134
220
  },
135
221
  conversation: {
136
222
  list: () => ask('conversation.list', []),
137
223
  read: (conversation, options) => ask('conversation.read', [conversation, options]),
138
224
  create: (input) => ask('conversation.create', [input]),
139
- send: (conversation) => ask('conversation.send', [conversation]),
140
- answer: (conversation, answer) => ask('conversation.answer', [conversation, answer]),
141
- interrupt: (conversation) => ask('conversation.interrupt', [conversation]),
142
- kill: (conversation) => ask('conversation.kill', [conversation]),
143
- cancel: (conversation, turn) => ask('conversation.cancel', [conversation, turn]),
144
- delete: (conversation) => ask('conversation.delete', [conversation]),
225
+ send: (conversation, operation, draft) => ask('conversation.send', [conversation, operation, draft]),
226
+ answer: (conversation, answer, operation) => ask('conversation.answer', [conversation, answer, operation]),
227
+ interrupt: (conversation, operation) => ask('conversation.interrupt', [conversation, operation]),
228
+ kill: (conversation, operation) => ask('conversation.kill', [conversation, operation]),
229
+ delete: (conversation, operation) => ask('conversation.delete', [conversation, operation]),
230
+ takeOut: (conversation, message, operation) => ask('conversation.takeOut', [conversation, message, operation]),
231
+ decide: (request, decision, operation) => ask('conversation.decide', [request, decision, operation]),
232
+ rename: (conversation, name, operation) => ask('conversation.rename', [conversation, name, operation]),
233
+ option: (conversation, option, value, operation) => ask('conversation.option', [conversation, option, value, operation]),
234
+ retry: (conversation, message, operation) => ask('conversation.retry', [conversation, message, operation]),
235
+ pin: (figures) => ask('conversation.pin', [figures]),
236
+ openTurn: (conversation, turn) => ask('conversation.openTurn', [conversation, turn]),
237
+ dismissSuggestion: (conversation, suggestion) => ask('conversation.dismissSuggestion', [conversation, suggestion]),
238
+ attach: (file) => ask('conversation.attach', [file]),
239
+ attachment: (link) => ask('conversation.attachment', [link]),
240
+ pageMetadata: async (app, address) => pageMetadataBlock(app, address, [...observations]
241
+ .sort(([left], [right]) => left - right)
242
+ .flatMap(([, { topic, input }]) => (topic === 'query' ? [input[0]] : []))),
145
243
  },
146
244
  chatDraft: {
147
- write: (conversation, draft) => ask('chatDraft.write', [conversation, draft]),
245
+ write: (conversation, draft, revision) => ask('chatDraft.write', [conversation, draft, revision]),
246
+ prepend: (conversation, draft) => ask('chatDraft.prepend', [conversation, draft]),
247
+ append: (conversation, draft) => ask('chatDraft.append', [conversation, draft]),
148
248
  discard: (conversation) => ask('chatDraft.discard', [conversation]),
149
249
  },
150
250
  history: (locator, path, query) => ask('history', [locator, path, query]),
251
+ resolve: (room, path, destination) => ask('resolve', [room, path, destination]),
252
+ binaryFile: {
253
+ read: (room, path, revision) => ask('binaryFile.read', [room, path, revision]).then((read) => streamed(read)),
254
+ show: (room, path, revision) => ask('binaryFile.show', [room, path, revision]).then((shown) => streamed(shown)),
255
+ attach: (room, file) => ask('binaryFile.attach', [room, file]),
256
+ download,
257
+ },
151
258
  call: (name, input) => ask('call', [name, input]),
259
+ answered: (operation) => ask('answered', [operation]),
152
260
  reached: (locator, roomVersion, path) => ask('reached', [locator, roomVersion, path]),
153
- log: () => ask('log', []),
154
261
  persistence: () => ask('persistence', []),
262
+ retry: () => ask('retry', []),
263
+ cleanUp: () => ask('cleanUp', []),
264
+ unsent: () => ask('unsent', []),
265
+ sent: () => ask('sent', []),
266
+ reset: () => ask('reset', []),
267
+ readAgain: () => ask('readAgain', []),
155
268
  observe: ((topic, ...input) => watch(topic, input)),
156
269
  reauthorize: () => ask('reauthorize', []),
270
+ settled,
157
271
  };
158
272
  }
273
+ const turns = new WeakMap();
274
+ export function inTurn(client, work) {
275
+ const turn = (turns.get(client) ?? Promise.resolve()).then(work);
276
+ turns.set(client, turn.then(() => undefined, () => undefined));
277
+ return turn;
278
+ }
279
+ export { chainedWindows } from './chain.js';
280
+ export { roomDraftRevision } from './identity.js';
281
+ export { atAddress, importedFile } from './loaded.js';
282
+ export { defineRoomMedia, ROOM_MEDIA, viewFile } from './media.js';
283
+ export { shownModal } from './modal.js';
284
+ export { unanswered, undelivered } from './wire.js';