@agentshouse/mdruntime 0.1.0-cd3486bd400ed → 0.1.0-cd35ccee27a19

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 (343) hide show
  1. package/README.md +22 -10
  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 +195 -91
  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.map +1 -1
  14. package/dist/attempt.js +14 -1
  15. package/dist/binary.d.ts +18 -0
  16. package/dist/binary.d.ts.map +1 -0
  17. package/dist/binary.js +8 -0
  18. package/dist/bootstrap.d.ts +31 -11
  19. package/dist/bootstrap.d.ts.map +1 -1
  20. package/dist/bootstrap.js +311 -92
  21. package/dist/cell.d.ts +6 -0
  22. package/dist/cell.d.ts.map +1 -0
  23. package/dist/cell.js +9 -0
  24. package/dist/chain.d.ts +12 -0
  25. package/dist/chain.d.ts.map +1 -0
  26. package/dist/chain.js +64 -0
  27. package/dist/change-set.d.ts +13 -14
  28. package/dist/change-set.d.ts.map +1 -1
  29. package/dist/change-set.js +17 -62
  30. package/dist/change.d.ts +42 -0
  31. package/dist/change.d.ts.map +1 -1
  32. package/dist/change.js +36 -0
  33. package/dist/chat-types.d.ts +5 -0
  34. package/dist/chat-types.d.ts.map +1 -0
  35. package/dist/chat-types.js +13 -0
  36. package/dist/client.d.ts +49 -21
  37. package/dist/client.d.ts.map +1 -1
  38. package/dist/client.js +131 -17
  39. package/dist/collection.d.ts +31 -9
  40. package/dist/collection.d.ts.map +1 -1
  41. package/dist/collection.js +49 -80
  42. package/dist/compile.d.ts +16 -0
  43. package/dist/compile.d.ts.map +1 -0
  44. package/dist/compile.js +711 -0
  45. package/dist/connection.d.ts +8 -111
  46. package/dist/connection.d.ts.map +1 -1
  47. package/dist/connection.js +107 -2218
  48. package/dist/context.d.ts +2 -0
  49. package/dist/context.d.ts.map +1 -0
  50. package/dist/context.js +7 -0
  51. package/dist/conversation-live.d.ts +136 -0
  52. package/dist/conversation-live.d.ts.map +1 -0
  53. package/dist/conversation-live.js +249 -0
  54. package/dist/conversation-row.d.ts +33 -0
  55. package/dist/conversation-row.d.ts.map +1 -0
  56. package/dist/conversation-row.js +53 -0
  57. package/dist/conversation.d.ts +71 -42
  58. package/dist/conversation.d.ts.map +1 -1
  59. package/dist/conversation.js +1068 -586
  60. package/dist/declaration.d.ts +10 -0
  61. package/dist/declaration.d.ts.map +1 -0
  62. package/dist/declaration.js +24 -0
  63. package/dist/digest.d.ts +7 -0
  64. package/dist/digest.d.ts.map +1 -0
  65. package/dist/digest.js +113 -0
  66. package/dist/discovery.d.ts +10 -0
  67. package/dist/discovery.d.ts.map +1 -0
  68. package/dist/discovery.js +148 -0
  69. package/dist/durability.d.ts +19 -1
  70. package/dist/durability.d.ts.map +1 -1
  71. package/dist/durability.js +5 -0
  72. package/dist/entry.d.ts +20 -0
  73. package/dist/entry.d.ts.map +1 -0
  74. package/dist/entry.js +161 -0
  75. package/dist/expectation.d.ts +4 -2
  76. package/dist/expectation.d.ts.map +1 -1
  77. package/dist/expectation.js +33 -11
  78. package/dist/failure.d.ts +1 -0
  79. package/dist/failure.d.ts.map +1 -1
  80. package/dist/failure.js +3 -0
  81. package/dist/figures.d.ts +49 -0
  82. package/dist/figures.d.ts.map +1 -0
  83. package/dist/figures.js +197 -0
  84. package/dist/file.d.ts +2 -19
  85. package/dist/file.d.ts.map +1 -1
  86. package/dist/file.js +7 -122
  87. package/dist/holdings.d.ts +29 -0
  88. package/dist/holdings.d.ts.map +1 -0
  89. package/dist/holdings.js +95 -0
  90. package/dist/host.d.ts +28 -4
  91. package/dist/host.d.ts.map +1 -1
  92. package/dist/host.js +163 -19
  93. package/dist/identity.d.ts +1 -0
  94. package/dist/identity.d.ts.map +1 -1
  95. package/dist/identity.js +3 -0
  96. package/dist/index.d.ts +37 -10
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +15 -0
  99. package/dist/install.d.ts +54 -0
  100. package/dist/install.d.ts.map +1 -0
  101. package/dist/install.js +538 -0
  102. package/dist/lifecycle.d.ts +7 -0
  103. package/dist/lifecycle.d.ts.map +1 -0
  104. package/dist/lifecycle.js +272 -0
  105. package/dist/listing.d.ts +48 -0
  106. package/dist/listing.d.ts.map +1 -0
  107. package/dist/listing.js +139 -0
  108. package/dist/live.d.ts +23 -0
  109. package/dist/live.d.ts.map +1 -0
  110. package/dist/live.js +165 -0
  111. package/dist/locks.d.ts +7 -0
  112. package/dist/locks.d.ts.map +1 -0
  113. package/dist/locks.js +33 -0
  114. package/dist/log.d.ts +1 -0
  115. package/dist/log.d.ts.map +1 -1
  116. package/dist/lost.d.ts +5 -0
  117. package/dist/lost.d.ts.map +1 -0
  118. package/dist/lost.js +50 -0
  119. package/dist/media.d.ts +8 -0
  120. package/dist/media.d.ts.map +1 -0
  121. package/dist/media.js +218 -0
  122. package/dist/memory.d.ts +24 -8
  123. package/dist/memory.d.ts.map +1 -1
  124. package/dist/memory.js +289 -96
  125. package/dist/messages.d.ts +49 -0
  126. package/dist/messages.d.ts.map +1 -0
  127. package/dist/messages.js +150 -0
  128. package/dist/model.d.ts +11 -12
  129. package/dist/model.d.ts.map +1 -1
  130. package/dist/model.js +7 -15
  131. package/dist/models.d.ts +10 -0
  132. package/dist/models.d.ts.map +1 -0
  133. package/dist/models.js +156 -0
  134. package/dist/name.d.ts +4 -0
  135. package/dist/name.d.ts.map +1 -0
  136. package/dist/name.js +122 -0
  137. package/dist/observation.d.ts +22 -4
  138. package/dist/observation.d.ts.map +1 -1
  139. package/dist/observation.js +127 -26
  140. package/dist/opened.d.ts +22 -0
  141. package/dist/opened.d.ts.map +1 -0
  142. package/dist/opened.js +107 -0
  143. package/dist/opening.d.ts +4 -0
  144. package/dist/opening.d.ts.map +1 -0
  145. package/dist/opening.js +59 -0
  146. package/dist/outcome.d.ts +56 -5
  147. package/dist/outcome.d.ts.map +1 -1
  148. package/dist/outcome.js +49 -0
  149. package/dist/overlay.d.ts +17 -5
  150. package/dist/overlay.d.ts.map +1 -1
  151. package/dist/overlay.js +161 -187
  152. package/dist/page-metadata.d.ts +8 -0
  153. package/dist/page-metadata.d.ts.map +1 -0
  154. package/dist/page-metadata.js +19 -0
  155. package/dist/parts.d.ts +11 -0
  156. package/dist/parts.d.ts.map +1 -0
  157. package/dist/parts.js +21 -0
  158. package/dist/paths.d.ts +2 -0
  159. package/dist/paths.d.ts.map +1 -1
  160. package/dist/paths.js +26 -0
  161. package/dist/preparation.d.ts +20 -0
  162. package/dist/preparation.d.ts.map +1 -0
  163. package/dist/preparation.js +233 -0
  164. package/dist/presence.d.ts +52 -0
  165. package/dist/presence.d.ts.map +1 -0
  166. package/dist/presence.js +220 -0
  167. package/dist/queries.d.ts +16 -0
  168. package/dist/queries.d.ts.map +1 -0
  169. package/dist/queries.js +270 -0
  170. package/dist/query.d.ts +51 -183
  171. package/dist/query.d.ts.map +1 -1
  172. package/dist/query.js +3 -464
  173. package/dist/{chat/questions.d.ts → questions.d.ts} +5 -2
  174. package/dist/questions.d.ts.map +1 -0
  175. package/dist/{chat/questions.js → questions.js} +13 -2
  176. package/dist/queue.d.ts +40 -0
  177. package/dist/queue.d.ts.map +1 -0
  178. package/dist/queue.js +455 -0
  179. package/dist/reach.d.ts +21 -5
  180. package/dist/reach.d.ts.map +1 -1
  181. package/dist/reach.js +313 -72
  182. package/dist/react.d.ts +20 -6
  183. package/dist/react.d.ts.map +1 -1
  184. package/dist/react.js +17 -18
  185. package/dist/{chat/read.d.ts → read.d.ts} +2 -0
  186. package/dist/read.d.ts.map +1 -0
  187. package/dist/{chat/read.js → read.js} +4 -0
  188. package/dist/readiness.d.ts +49 -0
  189. package/dist/readiness.d.ts.map +1 -0
  190. package/dist/readiness.js +27 -0
  191. package/dist/reads.d.ts +37 -0
  192. package/dist/reads.d.ts.map +1 -0
  193. package/dist/reads.js +174 -0
  194. package/dist/recovery.d.ts +26 -0
  195. package/dist/recovery.d.ts.map +1 -0
  196. package/dist/recovery.js +232 -0
  197. package/dist/refresh.d.ts +17 -14
  198. package/dist/refresh.d.ts.map +1 -1
  199. package/dist/refresh.js +145 -58
  200. package/dist/refusal.d.ts +5 -0
  201. package/dist/refusal.d.ts.map +1 -0
  202. package/dist/refusal.js +57 -0
  203. package/dist/replica.d.ts +53 -33
  204. package/dist/replica.d.ts.map +1 -1
  205. package/dist/replica.js +348 -166
  206. package/dist/room-draft.d.ts +55 -9
  207. package/dist/room-draft.d.ts.map +1 -1
  208. package/dist/room-draft.js +262 -73
  209. package/dist/room-drafts.d.ts +24 -0
  210. package/dist/room-drafts.d.ts.map +1 -0
  211. package/dist/room-drafts.js +217 -0
  212. package/dist/rows.d.ts +30 -35
  213. package/dist/rows.d.ts.map +1 -1
  214. package/dist/rows.js +60 -126
  215. package/dist/runtime.d.ts +34 -0
  216. package/dist/runtime.d.ts.map +1 -0
  217. package/dist/runtime.js +1 -0
  218. package/dist/save.d.ts +44 -22
  219. package/dist/save.d.ts.map +1 -1
  220. package/dist/save.js +950 -169
  221. package/dist/saves.d.ts +32 -0
  222. package/dist/saves.d.ts.map +1 -0
  223. package/dist/saves.js +413 -0
  224. package/dist/search.d.ts +15 -55
  225. package/dist/search.d.ts.map +1 -1
  226. package/dist/search.js +10 -121
  227. package/dist/seed.d.ts +25 -0
  228. package/dist/seed.d.ts.map +1 -0
  229. package/dist/seed.js +145 -0
  230. package/dist/shared.d.ts +10 -0
  231. package/dist/shared.d.ts.map +1 -0
  232. package/dist/shared.js +339 -0
  233. package/dist/shown.d.ts +32 -0
  234. package/dist/shown.d.ts.map +1 -0
  235. package/dist/shown.js +290 -0
  236. package/dist/socket/admission.d.ts +7 -0
  237. package/dist/socket/admission.d.ts.map +1 -0
  238. package/dist/socket/admission.js +39 -0
  239. package/dist/socket/answers.d.ts +6 -0
  240. package/dist/socket/answers.d.ts.map +1 -0
  241. package/dist/socket/answers.js +20 -0
  242. package/dist/socket/lanes.d.ts +20 -0
  243. package/dist/socket/lanes.d.ts.map +1 -0
  244. package/dist/socket/lanes.js +77 -0
  245. package/dist/socket/reads.d.ts +10 -0
  246. package/dist/socket/reads.d.ts.map +1 -0
  247. package/dist/socket/reads.js +31 -0
  248. package/dist/socket/session.d.ts +38 -0
  249. package/dist/socket/session.d.ts.map +1 -0
  250. package/dist/socket/session.js +23 -0
  251. package/dist/socket.d.ts +67 -0
  252. package/dist/socket.d.ts.map +1 -0
  253. package/dist/socket.js +170 -0
  254. package/dist/source.d.ts +61 -0
  255. package/dist/source.d.ts.map +1 -0
  256. package/dist/source.js +82 -0
  257. package/dist/status.d.ts +5 -2
  258. package/dist/status.d.ts.map +1 -1
  259. package/dist/status.js +3 -7
  260. package/dist/store/installs.d.ts +30 -0
  261. package/dist/store/installs.d.ts.map +1 -0
  262. package/dist/store/installs.js +34 -0
  263. package/dist/store/readiness.d.ts +10 -0
  264. package/dist/store/readiness.d.ts.map +1 -0
  265. package/dist/store/readiness.js +52 -0
  266. package/dist/store/records.d.ts +212 -0
  267. package/dist/store/records.d.ts.map +1 -0
  268. package/dist/store/records.js +430 -0
  269. package/dist/store/room-held.d.ts +8 -0
  270. package/dist/store/room-held.d.ts.map +1 -0
  271. package/dist/store/room-held.js +17 -0
  272. package/dist/store/space.d.ts +11 -0
  273. package/dist/store/space.d.ts.map +1 -0
  274. package/dist/store/space.js +41 -0
  275. package/dist/store/watchers.d.ts +17 -0
  276. package/dist/store/watchers.d.ts.map +1 -0
  277. package/dist/store/watchers.js +56 -0
  278. package/dist/store/writes.d.ts +24 -0
  279. package/dist/store/writes.d.ts.map +1 -0
  280. package/dist/store/writes.js +125 -0
  281. package/dist/store.d.ts +109 -117
  282. package/dist/store.d.ts.map +1 -1
  283. package/dist/store.js +155 -494
  284. package/dist/stored.d.ts +156 -0
  285. package/dist/stored.d.ts.map +1 -0
  286. package/dist/stored.js +649 -0
  287. package/dist/surface.d.ts +88 -0
  288. package/dist/surface.d.ts.map +1 -0
  289. package/dist/surface.js +223 -0
  290. package/dist/sync.d.ts +19 -0
  291. package/dist/sync.d.ts.map +1 -0
  292. package/dist/sync.js +521 -0
  293. package/dist/tables.d.ts +412 -0
  294. package/dist/tables.d.ts.map +1 -0
  295. package/dist/tables.js +737 -0
  296. package/dist/tallies.d.ts +18 -0
  297. package/dist/tallies.d.ts.map +1 -0
  298. package/dist/tallies.js +129 -0
  299. package/dist/transfer.d.ts +0 -5
  300. package/dist/transfer.d.ts.map +1 -1
  301. package/dist/turn.d.ts +9 -0
  302. package/dist/turn.d.ts.map +1 -0
  303. package/dist/turn.js +75 -0
  304. package/dist/validation.d.ts +29 -0
  305. package/dist/validation.d.ts.map +1 -0
  306. package/dist/validation.js +104 -0
  307. package/dist/windows.d.ts +11 -0
  308. package/dist/windows.d.ts.map +1 -0
  309. package/dist/windows.js +16 -0
  310. package/dist/wire.d.ts +220 -34
  311. package/dist/wire.d.ts.map +1 -1
  312. package/dist/wire.js +73 -31
  313. package/package.json +27 -15
  314. package/AGENTS.md +0 -290
  315. package/dist/attachment.d.ts +0 -3
  316. package/dist/attachment.d.ts.map +0 -1
  317. package/dist/attachment.js +0 -8
  318. package/dist/chat/acts.d.ts +0 -34
  319. package/dist/chat/acts.d.ts.map +0 -1
  320. package/dist/chat/acts.js +0 -36
  321. package/dist/chat/messages.d.ts +0 -21
  322. package/dist/chat/messages.d.ts.map +0 -1
  323. package/dist/chat/messages.js +0 -151
  324. package/dist/chat/overlay.d.ts +0 -31
  325. package/dist/chat/overlay.d.ts.map +0 -1
  326. package/dist/chat/overlay.js +0 -97
  327. package/dist/chat/parts.d.ts +0 -57
  328. package/dist/chat/parts.d.ts.map +0 -1
  329. package/dist/chat/parts.js +0 -119
  330. package/dist/chat/process.d.ts +0 -20
  331. package/dist/chat/process.d.ts.map +0 -1
  332. package/dist/chat/process.js +0 -32
  333. package/dist/chat/provider.d.ts +0 -57
  334. package/dist/chat/provider.d.ts.map +0 -1
  335. package/dist/chat/provider.js +0 -637
  336. package/dist/chat/questions.d.ts.map +0 -1
  337. package/dist/chat/read.d.ts.map +0 -1
  338. package/dist/chat.d.ts +0 -7
  339. package/dist/chat.d.ts.map +0 -1
  340. package/dist/chat.js +0 -2
  341. package/dist/read-side.d.ts +0 -18
  342. package/dist/read-side.d.ts.map +0 -1
  343. 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,8 +149,9 @@ 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
157
  function page(room, after) {
@@ -114,30 +161,49 @@ export function createMemoryAdapter(options = {}) {
114
161
  const size = pageSize ?? paths.length;
115
162
  const taken = paths.slice(from, from + size);
116
163
  const next = from + taken.length;
117
- const targets = opening ? (room.binaryTargets ?? []) : [];
164
+ const targets = opening ? Object.keys(room.binaryFiles ?? {}) : [];
118
165
  return {
119
166
  kind: 'bootstrap',
120
167
  roomVersion: room.roomVersion,
121
168
  ...(opening ? { models: modelsOf(room) } : {}),
122
169
  documents: named(room.documents ?? {}, taken),
123
- 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]) }),
124
178
  changes: named(room.changes ?? {}, [...taken, ...targets]),
125
- binaryTargets: targets,
126
- ...(opening && room.attachments !== undefined ? { attachments: room.attachments } : {}),
179
+ binaryFiles: named(room.binaryFiles ?? {}, targets),
180
+ ...(opening && room.folders !== undefined ? { folders: room.folders } : {}),
127
181
  ...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
128
182
  };
129
183
  }
130
- 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) {
131
195
  const current = room.documents ?? {};
132
196
  const previous = from.documents ?? {};
133
- const currentTargets = new Set(room.binaryTargets ?? []);
134
- const previousTargets = new Set(from.binaryTargets ?? []);
197
+ const currentTargets = new Set(Object.keys(room.binaryFiles ?? {}));
198
+ const previousTargets = new Set(Object.keys(from.binaryFiles ?? {}));
135
199
  const headMoved = (path) => room.revisions?.[path] !== from.revisions?.[path] ||
200
+ room.fileIds?.[path] !== from.fileIds?.[path] ||
201
+ room.created?.[path] !== from.created?.[path] ||
136
202
  !sameChange(room.changes?.[path], from.changes?.[path]);
137
203
  const changed = Object.keys(current)
138
204
  .filter((path) => current[path] !== previous[path] || headMoved(path))
139
205
  .sort();
140
- const size = pageSize ?? changed.length;
206
+ const size = whole ? changed.length : (pageSize ?? changed.length);
141
207
  const taken = changed.slice(at, at + size);
142
208
  const next = at + taken.length;
143
209
  const opening = at === 0;
@@ -147,51 +213,71 @@ export function createMemoryAdapter(options = {}) {
147
213
  const targets = opening
148
214
  ? [...currentTargets].filter((target) => !previousTargets.has(target) || headMoved(target))
149
215
  : [];
150
- const attachments = room.attachments ?? [];
151
- const declared = opening && JSON.stringify(attachments) !== JSON.stringify(from.attachments ?? []);
152
216
  const models = opening ? changedModels(room, from) : undefined;
153
217
  return {
154
218
  kind: 'net-advancement',
155
219
  roomVersion: room.roomVersion,
156
220
  ...(models === undefined ? {} : { models }),
157
221
  documents: named(current, taken),
158
- 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]) }),
159
230
  changes: named(room.changes ?? {}, [...taken, ...targets]),
160
- binaryTargets: targets,
231
+ binaryFiles: named(room.binaryFiles ?? {}, targets),
232
+ ...(opening ? foldersMoved(room, from) : {}),
161
233
  removals: opening
162
234
  ? [
163
235
  ...Object.keys(previous).filter((path) => !(path in current) && !currentTargets.has(path)),
164
236
  ...[...previousTargets].filter((target) => !currentTargets.has(target) && !(target in current)),
165
237
  ].sort()
166
238
  : [],
167
- ...(declared ? { attachments } : {}),
168
239
  ...(pageToken === undefined ? {} : { pageToken }),
169
240
  };
170
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
+ }
171
262
  function pageOf(conversation, after) {
172
263
  const messages = conversation.messages ?? [];
173
- const first = typeof after === 'string' ? messages.findIndex((message) => message.position > after) : 0;
264
+ const first = typeof after === 'string' ? messages.findIndex((message) => message.change > after) : 0;
174
265
  const from = first === -1 ? messages.length : first;
175
266
  const page = messages.slice(from, from + (historyPageSize ?? messages.length));
176
267
  const last = page.at(-1);
177
268
  return {
178
269
  conversation: conversation.conversation,
179
270
  messages: page,
180
- ...(last !== undefined && from + page.length < messages.length
181
- ? { next: last.position }
182
- : {}),
271
+ ...(last !== undefined && from + page.length < messages.length ? { next: last.change } : {}),
183
272
  };
184
273
  }
185
- function historiesOf(input) {
186
- const asked = input?.conversations;
187
- if (!Array.isArray(asked))
188
- return { kind: 'rejected', code: 'invalid_request', fields: {}, retryable: false };
274
+ function historiesOf(request) {
189
275
  const histories = [];
190
- for (const entry of asked) {
191
- const conversation = typeof entry.conversation === 'string' ? scripted.get(entry.conversation) : undefined;
276
+ for (const entry of request.conversations) {
277
+ const conversation = scripted.get(entry.conversation);
192
278
  if (conversation === undefined)
193
279
  continue;
194
- const outcome = conversation.outcomes?.['conversation.history'];
280
+ const outcome = conversation.outcomes?.history;
195
281
  if (outcome !== undefined)
196
282
  return outcome;
197
283
  histories.push(pageOf(conversation, entry.after));
@@ -202,15 +288,13 @@ export function createMemoryAdapter(options = {}) {
202
288
  function conversationAction(request) {
203
289
  const name = request.name;
204
290
  const input = (request.input ?? {});
205
- if (name === 'conversation.history')
206
- return historiesOf(request.input);
207
- if (name === 'conversation.create') {
291
+ if (name === 'conversations/create') {
208
292
  issued += 1;
209
293
  const conversation = `conversation-${issued}`;
210
294
  scripted.set(conversation, { conversation });
211
- return { kind: 'action', result: { conversation } };
295
+ return { kind: 'action', result: { conversation_id: conversation } };
212
296
  }
213
- const named = typeof input.conversation === 'string' ? input.conversation : '';
297
+ const named = typeof input.conversation_id === 'string' ? input.conversation_id : '';
214
298
  const conversation = scripted.get(named);
215
299
  if (conversation === undefined) {
216
300
  return {
@@ -223,28 +307,39 @@ export function createMemoryAdapter(options = {}) {
223
307
  const outcome = conversation.outcomes?.[name];
224
308
  if (outcome !== undefined)
225
309
  return outcome;
226
- if (name === 'conversation.send') {
310
+ if (name === 'conversations/send') {
311
+ const operation = typeof input.operation_id === 'string' ? input.operation_id : null;
312
+ const answered = operation === null ? undefined : sentTurns.get(operation);
313
+ if (answered !== undefined)
314
+ return { kind: 'action', result: { message_id: answered } };
227
315
  issued += 1;
228
316
  const turn = `turn-${issued}`;
229
- unsealed.set(turn, named);
230
- return { kind: 'action', result: { turn } };
317
+ if (operation !== null)
318
+ sentTurns.set(operation, turn);
319
+ return { kind: 'action', result: { message_id: turn } };
231
320
  }
232
- if (name === 'conversation.cancel') {
233
- const turn = typeof input.turn === 'string' ? input.turn : '';
234
- if (sealed.has(turn) || !unsealed.has(turn)) {
235
- return { kind: 'rejected', code: 'turn-sealed', fields: { turn }, retryable: false };
236
- }
237
- unsealed.delete(turn);
238
- return { kind: 'action', result: { turn, cancelled: true } };
239
- }
240
- if (name === 'conversation.delete')
321
+ if (name === 'conversations/delete')
241
322
  scripted.delete(named);
242
- return { kind: 'action', result: { conversation: named } };
323
+ return { kind: 'action', result: { conversation_id: named } };
324
+ }
325
+ function decided(request) {
326
+ const { request: asked, message, decision, } = (request.input ?? {});
327
+ return {
328
+ kind: 'action',
329
+ result: {
330
+ request: asked,
331
+ ...(message === undefined ? {} : { message }),
332
+ state: decision === 'approve' ? 'started' : 'declined',
333
+ },
334
+ };
243
335
  }
244
336
  function announceList() {
245
- const entries = [...scripted.values()].flatMap(({ conversation, listed }) => listed === undefined ? [] : [{ conversation, ...listed }]);
246
- for (const listener of listeners)
247
- listener({ kind: 'list', entries });
337
+ const entries = [...scripted.values()].flatMap(({ conversation, listed, messages = [] }) => listed === undefined
338
+ ? []
339
+ : [{ conversation, ...listed, newest: messages.at(-1)?.change ?? null }]);
340
+ for (const listener of listeners) {
341
+ listener({ kind: 'list', entries, whole: true, more: false, cursor: null });
342
+ }
248
343
  }
249
344
  function discovery() {
250
345
  return {
@@ -256,7 +351,42 @@ export function createMemoryAdapter(options = {}) {
256
351
  ...(options.member === undefined ? {} : { member: options.member }),
257
352
  };
258
353
  }
354
+ function discovered() {
355
+ return resolveScript(scripts.discover, discovery, undefined).then((answer) => {
356
+ if (answer.kind === 'discovery')
357
+ for (const room of answer.rooms)
358
+ note(room.locator, room);
359
+ return answer;
360
+ });
361
+ }
362
+ function opened(notify) {
363
+ const opening = ++openings;
364
+ notify({ kind: 'opened' });
365
+ void discovered()
366
+ .catch(() => ({ kind: 'transport-uncertainty' }))
367
+ .then((answer) => {
368
+ if (opening !== openings)
369
+ return;
370
+ if (answer.kind !== 'discovery') {
371
+ openings += 1;
372
+ carried.clear();
373
+ const revoked = answer.kind === 'revoked-authorization';
374
+ notify({ kind: 'closed', revoked, lost: !revoked, authorityChanged: false });
375
+ return;
376
+ }
377
+ declaredRooms.clear();
378
+ for (const room of answer.rooms)
379
+ declaredRooms.add(room.locator);
380
+ notify({ kind: 'discovered', discovery: answer });
381
+ });
382
+ }
383
+ function emitAll(event) {
384
+ for (const observer of observers)
385
+ observer(event);
386
+ }
259
387
  return {
388
+ ...(options.roomTypes === undefined ? {} : { roomTypes: options.roomTypes }),
389
+ ...(options.typedPaths === undefined ? {} : { typedPaths: options.typedPaths }),
260
390
  setRooms(next) {
261
391
  rooms = [...next];
262
392
  retain(rooms);
@@ -265,26 +395,37 @@ export function createMemoryAdapter(options = {}) {
265
395
  scriptConversations(next);
266
396
  },
267
397
  open() {
398
+ carried.clear();
268
399
  announceList();
269
- for (const observer of observers)
270
- observer({ kind: 'opened' });
400
+ opened(emitAll);
271
401
  },
272
- close(revoked = false) {
273
- for (const observer of observers)
274
- observer({ kind: 'closed', revoked });
402
+ close({ revoked = false, lost = !revoked, authorityChanged = false } = {}) {
403
+ openings += 1;
404
+ carried.clear();
405
+ emitAll({ kind: 'closed', revoked, lost, authorityChanged });
275
406
  },
276
407
  expire(locators) {
277
408
  expiring = [...locators];
278
409
  },
279
- notifyRoomVersion({ locator, roomVersion }) {
280
- for (const observer of observers)
281
- observer({ kind: 'room-version', locator, roomVersion });
410
+ notifyRoomVersion({ locator }) {
411
+ carry(locator);
412
+ },
413
+ notifyAuthorityChanged(locators) {
414
+ const named = new Set(locators ?? [...declaredRooms, ...rooms.map((room) => room.locator)]);
415
+ const listed = rooms.filter((room) => named.has(room.locator));
416
+ const left = [...named].filter((locator) => !listed.some((room) => room.locator === locator));
417
+ for (const room of listed)
418
+ declaredRooms.add(room.locator);
419
+ for (const locator of left)
420
+ declaredRooms.delete(locator);
421
+ emitAll({
422
+ kind: 'authority-changed',
423
+ rooms: listed.map(declared),
424
+ left,
425
+ ...(options.member === undefined ? {} : { member: options.member }),
426
+ });
282
427
  },
283
428
  notifyConversation(event) {
284
- if (event.kind === 'accepted-message') {
285
- sealed.add(event.message.turn);
286
- unsealed.delete(event.message.turn);
287
- }
288
429
  for (const listener of listeners)
289
430
  listener(event);
290
431
  },
@@ -293,21 +434,31 @@ export function createMemoryAdapter(options = {}) {
293
434
  observer(mode);
294
435
  },
295
436
  heldRooms() {
296
- return held;
437
+ return [...carried.keys()].sort();
297
438
  },
298
439
  replicatedConversations() {
299
440
  return replicated;
300
441
  },
442
+ heldConversationCursor() {
443
+ return heldCursor;
444
+ },
301
445
  conversations: {
302
446
  replicate(next) {
303
447
  replicated = [...next];
304
448
  },
449
+ hold(cursor) {
450
+ heldCursor = cursor;
451
+ },
305
452
  observe(notify) {
306
453
  listeners.add(notify);
307
454
  return () => {
308
455
  listeners.delete(notify);
309
456
  };
310
457
  },
458
+ history: (request) => Promise.resolve(historiesOf(request)),
459
+ ...(options.agents === undefined
460
+ ? {}
461
+ : { agents: () => Promise.resolve(structuredClone(options.agents)) }),
311
462
  },
312
463
  serviceMode: {
313
464
  observe(notify) {
@@ -319,29 +470,30 @@ export function createMemoryAdapter(options = {}) {
319
470
  },
320
471
  roomStream: {
321
472
  hold(asked) {
322
- held = asked.map((room) => room.locator);
323
- const expired = expiring.filter((locator) => held.includes(locator));
324
- expiring = [];
325
- const moved = asked.flatMap((room) => {
473
+ const named = asked.map((room) => room.locator);
474
+ const unknown = asked.flatMap((room) => {
326
475
  const current = rooms.find((entry) => entry.locator === room.locator);
476
+ const version = room.roomVersion;
327
477
  return current === undefined ||
328
- expired.includes(room.locator) ||
329
- current.roomVersion === room.roomVersion
478
+ (version !== null &&
479
+ (current.roomVersion === version || served.get(room.locator)?.has(version) === true))
330
480
  ? []
331
- : [{ locator: room.locator, roomVersion: current.roomVersion }];
481
+ : [room.locator];
332
482
  });
483
+ const expired = [
484
+ ...new Set([...expiring.filter((locator) => named.includes(locator)), ...unknown]),
485
+ ];
486
+ expiring = expiring.filter((locator) => !named.includes(locator));
333
487
  queueMicrotask(() => {
334
- for (const observer of observers) {
335
- for (const room of moved)
336
- observer({ kind: 'room-version', ...room });
337
- observer({ kind: 'opening', expired });
488
+ for (const room of asked) {
489
+ if (expired.includes(room.locator) || room.roomVersion === null)
490
+ carried.delete(room.locator);
491
+ else {
492
+ carried.set(room.locator, room.roomVersion);
493
+ carry(room.locator);
494
+ }
338
495
  }
339
- });
340
- },
341
- reopen() {
342
- queueMicrotask(() => {
343
- for (const observer of observers)
344
- observer({ kind: 'closed', revoked: false });
496
+ emitAll({ kind: 'caught-up', expired });
345
497
  });
346
498
  },
347
499
  observe(notify) {
@@ -350,11 +502,14 @@ export function createMemoryAdapter(options = {}) {
350
502
  if (!observers.has(notify))
351
503
  return;
352
504
  if (options.unopened === true) {
353
- notify({ kind: 'closed', revoked: false });
505
+ notify({ kind: 'closed', revoked: false, lost: true, authorityChanged: false });
354
506
  return;
355
507
  }
356
508
  announceList();
357
- notify({ kind: 'opened' });
509
+ opened((event) => {
510
+ if (observers.has(notify))
511
+ notify(event);
512
+ });
358
513
  });
359
514
  return () => {
360
515
  observers.delete(notify);
@@ -371,12 +526,7 @@ export function createMemoryAdapter(options = {}) {
371
526
  return resolveScript(scripts.authorize, () => ({}), undefined);
372
527
  },
373
528
  async discover(_authorization) {
374
- return resolveScript(scripts.discover, discovery, undefined).then((answer) => {
375
- if (answer.kind === 'discovery')
376
- for (const room of answer.rooms)
377
- note(room.locator, room);
378
- return answer;
379
- });
529
+ return discovered();
380
530
  },
381
531
  reached,
382
532
  follows(locator, roomVersion, next) {
@@ -433,7 +583,13 @@ export function createMemoryAdapter(options = {}) {
433
583
  retryable: false,
434
584
  affected: {},
435
585
  };
436
- }, request).then((answer) => note(request.locator, answer));
586
+ }, request).then((answer) => {
587
+ const destination = request.changeBatch.between?.destination.room;
588
+ if (answer.kind === 'accepted' && answer.destination !== undefined && destination) {
589
+ note(destination, answer.destination);
590
+ }
591
+ return note(request.locator, answer);
592
+ });
437
593
  },
438
594
  async history(_authorization, request) {
439
595
  return resolveScript(scripts.history, () => {
@@ -447,10 +603,47 @@ export function createMemoryAdapter(options = {}) {
447
603
  };
448
604
  }, request);
449
605
  },
606
+ async binary(_authorization, request) {
607
+ return resolveScript(scripts.binary, () => {
608
+ const room = rooms.find((entry) => entry.locator === request.locator);
609
+ if (room === undefined)
610
+ return { kind: 'room-not-readable', locator: request.locator };
611
+ const blob = heldBlob(room, request.path);
612
+ return blob === undefined
613
+ ? { kind: 'rejected', code: 'not_found', fields: {}, retryable: false }
614
+ : { kind: 'binary', body: blob.stream(), mediaType: blob.type };
615
+ }, request);
616
+ },
617
+ async link(_authorization, request) {
618
+ return resolveScript(scripts.link, () => {
619
+ const room = rooms.find((entry) => entry.locator === request.locator);
620
+ if (room === undefined)
621
+ return { kind: 'room-not-readable', locator: request.locator };
622
+ const blob = heldBlob(room, request.path);
623
+ if (blob === undefined) {
624
+ return { kind: 'rejected', code: 'not_found', fields: {}, retryable: false };
625
+ }
626
+ const url = linked.get(blob) ?? URL.createObjectURL(blob);
627
+ linked.set(blob, url);
628
+ return { kind: 'link', url, name: lastName(request.path), mediaType: blob.type };
629
+ }, request);
630
+ },
631
+ async attach(_authorization, request) {
632
+ return resolveScript(scripts.attach, () => {
633
+ const room = rooms.find((entry) => entry.locator === request.locator);
634
+ if (room === undefined)
635
+ return { kind: 'room-not-readable', locator: request.locator };
636
+ const path = freePath(room, request.name);
637
+ attached.set(`${room.locator}\u0000${path}`, request.blob);
638
+ return { kind: 'attached', path, revision: `attached-${attached.size}` };
639
+ }, request);
640
+ },
450
641
  async action(_authorization, request) {
451
642
  return resolveScript(scripts.action, () => {
452
- if (request.name.startsWith('conversation.'))
643
+ if (request.name.startsWith('conversations/'))
453
644
  return conversationAction(request);
645
+ if (request.name === 'agent-functions/decide')
646
+ return decided(request);
454
647
  return { kind: 'rejected', code: 'unscripted-action', fields: {}, retryable: false };
455
648
  }, request).then((answer) => {
456
649
  if (answer.kind === 'action' && answer.at !== undefined)
@@ -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":"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"}