@agentshouse/mdruntime-adapter 0.1.0-cd673d02b6e50 → 0.1.0-cd75dfaf57319
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 +2 -47
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +7 -225
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +69 -214
- package/dist/discovery.d.ts +18 -5
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +60 -26
- package/dist/history.d.ts +12 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +92 -0
- package/dist/house-model.d.ts +718 -1
- package/dist/house-model.d.ts.map +1 -1
- package/dist/house-model.js +393 -486
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/model.d.ts +5 -4
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +27 -22
- package/dist/read.d.ts +11 -44
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +25 -174
- package/dist/refusal.d.ts +0 -3
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +0 -5
- package/dist/room-stream.d.ts +2 -1
- package/dist/room-stream.d.ts.map +1 -1
- package/dist/room-stream.js +2 -2
- package/dist/room-types.d.ts +2 -2
- package/dist/room-types.d.ts.map +1 -1
- package/dist/room-types.js +7 -9
- package/dist/search.d.ts +5 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +47 -0
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +50 -92
- package/dist/space-schema.d.ts +7 -0
- package/dist/space-schema.d.ts.map +1 -0
- package/dist/space-schema.js +18 -0
- package/dist/stream.d.ts +14 -14
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +169 -424
- package/dist/transport.d.ts +44 -35
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +54 -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 +8 -23
- 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,13 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
|
+
export { foldedAuthorities } from './discovery.js';
|
|
2
3
|
export { finishedUpload, houseUpload, type HouseUpload } from './upload.js';
|
|
3
|
-
export {
|
|
4
|
+
export { houseAction, type HouseActDoor } from './actions.js';
|
|
5
|
+
export { HISTORY_PAGE } from './history.js';
|
|
4
6
|
export { houseParts, type ChangeMapping } from './write.js';
|
|
5
7
|
export { APP_REFERENCE_PATTERN } from './app-reference.js';
|
|
6
|
-
export { HOUSE_MODEL_TYPES } from './house-model.js';
|
|
8
|
+
export { HOUSE_MODEL_DECLARATION, HOUSE_MODEL_TYPES, HOUSE_TYPED_PATHS, type HouseDocumentFields, type HouseModelType, } from './house-model.js';
|
|
7
9
|
export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
|
|
8
|
-
export {
|
|
10
|
+
export { CHAT_MESSAGE_TYPE, CHAT_TYPE, HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, type InboxChannelKind, } from './room-types.js';
|
|
11
|
+
export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, type HouseRuntimeAct, type HouseRuntimeFrame, } from './transport.js';
|
|
9
12
|
export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamed, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
10
13
|
//# 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,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,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,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,iBAAiB,EACjB,SAAS,EACT,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,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,11 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter } from './adapter.js';
|
|
2
|
+
export { foldedAuthorities } from './discovery.js';
|
|
2
3
|
export { finishedUpload, houseUpload } from './upload.js';
|
|
3
|
-
export {
|
|
4
|
+
export { houseAction } from './actions.js';
|
|
5
|
+
export { HISTORY_PAGE } from './history.js';
|
|
4
6
|
export { houseParts } from './write.js';
|
|
5
7
|
export { APP_REFERENCE_PATTERN } from './app-reference.js';
|
|
6
|
-
export { HOUSE_MODEL_TYPES } from './house-model.js';
|
|
8
|
+
export { HOUSE_MODEL_DECLARATION, HOUSE_MODEL_TYPES, HOUSE_TYPED_PATHS, } from './house-model.js';
|
|
7
9
|
export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
|
|
8
|
-
export {
|
|
10
|
+
export { CHAT_MESSAGE_TYPE, CHAT_TYPE, HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, } from './room-types.js';
|
|
11
|
+
export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, } from './transport.js';
|
package/dist/model.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
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
|
+
import { type SpaceSchemas } from './space-schema.js';
|
|
4
5
|
import type { HouseMode, HouseStreamEntry } from './transport.js';
|
|
5
6
|
export declare function partModels(scope: HouseScope, tracked: TrackedAuthority, seen: ReadonlySet<string>, final: boolean): Promise<RoomModels | undefined>;
|
|
6
|
-
export declare function manifestedModels(room: HouseRoomHead, tracked: TrackedAuthority): Promise<{
|
|
7
|
+
export declare function manifestedModels(room: HouseRoomHead, tracked: TrackedAuthority, spaces: SpaceSchemas): Promise<{
|
|
7
8
|
readonly models: RoomModels | undefined;
|
|
8
9
|
readonly seen: string[];
|
|
9
10
|
}>;
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode): Promise<RoomModels | undefined>;
|
|
11
|
+
export declare function keptSpaceSchemas(entries: readonly HouseStreamEntry[], spaces: SpaceSchemas): void;
|
|
12
|
+
export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode, spaces: SpaceSchemas): Promise<RoomModels | undefined>;
|
|
12
13
|
//# 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,EAAiB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA+BlE,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,EACzB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAS/E;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAKjG;AAQD,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAajC"}
|
package/dist/model.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sha256Hex } from './digest.js';
|
|
2
2
|
import { modelScope, schemaOf, schemaPath, } from './read.js';
|
|
3
|
+
import { spaceIdentity } from './space-schema.js';
|
|
3
4
|
const MODEL_ABSENT = { kind: 'model-unavailable', reason: 'not-readable' };
|
|
4
5
|
const ABSENT_SCHEMA = { schema: null, version: null, revision: null };
|
|
5
6
|
async function heldModel(read, identity) {
|
|
@@ -8,7 +9,12 @@ async function heldModel(read, identity) {
|
|
|
8
9
|
const version = await sha256Hex(JSON.stringify(read.version));
|
|
9
10
|
return {
|
|
10
11
|
kind: 'model',
|
|
11
|
-
snapshot: {
|
|
12
|
+
snapshot: {
|
|
13
|
+
identity: read.space === undefined ? identity : spaceIdentity(read.space),
|
|
14
|
+
version,
|
|
15
|
+
schema: read.schema,
|
|
16
|
+
revision: read.revision,
|
|
17
|
+
},
|
|
12
18
|
};
|
|
13
19
|
}
|
|
14
20
|
async function modelsOf(tracked, read) {
|
|
@@ -24,42 +30,41 @@ export function partModels(scope, tracked, seen, final) {
|
|
|
24
30
|
return final && !seen.has(schema) ? ABSENT_SCHEMA : undefined;
|
|
25
31
|
});
|
|
26
32
|
}
|
|
27
|
-
export async function manifestedModels(room, tracked) {
|
|
33
|
+
export async function manifestedModels(room, tracked, spaces) {
|
|
28
34
|
const scope = modelScope(room);
|
|
35
|
+
const held = schemaOf(scope, tracked.schema);
|
|
36
|
+
if (held?.space !== undefined && held.schema !== null && held.revision !== null)
|
|
37
|
+
spaces.keep(held.space, held.revision, held.schema);
|
|
29
38
|
return {
|
|
30
39
|
models: await partModels(scope, tracked, new Set(), true),
|
|
31
40
|
seen: scope.files.some((file) => file.path === tracked.schema) ? [tracked.schema] : [],
|
|
32
41
|
};
|
|
33
42
|
}
|
|
34
|
-
export function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
version: change.version,
|
|
45
|
-
revision: change.revision ?? null,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
});
|
|
43
|
+
export function keptSpaceSchemas(entries, spaces) {
|
|
44
|
+
for (const entry of entries) {
|
|
45
|
+
if (entry.space !== undefined && entry.text !== undefined && entry.revision !== undefined)
|
|
46
|
+
spaces.keep(entry.space, entry.revision, entry.text);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function streamedText(entry, spaces) {
|
|
50
|
+
if (entry.text !== undefined || entry.space === undefined || entry.revision === undefined)
|
|
51
|
+
return entry.text;
|
|
52
|
+
return spaces.held(entry.space, entry.revision);
|
|
50
53
|
}
|
|
51
|
-
export function streamedModels(schemas, tracked, mode) {
|
|
54
|
+
export function streamedModels(schemas, tracked, mode, spaces) {
|
|
52
55
|
return modelsOf(tracked, (schema) => {
|
|
53
56
|
const entry = schemas.get(schema);
|
|
54
57
|
if (entry === undefined)
|
|
55
58
|
return undefined;
|
|
59
|
+
const space = entry.space === undefined ? {} : { space: entry.space };
|
|
56
60
|
if (entry.kind === 'removed')
|
|
57
|
-
return ABSENT_SCHEMA;
|
|
58
|
-
|
|
61
|
+
return { ...ABSENT_SCHEMA, ...space };
|
|
62
|
+
const text = streamedText(entry, spaces);
|
|
63
|
+
if (text === undefined)
|
|
59
64
|
return null;
|
|
60
65
|
const version = mode === 'site' ? entry.sha256 : entry.revision;
|
|
61
66
|
return version === undefined
|
|
62
67
|
? null
|
|
63
|
-
: { schema:
|
|
68
|
+
: { schema: text, version, revision: mode === 'site' ? null : version, ...space };
|
|
64
69
|
});
|
|
65
70
|
}
|
package/dist/read.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { TrackedAuthority } from './discovery.js';
|
|
1
|
+
import { type BinaryFile, type BootstrapPage, type SavedFacts, 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];
|
|
6
5
|
export type Answered = {
|
|
7
6
|
readonly documents: Map<string, string>;
|
|
7
|
+
readonly facts: Map<string, SavedFacts>;
|
|
8
8
|
readonly revisions: Map<string, string>;
|
|
9
9
|
readonly fileIds: Map<string, string>;
|
|
10
10
|
readonly changes: Map<string, HeadChange>;
|
|
@@ -19,6 +19,7 @@ export declare function forgotten(answer: Answered, path: string): void;
|
|
|
19
19
|
export declare function folded(answer: Answered, path: string, removed: boolean): void;
|
|
20
20
|
export declare function answered(answer: Answered): Generator<number, {
|
|
21
21
|
documents: Readonly<Record<string, string>>;
|
|
22
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
22
23
|
revisions: Readonly<Record<string, string>>;
|
|
23
24
|
fileIds?: Readonly<Record<string, string>>;
|
|
24
25
|
changes: Readonly<Record<string, HeadChange>>;
|
|
@@ -34,6 +35,8 @@ export type HouseManifestFile = {
|
|
|
34
35
|
sha256?: string;
|
|
35
36
|
head?: HeadChange;
|
|
36
37
|
binary?: BinaryFile;
|
|
38
|
+
facts?: SavedFacts;
|
|
39
|
+
space?: string;
|
|
37
40
|
};
|
|
38
41
|
export type HouseContent = {
|
|
39
42
|
path: string;
|
|
@@ -63,43 +66,6 @@ export type HouseFileAddress = {
|
|
|
63
66
|
sha256: string;
|
|
64
67
|
mediaType: string;
|
|
65
68
|
};
|
|
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
69
|
export declare function authorityRoot(handle: string): string;
|
|
104
70
|
export declare function schemaPath(handle: string, schema: string): string;
|
|
105
71
|
export declare function parseGrant(body: unknown): HouseGrant | null;
|
|
@@ -109,6 +75,11 @@ export declare function headChange(held: {
|
|
|
109
75
|
readonly created_at?: unknown;
|
|
110
76
|
}): HeadChange | undefined | null;
|
|
111
77
|
export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
|
|
78
|
+
export declare function carriedFacts(held: Readonly<Record<string, unknown>>): {
|
|
79
|
+
facts?: undefined;
|
|
80
|
+
} | {
|
|
81
|
+
facts: SavedFacts;
|
|
82
|
+
};
|
|
112
83
|
export declare function roomHead(payload: Uint8Array<ArrayBuffer>, mode: HouseMode): Promise<HouseRoomHead | null>;
|
|
113
84
|
export declare function manifested(room: HouseRoomHead, pageToken: string, models: RoomModels | undefined): BootstrapPage;
|
|
114
85
|
export declare function modelScope(room: HouseRoomHead): HouseScope;
|
|
@@ -117,16 +88,12 @@ export declare function housePart(room: HouseRoomHead, payload: Uint8Array<Array
|
|
|
117
88
|
scope: HouseScope;
|
|
118
89
|
ended: boolean;
|
|
119
90
|
} | 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
91
|
export declare function bootstrapping(scope: HouseScope): Generator<number, BootstrapPage, void>;
|
|
123
92
|
export type HouseSchema = {
|
|
124
93
|
schema: string | null;
|
|
125
94
|
version: string | null;
|
|
126
95
|
revision: string | null;
|
|
96
|
+
space?: string;
|
|
127
97
|
};
|
|
128
98
|
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
99
|
//# 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,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,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,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,MAA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AAED,wBAAiB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,CAqBxF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAY9E"}
|
package/dist/read.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { paced, patching, 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];
|
|
@@ -8,6 +8,7 @@ function fileOf(revision) {
|
|
|
8
8
|
export function answering() {
|
|
9
9
|
return {
|
|
10
10
|
documents: new Map(),
|
|
11
|
+
facts: new Map(),
|
|
11
12
|
revisions: new Map(),
|
|
12
13
|
fileIds: new Map(),
|
|
13
14
|
changes: new Map(),
|
|
@@ -25,6 +26,7 @@ export function revised(answer, path, revision) {
|
|
|
25
26
|
}
|
|
26
27
|
export function forgotten(answer, path) {
|
|
27
28
|
answer.documents.delete(path);
|
|
29
|
+
answer.facts.delete(path);
|
|
28
30
|
answer.revisions.delete(path);
|
|
29
31
|
answer.fileIds.delete(path);
|
|
30
32
|
answer.changes.delete(path);
|
|
@@ -53,6 +55,7 @@ export function* answered(answer) {
|
|
|
53
55
|
const removals = yield* pathsOf(answer.removals);
|
|
54
56
|
return {
|
|
55
57
|
documents: yield* patching({}, answer.documents),
|
|
58
|
+
facts: yield* patching({}, answer.facts),
|
|
56
59
|
revisions: yield* patching({}, answer.revisions),
|
|
57
60
|
...(answer.fileIds.size === 0 ? {} : { fileIds: yield* patching({}, answer.fileIds) }),
|
|
58
61
|
changes: yield* patching({}, answer.changes),
|
|
@@ -138,6 +141,12 @@ export function binaryFileOf(held) {
|
|
|
138
141
|
function binaried(binary) {
|
|
139
142
|
return binary === undefined ? {} : { binary };
|
|
140
143
|
}
|
|
144
|
+
export function carriedFacts(held) {
|
|
145
|
+
return held.facts === undefined ? {} : { facts: held.facts };
|
|
146
|
+
}
|
|
147
|
+
function carriedSpace(held) {
|
|
148
|
+
return typeof held.space === 'string' ? { space: held.space } : {};
|
|
149
|
+
}
|
|
141
150
|
function parseFile(value, mode) {
|
|
142
151
|
if (typeof value !== 'object' || value === null)
|
|
143
152
|
return null;
|
|
@@ -157,6 +166,7 @@ function parseFile(value, mode) {
|
|
|
157
166
|
version: file.sha256,
|
|
158
167
|
...headed(head),
|
|
159
168
|
...binaried(binary),
|
|
169
|
+
...carriedFacts(file),
|
|
160
170
|
};
|
|
161
171
|
}
|
|
162
172
|
if (typeof file.revision !== 'string')
|
|
@@ -168,6 +178,8 @@ function parseFile(value, mode) {
|
|
|
168
178
|
...(typeof file.sha256 === 'string' ? { sha256: file.sha256 } : {}),
|
|
169
179
|
...headed(head),
|
|
170
180
|
...binaried(binary),
|
|
181
|
+
...carriedFacts(file),
|
|
182
|
+
...carriedSpace(file),
|
|
171
183
|
};
|
|
172
184
|
}
|
|
173
185
|
function parseModels(value, mode) {
|
|
@@ -222,6 +234,7 @@ export function manifested(room, pageToken, models) {
|
|
|
222
234
|
kind: 'bootstrap',
|
|
223
235
|
roomVersion: roomVersion(room),
|
|
224
236
|
documents: {},
|
|
237
|
+
facts: {},
|
|
225
238
|
revisions: {},
|
|
226
239
|
changes: {},
|
|
227
240
|
binaryFiles: {},
|
|
@@ -311,146 +324,6 @@ export async function housePart(room, payload, mode) {
|
|
|
311
324
|
const { ended, ...scope } = read;
|
|
312
325
|
return { scope: { ...emptyScope(room), ...scope }, ended };
|
|
313
326
|
}
|
|
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
327
|
export function* bootstrapping(scope) {
|
|
455
328
|
const contents = new Map();
|
|
456
329
|
for (const entry of scope.contents) {
|
|
@@ -460,6 +333,8 @@ export function* bootstrapping(scope) {
|
|
|
460
333
|
const answer = answering();
|
|
461
334
|
for (const file of scope.files) {
|
|
462
335
|
yield ROW_WEIGHT;
|
|
336
|
+
if (file.space !== undefined)
|
|
337
|
+
continue;
|
|
463
338
|
if (file.head !== undefined)
|
|
464
339
|
answer.changes.set(file.path, file.head);
|
|
465
340
|
const content = contents.get(file.path);
|
|
@@ -467,6 +342,8 @@ export function* bootstrapping(scope) {
|
|
|
467
342
|
answer.binaryFiles.set(file.path, file.binary);
|
|
468
343
|
else if (content !== undefined)
|
|
469
344
|
answer.documents.set(file.path, content);
|
|
345
|
+
if (file.binary === undefined && file.facts !== undefined)
|
|
346
|
+
answer.facts.set(file.path, file.facts);
|
|
470
347
|
if (file.revision !== undefined)
|
|
471
348
|
revised(answer, file.path, file.revision);
|
|
472
349
|
}
|
|
@@ -482,36 +359,10 @@ export function schemaOf(scope, schema) {
|
|
|
482
359
|
const content = scope.contents.find((entry) => entry.path === schema);
|
|
483
360
|
return content === undefined
|
|
484
361
|
? null
|
|
485
|
-
: {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
}
|
|
490
|
-
|
|
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));
|
|
362
|
+
: {
|
|
363
|
+
schema: content.content,
|
|
364
|
+
version: file.version,
|
|
365
|
+
revision: file.revision ?? null,
|
|
366
|
+
...(file.space === undefined ? {} : { space: file.space }),
|
|
367
|
+
};
|
|
517
368
|
}
|
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-stream.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BootstrapResult, RoomModels } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
3
|
import { type HouseScope } from './read.js';
|
|
4
|
+
import type { SpaceSchemas } from './space-schema.js';
|
|
4
5
|
import type { HouseMode } from './transport.js';
|
|
5
6
|
export type StreamedPart = {
|
|
6
7
|
readonly scope: HouseScope;
|
|
@@ -10,7 +11,7 @@ export type StreamedPart = {
|
|
|
10
11
|
readonly pageToken: string | undefined;
|
|
11
12
|
readonly bytes: number;
|
|
12
13
|
};
|
|
13
|
-
export declare function roomStreams(mode: HouseMode): {
|
|
14
|
+
export declare function roomStreams(mode: HouseMode, spaces: SpaceSchemas): {
|
|
14
15
|
head: (entry: TrackedAuthority, room: ReadableStream<Uint8Array>, arriving: ((bytes: number) => void) | undefined, signal: AbortSignal | undefined) => Promise<BootstrapResult>;
|
|
15
16
|
part: (entry: TrackedAuthority, token: string) => Promise<StreamedPart | Exclude<BootstrapResult, {
|
|
16
17
|
kind: 'bootstrap';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room-stream.d.ts","sourceRoot":"","sources":["../src/room-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAuD,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAYhD,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IACxC,QAA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
package/dist/room-stream.js
CHANGED
|
@@ -2,7 +2,7 @@ import { manifestedModels, partModels } from './model.js';
|
|
|
2
2
|
import { roomFrames } from './part.js';
|
|
3
3
|
import { housePart, manifested, roomHead } from './read.js';
|
|
4
4
|
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
5
|
-
export function roomStreams(mode) {
|
|
5
|
+
export function roomStreams(mode, spaces) {
|
|
6
6
|
const open = new Map();
|
|
7
7
|
let opened = 0;
|
|
8
8
|
async function head(entry, room, arriving, signal) {
|
|
@@ -13,7 +13,7 @@ export function roomStreams(mode) {
|
|
|
13
13
|
const held = await roomHead(first.payload, mode);
|
|
14
14
|
if (held === null || held.anchor !== entry.authority)
|
|
15
15
|
return UNCERTAIN;
|
|
16
|
-
const { models, seen } = await manifestedModels(held, entry);
|
|
16
|
+
const { models, seen } = await manifestedModels(held, entry, spaces);
|
|
17
17
|
opened += 1;
|
|
18
18
|
const id = String(opened);
|
|
19
19
|
open.set(id, { entry, head: held, frames, next: 1, seen });
|
package/dist/room-types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const INBOX_CHANNEL_KINDS: readonly ['telegram-bot', 'telegram-business', 'whatsapp', 'messenger', 'instagram', 'viber', 'tiktok'];
|
|
2
2
|
export type InboxChannelKind = (typeof INBOX_CHANNEL_KINDS)[number];
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const CHAT_TYPE = "chat";
|
|
4
|
+
export declare const CHAT_MESSAGE_TYPE = "chat-message";
|
|
5
5
|
export declare const HOUSE_NAMEABLE_ROOM_TYPES: string[];
|
|
6
6
|
export declare const HOUSE_ROOM_TYPES: string;
|
|
7
7
|
//# sourceMappingURL=room-types.d.ts.map
|
package/dist/room-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room-types.d.ts","sourceRoot":"","sources":["../src/room-types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,YAC9B,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,OAAO,EACP,QAAQ,CACA,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"room-types.d.ts","sourceRoot":"","sources":["../src/room-types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,YAC9B,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,OAAO,EACP,QAAQ,CACA,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,eAAO,MAAM,yBAAyB,UAAiC,CAAC;AAyBxE,eAAO,MAAM,gBAAgB,QA2FjB,CAAC"}
|