@agentshouse/mdruntime-adapter 0.1.0-c6296cfbceb56 → 0.1.0-c658cd7165027
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 +2 -2
- package/dist/actions.d.ts +130 -7
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +41 -148
- package/dist/adapter.d.ts +1 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +283 -171
- package/dist/app-reference.d.ts +2 -0
- package/dist/app-reference.d.ts.map +1 -0
- package/dist/app-reference.js +2 -0
- package/dist/crockford.d.ts +4 -0
- package/dist/crockford.d.ts.map +1 -0
- package/dist/crockford.js +3 -0
- package/dist/discovery.d.ts +7 -10
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +44 -36
- package/dist/gather.d.ts +1 -2
- package/dist/gather.d.ts.map +1 -1
- package/dist/gather.js +5 -15
- package/dist/house-model.d.ts +2938 -0
- package/dist/house-model.d.ts.map +1 -0
- package/dist/house-model.js +1614 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/model.d.ts +5 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +10 -15
- package/dist/part.d.ts +14 -0
- package/dist/part.d.ts.map +1 -0
- package/dist/part.js +90 -0
- package/dist/read.d.ts +66 -18
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +318 -128
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +2 -1
- package/dist/room-stream.d.ts +19 -0
- package/dist/room-stream.d.ts.map +1 -0
- package/dist/room-stream.js +57 -0
- package/dist/room-types.d.ts +7 -0
- package/dist/room-types.d.ts.map +1 -0
- package/dist/room-types.js +126 -0
- package/dist/site.d.ts +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +113 -87
- package/dist/stream.d.ts +2 -4
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +103 -47
- package/dist/transport.d.ts +49 -11
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +2 -1
- package/dist/upload.d.ts +12 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +63 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/write.d.ts +16 -1
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +109 -59
- package/package.json +8 -5
- package/AGENTS.md +0 -318
- package/dist/handed.d.ts +0 -15
- package/dist/handed.d.ts.map +0 -1
- package/dist/handed.js +0 -38
- package/dist/referrer.d.ts +0 -7
- package/dist/referrer.d.ts.map +0 -1
- package/dist/referrer.js +0 -35
package/dist/stream.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ROW_WEIGHT, } from '@agentshouse/mdruntime';
|
|
2
|
+
import { acceptedMessage, cursorPosition } from './actions.js';
|
|
3
|
+
import { answered, answering, binaryFileOf, folded, forgotten, headChange, revised, } from './read.js';
|
|
3
4
|
import { roomVersion } from './version.js';
|
|
4
5
|
const HELD_FRAMES_MAX = 256;
|
|
5
6
|
function turnOperation(frame) {
|
|
@@ -14,6 +15,8 @@ function listedConversation(listed) {
|
|
|
14
15
|
created: listed.created_at,
|
|
15
16
|
finished: listed.finished_at,
|
|
16
17
|
outcome: listed.outcome,
|
|
18
|
+
waiting: listed.waiting,
|
|
19
|
+
newest: listed.newest === null ? null : cursorPosition(listed.newest),
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
22
|
function position(value) {
|
|
@@ -24,6 +27,8 @@ function position(value) {
|
|
|
24
27
|
export function houseNotifications(transport, mode) {
|
|
25
28
|
const stream = transport.stream;
|
|
26
29
|
const lines = new Map();
|
|
30
|
+
const staged = new Map();
|
|
31
|
+
let acknowledging = null;
|
|
27
32
|
const locators = new Map();
|
|
28
33
|
const observers = new Set();
|
|
29
34
|
const conversationObservers = new Set();
|
|
@@ -41,7 +46,10 @@ export function houseNotifications(transport, mode) {
|
|
|
41
46
|
event.kind === 'questions' ||
|
|
42
47
|
event.kind === 'process' ||
|
|
43
48
|
event.kind === 'commands' ||
|
|
44
|
-
event.kind === 'options'
|
|
49
|
+
event.kind === 'options' ||
|
|
50
|
+
event.kind === 'starting' ||
|
|
51
|
+
event.kind === 'link' ||
|
|
52
|
+
event.kind === 'deliveries') {
|
|
45
53
|
live.add(event.conversation);
|
|
46
54
|
}
|
|
47
55
|
for (const observer of conversationObservers)
|
|
@@ -49,6 +57,8 @@ export function houseNotifications(transport, mode) {
|
|
|
49
57
|
}
|
|
50
58
|
function reopened(next) {
|
|
51
59
|
opening = next;
|
|
60
|
+
acknowledging = next;
|
|
61
|
+
staged.clear();
|
|
52
62
|
const gapped = new Set([...replicated, ...live]);
|
|
53
63
|
live.clear();
|
|
54
64
|
for (const conversation of gapped)
|
|
@@ -86,6 +96,18 @@ export function houseNotifications(transport, mode) {
|
|
|
86
96
|
emitConversation({ kind: 'options', conversation, options: structuredClone(frame.options) });
|
|
87
97
|
return;
|
|
88
98
|
}
|
|
99
|
+
if (frame.type === 'starting') {
|
|
100
|
+
emitConversation({ kind: 'starting', conversation, step: frame.step });
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (frame.type === 'link') {
|
|
104
|
+
emitConversation({ kind: 'link', conversation, connected: frame.connected });
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (frame.type === 'deliveries') {
|
|
108
|
+
emitConversation({ kind: 'deliveries', conversation, unknown: [...frame.unknown] });
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
89
111
|
if (frame.type === 'interactions') {
|
|
90
112
|
emitConversation({
|
|
91
113
|
kind: 'questions',
|
|
@@ -110,7 +132,38 @@ export function houseNotifications(transport, mode) {
|
|
|
110
132
|
if (line !== undefined)
|
|
111
133
|
lines.set(authority, { ...line, frames: [] });
|
|
112
134
|
}
|
|
113
|
-
function
|
|
135
|
+
function lost(authority, carry) {
|
|
136
|
+
staged.delete(carry);
|
|
137
|
+
interrupt(authority);
|
|
138
|
+
}
|
|
139
|
+
function stage(frame, via) {
|
|
140
|
+
const held = staged.get(frame.carry);
|
|
141
|
+
if (frame.index !== (held?.parts ?? 0)) {
|
|
142
|
+
lost(frame.authority, frame.carry);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (held === undefined) {
|
|
146
|
+
for (const [carry, other] of staged) {
|
|
147
|
+
if (other.authority === frame.authority)
|
|
148
|
+
staged.delete(carry);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const next = held ?? { authority: frame.authority, parts: 0, entries: [] };
|
|
152
|
+
next.entries.push(...frame.entries);
|
|
153
|
+
next.parts += 1;
|
|
154
|
+
staged.set(frame.carry, next);
|
|
155
|
+
via?.received(frame.authority, frame.carry, frame.index);
|
|
156
|
+
}
|
|
157
|
+
function carried(frame) {
|
|
158
|
+
const held = staged.get(frame.carry);
|
|
159
|
+
staged.delete(frame.carry);
|
|
160
|
+
if ((held?.parts ?? 0) !== frame.parts) {
|
|
161
|
+
interrupt(frame.authority);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
publish(frame, held?.entries ?? []);
|
|
165
|
+
}
|
|
166
|
+
function handle(frame, via) {
|
|
114
167
|
if (frame.type === 'signal') {
|
|
115
168
|
const mode = frame.service_mode;
|
|
116
169
|
if (mode !== 'open' && mode !== 'write-halted')
|
|
@@ -126,6 +179,10 @@ export function houseNotifications(transport, mode) {
|
|
|
126
179
|
});
|
|
127
180
|
return;
|
|
128
181
|
}
|
|
182
|
+
if (frame.type === 'authority_changed') {
|
|
183
|
+
emit({ kind: 'authority-changed', scope: { authorities: frame.rooms } });
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
129
186
|
if (frame.type === 'conversations') {
|
|
130
187
|
emitConversation({ kind: 'list', entries: frame.conversations.map(listedConversation) });
|
|
131
188
|
return;
|
|
@@ -142,13 +199,20 @@ export function houseNotifications(transport, mode) {
|
|
|
142
199
|
frame.type === 'process' ||
|
|
143
200
|
frame.type === 'commands' ||
|
|
144
201
|
frame.type === 'options' ||
|
|
202
|
+
frame.type === 'starting' ||
|
|
203
|
+
frame.type === 'link' ||
|
|
204
|
+
frame.type === 'deliveries' ||
|
|
145
205
|
frame.type === 'interactions' ||
|
|
146
206
|
frame.type === 'message') {
|
|
147
207
|
converse(frame);
|
|
148
208
|
return;
|
|
149
209
|
}
|
|
150
|
-
if (frame.type
|
|
151
|
-
|
|
210
|
+
if (frame.type === 'part')
|
|
211
|
+
stage(frame, via);
|
|
212
|
+
else if (frame.type === 'carried')
|
|
213
|
+
carried(frame);
|
|
214
|
+
}
|
|
215
|
+
function publish(frame, entries) {
|
|
152
216
|
const at = position(frame.position);
|
|
153
217
|
const after = position(frame.after);
|
|
154
218
|
if (at === null || after === null || after >= at) {
|
|
@@ -162,7 +226,7 @@ export function houseNotifications(transport, mode) {
|
|
|
162
226
|
const last = line.frames.at(-1);
|
|
163
227
|
if (last !== undefined && at <= last.position)
|
|
164
228
|
return;
|
|
165
|
-
const held = { after, position: at, entries
|
|
229
|
+
const held = { after, position: at, entries };
|
|
166
230
|
const next = last !== undefined && after <= last.position ? [...line.frames, held] : [held];
|
|
167
231
|
lines.set(frame.authority, { ...line, frames: next.length > HELD_FRAMES_MAX ? [] : next });
|
|
168
232
|
}
|
|
@@ -171,11 +235,13 @@ export function houseNotifications(transport, mode) {
|
|
|
171
235
|
}
|
|
172
236
|
announce(frame.authority, { position: frame.position, logEpoch: frame.log_epoch });
|
|
173
237
|
}
|
|
174
|
-
stream.observe(
|
|
238
|
+
stream.observe((frame) => handle(frame, acknowledging));
|
|
175
239
|
stream.opened(reopened);
|
|
176
|
-
stream.closed((revoked) => {
|
|
240
|
+
stream.closed(({ revoked, lost }) => {
|
|
177
241
|
opening = null;
|
|
178
|
-
|
|
242
|
+
acknowledging = null;
|
|
243
|
+
staged.clear();
|
|
244
|
+
emit({ kind: 'closed', revoked, lost });
|
|
179
245
|
});
|
|
180
246
|
return {
|
|
181
247
|
runtime,
|
|
@@ -239,6 +305,10 @@ export function houseNotifications(transport, mode) {
|
|
|
239
305
|
if (!locators.has(authority))
|
|
240
306
|
lines.delete(authority);
|
|
241
307
|
}
|
|
308
|
+
for (const [carry, held] of staged) {
|
|
309
|
+
if (!locators.has(held.authority))
|
|
310
|
+
staged.delete(carry);
|
|
311
|
+
}
|
|
242
312
|
},
|
|
243
313
|
reach(authority, at) {
|
|
244
314
|
const line = lines.get(authority);
|
|
@@ -253,7 +323,7 @@ export function houseNotifications(transport, mode) {
|
|
|
253
323
|
held,
|
|
254
324
|
});
|
|
255
325
|
},
|
|
256
|
-
advance(tracked, from
|
|
326
|
+
*advance(tracked, from) {
|
|
257
327
|
const line = lines.get(tracked.authority);
|
|
258
328
|
const start = position(from.position);
|
|
259
329
|
if (line === undefined || start === null || line.logEpoch !== from.logEpoch)
|
|
@@ -262,71 +332,57 @@ export function houseNotifications(transport, mode) {
|
|
|
262
332
|
const first = pending[0];
|
|
263
333
|
if (first === undefined || first.after > start)
|
|
264
334
|
return null;
|
|
265
|
-
const
|
|
266
|
-
const revisions = {};
|
|
267
|
-
const changes = {};
|
|
268
|
-
const binaryFiles = {};
|
|
269
|
-
const removals = [];
|
|
270
|
-
const applied = [];
|
|
335
|
+
const answer = answering();
|
|
271
336
|
const schemas = new Map();
|
|
272
|
-
const forget = (path) => {
|
|
273
|
-
delete documents[path];
|
|
274
|
-
delete revisions[path];
|
|
275
|
-
delete changes[path];
|
|
276
|
-
delete binaryFiles[path];
|
|
277
|
-
const removed = removals.indexOf(path);
|
|
278
|
-
if (removed !== -1)
|
|
279
|
-
removals.splice(removed, 1);
|
|
280
|
-
};
|
|
281
337
|
for (const frame of pending) {
|
|
282
338
|
for (const entry of frame.entries) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
forget(entry.path);
|
|
339
|
+
yield ROW_WEIGHT + (entry.text?.length ?? 0);
|
|
340
|
+
if (entry.kind === 'folder') {
|
|
341
|
+
folded(answer, entry.path, entry.removed === true);
|
|
287
342
|
continue;
|
|
288
343
|
}
|
|
289
|
-
|
|
290
|
-
if (tracked.schemas.includes(entry.path))
|
|
344
|
+
if (entry.path === tracked.schema)
|
|
291
345
|
schemas.set(entry.path, entry);
|
|
292
346
|
if (entry.kind === 'removed') {
|
|
293
|
-
|
|
294
|
-
removals.
|
|
347
|
+
forgotten(answer, entry.path);
|
|
348
|
+
answer.removals.add(entry.path);
|
|
295
349
|
continue;
|
|
296
350
|
}
|
|
297
351
|
const binary = binaryFileOf(entry);
|
|
298
|
-
if (binary === null
|
|
352
|
+
if (binary === null)
|
|
299
353
|
return null;
|
|
300
354
|
if (mode === 'credential' && entry.revision === undefined)
|
|
301
355
|
return null;
|
|
302
356
|
const head = headChange(entry);
|
|
303
357
|
if (head === null)
|
|
304
358
|
return null;
|
|
305
|
-
|
|
359
|
+
forgotten(answer, entry.path);
|
|
306
360
|
if (binary === undefined)
|
|
307
|
-
documents
|
|
361
|
+
answer.documents.set(entry.path, entry.text);
|
|
308
362
|
else
|
|
309
|
-
binaryFiles
|
|
363
|
+
answer.binaryFiles.set(entry.path, binary);
|
|
310
364
|
const revision = entry.revision ?? binary?.sha256;
|
|
311
365
|
if (revision !== undefined)
|
|
312
|
-
|
|
366
|
+
revised(answer, entry.path, revision);
|
|
313
367
|
if (head !== undefined)
|
|
314
|
-
changes
|
|
368
|
+
answer.changes.set(entry.path, head);
|
|
315
369
|
}
|
|
316
370
|
}
|
|
317
371
|
const last = pending.at(-1);
|
|
318
|
-
lines.
|
|
372
|
+
const current = lines.get(tracked.authority);
|
|
373
|
+
if (current?.logEpoch === line.logEpoch) {
|
|
374
|
+
lines.set(tracked.authority, {
|
|
375
|
+
...current,
|
|
376
|
+
frames: current.frames.filter((frame) => frame.position > start),
|
|
377
|
+
held: current.held !== null && current.held > last.position ? current.held : last.position,
|
|
378
|
+
});
|
|
379
|
+
}
|
|
319
380
|
return {
|
|
320
381
|
page: {
|
|
321
382
|
kind: 'net-advancement',
|
|
322
383
|
roomVersion: roomVersion({ position: last.position.toString(), logEpoch: line.logEpoch }),
|
|
323
|
-
|
|
324
|
-
revisions,
|
|
325
|
-
changes,
|
|
326
|
-
binaryFiles,
|
|
327
|
-
removals: removals.sort(),
|
|
384
|
+
...(yield* answered(answer)),
|
|
328
385
|
},
|
|
329
|
-
entries: applied,
|
|
330
386
|
schemas,
|
|
331
387
|
};
|
|
332
388
|
},
|
package/dist/transport.d.ts
CHANGED
|
@@ -15,27 +15,27 @@ export type HouseDoorAnswer = {
|
|
|
15
15
|
body: unknown;
|
|
16
16
|
};
|
|
17
17
|
export declare const DOOR_FILES_GET = "/door/files/get";
|
|
18
|
+
export declare const DOOR_FILES_ATTACH = "/door/files/attach";
|
|
19
|
+
export declare const DOOR_FILES_FINISH = "/door/files/finish";
|
|
18
20
|
export declare const SITE_FILES = "/_house/files/";
|
|
19
|
-
export
|
|
20
|
-
export type HouseByteAct = 'authored_batch_upload' | 'conversation_file_upload' | 'binary_stage';
|
|
21
|
-
export type HouseByteBody = string | ArrayBuffer | Uint8Array | Blob;
|
|
21
|
+
export type HouseByteAct = 'authored_batch_upload';
|
|
22
22
|
export type HouseBytesAnswer = {
|
|
23
23
|
status: number;
|
|
24
|
-
|
|
24
|
+
body: ReadableStream<Uint8Array> | null;
|
|
25
|
+
mediaType: string;
|
|
25
26
|
};
|
|
26
27
|
export type HouseByteTransfer = {
|
|
27
28
|
act: HouseByteAct;
|
|
28
29
|
url: string;
|
|
29
|
-
body:
|
|
30
|
-
operation?: string;
|
|
30
|
+
body: string;
|
|
31
31
|
};
|
|
32
32
|
export type HouseStreamEntry = {
|
|
33
33
|
path: string;
|
|
34
|
-
kind: 'edited' | 'removed';
|
|
34
|
+
kind: 'edited' | 'removed' | 'folder';
|
|
35
|
+
removed?: true;
|
|
35
36
|
revision?: string;
|
|
36
37
|
sha256?: string;
|
|
37
38
|
text?: string;
|
|
38
|
-
file?: string;
|
|
39
39
|
bytes?: number;
|
|
40
40
|
media_type?: string;
|
|
41
41
|
author?: {
|
|
@@ -57,17 +57,32 @@ export type HouseListedConversation = {
|
|
|
57
57
|
created_at: string;
|
|
58
58
|
finished_at: string | null;
|
|
59
59
|
outcome: string | null;
|
|
60
|
+
waiting: boolean;
|
|
61
|
+
newest: {
|
|
62
|
+
accepted_at: string;
|
|
63
|
+
message_id: string;
|
|
64
|
+
} | null;
|
|
60
65
|
};
|
|
61
66
|
export type HouseStreamFrame = {
|
|
62
|
-
type: '
|
|
67
|
+
type: 'part';
|
|
63
68
|
authority: string;
|
|
69
|
+
carry: string;
|
|
70
|
+
index: number;
|
|
71
|
+
entries: readonly HouseStreamEntry[];
|
|
72
|
+
} | {
|
|
73
|
+
type: 'carried';
|
|
74
|
+
authority: string;
|
|
75
|
+
carry: string;
|
|
76
|
+
parts: number;
|
|
64
77
|
after: string;
|
|
65
78
|
position: string;
|
|
66
79
|
log_epoch: string;
|
|
67
|
-
entries: readonly HouseStreamEntry[];
|
|
68
80
|
} | {
|
|
69
81
|
type: 'opening';
|
|
70
82
|
expired: readonly string[];
|
|
83
|
+
} | {
|
|
84
|
+
type: 'authority_changed';
|
|
85
|
+
rooms: readonly string[];
|
|
71
86
|
} | ({
|
|
72
87
|
type: 'turn';
|
|
73
88
|
conversation_id: string;
|
|
@@ -80,6 +95,10 @@ export type HouseStreamFrame = {
|
|
|
80
95
|
type: 'interactions';
|
|
81
96
|
conversation_id: string;
|
|
82
97
|
interactions: readonly unknown[];
|
|
98
|
+
} | {
|
|
99
|
+
type: 'deliveries';
|
|
100
|
+
conversation_id: string;
|
|
101
|
+
unknown: readonly string[];
|
|
83
102
|
} | {
|
|
84
103
|
type: 'process';
|
|
85
104
|
conversation_id: string;
|
|
@@ -92,6 +111,14 @@ export type HouseStreamFrame = {
|
|
|
92
111
|
type: 'options';
|
|
93
112
|
conversation_id: string;
|
|
94
113
|
options: LiveFact<'options'>['options'];
|
|
114
|
+
} | {
|
|
115
|
+
type: 'starting';
|
|
116
|
+
conversation_id: string;
|
|
117
|
+
step: string | null;
|
|
118
|
+
} | {
|
|
119
|
+
type: 'link';
|
|
120
|
+
conversation_id: string;
|
|
121
|
+
connected: boolean;
|
|
95
122
|
} | {
|
|
96
123
|
type: 'conversations';
|
|
97
124
|
conversations: readonly HouseListedConversation[];
|
|
@@ -112,24 +139,35 @@ export type HouseHeldRoom = {
|
|
|
112
139
|
};
|
|
113
140
|
export type HouseOpening = {
|
|
114
141
|
hold(rooms: readonly HouseHeldRoom[], runtime: string): void;
|
|
142
|
+
received(authority: string, carry: string, index: number): void;
|
|
115
143
|
close(): void;
|
|
116
144
|
};
|
|
145
|
+
export type HouseClosing = {
|
|
146
|
+
revoked: boolean;
|
|
147
|
+
lost: boolean;
|
|
148
|
+
};
|
|
117
149
|
export type HouseStream = {
|
|
118
150
|
observe(receive: (frame: HouseStreamFrame) => void): () => void;
|
|
119
151
|
opened(notify: (opening: HouseOpening) => void): () => void;
|
|
120
|
-
closed(notify: (
|
|
152
|
+
closed(notify: (closing: HouseClosing) => void): () => void;
|
|
153
|
+
};
|
|
154
|
+
export type HouseStreamed = HouseDoorAnswer & {
|
|
155
|
+
room: ReadableStream<Uint8Array> | null;
|
|
121
156
|
};
|
|
122
157
|
export type HouseDoor = {
|
|
123
158
|
door(route: string, body: unknown): Promise<HouseDoorAnswer>;
|
|
124
159
|
stream: HouseStream;
|
|
125
160
|
};
|
|
126
161
|
export type HouseTransport = HouseDoor & {
|
|
162
|
+
streamed(route: string, body: unknown, signal: AbortSignal): Promise<HouseStreamed>;
|
|
127
163
|
transfer(request: HouseByteTransfer): Promise<HouseDoorAnswer>;
|
|
164
|
+
put(url: string, body: Blob, headers: Readonly<Record<string, string>>): Promise<number>;
|
|
128
165
|
download(url: string): Promise<HouseBytesAnswer>;
|
|
129
166
|
};
|
|
130
167
|
export type HouseSiteTransport = HouseDoor & {
|
|
131
168
|
online(): boolean;
|
|
132
169
|
read(route: string): Promise<HouseDoorAnswer>;
|
|
170
|
+
streamed(route: string, signal: AbortSignal): Promise<HouseStreamed>;
|
|
133
171
|
download(route: string): Promise<HouseBytesAnswer>;
|
|
134
172
|
};
|
|
135
173
|
export {};
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE/E,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,UAAU,gBAAgB,CAAC;AAExC,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE/E,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MA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F,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7D,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACpF,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC/D,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzF,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG;IAC3C,MAAM,IAAI,OAAO,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpD,CAAC"}
|
package/dist/transport.js
CHANGED
|
@@ -9,5 +9,6 @@ export const SITE_DOOR_BOOTSTRAP = '/_house/door/bootstrap/';
|
|
|
9
9
|
export const SITE_DOOR_ENUMERATE = '/_house/door/enumerate';
|
|
10
10
|
export const SITE_DOOR_SUBMIT = '/_house/door/submit';
|
|
11
11
|
export const DOOR_FILES_GET = '/door/files/get';
|
|
12
|
+
export const DOOR_FILES_ATTACH = '/door/files/attach';
|
|
13
|
+
export const DOOR_FILES_FINISH = '/door/files/finish';
|
|
12
14
|
export const SITE_FILES = '/_house/files/';
|
|
13
|
-
export const SITE_FILE_RECORD = 'record';
|
package/dist/upload.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type HouseDoorAnswer, type HouseTransport } from './transport.js';
|
|
2
|
+
export type HouseUpload = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly partBytes: number;
|
|
5
|
+
readonly parts: readonly {
|
|
6
|
+
readonly part: number;
|
|
7
|
+
readonly url: string;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
export declare function houseUpload(value: unknown): HouseUpload | null;
|
|
11
|
+
export declare function finishedUpload(transport: HouseTransport, first: HouseUpload, blob: Blob): Promise<HouseDoorAnswer | null>;
|
|
12
|
+
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE9F,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC5E,CAAC;AAeF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAQ9D;AA8BD,wBAAsB,cAAc,CAClC,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAejC"}
|
package/dist/upload.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { sha256 } from '@agentshouse/mdruntime/digest';
|
|
2
|
+
import { DOOR_FILES_FINISH } from './transport.js';
|
|
3
|
+
const FINISHING_ROUNDS = 24;
|
|
4
|
+
function record(value) {
|
|
5
|
+
return value !== null && typeof value === 'object' ? value : {};
|
|
6
|
+
}
|
|
7
|
+
function part(value) {
|
|
8
|
+
const { part: number, url } = record(value);
|
|
9
|
+
return Number.isSafeInteger(number) && number > 0 && typeof url === 'string'
|
|
10
|
+
? { part: number, url }
|
|
11
|
+
: null;
|
|
12
|
+
}
|
|
13
|
+
export function houseUpload(value) {
|
|
14
|
+
const { id, part_bytes: partBytes, parts = [] } = record(value);
|
|
15
|
+
if (typeof id !== 'string' || !Number.isSafeInteger(partBytes) || partBytes <= 0)
|
|
16
|
+
return null;
|
|
17
|
+
if (!Array.isArray(parts))
|
|
18
|
+
return null;
|
|
19
|
+
const named = parts.map(part);
|
|
20
|
+
if (named.some((one) => one === null))
|
|
21
|
+
return null;
|
|
22
|
+
return { id, partBytes: partBytes, parts: named };
|
|
23
|
+
}
|
|
24
|
+
function checksum(hex) {
|
|
25
|
+
let bytes = '';
|
|
26
|
+
for (let at = 0; at < hex.length; at += 2)
|
|
27
|
+
bytes += String.fromCharCode(Number.parseInt(hex.slice(at, at + 2), 16));
|
|
28
|
+
return { 'x-amz-checksum-sha256': btoa(bytes) };
|
|
29
|
+
}
|
|
30
|
+
async function partSha256(blob, partBytes) {
|
|
31
|
+
const parts = [];
|
|
32
|
+
for (let start = 0; start === 0 || start < blob.size; start += partBytes)
|
|
33
|
+
parts.push(await sha256(blob.slice(start, start + partBytes)));
|
|
34
|
+
return parts;
|
|
35
|
+
}
|
|
36
|
+
async function sent(transport, upload, blob, digests) {
|
|
37
|
+
for (const { part: number, url } of upload.parts) {
|
|
38
|
+
const start = (number - 1) * upload.partBytes;
|
|
39
|
+
const slice = blob.slice(start, start + upload.partBytes);
|
|
40
|
+
if ((await transport.put(url, slice, checksum(digests[number - 1]))) !== 200)
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
export async function finishedUpload(transport, first, blob) {
|
|
46
|
+
const digests = await partSha256(blob, first.partBytes);
|
|
47
|
+
let upload = first;
|
|
48
|
+
for (let round = 0; round < FINISHING_ROUNDS; round += 1) {
|
|
49
|
+
if (!(await sent(transport, upload, blob, digests)))
|
|
50
|
+
return null;
|
|
51
|
+
const answer = await transport.door(DOOR_FILES_FINISH, {
|
|
52
|
+
upload: upload.id,
|
|
53
|
+
part_sha256: digests,
|
|
54
|
+
});
|
|
55
|
+
if (answer.status !== 200)
|
|
56
|
+
return answer;
|
|
57
|
+
const missing = houseUpload(record(answer.body).upload);
|
|
58
|
+
if (missing === null)
|
|
59
|
+
return answer;
|
|
60
|
+
upload = missing;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare function roomVersion(at: LogPosition): string;
|
|
|
11
11
|
export declare function logPosition(version: string): LogPosition | null;
|
|
12
12
|
export declare function readPosition(held: Readonly<Record<string, unknown>>): LogPosition | null;
|
|
13
13
|
export declare function presented(authority: string, at: LogPosition): PresentedPosition;
|
|
14
|
+
export declare const DECIMAL: RegExp;
|
|
14
15
|
export declare function reachedVersion(roomVersion: string, target: string, currentEpoch: string | undefined): boolean;
|
|
15
16
|
export declare function followsVersion(roomVersion: string, next: string): boolean;
|
|
16
17
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAE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M,EACnB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,OAAO,CAQT;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAMzE"}
|
package/dist/version.js
CHANGED
|
@@ -18,7 +18,7 @@ export function readPosition(held) {
|
|
|
18
18
|
export function presented(authority, at) {
|
|
19
19
|
return { authority, position: at.position, log_epoch: at.logEpoch };
|
|
20
20
|
}
|
|
21
|
-
const DECIMAL = /^(?:0|[1-9][0-9]*)$/;
|
|
21
|
+
export const DECIMAL = /^(?:0|[1-9][0-9]*)$/;
|
|
22
22
|
export function reachedVersion(roomVersion, target, currentEpoch) {
|
|
23
23
|
if (roomVersion === target)
|
|
24
24
|
return true;
|
package/dist/write.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export type ChangeMapping = {
|
|
|
10
10
|
rule: string;
|
|
11
11
|
};
|
|
12
12
|
export declare function houseChanges(batch: ChangeBatch, handle: string): ChangeMapping;
|
|
13
|
+
export declare function houseParts(saved: readonly {
|
|
14
|
+
readonly path: string;
|
|
15
|
+
readonly parts: unknown;
|
|
16
|
+
}[], handle: string): ChangeMapping;
|
|
17
|
+
export declare function houseMove(batch: ChangeBatch, source: string, destination: string): ChangeMapping;
|
|
13
18
|
export type OperationHead = {
|
|
14
19
|
readonly operation_id: string;
|
|
15
20
|
readonly app_ref?: string;
|
|
@@ -21,7 +26,17 @@ export declare function deltaBody(changes: readonly HouseOperation[]): string;
|
|
|
21
26
|
export declare function deltaBytes(delta: string): number;
|
|
22
27
|
export declare function uploadable(inline: Readonly<Record<string, unknown>>, bytes: number, bounds: Pick<HouseBounds, 'max_inline_body_bytes' | 'max_upload_bytes'>): boolean;
|
|
23
28
|
export declare function deltaDigest(delta: string): Promise<string>;
|
|
24
|
-
export
|
|
29
|
+
export type MoveAuthorities = {
|
|
30
|
+
readonly source: {
|
|
31
|
+
readonly authority: string;
|
|
32
|
+
readonly handle: string;
|
|
33
|
+
};
|
|
34
|
+
readonly destination: {
|
|
35
|
+
readonly authority: string;
|
|
36
|
+
readonly handle: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare function mutationOutcome(status: number, body: unknown, locator: string, handle: string, move?: MoveAuthorities): Generator<number, MutationResult, void>;
|
|
25
40
|
export declare function rejectedMapping(mapping: Extract<ChangeMapping, {
|
|
26
41
|
kind: 'unmapped';
|
|
27
42
|
}>): {
|
package/dist/write.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAElB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOlD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE/D,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAwHrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAQ9E;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,EAAE,EACpE,MAAM,EAAE,MAAM,GACb,aAAa,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