@agentshouse/mdruntime-adapter 0.1.0-c6ddfd288ac81 → 0.1.0-c7d6f34caf6de

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/AGENTS.md +164 -56
  2. package/README.md +3 -3
  3. package/dist/actions.d.ts +41 -2
  4. package/dist/actions.d.ts.map +1 -1
  5. package/dist/actions.js +137 -123
  6. package/dist/adapter.d.ts.map +1 -1
  7. package/dist/adapter.js +231 -154
  8. package/dist/discovery.d.ts +14 -27
  9. package/dist/discovery.d.ts.map +1 -1
  10. package/dist/discovery.js +52 -101
  11. package/dist/gather.d.ts +1 -0
  12. package/dist/gather.d.ts.map +1 -1
  13. package/dist/gather.js +11 -6
  14. package/dist/handed.d.ts +15 -0
  15. package/dist/handed.d.ts.map +1 -0
  16. package/dist/handed.js +38 -0
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/model.d.ts +8 -18
  21. package/dist/model.d.ts.map +1 -1
  22. package/dist/model.js +63 -39
  23. package/dist/read.d.ts +16 -11
  24. package/dist/read.d.ts.map +1 -1
  25. package/dist/read.js +80 -106
  26. package/dist/referrer.d.ts +7 -0
  27. package/dist/referrer.d.ts.map +1 -0
  28. package/dist/referrer.js +35 -0
  29. package/dist/refusal.d.ts +5 -7
  30. package/dist/refusal.d.ts.map +1 -1
  31. package/dist/refusal.js +31 -32
  32. package/dist/site.d.ts.map +1 -1
  33. package/dist/site.js +86 -79
  34. package/dist/stream.d.ts +11 -4
  35. package/dist/stream.d.ts.map +1 -1
  36. package/dist/stream.js +155 -102
  37. package/dist/transport.d.ts +51 -20
  38. package/dist/transport.d.ts.map +1 -1
  39. package/dist/transport.js +3 -2
  40. package/dist/version.d.ts +1 -0
  41. package/dist/version.d.ts.map +1 -1
  42. package/dist/version.js +9 -0
  43. package/dist/write.d.ts +4 -5
  44. package/dist/write.d.ts.map +1 -1
  45. package/dist/write.js +98 -25
  46. package/package.json +4 -4
  47. package/dist/links.d.ts +0 -11
  48. package/dist/links.d.ts.map +0 -1
  49. package/dist/links.js +0 -51
package/AGENTS.md CHANGED
@@ -1,15 +1,25 @@
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, Slots, Query, Search, Observe, Types, Room Draft, Save, History, Call, Reached, Log,
11
- storage loss, the reported persistence answer, deployment facts, Sync Status, the Service Mode,
12
- reauthorization, conversation, the chat draft, and Presentation State.
9
+ Rooms, Query, Search, Observe, Types, Room Draft, Save, History, the binary file
10
+ reads, Call, Reached, Log,
11
+ the reported persistence answer, reauthorization, conversation, the chat draft,
12
+ and Presentation State. Sync Status, the Service Mode, the storage-loss
13
+ statement, the deployment facts and the signed-in member are observations only.
14
+
15
+ The host attaches each port with its reach, and every member and observation
16
+ answers within it: a Room outside it answers as one the replica does not hold,
17
+ Rooms lists only the Rooms reached whole, a Room reached for single Documents
18
+ shows only those Documents and the Types of the models that govern them, and
19
+ without conversations the conversation members, the chat draft and the
20
+ conversation observation hold none.
21
+ A change of the reach reaches every open observation as its new value, a query
22
+ keeping every unchanged Document the same object.
13
23
 
14
24
  Every `observe` resolves, once its first value has arrived, to a handle:
15
25
  `current()` is the latest complete value, `subscribe(listener)` hears each later
@@ -17,45 +27,84 @@ value whole and returns its unsubscribe, and `close()` ends the observation.
17
27
  Closing the port ends every handle and rejects every pending call and
18
28
  observation; a client that reconnects observes again.
19
29
 
20
- Each conversation a Provider card names is held complete in the browser.
30
+ `observe('agents')` answers every Agent a new conversation can go to, each
31
+ `{ identity, name }`, whether or not it has a conversation yet.
32
+ Each conversation the Provider's conversation list names is held complete in the
33
+ browser. `conversation.list()` and `observe('conversations')` answer each with its
34
+ Agent's identity and name, its name, created and finished times, last outcome and live
35
+ `state`: `asking` while a question waits, `working` while a turn runs, else `idle`,
36
+ and `started`, when the running turn began, or `null`.
21
37
  Observe one with `observe('conversation', id, { limit })`: the view
22
38
  holds its latest `limit` messages, or all of them, oldest first, its chat
23
39
  draft, and what the Provider streams for it whether or not anything views it:
24
- the growing text and plan of the running turn, the open questions, the process
25
- state, the CLI's commands and options, and the latest `workingNote`. These live
26
- only in memory: the turn's accepted message replaces its growing text and plan,
27
- a working note is never part of a message, and none of them is stored or
28
- searchable.
40
+ the running `turn` with its message parts and its context in use and window, the
41
+ open questions, the process state, and the CLI's commands and options. These live
42
+ only in memory: the message accepted under the turn's id replaces the running turn,
43
+ and none of them is stored or searchable.
29
44
  `chatDraft.write` and `chatDraft.discard` keep what the App Creator composes;
30
45
  sending it is a Provider Action that needs the Provider reachable and is never
31
46
  queued.
32
47
 
33
- Slots answers each Slot the Provider declares, in its order, with its entries
34
- in order, each a Room and its segment; a Room two Slots list is the same Room.
35
-
36
- Each Room in Rooms lists its `attachments`, the files the Provider holds for it
37
- that its Documents link by the Provider's reference, ordered by `reference`,
38
- each with `name`, `byteLength`, `mediaType` and the Provider's own entry as
39
- `entry`. They are as the Provider last declared them and hold no bytes;
40
- 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.
41
70
 
42
- Rooms, Slots, Query, Search, Observe, Types, Room Draft, Save, and Reached never
71
+ Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never
43
72
  touch the network.
44
- 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
45
76
  effect the Provider places in a Room carries `at`, that Room and Room Version;
46
77
  `reached(room, roomVersion)` answers whether the Room's confirmed state has
47
78
  reached it, and the MD Runtime keeps refreshing that Room until it has;
48
79
  `reached(room, roomVersion, path)` answers whether the held confirmed copy of
49
80
  that document was written at a later Room Version. Each History revision
50
- 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
51
85
  member of the
52
86
  client is asynchronous. Results are detached snapshots. Nothing in this
53
87
  surface returns the authorization, performs a request the App's code
54
88
  composes, or exposes the browser store.
55
89
 
56
- Read deployment facts with `deploymentFacts()` and observe replacements with
57
- `observe('deployment-facts')`. Interpret the opaque value using the
58
- host's contract.
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
+
97
+ Read the deployment facts with `observe('deployment-facts')`. Interpret the
98
+ opaque value using the host's contract.
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.
59
108
 
60
109
  The in-memory Adapter at `@agentshouse/mdruntime/memory` is for tests and
61
110
  ships in no bundle.
@@ -70,41 +119,48 @@ data:
70
119
  - **Filter.** `rooms` names Room locators and defaults to every Room. `types`
71
120
  names MD Types, and `any` names untyped Markdown Documents. `pathPrefix` is a
72
121
  directory: `notes` keeps `notes/a.md` and not `notes2/a.md`.
73
- - **Fields.** `where` names frontmatter fields, ANDs them, and nests `$and` and
74
- `$or`. A bare value is equality; the operators are `$eq`, `$ne`, `$in`, `$nin`,
75
- `$gt`, `$gte`, `$lt`, `$lte`, `$all`, `$size` and `$exists`. Equality on a list
76
- asks whether it contains the value. Missing, null and empty differ:
122
+ - **Fields.** Every frontmatter value is named by JSON Pointer: `/status`,
123
+ `/shipping/city`, `~1` for a `/` and `~0` for a `~` in a key. A segment that
124
+ meets a list applies to every item and a number names one item. `where` names
125
+ pointers, ANDs them, and nests `$and` and `$or`; a pointer through a list holds
126
+ when any item satisfies it. A bare value is equality; the operators are `$eq`,
127
+ `$ne`, `$in`, `$nin`, `$gt`, `$gte`, `$lt`, `$lte`, `$all`, `$size` and
128
+ `$exists`. Equality on a list asks whether it contains the value. Missing, null and empty differ:
77
129
  `$exists: false` keeps a missing field, `null` an explicit null, `''` empty
78
130
  text and `$size: 0` an empty list. A date compares in calendar order and never
79
131
  with a date-time. A reference compares by the Room Path it resolves to.
80
- Untyped frontmatter is plain values. There is no text containment or regular
132
+ Untyped frontmatter, and a value under `oneOf` or a conditional, is plain
133
+ values. There is no text containment or regular
81
134
  expression.
82
135
  - **Relations.** `hop: { field, types, where, pathPrefix }` keeps Documents whose
83
- reference `field` points to a matching Document of the same Room.
84
- `backlinks: { field, types, where, pathPrefix }` keeps Documents that a
136
+ reference at pointer `field`, at any depth, points to a matching Document of the
137
+ same Room. `backlinks: { field, types, where, pathPrefix }` keeps Documents that a
85
138
  matching Document of the same Room references. Each keeps a Document once.
86
139
  - **Parts.** A Document query must `select`: `'all'`, or `fields`, `sections`,
87
- `preamble`, `markdown`, `backlinks` and `change`, where `fields` and `sections`
88
- are `'all'` or a list of names. Room and Path always return; a Markdown
89
- Document also returns its MD Type. A non-Markdown Document or binary link
90
- target returns only Room and Path. An unselected part is absent. Select only
140
+ `preamble`, `markdown`, `backlinks` and `change`, where `fields` is `'all'` or a
141
+ list of pointers and `sections` `'all'` or a list of names. Selected pointers
142
+ return the frontmatter holding only them, nested as written. A backlink names
143
+ the referring Path, MD Type and the pointer it came from as `field`. Room and Path always return; a Markdown
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
91
147
  what a screen shows: a list that selects the Markdown hears every edit of it.
92
148
  - **Change.** `change` is `{ author, time }` of the Document's head revision as
93
149
  the Provider last delivered it: `author` is `{ kind: 'user' | 'site', id, name }`
94
150
  or `null` for a write the Provider made itself, and `time` is the Provider's
95
151
  ISO 8601 change time. It is `null` where the Provider delivered no time, as at
96
152
  a Site. An unsent edit or move keeps it, an unsent creation has none, and a
97
- 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
98
154
  Room's last change is its Document with the latest `time`.
99
155
  - **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }`
100
156
  with TanStack DB's own options, and ties end with Room, then Path. `groupBy` by
101
157
  `room`, `type` or `{ field }` answers `{ groups: [{ key, count }] }`, counted
102
- over every match and ordered by `count` or a key. `limit` bounds the Documents
103
- or the groups.
158
+ over every match and ordered by `count` or a key. A sort or group takes only a
159
+ pointer that holds one value. `limit` bounds the Documents or the groups.
104
160
  - **Results and errors.** A result carries no Room Version: read freshness from
105
- Rooms and Sync Status. An invalid query fails with `invalid-query`,
106
- `unknown-type`, `unknown-field` or `wrong-kind`, naming where, and never
107
- 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.
108
164
 
109
165
  ## Local Search rules
110
166
 
@@ -114,7 +170,7 @@ search.
114
170
 
115
171
  - **What is found.** A Document by its field values, its sections' headings and
116
172
  text, its preamble and its Path; a message by its text. Frontmatter keys, Room
117
- Drafts, chat drafts and growing text are never found. There are no phrases,
173
+ Drafts, chat drafts and a running turn's parts are never found. There are no phrases,
118
174
  word forms, typo tolerance or prefix matching.
119
175
  - **Narrowing.** `documents` is a Local Query filter: `rooms`, `types`, `where`,
120
176
  `pathPrefix`, `hop` and `backlinks`. `conversations` names conversations. Both
@@ -130,7 +186,7 @@ search.
130
186
 
131
187
  The MD Runtime owns one Room Draft per Room and Path, shared by every App and
132
188
  tab. It is durable: it survives reload and navigation. A Room that Discovery
133
- stops listing takes its Room Drafts, its queue and their outcomes with it.
189
+ stops listing takes its Room Drafts and its queue with it.
134
190
  Write a Room Draft with `roomDraft.write(room, path, revision, parts)`, naming
135
191
  the revision you read, or `null` when there was none, and every part it should
136
192
  now change: fields, sections and the preamble, or the whole Markdown, a
@@ -142,28 +198,36 @@ the current Room Draft; read it and write again.
142
198
 
143
199
  Save takes one Room and the Room Drafts of it to save, each with its revision,
144
200
  validates locally, and on success appends one Change Batch to that Room's
145
- 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`,
146
202
  `changed-underneath` naming each part whose base no longer matches the visible
147
- 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
148
204
  Room Draft in place. A directory move or removal is a move or removal part on
149
205
  each Document and binary link target beneath it, saved together.
150
206
 
151
207
  Outcomes follow the Provider's answer. An Accepted Change Batch stays in the
152
208
  queue, drawn over the confirmed layer, until the confirmed layer reaches the
153
- Room Version it was accepted at, and then leaves it. Conflicted and Rejected, an expired outcome record, and a change that no
209
+ Room Version it was accepted at, and then leaves it. Conflicted and Rejected, an expired operation, and a change that no
154
210
  longer applies over the Room each leave the queue and return as Room Drafts on
155
211
  the Documents they changed, marked with why: the Provider's structured refusal
156
212
  code and fields as returned, not known to have applied, or withdrawn locally.
157
213
  The rest of the queue keeps synchronizing, and Sync Status requires attention
158
- until each returned Room Draft is saved again or discarded. `outcome` answers
159
- the saved Change Batch's outcome, and `null` while it is Pending. Transport
214
+ until each returned Room Draft is saved again or discarded. A Change Batch
215
+ keeps no outcome once it leaves the queue; `observe('queue', room)` shows each
216
+ Pending one, and a returned Room Draft says why it returned. Transport
160
217
  failure and Provider unavailability keep work Pending and do not infer a
161
218
  rejection. A refusal the Provider marks retryable stays Pending until the reset
162
219
  it names; the MD Runtime retries the same Change Batch identity and payload and
163
220
  never infers an outcome from transport uncertainty. The MD Runtime never
164
221
  combines, reorders, or rebases.
165
222
 
166
- `serviceMode()` and `observe('service-mode')` answer the Provider's Service
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
+
230
+ `observe('service-mode')` answers the Provider's Service
167
231
  Mode, `open` or `write-halted`. While writes are halted, Save still succeeds,
168
232
  its Change Batch waits unsent, and the queue is submitted in order once the
169
233
  Provider reopens writes. An Action is never held: a write the Provider refuses
@@ -196,13 +260,57 @@ an App's override respected. What an App Creator's agent adds carries none
196
260
  of these promises by itself. Reading, querying and searching never wait for
197
261
  the network. Data lives only in the App Creator's browser and with the Provider.
198
262
 
199
- ## App code imports only the client entry and never constructs a Runtime
263
+ ## App code takes the client its host hands it and never constructs a Runtime
264
+
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.
271
+
272
+ A React App may observe and save through `@agentshouse/mdruntime/react`, which
273
+ names React as a peer dependency. `useObserve(client, topic, ...input)` takes
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()`.
200
304
 
201
- App code imports only `@agentshouse/mdruntime/client` and calls
202
- `connectMdRuntime` on the port the host hands it. It never constructs a
203
- Runtime. It does not import the package main, the host entry, or the Adapter
204
- package, and it does not call `createMdRuntime` or `serveMdRuntime`. Hosts
205
- and tests use those entries; the served App does not.
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.
206
314
 
207
315
  ## What an agent must never do
208
316
 
package/README.md CHANGED
@@ -19,12 +19,12 @@ import { serveMdRuntime } from '@agentshouse/mdruntime/host';
19
19
  import { createAgentsHouseAdapter } from '@agentshouse/mdruntime-adapter';
20
20
 
21
21
  const adapter = createAgentsHouseAdapter({ transport, authorize });
22
- const host = serveMdRuntime({ adapter, shell, requiredGuarantees: [] });
22
+ const host = serveMdRuntime({ adapter, shell });
23
23
  host.attach(port, 'my-app');
24
24
  ```
25
25
 
26
- App code never imports this package; it reaches the Runtime only through
27
- `@agentshouse/mdruntime/client`. The rules an App's agent follows are in the
26
+ App code never imports this package; it reaches the Runtime only through the
27
+ client its host hands it. The rules an App's agent follows are in the
28
28
  package's `AGENTS.md`.
29
29
 
30
30
  ## License
package/dist/actions.d.ts CHANGED
@@ -1,8 +1,47 @@
1
- import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationCards } from '@agentshouse/mdruntime';
1
+ import { type AcceptedMessage, type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationAgents, type ConversationHistories, type ConversationHistoryRequest, type FileDeclaration } from '@agentshouse/mdruntime';
2
2
  import type { HouseDoorAnswer, HouseTransport } from './transport.js';
3
- export declare const HOUSE_CONVERSATION_CARDS: ConversationCards;
3
+ type Operated = {
4
+ readonly operation_id?: string;
5
+ };
6
+ type ConversationControl = Operated & {
7
+ readonly conversation: string;
8
+ };
9
+ type SentFile = FileDeclaration & {
10
+ readonly blob: Blob;
11
+ };
12
+ export type AppInputs = {
13
+ readonly 'conversation.answer': ConversationControl & {
14
+ readonly answer: {
15
+ readonly interaction_id: string;
16
+ readonly response: unknown;
17
+ };
18
+ };
19
+ readonly 'conversation.create': Operated & {
20
+ readonly agent_id: string;
21
+ };
22
+ readonly 'conversation.delete': ConversationControl;
23
+ readonly 'conversation.history': ConversationHistoryRequest;
24
+ readonly 'conversation.interrupt': ConversationControl;
25
+ readonly 'conversation.kill': ConversationControl;
26
+ readonly 'conversation.send': ConversationControl & {
27
+ readonly text?: string;
28
+ readonly files?: readonly SentFile[];
29
+ };
30
+ };
31
+ export type AppAnswers = {
32
+ readonly 'conversation.history': ConversationHistories;
33
+ };
34
+ export type AppAnswerAdditions = {
35
+ readonly 'conversation.send': {
36
+ readonly turn: string;
37
+ };
38
+ };
39
+ export declare const HOUSE_APP_ACTS: Readonly<Record<string, string>>;
40
+ export declare const HOUSE_APP_BATCHES: Readonly<Partial<Record<string, readonly string[]>>>;
41
+ export declare function houseConversationAgents(locator: string): ConversationAgents;
4
42
  export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
5
43
  export declare function houseAction(transport: HouseTransport, request: ActionRequest): Promise<ActionResult>;
6
44
  export declare function actionOutcome(answer: HouseDoorAnswer, name: string): ActionResult;
7
45
  export declare function acceptedMessage(entry: unknown): AcceptedMessage | null;
46
+ export {};
8
47
  //# sourceMappingURL=actions.d.ts.map
@@ -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,iBAAiB,EAGvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkBtE,eAAO,MAAM,wBAAwB,EAAE,iBAKtC,CAAC;AAEF,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CASvF;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAQvB;AA4DD,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAWjF;AAuLD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAUtE"}
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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