@agentshouse/mdruntime 0.1.0-c5f333dfa0583 → 0.1.0-c5fe3b2cddda7
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 +10 -8
- package/dist/adapter.d.ts +39 -40
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +2 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +28 -4
- package/dist/binary.d.ts +0 -5
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +1 -1
- package/dist/bootstrap.d.ts +16 -8
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +142 -94
- package/dist/change-set.d.ts +1 -7
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +1 -4
- package/dist/client.d.ts +6 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +54 -7
- package/dist/collection.d.ts +5 -3
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +24 -19
- package/dist/compile.d.ts +6 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +94 -33
- package/dist/connection.d.ts +8 -7
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1160 -1151
- package/dist/conversation.d.ts +7 -5
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +171 -55
- package/dist/durability.d.ts +1 -5
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +1 -0
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +1 -1
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/fulltext.d.ts +27 -0
- package/dist/fulltext.d.ts.map +1 -0
- package/dist/fulltext.js +370 -0
- package/dist/host.d.ts +3 -4
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +42 -18
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +2 -1
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +3 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +93 -38
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +90 -0
- package/dist/model.d.ts +6 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -10
- package/dist/observation.d.ts +1 -0
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +1 -1
- package/dist/outcome.d.ts +13 -6
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +16 -5
- package/dist/overlay.js +1 -1
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +10 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +12 -1
- package/dist/reach.d.ts +8 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +69 -46
- package/dist/readiness.d.ts +14 -15
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +2 -8
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +26 -0
- package/dist/refresh.d.ts +9 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +64 -30
- package/dist/replica.d.ts +5 -5
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +4 -7
- package/dist/room-draft.d.ts +18 -2
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +73 -6
- package/dist/rows.d.ts +15 -6
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +102 -74
- package/dist/save.d.ts +2 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +13 -7
- package/dist/search.d.ts +11 -43
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +0 -296
- package/dist/shared.d.ts +0 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +0 -10
- package/dist/status.d.ts +4 -3
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +23 -58
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +37 -272
- package/dist/stored.d.ts +10 -23
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +217 -218
- package/dist/tables.d.ts +51 -46
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +94 -53
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +35 -96
- package/dist/wire.d.ts +5 -5
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +2 -2
- package/dist/words.d.ts +19 -0
- package/dist/words.d.ts.map +1 -0
- package/dist/words.js +156 -0
- package/package.json +11 -19
- package/AGENTS.md +0 -312
- package/dist/chat/acts.d.ts +0 -33
- package/dist/chat/acts.d.ts.map +0 -1
- package/dist/chat/acts.js +0 -36
- package/dist/chat/context.d.ts +0 -3
- package/dist/chat/context.d.ts.map +0 -1
- package/dist/chat/context.js +0 -10
- package/dist/chat/earlier.d.ts +0 -10
- package/dist/chat/earlier.d.ts.map +0 -1
- package/dist/chat/earlier.js +0 -54
- package/dist/chat/house.d.ts +0 -25
- package/dist/chat/house.d.ts.map +0 -1
- package/dist/chat/house.js +0 -38
- package/dist/chat/input.d.ts +0 -11
- package/dist/chat/input.d.ts.map +0 -1
- package/dist/chat/input.js +0 -92
- package/dist/chat/kit.d.ts +0 -61
- package/dist/chat/kit.d.ts.map +0 -1
- package/dist/chat/kit.js +0 -123
- package/dist/chat/lasting.d.ts +0 -6
- package/dist/chat/lasting.d.ts.map +0 -1
- package/dist/chat/lasting.js +0 -19
- package/dist/chat/list.d.ts +0 -28
- package/dist/chat/list.d.ts.map +0 -1
- package/dist/chat/list.js +0 -103
- package/dist/chat/markdown.d.ts +0 -21
- package/dist/chat/markdown.d.ts.map +0 -1
- package/dist/chat/markdown.js +0 -246
- package/dist/chat/message.d.ts +0 -7
- package/dist/chat/message.d.ts.map +0 -1
- package/dist/chat/message.js +0 -254
- package/dist/chat/messages.d.ts +0 -35
- package/dist/chat/messages.d.ts.map +0 -1
- package/dist/chat/messages.js +0 -210
- package/dist/chat/name.d.ts +0 -7
- package/dist/chat/name.d.ts.map +0 -1
- package/dist/chat/name.js +0 -37
- package/dist/chat/opened.d.ts +0 -12
- package/dist/chat/opened.d.ts.map +0 -1
- package/dist/chat/opened.js +0 -19
- package/dist/chat/overlay.d.ts +0 -32
- package/dist/chat/overlay.d.ts.map +0 -1
- package/dist/chat/overlay.js +0 -103
- package/dist/chat/parts.d.ts +0 -58
- package/dist/chat/parts.d.ts.map +0 -1
- package/dist/chat/parts.js +0 -120
- package/dist/chat/pieces.d.ts +0 -62
- package/dist/chat/pieces.d.ts.map +0 -1
- package/dist/chat/pieces.js +0 -1110
- package/dist/chat/process.d.ts +0 -20
- package/dist/chat/process.d.ts.map +0 -1
- package/dist/chat/process.js +0 -32
- package/dist/chat/provider.d.ts +0 -70
- package/dist/chat/provider.d.ts.map +0 -1
- package/dist/chat/provider.js +0 -635
- package/dist/chat/question.d.ts +0 -9
- package/dist/chat/question.d.ts.map +0 -1
- package/dist/chat/question.js +0 -69
- package/dist/chat/questions.d.ts +0 -31
- package/dist/chat/questions.d.ts.map +0 -1
- package/dist/chat/questions.js +0 -111
- package/dist/chat/read.d.ts +0 -5
- package/dist/chat/read.d.ts.map +0 -1
- package/dist/chat/read.js +0 -13
- package/dist/chat/ready.d.ts +0 -37
- package/dist/chat/ready.d.ts.map +0 -1
- package/dist/chat/ready.js +0 -93
- package/dist/chat/room-file.d.ts +0 -8
- package/dist/chat/room-file.d.ts.map +0 -1
- package/dist/chat/room-file.js +0 -72
- package/dist/chat/steady.d.ts +0 -3
- package/dist/chat/steady.d.ts.map +0 -1
- package/dist/chat/steady.js +0 -26
- package/dist/chat/style.d.ts +0 -4
- package/dist/chat/style.d.ts.map +0 -1
- package/dist/chat/style.js +0 -307
- package/dist/chat.d.ts +0 -15
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -8
- package/dist/reads.d.ts +0 -11
- package/dist/reads.d.ts.map +0 -1
- package/dist/reads.js +0 -98
package/dist/conversation.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ConversationAction, ConversationAgents, ConversationEvent, ConversationMessage, ConversationStream, ProcessCommand, SessionOption, TurnContext } from './adapter.js';
|
|
1
|
+
import type { ConversationAction, ConversationAgents, ConversationEvent, ConversationMessage, ConversationStream, ListedConversation, ProcessCommand, SessionOption, TurnContext } from './adapter.js';
|
|
2
2
|
import { type ChangeSet } from './change-set.js';
|
|
3
|
-
import { type ChosenFile } from './file.js';
|
|
4
3
|
import type { Open } from './open.js';
|
|
5
4
|
import { type CallResult, type Offline } from './outcome.js';
|
|
6
5
|
import type { DocumentResult, PendingResult } from './query.js';
|
|
@@ -65,7 +64,6 @@ export type ConversationSurface = {
|
|
|
65
64
|
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
66
65
|
create(input: unknown): Promise<CallResult>;
|
|
67
66
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
68
|
-
attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
|
|
69
67
|
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
70
68
|
interrupt(conversation: string): Promise<CallResult>;
|
|
71
69
|
kill(conversation: string): Promise<CallResult>;
|
|
@@ -85,6 +83,8 @@ export type ConversationDependencies = {
|
|
|
85
83
|
stream(): ConversationStream | undefined;
|
|
86
84
|
publish(set: ChangeSet): void;
|
|
87
85
|
online(): boolean;
|
|
86
|
+
listed(): boolean;
|
|
87
|
+
full(): boolean;
|
|
88
88
|
closed(): boolean;
|
|
89
89
|
unanswered(): void;
|
|
90
90
|
expired(operation: string): boolean;
|
|
@@ -92,13 +92,14 @@ export type ConversationDependencies = {
|
|
|
92
92
|
export type ConversationStore = {
|
|
93
93
|
surface: ConversationSurface;
|
|
94
94
|
chatDraft: ChatDraftSurface;
|
|
95
|
-
hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[]): void;
|
|
95
|
+
hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[], list: readonly ListedConversation[] | null): void;
|
|
96
96
|
reconcile(): Promise<void>;
|
|
97
97
|
catchUp(progress: CycleProgress): Promise<void>;
|
|
98
98
|
resend(progress: CycleProgress): Promise<void>;
|
|
99
99
|
current(): boolean;
|
|
100
100
|
known(): boolean;
|
|
101
|
-
|
|
101
|
+
learned(): void;
|
|
102
|
+
declared(): void;
|
|
102
103
|
reopened(): void;
|
|
103
104
|
lost(): void;
|
|
104
105
|
watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
@@ -112,6 +113,7 @@ export type ConversationStore = {
|
|
|
112
113
|
};
|
|
113
114
|
export declare function unheldView(conversation: string): ConversationView;
|
|
114
115
|
export declare const SESSION_STARTED = "Session started";
|
|
116
|
+
export declare const HISTORY_CONVERSATIONS = 64;
|
|
115
117
|
export declare function newChat(agent: string): string;
|
|
116
118
|
export declare function createConversationStore(deps: ConversationDependencies): ConversationStore;
|
|
117
119
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAEjB,mBAAmB,EACnB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kB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AAE,gBAAgB,KAAK,IAAI,GACxC,MAAM,IAAI,CAAC;IACd,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAChF,WAAW,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACjF,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC3C,UAAU,IAAI,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;IACxC,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAyCF,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,gBAAgB,CAcjE;AAED,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAIjD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7C;AAoQD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,wBAAwB,GAAG,iBAAiB,CAw+BzF"}
|
package/dist/conversation.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { conversationChangeSet } from './change-set.js';
|
|
2
2
|
import { runtimeError } from './failure.js';
|
|
3
|
-
import {
|
|
3
|
+
import { refusedForSpace } from './durability.js';
|
|
4
4
|
import { changeBatchIdentity, chatDraftRevision } from './identity.js';
|
|
5
5
|
import { OFFLINE } from './outcome.js';
|
|
6
|
+
import { untilAnswered } from './recovery.js';
|
|
6
7
|
import { capped, cursorOf, decodedCursor, FROM_START, messageOrder, precedes } from './windows.js';
|
|
7
8
|
const QUIET = {
|
|
8
9
|
turn: null,
|
|
@@ -40,6 +41,7 @@ export function unheldView(conversation) {
|
|
|
40
41
|
}
|
|
41
42
|
export const SESSION_STARTED = 'Session started';
|
|
42
43
|
const NEW_CHAT = 'new:';
|
|
44
|
+
export const HISTORY_CONVERSATIONS = 64;
|
|
43
45
|
export function newChat(agent) {
|
|
44
46
|
return `${NEW_CHAT}${agent}`;
|
|
45
47
|
}
|
|
@@ -209,6 +211,12 @@ function askedOf(options) {
|
|
|
209
211
|
return { limit: capped(limit), after, before: beforeOf(after), total: total === true };
|
|
210
212
|
}
|
|
211
213
|
const EXPIRED = { kind: 'rejected', code: 'expired', fields: {}, retryable: false };
|
|
214
|
+
const DURABLE_WRITE = {
|
|
215
|
+
kind: 'rejected',
|
|
216
|
+
code: 'durable-write',
|
|
217
|
+
fields: {},
|
|
218
|
+
retryable: true,
|
|
219
|
+
};
|
|
212
220
|
function unwritten(draft) {
|
|
213
221
|
return draft.text === '';
|
|
214
222
|
}
|
|
@@ -250,11 +258,17 @@ export function createConversationStore(deps) {
|
|
|
250
258
|
const listing = new Map();
|
|
251
259
|
const creations = new Set();
|
|
252
260
|
const listWatchers = new Set();
|
|
261
|
+
const unlisted = new Set();
|
|
253
262
|
let listKnown = false;
|
|
263
|
+
let listHeld = false;
|
|
264
|
+
let listKept = false;
|
|
254
265
|
const agentWatchers = new Set();
|
|
266
|
+
const unnamed = new Set();
|
|
267
|
+
let agentsKnown = false;
|
|
255
268
|
let agentNames = new Map();
|
|
256
269
|
let retiredAgents = new Set();
|
|
257
270
|
let agentsRead = null;
|
|
271
|
+
let agentsFrom;
|
|
258
272
|
let replicated = new Set();
|
|
259
273
|
let handedReplicated;
|
|
260
274
|
function liveOf(conversation) {
|
|
@@ -324,9 +338,6 @@ export function createConversationStore(deps) {
|
|
|
324
338
|
}
|
|
325
339
|
}
|
|
326
340
|
}
|
|
327
|
-
function changesOf(conversation, arriving) {
|
|
328
|
-
return arriving.map(({ identity, text }) => ({ conversation, identity, text }));
|
|
329
|
-
}
|
|
330
341
|
function stateOf(conversation) {
|
|
331
342
|
const facts = liveOf(conversation);
|
|
332
343
|
if (facts.questions.length > 0)
|
|
@@ -346,12 +357,53 @@ export function createConversationStore(deps) {
|
|
|
346
357
|
started: lives.get(entry.conversation)?.turn?.started ?? null,
|
|
347
358
|
}));
|
|
348
359
|
}
|
|
360
|
+
function keepList() {
|
|
361
|
+
if (!listKnown || listKept)
|
|
362
|
+
return;
|
|
363
|
+
listKept = true;
|
|
364
|
+
queueMicrotask(() => {
|
|
365
|
+
listKept = false;
|
|
366
|
+
if (deps.closed())
|
|
367
|
+
return;
|
|
368
|
+
const entries = [...listing.values()];
|
|
369
|
+
void deps.durably((local) => local.fact('conversationList', entries)).catch(() => { });
|
|
370
|
+
});
|
|
371
|
+
}
|
|
349
372
|
function emitList() {
|
|
350
|
-
if (deps.closed()
|
|
373
|
+
if (deps.closed())
|
|
351
374
|
return;
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
watcher
|
|
375
|
+
if (listWatchers.size > 0) {
|
|
376
|
+
const value = entries();
|
|
377
|
+
for (const watcher of listWatchers)
|
|
378
|
+
watcher(value);
|
|
379
|
+
}
|
|
380
|
+
learned();
|
|
381
|
+
}
|
|
382
|
+
function unlearnable() {
|
|
383
|
+
return !deps.online() || (deps.listed() && deps.agents() === undefined);
|
|
384
|
+
}
|
|
385
|
+
function learned() {
|
|
386
|
+
if (deps.closed())
|
|
387
|
+
return;
|
|
388
|
+
const named = agentsKnown || unlearnable();
|
|
389
|
+
if (unlisted.size > 0 &&
|
|
390
|
+
named &&
|
|
391
|
+
(listKnown || listHeld || deps.stream() === undefined || unlearnable())) {
|
|
392
|
+
const value = entries();
|
|
393
|
+
for (const watcher of [...unlisted]) {
|
|
394
|
+
unlisted.delete(watcher);
|
|
395
|
+
listWatchers.add(watcher);
|
|
396
|
+
watcher(value);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (unnamed.size > 0 && named) {
|
|
400
|
+
const value = agents();
|
|
401
|
+
for (const watcher of [...unnamed]) {
|
|
402
|
+
unnamed.delete(watcher);
|
|
403
|
+
agentWatchers.add(watcher);
|
|
404
|
+
watcher(value);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
355
407
|
}
|
|
356
408
|
function agents() {
|
|
357
409
|
return [...agentNames]
|
|
@@ -382,6 +434,7 @@ export function createConversationStore(deps) {
|
|
|
382
434
|
}
|
|
383
435
|
async function readAgents() {
|
|
384
436
|
const declaration = deps.agents();
|
|
437
|
+
agentsFrom = JSON.stringify(declaration);
|
|
385
438
|
if (declaration === undefined)
|
|
386
439
|
return;
|
|
387
440
|
const names = new Map();
|
|
@@ -409,14 +462,18 @@ export function createConversationStore(deps) {
|
|
|
409
462
|
break;
|
|
410
463
|
after = read.next;
|
|
411
464
|
}
|
|
465
|
+
agentsKnown = true;
|
|
412
466
|
const named = JSON.stringify([...names]) !== JSON.stringify([...agentNames]);
|
|
413
|
-
if (!named && JSON.stringify([...retired]) === JSON.stringify([...retiredAgents]))
|
|
467
|
+
if (!named && JSON.stringify([...retired]) === JSON.stringify([...retiredAgents])) {
|
|
468
|
+
learned();
|
|
414
469
|
return;
|
|
470
|
+
}
|
|
415
471
|
agentNames = names;
|
|
416
472
|
retiredAgents = retired;
|
|
473
|
+
emitAgents();
|
|
417
474
|
if (named)
|
|
418
475
|
emitList();
|
|
419
|
-
|
|
476
|
+
learned();
|
|
420
477
|
const ended = [...drafts.keys()].filter(retiredChat);
|
|
421
478
|
if (ended.length > 0)
|
|
422
479
|
await remove(ended);
|
|
@@ -485,12 +542,6 @@ export function createConversationStore(deps) {
|
|
|
485
542
|
}
|
|
486
543
|
async function remove(leaving) {
|
|
487
544
|
await deps.durably(async (local) => {
|
|
488
|
-
const removed = [];
|
|
489
|
-
for (const conversation of leaving) {
|
|
490
|
-
for (const identity of await local.messageIdentities(conversation)) {
|
|
491
|
-
removed.push({ conversation, identity, text: null });
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
545
|
await local.dropConversations(leaving);
|
|
495
546
|
const changed = [];
|
|
496
547
|
for (const conversation of leaving) {
|
|
@@ -507,9 +558,23 @@ export function createConversationStore(deps) {
|
|
|
507
558
|
await slide(local, conversation, null);
|
|
508
559
|
}
|
|
509
560
|
if (changed.length > 0)
|
|
510
|
-
deps.publish(conversationChangeSet(
|
|
561
|
+
deps.publish(conversationChangeSet(changed));
|
|
511
562
|
});
|
|
512
563
|
}
|
|
564
|
+
function missed(conversation) {
|
|
565
|
+
const read = reads.get(conversation);
|
|
566
|
+
const newest = listing.get(conversation)?.newest;
|
|
567
|
+
return (read === undefined ||
|
|
568
|
+
newest === undefined ||
|
|
569
|
+
partials.has(conversation) ||
|
|
570
|
+
(newest !== null && (read === null || newest > read)));
|
|
571
|
+
}
|
|
572
|
+
function noted(conversation, message) {
|
|
573
|
+
const entry = listing.get(conversation);
|
|
574
|
+
if (entry === undefined || (entry.newest !== null && entry.newest >= message.position))
|
|
575
|
+
return;
|
|
576
|
+
listing.set(conversation, { ...entry, newest: message.position });
|
|
577
|
+
}
|
|
513
578
|
function gap(conversation) {
|
|
514
579
|
gaps.set(conversation, (gaps.get(conversation) ?? 0) + 1);
|
|
515
580
|
behind.add(conversation);
|
|
@@ -533,16 +598,17 @@ export function createConversationStore(deps) {
|
|
|
533
598
|
reads.set(conversation, message.position);
|
|
534
599
|
sealTurns(conversation, new Set([message.turn]));
|
|
535
600
|
await slide(local, conversation, [message]);
|
|
536
|
-
deps.publish(conversationChangeSet(
|
|
601
|
+
deps.publish(conversationChangeSet([conversation]));
|
|
537
602
|
});
|
|
538
603
|
}
|
|
539
604
|
async function readHistories(conversations, ended) {
|
|
540
605
|
const generations = new Map(conversations.map((one) => [one, gaps.get(one) ?? 0]));
|
|
541
|
-
let
|
|
606
|
+
let waiting = conversations.map((conversation) => ({
|
|
542
607
|
conversation,
|
|
543
608
|
after: reads.get(conversation) ?? undefined,
|
|
544
609
|
}));
|
|
545
|
-
while (
|
|
610
|
+
while (waiting.length > 0) {
|
|
611
|
+
const asking = waiting.slice(0, HISTORY_CONVERSATIONS);
|
|
546
612
|
const result = await deps.call('conversation.history', {
|
|
547
613
|
conversations: asking.map(({ conversation, after }) => ({
|
|
548
614
|
conversation,
|
|
@@ -566,7 +632,7 @@ export function createConversationStore(deps) {
|
|
|
566
632
|
if (!following.some((next) => next.conversation === conversation))
|
|
567
633
|
ended(conversation);
|
|
568
634
|
}
|
|
569
|
-
|
|
635
|
+
waiting = [...waiting.slice(HISTORY_CONVERSATIONS), ...following];
|
|
570
636
|
}
|
|
571
637
|
return null;
|
|
572
638
|
}
|
|
@@ -609,7 +675,7 @@ export function createConversationStore(deps) {
|
|
|
609
675
|
behind.delete(conversation);
|
|
610
676
|
await slide(local, conversation, arriving);
|
|
611
677
|
if (arriving.length > 0 || sealing || whole) {
|
|
612
|
-
deps.publish(conversationChangeSet(
|
|
678
|
+
deps.publish(conversationChangeSet([conversation]));
|
|
613
679
|
}
|
|
614
680
|
});
|
|
615
681
|
}
|
|
@@ -657,8 +723,16 @@ export function createConversationStore(deps) {
|
|
|
657
723
|
const arriving = acceptedMessage(event.message);
|
|
658
724
|
if (arriving === null)
|
|
659
725
|
return;
|
|
726
|
+
noted(conversation, arriving);
|
|
660
727
|
if (replicated.has(conversation)) {
|
|
661
|
-
|
|
728
|
+
if (deps.full()) {
|
|
729
|
+
gap(conversation);
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
void keep(conversation, arriving).catch((error) => {
|
|
733
|
+
if (refusedForSpace(error))
|
|
734
|
+
gap(conversation);
|
|
735
|
+
});
|
|
662
736
|
return;
|
|
663
737
|
}
|
|
664
738
|
if (sealTurns(conversation, new Set([arriving.turn])))
|
|
@@ -702,7 +776,7 @@ export function createConversationStore(deps) {
|
|
|
702
776
|
drafts.set(from, left);
|
|
703
777
|
for (const one of taken)
|
|
704
778
|
drafts.set(to, one);
|
|
705
|
-
deps.publish(conversationChangeSet([
|
|
779
|
+
deps.publish(conversationChangeSet([from, to]));
|
|
706
780
|
});
|
|
707
781
|
}
|
|
708
782
|
function withDraft(conversation, next) {
|
|
@@ -711,7 +785,7 @@ export function createConversationStore(deps) {
|
|
|
711
785
|
if (following === undefined)
|
|
712
786
|
return;
|
|
713
787
|
await kept(local, conversation, following);
|
|
714
|
-
deps.publish(conversationChangeSet([
|
|
788
|
+
deps.publish(conversationChangeSet([conversation]));
|
|
715
789
|
});
|
|
716
790
|
}
|
|
717
791
|
async function submitted(conversation, operation, draft) {
|
|
@@ -743,13 +817,14 @@ export function createConversationStore(deps) {
|
|
|
743
817
|
});
|
|
744
818
|
}
|
|
745
819
|
async function dispatched(conversation, submission) {
|
|
746
|
-
const dispatch = {};
|
|
820
|
+
const dispatch = { answered: false };
|
|
747
821
|
sending.set(submission.operation, dispatch);
|
|
748
822
|
try {
|
|
749
823
|
const result = await invoke('conversation.send', conversation, {
|
|
750
824
|
text: submission.text,
|
|
751
825
|
operation_id: submission.operation,
|
|
752
826
|
});
|
|
827
|
+
dispatch.answered = result.kind !== 'transport-uncertainty';
|
|
753
828
|
if (result.kind === 'revoked-authorization')
|
|
754
829
|
return result;
|
|
755
830
|
if (result.kind !== 'action' && result.retryable) {
|
|
@@ -782,7 +857,15 @@ export function createConversationStore(deps) {
|
|
|
782
857
|
const surface = {
|
|
783
858
|
async list() {
|
|
784
859
|
await agentsReady();
|
|
785
|
-
return
|
|
860
|
+
return new Promise((settle) => {
|
|
861
|
+
const answer = (listed) => {
|
|
862
|
+
unlisted.delete(answer);
|
|
863
|
+
listWatchers.delete(answer);
|
|
864
|
+
settle(listed);
|
|
865
|
+
};
|
|
866
|
+
unlisted.add(answer);
|
|
867
|
+
learned();
|
|
868
|
+
});
|
|
786
869
|
},
|
|
787
870
|
async read(conversation, options = {}) {
|
|
788
871
|
const asked = askedOf(options);
|
|
@@ -805,8 +888,17 @@ export function createConversationStore(deps) {
|
|
|
805
888
|
return result;
|
|
806
889
|
},
|
|
807
890
|
async send(conversation, operation = changeBatchIdentity(), draft) {
|
|
891
|
+
if (deps.full())
|
|
892
|
+
return DURABLE_WRITE;
|
|
808
893
|
if (deps.online()) {
|
|
809
|
-
const
|
|
894
|
+
const held = await submitted(conversation, operation, draft).catch((error) => {
|
|
895
|
+
if (refusedForSpace(error))
|
|
896
|
+
return null;
|
|
897
|
+
throw error;
|
|
898
|
+
});
|
|
899
|
+
if (held === null)
|
|
900
|
+
return DURABLE_WRITE;
|
|
901
|
+
const { submission, earlier } = held;
|
|
810
902
|
if (!earlier || !deps.expired(operation))
|
|
811
903
|
return dispatched(conversation, submission);
|
|
812
904
|
await forgotten(conversation, submission);
|
|
@@ -819,15 +911,6 @@ export function createConversationStore(deps) {
|
|
|
819
911
|
}
|
|
820
912
|
return OFFLINE;
|
|
821
913
|
},
|
|
822
|
-
async attach(room, file) {
|
|
823
|
-
if (!deps.online())
|
|
824
|
-
return OFFLINE;
|
|
825
|
-
return deps.call('conversation.attach', {
|
|
826
|
-
room,
|
|
827
|
-
...(await declaredFile(file)),
|
|
828
|
-
blob: file.blob,
|
|
829
|
-
});
|
|
830
|
-
},
|
|
831
914
|
answer(conversation, answer) {
|
|
832
915
|
return invoke('conversation.answer', conversation, { answer });
|
|
833
916
|
},
|
|
@@ -879,7 +962,13 @@ export function createConversationStore(deps) {
|
|
|
879
962
|
return {
|
|
880
963
|
surface,
|
|
881
964
|
chatDraft,
|
|
882
|
-
hydrate(held, kept) {
|
|
965
|
+
hydrate(held, kept, list) {
|
|
966
|
+
if (list !== null && !listKnown) {
|
|
967
|
+
listing.clear();
|
|
968
|
+
for (const entry of list)
|
|
969
|
+
listing.set(entry.conversation, { ...entry });
|
|
970
|
+
listHeld = true;
|
|
971
|
+
}
|
|
883
972
|
stored.clear();
|
|
884
973
|
reads.clear();
|
|
885
974
|
partials.clear();
|
|
@@ -893,6 +982,8 @@ export function createConversationStore(deps) {
|
|
|
893
982
|
drafts.clear();
|
|
894
983
|
for (const record of kept)
|
|
895
984
|
drafts.set(record.conversation, record);
|
|
985
|
+
if (listHeld)
|
|
986
|
+
learned();
|
|
896
987
|
},
|
|
897
988
|
async reconcile() {
|
|
898
989
|
if (!listKnown)
|
|
@@ -904,7 +995,7 @@ export function createConversationStore(deps) {
|
|
|
904
995
|
!creations.has(conversation) &&
|
|
905
996
|
(!conversation.startsWith(NEW_CHAT) || retiredChat(conversation)));
|
|
906
997
|
for (const conversation of named) {
|
|
907
|
-
if (!replicated.has(conversation))
|
|
998
|
+
if (!replicated.has(conversation) && missed(conversation))
|
|
908
999
|
behind.add(conversation);
|
|
909
1000
|
}
|
|
910
1001
|
replicated = named;
|
|
@@ -913,6 +1004,11 @@ export function createConversationStore(deps) {
|
|
|
913
1004
|
await remove(leaving);
|
|
914
1005
|
},
|
|
915
1006
|
async catchUp(progress) {
|
|
1007
|
+
if (deps.full()) {
|
|
1008
|
+
if (behind.size > 0)
|
|
1009
|
+
progress.complete = false;
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
916
1012
|
const owed = (conversation) => behind.has(conversation) && replicated.has(conversation);
|
|
917
1013
|
const read = async (conversations) => {
|
|
918
1014
|
if (conversations.length === 0 || deps.closed())
|
|
@@ -961,12 +1057,10 @@ export function createConversationStore(deps) {
|
|
|
961
1057
|
known() {
|
|
962
1058
|
return listKnown;
|
|
963
1059
|
},
|
|
964
|
-
reconnected() {
|
|
965
|
-
for (const conversation of replicated)
|
|
966
|
-
gap(conversation);
|
|
967
|
-
},
|
|
968
1060
|
reopened() {
|
|
969
|
-
sending
|
|
1061
|
+
for (const [operation, dispatch] of sending)
|
|
1062
|
+
if (!dispatch.answered)
|
|
1063
|
+
sending.delete(operation);
|
|
970
1064
|
},
|
|
971
1065
|
lost() {
|
|
972
1066
|
catching.clear();
|
|
@@ -985,15 +1079,15 @@ export function createConversationStore(deps) {
|
|
|
985
1079
|
views.set(key, view);
|
|
986
1080
|
const watcher = { notify: deliver, ready: false };
|
|
987
1081
|
view.watchers.add(watcher);
|
|
988
|
-
|
|
989
|
-
|
|
1082
|
+
const reading = new AbortController();
|
|
1083
|
+
void untilAnswered(() => deps.durably(async (local) => {
|
|
990
1084
|
if (view.window !== null)
|
|
991
1085
|
return;
|
|
992
1086
|
const { messages, more } = await local.messageWindow(conversation, asked.limit, asked.before);
|
|
993
1087
|
view.window = messages;
|
|
994
1088
|
view.more = more;
|
|
995
1089
|
view.total = asked.total ? await local.messageCount(conversation) : null;
|
|
996
|
-
})
|
|
1090
|
+
}), reading.signal)
|
|
997
1091
|
.then(() => {
|
|
998
1092
|
if (deps.closed() || !view.watchers.has(watcher))
|
|
999
1093
|
return;
|
|
@@ -1003,6 +1097,7 @@ export function createConversationStore(deps) {
|
|
|
1003
1097
|
})
|
|
1004
1098
|
.catch(() => { });
|
|
1005
1099
|
return () => {
|
|
1100
|
+
reading.abort();
|
|
1006
1101
|
if (!view.watchers.delete(watcher))
|
|
1007
1102
|
return;
|
|
1008
1103
|
if (view.watchers.size === 0)
|
|
@@ -1010,25 +1105,35 @@ export function createConversationStore(deps) {
|
|
|
1010
1105
|
};
|
|
1011
1106
|
},
|
|
1012
1107
|
watchList(deliver) {
|
|
1013
|
-
|
|
1108
|
+
let ended = false;
|
|
1014
1109
|
void agentsReady().then(() => {
|
|
1015
|
-
if (
|
|
1016
|
-
|
|
1110
|
+
if (ended)
|
|
1111
|
+
return;
|
|
1112
|
+
unlisted.add(deliver);
|
|
1113
|
+
learned();
|
|
1017
1114
|
});
|
|
1018
1115
|
return () => {
|
|
1116
|
+
ended = true;
|
|
1117
|
+
unlisted.delete(deliver);
|
|
1019
1118
|
listWatchers.delete(deliver);
|
|
1020
1119
|
};
|
|
1021
1120
|
},
|
|
1022
1121
|
watchAgents(deliver) {
|
|
1023
|
-
|
|
1024
|
-
void agentsReady().then(
|
|
1025
|
-
if (!deps.closed() && agentWatchers.has(deliver))
|
|
1026
|
-
deliver(agents());
|
|
1027
|
-
});
|
|
1122
|
+
unnamed.add(deliver);
|
|
1123
|
+
void agentsReady().then(learned);
|
|
1028
1124
|
return () => {
|
|
1125
|
+
unnamed.delete(deliver);
|
|
1029
1126
|
agentWatchers.delete(deliver);
|
|
1030
1127
|
};
|
|
1031
1128
|
},
|
|
1129
|
+
learned,
|
|
1130
|
+
declared() {
|
|
1131
|
+
if (JSON.stringify(deps.agents()) === agentsFrom)
|
|
1132
|
+
return;
|
|
1133
|
+
agentsRead = readAgents().catch(() => {
|
|
1134
|
+
agentsRead = null;
|
|
1135
|
+
});
|
|
1136
|
+
},
|
|
1032
1137
|
changed(set) {
|
|
1033
1138
|
for (const conversation of set.conversations)
|
|
1034
1139
|
emit(conversation);
|
|
@@ -1051,6 +1156,14 @@ export function createConversationStore(deps) {
|
|
|
1051
1156
|
creations.delete(entry.conversation);
|
|
1052
1157
|
}
|
|
1053
1158
|
listKnown = true;
|
|
1159
|
+
for (const conversation of replicated) {
|
|
1160
|
+
if (!listing.has(conversation))
|
|
1161
|
+
continue;
|
|
1162
|
+
if (!missed(conversation))
|
|
1163
|
+
behind.delete(conversation);
|
|
1164
|
+
else if (!behind.has(conversation))
|
|
1165
|
+
gap(conversation);
|
|
1166
|
+
}
|
|
1054
1167
|
openingEnded();
|
|
1055
1168
|
}
|
|
1056
1169
|
else if (event.kind === 'listed') {
|
|
@@ -1060,6 +1173,7 @@ export function createConversationStore(deps) {
|
|
|
1060
1173
|
else {
|
|
1061
1174
|
listing.delete(event.conversation);
|
|
1062
1175
|
}
|
|
1176
|
+
keepList();
|
|
1063
1177
|
emitList();
|
|
1064
1178
|
return (event.kind !== 'list' &&
|
|
1065
1179
|
listKnown &&
|
|
@@ -1080,7 +1194,9 @@ export function createConversationStore(deps) {
|
|
|
1080
1194
|
lives.clear();
|
|
1081
1195
|
unsent.clear();
|
|
1082
1196
|
listWatchers.clear();
|
|
1197
|
+
unlisted.clear();
|
|
1083
1198
|
agentWatchers.clear();
|
|
1199
|
+
unnamed.clear();
|
|
1084
1200
|
},
|
|
1085
1201
|
};
|
|
1086
1202
|
}
|
package/dist/durability.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import type { Persistence } from './readiness.js';
|
|
2
|
-
export type StorageEstimate = {
|
|
3
|
-
readonly usage: number;
|
|
4
|
-
readonly total: number;
|
|
5
|
-
};
|
|
6
2
|
export type RuntimeShell = {
|
|
7
3
|
persistence: Persistence;
|
|
8
4
|
generation: string | null;
|
|
9
5
|
keepGeneration(value: string): void | Promise<void>;
|
|
10
6
|
dropGeneration(): void | Promise<void>;
|
|
11
|
-
estimate?(): Promise<StorageEstimate | null>;
|
|
12
7
|
cleanUp?(): Promise<number>;
|
|
13
8
|
};
|
|
9
|
+
export declare function refusedForSpace(error: unknown): boolean;
|
|
14
10
|
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
|
15
11
|
export declare function nextGeneration(stored: string | null, reported: string | null): string;
|
|
16
12
|
//# sourceMappingURL=durability.d.ts.map
|
package/dist/durability.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["../src/durability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["../src/durability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMvD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAG/F;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGrF"}
|
package/dist/durability.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
const STORAGE_LOSS_CODE = 'storage-loss';
|
|
2
|
+
export function refusedForSpace(error) {
|
|
3
|
+
return (typeof error === 'object' &&
|
|
4
|
+
error !== null &&
|
|
5
|
+
error.name === 'QuotaExceededError');
|
|
6
|
+
}
|
|
2
7
|
export function detectStorageLoss(stored, reported) {
|
|
3
8
|
if (reported === null || reported === stored)
|
|
4
9
|
return null;
|
package/dist/entry.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type EntryRoom = {
|
|
|
6
6
|
locator: string;
|
|
7
7
|
schema: string | null;
|
|
8
8
|
documents: Readonly<Record<string, string>>;
|
|
9
|
+
revisions?: Readonly<Record<string, string>>;
|
|
9
10
|
};
|
|
10
11
|
export type EntryArguments = Readonly<Record<string, string>>;
|
|
11
12
|
export type EntryParameterKind = 'string' | 'integer' | 'number' | 'boolean';
|
package/dist/entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK1D,OAAO,EAML,KAAK,SAAS,EAEf,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,QAAQ,CAAC,MAAM,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EF,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,UAAU,GACrB,UAAU,CAmDZ"}
|
package/dist/entry.js
CHANGED
package/dist/file.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
blob: Blob;
|
|
4
|
-
};
|
|
5
|
-
export type FileDeclaration = {
|
|
6
|
-
name: string;
|
|
7
|
-
mediaType: string;
|
|
8
|
-
byteLength: number;
|
|
9
|
-
contentHash: string;
|
|
10
|
-
};
|
|
11
|
-
export declare function declaredFile(file: ChosenFile): Promise<FileDeclaration>;
|
|
1
|
+
import type { AttachRequest } from './adapter.js';
|
|
2
|
+
export declare function attachedFile(locator: string, file: File): Promise<AttachRequest>;
|
|
12
3
|
//# sourceMappingURL=file.d.ts.map
|
package/dist/file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,CAStF"}
|
package/dist/file.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { sha256 } from './digest.js';
|
|
2
|
-
export async function
|
|
2
|
+
export async function attachedFile(locator, file) {
|
|
3
3
|
return {
|
|
4
|
+
locator,
|
|
4
5
|
name: file.name,
|
|
5
|
-
mediaType: file.
|
|
6
|
-
byteLength: file.
|
|
7
|
-
|
|
6
|
+
mediaType: file.type,
|
|
7
|
+
byteLength: file.size,
|
|
8
|
+
sha256: await sha256(file),
|
|
9
|
+
blob: file,
|
|
8
10
|
};
|
|
9
11
|
}
|