@agentshouse/mdruntime-adapter 0.1.0-alpha.9 → 0.1.0-c0074032f9909

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 (85) hide show
  1. package/README.md +32 -0
  2. package/dist/actions.d.ts +8 -16
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +43 -436
  5. package/dist/adapter.d.ts +1 -1
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +352 -231
  8. package/dist/authored-path.d.ts +9 -0
  9. package/dist/authored-path.d.ts.map +1 -0
  10. package/dist/authored-path.js +34 -0
  11. package/dist/chunks.d.ts +36 -0
  12. package/dist/chunks.d.ts.map +1 -0
  13. package/dist/chunks.js +281 -0
  14. package/dist/digest.d.ts +0 -1
  15. package/dist/digest.js +1 -5
  16. package/dist/discovery.d.ts +49 -42
  17. package/dist/discovery.d.ts.map +1 -1
  18. package/dist/discovery.js +317 -232
  19. package/dist/history.d.ts +6 -0
  20. package/dist/history.d.ts.map +1 -0
  21. package/dist/history.js +85 -0
  22. package/dist/index.d.ts +10 -3
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +9 -3
  25. package/dist/map.d.ts +2 -3
  26. package/dist/map.d.ts.map +1 -1
  27. package/dist/map.js +6 -7
  28. package/dist/model.d.ts +8 -19
  29. package/dist/model.d.ts.map +1 -1
  30. package/dist/model.js +43 -57
  31. package/dist/read.d.ts +65 -54
  32. package/dist/read.d.ts.map +1 -1
  33. package/dist/read.js +217 -295
  34. package/dist/refusal.d.ts +7 -11
  35. package/dist/refusal.d.ts.map +1 -1
  36. package/dist/refusal.js +53 -69
  37. package/dist/search.d.ts +4 -0
  38. package/dist/search.d.ts.map +1 -0
  39. package/dist/search.js +47 -0
  40. package/dist/session-content/bounds.d.ts +7 -0
  41. package/dist/session-content/check.d.ts +18 -0
  42. package/dist/session-content/index.d.ts +7 -0
  43. package/dist/session-content/parts.d.ts +103 -0
  44. package/dist/session-content/state.d.ts +61 -0
  45. package/dist/session-content/turn.d.ts +328 -0
  46. package/dist/site.d.ts +1 -2
  47. package/dist/site.d.ts.map +1 -1
  48. package/dist/site.js +142 -172
  49. package/dist/space-schema.d.ts +6 -0
  50. package/dist/space-schema.d.ts.map +1 -0
  51. package/dist/space-schema.js +11 -0
  52. package/dist/stream.d.ts +20 -9
  53. package/dist/stream.d.ts.map +1 -1
  54. package/dist/stream.js +394 -236
  55. package/dist/transport.d.ts +172 -47
  56. package/dist/transport.d.ts.map +1 -1
  57. package/dist/transport.js +58 -12
  58. package/dist/uncertain.d.ts +5 -0
  59. package/dist/uncertain.d.ts.map +1 -0
  60. package/dist/uncertain.js +11 -0
  61. package/dist/upload.d.ts +13 -0
  62. package/dist/upload.d.ts.map +1 -0
  63. package/dist/upload.js +65 -0
  64. package/dist/version.d.ts +3 -1
  65. package/dist/version.d.ts.map +1 -1
  66. package/dist/version.js +32 -18
  67. package/dist/write.d.ts +24 -11
  68. package/dist/write.d.ts.map +1 -1
  69. package/dist/write.js +263 -241
  70. package/package.json +10 -14
  71. package/AGENTS.md +0 -79
  72. package/dist/actions.js.map +0 -1
  73. package/dist/adapter.js.map +0 -1
  74. package/dist/digest.js.map +0 -1
  75. package/dist/discovery.js.map +0 -1
  76. package/dist/index.js.map +0 -1
  77. package/dist/map.js.map +0 -1
  78. package/dist/model.js.map +0 -1
  79. package/dist/read.js.map +0 -1
  80. package/dist/refusal.js.map +0 -1
  81. package/dist/site.js.map +0 -1
  82. package/dist/stream.js.map +0 -1
  83. package/dist/transport.js.map +0 -1
  84. package/dist/version.js.map +0 -1
  85. package/dist/write.js.map +0 -1
package/dist/read.js CHANGED
@@ -1,326 +1,248 @@
1
- import { PROVIDER_SELECTION_ROOTS } from './discovery.js';
2
- import { readPosition, roomVersion } from './version.js';
3
- export function authorityRoot(handle) {
4
- return handle === undefined ? '/private' : `/rooms/${handle}`;
5
- }
6
- export const ROOM_README = 'ROOM.md';
7
- export function selectionRoots(tracked) {
8
- if (tracked.handle === undefined) {
9
- return [
10
- tracked.collectionRoot,
11
- ...PROVIDER_SELECTION_ROOTS
12
- ];
13
- }
14
- return [
15
- ROOM_README,
16
- tracked.collectionRoot
17
- ];
1
+ import { patching, ROW_WEIGHT, } from '@agentshouse/mdruntime';
2
+ import { REVISION_REFERENCE_PATTERN } from '@agentshouse/mdmodel';
3
+ import { roomVersion } from './version.js';
4
+ function fileOf(revision) {
5
+ return REVISION_REFERENCE_PATTERN.exec(revision)?.[1];
18
6
  }
19
- export function contentPrefixes(tracked) {
20
- const root = authorityRoot(tracked.handle);
21
- return selectionRoots(tracked).filter((entry)=>entry !== ROOM_README).map((entry)=>`${root}/${entry}`);
22
- }
23
- export function modelPrefix(tracked, modelRoot) {
24
- return `${authorityRoot(tracked.handle)}/${modelRoot}`;
25
- }
26
- export function parseGrant(body) {
27
- if (typeof body !== 'object' || body === null) return null;
28
- if (!('transfer' in body) || typeof body.transfer !== 'object' || body.transfer === null) {
29
- return null;
30
- }
31
- const transfer = body.transfer;
32
- if (transfer.method !== 'GET' && transfer.method !== 'POST') return null;
33
- if (typeof transfer.operation !== 'string' || typeof transfer.url !== 'string') return null;
7
+ export function answering() {
34
8
  return {
35
- method: transfer.method,
36
- operation: transfer.operation,
37
- url: transfer.url
38
- };
39
- }
40
- function parseFile(value, mode) {
41
- if (typeof value !== 'object' || value === null) return null;
42
- const file = value;
43
- if (typeof file.path !== 'string') return null;
44
- if (mode === 'site') {
45
- if (typeof file.sha256 !== 'string') return null;
46
- return {
47
- path: file.path,
48
- revision: undefined,
49
- version: file.sha256
50
- };
51
- }
52
- if (typeof file.revision !== 'string') return null;
53
- return {
54
- path: file.path,
55
- revision: file.revision,
56
- version: file.revision
9
+ documents: new Map(),
10
+ facts: new Map(),
11
+ revisions: new Map(),
12
+ fileIds: new Map(),
13
+ created: new Map(),
14
+ changes: new Map(),
15
+ binaryFiles: new Map(),
16
+ removals: new Set(),
17
+ folders: new Set(),
18
+ folderRemovals: new Set(),
57
19
  };
58
20
  }
59
- function parseScope(value, mode) {
60
- if (typeof value !== 'object' || value === null) return null;
61
- const held = value;
62
- if (typeof held.manifest !== 'object' || held.manifest === null) return null;
63
- if (!Array.isArray(held.contents)) return null;
64
- const manifest = held.manifest;
65
- if (manifest.scope !== 'room' && manifest.scope !== 'private') return null;
66
- const at = readPosition(manifest);
67
- if (typeof manifest.anchor !== 'string' || at === null) return null;
68
- if (!Array.isArray(manifest.files)) return null;
69
- const files = [];
70
- for (const entry of manifest.files){
71
- const file = parseFile(entry, mode);
72
- if (file === null) return null;
73
- files.push(file);
21
+ export function revised(answer, path, revision) {
22
+ answer.revisions.set(path, revision);
23
+ const file = fileOf(revision);
24
+ if (file !== undefined)
25
+ answer.fileIds.set(path, file);
26
+ }
27
+ export function forgotten(answer, path) {
28
+ answer.documents.delete(path);
29
+ answer.facts.delete(path);
30
+ answer.revisions.delete(path);
31
+ answer.fileIds.delete(path);
32
+ answer.created.delete(path);
33
+ answer.changes.delete(path);
34
+ answer.binaryFiles.delete(path);
35
+ answer.removals.delete(path);
36
+ }
37
+ export function folded(answer, path, removed) {
38
+ if (removed) {
39
+ answer.folders.delete(path);
40
+ answer.folderRemovals.add(path);
74
41
  }
75
- const contents = [];
76
- for (const entry of held.contents){
77
- if (typeof entry !== 'object' || entry === null) return null;
78
- const content = entry;
79
- if (typeof content.path !== 'string' || typeof content.content !== 'string') return null;
80
- contents.push({
81
- path: content.path,
82
- content: content.content
83
- });
42
+ else {
43
+ answer.folderRemovals.delete(path);
44
+ answer.folders.add(path);
84
45
  }
85
- return {
86
- scope: manifest.scope,
87
- anchor: manifest.anchor,
88
- roomHandle: typeof manifest.room_handle === 'string' ? manifest.room_handle : undefined,
89
- ...at,
90
- files,
91
- contents
92
- };
93
46
  }
94
- export function parseEnvelope(body) {
95
- if (typeof body !== 'object' || body === null) return null;
96
- if (!('scopes' in body) || !Array.isArray(body.scopes)) return null;
97
- const scopes = [];
98
- for (const entry of body.scopes){
99
- const scope = parseScope(entry, 'credential');
100
- if (scope === null) return null;
101
- scopes.push(scope);
47
+ function* pathsOf(paths) {
48
+ const list = [];
49
+ for (const path of paths) {
50
+ list.push(path);
51
+ yield ROW_WEIGHT;
102
52
  }
53
+ return list;
54
+ }
55
+ export function* answered(answer) {
56
+ const removals = yield* pathsOf(answer.removals);
103
57
  return {
104
- scopes
58
+ documents: yield* patching({}, answer.documents),
59
+ facts: yield* patching({}, answer.facts),
60
+ revisions: yield* patching({}, answer.revisions),
61
+ ...(answer.fileIds.size === 0 ? {} : { fileIds: yield* patching({}, answer.fileIds) }),
62
+ ...(answer.created.size === 0 ? {} : { created: yield* patching({}, answer.created) }),
63
+ changes: yield* patching({}, answer.changes),
64
+ binaryFiles: yield* patching({}, answer.binaryFiles),
65
+ removals,
66
+ ...(answer.folders.size === 0 ? {} : { folders: yield* pathsOf(answer.folders) }),
67
+ ...(answer.folderRemovals.size === 0
68
+ ? {}
69
+ : { folderRemovals: yield* pathsOf(answer.folderRemovals) }),
105
70
  };
106
71
  }
107
- export function parseSiteBootstrap(body) {
108
- const scope = parseScope(body, 'site');
109
- return scope !== null && scope.scope === 'room' ? scope : null;
72
+ export function authorityRoot(handle) {
73
+ return `/rooms/${handle}`;
110
74
  }
111
- function parseChange(value, mode) {
112
- if (typeof value !== 'object' || value === null) return null;
113
- const held = value;
114
- if (typeof held.path !== 'string') return null;
115
- if (held.removed === true) return {
116
- path: held.path,
117
- removed: true
118
- };
119
- if (mode === 'site') {
120
- if (typeof held.content !== 'string' || typeof held.sha256 !== 'string') return null;
121
- return {
122
- path: held.path,
123
- content: held.content,
124
- revision: undefined,
125
- version: held.sha256
126
- };
127
- }
128
- if (typeof held.content === 'string' && typeof held.revision === 'string') {
129
- return {
130
- path: held.path,
131
- content: held.content,
132
- revision: held.revision,
133
- version: held.revision
134
- };
135
- }
136
- if (typeof held.reference === 'object' && held.reference !== null) {
137
- const reference = held.reference;
138
- if (typeof reference.revision !== 'string') return null;
139
- return {
140
- path: held.path,
141
- reference: {
142
- revision: reference.revision
143
- }
144
- };
145
- }
146
- return null;
75
+ export function schemaPath(handle, schema) {
76
+ return `${authorityRoot(handle)}/${schema}`;
147
77
  }
148
- export function parseEnumeration(body, mode) {
149
- if (typeof body !== 'object' || body === null) return null;
150
- if (!('authorities' in body) || !Array.isArray(body.authorities)) return null;
151
- const authorities = [];
152
- for (const entry of body.authorities){
153
- if (typeof entry !== 'object' || entry === null) return null;
154
- const held = entry;
155
- const at = readPosition(held);
156
- if (typeof held.authority !== 'string' || at === null) return null;
157
- if (!Array.isArray(held.changes)) return null;
158
- const changes = [];
159
- for (const change of held.changes){
160
- const mapped = parseChange(change, mode);
161
- if (mapped === null) return null;
162
- changes.push(mapped);
163
- }
164
- authorities.push({
165
- authority: held.authority,
166
- ...at,
167
- changes
168
- });
78
+ export function parseGrant(body) {
79
+ if (typeof body !== 'object' || body === null)
80
+ return null;
81
+ if (!('transfer' in body) || typeof body.transfer !== 'object' || body.transfer === null) {
82
+ return null;
169
83
  }
170
- return {
171
- authorities
172
- };
84
+ const transfer = body.transfer;
85
+ if (typeof transfer.url !== 'string')
86
+ return null;
87
+ if (transfer.method !== 'POST' || typeof transfer.operation !== 'string')
88
+ return null;
89
+ return { operation: transfer.operation, url: transfer.url };
173
90
  }
174
- export function advancedScope(scope, view) {
175
- const files = new Map(scope.files.map((file)=>[
176
- file.path,
177
- file
178
- ]));
179
- const contents = new Map(scope.contents.map((entry)=>[
180
- entry.path,
181
- entry.content
182
- ]));
183
- for (const change of view.changes){
184
- files.delete(change.path);
185
- contents.delete(change.path);
186
- if ('removed' in change) continue;
187
- if ('content' in change) {
188
- files.set(change.path, {
189
- path: change.path,
190
- revision: change.revision,
191
- version: change.version
192
- });
193
- contents.set(change.path, change.content);
194
- continue;
195
- }
196
- const { revision } = change.reference;
197
- files.set(change.path, {
198
- path: change.path,
199
- revision,
200
- version: revision
201
- });
91
+ export function parseFileAddress(body) {
92
+ if (typeof body !== 'object' || body === null)
93
+ return null;
94
+ const { download, name, sha256, media_type: mediaType } = body;
95
+ if (typeof download !== 'string' ||
96
+ typeof name !== 'string' ||
97
+ typeof sha256 !== 'string' ||
98
+ typeof mediaType !== 'string') {
99
+ return null;
202
100
  }
203
- return {
204
- ...scope,
205
- position: view.position,
206
- logEpoch: view.logEpoch,
207
- files: [
208
- ...files.values()
209
- ],
210
- contents: [
211
- ...contents
212
- ].map(([path, content])=>({
213
- path,
214
- content
215
- }))
216
- };
101
+ return { url: download, name, sha256, mediaType };
217
102
  }
218
- export function matchesScope(scope, tracked) {
219
- if (tracked.handle === undefined) return scope.scope === 'private';
220
- return scope.roomHandle === tracked.handle || scope.anchor === tracked.authority;
103
+ function changeAuthor(value) {
104
+ if (typeof value !== 'object' || value === null)
105
+ return null;
106
+ const { user, site, inbox, app, name } = value;
107
+ if (typeof name !== 'string')
108
+ return null;
109
+ const named = [user, site, inbox, app].filter((id) => id !== undefined);
110
+ if (named.length !== 1)
111
+ return null;
112
+ if (typeof user === 'string')
113
+ return { kind: 'user', id: user, name };
114
+ if (typeof site === 'string')
115
+ return { kind: 'site', id: site, name };
116
+ if (typeof inbox === 'string')
117
+ return { kind: 'inbox', id: inbox, name };
118
+ if (typeof app === 'string')
119
+ return { kind: 'app', id: app, name };
120
+ return null;
221
121
  }
222
- export function withinRoot(path, root) {
223
- return path === root || path.startsWith(`${root}/`);
122
+ export function headChange(held) {
123
+ const author = held.author === undefined ? null : changeAuthor(held.author);
124
+ if (held.author !== undefined && author === null)
125
+ return null;
126
+ if (held.changed_at === undefined)
127
+ return undefined;
128
+ if (typeof held.changed_at !== 'string')
129
+ return null;
130
+ return { author, time: held.changed_at };
224
131
  }
225
- export function selects(tracked, path) {
226
- if (tracked.modelRoots.some((root)=>withinRoot(path, root))) return false;
227
- return selectionRoots(tracked).some((root)=>withinRoot(path, root));
132
+ function createdOf(held) {
133
+ if (held.created_at === undefined)
134
+ return undefined;
135
+ return typeof held.created_at === 'string' ? held.created_at : null;
228
136
  }
229
- export function bootstrapFrom(envelope, tracked) {
230
- const scope = envelope.scopes.find((entry)=>matchesScope(entry, tracked));
231
- if (scope === undefined) return {
232
- kind: 'room-not-readable',
233
- locator: tracked.locator
234
- };
235
- return bootstrapOf(scope, tracked);
137
+ function createdHeld(created) {
138
+ return created === undefined ? {} : { created };
236
139
  }
237
- export function bootstrapOf(scope, tracked) {
238
- const contents = new Map(scope.contents.map((entry)=>[
239
- entry.path,
240
- entry.content
241
- ]));
242
- const documents = {};
243
- const revisions = {};
244
- const binaryTargets = [];
245
- for (const file of scope.files){
246
- if (!selects(tracked, file.path)) continue;
247
- if (file.revision !== undefined) revisions[file.path] = file.revision;
248
- const content = contents.get(file.path);
249
- if (content === undefined) binaryTargets.push(file.path);
250
- else documents[file.path] = content;
251
- }
252
- return {
253
- kind: 'bootstrap',
254
- roomVersion: roomVersion(scope),
255
- documents,
256
- revisions,
257
- binaryTargets: binaryTargets.sort()
258
- };
140
+ function headed(head) {
141
+ return head === undefined ? {} : { head };
142
+ }
143
+ export function binaryFileOf(held) {
144
+ if (held.media_type === undefined)
145
+ return undefined;
146
+ const { bytes, media_type: mediaType, sha256 } = held;
147
+ if (typeof bytes !== 'number' || typeof mediaType !== 'string' || typeof sha256 !== 'string')
148
+ return null;
149
+ return { byteLength: bytes, mediaType, sha256 };
259
150
  }
260
- export const MODEL_DEFINITION_ADDRESS = 'types';
261
- export function definitionAddress(path) {
262
- return `${MODEL_DEFINITION_ADDRESS}/${path.slice(path.lastIndexOf('/') + 1)}`;
151
+ function binaried(binary) {
152
+ return binary === undefined ? {} : { binary };
263
153
  }
264
- export function definitionsFrom(envelope, tracked, modelRoot) {
265
- const scope = envelope.scopes.find((entry)=>matchesScope(entry, tracked));
266
- if (scope === undefined) return null;
267
- return definitionsOf(scope, modelRoot);
154
+ function carriedFacts(held) {
155
+ return held.facts === undefined ? {} : { facts: held.facts };
268
156
  }
269
- export function definitionsOf(scope, modelRoot) {
270
- const contents = new Map(scope.contents.map((entry)=>[
271
- entry.path,
272
- entry.content
273
- ]));
274
- const definitions = {};
275
- const versions = [];
276
- for (const file of scope.files){
277
- if (!withinRoot(file.path, modelRoot)) continue;
278
- const content = contents.get(file.path);
279
- const address = definitionAddress(file.path);
280
- if (content === undefined || Object.hasOwn(definitions, address)) return null;
281
- definitions[address] = content;
282
- versions.push(`${file.path} ${file.version}`);
157
+ function carriedSpace(held) {
158
+ return typeof held.space === 'string' ? { space: held.space } : {};
159
+ }
160
+ export function documentEntry(value, mode) {
161
+ if (typeof value !== 'object' || value === null)
162
+ return null;
163
+ const file = value;
164
+ if (typeof file.path !== 'string')
165
+ return null;
166
+ if (file.content !== undefined && typeof file.content !== 'string')
167
+ return null;
168
+ const head = headChange(file);
169
+ const created = createdOf(file);
170
+ const binary = binaryFileOf(file);
171
+ if (head === null || created === null || binary === null)
172
+ return null;
173
+ const content = file.content === undefined ? {} : { content: file.content };
174
+ if (mode === 'site') {
175
+ if (typeof file.sha256 !== 'string')
176
+ return null;
177
+ return {
178
+ path: file.path,
179
+ revision: binary?.sha256,
180
+ version: file.sha256,
181
+ ...headed(head),
182
+ ...binaried(binary),
183
+ ...carriedFacts(file),
184
+ ...content,
185
+ };
283
186
  }
187
+ if (typeof file.revision !== 'string')
188
+ return null;
284
189
  return {
285
- definitions,
286
- versions: versions.sort()
190
+ path: file.path,
191
+ revision: file.revision,
192
+ version: file.revision,
193
+ ...headed(head),
194
+ ...createdHeld(created),
195
+ ...binaried(binary),
196
+ ...carriedFacts(file),
197
+ ...carriedSpace(file),
198
+ ...content,
287
199
  };
288
200
  }
289
- export function refreshFrom(enumeration, tracked, fromRoomVersion) {
290
- const view = enumeration.authorities.find((entry)=>entry.authority === tracked.authority);
291
- if (view === undefined) return {
292
- kind: 'room-not-readable',
293
- locator: tracked.locator
294
- };
295
- if (roomVersion(view) === fromRoomVersion) return {
296
- kind: 'still-current'
297
- };
298
- const documents = {};
299
- const revisions = {};
300
- const binaryTargets = [];
301
- const removals = [];
302
- for (const change of view.changes){
303
- if (!selects(tracked, change.path)) continue;
304
- if ('removed' in change) {
305
- removals.push(change.path);
306
- continue;
307
- }
308
- if ('content' in change) {
309
- documents[change.path] = change.content;
310
- if (change.revision !== undefined) revisions[change.path] = change.revision;
311
- continue;
312
- }
313
- binaryTargets.push(change.path);
314
- revisions[change.path] = change.reference.revision;
315
- }
201
+ export function kept(answer, file) {
202
+ if (file.head !== undefined)
203
+ answer.changes.set(file.path, file.head);
204
+ if (file.created !== undefined)
205
+ answer.created.set(file.path, file.created);
206
+ if (file.binary !== undefined)
207
+ answer.binaryFiles.set(file.path, file.binary);
208
+ else if (file.content !== undefined)
209
+ answer.documents.set(file.path, file.content);
210
+ if (file.binary === undefined && file.facts !== undefined)
211
+ answer.facts.set(file.path, file.facts);
212
+ if (file.revision !== undefined)
213
+ revised(answer, file.path, file.revision);
214
+ }
215
+ export function modelScope(room) {
316
216
  return {
317
- kind: 'net-advancement',
318
- roomVersion: roomVersion(view),
319
- documents,
320
- revisions,
321
- binaryTargets: binaryTargets.sort(),
322
- removals: removals.sort()
217
+ anchor: room.anchor,
218
+ position: room.position,
219
+ logEpoch: room.logEpoch,
220
+ files: room.models,
323
221
  };
324
222
  }
325
-
326
- //# sourceMappingURL=read.js.map
223
+ export function* bootstrapping(scope) {
224
+ const answer = answering();
225
+ for (const file of scope.files) {
226
+ yield ROW_WEIGHT;
227
+ if (file.space === undefined)
228
+ kept(answer, file);
229
+ }
230
+ for (const folder of scope.folders ?? [])
231
+ folded(answer, folder, false);
232
+ const { removals: _removals, folderRemovals: _folderRemovals, ...page } = yield* answered(answer);
233
+ return { kind: 'bootstrap', roomVersion: roomVersion(scope), ...page };
234
+ }
235
+ export function schemaFile(file) {
236
+ return file.content === undefined
237
+ ? null
238
+ : {
239
+ schema: file.content,
240
+ version: file.version,
241
+ revision: file.revision ?? null,
242
+ ...(file.space === undefined ? {} : { space: file.space }),
243
+ };
244
+ }
245
+ export function schemaOf(scope, schema) {
246
+ const file = scope.files.find((entry) => entry.path === schema);
247
+ return file === undefined ? { schema: null, version: null, revision: null } : schemaFile(file);
248
+ }
package/dist/refusal.d.ts CHANGED
@@ -1,11 +1,7 @@
1
- import type { AdapterFailure, DiscoverResult, ProviderRefusal, ScopedRefusal } from '@agentshouse/mdruntime';
2
- export type DoorRefusal = ProviderRefusal;
3
- export declare function doorRefusal(body: unknown): DoorRefusal | null;
4
- export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: DoorRefusal): ScopedRefusal;
5
- export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure | {
6
- kind: 'beyond-horizon';
7
- } | null;
8
- export declare function discoveryFailure(classified: AdapterFailure | {
9
- kind: 'beyond-horizon';
10
- }): DiscoverResult;
11
- //# sourceMappingURL=refusal.d.ts.map
1
+ import type { AdapterFailure, DiscoverResult, ProviderRefusal, ScopedRefusal, TransportUncertainty } from '@agentshouse/mdruntime';
2
+ export declare function doorRefusal(body: unknown): ProviderRefusal | null;
3
+ export declare function answeredFailure(status: number, body: unknown): TransportUncertainty;
4
+ export declare function resetOf(refusal: ProviderRefusal | null): string | undefined;
5
+ export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: ProviderRefusal): ScopedRefusal;
6
+ export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure | null;
7
+ export declare function discoveryFailure(status: number, body: unknown): DiscoverResult | null;
@@ -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;AAgBhC,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAE1C,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;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,CAepD;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GACtD,cAAc,CAMhB"}
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,EACb,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAGhC,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAOjE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,oBAAoB,CAInF;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAG3E;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,eAAe,GACvB,aAAa,CAEf;AAoBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,IAAI,CAMvB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAQrF"}