@agentshouse/mdruntime 0.1.0-ce531b51ff088 → 0.1.0-ce6bc9239a3ee
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 +25 -12
- package/dist/acceptance.d.ts +26 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +384 -0
- package/dist/adapter.d.ts +218 -62
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +1 -9
- package/dist/attached-model.d.ts +8 -0
- package/dist/attached-model.d.ts.map +1 -0
- package/dist/attached-model.js +46 -0
- package/dist/attempt.d.ts +16 -0
- package/dist/attempt.d.ts.map +1 -0
- package/dist/attempt.js +70 -0
- package/dist/binary.d.ts +18 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +8 -0
- package/dist/bootstrap.d.ts +40 -6
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +336 -51
- package/dist/chain.d.ts +12 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +64 -0
- package/dist/change-set.d.ts +9 -14
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +11 -56
- package/dist/change.d.ts +46 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +34 -0
- package/dist/chat-types.d.ts +3 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +2 -0
- package/dist/client.d.ts +50 -18
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +162 -30
- package/dist/collection.d.ts +13 -14
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +52 -56
- package/dist/compile.d.ts +16 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +717 -0
- package/dist/connection.d.ts +63 -48
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +2487 -1575
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +47 -0
- package/dist/conversation.d.ts +72 -22
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +1008 -273
- 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 +10 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +20 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +161 -0
- package/dist/expectation.d.ts +21 -0
- package/dist/expectation.d.ts.map +1 -0
- package/dist/expectation.js +70 -0
- package/dist/failure.d.ts +13 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/failure.js +19 -0
- package/dist/figures.d.ts +48 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/file.d.ts +2 -19
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +7 -122
- package/dist/host.d.ts +18 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +164 -50
- package/dist/identity.d.ts +3 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +13 -1
- package/dist/index.d.ts +31 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/install.d.ts +86 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +537 -0
- package/dist/job.d.ts +33 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +54 -0
- package/dist/live.d.ts +23 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +165 -0
- package/dist/log.d.ts +1 -0
- package/dist/log.d.ts.map +1 -1
- 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 +30 -9
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +337 -86
- package/dist/messages.d.ts +52 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +168 -0
- package/dist/model.d.ts +17 -16
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +9 -9
- 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 +22 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +133 -17
- package/dist/open.d.ts +2 -0
- package/dist/open.d.ts.map +1 -0
- package/dist/open.js +1 -0
- 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 +73 -5
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +84 -1
- package/dist/overlay.d.ts +16 -5
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +147 -180
- package/dist/parts.d.ts +59 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +118 -0
- package/dist/paths.d.ts +1 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -16
- package/dist/query.d.ts +56 -180
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -422
- package/dist/questions.d.ts +32 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +118 -0
- package/dist/reach.d.ts +54 -0
- package/dist/reach.d.ts.map +1 -0
- package/dist/reach.js +494 -0
- package/dist/react.d.ts +46 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +54 -0
- 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 +50 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +27 -0
- package/dist/reads.d.ts +36 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +136 -0
- package/dist/recovery.d.ts +26 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +232 -0
- package/dist/refresh.d.ts +21 -7
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +155 -55
- package/dist/replica.d.ts +58 -33
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +355 -158
- package/dist/room-draft.d.ts +62 -11
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +281 -83
- package/dist/room-drafts.d.ts +29 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +216 -0
- package/dist/rows.d.ts +32 -34
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +65 -87
- package/dist/save.d.ts +74 -6
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +902 -182
- package/dist/saves.d.ts +96 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +999 -0
- package/dist/search.d.ts +15 -54
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +10 -121
- package/dist/seed.d.ts +30 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +141 -0
- package/dist/shared.d.ts +15 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +421 -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/reads.d.ts +10 -0
- package/dist/socket/reads.d.ts.map +1 -0
- package/dist/socket/reads.js +31 -0
- package/dist/socket.d.ts +43 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +96 -0
- package/dist/source.d.ts +61 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +81 -0
- package/dist/status.d.ts +7 -4
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -15
- package/dist/store/fences.d.ts +16 -0
- package/dist/store/fences.d.ts.map +1 -0
- package/dist/store/fences.js +26 -0
- 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/records.d.ts +212 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +408 -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/watchers.d.ts +15 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +36 -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 +77 -94
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +118 -389
- package/dist/stored.d.ts +156 -0
- package/dist/stored.d.ts.map +1 -0
- package/dist/stored.js +637 -0
- package/dist/tables.d.ts +407 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +724 -0
- 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/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +75 -0
- package/dist/validation.d.ts +29 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +104 -0
- package/dist/windows.d.ts +11 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +16 -0
- package/dist/wire.d.ts +205 -19
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +95 -61
- package/package.json +33 -10
- package/AGENTS.md +0 -207
- package/dist/attachment.d.ts +0 -3
- package/dist/attachment.d.ts.map +0 -1
- package/dist/attachment.js +0 -8
- package/dist/read-side.d.ts +0 -14
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -371
package/dist/host.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { queryKey } from '@agentshouse/mdmodel';
|
|
1
2
|
import { composeRuntime, } from './connection.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { untilAnswered } from './recovery.js';
|
|
4
|
+
import { described } from './failure.js';
|
|
5
|
+
import { answeredResult } from './outcome.js';
|
|
6
|
+
import { AUTHORIZATION_ENDED, request, WIRE, } from './wire.js';
|
|
7
|
+
const NARROWED = new Set(['within', 'whole']);
|
|
4
8
|
function answered(md, app, writtenBy, member, input) {
|
|
5
9
|
switch (member) {
|
|
6
10
|
case 'rooms':
|
|
@@ -13,16 +17,40 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
13
17
|
return md.types(input[0]);
|
|
14
18
|
case 'save':
|
|
15
19
|
return md.save(input[0], input[1], writtenBy);
|
|
20
|
+
case 'saveParts':
|
|
21
|
+
return md.saveParts(input[0], input[1], writtenBy);
|
|
16
22
|
case 'history':
|
|
17
23
|
return md.history(input[0], input[1], input[2]);
|
|
24
|
+
case 'resolve':
|
|
25
|
+
return md.resolve(input[0], input[1], input[2]);
|
|
26
|
+
case 'binaryFile.read':
|
|
27
|
+
return md.binaryFile.read(input[0], input[1], input[2]);
|
|
28
|
+
case 'binaryFile.link':
|
|
29
|
+
return md.binaryFile.link(input[0], input[1], input[2]);
|
|
30
|
+
case 'binaryFile.show':
|
|
31
|
+
return md.binaryFile.show(input[0], input[1], input[2]);
|
|
32
|
+
case 'binaryFile.attach':
|
|
33
|
+
return md.binaryFile.attach(input[0], input[1]);
|
|
34
|
+
case 'binaryFile.part':
|
|
35
|
+
return md.binaryFile.part(input[0], input[1]);
|
|
18
36
|
case 'call':
|
|
19
37
|
return md.call(input[0], input[1]);
|
|
20
38
|
case 'reached':
|
|
21
39
|
return md.reached(input[0], input[1], input[2]);
|
|
22
40
|
case 'log':
|
|
23
41
|
return md.log();
|
|
42
|
+
case 'cleanUp':
|
|
43
|
+
return md.cleanUp();
|
|
44
|
+
case 'unsent':
|
|
45
|
+
return md.unsent();
|
|
46
|
+
case 'reset':
|
|
47
|
+
return md.reset();
|
|
48
|
+
case 'readAgain':
|
|
49
|
+
return md.readAgain();
|
|
24
50
|
case 'persistence':
|
|
25
51
|
return md.persistence();
|
|
52
|
+
case 'retry':
|
|
53
|
+
return md.retry();
|
|
26
54
|
case 'reauthorize':
|
|
27
55
|
return md.reauthorize();
|
|
28
56
|
case 'roomDraft.list':
|
|
@@ -30,13 +58,15 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
30
58
|
case 'roomDraft.read':
|
|
31
59
|
return md.roomDraft.read(input[0], input[1]);
|
|
32
60
|
case 'roomDraft.write':
|
|
33
|
-
return md.roomDraft.write(input[0], input[1], input[2], input[3]);
|
|
61
|
+
return md.roomDraft.write(input[0], input[1], input[2], input[3], input[4]);
|
|
34
62
|
case 'roomDraft.discard':
|
|
35
63
|
return md.roomDraft.discard(input[0], input[1], input[2]);
|
|
36
64
|
case 'presentation.read':
|
|
37
65
|
return md.presentation.read(app);
|
|
38
66
|
case 'presentation.write':
|
|
39
67
|
return md.presentation.write(app, input[0]);
|
|
68
|
+
case 'presentation.edit':
|
|
69
|
+
return md.presentation.edit(app, input[0]);
|
|
40
70
|
case 'conversation.list':
|
|
41
71
|
return md.conversation.list();
|
|
42
72
|
case 'conversation.read':
|
|
@@ -44,23 +74,36 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
44
74
|
case 'conversation.create':
|
|
45
75
|
return md.conversation.create(input[0]);
|
|
46
76
|
case 'conversation.send':
|
|
47
|
-
return md.conversation.send(input[0]);
|
|
77
|
+
return md.conversation.send(input[0], input[1], input[2]);
|
|
48
78
|
case 'conversation.answer':
|
|
49
79
|
return md.conversation.answer(input[0], input[1]);
|
|
50
80
|
case 'conversation.interrupt':
|
|
51
81
|
return md.conversation.interrupt(input[0]);
|
|
52
82
|
case 'conversation.kill':
|
|
53
83
|
return md.conversation.kill(input[0]);
|
|
54
|
-
case 'conversation.cancel':
|
|
55
|
-
return md.conversation.cancel(input[0], input[1]);
|
|
56
84
|
case 'conversation.delete':
|
|
57
85
|
return md.conversation.delete(input[0]);
|
|
58
86
|
case 'chatDraft.write':
|
|
59
|
-
return md.chatDraft.write(input[0], input[1]);
|
|
87
|
+
return md.chatDraft.write(input[0], input[1], input[2]);
|
|
88
|
+
case 'chatDraft.prepend':
|
|
89
|
+
return md.chatDraft.prepend(input[0], input[1]);
|
|
60
90
|
case 'chatDraft.discard':
|
|
61
91
|
return md.chatDraft.discard(input[0]);
|
|
62
92
|
}
|
|
63
93
|
}
|
|
94
|
+
function attempted(work) {
|
|
95
|
+
try {
|
|
96
|
+
return Promise.resolve(work());
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return Promise.reject(error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function answeredMessage(value) {
|
|
103
|
+
if (typeof value !== 'object' || value === null)
|
|
104
|
+
return false;
|
|
105
|
+
return !('result' in value) || answeredResult(value.result);
|
|
106
|
+
}
|
|
64
107
|
export function serveMdRuntime(options) {
|
|
65
108
|
const deploymentFacts = structuredClone(options.deploymentFacts);
|
|
66
109
|
const closing = new AbortController();
|
|
@@ -71,82 +114,114 @@ export function serveMdRuntime(options) {
|
|
|
71
114
|
if (options.signal?.aborted === true)
|
|
72
115
|
close();
|
|
73
116
|
const runtime = composeRuntime({ ...options, signal: closing.signal });
|
|
74
|
-
const { md
|
|
117
|
+
const { md } = runtime;
|
|
75
118
|
const attachments = new Map();
|
|
76
119
|
let authorized = true;
|
|
120
|
+
let opening = null;
|
|
121
|
+
const opened = () => (opening ??= untilAnswered(() => md.loaded(), closing.signal));
|
|
77
122
|
const watchFacts = (deliver) => {
|
|
78
123
|
deliver(structuredClone(deploymentFacts));
|
|
79
124
|
return () => { };
|
|
80
125
|
};
|
|
81
|
-
function attach(port, app, release) {
|
|
126
|
+
function attach(port, app, release, reach, code = 'stored') {
|
|
82
127
|
if (!authorized)
|
|
83
128
|
throw new Error(AUTHORIZATION_ENDED);
|
|
84
129
|
const writtenBy = release === undefined ? undefined : { app, release };
|
|
85
|
-
const
|
|
130
|
+
const view = runtime.within(reach ?? null, { target: app, code });
|
|
131
|
+
const observations = new Map();
|
|
132
|
+
const followed = new Set();
|
|
133
|
+
const answeredKeys = new Set();
|
|
134
|
+
let awaited = null;
|
|
86
135
|
let serving = true;
|
|
136
|
+
const answeredQuery = (query) => {
|
|
137
|
+
answeredKeys.add(queryKey(query));
|
|
138
|
+
if (awaited === null || !awaited.keys.every((key) => answeredKeys.has(key)))
|
|
139
|
+
return;
|
|
140
|
+
const { done } = awaited;
|
|
141
|
+
awaited = null;
|
|
142
|
+
done();
|
|
143
|
+
};
|
|
87
144
|
const send = (message) => {
|
|
88
|
-
port.postMessage(
|
|
145
|
+
port.postMessage(message);
|
|
89
146
|
};
|
|
90
147
|
const detach = () => {
|
|
91
148
|
if (!serving)
|
|
92
149
|
return;
|
|
93
150
|
serving = false;
|
|
94
|
-
for (const end of
|
|
151
|
+
for (const end of observations.values())
|
|
152
|
+
end();
|
|
153
|
+
observations.clear();
|
|
154
|
+
for (const end of [...followed])
|
|
95
155
|
end();
|
|
96
|
-
subscriptions.clear();
|
|
97
156
|
attachments.delete(detach);
|
|
98
157
|
};
|
|
158
|
+
const observe = (id, topic, input) => {
|
|
159
|
+
let resolved = false;
|
|
160
|
+
const deliver = (value) => {
|
|
161
|
+
if (!serving)
|
|
162
|
+
return;
|
|
163
|
+
send(resolved ? { kind: 'event', id, value } : { kind: 'result', id, value });
|
|
164
|
+
resolved = true;
|
|
165
|
+
if (topic === 'query' && answeredMessage(value))
|
|
166
|
+
answeredQuery(input[0]);
|
|
167
|
+
};
|
|
168
|
+
const fail = (error) => {
|
|
169
|
+
if (!serving || resolved)
|
|
170
|
+
return;
|
|
171
|
+
observations.get(id)?.();
|
|
172
|
+
observations.delete(id);
|
|
173
|
+
send({ kind: 'failure', id, ...described(error) });
|
|
174
|
+
};
|
|
175
|
+
observations.set(id, topic === 'deployment-facts'
|
|
176
|
+
? watchFacts(deliver)
|
|
177
|
+
: (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver, fail));
|
|
178
|
+
};
|
|
179
|
+
const reply = async (id, query, pending) => {
|
|
180
|
+
try {
|
|
181
|
+
const value = await pending;
|
|
182
|
+
if (!serving)
|
|
183
|
+
return;
|
|
184
|
+
send({ kind: 'result', id, value });
|
|
185
|
+
if (query !== undefined && answeredResult(value))
|
|
186
|
+
answeredQuery(query);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
if (serving)
|
|
190
|
+
send({ kind: 'failure', id, ...described(error) });
|
|
191
|
+
}
|
|
192
|
+
};
|
|
99
193
|
const serve = async (message) => {
|
|
100
194
|
if (message.kind === 'hello')
|
|
101
195
|
return;
|
|
102
196
|
if (message.kind === 'stop') {
|
|
103
|
-
|
|
104
|
-
|
|
197
|
+
observations.get(message.id)?.();
|
|
198
|
+
observations.delete(message.id);
|
|
105
199
|
return;
|
|
106
200
|
}
|
|
107
201
|
try {
|
|
108
|
-
if (message.kind !== 'observe'
|
|
202
|
+
if (message.kind !== 'observe')
|
|
109
203
|
await md.loaded();
|
|
204
|
+
else if (message.topic !== 'room-drafts')
|
|
205
|
+
await opened();
|
|
110
206
|
if (message.kind === 'observe') {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const deliver = (value) => {
|
|
114
|
-
if (!serving)
|
|
115
|
-
return;
|
|
116
|
-
send(resolved ? { kind: 'event', id, value } : { kind: 'result', id, value });
|
|
117
|
-
resolved = true;
|
|
118
|
-
};
|
|
119
|
-
subscriptions.set(id, topic === 'deployment-facts'
|
|
120
|
-
? watchFacts(deliver)
|
|
121
|
-
: watch(topic, topic === 'presentation' ? [app] : message.input, deliver));
|
|
207
|
+
if (serving)
|
|
208
|
+
observe(message.id, message.topic, message.input);
|
|
122
209
|
return;
|
|
123
210
|
}
|
|
124
|
-
const value = await answered(md, app, writtenBy, message.member, message.input);
|
|
125
|
-
if (serving)
|
|
126
|
-
send({ kind: 'result', id: message.id, value });
|
|
127
211
|
}
|
|
128
212
|
catch (error) {
|
|
129
|
-
if (serving)
|
|
130
|
-
send({
|
|
131
|
-
|
|
132
|
-
id: message.id,
|
|
133
|
-
message: error instanceof Error ? error.message : String(error),
|
|
134
|
-
});
|
|
135
|
-
}
|
|
213
|
+
if (serving)
|
|
214
|
+
send({ kind: 'failure', id: message.id, ...described(error) });
|
|
215
|
+
return;
|
|
136
216
|
}
|
|
217
|
+
const { id, member, input } = message;
|
|
218
|
+
const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ? view.md : md, app, writtenBy, member, input));
|
|
219
|
+
return reply(id, member === 'query' ? input[0] : undefined, pending);
|
|
137
220
|
};
|
|
138
221
|
port.addEventListener('message', (event) => {
|
|
139
222
|
if (!serving)
|
|
140
223
|
return;
|
|
141
|
-
const
|
|
142
|
-
if (wire === null)
|
|
143
|
-
return;
|
|
144
|
-
if (!wire.matching) {
|
|
145
|
-
send({ kind: 'refusal', refusal: PROTOCOL_MISMATCH });
|
|
146
|
-
detach();
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
const message = request(wire.message);
|
|
224
|
+
const message = request(event.data);
|
|
150
225
|
if (message === null)
|
|
151
226
|
return;
|
|
152
227
|
void serve(message);
|
|
@@ -154,22 +229,61 @@ export function serveMdRuntime(options) {
|
|
|
154
229
|
port.addEventListener('close', detach);
|
|
155
230
|
port.start();
|
|
156
231
|
attachments.set(detach, send);
|
|
157
|
-
return
|
|
232
|
+
return {
|
|
233
|
+
detach,
|
|
234
|
+
narrow(next) {
|
|
235
|
+
if (serving)
|
|
236
|
+
view.narrow(next);
|
|
237
|
+
},
|
|
238
|
+
answered(queries, done) {
|
|
239
|
+
const keys = queries.map(queryKey);
|
|
240
|
+
if (keys.every((key) => answeredKeys.has(key)))
|
|
241
|
+
done();
|
|
242
|
+
else
|
|
243
|
+
awaited = { keys, done };
|
|
244
|
+
},
|
|
245
|
+
readiness(deliver) {
|
|
246
|
+
if (!serving)
|
|
247
|
+
return () => { };
|
|
248
|
+
const stop = view.watch('readiness', [], (value) => {
|
|
249
|
+
if (serving)
|
|
250
|
+
deliver(value);
|
|
251
|
+
}, () => { });
|
|
252
|
+
const end = () => {
|
|
253
|
+
followed.delete(end);
|
|
254
|
+
stop();
|
|
255
|
+
};
|
|
256
|
+
followed.add(end);
|
|
257
|
+
return end;
|
|
258
|
+
},
|
|
259
|
+
};
|
|
158
260
|
}
|
|
159
261
|
return {
|
|
160
262
|
attach,
|
|
161
|
-
|
|
263
|
+
present(app, members) {
|
|
264
|
+
return md.presentation.edit(app, members);
|
|
265
|
+
},
|
|
266
|
+
seed(entry) {
|
|
267
|
+
runtime.seed(entry);
|
|
268
|
+
},
|
|
269
|
+
persisted(answer) {
|
|
270
|
+
runtime.persisted(answer);
|
|
271
|
+
},
|
|
272
|
+
async endAuthorization(holder) {
|
|
162
273
|
authorized = false;
|
|
163
274
|
for (const [detach, send] of [...attachments]) {
|
|
164
275
|
send({ kind: 'ended' });
|
|
165
276
|
detach();
|
|
166
277
|
}
|
|
167
278
|
close();
|
|
168
|
-
await
|
|
169
|
-
|
|
279
|
+
if (!(await options.database.ask({ kind: 'authored.end', holder: holder ?? null }))) {
|
|
280
|
+
await options.shell.dropGeneration();
|
|
281
|
+
}
|
|
170
282
|
},
|
|
171
283
|
stop() {
|
|
172
284
|
return runtime.stop();
|
|
173
285
|
},
|
|
174
286
|
};
|
|
175
287
|
}
|
|
288
|
+
export { entrySeedOf } from './seed.js';
|
|
289
|
+
export { createRecovery, retryDelay, } from './recovery.js';
|
package/dist/identity.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export declare function changeBatchIdentity(at?: number): string;
|
|
2
2
|
export declare function roomDraftRevision(): string;
|
|
3
|
+
export declare function chatDraftRevision(): string;
|
|
4
|
+
export declare function transferIdentity(): string;
|
|
5
|
+
export declare function binaryLocalId(): string;
|
|
3
6
|
//# 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;AAED,wBAAgB,iBAAiB,IAAI,MAAM,
|
|
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"}
|
package/dist/identity.js
CHANGED
|
@@ -10,8 +10,20 @@ 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
|
-
|
|
13
|
+
function randomIdentity() {
|
|
14
14
|
const bytes = new Uint8Array(16);
|
|
15
15
|
crypto.getRandomValues(bytes);
|
|
16
16
|
return [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
17
17
|
}
|
|
18
|
+
export function roomDraftRevision() {
|
|
19
|
+
return randomIdentity();
|
|
20
|
+
}
|
|
21
|
+
export function chatDraftRevision() {
|
|
22
|
+
return randomIdentity();
|
|
23
|
+
}
|
|
24
|
+
export function transferIdentity() {
|
|
25
|
+
return randomIdentity();
|
|
26
|
+
}
|
|
27
|
+
export function binaryLocalId() {
|
|
28
|
+
return randomIdentity();
|
|
29
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,38 @@
|
|
|
1
|
-
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction,
|
|
2
|
-
export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
|
|
3
|
-
export
|
|
4
|
-
export type {
|
|
5
|
-
export type {
|
|
1
|
+
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, AuthorityChange, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, SavedFacts, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, BootstrapPart, NotReady, HeldRoom, ListedAgent, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomChange, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, SearchAnswer, SearchAsk, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedPath, TypedSelection, } from './adapter.js';
|
|
2
|
+
export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
|
|
3
|
+
export { heldFacts } from './conversation-row.js';
|
|
4
|
+
export type { ConversationAsk, ConversationHeld, ConversationLast, ConversationStart, } from './conversation-row.js';
|
|
5
|
+
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
6
|
+
export type { AppRoom, AppTypedSelection, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, RoomSchemas, } from './connection.js';
|
|
7
|
+
export type { BinaryFileSurface, SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
|
|
6
8
|
export type { Observation } from './observation.js';
|
|
7
|
-
export type {
|
|
8
|
-
export type {
|
|
9
|
+
export type { DayFigures, Figures, FiguresResult, RoomFigures } from './figures.js';
|
|
10
|
+
export type { PresentationSurface, RoomDraftSurface } from './room-drafts.js';
|
|
11
|
+
export type { AttachAnswer, BinaryAnswer, BinaryLinkAnswer, CallResult, DownloadAnswer, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
|
|
12
|
+
export type { BinaryFileRecord } from './binary.js';
|
|
13
|
+
export type { RuntimeError } from './failure.js';
|
|
14
|
+
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
|
|
9
15
|
export type { SaveRefusal } from './save.js';
|
|
10
|
-
export type {
|
|
16
|
+
export type { SearchFound, SearchHit, SearchRequest, SearchResult } from './search.js';
|
|
17
|
+
export { CHAT_MESSAGE_TYPE, CHAT_TYPE } from './chat-types.js';
|
|
18
|
+
export { departure } from './change.js';
|
|
19
|
+
export { lineEnded, partsAfter, partsChanges } from './room-draft.js';
|
|
20
|
+
export { cutName, nameFrom, transliterated } from './name.js';
|
|
21
|
+
export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
|
|
22
|
+
export { contextFigure } from './context.js';
|
|
23
|
+
export { jobsRunning, openJobs, sessionEnded, type OpenJob, type RunningJob } from './job.js';
|
|
11
24
|
export { changeBatchIdentity } from './identity.js';
|
|
12
|
-
export
|
|
25
|
+
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
26
|
+
export { untilAnswered } from './recovery.js';
|
|
27
|
+
export { entriesIn, patching, sortedKeys } from './shared.js';
|
|
28
|
+
export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
|
|
29
|
+
export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
|
|
30
|
+
export type { RuntimeShell, UnsentKind, UnsentWork } from './durability.js';
|
|
31
|
+
export type { CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Installation, InstallationAmount, InstallationStep, Persistence, Readiness, ReadinessStatus, RoomCoverage, RoomPreparation, Space, TargetCoverage, } from './readiness.js';
|
|
32
|
+
export type { ObservedRead } from './reads.js';
|
|
13
33
|
export type { AttentionEntry, SyncStatus } from './status.js';
|
|
14
|
-
export type {
|
|
34
|
+
export type { Direction, DocumentQuery, Filter, GroupKey, GroupOrder, GroupQuery, GroupSelect, Key, LocalQuery, OrderOptions, Predicate, Related, Select, Value, Where, } from '@agentshouse/mdmodel';
|
|
35
|
+
export type { Awaits, Backlink, CoveredRoom, DocumentResult, GroupResult, GroupTotal, PendingResult, PendingRoom, QueryCoverage, QueryDocument, QueryGroup, QueryResult, QueryRows, } from './query.js';
|
|
15
36
|
export type { MdType, ModelIdentity, ModelSnapshot, ModelState, ModelResult, TypesResult, ValidationReceipt, } from './model.js';
|
|
16
37
|
export type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';
|
|
17
38
|
//# 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,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,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EACR,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,GACV,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 +1,14 @@
|
|
|
1
|
+
export { heldFacts } from './conversation-row.js';
|
|
2
|
+
export { CHAT_MESSAGE_TYPE, CHAT_TYPE } from './chat-types.js';
|
|
3
|
+
export { departure } from './change.js';
|
|
4
|
+
export { lineEnded, partsAfter, partsChanges } from './room-draft.js';
|
|
5
|
+
export { cutName, nameFrom, transliterated } from './name.js';
|
|
6
|
+
export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
|
|
7
|
+
export { contextFigure } from './context.js';
|
|
8
|
+
export { jobsRunning, openJobs, sessionEnded } from './job.js';
|
|
1
9
|
export { changeBatchIdentity } from './identity.js';
|
|
10
|
+
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
11
|
+
export { untilAnswered } from './recovery.js';
|
|
12
|
+
export { entriesIn, patching, sortedKeys } from './shared.js';
|
|
13
|
+
export { attempts, identities, intentOf, } from './attempt.js';
|
|
14
|
+
export { expectedList, expecting } from './expectation.js';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { AdapterFailure, Authorization, DiscoveredRoom, NotReady, RetryableRefusal, TypedPath } from './adapter.js';
|
|
2
|
+
import { attachedModel } from './attached-model.js';
|
|
3
|
+
import { type Reads } from './bootstrap.js';
|
|
4
|
+
import type { ChangeSet } from './change-set.js';
|
|
5
|
+
import type { ChangeBatch } from './change.js';
|
|
6
|
+
import type { Log } from './log.js';
|
|
7
|
+
import { type ModelState } from './model.js';
|
|
8
|
+
import type { Installation, RoomCoverage } from './readiness.js';
|
|
9
|
+
import { advancement, type Refresher } from './refresh.js';
|
|
10
|
+
import type { ReplicaRecord } from './replica.js';
|
|
11
|
+
import type { RuntimeSocket } from './socket.js';
|
|
12
|
+
import { type CoveredRoom, type InstallHold, type RoomCommit, type RuntimeStore, type Store, type View, type Work } from './store.js';
|
|
13
|
+
import { type Unconfirmed } from './transfer.js';
|
|
14
|
+
export type Live = () => boolean;
|
|
15
|
+
type Standing = {
|
|
16
|
+
readonly key: number | null;
|
|
17
|
+
readonly confirmed: number;
|
|
18
|
+
};
|
|
19
|
+
export type Unheld = {
|
|
20
|
+
readonly staged: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type Withheld = AdapterFailure | RetryableRefusal | NotReady | Unconfirmed;
|
|
23
|
+
type Settling = {
|
|
24
|
+
readonly room?: boolean;
|
|
25
|
+
readonly view?: View;
|
|
26
|
+
readonly commit?: Pick<RoomCommit, 'published' | 'refreshed'>;
|
|
27
|
+
};
|
|
28
|
+
type Landing = {
|
|
29
|
+
readonly kind: 'refreshed';
|
|
30
|
+
readonly from: Standing;
|
|
31
|
+
readonly remodelled: boolean;
|
|
32
|
+
} | {
|
|
33
|
+
readonly kind: 'bootstrapped';
|
|
34
|
+
readonly refreshed: boolean;
|
|
35
|
+
readonly from: Standing;
|
|
36
|
+
};
|
|
37
|
+
type Refreshed = {
|
|
38
|
+
kind: 'advanced';
|
|
39
|
+
record: ReplicaRecord;
|
|
40
|
+
from: Standing;
|
|
41
|
+
remodelled: boolean;
|
|
42
|
+
} | Exclude<Awaited<ReturnType<typeof advancement>>, {
|
|
43
|
+
kind: 'advanced';
|
|
44
|
+
}>;
|
|
45
|
+
export type Installer = {
|
|
46
|
+
readonly store: Store;
|
|
47
|
+
readonly socket: RuntimeSocket;
|
|
48
|
+
readonly journal: Log;
|
|
49
|
+
readonly roomTypes: Parameters<typeof attachedModel>[1];
|
|
50
|
+
readonly builtIn: ModelState;
|
|
51
|
+
readonly typedPaths: readonly TypedPath[];
|
|
52
|
+
unheldModel(locator: string): ModelState | undefined;
|
|
53
|
+
recover(): void;
|
|
54
|
+
queueReadiness(): void;
|
|
55
|
+
sweep(): void;
|
|
56
|
+
settle(local: RuntimeStore, locator: string, work: Work, record: ReplicaRecord, queue: readonly ChangeBatch[], settling: Settling): Promise<ChangeSet>;
|
|
57
|
+
readied(locator: string): void;
|
|
58
|
+
modelKept(locator: string): void;
|
|
59
|
+
name(locator: string): Promise<void>;
|
|
60
|
+
usable(room: DiscoveredRoom): void;
|
|
61
|
+
publishChangeSet(set: ChangeSet): Promise<void>;
|
|
62
|
+
unpair(local: RuntimeStore): Promise<void>;
|
|
63
|
+
statusShown(): Promise<void>;
|
|
64
|
+
submitLater(locator: string): void;
|
|
65
|
+
};
|
|
66
|
+
type Showing = Pick<Installer, 'store' | 'socket'>;
|
|
67
|
+
export declare function installationOf(store: Store, coverage: readonly RoomCoverage[], held: ReadonlyMap<string, CoveredRoom>): Installation;
|
|
68
|
+
export declare function roomInFlight(store: Store, locator: string): boolean;
|
|
69
|
+
export declare function forgetInstall(store: Store, locator: string): void;
|
|
70
|
+
export declare function caughtUpTo(installer: Installer, locator: string): void;
|
|
71
|
+
export declare function catching(store: Store, locator: string): void;
|
|
72
|
+
export declare function confirmedAgain(store: Store, locator: string): void;
|
|
73
|
+
export declare function standingAt(store: Store, locator: string, held: Pick<ReplicaRecord, 'key'> | undefined): Standing;
|
|
74
|
+
export declare function showing(system: Showing, locator: string, roomVersion: string, held: string | undefined): void;
|
|
75
|
+
export declare function olderThan(system: Showing, locator: string, roomVersion: string, held: string | undefined): boolean;
|
|
76
|
+
export declare function replaced(store: Store, locators: readonly string[]): void;
|
|
77
|
+
export declare function reachedBy({ store, socket }: Installer, locator: string, roomVersion: string): Promise<boolean>;
|
|
78
|
+
export declare function behind({ store, socket }: Installer, room: DiscoveredRoom): Promise<boolean>;
|
|
79
|
+
export declare function writtenAfter({ store, socket }: Installer, locator: string, roomVersion: string, path: string): Promise<boolean>;
|
|
80
|
+
export declare function pullRefresh(installer: Installer, authorized: Authorization, record: ReplicaRecord, liveness: Live, hold: InstallHold, refresh: Refresher): Promise<Refreshed>;
|
|
81
|
+
export declare function pullBootstrap(installer: Installer, authorized: Authorization, room: DiscoveredRoom, local: RuntimeStore, liveness: Live, prior: ReplicaRecord | undefined, from?: Reads, unheld?: Unheld): Promise<import("./bootstrap.js").Bootstrapped | NotReady | import("./adapter.js").RevokedAuthorization | import("./adapter.js").RoomNotReadable | Unconfirmed | {
|
|
82
|
+
readonly kind: 'transport-uncertainty';
|
|
83
|
+
} | RetryableRefusal | import("./adapter.js").ScopedRefusal>;
|
|
84
|
+
export declare function publish(installer: Installer, local: RuntimeStore, room: DiscoveredRoom, reached: ReplicaRecord, landing: Landing, live: Live): Promise<boolean>;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,QAAQ,EACR,gBAAgB,EAEhB,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAkC,KAAK,KAAK,EAAgB,MAAM,gBAAgB,CAAC;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EACV,YAAY,EAGZ,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,KAAK,SA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