@agentshouse/mdruntime 0.1.0-c2aaa9c0e3ca4 → 0.1.0-c2c52158b7381
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/AGENTS.md +285 -276
- package/README.md +9 -8
- package/dist/adapter.d.ts +80 -21
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +4 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +13 -3
- package/dist/attempt.d.ts.map +1 -1
- package/dist/attempt.js +14 -1
- package/dist/bootstrap.d.ts +3 -2
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +83 -26
- package/dist/change-set.d.ts +7 -2
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +37 -10
- package/dist/change.d.ts +31 -1
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +10 -1
- package/dist/chat/acts.d.ts +3 -4
- package/dist/chat/acts.d.ts.map +1 -1
- package/dist/chat/acts.js +10 -10
- package/dist/chat/earlier.d.ts +10 -0
- package/dist/chat/earlier.d.ts.map +1 -0
- package/dist/chat/earlier.js +54 -0
- package/dist/chat/house.d.ts +25 -0
- package/dist/chat/house.d.ts.map +1 -0
- package/dist/chat/house.js +38 -0
- package/dist/chat/input.d.ts +3 -1
- package/dist/chat/input.d.ts.map +1 -1
- package/dist/chat/input.js +11 -18
- package/dist/chat/kit.d.ts +2 -1
- package/dist/chat/kit.d.ts.map +1 -1
- package/dist/chat/kit.js +3 -3
- package/dist/chat/list.d.ts +9 -1
- package/dist/chat/list.d.ts.map +1 -1
- package/dist/chat/list.js +53 -9
- package/dist/chat/markdown.d.ts +3 -1
- package/dist/chat/markdown.d.ts.map +1 -1
- package/dist/chat/markdown.js +85 -26
- package/dist/chat/message.d.ts +1 -0
- package/dist/chat/message.d.ts.map +1 -1
- package/dist/chat/message.js +57 -12
- package/dist/chat/messages.d.ts +9 -1
- package/dist/chat/messages.d.ts.map +1 -1
- package/dist/chat/messages.js +67 -28
- package/dist/chat/name.d.ts +1 -0
- package/dist/chat/name.d.ts.map +1 -1
- package/dist/chat/name.js +1 -1
- package/dist/chat/opened.d.ts +1 -0
- package/dist/chat/opened.d.ts.map +1 -1
- package/dist/chat/opened.js +2 -0
- package/dist/chat/overlay.d.ts +1 -0
- package/dist/chat/overlay.d.ts.map +1 -1
- package/dist/chat/overlay.js +11 -5
- package/dist/chat/parts.d.ts +1 -0
- package/dist/chat/parts.d.ts.map +1 -1
- package/dist/chat/parts.js +3 -2
- package/dist/chat/pieces.d.ts +62 -0
- package/dist/chat/pieces.d.ts.map +1 -0
- package/dist/chat/pieces.js +1110 -0
- package/dist/chat/provider.d.ts +7 -2
- package/dist/chat/provider.d.ts.map +1 -1
- package/dist/chat/provider.js +129 -155
- package/dist/chat/question.d.ts +1 -1
- package/dist/chat/question.d.ts.map +1 -1
- package/dist/chat/question.js +7 -18
- package/dist/chat/ready.d.ts +5 -1
- package/dist/chat/ready.d.ts.map +1 -1
- package/dist/chat/ready.js +9 -7
- package/dist/chat/room-file.d.ts +8 -0
- package/dist/chat/room-file.d.ts.map +1 -0
- package/dist/chat/room-file.js +72 -0
- package/dist/chat/steady.d.ts +3 -0
- package/dist/chat/steady.d.ts.map +1 -0
- package/dist/chat/steady.js +26 -0
- package/dist/chat/style.d.ts.map +1 -1
- package/dist/chat/style.js +8 -4
- package/dist/chat.d.ts +3 -2
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +2 -2
- package/dist/client.d.ts +21 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +47 -8
- package/dist/collection.d.ts +21 -6
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +332 -40
- package/dist/connection.d.ts +39 -11
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +2294 -492
- package/dist/conversation.d.ts +28 -9
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +500 -165
- package/dist/digest.d.ts +7 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +113 -0
- package/dist/durability.d.ts +8 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +18 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +157 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/file.d.ts +2 -10
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -120
- package/dist/host.d.ts +15 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +103 -13
- package/dist/identity.d.ts +2 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +6 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/memory.d.ts +8 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +43 -12
- package/dist/model.d.ts +4 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +10 -1
- package/dist/name.d.ts +4 -0
- package/dist/name.d.ts.map +1 -0
- package/dist/name.js +122 -0
- package/dist/observation.d.ts +7 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +29 -12
- package/dist/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/outcome.d.ts +39 -4
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +29 -0
- package/dist/overlay.d.ts +6 -4
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +229 -161
- package/dist/query.d.ts +57 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +37 -7
- package/dist/reach.d.ts +11 -4
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +192 -41
- package/dist/react.d.ts +8 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -17
- package/dist/read-side.d.ts +18 -9
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +894 -155
- package/dist/readiness.d.ts +53 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +33 -0
- package/dist/reads.d.ts +11 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +98 -0
- package/dist/recovery.d.ts +25 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +198 -0
- package/dist/refresh.d.ts +4 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +46 -20
- package/dist/replica.d.ts +12 -7
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +151 -64
- package/dist/room-draft.d.ts +16 -2
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +32 -25
- package/dist/rows.d.ts +6 -13
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +10 -13
- package/dist/save.d.ts +52 -10
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +519 -159
- package/dist/search.d.ts +49 -6
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +242 -46
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +19 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +461 -0
- package/dist/status.d.ts +4 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/store.d.ts +61 -17
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +581 -310
- package/dist/tables.d.ts +242 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +406 -0
- package/dist/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +67 -0
- package/dist/windows.d.ts +21 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +84 -0
- package/dist/wire.d.ts +168 -32
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +56 -31
- package/package.json +10 -2
package/dist/host.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { composeRuntime, } from './connection.js';
|
|
2
|
+
import { queryKey } from './query.js';
|
|
2
3
|
import { described } from './failure.js';
|
|
3
|
-
import {
|
|
4
|
-
import { AUTHORIZATION_ENDED, request,
|
|
4
|
+
import { endRuntimeStore } from './store.js';
|
|
5
|
+
import { AUTHORIZATION_ENDED, request, WIRE, } from './wire.js';
|
|
5
6
|
const NARROWED = new Set(['within', 'whole']);
|
|
6
7
|
function answered(md, app, writtenBy, member, input) {
|
|
7
8
|
switch (member) {
|
|
@@ -15,20 +16,32 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
15
16
|
return md.types(input[0]);
|
|
16
17
|
case 'save':
|
|
17
18
|
return md.save(input[0], input[1], writtenBy);
|
|
19
|
+
case 'saveParts':
|
|
20
|
+
return md.saveParts(input[0], input[1], writtenBy);
|
|
18
21
|
case 'history':
|
|
19
22
|
return md.history(input[0], input[1], input[2]);
|
|
23
|
+
case 'resolve':
|
|
24
|
+
return md.resolve(input[0], input[1], input[2]);
|
|
20
25
|
case 'binaryFile.read':
|
|
21
26
|
return md.binaryFile.read(input[0], input[1], input[2]);
|
|
27
|
+
case 'binaryFile.link':
|
|
28
|
+
return md.binaryFile.link(input[0], input[1], input[2]);
|
|
22
29
|
case 'binaryFile.readReference':
|
|
23
30
|
return md.binaryFile.readReference(input[0]);
|
|
31
|
+
case 'binaryFile.part':
|
|
32
|
+
return md.binaryFile.part(input[0], input[1]);
|
|
24
33
|
case 'call':
|
|
25
34
|
return md.call(input[0], input[1]);
|
|
26
35
|
case 'reached':
|
|
27
36
|
return md.reached(input[0], input[1], input[2]);
|
|
28
37
|
case 'log':
|
|
29
38
|
return md.log();
|
|
39
|
+
case 'cleanUp':
|
|
40
|
+
return md.cleanUp();
|
|
30
41
|
case 'persistence':
|
|
31
42
|
return md.persistence();
|
|
43
|
+
case 'retry':
|
|
44
|
+
return md.retry();
|
|
32
45
|
case 'reauthorize':
|
|
33
46
|
return md.reauthorize();
|
|
34
47
|
case 'roomDraft.list':
|
|
@@ -43,6 +56,8 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
43
56
|
return md.presentation.read(app);
|
|
44
57
|
case 'presentation.write':
|
|
45
58
|
return md.presentation.write(app, input[0]);
|
|
59
|
+
case 'presentation.edit':
|
|
60
|
+
return md.presentation.edit(app, input[0]);
|
|
46
61
|
case 'conversation.list':
|
|
47
62
|
return md.conversation.list();
|
|
48
63
|
case 'conversation.read':
|
|
@@ -50,7 +65,9 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
50
65
|
case 'conversation.create':
|
|
51
66
|
return md.conversation.create(input[0]);
|
|
52
67
|
case 'conversation.send':
|
|
53
|
-
return md.conversation.send(input[0]);
|
|
68
|
+
return md.conversation.send(input[0], input[1], input[2]);
|
|
69
|
+
case 'conversation.attach':
|
|
70
|
+
return md.conversation.attach(input[0], input[1]);
|
|
54
71
|
case 'conversation.answer':
|
|
55
72
|
return md.conversation.answer(input[0], input[1]);
|
|
56
73
|
case 'conversation.interrupt':
|
|
@@ -63,10 +80,20 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
63
80
|
return md.conversation.delete(input[0]);
|
|
64
81
|
case 'chatDraft.write':
|
|
65
82
|
return md.chatDraft.write(input[0], input[1], input[2]);
|
|
83
|
+
case 'chatDraft.prepend':
|
|
84
|
+
return md.chatDraft.prepend(input[0], input[1]);
|
|
66
85
|
case 'chatDraft.discard':
|
|
67
86
|
return md.chatDraft.discard(input[0]);
|
|
68
87
|
}
|
|
69
88
|
}
|
|
89
|
+
function answeredResult(value) {
|
|
90
|
+
return typeof value === 'object' && value !== null && !('pending' in value);
|
|
91
|
+
}
|
|
92
|
+
function answeredMessage(value) {
|
|
93
|
+
if (typeof value !== 'object' || value === null)
|
|
94
|
+
return false;
|
|
95
|
+
return !('result' in value) || answeredResult(value.result);
|
|
96
|
+
}
|
|
70
97
|
export function serveMdRuntime(options) {
|
|
71
98
|
const deploymentFacts = structuredClone(options.deploymentFacts);
|
|
72
99
|
const closing = new AbortController();
|
|
@@ -84,13 +111,25 @@ export function serveMdRuntime(options) {
|
|
|
84
111
|
deliver(structuredClone(deploymentFacts));
|
|
85
112
|
return () => { };
|
|
86
113
|
};
|
|
87
|
-
function attach(port, app, release, reach) {
|
|
114
|
+
function attach(port, app, release, reach, code = 'stored', search = 'unused') {
|
|
88
115
|
if (!authorized)
|
|
89
116
|
throw new Error(AUTHORIZATION_ENDED);
|
|
90
117
|
const writtenBy = release === undefined ? undefined : { app, release };
|
|
91
|
-
|
|
118
|
+
let facts = { target: app, code, capacity: null, search };
|
|
119
|
+
const view = runtime.within(reach ?? null, facts);
|
|
92
120
|
const observations = new Map();
|
|
121
|
+
const followed = new Set();
|
|
122
|
+
const answeredKeys = new Set();
|
|
123
|
+
let awaited = null;
|
|
93
124
|
let serving = true;
|
|
125
|
+
const answeredQuery = (query) => {
|
|
126
|
+
answeredKeys.add(queryKey(query));
|
|
127
|
+
if (awaited === null || !awaited.keys.every((key) => answeredKeys.has(key)))
|
|
128
|
+
return;
|
|
129
|
+
const { done } = awaited;
|
|
130
|
+
awaited = null;
|
|
131
|
+
done();
|
|
132
|
+
};
|
|
94
133
|
const send = (message) => {
|
|
95
134
|
port.postMessage(message);
|
|
96
135
|
};
|
|
@@ -101,6 +140,8 @@ export function serveMdRuntime(options) {
|
|
|
101
140
|
for (const end of observations.values())
|
|
102
141
|
end();
|
|
103
142
|
observations.clear();
|
|
143
|
+
for (const end of [...followed])
|
|
144
|
+
end();
|
|
104
145
|
attachments.delete(detach);
|
|
105
146
|
};
|
|
106
147
|
const observe = (id, topic, input) => {
|
|
@@ -110,10 +151,12 @@ export function serveMdRuntime(options) {
|
|
|
110
151
|
return;
|
|
111
152
|
send(resolved ? { kind: 'event', id, value } : { kind: 'result', id, value });
|
|
112
153
|
resolved = true;
|
|
154
|
+
if (topic === 'query' && answeredMessage(value))
|
|
155
|
+
answeredQuery(input[0]);
|
|
113
156
|
};
|
|
114
157
|
observations.set(id, topic === 'deployment-facts'
|
|
115
158
|
? watchFacts(deliver)
|
|
116
|
-
: (NARROWED.has(
|
|
159
|
+
: (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
|
|
117
160
|
};
|
|
118
161
|
const serve = async (message) => {
|
|
119
162
|
if (message.kind === 'hello')
|
|
@@ -131,9 +174,12 @@ export function serveMdRuntime(options) {
|
|
|
131
174
|
observe(message.id, message.topic, message.input);
|
|
132
175
|
return;
|
|
133
176
|
}
|
|
134
|
-
const value = await answered(NARROWED.has(
|
|
135
|
-
if (serving)
|
|
136
|
-
|
|
177
|
+
const value = await answered(NARROWED.has(WIRE.members[message.member].reach) ? view.md : md, app, writtenBy, message.member, message.input);
|
|
178
|
+
if (!serving)
|
|
179
|
+
return;
|
|
180
|
+
send({ kind: 'result', id: message.id, value });
|
|
181
|
+
if (message.member === 'query' && answeredResult(value))
|
|
182
|
+
answeredQuery(message.input[0]);
|
|
137
183
|
}
|
|
138
184
|
catch (error) {
|
|
139
185
|
if (serving)
|
|
@@ -157,23 +203,67 @@ export function serveMdRuntime(options) {
|
|
|
157
203
|
if (serving)
|
|
158
204
|
view.narrow(next);
|
|
159
205
|
},
|
|
206
|
+
code(next, capacity) {
|
|
207
|
+
if (!serving)
|
|
208
|
+
return;
|
|
209
|
+
facts = { ...facts, code: next, capacity };
|
|
210
|
+
view.facts(facts);
|
|
211
|
+
},
|
|
212
|
+
search(next) {
|
|
213
|
+
if (!serving)
|
|
214
|
+
return;
|
|
215
|
+
facts = { ...facts, search: next };
|
|
216
|
+
view.facts(facts);
|
|
217
|
+
},
|
|
218
|
+
answered(queries, done) {
|
|
219
|
+
const keys = queries.map(queryKey);
|
|
220
|
+
if (keys.every((key) => answeredKeys.has(key)))
|
|
221
|
+
done();
|
|
222
|
+
else
|
|
223
|
+
awaited = { keys, done };
|
|
224
|
+
},
|
|
225
|
+
readiness(deliver) {
|
|
226
|
+
if (!serving)
|
|
227
|
+
return () => { };
|
|
228
|
+
const stop = view.watch('readiness', [], (value) => {
|
|
229
|
+
if (serving)
|
|
230
|
+
deliver(value);
|
|
231
|
+
});
|
|
232
|
+
const end = () => {
|
|
233
|
+
followed.delete(end);
|
|
234
|
+
stop();
|
|
235
|
+
};
|
|
236
|
+
followed.add(end);
|
|
237
|
+
return end;
|
|
238
|
+
},
|
|
160
239
|
};
|
|
161
240
|
}
|
|
162
241
|
return {
|
|
163
242
|
attach,
|
|
164
|
-
|
|
243
|
+
seed(entry) {
|
|
244
|
+
runtime.seed(entry);
|
|
245
|
+
},
|
|
246
|
+
persisted(answer) {
|
|
247
|
+
runtime.persisted(answer);
|
|
248
|
+
},
|
|
249
|
+
async endAuthorization(holder) {
|
|
165
250
|
authorized = false;
|
|
166
251
|
for (const [detach, send] of [...attachments]) {
|
|
167
252
|
send({ kind: 'ended' });
|
|
168
253
|
detach();
|
|
169
254
|
}
|
|
170
255
|
close();
|
|
171
|
-
await
|
|
172
|
-
|
|
256
|
+
if (!(await endRuntimeStore(options.database, holder)))
|
|
257
|
+
await options.shell.dropGeneration();
|
|
258
|
+
},
|
|
259
|
+
lose(locators) {
|
|
260
|
+
return runtime.lose(locators);
|
|
173
261
|
},
|
|
174
262
|
stop() {
|
|
175
263
|
return runtime.stop();
|
|
176
264
|
},
|
|
177
265
|
};
|
|
178
266
|
}
|
|
179
|
-
export {
|
|
267
|
+
export { entrySeedOf } from './seed.js';
|
|
268
|
+
export { createRecovery, retryDelay, } from './recovery.js';
|
|
269
|
+
export { openDatabase, STORE_SCHEMA, transacted } from './store.js';
|
package/dist/identity.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare function changeBatchIdentity(at?: number): string;
|
|
2
|
+
export declare function identityTime(identity: string): number;
|
|
2
3
|
export declare function roomDraftRevision(): string;
|
|
3
4
|
export declare function chatDraftRevision(): string;
|
|
4
5
|
export declare function transferIdentity(): string;
|
|
6
|
+
export declare function indexGeneration(): string;
|
|
5
7
|
export declare function binaryLocalId(): string;
|
|
6
8
|
//# sourceMappingURL=identity.d.ts.map
|
package/dist/identity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
package/dist/identity.js
CHANGED
|
@@ -10,6 +10,9 @@ export function changeBatchIdentity(at = Date.now()) {
|
|
|
10
10
|
const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
11
11
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
12
12
|
}
|
|
13
|
+
export function identityTime(identity) {
|
|
14
|
+
return Number.parseInt(identity.replaceAll('-', '').slice(0, 12), 16);
|
|
15
|
+
}
|
|
13
16
|
function randomIdentity() {
|
|
14
17
|
const bytes = new Uint8Array(16);
|
|
15
18
|
crypto.getRandomValues(bytes);
|
|
@@ -24,6 +27,9 @@ export function chatDraftRevision() {
|
|
|
24
27
|
export function transferIdentity() {
|
|
25
28
|
return randomIdentity();
|
|
26
29
|
}
|
|
30
|
+
export function indexGeneration() {
|
|
31
|
+
return randomIdentity();
|
|
32
|
+
}
|
|
27
33
|
export function binaryLocalId() {
|
|
28
34
|
return randomIdentity();
|
|
29
35
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BinaryFile, BinaryRequest, BinaryResult, ReferrerScope, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldRoom, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
|
|
2
|
-
export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
|
|
1
|
+
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, ReferrerScope, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, DiscoveryScope, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldContent, HeldRoom, KeptReceipt, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, StreamReceipts, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
|
|
2
|
+
export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
|
|
3
3
|
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
4
|
-
export type {
|
|
5
|
-
export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedRoomDraft, SaveResult, } from './connection.js';
|
|
4
|
+
export type { ChosenFile, FileDeclaration } from './file.js';
|
|
5
|
+
export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult, } from './connection.js';
|
|
6
6
|
export type { Observation } from './observation.js';
|
|
7
|
-
export type { BinaryAnswer, CallResult, Failure, HistoryAnswer, QueueEntry, Submission, } from './outcome.js';
|
|
7
|
+
export type { BinaryAnswer, BinaryLinkAnswer, CallResult, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
|
|
8
8
|
export type { BinaryFileRecord, BinaryReference } from './binary.js';
|
|
9
9
|
export type { RuntimeError } from './failure.js';
|
|
10
|
-
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, } from './room-draft.js';
|
|
10
|
+
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
|
|
11
11
|
export type { SaveRefusal } from './save.js';
|
|
12
|
-
export type { DocumentHit, DocumentPart, MessageHit, SearchRequest, SearchResult, } from './search.js';
|
|
12
|
+
export type { DocumentHit, DocumentPart, MessageHit, PendingConversation, SearchCoverage, SearchHits, SearchPending, SearchRequest, SearchResult, SearchUndeclared, } from './search.js';
|
|
13
13
|
export { departure } from './change.js';
|
|
14
|
+
export { partsAfter } from './room-draft.js';
|
|
15
|
+
export { cutName, nameFrom, transliterated } from './name.js';
|
|
16
|
+
export { SESSION_STARTED } from './conversation.js';
|
|
14
17
|
export { changeBatchIdentity } from './identity.js';
|
|
18
|
+
export { ROW_WEIGHT, stepped } from './turn.js';
|
|
19
|
+
export { entriesIn, patching, sortedKeys } from './shared.js';
|
|
15
20
|
export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
|
|
16
21
|
export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
|
|
17
|
-
export type { RuntimeShell } from './durability.js';
|
|
22
|
+
export type { RuntimeShell, StorageEstimate } from './durability.js';
|
|
23
|
+
export type { CapacityCause, CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Persistence, Readiness, ReadinessStatus, RefusedRoom, RoomCoverage, RoomPreparation, SearchObligation, TargetCoverage, } from './readiness.js';
|
|
18
24
|
export type { AttentionEntry, SyncStatus } from './status.js';
|
|
19
|
-
export type { Backlink, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, Predicate, QueryDocument, QueryGroup, QueryResult, Related, Select, Value, Where, } from './query.js';
|
|
25
|
+
export type { Awaits, Backlink, CoveredRoom, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, PendingResult, PendingRoom, Predicate, QueryCoverage, QueryDocument, QueryGroup, QueryResult, QueryRows, Related, Select, Value, Where, } from './query.js';
|
|
20
26
|
export type { MdType, ModelIdentity, ModelSnapshot, ModelState, ModelResult, TypesResult, ValidationReceipt, } from './model.js';
|
|
21
27
|
export type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';
|
|
22
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,iBAAi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B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5F,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACrE,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,eAAe,EACf,WAAW,EACX,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export { departure } from './change.js';
|
|
2
|
+
export { partsAfter } from './room-draft.js';
|
|
3
|
+
export { cutName, nameFrom, transliterated } from './name.js';
|
|
4
|
+
export { SESSION_STARTED } from './conversation.js';
|
|
2
5
|
export { changeBatchIdentity } from './identity.js';
|
|
6
|
+
export { ROW_WEIGHT, stepped } from './turn.js';
|
|
7
|
+
export { entriesIn, patching, sortedKeys } from './shared.js';
|
|
3
8
|
export { attempts, identities, intentOf, } from './attempt.js';
|
|
4
9
|
export { expectedList, expecting } from './expectation.js';
|
package/dist/memory.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ModelResult } from './model.js';
|
|
2
|
-
import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode } from './adapter.js';
|
|
2
|
+
import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveryScope, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode } from './adapter.js';
|
|
3
3
|
export type MemoryRoom = DiscoveredRoom & {
|
|
4
4
|
model?: ModelResult;
|
|
5
5
|
selectionModel?: ModelResult;
|
|
6
6
|
documents?: Readonly<Record<string, string>>;
|
|
7
7
|
revisions?: Readonly<Record<string, string>>;
|
|
8
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
8
9
|
changes?: Readonly<Record<string, HeadChange>>;
|
|
9
10
|
binaryFiles?: Readonly<Record<string, BinaryFile>>;
|
|
10
11
|
blobs?: Readonly<Record<string, Blob>>;
|
|
@@ -25,18 +26,23 @@ export type MemoryAdapterOptions = {
|
|
|
25
26
|
retention?: Retention;
|
|
26
27
|
member?: Member;
|
|
27
28
|
unopened?: boolean;
|
|
29
|
+
exhaustiveDiscovery?: true;
|
|
28
30
|
};
|
|
29
31
|
export type MemoryAdapter = Adapter & {
|
|
30
32
|
setRooms(rooms: readonly MemoryRoom[]): void;
|
|
31
33
|
setConversations(conversations: readonly MemoryConversation[]): void;
|
|
32
34
|
script(operation: keyof Adapter, answer: unknown): void;
|
|
33
35
|
open(): void;
|
|
34
|
-
close(
|
|
36
|
+
close(closing?: {
|
|
37
|
+
revoked?: boolean;
|
|
38
|
+
lost?: boolean;
|
|
39
|
+
}): void;
|
|
35
40
|
expire(locators: readonly string[]): void;
|
|
36
41
|
notifyRoomVersion(notification: {
|
|
37
42
|
locator: string;
|
|
38
43
|
roomVersion: string;
|
|
39
44
|
}): void;
|
|
45
|
+
notifyAuthorityChanged(scope?: DiscoveryScope): void;
|
|
40
46
|
notifyConversation(event: ConversationEvent): void;
|
|
41
47
|
notifyServiceMode(mode: ServiceMode): void;
|
|
42
48
|
heldRooms(): readonly string[];
|
package/dist/memory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAEZ,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAEZ,KAAK,UAAU,EAMf,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAItB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,UAAU,EAGf,KAAK,kBAAkB,EACvB,KAAK,MAAM,EAGX,KAAK,aAAa,EAIlB,KAAK,SAAS,EAGd,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAkBtB,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG;IACxC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,SAAS,CAAC,EAAE,QAAQ,CA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AAS,UAAU,EAAE,GAAG,IAAI,CAAC;IAC7C,gBAAgB,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI,CAAC;IACrE,MAAM,CAAC,SAAS,EAAE,MAAM,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACxD,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC7D,MAAM,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1C,iBAAiB,CAAC,YAAY,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChF,sBAAsB,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACrD,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnD,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,SAAS,IAAI,SAAS,MAAM,EAAE,CAAC;IAC/B,uBAAuB,IAAI,SAAS,MAAM,EAAE,CAAC;CAC9C,CAAC;AAiDF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAggBrF"}
|
package/dist/memory.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { sameChange } from './overlay.js';
|
|
2
2
|
const FIXTURE_RETENTION = {
|
|
3
3
|
history: { kind: 'duration', seconds: 1 },
|
|
4
|
-
outcome:
|
|
4
|
+
outcome: 604_800,
|
|
5
5
|
refreshHorizon: 1,
|
|
6
6
|
};
|
|
7
7
|
function declaredRetention(value) {
|
|
@@ -55,6 +55,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
55
55
|
const scripted = new Map();
|
|
56
56
|
const unsealed = new Map();
|
|
57
57
|
const sealed = new Set();
|
|
58
|
+
const sentTurns = new Map();
|
|
58
59
|
const historyPageSize = options.historyPageSize;
|
|
59
60
|
let held = [];
|
|
60
61
|
let expiring = [];
|
|
@@ -121,6 +122,9 @@ export function createMemoryAdapter(options = {}) {
|
|
|
121
122
|
...(opening ? { models: modelsOf(room) } : {}),
|
|
122
123
|
documents: named(room.documents ?? {}, taken),
|
|
123
124
|
revisions: named(room.revisions ?? {}, [...taken, ...targets]),
|
|
125
|
+
...(room.fileIds === undefined
|
|
126
|
+
? {}
|
|
127
|
+
: { fileIds: named(room.fileIds, [...taken, ...targets]) }),
|
|
124
128
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
125
129
|
binaryFiles: named(room.binaryFiles ?? {}, targets),
|
|
126
130
|
...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
|
|
@@ -132,6 +136,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
132
136
|
const currentTargets = new Set(Object.keys(room.binaryFiles ?? {}));
|
|
133
137
|
const previousTargets = new Set(Object.keys(from.binaryFiles ?? {}));
|
|
134
138
|
const headMoved = (path) => room.revisions?.[path] !== from.revisions?.[path] ||
|
|
139
|
+
room.fileIds?.[path] !== from.fileIds?.[path] ||
|
|
135
140
|
!sameChange(room.changes?.[path], from.changes?.[path]);
|
|
136
141
|
const changed = Object.keys(current)
|
|
137
142
|
.filter((path) => current[path] !== previous[path] || headMoved(path))
|
|
@@ -153,6 +158,9 @@ export function createMemoryAdapter(options = {}) {
|
|
|
153
158
|
...(models === undefined ? {} : { models }),
|
|
154
159
|
documents: named(current, taken),
|
|
155
160
|
revisions: named(room.revisions ?? {}, [...taken, ...targets]),
|
|
161
|
+
...(room.fileIds === undefined
|
|
162
|
+
? {}
|
|
163
|
+
: { fileIds: named(room.fileIds, [...taken, ...targets]) }),
|
|
156
164
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
157
165
|
binaryFiles: named(room.binaryFiles ?? {}, targets),
|
|
158
166
|
removals: opening
|
|
@@ -220,9 +228,15 @@ export function createMemoryAdapter(options = {}) {
|
|
|
220
228
|
if (outcome !== undefined)
|
|
221
229
|
return outcome;
|
|
222
230
|
if (name === 'conversation.send') {
|
|
231
|
+
const operation = typeof input.operation_id === 'string' ? input.operation_id : null;
|
|
232
|
+
const answered = operation === null ? undefined : sentTurns.get(operation);
|
|
233
|
+
if (answered !== undefined)
|
|
234
|
+
return { kind: 'action', result: { turn: answered } };
|
|
223
235
|
issued += 1;
|
|
224
236
|
const turn = `turn-${issued}`;
|
|
225
237
|
unsealed.set(turn, named);
|
|
238
|
+
if (operation !== null)
|
|
239
|
+
sentTurns.set(operation, turn);
|
|
226
240
|
return { kind: 'action', result: { turn } };
|
|
227
241
|
}
|
|
228
242
|
if (name === 'conversation.cancel') {
|
|
@@ -253,6 +267,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
253
267
|
};
|
|
254
268
|
}
|
|
255
269
|
return {
|
|
270
|
+
...(options.exhaustiveDiscovery === undefined ? {} : { exhaustiveDiscovery: true }),
|
|
256
271
|
setRooms(next) {
|
|
257
272
|
rooms = [...next];
|
|
258
273
|
retain(rooms);
|
|
@@ -265,9 +280,9 @@ export function createMemoryAdapter(options = {}) {
|
|
|
265
280
|
for (const observer of observers)
|
|
266
281
|
observer({ kind: 'opened' });
|
|
267
282
|
},
|
|
268
|
-
close(revoked = false) {
|
|
283
|
+
close({ revoked = false, lost = !revoked } = {}) {
|
|
269
284
|
for (const observer of observers)
|
|
270
|
-
observer({ kind: 'closed', revoked });
|
|
285
|
+
observer({ kind: 'closed', revoked, lost });
|
|
271
286
|
},
|
|
272
287
|
expire(locators) {
|
|
273
288
|
expiring = [...locators];
|
|
@@ -276,6 +291,13 @@ export function createMemoryAdapter(options = {}) {
|
|
|
276
291
|
for (const observer of observers)
|
|
277
292
|
observer({ kind: 'room-version', locator, roomVersion });
|
|
278
293
|
},
|
|
294
|
+
notifyAuthorityChanged(scope) {
|
|
295
|
+
for (const observer of observers) {
|
|
296
|
+
observer(scope === undefined
|
|
297
|
+
? { kind: 'authority-changed' }
|
|
298
|
+
: { kind: 'authority-changed', scope });
|
|
299
|
+
}
|
|
300
|
+
},
|
|
279
301
|
notifyConversation(event) {
|
|
280
302
|
if (event.kind === 'accepted-message') {
|
|
281
303
|
sealed.add(event.message.turn);
|
|
@@ -336,17 +358,19 @@ export function createMemoryAdapter(options = {}) {
|
|
|
336
358
|
},
|
|
337
359
|
reopen() {
|
|
338
360
|
queueMicrotask(() => {
|
|
339
|
-
for (const observer of observers)
|
|
340
|
-
observer({ kind: 'closed', revoked: false });
|
|
361
|
+
for (const observer of observers) {
|
|
362
|
+
observer({ kind: 'closed', revoked: false, lost: false });
|
|
363
|
+
}
|
|
341
364
|
});
|
|
342
365
|
},
|
|
366
|
+
published() { },
|
|
343
367
|
observe(notify) {
|
|
344
368
|
observers.add(notify);
|
|
345
369
|
queueMicrotask(() => {
|
|
346
370
|
if (!observers.has(notify))
|
|
347
371
|
return;
|
|
348
372
|
if (options.unopened === true) {
|
|
349
|
-
notify({ kind: 'closed', revoked: false });
|
|
373
|
+
notify({ kind: 'closed', revoked: false, lost: true });
|
|
350
374
|
return;
|
|
351
375
|
}
|
|
352
376
|
announceList();
|
|
@@ -429,7 +453,13 @@ export function createMemoryAdapter(options = {}) {
|
|
|
429
453
|
retryable: false,
|
|
430
454
|
affected: {},
|
|
431
455
|
};
|
|
432
|
-
}, request).then((answer) =>
|
|
456
|
+
}, request).then((answer) => {
|
|
457
|
+
const destination = request.changeBatch.between?.destination.room;
|
|
458
|
+
if (answer.kind === 'accepted' && answer.destination !== undefined && destination) {
|
|
459
|
+
note(destination, answer.destination);
|
|
460
|
+
}
|
|
461
|
+
return note(request.locator, answer);
|
|
462
|
+
});
|
|
433
463
|
},
|
|
434
464
|
async history(_authorization, request) {
|
|
435
465
|
return resolveScript(scripts.history, () => {
|
|
@@ -454,18 +484,19 @@ export function createMemoryAdapter(options = {}) {
|
|
|
454
484
|
const blob = room.blobs?.[request.path];
|
|
455
485
|
return blob === undefined
|
|
456
486
|
? { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false }
|
|
457
|
-
: { kind: 'binary', blob };
|
|
487
|
+
: { kind: 'binary', body: blob.stream(), mediaType: blob.type };
|
|
458
488
|
}, request);
|
|
459
489
|
},
|
|
490
|
+
async link(_authorization, request) {
|
|
491
|
+
return resolveScript(scripts.link, () => ({ kind: 'rejected', code: 'unscripted-link', fields: {}, retryable: false }), request);
|
|
492
|
+
},
|
|
460
493
|
referrerScope(referrer) {
|
|
461
494
|
if (typeof referrer !== 'object' || referrer === null)
|
|
462
495
|
return null;
|
|
463
|
-
const { room, path
|
|
464
|
-
if (typeof message === 'string')
|
|
465
|
-
return { kind: 'conversations' };
|
|
496
|
+
const { room, path } = referrer;
|
|
466
497
|
if (typeof room !== 'string')
|
|
467
498
|
return null;
|
|
468
|
-
return {
|
|
499
|
+
return { locator: room, ...(typeof path === 'string' ? { path } : {}) };
|
|
469
500
|
},
|
|
470
501
|
async action(_authorization, request) {
|
|
471
502
|
return resolveScript(scripts.action, () => {
|
package/dist/model.d.ts
CHANGED
|
@@ -29,12 +29,13 @@ export type ModelState = {
|
|
|
29
29
|
types: VerifiedModel['types'];
|
|
30
30
|
};
|
|
31
31
|
export type TypesResult = {
|
|
32
|
-
status: 'unavailable'
|
|
32
|
+
status: Open<'unavailable'>;
|
|
33
33
|
reason: ModelUnavailableReason;
|
|
34
|
+
types: null;
|
|
34
35
|
schema?: string | null;
|
|
35
36
|
revision?: string | null;
|
|
36
37
|
} | {
|
|
37
|
-
status: 'current' | 'cached'
|
|
38
|
+
status: Open<'current' | 'cached'>;
|
|
38
39
|
identity: string;
|
|
39
40
|
version: string;
|
|
40
41
|
verifiedWith: ModelIdentity;
|
|
@@ -52,5 +53,6 @@ export declare function definitionOf(state: ModelState, type: string | undefined
|
|
|
52
53
|
export declare function modelTypes(state: ModelState): TypesResult;
|
|
53
54
|
export declare function cached(state: ModelState): ModelState;
|
|
54
55
|
export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
|
|
56
|
+
export declare function sameTyping(left: ModelState, right: ModelState): boolean;
|
|
55
57
|
export declare function referenceField(facts: ValueFacts | undefined): boolean;
|
|
56
58
|
//# sourceMappingURL=model.d.ts.map
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC/F,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAAC,CAAC;AACnG,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAChC,MAAM,MAAM,UAAU,GAClB;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GACD;IACE,MAAM,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AAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CASvE;AACD,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAErE"}
|
package/dist/model.js
CHANGED
|
@@ -6,7 +6,7 @@ export function definitionOf(state, type) {
|
|
|
6
6
|
}
|
|
7
7
|
export function modelTypes(state) {
|
|
8
8
|
return state.status === 'unavailable'
|
|
9
|
-
? { ...state }
|
|
9
|
+
? { ...state, types: null }
|
|
10
10
|
: {
|
|
11
11
|
status: state.status,
|
|
12
12
|
identity: state.snapshot.identity,
|
|
@@ -23,6 +23,15 @@ export function cached(state) {
|
|
|
23
23
|
export function sameModel(left, right) {
|
|
24
24
|
return left.identity === right.identity && left.version === right.version;
|
|
25
25
|
}
|
|
26
|
+
export function sameTyping(left, right) {
|
|
27
|
+
if (left === right)
|
|
28
|
+
return true;
|
|
29
|
+
if (left.status === 'unavailable' || right.status === 'unavailable') {
|
|
30
|
+
return left.status === right.status;
|
|
31
|
+
}
|
|
32
|
+
return (left.snapshot.schema === right.snapshot.schema &&
|
|
33
|
+
sameModel(left.verifiedWith, right.verifiedWith));
|
|
34
|
+
}
|
|
26
35
|
export function referenceField(facts) {
|
|
27
36
|
return facts?.reference !== undefined || facts?.items?.reference !== undefined;
|
|
28
37
|
}
|
package/dist/name.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../src/name.ts"],"names":[],"mappings":"AAgHA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|