@agentshouse/mdruntime-adapter 0.1.0-c6ddfd288ac81 → 0.1.0-c736fea18a3c2
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/AGENTS.md +279 -181
- package/README.md +3 -3
- package/dist/actions.d.ts +63 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +156 -138
- package/dist/adapter.d.ts +1 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +347 -166
- package/dist/discovery.d.ts +15 -27
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +57 -102
- package/dist/gather.d.ts +1 -0
- package/dist/gather.d.ts.map +1 -1
- package/dist/gather.js +11 -6
- package/dist/handed.d.ts +15 -0
- package/dist/handed.d.ts.map +1 -0
- package/dist/handed.js +38 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/model.d.ts +7 -18
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +60 -39
- package/dist/read.d.ts +38 -11
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +166 -106
- package/dist/referrer.d.ts +7 -0
- package/dist/referrer.d.ts.map +1 -0
- package/dist/referrer.js +35 -0
- package/dist/refusal.d.ts +5 -7
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +31 -31
- package/dist/site.d.ts +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +209 -106
- package/dist/stream.d.ts +12 -4
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +442 -105
- package/dist/transport.d.ts +89 -23
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +3 -2
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +10 -1
- package/dist/write.d.ts +4 -5
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +103 -26
- package/package.json +3 -4
- package/dist/links.d.ts +0 -11
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js +0 -51
package/dist/discovery.d.ts
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import type { Capability, DiscoveredRoom, Discovery, ProviderLimit, Retention
|
|
1
|
+
import type { Capability, DiscoveredRoom, Discovery, Member, ProviderLimit, Retention } from '@agentshouse/mdruntime';
|
|
2
2
|
import { type LogPosition } from './version.js';
|
|
3
|
-
export declare const ROOM_CONTRACT_VERSION = 1;
|
|
4
|
-
export declare const MD_MODEL_IDENTITY = "@agentshouse/mdmodel";
|
|
5
|
-
export declare const ROOM_VERSION_NOTIFICATIONS = "room-version-notifications";
|
|
6
3
|
export declare const PROVIDER_ACTIONS = "provider-actions";
|
|
7
|
-
export declare const MOVE_REFERENCE_REWRITES = "move-reference-rewrites";
|
|
8
4
|
export declare const DISCOVER_PREFIXES: readonly string[];
|
|
9
|
-
export declare const PROVIDER_SELECTION_ROOTS: readonly string[];
|
|
10
|
-
export declare const UNTYPED_FOLDERS: readonly string[];
|
|
11
|
-
export declare const RESERVED_NAMES: readonly string[];
|
|
12
|
-
export declare const HOUSE_SCHEMA = "house/schema.yaml";
|
|
13
|
-
export declare const PRIVATE_HANDLE = "private";
|
|
14
5
|
export type HouseBounds = {
|
|
15
6
|
max_authored_file_bytes: number;
|
|
16
7
|
max_batch_operations: number;
|
|
@@ -19,6 +10,10 @@ export type HouseBounds = {
|
|
|
19
10
|
max_path_depth: number;
|
|
20
11
|
max_mount_files: number;
|
|
21
12
|
max_mount_bytes: number;
|
|
13
|
+
max_inline_body_bytes: number;
|
|
14
|
+
max_upload_bytes: number;
|
|
15
|
+
max_prefixes: number;
|
|
16
|
+
max_held_files: number;
|
|
22
17
|
change_retention_seconds: number;
|
|
23
18
|
operation_retention_seconds: number;
|
|
24
19
|
};
|
|
@@ -28,18 +23,23 @@ export type HouseOperations = {
|
|
|
28
23
|
write: readonly string[];
|
|
29
24
|
delete: readonly string[];
|
|
30
25
|
};
|
|
26
|
+
export type HouseModel = {
|
|
27
|
+
root: string;
|
|
28
|
+
paths: readonly string[];
|
|
29
|
+
};
|
|
31
30
|
export type HouseAuthority = LogPosition & {
|
|
32
31
|
roomRef: string;
|
|
33
32
|
roomHandle: string;
|
|
34
33
|
name: string;
|
|
35
34
|
schema: string;
|
|
35
|
+
houseModel: HouseModel | null;
|
|
36
36
|
managedReplication: 'admitted' | 'unavailable';
|
|
37
37
|
protectedPaths: readonly string[];
|
|
38
38
|
operations: HouseOperations;
|
|
39
39
|
};
|
|
40
40
|
export type HouseDiscoveryDocument = {
|
|
41
|
+
member: Member;
|
|
41
42
|
bounds: HouseBounds;
|
|
42
|
-
mdModelVersion: string;
|
|
43
43
|
authorities: readonly HouseAuthority[];
|
|
44
44
|
actions: readonly string[];
|
|
45
45
|
};
|
|
@@ -48,16 +48,9 @@ export type TrackedAuthority = LogPosition & {
|
|
|
48
48
|
authority: string;
|
|
49
49
|
handle: string;
|
|
50
50
|
schema: string;
|
|
51
|
+
houseModel: HouseModel | null;
|
|
51
52
|
schemas: readonly string[];
|
|
52
53
|
};
|
|
53
|
-
export type HouseSiteEntry = {
|
|
54
|
-
roomRef: string;
|
|
55
|
-
segment: string;
|
|
56
|
-
};
|
|
57
|
-
export type HouseSiteSlot = {
|
|
58
|
-
slot: string;
|
|
59
|
-
entries: readonly HouseSiteEntry[];
|
|
60
|
-
};
|
|
61
54
|
export type HouseSiteAuthority = LogPosition & {
|
|
62
55
|
roomRef: string;
|
|
63
56
|
roomHandle: string;
|
|
@@ -65,21 +58,16 @@ export type HouseSiteAuthority = LogPosition & {
|
|
|
65
58
|
};
|
|
66
59
|
export type HouseSiteDiscovery = {
|
|
67
60
|
bounds: HouseBounds;
|
|
68
|
-
mdModelVersion: string;
|
|
69
|
-
slots: readonly HouseSiteSlot[];
|
|
70
61
|
authorities: readonly HouseSiteAuthority[];
|
|
71
62
|
};
|
|
72
63
|
export declare function parseDiscovery(body: unknown): HouseDiscoveryDocument | null;
|
|
73
64
|
export declare function parseSiteDiscovery(body: unknown): HouseSiteDiscovery | null;
|
|
74
65
|
export declare function siteTracked(document: HouseSiteDiscovery): TrackedAuthority[];
|
|
75
|
-
export declare function siteSlots(document: HouseSiteDiscovery): Discovery['slots'];
|
|
76
|
-
export declare function locatorOf(authority: HouseAuthority): string;
|
|
77
66
|
export declare function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[];
|
|
78
67
|
export declare function providerLimits(bounds: HouseBounds): readonly ProviderLimit[];
|
|
79
68
|
export declare function declaredRetention(bounds: HouseBounds): Retention;
|
|
80
|
-
export declare function capabilities(
|
|
69
|
+
export declare function capabilities(document: HouseDiscoveryDocument): readonly Capability[];
|
|
81
70
|
export declare function siteCapabilities(): readonly Capability[];
|
|
82
|
-
export declare function
|
|
83
|
-
export declare function
|
|
84
|
-
export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds' | 'mdModelVersion'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
|
|
71
|
+
export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
|
|
72
|
+
export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
|
|
85
73
|
//# sourceMappingURL=discovery.d.ts.map
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,SAAS,
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACT,MAAM,EACN,aAAa,EACb,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,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,wBAAgB,gBAAgB,IAAI,SAAS,UAAU,EAAE,CAOxD;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAmBxE;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,EAChD,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAC9B,SAAS,CAQX"}
|
package/dist/discovery.js
CHANGED
|
@@ -1,35 +1,7 @@
|
|
|
1
|
-
import { declaredActions,
|
|
2
|
-
import { PRIVATE_LOCATOR } from './transport.js';
|
|
1
|
+
import { declaredActions, houseConversationAgents, SITE_SUBMIT } from './actions.js';
|
|
3
2
|
import { readPosition, roomVersion } from './version.js';
|
|
4
|
-
export const ROOM_CONTRACT_VERSION = 1;
|
|
5
|
-
export const MD_MODEL_IDENTITY = '@agentshouse/mdmodel';
|
|
6
|
-
export const ROOM_VERSION_NOTIFICATIONS = 'room-version-notifications';
|
|
7
3
|
export const PROVIDER_ACTIONS = 'provider-actions';
|
|
8
|
-
export const MOVE_REFERENCE_REWRITES = 'move-reference-rewrites';
|
|
9
4
|
export const DISCOVER_PREFIXES = ['/'];
|
|
10
|
-
export const PROVIDER_SELECTION_ROOTS = [
|
|
11
|
-
'agents',
|
|
12
|
-
'collaboration/routines',
|
|
13
|
-
'house',
|
|
14
|
-
'settings/apps',
|
|
15
|
-
'settings/panel.md',
|
|
16
|
-
];
|
|
17
|
-
export const UNTYPED_FOLDERS = ['capture'];
|
|
18
|
-
export const RESERVED_NAMES = [
|
|
19
|
-
'ROOM.md',
|
|
20
|
-
'capture',
|
|
21
|
-
'settings',
|
|
22
|
-
'collaboration',
|
|
23
|
-
'rooms',
|
|
24
|
-
'agents',
|
|
25
|
-
'house',
|
|
26
|
-
'work',
|
|
27
|
-
'entities',
|
|
28
|
-
'schema',
|
|
29
|
-
'commitments',
|
|
30
|
-
];
|
|
31
|
-
export const HOUSE_SCHEMA = 'house/schema.yaml';
|
|
32
|
-
export const PRIVATE_HANDLE = 'private';
|
|
33
5
|
const BOUND_KEYS = [
|
|
34
6
|
'max_authored_file_bytes',
|
|
35
7
|
'max_batch_operations',
|
|
@@ -38,6 +10,10 @@ const BOUND_KEYS = [
|
|
|
38
10
|
'max_path_depth',
|
|
39
11
|
'max_mount_files',
|
|
40
12
|
'max_mount_bytes',
|
|
13
|
+
'max_inline_body_bytes',
|
|
14
|
+
'max_upload_bytes',
|
|
15
|
+
'max_prefixes',
|
|
16
|
+
'max_held_files',
|
|
41
17
|
'change_retention_seconds',
|
|
42
18
|
'operation_retention_seconds',
|
|
43
19
|
];
|
|
@@ -60,6 +36,25 @@ function parseBounds(value) {
|
|
|
60
36
|
}
|
|
61
37
|
return bounds;
|
|
62
38
|
}
|
|
39
|
+
function parseHouseModel(value) {
|
|
40
|
+
if (value === undefined)
|
|
41
|
+
return null;
|
|
42
|
+
if (typeof value !== 'object' || value === null)
|
|
43
|
+
return undefined;
|
|
44
|
+
const held = value;
|
|
45
|
+
const paths = stringList(held.paths);
|
|
46
|
+
if (typeof held.root !== 'string' || held.root.length === 0 || paths === null)
|
|
47
|
+
return undefined;
|
|
48
|
+
return { root: held.root, paths };
|
|
49
|
+
}
|
|
50
|
+
function parseMember(value) {
|
|
51
|
+
if (typeof value !== 'object' || value === null)
|
|
52
|
+
return null;
|
|
53
|
+
const { user, name } = value;
|
|
54
|
+
if (typeof user !== 'string' || typeof name !== 'string')
|
|
55
|
+
return null;
|
|
56
|
+
return { kind: 'user', id: user, name };
|
|
57
|
+
}
|
|
63
58
|
function parseOperations(value) {
|
|
64
59
|
if (typeof value !== 'object' || value === null)
|
|
65
60
|
return null;
|
|
@@ -87,9 +82,10 @@ function parseAuthority(value) {
|
|
|
87
82
|
return null;
|
|
88
83
|
}
|
|
89
84
|
const at = readPosition(held);
|
|
85
|
+
const houseModel = parseHouseModel(held.house_model);
|
|
90
86
|
const protectedPaths = stringList(held.protected_paths);
|
|
91
87
|
const operations = parseOperations(held.operations);
|
|
92
|
-
if (at === null || protectedPaths === null || operations === null)
|
|
88
|
+
if (at === null || houseModel === undefined || protectedPaths === null || operations === null)
|
|
93
89
|
return null;
|
|
94
90
|
if (typeof held.room_ref !== 'string' || held.room_ref.length === 0)
|
|
95
91
|
return null;
|
|
@@ -100,6 +96,7 @@ function parseAuthority(value) {
|
|
|
100
96
|
roomHandle: held.room_handle,
|
|
101
97
|
name: held.name,
|
|
102
98
|
schema: held.model_root,
|
|
99
|
+
houseModel,
|
|
103
100
|
managedReplication: held.managed_replication,
|
|
104
101
|
protectedPaths,
|
|
105
102
|
operations,
|
|
@@ -110,11 +107,12 @@ export function parseDiscovery(body) {
|
|
|
110
107
|
if (typeof body !== 'object' || body === null)
|
|
111
108
|
return null;
|
|
112
109
|
const held = body;
|
|
110
|
+
const member = parseMember(held.member);
|
|
111
|
+
if (member === null)
|
|
112
|
+
return null;
|
|
113
113
|
const bounds = parseBounds(held.bounds);
|
|
114
114
|
if (bounds === null)
|
|
115
115
|
return null;
|
|
116
|
-
if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0)
|
|
117
|
-
return null;
|
|
118
116
|
const actions = stringList(held.actions);
|
|
119
117
|
if (actions === null ||
|
|
120
118
|
new Set(actions).size !== actions.length ||
|
|
@@ -129,34 +127,7 @@ export function parseDiscovery(body) {
|
|
|
129
127
|
return null;
|
|
130
128
|
authorities.push(authority);
|
|
131
129
|
}
|
|
132
|
-
return {
|
|
133
|
-
}
|
|
134
|
-
function parseSiteEntry(value) {
|
|
135
|
-
if (typeof value !== 'object' || value === null)
|
|
136
|
-
return null;
|
|
137
|
-
const held = value;
|
|
138
|
-
if (typeof held.room_ref !== 'string' || held.room_ref.length === 0)
|
|
139
|
-
return null;
|
|
140
|
-
if (typeof held.segment !== 'string' || held.segment.length === 0)
|
|
141
|
-
return null;
|
|
142
|
-
return { roomRef: held.room_ref, segment: held.segment };
|
|
143
|
-
}
|
|
144
|
-
function parseSiteSlot(value) {
|
|
145
|
-
if (typeof value !== 'object' || value === null)
|
|
146
|
-
return null;
|
|
147
|
-
const held = value;
|
|
148
|
-
if (typeof held.slot !== 'string' || held.slot.length === 0)
|
|
149
|
-
return null;
|
|
150
|
-
if (!Array.isArray(held.entries))
|
|
151
|
-
return null;
|
|
152
|
-
const entries = [];
|
|
153
|
-
for (const entry of held.entries) {
|
|
154
|
-
const parsed = parseSiteEntry(entry);
|
|
155
|
-
if (parsed === null)
|
|
156
|
-
return null;
|
|
157
|
-
entries.push(parsed);
|
|
158
|
-
}
|
|
159
|
-
return { slot: held.slot, entries };
|
|
130
|
+
return { member, bounds, authorities, actions };
|
|
160
131
|
}
|
|
161
132
|
function parseSiteAuthority(value) {
|
|
162
133
|
if (typeof value !== 'object' || value === null)
|
|
@@ -187,17 +158,8 @@ export function parseSiteDiscovery(body) {
|
|
|
187
158
|
const bounds = parseBounds(held.bounds);
|
|
188
159
|
if (bounds === null)
|
|
189
160
|
return null;
|
|
190
|
-
if (
|
|
191
|
-
return null;
|
|
192
|
-
if (!Array.isArray(held.slots) || !Array.isArray(held.authorities))
|
|
161
|
+
if (!Array.isArray(held.authorities))
|
|
193
162
|
return null;
|
|
194
|
-
const slots = [];
|
|
195
|
-
for (const entry of held.slots) {
|
|
196
|
-
const slot = parseSiteSlot(entry);
|
|
197
|
-
if (slot === null)
|
|
198
|
-
return null;
|
|
199
|
-
slots.push(slot);
|
|
200
|
-
}
|
|
201
163
|
const authorities = [];
|
|
202
164
|
for (const entry of held.authorities) {
|
|
203
165
|
const authority = parseSiteAuthority(entry);
|
|
@@ -205,7 +167,7 @@ export function parseSiteDiscovery(body) {
|
|
|
205
167
|
return null;
|
|
206
168
|
authorities.push(authority);
|
|
207
169
|
}
|
|
208
|
-
return { bounds,
|
|
170
|
+
return { bounds, authorities };
|
|
209
171
|
}
|
|
210
172
|
export function siteTracked(document) {
|
|
211
173
|
return document.authorities.map((authority) => ({
|
|
@@ -213,31 +175,24 @@ export function siteTracked(document) {
|
|
|
213
175
|
authority: authority.roomRef,
|
|
214
176
|
handle: authority.roomHandle,
|
|
215
177
|
schema: authority.schema,
|
|
178
|
+
houseModel: null,
|
|
216
179
|
schemas: [authority.schema],
|
|
217
180
|
position: authority.position,
|
|
218
181
|
logEpoch: authority.logEpoch,
|
|
219
182
|
}));
|
|
220
183
|
}
|
|
221
|
-
export function siteSlots(document) {
|
|
222
|
-
return document.slots.map(({ slot, entries }) => ({
|
|
223
|
-
slot,
|
|
224
|
-
entries: entries.map(({ roomRef, segment }) => ({ locator: roomRef, segment })),
|
|
225
|
-
}));
|
|
226
|
-
}
|
|
227
|
-
export function locatorOf(authority) {
|
|
228
|
-
return authority.roomHandle === PRIVATE_HANDLE ? PRIVATE_LOCATOR : authority.roomRef;
|
|
229
|
-
}
|
|
230
184
|
function schemasOf(authority) {
|
|
231
|
-
return authority.
|
|
232
|
-
? [authority.schema
|
|
233
|
-
: [authority.schema];
|
|
185
|
+
return authority.houseModel === null
|
|
186
|
+
? [authority.schema]
|
|
187
|
+
: [authority.schema, authority.houseModel.root];
|
|
234
188
|
}
|
|
235
189
|
export function trackedFrom(document) {
|
|
236
190
|
return document.authorities.map((authority) => ({
|
|
237
|
-
locator:
|
|
191
|
+
locator: authority.roomRef,
|
|
238
192
|
authority: authority.roomRef,
|
|
239
193
|
handle: authority.roomHandle,
|
|
240
194
|
schema: authority.schema,
|
|
195
|
+
houseModel: authority.houseModel,
|
|
241
196
|
schemas: schemasOf(authority),
|
|
242
197
|
position: authority.position,
|
|
243
198
|
logEpoch: authority.logEpoch,
|
|
@@ -261,30 +216,32 @@ export function declaredRetention(bounds) {
|
|
|
261
216
|
refreshHorizon: bounds.change_retention_seconds,
|
|
262
217
|
};
|
|
263
218
|
}
|
|
264
|
-
export function capabilities(
|
|
219
|
+
export function capabilities(document) {
|
|
220
|
+
const house = document.authorities.find((authority) => authority.houseModel !== null);
|
|
265
221
|
return [
|
|
266
|
-
{ name: ROOM_VERSION_NOTIFICATIONS },
|
|
267
222
|
{
|
|
268
223
|
name: PROVIDER_ACTIONS,
|
|
269
|
-
actions: declaredActions(actions),
|
|
270
|
-
|
|
224
|
+
actions: declaredActions(document.actions),
|
|
225
|
+
...(house === undefined
|
|
226
|
+
? {}
|
|
227
|
+
: { conversationAgents: houseConversationAgents(house.roomRef) }),
|
|
271
228
|
},
|
|
272
|
-
{ name: MOVE_REFERENCE_REWRITES },
|
|
273
229
|
];
|
|
274
230
|
}
|
|
275
231
|
export function siteCapabilities() {
|
|
276
232
|
return [
|
|
277
|
-
{
|
|
278
|
-
|
|
233
|
+
{
|
|
234
|
+
name: PROVIDER_ACTIONS,
|
|
235
|
+
actions: [{ name: SITE_SUBMIT, inputShape: {}, resultKind: 'house' }],
|
|
236
|
+
},
|
|
279
237
|
];
|
|
280
238
|
}
|
|
281
|
-
export function
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
export function discoveredRoom(authority, attachedModel, typedSelection) {
|
|
239
|
+
export function discoveredRoom(authority) {
|
|
240
|
+
const locator = authority.roomRef;
|
|
285
241
|
return {
|
|
286
242
|
name: authority.name,
|
|
287
|
-
locator
|
|
243
|
+
locator,
|
|
244
|
+
handle: authority.roomHandle,
|
|
288
245
|
roomVersion: roomVersion(authority),
|
|
289
246
|
operations: {
|
|
290
247
|
read: [...authority.operations.read],
|
|
@@ -292,18 +249,16 @@ export function discoveredRoom(authority, attachedModel, typedSelection) {
|
|
|
292
249
|
write: [...authority.operations.write],
|
|
293
250
|
delete: [...authority.operations.delete],
|
|
294
251
|
},
|
|
295
|
-
replica: { selection:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
252
|
+
replica: { selection: locator, admission: authority.managedReplication },
|
|
253
|
+
...(authority.houseModel === null
|
|
254
|
+
? {}
|
|
255
|
+
: { typedSelection: { roots: [...authority.houseModel.paths] } }),
|
|
299
256
|
providerOwnedPaths: [...authority.protectedPaths, ...schemasOf(authority)],
|
|
300
257
|
};
|
|
301
258
|
}
|
|
302
259
|
export function mapDiscovery(document, rooms, declared) {
|
|
303
260
|
return {
|
|
304
261
|
kind: 'discovery',
|
|
305
|
-
supportedVersions: [ROOM_CONTRACT_VERSION],
|
|
306
|
-
mdModel: { identity: MD_MODEL_IDENTITY, version: document.mdModelVersion },
|
|
307
262
|
rooms,
|
|
308
263
|
capabilities: declared,
|
|
309
264
|
providerLimits: providerLimits(document.bounds),
|
package/dist/gather.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare function gatheredEach<A, R>(send: (asks: readonly A[], answer: (ask: number, result: R) => void) => Promise<void>): (ask: A) => Promise<R>;
|
|
1
2
|
export declare function gathered<A, R>(send: (asks: readonly A[]) => Promise<readonly R[]>): (ask: A) => Promise<R>;
|
|
2
3
|
export declare function selections<T>(items: readonly T[], weight: (item: T) => number, limit: number): readonly (readonly T[])[];
|
|
3
4
|
//# sourceMappingURL=gather.d.ts.map
|
package/dist/gather.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"gather.d.ts","sourceRoot":"","sources":["../src/gather.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAC/B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GACpF,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAwBxB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClD,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAMxB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC3B,KAAK,EAAE,MAAM,GACZ,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAgB3B"}
|
package/dist/gather.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function gatheredEach(send) {
|
|
2
2
|
let held = [];
|
|
3
3
|
function flush() {
|
|
4
4
|
const taken = held;
|
|
5
5
|
held = [];
|
|
6
|
-
send(taken.map((entry) => entry.ask)
|
|
7
|
-
taken
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
}, (reason) => {
|
|
6
|
+
send(taken.map((entry) => entry.ask), (ask, result) => {
|
|
7
|
+
taken[ask]?.resolve(result);
|
|
8
|
+
}).catch((reason) => {
|
|
11
9
|
for (const entry of taken)
|
|
12
10
|
entry.reject(reason);
|
|
13
11
|
});
|
|
@@ -20,6 +18,13 @@ export function gathered(send) {
|
|
|
20
18
|
held.push({ ask, resolve, reject });
|
|
21
19
|
});
|
|
22
20
|
}
|
|
21
|
+
export function gathered(send) {
|
|
22
|
+
return gatheredEach(async (asks, answer) => {
|
|
23
|
+
(await send(asks)).forEach((result, ask) => {
|
|
24
|
+
answer(ask, result);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
23
28
|
export function selections(items, weight, limit) {
|
|
24
29
|
const parts = [];
|
|
25
30
|
let part = [];
|
package/dist/handed.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HeldRoom, MutationResult } from '@agentshouse/mdruntime';
|
|
2
|
+
import type { HouseScope, HouseView } from './read.js';
|
|
3
|
+
import type { StreamedAdvancement } from './stream.js';
|
|
4
|
+
export type HandedRoom = {
|
|
5
|
+
roomVersion: string;
|
|
6
|
+
revisions: ReadonlyMap<string, string>;
|
|
7
|
+
};
|
|
8
|
+
export declare function scopeHanded(scope: HouseScope): HandedRoom;
|
|
9
|
+
export declare function heldHanded(held: HeldRoom): HandedRoom;
|
|
10
|
+
export declare function acceptedHanded(held: HandedRoom, accepted: Extract<MutationResult, {
|
|
11
|
+
kind: 'accepted';
|
|
12
|
+
}>, roomVersion: string): HandedRoom;
|
|
13
|
+
export declare function enumeratedHanded(view: HouseView, earlier: HandedRoom | undefined): HandedRoom;
|
|
14
|
+
export declare function streamedHanded(held: HandedRoom, advanced: StreamedAdvancement): HandedRoom;
|
|
15
|
+
//# sourceMappingURL=handed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handed.d.ts","sourceRoot":"","sources":["../src/handed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CASzD;AAOD,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAErD;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EACvD,WAAW,EAAE,MAAM,GAClB,UAAU,CAKZ;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAM7F;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,GAAG,UAAU,CAM1F"}
|
package/dist/handed.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { roomVersion } from './version.js';
|
|
2
|
+
export function scopeHanded(scope) {
|
|
3
|
+
return {
|
|
4
|
+
roomVersion: roomVersion(scope),
|
|
5
|
+
revisions: new Map(scope.files.flatMap(({ path, revision }) => revision === undefined ? [] : [[path, revision]])),
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function revised(revisions, path, revision) {
|
|
9
|
+
if (revision === undefined)
|
|
10
|
+
revisions.delete(path);
|
|
11
|
+
else
|
|
12
|
+
revisions.set(path, revision);
|
|
13
|
+
}
|
|
14
|
+
export function heldHanded(held) {
|
|
15
|
+
return { roomVersion: held.roomVersion, revisions: new Map(Object.entries(held.revisions)) };
|
|
16
|
+
}
|
|
17
|
+
export function acceptedHanded(held, accepted, roomVersion) {
|
|
18
|
+
const revisions = new Map(held.revisions);
|
|
19
|
+
for (const [path, revision] of Object.entries(accepted.revisions))
|
|
20
|
+
revisions.set(path, revision);
|
|
21
|
+
for (const path of accepted.removals)
|
|
22
|
+
revisions.delete(path);
|
|
23
|
+
return { roomVersion, revisions };
|
|
24
|
+
}
|
|
25
|
+
export function enumeratedHanded(view, earlier) {
|
|
26
|
+
const revisions = new Map(earlier?.revisions);
|
|
27
|
+
for (const change of view.changes) {
|
|
28
|
+
revised(revisions, change.path, 'removed' in change ? undefined : change.revision);
|
|
29
|
+
}
|
|
30
|
+
return { roomVersion: roomVersion(view), revisions };
|
|
31
|
+
}
|
|
32
|
+
export function streamedHanded(held, advanced) {
|
|
33
|
+
const revisions = new Map(held.revisions);
|
|
34
|
+
for (const entry of advanced.entries) {
|
|
35
|
+
revised(revisions, entry.path, entry.kind === 'removed' ? undefined : entry.revision);
|
|
36
|
+
}
|
|
37
|
+
return { roomVersion: advanced.page.roomVersion, revisions };
|
|
38
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
|
|
2
|
-
export {
|
|
3
|
-
export type { HouseByteAct,
|
|
2
|
+
export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
|
|
3
|
+
export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDemand, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,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,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,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,2 +1,2 @@
|
|
|
1
1
|
export { createAgentsHouseAdapter } from './adapter.js';
|
|
2
|
-
export {
|
|
2
|
+
export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
|
package/dist/model.d.ts
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare
|
|
8
|
-
export declare function failedModel(failure: AdapterFailure | {
|
|
9
|
-
kind: 'beyond-horizon';
|
|
10
|
-
}): ModelResult;
|
|
11
|
-
export declare function modelKey(locator: string, attached: ModelRequest['attached']): string;
|
|
12
|
-
export declare function heldModel(read: HouseSchema | null, identity: string, failure: ModelResult): Promise<HeldModel>;
|
|
13
|
-
export type ModelShelf = {
|
|
14
|
-
retain(key: string, acquired: HeldModel | undefined): HeldModel | undefined;
|
|
15
|
-
answer(request: ModelRequest): ModelResult;
|
|
16
|
-
keep(locators: readonly string[]): void;
|
|
17
|
-
};
|
|
18
|
-
export declare function modelShelf(): ModelShelf;
|
|
1
|
+
import type { RoomModels } from '@agentshouse/mdruntime';
|
|
2
|
+
import type { TrackedAuthority } from './discovery.js';
|
|
3
|
+
import { type HouseScope, type HouseView } from './read.js';
|
|
4
|
+
import type { HouseMode, HouseStreamEntry } from './transport.js';
|
|
5
|
+
export declare function partModels(scope: HouseScope, tracked: TrackedAuthority, seen: ReadonlySet<string>, final: boolean): Promise<RoomModels | undefined>;
|
|
6
|
+
export declare function viewModels(view: HouseView, tracked: TrackedAuthority): Promise<RoomModels | undefined>;
|
|
7
|
+
export declare function streamedModels(schemas: ReadonlyMap<string, HouseStreamEntry>, tracked: TrackedAuthority, mode: HouseMode): Promise<RoomModels | undefined>;
|
|
19
8
|
//# sourceMappingURL=model.d.ts.map
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
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,EAA0C,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAoClE,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAKjC;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAcjC;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAWjC"}
|