@agentshouse/mdruntime-adapter 0.1.0-cd028205a5103 → 0.1.0-cd61dfca5d699

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.
Files changed (50) hide show
  1. package/AGENTS.md +277 -222
  2. package/dist/actions.d.ts +62 -1
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +156 -133
  5. package/dist/adapter.d.ts +1 -0
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +317 -93
  8. package/dist/discovery.d.ts +4 -2
  9. package/dist/discovery.d.ts.map +1 -1
  10. package/dist/discovery.js +22 -7
  11. package/dist/gather.d.ts +1 -0
  12. package/dist/gather.d.ts.map +1 -1
  13. package/dist/gather.js +11 -6
  14. package/dist/handed.d.ts +15 -0
  15. package/dist/handed.d.ts.map +1 -0
  16. package/dist/handed.js +38 -0
  17. package/dist/index.d.ts +2 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -0
  20. package/dist/model.d.ts +1 -1
  21. package/dist/model.d.ts.map +1 -1
  22. package/dist/model.js +6 -2
  23. package/dist/read.d.ts +34 -7
  24. package/dist/read.d.ts.map +1 -1
  25. package/dist/read.js +156 -77
  26. package/dist/referrer.d.ts +7 -0
  27. package/dist/referrer.d.ts.map +1 -0
  28. package/dist/referrer.js +35 -0
  29. package/dist/refusal.d.ts +2 -5
  30. package/dist/refusal.d.ts.map +1 -1
  31. package/dist/refusal.js +6 -9
  32. package/dist/site.d.ts +1 -1
  33. package/dist/site.d.ts.map +1 -1
  34. package/dist/site.js +182 -49
  35. package/dist/stream.d.ts +3 -2
  36. package/dist/stream.d.ts.map +1 -1
  37. package/dist/stream.js +326 -16
  38. package/dist/transport.d.ts +64 -10
  39. package/dist/transport.d.ts.map +1 -1
  40. package/dist/transport.js +3 -0
  41. package/dist/version.d.ts +1 -0
  42. package/dist/version.d.ts.map +1 -1
  43. package/dist/version.js +1 -1
  44. package/dist/write.d.ts +3 -9
  45. package/dist/write.d.ts.map +1 -1
  46. package/dist/write.js +92 -14
  47. package/package.json +3 -4
  48. package/dist/links.d.ts +0 -20
  49. package/dist/links.d.ts.map +0 -1
  50. package/dist/links.js +0 -104
package/dist/read.js CHANGED
@@ -1,4 +1,12 @@
1
- import { readPosition, roomVersion } from './version.js';
1
+ import { DECIMAL, readPosition, roomVersion } from './version.js';
2
+ const REVISION_FILE = /^fr_([0-9a-z]+)\.[0-9a-z]+\.[0-9a-z]$/u;
3
+ export function identities(revisions) {
4
+ const fileIds = Object.fromEntries(Object.entries(revisions).flatMap(([path, revision]) => {
5
+ const file = REVISION_FILE.exec(revision)?.[1];
6
+ return file === undefined ? [] : [[path, file]];
7
+ }));
8
+ return Object.keys(fileIds).length === 0 ? {} : { fileIds };
9
+ }
2
10
  export function authorityRoot(handle) {
3
11
  return `/rooms/${handle}`;
4
12
  }
@@ -51,32 +59,19 @@ export function headChange(held) {
51
59
  function headed(head) {
52
60
  return head === undefined ? {} : { head };
53
61
  }
54
- function parseOriginal(value) {
55
- if (typeof value !== 'object' || value === null)
56
- return null;
57
- const { attachment, name, bytes, media_type: mediaType } = value;
58
- if (typeof attachment !== 'string' || typeof name !== 'string')
59
- return null;
60
- if (typeof bytes !== 'number' || !Number.isSafeInteger(bytes) || bytes < 0)
61
- return null;
62
- if (mediaType !== null && typeof mediaType !== 'string')
63
- return null;
64
- return { reference: attachment, name, byteLength: bytes, mediaType, entry: value };
65
- }
66
- export function parseOriginals(value) {
67
- if (!Array.isArray(value))
62
+ export function binaryFileOf(held) {
63
+ if (held.file === undefined)
64
+ return undefined;
65
+ const { file, bytes, media_type: mediaType, sha256 } = held;
66
+ if (typeof file !== 'string' ||
67
+ typeof bytes !== 'number' ||
68
+ typeof mediaType !== 'string' ||
69
+ typeof sha256 !== 'string')
68
70
  return null;
69
- const attachments = [];
70
- for (const entry of value) {
71
- const attachment = parseOriginal(entry);
72
- if (attachment === null)
73
- return null;
74
- attachments.push(attachment);
75
- }
76
- return attachments;
71
+ return { fileRef: file, byteLength: bytes, mediaType, sha256 };
77
72
  }
78
- function declared(attachments) {
79
- return attachments === undefined ? {} : { attachments };
73
+ function binaried(binary) {
74
+ return binary === undefined ? {} : { binary };
80
75
  }
81
76
  function parseFile(value, mode) {
82
77
  if (typeof value !== 'object' || value === null)
@@ -85,16 +80,30 @@ function parseFile(value, mode) {
85
80
  if (typeof file.path !== 'string')
86
81
  return null;
87
82
  const head = headChange(file);
88
- if (head === null)
83
+ const binary = binaryFileOf(file);
84
+ if (head === null || binary === null)
89
85
  return null;
90
86
  if (mode === 'site') {
91
87
  if (typeof file.sha256 !== 'string')
92
88
  return null;
93
- return { path: file.path, revision: undefined, version: file.sha256, ...headed(head) };
89
+ return {
90
+ path: file.path,
91
+ revision: binary?.sha256,
92
+ version: file.sha256,
93
+ ...headed(head),
94
+ ...binaried(binary),
95
+ };
94
96
  }
95
97
  if (typeof file.revision !== 'string')
96
98
  return null;
97
- return { path: file.path, revision: file.revision, version: file.revision, ...headed(head) };
99
+ return {
100
+ path: file.path,
101
+ revision: file.revision,
102
+ version: file.revision,
103
+ ...(typeof file.sha256 === 'string' ? { sha256: file.sha256 } : {}),
104
+ ...headed(head),
105
+ ...binaried(binary),
106
+ };
98
107
  }
99
108
  function parseScope(value, mode) {
100
109
  if (typeof value !== 'object' || value === null)
@@ -130,12 +139,28 @@ function parseScope(value, mode) {
130
139
  return null;
131
140
  contents.push({ path: content.path, content: content.content });
132
141
  }
133
- if (mode === 'site')
134
- return { anchor: manifest.anchor, ...at, files, contents };
135
- const attachments = parseOriginals(held.originals);
136
- if (attachments === null)
142
+ return { anchor: manifest.anchor, ...at, files, contents };
143
+ }
144
+ function parseCut(value) {
145
+ if (value === undefined)
146
+ return undefined;
147
+ if (typeof value !== 'object' || value === null)
137
148
  return null;
138
- return { anchor: manifest.anchor, ...at, files, contents, attachments };
149
+ const { position, log_epoch: logEpoch } = value;
150
+ if (typeof position !== 'string' || typeof logEpoch !== 'string')
151
+ return null;
152
+ return { position, log_epoch: logEpoch };
153
+ }
154
+ function parseCursor(value) {
155
+ if (typeof value !== 'object' || value === null)
156
+ return null;
157
+ const { room, path, cut } = value;
158
+ if (typeof room !== 'string' || (path !== null && typeof path !== 'string'))
159
+ return null;
160
+ const parsed = parseCut(cut);
161
+ if (parsed === null)
162
+ return null;
163
+ return { room, path, ...(parsed === undefined ? {} : { cut: parsed }) };
139
164
  }
140
165
  export function parseEnvelope(body) {
141
166
  if (typeof body !== 'object' || body === null)
@@ -149,11 +174,26 @@ export function parseEnvelope(body) {
149
174
  return null;
150
175
  scopes.push(scope);
151
176
  }
152
- return { scopes };
177
+ if (!('next' in body) || body.next === undefined)
178
+ return { scopes };
179
+ const next = parseCursor(body.next);
180
+ return next === null ? null : { scopes, next };
153
181
  }
154
182
  export function parseSiteBootstrap(body) {
155
183
  return parseScope(body, 'site');
156
184
  }
185
+ export function siteBootstrapNext(body) {
186
+ if (typeof body !== 'object' || body === null || !('next' in body))
187
+ return null;
188
+ return typeof body.next === 'string' && body.next.length > 0 ? body.next : null;
189
+ }
190
+ export function siteBootstrapOffset(body) {
191
+ if (typeof body !== 'object' || body === null || !('offset' in body))
192
+ return null;
193
+ return Number.isSafeInteger(body.offset) && body.offset > 0
194
+ ? body.offset
195
+ : null;
196
+ }
157
197
  function parseChange(value, mode) {
158
198
  if (typeof value !== 'object' || value === null)
159
199
  return null;
@@ -163,8 +203,15 @@ function parseChange(value, mode) {
163
203
  if (held.removed === true)
164
204
  return { path: held.path, removed: true };
165
205
  const head = headChange(held);
166
- if (head === null)
206
+ const binary = binaryFileOf(held);
207
+ if (head === null || binary === null)
167
208
  return null;
209
+ if (binary !== undefined) {
210
+ if (mode === 'credential' && typeof held.revision !== 'string')
211
+ return null;
212
+ const revision = typeof held.revision === 'string' ? held.revision : binary.sha256;
213
+ return { path: held.path, binary, revision, version: revision, ...headed(head) };
214
+ }
168
215
  if (mode === 'site') {
169
216
  if (typeof held.content !== 'string' || typeof held.sha256 !== 'string')
170
217
  return null;
@@ -185,12 +232,6 @@ function parseChange(value, mode) {
185
232
  ...headed(head),
186
233
  };
187
234
  }
188
- if (typeof held.reference === 'object' && held.reference !== null) {
189
- const reference = held.reference;
190
- if (typeof reference.revision !== 'string')
191
- return null;
192
- return { path: held.path, reference: { revision: reference.revision } };
193
- }
194
235
  return null;
195
236
  }
196
237
  export function parseEnumeration(body, mode) {
@@ -215,17 +256,60 @@ export function parseEnumeration(body, mode) {
215
256
  return null;
216
257
  changes.push(mapped);
217
258
  }
218
- if (mode === 'site') {
219
- authorities.push({ authority: held.authority, ...at, changes });
220
- continue;
221
- }
222
- const attachments = parseOriginals(held.originals);
223
- if (attachments === null)
259
+ const next = held.next === undefined ? undefined : readPage(held.next);
260
+ if (next === null)
224
261
  return null;
225
- authorities.push({ authority: held.authority, ...at, changes, attachments });
262
+ authorities.push({
263
+ authority: held.authority,
264
+ ...at,
265
+ changes,
266
+ ...(next === undefined ? {} : { next }),
267
+ });
226
268
  }
227
269
  return { authorities };
228
270
  }
271
+ function readPage(held) {
272
+ if (typeof held !== 'object' || held === null)
273
+ return null;
274
+ const { after, through, read } = held;
275
+ if (typeof after !== 'string' || !DECIMAL.test(after))
276
+ return null;
277
+ if (typeof through !== 'string' || !DECIMAL.test(through))
278
+ return null;
279
+ if (typeof read !== 'number' || !Number.isSafeInteger(read) || read < 0)
280
+ return null;
281
+ return { after, through, read };
282
+ }
283
+ function advances(asked, next) {
284
+ const moved = BigInt(next.through) - BigInt(asked.through);
285
+ return moved > 0n || (moved === 0n && next.after === asked.after && next.read > asked.read);
286
+ }
287
+ export async function wholeView(first, more) {
288
+ const changes = new Map(first.changes.map((change) => [change.path, change]));
289
+ let view = first;
290
+ while (view.next !== undefined) {
291
+ const asked = view.next;
292
+ const page = await more(asked);
293
+ if ('kind' in page)
294
+ return page;
295
+ if (page.position !== asked.through ||
296
+ page.logEpoch !== first.logEpoch ||
297
+ (page.next !== undefined && !advances(asked, page.next))) {
298
+ return { kind: 'transport-uncertainty' };
299
+ }
300
+ for (const change of page.changes) {
301
+ changes.delete(change.path);
302
+ changes.set(change.path, change);
303
+ }
304
+ view = page;
305
+ }
306
+ return {
307
+ authority: first.authority,
308
+ position: view.position,
309
+ logEpoch: first.logEpoch,
310
+ changes: [...changes.values()],
311
+ };
312
+ }
229
313
  export function advancedScope(scope, view) {
230
314
  const files = new Map(scope.files.map((file) => [file.path, file]));
231
315
  const contents = new Map(scope.contents.map((entry) => [entry.path, entry.content]));
@@ -234,18 +318,15 @@ export function advancedScope(scope, view) {
234
318
  contents.delete(change.path);
235
319
  if ('removed' in change)
236
320
  continue;
237
- if ('content' in change) {
238
- files.set(change.path, {
239
- path: change.path,
240
- revision: change.revision,
241
- version: change.version,
242
- ...headed(change.head),
243
- });
321
+ files.set(change.path, {
322
+ path: change.path,
323
+ revision: change.revision,
324
+ version: change.version,
325
+ ...headed(change.head),
326
+ ...('binary' in change ? { binary: change.binary } : {}),
327
+ });
328
+ if ('content' in change)
244
329
  contents.set(change.path, change.content);
245
- continue;
246
- }
247
- const { revision } = change.reference;
248
- files.set(change.path, { path: change.path, revision, version: revision });
249
330
  }
250
331
  return {
251
332
  ...scope,
@@ -263,16 +344,16 @@ export function bootstrapOf(scope) {
263
344
  const documents = {};
264
345
  const revisions = {};
265
346
  const changes = {};
266
- const binaryTargets = [];
347
+ const binaryFiles = {};
267
348
  for (const file of scope.files) {
268
349
  if (file.revision !== undefined)
269
350
  revisions[file.path] = file.revision;
270
351
  if (file.head !== undefined)
271
352
  changes[file.path] = file.head;
272
353
  const content = contents.get(file.path);
273
- if (content === undefined)
274
- binaryTargets.push(file.path);
275
- else
354
+ if (file.binary !== undefined)
355
+ binaryFiles[file.path] = file.binary;
356
+ else if (content !== undefined)
276
357
  documents[file.path] = content;
277
358
  }
278
359
  return {
@@ -280,9 +361,9 @@ export function bootstrapOf(scope) {
280
361
  roomVersion: roomVersion(scope),
281
362
  documents,
282
363
  revisions,
364
+ ...identities(revisions),
283
365
  changes,
284
- binaryTargets: binaryTargets.sort(),
285
- ...declared(scope.attachments),
366
+ binaryFiles,
286
367
  };
287
368
  }
288
369
  export function schemaOf(scope, schema) {
@@ -303,32 +384,30 @@ export function refreshFrom(view, fromRoomVersion) {
303
384
  const documents = {};
304
385
  const revisions = {};
305
386
  const changes = {};
306
- const binaryTargets = [];
387
+ const binaryFiles = {};
307
388
  const removals = [];
308
389
  for (const change of view.changes) {
309
390
  if ('removed' in change) {
310
391
  removals.push(change.path);
311
392
  continue;
312
393
  }
313
- if ('content' in change) {
394
+ if ('content' in change)
314
395
  documents[change.path] = change.content;
315
- if (change.revision !== undefined)
316
- revisions[change.path] = change.revision;
317
- if (change.head !== undefined)
318
- changes[change.path] = change.head;
319
- continue;
320
- }
321
- binaryTargets.push(change.path);
322
- revisions[change.path] = change.reference.revision;
396
+ else
397
+ binaryFiles[change.path] = change.binary;
398
+ if (change.revision !== undefined)
399
+ revisions[change.path] = change.revision;
400
+ if (change.head !== undefined)
401
+ changes[change.path] = change.head;
323
402
  }
324
403
  return {
325
404
  kind: 'net-advancement',
326
405
  roomVersion: roomVersion(view),
327
406
  documents,
328
407
  revisions,
408
+ ...identities(revisions),
329
409
  changes,
330
- binaryTargets: binaryTargets.sort(),
410
+ binaryFiles,
331
411
  removals: removals.sort(),
332
- ...declared(view.attachments),
333
412
  };
334
413
  }
@@ -0,0 +1,7 @@
1
+ import type { TrackedAuthority } from './discovery.js';
2
+ export type HouseReferrer = {
3
+ locator: string;
4
+ referrer: Readonly<Record<string, string>>;
5
+ };
6
+ export declare function houseReferrer(referrer: unknown, tracked: ReadonlyMap<string, TrackedAuthority>): HouseReferrer | null;
7
+ //# sourceMappingURL=referrer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"referrer.d.ts","sourceRoot":"","sources":["../src/referrer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC;AAgB5F,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAC7C,aAAa,GAAG,IAAI,CAqBtB"}
@@ -0,0 +1,35 @@
1
+ function fields(value) {
2
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
3
+ ? value
4
+ : null;
5
+ }
6
+ function named(held, ...keys) {
7
+ const present = Object.keys(held);
8
+ return (present.length === keys.length &&
9
+ keys.every((key) => typeof held[key] === 'string' && held[key] !== ''));
10
+ }
11
+ export function houseReferrer(referrer, tracked) {
12
+ const held = fields(referrer);
13
+ if (held === null)
14
+ return null;
15
+ if (named(held, 'room', 'path')) {
16
+ const entry = tracked.get(held.room);
17
+ if (entry === undefined)
18
+ return null;
19
+ return {
20
+ locator: entry.locator,
21
+ referrer: { room_ref: entry.authority, path: held.path },
22
+ };
23
+ }
24
+ if (named(held, 'room_ref', 'record')) {
25
+ const roomRef = held.room_ref;
26
+ const entry = [...tracked.values()].find((candidate) => candidate.authority === roomRef);
27
+ return {
28
+ locator: entry?.locator ?? roomRef,
29
+ referrer: { room_ref: roomRef, record: held.record },
30
+ };
31
+ }
32
+ if (named(held, 'message'))
33
+ return { locator: '', referrer: { message: held.message } };
34
+ return null;
35
+ }
package/dist/refusal.d.ts CHANGED
@@ -1,9 +1,6 @@
1
1
  import type { AdapterFailure, DiscoverResult, ProviderRefusal, ScopedRefusal } from '@agentshouse/mdruntime';
2
- export type DoorRefusal = ProviderRefusal & {
3
- retryable: boolean;
4
- };
5
- export declare function doorRefusal(body: unknown): DoorRefusal | null;
6
- export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: DoorRefusal): ScopedRefusal;
2
+ export declare function doorRefusal(body: unknown): ProviderRefusal | null;
3
+ export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: ProviderRefusal): ScopedRefusal;
7
4
  export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure | null;
8
5
  export declare function classifyRead(status: number, body: unknown, locator: string): AdapterFailure | {
9
6
  kind: 'beyond-horizon';
@@ -1 +1 @@
1
- {"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAEnE,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAO7D;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,GACnB,aAAa,CAEf;AAmBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,IAAI,CAMvB;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAGpD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAYrF"}
1
+ {"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAOjE;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,eAAe,GACvB,aAAa,CAEf;AAqBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,IAAI,CAMvB;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAGpD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAQrF"}
package/dist/refusal.js CHANGED
@@ -6,11 +6,11 @@ export function doorRefusal(body) {
6
6
  const error = body.error;
7
7
  if (typeof error.code !== 'string')
8
8
  return null;
9
- const { code, ...fields } = error;
10
- return { code, fields, retryable: error.retryable === true };
9
+ const { code, retryable, ...fields } = error;
10
+ return { code, fields, retryable: retryable === true };
11
11
  }
12
12
  export function scopedRefusal(locator, scope, refusal) {
13
- return { kind: 'scoped-refusal', locator, scope, code: refusal.code, fields: refusal.fields };
13
+ return { kind: 'scoped-refusal', locator, scope, ...refusal };
14
14
  }
15
15
  function doorFailure(status, body) {
16
16
  if (status === 0)
@@ -18,8 +18,9 @@ function doorFailure(status, body) {
18
18
  const refusal = doorRefusal(body);
19
19
  if (status === 401)
20
20
  return { kind: 'revoked-authorization' };
21
- if (refusal?.retryable === true)
21
+ if (refusal?.retryable === true || refusal?.code === 'update_required') {
22
22
  return { kind: 'transport-uncertainty' };
23
+ }
23
24
  if (status === 404 || refusal?.code === 'room_not_found')
24
25
  return { kind: 'room-not-readable' };
25
26
  if (status < 400)
@@ -50,11 +51,7 @@ export function discoveryFailure(status, body) {
50
51
  if (failure.kind === 'revoked-authorization')
51
52
  return failure;
52
53
  if (failure.kind === 'refused') {
53
- return {
54
- kind: 'contract-unavailable',
55
- code: failure.refusal.code,
56
- fields: failure.refusal.fields,
57
- };
54
+ return { kind: 'contract-unavailable', ...failure.refusal };
58
55
  }
59
56
  return { kind: 'transport-uncertainty' };
60
57
  }
package/dist/site.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type { Adapter } from '@agentshouse/mdruntime';
2
2
  import { type HouseSiteTransport } from './transport.js';
3
- export declare function createSiteAdapter(transport: HouseSiteTransport): Adapter;
3
+ export declare function createSiteAdapter(transport: HouseSiteTransport, snapshot?: boolean): Adapter;
4
4
  //# sourceMappingURL=site.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,wBAAwB,CAAC;AAsBhC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAgCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAkIxE"}
1
+ {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAUR,MAAM,wBAAwB,CAAC;AA2BhC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAyCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAwR1F"}