@agentshouse/mdruntime-adapter 0.1.0-alpha.9 → 0.1.0-c0074032f9909

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.
Files changed (85) hide show
  1. package/README.md +32 -0
  2. package/dist/actions.d.ts +8 -16
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +43 -436
  5. package/dist/adapter.d.ts +1 -1
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +352 -231
  8. package/dist/authored-path.d.ts +9 -0
  9. package/dist/authored-path.d.ts.map +1 -0
  10. package/dist/authored-path.js +34 -0
  11. package/dist/chunks.d.ts +36 -0
  12. package/dist/chunks.d.ts.map +1 -0
  13. package/dist/chunks.js +281 -0
  14. package/dist/digest.d.ts +0 -1
  15. package/dist/digest.js +1 -5
  16. package/dist/discovery.d.ts +49 -42
  17. package/dist/discovery.d.ts.map +1 -1
  18. package/dist/discovery.js +317 -232
  19. package/dist/history.d.ts +6 -0
  20. package/dist/history.d.ts.map +1 -0
  21. package/dist/history.js +85 -0
  22. package/dist/index.d.ts +10 -3
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +9 -3
  25. package/dist/map.d.ts +2 -3
  26. package/dist/map.d.ts.map +1 -1
  27. package/dist/map.js +6 -7
  28. package/dist/model.d.ts +8 -19
  29. package/dist/model.d.ts.map +1 -1
  30. package/dist/model.js +43 -57
  31. package/dist/read.d.ts +65 -54
  32. package/dist/read.d.ts.map +1 -1
  33. package/dist/read.js +217 -295
  34. package/dist/refusal.d.ts +7 -11
  35. package/dist/refusal.d.ts.map +1 -1
  36. package/dist/refusal.js +53 -69
  37. package/dist/search.d.ts +4 -0
  38. package/dist/search.d.ts.map +1 -0
  39. package/dist/search.js +47 -0
  40. package/dist/session-content/bounds.d.ts +7 -0
  41. package/dist/session-content/check.d.ts +18 -0
  42. package/dist/session-content/index.d.ts +7 -0
  43. package/dist/session-content/parts.d.ts +103 -0
  44. package/dist/session-content/state.d.ts +61 -0
  45. package/dist/session-content/turn.d.ts +328 -0
  46. package/dist/site.d.ts +1 -2
  47. package/dist/site.d.ts.map +1 -1
  48. package/dist/site.js +142 -172
  49. package/dist/space-schema.d.ts +6 -0
  50. package/dist/space-schema.d.ts.map +1 -0
  51. package/dist/space-schema.js +11 -0
  52. package/dist/stream.d.ts +20 -9
  53. package/dist/stream.d.ts.map +1 -1
  54. package/dist/stream.js +394 -236
  55. package/dist/transport.d.ts +172 -47
  56. package/dist/transport.d.ts.map +1 -1
  57. package/dist/transport.js +58 -12
  58. package/dist/uncertain.d.ts +5 -0
  59. package/dist/uncertain.d.ts.map +1 -0
  60. package/dist/uncertain.js +11 -0
  61. package/dist/upload.d.ts +13 -0
  62. package/dist/upload.d.ts.map +1 -0
  63. package/dist/upload.js +65 -0
  64. package/dist/version.d.ts +3 -1
  65. package/dist/version.d.ts.map +1 -1
  66. package/dist/version.js +32 -18
  67. package/dist/write.d.ts +24 -11
  68. package/dist/write.d.ts.map +1 -1
  69. package/dist/write.js +263 -241
  70. package/package.json +10 -14
  71. package/AGENTS.md +0 -79
  72. package/dist/actions.js.map +0 -1
  73. package/dist/adapter.js.map +0 -1
  74. package/dist/digest.js.map +0 -1
  75. package/dist/discovery.js.map +0 -1
  76. package/dist/index.js.map +0 -1
  77. package/dist/map.js.map +0 -1
  78. package/dist/model.js.map +0 -1
  79. package/dist/read.js.map +0 -1
  80. package/dist/refusal.js.map +0 -1
  81. package/dist/site.js.map +0 -1
  82. package/dist/stream.js.map +0 -1
  83. package/dist/transport.js.map +0 -1
  84. package/dist/version.js.map +0 -1
  85. package/dist/write.js.map +0 -1
package/dist/discovery.js CHANGED
@@ -1,340 +1,425 @@
1
- import { declaredActions, HOUSE_CONVERSATION_CARDS } from './actions.js';
2
- import { PRIVATE_AUTHORITY } from './transport.js';
1
+ import { declaredActions } from './actions.js';
2
+ import { SITES_SUBMISSIONS_CREATE } from './transport.js';
3
3
  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
4
  export const PROVIDER_ACTIONS = 'provider-actions';
8
- export const MOVE_REFERENCE_REWRITES = 'move-reference-rewrites';
9
- export const DISCOVER_PREFIXES = [
10
- '/'
11
- ];
12
- export const PROVIDER_SELECTION_ROOTS = [
13
- 'agents',
14
- 'house'
15
- ];
16
- export const PROVIDER_SELECTION_MODEL_ROOT = 'house/settings/model';
17
5
  const BOUND_KEYS = [
18
6
  'max_authored_file_bytes',
19
7
  'max_batch_operations',
8
+ 'max_batch_documents',
20
9
  'max_path_length',
21
10
  'max_path_depth',
22
- 'max_mount_files',
23
- 'max_mount_bytes',
11
+ 'max_inline_body_bytes',
12
+ 'max_upload_bytes',
13
+ 'max_prefixes',
24
14
  'change_retention_seconds',
25
- 'operation_retention_seconds'
26
15
  ];
27
- const OPERATION_KEYS = [
28
- 'read',
29
- 'sync',
16
+ const OPERATION_KEYS = ['write', 'erase'];
17
+ const ACCESS_LEVELS = ['search', 'open', 'keep'];
18
+ const ROOM_ACCESS = [
19
+ 'owner',
20
+ 'manage',
30
21
  'write',
31
- 'delete'
22
+ 'read',
23
+ 'public',
32
24
  ];
33
25
  function stringList(value) {
34
- if (!Array.isArray(value)) return null;
35
- return value.every((entry)=>typeof entry === 'string') ? value : null;
26
+ if (!Array.isArray(value))
27
+ return null;
28
+ return value.every((entry) => typeof entry === 'string') ? value : null;
36
29
  }
37
30
  function parseBounds(value) {
38
- if (typeof value !== 'object' || value === null) return null;
31
+ if (typeof value !== 'object' || value === null)
32
+ return null;
39
33
  const held = value;
40
34
  const bounds = {};
41
- for (const key of BOUND_KEYS){
35
+ for (const key of BOUND_KEYS) {
42
36
  const amount = held[key];
43
- if (typeof amount !== 'number' || !Number.isFinite(amount)) return null;
37
+ if (typeof amount !== 'number' || !Number.isFinite(amount))
38
+ return null;
44
39
  bounds[key] = amount;
45
40
  }
41
+ const moves = held.max_move_documents;
42
+ if (moves !== undefined) {
43
+ if (typeof moves !== 'number' || !Number.isFinite(moves))
44
+ return null;
45
+ bounds.max_move_documents = moves;
46
+ }
46
47
  return bounds;
47
48
  }
49
+ function parseTypedSelection(value) {
50
+ if (value === undefined)
51
+ return null;
52
+ return stringList(value) ?? undefined;
53
+ }
54
+ function parseMember(value) {
55
+ if (typeof value !== 'object' || value === null)
56
+ return null;
57
+ const { user, name } = value;
58
+ if (typeof user !== 'string' || typeof name !== 'string')
59
+ return null;
60
+ return { kind: 'user', id: user, name };
61
+ }
48
62
  function parseOperations(value) {
49
- if (typeof value !== 'object' || value === null) return null;
63
+ if (typeof value !== 'object' || value === null)
64
+ return null;
50
65
  const held = value;
51
66
  const operations = {};
52
- for (const key of OPERATION_KEYS){
67
+ for (const key of OPERATION_KEYS) {
53
68
  const scopes = stringList(held[key]);
54
- if (scopes === null) return null;
69
+ if (scopes === null)
70
+ return null;
55
71
  operations[key] = scopes;
56
72
  }
57
73
  return operations;
58
74
  }
59
75
  function parseAuthority(value) {
60
- if (typeof value !== 'object' || value === null) return null;
76
+ if (typeof value !== 'object' || value === null)
77
+ return null;
61
78
  const held = value;
62
- if (held.kind !== 'room' && held.kind !== 'private') return null;
63
- if (typeof held.name !== 'string' || held.name.length === 0) return null;
64
- if (typeof held.collection_root !== 'string' || typeof held.model_root !== 'string') return null;
79
+ if (held.kind !== 'room')
80
+ return null;
81
+ if (typeof held.name !== 'string' || held.name.length === 0)
82
+ return null;
83
+ if (typeof held.model_root !== 'string')
84
+ return null;
65
85
  if (held.managed_replication !== 'admitted' && held.managed_replication !== 'unavailable') {
66
86
  return null;
67
87
  }
68
88
  const at = readPosition(held);
89
+ const typedSelection = parseTypedSelection(held.typed_selection);
69
90
  const protectedPaths = stringList(held.protected_paths);
91
+ const writtenHomes = stringList(held.written_homes);
70
92
  const operations = parseOperations(held.operations);
71
- if (at === null || protectedPaths === null || operations === null) return null;
72
- if (held.kind === 'private') {
73
- return {
74
- kind: 'private',
75
- roomRef: PRIVATE_AUTHORITY,
76
- roomHandle: null,
77
- name: held.name,
78
- collectionRoot: held.collection_root,
79
- modelRoot: held.model_root,
80
- managedReplication: held.managed_replication,
81
- protectedPaths,
82
- operations,
83
- ...at
84
- };
85
- }
86
- if (typeof held.room_ref !== 'string' || held.room_ref.length === 0) return null;
87
- if (typeof held.room_handle !== 'string' || held.room_handle.length === 0) return null;
93
+ const level = ACCESS_LEVELS.find((one) => one === held.level);
94
+ if (at === null ||
95
+ typedSelection === undefined ||
96
+ protectedPaths === null ||
97
+ writtenHomes === null ||
98
+ level === undefined ||
99
+ operations === null)
100
+ return null;
101
+ if (typeof held.room_ref !== 'string' || held.room_ref.length === 0)
102
+ return null;
103
+ if (typeof held.room_handle !== 'string' || held.room_handle.length === 0)
104
+ return null;
88
105
  return {
89
- kind: 'room',
90
106
  roomRef: held.room_ref,
91
107
  roomHandle: held.room_handle,
92
108
  name: held.name,
93
- collectionRoot: held.collection_root,
94
- modelRoot: held.model_root,
109
+ schema: held.model_root,
110
+ typedSelection,
95
111
  managedReplication: held.managed_replication,
96
112
  protectedPaths,
113
+ writtenHomes,
114
+ level,
97
115
  operations,
98
- ...at
116
+ ...at,
99
117
  };
100
118
  }
101
- export function parseDiscovery(body) {
102
- if (typeof body !== 'object' || body === null) return null;
103
- const held = body;
104
- const bounds = parseBounds(held.bounds);
105
- if (bounds === null) return null;
106
- if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0) return null;
107
- if (!Array.isArray(held.authorities)) return null;
119
+ function parseOwner(value) {
120
+ if (typeof value !== 'object' || value === null)
121
+ return null;
122
+ const { user, name } = value;
123
+ return typeof user === 'string' && typeof name === 'string' ? { user, name } : null;
124
+ }
125
+ function parseSpaceRef(value) {
126
+ if (typeof value !== 'object' || value === null)
127
+ return null;
128
+ const { space_ref, name } = value;
129
+ return typeof space_ref === 'string' && typeof name === 'string' ? { space_ref, name } : null;
130
+ }
131
+ function parseListedRoom(value) {
132
+ if (typeof value !== 'object' || value === null)
133
+ return null;
134
+ const held = value;
135
+ const level = ACCESS_LEVELS.find((one) => one === held.level);
136
+ const access = ROOM_ACCESS.find((one) => one === held.access);
137
+ const owner = parseOwner(held.owner);
138
+ const space = held.space === undefined ? undefined : parseSpaceRef(held.space);
139
+ if (typeof held.room_ref !== 'string' ||
140
+ held.room_ref.length === 0 ||
141
+ typeof held.room_handle !== 'string' ||
142
+ held.room_handle.length === 0 ||
143
+ typeof held.name !== 'string' ||
144
+ typeof held.created !== 'string' ||
145
+ (held.archived !== undefined && typeof held.archived !== 'string') ||
146
+ (held.exportable !== undefined && held.exportable !== true) ||
147
+ level === undefined ||
148
+ access === undefined ||
149
+ owner === null ||
150
+ space === null)
151
+ return null;
152
+ return {
153
+ room_ref: held.room_ref,
154
+ room_handle: held.room_handle,
155
+ name: held.name,
156
+ level,
157
+ access,
158
+ owner,
159
+ created: held.created,
160
+ ...(typeof held.archived === 'string' ? { archived: held.archived } : {}),
161
+ ...(held.exportable === true ? { exportable: true } : {}),
162
+ ...(space === undefined ? {} : { space }),
163
+ };
164
+ }
165
+ function parseListedSpace(value) {
166
+ const space = parseSpaceRef(value);
167
+ if (space === null)
168
+ return null;
169
+ const held = value;
170
+ const owner = parseOwner(held.owner);
171
+ if (owner === null ||
172
+ typeof held.created !== 'string' ||
173
+ (held.manages !== undefined && held.manages !== true))
174
+ return null;
175
+ return {
176
+ ...space,
177
+ owner,
178
+ created: held.created,
179
+ ...(held.manages === true ? { manages: true } : {}),
180
+ };
181
+ }
182
+ function parsedAll(value, parse) {
183
+ if (!Array.isArray(value))
184
+ return null;
185
+ const parsed = [];
186
+ for (const entry of value) {
187
+ const one = parse(entry);
188
+ if (one === null)
189
+ return null;
190
+ parsed.push(one);
191
+ }
192
+ return parsed;
193
+ }
194
+ function parseRoomList(authorities, listed, spaces) {
195
+ const held = parsedAll(authorities, parseListedRoom);
196
+ const only = parsedAll(listed, parseListedRoom);
197
+ const shown = parsedAll(spaces, parseListedSpace);
198
+ if (held === null || only === null || shown === null)
199
+ return null;
200
+ return { rooms: [...held, ...only], spaces: shown, listed: only };
201
+ }
202
+ function parseAuthorities(value) {
203
+ if (!Array.isArray(value))
204
+ return null;
108
205
  const authorities = [];
109
- for (const entry of held.authorities){
206
+ for (const entry of value) {
110
207
  const authority = parseAuthority(entry);
111
- if (authority === null) return null;
208
+ if (authority === null)
209
+ return null;
112
210
  authorities.push(authority);
113
211
  }
212
+ return authorities;
213
+ }
214
+ export const ROOM_OWN = {
215
+ room_ref: true,
216
+ room_handle: true,
217
+ name: true,
218
+ position: true,
219
+ created: true,
220
+ archived: true,
221
+ };
222
+ function ownKey(key) {
223
+ return Object.hasOwn(ROOM_OWN, key);
224
+ }
225
+ export function foldedAuthorities(authorities) {
226
+ const shapes = [];
227
+ const known = new Map();
228
+ const rooms = authorities.map((authority) => {
229
+ const entries = Object.entries(authority);
230
+ const shape = Object.fromEntries(entries.filter(([key]) => !ownKey(key)));
231
+ const own = Object.fromEntries(entries.filter(([key]) => ownKey(key)));
232
+ const key = JSON.stringify(shape);
233
+ let held = known.get(key);
234
+ if (held === undefined) {
235
+ held = shapes.push(shape) - 1;
236
+ known.set(key, held);
237
+ }
238
+ return { ...own, shape: held };
239
+ });
240
+ return { shapes, rooms };
241
+ }
242
+ function unfolded(shapes, rooms) {
243
+ if (!Array.isArray(shapes) || !Array.isArray(rooms))
244
+ return null;
245
+ const authorities = [];
246
+ for (const room of rooms) {
247
+ if (typeof room !== 'object' || room === null)
248
+ return null;
249
+ const { shape, ...own } = room;
250
+ const held = typeof shape === 'number' ? shapes[shape] : undefined;
251
+ if (typeof held !== 'object' || held === null)
252
+ return null;
253
+ authorities.push({ ...held, ...own });
254
+ }
255
+ return authorities;
256
+ }
257
+ export function parseDiscovery(body) {
258
+ if (typeof body !== 'object' || body === null)
259
+ return null;
260
+ const held = body;
261
+ const member = parseMember(held.member);
262
+ if (member === null)
263
+ return null;
264
+ const bounds = parseBounds(held.bounds);
265
+ if (bounds === null)
266
+ return null;
267
+ const actions = stringList(held.actions);
268
+ if (actions === null ||
269
+ new Set(actions).size !== actions.length ||
270
+ actions.some((name) => name.length === 0))
271
+ return null;
272
+ const entries = unfolded(held.shapes, held.rooms);
273
+ const authorities = parseAuthorities(entries);
274
+ const listing = parseRoomList(entries, held.listed, held.spaces);
275
+ if (authorities === null || listing === null)
276
+ return null;
114
277
  return {
278
+ member,
115
279
  bounds,
116
- mdModelVersion: held.md_model_version,
117
- authorities
280
+ authorities,
281
+ actions,
282
+ roomList: { rooms: listing.rooms, spaces: listing.spaces },
118
283
  };
119
284
  }
120
- function parseSiteSlot(value) {
121
- if (typeof value !== 'object' || value === null) return null;
122
- const held = value;
123
- if (typeof held.slot !== 'string' || held.slot.length === 0) return null;
124
- if (held.room_ref === null) return {
125
- slot: held.slot,
126
- roomRef: null
127
- };
128
- if (typeof held.room_ref !== 'string' || held.room_ref.length === 0) return null;
285
+ export function parseAuthorityChange(body) {
286
+ if (typeof body !== 'object' || body === null)
287
+ return null;
288
+ const held = body;
289
+ const member = parseMember(held.member);
290
+ const authorities = parseAuthorities(held.authorities);
291
+ const listing = parseRoomList(held.authorities, held.listed, held.spaces);
292
+ const left = stringList(held.left);
293
+ if (member === null || authorities === null || listing === null || left === null)
294
+ return null;
129
295
  return {
130
- slot: held.slot,
131
- roomRef: held.room_ref
296
+ member,
297
+ authorities,
298
+ listed: listing.listed.map((room) => room.room_ref),
299
+ left,
300
+ roomList: { rooms: listing.rooms, spaces: listing.spaces },
132
301
  };
133
302
  }
134
303
  function parseSiteAuthority(value) {
135
- if (typeof value !== 'object' || value === null) return null;
304
+ if (typeof value !== 'object' || value === null)
305
+ return null;
136
306
  const held = value;
137
- if (held.kind !== 'room') return null;
138
- if (typeof held.room_ref !== 'string' || held.room_ref.length === 0) return null;
139
- if (typeof held.room_handle !== 'string' || held.room_handle.length === 0) return null;
140
- if (typeof held.collection_root !== 'string' || typeof held.model_root !== 'string') return null;
307
+ if (held.kind !== 'room')
308
+ return null;
309
+ if (typeof held.room_ref !== 'string' || held.room_ref.length === 0)
310
+ return null;
311
+ if (typeof held.room_handle !== 'string' || held.room_handle.length === 0)
312
+ return null;
313
+ if (typeof held.model_root !== 'string')
314
+ return null;
141
315
  const at = readPosition(held);
142
- if (at === null) return null;
316
+ if (at === null)
317
+ return null;
143
318
  return {
144
319
  roomRef: held.room_ref,
145
320
  roomHandle: held.room_handle,
146
- collectionRoot: held.collection_root,
147
- modelRoot: held.model_root,
148
- ...at
321
+ schema: held.model_root,
322
+ ...at,
149
323
  };
150
324
  }
151
325
  export function parseSiteDiscovery(body) {
152
- if (typeof body !== 'object' || body === null) return null;
326
+ if (typeof body !== 'object' || body === null)
327
+ return null;
153
328
  const held = body;
154
329
  const bounds = parseBounds(held.bounds);
155
- if (bounds === null) return null;
156
- if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0) return null;
157
- if (!Array.isArray(held.slots) || !Array.isArray(held.authorities)) return null;
158
- const slots = [];
159
- for (const entry of held.slots){
160
- const slot = parseSiteSlot(entry);
161
- if (slot === null) return null;
162
- slots.push(slot);
163
- }
330
+ if (bounds === null)
331
+ return null;
332
+ if (!Array.isArray(held.authorities))
333
+ return null;
164
334
  const authorities = [];
165
- for (const entry of held.authorities){
335
+ for (const entry of held.authorities) {
166
336
  const authority = parseSiteAuthority(entry);
167
- if (authority === null) return null;
337
+ if (authority === null)
338
+ return null;
168
339
  authorities.push(authority);
169
340
  }
170
- return {
171
- bounds,
172
- mdModelVersion: held.md_model_version,
173
- slots,
174
- authorities
175
- };
176
- }
177
- export function siteLocator(slot, roomRef) {
178
- return `${slot}:${roomRef}`;
341
+ return { bounds, authorities };
179
342
  }
180
343
  export function siteTracked(document) {
181
- const published = new Map(document.authorities.map((entry)=>[
182
- entry.roomRef,
183
- entry
184
- ]));
185
- return document.slots.flatMap(({ slot, roomRef })=>{
186
- const authority = roomRef === null ? undefined : published.get(roomRef);
187
- if (authority === undefined) return [];
188
- return [
189
- {
190
- slot,
191
- locator: siteLocator(slot, authority.roomRef),
192
- authority: authority.roomRef,
193
- handle: authority.roomHandle,
194
- collectionRoot: authority.collectionRoot,
195
- modelRoot: authority.modelRoot,
196
- modelRoots: [
197
- authority.modelRoot
198
- ],
199
- position: authority.position,
200
- logEpoch: authority.logEpoch
201
- }
202
- ];
203
- });
204
- }
205
- export function locatorOf(authority) {
206
- return authority.roomHandle ?? PRIVATE_AUTHORITY;
344
+ return document.authorities.map((authority) => ({
345
+ locator: authority.roomRef,
346
+ authority: authority.roomRef,
347
+ handle: authority.roomHandle,
348
+ schema: authority.schema,
349
+ typedSelection: null,
350
+ position: authority.position,
351
+ logEpoch: authority.logEpoch,
352
+ }));
207
353
  }
208
354
  export function trackedFrom(document) {
209
- return document.authorities.map((authority)=>({
210
- locator: locatorOf(authority),
211
- authority: authority.roomRef,
212
- handle: authority.roomHandle ?? undefined,
213
- collectionRoot: authority.collectionRoot,
214
- modelRoot: authority.modelRoot,
215
- modelRoots: authority.kind === 'private' ? [
216
- authority.modelRoot,
217
- PROVIDER_SELECTION_MODEL_ROOT
218
- ] : [
219
- authority.modelRoot
220
- ],
221
- position: authority.position,
222
- logEpoch: authority.logEpoch
223
- }));
355
+ return document.authorities.map((authority) => ({
356
+ locator: authority.roomRef,
357
+ authority: authority.roomRef,
358
+ handle: authority.roomHandle,
359
+ schema: authority.schema,
360
+ typedSelection: authority.typedSelection,
361
+ position: authority.position,
362
+ logEpoch: authority.logEpoch,
363
+ }));
224
364
  }
225
365
  export function providerLimits(bounds) {
226
366
  return [
227
- {
228
- name: 'document-size',
229
- value: bounds.max_authored_file_bytes
230
- },
231
- {
232
- name: 'change-batch-operations',
233
- value: bounds.max_batch_operations
234
- },
235
- {
236
- name: 'path-length',
237
- value: bounds.max_path_length
238
- },
239
- {
240
- name: 'path-depth',
241
- value: bounds.max_path_depth
242
- },
243
- {
244
- name: 'write-rate'
245
- },
246
- {
247
- name: 'content-ceiling'
248
- }
367
+ { name: 'document-size', value: bounds.max_authored_file_bytes },
368
+ { name: 'change-batch-operations', value: bounds.max_batch_operations },
369
+ { name: 'change-documents', value: bounds.max_batch_documents },
370
+ { name: 'path-length', value: bounds.max_path_length },
371
+ { name: 'path-depth', value: bounds.max_path_depth },
372
+ ...(bounds.max_move_documents === undefined
373
+ ? []
374
+ : [{ name: 'move-documents', value: bounds.max_move_documents }]),
375
+ { name: 'write-rate' },
376
+ { name: 'storage-limit' },
249
377
  ];
250
378
  }
251
379
  export function declaredRetention(bounds) {
252
380
  return {
253
- history: {
254
- kind: 'no-declared-time-bound'
255
- },
256
- outcome: bounds.operation_retention_seconds,
257
- refreshHorizon: bounds.change_retention_seconds
381
+ history: { kind: 'no-declared-time-bound' },
382
+ refreshHorizon: bounds.change_retention_seconds,
258
383
  };
259
384
  }
260
- export function capabilities() {
261
- return [
262
- {
263
- name: ROOM_VERSION_NOTIFICATIONS
264
- },
265
- {
266
- name: PROVIDER_ACTIONS,
267
- actions: declaredActions(),
268
- conversationCards: HOUSE_CONVERSATION_CARDS
269
- },
270
- {
271
- name: MOVE_REFERENCE_REWRITES
272
- }
273
- ];
385
+ export function capabilities(actions) {
386
+ return [{ name: PROVIDER_ACTIONS, actions: declaredActions(actions) }];
274
387
  }
275
388
  export function siteCapabilities() {
276
389
  return [
277
390
  {
278
- name: ROOM_VERSION_NOTIFICATIONS
279
- }
391
+ name: PROVIDER_ACTIONS,
392
+ actions: [{ name: SITES_SUBMISSIONS_CREATE, inputShape: {}, resultKind: 'house' }],
393
+ },
280
394
  ];
281
395
  }
282
- export function providerSelection(attachedModel) {
283
- return {
284
- roots: [
285
- ...PROVIDER_SELECTION_ROOTS
286
- ],
287
- attachedModel
288
- };
289
- }
290
- export function discoveredRoom(authority, attachedModel, typedSelection) {
396
+ export function discoveredRoom(authority) {
397
+ const locator = authority.roomRef;
291
398
  return {
292
399
  name: authority.name,
293
- locator: locatorOf(authority),
294
- collectionRoot: authority.collectionRoot,
400
+ locator,
401
+ handle: authority.roomHandle,
295
402
  roomVersion: roomVersion(authority),
296
403
  operations: {
297
- read: [
298
- ...authority.operations.read
299
- ],
300
- sync: [
301
- ...authority.operations.sync
302
- ],
303
- write: [
304
- ...authority.operations.write
305
- ],
306
- delete: [
307
- ...authority.operations.delete
308
- ]
404
+ write: [...authority.operations.write],
405
+ erase: [...authority.operations.erase],
309
406
  },
310
407
  replica: {
311
- selection: locatorOf(authority),
312
- admission: authority.managedReplication
313
- },
314
- attachedModel,
315
- ...typedSelection === undefined ? {} : {
316
- typedSelection
408
+ selection: locator,
409
+ admission: authority.managedReplication,
410
+ offline: authority.level === 'open' ? 'locked' : 'open',
317
411
  },
318
- providerOwnedPaths: [
319
- ...authority.protectedPaths
320
- ]
412
+ typedSelection: authority.typedSelection === null ? null : { roots: [...authority.typedSelection] },
413
+ providerOwnedPaths: [...authority.protectedPaths, authority.schema],
414
+ authoredPaths: [...authority.writtenHomes],
321
415
  };
322
416
  }
323
417
  export function mapDiscovery(document, rooms, declared) {
324
418
  return {
325
419
  kind: 'discovery',
326
- supportedVersions: [
327
- ROOM_CONTRACT_VERSION
328
- ],
329
- mdModel: {
330
- identity: MD_MODEL_IDENTITY,
331
- version: document.mdModelVersion
332
- },
333
420
  rooms,
334
421
  capabilities: declared,
335
422
  providerLimits: providerLimits(document.bounds),
336
- retention: declaredRetention(document.bounds)
423
+ retention: declaredRetention(document.bounds),
337
424
  };
338
425
  }
339
-
340
- //# sourceMappingURL=discovery.js.map
@@ -0,0 +1,6 @@
1
+ import type { AcceptedMessage, ActionResult, ConversationHistoryRequest } from '@agentshouse/mdruntime';
2
+ import { type HouseDoor } from './transport.js';
3
+ export declare const HISTORY_PAGE = 100;
4
+ export declare function changeCursor(change: number): string;
5
+ export declare function acceptedMessage(entry: unknown): AcceptedMessage | null;
6
+ export declare function houseHistory(transport: HouseDoor, request: ConversationHistoryRequest): Promise<ActionResult>;
@@ -0,0 +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;AAGhE,eAAO,MAAM,YAAY,MAAM,CAAC;AAqBhC,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAatE;AA6BD,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,YAAY,CAAC,CAqBvB"}