@agentshouse/mdruntime 0.1.0-cbb8d8acc9d19 → 0.1.0-cbbae1fff01c6

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 (324) hide show
  1. package/README.md +24 -11
  2. package/dist/acceptance.d.ts +3 -0
  3. package/dist/acceptance.d.ts.map +1 -0
  4. package/dist/acceptance.js +308 -0
  5. package/dist/actions.d.ts +20 -0
  6. package/dist/actions.d.ts.map +1 -0
  7. package/dist/actions.js +251 -0
  8. package/dist/adapter.d.ts +194 -90
  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/attempt.d.ts +16 -0
  14. package/dist/attempt.d.ts.map +1 -0
  15. package/dist/attempt.js +70 -0
  16. package/dist/binary.d.ts +18 -0
  17. package/dist/binary.d.ts.map +1 -0
  18. package/dist/binary.js +8 -0
  19. package/dist/bootstrap.d.ts +37 -5
  20. package/dist/bootstrap.d.ts.map +1 -1
  21. package/dist/bootstrap.js +324 -52
  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 +12 -0
  26. package/dist/chain.d.ts.map +1 -0
  27. package/dist/chain.js +64 -0
  28. package/dist/change-set.d.ts +13 -14
  29. package/dist/change-set.d.ts.map +1 -1
  30. package/dist/change-set.js +17 -56
  31. package/dist/change.d.ts +46 -0
  32. package/dist/change.d.ts.map +1 -1
  33. package/dist/change.js +36 -0
  34. package/dist/chat-types.d.ts +5 -0
  35. package/dist/chat-types.d.ts.map +1 -0
  36. package/dist/chat-types.js +13 -0
  37. package/dist/client.d.ts +56 -18
  38. package/dist/client.d.ts.map +1 -1
  39. package/dist/client.js +164 -23
  40. package/dist/collection.d.ts +31 -14
  41. package/dist/collection.d.ts.map +1 -1
  42. package/dist/collection.js +61 -55
  43. package/dist/compile.d.ts +16 -0
  44. package/dist/compile.d.ts.map +1 -0
  45. package/dist/compile.js +711 -0
  46. package/dist/connection.d.ts +8 -104
  47. package/dist/connection.d.ts.map +1 -1
  48. package/dist/connection.js +107 -2094
  49. package/dist/context.d.ts +2 -0
  50. package/dist/context.d.ts.map +1 -0
  51. package/dist/context.js +7 -0
  52. package/dist/conversation-live.d.ts +135 -0
  53. package/dist/conversation-live.d.ts.map +1 -0
  54. package/dist/conversation-live.js +247 -0
  55. package/dist/conversation-row.d.ts +33 -0
  56. package/dist/conversation-row.d.ts.map +1 -0
  57. package/dist/conversation-row.js +53 -0
  58. package/dist/conversation.d.ts +67 -44
  59. package/dist/conversation.d.ts.map +1 -1
  60. package/dist/conversation.js +1010 -549
  61. package/dist/declaration.d.ts +10 -0
  62. package/dist/declaration.d.ts.map +1 -0
  63. package/dist/declaration.js +24 -0
  64. package/dist/digest.d.ts +7 -0
  65. package/dist/digest.d.ts.map +1 -0
  66. package/dist/digest.js +113 -0
  67. package/dist/discovery.d.ts +10 -0
  68. package/dist/discovery.d.ts.map +1 -0
  69. package/dist/discovery.js +148 -0
  70. package/dist/durability.d.ts +19 -1
  71. package/dist/durability.d.ts.map +1 -1
  72. package/dist/durability.js +5 -0
  73. package/dist/entry.d.ts +20 -0
  74. package/dist/entry.d.ts.map +1 -0
  75. package/dist/entry.js +161 -0
  76. package/dist/expectation.d.ts +23 -0
  77. package/dist/expectation.d.ts.map +1 -0
  78. package/dist/expectation.js +92 -0
  79. package/dist/failure.d.ts +14 -0
  80. package/dist/failure.d.ts.map +1 -0
  81. package/dist/failure.js +22 -0
  82. package/dist/figures.d.ts +49 -0
  83. package/dist/figures.d.ts.map +1 -0
  84. package/dist/figures.js +197 -0
  85. package/dist/file.d.ts +2 -19
  86. package/dist/file.d.ts.map +1 -1
  87. package/dist/file.js +7 -122
  88. package/dist/holdings.d.ts +29 -0
  89. package/dist/holdings.d.ts.map +1 -0
  90. package/dist/holdings.js +95 -0
  91. package/dist/host.d.ts +28 -4
  92. package/dist/host.d.ts.map +1 -1
  93. package/dist/host.js +149 -27
  94. package/dist/identity.d.ts +3 -0
  95. package/dist/identity.d.ts.map +1 -1
  96. package/dist/identity.js +13 -1
  97. package/dist/index.d.ts +40 -10
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +17 -0
  100. package/dist/install.d.ts +54 -0
  101. package/dist/install.d.ts.map +1 -0
  102. package/dist/install.js +538 -0
  103. package/dist/job.d.ts +5 -0
  104. package/dist/job.d.ts.map +1 -0
  105. package/dist/job.js +7 -0
  106. package/dist/lifecycle.d.ts +7 -0
  107. package/dist/lifecycle.d.ts.map +1 -0
  108. package/dist/lifecycle.js +272 -0
  109. package/dist/listing.d.ts +48 -0
  110. package/dist/listing.d.ts.map +1 -0
  111. package/dist/listing.js +139 -0
  112. package/dist/live.d.ts +23 -0
  113. package/dist/live.d.ts.map +1 -0
  114. package/dist/live.js +165 -0
  115. package/dist/locks.d.ts +7 -0
  116. package/dist/locks.d.ts.map +1 -0
  117. package/dist/locks.js +33 -0
  118. package/dist/log.d.ts +1 -0
  119. package/dist/log.d.ts.map +1 -1
  120. package/dist/lost.d.ts +5 -0
  121. package/dist/lost.d.ts.map +1 -0
  122. package/dist/lost.js +50 -0
  123. package/dist/media.d.ts +8 -0
  124. package/dist/media.d.ts.map +1 -0
  125. package/dist/media.js +218 -0
  126. package/dist/memory.d.ts +25 -8
  127. package/dist/memory.d.ts.map +1 -1
  128. package/dist/memory.js +295 -99
  129. package/dist/messages.d.ts +49 -0
  130. package/dist/messages.d.ts.map +1 -0
  131. package/dist/messages.js +148 -0
  132. package/dist/model.d.ts +13 -13
  133. package/dist/model.d.ts.map +1 -1
  134. package/dist/model.js +7 -15
  135. package/dist/models.d.ts +10 -0
  136. package/dist/models.d.ts.map +1 -0
  137. package/dist/models.js +156 -0
  138. package/dist/name.d.ts +4 -0
  139. package/dist/name.d.ts.map +1 -0
  140. package/dist/name.js +122 -0
  141. package/dist/observation.d.ts +22 -4
  142. package/dist/observation.d.ts.map +1 -1
  143. package/dist/observation.js +127 -26
  144. package/dist/open.d.ts +2 -0
  145. package/dist/open.d.ts.map +1 -0
  146. package/dist/open.js +1 -0
  147. package/dist/opened.d.ts +22 -0
  148. package/dist/opened.d.ts.map +1 -0
  149. package/dist/opened.js +107 -0
  150. package/dist/opening.d.ts +4 -0
  151. package/dist/opening.d.ts.map +1 -0
  152. package/dist/opening.js +59 -0
  153. package/dist/outcome.d.ts +75 -5
  154. package/dist/outcome.d.ts.map +1 -1
  155. package/dist/outcome.js +84 -1
  156. package/dist/overlay.d.ts +17 -5
  157. package/dist/overlay.d.ts.map +1 -1
  158. package/dist/overlay.js +168 -190
  159. package/dist/parts.d.ts +11 -0
  160. package/dist/parts.d.ts.map +1 -0
  161. package/dist/parts.js +21 -0
  162. package/dist/paths.d.ts +2 -0
  163. package/dist/paths.d.ts.map +1 -1
  164. package/dist/paths.js +26 -0
  165. package/dist/preparation.d.ts +20 -0
  166. package/dist/preparation.d.ts.map +1 -0
  167. package/dist/preparation.js +233 -0
  168. package/dist/presence.d.ts +52 -0
  169. package/dist/presence.d.ts.map +1 -0
  170. package/dist/presence.js +220 -0
  171. package/dist/queries.d.ts +16 -0
  172. package/dist/queries.d.ts.map +1 -0
  173. package/dist/queries.js +270 -0
  174. package/dist/query.d.ts +51 -181
  175. package/dist/query.d.ts.map +1 -1
  176. package/dist/query.js +3 -461
  177. package/dist/questions.d.ts +34 -0
  178. package/dist/questions.d.ts.map +1 -0
  179. package/dist/questions.js +122 -0
  180. package/dist/queue.d.ts +40 -0
  181. package/dist/queue.d.ts.map +1 -0
  182. package/dist/queue.js +455 -0
  183. package/dist/reach.d.ts +21 -5
  184. package/dist/reach.d.ts.map +1 -1
  185. package/dist/reach.js +305 -80
  186. package/dist/react.d.ts +43 -20
  187. package/dist/react.d.ts.map +1 -1
  188. package/dist/react.js +22 -21
  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 +49 -0
  193. package/dist/readiness.d.ts.map +1 -0
  194. package/dist/readiness.js +27 -0
  195. package/dist/reads.d.ts +37 -0
  196. package/dist/reads.d.ts.map +1 -0
  197. package/dist/reads.js +174 -0
  198. package/dist/recovery.d.ts +26 -0
  199. package/dist/recovery.d.ts.map +1 -0
  200. package/dist/recovery.js +232 -0
  201. package/dist/refresh.d.ts +20 -7
  202. package/dist/refresh.d.ts.map +1 -1
  203. package/dist/refresh.js +155 -59
  204. package/dist/refusal.d.ts +5 -0
  205. package/dist/refusal.d.ts.map +1 -0
  206. package/dist/refusal.js +57 -0
  207. package/dist/replica.d.ts +53 -33
  208. package/dist/replica.d.ts.map +1 -1
  209. package/dist/replica.js +361 -164
  210. package/dist/room-draft.d.ts +58 -12
  211. package/dist/room-draft.d.ts.map +1 -1
  212. package/dist/room-draft.js +270 -90
  213. package/dist/room-drafts.d.ts +24 -0
  214. package/dist/room-drafts.d.ts.map +1 -0
  215. package/dist/room-drafts.js +217 -0
  216. package/dist/rows.d.ts +32 -35
  217. package/dist/rows.d.ts.map +1 -1
  218. package/dist/rows.js +64 -124
  219. package/dist/runtime.d.ts +34 -0
  220. package/dist/runtime.d.ts.map +1 -0
  221. package/dist/runtime.js +1 -0
  222. package/dist/save.d.ts +46 -22
  223. package/dist/save.d.ts.map +1 -1
  224. package/dist/save.js +969 -171
  225. package/dist/saves.d.ts +32 -0
  226. package/dist/saves.d.ts.map +1 -0
  227. package/dist/saves.js +413 -0
  228. package/dist/search.d.ts +15 -54
  229. package/dist/search.d.ts.map +1 -1
  230. package/dist/search.js +10 -121
  231. package/dist/seed.d.ts +25 -0
  232. package/dist/seed.d.ts.map +1 -0
  233. package/dist/seed.js +145 -0
  234. package/dist/shared.d.ts +10 -0
  235. package/dist/shared.d.ts.map +1 -0
  236. package/dist/shared.js +339 -0
  237. package/dist/shown.d.ts +32 -0
  238. package/dist/shown.d.ts.map +1 -0
  239. package/dist/shown.js +290 -0
  240. package/dist/socket/admission.d.ts +7 -0
  241. package/dist/socket/admission.d.ts.map +1 -0
  242. package/dist/socket/admission.js +39 -0
  243. package/dist/socket/answers.d.ts +6 -0
  244. package/dist/socket/answers.d.ts.map +1 -0
  245. package/dist/socket/answers.js +20 -0
  246. package/dist/socket/lanes.d.ts +20 -0
  247. package/dist/socket/lanes.d.ts.map +1 -0
  248. package/dist/socket/lanes.js +77 -0
  249. package/dist/socket/reads.d.ts +10 -0
  250. package/dist/socket/reads.d.ts.map +1 -0
  251. package/dist/socket/reads.js +31 -0
  252. package/dist/socket/session.d.ts +38 -0
  253. package/dist/socket/session.d.ts.map +1 -0
  254. package/dist/socket/session.js +23 -0
  255. package/dist/socket.d.ts +67 -0
  256. package/dist/socket.d.ts.map +1 -0
  257. package/dist/socket.js +170 -0
  258. package/dist/source.d.ts +61 -0
  259. package/dist/source.d.ts.map +1 -0
  260. package/dist/source.js +82 -0
  261. package/dist/status.d.ts +7 -4
  262. package/dist/status.d.ts.map +1 -1
  263. package/dist/status.js +3 -15
  264. package/dist/store/installs.d.ts +30 -0
  265. package/dist/store/installs.d.ts.map +1 -0
  266. package/dist/store/installs.js +34 -0
  267. package/dist/store/readiness.d.ts +10 -0
  268. package/dist/store/readiness.d.ts.map +1 -0
  269. package/dist/store/readiness.js +52 -0
  270. package/dist/store/records.d.ts +210 -0
  271. package/dist/store/records.d.ts.map +1 -0
  272. package/dist/store/records.js +428 -0
  273. package/dist/store/room-held.d.ts +8 -0
  274. package/dist/store/room-held.d.ts.map +1 -0
  275. package/dist/store/room-held.js +17 -0
  276. package/dist/store/space.d.ts +11 -0
  277. package/dist/store/space.d.ts.map +1 -0
  278. package/dist/store/space.js +41 -0
  279. package/dist/store/watchers.d.ts +17 -0
  280. package/dist/store/watchers.d.ts.map +1 -0
  281. package/dist/store/watchers.js +56 -0
  282. package/dist/store/writes.d.ts +24 -0
  283. package/dist/store/writes.d.ts.map +1 -0
  284. package/dist/store/writes.js +125 -0
  285. package/dist/store.d.ts +109 -94
  286. package/dist/store.d.ts.map +1 -1
  287. package/dist/store.js +161 -384
  288. package/dist/stored.d.ts +156 -0
  289. package/dist/stored.d.ts.map +1 -0
  290. package/dist/stored.js +649 -0
  291. package/dist/surface.d.ts +88 -0
  292. package/dist/surface.d.ts.map +1 -0
  293. package/dist/surface.js +223 -0
  294. package/dist/sync.d.ts +19 -0
  295. package/dist/sync.d.ts.map +1 -0
  296. package/dist/sync.js +521 -0
  297. package/dist/tables.d.ts +412 -0
  298. package/dist/tables.d.ts.map +1 -0
  299. package/dist/tables.js +737 -0
  300. package/dist/tallies.d.ts +18 -0
  301. package/dist/tallies.d.ts.map +1 -0
  302. package/dist/tallies.js +129 -0
  303. package/dist/transfer.d.ts +0 -5
  304. package/dist/transfer.d.ts.map +1 -1
  305. package/dist/turn.d.ts +9 -0
  306. package/dist/turn.d.ts.map +1 -0
  307. package/dist/turn.js +75 -0
  308. package/dist/validation.d.ts +29 -0
  309. package/dist/validation.d.ts.map +1 -0
  310. package/dist/validation.js +104 -0
  311. package/dist/windows.d.ts +11 -0
  312. package/dist/windows.d.ts.map +1 -0
  313. package/dist/windows.js +16 -0
  314. package/dist/wire.d.ts +189 -37
  315. package/dist/wire.d.ts.map +1 -1
  316. package/dist/wire.js +77 -33
  317. package/package.json +27 -15
  318. package/AGENTS.md +0 -244
  319. package/dist/attachment.d.ts +0 -3
  320. package/dist/attachment.d.ts.map +0 -1
  321. package/dist/attachment.js +0 -8
  322. package/dist/read-side.d.ts +0 -18
  323. package/dist/read-side.d.ts.map +0 -1
  324. package/dist/read-side.js +0 -433
package/dist/memory.js CHANGED
@@ -1,7 +1,12 @@
1
+ import { definitionAt, documentFacts, parse } from '@agentshouse/mdmodel';
2
+ import { NO_ROOM_TYPES, schemaTypes } from './attached-model.js';
1
3
  import { sameChange } from './overlay.js';
4
+ const ATTACHMENTS = 'attachments';
5
+ function lastName(path) {
6
+ return path.slice(path.lastIndexOf('/') + 1);
7
+ }
2
8
  const FIXTURE_RETENTION = {
3
9
  history: { kind: 'duration', seconds: 1 },
4
- outcome: 1,
5
10
  refreshHorizon: 1,
6
11
  };
7
12
  function declaredRetention(value) {
@@ -15,12 +20,7 @@ function declaredRetention(value) {
15
20
  }
16
21
  const MODEL_ABSENT = { kind: 'model-unavailable', reason: 'not-readable' };
17
22
  function modelsOf(room) {
18
- return {
19
- collection: room.model ?? MODEL_ABSENT,
20
- ...(room.typedSelection === undefined
21
- ? {}
22
- : { selection: room.selectionModel ?? MODEL_ABSENT }),
23
- };
23
+ return { collection: room.model ?? MODEL_ABSENT };
24
24
  }
25
25
  function changedModels(room, from) {
26
26
  const now = modelsOf(room);
@@ -53,12 +53,16 @@ export function createMemoryAdapter(options = {}) {
53
53
  const listeners = new Set();
54
54
  const modeObservers = new Set();
55
55
  const scripted = new Map();
56
- const unsealed = new Map();
57
- const sealed = new Set();
56
+ const sentTurns = new Map();
58
57
  const historyPageSize = options.historyPageSize;
59
- let held = [];
58
+ const attached = new Map();
59
+ const linked = new WeakMap();
60
+ const carried = new Map();
60
61
  let expiring = [];
62
+ let openings = 0;
63
+ const declaredRooms = new Set();
61
64
  let replicated = [];
65
+ let heldCursor = null;
62
66
  let issued = 0;
63
67
  function scriptConversations(entries) {
64
68
  scripted.clear();
@@ -86,8 +90,50 @@ export function createMemoryAdapter(options = {}) {
86
90
  const wanted = ordinals.get(`${locator}\u0000${target}`);
87
91
  return held !== undefined && wanted !== undefined && held >= wanted;
88
92
  }
93
+ function heldBlob(room, path) {
94
+ return attached.get(`${room.locator}\u0000${path}`) ?? room.blobs?.[path];
95
+ }
96
+ function freePath(room, name) {
97
+ const dot = name.lastIndexOf('.');
98
+ const stem = dot > 0 ? name.slice(0, dot) : name;
99
+ const extension = dot > 0 ? name.slice(dot) : '';
100
+ for (let count = 1;; count += 1) {
101
+ const path = `${ATTACHMENTS}/${count === 1 ? stem : `${stem}-${count}`}${extension}`;
102
+ if (heldBlob(room, path) === undefined && room.documents?.[path] === undefined)
103
+ return path;
104
+ }
105
+ }
106
+ const saved = new WeakMap();
107
+ function factsAt(room, path, content) {
108
+ const types = schemaTypes(room.model?.kind === 'model' ? room.model.snapshot.schema : null, NO_ROOM_TYPES);
109
+ let held = saved.get(types);
110
+ if (held === undefined) {
111
+ held = new Map();
112
+ saved.set(types, held);
113
+ }
114
+ const key = `${path}\u0000${content}`;
115
+ if (!held.has(key)) {
116
+ const facts = documentFacts(path, parse(content, path, definitionAt({ types }, path, options.typedPaths)), {
117
+ types,
118
+ });
119
+ held.set(key, facts === null ? null : JSON.parse(JSON.stringify(facts)));
120
+ }
121
+ return held.get(key);
122
+ }
123
+ function factsIn(room, paths) {
124
+ const facts = {};
125
+ for (const path of paths) {
126
+ const content = room.documents?.[path];
127
+ const held = room.facts?.[path] ?? (content === undefined ? null : factsAt(room, path, content));
128
+ if (held !== null)
129
+ facts[path] = held;
130
+ }
131
+ return facts;
132
+ }
89
133
  function retain(entries) {
90
134
  for (const room of entries) {
135
+ for (const [path, content] of Object.entries(room.documents ?? {}))
136
+ factsAt(room, path, content);
91
137
  note(room.locator, room);
92
138
  const versions = served.get(room.locator) ?? new Map();
93
139
  versions.set(room.roomVersion, room);
@@ -103,39 +149,61 @@ export function createMemoryAdapter(options = {}) {
103
149
  roomVersion: room.roomVersion,
104
150
  operations: room.operations,
105
151
  replica: room.replica,
106
- ...(room.typedSelection === undefined ? {} : { typedSelection: room.typedSelection }),
152
+ typedSelection: room.typedSelection ?? null,
107
153
  providerOwnedPaths: room.providerOwnedPaths,
154
+ authoredPaths: room.authoredPaths ?? ['**'],
108
155
  };
109
156
  }
110
- function page(room, from) {
157
+ function page(room, after) {
111
158
  const paths = Object.keys(room.documents ?? {}).sort();
159
+ const opening = after === undefined;
160
+ const from = opening ? 0 : paths.filter((path) => path <= after).length;
112
161
  const size = pageSize ?? paths.length;
113
162
  const taken = paths.slice(from, from + size);
114
163
  const next = from + taken.length;
115
- const targets = from === 0 ? (room.binaryTargets ?? []) : [];
164
+ const targets = opening ? Object.keys(room.binaryFiles ?? {}) : [];
116
165
  return {
117
166
  kind: 'bootstrap',
118
167
  roomVersion: room.roomVersion,
119
- ...(from === 0 ? { models: modelsOf(room) } : {}),
168
+ ...(opening ? { models: modelsOf(room) } : {}),
120
169
  documents: named(room.documents ?? {}, taken),
121
- revisions: named(room.revisions ?? {}, taken),
170
+ facts: factsIn(room, taken),
171
+ revisions: named(room.revisions ?? {}, [...taken, ...targets]),
172
+ ...(room.fileIds === undefined
173
+ ? {}
174
+ : { fileIds: named(room.fileIds, [...taken, ...targets]) }),
175
+ ...(room.created === undefined
176
+ ? {}
177
+ : { created: named(room.created, [...taken, ...targets]) }),
122
178
  changes: named(room.changes ?? {}, [...taken, ...targets]),
123
- binaryTargets: targets,
124
- ...(from === 0 && room.attachments !== undefined ? { attachments: room.attachments } : {}),
125
- ...(next < paths.length ? { pageToken: String(next) } : {}),
179
+ binaryFiles: named(room.binaryFiles ?? {}, targets),
180
+ ...(opening && room.folders !== undefined ? { folders: room.folders } : {}),
181
+ ...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
126
182
  };
127
183
  }
128
- function advancement(room, from, at) {
184
+ function foldersMoved(room, from) {
185
+ const now = new Set(room.folders ?? []);
186
+ const before = new Set(from.folders ?? []);
187
+ const folders = [...now].filter((folder) => !before.has(folder)).sort();
188
+ const folderRemovals = [...before].filter((folder) => !now.has(folder)).sort();
189
+ return {
190
+ ...(folders.length === 0 ? {} : { folders }),
191
+ ...(folderRemovals.length === 0 ? {} : { folderRemovals }),
192
+ };
193
+ }
194
+ function advancement(room, from, at, whole = false) {
129
195
  const current = room.documents ?? {};
130
196
  const previous = from.documents ?? {};
131
- const currentTargets = new Set(room.binaryTargets ?? []);
132
- const previousTargets = new Set(from.binaryTargets ?? []);
197
+ const currentTargets = new Set(Object.keys(room.binaryFiles ?? {}));
198
+ const previousTargets = new Set(Object.keys(from.binaryFiles ?? {}));
133
199
  const headMoved = (path) => room.revisions?.[path] !== from.revisions?.[path] ||
200
+ room.fileIds?.[path] !== from.fileIds?.[path] ||
201
+ room.created?.[path] !== from.created?.[path] ||
134
202
  !sameChange(room.changes?.[path], from.changes?.[path]);
135
203
  const changed = Object.keys(current)
136
204
  .filter((path) => current[path] !== previous[path] || headMoved(path))
137
205
  .sort();
138
- const size = pageSize ?? changed.length;
206
+ const size = whole ? changed.length : (pageSize ?? changed.length);
139
207
  const taken = changed.slice(at, at + size);
140
208
  const next = at + taken.length;
141
209
  const opening = at === 0;
@@ -145,27 +213,52 @@ export function createMemoryAdapter(options = {}) {
145
213
  const targets = opening
146
214
  ? [...currentTargets].filter((target) => !previousTargets.has(target) || headMoved(target))
147
215
  : [];
148
- const attachments = room.attachments ?? [];
149
- const declared = opening && JSON.stringify(attachments) !== JSON.stringify(from.attachments ?? []);
150
216
  const models = opening ? changedModels(room, from) : undefined;
151
217
  return {
152
218
  kind: 'net-advancement',
153
219
  roomVersion: room.roomVersion,
154
220
  ...(models === undefined ? {} : { models }),
155
221
  documents: named(current, taken),
156
- revisions: named(room.revisions ?? {}, taken),
222
+ facts: factsIn(room, taken),
223
+ revisions: named(room.revisions ?? {}, [...taken, ...targets]),
224
+ ...(room.fileIds === undefined
225
+ ? {}
226
+ : { fileIds: named(room.fileIds, [...taken, ...targets]) }),
227
+ ...(room.created === undefined
228
+ ? {}
229
+ : { created: named(room.created, [...taken, ...targets]) }),
157
230
  changes: named(room.changes ?? {}, [...taken, ...targets]),
158
- binaryTargets: targets,
231
+ binaryFiles: named(room.binaryFiles ?? {}, targets),
232
+ ...(opening ? foldersMoved(room, from) : {}),
159
233
  removals: opening
160
234
  ? [
161
235
  ...Object.keys(previous).filter((path) => !(path in current) && !currentTargets.has(path)),
162
236
  ...[...previousTargets].filter((target) => !currentTargets.has(target) && !(target in current)),
163
237
  ].sort()
164
238
  : [],
165
- ...(declared ? { attachments } : {}),
166
239
  ...(pageToken === undefined ? {} : { pageToken }),
167
240
  };
168
241
  }
242
+ function carry(locator) {
243
+ const at = carried.get(locator);
244
+ const current = rooms.find((entry) => entry.locator === locator);
245
+ if (at === undefined || current === undefined || current.roomVersion === at)
246
+ return;
247
+ const from = served.get(locator)?.get(at);
248
+ carried.set(locator, current.roomVersion);
249
+ if (from === undefined)
250
+ return;
251
+ const page = advancement(current, from, 0, true);
252
+ for (const observer of observers) {
253
+ observer({
254
+ kind: 'room-change',
255
+ locator,
256
+ from: at,
257
+ roomVersion: current.roomVersion,
258
+ read: async () => page,
259
+ });
260
+ }
261
+ }
169
262
  function pageOf(conversation, after) {
170
263
  const messages = conversation.messages ?? [];
171
264
  const first = typeof after === 'string' ? messages.findIndex((message) => message.position > after) : 0;
@@ -180,16 +273,13 @@ export function createMemoryAdapter(options = {}) {
180
273
  : {}),
181
274
  };
182
275
  }
183
- function historiesOf(input) {
184
- const asked = input?.conversations;
185
- if (!Array.isArray(asked))
186
- return { kind: 'rejected', code: 'invalid_request', fields: {} };
276
+ function historiesOf(request) {
187
277
  const histories = [];
188
- for (const entry of asked) {
189
- const conversation = typeof entry.conversation === 'string' ? scripted.get(entry.conversation) : undefined;
278
+ for (const entry of request.conversations) {
279
+ const conversation = scripted.get(entry.conversation);
190
280
  if (conversation === undefined)
191
281
  continue;
192
- const outcome = conversation.outcomes?.['conversation.history'];
282
+ const outcome = conversation.outcomes?.history;
193
283
  if (outcome !== undefined)
194
284
  return outcome;
195
285
  histories.push(pageOf(conversation, entry.after));
@@ -200,44 +290,47 @@ export function createMemoryAdapter(options = {}) {
200
290
  function conversationAction(request) {
201
291
  const name = request.name;
202
292
  const input = (request.input ?? {});
203
- if (name === 'conversation.history')
204
- return historiesOf(request.input);
205
- if (name === 'conversation.create') {
293
+ if (name === 'conversations/create') {
206
294
  issued += 1;
207
295
  const conversation = `conversation-${issued}`;
208
296
  scripted.set(conversation, { conversation });
209
- return { kind: 'action', result: { conversation } };
297
+ return { kind: 'action', result: { conversation_id: conversation } };
210
298
  }
211
- const named = typeof input.conversation === 'string' ? input.conversation : '';
299
+ const named = typeof input.conversation_id === 'string' ? input.conversation_id : '';
212
300
  const conversation = scripted.get(named);
213
301
  if (conversation === undefined) {
214
- return { kind: 'rejected', code: 'unknown-conversation', fields: { conversation: named } };
302
+ return {
303
+ kind: 'rejected',
304
+ code: 'unknown-conversation',
305
+ fields: { conversation: named },
306
+ retryable: false,
307
+ };
215
308
  }
216
309
  const outcome = conversation.outcomes?.[name];
217
310
  if (outcome !== undefined)
218
311
  return outcome;
219
- if (name === 'conversation.send') {
312
+ if (name === 'conversations/send') {
313
+ const operation = typeof input.operation_id === 'string' ? input.operation_id : null;
314
+ const answered = operation === null ? undefined : sentTurns.get(operation);
315
+ if (answered !== undefined)
316
+ return { kind: 'action', result: { message_id: answered } };
220
317
  issued += 1;
221
318
  const turn = `turn-${issued}`;
222
- unsealed.set(turn, named);
223
- return { kind: 'action', result: { turn } };
319
+ if (operation !== null)
320
+ sentTurns.set(operation, turn);
321
+ return { kind: 'action', result: { message_id: turn } };
224
322
  }
225
- if (name === 'conversation.cancel') {
226
- const turn = typeof input.turn === 'string' ? input.turn : '';
227
- if (sealed.has(turn) || !unsealed.has(turn)) {
228
- return { kind: 'rejected', code: 'turn-sealed', fields: { turn } };
229
- }
230
- unsealed.delete(turn);
231
- return { kind: 'action', result: { turn, cancelled: true } };
232
- }
233
- if (name === 'conversation.delete')
323
+ if (name === 'conversations/delete')
234
324
  scripted.delete(named);
235
- return { kind: 'action', result: { conversation: named } };
325
+ return { kind: 'action', result: { conversation_id: named } };
236
326
  }
237
327
  function announceList() {
238
- const entries = [...scripted.values()].flatMap(({ conversation, listed }) => listed === undefined ? [] : [{ conversation, ...listed }]);
239
- for (const listener of listeners)
240
- listener({ kind: 'list', entries });
328
+ const entries = [...scripted.values()].flatMap(({ conversation, listed, messages = [] }) => listed === undefined
329
+ ? []
330
+ : [{ conversation, ...listed, newest: messages.at(-1)?.position ?? null }]);
331
+ for (const listener of listeners) {
332
+ listener({ kind: 'list', entries, whole: true, more: false, cursor: null });
333
+ }
241
334
  }
242
335
  function discovery() {
243
336
  return {
@@ -246,9 +339,45 @@ export function createMemoryAdapter(options = {}) {
246
339
  capabilities,
247
340
  providerLimits,
248
341
  retention,
342
+ ...(options.member === undefined ? {} : { member: options.member }),
249
343
  };
250
344
  }
345
+ function discovered() {
346
+ return resolveScript(scripts.discover, discovery, undefined).then((answer) => {
347
+ if (answer.kind === 'discovery')
348
+ for (const room of answer.rooms)
349
+ note(room.locator, room);
350
+ return answer;
351
+ });
352
+ }
353
+ function opened(notify) {
354
+ const opening = ++openings;
355
+ notify({ kind: 'opened' });
356
+ void discovered()
357
+ .catch(() => ({ kind: 'transport-uncertainty' }))
358
+ .then((answer) => {
359
+ if (opening !== openings)
360
+ return;
361
+ if (answer.kind !== 'discovery') {
362
+ openings += 1;
363
+ carried.clear();
364
+ const revoked = answer.kind === 'revoked-authorization';
365
+ notify({ kind: 'closed', revoked, lost: !revoked, authorityChanged: false });
366
+ return;
367
+ }
368
+ declaredRooms.clear();
369
+ for (const room of answer.rooms)
370
+ declaredRooms.add(room.locator);
371
+ notify({ kind: 'discovered', discovery: answer });
372
+ });
373
+ }
374
+ function emitAll(event) {
375
+ for (const observer of observers)
376
+ observer(event);
377
+ }
251
378
  return {
379
+ ...(options.roomTypes === undefined ? {} : { roomTypes: options.roomTypes }),
380
+ ...(options.typedPaths === undefined ? {} : { typedPaths: options.typedPaths }),
252
381
  setRooms(next) {
253
382
  rooms = [...next];
254
383
  retain(rooms);
@@ -257,26 +386,37 @@ export function createMemoryAdapter(options = {}) {
257
386
  scriptConversations(next);
258
387
  },
259
388
  open() {
389
+ carried.clear();
260
390
  announceList();
261
- for (const observer of observers)
262
- observer({ kind: 'opened' });
391
+ opened(emitAll);
263
392
  },
264
- close(revoked = false) {
265
- for (const observer of observers)
266
- observer({ kind: 'closed', revoked });
393
+ close({ revoked = false, lost = !revoked, authorityChanged = false } = {}) {
394
+ openings += 1;
395
+ carried.clear();
396
+ emitAll({ kind: 'closed', revoked, lost, authorityChanged });
267
397
  },
268
398
  expire(locators) {
269
399
  expiring = [...locators];
270
400
  },
271
- notifyRoomVersion({ locator, roomVersion }) {
272
- for (const observer of observers)
273
- observer({ kind: 'room-version', locator, roomVersion });
401
+ notifyRoomVersion({ locator }) {
402
+ carry(locator);
403
+ },
404
+ notifyAuthorityChanged(locators) {
405
+ const named = new Set(locators ?? [...declaredRooms, ...rooms.map((room) => room.locator)]);
406
+ const listed = rooms.filter((room) => named.has(room.locator));
407
+ const left = [...named].filter((locator) => !listed.some((room) => room.locator === locator));
408
+ for (const room of listed)
409
+ declaredRooms.add(room.locator);
410
+ for (const locator of left)
411
+ declaredRooms.delete(locator);
412
+ emitAll({
413
+ kind: 'authority-changed',
414
+ rooms: listed.map(declared),
415
+ left,
416
+ ...(options.member === undefined ? {} : { member: options.member }),
417
+ });
274
418
  },
275
419
  notifyConversation(event) {
276
- if (event.kind === 'accepted-message') {
277
- sealed.add(event.message.turn);
278
- unsealed.delete(event.message.turn);
279
- }
280
420
  for (const listener of listeners)
281
421
  listener(event);
282
422
  },
@@ -285,21 +425,31 @@ export function createMemoryAdapter(options = {}) {
285
425
  observer(mode);
286
426
  },
287
427
  heldRooms() {
288
- return held;
428
+ return [...carried.keys()].sort();
289
429
  },
290
430
  replicatedConversations() {
291
431
  return replicated;
292
432
  },
433
+ heldConversationCursor() {
434
+ return heldCursor;
435
+ },
293
436
  conversations: {
294
437
  replicate(next) {
295
438
  replicated = [...next];
296
439
  },
440
+ hold(cursor) {
441
+ heldCursor = cursor;
442
+ },
297
443
  observe(notify) {
298
444
  listeners.add(notify);
299
445
  return () => {
300
446
  listeners.delete(notify);
301
447
  };
302
448
  },
449
+ history: (request) => Promise.resolve(historiesOf(request)),
450
+ ...(options.agents === undefined
451
+ ? {}
452
+ : { agents: () => Promise.resolve(structuredClone(options.agents)) }),
303
453
  },
304
454
  serviceMode: {
305
455
  observe(notify) {
@@ -311,29 +461,30 @@ export function createMemoryAdapter(options = {}) {
311
461
  },
312
462
  roomStream: {
313
463
  hold(asked) {
314
- held = asked.map((room) => room.locator);
315
- const expired = expiring.filter((locator) => held.includes(locator));
316
- expiring = [];
317
- const moved = asked.flatMap((room) => {
464
+ const named = asked.map((room) => room.locator);
465
+ const unknown = asked.flatMap((room) => {
318
466
  const current = rooms.find((entry) => entry.locator === room.locator);
467
+ const version = room.roomVersion;
319
468
  return current === undefined ||
320
- expired.includes(room.locator) ||
321
- current.roomVersion === room.roomVersion
469
+ (version !== null &&
470
+ (current.roomVersion === version || served.get(room.locator)?.has(version) === true))
322
471
  ? []
323
- : [{ locator: room.locator, roomVersion: current.roomVersion }];
472
+ : [room.locator];
324
473
  });
474
+ const expired = [
475
+ ...new Set([...expiring.filter((locator) => named.includes(locator)), ...unknown]),
476
+ ];
477
+ expiring = expiring.filter((locator) => !named.includes(locator));
325
478
  queueMicrotask(() => {
326
- for (const observer of observers) {
327
- for (const room of moved)
328
- observer({ kind: 'room-version', ...room });
329
- observer({ kind: 'opening', expired });
479
+ for (const room of asked) {
480
+ if (expired.includes(room.locator) || room.roomVersion === null)
481
+ carried.delete(room.locator);
482
+ else {
483
+ carried.set(room.locator, room.roomVersion);
484
+ carry(room.locator);
485
+ }
330
486
  }
331
- });
332
- },
333
- reopen() {
334
- queueMicrotask(() => {
335
- for (const observer of observers)
336
- observer({ kind: 'closed', revoked: false });
487
+ emitAll({ kind: 'caught-up', expired });
337
488
  });
338
489
  },
339
490
  observe(notify) {
@@ -342,11 +493,14 @@ export function createMemoryAdapter(options = {}) {
342
493
  if (!observers.has(notify))
343
494
  return;
344
495
  if (options.unopened === true) {
345
- notify({ kind: 'closed', revoked: false });
496
+ notify({ kind: 'closed', revoked: false, lost: true, authorityChanged: false });
346
497
  return;
347
498
  }
348
499
  announceList();
349
- notify({ kind: 'opened' });
500
+ opened((event) => {
501
+ if (observers.has(notify))
502
+ notify(event);
503
+ });
350
504
  });
351
505
  return () => {
352
506
  observers.delete(notify);
@@ -363,12 +517,7 @@ export function createMemoryAdapter(options = {}) {
363
517
  return resolveScript(scripts.authorize, () => ({}), undefined);
364
518
  },
365
519
  async discover(_authorization) {
366
- return resolveScript(scripts.discover, discovery, undefined).then((answer) => {
367
- if (answer.kind === 'discovery')
368
- for (const room of answer.rooms)
369
- note(room.locator, room);
370
- return answer;
371
- });
520
+ return discovered();
372
521
  },
373
522
  reached,
374
523
  follows(locator, roomVersion, next) {
@@ -385,7 +534,7 @@ export function createMemoryAdapter(options = {}) {
385
534
  if (room === undefined) {
386
535
  return { kind: 'room-not-readable', locator: request.locator };
387
536
  }
388
- return page(room, request.pageToken === undefined ? 0 : Number(request.pageToken));
537
+ return page(room, request.pageToken);
389
538
  }, request).then((answer) => note(request.locator, answer));
390
539
  },
391
540
  async refresh(_authorization, request) {
@@ -418,8 +567,20 @@ export function createMemoryAdapter(options = {}) {
418
567
  if (room === undefined) {
419
568
  return { kind: 'room-not-readable', locator: request.locator };
420
569
  }
421
- return { kind: 'rejected', code: 'unscripted-mutation', fields: {}, affected: {} };
422
- }, request).then((answer) => note(request.locator, answer));
570
+ return {
571
+ kind: 'rejected',
572
+ code: 'unscripted-mutation',
573
+ fields: {},
574
+ retryable: false,
575
+ affected: {},
576
+ };
577
+ }, request).then((answer) => {
578
+ const destination = request.changeBatch.between?.destination.room;
579
+ if (answer.kind === 'accepted' && answer.destination !== undefined && destination) {
580
+ note(destination, answer.destination);
581
+ }
582
+ return note(request.locator, answer);
583
+ });
423
584
  },
424
585
  async history(_authorization, request) {
425
586
  return resolveScript(scripts.history, () => {
@@ -433,11 +594,46 @@ export function createMemoryAdapter(options = {}) {
433
594
  };
434
595
  }, request);
435
596
  },
597
+ async binary(_authorization, request) {
598
+ return resolveScript(scripts.binary, () => {
599
+ const room = rooms.find((entry) => entry.locator === request.locator);
600
+ if (room === undefined)
601
+ return { kind: 'room-not-readable', locator: request.locator };
602
+ const blob = heldBlob(room, request.path);
603
+ return blob === undefined
604
+ ? { kind: 'rejected', code: 'not_found', fields: {}, retryable: false }
605
+ : { kind: 'binary', body: blob.stream(), mediaType: blob.type };
606
+ }, request);
607
+ },
608
+ async link(_authorization, request) {
609
+ return resolveScript(scripts.link, () => {
610
+ const room = rooms.find((entry) => entry.locator === request.locator);
611
+ if (room === undefined)
612
+ return { kind: 'room-not-readable', locator: request.locator };
613
+ const blob = heldBlob(room, request.path);
614
+ if (blob === undefined) {
615
+ return { kind: 'rejected', code: 'not_found', fields: {}, retryable: false };
616
+ }
617
+ const url = linked.get(blob) ?? URL.createObjectURL(blob);
618
+ linked.set(blob, url);
619
+ return { kind: 'link', url, name: lastName(request.path), mediaType: blob.type };
620
+ }, request);
621
+ },
622
+ async attach(_authorization, request) {
623
+ return resolveScript(scripts.attach, () => {
624
+ const room = rooms.find((entry) => entry.locator === request.locator);
625
+ if (room === undefined)
626
+ return { kind: 'room-not-readable', locator: request.locator };
627
+ const path = freePath(room, request.name);
628
+ attached.set(`${room.locator}\u0000${path}`, request.blob);
629
+ return { kind: 'attached', path, revision: `attached-${attached.size}` };
630
+ }, request);
631
+ },
436
632
  async action(_authorization, request) {
437
633
  return resolveScript(scripts.action, () => {
438
- if (request.name.startsWith('conversation.'))
634
+ if (request.name.startsWith('conversations/'))
439
635
  return conversationAction(request);
440
- return { kind: 'rejected', code: 'unscripted-action', fields: {} };
636
+ return { kind: 'rejected', code: 'unscripted-action', fields: {}, retryable: false };
441
637
  }, request).then((answer) => {
442
638
  if (answer.kind === 'action' && answer.at !== undefined)
443
639
  note(answer.at.locator, answer.at);
@@ -0,0 +1,49 @@
1
+ import type { AcceptedMessage } from './adapter.js';
2
+ import type { Connection } from './tables.js';
3
+ export declare const MESSAGE_TABLES: readonly string[];
4
+ export declare const ROWS = "WITH chosen AS (\n SELECT listed.value AS conversation,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'assistant' ORDER BY position DESC, identity DESC LIMIT 1) AS answer,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND text <> '' ORDER BY position DESC, identity DESC LIMIT 1) AS said,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' ORDER BY position, identity LIMIT 1) AS opened,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' AND json_extract(message, '$.waiting') = 1 ORDER BY position, identity LIMIT 1) AS asking\n FROM json_each(?) AS listed\n )\n SELECT chosen.conversation AS conversation,\n substr(said.text, 1, 512) AS said_text,\n json_extract(said.message, '$.role') AS said_role,\n json_extract(said.message, '$.accepted_at') AS said_at,\n substr(json_extract(answer.message, '$.failure'), 1, 512) AS failure,\n json_extract(opened.message, '$.source') AS opened_source,\n json_extract(opened.message, '$.sender') AS opened_sender,\n asking.identity AS asking_identity,\n asking.text AS asking_text,\n json_extract(asking.message, '$.accepted_at') AS asking_at,\n json_extract(asking.message, '$.source') AS asking_source,\n json_extract(asking.message, '$.sender') AS asking_sender\n FROM chosen\n LEFT JOIN conversation_messages said ON said.id = chosen.said\n LEFT JOIN conversation_messages answer ON answer.id = chosen.answer\n LEFT JOIN conversation_messages opened ON opened.id = chosen.opened\n LEFT JOIN conversation_messages asking ON asking.id = chosen.asking";
5
+ export type HeldConversation = {
6
+ readonly conversation: string;
7
+ readonly read: string | null | undefined;
8
+ readonly partial: boolean;
9
+ };
10
+ export type MessageWindow = {
11
+ readonly messages: AcceptedMessage[];
12
+ readonly more: boolean;
13
+ };
14
+ export type HeldSource = {
15
+ readonly source: unknown;
16
+ readonly sender: string | null;
17
+ };
18
+ export type HeldRow = {
19
+ readonly conversation: string;
20
+ readonly said: {
21
+ readonly text: string;
22
+ readonly role: string | null;
23
+ readonly at: string | null;
24
+ } | null;
25
+ readonly failure: string | null;
26
+ readonly opened: HeldSource | null;
27
+ readonly asking: (HeldSource & {
28
+ readonly identity: string;
29
+ readonly text: string;
30
+ readonly at: string | null;
31
+ }) | null;
32
+ };
33
+ export type ConversationWrite = {
34
+ readonly conversation: string;
35
+ readonly messages: readonly AcceptedMessage[];
36
+ readonly read?: {
37
+ readonly at: string | null;
38
+ readonly partial: boolean;
39
+ };
40
+ };
41
+ export declare function heldConversations(connection: Connection, conversations: readonly string[] | null): HeldConversation[];
42
+ export declare function keptMessages(connection: Connection, { conversation, messages, read }: ConversationWrite): null;
43
+ export declare function messageWindow(connection: Connection, conversation: string, limit: number, before: readonly [string, string] | null, phrase: string | null): MessageWindow;
44
+ export declare function messageCount(connection: Connection, conversation: string, phrase: string | null): number;
45
+ export declare function conversationRows(connection: Connection, conversations: readonly string[]): HeldRow[];
46
+ export declare function turnArrived(connection: Connection, conversation: string, turn: string): boolean;
47
+ export declare function droppedMessages(connection: Connection, conversations: readonly string[]): void;
48
+ export declare function forgottenMessages(connection: Connection): void;
49
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAM1D,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAO3C,CAAC;AAQF,eAAO,MAAM,IAAI,qwDAwBqD,CAAC;AAEvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7F,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;KAC5B,GAAG,IAAI,CAAC;IACT,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,MAAM,EACX,CAAC,UAAU,GAAG;QACZ,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;KAC5B,CAAC,GACF,IAAI,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C,QAAQ,CAAC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAC3E,CAAC;AAMF,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GACtC,gBAAgB,EAAE,CA0BpB;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,iBAAiB,GAClD,IAAI,CAqBN;AAkBD,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EACxC,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,aAAa,CAWf;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,MAAM,CAOR;AAaD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,OAAO,EAAE,CAuBX;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAO/F;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAU9F;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAG9D"}