@agentshouse/mdruntime-adapter 0.1.0-ce3ced044cab5 → 0.1.0-ce3f1a73f440b
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/dist/actions.d.ts +1 -46
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +1 -223
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +60 -213
- package/dist/discovery.d.ts +8 -3
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +29 -22
- package/dist/history.d.ts +12 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +91 -0
- package/dist/house-model.d.ts +954 -1
- package/dist/house-model.d.ts.map +1 -1
- package/dist/house-model.js +521 -486
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/model.d.ts +1 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -17
- package/dist/read.d.ts +1 -44
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +2 -173
- package/dist/refusal.d.ts +0 -3
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +0 -5
- package/dist/room-types.js +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +44 -90
- package/dist/stream.d.ts +13 -14
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +160 -423
- package/dist/transport.d.ts +38 -34
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +53 -12
- package/dist/upload.d.ts.map +1 -1
- package/dist/upload.js +2 -2
- package/dist/write.d.ts +2 -1
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +7 -17
- package/package.json +2 -2
- package/dist/gather.d.ts +0 -3
- package/dist/gather.d.ts.map +0 -1
- package/dist/gather.js +0 -35
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
2
|
export { finishedUpload, houseUpload, type HouseUpload } from './upload.js';
|
|
3
|
-
export {
|
|
3
|
+
export { houseAction, type HouseActDoor } from './actions.js';
|
|
4
|
+
export { HISTORY_PAGE } from './history.js';
|
|
4
5
|
export { houseParts, type ChangeMapping } from './write.js';
|
|
5
6
|
export { APP_REFERENCE_PATTERN } from './app-reference.js';
|
|
6
|
-
export { HOUSE_MODEL_TYPES } from './house-model.js';
|
|
7
|
+
export { HOUSE_MODEL_DECLARATION, HOUSE_MODEL_TYPES, type HouseDocumentFields, type HouseModelType, } from './house-model.js';
|
|
7
8
|
export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
|
|
8
9
|
export { HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, INBOX_CHAT_TYPE, INBOX_MESSAGE_TYPE, type InboxChannelKind, } from './room-types.js';
|
|
10
|
+
export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, type HouseRuntimeAct, type HouseRuntimeFrame, } from './transport.js';
|
|
9
11
|
export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamed, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
10
12
|
//# 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,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,
|
|
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,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter } from './adapter.js';
|
|
2
2
|
export { finishedUpload, houseUpload } from './upload.js';
|
|
3
|
-
export {
|
|
3
|
+
export { houseAction } from './actions.js';
|
|
4
|
+
export { HISTORY_PAGE } from './history.js';
|
|
4
5
|
export { houseParts } from './write.js';
|
|
5
6
|
export { APP_REFERENCE_PATTERN } from './app-reference.js';
|
|
6
|
-
export { HOUSE_MODEL_TYPES } from './house-model.js';
|
|
7
|
+
export { HOUSE_MODEL_DECLARATION, HOUSE_MODEL_TYPES, } from './house-model.js';
|
|
7
8
|
export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
|
|
8
9
|
export { HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, INBOX_CHAT_TYPE, INBOX_MESSAGE_TYPE, } from './room-types.js';
|
|
10
|
+
export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, } from './transport.js';
|
package/dist/model.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { RoomModels } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
|
-
import { type HouseRoomHead, type HouseScope
|
|
3
|
+
import { type HouseRoomHead, type HouseScope } 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
6
|
export declare function manifestedModels(room: HouseRoomHead, tracked: TrackedAuthority): Promise<{
|
|
7
7
|
readonly models: RoomModels | undefined;
|
|
8
8
|
readonly seen: string[];
|
|
9
9
|
}>;
|
|
10
|
-
export declare function viewModels(view: HouseView, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
|
|
11
10
|
export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode): Promise<RoomModels | undefined>;
|
|
12
11
|
//# 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,EAIL,KAAK,aAAa,EAElB,KAAK,UAAU,
|
|
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,EAIL,KAAK,aAAa,EAElB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA0BlE,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,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAM/E;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
|
@@ -31,23 +31,6 @@ export async function manifestedModels(room, tracked) {
|
|
|
31
31
|
seen: scope.files.some((file) => file.path === tracked.schema) ? [tracked.schema] : [],
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
export function viewModels(view, tracked) {
|
|
35
|
-
return modelsOf(tracked, (schema) => {
|
|
36
|
-
const change = view.changes.find((candidate) => candidate.path === schema);
|
|
37
|
-
if (change === undefined)
|
|
38
|
-
return undefined;
|
|
39
|
-
if ('removed' in change)
|
|
40
|
-
return ABSENT_SCHEMA;
|
|
41
|
-
if ('content' in change) {
|
|
42
|
-
return {
|
|
43
|
-
schema: change.content,
|
|
44
|
-
version: change.version,
|
|
45
|
-
revision: change.revision ?? null,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
34
|
export function streamedModels(schemas, tracked, mode) {
|
|
52
35
|
return modelsOf(tracked, (schema) => {
|
|
53
36
|
const entry = schemas.get(schema);
|
package/dist/read.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { TrackedAuthority } from './discovery.js';
|
|
1
|
+
import { type BinaryFile, type BootstrapPage, type RoomModels, type TransportUncertainty } from '@agentshouse/mdruntime';
|
|
3
2
|
import type { HouseMode } from './transport.js';
|
|
4
3
|
import { type LogPosition } from './version.js';
|
|
5
4
|
export type HeadChange = BootstrapPage['changes'][string];
|
|
@@ -63,43 +62,6 @@ export type HouseFileAddress = {
|
|
|
63
62
|
sha256: string;
|
|
64
63
|
mediaType: string;
|
|
65
64
|
};
|
|
66
|
-
export type HouseChange = {
|
|
67
|
-
path: string;
|
|
68
|
-
removed: true;
|
|
69
|
-
} | {
|
|
70
|
-
path: string;
|
|
71
|
-
content: string;
|
|
72
|
-
revision: string | undefined;
|
|
73
|
-
version: string;
|
|
74
|
-
head?: HeadChange;
|
|
75
|
-
} | {
|
|
76
|
-
path: string;
|
|
77
|
-
binary: BinaryFile;
|
|
78
|
-
revision: string | undefined;
|
|
79
|
-
version: string;
|
|
80
|
-
head?: HeadChange;
|
|
81
|
-
};
|
|
82
|
-
export type HousePage = {
|
|
83
|
-
after: string;
|
|
84
|
-
through: string;
|
|
85
|
-
read: number;
|
|
86
|
-
};
|
|
87
|
-
export type HouseFolder = {
|
|
88
|
-
path: string;
|
|
89
|
-
removed: boolean;
|
|
90
|
-
};
|
|
91
|
-
export type HouseView = LogPosition & {
|
|
92
|
-
authority: string;
|
|
93
|
-
changes: readonly HouseChange[];
|
|
94
|
-
folders?: readonly HouseFolder[];
|
|
95
|
-
next?: HousePage;
|
|
96
|
-
};
|
|
97
|
-
type PageFailure = AdapterFailure | {
|
|
98
|
-
kind: 'beyond-horizon';
|
|
99
|
-
};
|
|
100
|
-
export type HouseEnumeration = {
|
|
101
|
-
authorities: readonly HouseView[];
|
|
102
|
-
};
|
|
103
65
|
export declare function authorityRoot(handle: string): string;
|
|
104
66
|
export declare function schemaPath(handle: string, schema: string): string;
|
|
105
67
|
export declare function parseGrant(body: unknown): HouseGrant | null;
|
|
@@ -117,8 +79,6 @@ export declare function housePart(room: HouseRoomHead, payload: Uint8Array<Array
|
|
|
117
79
|
scope: HouseScope;
|
|
118
80
|
ended: boolean;
|
|
119
81
|
} | TransportUncertainty>;
|
|
120
|
-
export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
|
|
121
|
-
export declare function wholeView(first: HouseView, more: (page: HousePage) => Promise<HouseView | PageFailure>): Promise<HouseView | PageFailure>;
|
|
122
82
|
export declare function bootstrapping(scope: HouseScope): Generator<number, BootstrapPage, void>;
|
|
123
83
|
export type HouseSchema = {
|
|
124
84
|
schema: string | null;
|
|
@@ -126,7 +86,4 @@ export type HouseSchema = {
|
|
|
126
86
|
revision: string | null;
|
|
127
87
|
};
|
|
128
88
|
export declare function schemaOf(scope: HouseScope, schema: string): HouseSchema | null;
|
|
129
|
-
export declare function viewOf(enumeration: HouseEnumeration, tracked: TrackedAuthority): HouseView | undefined;
|
|
130
|
-
export declare function refreshFrom(view: HouseView, fromRoomVersion: string): Promise<RefreshResult>;
|
|
131
|
-
export {};
|
|
132
89
|
//# 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,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,aAAa,EAElB,KAAK,UAAU,EACf,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC,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;AAQ1D,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACtC,CAAC;AAEF,wBAAgB,SAAS,IAAI,QAAQ,CAWpC;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,QAAQ,EA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ROW_WEIGHT,
|
|
1
|
+
import { paced, patching, ROW_WEIGHT, } from '@agentshouse/mdruntime';
|
|
2
2
|
import { gunzipped } from './part.js';
|
|
3
|
-
import {
|
|
3
|
+
import { readPosition, roomVersion } from './version.js';
|
|
4
4
|
const REVISION_FILE = /^fr_([0-9a-z]+)\.[0-9a-z]+\.[0-9a-z]$/u;
|
|
5
5
|
function fileOf(revision) {
|
|
6
6
|
return REVISION_FILE.exec(revision)?.[1];
|
|
@@ -311,146 +311,6 @@ export async function housePart(room, payload, mode) {
|
|
|
311
311
|
const { ended, ...scope } = read;
|
|
312
312
|
return { scope: { ...emptyScope(room), ...scope }, ended };
|
|
313
313
|
}
|
|
314
|
-
function folderChange(value) {
|
|
315
|
-
if (typeof value !== 'object' || value === null)
|
|
316
|
-
return null;
|
|
317
|
-
const { path, folder, removed, ...rest } = value;
|
|
318
|
-
return typeof path === 'string' &&
|
|
319
|
-
folder === true &&
|
|
320
|
-
(removed === undefined || removed === true) &&
|
|
321
|
-
Object.keys(rest).length === 0
|
|
322
|
-
? { path, removed: removed === true }
|
|
323
|
-
: null;
|
|
324
|
-
}
|
|
325
|
-
function parseChange(value, mode) {
|
|
326
|
-
if (typeof value !== 'object' || value === null)
|
|
327
|
-
return null;
|
|
328
|
-
const held = value;
|
|
329
|
-
if (typeof held.path !== 'string')
|
|
330
|
-
return null;
|
|
331
|
-
if (held.removed === true)
|
|
332
|
-
return { path: held.path, removed: true };
|
|
333
|
-
const head = headChange(held);
|
|
334
|
-
const binary = binaryFileOf(held);
|
|
335
|
-
if (head === null || binary === null)
|
|
336
|
-
return null;
|
|
337
|
-
if (binary !== undefined) {
|
|
338
|
-
if (mode === 'credential' && typeof held.revision !== 'string')
|
|
339
|
-
return null;
|
|
340
|
-
const revision = typeof held.revision === 'string' ? held.revision : binary.sha256;
|
|
341
|
-
return { path: held.path, binary, revision, version: revision, ...headed(head) };
|
|
342
|
-
}
|
|
343
|
-
if (mode === 'site') {
|
|
344
|
-
if (typeof held.content !== 'string' || typeof held.sha256 !== 'string')
|
|
345
|
-
return null;
|
|
346
|
-
return {
|
|
347
|
-
path: held.path,
|
|
348
|
-
content: held.content,
|
|
349
|
-
revision: undefined,
|
|
350
|
-
version: held.sha256,
|
|
351
|
-
...headed(head),
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
if (typeof held.content === 'string' && typeof held.revision === 'string') {
|
|
355
|
-
return {
|
|
356
|
-
path: held.path,
|
|
357
|
-
content: held.content,
|
|
358
|
-
revision: held.revision,
|
|
359
|
-
version: held.revision,
|
|
360
|
-
...headed(head),
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
return null;
|
|
364
|
-
}
|
|
365
|
-
export function parseEnumeration(body, mode) {
|
|
366
|
-
if (typeof body !== 'object' || body === null)
|
|
367
|
-
return null;
|
|
368
|
-
if (!('authorities' in body) || !Array.isArray(body.authorities))
|
|
369
|
-
return null;
|
|
370
|
-
const authorities = [];
|
|
371
|
-
for (const entry of body.authorities) {
|
|
372
|
-
if (typeof entry !== 'object' || entry === null)
|
|
373
|
-
return null;
|
|
374
|
-
const held = entry;
|
|
375
|
-
const at = readPosition(held);
|
|
376
|
-
if (typeof held.authority !== 'string' || at === null)
|
|
377
|
-
return null;
|
|
378
|
-
if (!Array.isArray(held.changes))
|
|
379
|
-
return null;
|
|
380
|
-
const changes = [];
|
|
381
|
-
const folders = [];
|
|
382
|
-
for (const change of held.changes) {
|
|
383
|
-
const folder = folderChange(change);
|
|
384
|
-
if (folder !== null) {
|
|
385
|
-
folders.push(folder);
|
|
386
|
-
continue;
|
|
387
|
-
}
|
|
388
|
-
const mapped = parseChange(change, mode);
|
|
389
|
-
if (mapped === null)
|
|
390
|
-
return null;
|
|
391
|
-
changes.push(mapped);
|
|
392
|
-
}
|
|
393
|
-
const next = held.next === undefined ? undefined : readPage(held.next);
|
|
394
|
-
if (next === null)
|
|
395
|
-
return null;
|
|
396
|
-
authorities.push({
|
|
397
|
-
authority: held.authority,
|
|
398
|
-
...at,
|
|
399
|
-
changes,
|
|
400
|
-
...(folders.length === 0 ? {} : { folders }),
|
|
401
|
-
...(next === undefined ? {} : { next }),
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
return { authorities };
|
|
405
|
-
}
|
|
406
|
-
function readPage(held) {
|
|
407
|
-
if (typeof held !== 'object' || held === null)
|
|
408
|
-
return null;
|
|
409
|
-
const { after, through, read } = held;
|
|
410
|
-
if (typeof after !== 'string' || !DECIMAL.test(after))
|
|
411
|
-
return null;
|
|
412
|
-
if (typeof through !== 'string' || !DECIMAL.test(through))
|
|
413
|
-
return null;
|
|
414
|
-
if (typeof read !== 'number' || !Number.isSafeInteger(read) || read < 0)
|
|
415
|
-
return null;
|
|
416
|
-
return { after, through, read };
|
|
417
|
-
}
|
|
418
|
-
function advances(asked, next) {
|
|
419
|
-
const moved = BigInt(next.through) - BigInt(asked.through);
|
|
420
|
-
return moved > 0n || (moved === 0n && next.after === asked.after && next.read > asked.read);
|
|
421
|
-
}
|
|
422
|
-
export async function wholeView(first, more) {
|
|
423
|
-
const changes = new Map(first.changes.map((change) => [change.path, change]));
|
|
424
|
-
const folders = new Map((first.folders ?? []).map((folder) => [folder.path, folder]));
|
|
425
|
-
let view = first;
|
|
426
|
-
while (view.next !== undefined) {
|
|
427
|
-
const asked = view.next;
|
|
428
|
-
const page = await more(asked);
|
|
429
|
-
if ('kind' in page)
|
|
430
|
-
return page;
|
|
431
|
-
if (page.position !== asked.through ||
|
|
432
|
-
page.logEpoch !== first.logEpoch ||
|
|
433
|
-
(page.next !== undefined && !advances(asked, page.next))) {
|
|
434
|
-
return { kind: 'transport-uncertainty' };
|
|
435
|
-
}
|
|
436
|
-
for (const change of page.changes) {
|
|
437
|
-
changes.delete(change.path);
|
|
438
|
-
changes.set(change.path, change);
|
|
439
|
-
}
|
|
440
|
-
for (const folder of page.folders ?? []) {
|
|
441
|
-
folders.delete(folder.path);
|
|
442
|
-
folders.set(folder.path, folder);
|
|
443
|
-
}
|
|
444
|
-
view = page;
|
|
445
|
-
}
|
|
446
|
-
return {
|
|
447
|
-
authority: first.authority,
|
|
448
|
-
position: view.position,
|
|
449
|
-
logEpoch: first.logEpoch,
|
|
450
|
-
changes: [...changes.values()],
|
|
451
|
-
...(folders.size === 0 ? {} : { folders: [...folders.values()] }),
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
314
|
export function* bootstrapping(scope) {
|
|
455
315
|
const contents = new Map();
|
|
456
316
|
for (const entry of scope.contents) {
|
|
@@ -484,34 +344,3 @@ export function schemaOf(scope, schema) {
|
|
|
484
344
|
? null
|
|
485
345
|
: { schema: content.content, version: file.version, revision: file.revision ?? null };
|
|
486
346
|
}
|
|
487
|
-
export function viewOf(enumeration, tracked) {
|
|
488
|
-
return enumeration.authorities.find((entry) => entry.authority === tracked.authority);
|
|
489
|
-
}
|
|
490
|
-
function* refreshing(view, fromRoomVersion) {
|
|
491
|
-
if (roomVersion(view) === fromRoomVersion)
|
|
492
|
-
return { kind: 'still-current' };
|
|
493
|
-
const answer = answering();
|
|
494
|
-
for (const change of view.changes) {
|
|
495
|
-
yield ROW_WEIGHT;
|
|
496
|
-
if ('removed' in change) {
|
|
497
|
-
answer.removals.add(change.path);
|
|
498
|
-
continue;
|
|
499
|
-
}
|
|
500
|
-
if ('content' in change)
|
|
501
|
-
answer.documents.set(change.path, change.content);
|
|
502
|
-
else
|
|
503
|
-
answer.binaryFiles.set(change.path, change.binary);
|
|
504
|
-
if (change.head !== undefined)
|
|
505
|
-
answer.changes.set(change.path, change.head);
|
|
506
|
-
if (change.revision !== undefined)
|
|
507
|
-
revised(answer, change.path, change.revision);
|
|
508
|
-
}
|
|
509
|
-
for (const folder of view.folders ?? []) {
|
|
510
|
-
yield ROW_WEIGHT;
|
|
511
|
-
folded(answer, folder.path, folder.removed);
|
|
512
|
-
}
|
|
513
|
-
return { kind: 'net-advancement', roomVersion: roomVersion(view), ...(yield* answered(answer)) };
|
|
514
|
-
}
|
|
515
|
-
export async function refreshFrom(view, fromRoomVersion) {
|
|
516
|
-
return stepped(refreshing(view, fromRoomVersion));
|
|
517
|
-
}
|
package/dist/refusal.d.ts
CHANGED
|
@@ -2,8 +2,5 @@ import type { AdapterFailure, DiscoverResult, ProviderRefusal, ScopedRefusal } f
|
|
|
2
2
|
export declare function doorRefusal(body: unknown): ProviderRefusal | null;
|
|
3
3
|
export declare function scopedRefusal(locator: string, scope: ScopedRefusal['scope'], refusal: ProviderRefusal): ScopedRefusal;
|
|
4
4
|
export declare function classifyDoor(status: number, body: unknown, locator: string): AdapterFailure | null;
|
|
5
|
-
export declare function classifyRead(status: number, body: unknown, locator: string): AdapterFailure | {
|
|
6
|
-
kind: 'beyond-horizon';
|
|
7
|
-
} | null;
|
|
8
5
|
export declare function discoveryFailure(status: number, body: unknown): DiscoverResult | null;
|
|
9
6
|
//# 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,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAOjE;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,eAAe,GACvB,aAAa,CAEf;AAqBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,IAAI,CAMvB;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAOjE;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,OAAO,EAAE,eAAe,GACvB,aAAa,CAEf;AAqBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,IAAI,CAMvB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAQrF"}
|
package/dist/refusal.js
CHANGED
|
@@ -39,11 +39,6 @@ export function classifyDoor(status, body, locator) {
|
|
|
39
39
|
return scopedRefusal(locator, failure.scope, failure.refusal);
|
|
40
40
|
return failure;
|
|
41
41
|
}
|
|
42
|
-
export function classifyRead(status, body, locator) {
|
|
43
|
-
if (doorRefusal(body)?.code === 'expired')
|
|
44
|
-
return { kind: 'beyond-horizon' };
|
|
45
|
-
return classifyDoor(status, body, locator);
|
|
46
|
-
}
|
|
47
42
|
export function discoveryFailure(status, body) {
|
|
48
43
|
const failure = doorFailure(status, body);
|
|
49
44
|
if (failure === null)
|
package/dist/room-types.js
CHANGED
|
@@ -47,7 +47,6 @@ export const HOUSE_ROOM_TYPES = [
|
|
|
47
47
|
' type: object',
|
|
48
48
|
' properties:',
|
|
49
49
|
...AGENT,
|
|
50
|
-
' conversation: { type: string, format: uuid }',
|
|
51
50
|
' required: [inbox, channel, chat, customer]',
|
|
52
51
|
`${INBOX_MESSAGE_TYPE}:`,
|
|
53
52
|
' properties:',
|
|
@@ -61,6 +60,7 @@ export const HOUSE_ROOM_TYPES = [
|
|
|
61
60
|
` channel_message: ${IDENTITY}`,
|
|
62
61
|
' state: { enum: [sending, sent, failed] }',
|
|
63
62
|
' reason: { type: string }',
|
|
63
|
+
' labelled: { const: true }',
|
|
64
64
|
' reactions:',
|
|
65
65
|
' type: array',
|
|
66
66
|
' items:',
|
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,EAQR,MAAM,wBAAwB,CAAC;AAehC,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAuBxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAkK1F"}
|
package/dist/site.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { stepped } from '@agentshouse/mdruntime';
|
|
2
|
-
import { actionOutcome
|
|
2
|
+
import { actionOutcome } from './actions.js';
|
|
3
3
|
import { mapDiscovery, parseSiteDiscovery, siteCapabilities, siteTracked, } from './discovery.js';
|
|
4
|
-
import {
|
|
5
|
-
import { bootstrapping, parseEnumeration, refreshFrom, viewOf, wholeView, } from './read.js';
|
|
4
|
+
import { bootstrapping } from './read.js';
|
|
6
5
|
import { roomStreams } from './room-stream.js';
|
|
7
|
-
import { classifyDoor,
|
|
6
|
+
import { classifyDoor, discoveryFailure } from './refusal.js';
|
|
8
7
|
import { HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES } from './room-types.js';
|
|
9
8
|
import { houseNotifications } from './stream.js';
|
|
10
|
-
import {
|
|
11
|
-
import { followsVersion, logPosition, presented, reachedVersion, roomVersion
|
|
9
|
+
import { houseSiteRoute, SITE_DOOR_SUBMIT, SITE_FILES, SITE_SUBMISSION, } from './transport.js';
|
|
10
|
+
import { followsVersion, logPosition, presented, reachedVersion, roomVersion } from './version.js';
|
|
12
11
|
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
13
12
|
function unfound() {
|
|
14
13
|
return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
|
|
@@ -25,7 +24,13 @@ function siteRoom(tracked) {
|
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
export function createSiteAdapter(transport, snapshot = false) {
|
|
28
|
-
const notifications = houseNotifications(transport, 'site'
|
|
27
|
+
const notifications = houseNotifications(transport, 'site', {
|
|
28
|
+
opened: async () => {
|
|
29
|
+
const found = await discovered();
|
|
30
|
+
return found.kind === 'discovery' ? found : null;
|
|
31
|
+
},
|
|
32
|
+
changed: () => null,
|
|
33
|
+
});
|
|
29
34
|
const tracked = new Map();
|
|
30
35
|
const read = new Map();
|
|
31
36
|
const rooms = roomStreams('site');
|
|
@@ -35,32 +40,9 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
35
40
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
36
41
|
return `${SITE_FILES}${entry.authority}/${encodeURIComponent(request.revision)}/${encodeURIComponent(request.path)}`;
|
|
37
42
|
}
|
|
38
|
-
async function enumerated(entry, from, page) {
|
|
39
|
-
const answer = await transport.door(SITE_DOOR_ENUMERATE, {
|
|
40
|
-
positions: [
|
|
41
|
-
page === undefined
|
|
42
|
-
? presented(entry.authority, from)
|
|
43
|
-
: {
|
|
44
|
-
...presented(entry.authority, { position: page.after, logEpoch: from.logEpoch }),
|
|
45
|
-
page: { through: page.through, read: page.read },
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
});
|
|
49
|
-
const classified = classifyRead(answer.status, answer.body, entry.locator);
|
|
50
|
-
if (classified !== null)
|
|
51
|
-
return classified;
|
|
52
|
-
const found = parseEnumeration(answer.body, 'site');
|
|
53
|
-
if (found === null)
|
|
54
|
-
return UNCERTAIN;
|
|
55
|
-
return viewOf(found, entry) ?? { kind: 'room-not-readable', locator: entry.locator };
|
|
56
|
-
}
|
|
57
|
-
async function enumeration(entry, from) {
|
|
58
|
-
const first = await enumerated(entry, from);
|
|
59
|
-
return 'kind' in first ? first : wholeView(first, (page) => enumerated(entry, from, page));
|
|
60
|
-
}
|
|
61
43
|
async function openedRoom(entry, arriving, signal) {
|
|
62
44
|
const cut = read.get(entry.locator);
|
|
63
|
-
const answered = await transport.streamed(`${
|
|
45
|
+
const answered = await transport.streamed(`${houseSiteRoute('bootstrap')}/${entry.authority}${cut === undefined ? '' : `?expired=${cut}`}`, signal ?? new AbortController().signal);
|
|
64
46
|
if (answered.room === null)
|
|
65
47
|
return classifyDoor(answered.status, answered.body, entry.locator) ?? UNCERTAIN;
|
|
66
48
|
const head = await rooms.head(entry, answered.room, arriving, signal);
|
|
@@ -73,7 +55,6 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
73
55
|
const part = await rooms.part(entry, token);
|
|
74
56
|
if ('kind' in part)
|
|
75
57
|
return part;
|
|
76
|
-
notifications.reach(entry.authority, part.scope);
|
|
77
58
|
const { folders: _folders, ...page } = await stepped(bootstrapping(part.scope));
|
|
78
59
|
return {
|
|
79
60
|
...page,
|
|
@@ -82,48 +63,28 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
82
63
|
bytes: part.bytes,
|
|
83
64
|
};
|
|
84
65
|
}
|
|
85
|
-
async function
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
notifications.
|
|
98
|
-
|
|
99
|
-
if (answer.kind !== 'net-advancement')
|
|
100
|
-
return answer;
|
|
101
|
-
const models = await viewModels(view, entry);
|
|
102
|
-
return models === undefined ? answer : { ...answer, models };
|
|
66
|
+
async function discovered() {
|
|
67
|
+
const answer = await transport.read(houseSiteRoute('discover'));
|
|
68
|
+
const failed = discoveryFailure(answer.status, answer.body);
|
|
69
|
+
if (failed !== null)
|
|
70
|
+
return failed;
|
|
71
|
+
const document = parseSiteDiscovery(answer.body);
|
|
72
|
+
if (document === null)
|
|
73
|
+
return UNCERTAIN;
|
|
74
|
+
const entries = siteTracked(document);
|
|
75
|
+
tracked.clear();
|
|
76
|
+
for (const entry of entries)
|
|
77
|
+
tracked.set(entry.locator, entry);
|
|
78
|
+
notifications.track(entries);
|
|
79
|
+
return mapDiscovery(document, entries.map(siteRoom), siteCapabilities());
|
|
103
80
|
}
|
|
104
81
|
return {
|
|
105
82
|
localSaves: true,
|
|
106
|
-
exhaustiveDiscovery: true,
|
|
107
83
|
roomTypes: HOUSE_ROOM_TYPES,
|
|
108
84
|
nameableRoomTypes: HOUSE_NAMEABLE_ROOM_TYPES,
|
|
109
85
|
async authorize() {
|
|
110
86
|
return {};
|
|
111
87
|
},
|
|
112
|
-
async discover() {
|
|
113
|
-
const answer = await transport.read(SITE_DOOR_DISCOVER);
|
|
114
|
-
const failed = discoveryFailure(answer.status, answer.body);
|
|
115
|
-
if (failed !== null)
|
|
116
|
-
return failed;
|
|
117
|
-
const document = parseSiteDiscovery(answer.body);
|
|
118
|
-
if (document === null)
|
|
119
|
-
return UNCERTAIN;
|
|
120
|
-
const entries = siteTracked(document);
|
|
121
|
-
tracked.clear();
|
|
122
|
-
for (const entry of entries)
|
|
123
|
-
tracked.set(entry.locator, entry);
|
|
124
|
-
notifications.track(entries);
|
|
125
|
-
return mapDiscovery(document, entries.map(siteRoom), siteCapabilities());
|
|
126
|
-
},
|
|
127
88
|
async bootstrap(_authorization, request) {
|
|
128
89
|
const entry = tracked.get(request.locator);
|
|
129
90
|
if (entry === undefined)
|
|
@@ -132,19 +93,21 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
132
93
|
? openedRoom(entry, request.arriving, request.signal)
|
|
133
94
|
: streamedPage(entry, request.pageToken);
|
|
134
95
|
},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
96
|
+
...(snapshot
|
|
97
|
+
? {
|
|
98
|
+
discover: discovered,
|
|
99
|
+
async refresh(_authorization, request) {
|
|
100
|
+
const entry = tracked.get(request.locator);
|
|
101
|
+
if (entry === undefined)
|
|
102
|
+
return { kind: 'room-not-readable', locator: request.locator };
|
|
103
|
+
if (request.pageToken !== undefined)
|
|
104
|
+
return UNCERTAIN;
|
|
105
|
+
return request.fromRoomVersion === roomVersion(entry)
|
|
106
|
+
? { kind: 'still-current' }
|
|
107
|
+
: { kind: 'beyond-horizon' };
|
|
108
|
+
},
|
|
145
109
|
}
|
|
146
|
-
|
|
147
|
-
},
|
|
110
|
+
: {}),
|
|
148
111
|
async mutate() {
|
|
149
112
|
return { kind: 'rejected', affected: {}, code: 'write-grant', fields: {}, retryable: false };
|
|
150
113
|
},
|
|
@@ -182,7 +145,7 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
182
145
|
return followsVersion(version, next);
|
|
183
146
|
},
|
|
184
147
|
async action(_authorization, request) {
|
|
185
|
-
if (request.name !==
|
|
148
|
+
if (request.name !== SITE_SUBMISSION) {
|
|
186
149
|
return {
|
|
187
150
|
kind: 'rejected',
|
|
188
151
|
code: 'action-unimplemented',
|
|
@@ -192,7 +155,7 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
192
155
|
}
|
|
193
156
|
if (!transport.online())
|
|
194
157
|
return UNCERTAIN;
|
|
195
|
-
return actionOutcome(await transport.door(SITE_DOOR_SUBMIT, request.input),
|
|
158
|
+
return actionOutcome(await transport.door(SITE_DOOR_SUBMIT, request.input), SITE_SUBMISSION);
|
|
196
159
|
},
|
|
197
160
|
roomStream: snapshot
|
|
198
161
|
? undefined
|
|
@@ -201,19 +164,10 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
201
164
|
notifications.send(rooms.flatMap((room) => {
|
|
202
165
|
const entry = tracked.get(room.locator);
|
|
203
166
|
const at = logPosition(room.roomVersion);
|
|
204
|
-
|
|
205
|
-
return [];
|
|
206
|
-
notifications.reach(entry.authority, at);
|
|
207
|
-
return [presented(entry.authority, at)];
|
|
167
|
+
return entry === undefined || at === null ? [] : [presented(entry.authority, at)];
|
|
208
168
|
}));
|
|
209
169
|
},
|
|
210
|
-
reopen: notifications.reopen,
|
|
211
170
|
observe: notifications.observe,
|
|
212
|
-
published(locator, roomVersion) {
|
|
213
|
-
const at = logPosition(roomVersion);
|
|
214
|
-
if (at !== null)
|
|
215
|
-
notifications.published(locator, at);
|
|
216
|
-
},
|
|
217
171
|
},
|
|
218
172
|
serviceMode: notifications.serviceMode,
|
|
219
173
|
};
|