@agentshouse/mdruntime-adapter 0.1.0-cedb8e57837a7 → 0.1.0-cee1a6954eb65
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 +3 -3
- package/dist/actions.d.ts +6 -70
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +26 -363
- package/dist/adapter.d.ts +0 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +264 -457
- 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 +44 -19
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +239 -72
- 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 +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/map.d.ts +0 -1
- package/dist/model.d.ts +6 -6
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +31 -48
- package/dist/read.d.ts +31 -68
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +136 -322
- package/dist/refusal.d.ts +6 -5
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +27 -11
- package/dist/room-query.d.ts +4 -0
- package/dist/room-query.d.ts.map +1 -0
- package/dist/room-query.js +48 -0
- 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/check.d.ts +17 -0
- package/dist/session-content/index.d.ts +6 -0
- package/dist/session-content/parts.d.ts +30 -0
- package/dist/session-content/state.d.ts +59 -0
- package/dist/session-content/turn.d.ts +137 -0
- package/dist/site.d.ts +0 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +102 -206
- 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 -15
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +240 -415
- package/dist/transport.d.ts +85 -48
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +88 -11
- 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 +13 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +65 -0
- package/dist/version.d.ts +0 -1
- package/dist/write.d.ts +6 -3
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +48 -61
- package/package.json +9 -4
- package/AGENTS.md +0 -304
- package/dist/gather.d.ts +0 -4
- package/dist/gather.d.ts.map +0 -1
- package/dist/gather.js +0 -35
- package/dist/handed.d.ts +0 -15
- package/dist/handed.d.ts.map +0 -1
- package/dist/handed.js +0 -45
- package/dist/referrer.d.ts +0 -7
- package/dist/referrer.d.ts.map +0 -1
- package/dist/referrer.js +0 -35
package/dist/site.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { actionOutcome
|
|
1
|
+
import { HOUSE_ROOM_TYPES, HOUSE_TYPED_PATHS } from '@agentshouse/mdmodel';
|
|
2
|
+
import { actionOutcome } from './actions.js';
|
|
3
|
+
import { chunkedHead, chunkPart, siteChunkList } from './chunks.js';
|
|
3
4
|
import { mapDiscovery, parseSiteDiscovery, siteCapabilities, siteTracked, } from './discovery.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { classifyDoor, classifyRead, discoveryFailure } from './refusal.js';
|
|
5
|
+
import { answeredFailure, discoveryFailure } from './refusal.js';
|
|
6
|
+
import { admittedPath } from './authored-path.js';
|
|
7
|
+
import { siteQuery } from './room-query.js';
|
|
8
8
|
import { houseNotifications } from './stream.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { followsVersion,
|
|
12
|
-
const UNCERTAIN = { kind: 'transport-uncertainty' };
|
|
9
|
+
import { houseSiteRoute, SITE_DOOR_ACTS, SITE_FILES, } from './transport.js';
|
|
10
|
+
import { UNANSWERED, unusable } from './uncertain.js';
|
|
11
|
+
import { followsVersion, reachedVersion, roomVersion } from './version.js';
|
|
13
12
|
function unfound() {
|
|
14
|
-
return { kind: 'rejected', code: '
|
|
13
|
+
return { kind: 'rejected', code: 'not_found', fields: {}, retryable: false };
|
|
15
14
|
}
|
|
16
15
|
function siteRoom(tracked) {
|
|
17
16
|
return {
|
|
@@ -19,200 +18,112 @@ function siteRoom(tracked) {
|
|
|
19
18
|
locator: tracked.locator,
|
|
20
19
|
handle: tracked.handle,
|
|
21
20
|
roomVersion: roomVersion(tracked),
|
|
22
|
-
operations: { write: [],
|
|
21
|
+
operations: { write: [], erase: [] },
|
|
23
22
|
replica: { selection: tracked.locator, admission: 'admitted', offline: 'open' },
|
|
23
|
+
typedSelection: null,
|
|
24
24
|
providerOwnedPaths: [],
|
|
25
|
+
authoredPaths: ['**'],
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
function settled(refused) {
|
|
28
|
-
return refused.kind === 'beyond-horizon' ? UNCERTAIN : refused;
|
|
29
|
-
}
|
|
30
28
|
export function createSiteAdapter(transport, snapshot = false) {
|
|
31
|
-
const notifications = houseNotifications(transport, 'site'
|
|
29
|
+
const notifications = houseNotifications(transport, 'site', {
|
|
30
|
+
opened: async () => {
|
|
31
|
+
const found = await discovered();
|
|
32
|
+
return found.kind === 'discovery' ? found : null;
|
|
33
|
+
},
|
|
34
|
+
changed: () => null,
|
|
35
|
+
});
|
|
32
36
|
const tracked = new Map();
|
|
33
|
-
|
|
34
|
-
const named = houseReferrer(referrer, tracked);
|
|
35
|
-
return named === null || !tracked.has(named.locator) ? null : named;
|
|
36
|
-
}
|
|
37
|
+
const chunked = new Map();
|
|
37
38
|
function fileRoute(request) {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
return { kind: '
|
|
41
|
-
}
|
|
42
|
-
if (request.fileRef === undefined)
|
|
43
|
-
return unfound();
|
|
44
|
-
const { room_ref, path, record } = named.referrer;
|
|
45
|
-
return `${SITE_FILES}${room_ref}/${encodeURIComponent(request.fileRef)}/${path === undefined
|
|
46
|
-
? `${SITE_FILE_RECORD}/${encodeURIComponent(record)}`
|
|
47
|
-
: encodeURIComponent(path)}`;
|
|
48
|
-
}
|
|
49
|
-
async function enumerated(entry, from, page) {
|
|
50
|
-
const answer = await transport.door(SITE_DOOR_ENUMERATE, {
|
|
51
|
-
positions: [
|
|
52
|
-
page === undefined
|
|
53
|
-
? presented(entry.authority, from)
|
|
54
|
-
: {
|
|
55
|
-
...presented(entry.authority, { position: page.after, logEpoch: from.logEpoch }),
|
|
56
|
-
page: { through: page.through, read: page.read },
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
});
|
|
60
|
-
const classified = classifyRead(answer.status, answer.body, entry.locator);
|
|
61
|
-
if (classified !== null)
|
|
62
|
-
return classified;
|
|
63
|
-
const found = parseEnumeration(answer.body, 'site');
|
|
64
|
-
if (found === null)
|
|
65
|
-
return UNCERTAIN;
|
|
66
|
-
return viewOf(found, entry) ?? { kind: 'room-not-readable', locator: entry.locator };
|
|
67
|
-
}
|
|
68
|
-
async function enumeration(entry, from) {
|
|
69
|
-
const first = await enumerated(entry, from);
|
|
70
|
-
return 'kind' in first ? first : wholeView(first, (page) => enumerated(entry, from, page));
|
|
39
|
+
const entry = tracked.get(request.locator);
|
|
40
|
+
if (entry === undefined)
|
|
41
|
+
return { kind: 'room-not-readable', locator: request.locator };
|
|
42
|
+
return `${SITE_FILES}${entry.authority}/${encodeURIComponent(request.revision)}/${encodeURIComponent(request.path)}`;
|
|
71
43
|
}
|
|
72
|
-
async function
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const scope = await stepped(parseSiteBootstrap(answer.body));
|
|
82
|
-
return scope === null ? { failure: UNCERTAIN } : { body: answer.body, scope };
|
|
44
|
+
async function listedRoom(entry) {
|
|
45
|
+
const past = chunked.get(entry.locator)?.position;
|
|
46
|
+
const listed = siteChunkList(await transport.read(`${houseSiteRoute('chunks')}/${entry.authority}${past === undefined ? '' : `?expired=${past}`}`), entry.locator);
|
|
47
|
+
if ('kind' in listed)
|
|
48
|
+
return listed;
|
|
49
|
+
const head = await chunkedHead(listed, entry);
|
|
50
|
+
if (head.kind === 'bootstrap')
|
|
51
|
+
chunked.set(entry.locator, listed);
|
|
52
|
+
return head;
|
|
83
53
|
}
|
|
84
|
-
async function
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return part.failure;
|
|
94
|
-
const [piece] = part.scope.contents;
|
|
95
|
-
if (piece === undefined ||
|
|
96
|
-
part.scope.contents.length !== 1 ||
|
|
97
|
-
piece.path !== path ||
|
|
98
|
-
piece.content.length === 0) {
|
|
99
|
-
return UNCERTAIN;
|
|
100
|
-
}
|
|
101
|
-
text += piece.content;
|
|
102
|
-
const more = siteBootstrapOffset(part.body);
|
|
103
|
-
if (more === null)
|
|
104
|
-
break;
|
|
105
|
-
if (more !== text.length)
|
|
106
|
-
return UNCERTAIN;
|
|
107
|
-
}
|
|
108
|
-
const file = scope.files.find((held) => held.path === path);
|
|
109
|
-
if (file === undefined || (await sha256Hex(text)) !== file.version)
|
|
110
|
-
return UNCERTAIN;
|
|
111
|
-
return { ...scope, contents: [...scope.contents.slice(0, -1), { path, content: text }] };
|
|
112
|
-
}
|
|
113
|
-
async function caughtUp(entry, after) {
|
|
114
|
-
const part = await bootstrapPart(entry, after, null);
|
|
115
|
-
if ('failure' in part)
|
|
116
|
-
return part;
|
|
117
|
-
const next = siteBootstrapNext(part.body);
|
|
118
|
-
const offset = siteBootstrapOffset(part.body);
|
|
119
|
-
if (offset !== null) {
|
|
120
|
-
if (next === null)
|
|
121
|
-
return { failure: UNCERTAIN };
|
|
122
|
-
const scope = await assembled(entry, part.scope, next, offset);
|
|
123
|
-
return 'kind' in scope ? { failure: scope } : { scope, next };
|
|
124
|
-
}
|
|
125
|
-
const { scope } = part;
|
|
126
|
-
if (after !== null || next !== null || roomVersion(scope) === roomVersion(entry)) {
|
|
127
|
-
return { scope, next };
|
|
128
|
-
}
|
|
129
|
-
const view = await enumeration(entry, scope);
|
|
130
|
-
if ('kind' in view)
|
|
131
|
-
return { failure: settled(view) };
|
|
132
|
-
return { scope: await stepped(advancedScope(scope, view)), next: null };
|
|
54
|
+
async function chunkPage(entry, id, arriving) {
|
|
55
|
+
const room = chunked.get(entry.locator);
|
|
56
|
+
const address = room?.chunks.get(id);
|
|
57
|
+
if (room === undefined || address === undefined)
|
|
58
|
+
return UNANSWERED;
|
|
59
|
+
const read = await transport.download(address.url);
|
|
60
|
+
if (read.status !== 200)
|
|
61
|
+
return answeredFailure(read.status, null);
|
|
62
|
+
return chunkPart(read.body, room, id, arriving);
|
|
133
63
|
}
|
|
134
|
-
async function
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
notifications.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
64
|
+
async function discovered() {
|
|
65
|
+
const answer = await transport.read(houseSiteRoute('discover'));
|
|
66
|
+
const failed = discoveryFailure(answer.status, answer.body);
|
|
67
|
+
if (failed !== null)
|
|
68
|
+
return failed;
|
|
69
|
+
const document = parseSiteDiscovery(answer.body);
|
|
70
|
+
if (document === null)
|
|
71
|
+
return unusable();
|
|
72
|
+
const entries = siteTracked(document);
|
|
73
|
+
tracked.clear();
|
|
74
|
+
for (const entry of entries)
|
|
75
|
+
tracked.set(entry.locator, entry);
|
|
76
|
+
notifications.track(entries);
|
|
77
|
+
return {
|
|
78
|
+
...mapDiscovery(document, entries.map(siteRoom), siteCapabilities()),
|
|
79
|
+
queriesOnly: document.queriesOnly.map(({ roomRef, roomHandle }) => ({
|
|
80
|
+
locator: roomRef,
|
|
81
|
+
handle: roomHandle,
|
|
82
|
+
name: roomHandle,
|
|
83
|
+
})),
|
|
84
|
+
};
|
|
152
85
|
}
|
|
153
86
|
return {
|
|
154
87
|
localSaves: true,
|
|
155
|
-
|
|
88
|
+
roomTypes: HOUSE_ROOM_TYPES,
|
|
89
|
+
typedPaths: HOUSE_TYPED_PATHS,
|
|
90
|
+
pathRule: admittedPath,
|
|
156
91
|
async authorize() {
|
|
157
92
|
return {};
|
|
158
93
|
},
|
|
159
|
-
async discover() {
|
|
160
|
-
const answer = await transport.read(SITE_DOOR_DISCOVER);
|
|
161
|
-
const failed = discoveryFailure(answer.status, answer.body);
|
|
162
|
-
if (failed !== null)
|
|
163
|
-
return failed;
|
|
164
|
-
const document = parseSiteDiscovery(answer.body);
|
|
165
|
-
if (document === null)
|
|
166
|
-
return UNCERTAIN;
|
|
167
|
-
const entries = siteTracked(document);
|
|
168
|
-
tracked.clear();
|
|
169
|
-
for (const entry of entries)
|
|
170
|
-
tracked.set(entry.locator, entry);
|
|
171
|
-
notifications.track(entries);
|
|
172
|
-
return mapDiscovery(document, entries.map(siteRoom), siteCapabilities());
|
|
173
|
-
},
|
|
174
94
|
async bootstrap(_authorization, request) {
|
|
175
95
|
const entry = tracked.get(request.locator);
|
|
176
96
|
if (entry === undefined)
|
|
177
97
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
178
|
-
|
|
179
|
-
?
|
|
180
|
-
:
|
|
181
|
-
const held = await caughtUp(entry, continued?.after ?? null);
|
|
182
|
-
if ('failure' in held)
|
|
183
|
-
return held.failure;
|
|
184
|
-
notifications.reach(entry.authority, held.scope);
|
|
185
|
-
const seen = [
|
|
186
|
-
...(continued?.seen ?? []),
|
|
187
|
-
...entry.schemas.filter((schema) => held.scope.files.some((file) => file.path === schema)),
|
|
188
|
-
];
|
|
189
|
-
const models = await partModels(held.scope, entry, new Set(seen), held.next === null);
|
|
190
|
-
const continuation = held.next === null ? null : { after: held.next, seen };
|
|
191
|
-
return {
|
|
192
|
-
...(await stepped(bootstrapping(held.scope))),
|
|
193
|
-
...(models === undefined ? {} : { models }),
|
|
194
|
-
...(continuation === null ? {} : { pageToken: JSON.stringify(continuation) }),
|
|
195
|
-
};
|
|
98
|
+
return request.pageToken === undefined
|
|
99
|
+
? listedRoom(entry)
|
|
100
|
+
: chunkPage(entry, request.pageToken, request.arriving);
|
|
196
101
|
},
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
102
|
+
...(snapshot
|
|
103
|
+
? {
|
|
104
|
+
discover: discovered,
|
|
105
|
+
async refresh(_authorization, request) {
|
|
106
|
+
const entry = tracked.get(request.locator);
|
|
107
|
+
if (entry === undefined)
|
|
108
|
+
return { kind: 'room-not-readable', locator: request.locator };
|
|
109
|
+
if (request.pageToken !== undefined)
|
|
110
|
+
return UNANSWERED;
|
|
111
|
+
return request.fromRoomVersion === roomVersion(entry)
|
|
112
|
+
? { kind: 'still-current' }
|
|
113
|
+
: { kind: 'beyond-horizon' };
|
|
114
|
+
},
|
|
207
115
|
}
|
|
208
|
-
|
|
209
|
-
},
|
|
116
|
+
: {}),
|
|
210
117
|
async mutate() {
|
|
211
118
|
return { kind: 'rejected', affected: {}, code: 'write-grant', fields: {}, retryable: false };
|
|
212
119
|
},
|
|
120
|
+
async attach() {
|
|
121
|
+
return { kind: 'rejected', code: 'write-grant', fields: {}, retryable: false };
|
|
122
|
+
},
|
|
213
123
|
async history() {
|
|
214
124
|
return { kind: 'no-history' };
|
|
215
125
|
},
|
|
126
|
+
queryHouse: snapshot ? undefined : (_authorization, request) => siteQuery(transport, request),
|
|
216
127
|
async binary(_authorization, request) {
|
|
217
128
|
const route = fileRoute(request);
|
|
218
129
|
if (typeof route !== 'string')
|
|
@@ -220,11 +131,15 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
220
131
|
const read = await transport.download(route);
|
|
221
132
|
if (read.status === 404)
|
|
222
133
|
return unfound();
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
134
|
+
if (read.status !== 200)
|
|
135
|
+
return answeredFailure(read.status, null);
|
|
136
|
+
if (read.body === null)
|
|
137
|
+
return unusable();
|
|
138
|
+
return { kind: 'binary', body: read.body, mediaType: read.mediaType };
|
|
226
139
|
},
|
|
227
140
|
async link(_authorization, request) {
|
|
141
|
+
if (request.kind === 'key')
|
|
142
|
+
return unfound();
|
|
228
143
|
const route = fileRoute(request);
|
|
229
144
|
if (typeof route !== 'string')
|
|
230
145
|
return route;
|
|
@@ -234,13 +149,6 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
234
149
|
name: request.path.slice(request.path.lastIndexOf('/') + 1),
|
|
235
150
|
};
|
|
236
151
|
},
|
|
237
|
-
referrerScope(referrer) {
|
|
238
|
-
const named = published(referrer);
|
|
239
|
-
if (named === null)
|
|
240
|
-
return null;
|
|
241
|
-
const { path } = named.referrer;
|
|
242
|
-
return { kind: 'room', locator: named.locator, ...(path === undefined ? {} : { path }) };
|
|
243
|
-
},
|
|
244
152
|
reached(locator, version, target) {
|
|
245
153
|
return reachedVersion(version, target, tracked.get(locator)?.logEpoch);
|
|
246
154
|
},
|
|
@@ -248,7 +156,10 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
248
156
|
return followsVersion(version, next);
|
|
249
157
|
},
|
|
250
158
|
async action(_authorization, request) {
|
|
251
|
-
|
|
159
|
+
const route = Object.hasOwn(SITE_DOOR_ACTS, request.name)
|
|
160
|
+
? SITE_DOOR_ACTS[request.name]
|
|
161
|
+
: null;
|
|
162
|
+
if (route === null) {
|
|
252
163
|
return {
|
|
253
164
|
kind: 'rejected',
|
|
254
165
|
code: 'action-unimplemented',
|
|
@@ -257,29 +168,14 @@ export function createSiteAdapter(transport, snapshot = false) {
|
|
|
257
168
|
};
|
|
258
169
|
}
|
|
259
170
|
if (!transport.online())
|
|
260
|
-
return
|
|
261
|
-
return actionOutcome(await transport.door(
|
|
171
|
+
return UNANSWERED;
|
|
172
|
+
return actionOutcome(await transport.door(route, request.input), request.name, request.input);
|
|
262
173
|
},
|
|
263
174
|
roomStream: snapshot
|
|
264
175
|
? undefined
|
|
265
176
|
: {
|
|
266
|
-
hold
|
|
267
|
-
notifications.send(rooms.flatMap((room) => {
|
|
268
|
-
const entry = tracked.get(room.locator);
|
|
269
|
-
const at = logPosition(room.roomVersion);
|
|
270
|
-
if (entry === undefined || at === null)
|
|
271
|
-
return [];
|
|
272
|
-
notifications.reach(entry.authority, at);
|
|
273
|
-
return [presented(entry.authority, at)];
|
|
274
|
-
}));
|
|
275
|
-
},
|
|
276
|
-
reopen: notifications.reopen,
|
|
177
|
+
hold: notifications.send,
|
|
277
178
|
observe: notifications.observe,
|
|
278
|
-
published(locator, roomVersion) {
|
|
279
|
-
const at = logPosition(roomVersion);
|
|
280
|
-
if (at !== null)
|
|
281
|
-
notifications.published(locator, at);
|
|
282
|
-
},
|
|
283
179
|
},
|
|
284
180
|
serviceMode: notifications.serviceMode,
|
|
285
181
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type SpaceSchemas = {
|
|
2
|
+
held(space: string, revision: string): string | undefined;
|
|
3
|
+
keep(space: string, revision: string, text: string): void;
|
|
4
|
+
};
|
|
5
|
+
export declare function spaceSchemas(): SpaceSchemas;
|
|
6
|
+
export declare function spaceIdentity(space: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space-schema.d.ts","sourceRoot":"","sources":["../src/space-schema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC1D,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3D,CAAC;AAEF,wBAAgB,YAAY,IAAI,YAAY,CAO3C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function spaceSchemas() {
|
|
2
|
+
const texts = new Map();
|
|
3
|
+
const key = (space, revision) => `${space} ${revision}`;
|
|
4
|
+
return {
|
|
5
|
+
held: (space, revision) => texts.get(key(space, revision)),
|
|
6
|
+
keep: (space, revision, text) => void texts.set(key(space, revision), text),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function spaceIdentity(space) {
|
|
10
|
+
return `space:${space}`;
|
|
11
|
+
}
|
package/dist/stream.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type AuthorityChange, type Discovery, type ConversationStream, type HeldRoom, type RoomStreamEvent, type ServiceModeSignal } from '@agentshouse/mdruntime';
|
|
2
2
|
import type { TrackedAuthority } from './discovery.js';
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { type HouseDoor, type HouseMode, type HouseStreamFrame } from './transport.js';
|
|
4
|
+
export type HouseOpeningFrame = Extract<HouseStreamFrame, {
|
|
5
|
+
type: 'opening';
|
|
6
|
+
}>;
|
|
7
|
+
export type HouseAuthorityChangedFrame = Extract<HouseStreamFrame, {
|
|
8
|
+
type: 'authority_changed';
|
|
9
|
+
}>;
|
|
10
|
+
export type HouseDiscovering = {
|
|
11
|
+
opened(frame: HouseOpeningFrame | null): Promise<Discovery | null>;
|
|
12
|
+
changed(frame: HouseAuthorityChangedFrame): AuthorityChange | null;
|
|
13
|
+
expired?(entries: readonly TrackedAuthority[]): void;
|
|
9
14
|
};
|
|
10
15
|
export type HouseNotifications = {
|
|
11
16
|
runtime: string;
|
|
12
|
-
observe(notify: (event: RoomStreamEvent) => void
|
|
13
|
-
send(rooms: readonly
|
|
14
|
-
published(locator: string, at: LogPosition): void;
|
|
15
|
-
reopen(): void;
|
|
17
|
+
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
18
|
+
send(rooms: readonly HeldRoom[]): void;
|
|
16
19
|
track(authorities: readonly TrackedAuthority[]): void;
|
|
17
|
-
reach(authority: string, at: LogPosition): void;
|
|
18
|
-
advance(tracked: TrackedAuthority, from: LogPosition, holds?: HeldRevision): Generator<number, StreamedAdvancement | null, void>;
|
|
19
20
|
conversations: ConversationStream;
|
|
20
21
|
serviceMode: ServiceModeSignal;
|
|
21
22
|
};
|
|
22
|
-
export declare function houseNotifications(transport: HouseDoor, mode: HouseMode): HouseNotifications;
|
|
23
|
-
//# sourceMappingURL=stream.d.ts.map
|
|
23
|
+
export declare function houseNotifications(transport: HouseDoor, mode: HouseMode, discovering: HouseDiscovering): HouseNotifications;
|
package/dist/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EAEvB,KAAK,
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EAEpB,KAAK,SAAS,EACd,KAAK,kBAAkB,EAEvB,KAAK,QAAQ,EAGb,KAAK,eAAe,EAEpB,KAAK,iBAAiB,EAEvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAYvD,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,SAAS,EAGd,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAaxB,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAE/E,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAAC;AAElG,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACnE,OAAO,CAAC,KAAK,EAAE,0BAA0B,GAAG,eAAe,GAAG,IAAI,CAAC;IACnE,OAAO,CAAC,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC9D,IAAI,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,IAAI,CAAC;IACvC,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAyFF,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,gBAAgB,GAC5B,kBAAkB,CA6XpB"}
|