@agentshouse/mdruntime 0.1.0-c714ba876473f → 0.1.0-c71b36a9c359c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -16
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +31 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +48 -9
- package/dist/adapter.d.ts +183 -27
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +0 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +2 -7
- package/dist/{binary.d.ts → attachment.d.ts} +8 -4
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +15 -0
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/chain.d.ts +1 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +5 -2
- package/dist/change.d.ts +6 -2
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +3 -0
- package/dist/chat-types.d.ts +0 -2
- package/dist/chat-types.d.ts.map +1 -1
- package/dist/chat-types.js +2 -4
- package/dist/client.d.ts +24 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +26 -56
- package/dist/collection.d.ts +6 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +23 -9
- package/dist/column.d.ts +5 -0
- package/dist/column.d.ts.map +1 -0
- package/dist/column.js +9 -0
- package/dist/compile.d.ts +2 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +73 -42
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +12 -6
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +19 -9
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +18 -8
- package/dist/conversation-row.d.ts +20 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +30 -7
- package/dist/conversation.d.ts +25 -12
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +236 -193
- package/dist/declaration.js +3 -3
- package/dist/discovery.d.ts +3 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +30 -5
- package/dist/download.d.ts +6 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +42 -0
- package/dist/durability.d.ts +2 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +25 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +111 -34
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +3 -1
- package/dist/figures.d.ts +1 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +6 -4
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- package/dist/host.d.ts +7 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +71 -29
- package/dist/house-query.d.ts +24 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +102 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +21 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -5
- package/dist/install.d.ts +8 -2
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +40 -33
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +40 -25
- package/dist/listing.d.ts +24 -12
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +50 -21
- package/dist/live.d.ts +19 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +94 -36
- package/dist/loaded.d.ts +7 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +46 -0
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +4 -2
- package/dist/lost.js +1 -1
- package/dist/media.d.ts +19 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +181 -34
- package/dist/memory.d.ts +7 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +63 -23
- package/dist/messages.d.ts +21 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +43 -13
- package/dist/modal.d.ts +2 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +11 -0
- package/dist/model.d.ts +10 -7
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +3 -3
- package/dist/name.d.ts +0 -1
- package/dist/name.d.ts.map +1 -1
- package/dist/name.js +3 -7
- package/dist/observation.d.ts +29 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +206 -69
- package/dist/online.d.ts +7 -0
- package/dist/online.d.ts.map +1 -0
- package/dist/online.js +29 -0
- package/dist/opened.d.ts +5 -5
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +2 -2
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +20 -2
- package/dist/outcome.d.ts +30 -13
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +21 -6
- package/dist/overlay.d.ts +20 -9
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +110 -41
- package/dist/parts.d.ts +3 -1
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +30 -7
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +1 -1
- package/dist/preparation.d.ts +33 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +195 -78
- package/dist/presence.d.ts +8 -2
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +24 -13
- package/dist/queries.d.ts +1 -1
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +115 -67
- package/dist/query.d.ts +2 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/questions.d.ts +1 -0
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +3 -1
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +51 -21
- package/dist/reach.d.ts +15 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +140 -25
- package/dist/react.d.ts +12 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +23 -4
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +18 -10
- package/dist/reads.d.ts +1 -1
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +17 -6
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +2 -1
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.js +4 -4
- package/dist/replica.d.ts +3 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +5 -5
- package/dist/room-draft.d.ts +29 -4
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +239 -18
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +12 -7
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +47 -0
- package/dist/rows.d.ts +11 -3
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +25 -11
- package/dist/run-tables.d.ts +25 -0
- package/dist/run-tables.d.ts.map +1 -0
- package/dist/run-tables.js +98 -0
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runs.d.ts +27 -0
- package/dist/runs.d.ts.map +1 -0
- package/dist/runs.js +92 -0
- package/dist/runtime.d.ts +5 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +17 -86
- package/dist/saves.d.ts +7 -5
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +106 -53
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -2
- package/dist/selector.d.ts +3 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +22 -0
- package/dist/shown.d.ts +5 -2
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +79 -43
- package/dist/socket/session.d.ts +4 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket/session.js +3 -0
- package/dist/socket.d.ts +4 -1
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +8 -0
- package/dist/source.d.ts +24 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +48 -9
- package/dist/store/installs.d.ts +2 -2
- package/dist/store/installs.d.ts.map +1 -1
- package/dist/store/installs.js +10 -4
- package/dist/store/readiness.d.ts +5 -4
- package/dist/store/readiness.d.ts.map +1 -1
- package/dist/store/readiness.js +28 -12
- package/dist/store/records.d.ts +30 -9
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +70 -27
- package/dist/store/rooms-shown.d.ts +8 -0
- package/dist/store/rooms-shown.d.ts.map +1 -0
- package/dist/store/rooms-shown.js +13 -0
- package/dist/store.d.ts +15 -10
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +12 -5
- package/dist/stored.d.ts +41 -16
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +215 -57
- package/dist/surface.d.ts +19 -7
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +57 -19
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +49 -27
- package/dist/tables.d.ts +40 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +109 -326
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +3 -4
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +50 -10
- package/dist/wire.d.ts +30 -14
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +19 -13
- package/package.json +4 -4
- package/dist/binary.d.ts.map +0 -1
- package/dist/binary.js +0 -8
package/README.md
CHANGED
|
@@ -12,14 +12,14 @@ 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/tables` | The host's database: the Authored store's and
|
|
22
|
-
| `@agentshouse/mdruntime/react` | React over the client: `useObserve`, `useSave`; `useExpected`, a reader of an expectation store; `useLane`, a reader of an act lane
|
|
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/tables` | The host's database: `formatted` lays it out for a device format, keeping the Authored store's tables and creating any it lacks, and `answerRuntime` answers it |
|
|
22
|
+
| `@agentshouse/mdruntime/react` | React over the client: `useObserve`, `useSave`; `useExpected`, a reader of an expectation store; `useLane`, a reader of an act lane |
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
@@ -33,24 +33,26 @@ const rooms = await runtime.rooms();
|
|
|
33
33
|
const notes = await runtime.query({ types: ['note'], select: 'all', limit: 20 });
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
`observe('storage-loss')` reports `null
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
`observe('storage-loss')` reports `null`, the stable code `storage-loss` when
|
|
37
|
+
unsynchronized Room Drafts and Pending Changes were lost, or `visit` while the host holds
|
|
38
|
+
the database in memory, which ends with the visit; the readiness `persistence` answer is then
|
|
39
|
+
`memory`. The host supplies the user-facing wording.
|
|
39
40
|
|
|
40
41
|
In House the bridge object the page holds as `window.houseBridge` places the Chat, which
|
|
41
42
|
House serves with the page: install and bundle nothing for it. Mount it in an element it
|
|
42
|
-
fills,
|
|
43
|
+
fills, where it lays out the User's chats by the element's width, themed by CSS custom
|
|
44
|
+
properties on that element, or as the Chat button, House's dot that opens it in a sheet:
|
|
43
45
|
|
|
44
46
|
```ts
|
|
45
47
|
const chat = await window.houseBridge.chat.mount(element, { conversation });
|
|
46
48
|
element.style.setProperty('--chat-accent', '#2a6cf0');
|
|
47
49
|
chat.update({ conversation: null, agent });
|
|
48
|
-
chat.
|
|
50
|
+
const button = await window.houseBridge.chat.mountButton({});
|
|
51
|
+
button.open({ agent });
|
|
49
52
|
```
|
|
50
53
|
|
|
51
|
-
The rules an App's agent follows, including Local Query, search, Room
|
|
52
|
-
|
|
53
|
-
`guide/open` opens.
|
|
54
|
+
The rules an App's agent follows, including Local Query, search, Room Draft, Save and the
|
|
55
|
+
Chat, are the `apps/` pages of House's Guide, which House's `guide` tool opens.
|
|
54
56
|
|
|
55
57
|
## License
|
|
56
58
|
|
package/dist/acceptance.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptance.d.ts","sourceRoot":"","sources":["../src/acceptance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"acceptance.d.ts","sourceRoot":"","sources":["../src/acceptance.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA0Y5C,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAK5D"}
|
package/dist/acceptance.js
CHANGED
|
@@ -6,7 +6,8 @@ import { olderThan, showing } from './install.js';
|
|
|
6
6
|
import { scoped } from './models.js';
|
|
7
7
|
import { answered, settle } from './queue.js';
|
|
8
8
|
import { refuse } from './refusal.js';
|
|
9
|
-
import {
|
|
9
|
+
import { writtenDocuments } from './overlay.js';
|
|
10
|
+
import { returnedPaths, returning, slicing, touchedBy, } from './replica.js';
|
|
10
11
|
import { batchFile } from './saves.js';
|
|
11
12
|
import { rest, roomUnreadable, statusShown } from './shown.js';
|
|
12
13
|
import { advanced, withhold } from './sync.js';
|
|
@@ -104,6 +105,25 @@ async function adoptedMove(runtime, room, partner, local, submitted, accepted) {
|
|
|
104
105
|
submitLater(runtime, partner);
|
|
105
106
|
return kept;
|
|
106
107
|
}
|
|
108
|
+
async function writtenOf({ store }, local, locator, batch) {
|
|
109
|
+
const record = (await store.record(locator));
|
|
110
|
+
const paths = [...touchedBy([batch])];
|
|
111
|
+
const confirmed = await stepped(slicing(await local.entries(record.key, 'confirmed', paths), paths));
|
|
112
|
+
return stepped(writtenDocuments(confirmed, batch, store.composed(record)));
|
|
113
|
+
}
|
|
114
|
+
const STALE_BASES = new Set(['base_revision_stale', 'merge_conflict']);
|
|
115
|
+
function staleOnly(fields) {
|
|
116
|
+
const { conflicts } = fields;
|
|
117
|
+
return (Array.isArray(conflicts) &&
|
|
118
|
+
conflicts.length > 0 &&
|
|
119
|
+
conflicts.every((conflict) => typeof conflict === 'object' &&
|
|
120
|
+
conflict !== null &&
|
|
121
|
+
STALE_BASES.has(conflict.code)));
|
|
122
|
+
}
|
|
123
|
+
function rebuilt(sent, again) {
|
|
124
|
+
return (again.every((document) => document === null || !document.stale) &&
|
|
125
|
+
JSON.stringify(again) !== JSON.stringify(sent));
|
|
126
|
+
}
|
|
107
127
|
async function behindIn({ store }, locator, batch) {
|
|
108
128
|
const local = await store.open();
|
|
109
129
|
const [order, { room }] = await Promise.all([
|
|
@@ -117,7 +137,7 @@ async function submitRoom(runtime, room, local, authorized, progress, signal) {
|
|
|
117
137
|
while (socket.continuing() &&
|
|
118
138
|
socket.session.now().authorization !== undefined &&
|
|
119
139
|
!signal.aborted) {
|
|
120
|
-
const headId = (await local.order(room.locator)).find((id) => store.
|
|
140
|
+
const headId = (await local.order(room.locator)).find((id) => store.conflicted.of(room.locator, id) === undefined);
|
|
121
141
|
if (headId === undefined)
|
|
122
142
|
return 'done';
|
|
123
143
|
const [head, pending] = await Promise.all([
|
|
@@ -150,6 +170,7 @@ async function submitRoom(runtime, room, local, authorized, progress, signal) {
|
|
|
150
170
|
}
|
|
151
171
|
const lost = earlier || submission.state === 'submitted';
|
|
152
172
|
let result;
|
|
173
|
+
const written = await writtenOf(runtime, local, room.locator, head);
|
|
153
174
|
await store.exclusive(() => mark(runtime, local, room.locator, head, { state: 'submitted' }, lost));
|
|
154
175
|
if (socket.session.now().paused || presence.lost(room.locator))
|
|
155
176
|
return 'done';
|
|
@@ -171,6 +192,7 @@ async function submitRoom(runtime, room, local, authorized, progress, signal) {
|
|
|
171
192
|
result = await socket.mutate(authorized, {
|
|
172
193
|
locator: room.locator,
|
|
173
194
|
changeBatch: head,
|
|
195
|
+
written,
|
|
174
196
|
file: batchFile(store, head),
|
|
175
197
|
...(state?.upload === undefined ? {} : { upload: state.upload }),
|
|
176
198
|
}, (upload) => store.exclusive(() => keepUpload(runtime, local, room.locator, head.id, upload)));
|
|
@@ -228,6 +250,13 @@ async function submitRoom(runtime, room, local, authorized, progress, signal) {
|
|
|
228
250
|
await store.exclusive(() => mark(runtime, local, room.locator, head, reset === undefined ? { state: 'waiting' } : { state: 'reset', reset }, lost));
|
|
229
251
|
return reset === undefined ? 'again' : { at: Date.parse(reset) };
|
|
230
252
|
}
|
|
253
|
+
if (result.kind === 'conflicted' && partner === null && staleOnly(result.fields)) {
|
|
254
|
+
const here = await advanced(runtime, room, local, authorized);
|
|
255
|
+
if (here === null && rebuilt(written, await writtenOf(runtime, local, room.locator, head))) {
|
|
256
|
+
await store.exclusive(() => mark(runtime, local, room.locator, head, { state: 'waiting' }, lost));
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
231
260
|
if (result.kind === 'conflicted' || result.kind === 'rejected') {
|
|
232
261
|
const refreshed = async () => ({
|
|
233
262
|
there: other === undefined ? null : await advanced(runtime, other, local, authorized),
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAM3E,OAAO,EAWL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAOF,wBAAsB,WAAW,CAC/B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,YAAiB,GACvB,OAAO,CAAC,aAAa,CAAC,CA+BxB;AAED,wBAAsB,OAAO,CAC3B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAShD;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAuBrB;AAyDD,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,wBAAsB,YAAY,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,EAAE,WAAW,EAAE,OAAO,EAAE,GAAE,OAAY,GACrC,OAAO,CAAC,UAAU,CAAC,CAiCrB;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,UAAU,CAAC,CAerB;AA4GD,wBAAsB,MAAM,CAC1B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,UAAU,CAAC,CAKrB;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAaxF;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAkB3F;AAiBD,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QAG3C"}
|
package/dist/actions.js
CHANGED
|
@@ -5,6 +5,7 @@ import { locked, lockedRooms } from './locks.js';
|
|
|
5
5
|
import { scoped } from './models.js';
|
|
6
6
|
import { ABSENT_TARGET, failure, historyAnswer, LOCKED_UNREADABLE, lockedRoom, handedOutcome, UNANSWERED, undeclared, UNCERTAIN, UNREADABLE, } from './outcome.js';
|
|
7
7
|
import { refuse } from './refusal.js';
|
|
8
|
+
import { selectorValues } from './selector.js';
|
|
8
9
|
function operationOf(input) {
|
|
9
10
|
const operation = input?.operation_id;
|
|
10
11
|
return typeof operation === 'string' ? operation : null;
|
|
@@ -86,8 +87,16 @@ export async function resolveReference(runtime, room, path, destination) {
|
|
|
86
87
|
? { kind: 'deleted', ...at, revision: last }
|
|
87
88
|
: { kind: 'document', ...at };
|
|
88
89
|
}
|
|
89
|
-
async function
|
|
90
|
-
|
|
90
|
+
async function declaredActions({ store, socket }) {
|
|
91
|
+
const { unstored } = socket.session.now();
|
|
92
|
+
if (unstored !== null)
|
|
93
|
+
return unstored.capabilities;
|
|
94
|
+
if (!store.needed())
|
|
95
|
+
return [];
|
|
96
|
+
return (await (await store.open()).facts()).capabilities;
|
|
97
|
+
}
|
|
98
|
+
async function declaredAction(runtime, name) {
|
|
99
|
+
for (const capability of await declaredActions(runtime)) {
|
|
91
100
|
for (const action of capability.actions ?? []) {
|
|
92
101
|
if (action.name === name)
|
|
93
102
|
return action;
|
|
@@ -95,12 +104,36 @@ async function declaredAction({ store }, name) {
|
|
|
95
104
|
}
|
|
96
105
|
return undefined;
|
|
97
106
|
}
|
|
107
|
+
async function declaration(runtime, name) {
|
|
108
|
+
const { socket } = runtime;
|
|
109
|
+
const declared = await declaredAction(runtime, name);
|
|
110
|
+
if (declared !== undefined || socket.streamed || socket.session.now().roomsNamed)
|
|
111
|
+
return declared;
|
|
112
|
+
await runtime.discover();
|
|
113
|
+
return declaredAction(runtime, name);
|
|
114
|
+
}
|
|
115
|
+
function strings(values) {
|
|
116
|
+
return values.filter((value) => typeof value === 'string');
|
|
117
|
+
}
|
|
118
|
+
const ROOM_TOP = /^\/rooms\/([^/]+)\/?$/u;
|
|
119
|
+
function namedRoom(path) {
|
|
120
|
+
return roomTarget(path)?.handle ?? ROOM_TOP.exec(path)?.[1] ?? null;
|
|
121
|
+
}
|
|
98
122
|
async function calledRooms(runtime, name, input) {
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
123
|
+
const declared = await declaration(runtime, name);
|
|
124
|
+
if (declared === undefined || input === null || typeof input !== 'object')
|
|
101
125
|
return [];
|
|
102
|
-
const named =
|
|
103
|
-
|
|
126
|
+
const named = declared.room === undefined ? [] : strings(selectorValues(input, declared.room));
|
|
127
|
+
const handles = strings((declared.roomPaths ?? []).flatMap((selector) => selectorValues(input, selector))).flatMap((path) => namedRoom(path) ?? []);
|
|
128
|
+
if (handles.length === 0)
|
|
129
|
+
return named;
|
|
130
|
+
const listing = await listingNow(runtime);
|
|
131
|
+
return [
|
|
132
|
+
...named,
|
|
133
|
+
...[...listing.values()]
|
|
134
|
+
.filter((listed) => handles.includes(listed.handle) || handles.includes(listed.locator))
|
|
135
|
+
.map((listed) => listed.locator),
|
|
136
|
+
];
|
|
104
137
|
}
|
|
105
138
|
export async function invokeAction(runtime, name, input, { dispatching, attempt } = {}) {
|
|
106
139
|
const { store, socket, retries } = runtime;
|
|
@@ -109,8 +142,11 @@ export async function invokeAction(runtime, name, input, { dispatching, attempt
|
|
|
109
142
|
if (socket.closed() || session.now().refusal !== null) {
|
|
110
143
|
return handedOutcome(retries, attempt, UNANSWERED);
|
|
111
144
|
}
|
|
112
|
-
if ((await declaredAction(runtime, name)) === undefined)
|
|
113
|
-
return
|
|
145
|
+
if ((await declaredAction(runtime, name)) === undefined) {
|
|
146
|
+
return session.now().roomsNamed
|
|
147
|
+
? undeclared(name)
|
|
148
|
+
: handedOutcome(retries, attempt, UNANSWERED);
|
|
149
|
+
}
|
|
114
150
|
try {
|
|
115
151
|
await socket.authorize();
|
|
116
152
|
}
|
|
@@ -270,7 +306,10 @@ export async function resendCalls(runtime, signal) {
|
|
|
270
306
|
continue;
|
|
271
307
|
if (socket.closed() || signal.aborted)
|
|
272
308
|
return 'done';
|
|
273
|
-
const
|
|
309
|
+
const name = runtime.renamedActions.get(held.name) ?? held.name;
|
|
310
|
+
const rewrite = runtime.rewrittenInputs.get(held.name);
|
|
311
|
+
const input = rewrite === undefined ? held.input : rewrite(held.input);
|
|
312
|
+
const sender = keptSender(runtime, name, input, held.operation, true);
|
|
274
313
|
try {
|
|
275
314
|
if (unsettled(await sender.send()))
|
|
276
315
|
return 'again';
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { SavedFacts, TypedPath } from '@agentshouse/mdmodel';
|
|
1
|
+
import type { SavedFacts, TypedPath, VerifiedModel } from '@agentshouse/mdmodel';
|
|
2
2
|
import type { Operation, SessionState } from '@agentshouse/session-content';
|
|
3
3
|
import type { ModelResult } from './model.js';
|
|
4
4
|
export type { SavedFacts, TypedPath };
|
|
5
5
|
import type { Open } from './open.js';
|
|
6
6
|
import type { ChangeBatch } from './change.js';
|
|
7
|
+
import type { Written } from './overlay.js';
|
|
8
|
+
import type { QueryDocument, QueryGroup } from './query.js';
|
|
7
9
|
export type Authorization = object;
|
|
8
10
|
export type MdModelIdentity = {
|
|
9
11
|
identity: string;
|
|
@@ -39,20 +41,27 @@ export type Capability = {
|
|
|
39
41
|
limits?: readonly ProviderLimit[];
|
|
40
42
|
actions?: readonly ActionDeclaration[];
|
|
41
43
|
};
|
|
44
|
+
export type ConversationActivity = {
|
|
45
|
+
turn: Open<'running' | 'asking' | 'ended'>;
|
|
46
|
+
secret: boolean;
|
|
47
|
+
background: boolean | 'runs';
|
|
48
|
+
};
|
|
42
49
|
export type ListedConversation = {
|
|
43
50
|
conversation: string;
|
|
44
51
|
agent: string;
|
|
45
|
-
agentName: string;
|
|
46
|
-
agentRetired: boolean;
|
|
47
52
|
name: string;
|
|
48
53
|
created: string;
|
|
49
|
-
finished: string | null;
|
|
50
54
|
outcome: string | null;
|
|
51
55
|
waiting: boolean;
|
|
52
56
|
newest: string | null;
|
|
53
57
|
processEnded: string | null;
|
|
58
|
+
activity: ConversationActivity | null;
|
|
59
|
+
subject: string | null;
|
|
60
|
+
room: string | null;
|
|
61
|
+
model: string | null;
|
|
62
|
+
effort: string | null;
|
|
54
63
|
};
|
|
55
|
-
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete' | 'conversations/take-out' | 'conversations/rename' | 'conversations/
|
|
64
|
+
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete' | 'conversations/take-out' | 'conversations/rename' | 'conversations/set' | 'conversations/retry' | 'agent-functions/decide';
|
|
56
65
|
export type ConversationMessage = {
|
|
57
66
|
identity: string;
|
|
58
67
|
turn: string;
|
|
@@ -146,10 +155,6 @@ export type ConversationEvent = {
|
|
|
146
155
|
kind: 'state';
|
|
147
156
|
conversation: string;
|
|
148
157
|
state: SessionState | null;
|
|
149
|
-
} | {
|
|
150
|
-
kind: 'link';
|
|
151
|
-
conversation: string;
|
|
152
|
-
connected: boolean;
|
|
153
158
|
} | {
|
|
154
159
|
kind: 'deliveries';
|
|
155
160
|
conversation: string;
|
|
@@ -164,6 +169,7 @@ export type ConversationEvent = {
|
|
|
164
169
|
conversation: string;
|
|
165
170
|
} | {
|
|
166
171
|
kind: 'list';
|
|
172
|
+
agents: readonly ListedAgent[];
|
|
167
173
|
entries: readonly ListedConversation[];
|
|
168
174
|
whole: boolean;
|
|
169
175
|
more: boolean;
|
|
@@ -171,6 +177,9 @@ export type ConversationEvent = {
|
|
|
171
177
|
} | {
|
|
172
178
|
kind: 'listed';
|
|
173
179
|
entry: ListedConversation;
|
|
180
|
+
} | {
|
|
181
|
+
kind: 'agent';
|
|
182
|
+
agent: ListedAgent;
|
|
174
183
|
} | {
|
|
175
184
|
kind: 'unlisted';
|
|
176
185
|
conversation: string;
|
|
@@ -180,18 +189,59 @@ export type AgentEnvironment = {
|
|
|
180
189
|
name: string;
|
|
181
190
|
state: 'online' | 'offline';
|
|
182
191
|
};
|
|
192
|
+
export type ListedOwner = {
|
|
193
|
+
readonly user: string;
|
|
194
|
+
readonly name: string;
|
|
195
|
+
};
|
|
196
|
+
export type ListedSpaceRef = {
|
|
197
|
+
readonly space_ref: string;
|
|
198
|
+
readonly name: string;
|
|
199
|
+
};
|
|
200
|
+
export type RoomListEntry = {
|
|
201
|
+
readonly room_ref: string;
|
|
202
|
+
readonly room_handle: string;
|
|
203
|
+
readonly name: string;
|
|
204
|
+
readonly level: 'search' | 'open' | 'keep';
|
|
205
|
+
readonly access: 'owner' | 'manage' | 'write' | 'read' | 'public';
|
|
206
|
+
readonly owner: ListedOwner;
|
|
207
|
+
readonly created: string;
|
|
208
|
+
readonly archived?: string;
|
|
209
|
+
readonly exportable?: true;
|
|
210
|
+
readonly space?: ListedSpaceRef;
|
|
211
|
+
};
|
|
212
|
+
export type SpaceListEntry = ListedSpaceRef & {
|
|
213
|
+
readonly owner: ListedOwner;
|
|
214
|
+
readonly created: string;
|
|
215
|
+
readonly manages?: true;
|
|
216
|
+
};
|
|
217
|
+
export type RoomList = {
|
|
218
|
+
readonly rooms: readonly RoomListEntry[];
|
|
219
|
+
readonly spaces: readonly SpaceListEntry[];
|
|
220
|
+
};
|
|
183
221
|
export type ListedAgent = {
|
|
184
|
-
|
|
222
|
+
id: string;
|
|
185
223
|
name: string;
|
|
186
|
-
|
|
224
|
+
revision: number;
|
|
225
|
+
environment: string;
|
|
226
|
+
environment_name: string;
|
|
227
|
+
environment_connected: boolean;
|
|
228
|
+
launch_directory: string;
|
|
187
229
|
cli: string;
|
|
188
|
-
|
|
230
|
+
model: string;
|
|
231
|
+
effort: string | null;
|
|
232
|
+
model_fixed: boolean;
|
|
233
|
+
base_instructions: string;
|
|
234
|
+
compaction_threshold: number | null;
|
|
235
|
+
compaction_words: string;
|
|
236
|
+
in_telegram: boolean;
|
|
237
|
+
telegram_messages: 'every' | 'last';
|
|
238
|
+
created: string;
|
|
239
|
+
retired_at: string | null;
|
|
189
240
|
};
|
|
190
241
|
export type ConversationStream = {
|
|
191
242
|
replicate(conversations: readonly string[]): void;
|
|
192
243
|
hold(cursor: string | null): void;
|
|
193
244
|
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
194
|
-
agents?(): Promise<readonly ListedAgent[] | null>;
|
|
195
245
|
history?(request: ConversationHistoryRequest): Promise<ActionResult>;
|
|
196
246
|
};
|
|
197
247
|
export type ActionDeclaration = {
|
|
@@ -199,6 +249,7 @@ export type ActionDeclaration = {
|
|
|
199
249
|
inputShape: unknown;
|
|
200
250
|
resultKind: unknown;
|
|
201
251
|
room?: string;
|
|
252
|
+
roomPaths?: readonly string[];
|
|
202
253
|
};
|
|
203
254
|
export type ProviderLimit = {
|
|
204
255
|
name: string;
|
|
@@ -214,6 +265,11 @@ export type Retention = {
|
|
|
214
265
|
history: HistoryRetention;
|
|
215
266
|
refreshHorizon: number;
|
|
216
267
|
};
|
|
268
|
+
export type QueriedRoom = {
|
|
269
|
+
readonly locator: string;
|
|
270
|
+
readonly handle: string;
|
|
271
|
+
readonly name: string;
|
|
272
|
+
};
|
|
217
273
|
export type Discovery = {
|
|
218
274
|
kind: 'discovery';
|
|
219
275
|
rooms: readonly DiscoveredRoom[];
|
|
@@ -221,6 +277,9 @@ export type Discovery = {
|
|
|
221
277
|
providerLimits: readonly ProviderLimit[];
|
|
222
278
|
retention: Retention;
|
|
223
279
|
member?: Member;
|
|
280
|
+
timeZone?: string | null;
|
|
281
|
+
roomList?: RoomList;
|
|
282
|
+
queriesOnly?: readonly QueriedRoom[];
|
|
224
283
|
};
|
|
225
284
|
export type TransportUncertainty = {
|
|
226
285
|
kind: 'transport-uncertainty';
|
|
@@ -254,19 +313,28 @@ export type ChangeAuthor = {
|
|
|
254
313
|
id: string;
|
|
255
314
|
name: string;
|
|
256
315
|
};
|
|
316
|
+
export type AppMember = {
|
|
317
|
+
kind: 'app_member';
|
|
318
|
+
id: string;
|
|
319
|
+
name: string;
|
|
320
|
+
access: Open<'waiting' | 'in' | 'out'>;
|
|
321
|
+
paidUntil: string | null;
|
|
322
|
+
};
|
|
257
323
|
export type Member = {
|
|
258
324
|
kind: Open<'user'>;
|
|
259
325
|
id: string;
|
|
260
326
|
name: string;
|
|
261
|
-
};
|
|
327
|
+
} | AppMember;
|
|
262
328
|
export type HeadChange = {
|
|
263
329
|
author: ChangeAuthor | null;
|
|
264
330
|
time: string;
|
|
265
331
|
};
|
|
266
|
-
export type
|
|
332
|
+
export type Attachment = {
|
|
267
333
|
byteLength: number;
|
|
268
334
|
mediaType: string;
|
|
269
335
|
sha256: string;
|
|
336
|
+
width?: number | null;
|
|
337
|
+
height?: number | null;
|
|
270
338
|
};
|
|
271
339
|
export type BootstrapRequest = {
|
|
272
340
|
locator: string;
|
|
@@ -295,7 +363,7 @@ export type BootstrapPage = {
|
|
|
295
363
|
fileIds?: Readonly<Record<string, string>>;
|
|
296
364
|
created?: Readonly<Record<string, string>>;
|
|
297
365
|
changes: Readonly<Record<string, HeadChange>>;
|
|
298
|
-
|
|
366
|
+
attachments: Readonly<Record<string, Attachment>>;
|
|
299
367
|
folders?: readonly string[];
|
|
300
368
|
pageToken?: PageToken;
|
|
301
369
|
parts?: readonly BootstrapPart[];
|
|
@@ -323,7 +391,7 @@ export type RefreshPage = {
|
|
|
323
391
|
fileIds?: Readonly<Record<string, string>>;
|
|
324
392
|
created?: Readonly<Record<string, string>>;
|
|
325
393
|
changes: Readonly<Record<string, HeadChange>>;
|
|
326
|
-
|
|
394
|
+
attachments: Readonly<Record<string, Attachment>>;
|
|
327
395
|
removals: readonly string[];
|
|
328
396
|
folders?: readonly string[];
|
|
329
397
|
folderRemovals?: readonly string[];
|
|
@@ -337,6 +405,7 @@ export type RefreshResult = {
|
|
|
337
405
|
export type MutationRequest = {
|
|
338
406
|
locator: string;
|
|
339
407
|
changeBatch: ChangeBatch;
|
|
408
|
+
written: Written;
|
|
340
409
|
file(localId: string): Promise<Blob>;
|
|
341
410
|
upload?: unknown;
|
|
342
411
|
};
|
|
@@ -355,7 +424,7 @@ export type AcceptedRoom = {
|
|
|
355
424
|
fileIds?: Readonly<Record<string, string>>;
|
|
356
425
|
changes: Readonly<Record<string, HeadChange>>;
|
|
357
426
|
removals: readonly string[];
|
|
358
|
-
|
|
427
|
+
attachments?: Readonly<Record<string, Attachment>>;
|
|
359
428
|
};
|
|
360
429
|
export type MutationResult = (AcceptedRoom & {
|
|
361
430
|
kind: 'accepted';
|
|
@@ -378,7 +447,7 @@ export type HistoryRevision = {
|
|
|
378
447
|
revision: string;
|
|
379
448
|
author: HistoryAuthor;
|
|
380
449
|
time: string;
|
|
381
|
-
|
|
450
|
+
attachment?: Attachment;
|
|
382
451
|
};
|
|
383
452
|
export type HistoryRequest = {
|
|
384
453
|
locator: string;
|
|
@@ -397,21 +466,31 @@ export type HistoryResult = {
|
|
|
397
466
|
} | {
|
|
398
467
|
kind: 'no-history';
|
|
399
468
|
} | AdapterFailure;
|
|
400
|
-
export type
|
|
469
|
+
export type AttachmentRequest = {
|
|
401
470
|
kind: 'path';
|
|
402
471
|
locator: string;
|
|
403
472
|
path: string;
|
|
404
473
|
revision: string;
|
|
405
474
|
};
|
|
406
|
-
export type
|
|
475
|
+
export type KeyedRequest = {
|
|
476
|
+
kind: 'key';
|
|
477
|
+
link: string;
|
|
478
|
+
};
|
|
479
|
+
export type AttachmentCopy = {
|
|
480
|
+
url: string;
|
|
481
|
+
width: number;
|
|
482
|
+
};
|
|
483
|
+
export type AttachmentResult = {
|
|
407
484
|
kind: 'binary';
|
|
408
485
|
body: ReadableStream<Uint8Array>;
|
|
409
486
|
mediaType: string;
|
|
410
487
|
sha256?: string;
|
|
488
|
+
url?: string;
|
|
489
|
+
copies?: readonly AttachmentCopy[];
|
|
411
490
|
} | (ProviderRefusal & {
|
|
412
491
|
kind: 'rejected';
|
|
413
492
|
}) | AdapterFailure;
|
|
414
|
-
export type
|
|
493
|
+
export type AttachmentLinkResult = {
|
|
415
494
|
kind: 'link';
|
|
416
495
|
url: string;
|
|
417
496
|
name: string;
|
|
@@ -420,7 +499,7 @@ export type BinaryLinkResult = {
|
|
|
420
499
|
kind: 'rejected';
|
|
421
500
|
}) | AdapterFailure;
|
|
422
501
|
export type AttachRequest = {
|
|
423
|
-
locator
|
|
502
|
+
locator?: string;
|
|
424
503
|
name: string;
|
|
425
504
|
mediaType: string;
|
|
426
505
|
byteLength: number;
|
|
@@ -431,6 +510,9 @@ export type AttachResult = {
|
|
|
431
510
|
kind: 'attached';
|
|
432
511
|
path: string;
|
|
433
512
|
revision: string;
|
|
513
|
+
} | {
|
|
514
|
+
kind: 'linked';
|
|
515
|
+
link: string;
|
|
434
516
|
} | (ProviderRefusal & {
|
|
435
517
|
kind: 'rejected';
|
|
436
518
|
}) | AdapterFailure;
|
|
@@ -466,6 +548,40 @@ export type SearchAnswer = {
|
|
|
466
548
|
} | (ProviderRefusal & {
|
|
467
549
|
kind: 'rejected';
|
|
468
550
|
}) | AdapterFailure;
|
|
551
|
+
export type HouseQueryFollow = string | {
|
|
552
|
+
readonly room: string;
|
|
553
|
+
readonly path: string;
|
|
554
|
+
} | {
|
|
555
|
+
readonly room: string;
|
|
556
|
+
readonly path: string;
|
|
557
|
+
readonly open: readonly string[];
|
|
558
|
+
};
|
|
559
|
+
export type HouseQueryAsk = {
|
|
560
|
+
room: string;
|
|
561
|
+
fresh: boolean;
|
|
562
|
+
follows?: readonly HouseQueryFollow[];
|
|
563
|
+
} & ({
|
|
564
|
+
query: Readonly<Record<string, unknown>>;
|
|
565
|
+
} | {
|
|
566
|
+
path: string;
|
|
567
|
+
after?: string;
|
|
568
|
+
});
|
|
569
|
+
export type HouseQueryRows = {
|
|
570
|
+
kind: 'rows';
|
|
571
|
+
documents: readonly QueryDocument[];
|
|
572
|
+
next?: string;
|
|
573
|
+
total?: number;
|
|
574
|
+
totalCapped?: true;
|
|
575
|
+
};
|
|
576
|
+
export type HouseQueryGroups = {
|
|
577
|
+
kind: 'groups';
|
|
578
|
+
groups: readonly QueryGroup[];
|
|
579
|
+
next?: string;
|
|
580
|
+
capped?: true;
|
|
581
|
+
};
|
|
582
|
+
export type HouseQueryAnswer = HouseQueryRows | HouseQueryGroups | (ProviderRefusal & {
|
|
583
|
+
kind: 'rejected';
|
|
584
|
+
}) | AdapterFailure;
|
|
469
585
|
export type HeldRoom = {
|
|
470
586
|
locator: string;
|
|
471
587
|
roomVersion: string | null;
|
|
@@ -482,6 +598,10 @@ export type AuthorityChange = {
|
|
|
482
598
|
rooms: readonly DiscoveredRoom[];
|
|
483
599
|
left: readonly string[];
|
|
484
600
|
member?: Member;
|
|
601
|
+
timeZone?: string | null;
|
|
602
|
+
roomList?: RoomList & {
|
|
603
|
+
readonly left: readonly string[];
|
|
604
|
+
};
|
|
485
605
|
};
|
|
486
606
|
export type RoomStreamEvent = {
|
|
487
607
|
kind: 'opened';
|
|
@@ -496,7 +616,40 @@ export type RoomStreamEvent = {
|
|
|
496
616
|
} | {
|
|
497
617
|
kind: 'caught-up';
|
|
498
618
|
expired: readonly string[];
|
|
619
|
+
} | {
|
|
620
|
+
kind: 'reported';
|
|
499
621
|
} | AuthorityChange | RoomChange;
|
|
622
|
+
export type HeardRun = {
|
|
623
|
+
readonly room: string;
|
|
624
|
+
readonly name: string;
|
|
625
|
+
readonly document: string;
|
|
626
|
+
readonly current: boolean;
|
|
627
|
+
readonly starter: string | null;
|
|
628
|
+
};
|
|
629
|
+
export type RunEvent = {
|
|
630
|
+
readonly kind: 'run';
|
|
631
|
+
readonly run: HeardRun;
|
|
632
|
+
readonly listing: string | null;
|
|
633
|
+
} | {
|
|
634
|
+
readonly kind: 'removed';
|
|
635
|
+
readonly room: string;
|
|
636
|
+
readonly name: string;
|
|
637
|
+
} | {
|
|
638
|
+
readonly kind: 'runs';
|
|
639
|
+
readonly listing: string | null;
|
|
640
|
+
readonly runs: readonly HeardRun[];
|
|
641
|
+
readonly whole: boolean;
|
|
642
|
+
readonly more: boolean;
|
|
643
|
+
readonly mark: string;
|
|
644
|
+
};
|
|
645
|
+
export type RunMarks = {
|
|
646
|
+
readonly rooms: Readonly<Record<string, string>>;
|
|
647
|
+
readonly sent: string | null;
|
|
648
|
+
};
|
|
649
|
+
export type RunStream = {
|
|
650
|
+
hold(marks: RunMarks): void;
|
|
651
|
+
observe(notify: (event: RunEvent) => void): () => void;
|
|
652
|
+
};
|
|
500
653
|
export type RoomStream = {
|
|
501
654
|
hold(rooms: readonly HeldRoom[]): void;
|
|
502
655
|
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
@@ -504,27 +657,30 @@ export type RoomStream = {
|
|
|
504
657
|
export type PathRule = (path: string) => boolean;
|
|
505
658
|
export type Adapter = {
|
|
506
659
|
readonly localSaves?: true;
|
|
507
|
-
readonly roomTypes?:
|
|
508
|
-
readonly nameableRoomTypes?: readonly string[];
|
|
660
|
+
readonly roomTypes?: VerifiedModel;
|
|
509
661
|
readonly typedPaths?: readonly TypedPath[];
|
|
510
662
|
readonly pathRule?: PathRule;
|
|
511
663
|
readonly unkeptReads?: readonly string[];
|
|
512
664
|
readonly leadingReads?: readonly string[];
|
|
665
|
+
readonly renamedActions?: ReadonlyMap<string, string>;
|
|
666
|
+
readonly rewrittenInputs?: ReadonlyMap<string, (input: unknown) => unknown>;
|
|
513
667
|
authorize(): Promise<Authorization>;
|
|
514
668
|
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
515
669
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
516
670
|
refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
517
671
|
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
518
672
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
519
|
-
binary(authorization: Authorization, request:
|
|
520
|
-
link(authorization: Authorization, request:
|
|
673
|
+
binary(authorization: Authorization, request: AttachmentRequest): Promise<AttachmentResult>;
|
|
674
|
+
link(authorization: Authorization, request: AttachmentRequest | KeyedRequest): Promise<AttachmentLinkResult>;
|
|
521
675
|
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
522
676
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
523
677
|
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
678
|
+
queryHouse?(authorization: Authorization, request: HouseQueryAsk): Promise<HouseQueryAnswer>;
|
|
524
679
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
525
680
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
526
681
|
roomStream?: RoomStream;
|
|
527
682
|
conversations?: ConversationStream;
|
|
683
|
+
runs?: RunStream;
|
|
528
684
|
serviceMode?: ServiceModeSignal;
|
|
529
685
|
};
|
|
530
686
|
//# sourceMappingURL=adapter.d.ts.map
|