@inkeep/agents-core 0.32.1 → 0.33.0

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.
@@ -2,9 +2,9 @@
2
2
 
3
3
  var zod = require('zod');
4
4
  var zodOpenapi = require('@hono/zod-openapi');
5
- var drizzleZod = require('drizzle-zod');
6
5
  var drizzleOrm = require('drizzle-orm');
7
6
  var pgCore = require('drizzle-orm/pg-core');
7
+ var drizzleZod = require('drizzle-zod');
8
8
  var Ajv = require('ajv');
9
9
  var auth_js = require('@modelcontextprotocol/sdk/client/auth.js');
10
10
 
@@ -992,6 +992,151 @@ drizzleOrm.relations(
992
992
  })
993
993
  })
994
994
  );
995
+ var MIN_ID_LENGTH = 1;
996
+ var MAX_ID_LENGTH = 255;
997
+ var URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
998
+ var resourceIdSchema = zodOpenapi.z.string().min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).describe("Resource identifier").regex(URL_SAFE_ID_PATTERN, {
999
+ message: "ID must contain only letters, numbers, hyphens, underscores, and dots"
1000
+ }).openapi({
1001
+ description: "Resource identifier",
1002
+ example: "resource_789"
1003
+ });
1004
+ resourceIdSchema.meta({
1005
+ description: "Resource identifier"
1006
+ });
1007
+ var FIELD_MODIFIERS = {
1008
+ id: (schema) => {
1009
+ const modified = schema.min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).describe("Resource identifier").regex(URL_SAFE_ID_PATTERN, {
1010
+ message: "ID must contain only letters, numbers, hyphens, underscores, and dots"
1011
+ }).openapi({
1012
+ description: "Resource identifier",
1013
+ example: "resource_789"
1014
+ });
1015
+ modified.meta({
1016
+ description: "Resource identifier"
1017
+ });
1018
+ return modified;
1019
+ },
1020
+ name: (_schema) => {
1021
+ const modified = zodOpenapi.z.string().describe("Name");
1022
+ modified.meta({ description: "Name" });
1023
+ return modified;
1024
+ },
1025
+ description: (_schema) => {
1026
+ const modified = zodOpenapi.z.string().describe("Description");
1027
+ modified.meta({ description: "Description" });
1028
+ return modified;
1029
+ },
1030
+ tenantId: (schema) => {
1031
+ const modified = schema.describe("Tenant identifier");
1032
+ modified.meta({ description: "Tenant identifier" });
1033
+ return modified;
1034
+ },
1035
+ projectId: (schema) => {
1036
+ const modified = schema.describe("Project identifier");
1037
+ modified.meta({ description: "Project identifier" });
1038
+ return modified;
1039
+ },
1040
+ agentId: (schema) => {
1041
+ const modified = schema.describe("Agent identifier");
1042
+ modified.meta({ description: "Agent identifier" });
1043
+ return modified;
1044
+ },
1045
+ subAgentId: (schema) => {
1046
+ const modified = schema.describe("Sub-agent identifier");
1047
+ modified.meta({ description: "Sub-agent identifier" });
1048
+ return modified;
1049
+ },
1050
+ createdAt: (schema) => {
1051
+ const modified = schema.describe("Creation timestamp");
1052
+ modified.meta({ description: "Creation timestamp" });
1053
+ return modified;
1054
+ },
1055
+ updatedAt: (schema) => {
1056
+ const modified = schema.describe("Last update timestamp");
1057
+ modified.meta({ description: "Last update timestamp" });
1058
+ return modified;
1059
+ }
1060
+ };
1061
+ function createSelectSchemaWithModifiers(table, overrides) {
1062
+ const tableColumns = table._?.columns;
1063
+ if (!tableColumns) {
1064
+ return drizzleZod.createSelectSchema(table, overrides);
1065
+ }
1066
+ const tableFieldNames = Object.keys(tableColumns);
1067
+ const modifiers = {};
1068
+ for (const fieldName of tableFieldNames) {
1069
+ const fieldNameStr = String(fieldName);
1070
+ if (fieldNameStr in FIELD_MODIFIERS) {
1071
+ modifiers[fieldNameStr] = FIELD_MODIFIERS[fieldNameStr];
1072
+ }
1073
+ }
1074
+ const mergedModifiers = { ...modifiers, ...overrides };
1075
+ return drizzleZod.createSelectSchema(table, mergedModifiers);
1076
+ }
1077
+ function createInsertSchemaWithModifiers(table, overrides) {
1078
+ const tableColumns = table._?.columns;
1079
+ if (!tableColumns) {
1080
+ return drizzleZod.createInsertSchema(table, overrides);
1081
+ }
1082
+ const tableFieldNames = Object.keys(tableColumns);
1083
+ const modifiers = {};
1084
+ for (const fieldName of tableFieldNames) {
1085
+ const fieldNameStr = String(fieldName);
1086
+ if (fieldNameStr in FIELD_MODIFIERS) {
1087
+ modifiers[fieldNameStr] = FIELD_MODIFIERS[fieldNameStr];
1088
+ }
1089
+ }
1090
+ const mergedModifiers = { ...modifiers, ...overrides };
1091
+ return drizzleZod.createInsertSchema(table, mergedModifiers);
1092
+ }
1093
+ var createSelectSchema = createSelectSchemaWithModifiers;
1094
+ var createInsertSchema = createInsertSchemaWithModifiers;
1095
+ function registerFieldSchemas(schema) {
1096
+ if (!(schema instanceof zodOpenapi.z.ZodObject)) {
1097
+ return schema;
1098
+ }
1099
+ const shape = schema.shape;
1100
+ const fieldMetadata = {
1101
+ id: { description: "Resource identifier" },
1102
+ name: { description: "Name" },
1103
+ description: { description: "Description" },
1104
+ tenantId: { description: "Tenant identifier" },
1105
+ projectId: { description: "Project identifier" },
1106
+ agentId: { description: "Agent identifier" },
1107
+ subAgentId: { description: "Sub-agent identifier" },
1108
+ createdAt: { description: "Creation timestamp" },
1109
+ updatedAt: { description: "Last update timestamp" }
1110
+ };
1111
+ for (const [fieldName, fieldSchema] of Object.entries(shape)) {
1112
+ if (fieldName in fieldMetadata && fieldSchema) {
1113
+ let zodFieldSchema = fieldSchema;
1114
+ let innerSchema = null;
1115
+ if (zodFieldSchema instanceof zodOpenapi.z.ZodOptional) {
1116
+ innerSchema = zodFieldSchema._def.innerType;
1117
+ zodFieldSchema = innerSchema;
1118
+ }
1119
+ zodFieldSchema.meta(fieldMetadata[fieldName]);
1120
+ if (fieldName === "id" && zodFieldSchema instanceof zodOpenapi.z.ZodString) {
1121
+ zodFieldSchema.openapi({
1122
+ description: "Resource identifier",
1123
+ minLength: MIN_ID_LENGTH,
1124
+ maxLength: MAX_ID_LENGTH,
1125
+ pattern: URL_SAFE_ID_PATTERN.source,
1126
+ example: "resource_789"
1127
+ });
1128
+ } else if (zodFieldSchema instanceof zodOpenapi.z.ZodString) {
1129
+ zodFieldSchema.openapi({
1130
+ description: fieldMetadata[fieldName].description
1131
+ });
1132
+ }
1133
+ if (innerSchema && fieldSchema instanceof zodOpenapi.z.ZodOptional) {
1134
+ fieldSchema.meta(fieldMetadata[fieldName]);
1135
+ }
1136
+ }
1137
+ }
1138
+ return schema;
1139
+ }
995
1140
 
996
1141
  // src/validation/schemas.ts
997
1142
  var {
@@ -1015,14 +1160,8 @@ var AgentStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true }).openapi
1015
1160
  var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true }).openapi(
1016
1161
  "SubAgentStopWhen"
1017
1162
  );
1018
- var MIN_ID_LENGTH = 1;
1019
- var MAX_ID_LENGTH = 255;
1020
- var URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
1021
- var resourceIdSchema = zodOpenapi.z.string().min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).describe("Resource identifier").regex(URL_SAFE_ID_PATTERN, {
1022
- message: "ID must contain only letters, numbers, hyphens, underscores, and dots"
1023
- }).openapi({
1024
- example: "resource_789"
1025
- });
1163
+ var pageNumber = zodOpenapi.z.coerce.number().min(1).default(1).openapi("PaginationPageQueryParam");
1164
+ var limitNumber = zodOpenapi.z.coerce.number().min(1).max(100).default(10).openapi("PaginationLimitQueryParam");
1026
1165
  var ModelSettingsSchema = zodOpenapi.z.object({
1027
1166
  model: zodOpenapi.z.string().optional().describe("The model to use for the project."),
1028
1167
  providerOptions: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.any()).optional().describe("The provider options to use for the project.")
@@ -1050,8 +1189,8 @@ var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId:
1050
1189
  var createAgentScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
1051
1190
  var createAgentScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
1052
1191
  var createAgentScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true }).partial();
1053
- var SubAgentSelectSchema = drizzleZod.createSelectSchema(subAgents);
1054
- var SubAgentInsertSchema = drizzleZod.createInsertSchema(subAgents).extend({
1192
+ var SubAgentSelectSchema = createSelectSchema(subAgents);
1193
+ var SubAgentInsertSchema = createInsertSchema(subAgents).extend({
1055
1194
  id: resourceIdSchema,
1056
1195
  models: ModelSchema.optional()
1057
1196
  });
@@ -1059,8 +1198,8 @@ var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
1059
1198
  var SubAgentApiSelectSchema = createAgentScopedApiSchema(SubAgentSelectSchema).openapi("SubAgent");
1060
1199
  var SubAgentApiInsertSchema = createAgentScopedApiInsertSchema(SubAgentInsertSchema).openapi("SubAgentCreate");
1061
1200
  createAgentScopedApiUpdateSchema(SubAgentUpdateSchema).openapi("SubAgentUpdate");
1062
- var SubAgentRelationSelectSchema = drizzleZod.createSelectSchema(subAgentRelations);
1063
- var SubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
1201
+ var SubAgentRelationSelectSchema = createSelectSchema(subAgentRelations);
1202
+ var SubAgentRelationInsertSchema = createInsertSchema(subAgentRelations).extend({
1064
1203
  id: resourceIdSchema,
1065
1204
  agentId: resourceIdSchema,
1066
1205
  sourceSubAgentId: resourceIdSchema,
@@ -1115,7 +1254,7 @@ zodOpenapi.z.object({
1115
1254
  externalSubAgentId: zodOpenapi.z.string().optional(),
1116
1255
  teamSubAgentId: zodOpenapi.z.string().optional()
1117
1256
  });
1118
- var ExternalSubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
1257
+ var ExternalSubAgentRelationInsertSchema = createInsertSchema(subAgentRelations).extend({
1119
1258
  id: resourceIdSchema,
1120
1259
  agentId: resourceIdSchema,
1121
1260
  sourceSubAgentId: resourceIdSchema,
@@ -1124,8 +1263,8 @@ var ExternalSubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgen
1124
1263
  createApiInsertSchema(
1125
1264
  ExternalSubAgentRelationInsertSchema
1126
1265
  );
1127
- var AgentSelectSchema = drizzleZod.createSelectSchema(agents);
1128
- var AgentInsertSchema = drizzleZod.createInsertSchema(agents).extend({
1266
+ var AgentSelectSchema = createSelectSchema(agents);
1267
+ var AgentInsertSchema = createInsertSchema(agents).extend({
1129
1268
  id: resourceIdSchema,
1130
1269
  name: zodOpenapi.z.string().trim().nonempty()
1131
1270
  });
@@ -1135,8 +1274,8 @@ var AgentApiInsertSchema = createApiInsertSchema(AgentInsertSchema).extend({
1135
1274
  id: resourceIdSchema
1136
1275
  }).openapi("AgentCreate");
1137
1276
  createApiUpdateSchema(AgentUpdateSchema).openapi("AgentUpdate");
1138
- var TaskSelectSchema = drizzleZod.createSelectSchema(tasks);
1139
- var TaskInsertSchema = drizzleZod.createInsertSchema(tasks).extend({
1277
+ var TaskSelectSchema = createSelectSchema(tasks);
1278
+ var TaskInsertSchema = createInsertSchema(tasks).extend({
1140
1279
  id: resourceIdSchema,
1141
1280
  conversationId: resourceIdSchema.optional()
1142
1281
  });
@@ -1144,8 +1283,8 @@ var TaskUpdateSchema = TaskInsertSchema.partial();
1144
1283
  createApiSchema(TaskSelectSchema);
1145
1284
  createApiInsertSchema(TaskInsertSchema);
1146
1285
  createApiUpdateSchema(TaskUpdateSchema);
1147
- var TaskRelationSelectSchema = drizzleZod.createSelectSchema(taskRelations);
1148
- var TaskRelationInsertSchema = drizzleZod.createInsertSchema(taskRelations).extend({
1286
+ var TaskRelationSelectSchema = createSelectSchema(taskRelations);
1287
+ var TaskRelationInsertSchema = createInsertSchema(taskRelations).extend({
1149
1288
  id: resourceIdSchema,
1150
1289
  parentTaskId: resourceIdSchema,
1151
1290
  childTaskId: resourceIdSchema
@@ -1189,8 +1328,8 @@ var McpToolDefinitionSchema = zodOpenapi.z.object({
1189
1328
  description: zodOpenapi.z.string().optional(),
1190
1329
  inputSchema: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional()
1191
1330
  });
1192
- var ToolSelectSchema = drizzleZod.createSelectSchema(tools);
1193
- var ToolInsertSchema = drizzleZod.createInsertSchema(tools).extend({
1331
+ var ToolSelectSchema = createSelectSchema(tools);
1332
+ var ToolInsertSchema = createInsertSchema(tools).extend({
1194
1333
  id: resourceIdSchema,
1195
1334
  imageUrl: imageUrlSchema,
1196
1335
  config: zodOpenapi.z.object({
@@ -1213,8 +1352,8 @@ var ToolInsertSchema = drizzleZod.createInsertSchema(tools).extend({
1213
1352
  })
1214
1353
  })
1215
1354
  });
1216
- var ConversationSelectSchema = drizzleZod.createSelectSchema(conversations);
1217
- var ConversationInsertSchema = drizzleZod.createInsertSchema(conversations).extend({
1355
+ var ConversationSelectSchema = createSelectSchema(conversations);
1356
+ var ConversationInsertSchema = createInsertSchema(conversations).extend({
1218
1357
  id: resourceIdSchema,
1219
1358
  contextConfigId: resourceIdSchema.optional()
1220
1359
  });
@@ -1222,8 +1361,8 @@ var ConversationUpdateSchema = ConversationInsertSchema.partial();
1222
1361
  var ConversationApiSelectSchema = createApiSchema(ConversationSelectSchema).openapi("Conversation");
1223
1362
  createApiInsertSchema(ConversationInsertSchema).openapi("ConversationCreate");
1224
1363
  createApiUpdateSchema(ConversationUpdateSchema).openapi("ConversationUpdate");
1225
- var MessageSelectSchema = drizzleZod.createSelectSchema(messages);
1226
- var MessageInsertSchema = drizzleZod.createInsertSchema(messages).extend({
1364
+ var MessageSelectSchema = createSelectSchema(messages);
1365
+ var MessageInsertSchema = createInsertSchema(messages).extend({
1227
1366
  id: resourceIdSchema,
1228
1367
  conversationId: resourceIdSchema,
1229
1368
  taskId: resourceIdSchema.optional()
@@ -1232,14 +1371,14 @@ var MessageUpdateSchema = MessageInsertSchema.partial();
1232
1371
  var MessageApiSelectSchema = createApiSchema(MessageSelectSchema).openapi("Message");
1233
1372
  createApiInsertSchema(MessageInsertSchema).openapi("MessageCreate");
1234
1373
  createApiUpdateSchema(MessageUpdateSchema).openapi("MessageUpdate");
1235
- var ContextCacheSelectSchema = drizzleZod.createSelectSchema(contextCache);
1236
- var ContextCacheInsertSchema = drizzleZod.createInsertSchema(contextCache);
1374
+ var ContextCacheSelectSchema = createSelectSchema(contextCache);
1375
+ var ContextCacheInsertSchema = createInsertSchema(contextCache);
1237
1376
  var ContextCacheUpdateSchema = ContextCacheInsertSchema.partial();
1238
1377
  createApiSchema(ContextCacheSelectSchema);
1239
1378
  createApiInsertSchema(ContextCacheInsertSchema);
1240
1379
  createApiUpdateSchema(ContextCacheUpdateSchema);
1241
- var DataComponentSelectSchema = drizzleZod.createSelectSchema(dataComponents);
1242
- var DataComponentInsertSchema = drizzleZod.createInsertSchema(dataComponents).extend({
1380
+ var DataComponentSelectSchema = createSelectSchema(dataComponents);
1381
+ var DataComponentInsertSchema = createInsertSchema(dataComponents).extend({
1243
1382
  id: resourceIdSchema
1244
1383
  });
1245
1384
  DataComponentInsertSchema.omit({
@@ -1250,8 +1389,8 @@ var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
1250
1389
  var DataComponentApiSelectSchema = createApiSchema(DataComponentSelectSchema).openapi("DataComponent");
1251
1390
  var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema).openapi("DataComponentCreate");
1252
1391
  createApiUpdateSchema(DataComponentUpdateSchema).openapi("DataComponentUpdate");
1253
- var SubAgentDataComponentSelectSchema = drizzleZod.createSelectSchema(subAgentDataComponents);
1254
- var SubAgentDataComponentInsertSchema = drizzleZod.createInsertSchema(subAgentDataComponents);
1392
+ var SubAgentDataComponentSelectSchema = createSelectSchema(subAgentDataComponents);
1393
+ var SubAgentDataComponentInsertSchema = createInsertSchema(subAgentDataComponents);
1255
1394
  var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
1256
1395
  var SubAgentDataComponentApiSelectSchema = createAgentScopedApiSchema(
1257
1396
  SubAgentDataComponentSelectSchema
@@ -1265,8 +1404,8 @@ SubAgentDataComponentInsertSchema.omit({
1265
1404
  createAgentScopedApiUpdateSchema(
1266
1405
  SubAgentDataComponentUpdateSchema
1267
1406
  );
1268
- var ArtifactComponentSelectSchema = drizzleZod.createSelectSchema(artifactComponents);
1269
- var ArtifactComponentInsertSchema = drizzleZod.createInsertSchema(artifactComponents).extend({
1407
+ var ArtifactComponentSelectSchema = createSelectSchema(artifactComponents);
1408
+ var ArtifactComponentInsertSchema = createInsertSchema(artifactComponents).extend({
1270
1409
  id: resourceIdSchema
1271
1410
  });
1272
1411
  var ArtifactComponentUpdateSchema = ArtifactComponentInsertSchema.partial();
@@ -1282,8 +1421,8 @@ var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
1282
1421
  createApiUpdateSchema(
1283
1422
  ArtifactComponentUpdateSchema
1284
1423
  ).openapi("ArtifactComponentUpdate");
1285
- var SubAgentArtifactComponentSelectSchema = drizzleZod.createSelectSchema(subAgentArtifactComponents);
1286
- var SubAgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
1424
+ var SubAgentArtifactComponentSelectSchema = createSelectSchema(subAgentArtifactComponents);
1425
+ var SubAgentArtifactComponentInsertSchema = createInsertSchema(
1287
1426
  subAgentArtifactComponents
1288
1427
  ).extend({
1289
1428
  id: resourceIdSchema,
@@ -1303,10 +1442,10 @@ SubAgentArtifactComponentInsertSchema.omit({
1303
1442
  createAgentScopedApiUpdateSchema(
1304
1443
  SubAgentArtifactComponentUpdateSchema
1305
1444
  );
1306
- var ExternalAgentSelectSchema = drizzleZod.createSelectSchema(externalAgents).extend({
1445
+ var ExternalAgentSelectSchema = createSelectSchema(externalAgents).extend({
1307
1446
  credentialReferenceId: zodOpenapi.z.string().nullable().optional()
1308
1447
  });
1309
- var ExternalAgentInsertSchema = drizzleZod.createInsertSchema(externalAgents).extend({
1448
+ var ExternalAgentInsertSchema = createInsertSchema(externalAgents).extend({
1310
1449
  id: resourceIdSchema
1311
1450
  });
1312
1451
  var ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
@@ -1317,8 +1456,8 @@ zodOpenapi.z.discriminatedUnion("type", [
1317
1456
  SubAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
1318
1457
  ExternalAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("external") })
1319
1458
  ]);
1320
- var ApiKeySelectSchema = drizzleZod.createSelectSchema(apiKeys);
1321
- var ApiKeyInsertSchema = drizzleZod.createInsertSchema(apiKeys).extend({
1459
+ var ApiKeySelectSchema = createSelectSchema(apiKeys);
1460
+ var ApiKeyInsertSchema = createInsertSchema(apiKeys).extend({
1322
1461
  id: resourceIdSchema,
1323
1462
  agentId: resourceIdSchema
1324
1463
  });
@@ -1369,7 +1508,7 @@ var CredentialReferenceSelectSchema = zodOpenapi.z.object({
1369
1508
  createdAt: zodOpenapi.z.string(),
1370
1509
  updatedAt: zodOpenapi.z.string()
1371
1510
  });
1372
- var CredentialReferenceInsertSchema = drizzleZod.createInsertSchema(credentialReferences).extend({
1511
+ var CredentialReferenceInsertSchema = createInsertSchema(credentialReferences).extend({
1373
1512
  id: resourceIdSchema,
1374
1513
  type: zodOpenapi.z.string(),
1375
1514
  credentialStoreId: resourceIdSchema,
@@ -1412,12 +1551,12 @@ zodOpenapi.z.object({
1412
1551
  createdAt: zodOpenapi.z.string().describe("ISO timestamp of creation")
1413
1552
  })
1414
1553
  }).openapi("CreateCredentialInStoreResponse");
1415
- zodOpenapi.z.object({
1554
+ var RelatedAgentInfoSchema = zodOpenapi.z.object({
1416
1555
  id: zodOpenapi.z.string(),
1417
1556
  name: zodOpenapi.z.string(),
1418
1557
  description: zodOpenapi.z.string()
1419
1558
  }).openapi("RelatedAgentInfo");
1420
- zodOpenapi.z.object({
1559
+ var ComponentAssociationSchema = zodOpenapi.z.object({
1421
1560
  subAgentId: zodOpenapi.z.string(),
1422
1561
  createdAt: zodOpenapi.z.string()
1423
1562
  }).openapi("ComponentAssociation");
@@ -1440,7 +1579,7 @@ var McpToolSchema = ToolInsertSchema.extend({
1440
1579
  createdAt: zodOpenapi.z.date(),
1441
1580
  updatedAt: zodOpenapi.z.date(),
1442
1581
  expiresAt: zodOpenapi.z.date().optional()
1443
- });
1582
+ }).openapi("McpTool");
1444
1583
  McpToolSchema.omit({
1445
1584
  config: true,
1446
1585
  tenantId: true,
@@ -1464,16 +1603,16 @@ var ToolUpdateSchema = ToolInsertSchema.partial();
1464
1603
  var ToolApiSelectSchema = createApiSchema(ToolSelectSchema).openapi("Tool");
1465
1604
  var ToolApiInsertSchema = createApiInsertSchema(ToolInsertSchema).openapi("ToolCreate");
1466
1605
  createApiUpdateSchema(ToolUpdateSchema).openapi("ToolUpdate");
1467
- var FunctionToolSelectSchema = drizzleZod.createSelectSchema(functionTools);
1468
- var FunctionToolInsertSchema = drizzleZod.createInsertSchema(functionTools).extend({
1606
+ var FunctionToolSelectSchema = createSelectSchema(functionTools);
1607
+ var FunctionToolInsertSchema = createInsertSchema(functionTools).extend({
1469
1608
  id: resourceIdSchema
1470
1609
  });
1471
1610
  var FunctionToolUpdateSchema = FunctionToolInsertSchema.partial();
1472
1611
  var FunctionToolApiSelectSchema = createApiSchema(FunctionToolSelectSchema).openapi("FunctionTool");
1473
1612
  var FunctionToolApiInsertSchema = createAgentScopedApiInsertSchema(FunctionToolInsertSchema).openapi("FunctionToolCreate");
1474
1613
  createApiUpdateSchema(FunctionToolUpdateSchema).openapi("FunctionToolUpdate");
1475
- var FunctionSelectSchema = drizzleZod.createSelectSchema(functions);
1476
- var FunctionInsertSchema = drizzleZod.createInsertSchema(functions).extend({
1614
+ var FunctionSelectSchema = createSelectSchema(functions);
1615
+ var FunctionInsertSchema = createInsertSchema(functions).extend({
1477
1616
  id: resourceIdSchema
1478
1617
  });
1479
1618
  var FunctionUpdateSchema = FunctionInsertSchema.partial();
@@ -1501,13 +1640,13 @@ zodOpenapi.z.object({
1501
1640
  }),
1502
1641
  credential: CredentialReferenceApiInsertSchema.optional()
1503
1642
  }).openapi("FetchDefinition");
1504
- var ContextConfigSelectSchema = drizzleZod.createSelectSchema(contextConfigs).extend({
1643
+ var ContextConfigSelectSchema = createSelectSchema(contextConfigs).extend({
1505
1644
  headersSchema: zodOpenapi.z.any().optional().openapi({
1506
1645
  type: "object",
1507
1646
  description: "JSON Schema for validating request headers"
1508
1647
  })
1509
1648
  });
1510
- var ContextConfigInsertSchema = drizzleZod.createInsertSchema(contextConfigs).extend({
1649
+ var ContextConfigInsertSchema = createInsertSchema(contextConfigs).extend({
1511
1650
  id: resourceIdSchema.optional(),
1512
1651
  headersSchema: zodOpenapi.z.any().nullable().optional().openapi({
1513
1652
  type: "object",
@@ -1531,8 +1670,8 @@ var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSche
1531
1670
  createApiUpdateSchema(ContextConfigUpdateSchema).omit({
1532
1671
  agentId: true
1533
1672
  }).openapi("ContextConfigUpdate");
1534
- var SubAgentToolRelationSelectSchema = drizzleZod.createSelectSchema(subAgentToolRelations);
1535
- var SubAgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToolRelations).extend({
1673
+ var SubAgentToolRelationSelectSchema = createSelectSchema(subAgentToolRelations);
1674
+ var SubAgentToolRelationInsertSchema = createInsertSchema(subAgentToolRelations).extend({
1536
1675
  id: resourceIdSchema,
1537
1676
  subAgentId: resourceIdSchema,
1538
1677
  toolId: resourceIdSchema,
@@ -1549,10 +1688,10 @@ createAgentScopedApiInsertSchema(
1549
1688
  createAgentScopedApiUpdateSchema(
1550
1689
  SubAgentToolRelationUpdateSchema
1551
1690
  ).openapi("SubAgentToolRelationUpdate");
1552
- var SubAgentExternalAgentRelationSelectSchema = drizzleZod.createSelectSchema(
1691
+ var SubAgentExternalAgentRelationSelectSchema = createSelectSchema(
1553
1692
  subAgentExternalAgentRelations
1554
1693
  );
1555
- var SubAgentExternalAgentRelationInsertSchema = drizzleZod.createInsertSchema(
1694
+ var SubAgentExternalAgentRelationInsertSchema = createInsertSchema(
1556
1695
  subAgentExternalAgentRelations
1557
1696
  ).extend({
1558
1697
  id: resourceIdSchema,
@@ -1561,7 +1700,7 @@ var SubAgentExternalAgentRelationInsertSchema = drizzleZod.createInsertSchema(
1561
1700
  headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
1562
1701
  });
1563
1702
  var SubAgentExternalAgentRelationUpdateSchema = SubAgentExternalAgentRelationInsertSchema.partial();
1564
- createAgentScopedApiSchema(
1703
+ var SubAgentExternalAgentRelationApiSelectSchema = createAgentScopedApiSchema(
1565
1704
  SubAgentExternalAgentRelationSelectSchema
1566
1705
  ).openapi("SubAgentExternalAgentRelation");
1567
1706
  createAgentScopedApiInsertSchema(
@@ -1570,8 +1709,8 @@ createAgentScopedApiInsertSchema(
1570
1709
  createAgentScopedApiUpdateSchema(
1571
1710
  SubAgentExternalAgentRelationUpdateSchema
1572
1711
  ).openapi("SubAgentExternalAgentRelationUpdate");
1573
- var SubAgentTeamAgentRelationSelectSchema = drizzleZod.createSelectSchema(subAgentTeamAgentRelations);
1574
- var SubAgentTeamAgentRelationInsertSchema = drizzleZod.createInsertSchema(
1712
+ var SubAgentTeamAgentRelationSelectSchema = createSelectSchema(subAgentTeamAgentRelations);
1713
+ var SubAgentTeamAgentRelationInsertSchema = createInsertSchema(
1575
1714
  subAgentTeamAgentRelations
1576
1715
  ).extend({
1577
1716
  id: resourceIdSchema,
@@ -1580,7 +1719,7 @@ var SubAgentTeamAgentRelationInsertSchema = drizzleZod.createInsertSchema(
1580
1719
  headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
1581
1720
  });
1582
1721
  var SubAgentTeamAgentRelationUpdateSchema = SubAgentTeamAgentRelationInsertSchema.partial();
1583
- createAgentScopedApiSchema(
1722
+ var SubAgentTeamAgentRelationApiSelectSchema = createAgentScopedApiSchema(
1584
1723
  SubAgentTeamAgentRelationSelectSchema
1585
1724
  ).openapi("SubAgentTeamAgentRelation");
1586
1725
  createAgentScopedApiInsertSchema(
@@ -1589,8 +1728,8 @@ createAgentScopedApiInsertSchema(
1589
1728
  createAgentScopedApiUpdateSchema(
1590
1729
  SubAgentTeamAgentRelationUpdateSchema
1591
1730
  ).openapi("SubAgentTeamAgentRelationUpdate");
1592
- var LedgerArtifactSelectSchema = drizzleZod.createSelectSchema(ledgerArtifacts);
1593
- var LedgerArtifactInsertSchema = drizzleZod.createInsertSchema(ledgerArtifacts);
1731
+ var LedgerArtifactSelectSchema = createSelectSchema(ledgerArtifacts);
1732
+ var LedgerArtifactInsertSchema = createInsertSchema(ledgerArtifacts);
1594
1733
  var LedgerArtifactUpdateSchema = LedgerArtifactInsertSchema.partial();
1595
1734
  createApiSchema(LedgerArtifactSelectSchema);
1596
1735
  createApiInsertSchema(LedgerArtifactInsertSchema);
@@ -1624,17 +1763,17 @@ var canDelegateToExternalAgentSchema = zodOpenapi.z.object({
1624
1763
  externalAgentId: zodOpenapi.z.string(),
1625
1764
  subAgentExternalAgentRelationId: zodOpenapi.z.string().optional(),
1626
1765
  headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
1627
- });
1766
+ }).openapi("CanDelegateToExternalAgent");
1628
1767
  var canDelegateToTeamAgentSchema = zodOpenapi.z.object({
1629
1768
  agentId: zodOpenapi.z.string(),
1630
1769
  subAgentTeamAgentRelationId: zodOpenapi.z.string().optional(),
1631
1770
  headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
1632
- });
1771
+ }).openapi("CanDelegateToTeamAgent");
1633
1772
  var TeamAgentSchema = zodOpenapi.z.object({
1634
1773
  id: zodOpenapi.z.string(),
1635
1774
  name: zodOpenapi.z.string(),
1636
1775
  description: zodOpenapi.z.string()
1637
- });
1776
+ }).openapi("TeamAgent");
1638
1777
  var FullAgentAgentInsertSchema = SubAgentApiInsertSchema.extend({
1639
1778
  type: zodOpenapi.z.literal("internal"),
1640
1779
  canUse: zodOpenapi.z.array(CanUseItemSchema),
@@ -1653,7 +1792,7 @@ var FullAgentAgentInsertSchema = SubAgentApiInsertSchema.extend({
1653
1792
  // Team agent with headers
1654
1793
  ])
1655
1794
  ).optional()
1656
- });
1795
+ }).openapi("FullAgentAgentInsert");
1657
1796
  var AgentWithinContextOfProjectSchema = AgentApiInsertSchema.extend({
1658
1797
  subAgents: zodOpenapi.z.record(zodOpenapi.z.string(), FullAgentAgentInsertSchema),
1659
1798
  // Lookup maps for UI to resolve canUse items
@@ -1675,10 +1814,10 @@ var AgentWithinContextOfProjectSchema = AgentApiInsertSchema.extend({
1675
1814
  VALIDATION_AGENT_PROMPT_MAX_CHARS,
1676
1815
  `Agent prompt cannot exceed ${VALIDATION_AGENT_PROMPT_MAX_CHARS} characters`
1677
1816
  ).optional()
1678
- });
1817
+ }).openapi("AgentWithinContextOfProject");
1679
1818
  var PaginationSchema = zodOpenapi.z.object({
1680
- page: zodOpenapi.z.coerce.number().min(1).default(1),
1681
- limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10),
1819
+ page: pageNumber,
1820
+ limit: limitNumber,
1682
1821
  total: zodOpenapi.z.number(),
1683
1822
  pages: zodOpenapi.z.number()
1684
1823
  }).openapi("Pagination");
@@ -1696,25 +1835,31 @@ zodOpenapi.z.object({
1696
1835
  message: zodOpenapi.z.string(),
1697
1836
  removed: zodOpenapi.z.boolean()
1698
1837
  }).openapi("RemovedResponse");
1699
- var ProjectSelectSchema = drizzleZod.createSelectSchema(projects);
1700
- var ProjectInsertSchema = drizzleZod.createInsertSchema(projects).extend({
1838
+ var ProjectSelectSchema = registerFieldSchemas(
1839
+ createSelectSchema(projects).extend({
1840
+ models: ProjectModelSchema.nullable(),
1841
+ stopWhen: StopWhenSchema.nullable()
1842
+ })
1843
+ );
1844
+ var ProjectInsertSchema = createInsertSchema(projects).extend({
1701
1845
  models: ProjectModelSchema,
1702
1846
  stopWhen: StopWhenSchema.optional()
1703
1847
  }).omit({
1704
1848
  createdAt: true,
1705
1849
  updatedAt: true
1706
1850
  });
1707
- var ProjectUpdateSchema = ProjectInsertSchema.partial();
1851
+ var ProjectUpdateSchema = ProjectInsertSchema.partial().omit({
1852
+ id: true,
1853
+ tenantId: true
1854
+ });
1708
1855
  var ProjectApiSelectSchema = ProjectSelectSchema.omit({ tenantId: true }).openapi(
1709
1856
  "Project"
1710
1857
  );
1711
1858
  var ProjectApiInsertSchema = ProjectInsertSchema.omit({ tenantId: true }).openapi(
1712
1859
  "ProjectCreate"
1713
1860
  );
1714
- ProjectUpdateSchema.omit({ tenantId: true }).openapi(
1715
- "ProjectUpdate"
1716
- );
1717
- ProjectApiInsertSchema.extend({
1861
+ ProjectUpdateSchema.openapi("ProjectUpdate");
1862
+ var FullProjectDefinitionSchema = ProjectApiInsertSchema.extend({
1718
1863
  agents: zodOpenapi.z.record(zodOpenapi.z.string(), AgentWithinContextOfProjectSchema),
1719
1864
  tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema),
1720
1865
  functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
@@ -1726,7 +1871,7 @@ ProjectApiInsertSchema.extend({
1726
1871
  credentialReferences: zodOpenapi.z.record(zodOpenapi.z.string(), CredentialReferenceApiInsertSchema).optional(),
1727
1872
  createdAt: zodOpenapi.z.string().optional(),
1728
1873
  updatedAt: zodOpenapi.z.string().optional()
1729
- });
1874
+ }).openapi("FullProjectDefinition");
1730
1875
  zodOpenapi.z.object({ data: ProjectApiSelectSchema }).openapi("ProjectResponse");
1731
1876
  zodOpenapi.z.object({ data: SubAgentApiSelectSchema }).openapi("SubAgentResponse");
1732
1877
  zodOpenapi.z.object({ data: AgentApiSelectSchema }).openapi("AgentResponse");
@@ -1817,6 +1962,30 @@ zodOpenapi.z.object({
1817
1962
  data: zodOpenapi.z.array(SubAgentArtifactComponentApiSelectSchema),
1818
1963
  pagination: PaginationSchema
1819
1964
  }).openapi("SubAgentArtifactComponentListResponse");
1965
+ zodOpenapi.z.object({ data: FullProjectDefinitionSchema }).openapi("FullProjectDefinitionResponse");
1966
+ zodOpenapi.z.object({ data: AgentWithinContextOfProjectSchema }).openapi("AgentWithinContextOfProjectResponse");
1967
+ zodOpenapi.z.object({
1968
+ data: zodOpenapi.z.array(RelatedAgentInfoSchema),
1969
+ pagination: PaginationSchema
1970
+ }).openapi("RelatedAgentInfoListResponse");
1971
+ zodOpenapi.z.object({ data: zodOpenapi.z.array(ComponentAssociationSchema) }).openapi("ComponentAssociationListResponse");
1972
+ zodOpenapi.z.object({ data: McpToolSchema }).openapi("McpToolResponse");
1973
+ zodOpenapi.z.object({
1974
+ data: zodOpenapi.z.array(McpToolSchema),
1975
+ pagination: PaginationSchema
1976
+ }).openapi("McpToolListResponse");
1977
+ zodOpenapi.z.object({ data: SubAgentTeamAgentRelationApiSelectSchema }).openapi("SubAgentTeamAgentRelationResponse");
1978
+ zodOpenapi.z.object({
1979
+ data: zodOpenapi.z.array(SubAgentTeamAgentRelationApiSelectSchema),
1980
+ pagination: PaginationSchema
1981
+ }).openapi("SubAgentTeamAgentRelationListResponse");
1982
+ zodOpenapi.z.object({ data: SubAgentExternalAgentRelationApiSelectSchema }).openapi("SubAgentExternalAgentRelationResponse");
1983
+ zodOpenapi.z.object({
1984
+ data: zodOpenapi.z.array(SubAgentExternalAgentRelationApiSelectSchema),
1985
+ pagination: PaginationSchema
1986
+ }).openapi("SubAgentExternalAgentRelationListResponse");
1987
+ zodOpenapi.z.object({ data: zodOpenapi.z.array(DataComponentApiSelectSchema) }).openapi("DataComponentArrayResponse");
1988
+ zodOpenapi.z.object({ data: zodOpenapi.z.array(ArtifactComponentApiSelectSchema) }).openapi("ArtifactComponentArrayResponse");
1820
1989
  zodOpenapi.z.object({
1821
1990
  "x-inkeep-tenant-id": zodOpenapi.z.string().optional().openapi({
1822
1991
  description: "Tenant identifier",
@@ -1831,50 +2000,66 @@ zodOpenapi.z.object({
1831
2000
  example: "agent_789"
1832
2001
  })
1833
2002
  });
1834
- var TenantId = zodOpenapi.z.string().openapi({
2003
+ var TenantId = zodOpenapi.z.string().openapi("TenantIdPathParam", {
2004
+ param: {
2005
+ name: "tenantId",
2006
+ in: "path"
2007
+ },
1835
2008
  description: "Tenant identifier",
1836
2009
  example: "tenant_123"
1837
2010
  });
1838
- var ProjectId = zodOpenapi.z.string().openapi({
2011
+ var ProjectId = zodOpenapi.z.string().openapi("ProjectIdPathParam", {
2012
+ param: {
2013
+ name: "projectId",
2014
+ in: "path"
2015
+ },
1839
2016
  description: "Project identifier",
1840
2017
  example: "project_456"
1841
2018
  });
1842
- var AgentId = zodOpenapi.z.string().openapi({
2019
+ var AgentId = zodOpenapi.z.string().openapi("AgentIdPathParam", {
2020
+ param: {
2021
+ name: "agentId",
2022
+ in: "path"
2023
+ },
1843
2024
  description: "Agent identifier",
1844
2025
  example: "agent_789"
1845
2026
  });
1846
- var SubAgentId = zodOpenapi.z.string().openapi({
2027
+ var SubAgentId = zodOpenapi.z.string().openapi("SubAgentIdPathParam", {
2028
+ param: {
2029
+ name: "subAgentId",
2030
+ in: "path"
2031
+ },
1847
2032
  description: "Sub-agent identifier",
1848
2033
  example: "sub_agent_123"
1849
2034
  });
1850
2035
  var TenantParamsSchema = zodOpenapi.z.object({
1851
2036
  tenantId: TenantId
1852
- }).openapi("TenantParams");
2037
+ });
1853
2038
  TenantParamsSchema.extend({
1854
2039
  id: resourceIdSchema
1855
- }).openapi("TenantIdParams");
2040
+ });
1856
2041
  var TenantProjectParamsSchema = TenantParamsSchema.extend({
1857
2042
  projectId: ProjectId
1858
- }).openapi("TenantProjectParams");
2043
+ });
1859
2044
  TenantProjectParamsSchema.extend({
1860
2045
  id: resourceIdSchema
1861
- }).openapi("TenantProjectIdParams");
2046
+ });
1862
2047
  var TenantProjectAgentParamsSchema = TenantProjectParamsSchema.extend({
1863
2048
  agentId: AgentId
1864
- }).openapi("TenantProjectAgentParams");
2049
+ });
1865
2050
  TenantProjectAgentParamsSchema.extend({
1866
2051
  id: resourceIdSchema
1867
- }).openapi("TenantProjectAgentIdParams");
2052
+ });
1868
2053
  var TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentParamsSchema.extend({
1869
2054
  subAgentId: SubAgentId
1870
- }).openapi("TenantProjectAgentSubAgentParams");
2055
+ });
1871
2056
  TenantProjectAgentSubAgentParamsSchema.extend({
1872
2057
  id: resourceIdSchema
1873
- }).openapi("TenantProjectAgentSubAgentIdParams");
1874
- zodOpenapi.z.object({
1875
- page: zodOpenapi.z.coerce.number().min(1).default(1),
1876
- limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10)
1877
2058
  });
2059
+ zodOpenapi.z.object({
2060
+ page: pageNumber,
2061
+ limit: limitNumber
2062
+ }).openapi("PaginationQueryParams");
1878
2063
  function validatePropsAsJsonSchema(props) {
1879
2064
  if (!props || typeof props === "object" && Object.keys(props).length === 0) {
1880
2065
  return {