@agentshouse/mdruntime-adapter 0.1.0-cc7fa1e066844 → 0.1.0-cf22c8563f9f4
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/AGENTS.md +57 -20
- package/README.md +3 -3
- package/dist/actions.d.ts +2 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +3 -7
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +75 -111
- package/dist/discovery.d.ts +4 -12
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +16 -35
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/links.d.ts +9 -1
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +40 -2
- package/dist/model.d.ts +7 -18
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +48 -41
- package/dist/read.d.ts +1 -1
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +5 -8
- package/dist/refusal.d.ts +3 -4
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +31 -14
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +45 -78
- package/dist/stream.d.ts +8 -4
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +89 -37
- package/dist/transport.d.ts +31 -2
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +0 -1
- package/dist/version.d.ts +1 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +9 -0
- package/dist/write.d.ts +9 -2
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +11 -7
- package/package.json +3 -3
package/dist/discovery.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { declaredActions,
|
|
2
|
-
import { PRIVATE_LOCATOR } from './transport.js';
|
|
1
|
+
import { declaredActions, houseConversationAgents } from './actions.js';
|
|
3
2
|
import { readPosition, roomVersion } from './version.js';
|
|
4
|
-
export const ROOM_CONTRACT_VERSION = 1;
|
|
5
|
-
export const MD_MODEL_IDENTITY = '@agentshouse/mdmodel';
|
|
6
|
-
export const ROOM_VERSION_NOTIFICATIONS = 'room-version-notifications';
|
|
7
3
|
export const PROVIDER_ACTIONS = 'provider-actions';
|
|
8
|
-
export const MOVE_REFERENCE_REWRITES = 'move-reference-rewrites';
|
|
9
4
|
export const DISCOVER_PREFIXES = ['/'];
|
|
10
|
-
export const PRIVATE_HANDLE = 'private';
|
|
11
5
|
const BOUND_KEYS = [
|
|
12
6
|
'max_authored_file_bytes',
|
|
13
7
|
'max_batch_operations',
|
|
@@ -107,8 +101,6 @@ export function parseDiscovery(body) {
|
|
|
107
101
|
const bounds = parseBounds(held.bounds);
|
|
108
102
|
if (bounds === null)
|
|
109
103
|
return null;
|
|
110
|
-
if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0)
|
|
111
|
-
return null;
|
|
112
104
|
const actions = stringList(held.actions);
|
|
113
105
|
if (actions === null ||
|
|
114
106
|
new Set(actions).size !== actions.length ||
|
|
@@ -123,7 +115,7 @@ export function parseDiscovery(body) {
|
|
|
123
115
|
return null;
|
|
124
116
|
authorities.push(authority);
|
|
125
117
|
}
|
|
126
|
-
return { bounds,
|
|
118
|
+
return { bounds, authorities, actions };
|
|
127
119
|
}
|
|
128
120
|
function parseSiteAuthority(value) {
|
|
129
121
|
if (typeof value !== 'object' || value === null)
|
|
@@ -154,8 +146,6 @@ export function parseSiteDiscovery(body) {
|
|
|
154
146
|
const bounds = parseBounds(held.bounds);
|
|
155
147
|
if (bounds === null)
|
|
156
148
|
return null;
|
|
157
|
-
if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0)
|
|
158
|
-
return null;
|
|
159
149
|
if (!Array.isArray(held.authorities))
|
|
160
150
|
return null;
|
|
161
151
|
const authorities = [];
|
|
@@ -165,7 +155,7 @@ export function parseSiteDiscovery(body) {
|
|
|
165
155
|
return null;
|
|
166
156
|
authorities.push(authority);
|
|
167
157
|
}
|
|
168
|
-
return { bounds,
|
|
158
|
+
return { bounds, authorities };
|
|
169
159
|
}
|
|
170
160
|
export function siteTracked(document) {
|
|
171
161
|
return document.authorities.map((authority) => ({
|
|
@@ -179,9 +169,6 @@ export function siteTracked(document) {
|
|
|
179
169
|
logEpoch: authority.logEpoch,
|
|
180
170
|
}));
|
|
181
171
|
}
|
|
182
|
-
export function locatorOf(authority) {
|
|
183
|
-
return authority.roomHandle === PRIVATE_HANDLE ? PRIVATE_LOCATOR : authority.roomRef;
|
|
184
|
-
}
|
|
185
172
|
function schemasOf(authority) {
|
|
186
173
|
return authority.houseModel === null
|
|
187
174
|
? [authority.schema]
|
|
@@ -189,7 +176,7 @@ function schemasOf(authority) {
|
|
|
189
176
|
}
|
|
190
177
|
export function trackedFrom(document) {
|
|
191
178
|
return document.authorities.map((authority) => ({
|
|
192
|
-
locator:
|
|
179
|
+
locator: authority.roomRef,
|
|
193
180
|
authority: authority.roomRef,
|
|
194
181
|
handle: authority.roomHandle,
|
|
195
182
|
schema: authority.schema,
|
|
@@ -217,27 +204,29 @@ export function declaredRetention(bounds) {
|
|
|
217
204
|
refreshHorizon: bounds.change_retention_seconds,
|
|
218
205
|
};
|
|
219
206
|
}
|
|
220
|
-
export function capabilities(
|
|
207
|
+
export function capabilities(document) {
|
|
208
|
+
const house = document.authorities.find((authority) => authority.houseModel !== null);
|
|
221
209
|
return [
|
|
222
|
-
{ name: ROOM_VERSION_NOTIFICATIONS },
|
|
223
210
|
{
|
|
224
211
|
name: PROVIDER_ACTIONS,
|
|
225
|
-
actions: declaredActions(actions),
|
|
226
|
-
|
|
212
|
+
actions: declaredActions(document.actions),
|
|
213
|
+
...(house === undefined
|
|
214
|
+
? {}
|
|
215
|
+
: { conversationAgents: houseConversationAgents(house.roomRef) }),
|
|
227
216
|
},
|
|
228
|
-
{ name: MOVE_REFERENCE_REWRITES },
|
|
229
217
|
];
|
|
230
218
|
}
|
|
231
219
|
export function siteCapabilities() {
|
|
232
220
|
return [
|
|
233
|
-
{ name: ROOM_VERSION_NOTIFICATIONS },
|
|
234
221
|
{ name: PROVIDER_ACTIONS, actions: [{ name: 'submit', inputShape: {}, resultKind: 'house' }] },
|
|
235
222
|
];
|
|
236
223
|
}
|
|
237
|
-
export function discoveredRoom(authority
|
|
224
|
+
export function discoveredRoom(authority) {
|
|
225
|
+
const locator = authority.roomRef;
|
|
238
226
|
return {
|
|
239
227
|
name: authority.name,
|
|
240
|
-
locator
|
|
228
|
+
locator,
|
|
229
|
+
handle: authority.roomHandle,
|
|
241
230
|
roomVersion: roomVersion(authority),
|
|
242
231
|
operations: {
|
|
243
232
|
read: [...authority.operations.read],
|
|
@@ -245,24 +234,16 @@ export function discoveredRoom(authority, attachedModel, selectionModel) {
|
|
|
245
234
|
write: [...authority.operations.write],
|
|
246
235
|
delete: [...authority.operations.delete],
|
|
247
236
|
},
|
|
248
|
-
replica: { selection:
|
|
249
|
-
attachedModel,
|
|
237
|
+
replica: { selection: locator, admission: authority.managedReplication },
|
|
250
238
|
...(authority.houseModel === null
|
|
251
239
|
? {}
|
|
252
|
-
: {
|
|
253
|
-
typedSelection: {
|
|
254
|
-
roots: [...authority.houseModel.paths],
|
|
255
|
-
attachedModel: selectionModel,
|
|
256
|
-
},
|
|
257
|
-
}),
|
|
240
|
+
: { typedSelection: { roots: [...authority.houseModel.paths] } }),
|
|
258
241
|
providerOwnedPaths: [...authority.protectedPaths, ...schemasOf(authority)],
|
|
259
242
|
};
|
|
260
243
|
}
|
|
261
244
|
export function mapDiscovery(document, rooms, declared) {
|
|
262
245
|
return {
|
|
263
246
|
kind: 'discovery',
|
|
264
|
-
supportedVersions: [ROOM_CONTRACT_VERSION],
|
|
265
|
-
mdModel: { identity: MD_MODEL_IDENTITY, version: document.mdModelVersion },
|
|
266
247
|
rooms,
|
|
267
248
|
capabilities: declared,
|
|
268
249
|
providerLimits: providerLimits(document.bounds),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
|
-
export type { HouseByteAct, HouseByteAnswer, HouseByteTransfer, HouseDoorAnswer, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
2
|
+
export type { HouseByteAct, HouseByteAnswer, HouseByteTransfer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,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,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"}
|
package/dist/links.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
import type { HeldRoom, MutationResult, RoomAttachment } from '@agentshouse/mdruntime';
|
|
1
2
|
import type { HouseScope, HouseView } from './read.js';
|
|
2
3
|
import type { StreamedAdvancement } from './stream.js';
|
|
3
4
|
export type RoomLinks = {
|
|
4
5
|
roomVersion: string;
|
|
5
|
-
handed:
|
|
6
|
+
handed: ReadonlyMap<string, RoomAttachment>;
|
|
6
7
|
paths: ReadonlyMap<string, ReadonlySet<string>>;
|
|
7
8
|
revisions: ReadonlyMap<string, string>;
|
|
8
9
|
};
|
|
9
10
|
export declare function scopeLinks(scope: HouseScope): RoomLinks;
|
|
11
|
+
export declare function heldLinks(held: HeldRoom): RoomLinks;
|
|
12
|
+
export declare function acceptedLinks(held: RoomLinks, accepted: Extract<MutationResult, {
|
|
13
|
+
kind: 'accepted';
|
|
14
|
+
}>, roomVersion: string, originals: readonly RoomAttachment[]): {
|
|
15
|
+
links: RoomLinks;
|
|
16
|
+
attachments?: readonly RoomAttachment[];
|
|
17
|
+
};
|
|
10
18
|
export declare function enumeratedLinks(view: HouseView, earlier: RoomLinks | undefined): RoomLinks;
|
|
11
19
|
export declare function streamedLinks(held: RoomLinks, advanced: StreamedAdvancement): RoomLinks | null;
|
|
12
20
|
//# sourceMappingURL=links.d.ts.map
|
package/dist/links.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAOvD,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAcF,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAWvD;AAOD,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAOnD;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EACvD,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,SAAS,cAAc,EAAE,GACnC;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,CA2B/D;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAgB1F;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI,CAoB9F"}
|
package/dist/links.js
CHANGED
|
@@ -8,7 +8,7 @@ function linkedBy(text) {
|
|
|
8
8
|
return references.size === 0 ? NONE : references;
|
|
9
9
|
}
|
|
10
10
|
function handedOf(attachments) {
|
|
11
|
-
return new
|
|
11
|
+
return new Map((attachments ?? []).map((attachment) => [attachment.reference, attachment]));
|
|
12
12
|
}
|
|
13
13
|
export function scopeLinks(scope) {
|
|
14
14
|
return {
|
|
@@ -24,6 +24,44 @@ function revised(revisions, path, revision) {
|
|
|
24
24
|
else
|
|
25
25
|
revisions.set(path, revision);
|
|
26
26
|
}
|
|
27
|
+
export function heldLinks(held) {
|
|
28
|
+
return {
|
|
29
|
+
roomVersion: held.roomVersion,
|
|
30
|
+
handed: handedOf(held.attachments),
|
|
31
|
+
paths: new Map(Object.entries(held.documents).map(([path, text]) => [path, linkedBy(text)])),
|
|
32
|
+
revisions: new Map(Object.entries(held.revisions)),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function acceptedLinks(held, accepted, roomVersion, originals) {
|
|
36
|
+
const paths = new Map(held.paths);
|
|
37
|
+
const revisions = new Map(held.revisions);
|
|
38
|
+
const handed = new Map(held.handed);
|
|
39
|
+
const answered = handedOf(originals);
|
|
40
|
+
for (const [path, text] of Object.entries(accepted.documents)) {
|
|
41
|
+
const linked = linkedBy(text);
|
|
42
|
+
for (const reference of linked) {
|
|
43
|
+
const original = answered.get(reference);
|
|
44
|
+
if (!handed.has(reference) && original !== undefined)
|
|
45
|
+
handed.set(reference, original);
|
|
46
|
+
}
|
|
47
|
+
paths.set(path, linked);
|
|
48
|
+
}
|
|
49
|
+
for (const [path, revision] of Object.entries(accepted.revisions))
|
|
50
|
+
revisions.set(path, revision);
|
|
51
|
+
for (const path of accepted.removals) {
|
|
52
|
+
paths.delete(path);
|
|
53
|
+
revisions.delete(path);
|
|
54
|
+
}
|
|
55
|
+
const linked = new Set([...paths.values()].flatMap((references) => [...references]));
|
|
56
|
+
for (const reference of held.handed.keys()) {
|
|
57
|
+
const before = [...held.paths.values()].some((references) => references.has(reference));
|
|
58
|
+
if (before && !linked.has(reference))
|
|
59
|
+
handed.delete(reference);
|
|
60
|
+
}
|
|
61
|
+
const links = { roomVersion, handed, paths, revisions };
|
|
62
|
+
const changed = handed.size !== held.handed.size || [...handed.keys()].some((key) => !held.handed.has(key));
|
|
63
|
+
return changed ? { links, attachments: [...handed.values()] } : { links };
|
|
64
|
+
}
|
|
27
65
|
export function enumeratedLinks(view, earlier) {
|
|
28
66
|
const paths = new Map(earlier?.paths);
|
|
29
67
|
const revisions = new Map(earlier?.revisions);
|
|
@@ -50,7 +88,7 @@ export function streamedLinks(held, advanced) {
|
|
|
50
88
|
for (const reference of linked)
|
|
51
89
|
if (!held.handed.has(reference))
|
|
52
90
|
return null;
|
|
53
|
-
for (const reference of paths.get(entry.path) ?? held.handed) {
|
|
91
|
+
for (const reference of paths.get(entry.path) ?? held.handed.keys()) {
|
|
54
92
|
if (held.handed.has(reference) && !linked.has(reference))
|
|
55
93
|
dropped.add(reference);
|
|
56
94
|
}
|
package/dist/model.d.ts
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare
|
|
8
|
-
export declare function failedModel(failure: AdapterFailure | {
|
|
9
|
-
kind: 'beyond-horizon';
|
|
10
|
-
}): ModelResult;
|
|
11
|
-
export declare function modelKey(locator: string, attached: ModelRequest['attached']): string;
|
|
12
|
-
export declare function heldModel(read: HouseSchema | null, identity: string, failure: ModelResult): Promise<HeldModel>;
|
|
13
|
-
export type ModelShelf = {
|
|
14
|
-
retain(key: string, acquired: HeldModel | undefined): HeldModel | undefined;
|
|
15
|
-
answer(request: ModelRequest): ModelResult;
|
|
16
|
-
keep(locators: readonly string[]): void;
|
|
17
|
-
};
|
|
18
|
-
export declare function modelShelf(): ModelShelf;
|
|
1
|
+
import type { RoomModels } from '@agentshouse/mdruntime';
|
|
2
|
+
import type { TrackedAuthority } from './discovery.js';
|
|
3
|
+
import { type HouseScope, type HouseView } from './read.js';
|
|
4
|
+
import type { HouseMode, HouseStreamEntry } from './transport.js';
|
|
5
|
+
export declare function scopeModels(scope: HouseScope, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
|
|
6
|
+
export declare function viewModels(view: HouseView, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
|
|
7
|
+
export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode): Promise<RoomModels | undefined>;
|
|
19
8
|
//# sourceMappingURL=model.d.ts.map
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
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;AAiClE,wBAAgB,WAAW,CACzB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAEjC;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAQjC;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CASjC"}
|
package/dist/model.js
CHANGED
|
@@ -1,46 +1,53 @@
|
|
|
1
1
|
import { sha256Hex } from './digest.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (failure.kind === 'transport-uncertainty')
|
|
7
|
-
return { kind: 'transport-uncertainty' };
|
|
8
|
-
return MODEL_ABSENT;
|
|
9
|
-
}
|
|
10
|
-
export function modelKey(locator, attached) {
|
|
11
|
-
return `${locator} ${attached}`;
|
|
12
|
-
}
|
|
13
|
-
export async function heldModel(read, identity, failure) {
|
|
2
|
+
import { schemaOf, schemaPath } from './read.js';
|
|
3
|
+
const MODEL_ABSENT = { kind: 'model-unavailable', reason: 'not-readable' };
|
|
4
|
+
const ABSENT_SCHEMA = { schema: null, version: null };
|
|
5
|
+
async function heldModel(read, identity) {
|
|
14
6
|
if (read === null)
|
|
15
|
-
return
|
|
7
|
+
return MODEL_ABSENT;
|
|
16
8
|
const version = await sha256Hex(JSON.stringify(read.version));
|
|
17
|
-
return {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
9
|
+
return { kind: 'model', snapshot: { identity, version, schema: read.schema } };
|
|
10
|
+
}
|
|
11
|
+
async function modelsOf(tracked, read) {
|
|
12
|
+
const models = {};
|
|
13
|
+
const collection = read(tracked.schema);
|
|
14
|
+
if (collection !== undefined) {
|
|
15
|
+
models.collection = await heldModel(collection, schemaPath(tracked.handle, tracked.schema));
|
|
16
|
+
}
|
|
17
|
+
if (tracked.houseModel !== null) {
|
|
18
|
+
const root = tracked.houseModel.root;
|
|
19
|
+
const selection = read(root);
|
|
20
|
+
if (selection !== undefined) {
|
|
21
|
+
models.selection = await heldModel(selection, schemaPath(tracked.handle, root));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return models.collection === undefined && models.selection === undefined ? undefined : models;
|
|
25
|
+
}
|
|
26
|
+
export function scopeModels(scope, tracked) {
|
|
27
|
+
return modelsOf(tracked, (schema) => schemaOf(scope, schema));
|
|
28
|
+
}
|
|
29
|
+
export function viewModels(view, tracked) {
|
|
30
|
+
return modelsOf(tracked, (schema) => {
|
|
31
|
+
const change = view.changes.find((candidate) => candidate.path === schema);
|
|
32
|
+
if (change === undefined)
|
|
33
|
+
return undefined;
|
|
34
|
+
if ('removed' in change)
|
|
35
|
+
return ABSENT_SCHEMA;
|
|
36
|
+
if ('content' in change)
|
|
37
|
+
return { schema: change.content, version: change.version };
|
|
38
|
+
return null;
|
|
39
|
+
});
|
|
21
40
|
}
|
|
22
|
-
export function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return acquired;
|
|
35
|
-
},
|
|
36
|
-
answer(request) {
|
|
37
|
-
return models.get(modelKey(request.locator, request.attached))?.snapshot ?? MODEL_ABSENT;
|
|
38
|
-
},
|
|
39
|
-
keep(locators) {
|
|
40
|
-
for (const key of [...models.keys()]) {
|
|
41
|
-
if (!locators.some((locator) => key.startsWith(`${locator} `)))
|
|
42
|
-
models.delete(key);
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
};
|
|
41
|
+
export function streamedModels(schemas, tracked, mode) {
|
|
42
|
+
return modelsOf(tracked, (schema) => {
|
|
43
|
+
const entry = schemas.get(schema);
|
|
44
|
+
if (entry === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
if (entry.kind === 'removed')
|
|
47
|
+
return ABSENT_SCHEMA;
|
|
48
|
+
if (entry.text === undefined)
|
|
49
|
+
return null;
|
|
50
|
+
const version = mode === 'site' ? entry.sha256 : entry.revision;
|
|
51
|
+
return version === undefined ? null : { schema: entry.text, version };
|
|
52
|
+
});
|
|
46
53
|
}
|
package/dist/read.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export declare function headChange(held: {
|
|
|
61
61
|
readonly author?: unknown;
|
|
62
62
|
readonly created_at?: unknown;
|
|
63
63
|
}): HeadChange | undefined | null;
|
|
64
|
+
export declare function parseOriginals(value: unknown): readonly RoomAttachment[] | null;
|
|
64
65
|
export declare function parseEnvelope(body: unknown): HouseEnvelope | null;
|
|
65
66
|
export declare function parseSiteBootstrap(body: unknown): HouseScope | null;
|
|
66
67
|
export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
|
|
@@ -71,7 +72,6 @@ export type HouseSchema = {
|
|
|
71
72
|
schema: string | null;
|
|
72
73
|
version: string | null;
|
|
73
74
|
};
|
|
74
|
-
export declare function schemaFrom(envelope: HouseEnvelope, tracked: TrackedAuthority, schema: string): HouseSchema | null;
|
|
75
75
|
export declare function schemaOf(scope: HouseScope, schema: string): HouseSchema | null;
|
|
76
76
|
export declare function viewOf(enumeration: HouseEnumeration, tracked: TrackedAuthority): HouseView | undefined;
|
|
77
77
|
export declare function refreshFrom(view: HouseView, fromRoomVersion: string): RefreshResult;
|
package/dist/read.d.ts.map
CHANGED
|
@@ -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;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EA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,OAAO,CAElF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CAsB5D;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAK9E;AAED,wBAAgB,MAAM,CACpB,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,SAAS,GAAG,SAAS,CAEvB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,aAAa,CA+BnF"}
|
package/dist/read.js
CHANGED
|
@@ -3,7 +3,10 @@ export function authorityRoot(handle) {
|
|
|
3
3
|
return `/rooms/${handle}`;
|
|
4
4
|
}
|
|
5
5
|
export function contentPrefixes(tracked) {
|
|
6
|
-
return [
|
|
6
|
+
return [
|
|
7
|
+
authorityRoot(tracked.handle),
|
|
8
|
+
...tracked.schemas.map((schema) => schemaPath(tracked.handle, schema)),
|
|
9
|
+
];
|
|
7
10
|
}
|
|
8
11
|
export function schemaPath(handle, schema) {
|
|
9
12
|
return `${authorityRoot(handle)}/${schema}`;
|
|
@@ -60,7 +63,7 @@ function parseOriginal(value) {
|
|
|
60
63
|
return null;
|
|
61
64
|
return { reference: attachment, name, byteLength: bytes, mediaType, entry: value };
|
|
62
65
|
}
|
|
63
|
-
function parseOriginals(value) {
|
|
66
|
+
export function parseOriginals(value) {
|
|
64
67
|
if (!Array.isArray(value))
|
|
65
68
|
return null;
|
|
66
69
|
const attachments = [];
|
|
@@ -282,12 +285,6 @@ export function bootstrapOf(scope) {
|
|
|
282
285
|
...declared(scope.attachments),
|
|
283
286
|
};
|
|
284
287
|
}
|
|
285
|
-
export function schemaFrom(envelope, tracked, schema) {
|
|
286
|
-
const scope = envelope.scopes.find((entry) => matchesScope(entry, tracked));
|
|
287
|
-
if (scope === undefined)
|
|
288
|
-
return null;
|
|
289
|
-
return schemaOf(scope, schema);
|
|
290
|
-
}
|
|
291
288
|
export function schemaOf(scope, schema) {
|
|
292
289
|
const file = scope.files.find((entry) => entry.path === schema);
|
|
293
290
|
if (file === undefined)
|
package/dist/refusal.d.ts
CHANGED
|
@@ -4,10 +4,9 @@ export type DoorRefusal = ProviderRefusal & {
|
|
|
4
4
|
};
|
|
5
5
|
export declare function doorRefusal(body: unknown): DoorRefusal | null;
|
|
6
6
|
export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: DoorRefusal): ScopedRefusal;
|
|
7
|
-
export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure |
|
|
7
|
+
export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure | null;
|
|
8
|
+
export declare function classifyRead(status: number, body: unknown, locator: string): AdapterFailure | {
|
|
8
9
|
kind: 'beyond-horizon';
|
|
9
10
|
} | null;
|
|
10
|
-
export declare function discoveryFailure(
|
|
11
|
-
kind: 'beyond-horizon';
|
|
12
|
-
}): DiscoverResult;
|
|
11
|
+
export declare function discoveryFailure(status: number, body: unknown): DiscoverResult | null;
|
|
13
12
|
//# sourceMappingURL=refusal.d.ts.map
|
package/dist/refusal.d.ts.map
CHANGED
|
@@ -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;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,
|
|
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"}
|
package/dist/refusal.js
CHANGED
|
@@ -12,7 +12,7 @@ export function doorRefusal(body) {
|
|
|
12
12
|
export function scopedRefusal(locator, scope, refusal) {
|
|
13
13
|
return { kind: 'scoped-refusal', locator, scope, code: refusal.code, fields: refusal.fields };
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
function doorFailure(status, body) {
|
|
16
16
|
if (status === 0)
|
|
17
17
|
return { kind: 'transport-uncertainty' };
|
|
18
18
|
const refusal = doorRefusal(body);
|
|
@@ -20,24 +20,41 @@ export function classifyDoor(status, body, locator) {
|
|
|
20
20
|
return { kind: 'revoked-authorization' };
|
|
21
21
|
if (refusal?.retryable === true)
|
|
22
22
|
return { kind: 'transport-uncertainty' };
|
|
23
|
-
if (
|
|
24
|
-
return { kind: '
|
|
25
|
-
if (status === 404 || refusal?.code === 'room_not_found') {
|
|
26
|
-
return { kind: 'room-not-readable', locator };
|
|
27
|
-
}
|
|
23
|
+
if (status === 404 || refusal?.code === 'room_not_found')
|
|
24
|
+
return { kind: 'room-not-readable' };
|
|
28
25
|
if (status < 400)
|
|
29
26
|
return null;
|
|
30
27
|
if (refusal === null)
|
|
31
28
|
return { kind: 'transport-uncertainty' };
|
|
32
|
-
|
|
33
|
-
return scopedRefusal(locator, 'operation', refusal);
|
|
34
|
-
return scopedRefusal(locator, 'undisclosed', refusal);
|
|
29
|
+
return { kind: 'refused', scope: status === 403 ? 'operation' : 'undisclosed', refusal };
|
|
35
30
|
}
|
|
36
|
-
export function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
export function classifyDoor(status, body, locator) {
|
|
32
|
+
const failure = doorFailure(status, body);
|
|
33
|
+
if (failure === null)
|
|
34
|
+
return null;
|
|
35
|
+
if (failure.kind === 'room-not-readable')
|
|
36
|
+
return { kind: 'room-not-readable', locator };
|
|
37
|
+
if (failure.kind === 'refused')
|
|
38
|
+
return scopedRefusal(locator, failure.scope, failure.refusal);
|
|
39
|
+
return failure;
|
|
40
|
+
}
|
|
41
|
+
export function classifyRead(status, body, locator) {
|
|
42
|
+
if (doorRefusal(body)?.code === 'expired')
|
|
43
|
+
return { kind: 'beyond-horizon' };
|
|
44
|
+
return classifyDoor(status, body, locator);
|
|
45
|
+
}
|
|
46
|
+
export function discoveryFailure(status, body) {
|
|
47
|
+
const failure = doorFailure(status, body);
|
|
48
|
+
if (failure === null)
|
|
49
|
+
return null;
|
|
50
|
+
if (failure.kind === 'revoked-authorization')
|
|
51
|
+
return failure;
|
|
52
|
+
if (failure.kind === 'refused') {
|
|
53
|
+
return {
|
|
54
|
+
kind: 'contract-unavailable',
|
|
55
|
+
code: failure.refusal.code,
|
|
56
|
+
fields: failure.refusal.fields,
|
|
57
|
+
};
|
|
41
58
|
}
|
|
42
59
|
return { kind: 'transport-uncertainty' };
|
|
43
60
|
}
|
package/dist/site.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,
|
|
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,CAiIxE"}
|