@agentshouse/mdruntime 0.1.0-c112fd663ab59 → 0.1.0-c11fdcbfb7fe2

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 (310) hide show
  1. package/README.md +21 -19
  2. package/dist/acceptance.d.ts +0 -3
  3. package/dist/acceptance.d.ts.map +1 -1
  4. package/dist/acceptance.js +101 -158
  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 +8 -2
  9. package/dist/actions.d.ts.map +1 -1
  10. package/dist/actions.js +165 -75
  11. package/dist/adapter.d.ts +209 -73
  12. package/dist/adapter.d.ts.map +1 -1
  13. package/dist/attached-model.d.ts +0 -1
  14. package/dist/attached-model.d.ts.map +1 -1
  15. package/dist/attached-model.js +2 -7
  16. package/dist/{binary.d.ts → attachment.d.ts} +8 -4
  17. package/dist/attachment.d.ts.map +1 -0
  18. package/dist/attachment.js +15 -0
  19. package/dist/authored.d.ts +88 -0
  20. package/dist/authored.d.ts.map +1 -0
  21. package/dist/authored.js +345 -0
  22. package/dist/bootstrap.d.ts +1 -1
  23. package/dist/bootstrap.d.ts.map +1 -1
  24. package/dist/bootstrap.js +6 -19
  25. package/dist/chain.d.ts +1 -1
  26. package/dist/chain.d.ts.map +1 -1
  27. package/dist/chain.js +5 -2
  28. package/dist/change-set.d.ts +4 -0
  29. package/dist/change-set.d.ts.map +1 -1
  30. package/dist/change-set.js +6 -0
  31. package/dist/change.d.ts +6 -2
  32. package/dist/change.d.ts.map +1 -1
  33. package/dist/change.js +3 -0
  34. package/dist/chat-types.d.ts +0 -2
  35. package/dist/chat-types.d.ts.map +1 -1
  36. package/dist/chat-types.js +2 -4
  37. package/dist/client.d.ts +29 -24
  38. package/dist/client.d.ts.map +1 -1
  39. package/dist/client.js +51 -66
  40. package/dist/collection.d.ts +27 -4
  41. package/dist/collection.d.ts.map +1 -1
  42. package/dist/collection.js +34 -10
  43. package/dist/column.d.ts +5 -0
  44. package/dist/column.d.ts.map +1 -0
  45. package/dist/column.js +9 -0
  46. package/dist/compile.d.ts +4 -1
  47. package/dist/compile.d.ts.map +1 -1
  48. package/dist/compile.js +88 -44
  49. package/dist/connection.d.ts +1 -1
  50. package/dist/connection.d.ts.map +1 -1
  51. package/dist/connection.js +36 -27
  52. package/dist/context.d.ts.map +1 -1
  53. package/dist/context.js +1 -1
  54. package/dist/conversation-live.d.ts +29 -15
  55. package/dist/conversation-live.d.ts.map +1 -1
  56. package/dist/conversation-live.js +26 -14
  57. package/dist/conversation-row.d.ts +20 -1
  58. package/dist/conversation-row.d.ts.map +1 -1
  59. package/dist/conversation-row.js +30 -7
  60. package/dist/conversation.d.ts +47 -16
  61. package/dist/conversation.d.ts.map +1 -1
  62. package/dist/conversation.js +358 -258
  63. package/dist/declaration.d.ts +10 -0
  64. package/dist/declaration.d.ts.map +1 -0
  65. package/dist/declaration.js +24 -0
  66. package/dist/discovery.d.ts +3 -1
  67. package/dist/discovery.d.ts.map +1 -1
  68. package/dist/discovery.js +47 -47
  69. package/dist/download.d.ts +6 -0
  70. package/dist/download.d.ts.map +1 -0
  71. package/dist/download.js +42 -0
  72. package/dist/durability.d.ts +5 -0
  73. package/dist/durability.d.ts.map +1 -1
  74. package/dist/durability.js +7 -0
  75. package/dist/entry.d.ts +25 -1
  76. package/dist/entry.d.ts.map +1 -1
  77. package/dist/entry.js +111 -34
  78. package/dist/expectation.d.ts +25 -14
  79. package/dist/expectation.d.ts.map +1 -1
  80. package/dist/expectation.js +51 -20
  81. package/dist/failure.d.ts +2 -0
  82. package/dist/failure.d.ts.map +1 -1
  83. package/dist/failure.js +6 -1
  84. package/dist/figures.d.ts +1 -1
  85. package/dist/figures.d.ts.map +1 -1
  86. package/dist/figures.js +6 -4
  87. package/dist/file.d.ts +1 -1
  88. package/dist/file.d.ts.map +1 -1
  89. package/dist/file.js +3 -2
  90. package/dist/host.d.ts +24 -4
  91. package/dist/host.d.ts.map +1 -1
  92. package/dist/host.js +108 -32
  93. package/dist/house-query.d.ts +24 -0
  94. package/dist/house-query.d.ts.map +1 -0
  95. package/dist/house-query.js +102 -0
  96. package/dist/identity.d.ts +1 -1
  97. package/dist/identity.d.ts.map +1 -1
  98. package/dist/identity.js +1 -1
  99. package/dist/index.d.ts +29 -16
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +19 -9
  102. package/dist/install.d.ts +10 -6
  103. package/dist/install.d.ts.map +1 -1
  104. package/dist/install.js +89 -108
  105. package/dist/lifecycle.d.ts +2 -2
  106. package/dist/lifecycle.d.ts.map +1 -1
  107. package/dist/lifecycle.js +76 -54
  108. package/dist/listing.d.ts +29 -22
  109. package/dist/listing.d.ts.map +1 -1
  110. package/dist/listing.js +71 -79
  111. package/dist/live.d.ts +19 -3
  112. package/dist/live.d.ts.map +1 -1
  113. package/dist/live.js +94 -36
  114. package/dist/loaded.d.ts +7 -0
  115. package/dist/loaded.d.ts.map +1 -0
  116. package/dist/loaded.js +46 -0
  117. package/dist/locks.d.ts +2 -4
  118. package/dist/locks.d.ts.map +1 -1
  119. package/dist/locks.js +10 -38
  120. package/dist/lost.d.ts.map +1 -1
  121. package/dist/lost.js +11 -23
  122. package/dist/media.d.ts +19 -3
  123. package/dist/media.d.ts.map +1 -1
  124. package/dist/media.js +181 -34
  125. package/dist/memory.d.ts +10 -4
  126. package/dist/memory.d.ts.map +1 -1
  127. package/dist/memory.js +101 -40
  128. package/dist/messages.d.ts +21 -6
  129. package/dist/messages.d.ts.map +1 -1
  130. package/dist/messages.js +48 -30
  131. package/dist/modal.d.ts +2 -0
  132. package/dist/modal.d.ts.map +1 -0
  133. package/dist/modal.js +11 -0
  134. package/dist/model.d.ts +10 -8
  135. package/dist/model.d.ts.map +1 -1
  136. package/dist/model.js +6 -5
  137. package/dist/models.d.ts +4 -8
  138. package/dist/models.d.ts.map +1 -1
  139. package/dist/models.js +94 -138
  140. package/dist/name.d.ts +0 -1
  141. package/dist/name.d.ts.map +1 -1
  142. package/dist/name.js +3 -7
  143. package/dist/observation.d.ts +29 -12
  144. package/dist/observation.d.ts.map +1 -1
  145. package/dist/observation.js +206 -69
  146. package/dist/online.d.ts +7 -0
  147. package/dist/online.d.ts.map +1 -0
  148. package/dist/online.js +29 -0
  149. package/dist/opened.d.ts +6 -6
  150. package/dist/opened.d.ts.map +1 -1
  151. package/dist/opened.js +4 -4
  152. package/dist/opening.d.ts.map +1 -1
  153. package/dist/opening.js +23 -12
  154. package/dist/outcome.d.ts +33 -13
  155. package/dist/outcome.d.ts.map +1 -1
  156. package/dist/outcome.js +36 -6
  157. package/dist/overlay.d.ts +23 -8
  158. package/dist/overlay.d.ts.map +1 -1
  159. package/dist/overlay.js +132 -48
  160. package/dist/page-metadata.d.ts +8 -0
  161. package/dist/page-metadata.d.ts.map +1 -0
  162. package/dist/page-metadata.js +19 -0
  163. package/dist/parts.d.ts +5 -59
  164. package/dist/parts.d.ts.map +1 -1
  165. package/dist/parts.js +32 -122
  166. package/dist/paths.d.ts +1 -1
  167. package/dist/paths.js +1 -1
  168. package/dist/preparation.d.ts +33 -7
  169. package/dist/preparation.d.ts.map +1 -1
  170. package/dist/preparation.js +207 -96
  171. package/dist/presence.d.ts +58 -0
  172. package/dist/presence.d.ts.map +1 -0
  173. package/dist/presence.js +231 -0
  174. package/dist/queries.d.ts +2 -2
  175. package/dist/queries.d.ts.map +1 -1
  176. package/dist/queries.js +137 -79
  177. package/dist/query.d.ts +2 -2
  178. package/dist/query.d.ts.map +1 -1
  179. package/dist/questions.d.ts +1 -5
  180. package/dist/questions.d.ts.map +1 -1
  181. package/dist/questions.js +3 -8
  182. package/dist/queue.d.ts +40 -0
  183. package/dist/queue.d.ts.map +1 -0
  184. package/dist/queue.js +480 -0
  185. package/dist/reach.d.ts +15 -6
  186. package/dist/reach.d.ts.map +1 -1
  187. package/dist/reach.js +198 -38
  188. package/dist/react.d.ts +17 -5
  189. package/dist/react.d.ts.map +1 -1
  190. package/dist/react.js +28 -5
  191. package/dist/readiness.d.ts +23 -4
  192. package/dist/readiness.d.ts.map +1 -1
  193. package/dist/readiness.js +18 -10
  194. package/dist/reads.d.ts +4 -2
  195. package/dist/reads.d.ts.map +1 -1
  196. package/dist/reads.js +22 -7
  197. package/dist/recovery.d.ts +4 -1
  198. package/dist/recovery.d.ts.map +1 -1
  199. package/dist/recovery.js +31 -8
  200. package/dist/refresh.d.ts +1 -1
  201. package/dist/refresh.js +6 -6
  202. package/dist/refusal.d.ts.map +1 -1
  203. package/dist/refusal.js +2 -4
  204. package/dist/replica.d.ts +6 -17
  205. package/dist/replica.d.ts.map +1 -1
  206. package/dist/replica.js +17 -19
  207. package/dist/retried.d.ts +30 -0
  208. package/dist/retried.d.ts.map +1 -0
  209. package/dist/retried.js +72 -0
  210. package/dist/room-draft.d.ts +31 -6
  211. package/dist/room-draft.d.ts.map +1 -1
  212. package/dist/room-draft.js +279 -69
  213. package/dist/room-drafts.d.ts.map +1 -1
  214. package/dist/room-drafts.js +12 -7
  215. package/dist/room-list.d.ts +10 -0
  216. package/dist/room-list.d.ts.map +1 -0
  217. package/dist/room-list.js +47 -0
  218. package/dist/rows.d.ts +11 -3
  219. package/dist/rows.d.ts.map +1 -1
  220. package/dist/rows.js +28 -15
  221. package/dist/run-tables.d.ts +25 -0
  222. package/dist/run-tables.d.ts.map +1 -0
  223. package/dist/run-tables.js +98 -0
  224. package/dist/running.d.ts +5 -0
  225. package/dist/running.d.ts.map +1 -0
  226. package/dist/running.js +10 -0
  227. package/dist/runs.d.ts +27 -0
  228. package/dist/runs.d.ts.map +1 -0
  229. package/dist/runs.js +92 -0
  230. package/dist/runtime.d.ts +13 -19
  231. package/dist/runtime.d.ts.map +1 -1
  232. package/dist/save.d.ts +43 -90
  233. package/dist/save.d.ts.map +1 -1
  234. package/dist/save.js +314 -223
  235. package/dist/saves.d.ts +9 -45
  236. package/dist/saves.d.ts.map +1 -1
  237. package/dist/saves.js +206 -748
  238. package/dist/seed.d.ts.map +1 -1
  239. package/dist/seed.js +4 -4
  240. package/dist/selector.d.ts +3 -0
  241. package/dist/selector.d.ts.map +1 -0
  242. package/dist/selector.js +22 -0
  243. package/dist/shown.d.ts +9 -5
  244. package/dist/shown.d.ts.map +1 -1
  245. package/dist/shown.js +93 -57
  246. package/dist/socket/lanes.d.ts +12 -4
  247. package/dist/socket/lanes.d.ts.map +1 -1
  248. package/dist/socket/lanes.js +34 -8
  249. package/dist/socket/session.d.ts +4 -1
  250. package/dist/socket/session.d.ts.map +1 -1
  251. package/dist/socket/session.js +3 -0
  252. package/dist/socket.d.ts +7 -7
  253. package/dist/socket.d.ts.map +1 -1
  254. package/dist/socket.js +11 -14
  255. package/dist/source.d.ts +24 -7
  256. package/dist/source.d.ts.map +1 -1
  257. package/dist/source.js +48 -9
  258. package/dist/store/installs.d.ts +2 -2
  259. package/dist/store/installs.d.ts.map +1 -1
  260. package/dist/store/installs.js +10 -4
  261. package/dist/store/readiness.d.ts +5 -4
  262. package/dist/store/readiness.d.ts.map +1 -1
  263. package/dist/store/readiness.js +28 -12
  264. package/dist/store/records.d.ts +31 -9
  265. package/dist/store/records.d.ts.map +1 -1
  266. package/dist/store/records.js +69 -26
  267. package/dist/store/rooms-shown.d.ts +8 -0
  268. package/dist/store/rooms-shown.d.ts.map +1 -0
  269. package/dist/store/rooms-shown.js +13 -0
  270. package/dist/store.d.ts +25 -15
  271. package/dist/store.d.ts.map +1 -1
  272. package/dist/store.js +50 -18
  273. package/dist/stored.d.ts +41 -16
  274. package/dist/stored.d.ts.map +1 -1
  275. package/dist/stored.js +217 -59
  276. package/dist/surface.d.ts +20 -8
  277. package/dist/surface.d.ts.map +1 -1
  278. package/dist/surface.js +68 -34
  279. package/dist/sync.d.ts +4 -2
  280. package/dist/sync.d.ts.map +1 -1
  281. package/dist/sync.js +127 -102
  282. package/dist/tables.d.ts +40 -56
  283. package/dist/tables.d.ts.map +1 -1
  284. package/dist/tables.js +109 -329
  285. package/dist/tallies.d.ts.map +1 -1
  286. package/dist/tallies.js +3 -4
  287. package/dist/validation.d.ts +2 -0
  288. package/dist/validation.d.ts.map +1 -1
  289. package/dist/validation.js +51 -11
  290. package/dist/wire.d.ts +72 -12
  291. package/dist/wire.d.ts.map +1 -1
  292. package/dist/wire.js +31 -14
  293. package/package.json +4 -3
  294. package/dist/attempt.d.ts +0 -16
  295. package/dist/attempt.d.ts.map +0 -1
  296. package/dist/attempt.js +0 -70
  297. package/dist/binary.d.ts.map +0 -1
  298. package/dist/binary.js +0 -8
  299. package/dist/job.d.ts +0 -33
  300. package/dist/job.d.ts.map +0 -1
  301. package/dist/job.js +0 -54
  302. package/dist/log.d.ts +0 -6
  303. package/dist/log.d.ts.map +0 -1
  304. package/dist/log.js +0 -14
  305. package/dist/socket/rooms.d.ts +0 -44
  306. package/dist/socket/rooms.d.ts.map +0 -1
  307. package/dist/socket/rooms.js +0 -90
  308. package/dist/store/fences.d.ts +0 -16
  309. package/dist/store/fences.d.ts.map +0 -1
  310. package/dist/store/fences.js +0 -26
package/dist/tables.js CHANGED
@@ -1,9 +1,13 @@
1
1
  import { sql } from '@agentshouse/mdmodel';
2
- import { answerQuery } from './compile.js';
3
- import { conversationRows, droppedMessages, forgottenMessages, heldConversations, jobMarkers, keptMessages, messageCount, messageWindow, MESSAGE_TABLES, turnArrived, } from './messages.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';
5
+ import { conversationFacts, conversationRows, forgottenConversations, heldConversations, keptFact, keptMessages, messageCount, messageWindow, MESSAGE_TABLES, turnArrived, } from './messages.js';
6
+ import { forgottenRuns, heldRuns, keptRuns, RUN_TABLES, runMarks, runsLeft, } from './run-tables.js';
4
7
  import { keptRead, READ_TABLES, readsOfOtherBuildsForgotten, storedRead, } from './reads.js';
5
8
  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, typedWithin, unrefresh, } from './stored.js';
9
+ 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';
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,17 @@ 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,
86
+ ...RUN_TABLES,
99
87
  ];
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})`;
88
+ const UNOPENED_PARTS = 'DELETE FROM opened_parts WHERE key NOT IN (SELECT key FROM opened_files)';
104
89
  const READS = new Set([
105
90
  'authored.status',
106
91
  'authored.moving',
@@ -125,10 +110,12 @@ const READS = new Set([
125
110
  'replica.facts',
126
111
  'replica.presentation',
127
112
  'replica.query',
113
+ 'replica.named',
128
114
  'replica.tallies',
129
115
  'replica.entries',
130
116
  'replica.typed',
131
117
  'replica.referrers',
118
+ 'replica.holders',
132
119
  'replica.folders',
133
120
  'replica.typedWithin',
134
121
  'opened.find',
@@ -139,9 +126,12 @@ const READS = new Set([
139
126
  'conversation.count',
140
127
  'conversation.turn',
141
128
  'conversation.rows',
142
- 'conversation.jobs',
143
129
  'conversation.tallies',
130
+ 'conversation.facts',
131
+ 'conversation.stored',
144
132
  'read.stored',
133
+ 'run.marks',
134
+ 'run.held',
145
135
  ]);
146
136
  const KINDS = new Set([
147
137
  ...READS,
@@ -172,10 +162,13 @@ const KINDS = new Set([
172
162
  'opened.drop',
173
163
  'opened.clean',
174
164
  'conversation.keep',
165
+ 'conversation.fact',
175
166
  'conversation.drop',
176
167
  'space.probe',
177
168
  'read.keep',
178
169
  'read.builds',
170
+ 'run.keep',
171
+ 'run.left',
179
172
  ]);
180
173
  export function isRuntime(request) {
181
174
  return KINDS.has(request.kind);
@@ -183,290 +176,76 @@ export function isRuntime(request) {
183
176
  export function readsRuntime(request) {
184
177
  return READS.has(request.kind);
185
178
  }
186
- function text(value) {
187
- return typeof value === 'string' ? value : String(value);
188
- }
189
- function texts(rows, column) {
190
- return rows.map((row) => text(row[column]));
191
- }
192
- function owned(files) {
193
- return JSON.stringify([...new Set(files)]);
194
- }
195
- function fact(connection, name) {
196
- const [held] = connection.rows('SELECT value FROM authored_facts WHERE name = ?', [name]);
197
- return held === undefined ? null : text(held.value);
198
- }
199
- function remember(connection, name, value) {
200
- connection.run('INSERT OR REPLACE INTO authored_facts (name, value) VALUES (?, ?)', [
201
- name,
202
- value,
203
- ]);
204
- return null;
205
- }
206
- function fenced(connection, locator) {
207
- return connection.rows('SELECT 1 FROM authored_fences WHERE locator = ?', [locator]).length > 0;
208
- }
209
- function stored(connection, key) {
210
- return connection.rows('SELECT 1 FROM file_parts WHERE key = ? LIMIT 1', [key]).length > 0;
211
- }
212
- function storedPart(connection, key, part, bytes) {
213
- connection.run('INSERT INTO file_parts (key, part, bytes) VALUES (?, ?, ?)', [key, part, bytes]);
214
- }
215
- async function storedFiles(connection, files) {
216
- for (const { key, blob } of files) {
217
- if (stored(connection, key))
218
- continue;
219
- for (let at = 0, part = 0; at < blob.size; at += FILE_PART_BYTES, part += 1) {
220
- const bytes = new Uint8Array(await blob.slice(at, at + FILE_PART_BYTES).arrayBuffer());
221
- storedPart(connection, key, part, bytes);
222
- }
223
- }
224
- }
225
- function filePart(connection, key, part) {
226
- const [held] = connection.rows('SELECT bytes FROM file_parts WHERE key = ? AND part = ?', [
227
- key,
228
- part,
229
- ]);
230
- return held?.bytes instanceof Uint8Array ? held.bytes : null;
231
- }
232
- function* fileParts(connection, key) {
233
- for (let part = 0;; part += 1) {
234
- const bytes = filePart(connection, key, part);
235
- if (bytes === null)
236
- return;
237
- yield bytes;
238
- }
239
- }
240
- async function spooled(connection, spool, { key, type }) {
241
- for (const held of [...spool.held()]) {
242
- if (held !== key && !stored(connection, held))
243
- await spool.drop(held);
244
- }
245
- return spool.spool(key, type, fileParts(connection, key));
246
- }
247
- function unowned(connection) {
248
- connection.run(UNOWNED_PARTS);
249
- }
250
- function queued(connection) {
251
- return connection.rows('SELECT locator, ids FROM authored_queues').map((row) => ({
252
- locator: text(row.locator),
253
- ids: JSON.parse(text(row.ids)),
254
- }));
255
- }
256
179
  function heldWork(connection, locator) {
257
180
  const room = heldRoom(connection, locator);
258
- const pending = new Map(connection
259
- .rows('SELECT id, batch, state FROM authored_pending WHERE locator = ?', [locator])
260
- .map((row) => [
261
- text(row.id),
262
- { id: text(row.id), batch: text(row.batch), state: text(row.state) },
263
- ]));
264
181
  return {
265
182
  room: room === null ? null : { ...room, overlaid: overlaid(connection, room.key) },
266
- queue: heldOrder(connection, locator).map((id) => {
267
- const held = pending.get(id);
268
- if (held === undefined)
269
- throw new Error(`Missing Pending Change ${locator}/${id}`);
270
- return held;
271
- }),
183
+ queue: queueOf(connection, locator),
272
184
  };
273
185
  }
274
186
  function status(connection) {
275
- const [completed] = connection.rows("SELECT value FROM replica_facts WHERE name = 'lastCompleted'");
276
187
  return {
277
- queued: texts(connection.rows('SELECT locator FROM authored_queues'), 'locator'),
278
- lastCompleted: completed === undefined ? null : text(completed.value),
279
- changes: connection
280
- .rows('SELECT p.locator, c.value AS path FROM authored_pending p, json_each(p.paths) c')
281
- .map((row) => ({ locator: text(row.locator), path: text(row.path) })),
282
- resets: connection
283
- .rows(`SELECT locator, json_extract(state, '$.submission.reset') AS reset FROM authored_pending
284
- WHERE json_extract(state, '$.submission.state') = 'reset'`)
285
- .map((row) => ({ locator: text(row.locator), reset: text(row.reset) })),
286
- returned: texts(connection.rows(`SELECT record FROM authored_room_drafts WHERE json_type(record, '$.returned') = 'object'`), 'record'),
188
+ ...unsentStatus(connection),
189
+ lastCompleted: facts(connection, ['lastCompleted']).lastCompleted ?? null,
287
190
  };
288
191
  }
289
192
  function pendingOf(connection, locator, id) {
290
- const [held] = connection.rows('SELECT state FROM authored_pending WHERE locator = ? AND id = ?', [locator, id]);
291
193
  return {
292
- state: held === undefined ? null : text(held.state),
194
+ state: pendingState(connection, locator, id),
293
195
  room: connection.rows('SELECT 1 FROM replica_rooms WHERE locator = ?', [locator]).length > 0,
294
196
  };
295
197
  }
296
- function roomDraftRecords(connection, locator, paths) {
297
- if (locator === null) {
298
- return texts(connection.rows('SELECT record FROM authored_room_drafts'), 'record');
299
- }
300
- if (paths === null) {
301
- return texts(connection.rows('SELECT record FROM authored_room_drafts WHERE locator = ?', [locator]), 'record');
302
- }
303
- 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');
304
- }
305
- function chatDraftRecord(connection, conversation) {
306
- const [held] = connection.rows('SELECT record FROM authored_chat_drafts WHERE conversation = ?', [
307
- conversation,
308
- ]);
309
- return held === undefined ? null : text(held.record);
310
- }
311
- function heldOrder(connection, locator) {
312
- const [held] = connection.rows('SELECT ids FROM authored_queues WHERE locator = ?', [locator]);
313
- return held === undefined ? [] : JSON.parse(text(held.ids));
314
- }
315
- function keptRows(connection, { locator, order, added, founded, roomDrafts, consumedRoomDrafts }) {
316
- for (const path of consumedRoomDrafts ?? []) {
317
- connection.run('DELETE FROM authored_room_drafts WHERE locator = ? AND path = ?', [
318
- locator,
319
- path,
320
- ]);
321
- }
322
- for (const { path, record, files } of roomDrafts ?? []) {
323
- connection.run('INSERT OR REPLACE INTO authored_room_drafts (locator, path, record, files) VALUES (?, ?, ?, ?)', [locator, path, record, owned(files)]);
324
- }
325
- if (order === undefined)
326
- return;
327
- const before = new Set(heldOrder(connection, locator));
328
- const after = new Set(order);
329
- if (after.size === 0)
330
- connection.run('DELETE FROM authored_queues WHERE locator = ?', [locator]);
331
- else {
332
- connection.run('INSERT OR REPLACE INTO authored_queues (locator, ids) VALUES (?, ?)', [
333
- locator,
334
- JSON.stringify([...after]),
335
- ]);
336
- }
337
- for (const id of before) {
338
- if (!after.has(id)) {
339
- connection.run('DELETE FROM authored_pending WHERE locator = ? AND id = ?', [locator, id]);
340
- }
341
- }
342
- for (const { id, batch, state, files, paths, moving } of added ?? []) {
343
- if (before.has(id))
344
- continue;
345
- 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]);
346
- }
347
- for (const { id, batch, files, paths, moving } of founded ?? []) {
348
- const [held] = connection.rows('SELECT files FROM authored_pending WHERE locator = ? AND id = ?', [locator, id]);
349
- if (held === undefined || !before.has(id))
350
- continue;
351
- connection.run('UPDATE authored_pending SET batch = ?, files = ?, paths = ?, moving = ? WHERE locator = ? AND id = ?', [
352
- batch,
353
- owned([...JSON.parse(text(held.files)), ...files]),
354
- JSON.stringify(paths),
355
- moving ? 1 : 0,
356
- locator,
357
- id,
358
- ]);
359
- }
360
- }
361
- async function kept(connection, { writes, files, whole }) {
362
- const refused = writes.find(({ locator }) => fenced(connection, locator));
363
- if (refused !== undefined && whole)
364
- return refused.locator;
365
- await storedFiles(connection, files);
366
- for (const write of writes) {
367
- if (!fenced(connection, write.locator))
368
- keptRows(connection, write);
369
- }
370
- unowned(connection);
371
- return refused?.locator ?? null;
372
- }
373
- function amended(connection, { locator, id, amendment }) {
374
- if (fenced(connection, locator))
375
- return null;
376
- const [held] = connection.rows('SELECT state FROM authored_pending WHERE locator = ? AND id = ?', [locator, id]);
377
- if (held === undefined)
378
- return null;
379
- connection.run('UPDATE authored_pending SET state = ? WHERE locator = ? AND id = ?', [
380
- JSON.stringify({
381
- ...JSON.parse(text(held.state)),
382
- ...JSON.parse(amendment),
383
- }),
384
- locator,
385
- id,
386
- ]);
387
- return null;
388
- }
389
- async function roomDraft(connection, { locator, path, kept: draft, files }) {
390
- if (fenced(connection, locator))
391
- return locator;
392
- await storedFiles(connection, files);
393
- if (draft === null) {
394
- connection.run('DELETE FROM authored_room_drafts WHERE locator = ? AND path = ?', [
395
- locator,
396
- path,
198
+ function storedConversations(connection, conversations) {
199
+ const named = conversations === null ? '' : ' WHERE conversation IN (SELECT value FROM json_each(?))';
200
+ const bound = conversations === null ? [] : [JSON.stringify(conversations)];
201
+ return [
202
+ ...new Set([
203
+ ...tablesOf(MESSAGE_TABLES).flatMap((table) => texts(connection.rows(`SELECT DISTINCT conversation FROM ${table}${named}`, bound), 'conversation')),
204
+ ...chatDraftConversations(connection, conversations),
205
+ ]),
206
+ ];
207
+ }
208
+ function droppedConversations(connection, conversations) {
209
+ const held = storedConversations(connection, conversations);
210
+ for (const table of tablesOf(MESSAGE_TABLES)) {
211
+ connection.run(`DELETE FROM ${table} WHERE conversation IN (SELECT value FROM json_each(?))`, [
212
+ JSON.stringify(conversations),
397
213
  ]);
398
214
  }
399
- else {
400
- connection.run('INSERT OR REPLACE INTO authored_room_drafts (locator, path, record, files) VALUES (?, ?, ?, ?)', [locator, path, draft.record, owned(draft.files)]);
401
- }
402
- unowned(connection);
403
- return null;
404
- }
405
- function chatDraft(connection, { kept: drafts, dropped }) {
406
- for (const conversation of dropped) {
407
- connection.run('DELETE FROM authored_chat_drafts WHERE conversation = ?', [conversation]);
408
- }
409
- for (const { conversation, record } of drafts) {
410
- connection.run('INSERT OR REPLACE INTO authored_chat_drafts (conversation, record) VALUES (?, ?)', [conversation, record]);
411
- }
412
- return null;
215
+ chatDraftsDropped(connection, conversations);
216
+ return held;
413
217
  }
414
- async function call(connection, { operation, kept: held, files }) {
415
- await storedFiles(connection, files);
416
- if (held === null)
417
- connection.run('DELETE FROM authored_calls WHERE operation = ?', [operation]);
418
- else {
419
- connection.run('INSERT OR REPLACE INTO authored_calls (operation, record, files) VALUES (?, ?, ?)', [operation, held.record, owned(held.files)]);
420
- }
421
- unowned(connection);
422
- return null;
423
- }
424
- function roomWork(connection, locator) {
425
- connection.run('DELETE FROM authored_queues WHERE locator = ?', [locator]);
426
- connection.run('DELETE FROM authored_pending WHERE locator = ?', [locator]);
218
+ function unopened(connection) {
219
+ connection.run(UNOPENED_PARTS);
427
220
  }
428
221
  function fence(connection, locators) {
222
+ fencedWork(connection, locators);
429
223
  for (const locator of locators) {
430
- connection.run('INSERT OR REPLACE INTO authored_fences (locator) VALUES (?)', [locator]);
431
- roomWork(connection, locator);
432
- connection.run('DELETE FROM authored_room_drafts WHERE locator = ?', [locator]);
433
224
  connection.run('DELETE FROM opened_files WHERE locator = ?', [locator]);
434
225
  }
435
- unowned(connection);
226
+ unopened(connection);
436
227
  return fenceRooms(connection, locators);
437
228
  }
438
229
  function erased(connection, { locator, limit }) {
439
230
  return erase(connection, locator, limit);
440
231
  }
441
- function unfenced(connection, locators) {
232
+ function unfencedRooms(connection, locators) {
442
233
  const erased = locators.filter((locator) => connection.rows('SELECT 1 FROM replica_erasing WHERE locator = ? LIMIT 1', [locator])
443
234
  .length === 0);
444
- for (const locator of erased) {
445
- connection.run('DELETE FROM authored_fences WHERE locator = ?', [locator]);
446
- }
235
+ unfenced(connection, erased);
447
236
  return erased;
448
237
  }
449
- function claim(connection, holder) {
450
- const held = fact(connection, 'holder');
451
- if (held !== null)
452
- return held === holder;
453
- remember(connection, 'holder', holder);
454
- return true;
455
- }
456
238
  function end(connection, holder) {
457
239
  ended(connection);
458
- forgottenMessages(connection);
240
+ forgottenConversations(connection);
241
+ forgottenRuns(connection);
459
242
  if (holder !== null && claim(connection, holder))
460
243
  return true;
461
- for (const [table] of TABLES)
462
- connection.run(`DELETE FROM ${table}`);
244
+ authoredEmptied(connection);
463
245
  connection.run('DELETE FROM opened_files');
464
- connection.run('DELETE FROM file_parts');
246
+ connection.run('DELETE FROM opened_parts');
465
247
  return false;
466
248
  }
467
- function count(value) {
468
- return typeof value === 'bigint' ? Number(value) : typeof value === 'number' ? value : 0;
469
- }
470
249
  function openedFile(connection, { locator, path, revision }) {
471
250
  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]);
472
251
  return held === undefined
@@ -481,7 +260,7 @@ function opening(connection, { key, locator, path, revision, mediaType }) {
481
260
  if (fenced(connection, locator))
482
261
  return false;
483
262
  connection.run('DELETE FROM opened_files WHERE locator = ? AND path = ? AND revision = ? AND byte_length IS NULL', [locator, path, revision]);
484
- unowned(connection);
263
+ unopened(connection);
485
264
  connection.run('INSERT INTO opened_files (key, locator, path, revision, media_type) VALUES (?, ?, ?, ?, ?)', [key, locator, path, revision, mediaType]);
486
265
  return true;
487
266
  }
@@ -494,19 +273,23 @@ function fetching(connection, key) {
494
273
  function openedPart(connection, { key, part, bytes }) {
495
274
  if (fetching(connection, key) === null)
496
275
  return false;
497
- storedPart(connection, key, part, bytes);
276
+ connection.run('INSERT INTO opened_parts (key, part, bytes) VALUES (?, ?, ?)', [
277
+ key,
278
+ part,
279
+ bytes,
280
+ ]);
498
281
  return true;
499
282
  }
500
283
  function dropped(connection, key) {
501
284
  connection.run('DELETE FROM opened_files WHERE key = ?', [key]);
502
- connection.run('DELETE FROM file_parts WHERE key = ?', [key]);
285
+ connection.run('DELETE FROM opened_parts WHERE key = ?', [key]);
503
286
  return null;
504
287
  }
505
288
  function keptOpened(connection, { key, sha256, byteLength, parts }) {
506
289
  const fetched = fetching(connection, key);
507
290
  if (fetched === null)
508
291
  return false;
509
- 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]);
292
+ 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]);
510
293
  const whole = count(held.parts) === parts &&
511
294
  count(held.bytes) === byteLength &&
512
295
  (parts === 0 || (count(held.first) === 0 && count(held.last) === parts - 1));
@@ -520,27 +303,24 @@ function keptOpened(connection, { key, sha256, byteLength, parts }) {
520
303
  key,
521
304
  ]);
522
305
  connection.run('DELETE FROM opened_files WHERE locator = ? AND path = ? AND revision = ? AND key <> ?', [fetched.locator, fetched.path, fetched.revision, key]);
523
- unowned(connection);
306
+ unopened(connection);
524
307
  return true;
525
308
  }
526
- const UNSENT = [
527
- ['pending-change', 'authored_pending'],
528
- ['call', 'authored_calls'],
529
- ['room-draft', 'authored_room_drafts'],
530
- ['chat-draft', 'authored_chat_drafts'],
531
- ];
532
- function unsent(connection) {
533
- const [held] = connection.rows(`SELECT ${UNSENT.map(([kind, table]) => `(SELECT count(*) FROM ${table}) AS "${kind}"`).join(', ')}`);
534
- return UNSENT.map(([kind]) => ({ kind, count: count(held[kind]) })).filter((work) => work.count > 0);
309
+ function heldPart(connection, key, part) {
310
+ const [held] = connection.rows('SELECT bytes FROM opened_parts WHERE key = ? AND part = ?', [
311
+ key,
312
+ part,
313
+ ]);
314
+ return held?.bytes instanceof Uint8Array ? held.bytes : authoredPart(connection, key, part);
535
315
  }
536
316
  function cleanable(connection) {
537
- const [held] = connection.rows(CLEANABLE_BYTES);
317
+ const [held] = connection.rows('SELECT coalesce(sum(length(bytes)), 0) AS bytes FROM opened_parts');
538
318
  return count(held.bytes);
539
319
  }
540
320
  function cleaned(connection) {
541
321
  connection.run('DELETE FROM opened_files');
542
322
  const freed = cleanable(connection);
543
- unowned(connection);
323
+ unopened(connection);
544
324
  return freed;
545
325
  }
546
326
  function openedHeld(connection) {
@@ -566,51 +346,39 @@ export function answerRuntime(connection, request, spool) {
566
346
  case 'authored.status':
567
347
  return status(connection);
568
348
  case 'authored.moving':
569
- return {
570
- queues: queued(connection),
571
- pending: connection
572
- .rows('SELECT locator, id, batch, state FROM authored_pending WHERE moving = 1 ORDER BY locator')
573
- .map((row) => ({
574
- locator: text(row.locator),
575
- id: text(row.id),
576
- batch: text(row.batch),
577
- state: text(row.state),
578
- })),
579
- };
349
+ return moving(connection);
580
350
  case 'authored.pending':
581
351
  return pendingOf(connection, request.locator, request.id);
582
- case 'authored.batch': {
583
- const [held] = connection.rows('SELECT batch FROM authored_pending WHERE locator = ? AND id = ?', [request.locator, request.id]);
584
- return held === undefined ? null : text(held.batch);
585
- }
352
+ case 'authored.batch':
353
+ return pendingBatch(connection, request.locator, request.id);
586
354
  case 'authored.order':
587
355
  return heldOrder(connection, request.locator);
588
356
  case 'authored.queued':
589
- return texts(connection.rows('SELECT locator FROM authored_queues'), 'locator');
357
+ return queuedLocators(connection);
590
358
  case 'authored.roomDrafts':
591
359
  return roomDraftRecords(connection, request.locator, request.paths);
592
360
  case 'authored.chatDraft.read':
593
361
  return chatDraftRecord(connection, request.conversation);
594
362
  case 'authored.chatDrafts':
595
- return texts(connection.rows('SELECT record FROM authored_chat_drafts'), 'record');
363
+ return chatDraftRecords(connection);
596
364
  case 'authored.calls':
597
- return texts(connection.rows('SELECT record FROM authored_calls'), 'record');
365
+ return callRecords(connection);
598
366
  case 'authored.fences':
599
- return texts(connection.rows('SELECT locator FROM authored_fences'), 'locator');
367
+ return fences(connection);
600
368
  case 'authored.unsent':
601
369
  return unsent(connection);
602
370
  case 'authored.fact':
603
371
  return fact(connection, request.name);
604
372
  case 'authored.file':
605
- return spooled(connection, spool, request);
373
+ return spooled(connection, spool, request.key, request.type);
606
374
  case 'authored.amend':
607
- return amended(connection, request);
375
+ return amended(connection, request.locator, request.id, request.amendment);
608
376
  case 'authored.roomDraft':
609
- return roomDraft(connection, request);
377
+ return roomDraft(connection, request.locator, request.path, request.kept, request.files);
610
378
  case 'authored.chatDraft':
611
- return chatDraft(connection, request);
379
+ return chatDraft(connection, request.kept, request.dropped);
612
380
  case 'authored.call':
613
- return call(connection, request);
381
+ return call(connection, request.operation, request.kept, request.files);
614
382
  case 'authored.remember':
615
383
  return remember(connection, request.name, request.value);
616
384
  case 'authored.claim':
@@ -624,22 +392,24 @@ export function answerRuntime(connection, request, spool) {
624
392
  case 'replica.room':
625
393
  return heldWork(connection, request.locator);
626
394
  case 'replica.covering':
627
- return {
628
- rooms: covering(connection),
629
- queues: queued(connection),
630
- };
395
+ return { ...covering(connection, request.since), queues: queues(connection) };
631
396
  case 'replica.offline':
632
397
  return offlineMode(connection, request.locator);
633
398
  case 'replica.held':
634
- return { held: heldLocators(connection), staged: stagedLocators(connection) };
399
+ return {
400
+ held: [...new Set([...heldLocators(connection), ...authoredLocators(connection)])],
401
+ staged: stagedLocators(connection),
402
+ };
635
403
  case 'replica.demote':
636
404
  return demoted(connection);
637
405
  case 'replica.facts':
638
- return facts(connection);
406
+ return facts(connection, request.names);
639
407
  case 'replica.presentation':
640
408
  return presentation(connection, request.app);
641
409
  case 'replica.query':
642
- return answerQuery(connection, request.plan, request.rooms, request.budget);
410
+ return answerQuery(connection, request.plan, request.rooms, request.budget, request.follows);
411
+ case 'replica.named':
412
+ return namedHandles(connection, request.plan, request.rooms, request.handles);
643
413
  case 'replica.tallies':
644
414
  return roomTallies(connection, request.totals, request.rooms, request.since);
645
415
  case 'replica.entries':
@@ -648,6 +418,8 @@ export function answerRuntime(connection, request, spool) {
648
418
  return typed(connection, request.key, request.view, request.paths);
649
419
  case 'replica.referrers':
650
420
  return referrers(connection, request.key, request.view, request.targets);
421
+ case 'replica.holders':
422
+ return holders(connection, request.key, request.view, request.sought);
651
423
  case 'replica.folders':
652
424
  return folders(connection, request.key, request.paths);
653
425
  case 'replica.typedWithin':
@@ -669,7 +441,7 @@ export function answerRuntime(connection, request, spool) {
669
441
  case 'replica.abandon':
670
442
  return abandon(connection, request.locator);
671
443
  case 'replica.unfence':
672
- return unfenced(connection, request.locators);
444
+ return unfencedRooms(connection, request.locators);
673
445
  case 'replica.release':
674
446
  return release(connection, request.key);
675
447
  case 'replica.rederive':
@@ -701,7 +473,7 @@ export function answerRuntime(connection, request, spool) {
701
473
  case 'opened.held':
702
474
  return openedHeld(connection);
703
475
  case 'file.part':
704
- return filePart(connection, request.key, request.part);
476
+ return heldPart(connection, request.key, request.part);
705
477
  case 'conversation.held':
706
478
  return heldConversations(connection, request.conversations);
707
479
  case 'conversation.keep': {
@@ -716,18 +488,18 @@ export function answerRuntime(connection, request, spool) {
716
488
  return turnArrived(connection, request.conversation, request.turn);
717
489
  case 'conversation.rows':
718
490
  return conversationRows(connection, request.conversations);
719
- case 'conversation.jobs':
720
- return jobMarkers(connection, request.conversation);
721
491
  case 'conversation.tallies':
722
492
  return conversationTallies(connection, request.conversations, request.since);
493
+ case 'conversation.facts':
494
+ return conversationFacts(connection);
495
+ case 'conversation.fact': {
496
+ const { kind: _kind, ...fact } = request;
497
+ return keptFact(connection, fact);
498
+ }
499
+ case 'conversation.stored':
500
+ return storedConversations(connection, null);
723
501
  case 'conversation.drop':
724
- chatDraft(connection, {
725
- kind: 'authored.chatDraft',
726
- kept: [],
727
- dropped: request.conversations,
728
- });
729
- droppedMessages(connection, request.conversations);
730
- return null;
502
+ return droppedConversations(connection, request.conversations);
731
503
  case 'space.probe':
732
504
  return spool.probe(PROBE_BYTES).then(() => null);
733
505
  case 'read.stored':
@@ -736,5 +508,13 @@ export function answerRuntime(connection, request, spool) {
736
508
  return keptRead(connection, request, request.answer);
737
509
  case 'read.builds':
738
510
  return readsOfOtherBuildsForgotten(connection, request.build);
511
+ case 'run.marks':
512
+ return runMarks(connection);
513
+ case 'run.held':
514
+ return heldRuns(connection, request.asked, request.sight);
515
+ case 'run.keep':
516
+ return keptRuns(connection, request.event);
517
+ case 'run.left':
518
+ return runsLeft(connection, request.sight);
739
519
  }
740
520
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tallies.d.ts","sourceRoot":"","sources":["../src/tallies.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAI1D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC;IAC7E,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAmHpG,wBAAgB,WAAW,CACzB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,KAAK,EAAE,MAAM,GACZ,SAAS,EAAE,CAwBb;AA0BD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,EACvC,KAAK,EAAE,MAAM,GACZ,iBAAiB,EAAE,CAerB"}
1
+ {"version":3,"file":"tallies.d.ts","sourceRoot":"","sources":["../src/tallies.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAI1D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC;IAC7E,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAmHpG,wBAAgB,WAAW,CACzB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,KAAK,EAAE,MAAM,GACZ,SAAS,EAAE,CAwBb;AA0BD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,EACvC,KAAK,EAAE,MAAM,GACZ,iBAAiB,EAAE,CAerB"}