@agentshouse/mdruntime 0.1.0-c44866799613e → 0.1.0-c44d5cc00aee5

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