@agentshouse/mdruntime 0.1.0-c967d1ca66fee → 0.1.0-c96e80d38e5f0

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 (175) hide show
  1. package/README.md +22 -9
  2. package/dist/adapter.d.ts +172 -49
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/attached-model.d.ts +5 -1
  5. package/dist/attached-model.d.ts.map +1 -1
  6. package/dist/attached-model.js +38 -4
  7. package/dist/attempt.d.ts +16 -0
  8. package/dist/attempt.d.ts.map +1 -0
  9. package/dist/attempt.js +70 -0
  10. package/dist/binary.d.ts +18 -0
  11. package/dist/binary.d.ts.map +1 -0
  12. package/dist/binary.js +8 -0
  13. package/dist/bootstrap.d.ts +27 -11
  14. package/dist/bootstrap.d.ts.map +1 -1
  15. package/dist/bootstrap.js +184 -84
  16. package/dist/chain.d.ts +11 -0
  17. package/dist/chain.d.ts.map +1 -0
  18. package/dist/chain.js +64 -0
  19. package/dist/change-set.d.ts +9 -14
  20. package/dist/change-set.d.ts.map +1 -1
  21. package/dist/change-set.js +11 -62
  22. package/dist/change.d.ts +41 -0
  23. package/dist/change.d.ts.map +1 -1
  24. package/dist/change.js +34 -0
  25. package/dist/client.d.ts +34 -15
  26. package/dist/client.d.ts.map +1 -1
  27. package/dist/client.js +104 -8
  28. package/dist/collection.d.ts +10 -7
  29. package/dist/collection.d.ts.map +1 -1
  30. package/dist/collection.js +38 -79
  31. package/dist/compile.d.ts +16 -0
  32. package/dist/compile.d.ts.map +1 -0
  33. package/dist/compile.js +789 -0
  34. package/dist/connection.d.ts +51 -17
  35. package/dist/connection.d.ts.map +1 -1
  36. package/dist/connection.js +3951 -907
  37. package/dist/conversation.d.ts +48 -19
  38. package/dist/conversation.d.ts.map +1 -1
  39. package/dist/conversation.js +726 -240
  40. package/dist/digest.d.ts +7 -0
  41. package/dist/digest.d.ts.map +1 -0
  42. package/dist/digest.js +113 -0
  43. package/dist/durability.d.ts +4 -1
  44. package/dist/durability.d.ts.map +1 -1
  45. package/dist/durability.js +5 -0
  46. package/dist/entry.d.ts +20 -0
  47. package/dist/entry.d.ts.map +1 -0
  48. package/dist/entry.js +152 -0
  49. package/dist/expectation.d.ts +21 -0
  50. package/dist/expectation.d.ts.map +1 -0
  51. package/dist/expectation.js +70 -0
  52. package/dist/fence.d.ts +6 -0
  53. package/dist/fence.d.ts.map +1 -0
  54. package/dist/fence.js +10 -0
  55. package/dist/file.d.ts +2 -19
  56. package/dist/file.d.ts.map +1 -1
  57. package/dist/file.js +7 -122
  58. package/dist/host.d.ts +12 -3
  59. package/dist/host.d.ts.map +1 -1
  60. package/dist/host.js +125 -18
  61. package/dist/identity.d.ts +3 -0
  62. package/dist/identity.d.ts.map +1 -1
  63. package/dist/identity.js +9 -0
  64. package/dist/index.d.ts +19 -9
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +9 -0
  67. package/dist/live.d.ts +22 -0
  68. package/dist/live.d.ts.map +1 -0
  69. package/dist/live.js +123 -0
  70. package/dist/media.d.ts +8 -0
  71. package/dist/media.d.ts.map +1 -0
  72. package/dist/media.js +218 -0
  73. package/dist/memory.d.ts +18 -7
  74. package/dist/memory.d.ts.map +1 -1
  75. package/dist/memory.js +231 -91
  76. package/dist/messages.d.ts +28 -0
  77. package/dist/messages.d.ts.map +1 -0
  78. package/dist/messages.js +89 -0
  79. package/dist/model.d.ts +9 -2
  80. package/dist/model.d.ts.map +1 -1
  81. package/dist/model.js +8 -2
  82. package/dist/name.d.ts +4 -0
  83. package/dist/name.d.ts.map +1 -0
  84. package/dist/name.js +122 -0
  85. package/dist/observation.d.ts +20 -2
  86. package/dist/observation.d.ts.map +1 -1
  87. package/dist/observation.js +113 -12
  88. package/dist/opened.d.ts +22 -0
  89. package/dist/opened.d.ts.map +1 -0
  90. package/dist/opened.js +107 -0
  91. package/dist/outcome.d.ts +52 -4
  92. package/dist/outcome.d.ts.map +1 -1
  93. package/dist/outcome.js +46 -0
  94. package/dist/overlay.d.ts +15 -5
  95. package/dist/overlay.d.ts.map +1 -1
  96. package/dist/overlay.js +129 -177
  97. package/dist/paths.d.ts +1 -0
  98. package/dist/paths.d.ts.map +1 -1
  99. package/dist/paths.js +4 -0
  100. package/dist/phrase.d.ts +3 -0
  101. package/dist/phrase.d.ts.map +1 -0
  102. package/dist/phrase.js +8 -0
  103. package/dist/query.d.ts +72 -4
  104. package/dist/query.d.ts.map +1 -1
  105. package/dist/query.js +67 -7
  106. package/dist/reach.d.ts +16 -2
  107. package/dist/reach.d.ts.map +1 -1
  108. package/dist/reach.js +222 -56
  109. package/dist/react.d.ts +11 -7
  110. package/dist/react.d.ts.map +1 -1
  111. package/dist/react.js +7 -17
  112. package/dist/readiness.d.ts +50 -0
  113. package/dist/readiness.d.ts.map +1 -0
  114. package/dist/readiness.js +27 -0
  115. package/dist/recovery.d.ts +26 -0
  116. package/dist/recovery.d.ts.map +1 -0
  117. package/dist/recovery.js +224 -0
  118. package/dist/refresh.d.ts +17 -14
  119. package/dist/refresh.d.ts.map +1 -1
  120. package/dist/refresh.js +155 -56
  121. package/dist/replica.d.ts +58 -33
  122. package/dist/replica.d.ts.map +1 -1
  123. package/dist/replica.js +310 -159
  124. package/dist/room-draft.d.ts +52 -5
  125. package/dist/room-draft.d.ts.map +1 -1
  126. package/dist/room-draft.js +261 -56
  127. package/dist/rows.d.ts +38 -35
  128. package/dist/rows.d.ts.map +1 -1
  129. package/dist/rows.js +178 -102
  130. package/dist/save.d.ts +70 -3
  131. package/dist/save.d.ts.map +1 -1
  132. package/dist/save.js +805 -147
  133. package/dist/search.d.ts +15 -55
  134. package/dist/search.d.ts.map +1 -1
  135. package/dist/search.js +10 -121
  136. package/dist/seed.d.ts +16 -0
  137. package/dist/seed.d.ts.map +1 -0
  138. package/dist/seed.js +75 -0
  139. package/dist/shared.d.ts +15 -0
  140. package/dist/shared.d.ts.map +1 -0
  141. package/dist/shared.js +421 -0
  142. package/dist/status.d.ts +5 -0
  143. package/dist/status.d.ts.map +1 -1
  144. package/dist/status.js +3 -1
  145. package/dist/store.d.ts +116 -80
  146. package/dist/store.d.ts.map +1 -1
  147. package/dist/store.js +355 -461
  148. package/dist/stored.d.ts +162 -0
  149. package/dist/stored.d.ts.map +1 -0
  150. package/dist/stored.js +549 -0
  151. package/dist/tables.d.ts +353 -0
  152. package/dist/tables.d.ts.map +1 -0
  153. package/dist/tables.js +585 -0
  154. package/dist/transfer.d.ts +0 -5
  155. package/dist/transfer.d.ts.map +1 -1
  156. package/dist/turn.d.ts +9 -0
  157. package/dist/turn.d.ts.map +1 -0
  158. package/dist/turn.js +75 -0
  159. package/dist/validation.d.ts +29 -0
  160. package/dist/validation.d.ts.map +1 -0
  161. package/dist/validation.js +101 -0
  162. package/dist/windows.d.ts +22 -0
  163. package/dist/windows.d.ts.map +1 -0
  164. package/dist/windows.js +89 -0
  165. package/dist/wire.d.ts +166 -30
  166. package/dist/wire.d.ts.map +1 -1
  167. package/dist/wire.js +57 -29
  168. package/package.json +26 -15
  169. package/AGENTS.md +0 -269
  170. package/dist/attachment.d.ts +0 -3
  171. package/dist/attachment.d.ts.map +0 -1
  172. package/dist/attachment.js +0 -8
  173. package/dist/read-side.d.ts +0 -18
  174. package/dist/read-side.d.ts.map +0 -1
  175. package/dist/read-side.js +0 -433
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/mdruntime",
3
- "version": "0.1.0-c967d1ca66fee",
3
+ "version": "0.1.0-c96e80d38e5f0",
4
4
  "description": "The headless core of MD App",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,48 +9,59 @@
9
9
  "access": "public"
10
10
  },
11
11
  "engines": {
12
- "node": ">=24.21.0"
12
+ "node": ">=24.22.1"
13
13
  },
14
14
  "exports": {
15
15
  ".": {
16
16
  "types": "./dist/index.d.ts",
17
- "import": "./dist/index.js"
17
+ "default": "./dist/index.js"
18
18
  },
19
19
  "./host": {
20
20
  "types": "./dist/host.d.ts",
21
- "import": "./dist/host.js"
21
+ "default": "./dist/host.js"
22
22
  },
23
23
  "./client": {
24
24
  "types": "./dist/client.d.ts",
25
- "import": "./dist/client.js"
25
+ "default": "./dist/client.js"
26
+ },
27
+ "./entry": {
28
+ "types": "./dist/entry.d.ts",
29
+ "default": "./dist/entry.js"
26
30
  },
27
31
  "./memory": {
28
32
  "types": "./dist/memory.d.ts",
29
- "import": "./dist/memory.js"
33
+ "default": "./dist/memory.js"
34
+ },
35
+ "./tables": {
36
+ "types": "./dist/tables.d.ts",
37
+ "default": "./dist/tables.js"
30
38
  },
31
39
  "./react": {
32
40
  "types": "./dist/react.d.ts",
33
- "import": "./dist/react.js"
41
+ "default": "./dist/react.js"
42
+ },
43
+ "./digest": {
44
+ "types": "./dist/digest.d.ts",
45
+ "default": "./dist/digest.js"
34
46
  },
35
47
  "./package.json": "./package.json"
36
48
  },
37
49
  "files": [
38
50
  "dist",
39
- "AGENTS.md",
51
+ "!dist/chat.*",
52
+ "!dist/chat/",
40
53
  "README.md",
41
54
  "LICENSE"
42
55
  ],
43
56
  "dependencies": {
44
- "@agentshouse/mdmodel": "0.1.0-c4d2418e88679",
45
- "@tanstack/db": "0.9.2",
46
- "minisearch": "7.2.0"
57
+ "@agentshouse/mdmodel": "0.1.0-cc58fdf3541b7"
47
58
  },
48
59
  "peerDependencies": {
49
60
  "react": ">=18"
50
61
  },
51
- "peerDependenciesMeta": {
52
- "react": {
53
- "optional": true
54
- }
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "git+https://github.com/agentshouse/core.git",
65
+ "directory": "mdruntime/packages/mdruntime"
55
66
  }
56
67
  }
package/AGENTS.md DELETED
@@ -1,269 +0,0 @@
1
- # Instructions for the App Creator's agent
2
-
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.
6
-
7
- ## The MD Runtime API
8
-
9
- 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,
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.
23
-
24
- Every `observe` resolves, once its first value has arrived, to a handle:
25
- `current()` is the latest complete value, `subscribe(listener)` hears each later
26
- value whole and returns its unsubscribe, and `close()` ends the observation.
27
- Closing the port ends every handle and rejects every pending call and
28
- observation; a client that reconnects observes again.
29
-
30
- Each conversation the Provider's conversation list names is held complete in the
31
- browser. `conversation.list()` and `observe('conversations')` answer each with its
32
- Agent's identity and name, its name, created and finished times, last outcome and live
33
- `state`: `asking` while a question waits, `working` while a turn runs, else `idle`,
34
- and `started`, when the running turn began, or `null`.
35
- Observe one with `observe('conversation', id, { limit })`: the view
36
- holds its latest `limit` messages, or all of them, oldest first, its chat
37
- draft, and what the Provider streams for it whether or not anything views it:
38
- the running `turn` with its message parts and its context in use and window, the
39
- open questions, the process state, and the CLI's commands and options. These live
40
- only in memory: the message accepted under the turn's id replaces the running turn,
41
- and none of them is stored or searchable.
42
- `chatDraft.write` and `chatDraft.discard` keep what the App Creator composes;
43
- sending it is a Provider Action that needs the Provider reachable and is never
44
- queued.
45
-
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.
51
-
52
- Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never
53
- touch the network.
54
- History and Call go to the Provider through the Adapter. Call takes the Action names
55
- the Adapter declares; any other name answers `undeclared` without reaching the
56
- Provider. A Call result whose
57
- effect the Provider places in a Room carries `at`, that Room and Room Version;
58
- `reached(room, roomVersion)` answers whether the Room's confirmed state has
59
- reached it, and the MD Runtime keeps refreshing that Room until it has;
60
- `reached(room, roomVersion, path)` answers whether the held confirmed copy of
61
- that document was written at a later Room Version. Each History revision
62
- names its author, `{ kind: 'user', id }` or `{ kind: 'site', id, name }`.
63
- History of a Path no current document holds answers the removed document's
64
- revisions with `deleted: true`, newest first; that revision is what a link to
65
- the Path opens. Every
66
- member of the
67
- client is asynchronous. Results are detached snapshots. Nothing in this
68
- surface returns the authorization, performs a request the App's code
69
- composes, or exposes the browser store.
70
-
71
- Every refusal and failure carries `code` and `retryable`: each Call and History answer
72
- other than its result, a refused Save or Room Draft write, a returned Room Draft's
73
- reason, a Room's refusal and the Connection Refusal, and every error a member rejects
74
- with, beside its message. A Provider refusal carries the Provider's own `retryable`.
75
- Every code and every value the API answers is open: handle one you do not know by its
76
- `code` and `retryable`.
77
-
78
- Read the deployment facts with `observe('deployment-facts')`. Interpret the
79
- opaque value using the host's contract.
80
-
81
- `observe('member')` answers who uses the App: the User the Provider signed in,
82
- `{ kind: 'user', id, name }` in the shape of a change's `author`, so a Document
83
- whose `change.author.id` equals its `id` is that User's own. It is `null` until
84
- the Provider first names one, and where it names none, such as a Site. The
85
- MD Runtime keeps it with the Local Replicas, so it answers offline once known,
86
- and every port hears the next member the Provider names; signing out answers
87
- `null`, then ends the observation with the authorization. It is the only way App code learns who
88
- uses it.
89
-
90
- The in-memory Adapter at `@agentshouse/mdruntime/memory` is for tests and
91
- ships in no bundle.
92
-
93
- ## Local Query rules
94
-
95
- `query(q)` answers once from local state; `observe('query', q)` holds the whole
96
- result and hears it again only when it changes, keeping every unchanged Document
97
- the same object, so a component can tell what changed by identity. A query is
98
- data:
99
-
100
- - **Filter.** `rooms` names Room locators and defaults to every Room. `types`
101
- names MD Types, and `any` names untyped Markdown Documents. `pathPrefix` is a
102
- directory: `notes` keeps `notes/a.md` and not `notes2/a.md`.
103
- - **Fields.** Every frontmatter value is named by JSON Pointer: `/status`,
104
- `/shipping/city`, `~1` for a `/` and `~0` for a `~` in a key. A segment that
105
- meets a list applies to every item and a number names one item. `where` names
106
- pointers, ANDs them, and nests `$and` and `$or`; a pointer through a list holds
107
- when any item satisfies it. A bare value is equality; the operators are `$eq`,
108
- `$ne`, `$in`, `$nin`, `$gt`, `$gte`, `$lt`, `$lte`, `$all`, `$size` and
109
- `$exists`. Equality on a list asks whether it contains the value. Missing, null and empty differ:
110
- `$exists: false` keeps a missing field, `null` an explicit null, `''` empty
111
- text and `$size: 0` an empty list. A date compares in calendar order and never
112
- with a date-time. A reference compares by the Room Path it resolves to.
113
- Untyped frontmatter, and a value under `oneOf` or a conditional, is plain
114
- values. There is no text containment or regular
115
- expression.
116
- - **Relations.** `hop: { field, types, where, pathPrefix }` keeps Documents whose
117
- reference at pointer `field`, at any depth, points to a matching Document of the
118
- same Room. `backlinks: { field, types, where, pathPrefix }` keeps Documents that a
119
- matching Document of the same Room references. Each keeps a Document once.
120
- - **Parts.** A Document query must `select`: `'all'`, or `fields`, `sections`,
121
- `preamble`, `markdown`, `backlinks` and `change`, where `fields` is `'all'` or a
122
- list of pointers and `sections` `'all'` or a list of names. Selected pointers
123
- return the frontmatter holding only them, nested as written. A backlink names
124
- the referring Path, MD Type and the pointer it came from as `field`. Room and Path always return; a Markdown
125
- Document also returns its MD Type. A non-Markdown Document or binary link
126
- target returns only Room and Path. An unselected part is absent. Select only
127
- what a screen shows: a list that selects the Markdown hears every edit of it.
128
- - **Change.** `change` is `{ author, time }` of the Document's head revision as
129
- the Provider last delivered it: `author` is `{ kind: 'user' | 'site', id, name }`
130
- or `null` for a write the Provider made itself, and `time` is the Provider's
131
- ISO 8601 change time. It is `null` where the Provider delivered no time, as at
132
- a Site. An unsent edit or move keeps it, an unsent creation has none, and a
133
- saved write takes the Provider's own once it is Accepted. A
134
- Room's last change is its Document with the latest `time`.
135
- - **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }`
136
- with TanStack DB's own options, and ties end with Room, then Path. `groupBy` by
137
- `room`, `type` or `{ field }` answers `{ groups: [{ key, count }] }`, counted
138
- over every match and ordered by `count` or a key. A sort or group takes only a
139
- pointer that holds one value. `limit` bounds the Documents or the groups.
140
- - **Results and errors.** A result carries no Room Version: read freshness from
141
- Rooms and Sync Status. An invalid query fails with the `code`
142
- `invalid-query`, `unknown-type`, `unknown-field` or `wrong-kind`, naming where,
143
- and never answers an empty result in its place.
144
-
145
- ## Local Search rules
146
-
147
- `search({ text, documents, conversations, limit })` answers once, by words, from
148
- local state, with MiniSearch at its default configuration. There is no observed
149
- search.
150
-
151
- - **What is found.** A Document by its field values, its sections' headings and
152
- text, its preamble and its Path; a message by its text. Frontmatter keys, Room
153
- Drafts, chat drafts and a running turn's parts are never found. There are no phrases,
154
- word forms, typo tolerance or prefix matching.
155
- - **Narrowing.** `documents` is a Local Query filter: `rooms`, `types`, `where`,
156
- `pathPrefix`, `hop` and `backlinks`. `conversations` names conversations. Both
157
- apply before `limit`, which bounds each list; without it every hit returns.
158
- - **Results.** `{ documents, messages }`, each ranked by `score`, which compares
159
- hits of one list of one search. A Document hit names its `room`, `path` and
160
- `type`, a message hit its `conversation` and `identity`, and `matches` maps each
161
- matched word to the parts it matched in: `fields`, `sections`, `preamble` or
162
- `path`, or `text`. A hit carries no position; mark the words in the text you
163
- show. An invalid filter fails with its Local Query error.
164
-
165
- ## Room Draft, Save, and outcome rules
166
-
167
- The MD Runtime owns one Room Draft per Room and Path, shared by every App and
168
- tab. It is durable: it survives reload and navigation. A Room that Discovery
169
- stops listing takes its Room Drafts and its queue with it.
170
- Write a Room Draft with `roomDraft.write(room, path, revision, parts)`, naming
171
- the revision you read, or `null` when there was none, and every part it should
172
- now change: fields, sections and the preamble, or the whole Markdown, a
173
- creation, a move, or a removal. A part new to the Room Draft names its base,
174
- the value you showed when it was opened; the MD Runtime keeps a part's first
175
- base. A binary link target has a Room Draft too, for a move or a removal, with
176
- `null` as its base. A write or a discard from an older revision is refused as `stale` with
177
- the current Room Draft; read it and write again.
178
-
179
- Save takes one Room and the Room Drafts of it to save, each with its revision,
180
- validates locally, and on success appends one Change Batch to that Room's
181
- queue and removes those Room Drafts. It is refused with the `code` `stale`,
182
- `changed-underneath` naming each part whose base no longer matches the visible
183
- state, or a local validation rule, and then creates nothing and leaves every
184
- Room Draft in place. A directory move or removal is a move or removal part on
185
- each Document and binary link target beneath it, saved together.
186
-
187
- Outcomes follow the Provider's answer. An Accepted Change Batch stays in the
188
- queue, drawn over the confirmed layer, until the confirmed layer reaches the
189
- Room Version it was accepted at, and then leaves it. Conflicted and Rejected, an expired operation, and a change that no
190
- longer applies over the Room each leave the queue and return as Room Drafts on
191
- the Documents they changed, marked with why: the Provider's structured refusal
192
- code and fields as returned, not known to have applied, or withdrawn locally.
193
- The rest of the queue keeps synchronizing, and Sync Status requires attention
194
- until each returned Room Draft is saved again or discarded. A Change Batch
195
- keeps no outcome once it leaves the queue; `observe('queue', room)` shows each
196
- Pending one, and a returned Room Draft says why it returned. Transport
197
- failure and Provider unavailability keep work Pending and do not infer a
198
- rejection. A refusal the Provider marks retryable stays Pending until the reset
199
- it names; the MD Runtime retries the same Change Batch identity and payload and
200
- never infers an outcome from transport uncertainty. The MD Runtime never
201
- combines, reorders, or rebases.
202
-
203
- On a Site, every Save stays in the visitor's browser. Write grants and
204
- revisions do not refuse it, and its Pending Change shows in every query and
205
- across reloads until the browser's storage is cleared. It is never sent:
206
- `observe('queue', room)` shows it `local`, and Sync Status never waits on it.
207
- Once the Room changes so that it no longer applies, it leaves the queue and
208
- returns no Room Draft.
209
-
210
- `observe('service-mode')` answers the Provider's Service
211
- Mode, `open` or `write-halted`. While writes are halted, Save still succeeds,
212
- its Change Batch waits unsent, and the queue is submitted in order once the
213
- Provider reopens writes. An Action is never held: a write the Provider refuses
214
- for the halt returns that refusal to its caller. Show the Provider as read-only
215
- instead of retrying.
216
-
217
- ## The neutrality rule
218
-
219
- No module outside an Adapter package imports, names, or special-cases a
220
- Provider. MD UI and every App reach data only through the client entry.
221
-
222
- ## Content-safety rules
223
-
224
- The Provider authorization belongs to the Runtime host and is never readable
225
- by the App's code. The App's code reaches the network only at the external
226
- origins its manifest declares, empty by default, and the Provider enforces
227
- that set. Every request to the Provider itself goes through the MD Runtime.
228
- Rendered Markdown never executes scripts, renders raw HTML only for the
229
- details and summary elements, and loads images and other resources only from
230
- origins the Provider's policy allows.
231
-
232
- ## Launch promises MD UI keeps
233
-
234
- MD UI uses semantic HTML, is fully operable from a keyboard with visible
235
- focus and labelled controls, and lays out from a 360 pixel wide viewport to
236
- a desktop. Its strings are English only, dates and numbers follow the
237
- browser locale, and content is never translated. Light and dark themes come
238
- from CSS custom properties with the browser's preference as the default and
239
- an App's override respected. What an App Creator's agent adds carries none
240
- of these promises by itself. Reading, querying and searching never wait for
241
- the network. Data lives only in the App Creator's browser and with the Provider.
242
-
243
- ## App code takes the client its host hands it and never constructs a Runtime
244
-
245
- App code takes the client its host hands it: in House,
246
- `houseBridge().runtime` from `@agentshouse/app-bridge` resolves to the
247
- client House built into the page. It never constructs a Runtime or a client.
248
- It imports only types from `@agentshouse/mdruntime/client`, does not call
249
- `connectMdRuntime` or `serveMdRuntime`, and does not import the package main,
250
- the host entry, or the Adapter package. Hosts and tests use those entries; the
251
- served App does not.
252
-
253
- A React App may observe and save through `@agentshouse/mdruntime/react`, which
254
- names React as a peer dependency. `useObserve(client, topic, ...input)` takes
255
- the arguments of `observe` and returns `{ state: 'loading' }` until the topic's
256
- first value arrives, then `{ state: 'ready', value }`, re-rendering on each
257
- change; a `null` client observes nothing and stays loading. `useSave(client)` returns `busy`, the last `outcome` or `failure`, and
258
- `save(room, roomDrafts)`, which writes each Path's parts onto the Room Draft
259
- already there, keeping the bases its parts have, or onto a new one, and saves
260
- them together. A refused Save leaves the Room Drafts for the App to save again
261
- or discard; a failure is recorded and rejects. `saveRoomDrafts(client, room,
262
- roomDrafts)` is that save outside a component. A react-admin or Refine App
263
- reads and writes its Rooms through the data providers of
264
- `@agentshouse/mdruntime-families`.
265
-
266
- ## What an agent must never do
267
-
268
- An agent must never read the authorization, load code from a Room, call the
269
- Provider directly, or rebase a refused Change Batch.
@@ -1,3 +0,0 @@
1
- import type { RoomAttachment } from './adapter.js';
2
- export declare function declaredAttachments(pages: readonly (readonly RoomAttachment[])[]): readonly RoomAttachment[];
3
- //# sourceMappingURL=attachment.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,GAC5C,SAAS,cAAc,EAAE,CAQ3B"}
@@ -1,8 +0,0 @@
1
- export function declaredAttachments(pages) {
2
- const byReference = new Map();
3
- for (const page of pages) {
4
- for (const attachment of page)
5
- byReference.set(attachment.reference, attachment);
6
- }
7
- return [...byReference.values()].sort((left, right) => left.reference < right.reference ? -1 : left.reference > right.reference ? 1 : 0);
8
- }
@@ -1,18 +0,0 @@
1
- import type { ChangeSet } from './change-set.js';
2
- import { type KeyedResult, type QueryChange } from './observation.js';
3
- import type { Plan, QueryResult } from './query.js';
4
- import type { SearchedDocument } from './search.js';
5
- export type ReadSide = {
6
- apply(set: ChangeSet): void;
7
- query(plan: Plan): Promise<QueryResult>;
8
- watch(plan: Plan, identity: string, deliver: (message: KeyedResult | QueryChange) => void): () => void;
9
- documents(): readonly SearchedDocument[];
10
- document(room: string, path: string): SearchedDocument | null;
11
- close(): void;
12
- };
13
- export declare function reconciled(previous: KeyedResult, next: KeyedResult): {
14
- keyed: KeyedResult;
15
- change: QueryChange;
16
- } | null;
17
- export declare function createReadSide(): ReadSide;
18
- //# sourceMappingURL=read-side.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read-side.d.ts","sourceRoot":"","sources":["../src/read-side.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC3F,OAAO,KAAK,EAOV,IAAI,EAIJ,WAAW,EAIZ,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAuDpD,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CACH,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,KAAK,IAAI,GACpD,MAAM,IAAI,CAAC;IACd,SAAS,IAAI,SAAS,gBAAgB,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAAC;IAC9D,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AA+UF,wBAAgB,UAAU,CACxB,QAAQ,EAAE,WAAW,EACrB,IAAI,EAAE,WAAW,GAChB;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GAAG,IAAI,CA4BpD;AAED,wBAAgB,cAAc,IAAI,QAAQ,CA4HzC"}