@agentshouse/mdruntime 0.1.0-cbb8d8acc9d19 → 0.1.0-cc56db96f86ae

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 (223) hide show
  1. package/AGENTS.md +285 -225
  2. package/README.md +21 -10
  3. package/dist/adapter.d.ts +114 -26
  4. package/dist/adapter.d.ts.map +1 -1
  5. package/dist/attempt.d.ts +16 -0
  6. package/dist/attempt.d.ts.map +1 -0
  7. package/dist/attempt.js +70 -0
  8. package/dist/binary.d.ts +23 -0
  9. package/dist/binary.d.ts.map +1 -0
  10. package/dist/binary.js +8 -0
  11. package/dist/bootstrap.d.ts +18 -5
  12. package/dist/bootstrap.d.ts.map +1 -1
  13. package/dist/bootstrap.js +147 -40
  14. package/dist/change-set.d.ts +7 -2
  15. package/dist/change-set.d.ts.map +1 -1
  16. package/dist/change-set.js +50 -16
  17. package/dist/change.d.ts +45 -0
  18. package/dist/change.d.ts.map +1 -1
  19. package/dist/change.js +34 -0
  20. package/dist/chat/acts.d.ts +33 -0
  21. package/dist/chat/acts.d.ts.map +1 -0
  22. package/dist/chat/acts.js +36 -0
  23. package/dist/chat/context.d.ts +3 -0
  24. package/dist/chat/context.d.ts.map +1 -0
  25. package/dist/chat/context.js +10 -0
  26. package/dist/chat/earlier.d.ts +10 -0
  27. package/dist/chat/earlier.d.ts.map +1 -0
  28. package/dist/chat/earlier.js +54 -0
  29. package/dist/chat/house.d.ts +25 -0
  30. package/dist/chat/house.d.ts.map +1 -0
  31. package/dist/chat/house.js +38 -0
  32. package/dist/chat/input.d.ts +11 -0
  33. package/dist/chat/input.d.ts.map +1 -0
  34. package/dist/chat/input.js +92 -0
  35. package/dist/chat/kit.d.ts +61 -0
  36. package/dist/chat/kit.d.ts.map +1 -0
  37. package/dist/chat/kit.js +123 -0
  38. package/dist/chat/lasting.d.ts +6 -0
  39. package/dist/chat/lasting.d.ts.map +1 -0
  40. package/dist/chat/lasting.js +19 -0
  41. package/dist/chat/list.d.ts +28 -0
  42. package/dist/chat/list.d.ts.map +1 -0
  43. package/dist/chat/list.js +103 -0
  44. package/dist/chat/markdown.d.ts +21 -0
  45. package/dist/chat/markdown.d.ts.map +1 -0
  46. package/dist/chat/markdown.js +246 -0
  47. package/dist/chat/message.d.ts +7 -0
  48. package/dist/chat/message.d.ts.map +1 -0
  49. package/dist/chat/message.js +237 -0
  50. package/dist/chat/messages.d.ts +29 -0
  51. package/dist/chat/messages.d.ts.map +1 -0
  52. package/dist/chat/messages.js +190 -0
  53. package/dist/chat/name.d.ts +7 -0
  54. package/dist/chat/name.d.ts.map +1 -0
  55. package/dist/chat/name.js +37 -0
  56. package/dist/chat/opened.d.ts +12 -0
  57. package/dist/chat/opened.d.ts.map +1 -0
  58. package/dist/chat/opened.js +19 -0
  59. package/dist/chat/overlay.d.ts +32 -0
  60. package/dist/chat/overlay.d.ts.map +1 -0
  61. package/dist/chat/overlay.js +103 -0
  62. package/dist/chat/parts.d.ts +58 -0
  63. package/dist/chat/parts.d.ts.map +1 -0
  64. package/dist/chat/parts.js +120 -0
  65. package/dist/chat/pieces.d.ts +62 -0
  66. package/dist/chat/pieces.d.ts.map +1 -0
  67. package/dist/chat/pieces.js +1110 -0
  68. package/dist/chat/process.d.ts +20 -0
  69. package/dist/chat/process.d.ts.map +1 -0
  70. package/dist/chat/process.js +32 -0
  71. package/dist/chat/provider.d.ts +68 -0
  72. package/dist/chat/provider.d.ts.map +1 -0
  73. package/dist/chat/provider.js +619 -0
  74. package/dist/chat/question.d.ts +9 -0
  75. package/dist/chat/question.d.ts.map +1 -0
  76. package/dist/chat/question.js +69 -0
  77. package/dist/chat/questions.d.ts +31 -0
  78. package/dist/chat/questions.d.ts.map +1 -0
  79. package/dist/chat/questions.js +111 -0
  80. package/dist/chat/read.d.ts +5 -0
  81. package/dist/chat/read.d.ts.map +1 -0
  82. package/dist/chat/read.js +13 -0
  83. package/dist/chat/ready.d.ts +37 -0
  84. package/dist/chat/ready.d.ts.map +1 -0
  85. package/dist/chat/ready.js +93 -0
  86. package/dist/chat/room-file.d.ts +8 -0
  87. package/dist/chat/room-file.d.ts.map +1 -0
  88. package/dist/chat/room-file.js +67 -0
  89. package/dist/chat/steady.d.ts +3 -0
  90. package/dist/chat/steady.d.ts.map +1 -0
  91. package/dist/chat/steady.js +26 -0
  92. package/dist/chat/style.d.ts +4 -0
  93. package/dist/chat/style.d.ts.map +1 -0
  94. package/dist/chat/style.js +306 -0
  95. package/dist/chat.d.ts +15 -0
  96. package/dist/chat.d.ts.map +1 -0
  97. package/dist/chat.js +8 -0
  98. package/dist/client.d.ts +33 -13
  99. package/dist/client.d.ts.map +1 -1
  100. package/dist/client.js +81 -16
  101. package/dist/collection.d.ts +23 -13
  102. package/dist/collection.d.ts.map +1 -1
  103. package/dist/collection.js +367 -38
  104. package/dist/connection.d.ts +54 -16
  105. package/dist/connection.d.ts.map +1 -1
  106. package/dist/connection.js +2582 -486
  107. package/dist/conversation.d.ts +39 -12
  108. package/dist/conversation.d.ts.map +1 -1
  109. package/dist/conversation.js +546 -171
  110. package/dist/digest.d.ts +2 -0
  111. package/dist/digest.d.ts.map +1 -0
  112. package/dist/digest.js +100 -0
  113. package/dist/durability.d.ts +7 -1
  114. package/dist/durability.d.ts.map +1 -1
  115. package/dist/entry.d.ts +17 -0
  116. package/dist/entry.d.ts.map +1 -0
  117. package/dist/entry.js +157 -0
  118. package/dist/expectation.d.ts +21 -0
  119. package/dist/expectation.d.ts.map +1 -0
  120. package/dist/expectation.js +70 -0
  121. package/dist/failure.d.ts +13 -0
  122. package/dist/failure.d.ts.map +1 -0
  123. package/dist/failure.js +19 -0
  124. package/dist/fence.d.ts +6 -0
  125. package/dist/fence.d.ts.map +1 -0
  126. package/dist/fence.js +10 -0
  127. package/dist/file.d.ts +2 -10
  128. package/dist/file.d.ts.map +1 -1
  129. package/dist/file.js +3 -120
  130. package/dist/host.d.ts +15 -3
  131. package/dist/host.d.ts.map +1 -1
  132. package/dist/host.js +107 -21
  133. package/dist/identity.d.ts +5 -0
  134. package/dist/identity.d.ts.map +1 -1
  135. package/dist/identity.js +19 -1
  136. package/dist/index.d.ts +20 -10
  137. package/dist/index.d.ts.map +1 -1
  138. package/dist/index.js +7 -0
  139. package/dist/memory.d.ts +11 -4
  140. package/dist/memory.d.ts.map +1 -1
  141. package/dist/memory.js +92 -27
  142. package/dist/model.d.ts +7 -4
  143. package/dist/model.d.ts.map +1 -1
  144. package/dist/model.js +10 -1
  145. package/dist/observation.d.ts +7 -2
  146. package/dist/observation.d.ts.map +1 -1
  147. package/dist/observation.js +29 -12
  148. package/dist/open.d.ts +2 -0
  149. package/dist/open.d.ts.map +1 -0
  150. package/dist/open.js +1 -0
  151. package/dist/outcome.d.ts +57 -3
  152. package/dist/outcome.d.ts.map +1 -1
  153. package/dist/outcome.js +67 -1
  154. package/dist/overlay.d.ts +18 -5
  155. package/dist/overlay.d.ts.map +1 -1
  156. package/dist/overlay.js +271 -165
  157. package/dist/query.d.ts +61 -4
  158. package/dist/query.d.ts.map +1 -1
  159. package/dist/query.js +40 -7
  160. package/dist/reach.d.ts +13 -4
  161. package/dist/reach.d.ts.map +1 -1
  162. package/dist/reach.js +201 -47
  163. package/dist/react.d.ts +31 -20
  164. package/dist/react.d.ts.map +1 -1
  165. package/dist/react.js +13 -21
  166. package/dist/read-side.d.ts +18 -9
  167. package/dist/read-side.d.ts.map +1 -1
  168. package/dist/read-side.js +903 -157
  169. package/dist/readiness.d.ts +53 -0
  170. package/dist/readiness.d.ts.map +1 -0
  171. package/dist/readiness.js +33 -0
  172. package/dist/reads.d.ts +11 -0
  173. package/dist/reads.d.ts.map +1 -0
  174. package/dist/reads.js +98 -0
  175. package/dist/recovery.d.ts +25 -0
  176. package/dist/recovery.d.ts.map +1 -0
  177. package/dist/recovery.js +198 -0
  178. package/dist/refresh.d.ts +13 -3
  179. package/dist/refresh.d.ts.map +1 -1
  180. package/dist/refresh.js +73 -43
  181. package/dist/replica.d.ts +16 -8
  182. package/dist/replica.d.ts.map +1 -1
  183. package/dist/replica.js +198 -91
  184. package/dist/room-draft.d.ts +40 -9
  185. package/dist/room-draft.d.ts.map +1 -1
  186. package/dist/room-draft.js +153 -37
  187. package/dist/rows.d.ts +10 -13
  188. package/dist/rows.d.ts.map +1 -1
  189. package/dist/rows.js +19 -14
  190. package/dist/save.d.ts +72 -4
  191. package/dist/save.d.ts.map +1 -1
  192. package/dist/save.js +812 -145
  193. package/dist/search.d.ts +52 -8
  194. package/dist/search.d.ts.map +1 -1
  195. package/dist/search.js +242 -46
  196. package/dist/seed.d.ts +16 -0
  197. package/dist/seed.d.ts.map +1 -0
  198. package/dist/seed.js +75 -0
  199. package/dist/shared.d.ts +19 -0
  200. package/dist/shared.d.ts.map +1 -0
  201. package/dist/shared.js +461 -0
  202. package/dist/status.d.ts +6 -2
  203. package/dist/status.d.ts.map +1 -1
  204. package/dist/status.js +0 -8
  205. package/dist/store.d.ts +90 -23
  206. package/dist/store.d.ts.map +1 -1
  207. package/dist/store.js +675 -295
  208. package/dist/tables.d.ts +181 -0
  209. package/dist/tables.d.ts.map +1 -0
  210. package/dist/tables.js +309 -0
  211. package/dist/turn.d.ts +9 -0
  212. package/dist/turn.d.ts.map +1 -0
  213. package/dist/turn.js +67 -0
  214. package/dist/windows.d.ts +21 -0
  215. package/dist/windows.d.ts.map +1 -0
  216. package/dist/windows.js +84 -0
  217. package/dist/wire.d.ts +165 -33
  218. package/dist/wire.d.ts.map +1 -1
  219. package/dist/wire.js +67 -31
  220. package/package.json +30 -14
  221. package/dist/attachment.d.ts +0 -3
  222. package/dist/attachment.d.ts.map +0 -1
  223. package/dist/attachment.js +0 -8
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,O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,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,cAAc,EACd,UAAU,EACV,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACpE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
package/dist/host.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { composeRuntime, } from './connection.js';
2
- import { removeRuntimeStore } from './store.js';
3
- import { AUTHORIZATION_ENDED, request, WIRE_REACH, } from './wire.js';
2
+ import { queryKey } from './query.js';
3
+ import { described } from './failure.js';
4
+ import { endRuntimeStore } from './store.js';
5
+ import { AUTHORIZATION_ENDED, request, WIRE, } from './wire.js';
4
6
  const NARROWED = new Set(['within', 'whole']);
5
7
  function answered(md, app, writtenBy, member, input) {
6
8
  switch (member) {
@@ -14,8 +16,18 @@ function answered(md, app, writtenBy, member, input) {
14
16
  return md.types(input[0]);
15
17
  case 'save':
16
18
  return md.save(input[0], input[1], writtenBy);
19
+ case 'saveParts':
20
+ return md.saveParts(input[0], input[1], writtenBy);
17
21
  case 'history':
18
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.readReference':
30
+ return md.binaryFile.readReference(input[0]);
19
31
  case 'call':
20
32
  return md.call(input[0], input[1]);
21
33
  case 'reached':
@@ -24,6 +36,8 @@ function answered(md, app, writtenBy, member, input) {
24
36
  return md.log();
25
37
  case 'persistence':
26
38
  return md.persistence();
39
+ case 'retry':
40
+ return md.retry();
27
41
  case 'reauthorize':
28
42
  return md.reauthorize();
29
43
  case 'roomDraft.list':
@@ -38,6 +52,8 @@ function answered(md, app, writtenBy, member, input) {
38
52
  return md.presentation.read(app);
39
53
  case 'presentation.write':
40
54
  return md.presentation.write(app, input[0]);
55
+ case 'presentation.edit':
56
+ return md.presentation.edit(app, input[0]);
41
57
  case 'conversation.list':
42
58
  return md.conversation.list();
43
59
  case 'conversation.read':
@@ -45,7 +61,9 @@ function answered(md, app, writtenBy, member, input) {
45
61
  case 'conversation.create':
46
62
  return md.conversation.create(input[0]);
47
63
  case 'conversation.send':
48
- return md.conversation.send(input[0]);
64
+ return md.conversation.send(input[0], input[1], input[2]);
65
+ case 'conversation.attach':
66
+ return md.conversation.attach(input[0], input[1]);
49
67
  case 'conversation.answer':
50
68
  return md.conversation.answer(input[0], input[1]);
51
69
  case 'conversation.interrupt':
@@ -57,11 +75,21 @@ function answered(md, app, writtenBy, member, input) {
57
75
  case 'conversation.delete':
58
76
  return md.conversation.delete(input[0]);
59
77
  case 'chatDraft.write':
60
- return md.chatDraft.write(input[0], input[1]);
78
+ return md.chatDraft.write(input[0], input[1], input[2]);
79
+ case 'chatDraft.prepend':
80
+ return md.chatDraft.prepend(input[0], input[1]);
61
81
  case 'chatDraft.discard':
62
82
  return md.chatDraft.discard(input[0]);
63
83
  }
64
84
  }
85
+ function answeredResult(value) {
86
+ return typeof value === 'object' && value !== null && !('pending' in value);
87
+ }
88
+ function answeredMessage(value) {
89
+ if (typeof value !== 'object' || value === null)
90
+ return false;
91
+ return !('result' in value) || answeredResult(value.result);
92
+ }
65
93
  export function serveMdRuntime(options) {
66
94
  const deploymentFacts = structuredClone(options.deploymentFacts);
67
95
  const closing = new AbortController();
@@ -79,13 +107,25 @@ export function serveMdRuntime(options) {
79
107
  deliver(structuredClone(deploymentFacts));
80
108
  return () => { };
81
109
  };
82
- function attach(port, app, release, reach) {
110
+ function attach(port, app, release, reach, code = 'stored', search = 'unused') {
83
111
  if (!authorized)
84
112
  throw new Error(AUTHORIZATION_ENDED);
85
113
  const writtenBy = release === undefined ? undefined : { app, release };
86
- const view = runtime.within(reach ?? null);
114
+ let facts = { target: app, code, capacity: null, search };
115
+ const view = runtime.within(reach ?? null, facts);
87
116
  const observations = new Map();
117
+ const followed = new Set();
118
+ const answeredKeys = new Set();
119
+ let awaited = null;
88
120
  let serving = true;
121
+ const answeredQuery = (query) => {
122
+ answeredKeys.add(queryKey(query));
123
+ if (awaited === null || !awaited.keys.every((key) => answeredKeys.has(key)))
124
+ return;
125
+ const { done } = awaited;
126
+ awaited = null;
127
+ done();
128
+ };
89
129
  const send = (message) => {
90
130
  port.postMessage(message);
91
131
  };
@@ -96,6 +136,8 @@ export function serveMdRuntime(options) {
96
136
  for (const end of observations.values())
97
137
  end();
98
138
  observations.clear();
139
+ for (const end of [...followed])
140
+ end();
99
141
  attachments.delete(detach);
100
142
  };
101
143
  const observe = (id, topic, input) => {
@@ -105,10 +147,12 @@ export function serveMdRuntime(options) {
105
147
  return;
106
148
  send(resolved ? { kind: 'event', id, value } : { kind: 'result', id, value });
107
149
  resolved = true;
150
+ if (topic === 'query' && answeredMessage(value))
151
+ answeredQuery(input[0]);
108
152
  };
109
153
  observations.set(id, topic === 'deployment-facts'
110
154
  ? watchFacts(deliver)
111
- : (NARROWED.has(WIRE_REACH.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
155
+ : (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
112
156
  };
113
157
  const serve = async (message) => {
114
158
  if (message.kind === 'hello')
@@ -126,18 +170,16 @@ export function serveMdRuntime(options) {
126
170
  observe(message.id, message.topic, message.input);
127
171
  return;
128
172
  }
129
- const value = await answered(NARROWED.has(WIRE_REACH.members[message.member]) ? view.md : md, app, writtenBy, message.member, message.input);
130
- if (serving)
131
- send({ kind: 'result', id: message.id, value });
173
+ const value = await answered(NARROWED.has(WIRE.members[message.member].reach) ? view.md : md, app, writtenBy, message.member, message.input);
174
+ if (!serving)
175
+ return;
176
+ send({ kind: 'result', id: message.id, value });
177
+ if (message.member === 'query' && answeredResult(value))
178
+ answeredQuery(message.input[0]);
132
179
  }
133
180
  catch (error) {
134
- if (serving) {
135
- send({
136
- kind: 'failure',
137
- id: message.id,
138
- message: error instanceof Error ? error.message : String(error),
139
- });
140
- }
181
+ if (serving)
182
+ send({ kind: 'failure', id: message.id, ...described(error) });
141
183
  }
142
184
  };
143
185
  port.addEventListener('message', (event) => {
@@ -157,23 +199,67 @@ export function serveMdRuntime(options) {
157
199
  if (serving)
158
200
  view.narrow(next);
159
201
  },
202
+ code(next, capacity) {
203
+ if (!serving)
204
+ return;
205
+ facts = { ...facts, code: next, capacity };
206
+ view.facts(facts);
207
+ },
208
+ search(next) {
209
+ if (!serving)
210
+ return;
211
+ facts = { ...facts, search: next };
212
+ view.facts(facts);
213
+ },
214
+ answered(queries, done) {
215
+ const keys = queries.map(queryKey);
216
+ if (keys.every((key) => answeredKeys.has(key)))
217
+ done();
218
+ else
219
+ awaited = { keys, done };
220
+ },
221
+ readiness(deliver) {
222
+ if (!serving)
223
+ return () => { };
224
+ const stop = view.watch('readiness', [], (value) => {
225
+ if (serving)
226
+ deliver(value);
227
+ });
228
+ const end = () => {
229
+ followed.delete(end);
230
+ stop();
231
+ };
232
+ followed.add(end);
233
+ return end;
234
+ },
160
235
  };
161
236
  }
162
237
  return {
163
238
  attach,
164
- async endAuthorization() {
239
+ seed(entry) {
240
+ runtime.seed(entry);
241
+ },
242
+ persisted(answer) {
243
+ runtime.persisted(answer);
244
+ },
245
+ async endAuthorization(holder) {
165
246
  authorized = false;
166
247
  for (const [detach, send] of [...attachments]) {
167
248
  send({ kind: 'ended' });
168
249
  detach();
169
250
  }
170
251
  close();
171
- await removeRuntimeStore();
172
- await options.shell.dropGeneration();
252
+ if (!(await endRuntimeStore(options.database, holder)))
253
+ await options.shell.dropGeneration();
254
+ },
255
+ lose(locators) {
256
+ return runtime.lose(locators);
173
257
  },
174
258
  stop() {
175
259
  return runtime.stop();
176
260
  },
177
261
  };
178
262
  }
179
- export { STORE_SCHEMA } from './store.js';
263
+ export { entrySeedOf } from './seed.js';
264
+ export { createRecovery, retryDelay, } from './recovery.js';
265
+ export { openDatabase, STORE_SCHEMA, transacted } from './store.js';
@@ -1,3 +1,8 @@
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;
5
+ export declare function transferIdentity(): string;
6
+ export declare function indexGeneration(): string;
7
+ export declare function binaryLocalId(): string;
3
8
  //# 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;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAI1C"}
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,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
package/dist/identity.js CHANGED
@@ -10,8 +10,26 @@ 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 roomDraftRevision() {
13
+ export function identityTime(identity) {
14
+ return Number.parseInt(identity.replaceAll('-', '').slice(0, 12), 16);
15
+ }
16
+ function randomIdentity() {
14
17
  const bytes = new Uint8Array(16);
15
18
  crypto.getRandomValues(bytes);
16
19
  return [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
17
20
  }
21
+ export function roomDraftRevision() {
22
+ return randomIdentity();
23
+ }
24
+ export function chatDraftRevision() {
25
+ return randomIdentity();
26
+ }
27
+ export function transferIdentity() {
28
+ return randomIdentity();
29
+ }
30
+ export function indexGeneration() {
31
+ return randomIdentity();
32
+ }
33
+ export function binaryLocalId() {
34
+ return randomIdentity();
35
+ }
package/dist/index.d.ts CHANGED
@@ -1,17 +1,27 @@
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, 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, ConnectionRefusalReason, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedRoomDraft, SaveResult, } from './connection.js';
1
+ export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, ReferrerScope, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, DiscoveryScope, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldContent, HeldRoom, KeptReceipt, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, StreamReceipts, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
2
+ export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
3
+ export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
4
+ export type { ChosenFile, FileDeclaration } from './file.js';
5
+ export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult, } from './connection.js';
6
6
  export type { Observation } from './observation.js';
7
- export type { CallResult, QueueEntry, Submission } from './outcome.js';
8
- export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, } from './room-draft.js';
7
+ export type { BinaryAnswer, BinaryLinkAnswer, CallResult, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
8
+ export type { BinaryFileRecord, BinaryReference } from './binary.js';
9
+ export type { RuntimeError } from './failure.js';
10
+ export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
9
11
  export type { SaveRefusal } from './save.js';
10
- export type { DocumentHit, DocumentPart, MessageHit, SearchRequest, SearchResult, } from './search.js';
12
+ export type { DocumentHit, DocumentPart, MessageHit, PendingConversation, SearchCoverage, SearchHits, SearchPending, SearchRequest, SearchResult, SearchUndeclared, } from './search.js';
13
+ export { departure } from './change.js';
14
+ export { partsAfter } from './room-draft.js';
15
+ export { SESSION_STARTED } from './conversation.js';
11
16
  export { changeBatchIdentity } from './identity.js';
12
- export type { RuntimeShell } from './durability.js';
17
+ export { ROW_WEIGHT, stepped } from './turn.js';
18
+ export { entriesIn, patching, sortedKeys } from './shared.js';
19
+ export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
20
+ export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
21
+ export type { RuntimeShell, StorageEstimate } from './durability.js';
22
+ export type { CapacityCause, CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Persistence, Readiness, ReadinessStatus, RefusedRoom, RoomCoverage, RoomPreparation, SearchObligation, TargetCoverage, } from './readiness.js';
13
23
  export type { AttentionEntry, SyncStatus } from './status.js';
14
- export type { Backlink, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, Predicate, QueryDocument, QueryGroup, QueryResult, Related, Select, Value, Where, } from './query.js';
24
+ 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';
15
25
  export type { MdType, ModelIdentity, ModelSnapshot, ModelState, ModelResult, TypesResult, ValidationReceipt, } from './model.js';
16
26
  export type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';
17
27
  //# 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,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,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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,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,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,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,QAAQ,EACR,WAAW,EACX,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,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,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,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC7D,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB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,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,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACrE,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,eAAe,EACf,WAAW,EACX,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,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,8 @@
1
+ export { departure } from './change.js';
2
+ export { partsAfter } from './room-draft.js';
3
+ export { SESSION_STARTED } from './conversation.js';
1
4
  export { changeBatchIdentity } from './identity.js';
5
+ export { ROW_WEIGHT, stepped } from './turn.js';
6
+ export { entriesIn, patching, sortedKeys } from './shared.js';
7
+ export { attempts, identities, intentOf, } from './attempt.js';
8
+ export { expectedList, expecting } from './expectation.js';
package/dist/memory.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import type { ModelResult } from './model.js';
2
- import { type AcceptedMessage, type ActionResult, type Adapter, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type ListedConversation, type ProviderLimit, type Retention, type RoomAttachment, type ServiceMode } from './adapter.js';
2
+ import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveryScope, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode } from './adapter.js';
3
3
  export type MemoryRoom = DiscoveredRoom & {
4
4
  model?: ModelResult;
5
5
  selectionModel?: ModelResult;
6
6
  documents?: Readonly<Record<string, string>>;
7
7
  revisions?: Readonly<Record<string, string>>;
8
+ fileIds?: Readonly<Record<string, string>>;
8
9
  changes?: Readonly<Record<string, HeadChange>>;
9
- binaryTargets?: readonly string[];
10
- attachments?: readonly RoomAttachment[];
10
+ binaryFiles?: Readonly<Record<string, BinaryFile>>;
11
+ blobs?: Readonly<Record<string, Blob>>;
11
12
  };
12
13
  export type MemoryConversation = {
13
14
  conversation: string;
@@ -23,19 +24,25 @@ export type MemoryAdapterOptions = {
23
24
  capabilities?: readonly Capability[];
24
25
  providerLimits?: readonly ProviderLimit[];
25
26
  retention?: Retention;
27
+ member?: Member;
26
28
  unopened?: boolean;
29
+ exhaustiveDiscovery?: true;
27
30
  };
28
31
  export type MemoryAdapter = Adapter & {
29
32
  setRooms(rooms: readonly MemoryRoom[]): void;
30
33
  setConversations(conversations: readonly MemoryConversation[]): void;
31
34
  script(operation: keyof Adapter, answer: unknown): void;
32
35
  open(): void;
33
- close(revoked?: boolean): void;
36
+ close(closing?: {
37
+ revoked?: boolean;
38
+ lost?: boolean;
39
+ }): void;
34
40
  expire(locators: readonly string[]): void;
35
41
  notifyRoomVersion(notification: {
36
42
  locator: string;
37
43
  roomVersion: string;
38
44
  }): void;
45
+ notifyAuthorityChanged(scope?: DiscoveryScope): void;
39
46
  notifyConversation(event: ConversationEvent): void;
40
47
  notifyServiceMode(mode: ServiceMode): void;
41
48
  heldRooms(): readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAIZ,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAItB,KAAK,cAAc,EACnB,KAAK,UAAU,EAGf,KAAK,kBAAkB,EAGvB,KAAK,aAAa,EAGlB,KAAK,SAAS,EACd,KAAK,cAAc,EAGnB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAkBtB,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG;IACxC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC,M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