@agentshouse/mdruntime-adapter 0.1.0-c9bc183fae1e1 → 0.1.0-c9be7d20acbf4

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.
@@ -74,7 +74,7 @@ export const HOUSE_MODEL_TYPES = `$defs:
74
74
  minProperties: 1
75
75
  maxProperties: 1
76
76
  house-account:
77
- description: "The User's own identifier as \`user\`, their registration as \`created\`, their email verification and chosen language, every notification group with the channels it now reaches as \`notifications\`, \`telegram: available\` while the Building runs its Telegram bots and no Telegram account is linked to it, \`linked\` while one is, \`started\` once that account has also pressed Start in the Inbox bot, \`meta\`, the Building's Meta app as \`application\` and its signup configuration as \`configuration\`, with \`business_app\` where its signup offers to keep the WhatsApp Business app on the number's phone, while it offers Connect Meta, \`tiktok: available\` while it offers Connect TikTok, \`building: administrator\` while the User is one of the Building's administrators, and \`full_house: true\` while the User holds Full House."
77
+ description: "The User's own identifier as \`user\`, their registration as \`created\`, their email verification and chosen language, every notification group with the channels it now reaches as \`notifications\`, \`telegram: available\` while the Building runs its Telegram bots and no Telegram account is linked to it, \`linked\` while one is, \`started\` once that account has also pressed Start in the Inbox bot, \`meta\`, the Building's Meta app as \`application\` and its signup configuration as \`configuration\`, with \`business_app\` where its signup offers to keep the WhatsApp Business app on the number's phone, while it offers Connect Meta, \`tiktok: available\` while it offers Connect TikTok, \`building: administrator\` while the User is one of the Building's administrators, \`full_house: true\` while the User holds Full House, and the Building's caps of an App function's run as \`function_limits\`, its time in milliseconds as \`time_ms\`, its memory in bytes as \`memory_bytes\` and its external calls as \`external_calls\`."
78
78
  properties:
79
79
  reflected: { type: string, format: date-time }
80
80
  user: { $ref: '#/$defs/id' }
@@ -87,7 +87,8 @@ house-account:
87
87
  tiktok: { enum: [ available ] }
88
88
  building: { enum: [ administrator ] }
89
89
  full_house: { const: true }
90
- required: [ reflected, user, email_verified, notifications, created ]
90
+ function_limits: { type: object, additionalProperties: false, properties: { time_ms: { type: integer, exclusiveMinimum: 0 }, memory_bytes: { type: integer, exclusiveMinimum: 0 }, external_calls: { type: integer, exclusiveMinimum: 0 } }, required: [ time_ms, memory_bytes, external_calls ] }
91
+ required: [ reflected, user, email_verified, notifications, created, function_limits ]
91
92
  house-agent:
92
93
  description: One registered Agent this User owns, with the \`profile\` and \`environment\` it binds, when it was \`created\` and, once it is, \`retired\`.
93
94
  properties:
@@ -213,7 +214,7 @@ house-notification:
213
214
  description: "One kept Human Notification for this User: its kind, when it was sent as \`created\`, its way in, its email's subject and each fact of its value that is not sealed, named in snake_case. An entity a fact names is an object holding its identifier under the key of its kind, when the notification carries it, and its \`name\`, \`email\` and other facts beside it; a fact holding null is absent. \`way_in\` is either the House \`path\` it opens or the entity it is about, by its identifier under the key of its kind, a Trigger with its \`room\`. Its body is its email's words in Markdown. Both were worded once, in the User's language when it was delivered; an App may show them or word it itself from its kind and value. Read state belongs to each browser."
214
215
  properties:
215
216
  notification: { $ref: '#/$defs/id' }
216
- kind: { type: string, enum: [ share-offer, join-request, join-request-approved, app-room-binding-incompatible, app-deleted, app-call, room-ownership-offer, managed-environment-retention-opened, managed-environment-placement-intervention, storage-full, sandbox-budget-spent, break-glass-owner-disclosure, routine-start-approval-request, routine-request-declined, routine-request-started, routine-request-finished, routine-request-not-started, export-ready, export-failed, site-disabled, site-binding-incompatible, site-room-left, site-images-full, custom, trigger-did-nothing ] }
217
+ kind: { type: string, enum: [ share-offer, join-request, join-request-approved, app-room-binding-incompatible, app-deleted, app-call, room-ownership-offer, managed-environment-retention-opened, managed-environment-placement-intervention, storage-full, sandbox-budget-spent, break-glass-owner-disclosure, routine-start-approval-request, routine-request-declined, routine-request-started, routine-request-finished, routine-request-not-started, export-ready, export-failed, site-disabled, site-binding-incompatible, site-room-left, site-images-full, custom, trigger-did-nothing, function-failed ] }
217
218
  created: { type: string, format: date-time }
218
219
  way_in: { type: object, additionalProperties: false, properties: { path: { type: string, pattern: ^\\/ }, room: { $ref: '#/$defs/room' }, app: { $ref: '#/$defs/app' }, agent: { $ref: '#/$defs/id' }, environment: { $ref: '#/$defs/id' }, routine: { $ref: '#/$defs/id' }, routine_request: { $ref: '#/$defs/id' }, trigger: { $ref: '#/$defs/id' }, site: { $ref: '#/$defs/id' } }, minProperties: 1 }
219
220
  subject: { type: string }
@@ -266,6 +267,8 @@ house-notification:
266
267
  path: { type: string, maxLength: 4096, pattern: ^\\/.* }
267
268
  trigger: { type: object, additionalProperties: false, properties: { trigger: { $ref: '#/$defs/id' }, name: { type: string } }, required: [ trigger, name ] }
268
269
  cause: { type: string }
270
+ function: { type: string }
271
+ error: { type: string }
269
272
  required: [ notification, kind, created, way_in, subject ]
270
273
  house-ownership-offer:
271
274
  description: One open Room ownership offer addressed to this User. The Room's name and the name of the owner it is \`from\` are captured when the offer is made. The page is the House approval path where this User accepts or declines.
@@ -381,32 +384,33 @@ house-service-key:
381
384
  icon: { type: string, pattern: '^\\/service-keys\\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\/icon$' }
382
385
  required: [ reflected, service_key, room, name, origin, form ]
383
386
  house-share:
384
- description: "One Share this User issued, kept until it expires or is cancelled. An email delivery carries \`share_to\`, the address this User entered; a link delivery never carries the link. Each item names its \`kind\`, \`room\` or \`app\`, the Room or App under that key with its \`name\`, its \`state\`, \`offerable\`, \`held\`, \`accepted\`, \`declined\` or \`superseded\`, for a Room item the \`level\` it grants, the \`operations\` it grants as this User chose them and the Schema Roles its member gets as \`roles\` when it names any, and for an App item the external \`origins\` its latest release declared when this document was written, when it declared any. An App item is never shown \`held\`. Each pack entry names an App item's \`app\`, one of its \`slot\`s, and the \`room\` of the Room item that fills it, with that Room's \`name\`. Each \`join_requests\` entry of a link delivery names one Join request, its \`state\`, \`waiting\`, \`approved\` or \`declined\`, and the User it is \`from\` by account \`email\` and display \`name\` as House held them when this document was written, oldest first; the House approval path of a Join request is \`/approve/\` followed by its identifier."
387
+ description: "One Share this User issued, kept until it expires or is cancelled. An email delivery carries \`share_to\`, the address this User entered, and \`invited\` \`true\` while that address has no account, so House sent it an invitation email; a link delivery never carries the link. Each item names its \`kind\`, \`room\` or \`app\`, the Room or App under that key with its \`name\`, its \`state\`, \`offerable\`, \`held\`, \`accepted\`, \`declined\`, \`superseded\` or \`ended\`, an item the accepted Share could not give being \`ended\` with its \`cause\`, \`offer_changed\` when the recipient's access changed before it was given or \`manage_access_lost\` when this User no longer managed it, for a Room item the \`level\` it grants, the \`operations\` it grants as this User chose them, the access word they earn as \`access\`, \`manage\`, \`edit\`, \`keep\`, \`open\` or \`search\`, with \`only_while_online\` on a \`manage\` or \`edit\` at the Open level, and the Schema Roles its member gets as \`roles\` when it names any, and for an App item the external \`origins\` its latest release declared when this document was written, when it declared any. An App item is never shown \`held\`. Each pack entry names an App item's \`app\`, one of its \`slot\`s, and the \`room\` of the Room item that fills it, with that Room's \`name\`. Each \`join_requests\` entry of a link delivery names one Join request, its \`state\`, \`waiting\`, \`approved\` or \`declined\`, and the User it is \`from\` by account \`email\` and display \`name\` as House held them when this document was written, oldest first; the House approval path of a Join request is \`/approve/\` followed by its identifier."
385
388
  properties:
386
389
  reflected: { type: string, format: date-time }
387
390
  share: { $ref: '#/$defs/id' }
388
391
  share_link: { enum: [ yes, no ] }
389
392
  share_to: { type: string, format: email }
390
- items: { type: array, items: { type: object, additionalProperties: false, properties: { kind: { enum: [ room, app ] }, name: { type: string }, state: { enum: [ offerable, held, accepted, declined, superseded ] }, level: { enum: [ search, open, keep ] }, operations: { type: array, items: { type: string, enum: [ write, delete, export, manageAccess ] } }, roles: { type: array, items: { type: string } }, origins: { type: array, items: { type: string, format: uri } }, room: { $ref: '#/$defs/room' }, app: { $ref: '#/$defs/app' } }, required: [ kind, name, state, operations ] } }
393
+ invited: { const: true }
394
+ items: { type: array, items: { type: object, additionalProperties: false, properties: { kind: { enum: [ room, app ] }, name: { type: string }, state: { enum: [ offerable, held, accepted, declined, superseded, ended ] }, cause: { enum: [ offer_changed, manage_access_lost ] }, level: { enum: [ search, open, keep ] }, operations: { type: array, items: { type: string, enum: [ write, delete, export, manageAccess ] } }, access: { enum: [ manage, edit, keep, open, search ] }, only_while_online: { const: true }, roles: { type: array, items: { type: string } }, origins: { type: array, items: { type: string, format: uri } }, room: { $ref: '#/$defs/room' }, app: { $ref: '#/$defs/app' } }, required: [ kind, name, state, operations ] } }
391
395
  pack: { type: array, items: { type: object, additionalProperties: false, properties: { app: { $ref: '#/$defs/app' }, slot: { type: string, pattern: '^[a-z0-9]([a-z0-9-]*[a-z0-9])?$' }, room: { type: object, additionalProperties: false, properties: { room: { $ref: '#/$defs/room' }, name: { type: string } }, required: [ room, name ] } }, required: [ app, slot, room ] } }
392
396
  join_requests: { type: array, items: { type: object, additionalProperties: false, properties: { join_request: { $ref: '#/$defs/id' }, state: { enum: [ waiting, approved, declined ] }, from: { type: object, additionalProperties: false, properties: { email: { type: string }, name: { type: string } }, required: [ email, name ] } }, required: [ join_request, state, from ] } }
393
397
  created: { type: string, format: date-time }
394
398
  expires: { type: string, format: date-time }
395
399
  required: [ reflected, share, share_link, created, expires ]
396
400
  house-share-offer:
397
- description: "One live Share offered to this User by email while an item of it is still offered, \`from\` its issuer by display \`name\` and account \`email\`. Each item names its \`kind\`, \`room\` or \`app\`, its \`name\`, its \`state\` for this User, \`offerable\`, \`held\`, \`accepted\`, \`declined\` or \`superseded\`, for a Room item the \`level\` it grants and the \`operations\` it grants; it carries no reference. A Room item's access level and operations are the ones its issuer chose for the Room's content; its holder reads the Room's settings at that level, and holds \`manageAccess\` over its document model when it names \`manageAccess\`. A Room item naming Schema Roles names them as \`roles\`, which accepting the Share adds to this User's own in that Room. An App item grants use of the App and never its source, is never shown \`held\`, and names as \`origins\` the external origins its latest release declared when this document was written, when it declared any, which accepting the Share lets its code reach. Each pack entry names an offered \`app\`, one of its \`slot\`s, and the offered \`room\` that fills it, each by \`name\`. Names are as House held them when this document was written. The page is the House approval path where this User accepts or declines the whole Share."
401
+ description: "One live Share offered to this User by email while an item of it is still offered, \`from\` its issuer by display \`name\` and account \`email\`. Each item names its \`kind\`, \`room\` or \`app\`, its \`name\`, its \`state\` for this User, \`offerable\`, \`held\`, \`accepted\`, \`declined\`, \`superseded\` or \`ended\`, an item the accepted Share could not give being \`ended\` with its \`cause\`, \`offer_changed\` when this User's access changed before it was given or \`manage_access_lost\` when its issuer no longer managed it, for a Room item the \`level\` it grants, the \`operations\` it grants and the access word they earn as \`access\`, \`manage\`, \`edit\`, \`keep\`, \`open\` or \`search\`, with \`only_while_online\` on a \`manage\` or \`edit\` at the Open level; it carries no reference. A Room item's access level and operations are the ones its issuer chose for the Room's content; its holder reads the Room's settings at that level, and holds \`manageAccess\` over its document model when it names \`manageAccess\`. A Room item naming Schema Roles names them as \`roles\`, which accepting the Share adds to this User's own in that Room. An App item grants use of the App and never its source, is never shown \`held\`, and names as \`origins\` the external origins its latest release declared when this document was written, when it declared any, which accepting the Share lets its code reach. Each pack entry names an offered \`app\`, one of its \`slot\`s, and the offered \`room\` that fills it, each by \`name\`. Names are as House held them when this document was written. The page is the House approval path where this User accepts or declines the whole Share."
398
402
  properties:
399
403
  reflected: { type: string, format: date-time }
400
404
  share: { $ref: '#/$defs/id' }
401
405
  from: { type: object, additionalProperties: false, properties: { name: { type: string }, email: { type: string, format: email } }, required: [ name, email ] }
402
406
  page: { type: string, pattern: '^\\/approve\\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' }
403
- items: { type: array, items: { type: object, additionalProperties: false, properties: { kind: { enum: [ room, app ] }, name: { type: string }, state: { enum: [ offerable, held, accepted, declined, superseded ] }, level: { enum: [ search, open, keep ] }, operations: { type: array, items: { type: string, enum: [ write, delete, export, manageAccess ] } }, roles: { type: array, items: { type: string } }, origins: { type: array, items: { type: string, format: uri } } }, required: [ kind, name, state, operations ] } }
407
+ items: { type: array, items: { type: object, additionalProperties: false, properties: { kind: { enum: [ room, app ] }, name: { type: string }, state: { enum: [ offerable, held, accepted, declined, superseded, ended ] }, cause: { enum: [ offer_changed, manage_access_lost ] }, level: { enum: [ search, open, keep ] }, operations: { type: array, items: { type: string, enum: [ write, delete, export, manageAccess ] } }, access: { enum: [ manage, edit, keep, open, search ] }, only_while_online: { const: true }, roles: { type: array, items: { type: string } }, origins: { type: array, items: { type: string, format: uri } } }, required: [ kind, name, state, operations ] } }
404
408
  pack: { type: array, items: { type: object, additionalProperties: false, properties: { app: { type: object, additionalProperties: false, properties: { name: { type: string } }, required: [ name ] }, slot: { type: string, pattern: '^[a-z0-9]([a-z0-9-]*[a-z0-9])?$' }, room: { type: object, additionalProperties: false, properties: { name: { type: string } }, required: [ name ] } }, required: [ app, slot, room ] } }
405
409
  created: { type: string, format: date-time }
406
410
  expires: { type: string, format: date-time }
407
411
  required: [ reflected, share, from, page, created, expires ]
408
412
  house-site:
409
- description: "One Site this User owns: its \`name\`, its address under this environment's Site suffix, its own \`app\` with that App's tab icon as a Site shows it, the running \`release\` of that App, which the Site serves, by \`release\` and \`sequence\`, its title and \`intake_room\`, the Intake Room by its \`room\`, whether an operator disabled it, its mode, and every Room slot of that release in its order. Each slot names its \`slot\` and as \`entries\` each Room its list holds, in list order, by its \`room\`, with that entry's address \`segment\` and the last \`compatibility\` outcome of that entry; a slot that lists no Room has no entry. Each finding names its \`slot\`, its \`room\` and one exact structural \`finding\` of that Room against the slot. An incompatible entry stays listed and blocks nothing. \`release\` is absent until that App's first release. \`disabled\` is \`yes\` while an operator holds the Site disabled, and \`disabled_reason\` carries the reason the operator stated; visitors then find the Site unavailable, this User may still change or delete it, and only an operator enables it again. \`mode\` is \`snapshot\` while visitors see the Published Snapshot \`publication\` names, or \`live\` while they see what its Rooms hold as it changes, which needs Full House; only this User changes it. \`unpublished\` is \`yes\` while this User holds the Site unpublished: visitors then find it unavailable at every address and nothing else changes, and only this User's republication serves it again; an operator's enable never does. \`suspended\` is \`yes\` while visitors find the Site unavailable at every address for the reason \`suspended_reason\` names: \`full_house_required\` while the Site is \`live\` and this User lacks Full House, or \`public_delivery_limit\` while what House's server sent for this User's Sites this UTC month has reached this User's Public delivery limit, unless \`public_overage\` is \`on\` while this User holds Full House. A suspension keeps the publication, the addresses, the Custom domains and every act of this User's, and ends by itself at the next UTC month, when this User gains Full House or when \`public_overage\` turns \`on\` while this User holds Full House; it lifts no Unpublish and no operator's disable. \`public_overage\` is \`on\` while this User keeps the Site serving past the Public delivery limit, which it does only while this User holds Full House; what it sends past the limit is charged as overage. It stays \`on\` when Full House ends and acts again when Full House returns. \`publication\` is the Published Snapshot the Site serves, or serves once republished, absent while it holds none. \`acts\` names the publication acts this User may take now: \`unpublish\` while the Site is published, \`republish\` while it is unpublished and holds a publication to serve; Publish data also serves an unpublished Site again, with what its Rooms hold. A cleared title is absent. \`description\` carries presentation. \`screenshot\` is the address of the image House captured of the Site at its primary address after a release, which a shared link to the Site shows, absent before the first capture. \`analytics\` is the owner's measurement ID the Site loads its analytics tag with, absent while unset. \`indexing\` is the search-engines-and-agents switch: while it is \`yes\`, the Site serves its documents as Markdown and lists them in its indexes. \`entry_fallback\` names the last time this release's Entry Data Contract could not serve an Entry Page as HTML: its \`cause\` (\`over_bound\`, \`query_refused\` or \`unavailable\`), the \`route\` and when it was \`recorded\`; that page then started the App as usual. \`external_origins\` names the declared external origins of that release. \`notify_me\` is \`on\` while the Site's notification Trigger is present and enabled in its Intake Room. \`addresses\` lists every address the Site answers at: its address under the Site suffix and each active Custom domain; every address other than \`primary_address\` redirects to it. Each \`domains\` entry names one Custom domain's \`host\`, its \`state\`, \`pending\`, \`active\` or \`failed\`, the DNS alias target its hostname must point at as \`dns_target\`, which is this environment's and the same for every domain, and the edge's \`reason\` when it gives one."
413
+ description: "One Site this User owns: its \`name\`, its address under this environment's Site suffix, its own \`app\`, the tab icon it shows, the one this User set for the Site while \`tab_icon_from\` is \`site\` and that App's while it is \`app\`, the running \`release\` of that App, which the Site serves, by \`release\` and \`sequence\`, its title and \`intake_room\`, the Intake Room by its \`room\`, whether an operator disabled it, its mode, and every Room slot of that release in its order. Each slot names its \`slot\` and as \`entries\` each Room its list holds, in list order, by its \`room\`, with that entry's address \`segment\` and the last \`compatibility\` outcome of that entry; a slot that lists no Room has no entry. Each finding names its \`slot\`, its \`room\` and one exact structural \`finding\` of that Room against the slot. An incompatible entry stays listed and blocks nothing. \`release\` is absent until that App's first release. \`disabled\` is \`yes\` while an operator holds the Site disabled, and \`disabled_reason\` carries the reason the operator stated; visitors then find the Site unavailable, this User may still change or delete it, and only an operator enables it again. \`mode\` is \`snapshot\` while visitors see the Published Snapshot \`publication\` names, or \`live\` while they see what its Rooms hold as it changes, which needs Full House; only this User changes it. \`unpublished\` is \`yes\` while this User holds the Site unpublished: visitors then find it unavailable at every address and nothing else changes, and only this User's republication serves it again; an operator's enable never does. \`suspended\` is \`yes\` while visitors find the Site unavailable at every address for the reason \`suspended_reason\` names: \`full_house_required\` while the Site is \`live\` and this User lacks Full House, or \`public_delivery_limit\` while what House's server sent for this User's Sites this UTC month has reached this User's Public delivery limit, unless \`public_overage\` is \`on\` while this User holds Full House. A suspension keeps the publication, the addresses, the Custom domains and every act of this User's, and ends by itself at the next UTC month, when this User gains Full House or when \`public_overage\` turns \`on\` while this User holds Full House; it lifts no Unpublish and no operator's disable. \`public_overage\` is \`on\` while this User keeps the Site serving past the Public delivery limit, which it does only while this User holds Full House; what it sends past the limit is charged as overage. It stays \`on\` when Full House ends and acts again when Full House returns. \`publication\` is the Published Snapshot the Site serves, or serves once republished, absent while it holds none. \`acts\` names the publication acts this User may take now: \`unpublish\` while the Site is published, \`republish\` while it is unpublished and holds a publication to serve; Publish data also serves an unpublished Site again, with what its Rooms hold. A cleared title is absent. \`description\` carries presentation. \`screenshot\` is the address of the image House captured of the Site at its primary address after a release, which a shared link to the Site shows, absent before the first capture. \`analytics\` is the owner's measurement ID the Site loads its analytics tag with, absent while unset. \`indexing\` is the search-engines-and-agents switch: while it is \`yes\`, the Site serves its documents as Markdown and lists them in its indexes. \`entry_fallback\` names the last time this release's Entry Data Contract could not serve an Entry Page as HTML: its \`cause\` (\`over_bound\`, \`query_refused\` or \`unavailable\`), the \`route\` and when it was \`recorded\`; that page then started the App as usual. \`external_origins\` names the declared external origins of that release. \`notify_me\` is \`on\` while the Site's notification Trigger is present and enabled in its Intake Room. \`addresses\` lists every address the Site answers at: its address under the Site suffix and each active Custom domain; every address other than \`primary_address\` redirects to it. Each \`domains\` entry names one Custom domain's \`host\`, its \`state\`, \`pending\`, \`active\` or \`failed\`, the DNS alias target its hostname must point at as \`dns_target\`, which is this environment's and the same for every domain, and the edge's \`reason\` when it gives one."
410
414
  properties:
411
415
  reflected: { type: string, format: date-time }
412
416
  site: { $ref: '#/$defs/id' }
@@ -421,6 +425,7 @@ house-site:
421
425
  tab_icon_colours: { type: array, items: { type: string, pattern: '^#[0-9a-f]{6}$' } }
422
426
  tab_icon_blend: { enum: [ linear, radial ] }
423
427
  tab_icon_angle: { type: integer, minimum: 0, maximum: 359 }
428
+ tab_icon_from: { enum: [ site, app ] }
424
429
  release: { type: object, additionalProperties: false, properties: { release: { $ref: '#/$defs/id' }, sequence: { type: integer, exclusiveMinimum: 0 } }, required: [ release, sequence ] }
425
430
  title: { type: string }
426
431
  description: { type: string }
@@ -448,9 +453,9 @@ house-site:
448
453
  image_copy_limit_reached: { enum: [ yes, no ] }
449
454
  slots: { type: array, items: { type: object, additionalProperties: false, properties: { slot: { type: string, pattern: '^[a-z0-9]([a-z0-9-]*[a-z0-9])?$' }, entries: { type: array, items: { type: object, additionalProperties: false, properties: { room: { $ref: '#/$defs/room' }, segment: { type: string }, compatibility: { enum: [ unchecked, compatible, incompatible ] } }, required: [ room, segment, compatibility ] } } }, required: [ slot, entries ] } }
450
455
  findings: { type: array, items: { type: object, additionalProperties: false, properties: { slot: { type: string, pattern: '^[a-z0-9]([a-z0-9-]*[a-z0-9])?$' }, room: { $ref: '#/$defs/room' }, finding: { type: string } }, required: [ slot, room, finding ] } }
451
- required: [ reflected, site, name, address, primary_address, app, disabled, mode, unpublished, suspended, public_overage, indexing, created, new_browsers, submissions, notify_me, image_copies, image_copy_bound, image_copy_limit_reached ]
456
+ required: [ reflected, site, name, address, primary_address, app, tab_icon_from, disabled, mode, unpublished, suspended, public_overage, indexing, created, new_browsers, submissions, notify_me, image_copies, image_copy_bound, image_copy_limit_reached ]
452
457
  house-trigger:
453
- description: "One Trigger of this Room as its acts wrote it, which House alone writes: its \`description\`, the \`condition\` it fires on, its \`actions\` in order, whether each action and the Trigger are \`enabled\`, \`paused_by\` \`types\` while a change of the Room's types paused it, its \`creator\` by \`user\` and the \`name\` they had then, and when it was \`created\`. A \`notify\` action reaches the \`users\` its \`to\` names, the members its \`fields\` name in the matched document and the holders of its \`roles\`; a \`routine\` action sends its \`payload\` through its \`routine_access\`. Whether an action's target holds is not written: it follows from the Room's members and the Routine Access."
458
+ description: "One Trigger of this Room as its acts wrote it, which House alone writes: its \`description\`, the \`condition\` it fires on, its \`actions\` in order, whether each action and the Trigger are \`enabled\`, \`paused_by\` \`types\` while a change of the Room's types paused it, its \`creator\` by \`user\` and the \`name\` they had then, and when it was \`created\`. A \`notify\` action reaches the \`users\` its \`to\` names, the members its \`fields\` name in the matched document and the holders of its \`roles\`; a \`routine\` action sends its \`payload\` through its \`routine_access\`; a \`function\` action runs the \`function\` its \`app\`'s latest release declares, on House's servers. Whether an action's target holds is not written: it follows from the Room's members, the Routine Access and the App's latest release."
454
459
  properties:
455
460
  reflected: { type: string, format: date-time }
456
461
  trigger: { $ref: '#/$defs/id' }
@@ -468,6 +473,7 @@ house-trigger:
468
473
  anyOf:
469
474
  - { type: object, additionalProperties: false, properties: { kind: { const: notify }, enabled: { type: boolean }, title: { type: string }, text: { type: string }, to: { type: object, additionalProperties: false, properties: { users: { type: array, items: { type: object, additionalProperties: false, properties: { user: { $ref: '#/$defs/id' } }, required: [ user ] } }, fields: { type: array, items: { type: string } }, roles: { type: array, items: { type: string } } }, required: [ users, fields, roles ] } }, required: [ kind, enabled, title, text, to ] }
470
475
  - { type: object, additionalProperties: false, properties: { kind: { const: routine }, enabled: { type: boolean }, routine_access: { $ref: '#/$defs/id' }, payload: { type: string } }, required: [ kind, enabled, payload ] }
476
+ - { type: object, additionalProperties: false, properties: { kind: { const: function }, enabled: { type: boolean }, app: { $ref: '#/$defs/app' }, function: { type: string } }, required: [ kind, enabled, app, function ] }
471
477
  enabled: { type: boolean }
472
478
  paused_by: { enum: [ types ] }
473
479
  creator: { type: object, additionalProperties: false, properties: { user: { $ref: '#/$defs/id' }, name: { type: string } }, required: [ user, name ] }
package/dist/index.d.ts CHANGED
@@ -6,5 +6,5 @@ export { APP_REFERENCE_PATTERN } from './app-reference.js';
6
6
  export { HOUSE_MODEL_TYPES } from './house-model.js';
7
7
  export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './crockford.js';
8
8
  export { HOUSE_NAMEABLE_ROOM_TYPES, HOUSE_ROOM_TYPES, INBOX_CHANNEL_KINDS, INBOX_CHAT_TYPE, INBOX_MESSAGE_TYPE, type InboxChannelKind, } from './room-types.js';
9
- export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
9
+ export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamed, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
10
10
  //# 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,cAAc,EAAE,WAAW,EAAE,KAAK,WAAW,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AAkB,EAClB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
package/dist/model.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { RoomModels } from '@agentshouse/mdruntime';
2
2
  import type { TrackedAuthority } from './discovery.js';
3
- import { type HouseRoomParts, type HouseScope, type HouseView } from './read.js';
3
+ import { type HouseRoomHead, type HouseScope, type HouseView } from './read.js';
4
4
  import type { HouseMode, HouseStreamEntry } from './transport.js';
5
5
  export declare function partModels(scope: HouseScope, tracked: TrackedAuthority, seen: ReadonlySet<string>, final: boolean): Promise<RoomModels | undefined>;
6
- export declare function manifestedModels(room: HouseRoomParts, tracked: TrackedAuthority): Promise<{
6
+ export declare function manifestedModels(room: HouseRoomHead, tracked: TrackedAuthority): Promise<{
7
7
  readonly models: RoomModels | undefined;
8
8
  readonly seen: string[];
9
9
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAIL,KAAK,cAAc,EAEnB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA0BlE,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gBAAgB,CACpC,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAM/E;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAcjC;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAWjC"}
package/dist/part.d.ts CHANGED
@@ -1,15 +1,14 @@
1
- import type { ScopedRefusal } from '@agentshouse/mdruntime';
2
- export declare const PART_ATTEMPTS = 3;
3
- export declare const PART_UNVERIFIED = "part_unverified";
4
- export type HousePart = {
5
- part: string;
6
- bytes: number;
7
- sha256: string;
1
+ export type RoomFrame = {
2
+ readonly kind: 'frame';
3
+ readonly payload: Uint8Array<ArrayBuffer>;
4
+ readonly bytes: number;
5
+ } | {
6
+ readonly kind: 'ended';
7
+ } | {
8
+ readonly kind: 'broken';
8
9
  };
9
- export declare function parsePart(value: unknown): HousePart | null;
10
- export declare function partArrival(listed: HousePart, arriving: ((bytes: number) => void) | undefined): ((answered: number) => void) | undefined;
11
- export declare function partFrame(body: unknown): Uint8Array<ArrayBuffer> | null;
12
- export declare function checkedPayload(frame: Uint8Array<ArrayBuffer>, listed: HousePart): Promise<Uint8Array<ArrayBuffer> | null>;
10
+ export type RoomFrames = () => Promise<RoomFrame>;
11
+ export declare function checkedPayload(frame: Uint8Array<ArrayBuffer>): Promise<Uint8Array<ArrayBuffer> | null>;
12
+ export declare function roomFrames(room: ReadableStream<Uint8Array>, arrived?: (bytes: number) => void, signal?: AbortSignal): RoomFrames;
13
13
  export declare function gunzipped(payload: Uint8Array<ArrayBuffer>): ReadableStream<string>;
14
- export declare function unverifiedPart(locator: string): ScopedRefusal;
15
14
  //# sourceMappingURL=part.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"part.d.ts","sourceRoot":"","sources":["../src/part.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAO1D;AAoBD,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,GAC9C,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAG1C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAIvE;AAED,wBAAsB,cAAc,CAClC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,EAC9B,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAazC;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAKlF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAS7D"}
1
+ {"version":3,"file":"part.d.ts","sourceRoot":"","sources":["../src/part.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC7F;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEhC,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;AAQlD,wBAAsB,cAAc,CAClC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,GAC7B,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CASzC;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,EAChC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EACjC,MAAM,CAAC,EAAE,WAAW,GACnB,UAAU,CAwDZ;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAKlF"}
package/dist/part.js CHANGED
@@ -1,54 +1,13 @@
1
1
  const PART_MAGIC = 0x48505431;
2
2
  const PART_HEAD_BYTES = 8;
3
3
  const PART_DIGEST_BYTES = 32;
4
- const PART_SHA256 = /^[0-9a-f]{64}$/u;
5
- export const PART_ATTEMPTS = 3;
6
- export const PART_UNVERIFIED = 'part_unverified';
7
- export function parsePart(value) {
8
- if (typeof value !== 'object' || value === null)
9
- return null;
10
- const { part, bytes, sha256 } = value;
11
- if (typeof part !== 'string' || part.length === 0)
12
- return null;
13
- if (typeof bytes !== 'number' || !Number.isSafeInteger(bytes) || bytes <= 0)
14
- return null;
15
- if (typeof sha256 !== 'string' || !PART_SHA256.test(sha256))
16
- return null;
17
- return { part, bytes, sha256 };
18
- }
19
- function decoded(text) {
20
- let binary;
21
- try {
22
- binary = atob(text);
23
- }
24
- catch {
25
- return null;
26
- }
27
- const bytes = new Uint8Array(binary.length);
28
- for (let at = 0; at < binary.length; at += 1)
29
- bytes[at] = binary.charCodeAt(at);
30
- return bytes;
31
- }
32
4
  function hex(bytes) {
33
5
  let text = '';
34
6
  for (const byte of bytes)
35
7
  text += byte.toString(16).padStart(2, '0');
36
8
  return text;
37
9
  }
38
- export function partArrival(listed, arriving) {
39
- if (arriving === undefined)
40
- return undefined;
41
- return (answered) => arriving(Math.min(listed.bytes, Math.floor((answered * 3) / 4)));
42
- }
43
- export function partFrame(body) {
44
- if (typeof body !== 'object' || body === null)
45
- return null;
46
- const { part } = body;
47
- return typeof part === 'string' ? decoded(part) : null;
48
- }
49
- export async function checkedPayload(frame, listed) {
50
- if (frame.length !== listed.bytes)
51
- return null;
10
+ export async function checkedPayload(frame) {
52
11
  if (frame.length < PART_HEAD_BYTES + PART_DIGEST_BYTES)
53
12
  return null;
54
13
  const view = new DataView(frame.buffer, frame.byteOffset, frame.byteLength);
@@ -59,10 +18,69 @@ export async function checkedPayload(frame, listed) {
59
18
  return null;
60
19
  const payload = frame.subarray(PART_HEAD_BYTES, PART_HEAD_BYTES + length);
61
20
  const digest = hex(new Uint8Array(await crypto.subtle.digest('SHA-256', payload)));
62
- if (digest !== listed.sha256 || hex(frame.subarray(PART_HEAD_BYTES + length)) !== digest) {
63
- return null;
21
+ return hex(frame.subarray(PART_HEAD_BYTES + length)) === digest ? payload : null;
22
+ }
23
+ export function roomFrames(room, arrived, signal) {
24
+ const reader = room.getReader();
25
+ signal?.addEventListener('abort', () => void reader.cancel().catch(() => { }), { once: true });
26
+ const chunks = [];
27
+ let held = 0;
28
+ let received = 0;
29
+ let ended = false;
30
+ async function filled(bytes) {
31
+ while (held < bytes && !ended) {
32
+ const read = await reader.read();
33
+ if (read.done) {
34
+ ended = true;
35
+ break;
36
+ }
37
+ chunks.push(read.value);
38
+ held += read.value.byteLength;
39
+ received += read.value.byteLength;
40
+ arrived?.(received);
41
+ }
42
+ return held >= bytes;
64
43
  }
65
- return payload;
44
+ function taken(bytes) {
45
+ const out = new Uint8Array(bytes);
46
+ let at = 0;
47
+ while (at < bytes) {
48
+ const chunk = chunks[0];
49
+ const used = Math.min(chunk.byteLength, bytes - at);
50
+ out.set(chunk.subarray(0, used), at);
51
+ at += used;
52
+ if (used === chunk.byteLength)
53
+ chunks.shift();
54
+ else
55
+ chunks[0] = chunk.subarray(used);
56
+ }
57
+ held -= bytes;
58
+ return out;
59
+ }
60
+ return async () => {
61
+ try {
62
+ if (!(await filled(PART_HEAD_BYTES)))
63
+ return held === 0 ? { kind: 'ended' } : { kind: 'broken' };
64
+ const head = taken(PART_HEAD_BYTES);
65
+ const view = new DataView(head.buffer);
66
+ if (view.getUint32(0) !== PART_MAGIC)
67
+ return { kind: 'broken' };
68
+ const length = view.getUint32(4);
69
+ const rest = length + PART_DIGEST_BYTES;
70
+ if (!(await filled(rest)))
71
+ return { kind: 'broken' };
72
+ const frame = new Uint8Array(PART_HEAD_BYTES + rest);
73
+ frame.set(head, 0);
74
+ frame.set(taken(rest), PART_HEAD_BYTES);
75
+ const payload = await checkedPayload(frame);
76
+ return payload === null
77
+ ? { kind: 'broken' }
78
+ : { kind: 'frame', payload, bytes: frame.byteLength };
79
+ }
80
+ catch {
81
+ return { kind: 'broken' };
82
+ }
83
+ };
66
84
  }
67
85
  export function gunzipped(payload) {
68
86
  return new Blob([payload])
@@ -70,13 +88,3 @@ export function gunzipped(payload) {
70
88
  .pipeThrough(new DecompressionStream('gzip'))
71
89
  .pipeThrough(new TextDecoderStream());
72
90
  }
73
- export function unverifiedPart(locator) {
74
- return {
75
- kind: 'scoped-refusal',
76
- locator,
77
- scope: 'undisclosed',
78
- code: PART_UNVERIFIED,
79
- fields: {},
80
- retryable: true,
81
- };
82
- }
package/dist/read.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { type AdapterFailure, type BinaryFile, type BootstrapInventory, type BootstrapPage, type RefreshResult, type RoomModels, type TransportUncertainty } from '@agentshouse/mdruntime';
1
+ import { type AdapterFailure, type BinaryFile, type BootstrapPage, type RefreshResult, type RoomModels, type TransportUncertainty } from '@agentshouse/mdruntime';
2
2
  import type { TrackedAuthority } from './discovery.js';
3
- import { type HousePart } from './part.js';
4
3
  import type { HouseMode } from './transport.js';
5
4
  import { type LogPosition } from './version.js';
6
5
  export type HeadChange = BootstrapPage['changes'][string];
@@ -50,14 +49,9 @@ export type HouseModels = {
50
49
  files: readonly HouseManifestFile[];
51
50
  contents: readonly HouseContent[];
52
51
  };
53
- export type HouseRoomParts = LogPosition & {
52
+ export type HouseRoomHead = LogPosition & {
54
53
  anchor: string;
55
54
  models: HouseModels;
56
- parts: readonly HousePart[];
57
- };
58
- export type HouseParted = {
59
- rooms: readonly HouseRoomParts[];
60
- next?: string;
61
55
  };
62
56
  export type HouseGrant = {
63
57
  operation: string;
@@ -115,13 +109,14 @@ export declare function headChange(held: {
115
109
  readonly created_at?: unknown;
116
110
  }): HeadChange | undefined | null;
117
111
  export declare function binaryFileOf(held: Readonly<Record<string, unknown>>): BinaryFile | undefined | null;
118
- export declare function parseParted(body: unknown): HouseParted | null;
119
- export declare function parseSiteParted(body: unknown): HouseRoomParts | null;
120
- export declare function partInventory(room: HouseRoomParts): BootstrapInventory;
121
- export declare function manifested(room: HouseRoomParts, inventory: BootstrapInventory, pageToken: string, models: RoomModels | undefined): BootstrapPage;
122
- export declare function modelScope(room: HouseRoomParts): HouseScope;
123
- export declare function emptyScope(room: HouseRoomParts): HouseScope;
124
- export declare function housePart(room: HouseRoomParts, frame: Uint8Array<ArrayBuffer>, listed: HousePart, mode: HouseMode): Promise<HouseScope | TransportUncertainty | null>;
112
+ export declare function roomHead(payload: Uint8Array<ArrayBuffer>, mode: HouseMode): Promise<HouseRoomHead | null>;
113
+ export declare function manifested(room: HouseRoomHead, pageToken: string, models: RoomModels | undefined): BootstrapPage;
114
+ export declare function modelScope(room: HouseRoomHead): HouseScope;
115
+ export declare function emptyScope(room: HouseRoomHead): HouseScope;
116
+ export declare function housePart(room: HouseRoomHead, payload: Uint8Array<ArrayBuffer>, mode: HouseMode): Promise<{
117
+ scope: HouseScope;
118
+ ended: boolean;
119
+ } | TransportUncertainty>;
125
120
  export declare function parseEnumeration(body: unknown, mode: HouseMode): HouseEnumeration | null;
126
121
  export declare function wholeView(first: HouseView, more: (page: HousePage) => Promise<HouseView | PageFailure>): Promise<HouseView | PageFailure>;
127
122
  export declare function bootstrapping(scope: HouseScope): Generator<number, BootstrapPage, void>;
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../src/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAElB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpF,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAQ1D,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,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AAU,CAQ1D;AAsED,wBAAsB,SAAS,CAC7B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,EAChC,IAAI,EAAE,SAAS,GACd,OAAO,CAAC;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,oBAAoB,CAAC,CAKvE;AAgDD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,gBAAgB,GAAG,IAAI,CAiCxF;AAgBD,wBAAsB,SAAS,CAC7B,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,GAC1D,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,CAgClC;AAED,wBAAiB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,CAkBxF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAO9E;AAED,wBAAgB,MAAM,CACpB,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,SAAS,GAAG,SAAS,CAEvB;AA0BD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,SAAS,EACf,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,aAAa,CAAC,CAExB"}
package/dist/read.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { paced, patching, ROW_WEIGHT, stepped, } from '@agentshouse/mdruntime';
2
- import { checkedPayload, gunzipped, parsePart } from './part.js';
2
+ import { gunzipped } from './part.js';
3
3
  import { DECIMAL, readPosition, roomVersion } from './version.js';
4
4
  const REVISION_FILE = /^fr_([0-9a-z]+)\.[0-9a-z]+\.[0-9a-z]$/u;
5
5
  function fileOf(revision) {
@@ -185,14 +185,12 @@ function parseModels(value, mode) {
185
185
  }
186
186
  return { files, contents };
187
187
  }
188
- function parseRoomParts(value, mode) {
188
+ function parseRoomHead(value, mode) {
189
189
  if (typeof value !== 'object' || value === null)
190
190
  return null;
191
191
  const held = value;
192
192
  if (typeof held.manifest !== 'object' || held.manifest === null)
193
193
  return null;
194
- if (!Array.isArray(held.parts))
195
- return null;
196
194
  const models = parseModels(held.models, mode);
197
195
  if (models === null)
198
196
  return null;
@@ -204,44 +202,22 @@ function parseRoomParts(value, mode) {
204
202
  return null;
205
203
  if (typeof manifest.room_handle !== 'string' || manifest.room_handle.length === 0)
206
204
  return null;
207
- const parts = [];
208
- for (const entry of held.parts) {
209
- const part = parsePart(entry);
210
- if (part === null)
211
- return null;
212
- parts.push(part);
213
- }
214
- return { anchor: manifest.anchor, ...at, models, parts };
205
+ return { anchor: manifest.anchor, ...at, models };
215
206
  }
216
- export function parseParted(body) {
217
- if (typeof body !== 'object' || body === null)
218
- return null;
219
- if (!('scopes' in body) || !Array.isArray(body.scopes))
220
- return null;
221
- const rooms = [];
222
- for (const entry of body.scopes) {
223
- const room = parseRoomParts(entry, 'credential');
224
- if (room === null)
225
- return null;
226
- rooms.push(room);
207
+ export async function roomHead(payload, mode) {
208
+ let text = '';
209
+ try {
210
+ for await (const chunk of gunzipped(payload))
211
+ text += chunk;
212
+ return text.endsWith('\n') && text.indexOf('\n') === text.length - 1
213
+ ? parseRoomHead(JSON.parse(text), mode)
214
+ : null;
227
215
  }
228
- if (!('next' in body) || body.next === undefined)
229
- return { rooms };
230
- const next = body.next;
231
- if (typeof next !== 'object' || next === null || typeof next.room !== 'string')
216
+ catch {
232
217
  return null;
233
- return { rooms, next: next.room };
234
- }
235
- export function parseSiteParted(body) {
236
- return parseRoomParts(body, 'site');
237
- }
238
- export function partInventory(room) {
239
- return {
240
- parts: room.parts.length,
241
- bytes: room.parts.reduce((sum, part) => sum + part.bytes, 0),
242
- };
218
+ }
243
219
  }
244
- export function manifested(room, inventory, pageToken, models) {
220
+ export function manifested(room, pageToken, models) {
245
221
  return {
246
222
  kind: 'bootstrap',
247
223
  roomVersion: roomVersion(room),
@@ -249,7 +225,6 @@ export function manifested(room, inventory, pageToken, models) {
249
225
  revisions: {},
250
226
  changes: {},
251
227
  binaryFiles: {},
252
- inventory,
253
228
  pageToken,
254
229
  ...(models === undefined ? {} : { models }),
255
230
  };
@@ -267,6 +242,8 @@ export function emptyScope(room) {
267
242
  };
268
243
  }
269
244
  function partLine(line, mode, read) {
245
+ if (read.ended)
246
+ return false;
270
247
  let entry;
271
248
  try {
272
249
  entry = JSON.parse(line);
@@ -274,6 +251,10 @@ function partLine(line, mode, read) {
274
251
  catch {
275
252
  return false;
276
253
  }
254
+ if (endLine(entry)) {
255
+ read.ended = true;
256
+ return true;
257
+ }
277
258
  if (folderLine(entry)) {
278
259
  read.folders.push(entry.folder);
279
260
  return true;
@@ -290,7 +271,7 @@ function partLine(line, mode, read) {
290
271
  return true;
291
272
  }
292
273
  async function partRead(chunks, mode) {
293
- const read = { files: [], contents: [], folders: [] };
274
+ const read = { files: [], contents: [], folders: [], ended: false };
294
275
  const pace = paced();
295
276
  const unfinished = [];
296
277
  for (let chunk = await chunks.read(); chunk.done !== true; chunk = await chunks.read()) {
@@ -313,17 +294,22 @@ async function partRead(chunks, mode) {
313
294
  }
314
295
  return unfinished.length === 0 ? read : null;
315
296
  }
297
+ function endLine(entry) {
298
+ if (typeof entry !== 'object' || entry === null || !('end' in entry))
299
+ return false;
300
+ return entry.end === true && Object.keys(entry).length === 1;
301
+ }
316
302
  function folderLine(entry) {
317
303
  if (typeof entry !== 'object' || entry === null || !('folder' in entry))
318
304
  return false;
319
305
  return typeof entry.folder === 'string' && Object.keys(entry).length === 1;
320
306
  }
321
- export async function housePart(room, frame, listed, mode) {
322
- const payload = await checkedPayload(frame, listed);
323
- if (payload === null)
324
- return null;
307
+ export async function housePart(room, payload, mode) {
325
308
  const read = await partRead(gunzipped(payload).getReader(), mode).catch(() => null);
326
- return read === null ? { kind: 'transport-uncertainty' } : { ...emptyScope(room), ...read };
309
+ if (read === null)
310
+ return { kind: 'transport-uncertainty' };
311
+ const { ended, ...scope } = read;
312
+ return { scope: { ...emptyScope(room), ...scope }, ended };
327
313
  }
328
314
  function folderChange(value) {
329
315
  if (typeof value !== 'object' || value === null)
@@ -0,0 +1,19 @@
1
+ import type { BootstrapResult, RoomModels } from '@agentshouse/mdruntime';
2
+ import type { TrackedAuthority } from './discovery.js';
3
+ import { type HouseScope } from './read.js';
4
+ import type { HouseMode } from './transport.js';
5
+ export type StreamedPart = {
6
+ readonly scope: HouseScope;
7
+ readonly first: boolean;
8
+ readonly ended: boolean;
9
+ readonly models: RoomModels | undefined;
10
+ readonly pageToken: string | undefined;
11
+ readonly bytes: number;
12
+ };
13
+ export declare function roomStreams(mode: HouseMode): {
14
+ head: (entry: TrackedAuthority, room: ReadableStream<Uint8Array>, arriving: ((bytes: number) => void) | undefined, signal: AbortSignal | undefined) => Promise<BootstrapResult>;
15
+ part: (entry: TrackedAuthority, token: string) => Promise<StreamedPart | Exclude<BootstrapResult, {
16
+ kind: 'bootstrap';
17
+ }>>;
18
+ };
19
+ //# sourceMappingURL=room-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-stream.d.ts","sourceRoot":"","sources":["../src/room-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAuD,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAYhD,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS;kBAKhC,gBAAgB,QACjB,cAAc,CAAC,UAAU,CAAC,YACtB,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,UACvC,WAAW,GAAG,SAAS,KAC9B,OAAO,CAAC,eAAe,CAAC;kBAelB,gBAAgB,SAChB,MAAM,KACZ,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,eAAe,EAAE;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;EAkC3E"}