@inkeep/agents-core 0.38.0 → 0.38.1

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/auth/auth.js CHANGED
@@ -1,4 +1,4 @@
1
- import { generateId } from '../chunk-MGHGIB7U.js';
1
+ import { generateId } from '../chunk-VXHL7CJY.js';
2
2
  import { env } from '../chunk-ZIXAWYZI.js';
3
3
  import { ssoProvider } from '../chunk-GENLXHZ4.js';
4
4
  import { ownerRole, adminRole, memberRole, ac } from '../chunk-JNBVHWXX.js';
@@ -55,6 +55,8 @@ declare const SPAN_KEYS: {
55
55
  readonly AI_TOOL_CALL_ARGS: "ai.toolCall.args";
56
56
  readonly AI_TOOL_CALL_ID: "ai.toolCall.id";
57
57
  readonly AI_TOOL_TYPE: "ai.toolType";
58
+ readonly AI_TOOL_CALL_MCP_SERVER_ID: "ai.toolCall.mcpServerId";
59
+ readonly AI_TOOL_CALL_MCP_SERVER_NAME: "ai.toolCall.mcpServerName";
58
60
  readonly TOOL_PURPOSE: "tool.purpose";
59
61
  readonly TOOL_NAME: "tool.name";
60
62
  readonly TOOL_CALL_ID: "tool.callId";
@@ -106,6 +108,7 @@ declare const ACTIVITY_STATUS: {
106
108
  readonly SUCCESS: "success";
107
109
  readonly ERROR: "error";
108
110
  readonly PENDING: "pending";
111
+ readonly WARNING: "warning";
109
112
  };
110
113
  /** Agent IDs */
111
114
  declare const AGENT_IDS: {
@@ -10,7 +10,7 @@ function discoverScopes(resourceMetadata, metadata) {
10
10
  async function discoverMcpMetadata(mcpServerUrl, logger) {
11
11
  try {
12
12
  let resourceMetadata = null;
13
- let authServerUrl = new URL(mcpServerUrl);
13
+ let authServerUrl = new URL("/", mcpServerUrl);
14
14
  try {
15
15
  resourceMetadata = await discoverOAuthProtectedResourceMetadata(mcpServerUrl);
16
16
  if (resourceMetadata?.authorization_servers?.length && resourceMetadata.authorization_servers[0]) {
@@ -57,6 +57,8 @@ var SPAN_KEYS = {
57
57
  AI_TOOL_CALL_ARGS: "ai.toolCall.args",
58
58
  AI_TOOL_CALL_ID: "ai.toolCall.id",
59
59
  AI_TOOL_TYPE: "ai.toolType",
60
+ AI_TOOL_CALL_MCP_SERVER_ID: "ai.toolCall.mcpServerId",
61
+ AI_TOOL_CALL_MCP_SERVER_NAME: "ai.toolCall.mcpServerName",
60
62
  TOOL_PURPOSE: "tool.purpose",
61
63
  TOOL_NAME: "tool.name",
62
64
  TOOL_CALL_ID: "tool.callId",
@@ -112,7 +114,8 @@ var ACTIVITY_TYPES = {
112
114
  var ACTIVITY_STATUS = {
113
115
  SUCCESS: "success",
114
116
  ERROR: "error",
115
- PENDING: "pending"
117
+ PENDING: "pending",
118
+ WARNING: "warning"
116
119
  };
117
120
  var AGENT_IDS = {
118
121
  USER: "user",
@@ -1134,6 +1134,12 @@ function deriveComposioUserId(tenantId, projectId) {
1134
1134
  const SEPARATOR = "||";
1135
1135
  return `${tenantId}${SEPARATOR}${projectId}`;
1136
1136
  }
1137
+ function getComposioUserId(tenantId, projectId, credentialScope, userId) {
1138
+ if (credentialScope === "user" && userId) {
1139
+ return userId;
1140
+ }
1141
+ return deriveComposioUserId(tenantId, projectId);
1142
+ }
1137
1143
  function extractComposioServerId(mcpUrl) {
1138
1144
  if (!mcpUrl.includes("composio.dev")) {
1139
1145
  return null;
@@ -1150,12 +1156,6 @@ function extractComposioServerId(mcpUrl) {
1150
1156
  return null;
1151
1157
  }
1152
1158
  }
1153
- function addUserIdToUrl(url, userId) {
1154
- const urlObj = new URL(url);
1155
- urlObj.searchParams.set("user_id", userId);
1156
- urlObj.searchParams.delete("transport");
1157
- return urlObj.toString();
1158
- }
1159
1159
  async function deleteComposioConnectedAccount(accountId) {
1160
1160
  const composioInstance = getComposioInstance();
1161
1161
  if (!composioInstance) {
@@ -1178,7 +1178,8 @@ async function fetchComposioConnectedAccounts(derivedUserId) {
1178
1178
  }
1179
1179
  try {
1180
1180
  const connectedAccounts = await composioInstance.connectedAccounts.list({
1181
- userIds: [derivedUserId]
1181
+ userIds: [derivedUserId],
1182
+ statuses: ["ACTIVE", "INITIATED"]
1182
1183
  });
1183
1184
  return connectedAccounts;
1184
1185
  } catch (error) {
@@ -1186,7 +1187,7 @@ async function fetchComposioConnectedAccounts(derivedUserId) {
1186
1187
  return null;
1187
1188
  }
1188
1189
  }
1189
- async function isComposioMCPServerAuthenticated(tenantId, projectId, mcpServerUrl) {
1190
+ async function isComposioMCPServerAuthenticated(tenantId, projectId, mcpServerUrl, credentialScope = "project", userId) {
1190
1191
  const composioApiKey = process.env.COMPOSIO_API_KEY;
1191
1192
  if (!composioApiKey) {
1192
1193
  logger4.info({}, "Composio API key not configured, skipping auth check");
@@ -1197,7 +1198,7 @@ async function isComposioMCPServerAuthenticated(tenantId, projectId, mcpServerUr
1197
1198
  logger4.info({ mcpServerUrl }, "Could not extract Composio server ID from URL");
1198
1199
  return false;
1199
1200
  }
1200
- const derivedUserId = deriveComposioUserId(tenantId, projectId);
1201
+ const composioUserId = getComposioUserId(tenantId, projectId, credentialScope, userId);
1201
1202
  const composioInstance = getComposioInstance();
1202
1203
  if (!composioInstance) {
1203
1204
  logger4.info({}, "Composio not configured, skipping auth check");
@@ -1209,7 +1210,7 @@ async function isComposioMCPServerAuthenticated(tenantId, projectId, mcpServerUr
1209
1210
  if (!firstAuthConfigId) {
1210
1211
  return false;
1211
1212
  }
1212
- const connectedAccounts = await fetchComposioConnectedAccounts(derivedUserId);
1213
+ const connectedAccounts = await fetchComposioConnectedAccounts(composioUserId);
1213
1214
  if (!connectedAccounts) {
1214
1215
  return false;
1215
1216
  }
@@ -1270,15 +1271,44 @@ async function ensureComposioAccount(composioMcpServer, derivedUserId, initiated
1270
1271
  return null;
1271
1272
  }
1272
1273
  }
1274
+ async function getComposioOAuthRedirectUrl(tenantId, projectId, mcpServerUrl, credentialScope, userId) {
1275
+ const composioApiKey = process.env.COMPOSIO_API_KEY;
1276
+ if (!composioApiKey) {
1277
+ logger4.info({}, "Composio API key not configured");
1278
+ return null;
1279
+ }
1280
+ const serverId = extractComposioServerId(mcpServerUrl);
1281
+ if (!serverId) {
1282
+ logger4.info({ mcpServerUrl }, "Could not extract Composio server ID from URL");
1283
+ return null;
1284
+ }
1285
+ const composioInstance = getComposioInstance();
1286
+ if (!composioInstance) {
1287
+ logger4.info({}, "Composio not configured");
1288
+ return null;
1289
+ }
1290
+ const composioUserId = getComposioUserId(tenantId, projectId, credentialScope, userId);
1291
+ try {
1292
+ const composioMcpServer = await composioInstance.mcp.get(serverId);
1293
+ const connectedAccounts = await fetchComposioConnectedAccounts(composioUserId);
1294
+ const initiatedAccounts = connectedAccounts?.items.filter((account) => account.status === "INITIATED") ?? [];
1295
+ const redirectUrl = await ensureComposioAccount(
1296
+ composioMcpServer,
1297
+ composioUserId,
1298
+ initiatedAccounts
1299
+ );
1300
+ return redirectUrl;
1301
+ } catch (error) {
1302
+ logger4.error({ error, mcpServerUrl }, "Failed to get Composio OAuth redirect URL");
1303
+ return null;
1304
+ }
1305
+ }
1273
1306
  async function transformComposioServer(composioMcpServer, authenticatedAuthConfigIds, initiatedAccounts, derivedUserId) {
1274
1307
  const isAuthenticated = composioMcpServer.authConfigIds.some(
1275
1308
  (authConfigId) => authenticatedAuthConfigIds.has(authConfigId)
1276
1309
  );
1277
- let url = composioMcpServer.MCPUrl;
1278
1310
  let thirdPartyConnectAccountUrl;
1279
- if (isAuthenticated) {
1280
- url = addUserIdToUrl(url, derivedUserId);
1281
- } else {
1311
+ if (!isAuthenticated) {
1282
1312
  const redirectUrl = await ensureComposioAccount(
1283
1313
  composioMcpServer,
1284
1314
  derivedUserId,
@@ -1288,22 +1318,20 @@ async function transformComposioServer(composioMcpServer, authenticatedAuthConfi
1288
1318
  return null;
1289
1319
  }
1290
1320
  thirdPartyConnectAccountUrl = redirectUrl;
1291
- url = addUserIdToUrl(url, derivedUserId);
1292
1321
  }
1293
1322
  return transformComposioServerData(
1294
1323
  composioMcpServer,
1295
1324
  isAuthenticated,
1296
- url,
1325
+ composioMcpServer.MCPUrl,
1297
1326
  thirdPartyConnectAccountUrl
1298
1327
  );
1299
1328
  }
1300
- async function fetchComposioServers(tenantId, projectId) {
1329
+ async function fetchComposioServers() {
1301
1330
  const composioApiKey = process.env.COMPOSIO_API_KEY;
1302
1331
  if (!composioApiKey) {
1303
1332
  logger4.info({}, "COMPOSIO_API_KEY not configured, skipping Composio servers");
1304
1333
  return [];
1305
1334
  }
1306
- const derivedUserId = deriveComposioUserId(tenantId, projectId);
1307
1335
  const composioInstance = getComposioInstance();
1308
1336
  if (!composioInstance) {
1309
1337
  logger4.info({}, "Composio not configured, returning empty list");
@@ -1316,44 +1344,30 @@ async function fetchComposioServers(tenantId, projectId) {
1316
1344
  page: 1,
1317
1345
  authConfigs: []
1318
1346
  });
1319
- const userConnectedAccounts = await composioInstance.connectedAccounts.list({
1320
- userIds: [derivedUserId]
1321
- });
1322
- const activeAccounts = userConnectedAccounts?.items.filter(
1323
- (account) => account.status === "ACTIVE"
1324
- );
1325
- const initiatedAccounts = userConnectedAccounts?.items.filter(
1326
- (account) => account.status === "INITIATED"
1327
- );
1328
- const authenticatedAuthConfigIds = new Set(
1329
- activeAccounts?.map((account) => account.authConfig.id) ?? []
1330
- );
1331
- const transformedServers = await Promise.all(
1332
- composioMcpServers?.items.map(
1333
- (server) => transformComposioServer(
1334
- server,
1335
- authenticatedAuthConfigIds,
1336
- initiatedAccounts ?? [],
1337
- derivedUserId
1338
- )
1347
+ const transformedServers = composioMcpServers?.items.map(
1348
+ (server) => transformComposioServerData(
1349
+ server,
1350
+ false,
1351
+ // Always false for catalog - we want scope dialog to show
1352
+ server.MCPUrl,
1353
+ // Raw URL without user_id
1354
+ void 0
1355
+ // No OAuth redirect URL for catalog
1339
1356
  )
1340
1357
  );
1341
- const validServers = transformedServers.filter(
1342
- (server) => server !== null
1343
- );
1344
- return validServers;
1358
+ return transformedServers ?? [];
1345
1359
  } catch (error) {
1346
1360
  logger4.error({ error }, "Failed to fetch Composio servers");
1347
1361
  return [];
1348
1362
  }
1349
1363
  }
1350
- async function fetchSingleComposioServer(tenantId, projectId, mcpServerUrl) {
1364
+ async function fetchSingleComposioServer(tenantId, projectId, mcpServerUrl, credentialScope = "project", userId) {
1351
1365
  const composioApiKey = process.env.COMPOSIO_API_KEY;
1352
1366
  if (!composioApiKey) {
1353
1367
  logger4.debug({}, "COMPOSIO_API_KEY not configured");
1354
1368
  return null;
1355
1369
  }
1356
- const derivedUserId = deriveComposioUserId(tenantId, projectId);
1370
+ const composioUserId = getComposioUserId(tenantId, projectId, credentialScope, userId);
1357
1371
  const composioInstance = getComposioInstance();
1358
1372
  if (!composioInstance) {
1359
1373
  logger4.info({}, "Composio not configured, returning null");
@@ -1367,7 +1381,8 @@ async function fetchSingleComposioServer(tenantId, projectId, mcpServerUrl) {
1367
1381
  }
1368
1382
  const composioMcpServer = await composioInstance.mcp.get(serverId);
1369
1383
  const userConnectedAccounts = await composioInstance.connectedAccounts.list({
1370
- userIds: [derivedUserId]
1384
+ userIds: [composioUserId],
1385
+ statuses: ["ACTIVE", "INITIATED"]
1371
1386
  });
1372
1387
  const activeAccounts = userConnectedAccounts?.items.filter(
1373
1388
  (account) => account.status === "ACTIVE"
@@ -1382,7 +1397,7 @@ async function fetchSingleComposioServer(tenantId, projectId, mcpServerUrl) {
1382
1397
  composioMcpServer,
1383
1398
  authenticatedAuthConfigIds,
1384
1399
  initiatedAccounts ?? [],
1385
- derivedUserId
1400
+ composioUserId
1386
1401
  );
1387
1402
  return transformedServer;
1388
1403
  } catch (error) {
@@ -1393,11 +1408,17 @@ async function fetchSingleComposioServer(tenantId, projectId, mcpServerUrl) {
1393
1408
 
1394
1409
  // src/utils/third-party-mcp-servers/third-party-check.ts
1395
1410
  var logger5 = getLogger("third-party-check");
1396
- async function isThirdPartyMCPServerAuthenticated(tenantId, projectId, mcpServerUrl) {
1411
+ async function isThirdPartyMCPServerAuthenticated(tenantId, projectId, mcpServerUrl, credentialScope = "project", userId) {
1397
1412
  const composioServerId = extractComposioServerId(mcpServerUrl);
1398
1413
  if (composioServerId) {
1399
1414
  logger5.debug({ mcpServerUrl }, "Detected Composio MCP server, checking auth status");
1400
- return isComposioMCPServerAuthenticated(tenantId, projectId, mcpServerUrl);
1415
+ return isComposioMCPServerAuthenticated(
1416
+ tenantId,
1417
+ projectId,
1418
+ mcpServerUrl,
1419
+ credentialScope,
1420
+ userId
1421
+ );
1401
1422
  }
1402
1423
  logger5.info({ mcpServerUrl }, "Unknown third-party MCP server provider");
1403
1424
  return false;
@@ -1450,4 +1471,4 @@ function getTracer(serviceName, serviceVersion) {
1450
1471
  }
1451
1472
  }
1452
1473
 
1453
- export { CONVERSATION_HISTORY_DEFAULT_LIMIT, CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT, ERROR_DOCS_BASE_URL, ErrorCode, MCP_TOOL_CONNECTION_TIMEOUT_MS, MCP_TOOL_INITIAL_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RETRIES, MCP_TOOL_RECONNECTION_DELAY_GROWTH_FACTOR, McpClient, ModelFactory, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, createExecutionContext, errorResponseSchema, errorSchemaFactory, executionLimitsSharedDefaults, extractComposioServerId, extractPublicId, fetchComposioServers, fetchSingleComposioServer, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateServiceToken, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getRequestExecutionContext, getTracer, handleApiError, hashApiKey, isApiKeyExpired, isComposioMCPServerAuthenticated, isThirdPartyMCPServerAuthenticated, maskApiKey, normalizeDateString, problemDetailsSchema, setSpanWithError, signTempToken, toISODateString, validateApiKey, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken, verifyTempToken };
1474
+ export { CONVERSATION_HISTORY_DEFAULT_LIMIT, CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT, ERROR_DOCS_BASE_URL, ErrorCode, MCP_TOOL_CONNECTION_TIMEOUT_MS, MCP_TOOL_INITIAL_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RETRIES, MCP_TOOL_RECONNECTION_DELAY_GROWTH_FACTOR, McpClient, ModelFactory, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, createExecutionContext, errorResponseSchema, errorSchemaFactory, executionLimitsSharedDefaults, extractComposioServerId, extractPublicId, fetchComposioServers, fetchSingleComposioServer, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getRequestExecutionContext, getTracer, handleApiError, hashApiKey, isApiKeyExpired, isComposioMCPServerAuthenticated, isThirdPartyMCPServerAuthenticated, maskApiKey, normalizeDateString, problemDetailsSchema, setSpanWithError, signTempToken, toISODateString, validateApiKey, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken, verifyTempToken };
@@ -1,4 +1,4 @@
1
- export { i as ACTIVITY_NAMES, g as ACTIVITY_STATUS, f as ACTIVITY_TYPES, h as AGENT_IDS, p as AGGREGATE_OPERATORS, A as AI_OPERATIONS, j as AI_TOOL_TYPES, o as DATA_SOURCES, k as DATA_TYPES, D as DELEGATION_FROM_SUB_AGENT_ID, b as DELEGATION_ID, a as DELEGATION_TO_SUB_AGENT_ID, F as FIELD_TYPES, O as OPERATORS, m as ORDER_DIRECTIONS, P as PANEL_TYPES, q as QUERY_DEFAULTS, l as QUERY_EXPRESSIONS, Q as QUERY_FIELD_CONFIGS, n as QUERY_TYPES, R as REDUCE_OPERATIONS, e as SPAN_KEYS, S as SPAN_NAMES, T as TRANSFER_FROM_SUB_AGENT_ID, c as TRANSFER_TO_SUB_AGENT_ID, U as UNKNOWN_VALUE, d as detectAuthenticationRequired } from './auth-detection-7G0Dxt55.js';
1
+ export { i as ACTIVITY_NAMES, g as ACTIVITY_STATUS, f as ACTIVITY_TYPES, h as AGENT_IDS, p as AGGREGATE_OPERATORS, A as AI_OPERATIONS, j as AI_TOOL_TYPES, o as DATA_SOURCES, k as DATA_TYPES, D as DELEGATION_FROM_SUB_AGENT_ID, b as DELEGATION_ID, a as DELEGATION_TO_SUB_AGENT_ID, F as FIELD_TYPES, O as OPERATORS, m as ORDER_DIRECTIONS, P as PANEL_TYPES, q as QUERY_DEFAULTS, l as QUERY_EXPRESSIONS, Q as QUERY_FIELD_CONFIGS, n as QUERY_TYPES, R as REDUCE_OPERATIONS, e as SPAN_KEYS, S as SPAN_NAMES, T as TRANSFER_FROM_SUB_AGENT_ID, c as TRANSFER_TO_SUB_AGENT_ID, U as UNKNOWN_VALUE, d as detectAuthenticationRequired } from './auth-detection-B8jOnR88.js';
2
2
  import { z } from '@hono/zod-openapi';
3
3
  import { a as ConversationHistoryConfig, F as FunctionApiInsertSchema, A as ApiKeyApiUpdateSchema, g as FullAgentAgentInsertSchema } from './utility-dsfXkYTu.js';
4
4
  export { k as AgentStopWhen, h as AgentStopWhenSchema, f as CredentialStoreType, p as FunctionApiSelectSchema, q as FunctionApiUpdateSchema, o as MCPTransportType, n as ModelSettings, m as ModelSettingsSchema, j as StopWhen, S as StopWhenSchema, l as SubAgentStopWhen, i as SubAgentStopWhenSchema } from './utility-dsfXkYTu.js';
@@ -1,8 +1,8 @@
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, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, UNKNOWN_VALUE } from './chunk-MQMMFK2K.js';
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, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, UNKNOWN_VALUE } from './chunk-NLLGMFQ6.js';
2
2
  import { ModelSettingsSchema, FullAgentAgentInsertSchema, ArtifactComponentApiInsertSchema } from './chunk-UK63CULA.js';
3
3
  export { AgentStopWhenSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, ModelSettingsSchema, StopWhenSchema, SubAgentStopWhenSchema, validatePropsAsJsonSchema } from './chunk-UK63CULA.js';
4
4
  import { schemaValidationDefaults } from './chunk-Z64UK4CA.js';
5
- export { detectAuthenticationRequired } from './chunk-4JZT4QEE.js';
5
+ export { detectAuthenticationRequired } from './chunk-KVVL5WLM.js';
6
6
  export { DEFAULT_NANGO_STORE_ID } from './chunk-3OPS2LN5.js';
7
7
  import { CredentialStoreType } from './chunk-YFHT5M2R.js';
8
8
  export { CredentialStoreType, MCPTransportType } from './chunk-YFHT5M2R.js';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { ANTHROPIC_MODELS, AnthropicModel, GOOGLE_MODELS, GoogleModel, ModelName, OPENAI_MODELS, OpenAIModel } from './constants/models.js';
2
- import { r as PinoLogger, s as getLogger } from './auth-detection-7G0Dxt55.js';
3
- export { i as ACTIVITY_NAMES, g as ACTIVITY_STATUS, f as ACTIVITY_TYPES, h as AGENT_IDS, p as AGGREGATE_OPERATORS, A as AI_OPERATIONS, j as AI_TOOL_TYPES, o as DATA_SOURCES, k as DATA_TYPES, D as DELEGATION_FROM_SUB_AGENT_ID, b as DELEGATION_ID, a as DELEGATION_TO_SUB_AGENT_ID, F as FIELD_TYPES, L as LoggerFactoryConfig, M as McpOAuthFlowResult, u as McpTokenExchangeResult, t as OAuthConfig, O as OPERATORS, m as ORDER_DIRECTIONS, P as PANEL_TYPES, x as PinoLoggerConfig, q as QUERY_DEFAULTS, l as QUERY_EXPRESSIONS, Q as QUERY_FIELD_CONFIGS, n as QUERY_TYPES, R as REDUCE_OPERATIONS, e as SPAN_KEYS, S as SPAN_NAMES, T as TRANSFER_FROM_SUB_AGENT_ID, c as TRANSFER_TO_SUB_AGENT_ID, U as UNKNOWN_VALUE, d as detectAuthenticationRequired, w as exchangeMcpAuthorizationCode, v as initiateMcpOAuthFlow, y as loggerFactory } from './auth-detection-7G0Dxt55.js';
2
+ import { r as PinoLogger, s as getLogger } from './auth-detection-B8jOnR88.js';
3
+ export { i as ACTIVITY_NAMES, g as ACTIVITY_STATUS, f as ACTIVITY_TYPES, h as AGENT_IDS, p as AGGREGATE_OPERATORS, A as AI_OPERATIONS, j as AI_TOOL_TYPES, o as DATA_SOURCES, k as DATA_TYPES, D as DELEGATION_FROM_SUB_AGENT_ID, b as DELEGATION_ID, a as DELEGATION_TO_SUB_AGENT_ID, F as FIELD_TYPES, L as LoggerFactoryConfig, M as McpOAuthFlowResult, u as McpTokenExchangeResult, t as OAuthConfig, O as OPERATORS, m as ORDER_DIRECTIONS, P as PANEL_TYPES, x as PinoLoggerConfig, q as QUERY_DEFAULTS, l as QUERY_EXPRESSIONS, Q as QUERY_FIELD_CONFIGS, n as QUERY_TYPES, R as REDUCE_OPERATIONS, e as SPAN_KEYS, S as SPAN_NAMES, T as TRANSFER_FROM_SUB_AGENT_ID, c as TRANSFER_TO_SUB_AGENT_ID, U as UNKNOWN_VALUE, d as detectAuthenticationRequired, w as exchangeMcpAuthorizationCode, v as initiateMcpOAuthFlow, y as loggerFactory } from './auth-detection-B8jOnR88.js';
4
4
  export { AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT, AGENT_EXECUTION_TRANSFER_COUNT_MAX, AGENT_EXECUTION_TRANSFER_COUNT_MIN, CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT, STATUS_UPDATE_MAX_INTERVAL_SECONDS, STATUS_UPDATE_MAX_NUM_EVENTS, SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT, SUB_AGENT_TURN_GENERATION_STEPS_MAX, SUB_AGENT_TURN_GENERATION_STEPS_MIN, VALIDATION_AGENT_PROMPT_MAX_CHARS, VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS, schemaValidationDefaults } from './constants/schema-validation/index.js';
5
5
  import { z } from '@hono/zod-openapi';
6
6
  import { r as CredentialReferenceApiInsert, s as ContextConfigSelect, C as ContextFetchDefinition, o as MCPTransportType, t as MCPToolConfig, u as ProjectScopeConfig, v as FullAgentDefinition, w as AgentScopeConfig, a as ConversationHistoryConfig, x as PaginationConfig, y as AgentInsert, z as AgentUpdate, B as AgentSelect, D as ApiKeySelect, E as ApiKeyInsert, G as ApiKeyUpdate, H as CreateApiKeyParams, I as ApiKeyCreateResult, J as ArtifactComponentSelect, K as ArtifactComponentInsert, L as ArtifactComponentUpdate, N as SubAgentScopeConfig, O as ContextCacheSelect, Q as ContextCacheInsert, R as ContextConfigInsert, U as ContextConfigUpdate, V as ConversationSelect, W as ConversationInsert, d as ConversationMetadata, X as ConversationUpdate, Y as CredentialReferenceSelect, Z as ToolSelect, _ as ExternalAgentSelect, $ as CredentialReferenceInsert, a0 as CredentialReferenceUpdate, a1 as DataComponentSelect, a2 as DataComponentInsert, a3 as DataComponentUpdate, a4 as ExternalAgentInsert, a5 as ExternalAgentUpdate, a6 as FunctionApiInsert, a7 as FunctionToolApiInsert, a8 as FunctionToolApiUpdate, a9 as Artifact, aa as LedgerArtifactSelect, e as MessageMetadata, M as MessageContent, ab as MessageVisibility, ac as MessageInsert, ad as MessageUpdate, ae as FullProjectDefinition, af as ProjectInfo, ag as ProjectSelect, ah as PaginationResult, ai as ProjectResourceCounts, aj as ProjectInsert, ak as ProjectUpdate, al as SubAgentExternalAgentRelationInsert, am as SubAgentRelationInsert, an as SubAgentRelationUpdate, ao as SubAgentToolRelationUpdate, b as ToolMcpConfig, c as ToolServerCapabilities, ap as SubAgentInsert, aq as SubAgentUpdate, ar as SubAgentSelect, as as SubAgentTeamAgentRelationInsert, at as TaskInsert, T as TaskMetadataConfig, au as TaskSelect, av as McpTool, aw as ToolInsert, ax as ToolUpdate, f as CredentialStoreType, ay as ExecutionContext, az as MessageSelect, n as ModelSettings, aA as PrebuiltMCPServerSchema } from './utility-dsfXkYTu.js';
@@ -4577,35 +4577,59 @@ declare function verifyTempToken(publicKeyPem: string, token: string): Promise<T
4577
4577
  */
4578
4578
 
4579
4579
  type PrebuiltMCPServer = z.infer<typeof PrebuiltMCPServerSchema>;
4580
+ /**
4581
+ * Credential scope type for MCP servers
4582
+ */
4583
+ type CredentialScope = 'project' | 'user';
4584
+ /**
4585
+ * Get the Composio user ID based on credential scope
4586
+ * - For project-scoped: uses derived tenant||project ID (shared team credentials)
4587
+ * - For user-scoped: uses the actual user ID (per-user credentials)
4588
+ */
4589
+ declare function getComposioUserId(tenantId: string, projectId: string, credentialScope: CredentialScope, userId?: string): string;
4580
4590
  /**
4581
4591
  * Extract server ID from a Composio MCP URL
4582
4592
  * Example: https://backend.composio.dev/v3/mcp/1234-1234-1234?user_id=... -> 1234-1234-1234
4583
4593
  */
4584
4594
  declare function extractComposioServerId(mcpUrl: string): string | null;
4585
4595
  /**
4586
- * Check if a Composio MCP server is authenticated for the given tenant/project
4596
+ * Check if a Composio MCP server is authenticated for the given tenant/project/user
4587
4597
  * Returns true if authenticated, false otherwise
4598
+ * @param credentialScope - 'project' for shared team credentials, 'user' for per-user credentials
4599
+ * @param userId - The actual user ID (required if credentialScope is 'user')
4588
4600
  */
4589
- declare function isComposioMCPServerAuthenticated(tenantId: string, projectId: string, mcpServerUrl: string): Promise<boolean>;
4601
+ declare function isComposioMCPServerAuthenticated(tenantId: string, projectId: string, mcpServerUrl: string, credentialScope?: CredentialScope, userId?: string): Promise<boolean>;
4590
4602
  /**
4591
- * Fetch and transform Composio MCP servers for a tenant/project
4603
+ * Get the OAuth redirect URL for a Composio MCP server based on credential scope
4604
+ * This should be called AFTER scope selection to get the correct URL
4605
+ * @param credentialScope - 'project' for shared team credentials, 'user' for per-user credentials
4606
+ * @param userId - The actual user ID (required if credentialScope is 'user')
4592
4607
  */
4593
- declare function fetchComposioServers(tenantId: string, projectId: string): Promise<PrebuiltMCPServer[]>;
4608
+ declare function getComposioOAuthRedirectUrl(tenantId: string, projectId: string, mcpServerUrl: string, credentialScope: CredentialScope, userId?: string): Promise<string | null>;
4609
+ /**
4610
+ * Fetch Composio MCP servers for the catalog
4611
+ */
4612
+ declare function fetchComposioServers(): Promise<PrebuiltMCPServer[]>;
4594
4613
  /**
4595
4614
  * Fetch a single Composio MCP server by URL and return its details with auth status
4615
+ * @param credentialScope - 'project' uses tenant||project, 'user' uses actual userId
4616
+ * @param userId - The actual user ID (required if credentialScope is 'user')
4596
4617
  */
4597
- declare function fetchSingleComposioServer(tenantId: string, projectId: string, mcpServerUrl: string): Promise<PrebuiltMCPServer | null>;
4618
+ declare function fetchSingleComposioServer(tenantId: string, projectId: string, mcpServerUrl: string, credentialScope?: CredentialScope, userId?: string): Promise<PrebuiltMCPServer | null>;
4598
4619
 
4599
4620
  /**
4600
4621
  * Third-Party MCP Server Authentication Check
4601
4622
  * Generic interface for checking authentication status of third-party MCP servers
4602
4623
  */
4624
+
4603
4625
  /**
4604
- * Check if a third-party MCP server is authenticated for the given tenant/project
4626
+ * Check if a third-party MCP server is authenticated for the given tenant/project/user
4605
4627
  * This is a generic function that routes to the appropriate provider-specific check
4606
4628
  * Returns true if authenticated, false otherwise
4629
+ * @param credentialScope - 'project' for shared team credentials, 'user' for per-user credentials
4630
+ * @param userId - The actual user ID (required if credentialScope is 'user')
4607
4631
  */
4608
- declare function isThirdPartyMCPServerAuthenticated(tenantId: string, projectId: string, mcpServerUrl: string): Promise<boolean>;
4632
+ declare function isThirdPartyMCPServerAuthenticated(tenantId: string, projectId: string, mcpServerUrl: string, credentialScope?: CredentialScope, userId?: string): Promise<boolean>;
4609
4633
 
4610
4634
  /**
4611
4635
  * Helper function to handle span errors consistently
@@ -4620,4 +4644,4 @@ declare function setSpanWithError(span: Span, error: Error, logger?: {
4620
4644
  */
4621
4645
  declare function getTracer(serviceName: string, serviceVersion?: string): Tracer;
4622
4646
 
4623
- export { AgentInsert, type AgentLogger, AgentScopeConfig, AgentSelect, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, CONVERSATION_HISTORY_DEFAULT_LIMIT, CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT, type CommonCreateErrorResponses, type CommonDeleteErrorResponses, type CommonGetErrorResponses, type CommonUpdateErrorResponses, ContextCache, ContextCacheInsert, ContextCacheSelect, ContextConfigBuilder, type ContextConfigBuilderOptions, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ContextFetcher, type ContextResolutionOptions, type ContextResolutionResult, ContextResolver, type ContextResolverInterface, type ContextValidationError, type ContextValidationResult, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationSelect, ConversationUpdate, CreateApiKeyParams, type CredentialContext, type CredentialData, CredentialReferenceApiInsert, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, type CredentialReferenceWithResources, type CredentialResolverInput, type CredentialStoreReference, CredentialStoreRegistry, CredentialStoreType, CredentialStuffer, DataComponentInsert, DataComponentSelect, DataComponentUpdate, DatabaseClient, type DotPaths, ERROR_DOCS_BASE_URL, ErrorCode, type ErrorCodes, type ErrorResponse, ExecutionContext, ExternalAgentInsert, ExternalAgentSelect, ExternalAgentUpdate, type FetchResult, FullAgentDefinition, FullProjectDefinition, FunctionApiInsert, FunctionToolApiInsert, FunctionToolApiUpdate, type GenerateServiceTokenParams, HTTP_REQUEST_PARTS, type HttpRequestPart, type LLMMessage, LedgerArtifactSelect, MCPToolConfig, MCPTransportType, MCP_TOOL_CONNECTION_TIMEOUT_MS, MCP_TOOL_INITIAL_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RETRIES, MCP_TOOL_RECONNECTION_DELAY_GROWTH_FACTOR, McpClient, type McpClientOptions, type McpSSEConfig, type McpServerConfig, type McpStreamableHttpConfig, McpTool, MessageContent, MessageInsert, MessageMetadata, MessageSelect, MessageUpdate, MessageVisibility, ModelFactory, ModelSettings, PaginationConfig, PaginationResult, type ParsedHttpRequest, PinoLogger, PrebuiltMCPServerSchema, type ProblemDetails, ProjectInfo, ProjectInsert, type ProjectLogger, ProjectResourceCounts, ProjectScopeConfig, ProjectSelect, ProjectUpdate, type ResolvedContext, type ServiceTokenPayload, type SignedTempToken, SubAgentExternalAgentRelationInsert, SubAgentInsert, SubAgentIsDefaultError, SubAgentRelationInsert, SubAgentRelationUpdate, SubAgentScopeConfig, SubAgentSelect, SubAgentTeamAgentRelationInsert, SubAgentToolRelationUpdate, SubAgentUpdate, TaskInsert, TaskMetadataConfig, TaskSelect, type TempTokenPayload, type TemplateContext, TemplateEngine, type TemplateRenderOptions, ToolInsert, ToolMcpConfig, ToolSelect, ToolServerCapabilities, ToolUpdate, type VerifyServiceTokenResult, addFunctionToolToSubAgent, addLedgerArtifacts, addToolToAgent, addUserToOrganization, agentHasArtifactComponents, apiFetch, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createExecutionContext, createExternalAgent, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createMessage, createOrGetConversation, createProject, createSubAgent, createSubAgentExternalAgentRelation, createSubAgentRelation, createSubAgentTeamAgentRelation, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullAgent, deleteFullProject, deleteFunction, deleteFunctionTool, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteSubAgent, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, deleteSubAgentRelation, deleteSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelationsByAgent, deleteSubAgentTeamAgentRelationsBySubAgent, deleteTool, determineContextTrigger, errorResponseSchema, errorSchemaFactory, executionLimitsSharedDefaults, externalAgentExists, externalAgentUrlExists, extractComposioServerId, extractPublicId, fetchComponentRelationships, fetchComposioServers, fetchDefinition, fetchSingleComposioServer, formatMessagesForLLM, formatMessagesForLLMContext, generateAndCreateApiKey, generateApiKey, generateId, generateServiceToken, getActiveAgentForConversation, getAgentById, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentSubAgentInfos, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentWithDefaultSubAgent, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getConversation, getConversationCacheEntries, getConversationHistory, getConversationId, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFullAgent, getFullAgentDefinition, getFullProject, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getPendingInvitationsByEmail, getProject, getProjectResourceCounts, getRelatedAgentsForAgent, getRequestExecutionContext, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getTracer, getUserByEmail, getUserById, getUserOrganizations, getUserScopedCredentialReference, getVisibleMessages, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, headers, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isComposioMCPServerAuthenticated, isDataComponentAssociatedWithAgent, isThirdPartyMCPServerAuthenticated, isValidHttpRequest, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listFunctionTools, listFunctions, listMessages, listProjects, listProjectsPaginated, listSubAgentExternalAgentRelations, listSubAgentTeamAgentRelations, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, maskApiKey, normalizeDateString, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, signTempToken, toISODateString, updateAgent, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullAgentServerSide, updateFullProjectServerSide, updateFunctionTool, updateMessage, updateProject, updateSubAgent, updateSubAgentExternalAgentRelation, updateSubAgentFunctionToolRelation, updateSubAgentTeamAgentRelation, updateTask, updateTool, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertSubAgent, upsertSubAgentExternalAgentRelation, upsertSubAgentFunctionToolRelation, upsertSubAgentRelation, upsertSubAgentTeamAgentRelation, upsertSubAgentToolRelation, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateHeaders, validateHttpRequestHeaders, validateProjectExists, validateSubAgent, validateTargetAgent, validateTenantId, validationHelper, verifyAuthorizationHeader, verifyServiceToken, verifyTempToken, withProjectValidation };
4647
+ export { AgentInsert, type AgentLogger, AgentScopeConfig, AgentSelect, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, CONVERSATION_HISTORY_DEFAULT_LIMIT, CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT, type CommonCreateErrorResponses, type CommonDeleteErrorResponses, type CommonGetErrorResponses, type CommonUpdateErrorResponses, ContextCache, ContextCacheInsert, ContextCacheSelect, ContextConfigBuilder, type ContextConfigBuilderOptions, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ContextFetcher, type ContextResolutionOptions, type ContextResolutionResult, ContextResolver, type ContextResolverInterface, type ContextValidationError, type ContextValidationResult, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationSelect, ConversationUpdate, CreateApiKeyParams, type CredentialContext, type CredentialData, CredentialReferenceApiInsert, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, type CredentialReferenceWithResources, type CredentialResolverInput, type CredentialScope, type CredentialStoreReference, CredentialStoreRegistry, CredentialStoreType, CredentialStuffer, DataComponentInsert, DataComponentSelect, DataComponentUpdate, DatabaseClient, type DotPaths, ERROR_DOCS_BASE_URL, ErrorCode, type ErrorCodes, type ErrorResponse, ExecutionContext, ExternalAgentInsert, ExternalAgentSelect, ExternalAgentUpdate, type FetchResult, FullAgentDefinition, FullProjectDefinition, FunctionApiInsert, FunctionToolApiInsert, FunctionToolApiUpdate, type GenerateServiceTokenParams, HTTP_REQUEST_PARTS, type HttpRequestPart, type LLMMessage, LedgerArtifactSelect, MCPToolConfig, MCPTransportType, MCP_TOOL_CONNECTION_TIMEOUT_MS, MCP_TOOL_INITIAL_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RETRIES, MCP_TOOL_RECONNECTION_DELAY_GROWTH_FACTOR, McpClient, type McpClientOptions, type McpSSEConfig, type McpServerConfig, type McpStreamableHttpConfig, McpTool, MessageContent, MessageInsert, MessageMetadata, MessageSelect, MessageUpdate, MessageVisibility, ModelFactory, ModelSettings, PaginationConfig, PaginationResult, type ParsedHttpRequest, PinoLogger, PrebuiltMCPServerSchema, type ProblemDetails, ProjectInfo, ProjectInsert, type ProjectLogger, ProjectResourceCounts, ProjectScopeConfig, ProjectSelect, ProjectUpdate, type ResolvedContext, type ServiceTokenPayload, type SignedTempToken, SubAgentExternalAgentRelationInsert, SubAgentInsert, SubAgentIsDefaultError, SubAgentRelationInsert, SubAgentRelationUpdate, SubAgentScopeConfig, SubAgentSelect, SubAgentTeamAgentRelationInsert, SubAgentToolRelationUpdate, SubAgentUpdate, TaskInsert, TaskMetadataConfig, TaskSelect, type TempTokenPayload, type TemplateContext, TemplateEngine, type TemplateRenderOptions, ToolInsert, ToolMcpConfig, ToolSelect, ToolServerCapabilities, ToolUpdate, type VerifyServiceTokenResult, addFunctionToolToSubAgent, addLedgerArtifacts, addToolToAgent, addUserToOrganization, agentHasArtifactComponents, apiFetch, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createExecutionContext, createExternalAgent, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createMessage, createOrGetConversation, createProject, createSubAgent, createSubAgentExternalAgentRelation, createSubAgentRelation, createSubAgentTeamAgentRelation, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullAgent, deleteFullProject, deleteFunction, deleteFunctionTool, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteSubAgent, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, deleteSubAgentRelation, deleteSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelationsByAgent, deleteSubAgentTeamAgentRelationsBySubAgent, deleteTool, determineContextTrigger, errorResponseSchema, errorSchemaFactory, executionLimitsSharedDefaults, externalAgentExists, externalAgentUrlExists, extractComposioServerId, extractPublicId, fetchComponentRelationships, fetchComposioServers, fetchDefinition, fetchSingleComposioServer, formatMessagesForLLM, formatMessagesForLLMContext, generateAndCreateApiKey, generateApiKey, generateId, generateServiceToken, getActiveAgentForConversation, getAgentById, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentSubAgentInfos, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentWithDefaultSubAgent, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getComposioOAuthRedirectUrl, getComposioUserId, getContextConfigById, getContextConfigCacheEntries, getConversation, getConversationCacheEntries, getConversationHistory, getConversationId, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFullAgent, getFullAgentDefinition, getFullProject, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getPendingInvitationsByEmail, getProject, getProjectResourceCounts, getRelatedAgentsForAgent, getRequestExecutionContext, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getTracer, getUserByEmail, getUserById, getUserOrganizations, getUserScopedCredentialReference, getVisibleMessages, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, headers, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isComposioMCPServerAuthenticated, isDataComponentAssociatedWithAgent, isThirdPartyMCPServerAuthenticated, isValidHttpRequest, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listFunctionTools, listFunctions, listMessages, listProjects, listProjectsPaginated, listSubAgentExternalAgentRelations, listSubAgentTeamAgentRelations, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, maskApiKey, normalizeDateString, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, signTempToken, toISODateString, updateAgent, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullAgentServerSide, updateFullProjectServerSide, updateFunctionTool, updateMessage, updateProject, updateSubAgent, updateSubAgentExternalAgentRelation, updateSubAgentFunctionToolRelation, updateSubAgentTeamAgentRelation, updateTask, updateTool, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertSubAgent, upsertSubAgentExternalAgentRelation, upsertSubAgentFunctionToolRelation, upsertSubAgentRelation, upsertSubAgentTeamAgentRelation, upsertSubAgentToolRelation, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateHeaders, validateHttpRequestHeaders, validateProjectExists, validateSubAgent, validateTargetAgent, validateTenantId, validationHelper, verifyAuthorizationHeader, verifyServiceToken, verifyTempToken, withProjectValidation };
package/dist/index.js CHANGED
@@ -2,20 +2,20 @@ export { cleanupTestDatabase, closeTestDatabase, createTestDatabaseClient, creat
2
2
  import { validateRender, validateAndTypeAgentData, validateAgentStructure } from './chunk-CWAFZVRI.js';
3
3
  export { A2AMessageMetadataSchema, DataComponentStreamEventSchema, DataOperationDetailsSchema, DataOperationEventSchema, DataOperationStreamEventSchema, DataSummaryStreamEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, StreamErrorEventSchema, StreamEventSchema, StreamFinishEventSchema, TextDeltaEventSchema, TextEndEventSchema, TextStartEventSchema, TransferDataSchema, generateIdFromName, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateRender, validateSubAgentExternalAgentRelations, validateToolReferences } from './chunk-CWAFZVRI.js';
4
4
  export { AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT, AGENT_EXECUTION_TRANSFER_COUNT_MAX, AGENT_EXECUTION_TRANSFER_COUNT_MIN, CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT, STATUS_UPDATE_MAX_INTERVAL_SECONDS, STATUS_UPDATE_MAX_NUM_EVENTS, SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT, SUB_AGENT_TURN_GENERATION_STEPS_MAX, SUB_AGENT_TURN_GENERATION_STEPS_MIN, VALIDATION_AGENT_PROMPT_MAX_CHARS, VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS } from './chunk-AJCP2QYU.js';
5
- 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, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, UNKNOWN_VALUE } from './chunk-MQMMFK2K.js';
5
+ 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, TRANSFER_FROM_SUB_AGENT_ID, TRANSFER_TO_SUB_AGENT_ID, UNKNOWN_VALUE } from './chunk-NLLGMFQ6.js';
6
6
  import { ContextConfigApiUpdateSchema, validatePropsAsJsonSchema } from './chunk-UK63CULA.js';
7
7
  export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentInsertSchema, AgentListResponse, AgentResponse, AgentSelectSchema, AgentStopWhenSchema, AgentUpdateSchema, AgentWithinContextOfProjectResponse, AgentWithinContextOfProjectSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeyListResponse, ApiKeyResponse, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentArrayResponse, ArtifactComponentInsertSchema, ArtifactComponentListResponse, ArtifactComponentResponse, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ComponentAssociationListResponse, ComponentAssociationSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigListResponse, ContextConfigResponse, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationListResponse, ConversationResponse, ConversationSelectSchema, ConversationUpdateSchema, CreateCredentialInStoreRequestSchema, CreateCredentialInStoreResponseSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceListResponse, CredentialReferenceResponse, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, CredentialStoreListResponseSchema, CredentialStoreSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentArrayResponse, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentListResponse, DataComponentResponse, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentListResponse, ExternalAgentResponse, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, ExternalSubAgentRelationApiInsertSchema, ExternalSubAgentRelationInsertSchema, FetchConfigSchema, FetchDefinitionSchema, FullAgentAgentInsertSchema, FullProjectDefinitionResponse, FullProjectDefinitionSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, FunctionInsertSchema, FunctionListResponse, FunctionResponse, FunctionSelectSchema, FunctionToolApiInsertSchema, FunctionToolApiSelectSchema, FunctionToolApiUpdateSchema, FunctionToolConfigSchema, FunctionToolInsertSchema, FunctionToolListResponse, FunctionToolResponse, FunctionToolSelectSchema, FunctionToolUpdateSchema, FunctionUpdateSchema, HeadersScopeSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPCatalogListResponse, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolListResponse, McpToolResponse, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageListResponse, MessageResponse, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, OAuthCallbackQuerySchema, OAuthLoginQuerySchema, PaginationQueryParamsSchema, PaginationSchema, PrebuiltMCPServerSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectListResponse, ProjectModelSchema, ProjectResponse, ProjectSelectSchema, ProjectUpdateSchema, RelatedAgentInfoListResponse, RelatedAgentInfoSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, SubAgentApiInsertSchema, SubAgentApiSelectSchema, SubAgentApiUpdateSchema, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, SubAgentArtifactComponentApiUpdateSchema, SubAgentArtifactComponentInsertSchema, SubAgentArtifactComponentListResponse, SubAgentArtifactComponentResponse, SubAgentArtifactComponentSelectSchema, SubAgentArtifactComponentUpdateSchema, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, SubAgentDataComponentApiUpdateSchema, SubAgentDataComponentInsertSchema, SubAgentDataComponentListResponse, SubAgentDataComponentResponse, SubAgentDataComponentSelectSchema, SubAgentDataComponentUpdateSchema, SubAgentExternalAgentRelationApiInsertSchema, SubAgentExternalAgentRelationApiSelectSchema, SubAgentExternalAgentRelationApiUpdateSchema, SubAgentExternalAgentRelationInsertSchema, SubAgentExternalAgentRelationListResponse, SubAgentExternalAgentRelationResponse, SubAgentExternalAgentRelationSelectSchema, SubAgentExternalAgentRelationUpdateSchema, SubAgentInsertSchema, SubAgentListResponse, SubAgentRelationApiInsertSchema, SubAgentRelationApiSelectSchema, SubAgentRelationApiUpdateSchema, SubAgentRelationInsertSchema, SubAgentRelationListResponse, SubAgentRelationQuerySchema, SubAgentRelationResponse, SubAgentRelationSelectSchema, SubAgentRelationUpdateSchema, SubAgentResponse, SubAgentSelectSchema, SubAgentStopWhenSchema, SubAgentTeamAgentRelationApiInsertSchema, SubAgentTeamAgentRelationApiSelectSchema, SubAgentTeamAgentRelationApiUpdateSchema, SubAgentTeamAgentRelationInsertSchema, SubAgentTeamAgentRelationListResponse, SubAgentTeamAgentRelationResponse, SubAgentTeamAgentRelationSelectSchema, SubAgentTeamAgentRelationUpdateSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationListResponse, SubAgentToolRelationResponse, SubAgentToolRelationSelectSchema, SubAgentToolRelationUpdateSchema, SubAgentUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TeamAgentSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TenantProjectAgentSubAgentIdParamsSchema, TenantProjectAgentSubAgentParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ThirdPartyMCPServerResponse, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolListResponse, ToolResponse, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, canDelegateToExternalAgentSchema, canDelegateToTeamAgentSchema, resourceIdSchema, validatePropsAsJsonSchema } from './chunk-UK63CULA.js';
8
8
  import { schema_exports, contextConfigs, externalAgents, functions, functionTools, subAgentFunctionToolRelations, subAgentExternalAgentRelations, subAgents, subAgentRelations, subAgentToolRelations, tools, agents, subAgentTeamAgentRelations, credentialReferences, subAgentDataComponents, subAgentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, ledgerArtifacts, tasks, taskRelations } from './chunk-LH6OJIIM.js';
9
9
  export { agentRelations, agentToolRelationsRelations, agents, 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, subAgentExternalAgentRelations, subAgentExternalAgentRelationsRelations, subAgentFunctionToolRelations, subAgentFunctionToolRelationsRelations, subAgentRelations, subAgentRelationsRelations, subAgentTeamAgentRelations, subAgentTeamAgentRelationsRelations, subAgentToolRelations, subAgents, subAgentsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-LH6OJIIM.js';
10
10
  export { schemaValidationDefaults } from './chunk-Z64UK4CA.js';
11
- import { getTracer, getCredentialStoreLookupKeyFromRetrievalParams, generateId, toISODateString, isThirdPartyMCPServerAuthenticated, createApiError, generateApiKey, extractPublicId, validateApiKey, isApiKeyExpired, getConversationId, setSpanWithError, getRequestExecutionContext, McpClient } from './chunk-MGHGIB7U.js';
12
- export { CONVERSATION_HISTORY_DEFAULT_LIMIT, CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT, ERROR_DOCS_BASE_URL, ErrorCode, MCP_TOOL_CONNECTION_TIMEOUT_MS, MCP_TOOL_INITIAL_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RETRIES, MCP_TOOL_RECONNECTION_DELAY_GROWTH_FACTOR, McpClient, ModelFactory, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, createExecutionContext, errorResponseSchema, errorSchemaFactory, executionLimitsSharedDefaults, extractComposioServerId, extractPublicId, fetchComposioServers, fetchSingleComposioServer, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateServiceToken, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getRequestExecutionContext, getTracer, handleApiError, hashApiKey, isApiKeyExpired, isComposioMCPServerAuthenticated, isThirdPartyMCPServerAuthenticated, maskApiKey, normalizeDateString, problemDetailsSchema, setSpanWithError, signTempToken, toISODateString, validateApiKey, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken, verifyTempToken } from './chunk-MGHGIB7U.js';
11
+ import { getTracer, getCredentialStoreLookupKeyFromRetrievalParams, generateId, toISODateString, isThirdPartyMCPServerAuthenticated, createApiError, generateApiKey, extractPublicId, validateApiKey, isApiKeyExpired, getConversationId, setSpanWithError, getRequestExecutionContext, McpClient } from './chunk-VXHL7CJY.js';
12
+ export { CONVERSATION_HISTORY_DEFAULT_LIMIT, CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT, ERROR_DOCS_BASE_URL, ErrorCode, MCP_TOOL_CONNECTION_TIMEOUT_MS, MCP_TOOL_INITIAL_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RECONNECTION_DELAY_MS, MCP_TOOL_MAX_RETRIES, MCP_TOOL_RECONNECTION_DELAY_GROWTH_FACTOR, McpClient, ModelFactory, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, createExecutionContext, errorResponseSchema, errorSchemaFactory, executionLimitsSharedDefaults, extractComposioServerId, extractPublicId, fetchComposioServers, fetchSingleComposioServer, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getRequestExecutionContext, getTracer, handleApiError, hashApiKey, isApiKeyExpired, isComposioMCPServerAuthenticated, isThirdPartyMCPServerAuthenticated, maskApiKey, normalizeDateString, problemDetailsSchema, setSpanWithError, signTempToken, toISODateString, validateApiKey, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken, verifyTempToken } from './chunk-VXHL7CJY.js';
13
13
  import { convertZodToJsonSchema } from './chunk-AUGHKZEB.js';
14
14
  export { convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, isZodSchema, jsonSchemaToZod, preview } from './chunk-AUGHKZEB.js';
15
15
  import { loadEnvironmentFiles, env } from './chunk-ZIXAWYZI.js';
16
16
  export { loadEnvironmentFiles } from './chunk-ZIXAWYZI.js';
17
- import { detectAuthenticationRequired } from './chunk-4JZT4QEE.js';
18
- export { detectAuthenticationRequired, exchangeMcpAuthorizationCode, initiateMcpOAuthFlow } from './chunk-4JZT4QEE.js';
17
+ import { detectAuthenticationRequired } from './chunk-KVVL5WLM.js';
18
+ export { detectAuthenticationRequired, exchangeMcpAuthorizationCode, initiateMcpOAuthFlow } from './chunk-KVVL5WLM.js';
19
19
  import { organization, member, invitation, user } from './chunk-GENLXHZ4.js';
20
20
  export { account, invitation, member, organization, session, ssoProvider, user, verification } from './chunk-GENLXHZ4.js';
21
21
  export { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from './chunk-7IQFIW44.js';
@@ -215689,6 +215689,16 @@ var discoverToolsFromServer = async (tool, dbClient, credentialStoreRegistry, us
215689
215689
  };
215690
215690
  }
215691
215691
  }
215692
+ if (serverConfig.url?.toString().includes("composio.dev")) {
215693
+ const urlObj = new URL(serverConfig.url.toString());
215694
+ if (tool.credentialScope === "user" && userId) {
215695
+ urlObj.searchParams.set("user_id", userId);
215696
+ } else {
215697
+ const SEPARATOR = "||";
215698
+ urlObj.searchParams.set("user_id", `${tool.tenantId}${SEPARATOR}${tool.projectId}`);
215699
+ }
215700
+ serverConfig.url = urlObj.toString();
215701
+ }
215692
215702
  const client = new McpClient({
215693
215703
  name: tool.name,
215694
215704
  server: serverConfig
@@ -215745,7 +215755,12 @@ var dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry, rela
215745
215755
  }
215746
215756
  const mcpServerUrl = dbResult.config.mcp.server.url;
215747
215757
  try {
215748
- availableTools = await discoverToolsFromServer(dbResult, dbClient, credentialStoreRegistry, userId);
215758
+ availableTools = await discoverToolsFromServer(
215759
+ dbResult,
215760
+ dbClient,
215761
+ credentialStoreRegistry,
215762
+ userId
215763
+ );
215749
215764
  status = "healthy";
215750
215765
  lastErrorComputed = null;
215751
215766
  } catch (error) {
@@ -215760,10 +215775,13 @@ var dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry, rela
215760
215775
  }
215761
215776
  const isThirdPartyMCPServer = dbResult.config.mcp.server.url.includes("composio.dev");
215762
215777
  if (isThirdPartyMCPServer) {
215778
+ const credentialScope = dbResult.credentialScope || "project";
215763
215779
  const isAuthenticated = await isThirdPartyMCPServerAuthenticated(
215764
215780
  dbResult.tenantId,
215765
215781
  dbResult.projectId,
215766
- mcpServerUrl
215782
+ mcpServerUrl,
215783
+ credentialScope,
215784
+ userId
215767
215785
  );
215768
215786
  if (!isAuthenticated) {
215769
215787
  status = "needs_auth";
@@ -219053,7 +219071,22 @@ var upsertLedgerArtifact = (db) => async (params) => {
219053
219071
  return { created: false, existing: existing[0] };
219054
219072
  }
219055
219073
  }
219056
- throw error;
219074
+ const sanitizedError = new Error(
219075
+ `Failed to insert artifact ${artifactRow.id}: ${error.message?.split("\nparams:")[0] || error.message}`
219076
+ );
219077
+ sanitizedError.name = error.name;
219078
+ sanitizedError.cause = error.code || error.errno;
219079
+ if (artifactRow.id?.includes("compress_")) {
219080
+ console.error("COMPRESSION ARTIFACT FULL ERROR:", {
219081
+ artifactId: artifactRow.id,
219082
+ errorMessage: error.message,
219083
+ errorCode: error.code,
219084
+ errorName: error.name,
219085
+ errorStack: error.stack,
219086
+ fullError: error
219087
+ });
219088
+ }
219089
+ throw sanitizedError;
219057
219090
  }
219058
219091
  };
219059
219092
  var addLedgerArtifacts = (db) => async (params) => {
@@ -219106,7 +219139,24 @@ var addLedgerArtifacts = (db) => async (params) => {
219106
219139
  await new Promise((resolve) => setTimeout(resolve, backoffMs));
219107
219140
  }
219108
219141
  }
219109
- throw lastError;
219142
+ const sanitizedError = new Error(
219143
+ `Failed to insert ${rows.length} artifacts after ${maxRetries} attempts: ${lastError?.message?.split("\nparams:")[0] || lastError?.message}`
219144
+ );
219145
+ sanitizedError.name = lastError?.name;
219146
+ sanitizedError.cause = lastError?.code || lastError?.errno;
219147
+ const hasCompressionArtifacts = rows.some((row) => row.id?.includes("compress_"));
219148
+ if (hasCompressionArtifacts) {
219149
+ console.error("COMPRESSION ARTIFACTS BULK INSERT FULL ERROR:", {
219150
+ artifactCount: rows.length,
219151
+ compressionArtifacts: rows.filter((row) => row.id?.includes("compress_")).map((row) => row.id),
219152
+ errorMessage: lastError?.message,
219153
+ errorCode: lastError?.code,
219154
+ errorName: lastError?.name,
219155
+ errorStack: lastError?.stack,
219156
+ fullError: lastError
219157
+ });
219158
+ }
219159
+ throw sanitizedError;
219110
219160
  };
219111
219161
  var getLedgerArtifacts = (db) => async (params) => {
219112
219162
  const { scopes, taskId, toolCallId, artifactId } = params;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-core",
3
- "version": "0.38.0",
3
+ "version": "0.38.1",
4
4
  "description": "Agents Core contains the database schema, types, and validation schemas for Inkeep Agent Framework, along with core components.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -132,7 +132,7 @@
132
132
  "vitest": "^3.2.4"
133
133
  },
134
134
  "engines": {
135
- "node": ">=22.0.0"
135
+ "node": ">=22.18.0"
136
136
  },
137
137
  "publishConfig": {
138
138
  "access": "public",