@zuplo/runtime 7.14.6 → 7.14.8

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.
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{G as p,M as c,Q as u}from"../chunk-JORDKCQ5.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-AEVCZW3D.js";import"../chunk-A3QGJZO7.js";import"../chunk-G2O2ZIL3.js";import"../chunk-UKQQD2JN.js";import{aa as i}from"../chunk-VIH2ISEH.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
25
+ import{G as p,M as c,Q as u}from"../chunk-DB6LKZ36.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-PY52EHDX.js";import"../chunk-A3QGJZO7.js";import"../chunk-6R2COTV6.js";import"../chunk-UKQQD2JN.js";import{aa as i}from"../chunk-2HVCLUM4.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
26
26
  //# sourceMappingURL=index.js.map
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-G2O2ZIL3.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-VIH2ISEH.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
25
+ import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-6R2COTV6.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-2HVCLUM4.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
26
26
  //# sourceMappingURL=index.js.map
@@ -4352,9 +4352,11 @@ declare interface CompatibilityFlags {
4352
4352
  * precompiled Ajv validators from the OpenAPI document, validated per the
4353
4353
  * dialect and OpenAPI version they declare (specs/mcp-tool-schemas.md), and
4354
4354
  * `prompts/list` also lists the arguments behind a prompt schema's `$ref`
4355
- * and `allOf`. `request-validation-inbound` validates with the same dialect,
4356
- * `format` and pattern rules, and keeps its parameter type coercion
4357
- * (specs/compat-improved-schema-validation.md).
4355
+ * and `allOf`. A tool set to `toolInputStyle: "flat"` whose input can't be
4356
+ * fully flattened fails the build instead of staying nested
4357
+ * (specs/mcp-flat-input.md FLAT-18). `request-validation-inbound` validates
4358
+ * with the same dialect, `format` and pattern rules, and keeps its parameter
4359
+ * type coercion (specs/compat-improved-schema-validation.md).
4358
4360
  *
4359
4361
  * @compatibilityDate 2026-11-06
4360
4362
  */
@@ -4433,10 +4435,11 @@ declare interface CompatibilityFlags {
4433
4435
  omitMcpFieldsNewerThanNegotiatedVersion: boolean;
4434
4436
  /**
4435
4437
  * Whether built-in policies treat an empty or whitespace-only value for an
4436
- * optional string option as if the option were left out.
4438
+ * optional string option as if the option were left out, and reject one for
4439
+ * a required string option.
4437
4440
  *
4438
4441
  * `$env(VAR)` with `VAR` defined but empty reaches a policy as `""`, so this
4439
- * decides what an empty environment variable does to an optional option.
4442
+ * decides what an empty environment variable does to a policy option.
4440
4443
  *
4441
4444
  * Before this flag: Many policies reject `""`. Some fail every request with
4442
4445
  * a `ConfigurationError` (for example `http-deprecation-outbound` `link`,
@@ -4451,6 +4454,12 @@ declare interface CompatibilityFlags {
4451
4454
  * current behavior. `BLANK_IS_NOT_UNSET` in
4452
4455
  * `policies/optional-string-options.spec.ts` lists them with the reason.
4453
4456
  *
4457
+ * A required string option that is empty or whitespace-only fails with a
4458
+ * `ConfigurationError` naming the option when the policy is created, instead
4459
+ * of being sent as a blank credential, host or header. Required options
4460
+ * where an empty value means something (`replace-string-outbound`
4461
+ * `replaceWith`, `set-body-inbound` `body`) are used as given.
4462
+ *
4454
4463
  * @compatibilityDate 2026-11-06
4455
4464
  */
4456
4465
  treatBlankOptionalStringOptionsAsUnset: boolean;
@@ -223,9 +223,11 @@ declare interface CompatibilityFlags {
223
223
  * precompiled Ajv validators from the OpenAPI document, validated per the
224
224
  * dialect and OpenAPI version they declare (specs/mcp-tool-schemas.md), and
225
225
  * `prompts/list` also lists the arguments behind a prompt schema's `$ref`
226
- * and `allOf`. `request-validation-inbound` validates with the same dialect,
227
- * `format` and pattern rules, and keeps its parameter type coercion
228
- * (specs/compat-improved-schema-validation.md).
226
+ * and `allOf`. A tool set to `toolInputStyle: "flat"` whose input can't be
227
+ * fully flattened fails the build instead of staying nested
228
+ * (specs/mcp-flat-input.md FLAT-18). `request-validation-inbound` validates
229
+ * with the same dialect, `format` and pattern rules, and keeps its parameter
230
+ * type coercion (specs/compat-improved-schema-validation.md).
229
231
  *
230
232
  * @compatibilityDate 2026-11-06
231
233
  */
@@ -304,10 +306,11 @@ declare interface CompatibilityFlags {
304
306
  omitMcpFieldsNewerThanNegotiatedVersion: boolean;
305
307
  /**
306
308
  * Whether built-in policies treat an empty or whitespace-only value for an
307
- * optional string option as if the option were left out.
309
+ * optional string option as if the option were left out, and reject one for
310
+ * a required string option.
308
311
  *
309
312
  * `$env(VAR)` with `VAR` defined but empty reaches a policy as `""`, so this
310
- * decides what an empty environment variable does to an optional option.
313
+ * decides what an empty environment variable does to a policy option.
311
314
  *
312
315
  * Before this flag: Many policies reject `""`. Some fail every request with
313
316
  * a `ConfigurationError` (for example `http-deprecation-outbound` `link`,
@@ -322,6 +325,12 @@ declare interface CompatibilityFlags {
322
325
  * current behavior. `BLANK_IS_NOT_UNSET` in
323
326
  * `policies/optional-string-options.spec.ts` lists them with the reason.
324
327
  *
328
+ * A required string option that is empty or whitespace-only fails with a
329
+ * `ConfigurationError` naming the option when the policy is created, instead
330
+ * of being sent as a blank credential, host or header. Required options
331
+ * where an empty value means something (`replace-string-outbound`
332
+ * `replaceWith`, `set-body-inbound` `body`) are used as given.
333
+ *
325
334
  * @compatibilityDate 2026-11-06
326
335
  */
327
336
  treatBlankOptionalStringOptionsAsUnset: boolean;
@@ -2925,6 +2925,46 @@ export declare function McpProxyHandler(
2925
2925
  context: ZuploContext
2926
2926
  ): Promise<Response>;
2927
2927
 
2928
+ /**
2929
+ * OpenTelemetry options for the MCP Gateway's `McpProxyHandler`, set under
2930
+ * `telemetry` in the route's handler options. The same options as the MCP
2931
+ * Server handler's `telemetry`.
2932
+ */
2933
+ export declare interface McpProxyHandlerTelemetryOptions {
2934
+ /**
2935
+ * Record tool call content on the MCP SERVER and CLIENT spans of a
2936
+ * forwarded `tools/call`: the arguments the client sent as
2937
+ * `gen_ai.tool.call.arguments` and, when the upstream returns a result
2938
+ * without `isError: true`, that result as `gen_ai.tool.call.result`. Both
2939
+ * are JSON strings capped at 8192 UTF-16 code units.
2940
+ *
2941
+ * Off by default. Tool arguments and results often contain personal or
2942
+ * otherwise sensitive data, and enabling this sends them to your telemetry
2943
+ * backend.
2944
+ *
2945
+ * The gateway records content only for a `tools/call` it forwards upstream.
2946
+ * A call a gateway policy answers itself (for example, by asking the client
2947
+ * to connect the upstream) records neither attribute. A result is recorded
2948
+ * when the JSON response, or the SSE event that carries it, is 1 MiB or
2949
+ * less; a larger result is forwarded to the client but not recorded.
2950
+ *
2951
+ * @example
2952
+ * ```json
2953
+ * {
2954
+ * "handler": {
2955
+ * "export": "McpProxyHandler",
2956
+ * "module": "$import(@zuplo/runtime/mcp-gateway)",
2957
+ * "options": {
2958
+ * "rewritePattern": "https://mcp.example.com/mcp",
2959
+ * "telemetry": { "captureToolCallContent": true }
2960
+ * }
2961
+ * }
2962
+ * }
2963
+ * ```
2964
+ */
2965
+ captureToolCallContent?: boolean;
2966
+ }
2967
+
2928
2968
  /**
2929
2969
  * Resolve a gateway-managed upstream MCP credential and apply it to the
2930
2970
  * request before the normal Zuplo route handler forwards the request.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.14.6",
4
+ "version": "7.14.8",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {