@zuplo/runtime 6.59.12 → 6.59.17

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.
@@ -1,8 +1,6 @@
1
- import { CallToolResult } from "@zuplo/mcp/types";
2
1
  import { KeyLike } from "jose";
3
2
  import { RequestGeneric as RequestGeneric_2 } from "../../request.js";
4
3
  import type { ValidateFunction } from "ajv";
5
- import { z } from "zod/v4";
6
4
 
7
5
  /**
8
6
  * Authenticates an AI Gateway Application requests based on Application API Keys
@@ -127,7 +125,9 @@ export declare function aiGatewayHandler(
127
125
  /* Excluded from this release type: AIGatewayMeterIncrements */
128
126
 
129
127
  /**
130
- * AI Gateway Metering policy for quota enforcement
128
+ * AI Gateway Metering policy for quota enforcement.
129
+ * This policy is meant to be used as singleton.
130
+ * You should only have one for your entire Gateway.
131
131
  *
132
132
  * @title AI Gateway Metering
133
133
  * @hidden
@@ -158,7 +158,20 @@ export declare class AIGatewayMeteringInboundPolicy extends InboundPolicy<AIGate
158
158
  context: ZuploContext
159
159
  ): Promise<Response | ZuploRequest<RequestGeneric_2>>;
160
160
  private fetchCurrentMeters;
161
- private incrementMeters;
161
+ /**
162
+ * Increment meters via API. Can be used by providers for streaming responses.
163
+ *
164
+ * @param configurationId - The AI Gateway configuration ID
165
+ * @param increments - The meter increments to send
166
+ * @param context - The ZuploContext for logging
167
+ * @returns Promise that resolves when meters are incremented
168
+ */
169
+ static incrementMeters(
170
+ configurationId: string,
171
+ increments: AIGatewayMeterIncrements,
172
+ context: ZuploContext
173
+ ): Promise<void>;
174
+ private static incrementMetersInternal;
162
175
  private checkQuotas;
163
176
  private checkQuotaLimit;
164
177
  private createQuotaExceededResponse;
@@ -4902,65 +4915,6 @@ declare type LokiTransportVersion = 1 | 2;
4902
4915
 
4903
4916
  /* Excluded from this release type: LookupResult */
4904
4917
 
4905
- /**
4906
- * SDK for creating and managing MCP custom tools
4907
- *
4908
- * Provides a fluent API for defining custom MCP tools that can perform
4909
- * complex operations including calling multiple routes or implementing
4910
- * custom logic beyond simple route mapping.
4911
- * @beta
4912
- */
4913
- export declare class McpCustomToolsSDK {
4914
- /**
4915
- * Create a new tool builder
4916
- * @beta
4917
- */
4918
- createTool(): McpToolBuilder;
4919
- /**
4920
- * Define a tool with a configuration object
4921
- * @beta
4922
- */
4923
- defineTool<TSchema extends z.ZodType>(config: {
4924
- name: string;
4925
- description: string;
4926
- schema?: TSchema;
4927
- outputSchema?: TSchema;
4928
- handler: McpToolHandler<z.infer<TSchema>>;
4929
- }): McpToolDefinition<z.infer<TSchema>>;
4930
- /**
4931
- * Create a text response
4932
- * @beta
4933
- */
4934
- textResponse(text: string): CallToolResult;
4935
- /**
4936
- * Create a JSON response (automatically stringified and put in structured content)
4937
- * @beta
4938
- */
4939
- jsonResponse(data: any): CallToolResult;
4940
- /**
4941
- * Create an error response
4942
- * @beta
4943
- */
4944
- errorResponse(message: string): CallToolResult;
4945
- /**
4946
- * Create an image response
4947
- * @beta
4948
- */
4949
- imageResponse(data: string, mimeType: string): CallToolResult;
4950
- /**
4951
- * Create a resource response
4952
- * @beta
4953
- */
4954
- resourceResponse(uri: string, mimeType?: string): CallToolResult;
4955
- /**
4956
- * Fetches the original headers used to invoke the MCP server.
4957
- * This is especially useful for when re-invoking Gateway routes and passing through
4958
- * all captured headers.
4959
- * @beta
4960
- */
4961
- getInvokeHeaders(): Record<string, string>;
4962
- }
4963
-
4964
4918
  /**
4965
4919
  * An MCP Server handler for Zuplo
4966
4920
  * Only POST requests are supported for the HTTP streamable MCP transport.
@@ -4975,65 +4929,6 @@ export declare function mcpServerHandler(
4975
4929
  context: ZuploContext
4976
4930
  ): Promise<Response>;
4977
4931
 
4978
- /**
4979
- * Builder for creating MCP tools with type safety
4980
- * @beta
4981
- */
4982
- export declare class McpToolBuilder<TSchema extends z.ZodSchema = z.ZodAny> {
4983
- private config;
4984
- /**
4985
- * Set the tool name
4986
- * @beta
4987
- */
4988
- name(name: string): this;
4989
- /**
4990
- * Set the tool description
4991
- * @beta
4992
- */
4993
- description(description: string): this;
4994
- /**
4995
- * Set the input schema for the tool
4996
- * @beta
4997
- */
4998
- schema<S extends z.ZodSchema>(schema: S): McpToolBuilder<S>;
4999
- /**
5000
- * Set the output schema for the tool
5001
- * @beta
5002
- */
5003
- outSchema<S extends z.ZodSchema>(schema: S): McpToolBuilder<S>;
5004
- /**
5005
- * Set the handler function for the tool
5006
- * @beta
5007
- */
5008
- handler(handler: McpToolHandler<z.infer<TSchema>>): this;
5009
- /**
5010
- * Build the tool definition
5011
- * @beta
5012
- */
5013
- build(): McpToolDefinition<z.infer<TSchema>>;
5014
- }
5015
-
5016
- /**
5017
- * Definition of a custom MCP tool
5018
- * @beta
5019
- */
5020
- export declare interface McpToolDefinition<TSchema = any> {
5021
- name: string;
5022
- description: string;
5023
- schema?: z.ZodType<TSchema>;
5024
- outputSchema?: z.ZodType<TSchema>;
5025
- handler: McpToolHandler<TSchema>;
5026
- }
5027
-
5028
- /**
5029
- * Handler function for MCP tools
5030
- * @beta
5031
- */
5032
- export declare type McpToolHandler<TArgs = any> = (
5033
- args: TArgs,
5034
- context: ZuploContext
5035
- ) => Promise<CallToolResult> | CallToolResult;
5036
-
5037
4932
  declare interface MemoryCacheOptions {
5038
4933
  maxSize: number;
5039
4934
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "6.59.12",
4
+ "version": "6.59.17",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {