@agentshouse/mdruntime-adapter 0.1.0-c8b338faa5c2d → 0.1.0-c8cad855cc8e8

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/dist/site.js CHANGED
@@ -1,22 +1,27 @@
1
+ import { stepped } from '@agentshouse/mdruntime';
1
2
  import { actionOutcome, SITE_SUBMIT } from './actions.js';
2
3
  import { mapDiscovery, parseSiteDiscovery, siteCapabilities, siteTracked, } from './discovery.js';
3
4
  import { partModels, streamedModels, viewModels } from './model.js';
4
- import { advancedScope, bootstrapOf, parseEnumeration, parseSiteBootstrap, refreshFrom, siteBootstrapNext, siteBootstrapOffset, viewOf, wholeView, } from './read.js';
5
- import { sha256Hex } from './digest.js';
5
+ import { advancedScope, bootstrapping, emptyScope, housePart, parseEnumeration, parseSiteParted, refreshFrom, viewOf, wholeView, } from './read.js';
6
+ import { PART_ATTEMPTS, unverifiedPart } from './part.js';
6
7
  import { classifyDoor, classifyRead, discoveryFailure } from './refusal.js';
8
+ import { HOUSE_ROOM_TYPES } from './room-types.js';
7
9
  import { houseNotifications } from './stream.js';
8
10
  import { SITE_DOOR_BOOTSTRAP, SITE_DOOR_DISCOVER, SITE_DOOR_ENUMERATE, SITE_DOOR_SUBMIT, SITE_FILE_RECORD, SITE_FILES, } from './transport.js';
9
11
  import { houseReferrer } from './referrer.js';
10
12
  import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
11
13
  const UNCERTAIN = { kind: 'transport-uncertainty' };
14
+ function unfound() {
15
+ return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
16
+ }
12
17
  function siteRoom(tracked) {
13
18
  return {
14
19
  name: tracked.handle,
15
20
  locator: tracked.locator,
16
21
  handle: tracked.handle,
17
22
  roomVersion: roomVersion(tracked),
18
- operations: { read: [''], sync: [''], write: [], delete: [] },
19
- replica: { selection: tracked.locator, admission: 'admitted' },
23
+ operations: { write: [], delete: [] },
24
+ replica: { selection: tracked.locator, admission: 'admitted', offline: 'open' },
20
25
  providerOwnedPaths: [],
21
26
  };
22
27
  }
@@ -26,10 +31,23 @@ function settled(refused) {
26
31
  export function createSiteAdapter(transport, snapshot = false) {
27
32
  const notifications = houseNotifications(transport, 'site');
28
33
  const tracked = new Map();
34
+ const expired = new Map();
29
35
  function published(referrer) {
30
36
  const named = houseReferrer(referrer, tracked);
31
37
  return named === null || !tracked.has(named.locator) ? null : named;
32
38
  }
39
+ function fileRoute(request) {
40
+ const named = published(request.kind === 'path' ? { room: request.locator, path: request.path } : request.referrer);
41
+ if (named === null) {
42
+ return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
43
+ }
44
+ if (request.fileRef === undefined)
45
+ return unfound();
46
+ const { room_ref, path, record } = named.referrer;
47
+ return `${SITE_FILES}${room_ref}/${encodeURIComponent(request.fileRef)}/${path === undefined
48
+ ? `${SITE_FILE_RECORD}/${encodeURIComponent(record)}`
49
+ : encodeURIComponent(path)}`;
50
+ }
33
51
  async function enumerated(entry, from, page) {
34
52
  const answer = await transport.door(SITE_DOOR_ENUMERATE, {
35
53
  positions: [
@@ -53,73 +71,48 @@ export function createSiteAdapter(transport, snapshot = false) {
53
71
  const first = await enumerated(entry, from);
54
72
  return 'kind' in first ? first : wholeView(first, (page) => enumerated(entry, from, page));
55
73
  }
56
- async function bootstrapPart(entry, after, offset) {
57
- const query = [
58
- ...(after === null ? [] : [`after=${encodeURIComponent(after)}`]),
59
- ...(offset === null ? [] : [`offset=${offset}`]),
60
- ];
61
- const answer = await transport.read(`${SITE_DOOR_BOOTSTRAP}${entry.authority}${query.length === 0 ? '' : `?${query.join('&')}`}`);
74
+ async function partedRoom(entry) {
75
+ const cut = expired.get(entry.locator);
76
+ const answer = await transport.read(`${SITE_DOOR_BOOTSTRAP}${entry.authority}${cut === undefined ? '' : `?expired=${cut}`}`);
62
77
  const classified = classifyDoor(answer.status, answer.body, entry.locator);
63
78
  if (classified !== null)
64
- return { failure: classified };
65
- const scope = parseSiteBootstrap(answer.body);
66
- return scope === null ? { failure: UNCERTAIN } : { body: answer.body, scope };
79
+ return classified;
80
+ const room = parseSiteParted(answer.body);
81
+ return room === null || room.anchor !== entry.authority ? UNCERTAIN : room;
67
82
  }
68
- async function assembled(entry, scope, path, offset) {
69
- const opened = scope.contents.at(-1);
70
- if (opened === undefined || opened.path !== path || opened.content.length !== offset) {
71
- return UNCERTAIN;
83
+ async function fetchedPart(entry, room, listed) {
84
+ for (let attempt = 0; attempt < PART_ATTEMPTS; attempt += 1) {
85
+ const answer = await transport.read(`${SITE_DOOR_BOOTSTRAP}${entry.authority}?part=${encodeURIComponent(listed.part)}`);
86
+ const failure = classifyRead(answer.status, answer.body, entry.locator);
87
+ if (failure?.kind === 'beyond-horizon')
88
+ expired.set(entry.locator, room.position);
89
+ if (failure !== null)
90
+ return failure;
91
+ const scope = await housePart(room, answer.body, listed, 'site');
92
+ if (scope !== null)
93
+ return scope;
72
94
  }
73
- let text = opened.content;
74
- for (;;) {
75
- const part = await bootstrapPart(entry, path, text.length);
76
- if ('failure' in part)
77
- return part.failure;
78
- const [piece] = part.scope.contents;
79
- if (piece === undefined ||
80
- part.scope.contents.length !== 1 ||
81
- piece.path !== path ||
82
- piece.content.length === 0) {
83
- return UNCERTAIN;
84
- }
85
- text += piece.content;
86
- const more = siteBootstrapOffset(part.body);
87
- if (more === null)
88
- break;
89
- if (more !== text.length)
90
- return UNCERTAIN;
91
- }
92
- const file = scope.files.find((held) => held.path === path);
93
- if (file === undefined || (await sha256Hex(text)) !== file.version)
94
- return UNCERTAIN;
95
- return { ...scope, contents: [...scope.contents.slice(0, -1), { path, content: text }] };
95
+ return unverifiedPart(entry.locator);
96
96
  }
97
- async function caughtUp(entry, after) {
98
- const part = await bootstrapPart(entry, after, null);
99
- if ('failure' in part)
100
- return part;
101
- const next = siteBootstrapNext(part.body);
102
- const offset = siteBootstrapOffset(part.body);
103
- if (offset !== null) {
104
- if (next === null)
105
- return { failure: UNCERTAIN };
106
- const scope = await assembled(entry, part.scope, next, offset);
107
- return 'kind' in scope ? { failure: scope } : { scope, next };
108
- }
109
- const { scope } = part;
110
- if (after !== null || next !== null || roomVersion(scope) === roomVersion(entry)) {
111
- return { scope, next };
112
- }
97
+ async function caughtUp(entry, continued) {
98
+ const listed = continued.room.parts[continued.next];
99
+ const scope = listed === undefined
100
+ ? emptyScope(continued.room)
101
+ : await fetchedPart(entry, continued.room, listed);
102
+ if ('kind' in scope)
103
+ return scope;
104
+ if (continued.room.parts.length > 1 || roomVersion(scope) === roomVersion(entry))
105
+ return scope;
113
106
  const view = await enumeration(entry, scope);
114
107
  if ('kind' in view)
115
- return { failure: settled(view) };
116
- return { scope: advancedScope(scope, view), next: null };
108
+ return settled(view);
109
+ return stepped(advancedScope(scope, view));
117
110
  }
118
111
  async function refreshed(entry, fromRoomVersion) {
119
112
  const from = logPosition(fromRoomVersion);
120
113
  if (from === null)
121
114
  return { kind: 'beyond-horizon' };
122
- const streamed = notifications.advance(entry, from);
115
+ const streamed = await stepped(notifications.advance(entry, from));
123
116
  if (streamed !== null) {
124
117
  const models = await streamedModels(streamed.schemas, entry, 'site');
125
118
  return models === undefined ? streamed.page : { ...streamed.page, models };
@@ -128,7 +121,7 @@ export function createSiteAdapter(transport, snapshot = false) {
128
121
  if ('kind' in view)
129
122
  return view;
130
123
  notifications.reach(entry.authority, view);
131
- const answer = refreshFrom(view, fromRoomVersion);
124
+ const answer = await refreshFrom(view, fromRoomVersion);
132
125
  if (answer.kind !== 'net-advancement')
133
126
  return answer;
134
127
  const models = await viewModels(view, entry);
@@ -137,6 +130,7 @@ export function createSiteAdapter(transport, snapshot = false) {
137
130
  return {
138
131
  localSaves: true,
139
132
  exhaustiveDiscovery: true,
133
+ roomTypes: HOUSE_ROOM_TYPES,
140
134
  async authorize() {
141
135
  return {};
142
136
  },
@@ -159,23 +153,31 @@ export function createSiteAdapter(transport, snapshot = false) {
159
153
  const entry = tracked.get(request.locator);
160
154
  if (entry === undefined)
161
155
  return { kind: 'room-not-readable', locator: request.locator };
162
- const continued = request.pageToken === undefined
163
- ? null
164
- : JSON.parse(request.pageToken);
165
- const held = await caughtUp(entry, continued?.after ?? null);
166
- if ('failure' in held)
167
- return held.failure;
168
- notifications.reach(entry.authority, held.scope);
156
+ let continued;
157
+ if (request.pageToken === undefined) {
158
+ const room = await partedRoom(entry);
159
+ if ('kind' in room)
160
+ return room;
161
+ continued = { room, next: 0, seen: [] };
162
+ }
163
+ else
164
+ continued = JSON.parse(request.pageToken);
165
+ const scope = await caughtUp(entry, continued);
166
+ if ('kind' in scope)
167
+ return scope;
168
+ notifications.reach(entry.authority, scope);
169
+ const next = continued.next + 1;
170
+ const more = next < continued.room.parts.length;
169
171
  const seen = [
170
- ...(continued?.seen ?? []),
171
- ...entry.schemas.filter((schema) => held.scope.files.some((file) => file.path === schema)),
172
+ ...continued.seen,
173
+ ...entry.schemas.filter((schema) => scope.files.some((file) => file.path === schema)),
172
174
  ];
173
- const models = await partModels(held.scope, entry, new Set(seen), held.next === null);
174
- const continuation = held.next === null ? null : { after: held.next, seen };
175
+ const models = await partModels(scope, entry, new Set(seen), !more);
176
+ const { folders: _folders, ...page } = await stepped(bootstrapping(scope));
175
177
  return {
176
- ...bootstrapOf(held.scope),
178
+ ...page,
177
179
  ...(models === undefined ? {} : { models }),
178
- ...(continuation === null ? {} : { pageToken: JSON.stringify(continuation) }),
180
+ ...(more ? { pageToken: JSON.stringify({ ...continued, next, seen }) } : {}),
179
181
  };
180
182
  },
181
183
  async refresh(_authorization, request) {
@@ -198,30 +200,32 @@ export function createSiteAdapter(transport, snapshot = false) {
198
200
  return { kind: 'no-history' };
199
201
  },
200
202
  async binary(_authorization, request) {
201
- const named = published(request.kind === 'path' ? { room: request.locator, path: request.path } : request.referrer);
202
- if (named === null) {
203
- return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
204
- }
205
- if (request.fileRef === undefined) {
206
- return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
207
- }
208
- const { room_ref, path, record } = named.referrer;
209
- const read = await transport.download(`${SITE_FILES}${room_ref}/${encodeURIComponent(request.fileRef)}/${path === undefined
210
- ? `${SITE_FILE_RECORD}/${encodeURIComponent(record)}`
211
- : encodeURIComponent(path)}`);
212
- if (read.status === 404) {
213
- return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
214
- }
215
- return read.status === 200 && read.blob !== null
216
- ? { kind: 'binary', blob: read.blob }
203
+ const route = fileRoute(request);
204
+ if (typeof route !== 'string')
205
+ return route;
206
+ const read = await transport.download(route);
207
+ if (read.status === 404)
208
+ return unfound();
209
+ return read.status === 200 && read.body !== null
210
+ ? { kind: 'binary', body: read.body, mediaType: read.mediaType }
217
211
  : UNCERTAIN;
218
212
  },
213
+ async link(_authorization, request) {
214
+ const route = fileRoute(request);
215
+ if (typeof route !== 'string')
216
+ return route;
217
+ return {
218
+ kind: 'link',
219
+ url: route,
220
+ name: request.path.slice(request.path.lastIndexOf('/') + 1),
221
+ };
222
+ },
219
223
  referrerScope(referrer) {
220
224
  const named = published(referrer);
221
225
  if (named === null)
222
226
  return null;
223
227
  const { path } = named.referrer;
224
- return { kind: 'room', locator: named.locator, ...(path === undefined ? {} : { path }) };
228
+ return { locator: named.locator, ...(path === undefined ? {} : { path }) };
225
229
  },
226
230
  reached(locator, version, target) {
227
231
  return reachedVersion(version, target, tracked.get(locator)?.logEpoch);
@@ -253,7 +257,7 @@ export function createSiteAdapter(transport, snapshot = false) {
253
257
  return [];
254
258
  notifications.reach(entry.authority, at);
255
259
  return [presented(entry.authority, at)];
256
- }), null);
260
+ }));
257
261
  },
258
262
  reopen: notifications.reopen,
259
263
  observe: notifications.observe,
package/dist/stream.d.ts CHANGED
@@ -1,22 +1,22 @@
1
- import type { ConversationStream, RefreshPage, RoomStreamEvent, ServiceModeSignal, StreamReceipts } from '@agentshouse/mdruntime';
1
+ import { type ConversationStream, type RefreshPage, type RoomStreamEvent, type ServiceModeSignal, type StreamReceipts } from '@agentshouse/mdruntime';
2
2
  import type { TrackedAuthority } from './discovery.js';
3
- import type { HouseDemand, HouseDoor, HouseHeldRoom, HouseMode, HouseStreamEntry } from './transport.js';
3
+ import type { HouseDoor, HouseHeldRoom, HouseMode, HouseStreamEntry } from './transport.js';
4
4
  import { type LogPosition } from './version.js';
5
5
  export type HeldRevision = (path: string, revision: string) => boolean;
6
6
  export type StreamedAdvancement = {
7
7
  page: RefreshPage;
8
- entries: readonly HouseStreamEntry[];
9
8
  schemas: ReadonlyMap<string, HouseStreamEntry>;
10
9
  };
11
10
  export type HouseNotifications = {
12
11
  runtime: string;
13
12
  observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts): () => void;
14
- send(rooms: readonly HouseHeldRoom[], demand: HouseDemand | null): void;
13
+ send(rooms: readonly HouseHeldRoom[]): void;
15
14
  published(locator: string, at: LogPosition): void;
16
15
  reopen(): void;
17
16
  track(authorities: readonly TrackedAuthority[]): void;
18
17
  reach(authority: string, at: LogPosition): void;
19
- advance(tracked: TrackedAuthority, from: LogPosition, holds?: HeldRevision): StreamedAdvancement | null;
18
+ edited(tracked: TrackedAuthority, from: LogPosition): readonly string[];
19
+ advance(tracked: TrackedAuthority, from: LogPosition, holds?: HeldRevision): Generator<number, StreamedAdvancement | null, void>;
20
20
  conversations: ConversationStream;
21
21
  serviceMode: ServiceModeSignal;
22
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,kBAAkB,EAElB,WAAW,EACX,eAAe,EAEf,iBAAiB,EACjB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,aAAa,EAEb,SAAS,EAET,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,KAAK,WA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AAC,EAAE,YAAY,GACnB,SAAS,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC;IACvD,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAmFF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,kBAAkB,CA8jB5F"}
package/dist/stream.js CHANGED
@@ -1,6 +1,7 @@
1
+ import { ROW_WEIGHT, } from '@agentshouse/mdruntime';
1
2
  import { acceptedMessage } from './actions.js';
2
3
  import { sha256Hex } from './digest.js';
3
- import { binaryFileOf, headChange, identities } from './read.js';
4
+ import { answered, answering, binaryFileOf, folded, forgotten, headChange, revised, } from './read.js';
4
5
  import { roomVersion } from './version.js';
5
6
  const HELD_FRAMES_MAX = 256;
6
7
  function turnOperation(frame) {
@@ -15,6 +16,7 @@ function listedConversation(listed) {
15
16
  created: listed.created_at,
16
17
  finished: listed.finished_at,
17
18
  outcome: listed.outcome,
19
+ waiting: listed.waiting,
18
20
  };
19
21
  }
20
22
  function position(value) {
@@ -111,7 +113,10 @@ export function houseNotifications(transport, mode) {
111
113
  event.kind === 'questions' ||
112
114
  event.kind === 'process' ||
113
115
  event.kind === 'commands' ||
114
- event.kind === 'options') {
116
+ event.kind === 'options' ||
117
+ event.kind === 'starting' ||
118
+ event.kind === 'link' ||
119
+ event.kind === 'deliveries') {
115
120
  live.add(event.conversation);
116
121
  }
117
122
  for (const observer of conversationObservers)
@@ -157,6 +162,18 @@ export function houseNotifications(transport, mode) {
157
162
  emitConversation({ kind: 'options', conversation, options: structuredClone(frame.options) });
158
163
  return;
159
164
  }
165
+ if (frame.type === 'starting') {
166
+ emitConversation({ kind: 'starting', conversation, step: frame.step });
167
+ return;
168
+ }
169
+ if (frame.type === 'link') {
170
+ emitConversation({ kind: 'link', conversation, connected: frame.connected });
171
+ return;
172
+ }
173
+ if (frame.type === 'deliveries') {
174
+ emitConversation({ kind: 'deliveries', conversation, unknown: [...frame.unknown] });
175
+ return;
176
+ }
160
177
  if (frame.type === 'interactions') {
161
178
  emitConversation({
162
179
  kind: 'questions',
@@ -352,6 +369,10 @@ export function houseNotifications(transport, mode) {
352
369
  });
353
370
  return;
354
371
  }
372
+ if (frame.type === 'authority_changed') {
373
+ emit({ kind: 'authority-changed', scope: { authorities: frame.rooms } });
374
+ return;
375
+ }
355
376
  if (frame.type === 'conversations') {
356
377
  emitConversation({ kind: 'list', entries: frame.conversations.map(listedConversation) });
357
378
  return;
@@ -368,6 +389,9 @@ export function houseNotifications(transport, mode) {
368
389
  frame.type === 'process' ||
369
390
  frame.type === 'commands' ||
370
391
  frame.type === 'options' ||
392
+ frame.type === 'starting' ||
393
+ frame.type === 'link' ||
394
+ frame.type === 'deliveries' ||
371
395
  frame.type === 'interactions' ||
372
396
  frame.type === 'message') {
373
397
  converse(frame);
@@ -421,10 +445,10 @@ export function houseNotifications(transport, mode) {
421
445
  });
422
446
  });
423
447
  stream.opened(reopened);
424
- stream.closed((revoked) => {
448
+ stream.closed(({ revoked, lost }) => {
425
449
  opening = null;
426
450
  acknowledging = null;
427
- emit({ kind: 'closed', revoked });
451
+ emit({ kind: 'closed', revoked, lost });
428
452
  });
429
453
  return {
430
454
  runtime,
@@ -463,7 +487,7 @@ export function houseNotifications(transport, mode) {
463
487
  observers.delete(notify);
464
488
  };
465
489
  },
466
- send(rooms, demand) {
490
+ send(rooms) {
467
491
  for (const room of rooms) {
468
492
  const line = lines.get(room.authority);
469
493
  const held = position(room.position);
@@ -478,7 +502,7 @@ export function houseNotifications(transport, mode) {
478
502
  void loaded
479
503
  .then(() => Promise.all(rooms.map(restored)))
480
504
  .then((presented) => {
481
- current.hold(presented, runtime, demand);
505
+ current.hold(presented, runtime);
482
506
  for (const [index, room] of presented.entries()) {
483
507
  if (room.position === rooms[index].position)
484
508
  continue;
@@ -532,7 +556,18 @@ export function houseNotifications(transport, mode) {
532
556
  held,
533
557
  });
534
558
  },
535
- advance(tracked, from, holds) {
559
+ edited(tracked, from) {
560
+ const line = lines.get(tracked.authority);
561
+ const start = position(from.position);
562
+ if (line === undefined || start === null || line.logEpoch !== from.logEpoch)
563
+ return [];
564
+ return [
565
+ ...new Set(line.frames
566
+ .filter((frame) => frame.position > start)
567
+ .flatMap((frame) => frame.entries.flatMap((entry) => entry.kind === 'edited' && entry.revision !== undefined ? [entry.path] : []))),
568
+ ];
569
+ },
570
+ *advance(tracked, from, holds) {
536
571
  const line = lines.get(tracked.authority);
537
572
  const start = position(from.position);
538
573
  if (line === undefined || start === null || line.logEpoch !== from.logEpoch)
@@ -541,36 +576,26 @@ export function houseNotifications(transport, mode) {
541
576
  const first = pending[0];
542
577
  if (first === undefined || first.after > start)
543
578
  return null;
544
- const documents = {};
545
- const revisions = {};
546
- const changes = {};
547
- const binaryFiles = {};
548
- const removals = [];
549
- const applied = [];
579
+ const answer = answering();
550
580
  const schemas = new Map();
551
- const forget = (path) => {
552
- delete documents[path];
553
- delete revisions[path];
554
- delete changes[path];
555
- delete binaryFiles[path];
556
- const removed = removals.indexOf(path);
557
- if (removed !== -1)
558
- removals.splice(removed, 1);
559
- };
560
581
  for (const frame of pending) {
561
582
  for (const entry of frame.entries) {
583
+ yield ROW_WEIGHT + (entry.text?.length ?? 0);
584
+ if (entry.kind === 'folder') {
585
+ folded(answer, entry.path, entry.removed === true);
586
+ continue;
587
+ }
562
588
  if (entry.kind === 'edited' &&
563
589
  entry.revision !== undefined &&
564
590
  holds?.(entry.path, entry.revision) === true) {
565
- forget(entry.path);
591
+ forgotten(answer, entry.path);
566
592
  continue;
567
593
  }
568
- applied.push(entry);
569
594
  if (tracked.schemas.includes(entry.path))
570
595
  schemas.set(entry.path, entry);
571
596
  if (entry.kind === 'removed') {
572
- forget(entry.path);
573
- removals.push(entry.path);
597
+ forgotten(answer, entry.path);
598
+ answer.removals.add(entry.path);
574
599
  continue;
575
600
  }
576
601
  const binary = binaryFileOf(entry);
@@ -581,32 +606,33 @@ export function houseNotifications(transport, mode) {
581
606
  const head = headChange(entry);
582
607
  if (head === null)
583
608
  return null;
584
- forget(entry.path);
609
+ forgotten(answer, entry.path);
585
610
  if (binary === undefined)
586
- documents[entry.path] = entry.text;
611
+ answer.documents.set(entry.path, entry.text);
587
612
  else
588
- binaryFiles[entry.path] = binary;
613
+ answer.binaryFiles.set(entry.path, binary);
589
614
  const revision = entry.revision ?? binary?.sha256;
590
615
  if (revision !== undefined)
591
- revisions[entry.path] = revision;
616
+ revised(answer, entry.path, revision);
592
617
  if (head !== undefined)
593
- changes[entry.path] = head;
618
+ answer.changes.set(entry.path, head);
594
619
  }
595
620
  }
596
621
  const last = pending.at(-1);
597
- lines.set(tracked.authority, { ...line, frames: pending, held: last.position });
622
+ const current = lines.get(tracked.authority);
623
+ if (current?.logEpoch === line.logEpoch) {
624
+ lines.set(tracked.authority, {
625
+ ...current,
626
+ frames: current.frames.filter((frame) => frame.position > start),
627
+ held: current.held !== null && current.held > last.position ? current.held : last.position,
628
+ });
629
+ }
598
630
  return {
599
631
  page: {
600
632
  kind: 'net-advancement',
601
633
  roomVersion: roomVersion({ position: last.position.toString(), logEpoch: line.logEpoch }),
602
- documents,
603
- revisions,
604
- ...identities(revisions),
605
- changes,
606
- binaryFiles,
607
- removals: removals.sort(),
634
+ ...(yield* answered(answer)),
608
635
  },
609
- entries: applied,
610
636
  schemas,
611
637
  };
612
638
  },
@@ -17,11 +17,12 @@ export type HouseDoorAnswer = {
17
17
  export declare const DOOR_FILES_GET = "/door/files/get";
18
18
  export declare const SITE_FILES = "/_house/files/";
19
19
  export declare const SITE_FILE_RECORD = "record";
20
- export type HouseByteAct = 'authored_batch_upload' | 'conversation_file_upload' | 'binary_stage';
20
+ export type HouseByteAct = 'authored_batch_upload' | 'file_upload' | 'binary_stage';
21
21
  export type HouseByteBody = string | ArrayBuffer | Uint8Array | Blob;
22
22
  export type HouseBytesAnswer = {
23
23
  status: number;
24
- blob: Blob | null;
24
+ body: ReadableStream<Uint8Array> | null;
25
+ mediaType: string;
25
26
  };
26
27
  export type HouseByteTransfer = {
27
28
  act: HouseByteAct;
@@ -31,7 +32,8 @@ export type HouseByteTransfer = {
31
32
  };
32
33
  export type HouseStreamEntry = {
33
34
  path: string;
34
- kind: 'edited' | 'removed' | 'piece';
35
+ kind: 'edited' | 'removed' | 'piece' | 'folder';
36
+ removed?: true;
35
37
  revision?: string;
36
38
  sha256?: string;
37
39
  text?: string;
@@ -58,6 +60,7 @@ export type HouseListedConversation = {
58
60
  created_at: string;
59
61
  finished_at: string | null;
60
62
  outcome: string | null;
63
+ waiting: boolean;
61
64
  };
62
65
  export type HouseStreamFrame = {
63
66
  type: 'part';
@@ -80,6 +83,9 @@ export type HouseStreamFrame = {
80
83
  } | {
81
84
  type: 'opening';
82
85
  expired: readonly string[];
86
+ } | {
87
+ type: 'authority_changed';
88
+ rooms: readonly string[];
83
89
  } | ({
84
90
  type: 'turn';
85
91
  conversation_id: string;
@@ -92,6 +98,10 @@ export type HouseStreamFrame = {
92
98
  type: 'interactions';
93
99
  conversation_id: string;
94
100
  interactions: readonly unknown[];
101
+ } | {
102
+ type: 'deliveries';
103
+ conversation_id: string;
104
+ unknown: readonly string[];
95
105
  } | {
96
106
  type: 'process';
97
107
  conversation_id: string;
@@ -104,6 +114,14 @@ export type HouseStreamFrame = {
104
114
  type: 'options';
105
115
  conversation_id: string;
106
116
  options: LiveFact<'options'>['options'];
117
+ } | {
118
+ type: 'starting';
119
+ conversation_id: string;
120
+ step: string | null;
121
+ } | {
122
+ type: 'link';
123
+ conversation_id: string;
124
+ connected: boolean;
107
125
  } | {
108
126
  type: 'conversations';
109
127
  conversations: readonly HouseListedConversation[];
@@ -134,19 +152,19 @@ export type HouseHeldRoom = {
134
152
  log_epoch: string;
135
153
  carry?: HouseHeldCarry;
136
154
  };
137
- export type HouseDemand = {
138
- rooms: readonly string[];
139
- conversations: boolean;
140
- };
141
155
  export type HouseOpening = {
142
- hold(rooms: readonly HouseHeldRoom[], runtime: string, demand: HouseDemand | null): void;
156
+ hold(rooms: readonly HouseHeldRoom[], runtime: string): void;
143
157
  received(authority: string, carry: string, index: number): void;
144
158
  close(): void;
145
159
  };
160
+ export type HouseClosing = {
161
+ revoked: boolean;
162
+ lost: boolean;
163
+ };
146
164
  export type HouseStream = {
147
165
  observe(receive: (frame: HouseStreamFrame) => void): () => void;
148
166
  opened(notify: (opening: HouseOpening) => void): () => void;
149
- closed(notify: (revoked: boolean) => void): () => void;
167
+ closed(notify: (closing: HouseClosing) => void): () => void;
150
168
  };
151
169
  export type HouseDoor = {
152
170
  door(route: string, body: unknown): Promise<HouseDoorAnswer>;
@@ -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,UAAU,mBAAmB,CAAC;AAE3C,eAAO,MAAM,gBAAgB,W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