@agentshouse/mdruntime-adapter 0.1.0-ccdfb41af2abb → 0.1.0-ccfaf175ec3b4
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/README.md +2 -2
- package/dist/actions.d.ts +3 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +26 -9
- package/dist/adapter.d.ts +0 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +118 -138
- package/dist/authored-path.d.ts +9 -0
- package/dist/authored-path.d.ts.map +1 -0
- package/dist/authored-path.js +34 -0
- package/dist/chunks.d.ts +36 -0
- package/dist/chunks.d.ts.map +1 -0
- package/dist/chunks.js +281 -0
- package/dist/digest.d.ts +0 -1
- package/dist/discovery.d.ts +23 -7
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +163 -16
- package/dist/history.d.ts +1 -7
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +24 -30
- package/dist/index.d.ts +5 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/map.d.ts +0 -1
- package/dist/model.d.ts +6 -9
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +28 -26
- package/dist/read.d.ts +15 -24
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +66 -189
- package/dist/refusal.d.ts +3 -2
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +17 -7
- package/dist/search.d.ts +0 -1
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +5 -5
- package/dist/session-content/bounds.d.ts +7 -0
- package/dist/session-content/check.d.ts +18 -0
- package/dist/session-content/index.d.ts +7 -0
- package/dist/session-content/parts.d.ts +103 -0
- package/dist/session-content/state.d.ts +61 -0
- package/dist/session-content/turn.d.ts +328 -0
- package/dist/site.d.ts +0 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +44 -50
- package/dist/space-schema.d.ts +6 -0
- package/dist/space-schema.d.ts.map +1 -0
- package/dist/space-schema.js +11 -0
- package/dist/stream.d.ts +4 -4
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +146 -72
- package/dist/transport.d.ts +47 -27
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +15 -14
- package/dist/uncertain.d.ts +5 -0
- package/dist/uncertain.d.ts.map +1 -0
- package/dist/uncertain.js +11 -0
- package/dist/upload.d.ts +3 -2
- package/dist/upload.d.ts.map +1 -1
- package/dist/upload.js +8 -6
- package/dist/version.d.ts +0 -1
- package/dist/write.d.ts +0 -2
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +22 -29
- package/package.json +3 -2
- package/dist/app-reference.d.ts +0 -2
- package/dist/app-reference.d.ts.map +0 -1
- package/dist/app-reference.js +0 -2
- package/dist/crockford.d.ts +0 -4
- package/dist/crockford.d.ts.map +0 -1
- package/dist/crockford.js +0 -3
- package/dist/house-model.d.ts +0 -892
- package/dist/house-model.d.ts.map +0 -1
- package/dist/house-model.js +0 -482
- package/dist/part.d.ts +0 -14
- package/dist/part.d.ts.map +0 -1
- package/dist/part.js +0 -90
- package/dist/room-stream.d.ts +0 -19
- package/dist/room-stream.d.ts.map +0 -1
- package/dist/room-stream.js +0 -57
- package/dist/room-types.d.ts +0 -7
- package/dist/room-types.d.ts.map +0 -1
- package/dist/room-types.js +0 -125
package/dist/history.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { actionOutcome } from './actions.js';
|
|
2
2
|
import { houseDoorRoute } from './transport.js';
|
|
3
|
+
import { unusable } from './uncertain.js';
|
|
3
4
|
export const HISTORY_PAGE = 100;
|
|
4
|
-
const HISTORY = 'conversations/history';
|
|
5
|
+
const HISTORY = 'conversations/history/list';
|
|
6
|
+
const CHANGE_DIGITS = 16;
|
|
7
|
+
const CHANGE = new RegExp(`^[0-9]{${CHANGE_DIGITS}}$`);
|
|
5
8
|
function record(value) {
|
|
6
9
|
return typeof value === 'object' && value !== null ? value : {};
|
|
7
10
|
}
|
|
@@ -9,32 +12,23 @@ function text(value, name) {
|
|
|
9
12
|
const held = record(value)[name];
|
|
10
13
|
return typeof held === 'string' ? held : undefined;
|
|
11
14
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
const messageId = text(value, 'message_id');
|
|
15
|
-
if (acceptedAt === undefined || messageId === undefined)
|
|
16
|
-
return null;
|
|
17
|
-
return { accepted_at: acceptedAt, message_id: messageId };
|
|
18
|
-
}
|
|
19
|
-
export function cursorPosition(cursor) {
|
|
20
|
-
return JSON.stringify({ accepted_at: cursor.accepted_at, message_id: cursor.message_id });
|
|
15
|
+
function changeOf(value) {
|
|
16
|
+
return Number.isSafeInteger(value) && value > 0 ? value : null;
|
|
21
17
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
return historyCursor(JSON.parse(value));
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
18
|
+
export function changeCursor(change) {
|
|
19
|
+
return String(change).padStart(CHANGE_DIGITS, '0');
|
|
29
20
|
}
|
|
30
21
|
export function acceptedMessage(entry) {
|
|
31
|
-
const
|
|
32
|
-
|
|
22
|
+
const identity = text(entry, 'message_id');
|
|
23
|
+
const acceptedAt = text(entry, 'accepted_at');
|
|
24
|
+
const change = changeOf(record(entry).change);
|
|
25
|
+
if (identity === undefined || acceptedAt === undefined || change === null)
|
|
33
26
|
return null;
|
|
34
27
|
return {
|
|
35
|
-
identity
|
|
36
|
-
turn: text(entry, 'turn_id') ??
|
|
37
|
-
position:
|
|
28
|
+
identity,
|
|
29
|
+
turn: text(entry, 'turn_id') ?? identity,
|
|
30
|
+
position: JSON.stringify({ accepted_at: acceptedAt, message_id: identity }),
|
|
31
|
+
change: changeCursor(change),
|
|
38
32
|
text: text(entry, 'text') ?? '',
|
|
39
33
|
message: structuredClone(record(entry)),
|
|
40
34
|
};
|
|
@@ -51,20 +45,19 @@ function historyPage(entry) {
|
|
|
51
45
|
return null;
|
|
52
46
|
messages.push(message);
|
|
53
47
|
}
|
|
54
|
-
const next = held.next === null || held.next === undefined ? undefined :
|
|
48
|
+
const next = held.next === null || held.next === undefined ? undefined : changeOf(held.next);
|
|
55
49
|
if (next === null)
|
|
56
50
|
return null;
|
|
57
|
-
return { conversation, messages, ...(next === undefined ? {} : { next:
|
|
51
|
+
return { conversation, messages, ...(next === undefined ? {} : { next: changeCursor(next) }) };
|
|
58
52
|
}
|
|
59
53
|
function historyAsks(request) {
|
|
60
54
|
const asks = [];
|
|
61
55
|
for (const { conversation, after } of request.conversations) {
|
|
62
|
-
|
|
63
|
-
if (cursor === null)
|
|
56
|
+
if (after !== undefined && !CHANGE.test(after))
|
|
64
57
|
return null;
|
|
65
58
|
asks.push({
|
|
66
59
|
conversation_id: conversation,
|
|
67
|
-
...(
|
|
60
|
+
...(after === undefined ? {} : { after: Number(after) }),
|
|
68
61
|
});
|
|
69
62
|
}
|
|
70
63
|
return asks;
|
|
@@ -73,17 +66,18 @@ export async function houseHistory(transport, request) {
|
|
|
73
66
|
const asks = historyAsks(request);
|
|
74
67
|
if (asks === null)
|
|
75
68
|
return { kind: 'rejected', code: 'invalid_request', fields: {}, retryable: false };
|
|
76
|
-
const
|
|
69
|
+
const asked = { conversations: asks, limit: HISTORY_PAGE };
|
|
70
|
+
const outcome = actionOutcome(await transport.door(houseDoorRoute(HISTORY), asked), HISTORY, asked);
|
|
77
71
|
if (outcome.kind !== 'action')
|
|
78
72
|
return outcome;
|
|
79
73
|
const answered = record(outcome.result).histories;
|
|
80
74
|
if (!Array.isArray(answered))
|
|
81
|
-
return
|
|
75
|
+
return unusable();
|
|
82
76
|
const histories = [];
|
|
83
77
|
for (const entry of answered) {
|
|
84
78
|
const page = historyPage(entry);
|
|
85
79
|
if (page === null)
|
|
86
|
-
return
|
|
80
|
+
return unusable();
|
|
87
81
|
histories.push(page);
|
|
88
82
|
}
|
|
89
83
|
const result = { histories };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
|
+
export { foldedAuthorities, ROOM_OWN } from './discovery.js';
|
|
2
3
|
export { finishedUpload, houseUpload, type HouseUpload } from './upload.js';
|
|
3
4
|
export { houseAction, type HouseActDoor } from './actions.js';
|
|
4
5
|
export { HISTORY_PAGE } from './history.js';
|
|
6
|
+
export { answeredFailure } from './refusal.js';
|
|
7
|
+
export { documentEntry, type HouseManifestFile } from './read.js';
|
|
5
8
|
export { houseParts, type ChangeMapping } from './write.js';
|
|
6
|
-
export {
|
|
7
|
-
export { HOUSE_MODEL_DECLARATION, HOUSE_MODEL_TYPES, type HouseDocumentFields, type HouseModelType, } from './house-model.js';
|
|
8
|
-
export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
|
|
9
|
-
export { HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, INBOX_CHAT_TYPE, INBOX_MESSAGE_TYPE, type InboxChannelKind, } from './room-types.js';
|
|
9
|
+
export { admittedPath, AUTHORED_SEGMENT, AUTHORED_SEGMENT_MAX_CHARS, GENERATED_PROVENANCE, GENERATED_REVISIONS, LOCAL_COPY_MANIFEST, LOCAL_COPY_ROOT_NAMES, RESERVED_DERIVED, WHOLE_ESCAPED_NAMES, } from './authored-path.js';
|
|
10
10
|
export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, type HouseRuntimeAct, type HouseRuntimeFrame, } from './transport.js';
|
|
11
|
-
export type {
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
11
|
+
export type { HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
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,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC7D,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,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter } from './adapter.js';
|
|
2
|
+
export { foldedAuthorities, ROOM_OWN } from './discovery.js';
|
|
2
3
|
export { finishedUpload, houseUpload } from './upload.js';
|
|
3
4
|
export { houseAction } from './actions.js';
|
|
4
5
|
export { HISTORY_PAGE } from './history.js';
|
|
6
|
+
export { answeredFailure } from './refusal.js';
|
|
7
|
+
export { documentEntry } from './read.js';
|
|
5
8
|
export { houseParts } from './write.js';
|
|
6
|
-
export {
|
|
7
|
-
export { HOUSE_MODEL_DECLARATION, HOUSE_MODEL_TYPES, } from './house-model.js';
|
|
8
|
-
export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
|
|
9
|
-
export { HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, INBOX_CHAT_TYPE, INBOX_MESSAGE_TYPE, } from './room-types.js';
|
|
9
|
+
export { admittedPath, AUTHORED_SEGMENT, AUTHORED_SEGMENT_MAX_CHARS, GENERATED_PROVENANCE, GENERATED_REVISIONS, LOCAL_COPY_MANIFEST, LOCAL_COPY_ROOT_NAMES, RESERVED_DERIVED, WHOLE_ESCAPED_NAMES, } from './authored-path.js';
|
|
10
10
|
export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, } from './transport.js';
|
package/dist/map.d.ts
CHANGED
package/dist/model.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { RoomModels } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
|
-
import { type
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
export declare function manifestedModels(room: HouseRoomHead, tracked: TrackedAuthority): Promise<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}>;
|
|
10
|
-
export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode): Promise<RoomModels | undefined>;
|
|
11
|
-
//# sourceMappingURL=model.d.ts.map
|
|
3
|
+
import { type HouseManifestFile, type HouseRoomHead } from './read.js';
|
|
4
|
+
import { type SpaceSchemas } from './space-schema.js';
|
|
5
|
+
import type { HouseStreamEntry } from './transport.js';
|
|
6
|
+
export declare function manifestedModels(room: HouseRoomHead, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
|
|
7
|
+
export declare function spaceSchemaTexts(entries: readonly HouseStreamEntry[], spaces: SpaceSchemas): HouseStreamEntry[];
|
|
8
|
+
export declare function streamedModels(schemas: ReadonlyMap<string, HouseManifestFile | null>, tracked: TrackedAuthority, whole: boolean): Promise<RoomModels | undefined>;
|
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,
|
|
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,EAKL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAEnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA+BvD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAGjC;AAYD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,MAAM,EAAE,YAAY,GACnB,gBAAgB,EAAE,CAEpB;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC,EACtD,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAMjC"}
|
package/dist/model.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sha256Hex } from './digest.js';
|
|
2
|
-
import { modelScope, schemaOf, schemaPath, } from './read.js';
|
|
2
|
+
import { modelScope, schemaFile, 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) {
|
|
@@ -17,32 +23,28 @@ async function modelsOf(tracked, read) {
|
|
|
17
23
|
return undefined;
|
|
18
24
|
return { collection: await heldModel(collection, schemaPath(tracked.handle, tracked.schema)) };
|
|
19
25
|
}
|
|
20
|
-
export function partModels(scope, tracked, seen, final) {
|
|
21
|
-
return modelsOf(tracked, (schema) => {
|
|
22
|
-
if (scope.files.some((file) => file.path === schema))
|
|
23
|
-
return schemaOf(scope, schema);
|
|
24
|
-
return final && !seen.has(schema) ? ABSENT_SCHEMA : undefined;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
26
|
export async function manifestedModels(room, tracked) {
|
|
28
|
-
const
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const held = schemaOf(modelScope(room), tracked.schema);
|
|
28
|
+
return modelsOf(tracked, () => held);
|
|
29
|
+
}
|
|
30
|
+
function spaceSchemaText(entry, spaces) {
|
|
31
|
+
if (entry.space === undefined || entry.revision === undefined)
|
|
32
|
+
return entry;
|
|
33
|
+
if (entry.content !== undefined) {
|
|
34
|
+
spaces.keep(entry.space, entry.revision, entry.content);
|
|
35
|
+
return entry;
|
|
36
|
+
}
|
|
37
|
+
const content = spaces.held(entry.space, entry.revision);
|
|
38
|
+
return content === undefined ? entry : { ...entry, content };
|
|
39
|
+
}
|
|
40
|
+
export function spaceSchemaTexts(entries, spaces) {
|
|
41
|
+
return entries.map((entry) => spaceSchemaText(entry, spaces));
|
|
33
42
|
}
|
|
34
|
-
export function streamedModels(schemas, tracked,
|
|
43
|
+
export function streamedModels(schemas, tracked, whole) {
|
|
35
44
|
return modelsOf(tracked, (schema) => {
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
return undefined;
|
|
39
|
-
|
|
40
|
-
return ABSENT_SCHEMA;
|
|
41
|
-
if (entry.text === undefined)
|
|
42
|
-
return null;
|
|
43
|
-
const version = mode === 'site' ? entry.sha256 : entry.revision;
|
|
44
|
-
return version === undefined
|
|
45
|
-
? null
|
|
46
|
-
: { schema: entry.text, version, revision: mode === 'site' ? null : version };
|
|
45
|
+
const file = schemas.get(schema);
|
|
46
|
+
if (file === undefined)
|
|
47
|
+
return whole ? ABSENT_SCHEMA : undefined;
|
|
48
|
+
return file === null ? ABSENT_SCHEMA : schemaFile(file);
|
|
47
49
|
});
|
|
48
50
|
}
|
package/dist/read.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { type BinaryFile, type BootstrapPage, type
|
|
1
|
+
import { type BinaryFile, type BootstrapPage, type SavedFacts } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { HouseMode } from './transport.js';
|
|
3
3
|
import { type LogPosition } from './version.js';
|
|
4
4
|
export type HeadChange = BootstrapPage['changes'][string];
|
|
5
5
|
export type Answered = {
|
|
6
6
|
readonly documents: Map<string, string>;
|
|
7
|
-
readonly
|
|
7
|
+
readonly facts: Map<string, SavedFacts>;
|
|
8
8
|
readonly revisions: Map<string, string>;
|
|
9
9
|
readonly fileIds: Map<string, string>;
|
|
10
|
+
readonly created: Map<string, string>;
|
|
10
11
|
readonly changes: Map<string, HeadChange>;
|
|
11
12
|
readonly binaryFiles: Map<string, BinaryFile>;
|
|
12
13
|
readonly removals: Set<string>;
|
|
@@ -19,9 +20,10 @@ export declare function forgotten(answer: Answered, path: string): void;
|
|
|
19
20
|
export declare function folded(answer: Answered, path: string, removed: boolean): void;
|
|
20
21
|
export declare function answered(answer: Answered): Generator<number, {
|
|
21
22
|
documents: Readonly<Record<string, string>>;
|
|
22
|
-
|
|
23
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
23
24
|
revisions: Readonly<Record<string, string>>;
|
|
24
25
|
fileIds?: Readonly<Record<string, string>>;
|
|
26
|
+
created?: Readonly<Record<string, string>>;
|
|
25
27
|
changes: Readonly<Record<string, HeadChange>>;
|
|
26
28
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
27
29
|
removals: readonly string[];
|
|
@@ -32,25 +34,19 @@ export type HouseManifestFile = {
|
|
|
32
34
|
path: string;
|
|
33
35
|
revision: string | undefined;
|
|
34
36
|
version: string;
|
|
35
|
-
sha256?: string;
|
|
36
37
|
head?: HeadChange;
|
|
38
|
+
created?: string;
|
|
37
39
|
binary?: BinaryFile;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
path: string;
|
|
42
|
-
content: string;
|
|
40
|
+
facts?: SavedFacts;
|
|
41
|
+
space?: string;
|
|
42
|
+
content?: string;
|
|
43
43
|
};
|
|
44
44
|
export type HouseScope = LogPosition & {
|
|
45
45
|
anchor: string;
|
|
46
46
|
files: readonly HouseManifestFile[];
|
|
47
|
-
contents: readonly HouseContent[];
|
|
48
47
|
folders?: readonly string[];
|
|
49
48
|
};
|
|
50
|
-
export type HouseModels =
|
|
51
|
-
files: readonly HouseManifestFile[];
|
|
52
|
-
contents: readonly HouseContent[];
|
|
53
|
-
};
|
|
49
|
+
export type HouseModels = readonly HouseManifestFile[];
|
|
54
50
|
export type HouseRoomHead = LogPosition & {
|
|
55
51
|
anchor: string;
|
|
56
52
|
models: HouseModels;
|
|
@@ -71,23 +67,18 @@ export declare function parseGrant(body: unknown): HouseGrant | null;
|
|
|
71
67
|
export declare function parseFileAddress(body: unknown): HouseFileAddress | null;
|
|
72
68
|
export declare function headChange(held: {
|
|
73
69
|
readonly author?: unknown;
|
|
74
|
-
readonly
|
|
70
|
+
readonly changed_at?: unknown;
|
|
75
71
|
}): HeadChange | undefined | null;
|
|
76
72
|
export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
|
|
77
|
-
export declare function
|
|
78
|
-
export declare function
|
|
79
|
-
export declare function manifested(room: HouseRoomHead, pageToken: string, models: RoomModels | undefined): BootstrapPage;
|
|
73
|
+
export declare function documentEntry(value: unknown, mode: HouseMode): HouseManifestFile | null;
|
|
74
|
+
export declare function kept(answer: Answered, file: HouseManifestFile): void;
|
|
80
75
|
export declare function modelScope(room: HouseRoomHead): HouseScope;
|
|
81
|
-
export declare function emptyScope(room: HouseRoomHead): HouseScope;
|
|
82
|
-
export declare function housePart(room: HouseRoomHead, payload: Uint8Array<ArrayBuffer>, mode: HouseMode): Promise<{
|
|
83
|
-
scope: HouseScope;
|
|
84
|
-
ended: boolean;
|
|
85
|
-
} | TransportUncertainty>;
|
|
86
76
|
export declare function bootstrapping(scope: HouseScope): Generator<number, BootstrapPage, void>;
|
|
87
77
|
export type HouseSchema = {
|
|
88
78
|
schema: string | null;
|
|
89
79
|
version: string | null;
|
|
90
80
|
revision: string | null;
|
|
81
|
+
space?: string;
|
|
91
82
|
};
|
|
83
|
+
export declare function schemaFile(file: HouseManifestFile): HouseSchema | null;
|
|
92
84
|
export declare function schemaOf(scope: HouseScope, schema: string): HouseSchema | null;
|
|
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,EAGL,KAAK,UAAU,EACf,KAAK,aAAa,EAElB,KAAK,UAAU,EAChB,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;AAM1D,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,C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