mandala-computer-mcp 0.3.0 → 0.5.0
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 +462 -37
- package/dist/api.d.ts +12 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +262 -42
- package/dist/api.js.map +1 -1
- package/dist/artifacts.d.ts +63 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +81 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +35 -21
- package/dist/cli.js.map +1 -1
- package/dist/credentials.d.ts +33 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +395 -0
- package/dist/credentials.js.map +1 -0
- package/dist/errors.d.ts +53 -10
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +122 -35
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +11 -2
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +213 -95
- package/dist/events.js.map +1 -1
- package/dist/executions.d.ts +43 -0
- package/dist/executions.d.ts.map +1 -0
- package/dist/executions.js +162 -0
- package/dist/executions.js.map +1 -0
- package/dist/format.d.ts +11 -11
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +159 -16
- package/dist/format.js.map +1 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +4 -0
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +17 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +17 -0
- package/dist/limits.js.map +1 -0
- package/dist/paths.d.ts +42 -2
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +54 -3
- package/dist/paths.js.map +1 -1
- package/dist/poll.d.ts +5 -1
- package/dist/poll.d.ts.map +1 -1
- package/dist/poll.js +120 -16
- package/dist/poll.js.map +1 -1
- package/dist/results.d.ts +97 -0
- package/dist/results.d.ts.map +1 -0
- package/dist/results.js +263 -0
- package/dist/results.js.map +1 -0
- package/dist/server.d.ts +3 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +61 -9
- package/dist/server.js.map +1 -1
- package/dist/stdio.d.ts +5 -1
- package/dist/stdio.d.ts.map +1 -1
- package/dist/stdio.js +10 -4
- package/dist/stdio.js.map +1 -1
- package/dist/tool-filters.d.ts +38 -0
- package/dist/tool-filters.d.ts.map +1 -0
- package/dist/tool-filters.js +129 -0
- package/dist/tool-filters.js.map +1 -0
- package/dist/tools/account.d.ts +3 -0
- package/dist/tools/account.d.ts.map +1 -0
- package/dist/tools/account.js +122 -0
- package/dist/tools/account.js.map +1 -0
- package/dist/tools/activities.d.ts +3 -0
- package/dist/tools/activities.d.ts.map +1 -0
- package/dist/tools/activities.js +140 -0
- package/dist/tools/activities.js.map +1 -0
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/agent.js +72 -5
- package/dist/tools/agent.js.map +1 -1
- package/dist/tools/artifacts.d.ts +3 -0
- package/dist/tools/artifacts.d.ts.map +1 -0
- package/dist/tools/artifacts.js +97 -0
- package/dist/tools/artifacts.js.map +1 -0
- package/dist/tools/chat.d.ts +6 -0
- package/dist/tools/chat.d.ts.map +1 -0
- package/dist/tools/chat.js +192 -0
- package/dist/tools/chat.js.map +1 -0
- package/dist/tools/computers.d.ts.map +1 -1
- package/dist/tools/computers.js +300 -247
- package/dist/tools/computers.js.map +1 -1
- package/dist/tools/directory.d.ts +13 -0
- package/dist/tools/directory.d.ts.map +1 -0
- package/dist/tools/directory.js +88 -0
- package/dist/tools/directory.js.map +1 -0
- package/dist/tools/events.d.ts.map +1 -1
- package/dist/tools/events.js +66 -22
- package/dist/tools/events.js.map +1 -1
- package/dist/tools/executions.d.ts +3 -0
- package/dist/tools/executions.d.ts.map +1 -0
- package/dist/tools/executions.js +87 -0
- package/dist/tools/executions.js.map +1 -0
- package/dist/tools/guest.d.ts.map +1 -1
- package/dist/tools/guest.js +57 -17
- package/dist/tools/guest.js.map +1 -1
- package/dist/tools/input.d.ts.map +1 -1
- package/dist/tools/input.js +63 -5
- package/dist/tools/input.js.map +1 -1
- package/dist/tools/results.d.ts +30 -0
- package/dist/tools/results.d.ts.map +1 -0
- package/dist/tools/results.js +106 -0
- package/dist/tools/results.js.map +1 -0
- package/dist/tools/secrets.d.ts +58 -0
- package/dist/tools/secrets.d.ts.map +1 -0
- package/dist/tools/secrets.js +204 -0
- package/dist/tools/secrets.js.map +1 -0
- package/dist/tools/signals.d.ts +3 -0
- package/dist/tools/signals.d.ts.map +1 -0
- package/dist/tools/signals.js +116 -0
- package/dist/tools/signals.js.map +1 -0
- package/dist/tools/snapshots.d.ts.map +1 -1
- package/dist/tools/snapshots.js +213 -167
- package/dist/tools/snapshots.js.map +1 -1
- package/dist/tools/ssh.d.ts +3 -0
- package/dist/tools/ssh.d.ts.map +1 -0
- package/dist/tools/ssh.js +186 -0
- package/dist/tools/ssh.js.map +1 -0
- package/dist/tools/templates.d.ts.map +1 -1
- package/dist/tools/templates.js +9 -13
- package/dist/tools/templates.js.map +1 -1
- package/package.json +1 -1
package/dist/results.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { APIError, CancelledError } from './errors.js';
|
|
2
|
+
import { refused, withErrorMetadata } from './format.js';
|
|
3
|
+
export const RETAINED_OPERATION_MS = 90000;
|
|
4
|
+
export const PRESENTATION_DEFAULT = 4096, PRESENTATION_MAX = 16384, RETAINED_RESULT_MAX = 256 * 1024;
|
|
5
|
+
export class RetainedValueError extends Error {
|
|
6
|
+
constructor() {
|
|
7
|
+
super('Invalid or unsupported retained response or request.');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export const record = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
11
|
+
export const integer = (v, min = 0, max = Number.MAX_SAFE_INTEGER) => Number.isSafeInteger(v) && v >= min && v <= max;
|
|
12
|
+
export function requireValue(condition) {
|
|
13
|
+
if (!condition)
|
|
14
|
+
throw new RetainedValueError();
|
|
15
|
+
}
|
|
16
|
+
export const resultId = (v) => typeof v === 'string' && v.length === 36 && /^res_[a-f0-9]{32}$/.test(v);
|
|
17
|
+
export const executionId = (v) => typeof v === 'string' && v.length === 37 && /^exec_[a-f0-9]{32}$/.test(v);
|
|
18
|
+
export const scopeId = (v) => typeof v === 'string' && v.match(/^[A-Za-z0-9_-]{1,100}$/)?.[0] === v;
|
|
19
|
+
export const digest = (v) => typeof v === 'string' && v.length === 64 && /^[a-f0-9]{64}$/.test(v);
|
|
20
|
+
export function time(v) {
|
|
21
|
+
requireValue(typeof v === 'string' &&
|
|
22
|
+
v.endsWith('Z') &&
|
|
23
|
+
/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d{1,9})?Z$/.test(v));
|
|
24
|
+
const parsed = Date.parse(v);
|
|
25
|
+
requireValue(Number.isFinite(parsed) && new Date(parsed).toISOString().slice(0, 19) === v.slice(0, 19));
|
|
26
|
+
return (BigInt(Math.floor(parsed / 1000)) * 1000000000n +
|
|
27
|
+
BigInt((v.split('.')[1]?.slice(0, -1) ?? '').padEnd(9, '0')));
|
|
28
|
+
}
|
|
29
|
+
export function retainOptions(v) {
|
|
30
|
+
requireValue(record(v) &&
|
|
31
|
+
Object.keys(v).every((k) => k === 'max_bytes_per_stream' || k === 'retention_seconds'));
|
|
32
|
+
const out = {};
|
|
33
|
+
if ('max_bytes_per_stream' in v) {
|
|
34
|
+
requireValue(integer(v.max_bytes_per_stream, 1, 4 * 1024 * 1024));
|
|
35
|
+
out.max_bytes_per_stream = v.max_bytes_per_stream;
|
|
36
|
+
}
|
|
37
|
+
if ('retention_seconds' in v) {
|
|
38
|
+
requireValue(integer(v.retention_seconds, 1, 604800));
|
|
39
|
+
out.retention_seconds = v.retention_seconds;
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
export function retainIntent(v, background) {
|
|
44
|
+
if (v === undefined || v === false)
|
|
45
|
+
return undefined;
|
|
46
|
+
requireValue(!background);
|
|
47
|
+
return v === true ? true : retainOptions(v);
|
|
48
|
+
}
|
|
49
|
+
export function resultMetadata(v, computer, id, execution, options) {
|
|
50
|
+
requireValue(record(v) &&
|
|
51
|
+
v.version === 1 &&
|
|
52
|
+
resultId(v.result_id) &&
|
|
53
|
+
(!id || v.result_id === id) &&
|
|
54
|
+
v.computer_id === computer &&
|
|
55
|
+
scopeId(v.computer_id) &&
|
|
56
|
+
scopeId(v.account_id) &&
|
|
57
|
+
(v.workspace_id === null || scopeId(v.workspace_id)) &&
|
|
58
|
+
v.state === 'ready');
|
|
59
|
+
const sync = v.kind === 'synchronous-output';
|
|
60
|
+
requireValue(sync || v.kind === 'background-output');
|
|
61
|
+
requireValue(sync
|
|
62
|
+
? v.execution_id === null && v.source === 'exec_response'
|
|
63
|
+
: executionId(v.execution_id) && v.source === 'volatile_guest_files');
|
|
64
|
+
if (execution)
|
|
65
|
+
requireValue(!sync && v.execution_id === execution);
|
|
66
|
+
const start = time(v.capture_started_at), end = time(v.captured_at), expires = time(v.expires_at);
|
|
67
|
+
requireValue(end >= start && expires > end && expires - start <= 604800000000000n);
|
|
68
|
+
const o = v.execution_observation;
|
|
69
|
+
requireValue(record(o));
|
|
70
|
+
const observed = time(o.observed_at);
|
|
71
|
+
requireValue(observed >= start && observed <= end);
|
|
72
|
+
requireValue(o.status === 'exited'
|
|
73
|
+
? integer(o.exit_code, -2147483648, 2147483647)
|
|
74
|
+
: !sync && o.status === 'running' && !('exit_code' in o));
|
|
75
|
+
const observation = {
|
|
76
|
+
status: o.status,
|
|
77
|
+
observed_at: o.observed_at,
|
|
78
|
+
...(o.status === 'exited' ? { exit_code: o.exit_code } : {}),
|
|
79
|
+
};
|
|
80
|
+
const prefix = (p) => {
|
|
81
|
+
requireValue(record(p) &&
|
|
82
|
+
integer(p.bytes, 0, 4 * 1024 * 1024) &&
|
|
83
|
+
digest(p.sha256) &&
|
|
84
|
+
p.source_offset === 0 &&
|
|
85
|
+
p.next_source_offset === p.bytes);
|
|
86
|
+
if (sync)
|
|
87
|
+
requireValue(integer(p.source_response_bytes, p.bytes, 16 * 1024 * 1024) &&
|
|
88
|
+
typeof p.upstream_truncated === 'boolean' &&
|
|
89
|
+
p.end_reason === (p.bytes === p.source_response_bytes ? 'response_end' : 'byte_limit'));
|
|
90
|
+
else
|
|
91
|
+
requireValue(p.end_reason === 'observed_eof' || p.end_reason === 'byte_limit');
|
|
92
|
+
return {
|
|
93
|
+
bytes: p.bytes,
|
|
94
|
+
sha256: p.sha256,
|
|
95
|
+
source_offset: 0,
|
|
96
|
+
next_source_offset: p.bytes,
|
|
97
|
+
end_reason: p.end_reason,
|
|
98
|
+
...(sync
|
|
99
|
+
? {
|
|
100
|
+
source_response_bytes: p.source_response_bytes,
|
|
101
|
+
upstream_truncated: p.upstream_truncated,
|
|
102
|
+
}
|
|
103
|
+
: {}),
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
let diagnostic = null;
|
|
107
|
+
if (sync)
|
|
108
|
+
requireValue(v.diagnostic === null);
|
|
109
|
+
else {
|
|
110
|
+
const d = v.diagnostic;
|
|
111
|
+
requireValue(record(d) &&
|
|
112
|
+
integer(d.bytes, 0, 65536) &&
|
|
113
|
+
digest(d.sha256) &&
|
|
114
|
+
d.source === 'wrapper' &&
|
|
115
|
+
typeof d.diagnostic_truncated === 'boolean');
|
|
116
|
+
diagnostic = {
|
|
117
|
+
bytes: d.bytes,
|
|
118
|
+
sha256: d.sha256,
|
|
119
|
+
source: 'wrapper',
|
|
120
|
+
diagnostic_truncated: d.diagnostic_truncated,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
if (options) {
|
|
124
|
+
requireValue(record(v.stdout) &&
|
|
125
|
+
record(v.stderr) &&
|
|
126
|
+
integer(v.stdout.bytes, 0, options.max_bytes_per_stream ?? 1048576) &&
|
|
127
|
+
integer(v.stderr.bytes, 0, options.max_bytes_per_stream ?? 1048576) &&
|
|
128
|
+
expires - start <= BigInt(options.retention_seconds ?? 86400) * 1000000000n);
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
version: 1,
|
|
132
|
+
result_id: v.result_id,
|
|
133
|
+
kind: v.kind,
|
|
134
|
+
state: 'ready',
|
|
135
|
+
account_id: v.account_id,
|
|
136
|
+
computer_id: v.computer_id,
|
|
137
|
+
workspace_id: v.workspace_id,
|
|
138
|
+
execution_id: v.execution_id,
|
|
139
|
+
source: v.source,
|
|
140
|
+
capture_started_at: v.capture_started_at,
|
|
141
|
+
captured_at: v.captured_at,
|
|
142
|
+
expires_at: v.expires_at,
|
|
143
|
+
execution_observation: observation,
|
|
144
|
+
stdout: prefix(v.stdout),
|
|
145
|
+
stderr: prefix(v.stderr),
|
|
146
|
+
diagnostic,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export function resultQuery(stream, offset, limit = PRESENTATION_DEFAULT) {
|
|
150
|
+
requireValue(['stdout', 'stderr', 'diagnostic'].includes(stream) &&
|
|
151
|
+
integer(offset) &&
|
|
152
|
+
integer(limit, 1, PRESENTATION_MAX) &&
|
|
153
|
+
Number.isSafeInteger(offset + limit));
|
|
154
|
+
return { stream: stream, offset, limit };
|
|
155
|
+
}
|
|
156
|
+
export function binaryContent(bytes) {
|
|
157
|
+
try {
|
|
158
|
+
const text = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
159
|
+
if (!bytes.some((byte) => byte === 127 || (byte < 32 && byte !== 9 && byte !== 10 && byte !== 13)) &&
|
|
160
|
+
Buffer.from(text, 'utf8').equals(Buffer.from(bytes)))
|
|
161
|
+
return { text };
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
/* exact binary follows */
|
|
165
|
+
}
|
|
166
|
+
return { base64: Buffer.from(bytes).toString('base64') };
|
|
167
|
+
}
|
|
168
|
+
export function resultPage(response, id, query) {
|
|
169
|
+
const h = response.headers, bytes = response.bytes;
|
|
170
|
+
const number = (name) => {
|
|
171
|
+
const raw = h[name];
|
|
172
|
+
requireValue(typeof raw === 'string' &&
|
|
173
|
+
/^(0|[1-9][0-9]*)$/.test(raw) &&
|
|
174
|
+
String(Number(raw)) === raw &&
|
|
175
|
+
integer(Number(raw)));
|
|
176
|
+
return Number(raw);
|
|
177
|
+
};
|
|
178
|
+
requireValue(h['content-type']?.split(';')[0].trim().toLowerCase() === 'application/octet-stream');
|
|
179
|
+
requireValue(number('content-length') === bytes.length &&
|
|
180
|
+
number('x-result-offset') === query.offset &&
|
|
181
|
+
number('x-result-next-offset') === query.offset + bytes.length &&
|
|
182
|
+
bytes.length <= query.limit);
|
|
183
|
+
requireValue(h['x-result-eof'] === 'true' || h['x-result-eof'] === 'false');
|
|
184
|
+
const eof = h['x-result-eof'] === 'true';
|
|
185
|
+
requireValue(eof || bytes.length === query.limit);
|
|
186
|
+
return {
|
|
187
|
+
result_id: id,
|
|
188
|
+
stream: query.stream,
|
|
189
|
+
offset: query.offset,
|
|
190
|
+
next_offset: query.offset + bytes.length,
|
|
191
|
+
eof,
|
|
192
|
+
bytes: bytes.length,
|
|
193
|
+
...binaryContent(bytes),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/** One deadline for the whole callback, including metadata, bytes and presentation. */
|
|
197
|
+
export async function retainedCall(parent, mutation, fn) {
|
|
198
|
+
const controller = new AbortController(), abort = () => controller.abort(parent.reason);
|
|
199
|
+
parent.addEventListener('abort', abort, { once: true });
|
|
200
|
+
if (parent.aborted)
|
|
201
|
+
abort();
|
|
202
|
+
const timer = setTimeout(() => controller.abort(), RETAINED_OPERATION_MS), signal = controller.signal, end = performance.now() + RETAINED_OPERATION_MS;
|
|
203
|
+
try {
|
|
204
|
+
if (signal.aborted)
|
|
205
|
+
throw new CancelledError('cancelled');
|
|
206
|
+
const result = await fn(signal);
|
|
207
|
+
if (signal.aborted || performance.now() >= end)
|
|
208
|
+
throw new CancelledError('cancelled');
|
|
209
|
+
requireValue(Buffer.byteLength(JSON.stringify(result)) <= RETAINED_RESULT_MAX);
|
|
210
|
+
if (signal.aborted || performance.now() >= end)
|
|
211
|
+
throw new CancelledError('cancelled');
|
|
212
|
+
return result;
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
const suffix = mutation
|
|
216
|
+
? ' Publication or deletion may have committed; its response is unconfirmed. Do not repeat a capture or command to recover this answer.'
|
|
217
|
+
: ' No fallback or command replay was attempted.';
|
|
218
|
+
if (signal.aborted || error instanceof CancelledError)
|
|
219
|
+
return refused(`Retained operation cancelled.${suffix}`);
|
|
220
|
+
if (error instanceof APIError)
|
|
221
|
+
return withErrorMetadata(refused(`Retained operation failed (HTTP ${error.status}). Current authorization, availability or server support could not be confirmed.${suffix}`), error);
|
|
222
|
+
return refused(`Retained operation could not be completed or validated.${suffix}`);
|
|
223
|
+
}
|
|
224
|
+
finally {
|
|
225
|
+
clearTimeout(timer);
|
|
226
|
+
parent.removeEventListener('abort', abort);
|
|
227
|
+
controller.abort();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/** Optional metadata must never change an already executed command's interpretation. */
|
|
231
|
+
export function synchronousResultId(v, status) {
|
|
232
|
+
if (!record(v) ||
|
|
233
|
+
status !== 200 ||
|
|
234
|
+
!resultId(v.result_id) ||
|
|
235
|
+
v.timed_out !== false ||
|
|
236
|
+
!integer(v.exit_code, -2147483648, 2147483647) ||
|
|
237
|
+
typeof v.out_truncated !== 'boolean' ||
|
|
238
|
+
typeof v.err_truncated !== 'boolean')
|
|
239
|
+
return undefined;
|
|
240
|
+
for (const key of ['stdout_b64', 'stderr_b64']) {
|
|
241
|
+
const data = v[key];
|
|
242
|
+
if (typeof data !== 'string' || data.length > 22369624 || data.length % 4)
|
|
243
|
+
return undefined;
|
|
244
|
+
// Validate canonical padding without allocating the decoded large stream.
|
|
245
|
+
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', pad = data.endsWith('==') ? 2 : data.endsWith('=') ? 1 : 0;
|
|
246
|
+
for (let i = 0; i < data.length - pad; i++) {
|
|
247
|
+
const c = data.charCodeAt(i);
|
|
248
|
+
if (!((c >= 65 && c <= 90) ||
|
|
249
|
+
(c >= 97 && c <= 122) ||
|
|
250
|
+
(c >= 48 && c <= 57) ||
|
|
251
|
+
c === 43 ||
|
|
252
|
+
c === 47))
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
if (pad &&
|
|
256
|
+
(data.length < 4 || alphabet.indexOf(data[data.length - pad - 1]) & (pad === 2 ? 15 : 3)))
|
|
257
|
+
return undefined;
|
|
258
|
+
if ((data.length / 4) * 3 - pad > 16 * 1024 * 1024)
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
return v.result_id;
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAC3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,EACtC,gBAAgB,GAAG,KAAK,EACxB,mBAAmB,GAAG,GAAG,GAAG,IAAI,CAAC;AACnC,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C;QACE,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAChE,CAAC;CACF;AACD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAU,EAAgC,EAAE,CACjE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAA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AAC,CAAC,CAAC,CAAC,CAAC;YAEzF,OAAO,SAAS,CAAC;QACnB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI;YAAE,OAAO,SAAS,CAAC;IACvE,CAAC;IACD,OAAO,CAAC,CAAC,SAAS,CAAC;AACrB,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { type SessionConfig } from './session.js';
|
|
3
|
+
import { type ToolFilters } from './tool-filters.js';
|
|
3
4
|
import type { ToolOptions } from './tools/types.js';
|
|
4
5
|
export declare const SERVER_NAME = "mandala-computer";
|
|
5
|
-
export declare const SERVER_VERSION = "0.
|
|
6
|
-
export type ServerConfig = SessionConfig & Partial<ToolOptions> & {
|
|
6
|
+
export declare const SERVER_VERSION = "0.5.0";
|
|
7
|
+
export type ServerConfig = SessionConfig & ToolFilters & Partial<ToolOptions> & {
|
|
7
8
|
/** Internal HTTP hook: hold a session active for the real tool callback lifetime. */
|
|
8
9
|
activity?: () => () => void;
|
|
9
10
|
};
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQpE,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,mBAAmB,CAAC;AAkBjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,eAAO,MAAM,WAAW,qBAAqB,CAAC;AAC9C,eAAO,MAAM,cAAc,UAAU,CAAC;AA6CtC,MAAM,MAAM,YAAY,GAAG,aAAa,GACtC,WAAW,GACX,OAAO,CAAC,WAAW,CAAC,GAAG;IACrB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEJ;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,SAAS,CAmFzD"}
|
package/dist/server.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from '@modelcontextprotocol/sdk/types.js';
|
|
2
3
|
import { Session } from './session.js';
|
|
4
|
+
import { toolFilter } from './tool-filters.js';
|
|
5
|
+
import { registerAccount } from './tools/account.js';
|
|
6
|
+
import { registerActivities } from './tools/activities.js';
|
|
3
7
|
import { registerAgent } from './tools/agent.js';
|
|
8
|
+
import { registerArtifacts } from './tools/artifacts.js';
|
|
9
|
+
import { registerChat } from './tools/chat.js';
|
|
4
10
|
import { registerComputers } from './tools/computers.js';
|
|
11
|
+
import { registerDirectory } from './tools/directory.js';
|
|
5
12
|
import { registerEvents } from './tools/events.js';
|
|
13
|
+
import { registerExecutions } from './tools/executions.js';
|
|
6
14
|
import { registerGuest } from './tools/guest.js';
|
|
7
15
|
import { registerInput } from './tools/input.js';
|
|
16
|
+
import { registerResults } from './tools/results.js';
|
|
17
|
+
import { registerSecrets } from './tools/secrets.js';
|
|
18
|
+
import { registerSignals } from './tools/signals.js';
|
|
8
19
|
import { registerSnapshots } from './tools/snapshots.js';
|
|
20
|
+
import { registerSSH } from './tools/ssh.js';
|
|
9
21
|
import { registerTemplates } from './tools/templates.js';
|
|
10
22
|
import { registerWebhooks } from './tools/webhooks.js';
|
|
11
23
|
export const SERVER_NAME = 'mandala-computer';
|
|
12
|
-
export const SERVER_VERSION = '0.
|
|
24
|
+
export const SERVER_VERSION = '0.5.0';
|
|
13
25
|
/**
|
|
14
26
|
* Told to the client on connect, and shown to the model before any tool is
|
|
15
27
|
* called. It is the only place to say the things that are true of the whole
|
|
@@ -40,8 +52,16 @@ Things that are true here and are not obvious:
|
|
|
40
52
|
- Waiting for a FILE is its own call, because a directory has to be nominated before the machine reports anything under it: wait_for_file_change takes an absolute directory in the guest, makes sure the guest is genuinely watching it, and then blocks until something under it is created, changed or deleted. Use it for a build's output or a download landing, in place of running ls in a loop. Nominate the narrowest directory you care about — a home directory under a build reports one "too much changed" marker instead of the changes — and read that marker as "list the directory again", not as a failure.
|
|
41
53
|
- list_windows tells you what is on the screen as data. It is how you distinguish an application that failed to start from one that has not painted yet, which a screenshot alone cannot do.
|
|
42
54
|
- A computer suspends itself when nobody uses it — 30 minutes by default. Input, exec and file transfers all count as use and resume it. Screenshots deliberately do not, so a loop that only watches can see its own machine go down.
|
|
55
|
+
- Who you are is checked again while a call is in flight, not only when it starts, so a long call can be refused after part of its work is already done. A 401 or a 403 means the credential or the role behind it stopped being accepted: re-authenticate, or say what was refused. Do not resend it, and never resend one that creates, starts, moves, writes or deletes without first checking what took effect. A 402 is the plan as it stands now rather than a fault on the computer, and waiting does not change it. Any of the three can arrive with completed work attached — read that before deciding what is left to do.
|
|
43
56
|
- A 409 is not one thing, and retrying blindly is how a turn gets burned. Most describe a passing state and clear on their own: a guest still booting, a guest agent busy with another call. Some describe a DECISION about what you asked for — a size the host cannot run, a computer that has to be stopped first — and those answer the same way forever; the message says which, and usually says what to do instead. A 400 never clears.
|
|
44
57
|
- Growing a computer past what its host can run is the refusal worth knowing by name: update_computer says a move is possible, and move_computer is how you take that up. It moves the machine to different hardware and copies its disk, so say what it costs before you call it.`;
|
|
58
|
+
const filteredInstructions = `Mandala Computer gives you access to a Linux desktop in the cloud.
|
|
59
|
+
|
|
60
|
+
This session exposes a filtered set of tools. Use only the tools in its tool list; some desktop workflows may be unavailable. Pass computer_id explicitly on computer-specific calls unless a computer was already bound to this session. A running VM does not imply that its guest desktop is ready.
|
|
61
|
+
|
|
62
|
+
Read each available tool's description before calling it. Read-only access follows the tool's readOnlyHint annotation: a read that can resume or bill a computer is not read-only. A running computer still costs money, and passive observation does not prevent idle suspension.
|
|
63
|
+
|
|
64
|
+
Who you are is checked again while a call is in flight. A 401 or 403 means the credential or role stopped being accepted; a 402 means the current plan refuses the work. Do not resend these calls. Inspect any completed work attached before deciding what remains. A 409 may describe either a temporary condition or a decision that will not change on retry; read its message. A 400 never clears.`;
|
|
45
65
|
/**
|
|
46
66
|
* One MCP server over one account's API key.
|
|
47
67
|
*
|
|
@@ -50,16 +70,24 @@ Things that are true here and are not obvious:
|
|
|
50
70
|
* transport builds exactly one and that is the same thing with n=1.
|
|
51
71
|
*/
|
|
52
72
|
export function createServer(cfg) {
|
|
73
|
+
const filter = toolFilter(cfg);
|
|
53
74
|
const session = new Session(cfg);
|
|
54
75
|
const opts = { lifecycle: cfg.lifecycle ?? true };
|
|
55
|
-
const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION }, {
|
|
76
|
+
const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION }, {
|
|
77
|
+
capabilities: { logging: {}, tools: {} },
|
|
78
|
+
instructions: filter.filtered ? filteredInstructions : instructions(opts.lifecycle),
|
|
79
|
+
});
|
|
56
80
|
// A cancelled Streamable HTTP response can let transport.handleRequest()
|
|
57
81
|
// settle while the tool callback is still awaiting platform work. Wrap tool
|
|
58
82
|
// registration once so the HTTP session lease follows that real lifetime.
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
83
|
+
// Withheld tools never reach the SDK registry or acquire an activity lease.
|
|
84
|
+
const register = server.registerTool.bind(server);
|
|
85
|
+
let registered = false;
|
|
86
|
+
server.registerTool = ((...args) => {
|
|
87
|
+
const [name, config] = args;
|
|
88
|
+
if (!filter.allows(name, config.annotations))
|
|
89
|
+
return;
|
|
90
|
+
if (cfg.activity) {
|
|
63
91
|
const handlerIndex = args.length - 1;
|
|
64
92
|
const handler = args[handlerIndex];
|
|
65
93
|
args[handlerIndex] = async (...handlerArgs) => {
|
|
@@ -71,17 +99,41 @@ export function createServer(cfg) {
|
|
|
71
99
|
release?.();
|
|
72
100
|
}
|
|
73
101
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
102
|
+
}
|
|
103
|
+
if (!registered) {
|
|
104
|
+
server.server.removeRequestHandler('tools/list');
|
|
105
|
+
server.server.removeRequestHandler('tools/call');
|
|
106
|
+
}
|
|
107
|
+
const tool = register(...args);
|
|
108
|
+
registered = true;
|
|
109
|
+
return tool;
|
|
110
|
+
});
|
|
111
|
+
registerAccount(server, session, opts);
|
|
77
112
|
registerComputers(server, session, opts);
|
|
78
113
|
registerInput(server, session, opts);
|
|
79
114
|
registerGuest(server, session, opts);
|
|
115
|
+
registerExecutions(server, session, opts);
|
|
116
|
+
registerResults(server, session, opts);
|
|
117
|
+
registerArtifacts(server, session, opts);
|
|
80
118
|
registerSnapshots(server, session, opts);
|
|
81
119
|
registerTemplates(server, session, opts);
|
|
82
120
|
registerEvents(server, session, opts);
|
|
83
121
|
registerWebhooks(server, session, opts);
|
|
122
|
+
registerSSH(server, session, opts);
|
|
123
|
+
registerSecrets(server, session, opts);
|
|
84
124
|
registerAgent(server, session, opts);
|
|
125
|
+
registerDirectory(server, session, opts);
|
|
126
|
+
registerActivities(server, session, opts);
|
|
127
|
+
registerSignals(server, session, opts);
|
|
128
|
+
registerChat(server, session, opts);
|
|
129
|
+
// The SDK installs tool handlers on the first registration. An empty
|
|
130
|
+
// selection still needs a valid tools/list response and must refuse calls.
|
|
131
|
+
if (!registered) {
|
|
132
|
+
server.server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: [] }));
|
|
133
|
+
server.server.setRequestHandler(CallToolRequestSchema, () => {
|
|
134
|
+
throw new McpError(ErrorCode.InvalidParams, 'No tools are available in this session');
|
|
135
|
+
});
|
|
136
|
+
}
|
|
85
137
|
// The event sockets outlive every tool call by design (OPL-3926), so nothing
|
|
86
138
|
// in a tool can be the thing that closes them. This is the end of the
|
|
87
139
|
// session, which is the lifetime they actually have — without it an HTTP
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAsB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC;;;;;;;;;;;;GAYG;AACH,MAAM,YAAY,GAAG,CAAC,SAAkB,EAAE,EAAE,CAC1C;;;;KAIG,SAAS,CAAC,CAAC,CAAC,yCAAyC,CAAC,CAAC,CAAC,oBAAoB
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,sBAAsB,EACtB,QAAQ,GAET,MAAM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AAChB,CAAC"}
|
package/dist/stdio.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type ServerConfig } from './server.js';
|
|
2
|
+
export type StdioConfig = Omit<ServerConfig, 'apiKey'> & {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
profile?: string;
|
|
5
|
+
};
|
|
2
6
|
/**
|
|
3
7
|
* The local install: one process, one key, spawned by the MCP client.
|
|
4
8
|
*
|
|
@@ -7,5 +11,5 @@ import { type ServerConfig } from './server.js';
|
|
|
7
11
|
* here may ever write to stdout: that stream is the protocol, and one stray
|
|
8
12
|
* console.log is a parse error at the other end. Diagnostics go to stderr.
|
|
9
13
|
*/
|
|
10
|
-
export declare function runStdio(cfg
|
|
14
|
+
export declare function runStdio(cfg?: StdioConfig): Promise<void>;
|
|
11
15
|
//# sourceMappingURL=stdio.d.ts.map
|
package/dist/stdio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/F;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,GAAG,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCnE"}
|
package/dist/stdio.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
|
-
import {
|
|
2
|
+
import { resolveCredentials } from './credentials.js';
|
|
3
3
|
import { createServer } from './server.js';
|
|
4
4
|
/**
|
|
5
5
|
* The local install: one process, one key, spawned by the MCP client.
|
|
@@ -9,8 +9,14 @@ import { createServer } from './server.js';
|
|
|
9
9
|
* here may ever write to stdout: that stream is the protocol, and one stray
|
|
10
10
|
* console.log is a parse error at the other end. Diagnostics go to stderr.
|
|
11
11
|
*/
|
|
12
|
-
export async function runStdio(cfg) {
|
|
13
|
-
const
|
|
12
|
+
export async function runStdio(cfg = {}) {
|
|
13
|
+
const credentials = resolveCredentials(cfg);
|
|
14
|
+
const resolved = {
|
|
15
|
+
...cfg,
|
|
16
|
+
apiKey: credentials.apiKey,
|
|
17
|
+
baseUrl: credentials.baseUrl,
|
|
18
|
+
};
|
|
19
|
+
const server = createServer(resolved);
|
|
14
20
|
const transport = new StdioServerTransport();
|
|
15
21
|
await server.connect(transport);
|
|
16
22
|
// The end of the client, and therefore the end of this process.
|
|
@@ -38,6 +44,6 @@ export async function runStdio(cfg) {
|
|
|
38
44
|
const shutdown = () => void server.close().catch(() => { });
|
|
39
45
|
process.stdin.once('end', shutdown);
|
|
40
46
|
process.stdin.once('close', shutdown);
|
|
41
|
-
console.error(`mandala-computer-mcp on stdio → ${new URL(
|
|
47
|
+
console.error(`mandala-computer-mcp on stdio → ${new URL(credentials.baseUrl).origin}`);
|
|
42
48
|
}
|
|
43
49
|
//# sourceMappingURL=stdio.js.map
|
package/dist/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,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,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
/** Tags describe capabilities, not whether calling a tool is safe. */
|
|
3
|
+
export declare const TOOL_TAGS: {
|
|
4
|
+
readonly account: readonly ["get_account"];
|
|
5
|
+
readonly agent: readonly ["run_agent", "run_agent_chat"];
|
|
6
|
+
readonly activities: readonly ["list_activities", "get_activity", "get_activity_results"];
|
|
7
|
+
readonly signals: readonly ["read_signals"];
|
|
8
|
+
readonly artifacts: readonly ["publish_artifact", "get_artifact", "read_artifact", "delete_artifact"];
|
|
9
|
+
readonly computers: readonly ["list_computers", "get_computer", "use_computer", "wait_for_computer", "get_desktop_url", "list_sizes"];
|
|
10
|
+
readonly events: readonly ["wait_for_event", "poll_events", "wait_for_file_change"];
|
|
11
|
+
readonly executions: readonly ["get_execution", "read_execution_output"];
|
|
12
|
+
readonly files: readonly ["list_directory", "read_file", "write_file", "wait_for_file_change"];
|
|
13
|
+
readonly guest: readonly ["exec", "exec_poll", "exec_kill", "open_url", "list_windows", "window_action", "read_clipboard", "write_clipboard"];
|
|
14
|
+
readonly input: readonly ["screenshot", "click", "type_text", "press_key", "scroll", "drag", "move_mouse", "mouse_button", "cursor_position", "wait"];
|
|
15
|
+
readonly lifecycle: readonly ["create_computer", "start_computer", "stop_computer", "suspend_computer", "restart_computer", "update_computer", "clone_computer", "delete_computer", "move_computer", "list_moves"];
|
|
16
|
+
readonly results: readonly ["get_activity_results", "retain_execution_output", "get_result", "read_result_output", "delete_result"];
|
|
17
|
+
readonly snapshots: readonly ["list_snapshots", "snapshot_holdings", "create_snapshot", "restore_snapshot", "clone_snapshot", "snapshot_schedule", "get_retention", "delete_snapshot"];
|
|
18
|
+
readonly templates: readonly ["list_templates", "get_template_schema", "check_template", "publish_template", "get_template", "retire_template", "build_template", "list_builds", "get_build", "watch_build"];
|
|
19
|
+
readonly secrets: readonly ["get_computer_secrets", "set_computer_secrets"];
|
|
20
|
+
readonly ssh: readonly ["list_ssh_keys", "add_ssh_key", "remove_ssh_key", "get_computer_ssh", "set_computer_ssh"];
|
|
21
|
+
readonly usage: readonly ["get_usage"];
|
|
22
|
+
readonly webhooks: readonly ["list_webhooks", "create_webhook", "get_webhook", "update_webhook", "rotate_webhook_secret", "test_webhook", "list_webhook_deliveries", "delete_webhook"];
|
|
23
|
+
};
|
|
24
|
+
export type ToolTag = keyof typeof TOOL_TAGS;
|
|
25
|
+
export type ToolFilters = {
|
|
26
|
+
/** Keep only tools whose existing readOnlyHint is exactly true. */
|
|
27
|
+
readOnly?: boolean;
|
|
28
|
+
/** Union of these tags; absent or empty means all tags. Names are lowercase. */
|
|
29
|
+
tags?: readonly string[];
|
|
30
|
+
};
|
|
31
|
+
export declare const VALID_TAGS: ToolTag[];
|
|
32
|
+
export declare function parseToolTags(raw: string | undefined): ToolTag[];
|
|
33
|
+
/** Validate before constructing the session; never infer read-only from a name or verb. */
|
|
34
|
+
export declare function toolFilter(cfg: ToolFilters): {
|
|
35
|
+
filtered: boolean;
|
|
36
|
+
allows: (name: string, annotations?: ToolAnnotations) => boolean;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=tool-filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-filters.d.ts","sourceRoot":"","sources":["../src/tool-filters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E,sEAAsE;AACtE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;CA6FZ,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,SAAS,CAAC;AAC7C,MAAM,MAAM,WAAW,GAAG;IACxB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gFAAgF;IAChF,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAoC,OAAO,EAAE,CAAC;AAcrE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,EAAE,CAEhE;AAED,2FAA2F;AAC3F,wBAAgB,UAAU,CAAC,GAAG,EAAE,WAAW,GAAG;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC;CAClE,CAmBA"}
|