mandala-computer-mcp 0.1.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/LICENSE +21 -0
- package/README.md +544 -0
- package/dist/api.d.ts +186 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +932 -0
- package/dist/api.js.map +1 -0
- package/dist/cli.d.ts +55 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +292 -0
- package/dist/cli.js.map +1 -0
- package/dist/errors.d.ts +560 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +873 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +406 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +1679 -0
- package/dist/events.js.map +1 -0
- package/dist/format.d.ts +125 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +180 -0
- package/dist/format.js.map +1 -0
- package/dist/http.d.ts +46 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +792 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/paths.d.ts +394 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +677 -0
- package/dist/paths.js.map +1 -0
- package/dist/server.d.ts +18 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +97 -0
- package/dist/server.js.map +1 -0
- package/dist/session.d.ts +78 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +166 -0
- package/dist/session.js.map +1 -0
- package/dist/stdio.d.ts +11 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +43 -0
- package/dist/stdio.js.map +1 -0
- package/dist/tools/agent.d.ts +16 -0
- package/dist/tools/agent.d.ts.map +1 -0
- package/dist/tools/agent.js +147 -0
- package/dist/tools/agent.js.map +1 -0
- package/dist/tools/computers.d.ts +3 -0
- package/dist/tools/computers.d.ts.map +1 -0
- package/dist/tools/computers.js +1037 -0
- package/dist/tools/computers.js.map +1 -0
- package/dist/tools/events.d.ts +3 -0
- package/dist/tools/events.d.ts.map +1 -0
- package/dist/tools/events.js +1077 -0
- package/dist/tools/events.js.map +1 -0
- package/dist/tools/guest.d.ts +3 -0
- package/dist/tools/guest.d.ts.map +1 -0
- package/dist/tools/guest.js +761 -0
- package/dist/tools/guest.js.map +1 -0
- package/dist/tools/input.d.ts +3 -0
- package/dist/tools/input.d.ts.map +1 -0
- package/dist/tools/input.js +240 -0
- package/dist/tools/input.js.map +1 -0
- package/dist/tools/snapshots.d.ts +3 -0
- package/dist/tools/snapshots.d.ts.map +1 -0
- package/dist/tools/snapshots.js +333 -0
- package/dist/tools/snapshots.js.map +1 -0
- package/dist/tools/templates.d.ts +3 -0
- package/dist/tools/templates.d.ts.map +1 -0
- package/dist/tools/templates.js +492 -0
- package/dist/tools/templates.js.map +1 -0
- package/dist/tools/types.d.ts +18 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/webhooks.d.ts +3 -0
- package/dist/tools/webhooks.d.ts.map +1 -0
- package/dist/tools/webhooks.js +260 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { NotFoundError } from '../errors.js';
|
|
3
|
+
import { describe, guarded, incompleteWarning, json, refused, said, unwrapComputer, withoutCredentials, } from '../format.js';
|
|
4
|
+
import * as P from '../paths.js';
|
|
5
|
+
const idArg = {
|
|
6
|
+
computer_id: z
|
|
7
|
+
.string()
|
|
8
|
+
.optional()
|
|
9
|
+
.describe('Which computer. Defaults to the one selected with use_computer.'),
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The sentence in front of a retention window, for the reason every tool here
|
|
13
|
+
* leads with one: the model reads the text, and three integers in a JSON blob
|
|
14
|
+
* do not say what they select.
|
|
15
|
+
*
|
|
16
|
+
* Says what SURVIVES rather than restating the numbers. A tier at zero is left
|
|
17
|
+
* out entirely rather than printed as "0 monthly", which reads like a promise
|
|
18
|
+
* about monthlies; and an all-zero window — what an account with no active
|
|
19
|
+
* subscription reads — is stated as the plan granting no retained history,
|
|
20
|
+
* without claiming anything about what happens to snapshots already taken. The
|
|
21
|
+
* platform's own reference stops in the same place and for the same reason.
|
|
22
|
+
*/
|
|
23
|
+
const retentionLine = (r) => {
|
|
24
|
+
const v = (r ?? {});
|
|
25
|
+
const n = (x) => (typeof x === 'number' && Number.isFinite(x) && x > 0 ? x : 0);
|
|
26
|
+
const parts = [
|
|
27
|
+
n(v.daily) && `${n(v.daily)} daily`,
|
|
28
|
+
n(v.weekly) && `${n(v.weekly)} weekly`,
|
|
29
|
+
n(v.monthly) && `${n(v.monthly)} monthly`,
|
|
30
|
+
].filter(Boolean);
|
|
31
|
+
if (!parts.length) {
|
|
32
|
+
return 'This plan grants no retained automatic history. Snapshots you take by hand are unaffected — they are never removed automatically.';
|
|
33
|
+
}
|
|
34
|
+
return (`Automatic snapshots are kept: ${parts.join(', ')}. ` +
|
|
35
|
+
'That is the newest automatic snapshot in each of the last N periods THAT HAVE ONE — periods ' +
|
|
36
|
+
'containing a capture, not periods on the calendar, cut in UTC. Snapshots you take by hand are ' +
|
|
37
|
+
'never aged out.');
|
|
38
|
+
};
|
|
39
|
+
export const registerSnapshots = (server, session, opts) => {
|
|
40
|
+
// The lifecycle tools these descriptions point at, named only where they are
|
|
41
|
+
// registered. Under MANDALA_NO_LIFECYCLE, delete_computer, clone_snapshot and
|
|
42
|
+
// delete_snapshot are withheld — and a name in a surviving tool's description
|
|
43
|
+
// is the same idea by a different route as a name in the tool list: the model
|
|
44
|
+
// reads it and tries it. The server instructions were already parameterised on
|
|
45
|
+
// this; these were not.
|
|
46
|
+
const purgeWith = opts.lifecycle
|
|
47
|
+
? 'Read this before purging snapshots with delete_computer: the fingerprint is what binds the purge to the snapshots you were shown, so one that arrived after you looked cannot be swept up in it.'
|
|
48
|
+
: 'The fingerprint binds a purge to the snapshots you were shown, so one that arrived after you looked cannot be swept up in it. This server cannot purge them — it was started with the lifecycle tools withheld — so the count and the size are all this answers.';
|
|
49
|
+
server.registerTool('list_snapshots', {
|
|
50
|
+
title: 'List snapshots',
|
|
51
|
+
description: 'Every snapshot on this account. `orphaned` means its computer is gone: such a snapshot can still be cloned into a new computer, but cannot be restored, because a restore puts the disk back on a source that no longer exists. Read `state` before acting on a row: a capture still being taken is listed FIRST and is not a snapshot yet — it reads `capturing` and its id begins `cap-`, and restore, clone and delete all fail on one. `pending` is the point at which it can be acted on, and `durable` means it has reached backup storage as well.',
|
|
52
|
+
inputSchema: {
|
|
53
|
+
computer_id: z
|
|
54
|
+
.string()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe('Only snapshots of this computer. Omit for the whole account.'),
|
|
57
|
+
include_unfinished: z
|
|
58
|
+
.boolean()
|
|
59
|
+
.default(false)
|
|
60
|
+
.describe('Also return deletions that began and did not finish. They are not usable — their state is "deleting" and nothing can be restored or cloned from one — but they still hold objects and are still billed, so this is the flag to set when the question is about storage rather than about what can be restored.'),
|
|
61
|
+
allow_partial: z
|
|
62
|
+
.boolean()
|
|
63
|
+
.optional()
|
|
64
|
+
.describe('Accept a short list when a hypervisor cannot be reached, instead of the 503 the platform answers by default. The answer then says it is short.'),
|
|
65
|
+
},
|
|
66
|
+
annotations: { readOnlyHint: true },
|
|
67
|
+
}, ({ computer_id, include_unfinished, allow_partial }, extra) => guarded(async () => {
|
|
68
|
+
// One route and a filter here, still, now that OPL-3636 has put
|
|
69
|
+
// `GET computers/:id/snapshots` on this surface. That route is not a
|
|
70
|
+
// narrower version of this one — it answers a count, a byte total and a
|
|
71
|
+
// fingerprint, and never the snapshots themselves. Listing one
|
|
72
|
+
// computer's snapshots is this route and a filter, and always was.
|
|
73
|
+
// See snapshot_holdings for the other question.
|
|
74
|
+
//
|
|
75
|
+
// `listing` rather than `json`, and that matters more here than it looks.
|
|
76
|
+
// Without allow_partial the platform answers a short inventory with a
|
|
77
|
+
// 503, so the filter below can never quietly narrow one — but with it,
|
|
78
|
+
// a short list arrives as a 200 and the only thing saying so is
|
|
79
|
+
// X-GC-Incomplete. Filtering that to one computer and reporting the
|
|
80
|
+
// count would turn "some hosts did not answer" into a confident wrong
|
|
81
|
+
// number about a single machine.
|
|
82
|
+
const { items, incomplete } = await session.api
|
|
83
|
+
.with(extra.signal)
|
|
84
|
+
.listing(P.SNAPSHOTS, {
|
|
85
|
+
query: {
|
|
86
|
+
include: include_unfinished ? 'unfinished' : undefined,
|
|
87
|
+
allow_partial: allow_partial ? 1 : undefined,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
// The same check list_computers makes, for the same reason and one
|
|
91
|
+
// consequence milder: an object body sends `.filter` below into a
|
|
92
|
+
// TypeError, and an absent one — a 204, or a gateway answering 200 with
|
|
93
|
+
// nothing — becomes a confident "0 snapshot(s)" about a machine whose
|
|
94
|
+
// inventory never arrived.
|
|
95
|
+
if (!Array.isArray(items)) {
|
|
96
|
+
const got = items === undefined ? 'no body at all' : items === null ? 'null' : typeof items;
|
|
97
|
+
return refused(`GET /snapshots answered with ${got}, not a list of snapshots. This is not an empty list — do not conclude anything about what exists from it.`, items);
|
|
98
|
+
}
|
|
99
|
+
const malformed = items.filter((item) => item === null || typeof item !== 'object' || Array.isArray(item)).length;
|
|
100
|
+
const all = items.filter((item) => item !== null && typeof item === 'object' && !Array.isArray(item));
|
|
101
|
+
const warning = incompleteWarning('snapshots', incomplete) +
|
|
102
|
+
(malformed
|
|
103
|
+
? `WARNING: ignored ${malformed} malformed snapshot entr${malformed === 1 ? 'y' : 'ies'} from the platform.\n\n`
|
|
104
|
+
: '');
|
|
105
|
+
if (!all.length && malformed) {
|
|
106
|
+
return refused(`${warning}No valid snapshots remained. This is not an empty snapshot inventory — do not draw conclusions from the malformed listing.`, items);
|
|
107
|
+
}
|
|
108
|
+
// The filter keeps the unreachable placeholders, and that is not a
|
|
109
|
+
// nicety. A partial listing does not merely omit rows — the platform
|
|
110
|
+
// APPENDS one `{id, unreachable: true}` stub per snapshot it could not
|
|
111
|
+
// reach, and publicSnapshot drops `computer_id` from such a row because
|
|
112
|
+
// there is no daemon to have said what it belongs to. Filtering on
|
|
113
|
+
// equality therefore deletes precisely the markers that say something
|
|
114
|
+
// is missing, and then reports a count: the confident wrong number
|
|
115
|
+
// about one machine that the comment above says this guards against.
|
|
116
|
+
//
|
|
117
|
+
// They cannot be attributed to a computer, so keeping them over-reports
|
|
118
|
+
// for this one. That is the trade the platform itself makes and writes
|
|
119
|
+
// down in lib/hostroute: an extra unreachable row is visible and is
|
|
120
|
+
// corrected by the next complete answer, while a withheld one makes a
|
|
121
|
+
// row vanish mid-outage, which is the failure worth preventing.
|
|
122
|
+
// A filter that was GIVEN and trims to nothing is refused, not dropped.
|
|
123
|
+
// `" "` used to fall through to the unfiltered list, so a caller who
|
|
124
|
+
// asked about one computer was handed the whole account's inventory
|
|
125
|
+
// with nothing saying the filter had been ignored — the one shape of
|
|
126
|
+
// wrong answer a listing must not produce. Every other id path treats
|
|
127
|
+
// whitespace as absent and then REFUSES; this is that rule, here.
|
|
128
|
+
const filterId = computer_id?.trim();
|
|
129
|
+
if (computer_id !== undefined && !filterId) {
|
|
130
|
+
return refused('computer_id was given but is blank, and a blank filter would have listed every snapshot on ' +
|
|
131
|
+
'the account as though it belonged to one computer. Pass a real computer_id, or omit it ' +
|
|
132
|
+
'entirely to ask for the whole account.');
|
|
133
|
+
}
|
|
134
|
+
const rows = filterId
|
|
135
|
+
? all.filter((s) => s.computer_id === filterId || s.unreachable)
|
|
136
|
+
: all;
|
|
137
|
+
const stubs = rows.filter((s) => s.unreachable).length;
|
|
138
|
+
const note = stubs
|
|
139
|
+
? ` ${stubs} of these could not be read and are listed by id alone; they may or may not belong to this computer.`
|
|
140
|
+
: '';
|
|
141
|
+
return said(`${warning}${rows.length} snapshot(s).${note}`, rows);
|
|
142
|
+
}));
|
|
143
|
+
server.registerTool('snapshot_holdings', {
|
|
144
|
+
title: 'What a computer would leave behind',
|
|
145
|
+
description: `How many snapshots a computer has, what they weigh, and the fingerprint that names that exact set. ${purgeWith}`,
|
|
146
|
+
inputSchema: { ...idArg },
|
|
147
|
+
annotations: { readOnlyHint: true },
|
|
148
|
+
}, ({ computer_id }, extra) => guarded(async () => {
|
|
149
|
+
const id = session.resolve(computer_id);
|
|
150
|
+
const held = await session.api.with(extra.signal).json('GET', P.computerAction(id, 'snapshots'));
|
|
151
|
+
const count = typeof held.count === 'number' ? `${held.count} snapshot(s)` : 'an unknown count';
|
|
152
|
+
const size = typeof held.size_bytes === 'number'
|
|
153
|
+
? `${(held.size_bytes / 1e9).toFixed(2)} GB`
|
|
154
|
+
: 'an unknown total size';
|
|
155
|
+
const next = !opts.lifecycle
|
|
156
|
+
? 'This server cannot purge them — it was started with the lifecycle tools withheld.'
|
|
157
|
+
: held.fingerprint
|
|
158
|
+
? 'To delete them along with the computer, pass this fingerprint to delete_computer as `expect`.'
|
|
159
|
+
: 'The platform did not provide a fingerprint, so they cannot be safely purged with delete_computer; retry snapshot_holdings.';
|
|
160
|
+
return said(`${id} holds ${count}, ${size}. ${next}`, held);
|
|
161
|
+
}));
|
|
162
|
+
server.registerTool('create_snapshot', {
|
|
163
|
+
title: 'Snapshot a computer',
|
|
164
|
+
description: 'Capture a computer so it can be restored or forked later. A disk snapshot is the filesystem; a memory snapshot also saves the running session, so a fork of it comes up with the same processes and windows already open. Name it after the step it is about — that name is what picks it out of the list later.',
|
|
165
|
+
inputSchema: {
|
|
166
|
+
...idArg,
|
|
167
|
+
name: z
|
|
168
|
+
.string()
|
|
169
|
+
.optional()
|
|
170
|
+
.describe(
|
|
171
|
+
// Two sentences rather than a name substituted into one. The
|
|
172
|
+
// three-tool list carries "all take an id" and "the last of
|
|
173
|
+
// those" — grammar and a referent that both break when the list
|
|
174
|
+
// is one item, and the unrecoverable-wrong-guess warning is about
|
|
175
|
+
// delete_snapshot, which is not registered here to warn about
|
|
176
|
+
// (/code-review, OPL-4244).
|
|
177
|
+
opts.lifecycle
|
|
178
|
+
? 'What this capture is of: "before the upgrade", "clean install", "reproduces the bug". It is the only place the reason for taking it can be written down — restore_snapshot, clone_snapshot and delete_snapshot all take an id, so a set of captures of one computer is otherwise told apart by timestamp alone, and the wrong guess on the last of those is unrecoverable. Omit it and the platform names the snapshot after the computer and the time, which says when but never why.'
|
|
179
|
+
: 'What this capture is of: "before the upgrade", "clean install", "reproduces the bug". It is the only place the reason for taking it can be written down — restore_snapshot takes an id and nothing else, so a set of captures of one computer is otherwise told apart by timestamp alone, and restoring the wrong one overwrites a disk. Omit it and the platform names the snapshot after the computer and the time, which says when but never why.'),
|
|
180
|
+
memory: z
|
|
181
|
+
.boolean()
|
|
182
|
+
.default(false)
|
|
183
|
+
.describe('Include the running session. A memory snapshot is a saved machine, so it only loads back into the shape it came off: resize the computer afterwards and the restore is refused, because the vCPU count and the memory size are part of the state rather than decoration around it. Clone it instead in that case, which restores the disk and boots fresh.'),
|
|
184
|
+
},
|
|
185
|
+
}, ({ computer_id, name, memory }, extra) => guarded(async () => {
|
|
186
|
+
const id = session.resolve(computer_id);
|
|
187
|
+
const res = await session.api
|
|
188
|
+
.with(extra.signal)
|
|
189
|
+
.json('POST', P.computerAction(id, 'snapshots'), {
|
|
190
|
+
body: P.snapshotBody({ memory, name }),
|
|
191
|
+
});
|
|
192
|
+
// The name read back rather than the one sent, because the interesting
|
|
193
|
+
// case is the one that was not sent: the platform generates
|
|
194
|
+
// "<computer> <timestamp>" when `name` is absent, and that generated
|
|
195
|
+
// name is what a later list_snapshots will show. Saying it here is the
|
|
196
|
+
// difference between a caller that can find this capture again and one
|
|
197
|
+
// that has to go looking for it.
|
|
198
|
+
const called = typeof res?.name === 'string' && res.name.trim() ? ` as "${res.name}"` : '';
|
|
199
|
+
return said(`Snapshotted ${id}${memory ? ' with its memory' : ''}${called}.`, res);
|
|
200
|
+
}));
|
|
201
|
+
server.registerTool('restore_snapshot', {
|
|
202
|
+
title: 'Restore a snapshot',
|
|
203
|
+
description: `Put a snapshot back onto the computer it came from, discarding everything on that disk since. Refused on an orphaned snapshot${opts.lifecycle ? ' — clone_snapshot is what works there' : ', and this server cannot fork one either: it was started with the lifecycle tools withheld'}. It leaves the computer RUNNING whatever state it was in: restoring a stopped one boots it, which is a start like any other and is charged. A disk snapshot comes back to a fresh boot, a memory one to the captured session, and either way a suspended session the computer was holding is discarded with the disk it was saved against.`,
|
|
204
|
+
inputSchema: {
|
|
205
|
+
snapshot_id: z.string(),
|
|
206
|
+
confirm: z
|
|
207
|
+
.literal(true)
|
|
208
|
+
.describe("Must be true. This overwrites the source computer's current disk."),
|
|
209
|
+
},
|
|
210
|
+
annotations: { destructiveHint: true },
|
|
211
|
+
}, ({ snapshot_id }, extra) => guarded(async () => {
|
|
212
|
+
// An acknowledgement, which /api/v1 is free to send as a 204 — and
|
|
213
|
+
// `said` already omits the body when there is none to repeat.
|
|
214
|
+
const res = await session.api
|
|
215
|
+
.with(extra.signal)
|
|
216
|
+
.send('POST', P.snapshotAction(snapshot_id, 'restore'));
|
|
217
|
+
return said(`Restored ${snapshot_id}.`, res);
|
|
218
|
+
}));
|
|
219
|
+
server.registerTool('snapshot_schedule', {
|
|
220
|
+
title: 'Read or set the nightly snapshot',
|
|
221
|
+
description: 'When the platform takes this computer\'s automatic snapshot. Reading takes no arguments; setting takes an hour. There is deliberately no "last run" here — snapshots carry real capture times, and that is what a freshness check should read. This says when they are TAKEN and not how long they survive: `get_retention` is the other half, and it is what tells you whether the snapshots this schedule takes will still be there next month.',
|
|
222
|
+
inputSchema: {
|
|
223
|
+
...idArg,
|
|
224
|
+
set: z
|
|
225
|
+
.object({
|
|
226
|
+
enabled: z.boolean(),
|
|
227
|
+
hour: z.number().int().min(0).max(23),
|
|
228
|
+
minute: z.number().int().min(0).max(59).default(0),
|
|
229
|
+
tz: z.string().default('UTC').describe('An IANA zone, e.g. "America/New_York".'),
|
|
230
|
+
})
|
|
231
|
+
.optional()
|
|
232
|
+
.describe('Omit to read the current schedule. Include to replace it.'),
|
|
233
|
+
clear: z.boolean().default(false).describe('Remove the schedule entirely.'),
|
|
234
|
+
},
|
|
235
|
+
}, ({ computer_id, set, clear }, extra) => guarded(async () => {
|
|
236
|
+
const id = session.resolve(computer_id);
|
|
237
|
+
const path = P.computerAction(id, 'schedule');
|
|
238
|
+
// Acting on half a contradictory request is worse than refusing it: the
|
|
239
|
+
// schedule the caller sent would be dropped without mention, and the
|
|
240
|
+
// answer would say "Schedule cleared" — true, and not what was asked
|
|
241
|
+
// for. The platform makes the same call one tier down, refusing a
|
|
242
|
+
// rename and a resize in one request rather than picking one.
|
|
243
|
+
if (set && clear) {
|
|
244
|
+
return refused('Send `set` or `clear`, not both — they ask for opposite things and nothing was changed.');
|
|
245
|
+
}
|
|
246
|
+
if (clear)
|
|
247
|
+
return said('Schedule cleared.', await session.api.with(extra.signal).send('DELETE', path));
|
|
248
|
+
if (set) {
|
|
249
|
+
return said(`Snapshot scheduled for ${String(set.hour).padStart(2, '0')}:${String(set.minute).padStart(2, '0')} ${set.tz}.`, await session.api.with(extra.signal).send('PUT', path, { body: P.scheduleBody(set) }));
|
|
250
|
+
}
|
|
251
|
+
return json(await session.api.with(extra.signal).json('GET', path));
|
|
252
|
+
}));
|
|
253
|
+
server.registerTool('get_retention', {
|
|
254
|
+
title: 'Read how long automatic snapshots are kept',
|
|
255
|
+
description: "The plan's retention window — the other half of `snapshot_schedule`, which says when snapshots are taken and deliberately has no field for how long they survive. Read it before promising anyone that a backup will still be there, and before taking a snapshot you mean to keep. Takes no arguments: the window belongs to the ACCOUNT, not to a computer, though each computer keeps its own set under it. ONLY AUTOMATIC SNAPSHOTS ARE AGED OUT — one you took yourself with `create_snapshot` is never removed automatically, which is how you keep something past the window.",
|
|
256
|
+
inputSchema: {},
|
|
257
|
+
annotations: { readOnlyHint: true },
|
|
258
|
+
}, (_args, extra) => guarded(async () => {
|
|
259
|
+
const body = await session.api.with(extra.signal).json('GET', P.RETENTION);
|
|
260
|
+
return said(retentionLine(body), body);
|
|
261
|
+
}));
|
|
262
|
+
// clone_snapshot brings a billable machine into existence as surely as
|
|
263
|
+
// create_computer does, and delete_snapshot destroys bytes as surely as
|
|
264
|
+
// delete_computer does, so both sit behind the gate those two sit behind.
|
|
265
|
+
//
|
|
266
|
+
// clone_snapshot was on the wrong side of it, which left MANDALA_NO_LIFECYCLE
|
|
267
|
+
// withholding every way of making a computer except this one — an operator
|
|
268
|
+
// who had turned creation off still had a tool that made computers, and the
|
|
269
|
+
// first they would learn of it is an invoice.
|
|
270
|
+
if (!opts.lifecycle)
|
|
271
|
+
return;
|
|
272
|
+
server.registerTool('clone_snapshot', {
|
|
273
|
+
title: 'Fork a snapshot into a new computer',
|
|
274
|
+
description: 'Build a new computer from a snapshot, leaving the original untouched. This is the fork half of snapshot-and-fork, and the only thing that works on an orphaned snapshot.',
|
|
275
|
+
inputSchema: {
|
|
276
|
+
snapshot_id: z.string(),
|
|
277
|
+
name: z.string().optional().describe('A name for the new computer.'),
|
|
278
|
+
select: z
|
|
279
|
+
.boolean()
|
|
280
|
+
.default(true)
|
|
281
|
+
.describe("Make the new computer this session's selected one."),
|
|
282
|
+
},
|
|
283
|
+
}, ({ snapshot_id, name, select }, extra) => guarded(async () => {
|
|
284
|
+
const c = unwrapComputer(await session.api
|
|
285
|
+
.with(extra.signal)
|
|
286
|
+
.json('POST', P.snapshotAction(snapshot_id, 'clone'), {
|
|
287
|
+
body: name === undefined ? {} : { name },
|
|
288
|
+
}));
|
|
289
|
+
if (!c.id) {
|
|
290
|
+
return refused(`The platform accepted the clone of ${snapshot_id} but sent no computer id back, so the copy cannot be identified. It may exist and be billable — list_computers will say. The selected computer is unchanged.`, withoutCredentials(c));
|
|
291
|
+
}
|
|
292
|
+
if (select && c.id)
|
|
293
|
+
session.bind(c.id, c.resolution);
|
|
294
|
+
return said(`Forked ${snapshot_id} into ${describe(c)}${select && c.id ? ', and selected it' : ''}.`, withoutCredentials(c));
|
|
295
|
+
}));
|
|
296
|
+
server.registerTool('delete_snapshot', {
|
|
297
|
+
title: 'Delete a snapshot',
|
|
298
|
+
description: 'Remove a snapshot permanently. Later snapshots in the same chain are unaffected.',
|
|
299
|
+
inputSchema: {
|
|
300
|
+
snapshot_id: z.string(),
|
|
301
|
+
confirm: z.literal(true).describe('Must be true.'),
|
|
302
|
+
},
|
|
303
|
+
annotations: { destructiveHint: true, idempotentHint: true },
|
|
304
|
+
}, ({ snapshot_id }, extra) => guarded(async () => {
|
|
305
|
+
try {
|
|
306
|
+
await session.api.with(extra.signal).send('DELETE', P.snapshot(snapshot_id));
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
// A 404 means the snapshot is not there, which is the state this call
|
|
310
|
+
// was asking for. `idempotentHint` above invites a client to retry a
|
|
311
|
+
// lost 2xx, and `#fetch` throws on every non-OK — so that invited
|
|
312
|
+
// retry came back `isError` saying the delete had FAILED, about bytes
|
|
313
|
+
// the first attempt had already destroyed. delete_computer carries the
|
|
314
|
+
// same hint and special-cases 404 for exactly this reason; this is
|
|
315
|
+
// that handler, one route over.
|
|
316
|
+
if (!(err instanceof NotFoundError))
|
|
317
|
+
throw err;
|
|
318
|
+
// Not reported as "Deleted", for delete_computer's reason: a 404 is
|
|
319
|
+
// equally the answer for an id that was never on this account, and
|
|
320
|
+
// "deleted" said over a typo leaves a caller believing a snapshot is
|
|
321
|
+
// gone while the real one is still held and still billed. Both
|
|
322
|
+
// readings are named, and the one call that settles which is named
|
|
323
|
+
// with them.
|
|
324
|
+
return said(`Nothing was deleted: the platform has no snapshot with the id ${snapshot_id} on this account. ` +
|
|
325
|
+
'Either it was already destroyed — if this is a retry, the first call is the one that did it — ' +
|
|
326
|
+
'or the id is not one on this account, in which case NO snapshot of yours has been touched and ' +
|
|
327
|
+
'a real one may still be held under the id you meant. list_snapshots says which of the two ' +
|
|
328
|
+
'this is.');
|
|
329
|
+
}
|
|
330
|
+
return said(`Deleted snapshot ${snapshot_id}.`);
|
|
331
|
+
}));
|
|
332
|
+
};
|
|
333
|
+
//# sourceMappingURL=snapshots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshots.js","sourceRoot":"","sources":["../../src/tools/snapshots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,QAAQ,EACR,OAAO,EACP,iBAAiB,EACjB,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,cAAc,EACd,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AAGjC,MAAM,KAAK,GAAG;IACZ,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,iEAAiE,CAAC;CAC/E,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,aAAa,GAAG,CAAC,CAAU,EAAU,EAAE;IAC3C,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAA4B,CAAC;IAC/C,MAAM,CAAC,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,MAAM,KAAK,GAAG;QACZ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ;QACnC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS;QACtC,CAAC,CAAC,CAAC,CAAC,OAAO,CA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