@frontmcp/plugin-approval 1.11.2 → 1.11.3

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 (54) hide show
  1. package/README.md +183 -13
  2. package/approval/delegation.d.ts +30 -0
  3. package/approval/delegation.d.ts.map +1 -0
  4. package/approval/errors.d.ts +6 -1
  5. package/approval/errors.d.ts.map +1 -1
  6. package/approval/factories.d.ts +1 -1
  7. package/approval/factories.d.ts.map +1 -1
  8. package/approval/index.d.ts +4 -3
  9. package/approval/index.d.ts.map +1 -1
  10. package/approval/schemas.d.ts +28 -0
  11. package/approval/schemas.d.ts.map +1 -1
  12. package/approval/types.d.ts +19 -1
  13. package/approval/types.d.ts.map +1 -1
  14. package/approval.context-extension.d.ts.map +1 -1
  15. package/approval.identity.d.ts +2 -0
  16. package/approval.identity.d.ts.map +1 -1
  17. package/approval.options.d.ts +43 -0
  18. package/approval.options.d.ts.map +1 -0
  19. package/approval.plugin.d.ts +62 -18
  20. package/approval.plugin.d.ts.map +1 -1
  21. package/approval.symbols.d.ts +11 -2
  22. package/approval.symbols.d.ts.map +1 -1
  23. package/audit/approval-audit.d.ts +44 -0
  24. package/audit/approval-audit.d.ts.map +1 -0
  25. package/esm/index.mjs +1 -1
  26. package/esm/package.json +5 -5
  27. package/external/approval-callback.flow.d.ts +36 -0
  28. package/external/approval-callback.flow.d.ts.map +1 -0
  29. package/external/approval-decisions.d.ts +60 -0
  30. package/external/approval-decisions.d.ts.map +1 -0
  31. package/external/outbound-request.d.ts +32 -0
  32. package/external/outbound-request.d.ts.map +1 -0
  33. package/external/recheck-approver.d.ts +49 -0
  34. package/external/recheck-approver.d.ts.map +1 -0
  35. package/external/webhook-approver.d.ts +44 -0
  36. package/external/webhook-approver.d.ts.map +1 -0
  37. package/external/webhook-signature.d.ts +29 -0
  38. package/external/webhook-signature.d.ts.map +1 -0
  39. package/flows/index.d.ts +3 -2
  40. package/flows/index.d.ts.map +1 -1
  41. package/hooks/approval-check.hook.d.ts +5 -0
  42. package/hooks/approval-check.hook.d.ts.map +1 -1
  43. package/index.d.ts +3 -2
  44. package/index.d.ts.map +1 -1
  45. package/index.js +1 -1
  46. package/package.json +5 -5
  47. package/services/challenge.service.d.ts +20 -1
  48. package/services/challenge.service.d.ts.map +1 -1
  49. package/stores/approval-storage.store.d.ts +15 -0
  50. package/stores/approval-storage.store.d.ts.map +1 -1
  51. package/stores/approval-store.interface.d.ts +6 -0
  52. package/stores/approval-store.interface.d.ts.map +1 -1
  53. package/types/approval.types.d.ts +41 -17
  54. package/types/approval.types.d.ts.map +1 -1
package/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  A FrontMCP plugin that refuses to run a tool until an approval is recorded for the caller. Use it for tools that
4
4
  shouldn't run without someone's say-so, like deleting a ticket or refunding a payment. Mark a tool with `approval`,
5
5
  and every call to it is refused until your code grants an approval, through `this.approval` or the plugin's store.
6
- Each approval records who granted it, and can be revoked or set to expire. The plugin doesn't ask anyone itself:
7
- there's no prompt, webhook or callback, so you decide how a person says yes, for example with a form from
8
- `this.elicit()`.
6
+ Each approval records who granted it, and can be revoked or set to expire. You decide how a person says yes: with a
7
+ form from `this.elicit()`, or with an external approval system the plugin asks for you, by
8
+ [webhook](#webhook-mode) or by [polling](#recheck-mode).
9
9
 
10
10
  [![npm](https://img.shields.io/npm/v/@frontmcp/plugin-approval.svg)](https://www.npmjs.com/package/@frontmcp/plugin-approval) [![License](https://img.shields.io/npm/l/@frontmcp/plugin-approval.svg)](https://github.com/agentfront/frontmcp/blob/main/LICENSE)
11
11
 
@@ -179,23 +179,193 @@ ApprovalPlugin.init({
179
179
  | `storageInstance` | | A storage you made with `createStorage()` from `@frontmcp/utils`. Wins over `storage`. |
180
180
  | `namespace` | `'approval'` | The prefix of the plugin's keys. |
181
181
  | `cleanupIntervalSeconds` | `60` | How often expired approvals are deleted. `0` turns it off. |
182
- | `mode` | `'recheck'` | `'webhook'` also registers a `ChallengeService` (below). Neither mode contacts an external system. |
183
- | `webhook.challengeTtl` | `300` | How long the `ChallengeService`'s challenges last, in seconds. |
184
-
185
- `webhook.url`, `webhook.callbackPath`, `webhook.includeJwt`, the `recheck` options, `enableAudit` and
186
- `maxDelegationDepth` are accepted and not used: nothing is sent, polled or served.
182
+ | `mode` | `'recheck'` | `'recheck'` polls `recheck.url` when it is set; `'webhook'` registers a `ChallengeService` and sends requests to `webhook.url` when it is set. Without a URL, neither contacts an external system. |
183
+ | `recheck` | | See [Recheck mode](#recheck-mode). |
184
+ | `webhook` | | See [Webhook mode](#webhook-mode). `webhook.challengeTtl` (default `300`) is how long a challenge lasts, in seconds. |
185
+ | `enableAudit` | `false` | Logs an [audit trail](#audit-trail). |
186
+ | `maxDelegationDepth` | `3` | The deepest [delegation chain](#delegation-chains) a delegated approval may name, 0 to 64. |
187
187
 
188
188
  In a browser build (`create()` in a web page, WebMCP), `storage: { type: 'redis' }` or `{ type: 'sqlite' }` throws
189
189
  `BrowserStoreUnavailableError` from `init()`, naming `storage: { type: 'memory' }`: a page has no TCP socket and no
190
190
  file. `{ type: 'auto' }` picks memory there.
191
191
 
192
+ ## Audit trail
193
+
194
+ With `enableAudit: true`, the plugin logs one `info` line (logger `ApprovalAudit`) per event. The message is
195
+ `<event> <toolId>`, and the first argument holds the fields:
196
+
197
+ | Event | When |
198
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
199
+ | `approval.requested` | A call had no approval it could use. `state`: `pending`, `expired`, `denied`, or `approved` by the recheck system; `via`: `webhook` or `recheck`. |
200
+ | `approval.granted` | An approval was recorded: by `this.approval`, the store, a webhook callback or a recheck answer. |
201
+ | `approval.denied` | A denial was recorded. |
202
+ | `approval.revoked` | An approval was revoked (`revokedBy`, `reason`), or a session's approvals were cleared (`count`). |
203
+ | `approval.expired` | The cleanup deleted an expired approval or denial. |
204
+
205
+ The fields are the tool, scope, user id, context, grantor or revoker, reason and `expiresAt`. A line never carries a
206
+ session id, a token or a record's `metadata`. A backend that expires keys itself, such as Redis, can delete an expired
207
+ record before the cleanup sees it; `approval.granted` carries its `expiresAt`.
208
+
209
+ It is off by default: up to 1.11.2 the option did nothing (its documented default was `true`), and turning it on adds
210
+ lines with user ids to your logs. Route them with a log transport.
211
+
212
+ ## Delegation chains
213
+
214
+ A delegated approval names who authorized whom: `grantedBy.delegationContext`, `{ delegatorId, delegateId, purpose?,
215
+ constraints?, chain? }`. A delegate can delegate further: `chain` lists the delegations above it, the original
216
+ delegator's first, and `extendDelegation()` builds the next one.
217
+
218
+ ```ts
219
+ import { agentGrantor, extendDelegation } from '@frontmcp/plugin-approval';
220
+
221
+ const toPlanner = { delegatorId: 'user-123', delegateId: 'planner-agent', purpose: 'release' };
222
+ const toDeployer = extendDelegation(toPlanner, 'deploy-agent', { purpose: 'deploy step' });
223
+ // { delegatorId: 'planner-agent', delegateId: 'deploy-agent', purpose: 'deploy step',
224
+ // chain: [{ delegatorId: 'user-123', delegateId: 'planner-agent', purpose: 'release' }] }
225
+
226
+ await this.approval.grantSessionApproval('ops:deploy', { grantedBy: agentGrantor('deploy-agent', toDeployer) });
227
+ ```
228
+
229
+ `maxDelegationDepth` (default `3`) bounds the chain, counting the delegation itself: `toPlanner` is 1 deep,
230
+ `toDeployer` 2. A grant whose chain is deeper, broken (a delegator that isn't the previous delegate) or names a party
231
+ twice throws `ApprovalOperationError`, and a stored approval like that doesn't let a call through. Denials are kept
232
+ whatever their chain. `maxDelegationDepth: 1` allows direct delegation only, and `0` no delegated approval.
233
+ `delegationDepth(context)` and `delegationProblem(context, maxDepth)` check a context yourself. Up to 1.11.2 the option
234
+ did nothing.
235
+
192
236
  ## Webhook mode
193
237
 
194
- With `mode: 'webhook'`, `this.get(ChallengeServiceToken)` returns a `ChallengeService`: a store of one-time PKCE
195
- (Proof Key for Code Exchange, RFC 7636) challenges you can build an external approval flow on.
196
- `createChallenge({ toolId, sessionId, requestedScope, requestInfo, ... })` returns a code verifier and its SHA-256
197
- challenge, and `verifyAndConsume(codeVerifier)` returns the stored request once, or throws `ChallengeValidationError`.
198
- The plugin itself doesn't call it, send a webhook or serve a callback route.
238
+ With `mode: 'webhook'` and `webhook.url`, a call that needs an approval it doesn't have sends a signed approval request
239
+ to your approval system (a Slack app, a ticketing system, an admin console), and is refused as `pending`. The system
240
+ decides by POSTing back to `webhook.callbackPath`, and the caller's next call runs, or is refused as `denied`.
241
+
242
+ ```ts
243
+ ApprovalPlugin.init({
244
+ storage: { type: 'redis', redis: { url: process.env.REDIS_URL } },
245
+ mode: 'webhook',
246
+ webhook: {
247
+ url: 'https://approvals.example.com/webhook',
248
+ secret: process.env.APPROVAL_WEBHOOK_SECRET, // required with url, at least 24 bytes
249
+ challengeTtl: 300,
250
+ callbackPath: '/approval/callback',
251
+ },
252
+ });
253
+ ```
254
+
255
+ | Option | Default | Description |
256
+ | ---------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
257
+ | `webhook.url` | | Where requests are POSTed. `https://`; `http://localhost`, `127.0.0.1` or `[::1]` only when `NODE_ENV` isn't `production`. No credentials in it. |
258
+ | `webhook.secret` | | Signs each request and verifies each callback. Required with `url`. A `whsec_` secret (Standard Webhooks) is base64 after the prefix. |
259
+ | `webhook.includeJwt` | `false` | Adds the caller's access token to the request as `jwt`. Set it only when the approval system must act as the caller. |
260
+ | `webhook.challengeTtl` | `300` | Seconds a request waits for its decision, and a denial without `ttlMs` lasts. |
261
+ | `webhook.callbackPath` | `'/approval/callback'` | The path the server takes decisions on (`POST`). |
262
+
263
+ The request, sent once per caller and tool until it is decided or `challengeTtl` passes:
264
+
265
+ ```json
266
+ {
267
+ "type": "approval.requested",
268
+ "codeChallenge": "…",
269
+ "codeVerifier": "…",
270
+ "toolId": "ops:delete_ticket",
271
+ "toolName": "delete_ticket",
272
+ "category": "delete",
273
+ "riskLevel": "high",
274
+ "approvalMessage": "…",
275
+ "requestedScope": "session",
276
+ "userId": "user-123",
277
+ "callbackPath": "/approval/callback",
278
+ "callbackUrl": "https://mcp.example.com/approval/callback",
279
+ "expiresAt": 1700000300000,
280
+ "timestamp": 1700000000000
281
+ }
282
+ ```
283
+
284
+ It never names the session. `callbackUrl` is there when `FRONTMCP_PUBLIC_URL` is set; `allowedScopes` and `maxTtlMs`
285
+ when the tool limits them; `jwt` only with `includeJwt: true`. Keep `codeVerifier` secret: it is what decides the
286
+ request. A request that fails (an error status, a redirect, no answer in 10 seconds) is sent again by the next call.
287
+
288
+ The decision, POSTed to `callbackPath` and signed with the same secret:
289
+
290
+ ```json
291
+ {
292
+ "codeVerifier": "…",
293
+ "approved": true,
294
+ "scope": "session",
295
+ "ttlMs": 3600000,
296
+ "grantedBy": { "source": "user", "identifier": "lead-7" },
297
+ "reason": "ok"
298
+ }
299
+ ```
300
+
301
+ - An approval is recorded for the caller the request was for, never one the body names, held to the tool's
302
+ `allowedScopes` and `maxTtlMs` (`scope` defaults to `requestedScope`), with `grantedBy` and `origin: 'webhook'`. A
303
+ denial (`approved: false`) is recorded for the caller's session, and lasts `ttlMs`, or `challengeTtl` without it.
304
+ - Each `codeVerifier` works once, until `challengeTtl` passes. A replayed or late decision does nothing.
305
+ - Every signed, well-formed callback gets `202 { "status": "received" }`, whether or not it matched a request, so the
306
+ route never says whether an approval is pending. An unsigned or mis-signed callback, or one signed more than five
307
+ minutes ago, gets `401`; a body that isn't a decision `400`; one over 16 KB `413`.
308
+
309
+ Requests and callbacks are signed with HMAC-SHA256 in the [Standard Webhooks](https://www.standardwebhooks.com)
310
+ format, so any Standard Webhooks library checks them: headers `webhook-id`, `webhook-timestamp` (Unix seconds) and
311
+ `webhook-signature: v1,<base64>`, over `<webhook-id>.<webhook-timestamp>.<body>`. Check the timestamp on your side too,
312
+ and reject a `webhook-id` you have seen.
313
+
314
+ `this.get(ChallengeServiceToken)` returns the plugin's `ChallengeService`, the store of these one-time PKCE (Proof Key
315
+ for Code Exchange, RFC 7636) challenges: `createChallenge(...)`, `consume(codeVerifier)` (the request once, or
316
+ `undefined`) and `verifyAndConsume(codeVerifier)` (the request once, or `ChallengeValidationError`).
317
+
318
+ ## Recheck mode
319
+
320
+ With `mode: 'recheck'` (the default) and `recheck.url`, a call that needs an approval it doesn't have polls your
321
+ approval API until it decides.
322
+
323
+ ```ts
324
+ ApprovalPlugin.init({
325
+ recheck: {
326
+ url: 'https://approvals.example.com/status',
327
+ auth: 'bearer',
328
+ token: process.env.APPROVALS_API_TOKEN,
329
+ interval: 2000,
330
+ maxAttempts: 5,
331
+ },
332
+ });
333
+ ```
334
+
335
+ | Option | Default | Description |
336
+ | --------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
337
+ | `recheck.url` | | The status URL, with the same rules as `webhook.url`. |
338
+ | `recheck.auth` | `'none'` | `'bearer'` sends `recheck.token`; `'jwt'` forwards the caller's own access token (a call without one isn't polled); `'custom'` sends the headers `recheck.headers(request)` returns. |
339
+ | `recheck.token` | | The token `auth: 'bearer'` sends. |
340
+ | `recheck.headers` | | `(request) => headers`, for `auth: 'custom'`. |
341
+ | `recheck.secret` | | Signs each poll as webhook requests are signed. |
342
+ | `recheck.interval` | `2000` | Milliseconds between polls, 100 to 60000. |
343
+ | `recheck.maxAttempts` | `5` | Polls per call, 1 to 60. `interval × (maxAttempts − 1)` is at most 2 minutes. |
344
+
345
+ Each poll POSTs `{ type: 'approval.status', requestId, attempt, toolId, toolName, userId?, requestedScope, ... }`
346
+ (`requestId` is the same for every poll of one caller and tool, and names neither), and reads
347
+ `{ approved, pending?, scope?, ttlMs?, grantedBy?, denialReason? }`:
348
+
349
+ - `{ "approved": true }` records an approval, as a webhook approval is recorded but with `origin: 'recheck'`, and the
350
+ call runs. An `alwaysPrompt` tool's approval lets that call alone through, and isn't stored.
351
+ - `{ "approved": false, "pending": true }` polls again after `interval`; after `maxAttempts` polls the call is refused as
352
+ `pending`.
353
+ - `{ "approved": false }` refuses the call as `denied`. Nothing is stored: the next call polls again.
354
+ - An error status, a redirect, a body that isn't such an answer, more than 64 KB, or no answer in 10 seconds refuses the
355
+ call as `pending`, and logs a warning that names only the URL's origin.
356
+
357
+ A recorded denial refuses a call before anything is polled or sent, in both modes.
358
+
359
+ ## Startup checks
360
+
361
+ `ApprovalPlugin.init()` throws `ApprovalConfigurationError` (code `APPROVAL_CONFIGURATION`), and the server doesn't
362
+ start, for options that can't work: `webhook.url` without `webhook.secret`, or a secret under 24 bytes; `webhook.*`
363
+ (other than `challengeTtl`) outside `mode: 'webhook'` or without `webhook.url`; `recheck` in `mode: 'webhook'` or
364
+ without `recheck.url`; a URL that isn't `https://` (or loopback outside production), or has credentials in it;
365
+ `auth: 'bearer'` without `token`, `auth: 'custom'` without `headers`, or either one set for another `auth`; an
366
+ `interval` or `maxAttempts` out of range; and a `callbackPath` that isn't a plain path, that the server reserves (the
367
+ MCP endpoint, `/oauth/*`, `/.well-known/*`), or that another `ApprovalPlugin` serves. Up to 1.11.2 these options were
368
+ accepted and ignored.
199
369
 
200
370
  ## Docs
201
371
 
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Delegation chains: a delegate that delegates further, bounded by `maxDelegationDepth`.
3
+ *
4
+ * @module @frontmcp/plugin-approval
5
+ */
6
+ import type { ApprovalGrantor, DelegationContext } from './types';
7
+ /** How many delegations a context stands for: its own and those in its `chain`. */
8
+ export declare function delegationDepth(context: DelegationContext): number;
9
+ /**
10
+ * Why a delegated grant can't be honoured, or `undefined` when it can: a chain deeper than `maxDepth`, a link whose
11
+ * delegator is not the previous link's delegate, or a party that appears twice.
12
+ */
13
+ export declare function delegationProblem(context: DelegationContext, maxDepth: number): string | undefined;
14
+ /** {@link delegationProblem} for a grantor: `undefined` for one that names no delegation. */
15
+ export declare function grantorDelegationProblem(grantor: ApprovalGrantor, maxDepth: number): string | undefined;
16
+ /**
17
+ * The context of a delegate that delegates further: `context.delegateId` authorizes `delegateId`, and `context` joins
18
+ * the chain.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const toPlanner = { delegatorId: 'user-123', delegateId: 'planner-agent', purpose: 'release' };
23
+ * const toDeployer = extendDelegation(toPlanner, 'deploy-agent', { purpose: 'deploy step' });
24
+ * // { delegatorId: 'planner-agent', delegateId: 'deploy-agent', purpose: 'deploy step',
25
+ * // chain: [{ delegatorId: 'user-123', delegateId: 'planner-agent', purpose: 'release' }] }
26
+ * grantedBy: agentGrantor('deploy-agent', toDeployer)
27
+ * ```
28
+ */
29
+ export declare function extendDelegation(context: DelegationContext, delegateId: string, options?: Pick<DelegationContext, 'purpose' | 'constraints'>): DelegationContext;
30
+ //# sourceMappingURL=delegation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegation.d.ts","sourceRoot":"","sources":["../../src/approval/delegation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAkB,MAAM,SAAS,CAAC;AAElF,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAElE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAelG;AAED,6FAA6F;AAC7F,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvG;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,aAAa,CAAM,GAC/D,iBAAiB,CAQnB"}
@@ -6,8 +6,13 @@
6
6
  *
7
7
  * @module @frontmcp/plugin-approval
8
8
  */
9
- import { PublicMcpError } from '@frontmcp/sdk';
9
+ import { InternalMcpError, PublicMcpError } from '@frontmcp/sdk';
10
10
  import type { ApprovalScope } from './types';
11
+ /** Raised at startup for `ApprovalPlugin` options that cannot work, such as a webhook without a secret. */
12
+ export declare class ApprovalConfigurationError extends InternalMcpError {
13
+ readonly name = "ApprovalConfigurationError";
14
+ constructor(message: string);
15
+ }
11
16
  /**
12
17
  * Base class for approval-related errors.
13
18
  */
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/approval/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;GAEG;AACH,qBAAa,aAAc,SAAQ,cAAc;gBACnC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAsB,EAAE,UAAU,SAAM;CAI1E;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;aAEpC,OAAO,EAAE;QACvB,sBAAsB;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,6BAA6B;QAC7B,KAAK,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;QACxC,0BAA0B;QAC1B,OAAO,EAAE,MAAM,CAAC;QAChB,0CAA0C;QAC1C,eAAe,CAAC,EAAE;YAChB,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;YAChC,YAAY,CAAC,EAAE,aAAa,CAAC;YAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,SAAS,CAAC,EAAE,MAAM,CAAC;SACpB,CAAC;KACH;gBAfe,OAAO,EAAE;QACvB,sBAAsB;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,6BAA6B;QAC7B,KAAK,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;QACxC,0BAA0B;QAC1B,OAAO,EAAE,MAAM,CAAC;QAChB,0CAA0C;QAC1C,eAAe,CAAC,EAAE;YAChB,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;YAChC,YAAY,CAAC,EAAE,aAAa,CAAC;YAC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;;;;gCAfQ,aAAa,EAAE;+BAChB,aAAa;2BACjB,MAAM;2BACN,MAAM;4BACL,MAAM;;;;CAuBzB;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,aAAa;aAErC,SAAS,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO;aACvC,MAAM,EAAE,MAAM;gBADd,SAAS,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,EACvC,MAAM,EAAE,MAAM;IAMhC;;OAEG;IACH,cAAc;;;;;;;;CAUf;AAED;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,aAAa;aAE3C,cAAc,EAAE,aAAa;aAC7B,aAAa,EAAE,aAAa,EAAE;gBAD9B,cAAc,EAAE,aAAa,EAC7B,aAAa,EAAE,aAAa,EAAE;IAWhD;;OAEG;IACH,cAAc;;;;;;;;;CAWf;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;aAEnC,MAAM,EAAE,MAAM;aACd,SAAS,EAAE,MAAM;gBADjB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM;IAMnC;;OAEG;IACH,cAAc;;;;;;;;;CAWf;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,aAAa;aAEvC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc;gBAA5D,MAAM,GAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,cAA0B,EACxF,OAAO,CAAC,EAAE,MAAM;IAMlB;;OAEG;IACH,cAAc;;;;;;;;CAUf"}
@@ -25,7 +25,7 @@
25
25
  *
26
26
  * @module @frontmcp/utils/approval
27
27
  */
28
- import type { ApprovalGrantor, ApprovalRevoker, ApprovalSourceType, RevocationSourceType, DelegationContext, ApprovalMethod } from './types';
28
+ import type { ApprovalGrantor, ApprovalMethod, ApprovalRevoker, ApprovalSourceType, DelegationContext, RevocationSourceType } from './types';
29
29
  /**
30
30
  * Create a user grantor for interactive approvals.
31
31
  *
@@ -1 +1 @@
1
- {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BAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IACR,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC,GACA,eAAe,CASjB;AAMD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,eAAe,CAOjF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,eAAe,CAOnF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAK/C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAMrE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CAOpF;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,kBAAkB,GAAG,SAAS,GAAG,eAAe,CAQzG;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,oBAAoB,GAAG,SAAS,GAAG,eAAe,CAQ3G"}
@@ -35,9 +35,10 @@
35
35
  * }
36
36
  * ```
37
37
  */
38
- export { ApprovalScope, ApprovalState, type ApprovalContext, type ApprovalSourceType, type ApprovalMethod, type DelegationContext, type ApprovalGrantor, type RevocationSourceType, type RevocationMethod, type ApprovalRevoker, type ApprovalRecord, type ApprovalCategory, type RiskLevel, type ToolApprovalRequirement, } from './types';
39
- export { approvalScopeSchema, approvalStateSchema, approvalMethodSchema, approvalSourceTypeSchema, revocationMethodSchema, approvalCategorySchema, riskLevelSchema, approvalContextSchema, delegationContextSchema, approvalGrantorSchema, approvalRevokerSchema, approvalRecordSchema, toolApprovalRequirementSchema, type ApprovalContextInput, type DelegationContextInput, type ApprovalGrantorInput, type ApprovalRevokerInput, type ApprovalRecordInput, type ToolApprovalRequirementInput, } from './schemas';
38
+ export { ApprovalScope, ApprovalState, type ApprovalContext, type ApprovalSourceType, type ApprovalMethod, type DelegationContext, type DelegationLink, type ApprovalGrantor, type RevocationSourceType, type RevocationMethod, type ApprovalRevoker, type ApprovalRecord, type ApprovalCategory, type RiskLevel, type ToolApprovalRequirement, } from './types';
39
+ export { approvalScopeSchema, approvalStateSchema, approvalMethodSchema, approvalSourceTypeSchema, revocationMethodSchema, approvalCategorySchema, riskLevelSchema, approvalContextSchema, delegationContextSchema, delegationLinkSchema, MAX_DELEGATION_CHAIN_LINKS, approvalGrantorSchema, approvalRevokerSchema, approvalRecordSchema, toolApprovalRequirementSchema, type ApprovalContextInput, type DelegationContextInput, type DelegationLinkInput, type ApprovalGrantorInput, type ApprovalRevokerInput, type ApprovalRecordInput, type ToolApprovalRequirementInput, } from './schemas';
40
40
  export { userGrantor, policyGrantor, adminGrantor, systemGrantor, agentGrantor, apiGrantor, oauthGrantor, testGrantor, customGrantor, userRevoker, adminRevoker, expiryRevoker, sessionEndRevoker, policyRevoker, normalizeGrantor, normalizeRevoker, } from './factories';
41
+ export { delegationDepth, delegationProblem, extendDelegation } from './delegation';
41
42
  export { isGrantorSource, isHumanGrantor, isAutoGrantor, isDelegatedGrantor, isApiGrantor, hasGrantorIdentifier, hasGrantorDisplayName, } from './guards';
42
- export { ApprovalError, ApprovalRequiredError, ApprovalOperationError, ApprovalScopeNotAllowedError, ApprovalExpiredError, ChallengeValidationError, } from './errors';
43
+ export { ApprovalError, ApprovalRequiredError, ApprovalOperationError, ApprovalScopeNotAllowedError, ApprovalExpiredError, ChallengeValidationError, ApprovalConfigurationError, } from './errors';
43
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/approval/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,EAEL,aAAa,EACb,aAAa,EAEb,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,uBAAuB,GAC7B,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAE7B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,GAClC,MAAM,WAAW,CAAC;AAGnB,OAAO,EAEL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EAEb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,aAAa,EAEb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/approval/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,EAEL,aAAa,EACb,aAAa,EAEb,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,uBAAuB,GAC7B,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAE7B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,GAClC,MAAM,WAAW,CAAC;AAGnB,OAAO,EAEL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EAEb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,aAAa,EAEb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGpF,OAAO,EACL,eAAe,EACf,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,UAAU,CAAC"}
@@ -39,11 +39,23 @@ export declare const approvalContextSchema: import("@frontmcp/lazy-zod").ZodObje
39
39
  identifier: import("@frontmcp/lazy-zod").ZodString;
40
40
  metadata: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
41
41
  }, import("zod/v4/core").$strip>;
42
+ /** The longest delegation chain a record can hold, whatever `maxDelegationDepth` says. */
43
+ export declare const MAX_DELEGATION_CHAIN_LINKS = 64;
44
+ export declare const delegationLinkSchema: import("@frontmcp/lazy-zod").ZodObject<{
45
+ delegatorId: import("@frontmcp/lazy-zod").ZodString;
46
+ delegateId: import("@frontmcp/lazy-zod").ZodString;
47
+ purpose: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
48
+ }, import("zod/v4/core").$strip>;
42
49
  export declare const delegationContextSchema: import("@frontmcp/lazy-zod").ZodObject<{
43
50
  delegatorId: import("@frontmcp/lazy-zod").ZodString;
44
51
  delegateId: import("@frontmcp/lazy-zod").ZodString;
45
52
  purpose: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
46
53
  constraints: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
54
+ chain: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodObject<{
55
+ delegatorId: import("@frontmcp/lazy-zod").ZodString;
56
+ delegateId: import("@frontmcp/lazy-zod").ZodString;
57
+ purpose: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
58
+ }, import("zod/v4/core").$strip>>>;
47
59
  }, import("zod/v4/core").$strip>;
48
60
  export declare const approvalGrantorSchema: import("@frontmcp/lazy-zod").ZodObject<{
49
61
  source: import("@frontmcp/lazy-zod").ZodString;
@@ -62,6 +74,11 @@ export declare const approvalGrantorSchema: import("@frontmcp/lazy-zod").ZodObje
62
74
  delegateId: import("@frontmcp/lazy-zod").ZodString;
63
75
  purpose: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
64
76
  constraints: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
77
+ chain: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodObject<{
78
+ delegatorId: import("@frontmcp/lazy-zod").ZodString;
79
+ delegateId: import("@frontmcp/lazy-zod").ZodString;
80
+ purpose: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
81
+ }, import("zod/v4/core").$strip>>>;
65
82
  }, import("zod/v4/core").$strip>>;
66
83
  }, import("zod/v4/core").$strip>;
67
84
  export declare const approvalRevokerSchema: import("@frontmcp/lazy-zod").ZodObject<{
@@ -106,6 +123,11 @@ export declare const approvalRecordSchema: import("@frontmcp/lazy-zod").ZodObjec
106
123
  delegateId: import("@frontmcp/lazy-zod").ZodString;
107
124
  purpose: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
108
125
  constraints: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
126
+ chain: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodObject<{
127
+ delegatorId: import("@frontmcp/lazy-zod").ZodString;
128
+ delegateId: import("@frontmcp/lazy-zod").ZodString;
129
+ purpose: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
130
+ }, import("zod/v4/core").$strip>>>;
109
131
  }, import("zod/v4/core").$strip>>;
110
132
  }, import("zod/v4/core").$strip>;
111
133
  approvalChain: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodObject<{
@@ -125,6 +147,11 @@ export declare const approvalRecordSchema: import("@frontmcp/lazy-zod").ZodObjec
125
147
  delegateId: import("@frontmcp/lazy-zod").ZodString;
126
148
  purpose: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
127
149
  constraints: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
150
+ chain: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodObject<{
151
+ delegatorId: import("@frontmcp/lazy-zod").ZodString;
152
+ delegateId: import("@frontmcp/lazy-zod").ZodString;
153
+ purpose: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
154
+ }, import("zod/v4/core").$strip>>>;
128
155
  }, import("zod/v4/core").$strip>>;
129
156
  }, import("zod/v4/core").$strip>>>;
130
157
  reason: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
@@ -171,6 +198,7 @@ export declare const toolApprovalRequirementSchema: import("@frontmcp/lazy-zod")
171
198
  }, import("zod/v4/core").$strip>>>;
172
199
  }, import("zod/v4/core").$strip>;
173
200
  export type ApprovalContextInput = z.input<typeof approvalContextSchema>;
201
+ export type DelegationLinkInput = z.input<typeof delegationLinkSchema>;
174
202
  export type DelegationContextInput = z.input<typeof delegationContextSchema>;
175
203
  export type ApprovalGrantorInput = z.input<typeof approvalGrantorSchema>;
176
204
  export type ApprovalRevokerInput = z.input<typeof approvalRevokerSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/approval/schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAMvD,eAAO,MAAM,mBAAmB,4DAA8B,CAAC;AAE/D,eAAO,MAAM,mBAAmB,4DAA8B,CAAC;AAE/D,eAAO,MAAM,oBAAoB;;;;;;EAAoE,CAAC;AAEtG,eAAO,MAAM,wBAAwB,wCAAoB,CAAC;AAE1D,eAAO,MAAM,sBAAsB;;;;;EAA0D,CAAC;AAE9F,eAAO,MAAM,sBAAsB;;;;;;EAA0D,CAAC;AAE9F,eAAO,MAAM,eAAe;;;;;EAAgD,CAAC;AAM7E,eAAO,MAAM,qBAAqB;;;;gCAIhC,CAAC;AAMH,eAAO,MAAM,uBAAuB;;;;;gCAKlC,CAAC;AAMH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;gCAOhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;gCAKhC,CAAC;AAMH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAiB/B,CAAC;AAMH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;gCAWxC,CAAC;AAMH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAiB/B,CAAC;AAMH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;gCAWxC,CAAC;AAMH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
@@ -66,12 +66,28 @@ export type ApprovalSourceType = 'user' | 'policy' | 'admin' | 'system' | 'agent
66
66
  * How the approval was obtained.
67
67
  */
68
68
  export type ApprovalMethod = 'interactive' | 'implicit' | 'delegation' | 'batch' | 'api';
69
+ /**
70
+ * One delegation in a chain: `delegatorId` authorized `delegateId`.
71
+ */
72
+ export interface DelegationLink {
73
+ /** Who authorized the delegate */
74
+ delegatorId: string;
75
+ /** Who was authorized */
76
+ delegateId: string;
77
+ /** Purpose of the delegation */
78
+ purpose?: string;
79
+ }
69
80
  /**
70
81
  * Context for delegated approvals (e.g., AI agent with delegated authority).
71
82
  * Per MCP spec, tracks the delegation chain for audit purposes.
83
+ *
84
+ * A delegate can delegate further: `chain` lists the delegations the delegator's own authority came from, the original
85
+ * delegator's first. Each link's `delegateId` is the next link's `delegatorId`, and the last link's is this context's
86
+ * `delegatorId`. The chain's depth, `chain.length + 1`, is bounded by `ApprovalPlugin`'s `maxDelegationDepth`; build a
87
+ * deeper one with `extendDelegation()`.
72
88
  */
73
89
  export interface DelegationContext {
74
- /** Who authorized the delegate (user ID, admin ID) */
90
+ /** Who authorized the delegate (user ID, admin ID, or a delegate that delegates further) */
75
91
  delegatorId: string;
76
92
  /** Who was authorized (agent ID, service account) */
77
93
  delegateId: string;
@@ -79,6 +95,8 @@ export interface DelegationContext {
79
95
  purpose?: string;
80
96
  /** Constraints on the delegation (paths, actions, etc.) */
81
97
  constraints?: Record<string, unknown>;
98
+ /** The delegations above this one, the original delegator's first; absent for a direct delegation */
99
+ chain?: DelegationLink[];
82
100
  }
83
101
  /**
84
102
  * Full audit trail for who/what granted an approval.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/approval/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;GAEG;AACH,oBAAY,aAAa;IACvB,8DAA8D;IAC9D,OAAO,YAAY;IAEnB,oEAAoE;IACpE,IAAI,SAAS;IAEb,sEAAsE;IACtE,YAAY,iBAAiB;IAE7B,0DAA0D;IAC1D,aAAa,kBAAkB;IAE/B,wEAAwE;IACxE,gBAAgB,qBAAqB;CACtC;AAMD;;GAEG;AACH,oBAAY,aAAa;IACvB,oCAAoC;IACpC,OAAO,YAAY;IAEnB,2CAA2C;IAC3C,QAAQ,aAAa;IAErB,yCAAyC;IACzC,MAAM,WAAW;IAEjB,4CAA4C;IAC5C,OAAO,YAAY;CACpB;AAMD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IAEb,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IAEnB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAMD;;;;;;;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Ae,CAAC;IAE5B,4BAA4B;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAE7B;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,eAAe,EAAE,CAAC;CACzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"approval.context-extension.d.ts","sourceRoot":"","sources":["../src/approval.context-extension.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAOnE,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,oBAAoB;QAC5B;;;WAGG;QACH,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;KACpC;CACF;AAQD;;;GAGG;AACH,wBAAgB,+BAA+B,IAAI,IAAI,CActD"}
1
+ {"version":3,"file":"approval.context-extension.d.ts","sourceRoot":"","sources":["../src/approval.context-extension.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAMnE,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,oBAAoB;QAC5B;;;WAGG;QACH,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;KACpC;CACF;AAQD;;;GAGG;AACH,wBAAgB,+BAA+B,IAAI,IAAI,CActD"}
@@ -11,6 +11,8 @@ export interface ApprovalIdentity {
11
11
  userId: string | undefined;
12
12
  }
13
13
  type ApprovalCallerContext = Pick<FrontMcpContext, 'verifiedSessionId' | 'authInfo'>;
14
+ /** Whether a session key names no one: no approval granted to it can ever match a later call. */
15
+ export declare function isUnidentifiedSession(sessionId: string): boolean;
14
16
  /**
15
17
  * The session and user that a call's approvals are read from and granted to.
16
18
  *
@@ -1 +1 @@
1
- {"version":3,"file":"approval.identity.d.ts","sourceRoot":"","sources":["../src/approval.identity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,KAAK,qBAAqB,GAAG,IAAI,CAAC,eAAe,EAAE,mBAAmB,GAAG,UAAU,CAAC,CAAC;AAMrF;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,qBAAqB,GAAG,SAAS,GAAG,gBAAgB,CAWhG"}
1
+ {"version":3,"file":"approval.identity.d.ts","sourceRoot":"","sources":["../src/approval.identity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,KAAK,qBAAqB,GAAG,IAAI,CAAC,eAAe,EAAE,mBAAmB,GAAG,UAAU,CAAC,CAAC;AAKrF,iGAAiG;AACjG,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEhE;AAMD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,qBAAqB,GAAG,SAAS,GAAG,gBAAgB,CAWhG"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The checks `ApprovalPlugin.init()` runs on its webhook and recheck options, and the settings they resolve to.
3
+ *
4
+ * @module @frontmcp/plugin-approval
5
+ */
6
+ import type { ApprovalPluginOptions, RecheckHeaders } from './approval.plugin';
7
+ /** Where `mode: 'webhook'` takes decisions when `webhook.callbackPath` is not set. */
8
+ export declare const DEFAULT_CALLBACK_PATH = "/approval/callback";
9
+ /** How long a request waits between two polls of `recheck.url` when `recheck.interval` is not set. */
10
+ export declare const DEFAULT_RECHECK_INTERVAL_MS = 2000;
11
+ /** How many times a request polls `recheck.url` when `recheck.maxAttempts` is not set. */
12
+ export declare const DEFAULT_RECHECK_MAX_ATTEMPTS = 5;
13
+ export interface ResolvedWebhook {
14
+ url: string;
15
+ signingKey: Uint8Array;
16
+ includeJwt: boolean;
17
+ callbackPath: string;
18
+ challengeTtlSeconds: number;
19
+ }
20
+ export type RecheckAuth = 'jwt' | 'bearer' | 'none' | 'custom';
21
+ export interface ResolvedRecheck {
22
+ url: string;
23
+ auth: RecheckAuth;
24
+ token?: string;
25
+ headers?: RecheckHeaders;
26
+ signingKey?: Uint8Array;
27
+ intervalMs: number;
28
+ maxAttempts: number;
29
+ }
30
+ /** The external approval system the options configure: a webhook, a recheck endpoint, or neither. */
31
+ export interface ResolvedExternalApproval {
32
+ webhook?: ResolvedWebhook;
33
+ recheck?: ResolvedRecheck;
34
+ }
35
+ /**
36
+ * The webhook and recheck settings `options` configure, checked. Throws `ApprovalConfigurationError`, so the server
37
+ * doesn't start, for a combination that cannot work: a webhook without a secret, an `http://` URL in production,
38
+ * `webhook.*` outside `mode: 'webhook'`, `recheck.auth: 'bearer'` without a token, and so on.
39
+ */
40
+ export declare function resolveExternalApproval(options: ApprovalPluginOptions): ResolvedExternalApproval;
41
+ /** The deepest delegation chain a delegated approval may name: `maxDelegationDepth`, a whole number from 0 to 64. */
42
+ export declare function resolveMaxDelegationDepth(options: ApprovalPluginOptions): number;
43
+ //# sourceMappingURL=approval.options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval.options.d.ts","sourceRoot":"","sources":["../src/approval.options.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAI/E,sFAAsF;AACtF,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D,sGAAsG;AACtG,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AAEjD,0FAA0F;AAC1F,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAW9C,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE/D,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qGAAqG;AACrG,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAsHD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,qBAAqB,GAAG,wBAAwB,CAEhG;AAED,qHAAqH;AACrH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAGhF"}