@agentshouse/mdruntime 0.1.0-c45e2d0d978ee → 0.1.0-c48172fb2b750

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 (168) hide show
  1. package/README.md +1 -1
  2. package/dist/acceptance.d.ts.map +1 -1
  3. package/dist/acceptance.js +30 -1
  4. package/dist/actions.d.ts.map +1 -1
  5. package/dist/actions.js +25 -5
  6. package/dist/adapter.d.ts +83 -14
  7. package/dist/adapter.d.ts.map +1 -1
  8. package/dist/attached-model.d.ts.map +1 -1
  9. package/dist/attached-model.js +2 -2
  10. package/dist/{binary.d.ts → attachment.d.ts} +4 -4
  11. package/dist/attachment.d.ts.map +1 -0
  12. package/dist/{binary.js → attachment.js} +2 -2
  13. package/dist/chain.d.ts +1 -1
  14. package/dist/chain.d.ts.map +1 -1
  15. package/dist/chain.js +5 -2
  16. package/dist/change.d.ts +2 -2
  17. package/dist/chat-types.js +2 -2
  18. package/dist/client.d.ts +16 -7
  19. package/dist/client.d.ts.map +1 -1
  20. package/dist/client.js +15 -15
  21. package/dist/collection.d.ts +1 -0
  22. package/dist/collection.d.ts.map +1 -1
  23. package/dist/collection.js +7 -1
  24. package/dist/compile.d.ts +2 -1
  25. package/dist/compile.d.ts.map +1 -1
  26. package/dist/compile.js +71 -39
  27. package/dist/connection.d.ts.map +1 -1
  28. package/dist/connection.js +2 -0
  29. package/dist/conversation-live.d.ts +1 -0
  30. package/dist/conversation-live.d.ts.map +1 -1
  31. package/dist/conversation-live.js +2 -1
  32. package/dist/conversation-row.d.ts +12 -0
  33. package/dist/conversation-row.d.ts.map +1 -1
  34. package/dist/conversation-row.js +10 -0
  35. package/dist/conversation.d.ts +12 -5
  36. package/dist/conversation.d.ts.map +1 -1
  37. package/dist/conversation.js +44 -37
  38. package/dist/declaration.js +3 -3
  39. package/dist/download.d.ts +2 -2
  40. package/dist/download.d.ts.map +1 -1
  41. package/dist/entry.d.ts +13 -3
  42. package/dist/entry.d.ts.map +1 -1
  43. package/dist/entry.js +72 -24
  44. package/dist/figures.d.ts +1 -1
  45. package/dist/figures.d.ts.map +1 -1
  46. package/dist/figures.js +2 -2
  47. package/dist/host.d.ts +1 -0
  48. package/dist/host.d.ts.map +1 -1
  49. package/dist/host.js +28 -17
  50. package/dist/house-query.d.ts +11 -2
  51. package/dist/house-query.d.ts.map +1 -1
  52. package/dist/house-query.js +66 -7
  53. package/dist/identity.d.ts +1 -1
  54. package/dist/identity.d.ts.map +1 -1
  55. package/dist/identity.js +1 -1
  56. package/dist/index.d.ts +16 -12
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +7 -5
  59. package/dist/lifecycle.d.ts.map +1 -1
  60. package/dist/lifecycle.js +2 -0
  61. package/dist/live.d.ts +14 -0
  62. package/dist/live.d.ts.map +1 -1
  63. package/dist/live.js +29 -12
  64. package/dist/loaded.d.ts +5 -3
  65. package/dist/loaded.d.ts.map +1 -1
  66. package/dist/loaded.js +12 -6
  67. package/dist/media.d.ts +5 -6
  68. package/dist/media.d.ts.map +1 -1
  69. package/dist/media.js +75 -18
  70. package/dist/memory.d.ts +2 -2
  71. package/dist/memory.js +9 -9
  72. package/dist/messages.d.ts +5 -1
  73. package/dist/messages.d.ts.map +1 -1
  74. package/dist/messages.js +14 -3
  75. package/dist/model.d.ts +6 -5
  76. package/dist/model.d.ts.map +1 -1
  77. package/dist/name.d.ts +0 -1
  78. package/dist/name.d.ts.map +1 -1
  79. package/dist/name.js +3 -7
  80. package/dist/opened.d.ts +5 -5
  81. package/dist/opened.d.ts.map +1 -1
  82. package/dist/opened.js +2 -2
  83. package/dist/opening.d.ts.map +1 -1
  84. package/dist/opening.js +2 -0
  85. package/dist/outcome.d.ts +21 -13
  86. package/dist/outcome.d.ts.map +1 -1
  87. package/dist/outcome.js +5 -5
  88. package/dist/overlay.d.ts +19 -8
  89. package/dist/overlay.d.ts.map +1 -1
  90. package/dist/overlay.js +108 -37
  91. package/dist/paths.d.ts +1 -1
  92. package/dist/paths.js +1 -1
  93. package/dist/queries.d.ts.map +1 -1
  94. package/dist/queries.js +56 -13
  95. package/dist/query.d.ts +2 -2
  96. package/dist/query.d.ts.map +1 -1
  97. package/dist/reach.d.ts +1 -1
  98. package/dist/reach.d.ts.map +1 -1
  99. package/dist/reach.js +30 -14
  100. package/dist/react.d.ts +6 -0
  101. package/dist/react.d.ts.map +1 -1
  102. package/dist/readiness.d.ts +4 -1
  103. package/dist/readiness.d.ts.map +1 -1
  104. package/dist/readiness.js +2 -1
  105. package/dist/reads.d.ts.map +1 -1
  106. package/dist/reads.js +15 -4
  107. package/dist/refresh.d.ts +1 -1
  108. package/dist/refresh.js +4 -4
  109. package/dist/replica.d.ts +3 -8
  110. package/dist/replica.d.ts.map +1 -1
  111. package/dist/replica.js +3 -3
  112. package/dist/room-draft.d.ts +1 -1
  113. package/dist/room-draft.d.ts.map +1 -1
  114. package/dist/room-draft.js +9 -6
  115. package/dist/room-drafts.d.ts.map +1 -1
  116. package/dist/room-drafts.js +8 -6
  117. package/dist/room-list.d.ts.map +1 -1
  118. package/dist/room-list.js +2 -0
  119. package/dist/rows.d.ts +9 -2
  120. package/dist/rows.d.ts.map +1 -1
  121. package/dist/rows.js +19 -5
  122. package/dist/run-tables.d.ts +25 -0
  123. package/dist/run-tables.d.ts.map +1 -0
  124. package/dist/run-tables.js +98 -0
  125. package/dist/runs.d.ts +27 -0
  126. package/dist/runs.d.ts.map +1 -0
  127. package/dist/runs.js +92 -0
  128. package/dist/runtime.d.ts +2 -0
  129. package/dist/runtime.d.ts.map +1 -1
  130. package/dist/save.d.ts +1 -0
  131. package/dist/save.d.ts.map +1 -1
  132. package/dist/save.js +6 -6
  133. package/dist/saves.d.ts +5 -5
  134. package/dist/saves.d.ts.map +1 -1
  135. package/dist/saves.js +71 -45
  136. package/dist/selector.d.ts +3 -0
  137. package/dist/selector.d.ts.map +1 -0
  138. package/dist/selector.js +22 -0
  139. package/dist/socket.d.ts +3 -1
  140. package/dist/socket.d.ts.map +1 -1
  141. package/dist/socket.js +7 -0
  142. package/dist/source.d.ts +19 -0
  143. package/dist/source.d.ts.map +1 -1
  144. package/dist/source.js +35 -7
  145. package/dist/store/records.d.ts +12 -5
  146. package/dist/store/records.d.ts.map +1 -1
  147. package/dist/store/records.js +10 -4
  148. package/dist/store.d.ts +1 -1
  149. package/dist/store.d.ts.map +1 -1
  150. package/dist/stored.d.ts +9 -2
  151. package/dist/stored.d.ts.map +1 -1
  152. package/dist/stored.js +33 -11
  153. package/dist/surface.d.ts +11 -5
  154. package/dist/surface.d.ts.map +1 -1
  155. package/dist/surface.js +8 -5
  156. package/dist/sync.js +1 -1
  157. package/dist/tables.d.ts +26 -2
  158. package/dist/tables.d.ts.map +1 -1
  159. package/dist/tables.js +24 -3
  160. package/dist/tallies.js +2 -2
  161. package/dist/validation.d.ts +2 -0
  162. package/dist/validation.d.ts.map +1 -1
  163. package/dist/validation.js +49 -3
  164. package/dist/wire.d.ts +7 -6
  165. package/dist/wire.d.ts.map +1 -1
  166. package/dist/wire.js +7 -6
  167. package/package.json +4 -4
  168. package/dist/binary.d.ts.map +0 -1
package/dist/media.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isAudioType, isImageType, isVideoType } from '@agentshouse/mdmodel';
2
2
  import { loaded } from './loaded.js';
3
3
  import { downloadAttachment } from './download.js';
4
- import { blobOf, UNCERTAIN } from './outcome.js';
4
+ import { attachmentBlob, UNCERTAIN } from './outcome.js';
5
5
  export const ROOM_MEDIA = 'room-media';
6
6
  export const KEYED_MEDIA = 'ahc-attachment';
7
7
  export const MEDIA = `${ROOM_MEDIA}, ${KEYED_MEDIA}`;
@@ -25,11 +25,6 @@ const STYLE = `:host{display:block}
25
25
  [part=box]>slot{display:flex;align-items:center;justify-content:center;width:100%;height:100%;text-align:center}
26
26
  [part=play]{position:absolute;top:50%;left:50%;width:56px;height:56px;margin:-28px 0 0 -28px;border-radius:50%;background:rgb(0 0 0/.6);pointer-events:none}
27
27
  [part=play]::before{content:"";position:absolute;top:18px;left:22px;border-style:solid;border-width:10px 0 10px 16px;border-color:transparent transparent transparent #fff}`;
28
- const shows = new WeakMap();
29
- export function shownBy(show, client) {
30
- shows.set(client, show);
31
- return client;
32
- }
33
28
  export function mediaAt(media) {
34
29
  if (media.localName === KEYED_MEDIA) {
35
30
  const link = media.getAttribute('link');
@@ -47,22 +42,42 @@ export function mediaTag(at) {
47
42
  export function downloadAt(client, at) {
48
43
  return 'link' in at
49
44
  ? downloadAttachment(client, at.link)
50
- : client.binaryFile.download(at.room, at.path, at.revision);
45
+ : client.attachment.download(at.room, at.path, at.revision);
51
46
  }
52
47
  function shownAt(client, at) {
53
48
  if (at === null)
54
49
  return null;
55
- if ('link' in at)
56
- return client.conversation.attachment(at.link);
57
- const show = shows.get(client);
58
- return show === undefined ? null : show(at.room, at.path, at.revision);
50
+ if ('link' in at) {
51
+ return client.conversation
52
+ .attachment(at.link)
53
+ .then((shown) => (shown.kind === 'link' ? { ...shown, copies: [] } : shown));
54
+ }
55
+ return client.attachment.show(at.room, at.path, at.revision);
59
56
  }
60
57
  function ratioOf(width, height) {
61
58
  const across = Number(width);
62
59
  const down = Number(height);
63
60
  return Number.isFinite(across) && Number.isFinite(down) && across > 0 && down > 0
64
61
  ? `${across} / ${down}`
65
- : SHAPE;
62
+ : null;
63
+ }
64
+ function ownRatio(found, at) {
65
+ const record = 'documents' in found ? found.documents[0]?.attachment : undefined;
66
+ if (record?.state !== 'accepted' ||
67
+ (at.revision !== undefined && record.revision !== at.revision)) {
68
+ return null;
69
+ }
70
+ return ratioOf(record.width, record.height);
71
+ }
72
+ function offered(drawn, box, copies) {
73
+ if (copies.length === 0) {
74
+ drawn.removeAttribute('srcset');
75
+ drawn.removeAttribute('sizes');
76
+ return;
77
+ }
78
+ const across = Math.ceil(box.getBoundingClientRect().width);
79
+ drawn.sizes = across > 0 ? `${across}px` : '100vw';
80
+ drawn.srcset = copies.map(({ url, width }) => `${url} ${width}w`).join(', ');
66
81
  }
67
82
  function refusedForGood(shown) {
68
83
  if (shown.kind === 'revoked-authorization')
@@ -145,6 +160,9 @@ export function defineRoomMedia(client) {
145
160
  #drawn = null;
146
161
  #loaded = false;
147
162
  #relinked = 0;
163
+ #failedAt = 0;
164
+ #own = null;
165
+ #measuring = null;
148
166
  constructor() {
149
167
  super();
150
168
  this.#box.setAttribute('part', 'box');
@@ -161,17 +179,21 @@ export function defineRoomMedia(client) {
161
179
  void this.#load();
162
180
  }, { rootMargin: NEARING });
163
181
  this.#watching.observe(this);
182
+ this.#measure();
164
183
  }
165
184
  disconnectedCallback() {
166
185
  this.#watching?.disconnect();
167
186
  this.#watching = null;
168
187
  this.#near = false;
169
188
  this.#asked += 1;
189
+ this.#measure();
170
190
  this.#show(null);
171
191
  }
172
192
  attributeChangedCallback(name, before, after) {
173
193
  if (before === after)
174
194
  return;
195
+ if (LOADING.has(name))
196
+ this.#measure();
175
197
  this.#shape();
176
198
  if (this.isConnected)
177
199
  this.#label();
@@ -181,7 +203,28 @@ export function defineRoomMedia(client) {
181
203
  void this.#load();
182
204
  }
183
205
  #shape() {
184
- this.#box.style.aspectRatio = ratioOf(this.getAttribute('width'), this.getAttribute('height'));
206
+ this.#box.style.aspectRatio =
207
+ ratioOf(this.getAttribute('width'), this.getAttribute('height')) ?? this.#own ?? SHAPE;
208
+ }
209
+ #measure() {
210
+ void this.#measuring?.then((measured) => measured.close(), () => undefined);
211
+ this.#measuring = null;
212
+ this.#own = null;
213
+ const at = mediaAt(this);
214
+ if (this.#watching === null || at === null || 'link' in at)
215
+ return;
216
+ const measuring = connected.then((one) => one.observe('query', { rooms: [at.room], paths: [at.path], select: {} }));
217
+ this.#measuring = measuring;
218
+ void measuring.then((measured) => {
219
+ const heard = () => {
220
+ if (this.#measuring !== measuring)
221
+ return;
222
+ this.#own = ownRatio(measured.current(), at);
223
+ this.#shape();
224
+ };
225
+ measured.subscribe(heard);
226
+ heard();
227
+ }, () => undefined);
185
228
  }
186
229
  #label() {
187
230
  const alt = this.getAttribute('alt') ?? '';
@@ -205,7 +248,7 @@ export function defineRoomMedia(client) {
205
248
  if (asked !== this.#asked)
206
249
  return;
207
250
  if (shown?.kind === 'link') {
208
- this.#draw({ url: shown.url, copy: false }, shown.mediaType);
251
+ this.#draw({ url: shown.url, copy: false }, shown.mediaType, shown.copies);
209
252
  return;
210
253
  }
211
254
  if (shown?.kind !== 'binary') {
@@ -215,13 +258,13 @@ export function defineRoomMedia(client) {
215
258
  this.#unshown(asked);
216
259
  return;
217
260
  }
218
- const copy = await blobOf(shown).catch(() => null);
261
+ const copy = await attachmentBlob(shown).catch(() => null);
219
262
  if (asked !== this.#asked)
220
263
  return;
221
264
  if (copy === null)
222
265
  this.#unshown(asked);
223
266
  else
224
- this.#draw({ url: URL.createObjectURL(copy), copy: true }, shown.mediaType);
267
+ this.#draw({ url: URL.createObjectURL(copy), copy: true }, shown.mediaType, []);
225
268
  }
226
269
  #unshown(asked) {
227
270
  this.#unreadable();
@@ -247,7 +290,7 @@ export function defineRoomMedia(client) {
247
290
  #unreadable() {
248
291
  this.#show(null, this.#fallback);
249
292
  }
250
- #draw(shown, mediaType) {
293
+ #draw(shown, mediaType, copies) {
251
294
  const tag = drawnFor(mediaType);
252
295
  if (tag === null) {
253
296
  if (shown.copy)
@@ -273,12 +316,25 @@ export function defineRoomMedia(client) {
273
316
  if (drawn !== this.#drawn)
274
317
  return;
275
318
  this.#loaded = true;
276
- this.#relinked = 0;
319
+ if (drawn instanceof HTMLImageElement)
320
+ this.#relinked = 0;
277
321
  });
322
+ if (drawn instanceof HTMLMediaElement) {
323
+ const played = () => {
324
+ if (drawn !== this.#drawn || drawn.seeking)
325
+ return;
326
+ if (drawn.ended || drawn.currentTime > this.#failedAt)
327
+ this.#relinked = 0;
328
+ };
329
+ drawn.addEventListener('timeupdate', played);
330
+ drawn.addEventListener('ended', played);
331
+ }
278
332
  drawn.addEventListener('error', () => this.#failed(drawn));
279
333
  }
280
334
  this.#drawn = drawn;
281
335
  this.#show(shown, drawn);
336
+ if (drawn instanceof HTMLImageElement)
337
+ offered(drawn, this.#box, copies);
282
338
  drawn.src = shown.url;
283
339
  }
284
340
  #failed(drawn) {
@@ -292,6 +348,7 @@ export function defineRoomMedia(client) {
292
348
  if (drawn instanceof HTMLMediaElement) {
293
349
  const at = drawn.currentTime;
294
350
  const playing = !drawn.paused;
351
+ this.#failedAt = at;
295
352
  drawn.addEventListener('loadedmetadata', () => {
296
353
  drawn.currentTime = at;
297
354
  if (playing)
package/dist/memory.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type VerifiedModel } from '@agentshouse/mdmodel';
2
2
  import type { ModelResult } from './model.js';
3
- import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type SavedFacts, type HeadChange, type ListedAgent, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode, type TypedPath, type TypedSelection } from './adapter.js';
3
+ import { type AcceptedMessage, type ActionResult, type Adapter, type Attachment, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type SavedFacts, type HeadChange, type ListedAgent, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode, type TypedPath, type TypedSelection } from './adapter.js';
4
4
  export type MemoryRoom = Omit<DiscoveredRoom, 'typedSelection' | 'authoredPaths'> & {
5
5
  typedSelection?: TypedSelection | null;
6
6
  authoredPaths?: readonly string[];
@@ -11,7 +11,7 @@ export type MemoryRoom = Omit<DiscoveredRoom, 'typedSelection' | 'authoredPaths'
11
11
  fileIds?: Readonly<Record<string, string>>;
12
12
  created?: Readonly<Record<string, string>>;
13
13
  changes?: Readonly<Record<string, HeadChange>>;
14
- binaryFiles?: Readonly<Record<string, BinaryFile>>;
14
+ attachments?: Readonly<Record<string, Attachment>>;
15
15
  folders?: readonly string[];
16
16
  blobs?: Readonly<Record<string, Blob>>;
17
17
  };
package/dist/memory.js CHANGED
@@ -100,11 +100,11 @@ export function createMemoryAdapter(options = {}) {
100
100
  const wanted = ordinals.get(`${locator}\u0000${target}`);
101
101
  return held !== undefined && wanted !== undefined && held >= wanted;
102
102
  }
103
- function heldBlob(room, path) {
103
+ function heldBytes(room, path) {
104
104
  return attached.get(`${room.locator}\u0000${path}`) ?? room.blobs?.[path];
105
105
  }
106
106
  function linkTo(room, path) {
107
- const blob = room === undefined ? undefined : heldBlob(room, path);
107
+ const blob = room === undefined ? undefined : heldBytes(room, path);
108
108
  if (blob === undefined)
109
109
  return UNFOUND;
110
110
  const url = linked.get(blob) ?? URL.createObjectURL(blob);
@@ -128,7 +128,7 @@ export function createMemoryAdapter(options = {}) {
128
128
  const extension = dot > 0 ? name.slice(dot) : '';
129
129
  for (let count = 1;; count += 1) {
130
130
  const path = `${ATTACHMENTS}/${count === 1 ? stem : `${stem}-${count}`}${extension}`;
131
- if (heldBlob(room, path) === undefined && room.documents?.[path] === undefined)
131
+ if (heldBytes(room, path) === undefined && room.documents?.[path] === undefined)
132
132
  return path;
133
133
  }
134
134
  }
@@ -193,7 +193,7 @@ export function createMemoryAdapter(options = {}) {
193
193
  const size = pageSize ?? paths.length;
194
194
  const taken = paths.slice(from, from + size);
195
195
  const next = from + taken.length;
196
- const targets = opening ? Object.keys(room.binaryFiles ?? {}) : [];
196
+ const targets = opening ? Object.keys(room.attachments ?? {}) : [];
197
197
  return {
198
198
  kind: 'bootstrap',
199
199
  roomVersion: room.roomVersion,
@@ -208,7 +208,7 @@ export function createMemoryAdapter(options = {}) {
208
208
  ? {}
209
209
  : { created: named(room.created, [...taken, ...targets]) }),
210
210
  changes: named(room.changes ?? {}, [...taken, ...targets]),
211
- binaryFiles: named(room.binaryFiles ?? {}, targets),
211
+ attachments: named(room.attachments ?? {}, targets),
212
212
  ...(opening && room.folders !== undefined ? { folders: room.folders } : {}),
213
213
  ...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
214
214
  };
@@ -226,8 +226,8 @@ export function createMemoryAdapter(options = {}) {
226
226
  function advancement(room, from, at, whole = false) {
227
227
  const current = room.documents ?? {};
228
228
  const previous = from.documents ?? {};
229
- const currentTargets = new Set(Object.keys(room.binaryFiles ?? {}));
230
- const previousTargets = new Set(Object.keys(from.binaryFiles ?? {}));
229
+ const currentTargets = new Set(Object.keys(room.attachments ?? {}));
230
+ const previousTargets = new Set(Object.keys(from.attachments ?? {}));
231
231
  const headMoved = (path) => room.revisions?.[path] !== from.revisions?.[path] ||
232
232
  room.fileIds?.[path] !== from.fileIds?.[path] ||
233
233
  room.created?.[path] !== from.created?.[path] ||
@@ -260,7 +260,7 @@ export function createMemoryAdapter(options = {}) {
260
260
  ? {}
261
261
  : { created: named(room.created, [...taken, ...targets]) }),
262
262
  changes: named(room.changes ?? {}, [...taken, ...targets]),
263
- binaryFiles: named(room.binaryFiles ?? {}, targets),
263
+ attachments: named(room.attachments ?? {}, targets),
264
264
  ...(opening ? foldersMoved(room, from) : {}),
265
265
  removals: opening
266
266
  ? [
@@ -653,7 +653,7 @@ export function createMemoryAdapter(options = {}) {
653
653
  const room = rooms.find((entry) => entry.locator === request.locator);
654
654
  if (room === undefined)
655
655
  return { kind: 'room-not-readable', locator: request.locator };
656
- const blob = heldBlob(room, request.path);
656
+ const blob = heldBytes(room, request.path);
657
657
  return blob === undefined
658
658
  ? { kind: 'rejected', code: 'not_found', fields: {}, retryable: false }
659
659
  : { kind: 'binary', body: blob.stream(), mediaType: declaredType(blob) };
@@ -2,7 +2,7 @@ import type { SessionState } from '@agentshouse/session-content';
2
2
  import type { AcceptedMessage } from './adapter.js';
3
3
  import type { Connection } from './tables.js';
4
4
  export declare const MESSAGE_TABLES: readonly string[];
5
- export declare const ROWS = "WITH chosen AS (\n SELECT listed.value AS conversation,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'assistant' ORDER BY position DESC, identity DESC LIMIT 1) AS answer,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND text <> '' ORDER BY position DESC, identity DESC LIMIT 1) AS said,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' ORDER BY position, identity LIMIT 1) AS opened,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' AND json_extract(message, '$.waiting') = 1 ORDER BY position, identity LIMIT 1) AS asking\n FROM json_each(?) AS listed\n )\n SELECT chosen.conversation AS conversation,\n substr(said.text, 1, 512) AS said_text,\n json_extract(said.message, '$.role') AS said_role,\n json_extract(said.message, '$.accepted_at') AS said_at,\n answer.turn AS answered,\n json_extract(answer.message, '$.content.state') AS saved_state,\n json_extract(answer.message, '$.accepted_at') AS saved_at,\n substr(json_extract(answer.message, '$.failure'), 1, 512) AS failure,\n COALESCE(\n (SELECT value FROM conversation_facts WHERE conversation = chosen.conversation AND name = 'openedTurn'),\n CASE WHEN julianday(json_extract(answer.message, '$.accepted_at')) < (SELECT julianday(json_extract(value, '$')) FROM replica_facts WHERE name = 'readUntil') THEN answer.turn END\n ) AS opened_turn,\n json_extract(opened.message, '$.source') AS opened_source,\n json_extract(opened.message, '$.sender') AS opened_sender,\n asking.identity AS asking_identity,\n asking.text AS asking_text,\n json_extract(asking.message, '$.accepted_at') AS asking_at,\n json_extract(asking.message, '$.source') AS asking_source,\n json_extract(asking.message, '$.sender') AS asking_sender\n FROM chosen\n LEFT JOIN conversation_messages said ON said.id = chosen.said\n LEFT JOIN conversation_messages answer ON answer.id = chosen.answer\n LEFT JOIN conversation_messages opened ON opened.id = chosen.opened\n LEFT JOIN conversation_messages asking ON asking.id = chosen.asking";
5
+ export declare const ROWS = "WITH chosen AS (\n SELECT listed.value AS conversation,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'assistant' ORDER BY position DESC, identity DESC LIMIT 1) AS answer,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND text <> '' ORDER BY position DESC, identity DESC LIMIT 1) AS said,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' ORDER BY position, identity LIMIT 1) AS opened,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' AND json_extract(message, '$.waiting') = 1 ORDER BY position, identity LIMIT 1) AS asking,\n (SELECT id FROM conversation_messages WHERE conversation = listed.value AND json_extract(message, '$.role') = 'house' AND json_extract(message, '$.source.kind') = 'instructions_proposal' AND json_extract(message, '$.source.state') = 'waiting' ORDER BY position DESC, identity DESC LIMIT 1) AS proposing\n FROM json_each(?) AS listed\n )\n SELECT chosen.conversation AS conversation,\n substr(said.text, 1, 512) AS said_text,\n json_extract(said.message, '$.role') AS said_role,\n json_extract(said.message, '$.accepted_at') AS said_at,\n answer.turn AS answered,\n json_extract(answer.message, '$.content.state') AS saved_state,\n json_extract(answer.message, '$.accepted_at') AS saved_at,\n substr(json_extract(answer.message, '$.failure'), 1, 512) AS failure,\n COALESCE(\n (SELECT value FROM conversation_facts WHERE conversation = chosen.conversation AND name = 'openedTurn'),\n CASE WHEN julianday(json_extract(answer.message, '$.accepted_at')) < (SELECT julianday(json_extract(value, '$')) FROM replica_facts WHERE name = 'readUntil') THEN answer.turn END\n ) AS opened_turn,\n json_extract(opened.message, '$.source') AS opened_source,\n json_extract(opened.message, '$.sender') AS opened_sender,\n asking.identity AS asking_identity,\n asking.text AS asking_text,\n json_extract(asking.message, '$.accepted_at') AS asking_at,\n json_extract(asking.message, '$.source') AS asking_source,\n json_extract(asking.message, '$.sender') AS asking_sender,\n json_extract(proposing.message, '$.source') AS proposing_source,\n json_extract(proposing.message, '$.accepted_at') AS proposing_at\n FROM chosen\n LEFT JOIN conversation_messages said ON said.id = chosen.said\n LEFT JOIN conversation_messages answer ON answer.id = chosen.answer\n LEFT JOIN conversation_messages opened ON opened.id = chosen.opened\n LEFT JOIN conversation_messages asking ON asking.id = chosen.asking\n LEFT JOIN conversation_messages proposing ON proposing.id = chosen.proposing";
6
6
  export type HeldConversation = {
7
7
  readonly conversation: string;
8
8
  readonly read: string | null | undefined;
@@ -36,6 +36,10 @@ export type HeldRow = {
36
36
  readonly text: string;
37
37
  readonly at: string | null;
38
38
  }) | null;
39
+ readonly proposing: {
40
+ readonly source: unknown;
41
+ readonly at: string | null;
42
+ } | null;
39
43
  };
40
44
  export type ConversationFact = 'openedTurn' | 'dismissedSuggestion';
41
45
  export type HeldFact = {
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAM1D,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAQ3C,CAAC;AAUF,eAAO,MAAM,IAAI,wvEA+BqD,CAAC;AAEvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7F,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;Q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AmBD,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EACxC,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,aAAa,CAWf;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,MAAM,CAOR;AAaD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,OAAO,EAAE,CAoCX;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAO/F;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ,EAAE,CAMpE;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,QAAQ,GAAG,IAAI,CAM9F;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAEnE"}
package/dist/messages.js CHANGED
@@ -4,6 +4,7 @@ import { EXCERPT } from './read.js';
4
4
  import { tablesOf } from './stored.js';
5
5
  const SAID_BY_HOUSE = `json_extract(message, '$.role') = 'house'`;
6
6
  const ANSWERS_THE_TURN = `json_extract(message, '$.role') = 'assistant'`;
7
+ const WAITING_PROPOSAL = `json_extract(message, '$.source.kind') = 'instructions_proposal' AND json_extract(message, '$.source.state') = 'waiting'`;
7
8
  export const MESSAGE_TABLES = [
8
9
  'CREATE TABLE conversation_reads (conversation TEXT PRIMARY KEY, read TEXT, partial INTEGER NOT NULL) WITHOUT ROWID',
9
10
  'CREATE TABLE conversation_messages (id INTEGER PRIMARY KEY, conversation TEXT NOT NULL, identity TEXT NOT NULL, turn TEXT NOT NULL, position TEXT NOT NULL, change TEXT NOT NULL, message TEXT NOT NULL, text TEXT NOT NULL)',
@@ -22,7 +23,8 @@ export const ROWS = `WITH chosen AS (
22
23
  (${OF_THE_ROW} AND ${ANSWERS_THE_TURN} ${NEWEST_FIRST}) AS answer,
23
24
  (${OF_THE_ROW} AND text <> '' ${NEWEST_FIRST}) AS said,
24
25
  (${OF_THE_ROW} AND ${SAID_BY_HOUSE} ${OLDEST_FIRST}) AS opened,
25
- (${OF_THE_ROW} AND ${SAID_BY_HOUSE} AND json_extract(message, '$.waiting') = 1 ${OLDEST_FIRST}) AS asking
26
+ (${OF_THE_ROW} AND ${SAID_BY_HOUSE} AND json_extract(message, '$.waiting') = 1 ${OLDEST_FIRST}) AS asking,
27
+ (${OF_THE_ROW} AND ${SAID_BY_HOUSE} AND ${WAITING_PROPOSAL} ${NEWEST_FIRST}) AS proposing
26
28
  FROM json_each(?) AS listed
27
29
  )
28
30
  SELECT chosen.conversation AS conversation,
@@ -43,12 +45,15 @@ export const ROWS = `WITH chosen AS (
43
45
  asking.text AS asking_text,
44
46
  json_extract(asking.message, '$.accepted_at') AS asking_at,
45
47
  json_extract(asking.message, '$.source') AS asking_source,
46
- json_extract(asking.message, '$.sender') AS asking_sender
48
+ json_extract(asking.message, '$.sender') AS asking_sender,
49
+ json_extract(proposing.message, '$.source') AS proposing_source,
50
+ json_extract(proposing.message, '$.accepted_at') AS proposing_at
47
51
  FROM chosen
48
52
  LEFT JOIN conversation_messages said ON said.id = chosen.said
49
53
  LEFT JOIN conversation_messages answer ON answer.id = chosen.answer
50
54
  LEFT JOIN conversation_messages opened ON opened.id = chosen.opened
51
- LEFT JOIN conversation_messages asking ON asking.id = chosen.asking`;
55
+ LEFT JOIN conversation_messages asking ON asking.id = chosen.asking
56
+ LEFT JOIN conversation_messages proposing ON proposing.id = chosen.proposing`;
52
57
  export function heldConversations(connection, conversations) {
53
58
  const named = conversations === null ? '' : ' AND conversation IN (SELECT value FROM json_each(?))';
54
59
  const bound = conversations === null ? [] : [JSON.stringify(conversations)];
@@ -147,6 +152,12 @@ export function conversationRows(connection, conversations) {
147
152
  text: text(row.asking_text),
148
153
  at: textOrNull(row.asking_at),
149
154
  },
155
+ proposing: row.proposing_source === null
156
+ ? null
157
+ : {
158
+ source: JSON.parse(text(row.proposing_source)),
159
+ at: textOrNull(row.proposing_at),
160
+ },
150
161
  }));
151
162
  }
152
163
  export function turnArrived(connection, conversation, turn) {
package/dist/model.d.ts CHANGED
@@ -17,20 +17,21 @@ export type ModelResult = {
17
17
  reason: ModelUnavailableReason;
18
18
  };
19
19
  export type MdType = Definition;
20
- export type ModelState = {
20
+ export type StoredModel = {
21
21
  status: 'unavailable';
22
22
  reason: ModelUnavailableReason;
23
23
  } | {
24
24
  status: 'current' | 'cached';
25
25
  snapshot: ModelSnapshot;
26
26
  verifiedWith: ModelIdentity;
27
- types: VerifiedModel['types'];
28
27
  };
29
- export type StoredModel = Extract<ModelState, {
28
+ export type ModelState = Extract<StoredModel, {
30
29
  status: 'unavailable';
31
- }> | Omit<Extract<ModelState, {
30
+ }> | (Extract<StoredModel, {
32
31
  status: 'current' | 'cached';
33
- }>, 'types'>;
32
+ }> & {
33
+ types: VerifiedModel['types'];
34
+ });
34
35
  export type TypesResult<Types = readonly MdType[]> = {
35
36
  status: Open<'unavailable'>;
36
37
  reason: ModelUnavailableReason;
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,aAAa,GA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M,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,CAAC;CACpC,CAAC;AACF,eAAO,MAAM,QAAQ,EAAE,UAA8D,CAAC;AACtF,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS,MAAM,EAAE,CAI5E;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAEzD;AACD,wBAAgB,WAAW,CAAC,KAAK,EAC/B,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,KAAK,GAC7C,WAAW,CAAC,KAAK,CAAC,CAYpB;AACD,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAI1D"}
package/dist/name.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export declare function transliterated(text: string): string;
2
1
  export declare function nameFrom(title: string): string;
3
2
  export declare function cutName(name: string, most: number): string;
4
3
  //# sourceMappingURL=name.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../src/name.ts"],"names":[],"mappings":"AAgHA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D"}
1
+ {"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../src/name.ts"],"names":[],"mappings":"AA+GA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D"}
package/dist/name.js CHANGED
@@ -97,22 +97,18 @@ function lowerLetterOf(character) {
97
97
  function codePoint(character) {
98
98
  return WORDLIKE.test(character) ? `-u${character.codePointAt(0)?.toString(16) ?? ''}-` : '-';
99
99
  }
100
- function latin(text, unknown) {
100
+ function latin(text) {
101
101
  return [...text]
102
102
  .map((character) => {
103
103
  if ((character.codePointAt(0) ?? 0) < 0x80)
104
104
  return character;
105
105
  const lower = character.toLowerCase();
106
- const letter = lowerLetterOf(lower) ?? unknown(lower);
107
- return lower === character ? letter : `${letter.charAt(0).toUpperCase()}${letter.slice(1)}`;
106
+ return lowerLetterOf(lower) ?? codePoint(lower);
108
107
  })
109
108
  .join('');
110
109
  }
111
- export function transliterated(text) {
112
- return latin(text, () => '-');
113
- }
114
110
  export function nameFrom(title) {
115
- return latin(title, codePoint)
111
+ return latin(title)
116
112
  .toLowerCase()
117
113
  .replace(/[^a-z0-9]+/g, '-')
118
114
  .replace(/^-+|-+$/g, '');
package/dist/opened.d.ts CHANGED
@@ -1,22 +1,22 @@
1
- import type { BinaryResult } from './adapter.js';
1
+ import type { AttachmentResult } from './adapter.js';
2
2
  import { type RuntimeDatabase } from './tables.js';
3
3
  export type OpenedName = {
4
4
  readonly locator: string;
5
5
  readonly path: string;
6
6
  readonly revision: string;
7
7
  };
8
- export type KeptBinary = {
8
+ export type KeptAttachment = {
9
9
  readonly kind: 'binary';
10
10
  readonly file: string;
11
11
  readonly byteLength: number;
12
12
  readonly mediaType: string;
13
13
  };
14
- export type KeptResult = KeptBinary | Exclude<BinaryResult, {
14
+ export type KeptResult = KeptAttachment | Exclude<AttachmentResult, {
15
15
  kind: 'binary';
16
16
  }>;
17
17
  export type OpenedFiles = {
18
- find(name: OpenedName): Promise<KeptBinary | null>;
19
- fetch(name: OpenedName, read: () => Promise<BinaryResult>): Promise<KeptResult>;
18
+ find(name: OpenedName): Promise<KeptAttachment | null>;
19
+ fetch(name: OpenedName, read: () => Promise<AttachmentResult>): Promise<KeptResult>;
20
20
  };
21
21
  export declare function openedFiles(database: RuntimeDatabase, lost: (locator: string) => boolean): OpenedFiles;
22
22
  //# sourceMappingURL=opened.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"opened.d.ts","sourceRoot":"","sources":["../src/opened.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAErF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAEhF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACnD,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACjF,CAAC;AAsBF,wBAAgB,WAAW,CACzB,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GACjC,WAAW,CAsFb"}
1
+ {"version":3,"file":"opened.d.ts","sourceRoot":"","sources":["../src/opened.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAErF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAExF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACvD,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACrF,CAAC;AAsBF,wBAAgB,WAAW,CACzB,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GACjC,WAAW,CAsFb"}
package/dist/opened.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { digest } from './digest.js';
2
- import { binaryLocalId } from './identity.js';
2
+ import { attachmentLocalId } from './identity.js';
3
3
  import { FILE_PART_BYTES } from './tables.js';
4
4
  const UNCERTAIN = { kind: 'transport-uncertainty' };
5
5
  function kept({ key, byteLength, mediaType }) {
@@ -27,7 +27,7 @@ export function openedFiles(database, lost) {
27
27
  return held === null ? null : kept(held);
28
28
  }
29
29
  async function written(name, { body, mediaType, sha256 }) {
30
- const key = binaryLocalId();
30
+ const key = attachmentLocalId();
31
31
  const reader = body.getReader();
32
32
  const hashed = digest();
33
33
  const chunks = [];
@@ -1 +1 @@
1
- {"version":3,"file":"opening.d.ts","sourceRoot":"","sources":["../src/opening.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAsCxF"}
1
+ {"version":3,"file":"opening.d.ts","sourceRoot":"","sources":["../src/opening.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAuCxF"}
package/dist/opening.js CHANGED
@@ -5,6 +5,7 @@ import { sweep } from './install.js';
5
5
  import { eraseFenced } from './lost.js';
6
6
  import { prepare } from './preparation.js';
7
7
  import { unpair } from './queue.js';
8
+ import { runsOpened } from './runs.js';
8
9
  import { emitRooms, emitStorageLoss, statusShown } from './shown.js';
9
10
  export async function open(runtime, opened) {
10
11
  const { store, socket, shell, conversations, build } = runtime;
@@ -40,6 +41,7 @@ export async function open(runtime, opened) {
40
41
  if (held.erasing || held.orphans.length > 0)
41
42
  queueMicrotask(() => sweep(runtime));
42
43
  await conversationsOpened(conversations, opened);
44
+ await runsOpened(runtime);
43
45
  if (interrupted.length > 0) {
44
46
  queueMicrotask(() => {
45
47
  void eraseFenced(runtime, interrupted).catch(uncaught);
package/dist/outcome.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { ActionResult, AdapterFailure, AttachResult, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
1
+ import type { ActionResult, AdapterFailure, AttachResult, AttachmentCopy, AttachmentLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
2
2
  import type { ChangeBatch } from './change.js';
3
3
  import type { Attempt, Retries } from './retried.js';
4
- import type { KeptBinary, KeptResult } from './opened.js';
4
+ import type { KeptAttachment, KeptResult } from './opened.js';
5
5
  type Refused<Kind extends string> = ProviderRefusal & {
6
6
  kind: Kind;
7
7
  };
@@ -20,22 +20,30 @@ export type CallResult = {
20
20
  export type HistoryAnswer = Exclude<HistoryResult, {
21
21
  kind: Failure['kind'];
22
22
  }> | Failure;
23
- type BinaryRefusal = Refused<'rejected'> | Refused<'absent'> | Failure;
24
- export type BinaryAnswer = {
23
+ type AttachmentRefusal = Refused<'rejected'> | Refused<'absent'> | Failure;
24
+ export type AttachmentAnswer = {
25
25
  kind: 'binary';
26
26
  stream: ReadableStream<Uint8Array>;
27
27
  byteLength: number;
28
28
  mediaType: string;
29
- } | BinaryRefusal;
30
- export type HeldBinaryAnswer = KeptBinary | BinaryRefusal;
31
- export type BinaryLinkAnswer = {
29
+ } | AttachmentRefusal;
30
+ export type HeldAttachmentAnswer = KeptAttachment | AttachmentRefusal;
31
+ export type AttachmentLinkAnswer = {
32
32
  kind: 'link';
33
33
  url: string;
34
34
  name: string;
35
35
  mediaType: string;
36
36
  } | Refused<'rejected'> | Refused<'absent'> | Failure;
37
- export type HeldShownAnswer = KeptBinary | BinaryLinkAnswer;
38
- export type ShownAnswer = BinaryAnswer | BinaryLinkAnswer;
37
+ export type ShownLinkAnswer = Extract<AttachmentLinkAnswer, {
38
+ kind: 'link';
39
+ }> & {
40
+ copies: readonly AttachmentCopy[];
41
+ };
42
+ type ShownRefusal = Exclude<AttachmentLinkAnswer, {
43
+ kind: 'link';
44
+ }>;
45
+ export type HeldShownAnswer = KeptAttachment | ShownLinkAnswer | ShownRefusal;
46
+ export type ShownAnswer = AttachmentAnswer | ShownLinkAnswer | ShownRefusal;
39
47
  export type AttachAnswer = {
40
48
  kind: 'attached';
41
49
  path: string;
@@ -60,13 +68,13 @@ export type Resolution = {
60
68
  export declare const UNREADABLE: Refused<'unreadable'>;
61
69
  export declare const LOCKED_UNREADABLE: Refused<'unreadable'>;
62
70
  export declare const ABSENT_TARGET: Refused<'absent'>;
63
- export declare function absentBinary(path: string): Refused<'absent'>;
71
+ export declare function absentAttachment(path: string): Refused<'absent'>;
64
72
  export declare function declaredType(blob: Blob): string;
65
- export declare function blobOf(binary: Extract<BinaryAnswer, {
73
+ export declare function attachmentBlob(binary: Extract<AttachmentAnswer, {
66
74
  kind: 'binary';
67
75
  }>): Promise<Blob>;
68
- export declare function binaryAnswer(result: KeptResult): HeldBinaryAnswer;
69
- export declare function binaryLinkAnswer(result: BinaryLinkResult, held?: string): BinaryLinkAnswer;
76
+ export declare function attachmentAnswer(result: KeptResult): HeldAttachmentAnswer;
77
+ export declare function attachmentLinkAnswer(result: AttachmentLinkResult, held?: string): AttachmentLinkAnswer;
70
78
  export declare function attachAnswer(result: AttachResult): AttachAnswer;
71
79
  export declare function linkedAnswer(result: AttachResult): ConversationAttachAnswer;
72
80
  export declare const ROOM_LOCKED = "room-locked";
@@ -1 +1 @@
1
- {"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO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