@utcp/http 1.0.13 → 1.1.1
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 +21 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +21 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -18,6 +18,7 @@ interface HttpCallTemplate extends CallTemplate {
|
|
|
18
18
|
body_field?: string;
|
|
19
19
|
header_fields?: string[];
|
|
20
20
|
auth_tools?: Auth | null;
|
|
21
|
+
allowed_communication_protocols?: string[];
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* HTTP Call Template schema for RESTful HTTP/HTTPS API tools.
|
|
@@ -149,6 +150,7 @@ interface StreamableHttpCallTemplate extends CallTemplate {
|
|
|
149
150
|
headers?: Record<string, string>;
|
|
150
151
|
body_field?: string | null;
|
|
151
152
|
header_fields?: string[] | null;
|
|
153
|
+
allowed_communication_protocols?: string[];
|
|
152
154
|
}
|
|
153
155
|
/**
|
|
154
156
|
* Streamable HTTP Call Template schema.
|
|
@@ -245,6 +247,7 @@ interface SseCallTemplate extends CallTemplate {
|
|
|
245
247
|
headers?: Record<string, string>;
|
|
246
248
|
body_field?: string | null;
|
|
247
249
|
header_fields?: string[] | null;
|
|
250
|
+
allowed_communication_protocols?: string[];
|
|
248
251
|
}
|
|
249
252
|
/**
|
|
250
253
|
* SSE Call Template schema.
|
|
@@ -318,8 +321,19 @@ declare class SseCommunicationProtocol implements CommunicationProtocol {
|
|
|
318
321
|
interface OpenApiConverterOptions {
|
|
319
322
|
specUrl?: string;
|
|
320
323
|
callTemplateName?: string;
|
|
321
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Authentication configuration for generated tools.
|
|
326
|
+
* - undefined: Auto-generate placeholder auth from OpenAPI security schemes
|
|
327
|
+
* - null: Explicitly disable auth for all generated tools
|
|
328
|
+
* - Auth object: Use the provided auth configuration
|
|
329
|
+
*/
|
|
330
|
+
authTools?: Auth | null;
|
|
322
331
|
baseUrl?: string;
|
|
332
|
+
/**
|
|
333
|
+
* Static headers to include in all generated tool call templates.
|
|
334
|
+
* These headers will be sent with every tool request.
|
|
335
|
+
*/
|
|
336
|
+
headers?: Record<string, string>;
|
|
323
337
|
}
|
|
324
338
|
/**
|
|
325
339
|
* REQUIRED
|
|
@@ -335,6 +349,7 @@ declare class OpenApiConverter {
|
|
|
335
349
|
private spec_url;
|
|
336
350
|
private base_url;
|
|
337
351
|
private auth_tools;
|
|
352
|
+
private headers;
|
|
338
353
|
private placeholder_counter;
|
|
339
354
|
private call_template_name;
|
|
340
355
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ interface HttpCallTemplate extends CallTemplate {
|
|
|
18
18
|
body_field?: string;
|
|
19
19
|
header_fields?: string[];
|
|
20
20
|
auth_tools?: Auth | null;
|
|
21
|
+
allowed_communication_protocols?: string[];
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* HTTP Call Template schema for RESTful HTTP/HTTPS API tools.
|
|
@@ -149,6 +150,7 @@ interface StreamableHttpCallTemplate extends CallTemplate {
|
|
|
149
150
|
headers?: Record<string, string>;
|
|
150
151
|
body_field?: string | null;
|
|
151
152
|
header_fields?: string[] | null;
|
|
153
|
+
allowed_communication_protocols?: string[];
|
|
152
154
|
}
|
|
153
155
|
/**
|
|
154
156
|
* Streamable HTTP Call Template schema.
|
|
@@ -245,6 +247,7 @@ interface SseCallTemplate extends CallTemplate {
|
|
|
245
247
|
headers?: Record<string, string>;
|
|
246
248
|
body_field?: string | null;
|
|
247
249
|
header_fields?: string[] | null;
|
|
250
|
+
allowed_communication_protocols?: string[];
|
|
248
251
|
}
|
|
249
252
|
/**
|
|
250
253
|
* SSE Call Template schema.
|
|
@@ -318,8 +321,19 @@ declare class SseCommunicationProtocol implements CommunicationProtocol {
|
|
|
318
321
|
interface OpenApiConverterOptions {
|
|
319
322
|
specUrl?: string;
|
|
320
323
|
callTemplateName?: string;
|
|
321
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Authentication configuration for generated tools.
|
|
326
|
+
* - undefined: Auto-generate placeholder auth from OpenAPI security schemes
|
|
327
|
+
* - null: Explicitly disable auth for all generated tools
|
|
328
|
+
* - Auth object: Use the provided auth configuration
|
|
329
|
+
*/
|
|
330
|
+
authTools?: Auth | null;
|
|
322
331
|
baseUrl?: string;
|
|
332
|
+
/**
|
|
333
|
+
* Static headers to include in all generated tool call templates.
|
|
334
|
+
* These headers will be sent with every tool request.
|
|
335
|
+
*/
|
|
336
|
+
headers?: Record<string, string>;
|
|
323
337
|
}
|
|
324
338
|
/**
|
|
325
339
|
* REQUIRED
|
|
@@ -335,6 +349,7 @@ declare class OpenApiConverter {
|
|
|
335
349
|
private spec_url;
|
|
336
350
|
private base_url;
|
|
337
351
|
private auth_tools;
|
|
352
|
+
private headers;
|
|
338
353
|
private placeholder_counter;
|
|
339
354
|
private call_template_name;
|
|
340
355
|
/**
|
package/dist/index.js
CHANGED
|
@@ -4067,7 +4067,8 @@ var HttpCallTemplateSchema = external_exports.object({
|
|
|
4067
4067
|
return new AuthSerializer().validateDict(val);
|
|
4068
4068
|
}
|
|
4069
4069
|
return val;
|
|
4070
|
-
}).describe("Authentication configuration for generated tools")
|
|
4070
|
+
}).describe("Authentication configuration for generated tools"),
|
|
4071
|
+
allowed_communication_protocols: external_exports.array(external_exports.string()).optional().describe("Optional list of allowed communication protocol types for tools within this manual.")
|
|
4071
4072
|
});
|
|
4072
4073
|
var HttpCallTemplateSerializer = class extends Serializer {
|
|
4073
4074
|
toDict(obj) {
|
|
@@ -4081,7 +4082,8 @@ var HttpCallTemplateSerializer = class extends Serializer {
|
|
|
4081
4082
|
auth_tools: obj.auth_tools ? new AuthSerializer().toDict(obj.auth_tools) : null,
|
|
4082
4083
|
headers: obj.headers,
|
|
4083
4084
|
body_field: obj.body_field,
|
|
4084
|
-
header_fields: obj.header_fields
|
|
4085
|
+
header_fields: obj.header_fields,
|
|
4086
|
+
allowed_communication_protocols: obj.allowed_communication_protocols
|
|
4085
4087
|
};
|
|
4086
4088
|
}
|
|
4087
4089
|
validateDict(obj) {
|
|
@@ -4108,7 +4110,8 @@ var StreamableHttpCallTemplateSchema = external_exports.object({
|
|
|
4108
4110
|
auth: AuthSchema2.optional().describe("Optional authentication configuration."),
|
|
4109
4111
|
headers: external_exports.record(external_exports.string(), external_exports.string()).optional().describe("Optional static headers to include in requests."),
|
|
4110
4112
|
body_field: external_exports.string().nullable().optional().describe("The name of the single input field to be sent as the request body."),
|
|
4111
|
-
header_fields: external_exports.array(external_exports.string()).nullable().optional().describe("List of input fields to be sent as request headers.")
|
|
4113
|
+
header_fields: external_exports.array(external_exports.string()).nullable().optional().describe("List of input fields to be sent as request headers."),
|
|
4114
|
+
allowed_communication_protocols: external_exports.array(external_exports.string()).optional().describe("Optional list of allowed communication protocol types for tools within this manual.")
|
|
4112
4115
|
});
|
|
4113
4116
|
var StreamableHttpCallTemplateSerializer = class extends Serializer2 {
|
|
4114
4117
|
/**
|
|
@@ -4127,7 +4130,8 @@ var StreamableHttpCallTemplateSerializer = class extends Serializer2 {
|
|
|
4127
4130
|
auth: obj.auth,
|
|
4128
4131
|
headers: obj.headers,
|
|
4129
4132
|
body_field: obj.body_field,
|
|
4130
|
-
header_fields: obj.header_fields
|
|
4133
|
+
header_fields: obj.header_fields,
|
|
4134
|
+
allowed_communication_protocols: obj.allowed_communication_protocols
|
|
4131
4135
|
};
|
|
4132
4136
|
}
|
|
4133
4137
|
/**
|
|
@@ -4157,7 +4161,8 @@ var SseCallTemplateSchema = external_exports.object({
|
|
|
4157
4161
|
auth: AuthSchema3.optional().describe("Optional authentication configuration."),
|
|
4158
4162
|
headers: external_exports.record(external_exports.string(), external_exports.string()).optional().describe("Optional static headers for the initial connection."),
|
|
4159
4163
|
body_field: external_exports.string().nullable().optional().describe("The name of the single input field to be sent as the request body."),
|
|
4160
|
-
header_fields: external_exports.array(external_exports.string()).nullable().optional().describe("List of input fields to be sent as request headers for the initial connection.")
|
|
4164
|
+
header_fields: external_exports.array(external_exports.string()).nullable().optional().describe("List of input fields to be sent as request headers for the initial connection."),
|
|
4165
|
+
allowed_communication_protocols: external_exports.array(external_exports.string()).optional().describe("Optional list of allowed communication protocol types for tools within this manual.")
|
|
4161
4166
|
});
|
|
4162
4167
|
var SseCallTemplateSerializer = class extends Serializer3 {
|
|
4163
4168
|
/**
|
|
@@ -4175,7 +4180,8 @@ var SseCallTemplateSerializer = class extends Serializer3 {
|
|
|
4175
4180
|
auth: obj.auth,
|
|
4176
4181
|
headers: obj.headers,
|
|
4177
4182
|
body_field: obj.body_field,
|
|
4178
|
-
header_fields: obj.header_fields
|
|
4183
|
+
header_fields: obj.header_fields,
|
|
4184
|
+
allowed_communication_protocols: obj.allowed_communication_protocols
|
|
4179
4185
|
};
|
|
4180
4186
|
}
|
|
4181
4187
|
/**
|
|
@@ -4205,6 +4211,7 @@ var OpenApiConverter = class {
|
|
|
4205
4211
|
spec_url;
|
|
4206
4212
|
base_url;
|
|
4207
4213
|
auth_tools;
|
|
4214
|
+
headers;
|
|
4208
4215
|
placeholder_counter = 0;
|
|
4209
4216
|
call_template_name;
|
|
4210
4217
|
/**
|
|
@@ -4222,6 +4229,7 @@ var OpenApiConverter = class {
|
|
|
4222
4229
|
this.spec_url = options?.specUrl;
|
|
4223
4230
|
this.base_url = options?.baseUrl;
|
|
4224
4231
|
this.auth_tools = options?.authTools;
|
|
4232
|
+
this.headers = options?.headers;
|
|
4225
4233
|
this.placeholder_counter = 0;
|
|
4226
4234
|
let callTemplateName = options?.callTemplateName;
|
|
4227
4235
|
if (!callTemplateName) {
|
|
@@ -4360,6 +4368,7 @@ var OpenApiConverter = class {
|
|
|
4360
4368
|
url: fullUrl,
|
|
4361
4369
|
body_field: bodyField ?? void 0,
|
|
4362
4370
|
header_fields: headerFields.length > 0 ? headerFields : void 0,
|
|
4371
|
+
headers: this.headers,
|
|
4363
4372
|
auth,
|
|
4364
4373
|
content_type: "application/json",
|
|
4365
4374
|
timeout: 30
|
|
@@ -4494,6 +4503,9 @@ var OpenApiConverter = class {
|
|
|
4494
4503
|
* @returns An Auth object or undefined if no authentication is specified.
|
|
4495
4504
|
*/
|
|
4496
4505
|
_extractAuth(operation) {
|
|
4506
|
+
if (this.auth_tools === null) {
|
|
4507
|
+
return void 0;
|
|
4508
|
+
}
|
|
4497
4509
|
let securityRequirements = operation.security || [];
|
|
4498
4510
|
if (!securityRequirements.length) {
|
|
4499
4511
|
securityRequirements = this.spec.security || [];
|
|
@@ -4707,7 +4719,9 @@ var HttpCommunicationProtocol = class {
|
|
|
4707
4719
|
this._logInfo(`Assuming OpenAPI spec from '${httpCallTemplate.name}'. Converting to UTCP manual.`);
|
|
4708
4720
|
const converter = new OpenApiConverter(responseData, {
|
|
4709
4721
|
specUrl: httpCallTemplate.url,
|
|
4710
|
-
callTemplateName: httpCallTemplate.name
|
|
4722
|
+
callTemplateName: httpCallTemplate.name,
|
|
4723
|
+
authTools: httpCallTemplate.auth_tools,
|
|
4724
|
+
headers: httpCallTemplate.headers
|
|
4711
4725
|
});
|
|
4712
4726
|
utcpManual = converter.convert();
|
|
4713
4727
|
} else {
|