@utcp/http 1.0.4 → 1.0.6
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/dist/index.cjs +5300 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +437 -0
- package/dist/index.d.ts +432 -8
- package/dist/index.js +5260 -38
- package/dist/index.js.map +1 -0
- package/package.json +6 -5
- package/dist/http_call_template.d.ts +0 -35
- package/dist/http_call_template.js +0 -55
- package/dist/http_communication_protocol.d.ts +0 -88
- package/dist/http_communication_protocol.js +0 -337
- package/dist/openapi_converter.d.ts +0 -117
- package/dist/openapi_converter.js +0 -535
- package/dist/sse_call_template.d.ts +0 -53
- package/dist/sse_call_template.js +0 -55
- package/dist/sse_communication_protocol.d.ts +0 -47
- package/dist/sse_communication_protocol.js +0 -157
- package/dist/streamable_http_call_template.d.ts +0 -55
- package/dist/streamable_http_call_template.js +0 -57
- package/dist/streamable_http_communication_protocol.d.ts +0 -47
- package/dist/streamable_http_communication_protocol.js +0 -154
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,437 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CallTemplate, Auth, Serializer, CommunicationProtocol, IUtcpClient, RegisterManualResult, UtcpManual } from '@utcp/sdk';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* REQUIRED
|
|
6
|
+
* Provider configuration for HTTP-based tools.
|
|
7
|
+
*
|
|
8
|
+
* Supports RESTful HTTP/HTTPS APIs with various HTTP methods, authentication,
|
|
9
|
+
* custom headers, and flexible request/response handling. Supports URL path
|
|
10
|
+
* parameters using {parameter_name} syntax.
|
|
11
|
+
*/
|
|
12
|
+
interface HttpCallTemplate extends CallTemplate {
|
|
13
|
+
call_template_type: 'http';
|
|
14
|
+
http_method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
15
|
+
url: string;
|
|
16
|
+
content_type: string;
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
body_field?: string;
|
|
19
|
+
header_fields?: string[];
|
|
20
|
+
auth_tools?: Auth | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* HTTP Call Template schema for RESTful HTTP/HTTPS API tools.
|
|
24
|
+
* Extends the base CallTemplate and defines HTTP-specific configuration.
|
|
25
|
+
*/
|
|
26
|
+
declare const HttpCallTemplateSchema: z.ZodType<HttpCallTemplate>;
|
|
27
|
+
/**
|
|
28
|
+
* REQUIRED
|
|
29
|
+
* Serializer for HttpCallTemplate.
|
|
30
|
+
*/
|
|
31
|
+
declare class HttpCallTemplateSerializer extends Serializer<HttpCallTemplate> {
|
|
32
|
+
toDict(obj: HttpCallTemplate): Record<string, unknown>;
|
|
33
|
+
validateDict(obj: Record<string, unknown>): HttpCallTemplate;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* HTTP communication protocol implementation for UTCP client.
|
|
38
|
+
*
|
|
39
|
+
* Handles communication with HTTP-based tool providers, supporting various
|
|
40
|
+
* authentication methods, URL path parameters, and automatic tool discovery.
|
|
41
|
+
* Enforces security by requiring HTTPS or localhost connections.
|
|
42
|
+
*/
|
|
43
|
+
declare class HttpCommunicationProtocol implements CommunicationProtocol {
|
|
44
|
+
private _oauthTokens;
|
|
45
|
+
private _axiosInstance;
|
|
46
|
+
constructor();
|
|
47
|
+
private _logInfo;
|
|
48
|
+
private _logError;
|
|
49
|
+
/**
|
|
50
|
+
* Registers a manual and its tools from an HTTP provider.
|
|
51
|
+
* Supports UTCP Manuals directly or OpenAPI specifications which are converted.
|
|
52
|
+
*
|
|
53
|
+
* @param caller The UTCP client instance.
|
|
54
|
+
* @param manualCallTemplate The HTTP call template for discovery.
|
|
55
|
+
* @returns A RegisterManualResult object.
|
|
56
|
+
*/
|
|
57
|
+
registerManual(caller: IUtcpClient, manualCallTemplate: CallTemplate): Promise<RegisterManualResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Deregisters an HTTP manual. This is a no-op for stateless HTTP communication.
|
|
60
|
+
* @param caller The UTCP client instance.
|
|
61
|
+
* @param manualCallTemplate The HTTP call template to deregister.
|
|
62
|
+
*/
|
|
63
|
+
deregisterManual(caller: IUtcpClient, manualCallTemplate: CallTemplate): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Executes a tool call through the HTTP protocol.
|
|
66
|
+
*
|
|
67
|
+
* @param caller The UTCP client instance.
|
|
68
|
+
* @param toolName Name of the tool to call.
|
|
69
|
+
* @param toolArgs Dictionary of arguments to pass to the tool.
|
|
70
|
+
* @param toolCallTemplate The HTTP call template for the tool.
|
|
71
|
+
* @returns The tool's response.
|
|
72
|
+
*/
|
|
73
|
+
callTool(caller: IUtcpClient, toolName: string, toolArgs: Record<string, any>, toolCallTemplate: CallTemplate): Promise<any>;
|
|
74
|
+
/**
|
|
75
|
+
* Executes a tool call through this transport streamingly.
|
|
76
|
+
* For standard HTTP, this typically means fetching the full response and yielding it as a single chunk.
|
|
77
|
+
* Real streaming for protocols like SSE or HTTP chunked transfer would be in their specific implementations.
|
|
78
|
+
*
|
|
79
|
+
* @param caller The UTCP client instance.
|
|
80
|
+
* @param toolName Name of the tool to call.
|
|
81
|
+
* @param toolArgs Dictionary of arguments to pass to the tool.
|
|
82
|
+
* @param toolCallTemplate The HTTP call template for the tool.
|
|
83
|
+
* @returns An async generator that yields chunks of the tool's response.
|
|
84
|
+
*/
|
|
85
|
+
callToolStreaming(caller: IUtcpClient, toolName: string, toolArgs: Record<string, any>, toolCallTemplate: CallTemplate): AsyncGenerator<any, void, unknown>;
|
|
86
|
+
/**
|
|
87
|
+
* Closes any persistent connections or resources held by the communication protocol.
|
|
88
|
+
* For stateless HTTP, this clears OAuth tokens.
|
|
89
|
+
*/
|
|
90
|
+
close(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Applies authentication details from the HttpCallTemplate to the Axios request configuration.
|
|
93
|
+
* This modifies `requestConfig.headers`, `requestConfig.params`, `requestConfig.auth`, and returns cookies.
|
|
94
|
+
*
|
|
95
|
+
* @param httpCallTemplate The CallTemplate containing authentication details.
|
|
96
|
+
* @param requestConfig The Axios request configuration to modify.
|
|
97
|
+
* @returns A Promise that resolves to an object containing any cookies to be set.
|
|
98
|
+
*/
|
|
99
|
+
private _applyAuthToRequestConfig;
|
|
100
|
+
/**
|
|
101
|
+
* Handles OAuth2 client credentials flow, trying both body and auth header methods.
|
|
102
|
+
* Caches tokens and automatically refreshes if expired.
|
|
103
|
+
*
|
|
104
|
+
* @param authDetails The OAuth2 authentication details.
|
|
105
|
+
* @returns The access token.
|
|
106
|
+
* @throws Error if token cannot be fetched.
|
|
107
|
+
*/
|
|
108
|
+
private _handleOAuth2;
|
|
109
|
+
/**
|
|
110
|
+
* Builds a URL by substituting path parameters from the provided arguments.
|
|
111
|
+
* Used arguments are removed from the `args` object.
|
|
112
|
+
*
|
|
113
|
+
* @param urlTemplate The URL template with path parameters in `{param_name}` format.
|
|
114
|
+
* @param args The dictionary of arguments; modified to remove path parameters.
|
|
115
|
+
* @returns The URL with path parameters substituted.
|
|
116
|
+
* @throws Error if a required path parameter is missing.
|
|
117
|
+
*/
|
|
118
|
+
private _buildUrlWithPathParams;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* REQUIRED
|
|
123
|
+
* Provider configuration for HTTP streaming tools.
|
|
124
|
+
*
|
|
125
|
+
* Uses HTTP Chunked Transfer Encoding to enable streaming of large responses
|
|
126
|
+
* or real-time data. Useful for tools that return large datasets or provide
|
|
127
|
+
* progressive results. All tool arguments not mapped to URL body, headers
|
|
128
|
+
* or query pattern parameters are passed as query parameters using '?arg_name={arg_value}'.
|
|
129
|
+
*
|
|
130
|
+
* Attributes:
|
|
131
|
+
* call_template_type: Always "streamable_http" for HTTP streaming providers.
|
|
132
|
+
* url: The streaming HTTP endpoint URL. Supports path parameters.
|
|
133
|
+
* http_method: The HTTP method to use (GET or POST).
|
|
134
|
+
* content_type: The Content-Type header for requests.
|
|
135
|
+
* chunk_size: Size of each chunk in bytes for reading the stream.
|
|
136
|
+
* timeout: Request timeout in milliseconds.
|
|
137
|
+
* headers: Optional static headers to include in requests.
|
|
138
|
+
* auth: Optional authentication configuration.
|
|
139
|
+
* body_field: Optional tool argument name to map to HTTP request body.
|
|
140
|
+
* header_fields: List of tool argument names to map to HTTP request headers.
|
|
141
|
+
*/
|
|
142
|
+
interface StreamableHttpCallTemplate extends CallTemplate {
|
|
143
|
+
call_template_type: 'streamable_http';
|
|
144
|
+
url: string;
|
|
145
|
+
http_method: 'GET' | 'POST';
|
|
146
|
+
content_type: string;
|
|
147
|
+
chunk_size: number;
|
|
148
|
+
timeout: number;
|
|
149
|
+
headers?: Record<string, string>;
|
|
150
|
+
body_field?: string | null;
|
|
151
|
+
header_fields?: string[] | null;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Streamable HTTP Call Template schema.
|
|
155
|
+
*/
|
|
156
|
+
declare const StreamableHttpCallTemplateSchema: z.ZodType<StreamableHttpCallTemplate>;
|
|
157
|
+
/**
|
|
158
|
+
* REQUIRED
|
|
159
|
+
* Serializer for StreamableHttpCallTemplate.
|
|
160
|
+
*/
|
|
161
|
+
declare class StreamableHttpCallTemplateSerializer extends Serializer<StreamableHttpCallTemplate> {
|
|
162
|
+
/**
|
|
163
|
+
* REQUIRED
|
|
164
|
+
* Convert StreamableHttpCallTemplate to dictionary.
|
|
165
|
+
*/
|
|
166
|
+
toDict(obj: StreamableHttpCallTemplate): Record<string, unknown>;
|
|
167
|
+
/**
|
|
168
|
+
* REQUIRED
|
|
169
|
+
* Validate dictionary and convert to StreamableHttpCallTemplate.
|
|
170
|
+
*/
|
|
171
|
+
validateDict(obj: Record<string, unknown>): StreamableHttpCallTemplate;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Streamable HTTP Communication Protocol for UTCP.
|
|
176
|
+
*
|
|
177
|
+
* Handles HTTP streaming with chunked transfer encoding for real-time data.
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* REQUIRED
|
|
182
|
+
* Streamable HTTP communication protocol implementation for UTCP client.
|
|
183
|
+
*
|
|
184
|
+
* Handles HTTP streaming with chunked transfer encoding for real-time data.
|
|
185
|
+
*/
|
|
186
|
+
declare class StreamableHttpCommunicationProtocol implements CommunicationProtocol {
|
|
187
|
+
private oauthTokens;
|
|
188
|
+
private _logInfo;
|
|
189
|
+
private _logError;
|
|
190
|
+
private _applyAuth;
|
|
191
|
+
/**
|
|
192
|
+
* REQUIRED
|
|
193
|
+
* Register a manual and its tools from a StreamableHttp provider.
|
|
194
|
+
*/
|
|
195
|
+
registerManual(caller: IUtcpClient, manualCallTemplate: CallTemplate): Promise<RegisterManualResult>;
|
|
196
|
+
/**
|
|
197
|
+
* REQUIRED
|
|
198
|
+
* Deregister a manual (no-op for HTTP streaming).
|
|
199
|
+
*/
|
|
200
|
+
deregisterManual(caller: IUtcpClient, manualCallTemplate: CallTemplate): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* REQUIRED
|
|
203
|
+
* Call a tool using HTTP (non-streaming).
|
|
204
|
+
*/
|
|
205
|
+
callTool(caller: IUtcpClient, toolName: string, toolArgs: Record<string, any>, toolCallTemplate: CallTemplate): Promise<any>;
|
|
206
|
+
/**
|
|
207
|
+
* REQUIRED
|
|
208
|
+
* Call a tool using HTTP streaming.
|
|
209
|
+
* Returns an async generator that yields chunks of data.
|
|
210
|
+
*/
|
|
211
|
+
callToolStreaming(caller: IUtcpClient, toolName: string, toolArgs: Record<string, any>, toolCallTemplate: CallTemplate): AsyncGenerator<any, void, unknown>;
|
|
212
|
+
/**
|
|
213
|
+
* REQUIRED
|
|
214
|
+
* Close all active connections and clear internal state.
|
|
215
|
+
*/
|
|
216
|
+
close(): Promise<void>;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* REQUIRED
|
|
221
|
+
* Provider configuration for Server-Sent Events (SSE) tools.
|
|
222
|
+
*
|
|
223
|
+
* Enables real-time streaming of events from server to client using the
|
|
224
|
+
* Server-Sent Events protocol. Supports automatic reconnection and
|
|
225
|
+
* event type filtering. All tool arguments not mapped to URL body, headers
|
|
226
|
+
* or query pattern parameters are passed as query parameters using '?arg_name={arg_value}'.
|
|
227
|
+
*
|
|
228
|
+
* Attributes:
|
|
229
|
+
* call_template_type: Always "sse" for SSE providers.
|
|
230
|
+
* url: The SSE endpoint URL to connect to.
|
|
231
|
+
* event_type: Optional filter for specific event types. If None, all events are received.
|
|
232
|
+
* reconnect: Whether to automatically reconnect on connection loss.
|
|
233
|
+
* retry_timeout: Timeout in milliseconds before attempting reconnection.
|
|
234
|
+
* auth: Optional authentication configuration.
|
|
235
|
+
* headers: Optional static headers for the initial connection.
|
|
236
|
+
* body_field: Optional tool argument name to map to request body during connection.
|
|
237
|
+
* header_fields: List of tool argument names to map to HTTP headers during connection.
|
|
238
|
+
*/
|
|
239
|
+
interface SseCallTemplate extends CallTemplate {
|
|
240
|
+
call_template_type: 'sse';
|
|
241
|
+
url: string;
|
|
242
|
+
event_type?: string | null;
|
|
243
|
+
reconnect: boolean;
|
|
244
|
+
retry_timeout: number;
|
|
245
|
+
headers?: Record<string, string>;
|
|
246
|
+
body_field?: string | null;
|
|
247
|
+
header_fields?: string[] | null;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* SSE Call Template schema.
|
|
251
|
+
*/
|
|
252
|
+
declare const SseCallTemplateSchema: z.ZodType<SseCallTemplate>;
|
|
253
|
+
/**
|
|
254
|
+
* REQUIRED
|
|
255
|
+
* Serializer for SseCallTemplate.
|
|
256
|
+
*/
|
|
257
|
+
declare class SseCallTemplateSerializer extends Serializer<SseCallTemplate> {
|
|
258
|
+
/**
|
|
259
|
+
* REQUIRED
|
|
260
|
+
* Convert SseCallTemplate to dictionary.
|
|
261
|
+
*/
|
|
262
|
+
toDict(obj: SseCallTemplate): Record<string, unknown>;
|
|
263
|
+
/**
|
|
264
|
+
* REQUIRED
|
|
265
|
+
* Validate dictionary and convert to SseCallTemplate.
|
|
266
|
+
*/
|
|
267
|
+
validateDict(obj: Record<string, unknown>): SseCallTemplate;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Server-Sent Events (SSE) Communication Protocol for UTCP.
|
|
272
|
+
*
|
|
273
|
+
* Handles Server-Sent Events based tool providers with streaming capabilities.
|
|
274
|
+
*/
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* REQUIRED
|
|
278
|
+
* SSE communication protocol implementation for UTCP client.
|
|
279
|
+
*
|
|
280
|
+
* Handles Server-Sent Events based tool providers with streaming capabilities.
|
|
281
|
+
*/
|
|
282
|
+
declare class SseCommunicationProtocol implements CommunicationProtocol {
|
|
283
|
+
private oauthTokens;
|
|
284
|
+
private _logInfo;
|
|
285
|
+
private _logError;
|
|
286
|
+
private _applyAuth;
|
|
287
|
+
/**
|
|
288
|
+
* REQUIRED
|
|
289
|
+
* Register a manual and its tools from an SSE provider.
|
|
290
|
+
*/
|
|
291
|
+
registerManual(caller: IUtcpClient, manualCallTemplate: CallTemplate): Promise<RegisterManualResult>;
|
|
292
|
+
/**
|
|
293
|
+
* REQUIRED
|
|
294
|
+
* Deregister a manual (no-op for SSE).
|
|
295
|
+
*/
|
|
296
|
+
deregisterManual(caller: IUtcpClient, manualCallTemplate: CallTemplate): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* REQUIRED
|
|
299
|
+
* Call a tool using SSE (non-streaming).
|
|
300
|
+
*/
|
|
301
|
+
callTool(caller: IUtcpClient, toolName: string, toolArgs: Record<string, any>, toolCallTemplate: CallTemplate): Promise<any>;
|
|
302
|
+
/**
|
|
303
|
+
* REQUIRED
|
|
304
|
+
* Call a tool using SSE streaming.
|
|
305
|
+
* Returns an async generator that yields SSE events.
|
|
306
|
+
*/
|
|
307
|
+
callToolStreaming(caller: IUtcpClient, toolName: string, toolArgs: Record<string, any>, toolCallTemplate: CallTemplate): AsyncGenerator<any, void, unknown>;
|
|
308
|
+
/**
|
|
309
|
+
* REQUIRED
|
|
310
|
+
* Close all active connections and clear internal state.
|
|
311
|
+
*/
|
|
312
|
+
close(): Promise<void>;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
interface OpenApiConverterOptions {
|
|
316
|
+
specUrl?: string;
|
|
317
|
+
callTemplateName?: string;
|
|
318
|
+
authTools?: Auth;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* REQUIRED
|
|
322
|
+
* Converts OpenAPI specifications into UTCP tool definitions.
|
|
323
|
+
*
|
|
324
|
+
* Processes OpenAPI 2.0 and 3.0 specifications to generate equivalent UTCP
|
|
325
|
+
* tools, handling schema resolution, authentication mapping, and proper
|
|
326
|
+
* HTTP call_template configuration. Each operation in the OpenAPI spec becomes
|
|
327
|
+
* a UTCP tool with appropriate input/output schemas.
|
|
328
|
+
*/
|
|
329
|
+
declare class OpenApiConverter {
|
|
330
|
+
private spec;
|
|
331
|
+
private spec_url;
|
|
332
|
+
private auth_tools;
|
|
333
|
+
private placeholder_counter;
|
|
334
|
+
private call_template_name;
|
|
335
|
+
/**
|
|
336
|
+
* Initializes the OpenAPI converter.
|
|
337
|
+
*
|
|
338
|
+
* @param openapi_spec Parsed OpenAPI specification as a dictionary.
|
|
339
|
+
* @param options Optional settings including spec_url, call_template_name, and auth_tools.
|
|
340
|
+
* - specUrl: URL where the specification was retrieved from.
|
|
341
|
+
* - callTemplateName: Custom name for the call_template if spec title not provided.
|
|
342
|
+
* - authTools: Optional auth configuration for generated tools.
|
|
343
|
+
*/
|
|
344
|
+
constructor(openapi_spec: Record<string, any>, options?: OpenApiConverterOptions);
|
|
345
|
+
private _generateUuid;
|
|
346
|
+
private _incrementPlaceholderCounter;
|
|
347
|
+
private _getPlaceholder;
|
|
348
|
+
/**
|
|
349
|
+
* Parses the OpenAPI specification and returns a UtcpManual.
|
|
350
|
+
* @returns A UTCP manual containing tools derived from the OpenAPI specification.
|
|
351
|
+
*/
|
|
352
|
+
/**
|
|
353
|
+
* REQUIRED
|
|
354
|
+
* Converts the loaded OpenAPI specification into a UtcpManual.
|
|
355
|
+
*/
|
|
356
|
+
convert(): UtcpManual;
|
|
357
|
+
/**
|
|
358
|
+
* Resolves a local JSON reference within the OpenAPI spec.
|
|
359
|
+
* @param ref The reference string (e.g., '#/components/schemas/Pet').
|
|
360
|
+
* @returns The resolved schema object.
|
|
361
|
+
*/
|
|
362
|
+
private _resolveRef;
|
|
363
|
+
/**
|
|
364
|
+
* Recursively resolves all $refs in a schema object, preventing infinite loops.
|
|
365
|
+
* @param schema The schema object that may contain references.
|
|
366
|
+
* @param visitedRefs A set of references already visited to detect cycles.
|
|
367
|
+
* @returns The resolved schema with all references replaced by their actual values.
|
|
368
|
+
*/
|
|
369
|
+
private _resolveSchema;
|
|
370
|
+
/**
|
|
371
|
+
* Creates a Tool object from an OpenAPI operation.
|
|
372
|
+
* @param path The API path.
|
|
373
|
+
* @param method The HTTP method (GET, POST, etc.).
|
|
374
|
+
* @param operation The operation definition from OpenAPI.
|
|
375
|
+
* @param baseUrl The base URL for the API.
|
|
376
|
+
* @returns A Tool object or null if operationId is not defined.
|
|
377
|
+
*/
|
|
378
|
+
private _createTool;
|
|
379
|
+
/**
|
|
380
|
+
* Extracts the input schema, header fields, and body field from an OpenAPI operation.
|
|
381
|
+
* - Merges path-level and operation-level parameters.
|
|
382
|
+
* - Resolves $ref for parameters.
|
|
383
|
+
* - Supports OpenAPI 2.0 body parameters and 3.0 requestBody.
|
|
384
|
+
* @param path The API path.
|
|
385
|
+
* @param operation The OpenAPI operation object.
|
|
386
|
+
* @returns An object containing the inputs schema, a list of header field names, and the body field name (if any).
|
|
387
|
+
*/
|
|
388
|
+
private _extractInputs;
|
|
389
|
+
/**
|
|
390
|
+
* Extracts the output schema from an OpenAPI operation, resolving refs.
|
|
391
|
+
* @param operation The OpenAPI operation object.
|
|
392
|
+
* @returns The output schema.
|
|
393
|
+
*/
|
|
394
|
+
private _extractOutputs;
|
|
395
|
+
/**
|
|
396
|
+
* Extracts authentication information from OpenAPI operation and global security schemes.
|
|
397
|
+
* Uses auth_tools configuration when compatible with OpenAPI auth requirements.
|
|
398
|
+
* Supports both OpenAPI 2.0 and 3.0 security schemes.
|
|
399
|
+
* @param operation The OpenAPI operation object.
|
|
400
|
+
* @returns An Auth object or undefined if no authentication is specified.
|
|
401
|
+
*/
|
|
402
|
+
private _extractAuth;
|
|
403
|
+
/**
|
|
404
|
+
* Checks if auth_tools configuration is compatible with OpenAPI auth requirements.
|
|
405
|
+
*
|
|
406
|
+
* @param openapiAuth Auth generated from OpenAPI security scheme
|
|
407
|
+
* @param authTools Auth configuration from manual call template
|
|
408
|
+
* @returns True if compatible and auth_tools should be used, False otherwise
|
|
409
|
+
*/
|
|
410
|
+
private _isAuthCompatible;
|
|
411
|
+
/**
|
|
412
|
+
* Gets security schemes supporting both OpenAPI 2.0 and 3.0.
|
|
413
|
+
* @returns A record of security schemes.
|
|
414
|
+
*/
|
|
415
|
+
private _getSecuritySchemes;
|
|
416
|
+
/**
|
|
417
|
+
* Creates an Auth object from an OpenAPI security scheme.
|
|
418
|
+
* @param scheme The security scheme object.
|
|
419
|
+
* @param schemeName The name of the security scheme.
|
|
420
|
+
* @returns An Auth object or undefined if the scheme is not supported.
|
|
421
|
+
*/
|
|
422
|
+
private _createAuthFromScheme;
|
|
423
|
+
}
|
|
424
|
+
declare global {
|
|
425
|
+
interface String {
|
|
426
|
+
lstrip(chars: string): string;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
1
430
|
/**
|
|
2
431
|
* Registers all HTTP-based protocol CallTemplate serializers
|
|
3
432
|
* and their CommunicationProtocol implementations.
|
|
4
433
|
* This function is called automatically when the package is imported.
|
|
5
434
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export * from './streamable_http_call_template';
|
|
10
|
-
export * from './streamable_http_communication_protocol';
|
|
11
|
-
export * from './sse_call_template';
|
|
12
|
-
export * from './sse_communication_protocol';
|
|
13
|
-
export * from './openapi_converter';
|
|
435
|
+
declare function register(override?: boolean): void;
|
|
436
|
+
|
|
437
|
+
export { type HttpCallTemplate, HttpCallTemplateSchema, HttpCallTemplateSerializer, HttpCommunicationProtocol, OpenApiConverter, type SseCallTemplate, SseCallTemplateSchema, SseCallTemplateSerializer, SseCommunicationProtocol, type StreamableHttpCallTemplate, StreamableHttpCallTemplateSchema, StreamableHttpCallTemplateSerializer, StreamableHttpCommunicationProtocol, register };
|