@inkeep/agents-core 0.0.0-dev-20251010175818 → 0.0.0-dev-20251010183741
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/{chunk-NEJ3QDK6.js → chunk-E4SFK6AI.js} +50 -30
- package/dist/{chunk-5LRSB445.js → chunk-ID4CFGVF.js} +88 -14
- package/dist/{chunk-2TJ2L67D.js → chunk-JTHQYGCX.js} +1 -1
- package/dist/client-exports.cjs +133 -43
- package/dist/client-exports.d.cts +2 -2
- package/dist/client-exports.d.ts +2 -2
- package/dist/client-exports.js +2 -2
- package/dist/db/schema.cjs +87 -13
- package/dist/db/schema.d.cts +2 -2
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +992 -424
- package/dist/index.d.cts +168 -54
- package/dist/index.d.ts +168 -54
- package/dist/index.js +835 -382
- package/dist/{schema-BwkT6bbU.d.cts → schema-Bjy5TkFv.d.cts} +358 -38
- package/dist/{schema-B6nVWV--.d.ts → schema-CfWbqju2.d.ts} +358 -38
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/{utility-D_8q6Vlh.d.cts → utility-Fxoh7s82.d.cts} +409 -137
- package/dist/{utility-D_8q6Vlh.d.ts → utility-Fxoh7s82.d.ts} +409 -137
- package/dist/validation/index.cjs +138 -41
- package/dist/validation/index.d.cts +2 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/drizzle/0006_damp_lenny_balinger.sql +52 -0
- package/drizzle/meta/0006_snapshot.json +2751 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { ACTIVITY_NAMES, ACTIVITY_STATUS, ACTIVITY_TYPES, AGENT_IDS, AGGREGATE_OPERATORS, AI_OPERATIONS, AI_TOOL_TYPES, DATA_SOURCES, DATA_TYPES, DELEGATION_FROM_SUB_AGENT_ID, DELEGATION_ID, DELEGATION_TO_SUB_AGENT_ID, FIELD_TYPES, OPERATORS, ORDER_DIRECTIONS, PANEL_TYPES, QUERY_DEFAULTS, QUERY_EXPRESSIONS, QUERY_FIELD_CONFIGS, QUERY_TYPES, REDUCE_OPERATIONS, SPAN_KEYS, SPAN_NAMES, TOOL_NAMES, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, UNKNOWN_VALUE } from './chunk-TCLX6C3C.js';
|
|
2
2
|
export { TaskState } from './chunk-H2F72PDA.js';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
9
|
-
import { schema_exports, contextConfigs, externalAgents, functions, subAgentRelations, subAgents, subAgentToolRelations, tools, credentialReferences, agentGraph, subAgentDataComponents, subAgentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, ledgerArtifacts, tasks, taskRelations } from './chunk-5LRSB445.js';
|
|
10
|
-
export { agentGraph, agentGraphRelations, agentToolRelationsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, functions, functionsRelations, ledgerArtifacts, ledgerArtifactsRelations, messages, messagesRelations, projects, projectsRelations, subAgentArtifactComponents, subAgentArtifactComponentsRelations, subAgentDataComponents, subAgentDataComponentsRelations, subAgentRelations, subAgentRelationsRelations, subAgentToolRelations, subAgents, subAgentsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-5LRSB445.js';
|
|
3
|
+
import { validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-JTHQYGCX.js';
|
|
4
|
+
export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-JTHQYGCX.js';
|
|
5
|
+
import { ContextConfigApiUpdateSchema, validatePropsAsJsonSchema } from './chunk-E4SFK6AI.js';
|
|
6
|
+
export { AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, ExternalSubAgentRelationApiInsertSchema, ExternalSubAgentRelationInsertSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, FunctionInsertSchema, FunctionSelectSchema, FunctionToolApiInsertSchema, FunctionToolApiSelectSchema, FunctionToolApiUpdateSchema, FunctionToolConfigSchema, FunctionToolInsertSchema, FunctionToolSelectSchema, FunctionToolUpdateSchema, FunctionUpdateSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SandboxConfigSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, SubAgentApiInsertSchema, SubAgentApiSelectSchema, SubAgentApiUpdateSchema, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, SubAgentArtifactComponentApiUpdateSchema, SubAgentArtifactComponentInsertSchema, SubAgentArtifactComponentSelectSchema, SubAgentArtifactComponentUpdateSchema, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, SubAgentDataComponentApiUpdateSchema, SubAgentDataComponentInsertSchema, SubAgentDataComponentSelectSchema, SubAgentDataComponentUpdateSchema, SubAgentInsertSchema, SubAgentRelationApiInsertSchema, SubAgentRelationApiSelectSchema, SubAgentRelationApiUpdateSchema, SubAgentRelationInsertSchema, SubAgentRelationQuerySchema, SubAgentRelationSelectSchema, SubAgentRelationUpdateSchema, SubAgentSelectSchema, SubAgentStopWhenSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationSelectSchema, SubAgentToolRelationUpdateSchema, SubAgentUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectGraphSubAgentIdParamsSchema, TenantProjectGraphSubAgentParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema, validatePropsAsJsonSchema } from './chunk-E4SFK6AI.js';
|
|
7
|
+
import { schema_exports, contextConfigs, externalAgents, functions, functionTools, agentFunctionToolRelations, subAgentRelations, subAgents, subAgentToolRelations, tools, credentialReferences, agentGraph, subAgentDataComponents, subAgentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, ledgerArtifacts, tasks, taskRelations } from './chunk-ID4CFGVF.js';
|
|
8
|
+
export { agentFunctionToolRelations, agentFunctionToolRelationsRelations, agentGraph, agentGraphRelations, agentToolRelationsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, functionTools, functionToolsRelations, functions, functionsRelations, ledgerArtifacts, ledgerArtifactsRelations, messages, messagesRelations, projects, projectsRelations, subAgentArtifactComponents, subAgentArtifactComponentsRelations, subAgentDataComponents, subAgentDataComponentsRelations, subAgentRelations, subAgentRelationsRelations, subAgentToolRelations, subAgents, subAgentsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-ID4CFGVF.js';
|
|
11
9
|
import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-YFHT5M2R.js';
|
|
12
10
|
export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-YFHT5M2R.js';
|
|
11
|
+
import { getLogger, convertZodToJsonSchema } from './chunk-R2EERZSW.js';
|
|
12
|
+
export { PinoLogger, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, getLogger, isZodSchema, loggerFactory, preview } from './chunk-R2EERZSW.js';
|
|
13
13
|
import { __publicField } from './chunk-MKBO26DX.js';
|
|
14
14
|
import { z as z$1 } from 'zod';
|
|
15
15
|
import { customAlphabet, nanoid } from 'nanoid';
|
|
@@ -556,11 +556,11 @@ function getCredentialStoreLookupKeyFromRetrievalParams({
|
|
|
556
556
|
|
|
557
557
|
// src/credential-stuffer/CredentialStuffer.ts
|
|
558
558
|
var CredentialStuffer = class {
|
|
559
|
-
constructor(credentialStoreRegistry, contextResolver,
|
|
559
|
+
constructor(credentialStoreRegistry, contextResolver, logger13) {
|
|
560
560
|
this.credentialStoreRegistry = credentialStoreRegistry;
|
|
561
561
|
this.contextResolver = contextResolver;
|
|
562
562
|
__publicField(this, "logger");
|
|
563
|
-
this.logger =
|
|
563
|
+
this.logger = logger13 || getLogger("credential-stuffer");
|
|
564
564
|
}
|
|
565
565
|
/**
|
|
566
566
|
* Retrieve credentials from credential store registry
|
|
@@ -1114,6 +1114,212 @@ var deleteFunction = (db) => async (params) => {
|
|
|
1114
1114
|
)
|
|
1115
1115
|
);
|
|
1116
1116
|
};
|
|
1117
|
+
var logger3 = getLogger("functionTools");
|
|
1118
|
+
var getFunctionToolById = (db) => async (params) => {
|
|
1119
|
+
const result = await db.select().from(functionTools).where(
|
|
1120
|
+
and(
|
|
1121
|
+
eq(functionTools.tenantId, params.scopes.tenantId),
|
|
1122
|
+
eq(functionTools.projectId, params.scopes.projectId),
|
|
1123
|
+
eq(functionTools.graphId, params.scopes.graphId),
|
|
1124
|
+
eq(functionTools.id, params.functionToolId)
|
|
1125
|
+
)
|
|
1126
|
+
).limit(1);
|
|
1127
|
+
return result[0] ?? null;
|
|
1128
|
+
};
|
|
1129
|
+
var listFunctionTools = (db) => async (params) => {
|
|
1130
|
+
const page = params.pagination?.page || 1;
|
|
1131
|
+
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
1132
|
+
const offset = (page - 1) * limit;
|
|
1133
|
+
const whereClause = and(
|
|
1134
|
+
eq(functionTools.tenantId, params.scopes.tenantId),
|
|
1135
|
+
eq(functionTools.projectId, params.scopes.projectId),
|
|
1136
|
+
eq(functionTools.graphId, params.scopes.graphId)
|
|
1137
|
+
);
|
|
1138
|
+
const [functionToolsDbResults, totalResult] = await Promise.all([
|
|
1139
|
+
db.select().from(functionTools).where(whereClause).limit(limit).offset(offset).orderBy(desc(functionTools.createdAt)),
|
|
1140
|
+
db.select({ count: count() }).from(functionTools).where(whereClause)
|
|
1141
|
+
]);
|
|
1142
|
+
const total = totalResult[0]?.count || 0;
|
|
1143
|
+
const pages = Math.ceil(total / limit);
|
|
1144
|
+
return {
|
|
1145
|
+
data: functionToolsDbResults,
|
|
1146
|
+
pagination: { page, limit, total, pages }
|
|
1147
|
+
};
|
|
1148
|
+
};
|
|
1149
|
+
var createFunctionTool = (db) => async (params) => {
|
|
1150
|
+
const { data, scopes } = params;
|
|
1151
|
+
const { tenantId, projectId, graphId } = scopes;
|
|
1152
|
+
const [created] = await db.insert(functionTools).values({
|
|
1153
|
+
tenantId,
|
|
1154
|
+
projectId,
|
|
1155
|
+
graphId,
|
|
1156
|
+
id: data.id,
|
|
1157
|
+
name: data.name,
|
|
1158
|
+
description: data.description,
|
|
1159
|
+
functionId: data.functionId,
|
|
1160
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1161
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1162
|
+
}).returning();
|
|
1163
|
+
return created;
|
|
1164
|
+
};
|
|
1165
|
+
var updateFunctionTool = (db) => async (params) => {
|
|
1166
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1167
|
+
const [updated] = await db.update(functionTools).set({
|
|
1168
|
+
...params.data,
|
|
1169
|
+
updatedAt: now
|
|
1170
|
+
}).where(
|
|
1171
|
+
and(
|
|
1172
|
+
eq(functionTools.tenantId, params.scopes.tenantId),
|
|
1173
|
+
eq(functionTools.projectId, params.scopes.projectId),
|
|
1174
|
+
eq(functionTools.graphId, params.scopes.graphId),
|
|
1175
|
+
eq(functionTools.id, params.functionToolId)
|
|
1176
|
+
)
|
|
1177
|
+
).returning();
|
|
1178
|
+
return updated ?? null;
|
|
1179
|
+
};
|
|
1180
|
+
var deleteFunctionTool = (db) => async (params) => {
|
|
1181
|
+
const [deleted] = await db.delete(functionTools).where(
|
|
1182
|
+
and(
|
|
1183
|
+
eq(functionTools.tenantId, params.scopes.tenantId),
|
|
1184
|
+
eq(functionTools.projectId, params.scopes.projectId),
|
|
1185
|
+
eq(functionTools.graphId, params.scopes.graphId),
|
|
1186
|
+
eq(functionTools.id, params.functionToolId)
|
|
1187
|
+
)
|
|
1188
|
+
).returning();
|
|
1189
|
+
return !!deleted;
|
|
1190
|
+
};
|
|
1191
|
+
var upsertFunctionTool = (db) => async (params) => {
|
|
1192
|
+
const scopes = {
|
|
1193
|
+
tenantId: params.scopes.tenantId,
|
|
1194
|
+
projectId: params.scopes.projectId,
|
|
1195
|
+
graphId: params.scopes.graphId
|
|
1196
|
+
};
|
|
1197
|
+
const existing = await getFunctionToolById(db)({
|
|
1198
|
+
scopes,
|
|
1199
|
+
functionToolId: params.data.id
|
|
1200
|
+
});
|
|
1201
|
+
if (existing) {
|
|
1202
|
+
return await updateFunctionTool(db)({
|
|
1203
|
+
scopes,
|
|
1204
|
+
functionToolId: params.data.id,
|
|
1205
|
+
data: {
|
|
1206
|
+
name: params.data.name,
|
|
1207
|
+
description: params.data.description,
|
|
1208
|
+
functionId: params.data.functionId
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
} else {
|
|
1212
|
+
return await createFunctionTool(db)({
|
|
1213
|
+
data: params.data,
|
|
1214
|
+
scopes
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
var getFunctionToolsForSubAgent = (db) => {
|
|
1219
|
+
return async (params) => {
|
|
1220
|
+
const { scopes, subAgentId } = params;
|
|
1221
|
+
const { tenantId, projectId, graphId } = scopes;
|
|
1222
|
+
try {
|
|
1223
|
+
const functionToolsList = await listFunctionTools(db)({
|
|
1224
|
+
scopes: { tenantId, projectId, graphId },
|
|
1225
|
+
pagination: { page: 1, limit: 1e3 }
|
|
1226
|
+
});
|
|
1227
|
+
const relations = await db.select().from(agentFunctionToolRelations).where(
|
|
1228
|
+
and(
|
|
1229
|
+
eq(agentFunctionToolRelations.tenantId, tenantId),
|
|
1230
|
+
eq(agentFunctionToolRelations.projectId, projectId),
|
|
1231
|
+
eq(agentFunctionToolRelations.graphId, graphId),
|
|
1232
|
+
eq(agentFunctionToolRelations.subAgentId, subAgentId)
|
|
1233
|
+
)
|
|
1234
|
+
);
|
|
1235
|
+
const relatedFunctionToolIds = new Set(relations.map((r) => r.functionToolId));
|
|
1236
|
+
const agentFunctionTools = functionToolsList.data.filter(
|
|
1237
|
+
(ft) => relatedFunctionToolIds.has(ft.id)
|
|
1238
|
+
);
|
|
1239
|
+
return {
|
|
1240
|
+
data: agentFunctionTools,
|
|
1241
|
+
pagination: functionToolsList.pagination
|
|
1242
|
+
};
|
|
1243
|
+
} catch (error) {
|
|
1244
|
+
logger3.error(
|
|
1245
|
+
{ tenantId, projectId, graphId, subAgentId, error },
|
|
1246
|
+
"Failed to get function tools for agent"
|
|
1247
|
+
);
|
|
1248
|
+
throw error;
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
};
|
|
1252
|
+
var upsertSubAgentFunctionToolRelation = (db) => async (params) => {
|
|
1253
|
+
if (params.relationId) {
|
|
1254
|
+
return await updateSubAgentFunctionToolRelation(db)({
|
|
1255
|
+
scopes: params.scopes,
|
|
1256
|
+
relationId: params.relationId,
|
|
1257
|
+
data: {
|
|
1258
|
+
subAgentId: params.subAgentId,
|
|
1259
|
+
functionToolId: params.functionToolId
|
|
1260
|
+
}
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
return await addFunctionToolToSubAgent(db)(params);
|
|
1264
|
+
};
|
|
1265
|
+
var addFunctionToolToSubAgent = (db) => {
|
|
1266
|
+
return async (params) => {
|
|
1267
|
+
const { scopes, subAgentId, functionToolId } = params;
|
|
1268
|
+
const { tenantId, projectId, graphId } = scopes;
|
|
1269
|
+
try {
|
|
1270
|
+
const relationId = nanoid();
|
|
1271
|
+
await db.insert(agentFunctionToolRelations).values({
|
|
1272
|
+
id: relationId,
|
|
1273
|
+
tenantId,
|
|
1274
|
+
projectId,
|
|
1275
|
+
graphId,
|
|
1276
|
+
subAgentId,
|
|
1277
|
+
functionToolId
|
|
1278
|
+
});
|
|
1279
|
+
logger3.info(
|
|
1280
|
+
{ tenantId, projectId, graphId, subAgentId, functionToolId, relationId },
|
|
1281
|
+
"Function tool added to agent"
|
|
1282
|
+
);
|
|
1283
|
+
return { id: relationId };
|
|
1284
|
+
} catch (error) {
|
|
1285
|
+
logger3.error(
|
|
1286
|
+
{ tenantId, projectId, graphId, subAgentId, functionToolId, error },
|
|
1287
|
+
"Failed to add function tool to agent"
|
|
1288
|
+
);
|
|
1289
|
+
throw error;
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
};
|
|
1293
|
+
var updateSubAgentFunctionToolRelation = (db) => {
|
|
1294
|
+
return async (params) => {
|
|
1295
|
+
const { scopes, relationId, data } = params;
|
|
1296
|
+
const { tenantId, projectId, graphId } = scopes;
|
|
1297
|
+
try {
|
|
1298
|
+
await db.update(agentFunctionToolRelations).set({
|
|
1299
|
+
subAgentId: data.subAgentId,
|
|
1300
|
+
functionToolId: data.functionToolId
|
|
1301
|
+
}).where(
|
|
1302
|
+
and(
|
|
1303
|
+
eq(agentFunctionToolRelations.id, relationId),
|
|
1304
|
+
eq(agentFunctionToolRelations.tenantId, tenantId),
|
|
1305
|
+
eq(agentFunctionToolRelations.projectId, projectId),
|
|
1306
|
+
eq(agentFunctionToolRelations.graphId, graphId)
|
|
1307
|
+
)
|
|
1308
|
+
);
|
|
1309
|
+
logger3.info(
|
|
1310
|
+
{ tenantId, projectId, graphId, relationId, data },
|
|
1311
|
+
"Agent-function tool relation updated"
|
|
1312
|
+
);
|
|
1313
|
+
return { id: relationId };
|
|
1314
|
+
} catch (error) {
|
|
1315
|
+
logger3.error(
|
|
1316
|
+
{ tenantId, projectId, graphId, relationId, data, error },
|
|
1317
|
+
"Failed to update agent-function tool relation"
|
|
1318
|
+
);
|
|
1319
|
+
throw error;
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
};
|
|
1117
1323
|
var getAgentRelationById = (db) => async (params) => {
|
|
1118
1324
|
return db.query.subAgentRelations.findFirst({
|
|
1119
1325
|
where: and(
|
|
@@ -1526,7 +1732,6 @@ var getToolsForAgent = (db) => async (params) => {
|
|
|
1526
1732
|
name: tools.name,
|
|
1527
1733
|
description: tools.description,
|
|
1528
1734
|
config: tools.config,
|
|
1529
|
-
functionId: tools.functionId,
|
|
1530
1735
|
createdAt: tools.createdAt,
|
|
1531
1736
|
updatedAt: tools.updatedAt,
|
|
1532
1737
|
capabilities: tools.capabilities,
|
|
@@ -1772,7 +1977,7 @@ var getSubAgentsByIds = (db) => async (params) => {
|
|
|
1772
1977
|
);
|
|
1773
1978
|
};
|
|
1774
1979
|
var scryptAsync = promisify(scrypt);
|
|
1775
|
-
var
|
|
1980
|
+
var logger4 = getLogger("api-key");
|
|
1776
1981
|
var API_KEY_LENGTH = 32;
|
|
1777
1982
|
var SALT_LENGTH = 32;
|
|
1778
1983
|
var KEY_LENGTH = 64;
|
|
@@ -1809,7 +2014,7 @@ async function validateApiKey(key, storedHash) {
|
|
|
1809
2014
|
const hashedBuffer = await scryptAsync(key, salt, KEY_LENGTH);
|
|
1810
2015
|
return timingSafeEqual(storedHashBuffer, hashedBuffer);
|
|
1811
2016
|
} catch (error) {
|
|
1812
|
-
|
|
2017
|
+
logger4.error({ error }, "Error validating API key");
|
|
1813
2018
|
return false;
|
|
1814
2019
|
}
|
|
1815
2020
|
}
|
|
@@ -1859,7 +2064,7 @@ var buildOAuthConfig = (metadata) => ({
|
|
|
1859
2064
|
registrationUrl: metadata.registration_endpoint,
|
|
1860
2065
|
supportsDynamicRegistration: !!metadata.registration_endpoint
|
|
1861
2066
|
});
|
|
1862
|
-
var tryWellKnownEndpoints = async (baseUrl,
|
|
2067
|
+
var tryWellKnownEndpoints = async (baseUrl, logger13) => {
|
|
1863
2068
|
const wellKnownUrls = getWellKnownUrls(baseUrl);
|
|
1864
2069
|
for (const wellKnownUrl of wellKnownUrls) {
|
|
1865
2070
|
try {
|
|
@@ -1867,21 +2072,21 @@ var tryWellKnownEndpoints = async (baseUrl, logger12) => {
|
|
|
1867
2072
|
if (response.ok) {
|
|
1868
2073
|
const metadata = await response.json();
|
|
1869
2074
|
if (validateOAuthMetadata(metadata)) {
|
|
1870
|
-
|
|
2075
|
+
logger13?.debug({ baseUrl, wellKnownUrl }, "OAuth 2.1/PKCE support detected");
|
|
1871
2076
|
return buildOAuthConfig(metadata);
|
|
1872
2077
|
}
|
|
1873
2078
|
}
|
|
1874
2079
|
} catch (error) {
|
|
1875
|
-
|
|
2080
|
+
logger13?.debug({ wellKnownUrl, error }, "OAuth endpoint check failed");
|
|
1876
2081
|
}
|
|
1877
2082
|
}
|
|
1878
2083
|
return null;
|
|
1879
2084
|
};
|
|
1880
|
-
var checkForOAuthEndpoints = async (serverUrl,
|
|
1881
|
-
const config = await discoverOAuthEndpoints(serverUrl,
|
|
2085
|
+
var checkForOAuthEndpoints = async (serverUrl, logger13) => {
|
|
2086
|
+
const config = await discoverOAuthEndpoints(serverUrl, logger13);
|
|
1882
2087
|
return config !== null;
|
|
1883
2088
|
};
|
|
1884
|
-
var discoverOAuthEndpoints = async (serverUrl,
|
|
2089
|
+
var discoverOAuthEndpoints = async (serverUrl, logger13) => {
|
|
1885
2090
|
try {
|
|
1886
2091
|
const response = await fetch(serverUrl, {
|
|
1887
2092
|
method: "POST",
|
|
@@ -1897,7 +2102,7 @@ var discoverOAuthEndpoints = async (serverUrl, logger12) => {
|
|
|
1897
2102
|
if (metadataResponse.ok) {
|
|
1898
2103
|
const metadata = await metadataResponse.json();
|
|
1899
2104
|
if (metadata.authorization_servers?.length > 0) {
|
|
1900
|
-
return await tryWellKnownEndpoints(metadata.authorization_servers[0],
|
|
2105
|
+
return await tryWellKnownEndpoints(metadata.authorization_servers[0], logger13);
|
|
1901
2106
|
}
|
|
1902
2107
|
}
|
|
1903
2108
|
}
|
|
@@ -1907,25 +2112,25 @@ var discoverOAuthEndpoints = async (serverUrl, logger12) => {
|
|
|
1907
2112
|
}
|
|
1908
2113
|
const url = new URL(serverUrl);
|
|
1909
2114
|
const baseUrl = `${url.protocol}//${url.host}`;
|
|
1910
|
-
return await tryWellKnownEndpoints(baseUrl,
|
|
2115
|
+
return await tryWellKnownEndpoints(baseUrl, logger13);
|
|
1911
2116
|
};
|
|
1912
2117
|
var detectAuthenticationRequired = async ({
|
|
1913
2118
|
serverUrl,
|
|
1914
2119
|
toolId,
|
|
1915
2120
|
error,
|
|
1916
|
-
logger:
|
|
2121
|
+
logger: logger13
|
|
1917
2122
|
}) => {
|
|
1918
2123
|
try {
|
|
1919
|
-
const hasOAuthEndpoints = await checkForOAuthEndpoints(serverUrl,
|
|
2124
|
+
const hasOAuthEndpoints = await checkForOAuthEndpoints(serverUrl, logger13);
|
|
1920
2125
|
if (hasOAuthEndpoints) {
|
|
1921
|
-
|
|
2126
|
+
logger13?.info(
|
|
1922
2127
|
{ toolId, serverUrl },
|
|
1923
2128
|
"OAuth 2.1/PKCE support confirmed via endpoint discovery"
|
|
1924
2129
|
);
|
|
1925
2130
|
return true;
|
|
1926
2131
|
}
|
|
1927
2132
|
} catch (discoveryError) {
|
|
1928
|
-
|
|
2133
|
+
logger13?.debug({ toolId, discoveryError }, "OAuth endpoint discovery failed");
|
|
1929
2134
|
}
|
|
1930
2135
|
try {
|
|
1931
2136
|
const response = await fetch(serverUrl, {
|
|
@@ -1944,13 +2149,13 @@ var detectAuthenticationRequired = async ({
|
|
|
1944
2149
|
const authLower = wwwAuth.toLowerCase();
|
|
1945
2150
|
const hasActiveOAuthFlow = authLower.includes("authorization_uri") || authLower.includes("as_uri=") || authLower.includes("bearer") && (authLower.includes("scope=") || authLower.includes("error_uri="));
|
|
1946
2151
|
if (hasActiveOAuthFlow) {
|
|
1947
|
-
|
|
2152
|
+
logger13?.info(
|
|
1948
2153
|
{ toolId, wwwAuth },
|
|
1949
2154
|
"Active OAuth flow detected via WWW-Authenticate parameters"
|
|
1950
2155
|
);
|
|
1951
2156
|
return true;
|
|
1952
2157
|
} else {
|
|
1953
|
-
|
|
2158
|
+
logger13?.debug(
|
|
1954
2159
|
{ toolId, wwwAuth },
|
|
1955
2160
|
"Bearer authentication detected - likely simple token auth, not OAuth"
|
|
1956
2161
|
);
|
|
@@ -1958,9 +2163,9 @@ var detectAuthenticationRequired = async ({
|
|
|
1958
2163
|
}
|
|
1959
2164
|
}
|
|
1960
2165
|
} catch (fetchError) {
|
|
1961
|
-
|
|
2166
|
+
logger13?.debug({ toolId, fetchError }, "Direct fetch authentication check failed");
|
|
1962
2167
|
}
|
|
1963
|
-
|
|
2168
|
+
logger13?.debug(
|
|
1964
2169
|
{ toolId, error: error.message },
|
|
1965
2170
|
"No OAuth 2.1/PKCE authentication requirement detected"
|
|
1966
2171
|
);
|
|
@@ -2420,7 +2625,7 @@ var McpClient = class {
|
|
|
2420
2625
|
return results;
|
|
2421
2626
|
}
|
|
2422
2627
|
};
|
|
2423
|
-
var
|
|
2628
|
+
var logger5 = getLogger("tracer");
|
|
2424
2629
|
var createNoOpSpan = () => ({
|
|
2425
2630
|
setAttributes: () => ({}),
|
|
2426
2631
|
recordException: () => ({}),
|
|
@@ -2449,21 +2654,21 @@ var noopTracer = {
|
|
|
2449
2654
|
return createNoOpSpan();
|
|
2450
2655
|
}
|
|
2451
2656
|
};
|
|
2452
|
-
function setSpanWithError(span, error,
|
|
2657
|
+
function setSpanWithError(span, error, logger13, logMessage) {
|
|
2453
2658
|
span.recordException(error);
|
|
2454
2659
|
span.setStatus({
|
|
2455
2660
|
code: SpanStatusCode.ERROR,
|
|
2456
2661
|
message: error.message
|
|
2457
2662
|
});
|
|
2458
|
-
if (
|
|
2459
|
-
|
|
2663
|
+
if (logger13 && logMessage) {
|
|
2664
|
+
logger13.error({ error: error.message }, logMessage);
|
|
2460
2665
|
}
|
|
2461
2666
|
}
|
|
2462
2667
|
function getTracer(serviceName, serviceVersion) {
|
|
2463
2668
|
try {
|
|
2464
2669
|
return trace.getTracer(serviceName, serviceVersion);
|
|
2465
2670
|
} catch (_error) {
|
|
2466
|
-
|
|
2671
|
+
logger5.debug({}, "OpenTelemetry tracer not available, using no-op tracer");
|
|
2467
2672
|
return noopTracer;
|
|
2468
2673
|
}
|
|
2469
2674
|
}
|
|
@@ -2626,7 +2831,7 @@ var upsertCredentialReference = (db) => async (params) => {
|
|
|
2626
2831
|
};
|
|
2627
2832
|
|
|
2628
2833
|
// src/data-access/tools.ts
|
|
2629
|
-
var
|
|
2834
|
+
var logger6 = getLogger("tools");
|
|
2630
2835
|
function extractInputSchema(toolDef) {
|
|
2631
2836
|
if (toolDef.inputSchema) {
|
|
2632
2837
|
return toolDef.inputSchema;
|
|
@@ -2726,7 +2931,7 @@ var discoverToolsFromServer = async (tool2, dbClient, credentialStoreRegistry) =
|
|
|
2726
2931
|
);
|
|
2727
2932
|
return toolDefinitions;
|
|
2728
2933
|
} catch (error) {
|
|
2729
|
-
|
|
2934
|
+
logger6.error({ toolId: tool2.id, error }, "Tool discovery failed");
|
|
2730
2935
|
throw error;
|
|
2731
2936
|
}
|
|
2732
2937
|
};
|
|
@@ -2735,8 +2940,6 @@ var dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry) => {
|
|
|
2735
2940
|
if (dbResult.config.type !== "mcp") {
|
|
2736
2941
|
return {
|
|
2737
2942
|
...rest,
|
|
2738
|
-
functionId: rest.functionId || void 0,
|
|
2739
|
-
// Convert null to undefined
|
|
2740
2943
|
status: "unknown",
|
|
2741
2944
|
availableTools: [],
|
|
2742
2945
|
capabilities: capabilities || void 0,
|
|
@@ -2760,7 +2963,7 @@ var dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry) => {
|
|
|
2760
2963
|
serverUrl: dbResult.config.mcp.server.url,
|
|
2761
2964
|
toolId: dbResult.id,
|
|
2762
2965
|
error,
|
|
2763
|
-
logger:
|
|
2966
|
+
logger: logger6
|
|
2764
2967
|
});
|
|
2765
2968
|
status = toolNeedsAuth ? "needs_auth" : "unhealthy";
|
|
2766
2969
|
lastErrorComputed = toolNeedsAuth ? "Authentication required - OAuth login needed" : error instanceof Error ? error.message : "Tool discovery failed";
|
|
@@ -2776,8 +2979,6 @@ var dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry) => {
|
|
|
2776
2979
|
});
|
|
2777
2980
|
return {
|
|
2778
2981
|
...rest,
|
|
2779
|
-
functionId: rest.functionId || void 0,
|
|
2780
|
-
// Convert null to undefined
|
|
2781
2982
|
status,
|
|
2782
2983
|
availableTools,
|
|
2783
2984
|
capabilities: capabilities || void 0,
|
|
@@ -2880,7 +3081,7 @@ var removeToolFromAgent = (db) => async (params) => {
|
|
|
2880
3081
|
).returning();
|
|
2881
3082
|
return deleted;
|
|
2882
3083
|
};
|
|
2883
|
-
var
|
|
3084
|
+
var upsertSubAgentToolRelation = (db) => async (params) => {
|
|
2884
3085
|
if (params.relationId) {
|
|
2885
3086
|
return await updateAgentToolRelation(db)({
|
|
2886
3087
|
scopes: params.scopes,
|
|
@@ -3154,6 +3355,33 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3154
3355
|
eq(subAgentToolRelations.subAgentId, agent.id)
|
|
3155
3356
|
)
|
|
3156
3357
|
);
|
|
3358
|
+
const agentFunctionTools = await db.select({
|
|
3359
|
+
id: functionTools.id,
|
|
3360
|
+
name: functionTools.name,
|
|
3361
|
+
description: functionTools.description,
|
|
3362
|
+
functionId: functionTools.functionId,
|
|
3363
|
+
createdAt: functionTools.createdAt,
|
|
3364
|
+
updatedAt: functionTools.updatedAt,
|
|
3365
|
+
tenantId: functionTools.tenantId,
|
|
3366
|
+
projectId: functionTools.projectId,
|
|
3367
|
+
graphId: functionTools.graphId,
|
|
3368
|
+
agentToolRelationId: agentFunctionToolRelations.id
|
|
3369
|
+
}).from(agentFunctionToolRelations).innerJoin(
|
|
3370
|
+
functionTools,
|
|
3371
|
+
and(
|
|
3372
|
+
eq(agentFunctionToolRelations.functionToolId, functionTools.id),
|
|
3373
|
+
eq(agentFunctionToolRelations.tenantId, functionTools.tenantId),
|
|
3374
|
+
eq(agentFunctionToolRelations.projectId, functionTools.projectId),
|
|
3375
|
+
eq(agentFunctionToolRelations.graphId, functionTools.graphId)
|
|
3376
|
+
)
|
|
3377
|
+
).where(
|
|
3378
|
+
and(
|
|
3379
|
+
eq(agentFunctionToolRelations.tenantId, tenantId),
|
|
3380
|
+
eq(agentFunctionToolRelations.projectId, projectId),
|
|
3381
|
+
eq(agentFunctionToolRelations.graphId, graphId),
|
|
3382
|
+
eq(agentFunctionToolRelations.subAgentId, agent.id)
|
|
3383
|
+
)
|
|
3384
|
+
);
|
|
3157
3385
|
const agentDataComponentRelations = await db.query.subAgentDataComponents.findMany({
|
|
3158
3386
|
where: and(
|
|
3159
3387
|
eq(subAgentDataComponents.tenantId, tenantId),
|
|
@@ -3170,12 +3398,21 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3170
3398
|
const agentArtifactComponentIds = agentArtifactComponentRelations.map(
|
|
3171
3399
|
(rel) => rel.artifactComponentId
|
|
3172
3400
|
);
|
|
3173
|
-
const
|
|
3401
|
+
const mcpToolCanUse = subAgentTools.map((tool2) => ({
|
|
3174
3402
|
agentToolRelationId: tool2.agentToolRelationId,
|
|
3175
3403
|
toolId: tool2.id,
|
|
3176
3404
|
toolSelection: tool2.selectedTools || null,
|
|
3177
3405
|
headers: tool2.headers || null
|
|
3178
3406
|
}));
|
|
3407
|
+
const functionToolCanUse = agentFunctionTools.map((tool2) => ({
|
|
3408
|
+
agentToolRelationId: tool2.agentToolRelationId,
|
|
3409
|
+
toolId: tool2.id,
|
|
3410
|
+
toolSelection: null,
|
|
3411
|
+
// Function tools don't have tool selection
|
|
3412
|
+
headers: null
|
|
3413
|
+
// Function tools don't have headers
|
|
3414
|
+
}));
|
|
3415
|
+
const canUse = [...mcpToolCanUse, ...functionToolCanUse];
|
|
3179
3416
|
return {
|
|
3180
3417
|
id: agent.id,
|
|
3181
3418
|
name: agent.name,
|
|
@@ -3364,16 +3601,29 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3364
3601
|
name: tool2.name,
|
|
3365
3602
|
description: tool2.description,
|
|
3366
3603
|
config: tool2.config,
|
|
3367
|
-
functionId: tool2.functionId,
|
|
3368
3604
|
credentialReferenceId: tool2.credentialReferenceId,
|
|
3369
3605
|
imageUrl: tool2.imageUrl
|
|
3370
3606
|
};
|
|
3371
3607
|
}
|
|
3372
3608
|
result.tools = toolsObject;
|
|
3609
|
+
const functionToolsList = await listFunctionTools(db)({
|
|
3610
|
+
scopes: { tenantId, projectId, graphId },
|
|
3611
|
+
pagination: { page: 1, limit: 1e3 }
|
|
3612
|
+
});
|
|
3613
|
+
const functionToolsObject = {};
|
|
3614
|
+
for (const functionTool of functionToolsList.data) {
|
|
3615
|
+
functionToolsObject[functionTool.id] = {
|
|
3616
|
+
id: functionTool.id,
|
|
3617
|
+
name: functionTool.name,
|
|
3618
|
+
description: functionTool.description,
|
|
3619
|
+
functionId: functionTool.functionId
|
|
3620
|
+
};
|
|
3621
|
+
}
|
|
3622
|
+
result.functionTools = functionToolsObject;
|
|
3373
3623
|
const functionIds = /* @__PURE__ */ new Set();
|
|
3374
|
-
for (const
|
|
3375
|
-
if (
|
|
3376
|
-
functionIds.add(
|
|
3624
|
+
for (const functionTool of functionToolsList.data) {
|
|
3625
|
+
if (functionTool.functionId) {
|
|
3626
|
+
functionIds.add(functionTool.functionId);
|
|
3377
3627
|
}
|
|
3378
3628
|
}
|
|
3379
3629
|
if (functionIds.size > 0) {
|
|
@@ -4393,18 +4643,18 @@ var defaultLogger = {
|
|
|
4393
4643
|
error: () => {
|
|
4394
4644
|
}
|
|
4395
4645
|
};
|
|
4396
|
-
async function applyExecutionLimitsInheritance(db,
|
|
4646
|
+
async function applyExecutionLimitsInheritance(db, logger13, scopes, graphData) {
|
|
4397
4647
|
const { tenantId, projectId } = scopes;
|
|
4398
4648
|
try {
|
|
4399
4649
|
const project = await db.query.projects.findFirst({
|
|
4400
4650
|
where: and(eq(projects.tenantId, tenantId), eq(projects.id, projectId))
|
|
4401
4651
|
});
|
|
4402
4652
|
if (!project?.stopWhen) {
|
|
4403
|
-
|
|
4653
|
+
logger13.info({ projectId }, "No project stopWhen configuration found");
|
|
4404
4654
|
return;
|
|
4405
4655
|
}
|
|
4406
4656
|
const projectStopWhen = project.stopWhen;
|
|
4407
|
-
|
|
4657
|
+
logger13.info(
|
|
4408
4658
|
{
|
|
4409
4659
|
projectId,
|
|
4410
4660
|
projectStopWhen
|
|
@@ -4416,7 +4666,7 @@ async function applyExecutionLimitsInheritance(db, logger12, scopes, graphData)
|
|
|
4416
4666
|
}
|
|
4417
4667
|
if (graphData.stopWhen.transferCountIs === void 0 && projectStopWhen?.transferCountIs !== void 0) {
|
|
4418
4668
|
graphData.stopWhen.transferCountIs = projectStopWhen.transferCountIs;
|
|
4419
|
-
|
|
4669
|
+
logger13.info(
|
|
4420
4670
|
{
|
|
4421
4671
|
graphId: graphData.id,
|
|
4422
4672
|
inheritedValue: projectStopWhen.transferCountIs
|
|
@@ -4426,7 +4676,7 @@ async function applyExecutionLimitsInheritance(db, logger12, scopes, graphData)
|
|
|
4426
4676
|
}
|
|
4427
4677
|
if (graphData.stopWhen.transferCountIs === void 0) {
|
|
4428
4678
|
graphData.stopWhen.transferCountIs = 10;
|
|
4429
|
-
|
|
4679
|
+
logger13.info(
|
|
4430
4680
|
{
|
|
4431
4681
|
graphId: graphData.id,
|
|
4432
4682
|
defaultValue: 10
|
|
@@ -4435,7 +4685,7 @@ async function applyExecutionLimitsInheritance(db, logger12, scopes, graphData)
|
|
|
4435
4685
|
);
|
|
4436
4686
|
}
|
|
4437
4687
|
if (projectStopWhen?.stepCountIs !== void 0) {
|
|
4438
|
-
|
|
4688
|
+
logger13.info(
|
|
4439
4689
|
{
|
|
4440
4690
|
projectId,
|
|
4441
4691
|
stepCountIs: projectStopWhen.stepCountIs
|
|
@@ -4450,7 +4700,7 @@ async function applyExecutionLimitsInheritance(db, logger12, scopes, graphData)
|
|
|
4450
4700
|
}
|
|
4451
4701
|
if (agent.stopWhen.stepCountIs === void 0) {
|
|
4452
4702
|
agent.stopWhen.stepCountIs = projectStopWhen.stepCountIs;
|
|
4453
|
-
|
|
4703
|
+
logger13.info(
|
|
4454
4704
|
{
|
|
4455
4705
|
subAgentId,
|
|
4456
4706
|
inheritedValue: projectStopWhen.stepCountIs
|
|
@@ -4462,7 +4712,7 @@ async function applyExecutionLimitsInheritance(db, logger12, scopes, graphData)
|
|
|
4462
4712
|
}
|
|
4463
4713
|
}
|
|
4464
4714
|
} catch (error) {
|
|
4465
|
-
|
|
4715
|
+
logger13.error(
|
|
4466
4716
|
{
|
|
4467
4717
|
projectId,
|
|
4468
4718
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -4471,21 +4721,21 @@ async function applyExecutionLimitsInheritance(db, logger12, scopes, graphData)
|
|
|
4471
4721
|
);
|
|
4472
4722
|
}
|
|
4473
4723
|
}
|
|
4474
|
-
var createFullGraphServerSide = (db,
|
|
4724
|
+
var createFullGraphServerSide = (db, logger13 = defaultLogger) => async (scopes, graphData) => {
|
|
4475
4725
|
const { tenantId, projectId } = scopes;
|
|
4476
4726
|
const typed = validateAndTypeGraphData(graphData);
|
|
4477
4727
|
validateGraphStructure(typed);
|
|
4478
|
-
await applyExecutionLimitsInheritance(db,
|
|
4728
|
+
await applyExecutionLimitsInheritance(db, logger13, { tenantId, projectId }, typed);
|
|
4479
4729
|
try {
|
|
4480
|
-
|
|
4730
|
+
logger13.info(
|
|
4481
4731
|
{},
|
|
4482
4732
|
"CredentialReferences are project-scoped - skipping credential reference creation in graph"
|
|
4483
4733
|
);
|
|
4484
|
-
|
|
4734
|
+
logger13.info({}, "MCP Tools are project-scoped - skipping tool creation in graph");
|
|
4485
4735
|
let finalGraphId;
|
|
4486
4736
|
try {
|
|
4487
4737
|
const graphId = typed.id || nanoid();
|
|
4488
|
-
|
|
4738
|
+
logger13.info({ graphId }, "Creating agent graph metadata");
|
|
4489
4739
|
const agentGraph2 = await upsertAgentGraph(db)({
|
|
4490
4740
|
data: {
|
|
4491
4741
|
id: graphId,
|
|
@@ -4503,15 +4753,15 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4503
4753
|
}
|
|
4504
4754
|
});
|
|
4505
4755
|
finalGraphId = agentGraph2.id;
|
|
4506
|
-
|
|
4756
|
+
logger13.info({ graphId: finalGraphId }, "Agent graph metadata created successfully");
|
|
4507
4757
|
} catch (error) {
|
|
4508
|
-
|
|
4758
|
+
logger13.error({ graphId: typed.id, error }, "Failed to create/update graph metadata");
|
|
4509
4759
|
throw error;
|
|
4510
4760
|
}
|
|
4511
4761
|
let contextConfigId;
|
|
4512
4762
|
if (typed.contextConfig) {
|
|
4513
4763
|
try {
|
|
4514
|
-
|
|
4764
|
+
logger13.info({ contextConfigId: typed.contextConfig.id }, "Processing context config");
|
|
4515
4765
|
const contextConfig2 = await upsertContextConfig(db)({
|
|
4516
4766
|
data: {
|
|
4517
4767
|
...typed.contextConfig,
|
|
@@ -4521,9 +4771,9 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4521
4771
|
}
|
|
4522
4772
|
});
|
|
4523
4773
|
contextConfigId = contextConfig2.id;
|
|
4524
|
-
|
|
4774
|
+
logger13.info({ contextConfigId }, "Context config processed successfully");
|
|
4525
4775
|
} catch (error) {
|
|
4526
|
-
|
|
4776
|
+
logger13.error(
|
|
4527
4777
|
{ contextConfigId: typed.contextConfig.id, error },
|
|
4528
4778
|
"Failed to create/update context config"
|
|
4529
4779
|
);
|
|
@@ -4532,7 +4782,7 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4532
4782
|
}
|
|
4533
4783
|
if (contextConfigId) {
|
|
4534
4784
|
try {
|
|
4535
|
-
|
|
4785
|
+
logger13.info(
|
|
4536
4786
|
{ graphId: finalGraphId, contextConfigId },
|
|
4537
4787
|
"Updating graph with contextConfigId"
|
|
4538
4788
|
);
|
|
@@ -4551,30 +4801,112 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4551
4801
|
stopWhen: typed.stopWhen
|
|
4552
4802
|
}
|
|
4553
4803
|
});
|
|
4554
|
-
|
|
4804
|
+
logger13.info(
|
|
4555
4805
|
{ graphId: finalGraphId, contextConfigId },
|
|
4556
4806
|
"Graph updated with contextConfigId successfully"
|
|
4557
4807
|
);
|
|
4558
4808
|
} catch (error) {
|
|
4559
|
-
|
|
4809
|
+
logger13.error(
|
|
4560
4810
|
{ graphId: finalGraphId, contextConfigId, error },
|
|
4561
4811
|
"Failed to update graph with contextConfigId"
|
|
4562
4812
|
);
|
|
4563
4813
|
throw error;
|
|
4564
4814
|
}
|
|
4565
4815
|
}
|
|
4566
|
-
|
|
4816
|
+
logger13.info(
|
|
4567
4817
|
{},
|
|
4568
4818
|
"DataComponents are project-scoped - skipping dataComponent creation in graph"
|
|
4569
4819
|
);
|
|
4570
|
-
|
|
4820
|
+
logger13.info(
|
|
4571
4821
|
{},
|
|
4572
4822
|
"ArtifactComponents are project-scoped - skipping artifactComponent creation in graph"
|
|
4573
4823
|
);
|
|
4824
|
+
if (typed.functions && Object.keys(typed.functions).length > 0) {
|
|
4825
|
+
logger13.info(
|
|
4826
|
+
{
|
|
4827
|
+
graphId: finalGraphId,
|
|
4828
|
+
functionCount: Object.keys(typed.functions).length
|
|
4829
|
+
},
|
|
4830
|
+
"Creating functions for graph"
|
|
4831
|
+
);
|
|
4832
|
+
const functionPromises = Object.entries(typed.functions).map(
|
|
4833
|
+
async ([functionId, functionData]) => {
|
|
4834
|
+
try {
|
|
4835
|
+
logger13.info({ graphId: finalGraphId, functionId }, "Creating function for graph");
|
|
4836
|
+
await upsertFunction(db)({
|
|
4837
|
+
data: {
|
|
4838
|
+
...functionData,
|
|
4839
|
+
id: functionId
|
|
4840
|
+
},
|
|
4841
|
+
scopes: { tenantId, projectId }
|
|
4842
|
+
});
|
|
4843
|
+
logger13.info({ graphId: finalGraphId, functionId }, "Function created successfully");
|
|
4844
|
+
} catch (error) {
|
|
4845
|
+
logger13.error(
|
|
4846
|
+
{ graphId: finalGraphId, functionId, error },
|
|
4847
|
+
"Failed to create function for graph"
|
|
4848
|
+
);
|
|
4849
|
+
throw error;
|
|
4850
|
+
}
|
|
4851
|
+
}
|
|
4852
|
+
);
|
|
4853
|
+
await Promise.all(functionPromises);
|
|
4854
|
+
logger13.info(
|
|
4855
|
+
{
|
|
4856
|
+
graphId: finalGraphId,
|
|
4857
|
+
functionCount: Object.keys(typed.functions).length
|
|
4858
|
+
},
|
|
4859
|
+
"All functions created successfully"
|
|
4860
|
+
);
|
|
4861
|
+
}
|
|
4862
|
+
if (typed.functionTools && Object.keys(typed.functionTools).length > 0) {
|
|
4863
|
+
logger13.info(
|
|
4864
|
+
{
|
|
4865
|
+
graphId: finalGraphId,
|
|
4866
|
+
functionToolCount: Object.keys(typed.functionTools).length
|
|
4867
|
+
},
|
|
4868
|
+
"Creating function tools for graph"
|
|
4869
|
+
);
|
|
4870
|
+
const functionToolPromises = Object.entries(typed.functionTools).map(
|
|
4871
|
+
async ([functionToolId, functionToolData]) => {
|
|
4872
|
+
try {
|
|
4873
|
+
logger13.info(
|
|
4874
|
+
{ graphId: finalGraphId, functionToolId },
|
|
4875
|
+
"Creating function tool in graph"
|
|
4876
|
+
);
|
|
4877
|
+
await upsertFunctionTool(db)({
|
|
4878
|
+
data: {
|
|
4879
|
+
...functionToolData,
|
|
4880
|
+
id: functionToolId
|
|
4881
|
+
},
|
|
4882
|
+
scopes: { tenantId, projectId, graphId: finalGraphId }
|
|
4883
|
+
});
|
|
4884
|
+
logger13.info(
|
|
4885
|
+
{ graphId: finalGraphId, functionToolId },
|
|
4886
|
+
"Function tool created successfully"
|
|
4887
|
+
);
|
|
4888
|
+
} catch (error) {
|
|
4889
|
+
logger13.error(
|
|
4890
|
+
{ graphId: finalGraphId, functionToolId, error },
|
|
4891
|
+
"Failed to create function tool in graph"
|
|
4892
|
+
);
|
|
4893
|
+
throw error;
|
|
4894
|
+
}
|
|
4895
|
+
}
|
|
4896
|
+
);
|
|
4897
|
+
await Promise.all(functionToolPromises);
|
|
4898
|
+
logger13.info(
|
|
4899
|
+
{
|
|
4900
|
+
graphId: finalGraphId,
|
|
4901
|
+
functionToolCount: Object.keys(typed.functionTools).length
|
|
4902
|
+
},
|
|
4903
|
+
"All function tools created successfully"
|
|
4904
|
+
);
|
|
4905
|
+
}
|
|
4574
4906
|
const internalAgentPromises = Object.entries(typed.subAgents).filter(([_, agentData]) => isInternalAgent(agentData)).map(async ([subAgentId, agentData]) => {
|
|
4575
4907
|
const internalAgent = agentData;
|
|
4576
4908
|
try {
|
|
4577
|
-
|
|
4909
|
+
logger13.info({ subAgentId }, "Processing internal agent");
|
|
4578
4910
|
await upsertSubAgent(db)({
|
|
4579
4911
|
data: {
|
|
4580
4912
|
id: subAgentId,
|
|
@@ -4589,9 +4921,9 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4589
4921
|
stopWhen: internalAgent.stopWhen
|
|
4590
4922
|
}
|
|
4591
4923
|
});
|
|
4592
|
-
|
|
4924
|
+
logger13.info({ subAgentId }, "Internal agent processed successfully");
|
|
4593
4925
|
} catch (error) {
|
|
4594
|
-
|
|
4926
|
+
logger13.error({ subAgentId, error }, "Failed to create/update internal agent");
|
|
4595
4927
|
throw error;
|
|
4596
4928
|
}
|
|
4597
4929
|
});
|
|
@@ -4599,11 +4931,11 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4599
4931
|
const internalAgentCount = Object.entries(typed.subAgents).filter(
|
|
4600
4932
|
([_, agentData]) => isInternalAgent(agentData)
|
|
4601
4933
|
).length;
|
|
4602
|
-
|
|
4934
|
+
logger13.info({ internalAgentCount }, "All internal agents created/updated successfully");
|
|
4603
4935
|
const externalAgentPromises = Object.entries(typed.subAgents).filter(([_, agentData]) => isExternalAgent(agentData)).map(async ([subAgentId, agentData]) => {
|
|
4604
4936
|
const externalAgent = agentData;
|
|
4605
4937
|
try {
|
|
4606
|
-
|
|
4938
|
+
logger13.info({ subAgentId }, "Processing external agent");
|
|
4607
4939
|
await upsertExternalAgent(db)({
|
|
4608
4940
|
data: {
|
|
4609
4941
|
id: subAgentId,
|
|
@@ -4617,9 +4949,9 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4617
4949
|
headers: externalAgent.headers || void 0
|
|
4618
4950
|
}
|
|
4619
4951
|
});
|
|
4620
|
-
|
|
4952
|
+
logger13.info({ subAgentId }, "External agent processed successfully");
|
|
4621
4953
|
} catch (error) {
|
|
4622
|
-
|
|
4954
|
+
logger13.error({ subAgentId, error }, "Failed to create/update external agent");
|
|
4623
4955
|
throw error;
|
|
4624
4956
|
}
|
|
4625
4957
|
});
|
|
@@ -4627,10 +4959,10 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4627
4959
|
const externalAgentCount = Object.entries(typed.subAgents).filter(
|
|
4628
4960
|
([_, agentData]) => isExternalAgent(agentData)
|
|
4629
4961
|
).length;
|
|
4630
|
-
|
|
4962
|
+
logger13.info({ externalAgentCount }, "All external agents created/updated successfully");
|
|
4631
4963
|
if (contextConfigId) {
|
|
4632
4964
|
try {
|
|
4633
|
-
|
|
4965
|
+
logger13.info(
|
|
4634
4966
|
{ graphId: finalGraphId, contextConfigId },
|
|
4635
4967
|
"Updating graph with context config"
|
|
4636
4968
|
);
|
|
@@ -4638,9 +4970,9 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4638
4970
|
scopes: { tenantId, projectId, graphId: finalGraphId },
|
|
4639
4971
|
data: { contextConfigId }
|
|
4640
4972
|
});
|
|
4641
|
-
|
|
4973
|
+
logger13.info({ graphId: finalGraphId }, "Graph updated with context config");
|
|
4642
4974
|
} catch (error) {
|
|
4643
|
-
|
|
4975
|
+
logger13.error(
|
|
4644
4976
|
{ graphId: finalGraphId, error },
|
|
4645
4977
|
"Failed to update graph with context config"
|
|
4646
4978
|
);
|
|
@@ -4655,18 +4987,46 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4655
4987
|
(async () => {
|
|
4656
4988
|
try {
|
|
4657
4989
|
const { toolId, toolSelection, headers: headers2, agentToolRelationId } = canUseItem;
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4990
|
+
const isFunctionTool = typed.functionTools && toolId in typed.functionTools;
|
|
4991
|
+
logger13.info(
|
|
4992
|
+
{
|
|
4993
|
+
subAgentId,
|
|
4994
|
+
toolId,
|
|
4995
|
+
hasFunctionTools: !!typed.functionTools,
|
|
4996
|
+
functionToolKeys: typed.functionTools ? Object.keys(typed.functionTools) : [],
|
|
4997
|
+
isFunctionTool
|
|
4998
|
+
},
|
|
4999
|
+
"Processing canUse item"
|
|
5000
|
+
);
|
|
5001
|
+
if (isFunctionTool) {
|
|
5002
|
+
logger13.info({ subAgentId, toolId }, "Processing agent-function tool relation");
|
|
5003
|
+
await upsertSubAgentFunctionToolRelation(db)({
|
|
5004
|
+
scopes: { tenantId, projectId, graphId: finalGraphId },
|
|
5005
|
+
subAgentId,
|
|
5006
|
+
functionToolId: toolId,
|
|
5007
|
+
relationId: agentToolRelationId
|
|
5008
|
+
});
|
|
5009
|
+
logger13.info(
|
|
5010
|
+
{ subAgentId, toolId },
|
|
5011
|
+
"Agent-function tool relation processed successfully"
|
|
5012
|
+
);
|
|
5013
|
+
} else {
|
|
5014
|
+
logger13.info({ subAgentId, toolId }, "Processing agent-MCP tool relation");
|
|
5015
|
+
await upsertSubAgentToolRelation(db)({
|
|
5016
|
+
scopes: { tenantId, projectId, graphId: finalGraphId },
|
|
5017
|
+
subAgentId,
|
|
5018
|
+
toolId,
|
|
5019
|
+
selectedTools: toolSelection || void 0,
|
|
5020
|
+
headers: headers2 || void 0,
|
|
5021
|
+
relationId: agentToolRelationId
|
|
5022
|
+
});
|
|
5023
|
+
logger13.info(
|
|
5024
|
+
{ subAgentId, toolId },
|
|
5025
|
+
"Agent-MCP tool relation processed successfully"
|
|
5026
|
+
);
|
|
5027
|
+
}
|
|
4668
5028
|
} catch (error) {
|
|
4669
|
-
|
|
5029
|
+
logger13.error(
|
|
4670
5030
|
{ subAgentId, toolId: canUseItem.toolId, error },
|
|
4671
5031
|
"Failed to create agent-tool relation"
|
|
4672
5032
|
);
|
|
@@ -4677,7 +5037,7 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4677
5037
|
}
|
|
4678
5038
|
}
|
|
4679
5039
|
await Promise.all(agentToolPromises);
|
|
4680
|
-
|
|
5040
|
+
logger13.info(
|
|
4681
5041
|
{ agentToolCount: Object.keys(typed.subAgents).length },
|
|
4682
5042
|
"All agent-tool relations created"
|
|
4683
5043
|
);
|
|
@@ -4688,7 +5048,7 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4688
5048
|
agentDataComponentPromises.push(
|
|
4689
5049
|
(async () => {
|
|
4690
5050
|
try {
|
|
4691
|
-
|
|
5051
|
+
logger13.info(
|
|
4692
5052
|
{ subAgentId, dataComponentId },
|
|
4693
5053
|
"Processing agent-data component relation"
|
|
4694
5054
|
);
|
|
@@ -4696,12 +5056,12 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4696
5056
|
scopes: { tenantId, projectId, graphId: finalGraphId, subAgentId },
|
|
4697
5057
|
dataComponentId
|
|
4698
5058
|
});
|
|
4699
|
-
|
|
5059
|
+
logger13.info(
|
|
4700
5060
|
{ subAgentId, dataComponentId },
|
|
4701
5061
|
"Agent-data component relation processed successfully"
|
|
4702
5062
|
);
|
|
4703
5063
|
} catch (error) {
|
|
4704
|
-
|
|
5064
|
+
logger13.error(
|
|
4705
5065
|
{ subAgentId, dataComponentId, error },
|
|
4706
5066
|
"Failed to create agent-data component relation"
|
|
4707
5067
|
);
|
|
@@ -4712,7 +5072,7 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4712
5072
|
}
|
|
4713
5073
|
}
|
|
4714
5074
|
await Promise.all(agentDataComponentPromises);
|
|
4715
|
-
|
|
5075
|
+
logger13.info({}, "All agent-data component relations created");
|
|
4716
5076
|
const agentArtifactComponentPromises = [];
|
|
4717
5077
|
for (const [subAgentId, agentData] of Object.entries(typed.subAgents)) {
|
|
4718
5078
|
if (isInternalAgent(agentData) && agentData.artifactComponents) {
|
|
@@ -4720,7 +5080,7 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4720
5080
|
agentArtifactComponentPromises.push(
|
|
4721
5081
|
(async () => {
|
|
4722
5082
|
try {
|
|
4723
|
-
|
|
5083
|
+
logger13.info(
|
|
4724
5084
|
{ subAgentId, artifactComponentId },
|
|
4725
5085
|
"Processing agent-artifact component relation"
|
|
4726
5086
|
);
|
|
@@ -4728,12 +5088,12 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4728
5088
|
scopes: { tenantId, projectId, graphId: finalGraphId, subAgentId },
|
|
4729
5089
|
artifactComponentId
|
|
4730
5090
|
});
|
|
4731
|
-
|
|
5091
|
+
logger13.info(
|
|
4732
5092
|
{ subAgentId, artifactComponentId },
|
|
4733
5093
|
"Agent-artifact component relation processed successfully"
|
|
4734
5094
|
);
|
|
4735
5095
|
} catch (error) {
|
|
4736
|
-
|
|
5096
|
+
logger13.error(
|
|
4737
5097
|
{ subAgentId, artifactComponentId, error },
|
|
4738
5098
|
"Failed to create agent-artifact component relation"
|
|
4739
5099
|
);
|
|
@@ -4744,7 +5104,7 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4744
5104
|
}
|
|
4745
5105
|
}
|
|
4746
5106
|
await Promise.all(agentArtifactComponentPromises);
|
|
4747
|
-
|
|
5107
|
+
logger13.info({}, "All agent-artifact component relations created");
|
|
4748
5108
|
const agentRelationPromises = [];
|
|
4749
5109
|
for (const [subAgentId, agentData] of Object.entries(typed.subAgents)) {
|
|
4750
5110
|
if (isInternalAgent(agentData) && agentData.canTransferTo) {
|
|
@@ -4752,7 +5112,7 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4752
5112
|
agentRelationPromises.push(
|
|
4753
5113
|
(async () => {
|
|
4754
5114
|
try {
|
|
4755
|
-
|
|
5115
|
+
logger13.info(
|
|
4756
5116
|
{ subAgentId, targetSubAgentId, type: "transfer" },
|
|
4757
5117
|
"Processing agent transfer relation"
|
|
4758
5118
|
);
|
|
@@ -4765,12 +5125,12 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4765
5125
|
targetSubAgentId,
|
|
4766
5126
|
relationType: "transfer"
|
|
4767
5127
|
});
|
|
4768
|
-
|
|
5128
|
+
logger13.info(
|
|
4769
5129
|
{ subAgentId, targetSubAgentId, type: "transfer" },
|
|
4770
5130
|
"Agent transfer relation processed successfully"
|
|
4771
5131
|
);
|
|
4772
5132
|
} catch (error) {
|
|
4773
|
-
|
|
5133
|
+
logger13.error(
|
|
4774
5134
|
{ subAgentId, targetSubAgentId, type: "transfer", error },
|
|
4775
5135
|
"Failed to create transfer relation"
|
|
4776
5136
|
);
|
|
@@ -4786,7 +5146,7 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4786
5146
|
agentRelationPromises.push(
|
|
4787
5147
|
(async () => {
|
|
4788
5148
|
try {
|
|
4789
|
-
|
|
5149
|
+
logger13.info(
|
|
4790
5150
|
{ subAgentId, targetSubAgentId, type: "delegate" },
|
|
4791
5151
|
"Processing agent delegation relation"
|
|
4792
5152
|
);
|
|
@@ -4800,12 +5160,12 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4800
5160
|
externalSubAgentId: isTargetExternal ? targetSubAgentId : void 0,
|
|
4801
5161
|
relationType: "delegate"
|
|
4802
5162
|
});
|
|
4803
|
-
|
|
5163
|
+
logger13.info(
|
|
4804
5164
|
{ subAgentId, targetSubAgentId, type: "delegate" },
|
|
4805
5165
|
"Agent delegation relation processed successfully"
|
|
4806
5166
|
);
|
|
4807
5167
|
} catch (error) {
|
|
4808
|
-
|
|
5168
|
+
logger13.error(
|
|
4809
5169
|
{ subAgentId, targetSubAgentId, type: "delegate", error },
|
|
4810
5170
|
"Failed to create delegation relation"
|
|
4811
5171
|
);
|
|
@@ -4816,7 +5176,7 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4816
5176
|
}
|
|
4817
5177
|
}
|
|
4818
5178
|
await Promise.all(agentRelationPromises);
|
|
4819
|
-
|
|
5179
|
+
logger13.info(
|
|
4820
5180
|
{ agentRelationCount: agentRelationPromises.length },
|
|
4821
5181
|
"All agent relations created"
|
|
4822
5182
|
);
|
|
@@ -4826,21 +5186,21 @@ var createFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4826
5186
|
if (!createdGraph) {
|
|
4827
5187
|
throw new Error("Failed to retrieve created graph");
|
|
4828
5188
|
}
|
|
4829
|
-
|
|
5189
|
+
logger13.info({ tenantId, graphId: finalGraphId }, "Full graph created successfully");
|
|
4830
5190
|
return createdGraph;
|
|
4831
5191
|
} catch (error) {
|
|
4832
5192
|
const errorGraphId = typed.id || "unknown";
|
|
4833
|
-
|
|
5193
|
+
logger13.error({ tenantId, graphId: errorGraphId, error }, "Failed to create full graph");
|
|
4834
5194
|
throw error;
|
|
4835
5195
|
}
|
|
4836
5196
|
};
|
|
4837
|
-
var updateFullGraphServerSide = (db,
|
|
5197
|
+
var updateFullGraphServerSide = (db, logger13 = defaultLogger) => async (scopes, graphData) => {
|
|
4838
5198
|
const { tenantId, projectId } = scopes;
|
|
4839
5199
|
const typedGraphDefinition = validateAndTypeGraphData(graphData);
|
|
4840
5200
|
if (!typedGraphDefinition.id) {
|
|
4841
5201
|
throw new Error("Graph ID is required");
|
|
4842
5202
|
}
|
|
4843
|
-
|
|
5203
|
+
logger13.info(
|
|
4844
5204
|
{
|
|
4845
5205
|
tenantId,
|
|
4846
5206
|
graphId: typedGraphDefinition.id,
|
|
@@ -4851,7 +5211,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4851
5211
|
validateGraphStructure(typedGraphDefinition);
|
|
4852
5212
|
await applyExecutionLimitsInheritance(
|
|
4853
5213
|
db,
|
|
4854
|
-
|
|
5214
|
+
logger13,
|
|
4855
5215
|
{ tenantId, projectId },
|
|
4856
5216
|
typedGraphDefinition
|
|
4857
5217
|
);
|
|
@@ -4860,22 +5220,22 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4860
5220
|
scopes: { tenantId, projectId, graphId: typedGraphDefinition.id }
|
|
4861
5221
|
});
|
|
4862
5222
|
if (!existingGraph) {
|
|
4863
|
-
|
|
5223
|
+
logger13.info(
|
|
4864
5224
|
{ graphId: typedGraphDefinition.id },
|
|
4865
5225
|
"Graph does not exist, creating new graph"
|
|
4866
5226
|
);
|
|
4867
|
-
return createFullGraphServerSide(db)(scopes, graphData);
|
|
5227
|
+
return createFullGraphServerSide(db, logger13)(scopes, graphData);
|
|
4868
5228
|
}
|
|
4869
5229
|
const existingGraphModels = existingGraph.models;
|
|
4870
|
-
|
|
5230
|
+
logger13.info(
|
|
4871
5231
|
{},
|
|
4872
5232
|
"CredentialReferences are project-scoped - skipping credential reference update in graph"
|
|
4873
5233
|
);
|
|
4874
|
-
|
|
5234
|
+
logger13.info({}, "MCP Tools are project-scoped - skipping tool creation in graph update");
|
|
4875
5235
|
let finalGraphId;
|
|
4876
5236
|
try {
|
|
4877
5237
|
const graphId = typedGraphDefinition.id || nanoid();
|
|
4878
|
-
|
|
5238
|
+
logger13.info({ graphId }, "Getting/creating agent graph metadata");
|
|
4879
5239
|
const agentGraph2 = await upsertAgentGraph(db)({
|
|
4880
5240
|
data: {
|
|
4881
5241
|
id: graphId,
|
|
@@ -4893,9 +5253,9 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4893
5253
|
}
|
|
4894
5254
|
});
|
|
4895
5255
|
finalGraphId = agentGraph2.id;
|
|
4896
|
-
|
|
5256
|
+
logger13.info({ graphId: finalGraphId }, "Agent graph metadata ready");
|
|
4897
5257
|
} catch (error) {
|
|
4898
|
-
|
|
5258
|
+
logger13.error(
|
|
4899
5259
|
{ graphId: typedGraphDefinition.id, error },
|
|
4900
5260
|
"Failed to get/update graph metadata"
|
|
4901
5261
|
);
|
|
@@ -4903,7 +5263,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4903
5263
|
}
|
|
4904
5264
|
let contextConfigId;
|
|
4905
5265
|
if (typedGraphDefinition.contextConfig) {
|
|
4906
|
-
|
|
5266
|
+
logger13.info(
|
|
4907
5267
|
{ contextConfigId: typedGraphDefinition.contextConfig?.id },
|
|
4908
5268
|
" context config exists"
|
|
4909
5269
|
);
|
|
@@ -4919,9 +5279,9 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4919
5279
|
}
|
|
4920
5280
|
});
|
|
4921
5281
|
contextConfigId = contextConfig2.id;
|
|
4922
|
-
|
|
5282
|
+
logger13.info({ contextConfigId }, "Context config processed successfully");
|
|
4923
5283
|
} catch (error) {
|
|
4924
|
-
|
|
5284
|
+
logger13.error(
|
|
4925
5285
|
{ contextConfigId: typedGraphDefinition.contextConfig.id, error },
|
|
4926
5286
|
"Failed to create/update context config"
|
|
4927
5287
|
);
|
|
@@ -4930,7 +5290,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4930
5290
|
}
|
|
4931
5291
|
if (contextConfigId) {
|
|
4932
5292
|
try {
|
|
4933
|
-
|
|
5293
|
+
logger13.info(
|
|
4934
5294
|
{ graphId: finalGraphId, contextConfigId },
|
|
4935
5295
|
"Updating graph with contextConfigId"
|
|
4936
5296
|
);
|
|
@@ -4949,23 +5309,105 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4949
5309
|
stopWhen: typedGraphDefinition.stopWhen
|
|
4950
5310
|
}
|
|
4951
5311
|
});
|
|
4952
|
-
|
|
5312
|
+
logger13.info(
|
|
4953
5313
|
{ graphId: finalGraphId, contextConfigId },
|
|
4954
5314
|
"Graph updated with contextConfigId successfully"
|
|
4955
5315
|
);
|
|
4956
5316
|
} catch (error) {
|
|
4957
|
-
|
|
5317
|
+
logger13.error(
|
|
4958
5318
|
{ graphId: finalGraphId, contextConfigId, error },
|
|
4959
5319
|
"Failed to update graph with contextConfigId"
|
|
4960
5320
|
);
|
|
4961
5321
|
throw error;
|
|
4962
5322
|
}
|
|
4963
5323
|
}
|
|
4964
|
-
|
|
4965
|
-
|
|
5324
|
+
logger13.info({}, "DataComponents are project-scoped - skipping dataComponent update in graph");
|
|
5325
|
+
logger13.info(
|
|
4966
5326
|
{},
|
|
4967
5327
|
"ArtifactComponents are project-scoped - skipping artifactComponent update in graph"
|
|
4968
5328
|
);
|
|
5329
|
+
if (typedGraphDefinition.functions && Object.keys(typedGraphDefinition.functions).length > 0) {
|
|
5330
|
+
logger13.info(
|
|
5331
|
+
{
|
|
5332
|
+
graphId: finalGraphId,
|
|
5333
|
+
functionCount: Object.keys(typedGraphDefinition.functions).length
|
|
5334
|
+
},
|
|
5335
|
+
"Updating functions for graph"
|
|
5336
|
+
);
|
|
5337
|
+
const functionPromises = Object.entries(typedGraphDefinition.functions).map(
|
|
5338
|
+
async ([functionId, functionData]) => {
|
|
5339
|
+
try {
|
|
5340
|
+
logger13.info({ graphId: finalGraphId, functionId }, "Updating function for graph");
|
|
5341
|
+
await upsertFunction(db)({
|
|
5342
|
+
data: {
|
|
5343
|
+
...functionData,
|
|
5344
|
+
id: functionId
|
|
5345
|
+
},
|
|
5346
|
+
scopes: { tenantId, projectId }
|
|
5347
|
+
});
|
|
5348
|
+
logger13.info({ graphId: finalGraphId, functionId }, "Function updated successfully");
|
|
5349
|
+
} catch (error) {
|
|
5350
|
+
logger13.error(
|
|
5351
|
+
{ graphId: finalGraphId, functionId, error },
|
|
5352
|
+
"Failed to update function for graph"
|
|
5353
|
+
);
|
|
5354
|
+
throw error;
|
|
5355
|
+
}
|
|
5356
|
+
}
|
|
5357
|
+
);
|
|
5358
|
+
await Promise.all(functionPromises);
|
|
5359
|
+
logger13.info(
|
|
5360
|
+
{
|
|
5361
|
+
graphId: finalGraphId,
|
|
5362
|
+
functionCount: Object.keys(typedGraphDefinition.functions).length
|
|
5363
|
+
},
|
|
5364
|
+
"All functions updated successfully"
|
|
5365
|
+
);
|
|
5366
|
+
}
|
|
5367
|
+
if (typedGraphDefinition.functionTools && Object.keys(typedGraphDefinition.functionTools).length > 0) {
|
|
5368
|
+
logger13.info(
|
|
5369
|
+
{
|
|
5370
|
+
graphId: finalGraphId,
|
|
5371
|
+
functionToolCount: Object.keys(typedGraphDefinition.functionTools).length
|
|
5372
|
+
},
|
|
5373
|
+
"Updating function tools for graph"
|
|
5374
|
+
);
|
|
5375
|
+
const functionToolPromises = Object.entries(typedGraphDefinition.functionTools).map(
|
|
5376
|
+
async ([functionToolId, functionToolData]) => {
|
|
5377
|
+
try {
|
|
5378
|
+
logger13.info(
|
|
5379
|
+
{ graphId: finalGraphId, functionToolId },
|
|
5380
|
+
"Updating function tool in graph"
|
|
5381
|
+
);
|
|
5382
|
+
await upsertFunctionTool(db)({
|
|
5383
|
+
data: {
|
|
5384
|
+
...functionToolData,
|
|
5385
|
+
id: functionToolId
|
|
5386
|
+
},
|
|
5387
|
+
scopes: { tenantId, projectId, graphId: finalGraphId }
|
|
5388
|
+
});
|
|
5389
|
+
logger13.info(
|
|
5390
|
+
{ graphId: finalGraphId, functionToolId },
|
|
5391
|
+
"Function tool updated successfully"
|
|
5392
|
+
);
|
|
5393
|
+
} catch (error) {
|
|
5394
|
+
logger13.error(
|
|
5395
|
+
{ graphId: finalGraphId, functionToolId, error },
|
|
5396
|
+
"Failed to update function tool in graph"
|
|
5397
|
+
);
|
|
5398
|
+
throw error;
|
|
5399
|
+
}
|
|
5400
|
+
}
|
|
5401
|
+
);
|
|
5402
|
+
await Promise.all(functionToolPromises);
|
|
5403
|
+
logger13.info(
|
|
5404
|
+
{
|
|
5405
|
+
graphId: finalGraphId,
|
|
5406
|
+
functionToolCount: Object.keys(typedGraphDefinition.functionTools).length
|
|
5407
|
+
},
|
|
5408
|
+
"All function tools updated successfully"
|
|
5409
|
+
);
|
|
5410
|
+
}
|
|
4969
5411
|
const internalAgentPromises = Object.entries(typedGraphDefinition.subAgents).filter(([_, agentData]) => isInternalAgent(agentData)).map(async ([subAgentId, agentData]) => {
|
|
4970
5412
|
const internalAgent = agentData;
|
|
4971
5413
|
let existingAgent = null;
|
|
@@ -4993,7 +5435,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
4993
5435
|
(graphModels[modelType].model !== existingGraphModels[modelType].model || // OR providerOptions changed
|
|
4994
5436
|
JSON.stringify(graphModels[modelType].providerOptions) !== JSON.stringify(existingGraphModels[modelType].providerOptions))) {
|
|
4995
5437
|
cascadedModels[modelType] = graphModels[modelType];
|
|
4996
|
-
|
|
5438
|
+
logger13.info(
|
|
4997
5439
|
{
|
|
4998
5440
|
subAgentId,
|
|
4999
5441
|
modelType,
|
|
@@ -5008,7 +5450,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5008
5450
|
finalModelSettings = cascadedModels;
|
|
5009
5451
|
}
|
|
5010
5452
|
try {
|
|
5011
|
-
|
|
5453
|
+
logger13.info({ subAgentId }, "Processing internal agent");
|
|
5012
5454
|
await upsertSubAgent(db)({
|
|
5013
5455
|
data: {
|
|
5014
5456
|
id: subAgentId,
|
|
@@ -5023,9 +5465,9 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5023
5465
|
stopWhen: internalAgent.stopWhen
|
|
5024
5466
|
}
|
|
5025
5467
|
});
|
|
5026
|
-
|
|
5468
|
+
logger13.info({ subAgentId }, "Internal agent processed successfully");
|
|
5027
5469
|
} catch (error) {
|
|
5028
|
-
|
|
5470
|
+
logger13.error({ subAgentId, error }, "Failed to create/update internal agent");
|
|
5029
5471
|
throw error;
|
|
5030
5472
|
}
|
|
5031
5473
|
});
|
|
@@ -5033,11 +5475,11 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5033
5475
|
const internalAgentCount = Object.entries(typedGraphDefinition.subAgents).filter(
|
|
5034
5476
|
([_, agentData]) => isInternalAgent(agentData)
|
|
5035
5477
|
).length;
|
|
5036
|
-
|
|
5478
|
+
logger13.info({ internalAgentCount }, "All internal agents created/updated successfully");
|
|
5037
5479
|
const externalAgentPromises = Object.entries(typedGraphDefinition.subAgents).filter(([_, agentData]) => isExternalAgent(agentData)).map(async ([subAgentId, agentData]) => {
|
|
5038
5480
|
const externalAgent = agentData;
|
|
5039
5481
|
try {
|
|
5040
|
-
|
|
5482
|
+
logger13.info({ subAgentId }, "Processing external agent");
|
|
5041
5483
|
await upsertExternalAgent(db)({
|
|
5042
5484
|
data: {
|
|
5043
5485
|
id: subAgentId,
|
|
@@ -5051,9 +5493,9 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5051
5493
|
headers: externalAgent.headers || void 0
|
|
5052
5494
|
}
|
|
5053
5495
|
});
|
|
5054
|
-
|
|
5496
|
+
logger13.info({ subAgentId }, "External agent processed successfully");
|
|
5055
5497
|
} catch (error) {
|
|
5056
|
-
|
|
5498
|
+
logger13.error({ subAgentId, error }, "Failed to create/update external agent");
|
|
5057
5499
|
throw error;
|
|
5058
5500
|
}
|
|
5059
5501
|
});
|
|
@@ -5061,7 +5503,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5061
5503
|
const externalAgentCount = Object.entries(typedGraphDefinition.subAgents).filter(
|
|
5062
5504
|
([_, agentData]) => isExternalAgent(agentData)
|
|
5063
5505
|
).length;
|
|
5064
|
-
|
|
5506
|
+
logger13.info({ externalAgentCount }, "All external agents created/updated successfully");
|
|
5065
5507
|
const incomingAgentIds = new Set(Object.keys(typedGraphDefinition.subAgents));
|
|
5066
5508
|
const existingInternalAgents = await listSubAgents(db)({
|
|
5067
5509
|
scopes: { tenantId, projectId, graphId: finalGraphId }
|
|
@@ -5078,9 +5520,9 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5078
5520
|
subAgentId: agent.id
|
|
5079
5521
|
});
|
|
5080
5522
|
deletedInternalCount++;
|
|
5081
|
-
|
|
5523
|
+
logger13.info({ subAgentId: agent.id }, "Deleted orphaned internal agent");
|
|
5082
5524
|
} catch (error) {
|
|
5083
|
-
|
|
5525
|
+
logger13.error(
|
|
5084
5526
|
{ subAgentId: agent.id, error },
|
|
5085
5527
|
"Failed to delete orphaned internal agent"
|
|
5086
5528
|
);
|
|
@@ -5096,9 +5538,9 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5096
5538
|
subAgentId: agent.id
|
|
5097
5539
|
});
|
|
5098
5540
|
deletedExternalCount++;
|
|
5099
|
-
|
|
5541
|
+
logger13.info({ subAgentId: agent.id }, "Deleted orphaned external agent");
|
|
5100
5542
|
} catch (error) {
|
|
5101
|
-
|
|
5543
|
+
logger13.error(
|
|
5102
5544
|
{ subAgentId: agent.id, error },
|
|
5103
5545
|
"Failed to delete orphaned external agent"
|
|
5104
5546
|
);
|
|
@@ -5106,7 +5548,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5106
5548
|
}
|
|
5107
5549
|
}
|
|
5108
5550
|
if (deletedInternalCount > 0 || deletedExternalCount > 0) {
|
|
5109
|
-
|
|
5551
|
+
logger13.info(
|
|
5110
5552
|
{
|
|
5111
5553
|
deletedInternalCount,
|
|
5112
5554
|
deletedExternalCount,
|
|
@@ -5128,7 +5570,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5128
5570
|
stopWhen: typedGraphDefinition.stopWhen
|
|
5129
5571
|
}
|
|
5130
5572
|
});
|
|
5131
|
-
|
|
5573
|
+
logger13.info({ graphId: typedGraphDefinition.id }, "Graph metadata updated");
|
|
5132
5574
|
const incomingRelationshipIds = /* @__PURE__ */ new Set();
|
|
5133
5575
|
for (const [_subAgentId, agentData] of Object.entries(typedGraphDefinition.subAgents)) {
|
|
5134
5576
|
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
@@ -5165,10 +5607,10 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5165
5607
|
deletedCount = result.rowsAffected || 0;
|
|
5166
5608
|
}
|
|
5167
5609
|
if (deletedCount > 0) {
|
|
5168
|
-
|
|
5610
|
+
logger13.info({ subAgentId, deletedCount }, "Deleted orphaned agent-tool relations");
|
|
5169
5611
|
}
|
|
5170
5612
|
} catch (error) {
|
|
5171
|
-
|
|
5613
|
+
logger13.error({ subAgentId, error }, "Failed to delete orphaned agent-tool relations");
|
|
5172
5614
|
}
|
|
5173
5615
|
}
|
|
5174
5616
|
const agentToolPromises = [];
|
|
@@ -5179,21 +5621,36 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5179
5621
|
(async () => {
|
|
5180
5622
|
try {
|
|
5181
5623
|
const { toolId, toolSelection, headers: headers2, agentToolRelationId } = canUseItem;
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5624
|
+
const isFunctionTool = typedGraphDefinition.functionTools && toolId in typedGraphDefinition.functionTools;
|
|
5625
|
+
if (isFunctionTool) {
|
|
5626
|
+
logger13.info({ subAgentId, toolId }, "Processing agent-function tool relation");
|
|
5627
|
+
await upsertSubAgentFunctionToolRelation(db)({
|
|
5628
|
+
scopes: { tenantId, projectId, graphId: finalGraphId },
|
|
5629
|
+
subAgentId,
|
|
5630
|
+
functionToolId: toolId,
|
|
5631
|
+
relationId: agentToolRelationId
|
|
5632
|
+
});
|
|
5633
|
+
logger13.info(
|
|
5634
|
+
{ subAgentId, toolId, relationId: agentToolRelationId },
|
|
5635
|
+
"Agent-function tool relation upserted"
|
|
5636
|
+
);
|
|
5637
|
+
} else {
|
|
5638
|
+
logger13.info({ subAgentId, toolId }, "Processing agent-MCP tool relation");
|
|
5639
|
+
await upsertSubAgentToolRelation(db)({
|
|
5640
|
+
scopes: { tenantId, projectId, graphId: finalGraphId },
|
|
5641
|
+
subAgentId,
|
|
5642
|
+
toolId,
|
|
5643
|
+
selectedTools: toolSelection || void 0,
|
|
5644
|
+
headers: headers2 || void 0,
|
|
5645
|
+
relationId: agentToolRelationId
|
|
5646
|
+
});
|
|
5647
|
+
logger13.info(
|
|
5648
|
+
{ subAgentId, toolId, relationId: agentToolRelationId },
|
|
5649
|
+
"Agent-MCP tool relation upserted"
|
|
5650
|
+
);
|
|
5651
|
+
}
|
|
5195
5652
|
} catch (error) {
|
|
5196
|
-
|
|
5653
|
+
logger13.error(
|
|
5197
5654
|
{
|
|
5198
5655
|
subAgentId,
|
|
5199
5656
|
toolId: canUseItem.toolId,
|
|
@@ -5209,7 +5666,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5209
5666
|
}
|
|
5210
5667
|
}
|
|
5211
5668
|
await Promise.all(agentToolPromises);
|
|
5212
|
-
|
|
5669
|
+
logger13.info(
|
|
5213
5670
|
{ agentToolPromisesCount: agentToolPromises.length },
|
|
5214
5671
|
"All agent-tool relations updated"
|
|
5215
5672
|
);
|
|
@@ -5229,12 +5686,12 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5229
5686
|
scopes: { tenantId, projectId, graphId: finalGraphId, subAgentId },
|
|
5230
5687
|
dataComponentId
|
|
5231
5688
|
});
|
|
5232
|
-
|
|
5689
|
+
logger13.info(
|
|
5233
5690
|
{ subAgentId, dataComponentId },
|
|
5234
5691
|
"Agent-dataComponent relation created"
|
|
5235
5692
|
);
|
|
5236
5693
|
} catch (error) {
|
|
5237
|
-
|
|
5694
|
+
logger13.error(
|
|
5238
5695
|
{ subAgentId, dataComponentId, error },
|
|
5239
5696
|
"Failed to create agent-dataComponent relation"
|
|
5240
5697
|
);
|
|
@@ -5245,7 +5702,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5245
5702
|
}
|
|
5246
5703
|
}
|
|
5247
5704
|
await Promise.all(agentDataComponentPromises);
|
|
5248
|
-
|
|
5705
|
+
logger13.info(
|
|
5249
5706
|
{ agentDataComponentPromisesCount: agentDataComponentPromises.length },
|
|
5250
5707
|
"All agent-dataComponent relations updated"
|
|
5251
5708
|
);
|
|
@@ -5265,12 +5722,12 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5265
5722
|
scopes: { tenantId, projectId, graphId: finalGraphId, subAgentId },
|
|
5266
5723
|
artifactComponentId
|
|
5267
5724
|
});
|
|
5268
|
-
|
|
5725
|
+
logger13.info(
|
|
5269
5726
|
{ subAgentId, artifactComponentId },
|
|
5270
5727
|
"Agent-artifactComponent relation created"
|
|
5271
5728
|
);
|
|
5272
5729
|
} catch (error) {
|
|
5273
|
-
|
|
5730
|
+
logger13.error(
|
|
5274
5731
|
{ subAgentId, artifactComponentId, error },
|
|
5275
5732
|
"Failed to create agent-artifactComponent relation"
|
|
5276
5733
|
);
|
|
@@ -5281,7 +5738,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5281
5738
|
}
|
|
5282
5739
|
}
|
|
5283
5740
|
await Promise.all(agentArtifactComponentPromises);
|
|
5284
|
-
|
|
5741
|
+
logger13.info(
|
|
5285
5742
|
{ agentArtifactComponentPromisesCount: agentArtifactComponentPromises.length },
|
|
5286
5743
|
"All agent-artifactComponent relations updated"
|
|
5287
5744
|
);
|
|
@@ -5310,12 +5767,12 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5310
5767
|
projectId,
|
|
5311
5768
|
...relationData
|
|
5312
5769
|
});
|
|
5313
|
-
|
|
5770
|
+
logger13.info(
|
|
5314
5771
|
{ subAgentId, targetSubAgentId, isTargetExternal },
|
|
5315
5772
|
"Transfer relation created"
|
|
5316
5773
|
);
|
|
5317
5774
|
} catch (error) {
|
|
5318
|
-
|
|
5775
|
+
logger13.error(
|
|
5319
5776
|
{ subAgentId, targetSubAgentId, error },
|
|
5320
5777
|
"Failed to create transfer relation"
|
|
5321
5778
|
);
|
|
@@ -5344,9 +5801,9 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5344
5801
|
projectId,
|
|
5345
5802
|
...relationData
|
|
5346
5803
|
});
|
|
5347
|
-
|
|
5804
|
+
logger13.info({ subAgentId, targetSubAgentId }, "Delegation relation created");
|
|
5348
5805
|
} catch (error) {
|
|
5349
|
-
|
|
5806
|
+
logger13.error(
|
|
5350
5807
|
{ subAgentId, targetSubAgentId, error },
|
|
5351
5808
|
"Failed to create delegation relation"
|
|
5352
5809
|
);
|
|
@@ -5357,7 +5814,7 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5357
5814
|
}
|
|
5358
5815
|
}
|
|
5359
5816
|
await Promise.all(agentRelationPromises);
|
|
5360
|
-
|
|
5817
|
+
logger13.info(
|
|
5361
5818
|
{ agentRelationPromisesCount: agentRelationPromises.length },
|
|
5362
5819
|
"All agent relations updated"
|
|
5363
5820
|
);
|
|
@@ -5367,26 +5824,26 @@ var updateFullGraphServerSide = (db, logger12 = defaultLogger) => async (scopes,
|
|
|
5367
5824
|
if (!updatedGraph) {
|
|
5368
5825
|
throw new Error("Failed to retrieve updated graph");
|
|
5369
5826
|
}
|
|
5370
|
-
|
|
5827
|
+
logger13.info({ graphId: typedGraphDefinition.id }, "Full graph updated successfully");
|
|
5371
5828
|
return updatedGraph;
|
|
5372
5829
|
} catch (error) {
|
|
5373
|
-
|
|
5830
|
+
logger13.error({ graphId: typedGraphDefinition.id, error }, "Failed to update full graph");
|
|
5374
5831
|
throw error;
|
|
5375
5832
|
}
|
|
5376
5833
|
};
|
|
5377
|
-
var getFullGraph = (db,
|
|
5834
|
+
var getFullGraph = (db, logger13 = defaultLogger) => async (params) => {
|
|
5378
5835
|
const { scopes } = params;
|
|
5379
5836
|
const { tenantId, projectId } = scopes;
|
|
5380
|
-
|
|
5837
|
+
logger13.info({ tenantId, graphId: scopes.graphId }, "Retrieving full graph definition");
|
|
5381
5838
|
try {
|
|
5382
5839
|
const graph = await getFullGraphDefinition(db)({
|
|
5383
5840
|
scopes: { tenantId, projectId, graphId: scopes.graphId }
|
|
5384
5841
|
});
|
|
5385
5842
|
if (!graph) {
|
|
5386
|
-
|
|
5843
|
+
logger13.info({ tenantId, graphId: scopes.graphId }, "Graph not found");
|
|
5387
5844
|
return null;
|
|
5388
5845
|
}
|
|
5389
|
-
|
|
5846
|
+
logger13.info(
|
|
5390
5847
|
{
|
|
5391
5848
|
tenantId,
|
|
5392
5849
|
graphId: scopes.graphId,
|
|
@@ -5396,7 +5853,7 @@ var getFullGraph = (db, logger12 = defaultLogger) => async (params) => {
|
|
|
5396
5853
|
);
|
|
5397
5854
|
return graph;
|
|
5398
5855
|
} catch (error) {
|
|
5399
|
-
|
|
5856
|
+
logger13.error(
|
|
5400
5857
|
{
|
|
5401
5858
|
tenantId,
|
|
5402
5859
|
graphId: scopes.graphId,
|
|
@@ -5407,21 +5864,21 @@ var getFullGraph = (db, logger12 = defaultLogger) => async (params) => {
|
|
|
5407
5864
|
throw error;
|
|
5408
5865
|
}
|
|
5409
5866
|
};
|
|
5410
|
-
var deleteFullGraph = (db,
|
|
5867
|
+
var deleteFullGraph = (db, logger13 = defaultLogger) => async (params) => {
|
|
5411
5868
|
const { tenantId, projectId, graphId } = params.scopes;
|
|
5412
|
-
|
|
5869
|
+
logger13.info({ tenantId, graphId }, "Deleting full graph and related entities");
|
|
5413
5870
|
try {
|
|
5414
5871
|
const graph = await getFullGraphDefinition(db)({
|
|
5415
5872
|
scopes: { tenantId, projectId, graphId }
|
|
5416
5873
|
});
|
|
5417
5874
|
if (!graph) {
|
|
5418
|
-
|
|
5875
|
+
logger13.info({ tenantId, graphId }, "Graph not found for deletion");
|
|
5419
5876
|
return false;
|
|
5420
5877
|
}
|
|
5421
5878
|
await deleteAgentRelationsByGraph(db)({
|
|
5422
5879
|
scopes: { tenantId, projectId, graphId }
|
|
5423
5880
|
});
|
|
5424
|
-
|
|
5881
|
+
logger13.info({ tenantId, graphId }, "Agent relations deleted");
|
|
5425
5882
|
const subAgentIds = Object.keys(graph.subAgents);
|
|
5426
5883
|
if (subAgentIds.length > 0) {
|
|
5427
5884
|
for (const subAgentId of subAgentIds) {
|
|
@@ -5429,7 +5886,7 @@ var deleteFullGraph = (db, logger12 = defaultLogger) => async (params) => {
|
|
|
5429
5886
|
scopes: { tenantId, projectId, graphId, subAgentId }
|
|
5430
5887
|
});
|
|
5431
5888
|
}
|
|
5432
|
-
|
|
5889
|
+
logger13.info(
|
|
5433
5890
|
{ tenantId, graphId, agentCount: subAgentIds.length },
|
|
5434
5891
|
"Agent-tool relations deleted"
|
|
5435
5892
|
);
|
|
@@ -5437,11 +5894,11 @@ var deleteFullGraph = (db, logger12 = defaultLogger) => async (params) => {
|
|
|
5437
5894
|
await deleteAgentGraph(db)({
|
|
5438
5895
|
scopes: { tenantId, projectId, graphId }
|
|
5439
5896
|
});
|
|
5440
|
-
|
|
5441
|
-
|
|
5897
|
+
logger13.info({ tenantId, graphId }, "Graph metadata deleted");
|
|
5898
|
+
logger13.info({ tenantId, graphId }, "Full graph deleted successfully");
|
|
5442
5899
|
return true;
|
|
5443
5900
|
} catch (error) {
|
|
5444
|
-
|
|
5901
|
+
logger13.error(
|
|
5445
5902
|
{
|
|
5446
5903
|
tenantId,
|
|
5447
5904
|
graphId,
|
|
@@ -6031,10 +6488,10 @@ var defaultLogger2 = getLogger("projectFull");
|
|
|
6031
6488
|
function validateAndTypeProjectData(projectData) {
|
|
6032
6489
|
return projectData;
|
|
6033
6490
|
}
|
|
6034
|
-
var createFullProjectServerSide = (db,
|
|
6491
|
+
var createFullProjectServerSide = (db, logger13 = defaultLogger2) => async (scopes, projectData) => {
|
|
6035
6492
|
const { tenantId } = scopes;
|
|
6036
6493
|
const typed = validateAndTypeProjectData(projectData);
|
|
6037
|
-
|
|
6494
|
+
logger13.info(
|
|
6038
6495
|
{
|
|
6039
6496
|
tenantId,
|
|
6040
6497
|
projectId: typed.id,
|
|
@@ -6053,11 +6510,11 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6053
6510
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6054
6511
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6055
6512
|
};
|
|
6056
|
-
|
|
6513
|
+
logger13.info({ projectId: typed.id }, "Creating project metadata");
|
|
6057
6514
|
await createProject(db)(projectPayload);
|
|
6058
|
-
|
|
6515
|
+
logger13.info({ projectId: typed.id }, "Project metadata created successfully");
|
|
6059
6516
|
if (typed.credentialReferences && Object.keys(typed.credentialReferences).length > 0) {
|
|
6060
|
-
|
|
6517
|
+
logger13.info(
|
|
6061
6518
|
{
|
|
6062
6519
|
projectId: typed.id,
|
|
6063
6520
|
count: Object.keys(typed.credentialReferences).length
|
|
@@ -6067,7 +6524,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6067
6524
|
const credentialPromises = Object.entries(typed.credentialReferences).map(
|
|
6068
6525
|
async ([_credId, credData]) => {
|
|
6069
6526
|
try {
|
|
6070
|
-
|
|
6527
|
+
logger13.info(
|
|
6071
6528
|
{ projectId: typed.id, credId: credData.id },
|
|
6072
6529
|
"Creating credentialReference in project"
|
|
6073
6530
|
);
|
|
@@ -6078,12 +6535,12 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6078
6535
|
projectId: typed.id
|
|
6079
6536
|
}
|
|
6080
6537
|
});
|
|
6081
|
-
|
|
6538
|
+
logger13.info(
|
|
6082
6539
|
{ projectId: typed.id, credId: credData.id },
|
|
6083
6540
|
"CredentialReference created successfully"
|
|
6084
6541
|
);
|
|
6085
6542
|
} catch (error) {
|
|
6086
|
-
|
|
6543
|
+
logger13.error(
|
|
6087
6544
|
{ projectId: typed.id, credId: credData.id, error },
|
|
6088
6545
|
"Failed to create credentialReference in project"
|
|
6089
6546
|
);
|
|
@@ -6092,7 +6549,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6092
6549
|
}
|
|
6093
6550
|
);
|
|
6094
6551
|
await Promise.all(credentialPromises);
|
|
6095
|
-
|
|
6552
|
+
logger13.info(
|
|
6096
6553
|
{
|
|
6097
6554
|
projectId: typed.id,
|
|
6098
6555
|
count: Object.keys(typed.credentialReferences).length
|
|
@@ -6104,19 +6561,19 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6104
6561
|
const functionPromises = Object.entries(typed.functions).map(
|
|
6105
6562
|
async ([functionId, functionData]) => {
|
|
6106
6563
|
try {
|
|
6107
|
-
|
|
6564
|
+
logger13.info({ projectId: typed.id, functionId }, "Creating project function");
|
|
6108
6565
|
await upsertFunction(db)({
|
|
6109
6566
|
data: {
|
|
6110
6567
|
...functionData
|
|
6111
6568
|
},
|
|
6112
6569
|
scopes: { tenantId, projectId: typed.id }
|
|
6113
6570
|
});
|
|
6114
|
-
|
|
6571
|
+
logger13.info(
|
|
6115
6572
|
{ projectId: typed.id, functionId },
|
|
6116
6573
|
"Project function created successfully"
|
|
6117
6574
|
);
|
|
6118
6575
|
} catch (error) {
|
|
6119
|
-
|
|
6576
|
+
logger13.error(
|
|
6120
6577
|
{ projectId: typed.id, functionId, error },
|
|
6121
6578
|
"Failed to create global function"
|
|
6122
6579
|
);
|
|
@@ -6125,7 +6582,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6125
6582
|
}
|
|
6126
6583
|
);
|
|
6127
6584
|
await Promise.all(functionPromises);
|
|
6128
|
-
|
|
6585
|
+
logger13.info(
|
|
6129
6586
|
{
|
|
6130
6587
|
projectId: typed.id,
|
|
6131
6588
|
functionCount: Object.keys(typed.functions).length
|
|
@@ -6134,7 +6591,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6134
6591
|
);
|
|
6135
6592
|
}
|
|
6136
6593
|
if (typed.tools && Object.keys(typed.tools).length > 0) {
|
|
6137
|
-
|
|
6594
|
+
logger13.info(
|
|
6138
6595
|
{
|
|
6139
6596
|
projectId: typed.id,
|
|
6140
6597
|
toolCount: Object.keys(typed.tools).length
|
|
@@ -6143,7 +6600,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6143
6600
|
);
|
|
6144
6601
|
const toolPromises = Object.entries(typed.tools).map(async ([toolId, toolData]) => {
|
|
6145
6602
|
try {
|
|
6146
|
-
|
|
6603
|
+
logger13.info({ projectId: typed.id, toolId }, "Creating tool in project");
|
|
6147
6604
|
await upsertTool(db)({
|
|
6148
6605
|
data: {
|
|
6149
6606
|
tenantId,
|
|
@@ -6151,9 +6608,9 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6151
6608
|
...toolData
|
|
6152
6609
|
}
|
|
6153
6610
|
});
|
|
6154
|
-
|
|
6611
|
+
logger13.info({ projectId: typed.id, toolId }, "Tool created successfully");
|
|
6155
6612
|
} catch (error) {
|
|
6156
|
-
|
|
6613
|
+
logger13.error(
|
|
6157
6614
|
{ projectId: typed.id, toolId, error },
|
|
6158
6615
|
"Failed to create tool in project"
|
|
6159
6616
|
);
|
|
@@ -6161,7 +6618,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6161
6618
|
}
|
|
6162
6619
|
});
|
|
6163
6620
|
await Promise.all(toolPromises);
|
|
6164
|
-
|
|
6621
|
+
logger13.info(
|
|
6165
6622
|
{
|
|
6166
6623
|
projectId: typed.id,
|
|
6167
6624
|
toolCount: Object.keys(typed.tools).length
|
|
@@ -6170,7 +6627,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6170
6627
|
);
|
|
6171
6628
|
}
|
|
6172
6629
|
if (typed.dataComponents && Object.keys(typed.dataComponents).length > 0) {
|
|
6173
|
-
|
|
6630
|
+
logger13.info(
|
|
6174
6631
|
{
|
|
6175
6632
|
projectId: typed.id,
|
|
6176
6633
|
count: Object.keys(typed.dataComponents).length
|
|
@@ -6180,7 +6637,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6180
6637
|
const dataComponentPromises = Object.entries(typed.dataComponents).map(
|
|
6181
6638
|
async ([componentId, componentData]) => {
|
|
6182
6639
|
try {
|
|
6183
|
-
|
|
6640
|
+
logger13.info(
|
|
6184
6641
|
{ projectId: typed.id, componentId },
|
|
6185
6642
|
"Creating dataComponent in project"
|
|
6186
6643
|
);
|
|
@@ -6191,12 +6648,12 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6191
6648
|
projectId: typed.id
|
|
6192
6649
|
}
|
|
6193
6650
|
});
|
|
6194
|
-
|
|
6651
|
+
logger13.info(
|
|
6195
6652
|
{ projectId: typed.id, componentId },
|
|
6196
6653
|
"DataComponent created successfully"
|
|
6197
6654
|
);
|
|
6198
6655
|
} catch (error) {
|
|
6199
|
-
|
|
6656
|
+
logger13.error(
|
|
6200
6657
|
{ projectId: typed.id, componentId, error },
|
|
6201
6658
|
"Failed to create dataComponent in project"
|
|
6202
6659
|
);
|
|
@@ -6205,7 +6662,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6205
6662
|
}
|
|
6206
6663
|
);
|
|
6207
6664
|
await Promise.all(dataComponentPromises);
|
|
6208
|
-
|
|
6665
|
+
logger13.info(
|
|
6209
6666
|
{
|
|
6210
6667
|
projectId: typed.id,
|
|
6211
6668
|
count: Object.keys(typed.dataComponents).length
|
|
@@ -6214,7 +6671,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6214
6671
|
);
|
|
6215
6672
|
}
|
|
6216
6673
|
if (typed.artifactComponents && Object.keys(typed.artifactComponents).length > 0) {
|
|
6217
|
-
|
|
6674
|
+
logger13.info(
|
|
6218
6675
|
{
|
|
6219
6676
|
projectId: typed.id,
|
|
6220
6677
|
count: Object.keys(typed.artifactComponents).length
|
|
@@ -6224,7 +6681,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6224
6681
|
const artifactComponentPromises = Object.entries(typed.artifactComponents).map(
|
|
6225
6682
|
async ([componentId, componentData]) => {
|
|
6226
6683
|
try {
|
|
6227
|
-
|
|
6684
|
+
logger13.info(
|
|
6228
6685
|
{ projectId: typed.id, componentId },
|
|
6229
6686
|
"Creating artifactComponent in project"
|
|
6230
6687
|
);
|
|
@@ -6235,12 +6692,12 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6235
6692
|
projectId: typed.id
|
|
6236
6693
|
}
|
|
6237
6694
|
});
|
|
6238
|
-
|
|
6695
|
+
logger13.info(
|
|
6239
6696
|
{ projectId: typed.id, componentId },
|
|
6240
6697
|
"ArtifactComponent created successfully"
|
|
6241
6698
|
);
|
|
6242
6699
|
} catch (error) {
|
|
6243
|
-
|
|
6700
|
+
logger13.error(
|
|
6244
6701
|
{ projectId: typed.id, componentId, error },
|
|
6245
6702
|
"Failed to create artifactComponent in project"
|
|
6246
6703
|
);
|
|
@@ -6249,7 +6706,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6249
6706
|
}
|
|
6250
6707
|
);
|
|
6251
6708
|
await Promise.all(artifactComponentPromises);
|
|
6252
|
-
|
|
6709
|
+
logger13.info(
|
|
6253
6710
|
{
|
|
6254
6711
|
projectId: typed.id,
|
|
6255
6712
|
count: Object.keys(typed.artifactComponents).length
|
|
@@ -6258,7 +6715,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6258
6715
|
);
|
|
6259
6716
|
}
|
|
6260
6717
|
if (typed.graphs && Object.keys(typed.graphs).length > 0) {
|
|
6261
|
-
|
|
6718
|
+
logger13.info(
|
|
6262
6719
|
{
|
|
6263
6720
|
projectId: typed.id,
|
|
6264
6721
|
graphCount: Object.keys(typed.graphs).length
|
|
@@ -6267,27 +6724,25 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6267
6724
|
);
|
|
6268
6725
|
const graphPromises = Object.entries(typed.graphs).map(async ([graphId, graphData]) => {
|
|
6269
6726
|
try {
|
|
6270
|
-
|
|
6727
|
+
logger13.info({ projectId: typed.id, graphId }, "Creating graph in project");
|
|
6271
6728
|
const graphDataWithProjectResources = {
|
|
6272
6729
|
...graphData,
|
|
6273
|
-
agents: void 0,
|
|
6274
|
-
// Remove 'agents' property from GraphWithinContextOfProjectSchema
|
|
6275
|
-
subAgents: graphData.subAgents,
|
|
6276
|
-
// Map 'agents' to 'subAgents' for FullGraphDefinitionSchema
|
|
6277
6730
|
tools: typed.tools || {},
|
|
6278
|
-
// Pass project-level
|
|
6731
|
+
// Pass project-level MCP tools for validation
|
|
6732
|
+
functions: typed.functions || {},
|
|
6733
|
+
// Pass project-level functions for validation
|
|
6279
6734
|
dataComponents: typed.dataComponents || {},
|
|
6280
6735
|
artifactComponents: typed.artifactComponents || {},
|
|
6281
6736
|
credentialReferences: typed.credentialReferences || {},
|
|
6282
6737
|
statusUpdates: graphData.statusUpdates === null ? void 0 : graphData.statusUpdates
|
|
6283
6738
|
};
|
|
6284
|
-
await createFullGraphServerSide(db,
|
|
6739
|
+
await createFullGraphServerSide(db, logger13)(
|
|
6285
6740
|
{ tenantId, projectId: typed.id },
|
|
6286
6741
|
graphDataWithProjectResources
|
|
6287
6742
|
);
|
|
6288
|
-
|
|
6743
|
+
logger13.info({ projectId: typed.id, graphId }, "Graph created successfully in project");
|
|
6289
6744
|
} catch (error) {
|
|
6290
|
-
|
|
6745
|
+
logger13.error(
|
|
6291
6746
|
{ projectId: typed.id, graphId, error },
|
|
6292
6747
|
"Failed to create graph in project"
|
|
6293
6748
|
);
|
|
@@ -6295,7 +6750,7 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6295
6750
|
}
|
|
6296
6751
|
});
|
|
6297
6752
|
await Promise.all(graphPromises);
|
|
6298
|
-
|
|
6753
|
+
logger13.info(
|
|
6299
6754
|
{
|
|
6300
6755
|
projectId: typed.id,
|
|
6301
6756
|
graphCount: Object.keys(typed.graphs).length
|
|
@@ -6303,15 +6758,15 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6303
6758
|
"All project graphs created successfully"
|
|
6304
6759
|
);
|
|
6305
6760
|
}
|
|
6306
|
-
|
|
6761
|
+
logger13.info({ projectId: typed.id }, "Full project created successfully");
|
|
6307
6762
|
return await getFullProject(
|
|
6308
6763
|
db,
|
|
6309
|
-
|
|
6764
|
+
logger13
|
|
6310
6765
|
)({
|
|
6311
6766
|
scopes: { tenantId, projectId: typed.id }
|
|
6312
6767
|
});
|
|
6313
6768
|
} catch (error) {
|
|
6314
|
-
|
|
6769
|
+
logger13.error(
|
|
6315
6770
|
{
|
|
6316
6771
|
tenantId,
|
|
6317
6772
|
projectId: typed.id,
|
|
@@ -6322,13 +6777,13 @@ var createFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6322
6777
|
throw error;
|
|
6323
6778
|
}
|
|
6324
6779
|
};
|
|
6325
|
-
var updateFullProjectServerSide = (db,
|
|
6780
|
+
var updateFullProjectServerSide = (db, logger13 = defaultLogger2) => async (scopes, projectData) => {
|
|
6326
6781
|
const { tenantId } = scopes;
|
|
6327
6782
|
const typed = validateAndTypeProjectData(projectData);
|
|
6328
6783
|
if (!typed.id) {
|
|
6329
6784
|
throw new Error("Project ID is required");
|
|
6330
6785
|
}
|
|
6331
|
-
|
|
6786
|
+
logger13.info(
|
|
6332
6787
|
{
|
|
6333
6788
|
tenantId,
|
|
6334
6789
|
projectId: typed.id,
|
|
@@ -6341,8 +6796,8 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6341
6796
|
scopes: { tenantId, projectId: typed.id }
|
|
6342
6797
|
});
|
|
6343
6798
|
if (!existingProject) {
|
|
6344
|
-
|
|
6345
|
-
return await createFullProjectServerSide(db,
|
|
6799
|
+
logger13.info({ projectId: typed.id }, "Project not found, creating new project");
|
|
6800
|
+
return await createFullProjectServerSide(db, logger13)(
|
|
6346
6801
|
{ tenantId, projectId: typed.id },
|
|
6347
6802
|
projectData
|
|
6348
6803
|
);
|
|
@@ -6353,14 +6808,14 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6353
6808
|
models: typed.models,
|
|
6354
6809
|
stopWhen: typed.stopWhen
|
|
6355
6810
|
};
|
|
6356
|
-
|
|
6811
|
+
logger13.info({ projectId: typed.id }, "Updating project metadata");
|
|
6357
6812
|
await updateProject(db)({
|
|
6358
6813
|
scopes: { tenantId, projectId: typed.id },
|
|
6359
6814
|
data: projectUpdatePayload
|
|
6360
6815
|
});
|
|
6361
|
-
|
|
6816
|
+
logger13.info({ projectId: typed.id }, "Project metadata updated successfully");
|
|
6362
6817
|
if (typed.credentialReferences && Object.keys(typed.credentialReferences).length > 0) {
|
|
6363
|
-
|
|
6818
|
+
logger13.info(
|
|
6364
6819
|
{
|
|
6365
6820
|
projectId: typed.id,
|
|
6366
6821
|
count: Object.keys(typed.credentialReferences).length
|
|
@@ -6370,7 +6825,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6370
6825
|
const credentialPromises = Object.entries(typed.credentialReferences).map(
|
|
6371
6826
|
async ([_credId, credData]) => {
|
|
6372
6827
|
try {
|
|
6373
|
-
|
|
6828
|
+
logger13.info(
|
|
6374
6829
|
{ projectId: typed.id, credId: credData.id },
|
|
6375
6830
|
"Updating credentialReference in project"
|
|
6376
6831
|
);
|
|
@@ -6381,12 +6836,12 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6381
6836
|
projectId: typed.id
|
|
6382
6837
|
}
|
|
6383
6838
|
});
|
|
6384
|
-
|
|
6839
|
+
logger13.info(
|
|
6385
6840
|
{ projectId: typed.id, credId: credData.id },
|
|
6386
6841
|
"CredentialReference updated successfully"
|
|
6387
6842
|
);
|
|
6388
6843
|
} catch (error) {
|
|
6389
|
-
|
|
6844
|
+
logger13.error(
|
|
6390
6845
|
{ projectId: typed.id, credId: credData.id, error },
|
|
6391
6846
|
"Failed to update credentialReference in project"
|
|
6392
6847
|
);
|
|
@@ -6395,7 +6850,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6395
6850
|
}
|
|
6396
6851
|
);
|
|
6397
6852
|
await Promise.all(credentialPromises);
|
|
6398
|
-
|
|
6853
|
+
logger13.info(
|
|
6399
6854
|
{
|
|
6400
6855
|
projectId: typed.id,
|
|
6401
6856
|
count: Object.keys(typed.credentialReferences).length
|
|
@@ -6404,7 +6859,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6404
6859
|
);
|
|
6405
6860
|
}
|
|
6406
6861
|
if (typed.functions && Object.keys(typed.functions).length > 0) {
|
|
6407
|
-
|
|
6862
|
+
logger13.info(
|
|
6408
6863
|
{
|
|
6409
6864
|
projectId: typed.id,
|
|
6410
6865
|
functionCount: Object.keys(typed.functions).length
|
|
@@ -6414,19 +6869,19 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6414
6869
|
const functionPromises = Object.entries(typed.functions).map(
|
|
6415
6870
|
async ([functionId, functionData]) => {
|
|
6416
6871
|
try {
|
|
6417
|
-
|
|
6872
|
+
logger13.info({ projectId: typed.id, functionId }, "Updating project function");
|
|
6418
6873
|
await upsertFunction(db)({
|
|
6419
6874
|
data: {
|
|
6420
6875
|
...functionData
|
|
6421
6876
|
},
|
|
6422
6877
|
scopes: { tenantId, projectId: typed.id }
|
|
6423
6878
|
});
|
|
6424
|
-
|
|
6879
|
+
logger13.info(
|
|
6425
6880
|
{ projectId: typed.id, functionId },
|
|
6426
6881
|
"Project function updated successfully"
|
|
6427
6882
|
);
|
|
6428
6883
|
} catch (error) {
|
|
6429
|
-
|
|
6884
|
+
logger13.error(
|
|
6430
6885
|
{ projectId: typed.id, functionId, error },
|
|
6431
6886
|
"Failed to update global function"
|
|
6432
6887
|
);
|
|
@@ -6435,7 +6890,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6435
6890
|
}
|
|
6436
6891
|
);
|
|
6437
6892
|
await Promise.all(functionPromises);
|
|
6438
|
-
|
|
6893
|
+
logger13.info(
|
|
6439
6894
|
{
|
|
6440
6895
|
projectId: typed.id,
|
|
6441
6896
|
functionCount: Object.keys(typed.functions).length
|
|
@@ -6444,7 +6899,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6444
6899
|
);
|
|
6445
6900
|
}
|
|
6446
6901
|
if (typed.tools && Object.keys(typed.tools).length > 0) {
|
|
6447
|
-
|
|
6902
|
+
logger13.info(
|
|
6448
6903
|
{
|
|
6449
6904
|
projectId: typed.id,
|
|
6450
6905
|
toolCount: Object.keys(typed.tools).length
|
|
@@ -6453,7 +6908,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6453
6908
|
);
|
|
6454
6909
|
const toolPromises = Object.entries(typed.tools).map(async ([toolId, toolData]) => {
|
|
6455
6910
|
try {
|
|
6456
|
-
|
|
6911
|
+
logger13.info({ projectId: typed.id, toolId }, "Updating tool in project");
|
|
6457
6912
|
await upsertTool(db)({
|
|
6458
6913
|
data: {
|
|
6459
6914
|
tenantId,
|
|
@@ -6461,9 +6916,9 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6461
6916
|
...toolData
|
|
6462
6917
|
}
|
|
6463
6918
|
});
|
|
6464
|
-
|
|
6919
|
+
logger13.info({ projectId: typed.id, toolId }, "Tool updated successfully");
|
|
6465
6920
|
} catch (error) {
|
|
6466
|
-
|
|
6921
|
+
logger13.error(
|
|
6467
6922
|
{ projectId: typed.id, toolId, error },
|
|
6468
6923
|
"Failed to update tool in project"
|
|
6469
6924
|
);
|
|
@@ -6471,7 +6926,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6471
6926
|
}
|
|
6472
6927
|
});
|
|
6473
6928
|
await Promise.all(toolPromises);
|
|
6474
|
-
|
|
6929
|
+
logger13.info(
|
|
6475
6930
|
{
|
|
6476
6931
|
projectId: typed.id,
|
|
6477
6932
|
toolCount: Object.keys(typed.tools).length
|
|
@@ -6480,7 +6935,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6480
6935
|
);
|
|
6481
6936
|
}
|
|
6482
6937
|
if (typed.dataComponents && Object.keys(typed.dataComponents).length > 0) {
|
|
6483
|
-
|
|
6938
|
+
logger13.info(
|
|
6484
6939
|
{
|
|
6485
6940
|
projectId: typed.id,
|
|
6486
6941
|
count: Object.keys(typed.dataComponents).length
|
|
@@ -6490,7 +6945,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6490
6945
|
const dataComponentPromises = Object.entries(typed.dataComponents).map(
|
|
6491
6946
|
async ([componentId, componentData]) => {
|
|
6492
6947
|
try {
|
|
6493
|
-
|
|
6948
|
+
logger13.info(
|
|
6494
6949
|
{ projectId: typed.id, componentId },
|
|
6495
6950
|
"Updating dataComponent in project"
|
|
6496
6951
|
);
|
|
@@ -6501,12 +6956,12 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6501
6956
|
projectId: typed.id
|
|
6502
6957
|
}
|
|
6503
6958
|
});
|
|
6504
|
-
|
|
6959
|
+
logger13.info(
|
|
6505
6960
|
{ projectId: typed.id, componentId },
|
|
6506
6961
|
"DataComponent updated successfully"
|
|
6507
6962
|
);
|
|
6508
6963
|
} catch (error) {
|
|
6509
|
-
|
|
6964
|
+
logger13.error(
|
|
6510
6965
|
{ projectId: typed.id, componentId, error },
|
|
6511
6966
|
"Failed to update dataComponent in project"
|
|
6512
6967
|
);
|
|
@@ -6515,7 +6970,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6515
6970
|
}
|
|
6516
6971
|
);
|
|
6517
6972
|
await Promise.all(dataComponentPromises);
|
|
6518
|
-
|
|
6973
|
+
logger13.info(
|
|
6519
6974
|
{
|
|
6520
6975
|
projectId: typed.id,
|
|
6521
6976
|
count: Object.keys(typed.dataComponents).length
|
|
@@ -6524,7 +6979,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6524
6979
|
);
|
|
6525
6980
|
}
|
|
6526
6981
|
if (typed.artifactComponents && Object.keys(typed.artifactComponents).length > 0) {
|
|
6527
|
-
|
|
6982
|
+
logger13.info(
|
|
6528
6983
|
{
|
|
6529
6984
|
projectId: typed.id,
|
|
6530
6985
|
count: Object.keys(typed.artifactComponents).length
|
|
@@ -6534,7 +6989,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6534
6989
|
const artifactComponentPromises = Object.entries(typed.artifactComponents).map(
|
|
6535
6990
|
async ([componentId, componentData]) => {
|
|
6536
6991
|
try {
|
|
6537
|
-
|
|
6992
|
+
logger13.info(
|
|
6538
6993
|
{ projectId: typed.id, componentId },
|
|
6539
6994
|
"Updating artifactComponent in project"
|
|
6540
6995
|
);
|
|
@@ -6545,12 +7000,12 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6545
7000
|
projectId: typed.id
|
|
6546
7001
|
}
|
|
6547
7002
|
});
|
|
6548
|
-
|
|
7003
|
+
logger13.info(
|
|
6549
7004
|
{ projectId: typed.id, componentId },
|
|
6550
7005
|
"ArtifactComponent updated successfully"
|
|
6551
7006
|
);
|
|
6552
7007
|
} catch (error) {
|
|
6553
|
-
|
|
7008
|
+
logger13.error(
|
|
6554
7009
|
{ projectId: typed.id, componentId, error },
|
|
6555
7010
|
"Failed to update artifactComponent in project"
|
|
6556
7011
|
);
|
|
@@ -6559,7 +7014,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6559
7014
|
}
|
|
6560
7015
|
);
|
|
6561
7016
|
await Promise.all(artifactComponentPromises);
|
|
6562
|
-
|
|
7017
|
+
logger13.info(
|
|
6563
7018
|
{
|
|
6564
7019
|
projectId: typed.id,
|
|
6565
7020
|
count: Object.keys(typed.artifactComponents).length
|
|
@@ -6577,14 +7032,14 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6577
7032
|
try {
|
|
6578
7033
|
await deleteFullGraph(
|
|
6579
7034
|
db,
|
|
6580
|
-
|
|
7035
|
+
logger13
|
|
6581
7036
|
)({
|
|
6582
7037
|
scopes: { tenantId, projectId: typed.id, graphId: graph.id }
|
|
6583
7038
|
});
|
|
6584
7039
|
deletedGraphCount++;
|
|
6585
|
-
|
|
7040
|
+
logger13.info({ graphId: graph.id }, "Deleted orphaned graph from project");
|
|
6586
7041
|
} catch (error) {
|
|
6587
|
-
|
|
7042
|
+
logger13.error(
|
|
6588
7043
|
{ graphId: graph.id, error },
|
|
6589
7044
|
"Failed to delete orphaned graph from project"
|
|
6590
7045
|
);
|
|
@@ -6592,7 +7047,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6592
7047
|
}
|
|
6593
7048
|
}
|
|
6594
7049
|
if (deletedGraphCount > 0) {
|
|
6595
|
-
|
|
7050
|
+
logger13.info(
|
|
6596
7051
|
{
|
|
6597
7052
|
deletedGraphCount,
|
|
6598
7053
|
projectId: typed.id
|
|
@@ -6601,7 +7056,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6601
7056
|
);
|
|
6602
7057
|
}
|
|
6603
7058
|
if (typed.graphs && Object.keys(typed.graphs).length > 0) {
|
|
6604
|
-
|
|
7059
|
+
logger13.info(
|
|
6605
7060
|
{
|
|
6606
7061
|
projectId: typed.id,
|
|
6607
7062
|
graphCount: Object.keys(typed.graphs).length
|
|
@@ -6610,27 +7065,25 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6610
7065
|
);
|
|
6611
7066
|
const graphPromises = Object.entries(typed.graphs).map(async ([graphId, graphData]) => {
|
|
6612
7067
|
try {
|
|
6613
|
-
|
|
7068
|
+
logger13.info({ projectId: typed.id, graphId }, "Updating graph in project");
|
|
6614
7069
|
const graphDataWithProjectResources = {
|
|
6615
7070
|
...graphData,
|
|
6616
|
-
agents: void 0,
|
|
6617
|
-
// Remove 'agents' property from GraphWithinContextOfProjectSchema
|
|
6618
|
-
subAgents: graphData.subAgents,
|
|
6619
|
-
// Map 'agents' to 'subAgents' for FullGraphDefinitionSchema
|
|
6620
7071
|
tools: typed.tools || {},
|
|
6621
|
-
// Pass project-level
|
|
7072
|
+
// Pass project-level MCP tools for validation
|
|
7073
|
+
functions: typed.functions || {},
|
|
7074
|
+
// Pass project-level functions for validation
|
|
6622
7075
|
dataComponents: typed.dataComponents || {},
|
|
6623
7076
|
artifactComponents: typed.artifactComponents || {},
|
|
6624
7077
|
credentialReferences: typed.credentialReferences || {},
|
|
6625
7078
|
statusUpdates: graphData.statusUpdates === null ? void 0 : graphData.statusUpdates
|
|
6626
7079
|
};
|
|
6627
|
-
await updateFullGraphServerSide(db,
|
|
7080
|
+
await updateFullGraphServerSide(db, logger13)(
|
|
6628
7081
|
{ tenantId, projectId: typed.id },
|
|
6629
7082
|
graphDataWithProjectResources
|
|
6630
7083
|
);
|
|
6631
|
-
|
|
7084
|
+
logger13.info({ projectId: typed.id, graphId }, "Graph updated successfully in project");
|
|
6632
7085
|
} catch (error) {
|
|
6633
|
-
|
|
7086
|
+
logger13.error(
|
|
6634
7087
|
{ projectId: typed.id, graphId, error },
|
|
6635
7088
|
"Failed to update graph in project"
|
|
6636
7089
|
);
|
|
@@ -6638,7 +7091,7 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6638
7091
|
}
|
|
6639
7092
|
});
|
|
6640
7093
|
await Promise.all(graphPromises);
|
|
6641
|
-
|
|
7094
|
+
logger13.info(
|
|
6642
7095
|
{
|
|
6643
7096
|
projectId: typed.id,
|
|
6644
7097
|
graphCount: Object.keys(typed.graphs).length
|
|
@@ -6646,15 +7099,15 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6646
7099
|
"All project graphs updated successfully"
|
|
6647
7100
|
);
|
|
6648
7101
|
}
|
|
6649
|
-
|
|
7102
|
+
logger13.info({ projectId: typed.id }, "Full project updated successfully");
|
|
6650
7103
|
return await getFullProject(
|
|
6651
7104
|
db,
|
|
6652
|
-
|
|
7105
|
+
logger13
|
|
6653
7106
|
)({
|
|
6654
7107
|
scopes: { tenantId, projectId: typed.id }
|
|
6655
7108
|
});
|
|
6656
7109
|
} catch (error) {
|
|
6657
|
-
|
|
7110
|
+
logger13.error(
|
|
6658
7111
|
{
|
|
6659
7112
|
tenantId,
|
|
6660
7113
|
projectId: typed.id,
|
|
@@ -6665,23 +7118,23 @@ var updateFullProjectServerSide = (db, logger12 = defaultLogger2) => async (scop
|
|
|
6665
7118
|
throw error;
|
|
6666
7119
|
}
|
|
6667
7120
|
};
|
|
6668
|
-
var getFullProject = (db,
|
|
7121
|
+
var getFullProject = (db, logger13 = defaultLogger2) => async (params) => {
|
|
6669
7122
|
const { scopes } = params;
|
|
6670
7123
|
const { tenantId, projectId } = scopes;
|
|
6671
|
-
|
|
7124
|
+
logger13.info({ tenantId, projectId }, "Retrieving full project definition");
|
|
6672
7125
|
try {
|
|
6673
7126
|
const project = await getProject(db)({
|
|
6674
7127
|
scopes: { tenantId, projectId }
|
|
6675
7128
|
});
|
|
6676
7129
|
if (!project) {
|
|
6677
|
-
|
|
7130
|
+
logger13.info({ tenantId, projectId }, "Project not found");
|
|
6678
7131
|
return null;
|
|
6679
7132
|
}
|
|
6680
|
-
|
|
7133
|
+
logger13.info({ tenantId, projectId }, "Project metadata retrieved");
|
|
6681
7134
|
const graphList = await listAgentGraphs(db)({
|
|
6682
7135
|
scopes: { tenantId, projectId }
|
|
6683
7136
|
});
|
|
6684
|
-
|
|
7137
|
+
logger13.info(
|
|
6685
7138
|
{
|
|
6686
7139
|
tenantId,
|
|
6687
7140
|
projectId,
|
|
@@ -6709,12 +7162,12 @@ var getFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6709
7162
|
// status, lastHealthCheck, availableTools, activeTools, lastToolsSync are all runtime
|
|
6710
7163
|
};
|
|
6711
7164
|
}
|
|
6712
|
-
|
|
7165
|
+
logger13.info(
|
|
6713
7166
|
{ tenantId, projectId, toolCount: Object.keys(projectTools).length },
|
|
6714
7167
|
"Tools retrieved for project"
|
|
6715
7168
|
);
|
|
6716
7169
|
} catch (error) {
|
|
6717
|
-
|
|
7170
|
+
logger13.warn({ tenantId, projectId, error }, "Failed to retrieve tools for project");
|
|
6718
7171
|
}
|
|
6719
7172
|
const projectDataComponents = {};
|
|
6720
7173
|
try {
|
|
@@ -6729,12 +7182,12 @@ var getFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6729
7182
|
props: component.props
|
|
6730
7183
|
};
|
|
6731
7184
|
}
|
|
6732
|
-
|
|
7185
|
+
logger13.info(
|
|
6733
7186
|
{ tenantId, projectId, count: Object.keys(projectDataComponents).length },
|
|
6734
7187
|
"DataComponents retrieved for project"
|
|
6735
7188
|
);
|
|
6736
7189
|
} catch (error) {
|
|
6737
|
-
|
|
7190
|
+
logger13.warn(
|
|
6738
7191
|
{ tenantId, projectId, error },
|
|
6739
7192
|
"Failed to retrieve dataComponents for project"
|
|
6740
7193
|
);
|
|
@@ -6752,12 +7205,12 @@ var getFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6752
7205
|
props: component.props
|
|
6753
7206
|
};
|
|
6754
7207
|
}
|
|
6755
|
-
|
|
7208
|
+
logger13.info(
|
|
6756
7209
|
{ tenantId, projectId, count: Object.keys(projectArtifactComponents).length },
|
|
6757
7210
|
"ArtifactComponents retrieved for project"
|
|
6758
7211
|
);
|
|
6759
7212
|
} catch (error) {
|
|
6760
|
-
|
|
7213
|
+
logger13.warn(
|
|
6761
7214
|
{ tenantId, projectId, error },
|
|
6762
7215
|
"Failed to retrieve artifactComponents for project"
|
|
6763
7216
|
);
|
|
@@ -6775,12 +7228,12 @@ var getFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6775
7228
|
retrievalParams: credential.retrievalParams
|
|
6776
7229
|
};
|
|
6777
7230
|
}
|
|
6778
|
-
|
|
7231
|
+
logger13.info(
|
|
6779
7232
|
{ tenantId, projectId, count: Object.keys(projectCredentialReferences).length },
|
|
6780
7233
|
"CredentialReferences retrieved for project"
|
|
6781
7234
|
);
|
|
6782
7235
|
} catch (error) {
|
|
6783
|
-
|
|
7236
|
+
logger13.warn(
|
|
6784
7237
|
{ tenantId, projectId, error },
|
|
6785
7238
|
"Failed to retrieve credentialReferences for project"
|
|
6786
7239
|
);
|
|
@@ -6789,7 +7242,7 @@ var getFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6789
7242
|
if (graphList.length > 0) {
|
|
6790
7243
|
const graphPromises = graphList.map(async (graph) => {
|
|
6791
7244
|
try {
|
|
6792
|
-
|
|
7245
|
+
logger13.info(
|
|
6793
7246
|
{ tenantId, projectId, graphId: graph.id },
|
|
6794
7247
|
"Retrieving full graph definition"
|
|
6795
7248
|
);
|
|
@@ -6798,15 +7251,15 @@ var getFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6798
7251
|
});
|
|
6799
7252
|
if (fullGraph) {
|
|
6800
7253
|
graphs[graph.id] = fullGraph;
|
|
6801
|
-
|
|
7254
|
+
logger13.info(
|
|
6802
7255
|
{ tenantId, projectId, graphId: graph.id },
|
|
6803
7256
|
"Full graph definition retrieved"
|
|
6804
7257
|
);
|
|
6805
7258
|
} else {
|
|
6806
|
-
|
|
7259
|
+
logger13.warn({ tenantId, projectId, graphId: graph.id }, "Graph definition not found");
|
|
6807
7260
|
}
|
|
6808
7261
|
} catch (error) {
|
|
6809
|
-
|
|
7262
|
+
logger13.error(
|
|
6810
7263
|
{ tenantId, projectId, graphId: graph.id, error },
|
|
6811
7264
|
"Failed to retrieve full graph definition"
|
|
6812
7265
|
);
|
|
@@ -6833,7 +7286,7 @@ var getFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6833
7286
|
createdAt: project.createdAt,
|
|
6834
7287
|
updatedAt: project.updatedAt
|
|
6835
7288
|
};
|
|
6836
|
-
|
|
7289
|
+
logger13.info(
|
|
6837
7290
|
{
|
|
6838
7291
|
tenantId,
|
|
6839
7292
|
projectId,
|
|
@@ -6843,7 +7296,7 @@ var getFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6843
7296
|
);
|
|
6844
7297
|
return fullProjectDefinition;
|
|
6845
7298
|
} catch (error) {
|
|
6846
|
-
|
|
7299
|
+
logger13.error(
|
|
6847
7300
|
{
|
|
6848
7301
|
tenantId,
|
|
6849
7302
|
projectId,
|
|
@@ -6854,23 +7307,23 @@ var getFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6854
7307
|
throw error;
|
|
6855
7308
|
}
|
|
6856
7309
|
};
|
|
6857
|
-
var deleteFullProject = (db,
|
|
7310
|
+
var deleteFullProject = (db, logger13 = defaultLogger2) => async (params) => {
|
|
6858
7311
|
const { scopes } = params;
|
|
6859
7312
|
const { tenantId, projectId } = scopes;
|
|
6860
|
-
|
|
7313
|
+
logger13.info({ tenantId, projectId }, "Deleting full project and related entities");
|
|
6861
7314
|
try {
|
|
6862
7315
|
const project = await getFullProject(
|
|
6863
7316
|
db,
|
|
6864
|
-
|
|
7317
|
+
logger13
|
|
6865
7318
|
)({
|
|
6866
7319
|
scopes: { tenantId, projectId }
|
|
6867
7320
|
});
|
|
6868
7321
|
if (!project) {
|
|
6869
|
-
|
|
7322
|
+
logger13.info({ tenantId, projectId }, "Project not found for deletion");
|
|
6870
7323
|
return false;
|
|
6871
7324
|
}
|
|
6872
7325
|
if (project.graphs && Object.keys(project.graphs).length > 0) {
|
|
6873
|
-
|
|
7326
|
+
logger13.info(
|
|
6874
7327
|
{
|
|
6875
7328
|
tenantId,
|
|
6876
7329
|
projectId,
|
|
@@ -6880,19 +7333,19 @@ var deleteFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6880
7333
|
);
|
|
6881
7334
|
const graphPromises = Object.keys(project.graphs).map(async (graphId) => {
|
|
6882
7335
|
try {
|
|
6883
|
-
|
|
7336
|
+
logger13.info({ tenantId, projectId, graphId }, "Deleting graph from project");
|
|
6884
7337
|
await deleteFullGraph(
|
|
6885
7338
|
db,
|
|
6886
|
-
|
|
7339
|
+
logger13
|
|
6887
7340
|
)({
|
|
6888
7341
|
scopes: { tenantId, projectId, graphId }
|
|
6889
7342
|
});
|
|
6890
|
-
|
|
7343
|
+
logger13.info(
|
|
6891
7344
|
{ tenantId, projectId, graphId },
|
|
6892
7345
|
"Graph deleted successfully from project"
|
|
6893
7346
|
);
|
|
6894
7347
|
} catch (error) {
|
|
6895
|
-
|
|
7348
|
+
logger13.error(
|
|
6896
7349
|
{ tenantId, projectId, graphId, error },
|
|
6897
7350
|
"Failed to delete graph from project"
|
|
6898
7351
|
);
|
|
@@ -6900,7 +7353,7 @@ var deleteFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6900
7353
|
}
|
|
6901
7354
|
});
|
|
6902
7355
|
await Promise.all(graphPromises);
|
|
6903
|
-
|
|
7356
|
+
logger13.info(
|
|
6904
7357
|
{
|
|
6905
7358
|
tenantId,
|
|
6906
7359
|
projectId,
|
|
@@ -6913,13 +7366,13 @@ var deleteFullProject = (db, logger12 = defaultLogger2) => async (params) => {
|
|
|
6913
7366
|
scopes: { tenantId, projectId }
|
|
6914
7367
|
});
|
|
6915
7368
|
if (!deleted) {
|
|
6916
|
-
|
|
7369
|
+
logger13.warn({ tenantId, projectId }, "Project deletion returned false");
|
|
6917
7370
|
return false;
|
|
6918
7371
|
}
|
|
6919
|
-
|
|
7372
|
+
logger13.info({ tenantId, projectId }, "Full project deleted successfully");
|
|
6920
7373
|
return true;
|
|
6921
7374
|
} catch (error) {
|
|
6922
|
-
|
|
7375
|
+
logger13.error(
|
|
6923
7376
|
{
|
|
6924
7377
|
tenantId,
|
|
6925
7378
|
projectId,
|
|
@@ -6997,7 +7450,7 @@ var createValidatedDataAccess = (db, dataAccessFunctions) => {
|
|
|
6997
7450
|
|
|
6998
7451
|
// src/utils/tracer.ts
|
|
6999
7452
|
var tracer = getTracer("agents-core");
|
|
7000
|
-
var
|
|
7453
|
+
var logger7 = getLogger("context-cache");
|
|
7001
7454
|
var ContextCache = class {
|
|
7002
7455
|
constructor(tenantId, projectId, dbClient) {
|
|
7003
7456
|
__publicField(this, "tenantId");
|
|
@@ -7006,7 +7459,7 @@ var ContextCache = class {
|
|
|
7006
7459
|
this.tenantId = tenantId;
|
|
7007
7460
|
this.projectId = projectId;
|
|
7008
7461
|
this.dbClient = dbClient;
|
|
7009
|
-
|
|
7462
|
+
logger7.info(
|
|
7010
7463
|
{
|
|
7011
7464
|
tenantId: this.tenantId
|
|
7012
7465
|
},
|
|
@@ -7041,7 +7494,7 @@ var ContextCache = class {
|
|
|
7041
7494
|
tenantId: this.tenantId
|
|
7042
7495
|
};
|
|
7043
7496
|
} catch (error) {
|
|
7044
|
-
|
|
7497
|
+
logger7.error(
|
|
7045
7498
|
{
|
|
7046
7499
|
conversationId,
|
|
7047
7500
|
contextConfigId,
|
|
@@ -7075,7 +7528,7 @@ var ContextCache = class {
|
|
|
7075
7528
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
7076
7529
|
};
|
|
7077
7530
|
await setCacheEntry(this.dbClient)(cacheData);
|
|
7078
|
-
|
|
7531
|
+
logger7.debug(
|
|
7079
7532
|
{
|
|
7080
7533
|
conversationId: entry.conversationId,
|
|
7081
7534
|
contextConfigId: entry.contextConfigId,
|
|
@@ -7084,7 +7537,7 @@ var ContextCache = class {
|
|
|
7084
7537
|
"Cache entry set successfully"
|
|
7085
7538
|
);
|
|
7086
7539
|
} catch (error) {
|
|
7087
|
-
|
|
7540
|
+
logger7.error(
|
|
7088
7541
|
{
|
|
7089
7542
|
conversationId: entry.conversationId,
|
|
7090
7543
|
contextConfigId: entry.contextConfigId,
|
|
@@ -7104,7 +7557,7 @@ var ContextCache = class {
|
|
|
7104
7557
|
scopes: { tenantId, projectId },
|
|
7105
7558
|
conversationId
|
|
7106
7559
|
});
|
|
7107
|
-
|
|
7560
|
+
logger7.info(
|
|
7108
7561
|
{
|
|
7109
7562
|
conversationId,
|
|
7110
7563
|
rowsCleared: result
|
|
@@ -7112,7 +7565,7 @@ var ContextCache = class {
|
|
|
7112
7565
|
"Conversation cache cleared successfully"
|
|
7113
7566
|
);
|
|
7114
7567
|
} catch (error) {
|
|
7115
|
-
|
|
7568
|
+
logger7.error(
|
|
7116
7569
|
{
|
|
7117
7570
|
conversationId,
|
|
7118
7571
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -7131,7 +7584,7 @@ var ContextCache = class {
|
|
|
7131
7584
|
scopes: { tenantId, projectId },
|
|
7132
7585
|
contextConfigId
|
|
7133
7586
|
});
|
|
7134
|
-
|
|
7587
|
+
logger7.info(
|
|
7135
7588
|
{
|
|
7136
7589
|
contextConfigId,
|
|
7137
7590
|
rowsCleared: result
|
|
@@ -7139,7 +7592,7 @@ var ContextCache = class {
|
|
|
7139
7592
|
"Context config cache cleared successfully"
|
|
7140
7593
|
);
|
|
7141
7594
|
} catch (error) {
|
|
7142
|
-
|
|
7595
|
+
logger7.error(
|
|
7143
7596
|
{
|
|
7144
7597
|
contextConfigId,
|
|
7145
7598
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -7157,14 +7610,14 @@ var ContextCache = class {
|
|
|
7157
7610
|
const result = await cleanupTenantCache(this.dbClient)({
|
|
7158
7611
|
scopes: { tenantId: this.tenantId, projectId: this.projectId }
|
|
7159
7612
|
});
|
|
7160
|
-
|
|
7613
|
+
logger7.info(
|
|
7161
7614
|
{
|
|
7162
7615
|
rowsCleared: result
|
|
7163
7616
|
},
|
|
7164
7617
|
"Cache cleanup completed"
|
|
7165
7618
|
);
|
|
7166
7619
|
} catch (error) {
|
|
7167
|
-
|
|
7620
|
+
logger7.error(
|
|
7168
7621
|
{
|
|
7169
7622
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
7170
7623
|
},
|
|
@@ -7191,7 +7644,7 @@ var ContextCache = class {
|
|
|
7191
7644
|
};
|
|
7192
7645
|
|
|
7193
7646
|
// src/context/ContextResolver.ts
|
|
7194
|
-
var
|
|
7647
|
+
var logger8 = getLogger("context-resolver");
|
|
7195
7648
|
var ContextResolver = class {
|
|
7196
7649
|
constructor(tenantId, projectId, dbClient, credentialStoreRegistry) {
|
|
7197
7650
|
__publicField(this, "fetcher");
|
|
@@ -7202,7 +7655,7 @@ var ContextResolver = class {
|
|
|
7202
7655
|
this.projectId = projectId;
|
|
7203
7656
|
this.fetcher = new ContextFetcher(tenantId, projectId, dbClient, credentialStoreRegistry);
|
|
7204
7657
|
this.cache = new ContextCache(tenantId, projectId, dbClient);
|
|
7205
|
-
|
|
7658
|
+
logger8.info(
|
|
7206
7659
|
{
|
|
7207
7660
|
tenantId: this.tenantId,
|
|
7208
7661
|
hasCredentialSupport: !!credentialStoreRegistry
|
|
@@ -7215,7 +7668,7 @@ var ContextResolver = class {
|
|
|
7215
7668
|
*/
|
|
7216
7669
|
async resolve(contextConfig2, options) {
|
|
7217
7670
|
const startTime = Date.now();
|
|
7218
|
-
|
|
7671
|
+
logger8.info(
|
|
7219
7672
|
{
|
|
7220
7673
|
contextConfigId: contextConfig2.id,
|
|
7221
7674
|
triggerEvent: options.triggerEvent,
|
|
@@ -7255,7 +7708,7 @@ var ContextResolver = class {
|
|
|
7255
7708
|
options.conversationId,
|
|
7256
7709
|
contextConfig2.id
|
|
7257
7710
|
);
|
|
7258
|
-
|
|
7711
|
+
logger8.info(
|
|
7259
7712
|
{
|
|
7260
7713
|
conversationId: options.conversationId,
|
|
7261
7714
|
contextConfigId: contextConfig2.id
|
|
@@ -7269,7 +7722,7 @@ var ContextResolver = class {
|
|
|
7269
7722
|
value: options.headers,
|
|
7270
7723
|
tenantId: this.tenantId
|
|
7271
7724
|
});
|
|
7272
|
-
|
|
7725
|
+
logger8.info(
|
|
7273
7726
|
{
|
|
7274
7727
|
conversationId: options.conversationId,
|
|
7275
7728
|
contextConfigId: contextConfig2.id
|
|
@@ -7285,7 +7738,7 @@ var ContextResolver = class {
|
|
|
7285
7738
|
const contextVariables = contextConfig2.contextVariables || {};
|
|
7286
7739
|
const contextVariableEntries = Object.entries(contextVariables);
|
|
7287
7740
|
if (contextVariableEntries.length === 0) {
|
|
7288
|
-
|
|
7741
|
+
logger8.info(
|
|
7289
7742
|
{
|
|
7290
7743
|
contextConfigId: contextConfig2.id
|
|
7291
7744
|
},
|
|
@@ -7321,7 +7774,7 @@ var ContextResolver = class {
|
|
|
7321
7774
|
result
|
|
7322
7775
|
).catch((error) => {
|
|
7323
7776
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
7324
|
-
|
|
7777
|
+
logger8.error(
|
|
7325
7778
|
{
|
|
7326
7779
|
contextConfigId: contextConfig2.id,
|
|
7327
7780
|
definitionId: definition.id,
|
|
@@ -7336,7 +7789,7 @@ var ContextResolver = class {
|
|
|
7336
7789
|
});
|
|
7337
7790
|
if (definition.defaultValue !== void 0) {
|
|
7338
7791
|
result.resolvedContext[templateKey] = definition.defaultValue;
|
|
7339
|
-
|
|
7792
|
+
logger8.info(
|
|
7340
7793
|
{
|
|
7341
7794
|
contextConfigId: contextConfig2.id,
|
|
7342
7795
|
definitionId: definition.id,
|
|
@@ -7361,7 +7814,7 @@ var ContextResolver = class {
|
|
|
7361
7814
|
} else {
|
|
7362
7815
|
parentSpan.setStatus({ code: SpanStatusCode.OK });
|
|
7363
7816
|
}
|
|
7364
|
-
|
|
7817
|
+
logger8.info(
|
|
7365
7818
|
{
|
|
7366
7819
|
contextConfigId: contextConfig2.id,
|
|
7367
7820
|
resolvedKeys: Object.keys(result.resolvedContext),
|
|
@@ -7377,7 +7830,7 @@ var ContextResolver = class {
|
|
|
7377
7830
|
} catch (error) {
|
|
7378
7831
|
const durationMs = Date.now() - startTime;
|
|
7379
7832
|
setSpanWithError(parentSpan, error instanceof Error ? error : new Error(String(error)));
|
|
7380
|
-
|
|
7833
|
+
logger8.error(
|
|
7381
7834
|
{
|
|
7382
7835
|
contextConfigId: contextConfig2.id,
|
|
7383
7836
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -7405,7 +7858,7 @@ var ContextResolver = class {
|
|
|
7405
7858
|
if (cachedEntry) {
|
|
7406
7859
|
result.resolvedContext[templateKey] = cachedEntry.value;
|
|
7407
7860
|
result.cacheHits.push(definition.id);
|
|
7408
|
-
|
|
7861
|
+
logger8.debug(
|
|
7409
7862
|
{
|
|
7410
7863
|
definitionId: definition.id,
|
|
7411
7864
|
templateKey,
|
|
@@ -7416,7 +7869,7 @@ var ContextResolver = class {
|
|
|
7416
7869
|
return;
|
|
7417
7870
|
}
|
|
7418
7871
|
result.cacheMisses.push(definition.id);
|
|
7419
|
-
|
|
7872
|
+
logger8.debug(
|
|
7420
7873
|
{
|
|
7421
7874
|
definitionId: definition.id,
|
|
7422
7875
|
templateKey,
|
|
@@ -7473,7 +7926,7 @@ var ContextResolver = class {
|
|
|
7473
7926
|
requestHash,
|
|
7474
7927
|
tenantId: this.tenantId
|
|
7475
7928
|
});
|
|
7476
|
-
|
|
7929
|
+
logger8.debug(
|
|
7477
7930
|
{
|
|
7478
7931
|
definitionId: definition.id,
|
|
7479
7932
|
templateKey,
|
|
@@ -7508,7 +7961,7 @@ var ContextResolver = class {
|
|
|
7508
7961
|
*/
|
|
7509
7962
|
async clearCache(tenantId, projectId, conversationId) {
|
|
7510
7963
|
await this.cache.clearConversation(tenantId, projectId, conversationId);
|
|
7511
|
-
|
|
7964
|
+
logger8.info(
|
|
7512
7965
|
{
|
|
7513
7966
|
conversationId
|
|
7514
7967
|
},
|
|
@@ -7518,7 +7971,7 @@ var ContextResolver = class {
|
|
|
7518
7971
|
};
|
|
7519
7972
|
|
|
7520
7973
|
// src/middleware/contextValidation.ts
|
|
7521
|
-
var
|
|
7974
|
+
var logger9 = getLogger("context-validation");
|
|
7522
7975
|
var ajv = new Ajv({ allErrors: true, strict: false });
|
|
7523
7976
|
var HTTP_REQUEST_PARTS = ["headers"];
|
|
7524
7977
|
var MAX_SCHEMA_CACHE_SIZE = 1e3;
|
|
@@ -7581,7 +8034,7 @@ function validationHelper(jsonSchema) {
|
|
|
7581
8034
|
return getCachedValidator(jsonSchema);
|
|
7582
8035
|
}
|
|
7583
8036
|
function validateAgainstJsonSchema(jsonSchema, context) {
|
|
7584
|
-
|
|
8037
|
+
logger9.debug({ jsonSchema, context }, "Validating context against JSON Schema");
|
|
7585
8038
|
const validate = validationHelper(jsonSchema);
|
|
7586
8039
|
return validate(context);
|
|
7587
8040
|
}
|
|
@@ -7671,7 +8124,7 @@ async function validateHttpRequestHeaders(headersSchema, httpRequest) {
|
|
|
7671
8124
|
validatedContext: filteredContext
|
|
7672
8125
|
};
|
|
7673
8126
|
} catch (error) {
|
|
7674
|
-
|
|
8127
|
+
logger9.error(
|
|
7675
8128
|
{ error: error instanceof Error ? error.message : "Unknown error" },
|
|
7676
8129
|
"Failed to validate headers schema"
|
|
7677
8130
|
);
|
|
@@ -7724,7 +8177,7 @@ async function validateHeaders({
|
|
|
7724
8177
|
scopes: { tenantId, projectId, graphId }
|
|
7725
8178
|
});
|
|
7726
8179
|
if (!agentGraph2?.contextConfigId) {
|
|
7727
|
-
|
|
8180
|
+
logger9.debug({ graphId }, "No context config found for graph, skipping validation");
|
|
7728
8181
|
return {
|
|
7729
8182
|
valid: true,
|
|
7730
8183
|
errors: [],
|
|
@@ -7736,7 +8189,7 @@ async function validateHeaders({
|
|
|
7736
8189
|
id: agentGraph2.contextConfigId
|
|
7737
8190
|
});
|
|
7738
8191
|
if (!contextConfig2) {
|
|
7739
|
-
|
|
8192
|
+
logger9.warn({ contextConfigId: agentGraph2.contextConfigId }, "Context config not found");
|
|
7740
8193
|
return {
|
|
7741
8194
|
valid: false,
|
|
7742
8195
|
errors: [
|
|
@@ -7748,7 +8201,7 @@ async function validateHeaders({
|
|
|
7748
8201
|
};
|
|
7749
8202
|
}
|
|
7750
8203
|
if (!contextConfig2.headersSchema) {
|
|
7751
|
-
|
|
8204
|
+
logger9.debug(
|
|
7752
8205
|
{ contextConfigId: contextConfig2.id },
|
|
7753
8206
|
"No headers schema defined, accepting any context"
|
|
7754
8207
|
);
|
|
@@ -7760,7 +8213,7 @@ async function validateHeaders({
|
|
|
7760
8213
|
}
|
|
7761
8214
|
try {
|
|
7762
8215
|
const schema = contextConfig2.headersSchema;
|
|
7763
|
-
|
|
8216
|
+
logger9.debug({ contextConfigId: contextConfig2.id }, "Using headers schema validation");
|
|
7764
8217
|
const httpRequest = parsedRequest;
|
|
7765
8218
|
const validationResult = await validateHttpRequestHeaders(schema, httpRequest);
|
|
7766
8219
|
if (validationResult.valid) {
|
|
@@ -7783,7 +8236,7 @@ async function validateHeaders({
|
|
|
7783
8236
|
return validationResult;
|
|
7784
8237
|
}
|
|
7785
8238
|
} catch (error) {
|
|
7786
|
-
|
|
8239
|
+
logger9.error(
|
|
7787
8240
|
{
|
|
7788
8241
|
contextConfigId: contextConfig2.id,
|
|
7789
8242
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -7801,7 +8254,7 @@ async function validateHeaders({
|
|
|
7801
8254
|
};
|
|
7802
8255
|
}
|
|
7803
8256
|
} catch (error) {
|
|
7804
|
-
|
|
8257
|
+
logger9.error(
|
|
7805
8258
|
{
|
|
7806
8259
|
tenantId,
|
|
7807
8260
|
graphId,
|
|
@@ -7853,7 +8306,7 @@ function contextValidationMiddleware(dbClient) {
|
|
|
7853
8306
|
credentialStores
|
|
7854
8307
|
});
|
|
7855
8308
|
if (!validationResult.valid) {
|
|
7856
|
-
|
|
8309
|
+
logger9.warn(
|
|
7857
8310
|
{
|
|
7858
8311
|
tenantId,
|
|
7859
8312
|
graphId,
|
|
@@ -7868,7 +8321,7 @@ function contextValidationMiddleware(dbClient) {
|
|
|
7868
8321
|
});
|
|
7869
8322
|
}
|
|
7870
8323
|
c.set("validatedContext", validationResult.validatedContext);
|
|
7871
|
-
|
|
8324
|
+
logger9.debug(
|
|
7872
8325
|
{
|
|
7873
8326
|
tenantId,
|
|
7874
8327
|
graphId,
|
|
@@ -7878,7 +8331,7 @@ function contextValidationMiddleware(dbClient) {
|
|
|
7878
8331
|
);
|
|
7879
8332
|
return next();
|
|
7880
8333
|
} catch (error) {
|
|
7881
|
-
|
|
8334
|
+
logger9.error(
|
|
7882
8335
|
{
|
|
7883
8336
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
7884
8337
|
},
|
|
@@ -7893,7 +8346,7 @@ function contextValidationMiddleware(dbClient) {
|
|
|
7893
8346
|
}
|
|
7894
8347
|
|
|
7895
8348
|
// src/context/ContextFetcher.ts
|
|
7896
|
-
var
|
|
8349
|
+
var logger10 = getLogger("context-fetcher");
|
|
7897
8350
|
var checkGraphQLErrors = (data) => {
|
|
7898
8351
|
if (data && typeof data === "object" && "errors" in data) {
|
|
7899
8352
|
const errorObj = data;
|
|
@@ -7922,7 +8375,7 @@ var ContextFetcher = class {
|
|
|
7922
8375
|
this.credentialStuffer = new CredentialStuffer(credentialStoreRegistry);
|
|
7923
8376
|
}
|
|
7924
8377
|
this.dbClient = dbClient;
|
|
7925
|
-
|
|
8378
|
+
logger10.info(
|
|
7926
8379
|
{
|
|
7927
8380
|
tenantId: this.tenantId,
|
|
7928
8381
|
defaultTimeout: this.defaultTimeout,
|
|
@@ -7936,7 +8389,7 @@ var ContextFetcher = class {
|
|
|
7936
8389
|
*/
|
|
7937
8390
|
async fetch(definition, context) {
|
|
7938
8391
|
const startTime = Date.now();
|
|
7939
|
-
|
|
8392
|
+
logger10.info(
|
|
7940
8393
|
{
|
|
7941
8394
|
definitionId: definition.id,
|
|
7942
8395
|
url: definition.fetchConfig.url
|
|
@@ -7950,7 +8403,7 @@ var ContextFetcher = class {
|
|
|
7950
8403
|
definition.credentialReferenceId
|
|
7951
8404
|
);
|
|
7952
8405
|
const response = await this.performRequest(resolvedConfig);
|
|
7953
|
-
|
|
8406
|
+
logger10.info({ response }, "ContextFetcher Response");
|
|
7954
8407
|
let transformedData = response.data;
|
|
7955
8408
|
if (definition.fetchConfig.transform) {
|
|
7956
8409
|
transformedData = this.transformResponse(response.data, definition.fetchConfig.transform);
|
|
@@ -7963,7 +8416,7 @@ var ContextFetcher = class {
|
|
|
7963
8416
|
);
|
|
7964
8417
|
}
|
|
7965
8418
|
const durationMs = Date.now() - startTime;
|
|
7966
|
-
|
|
8419
|
+
logger10.info(
|
|
7967
8420
|
{
|
|
7968
8421
|
definitionId: definition.id,
|
|
7969
8422
|
source: response.source,
|
|
@@ -7975,7 +8428,7 @@ var ContextFetcher = class {
|
|
|
7975
8428
|
} catch (error) {
|
|
7976
8429
|
const durationMs = Date.now() - startTime;
|
|
7977
8430
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
7978
|
-
|
|
8431
|
+
logger10.error(
|
|
7979
8432
|
{
|
|
7980
8433
|
definitionId: definition.id,
|
|
7981
8434
|
error: errorMessage,
|
|
@@ -7992,7 +8445,7 @@ var ContextFetcher = class {
|
|
|
7992
8445
|
scopes: { tenantId: this.tenantId, projectId: this.projectId },
|
|
7993
8446
|
id: credentialReferenceId
|
|
7994
8447
|
});
|
|
7995
|
-
|
|
8448
|
+
logger10.info({ credentialReference }, "Credential reference");
|
|
7996
8449
|
if (!credentialReference || !this.credentialStuffer) {
|
|
7997
8450
|
throw new Error(`Credential store not found for reference ID: ${credentialReferenceId}`);
|
|
7998
8451
|
}
|
|
@@ -8010,7 +8463,7 @@ var ContextFetcher = class {
|
|
|
8010
8463
|
);
|
|
8011
8464
|
return credentialData;
|
|
8012
8465
|
} catch (error) {
|
|
8013
|
-
|
|
8466
|
+
logger10.error(
|
|
8014
8467
|
{
|
|
8015
8468
|
credentialReferenceId,
|
|
8016
8469
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -8026,7 +8479,7 @@ var ContextFetcher = class {
|
|
|
8026
8479
|
async resolveTemplateVariables(fetchConfig, context, credentialReferenceId) {
|
|
8027
8480
|
const resolved = { ...fetchConfig };
|
|
8028
8481
|
resolved.url = this.interpolateTemplate(fetchConfig.url, context);
|
|
8029
|
-
|
|
8482
|
+
logger10.info({ resolvedUrl: resolved.url }, "Resolved URL");
|
|
8030
8483
|
if (fetchConfig.headers) {
|
|
8031
8484
|
resolved.headers = {};
|
|
8032
8485
|
for (const [key, value] of Object.entries(fetchConfig.headers)) {
|
|
@@ -8045,7 +8498,7 @@ var ContextFetcher = class {
|
|
|
8045
8498
|
...resolved.headers,
|
|
8046
8499
|
...credentialHeaders
|
|
8047
8500
|
};
|
|
8048
|
-
|
|
8501
|
+
logger10.info(
|
|
8049
8502
|
{
|
|
8050
8503
|
credentialReferenceId
|
|
8051
8504
|
},
|
|
@@ -8053,7 +8506,7 @@ var ContextFetcher = class {
|
|
|
8053
8506
|
);
|
|
8054
8507
|
}
|
|
8055
8508
|
} catch (error) {
|
|
8056
|
-
|
|
8509
|
+
logger10.error(
|
|
8057
8510
|
{
|
|
8058
8511
|
credentialReferenceId,
|
|
8059
8512
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -8075,7 +8528,7 @@ var ContextFetcher = class {
|
|
|
8075
8528
|
preserveUnresolved: true
|
|
8076
8529
|
});
|
|
8077
8530
|
} catch (error) {
|
|
8078
|
-
|
|
8531
|
+
logger10.error(
|
|
8079
8532
|
{
|
|
8080
8533
|
template,
|
|
8081
8534
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -8107,7 +8560,7 @@ var ContextFetcher = class {
|
|
|
8107
8560
|
async performRequest(config) {
|
|
8108
8561
|
const startTime = Date.now();
|
|
8109
8562
|
try {
|
|
8110
|
-
|
|
8563
|
+
logger10.debug(
|
|
8111
8564
|
{
|
|
8112
8565
|
url: config.url,
|
|
8113
8566
|
method: config.method
|
|
@@ -8144,7 +8597,7 @@ var ContextFetcher = class {
|
|
|
8144
8597
|
} catch (error) {
|
|
8145
8598
|
const durationMs = Date.now() - startTime;
|
|
8146
8599
|
const requestError = error instanceof Error ? error : new Error("Unknown error");
|
|
8147
|
-
|
|
8600
|
+
logger10.warn(
|
|
8148
8601
|
{
|
|
8149
8602
|
url: config.url,
|
|
8150
8603
|
error: requestError.message,
|
|
@@ -8163,7 +8616,7 @@ var ContextFetcher = class {
|
|
|
8163
8616
|
const result = jmespath.search(data, transform);
|
|
8164
8617
|
return result;
|
|
8165
8618
|
} catch (error) {
|
|
8166
|
-
|
|
8619
|
+
logger10.error(
|
|
8167
8620
|
{
|
|
8168
8621
|
transform,
|
|
8169
8622
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
@@ -8182,7 +8635,7 @@ var ContextFetcher = class {
|
|
|
8182
8635
|
if (!isValid) {
|
|
8183
8636
|
throw new Error("Data does not match JSON Schema");
|
|
8184
8637
|
}
|
|
8185
|
-
|
|
8638
|
+
logger10.debug(
|
|
8186
8639
|
{
|
|
8187
8640
|
definitionId,
|
|
8188
8641
|
dataType: typeof data,
|
|
@@ -8192,7 +8645,7 @@ var ContextFetcher = class {
|
|
|
8192
8645
|
);
|
|
8193
8646
|
} catch (error) {
|
|
8194
8647
|
const errorMessage = error instanceof Error ? error.message : "Unknown validation error";
|
|
8195
|
-
|
|
8648
|
+
logger10.error(
|
|
8196
8649
|
{
|
|
8197
8650
|
definitionId,
|
|
8198
8651
|
jsonSchema,
|
|
@@ -8233,7 +8686,7 @@ var ContextFetcher = class {
|
|
|
8233
8686
|
};
|
|
8234
8687
|
}
|
|
8235
8688
|
};
|
|
8236
|
-
var
|
|
8689
|
+
var logger11 = getLogger("context");
|
|
8237
8690
|
async function determineContextTrigger(tenantId, projectId, conversationId, dbClient) {
|
|
8238
8691
|
const conversation = await getConversation(dbClient)({
|
|
8239
8692
|
scopes: { tenantId, projectId },
|
|
@@ -8253,7 +8706,7 @@ async function handleContextConfigChange(tenantId, projectId, conversationId, gr
|
|
|
8253
8706
|
if (conversation.lastContextResolution) {
|
|
8254
8707
|
const contextResolver = new ContextResolver(tenantId, projectId, dbClient, credentialStores);
|
|
8255
8708
|
await contextResolver.clearCache(tenantId, projectId, conversationId);
|
|
8256
|
-
|
|
8709
|
+
logger11.info(
|
|
8257
8710
|
{
|
|
8258
8711
|
conversationId,
|
|
8259
8712
|
graphId,
|
|
@@ -8287,7 +8740,7 @@ async function handleContextResolution({
|
|
|
8287
8740
|
scopes: { tenantId, projectId, graphId }
|
|
8288
8741
|
});
|
|
8289
8742
|
if (!agentGraph2?.contextConfigId) {
|
|
8290
|
-
|
|
8743
|
+
logger11.debug({ graphId }, "No context config found for graph");
|
|
8291
8744
|
return null;
|
|
8292
8745
|
}
|
|
8293
8746
|
await handleContextConfigChange(
|
|
@@ -8305,7 +8758,7 @@ async function handleContextResolution({
|
|
|
8305
8758
|
id: agentGraph2.contextConfigId
|
|
8306
8759
|
});
|
|
8307
8760
|
if (!contextConfig2) {
|
|
8308
|
-
|
|
8761
|
+
logger11.warn(
|
|
8309
8762
|
{ contextConfigId: agentGraph2.contextConfigId },
|
|
8310
8763
|
"Context config not found, proceeding without context resolution"
|
|
8311
8764
|
);
|
|
@@ -8347,7 +8800,7 @@ async function handleContextResolution({
|
|
|
8347
8800
|
} else {
|
|
8348
8801
|
parentSpan.setStatus({ code: SpanStatusCode.OK });
|
|
8349
8802
|
}
|
|
8350
|
-
|
|
8803
|
+
logger11.info(
|
|
8351
8804
|
{
|
|
8352
8805
|
conversationId,
|
|
8353
8806
|
graphId,
|
|
@@ -8369,7 +8822,7 @@ async function handleContextResolution({
|
|
|
8369
8822
|
"context.error_message": errorMessage
|
|
8370
8823
|
});
|
|
8371
8824
|
setSpanWithError(parentSpan, error instanceof Error ? error : new Error(String(error)));
|
|
8372
|
-
|
|
8825
|
+
logger11.error(
|
|
8373
8826
|
{
|
|
8374
8827
|
error: errorMessage,
|
|
8375
8828
|
contextConfigId: agentGraph2?.contextConfigId,
|
|
@@ -8710,7 +9163,7 @@ var InMemoryCredentialStore = class {
|
|
|
8710
9163
|
return this.credentials.delete(key);
|
|
8711
9164
|
}
|
|
8712
9165
|
};
|
|
8713
|
-
var
|
|
9166
|
+
var logger12 = getLogger("nango-credential-store");
|
|
8714
9167
|
var CredentialKeySchema = z$1.object({
|
|
8715
9168
|
connectionId: z$1.string().min(1, "connectionId must be a non-empty string"),
|
|
8716
9169
|
providerConfigKey: z$1.string().min(1, "providerConfigKey must be a non-empty string")
|
|
@@ -8850,7 +9303,7 @@ var NangoCredentialStore = class {
|
|
|
8850
9303
|
if (error && typeof error === "object" && "status" in error && error.status === 404) {
|
|
8851
9304
|
return null;
|
|
8852
9305
|
}
|
|
8853
|
-
|
|
9306
|
+
logger12.error(
|
|
8854
9307
|
{ error: error instanceof Error ? error.message : "Unknown error", uniqueKey },
|
|
8855
9308
|
`Failed to fetch integration ${uniqueKey}`
|
|
8856
9309
|
);
|
|
@@ -8876,7 +9329,7 @@ var NangoCredentialStore = class {
|
|
|
8876
9329
|
});
|
|
8877
9330
|
const result = JSON.stringify(essential);
|
|
8878
9331
|
if (result.length > 1024) {
|
|
8879
|
-
|
|
9332
|
+
logger12.error(
|
|
8880
9333
|
{
|
|
8881
9334
|
originalLength: tokenData.length,
|
|
8882
9335
|
essentialLength: result.length,
|
|
@@ -8950,7 +9403,7 @@ var NangoCredentialStore = class {
|
|
|
8950
9403
|
);
|
|
8951
9404
|
}
|
|
8952
9405
|
} catch (error) {
|
|
8953
|
-
|
|
9406
|
+
logger12.error(
|
|
8954
9407
|
{
|
|
8955
9408
|
error: error instanceof Error ? error.message : "Unknown error",
|
|
8956
9409
|
name
|
|
@@ -8985,7 +9438,7 @@ var NangoCredentialStore = class {
|
|
|
8985
9438
|
};
|
|
8986
9439
|
return credentialData;
|
|
8987
9440
|
} catch (error) {
|
|
8988
|
-
|
|
9441
|
+
logger12.error(
|
|
8989
9442
|
{
|
|
8990
9443
|
error: error instanceof Error ? error.message : "Unknown error",
|
|
8991
9444
|
connectionId,
|
|
@@ -9006,7 +9459,7 @@ var NangoCredentialStore = class {
|
|
|
9006
9459
|
try {
|
|
9007
9460
|
parsedKey = JSON.parse(key);
|
|
9008
9461
|
} catch (parseError) {
|
|
9009
|
-
|
|
9462
|
+
logger12.warn(
|
|
9010
9463
|
{
|
|
9011
9464
|
storeId: this.id,
|
|
9012
9465
|
key: key.substring(0, 50),
|
|
@@ -9019,7 +9472,7 @@ var NangoCredentialStore = class {
|
|
|
9019
9472
|
}
|
|
9020
9473
|
const validationResult = CredentialKeySchema.safeParse(parsedKey);
|
|
9021
9474
|
if (!validationResult.success) {
|
|
9022
|
-
|
|
9475
|
+
logger12.warn(
|
|
9023
9476
|
{
|
|
9024
9477
|
storeId: this.id,
|
|
9025
9478
|
key: key.substring(0, 100),
|
|
@@ -9037,7 +9490,7 @@ var NangoCredentialStore = class {
|
|
|
9037
9490
|
const credentialString = JSON.stringify(credentials);
|
|
9038
9491
|
return credentialString;
|
|
9039
9492
|
} catch (error) {
|
|
9040
|
-
|
|
9493
|
+
logger12.error(
|
|
9041
9494
|
{
|
|
9042
9495
|
storeId: this.id,
|
|
9043
9496
|
key: key.substring(0, 100),
|
|
@@ -9066,7 +9519,7 @@ var NangoCredentialStore = class {
|
|
|
9066
9519
|
const credentials = await this.get(key);
|
|
9067
9520
|
return credentials !== null;
|
|
9068
9521
|
} catch (error) {
|
|
9069
|
-
|
|
9522
|
+
logger12.error(
|
|
9070
9523
|
{
|
|
9071
9524
|
error: error instanceof Error ? error.message : "Unknown error",
|
|
9072
9525
|
key
|
|
@@ -9085,7 +9538,7 @@ var NangoCredentialStore = class {
|
|
|
9085
9538
|
try {
|
|
9086
9539
|
parsedKey = JSON.parse(key);
|
|
9087
9540
|
} catch (parseError) {
|
|
9088
|
-
|
|
9541
|
+
logger12.warn(
|
|
9089
9542
|
{
|
|
9090
9543
|
storeId: this.id,
|
|
9091
9544
|
key: key.substring(0, 50),
|
|
@@ -9098,7 +9551,7 @@ var NangoCredentialStore = class {
|
|
|
9098
9551
|
}
|
|
9099
9552
|
const validationResult = CredentialKeySchema.safeParse(parsedKey);
|
|
9100
9553
|
if (!validationResult.success) {
|
|
9101
|
-
|
|
9554
|
+
logger12.warn(
|
|
9102
9555
|
{
|
|
9103
9556
|
storeId: this.id,
|
|
9104
9557
|
key: key.substring(0, 100),
|
|
@@ -9112,7 +9565,7 @@ var NangoCredentialStore = class {
|
|
|
9112
9565
|
await this.nangoClient.deleteConnection(providerConfigKey, connectionId);
|
|
9113
9566
|
return true;
|
|
9114
9567
|
} catch (error) {
|
|
9115
|
-
|
|
9568
|
+
logger12.error(
|
|
9116
9569
|
{
|
|
9117
9570
|
storeId: this.id,
|
|
9118
9571
|
key: key.substring(0, 100),
|
|
@@ -9212,4 +9665,4 @@ ${error.message}`
|
|
|
9212
9665
|
};
|
|
9213
9666
|
parseEnv();
|
|
9214
9667
|
|
|
9215
|
-
export { ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, ERROR_DOCS_BASE_URL, ErrorCode, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, McpClient, NangoCredentialStore, TemplateEngine, addLedgerArtifacts, addToolToAgent, apiFetch, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgentGraph, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createSubAgent, createSubAgentRelation, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteFunction, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteSubAgent, deleteSubAgentRelation, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, generateId, getActiveAgentForConversation, getAgentGraphById, getAgentGraphWithDefaultSubAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getConversation, getConversationCacheEntries, getConversationHistory, getConversationId, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getFunction, getGraphAgentInfos, getLedgerArtifacts, getLedgerArtifactsByContext, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getSubAgentById, getSubAgentsByIds, getTask, getToolById, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, headers, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listFunctions, listMessages, listProjects, listProjectsPaginated, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateMessage, updateProject, updateSubAgent, updateTask, updateTool, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation,
|
|
9668
|
+
export { ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, ERROR_DOCS_BASE_URL, ErrorCode, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, McpClient, NangoCredentialStore, TemplateEngine, addFunctionToolToSubAgent, addLedgerArtifacts, addToolToAgent, apiFetch, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgentGraph, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createFunctionTool, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createSubAgent, createSubAgentRelation, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteFunction, deleteFunctionTool, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteSubAgent, deleteSubAgentRelation, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, generateId, getActiveAgentForConversation, getAgentGraphById, getAgentGraphWithDefaultSubAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getConversation, getConversationCacheEntries, getConversationHistory, getConversationId, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getGraphAgentInfos, getLedgerArtifacts, getLedgerArtifactsByContext, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getSubAgentById, getSubAgentsByIds, getTask, getToolById, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, headers, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listFunctionTools, listFunctions, listMessages, listProjects, listProjectsPaginated, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateFunctionTool, updateMessage, updateProject, updateSubAgent, updateSubAgentFunctionToolRelation, updateTask, updateTool, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertSubAgent, upsertSubAgentFunctionToolRelation, upsertSubAgentToolRelation, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHeaders, validateHttpRequestHeaders, validateInternalSubAgent, validateProjectExists, validationHelper, withProjectValidation };
|