@agentshouse/mdruntime-adapter 0.1.0-c674b14001ced → 0.1.0-c67edc489e9f6
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 +1 -1
- package/dist/actions.d.ts +3 -1
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +22 -6
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +73 -100
- package/dist/chunks.d.ts +38 -0
- package/dist/chunks.d.ts.map +1 -0
- package/dist/chunks.js +247 -0
- package/dist/discovery.d.ts +10 -3
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +34 -8
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +3 -2
- package/dist/house-model.d.ts +86 -359
- package/dist/house-model.d.ts.map +1 -1
- package/dist/house-model.js +81 -206
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/model.d.ts +5 -7
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +30 -18
- package/dist/read.d.ts +19 -13
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +46 -168
- package/dist/refusal.d.ts +1 -0
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +4 -0
- package/dist/room-types.d.ts +0 -2
- package/dist/room-types.d.ts.map +1 -1
- package/dist/room-types.js +6 -11
- package/dist/search.d.ts +5 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +47 -0
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +33 -41
- package/dist/space-schema.d.ts +7 -0
- package/dist/space-schema.d.ts.map +1 -0
- package/dist/space-schema.js +18 -0
- package/dist/stream.d.ts +6 -4
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +92 -24
- package/dist/transport.d.ts +11 -12
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +12 -12
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +4 -11
- package/package.json +2 -2
- 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/discovery.d.ts
CHANGED
|
@@ -12,14 +12,12 @@ export type HouseBounds = {
|
|
|
12
12
|
max_inline_body_bytes: number;
|
|
13
13
|
max_upload_bytes: number;
|
|
14
14
|
max_prefixes: number;
|
|
15
|
-
max_held_files: number;
|
|
16
15
|
change_retention_seconds: number;
|
|
17
|
-
operation_retention_seconds: number;
|
|
18
16
|
max_move_documents?: number;
|
|
19
17
|
};
|
|
20
18
|
export type HouseOperations = {
|
|
21
19
|
write: readonly string[];
|
|
22
|
-
|
|
20
|
+
erase: readonly string[];
|
|
23
21
|
};
|
|
24
22
|
export type HouseAccessLevel = 'search' | 'open' | 'keep';
|
|
25
23
|
export type HouseAuthority = LogPosition & {
|
|
@@ -60,6 +58,14 @@ export type HouseSiteDiscovery = {
|
|
|
60
58
|
bounds: HouseBounds;
|
|
61
59
|
authorities: readonly HouseSiteAuthority[];
|
|
62
60
|
};
|
|
61
|
+
type RoomOwn = 'room_ref' | 'room_handle' | 'name' | 'position';
|
|
62
|
+
type Folded<A extends Record<RoomOwn, unknown>> = {
|
|
63
|
+
readonly shapes: readonly Omit<A, RoomOwn>[];
|
|
64
|
+
readonly rooms: readonly (Pick<A, RoomOwn> & {
|
|
65
|
+
readonly shape: number;
|
|
66
|
+
})[];
|
|
67
|
+
};
|
|
68
|
+
export declare function foldedAuthorities<A extends Record<RoomOwn, unknown>>(authorities: readonly A[]): Folded<A>;
|
|
63
69
|
export declare function parseDiscovery(body: unknown): HouseDiscoveryDocument | null;
|
|
64
70
|
export declare function parseAuthorityChange(body: unknown): HouseAuthorityChange | null;
|
|
65
71
|
export declare function parseSiteDiscovery(body: unknown): HouseSiteDiscovery | null;
|
|
@@ -71,4 +77,5 @@ export declare function capabilities(actions: HouseDiscoveryDocument['actions'])
|
|
|
71
77
|
export declare function siteCapabilities(): readonly Capability[];
|
|
72
78
|
export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
|
|
73
79
|
export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]): Discovery;
|
|
80
|
+
export {};
|
|
74
81
|
//# 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,MAAM,EACN,aAAa,EACb,SAAS,EACV,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,MAAM,MAAM,WAAW,GAAG;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,
|
|
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;AAGhC,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,MAAM,M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AI,CAgB3E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,oBAAoB,GAAG,IAAI,CAQ/E;AAmBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAa3E;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,gBAAgB,EAAE,CAU5E;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,aAAa,CAAC,GACpD,gBAAgB,EAAE,CAUpB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,aAAa,EAAE,CAa5E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAKhE;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,5 +1,5 @@
|
|
|
1
1
|
import { declaredActions } from './actions.js';
|
|
2
|
-
import {
|
|
2
|
+
import { SITES_SUBMISSIONS_CREATE } from './transport.js';
|
|
3
3
|
import { readPosition, roomVersion } from './version.js';
|
|
4
4
|
export const PROVIDER_ACTIONS = 'provider-actions';
|
|
5
5
|
const BOUND_KEYS = [
|
|
@@ -13,11 +13,9 @@ const BOUND_KEYS = [
|
|
|
13
13
|
'max_inline_body_bytes',
|
|
14
14
|
'max_upload_bytes',
|
|
15
15
|
'max_prefixes',
|
|
16
|
-
'max_held_files',
|
|
17
16
|
'change_retention_seconds',
|
|
18
|
-
'operation_retention_seconds',
|
|
19
17
|
];
|
|
20
|
-
const OPERATION_KEYS = ['write', '
|
|
18
|
+
const OPERATION_KEYS = ['write', 'erase'];
|
|
21
19
|
const ACCESS_LEVELS = ['search', 'open', 'keep'];
|
|
22
20
|
function stringList(value) {
|
|
23
21
|
if (!Array.isArray(value))
|
|
@@ -122,6 +120,35 @@ function parseAuthorities(value) {
|
|
|
122
120
|
}
|
|
123
121
|
return authorities;
|
|
124
122
|
}
|
|
123
|
+
export function foldedAuthorities(authorities) {
|
|
124
|
+
const shapes = [];
|
|
125
|
+
const known = new Map();
|
|
126
|
+
const rooms = authorities.map(({ room_ref, room_handle, name, position, ...shape }) => {
|
|
127
|
+
const key = JSON.stringify(shape);
|
|
128
|
+
let held = known.get(key);
|
|
129
|
+
if (held === undefined) {
|
|
130
|
+
held = shapes.push(shape) - 1;
|
|
131
|
+
known.set(key, held);
|
|
132
|
+
}
|
|
133
|
+
return { room_ref, room_handle, name, position, shape: held };
|
|
134
|
+
});
|
|
135
|
+
return { shapes, rooms };
|
|
136
|
+
}
|
|
137
|
+
function unfolded(shapes, rooms) {
|
|
138
|
+
if (!Array.isArray(shapes) || !Array.isArray(rooms))
|
|
139
|
+
return null;
|
|
140
|
+
const authorities = [];
|
|
141
|
+
for (const room of rooms) {
|
|
142
|
+
if (typeof room !== 'object' || room === null)
|
|
143
|
+
return null;
|
|
144
|
+
const { shape, ...own } = room;
|
|
145
|
+
const held = typeof shape === 'number' ? shapes[shape] : undefined;
|
|
146
|
+
if (typeof held !== 'object' || held === null)
|
|
147
|
+
return null;
|
|
148
|
+
authorities.push({ ...held, ...own });
|
|
149
|
+
}
|
|
150
|
+
return authorities;
|
|
151
|
+
}
|
|
125
152
|
export function parseDiscovery(body) {
|
|
126
153
|
if (typeof body !== 'object' || body === null)
|
|
127
154
|
return null;
|
|
@@ -137,7 +164,7 @@ export function parseDiscovery(body) {
|
|
|
137
164
|
new Set(actions).size !== actions.length ||
|
|
138
165
|
actions.some((name) => name.length === 0))
|
|
139
166
|
return null;
|
|
140
|
-
const authorities = parseAuthorities(held.
|
|
167
|
+
const authorities = parseAuthorities(unfolded(held.shapes, held.rooms));
|
|
141
168
|
return authorities === null ? null : { member, bounds, authorities, actions };
|
|
142
169
|
}
|
|
143
170
|
export function parseAuthorityChange(body) {
|
|
@@ -230,7 +257,6 @@ export function providerLimits(bounds) {
|
|
|
230
257
|
export function declaredRetention(bounds) {
|
|
231
258
|
return {
|
|
232
259
|
history: { kind: 'no-declared-time-bound' },
|
|
233
|
-
outcome: bounds.operation_retention_seconds,
|
|
234
260
|
refreshHorizon: bounds.change_retention_seconds,
|
|
235
261
|
};
|
|
236
262
|
}
|
|
@@ -241,7 +267,7 @@ export function siteCapabilities() {
|
|
|
241
267
|
return [
|
|
242
268
|
{
|
|
243
269
|
name: PROVIDER_ACTIONS,
|
|
244
|
-
actions: [{ name:
|
|
270
|
+
actions: [{ name: SITES_SUBMISSIONS_CREATE, inputShape: {}, resultKind: 'house' }],
|
|
245
271
|
},
|
|
246
272
|
];
|
|
247
273
|
}
|
|
@@ -254,7 +280,7 @@ export function discoveredRoom(authority) {
|
|
|
254
280
|
roomVersion: roomVersion(authority),
|
|
255
281
|
operations: {
|
|
256
282
|
write: [...authority.operations.write],
|
|
257
|
-
|
|
283
|
+
erase: [...authority.operations.erase],
|
|
258
284
|
},
|
|
259
285
|
replica: {
|
|
260
286
|
selection: locator,
|
package/dist/history.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EAGZ,0BAA0B,EAC3B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhE,eAAO,MAAM,YAAY,MAAM,CAAC;AAIhC,KAAK,aAAa,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAkBjE,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAE5D;AAUD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAUtE;AA8BD,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EAGZ,0BAA0B,EAC3B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhE,eAAO,MAAM,YAAY,MAAM,CAAC;AAIhC,KAAK,aAAa,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAkBjE,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAE5D;AAUD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAUtE;AA8BD,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,YAAY,CAAC,CAqBvB"}
|
package/dist/history.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { actionOutcome } from './actions.js';
|
|
2
2
|
import { houseDoorRoute } from './transport.js';
|
|
3
3
|
export const HISTORY_PAGE = 100;
|
|
4
|
-
const HISTORY = 'conversations/history';
|
|
4
|
+
const HISTORY = 'conversations/history/list';
|
|
5
5
|
function record(value) {
|
|
6
6
|
return typeof value === 'object' && value !== null ? value : {};
|
|
7
7
|
}
|
|
@@ -73,7 +73,8 @@ export async function houseHistory(transport, request) {
|
|
|
73
73
|
const asks = historyAsks(request);
|
|
74
74
|
if (asks === null)
|
|
75
75
|
return { kind: 'rejected', code: 'invalid_request', fields: {}, retryable: false };
|
|
76
|
-
const
|
|
76
|
+
const asked = { conversations: asks, limit: HISTORY_PAGE };
|
|
77
|
+
const outcome = actionOutcome(await transport.door(houseDoorRoute(HISTORY), asked), HISTORY, asked);
|
|
77
78
|
if (outcome.kind !== 'action')
|
|
78
79
|
return outcome;
|
|
79
80
|
const answered = record(outcome.result).histories;
|