@inkeep/agents-core 0.5.0 → 0.6.4

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/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-XQRFKXVV.js';
2
- export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-XQRFKXVV.js';
3
- import { ContextConfigApiUpdateSchema } from './chunk-LPIKPCE5.js';
4
- export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, 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, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, 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, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from './chunk-LPIKPCE5.js';
5
1
  export { TaskState } from './chunk-H2F72PDA.js';
2
+ import { validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-T5JVBY6K.js';
3
+ export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-T5JVBY6K.js';
4
+ import { ContextConfigApiUpdateSchema } from './chunk-7OCPFKGI.js';
5
+ export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, 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, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, 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, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from './chunk-7OCPFKGI.js';
6
+ import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-TNFWLVL6.js';
7
+ export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-TNFWLVL6.js';
6
8
  import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-SVGQSPW4.js';
7
9
  export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-SVGQSPW4.js';
8
- import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-LFWFXR4O.js';
9
- export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-LFWFXR4O.js';
10
10
  import { __publicField } from './chunk-MKBO26DX.js';
11
11
  import { z as z$1 } from 'zod';
12
12
  import pino from 'pino';
@@ -197,6 +197,22 @@ function getLogger(name) {
197
197
 
198
198
  // src/context/ContextConfig.ts
199
199
  var logger = getLogger("context-config");
200
+ var RequestContextSchemaBuilder = class {
201
+ constructor(options) {
202
+ __publicField(this, "schema");
203
+ this.schema = options.schema;
204
+ }
205
+ /** Template function for request context paths with type-safe autocomplete */
206
+ toTemplate(path2) {
207
+ return `{{requestContext.${path2}}}`;
208
+ }
209
+ getSchema() {
210
+ return this.schema;
211
+ }
212
+ getJsonSchema() {
213
+ return convertZodToJsonSchema(this.schema);
214
+ }
215
+ };
200
216
  function convertZodToJsonSchema(zodSchema) {
201
217
  try {
202
218
  return z$1.toJSONSchema(zodSchema, { target: "draft-7" });
@@ -219,23 +235,34 @@ var ContextConfigBuilder = class {
219
235
  this.tenantId = options.tenantId || "default";
220
236
  this.projectId = options.projectId || "default";
221
237
  this.baseURL = process.env.INKEEP_AGENTS_MANAGE_API_URL || "http://localhost:3002";
222
- let requestContextSchema;
238
+ let requestContextSchema2;
223
239
  if (options.requestContextSchema) {
240
+ const actualSchema = options.requestContextSchema instanceof RequestContextSchemaBuilder ? options.requestContextSchema.getSchema() : options.requestContextSchema;
224
241
  logger.info(
225
242
  {
226
243
  requestContextSchema: options.requestContextSchema
227
244
  },
228
245
  "Converting request headers schema to JSON Schema for database storage"
229
246
  );
230
- let schema = options.requestContextSchema;
231
- if (schema instanceof z$1.ZodObject) {
232
- schema = schema.loose();
247
+ requestContextSchema2 = convertZodToJsonSchema(actualSchema);
248
+ }
249
+ const processedContextVariables = {};
250
+ if (options.contextVariables) {
251
+ for (const [key, definition] of Object.entries(options.contextVariables)) {
252
+ const { credentialReference, ...rest } = definition;
253
+ processedContextVariables[key] = {
254
+ ...rest,
255
+ responseSchema: convertZodToJsonSchema(definition.responseSchema),
256
+ credentialReferenceId: credentialReference?.id
257
+ };
233
258
  logger.debug(
234
- { schemaType: "ZodObject" },
235
- "Applied .loose() to ZodObject requestContextSchema for more permissive validation"
259
+ {
260
+ contextVariableKey: key,
261
+ originalSchema: definition.responseSchema
262
+ },
263
+ "Converting contextVariable responseSchema to JSON Schema for database storage"
236
264
  );
237
265
  }
238
- requestContextSchema = convertZodToJsonSchema(schema);
239
266
  }
240
267
  this.config = {
241
268
  id: options.id,
@@ -243,8 +270,8 @@ var ContextConfigBuilder = class {
243
270
  projectId: this.projectId,
244
271
  name: options.name,
245
272
  description: options.description || "",
246
- requestContextSchema,
247
- contextVariables: options.contextVariables || {}
273
+ requestContextSchema: requestContextSchema2,
274
+ contextVariables: processedContextVariables
248
275
  };
249
276
  logger.info(
250
277
  {
@@ -254,6 +281,22 @@ var ContextConfigBuilder = class {
254
281
  "ContextConfig builder initialized"
255
282
  );
256
283
  }
284
+ /**
285
+ * Convert the builder to a plain object for database operations
286
+ */
287
+ toObject() {
288
+ return {
289
+ id: this.getId(),
290
+ tenantId: this.tenantId,
291
+ projectId: this.projectId,
292
+ name: this.getName(),
293
+ description: this.getDescription(),
294
+ requestContextSchema: this.getRequestContextSchema(),
295
+ contextVariables: this.getContextVariables(),
296
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
297
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
298
+ };
299
+ }
257
300
  // Getter methods
258
301
  getId() {
259
302
  if (!this.config.id) {
@@ -276,35 +319,14 @@ var ContextConfigBuilder = class {
276
319
  getContextVariables() {
277
320
  return this.config.contextVariables || {};
278
321
  }
279
- /**
280
- * Convert the builder to a plain object for database operations
281
- */
282
- toObject() {
283
- return {
284
- id: this.getId(),
285
- tenantId: this.tenantId,
286
- projectId: this.projectId,
287
- name: this.getName(),
288
- description: this.getDescription(),
289
- requestContextSchema: this.getRequestContextSchema(),
290
- contextVariables: this.getContextVariables(),
291
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
292
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
293
- };
294
- }
295
322
  // Builder methods for fluent API
296
323
  withRequestContextSchema(schema) {
297
324
  this.config.requestContextSchema = schema;
298
325
  return this;
299
326
  }
300
- withContextVariable(key, definition) {
301
- this.config.contextVariables = this.config.contextVariables || {};
302
- this.config.contextVariables[key] = definition;
303
- return this;
304
- }
305
- withContextVariables(variables) {
306
- this.config.contextVariables = variables;
307
- return this;
327
+ /** 4) The function you ship: path autocomplete + validation, returns {{path}} */
328
+ toTemplate(path2) {
329
+ return `{{${path2}}}`;
308
330
  }
309
331
  // Validation method
310
332
  validate() {
@@ -449,15 +471,11 @@ var ContextConfigBuilder = class {
449
471
  function contextConfig(options) {
450
472
  return new ContextConfigBuilder(options);
451
473
  }
474
+ function requestContextSchema(options) {
475
+ return new RequestContextSchemaBuilder(options);
476
+ }
452
477
  function fetchDefinition(options) {
453
- const fetchConfig = options.fetchConfig || {
454
- url: options.url,
455
- method: options.method,
456
- headers: options.headers,
457
- body: options.body,
458
- transform: options.transform,
459
- timeout: options.timeout
460
- };
478
+ const fetchConfig = options.fetchConfig;
461
479
  return {
462
480
  id: options.id,
463
481
  name: options.name,
@@ -470,9 +488,9 @@ function fetchDefinition(options) {
470
488
  transform: fetchConfig.transform,
471
489
  timeout: fetchConfig.timeout
472
490
  },
473
- responseSchema: options.responseSchema ? convertZodToJsonSchema(options.responseSchema) : void 0,
491
+ responseSchema: options.responseSchema,
474
492
  defaultValue: options.defaultValue,
475
- credentialReferenceId: options.credential?.id
493
+ credentialReferenceId: options.credentialReference?.id
476
494
  };
477
495
  }
478
496
  var logger2 = getLogger("template-engine");
@@ -981,16 +999,21 @@ var getRelatedAgentsForGraph = (db) => async (params) => {
981
999
  name: agents.name,
982
1000
  description: agents.description,
983
1001
  relationType: agentRelations.relationType
984
- }).from(agentRelations).innerJoin(agents, eq(agentRelations.targetAgentId, agents.id)).where(
1002
+ }).from(agentRelations).innerJoin(
1003
+ agents,
1004
+ and(
1005
+ eq(agentRelations.targetAgentId, agents.id),
1006
+ eq(agentRelations.tenantId, agents.tenantId),
1007
+ eq(agentRelations.projectId, agents.projectId),
1008
+ eq(agentRelations.graphId, agents.graphId)
1009
+ )
1010
+ ).where(
985
1011
  and(
986
1012
  eq(agentRelations.tenantId, params.scopes.tenantId),
987
1013
  eq(agentRelations.projectId, params.scopes.projectId),
988
1014
  eq(agentRelations.graphId, params.scopes.graphId),
989
1015
  eq(agentRelations.sourceAgentId, params.agentId),
990
- isNotNull(agentRelations.targetAgentId),
991
- eq(agents.tenantId, params.scopes.tenantId),
992
- eq(agents.projectId, params.scopes.projectId),
993
- eq(agents.graphId, params.scopes.graphId)
1016
+ isNotNull(agentRelations.targetAgentId)
994
1017
  )
995
1018
  );
996
1019
  const externalRelations = await db.select({
@@ -1002,16 +1025,21 @@ var getRelatedAgentsForGraph = (db) => async (params) => {
1002
1025
  description: externalAgents.description,
1003
1026
  baseUrl: externalAgents.baseUrl
1004
1027
  }
1005
- }).from(agentRelations).innerJoin(externalAgents, eq(agentRelations.externalAgentId, externalAgents.id)).where(
1028
+ }).from(agentRelations).innerJoin(
1029
+ externalAgents,
1030
+ and(
1031
+ eq(agentRelations.externalAgentId, externalAgents.id),
1032
+ eq(agentRelations.tenantId, externalAgents.tenantId),
1033
+ eq(agentRelations.projectId, externalAgents.projectId),
1034
+ eq(agentRelations.graphId, externalAgents.graphId)
1035
+ )
1036
+ ).where(
1006
1037
  and(
1007
1038
  eq(agentRelations.tenantId, params.scopes.tenantId),
1008
1039
  eq(agentRelations.projectId, params.scopes.projectId),
1009
1040
  eq(agentRelations.graphId, params.scopes.graphId),
1010
1041
  eq(agentRelations.sourceAgentId, params.agentId),
1011
- isNotNull(agentRelations.externalAgentId),
1012
- eq(externalAgents.tenantId, params.scopes.tenantId),
1013
- eq(externalAgents.projectId, params.scopes.projectId),
1014
- eq(externalAgents.graphId, params.scopes.graphId)
1042
+ isNotNull(agentRelations.externalAgentId)
1015
1043
  )
1016
1044
  );
1017
1045
  return {
@@ -1274,7 +1302,14 @@ var getToolsForAgent = (db) => async (params) => {
1274
1302
  availableTools: tools.availableTools,
1275
1303
  credentialReferenceId: tools.credentialReferenceId
1276
1304
  }
1277
- }).from(agentToolRelations).innerJoin(tools, eq(agentToolRelations.toolId, tools.id)).where(
1305
+ }).from(agentToolRelations).innerJoin(
1306
+ tools,
1307
+ and(
1308
+ eq(agentToolRelations.tenantId, tools.tenantId),
1309
+ eq(agentToolRelations.projectId, tools.projectId),
1310
+ eq(agentToolRelations.toolId, tools.id)
1311
+ )
1312
+ ).where(
1278
1313
  and(
1279
1314
  eq(agentToolRelations.tenantId, params.scopes.tenantId),
1280
1315
  eq(agentToolRelations.projectId, params.scopes.projectId),
@@ -1322,7 +1357,15 @@ var getAgentsForTool = (db) => async (params) => {
1322
1357
  createdAt: agents.createdAt,
1323
1358
  updatedAt: agents.updatedAt
1324
1359
  }
1325
- }).from(agentToolRelations).innerJoin(agents, eq(agentToolRelations.agentId, agents.id)).where(
1360
+ }).from(agentToolRelations).innerJoin(
1361
+ agents,
1362
+ and(
1363
+ eq(agentToolRelations.agentId, agents.id),
1364
+ eq(agentToolRelations.tenantId, agents.tenantId),
1365
+ eq(agentToolRelations.projectId, agents.projectId),
1366
+ eq(agentToolRelations.graphId, agents.graphId)
1367
+ )
1368
+ ).where(
1326
1369
  and(
1327
1370
  eq(agentToolRelations.tenantId, params.scopes.tenantId),
1328
1371
  eq(agentToolRelations.projectId, params.scopes.projectId),
@@ -2009,8 +2052,20 @@ var getFullGraphDefinition = (db) => async ({
2009
2052
  availableTools: tools.availableTools,
2010
2053
  lastToolsSync: tools.lastToolsSync,
2011
2054
  selectedTools: agentToolRelations.selectedTools
2012
- }).from(agentToolRelations).innerJoin(tools, eq(agentToolRelations.toolId, tools.id)).where(
2013
- and(eq(agentToolRelations.tenantId, tenantId), eq(agentToolRelations.agentId, agent.id))
2055
+ }).from(agentToolRelations).innerJoin(
2056
+ tools,
2057
+ and(
2058
+ eq(agentToolRelations.toolId, tools.id),
2059
+ eq(agentToolRelations.tenantId, tools.tenantId),
2060
+ eq(agentToolRelations.projectId, tools.projectId)
2061
+ )
2062
+ ).where(
2063
+ and(
2064
+ eq(agentToolRelations.tenantId, tenantId),
2065
+ eq(agentToolRelations.projectId, projectId),
2066
+ eq(agentToolRelations.graphId, graphId),
2067
+ eq(agentToolRelations.agentId, agent.id)
2068
+ )
2014
2069
  );
2015
2070
  const agentDataComponentRelations = await db.query.agentDataComponents.findMany({
2016
2071
  where: and(
@@ -2028,12 +2083,10 @@ var getFullGraphDefinition = (db) => async ({
2028
2083
  const agentArtifactComponentIds = agentArtifactComponentRelations.map(
2029
2084
  (rel) => rel.artifactComponentId
2030
2085
  );
2031
- const selectedTools = {};
2032
- agentTools.forEach((tool2) => {
2033
- if (tool2.selectedTools && Array.isArray(tool2.selectedTools)) {
2034
- selectedTools[tool2.id] = tool2.selectedTools;
2035
- }
2036
- });
2086
+ const canUse = agentTools.map((tool2) => ({
2087
+ toolId: tool2.id,
2088
+ toolSelection: tool2.selectedTools || null
2089
+ }));
2037
2090
  return {
2038
2091
  id: agent.id,
2039
2092
  name: agent.name,
@@ -2045,20 +2098,8 @@ var getFullGraphDefinition = (db) => async ({
2045
2098
  canDelegateTo,
2046
2099
  dataComponents: agentDataComponentIds,
2047
2100
  artifactComponents: agentArtifactComponentIds,
2048
- ...Object.keys(selectedTools).length > 0 && { selectedTools },
2049
- tools: agentTools.map((tool2) => ({
2050
- id: tool2.id,
2051
- name: tool2.name,
2052
- config: tool2.config,
2053
- imageUrl: tool2.imageUrl || void 0,
2054
- status: tool2.status,
2055
- capabilities: tool2.capabilities || void 0,
2056
- lastHealthCheck: tool2.lastHealthCheck && !Number.isNaN(new Date(tool2.lastHealthCheck).getTime()) ? new Date(tool2.lastHealthCheck).toISOString() : void 0,
2057
- lastError: tool2.lastError || void 0,
2058
- availableTools: tool2.availableTools || void 0,
2059
- activeTools: tool2.config?.mcp?.activeTools || void 0,
2060
- lastToolsSync: tool2.lastToolsSync && !Number.isNaN(new Date(tool2.lastToolsSync).getTime()) ? new Date(tool2.lastToolsSync).toISOString() : void 0
2061
- }))
2101
+ canUse
2102
+ // Use the new canUse structure
2062
2103
  };
2063
2104
  })
2064
2105
  );
@@ -2081,7 +2122,6 @@ var getFullGraphDefinition = (db) => async ({
2081
2122
  (agent) => agent !== null
2082
2123
  );
2083
2124
  const agentsObject = {};
2084
- const toolsObject = {};
2085
2125
  for (const agent of validAgents) {
2086
2126
  const isExternalAgent2 = "baseUrl" in agent && agent.baseUrl;
2087
2127
  if (isExternalAgent2) {
@@ -2092,22 +2132,7 @@ var getFullGraphDefinition = (db) => async ({
2092
2132
  baseUrl: agent.baseUrl
2093
2133
  };
2094
2134
  } else {
2095
- const toolsData = agent.tools || [];
2096
- const toolIds = [];
2097
- const agentSelectedTools = {};
2098
- for (const tool2 of toolsData) {
2099
- toolsObject[tool2.id] = tool2;
2100
- toolIds.push(tool2.id);
2101
- if (tool2.selectedTools !== null && tool2.selectedTools !== void 0) {
2102
- agentSelectedTools[tool2.id] = tool2.selectedTools;
2103
- }
2104
- }
2105
- agentsObject[agent.id] = {
2106
- ...agent,
2107
- tools: toolIds,
2108
- // Replace tool objects with tool IDs
2109
- ...Object.keys(agentSelectedTools).length > 0 && { selectedTools: agentSelectedTools }
2110
- };
2135
+ agentsObject[agent.id] = agent;
2111
2136
  }
2112
2137
  }
2113
2138
  let contextConfig2 = null;
@@ -2121,11 +2146,10 @@ var getFullGraphDefinition = (db) => async ({
2121
2146
  console.warn(`Failed to retrieve contextConfig ${graph.contextConfigId}:`, error);
2122
2147
  }
2123
2148
  }
2124
- let dataComponentsObject = {};
2125
2149
  try {
2126
2150
  const internalAgentIds = graphAgents.map((agent) => agent.id);
2127
2151
  const agentIds = Array.from(internalAgentIds);
2128
- dataComponentsObject = await fetchComponentRelationships(db)(
2152
+ await fetchComponentRelationships(db)(
2129
2153
  { tenantId, projectId },
2130
2154
  agentIds,
2131
2155
  {
@@ -2144,11 +2168,10 @@ var getFullGraphDefinition = (db) => async ({
2144
2168
  } catch (error) {
2145
2169
  console.warn("Failed to retrieve dataComponents:", error);
2146
2170
  }
2147
- let artifactComponentsObject = {};
2148
2171
  try {
2149
2172
  const internalAgentIds = graphAgents.map((agent) => agent.id);
2150
2173
  const agentIds = Array.from(internalAgentIds);
2151
- artifactComponentsObject = await fetchComponentRelationships(db)(
2174
+ await fetchComponentRelationships(db)(
2152
2175
  { tenantId, projectId },
2153
2176
  agentIds,
2154
2177
  {
@@ -2174,7 +2197,7 @@ var getFullGraphDefinition = (db) => async ({
2174
2197
  description: graph.description,
2175
2198
  defaultAgentId: graph.defaultAgentId,
2176
2199
  agents: agentsObject,
2177
- tools: toolsObject,
2200
+ // No tools field - tools are defined at project level
2178
2201
  createdAt: graph.createdAt && !Number.isNaN(new Date(graph.createdAt).getTime()) ? new Date(graph.createdAt).toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
2179
2202
  updatedAt: graph.updatedAt && !Number.isNaN(new Date(graph.updatedAt).getTime()) ? new Date(graph.updatedAt).toISOString() : (/* @__PURE__ */ new Date()).toISOString()
2180
2203
  };
@@ -2199,12 +2222,6 @@ var getFullGraphDefinition = (db) => async ({
2199
2222
  contextVariables: contextConfig2.contextVariables
2200
2223
  };
2201
2224
  }
2202
- if (Object.keys(dataComponentsObject).length > 0) {
2203
- result.dataComponents = dataComponentsObject;
2204
- }
2205
- if (Object.keys(artifactComponentsObject).length > 0) {
2206
- result.artifactComponents = artifactComponentsObject;
2207
- }
2208
2225
  try {
2209
2226
  if (!db.query?.projects?.findFirst) {
2210
2227
  return result;
@@ -2407,6 +2424,7 @@ var createApiKey = (db) => async (params) => {
2407
2424
  const now = (/* @__PURE__ */ new Date()).toISOString();
2408
2425
  const [apiKey] = await db.insert(apiKeys).values({
2409
2426
  id: params.id,
2427
+ name: params.name,
2410
2428
  tenantId: params.tenantId,
2411
2429
  projectId: params.projectId,
2412
2430
  graphId: params.graphId,
@@ -2422,6 +2440,7 @@ var createApiKey = (db) => async (params) => {
2422
2440
  var updateApiKey = (db) => async (params) => {
2423
2441
  const now = (/* @__PURE__ */ new Date()).toISOString();
2424
2442
  const [updatedKey] = await db.update(apiKeys).set({
2443
+ name: params.data.name,
2425
2444
  expiresAt: params.data.expiresAt,
2426
2445
  updatedAt: now
2427
2446
  }).where(
@@ -2475,12 +2494,13 @@ var countApiKeys = (db) => async (params) => {
2475
2494
  return typeof total === "string" ? Number.parseInt(total, 10) : total;
2476
2495
  };
2477
2496
  var generateAndCreateApiKey = async (params, db) => {
2478
- const { tenantId, projectId, graphId, expiresAt } = params;
2497
+ const { tenantId, projectId, graphId, expiresAt, name } = params;
2479
2498
  const keyData = await generateApiKey();
2480
2499
  const apiKey = await createApiKey(db)({
2481
2500
  tenantId,
2482
2501
  projectId,
2483
2502
  graphId,
2503
+ name,
2484
2504
  expiresAt,
2485
2505
  ...keyData
2486
2506
  });
@@ -2676,7 +2696,21 @@ var isArtifactComponentAssociatedWithAgent = (db) => async (params) => {
2676
2696
  return result.length > 0;
2677
2697
  };
2678
2698
  var graphHasArtifactComponents = (db) => async (params) => {
2679
- const result = await db.select({ count: count() }).from(agentArtifactComponents).innerJoin(agents, eq(agentArtifactComponents.agentId, agents.id)).innerJoin(agentRelations, eq(agents.id, agentRelations.sourceAgentId)).where(
2699
+ const result = await db.select({ count: count() }).from(agentArtifactComponents).innerJoin(
2700
+ agents,
2701
+ and(
2702
+ eq(agentArtifactComponents.agentId, agents.id),
2703
+ eq(agentArtifactComponents.tenantId, agents.tenantId)
2704
+ )
2705
+ ).innerJoin(
2706
+ agentRelations,
2707
+ and(
2708
+ eq(agents.id, agentRelations.sourceAgentId),
2709
+ eq(agents.tenantId, agentRelations.tenantId),
2710
+ eq(agents.projectId, agentRelations.projectId),
2711
+ eq(agents.graphId, agentRelations.graphId)
2712
+ )
2713
+ ).where(
2680
2714
  and(
2681
2715
  eq(agentArtifactComponents.tenantId, params.scopes.tenantId),
2682
2716
  eq(agentArtifactComponents.projectId, params.scopes.projectId),
@@ -3864,22 +3898,22 @@ var createFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
3864
3898
  }
3865
3899
  const agentToolPromises = [];
3866
3900
  for (const [agentId, agentData] of Object.entries(typed.agents)) {
3867
- if (isInternalAgent(agentData) && agentData.tools && Array.isArray(agentData.tools)) {
3868
- for (const toolId of agentData.tools) {
3901
+ if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
3902
+ for (const canUseItem of agentData.canUse) {
3869
3903
  agentToolPromises.push(
3870
3904
  (async () => {
3871
3905
  try {
3872
- const selectedTools = agentData.selectedTools?.[toolId];
3906
+ const { toolId, toolSelection } = canUseItem;
3873
3907
  logger11.info({ agentId, toolId }, "Processing agent-tool relation");
3874
3908
  await upsertAgentToolRelation(db)({
3875
3909
  scopes: { tenantId, projectId, graphId: finalGraphId },
3876
3910
  agentId,
3877
3911
  toolId,
3878
- selectedTools
3912
+ selectedTools: toolSelection || void 0
3879
3913
  });
3880
3914
  logger11.info({ agentId, toolId }, "Agent-tool relation processed successfully");
3881
3915
  } catch (error) {
3882
- logger11.error({ agentId, toolId, error }, "Failed to create agent-tool relation");
3916
+ logger11.error({ agentId, toolId: canUseItem.toolId, error }, "Failed to create agent-tool relation");
3883
3917
  }
3884
3918
  })()
3885
3919
  );
@@ -4257,23 +4291,23 @@ var updateFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
4257
4291
  }
4258
4292
  const agentToolPromises = [];
4259
4293
  for (const [agentId, agentData] of Object.entries(typedGraphDefinition.agents)) {
4260
- if (isInternalAgent(agentData) && agentData.tools && Array.isArray(agentData.tools)) {
4261
- for (const toolId of agentData.tools) {
4294
+ if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
4295
+ for (const canUseItem of agentData.canUse) {
4262
4296
  agentToolPromises.push(
4263
4297
  (async () => {
4264
4298
  try {
4265
- const selectedTools = agentData.selectedTools?.[toolId];
4299
+ const { toolId, toolSelection } = canUseItem;
4266
4300
  await createAgentToolRelation(db)({
4267
4301
  scopes: { tenantId, projectId, graphId: finalGraphId },
4268
4302
  data: {
4269
4303
  agentId,
4270
4304
  toolId,
4271
- selectedTools
4305
+ selectedTools: toolSelection || void 0
4272
4306
  }
4273
4307
  });
4274
4308
  logger11.info({ agentId, toolId }, "Agent-tool relation created");
4275
4309
  } catch (error) {
4276
- logger11.error({ agentId, toolId, error }, "Failed to create agent-tool relation");
4310
+ logger11.error({ agentId, toolId: canUseItem.toolId, error }, "Failed to create agent-tool relation");
4277
4311
  }
4278
4312
  })()
4279
4313
  );
@@ -5137,7 +5171,6 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
5137
5171
  );
5138
5172
  await upsertArtifactComponent(db)({
5139
5173
  data: {
5140
- id: componentId,
5141
5174
  ...componentData,
5142
5175
  tenantId,
5143
5176
  projectId: typed.id
@@ -5443,7 +5476,6 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
5443
5476
  );
5444
5477
  await upsertArtifactComponent(db)({
5445
5478
  data: {
5446
- id: componentId,
5447
5479
  ...componentData,
5448
5480
  tenantId,
5449
5481
  projectId: typed.id
@@ -5569,14 +5601,10 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
5569
5601
  id: tool2.id,
5570
5602
  name: tool2.name,
5571
5603
  config: tool2.config,
5572
- imageUrl: tool2.imageUrl || void 0,
5573
- status: tool2.status,
5574
- capabilities: tool2.capabilities || void 0,
5575
- lastHealthCheck: tool2.lastHealthCheck && !Number.isNaN(new Date(tool2.lastHealthCheck).getTime()) ? new Date(tool2.lastHealthCheck).toISOString() : void 0,
5576
- lastError: tool2.lastError || void 0,
5577
- availableTools: tool2.availableTools || void 0,
5578
- activeTools: tool2.config?.mcp?.activeTools || void 0,
5579
- lastToolsSync: tool2.lastToolsSync && !Number.isNaN(new Date(tool2.lastToolsSync).getTime()) ? new Date(tool2.lastToolsSync).toISOString() : void 0
5604
+ credentialReferenceId: tool2.credentialReferenceId || void 0,
5605
+ imageUrl: tool2.imageUrl || void 0
5606
+ // Don't include runtime fields in configuration
5607
+ // status, capabilities, lastHealthCheck, lastError, availableTools, activeTools, lastToolsSync are all runtime
5580
5608
  };
5581
5609
  }
5582
5610
  logger11.info(
@@ -7033,21 +7061,62 @@ var ContextResolver = class {
7033
7061
  var logger7 = getLogger("context-validation");
7034
7062
  var ajv = new Ajv({ allErrors: true, strict: false });
7035
7063
  var HTTP_REQUEST_PARTS = ["headers"];
7064
+ var MAX_SCHEMA_CACHE_SIZE = 1e3;
7036
7065
  var schemaCache = /* @__PURE__ */ new Map();
7037
7066
  function isValidHttpRequest(obj) {
7038
7067
  return obj != null && typeof obj === "object" && !Array.isArray(obj) && "headers" in obj;
7039
7068
  }
7040
7069
  function getCachedValidator(schema) {
7041
7070
  const key = JSON.stringify(schema);
7042
- if (!schemaCache.has(key)) {
7043
- schemaCache.set(key, ajv.compile(schema));
7071
+ if (schemaCache.has(key)) {
7072
+ const validator2 = schemaCache.get(key);
7073
+ if (!validator2) {
7074
+ throw new Error("Unexpected: validator not found in cache after has() check");
7075
+ }
7076
+ schemaCache.delete(key);
7077
+ schemaCache.set(key, validator2);
7078
+ return validator2;
7044
7079
  }
7045
- const validator = schemaCache.get(key);
7046
- if (!validator) {
7047
- throw new Error("Failed to compile JSON schema");
7080
+ if (schemaCache.size >= MAX_SCHEMA_CACHE_SIZE) {
7081
+ const firstKey = schemaCache.keys().next().value;
7082
+ if (firstKey) {
7083
+ schemaCache.delete(firstKey);
7084
+ }
7048
7085
  }
7086
+ const permissiveSchema = makeSchemaPermissive(schema);
7087
+ const validator = ajv.compile(permissiveSchema);
7088
+ schemaCache.set(key, validator);
7049
7089
  return validator;
7050
7090
  }
7091
+ function makeSchemaPermissive(schema) {
7092
+ if (!schema || typeof schema !== "object") {
7093
+ return schema;
7094
+ }
7095
+ const permissiveSchema = { ...schema };
7096
+ if (permissiveSchema.type === "object") {
7097
+ permissiveSchema.additionalProperties = true;
7098
+ if (permissiveSchema.properties && typeof permissiveSchema.properties === "object") {
7099
+ const newProperties = {};
7100
+ for (const [key, value] of Object.entries(permissiveSchema.properties)) {
7101
+ newProperties[key] = makeSchemaPermissive(value);
7102
+ }
7103
+ permissiveSchema.properties = newProperties;
7104
+ }
7105
+ }
7106
+ if (permissiveSchema.type === "array" && permissiveSchema.items) {
7107
+ permissiveSchema.items = makeSchemaPermissive(permissiveSchema.items);
7108
+ }
7109
+ if (permissiveSchema.oneOf) {
7110
+ permissiveSchema.oneOf = permissiveSchema.oneOf.map(makeSchemaPermissive);
7111
+ }
7112
+ if (permissiveSchema.anyOf) {
7113
+ permissiveSchema.anyOf = permissiveSchema.anyOf.map(makeSchemaPermissive);
7114
+ }
7115
+ if (permissiveSchema.allOf) {
7116
+ permissiveSchema.allOf = permissiveSchema.allOf.map(makeSchemaPermissive);
7117
+ }
7118
+ return permissiveSchema;
7119
+ }
7051
7120
  function validationHelper(jsonSchema) {
7052
7121
  return getCachedValidator(jsonSchema);
7053
7122
  }
@@ -8492,7 +8561,7 @@ var loadEnvironmentFiles = () => {
8492
8561
  loadEnvironmentFiles();
8493
8562
  var envSchema = z$1.object({
8494
8563
  ENVIRONMENT: z$1.enum(["development", "production", "pentest", "test"]).optional(),
8495
- DB_FILE_NAME: z$1.string(),
8564
+ DB_FILE_NAME: z$1.string().optional(),
8496
8565
  OTEL_TRACES_FORCE_FLUSH_ENABLED: z$1.coerce.boolean().optional()
8497
8566
  });
8498
8567
  var parseEnv = () => {
@@ -8512,4 +8581,4 @@ ${error.message}`
8512
8581
  };
8513
8582
  parseEnv();
8514
8583
 
8515
- export { ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, ERROR_DOCS_BASE_URL, ErrorCode, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, McpClient, NangoCredentialStore, PinoLogger, TemplateEngine, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentGraph, createAgentRelation, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelation, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsByIds, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getContextConfigsByName, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getGraphAgentInfos, getHealthyToolsForAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsByStatus, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, listToolsByStatus, loadEnvironmentFiles, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateMessage, updateProject, updateTask, updateTool, updateToolStatus, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };
8584
+ export { ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, ERROR_DOCS_BASE_URL, ErrorCode, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, McpClient, NangoCredentialStore, PinoLogger, TemplateEngine, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentGraph, createAgentRelation, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelation, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsByIds, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getContextConfigsByName, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getGraphAgentInfos, getHealthyToolsForAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsByStatus, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, listToolsByStatus, loadEnvironmentFiles, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, requestContextSchema, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateMessage, updateProject, updateTask, updateTool, updateToolStatus, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };