@agentshouse/mdruntime-adapter 0.1.0-c51fa73c21cdb → 0.1.0-c52e136e8d6ca

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/adapter.js CHANGED
@@ -1,18 +1,17 @@
1
- import { sortedKeys, stepped } from '@agentshouse/mdruntime';
1
+ import { stepped } from '@agentshouse/mdruntime';
2
2
  import { DISCOVER_PREFIXES, capabilities, discoveredRoom, mapDiscovery, parseDiscovery, trackedFrom, } from './discovery.js';
3
3
  import { partModels, streamedModels, viewModels } from './model.js';
4
4
  import { gathered, gatheredEach, selections } from './gather.js';
5
5
  import { createSiteAdapter } from './site.js';
6
- import { authorityRoot, bootstrapping, emptyScope, housePart, parseEnumeration, parseFileAddress, parseGrant, parseParted, refreshFrom, viewOf, wholeView, } from './read.js';
7
- import { PART_ATTEMPTS, unverifiedPart } from './part.js';
6
+ import { authorityRoot, bootstrapping, emptyScope, housePart, manifested, parseEnumeration, parseFileAddress, parseGrant, parseParted, partInventory, refreshFrom, viewOf, wholeView, } from './read.js';
7
+ import { PART_ATTEMPTS, partArrival, partFrame, unverifiedPart } from './part.js';
8
8
  import { sha256Hex } from './digest.js';
9
- import { acceptedHanded, enumeratedHanded, heldHanded, scopeHanded, streamedHanded, } from './handed.js';
9
+ import { finishedUpload, houseUpload } from './upload.js';
10
10
  import { houseAction } from './actions.js';
11
11
  import { classifyDoor, classifyRead, discoveryFailure, doorRefusal } from './refusal.js';
12
12
  import { houseNotifications } from './stream.js';
13
13
  import { DOOR_BATCH, DOOR_BATCH_UPLOAD, DOOR_BOOTSTRAP, DOOR_DISCOVER, DOOR_ENUMERATE, DOOR_FILES_GET, DOOR_REVISIONS, } from './transport.js';
14
14
  import { batchPaths, deltaBody, deltaBytes, deltaDigest, historyOutcome, houseChanges, houseMove, mutationOutcome, operationHead, rejectedMapping, revisionBody, uploadable, } from './write.js';
15
- import { houseReferrer } from './referrer.js';
16
15
  import { HOUSE_ROOM_TYPES } from './room-types.js';
17
16
  import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
18
17
  const UNCERTAIN = { kind: 'transport-uncertainty' };
@@ -21,42 +20,29 @@ const EXPIRED_ADDRESS = 403;
21
20
  function lapsedGrant(outcome) {
22
21
  return outcome.kind === 'rejected' && outcome.code === 'upload_unavailable';
23
22
  }
24
- const heldPaths = new WeakMap();
25
- async function sortedHeld(held) {
26
- const known = heldPaths.get(held.documents);
27
- if (known !== undefined)
28
- return known;
29
- const sorted = await stepped(sortedKeys(held.documents));
30
- heldPaths.set(held.documents, sorted);
31
- return sorted;
32
- }
33
- function heldFiles(authority, held, paths, bound) {
34
- const files = [];
35
- let through = null;
36
- for (let at = 0; at < paths.length && through === null; at += 1) {
37
- const revision = held.revisions[paths[at]];
38
- if (revision === undefined)
39
- continue;
40
- if (files.length === bound)
41
- through = files.at(-1).path;
42
- else
43
- files.push({ path: paths[at], revision });
44
- }
23
+ async function heldFiles(authority, held, bound) {
24
+ const listed = await held.files(null, bound + 1);
25
+ const files = listed.slice(0, bound);
26
+ const through = listed.length > bound ? (files.at(-1)?.path ?? null) : null;
45
27
  return files.length === 0 ? null : { room: authority, through, files };
46
28
  }
47
29
  async function reused(scope, held) {
48
30
  const sent = new Set(scope.contents.map((entry) => entry.path));
49
31
  const contents = [...scope.contents];
50
- for (const file of scope.files) {
51
- if (file.binary !== undefined || sent.has(file.path))
52
- continue;
53
- const content = held?.documents[file.path];
54
- if (content === undefined ||
55
- held?.revisions[file.path] !== file.revision ||
56
- (await sha256Hex(content)) !== file.sha256) {
32
+ const asked = scope.files.filter((file) => file.binary === undefined && !sent.has(file.path));
33
+ if (asked.length === 0)
34
+ return scope;
35
+ if (held === undefined)
36
+ return null;
37
+ const kept = await held.contents(asked.map(({ path }) => path));
38
+ for (const file of asked) {
39
+ const found = kept.get(file.path);
40
+ if (found === undefined ||
41
+ found.revision !== file.revision ||
42
+ (await sha256Hex(found.content)) !== file.sha256) {
57
43
  return null;
58
44
  }
59
- contents.push({ path: file.path, content });
45
+ contents.push({ path: file.path, content: found.content });
60
46
  }
61
47
  return { ...scope, contents };
62
48
  }
@@ -67,51 +53,55 @@ export function createAgentsHouseAdapter(options) {
67
53
  const notifications = houseNotifications(transport, 'credential');
68
54
  const tracked = new Map();
69
55
  const handed = new Map();
56
+ let heldRevisions;
70
57
  let bounds;
71
58
  function declared() {
72
59
  if (bounds === undefined)
73
60
  throw new Error('no Discovery declared the bounds');
74
61
  return bounds;
75
62
  }
76
- function hand(locator, steps) {
77
- const held = handed.get(locator);
78
- const next = stepped(steps);
79
- if (!(next instanceof Promise)) {
80
- handed.set(locator, next);
81
- return;
63
+ async function fetchedPart(entry, continued, listed, received, arriving) {
64
+ if (received !== undefined) {
65
+ const kept = new Uint8Array(received);
66
+ const held = await housePart(continued.room, kept, listed, 'credential');
67
+ if (held !== null)
68
+ return 'kind' in held ? held : { scope: held, frame: kept };
82
69
  }
83
- return next.then((room) => {
84
- if (handed.get(locator) === held)
85
- handed.set(locator, room);
86
- else
87
- handed.delete(locator);
88
- });
89
- }
90
- async function fetchedPart(entry, continued, listed) {
91
70
  for (let attempt = 0; attempt < PART_ATTEMPTS; attempt += 1) {
92
71
  const answered = await transport.door(DOOR_BOOTSTRAP, {
93
72
  prefixes: [authorityRoot(entry.handle)],
94
73
  part: listed.part,
95
74
  ...(continued.held === undefined ? {} : { held: [continued.held] }),
96
- });
75
+ }, partArrival(listed, arriving));
97
76
  const failure = classifyRead(answered.status, answered.body, entry.locator);
98
77
  if (failure !== null)
99
78
  return failure;
100
- const scope = await housePart(continued.room, answered.body, listed, 'credential');
79
+ const frame = partFrame(answered.body);
80
+ if (frame === null)
81
+ continue;
82
+ const scope = await housePart(continued.room, frame, listed, 'credential');
101
83
  if (scope !== null)
102
- return scope;
84
+ return 'kind' in scope ? scope : { scope, frame };
103
85
  }
104
86
  return unverifiedPart(entry.locator);
105
87
  }
106
- async function partPage(asked, continued) {
88
+ async function manifestPage(asked, continued) {
89
+ const inventory = partInventory(continued.room);
90
+ if (inventory.parts === 0) {
91
+ const page = await partPage(asked, continued, undefined, undefined);
92
+ return page.kind === 'bootstrap' ? { ...page, inventory } : page;
93
+ }
94
+ return manifested(continued.room, inventory, JSON.stringify(continued));
95
+ }
96
+ async function partPage(asked, continued, received, arriving) {
107
97
  const { entry } = asked;
108
98
  const listed = continued.room.parts[continued.next];
109
99
  const sent = listed === undefined
110
- ? emptyScope(continued.room)
111
- : await fetchedPart(entry, continued, listed);
100
+ ? { scope: emptyScope(continued.room), frame: null }
101
+ : await fetchedPart(entry, continued, listed, received, arriving);
112
102
  if ('kind' in sent)
113
103
  return sent;
114
- const scope = await reused(sent, asked.held);
104
+ const scope = await reused(sent.scope, asked.held);
115
105
  if (scope === null) {
116
106
  return asked.held === undefined
117
107
  ? UNCERTAIN_READ
@@ -120,7 +110,7 @@ export function createAgentsHouseAdapter(options) {
120
110
  const next = continued.next + 1;
121
111
  const more = next < continued.room.parts.length;
122
112
  if (continued.next === 0 && !more)
123
- await hand(entry.locator, scopeHanded(scope));
113
+ handed.set(entry.locator, roomVersion(scope));
124
114
  else
125
115
  handed.delete(entry.locator);
126
116
  notifications.reach(entry.authority, scope);
@@ -133,6 +123,7 @@ export function createAgentsHouseAdapter(options) {
133
123
  ...(await stepped(bootstrapping(scope))),
134
124
  ...(models === undefined ? {} : { models }),
135
125
  ...(more ? { pageToken: JSON.stringify({ ...continued, next, seen }) } : {}),
126
+ ...(sent.frame === null ? {} : { received: sent.frame }),
136
127
  };
137
128
  }
138
129
  async function enumeratedPage(ask, page) {
@@ -164,18 +155,21 @@ export function createAgentsHouseAdapter(options) {
164
155
  const answer = await refreshFrom(view, ask.fromRoomVersion);
165
156
  if (answer.kind !== 'net-advancement')
166
157
  return answer;
167
- await hand(ask.entry.locator, enumeratedHanded(view, handed.get(ask.entry.locator)));
158
+ handed.set(ask.entry.locator, roomVersion(view));
168
159
  const models = await viewModels(view, ask.entry);
169
160
  return models === undefined ? answer : { ...answer, models };
170
161
  }
171
162
  async function streamed(entry, request, from) {
172
- const held = handed.get(entry.locator);
173
- if (held?.roomVersion !== request.fromRoomVersion)
163
+ if (handed.get(entry.locator) !== request.fromRoomVersion)
174
164
  return null;
175
- const advanced = await stepped(notifications.advance(entry, from, (path, revision) => held.revisions[path] === revision));
165
+ const asked = notifications.edited(entry, from);
166
+ const kept = asked.length === 0 || heldRevisions === undefined
167
+ ? new Map()
168
+ : await heldRevisions(entry.locator, asked);
169
+ const advanced = await stepped(notifications.advance(entry, from, (path, revision) => kept.get(path) === revision));
176
170
  if (advanced === null)
177
171
  return null;
178
- await hand(entry.locator, streamedHanded(held, advanced));
172
+ handed.set(entry.locator, advanced.page.roomVersion);
179
173
  const models = await streamedModels(advanced.schemas, entry, 'credential');
180
174
  return models === undefined ? advanced.page : { ...advanced.page, models };
181
175
  }
@@ -185,7 +179,7 @@ export function createAgentsHouseAdapter(options) {
185
179
  const at = logPosition(room.roomVersion);
186
180
  if (entry === undefined || at === null)
187
181
  return [];
188
- handed.set(room.locator, heldHanded(room));
182
+ handed.set(room.locator, room.roomVersion);
189
183
  notifications.reach(entry.authority, at);
190
184
  return [presented(entry.authority, at)];
191
185
  });
@@ -203,8 +197,9 @@ export function createAgentsHouseAdapter(options) {
203
197
  const held = handed.get(entry.locator);
204
198
  if (held === undefined)
205
199
  return outcome;
206
- const follows = followsVersion(held.roomVersion, outcome.roomVersion);
207
- await hand(entry.locator, acceptedHanded(held, outcome, follows ? outcome.roomVersion : held.roomVersion));
200
+ const follows = followsVersion(held, outcome.roomVersion);
201
+ if (follows)
202
+ handed.set(entry.locator, outcome.roomVersion);
208
203
  const at = logPosition(outcome.roomVersion);
209
204
  if (follows && at !== null)
210
205
  notifications.reach(entry.authority, at);
@@ -233,8 +228,7 @@ export function createAgentsHouseAdapter(options) {
233
228
  for (const ask of asks) {
234
229
  if (ask.held === undefined || bound === 0)
235
230
  continue;
236
- const paths = await sortedHeld(ask.held);
237
- const files = heldFiles(ask.entry.authority, ask.held, paths, bound);
231
+ const files = await heldFiles(ask.entry.authority, ask.held, bound);
238
232
  if (files !== null)
239
233
  held.push(files);
240
234
  }
@@ -272,7 +266,7 @@ export function createAgentsHouseAdapter(options) {
272
266
  continue;
273
267
  }
274
268
  const kept = held.find((files) => files.room === asked.entry.authority);
275
- answer(asked.ask, await partPage(asked.asked, {
269
+ answer(asked.ask, await manifestPage(asked.asked, {
276
270
  room,
277
271
  next: 0,
278
272
  seen: [],
@@ -364,21 +358,16 @@ export function createAgentsHouseAdapter(options) {
364
358
  const refusal = doorRefusal(answer.body);
365
359
  if (refusal?.code !== 'files_unstaged')
366
360
  return null;
367
- const grants = refusal.fields.upload;
368
- if (!Array.isArray(grants))
361
+ const uploads = refusal.fields.upload;
362
+ if (!Array.isArray(uploads))
369
363
  return false;
370
- for (const grant of grants) {
371
- const { url, operation, sha256 } = grant;
372
- const change = batch.changes.find((held) => held.kind === 'binary' && held.sha256 === sha256);
373
- if (typeof url !== 'string' || typeof operation !== 'string' || change === undefined)
364
+ for (const named of uploads) {
365
+ const upload = houseUpload(named);
366
+ const change = batch.changes.find((held) => held.kind === 'binary' && held.sha256 === named.sha256);
367
+ if (upload === null || change === undefined)
374
368
  return false;
375
- const delivered = await transport.transfer({
376
- act: 'binary_stage',
377
- url,
378
- body: await file(change.localId),
379
- operation,
380
- });
381
- if (delivered.status !== 200)
369
+ const finished = await finishedUpload(transport, upload, await file(change.localId));
370
+ if (finished?.body?.staged !== true)
382
371
  return false;
383
372
  }
384
373
  return true;
@@ -436,11 +425,14 @@ export function createAgentsHouseAdapter(options) {
436
425
  return address;
437
426
  read = await transport.download(address.url);
438
427
  }
439
- if (read.status !== 200 || read.blob === null)
440
- return UNCERTAIN_READ;
441
- if ((await sha256Hex(await read.blob.arrayBuffer())) !== address.sha256)
428
+ if (read.status !== 200 || read.body === null)
442
429
  return UNCERTAIN_READ;
443
- return { kind: 'binary', blob: read.blob };
430
+ return {
431
+ kind: 'binary',
432
+ body: read.body,
433
+ mediaType: address.mediaType,
434
+ sha256: address.sha256,
435
+ };
444
436
  }
445
437
  function pathAddress(request) {
446
438
  const entry = authorityFor(request.locator);
@@ -503,7 +495,7 @@ export function createAgentsHouseAdapter(options) {
503
495
  return { kind: 'room-not-readable', locator: request.locator };
504
496
  const asked = { entry, held: request.held };
505
497
  if (request.pageToken !== undefined) {
506
- return partPage(asked, JSON.parse(request.pageToken));
498
+ return partPage(asked, JSON.parse(request.pageToken), request.received, request.arriving);
507
499
  }
508
500
  return bootstrapTogether(asked);
509
501
  },
@@ -563,17 +555,10 @@ export function createAgentsHouseAdapter(options) {
563
555
  });
564
556
  },
565
557
  async binary(_authorization, request) {
566
- if (request.kind === 'path') {
567
- const ask = pathAddress(request);
568
- if (ask === null)
569
- return { kind: 'room-not-readable', locator: request.locator };
570
- return downloaded(ask, request.locator);
571
- }
572
- const referrer = houseReferrer(request.referrer, tracked);
573
- if (referrer === null) {
574
- return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
575
- }
576
- return downloaded(() => transport.door(DOOR_FILES_GET, { file: request.fileRef, referrer: referrer.referrer }), referrer.locator);
558
+ const ask = pathAddress(request);
559
+ if (ask === null)
560
+ return { kind: 'room-not-readable', locator: request.locator };
561
+ return downloaded(ask, request.locator);
577
562
  },
578
563
  async link(_authorization, request) {
579
564
  const ask = pathAddress(request);
@@ -581,13 +566,6 @@ export function createAgentsHouseAdapter(options) {
581
566
  return { kind: 'room-not-readable', locator: request.locator };
582
567
  return linked(await ask(), request.locator);
583
568
  },
584
- referrerScope(referrer) {
585
- const held = houseReferrer(referrer, tracked);
586
- if (held === null)
587
- return null;
588
- const { path } = held.referrer;
589
- return { locator: held.locator, ...(path === undefined ? {} : { path }) };
590
- },
591
569
  reached(locator, version, target) {
592
570
  return reachedVersion(version, target, authorityFor(locator)?.logEpoch);
593
571
  },
@@ -600,7 +578,10 @@ export function createAgentsHouseAdapter(options) {
600
578
  roomStream: {
601
579
  hold: held,
602
580
  reopen: notifications.reopen,
603
- observe: notifications.observe,
581
+ observe(notify, receipts, revisions) {
582
+ heldRevisions = revisions;
583
+ return notifications.observe(notify, receipts);
584
+ },
604
585
  published(locator, roomVersion) {
605
586
  const at = logPosition(roomVersion);
606
587
  if (at !== null)
package/dist/digest.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare function textBytes(value: string): number;
2
- export declare function sha256Hex(value: string | ArrayBuffer): Promise<string>;
2
+ export declare function sha256Hex(value: string): Promise<string>;
3
3
  //# sourceMappingURL=digest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../src/digest.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAsB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAM5E"}
1
+ {"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../src/digest.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAsB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG9D"}
package/dist/digest.js CHANGED
@@ -2,6 +2,6 @@ export function textBytes(value) {
2
2
  return new TextEncoder().encode(value).length;
3
3
  }
4
4
  export async function sha256Hex(value) {
5
- const digest = await crypto.subtle.digest('SHA-256', typeof value === 'string' ? new TextEncoder().encode(value) : value);
5
+ const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(value));
6
6
  return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, '0')).join('');
7
7
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
2
- export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
2
+ export { finishedUpload, houseUpload, type HouseUpload } from './upload.js';
3
+ export { HISTORY_PAGE, HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS, TRIGGER_ROOMS, } from './actions.js';
3
4
  export { HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, INBOX_CHAT_TYPE, INBOX_MESSAGE_TYPE, type InboxChannelKind, } from './room-types.js';
4
5
  export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EACL,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { createAgentsHouseAdapter } from './adapter.js';
2
- export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
2
+ export { finishedUpload, houseUpload } from './upload.js';
3
+ export { HISTORY_PAGE, HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS, TRIGGER_ROOMS, } from './actions.js';
3
4
  export { HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, INBOX_CHAT_TYPE, INBOX_MESSAGE_TYPE, } from './room-types.js';
package/dist/part.d.ts CHANGED
@@ -7,7 +7,9 @@ export type HousePart = {
7
7
  sha256: string;
8
8
  };
9
9
  export declare function parsePart(value: unknown): HousePart | null;
10
- export declare function checkedPayload(body: unknown, listed: HousePart): Promise<Uint8Array<ArrayBuffer> | null>;
11
- export declare function gunzipped(payload: Uint8Array<ArrayBuffer>): Promise<string | null>;
10
+ export declare function partArrival(listed: HousePart, arriving: ((bytes: number) => void) | undefined): ((answered: number) => void) | undefined;
11
+ export declare function partFrame(body: unknown): Uint8Array<ArrayBuffer> | null;
12
+ export declare function checkedPayload(frame: Uint8Array<ArrayBuffer>, listed: HousePart): Promise<Uint8Array<ArrayBuffer> | null>;
13
+ export declare function gunzipped(payload: Uint8Array<ArrayBuffer>): ReadableStream<string>;
12
14
  export declare function unverifiedPart(locator: string): ScopedRefusal;
13
15
  //# sourceMappingURL=part.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"part.d.ts","sourceRoot":"","sources":["../src/part.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAO1D;AAoBD,wBAAsB,cAAc,CAClC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAiBzC;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOxF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAS7D"}
1
+ {"version":3,"file":"part.d.ts","sourceRoot":"","sources":["../src/part.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAO1D;AAoBD,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,GAC9C,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAG1C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAIvE;AAED,wBAAsB,cAAc,CAClC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,EAC9B,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAazC;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAKlF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAS7D"}
package/dist/part.js CHANGED
@@ -35,14 +35,19 @@ function hex(bytes) {
35
35
  text += byte.toString(16).padStart(2, '0');
36
36
  return text;
37
37
  }
38
- export async function checkedPayload(body, listed) {
38
+ export function partArrival(listed, arriving) {
39
+ if (arriving === undefined)
40
+ return undefined;
41
+ return (answered) => arriving(Math.min(listed.bytes, Math.floor((answered * 3) / 4)));
42
+ }
43
+ export function partFrame(body) {
39
44
  if (typeof body !== 'object' || body === null)
40
45
  return null;
41
46
  const { part } = body;
42
- if (typeof part !== 'string')
43
- return null;
44
- const frame = decoded(part);
45
- if (frame === null || frame.length !== listed.bytes)
47
+ return typeof part === 'string' ? decoded(part) : null;
48
+ }
49
+ export async function checkedPayload(frame, listed) {
50
+ if (frame.length !== listed.bytes)
46
51
  return null;
47
52
  if (frame.length < PART_HEAD_BYTES + PART_DIGEST_BYTES)
48
53
  return null;
@@ -59,14 +64,11 @@ export async function checkedPayload(body, listed) {
59
64
  }
60
65
  return payload;
61
66
  }
62
- export async function gunzipped(payload) {
63
- try {
64
- const stream = new Blob([payload]).stream().pipeThrough(new DecompressionStream('gzip'));
65
- return await new Response(stream).text();
66
- }
67
- catch {
68
- return null;
69
- }
67
+ export function gunzipped(payload) {
68
+ return new Blob([payload])
69
+ .stream()
70
+ .pipeThrough(new DecompressionStream('gzip'))
71
+ .pipeThrough(new TextDecoderStream());
70
72
  }
71
73
  export function unverifiedPart(locator) {
72
74
  return {
package/dist/read.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type AdapterFailure, type BinaryFile, type BootstrapPage, type RefreshResult, type TransportUncertainty } from '@agentshouse/mdruntime';
1
+ import { type AdapterFailure, type BinaryFile, type BootstrapInventory, type BootstrapPage, type RefreshResult, type TransportUncertainty } from '@agentshouse/mdruntime';
2
2
  import type { TrackedAuthority } from './discovery.js';
3
3
  import { type HousePart } from './part.js';
4
4
  import type { HouseMode } from './transport.js';
@@ -11,10 +11,13 @@ export type Answered = {
11
11
  readonly changes: Map<string, HeadChange>;
12
12
  readonly binaryFiles: Map<string, BinaryFile>;
13
13
  readonly removals: Set<string>;
14
+ readonly folders: Set<string>;
15
+ readonly folderRemovals: Set<string>;
14
16
  };
15
17
  export declare function answering(): Answered;
16
18
  export declare function revised(answer: Answered, path: string, revision: string): void;
17
19
  export declare function forgotten(answer: Answered, path: string): void;
20
+ export declare function folded(answer: Answered, path: string, removed: boolean): void;
18
21
  export declare function answered(answer: Answered): Generator<number, {
19
22
  documents: Readonly<Record<string, string>>;
20
23
  revisions: Readonly<Record<string, string>>;
@@ -22,6 +25,8 @@ export declare function answered(answer: Answered): Generator<number, {
22
25
  changes: Readonly<Record<string, HeadChange>>;
23
26
  binaryFiles: Readonly<Record<string, BinaryFile>>;
24
27
  removals: readonly string[];
28
+ folders?: readonly string[];
29
+ folderRemovals?: readonly string[];
25
30
  }, void>;
26
31
  export type HouseManifestFile = {
27
32
  path: string;
@@ -39,6 +44,7 @@ export type HouseScope = LogPosition & {
39
44
  anchor: string;
40
45
  files: readonly HouseManifestFile[];
41
46
  contents: readonly HouseContent[];
47
+ folders?: readonly string[];
42
48
  };
43
49
  export type HouseRoomParts = LogPosition & {
44
50
  anchor: string;
@@ -56,6 +62,7 @@ export type HouseFileAddress = {
56
62
  url: string;
57
63
  name: string;
58
64
  sha256: string;
65
+ mediaType: string;
59
66
  };
60
67
  export type HouseChange = {
61
68
  path: string;
@@ -78,9 +85,14 @@ export type HousePage = {
78
85
  through: string;
79
86
  read: number;
80
87
  };
88
+ export type HouseFolder = {
89
+ path: string;
90
+ removed: boolean;
91
+ };
81
92
  export type HouseView = LogPosition & {
82
93
  authority: string;
83
94
  changes: readonly HouseChange[];
95
+ folders?: readonly HouseFolder[];
84
96
  next?: HousePage;
85
97
  };
86
98
  type PageFailure = AdapterFailure | {
@@ -100,11 +112,12 @@ export declare function headChange(held: {
100
112
  export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
101
113
  export declare function parseParted(body: unknown): HouseParted | null;
102
114
  export declare function parseSiteParted(body: unknown): HouseRoomParts | null;
115
+ export declare function partInventory(room: HouseRoomParts): BootstrapInventory;
116
+ export declare function manifested(room: HouseRoomParts, inventory: BootstrapInventory, pageToken: string): BootstrapPage;
103
117
  export declare function emptyScope(room: HouseRoomParts): HouseScope;
104
- export declare function housePart(room: HouseRoomParts, body: unknown, listed: HousePart, mode: HouseMode): Promise<HouseScope | TransportUncertainty | null>;
118
+ export declare function housePart(room: HouseRoomParts, frame: Uint8Array<ArrayBuffer>, listed: HousePart, mode: HouseMode): Promise<HouseScope | TransportUncertainty | null>;
105
119
  export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
106
120
  export declare function wholeView(first: HouseView, more: (page: HousePage) => Promise<HouseView | PageFailure>): Promise<HouseView | PageFailure>;
107
- export declare function advancedScope(scope: HouseScope, view: HouseView): Generator<number, HouseScope, void>;
108
121
  export declare function bootstrapping(scope: HouseScope): Generator<number, BootstrapPage, void>;
109
122
  export type HouseSchema = {
110
123
  schema: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot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