@agentshouse/mdruntime-adapter 0.1.0-c9be7d20acbf4 → 0.1.0-c9c0fc93e45c2
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 +4 -53
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +26 -231
- package/dist/adapter.d.ts +0 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +158 -305
- 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 +289 -0
- package/dist/digest.d.ts +0 -1
- package/dist/discovery.d.ts +19 -9
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +65 -32
- package/dist/history.d.ts +6 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +85 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/map.d.ts +0 -1
- package/dist/model.d.ts +5 -9
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +28 -34
- package/dist/read.d.ts +19 -53
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +48 -316
- package/dist/refusal.d.ts +3 -5
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +17 -12
- package/dist/search.d.ts +4 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +47 -0
- 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 +78 -130
- 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 +15 -16
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +247 -429
- package/dist/transport.d.ts +56 -50
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +55 -12
- 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 +10 -8
- package/dist/version.d.ts +0 -1
- package/dist/write.d.ts +2 -3
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +27 -42
- 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/gather.d.ts +0 -3
- package/dist/gather.d.ts.map +0 -1
- package/dist/gather.js +0 -35
- package/dist/house-model.d.ts +0 -2
- package/dist/house-model.d.ts.map +0 -1
- package/dist/house-model.js +0 -491
- 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 -126
package/dist/history.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { actionOutcome } from './actions.js';
|
|
2
|
+
import { houseDoorRoute } from './transport.js';
|
|
3
|
+
import { unusable } from './uncertain.js';
|
|
4
|
+
export const HISTORY_PAGE = 100;
|
|
5
|
+
const HISTORY = 'conversations/history/list';
|
|
6
|
+
const CHANGE_DIGITS = 16;
|
|
7
|
+
const CHANGE = new RegExp(`^[0-9]{${CHANGE_DIGITS}}$`);
|
|
8
|
+
function record(value) {
|
|
9
|
+
return typeof value === 'object' && value !== null ? value : {};
|
|
10
|
+
}
|
|
11
|
+
function text(value, name) {
|
|
12
|
+
const held = record(value)[name];
|
|
13
|
+
return typeof held === 'string' ? held : undefined;
|
|
14
|
+
}
|
|
15
|
+
function changeOf(value) {
|
|
16
|
+
return Number.isSafeInteger(value) && value > 0 ? value : null;
|
|
17
|
+
}
|
|
18
|
+
export function changeCursor(change) {
|
|
19
|
+
return String(change).padStart(CHANGE_DIGITS, '0');
|
|
20
|
+
}
|
|
21
|
+
export function acceptedMessage(entry) {
|
|
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)
|
|
26
|
+
return null;
|
|
27
|
+
return {
|
|
28
|
+
identity,
|
|
29
|
+
turn: text(entry, 'turn_id') ?? identity,
|
|
30
|
+
position: JSON.stringify({ accepted_at: acceptedAt, message_id: identity }),
|
|
31
|
+
change: changeCursor(change),
|
|
32
|
+
text: text(entry, 'text') ?? '',
|
|
33
|
+
message: structuredClone(record(entry)),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function historyPage(entry) {
|
|
37
|
+
const held = record(entry);
|
|
38
|
+
const conversation = text(held, 'conversation_id');
|
|
39
|
+
if (conversation === undefined || !Array.isArray(held.messages))
|
|
40
|
+
return null;
|
|
41
|
+
const messages = [];
|
|
42
|
+
for (const one of held.messages) {
|
|
43
|
+
const message = acceptedMessage(one);
|
|
44
|
+
if (message === null)
|
|
45
|
+
return null;
|
|
46
|
+
messages.push(message);
|
|
47
|
+
}
|
|
48
|
+
const next = held.next === null || held.next === undefined ? undefined : changeOf(held.next);
|
|
49
|
+
if (next === null)
|
|
50
|
+
return null;
|
|
51
|
+
return { conversation, messages, ...(next === undefined ? {} : { next: changeCursor(next) }) };
|
|
52
|
+
}
|
|
53
|
+
function historyAsks(request) {
|
|
54
|
+
const asks = [];
|
|
55
|
+
for (const { conversation, after } of request.conversations) {
|
|
56
|
+
if (after !== undefined && !CHANGE.test(after))
|
|
57
|
+
return null;
|
|
58
|
+
asks.push({
|
|
59
|
+
conversation_id: conversation,
|
|
60
|
+
...(after === undefined ? {} : { after: Number(after) }),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return asks;
|
|
64
|
+
}
|
|
65
|
+
export async function houseHistory(transport, request) {
|
|
66
|
+
const asks = historyAsks(request);
|
|
67
|
+
if (asks === null)
|
|
68
|
+
return { kind: 'rejected', code: 'invalid_request', fields: {}, retryable: false };
|
|
69
|
+
const asked = { conversations: asks, limit: HISTORY_PAGE };
|
|
70
|
+
const outcome = actionOutcome(await transport.door(houseDoorRoute(HISTORY), asked), HISTORY, asked);
|
|
71
|
+
if (outcome.kind !== 'action')
|
|
72
|
+
return outcome;
|
|
73
|
+
const answered = record(outcome.result).histories;
|
|
74
|
+
if (!Array.isArray(answered))
|
|
75
|
+
return unusable();
|
|
76
|
+
const histories = [];
|
|
77
|
+
for (const entry of answered) {
|
|
78
|
+
const page = historyPage(entry);
|
|
79
|
+
if (page === null)
|
|
80
|
+
return unusable();
|
|
81
|
+
histories.push(page);
|
|
82
|
+
}
|
|
83
|
+
const result = { histories };
|
|
84
|
+
return { kind: 'action', result };
|
|
85
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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';
|
|
6
|
+
export { answeredFailure } from './refusal.js';
|
|
4
7
|
export { houseParts, type ChangeMapping } from './write.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
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 type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamed, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
8
|
+
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';
|
|
9
|
+
export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, type HouseRuntimeAct, type HouseRuntimeFrame, } from './transport.js';
|
|
10
|
+
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,
|
|
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,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,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,8 +1,9 @@
|
|
|
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';
|
|
6
|
+
export { answeredFailure } from './refusal.js';
|
|
4
7
|
export { houseParts } from './write.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
|
|
8
|
-
export { HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, INBOX_CHAT_TYPE, INBOX_MESSAGE_TYPE, } from './room-types.js';
|
|
8
|
+
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';
|
|
9
|
+
export { HOUSE_RUNTIME_READS, houseDoorRoute, houseSiteRoute, } from './transport.js';
|
package/dist/map.d.ts
CHANGED
package/dist/model.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { RoomModels } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
|
-
import { type HouseRoomHead
|
|
3
|
+
import { type HouseRoomHead } from './read.js';
|
|
4
|
+
import { type SpaceSchemas } from './space-schema.js';
|
|
4
5
|
import type { HouseMode, HouseStreamEntry } from './transport.js';
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
|
|
8
|
-
readonly seen: string[];
|
|
9
|
-
}>;
|
|
10
|
-
export declare function viewModels(view: HouseView, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
|
|
11
|
-
export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode): Promise<RoomModels | undefined>;
|
|
12
|
-
//# sourceMappingURL=model.d.ts.map
|
|
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, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode, 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,EAIL,KAAK,aAAa,
|
|
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,EAGnB,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,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,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,OAAO,GACb,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) {
|
|
@@ -17,49 +23,37 @@ 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
|
-
models: await partModels(scope, tracked, new Set(), true),
|
|
31
|
-
seen: scope.files.some((file) => file.path === tracked.schema) ? [tracked.schema] : [],
|
|
32
|
-
};
|
|
27
|
+
const held = schemaOf(modelScope(room), tracked.schema);
|
|
28
|
+
return modelsOf(tracked, () => held);
|
|
33
29
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
});
|
|
30
|
+
function spaceSchemaText(entry, spaces) {
|
|
31
|
+
if (entry.space === undefined || entry.revision === undefined)
|
|
32
|
+
return entry;
|
|
33
|
+
if (entry.text !== undefined) {
|
|
34
|
+
spaces.keep(entry.space, entry.revision, entry.text);
|
|
35
|
+
return entry;
|
|
36
|
+
}
|
|
37
|
+
const text = spaces.held(entry.space, entry.revision);
|
|
38
|
+
return text === undefined ? entry : { ...entry, text };
|
|
39
|
+
}
|
|
40
|
+
export function spaceSchemaTexts(entries, spaces) {
|
|
41
|
+
return entries.map((entry) => spaceSchemaText(entry, spaces));
|
|
50
42
|
}
|
|
51
|
-
export function streamedModels(schemas, tracked, mode) {
|
|
43
|
+
export function streamedModels(schemas, tracked, mode, whole) {
|
|
52
44
|
return modelsOf(tracked, (schema) => {
|
|
53
45
|
const entry = schemas.get(schema);
|
|
54
46
|
if (entry === undefined)
|
|
55
|
-
return undefined;
|
|
47
|
+
return whole ? ABSENT_SCHEMA : undefined;
|
|
48
|
+
const space = entry.space === undefined ? {} : { space: entry.space };
|
|
56
49
|
if (entry.kind === 'removed')
|
|
57
|
-
return ABSENT_SCHEMA;
|
|
58
|
-
|
|
50
|
+
return { ...ABSENT_SCHEMA, ...space };
|
|
51
|
+
const text = entry.text;
|
|
52
|
+
if (text === undefined)
|
|
59
53
|
return null;
|
|
60
54
|
const version = mode === 'site' ? entry.sha256 : entry.revision;
|
|
61
55
|
return version === undefined
|
|
62
56
|
? null
|
|
63
|
-
: { schema:
|
|
57
|
+
: { schema: text, version, revision: mode === 'site' ? null : version, ...space };
|
|
64
58
|
});
|
|
65
59
|
}
|
package/dist/read.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { TrackedAuthority } from './discovery.js';
|
|
1
|
+
import { type BinaryFile, type BootstrapPage, type SavedFacts } 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
|
+
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,8 +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>>;
|
|
23
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
22
24
|
revisions: Readonly<Record<string, string>>;
|
|
23
25
|
fileIds?: Readonly<Record<string, string>>;
|
|
26
|
+
created?: Readonly<Record<string, string>>;
|
|
24
27
|
changes: Readonly<Record<string, HeadChange>>;
|
|
25
28
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
26
29
|
removals: readonly string[];
|
|
@@ -33,7 +36,10 @@ export type HouseManifestFile = {
|
|
|
33
36
|
version: string;
|
|
34
37
|
sha256?: string;
|
|
35
38
|
head?: HeadChange;
|
|
39
|
+
created?: string;
|
|
36
40
|
binary?: BinaryFile;
|
|
41
|
+
facts?: SavedFacts;
|
|
42
|
+
space?: string;
|
|
37
43
|
};
|
|
38
44
|
export type HouseContent = {
|
|
39
45
|
path: string;
|
|
@@ -63,70 +69,30 @@ export type HouseFileAddress = {
|
|
|
63
69
|
sha256: string;
|
|
64
70
|
mediaType: string;
|
|
65
71
|
};
|
|
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
72
|
export declare function authorityRoot(handle: string): string;
|
|
104
73
|
export declare function schemaPath(handle: string, schema: string): string;
|
|
105
74
|
export declare function parseGrant(body: unknown): HouseGrant | null;
|
|
106
75
|
export declare function parseFileAddress(body: unknown): HouseFileAddress | null;
|
|
107
76
|
export declare function headChange(held: {
|
|
108
77
|
readonly author?: unknown;
|
|
109
|
-
readonly
|
|
78
|
+
readonly changed_at?: unknown;
|
|
110
79
|
}): HeadChange | undefined | null;
|
|
80
|
+
export declare function createdOf(held: {
|
|
81
|
+
readonly created_at?: unknown;
|
|
82
|
+
}): string | undefined | null;
|
|
111
83
|
export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
|
|
112
|
-
export declare function
|
|
113
|
-
|
|
84
|
+
export declare function carriedFacts(held: Readonly<Record<string, unknown>>): {
|
|
85
|
+
facts?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
facts: SavedFacts;
|
|
88
|
+
};
|
|
89
|
+
export declare function parseFile(value: unknown, mode: HouseMode): HouseManifestFile | null;
|
|
114
90
|
export declare function modelScope(room: HouseRoomHead): HouseScope;
|
|
115
|
-
export declare function emptyScope(room: HouseRoomHead): HouseScope;
|
|
116
|
-
export declare function housePart(room: HouseRoomHead, payload: Uint8Array<ArrayBuffer>, mode: HouseMode): Promise<{
|
|
117
|
-
scope: HouseScope;
|
|
118
|
-
ended: boolean;
|
|
119
|
-
} | 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
|
-
//# 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,SA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