@agentshouse/mdruntime 0.1.0-cd4f72ad5c517 → 0.1.0-cdf82f77fae68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/AGENTS.md +113 -33
  2. package/README.md +20 -10
  3. package/dist/adapter.d.ts +48 -14
  4. package/dist/adapter.d.ts.map +1 -1
  5. package/dist/attached-model.d.ts.map +1 -1
  6. package/dist/attached-model.js +15 -2
  7. package/dist/attempt.d.ts +16 -0
  8. package/dist/attempt.d.ts.map +1 -0
  9. package/dist/attempt.js +57 -0
  10. package/dist/binary.d.ts +23 -0
  11. package/dist/binary.d.ts.map +1 -0
  12. package/dist/binary.js +8 -0
  13. package/dist/bootstrap.d.ts +17 -5
  14. package/dist/bootstrap.d.ts.map +1 -1
  15. package/dist/bootstrap.js +88 -38
  16. package/dist/change-set.d.ts.map +1 -1
  17. package/dist/change-set.js +19 -12
  18. package/dist/change.d.ts +15 -0
  19. package/dist/change.d.ts.map +1 -1
  20. package/dist/change.js +26 -1
  21. package/dist/chat/acts.d.ts +34 -0
  22. package/dist/chat/acts.d.ts.map +1 -0
  23. package/dist/chat/acts.js +36 -0
  24. package/dist/chat/context.d.ts +3 -0
  25. package/dist/chat/context.d.ts.map +1 -0
  26. package/dist/chat/context.js +10 -0
  27. package/dist/chat/input.d.ts +9 -0
  28. package/dist/chat/input.d.ts.map +1 -0
  29. package/dist/chat/input.js +99 -0
  30. package/dist/chat/kit.d.ts +60 -0
  31. package/dist/chat/kit.d.ts.map +1 -0
  32. package/dist/chat/kit.js +123 -0
  33. package/dist/chat/lasting.d.ts +6 -0
  34. package/dist/chat/lasting.d.ts.map +1 -0
  35. package/dist/chat/lasting.js +19 -0
  36. package/dist/chat/list.d.ts +20 -0
  37. package/dist/chat/list.d.ts.map +1 -0
  38. package/dist/chat/list.js +59 -0
  39. package/dist/chat/markdown.d.ts +19 -0
  40. package/dist/chat/markdown.d.ts.map +1 -0
  41. package/dist/chat/markdown.js +187 -0
  42. package/dist/chat/message.d.ts +6 -0
  43. package/dist/chat/message.d.ts.map +1 -0
  44. package/dist/chat/message.js +192 -0
  45. package/dist/chat/messages.d.ts +21 -0
  46. package/dist/chat/messages.d.ts.map +1 -0
  47. package/dist/chat/messages.js +151 -0
  48. package/dist/chat/name.d.ts +6 -0
  49. package/dist/chat/name.d.ts.map +1 -0
  50. package/dist/chat/name.js +37 -0
  51. package/dist/chat/opened.d.ts +11 -0
  52. package/dist/chat/opened.d.ts.map +1 -0
  53. package/dist/chat/opened.js +17 -0
  54. package/dist/chat/overlay.d.ts +31 -0
  55. package/dist/chat/overlay.d.ts.map +1 -0
  56. package/dist/chat/overlay.js +97 -0
  57. package/dist/chat/parts.d.ts +57 -0
  58. package/dist/chat/parts.d.ts.map +1 -0
  59. package/dist/chat/parts.js +119 -0
  60. package/dist/chat/process.d.ts +20 -0
  61. package/dist/chat/process.d.ts.map +1 -0
  62. package/dist/chat/process.js +32 -0
  63. package/dist/chat/provider.d.ts +63 -0
  64. package/dist/chat/provider.d.ts.map +1 -0
  65. package/dist/chat/provider.js +645 -0
  66. package/dist/chat/question.d.ts +9 -0
  67. package/dist/chat/question.d.ts.map +1 -0
  68. package/dist/chat/question.js +80 -0
  69. package/dist/chat/questions.d.ts +31 -0
  70. package/dist/chat/questions.d.ts.map +1 -0
  71. package/dist/chat/questions.js +111 -0
  72. package/dist/chat/read.d.ts +5 -0
  73. package/dist/chat/read.d.ts.map +1 -0
  74. package/dist/chat/read.js +13 -0
  75. package/dist/chat/ready.d.ts +33 -0
  76. package/dist/chat/ready.d.ts.map +1 -0
  77. package/dist/chat/ready.js +91 -0
  78. package/dist/chat/style.d.ts +4 -0
  79. package/dist/chat/style.d.ts.map +1 -0
  80. package/dist/chat/style.js +302 -0
  81. package/dist/chat.d.ts +14 -0
  82. package/dist/chat.d.ts.map +1 -0
  83. package/dist/chat.js +8 -0
  84. package/dist/client.d.ts +14 -5
  85. package/dist/client.d.ts.map +1 -1
  86. package/dist/client.js +65 -15
  87. package/dist/collection.d.ts +6 -11
  88. package/dist/collection.d.ts.map +1 -1
  89. package/dist/collection.js +56 -19
  90. package/dist/connection.d.ts +21 -9
  91. package/dist/connection.d.ts.map +1 -1
  92. package/dist/connection.js +470 -142
  93. package/dist/conversation.d.ts +11 -3
  94. package/dist/conversation.d.ts.map +1 -1
  95. package/dist/conversation.js +47 -7
  96. package/dist/expectation.d.ts +21 -0
  97. package/dist/expectation.d.ts.map +1 -0
  98. package/dist/expectation.js +70 -0
  99. package/dist/failure.d.ts +13 -0
  100. package/dist/failure.d.ts.map +1 -0
  101. package/dist/failure.js +19 -0
  102. package/dist/host.d.ts +1 -0
  103. package/dist/host.d.ts.map +1 -1
  104. package/dist/host.js +9 -8
  105. package/dist/identity.d.ts +3 -0
  106. package/dist/identity.d.ts.map +1 -1
  107. package/dist/identity.js +13 -1
  108. package/dist/index.d.ts +9 -4
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +3 -0
  111. package/dist/memory.d.ts +4 -3
  112. package/dist/memory.d.ts.map +1 -1
  113. package/dist/memory.js +60 -20
  114. package/dist/model.d.ts +10 -2
  115. package/dist/model.d.ts.map +1 -1
  116. package/dist/model.js +2 -0
  117. package/dist/open.d.ts +2 -0
  118. package/dist/open.d.ts.map +1 -0
  119. package/dist/open.js +1 -0
  120. package/dist/outcome.d.ts +28 -3
  121. package/dist/outcome.d.ts.map +1 -1
  122. package/dist/outcome.js +41 -1
  123. package/dist/overlay.d.ts +14 -3
  124. package/dist/overlay.d.ts.map +1 -1
  125. package/dist/overlay.js +75 -37
  126. package/dist/query.d.ts +4 -0
  127. package/dist/query.d.ts.map +1 -1
  128. package/dist/query.js +5 -31
  129. package/dist/reach.d.ts +2 -0
  130. package/dist/reach.d.ts.map +1 -1
  131. package/dist/reach.js +43 -19
  132. package/dist/react.d.ts +26 -16
  133. package/dist/react.d.ts.map +1 -1
  134. package/dist/react.js +10 -8
  135. package/dist/read-side.d.ts.map +1 -1
  136. package/dist/read-side.js +9 -2
  137. package/dist/refresh.d.ts +10 -0
  138. package/dist/refresh.d.ts.map +1 -1
  139. package/dist/refresh.js +42 -38
  140. package/dist/replica.d.ts +8 -5
  141. package/dist/replica.d.ts.map +1 -1
  142. package/dist/replica.js +76 -56
  143. package/dist/room-draft.d.ts +26 -9
  144. package/dist/room-draft.d.ts.map +1 -1
  145. package/dist/room-draft.js +132 -23
  146. package/dist/rows.d.ts +5 -1
  147. package/dist/rows.d.ts.map +1 -1
  148. package/dist/rows.js +10 -2
  149. package/dist/save.d.ts +27 -1
  150. package/dist/save.d.ts.map +1 -1
  151. package/dist/save.js +340 -35
  152. package/dist/search.d.ts +3 -2
  153. package/dist/search.d.ts.map +1 -1
  154. package/dist/status.d.ts +2 -2
  155. package/dist/status.d.ts.map +1 -1
  156. package/dist/status.js +0 -8
  157. package/dist/store.d.ts +33 -9
  158. package/dist/store.d.ts.map +1 -1
  159. package/dist/store.js +273 -164
  160. package/dist/wire.d.ts +7 -3
  161. package/dist/wire.d.ts.map +1 -1
  162. package/dist/wire.js +15 -2
  163. package/package.json +17 -9
  164. package/dist/attachment.d.ts +0 -3
  165. package/dist/attachment.d.ts.map +0 -1
  166. package/dist/attachment.js +0 -8
package/AGENTS.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # Instructions for the App Creator's agent
2
2
 
3
3
  These instructions address an agent in an environment with Git. Obtain the
4
- App Repository, change it, build, and push. They are documentation, not
5
- enforcement.
4
+ App Repository, change it, build, and push. They are documentation, not enforcement.
6
5
 
7
6
  ## The MD Runtime API
8
7
 
9
8
  App code reaches the MD Runtime through the remote client. The surfaces are
10
- Rooms, Query, Search, Observe, Types, Room Draft, Save, History, Call, Reached, Log,
9
+ Rooms, Query, Search, Observe, Types, Room Draft, Save, History, the binary file
10
+ reads, Call, Reached, Log,
11
11
  the reported persistence answer, reauthorization, conversation, the chat draft,
12
12
  and Presentation State. Sync Status, the Service Mode, the storage-loss
13
- statement and the deployment facts are observations only.
13
+ statement, the deployment facts and the signed-in member are observations only.
14
14
 
15
15
  The host attaches each port with its reach, and every member and observation
16
16
  answers within it: a Room outside it answers as one the replica does not hold,
@@ -27,6 +27,8 @@ value whole and returns its unsubscribe, and `close()` ends the observation.
27
27
  Closing the port ends every handle and rejects every pending call and
28
28
  observation; a client that reconnects observes again.
29
29
 
30
+ `observe('agents')` answers every Agent a new conversation can go to, each
31
+ `{ identity, name }`, whether or not it has a conversation yet.
30
32
  Each conversation the Provider's conversation list names is held complete in the
31
33
  browser. `conversation.list()` and `observe('conversations')` answer each with its
32
34
  Agent's identity and name, its name, created and finished times, last outcome and live
@@ -43,29 +45,67 @@ and none of them is stored or searchable.
43
45
  sending it is a Provider Action that needs the Provider reachable and is never
44
46
  queued.
45
47
 
46
- Each Room in Rooms lists its `attachments`, the files the Provider holds for it
47
- that its Documents link by the Provider's reference, ordered by `reference`,
48
- each with `name`, `byteLength`, `mediaType` and the Provider's own entry as
49
- `entry`. They are as the Provider last declared them and hold no bytes;
50
- open one through the Provider Action that serves it.
48
+ A binary file at a Path of a Room is a binary Path entry. Query lists it by
49
+ `path` with its `binaryFile` record and never its bytes: `{ state: 'accepted',
50
+ revision, path, fileRef, byteLength, mediaType, sha256 }`, or, from a Save until
51
+ the Provider accepts it, `{ state: 'pending', localId, path, byteLength,
52
+ mediaType, sha256 }` with no revision. Write one with a Room Draft whose only part
53
+ is `file: { blob }`, a `Blob` whose `type` is its media type; Save keeps the bytes
54
+ in its Pending Change, works offline, and the record turns accepted with the
55
+ Provider's revision once the Pending Change is accepted. Move or remove an
56
+ accepted one as a Document. Move or remove a pending one the same way, before or
57
+ after Save: the Room Draft or its queued Pending Change carries the bytes to the
58
+ new Path or drops them, and once that Pending Change has gone to the Provider
59
+ Save refuses it as `unknown-revision` until it is accepted. Read the bytes with
60
+ `binaryFile.read(room, path)`: a pending record answers its saved bytes, and
61
+ every read of an accepted one asks the Provider again and keeps nothing. Pass a
62
+ History revision as `binaryFile.read(room, path, revision)` to open that
63
+ revision, a removed file's last one included. Text, a Record attachment or a conversation
64
+ message may name a file directly by its `fileRef`; read that file with
65
+ `binaryFile.readReference({ fileRef, referrer })`, where the referrer is the
66
+ `referrer` the Provider gave beside the reference, or `{ room, path }` of the
67
+ document whose text names it. Both answer `{ kind: 'binary', blob }` or a
68
+ refusal or failure. History of a binary Path lists each revision's
69
+ `binaryFile` metadata without bytes.
51
70
 
52
71
  Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never
53
72
  touch the network.
54
- History and Call go to the Provider through the Adapter. A Call result whose
73
+ History, the binary file reads and Call go to the Provider through the Adapter. Call takes the Action names
74
+ the Adapter declares; any other name answers `undeclared` without reaching the
75
+ Provider. A Call result whose
55
76
  effect the Provider places in a Room carries `at`, that Room and Room Version;
56
77
  `reached(room, roomVersion)` answers whether the Room's confirmed state has
57
78
  reached it, and the MD Runtime keeps refreshing that Room until it has;
58
79
  `reached(room, roomVersion, path)` answers whether the held confirmed copy of
59
80
  that document was written at a later Room Version. Each History revision
60
- names its author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`. Every
81
+ names its author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`.
82
+ History of a Path no current document holds answers the removed document's
83
+ revisions with `deleted: true`, newest first; that revision is what a link to
84
+ the Path opens. Every
61
85
  member of the
62
86
  client is asynchronous. Results are detached snapshots. Nothing in this
63
87
  surface returns the authorization, performs a request the App's code
64
88
  composes, or exposes the browser store.
65
89
 
90
+ Every refusal and failure carries `code` and `retryable`: each Call and History answer
91
+ other than its result, a refused Save or Room Draft write, a returned Room Draft's
92
+ reason, a Room's refusal and the Connection Refusal, and every error a member rejects
93
+ with, beside its message. A Provider refusal carries the Provider's own `retryable`.
94
+ Every code and every value the API answers is open: handle one you do not know by its
95
+ `code` and `retryable`.
96
+
66
97
  Read the deployment facts with `observe('deployment-facts')`. Interpret the
67
98
  opaque value using the host's contract.
68
99
 
100
+ `observe('member')` answers who uses the App: the User the Provider signed in,
101
+ `{ kind: 'user', id, name }` in the shape of a change's `author`, so a Document
102
+ whose `change.author.id` equals its `id` is that User's own. It is `null` until
103
+ the Provider first names one, and where it names none, such as a Site. The
104
+ MD Runtime keeps it with the Local Replicas, so it answers offline once known,
105
+ and every port hears the next member the Provider names; signing out answers
106
+ `null`, then ends the observation with the authorization. It is the only way App code learns who
107
+ uses it.
108
+
69
109
  The in-memory Adapter at `@agentshouse/mdruntime/memory` is for tests and
70
110
  ships in no bundle.
71
111
 
@@ -101,15 +141,16 @@ data:
101
141
  list of pointers and `sections` `'all'` or a list of names. Selected pointers
102
142
  return the frontmatter holding only them, nested as written. A backlink names
103
143
  the referring Path, MD Type and the pointer it came from as `field`. Room and Path always return; a Markdown
104
- Document also returns its MD Type. A non-Markdown Document or binary link
105
- target returns only Room and Path. An unselected part is absent. Select only
144
+ Document also returns its MD Type. A non-Markdown Document returns only Room
145
+ and Path, and a binary Path entry Room, Path and its `binaryFile` record,
146
+ whatever is selected. An unselected part is absent. Select only
106
147
  what a screen shows: a list that selects the Markdown hears every edit of it.
107
148
  - **Change.** `change` is `{ author, time }` of the Document's head revision as
108
149
  the Provider last delivered it: `author` is `{ kind: 'user' | 'site', id, name }`
109
150
  or `null` for a write the Provider made itself, and `time` is the Provider's
110
151
  ISO 8601 change time. It is `null` where the Provider delivered no time, as at
111
152
  a Site. An unsent edit or move keeps it, an unsent creation has none, and a
112
- saved write takes the Provider's own once it is Accepted and refreshed. A
153
+ saved write takes the Provider's own once it is Accepted. A
113
154
  Room's last change is its Document with the latest `time`.
114
155
  - **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }`
115
156
  with TanStack DB's own options, and ties end with Room, then Path. `groupBy` by
@@ -117,9 +158,9 @@ data:
117
158
  over every match and ordered by `count` or a key. A sort or group takes only a
118
159
  pointer that holds one value. `limit` bounds the Documents or the groups.
119
160
  - **Results and errors.** A result carries no Room Version: read freshness from
120
- Rooms and Sync Status. An invalid query fails with `invalid-query`,
121
- `unknown-type`, `unknown-field` or `wrong-kind`, naming where, and never
122
- answers an empty result in its place.
161
+ Rooms and Sync Status. An invalid query fails with the `code`
162
+ `invalid-query`, `unknown-type`, `unknown-field` or `wrong-kind`, naming where,
163
+ and never answers an empty result in its place.
123
164
 
124
165
  ## Local Search rules
125
166
 
@@ -157,9 +198,9 @@ the current Room Draft; read it and write again.
157
198
 
158
199
  Save takes one Room and the Room Drafts of it to save, each with its revision,
159
200
  validates locally, and on success appends one Change Batch to that Room's
160
- queue and removes those Room Drafts. It is refused as `stale`, as
201
+ queue and removes those Room Drafts. It is refused with the `code` `stale`,
161
202
  `changed-underneath` naming each part whose base no longer matches the visible
162
- state, or by a local validation rule, and then creates nothing and leaves every
203
+ state, or a local validation rule, and then creates nothing and leaves every
163
204
  Room Draft in place. A directory move or removal is a move or removal part on
164
205
  each Document and binary link target beneath it, saved together.
165
206
 
@@ -179,6 +220,13 @@ it names; the MD Runtime retries the same Change Batch identity and payload and
179
220
  never infers an outcome from transport uncertainty. The MD Runtime never
180
221
  combines, reorders, or rebases.
181
222
 
223
+ On a Site, every Save stays in the visitor's browser. Write grants and
224
+ revisions do not refuse it, and its Pending Change shows in every query and
225
+ across reloads until the browser's storage is cleared. It is never sent:
226
+ `observe('queue', room)` shows it `local`, and Sync Status never waits on it.
227
+ Once the Room changes so that it no longer applies, it leaves the queue and
228
+ returns no Room Draft.
229
+
182
230
  `observe('service-mode')` answers the Provider's Service
183
231
  Mode, `open` or `write-halted`. While writes are halted, Save still succeeds,
184
232
  its Change Batch waits unsent, and the queue is submitted in order once the
@@ -214,23 +262,55 @@ the network. Data lives only in the App Creator's browser and with the Provider.
214
262
 
215
263
  ## App code takes the client its host hands it and never constructs a Runtime
216
264
 
217
- App code takes the client its host hands it: in House,
218
- `connectHouseBridge().runtime` from `@agentshouse/app-bridge` resolves to the
219
- client House built into the page. It never constructs a Runtime or a client.
220
- It imports only types from `@agentshouse/mdruntime/client`, does not call
221
- `connectMdRuntime` or `serveMdRuntime`, and does not import the package main,
222
- the host entry, or the Adapter package. Hosts and tests use those entries; the
223
- served App does not.
265
+ App code takes the client its host hands it: in House, `houseBridge().runtime`
266
+ from `@agentshouse/app-bridge` resolves to the client House built into the page.
267
+ It never constructs a Runtime or a client. It imports only types from
268
+ `@agentshouse/mdruntime/client`, does not call `connectMdRuntime` or
269
+ `serveMdRuntime`, and does not import the package main, the host entry, or the
270
+ Adapter package. Hosts and tests use those entries; the served App does not.
224
271
 
225
272
  A React App may observe and save through `@agentshouse/mdruntime/react`, which
226
273
  names React as a peer dependency. `useObserve(client, topic, ...input)` takes
227
- the arguments of `observe` and returns the topic's current value, `undefined`
228
- until it arrives, re-rendering on each change; a `null` client observes
229
- nothing. `useSave(client)` returns `busy`, the last `outcome` or `failure`, and
230
- `save(room, roomDrafts)`, which writes each Path's parts onto the Room Draft
231
- already there, keeping the bases its parts have, or onto a new one, and saves
232
- them together. A refused Save leaves the Room Drafts for the App to save again
233
- or discard; a failure is recorded and rejects.
274
+ the arguments of `observe` and returns `{ state: 'loading' }` until the topic's
275
+ first value arrives, then `{ state: 'ready', value }`, re-rendering on each
276
+ change; a `null` client observes nothing and stays loading. `useSave(client)`
277
+ returns `busy`, the last `outcome` or `failure`, and `save(room, roomDrafts)`,
278
+ which writes each Path's parts onto the Room Draft already there, keeping the
279
+ bases its parts have, or onto a new one, and saves them together. A refused
280
+ Save leaves the Room Drafts for the App to save again or discard; a failure is
281
+ recorded and rejects. `saveRoomDrafts(client, room, roomDrafts)` is that save
282
+ outside a component. A react-admin or Refine App reads and writes its Rooms
283
+ through the data providers of `@agentshouse/mdruntime-families`.
284
+
285
+ ## The Chat
286
+
287
+ `@agentshouse/mdruntime/chat` holds the Chat, one data layer for every App.
288
+ Its required peers are React, React DOM and `@assistant-ui/react`: add React as
289
+ a dependency, also in an App not written in React.
290
+
291
+ Place the ready chat with `<Chat client={runtime} conversation={id}
292
+ agent={agent} width="1/3" showChats />`: `conversation` opens one, `null` for a
293
+ new chat, `agent` is the Agent a new chat goes to, `onOpen` hears each one it
294
+ opens, and `width` is `full` (the place you give it), or `3/4`, `1/2` or `1/3`
295
+ of the window docked at its right edge, whole on a narrow window. `showChats`
296
+ adds its conversation list; or draw your own inside a `ChatProvider` around a
297
+ `<Chat />` with no `client`. It carries its own styles; theme it with CSS custom
298
+ properties on it or an ancestor: `--chat-background`, `--chat-surface`,
299
+ `--chat-text`, `--chat-text-muted`, `--chat-accent`, `--chat-line`,
300
+ `--chat-attention`, `--chat-danger`, `--chat-font`, `--chat-font-mono`,
301
+ `--chat-font-size`, `--chat-radius` and `--chat-density` (a factor for spacing);
302
+ an unset one keeps House's light or dark look. `mountChat(element, { client })`
303
+ places it outside React and returns `update(props)` and `unmount()`.
304
+
305
+ Mix `ChatMessageList` (`components` takes your `UserMessage` and
306
+ `AssistantMessage`), `ChatInput` and `ChatQuestionCard` with your own design
307
+ inside a `ChatProvider`, or compose assistant-ui's primitives there; `useChat()`
308
+ gives `send`, the conversations, the Agents, questions to `answer`, `options`
309
+ to `choose`, `commands`, the queue to `edit` or `unqueue`, `stop`, `kill` and
310
+ outcomes; never replace its messages, sending or store. A secret question is
311
+ never answered here; typed answers live in Presentation State's `typed` key:
312
+ keep it, and change Presentation State only inside `inTurn(client, work)` from
313
+ `@agentshouse/mdruntime/client`. `Markdown` draws Markdown safely.
234
314
 
235
315
  ## What an agent must never do
236
316
 
package/README.md CHANGED
@@ -12,22 +12,23 @@ npm install @agentshouse/mdruntime
12
12
 
13
13
  ## Entries
14
14
 
15
- | Entry | For |
16
- | ------------------------------- | ---------------------------------------------------- |
17
- | `@agentshouse/mdruntime/client` | The host's client: `connectMdRuntime(port)` |
18
- | `@agentshouse/mdruntime/host` | The host that serves a Runtime: `serveMdRuntime` |
19
- | `@agentshouse/mdruntime` | Shared types |
20
- | `@agentshouse/mdruntime/memory` | Tests: `createMemoryAdapter`, an in-memory Adapter |
21
- | `@agentshouse/mdruntime/react` | React hooks over the client: `useObserve`, `useSave` |
15
+ | Entry | For |
16
+ | ------------------------------- | ---------------------------------------------------------------- |
17
+ | `@agentshouse/mdruntime/client` | The host's client: `connectMdRuntime(port)` |
18
+ | `@agentshouse/mdruntime/host` | The host that serves a Runtime: `serveMdRuntime` |
19
+ | `@agentshouse/mdruntime` | Shared types |
20
+ | `@agentshouse/mdruntime/memory` | Tests: `createMemoryAdapter`, an in-memory Adapter |
21
+ | `@agentshouse/mdruntime/react` | React over the client: `useObserve`, `useSave`, `saveRoomDrafts` |
22
+ | `@agentshouse/mdruntime/chat` | The Chat: `Chat`, `mountChat`, its parts and `ChatProvider` |
22
23
 
23
24
  ## Usage
24
25
 
25
26
  App code takes the client its host hands it; in House the App bridge hands it:
26
27
 
27
28
  ```ts
28
- import { connectHouseBridge } from '@agentshouse/app-bridge';
29
+ import { houseBridge } from '@agentshouse/app-bridge';
29
30
 
30
- const runtime = await connectHouseBridge().runtime;
31
+ const runtime = await houseBridge().runtime;
31
32
  const rooms = await runtime.rooms();
32
33
  const notes = await runtime.query({ types: ['note'], select: 'all', limit: 20 });
33
34
  ```
@@ -36,8 +37,17 @@ const notes = await runtime.query({ types: ['note'], select: 'all', limit: 20 })
36
37
  `storage-loss` when unsynchronized Room Drafts and Pending Changes were lost.
37
38
  The host supplies the user-facing wording.
38
39
 
40
+ Place the ready chat, themed by CSS custom properties, docked at a third of the
41
+ window; outside React, `mountChat(element, { client: runtime })` places the same:
42
+
43
+ ```tsx
44
+ import { Chat } from '@agentshouse/mdruntime/chat';
45
+
46
+ <Chat client={runtime} width="1/3" showChats style={{ '--chat-accent': '#2a6cf0' }} />;
47
+ ```
48
+
39
49
  The rules an App's agent follows, including Local Query, Local Search, Room
40
- Draft and Save, are in [`AGENTS.md`](AGENTS.md).
50
+ Draft, Save and the Chat, are in [`AGENTS.md`](AGENTS.md).
41
51
 
42
52
  ## License
43
53
 
package/dist/adapter.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ModelResult } from './model.js';
2
+ import type { Open } from './open.js';
2
3
  import type { ChangeBatch } from './change.js';
3
4
  export type Authorization = object;
4
5
  export type MdModelIdentity = {
@@ -16,7 +17,7 @@ export type OperationScopes = {
16
17
  };
17
18
  export type ReplicaAdmission = {
18
19
  selection: string;
19
- admission: 'admitted' | 'unavailable';
20
+ admission: Open<'admitted' | 'unavailable'>;
20
21
  };
21
22
  export type DiscoveredRoom = {
22
23
  name: string;
@@ -39,6 +40,7 @@ export type ConversationAgents = {
39
40
  type: string;
40
41
  identity: string;
41
42
  name: string;
43
+ retired?: string;
42
44
  };
43
45
  export type ListedConversation = {
44
46
  conversation: string;
@@ -207,6 +209,7 @@ export type Discovery = {
207
209
  capabilities: readonly Capability[];
208
210
  providerLimits: readonly ProviderLimit[];
209
211
  retention: Retention;
212
+ member?: Member;
210
213
  };
211
214
  export type TransportUncertainty = {
212
215
  kind: 'transport-uncertainty';
@@ -221,11 +224,12 @@ export type RevokedAuthorization = {
221
224
  export type ProviderRefusal = {
222
225
  code: string;
223
226
  fields: Readonly<Record<string, unknown>>;
227
+ retryable: boolean;
224
228
  };
225
229
  export type ScopedRefusal = ProviderRefusal & {
226
230
  kind: 'scoped-refusal';
227
231
  locator: string;
228
- scope: 'content' | 'sync' | 'model' | 'operation' | 'undisclosed';
232
+ scope: Open<'content' | 'sync' | 'model' | 'operation' | 'undisclosed'>;
229
233
  };
230
234
  export type AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization | ScopedRefusal;
231
235
  export type ContractUnavailable = ProviderRefusal & {
@@ -242,16 +246,18 @@ export type ChangeAuthor = {
242
246
  id: string;
243
247
  name: string;
244
248
  };
249
+ export type Member = Extract<ChangeAuthor, {
250
+ kind: 'user';
251
+ }>;
245
252
  export type HeadChange = {
246
253
  author: ChangeAuthor | null;
247
254
  time: string;
248
255
  };
249
- export type RoomAttachment = {
250
- reference: string;
251
- name: string;
256
+ export type BinaryFile = {
257
+ fileRef: string;
252
258
  byteLength: number;
253
- mediaType: string | null;
254
- entry: unknown;
259
+ mediaType: string;
260
+ sha256: string;
255
261
  };
256
262
  export type BootstrapRequest = {
257
263
  locator: string;
@@ -269,8 +275,7 @@ export type BootstrapPage = {
269
275
  documents: Readonly<Record<string, string>>;
270
276
  revisions: Readonly<Record<string, string>>;
271
277
  changes: Readonly<Record<string, HeadChange>>;
272
- binaryTargets: readonly string[];
273
- attachments?: readonly RoomAttachment[];
278
+ binaryFiles: Readonly<Record<string, BinaryFile>>;
274
279
  pageToken?: PageToken;
275
280
  };
276
281
  export type BootstrapResult = BootstrapPage | AdapterFailure;
@@ -287,9 +292,8 @@ export type RefreshPage = {
287
292
  documents: Readonly<Record<string, string>>;
288
293
  revisions: Readonly<Record<string, string>>;
289
294
  changes: Readonly<Record<string, HeadChange>>;
290
- binaryTargets: readonly string[];
295
+ binaryFiles: Readonly<Record<string, BinaryFile>>;
291
296
  removals: readonly string[];
292
- attachments?: readonly RoomAttachment[];
293
297
  pageToken?: PageToken;
294
298
  };
295
299
  export type RefreshResult = {
@@ -306,7 +310,7 @@ export type RetryableRefusal = ProviderRefusal & {
306
310
  kind: 'retryable-refusal';
307
311
  reset?: string;
308
312
  };
309
- export type ServiceMode = 'open' | 'write-halted';
313
+ export type ServiceMode = Open<'open' | 'write-halted'>;
310
314
  export type ServiceModeSignal = {
311
315
  observe(notify: (mode: ServiceMode) => void): () => void;
312
316
  };
@@ -315,8 +319,9 @@ export type MutationResult = {
315
319
  roomVersion: string;
316
320
  documents: Readonly<Record<string, string>>;
317
321
  revisions: Readonly<Record<string, string>>;
322
+ changes: Readonly<Record<string, HeadChange>>;
318
323
  removals: readonly string[];
319
- attachments?: readonly RoomAttachment[];
324
+ binaryFiles?: Readonly<Record<string, BinaryFile>>;
320
325
  author?: string;
321
326
  time?: string;
322
327
  } | (ProviderRefusal & {
@@ -343,6 +348,7 @@ export type HistoryRevision = {
343
348
  revision: string;
344
349
  author: HistoryAuthor;
345
350
  time: string;
351
+ binaryFile?: BinaryFile;
346
352
  };
347
353
  export type HistoryRequest = {
348
354
  locator: string;
@@ -354,12 +360,37 @@ export type HistoryResult = {
354
360
  kind: 'history';
355
361
  revisions: readonly HistoryRevision[];
356
362
  pageToken?: PageToken;
363
+ deleted?: true;
357
364
  } | {
358
365
  kind: 'revision';
359
366
  content: string;
360
367
  } | {
361
368
  kind: 'no-history';
362
369
  } | AdapterFailure;
370
+ export type BinaryRequest = {
371
+ kind: 'path';
372
+ locator: string;
373
+ path: string;
374
+ revision: string;
375
+ fileRef?: string;
376
+ } | {
377
+ kind: 'reference';
378
+ fileRef: string;
379
+ referrer: unknown;
380
+ };
381
+ export type ReferrerScope = {
382
+ kind: 'room';
383
+ locator: string;
384
+ path?: string;
385
+ } | {
386
+ kind: 'conversations';
387
+ };
388
+ export type BinaryResult = {
389
+ kind: 'binary';
390
+ blob: Blob;
391
+ } | (ProviderRefusal & {
392
+ kind: 'rejected';
393
+ }) | AdapterFailure;
363
394
  export type ActionRequest = {
364
395
  name: string;
365
396
  input: unknown;
@@ -380,7 +411,6 @@ export type HeldRoom = {
380
411
  roomVersion: string;
381
412
  documents: Readonly<Record<string, string>>;
382
413
  revisions: Readonly<Record<string, string>>;
383
- attachments: readonly RoomAttachment[];
384
414
  };
385
415
  export type RoomStreamEvent = {
386
416
  kind: 'opened';
@@ -397,15 +427,19 @@ export type RoomStreamEvent = {
397
427
  };
398
428
  export type RoomStream = {
399
429
  hold(rooms: readonly HeldRoom[]): void;
430
+ reopen(): void;
400
431
  observe(notify: (event: RoomStreamEvent) => void): () => void;
401
432
  };
402
433
  export type Adapter = {
434
+ readonly localSaves?: true;
403
435
  authorize(): Promise<Authorization>;
404
436
  discover(authorization: Authorization): Promise<DiscoverResult>;
405
437
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
406
438
  refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
407
439
  mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
408
440
  history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
441
+ binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
442
+ referrerScope(referrer: unknown): ReferrerScope | null;
409
443
  action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
410
444
  reached(locator: string, roomVersion: string, target: string): boolean;
411
445
  follows(locator: string, roomVersion: string, next: string): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,UAAU,GAAG,aAAa,CAAA;CAAE,CAAC;AAE5F,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;IAC5B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,kBAAkB,EAA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,MAAM,GAAG,OAAO,CAAC;IACrE,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"attached-model.d.ts","sourceRoot":"","sources":["../src/attached-model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAI1E,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACvE,CAAC;AAEF,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,aAAa,CA+BtF"}
1
+ {"version":3,"file":"attached-model.d.ts","sourceRoot":"","sources":["../src/attached-model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAI1E,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACvE,CAAC;AAEF,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,aAAa,CA4CtF"}
@@ -9,12 +9,25 @@ export function attachedModel(answer, previous) {
9
9
  if (previous.status !== 'unavailable' &&
10
10
  sameModel(previous.snapshot, answer.snapshot) &&
11
11
  previous.snapshot.schema !== answer.snapshot.schema) {
12
- return { state: { status: 'unavailable', reason: 'invalid' }, refused: null };
12
+ return {
13
+ state: {
14
+ status: 'unavailable',
15
+ reason: 'invalid',
16
+ schema: answer.snapshot.schema,
17
+ revision: answer.snapshot.revision,
18
+ },
19
+ refused: null,
20
+ };
13
21
  }
14
22
  const verified = answer.snapshot.schema === null ? EMPTY_SCHEMA : verify(answer.snapshot.schema);
15
23
  if (verified.verdict === 'refuse') {
16
24
  return {
17
- state: { status: 'unavailable', reason: 'invalid' },
25
+ state: {
26
+ status: 'unavailable',
27
+ reason: 'invalid',
28
+ schema: answer.snapshot.schema,
29
+ revision: answer.snapshot.revision,
30
+ },
18
31
  refused: {
19
32
  identity: answer.snapshot.identity,
20
33
  rule: verified.rule,
@@ -0,0 +1,16 @@
1
+ export type Answered = 'accepted' | 'refused' | 'unanswered' | 'offline';
2
+ export type Identities = {
3
+ of(intent: string): string;
4
+ settle(answered: Answered): void;
5
+ };
6
+ export declare function identities(mint?: () => string): Identities;
7
+ export declare function intentOf(name: string, about: unknown): string;
8
+ export type Attempt = {
9
+ identity(intent: string): string;
10
+ settle(answered: Answered, drop: (act: number) => void): void;
11
+ };
12
+ export type Attempts = {
13
+ begin(act: number): Attempt;
14
+ };
15
+ export declare function attempts(mint?: () => string): Attempts;
16
+ //# sourceMappingURL=attempt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attempt.d.ts","sourceRoot":"","sources":["../src/attempt.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;AAEzE,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,GAAE,MAAM,MAAoC,GAAG,UAAU,CAmBvF;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAE7D;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7B,CAAC;AAEF,wBAAgB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,MAAM,GAAG,QAAQ,CAyBtD"}
@@ -0,0 +1,57 @@
1
+ import { changeBatchIdentity } from './identity.js';
2
+ export function identities(mint = () => changeBatchIdentity()) {
3
+ const kept = new Map();
4
+ let used = new Map();
5
+ return {
6
+ of(intent) {
7
+ const one = used.get(intent) ?? kept.get(intent) ?? mint();
8
+ used.set(intent, one);
9
+ return one;
10
+ },
11
+ settle(answered) {
12
+ if (answered !== 'offline') {
13
+ for (const [intent, one] of used) {
14
+ if (answered === 'unanswered')
15
+ kept.set(intent, one);
16
+ else
17
+ kept.delete(intent);
18
+ }
19
+ }
20
+ used = new Map();
21
+ },
22
+ };
23
+ }
24
+ export function intentOf(name, about) {
25
+ return `${name}\u0000${JSON.stringify(about)}`;
26
+ }
27
+ export function attempts(mint) {
28
+ const numbers = identities(mint);
29
+ const waiting = new Map();
30
+ return {
31
+ begin(act) {
32
+ const intents = [];
33
+ return {
34
+ identity(intent) {
35
+ intents.push(intent);
36
+ return numbers.of(intent);
37
+ },
38
+ settle(answered, drop) {
39
+ numbers.settle(answered);
40
+ if (answered === 'refused' || answered === 'offline')
41
+ drop(act);
42
+ if (answered === 'offline')
43
+ return;
44
+ for (const intent of intents) {
45
+ const earlier = waiting.get(intent);
46
+ if (earlier !== undefined && earlier !== act)
47
+ drop(earlier);
48
+ if (answered === 'unanswered')
49
+ waiting.set(intent, act);
50
+ else
51
+ waiting.delete(intent);
52
+ }
53
+ },
54
+ };
55
+ },
56
+ };
57
+ }