@ideascol/agents-generator-sdk 0.0.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/README.md +44 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +1077 -0
- package/dist/cli.d.ts +3 -0
- package/dist/commands/agentsCommand.d.ts +3 -0
- package/dist/commands/rootCommand.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1081 -0
- package/dist/lib/clients/agents-generator/core/ApiError.d.ts +10 -0
- package/dist/lib/clients/agents-generator/core/ApiRequestOptions.d.ts +13 -0
- package/dist/lib/clients/agents-generator/core/ApiResult.d.ts +7 -0
- package/dist/lib/clients/agents-generator/core/CancelablePromise.d.ts +20 -0
- package/dist/lib/clients/agents-generator/core/OpenAPI.d.ts +16 -0
- package/dist/lib/clients/agents-generator/core/request.d.ts +30 -0
- package/dist/lib/clients/agents-generator/index.d.ts +29 -0
- package/dist/lib/clients/agents-generator/models/AgentInitResponse.d.ts +7 -0
- package/dist/lib/clients/agents-generator/models/AgentQueryRequest.d.ts +4 -0
- package/dist/lib/clients/agents-generator/models/AgentQueryResponse.d.ts +6 -0
- package/dist/lib/clients/agents-generator/models/AgentRequest.d.ts +15 -0
- package/dist/lib/clients/agents-generator/models/ConversationCreate.d.ts +4 -0
- package/dist/lib/clients/agents-generator/models/ConversationResponse.d.ts +10 -0
- package/dist/lib/clients/agents-generator/models/ConversationUpdate.d.ts +3 -0
- package/dist/lib/clients/agents-generator/models/Edge.d.ts +10 -0
- package/dist/lib/clients/agents-generator/models/HTTPValidationError.d.ts +4 -0
- package/dist/lib/clients/agents-generator/models/Handoff.d.ts +4 -0
- package/dist/lib/clients/agents-generator/models/MCPServer.d.ts +13 -0
- package/dist/lib/clients/agents-generator/models/MCPServerList.d.ts +7 -0
- package/dist/lib/clients/agents-generator/models/MCPServerReference.d.ts +11 -0
- package/dist/lib/clients/agents-generator/models/MarkerEnd.d.ts +4 -0
- package/dist/lib/clients/agents-generator/models/Measured.d.ts +4 -0
- package/dist/lib/clients/agents-generator/models/MessageCreate.d.ts +5 -0
- package/dist/lib/clients/agents-generator/models/MessageResponse.d.ts +7 -0
- package/dist/lib/clients/agents-generator/models/Node.d.ts +12 -0
- package/dist/lib/clients/agents-generator/models/NodeData.d.ts +11 -0
- package/dist/lib/clients/agents-generator/models/Position.d.ts +4 -0
- package/dist/lib/clients/agents-generator/models/ValidationError.d.ts +5 -0
- package/dist/lib/clients/agents-generator/services/AgentService.d.ts +75 -0
- package/dist/lib/clients/agents-generator/services/ConversationsService.d.ts +53 -0
- package/dist/lib/clients/agents-generator/services/McpServersService.d.ts +21 -0
- package/dist/lib/clients/agents-generator/services/RootService.d.ts +15 -0
- package/dist/lib/index.d.ts +1 -0
- package/package.json +37 -0
package/dist/bin/cli.js
ADDED
|
@@ -0,0 +1,1077 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
9
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
|
+
for (let key of __getOwnPropNames(mod))
|
|
12
|
+
if (!__hasOwnProp.call(to, key))
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: () => mod[key],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
20
|
+
var __toCommonJS = (from) => {
|
|
21
|
+
var entry = __moduleCache.get(from), desc;
|
|
22
|
+
if (entry)
|
|
23
|
+
return entry;
|
|
24
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function")
|
|
26
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
27
|
+
get: () => from[key],
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
}));
|
|
30
|
+
__moduleCache.set(from, entry);
|
|
31
|
+
return entry;
|
|
32
|
+
};
|
|
33
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
+
var __export = (target, all) => {
|
|
35
|
+
for (var name in all)
|
|
36
|
+
__defProp(target, name, {
|
|
37
|
+
get: all[name],
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
set: (newValue) => all[name] = () => newValue
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
44
|
+
|
|
45
|
+
// node_modules/@ideascol/cli-maker/dist/colors.js
|
|
46
|
+
var require_colors = __commonJS((exports2) => {
|
|
47
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
48
|
+
exports2.Colors = undefined;
|
|
49
|
+
exports2.Colors = {
|
|
50
|
+
Reset: "\x1B[0m",
|
|
51
|
+
Bright: "\x1B[1m",
|
|
52
|
+
Dim: "\x1B[2m",
|
|
53
|
+
Underscore: "\x1B[4m",
|
|
54
|
+
Blink: "\x1B[5m",
|
|
55
|
+
Reverse: "\x1B[7m",
|
|
56
|
+
Hidden: "\x1B[8m",
|
|
57
|
+
FgBlack: "\x1B[30m",
|
|
58
|
+
FgRed: "\x1B[31m",
|
|
59
|
+
FgGreen: "\x1B[32m",
|
|
60
|
+
FgYellow: "\x1B[33m",
|
|
61
|
+
FgBlue: "\x1B[34m",
|
|
62
|
+
FgMagenta: "\x1B[35m",
|
|
63
|
+
FgCyan: "\x1B[36m",
|
|
64
|
+
FgWhite: "\x1B[37m",
|
|
65
|
+
FgGray: "\x1B[90m",
|
|
66
|
+
BgBlack: "\x1B[40m",
|
|
67
|
+
BgRed: "\x1B[41m",
|
|
68
|
+
BgGreen: "\x1B[42m",
|
|
69
|
+
BgYellow: "\x1B[43m",
|
|
70
|
+
BgBlue: "\x1B[44m",
|
|
71
|
+
BgMagenta: "\x1B[45m",
|
|
72
|
+
BgCyan: "\x1B[46m",
|
|
73
|
+
BgWhite: "\x1B[47m"
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// node_modules/@ideascol/cli-maker/dist/interfaces.js
|
|
78
|
+
var require_interfaces = __commonJS((exports2) => {
|
|
79
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
80
|
+
exports2.ParamType = undefined;
|
|
81
|
+
var ParamType;
|
|
82
|
+
(function(ParamType2) {
|
|
83
|
+
ParamType2["Text"] = "text";
|
|
84
|
+
ParamType2["Number"] = "number";
|
|
85
|
+
ParamType2["Custom"] = "custom";
|
|
86
|
+
ParamType2["List"] = "list";
|
|
87
|
+
ParamType2["Boolean"] = "boolean";
|
|
88
|
+
ParamType2["Email"] = "email";
|
|
89
|
+
ParamType2["Phone"] = "phone";
|
|
90
|
+
ParamType2["Url"] = "url";
|
|
91
|
+
ParamType2["Package"] = "Package";
|
|
92
|
+
})(ParamType || (exports2.ParamType = ParamType = {}));
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// node_modules/@ideascol/cli-maker/dist/command/validator.js
|
|
96
|
+
var require_validator = __commonJS((exports2) => {
|
|
97
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
98
|
+
exports2.Validator = undefined;
|
|
99
|
+
var colors_1 = require_colors();
|
|
100
|
+
var interfaces_1 = require_interfaces();
|
|
101
|
+
|
|
102
|
+
class Validator {
|
|
103
|
+
validateParam(value, type, isRequired, options, paramName) {
|
|
104
|
+
if (this.checkEmpty(value) && isRequired) {
|
|
105
|
+
return { error: `${colors_1.Colors.FgRed}Missing required parameter${paramName ? `: ${paramName}` : ""}${colors_1.Colors.Reset}` };
|
|
106
|
+
} else if (this.checkEmpty(value) && !isRequired) {
|
|
107
|
+
return { value: undefined, error: "" };
|
|
108
|
+
}
|
|
109
|
+
if (value === undefined) {
|
|
110
|
+
return { value };
|
|
111
|
+
}
|
|
112
|
+
switch (type) {
|
|
113
|
+
case interfaces_1.ParamType.Number:
|
|
114
|
+
if (!/^[0-9]+$/.test(value)) {
|
|
115
|
+
return { error: `${colors_1.Colors.FgRed}Invalid number:${colors_1.Colors.Reset} ${value}` };
|
|
116
|
+
}
|
|
117
|
+
return { value: Number(value) };
|
|
118
|
+
case interfaces_1.ParamType.Custom:
|
|
119
|
+
try {
|
|
120
|
+
const customValue = JSON.parse(value);
|
|
121
|
+
if (Array.isArray(customValue) || typeof customValue === "object") {
|
|
122
|
+
return { value: customValue };
|
|
123
|
+
} else {
|
|
124
|
+
return { error: `${colors_1.Colors.FgRed}Invalid custom value:${colors_1.Colors.Reset} ${value}` };
|
|
125
|
+
}
|
|
126
|
+
} catch {
|
|
127
|
+
return { error: `${colors_1.Colors.FgRed}Invalid custom value:${colors_1.Colors.Reset} ${value}` };
|
|
128
|
+
}
|
|
129
|
+
case interfaces_1.ParamType.List:
|
|
130
|
+
if (options === undefined || options?.length === 0) {
|
|
131
|
+
return { error: `${colors_1.Colors.FgRed}Invalid List:${colors_1.Colors.Reset} empty options`, value: undefined };
|
|
132
|
+
}
|
|
133
|
+
const foundValue = options?.filter((x) => x === value);
|
|
134
|
+
if (foundValue?.length === 0) {
|
|
135
|
+
return { error: `${colors_1.Colors.FgRed}Invalid List:${colors_1.Colors.Reset} ${value} doesn't exists`, value: undefined };
|
|
136
|
+
}
|
|
137
|
+
return { value };
|
|
138
|
+
case interfaces_1.ParamType.Boolean:
|
|
139
|
+
if (value.toLowerCase() !== "true" && value.toLowerCase() !== "false") {
|
|
140
|
+
return { error: `${colors_1.Colors.FgRed}Invalid boolean:${colors_1.Colors.Reset} ${value}` };
|
|
141
|
+
}
|
|
142
|
+
return { value: value.toLowerCase() === "true" };
|
|
143
|
+
case interfaces_1.ParamType.Email:
|
|
144
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
145
|
+
return { error: `${colors_1.Colors.FgRed}Invalid email:${colors_1.Colors.Reset} ${value}` };
|
|
146
|
+
}
|
|
147
|
+
return { value };
|
|
148
|
+
case interfaces_1.ParamType.Url:
|
|
149
|
+
if (!/^https?:\/\/.+$/.test(value)) {
|
|
150
|
+
return { error: `${colors_1.Colors.FgRed}Invalid URL:${colors_1.Colors.Reset} ${value}` };
|
|
151
|
+
}
|
|
152
|
+
return { value };
|
|
153
|
+
case interfaces_1.ParamType.Package:
|
|
154
|
+
if (!/^@[a-zA-Z0-9-]+\/[a-zA-Z0-9-]+$/.test(value)) {
|
|
155
|
+
return { error: `${colors_1.Colors.FgRed}the format of the package is not correct, @company/package-name${colors_1.Colors.Reset}` };
|
|
156
|
+
}
|
|
157
|
+
return { value };
|
|
158
|
+
default:
|
|
159
|
+
return { value };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
checkEmpty(value) {
|
|
163
|
+
return value === undefined || value === "" || value === null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports2.Validator = Validator;
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// node_modules/@ideascol/cli-maker/dist/command/command.js
|
|
170
|
+
var require_command = __commonJS((exports2) => {
|
|
171
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
172
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
173
|
+
};
|
|
174
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
175
|
+
exports2.CLI = undefined;
|
|
176
|
+
var readline_1 = __importDefault(require("readline"));
|
|
177
|
+
var colors_1 = require_colors();
|
|
178
|
+
var interfaces_1 = require_interfaces();
|
|
179
|
+
var validator_1 = require_validator();
|
|
180
|
+
|
|
181
|
+
class CLI {
|
|
182
|
+
constructor(name, description, options) {
|
|
183
|
+
this.name = name;
|
|
184
|
+
this.description = description;
|
|
185
|
+
this.options = options;
|
|
186
|
+
this.commands = [];
|
|
187
|
+
if (this.options == null) {
|
|
188
|
+
this.options = { interactive: true, version: "1.0.0" };
|
|
189
|
+
}
|
|
190
|
+
this.validator = new validator_1.Validator;
|
|
191
|
+
}
|
|
192
|
+
getCommands() {
|
|
193
|
+
return this.commands;
|
|
194
|
+
}
|
|
195
|
+
getName() {
|
|
196
|
+
return this.name;
|
|
197
|
+
}
|
|
198
|
+
getDescription() {
|
|
199
|
+
return this.description;
|
|
200
|
+
}
|
|
201
|
+
getOptions() {
|
|
202
|
+
return this.options;
|
|
203
|
+
}
|
|
204
|
+
command(command) {
|
|
205
|
+
this.commands.push(command);
|
|
206
|
+
}
|
|
207
|
+
setOptions(options) {
|
|
208
|
+
this.options = options;
|
|
209
|
+
}
|
|
210
|
+
parse(argv) {
|
|
211
|
+
const [nodePath, scriptPath, ...args] = argv;
|
|
212
|
+
const commandName = args[0];
|
|
213
|
+
if (!commandName || commandName === "--version") {
|
|
214
|
+
if (commandName === "--version") {
|
|
215
|
+
console.log(`
|
|
216
|
+
${colors_1.Colors.FgGreen}${this.name} version: ${this.options?.version}${colors_1.Colors.Reset}
|
|
217
|
+
`);
|
|
218
|
+
} else {
|
|
219
|
+
this.help();
|
|
220
|
+
}
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const command = this.findCommand(commandName);
|
|
224
|
+
if (!command) {
|
|
225
|
+
this.showUnknownCommandError(commandName);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (args.includes("--help")) {
|
|
229
|
+
this.commandHelp(command);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const params = this.parseArgs(args.slice(1), command);
|
|
233
|
+
if (params.error) {
|
|
234
|
+
console.log(`
|
|
235
|
+
${params.error}`);
|
|
236
|
+
process.exit(1);
|
|
237
|
+
}
|
|
238
|
+
if (Object.keys(params.result).length > 0) {
|
|
239
|
+
if (this.options.interactive) {
|
|
240
|
+
this.options.interactive = false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const missingParams = this.getMissingParams(command, params.result);
|
|
244
|
+
if (missingParams.length > 0 && this.options?.interactive) {
|
|
245
|
+
this.handleMissingParams(command.params, params.result, command);
|
|
246
|
+
} else {
|
|
247
|
+
if (missingParams.length > 0) {
|
|
248
|
+
console.log(`
|
|
249
|
+
${colors_1.Colors.FgRed}error missing params${colors_1.Colors.Reset}
|
|
250
|
+
`);
|
|
251
|
+
missingParams.map((param) => {
|
|
252
|
+
console.log(`> ${colors_1.Colors.FgRed}${param.name}${colors_1.Colors.Reset}`);
|
|
253
|
+
console.log(` > ${colors_1.Colors.FgGray}Type: ${param.type}${colors_1.Colors.Reset}`);
|
|
254
|
+
console.log(` > ${colors_1.Colors.FgGray}Description: ${param.description}${colors_1.Colors.Reset}`);
|
|
255
|
+
if (param.options) {
|
|
256
|
+
console.log(` > ${colors_1.Colors.FgGray}Options: ${param.options}${colors_1.Colors.Reset}`);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
console.log(`
|
|
260
|
+
${colors_1.Colors.FgYellow}Optional missing params${colors_1.Colors.Reset}
|
|
261
|
+
`);
|
|
262
|
+
this.getOptionalParams(command, params.result).map((param) => {
|
|
263
|
+
console.log(`> ${colors_1.Colors.FgYellow}${param.name}${colors_1.Colors.Reset}`);
|
|
264
|
+
console.log(` > ${colors_1.Colors.FgGray}Type: ${param.type}${colors_1.Colors.Reset}`);
|
|
265
|
+
console.log(` > ${colors_1.Colors.FgGray}Description: ${param.description}${colors_1.Colors.Reset}`);
|
|
266
|
+
if (param.options) {
|
|
267
|
+
console.log(` > ${colors_1.Colors.FgGray}Options: ${param.options}${colors_1.Colors.Reset}`);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
process.exit(1);
|
|
271
|
+
}
|
|
272
|
+
command.action(params.result);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
help() {
|
|
276
|
+
console.log("");
|
|
277
|
+
console.log(`${colors_1.Colors.Bright}Welcome to ${colors_1.Colors.FgGreen}${this.name}${colors_1.Colors.Reset}`);
|
|
278
|
+
console.log("");
|
|
279
|
+
console.log(`${colors_1.Colors.FgYellow}${this.description}${colors_1.Colors.Reset}`);
|
|
280
|
+
console.log("");
|
|
281
|
+
console.log(`${colors_1.Colors.Bright}Available commands:${colors_1.Colors.Reset}`);
|
|
282
|
+
this.commands.forEach((cmd) => {
|
|
283
|
+
console.log(`${colors_1.Colors.FgGreen} ${cmd.name}${colors_1.Colors.Reset}: ${cmd.description}`);
|
|
284
|
+
});
|
|
285
|
+
console.log("");
|
|
286
|
+
}
|
|
287
|
+
commandHelp(command) {
|
|
288
|
+
console.log(`${colors_1.Colors.Bright}Help for command: ${colors_1.Colors.FgGreen}${command.name}${colors_1.Colors.Reset}`);
|
|
289
|
+
console.log(`${colors_1.Colors.FgGreen}Description:${colors_1.Colors.Reset} ${command.description}`);
|
|
290
|
+
if (command.params.length > 0) {
|
|
291
|
+
console.log(`${colors_1.Colors.FgGreen}Parameters:${colors_1.Colors.Reset}`);
|
|
292
|
+
command.params.forEach((param) => {
|
|
293
|
+
console.log(`${colors_1.Colors.FgYellow}(${param.type}) ${colors_1.Colors.Reset}${colors_1.Colors.FgGreen}${param.name}${colors_1.Colors.Reset}: ${param.description} ${param.required ? "(required)" : ""}`);
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
findCommand(commandName) {
|
|
298
|
+
return this.commands.find((cmd) => cmd.name === commandName);
|
|
299
|
+
}
|
|
300
|
+
showUnknownCommandError(commandName) {
|
|
301
|
+
console.log(`${colors_1.Colors.FgRed}Unknown command: ${commandName}${colors_1.Colors.Reset}`);
|
|
302
|
+
this.help();
|
|
303
|
+
}
|
|
304
|
+
getMissingParams(command, result) {
|
|
305
|
+
const requiredParams = command.params.filter((p) => p.required === true);
|
|
306
|
+
return requiredParams.filter((p) => result[p.name] === undefined);
|
|
307
|
+
}
|
|
308
|
+
getOptionalParams(command, result) {
|
|
309
|
+
const optionalParams = command.params.filter((p) => p.required === false || p.required === undefined);
|
|
310
|
+
return optionalParams.filter((p) => result[p.name] === undefined);
|
|
311
|
+
}
|
|
312
|
+
handleMissingParams(missingParams, result, command) {
|
|
313
|
+
if (this.options.interactive) {
|
|
314
|
+
this.promptForMissingParams(missingParams, result).then((fullParams) => {
|
|
315
|
+
command.action(fullParams);
|
|
316
|
+
});
|
|
317
|
+
} else {
|
|
318
|
+
console.log(`${colors_1.Colors.FgRed}Missing required parameters:${colors_1.Colors.Reset} ${missingParams.map((p) => p.name).join(", ")}`);
|
|
319
|
+
process.exit(1);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
parseArgs(args, command) {
|
|
323
|
+
const result = {};
|
|
324
|
+
for (const arg of args) {
|
|
325
|
+
const [key, value] = arg.split("=");
|
|
326
|
+
if (key.startsWith("--")) {
|
|
327
|
+
const paramName = key.slice(2);
|
|
328
|
+
const commandParam = command.params.find((p) => p.name === paramName);
|
|
329
|
+
if (commandParam) {
|
|
330
|
+
const validation = this.validateParam(value, commandParam.type, commandParam.required, commandParam.options, paramName);
|
|
331
|
+
if (validation.error) {
|
|
332
|
+
return { error: validation.error };
|
|
333
|
+
}
|
|
334
|
+
result[paramName] = validation.value;
|
|
335
|
+
} else {
|
|
336
|
+
return { error: `
|
|
337
|
+
Param ${colors_1.Colors.FgRed}${paramName}${colors_1.Colors.Reset} ${colors_1.Colors.Bright}is not allowed${colors_1.Colors.Reset}` };
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return { result };
|
|
342
|
+
}
|
|
343
|
+
validateParam(value, type, isRequired, options, paramName) {
|
|
344
|
+
return this.validator.validateParam(value, type, isRequired, options, paramName);
|
|
345
|
+
}
|
|
346
|
+
findParamType(paramName) {
|
|
347
|
+
return this.commands.flatMap((command) => command.params).find((param) => param.name === paramName);
|
|
348
|
+
}
|
|
349
|
+
async promptForMissingParams(missingParams, existingParams) {
|
|
350
|
+
const rl = readline_1.default.createInterface({
|
|
351
|
+
input: process.stdin,
|
|
352
|
+
output: process.stdout
|
|
353
|
+
});
|
|
354
|
+
const askQuestion = (question) => {
|
|
355
|
+
return new Promise((resolve) => rl.question(question, resolve));
|
|
356
|
+
};
|
|
357
|
+
const prompts = missingParams.reduce((promise, param) => {
|
|
358
|
+
return promise.then(async (answers) => {
|
|
359
|
+
let answer;
|
|
360
|
+
let validation;
|
|
361
|
+
if (param.type === interfaces_1.ParamType.List && param.options) {
|
|
362
|
+
const isRequired = param.required ? "(required) " : "";
|
|
363
|
+
console.log(`
|
|
364
|
+
${colors_1.Colors.FgYellow}(${param.type}) ${colors_1.Colors.Reset}${colors_1.Colors.FgGreen}${param.name}${colors_1.Colors.Reset} `);
|
|
365
|
+
console.log(`${colors_1.Colors.FgYellow}> ${colors_1.Colors.Reset}${colors_1.Colors.FgGray}${isRequired}${param.description}:${colors_1.Colors.Reset}
|
|
366
|
+
`);
|
|
367
|
+
answer = await this.promptWithArrows(param);
|
|
368
|
+
validation = { value: param.options[parseInt(answer, 10)] };
|
|
369
|
+
} else {
|
|
370
|
+
do {
|
|
371
|
+
const isRequired = param.required ? "(required) " : "(Enter to skip) ";
|
|
372
|
+
const message = `
|
|
373
|
+
${colors_1.Colors.FgYellow}(${param.type}) ${colors_1.Colors.Reset}${colors_1.Colors.FgGreen}${param.name}${colors_1.Colors.Reset}
|
|
374
|
+
${colors_1.Colors.FgYellow}> ${colors_1.Colors.Reset}${colors_1.Colors.FgGray}${isRequired}${param.description}:${colors_1.Colors.Reset}
|
|
375
|
+
`;
|
|
376
|
+
answer = await askQuestion(message);
|
|
377
|
+
validation = this.validateParam(answer, param.type, param.required, param.options);
|
|
378
|
+
if (validation.error) {
|
|
379
|
+
console.log(validation.error);
|
|
380
|
+
}
|
|
381
|
+
} while (validation.error);
|
|
382
|
+
}
|
|
383
|
+
return { ...answers, [param.name]: validation.value };
|
|
384
|
+
});
|
|
385
|
+
}, Promise.resolve(existingParams));
|
|
386
|
+
return prompts.finally(() => rl.close());
|
|
387
|
+
}
|
|
388
|
+
async promptWithArrows(param) {
|
|
389
|
+
return new Promise((resolve) => {
|
|
390
|
+
let index = 0;
|
|
391
|
+
const options = param.options;
|
|
392
|
+
const renderOptions = () => {
|
|
393
|
+
options.forEach((option, i) => {
|
|
394
|
+
process.stdout.write("\x1B[2K\x1B[0G");
|
|
395
|
+
if (i === index) {
|
|
396
|
+
process.stdout.write(`${colors_1.Colors.FgGreen}> ${option}${colors_1.Colors.Reset}
|
|
397
|
+
`);
|
|
398
|
+
} else {
|
|
399
|
+
process.stdout.write(` ${option}
|
|
400
|
+
`);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
process.stdout.write(`\x1B[${options.length}A`);
|
|
404
|
+
};
|
|
405
|
+
const clearLines = (numLines) => {
|
|
406
|
+
for (let i = 0;i < numLines; i++) {
|
|
407
|
+
process.stdout.write("\x1B[2K\x1B[1A");
|
|
408
|
+
}
|
|
409
|
+
process.stdout.write("\x1B[2K\x1B[0G");
|
|
410
|
+
};
|
|
411
|
+
const keypressHandler = (str, key) => {
|
|
412
|
+
if (key.name === "up") {
|
|
413
|
+
index = index > 0 ? index - 1 : options.length - 1;
|
|
414
|
+
renderOptions();
|
|
415
|
+
} else if (key.name === "down") {
|
|
416
|
+
index = (index + 1) % options.length;
|
|
417
|
+
renderOptions();
|
|
418
|
+
} else if (key.name === "return") {
|
|
419
|
+
process.stdin.removeListener("keypress", keypressHandler);
|
|
420
|
+
clearLines(options.length);
|
|
421
|
+
options.forEach((option, i) => {
|
|
422
|
+
if (i === index) {
|
|
423
|
+
process.stdout.write(`${colors_1.Colors.FgGreen}> ${option}${colors_1.Colors.Reset}
|
|
424
|
+
`);
|
|
425
|
+
} else {
|
|
426
|
+
process.stdout.write(` ${option}
|
|
427
|
+
`);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
process.stdout.write(`
|
|
431
|
+
Selected: ${options[index]}
|
|
432
|
+
`);
|
|
433
|
+
resolve(index.toString());
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
readline_1.default.emitKeypressEvents(process.stdin);
|
|
438
|
+
if (process.stdin.isTTY) {
|
|
439
|
+
process.stdin.setRawMode(true);
|
|
440
|
+
}
|
|
441
|
+
process.stdin.on("keypress", keypressHandler);
|
|
442
|
+
renderOptions();
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
exports2.CLI = CLI;
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
// node_modules/@ideascol/cli-maker/dist/common.js
|
|
450
|
+
var require_common = __commonJS((exports2) => {
|
|
451
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
452
|
+
exports2.stripAnsiCodes = stripAnsiCodes;
|
|
453
|
+
function stripAnsiCodes(str) {
|
|
454
|
+
return str.replace(/[\u001b\u009b][[\]()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
// node_modules/@ideascol/cli-maker/dist/index.js
|
|
459
|
+
var require_dist = __commonJS((exports2) => {
|
|
460
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
461
|
+
exports2.stripAnsiCodes = exports2.ParamType = exports2.CLI = undefined;
|
|
462
|
+
var command_1 = require_command();
|
|
463
|
+
Object.defineProperty(exports2, "CLI", { enumerable: true, get: function() {
|
|
464
|
+
return command_1.CLI;
|
|
465
|
+
} });
|
|
466
|
+
var interfaces_1 = require_interfaces();
|
|
467
|
+
Object.defineProperty(exports2, "ParamType", { enumerable: true, get: function() {
|
|
468
|
+
return interfaces_1.ParamType;
|
|
469
|
+
} });
|
|
470
|
+
var common_1 = require_common();
|
|
471
|
+
Object.defineProperty(exports2, "stripAnsiCodes", { enumerable: true, get: function() {
|
|
472
|
+
return common_1.stripAnsiCodes;
|
|
473
|
+
} });
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
// src/lib/clients/agents-generator/core/ApiError.ts
|
|
477
|
+
var ApiError;
|
|
478
|
+
var init_ApiError = __esm(() => {
|
|
479
|
+
ApiError = class ApiError extends Error {
|
|
480
|
+
url;
|
|
481
|
+
status;
|
|
482
|
+
statusText;
|
|
483
|
+
body;
|
|
484
|
+
request;
|
|
485
|
+
constructor(request, response, message) {
|
|
486
|
+
super(message);
|
|
487
|
+
this.name = "ApiError";
|
|
488
|
+
this.url = response.url;
|
|
489
|
+
this.status = response.status;
|
|
490
|
+
this.statusText = response.statusText;
|
|
491
|
+
this.body = response.body;
|
|
492
|
+
this.request = request;
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
// src/lib/clients/agents-generator/core/CancelablePromise.ts
|
|
498
|
+
var CancelError, CancelablePromise;
|
|
499
|
+
var init_CancelablePromise = __esm(() => {
|
|
500
|
+
CancelError = class CancelError extends Error {
|
|
501
|
+
constructor(message) {
|
|
502
|
+
super(message);
|
|
503
|
+
this.name = "CancelError";
|
|
504
|
+
}
|
|
505
|
+
get isCancelled() {
|
|
506
|
+
return true;
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
CancelablePromise = class CancelablePromise {
|
|
510
|
+
#isResolved;
|
|
511
|
+
#isRejected;
|
|
512
|
+
#isCancelled;
|
|
513
|
+
#cancelHandlers;
|
|
514
|
+
#promise;
|
|
515
|
+
#resolve;
|
|
516
|
+
#reject;
|
|
517
|
+
constructor(executor) {
|
|
518
|
+
this.#isResolved = false;
|
|
519
|
+
this.#isRejected = false;
|
|
520
|
+
this.#isCancelled = false;
|
|
521
|
+
this.#cancelHandlers = [];
|
|
522
|
+
this.#promise = new Promise((resolve, reject) => {
|
|
523
|
+
this.#resolve = resolve;
|
|
524
|
+
this.#reject = reject;
|
|
525
|
+
const onResolve = (value) => {
|
|
526
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
this.#isResolved = true;
|
|
530
|
+
if (this.#resolve)
|
|
531
|
+
this.#resolve(value);
|
|
532
|
+
};
|
|
533
|
+
const onReject = (reason) => {
|
|
534
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
this.#isRejected = true;
|
|
538
|
+
if (this.#reject)
|
|
539
|
+
this.#reject(reason);
|
|
540
|
+
};
|
|
541
|
+
const onCancel = (cancelHandler) => {
|
|
542
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
this.#cancelHandlers.push(cancelHandler);
|
|
546
|
+
};
|
|
547
|
+
Object.defineProperty(onCancel, "isResolved", {
|
|
548
|
+
get: () => this.#isResolved
|
|
549
|
+
});
|
|
550
|
+
Object.defineProperty(onCancel, "isRejected", {
|
|
551
|
+
get: () => this.#isRejected
|
|
552
|
+
});
|
|
553
|
+
Object.defineProperty(onCancel, "isCancelled", {
|
|
554
|
+
get: () => this.#isCancelled
|
|
555
|
+
});
|
|
556
|
+
return executor(onResolve, onReject, onCancel);
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
get [Symbol.toStringTag]() {
|
|
560
|
+
return "Cancellable Promise";
|
|
561
|
+
}
|
|
562
|
+
then(onFulfilled, onRejected) {
|
|
563
|
+
return this.#promise.then(onFulfilled, onRejected);
|
|
564
|
+
}
|
|
565
|
+
catch(onRejected) {
|
|
566
|
+
return this.#promise.catch(onRejected);
|
|
567
|
+
}
|
|
568
|
+
finally(onFinally) {
|
|
569
|
+
return this.#promise.finally(onFinally);
|
|
570
|
+
}
|
|
571
|
+
cancel() {
|
|
572
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
this.#isCancelled = true;
|
|
576
|
+
if (this.#cancelHandlers.length) {
|
|
577
|
+
try {
|
|
578
|
+
for (const cancelHandler of this.#cancelHandlers) {
|
|
579
|
+
cancelHandler();
|
|
580
|
+
}
|
|
581
|
+
} catch (error) {
|
|
582
|
+
console.warn("Cancellation threw an error", error);
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
this.#cancelHandlers.length = 0;
|
|
587
|
+
if (this.#reject)
|
|
588
|
+
this.#reject(new CancelError("Request aborted"));
|
|
589
|
+
}
|
|
590
|
+
get isCancelled() {
|
|
591
|
+
return this.#isCancelled;
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
// src/lib/clients/agents-generator/core/OpenAPI.ts
|
|
597
|
+
var OpenAPI;
|
|
598
|
+
var init_OpenAPI = __esm(() => {
|
|
599
|
+
OpenAPI = {
|
|
600
|
+
BASE: "",
|
|
601
|
+
VERSION: "main-3e9b5b5b62a0af3d34e07f2a82593d3a5b0543da",
|
|
602
|
+
WITH_CREDENTIALS: false,
|
|
603
|
+
CREDENTIALS: "include",
|
|
604
|
+
TOKEN: undefined,
|
|
605
|
+
USERNAME: undefined,
|
|
606
|
+
PASSWORD: undefined,
|
|
607
|
+
HEADERS: undefined,
|
|
608
|
+
ENCODE_PATH: undefined
|
|
609
|
+
};
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
// src/lib/clients/agents-generator/core/request.ts
|
|
613
|
+
var isDefined = (value) => {
|
|
614
|
+
return value !== undefined && value !== null;
|
|
615
|
+
}, isString = (value) => {
|
|
616
|
+
return typeof value === "string";
|
|
617
|
+
}, isStringWithValue = (value) => {
|
|
618
|
+
return isString(value) && value !== "";
|
|
619
|
+
}, isBlob = (value) => {
|
|
620
|
+
return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
|
|
621
|
+
}, isFormData = (value) => {
|
|
622
|
+
return value instanceof FormData;
|
|
623
|
+
}, base64 = (str) => {
|
|
624
|
+
try {
|
|
625
|
+
return btoa(str);
|
|
626
|
+
} catch (err) {
|
|
627
|
+
return Buffer.from(str).toString("base64");
|
|
628
|
+
}
|
|
629
|
+
}, getQueryString = (params) => {
|
|
630
|
+
const qs = [];
|
|
631
|
+
const append = (key, value) => {
|
|
632
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
633
|
+
};
|
|
634
|
+
const process2 = (key, value) => {
|
|
635
|
+
if (isDefined(value)) {
|
|
636
|
+
if (Array.isArray(value)) {
|
|
637
|
+
value.forEach((v) => {
|
|
638
|
+
process2(key, v);
|
|
639
|
+
});
|
|
640
|
+
} else if (typeof value === "object") {
|
|
641
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
642
|
+
process2(`${key}[${k}]`, v);
|
|
643
|
+
});
|
|
644
|
+
} else {
|
|
645
|
+
append(key, value);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
650
|
+
process2(key, value);
|
|
651
|
+
});
|
|
652
|
+
if (qs.length > 0) {
|
|
653
|
+
return `?${qs.join("&")}`;
|
|
654
|
+
}
|
|
655
|
+
return "";
|
|
656
|
+
}, getUrl = (config, options) => {
|
|
657
|
+
const encoder = config.ENCODE_PATH || encodeURI;
|
|
658
|
+
const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
659
|
+
if (options.path?.hasOwnProperty(group)) {
|
|
660
|
+
return encoder(String(options.path[group]));
|
|
661
|
+
}
|
|
662
|
+
return substring;
|
|
663
|
+
});
|
|
664
|
+
const url = `${config.BASE}${path}`;
|
|
665
|
+
if (options.query) {
|
|
666
|
+
return `${url}${getQueryString(options.query)}`;
|
|
667
|
+
}
|
|
668
|
+
return url;
|
|
669
|
+
}, getFormData = (options) => {
|
|
670
|
+
if (options.formData) {
|
|
671
|
+
const formData = new FormData;
|
|
672
|
+
const process2 = (key, value) => {
|
|
673
|
+
if (isString(value) || isBlob(value)) {
|
|
674
|
+
formData.append(key, value);
|
|
675
|
+
} else {
|
|
676
|
+
formData.append(key, JSON.stringify(value));
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
Object.entries(options.formData).filter(([_, value]) => isDefined(value)).forEach(([key, value]) => {
|
|
680
|
+
if (Array.isArray(value)) {
|
|
681
|
+
value.forEach((v) => process2(key, v));
|
|
682
|
+
} else {
|
|
683
|
+
process2(key, value);
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
return formData;
|
|
687
|
+
}
|
|
688
|
+
return;
|
|
689
|
+
}, resolve = async (options, resolver) => {
|
|
690
|
+
if (typeof resolver === "function") {
|
|
691
|
+
return resolver(options);
|
|
692
|
+
}
|
|
693
|
+
return resolver;
|
|
694
|
+
}, getHeaders = async (config, options) => {
|
|
695
|
+
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
696
|
+
resolve(options, config.TOKEN),
|
|
697
|
+
resolve(options, config.USERNAME),
|
|
698
|
+
resolve(options, config.PASSWORD),
|
|
699
|
+
resolve(options, config.HEADERS)
|
|
700
|
+
]);
|
|
701
|
+
const headers = Object.entries({
|
|
702
|
+
Accept: "application/json",
|
|
703
|
+
...additionalHeaders,
|
|
704
|
+
...options.headers
|
|
705
|
+
}).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => ({
|
|
706
|
+
...headers2,
|
|
707
|
+
[key]: String(value)
|
|
708
|
+
}), {});
|
|
709
|
+
if (isStringWithValue(token)) {
|
|
710
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
711
|
+
}
|
|
712
|
+
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
713
|
+
const credentials = base64(`${username}:${password}`);
|
|
714
|
+
headers["Authorization"] = `Basic ${credentials}`;
|
|
715
|
+
}
|
|
716
|
+
if (options.body !== undefined) {
|
|
717
|
+
if (options.mediaType) {
|
|
718
|
+
headers["Content-Type"] = options.mediaType;
|
|
719
|
+
} else if (isBlob(options.body)) {
|
|
720
|
+
headers["Content-Type"] = options.body.type || "application/octet-stream";
|
|
721
|
+
} else if (isString(options.body)) {
|
|
722
|
+
headers["Content-Type"] = "text/plain";
|
|
723
|
+
} else if (!isFormData(options.body)) {
|
|
724
|
+
headers["Content-Type"] = "application/json";
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return new Headers(headers);
|
|
728
|
+
}, getRequestBody = (options) => {
|
|
729
|
+
if (options.body !== undefined) {
|
|
730
|
+
if (options.mediaType?.includes("/json")) {
|
|
731
|
+
return JSON.stringify(options.body);
|
|
732
|
+
} else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
733
|
+
return options.body;
|
|
734
|
+
} else {
|
|
735
|
+
return JSON.stringify(options.body);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
return;
|
|
739
|
+
}, sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
740
|
+
const controller = new AbortController;
|
|
741
|
+
const request = {
|
|
742
|
+
headers,
|
|
743
|
+
body: body ?? formData,
|
|
744
|
+
method: options.method,
|
|
745
|
+
signal: controller.signal
|
|
746
|
+
};
|
|
747
|
+
if (config.WITH_CREDENTIALS) {
|
|
748
|
+
request.credentials = config.CREDENTIALS;
|
|
749
|
+
}
|
|
750
|
+
onCancel(() => controller.abort());
|
|
751
|
+
return await fetch(url, request);
|
|
752
|
+
}, getResponseHeader = (response, responseHeader) => {
|
|
753
|
+
if (responseHeader) {
|
|
754
|
+
const content = response.headers.get(responseHeader);
|
|
755
|
+
if (isString(content)) {
|
|
756
|
+
return content;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return;
|
|
760
|
+
}, getResponseBody = async (response) => {
|
|
761
|
+
if (response.status !== 204) {
|
|
762
|
+
try {
|
|
763
|
+
const contentType = response.headers.get("Content-Type");
|
|
764
|
+
if (contentType) {
|
|
765
|
+
const jsonTypes = ["application/json", "application/problem+json"];
|
|
766
|
+
const isJSON = jsonTypes.some((type) => contentType.toLowerCase().startsWith(type));
|
|
767
|
+
if (isJSON) {
|
|
768
|
+
return await response.json();
|
|
769
|
+
} else {
|
|
770
|
+
return await response.text();
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
} catch (error) {
|
|
774
|
+
console.error(error);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return;
|
|
778
|
+
}, catchErrorCodes = (options, result) => {
|
|
779
|
+
const errors = {
|
|
780
|
+
400: "Bad Request",
|
|
781
|
+
401: "Unauthorized",
|
|
782
|
+
403: "Forbidden",
|
|
783
|
+
404: "Not Found",
|
|
784
|
+
500: "Internal Server Error",
|
|
785
|
+
502: "Bad Gateway",
|
|
786
|
+
503: "Service Unavailable",
|
|
787
|
+
...options.errors
|
|
788
|
+
};
|
|
789
|
+
const error = errors[result.status];
|
|
790
|
+
if (error) {
|
|
791
|
+
throw new ApiError(options, result, error);
|
|
792
|
+
}
|
|
793
|
+
if (!result.ok) {
|
|
794
|
+
const errorStatus = result.status ?? "unknown";
|
|
795
|
+
const errorStatusText = result.statusText ?? "unknown";
|
|
796
|
+
const errorBody = (() => {
|
|
797
|
+
try {
|
|
798
|
+
return JSON.stringify(result.body, null, 2);
|
|
799
|
+
} catch (e) {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
})();
|
|
803
|
+
throw new ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
804
|
+
}
|
|
805
|
+
}, request = (config, options) => {
|
|
806
|
+
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
807
|
+
try {
|
|
808
|
+
const url = getUrl(config, options);
|
|
809
|
+
const formData = getFormData(options);
|
|
810
|
+
const body = getRequestBody(options);
|
|
811
|
+
const headers = await getHeaders(config, options);
|
|
812
|
+
if (!onCancel.isCancelled) {
|
|
813
|
+
const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
|
|
814
|
+
const responseBody = await getResponseBody(response);
|
|
815
|
+
const responseHeader = getResponseHeader(response, options.responseHeader);
|
|
816
|
+
const result = {
|
|
817
|
+
url,
|
|
818
|
+
ok: response.ok,
|
|
819
|
+
status: response.status,
|
|
820
|
+
statusText: response.statusText,
|
|
821
|
+
body: responseHeader ?? responseBody
|
|
822
|
+
};
|
|
823
|
+
catchErrorCodes(options, result);
|
|
824
|
+
resolve2(result.body);
|
|
825
|
+
}
|
|
826
|
+
} catch (error) {
|
|
827
|
+
reject(error);
|
|
828
|
+
}
|
|
829
|
+
});
|
|
830
|
+
};
|
|
831
|
+
var init_request = __esm(() => {
|
|
832
|
+
init_ApiError();
|
|
833
|
+
init_CancelablePromise();
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
// src/lib/clients/agents-generator/services/AgentService.ts
|
|
837
|
+
class AgentService {
|
|
838
|
+
static createAgentAgentsPost(requestBody, userId) {
|
|
839
|
+
return request(OpenAPI, {
|
|
840
|
+
method: "POST",
|
|
841
|
+
url: "/agents",
|
|
842
|
+
query: {
|
|
843
|
+
user_id: userId
|
|
844
|
+
},
|
|
845
|
+
body: requestBody,
|
|
846
|
+
mediaType: "application/json",
|
|
847
|
+
errors: {
|
|
848
|
+
422: `Validation Error`
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
static getAgentsAgentsGet(skip, limit = 100, userId) {
|
|
853
|
+
return request(OpenAPI, {
|
|
854
|
+
method: "GET",
|
|
855
|
+
url: "/agents",
|
|
856
|
+
query: {
|
|
857
|
+
skip,
|
|
858
|
+
limit,
|
|
859
|
+
user_id: userId
|
|
860
|
+
},
|
|
861
|
+
errors: {
|
|
862
|
+
422: `Validation Error`
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
static updateAgentAgentsAgentIdPut(agentId, requestBody, userId) {
|
|
867
|
+
return request(OpenAPI, {
|
|
868
|
+
method: "PUT",
|
|
869
|
+
url: "/agents/{agent_id}",
|
|
870
|
+
path: {
|
|
871
|
+
agent_id: agentId
|
|
872
|
+
},
|
|
873
|
+
query: {
|
|
874
|
+
user_id: userId
|
|
875
|
+
},
|
|
876
|
+
body: requestBody,
|
|
877
|
+
mediaType: "application/json",
|
|
878
|
+
errors: {
|
|
879
|
+
422: `Validation Error`
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
static getAgentAgentsAgentIdGet(agentId, userId) {
|
|
884
|
+
return request(OpenAPI, {
|
|
885
|
+
method: "GET",
|
|
886
|
+
url: "/agents/{agent_id}",
|
|
887
|
+
path: {
|
|
888
|
+
agent_id: agentId
|
|
889
|
+
},
|
|
890
|
+
query: {
|
|
891
|
+
user_id: userId
|
|
892
|
+
},
|
|
893
|
+
errors: {
|
|
894
|
+
422: `Validation Error`
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
static deleteAgentAgentsAgentIdDelete(agentId, userId) {
|
|
899
|
+
return request(OpenAPI, {
|
|
900
|
+
method: "DELETE",
|
|
901
|
+
url: "/agents/{agent_id}",
|
|
902
|
+
path: {
|
|
903
|
+
agent_id: agentId
|
|
904
|
+
},
|
|
905
|
+
query: {
|
|
906
|
+
user_id: userId
|
|
907
|
+
},
|
|
908
|
+
errors: {
|
|
909
|
+
422: `Validation Error`
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
static initializeAgentAgentsAgentIdInitializePost(agentId) {
|
|
914
|
+
return request(OpenAPI, {
|
|
915
|
+
method: "POST",
|
|
916
|
+
url: "/agents/{agent_id}/initialize",
|
|
917
|
+
path: {
|
|
918
|
+
agent_id: agentId
|
|
919
|
+
},
|
|
920
|
+
errors: {
|
|
921
|
+
422: `Validation Error`
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
static queryAgentAgentsAgentIdQueryPost(agentId, requestBody, userId, conversationId) {
|
|
926
|
+
return request(OpenAPI, {
|
|
927
|
+
method: "POST",
|
|
928
|
+
url: "/agents/{agent_id}/query",
|
|
929
|
+
path: {
|
|
930
|
+
agent_id: agentId
|
|
931
|
+
},
|
|
932
|
+
query: {
|
|
933
|
+
user_id: userId,
|
|
934
|
+
conversation_id: conversationId
|
|
935
|
+
},
|
|
936
|
+
body: requestBody,
|
|
937
|
+
mediaType: "application/json",
|
|
938
|
+
errors: {
|
|
939
|
+
422: `Validation Error`
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
static visualizeAgentAgentsAgentIdVisualizeGet(agentId, userId, format = "png") {
|
|
944
|
+
return request(OpenAPI, {
|
|
945
|
+
method: "GET",
|
|
946
|
+
url: "/agents/{agent_id}/visualize",
|
|
947
|
+
path: {
|
|
948
|
+
agent_id: agentId
|
|
949
|
+
},
|
|
950
|
+
query: {
|
|
951
|
+
user_id: userId,
|
|
952
|
+
format
|
|
953
|
+
},
|
|
954
|
+
errors: {
|
|
955
|
+
422: `Validation Error`
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
var init_AgentService = __esm(() => {
|
|
961
|
+
init_OpenAPI();
|
|
962
|
+
init_request();
|
|
963
|
+
});
|
|
964
|
+
|
|
965
|
+
// src/lib/clients/agents-generator/services/ConversationsService.ts
|
|
966
|
+
var init_ConversationsService = __esm(() => {
|
|
967
|
+
init_OpenAPI();
|
|
968
|
+
init_request();
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
// src/lib/clients/agents-generator/services/McpServersService.ts
|
|
972
|
+
var init_McpServersService = __esm(() => {
|
|
973
|
+
init_OpenAPI();
|
|
974
|
+
init_request();
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
// src/lib/clients/agents-generator/services/RootService.ts
|
|
978
|
+
class RootService {
|
|
979
|
+
static rootGet() {
|
|
980
|
+
return request(OpenAPI, {
|
|
981
|
+
method: "GET",
|
|
982
|
+
url: "/"
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
static healthCheckHealthGet() {
|
|
986
|
+
return request(OpenAPI, {
|
|
987
|
+
method: "GET",
|
|
988
|
+
url: "/health"
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
var init_RootService = __esm(() => {
|
|
993
|
+
init_OpenAPI();
|
|
994
|
+
init_request();
|
|
995
|
+
});
|
|
996
|
+
|
|
997
|
+
// src/lib/clients/agents-generator/index.ts
|
|
998
|
+
var init_agents_generator = __esm(() => {
|
|
999
|
+
init_ApiError();
|
|
1000
|
+
init_CancelablePromise();
|
|
1001
|
+
init_OpenAPI();
|
|
1002
|
+
init_AgentService();
|
|
1003
|
+
init_ConversationsService();
|
|
1004
|
+
init_McpServersService();
|
|
1005
|
+
init_RootService();
|
|
1006
|
+
});
|
|
1007
|
+
|
|
1008
|
+
// src/commands/agentsCommand.ts
|
|
1009
|
+
var import_cli_maker, commandAgents, agentsCommand_default;
|
|
1010
|
+
var init_agentsCommand = __esm(() => {
|
|
1011
|
+
import_cli_maker = __toESM(require_dist());
|
|
1012
|
+
init_agents_generator();
|
|
1013
|
+
commandAgents = {
|
|
1014
|
+
name: "getAgents",
|
|
1015
|
+
description: "Get the list of agents",
|
|
1016
|
+
params: [{
|
|
1017
|
+
name: "URL",
|
|
1018
|
+
description: "The URL of the API",
|
|
1019
|
+
required: true,
|
|
1020
|
+
type: import_cli_maker.ParamType.Url
|
|
1021
|
+
}],
|
|
1022
|
+
action: async (args) => {
|
|
1023
|
+
OpenAPI["BASE"] = args.URL;
|
|
1024
|
+
const agents = await AgentService.getAgentsAgentsGet();
|
|
1025
|
+
const hello = await RootService.healthCheckHealthGet();
|
|
1026
|
+
console.log(hello);
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
agentsCommand_default = commandAgents;
|
|
1030
|
+
});
|
|
1031
|
+
|
|
1032
|
+
// src/commands/rootCommand.ts
|
|
1033
|
+
var import_cli_maker2, rootCommand, rootCommand_default;
|
|
1034
|
+
var init_rootCommand = __esm(() => {
|
|
1035
|
+
import_cli_maker2 = __toESM(require_dist());
|
|
1036
|
+
init_agents_generator();
|
|
1037
|
+
rootCommand = {
|
|
1038
|
+
name: "version",
|
|
1039
|
+
description: "Get the version of the API",
|
|
1040
|
+
params: [{
|
|
1041
|
+
name: "URL",
|
|
1042
|
+
description: "The URL of the API",
|
|
1043
|
+
required: false,
|
|
1044
|
+
type: import_cli_maker2.ParamType.Url
|
|
1045
|
+
}],
|
|
1046
|
+
action: async (args) => {
|
|
1047
|
+
OpenAPI["BASE"] = args.URL || "https://api.agentsgenerator.dev/";
|
|
1048
|
+
console.log(OpenAPI);
|
|
1049
|
+
const hello = await RootService.healthCheckHealthGet();
|
|
1050
|
+
console.log(hello);
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
rootCommand_default = rootCommand;
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
// src/cli.ts
|
|
1057
|
+
var exports_cli = {};
|
|
1058
|
+
__export(exports_cli, {
|
|
1059
|
+
cli: () => cli
|
|
1060
|
+
});
|
|
1061
|
+
var import_cli_maker3, cli;
|
|
1062
|
+
var init_cli = __esm(() => {
|
|
1063
|
+
import_cli_maker3 = __toESM(require_dist());
|
|
1064
|
+
init_agents_generator();
|
|
1065
|
+
init_agentsCommand();
|
|
1066
|
+
init_rootCommand();
|
|
1067
|
+
cli = new import_cli_maker3.CLI("@ideascol/agents-generator-sdk", "agents-generator-sdk", {
|
|
1068
|
+
interactive: true,
|
|
1069
|
+
version: OpenAPI.VERSION
|
|
1070
|
+
});
|
|
1071
|
+
cli.command(rootCommand_default);
|
|
1072
|
+
cli.command(agentsCommand_default);
|
|
1073
|
+
cli.parse(process.argv);
|
|
1074
|
+
});
|
|
1075
|
+
|
|
1076
|
+
// src/bin/cli.ts
|
|
1077
|
+
init_cli();
|