@agentshouse/mdruntime-adapter 0.1.0-cd23c45caa798 → 0.1.0-cd36fe2bc9d48

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,60 +1,48 @@
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, 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';
15
+ import { HOUSE_ROOM_TYPES } from './room-types.js';
16
16
  import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
17
17
  const UNCERTAIN = { kind: 'transport-uncertainty' };
18
18
  const UNCERTAIN_READ = { kind: 'transport-uncertainty' };
19
+ const EXPIRED_ADDRESS = 403;
19
20
  function lapsedGrant(outcome) {
20
21
  return outcome.kind === 'rejected' && outcome.code === 'upload_unavailable';
21
22
  }
22
- const heldPaths = new WeakMap();
23
- async function sortedHeld(held) {
24
- const known = heldPaths.get(held.documents);
25
- if (known !== undefined)
26
- return known;
27
- const sorted = await stepped(sortedKeys(held.documents));
28
- heldPaths.set(held.documents, sorted);
29
- return sorted;
30
- }
31
- function heldFiles(authority, held, paths, bound) {
32
- const files = [];
33
- let through = null;
34
- for (let at = 0; at < paths.length && through === null; at += 1) {
35
- const revision = held.revisions[paths[at]];
36
- if (revision === undefined)
37
- continue;
38
- if (files.length === bound)
39
- through = files.at(-1).path;
40
- else
41
- files.push({ path: paths[at], revision });
42
- }
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;
43
27
  return files.length === 0 ? null : { room: authority, through, files };
44
28
  }
45
29
  async function reused(scope, held) {
46
30
  const sent = new Set(scope.contents.map((entry) => entry.path));
47
31
  const contents = [...scope.contents];
48
- for (const file of scope.files) {
49
- if (file.binary !== undefined || sent.has(file.path))
50
- continue;
51
- const content = held?.documents[file.path];
52
- if (content === undefined ||
53
- held?.revisions[file.path] !== file.revision ||
54
- (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) {
55
43
  return null;
56
44
  }
57
- contents.push({ path: file.path, content });
45
+ contents.push({ path: file.path, content: found.content });
58
46
  }
59
47
  return { ...scope, contents };
60
48
  }
@@ -65,51 +53,55 @@ export function createAgentsHouseAdapter(options) {
65
53
  const notifications = houseNotifications(transport, 'credential');
66
54
  const tracked = new Map();
67
55
  const handed = new Map();
56
+ let heldRevisions;
68
57
  let bounds;
69
58
  function declared() {
70
59
  if (bounds === undefined)
71
60
  throw new Error('no Discovery declared the bounds');
72
61
  return bounds;
73
62
  }
74
- function hand(locator, steps) {
75
- const held = handed.get(locator);
76
- const next = stepped(steps);
77
- if (!(next instanceof Promise)) {
78
- handed.set(locator, next);
79
- 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 };
80
69
  }
81
- return next.then((room) => {
82
- if (handed.get(locator) === held)
83
- handed.set(locator, room);
84
- else
85
- handed.delete(locator);
86
- });
87
- }
88
- async function fetchedPart(entry, continued, listed) {
89
70
  for (let attempt = 0; attempt < PART_ATTEMPTS; attempt += 1) {
90
71
  const answered = await transport.door(DOOR_BOOTSTRAP, {
91
72
  prefixes: [authorityRoot(entry.handle)],
92
73
  part: listed.part,
93
74
  ...(continued.held === undefined ? {} : { held: [continued.held] }),
94
- });
75
+ }, partArrival(listed, arriving));
95
76
  const failure = classifyRead(answered.status, answered.body, entry.locator);
96
77
  if (failure !== null)
97
78
  return failure;
98
- 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');
99
83
  if (scope !== null)
100
- return scope;
84
+ return 'kind' in scope ? scope : { scope, frame };
101
85
  }
102
86
  return unverifiedPart(entry.locator);
103
87
  }
104
- 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) {
105
97
  const { entry } = asked;
106
98
  const listed = continued.room.parts[continued.next];
107
99
  const sent = listed === undefined
108
- ? emptyScope(continued.room)
109
- : await fetchedPart(entry, continued, listed);
100
+ ? { scope: emptyScope(continued.room), frame: null }
101
+ : await fetchedPart(entry, continued, listed, received, arriving);
110
102
  if ('kind' in sent)
111
103
  return sent;
112
- const scope = await reused(sent, asked.held);
104
+ const scope = await reused(sent.scope, asked.held);
113
105
  if (scope === null) {
114
106
  return asked.held === undefined
115
107
  ? UNCERTAIN_READ
@@ -118,7 +110,7 @@ export function createAgentsHouseAdapter(options) {
118
110
  const next = continued.next + 1;
119
111
  const more = next < continued.room.parts.length;
120
112
  if (continued.next === 0 && !more)
121
- await hand(entry.locator, scopeHanded(scope));
113
+ handed.set(entry.locator, roomVersion(scope));
122
114
  else
123
115
  handed.delete(entry.locator);
124
116
  notifications.reach(entry.authority, scope);
@@ -131,6 +123,7 @@ export function createAgentsHouseAdapter(options) {
131
123
  ...(await stepped(bootstrapping(scope))),
132
124
  ...(models === undefined ? {} : { models }),
133
125
  ...(more ? { pageToken: JSON.stringify({ ...continued, next, seen }) } : {}),
126
+ ...(sent.frame === null ? {} : { received: sent.frame }),
134
127
  };
135
128
  }
136
129
  async function enumeratedPage(ask, page) {
@@ -162,18 +155,21 @@ export function createAgentsHouseAdapter(options) {
162
155
  const answer = await refreshFrom(view, ask.fromRoomVersion);
163
156
  if (answer.kind !== 'net-advancement')
164
157
  return answer;
165
- await hand(ask.entry.locator, enumeratedHanded(view, handed.get(ask.entry.locator)));
158
+ handed.set(ask.entry.locator, roomVersion(view));
166
159
  const models = await viewModels(view, ask.entry);
167
160
  return models === undefined ? answer : { ...answer, models };
168
161
  }
169
162
  async function streamed(entry, request, from) {
170
- const held = handed.get(entry.locator);
171
- if (held?.roomVersion !== request.fromRoomVersion)
163
+ if (handed.get(entry.locator) !== request.fromRoomVersion)
172
164
  return null;
173
- 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));
174
170
  if (advanced === null)
175
171
  return null;
176
- await hand(entry.locator, streamedHanded(held, advanced));
172
+ handed.set(entry.locator, advanced.page.roomVersion);
177
173
  const models = await streamedModels(advanced.schemas, entry, 'credential');
178
174
  return models === undefined ? advanced.page : { ...advanced.page, models };
179
175
  }
@@ -183,7 +179,7 @@ export function createAgentsHouseAdapter(options) {
183
179
  const at = logPosition(room.roomVersion);
184
180
  if (entry === undefined || at === null)
185
181
  return [];
186
- handed.set(room.locator, heldHanded(room));
182
+ handed.set(room.locator, room.roomVersion);
187
183
  notifications.reach(entry.authority, at);
188
184
  return [presented(entry.authority, at)];
189
185
  });
@@ -201,8 +197,9 @@ export function createAgentsHouseAdapter(options) {
201
197
  const held = handed.get(entry.locator);
202
198
  if (held === undefined)
203
199
  return outcome;
204
- const follows = followsVersion(held.roomVersion, outcome.roomVersion);
205
- 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);
206
203
  const at = logPosition(outcome.roomVersion);
207
204
  if (follows && at !== null)
208
205
  notifications.reach(entry.authority, at);
@@ -231,8 +228,7 @@ export function createAgentsHouseAdapter(options) {
231
228
  for (const ask of asks) {
232
229
  if (ask.held === undefined || bound === 0)
233
230
  continue;
234
- const paths = await sortedHeld(ask.held);
235
- const files = heldFiles(ask.entry.authority, ask.held, paths, bound);
231
+ const files = await heldFiles(ask.entry.authority, ask.held, bound);
236
232
  if (files !== null)
237
233
  held.push(files);
238
234
  }
@@ -270,7 +266,7 @@ export function createAgentsHouseAdapter(options) {
270
266
  continue;
271
267
  }
272
268
  const kept = held.find((files) => files.room === asked.entry.authority);
273
- answer(asked.ask, await partPage(asked.asked, {
269
+ answer(asked.ask, await manifestPage(asked.asked, {
274
270
  room,
275
271
  next: 0,
276
272
  seen: [],
@@ -342,7 +338,7 @@ export function createAgentsHouseAdapter(options) {
342
338
  };
343
339
  }
344
340
  const grant = parseGrant(minted.body);
345
- if (grant === null || grant.method !== 'POST')
341
+ if (grant === null)
346
342
  return { outcome: UNCERTAIN };
347
343
  const delivered = await transport.transfer({
348
344
  act: 'authored_batch_upload',
@@ -352,36 +348,31 @@ export function createAgentsHouseAdapter(options) {
352
348
  if (delivered.status !== 200)
353
349
  return { outcome: UNCERTAIN };
354
350
  const holding = parseGrant(delivered.body);
355
- if (holding === null || holding.method !== 'POST')
351
+ if (holding === null)
356
352
  return { outcome: UNCERTAIN };
357
353
  const upload = { url: holding.url, operation: holding.operation, bytes, sha256 };
358
354
  await keep(upload);
359
355
  return { body: { ...head, paths, upload, runtime: notifications.runtime } };
360
356
  }
361
- async function staged(answer, batch) {
357
+ async function staged(answer, { changeBatch: batch, file }) {
362
358
  const refusal = doorRefusal(answer.body);
363
359
  if (refusal?.code !== 'files_unstaged')
364
360
  return null;
365
- const grants = refusal.fields.upload;
366
- if (!Array.isArray(grants))
361
+ const uploads = refusal.fields.upload;
362
+ if (!Array.isArray(uploads))
367
363
  return false;
368
- for (const grant of grants) {
369
- const { url, operation, sha256 } = grant;
370
- const change = batch.changes.find((held) => held.kind === 'binary' && held.sha256 === sha256);
371
- 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)
372
368
  return false;
373
- const delivered = await transport.transfer({
374
- act: 'binary_stage',
375
- url,
376
- body: change.blob,
377
- operation,
378
- });
379
- if (delivered.status !== 200)
369
+ const finished = await finishedUpload(transport, upload, await file(change.localId));
370
+ if (finished?.body?.staged !== true)
380
371
  return false;
381
372
  }
382
373
  return true;
383
374
  }
384
- async function submit(batch, head, changes, delta, bytes, entry, handed, keep, into) {
375
+ async function submit(request, head, changes, delta, bytes, entry, handed, keep, into) {
385
376
  const inline = { ...head, changes, runtime: notifications.runtime };
386
377
  const prepared = uploadable(inline, bytes, declared())
387
378
  ? await uploaded(head, changes, delta, bytes, entry, handed, keep)
@@ -389,11 +380,11 @@ export function createAgentsHouseAdapter(options) {
389
380
  if ('outcome' in prepared)
390
381
  return prepared.outcome;
391
382
  const answer = await transport.door(DOOR_BATCH, prepared.body);
392
- const stagedFiles = await staged(answer, batch);
383
+ const stagedFiles = await staged(answer, request);
393
384
  if (stagedFiles === false)
394
385
  return UNCERTAIN;
395
386
  const settled = stagedFiles === null ? answer : await transport.door(DOOR_BATCH, prepared.body);
396
- if (stagedFiles === true && (await staged(settled, batch)) !== null)
387
+ if (stagedFiles === true && (await staged(settled, request)) !== null)
397
388
  return UNCERTAIN;
398
389
  return stepped(mutationOutcome(settled.status, settled.body, entry.locator, entry.handle, into === undefined
399
390
  ? undefined
@@ -402,7 +393,7 @@ export function createAgentsHouseAdapter(options) {
402
393
  destination: { authority: into.authority, handle: into.handle },
403
394
  }));
404
395
  }
405
- function granted(answer, locator) {
396
+ function addressed(answer, locator) {
406
397
  const failure = classifyDoor(answer.status, answer.body, locator);
407
398
  if (failure !== null) {
408
399
  return failure.kind === 'scoped-refusal'
@@ -414,33 +405,47 @@ export function createAgentsHouseAdapter(options) {
414
405
  }
415
406
  : failure;
416
407
  }
417
- const grant = parseGrant(answer.body);
418
- const name = answer.body.name;
419
- if (grant === null || grant.method !== 'GET' || typeof name !== 'string') {
420
- return UNCERTAIN_READ;
421
- }
422
- return { kind: 'link', url: grant.url, name };
408
+ const address = parseFileAddress(answer.body);
409
+ return address === null ? UNCERTAIN_READ : { kind: 'address', ...address };
410
+ }
411
+ function linked(answer, locator) {
412
+ const address = addressed(answer, locator);
413
+ return address.kind === 'address'
414
+ ? { kind: 'link', url: address.url, name: address.name }
415
+ : address;
423
416
  }
424
- async function downloaded(answer, locator) {
425
- const link = granted(answer, locator);
426
- if (link.kind !== 'link')
427
- return link;
428
- const read = await transport.download(link.url);
429
- if (read.status !== 200 || read.blob === null)
417
+ async function downloaded(ask, locator) {
418
+ let address = addressed(await ask(), locator);
419
+ if (address.kind !== 'address')
420
+ return address;
421
+ let read = await transport.download(address.url);
422
+ if (read.status === EXPIRED_ADDRESS) {
423
+ address = addressed(await ask(), locator);
424
+ if (address.kind !== 'address')
425
+ return address;
426
+ read = await transport.download(address.url);
427
+ }
428
+ if (read.status !== 200 || read.body === null)
430
429
  return UNCERTAIN_READ;
431
- return { kind: 'binary', blob: read.blob };
430
+ return {
431
+ kind: 'binary',
432
+ body: read.body,
433
+ mediaType: address.mediaType,
434
+ sha256: address.sha256,
435
+ };
432
436
  }
433
- function pathGrant(request) {
437
+ function pathAddress(request) {
434
438
  const entry = authorityFor(request.locator);
435
439
  if (entry === undefined)
436
440
  return null;
437
- return transport.door(DOOR_FILES_GET, {
441
+ return () => transport.door(DOOR_FILES_GET, {
438
442
  room_ref: entry.authority,
439
443
  path: request.path,
440
444
  revision: request.revision,
441
445
  });
442
446
  }
443
447
  return {
448
+ roomTypes: HOUSE_ROOM_TYPES,
444
449
  async authorize() {
445
450
  return options.authorize();
446
451
  },
@@ -490,7 +495,7 @@ export function createAgentsHouseAdapter(options) {
490
495
  return { kind: 'room-not-readable', locator: request.locator };
491
496
  const asked = { entry, held: request.held };
492
497
  if (request.pageToken !== undefined) {
493
- return partPage(asked, JSON.parse(request.pageToken));
498
+ return partPage(asked, JSON.parse(request.pageToken), request.received, request.arriving);
494
499
  }
495
500
  return bootstrapTogether(asked);
496
501
  },
@@ -527,7 +532,7 @@ export function createAgentsHouseAdapter(options) {
527
532
  const delta = deltaBody(mapped.changes);
528
533
  const bytes = deltaBytes(delta);
529
534
  const handed = request.upload;
530
- const answer = (upload) => submit(batch, head, mapped.changes, delta, bytes, entry, upload, keep, into);
535
+ const answer = (upload) => submit(request, head, mapped.changes, delta, bytes, entry, upload, keep, into);
531
536
  const settle = (outcome) => into === undefined ? adopted(entry, outcome) : adoptedMove(entry, into, outcome);
532
537
  const outcome = await answer(handed);
533
538
  if (handed === undefined || !lapsedGrant(outcome))
@@ -550,34 +555,16 @@ export function createAgentsHouseAdapter(options) {
550
555
  });
551
556
  },
552
557
  async binary(_authorization, request) {
553
- if (request.kind === 'path') {
554
- const asked = pathGrant(request);
555
- if (asked === null)
556
- return { kind: 'room-not-readable', locator: request.locator };
557
- return downloaded(await asked, request.locator);
558
- }
559
- const referrer = houseReferrer(request.referrer, tracked);
560
- if (referrer === null) {
561
- return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
562
- }
563
- const answer = await transport.door(DOOR_FILES_GET, {
564
- file: request.fileRef,
565
- referrer: referrer.referrer,
566
- });
567
- return downloaded(answer, 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);
568
562
  },
569
563
  async link(_authorization, request) {
570
- const asked = pathGrant(request);
571
- if (asked === null)
564
+ const ask = pathAddress(request);
565
+ if (ask === null)
572
566
  return { kind: 'room-not-readable', locator: request.locator };
573
- return granted(await asked, request.locator);
574
- },
575
- referrerScope(referrer) {
576
- const held = houseReferrer(referrer, tracked);
577
- if (held === null)
578
- return null;
579
- const { path } = held.referrer;
580
- return { locator: held.locator, ...(path === undefined ? {} : { path }) };
567
+ return linked(await ask(), request.locator);
581
568
  },
582
569
  reached(locator, version, target) {
583
570
  return reachedVersion(version, target, authorityFor(locator)?.logEpoch);
@@ -591,7 +578,10 @@ export function createAgentsHouseAdapter(options) {
591
578
  roomStream: {
592
579
  hold: held,
593
580
  reopen: notifications.reopen,
594
- observe: notifications.observe,
581
+ observe(notify, receipts, revisions) {
582
+ heldRevisions = revisions;
583
+ return notifications.observe(notify, receipts);
584
+ },
595
585
  published(locator, roomVersion) {
596
586
  const at = logPosition(roomVersion);
597
587
  if (at !== null)
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
2
+ export { finishedUpload, houseUpload, type HouseUpload } from './upload.js';
2
3
  export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
4
+ export { HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, INBOX_CHAT_TYPE, INBOX_MESSAGE_TYPE, type InboxChannelKind, } from './room-types.js';
3
5
  export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
4
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,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,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"}
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
1
  export { createAgentsHouseAdapter } from './adapter.js';
2
+ export { finishedUpload, houseUpload } from './upload.js';
2
3
  export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
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>;
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>;
11
13
  export declare function gunzipped(payload: Uint8Array<ArrayBuffer>): Promise<string | null>;
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,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"}
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;
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;
@@ -49,13 +55,15 @@ export type HouseParted = {
49
55
  next?: string;
50
56
  };
51
57
  export type HouseGrant = {
52
- method: 'GET';
53
- url: string;
54
- } | {
55
- method: 'POST';
56
58
  operation: string;
57
59
  url: string;
58
60
  };
61
+ export type HouseFileAddress = {
62
+ url: string;
63
+ name: string;
64
+ sha256: string;
65
+ mediaType: string;
66
+ };
59
67
  export type HouseChange = {
60
68
  path: string;
61
69
  removed: true;
@@ -77,9 +85,14 @@ export type HousePage = {
77
85
  through: string;
78
86
  read: number;
79
87
  };
88
+ export type HouseFolder = {
89
+ path: string;
90
+ removed: boolean;
91
+ };
80
92
  export type HouseView = LogPosition & {
81
93
  authority: string;
82
94
  changes: readonly HouseChange[];
95
+ folders?: readonly HouseFolder[];
83
96
  next?: HousePage;
84
97
  };
85
98
  type PageFailure = AdapterFailure | {
@@ -91,6 +104,7 @@ export type HouseEnumeration = {
91
104
  export declare function authorityRoot(handle: string): string;
92
105
  export declare function schemaPath(handle: string, schema: string): string;
93
106
  export declare function parseGrant(body: unknown): HouseGrant | null;
107
+ export declare function parseFileAddress(body: unknown): HouseFileAddress | null;
94
108
  export declare function headChange(held: {
95
109
  readonly author?: unknown;
96
110
  readonly created_at?: unknown;
@@ -98,11 +112,12 @@ export declare function headChange(held: {
98
112
  export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
99
113
  export declare function parseParted(body: unknown): HouseParted | null;
100
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;
101
117
  export declare function emptyScope(room: HouseRoomParts): HouseScope;
102
- 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>;
103
119
  export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
104
120
  export declare function wholeView(first: HouseView, more: (page: HousePage) => Promise<HouseView | PageFailure>): Promise<HouseView | PageFailure>;
105
- export declare function advancedScope(scope: HouseScope, view: HouseView): Generator<number, HouseScope, void>;
106
121
  export declare function bootstrapping(scope: HouseScope): Generator<number, BootstrapPage, void>;
107
122
  export type HouseSchema = {
108
123
  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