@agentshouse/mdruntime 0.1.0-c967d1ca66fee → 0.1.0-c96e80d38e5f0

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 (175) hide show
  1. package/README.md +22 -9
  2. package/dist/adapter.d.ts +172 -49
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/attached-model.d.ts +5 -1
  5. package/dist/attached-model.d.ts.map +1 -1
  6. package/dist/attached-model.js +38 -4
  7. package/dist/attempt.d.ts +16 -0
  8. package/dist/attempt.d.ts.map +1 -0
  9. package/dist/attempt.js +70 -0
  10. package/dist/binary.d.ts +18 -0
  11. package/dist/binary.d.ts.map +1 -0
  12. package/dist/binary.js +8 -0
  13. package/dist/bootstrap.d.ts +27 -11
  14. package/dist/bootstrap.d.ts.map +1 -1
  15. package/dist/bootstrap.js +184 -84
  16. package/dist/chain.d.ts +11 -0
  17. package/dist/chain.d.ts.map +1 -0
  18. package/dist/chain.js +64 -0
  19. package/dist/change-set.d.ts +9 -14
  20. package/dist/change-set.d.ts.map +1 -1
  21. package/dist/change-set.js +11 -62
  22. package/dist/change.d.ts +41 -0
  23. package/dist/change.d.ts.map +1 -1
  24. package/dist/change.js +34 -0
  25. package/dist/client.d.ts +34 -15
  26. package/dist/client.d.ts.map +1 -1
  27. package/dist/client.js +104 -8
  28. package/dist/collection.d.ts +10 -7
  29. package/dist/collection.d.ts.map +1 -1
  30. package/dist/collection.js +38 -79
  31. package/dist/compile.d.ts +16 -0
  32. package/dist/compile.d.ts.map +1 -0
  33. package/dist/compile.js +789 -0
  34. package/dist/connection.d.ts +51 -17
  35. package/dist/connection.d.ts.map +1 -1
  36. package/dist/connection.js +3951 -907
  37. package/dist/conversation.d.ts +48 -19
  38. package/dist/conversation.d.ts.map +1 -1
  39. package/dist/conversation.js +726 -240
  40. package/dist/digest.d.ts +7 -0
  41. package/dist/digest.d.ts.map +1 -0
  42. package/dist/digest.js +113 -0
  43. package/dist/durability.d.ts +4 -1
  44. package/dist/durability.d.ts.map +1 -1
  45. package/dist/durability.js +5 -0
  46. package/dist/entry.d.ts +20 -0
  47. package/dist/entry.d.ts.map +1 -0
  48. package/dist/entry.js +152 -0
  49. package/dist/expectation.d.ts +21 -0
  50. package/dist/expectation.d.ts.map +1 -0
  51. package/dist/expectation.js +70 -0
  52. package/dist/fence.d.ts +6 -0
  53. package/dist/fence.d.ts.map +1 -0
  54. package/dist/fence.js +10 -0
  55. package/dist/file.d.ts +2 -19
  56. package/dist/file.d.ts.map +1 -1
  57. package/dist/file.js +7 -122
  58. package/dist/host.d.ts +12 -3
  59. package/dist/host.d.ts.map +1 -1
  60. package/dist/host.js +125 -18
  61. package/dist/identity.d.ts +3 -0
  62. package/dist/identity.d.ts.map +1 -1
  63. package/dist/identity.js +9 -0
  64. package/dist/index.d.ts +19 -9
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +9 -0
  67. package/dist/live.d.ts +22 -0
  68. package/dist/live.d.ts.map +1 -0
  69. package/dist/live.js +123 -0
  70. package/dist/media.d.ts +8 -0
  71. package/dist/media.d.ts.map +1 -0
  72. package/dist/media.js +218 -0
  73. package/dist/memory.d.ts +18 -7
  74. package/dist/memory.d.ts.map +1 -1
  75. package/dist/memory.js +231 -91
  76. package/dist/messages.d.ts +28 -0
  77. package/dist/messages.d.ts.map +1 -0
  78. package/dist/messages.js +89 -0
  79. package/dist/model.d.ts +9 -2
  80. package/dist/model.d.ts.map +1 -1
  81. package/dist/model.js +8 -2
  82. package/dist/name.d.ts +4 -0
  83. package/dist/name.d.ts.map +1 -0
  84. package/dist/name.js +122 -0
  85. package/dist/observation.d.ts +20 -2
  86. package/dist/observation.d.ts.map +1 -1
  87. package/dist/observation.js +113 -12
  88. package/dist/opened.d.ts +22 -0
  89. package/dist/opened.d.ts.map +1 -0
  90. package/dist/opened.js +107 -0
  91. package/dist/outcome.d.ts +52 -4
  92. package/dist/outcome.d.ts.map +1 -1
  93. package/dist/outcome.js +46 -0
  94. package/dist/overlay.d.ts +15 -5
  95. package/dist/overlay.d.ts.map +1 -1
  96. package/dist/overlay.js +129 -177
  97. package/dist/paths.d.ts +1 -0
  98. package/dist/paths.d.ts.map +1 -1
  99. package/dist/paths.js +4 -0
  100. package/dist/phrase.d.ts +3 -0
  101. package/dist/phrase.d.ts.map +1 -0
  102. package/dist/phrase.js +8 -0
  103. package/dist/query.d.ts +72 -4
  104. package/dist/query.d.ts.map +1 -1
  105. package/dist/query.js +67 -7
  106. package/dist/reach.d.ts +16 -2
  107. package/dist/reach.d.ts.map +1 -1
  108. package/dist/reach.js +222 -56
  109. package/dist/react.d.ts +11 -7
  110. package/dist/react.d.ts.map +1 -1
  111. package/dist/react.js +7 -17
  112. package/dist/readiness.d.ts +50 -0
  113. package/dist/readiness.d.ts.map +1 -0
  114. package/dist/readiness.js +27 -0
  115. package/dist/recovery.d.ts +26 -0
  116. package/dist/recovery.d.ts.map +1 -0
  117. package/dist/recovery.js +224 -0
  118. package/dist/refresh.d.ts +17 -14
  119. package/dist/refresh.d.ts.map +1 -1
  120. package/dist/refresh.js +155 -56
  121. package/dist/replica.d.ts +58 -33
  122. package/dist/replica.d.ts.map +1 -1
  123. package/dist/replica.js +310 -159
  124. package/dist/room-draft.d.ts +52 -5
  125. package/dist/room-draft.d.ts.map +1 -1
  126. package/dist/room-draft.js +261 -56
  127. package/dist/rows.d.ts +38 -35
  128. package/dist/rows.d.ts.map +1 -1
  129. package/dist/rows.js +178 -102
  130. package/dist/save.d.ts +70 -3
  131. package/dist/save.d.ts.map +1 -1
  132. package/dist/save.js +805 -147
  133. package/dist/search.d.ts +15 -55
  134. package/dist/search.d.ts.map +1 -1
  135. package/dist/search.js +10 -121
  136. package/dist/seed.d.ts +16 -0
  137. package/dist/seed.d.ts.map +1 -0
  138. package/dist/seed.js +75 -0
  139. package/dist/shared.d.ts +15 -0
  140. package/dist/shared.d.ts.map +1 -0
  141. package/dist/shared.js +421 -0
  142. package/dist/status.d.ts +5 -0
  143. package/dist/status.d.ts.map +1 -1
  144. package/dist/status.js +3 -1
  145. package/dist/store.d.ts +116 -80
  146. package/dist/store.d.ts.map +1 -1
  147. package/dist/store.js +355 -461
  148. package/dist/stored.d.ts +162 -0
  149. package/dist/stored.d.ts.map +1 -0
  150. package/dist/stored.js +549 -0
  151. package/dist/tables.d.ts +353 -0
  152. package/dist/tables.d.ts.map +1 -0
  153. package/dist/tables.js +585 -0
  154. package/dist/transfer.d.ts +0 -5
  155. package/dist/transfer.d.ts.map +1 -1
  156. package/dist/turn.d.ts +9 -0
  157. package/dist/turn.d.ts.map +1 -0
  158. package/dist/turn.js +75 -0
  159. package/dist/validation.d.ts +29 -0
  160. package/dist/validation.d.ts.map +1 -0
  161. package/dist/validation.js +101 -0
  162. package/dist/windows.d.ts +22 -0
  163. package/dist/windows.d.ts.map +1 -0
  164. package/dist/windows.js +89 -0
  165. package/dist/wire.d.ts +166 -30
  166. package/dist/wire.d.ts.map +1 -1
  167. package/dist/wire.js +57 -29
  168. package/package.json +26 -15
  169. package/AGENTS.md +0 -269
  170. package/dist/attachment.d.ts +0 -3
  171. package/dist/attachment.d.ts.map +0 -1
  172. package/dist/attachment.js +0 -8
  173. package/dist/read-side.d.ts +0 -18
  174. package/dist/read-side.d.ts.map +0 -1
  175. package/dist/read-side.js +0 -433
package/dist/host.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { composeRuntime, } from './connection.js';
2
+ import { queryKey } from './query.js';
3
+ import { untilAnswered } from './recovery.js';
2
4
  import { described } from './failure.js';
3
- import { removeRuntimeStore } from './store.js';
4
- import { AUTHORIZATION_ENDED, request, WIRE_REACH, } from './wire.js';
5
+ import { AUTHORIZATION_ENDED, request, WIRE, } from './wire.js';
5
6
  const NARROWED = new Set(['within', 'whole']);
6
7
  function answered(md, app, writtenBy, member, input) {
7
8
  switch (member) {
@@ -15,16 +16,34 @@ function answered(md, app, writtenBy, member, input) {
15
16
  return md.types(input[0]);
16
17
  case 'save':
17
18
  return md.save(input[0], input[1], writtenBy);
19
+ case 'saveParts':
20
+ return md.saveParts(input[0], input[1], writtenBy);
18
21
  case 'history':
19
22
  return md.history(input[0], input[1], input[2]);
23
+ case 'resolve':
24
+ return md.resolve(input[0], input[1], input[2]);
25
+ case 'binaryFile.read':
26
+ return md.binaryFile.read(input[0], input[1], input[2]);
27
+ case 'binaryFile.link':
28
+ return md.binaryFile.link(input[0], input[1], input[2]);
29
+ case 'binaryFile.show':
30
+ return md.binaryFile.show(input[0], input[1], input[2]);
31
+ case 'binaryFile.attach':
32
+ return md.binaryFile.attach(input[0], input[1]);
33
+ case 'binaryFile.part':
34
+ return md.binaryFile.part(input[0], input[1]);
20
35
  case 'call':
21
36
  return md.call(input[0], input[1]);
22
37
  case 'reached':
23
38
  return md.reached(input[0], input[1], input[2]);
24
39
  case 'log':
25
40
  return md.log();
41
+ case 'cleanUp':
42
+ return md.cleanUp();
26
43
  case 'persistence':
27
44
  return md.persistence();
45
+ case 'retry':
46
+ return md.retry();
28
47
  case 'reauthorize':
29
48
  return md.reauthorize();
30
49
  case 'roomDraft.list':
@@ -32,13 +51,15 @@ function answered(md, app, writtenBy, member, input) {
32
51
  case 'roomDraft.read':
33
52
  return md.roomDraft.read(input[0], input[1]);
34
53
  case 'roomDraft.write':
35
- return md.roomDraft.write(input[0], input[1], input[2], input[3]);
54
+ return md.roomDraft.write(input[0], input[1], input[2], input[3], input[4]);
36
55
  case 'roomDraft.discard':
37
56
  return md.roomDraft.discard(input[0], input[1], input[2]);
38
57
  case 'presentation.read':
39
58
  return md.presentation.read(app);
40
59
  case 'presentation.write':
41
60
  return md.presentation.write(app, input[0]);
61
+ case 'presentation.edit':
62
+ return md.presentation.edit(app, input[0]);
42
63
  case 'conversation.list':
43
64
  return md.conversation.list();
44
65
  case 'conversation.read':
@@ -46,23 +67,39 @@ function answered(md, app, writtenBy, member, input) {
46
67
  case 'conversation.create':
47
68
  return md.conversation.create(input[0]);
48
69
  case 'conversation.send':
49
- return md.conversation.send(input[0]);
70
+ return md.conversation.send(input[0], input[1], input[2]);
50
71
  case 'conversation.answer':
51
72
  return md.conversation.answer(input[0], input[1]);
52
73
  case 'conversation.interrupt':
53
74
  return md.conversation.interrupt(input[0]);
54
75
  case 'conversation.kill':
55
76
  return md.conversation.kill(input[0]);
56
- case 'conversation.cancel':
57
- return md.conversation.cancel(input[0], input[1]);
58
77
  case 'conversation.delete':
59
78
  return md.conversation.delete(input[0]);
60
79
  case 'chatDraft.write':
61
- return md.chatDraft.write(input[0], input[1]);
80
+ return md.chatDraft.write(input[0], input[1], input[2]);
81
+ case 'chatDraft.prepend':
82
+ return md.chatDraft.prepend(input[0], input[1]);
62
83
  case 'chatDraft.discard':
63
84
  return md.chatDraft.discard(input[0]);
64
85
  }
65
86
  }
87
+ function attempted(work) {
88
+ try {
89
+ return Promise.resolve(work());
90
+ }
91
+ catch (error) {
92
+ return Promise.reject(error);
93
+ }
94
+ }
95
+ function answeredResult(value) {
96
+ return typeof value === 'object' && value !== null && !('pending' in value);
97
+ }
98
+ function answeredMessage(value) {
99
+ if (typeof value !== 'object' || value === null)
100
+ return false;
101
+ return !('result' in value) || answeredResult(value.result);
102
+ }
66
103
  export function serveMdRuntime(options) {
67
104
  const deploymentFacts = structuredClone(options.deploymentFacts);
68
105
  const closing = new AbortController();
@@ -76,17 +113,31 @@ export function serveMdRuntime(options) {
76
113
  const { md } = runtime;
77
114
  const attachments = new Map();
78
115
  let authorized = true;
116
+ let opening = null;
117
+ const opened = () => (opening ??= untilAnswered(() => md.loaded(), closing.signal));
79
118
  const watchFacts = (deliver) => {
80
119
  deliver(structuredClone(deploymentFacts));
81
120
  return () => { };
82
121
  };
83
- function attach(port, app, release, reach) {
122
+ function attach(port, app, release, reach, code = 'stored') {
84
123
  if (!authorized)
85
124
  throw new Error(AUTHORIZATION_ENDED);
86
125
  const writtenBy = release === undefined ? undefined : { app, release };
87
- const view = runtime.within(reach ?? null);
126
+ let facts = { target: app, code, space: null };
127
+ const view = runtime.within(reach ?? null, facts);
88
128
  const observations = new Map();
129
+ const followed = new Set();
130
+ const answeredKeys = new Set();
131
+ let awaited = null;
89
132
  let serving = true;
133
+ const answeredQuery = (query) => {
134
+ answeredKeys.add(queryKey(query));
135
+ if (awaited === null || !awaited.keys.every((key) => answeredKeys.has(key)))
136
+ return;
137
+ const { done } = awaited;
138
+ awaited = null;
139
+ done();
140
+ };
90
141
  const send = (message) => {
91
142
  port.postMessage(message);
92
143
  };
@@ -97,6 +148,8 @@ export function serveMdRuntime(options) {
97
148
  for (const end of observations.values())
98
149
  end();
99
150
  observations.clear();
151
+ for (const end of [...followed])
152
+ end();
100
153
  attachments.delete(detach);
101
154
  };
102
155
  const observe = (id, topic, input) => {
@@ -106,10 +159,26 @@ export function serveMdRuntime(options) {
106
159
  return;
107
160
  send(resolved ? { kind: 'event', id, value } : { kind: 'result', id, value });
108
161
  resolved = true;
162
+ if (topic === 'query' && answeredMessage(value))
163
+ answeredQuery(input[0]);
109
164
  };
110
165
  observations.set(id, topic === 'deployment-facts'
111
166
  ? watchFacts(deliver)
112
- : (NARROWED.has(WIRE_REACH.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
167
+ : (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
168
+ };
169
+ const reply = async (id, query, pending) => {
170
+ try {
171
+ const value = await pending;
172
+ if (!serving)
173
+ return;
174
+ send({ kind: 'result', id, value });
175
+ if (query !== undefined && answeredResult(value))
176
+ answeredQuery(query);
177
+ }
178
+ catch (error) {
179
+ if (serving)
180
+ send({ kind: 'failure', id, ...described(error) });
181
+ }
113
182
  };
114
183
  const serve = async (message) => {
115
184
  if (message.kind === 'hello')
@@ -120,21 +189,24 @@ export function serveMdRuntime(options) {
120
189
  return;
121
190
  }
122
191
  try {
123
- if (message.kind !== 'observe' || message.topic !== 'room-drafts')
192
+ if (message.kind !== 'observe')
124
193
  await md.loaded();
194
+ else if (message.topic !== 'room-drafts')
195
+ await opened();
125
196
  if (message.kind === 'observe') {
126
197
  if (serving)
127
198
  observe(message.id, message.topic, message.input);
128
199
  return;
129
200
  }
130
- const value = await answered(NARROWED.has(WIRE_REACH.members[message.member]) ? view.md : md, app, writtenBy, message.member, message.input);
131
- if (serving)
132
- send({ kind: 'result', id: message.id, value });
133
201
  }
134
202
  catch (error) {
135
203
  if (serving)
136
204
  send({ kind: 'failure', id: message.id, ...described(error) });
205
+ return;
137
206
  }
207
+ const { id, member, input } = message;
208
+ const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ? view.md : md, app, writtenBy, member, input));
209
+ return reply(id, member === 'query' ? input[0] : undefined, pending);
138
210
  };
139
211
  port.addEventListener('message', (event) => {
140
212
  if (!serving)
@@ -153,23 +225,58 @@ export function serveMdRuntime(options) {
153
225
  if (serving)
154
226
  view.narrow(next);
155
227
  },
228
+ code(next, space) {
229
+ if (!serving)
230
+ return;
231
+ facts = { ...facts, code: next, space };
232
+ view.facts(facts);
233
+ },
234
+ answered(queries, done) {
235
+ const keys = queries.map(queryKey);
236
+ if (keys.every((key) => answeredKeys.has(key)))
237
+ done();
238
+ else
239
+ awaited = { keys, done };
240
+ },
241
+ readiness(deliver) {
242
+ if (!serving)
243
+ return () => { };
244
+ const stop = view.watch('readiness', [], (value) => {
245
+ if (serving)
246
+ deliver(value);
247
+ });
248
+ const end = () => {
249
+ followed.delete(end);
250
+ stop();
251
+ };
252
+ followed.add(end);
253
+ return end;
254
+ },
156
255
  };
157
256
  }
158
257
  return {
159
258
  attach,
160
- async endAuthorization() {
259
+ seed(entry) {
260
+ runtime.seed(entry);
261
+ },
262
+ persisted(answer) {
263
+ runtime.persisted(answer);
264
+ },
265
+ async endAuthorization(holder) {
161
266
  authorized = false;
162
267
  for (const [detach, send] of [...attachments]) {
163
268
  send({ kind: 'ended' });
164
269
  detach();
165
270
  }
166
271
  close();
167
- await removeRuntimeStore();
168
- await options.shell.dropGeneration();
272
+ if (!(await options.database.ask({ kind: 'authored.end', holder: holder ?? null }))) {
273
+ await options.shell.dropGeneration();
274
+ }
169
275
  },
170
276
  stop() {
171
277
  return runtime.stop();
172
278
  },
173
279
  };
174
280
  }
175
- export { STORE_SCHEMA } from './store.js';
281
+ export { entrySeedOf } from './seed.js';
282
+ export { createRecovery, retryDelay, } from './recovery.js';
@@ -1,4 +1,7 @@
1
1
  export declare function changeBatchIdentity(at?: number): string;
2
+ export declare function identityTime(identity: string): number;
2
3
  export declare function roomDraftRevision(): string;
4
+ export declare function chatDraftRevision(): string;
3
5
  export declare function transferIdentity(): string;
6
+ export declare function binaryLocalId(): string;
4
7
  //# sourceMappingURL=identity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
package/dist/identity.js CHANGED
@@ -10,6 +10,9 @@ export function changeBatchIdentity(at = Date.now()) {
10
10
  const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
11
11
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
12
12
  }
13
+ export function identityTime(identity) {
14
+ return Number.parseInt(identity.replaceAll('-', '').slice(0, 12), 16);
15
+ }
13
16
  function randomIdentity() {
14
17
  const bytes = new Uint8Array(16);
15
18
  crypto.getRandomValues(bytes);
@@ -18,6 +21,12 @@ function randomIdentity() {
18
21
  export function roomDraftRevision() {
19
22
  return randomIdentity();
20
23
  }
24
+ export function chatDraftRevision() {
25
+ return randomIdentity();
26
+ }
21
27
  export function transferIdentity() {
22
28
  return randomIdentity();
23
29
  }
30
+ export function binaryLocalId() {
31
+ return randomIdentity();
32
+ }
package/dist/index.d.ts CHANGED
@@ -1,18 +1,28 @@
1
- export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldRoom, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomAttachment, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
2
- export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
3
- export type { ChatDraft, ChatDraftSurface, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
4
- export type { ChatDraftFile, FileDeclaration } from './file.js';
5
- export type { AppRoom, AppTypedSelection, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedRoomDraft, SaveResult, } from './connection.js';
1
+ export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, AuthorityChange, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldContent, HeldFile, HeldRoom, ListedAgent, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, Outline, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomChange, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, SearchAnswer, SearchAsk, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
2
+ export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
3
+ export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
4
+ export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult, } from './connection.js';
6
5
  export type { Observation } from './observation.js';
7
- export type { CallResult, Failure, HistoryAnswer, QueueEntry, Submission } from './outcome.js';
6
+ export type { AttachAnswer, BinaryAnswer, BinaryLinkAnswer, CallResult, DownloadAnswer, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
7
+ export type { BinaryFileRecord } from './binary.js';
8
8
  export type { RuntimeError } from './failure.js';
9
- export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, } from './room-draft.js';
9
+ export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
10
10
  export type { SaveRefusal } from './save.js';
11
- export type { DocumentHit, DocumentPart, MessageHit, SearchRequest, SearchResult, } from './search.js';
11
+ export type { SearchFound, SearchHit, SearchRequest, SearchResult } from './search.js';
12
+ export { departure } from './change.js';
13
+ export { partsAfter, partsChanges } from './room-draft.js';
14
+ export { cutName, nameFrom, transliterated } from './name.js';
15
+ export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
12
16
  export { changeBatchIdentity } from './identity.js';
17
+ export { paced, ROW_WEIGHT, stepped } from './turn.js';
18
+ export { untilAnswered } from './recovery.js';
19
+ export { entriesIn, patching, sortedKeys } from './shared.js';
20
+ export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
21
+ export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
13
22
  export type { RuntimeShell } from './durability.js';
23
+ export type { CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Installation, InstallationAmount, InstallationStep, Persistence, Readiness, ReadinessStatus, RoomCoverage, RoomPreparation, Space, TargetCoverage, } from './readiness.js';
14
24
  export type { AttentionEntry, SyncStatus } from './status.js';
15
- export type { Backlink, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, Predicate, QueryDocument, QueryGroup, QueryResult, Related, Select, Value, Where, } from './query.js';
25
+ export type { Awaits, Backlink, CoveredRoom, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, PendingResult, PendingRoom, Predicate, QueryCoverage, QueryDocument, QueryGroup, QueryResult, QueryRows, Related, Select, Value, Where, } from './query.js';
16
26
  export type { MdType, ModelIdentity, ModelSnapshot, ModelState, ModelResult, TypesResult, ValidationReceipt, } from './model.js';
17
27
  export type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';
18
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/F,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,YAAY,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,OAAO,EACP,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,YAAY,EACZ,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1F,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,OAAO,EACP,aAAa,EACb,OAAO,EACP,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,YAAY,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,UAAU,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5F,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,eAAe,EACf,YAAY,EACZ,eAAe,EACf,KAAK,EACL,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1,10 @@
1
+ export { departure } from './change.js';
2
+ export { partsAfter, partsChanges } from './room-draft.js';
3
+ export { cutName, nameFrom, transliterated } from './name.js';
4
+ export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
1
5
  export { changeBatchIdentity } from './identity.js';
6
+ export { paced, ROW_WEIGHT, stepped } from './turn.js';
7
+ export { untilAnswered } from './recovery.js';
8
+ export { entriesIn, patching, sortedKeys } from './shared.js';
9
+ export { attempts, identities, intentOf, } from './attempt.js';
10
+ export { expectedList, expecting } from './expectation.js';
package/dist/live.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { ChangeSet } from './change-set.js';
2
+ import { type KeyedResult, type QueryMessage } from './observation.js';
3
+ import type { PendingResult, Plan, QueryCoverage } from './query.js';
4
+ import type { QueryRoom } from './tables.js';
5
+ export type Cover = {
6
+ coverage: QueryCoverage;
7
+ rooms: readonly QueryRoom[];
8
+ } | PendingResult;
9
+ export type Ran = KeyedResult & {
10
+ readonly current: () => boolean;
11
+ };
12
+ export type Run = (plan: Plan, cover: () => Cover) => Promise<Ran>;
13
+ type Listener = (message: QueryMessage) => void;
14
+ export type LiveQueries = {
15
+ touched(set: ChangeSet): void;
16
+ recover(): void;
17
+ watch(plan: Plan, identity: string, cover: () => Cover, deliver: Listener): () => void;
18
+ close(): void;
19
+ };
20
+ export declare function createLiveQueries(run: Run): LiveQueries;
21
+ export {};
22
+ //# sourceMappingURL=live.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,KAAK,GAAG;IAAE,QAAQ,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE,GAAG,aAAa,CAAC;AAE7F,MAAM,MAAM,GAAG,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC;AAEpE,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEnE,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;AAchD,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;IACvF,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAmCF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAuFvD"}
package/dist/live.js ADDED
@@ -0,0 +1,123 @@
1
+ import { changeOf, digestOf, } from './observation.js';
2
+ import { roomOfKey } from './rows.js';
3
+ function narrowed(plan) {
4
+ return (plan.paths !== null &&
5
+ plan.hop === null &&
6
+ plan.backlinks === null &&
7
+ !(plan.shape.kind === 'documents' && plan.shape.backlinks));
8
+ }
9
+ function reads(plan, locator) {
10
+ if (plan.locked.includes(locator))
11
+ return false;
12
+ if (plan.rooms !== null && !plan.rooms.includes(locator))
13
+ return false;
14
+ if (plan.reach === null)
15
+ return true;
16
+ return (plan.reach.rooms.includes(locator) ||
17
+ plan.reach.documents.some((document) => roomOfKey(document) === locator));
18
+ }
19
+ function affected(plan, set) {
20
+ if (set.rooms.some((locator) => reads(plan, locator)))
21
+ return true;
22
+ const paths = narrowed(plan) ? new Set(plan.paths) : null;
23
+ return set.documents.some(({ locator, path }) => reads(plan, locator) && (paths === null || path === null || paths.has(path)));
24
+ }
25
+ function shown(entry) {
26
+ const cover = entry.cover();
27
+ return JSON.stringify('pending' in cover ? cover : cover.coverage);
28
+ }
29
+ export function createLiveQueries(run) {
30
+ const entries = new Map();
31
+ let closed = false;
32
+ function deliver(entry, next) {
33
+ const previous = entry.digest;
34
+ entry.digest = digestOf(next);
35
+ entry.covered = JSON.stringify('pending' in next.result ? next.result : next.result.coverage);
36
+ const change = previous === undefined ? null : changeOf(previous, next);
37
+ if (change !== null) {
38
+ for (const listener of entry.ready)
39
+ listener(change);
40
+ }
41
+ for (const listener of entry.fresh) {
42
+ entry.ready.add(listener);
43
+ listener(next);
44
+ }
45
+ entry.fresh.clear();
46
+ }
47
+ function schedule(entry) {
48
+ if (closed || entry.listeners.size === 0)
49
+ return;
50
+ if (entry.running) {
51
+ entry.dirty = true;
52
+ return;
53
+ }
54
+ entry.running = true;
55
+ void (async () => {
56
+ try {
57
+ for (;;) {
58
+ entry.dirty = false;
59
+ const { current, ...next } = await run(entry.plan, entry.cover);
60
+ if (closed || entry.listeners.size === 0)
61
+ return;
62
+ deliver(entry, next);
63
+ if (!(entry.dirty && !current()) && shown(entry) === entry.covered)
64
+ break;
65
+ }
66
+ }
67
+ catch {
68
+ entry.dirty = false;
69
+ }
70
+ finally {
71
+ entry.running = false;
72
+ }
73
+ })();
74
+ }
75
+ return {
76
+ touched(set) {
77
+ for (const entry of entries.values()) {
78
+ if (affected(entry.plan, set))
79
+ schedule(entry);
80
+ }
81
+ },
82
+ recover() {
83
+ for (const entry of entries.values()) {
84
+ if (entry.running)
85
+ continue;
86
+ if (entry.digest === undefined || shown(entry) !== entry.covered)
87
+ schedule(entry);
88
+ }
89
+ },
90
+ watch(plan, identity, cover, listener) {
91
+ let entry = entries.get(identity);
92
+ if (entry === undefined) {
93
+ entry = {
94
+ plan,
95
+ cover,
96
+ listeners: new Set(),
97
+ fresh: new Set(),
98
+ ready: new Set(),
99
+ digest: undefined,
100
+ covered: '',
101
+ dirty: false,
102
+ running: false,
103
+ };
104
+ entries.set(identity, entry);
105
+ }
106
+ const held = entry;
107
+ held.listeners.add(listener);
108
+ held.fresh.add(listener);
109
+ schedule(held);
110
+ return () => {
111
+ held.listeners.delete(listener);
112
+ held.fresh.delete(listener);
113
+ held.ready.delete(listener);
114
+ if (held.listeners.size === 0 && entries.get(identity) === held)
115
+ entries.delete(identity);
116
+ };
117
+ },
118
+ close() {
119
+ closed = true;
120
+ entries.clear();
121
+ },
122
+ };
123
+ }
@@ -0,0 +1,8 @@
1
+ import type { MdRuntimeClient } from './client.js';
2
+ import { type ShownAnswer } from './outcome.js';
3
+ export declare const ROOM_MEDIA = "room-media";
4
+ type Show = (room: string, path: string, revision?: string) => Promise<ShownAnswer>;
5
+ export declare function shownBy(show: Show, client: MdRuntimeClient): MdRuntimeClient;
6
+ export declare function defineRoomMedia(client: Promise<MdRuntimeClient> | MdRuntimeClient, registry?: CustomElementRegistry): void;
7
+ export {};
8
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3D,eAAO,MAAM,UAAU,eAAe,CAAC;AAwBvC,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAIpF,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,GAAG,eAAe,CAG5E;AAsBD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,EAClD,QAAQ,GAAE,qBAAsC,GAC/C,IAAI,CA0LN"}