mandala-computer-mcp 0.6.0 → 0.7.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.
Files changed (62) hide show
  1. package/README.md +165 -16
  2. package/dist/api.d.ts +26 -1
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +23 -0
  5. package/dist/api.js.map +1 -1
  6. package/dist/errors.d.ts +90 -3
  7. package/dist/errors.d.ts.map +1 -1
  8. package/dist/errors.js +211 -3
  9. package/dist/errors.js.map +1 -1
  10. package/dist/format.d.ts +65 -0
  11. package/dist/format.d.ts.map +1 -1
  12. package/dist/format.js +71 -0
  13. package/dist/format.js.map +1 -1
  14. package/dist/http.d.ts.map +1 -1
  15. package/dist/http.js +15 -5
  16. package/dist/http.js.map +1 -1
  17. package/dist/paths.d.ts +64 -1
  18. package/dist/paths.d.ts.map +1 -1
  19. package/dist/paths.js +74 -5
  20. package/dist/paths.js.map +1 -1
  21. package/dist/server.d.ts +1 -1
  22. package/dist/server.d.ts.map +1 -1
  23. package/dist/server.js +3 -1
  24. package/dist/server.js.map +1 -1
  25. package/dist/tool-filters.d.ts +4 -4
  26. package/dist/tool-filters.d.ts.map +1 -1
  27. package/dist/tool-filters.js +13 -1
  28. package/dist/tool-filters.js.map +1 -1
  29. package/dist/tools/account.d.ts +14 -0
  30. package/dist/tools/account.d.ts.map +1 -1
  31. package/dist/tools/account.js +118 -0
  32. package/dist/tools/account.js.map +1 -1
  33. package/dist/tools/agent.d.ts.map +1 -1
  34. package/dist/tools/agent.js +7 -2
  35. package/dist/tools/agent.js.map +1 -1
  36. package/dist/tools/computers.d.ts.map +1 -1
  37. package/dist/tools/computers.js +267 -48
  38. package/dist/tools/computers.js.map +1 -1
  39. package/dist/tools/guest.d.ts.map +1 -1
  40. package/dist/tools/guest.js +6 -2
  41. package/dist/tools/guest.js.map +1 -1
  42. package/dist/tools/input.d.ts +9 -0
  43. package/dist/tools/input.d.ts.map +1 -1
  44. package/dist/tools/input.js +247 -16
  45. package/dist/tools/input.js.map +1 -1
  46. package/dist/tools/operations.d.ts +44 -0
  47. package/dist/tools/operations.d.ts.map +1 -0
  48. package/dist/tools/operations.js +232 -0
  49. package/dist/tools/operations.js.map +1 -0
  50. package/dist/tools/secrets.d.ts +10 -1
  51. package/dist/tools/secrets.d.ts.map +1 -1
  52. package/dist/tools/secrets.js +59 -12
  53. package/dist/tools/secrets.js.map +1 -1
  54. package/dist/tools/snapshots.d.ts.map +1 -1
  55. package/dist/tools/snapshots.js +35 -12
  56. package/dist/tools/snapshots.js.map +1 -1
  57. package/dist/tools/ssh.d.ts.map +1 -1
  58. package/dist/tools/ssh.js +19 -2
  59. package/dist/tools/ssh.js.map +1 -1
  60. package/dist/tools/templates.js +1 -1
  61. package/dist/tools/templates.js.map +1 -1
  62. package/package.json +1 -1
@@ -0,0 +1,232 @@
1
+ import { z } from 'zod';
2
+ import { IDEMPOTENCY_KEY_PATTERN } from '../api.js';
3
+ import { CancelledError, idempotencyAdvice, isTransientForPoll, keyedOutcomeUnknown, platformAnsweredFailure, resendAfterSpentKey, resendUnseenByRead, } from '../errors.js';
4
+ import { failed, guarded, operationIdOf, refused, said } from '../format.js';
5
+ import * as P from '../paths.js';
6
+ import { heartbeat, POLL_MS, pollDelay, sleep } from '../poll.js';
7
+ import { label, metadata, metadataCall } from './directory.js';
8
+ import { readAnnotations } from './results.js';
9
+ /**
10
+ * One lifecycle operation (platform OPL-5055), projected to its public fields.
11
+ *
12
+ * `kind` and `state` are open strings: the platform adds kinds, and one this
13
+ * server does not know is a kind, not a malformed answer. Strict on the error's
14
+ * shape, because a `failed` operation relayed without its reason is a failure
15
+ * with nothing to say about why.
16
+ */
17
+ const operation = z.object({
18
+ id: label,
19
+ kind: label,
20
+ computer_id: z.string().nullable(),
21
+ state: label,
22
+ error: z.object({ code: z.string(), message: z.string() }).nullable(),
23
+ // The key the call that started it was sent with (OPL-5127): null for one
24
+ // sent without, and absent from a platform that predates the field.
25
+ idempotency_key: z.string().nullable().optional(),
26
+ created_at: z.string(),
27
+ updated_at: z.string(),
28
+ finished_at: z.string().nullable(),
29
+ });
30
+ const page = z.object({
31
+ operations: z.array(operation),
32
+ next_cursor: z.string().min(1).nullable(),
33
+ });
34
+ /**
35
+ * The `idempotency_key` a lifecycle tool takes (platform OPL-5127), checked
36
+ * against the platform's rule here so a key it would refuse never leaves.
37
+ */
38
+ const keyArg = z
39
+ .string()
40
+ .regex(IDEMPOTENCY_KEY_PATTERN, 'idempotency_key must be 1 to 255 characters, each printable ASCII other than a space')
41
+ .optional();
42
+ const KEY_FIRST = "Optional. Omit it on a first attempt: a fresh key is sent for you, and an answer that is lost names it. Pass the key such an answer named to send the SAME call again without it being done twice — the platform answers with the first call's result, or says it is still running. After a 5xx the platform answered, or idempotency_outcome_unknown, the key is spent (resending with it answers idempotency_outcome_unknown)";
43
+ const KEY_LAST = ' Keys last 24 hours; the same key with different arguments is refused.';
44
+ /**
45
+ * The key on a step a read of the computer shows: start, stop, suspend,
46
+ * delete, move, update_computer (not restart: see
47
+ * {@link restartIdempotencyKeyArg}). See {@link resendAfterSpentKey}.
48
+ */
49
+ export const idempotencyKeyArg = keyArg.describe(`${KEY_FIRST}: read get_computer (and get_operation when the error named an operation_id: succeeded means it happened, running means wait on it, pending alone is no reason to wait), and if the step did not take effect, send the call again with a new key, or none.${KEY_LAST}`);
50
+ /**
51
+ * The key on restart_computer, whose step no read of the computer shows: it
52
+ * reads running before and after a reset. So the route never conditions a
53
+ * resend on get_computer; see {@link resendAfterSpentKey}.
54
+ */
55
+ export const restartIdempotencyKeyArg = keyArg.describe(`${KEY_FIRST}. A restart cannot be seen in get_computer (it reads running before and after one), so do not read the computer to decide: read get_operation with the operation_id the error named, or list_operations with the key. Succeeded means the restart happened; running means wait on it. Anything else leaves it possibly done, so ask the user before sending it again with a new key, or none — a second restart resets the guest again.${KEY_LAST}`);
56
+ /**
57
+ * The key on a call that makes a new computer or overwrites a disk: create,
58
+ * clone, clone_snapshot, restore_snapshot. A resend after a spent key waits for
59
+ * the operation to be final. See {@link resendAfterSpentKey}.
60
+ */
61
+ export const buildIdempotencyKeyArg = keyArg.describe(`${KEY_FIRST} and the call may still be under way: read its operation first (get_operation with the operation_id the error named, or list_operations with the key), wait while it is pending or running and do not resend meanwhile, and send the call with a new key (or none) only once the operation is final as failed or not found AND get_computer shows the step did not happen.${KEY_LAST}`);
62
+ /**
63
+ * The answer to a lifecycle tool call that failed, with what its key means.
64
+ *
65
+ * The platform's own `idempotency_*` refusals get their sentence instead of the
66
+ * generic `reason` advice. A failure whose outcome is unknown ENDS with the
67
+ * retry that cannot do the step twice, and which one depends on who answered:
68
+ *
69
+ * - The answer never arrived, the keyed call is still running, or a proxy in
70
+ * front of the platform answered: the same tool, with the same key.
71
+ * - The platform itself answered a `5xx`: it has settled that key as lost
72
+ * (OPL-5304), so the same key can only be answered
73
+ * `idempotency_outcome_unknown`. The next step is a read, then a resend
74
+ * with a new key or none if the step did not happen. Which read depends on
75
+ * the tool (see {@link resendAfterSpentKey}): a create, clone or restore
76
+ * waits for its operation to be final, since a read of the computer made
77
+ * at once cannot see one still landing; a restart, which no read of the
78
+ * computer shows, is read off its operation and otherwise left to the user;
79
+ * every other step is read off the computer, since its operation stays
80
+ * `pending` for an hour regardless.
81
+ */
82
+ export function keyedFailure(err, tool, what, key) {
83
+ const advice = idempotencyAdvice(err, tool);
84
+ const result = failed(err, advice === undefined);
85
+ const [first, ...rest] = result.content;
86
+ if (first?.type !== 'text')
87
+ return result;
88
+ let text = first.text;
89
+ if (advice)
90
+ text += `\n\nAbout its idempotency_key: ${advice}.`;
91
+ if (keyedOutcomeUnknown(err)) {
92
+ text += `\n\nTo retry without risking a second ${what}, call ${tool} again with idempotency_key "${key}".`;
93
+ }
94
+ else if (platformAnsweredFailure(err)) {
95
+ const op = operationIdOf(err.body);
96
+ text +=
97
+ `\n\nThe platform answered this itself, so whether it took effect is unknown — its host may still be carrying out the ${what} — and it has settled idempotency_key "${key}": resending with that key will answer idempotency_outcome_unknown, not do it. ` +
98
+ `${resendAfterSpentKey(tool, op, key, `call ${tool} again`)}.` +
99
+ (resendUnseenByRead(tool) ? '' : ` That way there is no second ${what}.`);
100
+ }
101
+ return { ...result, content: [{ ...first, text }, ...rest] };
102
+ }
103
+ const operationIdArg = z
104
+ .string()
105
+ .min(1)
106
+ .describe('The operation_id a lifecycle tool answered: a create, a clone, a start, stop, suspend or restart, a resize, a snapshot restore, or a move.');
107
+ /** The sentence every answer about an operation starts with. */
108
+ const line = (op) => `${op.id}: ${op.kind}${op.computer_id ? ` of ${op.computer_id}` : ''} — ${op.state}` +
109
+ (op.error ? ` (${op.error.code}: ${op.error.message})` : '') +
110
+ (op.idempotency_key ? ` [idempotency_key ${JSON.stringify(op.idempotency_key)}]` : '');
111
+ /**
112
+ * Said beside every `succeeded`, because it is the misreading that costs the
113
+ * most: a model that reads a succeeded start as a desktop that answers drives
114
+ * a guest that is still booting.
115
+ */
116
+ const NOT_BOOTED = 'succeeded means the platform finished its step, not that the desktop has booted: wait_for_computer is still the wait for a desktop that answers.';
117
+ export const registerOperations = (server, session) => {
118
+ server.registerTool('get_operation', {
119
+ title: 'Read a lifecycle operation',
120
+ description: `One lifecycle operation: what an accepted create, clone, start, stop, suspend, restart, snapshot restore, resize, move or delete started, and where it got to. A call made with an idempotency_key is recorded pending before it is carried out, so it can be found even when its answer was lost; one the platform never heard end is failed with error.code lost. state is pending or running while live, and succeeded or failed once final; a failed one carries error.code (start_failed, build_failed, computer_gone, move_failed, resize_not_applied, lost, and more may be added) and a sentence. Most are already succeeded when the call that started them answered; a clone is running until its disk is copied, and a move until it lands. ${NOT_BOOTED} An id this key cannot see, or one that has expired, is not found.`,
121
+ inputSchema: { operation_id: operationIdArg },
122
+ annotations: readAnnotations,
123
+ }, ({ operation_id }, extra) => metadataCall(async () => {
124
+ const op = metadata(operation, await session.api.json('GET', P.operation(operation_id), { signal: extra.signal }));
125
+ return said(line(op), op);
126
+ }));
127
+ server.registerTool('list_operations', {
128
+ title: 'List lifecycle operations',
129
+ description: "The lifecycle operations this account's API calls started, newest first, a page at a time: kind, computer_id, state, error and timestamps. computer_id keeps one computer's (for a clone, the new computer's) — omitted, it is the whole account's, not the selected computer's. Pass next_cursor back as cursor for the next page; it is null on the last. Calls made from the dashboard record none.",
130
+ inputSchema: {
131
+ computer_id: z
132
+ .string()
133
+ .min(1)
134
+ .optional()
135
+ .describe("Only this computer's operations. Not defaulted to the selected computer."),
136
+ limit: z.number().int().min(1).max(100).optional().describe('Page size; default 20.'),
137
+ cursor: z.string().min(1).optional().describe('The next_cursor of the page before.'),
138
+ idempotency_key: z
139
+ .string()
140
+ .regex(IDEMPOTENCY_KEY_PATTERN, 'idempotency_key must be 1 to 255 characters, each printable ASCII other than a space')
141
+ .optional()
142
+ .describe("Only the operation the lifecycle call sent with this idempotency_key recorded — found even when that call's answer was lost — within the key's 24 hours."),
143
+ },
144
+ annotations: readAnnotations,
145
+ }, ({ computer_id, limit, cursor, idempotency_key }, extra) => metadataCall(async () => {
146
+ const data = metadata(page, await session.api.json('GET', P.OPERATIONS, {
147
+ query: { computer_id, limit, cursor, idempotency_key },
148
+ signal: extra.signal,
149
+ }));
150
+ if (!data.operations.length)
151
+ return said('No operations.', data);
152
+ return said(data.operations.map(line).join('\n') +
153
+ (data.next_cursor
154
+ ? `\n\nMore: pass cursor=${data.next_cursor} for the next page.`
155
+ : ''), data);
156
+ }));
157
+ server.registerTool('wait_for_operation', {
158
+ title: 'Wait for a lifecycle operation to finish',
159
+ description: `Poll a lifecycle operation until it is final. Answers once it has succeeded; a failed one is an error carrying error.code and the platform's sentence (resize_not_applied is a move that landed at the old size: the computer has moved, and update_computer finishes the resize). ${NOT_BOOTED} Most operations are already final when their call answers, so this is for a clone (running until its disk is copied) or a move. Reports progress while it waits, so a client that sends a progressToken and sets resetTimeoutOnProgress can hold the request open; get_operation reads it if the wait runs out.`,
160
+ inputSchema: {
161
+ operation_id: operationIdArg,
162
+ timeout_s: z
163
+ .number()
164
+ .int()
165
+ .min(1)
166
+ .max(900)
167
+ .default(300)
168
+ .describe('How long to wait before handing back and letting you poll.'),
169
+ },
170
+ annotations: readAnnotations,
171
+ }, ({ operation_id, timeout_s }, extra) => guarded(async () => {
172
+ const path = P.operation(operation_id);
173
+ const untilDeadline = AbortSignal.timeout(timeout_s * 1000);
174
+ const signal = extra.signal
175
+ ? AbortSignal.any([extra.signal, untilDeadline])
176
+ : untilDeadline;
177
+ const api = session.api.with(signal);
178
+ const beat = heartbeat(extra, server.server);
179
+ let last;
180
+ let blocked;
181
+ try {
182
+ while (!untilDeadline.aborted) {
183
+ if (extra.signal?.aborted) {
184
+ return refused(`Cancelled while waiting for ${operation_id}. The operation is not stopped by that; get_operation says where it got to.`, last);
185
+ }
186
+ let raw;
187
+ try {
188
+ raw = await api.json('GET', path);
189
+ }
190
+ catch (err) {
191
+ if (extra.signal?.aborted)
192
+ continue;
193
+ if (err instanceof CancelledError) {
194
+ if (untilDeadline.aborted)
195
+ break;
196
+ blocked = err.message;
197
+ await sleep(POLL_MS, signal);
198
+ continue;
199
+ }
200
+ if (!isTransientForPoll(err))
201
+ throw err;
202
+ blocked = err instanceof Error ? err.message : String(err);
203
+ await beat(`${operation_id} — the platform could not be asked: ${blocked}`);
204
+ await sleep(pollDelay(err), signal);
205
+ continue;
206
+ }
207
+ const op = metadata(operation, raw);
208
+ last = op;
209
+ blocked = undefined;
210
+ if (op.state === 'succeeded')
211
+ return said(`${line(op)}.\n\n${NOT_BOOTED}`, op);
212
+ if (op.state === 'failed')
213
+ return refused(`${line(op)}.`, op);
214
+ // A state this server does not know, on an operation the platform
215
+ // says has FINISHED, is a final state added after it was written.
216
+ // Polling it would run to the deadline and then call it live.
217
+ if (op.finished_at !== null && op.state !== 'pending' && op.state !== 'running') {
218
+ return refused(`${line(op)}. It has finished in a state this server does not know; read it with get_operation.`, op);
219
+ }
220
+ await beat(line(op));
221
+ await sleep(POLL_MS, signal);
222
+ }
223
+ return refused(blocked
224
+ ? `Gave up after ${timeout_s}s; the platform could not be asked — the last attempt said: ${blocked}. The operation is not stopped by that; get_operation says where it got to.`
225
+ : `Still ${last?.state ?? 'live'} after ${timeout_s}s. The operation is not stopped by that; wait again, or read it with get_operation.`, last);
226
+ }
227
+ finally {
228
+ await beat.stop();
229
+ }
230
+ }));
231
+ };
232
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/tools/operations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAEL,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C;;;;;;;GAOG;AACH,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EA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AC,CAAC;gBAC/E,IAAI,EAAE,CAAC,KAAK,KAAK,QAAQ;oBAAE,OAAO,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBAC9D,kEAAkE;gBAClE,kEAAkE;gBAClE,8DAA8D;gBAC9D,IAAI,EAAE,CAAC,WAAW,KAAK,IAAI,IAAI,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;oBAChF,OAAO,OAAO,CACZ,GAAG,IAAI,CAAC,EAAE,CAAC,qFAAqF,EAChG,EAAE,CACH,CAAC;gBACJ,CAAC;gBACD,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBACrB,MAAM,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC/B,CAAC;YACD,OAAO,OAAO,CACZ,OAAO;gBACL,CAAC,CAAC,iBAAiB,SAAS,+DAA+D,OAAO,6EAA6E;gBAC/K,CAAC,CAAC,SAAS,IAAI,EAAE,KAAK,IAAI,MAAM,UAAU,SAAS,qFAAqF,EAC1I,IAAI,CACL,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CACL,CAAC;AACJ,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
2
  import { z } from 'zod';
3
+ import { type Secret } from '../secret-store.js';
3
4
  import type { Registrar } from './types.js';
4
5
  /**
5
6
  * Secrets: the account's store of named values, and which of them each
@@ -8,7 +9,7 @@ import type { Registrar } from './types.js';
8
9
  * The BINDINGS (get/set_computer_secrets) carry only ids, revision ids, env
9
10
  * names and file names — no value crosses those routes in either direction.
10
11
  *
11
- * The STORE (list/get/create/replace/delete_secret) is where a value goes in,
12
+ * The STORE (list/get/create/set/replace/delete_secret) is where a value goes in,
12
13
  * and only in: the platform never answers one, the decoded answers here carry
13
14
  * none, and a tool that took a value never repeats it — not in a success, not
14
15
  * in a refusal. See {@link withoutValue}.
@@ -62,6 +63,14 @@ export declare function secretBindingsSchema(revision: boolean): z.ZodEffects<z.
62
63
  export declare const SECRET_VALUE_MAX_BYTES = 4096;
63
64
  /** The published ceiling on a name, in characters. */
64
65
  export declare const SECRET_NAME_MAX_CHARS = 60;
66
+ /** How many times set_secret reads the scope again after a conflict. */
67
+ export declare const SECRET_SET_RETRIES = 3;
68
+ /**
69
+ * The secret called `name` in a listing of one scope, or `undefined`: trimmed
70
+ * as the platform trims names, and ignoring ASCII case and nothing else, which
71
+ * is how it keeps them unique — `openai_api_key` is taken when `OPENAI_API_KEY` is.
72
+ */
73
+ export declare function namedSecret(secrets: readonly Secret[], name: string): Secret | undefined;
65
74
  /**
66
75
  * A tool result with every occurrence of a value taken out.
67
76
  *
@@ -1 +1 @@
1
- {"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/tools/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,sDAAsD;AACtD,eAAO,MAAM,SAAS,oCAAoC,CAAC;AAE3D,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAiBlC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;KA0DrD;AA0FD,2DAA2D;AAC3D,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,sDAAsD;AACtD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAwCxC;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAclF;AAsED,eAAO,MAAM,eAAe,EAAE,SAkP7B,CAAC"}
1
+ {"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/tools/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAIL,KAAK,MAAM,EAEZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,sDAAsD;AACtD,eAAO,MAAM,SAAS,oCAAoC,CAAC;AAE3D,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAiBlC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;KA0DrD;AA0FD,2DAA2D;AAC3D,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,sDAAsD;AACtD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAiDxC,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIxF;AAOD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAclF;AAsED,eAAO,MAAM,eAAe,EAAE,SAqR7B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { APIError, MandalaError, NotFoundError, statusAdvice } from '../errors.js';
2
+ import { APIError, ConflictError, MandalaError, NotFoundError, statusAdvice } from '../errors.js';
3
3
  import { guarded, refused, said, unavailableAdvice } from '../format.js';
4
4
  import * as P from '../paths.js';
5
5
  import { DOCUMENTED_REASONS, isRequestId, overlaps, } from '../secret-store.js';
@@ -10,7 +10,7 @@ import { DOCUMENTED_REASONS, isRequestId, overlaps, } from '../secret-store.js';
10
10
  * The BINDINGS (get/set_computer_secrets) carry only ids, revision ids, env
11
11
  * names and file names — no value crosses those routes in either direction.
12
12
  *
13
- * The STORE (list/get/create/replace/delete_secret) is where a value goes in,
13
+ * The STORE (list/get/create/set/replace/delete_secret) is where a value goes in,
14
14
  * and only in: the platform never answers one, the decoded answers here carry
15
15
  * none, and a tool that took a value never repeats it — not in a success, not
16
16
  * in a refusal. See {@link withoutValue}.
@@ -190,6 +190,29 @@ const workspaceArg = z
190
190
  .refine(isId, 'workspace_id must not be empty or have spaces around it')
191
191
  .optional()
192
192
  .describe('The workspace the secret belongs to. Leave it out for an account-wide secret. A secret in a workspace is found only with its workspace_id.');
193
+ /** A secret's name as a tool argument, checked for what the platform would refuse. */
194
+ const nameArg = z
195
+ .string()
196
+ .min(1, 'name must not be empty')
197
+ .refine((v) => [...v].length <= SECRET_NAME_MAX_CHARS, {
198
+ message: `name must be at most ${SECRET_NAME_MAX_CHARS} characters`,
199
+ })
200
+ .refine((v) => !/\p{Cc}/u.test(v), {
201
+ message: 'name must not contain control characters',
202
+ })
203
+ .describe(`What the secret is called, e.g. OPENAI_API_KEY. Up to ${SECRET_NAME_MAX_CHARS} characters, unique in its scope. This is a label, not where the value lands: set_computer_secrets names the variable or file.`);
204
+ /** How many times set_secret reads the scope again after a conflict. */
205
+ export const SECRET_SET_RETRIES = 3;
206
+ /**
207
+ * The secret called `name` in a listing of one scope, or `undefined`: trimmed
208
+ * as the platform trims names, and ignoring ASCII case and nothing else, which
209
+ * is how it keeps them unique — `openai_api_key` is taken when `OPENAI_API_KEY` is.
210
+ */
211
+ export function namedSecret(secrets, name) {
212
+ const fold = (text) => text.trim().replace(/[A-Z]/g, (c) => c.toLowerCase());
213
+ const wanted = fold(name);
214
+ return secrets.find((s) => fold(s.name) === wanted);
215
+ }
193
216
  const revisionArg = (use) => idString('revision_id').describe(`The \`revision_id\` list_secrets or get_secret answered for this secret — \`csr-\` and twenty-four hex characters. ${use}`);
194
217
  /**
195
218
  * A tool result with every occurrence of a value taken out.
@@ -381,16 +404,7 @@ export const registerSecrets = (server, session) => {
381
404
  title: 'Store a new secret',
382
405
  description: `Store a value under a name on this account, encrypted, for binding to computers with set_computer_secrets (or the secrets field of a create). The value is sent once and NEVER shown again: this answer, every other tool and every route give back only the name, id and revision. Do not put the value anywhere else — not in a command line, a file or a message — when a binding can deliver it. Owners only. A name is unique within its scope (up to ${SECRET_NAME_MAX_CHARS} characters, no control characters); a taken name is refused with 409. The account holds at most 100 secrets at once and may create at most 1000 over its lifetime — list_secrets reports both. Without workspace_id the secret is account-wide and any computer on the account may be bound to it. NOT safe to repeat blind: if the answer is lost, list_secrets before creating again, since the secret may exist.`,
383
406
  inputSchema: {
384
- name: z
385
- .string()
386
- .min(1, 'name must not be empty')
387
- .refine((v) => [...v].length <= SECRET_NAME_MAX_CHARS, {
388
- message: `name must be at most ${SECRET_NAME_MAX_CHARS} characters`,
389
- })
390
- .refine((v) => !/\p{Cc}/u.test(v), {
391
- message: 'name must not contain control characters',
392
- })
393
- .describe(`What the secret is called, e.g. OPENAI_API_KEY. Up to ${SECRET_NAME_MAX_CHARS} characters, unique in its scope. This is a label, not where the value lands: set_computer_secrets names the variable or file.`),
407
+ name: nameArg,
394
408
  value: valueArg('The value'),
395
409
  workspace_id: workspaceArg.describe('The workspace it belongs to. Leave it out for an account-wide secret.'),
396
410
  },
@@ -401,6 +415,39 @@ export const registerSecrets = (server, session) => {
401
415
  .secrets.create({ name, value, workspaceId: workspace_id });
402
416
  return said(`Stored ${secret.name} as ${secret.id}, revision ${secret.revision_id}, ${secret.workspace_id === null ? 'account-wide' : `in workspace ${secret.workspace_id}`}. The value is not shown and cannot be read back. Bind it to a computer with set_computer_secrets.`, secret);
403
417
  }));
418
+ server.registerTool('set_secret', {
419
+ title: 'Store or replace a secret by name',
420
+ description: `Make a name hold a value: create the secret if the scope has no secret by that name, or replace its value if it has — the one to reach for when either will do. It reads the scope first and replaces against the revision it read; names match ignoring ASCII case, as the platform keeps them unique. If the secret is created or replaced by someone else between the read and the write, it reads again and tries again, up to ${SECRET_SET_RETRIES} times. The value is NEVER shown back. Owners only. A new name counts against the account's limits on secrets held and created (list_secrets reports both). ${LIVE_VALUES} NOT safe to repeat blind when the answer is lost: list_secrets says whether the change landed.`,
421
+ inputSchema: {
422
+ name: nameArg,
423
+ value: valueArg('The value'),
424
+ workspace_id: workspaceArg.describe('The scope to look in, and to create in. Leave it out for the account-wide secrets.'),
425
+ },
426
+ annotations: { destructiveHint: true, idempotentHint: false },
427
+ }, ({ name, value, workspace_id }, extra) => storeGuarded(`Setting ${name.trim()}`, true, value, async () => {
428
+ const store = session.api.with(extra.signal).secrets;
429
+ for (let attempt = 0;; attempt++) {
430
+ const found = namedSecret((await store.list({ workspaceId: workspace_id })).secrets, name);
431
+ try {
432
+ const secret = found
433
+ ? await store.replace(found.id, {
434
+ value,
435
+ revisionId: found.revision_id,
436
+ workspaceId: workspace_id,
437
+ })
438
+ : await store.create({ name: name.trim(), value, workspaceId: workspace_id });
439
+ const scope = secret.workspace_id === null ? 'account-wide' : `in workspace ${secret.workspace_id}`;
440
+ return said(found
441
+ ? `Replaced the value of ${secret.name} (${secret.id}), ${scope}; it is now at revision ${secret.revision_id}. The value is not shown. Computers bound to it get it at their next start or restart, and a running one is sent it now on a best-effort basis.`
442
+ : `Stored ${secret.name} as ${secret.id}, revision ${secret.revision_id}, ${scope}. The value is not shown and cannot be read back. Bind it to a computer with set_computer_secrets.`, { ...secret, created: !found });
443
+ }
444
+ catch (err) {
445
+ // A revision that moved, or a name somebody else just took: read again.
446
+ if (!(err instanceof ConflictError) || attempt >= SECRET_SET_RETRIES)
447
+ throw err;
448
+ }
449
+ }
450
+ }));
404
451
  server.registerTool('replace_secret', {
405
452
  title: "Replace a secret's value",
406
453
  description: `Replace a stored secret's value, and move its revision_id. Send the revision_id list_secrets or get_secret answered: if it has moved since, this is refused with 409 and nothing changed — read it again, and replace again only if you still mean to. The new value is NEVER shown back. Owners only. ${LIVE_VALUES} That live send is asynchronous and best effort: this answer does not wait for it or say whether it landed, and a running computer may still hold the old value until its next start or restart, which always delivers the latest. get_computer's secrets_pending says whether one is still missing the change.`,
@@ -1 +1 @@
1
- {"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../src/tools/secrets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,QAAQ,GAGT,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,sDAAsD;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG,iCAAiC,CAAC;AAE3D,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,MAAM,UAAU,GAAG,+BAA+B,CAAC;AACnD,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAE9C,MAAM,QAAQ,GACZ,mFAAmF,CAAC;AACtF,MAAM,SAAS,GACb,mFAAmF,CAAC;AAEtF,0EAA0E;AAC1E,MAAM,IAAI,GAAG,CAAC,CAAU,EAAe,EAAE,CAAC,OAAO,CAAC,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E,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,CAAC;QACvF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,CAAC,GAAG,YAAY,aAAa,CAAC;gBAAE,MAAM,GAAG,CAAC;YAC/C,OAAO,OAAO,CACZ,kCAAkC,SAAS,aAAa,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,iBAAiB,YAAY,EAAE,mGAAmG,CAC5P,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CACT,WAAW,SAAS,sGAAsG,CAC3H,CAAC;IACJ,CAAC,CAAC,CACL,CAAC;AACJ,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"snapshots.d.ts","sourceRoot":"","sources":["../../src/tools/snapshots.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA4M5C,eAAO,MAAM,iBAAiB,EAAE,SAk1B/B,CAAC"}
1
+ {"version":3,"file":"snapshots.d.ts","sourceRoot":"","sources":["../../src/tools/snapshots.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA4M5C,eAAO,MAAM,iBAAiB,EAAE,SAq2B/B,CAAC"}
@@ -1,8 +1,10 @@
1
1
  import { z } from 'zod';
2
+ import { idempotencyHeaders, idempotencyKeyFor } from '../api.js';
2
3
  import { CancelledError, ConflictError, isTransientForPoll, NotFoundError } from '../errors.js';
3
- import { describe, guarded, incompleteWarning, json, refused, said, unwrapComputer, withoutCredentials, } from '../format.js';
4
+ import { describe, guarded, incompleteWarning, json, operationClause, refused, said, unwrapComputer, withoutCredentials, } from '../format.js';
4
5
  import * as P from '../paths.js';
5
6
  import { heartbeat, POLL_MS, pollDelay, sleep } from '../poll.js';
7
+ import { buildIdempotencyKeyArg, keyedFailure } from './operations.js';
6
8
  const idArg = {
7
9
  computer_id: z
8
10
  .string()
@@ -516,15 +518,25 @@ export const registerSnapshots = (server, session, opts) => {
516
518
  confirm: z
517
519
  .literal(true)
518
520
  .describe("Must be true. This overwrites the source computer's current disk."),
521
+ idempotency_key: buildIdempotencyKeyArg,
519
522
  },
520
523
  annotations: { destructiveHint: true },
521
- }, ({ snapshot_id }, extra) => guarded(async () => {
524
+ }, ({ snapshot_id, idempotency_key }, extra) => guarded(async () => {
522
525
  // An acknowledgement, which /api/v1 is free to send as a 204 — and
523
526
  // `said` already omits the body when there is none to repeat.
524
- const res = await session.api
525
- .with(extra.signal)
526
- .send('POST', P.snapshotAction(snapshot_id, 'restore'));
527
- return said(`Restored ${snapshot_id}.`, res);
527
+ const key = idempotencyKeyFor(idempotency_key);
528
+ let res;
529
+ try {
530
+ res = await session.api
531
+ .with(extra.signal)
532
+ .send('POST', P.snapshotAction(snapshot_id, 'restore'), {
533
+ headers: idempotencyHeaders(key),
534
+ });
535
+ }
536
+ catch (err) {
537
+ return keyedFailure(err, 'restore_snapshot', 'restore', key);
538
+ }
539
+ return said(`Restored ${snapshot_id}${operationClause(res)}.`, res);
528
540
  }));
529
541
  server.registerTool('snapshot_schedule', {
530
542
  title: 'Read or set the nightly snapshot',
@@ -599,7 +611,7 @@ export const registerSnapshots = (server, session, opts) => {
599
611
  return;
600
612
  server.registerTool('clone_snapshot', {
601
613
  title: 'Fork a snapshot into a new computer',
602
- 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. A MEMORY snapshot is resumed: the copy comes up running the captured session, sharing its source's network identity, so it cannot run on the same host while its source is running. Pass memory: false to build it from the disk alone instead, as a fresh boot with its own identity. A memory snapshot of a computer that held SECRETS is resumed only with inherit_secrets: true, and then the copy HOLDS THE SAME CREDENTIALS as the computer it came from; without it the clone is built from the disk and this tool says so.",
614
+ 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. A MEMORY snapshot is resumed: the copy comes up running the captured session, and is given its own MAC, address, hostname, machine ID, SSH host keys and desktop password before its network comes up, so it runs beside its source; if that fails it is left stopped, and starting it cold-boots its disk. Pass memory: false to build it from the disk alone instead, as a fresh boot. A memory snapshot of a computer that held SECRETS is resumed only with inherit_secrets: true, and then the copy HOLDS THE SAME CREDENTIALS as the computer it came from; without it the clone is built from the disk and this tool says so.',
603
615
  inputSchema: {
604
616
  snapshot_id: z.string(),
605
617
  name: z.string().optional().describe('A name for the new computer.'),
@@ -615,8 +627,9 @@ export const registerSnapshots = (server, session, opts) => {
615
627
  .boolean()
616
628
  .default(true)
617
629
  .describe("Make the new computer this session's selected one."),
630
+ idempotency_key: buildIdempotencyKeyArg,
618
631
  },
619
- }, ({ snapshot_id, name, select, memory, inherit_secrets }, extra) => guarded(async () => {
632
+ }, ({ snapshot_id, name, select, memory, inherit_secrets, idempotency_key }, extra) => guarded(async () => {
620
633
  // Each option only when set, so an ordinary clone sends what it always
621
634
  // did; consent is sent only when given, since its absence is the default.
622
635
  const body = {};
@@ -626,9 +639,19 @@ export const registerSnapshots = (server, session, opts) => {
626
639
  body.memory = memory;
627
640
  if (inherit_secrets === true)
628
641
  body.inherit_secrets = true;
629
- const answer = await session.api
630
- .with(extra.signal)
631
- .json('POST', P.snapshotAction(snapshot_id, 'clone'), { body });
642
+ const key = idempotencyKeyFor(idempotency_key);
643
+ let answer;
644
+ try {
645
+ answer = await session.api
646
+ .with(extra.signal)
647
+ .json('POST', P.snapshotAction(snapshot_id, 'clone'), {
648
+ body,
649
+ headers: idempotencyHeaders(key),
650
+ });
651
+ }
652
+ catch (err) {
653
+ return keyedFailure(err, 'clone_snapshot', 'computer', key);
654
+ }
632
655
  const c = unwrapComputer(answer);
633
656
  if (!c.id) {
634
657
  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));
@@ -661,7 +684,7 @@ export const registerSnapshots = (server, session, opts) => {
661
684
  : 'the platform did not resume it';
662
685
  return said(`Built ${describe(c)} from ${snapshot_id}'s DISK, booting fresh — its saved session was NOT resumed, because ${why}. No secrets are bound to it${select && c.id ? '. It is selected' : ''}.`, withoutCredentials(c));
663
686
  }
664
- return said(`${memory === false ? 'Built' : 'Forked'} ${snapshot_id} into ${describe(c)}${memory === false ? ' from its disk' : ''}${select && c.id ? ', and selected it' : ''}.`, withoutCredentials(c));
687
+ return said(`${memory === false ? 'Built' : 'Forked'} ${snapshot_id} into ${describe(c)}${memory === false ? ' from its disk' : ''}${select && c.id ? ', and selected it' : ''}${operationClause(c)}.`, withoutCredentials(c));
665
688
  }));
666
689
  server.registerTool('delete_snapshot', {
667
690
  title: 'Delete a snapshot',