@agentshouse/mdruntime-adapter 0.1.0-ceda7e87cc6e8 → 0.1.0-cedb8e57837a7
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 +281 -276
- package/dist/actions.d.ts +23 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +54 -35
- package/dist/adapter.d.ts +1 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +258 -73
- package/dist/discovery.d.ts +5 -3
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +29 -10
- package/dist/gather.d.ts +1 -1
- package/dist/gather.d.ts.map +1 -1
- package/dist/gather.js +4 -14
- package/dist/handed.d.ts +6 -6
- package/dist/handed.d.ts.map +1 -1
- package/dist/handed.js +36 -29
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/model.d.ts +0 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -3
- package/dist/read.d.ts +44 -7
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +177 -59
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +2 -1
- package/dist/site.d.ts +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +159 -62
- package/dist/stream.d.ts +4 -4
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +334 -43
- package/dist/transport.d.ts +49 -4
- package/dist/transport.d.ts.map +1 -1
- package/dist/version.d.ts +1 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/write.d.ts +12 -1
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +85 -40
- package/package.json +2 -3
package/dist/discovery.js
CHANGED
|
@@ -13,10 +13,12 @@ const BOUND_KEYS = [
|
|
|
13
13
|
'max_inline_body_bytes',
|
|
14
14
|
'max_upload_bytes',
|
|
15
15
|
'max_prefixes',
|
|
16
|
+
'max_held_files',
|
|
16
17
|
'change_retention_seconds',
|
|
17
18
|
'operation_retention_seconds',
|
|
18
19
|
];
|
|
19
|
-
const OPERATION_KEYS = ['
|
|
20
|
+
const OPERATION_KEYS = ['write', 'delete'];
|
|
21
|
+
const READ_LEVELS = ['mcp', 'online', 'local'];
|
|
20
22
|
function stringList(value) {
|
|
21
23
|
if (!Array.isArray(value))
|
|
22
24
|
return null;
|
|
@@ -33,6 +35,12 @@ function parseBounds(value) {
|
|
|
33
35
|
return null;
|
|
34
36
|
bounds[key] = amount;
|
|
35
37
|
}
|
|
38
|
+
const moves = held.max_move_documents;
|
|
39
|
+
if (moves !== undefined) {
|
|
40
|
+
if (typeof moves !== 'number' || !Number.isFinite(moves))
|
|
41
|
+
return null;
|
|
42
|
+
bounds.max_move_documents = moves;
|
|
43
|
+
}
|
|
36
44
|
return bounds;
|
|
37
45
|
}
|
|
38
46
|
function parseHouseModel(value) {
|
|
@@ -84,7 +92,12 @@ function parseAuthority(value) {
|
|
|
84
92
|
const houseModel = parseHouseModel(held.house_model);
|
|
85
93
|
const protectedPaths = stringList(held.protected_paths);
|
|
86
94
|
const operations = parseOperations(held.operations);
|
|
87
|
-
|
|
95
|
+
const read = READ_LEVELS.find((level) => level === held.read);
|
|
96
|
+
if (at === null ||
|
|
97
|
+
houseModel === undefined ||
|
|
98
|
+
protectedPaths === null ||
|
|
99
|
+
read === undefined ||
|
|
100
|
+
operations === null)
|
|
88
101
|
return null;
|
|
89
102
|
if (typeof held.room_ref !== 'string' || held.room_ref.length === 0)
|
|
90
103
|
return null;
|
|
@@ -98,6 +111,7 @@ function parseAuthority(value) {
|
|
|
98
111
|
houseModel,
|
|
99
112
|
managedReplication: held.managed_replication,
|
|
100
113
|
protectedPaths,
|
|
114
|
+
read,
|
|
101
115
|
operations,
|
|
102
116
|
...at,
|
|
103
117
|
};
|
|
@@ -204,8 +218,11 @@ export function providerLimits(bounds) {
|
|
|
204
218
|
{ name: 'change-documents', value: bounds.max_batch_documents },
|
|
205
219
|
{ name: 'path-length', value: bounds.max_path_length },
|
|
206
220
|
{ name: 'path-depth', value: bounds.max_path_depth },
|
|
221
|
+
...(bounds.max_move_documents === undefined
|
|
222
|
+
? []
|
|
223
|
+
: [{ name: 'move-documents', value: bounds.max_move_documents }]),
|
|
207
224
|
{ name: 'write-rate' },
|
|
208
|
-
{ name: '
|
|
225
|
+
{ name: 'storage-limit' },
|
|
209
226
|
];
|
|
210
227
|
}
|
|
211
228
|
export function declaredRetention(bounds) {
|
|
@@ -215,15 +232,15 @@ export function declaredRetention(bounds) {
|
|
|
215
232
|
refreshHorizon: bounds.change_retention_seconds,
|
|
216
233
|
};
|
|
217
234
|
}
|
|
218
|
-
export function capabilities(
|
|
219
|
-
const house =
|
|
235
|
+
export function capabilities(actions, rooms) {
|
|
236
|
+
const house = rooms.find((room) => room.houseModel !== null);
|
|
220
237
|
return [
|
|
221
238
|
{
|
|
222
239
|
name: PROVIDER_ACTIONS,
|
|
223
|
-
actions: declaredActions(
|
|
240
|
+
actions: declaredActions(actions),
|
|
224
241
|
...(house === undefined
|
|
225
242
|
? {}
|
|
226
|
-
: { conversationAgents: houseConversationAgents(house.
|
|
243
|
+
: { conversationAgents: houseConversationAgents(house.authority) }),
|
|
227
244
|
},
|
|
228
245
|
];
|
|
229
246
|
}
|
|
@@ -243,12 +260,14 @@ export function discoveredRoom(authority) {
|
|
|
243
260
|
handle: authority.roomHandle,
|
|
244
261
|
roomVersion: roomVersion(authority),
|
|
245
262
|
operations: {
|
|
246
|
-
read: [...authority.operations.read],
|
|
247
|
-
sync: [...authority.operations.sync],
|
|
248
263
|
write: [...authority.operations.write],
|
|
249
264
|
delete: [...authority.operations.delete],
|
|
250
265
|
},
|
|
251
|
-
replica: {
|
|
266
|
+
replica: {
|
|
267
|
+
selection: locator,
|
|
268
|
+
admission: authority.managedReplication,
|
|
269
|
+
offline: authority.read === 'online' ? 'locked' : 'open',
|
|
270
|
+
},
|
|
252
271
|
...(authority.houseModel === null
|
|
253
272
|
? {}
|
|
254
273
|
: { typedSelection: { roots: [...authority.houseModel.paths] } }),
|
package/dist/gather.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function gatheredEach<A, R>(send: (asks: readonly A[], answer: (ask: number, result: R) => void) => Promise<void>): (ask: A) => Promise<R>;
|
|
2
2
|
export declare function gathered<A, R>(send: (asks: readonly A[]) => Promise<readonly R[]>): (ask: A) => Promise<R>;
|
|
3
|
-
export declare function selections<T>(items: readonly T[],
|
|
3
|
+
export declare function selections<T>(items: readonly T[], limit: number): readonly (readonly T[])[];
|
|
4
4
|
//# sourceMappingURL=gather.d.ts.map
|
package/dist/gather.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAC/B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GACpF,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAwBxB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAMxB;AAED,wBAAgB,UAAU,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAC/B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GACpF,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAwBxB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAMxB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAO3F"}
|
package/dist/gather.js
CHANGED
|
@@ -25,21 +25,11 @@ export function gathered(send) {
|
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
export function selections(items,
|
|
28
|
+
export function selections(items, limit) {
|
|
29
|
+
const size = Math.max(1, limit);
|
|
29
30
|
const parts = [];
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
for (const item of items) {
|
|
33
|
-
const weighed = weight(item);
|
|
34
|
-
if (part.length > 0 && carried + weighed > limit) {
|
|
35
|
-
parts.push(part);
|
|
36
|
-
part = [];
|
|
37
|
-
carried = 0;
|
|
38
|
-
}
|
|
39
|
-
part.push(item);
|
|
40
|
-
carried += weighed;
|
|
31
|
+
for (let start = 0; start < items.length; start += size) {
|
|
32
|
+
parts.push(items.slice(start, start + size));
|
|
41
33
|
}
|
|
42
|
-
if (part.length > 0)
|
|
43
|
-
parts.push(part);
|
|
44
34
|
return parts;
|
|
45
35
|
}
|
package/dist/handed.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type HeldRoom, type MutationResult } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { HouseScope, HouseView } from './read.js';
|
|
3
3
|
import type { StreamedAdvancement } from './stream.js';
|
|
4
4
|
export type HandedRoom = {
|
|
5
5
|
roomVersion: string;
|
|
6
|
-
revisions:
|
|
6
|
+
revisions: Readonly<Record<string, string>>;
|
|
7
7
|
};
|
|
8
|
-
export declare function scopeHanded(scope: HouseScope): HandedRoom
|
|
8
|
+
export declare function scopeHanded(scope: HouseScope): Generator<number, HandedRoom, void>;
|
|
9
9
|
export declare function heldHanded(held: HeldRoom): HandedRoom;
|
|
10
10
|
export declare function acceptedHanded(held: HandedRoom, accepted: Extract<MutationResult, {
|
|
11
11
|
kind: 'accepted';
|
|
12
|
-
}>, roomVersion: string): HandedRoom
|
|
13
|
-
export declare function enumeratedHanded(view: HouseView, earlier: HandedRoom | undefined): HandedRoom
|
|
14
|
-
export declare function streamedHanded(held: HandedRoom, advanced: StreamedAdvancement): HandedRoom
|
|
12
|
+
}>, roomVersion: string): Generator<number, HandedRoom, void>;
|
|
13
|
+
export declare function enumeratedHanded(view: HouseView, earlier: HandedRoom | undefined): Generator<number, HandedRoom, void>;
|
|
14
|
+
export declare function streamedHanded(held: HandedRoom, advanced: StreamedAdvancement): Generator<number, HandedRoom, void>;
|
|
15
15
|
//# sourceMappingURL=handed.d.ts.map
|
package/dist/handed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handed.d.ts","sourceRoot":"","sources":["../src/handed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"handed.d.ts","sourceRoot":"","sources":["../src/handed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,KAAK,EAAqB,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC7C,CAAC;AAMF,wBAAiB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,CAEnF;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAErD;AAED,wBAAiB,cAAc,CAC7B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EACvD,WAAW,EAAE,MAAM,GAClB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,CAKrC;AAgBD,wBAAiB,gBAAgB,CAC/B,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,UAAU,GAAG,SAAS,GAC9B,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,CAKrC;AAED,wBAAiB,cAAc,CAC7B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,mBAAmB,GAC5B,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,CAMrC"}
|
package/dist/handed.js
CHANGED
|
@@ -1,38 +1,45 @@
|
|
|
1
|
+
import { entriesIn, patching } from '@agentshouse/mdruntime';
|
|
1
2
|
import { roomVersion } from './version.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
3
|
+
function* revised(files) {
|
|
4
|
+
for (const { path, revision } of files)
|
|
5
|
+
if (revision !== undefined)
|
|
6
|
+
yield [path, revision];
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
revisions.delete(path);
|
|
11
|
-
else
|
|
12
|
-
revisions.set(path, revision);
|
|
8
|
+
export function* scopeHanded(scope) {
|
|
9
|
+
return { roomVersion: roomVersion(scope), revisions: yield* patching({}, revised(scope.files)) };
|
|
13
10
|
}
|
|
14
11
|
export function heldHanded(held) {
|
|
15
|
-
return { roomVersion: held.roomVersion, revisions:
|
|
16
|
-
}
|
|
17
|
-
export function acceptedHanded(held, accepted, roomVersion) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
revisions.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
export function enumeratedHanded(view, earlier) {
|
|
26
|
-
const revisions = new Map(earlier?.revisions);
|
|
12
|
+
return { roomVersion: held.roomVersion, revisions: held.revisions };
|
|
13
|
+
}
|
|
14
|
+
export function* acceptedHanded(held, accepted, roomVersion) {
|
|
15
|
+
return {
|
|
16
|
+
roomVersion,
|
|
17
|
+
revisions: yield* patching(held.revisions, entriesIn(accepted.revisions), accepted.removals),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function* kept(view) {
|
|
27
21
|
for (const change of view.changes) {
|
|
28
|
-
|
|
22
|
+
if (!('removed' in change) && change.revision !== undefined) {
|
|
23
|
+
yield [change.path, change.revision];
|
|
24
|
+
}
|
|
29
25
|
}
|
|
30
|
-
return { roomVersion: roomVersion(view), revisions };
|
|
31
26
|
}
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
function* dropped(view) {
|
|
28
|
+
for (const change of view.changes) {
|
|
29
|
+
if ('removed' in change || change.revision === undefined)
|
|
30
|
+
yield change.path;
|
|
36
31
|
}
|
|
37
|
-
|
|
32
|
+
}
|
|
33
|
+
export function* enumeratedHanded(view, earlier) {
|
|
34
|
+
return {
|
|
35
|
+
roomVersion: roomVersion(view),
|
|
36
|
+
revisions: yield* patching(earlier?.revisions ?? {}, kept(view), dropped(view)),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function* streamedHanded(held, advanced) {
|
|
40
|
+
const { page } = advanced;
|
|
41
|
+
return {
|
|
42
|
+
roomVersion: page.roomVersion,
|
|
43
|
+
revisions: yield* patching(held.revisions, entriesIn(page.revisions), page.removals),
|
|
44
|
+
};
|
|
38
45
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
2
|
export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
|
|
3
|
-
export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
3
|
+
export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
4
4
|
//# 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,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
package/dist/model.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { TrackedAuthority } from './discovery.js';
|
|
|
3
3
|
import { type HouseScope, type HouseView } from './read.js';
|
|
4
4
|
import type { HouseMode, HouseStreamEntry } from './transport.js';
|
|
5
5
|
export declare function partModels(scope: HouseScope, tracked: TrackedAuthority, seen: ReadonlySet<string>, final: boolean): Promise<RoomModels | undefined>;
|
|
6
|
-
export declare function scopeModels(scope: HouseScope, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
|
|
7
6
|
export declare function viewModels(view: HouseView, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
|
|
8
7
|
export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode): Promise<RoomModels | undefined>;
|
|
9
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,EAAe,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAA0C,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAoClE,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAKjC;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAA0C,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAoClE,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAKjC;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAcjC;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,CAWjC"}
|
package/dist/model.js
CHANGED
|
@@ -33,9 +33,6 @@ export function partModels(scope, tracked, seen, final) {
|
|
|
33
33
|
return final && !seen.has(schema) ? ABSENT_SCHEMA : undefined;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
export function scopeModels(scope, tracked) {
|
|
37
|
-
return partModels(scope, tracked, new Set(), true);
|
|
38
|
-
}
|
|
39
36
|
export function viewModels(view, tracked) {
|
|
40
37
|
return modelsOf(tracked, (schema) => {
|
|
41
38
|
const change = view.changes.find((candidate) => candidate.path === schema);
|
package/dist/read.d.ts
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AdapterFailure, type BinaryFile, type BootstrapPage, type RefreshResult } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
3
|
import type { HouseMode } from './transport.js';
|
|
4
4
|
import { type LogPosition } from './version.js';
|
|
5
5
|
export type HeadChange = BootstrapPage['changes'][string];
|
|
6
|
+
export type Answered = {
|
|
7
|
+
readonly documents: Map<string, string>;
|
|
8
|
+
readonly revisions: Map<string, string>;
|
|
9
|
+
readonly fileIds: Map<string, string>;
|
|
10
|
+
readonly changes: Map<string, HeadChange>;
|
|
11
|
+
readonly binaryFiles: Map<string, BinaryFile>;
|
|
12
|
+
readonly removals: Set<string>;
|
|
13
|
+
};
|
|
14
|
+
export declare function answering(): Answered;
|
|
15
|
+
export declare function revised(answer: Answered, path: string, revision: string): void;
|
|
16
|
+
export declare function forgotten(answer: Answered, path: string): void;
|
|
17
|
+
export declare function answered(answer: Answered): Generator<number, {
|
|
18
|
+
documents: Readonly<Record<string, string>>;
|
|
19
|
+
revisions: Readonly<Record<string, string>>;
|
|
20
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
21
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
22
|
+
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
23
|
+
removals: readonly string[];
|
|
24
|
+
}, void>;
|
|
6
25
|
export type HouseManifestFile = {
|
|
7
26
|
path: string;
|
|
8
27
|
revision: string | undefined;
|
|
9
28
|
version: string;
|
|
29
|
+
sha256?: string;
|
|
10
30
|
head?: HeadChange;
|
|
11
31
|
binary?: BinaryFile;
|
|
12
32
|
};
|
|
@@ -19,9 +39,14 @@ export type HouseScope = LogPosition & {
|
|
|
19
39
|
files: readonly HouseManifestFile[];
|
|
20
40
|
contents: readonly HouseContent[];
|
|
21
41
|
};
|
|
42
|
+
export type HouseCut = {
|
|
43
|
+
position: string;
|
|
44
|
+
log_epoch: string;
|
|
45
|
+
};
|
|
22
46
|
export type HouseCursor = {
|
|
23
47
|
room: string;
|
|
24
48
|
path: string | null;
|
|
49
|
+
cut?: HouseCut;
|
|
25
50
|
};
|
|
26
51
|
export type HouseEnvelope = {
|
|
27
52
|
scopes: readonly HouseScope[];
|
|
@@ -51,15 +76,23 @@ export type HouseChange = {
|
|
|
51
76
|
version: string;
|
|
52
77
|
head?: HeadChange;
|
|
53
78
|
};
|
|
79
|
+
export type HousePage = {
|
|
80
|
+
after: string;
|
|
81
|
+
through: string;
|
|
82
|
+
read: number;
|
|
83
|
+
};
|
|
54
84
|
export type HouseView = LogPosition & {
|
|
55
85
|
authority: string;
|
|
56
86
|
changes: readonly HouseChange[];
|
|
87
|
+
next?: HousePage;
|
|
88
|
+
};
|
|
89
|
+
type PageFailure = AdapterFailure | {
|
|
90
|
+
kind: 'beyond-horizon';
|
|
57
91
|
};
|
|
58
92
|
export type HouseEnumeration = {
|
|
59
93
|
authorities: readonly HouseView[];
|
|
60
94
|
};
|
|
61
95
|
export declare function authorityRoot(handle: string): string;
|
|
62
|
-
export declare function contentPrefixes(tracked: TrackedAuthority): readonly string[];
|
|
63
96
|
export declare function schemaPath(handle: string, schema: string): string;
|
|
64
97
|
export declare function parseGrant(body: unknown): HouseGrant | null;
|
|
65
98
|
export declare function headChange(held: {
|
|
@@ -67,12 +100,15 @@ export declare function headChange(held: {
|
|
|
67
100
|
readonly created_at?: unknown;
|
|
68
101
|
}): HeadChange | undefined | null;
|
|
69
102
|
export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
|
|
70
|
-
export declare function parseEnvelope(body: unknown): HouseEnvelope | null
|
|
71
|
-
export declare function parseSiteBootstrap(body: unknown): HouseScope | null
|
|
103
|
+
export declare function parseEnvelope(body: unknown): Generator<number, HouseEnvelope | null, void>;
|
|
104
|
+
export declare function parseSiteBootstrap(body: unknown): Generator<number, HouseScope | null, void>;
|
|
105
|
+
export declare function siteBootstrapNext(body: unknown): string | null;
|
|
106
|
+
export declare function siteBootstrapOffset(body: unknown): number | null;
|
|
72
107
|
export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
|
|
73
|
-
export declare function
|
|
108
|
+
export declare function wholeView(first: HouseView, more: (page: HousePage) => Promise<HouseView | PageFailure>): Promise<HouseView | PageFailure>;
|
|
109
|
+
export declare function advancedScope(scope: HouseScope, view: HouseView): Generator<number, HouseScope, void>;
|
|
74
110
|
export declare function matchesScope(scope: HouseScope, tracked: TrackedAuthority): boolean;
|
|
75
|
-
export declare function
|
|
111
|
+
export declare function bootstrapping(scope: HouseScope): Generator<number, BootstrapPage, void>;
|
|
76
112
|
export type HouseSchema = {
|
|
77
113
|
schema: string | null;
|
|
78
114
|
version: string | null;
|
|
@@ -80,5 +116,6 @@ export type HouseSchema = {
|
|
|
80
116
|
};
|
|
81
117
|
export declare function schemaOf(scope: HouseScope, schema: string): HouseSchema | null;
|
|
82
118
|
export declare function viewOf(enumeration: HouseEnumeration, tracked: TrackedAuthority): HouseView | undefined;
|
|
83
|
-
export declare function refreshFrom(view: HouseView, fromRoomVersion: string): RefreshResult
|
|
119
|
+
export declare function refreshFrom(view: HouseView, fromRoomVersion: string): Promise<RefreshResult>;
|
|
120
|
+
export {};
|
|
84
121
|
//# sourceMappingURL=read.d.ts.map
|
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,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAA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