@agentshouse/mdruntime-adapter 0.1.0-cb89e0425af50 → 0.1.0-cb8fc491b1a92
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 +162 -3
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +52 -172
- package/dist/adapter.d.ts +1 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +265 -216
- package/dist/app-reference.d.ts +2 -0
- package/dist/app-reference.d.ts.map +1 -0
- package/dist/app-reference.js +2 -0
- package/dist/crockford.d.ts +4 -0
- package/dist/crockford.d.ts.map +1 -0
- package/dist/crockford.js +3 -0
- package/dist/discovery.d.ts +7 -10
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +40 -40
- package/dist/house-model.d.ts +2983 -0
- package/dist/house-model.d.ts.map +1 -0
- package/dist/house-model.js +1643 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/model.d.ts +5 -3
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +10 -32
- package/dist/part.d.ts +14 -0
- package/dist/part.d.ts.map +1 -0
- package/dist/part.js +90 -0
- package/dist/read.d.ts +50 -45
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +243 -242
- package/dist/refusal.d.ts +0 -3
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +2 -6
- package/dist/room-stream.d.ts +19 -0
- package/dist/room-stream.d.ts.map +1 -0
- package/dist/room-stream.js +57 -0
- package/dist/room-types.d.ts +7 -0
- package/dist/room-types.d.ts.map +1 -0
- package/dist/room-types.js +126 -0
- package/dist/site.d.ts +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +101 -90
- package/dist/stream.d.ts +2 -11
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +139 -140
- package/dist/transport.d.ts +70 -22
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +50 -9
- package/dist/upload.d.ts +12 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +63 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/write.d.ts +17 -9
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +138 -43
- package/package.json +8 -5
- package/AGENTS.md +0 -269
- package/dist/gather.d.ts +0 -4
- package/dist/gather.d.ts.map +0 -1
- package/dist/gather.js +0 -45
- package/dist/links.d.ts +0 -20
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js +0 -104
package/dist/discovery.d.ts
CHANGED
|
@@ -13,27 +13,25 @@ export type HouseBounds = {
|
|
|
13
13
|
max_inline_body_bytes: number;
|
|
14
14
|
max_upload_bytes: number;
|
|
15
15
|
max_prefixes: number;
|
|
16
|
+
max_held_files: number;
|
|
16
17
|
change_retention_seconds: number;
|
|
17
18
|
operation_retention_seconds: number;
|
|
19
|
+
max_move_documents?: number;
|
|
18
20
|
};
|
|
19
21
|
export type HouseOperations = {
|
|
20
|
-
read: readonly string[];
|
|
21
|
-
sync: readonly string[];
|
|
22
22
|
write: readonly string[];
|
|
23
23
|
delete: readonly string[];
|
|
24
24
|
};
|
|
25
|
-
export type
|
|
26
|
-
root: string;
|
|
27
|
-
paths: readonly string[];
|
|
28
|
-
};
|
|
25
|
+
export type HouseAccessLevel = 'search' | 'open' | 'keep';
|
|
29
26
|
export type HouseAuthority = LogPosition & {
|
|
30
27
|
roomRef: string;
|
|
31
28
|
roomHandle: string;
|
|
32
29
|
name: string;
|
|
33
30
|
schema: string;
|
|
34
|
-
|
|
31
|
+
typedSelection: readonly string[] | null;
|
|
35
32
|
managedReplication: 'admitted' | 'unavailable';
|
|
36
33
|
protectedPaths: readonly string[];
|
|
34
|
+
level: HouseAccessLevel;
|
|
37
35
|
operations: HouseOperations;
|
|
38
36
|
};
|
|
39
37
|
export type HouseDiscoveryDocument = {
|
|
@@ -47,8 +45,7 @@ export type TrackedAuthority = LogPosition & {
|
|
|
47
45
|
authority: string;
|
|
48
46
|
handle: string;
|
|
49
47
|
schema: string;
|
|
50
|
-
|
|
51
|
-
schemas: readonly string[];
|
|
48
|
+
typedSelection: readonly string[] | null;
|
|
52
49
|
};
|
|
53
50
|
export type HouseSiteAuthority = LogPosition & {
|
|
54
51
|
roomRef: string;
|
|
@@ -65,7 +62,7 @@ export declare function siteTracked(document: HouseSiteDiscovery): TrackedAuthor
|
|
|
65
62
|
export declare function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[];
|
|
66
63
|
export declare function providerLimits(bounds: HouseBounds): readonly ProviderLimit[];
|
|
67
64
|
export declare function declaredRetention(bounds: HouseBounds): Retention;
|
|
68
|
-
export declare function capabilities(
|
|
65
|
+
export declare function capabilities(actions: HouseDiscoveryDocument['actions']): readonly Capability[];
|
|
69
66
|
export declare function siteCapabilities(): readonly Capability[];
|
|
70
67
|
export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
|
|
71
68
|
export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
|
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,MAAM,EACN,aAAa,EACb,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAU,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB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EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAa3E;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,gBAAgB,EAAE,CAU5E;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,sBAAsB,GAAG,gBAAgB,EAAE,CAUhF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,aAAa,EAAE,CAa5E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAMhE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,sBAAsB,CAAC,SAAS,CAAC,GAAG,SAAS,UAAU,EAAE,CAE9F;AAED,wBAAgB,gBAAgB,IAAI,SAAS,UAAU,EAAE,CAOxD;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAqBxE;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,4 +1,4 @@
|
|
|
1
|
-
import { declaredActions,
|
|
1
|
+
import { declaredActions, SITE_SUBMIT } from './actions.js';
|
|
2
2
|
import { readPosition, roomVersion } from './version.js';
|
|
3
3
|
export const PROVIDER_ACTIONS = 'provider-actions';
|
|
4
4
|
export const DISCOVER_PREFIXES = ['/'];
|
|
@@ -13,10 +13,12 @@ const BOUND_KEYS = [
|
|
|
13
13
|
'max_inline_body_bytes',
|
|
14
14
|
'max_upload_bytes',
|
|
15
15
|
'max_prefixes',
|
|
16
|
+
'max_held_files',
|
|
16
17
|
'change_retention_seconds',
|
|
17
18
|
'operation_retention_seconds',
|
|
18
19
|
];
|
|
19
|
-
const OPERATION_KEYS = ['
|
|
20
|
+
const OPERATION_KEYS = ['write', 'delete'];
|
|
21
|
+
const ACCESS_LEVELS = ['search', 'open', 'keep'];
|
|
20
22
|
function stringList(value) {
|
|
21
23
|
if (!Array.isArray(value))
|
|
22
24
|
return null;
|
|
@@ -33,18 +35,18 @@ function parseBounds(value) {
|
|
|
33
35
|
return null;
|
|
34
36
|
bounds[key] = amount;
|
|
35
37
|
}
|
|
38
|
+
const moves = held.max_move_documents;
|
|
39
|
+
if (moves !== undefined) {
|
|
40
|
+
if (typeof moves !== 'number' || !Number.isFinite(moves))
|
|
41
|
+
return null;
|
|
42
|
+
bounds.max_move_documents = moves;
|
|
43
|
+
}
|
|
36
44
|
return bounds;
|
|
37
45
|
}
|
|
38
|
-
function
|
|
46
|
+
function parseTypedSelection(value) {
|
|
39
47
|
if (value === undefined)
|
|
40
48
|
return null;
|
|
41
|
-
|
|
42
|
-
return undefined;
|
|
43
|
-
const held = value;
|
|
44
|
-
const paths = stringList(held.paths);
|
|
45
|
-
if (typeof held.root !== 'string' || held.root.length === 0 || paths === null)
|
|
46
|
-
return undefined;
|
|
47
|
-
return { root: held.root, paths };
|
|
49
|
+
return stringList(value) ?? undefined;
|
|
48
50
|
}
|
|
49
51
|
function parseMember(value) {
|
|
50
52
|
if (typeof value !== 'object' || value === null)
|
|
@@ -81,10 +83,15 @@ function parseAuthority(value) {
|
|
|
81
83
|
return null;
|
|
82
84
|
}
|
|
83
85
|
const at = readPosition(held);
|
|
84
|
-
const
|
|
86
|
+
const typedSelection = parseTypedSelection(held.typed_selection);
|
|
85
87
|
const protectedPaths = stringList(held.protected_paths);
|
|
86
88
|
const operations = parseOperations(held.operations);
|
|
87
|
-
|
|
89
|
+
const level = ACCESS_LEVELS.find((one) => one === held.level);
|
|
90
|
+
if (at === null ||
|
|
91
|
+
typedSelection === undefined ||
|
|
92
|
+
protectedPaths === null ||
|
|
93
|
+
level === undefined ||
|
|
94
|
+
operations === null)
|
|
88
95
|
return null;
|
|
89
96
|
if (typeof held.room_ref !== 'string' || held.room_ref.length === 0)
|
|
90
97
|
return null;
|
|
@@ -95,9 +102,10 @@ function parseAuthority(value) {
|
|
|
95
102
|
roomHandle: held.room_handle,
|
|
96
103
|
name: held.name,
|
|
97
104
|
schema: held.model_root,
|
|
98
|
-
|
|
105
|
+
typedSelection,
|
|
99
106
|
managedReplication: held.managed_replication,
|
|
100
107
|
protectedPaths,
|
|
108
|
+
level,
|
|
101
109
|
operations,
|
|
102
110
|
...at,
|
|
103
111
|
};
|
|
@@ -174,25 +182,18 @@ export function siteTracked(document) {
|
|
|
174
182
|
authority: authority.roomRef,
|
|
175
183
|
handle: authority.roomHandle,
|
|
176
184
|
schema: authority.schema,
|
|
177
|
-
|
|
178
|
-
schemas: [authority.schema],
|
|
185
|
+
typedSelection: null,
|
|
179
186
|
position: authority.position,
|
|
180
187
|
logEpoch: authority.logEpoch,
|
|
181
188
|
}));
|
|
182
189
|
}
|
|
183
|
-
function schemasOf(authority) {
|
|
184
|
-
return authority.houseModel === null
|
|
185
|
-
? [authority.schema]
|
|
186
|
-
: [authority.schema, authority.houseModel.root];
|
|
187
|
-
}
|
|
188
190
|
export function trackedFrom(document) {
|
|
189
191
|
return document.authorities.map((authority) => ({
|
|
190
192
|
locator: authority.roomRef,
|
|
191
193
|
authority: authority.roomRef,
|
|
192
194
|
handle: authority.roomHandle,
|
|
193
195
|
schema: authority.schema,
|
|
194
|
-
|
|
195
|
-
schemas: schemasOf(authority),
|
|
196
|
+
typedSelection: authority.typedSelection,
|
|
196
197
|
position: authority.position,
|
|
197
198
|
logEpoch: authority.logEpoch,
|
|
198
199
|
}));
|
|
@@ -204,8 +205,11 @@ export function providerLimits(bounds) {
|
|
|
204
205
|
{ name: 'change-documents', value: bounds.max_batch_documents },
|
|
205
206
|
{ name: 'path-length', value: bounds.max_path_length },
|
|
206
207
|
{ name: 'path-depth', value: bounds.max_path_depth },
|
|
208
|
+
...(bounds.max_move_documents === undefined
|
|
209
|
+
? []
|
|
210
|
+
: [{ name: 'move-documents', value: bounds.max_move_documents }]),
|
|
207
211
|
{ name: 'write-rate' },
|
|
208
|
-
{ name: '
|
|
212
|
+
{ name: 'storage-limit' },
|
|
209
213
|
];
|
|
210
214
|
}
|
|
211
215
|
export function declaredRetention(bounds) {
|
|
@@ -215,23 +219,17 @@ export function declaredRetention(bounds) {
|
|
|
215
219
|
refreshHorizon: bounds.change_retention_seconds,
|
|
216
220
|
};
|
|
217
221
|
}
|
|
218
|
-
export function capabilities(
|
|
219
|
-
|
|
222
|
+
export function capabilities(actions) {
|
|
223
|
+
return [{ name: PROVIDER_ACTIONS, actions: declaredActions(actions) }];
|
|
224
|
+
}
|
|
225
|
+
export function siteCapabilities() {
|
|
220
226
|
return [
|
|
221
227
|
{
|
|
222
228
|
name: PROVIDER_ACTIONS,
|
|
223
|
-
actions:
|
|
224
|
-
...(house === undefined
|
|
225
|
-
? {}
|
|
226
|
-
: { conversationAgents: houseConversationAgents(house.roomRef) }),
|
|
229
|
+
actions: [{ name: SITE_SUBMIT, inputShape: {}, resultKind: 'house' }],
|
|
227
230
|
},
|
|
228
231
|
];
|
|
229
232
|
}
|
|
230
|
-
export function siteCapabilities() {
|
|
231
|
-
return [
|
|
232
|
-
{ name: PROVIDER_ACTIONS, actions: [{ name: 'submit', inputShape: {}, resultKind: 'house' }] },
|
|
233
|
-
];
|
|
234
|
-
}
|
|
235
233
|
export function discoveredRoom(authority) {
|
|
236
234
|
const locator = authority.roomRef;
|
|
237
235
|
return {
|
|
@@ -240,16 +238,18 @@ export function discoveredRoom(authority) {
|
|
|
240
238
|
handle: authority.roomHandle,
|
|
241
239
|
roomVersion: roomVersion(authority),
|
|
242
240
|
operations: {
|
|
243
|
-
read: [...authority.operations.read],
|
|
244
|
-
sync: [...authority.operations.sync],
|
|
245
241
|
write: [...authority.operations.write],
|
|
246
242
|
delete: [...authority.operations.delete],
|
|
247
243
|
},
|
|
248
|
-
replica: {
|
|
249
|
-
|
|
244
|
+
replica: {
|
|
245
|
+
selection: locator,
|
|
246
|
+
admission: authority.managedReplication,
|
|
247
|
+
offline: authority.level === 'open' ? 'locked' : 'open',
|
|
248
|
+
},
|
|
249
|
+
...(authority.typedSelection === null
|
|
250
250
|
? {}
|
|
251
|
-
: { typedSelection: { roots: [...authority.
|
|
252
|
-
providerOwnedPaths: [...authority.protectedPaths,
|
|
251
|
+
: { typedSelection: { roots: [...authority.typedSelection] } }),
|
|
252
|
+
providerOwnedPaths: [...authority.protectedPaths, authority.schema],
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
255
|
export function mapDiscovery(document, rooms, declared) {
|