@agentshouse/mdruntime-adapter 0.1.0-cacce09fc82c6 → 0.1.0-cb42b23b5d2fb

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,14 +1,15 @@
1
1
  import { DISCOVER_PREFIXES, capabilities, discoveredRoom, mapDiscovery, parseDiscovery, trackedFrom, } from './discovery.js';
2
- import { scopeModels, streamedModels, viewModels } from './model.js';
3
- import { gathered, selections } from './gather.js';
2
+ import { partModels, streamedModels, viewModels } from './model.js';
3
+ import { gathered, gatheredEach, selections } from './gather.js';
4
4
  import { createSiteAdapter } from './site.js';
5
5
  import { bootstrapOf, contentPrefixes, matchesScope, parseEnumeration, parseEnvelope, parseGrant, refreshFrom, viewOf, } from './read.js';
6
- import { acceptedLinks, enumeratedLinks, heldLinks, scopeLinks, streamedLinks, } from './links.js';
6
+ import { acceptedHanded, enumeratedHanded, heldHanded, scopeHanded, streamedHanded, } from './handed.js';
7
7
  import { houseAction } from './actions.js';
8
8
  import { classifyDoor, classifyRead, discoveryFailure, doorRefusal } from './refusal.js';
9
9
  import { houseNotifications } from './stream.js';
10
- import { DOOR_BATCH, DOOR_BATCH_UPLOAD, DOOR_BOOTSTRAP, DOOR_DISCOVER, DOOR_ENUMERATE, DOOR_REVISIONS, } from './transport.js';
10
+ import { DOOR_BATCH, DOOR_BATCH_UPLOAD, DOOR_BOOTSTRAP, DOOR_DISCOVER, DOOR_ENUMERATE, DOOR_FILES_GET, DOOR_REVISIONS, } from './transport.js';
11
11
  import { batchPaths, deltaBody, deltaBytes, deltaDigest, historyOutcome, houseChanges, mutationOutcome, operationHead, rejectedMapping, revisionBody, uploadable, } from './write.js';
12
+ import { houseReferrer } from './referrer.js';
12
13
  import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
13
14
  const UNCERTAIN = { kind: 'transport-uncertainty' };
14
15
  const UNCERTAIN_READ = { kind: 'transport-uncertainty' };
@@ -28,14 +29,26 @@ export function createAgentsHouseAdapter(options) {
28
29
  throw new Error('no Discovery declared the bounds');
29
30
  return bounds;
30
31
  }
31
- async function bootstrappedRoom(envelope, entry) {
32
- const scope = envelope.scopes.find((candidate) => matchesScope(candidate, entry));
32
+ async function bootstrappedRoom(envelope, scope, entry, continued) {
33
33
  if (scope === undefined)
34
34
  return { kind: 'room-not-readable', locator: entry.locator };
35
- handed.set(entry.locator, scopeLinks(scope));
35
+ const next = envelope.next?.room === entry.authority ? envelope.next.path : null;
36
+ if (continued === null && next === null)
37
+ handed.set(entry.locator, scopeHanded(scope));
38
+ else
39
+ handed.delete(entry.locator);
36
40
  notifications.reach(entry.authority, scope);
37
- const models = await scopeModels(scope, entry);
38
- return { ...bootstrapOf(scope), ...(models === undefined ? {} : { models }) };
41
+ const seen = [
42
+ ...(continued?.seen ?? []),
43
+ ...entry.schemas.filter((schema) => scope.files.some((file) => file.path === schema)),
44
+ ];
45
+ const models = await partModels(scope, entry, new Set(seen), next === null);
46
+ const continuation = next === null ? null : { after: next, seen };
47
+ return {
48
+ ...bootstrapOf(scope),
49
+ ...(models === undefined ? {} : { models }),
50
+ ...(continuation === null ? {} : { pageToken: JSON.stringify(continuation) }),
51
+ };
39
52
  }
40
53
  async function enumeratedRoom(enumeration, ask) {
41
54
  const view = viewOf(enumeration, ask.entry);
@@ -45,21 +58,18 @@ export function createAgentsHouseAdapter(options) {
45
58
  const answer = refreshFrom(view, ask.fromRoomVersion);
46
59
  if (answer.kind !== 'net-advancement')
47
60
  return answer;
48
- handed.set(ask.entry.locator, enumeratedLinks(view, handed.get(ask.entry.locator)));
61
+ handed.set(ask.entry.locator, enumeratedHanded(view, handed.get(ask.entry.locator)));
49
62
  const models = await viewModels(view, ask.entry);
50
63
  return models === undefined ? answer : { ...answer, models };
51
64
  }
52
65
  async function streamed(entry, request, from) {
53
- const links = handed.get(entry.locator);
54
- if (links?.roomVersion !== request.fromRoomVersion)
66
+ const held = handed.get(entry.locator);
67
+ if (held?.roomVersion !== request.fromRoomVersion)
55
68
  return null;
56
- const advanced = notifications.advance(entry, from, (path, revision) => links.revisions.get(path) === revision);
69
+ const advanced = notifications.advance(entry, from, (path, revision) => held.revisions.get(path) === revision);
57
70
  if (advanced === null)
58
71
  return null;
59
- const relinked = streamedLinks(links, advanced);
60
- if (relinked === null)
61
- return null;
62
- handed.set(entry.locator, relinked);
72
+ handed.set(entry.locator, streamedHanded(held, advanced));
63
73
  const models = await streamedModels(advanced.schemas, entry, 'credential');
64
74
  return models === undefined ? advanced.page : { ...advanced.page, models };
65
75
  }
@@ -69,7 +79,7 @@ export function createAgentsHouseAdapter(options) {
69
79
  const at = logPosition(room.roomVersion);
70
80
  if (entry === undefined || at === null)
71
81
  return [];
72
- handed.set(room.locator, heldLinks(room));
82
+ handed.set(room.locator, heldHanded(room));
73
83
  notifications.reach(entry.authority, at);
74
84
  return [presented(entry.authority, at)];
75
85
  });
@@ -78,19 +88,15 @@ export function createAgentsHouseAdapter(options) {
78
88
  function adopted(entry, outcome) {
79
89
  if (outcome.kind !== 'accepted')
80
90
  return outcome;
81
- const { originals, ...accepted } = outcome;
82
- const links = handed.get(entry.locator);
83
- if (links === undefined)
84
- return accepted;
85
- const follows = followsVersion(links.roomVersion, accepted.roomVersion);
86
- const relinked = acceptedLinks(links, accepted, follows ? accepted.roomVersion : links.roomVersion, originals);
87
- handed.set(entry.locator, relinked.links);
88
- const at = logPosition(accepted.roomVersion);
91
+ const held = handed.get(entry.locator);
92
+ if (held === undefined)
93
+ return outcome;
94
+ const follows = followsVersion(held.roomVersion, outcome.roomVersion);
95
+ handed.set(entry.locator, acceptedHanded(held, outcome, follows ? outcome.roomVersion : held.roomVersion));
96
+ const at = logPosition(outcome.roomVersion);
89
97
  if (follows && at !== null)
90
98
  notifications.reach(entry.authority, at);
91
- return relinked.attachments === undefined
92
- ? accepted
93
- : { ...accepted, attachments: relinked.attachments };
99
+ return outcome;
94
100
  }
95
101
  function authorityFor(locator) {
96
102
  return tracked.get(locator);
@@ -109,41 +115,54 @@ export function createAgentsHouseAdapter(options) {
109
115
  return result;
110
116
  return { ...result, at: { locator, roomVersion: roomVersion({ position, logEpoch }) } };
111
117
  }
112
- async function bundled(body) {
113
- const grant = parseGrant(body);
114
- if (grant === null)
115
- return body;
116
- if (grant.method !== 'GET')
117
- return null;
118
- const answer = await transport.transfer({
119
- act: 'local_copy_bundle',
120
- method: 'GET',
121
- url: grant.url,
122
- answer: 'json',
123
- });
124
- return answer.status === 200 ? answer.body : null;
125
- }
126
118
  function weight(entry) {
127
119
  return contentPrefixes(entry).length;
128
120
  }
129
- async function bootstrapped(entries) {
130
- const answers = [];
131
- for (const part of selections(entries, weight, declared().max_prefixes)) {
132
- const answer = await transport.door(DOOR_BOOTSTRAP, {
133
- prefixes: part.flatMap((entry) => contentPrefixes(entry)),
134
- });
135
- const classified = part.map((entry) => classifyDoor(answer.status, answer.body, entry.locator));
136
- const envelope = classified[0] === null ? parseEnvelope(await bundled(answer.body)) : null;
137
- for (const [index, entry] of part.entries()) {
138
- const failure = classified[index];
139
- if (failure === null || failure === undefined) {
140
- answers.push(envelope === null ? UNCERTAIN_READ : await bootstrappedRoom(envelope, entry));
141
- continue;
121
+ async function bootstrapped(entries, answer) {
122
+ let open = entries.map((entry, ask) => ({ entry, ask }));
123
+ while (open.length > 0) {
124
+ const unreached = [];
125
+ for (const part of selections(open, ({ entry }) => weight(entry), declared().max_prefixes)) {
126
+ const answered = await transport.door(DOOR_BOOTSTRAP, {
127
+ prefixes: part.flatMap(({ entry }) => contentPrefixes(entry)),
128
+ });
129
+ const classified = part.map(({ entry }) => classifyDoor(answered.status, answered.body, entry.locator));
130
+ const envelope = classified[0] === null ? parseEnvelope(answered.body) : null;
131
+ for (const [index, asked] of part.entries()) {
132
+ const failure = classified[index];
133
+ if (failure !== null && failure !== undefined) {
134
+ answer(asked.ask, failure);
135
+ continue;
136
+ }
137
+ if (envelope === null) {
138
+ answer(asked.ask, UNCERTAIN_READ);
139
+ continue;
140
+ }
141
+ const scope = envelope.scopes.find((candidate) => matchesScope(candidate, asked.entry));
142
+ if (scope === undefined && envelope.next !== undefined) {
143
+ unreached.push(asked);
144
+ continue;
145
+ }
146
+ answer(asked.ask, await bootstrappedRoom(envelope, scope, asked.entry, null));
142
147
  }
143
- answers.push(failure);
144
148
  }
149
+ open = unreached;
145
150
  }
146
- return answers;
151
+ }
152
+ async function continuedBootstrap(entry, continued) {
153
+ const after = { room: entry.authority, path: continued.after };
154
+ const answered = await transport.door(DOOR_BOOTSTRAP, {
155
+ prefixes: contentPrefixes(entry),
156
+ after,
157
+ });
158
+ const failure = classifyDoor(answered.status, answered.body, entry.locator);
159
+ if (failure !== null)
160
+ return failure;
161
+ const envelope = parseEnvelope(answered.body);
162
+ if (envelope === null)
163
+ return UNCERTAIN_READ;
164
+ const scope = envelope.scopes.find((candidate) => matchesScope(candidate, entry));
165
+ return bootstrappedRoom(envelope, scope, entry, continued);
147
166
  }
148
167
  function layered(asks) {
149
168
  const depths = new Map();
@@ -190,7 +209,7 @@ export function createAgentsHouseAdapter(options) {
190
209
  }
191
210
  return asks.map((ask) => answers.get(ask) ?? UNCERTAIN_READ);
192
211
  }
193
- const bootstrapTogether = gathered(bootstrapped);
212
+ const bootstrapTogether = gatheredEach(bootstrapped);
194
213
  const enumerateTogether = gathered(enumerated);
195
214
  async function uploaded(head, changes, delta, bytes, entry, handed, keep) {
196
215
  const paths = batchPaths(changes);
@@ -207,9 +226,7 @@ export function createAgentsHouseAdapter(options) {
207
226
  return { outcome: UNCERTAIN };
208
227
  const delivered = await transport.transfer({
209
228
  act: 'authored_batch_upload',
210
- method: 'POST',
211
229
  url: grant.url,
212
- answer: 'json',
213
230
  body: `${grant.operation}\n${delta}`,
214
231
  });
215
232
  if (delivered.status !== 200)
@@ -221,7 +238,30 @@ export function createAgentsHouseAdapter(options) {
221
238
  await keep(upload);
222
239
  return { body: { ...head, paths, upload, runtime: notifications.runtime } };
223
240
  }
224
- async function submit(head, changes, delta, bytes, entry, handed, keep) {
241
+ async function staged(answer, batch) {
242
+ const refusal = doorRefusal(answer.body);
243
+ if (refusal?.code !== 'files_unstaged')
244
+ return null;
245
+ const grants = refusal.fields.upload;
246
+ if (!Array.isArray(grants))
247
+ return false;
248
+ for (const grant of grants) {
249
+ const { url, operation, sha256 } = grant;
250
+ const change = batch.changes.find((held) => held.kind === 'binary' && held.sha256 === sha256);
251
+ if (typeof url !== 'string' || typeof operation !== 'string' || change === undefined)
252
+ return false;
253
+ const delivered = await transport.transfer({
254
+ act: 'binary_stage',
255
+ url,
256
+ body: change.blob,
257
+ operation,
258
+ });
259
+ if (delivered.status !== 200)
260
+ return false;
261
+ }
262
+ return true;
263
+ }
264
+ async function submit(batch, head, changes, delta, bytes, entry, handed, keep) {
225
265
  const inline = { ...head, changes, runtime: notifications.runtime };
226
266
  const prepared = uploadable(inline, bytes, declared())
227
267
  ? await uploaded(head, changes, delta, bytes, entry, handed, keep)
@@ -229,7 +269,33 @@ export function createAgentsHouseAdapter(options) {
229
269
  if ('outcome' in prepared)
230
270
  return prepared.outcome;
231
271
  const answer = await transport.door(DOOR_BATCH, prepared.body);
232
- return mutationOutcome(answer.status, answer.body, entry.locator, entry.handle);
272
+ const stagedFiles = await staged(answer, batch);
273
+ if (stagedFiles === false)
274
+ return UNCERTAIN;
275
+ const settled = stagedFiles === null ? answer : await transport.door(DOOR_BATCH, prepared.body);
276
+ if (stagedFiles === true && (await staged(settled, batch)) !== null)
277
+ return UNCERTAIN;
278
+ return mutationOutcome(settled.status, settled.body, entry.locator, entry.handle);
279
+ }
280
+ async function downloaded(answer, locator) {
281
+ const failure = classifyDoor(answer.status, answer.body, locator);
282
+ if (failure !== null) {
283
+ return failure.kind === 'scoped-refusal'
284
+ ? {
285
+ kind: 'rejected',
286
+ code: failure.code,
287
+ fields: failure.fields,
288
+ retryable: failure.retryable,
289
+ }
290
+ : failure;
291
+ }
292
+ const grant = parseGrant(answer.body);
293
+ if (grant === null || grant.method !== 'GET')
294
+ return UNCERTAIN_READ;
295
+ const read = await transport.download(grant.url);
296
+ if (read.status !== 200 || read.blob === null)
297
+ return UNCERTAIN_READ;
298
+ return { kind: 'binary', blob: read.blob };
233
299
  }
234
300
  return {
235
301
  async authorize() {
@@ -261,8 +327,9 @@ export function createAgentsHouseAdapter(options) {
261
327
  const entry = authorityFor(request.locator);
262
328
  if (entry === undefined)
263
329
  return { kind: 'room-not-readable', locator: request.locator };
264
- if (request.pageToken !== undefined)
265
- return { kind: 'transport-uncertainty' };
330
+ if (request.pageToken !== undefined) {
331
+ return continuedBootstrap(entry, JSON.parse(request.pageToken));
332
+ }
266
333
  return bootstrapTogether(entry);
267
334
  },
268
335
  async refresh(_authorization, request) {
@@ -290,10 +357,11 @@ export function createAgentsHouseAdapter(options) {
290
357
  const delta = deltaBody(mapped.changes);
291
358
  const bytes = deltaBytes(delta);
292
359
  const handed = request.upload;
293
- const outcome = await submit(head, mapped.changes, delta, bytes, entry, handed, keep);
360
+ const batch = request.changeBatch;
361
+ const outcome = await submit(batch, head, mapped.changes, delta, bytes, entry, handed, keep);
294
362
  if (handed === undefined || !lapsedGrant(outcome))
295
363
  return adopted(entry, outcome);
296
- return adopted(entry, await submit(head, mapped.changes, delta, bytes, entry, undefined, keep));
364
+ return adopted(entry, await submit(batch, head, mapped.changes, delta, bytes, entry, undefined, keep));
297
365
  },
298
366
  async history(_authorization, request) {
299
367
  const entry = authorityFor(request.locator);
@@ -310,6 +378,37 @@ export function createAgentsHouseAdapter(options) {
310
378
  ...(request.revision === undefined ? {} : { revision: request.revision }),
311
379
  });
312
380
  },
381
+ async binary(_authorization, request) {
382
+ if (request.kind === 'path') {
383
+ const entry = authorityFor(request.locator);
384
+ if (entry === undefined)
385
+ return { kind: 'room-not-readable', locator: request.locator };
386
+ const answer = await transport.door(DOOR_FILES_GET, {
387
+ room_ref: entry.authority,
388
+ path: request.path,
389
+ revision: request.revision,
390
+ });
391
+ return downloaded(answer, request.locator);
392
+ }
393
+ const referrer = houseReferrer(request.referrer, tracked);
394
+ if (referrer === null) {
395
+ return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
396
+ }
397
+ const answer = await transport.door(DOOR_FILES_GET, {
398
+ file: request.fileRef,
399
+ referrer: referrer.referrer,
400
+ });
401
+ return downloaded(answer, referrer.locator);
402
+ },
403
+ referrerScope(referrer) {
404
+ const held = houseReferrer(referrer, tracked);
405
+ if (held === null)
406
+ return null;
407
+ if (held.locator === '')
408
+ return { kind: 'conversations' };
409
+ const { path } = held.referrer;
410
+ return { kind: 'room', locator: held.locator, ...(path === undefined ? {} : { path }) };
411
+ },
313
412
  reached(locator, version, target) {
314
413
  return reachedVersion(version, target, authorityFor(locator)?.logEpoch);
315
414
  },
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,MAAM,EACN,aAAa,EACb,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAU,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB,EAAE,MAAM,CAAC;IACjC,2BAA2B,EAAE,MAAM,CAAC;CACrC,CAAC;A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AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAmBxE;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,EAChD,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAC9B,SAAS,CAQX"}
package/dist/discovery.js CHANGED
@@ -1,4 +1,4 @@
1
- import { declaredActions, houseConversationAgents } from './actions.js';
1
+ import { declaredActions, houseConversationAgents, SITE_SUBMIT } from './actions.js';
2
2
  import { readPosition, roomVersion } from './version.js';
3
3
  export const PROVIDER_ACTIONS = 'provider-actions';
4
4
  export const DISCOVER_PREFIXES = ['/'];
@@ -229,7 +229,10 @@ export function capabilities(document) {
229
229
  }
230
230
  export function siteCapabilities() {
231
231
  return [
232
- { name: PROVIDER_ACTIONS, actions: [{ name: 'submit', inputShape: {}, resultKind: 'house' }] },
232
+ {
233
+ name: PROVIDER_ACTIONS,
234
+ actions: [{ name: SITE_SUBMIT, inputShape: {}, resultKind: 'house' }],
235
+ },
233
236
  ];
234
237
  }
235
238
  export function discoveredRoom(authority) {
package/dist/gather.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare function gatheredEach<A, R>(send: (asks: readonly A[], answer: (ask: number, result: R) => void) => Promise<void>): (ask: A) => Promise<R>;
1
2
  export declare function gathered<A, R>(send: (asks: readonly A[]) => Promise<readonly R[]>): (ask: A) => Promise<R>;
2
3
  export declare function selections<T>(items: readonly T[], weight: (item: T) => number, limit: number): readonly (readonly T[])[];
3
4
  //# sourceMappingURL=gather.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CA0BxB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC3B,KAAK,EAAE,MAAM,GACZ,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAgB3B"}
1
+ {"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAC/B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GACpF,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAwBxB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAMxB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC3B,KAAK,EAAE,MAAM,GACZ,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAgB3B"}
package/dist/gather.js CHANGED
@@ -1,13 +1,11 @@
1
- export function gathered(send) {
1
+ export function gatheredEach(send) {
2
2
  let held = [];
3
3
  function flush() {
4
4
  const taken = held;
5
5
  held = [];
6
- send(taken.map((entry) => entry.ask)).then((answers) => {
7
- taken.forEach((entry, index) => {
8
- entry.resolve(answers[index]);
9
- });
10
- }, (reason) => {
6
+ send(taken.map((entry) => entry.ask), (ask, result) => {
7
+ taken[ask]?.resolve(result);
8
+ }).catch((reason) => {
11
9
  for (const entry of taken)
12
10
  entry.reject(reason);
13
11
  });
@@ -20,6 +18,13 @@ export function gathered(send) {
20
18
  held.push({ ask, resolve, reject });
21
19
  });
22
20
  }
21
+ export function gathered(send) {
22
+ return gatheredEach(async (asks, answer) => {
23
+ (await send(asks)).forEach((result, ask) => {
24
+ answer(ask, result);
25
+ });
26
+ });
27
+ }
23
28
  export function selections(items, weight, limit) {
24
29
  const parts = [];
25
30
  let part = [];
@@ -0,0 +1,15 @@
1
+ import type { HeldRoom, MutationResult } from '@agentshouse/mdruntime';
2
+ import type { HouseScope, HouseView } from './read.js';
3
+ import type { StreamedAdvancement } from './stream.js';
4
+ export type HandedRoom = {
5
+ roomVersion: string;
6
+ revisions: ReadonlyMap<string, string>;
7
+ };
8
+ export declare function scopeHanded(scope: HouseScope): HandedRoom;
9
+ export declare function heldHanded(held: HeldRoom): HandedRoom;
10
+ export declare function acceptedHanded(held: HandedRoom, accepted: Extract<MutationResult, {
11
+ kind: 'accepted';
12
+ }>, roomVersion: string): HandedRoom;
13
+ export declare function enumeratedHanded(view: HouseView, earlier: HandedRoom | undefined): HandedRoom;
14
+ export declare function streamedHanded(held: HandedRoom, advanced: StreamedAdvancement): HandedRoom;
15
+ //# sourceMappingURL=handed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handed.d.ts","sourceRoot":"","sources":["../src/handed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CASzD;AAOD,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAErD;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EACvD,WAAW,EAAE,MAAM,GAClB,UAAU,CAKZ;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAM7F;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,GAAG,UAAU,CAM1F"}
package/dist/handed.js ADDED
@@ -0,0 +1,38 @@
1
+ import { roomVersion } from './version.js';
2
+ export function scopeHanded(scope) {
3
+ return {
4
+ roomVersion: roomVersion(scope),
5
+ revisions: new Map(scope.files.flatMap(({ path, revision }) => revision === undefined ? [] : [[path, revision]])),
6
+ };
7
+ }
8
+ function revised(revisions, path, revision) {
9
+ if (revision === undefined)
10
+ revisions.delete(path);
11
+ else
12
+ revisions.set(path, revision);
13
+ }
14
+ export function heldHanded(held) {
15
+ return { roomVersion: held.roomVersion, revisions: new Map(Object.entries(held.revisions)) };
16
+ }
17
+ export function acceptedHanded(held, accepted, roomVersion) {
18
+ const revisions = new Map(held.revisions);
19
+ for (const [path, revision] of Object.entries(accepted.revisions))
20
+ revisions.set(path, revision);
21
+ for (const path of accepted.removals)
22
+ revisions.delete(path);
23
+ return { roomVersion, revisions };
24
+ }
25
+ export function enumeratedHanded(view, earlier) {
26
+ const revisions = new Map(earlier?.revisions);
27
+ for (const change of view.changes) {
28
+ revised(revisions, change.path, 'removed' in change ? undefined : change.revision);
29
+ }
30
+ return { roomVersion: roomVersion(view), revisions };
31
+ }
32
+ export function streamedHanded(held, advanced) {
33
+ const revisions = new Map(held.revisions);
34
+ for (const entry of advanced.entries) {
35
+ revised(revisions, entry.path, entry.kind === 'removed' ? undefined : entry.revision);
36
+ }
37
+ return { roomVersion: advanced.page.roomVersion, revisions };
38
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
2
- export type { HouseByteAct, HouseByteAnswer, HouseByteTransfer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
2
+ export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
3
+ export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
3
4
  //# 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,YAAY,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,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,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,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 +1,2 @@
1
1
  export { createAgentsHouseAdapter } from './adapter.js';
2
+ export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
package/dist/model.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { RoomModels } from '@agentshouse/mdruntime';
2
2
  import type { TrackedAuthority } from './discovery.js';
3
3
  import { type HouseScope, type HouseView } from './read.js';
4
4
  import type { HouseMode, HouseStreamEntry } from './transport.js';
5
+ export declare function partModels(scope: HouseScope, tracked: TrackedAuthority, seen: ReadonlySet<string>, final: boolean): Promise<RoomModels | undefined>;
5
6
  export declare function scopeModels(scope: HouseScope, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
6
7
  export declare function viewModels(view: HouseView, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
7
8
  export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode): Promise<RoomModels | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAA0C,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAoClE,wBAAgB,WAAW,CACzB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAEjC;AA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js CHANGED
@@ -26,8 +26,15 @@ async function modelsOf(tracked, read) {
26
26
  }
27
27
  return models.collection === undefined && models.selection === undefined ? undefined : models;
28
28
  }
29
+ export function partModels(scope, tracked, seen, final) {
30
+ return modelsOf(tracked, (schema) => {
31
+ if (scope.files.some((file) => file.path === schema))
32
+ return schemaOf(scope, schema);
33
+ return final && !seen.has(schema) ? ABSENT_SCHEMA : undefined;
34
+ });
35
+ }
29
36
  export function scopeModels(scope, tracked) {
30
- return modelsOf(tracked, (schema) => schemaOf(scope, schema));
37
+ return partModels(scope, tracked, new Set(), true);
31
38
  }
32
39
  export function viewModels(view, tracked) {
33
40
  return modelsOf(tracked, (schema) => {
package/dist/read.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { BootstrapPage, RefreshResult, RoomAttachment } from '@agentshouse/mdruntime';
1
+ import type { BinaryFile, BootstrapPage, RefreshResult } from '@agentshouse/mdruntime';
2
2
  import type { TrackedAuthority } from './discovery.js';
3
3
  import type { HouseMode } from './transport.js';
4
4
  import { type LogPosition } from './version.js';
@@ -8,6 +8,7 @@ export type HouseManifestFile = {
8
8
  revision: string | undefined;
9
9
  version: string;
10
10
  head?: HeadChange;
11
+ binary?: BinaryFile;
11
12
  };
12
13
  export type HouseContent = {
13
14
  path: string;
@@ -17,10 +18,14 @@ export type HouseScope = LogPosition & {
17
18
  anchor: string;
18
19
  files: readonly HouseManifestFile[];
19
20
  contents: readonly HouseContent[];
20
- attachments?: readonly RoomAttachment[];
21
+ };
22
+ export type HouseCursor = {
23
+ room: string;
24
+ path: string | null;
21
25
  };
22
26
  export type HouseEnvelope = {
23
27
  scopes: readonly HouseScope[];
28
+ next?: HouseCursor;
24
29
  };
25
30
  export type HouseGrant = {
26
31
  method: 'GET';
@@ -41,14 +46,14 @@ export type HouseChange = {
41
46
  head?: HeadChange;
42
47
  } | {
43
48
  path: string;
44
- reference: {
45
- revision: string;
46
- };
49
+ binary: BinaryFile;
50
+ revision: string | undefined;
51
+ version: string;
52
+ head?: HeadChange;
47
53
  };
48
54
  export type HouseView = LogPosition & {
49
55
  authority: string;
50
56
  changes: readonly HouseChange[];
51
- attachments?: readonly RoomAttachment[];
52
57
  };
53
58
  export type HouseEnumeration = {
54
59
  authorities: readonly HouseView[];
@@ -61,7 +66,7 @@ export declare function headChange(held: {
61
66
  readonly author?: unknown;
62
67
  readonly created_at?: unknown;
63
68
  }): HeadChange | undefined | null;
64
- export declare function parseOriginals(value: unknown): readonly RoomAttachment[] | null;
69
+ export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
65
70
  export declare function parseEnvelope(body: unknown): HouseEnvelope | null;
66
71
  export declare function parseSiteBootstrap(body: unknown): HouseScope | null;
67
72
  export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACb,cAAc,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;I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