@agentshouse/mdruntime-adapter 0.1.0-alpha.23 → 0.1.0-alpha.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -51,7 +51,7 @@ the same object, so a component can tell what changed by identity. A query is
51
51
  data:
52
52
 
53
53
  - **Filter.** `rooms` names Room locators and defaults to every Room. `types`
54
- names MD Types, and `any` names the untyped Documents. `pathPrefix` is a
54
+ names MD Types, and `any` names untyped Markdown Documents. `pathPrefix` is a
55
55
  directory: `notes` keeps `notes/a.md` and not `notes2/a.md`.
56
56
  - **Fields.** `where` names frontmatter fields, ANDs them, and nests `$and` and
57
57
  `$or`. A bare value is equality; the operators are `$eq`, `$ne`, `$in`, `$nin`,
@@ -68,9 +68,10 @@ data:
68
68
  matching Document of the same Room references. Each keeps a Document once.
69
69
  - **Parts.** A Document query must `select`: `'all'`, or `fields`, `sections`,
70
70
  `preamble`, `markdown` and `backlinks`, where `fields` and `sections` are
71
- `'all'` or a list of names. Room, Path and MD Type always return, and an
72
- unselected part is absent. Select only what a screen shows: a list that selects
73
- the Markdown hears every edit of it.
71
+ `'all'` or a list of names. Room and Path always return; a Markdown Document
72
+ also returns its MD Type. A non-Markdown Document or binary link target returns
73
+ only Room and Path. An unselected part is absent. Select only what a screen
74
+ shows: a list that selects the Markdown hears every edit of it.
74
75
  - **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }`
75
76
  with TanStack DB's own options, and ties end with Room, then Path. `groupBy` by
76
77
  `room`, `type` or `{ field }` answers `{ groups: [{ key, count }] }`, counted
package/dist/actions.js CHANGED
@@ -39,7 +39,7 @@ const CONVERSATION_ROUTES = new Map([
39
39
  ]);
40
40
  export const HOUSE_CONVERSATION_CARDS = {
41
41
  locator: PRIVATE_LOCATOR,
42
- type: 'conversation',
42
+ type: 'house-conversation',
43
43
  identity: 'conversation',
44
44
  agent: 'agent'
45
45
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["/workspace/packages/mdruntime-adapter/src/actions.ts"],"sourcesContent":["import {\n changeBatchIdentity,\n type AcceptedMessage,\n type ActionDeclaration,\n type ActionRequest,\n type ActionResult,\n type ConversationCards,\n type ConversationHistoryPage,\n} from '@agentshouse/mdruntime';\nimport { doorRefusal } from './refusal.js';\nimport { PRIVATE_LOCATOR } from './transport.js';\nimport type { HouseDoorAnswer, HouseTransport } from './transport.js';\n\nconst HISTORY_PAGE = 100;\n\nconst OCTET_STREAM = 'application/octet-stream';\n\nconst CONVERSATION_ROUTES: ReadonlyMap<string, string> = new Map([\n ['conversation.create', '/door/conversations/create'],\n ['conversation.send', '/door/conversations/send'],\n ['conversation.answer', '/door/conversations/interaction/answer'],\n ['conversation.interrupt', '/door/conversations/interrupt'],\n ['conversation.kill', '/door/conversations/kill'],\n ['conversation.cancel', '/door/conversations/cancel'],\n ['conversation.delete', '/door/conversations/delete'],\n ['conversation.history', '/door/conversations/history'],\n]);\n\nexport const HOUSE_CONVERSATION_CARDS: ConversationCards = {\n locator: PRIVATE_LOCATOR,\n type: 'conversation',\n identity: 'conversation',\n agent: 'agent',\n};\n\nexport function declaredActions(routes: readonly string[]): readonly ActionDeclaration[] {\n const mapped = new Map(\n [...CONVERSATION_ROUTES].map(([name, route]) => [route.slice('/door/'.length), name]),\n );\n return routes.map((route) => ({\n name: mapped.get(route) ?? route,\n inputShape: {},\n resultKind: 'house',\n }));\n}\n\nexport function houseAction(\n transport: HouseTransport,\n request: ActionRequest,\n): Promise<ActionResult> {\n if (request.name === 'conversation.send') return sendAction(transport, request.input);\n if (request.name === 'conversation.history') return historyAction(transport, request.input);\n const route = routeOf(request.name);\n if (route === null) return Promise.resolve(malformed());\n return carry(transport, route, request.name, request.input);\n}\n\nfunction routeOf(name: string): string | null {\n const mapped = CONVERSATION_ROUTES.get(name);\n if (mapped !== undefined) return mapped;\n const parts = name.split('/');\n if (parts.some((part) => part === '.' || part === '..')) return null;\n try {\n return `/door/${parts.map(encodeURIComponent).join('/')}`;\n } catch {\n return null;\n }\n}\n\nfunction record(value: unknown): Record<string, unknown> {\n return typeof value === 'object' && value !== null ? (value as Record<string, unknown>) : {};\n}\n\nfunction text(value: unknown, name: string): string | undefined {\n const held = record(value)[name];\n return typeof held === 'string' ? held : undefined;\n}\n\nfunction operationId(input: unknown): string {\n return text(input, 'operation_id') ?? changeBatchIdentity();\n}\n\nfunction malformed(): ActionResult {\n return { kind: 'rejected', code: 'invalid_request', fields: {} };\n}\n\nfunction bodyOf(name: string, input: unknown): unknown {\n if (name === 'conversation.create') {\n return { agent_id: text(input, 'agent_id'), operation_id: operationId(input) };\n }\n if (\n name === 'conversation.interrupt' ||\n name === 'conversation.kill' ||\n name === 'conversation.delete'\n ) {\n return { conversation_id: text(input, 'conversation'), operation_id: operationId(input) };\n }\n if (name === 'conversation.cancel') {\n return {\n conversation_id: text(input, 'conversation'),\n message_id: text(input, 'turn'),\n operation_id: operationId(input),\n };\n }\n if (name === 'conversation.answer') {\n const nested = record(record(input).answer);\n return {\n conversation_id: text(input, 'conversation'),\n operation_id: operationId(input),\n interaction_id: text(nested, 'interaction_id'),\n revision: nested.revision,\n response: nested.response,\n };\n }\n return input;\n}\n\nfunction withTurn(body: unknown): unknown {\n const held = record(body);\n const turn = text(held, 'message_id');\n return turn === undefined ? body : { ...held, turn };\n}\n\nexport function actionOutcome(answer: HouseDoorAnswer, name: string): ActionResult {\n if (answer.status === 401) return { kind: 'revoked-authorization' };\n const refusal = doorRefusal(answer.body);\n if (refusal !== null) {\n return { kind: 'rejected', code: refusal.code, fields: refusal.fields };\n }\n if (answer.status === 404)\n return { kind: 'rejected', code: 'action-unimplemented', fields: { name } };\n if (answer.status === 0 || answer.status >= 400) return { kind: 'transport-uncertainty' };\n if (name === 'conversation.send') return { kind: 'action', result: withTurn(answer.body) };\n return { kind: 'action', result: answer.body };\n}\n\nasync function carry(\n transport: HouseTransport,\n route: string,\n name: string,\n input: unknown,\n): Promise<ActionResult> {\n const answer = await transport.door(route, bodyOf(name, input));\n return actionOutcome(answer, name);\n}\n\nfunction sendFile(entry: unknown): Record<string, unknown> | null {\n const file = record(entry);\n const name = text(file, 'name');\n const bytes = file.byteLength;\n const sha256 = text(file, 'contentHash');\n if (name === undefined || typeof bytes !== 'number' || sha256 === undefined) return null;\n const mediaType = text(file, 'mediaType');\n const width = file.width;\n const height = file.height;\n return {\n name,\n media_type: mediaType !== undefined && mediaType.length > 0 ? mediaType : OCTET_STREAM,\n bytes,\n sha256,\n ...(typeof width === 'number' && typeof height === 'number'\n ? { dimensions: { width, height } }\n : {}),\n };\n}\n\nfunction sendFiles(input: unknown): readonly Record<string, unknown>[] | null {\n const files = record(input).files;\n if (files === undefined) return [];\n if (!Array.isArray(files)) return null;\n const declared: Record<string, unknown>[] = [];\n for (const entry of files) {\n const file = sendFile(entry);\n if (file === null) return null;\n declared.push(file);\n }\n return declared;\n}\n\nfunction sendBody(input: unknown): Record<string, unknown> | null {\n const files = sendFiles(input);\n if (files === null) return null;\n const textValue = text(input, 'text');\n return {\n conversation_id: text(input, 'conversation'),\n operation_id: operationId(input),\n ...(textValue !== undefined && textValue.length > 0 ? { text: textValue } : {}),\n ...(files.length === 0 ? {} : { files }),\n };\n}\n\nasync function fileBytes(file: unknown): Promise<Uint8Array | null> {\n const blob = record(file).blob;\n if (blob === undefined || typeof blob !== 'object' || blob === null) return null;\n if (!('arrayBuffer' in blob) || typeof blob.arrayBuffer !== 'function') return null;\n return new Uint8Array(await (blob as Blob).arrayBuffer());\n}\n\nfunction uploadGrant(\n entry: unknown,\n): { method: 'POST'; operation: string; url: string } | 'absent' | null {\n if (!('upload' in record(entry))) return 'absent';\n const upload = record(record(entry).upload);\n if (upload.method !== 'POST') return null;\n if (typeof upload.operation !== 'string' || typeof upload.url !== 'string') return null;\n return { method: 'POST', operation: upload.operation, url: upload.url };\n}\n\nasync function uploadOriginals(\n transport: HouseTransport,\n input: unknown,\n result: unknown,\n): Promise<ActionResult | null> {\n const originals = record(result).originals;\n if (!Array.isArray(originals) || originals.length === 0) return null;\n const files = Array.isArray(record(input).files) ? (record(input).files as unknown[]) : [];\n for (const [index, entry] of originals.entries()) {\n const grant = uploadGrant(entry);\n if (grant === 'absent') continue;\n if (grant === null) return malformed();\n const bytes = index < files.length ? await fileBytes(files[index]) : null;\n if (bytes === null) {\n return { kind: 'rejected', code: 'conversation_original_descriptor_required', fields: {} };\n }\n const delivered = await transport.transfer({\n act: 'conversation_original_upload',\n method: 'POST',\n url: grant.url,\n body: bytes,\n operation: grant.operation,\n });\n if (delivered.status === 200) continue;\n return actionOutcome(delivered, 'conversation.send');\n }\n return null;\n}\n\nasync function sendAction(transport: HouseTransport, input: unknown): Promise<ActionResult> {\n const body = sendBody(input);\n if (body === null) return malformed();\n const answer = await transport.door('/door/conversations/send', body);\n const outcome = actionOutcome(answer, 'conversation.send');\n if (outcome.kind !== 'action') return outcome;\n const uploaded = await uploadOriginals(transport, input, outcome.result);\n if (uploaded !== null) return uploaded;\n return outcome;\n}\n\ntype HistoryCursor = { accepted_at: string; message_id: string };\n\nfunction historyCursor(value: unknown): HistoryCursor | null {\n const acceptedAt = text(value, 'accepted_at');\n const messageId = text(value, 'message_id');\n if (acceptedAt === undefined || messageId === undefined) return null;\n return { accepted_at: acceptedAt, message_id: messageId };\n}\n\nfunction position(cursor: HistoryCursor): string {\n return JSON.stringify({ accepted_at: cursor.accepted_at, message_id: cursor.message_id });\n}\n\nfunction positionCursor(value: string): HistoryCursor | null {\n try {\n return historyCursor(JSON.parse(value) as unknown);\n } catch {\n return null;\n }\n}\n\nexport function acceptedMessage(entry: unknown): AcceptedMessage | null {\n const cursor = historyCursor(entry);\n if (cursor === null) return null;\n return {\n identity: cursor.message_id,\n turn: cursor.message_id,\n position: position(cursor),\n text: text(entry, 'text') ?? '',\n message: structuredClone(entry),\n };\n}\n\nasync function historyAction(transport: HouseTransport, input: unknown): Promise<ActionResult> {\n const conversationId = text(input, 'conversation');\n if (conversationId === undefined) return malformed();\n const afterValue = text(input, 'after');\n const after = afterValue === undefined ? undefined : positionCursor(afterValue);\n if (after === null) return malformed();\n const answer = await transport.door('/door/conversations/history', {\n conversation_id: conversationId,\n ...(after === undefined ? {} : { after }),\n limit: HISTORY_PAGE,\n });\n const outcome = actionOutcome(answer, 'conversation.history');\n if (outcome.kind !== 'action') return outcome;\n const held = record(outcome.result);\n if (!Array.isArray(held.messages)) return { kind: 'transport-uncertainty' };\n const messages: AcceptedMessage[] = [];\n for (const entry of held.messages) {\n const message = acceptedMessage(entry);\n if (message === null) return { kind: 'transport-uncertainty' };\n messages.push(message);\n }\n const next = held.next === null || held.next === undefined ? undefined : historyCursor(held.next);\n if (next === null) return { kind: 'transport-uncertainty' };\n const page: ConversationHistoryPage = {\n messages,\n ...(next === undefined ? {} : { next: position(next) }),\n };\n return { kind: 'action', result: page };\n}\n"],"names":["changeBatchIdentity","doorRefusal","PRIVATE_LOCATOR","HISTORY_PAGE","OCTET_STREAM","CONVERSATION_ROUTES","Map","HOUSE_CONVERSATION_CARDS","locator","type","identity","agent","declaredActions","routes","mapped","map","name","route","slice","length","get","inputShape","resultKind","houseAction","transport","request","sendAction","input","historyAction","routeOf","Promise","resolve","malformed","carry","undefined","parts","split","some","part","encodeURIComponent","join","record","value","text","held","operationId","kind","code","fields","bodyOf","agent_id","operation_id","conversation_id","message_id","nested","answer","interaction_id","revision","response","withTurn","body","turn","actionOutcome","status","refusal","result","door","sendFile","entry","file","bytes","byteLength","sha256","mediaType","width","height","media_type","dimensions","sendFiles","files","Array","isArray","declared","push","sendBody","textValue","fileBytes","blob","arrayBuffer","Uint8Array","uploadGrant","upload","method","operation","url","uploadOriginals","originals","index","entries","grant","delivered","transfer","act","outcome","uploaded","historyCursor","acceptedAt","messageId","accepted_at","position","cursor","JSON","stringify","positionCursor","parse","acceptedMessage","message","structuredClone","conversationId","afterValue","after","limit","messages","next","page"],"mappings":"AAAA,SACEA,mBAAmB,QAOd,yBAAyB;AAChC,SAASC,WAAW,QAAQ,eAAe;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ions.ts"],"sourcesContent":["import {\n changeBatchIdentity,\n type AcceptedMessage,\n type ActionDeclaration,\n type ActionRequest,\n type ActionResult,\n type ConversationCards,\n type ConversationHistoryPage,\n} from '@agentshouse/mdruntime';\nimport { doorRefusal } from './refusal.js';\nimport { PRIVATE_LOCATOR } from './transport.js';\nimport type { HouseDoorAnswer, HouseTransport } from './transport.js';\n\nconst HISTORY_PAGE = 100;\n\nconst OCTET_STREAM = 'application/octet-stream';\n\nconst CONVERSATION_ROUTES: ReadonlyMap<string, string> = new Map([\n ['conversation.create', '/door/conversations/create'],\n ['conversation.send', '/door/conversations/send'],\n ['conversation.answer', '/door/conversations/interaction/answer'],\n ['conversation.interrupt', '/door/conversations/interrupt'],\n ['conversation.kill', '/door/conversations/kill'],\n ['conversation.cancel', '/door/conversations/cancel'],\n ['conversation.delete', '/door/conversations/delete'],\n ['conversation.history', '/door/conversations/history'],\n]);\n\nexport const HOUSE_CONVERSATION_CARDS: ConversationCards = {\n locator: PRIVATE_LOCATOR,\n type: 'house-conversation',\n identity: 'conversation',\n agent: 'agent',\n};\n\nexport function declaredActions(routes: readonly string[]): readonly ActionDeclaration[] {\n const mapped = new Map(\n [...CONVERSATION_ROUTES].map(([name, route]) => [route.slice('/door/'.length), name]),\n );\n return routes.map((route) => ({\n name: mapped.get(route) ?? route,\n inputShape: {},\n resultKind: 'house',\n }));\n}\n\nexport function houseAction(\n transport: HouseTransport,\n request: ActionRequest,\n): Promise<ActionResult> {\n if (request.name === 'conversation.send') return sendAction(transport, request.input);\n if (request.name === 'conversation.history') return historyAction(transport, request.input);\n const route = routeOf(request.name);\n if (route === null) return Promise.resolve(malformed());\n return carry(transport, route, request.name, request.input);\n}\n\nfunction routeOf(name: string): string | null {\n const mapped = CONVERSATION_ROUTES.get(name);\n if (mapped !== undefined) return mapped;\n const parts = name.split('/');\n if (parts.some((part) => part === '.' || part === '..')) return null;\n try {\n return `/door/${parts.map(encodeURIComponent).join('/')}`;\n } catch {\n return null;\n }\n}\n\nfunction record(value: unknown): Record<string, unknown> {\n return typeof value === 'object' && value !== null ? (value as Record<string, unknown>) : {};\n}\n\nfunction text(value: unknown, name: string): string | undefined {\n const held = record(value)[name];\n return typeof held === 'string' ? held : undefined;\n}\n\nfunction operationId(input: unknown): string {\n return text(input, 'operation_id') ?? changeBatchIdentity();\n}\n\nfunction malformed(): ActionResult {\n return { kind: 'rejected', code: 'invalid_request', fields: {} };\n}\n\nfunction bodyOf(name: string, input: unknown): unknown {\n if (name === 'conversation.create') {\n return { agent_id: text(input, 'agent_id'), operation_id: operationId(input) };\n }\n if (\n name === 'conversation.interrupt' ||\n name === 'conversation.kill' ||\n name === 'conversation.delete'\n ) {\n return { conversation_id: text(input, 'conversation'), operation_id: operationId(input) };\n }\n if (name === 'conversation.cancel') {\n return {\n conversation_id: text(input, 'conversation'),\n message_id: text(input, 'turn'),\n operation_id: operationId(input),\n };\n }\n if (name === 'conversation.answer') {\n const nested = record(record(input).answer);\n return {\n conversation_id: text(input, 'conversation'),\n operation_id: operationId(input),\n interaction_id: text(nested, 'interaction_id'),\n revision: nested.revision,\n response: nested.response,\n };\n }\n return input;\n}\n\nfunction withTurn(body: unknown): unknown {\n const held = record(body);\n const turn = text(held, 'message_id');\n return turn === undefined ? body : { ...held, turn };\n}\n\nexport function actionOutcome(answer: HouseDoorAnswer, name: string): ActionResult {\n if (answer.status === 401) return { kind: 'revoked-authorization' };\n const refusal = doorRefusal(answer.body);\n if (refusal !== null) {\n return { kind: 'rejected', code: refusal.code, fields: refusal.fields };\n }\n if (answer.status === 404)\n return { kind: 'rejected', code: 'action-unimplemented', fields: { name } };\n if (answer.status === 0 || answer.status >= 400) return { kind: 'transport-uncertainty' };\n if (name === 'conversation.send') return { kind: 'action', result: withTurn(answer.body) };\n return { kind: 'action', result: answer.body };\n}\n\nasync function carry(\n transport: HouseTransport,\n route: string,\n name: string,\n input: unknown,\n): Promise<ActionResult> {\n const answer = await transport.door(route, bodyOf(name, input));\n return actionOutcome(answer, name);\n}\n\nfunction sendFile(entry: unknown): Record<string, unknown> | null {\n const file = record(entry);\n const name = text(file, 'name');\n const bytes = file.byteLength;\n const sha256 = text(file, 'contentHash');\n if (name === undefined || typeof bytes !== 'number' || sha256 === undefined) return null;\n const mediaType = text(file, 'mediaType');\n const width = file.width;\n const height = file.height;\n return {\n name,\n media_type: mediaType !== undefined && mediaType.length > 0 ? mediaType : OCTET_STREAM,\n bytes,\n sha256,\n ...(typeof width === 'number' && typeof height === 'number'\n ? { dimensions: { width, height } }\n : {}),\n };\n}\n\nfunction sendFiles(input: unknown): readonly Record<string, unknown>[] | null {\n const files = record(input).files;\n if (files === undefined) return [];\n if (!Array.isArray(files)) return null;\n const declared: Record<string, unknown>[] = [];\n for (const entry of files) {\n const file = sendFile(entry);\n if (file === null) return null;\n declared.push(file);\n }\n return declared;\n}\n\nfunction sendBody(input: unknown): Record<string, unknown> | null {\n const files = sendFiles(input);\n if (files === null) return null;\n const textValue = text(input, 'text');\n return {\n conversation_id: text(input, 'conversation'),\n operation_id: operationId(input),\n ...(textValue !== undefined && textValue.length > 0 ? { text: textValue } : {}),\n ...(files.length === 0 ? {} : { files }),\n };\n}\n\nasync function fileBytes(file: unknown): Promise<Uint8Array | null> {\n const blob = record(file).blob;\n if (blob === undefined || typeof blob !== 'object' || blob === null) return null;\n if (!('arrayBuffer' in blob) || typeof blob.arrayBuffer !== 'function') return null;\n return new Uint8Array(await (blob as Blob).arrayBuffer());\n}\n\nfunction uploadGrant(\n entry: unknown,\n): { method: 'POST'; operation: string; url: string } | 'absent' | null {\n if (!('upload' in record(entry))) return 'absent';\n const upload = record(record(entry).upload);\n if (upload.method !== 'POST') return null;\n if (typeof upload.operation !== 'string' || typeof upload.url !== 'string') return null;\n return { method: 'POST', operation: upload.operation, url: upload.url };\n}\n\nasync function uploadOriginals(\n transport: HouseTransport,\n input: unknown,\n result: unknown,\n): Promise<ActionResult | null> {\n const originals = record(result).originals;\n if (!Array.isArray(originals) || originals.length === 0) return null;\n const files = Array.isArray(record(input).files) ? (record(input).files as unknown[]) : [];\n for (const [index, entry] of originals.entries()) {\n const grant = uploadGrant(entry);\n if (grant === 'absent') continue;\n if (grant === null) return malformed();\n const bytes = index < files.length ? await fileBytes(files[index]) : null;\n if (bytes === null) {\n return { kind: 'rejected', code: 'conversation_original_descriptor_required', fields: {} };\n }\n const delivered = await transport.transfer({\n act: 'conversation_original_upload',\n method: 'POST',\n url: grant.url,\n body: bytes,\n operation: grant.operation,\n });\n if (delivered.status === 200) continue;\n return actionOutcome(delivered, 'conversation.send');\n }\n return null;\n}\n\nasync function sendAction(transport: HouseTransport, input: unknown): Promise<ActionResult> {\n const body = sendBody(input);\n if (body === null) return malformed();\n const answer = await transport.door('/door/conversations/send', body);\n const outcome = actionOutcome(answer, 'conversation.send');\n if (outcome.kind !== 'action') return outcome;\n const uploaded = await uploadOriginals(transport, input, outcome.result);\n if (uploaded !== null) return uploaded;\n return outcome;\n}\n\ntype HistoryCursor = { accepted_at: string; message_id: string };\n\nfunction historyCursor(value: unknown): HistoryCursor | null {\n const acceptedAt = text(value, 'accepted_at');\n const messageId = text(value, 'message_id');\n if (acceptedAt === undefined || messageId === undefined) return null;\n return { accepted_at: acceptedAt, message_id: messageId };\n}\n\nfunction position(cursor: HistoryCursor): string {\n return JSON.stringify({ accepted_at: cursor.accepted_at, message_id: cursor.message_id });\n}\n\nfunction positionCursor(value: string): HistoryCursor | null {\n try {\n return historyCursor(JSON.parse(value) as unknown);\n } catch {\n return null;\n }\n}\n\nexport function acceptedMessage(entry: unknown): AcceptedMessage | null {\n const cursor = historyCursor(entry);\n if (cursor === null) return null;\n return {\n identity: cursor.message_id,\n turn: cursor.message_id,\n position: position(cursor),\n text: text(entry, 'text') ?? '',\n message: structuredClone(entry),\n };\n}\n\nasync function historyAction(transport: HouseTransport, input: unknown): Promise<ActionResult> {\n const conversationId = text(input, 'conversation');\n if (conversationId === undefined) return malformed();\n const afterValue = text(input, 'after');\n const after = afterValue === undefined ? undefined : positionCursor(afterValue);\n if (after === null) return malformed();\n const answer = await transport.door('/door/conversations/history', {\n conversation_id: conversationId,\n ...(after === undefined ? {} : { after }),\n limit: HISTORY_PAGE,\n });\n const outcome = actionOutcome(answer, 'conversation.history');\n if (outcome.kind !== 'action') return outcome;\n const held = record(outcome.result);\n if (!Array.isArray(held.messages)) return { kind: 'transport-uncertainty' };\n const messages: AcceptedMessage[] = [];\n for (const entry of held.messages) {\n const message = acceptedMessage(entry);\n if (message === null) return { kind: 'transport-uncertainty' };\n messages.push(message);\n }\n const next = held.next === null || held.next === undefined ? undefined : historyCursor(held.next);\n if (next === null) return { kind: 'transport-uncertainty' };\n const page: ConversationHistoryPage = {\n messages,\n ...(next === undefined ? {} : { next: position(next) }),\n };\n return { kind: 'action', result: page };\n}\n"],"names":["changeBatchIdentity","doorRefusal","PRIVATE_LOCATOR","HISTORY_PAGE","OCTET_STREAM","CONVERSATION_ROUTES","Map","HOUSE_CONVERSATION_CARDS","locator","type","identity","agent","declaredActions","routes","mapped","map","name","route","slice","length","get","inputShape","resultKind","houseAction","transport","request","sendAction","input","historyAction","routeOf","Promise","resolve","malformed","carry","undefined","parts","split","some","part","encodeURIComponent","join","record","value","text","held","operationId","kind","code","fields","bodyOf","agent_id","operation_id","conversation_id","message_id","nested","answer","interaction_id","revision","response","withTurn","body","turn","actionOutcome","status","refusal","result","door","sendFile","entry","file","bytes","byteLength","sha256","mediaType","width","height","media_type","dimensions","sendFiles","files","Array","isArray","declared","push","sendBody","textValue","fileBytes","blob","arrayBuffer","Uint8Array","uploadGrant","upload","method","operation","url","uploadOriginals","originals","index","entries","grant","delivered","transfer","act","outcome","uploaded","historyCursor","acceptedAt","messageId","accepted_at","position","cursor","JSON","stringify","positionCursor","parse","acceptedMessage","message","structuredClone","conversationId","afterValue","after","limit","messages","next","page"],"mappings":"AAAA,SACEA,mBAAmB,QAOd,yBAAyB;AAChC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,eAAe,QAAQ,iBAAiB;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string>>;
64
64
  versions: readonly string[];
65
65
  };
66
- export declare const MODEL_DEFINITION_ADDRESS = "types";
67
- export declare function definitionAddress(path: string): string;
68
66
  export declare function definitionsFrom(envelope: HouseEnvelope, tracked: TrackedAuthority, modelRoot: string): HouseDefinitions | null;
69
67
  export declare function definitionsOf(scope: HouseScope, modelRoot: string): HouseDefinitions | null;
70
68
  export declare function refreshFrom(enumeration: HouseEnumeration, tracked: TrackedAuthority, fromRoomVersion: string): RefreshResult;
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,SAAS,EAAE,MA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,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAGxE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAIjG;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAmBvF;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,gBAAgB,EACzB,SAAS,EAAE,MAAM,GAChB,gBAAgB,GAAG,IAAI,CAIzB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAa3F;AAED,wBAAgB,WAAW,CACzB,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,gBAAgB,EACzB,eAAe,EAAE,MAAM,GACtB,aAAa,CA8Bf"}
package/dist/read.js CHANGED
@@ -254,10 +254,6 @@ export function bootstrapOf(scope, tracked) {
254
254
  binaryTargets: binaryTargets.sort()
255
255
  };
256
256
  }
257
- export const MODEL_DEFINITION_ADDRESS = 'types';
258
- export function definitionAddress(path) {
259
- return `${MODEL_DEFINITION_ADDRESS}/${path.slice(path.lastIndexOf('/') + 1)}`;
260
- }
261
257
  export function definitionsFrom(envelope, tracked, modelRoot) {
262
258
  const scope = envelope.scopes.find((entry)=>matchesScope(entry, tracked));
263
259
  if (scope === undefined) return null;
@@ -273,8 +269,8 @@ export function definitionsOf(scope, modelRoot) {
273
269
  for (const file of scope.files){
274
270
  if (!withinRoot(file.path, modelRoot)) continue;
275
271
  const content = contents.get(file.path);
276
- const address = definitionAddress(file.path);
277
- if (content === undefined || Object.hasOwn(definitions, address)) return null;
272
+ const address = file.path;
273
+ if (content === undefined) return null;
278
274
  definitions[address] = content;
279
275
  versions.push(`${file.path} ${file.version}`);
280
276
  }
package/dist/read.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["/workspace/packages/mdruntime-adapter/src/read.ts"],"sourcesContent":["import type { BootstrapPage, BootstrapResult, RefreshResult } from '@agentshouse/mdruntime';\nimport { PROVIDER_SELECTION_ROOTS, type TrackedAuthority } from './discovery.js';\nimport type { HouseMode } from './transport.js';\nimport { readPosition, roomVersion, type LogPosition } from './version.js';\n\nexport type HouseManifestFile = {\n path: string;\n revision: string | undefined;\n version: string;\n};\n\nexport type HouseContent = {\n path: string;\n content: string;\n};\n\nexport type HouseScope = LogPosition & {\n anchor: string;\n files: readonly HouseManifestFile[];\n contents: readonly HouseContent[];\n};\n\nexport type HouseEnvelope = {\n scopes: readonly HouseScope[];\n};\n\nexport type HouseGrant = {\n method: 'GET' | 'POST';\n operation: string;\n url: string;\n};\n\nexport type HouseChange =\n | { path: string; removed: true }\n | { path: string; content: string; revision: string | undefined; version: string }\n | { path: string; reference: { revision: string } };\n\nexport type HouseEnumeration = {\n authorities: readonly (LogPosition & {\n authority: string;\n changes: readonly HouseChange[];\n })[];\n};\n\nexport function authorityRoot(handle: string | undefined): string {\n return handle === undefined ? '/private' : `/rooms/${handle}`;\n}\n\nexport const ROOM_README = 'ROOM.md';\n\nexport function selectionRoots(tracked: TrackedAuthority): readonly string[] {\n if (tracked.handle === undefined) {\n return [tracked.collectionRoot, ...PROVIDER_SELECTION_ROOTS];\n }\n return [ROOM_README, tracked.collectionRoot];\n}\n\nexport function contentPrefixes(tracked: TrackedAuthority): readonly string[] {\n const root = authorityRoot(tracked.handle);\n return selectionRoots(tracked)\n .filter((entry) => entry !== ROOM_README)\n .map((entry) => `${root}/${entry}`);\n}\n\nexport function modelPrefix(tracked: TrackedAuthority, modelRoot: string): string {\n return `${authorityRoot(tracked.handle)}/${modelRoot}`;\n}\n\nexport function parseGrant(body: unknown): HouseGrant | null {\n if (typeof body !== 'object' || body === null) return null;\n if (!('transfer' in body) || typeof body.transfer !== 'object' || body.transfer === null) {\n return null;\n }\n const transfer = body.transfer as Record<string, unknown>;\n if (transfer.method !== 'GET' && transfer.method !== 'POST') return null;\n if (typeof transfer.operation !== 'string' || typeof transfer.url !== 'string') return null;\n return { method: transfer.method, operation: transfer.operation, url: transfer.url };\n}\n\nfunction parseFile(value: unknown, mode: HouseMode): HouseManifestFile | null {\n if (typeof value !== 'object' || value === null) return null;\n const file = value as Record<string, unknown>;\n if (typeof file.path !== 'string') return null;\n if (mode === 'site') {\n if (typeof file.sha256 !== 'string') return null;\n return { path: file.path, revision: undefined, version: file.sha256 };\n }\n if (typeof file.revision !== 'string') return null;\n return { path: file.path, revision: file.revision, version: file.revision };\n}\n\nfunction parseScope(value: unknown, mode: HouseMode): HouseScope | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n if (typeof held.manifest !== 'object' || held.manifest === null) return null;\n if (!Array.isArray(held.contents)) return null;\n const manifest = held.manifest as Record<string, unknown>;\n if (manifest.scope !== 'room') return null;\n const at = readPosition(manifest);\n if (typeof manifest.anchor !== 'string' || manifest.anchor.length === 0 || at === null)\n return null;\n if (\n manifest.room_handle !== null &&\n (typeof manifest.room_handle !== 'string' || manifest.room_handle.length === 0)\n )\n return null;\n if (!Array.isArray(manifest.files)) return null;\n const files: HouseManifestFile[] = [];\n for (const entry of manifest.files) {\n const file = parseFile(entry, mode);\n if (file === null) return null;\n files.push(file);\n }\n const contents: HouseContent[] = [];\n for (const entry of held.contents) {\n if (typeof entry !== 'object' || entry === null) return null;\n const content = entry as Record<string, unknown>;\n if (typeof content.path !== 'string' || typeof content.content !== 'string') return null;\n contents.push({ path: content.path, content: content.content });\n }\n return {\n anchor: manifest.anchor,\n ...at,\n files,\n contents,\n };\n}\n\nexport function parseEnvelope(body: unknown): HouseEnvelope | null {\n if (typeof body !== 'object' || body === null) return null;\n if (!('scopes' in body) || !Array.isArray(body.scopes)) return null;\n const scopes: HouseScope[] = [];\n for (const entry of body.scopes) {\n const scope = parseScope(entry, 'credential');\n if (scope === null) return null;\n scopes.push(scope);\n }\n return { scopes };\n}\n\nexport function parseSiteBootstrap(body: unknown): HouseScope | null {\n return parseScope(body, 'site');\n}\n\nfunction parseChange(value: unknown, mode: HouseMode): HouseChange | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n if (typeof held.path !== 'string') return null;\n if (held.removed === true) return { path: held.path, removed: true };\n if (mode === 'site') {\n if (typeof held.content !== 'string' || typeof held.sha256 !== 'string') return null;\n return { path: held.path, content: held.content, revision: undefined, version: held.sha256 };\n }\n if (typeof held.content === 'string' && typeof held.revision === 'string') {\n return {\n path: held.path,\n content: held.content,\n revision: held.revision,\n version: held.revision,\n };\n }\n if (typeof held.reference === 'object' && held.reference !== null) {\n const reference = held.reference as Record<string, unknown>;\n if (typeof reference.revision !== 'string') return null;\n return { path: held.path, reference: { revision: reference.revision } };\n }\n return null;\n}\n\nexport function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null {\n if (typeof body !== 'object' || body === null) return null;\n if (!('authorities' in body) || !Array.isArray(body.authorities)) return null;\n const authorities: HouseEnumeration['authorities'][number][] = [];\n for (const entry of body.authorities) {\n if (typeof entry !== 'object' || entry === null) return null;\n const held = entry as Record<string, unknown>;\n const at = readPosition(held);\n if (typeof held.authority !== 'string' || at === null) return null;\n if (!Array.isArray(held.changes)) return null;\n const changes: HouseChange[] = [];\n for (const change of held.changes) {\n const mapped = parseChange(change, mode);\n if (mapped === null) return null;\n changes.push(mapped);\n }\n authorities.push({ authority: held.authority, ...at, changes });\n }\n return { authorities };\n}\n\nexport function advancedScope(\n scope: HouseScope,\n view: HouseEnumeration['authorities'][number],\n): HouseScope {\n const files = new Map(scope.files.map((file) => [file.path, file]));\n const contents = new Map(scope.contents.map((entry) => [entry.path, entry.content]));\n for (const change of view.changes) {\n files.delete(change.path);\n contents.delete(change.path);\n if ('removed' in change) continue;\n if ('content' in change) {\n files.set(change.path, {\n path: change.path,\n revision: change.revision,\n version: change.version,\n });\n contents.set(change.path, change.content);\n continue;\n }\n const { revision } = change.reference;\n files.set(change.path, { path: change.path, revision, version: revision });\n }\n return {\n ...scope,\n position: view.position,\n logEpoch: view.logEpoch,\n files: [...files.values()],\n contents: [...contents].map(([path, content]) => ({ path, content })),\n };\n}\n\nexport function matchesScope(scope: HouseScope, tracked: TrackedAuthority): boolean {\n return scope.anchor === tracked.authority;\n}\n\nexport function withinRoot(path: string, root: string): boolean {\n return path === root || path.startsWith(`${root}/`);\n}\n\nexport function selects(tracked: TrackedAuthority, path: string): boolean {\n if (tracked.modelRoots.some((root) => withinRoot(path, root))) return false;\n return selectionRoots(tracked).some((root) => withinRoot(path, root));\n}\n\nexport function bootstrapFrom(envelope: HouseEnvelope, tracked: TrackedAuthority): BootstrapResult {\n const scope = envelope.scopes.find((entry) => matchesScope(entry, tracked));\n if (scope === undefined) return { kind: 'room-not-readable', locator: tracked.locator };\n return bootstrapOf(scope, tracked);\n}\n\nexport function bootstrapOf(scope: HouseScope, tracked: TrackedAuthority): BootstrapPage {\n const contents = new Map(scope.contents.map((entry) => [entry.path, entry.content]));\n const documents: Record<string, string> = {};\n const revisions: Record<string, string> = {};\n const binaryTargets: string[] = [];\n for (const file of scope.files) {\n if (!selects(tracked, file.path)) continue;\n if (file.revision !== undefined) revisions[file.path] = file.revision;\n const content = contents.get(file.path);\n if (content === undefined) binaryTargets.push(file.path);\n else documents[file.path] = content;\n }\n return {\n kind: 'bootstrap',\n roomVersion: roomVersion(scope),\n documents,\n revisions,\n binaryTargets: binaryTargets.sort(),\n };\n}\n\nexport type HouseDefinitions = {\n definitions: Readonly<Record<string, string>>;\n versions: readonly string[];\n};\n\nexport const MODEL_DEFINITION_ADDRESS = 'types';\n\nexport function definitionAddress(path: string): string {\n return `${MODEL_DEFINITION_ADDRESS}/${path.slice(path.lastIndexOf('/') + 1)}`;\n}\n\nexport function definitionsFrom(\n envelope: HouseEnvelope,\n tracked: TrackedAuthority,\n modelRoot: string,\n): HouseDefinitions | null {\n const scope = envelope.scopes.find((entry) => matchesScope(entry, tracked));\n if (scope === undefined) return null;\n return definitionsOf(scope, modelRoot);\n}\n\nexport function definitionsOf(scope: HouseScope, modelRoot: string): HouseDefinitions | null {\n const contents = new Map(scope.contents.map((entry) => [entry.path, entry.content]));\n const definitions: Record<string, string> = {};\n const versions: string[] = [];\n for (const file of scope.files) {\n if (!withinRoot(file.path, modelRoot)) continue;\n const content = contents.get(file.path);\n const address = definitionAddress(file.path);\n if (content === undefined || Object.hasOwn(definitions, address)) return null;\n definitions[address] = content;\n versions.push(`${file.path} ${file.version}`);\n }\n return { definitions, versions: versions.sort() };\n}\n\nexport function refreshFrom(\n enumeration: HouseEnumeration,\n tracked: TrackedAuthority,\n fromRoomVersion: string,\n): RefreshResult {\n const view = enumeration.authorities.find((entry) => entry.authority === tracked.authority);\n if (view === undefined) return { kind: 'room-not-readable', locator: tracked.locator };\n if (roomVersion(view) === fromRoomVersion) return { kind: 'still-current' };\n const documents: Record<string, string> = {};\n const revisions: Record<string, string> = {};\n const binaryTargets: string[] = [];\n const removals: string[] = [];\n for (const change of view.changes) {\n if (!selects(tracked, change.path)) continue;\n if ('removed' in change) {\n removals.push(change.path);\n continue;\n }\n if ('content' in change) {\n documents[change.path] = change.content;\n if (change.revision !== undefined) revisions[change.path] = change.revision;\n continue;\n }\n binaryTargets.push(change.path);\n revisions[change.path] = change.reference.revision;\n }\n return {\n kind: 'net-advancement',\n roomVersion: roomVersion(view),\n documents,\n revisions,\n binaryTargets: binaryTargets.sort(),\n removals: removals.sort(),\n };\n}\n"],"names":["PROVIDER_SELECTION_ROOTS","readPosition","roomVersion","authorityRoot","handle","undefined","ROOM_README","selectionRoots","tracked","collectionRoot","contentPrefixes","root","filter","entry","map","modelPrefix","modelRoot","parseGrant","body","transfer","method","operation","url","parseFile","value","mode","file","path","sha256","revision","version","parseScope","held","manifest","Array","isArray","contents","scope","at","anchor","length","room_handle","files","push","content","parseEnvelope","scopes","parseSiteBootstrap","parseChange","removed","reference","parseEnumeration","authorities","authority","changes","change","mapped","advancedScope","view","Map","delete","set","position","logEpoch","values","matchesScope","withinRoot","startsWith","selects","modelRoots","some","bootstrapFrom","envelope","find","kind","locator","bootstrapOf","documents","revisions","binaryTargets","get","sort","MODEL_DEFINITION_ADDRESS","definitionAddress","slice","lastIndexOf","definitionsFrom","definitionsOf","definitions","versions","address","Object","hasOwn","refreshFrom","enumeration","fromRoomVersion","removals"],"mappings":"AACA,SAASA,wBAAwB,QAA+B,iBAAiB;AAEjF,SAASC,YAAY,EAAEC,WAAW,QAA0B,eAAe;AAyC3E,OAAO,SAASC,cAAcC,MAA0B;IACtD,OAAOA,WAAWC,YAAY,aAAa,CAAC,OAAO,EAAED,QAAQ;AAC/D;AAEA,OAAO,MAAME,cAAc,UAAU;AAErC,OAAO,SAASC,eAAeC,OAAyB;IACtD,IAAIA,QAAQJ,MAAM,KAAKC,WAAW;QAChC,OAAO;YAACG,QAAQC,cAAc;eAAKT;SAAyB;IAC9D;IACA,OAAO;QAACM;QAAaE,QAAQC,cAAc;KAAC;AAC9C;AAEA,OAAO,SAASC,gBAAgBF,OAAyB;IACvD,MAAMG,OAAOR,cAAcK,QAAQJ,MAAM;IACzC,OAAOG,eAAeC,SACnBI,MAAM,CAAC,CAACC,QAAUA,UAAUP,aAC5BQ,GAAG,CAAC,CAACD,QAAU,GAAGF,KAAK,CAAC,EAAEE,OAAO;AACtC;AAEA,OAAO,SAASE,YAAYP,OAAyB,EAAEQ,SAAiB;IACtE,OAAO,GAAGb,cAAcK,QAAQJ,MAAM,EAAE,CAAC,EAAEY,WAAW;AACxD;AAEA,OAAO,SAASC,WAAWC,IAAa;IAC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O,CAAE;QACjC,IAAI,CAACc,QAAQ5D,SAAS+C,OAAO5B,IAAI,GAAG;QACpC,IAAI,aAAa4B,QAAQ;YACvByC,SAASrD,IAAI,CAACY,OAAO5B,IAAI;YACzB;QACF;QACA,IAAI,aAAa4B,QAAQ;YACvBsB,SAAS,CAACtB,OAAO5B,IAAI,CAAC,GAAG4B,OAAOX,OAAO;YACvC,IAAIW,OAAO1B,QAAQ,KAAKxB,WAAWyE,SAAS,CAACvB,OAAO5B,IAAI,CAAC,GAAG4B,OAAO1B,QAAQ;YAC3E;QACF;QACAkD,cAAcpC,IAAI,CAACY,OAAO5B,IAAI;QAC9BmD,SAAS,CAACvB,OAAO5B,IAAI,CAAC,GAAG4B,OAAOL,SAAS,CAACrB,QAAQ;IACpD;IACA,OAAO;QACL6C,MAAM;QACNxE,aAAaA,YAAYwD;QACzBmB;QACAC;QACAC,eAAeA,cAAcE,IAAI;QACjCe,UAAUA,SAASf,IAAI;IACzB;AACF"}
1
+ {"version":3,"sources":["/workspace/packages/mdruntime-adapter/src/read.ts"],"sourcesContent":["import type { BootstrapPage, BootstrapResult, RefreshResult } from '@agentshouse/mdruntime';\nimport { PROVIDER_SELECTION_ROOTS, type TrackedAuthority } from './discovery.js';\nimport type { HouseMode } from './transport.js';\nimport { readPosition, roomVersion, type LogPosition } from './version.js';\n\nexport type HouseManifestFile = {\n path: string;\n revision: string | undefined;\n version: string;\n};\n\nexport type HouseContent = {\n path: string;\n content: string;\n};\n\nexport type HouseScope = LogPosition & {\n anchor: string;\n files: readonly HouseManifestFile[];\n contents: readonly HouseContent[];\n};\n\nexport type HouseEnvelope = {\n scopes: readonly HouseScope[];\n};\n\nexport type HouseGrant = {\n method: 'GET' | 'POST';\n operation: string;\n url: string;\n};\n\nexport type HouseChange =\n | { path: string; removed: true }\n | { path: string; content: string; revision: string | undefined; version: string }\n | { path: string; reference: { revision: string } };\n\nexport type HouseEnumeration = {\n authorities: readonly (LogPosition & {\n authority: string;\n changes: readonly HouseChange[];\n })[];\n};\n\nexport function authorityRoot(handle: string | undefined): string {\n return handle === undefined ? '/private' : `/rooms/${handle}`;\n}\n\nexport const ROOM_README = 'ROOM.md';\n\nexport function selectionRoots(tracked: TrackedAuthority): readonly string[] {\n if (tracked.handle === undefined) {\n return [tracked.collectionRoot, ...PROVIDER_SELECTION_ROOTS];\n }\n return [ROOM_README, tracked.collectionRoot];\n}\n\nexport function contentPrefixes(tracked: TrackedAuthority): readonly string[] {\n const root = authorityRoot(tracked.handle);\n return selectionRoots(tracked)\n .filter((entry) => entry !== ROOM_README)\n .map((entry) => `${root}/${entry}`);\n}\n\nexport function modelPrefix(tracked: TrackedAuthority, modelRoot: string): string {\n return `${authorityRoot(tracked.handle)}/${modelRoot}`;\n}\n\nexport function parseGrant(body: unknown): HouseGrant | null {\n if (typeof body !== 'object' || body === null) return null;\n if (!('transfer' in body) || typeof body.transfer !== 'object' || body.transfer === null) {\n return null;\n }\n const transfer = body.transfer as Record<string, unknown>;\n if (transfer.method !== 'GET' && transfer.method !== 'POST') return null;\n if (typeof transfer.operation !== 'string' || typeof transfer.url !== 'string') return null;\n return { method: transfer.method, operation: transfer.operation, url: transfer.url };\n}\n\nfunction parseFile(value: unknown, mode: HouseMode): HouseManifestFile | null {\n if (typeof value !== 'object' || value === null) return null;\n const file = value as Record<string, unknown>;\n if (typeof file.path !== 'string') return null;\n if (mode === 'site') {\n if (typeof file.sha256 !== 'string') return null;\n return { path: file.path, revision: undefined, version: file.sha256 };\n }\n if (typeof file.revision !== 'string') return null;\n return { path: file.path, revision: file.revision, version: file.revision };\n}\n\nfunction parseScope(value: unknown, mode: HouseMode): HouseScope | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n if (typeof held.manifest !== 'object' || held.manifest === null) return null;\n if (!Array.isArray(held.contents)) return null;\n const manifest = held.manifest as Record<string, unknown>;\n if (manifest.scope !== 'room') return null;\n const at = readPosition(manifest);\n if (typeof manifest.anchor !== 'string' || manifest.anchor.length === 0 || at === null)\n return null;\n if (\n manifest.room_handle !== null &&\n (typeof manifest.room_handle !== 'string' || manifest.room_handle.length === 0)\n )\n return null;\n if (!Array.isArray(manifest.files)) return null;\n const files: HouseManifestFile[] = [];\n for (const entry of manifest.files) {\n const file = parseFile(entry, mode);\n if (file === null) return null;\n files.push(file);\n }\n const contents: HouseContent[] = [];\n for (const entry of held.contents) {\n if (typeof entry !== 'object' || entry === null) return null;\n const content = entry as Record<string, unknown>;\n if (typeof content.path !== 'string' || typeof content.content !== 'string') return null;\n contents.push({ path: content.path, content: content.content });\n }\n return {\n anchor: manifest.anchor,\n ...at,\n files,\n contents,\n };\n}\n\nexport function parseEnvelope(body: unknown): HouseEnvelope | null {\n if (typeof body !== 'object' || body === null) return null;\n if (!('scopes' in body) || !Array.isArray(body.scopes)) return null;\n const scopes: HouseScope[] = [];\n for (const entry of body.scopes) {\n const scope = parseScope(entry, 'credential');\n if (scope === null) return null;\n scopes.push(scope);\n }\n return { scopes };\n}\n\nexport function parseSiteBootstrap(body: unknown): HouseScope | null {\n return parseScope(body, 'site');\n}\n\nfunction parseChange(value: unknown, mode: HouseMode): HouseChange | null {\n if (typeof value !== 'object' || value === null) return null;\n const held = value as Record<string, unknown>;\n if (typeof held.path !== 'string') return null;\n if (held.removed === true) return { path: held.path, removed: true };\n if (mode === 'site') {\n if (typeof held.content !== 'string' || typeof held.sha256 !== 'string') return null;\n return { path: held.path, content: held.content, revision: undefined, version: held.sha256 };\n }\n if (typeof held.content === 'string' && typeof held.revision === 'string') {\n return {\n path: held.path,\n content: held.content,\n revision: held.revision,\n version: held.revision,\n };\n }\n if (typeof held.reference === 'object' && held.reference !== null) {\n const reference = held.reference as Record<string, unknown>;\n if (typeof reference.revision !== 'string') return null;\n return { path: held.path, reference: { revision: reference.revision } };\n }\n return null;\n}\n\nexport function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null {\n if (typeof body !== 'object' || body === null) return null;\n if (!('authorities' in body) || !Array.isArray(body.authorities)) return null;\n const authorities: HouseEnumeration['authorities'][number][] = [];\n for (const entry of body.authorities) {\n if (typeof entry !== 'object' || entry === null) return null;\n const held = entry as Record<string, unknown>;\n const at = readPosition(held);\n if (typeof held.authority !== 'string' || at === null) return null;\n if (!Array.isArray(held.changes)) return null;\n const changes: HouseChange[] = [];\n for (const change of held.changes) {\n const mapped = parseChange(change, mode);\n if (mapped === null) return null;\n changes.push(mapped);\n }\n authorities.push({ authority: held.authority, ...at, changes });\n }\n return { authorities };\n}\n\nexport function advancedScope(\n scope: HouseScope,\n view: HouseEnumeration['authorities'][number],\n): HouseScope {\n const files = new Map(scope.files.map((file) => [file.path, file]));\n const contents = new Map(scope.contents.map((entry) => [entry.path, entry.content]));\n for (const change of view.changes) {\n files.delete(change.path);\n contents.delete(change.path);\n if ('removed' in change) continue;\n if ('content' in change) {\n files.set(change.path, {\n path: change.path,\n revision: change.revision,\n version: change.version,\n });\n contents.set(change.path, change.content);\n continue;\n }\n const { revision } = change.reference;\n files.set(change.path, { path: change.path, revision, version: revision });\n }\n return {\n ...scope,\n position: view.position,\n logEpoch: view.logEpoch,\n files: [...files.values()],\n contents: [...contents].map(([path, content]) => ({ path, content })),\n };\n}\n\nexport function matchesScope(scope: HouseScope, tracked: TrackedAuthority): boolean {\n return scope.anchor === tracked.authority;\n}\n\nexport function withinRoot(path: string, root: string): boolean {\n return path === root || path.startsWith(`${root}/`);\n}\n\nexport function selects(tracked: TrackedAuthority, path: string): boolean {\n if (tracked.modelRoots.some((root) => withinRoot(path, root))) return false;\n return selectionRoots(tracked).some((root) => withinRoot(path, root));\n}\n\nexport function bootstrapFrom(envelope: HouseEnvelope, tracked: TrackedAuthority): BootstrapResult {\n const scope = envelope.scopes.find((entry) => matchesScope(entry, tracked));\n if (scope === undefined) return { kind: 'room-not-readable', locator: tracked.locator };\n return bootstrapOf(scope, tracked);\n}\n\nexport function bootstrapOf(scope: HouseScope, tracked: TrackedAuthority): BootstrapPage {\n const contents = new Map(scope.contents.map((entry) => [entry.path, entry.content]));\n const documents: Record<string, string> = {};\n const revisions: Record<string, string> = {};\n const binaryTargets: string[] = [];\n for (const file of scope.files) {\n if (!selects(tracked, file.path)) continue;\n if (file.revision !== undefined) revisions[file.path] = file.revision;\n const content = contents.get(file.path);\n if (content === undefined) binaryTargets.push(file.path);\n else documents[file.path] = content;\n }\n return {\n kind: 'bootstrap',\n roomVersion: roomVersion(scope),\n documents,\n revisions,\n binaryTargets: binaryTargets.sort(),\n };\n}\n\nexport type HouseDefinitions = {\n definitions: Readonly<Record<string, string>>;\n versions: readonly string[];\n};\n\nexport function definitionsFrom(\n envelope: HouseEnvelope,\n tracked: TrackedAuthority,\n modelRoot: string,\n): HouseDefinitions | null {\n const scope = envelope.scopes.find((entry) => matchesScope(entry, tracked));\n if (scope === undefined) return null;\n return definitionsOf(scope, modelRoot);\n}\n\nexport function definitionsOf(scope: HouseScope, modelRoot: string): HouseDefinitions | null {\n const contents = new Map(scope.contents.map((entry) => [entry.path, entry.content]));\n const definitions: Record<string, string> = {};\n const versions: string[] = [];\n for (const file of scope.files) {\n if (!withinRoot(file.path, modelRoot)) continue;\n const content = contents.get(file.path);\n const address = file.path;\n if (content === undefined) return null;\n definitions[address] = content;\n versions.push(`${file.path} ${file.version}`);\n }\n return { definitions, versions: versions.sort() };\n}\n\nexport function refreshFrom(\n enumeration: HouseEnumeration,\n tracked: TrackedAuthority,\n fromRoomVersion: string,\n): RefreshResult {\n const view = enumeration.authorities.find((entry) => entry.authority === tracked.authority);\n if (view === undefined) return { kind: 'room-not-readable', locator: tracked.locator };\n if (roomVersion(view) === fromRoomVersion) return { kind: 'still-current' };\n const documents: Record<string, string> = {};\n const revisions: Record<string, string> = {};\n const binaryTargets: string[] = [];\n const removals: string[] = [];\n for (const change of view.changes) {\n if (!selects(tracked, change.path)) continue;\n if ('removed' in change) {\n removals.push(change.path);\n continue;\n }\n if ('content' in change) {\n documents[change.path] = change.content;\n if (change.revision !== undefined) revisions[change.path] = change.revision;\n continue;\n }\n binaryTargets.push(change.path);\n revisions[change.path] = change.reference.revision;\n }\n return {\n kind: 'net-advancement',\n roomVersion: roomVersion(view),\n documents,\n revisions,\n binaryTargets: binaryTargets.sort(),\n removals: removals.sort(),\n };\n}\n"],"names":["PROVIDER_SELECTION_ROOTS","readPosition","roomVersion","authorityRoot","handle","undefined","ROOM_README","selectionRoots","tracked","collectionRoot","contentPrefixes","root","filter","entry","map","modelPrefix","modelRoot","parseGrant","body","transfer","method","operation","url","parseFile","value","mode","file","path","sha256","revision","version","parseScope","held","manifest","Array","isArray","contents","scope","at","anchor","length","room_handle","files","push","content","parseEnvelope","scopes","parseSiteBootstrap","parseChange","removed","reference","parseEnumeration","authorities","authority","changes","change","mapped","advancedScope","view","Map","delete","set","position","logEpoch","values","matchesScope","withinRoot","startsWith","selects","modelRoots","some","bootstrapFrom","envelope","find","kind","locator","bootstrapOf","documents","revisions","binaryTargets","get","sort","definitionsFrom","definitionsOf","definitions","versions","address","refreshFrom","enumeration","fromRoomVersion","removals"],"mappings":"AACA,SAASA,wBAAwB,QAA+B,iBAAiB;AAEjF,SAASC,YAAY,EAAEC,WAAW,QAA0B,eAAe;AAyC3E,OAAO,SAASC,cAAcC,MAA0B;IACtD,OAAOA,WAAWC,YAAY,aAAa,CAAC,OAAO,EAAED,QAAQ;AAC/D;AAEA,OAAO,MAAME,cAAc,UAAU;AAErC,OAAO,SAASC,eAAeC,OAAyB;IACtD,IAAIA,QAAQJ,MAAM,KAAKC,WAAW;QAChC,OAAO;YAACG,QAAQC,cAAc;eAAKT;SAAyB;IAC9D;IACA,OAAO;QAACM;QAAaE,QAAQC,cAAc;KAAC;AAC9C;AAEA,OAAO,SAASC,gBAAgBF,OAAyB;IACvD,MAAMG,OAAOR,cAAcK,QAAQJ,MAAM;IACzC,OAAOG,eAAeC,SACnBI,MAAM,CAAC,CAACC,QAAUA,UAAUP,aAC5BQ,GAAG,CAAC,CAACD,QAAU,GAAGF,KAAK,CAAC,EAAEE,OAAO;AACt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;QACpC,IAAI,aAAa4B,QAAQ;YACvBmC,SAAS/C,IAAI,CAACY,OAAO5B,IAAI;YACzB;QACF;QACA,IAAI,aAAa4B,QAAQ;YACvBsB,SAAS,CAACtB,OAAO5B,IAAI,CAAC,GAAG4B,OAAOX,OAAO;YACvC,IAAIW,OAAO1B,QAAQ,KAAKxB,WAAWyE,SAAS,CAACvB,OAAO5B,IAAI,CAAC,GAAG4B,OAAO1B,QAAQ;YAC3E;QACF;QACAkD,cAAcpC,IAAI,CAACY,OAAO5B,IAAI;QAC9BmD,SAAS,CAACvB,OAAO5B,IAAI,CAAC,GAAG4B,OAAOL,SAAS,CAACrB,QAAQ;IACpD;IACA,OAAO;QACL6C,MAAM;QACNxE,aAAaA,YAAYwD;QACzBmB;QACAC;QACAC,eAAeA,cAAcE,IAAI;QACjCS,UAAUA,SAAST,IAAI;IACzB;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-adapter",
3
- "version": "0.1.0-alpha.23",
3
+ "version": "0.1.0-alpha.24",
4
4
  "description": "Agents House Adapter for the MD Runtime",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,6 +34,6 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@agentshouse/mdmodel": "0.1.0-alpha.15",
37
- "@agentshouse/mdruntime": "0.1.0-alpha.29"
37
+ "@agentshouse/mdruntime": "0.1.0-alpha.30"
38
38
  }
39
39
  }