@agentshouse/mdruntime-adapter 0.1.0-alpha.2 → 0.1.0-alpha.21

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 (49) hide show
  1. package/AGENTS.md +120 -22
  2. package/dist/actions.d.ts +3 -11
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +118 -223
  5. package/dist/actions.js.map +1 -1
  6. package/dist/adapter.d.ts +3 -1
  7. package/dist/adapter.d.ts.map +1 -1
  8. package/dist/adapter.js +45 -101
  9. package/dist/adapter.js.map +1 -1
  10. package/dist/discovery.d.ts +34 -7
  11. package/dist/discovery.d.ts.map +1 -1
  12. package/dist/discovery.js +132 -29
  13. package/dist/discovery.js.map +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/model.d.ts +19 -0
  18. package/dist/model.d.ts.map +1 -0
  19. package/dist/model.js +64 -0
  20. package/dist/model.js.map +1 -0
  21. package/dist/read.d.ts +16 -12
  22. package/dist/read.d.ts.map +1 -1
  23. package/dist/read.js +109 -30
  24. package/dist/read.js.map +1 -1
  25. package/dist/refusal.d.ts +4 -1
  26. package/dist/refusal.d.ts.map +1 -1
  27. package/dist/refusal.js +13 -0
  28. package/dist/refusal.js.map +1 -1
  29. package/dist/site.d.ts +4 -0
  30. package/dist/site.d.ts.map +1 -0
  31. package/dist/site.js +205 -0
  32. package/dist/site.js.map +1 -0
  33. package/dist/stream.d.ts +7 -5
  34. package/dist/stream.d.ts.map +1 -1
  35. package/dist/stream.js +117 -82
  36. package/dist/stream.js.map +1 -1
  37. package/dist/transport.d.ts +16 -5
  38. package/dist/transport.d.ts.map +1 -1
  39. package/dist/transport.js +5 -1
  40. package/dist/transport.js.map +1 -1
  41. package/dist/version.d.ts +14 -0
  42. package/dist/version.d.ts.map +1 -0
  43. package/dist/version.js +29 -0
  44. package/dist/version.js.map +1 -0
  45. package/dist/write.d.ts +6 -0
  46. package/dist/write.d.ts.map +1 -1
  47. package/dist/write.js +24 -7
  48. package/dist/write.js.map +1 -1
  49. package/package.json +3 -3
@@ -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,EACT,cAAc,EACf,MAAM,wBAAwB,CAAC;AAIhC,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,eAAO,MAAM,iBAAiB,yBAAyB,CAAC;AAExD,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAEvE,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAU,CAAC;AAE1D,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAwB,CAAC;AAE/E,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AAEpE,MAAM,MAAM,WAAW,GAAG;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,wBAAwB,EAAE,MAAM,CAAC;IACjC,2BAA2B,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IA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eAAe,CAAC,EAC9C,cAAc,EAAE,cAAc,GAAG,SAAS,GACzC,cAAc,CAiBhB;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,gBAAgB,CAAC,EACnE,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAC9B,SAAS,CAUX"}
package/dist/discovery.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import { declaredActions, HOUSE_CONVERSATION_CARDS } from './actions.js';
2
- import { PRIVATE_AUTHORITY } from './transport.js';
2
+ import { PRIVATE_LOCATOR } from './transport.js';
3
+ import { readPosition, roomVersion } from './version.js';
3
4
  export const ROOM_CONTRACT_VERSION = 1;
4
5
  export const MD_MODEL_IDENTITY = '@agentshouse/mdmodel';
5
6
  export const ROOM_VERSION_NOTIFICATIONS = 'room-version-notifications';
6
7
  export const PROVIDER_ACTIONS = 'provider-actions';
8
+ export const MOVE_REFERENCE_REWRITES = 'move-reference-rewrites';
7
9
  export const DISCOVER_PREFIXES = [
8
10
  '/'
9
11
  ];
@@ -57,34 +59,19 @@ function parseOperations(value) {
57
59
  function parseAuthority(value) {
58
60
  if (typeof value !== 'object' || value === null) return null;
59
61
  const held = value;
60
- if (held.kind !== 'room' && held.kind !== 'private') return null;
62
+ if (held.kind !== 'room') return null;
61
63
  if (typeof held.name !== 'string' || held.name.length === 0) return null;
62
64
  if (typeof held.collection_root !== 'string' || typeof held.model_root !== 'string') return null;
63
65
  if (held.managed_replication !== 'admitted' && held.managed_replication !== 'unavailable') {
64
66
  return null;
65
67
  }
66
- if (typeof held.position !== 'string' || held.position.length === 0) return null;
68
+ const at = readPosition(held);
67
69
  const protectedPaths = stringList(held.protected_paths);
68
70
  const operations = parseOperations(held.operations);
69
- if (protectedPaths === null || operations === null) return null;
70
- if (held.kind === 'private') {
71
- return {
72
- kind: 'private',
73
- roomRef: PRIVATE_AUTHORITY,
74
- roomHandle: null,
75
- name: held.name,
76
- collectionRoot: held.collection_root,
77
- modelRoot: held.model_root,
78
- managedReplication: held.managed_replication,
79
- protectedPaths,
80
- operations,
81
- position: held.position
82
- };
83
- }
71
+ if (at === null || protectedPaths === null || operations === null) return null;
84
72
  if (typeof held.room_ref !== 'string' || held.room_ref.length === 0) return null;
85
- if (typeof held.room_handle !== 'string' || held.room_handle.length === 0) return null;
73
+ if (held.room_handle !== null && (typeof held.room_handle !== 'string' || held.room_handle.length === 0)) return null;
86
74
  return {
87
- kind: 'room',
88
75
  roomRef: held.room_ref,
89
76
  roomHandle: held.room_handle,
90
77
  name: held.name,
@@ -93,7 +80,7 @@ function parseAuthority(value) {
93
80
  managedReplication: held.managed_replication,
94
81
  protectedPaths,
95
82
  operations,
96
- position: held.position
83
+ ...at
97
84
  };
98
85
  }
99
86
  export function parseDiscovery(body) {
@@ -102,6 +89,8 @@ export function parseDiscovery(body) {
102
89
  const bounds = parseBounds(held.bounds);
103
90
  if (bounds === null) return null;
104
91
  if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0) return null;
92
+ const actions = stringList(held.actions);
93
+ if (actions === null || new Set(actions).size !== actions.length || actions.some((name)=>name.length === 0)) return null;
105
94
  if (!Array.isArray(held.authorities)) return null;
106
95
  const authorities = [];
107
96
  for (const entry of held.authorities){
@@ -112,11 +101,104 @@ export function parseDiscovery(body) {
112
101
  return {
113
102
  bounds,
114
103
  mdModelVersion: held.md_model_version,
104
+ authorities,
105
+ actions
106
+ };
107
+ }
108
+ function parseSiteEntry(value) {
109
+ if (typeof value !== 'object' || value === null) return null;
110
+ const held = value;
111
+ if (typeof held.room_ref !== 'string' || held.room_ref.length === 0) return null;
112
+ if (typeof held.segment !== 'string' || held.segment.length === 0) return null;
113
+ return {
114
+ roomRef: held.room_ref,
115
+ segment: held.segment
116
+ };
117
+ }
118
+ function parseSiteSlot(value) {
119
+ if (typeof value !== 'object' || value === null) return null;
120
+ const held = value;
121
+ if (typeof held.slot !== 'string' || held.slot.length === 0) return null;
122
+ if (!Array.isArray(held.entries)) return null;
123
+ const entries = [];
124
+ for (const entry of held.entries){
125
+ const parsed = parseSiteEntry(entry);
126
+ if (parsed === null) return null;
127
+ entries.push(parsed);
128
+ }
129
+ return {
130
+ slot: held.slot,
131
+ entries
132
+ };
133
+ }
134
+ function parseSiteAuthority(value) {
135
+ if (typeof value !== 'object' || value === null) return null;
136
+ 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;
141
+ const at = readPosition(held);
142
+ if (at === null) return null;
143
+ return {
144
+ roomRef: held.room_ref,
145
+ roomHandle: held.room_handle,
146
+ collectionRoot: held.collection_root,
147
+ modelRoot: held.model_root,
148
+ ...at
149
+ };
150
+ }
151
+ export function parseSiteDiscovery(body) {
152
+ if (typeof body !== 'object' || body === null) return null;
153
+ const held = body;
154
+ 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
+ }
164
+ const authorities = [];
165
+ for (const entry of held.authorities){
166
+ const authority = parseSiteAuthority(entry);
167
+ if (authority === null) return null;
168
+ authorities.push(authority);
169
+ }
170
+ return {
171
+ bounds,
172
+ mdModelVersion: held.md_model_version,
173
+ slots,
115
174
  authorities
116
175
  };
117
176
  }
177
+ export function siteTracked(document) {
178
+ return document.authorities.map((authority)=>({
179
+ locator: authority.roomRef,
180
+ authority: authority.roomRef,
181
+ handle: authority.roomHandle,
182
+ collectionRoot: authority.collectionRoot,
183
+ modelRoot: authority.modelRoot,
184
+ modelRoots: [
185
+ authority.modelRoot
186
+ ],
187
+ position: authority.position,
188
+ logEpoch: authority.logEpoch
189
+ }));
190
+ }
191
+ export function siteSlots(document) {
192
+ return document.slots.map(({ slot, entries })=>({
193
+ slot,
194
+ entries: entries.map(({ roomRef, segment })=>({
195
+ locator: roomRef,
196
+ segment
197
+ }))
198
+ }));
199
+ }
118
200
  export function locatorOf(authority) {
119
- return authority.roomHandle ?? PRIVATE_AUTHORITY;
201
+ return authority.roomHandle ?? PRIVATE_LOCATOR;
120
202
  }
121
203
  export function trackedFrom(document) {
122
204
  return document.authorities.map((authority)=>({
@@ -125,13 +207,14 @@ export function trackedFrom(document) {
125
207
  handle: authority.roomHandle ?? undefined,
126
208
  collectionRoot: authority.collectionRoot,
127
209
  modelRoot: authority.modelRoot,
128
- modelRoots: authority.kind === 'private' ? [
210
+ modelRoots: authority.roomHandle === null ? [
129
211
  authority.modelRoot,
130
212
  PROVIDER_SELECTION_MODEL_ROOT
131
213
  ] : [
132
214
  authority.modelRoot
133
215
  ],
134
- roomVersion: authority.position
216
+ position: authority.position,
217
+ logEpoch: authority.logEpoch
135
218
  }));
136
219
  }
137
220
  export function providerLimits(bounds) {
@@ -169,15 +252,35 @@ export function declaredRetention(bounds) {
169
252
  refreshHorizon: bounds.change_retention_seconds
170
253
  };
171
254
  }
172
- export function capabilities() {
255
+ export function capabilities(actions) {
173
256
  return [
174
257
  {
175
258
  name: ROOM_VERSION_NOTIFICATIONS
176
259
  },
177
260
  {
178
261
  name: PROVIDER_ACTIONS,
179
- actions: declaredActions(),
262
+ actions: declaredActions(actions),
180
263
  conversationCards: HOUSE_CONVERSATION_CARDS
264
+ },
265
+ {
266
+ name: MOVE_REFERENCE_REWRITES
267
+ }
268
+ ];
269
+ }
270
+ export function siteCapabilities() {
271
+ return [
272
+ {
273
+ name: ROOM_VERSION_NOTIFICATIONS
274
+ },
275
+ {
276
+ name: PROVIDER_ACTIONS,
277
+ actions: [
278
+ {
279
+ name: 'submit',
280
+ inputShape: {},
281
+ resultKind: 'house'
282
+ }
283
+ ]
181
284
  }
182
285
  ];
183
286
  }
@@ -194,7 +297,7 @@ export function discoveredRoom(authority, attachedModel, typedSelection) {
194
297
  name: authority.name,
195
298
  locator: locatorOf(authority),
196
299
  collectionRoot: authority.collectionRoot,
197
- roomVersion: authority.position,
300
+ roomVersion: roomVersion(authority),
198
301
  operations: {
199
302
  read: [
200
303
  ...authority.operations.read
@@ -222,7 +325,7 @@ export function discoveredRoom(authority, attachedModel, typedSelection) {
222
325
  ]
223
326
  };
224
327
  }
225
- export function mapDiscovery(document, rooms) {
328
+ export function mapDiscovery(document, rooms, declared) {
226
329
  return {
227
330
  kind: 'discovery',
228
331
  supportedVersions: [
@@ -233,7 +336,7 @@ export function mapDiscovery(document, rooms) {
233
336
  version: document.mdModelVersion
234
337
  },
235
338
  rooms,
236
- capabilities: capabilities(),
339
+ capabilities: declared,
237
340
  providerLimits: providerLimits(document.bounds),
238
341
  retention: declaredRetention(document.bounds)
239
342
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["/workspace/packages/mdruntime-adapter/src/discovery.ts"],"sourcesContent":["import type {\n Capability,\n DiscoveredRoom,\n Discovery,\n ProviderLimit,\n Retention,\n TypedSelection,\n} from '@agentshouse/mdruntime';\nimport { declaredActions, HOUSE_CONVERSATION_CARDS } from './actions.js';\nimport { PRIVATE_AUTHORITY } from './transport.js';\n\nexport const ROOM_CONTRACT_VERSION = 1;\n\nexport const MD_MODEL_IDENTITY = '@agentshouse/mdmodel';\n\nexport const ROOM_VERSION_NOTIFICATIONS = 'room-version-notifications';\n\nexport const PROVIDER_ACTIONS = 'provider-actions';\n\nexport const DISCOVER_PREFIXES: readonly string[] = ['/'];\n\nexport const PROVIDER_SELECTION_ROOTS: readonly string[] = ['agents', 'house'];\n\nexport const PROVIDER_SELECTION_MODEL_ROOT = 'house/settings/model';\n\nexport type HouseBounds = {\n max_authored_file_bytes: number;\n max_batch_operations: number;\n max_path_length: number;\n max_path_depth: number;\n max_mount_files: number;\n max_mount_bytes: number;\n change_retention_seconds: number;\n operation_retention_seconds: number;\n};\n\nexport type HouseOperations = {\n read: readonly string[];\n sync: readonly string[];\n write: readonly string[];\n delete: readonly string[];\n};\n\nexport type HouseAuthority = {\n kind: 'room' | 'private';\n roomRef: string;\n roomHandle: string | null;\n name: string;\n collectionRoot: string;\n modelRoot: string;\n managedReplication: 'admitted' | 'unavailable';\n protectedPaths: readonly string[];\n operations: HouseOperations;\n position: string;\n};\n\nexport type HouseDiscoveryDocument = {\n bounds: HouseBounds;\n mdModelVersion: string;\n authorities: readonly HouseAuthority[];\n};\n\nexport type TrackedAuthority = {\n locator: string;\n authority: string;\n handle: string | undefined;\n collectionRoot: string;\n modelRoot: string;\n modelRoots: readonly string[];\n roomVersion: string;\n};\n\nconst BOUND_KEYS: readonly (keyof HouseBounds)[] = [\n 'max_authored_file_bytes',\n 'max_batch_operations',\n 'max_path_length',\n 'max_path_depth',\n 'max_mount_files',\n 'max_mount_bytes',\n 'change_retention_seconds',\n 'operation_retention_seconds',\n];\n\nconst OPERATION_KEYS: readonly (keyof HouseOperations)[] = ['read', 'sync', 'write', 'delete'];\n\nfunction stringList(value: unknown): readonly string[] | null {\n if (!Array.isArray(value)) return null;\n return value.every((entry) => typeof entry === 'string') ? (value as string[]) : null;\n}\n\nfunction parseBounds(value: unknown): HouseBounds | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n const bounds: Partial<HouseBounds> = {};\n for (const key of BOUND_KEYS) {\n const amount = held[key];\n if (typeof amount !== 'number' || !Number.isFinite(amount)) return null;\n bounds[key] = amount;\n }\n return bounds as HouseBounds;\n}\n\nfunction parseOperations(value: unknown): HouseOperations | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n const operations: Partial<Record<keyof HouseOperations, readonly string[]>> = {};\n for (const key of OPERATION_KEYS) {\n const scopes = stringList(held[key]);\n if (scopes === null) return null;\n operations[key] = scopes;\n }\n return operations as HouseOperations;\n}\n\nfunction parseAuthority(value: unknown): HouseAuthority | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n if (held.kind !== 'room' && held.kind !== 'private') return null;\n if (typeof held.name !== 'string' || held.name.length === 0) return null;\n if (typeof held.collection_root !== 'string' || typeof held.model_root !== 'string') return null;\n if (held.managed_replication !== 'admitted' && held.managed_replication !== 'unavailable') {\n return null;\n }\n if (typeof held.position !== 'string' || held.position.length === 0) return null;\n const protectedPaths = stringList(held.protected_paths);\n const operations = parseOperations(held.operations);\n if (protectedPaths === null || operations === null) return null;\n if (held.kind === 'private') {\n return {\n kind: 'private',\n roomRef: PRIVATE_AUTHORITY,\n roomHandle: null,\n name: held.name,\n collectionRoot: held.collection_root,\n modelRoot: held.model_root,\n managedReplication: held.managed_replication,\n protectedPaths,\n operations,\n position: held.position,\n };\n }\n if (typeof held.room_ref !== 'string' || held.room_ref.length === 0) return null;\n if (typeof held.room_handle !== 'string' || held.room_handle.length === 0) return null;\n return {\n kind: 'room',\n roomRef: held.room_ref,\n roomHandle: held.room_handle,\n name: held.name,\n collectionRoot: held.collection_root,\n modelRoot: held.model_root,\n managedReplication: held.managed_replication,\n protectedPaths,\n operations,\n position: held.position,\n };\n}\n\nexport function parseDiscovery(body: unknown): HouseDiscoveryDocument | null {\n if (typeof body !== 'object' || body === null) return null;\n const held = body as Record<string, unknown>;\n const bounds = parseBounds(held.bounds);\n if (bounds === null) return null;\n if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0) return null;\n if (!Array.isArray(held.authorities)) return null;\n const authorities: HouseAuthority[] = [];\n for (const entry of held.authorities) {\n const authority = parseAuthority(entry);\n if (authority === null) return null;\n authorities.push(authority);\n }\n return { bounds, mdModelVersion: held.md_model_version, authorities };\n}\n\nexport function locatorOf(authority: HouseAuthority): string {\n return authority.roomHandle ?? PRIVATE_AUTHORITY;\n}\n\nexport function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[] {\n return document.authorities.map((authority) => ({\n locator: locatorOf(authority),\n authority: authority.roomRef,\n handle: authority.roomHandle ?? undefined,\n collectionRoot: authority.collectionRoot,\n modelRoot: authority.modelRoot,\n modelRoots:\n authority.kind === 'private'\n ? [authority.modelRoot, PROVIDER_SELECTION_MODEL_ROOT]\n : [authority.modelRoot],\n roomVersion: authority.position,\n }));\n}\n\nexport function providerLimits(bounds: HouseBounds): readonly ProviderLimit[] {\n return [\n { name: 'document-size', value: bounds.max_authored_file_bytes },\n { name: 'change-batch-operations', value: bounds.max_batch_operations },\n { name: 'path-length', value: bounds.max_path_length },\n { name: 'path-depth', value: bounds.max_path_depth },\n { name: 'write-rate' },\n { name: 'content-ceiling' },\n ];\n}\n\nexport function declaredRetention(bounds: HouseBounds): Retention {\n return {\n history: { kind: 'no-declared-time-bound' },\n outcome: bounds.operation_retention_seconds,\n refreshHorizon: bounds.change_retention_seconds,\n };\n}\n\nexport function capabilities(): readonly Capability[] {\n return [\n { name: ROOM_VERSION_NOTIFICATIONS },\n {\n name: PROVIDER_ACTIONS,\n actions: declaredActions(),\n conversationCards: HOUSE_CONVERSATION_CARDS,\n },\n ];\n}\n\nexport function providerSelection(attachedModel: TypedSelection['attachedModel']): TypedSelection {\n return { roots: [...PROVIDER_SELECTION_ROOTS], attachedModel };\n}\n\nexport function discoveredRoom(\n authority: HouseAuthority,\n attachedModel: DiscoveredRoom['attachedModel'],\n typedSelection: TypedSelection | undefined,\n): DiscoveredRoom {\n return {\n name: authority.name,\n locator: locatorOf(authority),\n collectionRoot: authority.collectionRoot,\n roomVersion: authority.position,\n operations: {\n read: [...authority.operations.read],\n sync: [...authority.operations.sync],\n write: [...authority.operations.write],\n delete: [...authority.operations.delete],\n },\n replica: { selection: locatorOf(authority), admission: authority.managedReplication },\n attachedModel,\n ...(typedSelection === undefined ? {} : { typedSelection }),\n providerOwnedPaths: [...authority.protectedPaths],\n };\n}\n\nexport function mapDiscovery(\n document: HouseDiscoveryDocument,\n rooms: readonly DiscoveredRoom[],\n): Discovery {\n return {\n kind: 'discovery',\n supportedVersions: [ROOM_CONTRACT_VERSION],\n mdModel: { identity: MD_MODEL_IDENTITY, version: document.mdModelVersion },\n rooms,\n capabilities: capabilities(),\n providerLimits: providerLimits(document.bounds),\n retention: declaredRetention(document.bounds),\n };\n}\n"],"names":["declaredActions","HOUSE_CONVERSATION_CARDS","PRIVATE_AUTHORITY","ROOM_CONTRACT_VERSION","MD_MODEL_IDENTITY","ROOM_VERSION_NOTIFICATIONS","PROVIDER_ACTIONS","DISCOVER_PREFIXES","PROVIDER_SELECTION_ROOTS","PROVIDER_SELECTION_MODEL_ROOT","BOUND_KEYS","OPERATION_KEYS","stringList","value","Array","isArray","every","entry","parseBounds","held","bounds","key","amount","Number","isFinite","parseOperations","operations","scopes","parseAuthority","kind","name","length","collection_root","model_root","managed_replication","position","protectedPaths","protected_paths","roomRef","roomHandle","collectionRoot","modelRoot","managedReplication","room_ref","room_handle","parseDiscovery","body","md_model_version","authorities","authority","push","mdModelVersion","locatorOf","trackedFrom","document","map","locator","handle","undefined","modelRoots","roomVersion","providerLimits","max_authored_file_bytes","max_batch_operations","max_path_length","max_path_depth","declaredRetention","history","outcome","operation_retention_seconds","refreshHorizon","change_retention_seconds","capabilities","actions","conversationCards","providerSelection","attachedModel","roots","discoveredRoom","typedSelection","read","sync","write","delete","replica","selection","admission","providerOwnedPaths","mapDiscovery","rooms","supportedVersions","mdModel","identity","version","retention"],"mappings":"AAQA,SAASA,eAAe,EAAEC,wBAAwB,QAAQ,eAAe;AACzE,SAASC,iBAAiB,QAAQ,iBAAiB;AAEnD,OAAO,MAAMC,wBAAwB,EAAE;AAEvC,OAAO,MAAMC,oBAAoB,uBAAuB;AAExD,OAAO,MAAMC,6BAA6B,6BAA6B;AAEvE,OAAO,MAAMC,mBAAmB,mBAAmB;AAEnD,OAAO,MAAMC,oBAAuC;IAAC;CAAI,CAAC;AAE1D,OAAO,MAAMC,2BAA8C;IAAC;IAAU;CAAQ,CAAC;AAE/E,OAAO,MAA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BA,eAAeP,SAASlC,MAAM;QAC9C0E,WAAW5B,kBAAkBZ,SAASlC,MAAM;IAC9C;AACF"}
1
+ {"version":3,"sources":["/workspace/packages/mdruntime-adapter/src/discovery.ts"],"sourcesContent":["import type {\n Capability,\n DiscoveredRoom,\n Discovery,\n ProviderLimit,\n Retention,\n TypedSelection,\n} from '@agentshouse/mdruntime';\nimport { declaredActions, HOUSE_CONVERSATION_CARDS } from './actions.js';\nimport { PRIVATE_LOCATOR } from './transport.js';\nimport { readPosition, roomVersion, type LogPosition } from './version.js';\n\nexport const ROOM_CONTRACT_VERSION = 1;\n\nexport const MD_MODEL_IDENTITY = '@agentshouse/mdmodel';\n\nexport const ROOM_VERSION_NOTIFICATIONS = 'room-version-notifications';\n\nexport const PROVIDER_ACTIONS = 'provider-actions';\n\nexport const MOVE_REFERENCE_REWRITES = 'move-reference-rewrites';\n\nexport const DISCOVER_PREFIXES: readonly string[] = ['/'];\n\nexport const PROVIDER_SELECTION_ROOTS: readonly string[] = ['agents', 'house'];\n\nexport const PROVIDER_SELECTION_MODEL_ROOT = 'house/settings/model';\n\nexport type HouseBounds = {\n max_authored_file_bytes: number;\n max_batch_operations: number;\n max_path_length: number;\n max_path_depth: number;\n max_mount_files: number;\n max_mount_bytes: number;\n change_retention_seconds: number;\n operation_retention_seconds: number;\n};\n\nexport type HouseOperations = {\n read: readonly string[];\n sync: readonly string[];\n write: readonly string[];\n delete: readonly string[];\n};\n\nexport type HouseAuthority = LogPosition & {\n roomRef: string;\n roomHandle: string | null;\n name: string;\n collectionRoot: string;\n modelRoot: string;\n managedReplication: 'admitted' | 'unavailable';\n protectedPaths: readonly string[];\n operations: HouseOperations;\n};\n\nexport type HouseDiscoveryDocument = {\n bounds: HouseBounds;\n mdModelVersion: string;\n authorities: readonly HouseAuthority[];\n actions: readonly string[];\n};\n\nexport type TrackedAuthority = LogPosition & {\n locator: string;\n authority: string;\n handle: string | undefined;\n collectionRoot: string;\n modelRoot: string;\n modelRoots: readonly string[];\n};\n\nexport type HouseSiteEntry = {\n roomRef: string;\n segment: string;\n};\n\nexport type HouseSiteSlot = {\n slot: string;\n entries: readonly HouseSiteEntry[];\n};\n\nexport type HouseSiteAuthority = LogPosition & {\n roomRef: string;\n roomHandle: string;\n collectionRoot: string;\n modelRoot: string;\n};\n\nexport type HouseSiteDiscovery = {\n bounds: HouseBounds;\n mdModelVersion: string;\n slots: readonly HouseSiteSlot[];\n authorities: readonly HouseSiteAuthority[];\n};\n\nexport type SiteTracked = TrackedAuthority & { handle: string };\n\nconst BOUND_KEYS: readonly (keyof HouseBounds)[] = [\n 'max_authored_file_bytes',\n 'max_batch_operations',\n 'max_path_length',\n 'max_path_depth',\n 'max_mount_files',\n 'max_mount_bytes',\n 'change_retention_seconds',\n 'operation_retention_seconds',\n];\n\nconst OPERATION_KEYS: readonly (keyof HouseOperations)[] = ['read', 'sync', 'write', 'delete'];\n\nfunction stringList(value: unknown): readonly string[] | null {\n if (!Array.isArray(value)) return null;\n return value.every((entry) => typeof entry === 'string') ? (value as string[]) : null;\n}\n\nfunction parseBounds(value: unknown): HouseBounds | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n const bounds: Partial<HouseBounds> = {};\n for (const key of BOUND_KEYS) {\n const amount = held[key];\n if (typeof amount !== 'number' || !Number.isFinite(amount)) return null;\n bounds[key] = amount;\n }\n return bounds as HouseBounds;\n}\n\nfunction parseOperations(value: unknown): HouseOperations | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n const operations: Partial<Record<keyof HouseOperations, readonly string[]>> = {};\n for (const key of OPERATION_KEYS) {\n const scopes = stringList(held[key]);\n if (scopes === null) return null;\n operations[key] = scopes;\n }\n return operations as HouseOperations;\n}\n\nfunction parseAuthority(value: unknown): HouseAuthority | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n if (held.kind !== 'room') return null;\n if (typeof held.name !== 'string' || held.name.length === 0) return null;\n if (typeof held.collection_root !== 'string' || typeof held.model_root !== 'string') return null;\n if (held.managed_replication !== 'admitted' && held.managed_replication !== 'unavailable') {\n return null;\n }\n const at = readPosition(held);\n const protectedPaths = stringList(held.protected_paths);\n const operations = parseOperations(held.operations);\n if (at === null || protectedPaths === null || operations === null) return null;\n if (typeof held.room_ref !== 'string' || held.room_ref.length === 0) return null;\n if (\n held.room_handle !== null &&\n (typeof held.room_handle !== 'string' || held.room_handle.length === 0)\n )\n return null;\n return {\n roomRef: held.room_ref,\n roomHandle: held.room_handle,\n name: held.name,\n collectionRoot: held.collection_root,\n modelRoot: held.model_root,\n managedReplication: held.managed_replication,\n protectedPaths,\n operations,\n ...at,\n };\n}\n\nexport function parseDiscovery(body: unknown): HouseDiscoveryDocument | null {\n if (typeof body !== 'object' || body === null) return null;\n const held = body as Record<string, unknown>;\n const bounds = parseBounds(held.bounds);\n if (bounds === null) return null;\n if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0) return null;\n const actions = stringList(held.actions);\n if (\n actions === null ||\n new Set(actions).size !== actions.length ||\n actions.some((name) => name.length === 0)\n )\n return null;\n if (!Array.isArray(held.authorities)) return null;\n const authorities: HouseAuthority[] = [];\n for (const entry of held.authorities) {\n const authority = parseAuthority(entry);\n if (authority === null) return null;\n authorities.push(authority);\n }\n return { bounds, mdModelVersion: held.md_model_version, authorities, actions };\n}\n\nfunction parseSiteEntry(value: unknown): HouseSiteEntry | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n if (typeof held.room_ref !== 'string' || held.room_ref.length === 0) return null;\n if (typeof held.segment !== 'string' || held.segment.length === 0) return null;\n return { roomRef: held.room_ref, segment: held.segment };\n}\n\nfunction parseSiteSlot(value: unknown): HouseSiteSlot | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n if (typeof held.slot !== 'string' || held.slot.length === 0) return null;\n if (!Array.isArray(held.entries)) return null;\n const entries: HouseSiteEntry[] = [];\n for (const entry of held.entries) {\n const parsed = parseSiteEntry(entry);\n if (parsed === null) return null;\n entries.push(parsed);\n }\n return { slot: held.slot, entries };\n}\n\nfunction parseSiteAuthority(value: unknown): HouseSiteAuthority | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n if (held.kind !== 'room') return null;\n if (typeof held.room_ref !== 'string' || held.room_ref.length === 0) return null;\n if (typeof held.room_handle !== 'string' || held.room_handle.length === 0) return null;\n if (typeof held.collection_root !== 'string' || typeof held.model_root !== 'string') return null;\n const at = readPosition(held);\n if (at === null) return null;\n return {\n roomRef: held.room_ref,\n roomHandle: held.room_handle,\n collectionRoot: held.collection_root,\n modelRoot: held.model_root,\n ...at,\n };\n}\n\nexport function parseSiteDiscovery(body: unknown): HouseSiteDiscovery | null {\n if (typeof body !== 'object' || body === null) return null;\n const held = body as Record<string, unknown>;\n const bounds = parseBounds(held.bounds);\n if (bounds === null) return null;\n if (typeof held.md_model_version !== 'string' || held.md_model_version.length === 0) return null;\n if (!Array.isArray(held.slots) || !Array.isArray(held.authorities)) return null;\n const slots: HouseSiteSlot[] = [];\n for (const entry of held.slots) {\n const slot = parseSiteSlot(entry);\n if (slot === null) return null;\n slots.push(slot);\n }\n const authorities: HouseSiteAuthority[] = [];\n for (const entry of held.authorities) {\n const authority = parseSiteAuthority(entry);\n if (authority === null) return null;\n authorities.push(authority);\n }\n return { bounds, mdModelVersion: held.md_model_version, slots, authorities };\n}\n\nexport function siteTracked(document: HouseSiteDiscovery): SiteTracked[] {\n return document.authorities.map((authority) => ({\n locator: authority.roomRef,\n authority: authority.roomRef,\n handle: authority.roomHandle,\n collectionRoot: authority.collectionRoot,\n modelRoot: authority.modelRoot,\n modelRoots: [authority.modelRoot],\n position: authority.position,\n logEpoch: authority.logEpoch,\n }));\n}\n\nexport function siteSlots(document: HouseSiteDiscovery): Discovery['slots'] {\n return document.slots.map(({ slot, entries }) => ({\n slot,\n entries: entries.map(({ roomRef, segment }) => ({ locator: roomRef, segment })),\n }));\n}\n\nexport function locatorOf(authority: HouseAuthority): string {\n return authority.roomHandle ?? PRIVATE_LOCATOR;\n}\n\nexport function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[] {\n return document.authorities.map((authority) => ({\n locator: locatorOf(authority),\n authority: authority.roomRef,\n handle: authority.roomHandle ?? undefined,\n collectionRoot: authority.collectionRoot,\n modelRoot: authority.modelRoot,\n modelRoots:\n authority.roomHandle === null\n ? [authority.modelRoot, PROVIDER_SELECTION_MODEL_ROOT]\n : [authority.modelRoot],\n position: authority.position,\n logEpoch: authority.logEpoch,\n }));\n}\n\nexport function providerLimits(bounds: HouseBounds): readonly ProviderLimit[] {\n return [\n { name: 'document-size', value: bounds.max_authored_file_bytes },\n { name: 'change-batch-operations', value: bounds.max_batch_operations },\n { name: 'path-length', value: bounds.max_path_length },\n { name: 'path-depth', value: bounds.max_path_depth },\n { name: 'write-rate' },\n { name: 'content-ceiling' },\n ];\n}\n\nexport function declaredRetention(bounds: HouseBounds): Retention {\n return {\n history: { kind: 'no-declared-time-bound' },\n outcome: bounds.operation_retention_seconds,\n refreshHorizon: bounds.change_retention_seconds,\n };\n}\n\nexport function capabilities(actions: readonly string[]): readonly Capability[] {\n return [\n { name: ROOM_VERSION_NOTIFICATIONS },\n {\n name: PROVIDER_ACTIONS,\n actions: declaredActions(actions),\n conversationCards: HOUSE_CONVERSATION_CARDS,\n },\n { name: MOVE_REFERENCE_REWRITES },\n ];\n}\n\nexport function siteCapabilities(): readonly Capability[] {\n return [\n { name: ROOM_VERSION_NOTIFICATIONS },\n { name: PROVIDER_ACTIONS, actions: [{ name: 'submit', inputShape: {}, resultKind: 'house' }] },\n ];\n}\n\nexport function providerSelection(attachedModel: TypedSelection['attachedModel']): TypedSelection {\n return { roots: [...PROVIDER_SELECTION_ROOTS], attachedModel };\n}\n\nexport function discoveredRoom(\n authority: HouseAuthority,\n attachedModel: DiscoveredRoom['attachedModel'],\n typedSelection: TypedSelection | undefined,\n): DiscoveredRoom {\n return {\n name: authority.name,\n locator: locatorOf(authority),\n collectionRoot: authority.collectionRoot,\n roomVersion: roomVersion(authority),\n operations: {\n read: [...authority.operations.read],\n sync: [...authority.operations.sync],\n write: [...authority.operations.write],\n delete: [...authority.operations.delete],\n },\n replica: { selection: locatorOf(authority), admission: authority.managedReplication },\n attachedModel,\n ...(typedSelection === undefined ? {} : { typedSelection }),\n providerOwnedPaths: [...authority.protectedPaths],\n };\n}\n\nexport function mapDiscovery(\n document: Pick<HouseDiscoveryDocument, 'bounds' | 'mdModelVersion'>,\n rooms: readonly DiscoveredRoom[],\n declared: readonly Capability[],\n): Discovery {\n return {\n kind: 'discovery',\n supportedVersions: [ROOM_CONTRACT_VERSION],\n mdModel: { identity: MD_MODEL_IDENTITY, version: document.mdModelVersion },\n rooms,\n capabilities: declared,\n providerLimits: providerLimits(document.bounds),\n retention: declaredRetention(document.bounds),\n };\n}\n"],"names":["declaredActions","HOUSE_CONVERSATION_CARDS","PRIVATE_LOCATOR","readPosition","roomVersion","ROOM_CONTRACT_VERSION","MD_MODEL_IDENTITY","ROOM_VERSION_NOTIFICATIONS","PROVIDER_ACTIONS","MOVE_REFERENCE_REWRITES","DISCOVER_PREFIXES","PROVIDER_SELECTION_ROOTS","PROVIDER_SELECTION_MODEL_ROOT","BOUND_KEYS","OPERATION_KEYS","stringList","value","Array","isArray","every","entry","parseBounds","held","bounds","key","amount","Number","isFinite","parseOperations","operations","scopes","parseAuthority","kind","name","length","collection_root","model_root","managed_replication","at","protectedPaths","protected_paths","room_ref","room_handle","roomRef","roomHandle","collectionRoot","modelRoot","managedReplication","parseDiscovery","body","md_model_version","actions","Set","size","some","authorities","authority","push","mdModelVersion","parseSiteEntry","segment","parseSiteSlot","slot","entries","parsed","parseSiteAuthority","parseSiteDiscovery","slots","siteTracked","document","map","locator","handle","modelRoots","position","logEpoch","siteSlots","locatorOf","trackedFrom","undefined","providerLimits","max_authored_file_bytes","max_batch_operations","max_path_length","max_path_depth","declaredRetention","history","outcome","operation_retention_seconds","refreshHorizon","change_retention_seconds","capabilities","conversationCards","siteCapabilities","inputShape","resultKind","providerSelection","attachedModel","roots","discoveredRoom","typedSelection","read","sync","write","delete","replica","selection","admission","providerOwnedPaths","mapDiscovery","rooms","declared","supportedVersions","mdModel","identity","version","retention"],"mappings":"AAQA,SAASA,eAAe,EAAEC,wBAAwB,QAAQ,eAAe;AACzE,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,YAAY,EAAEC,WAAW,QAA0B,eAAe;AAE3E,OAAO,MAAMC,wBAAwB,EAAE;AAEvC,OAAO,MAAMC,oBAAoB,uBAAuB;AAExD,OAAO,MAAMC,6BAA6B,6BAA6B;AAEvE,OAAO,MAAMC,mBAAmB,mBAAmB;AAEnD,OAAO,MAAMC,0BAA0B,0BAA0B;AAEjE,OAAO,MAAMC,oBAAuC;IAAC;CAAI,CAAC;AAE1D,OAAO,MAAMC,2BAA8C;IAAC;IAAU;CAAQ,CAAC;AAE/E,OAAO,MAAMC,gCAAgC,uBAAuB;AAyEpE,MAAMC,aAA6C;IACjD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,iBAAqD;IAAC;IAAQ;IAAQ;IAAS;CAAS;AAE9F,SAASC,WAAWC,KAAc;IAChC,IAAI,CAACC,MAAMC,OAAO,CAACF,QAAQ,OAAO;IAClC,OAAOA,MAAMG,KAAK,CAAC,CAACC,QAAU,OAAOA,UAAU,YAAaJ,QAAqB;AACnF;AAEA,SAASK,YAAYL,KAAc;IACjC,IAAI,OAAOA,UAAU,YAAYA,UAAU,MAAM,OAAO;IACxD,MAAMM,OAAON;IACb,MAAMO,SAA+B,CAAC;IACtC,KAAK,MAAMC,OAAOX,WAAY;QAC5B,MAAMY,SAASH,IAAI,CAACE,IAAI;QACxB,IAAI,OAAOC,WAAW,YAAY,CAACC,OAAOC,QAAQ,CAACF,SAAS,OAAO;QACnEF,MAAM,CAACC,IAAI,GAAGC;IAChB;IACA,OAAOF;AACT;AAEA,SAASK,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ACzEoD;QACAnB,cAAcoB;QACd/B,gBAAgBA,eAAeX,SAAS9C,MAAM;QAC9C6F,WAAW/B,kBAAkBhB,SAAS9C,MAAM;IAC9C;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
2
2
  export { nativePath, roomLocalPath } from './map.js';
3
- export type { HouseByteAct, HouseByteTransfer, HouseDoorAnswer, HouseStream, HouseStreamAuthority, HouseStreamEntry, HouseStreamFrame, HouseTransport, } from './transport.js';
3
+ export type { HouseByteAct, HouseByteTransfer, HouseDoorAnswer, HouseStream, HouseStreamAuthority, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -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,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACrD,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
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,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACrD,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["/workspace/packages/mdruntime-adapter/src/index.ts"],"sourcesContent":["export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';\nexport { nativePath, roomLocalPath } from './map.js';\nexport type {\n HouseByteAct,\n HouseByteTransfer,\n HouseDoorAnswer,\n HouseStream,\n HouseStreamAuthority,\n HouseStreamEntry,\n HouseStreamFrame,\n HouseTransport,\n} from './transport.js';\n"],"names":["createAgentsHouseAdapter","nativePath","roomLocalPath"],"mappings":"AAAA,SAASA,wBAAwB,QAAwC,eAAe;AACxF,SAASC,UAAU,EAAEC,aAAa,QAAQ,WAAW"}
1
+ {"version":3,"sources":["/workspace/packages/mdruntime-adapter/src/index.ts"],"sourcesContent":["export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';\nexport { nativePath, roomLocalPath } from './map.js';\nexport type {\n HouseByteAct,\n HouseByteTransfer,\n HouseDoorAnswer,\n HouseStream,\n HouseStreamAuthority,\n HouseStreamEntry,\n HouseStreamFrame,\n HouseSiteTransport,\n HouseTransport,\n} from './transport.js';\n"],"names":["createAgentsHouseAdapter","nativePath","roomLocalPath"],"mappings":"AAAA,SAASA,wBAAwB,QAAwC,eAAe;AACxF,SAASC,UAAU,EAAEC,aAAa,QAAQ,WAAW"}
@@ -0,0 +1,19 @@
1
+ import type { AdapterFailure, ModelIdentity, ModelRequest, ModelResult } from '@agentshouse/mdruntime';
2
+ import type { HouseDefinitions } from './read.js';
3
+ export type HeldModel = {
4
+ snapshot: ModelResult;
5
+ identity: ModelIdentity | null;
6
+ };
7
+ export declare const MODEL_ABSENT: ModelResult;
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: HouseDefinitions | 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;
19
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,CAAC;AAElF,eAAO,MAAM,YAAY,EAAE,WAAmE,CAAC;AAE/F,wBAAgB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAAG,WAAW,CAI7F;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,GAAG,MAAM,CAEpF;AAED,wBAAsB,SAAS,CAC7B,IAAI,EAAE,gBAAgB,GAAG,IAAI,EAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,SAAS,CAAC,CAOpB;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAC5E,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW,CAAC;IAC3C,IAAI,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,wBAAgB,UAAU,IAAI,UAAU,CAqBvC"}
package/dist/model.js ADDED
@@ -0,0 +1,64 @@
1
+ import { sha256Hex } from './digest.js';
2
+ export const MODEL_ABSENT = {
3
+ kind: 'model-unavailable',
4
+ reason: 'not-readable'
5
+ };
6
+ export function failedModel(failure) {
7
+ if (failure.kind === 'revoked-authorization') return {
8
+ kind: 'revoked-authorization'
9
+ };
10
+ if (failure.kind === 'transport-uncertainty') return {
11
+ kind: 'transport-uncertainty'
12
+ };
13
+ return MODEL_ABSENT;
14
+ }
15
+ export function modelKey(locator, attached) {
16
+ return `${locator} ${attached}`;
17
+ }
18
+ export async function heldModel(read, identity, failure) {
19
+ if (read === null) return {
20
+ snapshot: failure,
21
+ identity: null
22
+ };
23
+ const version = await sha256Hex(JSON.stringify(read.versions));
24
+ return {
25
+ snapshot: {
26
+ kind: 'model',
27
+ snapshot: {
28
+ identity,
29
+ version,
30
+ definitions: read.definitions
31
+ }
32
+ },
33
+ identity: {
34
+ identity,
35
+ version
36
+ }
37
+ };
38
+ }
39
+ export function modelShelf() {
40
+ const models = new Map();
41
+ return {
42
+ retain (key, acquired) {
43
+ if (acquired === undefined) return models.get(key);
44
+ if (acquired.snapshot.kind === 'transport-uncertainty') {
45
+ const previous = models.get(key);
46
+ if (previous !== undefined && previous.identity !== null) return previous;
47
+ }
48
+ models.set(key, acquired);
49
+ return acquired;
50
+ },
51
+ answer (request) {
52
+ return models.get(modelKey(request.locator, request.attached))?.snapshot ?? MODEL_ABSENT;
53
+ },
54
+ keep (locators) {
55
+ for (const key of [
56
+ ...models.keys()
57
+ ]){
58
+ if (!locators.some((locator)=>key.startsWith(`${locator} `))) models.delete(key);
59
+ }
60
+ }
61
+ };
62
+ }
63
+
64
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/workspace/packages/mdruntime-adapter/src/model.ts"],"sourcesContent":["import type {\n AdapterFailure,\n ModelIdentity,\n ModelRequest,\n ModelResult,\n} from '@agentshouse/mdruntime';\nimport { sha256Hex } from './digest.js';\nimport type { HouseDefinitions } from './read.js';\n\nexport type HeldModel = { snapshot: ModelResult; identity: ModelIdentity | null };\n\nexport const MODEL_ABSENT: ModelResult = { kind: 'model-unavailable', reason: 'not-readable' };\n\nexport function failedModel(failure: AdapterFailure | { kind: 'beyond-horizon' }): ModelResult {\n if (failure.kind === 'revoked-authorization') return { kind: 'revoked-authorization' };\n if (failure.kind === 'transport-uncertainty') return { kind: 'transport-uncertainty' };\n return MODEL_ABSENT;\n}\n\nexport function modelKey(locator: string, attached: ModelRequest['attached']): string {\n return `${locator} ${attached}`;\n}\n\nexport async function heldModel(\n read: HouseDefinitions | null,\n identity: string,\n failure: ModelResult,\n): Promise<HeldModel> {\n if (read === null) return { snapshot: failure, identity: null };\n const version = await sha256Hex(JSON.stringify(read.versions));\n return {\n snapshot: { kind: 'model', snapshot: { identity, version, definitions: read.definitions } },\n identity: { identity, version },\n };\n}\n\nexport type ModelShelf = {\n retain(key: string, acquired: HeldModel | undefined): HeldModel | undefined;\n answer(request: ModelRequest): ModelResult;\n keep(locators: readonly string[]): void;\n};\n\nexport function modelShelf(): ModelShelf {\n const models = new Map<string, HeldModel>();\n return {\n retain(key, acquired) {\n if (acquired === undefined) return models.get(key);\n if (acquired.snapshot.kind === 'transport-uncertainty') {\n const previous = models.get(key);\n if (previous !== undefined && previous.identity !== null) return previous;\n }\n models.set(key, acquired);\n return acquired;\n },\n answer(request) {\n return models.get(modelKey(request.locator, request.attached))?.snapshot ?? MODEL_ABSENT;\n },\n keep(locators) {\n for (const key of [...models.keys()]) {\n if (!locators.some((locator) => key.startsWith(`${locator} `))) models.delete(key);\n }\n },\n };\n}\n"],"names":["sha256Hex","MODEL_ABSENT","kind","reason","failedModel","failure","modelKey","locator","attached","heldModel","read","identity","snapshot","version","JSON","stringify","versions","definitions","modelShelf","models","Map","retain","key","acquired","undefined","get","previous","set","answer","request","keep","locators","keys","some","startsWith","delete"],"mappings":"AAMA,SAASA,SAAS,QAAQ,cAAc;AAKxC,OAAO,MAAMC,eAA4B;IAAEC,MAAM;IAAqBC,QAAQ;AAAe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AC,CAAC1B,UAAYe,IAAIY,UAAU,CAAC,GAAG3B,QAAQ,CAAC,CAAC,IAAIY,OAAOgB,MAAM,CAACb;YAChF;QACF;IACF;AACF"}
package/dist/read.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- import type { BootstrapResult, RefreshResult } from '@agentshouse/mdruntime';
1
+ import type { BootstrapPage, BootstrapResult, RefreshResult } from '@agentshouse/mdruntime';
2
2
  import { type TrackedAuthority } from './discovery.js';
3
+ import type { HouseMode } from './transport.js';
4
+ import { type LogPosition } from './version.js';
3
5
  export type HouseManifestFile = {
4
6
  path: string;
5
- revision: string;
7
+ revision: string | undefined;
8
+ version: string;
6
9
  };
7
10
  export type HouseContent = {
8
11
  path: string;
9
12
  content: string;
10
13
  };
11
- export type HouseScope = {
12
- scope: 'room' | 'private';
14
+ export type HouseScope = LogPosition & {
13
15
  anchor: string;
14
- roomHandle: string | undefined;
15
- position: string;
16
16
  files: readonly HouseManifestFile[];
17
17
  contents: readonly HouseContent[];
18
18
  };
@@ -30,7 +30,8 @@ export type HouseChange = {
30
30
  } | {
31
31
  path: string;
32
32
  content: string;
33
- revision: string;
33
+ revision: string | undefined;
34
+ version: string;
34
35
  } | {
35
36
  path: string;
36
37
  reference: {
@@ -38,11 +39,10 @@ export type HouseChange = {
38
39
  };
39
40
  };
40
41
  export type HouseEnumeration = {
41
- authorities: readonly {
42
+ authorities: readonly (LogPosition & {
42
43
  authority: string;
43
- position: string;
44
44
  changes: readonly HouseChange[];
45
- }[];
45
+ })[];
46
46
  };
47
47
  export declare function authorityRoot(handle: string | undefined): string;
48
48
  export declare const ROOM_README = "ROOM.md";
@@ -51,17 +51,21 @@ export declare function contentPrefixes(tracked: TrackedAuthority): readonly str
51
51
  export declare function modelPrefix(tracked: TrackedAuthority, modelRoot: string): string;
52
52
  export declare function parseGrant(body: unknown): HouseGrant | null;
53
53
  export declare function parseEnvelope(body: unknown): HouseEnvelope | null;
54
- export declare function parseEnumeration(body: unknown): HouseEnumeration | null;
54
+ export declare function parseSiteBootstrap(body: unknown): HouseScope | null;
55
+ export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
56
+ export declare function advancedScope(scope: HouseScope, view: HouseEnumeration['authorities'][number]): HouseScope;
55
57
  export declare function matchesScope(scope: HouseScope, tracked: TrackedAuthority): boolean;
56
58
  export declare function withinRoot(path: string, root: string): boolean;
57
59
  export declare function selects(tracked: TrackedAuthority, path: string): boolean;
58
60
  export declare function bootstrapFrom(envelope: HouseEnvelope, tracked: TrackedAuthority): BootstrapResult;
61
+ export declare function bootstrapOf(scope: HouseScope, tracked: TrackedAuthority): BootstrapPage;
59
62
  export type HouseDefinitions = {
60
63
  definitions: Readonly<Record<string, string>>;
61
- revisions: readonly string[];
64
+ versions: readonly string[];
62
65
  };
63
66
  export declare const MODEL_DEFINITION_ADDRESS = "types";
64
67
  export declare function definitionAddress(path: string): string;
65
68
  export declare function definitionsFrom(envelope: HouseEnvelope, tracked: TrackedAuthority, modelRoot: string): HouseDefinitions | null;
69
+ export declare function definitionsOf(scope: HouseScope, modelRoot: string): HouseDefinitions | null;
66
70
  export declare function refreshFrom(enumeration: HouseEnumeration, tracked: TrackedAuthority, fromRoomVersion: string): RefreshResult;
67
71
  //# sourceMappingURL=read.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEjF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,G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