@agentshouse/mdruntime 0.1.0-c45e2d0d978ee → 0.1.0-c4677fe3b9ecf
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.
- package/README.md +1 -1
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +31 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +39 -15
- package/dist/adapter.d.ts +109 -17
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +2 -2
- package/dist/{binary.d.ts → attachment.d.ts} +4 -4
- package/dist/attachment.d.ts.map +1 -0
- package/dist/{binary.js → attachment.js} +2 -2
- package/dist/chain.d.ts +1 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +5 -2
- package/dist/change.d.ts +2 -2
- package/dist/chat-types.js +2 -2
- package/dist/client.d.ts +16 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +15 -15
- package/dist/collection.d.ts +1 -0
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +7 -1
- package/dist/compile.d.ts +2 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +71 -39
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +8 -2
- package/dist/conversation-live.d.ts +1 -0
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +2 -1
- package/dist/conversation-row.d.ts +16 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +17 -1
- package/dist/conversation.d.ts +13 -5
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +45 -37
- package/dist/declaration.js +3 -3
- package/dist/download.d.ts +2 -2
- package/dist/download.d.ts.map +1 -1
- package/dist/download.js +2 -2
- package/dist/entry.d.ts +14 -3
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +87 -26
- package/dist/figures.d.ts +1 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +2 -2
- package/dist/host.d.ts +1 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +28 -17
- package/dist/house-query.d.ts +11 -2
- package/dist/house-query.d.ts.map +1 -1
- package/dist/house-query.js +66 -7
- package/dist/identity.d.ts +1 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +16 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +2 -0
- package/dist/linked-file.d.ts +7 -0
- package/dist/linked-file.d.ts.map +1 -0
- package/dist/linked-file.js +16 -0
- package/dist/live.d.ts +14 -0
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +29 -12
- package/dist/loaded.d.ts +5 -3
- package/dist/loaded.d.ts.map +1 -1
- package/dist/loaded.js +12 -6
- package/dist/media.d.ts +5 -6
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +75 -18
- package/dist/memory.d.ts +2 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +13 -12
- package/dist/messages.d.ts +5 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +14 -3
- package/dist/model.d.ts +6 -5
- package/dist/model.d.ts.map +1 -1
- package/dist/name.d.ts +0 -1
- package/dist/name.d.ts.map +1 -1
- package/dist/name.js +3 -7
- package/dist/opened.d.ts +5 -5
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +2 -2
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +2 -0
- package/dist/outcome.d.ts +21 -13
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +5 -5
- package/dist/overlay.d.ts +19 -8
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +108 -37
- package/dist/parts.d.ts +1 -0
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +1 -1
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +1 -1
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +56 -13
- package/dist/query.d.ts +2 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/queue.d.ts +1 -1
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +4 -2
- package/dist/reach.d.ts +1 -1
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +30 -14
- package/dist/react.d.ts +6 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +4 -1
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +2 -1
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +15 -4
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.js +4 -4
- package/dist/replica.d.ts +3 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +3 -3
- package/dist/room-draft.d.ts +1 -1
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +9 -6
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +8 -6
- package/dist/room-list.d.ts.map +1 -1
- package/dist/room-list.js +2 -0
- package/dist/rows.d.ts +9 -2
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +19 -5
- package/dist/run-tables.d.ts +25 -0
- package/dist/run-tables.d.ts.map +1 -0
- package/dist/run-tables.js +98 -0
- package/dist/runs.d.ts +27 -0
- package/dist/runs.d.ts.map +1 -0
- package/dist/runs.js +92 -0
- package/dist/runtime.d.ts +4 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +21 -17
- package/dist/saves.d.ts +5 -5
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +74 -47
- package/dist/selector.d.ts +3 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +22 -0
- package/dist/shown.d.ts +1 -1
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +13 -12
- package/dist/socket.d.ts +3 -1
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +7 -0
- package/dist/source.d.ts +37 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +63 -7
- package/dist/store/records.d.ts +12 -5
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +10 -4
- package/dist/store.d.ts +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/stored.d.ts +9 -2
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +33 -11
- package/dist/surface.d.ts +11 -5
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +8 -5
- package/dist/sync.js +1 -1
- package/dist/tables.d.ts +26 -2
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +24 -3
- package/dist/tallies.js +2 -2
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +49 -3
- package/dist/wire.d.ts +7 -6
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +7 -6
- package/package.json +4 -4
- package/dist/binary.d.ts.map +0 -1
package/dist/loaded.js
CHANGED
|
@@ -7,19 +7,25 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
7
7
|
return path;
|
|
8
8
|
};
|
|
9
9
|
const holdings = new WeakMap();
|
|
10
|
-
async function
|
|
11
|
-
if (file ===
|
|
12
|
-
return
|
|
10
|
+
export async function atAddress(file, use) {
|
|
11
|
+
if (typeof file === 'string')
|
|
12
|
+
return use(file);
|
|
13
13
|
const address = URL.createObjectURL(file);
|
|
14
14
|
try {
|
|
15
|
-
return await
|
|
15
|
+
return await use(address);
|
|
16
16
|
}
|
|
17
17
|
finally {
|
|
18
18
|
URL.revokeObjectURL(address);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
export function importedFile(file) {
|
|
22
|
+
return file === null ? Promise.resolve(null) : atAddress(file, (address) => import(__rewriteRelativeImportExtension(address)));
|
|
23
|
+
}
|
|
21
24
|
export async function parsed(file) {
|
|
22
|
-
|
|
25
|
+
if (file === null)
|
|
26
|
+
return null;
|
|
27
|
+
const text = typeof file === 'string' ? await (await fetch(file)).text() : await file.text();
|
|
28
|
+
return JSON.parse(text);
|
|
23
29
|
}
|
|
24
30
|
export function perBuild(buildFile, key, make) {
|
|
25
31
|
let named = holdings.get(buildFile);
|
|
@@ -35,6 +41,6 @@ export function perBuild(buildFile, key, make) {
|
|
|
35
41
|
making.catch(() => named.delete(key));
|
|
36
42
|
return making;
|
|
37
43
|
}
|
|
38
|
-
export function loaded(buildFile, name, read =
|
|
44
|
+
export function loaded(buildFile, name, read = importedFile) {
|
|
39
45
|
return perBuild(buildFile, name, () => buildFile(name).then(read));
|
|
40
46
|
}
|
package/dist/media.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import type { MdRuntimeClient } from './client.js';
|
|
2
|
-
import { type DownloadAnswer
|
|
2
|
+
import { type DownloadAnswer } from './outcome.js';
|
|
3
3
|
export declare const ROOM_MEDIA = "room-media";
|
|
4
4
|
export declare const KEYED_MEDIA = "ahc-attachment";
|
|
5
5
|
export declare const MEDIA = "room-media, ahc-attachment";
|
|
6
6
|
export declare const DIAGRAM = "md-diagram";
|
|
7
7
|
export declare const VIEWING = "ahc-viewer";
|
|
8
|
-
type
|
|
9
|
-
export type MediaAt = {
|
|
10
|
-
readonly link: string;
|
|
11
|
-
} | {
|
|
8
|
+
type RoomAt = {
|
|
12
9
|
readonly room: string;
|
|
13
10
|
readonly path: string;
|
|
14
11
|
readonly revision: string | undefined;
|
|
15
12
|
};
|
|
16
|
-
export
|
|
13
|
+
export type MediaAt = {
|
|
14
|
+
readonly link: string;
|
|
15
|
+
} | RoomAt;
|
|
17
16
|
export declare function mediaAt(media: Element): MediaAt | null;
|
|
18
17
|
export declare function mediaTag(at: MediaAt): string;
|
|
19
18
|
export declare function downloadAt(client: MdRuntimeClient, at: MediaAt): Promise<DownloadAnswer>;
|
package/dist/media.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRo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,IAAI,CAyOxF"}
|
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 {
|
|
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.
|
|
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
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
:
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
14
|
+
attachments?: Readonly<Record<string, Attachment>>;
|
|
15
15
|
folders?: readonly string[];
|
|
16
16
|
blobs?: Readonly<Record<string, Blob>>;
|
|
17
17
|
};
|
package/dist/memory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAIZ,KAAK,UAAU,EAOf,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAKtB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,UAAU,EAGf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,MAAM,EAGX,KAAK,aAAa,EAIlB,KAAK,SAAS,EAGd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AA+BtB,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,gBAAgB,GAAG,eAAe,CAAC,GAAG;IAClF,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,SAAS,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MAAM,EAAE,GAAG,IAAI,CAAC;IAC1C,iBAAiB,CAAC,YAAY,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChF,sBAAsB,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IAC3D,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnD,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,SAAS,IAAI,SAAS,MAAM,EAAE,CAAC;IAC/B,uBAAuB,IAAI,SAAS,MAAM,EAAE,CAAC;IAC7C,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAAC;CACzC,CAAC;AA0CF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CA8sBrF"}
|
package/dist/memory.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { definitionAt, documentFacts, keyedDestination,
|
|
1
|
+
import { definitionAt, documentFacts, keyedDestination, parse, } from '@agentshouse/mdmodel';
|
|
2
2
|
import { NO_ROOM_TYPES, schemaTypes } from './attached-model.js';
|
|
3
3
|
import { selected } from './collection.js';
|
|
4
|
+
import { linkedFile } from './linked-file.js';
|
|
4
5
|
import { declaredType } from './outcome.js';
|
|
5
6
|
import { sameChange } from './overlay.js';
|
|
6
7
|
const ATTACHMENTS = 'attachments';
|
|
@@ -100,11 +101,11 @@ export function createMemoryAdapter(options = {}) {
|
|
|
100
101
|
const wanted = ordinals.get(`${locator}\u0000${target}`);
|
|
101
102
|
return held !== undefined && wanted !== undefined && held >= wanted;
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function heldBytes(room, path) {
|
|
104
105
|
return attached.get(`${room.locator}\u0000${path}`) ?? room.blobs?.[path];
|
|
105
106
|
}
|
|
106
107
|
function linkTo(room, path) {
|
|
107
|
-
const blob = room === undefined ? undefined :
|
|
108
|
+
const blob = room === undefined ? undefined : heldBytes(room, path);
|
|
108
109
|
if (blob === undefined)
|
|
109
110
|
return UNFOUND;
|
|
110
111
|
const url = linked.get(blob) ?? URL.createObjectURL(blob);
|
|
@@ -128,7 +129,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
128
129
|
const extension = dot > 0 ? name.slice(dot) : '';
|
|
129
130
|
for (let count = 1;; count += 1) {
|
|
130
131
|
const path = `${ATTACHMENTS}/${count === 1 ? stem : `${stem}-${count}`}${extension}`;
|
|
131
|
-
if (
|
|
132
|
+
if (heldBytes(room, path) === undefined && room.documents?.[path] === undefined)
|
|
132
133
|
return path;
|
|
133
134
|
}
|
|
134
135
|
}
|
|
@@ -193,7 +194,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
193
194
|
const size = pageSize ?? paths.length;
|
|
194
195
|
const taken = paths.slice(from, from + size);
|
|
195
196
|
const next = from + taken.length;
|
|
196
|
-
const targets = opening ? Object.keys(room.
|
|
197
|
+
const targets = opening ? Object.keys(room.attachments ?? {}) : [];
|
|
197
198
|
return {
|
|
198
199
|
kind: 'bootstrap',
|
|
199
200
|
roomVersion: room.roomVersion,
|
|
@@ -208,7 +209,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
208
209
|
? {}
|
|
209
210
|
: { created: named(room.created, [...taken, ...targets]) }),
|
|
210
211
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
211
|
-
|
|
212
|
+
attachments: named(room.attachments ?? {}, targets),
|
|
212
213
|
...(opening && room.folders !== undefined ? { folders: room.folders } : {}),
|
|
213
214
|
...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
|
|
214
215
|
};
|
|
@@ -226,8 +227,8 @@ export function createMemoryAdapter(options = {}) {
|
|
|
226
227
|
function advancement(room, from, at, whole = false) {
|
|
227
228
|
const current = room.documents ?? {};
|
|
228
229
|
const previous = from.documents ?? {};
|
|
229
|
-
const currentTargets = new Set(Object.keys(room.
|
|
230
|
-
const previousTargets = new Set(Object.keys(from.
|
|
230
|
+
const currentTargets = new Set(Object.keys(room.attachments ?? {}));
|
|
231
|
+
const previousTargets = new Set(Object.keys(from.attachments ?? {}));
|
|
231
232
|
const headMoved = (path) => room.revisions?.[path] !== from.revisions?.[path] ||
|
|
232
233
|
room.fileIds?.[path] !== from.fileIds?.[path] ||
|
|
233
234
|
room.created?.[path] !== from.created?.[path] ||
|
|
@@ -260,7 +261,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
260
261
|
? {}
|
|
261
262
|
: { created: named(room.created, [...taken, ...targets]) }),
|
|
262
263
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
263
|
-
|
|
264
|
+
attachments: named(room.attachments ?? {}, targets),
|
|
264
265
|
...(opening ? foldersMoved(room, from) : {}),
|
|
265
266
|
removals: opening
|
|
266
267
|
? [
|
|
@@ -653,7 +654,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
653
654
|
const room = rooms.find((entry) => entry.locator === request.locator);
|
|
654
655
|
if (room === undefined)
|
|
655
656
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
656
|
-
const blob =
|
|
657
|
+
const blob = heldBytes(room, request.path);
|
|
657
658
|
return blob === undefined
|
|
658
659
|
? { kind: 'rejected', code: 'not_found', fields: {}, retryable: false }
|
|
659
660
|
: { kind: 'binary', body: blob.stream(), mediaType: declaredType(blob) };
|
|
@@ -662,8 +663,8 @@ export function createMemoryAdapter(options = {}) {
|
|
|
662
663
|
async link(_authorization, request) {
|
|
663
664
|
return resolveScript(scripts.link, () => {
|
|
664
665
|
if (request.kind === 'key') {
|
|
665
|
-
const key =
|
|
666
|
-
const named = key ===
|
|
666
|
+
const key = linkedFile(request.link)?.key ?? null;
|
|
667
|
+
const named = key === null ? undefined : keyed.get(key);
|
|
667
668
|
if (named === undefined)
|
|
668
669
|
return UNFOUND;
|
|
669
670
|
return linkTo(rooms.find((entry) => entry.locator === named.locator), named.path);
|
package/dist/messages.d.ts
CHANGED
|
@@ -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 = {
|
package/dist/messages.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAQ1D,eAAO,MA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B,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
|
|
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
|
|
28
|
+
export type ModelState = Extract<StoredModel, {
|
|
30
29
|
status: 'unavailable';
|
|
31
|
-
}> |
|
|
30
|
+
}> | (Extract<StoredModel, {
|
|
32
31
|
status: 'current' | 'cached';
|
|
33
|
-
}
|
|
32
|
+
}> & {
|
|
33
|
+
types: VerifiedModel['types'];
|
|
34
|
+
});
|
|
34
35
|
export type TypesResult<Types = readonly MdType[]> = {
|
|
35
36
|
status: Open<'unavailable'>;
|
|
36
37
|
reason: ModelUnavailableReason;
|
package/dist/model.d.ts.map
CHANGED
|
@@ -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,GAAG,aAAa,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC/F,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,GAAG,SAAS,GAAG,cAAc,CAAC,CAAC;AACvF,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAChC,MAAM,MAAM,
|
|
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,GAAG,aAAa,GAAG;IAAE,MAAM,EAAE,MAAM,GAA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,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AACN,MAAM,MAAM,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
package/dist/name.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../src/name.ts"],"names":[],"mappings":"
|
|
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
|
|
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
|
-
|
|
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
|
|
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 {
|
|
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
|
|
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 =
|
|
14
|
+
export type KeptResult = KeptAttachment | Exclude<AttachmentResult, {
|
|
15
15
|
kind: 'binary';
|
|
16
16
|
}>;
|
|
17
17
|
export type OpenedFiles = {
|
|
18
|
-
find(name: OpenedName): Promise<
|
|
19
|
-
fetch(name: OpenedName, read: () => Promise<
|
|
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
|
package/dist/opened.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opened.d.ts","sourceRoot":"","sources":["../src/opened.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
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 {
|
|
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 =
|
|
30
|
+
const key = attachmentLocalId();
|
|
31
31
|
const reader = body.getReader();
|
|
32
32
|
const hashed = digest();
|
|
33
33
|
const chunks = [];
|
package/dist/opening.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opening.d.ts","sourceRoot":"","sources":["../src/opening.ts"],"names":[],"mappings":"
|
|
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"}
|