@agentshouse/mdruntime 0.1.0-ca7c26c6bc27e → 0.1.0-ca8707258fdde
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 +200 -54
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +1 -9
- package/dist/attached-model.d.ts +7 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +40 -28
- 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 +37 -5
- 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 +61 -43
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +2377 -1476
- 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 +71 -22
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +996 -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 +11 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +134 -34
- 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 +22 -8
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +299 -94
- 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 -12
- 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 -4
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +120 -14
- 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 +52 -181
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -423
- 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 +19 -5
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +309 -92
- 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 +35 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +128 -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 +20 -7
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +155 -59
- package/dist/replica.d.ts +58 -34
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +355 -162
- package/dist/room-draft.d.ts +59 -11
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +276 -80
- 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 -93
- 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 +185 -45
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +75 -46
- package/package.json +33 -10
- package/AGENTS.md +0 -215
- 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 -18
- package/dist/read-side.d.ts.map +0 -1
- package/dist/read-side.js +0 -377
package/dist/host.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
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';
|
|
4
7
|
const NARROWED = new Set(['within', 'whole']);
|
|
5
8
|
function answered(md, app, writtenBy, member, input) {
|
|
6
9
|
switch (member) {
|
|
@@ -14,16 +17,40 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
14
17
|
return md.types(input[0]);
|
|
15
18
|
case 'save':
|
|
16
19
|
return md.save(input[0], input[1], writtenBy);
|
|
20
|
+
case 'saveParts':
|
|
21
|
+
return md.saveParts(input[0], input[1], writtenBy);
|
|
17
22
|
case 'history':
|
|
18
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]);
|
|
19
36
|
case 'call':
|
|
20
37
|
return md.call(input[0], input[1]);
|
|
21
38
|
case 'reached':
|
|
22
39
|
return md.reached(input[0], input[1], input[2]);
|
|
23
40
|
case 'log':
|
|
24
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();
|
|
25
50
|
case 'persistence':
|
|
26
51
|
return md.persistence();
|
|
52
|
+
case 'retry':
|
|
53
|
+
return md.retry();
|
|
27
54
|
case 'reauthorize':
|
|
28
55
|
return md.reauthorize();
|
|
29
56
|
case 'roomDraft.list':
|
|
@@ -31,13 +58,15 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
31
58
|
case 'roomDraft.read':
|
|
32
59
|
return md.roomDraft.read(input[0], input[1]);
|
|
33
60
|
case 'roomDraft.write':
|
|
34
|
-
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]);
|
|
35
62
|
case 'roomDraft.discard':
|
|
36
63
|
return md.roomDraft.discard(input[0], input[1], input[2]);
|
|
37
64
|
case 'presentation.read':
|
|
38
65
|
return md.presentation.read(app);
|
|
39
66
|
case 'presentation.write':
|
|
40
67
|
return md.presentation.write(app, input[0]);
|
|
68
|
+
case 'presentation.edit':
|
|
69
|
+
return md.presentation.edit(app, input[0]);
|
|
41
70
|
case 'conversation.list':
|
|
42
71
|
return md.conversation.list();
|
|
43
72
|
case 'conversation.read':
|
|
@@ -45,23 +74,36 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
45
74
|
case 'conversation.create':
|
|
46
75
|
return md.conversation.create(input[0]);
|
|
47
76
|
case 'conversation.send':
|
|
48
|
-
return md.conversation.send(input[0]);
|
|
77
|
+
return md.conversation.send(input[0], input[1], input[2]);
|
|
49
78
|
case 'conversation.answer':
|
|
50
79
|
return md.conversation.answer(input[0], input[1]);
|
|
51
80
|
case 'conversation.interrupt':
|
|
52
81
|
return md.conversation.interrupt(input[0]);
|
|
53
82
|
case 'conversation.kill':
|
|
54
83
|
return md.conversation.kill(input[0]);
|
|
55
|
-
case 'conversation.cancel':
|
|
56
|
-
return md.conversation.cancel(input[0], input[1]);
|
|
57
84
|
case 'conversation.delete':
|
|
58
85
|
return md.conversation.delete(input[0]);
|
|
59
86
|
case 'chatDraft.write':
|
|
60
|
-
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]);
|
|
61
90
|
case 'chatDraft.discard':
|
|
62
91
|
return md.chatDraft.discard(input[0]);
|
|
63
92
|
}
|
|
64
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
|
+
}
|
|
65
107
|
export function serveMdRuntime(options) {
|
|
66
108
|
const deploymentFacts = structuredClone(options.deploymentFacts);
|
|
67
109
|
const closing = new AbortController();
|
|
@@ -75,19 +117,32 @@ export function serveMdRuntime(options) {
|
|
|
75
117
|
const { md } = runtime;
|
|
76
118
|
const attachments = new Map();
|
|
77
119
|
let authorized = true;
|
|
120
|
+
let opening = null;
|
|
121
|
+
const opened = () => (opening ??= untilAnswered(() => md.loaded(), closing.signal));
|
|
78
122
|
const watchFacts = (deliver) => {
|
|
79
123
|
deliver(structuredClone(deploymentFacts));
|
|
80
124
|
return () => { };
|
|
81
125
|
};
|
|
82
|
-
function attach(port, app, release, reach) {
|
|
126
|
+
function attach(port, app, release, reach, code = 'stored') {
|
|
83
127
|
if (!authorized)
|
|
84
128
|
throw new Error(AUTHORIZATION_ENDED);
|
|
85
129
|
const writtenBy = release === undefined ? undefined : { app, release };
|
|
86
|
-
const view = runtime.within(reach ?? null);
|
|
130
|
+
const view = runtime.within(reach ?? null, { target: app, code });
|
|
87
131
|
const observations = new Map();
|
|
132
|
+
const followed = new Set();
|
|
133
|
+
const answeredKeys = new Set();
|
|
134
|
+
let awaited = null;
|
|
88
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
|
+
};
|
|
89
144
|
const send = (message) => {
|
|
90
|
-
port.postMessage(
|
|
145
|
+
port.postMessage(message);
|
|
91
146
|
};
|
|
92
147
|
const detach = () => {
|
|
93
148
|
if (!serving)
|
|
@@ -96,6 +151,8 @@ export function serveMdRuntime(options) {
|
|
|
96
151
|
for (const end of observations.values())
|
|
97
152
|
end();
|
|
98
153
|
observations.clear();
|
|
154
|
+
for (const end of [...followed])
|
|
155
|
+
end();
|
|
99
156
|
attachments.delete(detach);
|
|
100
157
|
};
|
|
101
158
|
const observe = (id, topic, input) => {
|
|
@@ -105,10 +162,33 @@ export function serveMdRuntime(options) {
|
|
|
105
162
|
return;
|
|
106
163
|
send(resolved ? { kind: 'event', id, value } : { kind: 'result', id, value });
|
|
107
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) });
|
|
108
174
|
};
|
|
109
175
|
observations.set(id, topic === 'deployment-facts'
|
|
110
176
|
? watchFacts(deliver)
|
|
111
|
-
: (NARROWED.has(
|
|
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
|
+
}
|
|
112
192
|
};
|
|
113
193
|
const serve = async (message) => {
|
|
114
194
|
if (message.kind === 'hello')
|
|
@@ -119,39 +199,29 @@ export function serveMdRuntime(options) {
|
|
|
119
199
|
return;
|
|
120
200
|
}
|
|
121
201
|
try {
|
|
122
|
-
if (message.kind !== 'observe'
|
|
202
|
+
if (message.kind !== 'observe')
|
|
123
203
|
await md.loaded();
|
|
204
|
+
else if (message.topic !== 'room-drafts')
|
|
205
|
+
await opened();
|
|
124
206
|
if (message.kind === 'observe') {
|
|
125
207
|
if (serving)
|
|
126
208
|
observe(message.id, message.topic, message.input);
|
|
127
209
|
return;
|
|
128
210
|
}
|
|
129
|
-
const value = await answered(NARROWED.has(WIRE_REACH.members[message.member]) ? view.md : md, app, writtenBy, message.member, message.input);
|
|
130
|
-
if (serving)
|
|
131
|
-
send({ kind: 'result', id: message.id, value });
|
|
132
211
|
}
|
|
133
212
|
catch (error) {
|
|
134
|
-
if (serving)
|
|
135
|
-
send({
|
|
136
|
-
|
|
137
|
-
id: message.id,
|
|
138
|
-
message: error instanceof Error ? error.message : String(error),
|
|
139
|
-
});
|
|
140
|
-
}
|
|
213
|
+
if (serving)
|
|
214
|
+
send({ kind: 'failure', id: message.id, ...described(error) });
|
|
215
|
+
return;
|
|
141
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);
|
|
142
220
|
};
|
|
143
221
|
port.addEventListener('message', (event) => {
|
|
144
222
|
if (!serving)
|
|
145
223
|
return;
|
|
146
|
-
const
|
|
147
|
-
if (wire === null)
|
|
148
|
-
return;
|
|
149
|
-
if (!wire.matching) {
|
|
150
|
-
send({ kind: 'refusal', refusal: PROTOCOL_MISMATCH });
|
|
151
|
-
detach();
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const message = request(wire.message);
|
|
224
|
+
const message = request(event.data);
|
|
155
225
|
if (message === null)
|
|
156
226
|
return;
|
|
157
227
|
void serve(message);
|
|
@@ -165,22 +235,52 @@ export function serveMdRuntime(options) {
|
|
|
165
235
|
if (serving)
|
|
166
236
|
view.narrow(next);
|
|
167
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
|
+
},
|
|
168
259
|
};
|
|
169
260
|
}
|
|
170
261
|
return {
|
|
171
262
|
attach,
|
|
172
|
-
|
|
263
|
+
seed(entry) {
|
|
264
|
+
runtime.seed(entry);
|
|
265
|
+
},
|
|
266
|
+
persisted(answer) {
|
|
267
|
+
runtime.persisted(answer);
|
|
268
|
+
},
|
|
269
|
+
async endAuthorization(holder) {
|
|
173
270
|
authorized = false;
|
|
174
271
|
for (const [detach, send] of [...attachments]) {
|
|
175
272
|
send({ kind: 'ended' });
|
|
176
273
|
detach();
|
|
177
274
|
}
|
|
178
275
|
close();
|
|
179
|
-
await
|
|
180
|
-
|
|
276
|
+
if (!(await options.database.ask({ kind: 'authored.end', holder: holder ?? null }))) {
|
|
277
|
+
await options.shell.dropGeneration();
|
|
278
|
+
}
|
|
181
279
|
},
|
|
182
280
|
stop() {
|
|
183
281
|
return runtime.stop();
|
|
184
282
|
},
|
|
185
283
|
};
|
|
186
284
|
}
|
|
285
|
+
export { entrySeedOf } from './seed.js';
|
|
286
|
+
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,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,UAAU,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,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,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,YAAY,EACZ,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,SAAS,EACT,cAAc,GACf,MAAM,cAA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,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,eAAe,EACf,YAAY,EACZ,eAAe,EACf,KAAK,EACL,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,SAAS,EACT,aAAa,EACb,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,MAAM,EACN,QAAQ,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":[],"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