@zuplo/cli 7.11.1 → 7.11.4

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{E as p,J as c,M as u}from"../chunk-RHU3Z7DA.js";import"../chunk-NUVXDVLJ.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import"../chunk-CDEAY3VY.js";import{aa as i}from"../chunk-LVSZ3WTO.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{E as p,J as c,M as u}from"../chunk-3RVZUQKN.js";import"../chunk-NUVXDVLJ.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import"../chunk-CDEAY3VY.js";import{aa as i}from"../chunk-LVSZ3WTO.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
@@ -598,10 +598,11 @@ export declare interface AIGatewayLoadBalancingInboundPolicyOptions {
598
598
  /* Excluded from this release type: AIGatewayMeterIncrements */
599
599
 
600
600
  /**
601
- * Meters AI Gateway usage and enforces limits configured by the application.
601
+ * Meters AI Gateway usage for the application.
602
602
  *
603
603
  * The authentication policy must run before this policy so the app
604
- * configuration id is available for meter storage and analytics.
604
+ * configuration id is available for meter storage and analytics. Budgets are
605
+ * declared with `budgetRules` and enforced by the configuration executor.
605
606
  *
606
607
  * @title AI Gateway Metering
607
608
  * @product ai-gateway
@@ -610,7 +611,7 @@ export declare interface AIGatewayLoadBalancingInboundPolicyOptions {
610
611
  * @param context - The ZuploContext
611
612
  * @param options - The policy options set in policies.json
612
613
  * @param policyName - The name of the policy as set in policies.json
613
- * @returns The request, or a 429 response when a limit is exceeded
614
+ * @returns The request
614
615
  */
615
616
  declare class AIGatewayMeteringInboundPolicy extends InboundPolicy<AIGatewayMeteringInboundPolicyOptions> {
616
617
  #private;
@@ -646,22 +647,17 @@ declare class AIGatewayMeteringInboundPolicy extends InboundPolicy<AIGatewayMete
646
647
  context: ZuploContext
647
648
  ): Promise<ZuploRequest | Response>;
648
649
  private resolveConfiguration;
649
- private fetchCurrentMeters;
650
- private checkWarnings;
651
- private hasWarning;
652
- private findViolation;
653
- private createQuotaExceededResponse;
654
650
  }
655
651
  export { AIGatewayMeteringInboundPolicy };
656
652
  export { AIGatewayMeteringInboundPolicy as AIGatewayMeteringV2InboundPolicy };
657
653
 
658
654
  /**
659
- * Options for metering AI Gateway usage and enforcing request-time limits.
655
+ * Options for metering AI Gateway usage and declaring budget rules.
660
656
  * @public
661
657
  */
662
658
  declare interface AIGatewayMeteringInboundPolicyOptions {
663
659
  /**
664
- * Throw when the metering service is unavailable instead of failing open.
660
+ * Fail the request instead of logging the error when recording usage with the metering service fails.
665
661
  */
666
662
  throwOnFailure?: boolean;
667
663
  /**
@@ -689,7 +685,7 @@ declare interface AIGatewayMeteringInboundPolicyOptions {
689
685
  ];
690
686
  /**
691
687
  * @deprecated
692
- * Usage limits grouped by meter.
688
+ * Deprecated and not enforced. Declare budgets with budgetRules.
693
689
  */
694
690
  limits?: {
695
691
  costs?: QuotaLimit;
@@ -701,7 +697,10 @@ export { AIGatewayMeteringInboundPolicyOptions };
701
697
  export { AIGatewayMeteringInboundPolicyOptions as AIGatewayMeteringV2InboundPolicyOptions };
702
698
 
703
699
  /**
704
- * Usage-limit settings accepted by the `options.limits` policy option.
700
+ * Shape of the deprecated `options.limits` policy option. It is not enforced;
701
+ * declare budgets with `budgetRules`.
702
+ *
703
+ * @deprecated Use `budgetRules`.
705
704
  */
706
705
  declare interface AIGatewayMeteringLimitOverrides {
707
706
  costs?: AIGatewayMeteringMeterLimitOverrides;
@@ -3298,6 +3297,8 @@ export declare interface BrownoutInboundPolicyOptions {
3298
3297
  };
3299
3298
  }
3300
3299
 
3300
+ /* Excluded from this release type: buildCacheOperationBase */
3301
+
3301
3302
  /* Excluded from this release type: BuildEnvironment */
3302
3303
 
3303
3304
  /**
@@ -3350,6 +3351,62 @@ declare interface BuildRouteConfiguration {
3350
3351
  */
3351
3352
  declare type CacheNamespace = string;
3352
3353
 
3354
+ /**
3355
+ * The shared per-request dimensions every `cache_operation` event from a
3356
+ * policy carries; outcome-specific fields are added at each emission site.
3357
+ */
3358
+ declare type CacheOperationBase = Pick<
3359
+ CacheOperationParams,
3360
+ | "cacheType"
3361
+ | "policyType"
3362
+ | "policyName"
3363
+ | "configId"
3364
+ | "consumerSub"
3365
+ | "routePath"
3366
+ | "method"
3367
+ >;
3368
+
3369
+ /** The kind of cache a `cache_operation` event describes. */
3370
+ declare type CacheOperationCacheType = "semantic" | "http";
3371
+
3372
+ /**
3373
+ * The outcome of a single cache lookup or write attempt:
3374
+ * - `hit` / `miss`: lookup outcomes.
3375
+ * - `store`: a write-back stored the response.
3376
+ * - `not_stored`: a write-back declined to store (see `reason`).
3377
+ * - `skip`: the lookup never ran (uncacheable shape, missing identity, ...).
3378
+ * - `error`: the lookup or store failed (see `reason`).
3379
+ */
3380
+ declare type CacheOperationOutcome =
3381
+ | "hit"
3382
+ | "miss"
3383
+ | "store"
3384
+ | "skip"
3385
+ | "error"
3386
+ | "not_stored";
3387
+
3388
+ /**
3389
+ * Emitter-facing params for a `cache_operation` event. Everything the emitter
3390
+ * doesn't know may be omitted; {@link buildCacheOperationMetadata} normalizes
3391
+ * omissions to explicit `null`s so every event carries the full contract.
3392
+ */
3393
+ declare interface CacheOperationParams {
3394
+ cacheType: CacheOperationCacheType;
3395
+ policyType: string;
3396
+ policyName: string;
3397
+ outcome: CacheOperationOutcome;
3398
+ reason?: string | null;
3399
+ latencyMs?: number | null;
3400
+ similarity?: number | null;
3401
+ configId?: string | null;
3402
+ consumerSub?: string | null;
3403
+ routePath?: string | null;
3404
+ method?: string | null;
3405
+ statusCode?: number | null;
3406
+ savedPromptTokens?: number | null;
3407
+ savedCompletionTokens?: number | null;
3408
+ }
3409
+
3353
3410
  /**
3354
3411
  * Internal
3355
3412
  */
@@ -3811,7 +3868,7 @@ declare type Claim = string;
3811
3868
  declare type ClaimCheck = EqualsRule | InRule | StartsWithRule;
3812
3869
 
3813
3870
  /**
3814
- * Where the prompt is classified. Set `app.adapter` to select the API that classifier app exposes.
3871
+ * Where the prompt is classified. Set `app.dialect` to select the API that classifier app exposes.
3815
3872
  * @public
3816
3873
  */
3817
3874
  declare interface Classifier {
@@ -3828,14 +3885,15 @@ declare interface ClassifierApp {
3828
3885
  appId: ClassifierAppID_2;
3829
3886
  model: ClassifierModel_2;
3830
3887
  apiKey?: ClassifierAppAPIKey;
3831
- adapter?: ClassifierAppAdapter;
3888
+ dialect?: ClassifierAppDialect;
3889
+ adapter?: ClassifierAppAdapterDeprecated;
3832
3890
  }
3833
3891
 
3834
3892
  /**
3835
- * API contract exposed by the classifier app. `chat-completions` calls /v1/chat/completions; `messages` calls /v1/messages for Claude models that support structured outputs (`output_config.format`), such as `claude-haiku-4-5`, on a provider whose Messages endpoint accepts them (not Amazon Bedrock Mantle); `system-one` calls /v1/systemone for models such as Jev. The app owns provider credentials, pricing, metering and analytics.
3893
+ * **Deprecated**: use `classifier.app.dialect` instead. Still honored when `dialect` is not set; setting both is a configuration error.
3836
3894
  * @public
3837
3895
  */
3838
- declare type ClassifierAppAdapter =
3896
+ declare type ClassifierAppAdapterDeprecated =
3839
3897
  | "chat-completions"
3840
3898
  | "messages"
3841
3899
  | "system-one";
@@ -3852,6 +3910,15 @@ declare type ClassifierAppAPIKey = string;
3852
3910
  */
3853
3911
  declare type ClassifierAppAPIKeyDeprecated = string;
3854
3912
 
3913
+ /**
3914
+ * API contract exposed by the classifier app. `chat-completions` calls /v1/chat/completions; `messages` calls /v1/messages for Claude models that support structured outputs (`output_config.format`), such as `claude-haiku-4-5`, on a provider whose Messages endpoint accepts them (not Amazon Bedrock Mantle); `system-one` calls /v1/systemone for models such as Jev. The app owns provider credentials, pricing, metering and analytics.
3915
+ * @public
3916
+ */
3917
+ declare type ClassifierAppDialect =
3918
+ | "chat-completions"
3919
+ | "messages"
3920
+ | "system-one";
3921
+
3855
3922
  /**
3856
3923
  * Run the classifier on another AI Gateway app instead of calling an external API directly. The gateway invokes that app in-process — no outbound HTTP hop — so the classifier inherits its provider credentials, model routing, fallbacks and quotas, and provider keys stay on one app. Give that app the Internal Only policy and `apiKey` is not needed at all. When set, `model` must name a routed model as `provider/model` and `baseUrl` must not be set. The target app must not itself run this policy: it would be asked to classify its own classification request, which is rejected as a configuration error rather than silently skipped. Omit to call `baseUrl` directly.
3857
3924
  * @public
@@ -3877,7 +3944,7 @@ declare type ClassifierAppIDDeprecated = string;
3877
3944
  declare type ClassifierModel = string;
3878
3945
 
3879
3946
  /**
3880
- * The model (`providerName/model`) the classifier app uses to evaluate the user's request. `providerName` is the name of the provider as configured on the classifier app, not a fixed vendor id. E.g. `openai/gpt-4o-mini`, `anthropic/claude-haiku-4-5` with the `messages` adapter, or `jev/jev-latest` when the Jev provider is named `jev`.
3947
+ * The model (`providerName/model`) the classifier app uses to evaluate the user's request. `providerName` is the name of the provider as configured on the classifier app, not a fixed vendor id. E.g. `openai/gpt-4o-mini`, `anthropic/claude-haiku-4-5` with the `messages` dialect, or `jev/jev-latest` when the Jev provider is named `jev`.
3881
3948
  * @public
3882
3949
  */
3883
3950
  declare type ClassifierModel_2 = string;
@@ -3895,7 +3962,7 @@ declare type ClassifierModelDeprecated = string;
3895
3962
  declare type ClassifierPrompt = string | [string, ...string[]];
3896
3963
 
3897
3964
  /**
3898
- * Prompt for classifier.app (its default `chat-completions` adapter or the `messages` adapter, where it is sent as the system prompt) and classifier.chatCompletions. Omit to use the built-in prompt. classifier.app.adapter `system-one` and classifier.jev take no prompt; combining them with classifierPrompt is a configuration error.
3965
+ * Prompt for classifier.app (its default `chat-completions` dialect or the `messages` dialect, where it is sent as the system prompt) and classifier.chatCompletions. Omit to use the built-in prompt. classifier.app.dialect `system-one` and classifier.jev take no prompt; combining them with classifierPrompt is a configuration error.
3899
3966
  * @public
3900
3967
  */
3901
3968
  declare type ClassifierPrompt_2 = string | [string, ...string[]];
@@ -5409,6 +5476,10 @@ declare type EmbeddingsOverride =
5409
5476
  default: DefaultModel1;
5410
5477
  };
5411
5478
 
5479
+ /* Excluded from this release type: emitCacheOperation */
5480
+
5481
+ /* Excluded from this release type: emitCacheOperationLate */
5482
+
5412
5483
  /**
5413
5484
  * Enable accumulation and validation of streaming responses.
5414
5485
  * @public
@@ -8337,7 +8408,7 @@ declare type JevModel = string;
8337
8408
 
8338
8409
  /**
8339
8410
  * @deprecated
8340
- * Deprecated: use `classifier.app` with `adapter` `system-one` instead. Classify with Jev, TypeSafe's classification model, by calling a System One API directly: TypeSafe's by default, or another host such as OpenRouter through `baseUrl`. Jev answers typed questions instead of generating text, so it takes no `classifierPrompt`.
8411
+ * Deprecated: use `classifier.app` with `dialect` `system-one` instead. Classify with Jev, TypeSafe's classification model, by calling a System One API directly: TypeSafe's by default, or another host such as OpenRouter through `baseUrl`. Jev answers typed questions instead of generating text, so it takes no `classifierPrompt`.
8341
8412
  * @public
8342
8413
  */
8343
8414
  declare interface JevTypeSafe {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.11.1",
4
+ "version": "7.11.4",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "7.11.1",
3
+ "version": "7.11.4",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "type": "module",
@@ -31,10 +31,10 @@
31
31
  "@opentelemetry/api": "1.9.0",
32
32
  "@opentelemetry/api-logs": "0.220.0",
33
33
  "@swc/core": "1.10.18",
34
- "@zuplo/core": "7.11.1",
34
+ "@zuplo/core": "7.11.4",
35
35
  "@zuplo/editor": "1.0.33162667821",
36
- "@zuplo/openapi-tools": "7.11.1",
37
- "@zuplo/runtime": "7.11.1",
36
+ "@zuplo/openapi-tools": "7.11.4",
37
+ "@zuplo/runtime": "7.11.4",
38
38
  "chalk": "5.4.1",
39
39
  "chokidar": "3.5.3",
40
40
  "cookie": "1.0.2",
@@ -65,15 +65,15 @@
65
65
  "workerd": "1.20261002.1",
66
66
  "yargs": "17.7.2",
67
67
  "zod": "4.4.3",
68
- "@zuplo/graphql": "7.11.1",
69
- "@zuplo/otel": "7.11.1"
68
+ "@zuplo/graphql": "7.11.4",
69
+ "@zuplo/otel": "7.11.4"
70
70
  },
71
71
  "optionalDependencies": {
72
- "@zuplo/lint-darwin-arm64": "7.11.1",
73
- "@zuplo/lint-darwin-x64": "7.11.1",
74
- "@zuplo/lint-linux-x64": "7.11.1",
75
- "@zuplo/lint-linux-arm64": "7.11.1",
76
- "@zuplo/lint-win32-x64": "7.11.1"
72
+ "@zuplo/lint-darwin-arm64": "7.11.4",
73
+ "@zuplo/lint-darwin-x64": "7.11.4",
74
+ "@zuplo/lint-linux-x64": "7.11.4",
75
+ "@zuplo/lint-linux-arm64": "7.11.4",
76
+ "@zuplo/lint-win32-x64": "7.11.4"
77
77
  },
78
78
  "bundleDependencies": [
79
79
  "@inquirer/prompts",