@agentshouse/mdruntime-adapter 0.1.0-c001b77384778 → 0.1.0-c04b3fdfb64c6

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
@@ -1,7 +1,7 @@
1
1
  # Instructions for the App Creator's agent
2
2
 
3
- These instructions address an agent in an environment with Git. Obtain the App
4
- Repository, change it, build, and push. They are documentation, not enforcement.
3
+ These instructions address an agent in an environment with Git: obtain the App Repository,
4
+ change it, build, and push. They are documentation, not enforcement.
5
5
 
6
6
  ## The MD Runtime API
7
7
 
@@ -13,98 +13,102 @@ statement, the deployment facts and the signed-in member are observations only.
13
13
 
14
14
  The host attaches each port with its reach, and every member and observation answers
15
15
  within it: a Room outside it answers as one the replica does not hold, Rooms lists only
16
- the Rooms reached whole, a Room reached for single Documents shows only those Documents
17
- and the Types of the models that govern them, and without conversations the conversation
18
- members, the chat draft and the conversation observation hold none. A change of the
19
- reach reaches every open observation as its new value, a query keeping unchanged
20
- Documents the same objects.
16
+ the Rooms reached whole, a Room reached for single Documents shows only them and their
17
+ models' Types, and without conversations the conversation members, chat draft and
18
+ observation hold none. A changed reach reaches every open observation as its new value.
21
19
 
22
- Every `observe` resolves, once its first value has arrived, to a handle: `current()` is
23
- the latest complete value, `subscribe(listener)` hears each later value whole and returns
24
- its unsubscribe, and `close()` ends the observation. Closing the port ends every handle
25
- and rejects every pending call and observation; a client that reconnects observes again.
20
+ Every `observe` resolves, once its first value arrived, to a handle: `current()` is the
21
+ latest complete value, `subscribe(listener)` hears each later value whole and returns its
22
+ unsubscribe, and `close()` ends it. Closing the port ends every handle and rejects every
23
+ pending call and observation; a reconnected client observes again.
26
24
 
27
25
  `observe('agents')` answers every Agent a new conversation can go to, each `{ identity,
28
- name }`, whether or not it has a conversation yet. Each conversation the Provider's
29
- conversation list names is held complete in the browser. `conversation.list()` and
30
- `observe('conversations')` answer each with its Agent's identity and name, its name,
31
- created and finished times, last outcome and live `state`: `asking` while a question
32
- waits, `working` while a turn runs, else `idle`, and `started`, when the running turn
33
- began, or `null`. Observe one with `observe('conversation', id, { limit })`: the view
34
- holds a window of its latest `limit` messages, or all of them, oldest first, its chat
35
- draft, and what the Provider streams for it whether or not anything views it: the
36
- running `turn` with its message parts and its context in use and window, the open
37
- questions, the process state, and the CLI's commands and options. These live only in
38
- memory: the message accepted under the turn's id replaces the running turn, and none of
39
- them is stored or searchable. `chatDraft.write` and `chatDraft.discard` keep what the
40
- App Creator composes; sending it is a Provider Action that needs the Provider reachable
41
- and is never queued. A new conversation's chat draft is the one keyed `new:<Agent
26
+ name }`, with a conversation yet or not. Each conversation the Provider lists is held
27
+ complete in the browser. `conversation.list()` and `observe('conversations')` answer each
28
+ with its Agent's identity and name, its name, created and finished times, last outcome,
29
+ live `state` (`asking` while a question waits, `working` while a turn runs, else `idle`)
30
+ and `started`, when the running turn began, or `null`. `observe('conversation', id, {
31
+ limit, total: true })` holds its latest `limit` messages, at most 1,000, oldest first,
32
+ `total` their count, and `next` while older ones exist, which `after` takes, there or in
33
+ `conversation.read(id, { limit, after })`, for the window before; its chat draft; and,
34
+ only in memory, what the Provider streams whether or not anything views it: the running
35
+ `turn` with its parts and its context in use and window, which the message accepted under
36
+ the turn's id replaces, the open questions, the process state, and the CLI's commands and
37
+ options, none stored or searchable. `chatDraft.write` and `chatDraft.discard` keep what
38
+ the App Creator composes, and `chatDraft.prepend(conversation, draft)` puts a message that
39
+ came back ahead of the chat draft as it stands, its text on a line before and its files
40
+ first, so what another tab typed meanwhile stays: never write back a draft read before; sending it is a Provider Action that needs the Provider
41
+ reachable and is never queued. A new conversation's chat draft is keyed `new:<Agent
42
42
  identity>`: no conversation list removes it, a retired Agent's goes, and the first answer
43
43
  to `conversation.create({ agent_id, operation_id })` moves it to the created conversation,
44
44
  where `conversation.send(conversation)` sends it; a replay of that create moves nothing.
45
45
 
46
- A binary file at a Path is a binary Path entry. Query lists it by `path`, and History
47
- each of its revisions, with its `binaryFile` record and never its bytes: `{ state:
48
- 'accepted', revision, path, fileRef, byteLength, mediaType, sha256 }`, or, from a Save
49
- until the Provider accepts it, `{ state: 'pending', localId, path, byteLength,
50
- mediaType, sha256 }`. Write one with a Room Draft whose only part is `file: { blob }`,
51
- the `Blob`'s `type` its media type: Save keeps the bytes in its Pending Change, offline
52
- too, and acceptance gives the record the Provider's revision. Move or remove one as a
53
- Document, a pending one before or after Save too, its bytes following; once its Pending
54
- Change has gone to the Provider, Save refuses that as `unknown-revision` until it is
55
- accepted. `binaryFile.read(room, path, revision?)` answers a pending record's saved
56
- bytes, or asks the Provider again on every read of an accepted one or of a History
57
- revision, a removed file's last included, keeping nothing. Text, a Record attachment or
58
- a conversation message may name a file by its `fileRef`; read it with
59
- `binaryFile.readReference({ fileRef, referrer })`, the referrer being the `referrer` the
60
- Provider gave beside it, or `{ room, path }` of the document whose text names it. Both
61
- answer `{ kind: 'binary', blob }` or a refusal or failure.
46
+ Presentation State is one value per App, kept in the browser and shared by its tabs:
47
+ `presentation.read()` answers it, `null` before anything is kept,
48
+ `observe('presentation')` hears it whole, `presentation.write(value)` replaces it whole,
49
+ and `presentation.edit(members)` sets each member named, or removes one named `null`, in
50
+ the state as it stands, so tabs changing different members never lose each other's change:
51
+ never write back a value read before. Each rejects when the browser does not keep the
52
+ change, and no tab sees it then.
53
+
54
+ A binary file at a Path is a binary Path entry. Query lists it by `path`, and History each
55
+ of its revisions, with its `binaryFile` record and never its bytes: `{ state: 'accepted',
56
+ revision, path, fileRef, byteLength, mediaType, sha256 }`, or, from a Save until the
57
+ Provider accepts it, `{ state: 'pending', localId, path, byteLength, mediaType, sha256 }`.
58
+ Write one with a Room Draft whose only part is `file: { blob }`, the `Blob`'s `type` its
59
+ media type: Save keeps the bytes in its Pending Change, offline too, and acceptance gives
60
+ the record the Provider's revision. Move or remove one as a Document, a pending one too,
61
+ its bytes following; once its Pending Change has gone to the Provider, Save refuses that
62
+ as `unknown-revision` until it is accepted. `binaryFile.read(room, path, revision?)`
63
+ answers a pending record's saved bytes, or asks the Provider on every read of an accepted
64
+ one or a History revision, a removed file's last included, keeping nothing. Text, a Record
65
+ attachment or a conversation message may name a file by its `fileRef`; read it with
66
+ `binaryFile.readReference({ fileRef, referrer })`, the `referrer` the Provider gave beside
67
+ it, or `{ room, path }` of the document whose text names it. Both answer
68
+ `{ kind: 'binary', blob }` or a refusal or failure.
62
69
 
63
70
  Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never touch the
64
- network. History, the binary file reads and Call go to the Provider through the Adapter.
65
- Call takes the Action names the Adapter declares; any other name answers `undeclared`
66
- without reaching the Provider. A Call result whose effect the Provider places in a Room
67
- carries `at`, that Room and Room Version; `reached(room, roomVersion)` answers whether
68
- the Room's confirmed state has reached it, and the MD Runtime keeps refreshing that Room
69
- until it has; `reached(room, roomVersion, path)` answers whether the held confirmed copy
70
- of that document was written at a later Room Version. Each History revision names its
71
- author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`. History of a Path no
72
- current document holds answers the removed document's revisions with `deleted: true`,
73
- newest first; that revision is what a link to the Path opens. Every member of the client
74
- is asynchronous. Results are detached snapshots. Nothing in this surface returns the
75
- authorization, performs a request the App's code composes, or exposes the browser store.
71
+ network; History, the binary file reads and Call go to the Provider through the Adapter.
72
+ Call takes the Action names the Adapter declares, any other answering `undeclared`. A Call
73
+ result whose effect the Provider places in a Room carries `at`, that Room and Room
74
+ Version: `reached(room, roomVersion)` answers whether the Room's confirmed state has
75
+ reached it, refreshing the Room until it has, and `reached(room, roomVersion, path)`
76
+ whether the held copy of that document was written later. A History revision names its
77
+ author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`; History of a Path no
78
+ document holds answers the removed document's revisions, newest first, with `deleted:
79
+ true`, which a link to the Path opens. Every member is asynchronous and every result a
80
+ detached snapshot; nothing returns the authorization, performs a request the App's code
81
+ composes, or exposes the browser store.
76
82
 
77
83
  Every refusal and failure carries `code` and `retryable`: each Call and History answer
78
- other than its result, a refused Save or Room Draft write, a returned Room Draft's
79
- reason, a Room's refusal and the Connection Refusal, and every error a member rejects
80
- with, beside its message. A Provider refusal carries the Provider's own `retryable`.
81
- Every code and every value the API answers is open: handle one you do not know by its
82
- `code` and `retryable`. Only a tag telling which fields a value carries, such as an
83
- answer's `kind`, is closed so it narrows: keep a branch for a tag you do not know. A
84
- model with no usable types answers `types: null`, whatever its `status`.
84
+ other than its result, a refused Save or Room Draft write, a returned Room Draft's reason,
85
+ a Room's refusal, the Connection Refusal and every error a member rejects with, beside its
86
+ message, a Provider refusal with the Provider's own `retryable`. Every code and value is
87
+ open: handle one you do not know by its `code` and `retryable`. Only a tag telling which
88
+ fields a value carries, such as `kind`, is closed: keep a branch for one you do not know.
89
+ A model with no usable types answers `types: null`.
85
90
 
86
91
  Read the deployment facts with `observe('deployment-facts')`, an opaque value the host's
87
- contract interprets. `observe('member')` answers who uses the App: the User the Provider
88
- signed in, `{ kind: 'user', id, name }` in the shape of a change's `author`, so a
89
- Document whose `change.author.id` equals its `id` is that User's own. It is `null` until
90
- the Provider first names one, and where it names none, such as a Site. The MD Runtime
91
- keeps it with the Local Replicas, so it answers offline once known, and every port hears
92
- the next member the Provider names; signing out answers `null`, then ends the
93
- observation with the authorization. It is the only way App code learns who uses it.
92
+ contract interprets. `observe('member')` answers who uses the App, the only way App code
93
+ learns it: the User the Provider signed in, `{ kind: 'user', id, name }` like a change's
94
+ `author`, so a Document whose `change.author.id` is its `id` is that User's own; `null`
95
+ until the Provider first names one, and where it names none, such as a Site. It is kept
96
+ with the Local Replicas, answers offline once known, and every port hears the next member
97
+ named; signing out answers `null`, then ends the observation with the authorization.
94
98
 
95
99
  ## Local Query rules
96
100
 
97
- `query(q)` answers once from local state; `observe('query', q)` holds the whole result
98
- and hears it again only when it changes, keeping every unchanged Document the same
99
- object, so a component can tell what changed by identity. An answer is complete or
100
- pending: `{ documents, coverage }` or `{ groups, coverage }` is complete for the Rooms
101
- its `coverage` names, and `{ pending }` names each Room not yet acquired or prepared,
102
- `[{ room, awaits }]`. Never read a pending answer as empty: draw it as loading, and
103
- observe the query to hear the complete one. A query is data:
101
+ `query(q)` answers once from local state; `observe('query', q)` holds the whole result and
102
+ hears it again only when it changes, keeping every unchanged Document the same object, so
103
+ a component can tell what changed by identity. `{ documents, coverage }` or `{ groups,
104
+ coverage }` is complete for the Rooms its `coverage` names, and `{ pending }` names each
105
+ Room not yet acquired or prepared, `[{ room, awaits }]`: never read it as empty, draw it
106
+ as loading and observe the query to hear the complete answer. A query is data:
104
107
 
105
108
  - **Filter.** `rooms` names Room locators and defaults to every Room. `types` names MD
106
- Types, and `any` names untyped Markdown Documents. `pathPrefix` is a directory:
107
- `notes` keeps `notes/a.md` and not `notes2/a.md`.
109
+ Types, and `any` names untyped Markdown Documents. `pathPrefix` is a directory: `notes`
110
+ keeps `notes/a.md` and not `notes2/a.md`; `folder` keeps only what lies directly in it.
111
+ `paths` keeps only the Paths it names: read named Documents so, never from a list.
108
112
  - **Fields.** Every frontmatter value is named by JSON Pointer: `/status`,
109
113
  `/shipping/city`, `~1` for a `/` and `~0` for a `~` in a key. A segment that meets a
110
114
  list applies to every item and a number names one item. `where` names pointers, ANDs
@@ -121,187 +125,181 @@ observe the query to hear the complete one. A query is data:
121
125
  Room. `backlinks: { field, types, where, pathPrefix }` keeps Documents that a matching
122
126
  Document of the same Room references. Each keeps a Document once.
123
127
  - **Parts.** A Document query must `select`: `'all'`, or `fields`, `sections`,
124
- `preamble`, `markdown`, `backlinks`, `change` and `fileId`, where `fields` is `'all'` or a list
125
- of pointers and `sections` `'all'` or a list of names. Selected pointers return the
126
- frontmatter holding only them, nested as written. A backlink names the referring Path,
127
- MD Type and the pointer it came from as `field`. Room and Path always return; a
128
- Markdown Document also returns its MD Type. A non-Markdown Document returns only Room
129
- and Path, and a binary Path entry Room, Path and its `binaryFile` record, each with its
130
- `fileId` when that is selected. An unselected part is absent. Select only what a screen shows: a list that
131
- selects the Markdown hears every edit of it.
132
- - **Change.** `change` is `{ author, time }` of the Document's head revision as the
133
- Provider last delivered it: `author` is `{ kind: 'user' | 'site', id, name }` or `null`
134
- for a write the Provider made itself, and `time` is the Provider's ISO 8601 change
135
- time. It is `null` where the Provider delivered no time, as at a Site. An unsent edit
136
- or move keeps it, an unsent creation has none, and a saved write takes the Provider's
137
- own once it is Accepted. A Room's last change is its Document with the latest `time`.
138
- - **File ID.** `fileId` is the Provider's Stable File ID of the file at the Path, for a
139
- Path-only result too, or `null` where the Provider supplies none. An unsent edit keeps
140
- it, an unsent move carries it to the new Path, and an unsent creation has none until it
141
- is Accepted, so a file ID that leaves one Path for another is the same file moved.
142
- - **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }` with
143
- TanStack DB's own options, and ties end with Room, then Path. `groupBy` by `room`,
144
- `type` or `{ field }` answers `{ groups: [{ key, count }] }`, counted over every match
145
- and ordered by `count` or a key. A sort or group takes only a pointer that holds one
146
- value. `limit` bounds the Documents or the groups.
147
- - **Results and errors.** A result carries no Room Version: read freshness from Rooms
148
- and Sync Status. `coverage` names each Room read as `{ room, generation, current }`,
149
- `current` false while a newer copy of that Room is being fetched, and the queued
150
- changes it includes as `overlay`; a Save in a Room changes the `overlay` of every
151
- query over it. An invalid query fails with the `code` `invalid-query`, `unknown-type`,
152
- `unknown-field` or `wrong-kind`, naming where, and never answers empty in its place.
128
+ `preamble`, `markdown`, `backlinks`, `change` and `fileId`, where `fields` is `'all'`
129
+ or a list of pointers and `sections` `'all'` or a list of names. Selected pointers
130
+ return the frontmatter holding only them, nested as written. A backlink names the
131
+ referring Path, MD Type and the pointer it came from as `field`. Room and Path always
132
+ return; a Markdown Document also returns its MD Type, and at most its first 1,000
133
+ backlinks: a query on the referring field reads the rest. A non-Markdown Document
134
+ returns only Room, Path and a selected `fileId`, and a binary Path entry its
135
+ `binaryFile` record too. An unselected part is absent. Select only what a screen shows:
136
+ a list that selects the Markdown hears every edit of it.
137
+ - **Change and file ID.** `change` is `{ author, time }` of the Document's head revision
138
+ as the Provider last delivered it: `author` is `{ kind: 'user' | 'site', id, name }`, or
139
+ `null` for a write the Provider made itself, and `time` its ISO 8601 change time, or the
140
+ whole change `null` where it delivered no time, as at a Site. `fileId` is the Provider's
141
+ Stable File ID of the file at the Path, or `null`. An unsent edit keeps both, an unsent
142
+ move keeps the change and carries the file ID to the new Path, so a file ID that leaves
143
+ one Path for another is the same file moved, and an unsent creation has neither until it
144
+ is Accepted. A Room's last change is its Document with the latest `time`.
145
+ - **Order and groups.** `orderBy` sorts by `room`, `path`, `type`, `folder` or `{ field }`
146
+ with TanStack DB's own options; ties end with Room, then Path. `groupBy` by `room`,
147
+ `type`, `folder` or `{ field }` answers `{ groups: [{ key, count }] }`, counted over every
148
+ match and ordered by `count` or a key. A sort or group takes only a single-value pointer.
149
+ `limit`, at most 1,000 whatever a query names, bounds the Documents or the groups, and a
150
+ result it cuts short names `next`: the same query with it as `after` reads the next
151
+ window, in the same order, ties included. `total: true` adds `total`, every match's
152
+ count. An observed window hears rows entering, leaving or changing, and `next`, `total`.
153
+ - **Results and errors.** A result carries no Room Version: read freshness from Rooms and
154
+ Sync Status. `coverage` names each Room read as `{ room, generation, current }`,
155
+ `current` false while a newer copy of that Room is being fetched, and the queued changes
156
+ it includes as `overlay`, which a Save in the Room changes. An invalid query fails with
157
+ `invalid-query`, `unknown-type`, `unknown-field` or `wrong-kind`, never an empty answer.
153
158
 
154
159
  ## Local Search rules
155
160
 
156
- `search({ text, documents, conversations, limit })` answers once, by words, from local
157
- state, with MiniSearch's defaults. There is no observed search.
158
-
159
- - **Declaration.** Only an App whose release declares Local Search searches, and its
160
- first readiness waits for its index. Any other App's `search` answers the `undeclared`
161
- refusal `search-undeclared`, its `fields` naming `local_search` and never retryable.
162
- - **What is found.** A Document by its field values, its sections' headings and text,
163
- its preamble and its Path; a message by its text. Frontmatter keys, Room Drafts, chat
164
- drafts and a running turn's parts are never found. There are no phrases, word forms,
165
- typo tolerance or prefix matching.
166
- - **Narrowing.** `documents` is a Local Query filter: `rooms`, `types`, `where`,
167
- `pathPrefix`, `hop` and `backlinks`. `conversations` names conversations. Both apply
168
- before `limit`, which bounds each list; without it every hit returns.
169
- - **Results.** `{ documents, messages, coverage }`, or the same with `pending` naming
170
- each Room or conversation the search waits for while its index is prepared: show its
171
- hits, ask again, and never read pending as no hits. `coverage` names the Rooms and
172
- conversations searched. Each
173
- list is ranked by `score`, which compares hits of one list of one search. A Document
174
- hit names its `room`, `path` and `type`, a message hit its `conversation` and
175
- `identity`, and `matches` maps each matched word to the parts it matched in: `fields`,
176
- `sections`, `preamble` or `path`, or `text`. A hit carries no position; mark the words
177
- in the text you show. An invalid filter fails with its Local Query error.
161
+ `search({ text, documents, collection, conversations, limit, after, total })` answers
162
+ once, by words, from local state, with MiniSearch's defaults. There is no observed search.
163
+
164
+ - **Declaration.** Only an App whose release declares Local Search searches, its first
165
+ readiness waiting for its index; any other App's `search` answers the never retryable
166
+ `undeclared` refusal `search-undeclared`, its `fields` naming `local_search`.
167
+ - **What is found.** A Document by its field values, its sections' headings and text, its
168
+ preamble and its Path, and a message by its text, never a frontmatter key, a Room Draft,
169
+ a chat draft or a running turn's parts, with no phrases, word forms, typo tolerance or
170
+ prefix matching.
171
+ - **Narrowing.** `documents` is a Local Query filter, and `collection: true` leaves out
172
+ what each Room's `typedSelection` roots hold; `conversations` names conversations. All
173
+ apply before `limit`, which bounds each list, at most 1,000 whatever a search names. A
174
+ complete answer it cuts short names `next`, which `after` takes for the next window of
175
+ both lists. `total: true` adds `total`, each list's count.
176
+ - **Results.** `{ documents, messages, coverage }`, or the same with `pending` naming each
177
+ Room or conversation the search still waits for: show its hits, ask again, and never
178
+ read pending as no hits. `coverage` names the Rooms and conversations searched. Each
179
+ list is ranked by `score`, comparable only within it; ties come by `room`, then `path`,
180
+ or by `conversation`, then `identity`. A Document hit names its `room`, `path` and
181
+ `type`, a message hit its `conversation` and `identity`; `matches` maps each matched
182
+ word to the parts it matched in: `fields`, `sections`, `preamble`, `path` or `text`. A
183
+ hit carries no position: mark the words you show. A bad filter fails as a query does.
178
184
 
179
185
  ## Room Draft, Save, and outcome rules
180
186
 
181
- The MD Runtime owns one Room Draft per Room and Path, shared by every App and tab. It is
182
- durable: it survives reload and navigation. A Room that Discovery stops listing takes its
183
- Room Drafts and its queue with it. Write a Room Draft with `roomDraft.write(room, path,
184
- revision, parts)`, naming the revision you read, or `null` when there was none, and every
185
- part it should now change: fields, sections and the preamble, or the whole Markdown, a
186
- creation, a move, or a removal. A part new to the Room Draft names its base, the value
187
- you showed when it was opened; the MD Runtime keeps a part's first base; a binary Path
188
- entry's move or removal takes `null` as its base. A write or a discard from an older
189
- revision is refused as `stale` with the current Room Draft; read it and write again.
187
+ The MD Runtime owns one durable Room Draft per Room and Path, shared by every App and tab
188
+ across reloads; a Room the Provider reports lost takes its Room Drafts and queue with it.
189
+ Write one with `roomDraft.write(room, path, revision, parts)`, naming the revision you
190
+ read or `null`, and every part it now changes: fields, sections and the preamble, or the
191
+ whole Markdown, a creation, a move or a removal. A new part names its base, the value you
192
+ showed when it was opened, a field's as `{ value }` or `null` for no such field, and keeps
193
+ its first base; a binary Path entry's move or removal takes `null`. A write or discard
194
+ from an older revision is refused as `stale` with the current Room Draft.
190
195
 
191
196
  Save takes one Room and the Room Drafts of it to save, each with its revision, validates
192
197
  locally, and on success appends one Change Batch to that Room's queue and removes those
193
- Room Drafts. It is refused with the `code` `stale`, `changed-underneath` naming each
194
- part whose base no longer matches the visible state, or a local validation rule, and
195
- then creates nothing and leaves every Room Draft in place. A directory move or removal
196
- is that part on each Document and binary Path entry beneath it, saved together.
197
-
198
- Outcomes follow the Provider's answer. An Accepted Change Batch stays in the queue,
199
- drawn over the confirmed layer, until the confirmed layer reaches the Room Version it
200
- was accepted at, and then leaves it. Conflicted and Rejected, an expired operation, and
201
- a change that no longer applies over the Room each leave the queue and return as Room
202
- Drafts on the Documents they changed, marked with why: the Provider's structured refusal
203
- code and fields as returned, not known to have applied, or withdrawn locally. The rest
204
- of the queue keeps synchronizing, and Sync Status requires attention until each returned
205
- Room Draft is saved again or discarded. A Change Batch keeps no outcome once it leaves
206
- the queue; `observe('queue', room)` shows each Pending one, and a returned Room Draft
207
- says why it returned. Transport failure and Provider unavailability keep work Pending
208
- and do not infer a rejection. A refusal the Provider marks retryable stays Pending until
209
- the reset it names; the MD Runtime retries the same Change Batch identity and payload
210
- and never infers an outcome from transport uncertainty. The MD Runtime never combines,
198
+ Room Drafts. Refused as `stale`, `changed-underneath` naming each part whose base no
199
+ longer matches the visible state, or a local validation rule, it creates nothing and
200
+ leaves every Room Draft. A directory move or removal is that part on each Document and
201
+ binary Path entry beneath it, saved together. `saveParts(room, [{ path, parts }])` saves
202
+ parts, each Path once and each new part with its base, the same way without any Room
203
+ Draft: one held at a saved Path stays as it is, and one held at a Path it moves moves with
204
+ it to a destination that holds none. Save a change that is not a Room Draft with it, never
205
+ by reading the Room Draft at that Path and writing it back.
206
+
207
+ Outcomes follow the Provider's answer. An Accepted Change Batch stays in the queue, drawn
208
+ over the confirmed layer, until that layer reaches the Room Version it was accepted at.
209
+ Conflicted and Rejected, an expired operation, and a change that no longer applies each
210
+ leave the queue and return as Room Drafts on their Documents, marked with why: the
211
+ Provider's structured refusal code and fields as returned, not known to have applied, or
212
+ withdrawn locally. The rest of the queue keeps synchronizing, and Sync Status requires
213
+ attention until each returned Room Draft is saved or discarded. `observe('queue', room)`
214
+ shows each Pending Change Batch, which keeps no outcome once it leaves. Transport failure,
215
+ Provider unavailability and a refusal the Provider marks retryable, until the reset it
216
+ names, keep work Pending; the MD Runtime retries the same Change Batch identity and
217
+ payload, never infers an outcome from transport uncertainty, and never combines,
211
218
  reorders, or rebases.
212
219
 
213
- On a Site, every Save stays in the visitor's browser. Write grants and revisions do not
220
+ On a Site, every Save stays in the visitor's browser: write grants and revisions do not
214
221
  refuse it, and its Pending Change shows in every query and across reloads until the
215
- browser's storage is cleared. It is never sent: `observe('queue', room)` shows it
216
- `local`, and Sync Status never waits on it. Once the Room changes so that it no longer
217
- applies, it leaves the queue and returns no Room Draft.
222
+ browser's storage is cleared. It is never sent: `observe('queue', room)` shows it `local`,
223
+ Sync Status never waits on it, and once the Room no longer lets it apply it leaves the
224
+ queue and returns no Room Draft.
218
225
 
219
226
  `observe('service-mode')` answers the Provider's Service Mode, `open` or `write-halted`.
220
- While writes are halted, Save still succeeds, its Change Batch waits unsent, and the
221
- queue is submitted in order once the Provider reopens writes. An Action is never held: a
222
- write the Provider refuses for the halt returns that refusal to its caller. Show the
223
- Provider as read-only instead of retrying.
224
-
227
+ While writes are halted, Save succeeds, its Change Batch waits unsent and the queue is
228
+ submitted in order once writes reopen; an Action is never held, and one the halt refuses
229
+ returns that refusal: show the Provider as read-only instead of retrying.
225
230
  `observe('readiness')` tells whether the App's code and bound Rooms are held locally
226
231
  (`ready`), each Room's state, each refused Room's file and rule, the persistence answer
227
232
  and a paused preparation's `capacity` cause; `retry()` resumes a paused preparation.
228
233
 
229
- ## The neutrality rule
230
-
231
- No module outside an Adapter package imports, names, or special-cases a Provider. MD UI
232
- and every App reach data only through the client entry.
233
-
234
- ## Content-safety rules
234
+ ## Content safety and launch promises
235
235
 
236
- The Provider authorization belongs to the Runtime host and is never readable by the
237
- App's code. The App's code reaches the network only at the external origins its manifest
238
- declares, empty by default, and the Provider enforces that set. Every request to the
239
- Provider itself goes through the MD Runtime. Rendered Markdown never executes scripts,
240
- renders raw HTML only for the details and summary elements, and loads images and other
241
- resources only from origins the Provider's policy allows.
242
-
243
- ## Launch promises MD UI keeps
236
+ The Provider authorization belongs to the Runtime host and is never readable by the App's
237
+ code. The App's code reaches the network only at the external origins its manifest
238
+ declares, empty by default, and the Provider enforces that set. Rendered Markdown never
239
+ executes scripts, renders raw HTML only for the details and summary elements, and loads
240
+ images and other resources only from origins the Provider's policy allows. An agent must
241
+ never read the authorization, load code from a Room, call the Provider directly, or rebase
242
+ a refused Change Batch.
244
243
 
245
244
  MD UI uses semantic HTML, is fully operable from a keyboard with visible focus and
246
245
  labelled controls, and lays out from a 360 pixel wide viewport to a desktop. Its strings
247
246
  are English only, dates and numbers follow the browser locale, and content is never
248
- translated. Light and dark themes come from CSS custom properties with the browser's
249
- preference as the default and an App's override respected. What an App Creator's agent
250
- adds carries none of these promises by itself. Reading, querying and searching never
251
- wait for the network. Data lives only in the App Creator's browser and with the
252
- Provider.
247
+ translated. Light and dark themes come from CSS custom properties, defaulting to the
248
+ browser's preference and respecting an App's override. What an agent adds carries none of
249
+ these promises by itself. Data lives only in the App Creator's browser and the Provider.
253
250
 
254
251
  ## App code takes the client its host hands it and never constructs a Runtime
255
252
 
256
- App code takes the client its host hands it: in House, `houseBridge().runtime` from
257
- `@agentshouse/app-bridge` resolves to the client House built into the page. It imports
258
- only types from `@agentshouse/mdruntime/client`, never calls `connectMdRuntime` or
259
- `serveMdRuntime`, and never imports the package main, the host entry or the Adapter
260
- package, which hosts and tests use. The in-memory Adapter at
261
- `@agentshouse/mdruntime/memory` is for tests and ships in no bundle. A Site's page fills
262
- its Entry Data Contract's `{"$param": name}` arguments with `boundQuery` from
263
- `@agentshouse/mdruntime/entry`, as House did for its HTML.
264
-
265
- A React App may observe and save through `@agentshouse/mdruntime/react`, which names
266
- React as a peer dependency. `useObserve(client, topic, ...input)` takes the arguments of
267
- `observe` and returns `{ state: 'loading' }` until the topic's first value arrives, then
268
- `{ state: 'ready', value }`, re-rendering on each change; a `null` client observes
269
- nothing and stays loading. `useSave(client)` returns `busy`, the last `outcome` or
270
- `failure`, and `save(room, roomDrafts)`, which writes each Path's parts onto the Room
271
- Draft already there, keeping the bases its parts have, or onto a new one, and saves them
272
- together. A refused Save leaves the Room Drafts for the App to save again or discard; a
273
- failure is recorded and rejects. `saveRoomDrafts(client, room, roomDrafts)` is that save
274
- outside a component. A react-admin or Refine App reads and writes its Rooms through the
275
- data providers of `@agentshouse/mdruntime-families`.
253
+ No module outside an Adapter package imports, names, or special-cases a Provider, and
254
+ every App and MD UI reach data only through the client entry. In House,
255
+ `houseBridge().runtime` from `@agentshouse/app-bridge` resolves to the client House built
256
+ into the page. App code imports only types from `@agentshouse/mdruntime/client`, never
257
+ calls `connectMdRuntime` or `serveMdRuntime`, and never imports the package main, the host
258
+ entry or the Adapter package; the in-memory Adapter at `@agentshouse/mdruntime/memory` is
259
+ for tests and ships in no bundle. A Site's page fills its Entry Data Contract's
260
+ `{"$param": name}` arguments with `boundQuery` from `@agentshouse/mdruntime/entry`, as
261
+ House did for its HTML. While the Site prepares, a query a route's `interaction` names
262
+ answers from the entry's result when the page observes that descriptor, and every other
263
+ stays pending. House replaces its HTML with the page once its document changed after those
264
+ answers, or readiness is `ready`, and then held still for two animation frames, unless the
265
+ visitor uses the HTML: draw the route at once, never behind a placeholder. Before
266
+ readiness is `ready`, `push` loads a new page.
267
+
268
+ A React App may observe and save through `@agentshouse/mdruntime/react`, with React as a
269
+ peer dependency. `useObserve(client, topic, ...input)` takes the arguments of `observe`
270
+ and returns `{ state: 'loading' }` until the topic's first value arrives, then `{ state:
271
+ 'ready', value }`, re-rendering on each change; a `null` client stays loading.
272
+ `useSave(client)` returns `busy`, the last `outcome` or `failure`, and `save(room,
273
+ parts)`, which saves each Path's parts, each new part naming its base, through
274
+ `saveParts(room, [{ path, parts }])`: it writes no Room Draft, so one another tab holds
275
+ at that Path stays as it is and one at a Path it moves moves with it, a refused Save
276
+ changes nothing, and a failure is recorded and rejects. `saveWritten(room, roomDrafts)`
277
+ saves Room Drafts the App wrote itself, each named with the revision its last write returned: one another tab wrote since
278
+ is refused as `stale`, and nothing is saved. A react-admin or Refine App uses the data
279
+ providers of `@agentshouse/mdruntime-families`.
276
280
 
277
281
  ## The Chat
278
282
 
279
- `@agentshouse/mdruntime/chat` holds the Chat, one data layer for every App; add React as
280
- a dependency in any App, with React DOM and `@assistant-ui/react`.
281
-
282
- Place the ready chat with `<Chat client={runtime} conversation={id} agent={agent}
283
- width="1/3" showChats />`: `conversation` opens one, `null` for a new chat, `agent` is
284
- the Agent a new chat goes to, `onOpen` hears each one it opens, and `width` is `full`
285
- (the place you give it), or `3/4`, `1/2` or `1/3` of the window docked at its right
286
- edge, whole on a narrow window. `showChats` adds its conversation list; or draw your own
287
- inside a `ChatProvider` around a `<Chat />` with no `client`. It carries its own styles;
288
- theme it with CSS custom properties on it or an ancestor: `--chat-background`,
289
- `--chat-surface`, `--chat-text`, `--chat-text-muted`, `--chat-accent`, `--chat-line`,
290
- `--chat-attention`, `--chat-danger`, `--chat-font`, `--chat-font-mono`,
291
- `--chat-font-size`, `--chat-radius` and `--chat-density` (a factor for spacing); an
292
- unset one keeps House's light or dark look. `mountChat(element, { client })` places it
293
- outside React and returns `update(props)` and `unmount()`.
283
+ `@agentshouse/mdruntime/chat` holds the Chat, one data layer for every App; add React as a
284
+ dependency in any App, with React DOM and `@assistant-ui/react`. Place the ready chat with
285
+ `<Chat client={runtime} conversation={id} agent={agent} width="1/3" showChats />`:
286
+ `conversation` opens one, `null` for a new chat, `agent` is the Agent a new chat goes to,
287
+ `onOpen` hears each one it opens, and `width` is `full` (the place you give it), or `3/4`,
288
+ `1/2` or `1/3` of the window docked at its right edge, whole on a narrow window.
289
+ `showChats` adds its conversation list; or draw your own inside a `ChatProvider` around a
290
+ `<Chat />` with no `client`. Theme its own styles with CSS custom properties on it or an
291
+ ancestor: `--chat-background`, `--chat-surface`, `--chat-text`, `--chat-text-muted`,
292
+ `--chat-accent`, `--chat-line`, `--chat-attention`, `--chat-danger`, `--chat-font`,
293
+ `--chat-font-mono`, `--chat-font-size`, `--chat-radius` and `--chat-density` (a factor for
294
+ spacing); an unset one keeps House's light or dark look. `mountChat(element, { client })`
295
+ places it outside React, with `update(props)` and `unmount()`.
294
296
 
295
297
  Mix `ChatMessageList` (`components` takes your `UserMessage` and `AssistantMessage`),
296
298
  `ChatInput` and `ChatQuestionCard` with your own design inside a `ChatProvider`, or
297
- compose assistant-ui's primitives there; `useChat()` gives `send`, the conversations,
298
- the Agents, questions to `answer`, `options` to `choose`, `commands`, the queue to
299
- `edit` or `unqueue`, `stop`, `kill` and outcomes; never replace its messages, sending or
300
- store. A secret question is never answered here; typed answers live in Presentation
301
- State's `typed` key: keep it, and change Presentation State only inside `inTurn(client,
302
- work)` from `@agentshouse/mdruntime/client`. `Markdown` draws Markdown safely.
303
-
304
- ## What an agent must never do
305
-
306
- An agent must never read the authorization, load code from a Room, call the Provider
307
- directly, or rebase a refused Change Batch.
299
+ compose assistant-ui's primitives there; `useChat()` gives `send`, the conversations, the
300
+ Agents, questions to `answer`, `options` to `choose`, `commands`, the queue to `edit` or
301
+ `unqueue`, `stop`, `kill` and outcomes; never replace its messages, sending or store. It
302
+ shows a conversation's latest 50 messages, and assistant-ui's `loadEarlier()` the 50
303
+ before, which `ChatMessageList` calls as the reader scrolls back. A secret question is
304
+ never answered here; typed answers live in the Presentation State members named `typed:…`:
305
+ leave them. `Markdown` draws Markdown safely.
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAE1B,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQtE,KAAK,QAAQ,GAAG;IAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,KAAK,mBAAmB,GAAG,QAAQ,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,KAAK,QAAQ,GAAG,eAAe,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,qBAAqB,EAAE,mBAAmB,GAAG;QACpD,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,EAAE,cAAc,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAQvB;AA6ED,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAQjF;AAuKD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAiBtE"}
package/dist/actions.js CHANGED
@@ -140,6 +140,8 @@ export function actionOutcome(answer, name) {
140
140
  if (answer.status === 401)
141
141
  return { kind: 'revoked-authorization' };
142
142
  const refusal = doorRefusal(answer.body);
143
+ if (refusal?.code === 'operation_contended')
144
+ return { kind: 'transport-uncertainty' };
143
145
  if (refusal !== null)
144
146
  return { kind: 'rejected', ...refusal };
145
147
  if (answer.status === 404)
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,OAAO,EACP,aAAa,EAiBd,MAAM,wBAAwB,CAAC;AA4ChC,OAAO,EASL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,GACD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAsErD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CA0hBpF"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,OAAO,EACP,aAAa,EAmBd,MAAM,wBAAwB,CAAC;AA4ChC,OAAO,EASL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,GACD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAsErD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAyjBpF"}
package/dist/adapter.js CHANGED
@@ -144,15 +144,7 @@ export function createAgentsHouseAdapter(options) {
144
144
  notifications.reach(entry.authority, at);
145
145
  return [presented(entry.authority, at)];
146
146
  });
147
- notifications.send(kept, demand === null
148
- ? null
149
- : {
150
- rooms: demand.rooms.flatMap((locator) => {
151
- const entry = tracked.get(locator);
152
- return entry === undefined ? [] : [entry.authority];
153
- }),
154
- conversations: demand.conversations,
155
- });
147
+ notifications.send(kept, demand === null ? null : { rooms: [...demand.rooms], conversations: demand.conversations });
156
148
  }
157
149
  function adopted(entry, outcome) {
158
150
  if (outcome.kind !== 'accepted')
@@ -360,7 +352,7 @@ export function createAgentsHouseAdapter(options) {
360
352
  return UNCERTAIN;
361
353
  return mutationOutcome(settled.status, settled.body, entry.locator, entry.handle);
362
354
  }
363
- async function downloaded(answer, locator) {
355
+ function granted(answer, locator) {
364
356
  const failure = classifyDoor(answer.status, answer.body, locator);
365
357
  if (failure !== null) {
366
358
  return failure.kind === 'scoped-refusal'
@@ -373,19 +365,40 @@ export function createAgentsHouseAdapter(options) {
373
365
  : failure;
374
366
  }
375
367
  const grant = parseGrant(answer.body);
376
- if (grant === null || grant.method !== 'GET')
368
+ const name = answer.body.name;
369
+ if (grant === null || grant.method !== 'GET' || typeof name !== 'string') {
377
370
  return UNCERTAIN_READ;
378
- const read = await transport.download(grant.url);
371
+ }
372
+ return { kind: 'link', url: grant.url, name };
373
+ }
374
+ async function downloaded(answer, locator) {
375
+ const link = granted(answer, locator);
376
+ if (link.kind !== 'link')
377
+ return link;
378
+ const read = await transport.download(link.url);
379
379
  if (read.status !== 200 || read.blob === null)
380
380
  return UNCERTAIN_READ;
381
381
  return { kind: 'binary', blob: read.blob };
382
382
  }
383
+ function pathGrant(request) {
384
+ const entry = authorityFor(request.locator);
385
+ if (entry === undefined)
386
+ return null;
387
+ return transport.door(DOOR_FILES_GET, {
388
+ room_ref: entry.authority,
389
+ path: request.path,
390
+ revision: request.revision,
391
+ });
392
+ }
383
393
  return {
384
394
  async authorize() {
385
395
  return options.authorize();
386
396
  },
387
- async discover(_authorization) {
388
- const answer = await transport.door(DOOR_DISCOVER, { prefixes: [...DISCOVER_PREFIXES] });
397
+ async discover(_authorization, scope) {
398
+ const answer = await transport.door(DOOR_DISCOVER, {
399
+ prefixes: [...DISCOVER_PREFIXES],
400
+ ...(scope === undefined ? {} : { rooms: scope.authorities }),
401
+ });
389
402
  const failed = discoveryFailure(answer.status, answer.body);
390
403
  if (failed !== null)
391
404
  return failed;
@@ -394,16 +407,31 @@ export function createAgentsHouseAdapter(options) {
394
407
  return { kind: 'transport-uncertainty' };
395
408
  bounds = document.bounds;
396
409
  const entries = trackedFrom(document);
397
- tracked.clear();
410
+ const covered = scope === undefined
411
+ ? null
412
+ : [
413
+ ...new Set([
414
+ ...[...tracked.values()]
415
+ .filter((entry) => scope.authorities.includes(entry.authority))
416
+ .map((entry) => entry.locator),
417
+ ...entries.map((entry) => entry.locator),
418
+ ]),
419
+ ];
420
+ if (covered === null)
421
+ tracked.clear();
422
+ else
423
+ for (const locator of covered)
424
+ tracked.delete(locator);
398
425
  for (const entry of entries)
399
426
  tracked.set(entry.locator, entry);
400
427
  for (const locator of handed.keys())
401
428
  if (!tracked.has(locator))
402
429
  handed.delete(locator);
403
- notifications.track(entries);
430
+ notifications.track([...tracked.values()]);
404
431
  return {
405
- ...mapDiscovery(document, document.authorities.map((authority) => discoveredRoom(authority)), capabilities(document)),
432
+ ...mapDiscovery(document, document.authorities.map((authority) => discoveredRoom(authority)), capabilities(document.actions, [...tracked.values()])),
406
433
  member: document.member,
434
+ ...(covered === null ? {} : { covered }),
407
435
  };
408
436
  },
409
437
  async bootstrap(_authorization, request) {
@@ -464,15 +492,10 @@ export function createAgentsHouseAdapter(options) {
464
492
  },
465
493
  async binary(_authorization, request) {
466
494
  if (request.kind === 'path') {
467
- const entry = authorityFor(request.locator);
468
- if (entry === undefined)
495
+ const asked = pathGrant(request);
496
+ if (asked === null)
469
497
  return { kind: 'room-not-readable', locator: request.locator };
470
- const answer = await transport.door(DOOR_FILES_GET, {
471
- room_ref: entry.authority,
472
- path: request.path,
473
- revision: request.revision,
474
- });
475
- return downloaded(answer, request.locator);
498
+ return downloaded(await asked, request.locator);
476
499
  }
477
500
  const referrer = houseReferrer(request.referrer, tracked);
478
501
  if (referrer === null) {
@@ -484,6 +507,12 @@ export function createAgentsHouseAdapter(options) {
484
507
  });
485
508
  return downloaded(answer, referrer.locator);
486
509
  },
510
+ async link(_authorization, request) {
511
+ const asked = pathGrant(request);
512
+ if (asked === null)
513
+ return { kind: 'room-not-readable', locator: request.locator };
514
+ return granted(await asked, request.locator);
515
+ },
487
516
  referrerScope(referrer) {
488
517
  const held = houseReferrer(referrer, tracked);
489
518
  if (held === null)
@@ -66,7 +66,7 @@ export declare function siteTracked(document: HouseSiteDiscovery): TrackedAuthor
66
66
  export declare function trackedFrom(document: HouseDiscoveryDocument): TrackedAuthority[];
67
67
  export declare function providerLimits(bounds: HouseBounds): readonly ProviderLimit[];
68
68
  export declare function declaredRetention(bounds: HouseBounds): Retention;
69
- export declare function capabilities(document: HouseDiscoveryDocument): readonly Capability[];
69
+ export declare function capabilities(actions: HouseDiscoveryDocument['actions'], rooms: readonly Pick<TrackedAuthority, 'authority' | 'houseModel'>[]): readonly Capability[];
70
70
  export declare function siteCapabilities(): readonly Capability[];
71
71
  export declare function discoveredRoom(authority: HouseAuthority): DiscoveredRoom;
72
72
  export declare function mapDiscovery(document: Pick<HouseDiscoveryDocument, 'bounds'>, rooms: readonly DiscoveredRoom[], declared: readonly Capability[]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ds) {
216
216
  refreshHorizon: bounds.change_retention_seconds,
217
217
  };
218
218
  }
219
- export function capabilities(document) {
220
- const house = document.authorities.find((authority) => authority.houseModel !== null);
219
+ export function capabilities(actions, rooms) {
220
+ const house = rooms.find((room) => room.houseModel !== null);
221
221
  return [
222
222
  {
223
223
  name: PROVIDER_ACTIONS,
224
- actions: declaredActions(document.actions),
224
+ actions: declaredActions(actions),
225
225
  ...(house === undefined
226
226
  ? {}
227
- : { conversationAgents: houseConversationAgents(house.roomRef) }),
227
+ : { conversationAgents: houseConversationAgents(house.authority) }),
228
228
  },
229
229
  ];
230
230
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { createAgentsHouseAdapter, type AgentsHouseAdapterOptions } from './adapter.js';
2
2
  export { HOUSE_APP_ACTS, HOUSE_APP_BATCHES, HOUSE_SITE_ACTS } from './actions.js';
3
- export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseDemand, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
3
+ export type { HouseByteAct, HouseByteTransfer, HouseBytesAnswer, HouseClosing, HouseDemand, HouseDoorAnswer, HouseHeldRoom, HouseOpening, HouseStream, HouseStreamEntry, HouseStreamFrame, HouseSiteTransport, HouseTransport, } from './transport.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAOR,MAAM,wBAAwB,CAAC;AA2BhC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAmCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CA+Q1F"}
1
+ {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAUR,MAAM,wBAAwB,CAAC;AA2BhC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAyCxB,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAyR1F"}
package/dist/site.js CHANGED
@@ -9,6 +9,9 @@ import { SITE_DOOR_BOOTSTRAP, SITE_DOOR_DISCOVER, SITE_DOOR_ENUMERATE, SITE_DOOR
9
9
  import { houseReferrer } from './referrer.js';
10
10
  import { followsVersion, logPosition, presented, reachedVersion, roomVersion, } from './version.js';
11
11
  const UNCERTAIN = { kind: 'transport-uncertainty' };
12
+ function unfound() {
13
+ return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
14
+ }
12
15
  function siteRoom(tracked) {
13
16
  return {
14
17
  name: tracked.handle,
@@ -30,6 +33,18 @@ export function createSiteAdapter(transport, snapshot = false) {
30
33
  const named = houseReferrer(referrer, tracked);
31
34
  return named === null || !tracked.has(named.locator) ? null : named;
32
35
  }
36
+ function fileRoute(request) {
37
+ const named = published(request.kind === 'path' ? { room: request.locator, path: request.path } : request.referrer);
38
+ if (named === null) {
39
+ return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
40
+ }
41
+ if (request.fileRef === undefined)
42
+ return unfound();
43
+ const { room_ref, path, record } = named.referrer;
44
+ return `${SITE_FILES}${room_ref}/${encodeURIComponent(request.fileRef)}/${path === undefined
45
+ ? `${SITE_FILE_RECORD}/${encodeURIComponent(record)}`
46
+ : encodeURIComponent(path)}`;
47
+ }
33
48
  async function enumerated(entry, from, page) {
34
49
  const answer = await transport.door(SITE_DOOR_ENUMERATE, {
35
50
  positions: [
@@ -198,24 +213,26 @@ export function createSiteAdapter(transport, snapshot = false) {
198
213
  return { kind: 'no-history' };
199
214
  },
200
215
  async binary(_authorization, request) {
201
- const named = published(request.kind === 'path' ? { room: request.locator, path: request.path } : request.referrer);
202
- if (named === null) {
203
- return { kind: 'rejected', code: 'referrer_unknown', fields: {}, retryable: false };
204
- }
205
- if (request.fileRef === undefined) {
206
- return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
207
- }
208
- const { room_ref, path, record } = named.referrer;
209
- const read = await transport.download(`${SITE_FILES}${room_ref}/${encodeURIComponent(request.fileRef)}/${path === undefined
210
- ? `${SITE_FILE_RECORD}/${encodeURIComponent(record)}`
211
- : encodeURIComponent(path)}`);
212
- if (read.status === 404) {
213
- return { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false };
214
- }
216
+ const route = fileRoute(request);
217
+ if (typeof route !== 'string')
218
+ return route;
219
+ const read = await transport.download(route);
220
+ if (read.status === 404)
221
+ return unfound();
215
222
  return read.status === 200 && read.blob !== null
216
223
  ? { kind: 'binary', blob: read.blob }
217
224
  : UNCERTAIN;
218
225
  },
226
+ async link(_authorization, request) {
227
+ const route = fileRoute(request);
228
+ if (typeof route !== 'string')
229
+ return route;
230
+ return {
231
+ kind: 'link',
232
+ url: route,
233
+ name: request.path.slice(request.path.lastIndexOf('/') + 1),
234
+ };
235
+ },
219
236
  referrerScope(referrer) {
220
237
  const named = published(referrer);
221
238
  if (named === null)
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,kBAAkB,EAElB,WAAW,EACX,eAAe,EAEf,iBAAiB,EACjB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,aAAa,EAEb,SAAS,EAET,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AA0C7D,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM,IAAI,CAAC;IACxF,IAA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AgB,EAAE,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM,IAAI,CAAC;IACxF,IAAI,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;IACxE,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAClD,MAAM,IAAI,IAAI,CAAC;IACf,KAAK,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtD,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD,OAAO,CACL,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,WAAW,EACjB,KAAK,CAAC,EAAE,YAAY,GACnB,mBAAmB,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAkFF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,kBAAkB,CAwhB5F"}
package/dist/stream.js CHANGED
@@ -352,6 +352,10 @@ export function houseNotifications(transport, mode) {
352
352
  });
353
353
  return;
354
354
  }
355
+ if (frame.type === 'authority_changed') {
356
+ emit({ kind: 'authority-changed', scope: { authorities: frame.rooms } });
357
+ return;
358
+ }
355
359
  if (frame.type === 'conversations') {
356
360
  emitConversation({ kind: 'list', entries: frame.conversations.map(listedConversation) });
357
361
  return;
@@ -421,10 +425,10 @@ export function houseNotifications(transport, mode) {
421
425
  });
422
426
  });
423
427
  stream.opened(reopened);
424
- stream.closed((revoked) => {
428
+ stream.closed(({ revoked, lost }) => {
425
429
  opening = null;
426
430
  acknowledging = null;
427
- emit({ kind: 'closed', revoked });
431
+ emit({ kind: 'closed', revoked, lost });
428
432
  });
429
433
  return {
430
434
  runtime,
@@ -80,6 +80,9 @@ export type HouseStreamFrame = {
80
80
  } | {
81
81
  type: 'opening';
82
82
  expired: readonly string[];
83
+ } | {
84
+ type: 'authority_changed';
85
+ rooms: readonly string[];
83
86
  } | ({
84
87
  type: 'turn';
85
88
  conversation_id: string;
@@ -143,10 +146,14 @@ export type HouseOpening = {
143
146
  received(authority: string, carry: string, index: number): void;
144
147
  close(): void;
145
148
  };
149
+ export type HouseClosing = {
150
+ revoked: boolean;
151
+ lost: boolean;
152
+ };
146
153
  export type HouseStream = {
147
154
  observe(receive: (frame: HouseStreamFrame) => void): () => void;
148
155
  opened(notify: (opening: HouseOpening) => void): () => void;
149
- closed(notify: (revoked: boolean) => void): () => void;
156
+ closed(notify: (closing: HouseClosing) => void): () => void;
150
157
  };
151
158
  export type HouseDoor = {
152
159
  door(route: string, body: unknown): Promise<HouseDoorAnswer>;
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE/E,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,UAAU,gBAAgB,CAAC;AAExC,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,eAAO,MAAM,mBAAmB,2BAA2B,CA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gB,CAAC,CAAC;CACpD,CAAC"}
package/dist/write.js CHANGED
@@ -341,7 +341,7 @@ export function historyOutcome(status, body, locator, request) {
341
341
  return {
342
342
  kind: 'scoped-refusal',
343
343
  locator,
344
- scope: 'content',
344
+ scope: 'operation',
345
345
  code: 'retained_history_unavailable',
346
346
  fields: { path: request.path, revision: request.revision },
347
347
  retryable: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime-adapter",
3
- "version": "0.1.0-c001b77384778",
3
+ "version": "0.1.0-c04b3fdfb64c6",
4
4
  "description": "Agents House Adapter for the MD Runtime",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,6 @@
25
25
  "LICENSE"
26
26
  ],
27
27
  "dependencies": {
28
- "@agentshouse/mdruntime": "0.1.0-c3b593308e82b"
28
+ "@agentshouse/mdruntime": "0.1.0-c13854b9249b6"
29
29
  }
30
30
  }