@agentshouse/mdruntime 0.1.0-cedd665dffa4c → 0.1.0-cee2924c82d23

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 (225) hide show
  1. package/README.md +9 -9
  2. package/dist/acceptance.d.ts.map +1 -1
  3. package/dist/acceptance.js +30 -1
  4. package/dist/actions.d.ts.map +1 -1
  5. package/dist/actions.js +48 -9
  6. package/dist/adapter.d.ts +118 -19
  7. package/dist/adapter.d.ts.map +1 -1
  8. package/dist/attached-model.d.ts.map +1 -1
  9. package/dist/attached-model.js +2 -2
  10. package/dist/{binary.d.ts → attachment.d.ts} +8 -4
  11. package/dist/attachment.d.ts.map +1 -0
  12. package/dist/attachment.js +15 -0
  13. package/dist/authored.d.ts +88 -0
  14. package/dist/authored.d.ts.map +1 -0
  15. package/dist/authored.js +347 -0
  16. package/dist/chain.d.ts +1 -1
  17. package/dist/chain.d.ts.map +1 -1
  18. package/dist/chain.js +5 -2
  19. package/dist/change.d.ts +2 -2
  20. package/dist/chat-types.js +2 -2
  21. package/dist/client.d.ts +16 -7
  22. package/dist/client.d.ts.map +1 -1
  23. package/dist/client.js +24 -51
  24. package/dist/collection.d.ts +3 -1
  25. package/dist/collection.d.ts.map +1 -1
  26. package/dist/collection.js +16 -9
  27. package/dist/column.d.ts +5 -0
  28. package/dist/column.d.ts.map +1 -0
  29. package/dist/column.js +9 -0
  30. package/dist/compile.d.ts +2 -1
  31. package/dist/compile.d.ts.map +1 -1
  32. package/dist/compile.js +71 -39
  33. package/dist/connection.d.ts +1 -1
  34. package/dist/connection.d.ts.map +1 -1
  35. package/dist/connection.js +6 -2
  36. package/dist/conversation-live.d.ts +2 -3
  37. package/dist/conversation-live.d.ts.map +1 -1
  38. package/dist/conversation-live.js +2 -2
  39. package/dist/conversation.d.ts +18 -9
  40. package/dist/conversation.d.ts.map +1 -1
  41. package/dist/conversation.js +38 -22
  42. package/dist/declaration.js +3 -3
  43. package/dist/discovery.d.ts +3 -1
  44. package/dist/discovery.d.ts.map +1 -1
  45. package/dist/discovery.js +30 -5
  46. package/dist/download.d.ts +6 -0
  47. package/dist/download.d.ts.map +1 -0
  48. package/dist/download.js +42 -0
  49. package/dist/durability.d.ts +1 -0
  50. package/dist/durability.d.ts.map +1 -1
  51. package/dist/durability.js +3 -0
  52. package/dist/entry.d.ts +25 -1
  53. package/dist/entry.d.ts.map +1 -1
  54. package/dist/entry.js +111 -34
  55. package/dist/failure.d.ts.map +1 -1
  56. package/dist/failure.js +3 -1
  57. package/dist/figures.d.ts +1 -1
  58. package/dist/figures.d.ts.map +1 -1
  59. package/dist/figures.js +2 -2
  60. package/dist/file.d.ts +1 -1
  61. package/dist/file.d.ts.map +1 -1
  62. package/dist/file.js +1 -1
  63. package/dist/host.d.ts +6 -2
  64. package/dist/host.d.ts.map +1 -1
  65. package/dist/host.js +57 -21
  66. package/dist/house-query.d.ts +24 -0
  67. package/dist/house-query.d.ts.map +1 -0
  68. package/dist/house-query.js +102 -0
  69. package/dist/identity.d.ts +1 -1
  70. package/dist/identity.d.ts.map +1 -1
  71. package/dist/identity.js +1 -1
  72. package/dist/index.d.ts +17 -10
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +10 -5
  75. package/dist/lifecycle.d.ts +1 -1
  76. package/dist/lifecycle.d.ts.map +1 -1
  77. package/dist/lifecycle.js +28 -16
  78. package/dist/listing.d.ts +20 -12
  79. package/dist/listing.d.ts.map +1 -1
  80. package/dist/listing.js +33 -17
  81. package/dist/live.d.ts +14 -0
  82. package/dist/live.d.ts.map +1 -1
  83. package/dist/live.js +29 -12
  84. package/dist/loaded.d.ts +5 -3
  85. package/dist/loaded.d.ts.map +1 -1
  86. package/dist/loaded.js +12 -6
  87. package/dist/locks.d.ts.map +1 -1
  88. package/dist/locks.js +2 -0
  89. package/dist/media.d.ts +14 -3
  90. package/dist/media.d.ts.map +1 -1
  91. package/dist/media.js +126 -30
  92. package/dist/memory.d.ts +4 -2
  93. package/dist/memory.d.ts.map +1 -1
  94. package/dist/memory.js +47 -16
  95. package/dist/messages.d.ts +6 -1
  96. package/dist/messages.d.ts.map +1 -1
  97. package/dist/messages.js +11 -4
  98. package/dist/modal.d.ts +2 -0
  99. package/dist/modal.d.ts.map +1 -0
  100. package/dist/modal.js +11 -0
  101. package/dist/model.d.ts +10 -7
  102. package/dist/model.d.ts.map +1 -1
  103. package/dist/model.js +7 -1
  104. package/dist/name.d.ts +0 -1
  105. package/dist/name.d.ts.map +1 -1
  106. package/dist/name.js +3 -7
  107. package/dist/observation.d.ts +2 -0
  108. package/dist/observation.d.ts.map +1 -1
  109. package/dist/observation.js +42 -9
  110. package/dist/online.d.ts +7 -0
  111. package/dist/online.d.ts.map +1 -0
  112. package/dist/online.js +29 -0
  113. package/dist/opened.d.ts +5 -5
  114. package/dist/opened.d.ts.map +1 -1
  115. package/dist/opened.js +2 -2
  116. package/dist/opening.d.ts.map +1 -1
  117. package/dist/opening.js +18 -2
  118. package/dist/outcome.d.ts +27 -14
  119. package/dist/outcome.d.ts.map +1 -1
  120. package/dist/outcome.js +14 -5
  121. package/dist/overlay.d.ts +19 -8
  122. package/dist/overlay.d.ts.map +1 -1
  123. package/dist/overlay.js +108 -37
  124. package/dist/parts.d.ts +3 -1
  125. package/dist/parts.d.ts.map +1 -1
  126. package/dist/parts.js +30 -7
  127. package/dist/paths.d.ts +1 -1
  128. package/dist/paths.js +1 -1
  129. package/dist/preparation.d.ts +10 -5
  130. package/dist/preparation.d.ts.map +1 -1
  131. package/dist/preparation.js +78 -48
  132. package/dist/queries.d.ts.map +1 -1
  133. package/dist/queries.js +75 -53
  134. package/dist/query.d.ts +2 -2
  135. package/dist/query.d.ts.map +1 -1
  136. package/dist/questions.d.ts +1 -0
  137. package/dist/questions.d.ts.map +1 -1
  138. package/dist/questions.js +3 -1
  139. package/dist/reach.d.ts +13 -3
  140. package/dist/reach.d.ts.map +1 -1
  141. package/dist/reach.js +114 -25
  142. package/dist/react.d.ts +5 -1
  143. package/dist/react.d.ts.map +1 -1
  144. package/dist/readiness.d.ts +17 -4
  145. package/dist/readiness.d.ts.map +1 -1
  146. package/dist/readiness.js +17 -7
  147. package/dist/reads.d.ts +1 -1
  148. package/dist/reads.d.ts.map +1 -1
  149. package/dist/reads.js +17 -6
  150. package/dist/recovery.d.ts +1 -0
  151. package/dist/recovery.d.ts.map +1 -1
  152. package/dist/recovery.js +2 -1
  153. package/dist/reference-forms.d.ts +4 -0
  154. package/dist/reference-forms.d.ts.map +1 -0
  155. package/dist/reference-forms.js +74 -0
  156. package/dist/refresh.d.ts +1 -1
  157. package/dist/refresh.js +4 -4
  158. package/dist/replica.d.ts +3 -8
  159. package/dist/replica.d.ts.map +1 -1
  160. package/dist/replica.js +3 -3
  161. package/dist/room-draft.d.ts +1 -1
  162. package/dist/room-draft.d.ts.map +1 -1
  163. package/dist/room-draft.js +9 -6
  164. package/dist/room-drafts.d.ts.map +1 -1
  165. package/dist/room-drafts.js +8 -6
  166. package/dist/room-list.d.ts +10 -0
  167. package/dist/room-list.d.ts.map +1 -0
  168. package/dist/room-list.js +45 -0
  169. package/dist/rows.d.ts +9 -1
  170. package/dist/rows.d.ts.map +1 -1
  171. package/dist/rows.js +18 -4
  172. package/dist/running.d.ts +5 -0
  173. package/dist/running.d.ts.map +1 -0
  174. package/dist/running.js +10 -0
  175. package/dist/runtime.d.ts +5 -2
  176. package/dist/runtime.d.ts.map +1 -1
  177. package/dist/save.d.ts +1 -0
  178. package/dist/save.d.ts.map +1 -1
  179. package/dist/save.js +6 -6
  180. package/dist/saves.d.ts +7 -5
  181. package/dist/saves.d.ts.map +1 -1
  182. package/dist/saves.js +86 -49
  183. package/dist/selector.d.ts +3 -0
  184. package/dist/selector.d.ts.map +1 -0
  185. package/dist/selector.js +22 -0
  186. package/dist/shown.d.ts +2 -0
  187. package/dist/shown.d.ts.map +1 -1
  188. package/dist/shown.js +21 -4
  189. package/dist/socket/session.d.ts +4 -1
  190. package/dist/socket/session.d.ts.map +1 -1
  191. package/dist/socket/session.js +3 -0
  192. package/dist/socket.d.ts +1 -0
  193. package/dist/socket.d.ts.map +1 -1
  194. package/dist/socket.js +1 -0
  195. package/dist/source.d.ts +2 -0
  196. package/dist/source.d.ts.map +1 -1
  197. package/dist/source.js +2 -0
  198. package/dist/store/records.d.ts +22 -5
  199. package/dist/store/records.d.ts.map +1 -1
  200. package/dist/store/records.js +14 -4
  201. package/dist/store.d.ts +3 -2
  202. package/dist/store.d.ts.map +1 -1
  203. package/dist/store.js +4 -1
  204. package/dist/stored.d.ts +17 -3
  205. package/dist/stored.d.ts.map +1 -1
  206. package/dist/stored.js +139 -35
  207. package/dist/surface.d.ts +12 -7
  208. package/dist/surface.d.ts.map +1 -1
  209. package/dist/surface.js +48 -15
  210. package/dist/sync.d.ts +4 -2
  211. package/dist/sync.d.ts.map +1 -1
  212. package/dist/sync.js +45 -23
  213. package/dist/tables.d.ts +16 -47
  214. package/dist/tables.d.ts.map +1 -1
  215. package/dist/tables.js +69 -321
  216. package/dist/tallies.js +2 -2
  217. package/dist/validation.d.ts +2 -0
  218. package/dist/validation.d.ts.map +1 -1
  219. package/dist/validation.js +49 -3
  220. package/dist/wire.d.ts +28 -6
  221. package/dist/wire.d.ts.map +1 -1
  222. package/dist/wire.js +17 -11
  223. package/package.json +4 -4
  224. package/dist/binary.d.ts.map +0 -1
  225. package/dist/binary.js +0 -8
package/dist/tables.js CHANGED
@@ -1,9 +1,13 @@
1
1
  import { sql } from '@agentshouse/mdmodel';
2
- import { answerQuery } from './compile.js';
2
+ import { answerQuery, namedHandles } from './compile.js';
3
+ import { amended, authoredLocators, authoredPart, call, callRecords, chatDraft, chatDraftConversations, chatDraftRecord, chatDraftRecords, chatDraftsDropped, claim, fact, fenced, fencedWork, fences, FILE_PART_BYTES, authoredEmptied, heldOrder, kept, moving, pendingBatch, pendingState, queuedLocators, queueOf, queues, remember, roomDraft, roomDraftRecords, spooled, unfenced, unsent, unsentStatus, } from './authored.js';
4
+ import { count, text, texts } from './column.js';
3
5
  import { conversationFacts, conversationRows, forgottenConversations, heldConversations, keptFact, keptMessages, messageCount, messageWindow, MESSAGE_TABLES, turnArrived, } from './messages.js';
4
6
  import { keptRead, READ_TABLES, readsOfOtherBuildsForgotten, storedRead, } from './reads.js';
5
7
  import { conversationTallies, roomTallies, } from './tallies.js';
6
- import { abandon, release, commit, covering, demoted, ended, entries, erase, facts, fenceRooms, folders, heldLocators, heldRoom, heldRooms, offlineMode, opened, overlaid, presentation, rederive, referrers, refreshing, REPLICA_TABLES, resume, stage, typed, stagedLocators, tablesOf, typedWithin, unrefresh, } from './stored.js';
8
+ import { abandon, release, commit, covering, demoted, ended, entries, erase, facts, fenceRooms, folders, heldLocators, heldRoom, heldRooms, holders, offlineMode, opened, overlaid, presentation, rederive, referrers, refreshing, REPLICA_TABLES, resume, stage, typed, stagedLocators, tablesOf, typedWithin, unrefresh, } from './stored.js';
9
+ export { kindedRevision } from './reference-forms.js';
10
+ export { authoredEmptied, authoredTable, FILE_PART_BYTES, formatted, heldTables, } from './authored.js';
7
11
  const STATEMENTS_HELD = 256;
8
12
  export function sqliteConnection(engine, database) {
9
13
  const decoder = new TextDecoder();
@@ -71,36 +75,16 @@ export function sqliteConnection(engine, database) {
71
75
  },
72
76
  };
73
77
  }
74
- export const FILE_PART_BYTES = 1_048_576;
75
78
  const PROBE_BYTES = 4 * FILE_PART_BYTES;
76
- const TABLES = [
77
- ['authored_facts', 'name TEXT PRIMARY KEY, value TEXT NOT NULL'],
78
- ['authored_queues', 'locator TEXT PRIMARY KEY, ids TEXT NOT NULL'],
79
- [
80
- 'authored_pending',
81
- 'locator TEXT NOT NULL, id TEXT NOT NULL, batch TEXT NOT NULL, state TEXT NOT NULL, files TEXT NOT NULL, paths TEXT NOT NULL, moving INTEGER NOT NULL, PRIMARY KEY (locator, id)',
82
- ],
83
- [
84
- 'authored_room_drafts',
85
- 'locator TEXT NOT NULL, path TEXT NOT NULL, record TEXT NOT NULL, files TEXT NOT NULL, PRIMARY KEY (locator, path)',
86
- ],
87
- ['authored_chat_drafts', 'conversation TEXT PRIMARY KEY, record TEXT NOT NULL'],
88
- ['authored_calls', 'operation TEXT PRIMARY KEY, record TEXT NOT NULL, files TEXT NOT NULL'],
89
- ['authored_fences', 'locator TEXT PRIMARY KEY'],
90
- ];
91
79
  export const RUNTIME_TABLES = [
92
- ...TABLES.map(([name, columns]) => `CREATE TABLE ${name} (${columns}) WITHOUT ROWID`),
93
- 'CREATE TABLE file_parts (key TEXT NOT NULL, part INTEGER NOT NULL, bytes BLOB NOT NULL, PRIMARY KEY (key, part))',
94
80
  'CREATE TABLE opened_files (key TEXT PRIMARY KEY, locator TEXT NOT NULL, path TEXT NOT NULL, revision TEXT NOT NULL, media_type TEXT NOT NULL, sha256 TEXT, byte_length INTEGER) WITHOUT ROWID',
95
81
  'CREATE INDEX opened_files_name ON opened_files (locator, path, revision)',
82
+ 'CREATE TABLE opened_parts (key TEXT NOT NULL, part INTEGER NOT NULL, bytes BLOB NOT NULL, PRIMARY KEY (key, part))',
96
83
  ...REPLICA_TABLES,
97
84
  ...MESSAGE_TABLES,
98
85
  ...READ_TABLES,
99
86
  ];
100
- const OWNERS = ['authored_pending', 'authored_room_drafts', 'authored_calls'];
101
- const AUTHORED_KEYS = OWNERS.map((table) => `SELECT value FROM ${table}, json_each(${table}.files)`).join(' UNION ');
102
- const UNOWNED_PARTS = `DELETE FROM file_parts WHERE key NOT IN (${AUTHORED_KEYS} UNION SELECT key FROM opened_files)`;
103
- const CLEANABLE_BYTES = `SELECT coalesce(sum(length(bytes)), 0) AS bytes FROM file_parts WHERE key NOT IN (${AUTHORED_KEYS})`;
87
+ const UNOPENED_PARTS = 'DELETE FROM opened_parts WHERE key NOT IN (SELECT key FROM opened_files)';
104
88
  const READS = new Set([
105
89
  'authored.status',
106
90
  'authored.moving',
@@ -125,10 +109,12 @@ const READS = new Set([
125
109
  'replica.facts',
126
110
  'replica.presentation',
127
111
  'replica.query',
112
+ 'replica.named',
128
113
  'replica.tallies',
129
114
  'replica.entries',
130
115
  'replica.typed',
131
116
  'replica.referrers',
117
+ 'replica.holders',
132
118
  'replica.folders',
133
119
  'replica.typedWithin',
134
120
  'opened.find',
@@ -185,309 +171,75 @@ export function isRuntime(request) {
185
171
  export function readsRuntime(request) {
186
172
  return READS.has(request.kind);
187
173
  }
188
- function text(value) {
189
- return typeof value === 'string' ? value : String(value);
190
- }
191
- function texts(rows, column) {
192
- return rows.map((row) => text(row[column]));
193
- }
194
- function owned(files) {
195
- return JSON.stringify([...new Set(files)]);
196
- }
197
- function fact(connection, name) {
198
- const [held] = connection.rows('SELECT value FROM authored_facts WHERE name = ?', [name]);
199
- return held === undefined ? null : text(held.value);
200
- }
201
- function remember(connection, name, value) {
202
- connection.run('INSERT OR REPLACE INTO authored_facts (name, value) VALUES (?, ?)', [
203
- name,
204
- value,
205
- ]);
206
- return null;
207
- }
208
- function fenced(connection, locator) {
209
- return connection.rows('SELECT 1 FROM authored_fences WHERE locator = ?', [locator]).length > 0;
210
- }
211
- function stored(connection, key) {
212
- return connection.rows('SELECT 1 FROM file_parts WHERE key = ? LIMIT 1', [key]).length > 0;
213
- }
214
- function storedPart(connection, key, part, bytes) {
215
- connection.run('INSERT INTO file_parts (key, part, bytes) VALUES (?, ?, ?)', [key, part, bytes]);
216
- }
217
- async function storedFiles(connection, files) {
218
- for (const { key, blob } of files) {
219
- if (stored(connection, key))
220
- continue;
221
- for (let at = 0, part = 0; at < blob.size; at += FILE_PART_BYTES, part += 1) {
222
- const bytes = new Uint8Array(await blob.slice(at, at + FILE_PART_BYTES).arrayBuffer());
223
- storedPart(connection, key, part, bytes);
224
- }
225
- }
226
- }
227
- function filePart(connection, key, part) {
228
- const [held] = connection.rows('SELECT bytes FROM file_parts WHERE key = ? AND part = ?', [
229
- key,
230
- part,
231
- ]);
232
- return held?.bytes instanceof Uint8Array ? held.bytes : null;
233
- }
234
- function* fileParts(connection, key) {
235
- for (let part = 0;; part += 1) {
236
- const bytes = filePart(connection, key, part);
237
- if (bytes === null)
238
- return;
239
- yield bytes;
240
- }
241
- }
242
- async function spooled(connection, spool, { key, type }) {
243
- for (const held of [...spool.held()]) {
244
- if (held !== key && !stored(connection, held))
245
- await spool.drop(held);
246
- }
247
- return spool.spool(key, type, fileParts(connection, key));
248
- }
249
- function unowned(connection) {
250
- connection.run(UNOWNED_PARTS);
251
- }
252
- function queued(connection) {
253
- return connection.rows('SELECT locator, ids FROM authored_queues').map((row) => ({
254
- locator: text(row.locator),
255
- ids: JSON.parse(text(row.ids)),
256
- }));
257
- }
258
174
  function heldWork(connection, locator) {
259
175
  const room = heldRoom(connection, locator);
260
- const pending = new Map(connection
261
- .rows('SELECT id, batch, state FROM authored_pending WHERE locator = ?', [locator])
262
- .map((row) => [
263
- text(row.id),
264
- { id: text(row.id), batch: text(row.batch), state: text(row.state) },
265
- ]));
266
176
  return {
267
177
  room: room === null ? null : { ...room, overlaid: overlaid(connection, room.key) },
268
- queue: heldOrder(connection, locator).map((id) => {
269
- const held = pending.get(id);
270
- if (held === undefined)
271
- throw new Error(`Missing Pending Change ${locator}/${id}`);
272
- return held;
273
- }),
178
+ queue: queueOf(connection, locator),
274
179
  };
275
180
  }
276
181
  function status(connection) {
277
- const [completed] = connection.rows("SELECT value FROM replica_facts WHERE name = 'lastCompleted'");
278
182
  return {
279
- queued: texts(connection.rows('SELECT locator FROM authored_queues'), 'locator'),
280
- lastCompleted: completed === undefined ? null : text(completed.value),
281
- changes: connection
282
- .rows('SELECT p.locator, c.value AS path FROM authored_pending p, json_each(p.paths) c')
283
- .map((row) => ({ locator: text(row.locator), path: text(row.path) })),
284
- resets: connection
285
- .rows(`SELECT locator, json_extract(state, '$.submission.reset') AS reset FROM authored_pending
286
- WHERE json_extract(state, '$.submission.state') = 'reset'`)
287
- .map((row) => ({ locator: text(row.locator), reset: text(row.reset) })),
288
- returned: texts(connection.rows(`SELECT record FROM authored_room_drafts WHERE json_type(record, '$.returned') = 'object'`), 'record'),
183
+ ...unsentStatus(connection),
184
+ lastCompleted: facts(connection, ['lastCompleted']).lastCompleted ?? null,
289
185
  };
290
186
  }
291
187
  function pendingOf(connection, locator, id) {
292
- const [held] = connection.rows('SELECT state FROM authored_pending WHERE locator = ? AND id = ?', [locator, id]);
293
188
  return {
294
- state: held === undefined ? null : text(held.state),
189
+ state: pendingState(connection, locator, id),
295
190
  room: connection.rows('SELECT 1 FROM replica_rooms WHERE locator = ?', [locator]).length > 0,
296
191
  };
297
192
  }
298
- function roomDraftRecords(connection, locator, paths) {
299
- if (locator === null) {
300
- return texts(connection.rows('SELECT record FROM authored_room_drafts'), 'record');
301
- }
302
- if (paths === null) {
303
- return texts(connection.rows('SELECT record FROM authored_room_drafts WHERE locator = ?', [locator]), 'record');
304
- }
305
- return texts(connection.rows('SELECT record FROM authored_room_drafts WHERE locator = ? AND path IN (SELECT value FROM json_each(?))', [locator, JSON.stringify(paths)]), 'record');
306
- }
307
- function chatDraftRecord(connection, conversation) {
308
- const [held] = connection.rows('SELECT record FROM authored_chat_drafts WHERE conversation = ?', [
309
- conversation,
310
- ]);
311
- return held === undefined ? null : text(held.record);
312
- }
313
- function heldOrder(connection, locator) {
314
- const [held] = connection.rows('SELECT ids FROM authored_queues WHERE locator = ?', [locator]);
315
- return held === undefined ? [] : JSON.parse(text(held.ids));
316
- }
317
- function keptRows(connection, { locator, order, added, founded, roomDrafts, consumedRoomDrafts }) {
318
- for (const path of consumedRoomDrafts ?? []) {
319
- connection.run('DELETE FROM authored_room_drafts WHERE locator = ? AND path = ?', [
320
- locator,
321
- path,
322
- ]);
323
- }
324
- for (const { path, record, files } of roomDrafts ?? []) {
325
- connection.run('INSERT OR REPLACE INTO authored_room_drafts (locator, path, record, files) VALUES (?, ?, ?, ?)', [locator, path, record, owned(files)]);
326
- }
327
- if (order === undefined)
328
- return;
329
- const before = new Set(heldOrder(connection, locator));
330
- const after = new Set(order);
331
- if (after.size === 0)
332
- connection.run('DELETE FROM authored_queues WHERE locator = ?', [locator]);
333
- else {
334
- connection.run('INSERT OR REPLACE INTO authored_queues (locator, ids) VALUES (?, ?)', [
335
- locator,
336
- JSON.stringify([...after]),
337
- ]);
338
- }
339
- for (const id of before) {
340
- if (!after.has(id)) {
341
- connection.run('DELETE FROM authored_pending WHERE locator = ? AND id = ?', [locator, id]);
342
- }
343
- }
344
- for (const { id, batch, state, files, paths, moving } of added ?? []) {
345
- if (before.has(id))
346
- continue;
347
- connection.run('INSERT OR REPLACE INTO authored_pending (locator, id, batch, state, files, paths, moving) VALUES (?, ?, ?, ?, ?, ?, ?)', [locator, id, batch, state, owned(files), JSON.stringify(paths), moving ? 1 : 0]);
348
- }
349
- for (const { id, batch, files, paths, moving } of founded ?? []) {
350
- const [held] = connection.rows('SELECT files FROM authored_pending WHERE locator = ? AND id = ?', [locator, id]);
351
- if (held === undefined || !before.has(id))
352
- continue;
353
- connection.run('UPDATE authored_pending SET batch = ?, files = ?, paths = ?, moving = ? WHERE locator = ? AND id = ?', [
354
- batch,
355
- owned([...JSON.parse(text(held.files)), ...files]),
356
- JSON.stringify(paths),
357
- moving ? 1 : 0,
358
- locator,
359
- id,
360
- ]);
361
- }
362
- }
363
- async function kept(connection, { writes, files, whole }) {
364
- const refused = writes.find(({ locator }) => fenced(connection, locator));
365
- if (refused !== undefined && whole)
366
- return refused.locator;
367
- await storedFiles(connection, files);
368
- for (const write of writes) {
369
- if (!fenced(connection, write.locator))
370
- keptRows(connection, write);
371
- }
372
- unowned(connection);
373
- return refused?.locator ?? null;
374
- }
375
- function amended(connection, { locator, id, amendment }) {
376
- if (fenced(connection, locator))
377
- return null;
378
- const [held] = connection.rows('SELECT state FROM authored_pending WHERE locator = ? AND id = ?', [locator, id]);
379
- if (held === undefined)
380
- return null;
381
- connection.run('UPDATE authored_pending SET state = ? WHERE locator = ? AND id = ?', [
382
- JSON.stringify({
383
- ...JSON.parse(text(held.state)),
384
- ...JSON.parse(amendment),
385
- }),
386
- locator,
387
- id,
388
- ]);
389
- return null;
390
- }
391
- async function roomDraft(connection, { locator, path, kept: draft, files }) {
392
- if (fenced(connection, locator))
393
- return locator;
394
- await storedFiles(connection, files);
395
- if (draft === null) {
396
- connection.run('DELETE FROM authored_room_drafts WHERE locator = ? AND path = ?', [
397
- locator,
398
- path,
399
- ]);
400
- }
401
- else {
402
- connection.run('INSERT OR REPLACE INTO authored_room_drafts (locator, path, record, files) VALUES (?, ?, ?, ?)', [locator, path, draft.record, owned(draft.files)]);
403
- }
404
- unowned(connection);
405
- return null;
406
- }
407
- function conversationTables() {
408
- return [...tablesOf(MESSAGE_TABLES), 'authored_chat_drafts'];
409
- }
410
193
  function storedConversations(connection, conversations) {
411
194
  const named = conversations === null ? '' : ' WHERE conversation IN (SELECT value FROM json_each(?))';
412
195
  const bound = conversations === null ? [] : [JSON.stringify(conversations)];
413
196
  return [
414
- ...new Set(conversationTables().flatMap((table) => texts(connection.rows(`SELECT DISTINCT conversation FROM ${table}${named}`, bound), 'conversation'))),
197
+ ...new Set([
198
+ ...tablesOf(MESSAGE_TABLES).flatMap((table) => texts(connection.rows(`SELECT DISTINCT conversation FROM ${table}${named}`, bound), 'conversation')),
199
+ ...chatDraftConversations(connection, conversations),
200
+ ]),
415
201
  ];
416
202
  }
417
203
  function droppedConversations(connection, conversations) {
418
204
  const held = storedConversations(connection, conversations);
419
- for (const table of conversationTables()) {
205
+ for (const table of tablesOf(MESSAGE_TABLES)) {
420
206
  connection.run(`DELETE FROM ${table} WHERE conversation IN (SELECT value FROM json_each(?))`, [
421
207
  JSON.stringify(conversations),
422
208
  ]);
423
209
  }
210
+ chatDraftsDropped(connection, conversations);
424
211
  return held;
425
212
  }
426
- function chatDraft(connection, { kept: drafts, dropped }) {
427
- for (const conversation of dropped) {
428
- connection.run('DELETE FROM authored_chat_drafts WHERE conversation = ?', [conversation]);
429
- }
430
- for (const { conversation, record } of drafts) {
431
- connection.run('INSERT OR REPLACE INTO authored_chat_drafts (conversation, record) VALUES (?, ?)', [conversation, record]);
432
- }
433
- return null;
434
- }
435
- async function call(connection, { operation, kept: held, files }) {
436
- await storedFiles(connection, files);
437
- if (held === null)
438
- connection.run('DELETE FROM authored_calls WHERE operation = ?', [operation]);
439
- else {
440
- connection.run('INSERT OR REPLACE INTO authored_calls (operation, record, files) VALUES (?, ?, ?)', [operation, held.record, owned(held.files)]);
441
- }
442
- unowned(connection);
443
- return null;
444
- }
445
- function roomWork(connection, locator) {
446
- connection.run('DELETE FROM authored_queues WHERE locator = ?', [locator]);
447
- connection.run('DELETE FROM authored_pending WHERE locator = ?', [locator]);
213
+ function unopened(connection) {
214
+ connection.run(UNOPENED_PARTS);
448
215
  }
449
216
  function fence(connection, locators) {
217
+ fencedWork(connection, locators);
450
218
  for (const locator of locators) {
451
- connection.run('INSERT OR REPLACE INTO authored_fences (locator) VALUES (?)', [locator]);
452
- roomWork(connection, locator);
453
- connection.run('DELETE FROM authored_room_drafts WHERE locator = ?', [locator]);
454
219
  connection.run('DELETE FROM opened_files WHERE locator = ?', [locator]);
455
220
  }
456
- unowned(connection);
221
+ unopened(connection);
457
222
  return fenceRooms(connection, locators);
458
223
  }
459
224
  function erased(connection, { locator, limit }) {
460
225
  return erase(connection, locator, limit);
461
226
  }
462
- function unfenced(connection, locators) {
227
+ function unfencedRooms(connection, locators) {
463
228
  const erased = locators.filter((locator) => connection.rows('SELECT 1 FROM replica_erasing WHERE locator = ? LIMIT 1', [locator])
464
229
  .length === 0);
465
- for (const locator of erased) {
466
- connection.run('DELETE FROM authored_fences WHERE locator = ?', [locator]);
467
- }
230
+ unfenced(connection, erased);
468
231
  return erased;
469
232
  }
470
- function claim(connection, holder) {
471
- const held = fact(connection, 'holder');
472
- if (held !== null)
473
- return held === holder;
474
- remember(connection, 'holder', holder);
475
- return true;
476
- }
477
233
  function end(connection, holder) {
478
234
  ended(connection);
479
235
  forgottenConversations(connection);
480
236
  if (holder !== null && claim(connection, holder))
481
237
  return true;
482
- for (const [table] of TABLES)
483
- connection.run(`DELETE FROM ${table}`);
238
+ authoredEmptied(connection);
484
239
  connection.run('DELETE FROM opened_files');
485
- connection.run('DELETE FROM file_parts');
240
+ connection.run('DELETE FROM opened_parts');
486
241
  return false;
487
242
  }
488
- function count(value) {
489
- return typeof value === 'bigint' ? Number(value) : typeof value === 'number' ? value : 0;
490
- }
491
243
  function openedFile(connection, { locator, path, revision }) {
492
244
  const [held] = connection.rows('SELECT key, media_type, byte_length FROM opened_files WHERE locator = ? AND path = ? AND revision = ? AND byte_length IS NOT NULL', [locator, path, revision]);
493
245
  return held === undefined
@@ -502,7 +254,7 @@ function opening(connection, { key, locator, path, revision, mediaType }) {
502
254
  if (fenced(connection, locator))
503
255
  return false;
504
256
  connection.run('DELETE FROM opened_files WHERE locator = ? AND path = ? AND revision = ? AND byte_length IS NULL', [locator, path, revision]);
505
- unowned(connection);
257
+ unopened(connection);
506
258
  connection.run('INSERT INTO opened_files (key, locator, path, revision, media_type) VALUES (?, ?, ?, ?, ?)', [key, locator, path, revision, mediaType]);
507
259
  return true;
508
260
  }
@@ -515,19 +267,23 @@ function fetching(connection, key) {
515
267
  function openedPart(connection, { key, part, bytes }) {
516
268
  if (fetching(connection, key) === null)
517
269
  return false;
518
- storedPart(connection, key, part, bytes);
270
+ connection.run('INSERT INTO opened_parts (key, part, bytes) VALUES (?, ?, ?)', [
271
+ key,
272
+ part,
273
+ bytes,
274
+ ]);
519
275
  return true;
520
276
  }
521
277
  function dropped(connection, key) {
522
278
  connection.run('DELETE FROM opened_files WHERE key = ?', [key]);
523
- connection.run('DELETE FROM file_parts WHERE key = ?', [key]);
279
+ connection.run('DELETE FROM opened_parts WHERE key = ?', [key]);
524
280
  return null;
525
281
  }
526
282
  function keptOpened(connection, { key, sha256, byteLength, parts }) {
527
283
  const fetched = fetching(connection, key);
528
284
  if (fetched === null)
529
285
  return false;
530
- const [held] = connection.rows('SELECT count(*) AS parts, min(part) AS first, max(part) AS last, coalesce(sum(length(bytes)), 0) AS bytes FROM file_parts WHERE key = ?', [key]);
286
+ const [held] = connection.rows('SELECT count(*) AS parts, min(part) AS first, max(part) AS last, coalesce(sum(length(bytes)), 0) AS bytes FROM opened_parts WHERE key = ?', [key]);
531
287
  const whole = count(held.parts) === parts &&
532
288
  count(held.bytes) === byteLength &&
533
289
  (parts === 0 || (count(held.first) === 0 && count(held.last) === parts - 1));
@@ -541,27 +297,24 @@ function keptOpened(connection, { key, sha256, byteLength, parts }) {
541
297
  key,
542
298
  ]);
543
299
  connection.run('DELETE FROM opened_files WHERE locator = ? AND path = ? AND revision = ? AND key <> ?', [fetched.locator, fetched.path, fetched.revision, key]);
544
- unowned(connection);
300
+ unopened(connection);
545
301
  return true;
546
302
  }
547
- const UNSENT = [
548
- ['pending-change', 'authored_pending'],
549
- ['call', 'authored_calls'],
550
- ['room-draft', 'authored_room_drafts'],
551
- ['chat-draft', 'authored_chat_drafts'],
552
- ];
553
- function unsent(connection) {
554
- const [held] = connection.rows(`SELECT ${UNSENT.map(([kind, table]) => `(SELECT count(*) FROM ${table}) AS "${kind}"`).join(', ')}`);
555
- return UNSENT.map(([kind]) => ({ kind, count: count(held[kind]) })).filter((work) => work.count > 0);
303
+ function heldPart(connection, key, part) {
304
+ const [held] = connection.rows('SELECT bytes FROM opened_parts WHERE key = ? AND part = ?', [
305
+ key,
306
+ part,
307
+ ]);
308
+ return held?.bytes instanceof Uint8Array ? held.bytes : authoredPart(connection, key, part);
556
309
  }
557
310
  function cleanable(connection) {
558
- const [held] = connection.rows(CLEANABLE_BYTES);
311
+ const [held] = connection.rows('SELECT coalesce(sum(length(bytes)), 0) AS bytes FROM opened_parts');
559
312
  return count(held.bytes);
560
313
  }
561
314
  function cleaned(connection) {
562
315
  connection.run('DELETE FROM opened_files');
563
316
  const freed = cleanable(connection);
564
- unowned(connection);
317
+ unopened(connection);
565
318
  return freed;
566
319
  }
567
320
  function openedHeld(connection) {
@@ -587,51 +340,39 @@ export function answerRuntime(connection, request, spool) {
587
340
  case 'authored.status':
588
341
  return status(connection);
589
342
  case 'authored.moving':
590
- return {
591
- queues: queued(connection),
592
- pending: connection
593
- .rows('SELECT locator, id, batch, state FROM authored_pending WHERE moving = 1 ORDER BY locator')
594
- .map((row) => ({
595
- locator: text(row.locator),
596
- id: text(row.id),
597
- batch: text(row.batch),
598
- state: text(row.state),
599
- })),
600
- };
343
+ return moving(connection);
601
344
  case 'authored.pending':
602
345
  return pendingOf(connection, request.locator, request.id);
603
- case 'authored.batch': {
604
- const [held] = connection.rows('SELECT batch FROM authored_pending WHERE locator = ? AND id = ?', [request.locator, request.id]);
605
- return held === undefined ? null : text(held.batch);
606
- }
346
+ case 'authored.batch':
347
+ return pendingBatch(connection, request.locator, request.id);
607
348
  case 'authored.order':
608
349
  return heldOrder(connection, request.locator);
609
350
  case 'authored.queued':
610
- return texts(connection.rows('SELECT locator FROM authored_queues'), 'locator');
351
+ return queuedLocators(connection);
611
352
  case 'authored.roomDrafts':
612
353
  return roomDraftRecords(connection, request.locator, request.paths);
613
354
  case 'authored.chatDraft.read':
614
355
  return chatDraftRecord(connection, request.conversation);
615
356
  case 'authored.chatDrafts':
616
- return texts(connection.rows('SELECT record FROM authored_chat_drafts'), 'record');
357
+ return chatDraftRecords(connection);
617
358
  case 'authored.calls':
618
- return texts(connection.rows('SELECT record FROM authored_calls'), 'record');
359
+ return callRecords(connection);
619
360
  case 'authored.fences':
620
- return texts(connection.rows('SELECT locator FROM authored_fences'), 'locator');
361
+ return fences(connection);
621
362
  case 'authored.unsent':
622
363
  return unsent(connection);
623
364
  case 'authored.fact':
624
365
  return fact(connection, request.name);
625
366
  case 'authored.file':
626
- return spooled(connection, spool, request);
367
+ return spooled(connection, spool, request.key, request.type);
627
368
  case 'authored.amend':
628
- return amended(connection, request);
369
+ return amended(connection, request.locator, request.id, request.amendment);
629
370
  case 'authored.roomDraft':
630
- return roomDraft(connection, request);
371
+ return roomDraft(connection, request.locator, request.path, request.kept, request.files);
631
372
  case 'authored.chatDraft':
632
- return chatDraft(connection, request);
373
+ return chatDraft(connection, request.kept, request.dropped);
633
374
  case 'authored.call':
634
- return call(connection, request);
375
+ return call(connection, request.operation, request.kept, request.files);
635
376
  case 'authored.remember':
636
377
  return remember(connection, request.name, request.value);
637
378
  case 'authored.claim':
@@ -645,11 +386,14 @@ export function answerRuntime(connection, request, spool) {
645
386
  case 'replica.room':
646
387
  return heldWork(connection, request.locator);
647
388
  case 'replica.covering':
648
- return { ...covering(connection, request.since), queues: queued(connection) };
389
+ return { ...covering(connection, request.since), queues: queues(connection) };
649
390
  case 'replica.offline':
650
391
  return offlineMode(connection, request.locator);
651
392
  case 'replica.held':
652
- return { held: heldLocators(connection), staged: stagedLocators(connection) };
393
+ return {
394
+ held: [...new Set([...heldLocators(connection), ...authoredLocators(connection)])],
395
+ staged: stagedLocators(connection),
396
+ };
653
397
  case 'replica.demote':
654
398
  return demoted(connection);
655
399
  case 'replica.facts':
@@ -657,7 +401,9 @@ export function answerRuntime(connection, request, spool) {
657
401
  case 'replica.presentation':
658
402
  return presentation(connection, request.app);
659
403
  case 'replica.query':
660
- return answerQuery(connection, request.plan, request.rooms, request.budget);
404
+ return answerQuery(connection, request.plan, request.rooms, request.budget, request.follows);
405
+ case 'replica.named':
406
+ return namedHandles(connection, request.plan, request.rooms, request.handles);
661
407
  case 'replica.tallies':
662
408
  return roomTallies(connection, request.totals, request.rooms, request.since);
663
409
  case 'replica.entries':
@@ -666,6 +412,8 @@ export function answerRuntime(connection, request, spool) {
666
412
  return typed(connection, request.key, request.view, request.paths);
667
413
  case 'replica.referrers':
668
414
  return referrers(connection, request.key, request.view, request.targets);
415
+ case 'replica.holders':
416
+ return holders(connection, request.key, request.view, request.sought);
669
417
  case 'replica.folders':
670
418
  return folders(connection, request.key, request.paths);
671
419
  case 'replica.typedWithin':
@@ -687,7 +435,7 @@ export function answerRuntime(connection, request, spool) {
687
435
  case 'replica.abandon':
688
436
  return abandon(connection, request.locator);
689
437
  case 'replica.unfence':
690
- return unfenced(connection, request.locators);
438
+ return unfencedRooms(connection, request.locators);
691
439
  case 'replica.release':
692
440
  return release(connection, request.key);
693
441
  case 'replica.rederive':
@@ -719,7 +467,7 @@ export function answerRuntime(connection, request, spool) {
719
467
  case 'opened.held':
720
468
  return openedHeld(connection);
721
469
  case 'file.part':
722
- return filePart(connection, request.key, request.part);
470
+ return heldPart(connection, request.key, request.part);
723
471
  case 'conversation.held':
724
472
  return heldConversations(connection, request.conversations);
725
473
  case 'conversation.keep': {
package/dist/tallies.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { CHAT_MESSAGE_TYPE, CHAT_TYPE, instantKey, sql } from '@agentshouse/mdmodel';
2
2
  import { answerQuery, VISIBLE, within } from './compile.js';
3
- import { HOUSE_DIRECTORY } from './figures.js';
3
+ import { HOUSE_FOLDER } from './figures.js';
4
4
  const NONE = { count: 0, size: 0 };
5
5
  const { all, fragment, joined } = sql;
6
6
  function instant(value) {
7
7
  return typeof value === 'string' ? value : null;
8
8
  }
9
9
  function held(alias, keys) {
10
- const reserved = within(alias, HOUSE_DIRECTORY);
10
+ const reserved = within(alias, HOUSE_FOLDER);
11
11
  return all([
12
12
  fragment(`${alias}.key IN (SELECT value FROM json_each(?))`, [JSON.stringify(keys)]),
13
13
  fragment(VISIBLE(alias)),
@@ -1,5 +1,6 @@
1
1
  import { type Validation } from '@agentshouse/mdmodel';
2
2
  import { type Composition } from './collection.js';
3
+ import type { Holder, Sought } from './stored.js';
3
4
  type Examined = {
4
5
  readonly path: string;
5
6
  readonly content: string | null;
@@ -23,6 +24,7 @@ type Neighbourhood = {
23
24
  readonly lookup: Lookup;
24
25
  readonly texts: (paths: readonly string[]) => Promise<ReadonlyMap<string, string | null>>;
25
26
  readonly referrers: (targets: readonly string[]) => Promise<readonly string[]>;
27
+ readonly holders: (sought: readonly Sought[]) => Promise<readonly Holder[]>;
26
28
  };
27
29
  export declare function validatedNeighbourhood(changes: readonly Changed[], composition: Composition, source: Neighbourhood): Promise<Validation>;
28
30
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.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