@agentshouse/mdruntime 0.1.0-cf6d5f0a5c9c8 → 0.1.0-cf96c797c5fa8

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 (158) hide show
  1. package/AGENTS.md +96 -31
  2. package/README.md +11 -1
  3. package/dist/adapter.d.ts +41 -14
  4. package/dist/adapter.d.ts.map +1 -1
  5. package/dist/attempt.d.ts +16 -0
  6. package/dist/attempt.d.ts.map +1 -0
  7. package/dist/attempt.js +57 -0
  8. package/dist/binary.d.ts +23 -0
  9. package/dist/binary.d.ts.map +1 -0
  10. package/dist/binary.js +8 -0
  11. package/dist/bootstrap.d.ts.map +1 -1
  12. package/dist/bootstrap.js +5 -8
  13. package/dist/change-set.d.ts.map +1 -1
  14. package/dist/change-set.js +8 -7
  15. package/dist/change.d.ts +15 -0
  16. package/dist/change.d.ts.map +1 -1
  17. package/dist/change.js +26 -1
  18. package/dist/chat/acts.d.ts +34 -0
  19. package/dist/chat/acts.d.ts.map +1 -0
  20. package/dist/chat/acts.js +36 -0
  21. package/dist/chat/context.d.ts +3 -0
  22. package/dist/chat/context.d.ts.map +1 -0
  23. package/dist/chat/context.js +10 -0
  24. package/dist/chat/input.d.ts +9 -0
  25. package/dist/chat/input.d.ts.map +1 -0
  26. package/dist/chat/input.js +99 -0
  27. package/dist/chat/kit.d.ts +60 -0
  28. package/dist/chat/kit.d.ts.map +1 -0
  29. package/dist/chat/kit.js +123 -0
  30. package/dist/chat/lasting.d.ts +6 -0
  31. package/dist/chat/lasting.d.ts.map +1 -0
  32. package/dist/chat/lasting.js +19 -0
  33. package/dist/chat/list.d.ts +20 -0
  34. package/dist/chat/list.d.ts.map +1 -0
  35. package/dist/chat/list.js +59 -0
  36. package/dist/chat/markdown.d.ts +19 -0
  37. package/dist/chat/markdown.d.ts.map +1 -0
  38. package/dist/chat/markdown.js +187 -0
  39. package/dist/chat/message.d.ts +6 -0
  40. package/dist/chat/message.d.ts.map +1 -0
  41. package/dist/chat/message.js +192 -0
  42. package/dist/chat/messages.d.ts +21 -0
  43. package/dist/chat/messages.d.ts.map +1 -0
  44. package/dist/chat/messages.js +151 -0
  45. package/dist/chat/name.d.ts +6 -0
  46. package/dist/chat/name.d.ts.map +1 -0
  47. package/dist/chat/name.js +37 -0
  48. package/dist/chat/opened.d.ts +11 -0
  49. package/dist/chat/opened.d.ts.map +1 -0
  50. package/dist/chat/opened.js +17 -0
  51. package/dist/chat/overlay.d.ts +31 -0
  52. package/dist/chat/overlay.d.ts.map +1 -0
  53. package/dist/chat/overlay.js +97 -0
  54. package/dist/chat/parts.d.ts +57 -0
  55. package/dist/chat/parts.d.ts.map +1 -0
  56. package/dist/chat/parts.js +119 -0
  57. package/dist/chat/process.d.ts +20 -0
  58. package/dist/chat/process.d.ts.map +1 -0
  59. package/dist/chat/process.js +32 -0
  60. package/dist/chat/provider.d.ts +63 -0
  61. package/dist/chat/provider.d.ts.map +1 -0
  62. package/dist/chat/provider.js +645 -0
  63. package/dist/chat/question.d.ts +9 -0
  64. package/dist/chat/question.d.ts.map +1 -0
  65. package/dist/chat/question.js +80 -0
  66. package/dist/chat/questions.d.ts +31 -0
  67. package/dist/chat/questions.d.ts.map +1 -0
  68. package/dist/chat/questions.js +111 -0
  69. package/dist/chat/read.d.ts +5 -0
  70. package/dist/chat/read.d.ts.map +1 -0
  71. package/dist/chat/read.js +13 -0
  72. package/dist/chat/ready.d.ts +33 -0
  73. package/dist/chat/ready.d.ts.map +1 -0
  74. package/dist/chat/ready.js +91 -0
  75. package/dist/chat/style.d.ts +4 -0
  76. package/dist/chat/style.d.ts.map +1 -0
  77. package/dist/chat/style.js +302 -0
  78. package/dist/chat.d.ts +14 -0
  79. package/dist/chat.d.ts.map +1 -0
  80. package/dist/chat.js +8 -0
  81. package/dist/client.d.ts +12 -5
  82. package/dist/client.d.ts.map +1 -1
  83. package/dist/client.js +30 -15
  84. package/dist/connection.d.ts +19 -9
  85. package/dist/connection.d.ts.map +1 -1
  86. package/dist/connection.js +312 -96
  87. package/dist/conversation.d.ts +11 -3
  88. package/dist/conversation.d.ts.map +1 -1
  89. package/dist/conversation.js +47 -7
  90. package/dist/expectation.d.ts +21 -0
  91. package/dist/expectation.d.ts.map +1 -0
  92. package/dist/expectation.js +70 -0
  93. package/dist/failure.d.ts +13 -0
  94. package/dist/failure.d.ts.map +1 -0
  95. package/dist/failure.js +19 -0
  96. package/dist/host.d.ts +1 -1
  97. package/dist/host.d.ts.map +1 -1
  98. package/dist/host.js +9 -9
  99. package/dist/identity.d.ts +2 -0
  100. package/dist/identity.d.ts.map +1 -1
  101. package/dist/identity.js +6 -0
  102. package/dist/index.d.ts +9 -4
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +3 -0
  105. package/dist/memory.d.ts +3 -3
  106. package/dist/memory.d.ts.map +1 -1
  107. package/dist/memory.js +47 -16
  108. package/dist/model.d.ts +3 -2
  109. package/dist/model.d.ts.map +1 -1
  110. package/dist/open.d.ts +2 -0
  111. package/dist/open.d.ts.map +1 -0
  112. package/dist/open.js +1 -0
  113. package/dist/outcome.d.ts +28 -3
  114. package/dist/outcome.d.ts.map +1 -1
  115. package/dist/outcome.js +41 -1
  116. package/dist/overlay.d.ts +14 -3
  117. package/dist/overlay.d.ts.map +1 -1
  118. package/dist/overlay.js +75 -37
  119. package/dist/query.d.ts +4 -0
  120. package/dist/query.d.ts.map +1 -1
  121. package/dist/query.js +3 -0
  122. package/dist/reach.d.ts +2 -0
  123. package/dist/reach.d.ts.map +1 -1
  124. package/dist/reach.js +43 -19
  125. package/dist/react.d.ts +4 -2
  126. package/dist/react.d.ts.map +1 -1
  127. package/dist/react.js +3 -2
  128. package/dist/read-side.d.ts.map +1 -1
  129. package/dist/read-side.js +9 -2
  130. package/dist/refresh.d.ts.map +1 -1
  131. package/dist/refresh.js +12 -17
  132. package/dist/replica.d.ts +6 -3
  133. package/dist/replica.d.ts.map +1 -1
  134. package/dist/replica.js +46 -32
  135. package/dist/room-draft.d.ts +26 -9
  136. package/dist/room-draft.d.ts.map +1 -1
  137. package/dist/room-draft.js +131 -22
  138. package/dist/rows.d.ts +3 -1
  139. package/dist/rows.d.ts.map +1 -1
  140. package/dist/rows.js +3 -1
  141. package/dist/save.d.ts +27 -1
  142. package/dist/save.d.ts.map +1 -1
  143. package/dist/save.js +323 -22
  144. package/dist/search.d.ts +3 -2
  145. package/dist/search.d.ts.map +1 -1
  146. package/dist/status.d.ts +2 -2
  147. package/dist/status.d.ts.map +1 -1
  148. package/dist/status.js +0 -8
  149. package/dist/store.d.ts +13 -12
  150. package/dist/store.d.ts.map +1 -1
  151. package/dist/store.js +150 -157
  152. package/dist/wire.d.ts +6 -3
  153. package/dist/wire.d.ts.map +1 -1
  154. package/dist/wire.js +14 -2
  155. package/package.json +17 -9
  156. package/dist/attachment.d.ts +0 -3
  157. package/dist/attachment.d.ts.map +0 -1
  158. package/dist/attachment.js +0 -8
package/dist/store.js CHANGED
@@ -1,10 +1,9 @@
1
- import { transferIdentity } from './identity.js';
2
- import { sameChange } from './overlay.js';
1
+ import { sameBinary, sameChange } from './overlay.js';
3
2
  const DATABASE = 'mdruntime';
3
+ const AUTHORED = 'mdruntime-authored';
4
4
  const ROOMS = 'rooms';
5
5
  const DOCUMENTS = 'documents';
6
- const BINARY_TARGETS = 'binaryTargets';
7
- const ATTACHMENTS = 'attachments';
6
+ const BINARY_FILES = 'binaryFiles';
8
7
  const TRANSFERS = 'transfers';
9
8
  const PENDING_CHANGES = 'pendingChanges';
10
9
  const DECLARATIONS = 'declarations';
@@ -13,10 +12,20 @@ const PRESENTATION = 'presentation';
13
12
  const CONVERSATIONS = 'conversations';
14
13
  const MESSAGES = 'messages';
15
14
  const CHAT_DRAFTS = 'chatDrafts';
15
+ const QUEUES = 'queues';
16
+ const FACTS = 'facts';
16
17
  const CURRENT = 'current';
17
18
  const MEMBER = 'member';
18
- export const STORE_SCHEMA = 21;
19
- const PATH_KEYED_SCHEMA = 20;
19
+ const GENERATION = 'generation';
20
+ export const STORE_SCHEMA = 23;
21
+ export const AUTHORED_SCHEMA = 1;
22
+ const AUTHORED_STORES = [
23
+ [QUEUES, { keyPath: 'locator' }],
24
+ [PENDING_CHANGES, { keyPath: ['locator', 'id'] }],
25
+ [ROOM_DRAFTS, { keyPath: ['locator', 'path'] }],
26
+ [CHAT_DRAFTS, { keyPath: 'conversation' }],
27
+ [FACTS, undefined],
28
+ ];
20
29
  const READ_BATCH = 256;
21
30
  function settled(request) {
22
31
  return new Promise((resolve, reject) => {
@@ -33,7 +42,6 @@ function completed(transaction) {
33
42
  }
34
43
  const EMPTY_DECLARATIONS = {
35
44
  lastCompleted: null,
36
- generation: null,
37
45
  providerLimits: [],
38
46
  capabilities: [],
39
47
  };
@@ -61,9 +69,12 @@ function amendPending(database, locator, id, amendment) {
61
69
  };
62
70
  return completed(transaction);
63
71
  }
64
- function roomRecord(record, queue) {
65
- const { documents, binaryTargets, revisions, changes, written, attachments, ...room } = record;
66
- return { ...room, order: queue.map((batch) => batch.id) };
72
+ function roomRecord(record) {
73
+ const { documents, binaries, revisions, changes, written, ...room } = record;
74
+ return room;
75
+ }
76
+ function chatDraftRecord(record) {
77
+ return { ...record, revision: record.revision ?? '' };
67
78
  }
68
79
  function underTransfer(locator, transfer, after) {
69
80
  return after === undefined
@@ -85,7 +96,7 @@ async function readTransfer(store, locator, transfer, receive) {
85
96
  }
86
97
  }
87
98
  function emptyLayer() {
88
- return { documents: {}, binaryTargets: [], revisions: {}, changes: {}, written: {} };
99
+ return { documents: {}, binaries: {}, revisions: {}, changes: {}, written: {} };
89
100
  }
90
101
  async function readLayer(transaction, locator, transfer) {
91
102
  const layer = emptyLayer();
@@ -101,9 +112,9 @@ async function readLayer(transaction, locator, transfer) {
101
112
  layer.written[document.path] = document.written;
102
113
  head(document);
103
114
  });
104
- await readTransfer(transaction.objectStore(BINARY_TARGETS), locator, transfer, (target) => {
105
- layer.binaryTargets.push(target.path);
106
- head(target);
115
+ await readTransfer(transaction.objectStore(BINARY_FILES), locator, transfer, (file) => {
116
+ layer.binaries[file.path] = file.binary;
117
+ head(file);
107
118
  });
108
119
  return layer;
109
120
  }
@@ -118,13 +129,14 @@ function documentRecord(locator, transfer, layer, path) {
118
129
  written: layer.written[path] ?? null,
119
130
  };
120
131
  }
121
- function targetRecord(locator, transfer, layer, path) {
132
+ function binaryFileRecord(locator, transfer, layer, path) {
122
133
  return {
123
134
  locator,
124
135
  transfer,
125
136
  path,
126
137
  revision: layer.revisions[path] ?? null,
127
138
  change: layer.changes[path] ?? null,
139
+ binary: layer.binaries[path],
128
140
  };
129
141
  }
130
142
  function writeLayer(transaction, locator, transfer, next, base) {
@@ -141,18 +153,16 @@ function writeLayer(transaction, locator, transfer, next, base) {
141
153
  continue;
142
154
  documents.put(documentRecord(locator, transfer, next, path));
143
155
  }
144
- const targets = transaction.objectStore(BINARY_TARGETS);
145
- const beforeTargets = new Set(base?.binaryTargets ?? []);
146
- const afterTargets = new Set(next.binaryTargets);
147
- for (const path of beforeTargets) {
148
- if (!afterTargets.has(path))
149
- targets.delete([locator, transfer, path]);
156
+ const files = transaction.objectStore(BINARY_FILES);
157
+ for (const path of Object.keys(base?.binaries ?? {})) {
158
+ if (next.binaries[path] === undefined)
159
+ files.delete([locator, transfer, path]);
150
160
  }
151
- for (const path of afterTargets) {
152
- if (!beforeTargets.has(path) ||
161
+ for (const path of Object.keys(next.binaries)) {
162
+ if (!sameBinary(base?.binaries[path], next.binaries[path]) ||
153
163
  base?.revisions[path] !== next.revisions[path] ||
154
164
  !sameChange(base?.changes[path], next.changes[path])) {
155
- targets.put(targetRecord(locator, transfer, next, path));
165
+ files.put(binaryFileRecord(locator, transfer, next, path));
156
166
  }
157
167
  }
158
168
  }
@@ -165,155 +175,121 @@ function removeRoomEntries(store, locator) {
165
175
  }
166
176
  };
167
177
  }
168
- export function removeRuntimeStore() {
178
+ function removeDatabase(name) {
169
179
  return new Promise((resolve, reject) => {
170
- const removal = indexedDB.deleteDatabase(DATABASE);
180
+ const removal = indexedDB.deleteDatabase(name);
171
181
  removal.onsuccess = () => resolve();
172
182
  removal.onerror = () => reject(removal.error);
173
183
  });
174
184
  }
175
- function keyByTransfer(database, upgrade) {
176
- database.createObjectStore(TRANSFERS, { keyPath: 'locator' });
177
- const moves = [DOCUMENTS, BINARY_TARGETS].map((name) => {
178
- const from = upgrade.objectStore(name);
179
- from.name = `${name}-${PATH_KEYED_SCHEMA}`;
180
- return {
181
- from,
182
- to: database.createObjectStore(name, { keyPath: ['locator', 'transfer', 'path'] }),
183
- };
184
- });
185
- const transfers = new Map();
186
- const rooms = upgrade.objectStore(ROOMS).openCursor();
187
- rooms.onsuccess = () => {
188
- const room = rooms.result;
189
- if (room !== null) {
190
- const record = room.value;
191
- const transfer = transferIdentity();
192
- transfers.set(record.locator, transfer);
193
- room.update({ ...record, transfer });
194
- room.continue();
195
- return;
196
- }
197
- for (const { from, to } of moves) {
198
- const held = from.openCursor();
199
- held.onsuccess = () => {
200
- const entry = held.result;
201
- if (entry === null) {
202
- database.deleteObjectStore(from.name);
203
- return;
204
- }
205
- const record = entry.value;
206
- const transfer = transfers.get(record.locator);
207
- if (transfer !== undefined)
208
- to.put({ ...record, transfer });
209
- entry.continue();
210
- };
211
- }
212
- };
185
+ export async function removeRuntimeStore() {
186
+ await Promise.all([removeDatabase(DATABASE), removeDatabase(AUTHORED)]);
213
187
  }
214
- export async function openRuntimeStore() {
188
+ function openReplica() {
215
189
  const opening = indexedDB.open(DATABASE, STORE_SCHEMA);
216
- opening.onupgradeneeded = (event) => {
190
+ opening.onupgradeneeded = () => {
217
191
  const database = opening.result;
218
- if (event.oldVersion === PATH_KEYED_SCHEMA && opening.transaction !== null) {
219
- keyByTransfer(database, opening.transaction);
220
- return;
221
- }
222
192
  for (const name of [...database.objectStoreNames])
223
193
  database.deleteObjectStore(name);
224
194
  database.createObjectStore(ROOMS, { keyPath: 'locator' });
225
195
  database.createObjectStore(DOCUMENTS, { keyPath: ['locator', 'transfer', 'path'] });
226
- database.createObjectStore(BINARY_TARGETS, { keyPath: ['locator', 'transfer', 'path'] });
196
+ database.createObjectStore(BINARY_FILES, { keyPath: ['locator', 'transfer', 'path'] });
227
197
  database.createObjectStore(TRANSFERS, { keyPath: 'locator' });
228
- database.createObjectStore(ATTACHMENTS, { keyPath: ['locator', 'reference'] });
229
- database.createObjectStore(PENDING_CHANGES, { keyPath: ['locator', 'id'] });
230
198
  database.createObjectStore(DECLARATIONS);
231
- database.createObjectStore(ROOM_DRAFTS, { keyPath: ['locator', 'path'] });
232
199
  database.createObjectStore(PRESENTATION, { keyPath: 'app' });
233
200
  database.createObjectStore(CONVERSATIONS, { keyPath: 'conversation' });
234
201
  const messages = database.createObjectStore(MESSAGES, {
235
202
  keyPath: ['conversation', 'identity'],
236
203
  });
237
204
  messages.createIndex('conversation', 'conversation');
238
- database.createObjectStore(CHAT_DRAFTS, { keyPath: 'conversation' });
239
205
  };
240
- const database = await settled(opening);
206
+ return settled(opening);
207
+ }
208
+ function openAuthored() {
209
+ const opening = indexedDB.open(AUTHORED, AUTHORED_SCHEMA);
210
+ opening.onupgradeneeded = () => {
211
+ const database = opening.result;
212
+ for (const [name, parameters] of AUTHORED_STORES) {
213
+ if (!database.objectStoreNames.contains(name))
214
+ database.createObjectStore(name, parameters);
215
+ }
216
+ };
217
+ return settled(opening);
218
+ }
219
+ export async function openRuntimeStore() {
220
+ const authored = await openAuthored();
221
+ const database = await openReplica().catch((error) => {
222
+ authored.close();
223
+ throw error;
224
+ });
241
225
  return {
242
226
  async all() {
243
- const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS], 'readonly');
244
- const [rooms, attachments] = await Promise.all([
245
- settled(transaction.objectStore(ROOMS).getAll()),
246
- settled(transaction.objectStore(ATTACHMENTS).getAll()),
247
- ]);
227
+ const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_FILES], 'readonly');
228
+ const rooms = await settled(transaction.objectStore(ROOMS).getAll());
248
229
  const records = [];
249
- for (const { order, ...room } of rooms) {
250
- const layer = await readLayer(transaction, room.locator, room.transfer);
251
- records.push({
252
- ...room,
253
- ...layer,
254
- attachments: attachments.flatMap(({ locator, ...attachment }) => locator === room.locator ? [attachment] : []),
255
- });
230
+ for (const room of rooms) {
231
+ records.push({ ...room, ...(await readLayer(transaction, room.locator, room.transfer)) });
256
232
  }
257
233
  return records;
258
234
  },
259
- async write({ next, previous, stored, queue, previousQueue, saved, roomDrafts, consumedRoomDrafts, }) {
260
- const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, TRANSFERS, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
261
- transaction.objectStore(ROOMS).put(roomRecord(next, queue));
262
- const moved = previous?.transfer !== next.transfer;
263
- if (moved && previous !== null) {
264
- const range = underTransfer(previous.locator, previous.transfer);
265
- transaction.objectStore(DOCUMENTS).delete(range);
266
- transaction.objectStore(BINARY_TARGETS).delete(range);
267
- }
268
- if (moved)
269
- transaction.objectStore(TRANSFERS).delete(next.locator);
270
- writeLayer(transaction, next.locator, next.transfer, next, moved ? (stored ?? null) : previous);
271
- const attachments = transaction.objectStore(ATTACHMENTS);
272
- const held = new Map((previous?.attachments ?? []).map((attachment) => [attachment.reference, attachment]));
273
- const declared = new Set(next.attachments.map((attachment) => attachment.reference));
274
- for (const reference of held.keys()) {
275
- if (!declared.has(reference))
276
- attachments.delete([next.locator, reference]);
277
- }
278
- for (const attachment of next.attachments) {
279
- if (held.get(attachment.reference) === attachment)
280
- continue;
281
- attachments.put({ ...attachment, locator: next.locator });
282
- }
283
- if (previousQueue !== undefined) {
284
- const pending = transaction.objectStore(PENDING_CHANGES);
285
- const before = new Set(previousQueue.map((batch) => batch.id));
235
+ async keepAuthored({ locator, queue, saved, roomDrafts, consumedRoomDrafts }) {
236
+ const transaction = authored.transaction([QUEUES, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
237
+ const order = transaction.objectStore(QUEUES);
238
+ const pending = transaction.objectStore(PENDING_CHANGES);
239
+ const held = order.get(locator);
240
+ held.onsuccess = () => {
241
+ const before = new Set(held.result?.order ?? []);
286
242
  const after = new Set(queue.map((batch) => batch.id));
243
+ if (queue.length === 0)
244
+ order.delete(locator);
245
+ else
246
+ order.put({ locator, order: [...after] });
287
247
  for (const id of before) {
288
248
  if (!after.has(id))
289
- pending.delete([next.locator, id]);
249
+ pending.delete([locator, id]);
290
250
  }
291
251
  for (const batch of queue) {
292
252
  if (!before.has(batch.id)) {
293
253
  pending.put({
294
- locator: next.locator,
254
+ locator,
295
255
  id: batch.id,
296
256
  batch,
297
- drafts: saved ?? [],
257
+ drafts: saved?.get(batch.id) ?? [],
298
258
  submission: { state: 'waiting' },
299
259
  lost: false,
300
260
  });
301
261
  }
302
262
  }
303
- }
263
+ };
304
264
  const draftStore = transaction.objectStore(ROOM_DRAFTS);
305
265
  for (const path of consumedRoomDrafts ?? [])
306
- draftStore.delete([next.locator, path]);
266
+ draftStore.delete([locator, path]);
307
267
  for (const record of roomDrafts ?? [])
308
268
  draftStore.put(record);
309
269
  await completed(transaction);
310
270
  },
271
+ async write({ next, previous, stored }) {
272
+ if (next === previous)
273
+ return;
274
+ const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_FILES, TRANSFERS], 'readwrite');
275
+ transaction.objectStore(ROOMS).put(roomRecord(next));
276
+ const moved = previous?.transfer !== next.transfer;
277
+ if (moved && previous !== null) {
278
+ const range = underTransfer(previous.locator, previous.transfer);
279
+ transaction.objectStore(DOCUMENTS).delete(range);
280
+ transaction.objectStore(BINARY_FILES).delete(range);
281
+ }
282
+ if (moved)
283
+ transaction.objectStore(TRANSFERS).delete(next.locator);
284
+ writeLayer(transaction, next.locator, next.transfer, next, moved ? (stored ?? null) : previous);
285
+ await completed(transaction);
286
+ },
311
287
  async revokeModels(records) {
312
288
  const transaction = database.transaction(ROOMS, 'readwrite');
313
289
  const rooms = transaction.objectStore(ROOMS);
314
290
  const revoked = { status: 'unavailable', reason: 'revoked' };
315
- for (const { record, queue } of records) {
316
- rooms.put(roomRecord({ ...record, model: revoked, selectionModel: revoked }, queue));
291
+ for (const record of records) {
292
+ rooms.put(roomRecord({ ...record, model: revoked, selectionModel: revoked }));
317
293
  }
318
294
  await completed(transaction);
319
295
  },
@@ -347,34 +323,34 @@ export async function openRuntimeStore() {
347
323
  await completed(transaction);
348
324
  },
349
325
  async queues() {
350
- const transaction = database.transaction([ROOMS, PENDING_CHANGES], 'readonly');
351
- const [rooms, pending] = await Promise.all([
352
- settled(transaction.objectStore(ROOMS).getAll()),
326
+ const transaction = authored.transaction([QUEUES, PENDING_CHANGES], 'readonly');
327
+ const [queues, pending] = await Promise.all([
328
+ settled(transaction.objectStore(QUEUES).getAll()),
353
329
  settled(transaction.objectStore(PENDING_CHANGES).getAll()),
354
330
  ]);
355
331
  const byId = new Map(pending.map((record) => [`${record.locator}\0${record.id}`, record]));
356
- return rooms.map((room) => ({
357
- locator: room.locator,
358
- pending: room.order.map((id) => {
359
- const record = byId.get(`${room.locator}\0${id}`);
332
+ return queues.map((queue) => ({
333
+ locator: queue.locator,
334
+ pending: queue.order.map((id) => {
335
+ const record = byId.get(`${queue.locator}\0${id}`);
360
336
  if (record === undefined)
361
- throw new Error(`Missing Pending Change ${room.locator}/${id}`);
337
+ throw new Error(`Missing Pending Change ${queue.locator}/${id}`);
362
338
  const { batch, drafts, submission, lost, upload, accepted } = record;
363
339
  return { batch, state: { drafts, submission, lost, upload, accepted } };
364
340
  }),
365
341
  }));
366
342
  },
367
343
  submit(locator, id, submission, lost) {
368
- return amendPending(database, locator, id, { submission, lost });
344
+ return amendPending(authored, locator, id, { submission, lost });
369
345
  },
370
346
  accept(locator, id, roomVersion) {
371
- return amendPending(database, locator, id, { accepted: roomVersion });
347
+ return amendPending(authored, locator, id, { accepted: roomVersion });
372
348
  },
373
349
  keepUpload(locator, id, upload) {
374
- return amendPending(database, locator, id, { upload });
350
+ return amendPending(authored, locator, id, { upload });
375
351
  },
376
352
  async roomDrafts() {
377
- const transaction = database.transaction(ROOM_DRAFTS, 'readonly');
353
+ const transaction = authored.transaction(ROOM_DRAFTS, 'readonly');
378
354
  return settled(transaction.objectStore(ROOM_DRAFTS).getAll());
379
355
  },
380
356
  async presentation() {
@@ -404,7 +380,12 @@ export async function openRuntimeStore() {
404
380
  return [...held.values()];
405
381
  },
406
382
  async keepMessages({ conversation, messages, read, sealed }) {
407
- const transaction = database.transaction([CONVERSATIONS, MESSAGES, CHAT_DRAFTS], 'readwrite');
383
+ if (sealed === true) {
384
+ const sealing = authored.transaction(CHAT_DRAFTS, 'readwrite');
385
+ sealing.objectStore(CHAT_DRAFTS).delete(conversation);
386
+ await completed(sealing);
387
+ }
388
+ const transaction = database.transaction([CONVERSATIONS, MESSAGES], 'readwrite');
408
389
  const stored = transaction.objectStore(MESSAGES);
409
390
  for (const message of messages) {
410
391
  stored.put({ ...message, conversation });
@@ -414,16 +395,17 @@ export async function openRuntimeStore() {
414
395
  .objectStore(CONVERSATIONS)
415
396
  .put({ conversation, read });
416
397
  }
417
- if (sealed === true)
418
- transaction.objectStore(CHAT_DRAFTS).delete(conversation);
419
398
  await completed(transaction);
420
399
  },
421
400
  async dropConversations(conversations) {
422
- const transaction = database.transaction([CONVERSATIONS, MESSAGES, CHAT_DRAFTS], 'readwrite');
401
+ const drafts = authored.transaction(CHAT_DRAFTS, 'readwrite');
402
+ for (const conversation of conversations)
403
+ drafts.objectStore(CHAT_DRAFTS).delete(conversation);
404
+ await completed(drafts);
405
+ const transaction = database.transaction([CONVERSATIONS, MESSAGES], 'readwrite');
423
406
  const messages = transaction.objectStore(MESSAGES);
424
407
  for (const conversation of conversations) {
425
408
  transaction.objectStore(CONVERSATIONS).delete(conversation);
426
- transaction.objectStore(CHAT_DRAFTS).delete(conversation);
427
409
  const keys = messages.index('conversation').getAllKeys(conversation);
428
410
  keys.onsuccess = () => {
429
411
  for (const key of keys.result)
@@ -433,39 +415,45 @@ export async function openRuntimeStore() {
433
415
  await completed(transaction);
434
416
  },
435
417
  async chatDrafts() {
436
- const transaction = database.transaction(CHAT_DRAFTS, 'readonly');
437
- return settled(transaction.objectStore(CHAT_DRAFTS).getAll());
418
+ const transaction = authored.transaction(CHAT_DRAFTS, 'readonly');
419
+ const held = await settled(transaction.objectStore(CHAT_DRAFTS).getAll());
420
+ return held.map(chatDraftRecord);
438
421
  },
439
422
  async keepChatDraft(record) {
440
- const transaction = database.transaction(CHAT_DRAFTS, 'readwrite');
423
+ const transaction = authored.transaction(CHAT_DRAFTS, 'readwrite');
441
424
  transaction.objectStore(CHAT_DRAFTS).put(record);
442
425
  await completed(transaction);
443
426
  },
444
427
  async dropChatDraft(conversation) {
445
- const transaction = database.transaction(CHAT_DRAFTS, 'readwrite');
428
+ const transaction = authored.transaction(CHAT_DRAFTS, 'readwrite');
446
429
  transaction.objectStore(CHAT_DRAFTS).delete(conversation);
447
430
  await completed(transaction);
448
431
  },
449
432
  async keepRoomDraft(record) {
450
- const transaction = database.transaction(ROOM_DRAFTS, 'readwrite');
433
+ const transaction = authored.transaction(ROOM_DRAFTS, 'readwrite');
451
434
  transaction.objectStore(ROOM_DRAFTS).put(record);
452
435
  await completed(transaction);
453
436
  },
454
437
  async discardRoomDraft(locator, path) {
455
- const transaction = database.transaction(ROOM_DRAFTS, 'readwrite');
438
+ const transaction = authored.transaction(ROOM_DRAFTS, 'readwrite');
456
439
  transaction.objectStore(ROOM_DRAFTS).delete([locator, path]);
457
440
  await completed(transaction);
458
441
  },
459
442
  async dropRooms(locators) {
460
- const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, TRANSFERS, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
443
+ const work = authored.transaction([QUEUES, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
444
+ for (const locator of locators) {
445
+ work.objectStore(QUEUES).delete(locator);
446
+ for (const name of [PENDING_CHANGES, ROOM_DRAFTS]) {
447
+ removeRoomEntries(work.objectStore(name), locator);
448
+ }
449
+ }
450
+ await completed(work);
451
+ const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_FILES, TRANSFERS], 'readwrite');
461
452
  for (const locator of locators) {
462
453
  transaction.objectStore(ROOMS).delete(locator);
463
454
  transaction.objectStore(TRANSFERS).delete(locator);
464
455
  transaction.objectStore(DOCUMENTS).delete(underRoom(locator));
465
- transaction.objectStore(BINARY_TARGETS).delete(underRoom(locator));
466
- for (const name of [ATTACHMENTS, PENDING_CHANGES, ROOM_DRAFTS]) {
467
- removeRoomEntries(transaction.objectStore(name), locator);
468
- }
456
+ transaction.objectStore(BINARY_FILES).delete(underRoom(locator));
469
457
  }
470
458
  await completed(transaction);
471
459
  },
@@ -474,17 +462,17 @@ export async function openRuntimeStore() {
474
462
  return settled(transaction.objectStore(TRANSFERS).getAll());
475
463
  },
476
464
  staged(record) {
477
- const transaction = database.transaction([DOCUMENTS, BINARY_TARGETS], 'readonly');
465
+ const transaction = database.transaction([DOCUMENTS, BINARY_FILES], 'readonly');
478
466
  return readLayer(transaction, record.locator, record.transfer);
479
467
  },
480
468
  async stage(record, page) {
481
- const transaction = database.transaction([TRANSFERS, DOCUMENTS, BINARY_TARGETS], 'readwrite');
469
+ const transaction = database.transaction([TRANSFERS, DOCUMENTS, BINARY_FILES], 'readwrite');
482
470
  writeLayer(transaction, record.locator, record.transfer, page, null);
483
471
  transaction.objectStore(TRANSFERS).put(record);
484
472
  await completed(transaction);
485
473
  },
486
474
  async abandon(locator) {
487
- const transaction = database.transaction([TRANSFERS, DOCUMENTS, BINARY_TARGETS], 'readwrite');
475
+ const transaction = database.transaction([TRANSFERS, DOCUMENTS, BINARY_FILES], 'readwrite');
488
476
  const transfers = transaction.objectStore(TRANSFERS);
489
477
  const held = transfers.get(locator);
490
478
  held.onsuccess = () => {
@@ -494,17 +482,22 @@ export async function openRuntimeStore() {
494
482
  transfers.delete(locator);
495
483
  const range = underTransfer(locator, record.transfer);
496
484
  transaction.objectStore(DOCUMENTS).delete(range);
497
- transaction.objectStore(BINARY_TARGETS).delete(range);
485
+ transaction.objectStore(BINARY_FILES).delete(range);
498
486
  };
499
487
  await completed(transaction);
500
488
  },
501
489
  async generation() {
502
- return (await declaration(database)).generation;
490
+ const transaction = authored.transaction(FACTS, 'readonly');
491
+ const held = await settled(transaction.objectStore(FACTS).get(GENERATION));
492
+ return held ?? null;
503
493
  },
504
- rememberGeneration(value) {
505
- return updateDeclaration(database, (record) => ({ ...record, generation: value }));
494
+ async rememberGeneration(value) {
495
+ const transaction = authored.transaction(FACTS, 'readwrite');
496
+ transaction.objectStore(FACTS).put(value, GENERATION);
497
+ await completed(transaction);
506
498
  },
507
499
  close() {
500
+ authored.close();
508
501
  database.close();
509
502
  },
510
503
  };
package/dist/wire.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ConnectionRefusal } from './connection.js';
2
+ import type { Described } from './failure.js';
2
3
  export type RuntimePort = {
3
4
  postMessage(message: unknown): void;
4
5
  addEventListener(type: 'message' | 'close', listener: (event: {
@@ -14,6 +15,8 @@ declare const MEMBERS: {
14
15
  readonly types: 'within';
15
16
  readonly save: 'within';
16
17
  readonly history: 'within';
18
+ readonly 'binaryFile.read': 'within';
19
+ readonly 'binaryFile.readReference': 'within';
17
20
  readonly call: 'actions';
18
21
  readonly reached: 'within';
19
22
  readonly log: 'whole';
@@ -51,6 +54,7 @@ declare const TOPICS: {
51
54
  readonly presentation: 'app';
52
55
  readonly conversation: 'within';
53
56
  readonly conversations: 'within';
57
+ readonly agents: 'within';
54
58
  };
55
59
  export declare const WIRE_REACH: {
56
60
  readonly members: Readonly<Record<string, WireReach>>;
@@ -78,11 +82,10 @@ export type WireAnswer = {
78
82
  kind: 'result';
79
83
  id: number;
80
84
  value: unknown;
81
- } | {
85
+ } | ({
82
86
  kind: 'failure';
83
87
  id: number;
84
- message: string;
85
- } | {
88
+ } & Described) | {
86
89
  kind: 'event';
87
90
  id: number;
88
91
  value: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":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,OAAO,EAAE,iBAAiB,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtB,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAQ7C,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAiC5D;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAgC1D"}
package/dist/wire.js CHANGED
@@ -5,6 +5,8 @@ const MEMBERS = {
5
5
  types: 'within',
6
6
  save: 'within',
7
7
  history: 'within',
8
+ 'binaryFile.read': 'within',
9
+ 'binaryFile.readReference': 'within',
8
10
  call: 'actions',
9
11
  reached: 'within',
10
12
  log: 'whole',
@@ -42,6 +44,7 @@ const TOPICS = {
42
44
  presentation: 'app',
43
45
  conversation: 'within',
44
46
  conversations: 'within',
47
+ agents: 'within',
45
48
  };
46
49
  export const WIRE_REACH = { members: MEMBERS, topics: TOPICS };
47
50
  export const AUTHORIZATION_ENDED = 'the host authorization ended';
@@ -103,8 +106,17 @@ export function answer(message) {
103
106
  return { kind: 'result', id: shape.id, value: record.value };
104
107
  if (shape.kind === 'event')
105
108
  return { kind: 'event', id: shape.id, value: record.value };
106
- if (shape.kind === 'failure' && typeof record.message === 'string') {
107
- return { kind: 'failure', id: shape.id, message: record.message };
109
+ if (shape.kind === 'failure' &&
110
+ typeof record.message === 'string' &&
111
+ typeof record.code === 'string' &&
112
+ typeof record.retryable === 'boolean') {
113
+ return {
114
+ kind: 'failure',
115
+ id: shape.id,
116
+ message: record.message,
117
+ code: record.code,
118
+ retryable: record.retryable,
119
+ };
108
120
  }
109
121
  return null;
110
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime",
3
- "version": "0.1.0-cf6d5f0a5c9c8",
3
+ "version": "0.1.0-cf96c797c5fa8",
4
4
  "description": "The headless core of MD App",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,6 +32,10 @@
32
32
  "types": "./dist/react.d.ts",
33
33
  "import": "./dist/react.js"
34
34
  },
35
+ "./chat": {
36
+ "types": "./dist/chat.d.ts",
37
+ "import": "./dist/chat.js"
38
+ },
35
39
  "./package.json": "./package.json"
36
40
  },
37
41
  "files": [
@@ -41,16 +45,20 @@
41
45
  "LICENSE"
42
46
  ],
43
47
  "dependencies": {
44
- "@agentshouse/mdmodel": "0.1.0-c64dbada0730d",
48
+ "@agentshouse/mdmodel": "0.1.0-c64451b2127b4",
49
+ "@assistant-ui/react-markdown": "0.14.20",
45
50
  "@tanstack/db": "0.9.2",
46
- "minisearch": "7.2.0"
51
+ "lucide-react": "1.47.0",
52
+ "mdast-util-from-markdown": "2.0.3",
53
+ "mdast-util-gfm": "3.1.0",
54
+ "micromark-extension-gfm": "3.0.0",
55
+ "minisearch": "7.2.0",
56
+ "radix-ui": "1.8.0",
57
+ "remark-gfm": "4.0.1"
47
58
  },
48
59
  "peerDependencies": {
49
- "react": ">=18"
50
- },
51
- "peerDependenciesMeta": {
52
- "react": {
53
- "optional": true
54
- }
60
+ "@assistant-ui/react": "^0.15.22",
61
+ "react": ">=18",
62
+ "react-dom": ">=18"
55
63
  }
56
64
  }