@zuplo/runtime 7.6.7 → 7.6.9

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.
@@ -1302,7 +1302,14 @@ export declare type AiRequestBody =
1302
1302
  }
1303
1303
  | {
1304
1304
  format: "anthropic-messages";
1305
- body: AnthropicMessagesRequest;
1305
+ /**
1306
+ * `/v1/messages` bodies carry a required `max_tokens`;
1307
+ * `/v1/messages/count_tokens` bodies never do, and both classify as
1308
+ * `anthropic-messages` because they are the same schema dialect. The union
1309
+ * keeps a policy from reading `max_tokens` as if it were always present —
1310
+ * narrow on it (or on `getFormat`'s endpoint) before relying on it.
1311
+ */
1312
+ body: AnthropicMessagesRequest | AnthropicCountTokensRequest;
1306
1313
  };
1307
1314
 
1308
1315
  /**
@@ -1749,6 +1756,19 @@ declare interface AndRule {
1749
1756
  and: [NestedRule, ...NestedRule[]];
1750
1757
  }
1751
1758
 
1759
+ /**
1760
+ * A request to Anthropic's token-counting operation
1761
+ * (`/v1/messages/count_tokens`).
1762
+ *
1763
+ * The request uses the Messages body shape but does not require `max_tokens`.
1764
+ * The index signature preserves evolving Anthropic fields verbatim.
1765
+ */
1766
+ declare interface AnthropicCountTokensRequest {
1767
+ model: string;
1768
+ messages: AnthropicMessage[];
1769
+ [key: string]: unknown;
1770
+ }
1771
+
1752
1772
  declare interface AnthropicMessage {
1753
1773
  role: "user" | "assistant";
1754
1774
  content:
@@ -2439,7 +2459,7 @@ export declare interface Auth0JwtInboundPolicyOptions {
2439
2459
  */
2440
2460
  allowUnauthenticatedRequests?: boolean;
2441
2461
  /**
2442
- * Flag that determines whether OAuth protected resource metadata is enabled.
2462
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
2443
2463
  */
2444
2464
  oAuthResourceMetadataEnabled?: boolean;
2445
2465
  }
@@ -3748,25 +3768,25 @@ declare type ClaimCheck = EqualsRule | InRule | StartsWithRule;
3748
3768
  declare type ClassifierAppAPIKey = string;
3749
3769
 
3750
3770
  /**
3751
- * The AI Gateway application id whose `/v1/chat/completions` route runs the classifier. The policy calls `/{classifierAppID}/v1/chat/completions` via `context.invokeRoute`.
3771
+ * The AI Gateway application id used to run the classifier prompt and evaluate the user's request.
3752
3772
  * @public
3753
3773
  */
3754
3774
  declare type ClassifierAppID = string;
3755
3775
 
3756
3776
  /**
3757
- * The `providerName/model` reference the classifier chat/completions request should use.
3777
+ * The model (`providerName/model`) the classifier uses to evaluate the user's request. E.g. `openai/gpt-4o-mini`.
3758
3778
  * @public
3759
3779
  */
3760
3780
  declare type ClassifierModel = string;
3761
3781
 
3762
3782
  /**
3763
- * System prompt for the classifier. If it includes `{{intents}}`, that placeholder is replaced with the configured intent id/description list. A string or an array of lines (joined with newlines). Omit to use the built-in classifier prompt.
3783
+ * Prompt used to analyze and classify the user message. Omit to use the built-in classifier prompt.
3764
3784
  * @public
3765
3785
  */
3766
3786
  declare type ClassifierPrompt = string | [string, ...string[]];
3767
3787
 
3768
3788
  /**
3769
- * How long to wait for the classifier `invokeRoute` call before skipping classification and forwarding the original request.
3789
+ * Timeout configured for the classifier task. When exceeded, the request is forwarded without classification to the original model.
3770
3790
  * @public
3771
3791
  */
3772
3792
  declare type ClassifierTimeoutMs = number;
@@ -3849,7 +3869,7 @@ export declare interface ClerkJwtInboundPolicyOptions {
3849
3869
  */
3850
3870
  allowUnauthenticatedRequests?: boolean;
3851
3871
  /**
3852
- * Flag that determines whether OAuth protected resource metadata is enabled.
3872
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
3853
3873
  */
3854
3874
  oAuthResourceMetadataEnabled?: boolean;
3855
3875
  }
@@ -3934,7 +3954,7 @@ export declare interface CognitoJwtInboundPolicyOptions {
3934
3954
  */
3935
3955
  allowUnauthenticatedRequests?: boolean;
3936
3956
  /**
3937
- * Flag that determines whether OAuth protected resource metadata is enabled.
3957
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
3938
3958
  */
3939
3959
  oAuthResourceMetadataEnabled?: boolean;
3940
3960
  }
@@ -5462,7 +5482,7 @@ export declare interface FirebaseJwtInboundPolicyOptions {
5462
5482
  */
5463
5483
  allowUnauthenticatedRequests?: boolean;
5464
5484
  /**
5465
- * Flag that determines whether OAuth protected resource metadata is enabled.
5485
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
5466
5486
  */
5467
5487
  oAuthResourceMetadataEnabled?: boolean;
5468
5488
  }
@@ -7843,19 +7863,19 @@ declare interface InRule {
7843
7863
  }
7844
7864
 
7845
7865
  /**
7846
- * Short description shown to the classifier for this intent.
7866
+ * Short description of the intent label.
7847
7867
  * @public
7848
7868
  */
7849
7869
  declare type IntentDescription = string;
7850
7870
 
7851
7871
  /**
7852
- * Stable intent identifier written into the classifier JSON schema enum.
7872
+ * Label used to classify the intent of the user message being evaluated.
7853
7873
  * @public
7854
7874
  */
7855
7875
  declare type IntentID = string;
7856
7876
 
7857
7877
  /**
7858
- * Labels the classifier may assign. Used to build the JSON schema enum and injected into `classifierPrompt` at `{{intents}}`. Omit to use the built-in taxonomy (code, summarization, translation, qa, conversation, classification, creative_writing, agentic, document_qa, other).
7878
+ * Dictionary of intents used to classify the user message being evaluated. Omit to use the built-in dictionary (code, summarization, translation, qa, conversation, classification, creative_writing, agentic, document_qa, other).
7859
7879
  *
7860
7880
  * @minItems 1
7861
7881
  * @public
@@ -8528,7 +8548,7 @@ declare type LowComplexityModel = string;
8528
8548
  declare type MaxConversationLength = number;
8529
8549
 
8530
8550
  /**
8531
- * Maximum characters of user prompt sent to the classifier. Longer prompts are truncated.
8551
+ * Maximum characters of user message sent to the classifier. Longer messages get truncated.
8532
8552
  * @public
8533
8553
  */
8534
8554
  declare type MaxPromptCharacters = number;
@@ -10584,7 +10604,7 @@ declare interface Models {
10584
10604
  }
10585
10605
 
10586
10606
  /**
10587
- * `providerName/model` routing by classified complexity. All of `low`, `medium`, and `high` are required. Used only when `smartRoutingEnabled` is true.
10607
+ * 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.
10588
10608
  * @public
10589
10609
  */
10590
10610
  declare interface ModelsByComplexity {
@@ -10981,7 +11001,14 @@ declare type OAuthClientCredentialsLocation = "body" | "header";
10981
11001
  */
10982
11002
  export declare class OAuthProtectedResourcePlugin extends OAuthProtectedResourceBasePlugin {
10983
11003
  private options;
11004
+ private readonly scopes;
10984
11005
  constructor(options: OAuthProtectedResourcePluginOptions);
11006
+ /**
11007
+ * The scope values configured through `scopesSupported`, or `undefined` when
11008
+ * the option was not set. OAuth policies read this to populate the `scope`
11009
+ * parameter of their `WWW-Authenticate` challenge.
11010
+ */
11011
+ get scopesSupported(): readonly string[] | undefined;
10985
11012
  protected getMetadataOptions(
10986
11013
  _request: ZuploRequest,
10987
11014
  _context: ZuploContext
@@ -11005,6 +11032,29 @@ export declare interface OAuthProtectedResourcePluginOptions {
11005
11032
  * This field is recommended by RFC 9728.
11006
11033
  */
11007
11034
  resourceName?: string;
11035
+ /**
11036
+ * Scope values that clients should request when obtaining an access token for
11037
+ * this protected resource. Emitted as `scopes_supported` in the metadata
11038
+ * document (RFC 9728) and, when an OAuth policy on the route has
11039
+ * `oAuthResourceMetadataEnabled` set, as the `scope` parameter of the
11040
+ * `WWW-Authenticate` challenge on 401 responses. MCP clients use these values
11041
+ * to build their authorization request instead of asking for every scope the
11042
+ * authorization server advertises.
11043
+ *
11044
+ * Each entry must be a single OAuth scope token (RFC 6749 §3.3): printable
11045
+ * ASCII with no spaces, double quotes, or backslashes. The list must not be
11046
+ * empty; omit the option to advertise no scopes.
11047
+ *
11048
+ * @example
11049
+ * ```ts
11050
+ * new OAuthProtectedResourcePlugin({
11051
+ * authorizationServers: ["https://acme.okta.com/oauth2/aus1a2b3c"],
11052
+ * resourceName: "Acme MCP",
11053
+ * scopesSupported: ["mcp:access", "openid", "offline_access"],
11054
+ * });
11055
+ * ```
11056
+ */
11057
+ scopesSupported?: string[];
11008
11058
  }
11009
11059
 
11010
11060
  /**
@@ -11091,7 +11141,7 @@ export declare interface OktaJwtInboundPolicyOptions {
11091
11141
  */
11092
11142
  allowUnauthenticatedRequests?: boolean;
11093
11143
  /**
11094
- * Flag that determines whether OAuth protected resource metadata is enabled.
11144
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
11095
11145
  */
11096
11146
  oAuthResourceMetadataEnabled?: boolean;
11097
11147
  }
@@ -11897,7 +11947,7 @@ export declare interface OpenIdJwtInboundPolicyOptions {
11897
11947
  [k: string]: string;
11898
11948
  };
11899
11949
  /**
11900
- * Flag that determines whether OAuth protected resource metadata is enabled.
11950
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
11901
11951
  */
11902
11952
  oAuthResourceMetadataEnabled?: boolean;
11903
11953
  }
@@ -12482,7 +12532,7 @@ export declare interface PropelAuthJwtInboundPolicyOptions {
12482
12532
  */
12483
12533
  allowUnauthenticatedRequests?: boolean;
12484
12534
  /**
12485
- * Flag that determines whether OAuth protected resource metadata is enabled.
12535
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
12486
12536
  */
12487
12537
  oAuthResourceMetadataEnabled?: boolean;
12488
12538
  }
@@ -14179,7 +14229,7 @@ export declare interface SleepInboundPolicyOptions {
14179
14229
  }
14180
14230
 
14181
14231
  /**
14182
- * When true, apply model routing from `modelsByComplexity` when confidence is high enough and the intent is known. Classification still runs when false.
14232
+ * When true, apply model routing based on the models set in `modelsByComplexity` when confidence score meets the `minConfidenceForRouting` threshold. When set to false, classification still runs but model routing is not applied, useful for debugging or testing the classifier prompt.
14183
14233
  * @public
14184
14234
  */
14185
14235
  declare type SmartRoutingEnabled = boolean;
@@ -14442,7 +14492,7 @@ export declare interface SupabaseJwtInboundPolicyOptions {
14442
14492
  */
14443
14493
  allowUnauthenticatedRequests?: boolean;
14444
14494
  /**
14445
- * Flag that determines whether OAuth protected resource metadata is enabled.
14495
+ * Enables OAuth 2.0 Protected Resource Metadata discovery (RFC 9728). When `true`, requests without a bearer token receive a 401 whose `WWW-Authenticate` header points `resource_metadata` at the `/.well-known/oauth-protected-resource` document for the request path and, when the `OAuthProtectedResourcePlugin` declares `scopesSupported`, lists those scopes in `scope`. Requires the `OAuthProtectedResourcePlugin` in `zuplo.runtime.ts` or a user-defined route at that path.
14446
14496
  */
14447
14497
  oAuthResourceMetadataEnabled?: boolean;
14448
14498
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.6.7",
4
+ "version": "7.6.9",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {