@agentshouse/mdruntime-adapter 0.1.0-alpha.9 → 0.1.0-c04b3fdfb64c6
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 +297 -71
- package/README.md +32 -0
- package/dist/actions.d.ts +66 -13
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +279 -354
- package/dist/adapter.d.ts +1 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +480 -218
- package/dist/digest.js +1 -5
- package/dist/discovery.d.ts +24 -34
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +157 -230
- package/dist/gather.d.ts +4 -0
- package/dist/gather.d.ts.map +1 -0
- package/dist/gather.js +45 -0
- package/dist/handed.d.ts +15 -0
- package/dist/handed.d.ts.map +1 -0
- package/dist/handed.js +38 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/map.d.ts +2 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +6 -7
- package/dist/model.d.ts +7 -18
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +60 -57
- package/dist/read.d.ts +62 -29
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +290 -203
- package/dist/referrer.d.ts +7 -0
- package/dist/referrer.d.ts.map +1 -0
- package/dist/referrer.js +35 -0
- package/dist/refusal.d.ts +5 -7
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +47 -68
- package/dist/site.d.ts +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +242 -155
- package/dist/stream.d.ts +18 -6
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +532 -212
- package/dist/transport.d.ts +119 -35
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +4 -3
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +32 -18
- package/dist/write.d.ts +7 -8
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +201 -207
- package/package.json +4 -13
- package/dist/actions.js.map +0 -1
- package/dist/adapter.js.map +0 -1
- package/dist/digest.js.map +0 -1
- package/dist/discovery.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/map.js.map +0 -1
- package/dist/model.js.map +0 -1
- package/dist/read.js.map +0 -1
- package/dist/refusal.js.map +0 -1
- package/dist/site.js.map +0 -1
- package/dist/stream.js.map +0 -1
- package/dist/transport.js.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/write.js.map +0 -1
package/dist/gather.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function gatheredEach(send) {
|
|
2
|
+
let held = [];
|
|
3
|
+
function flush() {
|
|
4
|
+
const taken = held;
|
|
5
|
+
held = [];
|
|
6
|
+
send(taken.map((entry) => entry.ask), (ask, result) => {
|
|
7
|
+
taken[ask]?.resolve(result);
|
|
8
|
+
}).catch((reason) => {
|
|
9
|
+
for (const entry of taken)
|
|
10
|
+
entry.reject(reason);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return (ask) => new Promise((resolve, reject) => {
|
|
14
|
+
if (held.length === 0) {
|
|
15
|
+
// Asks made in one task wait a single event-loop turn so they leave as one batch.
|
|
16
|
+
setTimeout(flush, 0);
|
|
17
|
+
}
|
|
18
|
+
held.push({ ask, resolve, reject });
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function gathered(send) {
|
|
22
|
+
return gatheredEach(async (asks, answer) => {
|
|
23
|
+
(await send(asks)).forEach((result, ask) => {
|
|
24
|
+
answer(ask, result);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function selections(items, weight, limit) {
|
|
29
|
+
const parts = [];
|
|
30
|
+
let part = [];
|
|
31
|
+
let carried = 0;
|
|
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;
|
|
41
|
+
}
|
|
42
|
+
if (part.length > 0)
|
|
43
|
+
parts.push(part);
|
|
44
|
+
return parts;
|
|
45
|
+
}
|
package/dist/handed.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HeldRoom, MutationResult } from '@agentshouse/mdruntime';
|
|
2
|
+
import type { HouseScope, HouseView } from './read.js';
|
|
3
|
+
import type { StreamedAdvancement } from './stream.js';
|
|
4
|
+
export type HandedRoom = {
|
|
5
|
+
roomVersion: string;
|
|
6
|
+
revisions: ReadonlyMap<string, string>;
|
|
7
|
+
};
|
|
8
|
+
export declare function scopeHanded(scope: HouseScope): HandedRoom;
|
|
9
|
+
export declare function heldHanded(held: HeldRoom): HandedRoom;
|
|
10
|
+
export declare function acceptedHanded(held: HandedRoom, accepted: Extract<MutationResult, {
|
|
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;
|
|
15
|
+
//# sourceMappingURL=handed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handed.d.ts","sourceRoot":"","sources":["../src/handed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CASzD;AAOD,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAErD;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EACvD,WAAW,EAAE,MAAM,GAClB,UAAU,CAKZ;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAM7F;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,GAAG,UAAU,CAM1F"}
|
package/dist/handed.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { roomVersion } from './version.js';
|
|
2
|
+
export function scopeHanded(scope) {
|
|
3
|
+
return {
|
|
4
|
+
roomVersion: roomVersion(scope),
|
|
5
|
+
revisions: new Map(scope.files.flatMap(({ path, revision }) => revision === undefined ? [] : [[path, revision]])),
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function revised(revisions, path, revision) {
|
|
9
|
+
if (revision === undefined)
|
|
10
|
+
revisions.delete(path);
|
|
11
|
+
else
|
|
12
|
+
revisions.set(path, revision);
|
|
13
|
+
}
|
|
14
|
+
export function heldHanded(held) {
|
|
15
|
+
return { roomVersion: held.roomVersion, revisions: new Map(Object.entries(held.revisions)) };
|
|
16
|
+
}
|
|
17
|
+
export function acceptedHanded(held, accepted, roomVersion) {
|
|
18
|
+
const revisions = new Map(held.revisions);
|
|
19
|
+
for (const [path, revision] of Object.entries(accepted.revisions))
|
|
20
|
+
revisions.set(path, revision);
|
|
21
|
+
for (const path of accepted.removals)
|
|
22
|
+
revisions.delete(path);
|
|
23
|
+
return { roomVersion, revisions };
|
|
24
|
+
}
|
|
25
|
+
export function enumeratedHanded(view, earlier) {
|
|
26
|
+
const revisions = new Map(earlier?.revisions);
|
|
27
|
+
for (const change of view.changes) {
|
|
28
|
+
revised(revisions, change.path, 'removed' in change ? undefined : change.revision);
|
|
29
|
+
}
|
|
30
|
+
return { roomVersion: roomVersion(view), revisions };
|
|
31
|
+
}
|
|
32
|
+
export function streamedHanded(held, advanced) {
|
|
33
|
+
const revisions = new Map(held.revisions);
|
|
34
|
+
for (const entry of advanced.entries) {
|
|
35
|
+
revised(revisions, entry.path, entry.kind === 'removed' ? undefined : entry.revision);
|
|
36
|
+
}
|
|
37
|
+
return { roomVersion: advanced.page.roomVersion, revisions };
|
|
38
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
|
-
export {
|
|
3
|
-
export type { HouseByteAct, HouseByteTransfer, HouseDoorAnswer,
|
|
2
|
+
export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
|
|
3
|
+
export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDemand, 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,
|
|
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,WAAW,EACX,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/map.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function roomLocalPath(path: string, handle
|
|
2
|
-
export declare function nativePath(path: string, handle
|
|
1
|
+
export declare function roomLocalPath(path: string, handle: string): string;
|
|
2
|
+
export declare function nativePath(path: string, handle: string): string;
|
|
3
3
|
//# sourceMappingURL=map.d.ts.map
|
package/dist/map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUlE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAG/D"}
|
package/dist/map.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
export function roomLocalPath(path, handle) {
|
|
2
|
-
const prefix =
|
|
2
|
+
const prefix = `/rooms/${handle}/`;
|
|
3
3
|
const local = path.startsWith(prefix) ? path.slice(prefix.length) : path;
|
|
4
|
-
if (local === '' ||
|
|
4
|
+
if (local === '' ||
|
|
5
|
+
local.split('/').some((part) => part === '' || part === '.' || part === '..')) {
|
|
5
6
|
throw new Error('invalid authority-relative path');
|
|
6
7
|
}
|
|
7
8
|
return local;
|
|
8
9
|
}
|
|
9
10
|
export function nativePath(path, handle) {
|
|
10
|
-
if (path.startsWith('/'))
|
|
11
|
-
|
|
12
|
-
return
|
|
11
|
+
if (path.startsWith('/'))
|
|
12
|
+
throw new Error('canonical Room path required');
|
|
13
|
+
return `/rooms/${handle}/${roomLocalPath(path, handle)}`;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=map.js.map
|
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: HouseDefinitions | 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 partModels(scope: HouseScope, tracked: TrackedAuthority, seen: ReadonlySet<string>, final: boolean): 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;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
|
@@ -1,64 +1,67 @@
|
|
|
1
1
|
import { sha256Hex } from './digest.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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, revision: null };
|
|
5
|
+
async function heldModel(read, identity) {
|
|
6
|
+
if (read === null)
|
|
7
|
+
return MODEL_ABSENT;
|
|
8
|
+
const version = await sha256Hex(JSON.stringify(read.version));
|
|
9
|
+
return {
|
|
10
|
+
kind: 'model',
|
|
11
|
+
snapshot: { identity, version, schema: read.schema, revision: read.revision },
|
|
12
12
|
};
|
|
13
|
-
return MODEL_ABSENT;
|
|
14
|
-
}
|
|
15
|
-
export function modelKey(locator, attached) {
|
|
16
|
-
return `${locator} ${attached}`;
|
|
17
13
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
version,
|
|
30
|
-
definitions: read.definitions
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
identity: {
|
|
34
|
-
identity,
|
|
35
|
-
version
|
|
14
|
+
async function modelsOf(tracked, read) {
|
|
15
|
+
const models = {};
|
|
16
|
+
const collection = read(tracked.schema);
|
|
17
|
+
if (collection !== undefined) {
|
|
18
|
+
models.collection = await heldModel(collection, schemaPath(tracked.handle, tracked.schema));
|
|
19
|
+
}
|
|
20
|
+
if (tracked.houseModel !== null) {
|
|
21
|
+
const root = tracked.houseModel.root;
|
|
22
|
+
const selection = read(root);
|
|
23
|
+
if (selection !== undefined) {
|
|
24
|
+
models.selection = await heldModel(selection, schemaPath(tracked.handle, root));
|
|
36
25
|
}
|
|
37
|
-
}
|
|
26
|
+
}
|
|
27
|
+
return models.collection === undefined && models.selection === undefined ? undefined : models;
|
|
38
28
|
}
|
|
39
|
-
export function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
29
|
+
export function partModels(scope, tracked, seen, final) {
|
|
30
|
+
return modelsOf(tracked, (schema) => {
|
|
31
|
+
if (scope.files.some((file) => file.path === schema))
|
|
32
|
+
return schemaOf(scope, schema);
|
|
33
|
+
return final && !seen.has(schema) ? ABSENT_SCHEMA : undefined;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export function viewModels(view, tracked) {
|
|
37
|
+
return modelsOf(tracked, (schema) => {
|
|
38
|
+
const change = view.changes.find((candidate) => candidate.path === schema);
|
|
39
|
+
if (change === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
if ('removed' in change)
|
|
42
|
+
return ABSENT_SCHEMA;
|
|
43
|
+
if ('content' in change) {
|
|
44
|
+
return {
|
|
45
|
+
schema: change.content,
|
|
46
|
+
version: change.version,
|
|
47
|
+
revision: change.revision ?? null,
|
|
48
|
+
};
|
|
60
49
|
}
|
|
61
|
-
|
|
50
|
+
return null;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export function streamedModels(schemas, tracked, mode) {
|
|
54
|
+
return modelsOf(tracked, (schema) => {
|
|
55
|
+
const entry = schemas.get(schema);
|
|
56
|
+
if (entry === undefined)
|
|
57
|
+
return undefined;
|
|
58
|
+
if (entry.kind === 'removed')
|
|
59
|
+
return ABSENT_SCHEMA;
|
|
60
|
+
if (entry.text === undefined)
|
|
61
|
+
return null;
|
|
62
|
+
const version = mode === 'site' ? entry.sha256 : entry.revision;
|
|
63
|
+
return version === undefined
|
|
64
|
+
? null
|
|
65
|
+
: { schema: entry.text, version, revision: mode === 'site' ? null : version };
|
|
66
|
+
});
|
|
62
67
|
}
|
|
63
|
-
|
|
64
|
-
//# sourceMappingURL=model.js.map
|
package/dist/read.d.ts
CHANGED
|
@@ -1,28 +1,46 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { AdapterFailure, BinaryFile, BootstrapPage, RefreshResult } from '@agentshouse/mdruntime';
|
|
2
|
+
import type { TrackedAuthority } from './discovery.js';
|
|
3
3
|
import type { HouseMode } from './transport.js';
|
|
4
4
|
import { type LogPosition } from './version.js';
|
|
5
|
+
export type HeadChange = BootstrapPage['changes'][string];
|
|
6
|
+
export declare function identities(revisions: Readonly<Record<string, string>>): {
|
|
7
|
+
fileIds?: Record<string, string>;
|
|
8
|
+
};
|
|
5
9
|
export type HouseManifestFile = {
|
|
6
10
|
path: string;
|
|
7
11
|
revision: string | undefined;
|
|
8
12
|
version: string;
|
|
13
|
+
sha256?: string;
|
|
14
|
+
head?: HeadChange;
|
|
15
|
+
binary?: BinaryFile;
|
|
9
16
|
};
|
|
10
17
|
export type HouseContent = {
|
|
11
18
|
path: string;
|
|
12
19
|
content: string;
|
|
13
20
|
};
|
|
14
21
|
export type HouseScope = LogPosition & {
|
|
15
|
-
scope: 'room' | 'private';
|
|
16
22
|
anchor: string;
|
|
17
|
-
roomHandle: string | undefined;
|
|
18
23
|
files: readonly HouseManifestFile[];
|
|
19
24
|
contents: readonly HouseContent[];
|
|
20
25
|
};
|
|
26
|
+
export type HouseCut = {
|
|
27
|
+
position: string;
|
|
28
|
+
log_epoch: string;
|
|
29
|
+
};
|
|
30
|
+
export type HouseCursor = {
|
|
31
|
+
room: string;
|
|
32
|
+
path: string | null;
|
|
33
|
+
cut?: HouseCut;
|
|
34
|
+
};
|
|
21
35
|
export type HouseEnvelope = {
|
|
22
36
|
scopes: readonly HouseScope[];
|
|
37
|
+
next?: HouseCursor;
|
|
23
38
|
};
|
|
24
39
|
export type HouseGrant = {
|
|
25
|
-
method: 'GET'
|
|
40
|
+
method: 'GET';
|
|
41
|
+
url: string;
|
|
42
|
+
} | {
|
|
43
|
+
method: 'POST';
|
|
26
44
|
operation: string;
|
|
27
45
|
url: string;
|
|
28
46
|
};
|
|
@@ -34,40 +52,55 @@ export type HouseChange = {
|
|
|
34
52
|
content: string;
|
|
35
53
|
revision: string | undefined;
|
|
36
54
|
version: string;
|
|
55
|
+
head?: HeadChange;
|
|
37
56
|
} | {
|
|
38
57
|
path: string;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
binary: BinaryFile;
|
|
59
|
+
revision: string | undefined;
|
|
60
|
+
version: string;
|
|
61
|
+
head?: HeadChange;
|
|
62
|
+
};
|
|
63
|
+
export type HousePage = {
|
|
64
|
+
after: string;
|
|
65
|
+
through: string;
|
|
66
|
+
read: number;
|
|
67
|
+
};
|
|
68
|
+
export type HouseView = LogPosition & {
|
|
69
|
+
authority: string;
|
|
70
|
+
changes: readonly HouseChange[];
|
|
71
|
+
next?: HousePage;
|
|
72
|
+
};
|
|
73
|
+
type PageFailure = AdapterFailure | {
|
|
74
|
+
kind: 'beyond-horizon';
|
|
42
75
|
};
|
|
43
76
|
export type HouseEnumeration = {
|
|
44
|
-
authorities: readonly
|
|
45
|
-
authority: string;
|
|
46
|
-
changes: readonly HouseChange[];
|
|
47
|
-
})[];
|
|
77
|
+
authorities: readonly HouseView[];
|
|
48
78
|
};
|
|
49
|
-
export declare function authorityRoot(handle: string
|
|
50
|
-
export declare const ROOM_README = "ROOM.md";
|
|
51
|
-
export declare function selectionRoots(tracked: TrackedAuthority): readonly string[];
|
|
79
|
+
export declare function authorityRoot(handle: string): string;
|
|
52
80
|
export declare function contentPrefixes(tracked: TrackedAuthority): readonly string[];
|
|
53
|
-
export declare function
|
|
81
|
+
export declare function schemaPath(handle: string, schema: string): string;
|
|
54
82
|
export declare function parseGrant(body: unknown): HouseGrant | null;
|
|
83
|
+
export declare function headChange(held: {
|
|
84
|
+
readonly author?: unknown;
|
|
85
|
+
readonly created_at?: unknown;
|
|
86
|
+
}): HeadChange | undefined | null;
|
|
87
|
+
export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
|
|
55
88
|
export declare function parseEnvelope(body: unknown): HouseEnvelope | null;
|
|
56
89
|
export declare function parseSiteBootstrap(body: unknown): HouseScope | null;
|
|
90
|
+
export declare function siteBootstrapNext(body: unknown): string | null;
|
|
91
|
+
export declare function siteBootstrapOffset(body: unknown): number | null;
|
|
57
92
|
export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
|
|
58
|
-
export declare function
|
|
93
|
+
export declare function wholeView(first: HouseView, more: (page: HousePage) => Promise<HouseView | PageFailure>): Promise<HouseView | PageFailure>;
|
|
94
|
+
export declare function advancedScope(scope: HouseScope, view: HouseView): HouseScope;
|
|
59
95
|
export declare function matchesScope(scope: HouseScope, tracked: TrackedAuthority): boolean;
|
|
60
|
-
export declare function
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
definitions: Readonly<Record<string, string>>;
|
|
66
|
-
versions: readonly string[];
|
|
96
|
+
export declare function bootstrapOf(scope: HouseScope): BootstrapPage;
|
|
97
|
+
export type HouseSchema = {
|
|
98
|
+
schema: string | null;
|
|
99
|
+
version: string | null;
|
|
100
|
+
revision: string | null;
|
|
67
101
|
};
|
|
68
|
-
export declare
|
|
69
|
-
export declare function
|
|
70
|
-
export declare function
|
|
71
|
-
export
|
|
72
|
-
export declare function refreshFrom(enumeration: HouseEnumeration, tracked: TrackedAuthority, fromRoomVersion: string): RefreshResult;
|
|
102
|
+
export declare function schemaOf(scope: HouseScope, schema: string): HouseSchema | null;
|
|
103
|
+
export declare function viewOf(enumeration: HouseEnumeration, tracked: TrackedAuthority): HouseView | undefined;
|
|
104
|
+
export declare function refreshFrom(view: HouseView, fromRoomVersion: string): RefreshResult;
|
|
105
|
+
export {};
|
|
73
106
|
//# 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,KAAK,EACV,cAAc,EACd,UAAU,EACV,aAAa,EAEb,aAAa,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpF,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAI1D,wBAAgB,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAQA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,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;CACnC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,EAAE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