@agentshouse/mdruntime 0.1.0-c33f874b1f932 → 0.1.0-c346b1fc00b03
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 +58 -19
- package/dist/adapter.d.ts +183 -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 +22 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +24 -51
- 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 +12 -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 +13 -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 +5 -3
- package/dist/loaded.d.ts.map +1 -1
- package/dist/loaded.js +12 -6
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +2 -0
- package/dist/media.d.ts +14 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +126 -30
- package/dist/memory.d.ts +4 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +50 -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 +7 -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;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
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { classifyHref, parseRoomPath } 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,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 FOLDER_END = /\/$/u;
|
|
119
|
+
function namedRoom(path) {
|
|
120
|
+
return parseRoomPath(path.replace(FOLDER_END, ''))?.handle ?? 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 = runtime.keptInput(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
|
@@ -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,15 @@ 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;
|
|
237
|
+
auto_compact: number | 'off' | null;
|
|
199
238
|
in_telegram: boolean;
|
|
239
|
+
telegram_messages: 'every' | 'last';
|
|
200
240
|
created: string;
|
|
201
241
|
retired_at: string | null;
|
|
202
242
|
};
|
|
@@ -211,6 +251,7 @@ export type ActionDeclaration = {
|
|
|
211
251
|
inputShape: unknown;
|
|
212
252
|
resultKind: unknown;
|
|
213
253
|
room?: string;
|
|
254
|
+
roomPaths?: readonly string[];
|
|
214
255
|
};
|
|
215
256
|
export type ProviderLimit = {
|
|
216
257
|
name: string;
|
|
@@ -226,6 +267,11 @@ export type Retention = {
|
|
|
226
267
|
history: HistoryRetention;
|
|
227
268
|
refreshHorizon: number;
|
|
228
269
|
};
|
|
270
|
+
export type QueriedRoom = {
|
|
271
|
+
readonly locator: string;
|
|
272
|
+
readonly handle: string;
|
|
273
|
+
readonly name: string;
|
|
274
|
+
};
|
|
229
275
|
export type Discovery = {
|
|
230
276
|
kind: 'discovery';
|
|
231
277
|
rooms: readonly DiscoveredRoom[];
|
|
@@ -233,6 +279,9 @@ export type Discovery = {
|
|
|
233
279
|
providerLimits: readonly ProviderLimit[];
|
|
234
280
|
retention: Retention;
|
|
235
281
|
member?: Member;
|
|
282
|
+
timeZone?: string | null;
|
|
283
|
+
roomList?: RoomList;
|
|
284
|
+
queriesOnly?: readonly QueriedRoom[];
|
|
236
285
|
};
|
|
237
286
|
export type TransportUncertainty = {
|
|
238
287
|
kind: 'transport-uncertainty';
|
|
@@ -261,24 +310,42 @@ export type ContractUnavailable = ProviderRefusal & {
|
|
|
261
310
|
};
|
|
262
311
|
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
263
312
|
export type PageToken = string;
|
|
313
|
+
export type AppMemberAuthor = {
|
|
314
|
+
kind: 'app_member';
|
|
315
|
+
id: string;
|
|
316
|
+
name: string;
|
|
317
|
+
site: {
|
|
318
|
+
id: string;
|
|
319
|
+
name: string;
|
|
320
|
+
};
|
|
321
|
+
};
|
|
264
322
|
export type ChangeAuthor = {
|
|
265
323
|
kind: Open<'user' | 'site' | 'inbox' | 'app'>;
|
|
266
324
|
id: string;
|
|
267
325
|
name: string;
|
|
326
|
+
} | AppMemberAuthor;
|
|
327
|
+
export type AppMember = {
|
|
328
|
+
kind: 'app_member';
|
|
329
|
+
id: string;
|
|
330
|
+
name: string;
|
|
331
|
+
access: Open<'waiting' | 'in' | 'out'>;
|
|
332
|
+
paidUntil: string | null;
|
|
268
333
|
};
|
|
269
334
|
export type Member = {
|
|
270
335
|
kind: Open<'user'>;
|
|
271
336
|
id: string;
|
|
272
337
|
name: string;
|
|
273
|
-
};
|
|
338
|
+
} | AppMember;
|
|
274
339
|
export type HeadChange = {
|
|
275
340
|
author: ChangeAuthor | null;
|
|
276
341
|
time: string;
|
|
277
342
|
};
|
|
278
|
-
export type
|
|
343
|
+
export type Attachment = {
|
|
279
344
|
byteLength: number;
|
|
280
345
|
mediaType: string;
|
|
281
346
|
sha256: string;
|
|
347
|
+
width?: number | null;
|
|
348
|
+
height?: number | null;
|
|
282
349
|
};
|
|
283
350
|
export type BootstrapRequest = {
|
|
284
351
|
locator: string;
|
|
@@ -307,7 +374,7 @@ export type BootstrapPage = {
|
|
|
307
374
|
fileIds?: Readonly<Record<string, string>>;
|
|
308
375
|
created?: Readonly<Record<string, string>>;
|
|
309
376
|
changes: Readonly<Record<string, HeadChange>>;
|
|
310
|
-
|
|
377
|
+
attachments: Readonly<Record<string, Attachment>>;
|
|
311
378
|
folders?: readonly string[];
|
|
312
379
|
pageToken?: PageToken;
|
|
313
380
|
parts?: readonly BootstrapPart[];
|
|
@@ -335,7 +402,7 @@ export type RefreshPage = {
|
|
|
335
402
|
fileIds?: Readonly<Record<string, string>>;
|
|
336
403
|
created?: Readonly<Record<string, string>>;
|
|
337
404
|
changes: Readonly<Record<string, HeadChange>>;
|
|
338
|
-
|
|
405
|
+
attachments: Readonly<Record<string, Attachment>>;
|
|
339
406
|
removals: readonly string[];
|
|
340
407
|
folders?: readonly string[];
|
|
341
408
|
folderRemovals?: readonly string[];
|
|
@@ -349,6 +416,7 @@ export type RefreshResult = {
|
|
|
349
416
|
export type MutationRequest = {
|
|
350
417
|
locator: string;
|
|
351
418
|
changeBatch: ChangeBatch;
|
|
419
|
+
written: Written;
|
|
352
420
|
file(localId: string): Promise<Blob>;
|
|
353
421
|
upload?: unknown;
|
|
354
422
|
};
|
|
@@ -367,7 +435,7 @@ export type AcceptedRoom = {
|
|
|
367
435
|
fileIds?: Readonly<Record<string, string>>;
|
|
368
436
|
changes: Readonly<Record<string, HeadChange>>;
|
|
369
437
|
removals: readonly string[];
|
|
370
|
-
|
|
438
|
+
attachments?: Readonly<Record<string, Attachment>>;
|
|
371
439
|
};
|
|
372
440
|
export type MutationResult = (AcceptedRoom & {
|
|
373
441
|
kind: 'accepted';
|
|
@@ -385,12 +453,17 @@ export type HistoryAuthor = {
|
|
|
385
453
|
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
386
454
|
id: string;
|
|
387
455
|
name: string;
|
|
388
|
-
}
|
|
456
|
+
} | {
|
|
457
|
+
kind: 'function';
|
|
458
|
+
id: string;
|
|
459
|
+
name: string;
|
|
460
|
+
version: number;
|
|
461
|
+
} | AppMemberAuthor;
|
|
389
462
|
export type HistoryRevision = {
|
|
390
463
|
revision: string;
|
|
391
464
|
author: HistoryAuthor;
|
|
392
465
|
time: string;
|
|
393
|
-
|
|
466
|
+
attachment?: Attachment;
|
|
394
467
|
};
|
|
395
468
|
export type HistoryRequest = {
|
|
396
469
|
locator: string;
|
|
@@ -409,21 +482,31 @@ export type HistoryResult = {
|
|
|
409
482
|
} | {
|
|
410
483
|
kind: 'no-history';
|
|
411
484
|
} | AdapterFailure;
|
|
412
|
-
export type
|
|
485
|
+
export type AttachmentRequest = {
|
|
413
486
|
kind: 'path';
|
|
414
487
|
locator: string;
|
|
415
488
|
path: string;
|
|
416
489
|
revision: string;
|
|
417
490
|
};
|
|
418
|
-
export type
|
|
491
|
+
export type KeyedRequest = {
|
|
492
|
+
kind: 'key';
|
|
493
|
+
link: string;
|
|
494
|
+
};
|
|
495
|
+
export type AttachmentCopy = {
|
|
496
|
+
url: string;
|
|
497
|
+
width: number;
|
|
498
|
+
};
|
|
499
|
+
export type AttachmentResult = {
|
|
419
500
|
kind: 'binary';
|
|
420
501
|
body: ReadableStream<Uint8Array>;
|
|
421
502
|
mediaType: string;
|
|
422
503
|
sha256?: string;
|
|
504
|
+
url?: string;
|
|
505
|
+
copies?: readonly AttachmentCopy[];
|
|
423
506
|
} | (ProviderRefusal & {
|
|
424
507
|
kind: 'rejected';
|
|
425
508
|
}) | AdapterFailure;
|
|
426
|
-
export type
|
|
509
|
+
export type AttachmentLinkResult = {
|
|
427
510
|
kind: 'link';
|
|
428
511
|
url: string;
|
|
429
512
|
name: string;
|
|
@@ -432,7 +515,7 @@ export type BinaryLinkResult = {
|
|
|
432
515
|
kind: 'rejected';
|
|
433
516
|
}) | AdapterFailure;
|
|
434
517
|
export type AttachRequest = {
|
|
435
|
-
locator
|
|
518
|
+
locator?: string;
|
|
436
519
|
name: string;
|
|
437
520
|
mediaType: string;
|
|
438
521
|
byteLength: number;
|
|
@@ -443,6 +526,9 @@ export type AttachResult = {
|
|
|
443
526
|
kind: 'attached';
|
|
444
527
|
path: string;
|
|
445
528
|
revision: string;
|
|
529
|
+
} | {
|
|
530
|
+
kind: 'linked';
|
|
531
|
+
link: string;
|
|
446
532
|
} | (ProviderRefusal & {
|
|
447
533
|
kind: 'rejected';
|
|
448
534
|
}) | AdapterFailure;
|
|
@@ -478,6 +564,40 @@ export type SearchAnswer = {
|
|
|
478
564
|
} | (ProviderRefusal & {
|
|
479
565
|
kind: 'rejected';
|
|
480
566
|
}) | AdapterFailure;
|
|
567
|
+
export type HouseQueryFollow = string | {
|
|
568
|
+
readonly room: string;
|
|
569
|
+
readonly path: string;
|
|
570
|
+
} | {
|
|
571
|
+
readonly room: string;
|
|
572
|
+
readonly path: string;
|
|
573
|
+
readonly open: readonly string[];
|
|
574
|
+
};
|
|
575
|
+
export type HouseQueryAsk = {
|
|
576
|
+
room: string;
|
|
577
|
+
fresh: boolean;
|
|
578
|
+
follows?: readonly HouseQueryFollow[];
|
|
579
|
+
} & ({
|
|
580
|
+
query: Readonly<Record<string, unknown>>;
|
|
581
|
+
} | {
|
|
582
|
+
path: string;
|
|
583
|
+
after?: string;
|
|
584
|
+
});
|
|
585
|
+
export type HouseQueryRows = {
|
|
586
|
+
kind: 'rows';
|
|
587
|
+
documents: readonly QueryDocument[];
|
|
588
|
+
next?: string;
|
|
589
|
+
total?: number;
|
|
590
|
+
totalCapped?: true;
|
|
591
|
+
};
|
|
592
|
+
export type HouseQueryGroups = {
|
|
593
|
+
kind: 'groups';
|
|
594
|
+
groups: readonly QueryGroup[];
|
|
595
|
+
next?: string;
|
|
596
|
+
capped?: true;
|
|
597
|
+
};
|
|
598
|
+
export type HouseQueryAnswer = HouseQueryRows | HouseQueryGroups | (ProviderRefusal & {
|
|
599
|
+
kind: 'rejected';
|
|
600
|
+
}) | AdapterFailure;
|
|
481
601
|
export type HeldRoom = {
|
|
482
602
|
locator: string;
|
|
483
603
|
roomVersion: string | null;
|
|
@@ -494,6 +614,10 @@ export type AuthorityChange = {
|
|
|
494
614
|
rooms: readonly DiscoveredRoom[];
|
|
495
615
|
left: readonly string[];
|
|
496
616
|
member?: Member;
|
|
617
|
+
timeZone?: string | null;
|
|
618
|
+
roomList?: RoomList & {
|
|
619
|
+
readonly left: readonly string[];
|
|
620
|
+
};
|
|
497
621
|
};
|
|
498
622
|
export type RoomStreamEvent = {
|
|
499
623
|
kind: 'opened';
|
|
@@ -508,7 +632,40 @@ export type RoomStreamEvent = {
|
|
|
508
632
|
} | {
|
|
509
633
|
kind: 'caught-up';
|
|
510
634
|
expired: readonly string[];
|
|
635
|
+
} | {
|
|
636
|
+
kind: 'reported';
|
|
511
637
|
} | AuthorityChange | RoomChange;
|
|
638
|
+
export type HeardRun = {
|
|
639
|
+
readonly room: string;
|
|
640
|
+
readonly name: string;
|
|
641
|
+
readonly document: string;
|
|
642
|
+
readonly current: boolean;
|
|
643
|
+
readonly starter: string | null;
|
|
644
|
+
};
|
|
645
|
+
export type RunEvent = {
|
|
646
|
+
readonly kind: 'run';
|
|
647
|
+
readonly run: HeardRun;
|
|
648
|
+
readonly listing: string | null;
|
|
649
|
+
} | {
|
|
650
|
+
readonly kind: 'removed';
|
|
651
|
+
readonly room: string;
|
|
652
|
+
readonly name: string;
|
|
653
|
+
} | {
|
|
654
|
+
readonly kind: 'runs';
|
|
655
|
+
readonly listing: string | null;
|
|
656
|
+
readonly runs: readonly HeardRun[];
|
|
657
|
+
readonly whole: boolean;
|
|
658
|
+
readonly more: boolean;
|
|
659
|
+
readonly mark: string;
|
|
660
|
+
};
|
|
661
|
+
export type RunMarks = {
|
|
662
|
+
readonly rooms: Readonly<Record<string, string>>;
|
|
663
|
+
readonly sent: string | null;
|
|
664
|
+
};
|
|
665
|
+
export type RunStream = {
|
|
666
|
+
hold(marks: RunMarks): void;
|
|
667
|
+
observe(notify: (event: RunEvent) => void): () => void;
|
|
668
|
+
};
|
|
512
669
|
export type RoomStream = {
|
|
513
670
|
hold(rooms: readonly HeldRoom[]): void;
|
|
514
671
|
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
@@ -521,21 +678,26 @@ export type Adapter = {
|
|
|
521
678
|
readonly pathRule?: PathRule;
|
|
522
679
|
readonly unkeptReads?: readonly string[];
|
|
523
680
|
readonly leadingReads?: readonly string[];
|
|
681
|
+
readonly renamedActions?: ReadonlyMap<string, string>;
|
|
682
|
+
readonly rewrittenInputs?: ReadonlyMap<string, (input: unknown) => unknown>;
|
|
683
|
+
readonly keptInput?: (input: unknown) => unknown;
|
|
524
684
|
authorize(): Promise<Authorization>;
|
|
525
685
|
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
526
686
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
527
687
|
refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
528
688
|
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
529
689
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
530
|
-
binary(authorization: Authorization, request:
|
|
531
|
-
link(authorization: Authorization, request:
|
|
690
|
+
binary(authorization: Authorization, request: AttachmentRequest): Promise<AttachmentResult>;
|
|
691
|
+
link(authorization: Authorization, request: AttachmentRequest | KeyedRequest): Promise<AttachmentLinkResult>;
|
|
532
692
|
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
533
693
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
534
694
|
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
695
|
+
queryHouse?(authorization: Authorization, request: HouseQueryAsk): Promise<HouseQueryAnswer>;
|
|
535
696
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
536
697
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
537
698
|
roomStream?: RoomStream;
|
|
538
699
|
conversations?: ConversationStream;
|
|
700
|
+
runs?: RunStream;
|
|
539
701
|
serviceMode?: ServiceModeSignal;
|
|
540
702
|
};
|
|
541
703
|
//# sourceMappingURL=adapter.d.ts.map
|