@agentshouse/mdruntime-adapter 0.1.0-cd59fd8945dcb → 0.1.0-cda5b3be3317e
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/AGENTS.md +271 -262
- package/dist/actions.d.ts +23 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +68 -31
- package/dist/adapter.d.ts +1 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +261 -64
- package/dist/discovery.d.ts +2 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +10 -6
- package/dist/handed.d.ts +15 -0
- package/dist/handed.d.ts.map +1 -0
- package/dist/handed.js +38 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/model.d.ts +0 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -3
- package/dist/read.d.ts +29 -6
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +150 -52
- package/dist/referrer.d.ts +7 -0
- package/dist/referrer.d.ts.map +1 -0
- package/dist/referrer.js +35 -0
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +2 -1
- package/dist/site.d.ts +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +174 -47
- package/dist/stream.d.ts +3 -2
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +325 -16
- package/dist/transport.d.ts +62 -6
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +3 -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 +2 -9
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +61 -8
- package/package.json +2 -3
- package/dist/links.d.ts +0 -20
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js +0 -104
package/dist/stream.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { acceptedMessage } from './actions.js';
|
|
2
|
-
import {
|
|
2
|
+
import { sha256Hex } from './digest.js';
|
|
3
|
+
import { binaryFileOf, headChange, identities } from './read.js';
|
|
3
4
|
import { roomVersion } from './version.js';
|
|
4
5
|
const HELD_FRAMES_MAX = 256;
|
|
5
6
|
function turnOperation(frame) {
|
|
@@ -21,9 +22,78 @@ function position(value) {
|
|
|
21
22
|
return null;
|
|
22
23
|
return BigInt(value);
|
|
23
24
|
}
|
|
25
|
+
function assembled(entries) {
|
|
26
|
+
const whole = [];
|
|
27
|
+
let open = null;
|
|
28
|
+
for (const entry of entries) {
|
|
29
|
+
if (entry.kind === 'piece') {
|
|
30
|
+
if (open === null || open.entry.path !== entry.path || entry.text === undefined)
|
|
31
|
+
return null;
|
|
32
|
+
open.texts.push(entry.text);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
if (open !== null)
|
|
36
|
+
return null;
|
|
37
|
+
if (entry.continued !== true) {
|
|
38
|
+
whole.push(entry);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (entry.text === undefined)
|
|
42
|
+
return null;
|
|
43
|
+
open = { entry, texts: [entry.text] };
|
|
44
|
+
}
|
|
45
|
+
if (entry.continued === true)
|
|
46
|
+
continue;
|
|
47
|
+
const { continued: _continued, ...head } = open.entry;
|
|
48
|
+
whole.push({ ...head, text: open.texts.join('') });
|
|
49
|
+
open = null;
|
|
50
|
+
}
|
|
51
|
+
return open === null ? whole : null;
|
|
52
|
+
}
|
|
53
|
+
async function verified(entries) {
|
|
54
|
+
try {
|
|
55
|
+
for (const entry of entries) {
|
|
56
|
+
if (entry.text === undefined || entry.sha256 === undefined)
|
|
57
|
+
continue;
|
|
58
|
+
if ((await sha256Hex(entry.text)) !== entry.sha256)
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function resumed(kept, frame) {
|
|
68
|
+
const last = frame.entries.at(-1);
|
|
69
|
+
const point = { parts: frame.index + 1, from: frame.from, target: frame.target };
|
|
70
|
+
if (last?.continued !== true)
|
|
71
|
+
return { ...point, handled: frame.handled, piece: null };
|
|
72
|
+
const text = last.text?.length ?? 0;
|
|
73
|
+
if (last.kind !== 'piece') {
|
|
74
|
+
return last.sha256 === undefined
|
|
75
|
+
? kept.resume
|
|
76
|
+
: { ...point, handled: frame.handled, piece: { sha256: last.sha256, offset: text } };
|
|
77
|
+
}
|
|
78
|
+
const piece = kept.resume?.piece ?? null;
|
|
79
|
+
if (piece === null)
|
|
80
|
+
return kept.resume;
|
|
81
|
+
const pieces = frame.entries.reduce((sum, entry) => sum + (entry.kind === 'piece' ? (entry.text?.length ?? 0) : 0), 0);
|
|
82
|
+
return {
|
|
83
|
+
...point,
|
|
84
|
+
handled: frame.handled,
|
|
85
|
+
piece: { sha256: piece.sha256, offset: piece.offset + pieces },
|
|
86
|
+
};
|
|
87
|
+
}
|
|
24
88
|
export function houseNotifications(transport, mode) {
|
|
25
89
|
const stream = transport.stream;
|
|
26
90
|
const lines = new Map();
|
|
91
|
+
const kept = new Map();
|
|
92
|
+
let receipts = null;
|
|
93
|
+
let loaded = Promise.resolve();
|
|
94
|
+
let acknowledging = null;
|
|
95
|
+
let receiving = Promise.resolve();
|
|
96
|
+
let verifying = 0;
|
|
27
97
|
const locators = new Map();
|
|
28
98
|
const observers = new Set();
|
|
29
99
|
const conversationObservers = new Set();
|
|
@@ -41,7 +111,10 @@ export function houseNotifications(transport, mode) {
|
|
|
41
111
|
event.kind === 'questions' ||
|
|
42
112
|
event.kind === 'process' ||
|
|
43
113
|
event.kind === 'commands' ||
|
|
44
|
-
event.kind === 'options'
|
|
114
|
+
event.kind === 'options' ||
|
|
115
|
+
event.kind === 'starting' ||
|
|
116
|
+
event.kind === 'link' ||
|
|
117
|
+
event.kind === 'deliveries') {
|
|
45
118
|
live.add(event.conversation);
|
|
46
119
|
}
|
|
47
120
|
for (const observer of conversationObservers)
|
|
@@ -49,6 +122,7 @@ export function houseNotifications(transport, mode) {
|
|
|
49
122
|
}
|
|
50
123
|
function reopened(next) {
|
|
51
124
|
opening = next;
|
|
125
|
+
acknowledging = next;
|
|
52
126
|
const gapped = new Set([...replicated, ...live]);
|
|
53
127
|
live.clear();
|
|
54
128
|
for (const conversation of gapped)
|
|
@@ -86,6 +160,18 @@ export function houseNotifications(transport, mode) {
|
|
|
86
160
|
emitConversation({ kind: 'options', conversation, options: structuredClone(frame.options) });
|
|
87
161
|
return;
|
|
88
162
|
}
|
|
163
|
+
if (frame.type === 'starting') {
|
|
164
|
+
emitConversation({ kind: 'starting', conversation, step: frame.step });
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (frame.type === 'link') {
|
|
168
|
+
emitConversation({ kind: 'link', conversation, connected: frame.connected });
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (frame.type === 'deliveries') {
|
|
172
|
+
emitConversation({ kind: 'deliveries', conversation, unknown: [...frame.unknown] });
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
89
175
|
if (frame.type === 'interactions') {
|
|
90
176
|
emitConversation({
|
|
91
177
|
kind: 'questions',
|
|
@@ -110,7 +196,162 @@ export function houseNotifications(transport, mode) {
|
|
|
110
196
|
if (line !== undefined)
|
|
111
197
|
lines.set(authority, { ...line, frames: [] });
|
|
112
198
|
}
|
|
113
|
-
function
|
|
199
|
+
async function forget(carries) {
|
|
200
|
+
const held = carries.filter((carry) => kept.delete(carry));
|
|
201
|
+
if (held.length > 0)
|
|
202
|
+
await receipts?.drop(held).catch(() => { });
|
|
203
|
+
}
|
|
204
|
+
async function lost(authority, carry) {
|
|
205
|
+
interrupt(authority);
|
|
206
|
+
await forget([carry]);
|
|
207
|
+
}
|
|
208
|
+
async function stage(frame, via) {
|
|
209
|
+
await loaded;
|
|
210
|
+
const port = receipts;
|
|
211
|
+
if (port === null)
|
|
212
|
+
return;
|
|
213
|
+
const held = kept.get(frame.carry);
|
|
214
|
+
if (held === undefined && frame.index !== 0) {
|
|
215
|
+
interrupt(frame.authority);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (held !== undefined &&
|
|
219
|
+
(held.fenced !== null || frame.index > held.parts || frame.index < (held.resume?.parts ?? 0))) {
|
|
220
|
+
await lost(frame.authority, frame.carry);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (held === undefined) {
|
|
224
|
+
await forget([...kept.values()]
|
|
225
|
+
.filter((other) => other.authority === frame.authority && other.fenced === null)
|
|
226
|
+
.map((other) => other.carry));
|
|
227
|
+
}
|
|
228
|
+
const start = held ?? {
|
|
229
|
+
authority: frame.authority,
|
|
230
|
+
carry: frame.carry,
|
|
231
|
+
logEpoch: lines.get(frame.authority)?.logEpoch ?? null,
|
|
232
|
+
after: frame.after,
|
|
233
|
+
parts: 0,
|
|
234
|
+
resume: null,
|
|
235
|
+
fenced: null,
|
|
236
|
+
};
|
|
237
|
+
const next = { ...start, parts: frame.index + 1, resume: resumed(start, frame) };
|
|
238
|
+
const part = { entries: frame.entries };
|
|
239
|
+
try {
|
|
240
|
+
await port.keep(frame.carry, next, { index: frame.index, value: part });
|
|
241
|
+
}
|
|
242
|
+
catch {
|
|
243
|
+
await lost(frame.authority, frame.carry);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
kept.set(frame.carry, next);
|
|
247
|
+
via?.received(frame.authority, frame.carry, frame.index);
|
|
248
|
+
}
|
|
249
|
+
async function keptEntries(carry, parts) {
|
|
250
|
+
if (parts === 0)
|
|
251
|
+
return [];
|
|
252
|
+
if (receipts === null)
|
|
253
|
+
return null;
|
|
254
|
+
const read = (await receipts.parts(carry, parts));
|
|
255
|
+
if (read.length !== parts)
|
|
256
|
+
return null;
|
|
257
|
+
const entries = assembled(read.flatMap((part) => part.entries));
|
|
258
|
+
return entries !== null && (await verified(entries)) ? entries : null;
|
|
259
|
+
}
|
|
260
|
+
async function carried(frame) {
|
|
261
|
+
await loaded;
|
|
262
|
+
const held = kept.get(frame.carry);
|
|
263
|
+
if (frame.parts > 0 && held?.parts !== frame.parts) {
|
|
264
|
+
await lost(frame.authority, frame.carry);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const entries = await keptEntries(frame.carry, frame.parts).catch(() => null);
|
|
268
|
+
if (entries === null) {
|
|
269
|
+
await lost(frame.authority, frame.carry);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const fenced = {
|
|
273
|
+
...(held ?? {
|
|
274
|
+
authority: frame.authority,
|
|
275
|
+
carry: frame.carry,
|
|
276
|
+
logEpoch: frame.log_epoch,
|
|
277
|
+
after: frame.after,
|
|
278
|
+
parts: 0,
|
|
279
|
+
resume: null,
|
|
280
|
+
}),
|
|
281
|
+
after: frame.after,
|
|
282
|
+
fenced: { position: frame.position, logEpoch: frame.log_epoch },
|
|
283
|
+
};
|
|
284
|
+
try {
|
|
285
|
+
await receipts?.keep(frame.carry, fenced);
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
await lost(frame.authority, frame.carry);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
kept.set(frame.carry, fenced);
|
|
292
|
+
publish(frame, entries);
|
|
293
|
+
}
|
|
294
|
+
async function load(port) {
|
|
295
|
+
try {
|
|
296
|
+
for (const { key, head } of await port.heads())
|
|
297
|
+
kept.set(key, head);
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
kept.clear();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
async function restored(room) {
|
|
304
|
+
const line = lines.get(room.authority);
|
|
305
|
+
let at = room.position;
|
|
306
|
+
const chain = [];
|
|
307
|
+
for (;;) {
|
|
308
|
+
const next = [...kept.values()].find((carry) => carry.authority === room.authority &&
|
|
309
|
+
carry.after === at &&
|
|
310
|
+
carry.fenced?.logEpoch === room.log_epoch);
|
|
311
|
+
if (next?.fenced == null)
|
|
312
|
+
break;
|
|
313
|
+
const entries = await keptEntries(next.carry, next.parts).catch(() => null);
|
|
314
|
+
if (entries === null)
|
|
315
|
+
break;
|
|
316
|
+
chain.push({ carry: next, entries });
|
|
317
|
+
at = next.fenced.position;
|
|
318
|
+
}
|
|
319
|
+
const partial = [...kept.values()].find((carry) => carry.authority === room.authority &&
|
|
320
|
+
carry.fenced === null &&
|
|
321
|
+
carry.logEpoch === room.log_epoch &&
|
|
322
|
+
carry.after === at &&
|
|
323
|
+
carry.resume !== null &&
|
|
324
|
+
carry.resume.parts > 0);
|
|
325
|
+
const stale = [...kept.values()].filter((carry) => carry.authority === room.authority &&
|
|
326
|
+
carry !== partial &&
|
|
327
|
+
!chain.some((link) => link.carry === carry));
|
|
328
|
+
await forget(stale.map((carry) => carry.carry));
|
|
329
|
+
if (line !== undefined && line.logEpoch === room.log_epoch && chain.length > 0) {
|
|
330
|
+
const frames = chain.map(({ carry, entries }) => ({
|
|
331
|
+
after: BigInt(carry.after),
|
|
332
|
+
position: BigInt(carry.fenced.position),
|
|
333
|
+
entries,
|
|
334
|
+
}));
|
|
335
|
+
lines.set(room.authority, { ...line, frames: [...line.frames, ...frames] });
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
...room,
|
|
339
|
+
position: at,
|
|
340
|
+
...(partial?.resume == null
|
|
341
|
+
? {}
|
|
342
|
+
: {
|
|
343
|
+
carry: {
|
|
344
|
+
id: partial.carry,
|
|
345
|
+
parts: partial.resume.parts,
|
|
346
|
+
from: partial.resume.from,
|
|
347
|
+
target: partial.resume.target,
|
|
348
|
+
handled: partial.resume.handled,
|
|
349
|
+
...(partial.resume.piece === null ? {} : { piece: partial.resume.piece }),
|
|
350
|
+
},
|
|
351
|
+
}),
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
function handle(frame, via) {
|
|
114
355
|
if (frame.type === 'signal') {
|
|
115
356
|
const mode = frame.service_mode;
|
|
116
357
|
if (mode !== 'open' && mode !== 'write-halted')
|
|
@@ -126,6 +367,10 @@ export function houseNotifications(transport, mode) {
|
|
|
126
367
|
});
|
|
127
368
|
return;
|
|
128
369
|
}
|
|
370
|
+
if (frame.type === 'authority_changed') {
|
|
371
|
+
emit({ kind: 'authority-changed', scope: { authorities: frame.rooms } });
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
129
374
|
if (frame.type === 'conversations') {
|
|
130
375
|
emitConversation({ kind: 'list', entries: frame.conversations.map(listedConversation) });
|
|
131
376
|
return;
|
|
@@ -142,13 +387,20 @@ export function houseNotifications(transport, mode) {
|
|
|
142
387
|
frame.type === 'process' ||
|
|
143
388
|
frame.type === 'commands' ||
|
|
144
389
|
frame.type === 'options' ||
|
|
390
|
+
frame.type === 'starting' ||
|
|
391
|
+
frame.type === 'link' ||
|
|
392
|
+
frame.type === 'deliveries' ||
|
|
145
393
|
frame.type === 'interactions' ||
|
|
146
394
|
frame.type === 'message') {
|
|
147
395
|
converse(frame);
|
|
148
396
|
return;
|
|
149
397
|
}
|
|
150
|
-
if (frame.type
|
|
151
|
-
return;
|
|
398
|
+
if (frame.type === 'part')
|
|
399
|
+
return stage(frame, via);
|
|
400
|
+
if (frame.type === 'carried')
|
|
401
|
+
return carried(frame);
|
|
402
|
+
}
|
|
403
|
+
function publish(frame, entries) {
|
|
152
404
|
const at = position(frame.position);
|
|
153
405
|
const after = position(frame.after);
|
|
154
406
|
if (at === null || after === null || after >= at) {
|
|
@@ -162,7 +414,7 @@ export function houseNotifications(transport, mode) {
|
|
|
162
414
|
const last = line.frames.at(-1);
|
|
163
415
|
if (last !== undefined && at <= last.position)
|
|
164
416
|
return;
|
|
165
|
-
const held = { after, position: at, entries
|
|
417
|
+
const held = { after, position: at, entries };
|
|
166
418
|
const next = last !== undefined && after <= last.position ? [...line.frames, held] : [held];
|
|
167
419
|
lines.set(frame.authority, { ...line, frames: next.length > HELD_FRAMES_MAX ? [] : next });
|
|
168
420
|
}
|
|
@@ -171,11 +423,30 @@ export function houseNotifications(transport, mode) {
|
|
|
171
423
|
}
|
|
172
424
|
announce(frame.authority, { position: frame.position, logEpoch: frame.log_epoch });
|
|
173
425
|
}
|
|
174
|
-
stream.observe(
|
|
426
|
+
stream.observe((frame) => {
|
|
427
|
+
const via = acknowledging;
|
|
428
|
+
if (verifying === 0) {
|
|
429
|
+
const handled = handle(frame, via);
|
|
430
|
+
if (handled === undefined)
|
|
431
|
+
return;
|
|
432
|
+
verifying += 1;
|
|
433
|
+
receiving = handled.finally(() => {
|
|
434
|
+
verifying -= 1;
|
|
435
|
+
});
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
verifying += 1;
|
|
439
|
+
receiving = receiving
|
|
440
|
+
.then(() => handle(frame, via))
|
|
441
|
+
.finally(() => {
|
|
442
|
+
verifying -= 1;
|
|
443
|
+
});
|
|
444
|
+
});
|
|
175
445
|
stream.opened(reopened);
|
|
176
|
-
stream.closed((revoked) => {
|
|
446
|
+
stream.closed(({ revoked, lost }) => {
|
|
177
447
|
opening = null;
|
|
178
|
-
|
|
448
|
+
acknowledging = null;
|
|
449
|
+
emit({ kind: 'closed', revoked, lost });
|
|
179
450
|
});
|
|
180
451
|
return {
|
|
181
452
|
runtime,
|
|
@@ -198,8 +469,12 @@ export function houseNotifications(transport, mode) {
|
|
|
198
469
|
};
|
|
199
470
|
},
|
|
200
471
|
},
|
|
201
|
-
observe(notify) {
|
|
472
|
+
observe(notify, port) {
|
|
202
473
|
observers.add(notify);
|
|
474
|
+
if (receipts === null) {
|
|
475
|
+
receipts = port;
|
|
476
|
+
loaded = load(port);
|
|
477
|
+
}
|
|
203
478
|
if (opening !== null) {
|
|
204
479
|
queueMicrotask(() => {
|
|
205
480
|
if (observers.has(notify))
|
|
@@ -220,7 +495,30 @@ export function houseNotifications(transport, mode) {
|
|
|
220
495
|
}
|
|
221
496
|
const current = opening;
|
|
222
497
|
opening = null;
|
|
223
|
-
current
|
|
498
|
+
if (current === null)
|
|
499
|
+
return;
|
|
500
|
+
void loaded
|
|
501
|
+
.then(() => Promise.all(rooms.map(restored)))
|
|
502
|
+
.then((presented) => {
|
|
503
|
+
current.hold(presented, runtime);
|
|
504
|
+
for (const [index, room] of presented.entries()) {
|
|
505
|
+
if (room.position === rooms[index].position)
|
|
506
|
+
continue;
|
|
507
|
+
announce(room.authority, { position: room.position, logEpoch: room.log_epoch });
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
},
|
|
511
|
+
published(locator, at) {
|
|
512
|
+
const authority = [...locators].find(([, held]) => held.includes(locator))?.[0];
|
|
513
|
+
const reached = position(at.position);
|
|
514
|
+
if (authority === undefined || reached === null)
|
|
515
|
+
return;
|
|
516
|
+
void forget([...kept.values()]
|
|
517
|
+
.filter((carry) => carry.authority === authority &&
|
|
518
|
+
carry.fenced !== null &&
|
|
519
|
+
carry.fenced.logEpoch === at.logEpoch &&
|
|
520
|
+
BigInt(carry.fenced.position) <= reached)
|
|
521
|
+
.map((carry) => carry.carry));
|
|
224
522
|
},
|
|
225
523
|
reopen() {
|
|
226
524
|
const current = opening;
|
|
@@ -239,6 +537,9 @@ export function houseNotifications(transport, mode) {
|
|
|
239
537
|
if (!locators.has(authority))
|
|
240
538
|
lines.delete(authority);
|
|
241
539
|
}
|
|
540
|
+
void loaded.then(() => forget([...kept.values()]
|
|
541
|
+
.filter((carry) => !locators.has(carry.authority))
|
|
542
|
+
.map((carry) => carry.carry)));
|
|
242
543
|
},
|
|
243
544
|
reach(authority, at) {
|
|
244
545
|
const line = lines.get(authority);
|
|
@@ -265,6 +566,7 @@ export function houseNotifications(transport, mode) {
|
|
|
265
566
|
const documents = {};
|
|
266
567
|
const revisions = {};
|
|
267
568
|
const changes = {};
|
|
569
|
+
const binaryFiles = {};
|
|
268
570
|
const removals = [];
|
|
269
571
|
const applied = [];
|
|
270
572
|
const schemas = new Map();
|
|
@@ -272,6 +574,7 @@ export function houseNotifications(transport, mode) {
|
|
|
272
574
|
delete documents[path];
|
|
273
575
|
delete revisions[path];
|
|
274
576
|
delete changes[path];
|
|
577
|
+
delete binaryFiles[path];
|
|
275
578
|
const removed = removals.indexOf(path);
|
|
276
579
|
if (removed !== -1)
|
|
277
580
|
removals.splice(removed, 1);
|
|
@@ -292,7 +595,8 @@ export function houseNotifications(transport, mode) {
|
|
|
292
595
|
removals.push(entry.path);
|
|
293
596
|
continue;
|
|
294
597
|
}
|
|
295
|
-
|
|
598
|
+
const binary = binaryFileOf(entry);
|
|
599
|
+
if (binary === null || (binary === undefined && entry.text === undefined))
|
|
296
600
|
return null;
|
|
297
601
|
if (mode === 'credential' && entry.revision === undefined)
|
|
298
602
|
return null;
|
|
@@ -300,9 +604,13 @@ export function houseNotifications(transport, mode) {
|
|
|
300
604
|
if (head === null)
|
|
301
605
|
return null;
|
|
302
606
|
forget(entry.path);
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
607
|
+
if (binary === undefined)
|
|
608
|
+
documents[entry.path] = entry.text;
|
|
609
|
+
else
|
|
610
|
+
binaryFiles[entry.path] = binary;
|
|
611
|
+
const revision = entry.revision ?? binary?.sha256;
|
|
612
|
+
if (revision !== undefined)
|
|
613
|
+
revisions[entry.path] = revision;
|
|
306
614
|
if (head !== undefined)
|
|
307
615
|
changes[entry.path] = head;
|
|
308
616
|
}
|
|
@@ -315,8 +623,9 @@ export function houseNotifications(transport, mode) {
|
|
|
315
623
|
roomVersion: roomVersion({ position: last.position.toString(), logEpoch: line.logEpoch }),
|
|
316
624
|
documents,
|
|
317
625
|
revisions,
|
|
626
|
+
...identities(revisions),
|
|
318
627
|
changes,
|
|
319
|
-
|
|
628
|
+
binaryFiles,
|
|
320
629
|
removals: removals.sort(),
|
|
321
630
|
},
|
|
322
631
|
entries: applied,
|
package/dist/transport.d.ts
CHANGED
|
@@ -14,8 +14,15 @@ export type HouseDoorAnswer = {
|
|
|
14
14
|
status: number;
|
|
15
15
|
body: unknown;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
export
|
|
17
|
+
export declare const DOOR_FILES_GET = "/door/files/get";
|
|
18
|
+
export declare const SITE_FILES = "/_house/files/";
|
|
19
|
+
export declare const SITE_FILE_RECORD = "record";
|
|
20
|
+
export type HouseByteAct = 'authored_batch_upload' | 'conversation_file_upload' | 'binary_stage';
|
|
21
|
+
export type HouseByteBody = string | ArrayBuffer | Uint8Array | Blob;
|
|
22
|
+
export type HouseBytesAnswer = {
|
|
23
|
+
status: number;
|
|
24
|
+
blob: Blob | null;
|
|
25
|
+
};
|
|
19
26
|
export type HouseByteTransfer = {
|
|
20
27
|
act: HouseByteAct;
|
|
21
28
|
url: string;
|
|
@@ -24,10 +31,13 @@ export type HouseByteTransfer = {
|
|
|
24
31
|
};
|
|
25
32
|
export type HouseStreamEntry = {
|
|
26
33
|
path: string;
|
|
27
|
-
kind: 'edited' | 'removed';
|
|
34
|
+
kind: 'edited' | 'removed' | 'piece';
|
|
28
35
|
revision?: string;
|
|
29
36
|
sha256?: string;
|
|
30
37
|
text?: string;
|
|
38
|
+
file?: string;
|
|
39
|
+
bytes?: number;
|
|
40
|
+
media_type?: string;
|
|
31
41
|
author?: {
|
|
32
42
|
user: string;
|
|
33
43
|
name: string;
|
|
@@ -36,6 +46,7 @@ export type HouseStreamEntry = {
|
|
|
36
46
|
name: string;
|
|
37
47
|
};
|
|
38
48
|
created_at?: string;
|
|
49
|
+
continued?: true;
|
|
39
50
|
};
|
|
40
51
|
type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent, {
|
|
41
52
|
kind: K;
|
|
@@ -49,15 +60,29 @@ export type HouseListedConversation = {
|
|
|
49
60
|
outcome: string | null;
|
|
50
61
|
};
|
|
51
62
|
export type HouseStreamFrame = {
|
|
52
|
-
type: '
|
|
63
|
+
type: 'part';
|
|
53
64
|
authority: string;
|
|
65
|
+
carry: string;
|
|
66
|
+
index: number;
|
|
67
|
+
after: string;
|
|
68
|
+
from: string;
|
|
69
|
+
target: string;
|
|
70
|
+
handled: number;
|
|
71
|
+
entries: readonly HouseStreamEntry[];
|
|
72
|
+
} | {
|
|
73
|
+
type: 'carried';
|
|
74
|
+
authority: string;
|
|
75
|
+
carry: string;
|
|
76
|
+
parts: number;
|
|
54
77
|
after: string;
|
|
55
78
|
position: string;
|
|
56
79
|
log_epoch: string;
|
|
57
|
-
entries: readonly HouseStreamEntry[];
|
|
58
80
|
} | {
|
|
59
81
|
type: 'opening';
|
|
60
82
|
expired: readonly string[];
|
|
83
|
+
} | {
|
|
84
|
+
type: 'authority_changed';
|
|
85
|
+
rooms: readonly string[];
|
|
61
86
|
} | ({
|
|
62
87
|
type: 'turn';
|
|
63
88
|
conversation_id: string;
|
|
@@ -70,6 +95,10 @@ export type HouseStreamFrame = {
|
|
|
70
95
|
type: 'interactions';
|
|
71
96
|
conversation_id: string;
|
|
72
97
|
interactions: readonly unknown[];
|
|
98
|
+
} | {
|
|
99
|
+
type: 'deliveries';
|
|
100
|
+
conversation_id: string;
|
|
101
|
+
unknown: readonly string[];
|
|
73
102
|
} | {
|
|
74
103
|
type: 'process';
|
|
75
104
|
conversation_id: string;
|
|
@@ -82,6 +111,14 @@ export type HouseStreamFrame = {
|
|
|
82
111
|
type: 'options';
|
|
83
112
|
conversation_id: string;
|
|
84
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;
|
|
85
122
|
} | {
|
|
86
123
|
type: 'conversations';
|
|
87
124
|
conversations: readonly HouseListedConversation[];
|
|
@@ -95,19 +132,36 @@ export type HouseStreamFrame = {
|
|
|
95
132
|
type: 'signal';
|
|
96
133
|
service_mode: string;
|
|
97
134
|
};
|
|
135
|
+
export type HouseHeldCarry = {
|
|
136
|
+
id: string;
|
|
137
|
+
parts: number;
|
|
138
|
+
from: string;
|
|
139
|
+
target: string;
|
|
140
|
+
handled: number;
|
|
141
|
+
piece?: {
|
|
142
|
+
sha256: string;
|
|
143
|
+
offset: number;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
98
146
|
export type HouseHeldRoom = {
|
|
99
147
|
authority: string;
|
|
100
148
|
position: string;
|
|
101
149
|
log_epoch: string;
|
|
150
|
+
carry?: HouseHeldCarry;
|
|
102
151
|
};
|
|
103
152
|
export type HouseOpening = {
|
|
104
153
|
hold(rooms: readonly HouseHeldRoom[], runtime: string): void;
|
|
154
|
+
received(authority: string, carry: string, index: number): void;
|
|
105
155
|
close(): void;
|
|
106
156
|
};
|
|
157
|
+
export type HouseClosing = {
|
|
158
|
+
revoked: boolean;
|
|
159
|
+
lost: boolean;
|
|
160
|
+
};
|
|
107
161
|
export type HouseStream = {
|
|
108
162
|
observe(receive: (frame: HouseStreamFrame) => void): () => void;
|
|
109
163
|
opened(notify: (opening: HouseOpening) => void): () => void;
|
|
110
|
-
closed(notify: (
|
|
164
|
+
closed(notify: (closing: HouseClosing) => void): () => void;
|
|
111
165
|
};
|
|
112
166
|
export type HouseDoor = {
|
|
113
167
|
door(route: string, body: unknown): Promise<HouseDoorAnswer>;
|
|
@@ -115,10 +169,12 @@ export type HouseDoor = {
|
|
|
115
169
|
};
|
|
116
170
|
export type HouseTransport = HouseDoor & {
|
|
117
171
|
transfer(request: HouseByteTransfer): Promise<HouseDoorAnswer>;
|
|
172
|
+
download(url: string): Promise<HouseBytesAnswer>;
|
|
118
173
|
};
|
|
119
174
|
export type HouseSiteTransport = HouseDoor & {
|
|
120
175
|
online(): boolean;
|
|
121
176
|
read(route: string): Promise<HouseDoorAnswer>;
|
|
177
|
+
download(route: string): Promise<HouseBytesAnswer>;
|
|
122
178
|
};
|
|
123
179
|
export {};
|
|
124
180
|
//# sourceMappingURL=transport.d.ts.map
|
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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M,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,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC/D,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,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpD,CAAC"}
|
package/dist/transport.js
CHANGED
|
@@ -8,3 +8,6 @@ export const SITE_DOOR_DISCOVER = '/_house/door/discover';
|
|
|
8
8
|
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
|
+
export const DOOR_FILES_GET = '/door/files/get';
|
|
12
|
+
export const SITE_FILES = '/_house/files/';
|
|
13
|
+
export const SITE_FILE_RECORD = 'record';
|
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;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAEnD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAI/D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,WAAW,GAAG,IAAI,CAKxF;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,iBAAiB,CAE/E;
|
|
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;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAEnD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAI/D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,WAAW,GAAG,IAAI,CAKxF;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,iBAAiB,CAE/E;AAED,eAAO,MAAM,OAAO,QAAwB,CAAC;AAE7C,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,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;
|