@ideascol/agents-generator-sdk 0.0.1 → 0.0.2
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/bin/cli.js +101 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +119 -508
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -963,12 +963,113 @@ var init_AgentService = __esm(() => {
|
|
|
963
963
|
});
|
|
964
964
|
|
|
965
965
|
// src/lib/clients/agents-generator/services/ConversationsService.ts
|
|
966
|
+
class ConversationsService {
|
|
967
|
+
static createConversationConversationsPost(requestBody) {
|
|
968
|
+
return request(OpenAPI, {
|
|
969
|
+
method: "POST",
|
|
970
|
+
url: "/conversations",
|
|
971
|
+
body: requestBody,
|
|
972
|
+
mediaType: "application/json",
|
|
973
|
+
errors: {
|
|
974
|
+
422: `Validation Error`
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
static getConversationConversationsConversationIdGet(conversationId) {
|
|
979
|
+
return request(OpenAPI, {
|
|
980
|
+
method: "GET",
|
|
981
|
+
url: "/conversations/{conversation_id}",
|
|
982
|
+
path: {
|
|
983
|
+
conversation_id: conversationId
|
|
984
|
+
},
|
|
985
|
+
errors: {
|
|
986
|
+
422: `Validation Error`
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
static updateConversationConversationsConversationIdPut(conversationId, requestBody) {
|
|
991
|
+
return request(OpenAPI, {
|
|
992
|
+
method: "PUT",
|
|
993
|
+
url: "/conversations/{conversation_id}",
|
|
994
|
+
path: {
|
|
995
|
+
conversation_id: conversationId
|
|
996
|
+
},
|
|
997
|
+
body: requestBody,
|
|
998
|
+
mediaType: "application/json",
|
|
999
|
+
errors: {
|
|
1000
|
+
422: `Validation Error`
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
static deleteConversationConversationsConversationIdDelete(conversationId) {
|
|
1005
|
+
return request(OpenAPI, {
|
|
1006
|
+
method: "DELETE",
|
|
1007
|
+
url: "/conversations/{conversation_id}",
|
|
1008
|
+
path: {
|
|
1009
|
+
conversation_id: conversationId
|
|
1010
|
+
},
|
|
1011
|
+
errors: {
|
|
1012
|
+
422: `Validation Error`
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
static getAgentConversationsConversationsAgentAgentIdGet(agentId, skip, limit = 100) {
|
|
1017
|
+
return request(OpenAPI, {
|
|
1018
|
+
method: "GET",
|
|
1019
|
+
url: "/conversations/agent/{agent_id}",
|
|
1020
|
+
path: {
|
|
1021
|
+
agent_id: agentId
|
|
1022
|
+
},
|
|
1023
|
+
query: {
|
|
1024
|
+
skip,
|
|
1025
|
+
limit
|
|
1026
|
+
},
|
|
1027
|
+
errors: {
|
|
1028
|
+
422: `Validation Error`
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
static addMessageConversationsConversationIdMessagesPost(conversationId, requestBody) {
|
|
1033
|
+
return request(OpenAPI, {
|
|
1034
|
+
method: "POST",
|
|
1035
|
+
url: "/conversations/{conversation_id}/messages",
|
|
1036
|
+
path: {
|
|
1037
|
+
conversation_id: conversationId
|
|
1038
|
+
},
|
|
1039
|
+
body: requestBody,
|
|
1040
|
+
mediaType: "application/json",
|
|
1041
|
+
errors: {
|
|
1042
|
+
422: `Validation Error`
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
966
1047
|
var init_ConversationsService = __esm(() => {
|
|
967
1048
|
init_OpenAPI();
|
|
968
1049
|
init_request();
|
|
969
1050
|
});
|
|
970
1051
|
|
|
971
1052
|
// src/lib/clients/agents-generator/services/McpServersService.ts
|
|
1053
|
+
class McpServersService {
|
|
1054
|
+
static getMcpServersMcpServersGet() {
|
|
1055
|
+
return request(OpenAPI, {
|
|
1056
|
+
method: "GET",
|
|
1057
|
+
url: "/mcp-servers"
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
static getMcpServerMcpServersServerIdGet(serverId) {
|
|
1061
|
+
return request(OpenAPI, {
|
|
1062
|
+
method: "GET",
|
|
1063
|
+
url: "/mcp-servers/{server_id}",
|
|
1064
|
+
path: {
|
|
1065
|
+
server_id: serverId
|
|
1066
|
+
},
|
|
1067
|
+
errors: {
|
|
1068
|
+
422: `Validation Error`
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
972
1073
|
var init_McpServersService = __esm(() => {
|
|
973
1074
|
init_OpenAPI();
|
|
974
1075
|
init_request();
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './lib';
|
package/dist/index.js
CHANGED
|
@@ -41,437 +41,6 @@ var __export = (target, all) => {
|
|
|
41
41
|
};
|
|
42
42
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
43
43
|
|
|
44
|
-
// node_modules/@ideascol/cli-maker/dist/colors.js
|
|
45
|
-
var require_colors = __commonJS((exports2) => {
|
|
46
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47
|
-
exports2.Colors = undefined;
|
|
48
|
-
exports2.Colors = {
|
|
49
|
-
Reset: "\x1B[0m",
|
|
50
|
-
Bright: "\x1B[1m",
|
|
51
|
-
Dim: "\x1B[2m",
|
|
52
|
-
Underscore: "\x1B[4m",
|
|
53
|
-
Blink: "\x1B[5m",
|
|
54
|
-
Reverse: "\x1B[7m",
|
|
55
|
-
Hidden: "\x1B[8m",
|
|
56
|
-
FgBlack: "\x1B[30m",
|
|
57
|
-
FgRed: "\x1B[31m",
|
|
58
|
-
FgGreen: "\x1B[32m",
|
|
59
|
-
FgYellow: "\x1B[33m",
|
|
60
|
-
FgBlue: "\x1B[34m",
|
|
61
|
-
FgMagenta: "\x1B[35m",
|
|
62
|
-
FgCyan: "\x1B[36m",
|
|
63
|
-
FgWhite: "\x1B[37m",
|
|
64
|
-
FgGray: "\x1B[90m",
|
|
65
|
-
BgBlack: "\x1B[40m",
|
|
66
|
-
BgRed: "\x1B[41m",
|
|
67
|
-
BgGreen: "\x1B[42m",
|
|
68
|
-
BgYellow: "\x1B[43m",
|
|
69
|
-
BgBlue: "\x1B[44m",
|
|
70
|
-
BgMagenta: "\x1B[45m",
|
|
71
|
-
BgCyan: "\x1B[46m",
|
|
72
|
-
BgWhite: "\x1B[47m"
|
|
73
|
-
};
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// node_modules/@ideascol/cli-maker/dist/interfaces.js
|
|
77
|
-
var require_interfaces = __commonJS((exports2) => {
|
|
78
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
79
|
-
exports2.ParamType = undefined;
|
|
80
|
-
var ParamType;
|
|
81
|
-
(function(ParamType2) {
|
|
82
|
-
ParamType2["Text"] = "text";
|
|
83
|
-
ParamType2["Number"] = "number";
|
|
84
|
-
ParamType2["Custom"] = "custom";
|
|
85
|
-
ParamType2["List"] = "list";
|
|
86
|
-
ParamType2["Boolean"] = "boolean";
|
|
87
|
-
ParamType2["Email"] = "email";
|
|
88
|
-
ParamType2["Phone"] = "phone";
|
|
89
|
-
ParamType2["Url"] = "url";
|
|
90
|
-
ParamType2["Package"] = "Package";
|
|
91
|
-
})(ParamType || (exports2.ParamType = ParamType = {}));
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// node_modules/@ideascol/cli-maker/dist/command/validator.js
|
|
95
|
-
var require_validator = __commonJS((exports2) => {
|
|
96
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
97
|
-
exports2.Validator = undefined;
|
|
98
|
-
var colors_1 = require_colors();
|
|
99
|
-
var interfaces_1 = require_interfaces();
|
|
100
|
-
|
|
101
|
-
class Validator {
|
|
102
|
-
validateParam(value, type, isRequired, options, paramName) {
|
|
103
|
-
if (this.checkEmpty(value) && isRequired) {
|
|
104
|
-
return { error: `${colors_1.Colors.FgRed}Missing required parameter${paramName ? `: ${paramName}` : ""}${colors_1.Colors.Reset}` };
|
|
105
|
-
} else if (this.checkEmpty(value) && !isRequired) {
|
|
106
|
-
return { value: undefined, error: "" };
|
|
107
|
-
}
|
|
108
|
-
if (value === undefined) {
|
|
109
|
-
return { value };
|
|
110
|
-
}
|
|
111
|
-
switch (type) {
|
|
112
|
-
case interfaces_1.ParamType.Number:
|
|
113
|
-
if (!/^[0-9]+$/.test(value)) {
|
|
114
|
-
return { error: `${colors_1.Colors.FgRed}Invalid number:${colors_1.Colors.Reset} ${value}` };
|
|
115
|
-
}
|
|
116
|
-
return { value: Number(value) };
|
|
117
|
-
case interfaces_1.ParamType.Custom:
|
|
118
|
-
try {
|
|
119
|
-
const customValue = JSON.parse(value);
|
|
120
|
-
if (Array.isArray(customValue) || typeof customValue === "object") {
|
|
121
|
-
return { value: customValue };
|
|
122
|
-
} else {
|
|
123
|
-
return { error: `${colors_1.Colors.FgRed}Invalid custom value:${colors_1.Colors.Reset} ${value}` };
|
|
124
|
-
}
|
|
125
|
-
} catch {
|
|
126
|
-
return { error: `${colors_1.Colors.FgRed}Invalid custom value:${colors_1.Colors.Reset} ${value}` };
|
|
127
|
-
}
|
|
128
|
-
case interfaces_1.ParamType.List:
|
|
129
|
-
if (options === undefined || options?.length === 0) {
|
|
130
|
-
return { error: `${colors_1.Colors.FgRed}Invalid List:${colors_1.Colors.Reset} empty options`, value: undefined };
|
|
131
|
-
}
|
|
132
|
-
const foundValue = options?.filter((x) => x === value);
|
|
133
|
-
if (foundValue?.length === 0) {
|
|
134
|
-
return { error: `${colors_1.Colors.FgRed}Invalid List:${colors_1.Colors.Reset} ${value} doesn't exists`, value: undefined };
|
|
135
|
-
}
|
|
136
|
-
return { value };
|
|
137
|
-
case interfaces_1.ParamType.Boolean:
|
|
138
|
-
if (value.toLowerCase() !== "true" && value.toLowerCase() !== "false") {
|
|
139
|
-
return { error: `${colors_1.Colors.FgRed}Invalid boolean:${colors_1.Colors.Reset} ${value}` };
|
|
140
|
-
}
|
|
141
|
-
return { value: value.toLowerCase() === "true" };
|
|
142
|
-
case interfaces_1.ParamType.Email:
|
|
143
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
144
|
-
return { error: `${colors_1.Colors.FgRed}Invalid email:${colors_1.Colors.Reset} ${value}` };
|
|
145
|
-
}
|
|
146
|
-
return { value };
|
|
147
|
-
case interfaces_1.ParamType.Url:
|
|
148
|
-
if (!/^https?:\/\/.+$/.test(value)) {
|
|
149
|
-
return { error: `${colors_1.Colors.FgRed}Invalid URL:${colors_1.Colors.Reset} ${value}` };
|
|
150
|
-
}
|
|
151
|
-
return { value };
|
|
152
|
-
case interfaces_1.ParamType.Package:
|
|
153
|
-
if (!/^@[a-zA-Z0-9-]+\/[a-zA-Z0-9-]+$/.test(value)) {
|
|
154
|
-
return { error: `${colors_1.Colors.FgRed}the format of the package is not correct, @company/package-name${colors_1.Colors.Reset}` };
|
|
155
|
-
}
|
|
156
|
-
return { value };
|
|
157
|
-
default:
|
|
158
|
-
return { value };
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
checkEmpty(value) {
|
|
162
|
-
return value === undefined || value === "" || value === null;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
exports2.Validator = Validator;
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// node_modules/@ideascol/cli-maker/dist/command/command.js
|
|
169
|
-
var require_command = __commonJS((exports2) => {
|
|
170
|
-
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
171
|
-
return mod && mod.__esModule ? mod : { default: mod };
|
|
172
|
-
};
|
|
173
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
174
|
-
exports2.CLI = undefined;
|
|
175
|
-
var readline_1 = __importDefault(require("readline"));
|
|
176
|
-
var colors_1 = require_colors();
|
|
177
|
-
var interfaces_1 = require_interfaces();
|
|
178
|
-
var validator_1 = require_validator();
|
|
179
|
-
|
|
180
|
-
class CLI {
|
|
181
|
-
constructor(name, description, options) {
|
|
182
|
-
this.name = name;
|
|
183
|
-
this.description = description;
|
|
184
|
-
this.options = options;
|
|
185
|
-
this.commands = [];
|
|
186
|
-
if (this.options == null) {
|
|
187
|
-
this.options = { interactive: true, version: "1.0.0" };
|
|
188
|
-
}
|
|
189
|
-
this.validator = new validator_1.Validator;
|
|
190
|
-
}
|
|
191
|
-
getCommands() {
|
|
192
|
-
return this.commands;
|
|
193
|
-
}
|
|
194
|
-
getName() {
|
|
195
|
-
return this.name;
|
|
196
|
-
}
|
|
197
|
-
getDescription() {
|
|
198
|
-
return this.description;
|
|
199
|
-
}
|
|
200
|
-
getOptions() {
|
|
201
|
-
return this.options;
|
|
202
|
-
}
|
|
203
|
-
command(command) {
|
|
204
|
-
this.commands.push(command);
|
|
205
|
-
}
|
|
206
|
-
setOptions(options) {
|
|
207
|
-
this.options = options;
|
|
208
|
-
}
|
|
209
|
-
parse(argv) {
|
|
210
|
-
const [nodePath, scriptPath, ...args] = argv;
|
|
211
|
-
const commandName = args[0];
|
|
212
|
-
if (!commandName || commandName === "--version") {
|
|
213
|
-
if (commandName === "--version") {
|
|
214
|
-
console.log(`
|
|
215
|
-
${colors_1.Colors.FgGreen}${this.name} version: ${this.options?.version}${colors_1.Colors.Reset}
|
|
216
|
-
`);
|
|
217
|
-
} else {
|
|
218
|
-
this.help();
|
|
219
|
-
}
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
const command = this.findCommand(commandName);
|
|
223
|
-
if (!command) {
|
|
224
|
-
this.showUnknownCommandError(commandName);
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
if (args.includes("--help")) {
|
|
228
|
-
this.commandHelp(command);
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
const params = this.parseArgs(args.slice(1), command);
|
|
232
|
-
if (params.error) {
|
|
233
|
-
console.log(`
|
|
234
|
-
${params.error}`);
|
|
235
|
-
process.exit(1);
|
|
236
|
-
}
|
|
237
|
-
if (Object.keys(params.result).length > 0) {
|
|
238
|
-
if (this.options.interactive) {
|
|
239
|
-
this.options.interactive = false;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
const missingParams = this.getMissingParams(command, params.result);
|
|
243
|
-
if (missingParams.length > 0 && this.options?.interactive) {
|
|
244
|
-
this.handleMissingParams(command.params, params.result, command);
|
|
245
|
-
} else {
|
|
246
|
-
if (missingParams.length > 0) {
|
|
247
|
-
console.log(`
|
|
248
|
-
${colors_1.Colors.FgRed}error missing params${colors_1.Colors.Reset}
|
|
249
|
-
`);
|
|
250
|
-
missingParams.map((param) => {
|
|
251
|
-
console.log(`> ${colors_1.Colors.FgRed}${param.name}${colors_1.Colors.Reset}`);
|
|
252
|
-
console.log(` > ${colors_1.Colors.FgGray}Type: ${param.type}${colors_1.Colors.Reset}`);
|
|
253
|
-
console.log(` > ${colors_1.Colors.FgGray}Description: ${param.description}${colors_1.Colors.Reset}`);
|
|
254
|
-
if (param.options) {
|
|
255
|
-
console.log(` > ${colors_1.Colors.FgGray}Options: ${param.options}${colors_1.Colors.Reset}`);
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
console.log(`
|
|
259
|
-
${colors_1.Colors.FgYellow}Optional missing params${colors_1.Colors.Reset}
|
|
260
|
-
`);
|
|
261
|
-
this.getOptionalParams(command, params.result).map((param) => {
|
|
262
|
-
console.log(`> ${colors_1.Colors.FgYellow}${param.name}${colors_1.Colors.Reset}`);
|
|
263
|
-
console.log(` > ${colors_1.Colors.FgGray}Type: ${param.type}${colors_1.Colors.Reset}`);
|
|
264
|
-
console.log(` > ${colors_1.Colors.FgGray}Description: ${param.description}${colors_1.Colors.Reset}`);
|
|
265
|
-
if (param.options) {
|
|
266
|
-
console.log(` > ${colors_1.Colors.FgGray}Options: ${param.options}${colors_1.Colors.Reset}`);
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
process.exit(1);
|
|
270
|
-
}
|
|
271
|
-
command.action(params.result);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
help() {
|
|
275
|
-
console.log("");
|
|
276
|
-
console.log(`${colors_1.Colors.Bright}Welcome to ${colors_1.Colors.FgGreen}${this.name}${colors_1.Colors.Reset}`);
|
|
277
|
-
console.log("");
|
|
278
|
-
console.log(`${colors_1.Colors.FgYellow}${this.description}${colors_1.Colors.Reset}`);
|
|
279
|
-
console.log("");
|
|
280
|
-
console.log(`${colors_1.Colors.Bright}Available commands:${colors_1.Colors.Reset}`);
|
|
281
|
-
this.commands.forEach((cmd) => {
|
|
282
|
-
console.log(`${colors_1.Colors.FgGreen} ${cmd.name}${colors_1.Colors.Reset}: ${cmd.description}`);
|
|
283
|
-
});
|
|
284
|
-
console.log("");
|
|
285
|
-
}
|
|
286
|
-
commandHelp(command) {
|
|
287
|
-
console.log(`${colors_1.Colors.Bright}Help for command: ${colors_1.Colors.FgGreen}${command.name}${colors_1.Colors.Reset}`);
|
|
288
|
-
console.log(`${colors_1.Colors.FgGreen}Description:${colors_1.Colors.Reset} ${command.description}`);
|
|
289
|
-
if (command.params.length > 0) {
|
|
290
|
-
console.log(`${colors_1.Colors.FgGreen}Parameters:${colors_1.Colors.Reset}`);
|
|
291
|
-
command.params.forEach((param) => {
|
|
292
|
-
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)" : ""}`);
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
findCommand(commandName) {
|
|
297
|
-
return this.commands.find((cmd) => cmd.name === commandName);
|
|
298
|
-
}
|
|
299
|
-
showUnknownCommandError(commandName) {
|
|
300
|
-
console.log(`${colors_1.Colors.FgRed}Unknown command: ${commandName}${colors_1.Colors.Reset}`);
|
|
301
|
-
this.help();
|
|
302
|
-
}
|
|
303
|
-
getMissingParams(command, result) {
|
|
304
|
-
const requiredParams = command.params.filter((p) => p.required === true);
|
|
305
|
-
return requiredParams.filter((p) => result[p.name] === undefined);
|
|
306
|
-
}
|
|
307
|
-
getOptionalParams(command, result) {
|
|
308
|
-
const optionalParams = command.params.filter((p) => p.required === false || p.required === undefined);
|
|
309
|
-
return optionalParams.filter((p) => result[p.name] === undefined);
|
|
310
|
-
}
|
|
311
|
-
handleMissingParams(missingParams, result, command) {
|
|
312
|
-
if (this.options.interactive) {
|
|
313
|
-
this.promptForMissingParams(missingParams, result).then((fullParams) => {
|
|
314
|
-
command.action(fullParams);
|
|
315
|
-
});
|
|
316
|
-
} else {
|
|
317
|
-
console.log(`${colors_1.Colors.FgRed}Missing required parameters:${colors_1.Colors.Reset} ${missingParams.map((p) => p.name).join(", ")}`);
|
|
318
|
-
process.exit(1);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
parseArgs(args, command) {
|
|
322
|
-
const result = {};
|
|
323
|
-
for (const arg of args) {
|
|
324
|
-
const [key, value] = arg.split("=");
|
|
325
|
-
if (key.startsWith("--")) {
|
|
326
|
-
const paramName = key.slice(2);
|
|
327
|
-
const commandParam = command.params.find((p) => p.name === paramName);
|
|
328
|
-
if (commandParam) {
|
|
329
|
-
const validation = this.validateParam(value, commandParam.type, commandParam.required, commandParam.options, paramName);
|
|
330
|
-
if (validation.error) {
|
|
331
|
-
return { error: validation.error };
|
|
332
|
-
}
|
|
333
|
-
result[paramName] = validation.value;
|
|
334
|
-
} else {
|
|
335
|
-
return { error: `
|
|
336
|
-
Param ${colors_1.Colors.FgRed}${paramName}${colors_1.Colors.Reset} ${colors_1.Colors.Bright}is not allowed${colors_1.Colors.Reset}` };
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
return { result };
|
|
341
|
-
}
|
|
342
|
-
validateParam(value, type, isRequired, options, paramName) {
|
|
343
|
-
return this.validator.validateParam(value, type, isRequired, options, paramName);
|
|
344
|
-
}
|
|
345
|
-
findParamType(paramName) {
|
|
346
|
-
return this.commands.flatMap((command) => command.params).find((param) => param.name === paramName);
|
|
347
|
-
}
|
|
348
|
-
async promptForMissingParams(missingParams, existingParams) {
|
|
349
|
-
const rl = readline_1.default.createInterface({
|
|
350
|
-
input: process.stdin,
|
|
351
|
-
output: process.stdout
|
|
352
|
-
});
|
|
353
|
-
const askQuestion = (question) => {
|
|
354
|
-
return new Promise((resolve) => rl.question(question, resolve));
|
|
355
|
-
};
|
|
356
|
-
const prompts = missingParams.reduce((promise, param) => {
|
|
357
|
-
return promise.then(async (answers) => {
|
|
358
|
-
let answer;
|
|
359
|
-
let validation;
|
|
360
|
-
if (param.type === interfaces_1.ParamType.List && param.options) {
|
|
361
|
-
const isRequired = param.required ? "(required) " : "";
|
|
362
|
-
console.log(`
|
|
363
|
-
${colors_1.Colors.FgYellow}(${param.type}) ${colors_1.Colors.Reset}${colors_1.Colors.FgGreen}${param.name}${colors_1.Colors.Reset} `);
|
|
364
|
-
console.log(`${colors_1.Colors.FgYellow}> ${colors_1.Colors.Reset}${colors_1.Colors.FgGray}${isRequired}${param.description}:${colors_1.Colors.Reset}
|
|
365
|
-
`);
|
|
366
|
-
answer = await this.promptWithArrows(param);
|
|
367
|
-
validation = { value: param.options[parseInt(answer, 10)] };
|
|
368
|
-
} else {
|
|
369
|
-
do {
|
|
370
|
-
const isRequired = param.required ? "(required) " : "(Enter to skip) ";
|
|
371
|
-
const message = `
|
|
372
|
-
${colors_1.Colors.FgYellow}(${param.type}) ${colors_1.Colors.Reset}${colors_1.Colors.FgGreen}${param.name}${colors_1.Colors.Reset}
|
|
373
|
-
${colors_1.Colors.FgYellow}> ${colors_1.Colors.Reset}${colors_1.Colors.FgGray}${isRequired}${param.description}:${colors_1.Colors.Reset}
|
|
374
|
-
`;
|
|
375
|
-
answer = await askQuestion(message);
|
|
376
|
-
validation = this.validateParam(answer, param.type, param.required, param.options);
|
|
377
|
-
if (validation.error) {
|
|
378
|
-
console.log(validation.error);
|
|
379
|
-
}
|
|
380
|
-
} while (validation.error);
|
|
381
|
-
}
|
|
382
|
-
return { ...answers, [param.name]: validation.value };
|
|
383
|
-
});
|
|
384
|
-
}, Promise.resolve(existingParams));
|
|
385
|
-
return prompts.finally(() => rl.close());
|
|
386
|
-
}
|
|
387
|
-
async promptWithArrows(param) {
|
|
388
|
-
return new Promise((resolve) => {
|
|
389
|
-
let index = 0;
|
|
390
|
-
const options = param.options;
|
|
391
|
-
const renderOptions = () => {
|
|
392
|
-
options.forEach((option, i) => {
|
|
393
|
-
process.stdout.write("\x1B[2K\x1B[0G");
|
|
394
|
-
if (i === index) {
|
|
395
|
-
process.stdout.write(`${colors_1.Colors.FgGreen}> ${option}${colors_1.Colors.Reset}
|
|
396
|
-
`);
|
|
397
|
-
} else {
|
|
398
|
-
process.stdout.write(` ${option}
|
|
399
|
-
`);
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
process.stdout.write(`\x1B[${options.length}A`);
|
|
403
|
-
};
|
|
404
|
-
const clearLines = (numLines) => {
|
|
405
|
-
for (let i = 0;i < numLines; i++) {
|
|
406
|
-
process.stdout.write("\x1B[2K\x1B[1A");
|
|
407
|
-
}
|
|
408
|
-
process.stdout.write("\x1B[2K\x1B[0G");
|
|
409
|
-
};
|
|
410
|
-
const keypressHandler = (str, key) => {
|
|
411
|
-
if (key.name === "up") {
|
|
412
|
-
index = index > 0 ? index - 1 : options.length - 1;
|
|
413
|
-
renderOptions();
|
|
414
|
-
} else if (key.name === "down") {
|
|
415
|
-
index = (index + 1) % options.length;
|
|
416
|
-
renderOptions();
|
|
417
|
-
} else if (key.name === "return") {
|
|
418
|
-
process.stdin.removeListener("keypress", keypressHandler);
|
|
419
|
-
clearLines(options.length);
|
|
420
|
-
options.forEach((option, i) => {
|
|
421
|
-
if (i === index) {
|
|
422
|
-
process.stdout.write(`${colors_1.Colors.FgGreen}> ${option}${colors_1.Colors.Reset}
|
|
423
|
-
`);
|
|
424
|
-
} else {
|
|
425
|
-
process.stdout.write(` ${option}
|
|
426
|
-
`);
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
process.stdout.write(`
|
|
430
|
-
Selected: ${options[index]}
|
|
431
|
-
`);
|
|
432
|
-
resolve(index.toString());
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
readline_1.default.emitKeypressEvents(process.stdin);
|
|
437
|
-
if (process.stdin.isTTY) {
|
|
438
|
-
process.stdin.setRawMode(true);
|
|
439
|
-
}
|
|
440
|
-
process.stdin.on("keypress", keypressHandler);
|
|
441
|
-
renderOptions();
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
exports2.CLI = CLI;
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
// node_modules/@ideascol/cli-maker/dist/common.js
|
|
449
|
-
var require_common = __commonJS((exports2) => {
|
|
450
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
451
|
-
exports2.stripAnsiCodes = stripAnsiCodes;
|
|
452
|
-
function stripAnsiCodes(str) {
|
|
453
|
-
return str.replace(/[\u001b\u009b][[\]()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
// node_modules/@ideascol/cli-maker/dist/index.js
|
|
458
|
-
var require_dist = __commonJS((exports2) => {
|
|
459
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
460
|
-
exports2.stripAnsiCodes = exports2.ParamType = exports2.CLI = undefined;
|
|
461
|
-
var command_1 = require_command();
|
|
462
|
-
Object.defineProperty(exports2, "CLI", { enumerable: true, get: function() {
|
|
463
|
-
return command_1.CLI;
|
|
464
|
-
} });
|
|
465
|
-
var interfaces_1 = require_interfaces();
|
|
466
|
-
Object.defineProperty(exports2, "ParamType", { enumerable: true, get: function() {
|
|
467
|
-
return interfaces_1.ParamType;
|
|
468
|
-
} });
|
|
469
|
-
var common_1 = require_common();
|
|
470
|
-
Object.defineProperty(exports2, "stripAnsiCodes", { enumerable: true, get: function() {
|
|
471
|
-
return common_1.stripAnsiCodes;
|
|
472
|
-
} });
|
|
473
|
-
});
|
|
474
|
-
|
|
475
44
|
// src/lib/clients/agents-generator/core/ApiError.ts
|
|
476
45
|
var ApiError;
|
|
477
46
|
var init_ApiError = __esm(() => {
|
|
@@ -630,15 +199,15 @@ var isDefined = (value) => {
|
|
|
630
199
|
const append = (key, value) => {
|
|
631
200
|
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
632
201
|
};
|
|
633
|
-
const
|
|
202
|
+
const process = (key, value) => {
|
|
634
203
|
if (isDefined(value)) {
|
|
635
204
|
if (Array.isArray(value)) {
|
|
636
205
|
value.forEach((v) => {
|
|
637
|
-
|
|
206
|
+
process(key, v);
|
|
638
207
|
});
|
|
639
208
|
} else if (typeof value === "object") {
|
|
640
209
|
Object.entries(value).forEach(([k, v]) => {
|
|
641
|
-
|
|
210
|
+
process(`${key}[${k}]`, v);
|
|
642
211
|
});
|
|
643
212
|
} else {
|
|
644
213
|
append(key, value);
|
|
@@ -646,7 +215,7 @@ var isDefined = (value) => {
|
|
|
646
215
|
}
|
|
647
216
|
};
|
|
648
217
|
Object.entries(params).forEach(([key, value]) => {
|
|
649
|
-
|
|
218
|
+
process(key, value);
|
|
650
219
|
});
|
|
651
220
|
if (qs.length > 0) {
|
|
652
221
|
return `?${qs.join("&")}`;
|
|
@@ -668,7 +237,7 @@ var isDefined = (value) => {
|
|
|
668
237
|
}, getFormData = (options) => {
|
|
669
238
|
if (options.formData) {
|
|
670
239
|
const formData = new FormData;
|
|
671
|
-
const
|
|
240
|
+
const process = (key, value) => {
|
|
672
241
|
if (isString(value) || isBlob(value)) {
|
|
673
242
|
formData.append(key, value);
|
|
674
243
|
} else {
|
|
@@ -677,9 +246,9 @@ var isDefined = (value) => {
|
|
|
677
246
|
};
|
|
678
247
|
Object.entries(options.formData).filter(([_, value]) => isDefined(value)).forEach(([key, value]) => {
|
|
679
248
|
if (Array.isArray(value)) {
|
|
680
|
-
value.forEach((v) =>
|
|
249
|
+
value.forEach((v) => process(key, v));
|
|
681
250
|
} else {
|
|
682
|
-
|
|
251
|
+
process(key, value);
|
|
683
252
|
}
|
|
684
253
|
});
|
|
685
254
|
return formData;
|
|
@@ -962,12 +531,113 @@ var init_AgentService = __esm(() => {
|
|
|
962
531
|
});
|
|
963
532
|
|
|
964
533
|
// src/lib/clients/agents-generator/services/ConversationsService.ts
|
|
534
|
+
class ConversationsService {
|
|
535
|
+
static createConversationConversationsPost(requestBody) {
|
|
536
|
+
return request(OpenAPI, {
|
|
537
|
+
method: "POST",
|
|
538
|
+
url: "/conversations",
|
|
539
|
+
body: requestBody,
|
|
540
|
+
mediaType: "application/json",
|
|
541
|
+
errors: {
|
|
542
|
+
422: `Validation Error`
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
static getConversationConversationsConversationIdGet(conversationId) {
|
|
547
|
+
return request(OpenAPI, {
|
|
548
|
+
method: "GET",
|
|
549
|
+
url: "/conversations/{conversation_id}",
|
|
550
|
+
path: {
|
|
551
|
+
conversation_id: conversationId
|
|
552
|
+
},
|
|
553
|
+
errors: {
|
|
554
|
+
422: `Validation Error`
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
static updateConversationConversationsConversationIdPut(conversationId, requestBody) {
|
|
559
|
+
return request(OpenAPI, {
|
|
560
|
+
method: "PUT",
|
|
561
|
+
url: "/conversations/{conversation_id}",
|
|
562
|
+
path: {
|
|
563
|
+
conversation_id: conversationId
|
|
564
|
+
},
|
|
565
|
+
body: requestBody,
|
|
566
|
+
mediaType: "application/json",
|
|
567
|
+
errors: {
|
|
568
|
+
422: `Validation Error`
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
static deleteConversationConversationsConversationIdDelete(conversationId) {
|
|
573
|
+
return request(OpenAPI, {
|
|
574
|
+
method: "DELETE",
|
|
575
|
+
url: "/conversations/{conversation_id}",
|
|
576
|
+
path: {
|
|
577
|
+
conversation_id: conversationId
|
|
578
|
+
},
|
|
579
|
+
errors: {
|
|
580
|
+
422: `Validation Error`
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
static getAgentConversationsConversationsAgentAgentIdGet(agentId, skip, limit = 100) {
|
|
585
|
+
return request(OpenAPI, {
|
|
586
|
+
method: "GET",
|
|
587
|
+
url: "/conversations/agent/{agent_id}",
|
|
588
|
+
path: {
|
|
589
|
+
agent_id: agentId
|
|
590
|
+
},
|
|
591
|
+
query: {
|
|
592
|
+
skip,
|
|
593
|
+
limit
|
|
594
|
+
},
|
|
595
|
+
errors: {
|
|
596
|
+
422: `Validation Error`
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
static addMessageConversationsConversationIdMessagesPost(conversationId, requestBody) {
|
|
601
|
+
return request(OpenAPI, {
|
|
602
|
+
method: "POST",
|
|
603
|
+
url: "/conversations/{conversation_id}/messages",
|
|
604
|
+
path: {
|
|
605
|
+
conversation_id: conversationId
|
|
606
|
+
},
|
|
607
|
+
body: requestBody,
|
|
608
|
+
mediaType: "application/json",
|
|
609
|
+
errors: {
|
|
610
|
+
422: `Validation Error`
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
}
|
|
965
615
|
var init_ConversationsService = __esm(() => {
|
|
966
616
|
init_OpenAPI();
|
|
967
617
|
init_request();
|
|
968
618
|
});
|
|
969
619
|
|
|
970
620
|
// src/lib/clients/agents-generator/services/McpServersService.ts
|
|
621
|
+
class McpServersService {
|
|
622
|
+
static getMcpServersMcpServersGet() {
|
|
623
|
+
return request(OpenAPI, {
|
|
624
|
+
method: "GET",
|
|
625
|
+
url: "/mcp-servers"
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
static getMcpServerMcpServersServerIdGet(serverId) {
|
|
629
|
+
return request(OpenAPI, {
|
|
630
|
+
method: "GET",
|
|
631
|
+
url: "/mcp-servers/{server_id}",
|
|
632
|
+
path: {
|
|
633
|
+
server_id: serverId
|
|
634
|
+
},
|
|
635
|
+
errors: {
|
|
636
|
+
422: `Validation Error`
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
}
|
|
971
641
|
var init_McpServersService = __esm(() => {
|
|
972
642
|
init_OpenAPI();
|
|
973
643
|
init_request();
|
|
@@ -1004,78 +674,19 @@ var init_agents_generator = __esm(() => {
|
|
|
1004
674
|
init_RootService();
|
|
1005
675
|
});
|
|
1006
676
|
|
|
1007
|
-
// src/commands/agentsCommand.ts
|
|
1008
|
-
var import_cli_maker, commandAgents, agentsCommand_default;
|
|
1009
|
-
var init_agentsCommand = __esm(() => {
|
|
1010
|
-
import_cli_maker = __toESM(require_dist());
|
|
1011
|
-
init_agents_generator();
|
|
1012
|
-
commandAgents = {
|
|
1013
|
-
name: "getAgents",
|
|
1014
|
-
description: "Get the list of agents",
|
|
1015
|
-
params: [{
|
|
1016
|
-
name: "URL",
|
|
1017
|
-
description: "The URL of the API",
|
|
1018
|
-
required: true,
|
|
1019
|
-
type: import_cli_maker.ParamType.Url
|
|
1020
|
-
}],
|
|
1021
|
-
action: async (args) => {
|
|
1022
|
-
OpenAPI["BASE"] = args.URL;
|
|
1023
|
-
const agents = await AgentService.getAgentsAgentsGet();
|
|
1024
|
-
const hello = await RootService.healthCheckHealthGet();
|
|
1025
|
-
console.log(hello);
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
|
-
agentsCommand_default = commandAgents;
|
|
1029
|
-
});
|
|
1030
|
-
|
|
1031
|
-
// src/commands/rootCommand.ts
|
|
1032
|
-
var import_cli_maker2, rootCommand, rootCommand_default;
|
|
1033
|
-
var init_rootCommand = __esm(() => {
|
|
1034
|
-
import_cli_maker2 = __toESM(require_dist());
|
|
1035
|
-
init_agents_generator();
|
|
1036
|
-
rootCommand = {
|
|
1037
|
-
name: "version",
|
|
1038
|
-
description: "Get the version of the API",
|
|
1039
|
-
params: [{
|
|
1040
|
-
name: "URL",
|
|
1041
|
-
description: "The URL of the API",
|
|
1042
|
-
required: false,
|
|
1043
|
-
type: import_cli_maker2.ParamType.Url
|
|
1044
|
-
}],
|
|
1045
|
-
action: async (args) => {
|
|
1046
|
-
OpenAPI["BASE"] = args.URL || "https://api.agentsgenerator.dev/";
|
|
1047
|
-
console.log(OpenAPI);
|
|
1048
|
-
const hello = await RootService.healthCheckHealthGet();
|
|
1049
|
-
console.log(hello);
|
|
1050
|
-
}
|
|
1051
|
-
};
|
|
1052
|
-
rootCommand_default = rootCommand;
|
|
1053
|
-
});
|
|
1054
|
-
|
|
1055
|
-
// src/cli.ts
|
|
1056
|
-
var exports_cli = {};
|
|
1057
|
-
__export(exports_cli, {
|
|
1058
|
-
cli: () => cli
|
|
1059
|
-
});
|
|
1060
|
-
var import_cli_maker3, cli;
|
|
1061
|
-
var init_cli = __esm(() => {
|
|
1062
|
-
import_cli_maker3 = __toESM(require_dist());
|
|
1063
|
-
init_agents_generator();
|
|
1064
|
-
init_agentsCommand();
|
|
1065
|
-
init_rootCommand();
|
|
1066
|
-
cli = new import_cli_maker3.CLI("@ideascol/agents-generator-sdk", "agents-generator-sdk", {
|
|
1067
|
-
interactive: true,
|
|
1068
|
-
version: OpenAPI.VERSION
|
|
1069
|
-
});
|
|
1070
|
-
cli.command(rootCommand_default);
|
|
1071
|
-
cli.command(agentsCommand_default);
|
|
1072
|
-
cli.parse(process.argv);
|
|
1073
|
-
});
|
|
1074
|
-
|
|
1075
677
|
// src/index.ts
|
|
1076
678
|
var exports_src = {};
|
|
1077
679
|
__export(exports_src, {
|
|
1078
|
-
|
|
680
|
+
RootService: () => RootService,
|
|
681
|
+
OpenAPI: () => OpenAPI,
|
|
682
|
+
McpServersService: () => McpServersService,
|
|
683
|
+
ConversationsService: () => ConversationsService,
|
|
684
|
+
CancelablePromise: () => CancelablePromise,
|
|
685
|
+
CancelError: () => CancelError,
|
|
686
|
+
ApiError: () => ApiError,
|
|
687
|
+
AgentService: () => AgentService
|
|
1079
688
|
});
|
|
1080
689
|
module.exports = __toCommonJS(exports_src);
|
|
1081
|
-
|
|
690
|
+
|
|
691
|
+
// src/lib/index.ts
|
|
692
|
+
init_agents_generator();
|