@agentshouse/mdruntime 0.1.0-cae97ad2e9142 → 0.1.0-caf080a9a9c60
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 +14 -14
- package/dist/acceptance.d.ts +3 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +318 -0
- package/dist/act-lanes.d.ts +29 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +177 -0
- package/dist/actions.d.ts +25 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +261 -0
- package/dist/adapter.d.ts +126 -107
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +29 -47
- package/dist/bootstrap.d.ts +17 -19
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +266 -135
- package/dist/cell.d.ts +6 -0
- package/dist/cell.d.ts.map +1 -0
- package/dist/cell.js +9 -0
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/change-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -0
- package/dist/change.d.ts +1 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +4 -2
- package/dist/chat-types.d.ts +5 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +13 -0
- package/dist/client.d.ts +28 -18
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +84 -20
- package/dist/collection.d.ts +28 -7
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +35 -19
- package/dist/compile.d.ts +8 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +289 -332
- package/dist/connection.d.ts +6 -141
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +111 -5012
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-live.d.ts +138 -0
- package/dist/conversation-live.d.ts.map +1 -0
- package/dist/conversation-live.js +249 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +53 -0
- package/dist/conversation.d.ts +59 -50
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +938 -832
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts +10 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +153 -0
- package/dist/durability.d.ts +18 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +3 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +19 -9
- package/dist/expectation.d.ts +26 -13
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +72 -19
- package/dist/failure.d.ts +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -0
- package/dist/figures.d.ts +49 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/holdings.d.ts +29 -0
- package/dist/holdings.d.ts.map +1 -0
- package/dist/holdings.js +95 -0
- package/dist/host.d.ts +20 -8
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +70 -40
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +33 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/install.d.ts +54 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +539 -0
- package/dist/lifecycle.d.ts +7 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +279 -0
- package/dist/listing.d.ts +48 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +139 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +64 -23
- package/dist/locks.d.ts +7 -0
- package/dist/locks.d.ts.map +1 -0
- package/dist/locks.js +33 -0
- package/dist/log.d.ts +1 -0
- package/dist/log.d.ts.map +1 -1
- package/dist/lost.d.ts +5 -0
- package/dist/lost.d.ts.map +1 -0
- package/dist/lost.js +50 -0
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +15 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +251 -98
- package/dist/messages.d.ts +24 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +92 -32
- package/dist/model.d.ts +8 -11
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +5 -22
- package/dist/models.d.ts +10 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +156 -0
- package/dist/observation.d.ts +3 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +15 -15
- package/dist/opened.d.ts +1 -1
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +5 -5
- package/dist/opening.d.ts +4 -0
- package/dist/opening.d.ts.map +1 -0
- package/dist/opening.js +59 -0
- package/dist/outcome.d.ts +20 -6
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +34 -2
- package/dist/overlay.d.ts +6 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +47 -21
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +3 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +10 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +26 -0
- package/dist/preparation.d.ts +20 -0
- package/dist/preparation.d.ts.map +1 -0
- package/dist/preparation.js +233 -0
- package/dist/presence.d.ts +52 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +220 -0
- package/dist/queries.d.ts +16 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +285 -0
- package/dist/query.d.ts +14 -210
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/questions.d.ts +29 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +115 -0
- package/dist/queue.d.ts +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +465 -0
- package/dist/reach.d.ts +15 -12
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +228 -145
- package/dist/react.d.ts +15 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +33 -1
- package/dist/read.d.ts +7 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +17 -0
- package/dist/readiness.d.ts +3 -18
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +4 -10
- package/dist/reads.d.ts +38 -10
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +163 -85
- package/dist/recovery.d.ts +3 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +57 -1
- package/dist/refresh.d.ts +7 -5
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +35 -7
- package/dist/refusal.d.ts +5 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +57 -0
- package/dist/replica.d.ts +13 -19
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +66 -35
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +24 -10
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +142 -106
- package/dist/room-drafts.d.ts +24 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +217 -0
- package/dist/rows.d.ts +16 -21
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +46 -174
- package/dist/runtime.d.ts +36 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts +42 -84
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +349 -170
- package/dist/saves.d.ts +32 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +413 -0
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/seed.d.ts +11 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +71 -1
- package/dist/shared.d.ts +1 -7
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +13 -105
- package/dist/shown.d.ts +32 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +290 -0
- package/dist/socket/admission.d.ts +7 -0
- package/dist/socket/admission.d.ts.map +1 -0
- package/dist/socket/admission.js +39 -0
- package/dist/socket/answers.d.ts +6 -0
- package/dist/socket/answers.d.ts.map +1 -0
- package/dist/socket/answers.js +20 -0
- package/dist/socket/lanes.d.ts +21 -0
- package/dist/socket/lanes.d.ts.map +1 -0
- package/dist/socket/lanes.js +80 -0
- package/dist/socket/reads.d.ts +10 -0
- package/dist/socket/reads.d.ts.map +1 -0
- package/dist/socket/reads.js +31 -0
- package/dist/socket/session.d.ts +38 -0
- package/dist/socket/session.d.ts.map +1 -0
- package/dist/socket/session.js +23 -0
- package/dist/socket.d.ts +68 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +171 -0
- package/dist/source.d.ts +54 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +82 -0
- package/dist/status.d.ts +4 -5
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -7
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +34 -0
- package/dist/store/readiness.d.ts +10 -0
- package/dist/store/readiness.d.ts.map +1 -0
- package/dist/store/readiness.js +52 -0
- package/dist/store/records.d.ts +212 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +430 -0
- package/dist/store/room-held.d.ts +8 -0
- package/dist/store/room-held.d.ts.map +1 -0
- package/dist/store/room-held.js +17 -0
- package/dist/store/space.d.ts +11 -0
- package/dist/store/space.d.ts.map +1 -0
- package/dist/store/space.js +41 -0
- package/dist/store/watchers.d.ts +17 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +56 -0
- package/dist/store/writes.d.ts +24 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +125 -0
- package/dist/store.d.ts +110 -158
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +167 -403
- package/dist/stored.d.ts +65 -59
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +356 -271
- package/dist/surface.d.ts +88 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +223 -0
- package/dist/sync.d.ts +19 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +540 -0
- package/dist/tables.d.ts +127 -69
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +218 -105
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +42 -100
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +63 -11
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +21 -5
- package/package.json +3 -2
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- package/dist/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -368
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -150
package/dist/actions.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { roomTarget, target } from '@agentshouse/mdmodel';
|
|
2
|
+
import { CATCHING_UP, resendConversations } from './conversation.js';
|
|
3
|
+
import { listingNow } from './listing.js';
|
|
4
|
+
import { locked, lockedRooms } from './locks.js';
|
|
5
|
+
import { scoped } from './models.js';
|
|
6
|
+
import { ABSENT_TARGET, failure, historyAnswer, LOCKED_UNREADABLE, lockedRoom, handedOutcome, UNANSWERED, undeclared, UNCERTAIN, UNREADABLE, } from './outcome.js';
|
|
7
|
+
import { refuse } from './refusal.js';
|
|
8
|
+
function operationOf(input) {
|
|
9
|
+
const operation = input?.operation_id;
|
|
10
|
+
return typeof operation === 'string' ? operation : null;
|
|
11
|
+
}
|
|
12
|
+
export async function readHistory(runtime, locator, path, query = {}) {
|
|
13
|
+
const { store, socket, presence, journal } = runtime;
|
|
14
|
+
const { session } = socket;
|
|
15
|
+
if (socket.closed() || session.now().refusal !== null)
|
|
16
|
+
return UNCERTAIN;
|
|
17
|
+
await socket.firstDiscovery;
|
|
18
|
+
if (!session.now().roomsNamed)
|
|
19
|
+
return UNCERTAIN;
|
|
20
|
+
try {
|
|
21
|
+
await socket.authorize();
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return UNCERTAIN;
|
|
25
|
+
}
|
|
26
|
+
const { closed, authorization, refusal } = session.now();
|
|
27
|
+
if (closed || authorization === undefined || refusal !== null)
|
|
28
|
+
return UNCERTAIN;
|
|
29
|
+
const since = presence.losses();
|
|
30
|
+
const transfer = ['transfer', 'history', locator, path];
|
|
31
|
+
if (query.revision !== undefined)
|
|
32
|
+
transfer.push(query.revision);
|
|
33
|
+
if (query.pageToken !== undefined)
|
|
34
|
+
transfer.push(query.pageToken);
|
|
35
|
+
journal.record(transfer.join(' '));
|
|
36
|
+
try {
|
|
37
|
+
const result = await socket.history(authorization, {
|
|
38
|
+
locator,
|
|
39
|
+
path,
|
|
40
|
+
...(query.revision === undefined ? {} : { revision: query.revision }),
|
|
41
|
+
...(query.pageToken === undefined ? {} : { pageToken: query.pageToken }),
|
|
42
|
+
});
|
|
43
|
+
journal.record(`outcome history ${result.kind}`);
|
|
44
|
+
if (presence.lostSince(locator, since))
|
|
45
|
+
return failure({ kind: 'room-not-readable', locator });
|
|
46
|
+
if (result.kind === 'scoped-refusal') {
|
|
47
|
+
const room = await store.record(result.locator);
|
|
48
|
+
if (room !== undefined)
|
|
49
|
+
await scoped(runtime, result, room.locator, room.declaration);
|
|
50
|
+
}
|
|
51
|
+
if (result.kind === 'revoked-authorization')
|
|
52
|
+
await refuse(runtime, 'revoked-authorization');
|
|
53
|
+
return historyAnswer(result);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
journal.record('outcome history transport-uncertainty');
|
|
57
|
+
return UNCERTAIN;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export async function located(runtime, room, path, destination) {
|
|
61
|
+
const crossing = roomTarget(destination);
|
|
62
|
+
const listing = await listingNow(runtime);
|
|
63
|
+
if (crossing === null) {
|
|
64
|
+
const named = target(path, destination);
|
|
65
|
+
return named === null || !listing.has(room) ? null : { room, path: named };
|
|
66
|
+
}
|
|
67
|
+
const held = [...listing.values()].find((listed) => listed.handle === crossing.handle);
|
|
68
|
+
return held === undefined ? null : { room: held.locator, path: crossing.path };
|
|
69
|
+
}
|
|
70
|
+
export async function resolveReference(runtime, room, path, destination) {
|
|
71
|
+
const { store } = runtime;
|
|
72
|
+
if (roomTarget(destination) === null && target(path, destination) === null) {
|
|
73
|
+
return ABSENT_TARGET;
|
|
74
|
+
}
|
|
75
|
+
const at = await located(runtime, room, path, destination);
|
|
76
|
+
if (at === null)
|
|
77
|
+
return UNREADABLE;
|
|
78
|
+
if (await locked(runtime, at.room))
|
|
79
|
+
return LOCKED_UNREADABLE;
|
|
80
|
+
const held = await store.record(at.room);
|
|
81
|
+
if (held !== undefined &&
|
|
82
|
+
(await (await store.open()).entries(held.key, 'visible', [at.path])).length > 0) {
|
|
83
|
+
return { kind: 'document', ...at };
|
|
84
|
+
}
|
|
85
|
+
const history = await readHistory(runtime, at.room, at.path);
|
|
86
|
+
if (history.kind === 'no-history' || history.kind === 'revision')
|
|
87
|
+
return ABSENT_TARGET;
|
|
88
|
+
if (history.kind !== 'history')
|
|
89
|
+
return history;
|
|
90
|
+
const [last] = history.revisions;
|
|
91
|
+
if (last === undefined)
|
|
92
|
+
return ABSENT_TARGET;
|
|
93
|
+
return history.deleted === true
|
|
94
|
+
? { kind: 'deleted', ...at, revision: last }
|
|
95
|
+
: { kind: 'document', ...at };
|
|
96
|
+
}
|
|
97
|
+
async function declaredAction({ store }, name) {
|
|
98
|
+
for (const capability of (await (await store.open()).facts()).capabilities) {
|
|
99
|
+
for (const action of capability.actions ?? []) {
|
|
100
|
+
if (action.name === name)
|
|
101
|
+
return action;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
async function calledRooms(runtime, name, input) {
|
|
107
|
+
const member = (await declaredAction(runtime, name))?.room;
|
|
108
|
+
if (member === undefined || input === null || typeof input !== 'object')
|
|
109
|
+
return [];
|
|
110
|
+
const named = input[member];
|
|
111
|
+
return (Array.isArray(named) ? named : [named]).filter((room) => typeof room === 'string');
|
|
112
|
+
}
|
|
113
|
+
export async function invokeAction(runtime, name, input, { dispatching, attempt } = {}) {
|
|
114
|
+
const { store, socket, journal, retries } = runtime;
|
|
115
|
+
const { session } = socket;
|
|
116
|
+
await socket.ready;
|
|
117
|
+
if (socket.closed() || session.now().refusal !== null) {
|
|
118
|
+
return handedOutcome(retries, attempt, UNANSWERED);
|
|
119
|
+
}
|
|
120
|
+
if ((await declaredAction(runtime, name)) === undefined)
|
|
121
|
+
return undeclared(name);
|
|
122
|
+
try {
|
|
123
|
+
await socket.authorize();
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return handedOutcome(retries, attempt, UNANSWERED);
|
|
127
|
+
}
|
|
128
|
+
const { closed, authorization, refusal } = session.now();
|
|
129
|
+
if (closed || authorization === undefined || refusal !== null) {
|
|
130
|
+
return handedOutcome(retries, attempt, UNANSWERED);
|
|
131
|
+
}
|
|
132
|
+
await dispatching?.();
|
|
133
|
+
journal.record(`transfer action ${name}`);
|
|
134
|
+
try {
|
|
135
|
+
const result = await socket.action(authorization, { name, input });
|
|
136
|
+
if (result.kind === 'scoped-refusal') {
|
|
137
|
+
const room = await store.record(result.locator);
|
|
138
|
+
if (room !== undefined)
|
|
139
|
+
await scoped(runtime, result, room.locator, room.declaration);
|
|
140
|
+
}
|
|
141
|
+
if (result.kind === 'revoked-authorization')
|
|
142
|
+
await refuse(runtime, 'revoked-authorization');
|
|
143
|
+
journal.record(`outcome action ${result.kind}`);
|
|
144
|
+
if (result.kind === 'rejected')
|
|
145
|
+
journal.record(`refusal rejected ${result.code}`);
|
|
146
|
+
return handedOutcome(retries, attempt, result);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
journal.record('outcome action transport-uncertainty');
|
|
150
|
+
return handedOutcome(retries, attempt, { kind: 'transport-uncertainty', failure: error });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export async function readConversationHistory(runtime, request) {
|
|
154
|
+
const { socket, journal, retries } = runtime;
|
|
155
|
+
const caught = { step: 'conversations', instance: CATCHING_UP };
|
|
156
|
+
await socket.ready;
|
|
157
|
+
const stream = socket.conversations();
|
|
158
|
+
if (socket.closed() || socket.session.now().refusal !== null || stream?.history === undefined) {
|
|
159
|
+
return handedOutcome(retries, caught, UNANSWERED);
|
|
160
|
+
}
|
|
161
|
+
journal.record('transfer conversation history');
|
|
162
|
+
try {
|
|
163
|
+
const result = await stream.history(request);
|
|
164
|
+
if (result.kind === 'revoked-authorization')
|
|
165
|
+
await refuse(runtime, 'revoked-authorization');
|
|
166
|
+
journal.record(`outcome conversation history ${result.kind}`);
|
|
167
|
+
return handedOutcome(retries, caught, result);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
journal.record('outcome conversation history transport-uncertainty');
|
|
171
|
+
return handedOutcome(retries, caught, { kind: 'transport-uncertainty', failure: error });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function unsettled(result) {
|
|
175
|
+
if (result.kind === 'action')
|
|
176
|
+
return false;
|
|
177
|
+
return result.retryable && (result.kind !== 'rejected' || result.reset === undefined);
|
|
178
|
+
}
|
|
179
|
+
function numberedCall(runtime, name, input, operation, dispatching) {
|
|
180
|
+
return invokeAction(runtime, name, input, {
|
|
181
|
+
dispatching,
|
|
182
|
+
attempt: { step: 'sending', instance: `action ${operation}` },
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
async function recoveredAction(runtime, name, input, attempt) {
|
|
186
|
+
const { store, socket, recovery } = runtime;
|
|
187
|
+
const { lanes } = socket;
|
|
188
|
+
const operation = operationOf(input);
|
|
189
|
+
if (operation === null)
|
|
190
|
+
return invokeAction(runtime, name, input, { attempt });
|
|
191
|
+
const dispatching = async () => (await store.open()).keepCall({ operation, name, input });
|
|
192
|
+
lanes.call(operation);
|
|
193
|
+
try {
|
|
194
|
+
let result = await numberedCall(runtime, name, input, operation, dispatching);
|
|
195
|
+
if (unsettled(result)) {
|
|
196
|
+
await recovery.attempt(`action ${operation}`, async () => {
|
|
197
|
+
if (socket.closed() || socket.session.now().refusal !== null)
|
|
198
|
+
return 'done';
|
|
199
|
+
if (!socket.isOpen())
|
|
200
|
+
return 'again';
|
|
201
|
+
result = await numberedCall(runtime, name, input, operation, dispatching);
|
|
202
|
+
return unsettled(result) ? 'again' : 'done';
|
|
203
|
+
}, { again: true });
|
|
204
|
+
}
|
|
205
|
+
if (!unsettled(result))
|
|
206
|
+
await (await store.open()).dropCall(operation);
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
finally {
|
|
210
|
+
lanes.called(operation);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
export async function called(runtime, name, input, attempt) {
|
|
214
|
+
await runtime.socket.ready;
|
|
215
|
+
const lockedNow = await lockedRooms(runtime);
|
|
216
|
+
const room = (await calledRooms(runtime, name, input)).find((one) => lockedNow.includes(one));
|
|
217
|
+
return room === undefined ? recoveredAction(runtime, name, input, attempt) : lockedRoom(room);
|
|
218
|
+
}
|
|
219
|
+
export async function resendCalls(runtime, signal) {
|
|
220
|
+
const { store, socket } = runtime;
|
|
221
|
+
const { lanes } = socket;
|
|
222
|
+
if (!socket.isOpen() || socket.closed() || socket.stopping())
|
|
223
|
+
return 'done';
|
|
224
|
+
const local = await store.open();
|
|
225
|
+
for (const held of await local.calls()) {
|
|
226
|
+
if (lanes.calling(held.operation))
|
|
227
|
+
continue;
|
|
228
|
+
if (socket.closed() || signal.aborted)
|
|
229
|
+
return 'done';
|
|
230
|
+
lanes.call(held.operation);
|
|
231
|
+
try {
|
|
232
|
+
if (unsettled(await numberedCall(runtime, held.name, held.input, held.operation))) {
|
|
233
|
+
return 'again';
|
|
234
|
+
}
|
|
235
|
+
await local.dropCall(held.operation);
|
|
236
|
+
}
|
|
237
|
+
finally {
|
|
238
|
+
lanes.called(held.operation);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return 'done';
|
|
242
|
+
}
|
|
243
|
+
async function resendPass({ socket, conversations }, signal) {
|
|
244
|
+
if (!socket.continuing() || !socket.isOpen() || socket.stopping())
|
|
245
|
+
return 'done';
|
|
246
|
+
const reading = { complete: true, reachable: true };
|
|
247
|
+
try {
|
|
248
|
+
await resendConversations(conversations, reading);
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
reading.reachable = false;
|
|
252
|
+
}
|
|
253
|
+
if (signal.aborted)
|
|
254
|
+
return 'done';
|
|
255
|
+
return reading.reachable && reading.complete ? 'done' : 'again';
|
|
256
|
+
}
|
|
257
|
+
export function resendLater(runtime) {
|
|
258
|
+
if (!runtime.socket.isOpen())
|
|
259
|
+
return;
|
|
260
|
+
void runtime.recovery.attempt('resend', (signal) => resendPass(runtime, signal), { again: true });
|
|
261
|
+
}
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { SavedFacts, TypedPath } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { Operation, SessionState } from '@agentshouse/session-content';
|
|
1
3
|
import type { ModelResult } from './model.js';
|
|
4
|
+
export type { SavedFacts, TypedPath };
|
|
2
5
|
import type { Open } from './open.js';
|
|
3
6
|
import type { ChangeBatch } from './change.js';
|
|
4
7
|
export type Authorization = object;
|
|
@@ -11,46 +14,45 @@ export type TypedSelection = {
|
|
|
11
14
|
};
|
|
12
15
|
export type OperationScopes = {
|
|
13
16
|
write: readonly string[];
|
|
14
|
-
|
|
17
|
+
erase: readonly string[];
|
|
15
18
|
};
|
|
16
19
|
export type ReplicaAdmission = {
|
|
17
20
|
selection: string;
|
|
18
21
|
admission: Open<'admitted' | 'unavailable'>;
|
|
19
22
|
offline: Open<'locked' | 'open'>;
|
|
20
23
|
};
|
|
21
|
-
export type
|
|
22
|
-
name: string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
export type RoomDeclaration = {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly handle: string;
|
|
27
|
+
readonly operations: OperationScopes;
|
|
28
|
+
readonly replica: ReplicaAdmission;
|
|
29
|
+
readonly typedSelection: TypedSelection | null;
|
|
30
|
+
readonly providerOwnedPaths: readonly string[];
|
|
31
|
+
readonly authoredPaths: readonly string[];
|
|
32
|
+
};
|
|
33
|
+
export type DiscoveredRoom = RoomDeclaration & {
|
|
34
|
+
readonly locator: string;
|
|
35
|
+
readonly roomVersion: string;
|
|
30
36
|
};
|
|
31
37
|
export type Capability = {
|
|
32
38
|
name: string;
|
|
33
39
|
limits?: readonly ProviderLimit[];
|
|
34
40
|
actions?: readonly ActionDeclaration[];
|
|
35
|
-
conversationAgents?: ConversationAgents;
|
|
36
|
-
};
|
|
37
|
-
export type ConversationAgents = {
|
|
38
|
-
locator: string;
|
|
39
|
-
type: string;
|
|
40
|
-
identity: string;
|
|
41
|
-
name: string;
|
|
42
|
-
retired?: string;
|
|
43
41
|
};
|
|
44
42
|
export type ListedConversation = {
|
|
45
43
|
conversation: string;
|
|
46
44
|
agent: string;
|
|
45
|
+
agentName: string;
|
|
46
|
+
agentRetired: boolean;
|
|
47
47
|
name: string;
|
|
48
48
|
created: string;
|
|
49
49
|
finished: string | null;
|
|
50
50
|
outcome: string | null;
|
|
51
51
|
waiting: boolean;
|
|
52
|
+
newest: string | null;
|
|
53
|
+
processEnded: string | null;
|
|
52
54
|
};
|
|
53
|
-
export type ConversationAction = '
|
|
55
|
+
export type ConversationAction = 'conversations/create' | 'conversations/send' | 'conversations/interaction/answer' | 'conversations/interrupt' | 'conversations/kill' | 'conversations/delete' | 'conversations/take-out' | 'conversations/rename' | 'conversations/option/set' | 'conversations/retry' | 'agent-functions/decide';
|
|
54
56
|
export type ConversationMessage = {
|
|
55
57
|
identity: string;
|
|
56
58
|
turn: string;
|
|
@@ -59,6 +61,7 @@ export type ConversationMessage = {
|
|
|
59
61
|
};
|
|
60
62
|
export type AcceptedMessage = ConversationMessage & {
|
|
61
63
|
position: string;
|
|
64
|
+
change: string;
|
|
62
65
|
};
|
|
63
66
|
export type ConversationHistoryRequest = {
|
|
64
67
|
conversations: readonly {
|
|
@@ -74,37 +77,10 @@ export type ConversationHistoryPage = {
|
|
|
74
77
|
export type ConversationHistories = {
|
|
75
78
|
histories: readonly ConversationHistoryPage[];
|
|
76
79
|
};
|
|
77
|
-
export type TurnContext = {
|
|
78
|
-
used: number;
|
|
79
|
-
window: number;
|
|
80
|
-
};
|
|
81
80
|
export type TurnOperation = {
|
|
82
81
|
op: 'begin';
|
|
83
82
|
at: string;
|
|
84
|
-
} |
|
|
85
|
-
op: 'start';
|
|
86
|
-
index: number;
|
|
87
|
-
part: unknown;
|
|
88
|
-
} | {
|
|
89
|
-
op: 'append';
|
|
90
|
-
index: number;
|
|
91
|
-
text: string;
|
|
92
|
-
} | {
|
|
93
|
-
op: 'status';
|
|
94
|
-
index: number;
|
|
95
|
-
status: string;
|
|
96
|
-
result: unknown;
|
|
97
|
-
} | {
|
|
98
|
-
op: 'count';
|
|
99
|
-
index: number;
|
|
100
|
-
count: number;
|
|
101
|
-
} | {
|
|
102
|
-
op: 'plan';
|
|
103
|
-
index: number;
|
|
104
|
-
entries: readonly unknown[];
|
|
105
|
-
} | ({
|
|
106
|
-
op: 'context';
|
|
107
|
-
} & TurnContext);
|
|
83
|
+
} | Operation;
|
|
108
84
|
export type ProcessCommand = {
|
|
109
85
|
[field: string]: unknown;
|
|
110
86
|
name: string;
|
|
@@ -166,6 +142,10 @@ export type ConversationEvent = {
|
|
|
166
142
|
kind: 'starting';
|
|
167
143
|
conversation: string;
|
|
168
144
|
step: string | null;
|
|
145
|
+
} | {
|
|
146
|
+
kind: 'state';
|
|
147
|
+
conversation: string;
|
|
148
|
+
state: SessionState | null;
|
|
169
149
|
} | {
|
|
170
150
|
kind: 'link';
|
|
171
151
|
conversation: string;
|
|
@@ -173,6 +153,7 @@ export type ConversationEvent = {
|
|
|
173
153
|
} | {
|
|
174
154
|
kind: 'deliveries';
|
|
175
155
|
conversation: string;
|
|
156
|
+
waiting: readonly string[];
|
|
176
157
|
unknown: readonly string[];
|
|
177
158
|
} | {
|
|
178
159
|
kind: 'accepted-message';
|
|
@@ -184,6 +165,9 @@ export type ConversationEvent = {
|
|
|
184
165
|
} | {
|
|
185
166
|
kind: 'list';
|
|
186
167
|
entries: readonly ListedConversation[];
|
|
168
|
+
whole: boolean;
|
|
169
|
+
more: boolean;
|
|
170
|
+
cursor: string | null;
|
|
187
171
|
} | {
|
|
188
172
|
kind: 'listed';
|
|
189
173
|
entry: ListedConversation;
|
|
@@ -191,9 +175,24 @@ export type ConversationEvent = {
|
|
|
191
175
|
kind: 'unlisted';
|
|
192
176
|
conversation: string;
|
|
193
177
|
};
|
|
178
|
+
export type AgentEnvironment = {
|
|
179
|
+
identity: string;
|
|
180
|
+
name: string;
|
|
181
|
+
state: 'online' | 'offline';
|
|
182
|
+
};
|
|
183
|
+
export type ListedAgent = {
|
|
184
|
+
agent: string;
|
|
185
|
+
name: string;
|
|
186
|
+
retired: boolean;
|
|
187
|
+
cli: string;
|
|
188
|
+
environment: AgentEnvironment;
|
|
189
|
+
};
|
|
194
190
|
export type ConversationStream = {
|
|
195
191
|
replicate(conversations: readonly string[]): void;
|
|
192
|
+
hold(cursor: string | null): void;
|
|
196
193
|
observe(notify: (event: ConversationEvent) => void): () => void;
|
|
194
|
+
agents?(): Promise<readonly ListedAgent[] | null>;
|
|
195
|
+
history?(request: ConversationHistoryRequest): Promise<ActionResult>;
|
|
197
196
|
};
|
|
198
197
|
export type ActionDeclaration = {
|
|
199
198
|
name: string;
|
|
@@ -213,7 +212,6 @@ export type HistoryRetention = {
|
|
|
213
212
|
};
|
|
214
213
|
export type Retention = {
|
|
215
214
|
history: HistoryRetention;
|
|
216
|
-
outcome: number;
|
|
217
215
|
refreshHorizon: number;
|
|
218
216
|
};
|
|
219
217
|
export type Discovery = {
|
|
@@ -223,13 +221,10 @@ export type Discovery = {
|
|
|
223
221
|
providerLimits: readonly ProviderLimit[];
|
|
224
222
|
retention: Retention;
|
|
225
223
|
member?: Member;
|
|
226
|
-
covered?: readonly string[];
|
|
227
|
-
};
|
|
228
|
-
export type DiscoveryScope = {
|
|
229
|
-
readonly authorities: readonly string[];
|
|
230
224
|
};
|
|
231
225
|
export type TransportUncertainty = {
|
|
232
226
|
kind: 'transport-uncertainty';
|
|
227
|
+
failure?: unknown;
|
|
233
228
|
};
|
|
234
229
|
export type RoomNotReadable = {
|
|
235
230
|
kind: 'room-not-readable';
|
|
@@ -255,7 +250,7 @@ export type ContractUnavailable = ProviderRefusal & {
|
|
|
255
250
|
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
256
251
|
export type PageToken = string;
|
|
257
252
|
export type ChangeAuthor = {
|
|
258
|
-
kind: Open<'user' | 'site' | 'inbox'>;
|
|
253
|
+
kind: Open<'user' | 'site' | 'inbox' | 'app'>;
|
|
259
254
|
id: string;
|
|
260
255
|
name: string;
|
|
261
256
|
};
|
|
@@ -273,27 +268,18 @@ export type BinaryFile = {
|
|
|
273
268
|
mediaType: string;
|
|
274
269
|
sha256: string;
|
|
275
270
|
};
|
|
276
|
-
export type HeldFile = {
|
|
277
|
-
readonly path: string;
|
|
278
|
-
readonly revision: string;
|
|
279
|
-
};
|
|
280
|
-
export type HeldContent = {
|
|
281
|
-
files(after: string | null, limit: number): Promise<readonly HeldFile[]>;
|
|
282
|
-
contents(paths: readonly string[]): Promise<ReadonlyMap<string, {
|
|
283
|
-
readonly content: string;
|
|
284
|
-
readonly revision: string;
|
|
285
|
-
}>>;
|
|
286
|
-
};
|
|
287
271
|
export type BootstrapRequest = {
|
|
288
272
|
locator: string;
|
|
289
273
|
selection: string;
|
|
290
274
|
pageToken?: PageToken;
|
|
291
|
-
held?: HeldContent;
|
|
292
|
-
received?: Uint8Array;
|
|
293
275
|
arriving?: (bytes: number) => void;
|
|
276
|
+
signal?: AbortSignal;
|
|
277
|
+
};
|
|
278
|
+
export type BootstrapPart = {
|
|
279
|
+
readonly id: string;
|
|
280
|
+
readonly bytes: number;
|
|
294
281
|
};
|
|
295
282
|
export type BootstrapInventory = {
|
|
296
|
-
readonly parts: number;
|
|
297
283
|
readonly bytes: number;
|
|
298
284
|
};
|
|
299
285
|
export type RoomModels = {
|
|
@@ -304,18 +290,23 @@ export type BootstrapPage = {
|
|
|
304
290
|
roomVersion: string;
|
|
305
291
|
models?: RoomModels;
|
|
306
292
|
documents: Readonly<Record<string, string>>;
|
|
293
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
307
294
|
revisions: Readonly<Record<string, string>>;
|
|
308
295
|
fileIds?: Readonly<Record<string, string>>;
|
|
296
|
+
created?: Readonly<Record<string, string>>;
|
|
309
297
|
changes: Readonly<Record<string, HeadChange>>;
|
|
310
298
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
311
299
|
folders?: readonly string[];
|
|
312
300
|
pageToken?: PageToken;
|
|
313
|
-
|
|
314
|
-
|
|
301
|
+
parts?: readonly BootstrapPart[];
|
|
302
|
+
bytes?: number;
|
|
303
|
+
};
|
|
304
|
+
export type NotReady = {
|
|
305
|
+
kind: 'not-ready';
|
|
315
306
|
};
|
|
316
307
|
export type BootstrapResult = BootstrapPage | {
|
|
317
308
|
kind: 'beyond-horizon';
|
|
318
|
-
} | AdapterFailure;
|
|
309
|
+
} | NotReady | AdapterFailure;
|
|
319
310
|
export type RefreshRequest = {
|
|
320
311
|
locator: string;
|
|
321
312
|
selection: string;
|
|
@@ -327,8 +318,10 @@ export type RefreshPage = {
|
|
|
327
318
|
roomVersion: string;
|
|
328
319
|
models?: RoomModels;
|
|
329
320
|
documents: Readonly<Record<string, string>>;
|
|
321
|
+
facts: Readonly<Record<string, SavedFacts>>;
|
|
330
322
|
revisions: Readonly<Record<string, string>>;
|
|
331
323
|
fileIds?: Readonly<Record<string, string>>;
|
|
324
|
+
created?: Readonly<Record<string, string>>;
|
|
332
325
|
changes: Readonly<Record<string, HeadChange>>;
|
|
333
326
|
binaryFiles: Readonly<Record<string, BinaryFile>>;
|
|
334
327
|
removals: readonly string[];
|
|
@@ -378,15 +371,9 @@ export type MutationResult = (AcceptedRoom & {
|
|
|
378
371
|
affected: Readonly<Record<string, string>>;
|
|
379
372
|
}) | RetryableRefusal | {
|
|
380
373
|
kind: 'write-halted';
|
|
381
|
-
} | {
|
|
382
|
-
kind: 'expired';
|
|
383
|
-
restored?: true;
|
|
384
374
|
} | AdapterFailure;
|
|
385
375
|
export type HistoryAuthor = {
|
|
386
|
-
kind: 'user';
|
|
387
|
-
id: string;
|
|
388
|
-
} | {
|
|
389
|
-
kind: 'site' | 'inbox';
|
|
376
|
+
kind: 'user' | 'site' | 'inbox' | 'app';
|
|
390
377
|
id: string;
|
|
391
378
|
name: string;
|
|
392
379
|
};
|
|
@@ -431,6 +418,22 @@ export type BinaryLinkResult = {
|
|
|
431
418
|
kind: 'link';
|
|
432
419
|
url: string;
|
|
433
420
|
name: string;
|
|
421
|
+
mediaType?: string;
|
|
422
|
+
} | (ProviderRefusal & {
|
|
423
|
+
kind: 'rejected';
|
|
424
|
+
}) | AdapterFailure;
|
|
425
|
+
export type AttachRequest = {
|
|
426
|
+
locator: string;
|
|
427
|
+
name: string;
|
|
428
|
+
mediaType: string;
|
|
429
|
+
byteLength: number;
|
|
430
|
+
sha256: string;
|
|
431
|
+
blob: Blob;
|
|
432
|
+
};
|
|
433
|
+
export type AttachResult = {
|
|
434
|
+
kind: 'attached';
|
|
435
|
+
path: string;
|
|
436
|
+
revision: string;
|
|
434
437
|
} | (ProviderRefusal & {
|
|
435
438
|
kind: 'rejected';
|
|
436
439
|
}) | AdapterFailure;
|
|
@@ -446,69 +449,85 @@ export type ActionResult = {
|
|
|
446
449
|
kind: 'action';
|
|
447
450
|
result: unknown;
|
|
448
451
|
at?: RoomVersionAt;
|
|
452
|
+
} | (ProviderRefusal & {
|
|
453
|
+
kind: 'rejected';
|
|
454
|
+
reset?: string;
|
|
455
|
+
}) | AdapterFailure;
|
|
456
|
+
export type SearchHit = {
|
|
457
|
+
room: string;
|
|
458
|
+
path: string;
|
|
459
|
+
line?: number;
|
|
460
|
+
snippet?: string;
|
|
461
|
+
};
|
|
462
|
+
export type SearchAsk = {
|
|
463
|
+
text: string;
|
|
464
|
+
rooms: readonly string[] | null;
|
|
465
|
+
};
|
|
466
|
+
export type SearchAnswer = {
|
|
467
|
+
kind: 'found';
|
|
468
|
+
documents: readonly SearchHit[];
|
|
449
469
|
} | (ProviderRefusal & {
|
|
450
470
|
kind: 'rejected';
|
|
451
471
|
}) | AdapterFailure;
|
|
452
472
|
export type HeldRoom = {
|
|
453
473
|
locator: string;
|
|
474
|
+
roomVersion: string | null;
|
|
475
|
+
};
|
|
476
|
+
export type RoomChange = {
|
|
477
|
+
kind: 'room-change';
|
|
478
|
+
locator: string;
|
|
479
|
+
from: string | null;
|
|
454
480
|
roomVersion: string;
|
|
481
|
+
read(): Promise<RefreshPage>;
|
|
482
|
+
};
|
|
483
|
+
export type AuthorityChange = {
|
|
484
|
+
kind: 'authority-changed';
|
|
485
|
+
rooms: readonly DiscoveredRoom[];
|
|
486
|
+
left: readonly string[];
|
|
487
|
+
member?: Member;
|
|
455
488
|
};
|
|
456
|
-
export type HeldRevisions = (locator: string, paths: readonly string[]) => Promise<ReadonlyMap<string, string>>;
|
|
457
489
|
export type RoomStreamEvent = {
|
|
458
490
|
kind: 'opened';
|
|
491
|
+
} | {
|
|
492
|
+
kind: 'discovered';
|
|
493
|
+
discovery: Discovery;
|
|
459
494
|
} | {
|
|
460
495
|
kind: 'closed';
|
|
461
496
|
revoked: boolean;
|
|
462
497
|
lost: boolean;
|
|
498
|
+
authorityChanged: boolean;
|
|
463
499
|
} | {
|
|
464
|
-
kind: '
|
|
500
|
+
kind: 'caught-up';
|
|
465
501
|
expired: readonly string[];
|
|
466
|
-
} |
|
|
467
|
-
kind: 'authority-changed';
|
|
468
|
-
scope?: DiscoveryScope;
|
|
469
|
-
} | {
|
|
470
|
-
kind: 'room-version';
|
|
471
|
-
locator: string;
|
|
472
|
-
roomVersion: string;
|
|
473
|
-
};
|
|
474
|
-
export type KeptReceipt = {
|
|
475
|
-
key: string;
|
|
476
|
-
head: unknown;
|
|
477
|
-
};
|
|
478
|
-
export type StreamReceipts = {
|
|
479
|
-
heads(): Promise<readonly KeptReceipt[]>;
|
|
480
|
-
parts(key: string, count: number): Promise<readonly unknown[]>;
|
|
481
|
-
keep(key: string, head: unknown, part?: {
|
|
482
|
-
index: number;
|
|
483
|
-
value: unknown;
|
|
484
|
-
}): Promise<void>;
|
|
485
|
-
drop(keys: readonly string[]): Promise<void>;
|
|
486
|
-
};
|
|
502
|
+
} | AuthorityChange | RoomChange;
|
|
487
503
|
export type RoomStream = {
|
|
488
504
|
hold(rooms: readonly HeldRoom[]): void;
|
|
489
|
-
|
|
490
|
-
published(locator: string, roomVersion: string): void;
|
|
491
|
-
observe(notify: (event: RoomStreamEvent) => void, receipts: StreamReceipts, revisions: HeldRevisions): () => void;
|
|
505
|
+
observe(notify: (event: RoomStreamEvent) => void): () => void;
|
|
492
506
|
};
|
|
507
|
+
export type PathRule = (path: string) => boolean;
|
|
493
508
|
export type Adapter = {
|
|
494
509
|
readonly localSaves?: true;
|
|
495
|
-
readonly exhaustiveDiscovery?: true;
|
|
496
510
|
readonly roomTypes?: string;
|
|
497
511
|
readonly nameableRoomTypes?: readonly string[];
|
|
512
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
513
|
+
readonly pathRule?: PathRule;
|
|
514
|
+
readonly unkeptReads?: readonly string[];
|
|
515
|
+
readonly leadingReads?: readonly string[];
|
|
498
516
|
authorize(): Promise<Authorization>;
|
|
499
|
-
discover(authorization: Authorization
|
|
517
|
+
discover?(authorization: Authorization): Promise<DiscoverResult>;
|
|
500
518
|
bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;
|
|
501
|
-
refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
519
|
+
refresh?(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;
|
|
502
520
|
mutate(authorization: Authorization, request: MutationRequest, keep: (upload: unknown) => Promise<void>): Promise<MutationResult>;
|
|
503
521
|
history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;
|
|
504
522
|
binary(authorization: Authorization, request: BinaryRequest): Promise<BinaryResult>;
|
|
505
523
|
link(authorization: Authorization, request: BinaryRequest): Promise<BinaryLinkResult>;
|
|
524
|
+
attach(authorization: Authorization, request: AttachRequest): Promise<AttachResult>;
|
|
506
525
|
action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;
|
|
526
|
+
search?(authorization: Authorization, request: SearchAsk): Promise<SearchAnswer>;
|
|
507
527
|
reached(locator: string, roomVersion: string, target: string): boolean;
|
|
508
528
|
follows(locator: string, roomVersion: string, next: string): boolean;
|
|
509
529
|
roomStream?: RoomStream;
|
|
510
530
|
conversations?: ConversationStream;
|
|
511
531
|
serviceMode?: ServiceModeSignal;
|
|
512
532
|
};
|
|
513
|
-
export {};
|
|
514
533
|
//# sourceMappingURL=adapter.d.ts.map
|