@agentshouse/mdruntime-adapter 0.1.0-c4c8594e5b8d9 → 0.1.0-c4d6f3cc9ec0c
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 -67
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +26 -342
- package/dist/adapter.d.ts +1 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +302 -310
- 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 +45 -18
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +252 -66
- 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 +51 -53
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +176 -256
- 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 +1 -2
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +127 -193
- 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 +14 -14
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +267 -253
- package/dist/transport.d.ts +108 -30
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +89 -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 +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/write.d.ts +18 -4
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +123 -91
- package/package.json +9 -4
- package/AGENTS.md +0 -299
- package/dist/gather.d.ts +0 -4
- package/dist/gather.d.ts.map +0 -1
- package/dist/gather.js +0 -45
- package/dist/handed.d.ts +0 -15
- package/dist/handed.d.ts.map +0 -1
- package/dist/handed.js +0 -38
- 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,214 +1,153 @@
|
|
|
1
|
-
import {
|
|
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';
|
|
2
4
|
import { mapDiscovery, parseSiteDiscovery, siteCapabilities, siteTracked, } from './discovery.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
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';
|
|
7
8
|
import { houseNotifications } from './stream.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { followsVersion,
|
|
11
|
-
|
|
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';
|
|
12
|
+
function unfound() {
|
|
13
|
+
return { kind: 'rejected', code: 'not_found', fields: {}, retryable: false };
|
|
14
|
+
}
|
|
12
15
|
function siteRoom(tracked) {
|
|
13
16
|
return {
|
|
14
17
|
name: tracked.handle,
|
|
15
18
|
locator: tracked.locator,
|
|
16
19
|
handle: tracked.handle,
|
|
17
20
|
roomVersion: roomVersion(tracked),
|
|
18
|
-
operations: {
|
|
19
|
-
replica: { selection: tracked.locator, admission: 'admitted' },
|
|
21
|
+
operations: { write: [], erase: [] },
|
|
22
|
+
replica: { selection: tracked.locator, admission: 'admitted', offline: 'open' },
|
|
23
|
+
typedSelection: null,
|
|
20
24
|
providerOwnedPaths: [],
|
|
25
|
+
authoredPaths: ['**'],
|
|
21
26
|
};
|
|
22
27
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
export function createSiteAdapter(transport, snapshot = false) {
|
|
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
|
+
});
|
|
28
36
|
const tracked = new Map();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
const chunked = new Map();
|
|
38
|
+
function fileRoute(request) {
|
|
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)}`;
|
|
32
43
|
}
|
|
33
|
-
async function
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
async function bootstrapPart(entry, after, offset) {
|
|
43
|
-
const query = [
|
|
44
|
-
...(after === null ? [] : [`after=${encodeURIComponent(after)}`]),
|
|
45
|
-
...(offset === null ? [] : [`offset=${offset}`]),
|
|
46
|
-
];
|
|
47
|
-
const answer = await transport.read(`${SITE_DOOR_BOOTSTRAP}${entry.authority}${query.length === 0 ? '' : `?${query.join('&')}`}`);
|
|
48
|
-
const classified = classifyDoor(answer.status, answer.body, entry.locator);
|
|
49
|
-
if (classified !== null)
|
|
50
|
-
return { failure: classified };
|
|
51
|
-
const scope = parseSiteBootstrap(answer.body);
|
|
52
|
-
return scope === null ? { failure: UNCERTAIN } : { body: answer.body, scope };
|
|
53
|
-
}
|
|
54
|
-
async function assembled(entry, scope, path, offset) {
|
|
55
|
-
const opened = scope.contents.at(-1);
|
|
56
|
-
if (opened === undefined || opened.path !== path || opened.content.length !== offset) {
|
|
57
|
-
return UNCERTAIN;
|
|
58
|
-
}
|
|
59
|
-
let text = opened.content;
|
|
60
|
-
for (;;) {
|
|
61
|
-
const part = await bootstrapPart(entry, path, text.length);
|
|
62
|
-
if ('failure' in part)
|
|
63
|
-
return part.failure;
|
|
64
|
-
const [piece] = part.scope.contents;
|
|
65
|
-
if (piece === undefined ||
|
|
66
|
-
part.scope.contents.length !== 1 ||
|
|
67
|
-
piece.path !== path ||
|
|
68
|
-
piece.content.length === 0) {
|
|
69
|
-
return UNCERTAIN;
|
|
70
|
-
}
|
|
71
|
-
text += piece.content;
|
|
72
|
-
const more = siteBootstrapOffset(part.body);
|
|
73
|
-
if (more === null)
|
|
74
|
-
break;
|
|
75
|
-
if (more !== text.length)
|
|
76
|
-
return UNCERTAIN;
|
|
77
|
-
}
|
|
78
|
-
const file = scope.files.find((held) => held.path === path);
|
|
79
|
-
if (file === undefined || (await sha256Hex(text)) !== file.version)
|
|
80
|
-
return UNCERTAIN;
|
|
81
|
-
return { ...scope, contents: [...scope.contents.slice(0, -1), { path, content: text }] };
|
|
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;
|
|
82
53
|
}
|
|
83
|
-
async function
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const scope = await assembled(entry, part.scope, next, offset);
|
|
93
|
-
return 'kind' in scope ? { failure: scope } : { scope, next };
|
|
94
|
-
}
|
|
95
|
-
const { scope } = part;
|
|
96
|
-
if (after !== null || next !== null || roomVersion(scope) === roomVersion(entry)) {
|
|
97
|
-
return { scope, next };
|
|
98
|
-
}
|
|
99
|
-
const found = await enumeration(entry, scope);
|
|
100
|
-
if ('kind' in found)
|
|
101
|
-
return { failure: settled(found) };
|
|
102
|
-
const view = viewOf(found, entry);
|
|
103
|
-
if (view === undefined)
|
|
104
|
-
return { failure: { kind: 'room-not-readable', locator: entry.locator } };
|
|
105
|
-
return { scope: 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);
|
|
106
63
|
}
|
|
107
|
-
async function
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
+
};
|
|
128
85
|
}
|
|
129
86
|
return {
|
|
130
87
|
localSaves: true,
|
|
131
|
-
|
|
88
|
+
roomTypes: HOUSE_ROOM_TYPES,
|
|
89
|
+
typedPaths: HOUSE_TYPED_PATHS,
|
|
90
|
+
pathRule: admittedPath,
|
|
132
91
|
async authorize() {
|
|
133
92
|
return {};
|
|
134
93
|
},
|
|
135
|
-
async discover() {
|
|
136
|
-
const answer = await transport.read(SITE_DOOR_DISCOVER);
|
|
137
|
-
const failed = discoveryFailure(answer.status, answer.body);
|
|
138
|
-
if (failed !== null)
|
|
139
|
-
return failed;
|
|
140
|
-
const document = parseSiteDiscovery(answer.body);
|
|
141
|
-
if (document === null)
|
|
142
|
-
return UNCERTAIN;
|
|
143
|
-
const entries = siteTracked(document);
|
|
144
|
-
tracked.clear();
|
|
145
|
-
for (const entry of entries)
|
|
146
|
-
tracked.set(entry.locator, entry);
|
|
147
|
-
notifications.track(entries);
|
|
148
|
-
return mapDiscovery(document, entries.map(siteRoom), siteCapabilities());
|
|
149
|
-
},
|
|
150
94
|
async bootstrap(_authorization, request) {
|
|
151
95
|
const entry = tracked.get(request.locator);
|
|
152
96
|
if (entry === undefined)
|
|
153
97
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
154
|
-
|
|
155
|
-
?
|
|
156
|
-
:
|
|
157
|
-
const held = await caughtUp(entry, continued?.after ?? null);
|
|
158
|
-
if ('failure' in held)
|
|
159
|
-
return held.failure;
|
|
160
|
-
notifications.reach(entry.authority, held.scope);
|
|
161
|
-
const seen = [
|
|
162
|
-
...(continued?.seen ?? []),
|
|
163
|
-
...entry.schemas.filter((schema) => held.scope.files.some((file) => file.path === schema)),
|
|
164
|
-
];
|
|
165
|
-
const models = await partModels(held.scope, entry, new Set(seen), held.next === null);
|
|
166
|
-
const continuation = held.next === null ? null : { after: held.next, seen };
|
|
167
|
-
return {
|
|
168
|
-
...bootstrapOf(held.scope),
|
|
169
|
-
...(models === undefined ? {} : { models }),
|
|
170
|
-
...(continuation === null ? {} : { pageToken: JSON.stringify(continuation) }),
|
|
171
|
-
};
|
|
172
|
-
},
|
|
173
|
-
async refresh(_authorization, request) {
|
|
174
|
-
const entry = tracked.get(request.locator);
|
|
175
|
-
if (entry === undefined)
|
|
176
|
-
return { kind: 'room-not-readable', locator: request.locator };
|
|
177
|
-
if (request.pageToken !== undefined)
|
|
178
|
-
return UNCERTAIN;
|
|
179
|
-
return refreshed(entry, request.fromRoomVersion);
|
|
98
|
+
return request.pageToken === undefined
|
|
99
|
+
? listedRoom(entry)
|
|
100
|
+
: chunkPage(entry, request.pageToken, request.arriving);
|
|
180
101
|
},
|
|
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
|
+
},
|
|
115
|
+
}
|
|
116
|
+
: {}),
|
|
181
117
|
async mutate() {
|
|
182
118
|
return { kind: 'rejected', affected: {}, code: 'write-grant', fields: {}, retryable: false };
|
|
183
119
|
},
|
|
120
|
+
async attach() {
|
|
121
|
+
return { kind: 'rejected', code: 'write-grant', fields: {}, retryable: false };
|
|
122
|
+
},
|
|
184
123
|
async history() {
|
|
185
124
|
return { kind: 'no-history' };
|
|
186
125
|
},
|
|
126
|
+
queryHouse: snapshot ? undefined : (_authorization, request) => siteQuery(transport, request),
|
|
187
127
|
async binary(_authorization, request) {
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
return
|
|
191
|
-
|
|
192
|
-
if (
|
|
193
|
-
return
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (read.status === 404) {
|
|
200
|
-
return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
|
|
201
|
-
}
|
|
202
|
-
return read.status === 200 && read.blob !== null
|
|
203
|
-
? { kind: 'binary', blob: read.blob }
|
|
204
|
-
: UNCERTAIN;
|
|
128
|
+
const route = fileRoute(request);
|
|
129
|
+
if (typeof route !== 'string')
|
|
130
|
+
return route;
|
|
131
|
+
const read = await transport.download(route);
|
|
132
|
+
if (read.status === 404)
|
|
133
|
+
return unfound();
|
|
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 };
|
|
205
139
|
},
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
140
|
+
async link(_authorization, request) {
|
|
141
|
+
if (request.kind === 'key')
|
|
142
|
+
return unfound();
|
|
143
|
+
const route = fileRoute(request);
|
|
144
|
+
if (typeof route !== 'string')
|
|
145
|
+
return route;
|
|
146
|
+
return {
|
|
147
|
+
kind: 'link',
|
|
148
|
+
url: route,
|
|
149
|
+
name: request.path.slice(request.path.lastIndexOf('/') + 1),
|
|
150
|
+
};
|
|
212
151
|
},
|
|
213
152
|
reached(locator, version, target) {
|
|
214
153
|
return reachedVersion(version, target, tracked.get(locator)?.logEpoch);
|
|
@@ -217,7 +156,10 @@ export function createSiteAdapter(transport) {
|
|
|
217
156
|
return followsVersion(version, next);
|
|
218
157
|
},
|
|
219
158
|
async action(_authorization, request) {
|
|
220
|
-
|
|
159
|
+
const route = Object.hasOwn(SITE_DOOR_ACTS, request.name)
|
|
160
|
+
? SITE_DOOR_ACTS[request.name]
|
|
161
|
+
: null;
|
|
162
|
+
if (route === null) {
|
|
221
163
|
return {
|
|
222
164
|
kind: 'rejected',
|
|
223
165
|
code: 'action-unimplemented',
|
|
@@ -226,23 +168,15 @@ export function createSiteAdapter(transport) {
|
|
|
226
168
|
};
|
|
227
169
|
}
|
|
228
170
|
if (!transport.online())
|
|
229
|
-
return
|
|
230
|
-
return actionOutcome(await transport.door(
|
|
171
|
+
return UNANSWERED;
|
|
172
|
+
return actionOutcome(await transport.door(route, request.input), request.name, request.input);
|
|
231
173
|
},
|
|
232
|
-
roomStream:
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (entry === undefined || at === null)
|
|
238
|
-
return [];
|
|
239
|
-
notifications.reach(entry.authority, at);
|
|
240
|
-
return [presented(entry.authority, at)];
|
|
241
|
-
}));
|
|
174
|
+
roomStream: snapshot
|
|
175
|
+
? undefined
|
|
176
|
+
: {
|
|
177
|
+
hold: notifications.send,
|
|
178
|
+
observe: notifications.observe,
|
|
242
179
|
},
|
|
243
|
-
reopen: notifications.reopen,
|
|
244
|
-
observe: notifications.observe,
|
|
245
|
-
},
|
|
246
180
|
serviceMode: notifications.serviceMode,
|
|
247
181
|
};
|
|
248
182
|
}
|
|
@@ -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
|
-
|
|
9
|
-
|
|
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;
|
|
10
14
|
};
|
|
11
15
|
export type HouseNotifications = {
|
|
12
16
|
runtime: string;
|
|
13
17
|
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
14
|
-
send(rooms: readonly
|
|
15
|
-
reopen(): 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): StreamedAdvancement | null;
|
|
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,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,CAoYpB"}
|