@agentshouse/mdruntime-adapter 0.1.0-c6ddfd288ac81 → 0.1.0-c7d05e09c73b7

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,26 +1,20 @@
1
- import { DISCOVER_PREFIXES, HOUSE_SCHEMA, capabilities, discoveredRoom, locatorOf, mapDiscovery, parseDiscovery, providerSelection, trackedFrom, } from './discovery.js';
2
- import { MODEL_ABSENT, failedModel, heldModel, modelKey, modelShelf, } from './model.js';
3
- import { gathered, selections } from './gather.js';
1
+ import { DISCOVER_PREFIXES, capabilities, discoveredRoom, mapDiscovery, parseDiscovery, trackedFrom, } from './discovery.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
- import { bootstrapOf, contentPrefixes, matchesScope, parseEnumeration, parseEnvelope, parseGrant, refreshFrom, schemaFrom, schemaPath, viewOf, } from './read.js';
6
- import { enumeratedLinks, scopeLinks, streamedLinks } from './links.js';
5
+ import { bootstrapOf, contentPrefixes, matchesScope, parseEnumeration, parseEnvelope, parseGrant, refreshFrom, viewOf, } from './read.js';
6
+ import { acceptedLinks, enumeratedLinks, heldLinks, scopeLinks, streamedLinks, } from './links.js';
7
7
  import { houseAction } from './actions.js';
8
- import { classifyDoor, discoveryFailure, doorRefusal } from './refusal.js';
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, DOOR_SELECTION_MAX, PRIVATE_LOCATOR, } from './transport.js';
10
+ import { DOOR_BATCH, DOOR_BATCH_UPLOAD, DOOR_BOOTSTRAP, DOOR_DISCOVER, DOOR_ENUMERATE, DOOR_REVISIONS, } from './transport.js';
11
11
  import { batchPaths, deltaBody, deltaBytes, deltaDigest, historyOutcome, houseChanges, mutationOutcome, operationHead, rejectedMapping, revisionBody, uploadable, } from './write.js';
12
- import { logPosition, presented, reachedVersion, roomVersion, } from './version.js';
12
+ import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
13
13
  const UNCERTAIN = { kind: 'transport-uncertainty' };
14
14
  const UNCERTAIN_READ = { kind: 'transport-uncertainty' };
15
15
  function lapsedGrant(outcome) {
16
16
  return outcome.kind === 'rejected' && outcome.code === 'upload_unavailable';
17
17
  }
18
- function modelFailure(classified, envelope) {
19
- if (classified === null) {
20
- return envelope === null ? { kind: 'transport-uncertainty' } : MODEL_ABSENT;
21
- }
22
- return failedModel(classified);
23
- }
24
18
  export function createAgentsHouseAdapter(options) {
25
19
  if ('site' in options)
26
20
  return createSiteAdapter(options.site);
@@ -28,74 +22,87 @@ export function createAgentsHouseAdapter(options) {
28
22
  const notifications = houseNotifications(transport, 'credential');
29
23
  const tracked = new Map();
30
24
  const handed = new Map();
31
- const models = modelShelf();
32
- function bootstrappedRoom(envelope, entry) {
33
- const scope = envelope.scopes.find((candidate) => matchesScope(candidate, entry));
25
+ let bounds;
26
+ function declared() {
27
+ if (bounds === undefined)
28
+ throw new Error('no Discovery declared the bounds');
29
+ return bounds;
30
+ }
31
+ async function bootstrappedRoom(envelope, scope, entry, continued) {
34
32
  if (scope === undefined)
35
33
  return { kind: 'room-not-readable', locator: entry.locator };
36
- handed.set(entry.locator, scopeLinks(scope));
37
- return bootstrapOf(scope, entry);
34
+ const next = envelope.next?.room === entry.authority ? envelope.next.path : null;
35
+ if (continued === null && next === null)
36
+ handed.set(entry.locator, scopeLinks(scope));
37
+ else
38
+ handed.delete(entry.locator);
39
+ notifications.reach(entry.authority, scope);
40
+ const seen = [
41
+ ...(continued?.seen ?? []),
42
+ ...entry.schemas.filter((schema) => scope.files.some((file) => file.path === schema)),
43
+ ];
44
+ const models = await partModels(scope, entry, new Set(seen), next === null);
45
+ const continuation = next === null ? null : { after: next, seen };
46
+ return {
47
+ ...bootstrapOf(scope),
48
+ ...(models === undefined ? {} : { models }),
49
+ ...(continuation === null ? {} : { pageToken: JSON.stringify(continuation) }),
50
+ };
38
51
  }
39
- function enumeratedRoom(enumeration, ask) {
52
+ async function enumeratedRoom(enumeration, ask) {
40
53
  const view = viewOf(enumeration, ask.entry);
41
54
  if (view === undefined)
42
55
  return { kind: 'room-not-readable', locator: ask.entry.locator };
43
- const answer = refreshFrom(view, ask.entry, ask.fromRoomVersion);
44
- if (answer.kind === 'net-advancement') {
45
- handed.set(ask.entry.locator, enumeratedLinks(view, handed.get(ask.entry.locator)));
46
- }
47
- return answer;
56
+ notifications.reach(ask.entry.authority, view);
57
+ const answer = refreshFrom(view, ask.fromRoomVersion);
58
+ if (answer.kind !== 'net-advancement')
59
+ return answer;
60
+ handed.set(ask.entry.locator, enumeratedLinks(view, handed.get(ask.entry.locator)));
61
+ const models = await viewModels(view, ask.entry);
62
+ return models === undefined ? answer : { ...answer, models };
48
63
  }
49
- function streamed(entry, request, from) {
64
+ async function streamed(entry, request, from) {
50
65
  const links = handed.get(entry.locator);
51
66
  if (links?.roomVersion !== request.fromRoomVersion)
52
67
  return null;
53
- const advanced = notifications.advance(entry, from);
68
+ const advanced = notifications.advance(entry, from, (path, revision) => links.revisions.get(path) === revision);
54
69
  if (advanced === null)
55
70
  return null;
56
- if (request.minPosition !== undefined &&
57
- !reachedVersion(advanced.page.roomVersion, request.minPosition, entry.logEpoch))
58
- return null;
59
71
  const relinked = streamedLinks(links, advanced);
60
72
  if (relinked === null)
61
73
  return null;
62
74
  handed.set(entry.locator, relinked);
63
- return advanced.page;
75
+ const models = await streamedModels(advanced.schemas, entry, 'credential');
76
+ return models === undefined ? advanced.page : { ...advanced.page, models };
64
77
  }
65
- function held(envelope, entry, schema, failure) {
66
- return heldModel(envelope === null ? null : schemaFrom(envelope, entry, schema), schemaPath(entry.handle, schema), failure);
67
- }
68
- function modelPrefixes(entry) {
69
- return entry.schemas.map((schema) => schemaPath(entry.handle, schema));
70
- }
71
- async function acquireModels(entries) {
72
- const acquired = new Map();
73
- for (const part of selections(entries, (entry) => modelPrefixes(entry).length, DOOR_SELECTION_MAX)) {
74
- const privateEntry = part.find((entry) => entry.locator === PRIVATE_LOCATOR);
75
- const answer = await transport.door(DOOR_BOOTSTRAP, {
76
- prefixes: part.flatMap((entry) => modelPrefixes(entry)),
77
- });
78
- const classified = classifyDoor(answer.status, answer.body, PRIVATE_LOCATOR);
79
- const envelope = classified === null ? parseEnvelope(await bundled(answer.body)) : null;
80
- const failure = modelFailure(classified, envelope);
81
- for (const entry of part) {
82
- acquired.set(modelKey(entry.locator, 'collection'), await held(envelope, entry, entry.schema, failure));
83
- }
84
- if (privateEntry !== undefined) {
85
- acquired.set(modelKey(privateEntry.locator, 'typed-selection'), await held(envelope, privateEntry, HOUSE_SCHEMA, failure));
86
- }
87
- }
88
- return acquired;
78
+ function held(rooms) {
79
+ const kept = rooms.flatMap((room) => {
80
+ const entry = tracked.get(room.locator);
81
+ const at = logPosition(room.roomVersion);
82
+ if (entry === undefined || at === null)
83
+ return [];
84
+ handed.set(room.locator, heldLinks(room));
85
+ notifications.reach(entry.authority, at);
86
+ return [presented(entry.authority, at)];
87
+ });
88
+ notifications.send(kept);
89
89
  }
90
- function roomOf(authority, acquired) {
91
- const locator = locatorOf(authority);
92
- const key = modelKey(locator, 'collection');
93
- const collection = models.retain(key, acquired.get(key));
94
- if (locator !== PRIVATE_LOCATOR) {
95
- return discoveredRoom(authority, collection?.identity ?? null, undefined);
96
- }
97
- const selection = models.retain(modelKey(locator, 'typed-selection'), acquired.get(modelKey(locator, 'typed-selection')));
98
- return discoveredRoom(authority, collection?.identity ?? null, providerSelection(selection?.identity ?? null));
90
+ function adopted(entry, outcome) {
91
+ if (outcome.kind !== 'accepted')
92
+ return outcome;
93
+ const { originals, ...accepted } = outcome;
94
+ const links = handed.get(entry.locator);
95
+ if (links === undefined)
96
+ return accepted;
97
+ const follows = followsVersion(links.roomVersion, accepted.roomVersion);
98
+ const relinked = acceptedLinks(links, accepted, follows ? accepted.roomVersion : links.roomVersion, originals);
99
+ handed.set(entry.locator, relinked.links);
100
+ const at = logPosition(accepted.roomVersion);
101
+ if (follows && at !== null)
102
+ notifications.reach(entry.authority, at);
103
+ return relinked.attachments === undefined
104
+ ? accepted
105
+ : { ...accepted, attachments: relinked.attachments };
99
106
  }
100
107
  function authorityFor(locator) {
101
108
  return tracked.get(locator);
@@ -109,48 +116,59 @@ export function createAgentsHouseAdapter(options) {
109
116
  const { authority, position, log_epoch: logEpoch } = body;
110
117
  if (typeof position !== 'string' || typeof logEpoch !== 'string')
111
118
  return result;
112
- const locator = authority === undefined
113
- ? PRIVATE_LOCATOR
114
- : [...tracked.values()].find((entry) => entry.authority === authority)?.locator;
119
+ const locator = [...tracked.values()].find((entry) => entry.authority === authority)?.locator;
115
120
  if (locator === undefined)
116
121
  return result;
117
122
  return { ...result, at: { locator, roomVersion: roomVersion({ position, logEpoch }) } };
118
123
  }
119
- async function bundled(body) {
120
- const grant = parseGrant(body);
121
- if (grant === null)
122
- return body;
123
- if (grant.method !== 'GET')
124
- return null;
125
- const answer = await transport.transfer({
126
- act: 'local_copy_bundle',
127
- method: 'GET',
128
- url: grant.url,
129
- answer: 'json',
130
- });
131
- return answer.status === 200 ? answer.body : null;
132
- }
133
124
  function weight(entry) {
134
125
  return contentPrefixes(entry).length;
135
126
  }
136
- async function bootstrapped(entries) {
137
- const answers = [];
138
- for (const part of selections(entries, weight, DOOR_SELECTION_MAX)) {
139
- const answer = await transport.door(DOOR_BOOTSTRAP, {
140
- prefixes: part.flatMap((entry) => contentPrefixes(entry)),
141
- });
142
- const classified = part.map((entry) => classifyDoor(answer.status, answer.body, entry.locator));
143
- const envelope = classified[0] === null ? parseEnvelope(await bundled(answer.body)) : null;
144
- part.forEach((entry, index) => {
145
- const failure = classified[index];
146
- if (failure === null || failure === undefined) {
147
- answers.push(envelope === null ? UNCERTAIN_READ : bootstrappedRoom(envelope, entry));
148
- return;
127
+ async function bootstrapped(entries, answer) {
128
+ let open = entries.map((entry, ask) => ({ entry, ask }));
129
+ while (open.length > 0) {
130
+ const unreached = [];
131
+ for (const part of selections(open, ({ entry }) => weight(entry), declared().max_prefixes)) {
132
+ const answered = await transport.door(DOOR_BOOTSTRAP, {
133
+ prefixes: part.flatMap(({ entry }) => contentPrefixes(entry)),
134
+ });
135
+ const classified = part.map(({ entry }) => classifyDoor(answered.status, answered.body, entry.locator));
136
+ const envelope = classified[0] === null ? parseEnvelope(answered.body) : null;
137
+ for (const [index, asked] of part.entries()) {
138
+ const failure = classified[index];
139
+ if (failure !== null && failure !== undefined) {
140
+ answer(asked.ask, failure);
141
+ continue;
142
+ }
143
+ if (envelope === null) {
144
+ answer(asked.ask, UNCERTAIN_READ);
145
+ continue;
146
+ }
147
+ const scope = envelope.scopes.find((candidate) => matchesScope(candidate, asked.entry));
148
+ if (scope === undefined && envelope.next !== undefined) {
149
+ unreached.push(asked);
150
+ continue;
151
+ }
152
+ answer(asked.ask, await bootstrappedRoom(envelope, scope, asked.entry, null));
149
153
  }
150
- answers.push(failure.kind === 'beyond-horizon' ? UNCERTAIN_READ : failure);
151
- });
154
+ }
155
+ open = unreached;
152
156
  }
153
- return answers;
157
+ }
158
+ async function continuedBootstrap(entry, continued) {
159
+ const after = { room: entry.authority, path: continued.after };
160
+ const answered = await transport.door(DOOR_BOOTSTRAP, {
161
+ prefixes: contentPrefixes(entry),
162
+ after,
163
+ });
164
+ const failure = classifyDoor(answered.status, answered.body, entry.locator);
165
+ if (failure !== null)
166
+ return failure;
167
+ const envelope = parseEnvelope(answered.body);
168
+ if (envelope === null)
169
+ return UNCERTAIN_READ;
170
+ const scope = envelope.scopes.find((candidate) => matchesScope(candidate, entry));
171
+ return bootstrappedRoom(envelope, scope, entry, continued);
154
172
  }
155
173
  function layered(asks) {
156
174
  const depths = new Map();
@@ -164,27 +182,15 @@ export function createAgentsHouseAdapter(options) {
164
182
  }
165
183
  async function enumerated(asks) {
166
184
  const answers = new Map();
167
- const parts = layered(asks).flatMap((layer) => selections(layer, (ask) => weight(ask.entry), DOOR_SELECTION_MAX));
185
+ const parts = layered(asks).flatMap((layer) => selections(layer, (ask) => weight(ask.entry), declared().max_prefixes));
168
186
  for (const part of parts) {
169
187
  let open = [...part];
170
188
  while (open.length > 0) {
171
189
  const answer = await transport.door(DOOR_ENUMERATE, {
172
190
  prefixes: open.flatMap((ask) => contentPrefixes(ask.entry)),
173
- positions: open.map((ask) => ({
174
- ...presented(ask.entry.authority, ask.from),
175
- ...(ask.minPosition === undefined ? {} : { min_position: ask.minPosition }),
176
- })),
191
+ positions: open.map((ask) => presented(ask.entry.authority, ask.from)),
177
192
  });
178
- const refusal = doorRefusal(answer.body);
179
- if (refusal?.code === 'replica_behind') {
180
- const named = open.filter((ask) => ask.entry.authority === refusal.fields.authority);
181
- const behind = named.length === 0 ? open : named;
182
- for (const ask of behind)
183
- answers.set(ask, { kind: 'retryable-refusal', ...refusal });
184
- open = open.filter((ask) => !behind.includes(ask));
185
- continue;
186
- }
187
- const classified = open.map((ask) => classifyDoor(answer.status, answer.body, ask.entry.locator));
193
+ const classified = open.map((ask) => classifyRead(answer.status, answer.body, ask.entry.locator));
188
194
  if (classified[0]?.kind === 'beyond-horizon') {
189
195
  const named = doorRefusal(answer.body)?.fields.authority;
190
196
  const expired = open.filter((ask) => ask.entry.authority === named);
@@ -196,26 +202,26 @@ export function createAgentsHouseAdapter(options) {
196
202
  continue;
197
203
  }
198
204
  const enumeration = classified[0] === null ? parseEnumeration(answer.body, 'credential') : null;
199
- open.forEach((ask, index) => {
205
+ for (const [index, ask] of open.entries()) {
200
206
  const failure = classified[index];
201
207
  if (failure !== null && failure !== undefined) {
202
208
  answers.set(ask, failure);
203
- return;
209
+ continue;
204
210
  }
205
- answers.set(ask, enumeration === null ? UNCERTAIN_READ : enumeratedRoom(enumeration, ask));
206
- });
211
+ answers.set(ask, enumeration === null ? UNCERTAIN_READ : await enumeratedRoom(enumeration, ask));
212
+ }
207
213
  open = [];
208
214
  }
209
215
  }
210
216
  return asks.map((ask) => answers.get(ask) ?? UNCERTAIN_READ);
211
217
  }
212
- const bootstrapTogether = gathered(bootstrapped);
218
+ const bootstrapTogether = gatheredEach(bootstrapped);
213
219
  const enumerateTogether = gathered(enumerated);
214
220
  async function uploaded(head, changes, delta, bytes, entry, handed, keep) {
215
221
  const paths = batchPaths(changes);
216
222
  const sha256 = await deltaDigest(delta);
217
223
  if (handed !== undefined && handed.sha256 === sha256) {
218
- return { body: { ...head, paths, upload: handed } };
224
+ return { body: { ...head, paths, upload: handed, runtime: notifications.runtime } };
219
225
  }
220
226
  const minted = await transport.door(DOOR_BATCH_UPLOAD, { ...head, paths, bytes, sha256 });
221
227
  if (minted.status !== 200) {
@@ -238,12 +244,13 @@ export function createAgentsHouseAdapter(options) {
238
244
  return { outcome: UNCERTAIN };
239
245
  const upload = { url: holding.url, operation: holding.operation, bytes, sha256 };
240
246
  await keep(upload);
241
- return { body: { ...head, paths, upload } };
247
+ return { body: { ...head, paths, upload, runtime: notifications.runtime } };
242
248
  }
243
249
  async function submit(head, changes, delta, bytes, entry, handed, keep) {
244
- const prepared = uploadable(bytes)
250
+ const inline = { ...head, changes, runtime: notifications.runtime };
251
+ const prepared = uploadable(inline, bytes, declared())
245
252
  ? await uploaded(head, changes, delta, bytes, entry, handed, keep)
246
- : { body: { ...head, changes } };
253
+ : { body: inline };
247
254
  if ('outcome' in prepared)
248
255
  return prepared.outcome;
249
256
  const answer = await transport.door(DOOR_BATCH, prepared.body);
@@ -253,17 +260,15 @@ export function createAgentsHouseAdapter(options) {
253
260
  async authorize() {
254
261
  return options.authorize();
255
262
  },
256
- async model(_authorization, request) {
257
- return models.answer(request);
258
- },
259
263
  async discover(_authorization) {
260
264
  const answer = await transport.door(DOOR_DISCOVER, { prefixes: [...DISCOVER_PREFIXES] });
261
- const classified = classifyDoor(answer.status, answer.body, PRIVATE_LOCATOR);
262
- if (classified !== null)
263
- return discoveryFailure(classified);
265
+ const failed = discoveryFailure(answer.status, answer.body);
266
+ if (failed !== null)
267
+ return failed;
264
268
  const document = parseDiscovery(answer.body);
265
269
  if (document === null)
266
270
  return { kind: 'transport-uncertainty' };
271
+ bounds = document.bounds;
267
272
  const entries = trackedFrom(document);
268
273
  tracked.clear();
269
274
  for (const entry of entries)
@@ -272,16 +277,18 @@ export function createAgentsHouseAdapter(options) {
272
277
  if (!tracked.has(locator))
273
278
  handed.delete(locator);
274
279
  notifications.track(entries);
275
- const acquired = await acquireModels(entries);
276
- models.keep(entries.map((entry) => entry.locator));
277
- return mapDiscovery(document, document.authorities.map((authority) => roomOf(authority, acquired)), capabilities(document.actions));
280
+ return {
281
+ ...mapDiscovery(document, document.authorities.map((authority) => discoveredRoom(authority)), capabilities(document)),
282
+ member: document.member,
283
+ };
278
284
  },
279
285
  async bootstrap(_authorization, request) {
280
286
  const entry = authorityFor(request.locator);
281
287
  if (entry === undefined)
282
288
  return { kind: 'room-not-readable', locator: request.locator };
283
- if (request.pageToken !== undefined)
284
- return { kind: 'transport-uncertainty' };
289
+ if (request.pageToken !== undefined) {
290
+ return continuedBootstrap(entry, JSON.parse(request.pageToken));
291
+ }
285
292
  return bootstrapTogether(entry);
286
293
  },
287
294
  async refresh(_authorization, request) {
@@ -293,16 +300,10 @@ export function createAgentsHouseAdapter(options) {
293
300
  const from = logPosition(request.fromRoomVersion);
294
301
  if (from === null)
295
302
  return { kind: 'beyond-horizon' };
296
- const answered = streamed(entry, request, from);
303
+ const answered = await streamed(entry, request, from);
297
304
  if (answered !== null)
298
305
  return answered;
299
- const minPosition = request.minPosition === undefined ? null : logPosition(request.minPosition);
300
- return enumerateTogether({
301
- entry,
302
- from,
303
- fromRoomVersion: request.fromRoomVersion,
304
- ...(minPosition?.logEpoch === from.logEpoch ? { minPosition: minPosition.position } : {}),
305
- });
306
+ return enumerateTogether({ entry, from, fromRoomVersion: request.fromRoomVersion });
306
307
  },
307
308
  async mutate(_authorization, request, keep) {
308
309
  const entry = authorityFor(request.locator);
@@ -317,8 +318,8 @@ export function createAgentsHouseAdapter(options) {
317
318
  const handed = request.upload;
318
319
  const outcome = await submit(head, mapped.changes, delta, bytes, entry, handed, keep);
319
320
  if (handed === undefined || !lapsedGrant(outcome))
320
- return outcome;
321
- return submit(head, mapped.changes, delta, bytes, entry, undefined, keep);
321
+ return adopted(entry, outcome);
322
+ return adopted(entry, await submit(head, mapped.changes, delta, bytes, entry, undefined, keep));
322
323
  },
323
324
  async history(_authorization, request) {
324
325
  const entry = authorityFor(request.locator);
@@ -338,10 +339,13 @@ export function createAgentsHouseAdapter(options) {
338
339
  reached(locator, version, target) {
339
340
  return reachedVersion(version, target, authorityFor(locator)?.logEpoch);
340
341
  },
342
+ follows(_locator, version, next) {
343
+ return followsVersion(version, next);
344
+ },
341
345
  async action(_authorization, request) {
342
346
  return withAt(await houseAction(transport, request));
343
347
  },
344
- roomVersions: notifications,
348
+ roomStream: { hold: held, reopen: notifications.reopen, observe: notifications.observe },
345
349
  conversations: notifications.conversations,
346
350
  serviceMode: notifications.serviceMode,
347
351
  };
@@ -1,16 +1,7 @@
1
- import type { Capability, DiscoveredRoom, Discovery, ProviderLimit, Retention, TypedSelection } from '@agentshouse/mdruntime';
1
+ import type { Capability, DiscoveredRoom, Discovery, Member, ProviderLimit, Retention } from '@agentshouse/mdruntime';
2
2
  import { type LogPosition } from './version.js';
3
- export declare const ROOM_CONTRACT_VERSION = 1;
4
- export declare const MD_MODEL_IDENTITY = "@agentshouse/mdmodel";
5
- export declare const ROOM_VERSION_NOTIFICATIONS = "room-version-notifications";
6
3
  export declare const PROVIDER_ACTIONS = "provider-actions";
7
- export declare const MOVE_REFERENCE_REWRITES = "move-reference-rewrites";
8
4
  export declare const DISCOVER_PREFIXES: readonly string[];
9
- export declare const PROVIDER_SELECTION_ROOTS: readonly string[];
10
- export declare const UNTYPED_FOLDERS: readonly string[];
11
- export declare const RESERVED_NAMES: readonly string[];
12
- export declare const HOUSE_SCHEMA = "house/schema.yaml";
13
- export declare const PRIVATE_HANDLE = "private";
14
5
  export type HouseBounds = {
15
6
  max_authored_file_bytes: number;
16
7
  max_batch_operations: number;
@@ -19,6 +10,9 @@ export type HouseBounds = {
19
10
  max_path_depth: number;
20
11
  max_mount_files: number;
21
12
  max_mount_bytes: number;
13
+ max_inline_body_bytes: number;
14
+ max_upload_bytes: number;
15
+ max_prefixes: number;
22
16
  change_retention_seconds: number;
23
17
  operation_retention_seconds: number;
24
18
  };
@@ -28,18 +22,23 @@ export type HouseOperations = {
28
22
  write: readonly string[];
29
23
  delete: readonly string[];
30
24
  };
25
+ export type HouseModel = {
26
+ root: string;
27
+ paths: readonly string[];
28
+ };
31
29
  export type HouseAuthority = LogPosition & {
32
30
  roomRef: string;
33
31
  roomHandle: string;
34
32
  name: string;
35
33
  schema: string;
34
+ houseModel: HouseModel | null;
36
35
  managedReplication: 'admitted' | 'unavailable';
37
36
  protectedPaths: readonly string[];
38
37
  operations: HouseOperations;
39
38
  };
40
39
  export type HouseDiscoveryDocument = {
40
+ member: Member;
41
41
  bounds: HouseBounds;
42
- mdModelVersion: string;
43
42
  authorities: readonly HouseAuthority[];
44
43
  actions: readonly string[];
45
44
  };
@@ -48,16 +47,9 @@ export type TrackedAuthority = LogPosition & {
48
47
  authority: string;
49
48
  handle: string;
50
49
  schema: string;
50
+ houseModel: HouseModel | null;
51
51
  schemas: readonly string[];
52
52
  };
53
- export type HouseSiteEntry = {
54
- roomRef: string;
55
- segment: string;
56
- };
57
- export type HouseSiteSlot = {
58
- slot: string;
59
- entries: readonly HouseSiteEntry[];
60
- };
61
53
  export type HouseSiteAuthority = LogPosition & {
62
54
  roomRef: string;
63
55
  roomHandle: string;
@@ -65,21 +57,16 @@ export type HouseSiteAuthority = LogPosition & {
65
57
  };
66
58
  export type HouseSiteDiscovery = {
67
59
  bounds: HouseBounds;
68
- mdModelVersion: string;
69
- slots: readonly HouseSiteSlot[];
70
60
  authorities: readonly HouseSiteAuthority[];
71
61
  };
72
62
  export declare function parseDiscovery(body: unknown): HouseDiscoveryDocument | null;
73
63
  export declare function parseSiteDiscovery(body: unknown): HouseSiteDiscovery | null;
74
64
  export declare function siteTracked(document: HouseSiteDiscovery): TrackedAuthority[];
75
- export declare function siteSlots(document: HouseSiteDiscovery): Discovery['slots'];
76
- export declare function locatorOf(authority: HouseAuthority): string;
77
65
  export declare function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[];
78
66
  export declare function providerLimits(bounds: HouseBounds): readonly ProviderLimit[];
79
67
  export declare function declaredRetention(bounds: HouseBounds): Retention;
80
- export declare function capabilities(actions: readonly string[]): readonly Capability[];
68
+ export declare function capabilities(document: HouseDiscoveryDocument): readonly Capability[];
81
69
  export declare function siteCapabilities(): readonly Capability[];
82
- export declare function providerSelection(attachedModel: TypedSelection['attachedModel']): TypedSelection;
83
- export declare function discoveredRoom(authority: HouseAuthority, attachedModel: DiscoveredRoom['attachedModel'], typedSelection: TypedSelection | undefined): DiscoveredRoom;
84
- export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds' | 'mdModelVersion'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
70
+ export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
71
+ export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
85
72
  //# sourceMappingURL=discovery.d.ts.map
@@ -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,aAAa,EACb,SAAS,EACT,cAAc,EACf,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,eAAO,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