@zuplo/runtime 7.8.19 → 7.8.21
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/out/esm/{chunk-I5ENAL3B.js → chunk-OABXMALF.js} +97 -97
- package/out/esm/chunk-OABXMALF.js.map +1 -0
- package/out/esm/index.js +1 -1
- package/out/esm/index.js.map +1 -1
- package/out/esm/mcp-gateway/index.js +1 -1
- package/out/esm/mocks/index.js +1 -1
- package/out/types/index.d.ts +105 -0
- package/package.json +1 -1
- package/out/esm/chunk-I5ENAL3B.js.map +0 -1
- /package/out/esm/{chunk-I5ENAL3B.js.LEGAL.txt → chunk-OABXMALF.js.LEGAL.txt} +0 -0
package/out/esm/mocks/index.js
CHANGED
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{E as p,J as c,M as u}from"../chunk-
|
|
25
|
+
import{E as p,J as c,M as u}from"../chunk-OABXMALF.js";import"../chunk-54HRCPVQ.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import"../chunk-6O4OZCO6.js";import{aa as i}from"../chunk-MWIJG5KC.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
|
package/out/types/index.d.ts
CHANGED
|
@@ -874,6 +874,54 @@ export declare interface AIGatewayModelInfo {
|
|
|
874
874
|
outputCostPerToken: number;
|
|
875
875
|
}
|
|
876
876
|
|
|
877
|
+
/**
|
|
878
|
+
* Forces one model for every request, or supplies a default model when a
|
|
879
|
+
* request omits one, then stores that selection for the AI Gateway handler.
|
|
880
|
+
*
|
|
881
|
+
* An earlier policy's model selection is never overwritten, so a custom
|
|
882
|
+
* routing policy placed before this one stays authoritative.
|
|
883
|
+
*
|
|
884
|
+
* @title AI Gateway Model Override
|
|
885
|
+
* @beta
|
|
886
|
+
* @product ai-gateway
|
|
887
|
+
* @requiresAI
|
|
888
|
+
* @param request - The ZuploRequest
|
|
889
|
+
* @param context - The ZuploContext
|
|
890
|
+
* @param options - The policy options set in policies.json
|
|
891
|
+
* @param policyName - The name of the policy as set in policies.json
|
|
892
|
+
* @returns The request with model routing stored in context
|
|
893
|
+
* @example
|
|
894
|
+
* ```json
|
|
895
|
+
* {
|
|
896
|
+
* "models": {
|
|
897
|
+
* "completions": {
|
|
898
|
+
* "force": "openai/gpt-5"
|
|
899
|
+
* },
|
|
900
|
+
* "embeddings": {
|
|
901
|
+
* "default": "openai/text-embedding-3-small"
|
|
902
|
+
* }
|
|
903
|
+
* }
|
|
904
|
+
* }
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
export declare class AIGatewayModelOverrideInboundPolicy extends InboundPolicy<AIGatewayModelOverrideInboundPolicyOptions> {
|
|
908
|
+
#private;
|
|
909
|
+
static readonly policyType = "ai-gateway-model-override";
|
|
910
|
+
constructor(
|
|
911
|
+
options: AIGatewayModelOverrideInboundPolicyOptions,
|
|
912
|
+
policyName: string
|
|
913
|
+
);
|
|
914
|
+
handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest>;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Options for forcing one model or supplying a default model for each AI Gateway capability.
|
|
919
|
+
* @public
|
|
920
|
+
*/
|
|
921
|
+
export declare interface AIGatewayModelOverrideInboundPolicyOptions {
|
|
922
|
+
models: Models_2;
|
|
923
|
+
}
|
|
924
|
+
|
|
877
925
|
/**
|
|
878
926
|
* Sets and reads the model routing selected for an AI Gateway request.
|
|
879
927
|
*
|
|
@@ -4403,6 +4451,18 @@ declare type CompletionsModels =
|
|
|
4403
4451
|
blockList: BlockedModels;
|
|
4404
4452
|
};
|
|
4405
4453
|
|
|
4454
|
+
/**
|
|
4455
|
+
* Rule for chat completions, Responses, and Anthropic Messages requests.
|
|
4456
|
+
* @public
|
|
4457
|
+
*/
|
|
4458
|
+
declare type CompletionsOverride =
|
|
4459
|
+
| {
|
|
4460
|
+
force: ForcedModel;
|
|
4461
|
+
}
|
|
4462
|
+
| {
|
|
4463
|
+
default: DefaultModel;
|
|
4464
|
+
};
|
|
4465
|
+
|
|
4406
4466
|
/**
|
|
4407
4467
|
* @public
|
|
4408
4468
|
*/
|
|
@@ -5246,6 +5306,18 @@ export declare interface DataLossPreventionOutboundPolicyOptions {
|
|
|
5246
5306
|
*/
|
|
5247
5307
|
export declare const defaultGenerateHydrolixEntry: GenerateRequestLoggerEntry<HydrolixDefaultEntry>;
|
|
5248
5308
|
|
|
5309
|
+
/**
|
|
5310
|
+
* The model used only when a request does not select one.
|
|
5311
|
+
* @public
|
|
5312
|
+
*/
|
|
5313
|
+
declare type DefaultModel = string;
|
|
5314
|
+
|
|
5315
|
+
/**
|
|
5316
|
+
* The model used only when a request does not select one.
|
|
5317
|
+
* @public
|
|
5318
|
+
*/
|
|
5319
|
+
declare type DefaultModel1 = string;
|
|
5320
|
+
|
|
5249
5321
|
/* Excluded from this release type: DevPortalRuntimeConfig */
|
|
5250
5322
|
|
|
5251
5323
|
declare type DevPortalType = "legacy" | "zudoku";
|
|
@@ -5527,6 +5599,18 @@ declare type EmbeddingsModels =
|
|
|
5527
5599
|
blockList: BlockedModels1;
|
|
5528
5600
|
};
|
|
5529
5601
|
|
|
5602
|
+
/**
|
|
5603
|
+
* Rule for embedding requests.
|
|
5604
|
+
* @public
|
|
5605
|
+
*/
|
|
5606
|
+
declare type EmbeddingsOverride =
|
|
5607
|
+
| {
|
|
5608
|
+
force: ForcedModel1;
|
|
5609
|
+
}
|
|
5610
|
+
| {
|
|
5611
|
+
default: DefaultModel1;
|
|
5612
|
+
};
|
|
5613
|
+
|
|
5530
5614
|
/**
|
|
5531
5615
|
* Enable accumulation and validation of streaming responses.
|
|
5532
5616
|
* @public
|
|
@@ -5750,6 +5834,18 @@ export declare interface FirebaseJwtInboundPolicyOptions {
|
|
|
5750
5834
|
*/
|
|
5751
5835
|
export declare function flattenMessageContent(content: unknown): string;
|
|
5752
5836
|
|
|
5837
|
+
/**
|
|
5838
|
+
* The model every request uses; a request-selected model is ignored.
|
|
5839
|
+
* @public
|
|
5840
|
+
*/
|
|
5841
|
+
declare type ForcedModel = string;
|
|
5842
|
+
|
|
5843
|
+
/**
|
|
5844
|
+
* The model every request uses; a request-selected model is ignored.
|
|
5845
|
+
* @public
|
|
5846
|
+
*/
|
|
5847
|
+
declare type ForcedModel1 = string;
|
|
5848
|
+
|
|
5753
5849
|
/**
|
|
5754
5850
|
* Converts form data in the incoming request to JSON.
|
|
5755
5851
|
*
|
|
@@ -10872,6 +10968,15 @@ declare interface Models {
|
|
|
10872
10968
|
embeddings?: EmbeddingsModels;
|
|
10873
10969
|
}
|
|
10874
10970
|
|
|
10971
|
+
/**
|
|
10972
|
+
* Override rules grouped by AI Gateway capability.
|
|
10973
|
+
* @public
|
|
10974
|
+
*/
|
|
10975
|
+
declare interface Models_2 {
|
|
10976
|
+
completions?: CompletionsOverride;
|
|
10977
|
+
embeddings?: EmbeddingsOverride;
|
|
10978
|
+
}
|
|
10979
|
+
|
|
10875
10980
|
/**
|
|
10876
10981
|
* Enables which model will be used based on the classifier results (`low`, `medium` and `high`). This configuration is applied only when `smartRoutingEnabled` is true and confidence score meets the `minConfidenceForRouting` threshold.
|
|
10877
10982
|
* @public
|