mandala-computer-mcp 0.5.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 (84) hide show
  1. package/README.md +277 -20
  2. package/dist/api.d.ts +73 -2
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +271 -22
  5. package/dist/api.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +17 -0
  8. package/dist/cli.js.map +1 -1
  9. package/dist/errors.d.ts +183 -5
  10. package/dist/errors.d.ts.map +1 -1
  11. package/dist/errors.js +377 -10
  12. package/dist/errors.js.map +1 -1
  13. package/dist/format.d.ts +90 -0
  14. package/dist/format.d.ts.map +1 -1
  15. package/dist/format.js +102 -2
  16. package/dist/format.js.map +1 -1
  17. package/dist/http.d.ts +42 -0
  18. package/dist/http.d.ts.map +1 -1
  19. package/dist/http.js +392 -6
  20. package/dist/http.js.map +1 -1
  21. package/dist/index.d.ts +4 -3
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +3 -3
  24. package/dist/index.js.map +1 -1
  25. package/dist/paths.d.ts +74 -3
  26. package/dist/paths.d.ts.map +1 -1
  27. package/dist/paths.js +89 -10
  28. package/dist/paths.js.map +1 -1
  29. package/dist/secret-errors.d.ts +59 -0
  30. package/dist/secret-errors.d.ts.map +1 -0
  31. package/dist/secret-errors.js +199 -0
  32. package/dist/secret-errors.js.map +1 -0
  33. package/dist/secret-store.d.ts +115 -0
  34. package/dist/secret-store.d.ts.map +1 -0
  35. package/dist/secret-store.js +105 -0
  36. package/dist/secret-store.js.map +1 -0
  37. package/dist/server.d.ts +1 -1
  38. package/dist/server.d.ts.map +1 -1
  39. package/dist/server.js +3 -1
  40. package/dist/server.js.map +1 -1
  41. package/dist/session.d.ts +6 -1
  42. package/dist/session.d.ts.map +1 -1
  43. package/dist/session.js +1 -1
  44. package/dist/session.js.map +1 -1
  45. package/dist/tool-filters.d.ts +4 -4
  46. package/dist/tool-filters.d.ts.map +1 -1
  47. package/dist/tool-filters.js +22 -2
  48. package/dist/tool-filters.js.map +1 -1
  49. package/dist/tools/account.d.ts +14 -0
  50. package/dist/tools/account.d.ts.map +1 -1
  51. package/dist/tools/account.js +118 -0
  52. package/dist/tools/account.js.map +1 -1
  53. package/dist/tools/agent.d.ts.map +1 -1
  54. package/dist/tools/agent.js +7 -2
  55. package/dist/tools/agent.js.map +1 -1
  56. package/dist/tools/computers.d.ts.map +1 -1
  57. package/dist/tools/computers.js +277 -57
  58. package/dist/tools/computers.js.map +1 -1
  59. package/dist/tools/guest.d.ts.map +1 -1
  60. package/dist/tools/guest.js +140 -22
  61. package/dist/tools/guest.js.map +1 -1
  62. package/dist/tools/input.d.ts +11 -0
  63. package/dist/tools/input.d.ts.map +1 -1
  64. package/dist/tools/input.js +277 -20
  65. package/dist/tools/input.js.map +1 -1
  66. package/dist/tools/operations.d.ts +44 -0
  67. package/dist/tools/operations.d.ts.map +1 -0
  68. package/dist/tools/operations.js +232 -0
  69. package/dist/tools/operations.js.map +1 -0
  70. package/dist/tools/secrets.d.ts +42 -13
  71. package/dist/tools/secrets.d.ts.map +1 -1
  72. package/dist/tools/secrets.js +306 -15
  73. package/dist/tools/secrets.js.map +1 -1
  74. package/dist/tools/snapshots.d.ts.map +1 -1
  75. package/dist/tools/snapshots.js +44 -15
  76. package/dist/tools/snapshots.js.map +1 -1
  77. package/dist/tools/ssh.d.ts.map +1 -1
  78. package/dist/tools/ssh.js +19 -2
  79. package/dist/tools/ssh.js.map +1 -1
  80. package/dist/tools/templates.js +1 -1
  81. package/dist/tools/templates.js.map +1 -1
  82. package/dist/tools/webhooks.js +1 -1
  83. package/dist/tools/webhooks.js.map +1 -1
  84. package/package.json +1 -1
package/dist/format.d.ts CHANGED
@@ -61,6 +61,14 @@ export declare function errorMetadata(source: APIError | Record<string, unknown>
61
61
  export declare function withErrorMetadata(result: CallToolResult, source: APIError | Record<string, unknown>): CallToolResult;
62
62
  /** Keep scalar error prose, without displaying a serialized response body as its message. */
63
63
  export declare function apiErrorMessage(error: APIError): string;
64
+ /**
65
+ * What to tell a model about a `503`, or `undefined` for anything else.
66
+ *
67
+ * Two answers, told apart by the request's method, and the same split
68
+ * isTransient makes: a GET or HEAD can be sent again shortly; any change may
69
+ * already have happened, so the current state is read first.
70
+ */
71
+ export declare function unavailableAdvice(err: APIError): string | undefined;
64
72
  /** A model-visible refusal. A projected run failure must withhold reason-based replay advice. */
65
73
  export declare function failed(err: unknown, includeReasonAdvice?: boolean): CallToolResult;
66
74
  /** Run a tool body, turning anything it throws into a result the model can read. */
@@ -105,6 +113,12 @@ export type Computer = {
105
113
  deleted_at?: string;
106
114
  lost_at?: string;
107
115
  start_error?: string;
116
+ /**
117
+ * The lifecycle operation this answer started (platform OPL-5055), on a
118
+ * create, a clone or a resize only — never on a read. `wait_for_operation`
119
+ * follows it to its end.
120
+ */
121
+ operation_id?: string;
108
122
  /**
109
123
  * Guest RAM the platform is holding for this computer against the account's
110
124
  * running pool (platform OPL-4630).
@@ -121,6 +135,60 @@ export type Computer = {
121
135
  * wrote before reading the computer back. See `nothingAdmitted`.
122
136
  */
123
137
  running_ram_mb?: number;
138
+ /**
139
+ * The secrets bound to this computer, as references (secret id, the revision
140
+ * last delivered, and exactly one of `env` or `file`). Never a value. The
141
+ * whole `secrets*` group is absent on a computer that holds none.
142
+ */
143
+ secrets?: unknown[];
144
+ /**
145
+ * Whether the desktop is missing a change to its secrets that a restart would
146
+ * deliver. Three answers: `true` (a restart delivers it), `false` (nothing
147
+ * pending), and `null` — the platform could not check, which is not `false`.
148
+ * Only ever true of a running or suspended computer.
149
+ */
150
+ secrets_pending?: boolean | null;
151
+ /** Why the last delivering start was stopped, in one fixed sentence. Never a value. */
152
+ secrets_error?: string;
153
+ /**
154
+ * Whether values are on their way into the desktop right now: true from a
155
+ * delivering start until they are applied, so a computer reads `running`
156
+ * with this still true for a few seconds. Absent where nothing is bound, or
157
+ * from a platform that predates it.
158
+ */
159
+ secrets_delivering?: boolean;
160
+ secrets_generation?: number;
161
+ secrets_applied?: unknown;
162
+ /**
163
+ * The proxy this computer's browsers are sent through (platform OPL-5056):
164
+ * the server URL, the hosts they reach directly, and the id of the secret
165
+ * holding its `user:password` when it asks for one. Absent when none is set.
166
+ */
167
+ browser_proxy?: {
168
+ server?: string;
169
+ bypass?: string[];
170
+ credentials_secret_id?: string;
171
+ };
172
+ /**
173
+ * `true` while a running computer's guest does not have its browser proxy
174
+ * yet, or still holds the files of one just removed. Absent otherwise, and
175
+ * never present on a computer that is not running.
176
+ */
177
+ browser_proxy_pending?: boolean;
178
+ /**
179
+ * The proxy ALL of this computer's outbound TCP is sent through: the server
180
+ * URL, and the id of the secret holding its `user:password` when it asks for
181
+ * one. Absent when none is set.
182
+ */
183
+ egress_proxy?: {
184
+ server?: string;
185
+ credentials_secret_id?: string;
186
+ };
187
+ /**
188
+ * `true` while a running computer's egress proxy names credentials its host
189
+ * does not hold yet; every connection is closed meanwhile. Absent otherwise.
190
+ */
191
+ egress_proxy_pending?: boolean;
124
192
  vnc?: Record<string, unknown>;
125
193
  };
126
194
  /**
@@ -139,6 +207,16 @@ export type Computer = {
139
207
  * the same distinction the same way (OPL-4628, OPL-4629).
140
208
  */
141
209
  export declare function nothingAdmitted(c: Computer): boolean;
210
+ /**
211
+ * Whether a running computer's secrets are still on their way into its desktop.
212
+ *
213
+ * `secrets_delivering` answers it where the platform reports the field. Where
214
+ * it does not (a platform that predates it), the receipt does: it names the
215
+ * delivering start it is for, so a receipt behind `secrets_generation` is a
216
+ * delivery still under way — the fallback both SDKs' waits use. Nothing bound
217
+ * is nothing coming.
218
+ */
219
+ export declare function secretsOnTheirWay(c: Computer): boolean;
142
220
  /**
143
221
  * A create or a clone can answer `{computer, start_error}` rather than a bare
144
222
  * computer: the guest was made and then would not boot, so the machine exists
@@ -146,6 +224,18 @@ export declare function nothingAdmitted(c: Computer): boolean;
146
224
  * flattens it, so every reader of a computer sees the same shape and the
147
225
  * failure travels beside the fields rather than wrapping them.
148
226
  */
227
+ /**
228
+ * The `operation_id` a lifecycle answer carried, or `undefined` for none
229
+ * (platform OPL-5055). Absent is ordinary: the platform leaves it out, with the
230
+ * call still done, when it could not record the operation. Anything that is not
231
+ * a non-empty string reads as absent for the same reason.
232
+ */
233
+ export declare function operationIdOf(body: unknown): string | undefined;
234
+ /**
235
+ * The operation an answer carried, as the clause a tool's sentence ends with:
236
+ * `` (operation op_…)`` or nothing.
237
+ */
238
+ export declare const operationClause: (body: unknown) => string;
149
239
  export declare function unwrapComputer(body: unknown): Computer;
150
240
  /**
151
241
  * A computer without its desktop credentials.
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAA0D,MAAM,aAAa,CAAC;AAE/F,2BAA2B;AAC3B,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,KAAG,cAA4D,CAAC;AAE9F,6FAA6F;AAC7F,eAAO,MAAM,IAAI,GAAI,GAAG,OAAO,KAAG,cAAkD,CAAC;AAErF,yDAAyD;AACzD,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,EAAE,IAAI,OAAO,KAAG,cAC0B,CAAC;AAE5E;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,IAAI,OAAO,KAAG,cAGlD,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,QAAkB,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAKjD,CAAC;AAEH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EA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,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAGxD;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAUjF;AAED,6DAA6D;AAC7D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,QAAQ,GAAG,MAAM,CAiD5C"}
package/dist/format.js CHANGED
@@ -1,4 +1,4 @@
1
- import { APIError, MandalaError, platformSaid, reasonAdvice, statusAdvice } from './errors.js';
1
+ import { APIError, MandalaError, outcomeUnknownOn503, platformSaid, reasonAdvice, statusAdvice, UnavailableError, } from './errors.js';
2
2
  /** A plain text result. */
3
3
  export const text = (s) => ({ content: [{ type: 'text', text: s }] });
4
4
  /** A JSON result, pretty-printed — models read indented JSON more reliably than one line. */
@@ -129,6 +129,20 @@ export function apiErrorMessage(error) {
129
129
  return `HTTP ${error.status}`;
130
130
  return error.message;
131
131
  }
132
+ /**
133
+ * What to tell a model about a `503`, or `undefined` for anything else.
134
+ *
135
+ * Two answers, told apart by the request's method, and the same split
136
+ * isTransient makes: a GET or HEAD can be sent again shortly; any change may
137
+ * already have happened, so the current state is read first.
138
+ */
139
+ export function unavailableAdvice(err) {
140
+ if (!(err instanceof UnavailableError))
141
+ return undefined;
142
+ return outcomeUnknownOn503(err)
143
+ ? 'something this depends on could not answer right now, and THIS CHANGE MAY OR MAY NOT HAVE HAPPENED: a failure after the request was sent is answered the same way. Read the current state before sending it again — repeating a create, a command, a clone or a snapshot blind can do it twice'
144
+ : 'something this depends on could not answer right now; the same request can be sent again shortly';
145
+ }
132
146
  /** A model-visible refusal. A projected run failure must withhold reason-based replay advice. */
133
147
  export function failed(err, includeReasonAdvice = true) {
134
148
  const message = err instanceof APIError
@@ -158,8 +172,14 @@ export function failed(err, includeReasonAdvice = true) {
158
172
  // call works once it finishes", which is exactly the replay this is here to
159
173
  // stop (Codex review). Every other status keeps the platform's word ahead of
160
174
  // anything generic, which is where it belongs: it is specific to one refusal.
175
+ //
176
+ // A 503 answered to a change is the one status whose advice outranks the
177
+ // platform's word: the change may or may not have happened, and a reason
178
+ // saying "worth sending again" would invite the blind replay of a create or a
179
+ // command that the platform's own docs warn against (OPL-5026).
161
180
  const advice = err instanceof APIError
162
- ? (statusAdvice(err.status, err.reason) ??
181
+ ? (unavailableAdvice(err) ??
182
+ statusAdvice(err.status, err.reason) ??
163
183
  (includeReasonAdvice &&
164
184
  ![404, 405].includes(err.status) &&
165
185
  (!err.body ||
@@ -272,6 +292,31 @@ export function nothingAdmitted(c) {
272
292
  Number.isFinite(c.running_ram_mb) &&
273
293
  c.running_ram_mb === 0);
274
294
  }
295
+ /**
296
+ * Whether a running computer's secrets are still on their way into its desktop.
297
+ *
298
+ * `secrets_delivering` answers it where the platform reports the field. Where
299
+ * it does not (a platform that predates it), the receipt does: it names the
300
+ * delivering start it is for, so a receipt behind `secrets_generation` is a
301
+ * delivery still under way — the fallback both SDKs' waits use. Nothing bound
302
+ * is nothing coming.
303
+ */
304
+ export function secretsOnTheirWay(c) {
305
+ if (typeof c.secrets_delivering === 'boolean')
306
+ return c.secrets_delivering;
307
+ if (!Array.isArray(c.secrets) || c.secrets.length === 0)
308
+ return false;
309
+ const generation = c.secrets_generation;
310
+ if (typeof generation !== 'number' || !Number.isFinite(generation) || generation <= 0)
311
+ return false;
312
+ const receipt = c.secrets_applied;
313
+ const applied = receipt !== null &&
314
+ typeof receipt === 'object' &&
315
+ typeof receipt.generation === 'number'
316
+ ? receipt.generation
317
+ : -1;
318
+ return applied < generation;
319
+ }
275
320
  /**
276
321
  * A create or a clone can answer `{computer, start_error}` rather than a bare
277
322
  * computer: the guest was made and then would not boot, so the machine exists
@@ -279,6 +324,26 @@ export function nothingAdmitted(c) {
279
324
  * flattens it, so every reader of a computer sees the same shape and the
280
325
  * failure travels beside the fields rather than wrapping them.
281
326
  */
327
+ /**
328
+ * The `operation_id` a lifecycle answer carried, or `undefined` for none
329
+ * (platform OPL-5055). Absent is ordinary: the platform leaves it out, with the
330
+ * call still done, when it could not record the operation. Anything that is not
331
+ * a non-empty string reads as absent for the same reason.
332
+ */
333
+ export function operationIdOf(body) {
334
+ if (!body || typeof body !== 'object')
335
+ return undefined;
336
+ const v = body.operation_id;
337
+ return typeof v === 'string' && v ? v : undefined;
338
+ }
339
+ /**
340
+ * The operation an answer carried, as the clause a tool's sentence ends with:
341
+ * `` (operation op_…)`` or nothing.
342
+ */
343
+ export const operationClause = (body) => {
344
+ const id = operationIdOf(body);
345
+ return id ? ` (operation ${id})` : '';
346
+ };
282
347
  export function unwrapComputer(body) {
283
348
  if (!body || typeof body !== 'object')
284
349
  return {};
@@ -290,9 +355,13 @@ export function unwrapComputer(body) {
290
355
  // the computer and replace it with nothing — discarding the reason a
291
356
  // billable machine did not boot, in the function that exists to surface it.
292
357
  const nested = inner;
358
+ // `operation_id` the same way (platform OPL-5055): on a create that would
359
+ // not boot it is on the envelope, beside `start_error`.
360
+ const operation = operationIdOf(v) ?? nested.operation_id;
293
361
  return {
294
362
  ...nested,
295
363
  start_error: v.start_error ?? nested.start_error,
364
+ ...(operation === undefined ? {} : { operation_id: operation }),
296
365
  };
297
366
  }
298
367
  return v;
@@ -348,6 +417,37 @@ export function describe(c) {
348
417
  bits.push(`suspended ${c.suspended.at}`);
349
418
  if (c.unreachable)
350
419
  bits.push('UNREACHABLE — its hypervisor could not be reached');
420
+ // Secrets, only where there is something to say: `false` and absent say
421
+ // nothing, and `null` is the platform saying it could not check — not that
422
+ // nothing is pending.
423
+ if (c.secrets_delivering === true)
424
+ bits.push('its secrets are still on their way in');
425
+ if (c.secrets_pending === true)
426
+ bits.push('a change to its secrets is pending until it restarts');
427
+ else if (c.secrets_pending === null)
428
+ bits.push('whether its secrets are current is unknown until it restarts');
429
+ if (typeof c.secrets_error === 'string' && c.secrets_error.trim())
430
+ bits.push(`secrets not delivered: ${c.secrets_error.trim()}`);
431
+ // The proxy by its server, and its credentials secret when it has one: the
432
+ // bypass list rides in the structured result, and a line naming sixty hosts
433
+ // says nothing a model can act on. The id is said because a change that
434
+ // leaves it out removes the credentials.
435
+ const proxy = c.browser_proxy?.server;
436
+ const creds = c.browser_proxy?.credentials_secret_id;
437
+ if (typeof proxy === 'string' && proxy)
438
+ bits.push(typeof creds === 'string' && creds
439
+ ? `browsers via ${proxy} (with credentials ${creds})`
440
+ : `browsers via ${proxy}`);
441
+ if (c.browser_proxy_pending === true)
442
+ bits.push('its browser proxy is still being applied');
443
+ const egress = c.egress_proxy?.server;
444
+ const egressCreds = c.egress_proxy?.credentials_secret_id;
445
+ if (typeof egress === 'string' && egress)
446
+ bits.push(typeof egressCreds === 'string' && egressCreds
447
+ ? `all outbound traffic via ${egress} (with credentials ${egressCreds})`
448
+ : `all outbound traffic via ${egress}`);
449
+ if (c.egress_proxy_pending === true)
450
+ bits.push('its egress proxy is waiting for credentials; connections are closed until they arrive');
351
451
  return bits.join(' · ');
352
452
  }
353
453
  //# sourceMappingURL=format.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE/F,2BAA2B;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAS,EAAkB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAE9F,6FAA6F;AAC7F,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAU,EAAkB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAErF,yDAAyD;AACzD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,CAAW,EAAkB,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O,MAAM,KAAK,QAAQ,IAAI,MAAM;QACtC,IAAI,CAAC,IAAI,CACP,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW;YAC5C,CAAC,CAAC,4BAA4B,MAAM,sBAAsB,WAAW,GAAG;YACxE,CAAC,CAAC,4BAA4B,MAAM,EAAE,CACzC,CAAC;IACJ,IAAI,CAAC,CAAC,oBAAoB,KAAK,IAAI;QACjC,IAAI,CAAC,IAAI,CACP,uFAAuF,CACxF,CAAC;IACJ,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
package/dist/http.d.ts CHANGED
@@ -12,7 +12,49 @@ export type HttpConfig = Omit<ServerConfig, 'apiKey' | 'activity'> & {
12
12
  maxSessions?: number;
13
13
  /** How many requests may retain a parsed body above 256 KiB at once. */
14
14
  maxLargeBodyParses?: number;
15
+ /**
16
+ * The OAuth protected-resource metadata URL (RFC 9728) of this server, for
17
+ * the hosted install (OPL-4982). Setting it turns on the OAuth answers: a
18
+ * request with no bearer, or whose bearer the platform refused, is a 401
19
+ * carrying {@link bearerChallenge}, which is how an MCP client discovers
20
+ * where to authorize and knows to refresh. Unset, nothing changes.
21
+ */
22
+ resourceMetadataUrl?: string;
23
+ /**
24
+ * The platform's shared secret for this service, sent as
25
+ * `X-Mandala-MCP-Service` on every platform request a session makes. Needed
26
+ * for the platform to take an OAuth access token at all. Never logged.
27
+ */
28
+ serviceSecret?: string;
29
+ /**
30
+ * Hosted mode: how long a bearer the platform accepted is taken on trust
31
+ * before it is checked again, in ms. Default 60 s.
32
+ */
33
+ bearerCheckTtlMs?: number;
34
+ /**
35
+ * Hosted mode: refused initializes one source may make per minute before it
36
+ * is answered 429 without asking the platform. Default 20.
37
+ */
38
+ maxFailedInitializes?: number;
39
+ /**
40
+ * Hosted mode: once a source has spent that budget, how often it may still
41
+ * have one new bearer checked, in ms. Default 5 s.
42
+ */
43
+ exhaustedProbeIntervalMs?: number;
44
+ /** The SDK's SSE keep-alive interval, in ms. For tests; default 15 s. */
45
+ sseKeepAliveMs?: number;
15
46
  };
47
+ /** The OAuth scope the hosted resource asks for. */
48
+ export declare const MCP_SCOPE = "mcp:tools";
49
+ /**
50
+ * The `WWW-Authenticate` value of every OAuth refusal this server makes.
51
+ *
52
+ * The same header whether no bearer was sent or the platform refused one: RFC
53
+ * 9728 §5.1 has a client find the authorization server through
54
+ * `resource_metadata`, and the MCP authorization spec has it refresh or
55
+ * re-authorize on any 401 that carries it.
56
+ */
57
+ export declare function bearerChallenge(resourceMetadataUrl: string): string;
16
58
  export declare function isLoopbackHost(host: string): boolean;
17
59
  /**
18
60
  * One operator-supplied allowlist entry, as the Host headers it should match.
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOxC,OAAO,EAA6C,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3F,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,UAAU,CAAC,GAAG;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAgEF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUpD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAWlE;AA+BD;;;;;;;;;;GAUG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