@agentshouse/mdruntime 0.1.0-ccad597a8a1f0 → 0.1.0-ccae62c0cab02
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 +9 -9
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +32 -3
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +62 -19
- package/dist/adapter.d.ts +176 -21
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +2 -2
- 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.js +2 -2
- package/dist/client.d.ts +23 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +25 -52
- package/dist/collection.d.ts +3 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +16 -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 +71 -39
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +11 -4
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +3 -3
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +4 -3
- package/dist/conversation-row.d.ts +21 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +35 -8
- package/dist/conversation.d.ts +19 -7
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +74 -51
- 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 +1 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +3 -0
- package/dist/entry.d.ts +26 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +126 -36
- 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 +2 -2
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +1 -1
- package/dist/host.d.ts +6 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +57 -21
- 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 +20 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -5
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +30 -16
- package/dist/linked-file.d.ts +7 -0
- package/dist/linked-file.d.ts.map +1 -0
- package/dist/linked-file.js +16 -0
- package/dist/listing.d.ts +20 -12
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +33 -17
- package/dist/live.d.ts +14 -0
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +29 -12
- 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 +2 -0
- package/dist/media.d.ts +19 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +177 -27
- package/dist/memory.d.ts +4 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +48 -16
- package/dist/messages.d.ts +10 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +25 -7
- 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/name.d.ts +0 -1
- package/dist/name.d.ts.map +1 -1
- package/dist/name.js +3 -7
- package/dist/observation.d.ts +2 -0
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +42 -9
- 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 +27 -14
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +14 -5
- package/dist/overlay.d.ts +20 -9
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +108 -39
- package/dist/parts.d.ts +4 -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 +10 -5
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +78 -48
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +75 -53
- 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 +1 -1
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +55 -23
- package/dist/reach.d.ts +13 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +130 -25
- package/dist/react.d.ts +11 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +17 -4
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +17 -7
- 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 +229 -8
- 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 +9 -2
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +19 -5
- 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 +6 -3
- 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 +29 -91
- package/dist/saves.d.ts +7 -5
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +107 -52
- 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 +3 -1
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +32 -14
- 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 +42 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +76 -9
- package/dist/store/records.d.ts +22 -5
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +14 -4
- package/dist/store.d.ts +9 -5
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +7 -4
- package/dist/stored.d.ts +17 -3
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +139 -35
- package/dist/surface.d.ts +18 -7
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +51 -15
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +45 -23
- package/dist/tables.d.ts +28 -47
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +83 -321
- package/dist/tallies.js +2 -2
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +49 -3
- package/dist/wire.d.ts +29 -6
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +18 -11
- 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
|
|
|
@@ -52,7 +52,7 @@ button.open({ agent });
|
|
|
52
52
|
```
|
|
53
53
|
|
|
54
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
|
|
55
|
+
Chat, are the `apps/` pages of House's Guide, which House's `guide` tool opens.
|
|
56
56
|
|
|
57
57
|
## License
|
|
58
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),
|
|
@@ -268,7 +297,7 @@ function submitting(locator) {
|
|
|
268
297
|
return `submit ${locator}`;
|
|
269
298
|
}
|
|
270
299
|
export function submitLater(runtime, locator) {
|
|
271
|
-
if (runtime.
|
|
300
|
+
if (runtime.savesLocally(locator))
|
|
272
301
|
return;
|
|
273
302
|
void runtime.recovery.attempt(submitting(locator), (signal) => submitPass(runtime, locator, signal));
|
|
274
303
|
}
|
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,CAOhD;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAsBrB;AAgED,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
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { classifyHref, parseRoomPath, roomTarget } from '@agentshouse/mdmodel';
|
|
2
2
|
import { CATCHING_UP, holdsSubmission, resendConversations } from './conversation.js';
|
|
3
3
|
import { listingNow } from './listing.js';
|
|
4
4
|
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;
|
|
@@ -50,20 +51,20 @@ export async function readHistory(runtime, locator, path, query = {}) {
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
export async function located(runtime, room, path, destination) {
|
|
53
|
-
const crossing = roomTarget(destination);
|
|
54
54
|
const listing = await listingNow(runtime);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
const named = classifyHref(path, destination, listing.get(room)?.handle);
|
|
56
|
+
if (named.kind === 'path')
|
|
57
|
+
return listing.has(room) ? { room, path: named.path } : null;
|
|
58
|
+
if (named.kind !== 'room')
|
|
59
|
+
return null;
|
|
60
|
+
const held = [...listing.values()].find((listed) => listed.handle === named.handle);
|
|
61
|
+
return held === undefined ? null : { room: held.locator, path: named.path };
|
|
61
62
|
}
|
|
62
63
|
export async function resolveReference(runtime, room, path, destination) {
|
|
63
64
|
const { store } = runtime;
|
|
64
|
-
|
|
65
|
+
const kind = classifyHref(path, destination).kind;
|
|
66
|
+
if (kind !== 'path' && kind !== 'room')
|
|
65
67
|
return ABSENT_TARGET;
|
|
66
|
-
}
|
|
67
68
|
const at = await located(runtime, room, path, destination);
|
|
68
69
|
if (at === null)
|
|
69
70
|
return UNREADABLE;
|
|
@@ -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,40 @@ 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
|
+
const FOLDER_END = /\/$/u;
|
|
120
|
+
function namedRoom(path) {
|
|
121
|
+
return (parseRoomPath(path.replace(FOLDER_END, ''))?.handle ??
|
|
122
|
+
roomTarget(path)?.handle ??
|
|
123
|
+
ROOM_TOP.exec(path)?.[1] ??
|
|
124
|
+
null);
|
|
125
|
+
}
|
|
98
126
|
async function calledRooms(runtime, name, input) {
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
127
|
+
const declared = await declaration(runtime, name);
|
|
128
|
+
if (declared === undefined || input === null || typeof input !== 'object')
|
|
101
129
|
return [];
|
|
102
|
-
const named =
|
|
103
|
-
|
|
130
|
+
const named = declared.room === undefined ? [] : strings(selectorValues(input, declared.room));
|
|
131
|
+
const handles = strings((declared.roomPaths ?? []).flatMap((selector) => selectorValues(input, selector))).flatMap((path) => namedRoom(path) ?? []);
|
|
132
|
+
if (handles.length === 0)
|
|
133
|
+
return named;
|
|
134
|
+
const listing = await listingNow(runtime);
|
|
135
|
+
return [
|
|
136
|
+
...named,
|
|
137
|
+
...[...listing.values()]
|
|
138
|
+
.filter((listed) => handles.includes(listed.handle) || handles.includes(listed.locator))
|
|
139
|
+
.map((listed) => listed.locator),
|
|
140
|
+
];
|
|
104
141
|
}
|
|
105
142
|
export async function invokeAction(runtime, name, input, { dispatching, attempt } = {}) {
|
|
106
143
|
const { store, socket, retries } = runtime;
|
|
@@ -109,8 +146,11 @@ export async function invokeAction(runtime, name, input, { dispatching, attempt
|
|
|
109
146
|
if (socket.closed() || session.now().refusal !== null) {
|
|
110
147
|
return handedOutcome(retries, attempt, UNANSWERED);
|
|
111
148
|
}
|
|
112
|
-
if ((await declaredAction(runtime, name)) === undefined)
|
|
113
|
-
return
|
|
149
|
+
if ((await declaredAction(runtime, name)) === undefined) {
|
|
150
|
+
return session.now().roomsNamed
|
|
151
|
+
? undeclared(name)
|
|
152
|
+
: handedOutcome(retries, attempt, UNANSWERED);
|
|
153
|
+
}
|
|
114
154
|
try {
|
|
115
155
|
await socket.authorize();
|
|
116
156
|
}
|
|
@@ -270,7 +310,10 @@ export async function resendCalls(runtime, signal) {
|
|
|
270
310
|
continue;
|
|
271
311
|
if (socket.closed() || signal.aborted)
|
|
272
312
|
return 'done';
|
|
273
|
-
const
|
|
313
|
+
const name = runtime.renamedActions.get(held.name) ?? held.name;
|
|
314
|
+
const rewrite = runtime.rewrittenInputs.get(held.name);
|
|
315
|
+
const input = rewrite === undefined ? held.input : rewrite(held.input);
|
|
316
|
+
const sender = keptSender(runtime, name, input, held.operation, true);
|
|
274
317
|
try {
|
|
275
318
|
if (unsettled(await sender.send()))
|
|
276
319
|
return 'again';
|
package/dist/adapter.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ 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,19 +41,28 @@ 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
52
|
name: string;
|
|
53
|
+
conversationName: string;
|
|
46
54
|
created: string;
|
|
47
|
-
finished: string | null;
|
|
48
55
|
outcome: string | null;
|
|
49
56
|
waiting: boolean;
|
|
50
57
|
newest: string | null;
|
|
51
58
|
processEnded: string | null;
|
|
59
|
+
activity: ConversationActivity | null;
|
|
52
60
|
subject: string | null;
|
|
61
|
+
room: string | null;
|
|
62
|
+
model: string | null;
|
|
63
|
+
effort: string | null;
|
|
53
64
|
};
|
|
54
|
-
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete' | 'conversations/take-out' | 'conversations/rename' | 'conversations/
|
|
65
|
+
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';
|
|
55
66
|
export type ConversationMessage = {
|
|
56
67
|
identity: string;
|
|
57
68
|
turn: string;
|
|
@@ -145,10 +156,6 @@ export type ConversationEvent = {
|
|
|
145
156
|
kind: 'state';
|
|
146
157
|
conversation: string;
|
|
147
158
|
state: SessionState | null;
|
|
148
|
-
} | {
|
|
149
|
-
kind: 'link';
|
|
150
|
-
conversation: string;
|
|
151
|
-
connected: boolean;
|
|
152
159
|
} | {
|
|
153
160
|
kind: 'deliveries';
|
|
154
161
|
conversation: string;
|
|
@@ -183,6 +190,35 @@ export type AgentEnvironment = {
|
|
|
183
190
|
name: string;
|
|
184
191
|
state: 'online' | 'offline';
|
|
185
192
|
};
|
|
193
|
+
export type ListedOwner = {
|
|
194
|
+
readonly user: string;
|
|
195
|
+
readonly name: string;
|
|
196
|
+
};
|
|
197
|
+
export type ListedSpaceRef = {
|
|
198
|
+
readonly space_ref: string;
|
|
199
|
+
readonly name: string;
|
|
200
|
+
};
|
|
201
|
+
export type RoomListEntry = {
|
|
202
|
+
readonly room_ref: string;
|
|
203
|
+
readonly room_handle: string;
|
|
204
|
+
readonly name: string;
|
|
205
|
+
readonly level: 'search' | 'open' | 'keep';
|
|
206
|
+
readonly access: 'owner' | 'manage' | 'write' | 'read' | 'public';
|
|
207
|
+
readonly owner: ListedOwner;
|
|
208
|
+
readonly created: string;
|
|
209
|
+
readonly archived?: string;
|
|
210
|
+
readonly exportable?: true;
|
|
211
|
+
readonly space?: ListedSpaceRef;
|
|
212
|
+
};
|
|
213
|
+
export type SpaceListEntry = ListedSpaceRef & {
|
|
214
|
+
readonly owner: ListedOwner;
|
|
215
|
+
readonly created: string;
|
|
216
|
+
readonly manages?: true;
|
|
217
|
+
};
|
|
218
|
+
export type RoomList = {
|
|
219
|
+
readonly rooms: readonly RoomListEntry[];
|
|
220
|
+
readonly spaces: readonly SpaceListEntry[];
|
|
221
|
+
};
|
|
186
222
|
export type ListedAgent = {
|
|
187
223
|
id: string;
|
|
188
224
|
name: string;
|
|
@@ -192,11 +228,14 @@ export type ListedAgent = {
|
|
|
192
228
|
environment_connected: boolean;
|
|
193
229
|
launch_directory: string;
|
|
194
230
|
cli: string;
|
|
195
|
-
model: string
|
|
231
|
+
model: string;
|
|
196
232
|
effort: string | null;
|
|
197
|
-
|
|
233
|
+
model_fixed: boolean;
|
|
198
234
|
base_instructions: string;
|
|
235
|
+
compaction_threshold: number | null;
|
|
236
|
+
compaction_words: string;
|
|
199
237
|
in_telegram: boolean;
|
|
238
|
+
telegram_messages: 'every' | 'last';
|
|
200
239
|
created: string;
|
|
201
240
|
retired_at: string | null;
|
|
202
241
|
};
|
|
@@ -211,6 +250,7 @@ export type ActionDeclaration = {
|
|
|
211
250
|
inputShape: unknown;
|
|
212
251
|
resultKind: unknown;
|
|
213
252
|
room?: string;
|
|
253
|
+
roomPaths?: readonly string[];
|
|
214
254
|
};
|
|
215
255
|
export type ProviderLimit = {
|
|
216
256
|
name: string;
|
|
@@ -226,6 +266,11 @@ export type Retention = {
|
|
|
226
266
|
history: HistoryRetention;
|
|
227
267
|
refreshHorizon: number;
|
|
228
268
|
};
|
|
269
|
+
export type QueriedRoom = {
|
|
270
|
+
readonly locator: string;
|
|
271
|
+
readonly handle: string;
|
|
272
|
+
readonly name: string;
|
|
273
|
+
};
|
|
229
274
|
export type Discovery = {
|
|
230
275
|
kind: 'discovery';
|
|
231
276
|
rooms: readonly DiscoveredRoom[];
|
|
@@ -233,6 +278,9 @@ export type Discovery = {
|
|
|
233
278
|
providerLimits: readonly ProviderLimit[];
|
|
234
279
|
retention: Retention;
|
|
235
280
|
member?: Member;
|
|
281
|
+
timeZone?: string | null;
|
|
282
|
+
roomList?: RoomList;
|
|
283
|
+
queriesOnly?: readonly QueriedRoom[];
|
|
236
284
|
};
|
|
237
285
|
export type TransportUncertainty = {
|
|
238
286
|
kind: 'transport-uncertainty';
|
|
@@ -261,24 +309,42 @@ export type ContractUnavailable = ProviderRefusal & {
|
|
|
261
309
|
};
|
|
262
310
|
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
263
311
|
export type PageToken = string;
|
|
312
|
+
export type AppMemberAuthor = {
|
|
313
|
+
kind: 'app_member';
|
|
314
|
+
id: string;
|
|
315
|
+
name: string;
|
|
316
|
+
site: {
|
|
317
|
+
id: string;
|
|
318
|
+
name: string;
|
|
319
|
+
};
|
|
320
|
+
};
|
|
264
321
|
export type ChangeAuthor = {
|
|
265
322
|
kind: Open<'user' | 'site' | 'inbox' | 'app'>;
|
|
266
323
|
id: string;
|
|
267
324
|
name: string;
|
|
325
|
+
} | AppMemberAuthor;
|
|
326
|
+
export type AppMember = {
|
|
327
|
+
kind: 'app_member';
|
|
328
|
+
id: string;
|
|
329
|
+
name: string;
|
|
330
|
+
access: Open<'waiting' | 'in' | 'out'>;
|
|
331
|
+
paidUntil: string | null;
|
|
268
332
|
};
|
|
269
333
|
export type Member = {
|
|
270
334
|
kind: Open<'user'>;
|
|
271
335
|
id: string;
|
|
272
336
|
name: string;
|
|
273
|
-
};
|
|
337
|
+
} | AppMember;
|
|
274
338
|
export type HeadChange = {
|
|
275
339
|
author: ChangeAuthor | null;
|
|
276
340
|
time: string;
|
|
277
341
|
};
|
|
278
|
-
export type
|
|
342
|
+
export type Attachment = {
|
|
279
343
|
byteLength: number;
|
|
280
344
|
mediaType: string;
|
|
281
345
|
sha256: string;
|
|
346
|
+
width?: number | null;
|
|
347
|
+
height?: number | null;
|
|
282
348
|
};
|
|
283
349
|
export type BootstrapRequest = {
|
|
284
350
|
locator: string;
|
|
@@ -307,7 +373,7 @@ export type BootstrapPage = {
|
|
|
307
373
|
fileIds?: Readonly<Record<string, string>>;
|
|
308
374
|
created?: Readonly<Record<string, string>>;
|
|
309
375
|
changes: Readonly<Record<string, HeadChange>>;
|
|
310
|
-
|
|
376
|
+
attachments: Readonly<Record<string, Attachment>>;
|
|
311
377
|
folders?: readonly string[];
|
|
312
378
|
pageToken?: PageToken;
|
|
313
379
|
parts?: readonly BootstrapPart[];
|
|
@@ -335,7 +401,7 @@ export type RefreshPage = {
|
|
|
335
401
|
fileIds?: Readonly<Record<string, string>>;
|
|
336
402
|
created?: Readonly<Record<string, string>>;
|
|
337
403
|
changes: Readonly<Record<string, HeadChange>>;
|
|
338
|
-
|
|
404
|
+
attachments: Readonly<Record<string, Attachment>>;
|
|
339
405
|
removals: readonly string[];
|
|
340
406
|
folders?: readonly string[];
|
|
341
407
|
folderRemovals?: readonly string[];
|
|
@@ -349,6 +415,7 @@ export type RefreshResult = {
|
|
|
349
415
|
export type MutationRequest = {
|
|
350
416
|
locator: string;
|
|
351
417
|
changeBatch: ChangeBatch;
|
|
418
|
+
written: Written;
|
|
352
419
|
file(localId: string): Promise<Blob>;
|
|
353
420
|
upload?: unknown;
|
|
354
421
|
};
|
|
@@ -367,7 +434,7 @@ export type AcceptedRoom = {
|
|
|
367
434
|
fileIds?: Readonly<Record<string, string>>;
|
|
368
435
|
changes: Readonly<Record<string, HeadChange>>;
|
|
369
436
|
removals: readonly string[];
|
|
370
|
-
|
|
437
|
+
attachments?: Readonly<Record<string, Attachment>>;
|
|
371
438
|
};
|
|
372
439
|
export type MutationResult = (AcceptedRoom & {
|
|
373
440
|
kind: 'accepted';
|
|
@@ -385,12 +452,12 @@ export type HistoryAuthor = {
|
|
|
385
452
|
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
386
453
|
id: string;
|
|
387
454
|
name: string;
|
|
388
|
-
};
|
|
455
|
+
} | AppMemberAuthor;
|
|
389
456
|
export type HistoryRevision = {
|
|
390
457
|
revision: string;
|
|
391
458
|
author: HistoryAuthor;
|
|
392
459
|
time: string;
|
|
393
|
-
|
|
460
|
+
attachment?: Attachment;
|
|
394
461
|
};
|
|
395
462
|
export type HistoryRequest = {
|
|
396
463
|
locator: string;
|
|
@@ -409,21 +476,31 @@ export type HistoryResult = {
|
|
|
409
476
|
} | {
|
|
410
477
|
kind: 'no-history';
|
|
411
478
|
} | AdapterFailure;
|
|
412
|
-
export type
|
|
479
|
+
export type AttachmentRequest = {
|
|
413
480
|
kind: 'path';
|
|
414
481
|
locator: string;
|
|
415
482
|
path: string;
|
|
416
483
|
revision: string;
|
|
417
484
|
};
|
|
418
|
-
export type
|
|
485
|
+
export type KeyedRequest = {
|
|
486
|
+
kind: 'key';
|
|
487
|
+
link: string;
|
|
488
|
+
};
|
|
489
|
+
export type AttachmentCopy = {
|
|
490
|
+
url: string;
|
|
491
|
+
width: number;
|
|
492
|
+
};
|
|
493
|
+
export type AttachmentResult = {
|
|
419
494
|
kind: 'binary';
|
|
420
495
|
body: ReadableStream<Uint8Array>;
|
|
421
496
|
mediaType: string;
|
|
422
497
|
sha256?: string;
|
|
498
|
+
url?: string;
|
|
499
|
+
copies?: readonly AttachmentCopy[];
|
|
423
500
|
} | (ProviderRefusal & {
|
|
424
501
|
kind: 'rejected';
|
|
425
502
|
}) | AdapterFailure;
|
|
426
|
-
export type
|
|
503
|
+
export type AttachmentLinkResult = {
|
|
427
504
|
kind: 'link';
|
|
428
505
|
url: string;
|
|
429
506
|
name: string;
|
|
@@ -432,7 +509,7 @@ export type BinaryLinkResult = {
|
|
|
432
509
|
kind: 'rejected';
|
|
433
510
|
}) | AdapterFailure;
|
|
434
511
|
export type AttachRequest = {
|
|
435
|
-
locator
|
|
512
|
+
locator?: string;
|
|
436
513
|
name: string;
|
|
437
514
|
mediaType: string;
|
|
438
515
|
byteLength: number;
|
|
@@ -443,6 +520,9 @@ export type AttachResult = {
|
|
|
443
520
|
kind: 'attached';
|
|
444
521
|
path: string;
|
|
445
522
|
revision: string;
|
|
523
|
+
} | {
|
|
524
|
+
kind: 'linked';
|
|
525
|
+
link: string;
|
|
446
526
|
} | (ProviderRefusal & {
|
|
447
527
|
kind: 'rejected';
|
|
448
528
|
}) | AdapterFailure;
|
|
@@ -478,6 +558,40 @@ export type SearchAnswer = {
|
|
|
478
558
|
} | (ProviderRefusal & {
|
|
479
559
|
kind: 'rejected';
|
|
480
560
|
}) | AdapterFailure;
|
|
561
|
+
export type HouseQueryFollow = string | {
|
|
562
|
+
readonly room: string;
|
|
563
|
+
readonly path: string;
|
|
564
|
+
} | {
|
|
565
|
+
readonly room: string;
|
|
566
|
+
readonly path: string;
|
|
567
|
+
readonly open: readonly string[];
|
|
568
|
+
};
|
|
569
|
+
export type HouseQueryAsk = {
|
|
570
|
+
room: string;
|
|
571
|
+
fresh: boolean;
|
|
572
|
+
follows?: readonly HouseQueryFollow[];
|
|
573
|
+
} & ({
|
|
574
|
+
query: Readonly<Record<string, unknown>>;
|
|
575
|
+
} | {
|
|
576
|
+
path: string;
|
|
577
|
+
after?: string;
|
|
578
|
+
});
|
|
579
|
+
export type HouseQueryRows = {
|
|
580
|
+
kind: 'rows';
|
|
581
|
+
documents: readonly QueryDocument[];
|
|
582
|
+
next?: string;
|
|
583
|
+
total?: number;
|
|
584
|
+
totalCapped?: true;
|
|
585
|
+
};
|
|
586
|
+
export type HouseQueryGroups = {
|
|
587
|
+
kind: 'groups';
|
|
588
|
+
groups: readonly QueryGroup[];
|
|
589
|
+
next?: string;
|
|
590
|
+
capped?: true;
|
|
591
|
+
};
|
|
592
|
+
export type HouseQueryAnswer = HouseQueryRows | HouseQueryGroups | (ProviderRefusal & {
|
|
593
|
+
kind: 'rejected';
|
|
594
|
+
}) | AdapterFailure;
|
|
481
595
|
export type HeldRoom = {
|
|
482
596
|
locator: string;
|
|
483
597
|
roomVersion: string | null;
|
|
@@ -494,6 +608,10 @@ export type AuthorityChange = {
|
|
|
494
608
|
rooms: readonly DiscoveredRoom[];
|
|
495
609
|
left: readonly string[];
|
|
496
610
|
member?: Member;
|
|
611
|
+
timeZone?: string | null;
|
|
612
|
+
roomList?: RoomList & {
|
|
613
|
+
readonly left: readonly string[];
|
|
614
|
+
};
|
|
497
615
|
};
|
|
498
616
|
export type RoomStreamEvent = {
|
|
499
617
|
kind: 'opened';
|
|
@@ -508,7 +626,40 @@ export type RoomStreamEvent = {
|
|
|
508
626
|
} | {
|
|
509
627
|
kind: 'caught-up';
|
|
510
628
|
expired: readonly string[];
|
|
629
|
+
} | {
|
|
630
|
+
kind: 'reported';
|
|
511
631
|
} | AuthorityChange | RoomChange;
|
|
632
|
+
export type HeardRun = {
|
|
633
|
+
readonly room: string;
|
|
634
|
+
readonly name: string;
|
|
635
|
+
readonly document: string;
|
|
636
|
+
readonly current: boolean;
|
|
637
|
+
readonly starter: string | null;
|
|
638
|
+
};
|
|
639
|
+
export type RunEvent = {
|
|
640
|
+
readonly kind: 'run';
|
|
641
|
+
readonly run: HeardRun;
|
|
642
|
+
readonly listing: string | null;
|
|
643
|
+
} | {
|
|
644
|
+
readonly kind: 'removed';
|
|
645
|
+
readonly room: string;
|
|
646
|
+
readonly name: string;
|
|
647
|
+
} | {
|
|
648
|
+
readonly kind: 'runs';
|
|
649
|
+
readonly listing: string | null;
|
|
650
|
+
readonly runs: readonly HeardRun[];
|
|
651
|
+
readonly whole: boolean;
|
|
652
|
+
readonly more: boolean;
|
|
653
|
+
readonly mark: string;
|
|
654
|
+
};
|
|
655
|
+
export type RunMarks = {
|
|
656
|
+
readonly rooms: Readonly<Record<string, string>>;
|
|
657
|
+
readonly sent: string | null;
|
|
658
|
+
};
|
|
659
|
+
export type RunStream = {
|
|
660
|
+
hold(marks: RunMarks): void;
|
|
661
|
+
observe(notify: (event: RunEvent) => void): () => void;
|
|
662
|
+
};
|
|
512
663
|
export type RoomStream = {
|
|
513
664
|
hold(rooms: readonly HeldRoom[]): void;
|
|
514
665
|
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
@@ -521,21 +672,25 @@ export type Adapter = {
|
|
|
521
672
|
readonly pathRule?: PathRule;
|
|
522
673
|
readonly unkeptReads?: readonly string[];
|
|
523
674
|
readonly leadingReads?: readonly string[];
|
|
675
|
+
readonly renamedActions?: ReadonlyMap<string, string>;
|
|
676
|
+
readonly rewrittenInputs?: ReadonlyMap<string, (input: unknown) => unknown>;
|
|
524
677
|
authorize(): Promise<Authorization>;
|
|
525
678
|
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
526
679
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
527
680
|
refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
528
681
|
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
529
682
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
530
|
-
binary(authorization: Authorization, request:
|
|
531
|
-
link(authorization: Authorization, request:
|
|
683
|
+
binary(authorization: Authorization, request: AttachmentRequest): Promise<AttachmentResult>;
|
|
684
|
+
link(authorization: Authorization, request: AttachmentRequest | KeyedRequest): Promise<AttachmentLinkResult>;
|
|
532
685
|
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
533
686
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
534
687
|
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
688
|
+
queryHouse?(authorization: Authorization, request: HouseQueryAsk): Promise<HouseQueryAnswer>;
|
|
535
689
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
536
690
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
537
691
|
roomStream?: RoomStream;
|
|
538
692
|
conversations?: ConversationStream;
|
|
693
|
+
runs?: RunStream;
|
|
539
694
|
serviceMode?: ServiceModeSignal;
|
|
540
695
|
};
|
|
541
696
|
//# sourceMappingURL=adapter.d.ts.map
|