@inkeep/agents-core 0.8.0 → 0.8.2

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.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { k as CredentialReferenceApiInsert, l as ContextConfigSelect, e as ContextFetchDefinition, M as MCPTransportType, m as MCPToolConfig, n as GraphScopeConfig, C as ConversationHistoryConfig, o as ProjectScopeConfig, p as PaginationConfig, q as AgentGraphInsert, r as AgentGraphUpdate, s as FullGraphDefinition, t as AgentScopeConfig, u as AgentRelationInsert, E as ExternalAgentRelationInsert, v as AgentRelationUpdate, w as AgentToolRelationUpdate, f as ToolMcpConfig, g as ToolServerCapabilities, x as AgentInsert, y as AgentUpdate, z as AgentSelect, B as ApiKeySelect, D as ApiKeyInsert, H as ApiKeyUpdate, I as CreateApiKeyParams, J as ApiKeyCreateResult, K as ArtifactComponentSelect, L as ArtifactComponentInsert, N as ArtifactComponentUpdate, O as ContextCacheSelect, Q as ContextCacheInsert, R as ContextConfigInsert, U as ContextConfigUpdate, V as ConversationSelect, W as ConversationInsert, h as ConversationMetadata, X as ConversationUpdate, Y as CredentialReferenceSelect, Z as ToolSelect, _ as CredentialReferenceInsert, $ as CredentialReferenceUpdate, a0 as DataComponentSelect, a1 as DataComponentInsert, a2 as DataComponentUpdate, a3 as ExternalAgentInsert, a4 as ExternalAgentSelect, a5 as ExternalAgentUpdate, a6 as Artifact, a7 as LedgerArtifactSelect, j as MessageMetadata, i as MessageContent, a8 as MessageVisibility, a9 as MessageInsert, aa as MessageUpdate, ab as FullProjectDefinition, ac as ProjectInfo, ad as ProjectSelect, ae as PaginationResult, af as ProjectResourceCounts, ag as ProjectInsert, ah as ProjectUpdate, ai as TaskInsert, T as TaskMetadataConfig, aj as TaskSelect, ak as McpTool, al as ToolInsert, am as ToolUpdate, d as CredentialStoreType, an as ExecutionContext } from './utility-CT2pq49U.cjs';
3
- export { a$ as A2AError, bv as A2ARequest, bw as A2AResponse, aA as APIKeySecurityScheme, bA as AgentApiInsert, ds as AgentApiInsertSchema, bz as AgentApiSelect, dr as AgentApiSelectSchema, bB as AgentApiUpdate, dt as AgentApiUpdateSchema, ct as AgentArtifactComponentApiInsert, eD as AgentArtifactComponentApiInsertSchema, cs as AgentArtifactComponentApiSelect, eC as AgentArtifactComponentApiSelectSchema, cu as AgentArtifactComponentApiUpdate, eE as AgentArtifactComponentApiUpdateSchema, cq as AgentArtifactComponentInsert, eA as AgentArtifactComponentInsertSchema, cp as AgentArtifactComponentSelect, ez as AgentArtifactComponentSelectSchema, cr as AgentArtifactComponentUpdate, eB as AgentArtifactComponentUpdateSchema, aw as AgentCapabilities, aK as AgentCard, d6 as AgentConversationHistoryConfig, ck as AgentDataComponentApiInsert, er as AgentDataComponentApiInsertSchema, cj as AgentDataComponentApiSelect, eq as AgentDataComponentApiSelectSchema, cl as AgentDataComponentApiUpdate, es as AgentDataComponentApiUpdateSchema, ch as AgentDataComponentInsert, eo as AgentDataComponentInsertSchema, cg as AgentDataComponentSelect, en as AgentDataComponentSelectSchema, ci as AgentDataComponentUpdate, ep as AgentDataComponentUpdateSchema, cS as AgentDefinition, bK as AgentGraphApiInsert, dH as AgentGraphApiInsertSchema, bJ as AgentGraphApiSelect, dG as AgentGraphApiSelectSchema, bL as AgentGraphApiUpdate, dI as AgentGraphApiUpdateSchema, dE as AgentGraphInsertSchema, bI as AgentGraphSelect, dD as AgentGraphSelectSchema, dF as AgentGraphUpdateSchema, dp as AgentInsertSchema, ax as AgentProvider, bE as AgentRelationApiInsert, dy as AgentRelationApiInsertSchema, bD as AgentRelationApiSelect, dx as AgentRelationApiSelectSchema, bF as AgentRelationApiUpdate, dz as AgentRelationApiUpdateSchema, dv as AgentRelationInsertSchema, bG as AgentRelationQuery, dA as AgentRelationQuerySchema, bC as AgentRelationSelect, du as AgentRelationSelectSchema, dw as AgentRelationUpdateSchema, dn as AgentSelectSchema, ay as AgentSkill, c as AgentStopWhen, A as AgentStopWhenSchema, cI as AgentToolRelationApiInsert, ff as AgentToolRelationApiInsertSchema, cH as AgentToolRelationApiSelect, fe as AgentToolRelationApiSelectSchema, cJ as AgentToolRelationApiUpdate, fg as AgentToolRelationApiUpdateSchema, cG as AgentToolRelationInsert, fc as AgentToolRelationInsertSchema, cF as AgentToolRelationSelect, fb as AgentToolRelationSelectSchema, fd as AgentToolRelationUpdateSchema, dq as AgentUpdateSchema, eL as AllAgentSchema, cy as AllAgentSelect, cC as ApiKeyApiCreationResponse, eQ as ApiKeyApiCreationResponseSchema, cA as ApiKeyApiInsert, eR as ApiKeyApiInsertSchema, cz as ApiKeyApiSelect, eP as ApiKeyApiSelectSchema, cB as ApiKeyApiUpdate, eS as ApiKeyApiUpdateSchema, eN as ApiKeyInsertSchema, eM as ApiKeySelectSchema, eO as ApiKeyUpdateSchema, cn as ArtifactComponentApiInsert, ex as ArtifactComponentApiInsertSchema, cm as ArtifactComponentApiSelect, ew as ArtifactComponentApiSelectSchema, co as ArtifactComponentApiUpdate, ey as ArtifactComponentApiUpdateSchema, eu as ArtifactComponentInsertSchema, et as ArtifactComponentSelectSchema, ev as ArtifactComponentUpdateSchema, aD as AuthorizationCodeOAuthFlow, cQ as CanUseItem, fp as CanUseItemSchema, bf as CancelTaskRequest, bq as CancelTaskResponse, bp as CancelTaskSuccessResponse, aE as ClientCredentialsOAuthFlow, aZ as ContentTypeNotSupportedError, cb as ContextCacheApiInsert, ee as ContextCacheApiInsertSchema, ca as ContextCacheApiSelect, ed as ContextCacheApiSelectSchema, cc as ContextCacheApiUpdate, ef as ContextCacheApiUpdateSchema, d7 as ContextCacheEntry, eb as ContextCacheInsertSchema, ea as ContextCacheSelectSchema, c9 as ContextCacheUpdate, ec as ContextCacheUpdateSchema, c5 as ContextConfigApiInsert, f9 as ContextConfigApiInsertSchema, c4 as ContextConfigApiSelect, f8 as ContextConfigApiSelectSchema, c6 as ContextConfigApiUpdate, fa as ContextConfigApiUpdateSchema, f6 as ContextConfigInsertSchema, f5 as ContextConfigSelectSchema, f7 as ContextConfigUpdateSchema, b_ as ConversationApiInsert, e2 as ConversationApiInsertSchema, bZ as ConversationApiSelect, e1 as ConversationApiSelectSchema, b$ as ConversationApiUpdate, e3 as ConversationApiUpdateSchema, d$ as ConversationInsertSchema, d5 as ConversationScopeOptions, d_ as ConversationSelectSchema, e0 as ConversationUpdateSchema, eX as CredentialReferenceApiInsertSchema, cD as CredentialReferenceApiSelect, eW as CredentialReferenceApiSelectSchema, cE as CredentialReferenceApiUpdate, eY as CredentialReferenceApiUpdateSchema, eU as CredentialReferenceInsertSchema, eT as CredentialReferenceSelectSchema, eV as CredentialReferenceUpdateSchema, ce as DataComponentApiInsert, el as DataComponentApiInsertSchema, cd as DataComponentApiSelect, ek as DataComponentApiSelectSchema, cf as DataComponentApiUpdate, em as DataComponentApiUpdateSchema, ei as DataComponentBaseSchema, eh as DataComponentInsertSchema, eg as DataComponentSelectSchema, ej as DataComponentUpdateSchema, au as DataPart, fv as ErrorResponseSchema, fw as ExistsResponseSchema, cw as ExternalAgentApiInsert, eJ as ExternalAgentApiInsertSchema, cv as ExternalAgentApiSelect, eI as ExternalAgentApiSelectSchema, cx as ExternalAgentApiUpdate, eK as ExternalAgentApiUpdateSchema, eG as ExternalAgentInsertSchema, bH as ExternalAgentRelationApiInsert, dC as ExternalAgentRelationApiInsertSchema, dB as ExternalAgentRelationInsertSchema, eF as ExternalAgentSelectSchema, eH as ExternalAgentUpdateSchema, c8 as FetchConfig, f3 as FetchConfigSchema, c7 as FetchDefinition, f4 as FetchDefinitionSchema, aq as FileBase, at as FilePart, ar as FileWithBytes, as as FileWithUri, cP as FullGraphAgentInsert, F as FullGraphAgentInsertSchema, fq as FullGraphDefinitionSchema, fE as FullProjectDefinitionSchema, bh as GetTaskPushNotificationConfigRequest, bu as GetTaskPushNotificationConfigResponse, bt as GetTaskPushNotificationConfigSuccessResponse, be as GetTaskRequest, bo as GetTaskResponse, bn as GetTaskSuccessResponse, b as GraphStopWhen, G as GraphStopWhenSchema, fr as GraphWithinContextOfProjectSchema, aB as HTTPAuthSecurityScheme, fF as HeadersScopeSchema, fM as IdParamsSchema, aF as ImplicitOAuthFlow, cR as InternalAgentDefinition, aU as InternalError, a_ as InvalidAgentResponseError, aT as InvalidParamsError, aR as InvalidRequestError, aQ as JSONParseError, b9 as JSONRPCError, bb as JSONRPCErrorResponse, b7 as JSONRPCMessage, b8 as JSONRPCRequest, ba as JSONRPCResult, cN as LedgerArtifactApiInsert, fl as LedgerArtifactApiInsertSchema, cM as LedgerArtifactApiSelect, fk as LedgerArtifactApiSelectSchema, cO as LedgerArtifactApiUpdate, fm as LedgerArtifactApiUpdateSchema, cK as LedgerArtifactInsert, fi as LedgerArtifactInsertSchema, fh as LedgerArtifactSelectSchema, cL as LedgerArtifactUpdate, fj as LedgerArtifactUpdateSchema, ft as ListResponseSchema, dh as MAX_ID_LENGTH, df as MCPServerType, e_ as MCPToolConfigSchema, dg as MIN_ID_LENGTH, d8 as McpAuthType, d9 as McpServerAuth, db as McpServerCapabilities, dc as McpToolDefinition, dX as McpToolDefinitionSchema, eZ as McpToolSchema, da as McpTransportConfig, dV as McpTransportConfigSchema, aL as Message, c2 as MessageApiInsert, e8 as MessageApiInsertSchema, c1 as MessageApiSelect, e7 as MessageApiSelectSchema, c3 as MessageApiUpdate, e9 as MessageApiUpdateSchema, e5 as MessageInsertSchema, c$ as MessageMode, bx as MessagePart, c_ as MessageRole, c0 as MessageSelect, e4 as MessageSelectSchema, b5 as MessageSendConfiguration, b6 as MessageSendParams, cZ as MessageType, e6 as MessageUpdateSchema, aS as MethodNotFoundError, dl as ModelSchema, d2 as ModelSettings, dk as ModelSettingsSchema, d0 as Models, aH as OAuth2SecurityScheme, aC as OAuthFlows, aI as OpenIdConnectSecurityScheme, cX as Pagination, fN as PaginationQueryParamsSchema, fs as PaginationSchema, P as Part, ao as PartBase, aG as PasswordOAuthFlow, cV as ProjectApiInsert, fC as ProjectApiInsertSchema, cU as ProjectApiSelect, fB as ProjectApiSelectSchema, cW as ProjectApiUpdate, fD as ProjectApiUpdateSchema, fz as ProjectInsertSchema, dm as ProjectModelSchema, d1 as ProjectModels, fy as ProjectSelectSchema, fA as ProjectUpdateSchema, b0 as PushNotificationAuthenticationInfo, b1 as PushNotificationConfig, aX as PushNotificationNotSupportedError, fx as RemovedResponseSchema, aJ as SecurityScheme, az as SecuritySchemeBase, bc as SendMessageRequest, bk as SendMessageResponse, bj as SendMessageSuccessResponse, bd as SendStreamingMessageRequest, bm as SendStreamingMessageResponse, bl as SendStreamingMessageSuccessResponse, bg as SetTaskPushNotificationConfigRequest, bs as SetTaskPushNotificationConfigResponse, br as SetTaskPushNotificationConfigSuccessResponse, fu as SingleResponseSchema, d4 as StatusComponent, fn as StatusComponentSchema, fo as StatusUpdateSchema, d3 as StatusUpdateSettings, a as StopWhen, S as StopWhenSchema, cY as SummaryEvent, dd as TOOL_STATUS_VALUES, aN as Task, bO as TaskApiInsert, dN as TaskApiInsertSchema, bN as TaskApiSelect, dM as TaskApiSelectSchema, bP as TaskApiUpdate, dO as TaskApiUpdateSchema, by as TaskArtifact, aP as TaskArtifactUpdateEvent, b3 as TaskIdParams, dK as TaskInsertSchema, aW as TaskNotCancelableError, aV as TaskNotFoundError, b2 as TaskPushNotificationConfig, b4 as TaskQueryParams, bU as TaskRelationApiInsert, dT as TaskRelationApiInsertSchema, bT as TaskRelationApiSelect, dS as TaskRelationApiSelectSchema, bV as TaskRelationApiUpdate, dU as TaskRelationApiUpdateSchema, bR as TaskRelationInsert, dQ as TaskRelationInsertSchema, bQ as TaskRelationSelect, dP as TaskRelationSelectSchema, bS as TaskRelationUpdate, dR as TaskRelationUpdateSchema, bi as TaskResubscriptionRequest, dJ as TaskSelectSchema, av as TaskState, aM as TaskStatus, aO as TaskStatusUpdateEvent, bM as TaskUpdate, dL as TaskUpdateSchema, fL as TenantIdParamsSchema, fG as TenantParamsSchema, fJ as TenantProjectGraphIdParamsSchema, fI as TenantProjectGraphParamsSchema, fK as TenantProjectIdParamsSchema, fH as TenantProjectParamsSchema, ap as TextPart, bX as ToolApiInsert, f1 as ToolApiInsertSchema, bW as ToolApiSelect, f0 as ToolApiSelectSchema, bY as ToolApiUpdate, f2 as ToolApiUpdateSchema, cT as ToolDefinition, dZ as ToolInsertSchema, dY as ToolSelectSchema, dW as ToolStatusSchema, e$ as ToolUpdateSchema, di as URL_SAFE_ID_PATTERN, aY as UnsupportedOperationError, de as VALID_RELATION_TYPES, dj as resourceIdSchema } from './utility-CT2pq49U.cjs';
2
+ import { k as CredentialReferenceApiInsert, l as ContextConfigSelect, e as ContextFetchDefinition, M as MCPTransportType, m as MCPToolConfig, n as GraphScopeConfig, C as ConversationHistoryConfig, o as ProjectScopeConfig, p as PaginationConfig, q as AgentGraphInsert, r as AgentGraphUpdate, s as FullGraphDefinition, t as AgentScopeConfig, u as AgentRelationInsert, E as ExternalAgentRelationInsert, v as AgentRelationUpdate, w as AgentToolRelationUpdate, f as ToolMcpConfig, g as ToolServerCapabilities, x as AgentInsert, y as AgentUpdate, z as AgentSelect, B as ApiKeySelect, D as ApiKeyInsert, H as ApiKeyUpdate, I as CreateApiKeyParams, J as ApiKeyCreateResult, K as ArtifactComponentSelect, L as ArtifactComponentInsert, N as ArtifactComponentUpdate, O as ContextCacheSelect, Q as ContextCacheInsert, R as ContextConfigInsert, U as ContextConfigUpdate, V as ConversationSelect, W as ConversationInsert, h as ConversationMetadata, X as ConversationUpdate, Y as CredentialReferenceSelect, Z as ToolSelect, _ as CredentialReferenceInsert, $ as CredentialReferenceUpdate, a0 as DataComponentSelect, a1 as DataComponentInsert, a2 as DataComponentUpdate, a3 as ExternalAgentInsert, a4 as ExternalAgentSelect, a5 as ExternalAgentUpdate, a6 as Artifact, a7 as LedgerArtifactSelect, j as MessageMetadata, i as MessageContent, a8 as MessageVisibility, a9 as MessageInsert, aa as MessageUpdate, ab as FullProjectDefinition, ac as ProjectInfo, ad as ProjectSelect, ae as PaginationResult, af as ProjectResourceCounts, ag as ProjectInsert, ah as ProjectUpdate, ai as TaskInsert, T as TaskMetadataConfig, aj as TaskSelect, ak as McpTool, al as ToolInsert, am as ToolUpdate, d as CredentialStoreType, an as ExecutionContext } from './utility-C3eMTvpr.cjs';
3
+ export { a$ as A2AError, bv as A2ARequest, bw as A2AResponse, aA as APIKeySecurityScheme, bA as AgentApiInsert, ds as AgentApiInsertSchema, bz as AgentApiSelect, dr as AgentApiSelectSchema, bB as AgentApiUpdate, dt as AgentApiUpdateSchema, ct as AgentArtifactComponentApiInsert, eD as AgentArtifactComponentApiInsertSchema, cs as AgentArtifactComponentApiSelect, eC as AgentArtifactComponentApiSelectSchema, cu as AgentArtifactComponentApiUpdate, eE as AgentArtifactComponentApiUpdateSchema, cq as AgentArtifactComponentInsert, eA as AgentArtifactComponentInsertSchema, cp as AgentArtifactComponentSelect, ez as AgentArtifactComponentSelectSchema, cr as AgentArtifactComponentUpdate, eB as AgentArtifactComponentUpdateSchema, aw as AgentCapabilities, aK as AgentCard, d6 as AgentConversationHistoryConfig, ck as AgentDataComponentApiInsert, er as AgentDataComponentApiInsertSchema, cj as AgentDataComponentApiSelect, eq as AgentDataComponentApiSelectSchema, cl as AgentDataComponentApiUpdate, es as AgentDataComponentApiUpdateSchema, ch as AgentDataComponentInsert, eo as AgentDataComponentInsertSchema, cg as AgentDataComponentSelect, en as AgentDataComponentSelectSchema, ci as AgentDataComponentUpdate, ep as AgentDataComponentUpdateSchema, cS as AgentDefinition, bK as AgentGraphApiInsert, dH as AgentGraphApiInsertSchema, bJ as AgentGraphApiSelect, dG as AgentGraphApiSelectSchema, bL as AgentGraphApiUpdate, dI as AgentGraphApiUpdateSchema, dE as AgentGraphInsertSchema, bI as AgentGraphSelect, dD as AgentGraphSelectSchema, dF as AgentGraphUpdateSchema, dp as AgentInsertSchema, ax as AgentProvider, bE as AgentRelationApiInsert, dy as AgentRelationApiInsertSchema, bD as AgentRelationApiSelect, dx as AgentRelationApiSelectSchema, bF as AgentRelationApiUpdate, dz as AgentRelationApiUpdateSchema, dv as AgentRelationInsertSchema, bG as AgentRelationQuery, dA as AgentRelationQuerySchema, bC as AgentRelationSelect, du as AgentRelationSelectSchema, dw as AgentRelationUpdateSchema, dn as AgentSelectSchema, ay as AgentSkill, c as AgentStopWhen, A as AgentStopWhenSchema, cI as AgentToolRelationApiInsert, ff as AgentToolRelationApiInsertSchema, cH as AgentToolRelationApiSelect, fe as AgentToolRelationApiSelectSchema, cJ as AgentToolRelationApiUpdate, fg as AgentToolRelationApiUpdateSchema, cG as AgentToolRelationInsert, fc as AgentToolRelationInsertSchema, cF as AgentToolRelationSelect, fb as AgentToolRelationSelectSchema, fd as AgentToolRelationUpdateSchema, dq as AgentUpdateSchema, eL as AllAgentSchema, cy as AllAgentSelect, cC as ApiKeyApiCreationResponse, eQ as ApiKeyApiCreationResponseSchema, cA as ApiKeyApiInsert, eR as ApiKeyApiInsertSchema, cz as ApiKeyApiSelect, eP as ApiKeyApiSelectSchema, cB as ApiKeyApiUpdate, eS as ApiKeyApiUpdateSchema, eN as ApiKeyInsertSchema, eM as ApiKeySelectSchema, eO as ApiKeyUpdateSchema, cn as ArtifactComponentApiInsert, ex as ArtifactComponentApiInsertSchema, cm as ArtifactComponentApiSelect, ew as ArtifactComponentApiSelectSchema, co as ArtifactComponentApiUpdate, ey as ArtifactComponentApiUpdateSchema, eu as ArtifactComponentInsertSchema, et as ArtifactComponentSelectSchema, ev as ArtifactComponentUpdateSchema, aD as AuthorizationCodeOAuthFlow, cQ as CanUseItem, fp as CanUseItemSchema, bf as CancelTaskRequest, bq as CancelTaskResponse, bp as CancelTaskSuccessResponse, aE as ClientCredentialsOAuthFlow, aZ as ContentTypeNotSupportedError, cb as ContextCacheApiInsert, ee as ContextCacheApiInsertSchema, ca as ContextCacheApiSelect, ed as ContextCacheApiSelectSchema, cc as ContextCacheApiUpdate, ef as ContextCacheApiUpdateSchema, d7 as ContextCacheEntry, eb as ContextCacheInsertSchema, ea as ContextCacheSelectSchema, c9 as ContextCacheUpdate, ec as ContextCacheUpdateSchema, c5 as ContextConfigApiInsert, f9 as ContextConfigApiInsertSchema, c4 as ContextConfigApiSelect, f8 as ContextConfigApiSelectSchema, c6 as ContextConfigApiUpdate, fa as ContextConfigApiUpdateSchema, f6 as ContextConfigInsertSchema, f5 as ContextConfigSelectSchema, f7 as ContextConfigUpdateSchema, b_ as ConversationApiInsert, e2 as ConversationApiInsertSchema, bZ as ConversationApiSelect, e1 as ConversationApiSelectSchema, b$ as ConversationApiUpdate, e3 as ConversationApiUpdateSchema, d$ as ConversationInsertSchema, d5 as ConversationScopeOptions, d_ as ConversationSelectSchema, e0 as ConversationUpdateSchema, eX as CredentialReferenceApiInsertSchema, cD as CredentialReferenceApiSelect, eW as CredentialReferenceApiSelectSchema, cE as CredentialReferenceApiUpdate, eY as CredentialReferenceApiUpdateSchema, eU as CredentialReferenceInsertSchema, eT as CredentialReferenceSelectSchema, eV as CredentialReferenceUpdateSchema, ce as DataComponentApiInsert, el as DataComponentApiInsertSchema, cd as DataComponentApiSelect, ek as DataComponentApiSelectSchema, cf as DataComponentApiUpdate, em as DataComponentApiUpdateSchema, ei as DataComponentBaseSchema, eh as DataComponentInsertSchema, eg as DataComponentSelectSchema, ej as DataComponentUpdateSchema, au as DataPart, fv as ErrorResponseSchema, fw as ExistsResponseSchema, cw as ExternalAgentApiInsert, eJ as ExternalAgentApiInsertSchema, cv as ExternalAgentApiSelect, eI as ExternalAgentApiSelectSchema, cx as ExternalAgentApiUpdate, eK as ExternalAgentApiUpdateSchema, eG as ExternalAgentInsertSchema, bH as ExternalAgentRelationApiInsert, dC as ExternalAgentRelationApiInsertSchema, dB as ExternalAgentRelationInsertSchema, eF as ExternalAgentSelectSchema, eH as ExternalAgentUpdateSchema, c8 as FetchConfig, f3 as FetchConfigSchema, c7 as FetchDefinition, f4 as FetchDefinitionSchema, aq as FileBase, at as FilePart, ar as FileWithBytes, as as FileWithUri, cP as FullGraphAgentInsert, F as FullGraphAgentInsertSchema, fq as FullGraphDefinitionSchema, fE as FullProjectDefinitionSchema, bh as GetTaskPushNotificationConfigRequest, bu as GetTaskPushNotificationConfigResponse, bt as GetTaskPushNotificationConfigSuccessResponse, be as GetTaskRequest, bo as GetTaskResponse, bn as GetTaskSuccessResponse, b as GraphStopWhen, G as GraphStopWhenSchema, fr as GraphWithinContextOfProjectSchema, aB as HTTPAuthSecurityScheme, fF as HeadersScopeSchema, fM as IdParamsSchema, aF as ImplicitOAuthFlow, cR as InternalAgentDefinition, aU as InternalError, a_ as InvalidAgentResponseError, aT as InvalidParamsError, aR as InvalidRequestError, aQ as JSONParseError, b9 as JSONRPCError, bb as JSONRPCErrorResponse, b7 as JSONRPCMessage, b8 as JSONRPCRequest, ba as JSONRPCResult, cN as LedgerArtifactApiInsert, fl as LedgerArtifactApiInsertSchema, cM as LedgerArtifactApiSelect, fk as LedgerArtifactApiSelectSchema, cO as LedgerArtifactApiUpdate, fm as LedgerArtifactApiUpdateSchema, cK as LedgerArtifactInsert, fi as LedgerArtifactInsertSchema, fh as LedgerArtifactSelectSchema, cL as LedgerArtifactUpdate, fj as LedgerArtifactUpdateSchema, ft as ListResponseSchema, dh as MAX_ID_LENGTH, df as MCPServerType, e_ as MCPToolConfigSchema, dg as MIN_ID_LENGTH, d8 as McpAuthType, d9 as McpServerAuth, db as McpServerCapabilities, dc as McpToolDefinition, dX as McpToolDefinitionSchema, eZ as McpToolSchema, da as McpTransportConfig, dV as McpTransportConfigSchema, aL as Message, c2 as MessageApiInsert, e8 as MessageApiInsertSchema, c1 as MessageApiSelect, e7 as MessageApiSelectSchema, c3 as MessageApiUpdate, e9 as MessageApiUpdateSchema, e5 as MessageInsertSchema, c$ as MessageMode, bx as MessagePart, c_ as MessageRole, c0 as MessageSelect, e4 as MessageSelectSchema, b5 as MessageSendConfiguration, b6 as MessageSendParams, cZ as MessageType, e6 as MessageUpdateSchema, aS as MethodNotFoundError, dl as ModelSchema, d2 as ModelSettings, dk as ModelSettingsSchema, d0 as Models, aH as OAuth2SecurityScheme, aC as OAuthFlows, aI as OpenIdConnectSecurityScheme, cX as Pagination, fN as PaginationQueryParamsSchema, fs as PaginationSchema, P as Part, ao as PartBase, aG as PasswordOAuthFlow, cV as ProjectApiInsert, fC as ProjectApiInsertSchema, cU as ProjectApiSelect, fB as ProjectApiSelectSchema, cW as ProjectApiUpdate, fD as ProjectApiUpdateSchema, fz as ProjectInsertSchema, dm as ProjectModelSchema, d1 as ProjectModels, fy as ProjectSelectSchema, fA as ProjectUpdateSchema, b0 as PushNotificationAuthenticationInfo, b1 as PushNotificationConfig, aX as PushNotificationNotSupportedError, fx as RemovedResponseSchema, aJ as SecurityScheme, az as SecuritySchemeBase, bc as SendMessageRequest, bk as SendMessageResponse, bj as SendMessageSuccessResponse, bd as SendStreamingMessageRequest, bm as SendStreamingMessageResponse, bl as SendStreamingMessageSuccessResponse, bg as SetTaskPushNotificationConfigRequest, bs as SetTaskPushNotificationConfigResponse, br as SetTaskPushNotificationConfigSuccessResponse, fu as SingleResponseSchema, d4 as StatusComponent, fn as StatusComponentSchema, fo as StatusUpdateSchema, d3 as StatusUpdateSettings, a as StopWhen, S as StopWhenSchema, cY as SummaryEvent, dd as TOOL_STATUS_VALUES, aN as Task, bO as TaskApiInsert, dN as TaskApiInsertSchema, bN as TaskApiSelect, dM as TaskApiSelectSchema, bP as TaskApiUpdate, dO as TaskApiUpdateSchema, by as TaskArtifact, aP as TaskArtifactUpdateEvent, b3 as TaskIdParams, dK as TaskInsertSchema, aW as TaskNotCancelableError, aV as TaskNotFoundError, b2 as TaskPushNotificationConfig, b4 as TaskQueryParams, bU as TaskRelationApiInsert, dT as TaskRelationApiInsertSchema, bT as TaskRelationApiSelect, dS as TaskRelationApiSelectSchema, bV as TaskRelationApiUpdate, dU as TaskRelationApiUpdateSchema, bR as TaskRelationInsert, dQ as TaskRelationInsertSchema, bQ as TaskRelationSelect, dP as TaskRelationSelectSchema, bS as TaskRelationUpdate, dR as TaskRelationUpdateSchema, bi as TaskResubscriptionRequest, dJ as TaskSelectSchema, av as TaskState, aM as TaskStatus, aO as TaskStatusUpdateEvent, bM as TaskUpdate, dL as TaskUpdateSchema, fL as TenantIdParamsSchema, fG as TenantParamsSchema, fJ as TenantProjectGraphIdParamsSchema, fI as TenantProjectGraphParamsSchema, fK as TenantProjectIdParamsSchema, fH as TenantProjectParamsSchema, ap as TextPart, bX as ToolApiInsert, f1 as ToolApiInsertSchema, bW as ToolApiSelect, f0 as ToolApiSelectSchema, bY as ToolApiUpdate, f2 as ToolApiUpdateSchema, cT as ToolDefinition, dZ as ToolInsertSchema, dY as ToolSelectSchema, dW as ToolStatusSchema, e$ as ToolUpdateSchema, di as URL_SAFE_ID_PATTERN, aY as UnsupportedOperationError, de as VALID_RELATION_TYPES, dj as resourceIdSchema } from './utility-C3eMTvpr.cjs';
4
4
  import { CredentialStore } from './types/index.cjs';
5
5
  export { CorsConfig, ServerConfig, ServerOptions } from './types/index.cjs';
6
6
  import { LibSQLDatabase } from 'drizzle-orm/libsql';
7
- import { s as schema } from './schema-BF9NpAv5.cjs';
8
- export { k as agentArtifactComponents, N as agentArtifactComponentsRelations, i as agentDataComponents, P as agentDataComponentsRelations, a as agentGraph, E as agentGraphRelations, e as agentRelations, R as agentRelationsRelations, m as agentToolRelations, H as agentToolRelationsRelations, d as agents, D as agentsRelations, r as apiKeys, G as apiKeysRelations, j as artifactComponents, M as artifactComponentsRelations, b as contextCache, C as contextCacheRelations, c as contextConfigs, B as contextConfigsRelations, n as conversations, K as conversationsRelations, u as credentialReferences, I as credentialReferencesRelations, h as dataComponents, O as dataComponentsRelations, f as externalAgents, F as externalAgentsRelations, q as ledgerArtifacts, w as ledgerArtifactsContextIdIdx, Q as ledgerArtifactsRelations, x as ledgerArtifactsTaskContextNameUnique, v as ledgerArtifactsTaskIdIdx, o as messages, L as messagesRelations, p as projects, z as projectsRelations, g as taskRelations, A as taskRelationsRelations, t as tasks, y as tasksRelations, l as tools, J as toolsRelations } from './schema-BF9NpAv5.cjs';
7
+ import { s as schema } from './schema-DwiRB4zS.cjs';
8
+ export { k as agentArtifactComponents, O as agentArtifactComponentsRelations, i as agentDataComponents, Q as agentDataComponentsRelations, a as agentGraph, F as agentGraphRelations, e as agentRelations, S as agentRelationsRelations, m as agentToolRelations, I as agentToolRelationsRelations, d as agents, E as agentsRelations, r as apiKeys, H as apiKeysRelations, j as artifactComponents, N as artifactComponentsRelations, b as contextCache, D as contextCacheRelations, c as contextConfigs, C as contextConfigsRelations, n as conversations, L as conversationsRelations, u as credentialReferences, J as credentialReferencesRelations, h as dataComponents, P as dataComponentsRelations, f as externalAgents, G as externalAgentsRelations, q as ledgerArtifacts, x as ledgerArtifactsContextIdIdx, R as ledgerArtifactsRelations, y as ledgerArtifactsTaskContextNameUnique, v as ledgerArtifactsTaskIdIdx, w as ledgerArtifactsToolCallIdIdx, o as messages, M as messagesRelations, p as projects, A as projectsRelations, g as taskRelations, B as taskRelationsRelations, t as tasks, z as tasksRelations, l as tools, K as toolsRelations } from './schema-DwiRB4zS.cjs';
9
9
  import { LoggerOptions, TransportSingleOptions, Logger } from 'pino';
10
10
  import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
11
11
  import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
@@ -2656,6 +2656,19 @@ declare const deleteFullGraph: (db: DatabaseClient, logger?: GraphLogger) => (pa
2656
2656
  scopes: GraphScopeConfig;
2657
2657
  }) => Promise<boolean>;
2658
2658
 
2659
+ /**
2660
+ * Atomic upsert operation for a single artifact - prevents race conditions
2661
+ */
2662
+ declare const upsertLedgerArtifact: (db: DatabaseClient) => (params: {
2663
+ scopes: ProjectScopeConfig;
2664
+ contextId: string;
2665
+ taskId: string;
2666
+ toolCallId?: string | null;
2667
+ artifact: Artifact;
2668
+ }) => Promise<{
2669
+ created: boolean;
2670
+ existing?: any;
2671
+ }>;
2659
2672
  /**
2660
2673
  * Save one or more artifacts to the ledger
2661
2674
  */
@@ -2663,15 +2676,17 @@ declare const addLedgerArtifacts: (db: DatabaseClient) => (params: {
2663
2676
  scopes: ProjectScopeConfig;
2664
2677
  contextId: string;
2665
2678
  taskId?: string | null;
2679
+ toolCallId?: string | null;
2666
2680
  artifacts: Artifact[];
2667
2681
  }) => Promise<void>;
2668
2682
  /**
2669
- * Retrieve artifacts by taskId and/or artifactId.
2670
- * At least one of taskId or artifactId must be provided.
2683
+ * Retrieve artifacts by taskId, toolCallId, and/or artifactId.
2684
+ * At least one of taskId, toolCallId, or artifactId must be provided.
2671
2685
  */
2672
2686
  declare const getLedgerArtifacts: (db: DatabaseClient) => (params: {
2673
2687
  scopes: ProjectScopeConfig;
2674
2688
  taskId?: string;
2689
+ toolCallId?: string;
2675
2690
  artifactId?: string;
2676
2691
  }) => Promise<Artifact[]>;
2677
2692
  /**
@@ -3890,4 +3905,4 @@ declare function setSpanWithError(span: Span, error: unknown, logger?: {
3890
3905
  */
3891
3906
  declare function getTracer(serviceName: string, serviceVersion?: string): Tracer;
3892
3907
 
3893
- export { AgentGraphInsert, AgentGraphUpdate, AgentInsert, AgentRelationInsert, AgentRelationUpdate, AgentScopeConfig, AgentSelect, AgentToolRelationUpdate, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, type CommonCreateErrorResponses, type CommonDeleteErrorResponses, type CommonGetErrorResponses, type CommonUpdateErrorResponses, ContextCache, ContextCacheInsert, ContextCacheSelect, ContextConfigBuilder, type ContextConfigBuilderOptions, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ContextFetcher, type ContextResolutionOptions, type ContextResolutionResult, ContextResolver, type ContextResolverInterface, type ContextValidationError, type ContextValidationResult, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationSelect, ConversationUpdate, CreateApiKeyParams, type CredentialContext, type CredentialData, CredentialReferenceApiInsert, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, type CredentialReferenceWithTools, type CredentialResolverInput, CredentialStore, type CredentialStoreReference, CredentialStoreRegistry, CredentialStoreType, CredentialStuffer, DataComponentInsert, DataComponentSelect, DataComponentUpdate, type DatabaseClient, type DatabaseConfig, type DotPaths, ERROR_DOCS_BASE_URL, ErrorCode, type ErrorCodes, type ErrorResponse, ExecutionContext, ExternalAgentInsert, ExternalAgentRelationInsert, ExternalAgentSelect, ExternalAgentUpdate, type FetchResult, FullGraphDefinition, FullProjectDefinition, type GraphLogger, GraphScopeConfig, HTTP_REQUEST_PARTS, type HttpRequestPart, InMemoryCredentialStore, KeyChainStore, LedgerArtifactSelect, type LoggerFactoryConfig, MCPToolConfig, MCPTransportType, McpClient, type McpClientOptions, type McpSSEConfig, type McpServerConfig, type McpStreamableHttpConfig, McpTool, MessageContent, MessageInsert, MessageMetadata, MessageUpdate, MessageVisibility, NangoCredentialStore, type OAuthConfig, PaginationConfig, PaginationResult, type ParsedHttpRequest, PinoLogger, type PinoLoggerConfig, type ProblemDetails, ProjectInfo, ProjectInsert, type ProjectLogger, ProjectResourceCounts, ProjectScopeConfig, ProjectSelect, ProjectUpdate, type ResolvedContext, TaskInsert, TaskMetadataConfig, TaskSelect, type TemplateContext, TemplateEngine, type TemplateRenderOptions, ToolInsert, ToolMcpConfig, ToolSelect, ToolServerCapabilities, ToolUpdate, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentGraph, createAgentRelation, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelation, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsByIds, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getContextConfigsByName, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getGraphAgentInfos, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, requestContextSchema, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateMessage, updateProject, updateTask, updateTool, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };
3908
+ export { AgentGraphInsert, AgentGraphUpdate, AgentInsert, AgentRelationInsert, AgentRelationUpdate, AgentScopeConfig, AgentSelect, AgentToolRelationUpdate, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, type CommonCreateErrorResponses, type CommonDeleteErrorResponses, type CommonGetErrorResponses, type CommonUpdateErrorResponses, ContextCache, ContextCacheInsert, ContextCacheSelect, ContextConfigBuilder, type ContextConfigBuilderOptions, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ContextFetcher, type ContextResolutionOptions, type ContextResolutionResult, ContextResolver, type ContextResolverInterface, type ContextValidationError, type ContextValidationResult, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationSelect, ConversationUpdate, CreateApiKeyParams, type CredentialContext, type CredentialData, CredentialReferenceApiInsert, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, type CredentialReferenceWithTools, type CredentialResolverInput, CredentialStore, type CredentialStoreReference, CredentialStoreRegistry, CredentialStoreType, CredentialStuffer, DataComponentInsert, DataComponentSelect, DataComponentUpdate, type DatabaseClient, type DatabaseConfig, type DotPaths, ERROR_DOCS_BASE_URL, ErrorCode, type ErrorCodes, type ErrorResponse, ExecutionContext, ExternalAgentInsert, ExternalAgentRelationInsert, ExternalAgentSelect, ExternalAgentUpdate, type FetchResult, FullGraphDefinition, FullProjectDefinition, type GraphLogger, GraphScopeConfig, HTTP_REQUEST_PARTS, type HttpRequestPart, InMemoryCredentialStore, KeyChainStore, LedgerArtifactSelect, type LoggerFactoryConfig, MCPToolConfig, MCPTransportType, McpClient, type McpClientOptions, type McpSSEConfig, type McpServerConfig, type McpStreamableHttpConfig, McpTool, MessageContent, MessageInsert, MessageMetadata, MessageUpdate, MessageVisibility, NangoCredentialStore, type OAuthConfig, PaginationConfig, PaginationResult, type ParsedHttpRequest, PinoLogger, type PinoLoggerConfig, type ProblemDetails, ProjectInfo, ProjectInsert, type ProjectLogger, ProjectResourceCounts, ProjectScopeConfig, ProjectSelect, ProjectUpdate, type ResolvedContext, TaskInsert, TaskMetadataConfig, TaskSelect, type TemplateContext, TemplateEngine, type TemplateRenderOptions, ToolInsert, ToolMcpConfig, ToolSelect, ToolServerCapabilities, ToolUpdate, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentGraph, createAgentRelation, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelation, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsByIds, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getContextConfigsByName, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getGraphAgentInfos, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, requestContextSchema, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateMessage, updateProject, updateTask, updateTool, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertLedgerArtifact, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { k as CredentialReferenceApiInsert, l as ContextConfigSelect, e as ContextFetchDefinition, M as MCPTransportType, m as MCPToolConfig, n as GraphScopeConfig, C as ConversationHistoryConfig, o as ProjectScopeConfig, p as PaginationConfig, q as AgentGraphInsert, r as AgentGraphUpdate, s as FullGraphDefinition, t as AgentScopeConfig, u as AgentRelationInsert, E as ExternalAgentRelationInsert, v as AgentRelationUpdate, w as AgentToolRelationUpdate, f as ToolMcpConfig, g as ToolServerCapabilities, x as AgentInsert, y as AgentUpdate, z as AgentSelect, B as ApiKeySelect, D as ApiKeyInsert, H as ApiKeyUpdate, I as CreateApiKeyParams, J as ApiKeyCreateResult, K as ArtifactComponentSelect, L as ArtifactComponentInsert, N as ArtifactComponentUpdate, O as ContextCacheSelect, Q as ContextCacheInsert, R as ContextConfigInsert, U as ContextConfigUpdate, V as ConversationSelect, W as ConversationInsert, h as ConversationMetadata, X as ConversationUpdate, Y as CredentialReferenceSelect, Z as ToolSelect, _ as CredentialReferenceInsert, $ as CredentialReferenceUpdate, a0 as DataComponentSelect, a1 as DataComponentInsert, a2 as DataComponentUpdate, a3 as ExternalAgentInsert, a4 as ExternalAgentSelect, a5 as ExternalAgentUpdate, a6 as Artifact, a7 as LedgerArtifactSelect, j as MessageMetadata, i as MessageContent, a8 as MessageVisibility, a9 as MessageInsert, aa as MessageUpdate, ab as FullProjectDefinition, ac as ProjectInfo, ad as ProjectSelect, ae as PaginationResult, af as ProjectResourceCounts, ag as ProjectInsert, ah as ProjectUpdate, ai as TaskInsert, T as TaskMetadataConfig, aj as TaskSelect, ak as McpTool, al as ToolInsert, am as ToolUpdate, d as CredentialStoreType, an as ExecutionContext } from './utility-CT2pq49U.js';
3
- export { a$ as A2AError, bv as A2ARequest, bw as A2AResponse, aA as APIKeySecurityScheme, bA as AgentApiInsert, ds as AgentApiInsertSchema, bz as AgentApiSelect, dr as AgentApiSelectSchema, bB as AgentApiUpdate, dt as AgentApiUpdateSchema, ct as AgentArtifactComponentApiInsert, eD as AgentArtifactComponentApiInsertSchema, cs as AgentArtifactComponentApiSelect, eC as AgentArtifactComponentApiSelectSchema, cu as AgentArtifactComponentApiUpdate, eE as AgentArtifactComponentApiUpdateSchema, cq as AgentArtifactComponentInsert, eA as AgentArtifactComponentInsertSchema, cp as AgentArtifactComponentSelect, ez as AgentArtifactComponentSelectSchema, cr as AgentArtifactComponentUpdate, eB as AgentArtifactComponentUpdateSchema, aw as AgentCapabilities, aK as AgentCard, d6 as AgentConversationHistoryConfig, ck as AgentDataComponentApiInsert, er as AgentDataComponentApiInsertSchema, cj as AgentDataComponentApiSelect, eq as AgentDataComponentApiSelectSchema, cl as AgentDataComponentApiUpdate, es as AgentDataComponentApiUpdateSchema, ch as AgentDataComponentInsert, eo as AgentDataComponentInsertSchema, cg as AgentDataComponentSelect, en as AgentDataComponentSelectSchema, ci as AgentDataComponentUpdate, ep as AgentDataComponentUpdateSchema, cS as AgentDefinition, bK as AgentGraphApiInsert, dH as AgentGraphApiInsertSchema, bJ as AgentGraphApiSelect, dG as AgentGraphApiSelectSchema, bL as AgentGraphApiUpdate, dI as AgentGraphApiUpdateSchema, dE as AgentGraphInsertSchema, bI as AgentGraphSelect, dD as AgentGraphSelectSchema, dF as AgentGraphUpdateSchema, dp as AgentInsertSchema, ax as AgentProvider, bE as AgentRelationApiInsert, dy as AgentRelationApiInsertSchema, bD as AgentRelationApiSelect, dx as AgentRelationApiSelectSchema, bF as AgentRelationApiUpdate, dz as AgentRelationApiUpdateSchema, dv as AgentRelationInsertSchema, bG as AgentRelationQuery, dA as AgentRelationQuerySchema, bC as AgentRelationSelect, du as AgentRelationSelectSchema, dw as AgentRelationUpdateSchema, dn as AgentSelectSchema, ay as AgentSkill, c as AgentStopWhen, A as AgentStopWhenSchema, cI as AgentToolRelationApiInsert, ff as AgentToolRelationApiInsertSchema, cH as AgentToolRelationApiSelect, fe as AgentToolRelationApiSelectSchema, cJ as AgentToolRelationApiUpdate, fg as AgentToolRelationApiUpdateSchema, cG as AgentToolRelationInsert, fc as AgentToolRelationInsertSchema, cF as AgentToolRelationSelect, fb as AgentToolRelationSelectSchema, fd as AgentToolRelationUpdateSchema, dq as AgentUpdateSchema, eL as AllAgentSchema, cy as AllAgentSelect, cC as ApiKeyApiCreationResponse, eQ as ApiKeyApiCreationResponseSchema, cA as ApiKeyApiInsert, eR as ApiKeyApiInsertSchema, cz as ApiKeyApiSelect, eP as ApiKeyApiSelectSchema, cB as ApiKeyApiUpdate, eS as ApiKeyApiUpdateSchema, eN as ApiKeyInsertSchema, eM as ApiKeySelectSchema, eO as ApiKeyUpdateSchema, cn as ArtifactComponentApiInsert, ex as ArtifactComponentApiInsertSchema, cm as ArtifactComponentApiSelect, ew as ArtifactComponentApiSelectSchema, co as ArtifactComponentApiUpdate, ey as ArtifactComponentApiUpdateSchema, eu as ArtifactComponentInsertSchema, et as ArtifactComponentSelectSchema, ev as ArtifactComponentUpdateSchema, aD as AuthorizationCodeOAuthFlow, cQ as CanUseItem, fp as CanUseItemSchema, bf as CancelTaskRequest, bq as CancelTaskResponse, bp as CancelTaskSuccessResponse, aE as ClientCredentialsOAuthFlow, aZ as ContentTypeNotSupportedError, cb as ContextCacheApiInsert, ee as ContextCacheApiInsertSchema, ca as ContextCacheApiSelect, ed as ContextCacheApiSelectSchema, cc as ContextCacheApiUpdate, ef as ContextCacheApiUpdateSchema, d7 as ContextCacheEntry, eb as ContextCacheInsertSchema, ea as ContextCacheSelectSchema, c9 as ContextCacheUpdate, ec as ContextCacheUpdateSchema, c5 as ContextConfigApiInsert, f9 as ContextConfigApiInsertSchema, c4 as ContextConfigApiSelect, f8 as ContextConfigApiSelectSchema, c6 as ContextConfigApiUpdate, fa as ContextConfigApiUpdateSchema, f6 as ContextConfigInsertSchema, f5 as ContextConfigSelectSchema, f7 as ContextConfigUpdateSchema, b_ as ConversationApiInsert, e2 as ConversationApiInsertSchema, bZ as ConversationApiSelect, e1 as ConversationApiSelectSchema, b$ as ConversationApiUpdate, e3 as ConversationApiUpdateSchema, d$ as ConversationInsertSchema, d5 as ConversationScopeOptions, d_ as ConversationSelectSchema, e0 as ConversationUpdateSchema, eX as CredentialReferenceApiInsertSchema, cD as CredentialReferenceApiSelect, eW as CredentialReferenceApiSelectSchema, cE as CredentialReferenceApiUpdate, eY as CredentialReferenceApiUpdateSchema, eU as CredentialReferenceInsertSchema, eT as CredentialReferenceSelectSchema, eV as CredentialReferenceUpdateSchema, ce as DataComponentApiInsert, el as DataComponentApiInsertSchema, cd as DataComponentApiSelect, ek as DataComponentApiSelectSchema, cf as DataComponentApiUpdate, em as DataComponentApiUpdateSchema, ei as DataComponentBaseSchema, eh as DataComponentInsertSchema, eg as DataComponentSelectSchema, ej as DataComponentUpdateSchema, au as DataPart, fv as ErrorResponseSchema, fw as ExistsResponseSchema, cw as ExternalAgentApiInsert, eJ as ExternalAgentApiInsertSchema, cv as ExternalAgentApiSelect, eI as ExternalAgentApiSelectSchema, cx as ExternalAgentApiUpdate, eK as ExternalAgentApiUpdateSchema, eG as ExternalAgentInsertSchema, bH as ExternalAgentRelationApiInsert, dC as ExternalAgentRelationApiInsertSchema, dB as ExternalAgentRelationInsertSchema, eF as ExternalAgentSelectSchema, eH as ExternalAgentUpdateSchema, c8 as FetchConfig, f3 as FetchConfigSchema, c7 as FetchDefinition, f4 as FetchDefinitionSchema, aq as FileBase, at as FilePart, ar as FileWithBytes, as as FileWithUri, cP as FullGraphAgentInsert, F as FullGraphAgentInsertSchema, fq as FullGraphDefinitionSchema, fE as FullProjectDefinitionSchema, bh as GetTaskPushNotificationConfigRequest, bu as GetTaskPushNotificationConfigResponse, bt as GetTaskPushNotificationConfigSuccessResponse, be as GetTaskRequest, bo as GetTaskResponse, bn as GetTaskSuccessResponse, b as GraphStopWhen, G as GraphStopWhenSchema, fr as GraphWithinContextOfProjectSchema, aB as HTTPAuthSecurityScheme, fF as HeadersScopeSchema, fM as IdParamsSchema, aF as ImplicitOAuthFlow, cR as InternalAgentDefinition, aU as InternalError, a_ as InvalidAgentResponseError, aT as InvalidParamsError, aR as InvalidRequestError, aQ as JSONParseError, b9 as JSONRPCError, bb as JSONRPCErrorResponse, b7 as JSONRPCMessage, b8 as JSONRPCRequest, ba as JSONRPCResult, cN as LedgerArtifactApiInsert, fl as LedgerArtifactApiInsertSchema, cM as LedgerArtifactApiSelect, fk as LedgerArtifactApiSelectSchema, cO as LedgerArtifactApiUpdate, fm as LedgerArtifactApiUpdateSchema, cK as LedgerArtifactInsert, fi as LedgerArtifactInsertSchema, fh as LedgerArtifactSelectSchema, cL as LedgerArtifactUpdate, fj as LedgerArtifactUpdateSchema, ft as ListResponseSchema, dh as MAX_ID_LENGTH, df as MCPServerType, e_ as MCPToolConfigSchema, dg as MIN_ID_LENGTH, d8 as McpAuthType, d9 as McpServerAuth, db as McpServerCapabilities, dc as McpToolDefinition, dX as McpToolDefinitionSchema, eZ as McpToolSchema, da as McpTransportConfig, dV as McpTransportConfigSchema, aL as Message, c2 as MessageApiInsert, e8 as MessageApiInsertSchema, c1 as MessageApiSelect, e7 as MessageApiSelectSchema, c3 as MessageApiUpdate, e9 as MessageApiUpdateSchema, e5 as MessageInsertSchema, c$ as MessageMode, bx as MessagePart, c_ as MessageRole, c0 as MessageSelect, e4 as MessageSelectSchema, b5 as MessageSendConfiguration, b6 as MessageSendParams, cZ as MessageType, e6 as MessageUpdateSchema, aS as MethodNotFoundError, dl as ModelSchema, d2 as ModelSettings, dk as ModelSettingsSchema, d0 as Models, aH as OAuth2SecurityScheme, aC as OAuthFlows, aI as OpenIdConnectSecurityScheme, cX as Pagination, fN as PaginationQueryParamsSchema, fs as PaginationSchema, P as Part, ao as PartBase, aG as PasswordOAuthFlow, cV as ProjectApiInsert, fC as ProjectApiInsertSchema, cU as ProjectApiSelect, fB as ProjectApiSelectSchema, cW as ProjectApiUpdate, fD as ProjectApiUpdateSchema, fz as ProjectInsertSchema, dm as ProjectModelSchema, d1 as ProjectModels, fy as ProjectSelectSchema, fA as ProjectUpdateSchema, b0 as PushNotificationAuthenticationInfo, b1 as PushNotificationConfig, aX as PushNotificationNotSupportedError, fx as RemovedResponseSchema, aJ as SecurityScheme, az as SecuritySchemeBase, bc as SendMessageRequest, bk as SendMessageResponse, bj as SendMessageSuccessResponse, bd as SendStreamingMessageRequest, bm as SendStreamingMessageResponse, bl as SendStreamingMessageSuccessResponse, bg as SetTaskPushNotificationConfigRequest, bs as SetTaskPushNotificationConfigResponse, br as SetTaskPushNotificationConfigSuccessResponse, fu as SingleResponseSchema, d4 as StatusComponent, fn as StatusComponentSchema, fo as StatusUpdateSchema, d3 as StatusUpdateSettings, a as StopWhen, S as StopWhenSchema, cY as SummaryEvent, dd as TOOL_STATUS_VALUES, aN as Task, bO as TaskApiInsert, dN as TaskApiInsertSchema, bN as TaskApiSelect, dM as TaskApiSelectSchema, bP as TaskApiUpdate, dO as TaskApiUpdateSchema, by as TaskArtifact, aP as TaskArtifactUpdateEvent, b3 as TaskIdParams, dK as TaskInsertSchema, aW as TaskNotCancelableError, aV as TaskNotFoundError, b2 as TaskPushNotificationConfig, b4 as TaskQueryParams, bU as TaskRelationApiInsert, dT as TaskRelationApiInsertSchema, bT as TaskRelationApiSelect, dS as TaskRelationApiSelectSchema, bV as TaskRelationApiUpdate, dU as TaskRelationApiUpdateSchema, bR as TaskRelationInsert, dQ as TaskRelationInsertSchema, bQ as TaskRelationSelect, dP as TaskRelationSelectSchema, bS as TaskRelationUpdate, dR as TaskRelationUpdateSchema, bi as TaskResubscriptionRequest, dJ as TaskSelectSchema, av as TaskState, aM as TaskStatus, aO as TaskStatusUpdateEvent, bM as TaskUpdate, dL as TaskUpdateSchema, fL as TenantIdParamsSchema, fG as TenantParamsSchema, fJ as TenantProjectGraphIdParamsSchema, fI as TenantProjectGraphParamsSchema, fK as TenantProjectIdParamsSchema, fH as TenantProjectParamsSchema, ap as TextPart, bX as ToolApiInsert, f1 as ToolApiInsertSchema, bW as ToolApiSelect, f0 as ToolApiSelectSchema, bY as ToolApiUpdate, f2 as ToolApiUpdateSchema, cT as ToolDefinition, dZ as ToolInsertSchema, dY as ToolSelectSchema, dW as ToolStatusSchema, e$ as ToolUpdateSchema, di as URL_SAFE_ID_PATTERN, aY as UnsupportedOperationError, de as VALID_RELATION_TYPES, dj as resourceIdSchema } from './utility-CT2pq49U.js';
2
+ import { k as CredentialReferenceApiInsert, l as ContextConfigSelect, e as ContextFetchDefinition, M as MCPTransportType, m as MCPToolConfig, n as GraphScopeConfig, C as ConversationHistoryConfig, o as ProjectScopeConfig, p as PaginationConfig, q as AgentGraphInsert, r as AgentGraphUpdate, s as FullGraphDefinition, t as AgentScopeConfig, u as AgentRelationInsert, E as ExternalAgentRelationInsert, v as AgentRelationUpdate, w as AgentToolRelationUpdate, f as ToolMcpConfig, g as ToolServerCapabilities, x as AgentInsert, y as AgentUpdate, z as AgentSelect, B as ApiKeySelect, D as ApiKeyInsert, H as ApiKeyUpdate, I as CreateApiKeyParams, J as ApiKeyCreateResult, K as ArtifactComponentSelect, L as ArtifactComponentInsert, N as ArtifactComponentUpdate, O as ContextCacheSelect, Q as ContextCacheInsert, R as ContextConfigInsert, U as ContextConfigUpdate, V as ConversationSelect, W as ConversationInsert, h as ConversationMetadata, X as ConversationUpdate, Y as CredentialReferenceSelect, Z as ToolSelect, _ as CredentialReferenceInsert, $ as CredentialReferenceUpdate, a0 as DataComponentSelect, a1 as DataComponentInsert, a2 as DataComponentUpdate, a3 as ExternalAgentInsert, a4 as ExternalAgentSelect, a5 as ExternalAgentUpdate, a6 as Artifact, a7 as LedgerArtifactSelect, j as MessageMetadata, i as MessageContent, a8 as MessageVisibility, a9 as MessageInsert, aa as MessageUpdate, ab as FullProjectDefinition, ac as ProjectInfo, ad as ProjectSelect, ae as PaginationResult, af as ProjectResourceCounts, ag as ProjectInsert, ah as ProjectUpdate, ai as TaskInsert, T as TaskMetadataConfig, aj as TaskSelect, ak as McpTool, al as ToolInsert, am as ToolUpdate, d as CredentialStoreType, an as ExecutionContext } from './utility-C3eMTvpr.js';
3
+ export { a$ as A2AError, bv as A2ARequest, bw as A2AResponse, aA as APIKeySecurityScheme, bA as AgentApiInsert, ds as AgentApiInsertSchema, bz as AgentApiSelect, dr as AgentApiSelectSchema, bB as AgentApiUpdate, dt as AgentApiUpdateSchema, ct as AgentArtifactComponentApiInsert, eD as AgentArtifactComponentApiInsertSchema, cs as AgentArtifactComponentApiSelect, eC as AgentArtifactComponentApiSelectSchema, cu as AgentArtifactComponentApiUpdate, eE as AgentArtifactComponentApiUpdateSchema, cq as AgentArtifactComponentInsert, eA as AgentArtifactComponentInsertSchema, cp as AgentArtifactComponentSelect, ez as AgentArtifactComponentSelectSchema, cr as AgentArtifactComponentUpdate, eB as AgentArtifactComponentUpdateSchema, aw as AgentCapabilities, aK as AgentCard, d6 as AgentConversationHistoryConfig, ck as AgentDataComponentApiInsert, er as AgentDataComponentApiInsertSchema, cj as AgentDataComponentApiSelect, eq as AgentDataComponentApiSelectSchema, cl as AgentDataComponentApiUpdate, es as AgentDataComponentApiUpdateSchema, ch as AgentDataComponentInsert, eo as AgentDataComponentInsertSchema, cg as AgentDataComponentSelect, en as AgentDataComponentSelectSchema, ci as AgentDataComponentUpdate, ep as AgentDataComponentUpdateSchema, cS as AgentDefinition, bK as AgentGraphApiInsert, dH as AgentGraphApiInsertSchema, bJ as AgentGraphApiSelect, dG as AgentGraphApiSelectSchema, bL as AgentGraphApiUpdate, dI as AgentGraphApiUpdateSchema, dE as AgentGraphInsertSchema, bI as AgentGraphSelect, dD as AgentGraphSelectSchema, dF as AgentGraphUpdateSchema, dp as AgentInsertSchema, ax as AgentProvider, bE as AgentRelationApiInsert, dy as AgentRelationApiInsertSchema, bD as AgentRelationApiSelect, dx as AgentRelationApiSelectSchema, bF as AgentRelationApiUpdate, dz as AgentRelationApiUpdateSchema, dv as AgentRelationInsertSchema, bG as AgentRelationQuery, dA as AgentRelationQuerySchema, bC as AgentRelationSelect, du as AgentRelationSelectSchema, dw as AgentRelationUpdateSchema, dn as AgentSelectSchema, ay as AgentSkill, c as AgentStopWhen, A as AgentStopWhenSchema, cI as AgentToolRelationApiInsert, ff as AgentToolRelationApiInsertSchema, cH as AgentToolRelationApiSelect, fe as AgentToolRelationApiSelectSchema, cJ as AgentToolRelationApiUpdate, fg as AgentToolRelationApiUpdateSchema, cG as AgentToolRelationInsert, fc as AgentToolRelationInsertSchema, cF as AgentToolRelationSelect, fb as AgentToolRelationSelectSchema, fd as AgentToolRelationUpdateSchema, dq as AgentUpdateSchema, eL as AllAgentSchema, cy as AllAgentSelect, cC as ApiKeyApiCreationResponse, eQ as ApiKeyApiCreationResponseSchema, cA as ApiKeyApiInsert, eR as ApiKeyApiInsertSchema, cz as ApiKeyApiSelect, eP as ApiKeyApiSelectSchema, cB as ApiKeyApiUpdate, eS as ApiKeyApiUpdateSchema, eN as ApiKeyInsertSchema, eM as ApiKeySelectSchema, eO as ApiKeyUpdateSchema, cn as ArtifactComponentApiInsert, ex as ArtifactComponentApiInsertSchema, cm as ArtifactComponentApiSelect, ew as ArtifactComponentApiSelectSchema, co as ArtifactComponentApiUpdate, ey as ArtifactComponentApiUpdateSchema, eu as ArtifactComponentInsertSchema, et as ArtifactComponentSelectSchema, ev as ArtifactComponentUpdateSchema, aD as AuthorizationCodeOAuthFlow, cQ as CanUseItem, fp as CanUseItemSchema, bf as CancelTaskRequest, bq as CancelTaskResponse, bp as CancelTaskSuccessResponse, aE as ClientCredentialsOAuthFlow, aZ as ContentTypeNotSupportedError, cb as ContextCacheApiInsert, ee as ContextCacheApiInsertSchema, ca as ContextCacheApiSelect, ed as ContextCacheApiSelectSchema, cc as ContextCacheApiUpdate, ef as ContextCacheApiUpdateSchema, d7 as ContextCacheEntry, eb as ContextCacheInsertSchema, ea as ContextCacheSelectSchema, c9 as ContextCacheUpdate, ec as ContextCacheUpdateSchema, c5 as ContextConfigApiInsert, f9 as ContextConfigApiInsertSchema, c4 as ContextConfigApiSelect, f8 as ContextConfigApiSelectSchema, c6 as ContextConfigApiUpdate, fa as ContextConfigApiUpdateSchema, f6 as ContextConfigInsertSchema, f5 as ContextConfigSelectSchema, f7 as ContextConfigUpdateSchema, b_ as ConversationApiInsert, e2 as ConversationApiInsertSchema, bZ as ConversationApiSelect, e1 as ConversationApiSelectSchema, b$ as ConversationApiUpdate, e3 as ConversationApiUpdateSchema, d$ as ConversationInsertSchema, d5 as ConversationScopeOptions, d_ as ConversationSelectSchema, e0 as ConversationUpdateSchema, eX as CredentialReferenceApiInsertSchema, cD as CredentialReferenceApiSelect, eW as CredentialReferenceApiSelectSchema, cE as CredentialReferenceApiUpdate, eY as CredentialReferenceApiUpdateSchema, eU as CredentialReferenceInsertSchema, eT as CredentialReferenceSelectSchema, eV as CredentialReferenceUpdateSchema, ce as DataComponentApiInsert, el as DataComponentApiInsertSchema, cd as DataComponentApiSelect, ek as DataComponentApiSelectSchema, cf as DataComponentApiUpdate, em as DataComponentApiUpdateSchema, ei as DataComponentBaseSchema, eh as DataComponentInsertSchema, eg as DataComponentSelectSchema, ej as DataComponentUpdateSchema, au as DataPart, fv as ErrorResponseSchema, fw as ExistsResponseSchema, cw as ExternalAgentApiInsert, eJ as ExternalAgentApiInsertSchema, cv as ExternalAgentApiSelect, eI as ExternalAgentApiSelectSchema, cx as ExternalAgentApiUpdate, eK as ExternalAgentApiUpdateSchema, eG as ExternalAgentInsertSchema, bH as ExternalAgentRelationApiInsert, dC as ExternalAgentRelationApiInsertSchema, dB as ExternalAgentRelationInsertSchema, eF as ExternalAgentSelectSchema, eH as ExternalAgentUpdateSchema, c8 as FetchConfig, f3 as FetchConfigSchema, c7 as FetchDefinition, f4 as FetchDefinitionSchema, aq as FileBase, at as FilePart, ar as FileWithBytes, as as FileWithUri, cP as FullGraphAgentInsert, F as FullGraphAgentInsertSchema, fq as FullGraphDefinitionSchema, fE as FullProjectDefinitionSchema, bh as GetTaskPushNotificationConfigRequest, bu as GetTaskPushNotificationConfigResponse, bt as GetTaskPushNotificationConfigSuccessResponse, be as GetTaskRequest, bo as GetTaskResponse, bn as GetTaskSuccessResponse, b as GraphStopWhen, G as GraphStopWhenSchema, fr as GraphWithinContextOfProjectSchema, aB as HTTPAuthSecurityScheme, fF as HeadersScopeSchema, fM as IdParamsSchema, aF as ImplicitOAuthFlow, cR as InternalAgentDefinition, aU as InternalError, a_ as InvalidAgentResponseError, aT as InvalidParamsError, aR as InvalidRequestError, aQ as JSONParseError, b9 as JSONRPCError, bb as JSONRPCErrorResponse, b7 as JSONRPCMessage, b8 as JSONRPCRequest, ba as JSONRPCResult, cN as LedgerArtifactApiInsert, fl as LedgerArtifactApiInsertSchema, cM as LedgerArtifactApiSelect, fk as LedgerArtifactApiSelectSchema, cO as LedgerArtifactApiUpdate, fm as LedgerArtifactApiUpdateSchema, cK as LedgerArtifactInsert, fi as LedgerArtifactInsertSchema, fh as LedgerArtifactSelectSchema, cL as LedgerArtifactUpdate, fj as LedgerArtifactUpdateSchema, ft as ListResponseSchema, dh as MAX_ID_LENGTH, df as MCPServerType, e_ as MCPToolConfigSchema, dg as MIN_ID_LENGTH, d8 as McpAuthType, d9 as McpServerAuth, db as McpServerCapabilities, dc as McpToolDefinition, dX as McpToolDefinitionSchema, eZ as McpToolSchema, da as McpTransportConfig, dV as McpTransportConfigSchema, aL as Message, c2 as MessageApiInsert, e8 as MessageApiInsertSchema, c1 as MessageApiSelect, e7 as MessageApiSelectSchema, c3 as MessageApiUpdate, e9 as MessageApiUpdateSchema, e5 as MessageInsertSchema, c$ as MessageMode, bx as MessagePart, c_ as MessageRole, c0 as MessageSelect, e4 as MessageSelectSchema, b5 as MessageSendConfiguration, b6 as MessageSendParams, cZ as MessageType, e6 as MessageUpdateSchema, aS as MethodNotFoundError, dl as ModelSchema, d2 as ModelSettings, dk as ModelSettingsSchema, d0 as Models, aH as OAuth2SecurityScheme, aC as OAuthFlows, aI as OpenIdConnectSecurityScheme, cX as Pagination, fN as PaginationQueryParamsSchema, fs as PaginationSchema, P as Part, ao as PartBase, aG as PasswordOAuthFlow, cV as ProjectApiInsert, fC as ProjectApiInsertSchema, cU as ProjectApiSelect, fB as ProjectApiSelectSchema, cW as ProjectApiUpdate, fD as ProjectApiUpdateSchema, fz as ProjectInsertSchema, dm as ProjectModelSchema, d1 as ProjectModels, fy as ProjectSelectSchema, fA as ProjectUpdateSchema, b0 as PushNotificationAuthenticationInfo, b1 as PushNotificationConfig, aX as PushNotificationNotSupportedError, fx as RemovedResponseSchema, aJ as SecurityScheme, az as SecuritySchemeBase, bc as SendMessageRequest, bk as SendMessageResponse, bj as SendMessageSuccessResponse, bd as SendStreamingMessageRequest, bm as SendStreamingMessageResponse, bl as SendStreamingMessageSuccessResponse, bg as SetTaskPushNotificationConfigRequest, bs as SetTaskPushNotificationConfigResponse, br as SetTaskPushNotificationConfigSuccessResponse, fu as SingleResponseSchema, d4 as StatusComponent, fn as StatusComponentSchema, fo as StatusUpdateSchema, d3 as StatusUpdateSettings, a as StopWhen, S as StopWhenSchema, cY as SummaryEvent, dd as TOOL_STATUS_VALUES, aN as Task, bO as TaskApiInsert, dN as TaskApiInsertSchema, bN as TaskApiSelect, dM as TaskApiSelectSchema, bP as TaskApiUpdate, dO as TaskApiUpdateSchema, by as TaskArtifact, aP as TaskArtifactUpdateEvent, b3 as TaskIdParams, dK as TaskInsertSchema, aW as TaskNotCancelableError, aV as TaskNotFoundError, b2 as TaskPushNotificationConfig, b4 as TaskQueryParams, bU as TaskRelationApiInsert, dT as TaskRelationApiInsertSchema, bT as TaskRelationApiSelect, dS as TaskRelationApiSelectSchema, bV as TaskRelationApiUpdate, dU as TaskRelationApiUpdateSchema, bR as TaskRelationInsert, dQ as TaskRelationInsertSchema, bQ as TaskRelationSelect, dP as TaskRelationSelectSchema, bS as TaskRelationUpdate, dR as TaskRelationUpdateSchema, bi as TaskResubscriptionRequest, dJ as TaskSelectSchema, av as TaskState, aM as TaskStatus, aO as TaskStatusUpdateEvent, bM as TaskUpdate, dL as TaskUpdateSchema, fL as TenantIdParamsSchema, fG as TenantParamsSchema, fJ as TenantProjectGraphIdParamsSchema, fI as TenantProjectGraphParamsSchema, fK as TenantProjectIdParamsSchema, fH as TenantProjectParamsSchema, ap as TextPart, bX as ToolApiInsert, f1 as ToolApiInsertSchema, bW as ToolApiSelect, f0 as ToolApiSelectSchema, bY as ToolApiUpdate, f2 as ToolApiUpdateSchema, cT as ToolDefinition, dZ as ToolInsertSchema, dY as ToolSelectSchema, dW as ToolStatusSchema, e$ as ToolUpdateSchema, di as URL_SAFE_ID_PATTERN, aY as UnsupportedOperationError, de as VALID_RELATION_TYPES, dj as resourceIdSchema } from './utility-C3eMTvpr.js';
4
4
  import { CredentialStore } from './types/index.js';
5
5
  export { CorsConfig, ServerConfig, ServerOptions } from './types/index.js';
6
6
  import { LibSQLDatabase } from 'drizzle-orm/libsql';
7
- import { s as schema } from './schema-78jVngGh.js';
8
- export { k as agentArtifactComponents, N as agentArtifactComponentsRelations, i as agentDataComponents, P as agentDataComponentsRelations, a as agentGraph, E as agentGraphRelations, e as agentRelations, R as agentRelationsRelations, m as agentToolRelations, H as agentToolRelationsRelations, d as agents, D as agentsRelations, r as apiKeys, G as apiKeysRelations, j as artifactComponents, M as artifactComponentsRelations, b as contextCache, C as contextCacheRelations, c as contextConfigs, B as contextConfigsRelations, n as conversations, K as conversationsRelations, u as credentialReferences, I as credentialReferencesRelations, h as dataComponents, O as dataComponentsRelations, f as externalAgents, F as externalAgentsRelations, q as ledgerArtifacts, w as ledgerArtifactsContextIdIdx, Q as ledgerArtifactsRelations, x as ledgerArtifactsTaskContextNameUnique, v as ledgerArtifactsTaskIdIdx, o as messages, L as messagesRelations, p as projects, z as projectsRelations, g as taskRelations, A as taskRelationsRelations, t as tasks, y as tasksRelations, l as tools, J as toolsRelations } from './schema-78jVngGh.js';
7
+ import { s as schema } from './schema-DnjptA-m.js';
8
+ export { k as agentArtifactComponents, O as agentArtifactComponentsRelations, i as agentDataComponents, Q as agentDataComponentsRelations, a as agentGraph, F as agentGraphRelations, e as agentRelations, S as agentRelationsRelations, m as agentToolRelations, I as agentToolRelationsRelations, d as agents, E as agentsRelations, r as apiKeys, H as apiKeysRelations, j as artifactComponents, N as artifactComponentsRelations, b as contextCache, D as contextCacheRelations, c as contextConfigs, C as contextConfigsRelations, n as conversations, L as conversationsRelations, u as credentialReferences, J as credentialReferencesRelations, h as dataComponents, P as dataComponentsRelations, f as externalAgents, G as externalAgentsRelations, q as ledgerArtifacts, x as ledgerArtifactsContextIdIdx, R as ledgerArtifactsRelations, y as ledgerArtifactsTaskContextNameUnique, v as ledgerArtifactsTaskIdIdx, w as ledgerArtifactsToolCallIdIdx, o as messages, M as messagesRelations, p as projects, A as projectsRelations, g as taskRelations, B as taskRelationsRelations, t as tasks, z as tasksRelations, l as tools, K as toolsRelations } from './schema-DnjptA-m.js';
9
9
  import { LoggerOptions, TransportSingleOptions, Logger } from 'pino';
10
10
  import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
11
11
  import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
@@ -2656,6 +2656,19 @@ declare const deleteFullGraph: (db: DatabaseClient, logger?: GraphLogger) => (pa
2656
2656
  scopes: GraphScopeConfig;
2657
2657
  }) => Promise<boolean>;
2658
2658
 
2659
+ /**
2660
+ * Atomic upsert operation for a single artifact - prevents race conditions
2661
+ */
2662
+ declare const upsertLedgerArtifact: (db: DatabaseClient) => (params: {
2663
+ scopes: ProjectScopeConfig;
2664
+ contextId: string;
2665
+ taskId: string;
2666
+ toolCallId?: string | null;
2667
+ artifact: Artifact;
2668
+ }) => Promise<{
2669
+ created: boolean;
2670
+ existing?: any;
2671
+ }>;
2659
2672
  /**
2660
2673
  * Save one or more artifacts to the ledger
2661
2674
  */
@@ -2663,15 +2676,17 @@ declare const addLedgerArtifacts: (db: DatabaseClient) => (params: {
2663
2676
  scopes: ProjectScopeConfig;
2664
2677
  contextId: string;
2665
2678
  taskId?: string | null;
2679
+ toolCallId?: string | null;
2666
2680
  artifacts: Artifact[];
2667
2681
  }) => Promise<void>;
2668
2682
  /**
2669
- * Retrieve artifacts by taskId and/or artifactId.
2670
- * At least one of taskId or artifactId must be provided.
2683
+ * Retrieve artifacts by taskId, toolCallId, and/or artifactId.
2684
+ * At least one of taskId, toolCallId, or artifactId must be provided.
2671
2685
  */
2672
2686
  declare const getLedgerArtifacts: (db: DatabaseClient) => (params: {
2673
2687
  scopes: ProjectScopeConfig;
2674
2688
  taskId?: string;
2689
+ toolCallId?: string;
2675
2690
  artifactId?: string;
2676
2691
  }) => Promise<Artifact[]>;
2677
2692
  /**
@@ -3890,4 +3905,4 @@ declare function setSpanWithError(span: Span, error: unknown, logger?: {
3890
3905
  */
3891
3906
  declare function getTracer(serviceName: string, serviceVersion?: string): Tracer;
3892
3907
 
3893
- export { AgentGraphInsert, AgentGraphUpdate, AgentInsert, AgentRelationInsert, AgentRelationUpdate, AgentScopeConfig, AgentSelect, AgentToolRelationUpdate, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, type CommonCreateErrorResponses, type CommonDeleteErrorResponses, type CommonGetErrorResponses, type CommonUpdateErrorResponses, ContextCache, ContextCacheInsert, ContextCacheSelect, ContextConfigBuilder, type ContextConfigBuilderOptions, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ContextFetcher, type ContextResolutionOptions, type ContextResolutionResult, ContextResolver, type ContextResolverInterface, type ContextValidationError, type ContextValidationResult, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationSelect, ConversationUpdate, CreateApiKeyParams, type CredentialContext, type CredentialData, CredentialReferenceApiInsert, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, type CredentialReferenceWithTools, type CredentialResolverInput, CredentialStore, type CredentialStoreReference, CredentialStoreRegistry, CredentialStoreType, CredentialStuffer, DataComponentInsert, DataComponentSelect, DataComponentUpdate, type DatabaseClient, type DatabaseConfig, type DotPaths, ERROR_DOCS_BASE_URL, ErrorCode, type ErrorCodes, type ErrorResponse, ExecutionContext, ExternalAgentInsert, ExternalAgentRelationInsert, ExternalAgentSelect, ExternalAgentUpdate, type FetchResult, FullGraphDefinition, FullProjectDefinition, type GraphLogger, GraphScopeConfig, HTTP_REQUEST_PARTS, type HttpRequestPart, InMemoryCredentialStore, KeyChainStore, LedgerArtifactSelect, type LoggerFactoryConfig, MCPToolConfig, MCPTransportType, McpClient, type McpClientOptions, type McpSSEConfig, type McpServerConfig, type McpStreamableHttpConfig, McpTool, MessageContent, MessageInsert, MessageMetadata, MessageUpdate, MessageVisibility, NangoCredentialStore, type OAuthConfig, PaginationConfig, PaginationResult, type ParsedHttpRequest, PinoLogger, type PinoLoggerConfig, type ProblemDetails, ProjectInfo, ProjectInsert, type ProjectLogger, ProjectResourceCounts, ProjectScopeConfig, ProjectSelect, ProjectUpdate, type ResolvedContext, TaskInsert, TaskMetadataConfig, TaskSelect, type TemplateContext, TemplateEngine, type TemplateRenderOptions, ToolInsert, ToolMcpConfig, ToolSelect, ToolServerCapabilities, ToolUpdate, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentGraph, createAgentRelation, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelation, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsByIds, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getContextConfigsByName, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getGraphAgentInfos, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, requestContextSchema, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateMessage, updateProject, updateTask, updateTool, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };
3908
+ export { AgentGraphInsert, AgentGraphUpdate, AgentInsert, AgentRelationInsert, AgentRelationUpdate, AgentScopeConfig, AgentSelect, AgentToolRelationUpdate, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, type CommonCreateErrorResponses, type CommonDeleteErrorResponses, type CommonGetErrorResponses, type CommonUpdateErrorResponses, ContextCache, ContextCacheInsert, ContextCacheSelect, ContextConfigBuilder, type ContextConfigBuilderOptions, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ContextFetcher, type ContextResolutionOptions, type ContextResolutionResult, ContextResolver, type ContextResolverInterface, type ContextValidationError, type ContextValidationResult, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationSelect, ConversationUpdate, CreateApiKeyParams, type CredentialContext, type CredentialData, CredentialReferenceApiInsert, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, type CredentialReferenceWithTools, type CredentialResolverInput, CredentialStore, type CredentialStoreReference, CredentialStoreRegistry, CredentialStoreType, CredentialStuffer, DataComponentInsert, DataComponentSelect, DataComponentUpdate, type DatabaseClient, type DatabaseConfig, type DotPaths, ERROR_DOCS_BASE_URL, ErrorCode, type ErrorCodes, type ErrorResponse, ExecutionContext, ExternalAgentInsert, ExternalAgentRelationInsert, ExternalAgentSelect, ExternalAgentUpdate, type FetchResult, FullGraphDefinition, FullProjectDefinition, type GraphLogger, GraphScopeConfig, HTTP_REQUEST_PARTS, type HttpRequestPart, InMemoryCredentialStore, KeyChainStore, LedgerArtifactSelect, type LoggerFactoryConfig, MCPToolConfig, MCPTransportType, McpClient, type McpClientOptions, type McpSSEConfig, type McpServerConfig, type McpStreamableHttpConfig, McpTool, MessageContent, MessageInsert, MessageMetadata, MessageUpdate, MessageVisibility, NangoCredentialStore, type OAuthConfig, PaginationConfig, PaginationResult, type ParsedHttpRequest, PinoLogger, type PinoLoggerConfig, type ProblemDetails, ProjectInfo, ProjectInsert, type ProjectLogger, ProjectResourceCounts, ProjectScopeConfig, ProjectSelect, ProjectUpdate, type ResolvedContext, TaskInsert, TaskMetadataConfig, TaskSelect, type TemplateContext, TemplateEngine, type TemplateRenderOptions, ToolInsert, ToolMcpConfig, ToolSelect, ToolServerCapabilities, ToolUpdate, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentGraph, createAgentRelation, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelation, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsByIds, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getContextConfigsByName, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getGraphAgentInfos, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, requestContextSchema, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateMessage, updateProject, updateTask, updateTool, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertLedgerArtifact, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  export { TaskState } from './chunk-H2F72PDA.js';
2
- import { validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-VZ62ZJTI.js';
3
- export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-VZ62ZJTI.js';
4
- import { ContextConfigApiUpdateSchema } from './chunk-P5LTXXFH.js';
5
- export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from './chunk-P5LTXXFH.js';
6
- import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-E4ZLV4GU.js';
7
- export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-E4ZLV4GU.js';
2
+ import { validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-GPGFF2K4.js';
3
+ export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-GPGFF2K4.js';
4
+ import { ContextConfigApiUpdateSchema } from './chunk-AX77SEE3.js';
5
+ export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from './chunk-AX77SEE3.js';
6
+ import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-URSDNK76.js';
7
+ export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, ledgerArtifactsToolCallIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-URSDNK76.js';
8
8
  import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-YFHT5M2R.js';
9
9
  export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-YFHT5M2R.js';
10
10
  import { __publicField } from './chunk-MKBO26DX.js';
@@ -5254,38 +5254,200 @@ var deleteFullGraph = (db, logger12 = defaultLogger) => async (params) => {
5254
5254
  throw error;
5255
5255
  }
5256
5256
  };
5257
+ function validateArtifactData(artifact, index) {
5258
+ if (!artifact.artifactId?.trim()) {
5259
+ throw new Error(`Artifact at index ${index} missing required artifactId`);
5260
+ }
5261
+ if (artifact.parts) {
5262
+ try {
5263
+ JSON.stringify(artifact.parts);
5264
+ } catch (error) {
5265
+ throw new Error(
5266
+ `Artifact ${artifact.artifactId} has invalid parts data: ${error instanceof Error ? error.message : "Unknown error"}`
5267
+ );
5268
+ }
5269
+ }
5270
+ if (artifact.metadata) {
5271
+ try {
5272
+ JSON.stringify(artifact.metadata);
5273
+ } catch (error) {
5274
+ throw new Error(
5275
+ `Artifact ${artifact.artifactId} has invalid metadata: ${error instanceof Error ? error.message : "Unknown error"}`
5276
+ );
5277
+ }
5278
+ }
5279
+ }
5280
+ function determineMimeTypes(artifact) {
5281
+ if (artifact.parts && artifact.parts.length > 0) {
5282
+ const kinds = /* @__PURE__ */ new Set();
5283
+ for (const part of artifact.parts) {
5284
+ if (part.kind) {
5285
+ kinds.add(part.kind);
5286
+ }
5287
+ }
5288
+ if (kinds.size > 0) {
5289
+ return Array.from(kinds);
5290
+ }
5291
+ }
5292
+ if (artifact.type?.toLowerCase().includes("document")) {
5293
+ return ["text"];
5294
+ }
5295
+ if (artifact.type?.toLowerCase().includes("image")) {
5296
+ return ["image"];
5297
+ }
5298
+ if (artifact.type?.toLowerCase().includes("code")) {
5299
+ return ["text"];
5300
+ }
5301
+ return ["data"];
5302
+ }
5303
+ function sanitizeArtifactForDatabase(artifact) {
5304
+ return {
5305
+ ...artifact,
5306
+ // Ensure text fields don't exceed reasonable limits
5307
+ name: artifact.name?.slice(0, 255) || void 0,
5308
+ description: artifact.description?.slice(0, 1e3) || void 0,
5309
+ // Clean any undefined values from JSON fields
5310
+ parts: artifact.parts ? JSON.parse(JSON.stringify(artifact.parts)) : null,
5311
+ metadata: artifact.metadata ? JSON.parse(JSON.stringify(artifact.metadata)) : null
5312
+ };
5313
+ }
5314
+ async function tryFallbackInsert(db, rows, _originalError) {
5315
+ for (let i = 0; i < rows.length; i++) {
5316
+ const row = rows[i];
5317
+ try {
5318
+ await db.insert(ledgerArtifacts).values([row]);
5319
+ } catch (_fallbackError) {
5320
+ try {
5321
+ const minimalRow = {
5322
+ id: row.id,
5323
+ tenantId: row.tenantId,
5324
+ projectId: row.projectId,
5325
+ taskId: row.taskId,
5326
+ toolCallId: row.toolCallId,
5327
+ contextId: row.contextId,
5328
+ type: row.type || "source",
5329
+ name: row.name || `Artifact ${row.id.substring(0, 8)}`,
5330
+ description: row.description || "Artifact from tool results",
5331
+ parts: null,
5332
+ // Skip complex JSON data
5333
+ metadata: null,
5334
+ // Skip complex JSON data
5335
+ summary: null,
5336
+ mime: null,
5337
+ visibility: "context",
5338
+ allowedAgents: null,
5339
+ derivedFrom: null,
5340
+ createdAt: row.createdAt,
5341
+ updatedAt: row.updatedAt
5342
+ };
5343
+ await db.insert(ledgerArtifacts).values([minimalRow]);
5344
+ } catch (_finalError) {
5345
+ }
5346
+ }
5347
+ }
5348
+ }
5349
+ var upsertLedgerArtifact = (db) => async (params) => {
5350
+ const { scopes, contextId, taskId, toolCallId = null, artifact } = params;
5351
+ validateArtifactData(artifact, 0);
5352
+ const sanitizedArt = sanitizeArtifactForDatabase(artifact);
5353
+ const now = (/* @__PURE__ */ new Date()).toISOString();
5354
+ const artifactRow = {
5355
+ id: sanitizedArt.artifactId ?? nanoid(),
5356
+ tenantId: scopes.tenantId,
5357
+ projectId: scopes.projectId,
5358
+ taskId,
5359
+ toolCallId,
5360
+ contextId,
5361
+ type: sanitizedArt.type ?? "source",
5362
+ name: sanitizedArt.name,
5363
+ description: sanitizedArt.description,
5364
+ parts: sanitizedArt.parts,
5365
+ metadata: sanitizedArt.metadata,
5366
+ summary: sanitizedArt.description?.slice(0, 200) ?? null,
5367
+ mime: determineMimeTypes(sanitizedArt),
5368
+ visibility: sanitizedArt.metadata?.visibility ?? "context",
5369
+ allowedAgents: sanitizedArt.metadata?.allowedAgents ?? [],
5370
+ derivedFrom: sanitizedArt.metadata?.derivedFrom ?? null,
5371
+ createdAt: now,
5372
+ updatedAt: now
5373
+ };
5374
+ try {
5375
+ await db.insert(ledgerArtifacts).values([artifactRow]);
5376
+ return { created: true };
5377
+ } catch (error) {
5378
+ if (error.message?.includes("UNIQUE") || error.message?.includes("duplicate")) {
5379
+ const existing = await db.select().from(ledgerArtifacts).where(
5380
+ and(
5381
+ eq(ledgerArtifacts.tenantId, scopes.tenantId),
5382
+ eq(ledgerArtifacts.projectId, scopes.projectId),
5383
+ eq(ledgerArtifacts.id, artifactRow.id),
5384
+ eq(ledgerArtifacts.taskId, taskId)
5385
+ )
5386
+ ).limit(1);
5387
+ if (existing.length > 0) {
5388
+ return { created: false, existing: existing[0] };
5389
+ }
5390
+ }
5391
+ throw error;
5392
+ }
5393
+ };
5257
5394
  var addLedgerArtifacts = (db) => async (params) => {
5258
- const { scopes, contextId, taskId = null, artifacts } = params;
5395
+ const { scopes, contextId, taskId = null, toolCallId = null, artifacts } = params;
5259
5396
  if (artifacts.length === 0) return;
5397
+ for (let i = 0; i < artifacts.length; i++) {
5398
+ validateArtifactData(artifacts[i], i);
5399
+ }
5260
5400
  const now = (/* @__PURE__ */ new Date()).toISOString();
5261
5401
  const rows = artifacts.map((art) => {
5262
- const resolvedTaskId = taskId ?? art.taskId ?? art.metadata?.taskId ?? null;
5402
+ const sanitizedArt = sanitizeArtifactForDatabase(art);
5403
+ const resolvedTaskId = taskId ?? sanitizedArt.taskId ?? sanitizedArt.metadata?.taskId ?? null;
5263
5404
  return {
5264
- id: art.artifactId ?? nanoid(),
5405
+ id: sanitizedArt.artifactId ?? nanoid(),
5265
5406
  tenantId: scopes.tenantId,
5266
5407
  projectId: scopes.projectId,
5267
5408
  taskId: resolvedTaskId,
5409
+ toolCallId: toolCallId ?? sanitizedArt.metadata?.toolCallId ?? null,
5268
5410
  contextId,
5269
- name: art.name ?? null,
5270
- description: art.description ?? null,
5271
- parts: art.parts ?? null,
5272
- metadata: art.metadata ?? null,
5411
+ type: sanitizedArt.type ?? "source",
5412
+ name: sanitizedArt.name,
5413
+ description: sanitizedArt.description,
5414
+ parts: sanitizedArt.parts,
5415
+ metadata: sanitizedArt.metadata,
5273
5416
  // extra (optional) ledger fields
5274
- summary: art.description?.slice(0, 200) ?? null,
5275
- mime: art.parts?.map((p) => p.kind) ?? null,
5276
- visibility: art.metadata?.visibility ?? "context",
5277
- allowedAgents: art.metadata?.allowedAgents ?? null,
5278
- derivedFrom: art.metadata?.derivedFrom ?? null,
5417
+ summary: sanitizedArt.description?.slice(0, 200) ?? null,
5418
+ mime: determineMimeTypes(sanitizedArt),
5419
+ // Simple string fallback until we debug the issue
5420
+ visibility: sanitizedArt.metadata?.visibility ?? "context",
5421
+ allowedAgents: sanitizedArt.metadata?.allowedAgents ?? [],
5422
+ // Fix: use empty array, not null
5423
+ derivedFrom: sanitizedArt.metadata?.derivedFrom ?? null,
5279
5424
  createdAt: now,
5280
5425
  updatedAt: now
5281
5426
  };
5282
5427
  });
5283
- await db.insert(ledgerArtifacts).values(rows);
5428
+ const maxRetries = 3;
5429
+ let lastError = null;
5430
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
5431
+ try {
5432
+ await db.insert(ledgerArtifacts).values(rows);
5433
+ return;
5434
+ } catch (error) {
5435
+ lastError = error;
5436
+ const isRetryable = error.code === "SQLITE_BUSY" || error.code === "SQLITE_LOCKED" || error.message?.includes("database is locked") || error.message?.includes("busy") || error.message?.includes("timeout");
5437
+ if (!isRetryable || attempt === maxRetries) {
5438
+ await tryFallbackInsert(db, rows);
5439
+ return;
5440
+ }
5441
+ const backoffMs = Math.min(1e3 * 2 ** (attempt - 1), 5e3);
5442
+ await new Promise((resolve) => setTimeout(resolve, backoffMs));
5443
+ }
5444
+ }
5445
+ throw lastError;
5284
5446
  };
5285
5447
  var getLedgerArtifacts = (db) => async (params) => {
5286
- const { scopes, taskId, artifactId } = params;
5287
- if (!taskId && !artifactId) {
5288
- throw new Error("Either taskId or artifactId must be provided");
5448
+ const { scopes, taskId, toolCallId, artifactId } = params;
5449
+ if (!taskId && !toolCallId && !artifactId) {
5450
+ throw new Error("At least one of taskId, toolCallId, or artifactId must be provided");
5289
5451
  }
5290
5452
  const conditions = [
5291
5453
  eq(ledgerArtifacts.tenantId, scopes.tenantId),
@@ -5297,6 +5459,9 @@ var getLedgerArtifacts = (db) => async (params) => {
5297
5459
  if (taskId) {
5298
5460
  conditions.push(eq(ledgerArtifacts.taskId, taskId));
5299
5461
  }
5462
+ if (toolCallId) {
5463
+ conditions.push(eq(ledgerArtifacts.toolCallId, toolCallId));
5464
+ }
5300
5465
  const query = db.select().from(ledgerArtifacts).where(conditions.length > 1 ? and(...conditions) : conditions[0]);
5301
5466
  const results = await query;
5302
5467
  return results.map(
@@ -5304,6 +5469,8 @@ var getLedgerArtifacts = (db) => async (params) => {
5304
5469
  artifactId: row.id,
5305
5470
  type: row.type ?? "source",
5306
5471
  taskId: row.taskId ?? void 0,
5472
+ toolCallId: row.toolCallId ?? void 0,
5473
+ // Added for traceability to the specific tool execution
5307
5474
  name: row.name ?? void 0,
5308
5475
  description: row.description ?? void 0,
5309
5476
  parts: row.parts ?? [],
@@ -8651,6 +8818,8 @@ loadEnvironmentFiles();
8651
8818
  var envSchema = z$1.object({
8652
8819
  ENVIRONMENT: z$1.enum(["development", "production", "pentest", "test"]).optional(),
8653
8820
  DB_FILE_NAME: z$1.string().optional(),
8821
+ TURSO_DATABASE_URL: z$1.string().optional(),
8822
+ TURSO_AUTH_TOKEN: z$1.string().optional(),
8654
8823
  OTEL_TRACES_FORCE_FLUSH_ENABLED: z$1.coerce.boolean().optional()
8655
8824
  });
8656
8825
  var parseEnv = () => {
@@ -8670,4 +8839,4 @@ ${error.message}`
8670
8839
  };
8671
8840
  parseEnv();
8672
8841
 
8673
- export { ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, ERROR_DOCS_BASE_URL, ErrorCode, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, McpClient, NangoCredentialStore, PinoLogger, TemplateEngine, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentGraph, createAgentRelation, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelation, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsByIds, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getContextConfigsByName, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getGraphAgentInfos, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, requestContextSchema, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateMessage, updateProject, updateTask, updateTool, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };
8842
+ export { ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, ERROR_DOCS_BASE_URL, ErrorCode, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, McpClient, NangoCredentialStore, PinoLogger, TemplateEngine, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentGraph, createAgentRelation, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createFullProjectServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelation, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteFullProject, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsByIds, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getContextConfigsByName, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getFullProject, getGraphAgentInfos, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, loadEnvironmentFiles, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, requestContextSchema, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateFullProjectServerSide, updateMessage, updateProject, updateTask, updateTool, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertLedgerArtifact, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };