@inkeep/agents-core 0.35.3 → 0.35.5

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,22 +1,30 @@
1
- import { validateRender, validateAndTypeAgentData, validateAgentStructure } from './chunk-SPRTYWRV.js';
2
- 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-SPRTYWRV.js';
1
+ import { validateRender, validateAndTypeAgentData, validateAgentStructure } from './chunk-SH5TYTTP.js';
2
+ 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-SH5TYTTP.js';
3
+ 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-KMLLKRUY.js';
3
4
  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-TGESM3JG.js';
4
- import { schemaValidationDefaults, ContextConfigApiUpdateSchema, validatePropsAsJsonSchema } from './chunk-VBCCPAZK.js';
5
- 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, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolListResponse, McpToolResponse, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageListResponse, MessageResponse, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, OAuthCallbackQuerySchema, OAuthLoginQuerySchema, PaginationQueryParamsSchema, PaginationSchema, 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, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolListResponse, ToolResponse, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, canDelegateToExternalAgentSchema, canDelegateToTeamAgentSchema, resourceIdSchema, schemaValidationDefaults, validatePropsAsJsonSchema } from './chunk-VBCCPAZK.js';
6
- import { loadEnvironmentFiles, getTracer, getCredentialStoreLookupKeyFromRetrievalParams, env, generateId, normalizeDateString, createApiError, generateApiKey, extractPublicId, validateApiKey, isApiKeyExpired, getConversationId, setSpanWithError, getRequestExecutionContext, McpClient } from './chunk-ZYSTJ4XY.js';
7
- 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, cleanupTestDatabase, closeTestDatabase, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, createExecutionContext, createTestDatabaseClient, createTestOrganization, createTestProject, errorResponseSchema, errorSchemaFactory, executionLimitsSharedDefaults, extractPublicId, generateApiKey, generateId, generateServiceToken, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getRequestExecutionContext, getTracer, handleApiError, hashApiKey, isApiKeyExpired, loadEnvironmentFiles, maskApiKey, normalizeDateString, problemDetailsSchema, setSpanWithError, validateApiKey, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken } from './chunk-ZYSTJ4XY.js';
8
- import { getLogger, convertZodToJsonSchema } from './chunk-W3L4M7FO.js';
9
- export { PinoLogger, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, getLogger, isZodSchema, loggerFactory, preview } from './chunk-W3L4M7FO.js';
5
+ import { ContextConfigApiUpdateSchema, validatePropsAsJsonSchema } from './chunk-3AK7OSAT.js';
6
+ 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-3AK7OSAT.js';
7
+ export { schemaValidationDefaults } from './chunk-Z64UK4CA.js';
8
+ import { getTracer, getCredentialStoreLookupKeyFromRetrievalParams, generateId, normalizeDateString, isThirdPartyMCPServerAuthenticated, createApiError, generateApiKey, extractPublicId, validateApiKey, isApiKeyExpired, getConversationId, setSpanWithError, getRequestExecutionContext, McpClient } from './chunk-D3NGJEP2.js';
9
+ 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, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, createExecutionContext, errorResponseSchema, errorSchemaFactory, executionLimitsSharedDefaults, extractComposioServerId, extractPublicId, fetchComposioServers, fetchSingleComposioServer, generateApiKey, generateId, generateServiceToken, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getRequestExecutionContext, getTracer, handleApiError, hashApiKey, isApiKeyExpired, isComposioMCPServerAuthenticated, isThirdPartyMCPServerAuthenticated, maskApiKey, normalizeDateString, problemDetailsSchema, setSpanWithError, validateApiKey, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken } from './chunk-D3NGJEP2.js';
10
+ export { cleanupTestDatabase, closeTestDatabase, createTestDatabaseClient, createTestOrganization, createTestProject } from './chunk-SG75RA63.js';
11
+ import { convertZodToJsonSchema } from './chunk-7GZHUB4J.js';
12
+ export { convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, isZodSchema, preview } from './chunk-7GZHUB4J.js';
13
+ import { loadEnvironmentFiles, env } from './chunk-4RVJB4KV.js';
14
+ export { loadEnvironmentFiles } from './chunk-4RVJB4KV.js';
10
15
  import { detectAuthenticationRequired } from './chunk-4JZT4QEE.js';
11
16
  export { detectAuthenticationRequired, exchangeMcpAuthorizationCode, initiateMcpOAuthFlow } from './chunk-4JZT4QEE.js';
12
- export { TaskState } from './chunk-H2F72PDA.js';
13
- import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-YFHT5M2R.js';
14
- export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-YFHT5M2R.js';
15
- export { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from './chunk-7CLFCY6J.js';
16
17
  import { schema_exports, contextConfigs, externalAgents, functions, functionTools, subAgentFunctionToolRelations, subAgentExternalAgentRelations, subAgents, subAgentRelations, subAgentToolRelations, tools, subAgentTeamAgentRelations, agents, credentialReferences, subAgentDataComponents, subAgentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, ledgerArtifacts, tasks, taskRelations } from './chunk-NFYCSHD3.js';
17
18
  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-NFYCSHD3.js';
18
19
  import { organization, member, invitation, user } from './chunk-NOPEANIU.js';
19
20
  export { account, invitation, member, organization, session, ssoProvider, user, verification } from './chunk-NOPEANIU.js';
21
+ export { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from './chunk-7CLFCY6J.js';
22
+ export { CredentialStoreRegistry, InMemoryCredentialStore, KeyChainStore, NangoCredentialStore, createDefaultCredentialStores, createKeyChainStore, createNangoCredentialStore } from './chunk-FOK3JSQN.js';
23
+ import { getLogger } from './chunk-DN4B564Y.js';
24
+ export { PinoLogger, getLogger, loggerFactory } from './chunk-DN4B564Y.js';
25
+ export { TaskState } from './chunk-H2F72PDA.js';
26
+ import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-YFHT5M2R.js';
27
+ export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-YFHT5M2R.js';
20
28
  import { __commonJS, __require } from './chunk-SIAA4J6H.js';
21
29
  import { z } from 'zod';
22
30
  import jmespath from 'jmespath';
@@ -27,7 +35,6 @@ import { nanoid } from 'nanoid';
27
35
  import Ajv from 'ajv';
28
36
  import crypto from 'crypto';
29
37
  import { SpanStatusCode } from '@opentelemetry/api';
30
- import { Nango } from '@nangohq/node';
31
38
 
32
39
  // ../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/base64.js
33
40
  var require_base64 = __commonJS({
@@ -10197,8 +10204,8 @@ ${lanes.join("\n")}
10197
10204
  function sysLog(s) {
10198
10205
  return curSysLog(s);
10199
10206
  }
10200
- function setSysLog(logger11) {
10201
- curSysLog = logger11;
10207
+ function setSysLog(logger10) {
10208
+ curSysLog = logger10;
10202
10209
  }
10203
10210
  function createDirectoryWatcherSupportingRecursive({
10204
10211
  watchDirectory,
@@ -200588,13 +200595,13 @@ ${options.prefix}` : "\n" : options.prefix
200588
200595
  return [];
200589
200596
  }
200590
200597
  var ThrottledOperations = class _ThrottledOperations {
200591
- constructor(host, logger11) {
200598
+ constructor(host, logger10) {
200592
200599
  this.host = host;
200593
200600
  this.pendingTimeouts = /* @__PURE__ */ new Map();
200594
- this.logger = logger11.hasLevel(
200601
+ this.logger = logger10.hasLevel(
200595
200602
  3
200596
200603
  /* verbose */
200597
- ) ? logger11 : void 0;
200604
+ ) ? logger10 : void 0;
200598
200605
  }
200599
200606
  /**
200600
200607
  * Wait `number` milliseconds and then invoke `cb`. If, while waiting, schedule
@@ -200627,10 +200634,10 @@ ${options.prefix}` : "\n" : options.prefix
200627
200634
  }
200628
200635
  };
200629
200636
  var GcTimer = class _GcTimer {
200630
- constructor(host, delay, logger11) {
200637
+ constructor(host, delay, logger10) {
200631
200638
  this.host = host;
200632
200639
  this.delay = delay;
200633
- this.logger = logger11;
200640
+ this.logger = logger10;
200634
200641
  }
200635
200642
  scheduleCollect() {
200636
200643
  if (!this.host.gc || this.timerId !== void 0) {
@@ -207990,14 +207997,14 @@ Dynamic files must always be opened with service's current directory or service
207990
207997
  return edits.every((edit) => textSpanEnd(edit.span) < pos);
207991
207998
  }
207992
207999
  var CommandNames = CommandTypes;
207993
- function formatMessage2(msg, logger11, byteLength, newLine) {
207994
- const verboseLogging = logger11.hasLevel(
208000
+ function formatMessage2(msg, logger10, byteLength, newLine) {
208001
+ const verboseLogging = logger10.hasLevel(
207995
208002
  3
207996
208003
  /* verbose */
207997
208004
  );
207998
208005
  const json = JSON.stringify(msg);
207999
208006
  if (verboseLogging) {
208000
- logger11.info(`${msg.type}:${stringifyIndented(msg)}`);
208007
+ logger10.info(`${msg.type}:${stringifyIndented(msg)}`);
208001
208008
  }
208002
208009
  const len = byteLength(json, "utf8");
208003
208010
  return `Content-Length: ${1 + len}\r
@@ -208152,7 +208159,7 @@ ${json}${newLine}`;
208152
208159
  const info = infos && firstOrUndefined(infos);
208153
208160
  return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : void 0;
208154
208161
  }
208155
- function getReferencesWorker(projects2, defaultProject, initialLocation, useCaseSensitiveFileNames2, logger11) {
208162
+ function getReferencesWorker(projects2, defaultProject, initialLocation, useCaseSensitiveFileNames2, logger10) {
208156
208163
  var _a, _b;
208157
208164
  const perProjectResults = getPerProjectReferences(
208158
208165
  projects2,
@@ -208166,7 +208173,7 @@ ${json}${newLine}`;
208166
208173
  ),
208167
208174
  mapDefinitionInProject,
208168
208175
  (project, position) => {
208169
- logger11.info(`Finding references to ${position.fileName} position ${position.pos} in project ${project.getProjectName()}`);
208176
+ logger10.info(`Finding references to ${position.fileName} position ${position.pos} in project ${project.getProjectName()}`);
208170
208177
  return project.getLanguageService().findReferences(position.fileName, position.pos);
208171
208178
  },
208172
208179
  (referencedSymbol, cb) => {
@@ -212542,9 +212549,9 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
212542
212549
  }
212543
212550
  };
212544
212551
  var _TypingsInstallerAdapter = class _TypingsInstallerAdapter2 {
212545
- constructor(telemetryEnabled, logger11, host, globalTypingsCacheLocation, event, maxActiveRequestCount) {
212552
+ constructor(telemetryEnabled, logger10, host, globalTypingsCacheLocation, event, maxActiveRequestCount) {
212546
212553
  this.telemetryEnabled = telemetryEnabled;
212547
- this.logger = logger11;
212554
+ this.logger = logger10;
212548
212555
  this.host = host;
212549
212556
  this.globalTypingsCacheLocation = globalTypingsCacheLocation;
212550
212557
  this.event = event;
@@ -212863,38 +212870,6 @@ async function apiFetch(url, options = {}) {
212863
212870
  headers: headers2
212864
212871
  });
212865
212872
  }
212866
- loadEnvironmentFiles();
212867
- var constantsSchema = z.object(
212868
- Object.fromEntries(
212869
- Object.keys(schemaValidationDefaults).map((key) => [
212870
- `AGENTS_${key}`,
212871
- z.coerce.number().optional()
212872
- ])
212873
- )
212874
- );
212875
- var parseConstants = () => {
212876
- const envOverrides = constantsSchema.parse(process.env);
212877
- return Object.fromEntries(
212878
- Object.entries(schemaValidationDefaults).map(([key, defaultValue]) => [
212879
- key,
212880
- envOverrides[`AGENTS_${key}`] ?? defaultValue
212881
- ])
212882
- );
212883
- };
212884
- var constants = parseConstants();
212885
- var {
212886
- AGENT_EXECUTION_TRANSFER_COUNT_MIN,
212887
- AGENT_EXECUTION_TRANSFER_COUNT_MAX,
212888
- AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT,
212889
- SUB_AGENT_TURN_GENERATION_STEPS_MIN,
212890
- SUB_AGENT_TURN_GENERATION_STEPS_MAX,
212891
- SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT,
212892
- STATUS_UPDATE_MAX_NUM_EVENTS,
212893
- STATUS_UPDATE_MAX_INTERVAL_SECONDS,
212894
- VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS,
212895
- VALIDATION_AGENT_PROMPT_MAX_CHARS,
212896
- CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT
212897
- } = constants;
212898
212873
  var logger = getLogger("context-config");
212899
212874
  var HeadersSchemaBuilder = class {
212900
212875
  schema;
@@ -213411,10 +213386,10 @@ var TemplateEngine = class _TemplateEngine {
213411
213386
 
213412
213387
  // src/credential-stuffer/CredentialStuffer.ts
213413
213388
  var CredentialStuffer = class {
213414
- constructor(credentialStoreRegistry, contextResolver, logger11) {
213389
+ constructor(credentialStoreRegistry, contextResolver, logger10) {
213415
213390
  this.credentialStoreRegistry = credentialStoreRegistry;
213416
213391
  this.contextResolver = contextResolver;
213417
- this.logger = logger11 || getLogger("credential-stuffer");
213392
+ this.logger = logger10 || getLogger("credential-stuffer");
213418
213393
  }
213419
213394
  logger;
213420
213395
  /**
@@ -215726,13 +215701,14 @@ var dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry, rela
215726
215701
  }
215727
215702
  }
215728
215703
  }
215704
+ const mcpServerUrl = dbResult.config.mcp.server.url;
215729
215705
  try {
215730
215706
  availableTools = await discoverToolsFromServer(dbResult, dbClient, credentialStoreRegistry);
215731
215707
  status = "healthy";
215732
215708
  lastErrorComputed = null;
215733
215709
  } catch (error) {
215734
215710
  const toolNeedsAuth = error instanceof Error && await detectAuthenticationRequired({
215735
- serverUrl: dbResult.config.mcp.server.url,
215711
+ serverUrl: mcpServerUrl,
215736
215712
  error,
215737
215713
  logger: logger4
215738
215714
  });
@@ -215740,6 +215716,18 @@ var dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry, rela
215740
215716
  const errorMessage = error instanceof Error ? error.message : "Tool discovery failed";
215741
215717
  lastErrorComputed = toolNeedsAuth ? `Authentication required - OAuth login needed. ${errorMessage}` : errorMessage;
215742
215718
  }
215719
+ const isThirdPartyMCPServer = dbResult.config.mcp.server.url.includes("composio.dev");
215720
+ if (isThirdPartyMCPServer) {
215721
+ const isAuthenticated = await isThirdPartyMCPServerAuthenticated(
215722
+ dbResult.tenantId,
215723
+ dbResult.projectId,
215724
+ mcpServerUrl
215725
+ );
215726
+ if (!isAuthenticated) {
215727
+ status = "needs_auth";
215728
+ lastErrorComputed = "Third-party authentication required. Try authenticating again.";
215729
+ }
215730
+ }
215743
215731
  const now = (/* @__PURE__ */ new Date()).toISOString();
215744
215732
  await updateTool(dbClient)({
215745
215733
  scopes: { tenantId: dbResult.tenantId, projectId: dbResult.projectId },
@@ -216965,18 +216953,18 @@ var defaultLogger = {
216965
216953
  error: () => {
216966
216954
  }
216967
216955
  };
216968
- async function applyExecutionLimitsInheritance(db, logger11, scopes, agentData) {
216956
+ async function applyExecutionLimitsInheritance(db, logger10, scopes, agentData) {
216969
216957
  const { tenantId, projectId } = scopes;
216970
216958
  try {
216971
216959
  const project = await db.query.projects.findFirst({
216972
216960
  where: and(eq(projects.tenantId, tenantId), eq(projects.id, projectId))
216973
216961
  });
216974
216962
  if (!project?.stopWhen) {
216975
- logger11.info({ projectId }, "No project stopWhen configuration found");
216963
+ logger10.info({ projectId }, "No project stopWhen configuration found");
216976
216964
  return;
216977
216965
  }
216978
216966
  const projectStopWhen = project.stopWhen;
216979
- logger11.info(
216967
+ logger10.info(
216980
216968
  {
216981
216969
  projectId,
216982
216970
  projectStopWhen
@@ -216988,7 +216976,7 @@ async function applyExecutionLimitsInheritance(db, logger11, scopes, agentData)
216988
216976
  }
216989
216977
  if (agentData.stopWhen.transferCountIs === void 0 && projectStopWhen?.transferCountIs !== void 0) {
216990
216978
  agentData.stopWhen.transferCountIs = projectStopWhen.transferCountIs;
216991
- logger11.info(
216979
+ logger10.info(
216992
216980
  {
216993
216981
  agentId: agentData.id,
216994
216982
  inheritedValue: projectStopWhen.transferCountIs
@@ -216998,7 +216986,7 @@ async function applyExecutionLimitsInheritance(db, logger11, scopes, agentData)
216998
216986
  }
216999
216987
  if (agentData.stopWhen.transferCountIs === void 0) {
217000
216988
  agentData.stopWhen.transferCountIs = 10;
217001
- logger11.info(
216989
+ logger10.info(
217002
216990
  {
217003
216991
  agentId: agentData.id,
217004
216992
  defaultValue: 10
@@ -217007,7 +216995,7 @@ async function applyExecutionLimitsInheritance(db, logger11, scopes, agentData)
217007
216995
  );
217008
216996
  }
217009
216997
  if (projectStopWhen?.stepCountIs !== void 0) {
217010
- logger11.info(
216998
+ logger10.info(
217011
216999
  {
217012
217000
  projectId,
217013
217001
  stepCountIs: projectStopWhen.stepCountIs
@@ -217022,7 +217010,7 @@ async function applyExecutionLimitsInheritance(db, logger11, scopes, agentData)
217022
217010
  }
217023
217011
  if (agent.stopWhen.stepCountIs === void 0) {
217024
217012
  agent.stopWhen.stepCountIs = projectStopWhen.stepCountIs;
217025
- logger11.info(
217013
+ logger10.info(
217026
217014
  {
217027
217015
  subAgentId,
217028
217016
  inheritedValue: projectStopWhen.stepCountIs
@@ -217034,7 +217022,7 @@ async function applyExecutionLimitsInheritance(db, logger11, scopes, agentData)
217034
217022
  }
217035
217023
  }
217036
217024
  } catch (error) {
217037
- logger11.error(
217025
+ logger10.error(
217038
217026
  {
217039
217027
  projectId,
217040
217028
  error: error instanceof Error ? error.message : "Unknown error"
@@ -217043,21 +217031,21 @@ async function applyExecutionLimitsInheritance(db, logger11, scopes, agentData)
217043
217031
  );
217044
217032
  }
217045
217033
  }
217046
- var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes, agentData) => {
217034
+ var createFullAgentServerSide = (db, logger10 = defaultLogger) => async (scopes, agentData) => {
217047
217035
  const { tenantId, projectId } = scopes;
217048
217036
  const typed = validateAndTypeAgentData(agentData);
217049
217037
  validateAgentStructure(typed);
217050
- await applyExecutionLimitsInheritance(db, logger11, { tenantId, projectId }, typed);
217038
+ await applyExecutionLimitsInheritance(db, logger10, { tenantId, projectId }, typed);
217051
217039
  try {
217052
- logger11.info(
217040
+ logger10.info(
217053
217041
  {},
217054
217042
  "CredentialReferences are project-scoped - skipping credential reference creation in agent"
217055
217043
  );
217056
- logger11.info({}, "MCP Tools are project-scoped - skipping tool creation in agent");
217044
+ logger10.info({}, "MCP Tools are project-scoped - skipping tool creation in agent");
217057
217045
  let finalAgentId;
217058
217046
  try {
217059
217047
  const agentId = typed.id || generateId();
217060
- logger11.info({ agentId }, "Creating agent metadata");
217048
+ logger10.info({ agentId }, "Creating agent metadata");
217061
217049
  const agent = await upsertAgent(db)({
217062
217050
  data: {
217063
217051
  id: agentId,
@@ -217078,15 +217066,15 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217078
217066
  throw new Error("Failed to create agent: no ID returned");
217079
217067
  }
217080
217068
  finalAgentId = agent.id;
217081
- logger11.info({ agentId: finalAgentId }, "Agent metadata created successfully");
217069
+ logger10.info({ agentId: finalAgentId }, "Agent metadata created successfully");
217082
217070
  } catch (error) {
217083
- logger11.error({ agentId: typed.id, error }, "Failed to create/update agent metadata");
217071
+ logger10.error({ agentId: typed.id, error }, "Failed to create/update agent metadata");
217084
217072
  throw error;
217085
217073
  }
217086
217074
  let contextConfigId;
217087
217075
  if (typed.contextConfig) {
217088
217076
  try {
217089
- logger11.info({ contextConfigId: typed.contextConfig.id }, "Processing context config");
217077
+ logger10.info({ contextConfigId: typed.contextConfig.id }, "Processing context config");
217090
217078
  const contextConfig2 = await upsertContextConfig(db)({
217091
217079
  data: {
217092
217080
  ...typed.contextConfig,
@@ -217096,9 +217084,9 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217096
217084
  }
217097
217085
  });
217098
217086
  contextConfigId = contextConfig2.id;
217099
- logger11.info({ contextConfigId }, "Context config processed successfully");
217087
+ logger10.info({ contextConfigId }, "Context config processed successfully");
217100
217088
  } catch (error) {
217101
- logger11.error(
217089
+ logger10.error(
217102
217090
  { contextConfigId: typed.contextConfig.id, error },
217103
217091
  "Failed to create/update context config"
217104
217092
  );
@@ -217107,7 +217095,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217107
217095
  }
217108
217096
  if (contextConfigId) {
217109
217097
  try {
217110
- logger11.info(
217098
+ logger10.info(
217111
217099
  { agentId: finalAgentId, contextConfigId },
217112
217100
  "Updating agent with contextConfigId"
217113
217101
  );
@@ -217126,28 +217114,28 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217126
217114
  stopWhen: typed.stopWhen
217127
217115
  }
217128
217116
  });
217129
- logger11.info(
217117
+ logger10.info(
217130
217118
  { agentId: finalAgentId, contextConfigId },
217131
217119
  "Agent updated with contextConfigId successfully"
217132
217120
  );
217133
217121
  } catch (error) {
217134
- logger11.error(
217122
+ logger10.error(
217135
217123
  { agentId: finalAgentId, contextConfigId, error },
217136
217124
  "Failed to update agent with contextConfigId"
217137
217125
  );
217138
217126
  throw error;
217139
217127
  }
217140
217128
  }
217141
- logger11.info(
217129
+ logger10.info(
217142
217130
  {},
217143
217131
  "DataComponents are project-scoped - skipping dataComponent creation in agent"
217144
217132
  );
217145
- logger11.info(
217133
+ logger10.info(
217146
217134
  {},
217147
217135
  "ArtifactComponents are project-scoped - skipping artifactComponent creation in agent"
217148
217136
  );
217149
217137
  if (typed.functions && Object.keys(typed.functions).length > 0) {
217150
- logger11.info(
217138
+ logger10.info(
217151
217139
  {
217152
217140
  agentId: finalAgentId,
217153
217141
  functionCount: Object.keys(typed.functions).length
@@ -217157,7 +217145,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217157
217145
  const functionPromises = Object.entries(typed.functions).map(
217158
217146
  async ([functionId, functionData]) => {
217159
217147
  try {
217160
- logger11.info({ agentId: finalAgentId, functionId }, "Creating function for agent");
217148
+ logger10.info({ agentId: finalAgentId, functionId }, "Creating function for agent");
217161
217149
  await upsertFunction(db)({
217162
217150
  data: {
217163
217151
  ...functionData,
@@ -217165,9 +217153,9 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217165
217153
  },
217166
217154
  scopes: { tenantId, projectId }
217167
217155
  });
217168
- logger11.info({ agentId: finalAgentId, functionId }, "Function created successfully");
217156
+ logger10.info({ agentId: finalAgentId, functionId }, "Function created successfully");
217169
217157
  } catch (error) {
217170
- logger11.error(
217158
+ logger10.error(
217171
217159
  { agentId: finalAgentId, functionId, error },
217172
217160
  "Failed to create function for agent"
217173
217161
  );
@@ -217176,7 +217164,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217176
217164
  }
217177
217165
  );
217178
217166
  await Promise.all(functionPromises);
217179
- logger11.info(
217167
+ logger10.info(
217180
217168
  {
217181
217169
  agentId: finalAgentId,
217182
217170
  functionCount: Object.keys(typed.functions).length
@@ -217185,7 +217173,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217185
217173
  );
217186
217174
  }
217187
217175
  if (typed.functionTools && Object.keys(typed.functionTools).length > 0) {
217188
- logger11.info(
217176
+ logger10.info(
217189
217177
  {
217190
217178
  agentId: finalAgentId,
217191
217179
  functionToolCount: Object.keys(typed.functionTools).length
@@ -217195,7 +217183,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217195
217183
  const functionToolPromises = Object.entries(typed.functionTools).map(
217196
217184
  async ([functionToolId, functionToolData]) => {
217197
217185
  try {
217198
- logger11.info(
217186
+ logger10.info(
217199
217187
  { agentId: finalAgentId, functionToolId },
217200
217188
  "Creating function tool in agent"
217201
217189
  );
@@ -217206,12 +217194,12 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217206
217194
  },
217207
217195
  scopes: { tenantId, projectId, agentId: finalAgentId }
217208
217196
  });
217209
- logger11.info(
217197
+ logger10.info(
217210
217198
  { agentId: finalAgentId, functionToolId },
217211
217199
  "Function tool created successfully"
217212
217200
  );
217213
217201
  } catch (error) {
217214
- logger11.error(
217202
+ logger10.error(
217215
217203
  { agentId: finalAgentId, functionToolId, error },
217216
217204
  "Failed to create function tool in agent"
217217
217205
  );
@@ -217220,7 +217208,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217220
217208
  }
217221
217209
  );
217222
217210
  await Promise.all(functionToolPromises);
217223
- logger11.info(
217211
+ logger10.info(
217224
217212
  {
217225
217213
  agentId: finalAgentId,
217226
217214
  functionToolCount: Object.keys(typed.functionTools).length
@@ -217232,7 +217220,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217232
217220
  async ([subAgentId, agentData2]) => {
217233
217221
  const subAgent = agentData2;
217234
217222
  try {
217235
- logger11.info({ subAgentId }, "Processing sub-agent");
217223
+ logger10.info({ subAgentId }, "Processing sub-agent");
217236
217224
  await upsertSubAgent(db)({
217237
217225
  data: {
217238
217226
  id: subAgentId,
@@ -217247,17 +217235,17 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217247
217235
  stopWhen: subAgent.stopWhen
217248
217236
  }
217249
217237
  });
217250
- logger11.info({ subAgentId }, "Sub-agent processed successfully");
217238
+ logger10.info({ subAgentId }, "Sub-agent processed successfully");
217251
217239
  } catch (error) {
217252
- logger11.error({ subAgentId, error }, "Failed to create/update sub-agent");
217240
+ logger10.error({ subAgentId, error }, "Failed to create/update sub-agent");
217253
217241
  throw error;
217254
217242
  }
217255
217243
  }
217256
217244
  );
217257
217245
  await Promise.all(subAgentPromises);
217258
217246
  const subAgentCount = Object.entries(typed.subAgents).length;
217259
- logger11.info({ subAgentCount }, "All sub-agents created/updated successfully");
217260
- logger11.info({}, "External agents are project-scoped and managed at the project level.");
217247
+ logger10.info({ subAgentCount }, "All sub-agents created/updated successfully");
217248
+ logger10.info({}, "External agents are project-scoped and managed at the project level.");
217261
217249
  const agentToolPromises = [];
217262
217250
  for (const [subAgentId, agentData2] of Object.entries(typed.subAgents)) {
217263
217251
  if (agentData2.canUse && Array.isArray(agentData2.canUse)) {
@@ -217267,7 +217255,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217267
217255
  try {
217268
217256
  const { toolId, toolSelection, headers: headers2, agentToolRelationId } = canUseItem;
217269
217257
  const isFunctionTool = typed.functionTools && toolId in typed.functionTools;
217270
- logger11.info(
217258
+ logger10.info(
217271
217259
  {
217272
217260
  subAgentId,
217273
217261
  toolId,
@@ -217278,19 +217266,19 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217278
217266
  "Processing canUse item"
217279
217267
  );
217280
217268
  if (isFunctionTool) {
217281
- logger11.info({ subAgentId, toolId }, "Processing agent-function tool relation");
217269
+ logger10.info({ subAgentId, toolId }, "Processing agent-function tool relation");
217282
217270
  await upsertSubAgentFunctionToolRelation(db)({
217283
217271
  scopes: { tenantId, projectId, agentId: finalAgentId },
217284
217272
  subAgentId,
217285
217273
  functionToolId: toolId,
217286
217274
  relationId: agentToolRelationId
217287
217275
  });
217288
- logger11.info(
217276
+ logger10.info(
217289
217277
  { subAgentId, toolId },
217290
217278
  "Agent-function tool relation processed successfully"
217291
217279
  );
217292
217280
  } else {
217293
- logger11.info({ subAgentId, toolId }, "Processing agent-MCP tool relation");
217281
+ logger10.info({ subAgentId, toolId }, "Processing agent-MCP tool relation");
217294
217282
  await upsertSubAgentToolRelation(db)({
217295
217283
  scopes: { tenantId, projectId, agentId: finalAgentId },
217296
217284
  subAgentId,
@@ -217299,13 +217287,13 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217299
217287
  headers: headers2 || void 0,
217300
217288
  relationId: agentToolRelationId
217301
217289
  });
217302
- logger11.info(
217290
+ logger10.info(
217303
217291
  { subAgentId, toolId },
217304
217292
  "Agent-MCP tool relation processed successfully"
217305
217293
  );
217306
217294
  }
217307
217295
  } catch (error) {
217308
- logger11.error(
217296
+ logger10.error(
217309
217297
  { subAgentId, toolId: canUseItem.toolId, error },
217310
217298
  "Failed to create agent-tool relation"
217311
217299
  );
@@ -217316,7 +217304,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217316
217304
  }
217317
217305
  }
217318
217306
  await Promise.all(agentToolPromises);
217319
- logger11.info(
217307
+ logger10.info(
217320
217308
  { agentToolCount: Object.keys(typed.subAgents).length },
217321
217309
  "All agent-tool relations created"
217322
217310
  );
@@ -217327,7 +217315,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217327
217315
  agentDataComponentPromises.push(
217328
217316
  (async () => {
217329
217317
  try {
217330
- logger11.info(
217318
+ logger10.info(
217331
217319
  { subAgentId, dataComponentId },
217332
217320
  "Processing agent-data component relation"
217333
217321
  );
@@ -217335,12 +217323,12 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217335
217323
  scopes: { tenantId, projectId, agentId: finalAgentId, subAgentId },
217336
217324
  dataComponentId
217337
217325
  });
217338
- logger11.info(
217326
+ logger10.info(
217339
217327
  { subAgentId, dataComponentId },
217340
217328
  "Agent-data component relation processed successfully"
217341
217329
  );
217342
217330
  } catch (error) {
217343
- logger11.error(
217331
+ logger10.error(
217344
217332
  { subAgentId, dataComponentId, error },
217345
217333
  "Failed to create agent-data component relation"
217346
217334
  );
@@ -217351,7 +217339,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217351
217339
  }
217352
217340
  }
217353
217341
  await Promise.all(agentDataComponentPromises);
217354
- logger11.info({}, "All agent-data component relations created");
217342
+ logger10.info({}, "All agent-data component relations created");
217355
217343
  const agentArtifactComponentPromises = [];
217356
217344
  for (const [subAgentId, agentData2] of Object.entries(typed.subAgents)) {
217357
217345
  if (agentData2.artifactComponents) {
@@ -217359,7 +217347,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217359
217347
  agentArtifactComponentPromises.push(
217360
217348
  (async () => {
217361
217349
  try {
217362
- logger11.info(
217350
+ logger10.info(
217363
217351
  { subAgentId, artifactComponentId },
217364
217352
  "Processing agent-artifact component relation"
217365
217353
  );
@@ -217367,12 +217355,12 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217367
217355
  scopes: { tenantId, projectId, agentId: finalAgentId, subAgentId },
217368
217356
  artifactComponentId
217369
217357
  });
217370
- logger11.info(
217358
+ logger10.info(
217371
217359
  { subAgentId, artifactComponentId },
217372
217360
  "Agent-artifact component relation processed successfully"
217373
217361
  );
217374
217362
  } catch (error) {
217375
- logger11.error(
217363
+ logger10.error(
217376
217364
  { subAgentId, artifactComponentId, error },
217377
217365
  "Failed to create agent-artifact component relation"
217378
217366
  );
@@ -217383,7 +217371,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217383
217371
  }
217384
217372
  }
217385
217373
  await Promise.all(agentArtifactComponentPromises);
217386
- logger11.info({}, "All agent-artifact component relations created");
217374
+ logger10.info({}, "All agent-artifact component relations created");
217387
217375
  const subAgentRelationPromises = [];
217388
217376
  const subAgentExternalAgentRelationPromises = [];
217389
217377
  const subAgentTeamAgentRelationPromises = [];
@@ -217393,7 +217381,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217393
217381
  subAgentRelationPromises.push(
217394
217382
  (async () => {
217395
217383
  try {
217396
- logger11.info(
217384
+ logger10.info(
217397
217385
  { subAgentId, targetSubAgentId, type: "transfer" },
217398
217386
  "Processing agent transfer relation"
217399
217387
  );
@@ -217406,12 +217394,12 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217406
217394
  targetSubAgentId,
217407
217395
  relationType: "transfer"
217408
217396
  });
217409
- logger11.info(
217397
+ logger10.info(
217410
217398
  { subAgentId, targetSubAgentId, type: "transfer" },
217411
217399
  "Agent transfer relation processed successfully"
217412
217400
  );
217413
217401
  } catch (error) {
217414
- logger11.error(
217402
+ logger10.error(
217415
217403
  { subAgentId, targetSubAgentId, type: "transfer", error },
217416
217404
  "Failed to create transfer relation"
217417
217405
  );
@@ -217425,7 +217413,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217425
217413
  subAgentRelationPromises.push(
217426
217414
  (async () => {
217427
217415
  try {
217428
- logger11.info(
217416
+ logger10.info(
217429
217417
  { subAgentId, targetSubAgentId: targetItem, type: "delegate" },
217430
217418
  "Processing sub-agent delegation relation"
217431
217419
  );
@@ -217438,12 +217426,12 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217438
217426
  targetSubAgentId: targetItem,
217439
217427
  relationType: "delegate"
217440
217428
  });
217441
- logger11.info(
217429
+ logger10.info(
217442
217430
  { subAgentId, targetSubAgentId: targetItem, type: "delegate" },
217443
217431
  "Sub-agent delegation relation processed successfully"
217444
217432
  );
217445
217433
  } catch (error) {
217446
- logger11.error(
217434
+ logger10.error(
217447
217435
  { subAgentId, targetSubAgentId: targetItem, type: "delegate", error },
217448
217436
  "Failed to create sub-agent delegation relation"
217449
217437
  );
@@ -217467,7 +217455,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217467
217455
  headers: targetItem.headers || null
217468
217456
  }
217469
217457
  });
217470
- logger11.info(
217458
+ logger10.info(
217471
217459
  {
217472
217460
  subAgentId,
217473
217461
  externalAgentId: targetItem.externalAgentId
@@ -217475,7 +217463,7 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217475
217463
  "External agent delegation relation processed successfully"
217476
217464
  );
217477
217465
  } catch (error) {
217478
- logger11.error(
217466
+ logger10.error(
217479
217467
  {
217480
217468
  subAgentId,
217481
217469
  externalAgentId: targetItem.externalAgentId,
@@ -217503,12 +217491,12 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217503
217491
  headers: targetItem.headers || null
217504
217492
  }
217505
217493
  });
217506
- logger11.info(
217494
+ logger10.info(
217507
217495
  { subAgentId, agentId: targetItem.agentId },
217508
217496
  "Team agent delegation relation processed successfully"
217509
217497
  );
217510
217498
  } catch (error) {
217511
- logger11.error(
217499
+ logger10.error(
217512
217500
  { subAgentId, agentId: targetItem.agentId, error },
217513
217501
  "Failed to create team agent delegation relation"
217514
217502
  );
@@ -217523,15 +217511,15 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217523
217511
  await Promise.all(subAgentRelationPromises);
217524
217512
  await Promise.all(subAgentExternalAgentRelationPromises);
217525
217513
  await Promise.all(subAgentTeamAgentRelationPromises);
217526
- logger11.info(
217514
+ logger10.info(
217527
217515
  { subAgentRelationCount: subAgentRelationPromises.length },
217528
217516
  "All sub-agent relations created"
217529
217517
  );
217530
- logger11.info(
217518
+ logger10.info(
217531
217519
  { subAgentExternalAgentRelationCount: subAgentExternalAgentRelationPromises.length },
217532
217520
  "All sub-agent external agent relations created"
217533
217521
  );
217534
- logger11.info(
217522
+ logger10.info(
217535
217523
  { subAgentTeamAgentRelationCount: subAgentTeamAgentRelationPromises.length },
217536
217524
  "All sub-agent team agent relations created"
217537
217525
  );
@@ -217541,21 +217529,21 @@ var createFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217541
217529
  if (!createdAgent) {
217542
217530
  throw new Error("Failed to retrieve created agent");
217543
217531
  }
217544
- logger11.info({ tenantId, agentId: finalAgentId }, "Full agent created successfully");
217532
+ logger10.info({ tenantId, agentId: finalAgentId }, "Full agent created successfully");
217545
217533
  return createdAgent;
217546
217534
  } catch (error) {
217547
217535
  const errorAgentId = typed.id || "unknown";
217548
- logger11.error({ tenantId, agentId: errorAgentId, error }, "Failed to create full agent");
217536
+ logger10.error({ tenantId, agentId: errorAgentId, error }, "Failed to create full agent");
217549
217537
  throw error;
217550
217538
  }
217551
217539
  };
217552
- var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes, agentData) => {
217540
+ var updateFullAgentServerSide = (db, logger10 = defaultLogger) => async (scopes, agentData) => {
217553
217541
  const { tenantId, projectId } = scopes;
217554
217542
  const typedAgentDefinition = validateAndTypeAgentData(agentData);
217555
217543
  if (!typedAgentDefinition.id) {
217556
217544
  throw new Error("Agent ID is required");
217557
217545
  }
217558
- logger11.info(
217546
+ logger10.info(
217559
217547
  {
217560
217548
  tenantId,
217561
217549
  agentId: typedAgentDefinition.id,
@@ -217566,7 +217554,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217566
217554
  validateAgentStructure(typedAgentDefinition);
217567
217555
  await applyExecutionLimitsInheritance(
217568
217556
  db,
217569
- logger11,
217557
+ logger10,
217570
217558
  { tenantId, projectId },
217571
217559
  typedAgentDefinition
217572
217560
  );
@@ -217575,22 +217563,22 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217575
217563
  scopes: { tenantId, projectId, agentId: typedAgentDefinition.id }
217576
217564
  });
217577
217565
  if (!existingAgent) {
217578
- logger11.info(
217566
+ logger10.info(
217579
217567
  { agentId: typedAgentDefinition.id },
217580
217568
  "Agent does not exist, creating new agent"
217581
217569
  );
217582
- return createFullAgentServerSide(db, logger11)(scopes, agentData);
217570
+ return createFullAgentServerSide(db, logger10)(scopes, agentData);
217583
217571
  }
217584
217572
  const existingAgentModels = existingAgent.models;
217585
- logger11.info(
217573
+ logger10.info(
217586
217574
  {},
217587
217575
  "CredentialReferences are project-scoped - skipping credential reference update in agent"
217588
217576
  );
217589
- logger11.info({}, "MCP Tools are project-scoped - skipping tool creation in agent update");
217577
+ logger10.info({}, "MCP Tools are project-scoped - skipping tool creation in agent update");
217590
217578
  let finalAgentId;
217591
217579
  try {
217592
217580
  const agentId = typedAgentDefinition.id || generateId();
217593
- logger11.info({ agentId }, "Getting/creating agent metadata");
217581
+ logger10.info({ agentId }, "Getting/creating agent metadata");
217594
217582
  const agent = await upsertAgent(db)({
217595
217583
  data: {
217596
217584
  id: agentId,
@@ -217611,9 +217599,9 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217611
217599
  throw new Error("Failed to upsert agent: no ID returned");
217612
217600
  }
217613
217601
  finalAgentId = agent.id;
217614
- logger11.info({ agentId: finalAgentId }, "Agent metadata ready");
217602
+ logger10.info({ agentId: finalAgentId }, "Agent metadata ready");
217615
217603
  } catch (error) {
217616
- logger11.error(
217604
+ logger10.error(
217617
217605
  { agentId: typedAgentDefinition.id, error },
217618
217606
  "Failed to get/update agent metadata"
217619
217607
  );
@@ -217621,7 +217609,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217621
217609
  }
217622
217610
  let contextConfigId;
217623
217611
  if (typedAgentDefinition.contextConfig) {
217624
- logger11.info(
217612
+ logger10.info(
217625
217613
  { contextConfigId: typedAgentDefinition.contextConfig?.id },
217626
217614
  " context config exists"
217627
217615
  );
@@ -217637,9 +217625,9 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217637
217625
  }
217638
217626
  });
217639
217627
  contextConfigId = contextConfig2.id;
217640
- logger11.info({ contextConfigId }, "Context config processed successfully");
217628
+ logger10.info({ contextConfigId }, "Context config processed successfully");
217641
217629
  } catch (error) {
217642
- logger11.error(
217630
+ logger10.error(
217643
217631
  { contextConfigId: typedAgentDefinition.contextConfig.id, error },
217644
217632
  "Failed to create/update context config"
217645
217633
  );
@@ -217648,7 +217636,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217648
217636
  }
217649
217637
  if (contextConfigId) {
217650
217638
  try {
217651
- logger11.info(
217639
+ logger10.info(
217652
217640
  { agentId: finalAgentId, contextConfigId },
217653
217641
  "Updating agent with contextConfigId"
217654
217642
  );
@@ -217667,25 +217655,25 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217667
217655
  stopWhen: typedAgentDefinition.stopWhen
217668
217656
  }
217669
217657
  });
217670
- logger11.info(
217658
+ logger10.info(
217671
217659
  { agentId: finalAgentId, contextConfigId },
217672
217660
  "Agent updated with contextConfigId successfully"
217673
217661
  );
217674
217662
  } catch (error) {
217675
- logger11.error(
217663
+ logger10.error(
217676
217664
  { agentId: finalAgentId, contextConfigId, error },
217677
217665
  "Failed to update agent with contextConfigId"
217678
217666
  );
217679
217667
  throw error;
217680
217668
  }
217681
217669
  }
217682
- logger11.info({}, "DataComponents are project-scoped - skipping dataComponent update in agent");
217683
- logger11.info(
217670
+ logger10.info({}, "DataComponents are project-scoped - skipping dataComponent update in agent");
217671
+ logger10.info(
217684
217672
  {},
217685
217673
  "ArtifactComponents are project-scoped - skipping artifactComponent update in agent"
217686
217674
  );
217687
217675
  if (typedAgentDefinition.functions && Object.keys(typedAgentDefinition.functions).length > 0) {
217688
- logger11.info(
217676
+ logger10.info(
217689
217677
  {
217690
217678
  agentId: finalAgentId,
217691
217679
  functionCount: Object.keys(typedAgentDefinition.functions).length
@@ -217695,7 +217683,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217695
217683
  const functionPromises = Object.entries(typedAgentDefinition.functions).map(
217696
217684
  async ([functionId, functionData]) => {
217697
217685
  try {
217698
- logger11.info({ agentId: finalAgentId, functionId }, "Updating function for agent");
217686
+ logger10.info({ agentId: finalAgentId, functionId }, "Updating function for agent");
217699
217687
  await upsertFunction(db)({
217700
217688
  data: {
217701
217689
  ...functionData,
@@ -217703,9 +217691,9 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217703
217691
  },
217704
217692
  scopes: { tenantId, projectId }
217705
217693
  });
217706
- logger11.info({ agentId: finalAgentId, functionId }, "Function updated successfully");
217694
+ logger10.info({ agentId: finalAgentId, functionId }, "Function updated successfully");
217707
217695
  } catch (error) {
217708
- logger11.error(
217696
+ logger10.error(
217709
217697
  { agentId: finalAgentId, functionId, error },
217710
217698
  "Failed to update function for agent"
217711
217699
  );
@@ -217714,7 +217702,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217714
217702
  }
217715
217703
  );
217716
217704
  await Promise.all(functionPromises);
217717
- logger11.info(
217705
+ logger10.info(
217718
217706
  {
217719
217707
  agentId: finalAgentId,
217720
217708
  functionCount: Object.keys(typedAgentDefinition.functions).length
@@ -217723,7 +217711,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217723
217711
  );
217724
217712
  }
217725
217713
  if (typedAgentDefinition.functionTools && Object.keys(typedAgentDefinition.functionTools).length > 0) {
217726
- logger11.info(
217714
+ logger10.info(
217727
217715
  {
217728
217716
  agentId: finalAgentId,
217729
217717
  functionToolCount: Object.keys(typedAgentDefinition.functionTools).length
@@ -217733,7 +217721,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217733
217721
  const functionToolPromises = Object.entries(typedAgentDefinition.functionTools).map(
217734
217722
  async ([functionToolId, functionToolData]) => {
217735
217723
  try {
217736
- logger11.info(
217724
+ logger10.info(
217737
217725
  { agentId: finalAgentId, functionToolId },
217738
217726
  "Updating function tool in agent"
217739
217727
  );
@@ -217744,12 +217732,12 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217744
217732
  },
217745
217733
  scopes: { tenantId, projectId, agentId: finalAgentId }
217746
217734
  });
217747
- logger11.info(
217735
+ logger10.info(
217748
217736
  { agentId: finalAgentId, functionToolId },
217749
217737
  "Function tool updated successfully"
217750
217738
  );
217751
217739
  } catch (error) {
217752
- logger11.error(
217740
+ logger10.error(
217753
217741
  { agentId: finalAgentId, functionToolId, error },
217754
217742
  "Failed to update function tool in agent"
217755
217743
  );
@@ -217758,7 +217746,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217758
217746
  }
217759
217747
  );
217760
217748
  await Promise.all(functionToolPromises);
217761
- logger11.info(
217749
+ logger10.info(
217762
217750
  {
217763
217751
  agentId: finalAgentId,
217764
217752
  functionToolCount: Object.keys(typedAgentDefinition.functionTools).length
@@ -217792,7 +217780,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217792
217780
  for (const modelType of modelTypes) {
217793
217781
  if (subAgentModels[modelType]?.model && existingAgentModels?.[modelType]?.model && subAgentModels[modelType].model === existingAgentModels[modelType].model && agentModels[modelType] && (agentModels[modelType].model !== existingAgentModels[modelType]?.model || JSON.stringify(agentModels[modelType].providerOptions) !== JSON.stringify(existingAgentModels[modelType]?.providerOptions))) {
217794
217782
  cascadedModels[modelType] = agentModels[modelType];
217795
- logger11.info(
217783
+ logger10.info(
217796
217784
  {
217797
217785
  subAgentId,
217798
217786
  modelType,
@@ -217807,7 +217795,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217807
217795
  finalModelSettings = cascadedModels;
217808
217796
  }
217809
217797
  try {
217810
- logger11.info({ subAgentId }, "Processing sub-agent");
217798
+ logger10.info({ subAgentId }, "Processing sub-agent");
217811
217799
  await upsertSubAgent(db)({
217812
217800
  data: {
217813
217801
  id: subAgentId,
@@ -217822,17 +217810,17 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217822
217810
  stopWhen: subAgent.stopWhen
217823
217811
  }
217824
217812
  });
217825
- logger11.info({ subAgentId }, "Sub-agent processed successfully");
217813
+ logger10.info({ subAgentId }, "Sub-agent processed successfully");
217826
217814
  } catch (error) {
217827
- logger11.error({ subAgentId, error }, "Failed to create/update sub-agent");
217815
+ logger10.error({ subAgentId, error }, "Failed to create/update sub-agent");
217828
217816
  throw error;
217829
217817
  }
217830
217818
  }
217831
217819
  );
217832
217820
  await Promise.all(subAgentPromises);
217833
217821
  const subAgentCount = Object.entries(typedAgentDefinition.subAgents).length;
217834
- logger11.info({ subAgentCount }, "All sub-agents created/updated successfully");
217835
- logger11.info({}, "External agents are project-scoped and managed at the project level.");
217822
+ logger10.info({ subAgentCount }, "All sub-agents created/updated successfully");
217823
+ logger10.info({}, "External agents are project-scoped and managed at the project level.");
217836
217824
  const incomingSubAgentIds = new Set(Object.keys(typedAgentDefinition.subAgents));
217837
217825
  const existingSubAgents = await listSubAgents(db)({
217838
217826
  scopes: { tenantId, projectId, agentId: finalAgentId }
@@ -217846,14 +217834,14 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217846
217834
  subAgentId: subAgent.id
217847
217835
  });
217848
217836
  deletedSubAgentCount++;
217849
- logger11.info({ subAgentId: subAgent.id }, "Deleted orphaned sub-agent");
217837
+ logger10.info({ subAgentId: subAgent.id }, "Deleted orphaned sub-agent");
217850
217838
  } catch (error) {
217851
- logger11.error({ subAgentId: subAgent.id, error }, "Failed to delete orphaned sub-agent");
217839
+ logger10.error({ subAgentId: subAgent.id, error }, "Failed to delete orphaned sub-agent");
217852
217840
  }
217853
217841
  }
217854
217842
  }
217855
217843
  if (deletedSubAgentCount > 0) {
217856
- logger11.info(
217844
+ logger10.info(
217857
217845
  {
217858
217846
  deletedSubAgentCount
217859
217847
  },
@@ -217899,7 +217887,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217899
217887
  });
217900
217888
  deletedExternalAgentRelationCount++;
217901
217889
  } catch (error) {
217902
- logger11.error(
217890
+ logger10.error(
217903
217891
  { relationId: relation.id, error },
217904
217892
  "Failed to delete orphaned external agent relation"
217905
217893
  );
@@ -217907,7 +217895,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217907
217895
  }
217908
217896
  }
217909
217897
  if (deletedExternalAgentRelationCount > 0) {
217910
- logger11.info(
217898
+ logger10.info(
217911
217899
  { deletedExternalAgentRelationCount },
217912
217900
  "Deleted orphaned external agent relations from agent"
217913
217901
  );
@@ -217930,7 +217918,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217930
217918
  });
217931
217919
  deletedTeamAgentRelationCount++;
217932
217920
  } catch (error) {
217933
- logger11.error(
217921
+ logger10.error(
217934
217922
  { relationId: relation.id, error },
217935
217923
  "Failed to delete orphaned team agent relation"
217936
217924
  );
@@ -217938,7 +217926,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217938
217926
  }
217939
217927
  }
217940
217928
  if (deletedTeamAgentRelationCount > 0) {
217941
- logger11.info(
217929
+ logger10.info(
217942
217930
  { deletedTeamAgentRelationCount },
217943
217931
  "Deleted orphaned team agent relations from agent"
217944
217932
  );
@@ -217956,7 +217944,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217956
217944
  stopWhen: typedAgentDefinition.stopWhen
217957
217945
  }
217958
217946
  });
217959
- logger11.info({ agentId: typedAgentDefinition.id }, "Agent metadata updated");
217947
+ logger10.info({ agentId: typedAgentDefinition.id }, "Agent metadata updated");
217960
217948
  const incomingRelationshipIds = /* @__PURE__ */ new Set();
217961
217949
  for (const [_subAgentId, agentData2] of Object.entries(typedAgentDefinition.subAgents)) {
217962
217950
  if (agentData2.canUse && Array.isArray(agentData2.canUse)) {
@@ -217993,10 +217981,10 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
217993
217981
  deletedCount = result.length;
217994
217982
  }
217995
217983
  if (deletedCount > 0) {
217996
- logger11.info({ subAgentId, deletedCount }, "Deleted orphaned agent-tool relations");
217984
+ logger10.info({ subAgentId, deletedCount }, "Deleted orphaned agent-tool relations");
217997
217985
  }
217998
217986
  } catch (error) {
217999
- logger11.error({ subAgentId, error }, "Failed to delete orphaned agent-tool relations");
217987
+ logger10.error({ subAgentId, error }, "Failed to delete orphaned agent-tool relations");
218000
217988
  }
218001
217989
  }
218002
217990
  const subAgentToolPromises = [];
@@ -218009,7 +217997,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218009
217997
  const { toolId, toolSelection, headers: headers2, agentToolRelationId } = canUseItem;
218010
217998
  const isFunctionTool = typedAgentDefinition.functionTools && toolId in typedAgentDefinition.functionTools;
218011
217999
  if (isFunctionTool) {
218012
- logger11.info(
218000
+ logger10.info(
218013
218001
  { subAgentId, toolId },
218014
218002
  "Processing sub-agent-function tool relation"
218015
218003
  );
@@ -218019,12 +218007,12 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218019
218007
  functionToolId: toolId,
218020
218008
  relationId: agentToolRelationId
218021
218009
  });
218022
- logger11.info(
218010
+ logger10.info(
218023
218011
  { subAgentId, toolId, relationId: agentToolRelationId },
218024
218012
  "Sub-agent-function tool relation upserted"
218025
218013
  );
218026
218014
  } else {
218027
- logger11.info({ subAgentId, toolId }, "Processing sub-agent-MCP tool relation");
218015
+ logger10.info({ subAgentId, toolId }, "Processing sub-agent-MCP tool relation");
218028
218016
  await upsertSubAgentToolRelation(db)({
218029
218017
  scopes: { tenantId, projectId, agentId: finalAgentId },
218030
218018
  subAgentId,
@@ -218033,13 +218021,13 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218033
218021
  headers: headers2 || void 0,
218034
218022
  relationId: agentToolRelationId
218035
218023
  });
218036
- logger11.info(
218024
+ logger10.info(
218037
218025
  { subAgentId, toolId, relationId: agentToolRelationId },
218038
218026
  "Sub-agent-MCP tool relation upserted"
218039
218027
  );
218040
218028
  }
218041
218029
  } catch (error) {
218042
- logger11.error(
218030
+ logger10.error(
218043
218031
  {
218044
218032
  subAgentId,
218045
218033
  toolId: canUseItem.toolId,
@@ -218055,7 +218043,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218055
218043
  }
218056
218044
  }
218057
218045
  await Promise.all(subAgentToolPromises);
218058
- logger11.info(
218046
+ logger10.info(
218059
218047
  { subAgentToolPromisesCount: subAgentToolPromises.length },
218060
218048
  "All sub-agent-tool relations updated"
218061
218049
  );
@@ -218075,12 +218063,12 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218075
218063
  scopes: { tenantId, projectId, agentId: finalAgentId, subAgentId },
218076
218064
  dataComponentId
218077
218065
  });
218078
- logger11.info(
218066
+ logger10.info(
218079
218067
  { subAgentId, dataComponentId },
218080
218068
  "Sub-agent-dataComponent relation created"
218081
218069
  );
218082
218070
  } catch (error) {
218083
- logger11.error(
218071
+ logger10.error(
218084
218072
  { subAgentId, dataComponentId, error },
218085
218073
  "Failed to create sub-agent-dataComponent relation"
218086
218074
  );
@@ -218091,7 +218079,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218091
218079
  }
218092
218080
  }
218093
218081
  await Promise.all(agentDataComponentPromises);
218094
- logger11.info(
218082
+ logger10.info(
218095
218083
  { agentDataComponentPromisesCount: agentDataComponentPromises.length },
218096
218084
  "All sub-agent-dataComponent relations updated"
218097
218085
  );
@@ -218111,12 +218099,12 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218111
218099
  scopes: { tenantId, projectId, agentId: finalAgentId, subAgentId },
218112
218100
  artifactComponentId
218113
218101
  });
218114
- logger11.info(
218102
+ logger10.info(
218115
218103
  { subAgentId, artifactComponentId },
218116
218104
  "Sub-agent-artifactComponent relation created"
218117
218105
  );
218118
218106
  } catch (error) {
218119
- logger11.error(
218107
+ logger10.error(
218120
218108
  { subAgentId, artifactComponentId, error },
218121
218109
  "Failed to create sub-agent-artifactComponent relation"
218122
218110
  );
@@ -218127,7 +218115,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218127
218115
  }
218128
218116
  }
218129
218117
  await Promise.all(agentArtifactComponentPromises);
218130
- logger11.info(
218118
+ logger10.info(
218131
218119
  { agentArtifactComponentPromisesCount: agentArtifactComponentPromises.length },
218132
218120
  "All sub-agent-artifactComponent relations updated"
218133
218121
  );
@@ -218152,9 +218140,9 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218152
218140
  targetSubAgentId,
218153
218141
  relationType: "transfer"
218154
218142
  });
218155
- logger11.info({ subAgentId, targetSubAgentId }, "Transfer relation created");
218143
+ logger10.info({ subAgentId, targetSubAgentId }, "Transfer relation created");
218156
218144
  } catch (error) {
218157
- logger11.error(
218145
+ logger10.error(
218158
218146
  { subAgentId, targetSubAgentId, error },
218159
218147
  "Failed to create transfer relation"
218160
218148
  );
@@ -218178,12 +218166,12 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218178
218166
  targetSubAgentId: targetItem,
218179
218167
  relationType: "delegate"
218180
218168
  });
218181
- logger11.info(
218169
+ logger10.info(
218182
218170
  { subAgentId, targetSubAgentId: targetItem },
218183
218171
  "Sub-agent delegation relation created"
218184
218172
  );
218185
218173
  } catch (error) {
218186
- logger11.error(
218174
+ logger10.error(
218187
218175
  { subAgentId, targetSubAgentId: targetItem, error },
218188
218176
  "Failed to create sub-agent delegation relation"
218189
218177
  );
@@ -218207,12 +218195,12 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218207
218195
  headers: targetItem.headers || null
218208
218196
  }
218209
218197
  });
218210
- logger11.info(
218198
+ logger10.info(
218211
218199
  { subAgentId, externalAgentId: targetItem.externalAgentId },
218212
218200
  "External delegation relation created"
218213
218201
  );
218214
218202
  } catch (error) {
218215
- logger11.error(
218203
+ logger10.error(
218216
218204
  { subAgentId, externalAgentId: targetItem.externalAgentId, error },
218217
218205
  "Failed to create external delegation relation"
218218
218206
  );
@@ -218220,7 +218208,7 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218220
218208
  })()
218221
218209
  );
218222
218210
  } else if ("agentId" in targetItem) {
218223
- logger11.info({ subAgentId, targetItem }, "Processing team agent delegation");
218211
+ logger10.info({ subAgentId, targetItem }, "Processing team agent delegation");
218224
218212
  subAgentTeamAgentRelationPromises.push(
218225
218213
  (async () => {
218226
218214
  try {
@@ -218232,12 +218220,12 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218232
218220
  headers: targetItem.headers || null
218233
218221
  }
218234
218222
  });
218235
- logger11.info(
218223
+ logger10.info(
218236
218224
  { subAgentId, agentId: targetItem.agentId },
218237
218225
  "Team agent delegation relation created"
218238
218226
  );
218239
218227
  } catch (error) {
218240
- logger11.error(
218228
+ logger10.error(
218241
218229
  { subAgentId, agentId: targetItem.agentId, error },
218242
218230
  "Failed to create team agent delegation relation"
218243
218231
  );
@@ -218249,19 +218237,19 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218249
218237
  }
218250
218238
  }
218251
218239
  await Promise.all(subAgentRelationPromises);
218252
- logger11.info(
218240
+ logger10.info(
218253
218241
  { subAgentRelationPromisesCount: subAgentRelationPromises.length },
218254
218242
  "All sub-agent relations updated"
218255
218243
  );
218256
218244
  await Promise.all(subAgentExternalAgentRelationPromises);
218257
- logger11.info(
218245
+ logger10.info(
218258
218246
  {
218259
218247
  subAgentExternalAgentRelationPromisesCount: subAgentExternalAgentRelationPromises.length
218260
218248
  },
218261
218249
  "All sub-agent external agent relations updated"
218262
218250
  );
218263
218251
  await Promise.all(subAgentTeamAgentRelationPromises);
218264
- logger11.info(
218252
+ logger10.info(
218265
218253
  {
218266
218254
  subAgentTeamAgentRelationPromisesCount: subAgentTeamAgentRelationPromises.length
218267
218255
  },
@@ -218273,26 +218261,26 @@ var updateFullAgentServerSide = (db, logger11 = defaultLogger) => async (scopes,
218273
218261
  if (!updatedAgent) {
218274
218262
  throw new Error("Failed to retrieve updated agent");
218275
218263
  }
218276
- logger11.info({ agentId: typedAgentDefinition.id }, "Full agent updated successfully");
218264
+ logger10.info({ agentId: typedAgentDefinition.id }, "Full agent updated successfully");
218277
218265
  return updatedAgent;
218278
218266
  } catch (error) {
218279
- logger11.error({ agentId: typedAgentDefinition.id, error }, "Failed to update full agent");
218267
+ logger10.error({ agentId: typedAgentDefinition.id, error }, "Failed to update full agent");
218280
218268
  throw error;
218281
218269
  }
218282
218270
  };
218283
- var getFullAgent = (db, logger11 = defaultLogger) => async (params) => {
218271
+ var getFullAgent = (db, logger10 = defaultLogger) => async (params) => {
218284
218272
  const { scopes } = params;
218285
218273
  const { tenantId, projectId } = scopes;
218286
- logger11.info({ tenantId, agentId: scopes.agentId }, "Retrieving full agent definition");
218274
+ logger10.info({ tenantId, agentId: scopes.agentId }, "Retrieving full agent definition");
218287
218275
  try {
218288
218276
  const agent = await getFullAgentDefinition(db)({
218289
218277
  scopes: { tenantId, projectId, agentId: scopes.agentId }
218290
218278
  });
218291
218279
  if (!agent) {
218292
- logger11.info({ tenantId, agentId: scopes.agentId }, "Agent not found");
218280
+ logger10.info({ tenantId, agentId: scopes.agentId }, "Agent not found");
218293
218281
  return null;
218294
218282
  }
218295
- logger11.info(
218283
+ logger10.info(
218296
218284
  {
218297
218285
  tenantId,
218298
218286
  agentId: scopes.agentId,
@@ -218302,7 +218290,7 @@ var getFullAgent = (db, logger11 = defaultLogger) => async (params) => {
218302
218290
  );
218303
218291
  return agent;
218304
218292
  } catch (error) {
218305
- logger11.error(
218293
+ logger10.error(
218306
218294
  {
218307
218295
  tenantId,
218308
218296
  agentId: scopes.agentId,
@@ -218313,21 +218301,21 @@ var getFullAgent = (db, logger11 = defaultLogger) => async (params) => {
218313
218301
  throw error;
218314
218302
  }
218315
218303
  };
218316
- var deleteFullAgent = (db, logger11 = defaultLogger) => async (params) => {
218304
+ var deleteFullAgent = (db, logger10 = defaultLogger) => async (params) => {
218317
218305
  const { tenantId, projectId, agentId } = params.scopes;
218318
- logger11.info({ tenantId, agentId }, "Deleting full agent and related entities");
218306
+ logger10.info({ tenantId, agentId }, "Deleting full agent and related entities");
218319
218307
  try {
218320
218308
  const agent = await getFullAgentDefinition(db)({
218321
218309
  scopes: { tenantId, projectId, agentId }
218322
218310
  });
218323
218311
  if (!agent) {
218324
- logger11.info({ tenantId, agentId }, "Agent not found for deletion");
218312
+ logger10.info({ tenantId, agentId }, "Agent not found for deletion");
218325
218313
  return false;
218326
218314
  }
218327
218315
  await deleteAgentRelationsByAgent(db)({
218328
218316
  scopes: { tenantId, projectId, agentId }
218329
218317
  });
218330
- logger11.info({ tenantId, agentId }, "Agent relations deleted");
218318
+ logger10.info({ tenantId, agentId }, "Agent relations deleted");
218331
218319
  const subAgentIds = Object.keys(agent.subAgents);
218332
218320
  if (subAgentIds.length > 0) {
218333
218321
  for (const subAgentId of subAgentIds) {
@@ -218335,7 +218323,7 @@ var deleteFullAgent = (db, logger11 = defaultLogger) => async (params) => {
218335
218323
  scopes: { tenantId, projectId, agentId, subAgentId }
218336
218324
  });
218337
218325
  }
218338
- logger11.info(
218326
+ logger10.info(
218339
218327
  { tenantId, agentId, agentCount: subAgentIds.length },
218340
218328
  "Agent-tool relations deleted"
218341
218329
  );
@@ -218343,11 +218331,11 @@ var deleteFullAgent = (db, logger11 = defaultLogger) => async (params) => {
218343
218331
  await deleteAgent(db)({
218344
218332
  scopes: { tenantId, projectId, agentId }
218345
218333
  });
218346
- logger11.info({ tenantId, agentId }, "Agent metadata deleted");
218347
- logger11.info({ tenantId, agentId }, "Full agent deleted successfully");
218334
+ logger10.info({ tenantId, agentId }, "Agent metadata deleted");
218335
+ logger10.info({ tenantId, agentId }, "Full agent deleted successfully");
218348
218336
  return true;
218349
218337
  } catch (error) {
218350
- logger11.error(
218338
+ logger10.error(
218351
218339
  {
218352
218340
  tenantId,
218353
218341
  agentId,
@@ -219500,10 +219488,10 @@ var defaultLogger2 = getLogger("projectFull");
219500
219488
  function validateAndTypeProjectData(projectData) {
219501
219489
  return projectData;
219502
219490
  }
219503
- var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scopes, projectData) => {
219491
+ var createFullProjectServerSide = (db, logger10 = defaultLogger2) => async (scopes, projectData) => {
219504
219492
  const { tenantId } = scopes;
219505
219493
  const typed = validateAndTypeProjectData(projectData);
219506
- logger11.info(
219494
+ logger10.info(
219507
219495
  {
219508
219496
  tenantId,
219509
219497
  projectId: typed.id,
@@ -219520,11 +219508,11 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219520
219508
  stopWhen: typed.stopWhen,
219521
219509
  tenantId
219522
219510
  };
219523
- logger11.info({ projectId: typed.id }, "Creating project metadata");
219511
+ logger10.info({ projectId: typed.id }, "Creating project metadata");
219524
219512
  await createProject(db)(projectPayload);
219525
- logger11.info({ projectId: typed.id }, "Project metadata created successfully");
219513
+ logger10.info({ projectId: typed.id }, "Project metadata created successfully");
219526
219514
  if (typed.credentialReferences && Object.keys(typed.credentialReferences).length > 0) {
219527
- logger11.info(
219515
+ logger10.info(
219528
219516
  {
219529
219517
  projectId: typed.id,
219530
219518
  count: Object.keys(typed.credentialReferences).length
@@ -219534,7 +219522,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219534
219522
  const credentialPromises = Object.entries(typed.credentialReferences).map(
219535
219523
  async ([_credId, credData]) => {
219536
219524
  try {
219537
- logger11.info(
219525
+ logger10.info(
219538
219526
  { projectId: typed.id, credId: credData.id },
219539
219527
  "Creating credentialReference in project"
219540
219528
  );
@@ -219545,12 +219533,12 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219545
219533
  projectId: typed.id
219546
219534
  }
219547
219535
  });
219548
- logger11.info(
219536
+ logger10.info(
219549
219537
  { projectId: typed.id, credId: credData.id },
219550
219538
  "CredentialReference created successfully"
219551
219539
  );
219552
219540
  } catch (error) {
219553
- logger11.error(
219541
+ logger10.error(
219554
219542
  { projectId: typed.id, credId: credData.id, error },
219555
219543
  "Failed to create credentialReference in project"
219556
219544
  );
@@ -219559,7 +219547,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219559
219547
  }
219560
219548
  );
219561
219549
  await Promise.all(credentialPromises);
219562
- logger11.info(
219550
+ logger10.info(
219563
219551
  {
219564
219552
  projectId: typed.id,
219565
219553
  count: Object.keys(typed.credentialReferences).length
@@ -219571,19 +219559,19 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219571
219559
  const functionPromises = Object.entries(typed.functions).map(
219572
219560
  async ([functionId, functionData]) => {
219573
219561
  try {
219574
- logger11.info({ projectId: typed.id, functionId }, "Creating project function");
219562
+ logger10.info({ projectId: typed.id, functionId }, "Creating project function");
219575
219563
  await upsertFunction(db)({
219576
219564
  data: {
219577
219565
  ...functionData
219578
219566
  },
219579
219567
  scopes: { tenantId, projectId: typed.id }
219580
219568
  });
219581
- logger11.info(
219569
+ logger10.info(
219582
219570
  { projectId: typed.id, functionId },
219583
219571
  "Project function created successfully"
219584
219572
  );
219585
219573
  } catch (error) {
219586
- logger11.error(
219574
+ logger10.error(
219587
219575
  { projectId: typed.id, functionId, error },
219588
219576
  "Failed to create global function"
219589
219577
  );
@@ -219592,7 +219580,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219592
219580
  }
219593
219581
  );
219594
219582
  await Promise.all(functionPromises);
219595
- logger11.info(
219583
+ logger10.info(
219596
219584
  {
219597
219585
  projectId: typed.id,
219598
219586
  functionCount: Object.keys(typed.functions).length
@@ -219601,7 +219589,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219601
219589
  );
219602
219590
  }
219603
219591
  if (typed.tools && Object.keys(typed.tools).length > 0) {
219604
- logger11.info(
219592
+ logger10.info(
219605
219593
  {
219606
219594
  projectId: typed.id,
219607
219595
  toolCount: Object.keys(typed.tools).length
@@ -219610,7 +219598,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219610
219598
  );
219611
219599
  const toolPromises = Object.entries(typed.tools).map(async ([toolId, toolData]) => {
219612
219600
  try {
219613
- logger11.info({ projectId: typed.id, toolId }, "Creating tool in project");
219601
+ logger10.info({ projectId: typed.id, toolId }, "Creating tool in project");
219614
219602
  await upsertTool(db)({
219615
219603
  data: {
219616
219604
  tenantId,
@@ -219618,9 +219606,9 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219618
219606
  ...toolData
219619
219607
  }
219620
219608
  });
219621
- logger11.info({ projectId: typed.id, toolId }, "Tool created successfully");
219609
+ logger10.info({ projectId: typed.id, toolId }, "Tool created successfully");
219622
219610
  } catch (error) {
219623
- logger11.error(
219611
+ logger10.error(
219624
219612
  { projectId: typed.id, toolId, error },
219625
219613
  "Failed to create tool in project"
219626
219614
  );
@@ -219628,7 +219616,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219628
219616
  }
219629
219617
  });
219630
219618
  await Promise.all(toolPromises);
219631
- logger11.info(
219619
+ logger10.info(
219632
219620
  {
219633
219621
  projectId: typed.id,
219634
219622
  toolCount: Object.keys(typed.tools).length
@@ -219637,7 +219625,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219637
219625
  );
219638
219626
  }
219639
219627
  if (typed.externalAgents && Object.keys(typed.externalAgents).length > 0) {
219640
- logger11.info(
219628
+ logger10.info(
219641
219629
  {
219642
219630
  projectId: typed.id,
219643
219631
  count: Object.keys(typed.externalAgents).length
@@ -219647,7 +219635,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219647
219635
  const externalAgentPromises = Object.entries(typed.externalAgents).map(
219648
219636
  async ([externalAgentId, externalAgentData]) => {
219649
219637
  try {
219650
- logger11.info(
219638
+ logger10.info(
219651
219639
  { projectId: typed.id, externalAgentId },
219652
219640
  "Creating externalAgent in project"
219653
219641
  );
@@ -219658,12 +219646,12 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219658
219646
  projectId: typed.id
219659
219647
  }
219660
219648
  });
219661
- logger11.info(
219649
+ logger10.info(
219662
219650
  { projectId: typed.id, externalAgentId },
219663
219651
  "ExternalAgent created successfully"
219664
219652
  );
219665
219653
  } catch (error) {
219666
- logger11.error(
219654
+ logger10.error(
219667
219655
  { projectId: typed.id, externalAgentId, error },
219668
219656
  "Failed to create externalAgent in project"
219669
219657
  );
@@ -219672,7 +219660,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219672
219660
  }
219673
219661
  );
219674
219662
  await Promise.all(externalAgentPromises);
219675
- logger11.info(
219663
+ logger10.info(
219676
219664
  {
219677
219665
  projectId: typed.id,
219678
219666
  count: Object.keys(typed.externalAgents).length
@@ -219681,7 +219669,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219681
219669
  );
219682
219670
  }
219683
219671
  if (typed.dataComponents && Object.keys(typed.dataComponents).length > 0) {
219684
- logger11.info(
219672
+ logger10.info(
219685
219673
  {
219686
219674
  projectId: typed.id,
219687
219675
  count: Object.keys(typed.dataComponents).length
@@ -219691,7 +219679,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219691
219679
  const dataComponentPromises = Object.entries(typed.dataComponents).map(
219692
219680
  async ([componentId, componentData]) => {
219693
219681
  try {
219694
- logger11.info(
219682
+ logger10.info(
219695
219683
  { projectId: typed.id, componentId },
219696
219684
  "Creating dataComponent in project"
219697
219685
  );
@@ -219702,12 +219690,12 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219702
219690
  projectId: typed.id
219703
219691
  }
219704
219692
  });
219705
- logger11.info(
219693
+ logger10.info(
219706
219694
  { projectId: typed.id, componentId },
219707
219695
  "DataComponent created successfully"
219708
219696
  );
219709
219697
  } catch (error) {
219710
- logger11.error(
219698
+ logger10.error(
219711
219699
  { projectId: typed.id, componentId, error },
219712
219700
  "Failed to create dataComponent in project"
219713
219701
  );
@@ -219716,7 +219704,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219716
219704
  }
219717
219705
  );
219718
219706
  await Promise.all(dataComponentPromises);
219719
- logger11.info(
219707
+ logger10.info(
219720
219708
  {
219721
219709
  projectId: typed.id,
219722
219710
  count: Object.keys(typed.dataComponents).length
@@ -219725,7 +219713,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219725
219713
  );
219726
219714
  }
219727
219715
  if (typed.artifactComponents && Object.keys(typed.artifactComponents).length > 0) {
219728
- logger11.info(
219716
+ logger10.info(
219729
219717
  {
219730
219718
  projectId: typed.id,
219731
219719
  count: Object.keys(typed.artifactComponents).length
@@ -219735,7 +219723,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219735
219723
  const artifactComponentPromises = Object.entries(typed.artifactComponents).map(
219736
219724
  async ([componentId, componentData]) => {
219737
219725
  try {
219738
- logger11.info(
219726
+ logger10.info(
219739
219727
  { projectId: typed.id, componentId },
219740
219728
  "Creating artifactComponent in project"
219741
219729
  );
@@ -219746,12 +219734,12 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219746
219734
  projectId: typed.id
219747
219735
  }
219748
219736
  });
219749
- logger11.info(
219737
+ logger10.info(
219750
219738
  { projectId: typed.id, componentId },
219751
219739
  "ArtifactComponent created successfully"
219752
219740
  );
219753
219741
  } catch (error) {
219754
- logger11.error(
219742
+ logger10.error(
219755
219743
  { projectId: typed.id, componentId, error },
219756
219744
  "Failed to create artifactComponent in project"
219757
219745
  );
@@ -219760,7 +219748,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219760
219748
  }
219761
219749
  );
219762
219750
  await Promise.all(artifactComponentPromises);
219763
- logger11.info(
219751
+ logger10.info(
219764
219752
  {
219765
219753
  projectId: typed.id,
219766
219754
  count: Object.keys(typed.artifactComponents).length
@@ -219769,14 +219757,14 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219769
219757
  );
219770
219758
  }
219771
219759
  if (typed.agents && Object.keys(typed.agents).length > 0) {
219772
- logger11.info(
219760
+ logger10.info(
219773
219761
  {
219774
219762
  projectId: typed.id,
219775
219763
  agentCount: Object.keys(typed.agents).length
219776
219764
  },
219777
219765
  "Creating project agent"
219778
219766
  );
219779
- logger11.info(
219767
+ logger10.info(
219780
219768
  {
219781
219769
  projectId: typed.id,
219782
219770
  agentCount: Object.keys(typed.agents).length
@@ -219785,7 +219773,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219785
219773
  );
219786
219774
  const agentPromises = Object.entries(typed.agents).map(async ([agentId, agentData]) => {
219787
219775
  try {
219788
- logger11.info({ projectId: typed.id, agentId }, "Creating agent in project (phase 1)");
219776
+ logger10.info({ projectId: typed.id, agentId }, "Creating agent in project (phase 1)");
219789
219777
  const agentDataWithoutSubAgents = {
219790
219778
  ...agentData,
219791
219779
  subAgents: {},
@@ -219803,16 +219791,16 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219803
219791
  credentialReferences: typed.credentialReferences || {},
219804
219792
  statusUpdates: agentData.statusUpdates === null ? void 0 : agentData.statusUpdates
219805
219793
  };
219806
- await createFullAgentServerSide(db, logger11)(
219794
+ await createFullAgentServerSide(db, logger10)(
219807
219795
  { tenantId, projectId: typed.id },
219808
219796
  agentDataWithoutSubAgents
219809
219797
  );
219810
- logger11.info(
219798
+ logger10.info(
219811
219799
  { projectId: typed.id, agentId },
219812
219800
  "Agent created successfully in project (phase 1)"
219813
219801
  );
219814
219802
  } catch (error) {
219815
- logger11.error(
219803
+ logger10.error(
219816
219804
  { projectId: typed.id, agentId, error },
219817
219805
  "Failed to create agent in project (phase 1)"
219818
219806
  );
@@ -219820,14 +219808,14 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219820
219808
  }
219821
219809
  });
219822
219810
  await Promise.all(agentPromises);
219823
- logger11.info(
219811
+ logger10.info(
219824
219812
  {
219825
219813
  projectId: typed.id,
219826
219814
  agentCount: Object.keys(typed.agents).length
219827
219815
  },
219828
219816
  "Phase 1 complete: All agents created without sub-agents"
219829
219817
  );
219830
- logger11.info(
219818
+ logger10.info(
219831
219819
  {
219832
219820
  projectId: typed.id,
219833
219821
  agentCount: Object.keys(typed.agents).length
@@ -219836,22 +219824,22 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219836
219824
  );
219837
219825
  const updatePromises = Object.entries(typed.agents).filter(([_, agentData]) => Object.keys(agentData.subAgents).length > 0).map(async ([agentId, agentData]) => {
219838
219826
  try {
219839
- logger11.info({ projectId: typed.id, agentId }, "Adding sub-agents (phase 2)");
219827
+ logger10.info({ projectId: typed.id, agentId }, "Adding sub-agents (phase 2)");
219840
219828
  const updateData = {
219841
219829
  ...agentData,
219842
219830
  subAgents: agentData.subAgents
219843
219831
  // Include all sub-agents with their relationships
219844
219832
  };
219845
- await updateFullAgentServerSide(db, logger11)(
219833
+ await updateFullAgentServerSide(db, logger10)(
219846
219834
  { tenantId, projectId: typed.id },
219847
219835
  updateData
219848
219836
  );
219849
- logger11.info(
219837
+ logger10.info(
219850
219838
  { projectId: typed.id, agentId },
219851
219839
  "Sub-agents added successfully (phase 2)"
219852
219840
  );
219853
219841
  } catch (error) {
219854
- logger11.error(
219842
+ logger10.error(
219855
219843
  { projectId: typed.id, agentId, error },
219856
219844
  "Failed to add sub-agents (phase 2)"
219857
219845
  );
@@ -219859,7 +219847,7 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219859
219847
  }
219860
219848
  });
219861
219849
  await Promise.all(updatePromises);
219862
- logger11.info(
219850
+ logger10.info(
219863
219851
  {
219864
219852
  projectId: typed.id,
219865
219853
  agentCount: Object.keys(typed.agents).length
@@ -219867,15 +219855,15 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219867
219855
  "Phase 2 complete: All sub-agents added successfully"
219868
219856
  );
219869
219857
  }
219870
- logger11.info({ projectId: typed.id }, "Full project created successfully");
219858
+ logger10.info({ projectId: typed.id }, "Full project created successfully");
219871
219859
  return await getFullProject(
219872
219860
  db,
219873
- logger11
219861
+ logger10
219874
219862
  )({
219875
219863
  scopes: { tenantId, projectId: typed.id }
219876
219864
  });
219877
219865
  } catch (error) {
219878
- logger11.error(
219866
+ logger10.error(
219879
219867
  {
219880
219868
  tenantId,
219881
219869
  projectId: typed.id,
@@ -219886,13 +219874,13 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219886
219874
  throw error;
219887
219875
  }
219888
219876
  };
219889
- var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scopes, projectData) => {
219877
+ var updateFullProjectServerSide = (db, logger10 = defaultLogger2) => async (scopes, projectData) => {
219890
219878
  const { tenantId } = scopes;
219891
219879
  const typed = validateAndTypeProjectData(projectData);
219892
219880
  if (!typed.id) {
219893
219881
  throw new Error("Project ID is required");
219894
219882
  }
219895
- logger11.info(
219883
+ logger10.info(
219896
219884
  {
219897
219885
  tenantId,
219898
219886
  projectId: typed.id,
@@ -219905,8 +219893,8 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219905
219893
  scopes: { tenantId, projectId: typed.id }
219906
219894
  });
219907
219895
  if (!existingProject) {
219908
- logger11.info({ projectId: typed.id }, "Project not found, creating new project");
219909
- return await createFullProjectServerSide(db, logger11)(
219896
+ logger10.info({ projectId: typed.id }, "Project not found, creating new project");
219897
+ return await createFullProjectServerSide(db, logger10)(
219910
219898
  { tenantId, projectId: typed.id },
219911
219899
  projectData
219912
219900
  );
@@ -219917,14 +219905,14 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219917
219905
  models: typed.models,
219918
219906
  stopWhen: typed.stopWhen
219919
219907
  };
219920
- logger11.info({ projectId: typed.id }, "Updating project metadata");
219908
+ logger10.info({ projectId: typed.id }, "Updating project metadata");
219921
219909
  await updateProject(db)({
219922
219910
  scopes: { tenantId, projectId: typed.id },
219923
219911
  data: projectUpdatePayload
219924
219912
  });
219925
- logger11.info({ projectId: typed.id }, "Project metadata updated successfully");
219913
+ logger10.info({ projectId: typed.id }, "Project metadata updated successfully");
219926
219914
  if (typed.credentialReferences && Object.keys(typed.credentialReferences).length > 0) {
219927
- logger11.info(
219915
+ logger10.info(
219928
219916
  {
219929
219917
  projectId: typed.id,
219930
219918
  count: Object.keys(typed.credentialReferences).length
@@ -219934,7 +219922,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219934
219922
  const credentialPromises = Object.entries(typed.credentialReferences).map(
219935
219923
  async ([_credId, credData]) => {
219936
219924
  try {
219937
- logger11.info(
219925
+ logger10.info(
219938
219926
  { projectId: typed.id, credId: credData.id },
219939
219927
  "Updating credentialReference in project"
219940
219928
  );
@@ -219945,12 +219933,12 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219945
219933
  projectId: typed.id
219946
219934
  }
219947
219935
  });
219948
- logger11.info(
219936
+ logger10.info(
219949
219937
  { projectId: typed.id, credId: credData.id },
219950
219938
  "CredentialReference updated successfully"
219951
219939
  );
219952
219940
  } catch (error) {
219953
- logger11.error(
219941
+ logger10.error(
219954
219942
  { projectId: typed.id, credId: credData.id, error },
219955
219943
  "Failed to update credentialReference in project"
219956
219944
  );
@@ -219959,7 +219947,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219959
219947
  }
219960
219948
  );
219961
219949
  await Promise.all(credentialPromises);
219962
- logger11.info(
219950
+ logger10.info(
219963
219951
  {
219964
219952
  projectId: typed.id,
219965
219953
  count: Object.keys(typed.credentialReferences).length
@@ -219968,7 +219956,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219968
219956
  );
219969
219957
  }
219970
219958
  if (typed.functions && Object.keys(typed.functions).length > 0) {
219971
- logger11.info(
219959
+ logger10.info(
219972
219960
  {
219973
219961
  projectId: typed.id,
219974
219962
  functionCount: Object.keys(typed.functions).length
@@ -219978,19 +219966,19 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219978
219966
  const functionPromises = Object.entries(typed.functions).map(
219979
219967
  async ([functionId, functionData]) => {
219980
219968
  try {
219981
- logger11.info({ projectId: typed.id, functionId }, "Updating project function");
219969
+ logger10.info({ projectId: typed.id, functionId }, "Updating project function");
219982
219970
  await upsertFunction(db)({
219983
219971
  data: {
219984
219972
  ...functionData
219985
219973
  },
219986
219974
  scopes: { tenantId, projectId: typed.id }
219987
219975
  });
219988
- logger11.info(
219976
+ logger10.info(
219989
219977
  { projectId: typed.id, functionId },
219990
219978
  "Project function updated successfully"
219991
219979
  );
219992
219980
  } catch (error) {
219993
- logger11.error(
219981
+ logger10.error(
219994
219982
  { projectId: typed.id, functionId, error },
219995
219983
  "Failed to update global function"
219996
219984
  );
@@ -219999,7 +219987,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
219999
219987
  }
220000
219988
  );
220001
219989
  await Promise.all(functionPromises);
220002
- logger11.info(
219990
+ logger10.info(
220003
219991
  {
220004
219992
  projectId: typed.id,
220005
219993
  functionCount: Object.keys(typed.functions).length
@@ -220008,7 +219996,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220008
219996
  );
220009
219997
  }
220010
219998
  if (typed.tools && Object.keys(typed.tools).length > 0) {
220011
- logger11.info(
219999
+ logger10.info(
220012
220000
  {
220013
220001
  projectId: typed.id,
220014
220002
  toolCount: Object.keys(typed.tools).length
@@ -220017,7 +220005,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220017
220005
  );
220018
220006
  const toolPromises = Object.entries(typed.tools).map(async ([toolId, toolData]) => {
220019
220007
  try {
220020
- logger11.info({ projectId: typed.id, toolId }, "Updating tool in project");
220008
+ logger10.info({ projectId: typed.id, toolId }, "Updating tool in project");
220021
220009
  await upsertTool(db)({
220022
220010
  data: {
220023
220011
  tenantId,
@@ -220025,9 +220013,9 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220025
220013
  ...toolData
220026
220014
  }
220027
220015
  });
220028
- logger11.info({ projectId: typed.id, toolId }, "Tool updated successfully");
220016
+ logger10.info({ projectId: typed.id, toolId }, "Tool updated successfully");
220029
220017
  } catch (error) {
220030
- logger11.error(
220018
+ logger10.error(
220031
220019
  { projectId: typed.id, toolId, error },
220032
220020
  "Failed to update tool in project"
220033
220021
  );
@@ -220035,7 +220023,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220035
220023
  }
220036
220024
  });
220037
220025
  await Promise.all(toolPromises);
220038
- logger11.info(
220026
+ logger10.info(
220039
220027
  {
220040
220028
  projectId: typed.id,
220041
220029
  toolCount: Object.keys(typed.tools).length
@@ -220044,7 +220032,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220044
220032
  );
220045
220033
  }
220046
220034
  if (typed.externalAgents && Object.keys(typed.externalAgents).length > 0) {
220047
- logger11.info(
220035
+ logger10.info(
220048
220036
  {
220049
220037
  projectId: typed.id,
220050
220038
  count: Object.keys(typed.externalAgents).length
@@ -220054,7 +220042,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220054
220042
  const externalAgentPromises = Object.entries(typed.externalAgents).map(
220055
220043
  async ([externalAgentId, externalAgentData]) => {
220056
220044
  try {
220057
- logger11.info(
220045
+ logger10.info(
220058
220046
  { projectId: typed.id, externalAgentId },
220059
220047
  "Updating externalAgent in project"
220060
220048
  );
@@ -220065,12 +220053,12 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220065
220053
  projectId: typed.id
220066
220054
  }
220067
220055
  });
220068
- logger11.info(
220056
+ logger10.info(
220069
220057
  { projectId: typed.id, externalAgentId },
220070
220058
  "ExternalAgent updated successfully"
220071
220059
  );
220072
220060
  } catch (error) {
220073
- logger11.error(
220061
+ logger10.error(
220074
220062
  { projectId: typed.id, externalAgentId, error },
220075
220063
  "Failed to update externalAgent in project"
220076
220064
  );
@@ -220079,7 +220067,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220079
220067
  }
220080
220068
  );
220081
220069
  await Promise.all(externalAgentPromises);
220082
- logger11.info(
220070
+ logger10.info(
220083
220071
  {
220084
220072
  projectId: typed.id,
220085
220073
  count: Object.keys(typed.externalAgents).length
@@ -220088,7 +220076,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220088
220076
  );
220089
220077
  }
220090
220078
  if (typed.dataComponents && Object.keys(typed.dataComponents).length > 0) {
220091
- logger11.info(
220079
+ logger10.info(
220092
220080
  {
220093
220081
  projectId: typed.id,
220094
220082
  count: Object.keys(typed.dataComponents).length
@@ -220098,7 +220086,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220098
220086
  const dataComponentPromises = Object.entries(typed.dataComponents).map(
220099
220087
  async ([componentId, componentData]) => {
220100
220088
  try {
220101
- logger11.info(
220089
+ logger10.info(
220102
220090
  { projectId: typed.id, componentId },
220103
220091
  "Updating dataComponent in project"
220104
220092
  );
@@ -220109,12 +220097,12 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220109
220097
  projectId: typed.id
220110
220098
  }
220111
220099
  });
220112
- logger11.info(
220100
+ logger10.info(
220113
220101
  { projectId: typed.id, componentId },
220114
220102
  "DataComponent updated successfully"
220115
220103
  );
220116
220104
  } catch (error) {
220117
- logger11.error(
220105
+ logger10.error(
220118
220106
  { projectId: typed.id, componentId, error },
220119
220107
  "Failed to update dataComponent in project"
220120
220108
  );
@@ -220123,7 +220111,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220123
220111
  }
220124
220112
  );
220125
220113
  await Promise.all(dataComponentPromises);
220126
- logger11.info(
220114
+ logger10.info(
220127
220115
  {
220128
220116
  projectId: typed.id,
220129
220117
  count: Object.keys(typed.dataComponents).length
@@ -220132,7 +220120,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220132
220120
  );
220133
220121
  }
220134
220122
  if (typed.artifactComponents && Object.keys(typed.artifactComponents).length > 0) {
220135
- logger11.info(
220123
+ logger10.info(
220136
220124
  {
220137
220125
  projectId: typed.id,
220138
220126
  count: Object.keys(typed.artifactComponents).length
@@ -220142,7 +220130,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220142
220130
  const artifactComponentPromises = Object.entries(typed.artifactComponents).map(
220143
220131
  async ([componentId, componentData]) => {
220144
220132
  try {
220145
- logger11.info(
220133
+ logger10.info(
220146
220134
  { projectId: typed.id, componentId },
220147
220135
  "Updating artifactComponent in project"
220148
220136
  );
@@ -220153,12 +220141,12 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220153
220141
  projectId: typed.id
220154
220142
  }
220155
220143
  });
220156
- logger11.info(
220144
+ logger10.info(
220157
220145
  { projectId: typed.id, componentId },
220158
220146
  "ArtifactComponent updated successfully"
220159
220147
  );
220160
220148
  } catch (error) {
220161
- logger11.error(
220149
+ logger10.error(
220162
220150
  { projectId: typed.id, componentId, error },
220163
220151
  "Failed to update artifactComponent in project"
220164
220152
  );
@@ -220167,7 +220155,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220167
220155
  }
220168
220156
  );
220169
220157
  await Promise.all(artifactComponentPromises);
220170
- logger11.info(
220158
+ logger10.info(
220171
220159
  {
220172
220160
  projectId: typed.id,
220173
220161
  count: Object.keys(typed.artifactComponents).length
@@ -220185,14 +220173,14 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220185
220173
  try {
220186
220174
  await deleteFullAgent(
220187
220175
  db,
220188
- logger11
220176
+ logger10
220189
220177
  )({
220190
220178
  scopes: { tenantId, projectId: typed.id, agentId: agent.id }
220191
220179
  });
220192
220180
  deletedAgentCount++;
220193
- logger11.info({ agentId: agent.id }, "Deleted orphaned agent from project");
220181
+ logger10.info({ agentId: agent.id }, "Deleted orphaned agent from project");
220194
220182
  } catch (error) {
220195
- logger11.error(
220183
+ logger10.error(
220196
220184
  { agentId: agent.id, error },
220197
220185
  "Failed to delete orphaned agent from project"
220198
220186
  );
@@ -220200,7 +220188,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220200
220188
  }
220201
220189
  }
220202
220190
  if (deletedAgentCount > 0) {
220203
- logger11.info(
220191
+ logger10.info(
220204
220192
  {
220205
220193
  deletedAgentCount,
220206
220194
  projectId: typed.id
@@ -220209,7 +220197,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220209
220197
  );
220210
220198
  }
220211
220199
  if (typed.agents && Object.keys(typed.agents).length > 0) {
220212
- logger11.info(
220200
+ logger10.info(
220213
220201
  {
220214
220202
  projectId: typed.id,
220215
220203
  agentCount: Object.keys(typed.agents).length
@@ -220218,7 +220206,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220218
220206
  );
220219
220207
  const agentPromises = Object.entries(typed.agents).map(async ([agentId, agentData]) => {
220220
220208
  try {
220221
- logger11.info({ projectId: typed.id, agentId }, "Updating agent in project");
220209
+ logger10.info({ projectId: typed.id, agentId }, "Updating agent in project");
220222
220210
  const agentDataWithProjectResources = {
220223
220211
  ...agentData,
220224
220212
  tools: typed.tools || {},
@@ -220232,13 +220220,13 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220232
220220
  credentialReferences: typed.credentialReferences || {},
220233
220221
  statusUpdates: agentData.statusUpdates === null ? void 0 : agentData.statusUpdates
220234
220222
  };
220235
- await updateFullAgentServerSide(db, logger11)(
220223
+ await updateFullAgentServerSide(db, logger10)(
220236
220224
  { tenantId, projectId: typed.id },
220237
220225
  agentDataWithProjectResources
220238
220226
  );
220239
- logger11.info({ projectId: typed.id, agentId }, "Agent updated successfully in project");
220227
+ logger10.info({ projectId: typed.id, agentId }, "Agent updated successfully in project");
220240
220228
  } catch (error) {
220241
- logger11.error(
220229
+ logger10.error(
220242
220230
  { projectId: typed.id, agentId, error },
220243
220231
  "Failed to update agent in project"
220244
220232
  );
@@ -220246,7 +220234,7 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220246
220234
  }
220247
220235
  });
220248
220236
  await Promise.all(agentPromises);
220249
- logger11.info(
220237
+ logger10.info(
220250
220238
  {
220251
220239
  projectId: typed.id,
220252
220240
  agentCount: Object.keys(typed.agents).length
@@ -220254,15 +220242,15 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220254
220242
  "All project agent updated successfully"
220255
220243
  );
220256
220244
  }
220257
- logger11.info({ projectId: typed.id }, "Full project updated successfully");
220245
+ logger10.info({ projectId: typed.id }, "Full project updated successfully");
220258
220246
  return await getFullProject(
220259
220247
  db,
220260
- logger11
220248
+ logger10
220261
220249
  )({
220262
220250
  scopes: { tenantId, projectId: typed.id }
220263
220251
  });
220264
220252
  } catch (error) {
220265
- logger11.error(
220253
+ logger10.error(
220266
220254
  {
220267
220255
  tenantId,
220268
220256
  projectId: typed.id,
@@ -220273,23 +220261,23 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
220273
220261
  throw error;
220274
220262
  }
220275
220263
  };
220276
- var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220264
+ var getFullProject = (db, logger10 = defaultLogger2) => async (params) => {
220277
220265
  const { scopes } = params;
220278
220266
  const { tenantId, projectId } = scopes;
220279
- logger11.info({ tenantId, projectId }, "Retrieving full project definition");
220267
+ logger10.info({ tenantId, projectId }, "Retrieving full project definition");
220280
220268
  try {
220281
220269
  const project = await getProject(db)({
220282
220270
  scopes: { tenantId, projectId }
220283
220271
  });
220284
220272
  if (!project) {
220285
- logger11.info({ tenantId, projectId }, "Project not found");
220273
+ logger10.info({ tenantId, projectId }, "Project not found");
220286
220274
  return null;
220287
220275
  }
220288
- logger11.info({ tenantId, projectId }, "Project metadata retrieved");
220276
+ logger10.info({ tenantId, projectId }, "Project metadata retrieved");
220289
220277
  const agentList = await listAgents(db)({
220290
220278
  scopes: { tenantId, projectId }
220291
220279
  });
220292
- logger11.info(
220280
+ logger10.info(
220293
220281
  {
220294
220282
  tenantId,
220295
220283
  projectId,
@@ -220315,12 +220303,12 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220315
220303
  lastError: tool.lastError || void 0
220316
220304
  };
220317
220305
  }
220318
- logger11.info(
220306
+ logger10.info(
220319
220307
  { tenantId, projectId, toolCount: Object.keys(projectTools).length },
220320
220308
  "Tools retrieved for project"
220321
220309
  );
220322
220310
  } catch (error) {
220323
- logger11.warn({ tenantId, projectId, error }, "Failed to retrieve tools for project");
220311
+ logger10.warn({ tenantId, projectId, error }, "Failed to retrieve tools for project");
220324
220312
  }
220325
220313
  const projectExternalAgents = {};
220326
220314
  try {
@@ -220336,12 +220324,12 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220336
220324
  credentialReferenceId: externalAgent.credentialReferenceId || void 0
220337
220325
  };
220338
220326
  }
220339
- logger11.info(
220327
+ logger10.info(
220340
220328
  { tenantId, projectId, count: Object.keys(projectExternalAgents).length },
220341
220329
  "ExternalAgents retrieved for project"
220342
220330
  );
220343
220331
  } catch (error) {
220344
- logger11.warn(
220332
+ logger10.warn(
220345
220333
  { tenantId, projectId, error },
220346
220334
  "Failed to retrieve externalAgents for project"
220347
220335
  );
@@ -220360,12 +220348,12 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220360
220348
  render: component.render
220361
220349
  };
220362
220350
  }
220363
- logger11.info(
220351
+ logger10.info(
220364
220352
  { tenantId, projectId, count: Object.keys(projectDataComponents).length },
220365
220353
  "DataComponents retrieved for project"
220366
220354
  );
220367
220355
  } catch (error) {
220368
- logger11.warn(
220356
+ logger10.warn(
220369
220357
  { tenantId, projectId, error },
220370
220358
  "Failed to retrieve dataComponents for project"
220371
220359
  );
@@ -220383,12 +220371,12 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220383
220371
  props: component.props
220384
220372
  };
220385
220373
  }
220386
- logger11.info(
220374
+ logger10.info(
220387
220375
  { tenantId, projectId, count: Object.keys(projectArtifactComponents).length },
220388
220376
  "ArtifactComponents retrieved for project"
220389
220377
  );
220390
220378
  } catch (error) {
220391
- logger11.warn(
220379
+ logger10.warn(
220392
220380
  { tenantId, projectId, error },
220393
220381
  "Failed to retrieve artifactComponents for project"
220394
220382
  );
@@ -220407,12 +220395,12 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220407
220395
  retrievalParams: credential.retrievalParams
220408
220396
  };
220409
220397
  }
220410
- logger11.info(
220398
+ logger10.info(
220411
220399
  { tenantId, projectId, count: Object.keys(projectCredentialReferences).length },
220412
220400
  "CredentialReferences retrieved for project"
220413
220401
  );
220414
220402
  } catch (error) {
220415
- logger11.warn(
220403
+ logger10.warn(
220416
220404
  { tenantId, projectId, error },
220417
220405
  "Failed to retrieve credentialReferences for project"
220418
220406
  );
@@ -220438,12 +220426,12 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220438
220426
  dependencies: item.dependencies
220439
220427
  };
220440
220428
  }
220441
- logger11.info(
220429
+ logger10.info(
220442
220430
  { tenantId, projectId, functionCount: Object.keys(projectFunctions).length },
220443
220431
  "Function tools with function data retrieved for project"
220444
220432
  );
220445
220433
  } catch (error) {
220446
- logger11.warn(
220434
+ logger10.warn(
220447
220435
  { tenantId, projectId, error },
220448
220436
  "Failed to retrieve function tools for project"
220449
220437
  );
@@ -220452,7 +220440,7 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220452
220440
  if (agentList.length > 0) {
220453
220441
  const agentPromises = agentList.map(async (agent) => {
220454
220442
  try {
220455
- logger11.info(
220443
+ logger10.info(
220456
220444
  { tenantId, projectId, agentId: agent.id },
220457
220445
  "Retrieving full agent definition"
220458
220446
  );
@@ -220461,15 +220449,15 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220461
220449
  });
220462
220450
  if (fullAgent) {
220463
220451
  agents2[agent.id] = fullAgent;
220464
- logger11.info(
220452
+ logger10.info(
220465
220453
  { tenantId, projectId, agentId: agent.id },
220466
220454
  "Full agent definition retrieved"
220467
220455
  );
220468
220456
  } else {
220469
- logger11.warn({ tenantId, projectId, agentId: agent.id }, "Agent definition not found");
220457
+ logger10.warn({ tenantId, projectId, agentId: agent.id }, "Agent definition not found");
220470
220458
  }
220471
220459
  } catch (error) {
220472
- logger11.error(
220460
+ logger10.error(
220473
220461
  { tenantId, projectId, agentId: agent.id, error },
220474
220462
  "Failed to retrieve full agent definition"
220475
220463
  );
@@ -220498,7 +220486,7 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220498
220486
  createdAt: project.createdAt,
220499
220487
  updatedAt: project.updatedAt
220500
220488
  };
220501
- logger11.info(
220489
+ logger10.info(
220502
220490
  {
220503
220491
  tenantId,
220504
220492
  projectId,
@@ -220508,7 +220496,7 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220508
220496
  );
220509
220497
  return fullProjectDefinition;
220510
220498
  } catch (error) {
220511
- logger11.error(
220499
+ logger10.error(
220512
220500
  {
220513
220501
  tenantId,
220514
220502
  projectId,
@@ -220519,23 +220507,23 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220519
220507
  throw error;
220520
220508
  }
220521
220509
  };
220522
- var deleteFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220510
+ var deleteFullProject = (db, logger10 = defaultLogger2) => async (params) => {
220523
220511
  const { scopes } = params;
220524
220512
  const { tenantId, projectId } = scopes;
220525
- logger11.info({ tenantId, projectId }, "Deleting full project and related entities");
220513
+ logger10.info({ tenantId, projectId }, "Deleting full project and related entities");
220526
220514
  try {
220527
220515
  const project = await getFullProject(
220528
220516
  db,
220529
- logger11
220517
+ logger10
220530
220518
  )({
220531
220519
  scopes: { tenantId, projectId }
220532
220520
  });
220533
220521
  if (!project) {
220534
- logger11.info({ tenantId, projectId }, "Project not found for deletion");
220522
+ logger10.info({ tenantId, projectId }, "Project not found for deletion");
220535
220523
  return false;
220536
220524
  }
220537
220525
  if (project.agents && Object.keys(project.agents).length > 0) {
220538
- logger11.info(
220526
+ logger10.info(
220539
220527
  {
220540
220528
  tenantId,
220541
220529
  projectId,
@@ -220545,19 +220533,19 @@ var deleteFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220545
220533
  );
220546
220534
  const agentPromises = Object.keys(project.agents).map(async (agentId) => {
220547
220535
  try {
220548
- logger11.info({ tenantId, projectId, agentId }, "Deleting agent from project");
220536
+ logger10.info({ tenantId, projectId, agentId }, "Deleting agent from project");
220549
220537
  await deleteFullAgent(
220550
220538
  db,
220551
- logger11
220539
+ logger10
220552
220540
  )({
220553
220541
  scopes: { tenantId, projectId, agentId }
220554
220542
  });
220555
- logger11.info(
220543
+ logger10.info(
220556
220544
  { tenantId, projectId, agentId },
220557
220545
  "Agent deleted successfully from project"
220558
220546
  );
220559
220547
  } catch (error) {
220560
- logger11.error(
220548
+ logger10.error(
220561
220549
  { tenantId, projectId, agentId, error },
220562
220550
  "Failed to delete agent from project"
220563
220551
  );
@@ -220565,7 +220553,7 @@ var deleteFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220565
220553
  }
220566
220554
  });
220567
220555
  await Promise.all(agentPromises);
220568
- logger11.info(
220556
+ logger10.info(
220569
220557
  {
220570
220558
  tenantId,
220571
220559
  projectId,
@@ -220578,13 +220566,13 @@ var deleteFullProject = (db, logger11 = defaultLogger2) => async (params) => {
220578
220566
  scopes: { tenantId, projectId }
220579
220567
  });
220580
220568
  if (!deleted) {
220581
- logger11.warn({ tenantId, projectId }, "Project deletion returned false");
220569
+ logger10.warn({ tenantId, projectId }, "Project deletion returned false");
220582
220570
  return false;
220583
220571
  }
220584
- logger11.info({ tenantId, projectId }, "Full project deleted successfully");
220572
+ logger10.info({ tenantId, projectId }, "Full project deleted successfully");
220585
220573
  return true;
220586
220574
  } catch (error) {
220587
- logger11.error(
220575
+ logger10.error(
220588
220576
  {
220589
220577
  tenantId,
220590
220578
  projectId,
@@ -222049,763 +222037,6 @@ async function handleContextResolution({
222049
222037
  }
222050
222038
  );
222051
222039
  }
222052
-
222053
- // src/credential-stores/CredentialStoreRegistry.ts
222054
- var CredentialStoreRegistry = class {
222055
- stores = /* @__PURE__ */ new Map();
222056
- logger = getLogger("credential-store-registry");
222057
- constructor(initialStores = []) {
222058
- for (const store of initialStores) {
222059
- this.add(store);
222060
- }
222061
- }
222062
- /**
222063
- * Add a credential store to the registry
222064
- */
222065
- add(store) {
222066
- if (this.stores.has(store.id)) {
222067
- this.logger.warn(
222068
- { storeId: store.id },
222069
- `Credential store ${store.id} already registered, replacing`
222070
- );
222071
- }
222072
- this.stores.set(store.id, store);
222073
- this.logger.info(
222074
- { storeId: store.id, storeType: store.type },
222075
- `Registered credential store: ${store.id} (type: ${store.type})`
222076
- );
222077
- }
222078
- /**
222079
- * Get a credential store by ID
222080
- */
222081
- get(id) {
222082
- return this.stores.get(id);
222083
- }
222084
- /**
222085
- * Get all registered credential stores
222086
- */
222087
- getAll() {
222088
- return Array.from(this.stores.values());
222089
- }
222090
- /**
222091
- * Get all credential store IDs
222092
- */
222093
- getIds() {
222094
- return Array.from(this.stores.keys());
222095
- }
222096
- /**
222097
- * Check if a credential store is registered
222098
- */
222099
- has(id) {
222100
- return this.stores.has(id);
222101
- }
222102
- /**
222103
- * Remove a credential store
222104
- */
222105
- remove(id) {
222106
- const removed = this.stores.delete(id);
222107
- if (removed) {
222108
- this.logger.info({ id }, `Removed credential store: ${id}`);
222109
- }
222110
- return removed;
222111
- }
222112
- /**
222113
- * Get the number of registered stores
222114
- */
222115
- size() {
222116
- return this.stores.size;
222117
- }
222118
- };
222119
-
222120
- // src/credential-stores/keychain-store.ts
222121
- var KeyChainStore = class {
222122
- id;
222123
- type = CredentialStoreType.keychain;
222124
- service;
222125
- logger = getLogger("KeyChainStore");
222126
- keytarAvailable = false;
222127
- keytar = null;
222128
- initializationPromise;
222129
- constructor(id, servicePrefix = "inkeep-agent-framework") {
222130
- this.id = id;
222131
- this.service = `${servicePrefix}-${id}`;
222132
- this.initializationPromise = this.initializeKeytar();
222133
- }
222134
- /**
222135
- * Initialize keytar dynamically to handle optional availability
222136
- */
222137
- async initializeKeytar() {
222138
- if (this.keytar) {
222139
- this.keytarAvailable = true;
222140
- return;
222141
- }
222142
- try {
222143
- this.keytar = (await import('keytar')).default;
222144
- this.keytarAvailable = true;
222145
- this.logger.info(
222146
- {
222147
- storeId: this.id,
222148
- service: this.service
222149
- },
222150
- "Keytar initialized successfully"
222151
- );
222152
- } catch (error) {
222153
- this.logger.warn(
222154
- {
222155
- storeId: this.id,
222156
- error: error instanceof Error ? error.message : "Unknown error"
222157
- },
222158
- "Keytar not available - KeyChainStore will return null for all operations"
222159
- );
222160
- this.keytarAvailable = false;
222161
- }
222162
- }
222163
- /**
222164
- * Get a credential from the keychain
222165
- */
222166
- async get(key) {
222167
- await this.initializationPromise;
222168
- if (!this.keytarAvailable || !this.keytar) {
222169
- this.logger.debug({ storeId: this.id, key }, "Keytar not available, returning null");
222170
- return null;
222171
- }
222172
- try {
222173
- const password = await this.keytar.getPassword(this.service, key);
222174
- if (password === null) {
222175
- this.logger.debug(
222176
- { storeId: this.id, service: this.service, account: key },
222177
- "No credential found in keychain"
222178
- );
222179
- }
222180
- return password;
222181
- } catch (error) {
222182
- this.logger.error(
222183
- {
222184
- storeId: this.id,
222185
- service: this.service,
222186
- account: key,
222187
- error: error instanceof Error ? error.message : "Unknown error"
222188
- },
222189
- "Error getting credential from keychain"
222190
- );
222191
- return null;
222192
- }
222193
- }
222194
- /**
222195
- * Set a credential in the keychain
222196
- * @param metadata - Optional metadata (ignored by keychain store)
222197
- */
222198
- async set(key, value, _metadata) {
222199
- await this.initializationPromise;
222200
- if (!this.keytarAvailable || !this.keytar) {
222201
- this.logger.warn({ storeId: this.id, key }, "Keytar not available, cannot set credential");
222202
- throw new Error("Keytar not available - cannot store credentials in system keychain");
222203
- }
222204
- try {
222205
- await this.keytar.setPassword(this.service, key, value);
222206
- this.logger.debug(
222207
- { storeId: this.id, service: this.service, account: key },
222208
- "Credential stored in keychain"
222209
- );
222210
- } catch (error) {
222211
- this.logger.error(
222212
- {
222213
- storeId: this.id,
222214
- service: this.service,
222215
- account: key,
222216
- error: error instanceof Error ? error.message : "Unknown error"
222217
- },
222218
- "Error setting credential in keychain"
222219
- );
222220
- throw new Error(
222221
- `Failed to store credential in keychain: ${error instanceof Error ? error.message : "Unknown error"}`
222222
- );
222223
- }
222224
- }
222225
- /**
222226
- * Check if a credential exists in the keychain
222227
- */
222228
- async has(key) {
222229
- const credential = await this.get(key);
222230
- return credential !== null;
222231
- }
222232
- /**
222233
- * Check if the credential store is available and functional
222234
- */
222235
- async checkAvailability() {
222236
- await this.initializationPromise;
222237
- if (!this.keytarAvailable || !this.keytar) {
222238
- return {
222239
- available: false,
222240
- reason: "Keytar not available - cannot store credentials in system keychain"
222241
- };
222242
- }
222243
- return {
222244
- available: true
222245
- };
222246
- }
222247
- /**
222248
- * Delete a credential from the keychain
222249
- */
222250
- async delete(key) {
222251
- await this.initializationPromise;
222252
- if (!this.keytarAvailable || !this.keytar) {
222253
- this.logger.warn({ storeId: this.id, key }, "Keytar not available, cannot delete credential");
222254
- return false;
222255
- }
222256
- try {
222257
- const result = await this.keytar.deletePassword(this.service, key);
222258
- if (result) {
222259
- this.logger.debug(
222260
- { storeId: this.id, service: this.service, account: key },
222261
- "Credential deleted from keychain"
222262
- );
222263
- } else {
222264
- this.logger.debug(
222265
- { storeId: this.id, service: this.service, account: key },
222266
- "Credential not found in keychain for deletion"
222267
- );
222268
- }
222269
- return result;
222270
- } catch (error) {
222271
- this.logger.error(
222272
- {
222273
- storeId: this.id,
222274
- service: this.service,
222275
- account: key,
222276
- error: error instanceof Error ? error.message : "Unknown error"
222277
- },
222278
- "Error deleting credential from keychain"
222279
- );
222280
- return false;
222281
- }
222282
- }
222283
- /**
222284
- * Find all credentials for this service
222285
- * Useful for debugging and listing stored credentials
222286
- */
222287
- async findAllCredentials() {
222288
- await this.initializationPromise;
222289
- if (!this.keytarAvailable || !this.keytar) {
222290
- return [];
222291
- }
222292
- try {
222293
- const credentials = await this.keytar.findCredentials(this.service);
222294
- return credentials || [];
222295
- } catch (error) {
222296
- this.logger.error(
222297
- {
222298
- storeId: this.id,
222299
- service: this.service,
222300
- error: error instanceof Error ? error.message : "Unknown error"
222301
- },
222302
- "Error finding credentials in keychain"
222303
- );
222304
- return [];
222305
- }
222306
- }
222307
- /**
222308
- * Clear all credentials for this service
222309
- * WARNING: This will delete all credentials stored under this service
222310
- */
222311
- async clearAll() {
222312
- const credentials = await this.findAllCredentials();
222313
- let deletedCount = 0;
222314
- for (const cred of credentials) {
222315
- const deleted = await this.delete(cred.account);
222316
- if (deleted) {
222317
- deletedCount++;
222318
- }
222319
- }
222320
- if (deletedCount > 0) {
222321
- this.logger.info(
222322
- {
222323
- storeId: this.id,
222324
- service: this.service,
222325
- deletedCount
222326
- },
222327
- "Cleared all credentials from keychain"
222328
- );
222329
- }
222330
- return deletedCount;
222331
- }
222332
- };
222333
- function createKeyChainStore(id, options) {
222334
- return new KeyChainStore(id, options?.servicePrefix);
222335
- }
222336
-
222337
- // src/credential-stores/memory-store.ts
222338
- var InMemoryCredentialStore = class {
222339
- id;
222340
- type = CredentialStoreType.memory;
222341
- credentials = /* @__PURE__ */ new Map();
222342
- constructor(id = "memory-default") {
222343
- this.id = id;
222344
- }
222345
- /**
222346
- * Get a credential from the in memory store.
222347
- * If the key is not found in the in memory store then it is loaded from environment variables.
222348
- * If the key is not found in the environment variables or in the in memory store then returns null.
222349
- * @param key - The key of the credential to get
222350
- * @returns The credential value or null if not found
222351
- */
222352
- async get(key) {
222353
- const credential = this.credentials.get(key);
222354
- if (!credential) {
222355
- const envValue = process.env[key];
222356
- if (envValue) {
222357
- this.credentials.set(key, envValue);
222358
- return envValue;
222359
- }
222360
- return null;
222361
- }
222362
- return credential;
222363
- }
222364
- /**
222365
- * Set a credential in the in memory store.
222366
- * @param key - The key of the credential to set
222367
- * @param value - The value of the credential to set
222368
- * @param metadata - Optional metadata (ignored by memory store)
222369
- */
222370
- async set(key, value, _metadata) {
222371
- this.credentials.set(key, value);
222372
- }
222373
- /**
222374
- * Check if a credential exists in the in memory store.
222375
- * @param key - The key of the credential to check
222376
- * @returns True if the credential exists, false otherwise
222377
- */
222378
- async has(key) {
222379
- return this.credentials.has(key);
222380
- }
222381
- /**
222382
- * Delete a credential from the in memory store.
222383
- * @param key - The key of the credential to delete
222384
- * @returns True if the credential was deleted, false otherwise
222385
- */
222386
- async delete(key) {
222387
- return this.credentials.delete(key);
222388
- }
222389
- /**
222390
- * Check if the credential store is available and functional
222391
- */
222392
- async checkAvailability() {
222393
- return {
222394
- available: true
222395
- };
222396
- }
222397
- };
222398
- var logger10 = getLogger("nango-credential-store");
222399
- var CredentialKeySchema = z.object({
222400
- connectionId: z.string().min(1, "connectionId must be a non-empty string"),
222401
- providerConfigKey: z.string().min(1, "providerConfigKey must be a non-empty string"),
222402
- integrationDisplayName: z.string().nullish()
222403
- });
222404
- function parseCredentialKey(key) {
222405
- try {
222406
- const parsed = JSON.parse(key);
222407
- return CredentialKeySchema.parse(parsed);
222408
- } catch (error) {
222409
- logger10.warn(
222410
- {
222411
- key: key.substring(0, 100),
222412
- error: error instanceof Error ? error.message : "Unknown error"
222413
- },
222414
- "Failed to parse credential key"
222415
- );
222416
- return null;
222417
- }
222418
- }
222419
- var SUPPORTED_AUTH_MODES = [
222420
- "APP",
222421
- "API_KEY",
222422
- "BASIC",
222423
- "CUSTOM",
222424
- "JWT",
222425
- "NONE",
222426
- "OAUTH1",
222427
- "OAUTH2",
222428
- "OAUTH2_CC",
222429
- "TBA"
222430
- ];
222431
- function isSupportedAuthMode(mode) {
222432
- return SUPPORTED_AUTH_MODES.includes(mode);
222433
- }
222434
- var NangoCredentialStore = class {
222435
- id;
222436
- type = CredentialStoreType.nango;
222437
- nangoConfig;
222438
- nangoClient;
222439
- constructor(id, config) {
222440
- this.id = id;
222441
- this.nangoConfig = config;
222442
- this.nangoClient = new Nango({
222443
- secretKey: this.nangoConfig.secretKey,
222444
- host: this.nangoConfig.apiUrl
222445
- });
222446
- }
222447
- getAccessToken(credentials) {
222448
- const { type } = credentials;
222449
- if (!isSupportedAuthMode(type)) {
222450
- return null;
222451
- }
222452
- const extractAccessTokenForBearerType = (tokenString) => {
222453
- if (tokenString && typeof tokenString === "string") {
222454
- try {
222455
- const parsedToken = JSON.parse(tokenString);
222456
- if (parsedToken.access_token && typeof parsedToken.access_token === "string") {
222457
- return parsedToken.access_token;
222458
- }
222459
- } catch {
222460
- }
222461
- return tokenString;
222462
- }
222463
- return void 0;
222464
- };
222465
- switch (type) {
222466
- case "API_KEY":
222467
- return {
222468
- token: extractAccessTokenForBearerType(
222469
- credentials.apiKey || credentials.api_key
222470
- )
222471
- };
222472
- case "APP":
222473
- return {
222474
- token: extractAccessTokenForBearerType(
222475
- credentials.accessToken || credentials.access_token
222476
- )
222477
- };
222478
- case "BASIC":
222479
- return {
222480
- username: credentials.username,
222481
- token: credentials.password
222482
- };
222483
- case "CUSTOM":
222484
- return credentials.raw;
222485
- case "JWT":
222486
- return {
222487
- token: extractAccessTokenForBearerType(credentials.token)
222488
- };
222489
- case "OAUTH1":
222490
- return {
222491
- token: credentials.oauth_token,
222492
- token_secret: credentials.oauth_token_secret
222493
- };
222494
- case "OAUTH2":
222495
- return {
222496
- token: extractAccessTokenForBearerType(credentials.access_token),
222497
- refresh_token: credentials.refresh_token,
222498
- expiresAt: credentials.expires_at
222499
- };
222500
- case "OAUTH2_CC":
222501
- return {
222502
- token: extractAccessTokenForBearerType(credentials.token),
222503
- client_certificate: credentials.client_certificate,
222504
- client_id: credentials.client_id,
222505
- client_private_key: credentials.client_private_key,
222506
- client_secret: credentials.client_secret
222507
- };
222508
- case "TBA":
222509
- return {
222510
- token: credentials.token_id,
222511
- token_secret: credentials.token_secret
222512
- };
222513
- default:
222514
- return null;
222515
- }
222516
- }
222517
- sanitizeMetadata(metadata) {
222518
- if (!metadata || typeof metadata !== "object") return {};
222519
- const result = {};
222520
- for (const [key, value] of Object.entries(metadata)) {
222521
- if (typeof key !== "string") continue;
222522
- if (typeof value === "string") {
222523
- result[key] = value;
222524
- }
222525
- }
222526
- return result;
222527
- }
222528
- /**
222529
- * Fetch a specific Nango integration
222530
- */
222531
- async fetchNangoIntegration(uniqueKey) {
222532
- try {
222533
- const response = await this.nangoClient.getIntegration(
222534
- { uniqueKey },
222535
- { include: ["credentials"] }
222536
- );
222537
- const integration = response.data;
222538
- let areCredentialsSet = false;
222539
- if (integration.credentials?.type === "OAUTH2" || integration.credentials?.type === "OAUTH1" || integration.credentials?.type === "TBA") {
222540
- areCredentialsSet = !!(integration.credentials?.client_id && integration.credentials?.client_secret);
222541
- } else if (integration.credentials?.type === "APP") {
222542
- areCredentialsSet = !!(integration.credentials?.app_id && integration.credentials?.app_link);
222543
- } else {
222544
- areCredentialsSet = true;
222545
- }
222546
- const { credentials: _credentials, ...integrationWithoutCredentials } = integration;
222547
- return {
222548
- ...integrationWithoutCredentials,
222549
- areCredentialsSet
222550
- };
222551
- } catch (error) {
222552
- if (error && typeof error === "object" && "status" in error && error.status === 404) {
222553
- return null;
222554
- }
222555
- logger10.error(
222556
- { error: error instanceof Error ? error.message : "Unknown error", uniqueKey },
222557
- `Failed to fetch integration ${uniqueKey}`
222558
- );
222559
- return null;
222560
- }
222561
- }
222562
- /**
222563
- * Create an API key credential by setting up Nango integration and importing the connection
222564
- */
222565
- async createNangoApiKeyConnection({
222566
- uniqueKey,
222567
- displayName,
222568
- apiKeyToSet,
222569
- metadata
222570
- }) {
222571
- const provider = "private-api-bearer";
222572
- try {
222573
- let integration;
222574
- try {
222575
- const response2 = await this.nangoClient.createIntegration({
222576
- provider,
222577
- unique_key: uniqueKey,
222578
- display_name: displayName
222579
- });
222580
- integration = response2.data;
222581
- } catch (error) {
222582
- const existingIntegration = await this.fetchNangoIntegration(uniqueKey);
222583
- if (existingIntegration) {
222584
- integration = existingIntegration;
222585
- } else {
222586
- console.log(`Integration creation failed for unexpected reasons`, error);
222587
- }
222588
- }
222589
- if (!integration) {
222590
- throw new Error(`Integration '${uniqueKey}' not found`);
222591
- }
222592
- const importConnectionUrl = `${process.env.NANGO_SERVER_URL || "https://api.nango.dev"}/connections`;
222593
- const credentials = {
222594
- type: "API_KEY",
222595
- apiKey: apiKeyToSet
222596
- };
222597
- const body = {
222598
- provider_config_key: integration.unique_key,
222599
- connection_id: uniqueKey,
222600
- metadata,
222601
- credentials
222602
- };
222603
- const response = await fetch(importConnectionUrl, {
222604
- method: "POST",
222605
- headers: {
222606
- Authorization: `Bearer ${process.env.NANGO_SECRET_KEY}`,
222607
- "Content-Type": "application/json"
222608
- },
222609
- body: JSON.stringify(body)
222610
- });
222611
- if (!response.ok) {
222612
- const errorText = await response.text();
222613
- throw new Error(
222614
- `Failed to import connection: HTTP ${response.status} - ${response.statusText}. Response: ${errorText}`
222615
- );
222616
- }
222617
- } catch (error) {
222618
- logger10.error(
222619
- {
222620
- error: error instanceof Error ? error.message : "Unknown error",
222621
- displayName
222622
- },
222623
- `Unexpected error creating API key credential '${displayName}'`
222624
- );
222625
- throw new Error(
222626
- `Failed to create API key credential '${displayName}': ${error instanceof Error ? error.message : "Unknown error"}`
222627
- );
222628
- }
222629
- }
222630
- /**
222631
- * Fetch credentials from Nango API using connection information
222632
- * @param connectionId - The connection ID for the Nango connection
222633
- * @param providerConfigKey - The provider config key for the Nango connection
222634
- * @returns The credential data or null if the credentials are not found
222635
- */
222636
- async fetchCredentialsFromNango({
222637
- connectionId,
222638
- providerConfigKey
222639
- }) {
222640
- try {
222641
- const nangoConnection = await this.nangoClient.getConnection(providerConfigKey, connectionId);
222642
- const tokenAndCredentials = this.getAccessToken(nangoConnection.credentials) ?? {};
222643
- const credentialData = {
222644
- ...tokenAndCredentials,
222645
- connectionId,
222646
- providerConfigKey,
222647
- provider: nangoConnection.provider || "unknown",
222648
- secretKey: this.nangoConfig.secretKey,
222649
- metadata: this.sanitizeMetadata(nangoConnection.metadata ?? {})
222650
- };
222651
- return credentialData;
222652
- } catch (error) {
222653
- logger10.error(
222654
- {
222655
- error: error instanceof Error ? error.message : "Unknown error",
222656
- connectionId,
222657
- providerConfigKey
222658
- },
222659
- "Error fetching credentials from Nango"
222660
- );
222661
- return null;
222662
- }
222663
- }
222664
- /**
222665
- * Get credentials by key - implements CredentialStore interface
222666
- * Key format: JSON string with connectionId and providerConfigKey
222667
- */
222668
- async get(key) {
222669
- try {
222670
- const parsedKey = parseCredentialKey(key);
222671
- if (!parsedKey) {
222672
- return null;
222673
- }
222674
- const { connectionId, providerConfigKey } = parsedKey;
222675
- const credentials = await this.fetchCredentialsFromNango({ connectionId, providerConfigKey });
222676
- if (!credentials) {
222677
- return null;
222678
- }
222679
- const credentialString = JSON.stringify(credentials);
222680
- return credentialString;
222681
- } catch (error) {
222682
- logger10.error(
222683
- {
222684
- storeId: this.id,
222685
- key: key.substring(0, 100),
222686
- error: error instanceof Error ? error.message : "Unknown error"
222687
- },
222688
- "Error getting credentials from Nango"
222689
- );
222690
- return null;
222691
- }
222692
- }
222693
- /**
222694
- * Set credentials - this is used to save bearer auth
222695
- * Key format: JSON string with connectionId and providerConfigKey
222696
- */
222697
- async set(key, value, metadata = {}) {
222698
- const parsedKey = parseCredentialKey(key);
222699
- if (!parsedKey) {
222700
- throw new Error(`Invalid credential key: ${key}`);
222701
- }
222702
- const { connectionId, providerConfigKey, integrationDisplayName } = parsedKey;
222703
- await this.createNangoApiKeyConnection({
222704
- uniqueKey: connectionId,
222705
- displayName: integrationDisplayName ?? providerConfigKey,
222706
- apiKeyToSet: value,
222707
- metadata
222708
- });
222709
- }
222710
- /**
222711
- * Check if credentials exist by attempting to fetch them
222712
- */
222713
- async has(key) {
222714
- try {
222715
- const credentials = await this.get(key);
222716
- return credentials !== null;
222717
- } catch (error) {
222718
- logger10.error(
222719
- {
222720
- error: error instanceof Error ? error.message : "Unknown error",
222721
- key
222722
- },
222723
- "Error checking credentials existence"
222724
- );
222725
- return false;
222726
- }
222727
- }
222728
- /**
222729
- * Delete credentials - not supported for Nango (revoke through Nango dashboard)
222730
- */
222731
- async delete(key) {
222732
- try {
222733
- const parsedKey = parseCredentialKey(key);
222734
- if (!parsedKey) {
222735
- return false;
222736
- }
222737
- const { connectionId, providerConfigKey } = parsedKey;
222738
- await this.nangoClient.deleteConnection(providerConfigKey, connectionId);
222739
- return true;
222740
- } catch (error) {
222741
- logger10.error(
222742
- {
222743
- storeId: this.id,
222744
- key: key.substring(0, 100),
222745
- error: error instanceof Error ? error.message : "Unknown error"
222746
- },
222747
- "Error deleting credentials from Nango"
222748
- );
222749
- return false;
222750
- }
222751
- }
222752
- /**
222753
- * Check if the credential store is available and functional
222754
- */
222755
- async checkAvailability() {
222756
- if (!this.nangoConfig.secretKey) {
222757
- return {
222758
- available: false,
222759
- reason: "Nango secret key not configured"
222760
- };
222761
- }
222762
- if (this.nangoConfig.secretKey.includes("mock") || this.nangoConfig.secretKey === "your_nango_secret_key") {
222763
- return {
222764
- available: false,
222765
- reason: "Nango secret key appears to be a placeholder or mock value"
222766
- };
222767
- }
222768
- return {
222769
- available: true
222770
- };
222771
- }
222772
- };
222773
- function createNangoCredentialStore(id, config) {
222774
- const nangoSecretKey = config?.secretKey || process.env.NANGO_SECRET_KEY;
222775
- if (!nangoSecretKey || nangoSecretKey === "your_nango_secret_key" || nangoSecretKey.includes("mock")) {
222776
- throw new Error(
222777
- "NANGO_SECRET_KEY environment variable is required and must be a real Nango secret key (not mock/placeholder)"
222778
- );
222779
- }
222780
- return new NangoCredentialStore(id, {
222781
- apiUrl: "https://api.nango.dev",
222782
- ...config,
222783
- secretKey: nangoSecretKey
222784
- });
222785
- }
222786
-
222787
- // src/credential-stores/defaults.ts
222788
- function createDefaultCredentialStores() {
222789
- const stores = [];
222790
- stores.push(new InMemoryCredentialStore("memory-default"));
222791
- if (process.env.NANGO_SECRET_KEY) {
222792
- stores.push(
222793
- createNangoCredentialStore("nango-default", {
222794
- apiUrl: process.env.NANGO_SERVER_URL || "https://api.nango.dev",
222795
- secretKey: process.env.NANGO_SECRET_KEY
222796
- })
222797
- );
222798
- }
222799
- try {
222800
- stores.push(createKeyChainStore("keychain-default"));
222801
- } catch (error) {
222802
- console.warn(
222803
- "Failed to create keychain store:",
222804
- error instanceof Error ? error.message : error
222805
- );
222806
- }
222807
- return stores;
222808
- }
222809
222040
  /*! Bundled license information:
222810
222041
 
222811
222042
  typescript/lib/typescript.js:
@@ -222825,4 +222056,4 @@ typescript/lib/typescript.js:
222825
222056
  ***************************************************************************** *)
222826
222057
  */
222827
222058
 
222828
- export { AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT, AGENT_EXECUTION_TRANSFER_COUNT_MAX, AGENT_EXECUTION_TRANSFER_COUNT_MIN, CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT, ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, NangoCredentialStore, 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, TemplateEngine, VALIDATION_AGENT_PROMPT_MAX_CHARS, VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS, addFunctionToolToSubAgent, addLedgerArtifacts, addToolToAgent, addUserToOrganization, agentHasArtifactComponents, apiFetch, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentToolRelation, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExternalAgent, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createKeyChainStore, createMessage, createNangoCredentialStore, 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, externalAgentExists, externalAgentUrlExists, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, 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, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFullAgent, getFullAgentDefinition, getFullProject, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getMessageById, getMessagesByConversation, getMessagesByTask, getPendingInvitationsByEmail, getProject, getProjectResourceCounts, getRelatedAgentsForAgent, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getUserByEmail, getUserById, getUserOrganizations, getVisibleMessages, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, headers, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, 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, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, 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, validateHeaders, validateHttpRequestHeaders, validateProjectExists, validateSubAgent, validationHelper, withProjectValidation };
222059
+ export { ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStuffer, HTTP_REQUEST_PARTS, TemplateEngine, addFunctionToolToSubAgent, addLedgerArtifacts, addToolToAgent, addUserToOrganization, agentHasArtifactComponents, apiFetch, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentToolRelation, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, 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, externalAgentExists, externalAgentUrlExists, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, 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, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFullAgent, getFullAgentDefinition, getFullProject, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getMessageById, getMessagesByConversation, getMessagesByTask, getPendingInvitationsByEmail, getProject, getProjectResourceCounts, getRelatedAgentsForAgent, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getUserByEmail, getUserById, getUserOrganizations, getVisibleMessages, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, headers, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, 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, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, 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, validateHeaders, validateHttpRequestHeaders, validateProjectExists, validateSubAgent, validationHelper, withProjectValidation };