@agentshouse/mdruntime 0.1.0-cebcd51f70ed1 → 0.1.0-cec6690d5712e

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 (156) hide show
  1. package/AGENTS.md +82 -27
  2. package/README.md +13 -3
  3. package/dist/adapter.d.ts +13 -3
  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/bootstrap.d.ts +17 -5
  11. package/dist/bootstrap.d.ts.map +1 -1
  12. package/dist/bootstrap.js +88 -35
  13. package/dist/change-set.d.ts.map +1 -1
  14. package/dist/change-set.js +13 -7
  15. package/dist/change.d.ts +4 -0
  16. package/dist/change.d.ts.map +1 -1
  17. package/dist/chat/acts.d.ts +34 -0
  18. package/dist/chat/acts.d.ts.map +1 -0
  19. package/dist/chat/acts.js +36 -0
  20. package/dist/chat/context.d.ts +3 -0
  21. package/dist/chat/context.d.ts.map +1 -0
  22. package/dist/chat/context.js +10 -0
  23. package/dist/chat/input.d.ts +9 -0
  24. package/dist/chat/input.d.ts.map +1 -0
  25. package/dist/chat/input.js +99 -0
  26. package/dist/chat/kit.d.ts +60 -0
  27. package/dist/chat/kit.d.ts.map +1 -0
  28. package/dist/chat/kit.js +123 -0
  29. package/dist/chat/lasting.d.ts +6 -0
  30. package/dist/chat/lasting.d.ts.map +1 -0
  31. package/dist/chat/lasting.js +19 -0
  32. package/dist/chat/list.d.ts +20 -0
  33. package/dist/chat/list.d.ts.map +1 -0
  34. package/dist/chat/list.js +59 -0
  35. package/dist/chat/markdown.d.ts +19 -0
  36. package/dist/chat/markdown.d.ts.map +1 -0
  37. package/dist/chat/markdown.js +187 -0
  38. package/dist/chat/message.d.ts +6 -0
  39. package/dist/chat/message.d.ts.map +1 -0
  40. package/dist/chat/message.js +192 -0
  41. package/dist/chat/messages.d.ts +21 -0
  42. package/dist/chat/messages.d.ts.map +1 -0
  43. package/dist/chat/messages.js +151 -0
  44. package/dist/chat/name.d.ts +6 -0
  45. package/dist/chat/name.d.ts.map +1 -0
  46. package/dist/chat/name.js +37 -0
  47. package/dist/chat/opened.d.ts +11 -0
  48. package/dist/chat/opened.d.ts.map +1 -0
  49. package/dist/chat/opened.js +17 -0
  50. package/dist/chat/overlay.d.ts +31 -0
  51. package/dist/chat/overlay.d.ts.map +1 -0
  52. package/dist/chat/overlay.js +97 -0
  53. package/dist/chat/parts.d.ts +57 -0
  54. package/dist/chat/parts.d.ts.map +1 -0
  55. package/dist/chat/parts.js +119 -0
  56. package/dist/chat/process.d.ts +20 -0
  57. package/dist/chat/process.d.ts.map +1 -0
  58. package/dist/chat/process.js +32 -0
  59. package/dist/chat/provider.d.ts +63 -0
  60. package/dist/chat/provider.d.ts.map +1 -0
  61. package/dist/chat/provider.js +645 -0
  62. package/dist/chat/question.d.ts +9 -0
  63. package/dist/chat/question.d.ts.map +1 -0
  64. package/dist/chat/question.js +80 -0
  65. package/dist/chat/questions.d.ts +31 -0
  66. package/dist/chat/questions.d.ts.map +1 -0
  67. package/dist/chat/questions.js +111 -0
  68. package/dist/chat/read.d.ts +5 -0
  69. package/dist/chat/read.d.ts.map +1 -0
  70. package/dist/chat/read.js +13 -0
  71. package/dist/chat/ready.d.ts +33 -0
  72. package/dist/chat/ready.d.ts.map +1 -0
  73. package/dist/chat/ready.js +91 -0
  74. package/dist/chat/style.d.ts +4 -0
  75. package/dist/chat/style.d.ts.map +1 -0
  76. package/dist/chat/style.js +302 -0
  77. package/dist/chat.d.ts +14 -0
  78. package/dist/chat.d.ts.map +1 -0
  79. package/dist/chat.js +8 -0
  80. package/dist/client.d.ts +9 -5
  81. package/dist/client.d.ts.map +1 -1
  82. package/dist/client.js +61 -15
  83. package/dist/collection.d.ts +6 -11
  84. package/dist/collection.d.ts.map +1 -1
  85. package/dist/collection.js +56 -19
  86. package/dist/connection.d.ts +14 -7
  87. package/dist/connection.d.ts.map +1 -1
  88. package/dist/connection.js +239 -102
  89. package/dist/conversation.d.ts +11 -3
  90. package/dist/conversation.d.ts.map +1 -1
  91. package/dist/conversation.js +47 -7
  92. package/dist/expectation.d.ts +21 -0
  93. package/dist/expectation.d.ts.map +1 -0
  94. package/dist/expectation.js +70 -0
  95. package/dist/failure.d.ts +13 -0
  96. package/dist/failure.d.ts.map +1 -0
  97. package/dist/failure.js +19 -0
  98. package/dist/host.d.ts +1 -0
  99. package/dist/host.d.ts.map +1 -1
  100. package/dist/host.js +5 -8
  101. package/dist/identity.d.ts +2 -0
  102. package/dist/identity.d.ts.map +1 -1
  103. package/dist/identity.js +10 -1
  104. package/dist/index.d.ts +7 -4
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +2 -0
  107. package/dist/memory.d.ts +2 -1
  108. package/dist/memory.d.ts.map +1 -1
  109. package/dist/memory.js +31 -11
  110. package/dist/model.d.ts +10 -2
  111. package/dist/model.d.ts.map +1 -1
  112. package/dist/model.js +2 -0
  113. package/dist/open.d.ts +2 -0
  114. package/dist/open.d.ts.map +1 -0
  115. package/dist/open.js +1 -0
  116. package/dist/outcome.d.ts +22 -3
  117. package/dist/outcome.d.ts.map +1 -1
  118. package/dist/outcome.js +35 -1
  119. package/dist/overlay.d.ts +1 -1
  120. package/dist/overlay.d.ts.map +1 -1
  121. package/dist/overlay.js +19 -15
  122. package/dist/query.d.ts +2 -0
  123. package/dist/query.d.ts.map +1 -1
  124. package/dist/query.js +5 -31
  125. package/dist/reach.d.ts.map +1 -1
  126. package/dist/reach.js +21 -19
  127. package/dist/react.d.ts +25 -16
  128. package/dist/react.d.ts.map +1 -1
  129. package/dist/react.js +8 -6
  130. package/dist/refresh.d.ts +10 -0
  131. package/dist/refresh.d.ts.map +1 -1
  132. package/dist/refresh.js +33 -24
  133. package/dist/replica.d.ts +5 -5
  134. package/dist/replica.d.ts.map +1 -1
  135. package/dist/replica.js +44 -29
  136. package/dist/room-draft.d.ts +8 -8
  137. package/dist/room-draft.d.ts.map +1 -1
  138. package/dist/room-draft.js +13 -22
  139. package/dist/rows.d.ts +2 -0
  140. package/dist/rows.d.ts.map +1 -1
  141. package/dist/rows.js +7 -1
  142. package/dist/save.d.ts +3 -1
  143. package/dist/save.d.ts.map +1 -1
  144. package/dist/save.js +38 -21
  145. package/dist/search.d.ts +3 -2
  146. package/dist/search.d.ts.map +1 -1
  147. package/dist/status.d.ts +2 -2
  148. package/dist/status.d.ts.map +1 -1
  149. package/dist/status.js +0 -8
  150. package/dist/store.d.ts +25 -1
  151. package/dist/store.d.ts.map +1 -1
  152. package/dist/store.js +206 -90
  153. package/dist/wire.d.ts +5 -3
  154. package/dist/wire.d.ts.map +1 -1
  155. package/dist/wire.js +13 -2
  156. package/package.json +17 -9
package/AGENTS.md CHANGED
@@ -1,8 +1,7 @@
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
 
@@ -10,7 +9,7 @@ App code reaches the MD Runtime through the remote client. The surfaces are
10
9
  Rooms, Query, Search, Observe, Types, Room Draft, Save, History, Call, Reached, Log,
11
10
  the reported persistence answer, reauthorization, conversation, the chat draft,
12
11
  and Presentation State. Sync Status, the Service Mode, the storage-loss
13
- statement and the deployment facts are observations only.
12
+ statement, the deployment facts and the signed-in member are observations only.
14
13
 
15
14
  The host attaches each port with its reach, and every member and observation
16
15
  answers within it: a Room outside it answers as one the replica does not hold,
@@ -27,6 +26,8 @@ value whole and returns its unsubscribe, and `close()` ends the observation.
27
26
  Closing the port ends every handle and rejects every pending call and
28
27
  observation; a client that reconnects observes again.
29
28
 
29
+ `observe('agents')` answers every Agent a new conversation can go to, each
30
+ `{ identity, name }`, whether or not it has a conversation yet.
30
31
  Each conversation the Provider's conversation list names is held complete in the
31
32
  browser. `conversation.list()` and `observe('conversations')` answer each with its
32
33
  Agent's identity and name, its name, created and finished times, last outcome and live
@@ -51,7 +52,9 @@ open one through the Provider Action that serves it.
51
52
 
52
53
  Rooms, Query, Search, Observe, Types, Room Draft, Save, and Reached never
53
54
  touch the network.
54
- History and Call go to the Provider through the Adapter. A Call result whose
55
+ History and Call go to the Provider through the Adapter. Call takes the Action names
56
+ the Adapter declares; any other name answers `undeclared` without reaching the
57
+ Provider. A Call result whose
55
58
  effect the Provider places in a Room carries `at`, that Room and Room Version;
56
59
  `reached(room, roomVersion)` answers whether the Room's confirmed state has
57
60
  reached it, and the MD Runtime keeps refreshing that Room until it has;
@@ -66,9 +69,25 @@ client is asynchronous. Results are detached snapshots. Nothing in this
66
69
  surface returns the authorization, performs a request the App's code
67
70
  composes, or exposes the browser store.
68
71
 
72
+ Every refusal and failure carries `code` and `retryable`: each Call and History answer
73
+ other than its result, a refused Save or Room Draft write, a returned Room Draft's
74
+ reason, a Room's refusal and the Connection Refusal, and every error a member rejects
75
+ with, beside its message. A Provider refusal carries the Provider's own `retryable`.
76
+ Every code and every value the API answers is open: handle one you do not know by its
77
+ `code` and `retryable`.
78
+
69
79
  Read the deployment facts with `observe('deployment-facts')`. Interpret the
70
80
  opaque value using the host's contract.
71
81
 
82
+ `observe('member')` answers who uses the App: the User the Provider signed in,
83
+ `{ kind: 'user', id, name }` in the shape of a change's `author`, so a Document
84
+ whose `change.author.id` equals its `id` is that User's own. It is `null` until
85
+ the Provider first names one, and where it names none, such as a Site. The
86
+ MD Runtime keeps it with the Local Replicas, so it answers offline once known,
87
+ and every port hears the next member the Provider names; signing out answers
88
+ `null`, then ends the observation with the authorization. It is the only way App code learns who
89
+ uses it.
90
+
72
91
  The in-memory Adapter at `@agentshouse/mdruntime/memory` is for tests and
73
92
  ships in no bundle.
74
93
 
@@ -112,7 +131,7 @@ data:
112
131
  or `null` for a write the Provider made itself, and `time` is the Provider's
113
132
  ISO 8601 change time. It is `null` where the Provider delivered no time, as at
114
133
  a Site. An unsent edit or move keeps it, an unsent creation has none, and a
115
- saved write takes the Provider's own once it is Accepted and refreshed. A
134
+ saved write takes the Provider's own once it is Accepted. A
116
135
  Room's last change is its Document with the latest `time`.
117
136
  - **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }`
118
137
  with TanStack DB's own options, and ties end with Room, then Path. `groupBy` by
@@ -120,9 +139,9 @@ data:
120
139
  over every match and ordered by `count` or a key. A sort or group takes only a
121
140
  pointer that holds one value. `limit` bounds the Documents or the groups.
122
141
  - **Results and errors.** A result carries no Room Version: read freshness from
123
- Rooms and Sync Status. An invalid query fails with `invalid-query`,
124
- `unknown-type`, `unknown-field` or `wrong-kind`, naming where, and never
125
- answers an empty result in its place.
142
+ Rooms and Sync Status. An invalid query fails with the `code`
143
+ `invalid-query`, `unknown-type`, `unknown-field` or `wrong-kind`, naming where,
144
+ and never answers an empty result in its place.
126
145
 
127
146
  ## Local Search rules
128
147
 
@@ -160,9 +179,9 @@ the current Room Draft; read it and write again.
160
179
 
161
180
  Save takes one Room and the Room Drafts of it to save, each with its revision,
162
181
  validates locally, and on success appends one Change Batch to that Room's
163
- queue and removes those Room Drafts. It is refused as `stale`, as
182
+ queue and removes those Room Drafts. It is refused with the `code` `stale`,
164
183
  `changed-underneath` naming each part whose base no longer matches the visible
165
- state, or by a local validation rule, and then creates nothing and leaves every
184
+ state, or a local validation rule, and then creates nothing and leaves every
166
185
  Room Draft in place. A directory move or removal is a move or removal part on
167
186
  each Document and binary link target beneath it, saved together.
168
187
 
@@ -182,6 +201,13 @@ it names; the MD Runtime retries the same Change Batch identity and payload and
182
201
  never infers an outcome from transport uncertainty. The MD Runtime never
183
202
  combines, reorders, or rebases.
184
203
 
204
+ On a Site, every Save stays in the visitor's browser. Write grants and
205
+ revisions do not refuse it, and its Pending Change shows in every query and
206
+ across reloads until the browser's storage is cleared. It is never sent:
207
+ `observe('queue', room)` shows it `local`, and Sync Status never waits on it.
208
+ Once the Room changes so that it no longer applies, it leaves the queue and
209
+ returns no Room Draft.
210
+
185
211
  `observe('service-mode')` answers the Provider's Service
186
212
  Mode, `open` or `write-halted`. While writes are halted, Save still succeeds,
187
213
  its Change Batch waits unsent, and the queue is submitted in order once the
@@ -217,26 +243,55 @@ the network. Data lives only in the App Creator's browser and with the Provider.
217
243
 
218
244
  ## App code takes the client its host hands it and never constructs a Runtime
219
245
 
220
- App code takes the client its host hands it: in House,
221
- `connectHouseBridge().runtime` from `@agentshouse/app-bridge` resolves to the
222
- client House built into the page. It never constructs a Runtime or a client.
223
- It imports only types from `@agentshouse/mdruntime/client`, does not call
224
- `connectMdRuntime` or `serveMdRuntime`, and does not import the package main,
225
- the host entry, or the Adapter package. Hosts and tests use those entries; the
226
- served App does not.
246
+ App code takes the client its host hands it: in House, `houseBridge().runtime`
247
+ from `@agentshouse/app-bridge` resolves to the client House built into the page.
248
+ It never constructs a Runtime or a client. It imports only types from
249
+ `@agentshouse/mdruntime/client`, does not call `connectMdRuntime` or
250
+ `serveMdRuntime`, and does not import the package main, the host entry, or the
251
+ Adapter package. Hosts and tests use those entries; the served App does not.
227
252
 
228
253
  A React App may observe and save through `@agentshouse/mdruntime/react`, which
229
254
  names React as a peer dependency. `useObserve(client, topic, ...input)` takes
230
- the arguments of `observe` and returns the topic's current value, `undefined`
231
- until it arrives, re-rendering on each change; a `null` client observes
232
- nothing. `useSave(client)` returns `busy`, the last `outcome` or `failure`, and
233
- `save(room, roomDrafts)`, which writes each Path's parts onto the Room Draft
234
- already there, keeping the bases its parts have, or onto a new one, and saves
235
- them together. A refused Save leaves the Room Drafts for the App to save again
236
- or discard; a failure is recorded and rejects. `saveRoomDrafts(client, room,
237
- roomDrafts)` is that save outside a component. A react-admin or Refine App
238
- reads and writes its Rooms through the data providers of
239
- `@agentshouse/mdruntime-families`.
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)`
258
+ returns `busy`, the last `outcome` or `failure`, and `save(room, roomDrafts)`,
259
+ which writes each Path's parts onto the Room Draft already there, keeping the
260
+ bases its parts have, or onto a new one, and saves them together. A refused
261
+ Save leaves the Room Drafts for the App to save again or discard; a failure is
262
+ recorded and rejects. `saveRoomDrafts(client, room, roomDrafts)` is that save
263
+ outside a component. A react-admin or Refine App reads and writes its Rooms
264
+ through the data providers of `@agentshouse/mdruntime-families`.
265
+
266
+ ## The Chat
267
+
268
+ `@agentshouse/mdruntime/chat` holds the Chat, one data layer for every App.
269
+ Its required peers are React, React DOM and `@assistant-ui/react`: add React as
270
+ a dependency, also in an App not written in React.
271
+
272
+ Place the ready chat with `<Chat client={runtime} conversation={id}
273
+ agent={agent} width="1/3" showChats />`: `conversation` opens one, `null` for a
274
+ new chat, `agent` is the Agent a new chat goes to, `onOpen` hears each one it
275
+ opens, and `width` is `full` (the place you give it), or `3/4`, `1/2` or `1/3`
276
+ of the window docked at its right edge, whole on a narrow window. `showChats`
277
+ adds its conversation list; or draw your own inside a `ChatProvider` around a
278
+ `<Chat />` with no `client`. It carries its own styles; theme it with CSS custom
279
+ properties on it or an ancestor: `--chat-background`, `--chat-surface`,
280
+ `--chat-text`, `--chat-text-muted`, `--chat-accent`, `--chat-line`,
281
+ `--chat-attention`, `--chat-danger`, `--chat-font`, `--chat-font-mono`,
282
+ `--chat-font-size`, `--chat-radius` and `--chat-density` (a factor for spacing);
283
+ an unset one keeps House's light or dark look. `mountChat(element, { client })`
284
+ places it outside React and returns `update(props)` and `unmount()`.
285
+
286
+ Mix `ChatMessageList` (`components` takes your `UserMessage` and
287
+ `AssistantMessage`), `ChatInput` and `ChatQuestionCard` with your own design
288
+ inside a `ChatProvider`, or compose assistant-ui's primitives there; `useChat()`
289
+ gives `send`, the conversations, the Agents, questions to `answer`, `options`
290
+ to `choose`, `commands`, the queue to `edit` or `unqueue`, `stop`, `kill` and
291
+ outcomes; never replace its messages, sending or store. A secret question is
292
+ never answered here; typed answers live in Presentation State's `typed` key:
293
+ keep it, and change Presentation State only inside `inTurn(client, work)` from
294
+ `@agentshouse/mdruntime/client`. `Markdown` draws Markdown safely.
240
295
 
241
296
  ## What an agent must never do
242
297
 
package/README.md CHANGED
@@ -19,15 +19,16 @@ npm install @agentshouse/mdruntime
19
19
  | `@agentshouse/mdruntime` | Shared types |
20
20
  | `@agentshouse/mdruntime/memory` | Tests: `createMemoryAdapter`, an in-memory Adapter |
21
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,6 +246,9 @@ 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;
@@ -306,7 +313,7 @@ export type RetryableRefusal = ProviderRefusal & {
306
313
  kind: 'retryable-refusal';
307
314
  reset?: string;
308
315
  };
309
- export type ServiceMode = 'open' | 'write-halted';
316
+ export type ServiceMode = Open<'open' | 'write-halted'>;
310
317
  export type ServiceModeSignal = {
311
318
  observe(notify: (mode: ServiceMode) => void): () => void;
312
319
  };
@@ -315,6 +322,7 @@ export type MutationResult = {
315
322
  roomVersion: string;
316
323
  documents: Readonly<Record<string, string>>;
317
324
  revisions: Readonly<Record<string, string>>;
325
+ changes: Readonly<Record<string, HeadChange>>;
318
326
  removals: readonly string[];
319
327
  attachments?: readonly RoomAttachment[];
320
328
  author?: string;
@@ -398,9 +406,11 @@ export type RoomStreamEvent = {
398
406
  };
399
407
  export type RoomStream = {
400
408
  hold(rooms: readonly HeldRoom[]): void;
409
+ reopen(): void;
401
410
  observe(notify: (event: RoomStreamEvent) => void): () => void;
402
411
  };
403
412
  export type Adapter = {
413
+ readonly localSaves?: true;
404
414
  authorize(): Promise<Authorization>;
405
415
  discover(authorization: Authorization): Promise<DiscoverResult>;
406
416
  bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
@@ -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,S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Y,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
+ }
@@ -1,12 +1,24 @@
1
1
  import type { ModelState } from './model.js';
2
- import type { Adapter, AdapterFailure, Authorization, DiscoveredRoom, RoomModels } from './adapter.js';
3
- import { type Staged } from './replica.js';
4
- import { type Unconfirmed } from './transfer.js';
5
- export type BootstrapOutcome = Staged | Unconfirmed | AdapterFailure;
2
+ import type { Adapter, AdapterFailure, Authorization, DiscoveredRoom, RetryableRefusal, RoomModels } from './adapter.js';
3
+ import { type ConfirmedLayer } from './replica.js';
4
+ import type { StagedLayer, TransferRecord } from './store.js';
5
+ import { type Refused, type Unconfirmed } from './transfer.js';
6
+ export type Bootstrapped = {
7
+ kind: 'staged';
8
+ confirmed: ConfirmedLayer;
9
+ stored: StagedLayer;
10
+ };
11
+ export type BootstrapOutcome = Bootstrapped | Refused | Unconfirmed | RetryableRefusal | AdapterFailure;
6
12
  export type HeldModels = {
7
13
  collection: ModelState;
8
14
  selection: ModelState;
9
15
  };
10
16
  export type Remodel = (models: RoomModels | undefined, held: HeldModels) => HeldModels;
11
- export declare function bootstrapRoom(adapter: Adapter, authorization: Authorization, room: DiscoveredRoom, held: HeldModels, remodel: Remodel, continuing: () => boolean): Promise<BootstrapOutcome>;
17
+ export type Staging = {
18
+ held(locator: string): TransferRecord | null;
19
+ staged(record: TransferRecord): Promise<StagedLayer>;
20
+ stage(record: TransferRecord, page: StagedLayer): Promise<boolean>;
21
+ abandon(locator: string): Promise<void>;
22
+ };
23
+ export declare function bootstrapRoom(adapter: Adapter, authorization: Authorization, room: DiscoveredRoom, held: HeldModels, remodel: Remodel, continuing: () => boolean, staging: Staging): Promise<BootstrapOutcome>;
12
24
  //# sourceMappingURL=bootstrap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,cAAc,EAGd,UAAU,EACX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,cAAc,CAAC;AAErE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