@xuda.io/xuda-studio-checker 1.0.26 → 1.0.27
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/index.mjs +212 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1209,6 +1209,218 @@ const check_route = function (doc) {
|
|
|
1209
1209
|
|
|
1210
1210
|
const check_ai_agent = function (doc) {
|
|
1211
1211
|
var ret = [];
|
|
1212
|
+
if (!doc?.agentConfig) {
|
|
1213
|
+
ret.push({
|
|
1214
|
+
code: 'CHK_MSG_PRG_AGN_010',
|
|
1215
|
+
data: 'Ai Agent agentConfig not defined',
|
|
1216
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1217
|
+
category: `ai_agent`,
|
|
1218
|
+
ref: doc._id,
|
|
1219
|
+
id: `${doc._id}`,
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
if (!doc?.agentConfig?.agent_instructions) {
|
|
1224
|
+
ret.push({
|
|
1225
|
+
code: 'CHK_MSG_PRG_AGN_020',
|
|
1226
|
+
data: 'Ai Agent instructions is required',
|
|
1227
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1228
|
+
category: `ai_agent`,
|
|
1229
|
+
ref: doc._id,
|
|
1230
|
+
id: `${doc._id}`,
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
if (doc?.agentConfig?.agent_instructions?.length < 10) {
|
|
1235
|
+
ret.push({
|
|
1236
|
+
code: 'CHK_MSG_PRG_AGN_030',
|
|
1237
|
+
data: 'Ai Agent instructions is too short',
|
|
1238
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1239
|
+
category: `ai_agent`,
|
|
1240
|
+
ref: doc._id,
|
|
1241
|
+
id: `${doc._id}`,
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
if (!doc?.agentConfig?.agent_instructions?.agent_tools?.length && doc?.agentConfig?.use_tools_only) {
|
|
1246
|
+
ret.push({
|
|
1247
|
+
code: 'CHK_MSG_PRG_AGN_040',
|
|
1248
|
+
data: 'Ai Agent use_tools_only set to true but could not find agent_tools configuration',
|
|
1249
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1250
|
+
category: `ai_agent`,
|
|
1251
|
+
ref: doc._id,
|
|
1252
|
+
id: `${doc._id}`,
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
for (const tool of doc?.agentConfig?.agent_tools || []) {
|
|
1257
|
+
switch (tool.type) {
|
|
1258
|
+
case 'file_search': {
|
|
1259
|
+
if (_.isEmpty(tool.file)) {
|
|
1260
|
+
ret.push({
|
|
1261
|
+
code: 'CHK_MSG_PRG_AGN_100',
|
|
1262
|
+
data: 'Ai Agent file_search set but could not find file configuration',
|
|
1263
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1264
|
+
category: `ai_agent`,
|
|
1265
|
+
ref: doc._id,
|
|
1266
|
+
id: `${doc._id}`,
|
|
1267
|
+
});
|
|
1268
|
+
} else {
|
|
1269
|
+
if (_.isEmpty(tool?.file?.access_link)) {
|
|
1270
|
+
ret.push({
|
|
1271
|
+
code: 'CHK_MSG_PRG_AGN_110',
|
|
1272
|
+
data: 'Ai Agent file_search set but could not find file configuration',
|
|
1273
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1274
|
+
category: `ai_agent`,
|
|
1275
|
+
ref: doc._id,
|
|
1276
|
+
id: `${doc._id}`,
|
|
1277
|
+
});
|
|
1278
|
+
} else {
|
|
1279
|
+
if (_.isEmpty(tool?.file?.file_id)) {
|
|
1280
|
+
ret.push({
|
|
1281
|
+
code: 'CHK_MSG_PRG_AGN_120',
|
|
1282
|
+
data: 'Ai Agent file_search set but could not find file uploaded',
|
|
1283
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1284
|
+
category: `ai_agent`,
|
|
1285
|
+
ref: doc._id,
|
|
1286
|
+
id: `${doc._id}`,
|
|
1287
|
+
});
|
|
1288
|
+
} else {
|
|
1289
|
+
if (_.isEmpty(tool?.file?.vector_file_id)) {
|
|
1290
|
+
ret.push({
|
|
1291
|
+
code: 'CHK_MSG_PRG_AGN_130',
|
|
1292
|
+
data: 'Ai Agent file_search set but could not find vector_file uploaded',
|
|
1293
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1294
|
+
category: `ai_agent`,
|
|
1295
|
+
ref: doc._id,
|
|
1296
|
+
id: `${doc._id}`,
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
break;
|
|
1303
|
+
}
|
|
1304
|
+
case 'youtube': {
|
|
1305
|
+
if (_.isEmpty(tool?.youtube?.url)) {
|
|
1306
|
+
ret.push({
|
|
1307
|
+
code: 'CHK_MSG_PRG_AGN_200',
|
|
1308
|
+
data: 'Ai Agent youtube set but could not find url',
|
|
1309
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1310
|
+
category: `ai_agent`,
|
|
1311
|
+
ref: doc._id,
|
|
1312
|
+
id: `${doc._id}`,
|
|
1313
|
+
});
|
|
1314
|
+
} else {
|
|
1315
|
+
if (_.isEmpty(tool?.youtube?.file_id)) {
|
|
1316
|
+
ret.push({
|
|
1317
|
+
code: 'CHK_MSG_PRG_AGN_210',
|
|
1318
|
+
data: 'Ai Agent youtube set but could not find file uploaded',
|
|
1319
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1320
|
+
category: `ai_agent`,
|
|
1321
|
+
ref: doc._id,
|
|
1322
|
+
id: `${doc._id}`,
|
|
1323
|
+
});
|
|
1324
|
+
} else {
|
|
1325
|
+
if (_.isEmpty(tool?.youtube?.vector_store_id)) {
|
|
1326
|
+
ret.push({
|
|
1327
|
+
code: 'CHK_MSG_PRG_AGN_220',
|
|
1328
|
+
data: 'Ai Agent youtube set but could not find vector_file uploaded',
|
|
1329
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1330
|
+
category: `ai_agent`,
|
|
1331
|
+
ref: doc._id,
|
|
1332
|
+
id: `${doc._id}`,
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
break;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
case 'mcp': {
|
|
1341
|
+
if (_.isEmpty(tool?.url)) {
|
|
1342
|
+
ret.push({
|
|
1343
|
+
code: 'CHK_MSG_PRG_AGN_310',
|
|
1344
|
+
data: 'Ai Agent mcp tool set but could not find url',
|
|
1345
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1346
|
+
category: `ai_agent`,
|
|
1347
|
+
ref: doc._id,
|
|
1348
|
+
id: `${doc._id}`,
|
|
1349
|
+
});
|
|
1350
|
+
} else {
|
|
1351
|
+
if (tool?.url.substr(0, 7) !== 'https://') {
|
|
1352
|
+
ret.push({
|
|
1353
|
+
code: 'CHK_MSG_PRG_AGN_320',
|
|
1354
|
+
data: 'Ai Agent mcp tool set but found invalid url',
|
|
1355
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1356
|
+
category: `ai_agent`,
|
|
1357
|
+
ref: doc._id,
|
|
1358
|
+
id: `${doc._id}`,
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
break;
|
|
1363
|
+
}
|
|
1364
|
+
case 'cpi': {
|
|
1365
|
+
break;
|
|
1366
|
+
}
|
|
1367
|
+
case 'table': {
|
|
1368
|
+
if (_.isEmpty(tool?.prog_id)) {
|
|
1369
|
+
ret.push({
|
|
1370
|
+
code: 'CHK_MSG_PRG_AGN_410',
|
|
1371
|
+
data: 'Ai Agent table tool set but could not find table id',
|
|
1372
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1373
|
+
category: `ai_agent`,
|
|
1374
|
+
ref: doc._id,
|
|
1375
|
+
id: `${doc._id}`,
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
case 'ai_agent': {
|
|
1381
|
+
break;
|
|
1382
|
+
}
|
|
1383
|
+
case 'plugin': {
|
|
1384
|
+
if (_.isEmpty(tool?.plugin_id)) {
|
|
1385
|
+
ret.push({
|
|
1386
|
+
code: 'CHK_MSG_PRG_AGN_510',
|
|
1387
|
+
data: 'Ai Agent plugin tool set but could not find plugin id',
|
|
1388
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1389
|
+
category: `ai_agent`,
|
|
1390
|
+
ref: doc._id,
|
|
1391
|
+
id: `${doc._id}`,
|
|
1392
|
+
});
|
|
1393
|
+
} else {
|
|
1394
|
+
if (_.isEmpty(tool?.method)) {
|
|
1395
|
+
ret.push({
|
|
1396
|
+
code: 'CHK_MSG_PRG_AGN_520',
|
|
1397
|
+
data: 'Ai Agent plugin tool set but could not find method property',
|
|
1398
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1399
|
+
category: `ai_agent`,
|
|
1400
|
+
ref: doc._id,
|
|
1401
|
+
id: `${doc._id}`,
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
break;
|
|
1406
|
+
}
|
|
1407
|
+
case 'program': {
|
|
1408
|
+
if (_.isEmpty(tool?.prog_id)) {
|
|
1409
|
+
ret.push({
|
|
1410
|
+
code: 'CHK_MSG_PRG_AGN_410',
|
|
1411
|
+
data: 'Ai Agent program tool set but could not find program id',
|
|
1412
|
+
type: doc.studio_meta.not_in_use ? 'W' : 'E',
|
|
1413
|
+
category: `ai_agent`,
|
|
1414
|
+
ref: doc._id,
|
|
1415
|
+
id: `${doc._id}`,
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
break;
|
|
1419
|
+
}
|
|
1420
|
+
default:
|
|
1421
|
+
break;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1212
1424
|
|
|
1213
1425
|
return ret;
|
|
1214
1426
|
};
|