@zuplo/runtime 6.74.6 → 6.74.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{b as l}from"../chunk-5BL2UFIS.js";import{_ as n}from"../chunk-N22BFR2U.js";import{a as o}from"../chunk-TYV53J3B.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function t(r){e.push(Promise.resolve(r))}return o(t,"waitUntil"),{context:new s({event:{waitUntil:t},route:u.route}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(g,"createMockContext");var a={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},s=class extends EventTarget{static{o(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=a,parentContext:i}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:n.console.info,log:n.console.log,debug:n.console.debug,warn:n.console.warn,error:n.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=i,this.#e=e,this.analyticsContext=new l(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,i){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")}addEventListener(e,t,i){let d=o(r=>{try{typeof t=="function"?t(r):t.handleEvent(r)}catch(p){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),p}},"wrapped");super.addEventListener(e,d,i)}};export{s as MockZuploContext,g as createMockContext};
25
+ import{b as l}from"../chunk-2UG5Z76T.js";import{_ as n}from"../chunk-7AMMYBFQ.js";import{a as o}from"../chunk-TYV53J3B.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function t(r){e.push(Promise.resolve(r))}return o(t,"waitUntil"),{context:new s({event:{waitUntil:t},route:u.route}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(g,"createMockContext");var a={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},s=class extends EventTarget{static{o(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=a,parentContext:i}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:n.console.info,log:n.console.log,debug:n.console.debug,warn:n.console.warn,error:n.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=i,this.#e=e,this.analyticsContext=new l(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,i){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")}addEventListener(e,t,i){let d=o(r=>{try{typeof t=="function"?t(r):t.handleEvent(r)}catch(p){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),p}},"wrapped");super.addEventListener(e,d,i)}};export{s as MockZuploContext,g as createMockContext};
26
26
  //# sourceMappingURL=index.js.map
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{I as a,J as l,K as c,L as o,O as p,P as y,Q as m}from"../../chunk-SH5GYJN3.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-N22BFR2U.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-SMQPMERU.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-7AMMYBFQ.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
@@ -145,10 +145,12 @@ export declare interface AIGatewayAuthInboundPolicyOptions {
145
145
  * Authenticates requests to an AI Gateway v2 endpoint with application API
146
146
  * keys.
147
147
  *
148
- * Place this policy first in the inbound chain. The policies that follow can
149
- * read the authenticated application from `request.user` (`sub` is the
150
- * application name, `data` its metadata), and the application's AI Gateway
151
- * configuration takes effect for the request. Use `authHeader` and
148
+ * Add this policy to an application's `inboundPolicyChain` to require a key
149
+ * for that app only, or place it on the route before the configuration
150
+ * executor to require a key for every application on the route. The policies
151
+ * that follow can read the authenticated application from `request.user`
152
+ * (`sub` is the application name, `data` its metadata), and the application's
153
+ * AI Gateway configuration takes effect for the request. Use `authHeader` and
152
154
  * `authScheme` when clients send their app key somewhere other than the
153
155
  * default `Authorization: Bearer` header.
154
156
  *
@@ -245,14 +247,15 @@ export declare type AIGatewayCapability =
245
247
  | "audio_transcriptions";
246
248
 
247
249
  /**
248
- * Runs the inbound policy chain from the app configuration provided by
249
- * `ai-gateway-auth-v2-inbound`.
250
+ * Loads the app configuration for the request (when auth has not already) and
251
+ * runs the inbound policy chain from that configuration.
250
252
  *
251
- * Use this policy after AI Gateway Authentication (v2) when apps need
252
- * different combinations or ordering of AI Gateway policies. Applications
253
- * select from policies pre-declared by the gateway. Applications without a
254
- * `inboundPolicyChain`, or with an empty chain, run no application-selected
255
- * policies.
253
+ * Place this policy on AI Gateway v2 routes after optional authentication.
254
+ * When `ai-gateway-auth-v2-inbound` already populated the app-configuration
255
+ * channel, this policy reuses it. Otherwise it loads the configuration with
256
+ * the route's `app_id` path parameter. Applications select from policies
257
+ * pre-declared by the gateway. Applications without a `inboundPolicyChain`,
258
+ * or with an empty chain, run no application-selected policies.
256
259
  * Entry options replace the declaration's options as a complete object; omit
257
260
  * them to inherit the declaration, including environment-backed credentials.
258
261
  * Each occurrence receives a private deep copy of its entry options, so a
@@ -277,10 +280,15 @@ export declare class AIGatewayConfigurationExecutorV2InboundPolicy extends Inbou
277
280
  }
278
281
 
279
282
  /**
280
- * This policy has no options. Each application's policy chain comes from its AI Gateway configuration.
283
+ * Options for loading each application's AI Gateway configuration and running its inbound policy chain.
281
284
  * @public
282
285
  */
283
- export declare interface AIGatewayConfigurationExecutorV2InboundPolicyOptions {}
286
+ export declare interface AIGatewayConfigurationExecutorV2InboundPolicyOptions {
287
+ /**
288
+ * The time to cache app configurations loaded by app_id. Higher values decrease latency. Cached results remain valid until the cache expires even if the configuration changes in the portal. When ai-gateway-auth-v2-inbound already loaded the configuration for the request, this cache is not used.
289
+ */
290
+ cacheTtlSeconds?: number;
291
+ }
284
292
 
285
293
  /**
286
294
  * Adds failure and quota fallbacks to an existing AI Gateway model selection.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "6.74.6",
4
+ "version": "6.74.8",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -45,6 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@cfworker/json-schema": "4.1.1",
48
+ "@modelcontextprotocol/client": "^2.0.0",
48
49
  "@modelcontextprotocol/core": "^2.0.0",
49
50
  "@modelcontextprotocol/sdk": "^1.30.0",
50
51
  "@modelcontextprotocol/server": "^2.0.0",