@agentshouse/mdruntime-adapter 0.1.0-cf41d9210cb6b → 0.1.0-cf75412975d5b
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 -52
- 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 +75 -214
- package/dist/discovery.d.ts +17 -3
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +58 -22
- 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 +910 -1
- package/dist/house-model.d.ts.map +1 -1
- package/dist/house-model.js +496 -489
- 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 +1 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -17
- package/dist/read.d.ts +5 -44
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +30 -175
- 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 +1 -0
- package/dist/room-stream.d.ts.map +1 -1
- package/dist/room-stream.js +23 -2
- package/dist/room-types.d.ts +2 -2
- package/dist/room-types.d.ts.map +1 -1
- package/dist/room-types.js +6 -6
- 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 +54 -90
- package/dist/stream.d.ts +13 -14
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +168 -429
- package/dist/transport.d.ts +38 -34
- 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 +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,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.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,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,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,10 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { TrackedAuthority } from './discovery.js';
|
|
1
|
+
import { type BinaryFile, type BootstrapPage, type Outline, 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 outlines: Map<string, Outline>;
|
|
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
|
+
outlines?: Readonly<Record<string, Outline>>;
|
|
22
23
|
revisions: Readonly<Record<string, string>>;
|
|
23
24
|
fileIds?: Readonly<Record<string, string>>;
|
|
24
25
|
changes: Readonly<Record<string, HeadChange>>;
|
|
@@ -34,6 +35,7 @@ export type HouseManifestFile = {
|
|
|
34
35
|
sha256?: string;
|
|
35
36
|
head?: HeadChange;
|
|
36
37
|
binary?: BinaryFile;
|
|
38
|
+
outline?: Outline;
|
|
37
39
|
};
|
|
38
40
|
export type HouseContent = {
|
|
39
41
|
path: string;
|
|
@@ -63,43 +65,6 @@ export type HouseFileAddress = {
|
|
|
63
65
|
sha256: string;
|
|
64
66
|
mediaType: string;
|
|
65
67
|
};
|
|
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
68
|
export declare function authorityRoot(handle: string): string;
|
|
104
69
|
export declare function schemaPath(handle: string, schema: string): string;
|
|
105
70
|
export declare function parseGrant(body: unknown): HouseGrant | null;
|
|
@@ -109,6 +74,7 @@ export declare function headChange(held: {
|
|
|
109
74
|
readonly created_at?: unknown;
|
|
110
75
|
}): HeadChange | undefined | null;
|
|
111
76
|
export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
|
|
77
|
+
export declare function outlineOf(value: unknown): Outline | undefined | null;
|
|
112
78
|
export declare function roomHead(payload: Uint8Array<ArrayBuffer>, mode: HouseMode): Promise<HouseRoomHead | null>;
|
|
113
79
|
export declare function manifested(room: HouseRoomHead, pageToken: string, models: RoomModels | undefined): BootstrapPage;
|
|
114
80
|
export declare function modelScope(room: HouseRoomHead): HouseScope;
|
|
@@ -117,8 +83,6 @@ export declare function housePart(room: HouseRoomHead, payload: Uint8Array<Array
|
|
|
117
83
|
scope: HouseScope;
|
|
118
84
|
ended: boolean;
|
|
119
85
|
} | 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
86
|
export declare function bootstrapping(scope: HouseScope): Generator<number, BootstrapPage, void>;
|
|
123
87
|
export type HouseSchema = {
|
|
124
88
|
schema: string | null;
|
|
@@ -126,7 +90,4 @@ export type HouseSchema = {
|
|
|
126
90
|
revision: string | null;
|
|
127
91
|
};
|
|
128
92
|
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
93
|
//# 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,OAAO,EACZ,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,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,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,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,SAAS,GACd,OAAO,CAAC;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,oBAAoB,CAAC,CAKvE;AAED,wBAAiB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,CAmBxF;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;CACzB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAO9E"}
|
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
|
+
outlines: 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.outlines.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
|
+
...(answer.outlines.size === 0 ? {} : { outlines: yield* patching({}, answer.outlines) }),
|
|
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,24 @@ export function binaryFileOf(held) {
|
|
|
138
141
|
function binaried(binary) {
|
|
139
142
|
return binary === undefined ? {} : { binary };
|
|
140
143
|
}
|
|
144
|
+
export function outlineOf(value) {
|
|
145
|
+
if (value === undefined)
|
|
146
|
+
return undefined;
|
|
147
|
+
if (typeof value !== 'object' || value === null)
|
|
148
|
+
return null;
|
|
149
|
+
const { type, fields, links } = value;
|
|
150
|
+
if (type !== null && typeof type !== 'string')
|
|
151
|
+
return null;
|
|
152
|
+
if (fields !== null && (typeof fields !== 'object' || Array.isArray(fields)))
|
|
153
|
+
return null;
|
|
154
|
+
if (!Array.isArray(links) || links.some((link) => typeof link !== 'string'))
|
|
155
|
+
return null;
|
|
156
|
+
return {
|
|
157
|
+
type: type,
|
|
158
|
+
fields: fields,
|
|
159
|
+
links: links,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
141
162
|
function parseFile(value, mode) {
|
|
142
163
|
if (typeof value !== 'object' || value === null)
|
|
143
164
|
return null;
|
|
@@ -146,17 +167,19 @@ function parseFile(value, mode) {
|
|
|
146
167
|
return null;
|
|
147
168
|
const head = headChange(file);
|
|
148
169
|
const binary = binaryFileOf(file);
|
|
149
|
-
|
|
170
|
+
const outline = outlineOf(file.outline);
|
|
171
|
+
if (head === null || binary === null || outline === null)
|
|
150
172
|
return null;
|
|
151
173
|
if (mode === 'site') {
|
|
152
174
|
if (typeof file.sha256 !== 'string')
|
|
153
175
|
return null;
|
|
154
176
|
return {
|
|
155
177
|
path: file.path,
|
|
156
|
-
revision: binary?.sha256,
|
|
178
|
+
revision: binary?.sha256 ?? file.sha256,
|
|
157
179
|
version: file.sha256,
|
|
158
180
|
...headed(head),
|
|
159
181
|
...binaried(binary),
|
|
182
|
+
...(outline === undefined ? {} : { outline }),
|
|
160
183
|
};
|
|
161
184
|
}
|
|
162
185
|
if (typeof file.revision !== 'string')
|
|
@@ -168,6 +191,7 @@ function parseFile(value, mode) {
|
|
|
168
191
|
...(typeof file.sha256 === 'string' ? { sha256: file.sha256 } : {}),
|
|
169
192
|
...headed(head),
|
|
170
193
|
...binaried(binary),
|
|
194
|
+
...(outline === undefined ? {} : { outline }),
|
|
171
195
|
};
|
|
172
196
|
}
|
|
173
197
|
function parseModels(value, mode) {
|
|
@@ -311,146 +335,6 @@ export async function housePart(room, payload, mode) {
|
|
|
311
335
|
const { ended, ...scope } = read;
|
|
312
336
|
return { scope: { ...emptyScope(room), ...scope }, ended };
|
|
313
337
|
}
|
|
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
338
|
export function* bootstrapping(scope) {
|
|
455
339
|
const contents = new Map();
|
|
456
340
|
for (const entry of scope.contents) {
|
|
@@ -467,6 +351,8 @@ export function* bootstrapping(scope) {
|
|
|
467
351
|
answer.binaryFiles.set(file.path, file.binary);
|
|
468
352
|
else if (content !== undefined)
|
|
469
353
|
answer.documents.set(file.path, content);
|
|
354
|
+
else if (file.outline !== undefined)
|
|
355
|
+
answer.outlines.set(file.path, file.outline);
|
|
470
356
|
if (file.revision !== undefined)
|
|
471
357
|
revised(answer, file.path, file.revision);
|
|
472
358
|
}
|
|
@@ -484,34 +370,3 @@ export function schemaOf(scope, schema) {
|
|
|
484
370
|
? null
|
|
485
371
|
: { schema: content.content, version: file.version, revision: file.revision ?? null };
|
|
486
372
|
}
|
|
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-stream.d.ts
CHANGED
|
@@ -15,5 +15,6 @@ export declare function roomStreams(mode: HouseMode): {
|
|
|
15
15
|
part: (entry: TrackedAuthority, token: string) => Promise<StreamedPart | Exclude<BootstrapResult, {
|
|
16
16
|
kind: 'bootstrap';
|
|
17
17
|
}>>;
|
|
18
|
+
named: (entry: TrackedAuthority, room: ReadableStream<Uint8Array>, signal: AbortSignal | undefined) => Promise<BootstrapResult>;
|
|
18
19
|
};
|
|
19
20
|
//# sourceMappingURL=room-stream.d.ts.map
|
|
@@ -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;
|
|
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;AAE1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,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,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS;kBAKhC,gBAAgB,QACjB,cAAc,CAAC,UAAU,CAAC,YACtB,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,UACvC,WAAW,GAAG,SAAS,KAC9B,OAAO,CAAC,eAAe,CAAC;kBAelB,gBAAgB,SAChB,MAAM,KACZ,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,eAAe,EAAE;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;mBAkCjE,gBAAgB,QACjB,cAAc,CAAC,UAAU,CAAC,UACxB,WAAW,GAAG,SAAS,KAC9B,OAAO,CAAC,eAAe,CAAC;EAmB5B"}
|
package/dist/room-stream.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { stepped } from '@agentshouse/mdruntime';
|
|
1
2
|
import { manifestedModels, partModels } from './model.js';
|
|
2
3
|
import { roomFrames } from './part.js';
|
|
3
|
-
import { housePart, manifested, roomHead } from './read.js';
|
|
4
|
+
import { bootstrapping, housePart, manifested, roomHead, } from './read.js';
|
|
4
5
|
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
5
6
|
export function roomStreams(mode) {
|
|
6
7
|
const open = new Map();
|
|
@@ -53,5 +54,25 @@ export function roomStreams(mode) {
|
|
|
53
54
|
bytes: frame.bytes,
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
async function named(entry, room, signal) {
|
|
58
|
+
const opened = await head(entry, room, undefined, signal);
|
|
59
|
+
if (opened.kind !== 'bootstrap')
|
|
60
|
+
return opened;
|
|
61
|
+
const files = [];
|
|
62
|
+
const contents = [];
|
|
63
|
+
let last = null;
|
|
64
|
+
for (let token = opened.pageToken; token !== undefined;) {
|
|
65
|
+
const read = await part(entry, token);
|
|
66
|
+
if ('kind' in read)
|
|
67
|
+
return read;
|
|
68
|
+
files.push(...read.scope.files);
|
|
69
|
+
contents.push(...read.scope.contents);
|
|
70
|
+
last = read.scope;
|
|
71
|
+
token = read.pageToken;
|
|
72
|
+
}
|
|
73
|
+
if (last === null)
|
|
74
|
+
return UNCERTAIN;
|
|
75
|
+
return stepped(bootstrapping({ ...last, files, contents }));
|
|
76
|
+
}
|
|
77
|
+
return { head, part, named };
|
|
57
78
|
}
|
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,QA6FjB,CAAC"}
|
package/dist/room-types.js
CHANGED
|
@@ -9,9 +9,9 @@ export const INBOX_CHANNEL_KINDS = [
|
|
|
9
9
|
'viber',
|
|
10
10
|
'tiktok',
|
|
11
11
|
];
|
|
12
|
-
export const
|
|
13
|
-
export const
|
|
14
|
-
export const HOUSE_NAMEABLE_ROOM_TYPES = [
|
|
12
|
+
export const CHAT_TYPE = 'chat';
|
|
13
|
+
export const CHAT_MESSAGE_TYPE = 'chat-message';
|
|
14
|
+
export const HOUSE_NAMEABLE_ROOM_TYPES = [CHAT_TYPE, CHAT_MESSAGE_TYPE];
|
|
15
15
|
const WAYFINDING_MAP_TYPE = 'wayfinding-map';
|
|
16
16
|
const WAYFINDING_TICKET_TYPE = 'wayfinding-ticket';
|
|
17
17
|
const WAYFINDING_MAP_SECTIONS = [
|
|
@@ -30,7 +30,7 @@ const ASSIGNEE = [
|
|
|
30
30
|
...AGENT,
|
|
31
31
|
];
|
|
32
32
|
export const HOUSE_ROOM_TYPES = [
|
|
33
|
-
`${
|
|
33
|
+
`${CHAT_TYPE}:`,
|
|
34
34
|
' properties:',
|
|
35
35
|
' inbox: { type: string, format: uuid }',
|
|
36
36
|
` channel: { enum: [${INBOX_CHANNEL_KINDS.join(', ')}] }`,
|
|
@@ -47,9 +47,8 @@ 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
|
+
`${CHAT_MESSAGE_TYPE}:`,
|
|
53
52
|
' properties:',
|
|
54
53
|
' direction: { enum: [in, out] }',
|
|
55
54
|
' sender:',
|
|
@@ -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/search.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SearchAnswer, SearchAsk } from '@agentshouse/mdruntime';
|
|
2
|
+
import type { TrackedAuthority } from './discovery.js';
|
|
3
|
+
import { type HouseTransport } from './transport.js';
|
|
4
|
+
export declare function houseSearch(transport: Pick<HouseTransport, 'door'>, tracked: readonly TrackedAuthority[], request: SearchAsk): Promise<SearchAnswer>;
|
|
5
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAa,MAAM,wBAAwB,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAsBrE,wBAAsB,WAAW,CAC/B,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,EACvC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,YAAY,CAAC,CAoBvB"}
|