@happyvertical/smrt-app-mcp 0.62.4 → 0.62.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -23,6 +23,13 @@ tool policy; `./sveltekit` owns the stateless Streamable HTTP transport.
23
23
  `@smrt()` `McpCallAudit` model lives only behind the `./audit-store` subpath
24
24
  (smrt#4957), never in the main entry.
25
25
 
26
+ - `approvals` (`src/approval-gate.ts`, structural `McpApprovalGate`) replaces
27
+ `confirm: true` for gated tools: assertions first, then the gate opens or
28
+ consumes an approval keyed by `mcpApprovalBindingHash` (tool, canonical args
29
+ without `confirm`, tenant, principal). Fail closed (`approval_unavailable`);
30
+ no decide path exists here; the adapter lives in `@happyvertical/smrt-approvals`
31
+ (`createApprovalMcpGate`). Never import approvals from this package.
32
+
26
33
  - Generate tools from core scoped to the allow-list (`MCPConfig.classNames`),
27
34
  then filter by allowed class names: a duplicate tool name among registered
28
35
  classes the app never publishes must not fail its catalog or calls (#3490).
@@ -33,13 +40,16 @@ tool policy; `./sveltekit` owns the stateless Streamable HTTP transport.
33
40
  - Keep app policy outside generated tool schemas. The wrapper owns auth, allow-list, and workflow assertion behavior.
34
41
  - Return 404 for tools outside the app allow-list so private generated tools are not enumerated by mistake.
35
42
  - Trust only a principal supplied by the application adapter. This package
36
- does not implement an OAuth authorization server. The opt-in `./auth` entry
43
+ validates tokens and does not issue them; issuance lives in
44
+ `@happyvertical/smrt-users` (see
45
+ `docs/content/architecture/remote-mcp-authorization.md`). The opt-in `./auth` entry
37
46
  validates JWT access tokens and requires an application-owned principal mapper.
38
47
  - Mount `mountMcpRoute` as one modern `POST` endpoint. It creates a fresh
39
48
  protocol server per request, emits no session id, and refuses subscriptions.
40
49
  - `mountMcpAppRoute` (`src/defaults.ts` + `./sveltekit`) is the one-call app
41
50
  route: explicit `models` allow-list, required `requiredScopes`, principal from
42
- session locals (`principalFromSessionLocals`). App policies compose with the
51
+ session locals (`principalFromSessionLocals`; absent `principalKind` denies
52
+ unless `defaultPrincipalKind` is set). App policies compose with the
43
53
  default and may only narrow it. Its `Origin` check (default on; opt-in on
44
54
  `mountMcpRoute`) runs before auth and dispatch; no-`Origin` clients pass.
45
55
  `effects` filters the catalog by `mcpToolEffect` (excluded tools 404).
@@ -63,11 +73,26 @@ tool policy; `./sveltekit` owns the stateless Streamable HTTP transport.
63
73
  principal; a presented bearer must verify (401, never cookie fallback); no
64
74
  metadata (404). Hosted, `runtime.resolveMcpPrincipal` is the default
65
75
  identity mapping; an explicit `resolvePrincipal` overrides it.
76
+ `runtime.mcpSelfIssuer` (app is its own issuer, #5080): verify in process via
77
+ `verifyAccessToken(token, resource)`, then `validateGrant(claims)` on every
78
+ call (anything but `true` = 401); no JWKS/issuer env; metadata advertises
79
+ its issuer. Override mappings never skip the liveness check.
66
80
  - Adapters stamp `principal.tenantBinding` for `bindPrincipal`: the local
67
81
  token adapter always `direct`; the JWT adapter the mapping's value or
68
82
  `direct-or-inherited`. Never derive it from request input. Both adapters
69
83
  read principals/mappings from own data only (`own-data.ts`): inherited
70
84
  values, accessors and poison keys deny.
85
+ - A policy-denied call (scopes, `toolPolicy`, effects) answers exactly like an
86
+ unknown tool (404 `Unknown MCP tool.`, no `data.code`) so the catalog cannot
87
+ be probed; only the audit record carries `mcp_tool_access_denied` (the
88
+ `McpAccessError.auditCode`). Anonymous callers still get 401 for a tool that
89
+ needs authentication, which the OAuth challenge requires. Agent principals
90
+ (`kind: 'agent'`, #5086) pass the default policy only when `principalKinds`
91
+ lists them.
92
+ - `mountMcpToolsRoute`/`mountMcpCallRoute` share the modern route's
93
+ `auth`/`bindPrincipal` sequence (`authenticateAndDispatch`): a bearer agent
94
+ lists and calls with the same live-capped scopes on every route. `mountMcpRoute`
95
+ with `auth` but no `bindPrincipal` authorizes on token scopes only.
71
96
  - Keep tool catalogs private by default. Public caching requires an explicit
72
97
  attestation and a global, unauthenticated, read-only, non-tenant catalog with
73
98
  no principal-aware policy.
package/README.md CHANGED
@@ -52,7 +52,11 @@ export const POST = mountMcpAppRoute({
52
52
  error (404 semantics).
53
53
  - **Principal** — `principalFromSessionLocals` reads only `locals.user.id`, the
54
54
  session-authorized `locals.tenantId`, and `locals.permissions` (as sorted
55
- `scopes`, `kind: 'human'`). Missing or malformed fields mean unauthenticated.
55
+ `scopes`, `kind` from `locals.principalKind` as classified by the app
56
+ runtime). An absent or unclassifiable kind is unauthenticated, so a session
57
+ hook that never sets it (for example `smrt-users` `createSessionHandler`
58
+ without the app runtime) is denied; a host that knowingly asserts one kind
59
+ opts in with `defaultPrincipalKind`, unset by default. Missing or malformed fields mean unauthenticated.
56
60
  URL-selected tenants, headers and bodies are never identity inputs. Override
57
61
  with `resolvePrincipal`.
58
62
  - **Policy** — `requiredScopes` is required: every authenticated principal must
@@ -196,10 +200,19 @@ methods; the s-m-r-t SvelteKit runtime has both.
196
200
  membership, and denies anything else. Pass `resolvePrincipal` when users
197
201
  belong to several tenants.
198
202
 
203
+ - **The app as its own issuer.** A runtime that sets `mcpSelfIssuer` (the
204
+ s-m-r-t runtime's `mcp.authorizationServer` option) makes hosted auth verify
205
+ tokens in process, re-check the grant's liveness on every call (revoked
206
+ grant, inactive user or tenant: 401), and advertise its own issuer; no
207
+ `SMRT_MCP_ISSUER` / `SMRT_MCP_JWKS_URI` is read. The default mapping is
208
+ `sub` to the principal id and the live grant's tenant to `tenantId`
209
+ (`kind: 'human'`); claims never select a tenant. An explicit
210
+ `resolvePrincipal` still overrides the mapping, not the liveness check.
211
+
199
212
  `mountMcpProtectedResourceMetadataRoute` serves the RFC 9728 document only at
200
213
  the adapter's advertised `metadataUrl` path. It returns 404 for any other
201
- path, and in the `local` profile (no adapter, or the local token adapter). It
202
- does not implement an OAuth authorization server.
214
+ path, and in the `local` profile (no adapter, or the local token adapter). This
215
+ route does not issue tokens.
203
216
 
204
217
  For piping a deployed app's MCP surface to a local stdio MCP client, see `@happyvertical/smrt-app-cli` — the client-side runtime CLI exposes a `startMcpBridge()` default and a generic `smrt-mcp-bridge` bin.
205
218
 
@@ -208,8 +221,18 @@ For public deployments, follow the
208
221
  The server trusts the principal supplied by the application adapter. Validate
209
222
  bearer tokens at an application gateway or with the server-only `./auth` JWT
210
223
  adapter, then resolve fresh application membership and tenant authority on every
211
- request. The OAuth issuer remains operator-owned; this package does not implement
212
- an OAuth authorization server.
224
+ request. This package validates tokens; it does not issue them. Two issuer paths
225
+ are supported: the application as its own OAuth authorization server through
226
+ `@happyvertical/smrt-users` (authorization code with S256 PKCE, refresh,
227
+ RFC 8414 discovery, JWKS, revocation, RFC 8707 resource binding, RFC 9207 `iss`,
228
+ opt-in Dynamic Client Registration, opt-in Client ID Metadata Documents through
229
+ `createCimdAuthorizationServer` with a required `allowClientOrigin` policy,
230
+ host-owned login and consent), or an external issuer you operate. The contract
231
+ page above describes both, with the end-to-end app-as-issuer wiring (pass
232
+ `mcp: { authorizationServer: { server, authorization, resource, scopes } }` to
233
+ `createSmrtSvelteKitRuntime`), live per-call revocation, the default principal
234
+ mapping, client registration choices, webhook signing profiles for waking
235
+ agents and an ordered agent-ready app checklist.
213
236
 
214
237
  ```ts
215
238
  // src/lib/server/mcp.ts
@@ -268,6 +291,16 @@ workflowTools: [{
268
291
  }],
269
292
  ```
270
293
 
294
+ ### Agent users
295
+
296
+ An agent is a user with a `bot` profile. `runtime.resolveMcpPrincipal` stamps
297
+ `kind: 'agent'` for it (app-issued or OIDC tokens); the default policy accepts
298
+ `human` only, so serve agents with `principalKinds: ['human', 'agent']`. With
299
+ `mountMcpAppRoute({ runtime })` the binder caps the token's scopes by the
300
+ agent's live role permissions, and `toolScopes` maps tools to permission slugs:
301
+ the agent lists and calls only what both its role and its token allow, and a
302
+ revoked permission removes the tool from the next list and call.
303
+
271
304
  ### Tool scopes, confirm gate and persistent audit
272
305
 
273
306
  Scoped credentials for external agents need no app-local policy parsing:
@@ -286,14 +319,17 @@ createDefaultMcpAppServer({
286
319
 
287
320
  - **Scopes.** A workflow tool declares `requiredScopes`; the host may also map
288
321
  patterns with `toolScopes`. A tool whose scopes the principal (`principal.scopes`)
289
- does not hold is hidden from `tools/list` and denied (403) on call; this is
290
- ANDed with `toolPolicy`. An anonymous caller holds none, so a scoped tool is
322
+ does not hold is hidden from `tools/list` and refused on call exactly like an
323
+ unknown tool (404, no existence oracle; the audit record keeps the real
324
+ reason); this is ANDed with `toolPolicy`. An anonymous caller holds none, so a scoped tool is
291
325
  never public.
292
326
  - **Confirm.** A gated tool is refused before any `workflowAssertions` or
293
327
  handler runs unless `arguments.confirm === true`: the result is `isError` with
294
328
  `structuredContent.error.code === 'confirm_required'`, audited `denied`.
295
329
  Discovery advertises a boolean `confirm` property. For generated tools the
296
- `confirm` flag is consumed by the gate and not forwarded.
330
+ `confirm` flag is consumed by the gate and not forwarded. The flag is supplied
331
+ by the caller: it stops an agent acting without asking its user, and is not a
332
+ human sign-off (use `@happyvertical/smrt-approvals` for that).
297
333
  - **Audit.** `onToolCall` events now also carry `tenantId`, `argumentKeys`
298
334
  and `occurredAt`; `auditSink.record(record)` receives the persistable
299
335
  `McpAuditRecord` (`principalId`, `principalKind`, `tool`, `tenantId`,
@@ -308,6 +344,44 @@ createDefaultMcpAppServer({
308
344
  Run your schema bootstrap/migrations so the table exists. Implement
309
345
  `McpAuditSink` for any other store; `createInMemoryMcpAuditSink()` suits tests.
310
346
 
347
+ ### Person-approved gated calls (`approvals`)
348
+
349
+ Set `approvals` to an `McpApprovalGate` (structural `{ check(request) }`) and a
350
+ `confirmTools`/`requiresConfirm` call stops being authorized by
351
+ `confirm: true`. `@happyvertical/smrt-approvals` ships the adapter, so neither
352
+ package depends on the other:
353
+
354
+ ```ts
355
+ import { createApprovalMcpGate } from '@happyvertical/smrt-approvals';
356
+
357
+ createMcpAppServer({
358
+ confirmTools: ['mail_send'],
359
+ approvals: createApprovalMcpGate({ service: new ApprovalService({ db }) }),
360
+ auditSink,
361
+ // ...
362
+ });
363
+ ```
364
+
365
+ 1. First call: host assertions run, then one approval request is opened per
366
+ binding (idempotent) and the call answers `isError` `approval_pending`
367
+ (`details.approvalId`). Nothing runs.
368
+ 2. A person (a `human` principal holding `approvals.approve-mcp-tool`, never the
369
+ requester, never an agent or service) decides through the host's approval UI
370
+ or `ApprovalService.decide`. This server exposes no decide path.
371
+ 3. The identical retried call consumes the approval and runs once. The binding
372
+ is SHA-256 over tool, canonical arguments (key order ignored, `confirm`
373
+ excluded), tenant and principal id. Replays, changed arguments, another
374
+ principal or tenant, rejection, expiry and an already-consumed approval
375
+ answer `approval_refused` with a short reason.
376
+
377
+ The approver reviews a server-built summary stored on the request (tool, principal kind and id, and the arguments as JSON with values under secret-looking keys such as password, token, apiKey, authorization or cookie replaced by `[redacted]`, at any depth; `approvalRedact(tool, args)` can mask more). It never contains agent-supplied free text outside that JSON, and arguments too large to review (3000 characters) are refused. The binding hash covers the real arguments, so changing even a redacted value needs a new approval. After a reviewer requests changes the call is refused with a hint to change the arguments. A consumed or expired approval never runs again, but the identical call later opens a fresh request (concurrent retries share one live request), so a failed or legitimately repeated call can be approved again; a rejected or changes-requested call stays refused until its arguments change. Any adapter error, missing principal id or tenant, or non-JSON
378
+ argument answers `approval_unavailable` and the call does not run. The approval
379
+ is consumed before the tool runs, so a tool that fails after consumption needs a
380
+ new approval. Audit records use `errorCode`: `approval_requested` (request
381
+ opened, `denied`), `approval_pending`, `approval_refused`, `approval_unavailable`
382
+ (all `denied`) and `approval_consumed` on the `allowed` record of the call that
383
+ ran; the approver and decision are in the approvals event ledger.
384
+
311
385
  ### Host operations, audit and typed errors
312
386
 
313
387
  `@happyvertical/smrt-app-mcp/host-operations` (browser-safe, dependency-free)
@@ -403,7 +477,9 @@ await client.callTool({
403
477
  Applications that have not moved their route path can retain the deprecated
404
478
  handlers below while they migrate. They are REST-shaped compatibility aliases,
405
479
  not an MCP transport. Direct calls to a tool outside the app allow-list
406
- continue to receive the safe 404 behavior.
480
+ continue to receive the safe 404 behavior. They honor `auth` and
481
+ `bindPrincipal` like `mountMcpRoute`, so a bearer principal (including an
482
+ agent user) gets the same live-role-filtered list and the same refusals.
407
483
 
408
484
  ```ts
409
485
  // src/routes/api/mcp/tools/+server.ts
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Approval gate for `confirmTools`-gated calls (#5087, slice 5 of #3716).
3
+ *
4
+ * With an {@link McpApprovalGate} configured, a gated call no longer runs on
5
+ * `confirm: true`: the first call opens an approval request and answers
6
+ * `approval_pending`; a person decides elsewhere (never through this server);
7
+ * the retried identical call consumes the approval and runs once. This module
8
+ * is structural and dependency-free: `@happyvertical/smrt-approvals` ships an
9
+ * adapter (`createApprovalMcpGate`) that satisfies the interface without
10
+ * either package depending on the other.
11
+ *
12
+ * @packageDocumentation
13
+ */
14
+ /** Stable codes of the approval outcomes returned to the agent. */
15
+ export declare const MCP_APPROVAL_PENDING_CODE = "approval_pending";
16
+ export declare const MCP_APPROVAL_REFUSED_CODE = "approval_refused";
17
+ export declare const MCP_APPROVAL_UNAVAILABLE_CODE = "approval_unavailable";
18
+ /** Audit-only code on the `denied` record of the call that opened a request. */
19
+ export declare const MCP_APPROVAL_REQUESTED_CODE = "approval_requested";
20
+ /** Audit-only code on the `allowed` record of a call that consumed an approval. */
21
+ export declare const MCP_APPROVAL_CONSUMED_CODE = "approval_consumed";
22
+ /** What the gate is asked about one gated call. */
23
+ export interface McpApprovalGateRequest {
24
+ tool: string;
25
+ /** Tenant of the calling principal (required; calls without one are refused). */
26
+ tenantId: string;
27
+ /** Authenticated principal id (credential id or user id). */
28
+ principalId: string;
29
+ /** The principal's `kind` (for example `agent`, `owner`). */
30
+ principalKind: string | null;
31
+ /**
32
+ * SHA-256 hex over tool name, canonical arguments (without `confirm`),
33
+ * tenant and principal. Equal bindings mean the identical call.
34
+ */
35
+ bindingHash: string;
36
+ /** Deterministic idempotency key for this binding. */
37
+ requestKey: string;
38
+ /** Short human-readable description for the person deciding. */
39
+ summary: string;
40
+ }
41
+ /** What the gate decided. Anything but `approved` leaves the call unrun. */
42
+ export type McpApprovalGateResult =
43
+ /** An approval was consumed by this very call: run the tool once. */
44
+ {
45
+ state: 'approved';
46
+ }
47
+ /** A request is awaiting a person's decision. `created` is true for the call that opened it. */
48
+ | {
49
+ state: 'pending';
50
+ approvalId?: string;
51
+ created: boolean;
52
+ }
53
+ /** Rejected, expired, already consumed, mismatched, or otherwise unusable. */
54
+ | {
55
+ state: 'refused';
56
+ reason: string;
57
+ };
58
+ /**
59
+ * Host adapter that turns a gated call into an approval request and later
60
+ * consumes the approval. It must fail closed: a thrown error is treated as
61
+ * `approval_unavailable` and the call does not run. It must never expose a way
62
+ * for the calling principal to decide.
63
+ */
64
+ export interface McpApprovalGate {
65
+ check(request: McpApprovalGateRequest): Promise<McpApprovalGateResult>;
66
+ }
67
+ /**
68
+ * Binding hash of one gated call: SHA-256 hex over a versioned canonical
69
+ * encoding of tool, tenant, principal and arguments (`confirm` excluded by the
70
+ * caller). Throws on a value that is not plain JSON, so an unbindable call is
71
+ * refused rather than approved loosely.
72
+ */
73
+ export declare function mcpApprovalBindingHash(input: {
74
+ tool: string;
75
+ tenantId: string;
76
+ principalId: string;
77
+ args: Record<string, unknown>;
78
+ }): Promise<string>;
79
+ /** Replacement shown instead of a secret-looking value. */
80
+ export declare const MCP_APPROVAL_REDACTED = "[redacted]";
81
+ /** Longest snapshot (characters) an approver is asked to review. */
82
+ export declare const MCP_APPROVAL_MAX_SNAPSHOT = 3000;
83
+ /**
84
+ * Default redaction: values under secret-looking keys, at any depth, become
85
+ * {@link MCP_APPROVAL_REDACTED}. The binding hash still covers the real
86
+ * values; only the reviewable snapshot is redacted.
87
+ */
88
+ export declare function redactMcpApprovalArguments(value: unknown, depth?: number): unknown;
89
+ /**
90
+ * Server-built approver text from trusted data only: tool name, principal
91
+ * and the redacted argument snapshot as JSON (string values are escaped, so
92
+ * an argument can never forge a line of the summary). Returns `null` when the
93
+ * snapshot is too large to review, so the call is refused rather than
94
+ * approved unseen.
95
+ */
96
+ export declare function buildMcpApprovalSummary(input: {
97
+ tool: string;
98
+ principalId: string;
99
+ principalKind: string | null;
100
+ args: Record<string, unknown>;
101
+ redact?: (tool: string, args: Record<string, unknown>) => unknown;
102
+ }): string | null;
103
+ //# sourceMappingURL=approval-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-gate.d.ts","sourceRoot":"","sources":["../src/approval-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,mEAAmE;AACnE,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAC5D,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAC5D,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AACpE,gFAAgF;AAChF,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAChE,mFAAmF;AACnF,eAAO,MAAM,0BAA0B,sBAAsB,CAAC;AAE9D,mDAAmD;AACnD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,4EAA4E;AAC5E,MAAM,MAAM,qBAAqB;AAC/B,qEAAqE;AACnE;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE;AACvB,gGAAgG;GAC9F;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE;AAC7D,8EAA8E;GAC5E;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACxE;AAuCD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,EAAE;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBlB;AAMD,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD,oEAAoE;AACpE,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CAkB7E;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;CACnE,GAAG,MAAM,GAAG,IAAI,CAOhB"}
@@ -1,7 +1,7 @@
1
1
  import { ObjectRegistry, SmrtCollection, SmrtObject, field, smrt } from "@happyvertical/smrt-core";
2
2
  import { TenantScoped, tenantId, withSystemContext, withTenant } from "@happyvertical/smrt-tenancy";
3
3
  //#region src/__smrt-register__.ts
4
- ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-app-mcp","packageVersion":"0.62.4","objects":{"@happyvertical/smrt-app-mcp:McpCallAudit":{"name":"mcpcallaudit","className":"McpCallAudit","qualifiedName":"@happyvertical/smrt-app-mcp:McpCallAudit","collection":"mcpcallaudits","description":"One persisted MCP tool call. Stores identity, tool, tenant, outcome and argument KEY names only: never argument values or response bodies.","filePath":"src/audit-store.ts","packageName":"@happyvertical/smrt-app-mcp","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","nullable","__tenancy","required"],"sqlType":"UUID","nullable":true,"required":false},"required":false},"principalId":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"principalKind":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"identityIssuer":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"identitySubject":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"identityClientId":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"tool":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","default"],"required":true,"default":"","requiredFor":"identity"},"required":true,"default":""},"outcome":{"type":"text","_meta":{"__statedOptions":["required","default","enum"],"required":true,"default":"allowed"},"required":true,"default":"allowed","enum":["allowed","denied","error"]},"errorCode":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"argumentKeys":{"type":"json","_meta":{"__statedOptions":[]},"required":false},"occurredAt":{"type":"datetime","_meta":{"__statedOptions":["required"],"required":true},"required":true}},"methods":{},"decoratorConfig":{"tableName":"smrt_mcp_call_audits","api":false,"mcp":false,"cli":false,"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"McpCallAudit","collectionExportName":"McpCallAuditCollection","validationRules":[{"field":"tool","rule":"required","fieldType":"text"},{"field":"outcome","rule":"required","fieldType":"text"},{"field":"occurredAt","rule":"required","fieldType":"datetime"}],"schema":{"tableName":"smrt_mcp_call_audits","ddl":"CREATE TABLE IF NOT EXISTS \\"smrt_mcp_call_audits\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"principal_id\\" TEXT,\\n \\"principal_kind\\" TEXT,\\n \\"identity_issuer\\" TEXT,\\n \\"identity_subject\\" TEXT,\\n \\"identity_client_id\\" TEXT,\\n \\"tool\\" TEXT NOT NULL DEFAULT '',\\n \\"outcome\\" TEXT NOT NULL DEFAULT 'allowed',\\n \\"error_code\\" TEXT,\\n \\"argument_keys\\" JSON,\\n \\"occurred_at\\" TIMESTAMP NOT NULL\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"principal_id":{"type":"TEXT","notNull":false,"unique":false},"principal_kind":{"type":"TEXT","notNull":false,"unique":false},"identity_issuer":{"type":"TEXT","notNull":false,"unique":false},"identity_subject":{"type":"TEXT","notNull":false,"unique":false},"identity_client_id":{"type":"TEXT","notNull":false,"unique":false},"tool":{"type":"TEXT","notNull":true,"unique":false,"default":""},"outcome":{"type":"TEXT","notNull":true,"unique":false,"default":"allowed"},"error_code":{"type":"TEXT","notNull":false,"unique":false},"argument_keys":{"type":"JSON","notNull":false,"unique":false},"occurred_at":{"type":"TIMESTAMP","notNull":true,"unique":false}},"indexes":[{"name":"smrt_mcp_call_audits_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"smrt_mcp_call_audits_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"e0a722bb"},"importPath":"@happyvertical/smrt-app-mcp/audit-store"},"@happyvertical/smrt-app-mcp:McpCallAuditCollection":{"name":"mcpcallauditcollection","className":"McpCallAuditCollection","qualifiedName":"@happyvertical/smrt-app-mcp:McpCallAuditCollection","collection":"mcpcallaudits","description":"Tenant-aware persistence and queries for McpCallAudit.","filePath":"src/audit-store.ts","packageName":"@happyvertical/smrt-app-mcp","fields":{},"methods":{"append":{"name":"append","async":true,"parameters":[{"name":"record","type":"McpAuditRecord","optional":false}],"returnType":"Promise<McpCallAudit>","isStatic":false,"isPublic":true},"listAudits":{"name":"listAudits","async":true,"parameters":[{"name":"query","type":"any","optional":false,"typeUnresolved":true}],"returnType":"any","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"smrt_mcp_call_audits","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"McpCallAudit","exportName":"McpCallAuditCollection","collectionExportName":"McpCallAuditCollectionCollection","collectionOf":"@happyvertical/smrt-app-mcp:McpCallAudit","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"smrt_mcp_call_audits","ddl":"CREATE TABLE IF NOT EXISTS \\"smrt_mcp_call_audits\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"principal_id\\" TEXT,\\n \\"principal_kind\\" TEXT,\\n \\"identity_issuer\\" TEXT,\\n \\"identity_subject\\" TEXT,\\n \\"identity_client_id\\" TEXT,\\n \\"tool\\" TEXT NOT NULL DEFAULT '',\\n \\"outcome\\" TEXT NOT NULL DEFAULT 'allowed',\\n \\"error_code\\" TEXT,\\n \\"argument_keys\\" JSON,\\n \\"occurred_at\\" TIMESTAMP NOT NULL\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"principal_id":{"type":"TEXT","notNull":false,"unique":false},"principal_kind":{"type":"TEXT","notNull":false,"unique":false},"identity_issuer":{"type":"TEXT","notNull":false,"unique":false},"identity_subject":{"type":"TEXT","notNull":false,"unique":false},"identity_client_id":{"type":"TEXT","notNull":false,"unique":false},"tool":{"type":"TEXT","notNull":true,"unique":false,"default":""},"outcome":{"type":"TEXT","notNull":true,"unique":false,"default":"allowed"},"error_code":{"type":"TEXT","notNull":false,"unique":false},"argument_keys":{"type":"JSON","notNull":false,"unique":false},"occurred_at":{"type":"TIMESTAMP","notNull":true,"unique":false}},"indexes":[{"name":"smrt_mcp_call_audits_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"smrt_mcp_call_audits_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"e0a722bb"},"importPath":"@happyvertical/smrt-app-mcp/audit-store"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-jobs","@happyvertical/smrt-tenancy"],"stampsConstructors":true}`));
4
+ ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-app-mcp","packageVersion":"0.62.5","objects":{"@happyvertical/smrt-app-mcp:McpCallAudit":{"name":"mcpcallaudit","className":"McpCallAudit","qualifiedName":"@happyvertical/smrt-app-mcp:McpCallAudit","collection":"mcpcallaudits","description":"One persisted MCP tool call. Stores identity, tool, tenant, outcome and argument KEY names only: never argument values or response bodies.","filePath":"src/audit-store.ts","packageName":"@happyvertical/smrt-app-mcp","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":false,"autoPopulate":true,"nullable":true,"mode":"optional","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","nullable","__tenancy","required"],"sqlType":"UUID","nullable":true,"required":false},"required":false},"principalId":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"principalKind":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"identityIssuer":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"identitySubject":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"identityClientId":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"tool":{"type":"text","_meta":{"__statedOptions":["required","requiredFor","default"],"required":true,"default":"","requiredFor":"identity"},"required":true,"default":""},"outcome":{"type":"text","_meta":{"__statedOptions":["required","default","enum"],"required":true,"default":"allowed"},"required":true,"default":"allowed","enum":["allowed","denied","error"]},"errorCode":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"argumentKeys":{"type":"json","_meta":{"__statedOptions":[]},"required":false},"occurredAt":{"type":"datetime","_meta":{"__statedOptions":["required"],"required":true},"required":true}},"methods":{},"decoratorConfig":{"tableName":"smrt_mcp_call_audits","api":false,"mcp":false,"cli":false,"tenantScoped":{"mode":"optional"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"McpCallAudit","collectionExportName":"McpCallAuditCollection","validationRules":[{"field":"tool","rule":"required","fieldType":"text"},{"field":"outcome","rule":"required","fieldType":"text"},{"field":"occurredAt","rule":"required","fieldType":"datetime"}],"schema":{"tableName":"smrt_mcp_call_audits","ddl":"CREATE TABLE IF NOT EXISTS \\"smrt_mcp_call_audits\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"principal_id\\" TEXT,\\n \\"principal_kind\\" TEXT,\\n \\"identity_issuer\\" TEXT,\\n \\"identity_subject\\" TEXT,\\n \\"identity_client_id\\" TEXT,\\n \\"tool\\" TEXT NOT NULL DEFAULT '',\\n \\"outcome\\" TEXT NOT NULL DEFAULT 'allowed',\\n \\"error_code\\" TEXT,\\n \\"argument_keys\\" JSON,\\n \\"occurred_at\\" TIMESTAMP NOT NULL\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"principal_id":{"type":"TEXT","notNull":false,"unique":false},"principal_kind":{"type":"TEXT","notNull":false,"unique":false},"identity_issuer":{"type":"TEXT","notNull":false,"unique":false},"identity_subject":{"type":"TEXT","notNull":false,"unique":false},"identity_client_id":{"type":"TEXT","notNull":false,"unique":false},"tool":{"type":"TEXT","notNull":true,"unique":false,"default":""},"outcome":{"type":"TEXT","notNull":true,"unique":false,"default":"allowed"},"error_code":{"type":"TEXT","notNull":false,"unique":false},"argument_keys":{"type":"JSON","notNull":false,"unique":false},"occurred_at":{"type":"TIMESTAMP","notNull":true,"unique":false}},"indexes":[{"name":"smrt_mcp_call_audits_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"smrt_mcp_call_audits_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"e0a722bb"},"importPath":"@happyvertical/smrt-app-mcp/audit-store"},"@happyvertical/smrt-app-mcp:McpCallAuditCollection":{"name":"mcpcallauditcollection","className":"McpCallAuditCollection","qualifiedName":"@happyvertical/smrt-app-mcp:McpCallAuditCollection","collection":"mcpcallaudits","description":"Tenant-aware persistence and queries for McpCallAudit.","filePath":"src/audit-store.ts","packageName":"@happyvertical/smrt-app-mcp","fields":{},"methods":{"append":{"name":"append","async":true,"parameters":[{"name":"record","type":"McpAuditRecord","optional":false}],"returnType":"Promise<McpCallAudit>","isStatic":false,"isPublic":true},"listAudits":{"name":"listAudits","async":true,"parameters":[{"name":"query","type":"any","optional":false,"typeUnresolved":true}],"returnType":"any","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"smrt_mcp_call_audits","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"McpCallAudit","exportName":"McpCallAuditCollection","collectionExportName":"McpCallAuditCollectionCollection","collectionOf":"@happyvertical/smrt-app-mcp:McpCallAudit","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"smrt_mcp_call_audits","ddl":"CREATE TABLE IF NOT EXISTS \\"smrt_mcp_call_audits\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID,\\n \\"principal_id\\" TEXT,\\n \\"principal_kind\\" TEXT,\\n \\"identity_issuer\\" TEXT,\\n \\"identity_subject\\" TEXT,\\n \\"identity_client_id\\" TEXT,\\n \\"tool\\" TEXT NOT NULL DEFAULT '',\\n \\"outcome\\" TEXT NOT NULL DEFAULT 'allowed',\\n \\"error_code\\" TEXT,\\n \\"argument_keys\\" JSON,\\n \\"occurred_at\\" TIMESTAMP NOT NULL\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":false,"unique":false},"principal_id":{"type":"TEXT","notNull":false,"unique":false},"principal_kind":{"type":"TEXT","notNull":false,"unique":false},"identity_issuer":{"type":"TEXT","notNull":false,"unique":false},"identity_subject":{"type":"TEXT","notNull":false,"unique":false},"identity_client_id":{"type":"TEXT","notNull":false,"unique":false},"tool":{"type":"TEXT","notNull":true,"unique":false,"default":""},"outcome":{"type":"TEXT","notNull":true,"unique":false,"default":"allowed"},"error_code":{"type":"TEXT","notNull":false,"unique":false},"argument_keys":{"type":"JSON","notNull":false,"unique":false},"occurred_at":{"type":"TIMESTAMP","notNull":true,"unique":false}},"indexes":[{"name":"smrt_mcp_call_audits_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true,"nullsNotDistinct":true},{"name":"smrt_mcp_call_audits_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"e0a722bb"},"importPath":"@happyvertical/smrt-app-mcp/audit-store"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-jobs","@happyvertical/smrt-tenancy"],"stampsConstructors":true}`));
5
5
  //#endregion
6
6
  //#region src/audit-store.ts
7
7
  var __defProp = Object.defineProperty;
@@ -1 +1 @@
1
- {"version":3,"file":"audit-store.js","names":[],"sources":["../src/__smrt-register__.ts","../src/audit-store.ts"],"sourcesContent":["// Generated by @happyvertical/smrt-core smrtPlugin at library build time.\n// The package manifest is inlined so self-registration cannot miss when a\n// downstream bundler relocates this module away from dist/manifest.json\n// (https://github.com/happyvertical/smrt/issues/1506,\n// https://github.com/happyvertical/smrt/issues/1507).\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\nObjectRegistry.registerPackageManifest(JSON.parse(\"{\\\"version\\\":\\\"1.0.0\\\",\\\"timestamp\\\":0,\\\"packageName\\\":\\\"@happyvertical/smrt-app-mcp\\\",\\\"packageVersion\\\":\\\"0.62.4\\\",\\\"objects\\\":{\\\"@happyvertical/smrt-app-mcp:McpCallAudit\\\":{\\\"name\\\":\\\"mcpcallaudit\\\",\\\"className\\\":\\\"McpCallAudit\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-app-mcp:McpCallAudit\\\",\\\"collection\\\":\\\"mcpcallaudits\\\",\\\"description\\\":\\\"One persisted MCP tool call. Stores identity, tool, tenant, outcome and argument KEY names only: never argument values or response bodies.\\\",\\\"filePath\\\":\\\"src/audit-store.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-app-mcp\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true,\\\"mode\\\":\\\"optional\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"principalId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"principalKind\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"identityIssuer\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"identitySubject\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"identityClientId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"tool\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\",\\\"default\\\"],\\\"required\\\":true,\\\"default\\\":\\\"\\\",\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true,\\\"default\\\":\\\"\\\"},\\\"outcome\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"default\\\",\\\"enum\\\"],\\\"required\\\":true,\\\"default\\\":\\\"allowed\\\"},\\\"required\\\":true,\\\"default\\\":\\\"allowed\\\",\\\"enum\\\":[\\\"allowed\\\",\\\"denied\\\",\\\"error\\\"]},\\\"errorCode\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"argumentKeys\\\":{\\\"type\\\":\\\"json\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"occurredAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\"],\\\"required\\\":true},\\\"required\\\":true}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"smrt_mcp_call_audits\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"tenantScoped\\\":{\\\"mode\\\":\\\"optional\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"McpCallAudit\\\",\\\"collectionExportName\\\":\\\"McpCallAuditCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"tool\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"outcome\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"occurredAt\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"datetime\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"smrt_mcp_call_audits\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"smrt_mcp_call_audits\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"principal_id\\\\\\\" TEXT,\\\\n \\\\\\\"principal_kind\\\\\\\" TEXT,\\\\n \\\\\\\"identity_issuer\\\\\\\" TEXT,\\\\n \\\\\\\"identity_subject\\\\\\\" TEXT,\\\\n \\\\\\\"identity_client_id\\\\\\\" TEXT,\\\\n \\\\\\\"tool\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"outcome\\\\\\\" TEXT NOT NULL DEFAULT 'allowed',\\\\n \\\\\\\"error_code\\\\\\\" TEXT,\\\\n \\\\\\\"argument_keys\\\\\\\" JSON,\\\\n \\\\\\\"occurred_at\\\\\\\" TIMESTAMP NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"principal_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"principal_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_issuer\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tool\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"outcome\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"allowed\\\"},\\\"error_code\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"argument_keys\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"occurred_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"smrt_mcp_call_audits_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"smrt_mcp_call_audits_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"e0a722bb\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-app-mcp/audit-store\\\"},\\\"@happyvertical/smrt-app-mcp:McpCallAuditCollection\\\":{\\\"name\\\":\\\"mcpcallauditcollection\\\",\\\"className\\\":\\\"McpCallAuditCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-app-mcp:McpCallAuditCollection\\\",\\\"collection\\\":\\\"mcpcallaudits\\\",\\\"description\\\":\\\"Tenant-aware persistence and queries for McpCallAudit.\\\",\\\"filePath\\\":\\\"src/audit-store.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-app-mcp\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"append\\\":{\\\"name\\\":\\\"append\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"record\\\",\\\"type\\\":\\\"McpAuditRecord\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<McpCallAudit>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"listAudits\\\":{\\\"name\\\":\\\"listAudits\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":false,\\\"typeUnresolved\\\":true}],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"smrt_mcp_call_audits\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"McpCallAudit\\\",\\\"exportName\\\":\\\"McpCallAuditCollection\\\",\\\"collectionExportName\\\":\\\"McpCallAuditCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-app-mcp:McpCallAudit\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"smrt_mcp_call_audits\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"smrt_mcp_call_audits\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"principal_id\\\\\\\" TEXT,\\\\n \\\\\\\"principal_kind\\\\\\\" TEXT,\\\\n \\\\\\\"identity_issuer\\\\\\\" TEXT,\\\\n \\\\\\\"identity_subject\\\\\\\" TEXT,\\\\n \\\\\\\"identity_client_id\\\\\\\" TEXT,\\\\n \\\\\\\"tool\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"outcome\\\\\\\" TEXT NOT NULL DEFAULT 'allowed',\\\\n \\\\\\\"error_code\\\\\\\" TEXT,\\\\n \\\\\\\"argument_keys\\\\\\\" JSON,\\\\n \\\\\\\"occurred_at\\\\\\\" TIMESTAMP NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"principal_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"principal_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_issuer\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tool\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"outcome\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"allowed\\\"},\\\"error_code\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"argument_keys\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"occurred_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"smrt_mcp_call_audits_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"smrt_mcp_call_audits_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"e0a722bb\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-app-mcp/audit-store\\\"}},\\\"moduleType\\\":\\\"smrt\\\",\\\"smrtDependencies\\\":[\\\"@happyvertical/smrt-core\\\",\\\"@happyvertical/smrt-jobs\\\",\\\"@happyvertical/smrt-tenancy\\\"],\\\"stampsConstructors\\\":true}\"));\n","// Self-register this package's manifest for consumers that import via this\n// subpath without the main entry (smrt#1132).\nimport './__smrt-register__.js';\n\nimport {\n field,\n SmrtCollection,\n SmrtObject,\n smrt,\n} from '@happyvertical/smrt-core';\nimport {\n TenantScoped,\n tenantId,\n withSystemContext,\n withTenant,\n} from '@happyvertical/smrt-tenancy';\nimport type {\n McpAuditOutcome,\n McpAuditQuery,\n McpAuditRecord,\n McpAuditSink,\n} from './audit.js';\n\n/**\n * One persisted MCP tool call. Stores identity, tool, tenant, outcome and\n * argument KEY names only: never argument values or response bodies.\n */\n@smrt({\n tableName: 'smrt_mcp_call_audits',\n // Audit rows are read through `McpCallAuditCollection.listAudits`, which\n // requires an explicit tenant; no generated read surface (fail closed).\n api: false,\n mcp: false,\n cli: false,\n})\n@TenantScoped({ mode: 'optional' })\nexport class McpCallAudit extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-app-mcp\";\n /** The tenant the call ran for; `null` for a global/anonymous call. */\n @tenantId({ nullable: true })\n tenantId: string | null | undefined = undefined;\n\n /** The principal id (credential id); `null` for an anonymous call. */\n @field({ type: 'text', nullable: true })\n principalId: string | null = null;\n\n /** The principal kind (agent, owner, user, ...); `null` when unknown. */\n @field({ type: 'text', nullable: true })\n principalKind: string | null = null;\n\n @field({ type: 'text', nullable: true })\n identityIssuer: string | null = null;\n\n @field({ type: 'text', nullable: true })\n identitySubject: string | null = null;\n\n @field({ type: 'text', nullable: true })\n identityClientId: string | null = null;\n\n /**\n * The tool the call named. Required for identity: the record exists to say\n * which tool ran, and `listAudits` looks rows up by it.\n */\n @field({ type: 'text', required: true, requiredFor: 'identity', default: '' })\n tool = '';\n\n @field({ type: 'text', required: true, default: 'allowed' })\n outcome: McpAuditOutcome = 'allowed';\n\n @field({ type: 'text', nullable: true })\n errorCode: string | null = null;\n\n @field({ type: 'json' })\n argumentKeys: string[] = [];\n\n @field({ type: 'datetime', required: true })\n occurredAt: Date = new Date();\n}\n\nconst DEFAULT_LIMIT = 100;\nconst MAX_LIMIT = 500;\n\n/** Tenant-aware persistence and queries for {@link McpCallAudit}. */\nexport class McpCallAuditCollection extends SmrtCollection<McpCallAudit> {\n static readonly _itemClass = McpCallAudit;\n\n /** Persist one record under its own tenant (or the global scope). */\n async append(record: McpAuditRecord): Promise<McpCallAudit> {\n const write = () =>\n this.create({\n tenantId: record.tenantId,\n principalId: record.principalId,\n principalKind: record.principalKind,\n identityIssuer: record.identityIssuer ?? null,\n identitySubject: record.identitySubject ?? null,\n identityClientId: record.identityClientId ?? null,\n tool: record.tool,\n outcome: record.outcome,\n errorCode: record.errorCode ?? null,\n argumentKeys: [...record.argumentKeys],\n occurredAt: record.occurredAt,\n });\n return record.tenantId\n ? withTenant({ tenantId: record.tenantId }, write)\n : withSystemContext(write);\n }\n\n /**\n * Newest-first records for one tenant, optionally narrowed by principal,\n * tool or outcome. `tenantId` is mandatory: `null` lists global rows.\n */\n async listAudits(query: McpAuditQuery & { tenantId: string | null }) {\n if (query.tenantId === undefined) {\n throw new TypeError('listAudits requires an explicit tenantId.');\n }\n const limit = Math.min(\n Math.max(Math.trunc(query.limit ?? DEFAULT_LIMIT), 1),\n MAX_LIMIT,\n );\n const where: Record<string, unknown> = { tenantId: query.tenantId };\n if (query.principalId !== undefined) where.principalId = query.principalId;\n if (query.tool !== undefined) where.tool = query.tool;\n if (query.outcome !== undefined) where.outcome = query.outcome;\n const read = () => this.list({ where, orderBy: 'occurred_at DESC', limit });\n const rows = query.tenantId\n ? await withTenant({ tenantId: query.tenantId }, read)\n : await withSystemContext(read);\n return rows.map((row): McpAuditRecord & { id: string } => ({\n id: String(row.id),\n principalId: row.principalId ?? null,\n principalKind: row.principalKind ?? null,\n tool: row.tool,\n tenantId: row.tenantId ?? null,\n outcome: row.outcome,\n ...(row.errorCode ? { errorCode: row.errorCode } : {}),\n ...(row.identityIssuer ? { identityIssuer: row.identityIssuer } : {}),\n ...(row.identitySubject ? { identitySubject: row.identitySubject } : {}),\n ...(row.identityClientId\n ? { identityClientId: row.identityClientId }\n : {}),\n argumentKeys: Array.isArray(row.argumentKeys) ? row.argumentKeys : [],\n occurredAt: new Date(row.occurredAt),\n }));\n }\n}\n\n/** Options for {@link createSmrtMcpAuditStore}. */\nexport interface SmrtMcpAuditStoreOptions {\n /** SMRT options bag (`{ db }`), the same one `smrtOptions` supplies. */\n smrtOptions: () => Record<string, unknown>;\n}\n\n/**\n * The default persistent audit sink: a SMRT-model-backed, tenant-aware store.\n * Pass it as `auditSink` and read it back with `list`.\n */\nexport function createSmrtMcpAuditStore(\n options: SmrtMcpAuditStoreOptions,\n): McpAuditSink & {\n list(\n query: McpAuditQuery & { tenantId: string | null },\n ): ReturnType<McpCallAuditCollection['listAudits']>;\n} {\n // Resolved per operation: `smrtOptions()` may return request-scoped state\n // (e.g. a transaction-bound db under RLS) that must not outlive its request.\n const get = () =>\n McpCallAuditCollection.create(\n options.smrtOptions() as never,\n ) as Promise<McpCallAuditCollection>;\n return {\n async record(record) {\n await (await get()).append(record);\n },\n async list(query) {\n return (await get()).listAudits(query);\n },\n };\n}\n"],"mappings":";;;AAOA,eAAe,wBAAwB,KAAK,MAAM,g1QAAs5S,CAAC;;;;;;;;;;;;;;;;;;AC6Bl8S,IAAM,eAAN,cAA2B,WAAW;CAG3C,WAAsC,KAAA;CAItC,cAA6B;CAI7B,gBAA+B;CAG/B,iBAAgC;CAGhC,kBAAiC;CAGjC,mBAAkC;CAOlC,OAAO;CAGP,UAA2B;CAG3B,YAA2B;CAG3B,eAAyB,CAAC;CAG1B,6BAAmB,IAAI,KAAK;AAC9B;AAxC+C,cAAlC,cAAyC,mBAAkB,6BAAA;AAGtE,gBAAA,CADC,SAAS,EAAE,UAAU,KAAK,CAAC,CAAA,GAFjB,aAGX,WAAA,YAAA,CAAA;AAIA,gBAAA,CADC,MAAM;CAAE,MAAM;CAAQ,UAAU;AAAK,CAAC,CAAA,GAN5B,aAOX,WAAA,eAAA,CAAA;A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,EAAE,iBAAiB,IAAI,gBAAgB,IAAI,CAAC;GACtE,GAAI,IAAI,mBACJ,EAAE,kBAAkB,IAAI,iBAAiB,IACzC,CAAC;GACL,cAAc,MAAM,QAAQ,IAAI,YAAY,IAAI,IAAI,eAAe,CAAC;GACpE,YAAY,IAAI,KAAK,IAAI,UAAU;EACrC,EAAE;CACJ;AACF;AAYO,SAAS,wBACd,SAKA;CAGA,MAAM,YACJ,uBAAuB,OACrB,QAAQ,YAAY,CACtB;CACF,OAAO;EACL,MAAM,OAAO,QAAQ;GACnB,OAAO,MAAM,IAAI,EAAA,CAAG,OAAO,MAAM;EACnC;EACA,MAAM,KAAK,OAAO;GAChB,QAAQ,MAAM,IAAI,EAAA,CAAG,WAAW,KAAK;EACvC;CACF;AACF"}
1
+ {"version":3,"file":"audit-store.js","names":[],"sources":["../src/__smrt-register__.ts","../src/audit-store.ts"],"sourcesContent":["// Generated by @happyvertical/smrt-core smrtPlugin at library build time.\n// The package manifest is inlined so self-registration cannot miss when a\n// downstream bundler relocates this module away from dist/manifest.json\n// (https://github.com/happyvertical/smrt/issues/1506,\n// https://github.com/happyvertical/smrt/issues/1507).\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\nObjectRegistry.registerPackageManifest(JSON.parse(\"{\\\"version\\\":\\\"1.0.0\\\",\\\"timestamp\\\":0,\\\"packageName\\\":\\\"@happyvertical/smrt-app-mcp\\\",\\\"packageVersion\\\":\\\"0.62.5\\\",\\\"objects\\\":{\\\"@happyvertical/smrt-app-mcp:McpCallAudit\\\":{\\\"name\\\":\\\"mcpcallaudit\\\",\\\"className\\\":\\\"McpCallAudit\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-app-mcp:McpCallAudit\\\",\\\"collection\\\":\\\"mcpcallaudits\\\",\\\"description\\\":\\\"One persisted MCP tool call. Stores identity, tool, tenant, outcome and argument KEY names only: never argument values or response bodies.\\\",\\\"filePath\\\":\\\"src/audit-store.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-app-mcp\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":false,\\\"autoPopulate\\\":true,\\\"nullable\\\":true,\\\"mode\\\":\\\"optional\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"nullable\\\",\\\"__tenancy\\\",\\\"required\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"principalId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"principalKind\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"identityIssuer\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"identitySubject\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"identityClientId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"tool\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\",\\\"default\\\"],\\\"required\\\":true,\\\"default\\\":\\\"\\\",\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true,\\\"default\\\":\\\"\\\"},\\\"outcome\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"default\\\",\\\"enum\\\"],\\\"required\\\":true,\\\"default\\\":\\\"allowed\\\"},\\\"required\\\":true,\\\"default\\\":\\\"allowed\\\",\\\"enum\\\":[\\\"allowed\\\",\\\"denied\\\",\\\"error\\\"]},\\\"errorCode\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"argumentKeys\\\":{\\\"type\\\":\\\"json\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"occurredAt\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\"],\\\"required\\\":true},\\\"required\\\":true}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"smrt_mcp_call_audits\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false,\\\"tenantScoped\\\":{\\\"mode\\\":\\\"optional\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"McpCallAudit\\\",\\\"collectionExportName\\\":\\\"McpCallAuditCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"tool\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"outcome\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"occurredAt\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"datetime\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"smrt_mcp_call_audits\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"smrt_mcp_call_audits\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"principal_id\\\\\\\" TEXT,\\\\n \\\\\\\"principal_kind\\\\\\\" TEXT,\\\\n \\\\\\\"identity_issuer\\\\\\\" TEXT,\\\\n \\\\\\\"identity_subject\\\\\\\" TEXT,\\\\n \\\\\\\"identity_client_id\\\\\\\" TEXT,\\\\n \\\\\\\"tool\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"outcome\\\\\\\" TEXT NOT NULL DEFAULT 'allowed',\\\\n \\\\\\\"error_code\\\\\\\" TEXT,\\\\n \\\\\\\"argument_keys\\\\\\\" JSON,\\\\n \\\\\\\"occurred_at\\\\\\\" TIMESTAMP NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"principal_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"principal_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_issuer\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tool\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"outcome\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"allowed\\\"},\\\"error_code\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"argument_keys\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"occurred_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"smrt_mcp_call_audits_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"smrt_mcp_call_audits_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"e0a722bb\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-app-mcp/audit-store\\\"},\\\"@happyvertical/smrt-app-mcp:McpCallAuditCollection\\\":{\\\"name\\\":\\\"mcpcallauditcollection\\\",\\\"className\\\":\\\"McpCallAuditCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-app-mcp:McpCallAuditCollection\\\",\\\"collection\\\":\\\"mcpcallaudits\\\",\\\"description\\\":\\\"Tenant-aware persistence and queries for McpCallAudit.\\\",\\\"filePath\\\":\\\"src/audit-store.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-app-mcp\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"append\\\":{\\\"name\\\":\\\"append\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"record\\\",\\\"type\\\":\\\"McpAuditRecord\\\",\\\"optional\\\":false}],\\\"returnType\\\":\\\"Promise<McpCallAudit>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true},\\\"listAudits\\\":{\\\"name\\\":\\\"listAudits\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"query\\\",\\\"type\\\":\\\"any\\\",\\\"optional\\\":false,\\\"typeUnresolved\\\":true}],\\\"returnType\\\":\\\"any\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"smrt_mcp_call_audits\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"McpCallAudit\\\",\\\"exportName\\\":\\\"McpCallAuditCollection\\\",\\\"collectionExportName\\\":\\\"McpCallAuditCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-app-mcp:McpCallAudit\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"smrt_mcp_call_audits\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"smrt_mcp_call_audits\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID,\\\\n \\\\\\\"principal_id\\\\\\\" TEXT,\\\\n \\\\\\\"principal_kind\\\\\\\" TEXT,\\\\n \\\\\\\"identity_issuer\\\\\\\" TEXT,\\\\n \\\\\\\"identity_subject\\\\\\\" TEXT,\\\\n \\\\\\\"identity_client_id\\\\\\\" TEXT,\\\\n \\\\\\\"tool\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"outcome\\\\\\\" TEXT NOT NULL DEFAULT 'allowed',\\\\n \\\\\\\"error_code\\\\\\\" TEXT,\\\\n \\\\\\\"argument_keys\\\\\\\" JSON,\\\\n \\\\\\\"occurred_at\\\\\\\" TIMESTAMP NOT NULL\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"principal_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"principal_kind\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_issuer\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_subject\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"identity_client_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"tool\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"\\\"},\\\"outcome\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false,\\\"default\\\":\\\"allowed\\\"},\\\"error_code\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"argument_keys\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"occurred_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"smrt_mcp_call_audits_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true,\\\"nullsNotDistinct\\\":true},{\\\"name\\\":\\\"smrt_mcp_call_audits_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"e0a722bb\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-app-mcp/audit-store\\\"}},\\\"moduleType\\\":\\\"smrt\\\",\\\"smrtDependencies\\\":[\\\"@happyvertical/smrt-core\\\",\\\"@happyvertical/smrt-jobs\\\",\\\"@happyvertical/smrt-tenancy\\\"],\\\"stampsConstructors\\\":true}\"));\n","// Self-register this package's manifest for consumers that import via this\n// subpath without the main entry (smrt#1132).\nimport './__smrt-register__.js';\n\nimport {\n field,\n SmrtCollection,\n SmrtObject,\n smrt,\n} from '@happyvertical/smrt-core';\nimport {\n TenantScoped,\n tenantId,\n withSystemContext,\n withTenant,\n} from '@happyvertical/smrt-tenancy';\nimport type {\n McpAuditOutcome,\n McpAuditQuery,\n McpAuditRecord,\n McpAuditSink,\n} from './audit.js';\n\n/**\n * One persisted MCP tool call. Stores identity, tool, tenant, outcome and\n * argument KEY names only: never argument values or response bodies.\n */\n@smrt({\n tableName: 'smrt_mcp_call_audits',\n // Audit rows are read through `McpCallAuditCollection.listAudits`, which\n // requires an explicit tenant; no generated read surface (fail closed).\n api: false,\n mcp: false,\n cli: false,\n})\n@TenantScoped({ mode: 'optional' })\nexport class McpCallAudit extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-app-mcp\";\n /** The tenant the call ran for; `null` for a global/anonymous call. */\n @tenantId({ nullable: true })\n tenantId: string | null | undefined = undefined;\n\n /** The principal id (credential id); `null` for an anonymous call. */\n @field({ type: 'text', nullable: true })\n principalId: string | null = null;\n\n /** The principal kind (agent, owner, user, ...); `null` when unknown. */\n @field({ type: 'text', nullable: true })\n principalKind: string | null = null;\n\n @field({ type: 'text', nullable: true })\n identityIssuer: string | null = null;\n\n @field({ type: 'text', nullable: true })\n identitySubject: string | null = null;\n\n @field({ type: 'text', nullable: true })\n identityClientId: string | null = null;\n\n /**\n * The tool the call named. Required for identity: the record exists to say\n * which tool ran, and `listAudits` looks rows up by it.\n */\n @field({ type: 'text', required: true, requiredFor: 'identity', default: '' })\n tool = '';\n\n @field({ type: 'text', required: true, default: 'allowed' })\n outcome: McpAuditOutcome = 'allowed';\n\n @field({ type: 'text', nullable: true })\n errorCode: string | null = null;\n\n @field({ type: 'json' })\n argumentKeys: string[] = [];\n\n @field({ type: 'datetime', required: true })\n occurredAt: Date = new Date();\n}\n\nconst DEFAULT_LIMIT = 100;\nconst MAX_LIMIT = 500;\n\n/** Tenant-aware persistence and queries for {@link McpCallAudit}. */\nexport class McpCallAuditCollection extends SmrtCollection<McpCallAudit> {\n static readonly _itemClass = McpCallAudit;\n\n /** Persist one record under its own tenant (or the global scope). */\n async append(record: McpAuditRecord): Promise<McpCallAudit> {\n const write = () =>\n this.create({\n tenantId: record.tenantId,\n principalId: record.principalId,\n principalKind: record.principalKind,\n identityIssuer: record.identityIssuer ?? null,\n identitySubject: record.identitySubject ?? null,\n identityClientId: record.identityClientId ?? null,\n tool: record.tool,\n outcome: record.outcome,\n errorCode: record.errorCode ?? null,\n argumentKeys: [...record.argumentKeys],\n occurredAt: record.occurredAt,\n });\n return record.tenantId\n ? withTenant({ tenantId: record.tenantId }, write)\n : withSystemContext(write);\n }\n\n /**\n * Newest-first records for one tenant, optionally narrowed by principal,\n * tool or outcome. `tenantId` is mandatory: `null` lists global rows.\n */\n async listAudits(query: McpAuditQuery & { tenantId: string | null }) {\n if (query.tenantId === undefined) {\n throw new TypeError('listAudits requires an explicit tenantId.');\n }\n const limit = Math.min(\n Math.max(Math.trunc(query.limit ?? DEFAULT_LIMIT), 1),\n MAX_LIMIT,\n );\n const where: Record<string, unknown> = { tenantId: query.tenantId };\n if (query.principalId !== undefined) where.principalId = query.principalId;\n if (query.tool !== undefined) where.tool = query.tool;\n if (query.outcome !== undefined) where.outcome = query.outcome;\n const read = () => this.list({ where, orderBy: 'occurred_at DESC', limit });\n const rows = query.tenantId\n ? await withTenant({ tenantId: query.tenantId }, read)\n : await withSystemContext(read);\n return rows.map((row): McpAuditRecord & { id: string } => ({\n id: String(row.id),\n principalId: row.principalId ?? null,\n principalKind: row.principalKind ?? null,\n tool: row.tool,\n tenantId: row.tenantId ?? null,\n outcome: row.outcome,\n ...(row.errorCode ? { errorCode: row.errorCode } : {}),\n ...(row.identityIssuer ? { identityIssuer: row.identityIssuer } : {}),\n ...(row.identitySubject ? { identitySubject: row.identitySubject } : {}),\n ...(row.identityClientId\n ? { identityClientId: row.identityClientId }\n : {}),\n argumentKeys: Array.isArray(row.argumentKeys) ? row.argumentKeys : [],\n occurredAt: new Date(row.occurredAt),\n }));\n }\n}\n\n/** Options for {@link createSmrtMcpAuditStore}. */\nexport interface SmrtMcpAuditStoreOptions {\n /** SMRT options bag (`{ db }`), the same one `smrtOptions` supplies. */\n smrtOptions: () => Record<string, unknown>;\n}\n\n/**\n * The default persistent audit sink: a SMRT-model-backed, tenant-aware store.\n * Pass it as `auditSink` and read it back with `list`.\n */\nexport function createSmrtMcpAuditStore(\n options: SmrtMcpAuditStoreOptions,\n): McpAuditSink & {\n list(\n query: McpAuditQuery & { tenantId: string | null },\n ): ReturnType<McpCallAuditCollection['listAudits']>;\n} {\n // Resolved per operation: `smrtOptions()` may return request-scoped state\n // (e.g. a transaction-bound db under RLS) that must not outlive its request.\n const get = () =>\n McpCallAuditCollection.create(\n options.smrtOptions() as never,\n ) as Promise<McpCallAuditCollection>;\n return {\n async record(record) {\n await (await get()).append(record);\n },\n async list(query) {\n return (await get()).listAudits(query);\n },\n };\n}\n"],"mappings":";;;AAOA,eAAe,wBAAwB,KAAK,MAAM,g1QAAs5S,CAAC;;;;;;;;;;;;;;;;;;AC6Bl8S,IAAM,eAAN,cAA2B,WAAW;CAG3C,WAAsC,KAAA;CAItC,cAA6B;CAI7B,gBAA+B;CAG/B,iBAAgC;CAGhC,kBAAiC;CAGjC,mBAAkC;CAOlC,OAAO;CAGP,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AAK,SAA0C;GACzD,IAAI,OAAO,IAAI,EAAE;GACjB,aAAa,IAAI,eAAe;GAChC,eAAe,IAAI,iBAAiB;GACpC,MAAM,IAAI;GACV,UAAU,IAAI,YAAY;GAC1B,SAAS,IAAI;GACb,GAAI,IAAI,YAAY,EAAE,WAAW,IAAI,UAAU,IAAI,CAAC;GACpD,GAAI,IAAI,iBAAiB,EAAE,gBAAgB,IAAI,eAAe,IAAI,CAAC;GACnE,GAAI,IAAI,kBAAkB,EAAE,iBAAiB,IAAI,gBAAgB,IAAI,CAAC;GACtE,GAAI,IAAI,mBACJ,EAAE,kBAAkB,IAAI,iBAAiB,IACzC,CAAC;GACL,cAAc,MAAM,QAAQ,IAAI,YAAY,IAAI,IAAI,eAAe,CAAC;GACpE,YAAY,IAAI,KAAK,IAAI,UAAU;EACrC,EAAE;CACJ;AACF;AAYO,SAAS,wBACd,SAKA;CAGA,MAAM,YACJ,uBAAuB,OACrB,QAAQ,YAAY,CACtB;CACF,OAAO;EACL,MAAM,OAAO,QAAQ;GACnB,OAAO,MAAM,IAAI,EAAA,CAAG,OAAO,MAAM;EACnC;EACA,MAAM,KAAK,OAAO;GAChB,QAAQ,MAAM,IAAI,EAAA,CAAG,WAAW,KAAK;EACvC;CACF;AACF"}
package/dist/auth.d.ts CHANGED
@@ -20,14 +20,41 @@ export interface McpPrincipalMapping {
20
20
  */
21
21
  tenantBinding?: McpTenantBinding;
22
22
  }
23
+ /**
24
+ * The application's own in-process OAuth issuer (smrt#5080). Verification
25
+ * never touches the network: the issuer's own key checks the token.
26
+ */
27
+ export interface McpSelfIssuer {
28
+ /** Exact issuer identifier tokens carry and metadata advertises. */
29
+ readonly issuer: string;
30
+ /**
31
+ * Verify signature, issuer, expiry, the audience and server-side access
32
+ * token revocation, and return the payload; reject otherwise.
33
+ */
34
+ verifyAccessToken(token: string, audience: string): Promise<Readonly<JWTPayload>>;
35
+ /**
36
+ * Per-call grant liveness (`smrt_grant_id` not revoked, user and tenant
37
+ * still active). Fail closed: anything but `true` denies.
38
+ */
39
+ validateGrant(claims: Readonly<JWTPayload>): Promise<boolean>;
40
+ }
23
41
  export interface McpResourceAuthOptions {
24
42
  profile: McpDeploymentProfile;
25
43
  /** Exact public resource identifier; also the required token audience. */
26
44
  resource: string;
27
45
  /** Exact issuer identifier, including any trailing slash. */
28
46
  issuer: string;
29
- /** Operator-configured signing keys. Never derived from an untrusted token. */
30
- jwksUri: string;
47
+ /**
48
+ * Operator-configured signing keys. Never derived from an untrusted token.
49
+ * Ignored (and not required) with {@link McpResourceAuthOptions.selfIssuer}.
50
+ */
51
+ jwksUri?: string;
52
+ /**
53
+ * The app is its own issuer: tokens are verified in process by this issuer
54
+ * (no JWKS fetch) and every call re-checks grant liveness. `issuer` must
55
+ * equal `selfIssuer.issuer`.
56
+ */
57
+ selfIssuer?: McpSelfIssuer;
31
58
  scopes: readonly string[];
32
59
  algorithms: readonly ('RS256' | 'ES256')[];
33
60
  /** Default at+jwt. Select JWT only for a provider that uses it for access tokens. */
@@ -93,6 +120,18 @@ export interface McpAuthRuntime {
93
120
  * resolver).
94
121
  */
95
122
  resolveMcpPrincipal?(identity: McpVerifiedIdentity): Promise<McpPrincipalMapping | null>;
123
+ /**
124
+ * Set when the application is its own MCP issuer (the runtime's
125
+ * `mcp.authorizationServer` option). Hosted resource auth then verifies
126
+ * in process and checks grant liveness on every call instead of reading
127
+ * `SMRT_MCP_ISSUER` / `SMRT_MCP_JWKS_URI`.
128
+ */
129
+ readonly mcpSelfIssuer?: McpSelfIssuer & {
130
+ /** Resource identifier; falls back to `SMRT_MCP_RESOURCE`. */
131
+ readonly resource?: string;
132
+ /** Required scopes; falls back to `SMRT_MCP_SCOPES`. */
133
+ readonly scopes?: readonly string[];
134
+ };
96
135
  }
97
136
  /** Options for {@link createLocalMcpTokenAuth}. */
98
137
  export interface LocalMcpTokenAuthOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"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