@zuplo/runtime 6.74.2 → 6.74.7

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
@@ -245,14 +245,15 @@ export declare type AIGatewayCapability =
245
245
  | "audio_transcriptions";
246
246
 
247
247
  /**
248
- * Runs the inbound policy chain from the app configuration provided by
249
- * `ai-gateway-auth-v2-inbound`.
250
- *
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.
248
+ * Loads the app configuration for the request (when auth has not already) and
249
+ * runs the inbound policy chain from that configuration.
250
+ *
251
+ * Place this policy on AI Gateway v2 routes after optional authentication.
252
+ * When `ai-gateway-auth-v2-inbound` already populated the app-configuration
253
+ * channel, this policy reuses it. Otherwise it loads the configuration with
254
+ * the route's `app_id` path parameter. Applications select from policies
255
+ * pre-declared by the gateway. Applications without a `inboundPolicyChain`,
256
+ * or with an empty chain, run no application-selected policies.
256
257
  * Entry options replace the declaration's options as a complete object; omit
257
258
  * them to inherit the declaration, including environment-backed credentials.
258
259
  * Each occurrence receives a private deep copy of its entry options, so a
@@ -277,10 +278,15 @@ export declare class AIGatewayConfigurationExecutorV2InboundPolicy extends Inbou
277
278
  }
278
279
 
279
280
  /**
280
- * This policy has no options. Each application's policy chain comes from its AI Gateway configuration.
281
+ * Options for loading each application's AI Gateway configuration and running its inbound policy chain.
281
282
  * @public
282
283
  */
283
- export declare interface AIGatewayConfigurationExecutorV2InboundPolicyOptions {}
284
+ export declare interface AIGatewayConfigurationExecutorV2InboundPolicyOptions {
285
+ /**
286
+ * 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.
287
+ */
288
+ cacheTtlSeconds?: number;
289
+ }
284
290
 
285
291
  /**
286
292
  * Adds failure and quota fallbacks to an existing AI Gateway model selection.
@@ -488,7 +494,10 @@ export declare interface AIGatewayMeteringInboundPolicyOptions {
488
494
  }
489
495
 
490
496
  /**
491
- * Meters AI Gateway v2 usage and enforces options-driven usage limits.
497
+ * Meters AI Gateway v2 usage and enforces app and ancestor usage limits.
498
+ *
499
+ * Limits configured on parent teams or the bucket root are enforced through a
500
+ * server-side hierarchical check.
492
501
  *
493
502
  * The authentication policy must run before this policy so the app
494
503
  * configuration id is available for meter storage and analytics.
@@ -557,6 +566,7 @@ export declare class AIGatewayMeteringV2InboundPolicy extends InboundPolicy<AIGa
557
566
  ): Promise<ZuploRequest | Response>;
558
567
  private resolveConfiguration;
559
568
  private fetchCurrentMeters;
569
+ private checkHierarchicalViolation;
560
570
  private checkWarnings;
561
571
  private hasWarning;
562
572
  private findViolation;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "6.74.2",
4
+ "version": "6.74.7",
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",