@agentshouse/mdruntime 0.1.0-ccbb89b0ca151 → 0.1.0-ccc0e3407f107
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 +1 -1
- package/dist/adapter.d.ts +74 -57
- 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 +11 -18
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +85 -108
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/client.d.ts +9 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -1
- package/dist/collection.d.ts +7 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +23 -17
- package/dist/compile.d.ts +1 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +91 -270
- package/dist/connection.d.ts +10 -9
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1009 -1063
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation.d.ts +16 -13
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +229 -155
- package/dist/durability.d.ts +6 -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 +17 -8
- package/dist/host.d.ts +3 -7
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +22 -27
- 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 +11 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/job.d.ts +14 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +28 -0
- package/dist/live.d.ts +2 -1
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +10 -7
- package/dist/media.d.ts +1 -1
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +27 -4
- package/dist/memory.d.ts +11 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +167 -84
- package/dist/messages.d.ts +2 -2
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +15 -16
- package/dist/model.d.ts +8 -8
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +6 -12
- package/dist/observation.d.ts +3 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +8 -3
- package/dist/outcome.d.ts +0 -3
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +3 -1
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +4 -209
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/reach.d.ts +9 -8
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +37 -48
- package/dist/react.d.ts +3 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +3 -17
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +4 -10
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +26 -0
- package/dist/refresh.d.ts +7 -5
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +29 -5
- package/dist/replica.d.ts +10 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +29 -14
- package/dist/room-draft.d.ts +21 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +98 -51
- package/dist/rows.d.ts +14 -21
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +48 -184
- package/dist/save.d.ts +2 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +20 -12
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/shared.d.ts +0 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +0 -10
- package/dist/status.d.ts +4 -3
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +21 -34
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +34 -77
- package/dist/stored.d.ts +11 -34
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +158 -241
- package/dist/tables.d.ts +23 -48
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +29 -66
- 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 +9 -4
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +3 -1
- package/package.json +2 -2
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -368
- package/dist/reads.d.ts +0 -11
- package/dist/reads.d.ts.map +0 -1
- package/dist/reads.js +0 -100
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -150
package/dist/bootstrap.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { transferIdentity } from './identity.js';
|
|
2
2
|
import { advancement, pageEntries } from './refresh.js';
|
|
3
|
+
import { entriesIn } from './shared.js';
|
|
3
4
|
import { unconfirmed } from './transfer.js';
|
|
4
|
-
export const NOTHING_DONE = { parts: 0, bytes: 0 };
|
|
5
|
-
const RESUMABLE = new Set([
|
|
6
|
-
'transport-uncertainty',
|
|
7
|
-
'retryable-refusal',
|
|
8
|
-
'unconfirmed',
|
|
9
|
-
]);
|
|
10
5
|
const NOTHING_PRIOR = () => Promise.resolve(new Map());
|
|
6
|
+
function textOf(page) {
|
|
7
|
+
let text = 0;
|
|
8
|
+
for (const [, content] of entriesIn(page.documents))
|
|
9
|
+
text += content.length;
|
|
10
|
+
return text;
|
|
11
|
+
}
|
|
11
12
|
async function pageOf(page) {
|
|
12
13
|
return {
|
|
13
14
|
entries: await pageEntries(page, [], page.roomVersion, NOTHING_PRIOR),
|
|
@@ -38,17 +39,16 @@ const NO_CONTENT = {
|
|
|
38
39
|
files: () => Promise.resolve([]),
|
|
39
40
|
contents: () => Promise.resolve(new Map()),
|
|
40
41
|
};
|
|
41
|
-
export async function bootstrapRoom(adapter, authorization, room, held, builtIn, remodel, continuing, staging, reuse) {
|
|
42
|
-
|
|
43
|
-
const resumed = kept !== null && kept.selection === room.replica.selection ? kept : null;
|
|
44
|
-
if (kept !== null && resumed === null)
|
|
42
|
+
export async function bootstrapRoom(adapter, authorization, room, held, builtIn, typedPaths, remodel, continuing, staging, reuse) {
|
|
43
|
+
if (staging.held(room.locator) !== null)
|
|
45
44
|
await staging.abandon(room.locator);
|
|
46
|
-
const
|
|
45
|
+
const begun = (pool) => started(adapter, authorization, room, held, builtIn, typedPaths, remodel, continuing, staging, pool);
|
|
46
|
+
const first = await begun(reuse);
|
|
47
47
|
if (first.kind !== 'expired')
|
|
48
48
|
return first;
|
|
49
49
|
await staging.setAside(room.locator);
|
|
50
50
|
try {
|
|
51
|
-
const replacement = await
|
|
51
|
+
const replacement = await begun(heldTogether(reuse, first.held));
|
|
52
52
|
if (replacement.kind !== 'expired')
|
|
53
53
|
return replacement;
|
|
54
54
|
await staging.abandon(room.locator);
|
|
@@ -59,89 +59,74 @@ export async function bootstrapRoom(adapter, authorization, room, held, builtIn,
|
|
|
59
59
|
await staging.release(first.key);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
const UNASKED = { page: unconfirmed, reused: false };
|
|
63
|
-
const NOTHING_KEPT = Promise.resolve();
|
|
64
62
|
function dropped(ahead) {
|
|
65
63
|
void ahead?.fetched.then(({ next, written }) => {
|
|
66
64
|
written();
|
|
67
65
|
dropped(next);
|
|
68
66
|
}, () => { });
|
|
69
67
|
}
|
|
70
|
-
function compositionFor(room, models, builtIn) {
|
|
68
|
+
function compositionFor(room, models, builtIn, typedPaths) {
|
|
71
69
|
return {
|
|
72
70
|
model: models.collection,
|
|
73
71
|
selection: room.typedSelection === undefined
|
|
74
72
|
? null
|
|
75
73
|
: { roots: room.typedSelection.roots, model: builtIn },
|
|
74
|
+
typedPaths,
|
|
76
75
|
};
|
|
77
76
|
}
|
|
78
|
-
async function
|
|
77
|
+
async function started(adapter, authorization, room, held, builtIn, typedPaths, remodel, continuing, staging, pool) {
|
|
78
|
+
let outcome;
|
|
79
|
+
try {
|
|
80
|
+
outcome = await bundle(adapter, authorization, room, held, builtIn, typedPaths, remodel, continuing, staging, pool);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
await staging.abandon(room.locator).catch(() => { });
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
if (outcome.kind !== 'staged' && outcome.kind !== 'expired') {
|
|
87
|
+
await staging.abandon(room.locator);
|
|
88
|
+
}
|
|
89
|
+
return outcome;
|
|
90
|
+
}
|
|
91
|
+
async function bundle(adapter, authorization, room, held, builtIn, typedPaths, remodel, continuing, staging, pool) {
|
|
79
92
|
const locator = room.locator;
|
|
80
93
|
const selection = room.replica.selection;
|
|
81
|
-
|
|
82
|
-
let looking = kept !== null;
|
|
83
|
-
let stopped = false;
|
|
84
|
-
let begin = () => { };
|
|
85
|
-
const begun = kept === null
|
|
86
|
-
? new Promise((resolve) => {
|
|
87
|
-
begin = resolve;
|
|
88
|
-
})
|
|
89
|
-
: NOTHING_KEPT;
|
|
94
|
+
const ending = new AbortController();
|
|
90
95
|
const arriving = staging.arriving(locator);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
...(pool === null ? {} : { held: pool }),
|
|
102
|
-
...(received === null ? {} : { received }),
|
|
103
|
-
});
|
|
104
|
-
return { page, reused: received !== null };
|
|
105
|
-
};
|
|
96
|
+
const downloaded = await staging.turn(locator, 'downloading');
|
|
97
|
+
const asking = (token) => adapter.bootstrap(authorization, {
|
|
98
|
+
locator,
|
|
99
|
+
selection,
|
|
100
|
+
signal: ending.signal,
|
|
101
|
+
...(token === null
|
|
102
|
+
? { arriving: (bytes) => arriving.at(bytes) }
|
|
103
|
+
: { pageToken: token }),
|
|
104
|
+
...(pool === null ? {} : { held: pool }),
|
|
105
|
+
});
|
|
106
106
|
const fetching = (token) => {
|
|
107
107
|
const fetched = (async () => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
finally {
|
|
114
|
-
release();
|
|
115
|
-
}
|
|
116
|
-
const { page, reused } = asked;
|
|
117
|
-
if (page.kind !== 'bootstrap') {
|
|
118
|
-
return { page, kept: NOTHING_KEPT, next: null, written: () => { } };
|
|
119
|
-
}
|
|
120
|
-
const received = page.received;
|
|
121
|
-
const written = staging.queued(received?.byteLength ?? 0);
|
|
122
|
-
let kept = NOTHING_KEPT;
|
|
123
|
-
if (token !== null && received !== undefined && !reused) {
|
|
124
|
-
kept = begun.then(() => staging.keep(locator, token, received));
|
|
125
|
-
kept.catch(() => { });
|
|
126
|
-
}
|
|
108
|
+
await staging.unqueued();
|
|
109
|
+
const page = continuing() ? await asking(token) : unconfirmed;
|
|
110
|
+
if (page.kind !== 'bootstrap')
|
|
111
|
+
return { page, next: null, written: () => { } };
|
|
112
|
+
const written = staging.queued(textOf(page));
|
|
127
113
|
const later = page.pageToken;
|
|
128
|
-
|
|
129
|
-
|
|
114
|
+
if (later === undefined) {
|
|
115
|
+
downloaded();
|
|
116
|
+
arriving.end();
|
|
117
|
+
}
|
|
118
|
+
return { page, written, next: later === undefined || !continuing() ? null : fetching(later) };
|
|
130
119
|
})();
|
|
131
120
|
fetched.catch(() => { });
|
|
132
|
-
return {
|
|
121
|
+
return { fetched };
|
|
133
122
|
};
|
|
134
|
-
let
|
|
123
|
+
let transfer = null;
|
|
124
|
+
let ahead = fetching(null);
|
|
135
125
|
try {
|
|
136
|
-
while (
|
|
126
|
+
while (ahead !== null) {
|
|
137
127
|
if (!continuing())
|
|
138
128
|
return unconfirmed;
|
|
139
|
-
const
|
|
140
|
-
const current = ahead !== null && ahead.token === asked ? ahead : fetching(asked);
|
|
141
|
-
if (ahead !== current)
|
|
142
|
-
dropped(ahead);
|
|
143
|
-
ahead = null;
|
|
144
|
-
const fetched = await current.fetched;
|
|
129
|
+
const fetched = await ahead.fetched;
|
|
145
130
|
ahead = fetched.next;
|
|
146
131
|
try {
|
|
147
132
|
if (!continuing())
|
|
@@ -151,15 +136,10 @@ async function bundle(adapter, authorization, room, held, builtIn, remodel, cont
|
|
|
151
136
|
const key = transfer?.key ?? null;
|
|
152
137
|
return { kind: 'expired', held: key === null ? NO_CONTENT : staging.content(key), key };
|
|
153
138
|
}
|
|
154
|
-
if (page.kind !== 'bootstrap')
|
|
155
|
-
if (!RESUMABLE.has(page.kind))
|
|
156
|
-
await staging.abandon(locator);
|
|
139
|
+
if (page.kind !== 'bootstrap')
|
|
157
140
|
return page;
|
|
158
|
-
|
|
159
|
-
await
|
|
160
|
-
const done = transfer?.done ?? NOTHING_DONE;
|
|
161
|
-
const part = page.received?.byteLength;
|
|
162
|
-
const next = {
|
|
141
|
+
const models = remodel(page.models, transfer?.models ?? held);
|
|
142
|
+
const staged = await staging.stage({
|
|
163
143
|
locator,
|
|
164
144
|
transfer: transfer?.transfer ?? transferIdentity(),
|
|
165
145
|
selection,
|
|
@@ -169,17 +149,13 @@ async function bundle(adapter, authorization, room, held, builtIn, remodel, cont
|
|
|
169
149
|
last: transfer !== null && !adapter.reached(locator, page.roomVersion, transfer.last)
|
|
170
150
|
? transfer.last
|
|
171
151
|
: page.roomVersion,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
done: part === undefined ? done : { parts: done.parts + 1, bytes: done.bytes + part },
|
|
175
|
-
models: remodel(page.models, transfer?.models ?? held),
|
|
152
|
+
done: { bytes: (transfer?.done.bytes ?? 0) + (page.bytes ?? 0) },
|
|
153
|
+
models,
|
|
176
154
|
key: transfer?.key ?? null,
|
|
177
|
-
};
|
|
178
|
-
const staged = await staging.stage(next, await pageOf(page), compositionFor(room, next.models, builtIn), part === undefined ? null : asked);
|
|
155
|
+
}, await pageOf(page), compositionFor(room, models, builtIn, typedPaths));
|
|
179
156
|
if (staged === null)
|
|
180
157
|
return unconfirmed;
|
|
181
158
|
transfer = staged;
|
|
182
|
-
begin();
|
|
183
159
|
}
|
|
184
160
|
finally {
|
|
185
161
|
fetched.written();
|
|
@@ -187,11 +163,16 @@ async function bundle(adapter, authorization, room, held, builtIn, remodel, cont
|
|
|
187
163
|
}
|
|
188
164
|
}
|
|
189
165
|
finally {
|
|
190
|
-
|
|
191
|
-
|
|
166
|
+
ending.abort();
|
|
167
|
+
downloaded();
|
|
192
168
|
arriving.end();
|
|
169
|
+
dropped(ahead);
|
|
193
170
|
}
|
|
194
|
-
if (
|
|
171
|
+
if (transfer === null)
|
|
172
|
+
return unconfirmed;
|
|
173
|
+
const installed = transfer;
|
|
174
|
+
const composition = compositionFor(room, installed.models, builtIn, typedPaths);
|
|
175
|
+
if (!(await staging.derive(locator, installed.key, composition)))
|
|
195
176
|
return unconfirmed;
|
|
196
177
|
await staging.turn(locator, 'replaying');
|
|
197
178
|
if (!continuing())
|
|
@@ -202,33 +183,29 @@ async function bundle(adapter, authorization, room, held, builtIn, remodel, cont
|
|
|
202
183
|
handle: room.handle,
|
|
203
184
|
operations: room.operations,
|
|
204
185
|
replica: room.replica,
|
|
205
|
-
model:
|
|
186
|
+
model: installed.models.collection,
|
|
206
187
|
typedSelection: room.typedSelection ?? null,
|
|
207
188
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
208
|
-
roomVersion:
|
|
209
|
-
transfer:
|
|
210
|
-
inventory:
|
|
211
|
-
key:
|
|
189
|
+
roomVersion: installed.from,
|
|
190
|
+
transfer: installed.transfer,
|
|
191
|
+
inventory: installed.done,
|
|
192
|
+
key: installed.key,
|
|
212
193
|
};
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
const reconciled = last ===
|
|
194
|
+
const last = installed.last;
|
|
195
|
+
const refresh = adapter.refresh;
|
|
196
|
+
const reconciled = last === installed.from &&
|
|
197
|
+
(staging.streamed || adapter.reached(locator, last, room.roomVersion))
|
|
216
198
|
? { kind: 'still-current' }
|
|
217
|
-
:
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
if (refused !== null) {
|
|
223
|
-
await staging.abandon(locator);
|
|
224
|
-
return refused;
|
|
225
|
-
}
|
|
226
|
-
return { kind: 'staged', record: result, refreshed };
|
|
199
|
+
: refresh === undefined
|
|
200
|
+
? unconfirmed
|
|
201
|
+
: await advancement(refresh, authorization, record, remodel, continuing, await staging.refreshing(locator, record.key, composition));
|
|
202
|
+
if (reconciled.kind === 'advanced') {
|
|
203
|
+
return { kind: 'staged', record: reconciled.record, refreshed: true };
|
|
227
204
|
}
|
|
205
|
+
if (reconciled.kind === 'still-current')
|
|
206
|
+
return { kind: 'staged', record, refreshed: false };
|
|
228
207
|
if (reconciled.kind === 'beyond-horizon') {
|
|
229
208
|
return { kind: 'expired', held: staging.content(record.key), key: record.key };
|
|
230
209
|
}
|
|
231
|
-
if (!RESUMABLE.has(reconciled.kind))
|
|
232
|
-
await staging.abandon(locator);
|
|
233
210
|
return reconciled;
|
|
234
211
|
}
|
package/dist/chain.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
|
|
1
2
|
import type { MdRuntimeClient } from './client.js';
|
|
2
|
-
import type {
|
|
3
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
3
4
|
type Rows = DocumentResult | GroupResult;
|
|
4
5
|
export type WindowAnswer = Rows | PendingResult;
|
|
5
6
|
export type WindowChain = {
|
package/dist/chain.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE7E,KAAK,IAAI,GAAG,cAAc,GAAG,WAAW,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,aAAa,CAAC;AAEhD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAaF,wBAAgB,cAAc,CAC5B,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,aAAa,GAAG,UAAU,EACjC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GAC7E,WAAW,CAkEb"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
|
|
1
2
|
import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult } from './connection.js';
|
|
2
3
|
import type { Member, ServiceMode } from './adapter.js';
|
|
3
|
-
import type {
|
|
4
|
+
import type { UnsentWork } from './durability.js';
|
|
5
|
+
import type { ChatDraft, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationView } from './conversation.js';
|
|
4
6
|
import { type Observation } from './observation.js';
|
|
5
7
|
import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, Offline, QueueEntry, Resolution } from './outcome.js';
|
|
6
|
-
import type {
|
|
8
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
7
9
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
8
10
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
9
11
|
import type { Readiness } from './readiness.js';
|
|
@@ -32,13 +34,12 @@ export type MdRuntimeClient = {
|
|
|
32
34
|
};
|
|
33
35
|
conversation: {
|
|
34
36
|
list(): Promise<readonly ConversationEntry[]>;
|
|
35
|
-
read(conversation: string, options?:
|
|
37
|
+
read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
|
|
36
38
|
create(input: unknown): Promise<CallResult>;
|
|
37
39
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
38
|
-
answer(conversation: string, answer:
|
|
40
|
+
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
39
41
|
interrupt(conversation: string): Promise<CallResult>;
|
|
40
42
|
kill(conversation: string): Promise<CallResult>;
|
|
41
|
-
cancel(conversation: string, turn: string): Promise<CallResult>;
|
|
42
43
|
delete(conversation: string): Promise<CallResult>;
|
|
43
44
|
};
|
|
44
45
|
chatDraft: {
|
|
@@ -59,6 +60,8 @@ export type MdRuntimeClient = {
|
|
|
59
60
|
persistence(): Promise<boolean>;
|
|
60
61
|
retry(): Promise<void>;
|
|
61
62
|
cleanUp(): Promise<number>;
|
|
63
|
+
unsent(): Promise<readonly UnsentWork[]>;
|
|
64
|
+
reset(): Promise<void>;
|
|
62
65
|
observe: {
|
|
63
66
|
(topic: 'deployment-facts'): Promise<Observation<unknown>>;
|
|
64
67
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
@@ -68,6 +71,7 @@ export type MdRuntimeClient = {
|
|
|
68
71
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
69
72
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
70
73
|
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
74
|
+
(topic: 'authority-changes'): Promise<Observation<number>>;
|
|
71
75
|
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
72
76
|
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
73
77
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAY,KAAK,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAE7E,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EAEZ,UAAU,EACV,cAAc,EAGd,aAAa,EACb,OAAO,EACP,UAAU,EACV,UAAU,EAEX,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EACV,OAAO,EACP,i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AAS,iBAAiB,EAAE,CAAC,CAAC,CAAC;QAC7E,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAAC,CAAC;KACvE,CAAC;IACF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B,CAAC;AAMF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,eAAe,CAuSnE;AAID,wBAAgB,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUxF;AAED,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -257,7 +257,6 @@ export function connectMdRuntime(port) {
|
|
|
257
257
|
answer: (conversation, answer) => ask('conversation.answer', [conversation, answer]),
|
|
258
258
|
interrupt: (conversation) => ask('conversation.interrupt', [conversation]),
|
|
259
259
|
kill: (conversation) => ask('conversation.kill', [conversation]),
|
|
260
|
-
cancel: (conversation, turn) => ask('conversation.cancel', [conversation, turn]),
|
|
261
260
|
delete: (conversation) => ask('conversation.delete', [conversation]),
|
|
262
261
|
},
|
|
263
262
|
chatDraft: {
|
|
@@ -278,6 +277,8 @@ export function connectMdRuntime(port) {
|
|
|
278
277
|
persistence: () => ask('persistence', []),
|
|
279
278
|
retry: () => ask('retry', []),
|
|
280
279
|
cleanUp: () => ask('cleanUp', []),
|
|
280
|
+
unsent: () => ask('unsent', []),
|
|
281
|
+
reset: () => ask('reset', []),
|
|
281
282
|
observe: ((topic, ...input) => watch(topic, input)),
|
|
282
283
|
reauthorize: () => ask('reauthorize', []),
|
|
283
284
|
settled,
|
package/dist/collection.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { type Document } from '@agentshouse/mdmodel';
|
|
1
|
+
import { type Document, type TypedPath } from '@agentshouse/mdmodel';
|
|
2
2
|
import type { ModelState } from './model.js';
|
|
3
3
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
|
-
import { type Paths } from './shared.js';
|
|
5
|
-
import type { Refused } from './transfer.js';
|
|
6
4
|
export declare const MD_MODEL: MdModelIdentity;
|
|
7
5
|
export type Collection = {
|
|
8
6
|
text: Readonly<Record<string, string>>;
|
|
@@ -15,12 +13,17 @@ export type Composition = {
|
|
|
15
13
|
roots: readonly string[];
|
|
16
14
|
model: ModelState;
|
|
17
15
|
} | null;
|
|
16
|
+
typedPaths: readonly TypedPath[];
|
|
18
17
|
};
|
|
18
|
+
export type Composed = {
|
|
19
|
+
readonly composition: Composition;
|
|
20
|
+
readonly fingerprint: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function composedOf(composition: Composition): Composed;
|
|
19
23
|
export declare function selected(composition: Composition, path: string): boolean;
|
|
20
24
|
export declare function governing(composition: Composition, path: string): ModelState;
|
|
21
25
|
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
|
|
22
26
|
export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
|
|
23
|
-
export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
|
|
24
27
|
export declare function validRoot(root: unknown): root is string;
|
|
25
28
|
export declare function available(composition: Composition): boolean;
|
|
26
29
|
//# sourceMappingURL=collection.d.ts.map
|
package/dist/collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,eAAO,MAAM,QAAQ,EAAE,eAAwE,CAAC;AAEhG,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE;QAAE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,GAAG,IAAI,CAAC;IAClE,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAc3F,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,QAAQ,CAS7D;AAED,wBAAgB,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAKxE;AAED,wBAAgB,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAI5E;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACtC,WAAW,EAAE,WAAW,GACvB,UAAU,CAcZ;AAED,wBAAiB,WAAW,CAC1B,UAAU,EAAE,UAAU,GACrB,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,CAQhE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAEvD;AAED,wBAAgB,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE3D"}
|
package/dist/collection.js
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
import { parse, VERSION } from '@agentshouse/mdmodel';
|
|
2
2
|
import { beneath, normalize } from './paths.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { hashed } from './observation.js';
|
|
4
|
+
import { sortedKeys } from './shared.js';
|
|
5
5
|
export const MD_MODEL = { identity: '@agentshouse/mdmodel', version: VERSION };
|
|
6
|
+
const typesPrinted = new WeakMap();
|
|
7
|
+
function typesPrint(model) {
|
|
8
|
+
if (model.status === 'unavailable')
|
|
9
|
+
return '';
|
|
10
|
+
let print = typesPrinted.get(model.types);
|
|
11
|
+
if (print === undefined) {
|
|
12
|
+
print = hashed(JSON.stringify(model.types)).toString(36);
|
|
13
|
+
typesPrinted.set(model.types, print);
|
|
14
|
+
}
|
|
15
|
+
return print;
|
|
16
|
+
}
|
|
17
|
+
export function composedOf(composition) {
|
|
18
|
+
const { model, selection } = composition;
|
|
19
|
+
return {
|
|
20
|
+
composition,
|
|
21
|
+
fingerprint: JSON.stringify([
|
|
22
|
+
typesPrint(model),
|
|
23
|
+
selection === null ? null : [selection.roots, typesPrint(selection.model)],
|
|
24
|
+
]),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
6
27
|
export function selected(composition, path) {
|
|
7
28
|
return (composition.selection !== null &&
|
|
8
29
|
composition.selection.roots.some((root) => beneath(root, path)));
|
|
@@ -39,21 +60,6 @@ export function* documentsOf(collection) {
|
|
|
39
60
|
}
|
|
40
61
|
})();
|
|
41
62
|
}
|
|
42
|
-
export function* unreadable(text, paths = null) {
|
|
43
|
-
const named = paths ?? (yield* keysIn(text));
|
|
44
|
-
let least = null;
|
|
45
|
-
for (const path of named) {
|
|
46
|
-
const content = Object.hasOwn(text, path) ? text[path] : undefined;
|
|
47
|
-
if (content === undefined)
|
|
48
|
-
continue;
|
|
49
|
-
const read = parse(content, path);
|
|
50
|
-
if (!read.ok && (least === null || path < least.path)) {
|
|
51
|
-
least = { path, refused: { kind: 'refused', refusal: read.refusal } };
|
|
52
|
-
}
|
|
53
|
-
yield ROW_WEIGHT + content.length;
|
|
54
|
-
}
|
|
55
|
-
return least?.refused ?? null;
|
|
56
|
-
}
|
|
57
63
|
export function validRoot(root) {
|
|
58
64
|
return typeof root === 'string' && normalize(root) === root;
|
|
59
65
|
}
|
package/dist/compile.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import type { Plan, QueryRows } from './query.js';
|
|
2
|
-
import type { Connection
|
|
2
|
+
import type { Connection } from './tables.js';
|
|
3
3
|
export type QueryRoom = {
|
|
4
4
|
readonly locator: string;
|
|
5
5
|
readonly key: number;
|
|
6
6
|
};
|
|
7
|
-
export type Fragment = {
|
|
8
|
-
readonly sql: string;
|
|
9
|
-
readonly bind: readonly Value[];
|
|
10
|
-
};
|
|
11
7
|
export type QueryAnswer = QueryRows & {
|
|
12
8
|
readonly more?: string;
|
|
13
9
|
};
|
|
14
|
-
export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
|
|
15
10
|
export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
|
|
16
11
|
//# sourceMappingURL=compile.d.ts.map
|
package/dist/compile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,IAAI,EAAuC,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAG1D,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AA+a3E,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAkUjE,wBAAgB,WAAW,CACzB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,MAAM,GAAE,MAAM,GAAG,IAAW,GAC3B,WAAW,CAUb"}
|