@inkeep/agents-core 0.1.4 → 0.1.6

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.
Files changed (285) hide show
  1. package/SUPPLEMENTAL_TERMS.md +40 -0
  2. package/dist/chunk-H2F72PDA.js +15 -0
  3. package/dist/chunk-M4JXMAG7.js +822 -0
  4. package/dist/chunk-MKBO26DX.js +9 -0
  5. package/dist/chunk-RZPLS4MU.js +676 -0
  6. package/dist/chunk-SVGQSPW4.js +24 -0
  7. package/dist/client-exports.cjs +246 -0
  8. package/dist/client-exports.d.cts +315 -0
  9. package/dist/client-exports.d.ts +64 -49
  10. package/dist/client-exports.js +201 -246
  11. package/dist/db/schema.cjs +819 -0
  12. package/dist/db/schema.d.cts +8 -0
  13. package/dist/db/schema.d.ts +8 -4337
  14. package/dist/db/schema.js +1 -696
  15. package/dist/entities-CNJaf-rG.d.cts +7849 -0
  16. package/dist/entities-CNJaf-rG.d.ts +7849 -0
  17. package/dist/index.cjs +9647 -0
  18. package/dist/index.d.cts +3991 -0
  19. package/dist/index.d.ts +3991 -12
  20. package/dist/index.js +7646 -13
  21. package/dist/schema-DFDqtBpV.d.ts +4401 -0
  22. package/dist/schema-Dbc3UMpd.d.cts +4401 -0
  23. package/dist/types/index.cjs +45 -0
  24. package/dist/types/index.d.cts +125 -0
  25. package/dist/types/index.d.ts +125 -5
  26. package/dist/types/index.js +2 -6
  27. package/dist/validation/index.cjs +1642 -0
  28. package/dist/validation/index.d.cts +64 -0
  29. package/dist/validation/index.d.ts +64 -4
  30. package/dist/validation/index.js +1 -5
  31. package/package.json +6 -4
  32. package/dist/__tests__/integration/helpers.d.ts +0 -5
  33. package/dist/__tests__/integration/helpers.d.ts.map +0 -1
  34. package/dist/__tests__/integration/helpers.js +0 -37
  35. package/dist/__tests__/integration/helpers.js.map +0 -1
  36. package/dist/__tests__/setup.d.ts +0 -3
  37. package/dist/__tests__/setup.d.ts.map +0 -1
  38. package/dist/__tests__/setup.js +0 -29
  39. package/dist/__tests__/setup.js.map +0 -1
  40. package/dist/client-exports.d.ts.map +0 -1
  41. package/dist/client-exports.js.map +0 -1
  42. package/dist/context/ContextConfig.d.ts +0 -54
  43. package/dist/context/ContextConfig.d.ts.map +0 -1
  44. package/dist/context/ContextConfig.js +0 -302
  45. package/dist/context/ContextConfig.js.map +0 -1
  46. package/dist/context/ContextFetcher.d.ts +0 -64
  47. package/dist/context/ContextFetcher.d.ts.map +0 -1
  48. package/dist/context/ContextFetcher.js +0 -325
  49. package/dist/context/ContextFetcher.js.map +0 -1
  50. package/dist/context/ContextResolver.d.ts +0 -52
  51. package/dist/context/ContextResolver.d.ts.map +0 -1
  52. package/dist/context/ContextResolver.js +0 -298
  53. package/dist/context/ContextResolver.js.map +0 -1
  54. package/dist/context/TemplateEngine.d.ts +0 -46
  55. package/dist/context/TemplateEngine.d.ts.map +0 -1
  56. package/dist/context/TemplateEngine.js +0 -175
  57. package/dist/context/TemplateEngine.js.map +0 -1
  58. package/dist/context/context.d.ts +0 -8
  59. package/dist/context/context.d.ts.map +0 -1
  60. package/dist/context/context.js +0 -157
  61. package/dist/context/context.js.map +0 -1
  62. package/dist/context/contextCache.d.ts +0 -50
  63. package/dist/context/contextCache.d.ts.map +0 -1
  64. package/dist/context/contextCache.js +0 -175
  65. package/dist/context/contextCache.js.map +0 -1
  66. package/dist/context/index.d.ts +0 -11
  67. package/dist/context/index.d.ts.map +0 -1
  68. package/dist/context/index.js +0 -8
  69. package/dist/context/index.js.map +0 -1
  70. package/dist/credential-stores/CredentialStoreRegistry.d.ts +0 -39
  71. package/dist/credential-stores/CredentialStoreRegistry.d.ts.map +0 -1
  72. package/dist/credential-stores/CredentialStoreRegistry.js +0 -65
  73. package/dist/credential-stores/CredentialStoreRegistry.js.map +0 -1
  74. package/dist/credential-stores/defaults.d.ts +0 -6
  75. package/dist/credential-stores/defaults.d.ts.map +0 -1
  76. package/dist/credential-stores/defaults.js +0 -22
  77. package/dist/credential-stores/defaults.js.map +0 -1
  78. package/dist/credential-stores/index.d.ts +0 -6
  79. package/dist/credential-stores/index.d.ts.map +0 -1
  80. package/dist/credential-stores/index.js +0 -6
  81. package/dist/credential-stores/index.js.map +0 -1
  82. package/dist/credential-stores/keychain-store.d.ts +0 -100
  83. package/dist/credential-stores/keychain-store.d.ts.map +0 -1
  84. package/dist/credential-stores/keychain-store.js +0 -225
  85. package/dist/credential-stores/keychain-store.js.map +0 -1
  86. package/dist/credential-stores/memory-store.d.ts +0 -39
  87. package/dist/credential-stores/memory-store.d.ts.map +0 -1
  88. package/dist/credential-stores/memory-store.js +0 -58
  89. package/dist/credential-stores/memory-store.js.map +0 -1
  90. package/dist/credential-stores/nango-store.d.ts +0 -59
  91. package/dist/credential-stores/nango-store.d.ts.map +0 -1
  92. package/dist/credential-stores/nango-store.js +0 -264
  93. package/dist/credential-stores/nango-store.js.map +0 -1
  94. package/dist/credential-stuffer/CredentialStuffer.d.ts +0 -80
  95. package/dist/credential-stuffer/CredentialStuffer.d.ts.map +0 -1
  96. package/dist/credential-stuffer/CredentialStuffer.js +0 -186
  97. package/dist/credential-stuffer/CredentialStuffer.js.map +0 -1
  98. package/dist/credential-stuffer/index.d.ts +0 -2
  99. package/dist/credential-stuffer/index.d.ts.map +0 -1
  100. package/dist/credential-stuffer/index.js +0 -2
  101. package/dist/credential-stuffer/index.js.map +0 -1
  102. package/dist/data-access/agentDataComponents.d.ts +0 -1
  103. package/dist/data-access/agentDataComponents.d.ts.map +0 -1
  104. package/dist/data-access/agentDataComponents.js +0 -2
  105. package/dist/data-access/agentDataComponents.js.map +0 -1
  106. package/dist/data-access/agentGraphs.d.ts +0 -406
  107. package/dist/data-access/agentGraphs.d.ts.map +0 -1
  108. package/dist/data-access/agentGraphs.js +0 -551
  109. package/dist/data-access/agentGraphs.js.map +0 -1
  110. package/dist/data-access/agentRelations.d.ts +0 -456
  111. package/dist/data-access/agentRelations.d.ts.map +0 -1
  112. package/dist/data-access/agentRelations.js +0 -471
  113. package/dist/data-access/agentRelations.js.map +0 -1
  114. package/dist/data-access/agents.d.ts +0 -218
  115. package/dist/data-access/agents.d.ts.map +0 -1
  116. package/dist/data-access/agents.js +0 -130
  117. package/dist/data-access/agents.js.map +0 -1
  118. package/dist/data-access/apiKeys.d.ts +0 -114
  119. package/dist/data-access/apiKeys.d.ts.map +0 -1
  120. package/dist/data-access/apiKeys.js +0 -185
  121. package/dist/data-access/apiKeys.js.map +0 -1
  122. package/dist/data-access/artifactComponents.d.ts +0 -152
  123. package/dist/data-access/artifactComponents.d.ts.map +0 -1
  124. package/dist/data-access/artifactComponents.js +0 -214
  125. package/dist/data-access/artifactComponents.js.map +0 -1
  126. package/dist/data-access/contextCache.d.ts +0 -68
  127. package/dist/data-access/contextCache.d.ts.map +0 -1
  128. package/dist/data-access/contextCache.js +0 -160
  129. package/dist/data-access/contextCache.js.map +0 -1
  130. package/dist/data-access/contextConfigs.d.ts +0 -110
  131. package/dist/data-access/contextConfigs.d.ts.map +0 -1
  132. package/dist/data-access/contextConfigs.js +0 -156
  133. package/dist/data-access/contextConfigs.js.map +0 -1
  134. package/dist/data-access/conversations.d.ts +0 -125
  135. package/dist/data-access/conversations.d.ts.map +0 -1
  136. package/dist/data-access/conversations.js +0 -244
  137. package/dist/data-access/conversations.js.map +0 -1
  138. package/dist/data-access/credentialReferences.d.ts +0 -86
  139. package/dist/data-access/credentialReferences.d.ts.map +0 -1
  140. package/dist/data-access/credentialReferences.js +0 -175
  141. package/dist/data-access/credentialReferences.js.map +0 -1
  142. package/dist/data-access/dataComponents.d.ts +0 -129
  143. package/dist/data-access/dataComponents.d.ts.map +0 -1
  144. package/dist/data-access/dataComponents.js +0 -213
  145. package/dist/data-access/dataComponents.js.map +0 -1
  146. package/dist/data-access/externalAgents.d.ts +0 -83
  147. package/dist/data-access/externalAgents.d.ts.map +0 -1
  148. package/dist/data-access/externalAgents.js +0 -163
  149. package/dist/data-access/externalAgents.js.map +0 -1
  150. package/dist/data-access/graphFull.d.ts +0 -32
  151. package/dist/data-access/graphFull.d.ts.map +0 -1
  152. package/dist/data-access/graphFull.js +0 -996
  153. package/dist/data-access/graphFull.js.map +0 -1
  154. package/dist/data-access/index.d.ts +0 -21
  155. package/dist/data-access/index.d.ts.map +0 -1
  156. package/dist/data-access/index.js +0 -22
  157. package/dist/data-access/index.js.map +0 -1
  158. package/dist/data-access/ledgerArtifacts.d.ts +0 -49
  159. package/dist/data-access/ledgerArtifacts.d.ts.map +0 -1
  160. package/dist/data-access/ledgerArtifacts.js +0 -112
  161. package/dist/data-access/ledgerArtifacts.js.map +0 -1
  162. package/dist/data-access/messages.d.ts +0 -209
  163. package/dist/data-access/messages.d.ts.map +0 -1
  164. package/dist/data-access/messages.js +0 -100
  165. package/dist/data-access/messages.js.map +0 -1
  166. package/dist/data-access/projects.d.ts +0 -67
  167. package/dist/data-access/projects.d.ts.map +0 -1
  168. package/dist/data-access/projects.js +0 -337
  169. package/dist/data-access/projects.js.map +0 -1
  170. package/dist/data-access/tasks.d.ts +0 -37
  171. package/dist/data-access/tasks.d.ts.map +0 -1
  172. package/dist/data-access/tasks.js +0 -40
  173. package/dist/data-access/tasks.js.map +0 -1
  174. package/dist/data-access/tools.d.ts +0 -277
  175. package/dist/data-access/tools.d.ts.map +0 -1
  176. package/dist/data-access/tools.js +0 -183
  177. package/dist/data-access/tools.js.map +0 -1
  178. package/dist/data-access/validation.d.ts +0 -17
  179. package/dist/data-access/validation.d.ts.map +0 -1
  180. package/dist/data-access/validation.js +0 -52
  181. package/dist/data-access/validation.js.map +0 -1
  182. package/dist/db/clean.d.ts +0 -6
  183. package/dist/db/clean.d.ts.map +0 -1
  184. package/dist/db/clean.js +0 -81
  185. package/dist/db/clean.js.map +0 -1
  186. package/dist/db/client.d.ts +0 -19
  187. package/dist/db/client.d.ts.map +0 -1
  188. package/dist/db/client.js +0 -24
  189. package/dist/db/client.js.map +0 -1
  190. package/dist/db/schema.d.ts.map +0 -1
  191. package/dist/db/schema.js.map +0 -1
  192. package/dist/db/test-client.d.ts +0 -25
  193. package/dist/db/test-client.d.ts.map +0 -1
  194. package/dist/db/test-client.js +0 -136
  195. package/dist/db/test-client.js.map +0 -1
  196. package/dist/env.d.ts +0 -19
  197. package/dist/env.d.ts.map +0 -1
  198. package/dist/env.js +0 -49
  199. package/dist/env.js.map +0 -1
  200. package/dist/index.d.ts.map +0 -1
  201. package/dist/index.js.map +0 -1
  202. package/dist/middleware/contextValidation.d.ts +0 -49
  203. package/dist/middleware/contextValidation.d.ts.map +0 -1
  204. package/dist/middleware/contextValidation.js +0 -473
  205. package/dist/middleware/contextValidation.js.map +0 -1
  206. package/dist/middleware/index.d.ts +0 -2
  207. package/dist/middleware/index.d.ts.map +0 -1
  208. package/dist/middleware/index.js +0 -2
  209. package/dist/middleware/index.js.map +0 -1
  210. package/dist/server/BaseServer.d.ts +0 -83
  211. package/dist/server/BaseServer.d.ts.map +0 -1
  212. package/dist/server/BaseServer.js +0 -218
  213. package/dist/server/BaseServer.js.map +0 -1
  214. package/dist/types/a2a.d.ts +0 -373
  215. package/dist/types/a2a.d.ts.map +0 -1
  216. package/dist/types/a2a.js +0 -14
  217. package/dist/types/a2a.js.map +0 -1
  218. package/dist/types/entities.d.ts +0 -147
  219. package/dist/types/entities.d.ts.map +0 -1
  220. package/dist/types/entities.js +0 -2
  221. package/dist/types/entities.js.map +0 -1
  222. package/dist/types/index.d.ts.map +0 -1
  223. package/dist/types/index.js.map +0 -1
  224. package/dist/types/server.d.ts +0 -116
  225. package/dist/types/server.d.ts.map +0 -1
  226. package/dist/types/server.js +0 -2
  227. package/dist/types/server.js.map +0 -1
  228. package/dist/types/utility.d.ts +0 -213
  229. package/dist/types/utility.d.ts.map +0 -1
  230. package/dist/types/utility.js +0 -9
  231. package/dist/types/utility.js.map +0 -1
  232. package/dist/utils/apiKeys.d.ts +0 -32
  233. package/dist/utils/apiKeys.d.ts.map +0 -1
  234. package/dist/utils/apiKeys.js +0 -117
  235. package/dist/utils/apiKeys.js.map +0 -1
  236. package/dist/utils/auth-detection.d.ts +0 -23
  237. package/dist/utils/auth-detection.d.ts.map +0 -1
  238. package/dist/utils/auth-detection.js +0 -148
  239. package/dist/utils/auth-detection.js.map +0 -1
  240. package/dist/utils/credential-store-utils.d.ts +0 -11
  241. package/dist/utils/credential-store-utils.d.ts.map +0 -1
  242. package/dist/utils/credential-store-utils.js +0 -19
  243. package/dist/utils/credential-store-utils.js.map +0 -1
  244. package/dist/utils/error.d.ts +0 -526
  245. package/dist/utils/error.d.ts.map +0 -1
  246. package/dist/utils/error.js +0 -282
  247. package/dist/utils/error.js.map +0 -1
  248. package/dist/utils/execution.d.ts +0 -18
  249. package/dist/utils/execution.d.ts.map +0 -1
  250. package/dist/utils/execution.js +0 -25
  251. package/dist/utils/execution.js.map +0 -1
  252. package/dist/utils/index.d.ts +0 -9
  253. package/dist/utils/index.d.ts.map +0 -1
  254. package/dist/utils/index.js +0 -9
  255. package/dist/utils/index.js.map +0 -1
  256. package/dist/utils/logger.d.ts +0 -79
  257. package/dist/utils/logger.d.ts.map +0 -1
  258. package/dist/utils/logger.js +0 -102
  259. package/dist/utils/logger.js.map +0 -1
  260. package/dist/utils/logging.d.ts +0 -11
  261. package/dist/utils/logging.d.ts.map +0 -1
  262. package/dist/utils/logging.js +0 -6
  263. package/dist/utils/logging.js.map +0 -1
  264. package/dist/utils/mcp-client.d.ts +0 -48
  265. package/dist/utils/mcp-client.d.ts.map +0 -1
  266. package/dist/utils/mcp-client.js +0 -174
  267. package/dist/utils/mcp-client.js.map +0 -1
  268. package/dist/utils/tracer.d.ts +0 -24
  269. package/dist/utils/tracer.d.ts.map +0 -1
  270. package/dist/utils/tracer.js +0 -110
  271. package/dist/utils/tracer.js.map +0 -1
  272. package/dist/validation/graphFull.d.ts +0 -36
  273. package/dist/validation/graphFull.d.ts.map +0 -1
  274. package/dist/validation/graphFull.js +0 -128
  275. package/dist/validation/graphFull.js.map +0 -1
  276. package/dist/validation/id-validation.d.ts +0 -38
  277. package/dist/validation/id-validation.d.ts.map +0 -1
  278. package/dist/validation/id-validation.js +0 -60
  279. package/dist/validation/id-validation.js.map +0 -1
  280. package/dist/validation/index.d.ts.map +0 -1
  281. package/dist/validation/index.js.map +0 -1
  282. package/dist/validation/schemas.d.ts +0 -7238
  283. package/dist/validation/schemas.d.ts.map +0 -1
  284. package/dist/validation/schemas.js +0 -575
  285. package/dist/validation/schemas.js.map +0 -1
@@ -0,0 +1,3991 @@
1
+ import { z } from 'zod/v4';
2
+ import { a as ContextFetchDefinition, i as ContextConfigSelect, F as FetchDefinition, M as MCPTransportType, j as MCPToolConfig, S as ScopeConfig, b as ConversationHistoryConfig, k as PaginationConfig, A as AgentGraphInsert, l as AgentGraphUpdate, m as FullGraphDefinition, n as AgentRelationInsert, E as ExternalAgentRelationInsert, o as AgentRelationUpdate, p as AgentToolRelationUpdate, c as ToolMcpConfig, d as ToolServerCapabilities, e as McpToolDefinition, q as AgentInsert, r as AgentUpdate, s as AgentSelect, t as ApiKeySelect, u as ApiKeyInsert, v as ApiKeyUpdate, w as CreateApiKeyParams, x as ApiKeyCreateResult, y as ArtifactComponentSelect, z as ArtifactComponentInsert, B as ArtifactComponentUpdate, D as ContextCacheSelect, G as ContextCacheInsert, H as ContextConfigInsert, I as ContextConfigUpdate, J as ConversationSelect, K as ConversationInsert, f as ConversationMetadata, L as ConversationUpdate, N as CredentialReferenceSelect, O as ToolSelect, Q as CredentialReferenceInsert, R as CredentialReferenceUpdate, U as DataComponentSelect, V as DataComponentInsert, W as DataComponentUpdate, X as ExternalAgentInsert, Y as ExternalAgentSelect, Z as ExternalAgentUpdate, _ as Artifact, $ as LedgerArtifactSelect, h as MessageMetadata, g as MessageContent, a0 as MessageVisibility, a1 as MessageInsert, a2 as MessageUpdate, a3 as ProjectInfo, a4 as ProjectSelect, a5 as PaginationResult, a6 as ProjectResourceCounts, a7 as ProjectInsert, a8 as ProjectUpdate, a9 as TaskInsert, T as TaskMetadataConfig, aa as TaskSelect, ab as McpTool, ac as McpToolStatus, ad as ToolInsert, ae as ToolUpdate, C as CredentialStoreType, af as ExecutionContext } from './entities-CNJaf-rG.cjs';
3
+ export { aT as A2AError, bn as A2ARequest, bo as A2AResponse, as as APIKeySecurityScheme, bs as AgentApiInsert, dh as AgentApiInsertSchema, br as AgentApiSelect, dg as AgentApiSelectSchema, bt as AgentApiUpdate, di as AgentApiUpdateSchema, ck as AgentArtifactComponentApiInsert, et as AgentArtifactComponentApiInsertSchema, cj as AgentArtifactComponentApiSelect, es as AgentArtifactComponentApiSelectSchema, cl as AgentArtifactComponentApiUpdate, eu as AgentArtifactComponentApiUpdateSchema, ch as AgentArtifactComponentInsert, eq as AgentArtifactComponentInsertSchema, cg as AgentArtifactComponentSelect, ep as AgentArtifactComponentSelectSchema, ci as AgentArtifactComponentUpdate, er as AgentArtifactComponentUpdateSchema, ao as AgentCapabilities, aC as AgentCard, cY as AgentConversationHistoryConfig, cb as AgentDataComponentApiInsert, eh as AgentDataComponentApiInsertSchema, ca as AgentDataComponentApiSelect, eg as AgentDataComponentApiSelectSchema, cc as AgentDataComponentApiUpdate, ei as AgentDataComponentApiUpdateSchema, c8 as AgentDataComponentInsert, ee as AgentDataComponentInsertSchema, c7 as AgentDataComponentSelect, ed as AgentDataComponentSelectSchema, c9 as AgentDataComponentUpdate, ef as AgentDataComponentUpdateSchema, cJ as AgentDefinition, bC as AgentGraphApiInsert, dx as AgentGraphApiInsertSchema, bB as AgentGraphApiSelect, dw as AgentGraphApiSelectSchema, bD as AgentGraphApiUpdate, dy as AgentGraphApiUpdateSchema, du as AgentGraphInsertSchema, bA as AgentGraphSelect, dt as AgentGraphSelectSchema, dv as AgentGraphUpdateSchema, de as AgentInsertSchema, ap as AgentProvider, bw as AgentRelationApiInsert, dn as AgentRelationApiInsertSchema, bv as AgentRelationApiSelect, dm as AgentRelationApiSelectSchema, bx as AgentRelationApiUpdate, dp as AgentRelationApiUpdateSchema, dk as AgentRelationInsertSchema, by as AgentRelationQuery, dq as AgentRelationQuerySchema, bu as AgentRelationSelect, dj as AgentRelationSelectSchema, dl as AgentRelationUpdateSchema, dd as AgentSelectSchema, aq as AgentSkill, cA as AgentToolRelationApiInsert, f5 as AgentToolRelationApiInsertSchema, cz as AgentToolRelationApiSelect, f4 as AgentToolRelationApiSelectSchema, cB as AgentToolRelationApiUpdate, f6 as AgentToolRelationApiUpdateSchema, cy as AgentToolRelationInsert, f2 as AgentToolRelationInsertSchema, cx as AgentToolRelationSelect, f1 as AgentToolRelationSelectSchema, f3 as AgentToolRelationUpdateSchema, df as AgentUpdateSchema, eB as AllAgentSchema, cp as AllAgentSelect, ct as ApiKeyApiCreationResponse, eG as ApiKeyApiCreationResponseSchema, cr as ApiKeyApiInsert, eH as ApiKeyApiInsertSchema, cq as ApiKeyApiSelect, eF as ApiKeyApiSelectSchema, cs as ApiKeyApiUpdate, eI as ApiKeyApiUpdateSchema, eD as ApiKeyInsertSchema, eC as ApiKeySelectSchema, eE as ApiKeyUpdateSchema, ce as ArtifactComponentApiInsert, en as ArtifactComponentApiInsertSchema, cd as ArtifactComponentApiSelect, em as ArtifactComponentApiSelectSchema, cf as ArtifactComponentApiUpdate, eo as ArtifactComponentApiUpdateSchema, ek as ArtifactComponentInsertSchema, ej as ArtifactComponentSelectSchema, el as ArtifactComponentUpdateSchema, av as AuthorizationCodeOAuthFlow, b7 as CancelTaskRequest, bi as CancelTaskResponse, bh as CancelTaskSuccessResponse, aw as ClientCredentialsOAuthFlow, aR as ContentTypeNotSupportedError, c2 as ContextCacheApiInsert, e4 as ContextCacheApiInsertSchema, c1 as ContextCacheApiSelect, e3 as ContextCacheApiSelectSchema, c3 as ContextCacheApiUpdate, e5 as ContextCacheApiUpdateSchema, cZ as ContextCacheEntry, e1 as ContextCacheInsertSchema, e0 as ContextCacheSelectSchema, c0 as ContextCacheUpdate, e2 as ContextCacheUpdateSchema, bZ as ContextConfigApiInsert, e$ as ContextConfigApiInsertSchema, bY as ContextConfigApiSelect, e_ as ContextConfigApiSelectSchema, b_ as ContextConfigApiUpdate, f0 as ContextConfigApiUpdateSchema, eY as ContextConfigInsertSchema, eX as ContextConfigSelectSchema, eZ as ContextConfigUpdateSchema, bS as ConversationApiInsert, dU as ConversationApiInsertSchema, bR as ConversationApiSelect, dT as ConversationApiSelectSchema, bT as ConversationApiUpdate, dV as ConversationApiUpdateSchema, dR as ConversationInsertSchema, cX as ConversationScopeOptions, dQ as ConversationSelectSchema, dS as ConversationUpdateSchema, cv as CredentialReferenceApiInsert, eN as CredentialReferenceApiInsertSchema, cu as CredentialReferenceApiSelect, eM as CredentialReferenceApiSelectSchema, cw as CredentialReferenceApiUpdate, eO as CredentialReferenceApiUpdateSchema, eK as CredentialReferenceInsertSchema, eJ as CredentialReferenceSelectSchema, eL as CredentialReferenceUpdateSchema, c5 as DataComponentApiInsert, eb as DataComponentApiInsertSchema, c4 as DataComponentApiSelect, ea as DataComponentApiSelectSchema, c6 as DataComponentApiUpdate, ec as DataComponentApiUpdateSchema, e8 as DataComponentBaseSchema, e7 as DataComponentInsertSchema, e6 as DataComponentSelectSchema, e9 as DataComponentUpdateSchema, am as DataPart, fk as ErrorResponseSchema, fl as ExistsResponseSchema, cn as ExternalAgentApiInsert, ez as ExternalAgentApiInsertSchema, cm as ExternalAgentApiSelect, ey as ExternalAgentApiSelectSchema, co as ExternalAgentApiUpdate, eA as ExternalAgentApiUpdateSchema, ew as ExternalAgentInsertSchema, bz as ExternalAgentRelationApiInsert, ds as ExternalAgentRelationApiInsertSchema, dr as ExternalAgentRelationInsertSchema, ev as ExternalAgentSelectSchema, ex as ExternalAgentUpdateSchema, b$ as FetchConfig, eV as FetchConfigSchema, eW as FetchDefinitionSchema, ai as FileBase, al as FilePart, aj as FileWithBytes, ak as FileWithUri, cH as FullGraphAgentInsert, ff as FullGraphAgentInsertSchema, fg as FullGraphDefinitionSchema, b9 as GetTaskPushNotificationConfigRequest, bm as GetTaskPushNotificationConfigResponse, bl as GetTaskPushNotificationConfigSuccessResponse, b6 as GetTaskRequest, bg as GetTaskResponse, bf as GetTaskSuccessResponse, at as HTTPAuthSecurityScheme, ft as HeadersScopeSchema, fy as IdParamsSchema, ax as ImplicitOAuthFlow, cI as InternalAgentDefinition, aM as InternalError, aS as InvalidAgentResponseError, aL as InvalidParamsError, aJ as InvalidRequestError, aI as JSONParseError, b1 as JSONRPCError, b3 as JSONRPCErrorResponse, a$ as JSONRPCMessage, b0 as JSONRPCRequest, b2 as JSONRPCResult, cF as LedgerArtifactApiInsert, fb as LedgerArtifactApiInsertSchema, cE as LedgerArtifactApiSelect, fa as LedgerArtifactApiSelectSchema, cG as LedgerArtifactApiUpdate, fc as LedgerArtifactApiUpdateSchema, cC as LedgerArtifactInsert, f8 as LedgerArtifactInsertSchema, f7 as LedgerArtifactSelectSchema, cD as LedgerArtifactUpdate, f9 as LedgerArtifactUpdateSchema, fi as ListResponseSchema, d7 as MAX_ID_LENGTH, d5 as MCPServerType, eQ as MCPToolConfigSchema, d6 as MIN_ID_LENGTH, c_ as McpAuthType, c$ as McpServerAuth, d1 as McpServerCapabilities, dN as McpToolDefinitionSchema, eP as McpToolSchema, d0 as McpTransportConfig, dL as McpTransportConfigSchema, aD as Message, bW as MessageApiInsert, d_ as MessageApiInsertSchema, bV as MessageApiSelect, dZ as MessageApiSelectSchema, bX as MessageApiUpdate, d$ as MessageApiUpdateSchema, dX as MessageInsertSchema, cR as MessageMode, bp as MessagePart, cQ as MessageRole, bU as MessageSelect, dW as MessageSelectSchema, aZ as MessageSendConfiguration, a_ as MessageSendParams, cP as MessageType, dY as MessageUpdateSchema, aK as MethodNotFoundError, db as ModelSchema, cU as ModelSettings, da as ModelSettingsSchema, cS as Models, az as OAuth2SecurityScheme, au as OAuthFlows, aA as OpenIdConnectSecurityScheme, cO as Pagination, fz as PaginationQueryParamsSchema, fh as PaginationSchema, P as Part, ag as PartBase, ay as PasswordOAuthFlow, cM as ProjectApiInsert, fr as ProjectApiInsertSchema, cL as ProjectApiSelect, fq as ProjectApiSelectSchema, cN as ProjectApiUpdate, fs as ProjectApiUpdateSchema, fo as ProjectInsertSchema, dc as ProjectModelSchema, cT as ProjectModels, fn as ProjectSelectSchema, fp as ProjectUpdateSchema, aU as PushNotificationAuthenticationInfo, aV as PushNotificationConfig, aP as PushNotificationNotSupportedError, fm as RemovedResponseSchema, aB as SecurityScheme, ar as SecuritySchemeBase, b4 as SendMessageRequest, bc as SendMessageResponse, bb as SendMessageSuccessResponse, b5 as SendStreamingMessageRequest, be as SendStreamingMessageResponse, bd as SendStreamingMessageSuccessResponse, b8 as SetTaskPushNotificationConfigRequest, bk as SetTaskPushNotificationConfigResponse, bj as SetTaskPushNotificationConfigSuccessResponse, fj as SingleResponseSchema, cW as StatusComponent, fd as StatusComponentSchema, fe as StatusUpdateSchema, cV as StatusUpdateSettings, d3 as TOOL_STATUS_VALUES, aF as Task, bG as TaskApiInsert, dD as TaskApiInsertSchema, bF as TaskApiSelect, dC as TaskApiSelectSchema, bH as TaskApiUpdate, dE as TaskApiUpdateSchema, bq as TaskArtifact, aH as TaskArtifactUpdateEvent, aX as TaskIdParams, dA as TaskInsertSchema, aO as TaskNotCancelableError, aN as TaskNotFoundError, aW as TaskPushNotificationConfig, aY as TaskQueryParams, bM as TaskRelationApiInsert, dJ as TaskRelationApiInsertSchema, bL as TaskRelationApiSelect, dI as TaskRelationApiSelectSchema, bN as TaskRelationApiUpdate, dK as TaskRelationApiUpdateSchema, bJ as TaskRelationInsert, dG as TaskRelationInsertSchema, bI as TaskRelationSelect, dF as TaskRelationSelectSchema, bK as TaskRelationUpdate, dH as TaskRelationUpdateSchema, ba as TaskResubscriptionRequest, dz as TaskSelectSchema, an as TaskState, aE as TaskStatus, aG as TaskStatusUpdateEvent, bE as TaskUpdate, dB as TaskUpdateSchema, fx as TenantIdParamsSchema, fu as TenantParamsSchema, fw as TenantProjectIdParamsSchema, fv as TenantProjectParamsSchema, ah as TextPart, bP as ToolApiInsert, eT as ToolApiInsertSchema, bO as ToolApiSelect, eS as ToolApiSelectSchema, bQ as ToolApiUpdate, eU as ToolApiUpdateSchema, cK as ToolDefinition, dP as ToolInsertSchema, dO as ToolSelectSchema, dM as ToolStatusSchema, eR as ToolUpdateSchema, d8 as URL_SAFE_ID_PATTERN, aQ as UnsupportedOperationError, d4 as VALID_RELATION_TYPES, d9 as resourceIdSchema, d2 as toolStatus } from './entities-CNJaf-rG.cjs';
4
+ import { CredentialStore } from './types/index.cjs';
5
+ export { CorsConfig, ServerConfig, ServerOptions } from './types/index.cjs';
6
+ import { LibSQLDatabase } from 'drizzle-orm/libsql';
7
+ import { s as schema } from './schema-Dbc3UMpd.cjs';
8
+ export { k as agentArtifactComponents, N as agentArtifactComponentsRelations, i as agentDataComponents, f as agentGraph, E as agentGraphRelations, d as agentRelations, O as agentRelationsRelations, m as agentToolRelations, H as agentToolRelationsRelations, b as agents, D as agentsRelations, r as apiKeys, G as apiKeysRelations, j as artifactComponents, M as artifactComponentsRelations, a 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, e as externalAgents, F as externalAgentsRelations, q as ledgerArtifacts, w as ledgerArtifactsContextIdIdx, 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-Dbc3UMpd.cjs';
9
+ import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
10
+ import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
11
+ import { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
12
+ import * as hono from 'hono';
13
+ import { Context, Next } from 'hono';
14
+ import { ValidateFunction } from 'ajv';
15
+ import { z as z$1 } from '@hono/zod-openapi';
16
+ import { HTTPException } from 'hono/http-exception';
17
+ import { Span, Tracer } from '@opentelemetry/api';
18
+ export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './validation/index.cjs';
19
+ import 'zod';
20
+ import 'drizzle-zod';
21
+ import 'drizzle-orm/sqlite-core';
22
+ import 'drizzle-orm';
23
+
24
+ interface ContextConfigBuilderOptions {
25
+ id: string;
26
+ name: string;
27
+ description?: string;
28
+ requestContextSchema?: z.ZodSchema<any>;
29
+ contextVariables?: Record<string, ContextFetchDefinition>;
30
+ tenantId?: string;
31
+ projectId?: string;
32
+ }
33
+ declare class ContextConfigBuilder {
34
+ private config;
35
+ private baseURL;
36
+ private tenantId;
37
+ private projectId;
38
+ constructor(options: ContextConfigBuilderOptions);
39
+ getId(): string;
40
+ getName(): string;
41
+ getDescription(): string;
42
+ getRequestContextSchema(): {} | null;
43
+ getContextVariables(): Record<string, ContextFetchDefinition>;
44
+ /**
45
+ * Convert the builder to a plain object for database operations
46
+ */
47
+ toObject(): ContextConfigSelect;
48
+ withRequestContextSchema(schema: any): this;
49
+ withContextVariable(key: string, definition: ContextFetchDefinition): this;
50
+ withContextVariables(variables: Record<string, ContextFetchDefinition>): this;
51
+ validate(): {
52
+ valid: boolean;
53
+ errors: string[];
54
+ };
55
+ init(): Promise<void>;
56
+ private upsertContextConfig;
57
+ private parseErrorResponse;
58
+ }
59
+ declare function contextConfig(options: ContextConfigBuilderOptions): ContextConfigBuilder;
60
+ declare function fetchDefinition(options: FetchDefinition | any): ContextFetchDefinition;
61
+
62
+ /**
63
+ * Registry for managing credential stores in the application context
64
+ * Provides methods to register, retrieve, and manage credential stores
65
+ */
66
+ declare class CredentialStoreRegistry {
67
+ private stores;
68
+ private logger;
69
+ constructor(initialStores?: CredentialStore[]);
70
+ /**
71
+ * Add a credential store to the registry
72
+ */
73
+ add(store: CredentialStore): void;
74
+ /**
75
+ * Get a credential store by ID
76
+ */
77
+ get(id: string): CredentialStore | undefined;
78
+ /**
79
+ * Get all registered credential stores
80
+ */
81
+ getAll(): CredentialStore[];
82
+ /**
83
+ * Get all credential store IDs
84
+ */
85
+ getIds(): string[];
86
+ /**
87
+ * Check if a credential store is registered
88
+ */
89
+ has(id: string): boolean;
90
+ /**
91
+ * Remove a credential store
92
+ */
93
+ remove(id: string): boolean;
94
+ /**
95
+ * Get the number of registered stores
96
+ */
97
+ size(): number;
98
+ }
99
+
100
+ type DatabaseClient = LibSQLDatabase<typeof schema>;
101
+ interface DatabaseConfig {
102
+ url: string;
103
+ authToken?: string;
104
+ logger?: {
105
+ logQuery: (query: string, params: unknown[]) => void;
106
+ };
107
+ }
108
+ /**
109
+ * Creates a database client with the specified configuration
110
+ */
111
+ declare function createDatabaseClient(config: DatabaseConfig): DatabaseClient;
112
+ /**
113
+ * Creates an in-memory database client for testing
114
+ */
115
+ declare function createInMemoryDatabaseClient(): DatabaseClient;
116
+
117
+ interface TemplateContext {
118
+ [key: string]: unknown;
119
+ }
120
+ interface TemplateRenderOptions {
121
+ strict?: boolean;
122
+ preserveUnresolved?: boolean;
123
+ }
124
+ declare class TemplateEngine {
125
+ private static readonly DEFAULT_OPTIONS;
126
+ /**
127
+ * Render a template string with context data using JMESPath
128
+ */
129
+ static render(template: string, context: TemplateContext, options?: TemplateRenderOptions): string;
130
+ /**
131
+ * Process variable substitutions {{variable.path}} using JMESPath
132
+ */
133
+ private static processVariables;
134
+ /**
135
+ * Process built-in variables like $now, $env, etc.
136
+ */
137
+ private static processBuiltinVariable;
138
+ /**
139
+ * Check if template contains template variables
140
+ */
141
+ private static hasTemplateVariables;
142
+ /**
143
+ * Extract all template variables from a template
144
+ */
145
+ private static extractTemplateVariables;
146
+ /**
147
+ * Validate template syntax
148
+ */
149
+ static validateTemplate(template: string): {
150
+ valid: boolean;
151
+ errors: string[];
152
+ };
153
+ /**
154
+ * Preview template rendering with sample context
155
+ */
156
+ static preview(template: string, sampleContext: TemplateContext, options?: TemplateRenderOptions): {
157
+ rendered: string;
158
+ variables: string[];
159
+ errors: string[];
160
+ };
161
+ }
162
+
163
+ interface FetchResult {
164
+ data: unknown;
165
+ source: string;
166
+ durationMs: number;
167
+ }
168
+ declare class ContextFetcher {
169
+ private tenantId;
170
+ private projectId;
171
+ private defaultTimeout;
172
+ private credentialStuffer?;
173
+ private dbClient;
174
+ constructor(tenantId: string, projectId: string, dbClient: DatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry, defaultTimeout?: number);
175
+ /**
176
+ * Fetch data according to a fetch definition
177
+ */
178
+ fetch(definition: ContextFetchDefinition, context: TemplateContext): Promise<unknown>;
179
+ private getCredential;
180
+ /**
181
+ * Resolve template variables in fetch configuration and inject credential headers
182
+ */
183
+ private resolveTemplateVariables;
184
+ /**
185
+ * Interpolate template variables in a string using TemplateEngine
186
+ */
187
+ private interpolateTemplate;
188
+ /**
189
+ * Interpolate template variables in an object recursively using TemplateEngine
190
+ */
191
+ private interpolateObjectTemplates;
192
+ /**
193
+ * Perform HTTP request
194
+ */
195
+ private performRequest;
196
+ /**
197
+ * Transform response data using JMESPath
198
+ */
199
+ private transformResponse;
200
+ /**
201
+ * Validate response against JSON Schema
202
+ */
203
+ private validateResponseWithJsonSchema;
204
+ /**
205
+ * Test a fetch definition without caching
206
+ */
207
+ test(definition: ContextFetchDefinition, context: TemplateContext): Promise<{
208
+ success: boolean;
209
+ data?: unknown;
210
+ error?: string;
211
+ durationMs: number;
212
+ }>;
213
+ /**
214
+ * Get fetcher statistics
215
+ */
216
+ getStats(): {
217
+ tenantId: string;
218
+ defaultTimeout: number;
219
+ };
220
+ }
221
+
222
+ interface ResolvedContext {
223
+ [templateKey: string]: unknown;
224
+ }
225
+ interface ContextResolutionOptions {
226
+ triggerEvent: 'initialization' | 'invocation';
227
+ conversationId: string;
228
+ requestContext?: Record<string, unknown>;
229
+ tenantId: string;
230
+ }
231
+ interface ContextResolutionResult {
232
+ resolvedContext: ResolvedContext;
233
+ requestContext: Record<string, unknown>;
234
+ fetchedDefinitions: string[];
235
+ cacheHits: string[];
236
+ cacheMisses: string[];
237
+ errors: Array<{
238
+ definitionId: string;
239
+ error: string;
240
+ }>;
241
+ totalDurationMs: number;
242
+ }
243
+ declare class ContextResolver {
244
+ private fetcher;
245
+ private cache;
246
+ private tenantId;
247
+ private projectId;
248
+ constructor(tenantId: string, projectId: string, dbClient: DatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry);
249
+ /**
250
+ * Resolve all contexts for a given configuration and trigger event
251
+ */
252
+ resolve(contextConfig: ContextConfigSelect, options: ContextResolutionOptions): Promise<ContextResolutionResult>;
253
+ /**
254
+ * Resolve a single context variable
255
+ */
256
+ private resolveSingleFetchDefinition;
257
+ /**
258
+ * Resolve the request context for a given conversation
259
+ */
260
+ resolveRequestContext(conversationId: string, contextConfigId: string): Promise<Record<string, unknown>>;
261
+ /**
262
+ * Create a hash of the request context for cache invalidation
263
+ */
264
+ private createRequestHash;
265
+ /**
266
+ * Clear cache
267
+ */
268
+ clearCache(tenantId: string, projectId: string, conversationId: string): Promise<void>;
269
+ }
270
+
271
+ declare function determineContextTrigger(tenantId: string, projectId: string, conversationId: string, dbClient: DatabaseClient): Promise<'initialization' | 'invocation'>;
272
+ declare function handleContextConfigChange(tenantId: string, projectId: string, conversationId: string, graphId: string, newContextConfigId: string, dbClient: DatabaseClient, credentialStores?: CredentialStoreRegistry): Promise<void>;
273
+ declare function handleContextResolution(tenantId: string, projectId: string, conversationId: string, graphId: string, requestContext: Record<string, unknown>, dbClient: DatabaseClient, credentialStores?: CredentialStoreRegistry): Promise<ResolvedContext | null>;
274
+
275
+ interface CacheEntry {
276
+ contextConfigId: string;
277
+ contextVariableKey: string;
278
+ conversationId: string;
279
+ value: unknown;
280
+ requestHash?: string;
281
+ tenantId: string;
282
+ }
283
+ /**
284
+ * Context cache with request hash-based invalidation and graceful error handling.
285
+ *
286
+ * Implements conversation-scoped caching with smart cache invalidation based on
287
+ * request hash changes. All cache errors are treated as cache misses to ensure
288
+ * system reliability.
289
+ */
290
+ declare class ContextCache {
291
+ private tenantId;
292
+ private projectId;
293
+ private dbClient;
294
+ constructor(tenantId: string, projectId: string, dbClient: DatabaseClient);
295
+ /**
296
+ * Get cached context data for a conversation
297
+ */
298
+ get({ conversationId, contextConfigId, contextVariableKey, requestHash, }: {
299
+ conversationId: string;
300
+ contextConfigId: string;
301
+ contextVariableKey: string;
302
+ requestHash?: string;
303
+ }): Promise<CacheEntry | null>;
304
+ /**
305
+ * Set cached context data for a conversation
306
+ */
307
+ set(entry: CacheEntry): Promise<void>;
308
+ /**
309
+ * Clear cache entries for a specific conversation
310
+ */
311
+ clearConversation(tenantId: string, projectId: string, conversationId: string): Promise<void>;
312
+ /**
313
+ * Clear all cache entries for a specific context configuration
314
+ */
315
+ clearContextConfig(tenantId: string, projectId: string, contextConfigId: string): Promise<void>;
316
+ /**
317
+ * Clean up expired or orphaned cache entries
318
+ */
319
+ cleanup(): Promise<void>;
320
+ invalidateInvocationDefinitions(tenantId: string, projectId: string, conversationId: string, contextConfigId: string, definitionIds: string[]): Promise<void>;
321
+ invalidateRequestContext(tenantId: string, projectId: string, conversationId: string, contextConfigId: string): Promise<void>;
322
+ }
323
+
324
+ /**
325
+ * Create default credential stores based on environment variables
326
+ */
327
+ declare function createDefaultCredentialStores(): CredentialStore[];
328
+
329
+ /**
330
+ * KeyChainStore - Cross-platform system keychain credential storage
331
+ *
332
+ * Uses the native OS credential storage:
333
+ * - macOS: Keychain
334
+ * - Windows: Credential Vault
335
+ * - Linux: Secret Service API/libsecret
336
+ *
337
+ * Requires the 'keytar' npm package to be installed.
338
+ * Falls back gracefully if keytar is not available.
339
+ *
340
+ * ## macOS Permission Handling
341
+ *
342
+ * On macOS, when your Node.js app first calls keytar operations:
343
+ * - `setPassword()` creates a new Keychain item (no prompt required)
344
+ * - `getPassword()` may prompt the user for permission on first access
345
+ * - Users can click "Allow", "Always Allow", or "Deny"
346
+ * - If denied, keytar returns `null` which this implementation handles gracefully
347
+ * - The calling binary (usually `node`) will be shown in the permission prompt
348
+ * - For better UX in packaged apps, consider code signing and app bundling
349
+ *
350
+ * This implementation handles all permission scenarios gracefully:
351
+ * - Returns `null` when access is denied or credentials don't exist
352
+ * - Logs errors for debugging permission issues
353
+ * - Never throws on permission denial, only on system-level errors
354
+ */
355
+ declare class KeyChainStore implements CredentialStore {
356
+ readonly id: string;
357
+ readonly type: "keychain";
358
+ private readonly service;
359
+ private readonly logger;
360
+ private keytarAvailable;
361
+ private keytar;
362
+ private initializationPromise;
363
+ constructor(id: string, servicePrefix?: string);
364
+ /**
365
+ * Initialize keytar dynamically to handle optional availability
366
+ */
367
+ private initializeKeytar;
368
+ /**
369
+ * Get a credential from the keychain
370
+ */
371
+ get(key: string): Promise<string | null>;
372
+ /**
373
+ * Set a credential in the keychain
374
+ */
375
+ set(key: string, value: string): Promise<void>;
376
+ /**
377
+ * Check if a credential exists in the keychain
378
+ */
379
+ has(key: string): Promise<boolean>;
380
+ /**
381
+ * Delete a credential from the keychain
382
+ */
383
+ delete(key: string): Promise<boolean>;
384
+ /**
385
+ * Find all credentials for this service
386
+ * Useful for debugging and listing stored credentials
387
+ */
388
+ findAllCredentials(): Promise<Array<{
389
+ account: string;
390
+ password: string;
391
+ }>>;
392
+ /**
393
+ * Clear all credentials for this service
394
+ * WARNING: This will delete all credentials stored under this service
395
+ */
396
+ clearAll(): Promise<number>;
397
+ }
398
+ /**
399
+ * Factory function to create KeyChainStore
400
+ * Provides consistent initialization and optional configuration
401
+ *
402
+ * ## Usage Recommendations for macOS Permission Handling
403
+ *
404
+ * 1. **First-time setup**: Inform users that they may see permission prompts
405
+ * 2. **Error handling**: Check for `null` returns from `get()` operations
406
+ * 3. **User guidance**: If credentials can't be retrieved, guide users to:
407
+ * - Check Keychain Access app for denied permissions
408
+ * - Re-run the application if they accidentally clicked "Deny"
409
+ * 4. **Development**: Use a consistent `servicePrefix` to avoid permission prompt spam
410
+ * 5. **Production**: Consider code-signing your distributed app for better permission prompts
411
+ *
412
+ * Example usage with permission handling:
413
+ * ```typescript
414
+ * const store = createKeyChainStore('my-app');
415
+ *
416
+ * // Always check for null when retrieving
417
+ * const apiKey = await store.get('api-key');
418
+ * if (!apiKey) {
419
+ * console.log('API key not found or access denied');
420
+ * // Guide user to check permissions or re-enter credentials
421
+ * }
422
+ * ```
423
+ */
424
+ declare function createKeyChainStore(id: string, options?: {
425
+ servicePrefix?: string;
426
+ }): KeyChainStore;
427
+
428
+ /**
429
+ * In-memory credential store implementation
430
+ * Automatically loads environment variables prefixed with CREDENTIAL_STORE_ on initialization
431
+ * Note: Runtime credentials are lost when the server restarts, but env vars are reloaded
432
+ */
433
+ declare class InMemoryCredentialStore implements CredentialStore {
434
+ readonly id: string;
435
+ readonly type: "memory";
436
+ private credentials;
437
+ constructor(id?: string);
438
+ /**
439
+ * Get a credential from the in memory store.
440
+ * If the key is not found in the in memory store then it is loaded from environment variables.
441
+ * If the key is not found in the environment variables or in the in memory store then returns null.
442
+ * @param key - The key of the credential to get
443
+ * @returns The credential value or null if not found
444
+ */
445
+ get(key: string): Promise<string | null>;
446
+ /**
447
+ * Set a credential in the in memory store.
448
+ * @param key - The key of the credential to set
449
+ * @param value - The value of the credential to set
450
+ */
451
+ set(key: string, value: string): Promise<void>;
452
+ /**
453
+ * Check if a credential exists in the in memory store.
454
+ * @param key - The key of the credential to check
455
+ * @returns True if the credential exists, false otherwise
456
+ */
457
+ has(key: string): Promise<boolean>;
458
+ /**
459
+ * Delete a credential from the in memory store.
460
+ * @param key - The key of the credential to delete
461
+ * @returns True if the credential was deleted, false otherwise
462
+ */
463
+ delete(key: string): Promise<boolean>;
464
+ }
465
+
466
+ interface NangoConfig {
467
+ secretKey: string;
468
+ apiUrl?: string;
469
+ }
470
+ /**
471
+ * Nango-based CredentialStore that fetches OAuth credentials from Nango API
472
+ * Uses connectionId and providerConfigKey from metadata to fetch live credentials
473
+ */
474
+ declare class NangoCredentialStore implements CredentialStore {
475
+ readonly id: string;
476
+ readonly type: "nango";
477
+ private nangoConfig;
478
+ private nangoClient;
479
+ constructor(id: string, config: NangoConfig);
480
+ private getAccessToken;
481
+ private sanitizeMetadata;
482
+ /**
483
+ * Fetch credentials from Nango API using connection information
484
+ * @param connectionId - The connection ID for the Nango connection
485
+ * @param providerConfigKey - The provider config key for the Nango connection
486
+ * @returns The credential data or null if the credentials are not found
487
+ */
488
+ private fetchCredentialsFromNango;
489
+ /**
490
+ * Get credentials by key - implements CredentialStore interface
491
+ * Key format: JSON string with connectionId and providerConfigKey
492
+ */
493
+ get(key: string): Promise<string | null>;
494
+ /**
495
+ * Set credentials - not supported for Nango (OAuth flow handles this)
496
+ */
497
+ set(_key: string, _value: string): Promise<void>;
498
+ /**
499
+ * Check if credentials exist by attempting to fetch them
500
+ */
501
+ has(key: string): Promise<boolean>;
502
+ /**
503
+ * Delete credentials - not supported for Nango (revoke through Nango dashboard)
504
+ */
505
+ delete(key: string): Promise<boolean>;
506
+ }
507
+ /**
508
+ * Factory function to create NangoCredentialStore
509
+ * Automatically reads NANGO_SECRET_KEY from environment and validates it
510
+ */
511
+ declare function createNangoCredentialStore(id: string, config?: Partial<NangoConfig>): NangoCredentialStore;
512
+
513
+ /**
514
+ * Logger interface for core package components
515
+ * Allows services to inject their own logger implementation
516
+ */
517
+ interface Logger$1 {
518
+ error(data: any, message: string): void;
519
+ warn(data: any, message: string): void;
520
+ info(data: any, message: string): void;
521
+ debug(data: any, message: string): void;
522
+ }
523
+ /**
524
+ * Default console logger implementation
525
+ */
526
+ declare class ConsoleLogger implements Logger$1 {
527
+ private name;
528
+ constructor(name: string);
529
+ error(data: any, message: string): void;
530
+ warn(data: any, message: string): void;
531
+ info(data: any, message: string): void;
532
+ debug(data: any, message: string): void;
533
+ }
534
+ /**
535
+ * No-op logger that silently ignores all log calls
536
+ */
537
+ declare class NoOpLogger implements Logger$1 {
538
+ error(_data: any, _message: string): void;
539
+ warn(_data: any, _message: string): void;
540
+ info(_data: any, _message: string): void;
541
+ debug(_data: any, _message: string): void;
542
+ }
543
+ /**
544
+ * Logger factory configuration
545
+ */
546
+ interface LoggerFactoryConfig {
547
+ defaultLogger?: Logger$1;
548
+ loggerFactory?: (name: string) => Logger$1;
549
+ }
550
+ /**
551
+ * Global logger factory singleton
552
+ */
553
+ declare class LoggerFactory {
554
+ private config;
555
+ private loggers;
556
+ /**
557
+ * Configure the logger factory
558
+ */
559
+ configure(config: LoggerFactoryConfig): void;
560
+ /**
561
+ * Get or create a logger instance
562
+ */
563
+ getLogger(name: string): Logger$1;
564
+ /**
565
+ * Reset factory to default state
566
+ */
567
+ reset(): void;
568
+ }
569
+ declare const loggerFactory: LoggerFactory;
570
+ /**
571
+ * Convenience function to get a logger
572
+ */
573
+ declare function getLogger(name: string): Logger$1;
574
+ /**
575
+ * Configure the global logger factory
576
+ * This should be called once at application startup
577
+ *
578
+ * Example usage:
579
+ * ```typescript
580
+ * // In your service initialization
581
+ * import { configureLogging } from '@inkeep/agents-core';
582
+ * import { getLogger as getPinoLogger } from './logger.j';
583
+ *
584
+ * configureLogging({
585
+ * loggerFactory: (name) => getPinoLogger(name)
586
+ * });
587
+ * ```
588
+ */
589
+ declare function configureLogging(config: LoggerFactoryConfig): void;
590
+
591
+ interface SharedServerConfig {
592
+ timeout?: number;
593
+ activeTools?: string[];
594
+ selectedTools?: string[];
595
+ }
596
+ interface McpStreamableHttpConfig extends SharedServerConfig {
597
+ type: typeof MCPTransportType.streamableHttp;
598
+ url: string | URL;
599
+ headers?: Record<string, string>;
600
+ requestInit?: StreamableHTTPClientTransportOptions['requestInit'];
601
+ eventSourceInit?: SSEClientTransportOptions['eventSourceInit'];
602
+ reconnectionOptions?: StreamableHTTPClientTransportOptions['reconnectionOptions'];
603
+ sessionId?: StreamableHTTPClientTransportOptions['sessionId'];
604
+ }
605
+ interface McpSSEConfig extends SharedServerConfig {
606
+ type: typeof MCPTransportType.sse;
607
+ url: string | URL;
608
+ headers?: Record<string, string>;
609
+ eventSourceInit?: SSEClientTransportOptions['eventSourceInit'];
610
+ }
611
+ type McpServerConfig = McpStreamableHttpConfig | McpSSEConfig;
612
+ interface McpClientOptions {
613
+ name: string;
614
+ version?: string;
615
+ server: McpServerConfig;
616
+ capabilities?: ClientCapabilities;
617
+ timeout?: number;
618
+ }
619
+ declare class McpClient {
620
+ name: string;
621
+ private client;
622
+ private readonly timeout;
623
+ private transport?;
624
+ private serverConfig;
625
+ private connected;
626
+ constructor(opts: McpClientOptions);
627
+ connect(): Promise<void>;
628
+ private connectSSE;
629
+ private connectHttp;
630
+ disconnect(): Promise<void>;
631
+ private validateSelectedTools;
632
+ private selectTools;
633
+ tools(): Promise<Record<string, any>>;
634
+ }
635
+
636
+ /**
637
+ * Context object for credential operations
638
+ */
639
+ interface CredentialContext {
640
+ /** Tenant identifier */
641
+ tenantId: string;
642
+ /** Project identifier */
643
+ projectId: string;
644
+ /** Conversation identifier */
645
+ conversationId?: string;
646
+ /** Context configuration identifier */
647
+ contextConfigId?: string;
648
+ /** Additional context data */
649
+ metadata?: Record<string, unknown>;
650
+ }
651
+ /**
652
+ * Base credential data structure containing headers and metadata
653
+ */
654
+ interface CredentialData {
655
+ /** HTTP headers for authentication */
656
+ headers: Record<string, string>;
657
+ /** Additional metadata for the credentials */
658
+ metadata?: Record<string, any>;
659
+ }
660
+ /**
661
+ * Credential store reference for lookups
662
+ */
663
+ interface CredentialStoreReference {
664
+ /** Framework credential store ID */
665
+ credentialStoreId: string;
666
+ /** Configuration parameters for credential retrieval */
667
+ retrievalParams: Record<string, unknown>;
668
+ }
669
+ interface CredentialResolverInput {
670
+ context: CredentialContext;
671
+ mcpType?: MCPToolConfig['mcpType'];
672
+ storeReference?: CredentialStoreReference;
673
+ headers?: Record<string, string>;
674
+ }
675
+ /**
676
+ * Interface for context resolver (optional)
677
+ */
678
+ interface ContextResolverInterface {
679
+ resolveRequestContext(conversationId: string, contextConfigId: string): Promise<Record<string, unknown>>;
680
+ }
681
+ /**
682
+ * Manages credential retrieval and injection for MCP tools
683
+ * Uses CredentialStoreRegistry for credential store management
684
+ */
685
+ declare class CredentialStuffer {
686
+ private credentialStoreRegistry;
687
+ private contextResolver?;
688
+ private readonly logger;
689
+ constructor(credentialStoreRegistry: CredentialStoreRegistry, contextResolver?: ContextResolverInterface | undefined, logger?: Logger$1);
690
+ /**
691
+ * Retrieve credentials from credential store registry
692
+ */
693
+ getCredentials(context: CredentialContext, storeReference: CredentialStoreReference, mcpType?: MCPToolConfig['mcpType']): Promise<CredentialData | null>;
694
+ /**
695
+ * Generate credential lookup key based on store type
696
+ */
697
+ private generateCredentialKey;
698
+ /**
699
+ * Get credentials from request context
700
+ */
701
+ getCredentialsFromRequestContext(credentialContext: CredentialContext, headers: Record<string, string>): Promise<CredentialData | null>;
702
+ /**
703
+ * Get credential headers for MCP server configuration
704
+ */
705
+ getCredentialHeaders({ context, mcpType, storeReference, headers, }: CredentialResolverInput): Promise<Record<string, string>>;
706
+ /**
707
+ * Build MCP server configuration with credentials
708
+ */
709
+ buildMcpServerConfig(context: CredentialContext, tool: MCPToolConfig, storeReference?: CredentialStoreReference, selectedTools?: string[]): Promise<McpServerConfig>;
710
+ }
711
+
712
+ declare const getAgentGraph: (db: DatabaseClient) => (params: {
713
+ scopes: ScopeConfig;
714
+ graphId: string;
715
+ }) => Promise<{
716
+ tenantId: string;
717
+ projectId: string;
718
+ id: string;
719
+ name: string;
720
+ description: string | null;
721
+ createdAt: string;
722
+ updatedAt: string;
723
+ defaultAgentId: string;
724
+ models: {
725
+ base?: {
726
+ model?: string | undefined;
727
+ providerOptions?: Record<string, unknown> | undefined;
728
+ } | undefined;
729
+ structuredOutput?: {
730
+ model?: string | undefined;
731
+ providerOptions?: Record<string, unknown> | undefined;
732
+ } | undefined;
733
+ summarizer?: {
734
+ model?: string | undefined;
735
+ providerOptions?: Record<string, unknown> | undefined;
736
+ } | undefined;
737
+ } | null;
738
+ stopWhen: {
739
+ transferCountIs?: number;
740
+ } | null;
741
+ graphPrompt: string | null;
742
+ statusUpdates: {
743
+ enabled?: boolean | undefined;
744
+ numEvents?: number | undefined;
745
+ timeInSeconds?: number | undefined;
746
+ prompt?: string | undefined;
747
+ statusComponents?: {
748
+ type: string;
749
+ description?: string | undefined;
750
+ detailsSchema?: {
751
+ type: "object";
752
+ properties: Record<string, any>;
753
+ required?: string[] | undefined;
754
+ } | undefined;
755
+ }[] | undefined;
756
+ } | null;
757
+ contextConfigId: string | null;
758
+ } | undefined>;
759
+ declare const getAgentGraphById: (db: DatabaseClient) => (params: {
760
+ scopes: ScopeConfig;
761
+ graphId: string;
762
+ }) => Promise<{
763
+ tenantId: string;
764
+ projectId: string;
765
+ id: string;
766
+ name: string;
767
+ description: string | null;
768
+ createdAt: string;
769
+ updatedAt: string;
770
+ defaultAgentId: string;
771
+ models: {
772
+ base?: {
773
+ model?: string | undefined;
774
+ providerOptions?: Record<string, unknown> | undefined;
775
+ } | undefined;
776
+ structuredOutput?: {
777
+ model?: string | undefined;
778
+ providerOptions?: Record<string, unknown> | undefined;
779
+ } | undefined;
780
+ summarizer?: {
781
+ model?: string | undefined;
782
+ providerOptions?: Record<string, unknown> | undefined;
783
+ } | undefined;
784
+ } | null;
785
+ stopWhen: {
786
+ transferCountIs?: number;
787
+ } | null;
788
+ graphPrompt: string | null;
789
+ statusUpdates: {
790
+ enabled?: boolean | undefined;
791
+ numEvents?: number | undefined;
792
+ timeInSeconds?: number | undefined;
793
+ prompt?: string | undefined;
794
+ statusComponents?: {
795
+ type: string;
796
+ description?: string | undefined;
797
+ detailsSchema?: {
798
+ type: "object";
799
+ properties: Record<string, any>;
800
+ required?: string[] | undefined;
801
+ } | undefined;
802
+ }[] | undefined;
803
+ } | null;
804
+ contextConfigId: string | null;
805
+ } | null>;
806
+ declare const getAgentGraphWithDefaultAgent: (db: DatabaseClient) => (params: {
807
+ scopes: ScopeConfig;
808
+ graphId: string;
809
+ }) => Promise<{
810
+ tenantId: string;
811
+ projectId: string;
812
+ id: string;
813
+ name: string;
814
+ description: string | null;
815
+ createdAt: string;
816
+ updatedAt: string;
817
+ defaultAgentId: string;
818
+ models: {
819
+ base?: {
820
+ model?: string | undefined;
821
+ providerOptions?: Record<string, unknown> | undefined;
822
+ } | undefined;
823
+ structuredOutput?: {
824
+ model?: string | undefined;
825
+ providerOptions?: Record<string, unknown> | undefined;
826
+ } | undefined;
827
+ summarizer?: {
828
+ model?: string | undefined;
829
+ providerOptions?: Record<string, unknown> | undefined;
830
+ } | undefined;
831
+ } | null;
832
+ stopWhen: {
833
+ transferCountIs?: number;
834
+ } | null;
835
+ graphPrompt: string | null;
836
+ statusUpdates: {
837
+ enabled?: boolean | undefined;
838
+ numEvents?: number | undefined;
839
+ timeInSeconds?: number | undefined;
840
+ prompt?: string | undefined;
841
+ statusComponents?: {
842
+ type: string;
843
+ description?: string | undefined;
844
+ detailsSchema?: {
845
+ type: "object";
846
+ properties: Record<string, any>;
847
+ required?: string[] | undefined;
848
+ } | undefined;
849
+ }[] | undefined;
850
+ } | null;
851
+ contextConfigId: string | null;
852
+ defaultAgent: {
853
+ tenantId: string;
854
+ projectId: string;
855
+ id: string;
856
+ name: string;
857
+ description: string;
858
+ prompt: string;
859
+ createdAt: string;
860
+ updatedAt: string;
861
+ models: {
862
+ base?: {
863
+ model?: string | undefined;
864
+ providerOptions?: Record<string, unknown> | undefined;
865
+ } | undefined;
866
+ structuredOutput?: {
867
+ model?: string | undefined;
868
+ providerOptions?: Record<string, unknown> | undefined;
869
+ } | undefined;
870
+ summarizer?: {
871
+ model?: string | undefined;
872
+ providerOptions?: Record<string, unknown> | undefined;
873
+ } | undefined;
874
+ } | null;
875
+ stopWhen: {
876
+ stepCountIs?: number;
877
+ } | null;
878
+ conversationHistoryConfig: ConversationHistoryConfig | null;
879
+ };
880
+ } | null>;
881
+ declare const listAgentGraphs: (db: DatabaseClient) => (params: {
882
+ scopes: ScopeConfig;
883
+ }) => Promise<{
884
+ tenantId: string;
885
+ projectId: string;
886
+ id: string;
887
+ name: string;
888
+ description: string | null;
889
+ createdAt: string;
890
+ updatedAt: string;
891
+ defaultAgentId: string;
892
+ models: {
893
+ base?: {
894
+ model?: string | undefined;
895
+ providerOptions?: Record<string, unknown> | undefined;
896
+ } | undefined;
897
+ structuredOutput?: {
898
+ model?: string | undefined;
899
+ providerOptions?: Record<string, unknown> | undefined;
900
+ } | undefined;
901
+ summarizer?: {
902
+ model?: string | undefined;
903
+ providerOptions?: Record<string, unknown> | undefined;
904
+ } | undefined;
905
+ } | null;
906
+ stopWhen: {
907
+ transferCountIs?: number;
908
+ } | null;
909
+ graphPrompt: string | null;
910
+ statusUpdates: {
911
+ enabled?: boolean | undefined;
912
+ numEvents?: number | undefined;
913
+ timeInSeconds?: number | undefined;
914
+ prompt?: string | undefined;
915
+ statusComponents?: {
916
+ type: string;
917
+ description?: string | undefined;
918
+ detailsSchema?: {
919
+ type: "object";
920
+ properties: Record<string, any>;
921
+ required?: string[] | undefined;
922
+ } | undefined;
923
+ }[] | undefined;
924
+ } | null;
925
+ contextConfigId: string | null;
926
+ }[]>;
927
+ declare const listAgentGraphsPaginated: (db: DatabaseClient) => (params: {
928
+ scopes: ScopeConfig;
929
+ pagination?: PaginationConfig;
930
+ }) => Promise<{
931
+ data: {
932
+ tenantId: string;
933
+ projectId: string;
934
+ id: string;
935
+ name: string;
936
+ description: string | null;
937
+ defaultAgentId: string;
938
+ contextConfigId: string | null;
939
+ models: {
940
+ base?: {
941
+ model?: string | undefined;
942
+ providerOptions?: Record<string, unknown> | undefined;
943
+ } | undefined;
944
+ structuredOutput?: {
945
+ model?: string | undefined;
946
+ providerOptions?: Record<string, unknown> | undefined;
947
+ } | undefined;
948
+ summarizer?: {
949
+ model?: string | undefined;
950
+ providerOptions?: Record<string, unknown> | undefined;
951
+ } | undefined;
952
+ } | null;
953
+ statusUpdates: {
954
+ enabled?: boolean | undefined;
955
+ numEvents?: number | undefined;
956
+ timeInSeconds?: number | undefined;
957
+ prompt?: string | undefined;
958
+ statusComponents?: {
959
+ type: string;
960
+ description?: string | undefined;
961
+ detailsSchema?: {
962
+ type: "object";
963
+ properties: Record<string, any>;
964
+ required?: string[] | undefined;
965
+ } | undefined;
966
+ }[] | undefined;
967
+ } | null;
968
+ graphPrompt: string | null;
969
+ stopWhen: {
970
+ transferCountIs?: number;
971
+ } | null;
972
+ createdAt: string;
973
+ updatedAt: string;
974
+ }[];
975
+ pagination: {
976
+ page: number;
977
+ limit: number;
978
+ total: number;
979
+ pages: number;
980
+ };
981
+ }>;
982
+ declare const createAgentGraph: (db: DatabaseClient) => (data: AgentGraphInsert) => Promise<{
983
+ tenantId: string;
984
+ projectId: string;
985
+ id: string;
986
+ name: string;
987
+ description: string | null;
988
+ createdAt: string;
989
+ updatedAt: string;
990
+ defaultAgentId: string;
991
+ models: {
992
+ base?: {
993
+ model?: string | undefined;
994
+ providerOptions?: Record<string, unknown> | undefined;
995
+ } | undefined;
996
+ structuredOutput?: {
997
+ model?: string | undefined;
998
+ providerOptions?: Record<string, unknown> | undefined;
999
+ } | undefined;
1000
+ summarizer?: {
1001
+ model?: string | undefined;
1002
+ providerOptions?: Record<string, unknown> | undefined;
1003
+ } | undefined;
1004
+ } | null;
1005
+ stopWhen: {
1006
+ transferCountIs?: number;
1007
+ } | null;
1008
+ graphPrompt: string | null;
1009
+ statusUpdates: {
1010
+ enabled?: boolean | undefined;
1011
+ numEvents?: number | undefined;
1012
+ timeInSeconds?: number | undefined;
1013
+ prompt?: string | undefined;
1014
+ statusComponents?: {
1015
+ type: string;
1016
+ description?: string | undefined;
1017
+ detailsSchema?: {
1018
+ type: "object";
1019
+ properties: Record<string, any>;
1020
+ required?: string[] | undefined;
1021
+ } | undefined;
1022
+ }[] | undefined;
1023
+ } | null;
1024
+ contextConfigId: string | null;
1025
+ }>;
1026
+ declare const updateAgentGraph: (db: DatabaseClient) => (params: {
1027
+ scopes: ScopeConfig;
1028
+ graphId: string;
1029
+ data: AgentGraphUpdate;
1030
+ }) => Promise<{
1031
+ tenantId: string;
1032
+ projectId: string;
1033
+ id: string;
1034
+ name: string;
1035
+ description: string | null;
1036
+ createdAt: string;
1037
+ updatedAt: string;
1038
+ defaultAgentId: string;
1039
+ models: {
1040
+ base?: {
1041
+ model?: string | undefined;
1042
+ providerOptions?: Record<string, unknown> | undefined;
1043
+ } | undefined;
1044
+ structuredOutput?: {
1045
+ model?: string | undefined;
1046
+ providerOptions?: Record<string, unknown> | undefined;
1047
+ } | undefined;
1048
+ summarizer?: {
1049
+ model?: string | undefined;
1050
+ providerOptions?: Record<string, unknown> | undefined;
1051
+ } | undefined;
1052
+ } | null;
1053
+ stopWhen: {
1054
+ transferCountIs?: number;
1055
+ } | null;
1056
+ graphPrompt: string | null;
1057
+ statusUpdates: {
1058
+ enabled?: boolean | undefined;
1059
+ numEvents?: number | undefined;
1060
+ timeInSeconds?: number | undefined;
1061
+ prompt?: string | undefined;
1062
+ statusComponents?: {
1063
+ type: string;
1064
+ description?: string | undefined;
1065
+ detailsSchema?: {
1066
+ type: "object";
1067
+ properties: Record<string, any>;
1068
+ required?: string[] | undefined;
1069
+ } | undefined;
1070
+ }[] | undefined;
1071
+ } | null;
1072
+ contextConfigId: string | null;
1073
+ }>;
1074
+ declare const deleteAgentGraph: (db: DatabaseClient) => (params: {
1075
+ scopes: ScopeConfig;
1076
+ graphId: string;
1077
+ }) => Promise<boolean>;
1078
+ /**
1079
+ * Helper function to fetch component relationships using efficient joins
1080
+ */
1081
+ declare const fetchComponentRelationships: (db: DatabaseClient) => <T extends Record<string, any>>(scopes: ScopeConfig, agentIds: string[], config: {
1082
+ relationTable: any;
1083
+ componentTable: any;
1084
+ relationIdField: any;
1085
+ componentIdField: any;
1086
+ selectFields: Record<string, any>;
1087
+ }) => Promise<Record<string, T>>;
1088
+ declare const getGraphAgentInfos: (db: DatabaseClient) => ({ scopes, graphId, agentId, }: {
1089
+ scopes: ScopeConfig;
1090
+ graphId: string;
1091
+ agentId: string;
1092
+ }) => Promise<{
1093
+ id: string;
1094
+ name: string;
1095
+ description: string;
1096
+ }[]>;
1097
+ declare const getFullGraphDefinition: (db: DatabaseClient) => ({ scopes: { tenantId, projectId }, graphId, }: {
1098
+ scopes: ScopeConfig;
1099
+ graphId: string;
1100
+ }) => Promise<FullGraphDefinition | null>;
1101
+ /**
1102
+ * Upsert an agent graph (create if it doesn't exist, update if it does)
1103
+ */
1104
+ declare const upsertAgentGraph: (db: DatabaseClient) => (params: {
1105
+ data: AgentGraphInsert;
1106
+ }) => Promise<any>;
1107
+
1108
+ declare const getAgentRelationById: (db: DatabaseClient) => (params: {
1109
+ scopes: ScopeConfig;
1110
+ relationId: string;
1111
+ }) => Promise<{
1112
+ tenantId: string;
1113
+ projectId: string;
1114
+ id: string;
1115
+ graphId: string;
1116
+ createdAt: string;
1117
+ updatedAt: string;
1118
+ sourceAgentId: string;
1119
+ targetAgentId: string | null;
1120
+ externalAgentId: string | null;
1121
+ relationType: string | null;
1122
+ } | undefined>;
1123
+ declare const listAgentRelations: (db: DatabaseClient) => (params: {
1124
+ scopes: ScopeConfig;
1125
+ pagination?: PaginationConfig;
1126
+ }) => Promise<{
1127
+ data: {
1128
+ tenantId: string;
1129
+ projectId: string;
1130
+ id: string;
1131
+ graphId: string;
1132
+ sourceAgentId: string;
1133
+ targetAgentId: string | null;
1134
+ externalAgentId: string | null;
1135
+ relationType: string | null;
1136
+ createdAt: string;
1137
+ updatedAt: string;
1138
+ }[];
1139
+ pagination: {
1140
+ page: number;
1141
+ limit: number;
1142
+ total: number;
1143
+ pages: number;
1144
+ };
1145
+ }>;
1146
+ declare const getAgentRelations: (db: DatabaseClient) => (params: {
1147
+ scopes: ScopeConfig;
1148
+ graphId: string;
1149
+ agentId: string;
1150
+ }) => Promise<{
1151
+ tenantId: string;
1152
+ projectId: string;
1153
+ id: string;
1154
+ graphId: string;
1155
+ createdAt: string;
1156
+ updatedAt: string;
1157
+ sourceAgentId: string;
1158
+ targetAgentId: string | null;
1159
+ externalAgentId: string | null;
1160
+ relationType: string | null;
1161
+ }[]>;
1162
+ declare const getAgentRelationsByGraph: (db: DatabaseClient) => (params: {
1163
+ scopes: ScopeConfig;
1164
+ graphId: string;
1165
+ }) => Promise<{
1166
+ tenantId: string;
1167
+ projectId: string;
1168
+ id: string;
1169
+ graphId: string;
1170
+ createdAt: string;
1171
+ updatedAt: string;
1172
+ sourceAgentId: string;
1173
+ targetAgentId: string | null;
1174
+ externalAgentId: string | null;
1175
+ relationType: string | null;
1176
+ }[]>;
1177
+ declare const getAgentRelationsBySource: (db: DatabaseClient) => (params: {
1178
+ scopes: ScopeConfig;
1179
+ sourceAgentId: string;
1180
+ pagination?: PaginationConfig;
1181
+ }) => Promise<{
1182
+ data: {
1183
+ tenantId: string;
1184
+ projectId: string;
1185
+ id: string;
1186
+ graphId: string;
1187
+ sourceAgentId: string;
1188
+ targetAgentId: string | null;
1189
+ externalAgentId: string | null;
1190
+ relationType: string | null;
1191
+ createdAt: string;
1192
+ updatedAt: string;
1193
+ }[];
1194
+ pagination: {
1195
+ page: number;
1196
+ limit: number;
1197
+ total: number;
1198
+ pages: number;
1199
+ };
1200
+ }>;
1201
+ declare const getAgentRelationsByTarget: (db: DatabaseClient) => (params: {
1202
+ scopes: ScopeConfig;
1203
+ targetAgentId: string;
1204
+ pagination?: PaginationConfig;
1205
+ }) => Promise<{
1206
+ data: {
1207
+ tenantId: string;
1208
+ projectId: string;
1209
+ id: string;
1210
+ graphId: string;
1211
+ sourceAgentId: string;
1212
+ targetAgentId: string | null;
1213
+ externalAgentId: string | null;
1214
+ relationType: string | null;
1215
+ createdAt: string;
1216
+ updatedAt: string;
1217
+ }[];
1218
+ pagination: {
1219
+ page: number;
1220
+ limit: number;
1221
+ total: number;
1222
+ pages: number;
1223
+ };
1224
+ }>;
1225
+ declare const getExternalAgentRelations: (db: DatabaseClient) => (params: {
1226
+ scopes: ScopeConfig;
1227
+ externalAgentId: string;
1228
+ pagination?: PaginationConfig;
1229
+ }) => Promise<{
1230
+ data: {
1231
+ tenantId: string;
1232
+ projectId: string;
1233
+ id: string;
1234
+ graphId: string;
1235
+ sourceAgentId: string;
1236
+ targetAgentId: string | null;
1237
+ externalAgentId: string | null;
1238
+ relationType: string | null;
1239
+ createdAt: string;
1240
+ updatedAt: string;
1241
+ }[];
1242
+ pagination: {
1243
+ page: number;
1244
+ limit: number;
1245
+ total: number;
1246
+ pages: number;
1247
+ };
1248
+ }>;
1249
+ declare const getRelatedAgentsForGraph: (db: DatabaseClient) => (params: {
1250
+ scopes: ScopeConfig;
1251
+ graphId: string;
1252
+ agentId: string;
1253
+ }) => Promise<{
1254
+ internalRelations: {
1255
+ id: string;
1256
+ name: string;
1257
+ description: string;
1258
+ relationType: string | null;
1259
+ }[];
1260
+ externalRelations: {
1261
+ id: string;
1262
+ relationType: string | null;
1263
+ externalAgent: {
1264
+ id: string;
1265
+ name: string;
1266
+ description: string;
1267
+ baseUrl: string;
1268
+ };
1269
+ }[];
1270
+ }>;
1271
+ declare const createAgentRelation: (db: DatabaseClient) => (params: AgentRelationInsert) => Promise<{
1272
+ tenantId: string;
1273
+ projectId: string;
1274
+ id: string;
1275
+ graphId: string;
1276
+ createdAt: string;
1277
+ updatedAt: string;
1278
+ sourceAgentId: string;
1279
+ targetAgentId: string | null;
1280
+ externalAgentId: string | null;
1281
+ relationType: string | null;
1282
+ }>;
1283
+ /**
1284
+ * Check if agent relation exists by graph, source, target, and relation type
1285
+ */
1286
+ declare const getAgentRelationByParams: (db: DatabaseClient) => (params: {
1287
+ scopes: ScopeConfig;
1288
+ graphId: string;
1289
+ sourceAgentId: string;
1290
+ targetAgentId?: string;
1291
+ externalAgentId?: string;
1292
+ relationType: string;
1293
+ }) => Promise<{
1294
+ tenantId: string;
1295
+ projectId: string;
1296
+ id: string;
1297
+ graphId: string;
1298
+ createdAt: string;
1299
+ updatedAt: string;
1300
+ sourceAgentId: string;
1301
+ targetAgentId: string | null;
1302
+ externalAgentId: string | null;
1303
+ relationType: string | null;
1304
+ } | undefined>;
1305
+ /**
1306
+ * Upsert agent relation (create if it doesn't exist, no-op if it does)
1307
+ */
1308
+ declare const upsertAgentRelation: (db: DatabaseClient) => (params: AgentRelationInsert) => Promise<{
1309
+ tenantId: string;
1310
+ projectId: string;
1311
+ id: string;
1312
+ graphId: string;
1313
+ createdAt: string;
1314
+ updatedAt: string;
1315
+ sourceAgentId: string;
1316
+ targetAgentId: string | null;
1317
+ externalAgentId: string | null;
1318
+ relationType: string | null;
1319
+ }>;
1320
+ declare const createExternalAgentRelation: (db: DatabaseClient) => (params: ExternalAgentRelationInsert) => Promise<{
1321
+ tenantId: string;
1322
+ projectId: string;
1323
+ id: string;
1324
+ graphId: string;
1325
+ createdAt: string;
1326
+ updatedAt: string;
1327
+ sourceAgentId: string;
1328
+ targetAgentId: string | null;
1329
+ externalAgentId: string | null;
1330
+ relationType: string | null;
1331
+ }>;
1332
+ declare const updateAgentRelation: (db: DatabaseClient) => (params: {
1333
+ scopes: ScopeConfig;
1334
+ relationId: string;
1335
+ data: AgentRelationUpdate;
1336
+ }) => Promise<{
1337
+ tenantId: string;
1338
+ projectId: string;
1339
+ id: string;
1340
+ graphId: string;
1341
+ createdAt: string;
1342
+ updatedAt: string;
1343
+ sourceAgentId: string;
1344
+ targetAgentId: string | null;
1345
+ externalAgentId: string | null;
1346
+ relationType: string | null;
1347
+ }>;
1348
+ declare const deleteAgentRelation: (db: DatabaseClient) => (params: {
1349
+ scopes: ScopeConfig;
1350
+ relationId: string;
1351
+ }) => Promise<boolean>;
1352
+ declare const deleteAgentRelationsByGraph: (db: DatabaseClient) => (params: {
1353
+ scopes: ScopeConfig;
1354
+ graphId: string;
1355
+ }) => Promise<boolean>;
1356
+ declare const createAgentToolRelation: (db: DatabaseClient) => (params: {
1357
+ scopes: ScopeConfig;
1358
+ relationId?: string;
1359
+ data: {
1360
+ agentId: string;
1361
+ toolId: string;
1362
+ selectedTools?: string[] | null;
1363
+ };
1364
+ }) => Promise<{
1365
+ tenantId: string;
1366
+ projectId: string;
1367
+ id: string;
1368
+ createdAt: string;
1369
+ updatedAt: string;
1370
+ selectedTools: string[] | null;
1371
+ agentId: string;
1372
+ toolId: string;
1373
+ }>;
1374
+ declare const updateAgentToolRelation: (db: DatabaseClient) => (params: {
1375
+ scopes: ScopeConfig;
1376
+ relationId: string;
1377
+ data: AgentToolRelationUpdate;
1378
+ }) => Promise<{
1379
+ tenantId: string;
1380
+ projectId: string;
1381
+ id: string;
1382
+ createdAt: string;
1383
+ updatedAt: string;
1384
+ selectedTools: string[] | null;
1385
+ agentId: string;
1386
+ toolId: string;
1387
+ }>;
1388
+ declare const deleteAgentToolRelation: (db: DatabaseClient) => (params: {
1389
+ scopes: ScopeConfig;
1390
+ relationId: string;
1391
+ }) => Promise<boolean>;
1392
+ declare const deleteAgentToolRelationByAgent: (db: DatabaseClient) => (params: {
1393
+ scopes: ScopeConfig;
1394
+ agentId: string;
1395
+ }) => Promise<boolean>;
1396
+ declare const getAgentToolRelationById: (db: DatabaseClient) => (params: {
1397
+ scopes: ScopeConfig;
1398
+ relationId: string;
1399
+ }) => Promise<{
1400
+ tenantId: string;
1401
+ projectId: string;
1402
+ id: string;
1403
+ createdAt: string;
1404
+ updatedAt: string;
1405
+ selectedTools: string[] | null;
1406
+ agentId: string;
1407
+ toolId: string;
1408
+ } | undefined>;
1409
+ declare const getAgentToolRelationByAgent: (db: DatabaseClient) => (params: {
1410
+ scopes: ScopeConfig;
1411
+ agentId: string;
1412
+ pagination?: PaginationConfig;
1413
+ }) => Promise<{
1414
+ data: {
1415
+ tenantId: string;
1416
+ projectId: string;
1417
+ id: string;
1418
+ agentId: string;
1419
+ toolId: string;
1420
+ selectedTools: string[] | null;
1421
+ createdAt: string;
1422
+ updatedAt: string;
1423
+ }[];
1424
+ pagination: {
1425
+ page: number;
1426
+ limit: number;
1427
+ total: number;
1428
+ pages: number;
1429
+ };
1430
+ }>;
1431
+ declare const getAgentToolRelationByTool: (db: DatabaseClient) => (params: {
1432
+ scopes: ScopeConfig;
1433
+ toolId: string;
1434
+ pagination?: PaginationConfig;
1435
+ }) => Promise<{
1436
+ data: {
1437
+ tenantId: string;
1438
+ projectId: string;
1439
+ id: string;
1440
+ agentId: string;
1441
+ toolId: string;
1442
+ selectedTools: string[] | null;
1443
+ createdAt: string;
1444
+ updatedAt: string;
1445
+ }[];
1446
+ pagination: {
1447
+ page: number;
1448
+ limit: number;
1449
+ total: number;
1450
+ pages: number;
1451
+ };
1452
+ }>;
1453
+ declare const listAgentToolRelations: (db: DatabaseClient) => (params: {
1454
+ scopes: ScopeConfig;
1455
+ pagination?: PaginationConfig;
1456
+ }) => Promise<{
1457
+ data: {
1458
+ tenantId: string;
1459
+ projectId: string;
1460
+ id: string;
1461
+ agentId: string;
1462
+ toolId: string;
1463
+ selectedTools: string[] | null;
1464
+ createdAt: string;
1465
+ updatedAt: string;
1466
+ }[];
1467
+ pagination: {
1468
+ page: number;
1469
+ limit: number;
1470
+ total: number;
1471
+ pages: number;
1472
+ };
1473
+ }>;
1474
+ declare const listAgentToolRelationsByAgent: (db: DatabaseClient) => (params: {
1475
+ scopes: ScopeConfig;
1476
+ agentId: string;
1477
+ pagination?: PaginationConfig;
1478
+ }) => Promise<{
1479
+ data: {
1480
+ tenantId: string;
1481
+ projectId: string;
1482
+ id: string;
1483
+ agentId: string;
1484
+ toolId: string;
1485
+ selectedTools: string[] | null;
1486
+ createdAt: string;
1487
+ updatedAt: string;
1488
+ }[];
1489
+ pagination: {
1490
+ page: number;
1491
+ limit: number;
1492
+ total: number;
1493
+ pages: number;
1494
+ };
1495
+ }>;
1496
+ declare const getToolsForAgent: (db: DatabaseClient) => (params: {
1497
+ scopes: ScopeConfig;
1498
+ agentId: string;
1499
+ pagination?: PaginationConfig;
1500
+ }) => Promise<{
1501
+ data: {
1502
+ id: string;
1503
+ tenantId: string;
1504
+ agentId: string;
1505
+ toolId: string;
1506
+ selectedTools: string[] | null;
1507
+ createdAt: string;
1508
+ updatedAt: string;
1509
+ tool: {
1510
+ id: string;
1511
+ name: string;
1512
+ config: {
1513
+ type: "mcp";
1514
+ mcp: ToolMcpConfig;
1515
+ };
1516
+ createdAt: string;
1517
+ updatedAt: string;
1518
+ capabilities: ToolServerCapabilities | null;
1519
+ lastHealthCheck: string | null;
1520
+ lastToolsSync: string | null;
1521
+ lastError: string | null;
1522
+ availableTools: McpToolDefinition[] | null;
1523
+ credentialReferenceId: string | null;
1524
+ };
1525
+ }[];
1526
+ pagination: {
1527
+ page: number;
1528
+ limit: number;
1529
+ total: number;
1530
+ pages: number;
1531
+ };
1532
+ }>;
1533
+ declare const getAgentsForTool: (db: DatabaseClient) => (params: {
1534
+ scopes: ScopeConfig;
1535
+ toolId: string;
1536
+ pagination?: PaginationConfig;
1537
+ }) => Promise<{
1538
+ data: {
1539
+ id: string;
1540
+ tenantId: string;
1541
+ agentId: string;
1542
+ toolId: string;
1543
+ selectedTools: string[] | null;
1544
+ createdAt: string;
1545
+ updatedAt: string;
1546
+ agent: {
1547
+ id: string;
1548
+ name: string;
1549
+ description: string;
1550
+ prompt: string;
1551
+ createdAt: string;
1552
+ updatedAt: string;
1553
+ };
1554
+ }[];
1555
+ pagination: {
1556
+ page: number;
1557
+ limit: number;
1558
+ total: number;
1559
+ pages: number;
1560
+ };
1561
+ }>;
1562
+ declare const validateInternalAgent: (db: DatabaseClient) => (params: {
1563
+ scopes: ScopeConfig;
1564
+ agentId: string;
1565
+ }) => Promise<boolean>;
1566
+ declare const validateExternalAgent: (db: DatabaseClient) => (params: {
1567
+ scopes: ScopeConfig;
1568
+ agentId: string;
1569
+ }) => Promise<boolean>;
1570
+
1571
+ declare const getAgentById: (db: DatabaseClient) => (params: {
1572
+ scopes: ScopeConfig;
1573
+ agentId: string;
1574
+ }) => Promise<{
1575
+ tenantId: string;
1576
+ projectId: string;
1577
+ id: string;
1578
+ name: string;
1579
+ description: string;
1580
+ prompt: string;
1581
+ createdAt: string;
1582
+ updatedAt: string;
1583
+ models: {
1584
+ base?: {
1585
+ model?: string | undefined;
1586
+ providerOptions?: Record<string, unknown> | undefined;
1587
+ } | undefined;
1588
+ structuredOutput?: {
1589
+ model?: string | undefined;
1590
+ providerOptions?: Record<string, unknown> | undefined;
1591
+ } | undefined;
1592
+ summarizer?: {
1593
+ model?: string | undefined;
1594
+ providerOptions?: Record<string, unknown> | undefined;
1595
+ } | undefined;
1596
+ } | null;
1597
+ stopWhen: {
1598
+ stepCountIs?: number;
1599
+ } | null;
1600
+ conversationHistoryConfig: ConversationHistoryConfig | null;
1601
+ } | undefined>;
1602
+ declare const listAgents: (db: DatabaseClient) => (params: {
1603
+ scopes: ScopeConfig;
1604
+ }) => Promise<{
1605
+ tenantId: string;
1606
+ projectId: string;
1607
+ id: string;
1608
+ name: string;
1609
+ description: string;
1610
+ prompt: string;
1611
+ createdAt: string;
1612
+ updatedAt: string;
1613
+ models: {
1614
+ base?: {
1615
+ model?: string | undefined;
1616
+ providerOptions?: Record<string, unknown> | undefined;
1617
+ } | undefined;
1618
+ structuredOutput?: {
1619
+ model?: string | undefined;
1620
+ providerOptions?: Record<string, unknown> | undefined;
1621
+ } | undefined;
1622
+ summarizer?: {
1623
+ model?: string | undefined;
1624
+ providerOptions?: Record<string, unknown> | undefined;
1625
+ } | undefined;
1626
+ } | null;
1627
+ stopWhen: {
1628
+ stepCountIs?: number;
1629
+ } | null;
1630
+ conversationHistoryConfig: ConversationHistoryConfig | null;
1631
+ }[]>;
1632
+ declare const listAgentsPaginated: (db: DatabaseClient) => (params: {
1633
+ scopes: ScopeConfig;
1634
+ pagination?: PaginationConfig;
1635
+ }) => Promise<{
1636
+ data: {
1637
+ tenantId: string;
1638
+ projectId: string;
1639
+ id: string;
1640
+ name: string;
1641
+ description: string;
1642
+ prompt: string;
1643
+ conversationHistoryConfig: ConversationHistoryConfig | null;
1644
+ models: {
1645
+ base?: {
1646
+ model?: string | undefined;
1647
+ providerOptions?: Record<string, unknown> | undefined;
1648
+ } | undefined;
1649
+ structuredOutput?: {
1650
+ model?: string | undefined;
1651
+ providerOptions?: Record<string, unknown> | undefined;
1652
+ } | undefined;
1653
+ summarizer?: {
1654
+ model?: string | undefined;
1655
+ providerOptions?: Record<string, unknown> | undefined;
1656
+ } | undefined;
1657
+ } | null;
1658
+ stopWhen: {
1659
+ stepCountIs?: number;
1660
+ } | null;
1661
+ createdAt: string;
1662
+ updatedAt: string;
1663
+ }[];
1664
+ pagination: {
1665
+ page: number;
1666
+ limit: number;
1667
+ total: number;
1668
+ pages: number;
1669
+ };
1670
+ }>;
1671
+ declare const createAgent: (db: DatabaseClient) => (params: AgentInsert) => Promise<{
1672
+ tenantId: string;
1673
+ projectId: string;
1674
+ id: string;
1675
+ name: string;
1676
+ description: string;
1677
+ prompt: string;
1678
+ createdAt: string;
1679
+ updatedAt: string;
1680
+ models: {
1681
+ base?: {
1682
+ model?: string | undefined;
1683
+ providerOptions?: Record<string, unknown> | undefined;
1684
+ } | undefined;
1685
+ structuredOutput?: {
1686
+ model?: string | undefined;
1687
+ providerOptions?: Record<string, unknown> | undefined;
1688
+ } | undefined;
1689
+ summarizer?: {
1690
+ model?: string | undefined;
1691
+ providerOptions?: Record<string, unknown> | undefined;
1692
+ } | undefined;
1693
+ } | null;
1694
+ stopWhen: {
1695
+ stepCountIs?: number;
1696
+ } | null;
1697
+ conversationHistoryConfig: ConversationHistoryConfig | null;
1698
+ }>;
1699
+ declare const updateAgent: (db: DatabaseClient) => (params: {
1700
+ scopes: ScopeConfig;
1701
+ agentId: string;
1702
+ data: AgentUpdate;
1703
+ }) => Promise<{
1704
+ tenantId: string;
1705
+ projectId: string;
1706
+ id: string;
1707
+ name: string;
1708
+ description: string;
1709
+ prompt: string;
1710
+ createdAt: string;
1711
+ updatedAt: string;
1712
+ models: {
1713
+ base?: {
1714
+ model?: string | undefined;
1715
+ providerOptions?: Record<string, unknown> | undefined;
1716
+ } | undefined;
1717
+ structuredOutput?: {
1718
+ model?: string | undefined;
1719
+ providerOptions?: Record<string, unknown> | undefined;
1720
+ } | undefined;
1721
+ summarizer?: {
1722
+ model?: string | undefined;
1723
+ providerOptions?: Record<string, unknown> | undefined;
1724
+ } | undefined;
1725
+ } | null;
1726
+ stopWhen: {
1727
+ stepCountIs?: number;
1728
+ } | null;
1729
+ conversationHistoryConfig: ConversationHistoryConfig | null;
1730
+ }>;
1731
+ /**
1732
+ * Upsert agent (create if it doesn't exist, update if it does)
1733
+ */
1734
+ declare const upsertAgent: (db: DatabaseClient) => (params: {
1735
+ data: AgentInsert;
1736
+ }) => Promise<AgentSelect>;
1737
+ declare const deleteAgent: (db: DatabaseClient) => (params: {
1738
+ scopes: ScopeConfig;
1739
+ agentId: string;
1740
+ }) => Promise<boolean>;
1741
+ declare const getAgentsByIds: (db: DatabaseClient) => (params: {
1742
+ scopes: ScopeConfig;
1743
+ agentIds: string[];
1744
+ }) => Promise<{
1745
+ tenantId: string;
1746
+ projectId: string;
1747
+ id: string;
1748
+ name: string;
1749
+ description: string;
1750
+ prompt: string;
1751
+ conversationHistoryConfig: ConversationHistoryConfig | null;
1752
+ models: {
1753
+ base?: {
1754
+ model?: string | undefined;
1755
+ providerOptions?: Record<string, unknown> | undefined;
1756
+ } | undefined;
1757
+ structuredOutput?: {
1758
+ model?: string | undefined;
1759
+ providerOptions?: Record<string, unknown> | undefined;
1760
+ } | undefined;
1761
+ summarizer?: {
1762
+ model?: string | undefined;
1763
+ providerOptions?: Record<string, unknown> | undefined;
1764
+ } | undefined;
1765
+ } | null;
1766
+ stopWhen: {
1767
+ stepCountIs?: number;
1768
+ } | null;
1769
+ createdAt: string;
1770
+ updatedAt: string;
1771
+ }[]>;
1772
+ declare const getAgentInGraphContext: (db: DatabaseClient) => (params: {
1773
+ scopes: ScopeConfig;
1774
+ graphId: string;
1775
+ agentId: string;
1776
+ }) => Promise<{
1777
+ id: string;
1778
+ name: string;
1779
+ description: string;
1780
+ prompt: string;
1781
+ tenantId: string;
1782
+ graphId: string;
1783
+ sourceAgentId: string;
1784
+ }[]>;
1785
+
1786
+ declare const getApiKeyById: (db: DatabaseClient) => (params: {
1787
+ scopes: ScopeConfig;
1788
+ id: string;
1789
+ }) => Promise<{
1790
+ tenantId: string;
1791
+ projectId: string;
1792
+ id: string;
1793
+ graphId: string;
1794
+ publicId: string;
1795
+ keyHash: string;
1796
+ keyPrefix: string;
1797
+ lastUsedAt: string | null;
1798
+ expiresAt: string | null;
1799
+ createdAt: string;
1800
+ updatedAt: string;
1801
+ } | undefined>;
1802
+ declare const getApiKeyByPublicId: (db: DatabaseClient) => (publicId: string) => Promise<{
1803
+ tenantId: string;
1804
+ projectId: string;
1805
+ id: string;
1806
+ graphId: string;
1807
+ publicId: string;
1808
+ keyHash: string;
1809
+ keyPrefix: string;
1810
+ lastUsedAt: string | null;
1811
+ expiresAt: string | null;
1812
+ createdAt: string;
1813
+ updatedAt: string;
1814
+ } | undefined>;
1815
+ declare const listApiKeys: (db: DatabaseClient) => (params: {
1816
+ scopes: ScopeConfig;
1817
+ graphId?: string;
1818
+ }) => Promise<{
1819
+ tenantId: string;
1820
+ projectId: string;
1821
+ id: string;
1822
+ graphId: string;
1823
+ publicId: string;
1824
+ keyHash: string;
1825
+ keyPrefix: string;
1826
+ lastUsedAt: string | null;
1827
+ expiresAt: string | null;
1828
+ createdAt: string;
1829
+ updatedAt: string;
1830
+ }[]>;
1831
+ declare const listApiKeysPaginated: (db: DatabaseClient) => (params: {
1832
+ scopes: ScopeConfig;
1833
+ pagination?: PaginationConfig;
1834
+ graphId?: string;
1835
+ }) => Promise<{
1836
+ data: ApiKeySelect[];
1837
+ pagination: {
1838
+ page: number;
1839
+ limit: number;
1840
+ total: number;
1841
+ pages: number;
1842
+ };
1843
+ }>;
1844
+ declare const createApiKey: (db: DatabaseClient) => (params: ApiKeyInsert) => Promise<{
1845
+ tenantId: string;
1846
+ projectId: string;
1847
+ id: string;
1848
+ graphId: string;
1849
+ publicId: string;
1850
+ keyHash: string;
1851
+ keyPrefix: string;
1852
+ lastUsedAt: string | null;
1853
+ expiresAt: string | null;
1854
+ createdAt: string;
1855
+ updatedAt: string;
1856
+ }>;
1857
+ declare const updateApiKey: (db: DatabaseClient) => (params: {
1858
+ scopes: ScopeConfig;
1859
+ id: string;
1860
+ data: ApiKeyUpdate;
1861
+ }) => Promise<{
1862
+ tenantId: string;
1863
+ projectId: string;
1864
+ id: string;
1865
+ graphId: string;
1866
+ publicId: string;
1867
+ keyHash: string;
1868
+ keyPrefix: string;
1869
+ lastUsedAt: string | null;
1870
+ expiresAt: string | null;
1871
+ createdAt: string;
1872
+ updatedAt: string;
1873
+ }>;
1874
+ declare const deleteApiKey: (db: DatabaseClient) => (params: {
1875
+ scopes: ScopeConfig;
1876
+ id: string;
1877
+ }) => Promise<boolean>;
1878
+ declare const hasApiKey: (db: DatabaseClient) => (params: {
1879
+ scopes: ScopeConfig;
1880
+ id: string;
1881
+ }) => Promise<boolean>;
1882
+ declare const updateApiKeyLastUsed: (db: DatabaseClient) => (id: string) => Promise<void>;
1883
+ declare const countApiKeys: (db: DatabaseClient) => (params: {
1884
+ scopes: ScopeConfig;
1885
+ graphId?: string;
1886
+ }) => Promise<number>;
1887
+ /**
1888
+ * Create a new API key
1889
+ * Returns both the API key record and the full key (which should be shown to the user only once)
1890
+ */
1891
+ declare const generateAndCreateApiKey: (params: CreateApiKeyParams, db: DatabaseClient) => Promise<ApiKeyCreateResult>;
1892
+ /**
1893
+ * Validate an API key and return the associated record if valid
1894
+ */
1895
+ declare const validateAndGetApiKey: (key: string, db: DatabaseClient) => Promise<ApiKeySelect | null>;
1896
+
1897
+ declare const getArtifactComponentById: (db: DatabaseClient) => (params: {
1898
+ scopes: ScopeConfig;
1899
+ id: string;
1900
+ }) => Promise<{
1901
+ tenantId: string;
1902
+ projectId: string;
1903
+ id: string;
1904
+ name: string;
1905
+ description: string;
1906
+ createdAt: string;
1907
+ updatedAt: string;
1908
+ summaryProps: Record<string, unknown> | null;
1909
+ fullProps: Record<string, unknown> | null;
1910
+ } | undefined>;
1911
+ declare const listArtifactComponents: (db: DatabaseClient) => (params: {
1912
+ scopes: ScopeConfig;
1913
+ }) => Promise<{
1914
+ tenantId: string;
1915
+ projectId: string;
1916
+ id: string;
1917
+ name: string;
1918
+ description: string;
1919
+ summaryProps: Record<string, unknown> | null;
1920
+ fullProps: Record<string, unknown> | null;
1921
+ createdAt: string;
1922
+ updatedAt: string;
1923
+ }[]>;
1924
+ declare const listArtifactComponentsPaginated: (db: DatabaseClient) => (params: {
1925
+ scopes: ScopeConfig;
1926
+ pagination?: PaginationConfig;
1927
+ }) => Promise<{
1928
+ data: ArtifactComponentSelect[];
1929
+ pagination: {
1930
+ page: number;
1931
+ limit: number;
1932
+ total: number;
1933
+ pages: number;
1934
+ };
1935
+ }>;
1936
+ declare const createArtifactComponent: (db: DatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
1937
+ tenantId: string;
1938
+ projectId: string;
1939
+ id: string;
1940
+ name: string;
1941
+ description: string;
1942
+ createdAt: string;
1943
+ updatedAt: string;
1944
+ summaryProps: Record<string, unknown> | null;
1945
+ fullProps: Record<string, unknown> | null;
1946
+ }>;
1947
+ declare const updateArtifactComponent: (db: DatabaseClient) => (params: {
1948
+ scopes: ScopeConfig;
1949
+ id: string;
1950
+ data: ArtifactComponentUpdate;
1951
+ }) => Promise<{
1952
+ tenantId: string;
1953
+ projectId: string;
1954
+ id: string;
1955
+ name: string;
1956
+ description: string;
1957
+ createdAt: string;
1958
+ updatedAt: string;
1959
+ summaryProps: Record<string, unknown> | null;
1960
+ fullProps: Record<string, unknown> | null;
1961
+ }>;
1962
+ declare const deleteArtifactComponent: (db: DatabaseClient) => (params: {
1963
+ scopes: ScopeConfig;
1964
+ id: string;
1965
+ }) => Promise<boolean>;
1966
+ declare const getArtifactComponentsForAgent: (db: DatabaseClient) => (params: {
1967
+ scopes: ScopeConfig;
1968
+ agentId: string;
1969
+ }) => Promise<{
1970
+ id: string;
1971
+ tenantId: string;
1972
+ projectId: string;
1973
+ name: string;
1974
+ description: string;
1975
+ summaryProps: Record<string, unknown> | null;
1976
+ fullProps: Record<string, unknown> | null;
1977
+ createdAt: string;
1978
+ updatedAt: string;
1979
+ }[]>;
1980
+ declare const associateArtifactComponentWithAgent: (db: DatabaseClient) => (params: {
1981
+ scopes: ScopeConfig;
1982
+ agentId: string;
1983
+ artifactComponentId: string;
1984
+ }) => Promise<{
1985
+ tenantId: string;
1986
+ projectId: string;
1987
+ id: string;
1988
+ createdAt: string;
1989
+ agentId: string;
1990
+ artifactComponentId: string;
1991
+ }>;
1992
+ declare const removeArtifactComponentFromAgent: (db: DatabaseClient) => (params: {
1993
+ scopes: ScopeConfig;
1994
+ agentId: string;
1995
+ artifactComponentId: string;
1996
+ }) => Promise<boolean>;
1997
+ declare const deleteAgentArtifactComponentRelationByAgent: (db: DatabaseClient) => (params: {
1998
+ scopes: ScopeConfig;
1999
+ agentId: string;
2000
+ }) => Promise<boolean>;
2001
+ declare const getAgentsUsingArtifactComponent: (db: DatabaseClient) => (params: {
2002
+ scopes: ScopeConfig;
2003
+ artifactComponentId: string;
2004
+ }) => Promise<{
2005
+ agentId: string;
2006
+ createdAt: string;
2007
+ }[]>;
2008
+ declare const isArtifactComponentAssociatedWithAgent: (db: DatabaseClient) => (params: {
2009
+ scopes: ScopeConfig;
2010
+ agentId: string;
2011
+ artifactComponentId: string;
2012
+ }) => Promise<boolean>;
2013
+ declare const graphHasArtifactComponents: (db: DatabaseClient) => (params: {
2014
+ scopes: ScopeConfig;
2015
+ graphId: string;
2016
+ }) => Promise<boolean>;
2017
+ declare const countArtifactComponents: (db: DatabaseClient) => (params: {
2018
+ scopes: ScopeConfig;
2019
+ }) => Promise<number>;
2020
+ declare const countArtifactComponentsForAgent: (db: DatabaseClient) => (params: {
2021
+ scopes: ScopeConfig;
2022
+ agentId: string;
2023
+ }) => Promise<number>;
2024
+ /**
2025
+ * Upsert agent-artifact component relation (create if it doesn't exist, no-op if it does)
2026
+ */
2027
+ declare const upsertAgentArtifactComponentRelation: (db: DatabaseClient) => (params: {
2028
+ scopes: ScopeConfig;
2029
+ agentId: string;
2030
+ artifactComponentId: string;
2031
+ }) => Promise<{
2032
+ tenantId: string;
2033
+ projectId: string;
2034
+ id: string;
2035
+ createdAt: string;
2036
+ agentId: string;
2037
+ artifactComponentId: string;
2038
+ } | null>;
2039
+ /**
2040
+ * Upsert an artifact component (create if it doesn't exist, update if it does)
2041
+ */
2042
+ declare const upsertArtifactComponent: (db: DatabaseClient) => (params: {
2043
+ data: ArtifactComponentInsert;
2044
+ }) => Promise<ArtifactComponentSelect>;
2045
+
2046
+ /**
2047
+ * Get cached context data for a conversation with optional request hash validation
2048
+ */
2049
+ declare const getCacheEntry: (db: DatabaseClient) => (params: {
2050
+ conversationId: string;
2051
+ contextConfigId: string;
2052
+ contextVariableKey: string;
2053
+ requestHash?: string;
2054
+ }) => Promise<ContextCacheSelect | null>;
2055
+ /**
2056
+ * Set cached context data for a conversation
2057
+ */
2058
+ declare const setCacheEntry: (db: DatabaseClient) => (entry: ContextCacheInsert) => Promise<ContextCacheSelect | null>;
2059
+ /**
2060
+ * Clear cache entries for a specific conversation
2061
+ */
2062
+ declare const clearConversationCache: (db: DatabaseClient) => (params: {
2063
+ scopes: ScopeConfig;
2064
+ conversationId: string;
2065
+ }) => Promise<number>;
2066
+ /**
2067
+ * Clear all cache entries for a specific context configuration
2068
+ */
2069
+ declare const clearContextConfigCache: (db: DatabaseClient) => (params: {
2070
+ scopes: ScopeConfig;
2071
+ contextConfigId: string;
2072
+ }) => Promise<number>;
2073
+ /**
2074
+ * Clean up all cache entries for a tenant
2075
+ */
2076
+ declare const cleanupTenantCache: (db: DatabaseClient) => (params: {
2077
+ scopes: ScopeConfig;
2078
+ }) => Promise<number>;
2079
+ /**
2080
+ * Invalidate the request context cache for a conversation
2081
+ */
2082
+ declare const invalidateRequestContextCache: (db: DatabaseClient) => (params: {
2083
+ scopes: ScopeConfig;
2084
+ conversationId: string;
2085
+ contextConfigId: string;
2086
+ }) => Promise<number>;
2087
+ /**
2088
+ * Invalidate specific cache entries for invocation-trigger definitions
2089
+ */
2090
+ declare const invalidateInvocationDefinitionsCache: (db: DatabaseClient) => (params: {
2091
+ scopes: ScopeConfig;
2092
+ conversationId: string;
2093
+ contextConfigId: string;
2094
+ invocationDefinitionIds: string[];
2095
+ }) => Promise<number>;
2096
+ /**
2097
+ * Get all cache entries for a conversation
2098
+ */
2099
+ declare const getConversationCacheEntries: (db: DatabaseClient) => (params: {
2100
+ scopes: ScopeConfig;
2101
+ conversationId: string;
2102
+ }) => Promise<ContextCacheSelect[]>;
2103
+ /**
2104
+ * Get all cache entries for a context configuration
2105
+ */
2106
+ declare const getContextConfigCacheEntries: (db: DatabaseClient) => (params: {
2107
+ scopes: ScopeConfig;
2108
+ contextConfigId: string;
2109
+ }) => Promise<ContextCacheSelect[]>;
2110
+
2111
+ declare const getContextConfigById: (db: DatabaseClient) => (params: {
2112
+ scopes: ScopeConfig;
2113
+ id: string;
2114
+ }) => Promise<{
2115
+ tenantId: string;
2116
+ projectId: string;
2117
+ id: string;
2118
+ name: string;
2119
+ description: string;
2120
+ createdAt: string;
2121
+ updatedAt: string;
2122
+ requestContextSchema: unknown;
2123
+ contextVariables: Record<string, ContextFetchDefinition> | null;
2124
+ } | undefined>;
2125
+ declare const listContextConfigs: (db: DatabaseClient) => (params: {
2126
+ scopes: ScopeConfig;
2127
+ }) => Promise<{
2128
+ tenantId: string;
2129
+ projectId: string;
2130
+ id: string;
2131
+ name: string;
2132
+ description: string;
2133
+ createdAt: string;
2134
+ updatedAt: string;
2135
+ requestContextSchema: unknown;
2136
+ contextVariables: Record<string, ContextFetchDefinition> | null;
2137
+ }[]>;
2138
+ declare const listContextConfigsPaginated: (db: DatabaseClient) => (params: {
2139
+ scopes: ScopeConfig;
2140
+ pagination?: PaginationConfig;
2141
+ }) => Promise<{
2142
+ data: any[];
2143
+ pagination: {
2144
+ page: number;
2145
+ limit: number;
2146
+ total: number;
2147
+ pages: number;
2148
+ };
2149
+ }>;
2150
+ declare const createContextConfig: (db: DatabaseClient) => (params: ContextConfigInsert) => Promise<{
2151
+ tenantId: string;
2152
+ projectId: string;
2153
+ id: string;
2154
+ name: string;
2155
+ description: string;
2156
+ createdAt: string;
2157
+ updatedAt: string;
2158
+ requestContextSchema: unknown;
2159
+ contextVariables: Record<string, ContextFetchDefinition> | null;
2160
+ }>;
2161
+ declare const updateContextConfig: (db: DatabaseClient) => (params: {
2162
+ scopes: ScopeConfig;
2163
+ id: string;
2164
+ data: Partial<ContextConfigUpdate>;
2165
+ }) => Promise<{
2166
+ tenantId: string;
2167
+ projectId: string;
2168
+ id: string;
2169
+ name: string;
2170
+ description: string;
2171
+ createdAt: string;
2172
+ updatedAt: string;
2173
+ requestContextSchema: unknown;
2174
+ contextVariables: Record<string, ContextFetchDefinition> | null;
2175
+ }>;
2176
+ declare const deleteContextConfig: (db: DatabaseClient) => (params: {
2177
+ scopes: ScopeConfig;
2178
+ id: string;
2179
+ }) => Promise<boolean>;
2180
+ declare const hasContextConfig: (db: DatabaseClient) => (params: {
2181
+ scopes: ScopeConfig;
2182
+ id: string;
2183
+ }) => Promise<boolean>;
2184
+ declare const countContextConfigs: (db: DatabaseClient) => (params: {
2185
+ scopes: ScopeConfig;
2186
+ }) => Promise<number>;
2187
+ declare const getContextConfigsByName: (db: DatabaseClient) => (params: {
2188
+ scopes: ScopeConfig;
2189
+ name: string;
2190
+ }) => Promise<{
2191
+ tenantId: string;
2192
+ projectId: string;
2193
+ id: string;
2194
+ name: string;
2195
+ description: string;
2196
+ createdAt: string;
2197
+ updatedAt: string;
2198
+ requestContextSchema: unknown;
2199
+ contextVariables: Record<string, ContextFetchDefinition> | null;
2200
+ }[]>;
2201
+ /**
2202
+ * Upsert a context config (create if it doesn't exist, update if it does)
2203
+ */
2204
+ declare const upsertContextConfig: (db: DatabaseClient) => (params: {
2205
+ data: ContextConfigInsert;
2206
+ }) => Promise<{
2207
+ tenantId: string;
2208
+ projectId: string;
2209
+ id: string;
2210
+ name: string;
2211
+ description: string;
2212
+ createdAt: string;
2213
+ updatedAt: string;
2214
+ requestContextSchema: unknown;
2215
+ contextVariables: Record<string, ContextFetchDefinition> | null;
2216
+ }>;
2217
+
2218
+ declare const listConversations: (db: DatabaseClient) => (params: {
2219
+ scopes: ScopeConfig;
2220
+ userId?: string;
2221
+ pagination?: PaginationConfig;
2222
+ }) => Promise<{
2223
+ conversations: ConversationSelect[];
2224
+ total: number;
2225
+ }>;
2226
+ declare const createConversation: (db: DatabaseClient) => (params: ConversationInsert) => Promise<{
2227
+ tenantId: string;
2228
+ projectId: string;
2229
+ id: string;
2230
+ createdAt: string;
2231
+ updatedAt: string;
2232
+ metadata: ConversationMetadata | null;
2233
+ title: string | null;
2234
+ userId: string | null;
2235
+ activeAgentId: string;
2236
+ lastContextResolution: string | null;
2237
+ }>;
2238
+ declare const updateConversation: (db: DatabaseClient) => (params: {
2239
+ scopes: ScopeConfig;
2240
+ conversationId: string;
2241
+ data: ConversationUpdate;
2242
+ }) => Promise<{
2243
+ tenantId: string;
2244
+ projectId: string;
2245
+ id: string;
2246
+ createdAt: string;
2247
+ updatedAt: string;
2248
+ metadata: ConversationMetadata | null;
2249
+ title: string | null;
2250
+ userId: string | null;
2251
+ activeAgentId: string;
2252
+ lastContextResolution: string | null;
2253
+ }>;
2254
+ declare const deleteConversation: (db: DatabaseClient) => (params: {
2255
+ scopes: ScopeConfig;
2256
+ conversationId: string;
2257
+ }) => Promise<boolean>;
2258
+ declare const updateConversationActiveAgent: (db: DatabaseClient) => (params: {
2259
+ scopes: ScopeConfig;
2260
+ conversationId: string;
2261
+ activeAgentId: string;
2262
+ }) => Promise<{
2263
+ tenantId: string;
2264
+ projectId: string;
2265
+ id: string;
2266
+ createdAt: string;
2267
+ updatedAt: string;
2268
+ metadata: ConversationMetadata | null;
2269
+ title: string | null;
2270
+ userId: string | null;
2271
+ activeAgentId: string;
2272
+ lastContextResolution: string | null;
2273
+ }>;
2274
+ declare const getConversation: (db: DatabaseClient) => (params: {
2275
+ scopes: ScopeConfig;
2276
+ conversationId: string;
2277
+ }) => Promise<{
2278
+ tenantId: string;
2279
+ projectId: string;
2280
+ id: string;
2281
+ createdAt: string;
2282
+ updatedAt: string;
2283
+ metadata: ConversationMetadata | null;
2284
+ title: string | null;
2285
+ userId: string | null;
2286
+ activeAgentId: string;
2287
+ lastContextResolution: string | null;
2288
+ } | undefined>;
2289
+ declare const createOrGetConversation: (db: DatabaseClient) => (input: ConversationInsert) => Promise<{
2290
+ id: string;
2291
+ tenantId: string;
2292
+ projectId: string;
2293
+ userId: string | null | undefined;
2294
+ activeAgentId: string;
2295
+ title: string | null | undefined;
2296
+ lastContextResolution: string | null | undefined;
2297
+ metadata: ConversationMetadata | null | undefined;
2298
+ createdAt: string;
2299
+ updatedAt: string;
2300
+ }>;
2301
+ /**
2302
+ * Get conversation history with filtering and context management
2303
+ */
2304
+ declare const getConversationHistory: (db: DatabaseClient) => (params: {
2305
+ scopes: ScopeConfig;
2306
+ conversationId: string;
2307
+ options?: ConversationHistoryConfig;
2308
+ }) => Promise<any[]>;
2309
+ /**
2310
+ * Get active agent for a conversation
2311
+ */
2312
+ declare const getActiveAgentForConversation: (db: DatabaseClient) => (params: {
2313
+ scopes: ScopeConfig;
2314
+ conversationId: string;
2315
+ }) => Promise<{
2316
+ tenantId: string;
2317
+ projectId: string;
2318
+ id: string;
2319
+ createdAt: string;
2320
+ updatedAt: string;
2321
+ metadata: ConversationMetadata | null;
2322
+ title: string | null;
2323
+ userId: string | null;
2324
+ activeAgentId: string;
2325
+ lastContextResolution: string | null;
2326
+ } | undefined>;
2327
+ /**
2328
+ * Set active agent for a conversation (upsert operation)
2329
+ */
2330
+ declare const setActiveAgentForConversation: (db: DatabaseClient) => (params: {
2331
+ scopes: ScopeConfig;
2332
+ conversationId: string;
2333
+ agentId: string;
2334
+ }) => Promise<void>;
2335
+ declare const setActiveAgentForThread: (db: DatabaseClient) => ({ scopes, threadId, agentId, }: {
2336
+ scopes: ScopeConfig;
2337
+ threadId: string;
2338
+ agentId: string;
2339
+ }) => Promise<void>;
2340
+
2341
+ type CredentialReferenceWithTools = CredentialReferenceSelect & {
2342
+ tools: ToolSelect[];
2343
+ };
2344
+ /**
2345
+ * Get a credential reference by ID
2346
+ */
2347
+ declare const getCredentialReference: (db: DatabaseClient) => (params: {
2348
+ scopes: ScopeConfig;
2349
+ id: string;
2350
+ }) => Promise<CredentialReferenceSelect | undefined>;
2351
+ /**
2352
+ * Get a credential reference by ID with its related tools
2353
+ */
2354
+ declare const getCredentialReferenceWithTools: (db: DatabaseClient) => (params: {
2355
+ scopes: ScopeConfig;
2356
+ id: string;
2357
+ }) => Promise<CredentialReferenceWithTools | undefined>;
2358
+ /**
2359
+ * List all credential references for a tenant/project
2360
+ */
2361
+ declare const listCredentialReferences: (db: DatabaseClient) => (params: {
2362
+ scopes: ScopeConfig;
2363
+ }) => Promise<CredentialReferenceSelect[]>;
2364
+ /**
2365
+ * List credential references with pagination
2366
+ */
2367
+ declare const listCredentialReferencesPaginated: (db: DatabaseClient) => (params: {
2368
+ scopes: ScopeConfig;
2369
+ pagination?: PaginationConfig;
2370
+ }) => Promise<{
2371
+ data: CredentialReferenceSelect[];
2372
+ pagination: {
2373
+ page: number;
2374
+ limit: number;
2375
+ total: number;
2376
+ pages: number;
2377
+ };
2378
+ }>;
2379
+ /**
2380
+ * Create a new credential reference
2381
+ */
2382
+ declare const createCredentialReference: (db: DatabaseClient) => (params: CredentialReferenceInsert) => Promise<CredentialReferenceSelect>;
2383
+ /**
2384
+ * Update a credential reference
2385
+ */
2386
+ declare const updateCredentialReference: (db: DatabaseClient) => (params: {
2387
+ scopes: ScopeConfig;
2388
+ id: string;
2389
+ data: Partial<CredentialReferenceUpdate>;
2390
+ }) => Promise<CredentialReferenceWithTools | undefined>;
2391
+ /**
2392
+ * Delete a credential reference
2393
+ */
2394
+ declare const deleteCredentialReference: (db: DatabaseClient) => (params: {
2395
+ scopes: ScopeConfig;
2396
+ id: string;
2397
+ }) => Promise<boolean>;
2398
+ /**
2399
+ * Check if a credential reference exists
2400
+ */
2401
+ declare const hasCredentialReference: (db: DatabaseClient) => (params: {
2402
+ scopes: ScopeConfig;
2403
+ id: string;
2404
+ }) => Promise<boolean>;
2405
+ /**
2406
+ * Get credential reference by ID (simple version without tools)
2407
+ */
2408
+ declare const getCredentialReferenceById: (db: DatabaseClient) => (params: {
2409
+ scopes: ScopeConfig;
2410
+ id: string;
2411
+ }) => Promise<CredentialReferenceSelect | null>;
2412
+ /**
2413
+ * Count credential references for a tenant/project
2414
+ */
2415
+ declare const countCredentialReferences: (db: DatabaseClient) => (params: {
2416
+ scopes: ScopeConfig;
2417
+ }) => Promise<number>;
2418
+ /**
2419
+ * Upsert a credential reference (create if it doesn't exist, update if it does)
2420
+ */
2421
+ declare const upsertCredentialReference: (db: DatabaseClient) => (params: {
2422
+ data: CredentialReferenceInsert;
2423
+ }) => Promise<CredentialReferenceSelect>;
2424
+
2425
+ /**
2426
+ * Get a data component by ID
2427
+ */
2428
+ declare const getDataComponent: (db: DatabaseClient) => (params: {
2429
+ scopes: ScopeConfig;
2430
+ dataComponentId: string;
2431
+ }) => Promise<DataComponentSelect | null>;
2432
+ /**
2433
+ * List all data components for a tenant/project
2434
+ */
2435
+ declare const listDataComponents: (db: DatabaseClient) => (params: {
2436
+ scopes: ScopeConfig;
2437
+ }) => Promise<DataComponentSelect[]>;
2438
+ /**
2439
+ * List data components with pagination
2440
+ */
2441
+ declare const listDataComponentsPaginated: (db: DatabaseClient) => (params: {
2442
+ scopes: ScopeConfig;
2443
+ pagination?: PaginationConfig;
2444
+ }) => Promise<{
2445
+ data: DataComponentSelect[];
2446
+ pagination: {
2447
+ page: number;
2448
+ limit: number;
2449
+ total: number;
2450
+ pages: number;
2451
+ };
2452
+ }>;
2453
+ /**
2454
+ * Create a new data component
2455
+ */
2456
+ declare const createDataComponent: (db: DatabaseClient) => (params: DataComponentInsert) => Promise<DataComponentSelect>;
2457
+ /**
2458
+ * Update a data component
2459
+ */
2460
+ declare const updateDataComponent: (db: DatabaseClient) => (params: {
2461
+ scopes: ScopeConfig;
2462
+ dataComponentId: string;
2463
+ data: DataComponentUpdate;
2464
+ }) => Promise<DataComponentSelect | null>;
2465
+ /**
2466
+ * Delete a data component
2467
+ */
2468
+ declare const deleteDataComponent: (db: DatabaseClient) => (params: {
2469
+ scopes: ScopeConfig;
2470
+ dataComponentId: string;
2471
+ }) => Promise<boolean>;
2472
+ /**
2473
+ * Get data components for a specific agent
2474
+ */
2475
+ declare const getDataComponentsForAgent: (db: DatabaseClient) => (params: {
2476
+ scopes: ScopeConfig;
2477
+ agentId: string;
2478
+ }) => Promise<DataComponentSelect[]>;
2479
+ /**
2480
+ * Associate a data component with an agent
2481
+ */
2482
+ declare const associateDataComponentWithAgent: (db: DatabaseClient) => (params: {
2483
+ scopes: ScopeConfig;
2484
+ agentId: string;
2485
+ dataComponentId: string;
2486
+ }) => Promise<{
2487
+ tenantId: string;
2488
+ projectId: string;
2489
+ id: string;
2490
+ createdAt: string;
2491
+ agentId: string;
2492
+ dataComponentId: string;
2493
+ }>;
2494
+ /**
2495
+ * Remove association between data component and agent
2496
+ */
2497
+ declare const removeDataComponentFromAgent: (db: DatabaseClient) => (params: {
2498
+ scopes: ScopeConfig;
2499
+ agentId: string;
2500
+ dataComponentId: string;
2501
+ }) => Promise<boolean>;
2502
+ declare const deleteAgentDataComponentRelationByAgent: (db: DatabaseClient) => (params: {
2503
+ scopes: ScopeConfig;
2504
+ agentId: string;
2505
+ }) => Promise<boolean>;
2506
+ /**
2507
+ * Get all agents that use a specific data component
2508
+ */
2509
+ declare const getAgentsUsingDataComponent: (db: DatabaseClient) => (params: {
2510
+ scopes: ScopeConfig;
2511
+ dataComponentId: string;
2512
+ }) => Promise<{
2513
+ agentId: string;
2514
+ createdAt: string;
2515
+ }[]>;
2516
+ /**
2517
+ * Check if a data component is associated with an agent
2518
+ */
2519
+ declare const isDataComponentAssociatedWithAgent: (db: DatabaseClient) => (params: {
2520
+ scopes: ScopeConfig;
2521
+ agentId: string;
2522
+ dataComponentId: string;
2523
+ }) => Promise<boolean>;
2524
+ /**
2525
+ * Upsert agent-data component relation (create if it doesn't exist, no-op if it does)
2526
+ */
2527
+ declare const upsertAgentDataComponentRelation: (db: DatabaseClient) => (params: {
2528
+ scopes: ScopeConfig;
2529
+ agentId: string;
2530
+ dataComponentId: string;
2531
+ }) => Promise<{
2532
+ tenantId: string;
2533
+ projectId: string;
2534
+ id: string;
2535
+ createdAt: string;
2536
+ agentId: string;
2537
+ dataComponentId: string;
2538
+ } | null>;
2539
+ /**
2540
+ * Count data components for a tenant/project
2541
+ */
2542
+ declare const countDataComponents: (db: DatabaseClient) => (params: {
2543
+ scopes: ScopeConfig;
2544
+ }) => Promise<number>;
2545
+ /**
2546
+ * Upsert a data component (create if it doesn't exist, update if it does)
2547
+ */
2548
+ declare const upsertDataComponent: (db: DatabaseClient) => (params: {
2549
+ data: DataComponentInsert;
2550
+ }) => Promise<DataComponentSelect | null>;
2551
+
2552
+ /**
2553
+ * Create a new external agent
2554
+ */
2555
+ declare const createExternalAgent: (db: DatabaseClient) => (params: ExternalAgentInsert) => Promise<ExternalAgentSelect>;
2556
+ /**
2557
+ * Get external agent by ID
2558
+ */
2559
+ declare const getExternalAgent: (db: DatabaseClient) => (params: {
2560
+ scopes: ScopeConfig;
2561
+ agentId: string;
2562
+ }) => Promise<ExternalAgentSelect | null>;
2563
+ /**
2564
+ * Get external agent by base URL
2565
+ */
2566
+ declare const getExternalAgentByUrl: (db: DatabaseClient) => (params: {
2567
+ scopes: ScopeConfig;
2568
+ baseUrl: string;
2569
+ }) => Promise<ExternalAgentSelect | null>;
2570
+ /**
2571
+ * List external agents for a tenant
2572
+ */
2573
+ declare const listExternalAgents: (db: DatabaseClient) => (params: {
2574
+ scopes: ScopeConfig;
2575
+ }) => Promise<ExternalAgentSelect[]>;
2576
+ /**
2577
+ * List external agents with pagination
2578
+ */
2579
+ declare const listExternalAgentsPaginated: (db: DatabaseClient) => (params: {
2580
+ scopes: ScopeConfig;
2581
+ pagination?: PaginationConfig;
2582
+ }) => Promise<{
2583
+ data: ExternalAgentSelect[];
2584
+ pagination: {
2585
+ page: number;
2586
+ limit: number;
2587
+ total: number;
2588
+ pages: number;
2589
+ };
2590
+ }>;
2591
+ /**
2592
+ * Update an existing external agent
2593
+ */
2594
+ declare const updateExternalAgent: (db: DatabaseClient) => (params: {
2595
+ scopes: ScopeConfig;
2596
+ agentId: string;
2597
+ data: Partial<ExternalAgentUpdate>;
2598
+ }) => Promise<ExternalAgentSelect | null>;
2599
+ /**
2600
+ * Upsert external agent (create if it doesn't exist, update if it does)
2601
+ */
2602
+ declare const upsertExternalAgent: (db: DatabaseClient) => (params: {
2603
+ data: ExternalAgentInsert;
2604
+ }) => Promise<ExternalAgentSelect>;
2605
+ /**
2606
+ * Delete an external agent
2607
+ */
2608
+ declare const deleteExternalAgent: (db: DatabaseClient) => (params: {
2609
+ scopes: ScopeConfig;
2610
+ agentId: string;
2611
+ }) => Promise<boolean>;
2612
+ /**
2613
+ * Check if an external agent exists
2614
+ */
2615
+ declare const externalAgentExists: (db: DatabaseClient) => (params: {
2616
+ scopes: ScopeConfig;
2617
+ agentId: string;
2618
+ }) => Promise<boolean>;
2619
+ /**
2620
+ * Check if an external agent exists by URL
2621
+ */
2622
+ declare const externalAgentUrlExists: (db: DatabaseClient) => (params: {
2623
+ scopes: ScopeConfig;
2624
+ baseUrl: string;
2625
+ }) => Promise<boolean>;
2626
+ /**
2627
+ * Count external agents for a tenant
2628
+ */
2629
+ declare const countExternalAgents: (db: DatabaseClient) => (params: {
2630
+ scopes: ScopeConfig;
2631
+ }) => Promise<number>;
2632
+
2633
+ interface GraphLogger {
2634
+ info(obj: Record<string, any>, msg?: string): void;
2635
+ error(obj: Record<string, any>, msg?: string): void;
2636
+ }
2637
+ /**
2638
+ * Server-side implementation of createFullGraph that performs actual database operations.
2639
+ * This function creates a complete graph with all agents, tools, and relationships.
2640
+ */
2641
+ declare const createFullGraphServerSide: (db: DatabaseClient, logger?: GraphLogger) => (scopes: ScopeConfig, graphData: FullGraphDefinition) => Promise<FullGraphDefinition>;
2642
+ /**
2643
+ * Server-side implementation of updateFullGraph that performs actual database operations.
2644
+ * This function updates a complete graph with all agents, tools, and relationships.
2645
+ */
2646
+ declare const updateFullGraphServerSide: (db: DatabaseClient, logger?: GraphLogger) => (scopes: ScopeConfig, graphData: FullGraphDefinition) => Promise<FullGraphDefinition>;
2647
+ /**
2648
+ * Get a complete graph definition by ID
2649
+ */
2650
+ declare const getFullGraph: (db: DatabaseClient, logger?: GraphLogger) => (params: {
2651
+ scopes: ScopeConfig;
2652
+ graphId: string;
2653
+ }) => Promise<FullGraphDefinition | null>;
2654
+ /**
2655
+ * Delete a complete graph and cascade to all related entities
2656
+ */
2657
+ declare const deleteFullGraph: (db: DatabaseClient, logger?: GraphLogger) => (params: {
2658
+ scopes: ScopeConfig;
2659
+ graphId: string;
2660
+ }) => Promise<boolean>;
2661
+
2662
+ /**
2663
+ * Save one or more artifacts to the ledger
2664
+ */
2665
+ declare const addLedgerArtifacts: (db: DatabaseClient) => (params: {
2666
+ scopes: ScopeConfig;
2667
+ contextId: string;
2668
+ taskId?: string | null;
2669
+ artifacts: Artifact[];
2670
+ }) => Promise<void>;
2671
+ /**
2672
+ * Retrieve artifacts by taskId and/or artifactId.
2673
+ * At least one of taskId or artifactId must be provided.
2674
+ */
2675
+ declare const getLedgerArtifacts: (db: DatabaseClient) => (params: {
2676
+ scopes: ScopeConfig;
2677
+ taskId?: string;
2678
+ artifactId?: string;
2679
+ }) => Promise<Artifact[]>;
2680
+ /**
2681
+ * Get ledger artifacts by context ID
2682
+ */
2683
+ declare const getLedgerArtifactsByContext: (db: DatabaseClient) => (params: {
2684
+ scopes: ScopeConfig;
2685
+ contextId: string;
2686
+ }) => Promise<LedgerArtifactSelect[]>;
2687
+ /**
2688
+ * Delete ledger artifacts by task ID
2689
+ */
2690
+ declare const deleteLedgerArtifactsByTask: (db: DatabaseClient) => (params: {
2691
+ scopes: ScopeConfig;
2692
+ taskId: string;
2693
+ }) => Promise<boolean>;
2694
+ /**
2695
+ * Delete ledger artifacts by context ID
2696
+ */
2697
+ declare const deleteLedgerArtifactsByContext: (db: DatabaseClient) => (params: {
2698
+ scopes: ScopeConfig;
2699
+ contextId: string;
2700
+ }) => Promise<boolean>;
2701
+ /**
2702
+ * Count ledger artifacts by task ID
2703
+ */
2704
+ declare const countLedgerArtifactsByTask: (db: DatabaseClient) => (params: {
2705
+ scopes: ScopeConfig;
2706
+ taskId: string;
2707
+ }) => Promise<number>;
2708
+
2709
+ declare const getMessageById: (db: DatabaseClient) => (params: {
2710
+ scopes: ScopeConfig;
2711
+ messageId: string;
2712
+ }) => Promise<{
2713
+ tenantId: string;
2714
+ projectId: string;
2715
+ id: string;
2716
+ createdAt: string;
2717
+ updatedAt: string;
2718
+ metadata: MessageMetadata | null;
2719
+ content: MessageContent;
2720
+ role: string;
2721
+ conversationId: string;
2722
+ agentId: string | null;
2723
+ fromAgentId: string | null;
2724
+ toAgentId: string | null;
2725
+ fromExternalAgentId: string | null;
2726
+ toExternalAgentId: string | null;
2727
+ visibility: string;
2728
+ messageType: string;
2729
+ taskId: string | null;
2730
+ parentMessageId: string | null;
2731
+ a2aTaskId: string | null;
2732
+ a2aSessionId: string | null;
2733
+ } | undefined>;
2734
+ declare const listMessages: (db: DatabaseClient) => (params: {
2735
+ scopes: ScopeConfig;
2736
+ pagination: PaginationConfig;
2737
+ }) => Promise<{
2738
+ tenantId: string;
2739
+ projectId: string;
2740
+ id: string;
2741
+ conversationId: string;
2742
+ role: string;
2743
+ fromAgentId: string | null;
2744
+ toAgentId: string | null;
2745
+ fromExternalAgentId: string | null;
2746
+ toExternalAgentId: string | null;
2747
+ content: MessageContent;
2748
+ visibility: string;
2749
+ messageType: string;
2750
+ agentId: string | null;
2751
+ taskId: string | null;
2752
+ parentMessageId: string | null;
2753
+ a2aTaskId: string | null;
2754
+ a2aSessionId: string | null;
2755
+ metadata: MessageMetadata | null;
2756
+ createdAt: string;
2757
+ updatedAt: string;
2758
+ }[]>;
2759
+ declare const getMessagesByConversation: (db: DatabaseClient) => (params: {
2760
+ scopes: ScopeConfig;
2761
+ conversationId: string;
2762
+ pagination: PaginationConfig;
2763
+ }) => Promise<{
2764
+ tenantId: string;
2765
+ projectId: string;
2766
+ id: string;
2767
+ conversationId: string;
2768
+ role: string;
2769
+ fromAgentId: string | null;
2770
+ toAgentId: string | null;
2771
+ fromExternalAgentId: string | null;
2772
+ toExternalAgentId: string | null;
2773
+ content: MessageContent;
2774
+ visibility: string;
2775
+ messageType: string;
2776
+ agentId: string | null;
2777
+ taskId: string | null;
2778
+ parentMessageId: string | null;
2779
+ a2aTaskId: string | null;
2780
+ a2aSessionId: string | null;
2781
+ metadata: MessageMetadata | null;
2782
+ createdAt: string;
2783
+ updatedAt: string;
2784
+ }[]>;
2785
+ declare const getMessagesByTask: (db: DatabaseClient) => (params: {
2786
+ scopes: ScopeConfig;
2787
+ taskId: string;
2788
+ pagination: PaginationConfig;
2789
+ }) => Promise<{
2790
+ tenantId: string;
2791
+ projectId: string;
2792
+ id: string;
2793
+ conversationId: string;
2794
+ role: string;
2795
+ fromAgentId: string | null;
2796
+ toAgentId: string | null;
2797
+ fromExternalAgentId: string | null;
2798
+ toExternalAgentId: string | null;
2799
+ content: MessageContent;
2800
+ visibility: string;
2801
+ messageType: string;
2802
+ agentId: string | null;
2803
+ taskId: string | null;
2804
+ parentMessageId: string | null;
2805
+ a2aTaskId: string | null;
2806
+ a2aSessionId: string | null;
2807
+ metadata: MessageMetadata | null;
2808
+ createdAt: string;
2809
+ updatedAt: string;
2810
+ }[]>;
2811
+ declare const getVisibleMessages: (db: DatabaseClient) => (params: {
2812
+ scopes: ScopeConfig;
2813
+ conversationId: string;
2814
+ visibility?: MessageVisibility[];
2815
+ pagination: PaginationConfig;
2816
+ }) => Promise<{
2817
+ tenantId: string;
2818
+ projectId: string;
2819
+ id: string;
2820
+ conversationId: string;
2821
+ role: string;
2822
+ fromAgentId: string | null;
2823
+ toAgentId: string | null;
2824
+ fromExternalAgentId: string | null;
2825
+ toExternalAgentId: string | null;
2826
+ content: MessageContent;
2827
+ visibility: string;
2828
+ messageType: string;
2829
+ agentId: string | null;
2830
+ taskId: string | null;
2831
+ parentMessageId: string | null;
2832
+ a2aTaskId: string | null;
2833
+ a2aSessionId: string | null;
2834
+ metadata: MessageMetadata | null;
2835
+ createdAt: string;
2836
+ updatedAt: string;
2837
+ }[]>;
2838
+ declare const createMessage: (db: DatabaseClient) => (params: MessageInsert) => Promise<{
2839
+ tenantId: string;
2840
+ projectId: string;
2841
+ id: string;
2842
+ createdAt: string;
2843
+ updatedAt: string;
2844
+ metadata: MessageMetadata | null;
2845
+ content: MessageContent;
2846
+ role: string;
2847
+ conversationId: string;
2848
+ agentId: string | null;
2849
+ fromAgentId: string | null;
2850
+ toAgentId: string | null;
2851
+ fromExternalAgentId: string | null;
2852
+ toExternalAgentId: string | null;
2853
+ visibility: string;
2854
+ messageType: string;
2855
+ taskId: string | null;
2856
+ parentMessageId: string | null;
2857
+ a2aTaskId: string | null;
2858
+ a2aSessionId: string | null;
2859
+ }>;
2860
+ declare const updateMessage: (db: DatabaseClient) => (params: {
2861
+ scopes: ScopeConfig;
2862
+ messageId: string;
2863
+ data: MessageUpdate;
2864
+ }) => Promise<{
2865
+ tenantId: string;
2866
+ projectId: string;
2867
+ id: string;
2868
+ createdAt: string;
2869
+ updatedAt: string;
2870
+ metadata: MessageMetadata | null;
2871
+ content: MessageContent;
2872
+ role: string;
2873
+ conversationId: string;
2874
+ agentId: string | null;
2875
+ fromAgentId: string | null;
2876
+ toAgentId: string | null;
2877
+ fromExternalAgentId: string | null;
2878
+ toExternalAgentId: string | null;
2879
+ visibility: string;
2880
+ messageType: string;
2881
+ taskId: string | null;
2882
+ parentMessageId: string | null;
2883
+ a2aTaskId: string | null;
2884
+ a2aSessionId: string | null;
2885
+ }>;
2886
+ declare const deleteMessage: (db: DatabaseClient) => (params: {
2887
+ scopes: ScopeConfig;
2888
+ messageId: string;
2889
+ }) => Promise<{
2890
+ tenantId: string;
2891
+ projectId: string;
2892
+ id: string;
2893
+ createdAt: string;
2894
+ updatedAt: string;
2895
+ metadata: MessageMetadata | null;
2896
+ content: MessageContent;
2897
+ role: string;
2898
+ conversationId: string;
2899
+ agentId: string | null;
2900
+ fromAgentId: string | null;
2901
+ toAgentId: string | null;
2902
+ fromExternalAgentId: string | null;
2903
+ toExternalAgentId: string | null;
2904
+ visibility: string;
2905
+ messageType: string;
2906
+ taskId: string | null;
2907
+ parentMessageId: string | null;
2908
+ a2aTaskId: string | null;
2909
+ a2aSessionId: string | null;
2910
+ }>;
2911
+ declare const countMessagesByConversation: (db: DatabaseClient) => (params: {
2912
+ scopes: ScopeConfig;
2913
+ conversationId: string;
2914
+ }) => Promise<number>;
2915
+
2916
+ /**
2917
+ * List all unique project IDs within a tenant by scanning all resource tables
2918
+ */
2919
+ declare const listProjects: (db: DatabaseClient) => (params: {
2920
+ tenantId: string;
2921
+ }) => Promise<ProjectInfo[]>;
2922
+ /**
2923
+ * List all unique project IDs within a tenant with pagination
2924
+ */
2925
+ declare const listProjectsPaginated: (db: DatabaseClient) => (params: {
2926
+ tenantId: string;
2927
+ pagination?: PaginationConfig;
2928
+ }) => Promise<{
2929
+ data: ProjectSelect[];
2930
+ pagination: PaginationResult;
2931
+ }>;
2932
+ /**
2933
+ * Get resource counts for a specific project
2934
+ */
2935
+ declare const getProjectResourceCounts: (db: DatabaseClient) => (params: ScopeConfig) => Promise<ProjectResourceCounts>;
2936
+ /**
2937
+ * Check if a project exists (has any resources)
2938
+ */
2939
+ declare const projectExists: (db: DatabaseClient) => (params: ScopeConfig) => Promise<boolean>;
2940
+ /**
2941
+ * Count total projects for a tenant
2942
+ */
2943
+ declare const countProjects: (db: DatabaseClient) => (params: {
2944
+ tenantId: string;
2945
+ }) => Promise<number>;
2946
+ /**
2947
+ * Get a single project by ID
2948
+ */
2949
+ declare const getProject: (db: DatabaseClient) => (params: {
2950
+ scopes: ScopeConfig;
2951
+ }) => Promise<ProjectSelect | null>;
2952
+ /**
2953
+ * Create a new project
2954
+ */
2955
+ declare const createProject: (db: DatabaseClient) => (params: ProjectInsert) => Promise<ProjectSelect>;
2956
+ /**
2957
+ * Update an existing project
2958
+ */
2959
+ declare const updateProject: (db: DatabaseClient) => (params: {
2960
+ scopes: ScopeConfig;
2961
+ data: ProjectUpdate;
2962
+ }) => Promise<ProjectSelect | null>;
2963
+ /**
2964
+ * Check if a project exists in the projects table
2965
+ */
2966
+ declare const projectExistsInTable: (db: DatabaseClient) => (params: {
2967
+ scopes: ScopeConfig;
2968
+ }) => Promise<boolean>;
2969
+ /**
2970
+ * Check if a project has any resources (used before deletion)
2971
+ */
2972
+ declare const projectHasResources: (db: DatabaseClient) => (params: ScopeConfig) => Promise<boolean>;
2973
+ /**
2974
+ * Delete a project (with validation for existing resources)
2975
+ */
2976
+ declare const deleteProject: (db: DatabaseClient) => (params: {
2977
+ scopes: ScopeConfig;
2978
+ }) => Promise<boolean>;
2979
+
2980
+ declare const createTask: (db: DatabaseClient) => (params: TaskInsert) => Promise<{
2981
+ tenantId: string;
2982
+ projectId: string;
2983
+ id: string;
2984
+ createdAt: string;
2985
+ updatedAt: string;
2986
+ metadata: TaskMetadataConfig | null;
2987
+ status: string;
2988
+ contextId: string;
2989
+ agentId: string;
2990
+ }>;
2991
+ declare const getTask: (db: DatabaseClient) => (params: {
2992
+ id: string;
2993
+ }) => Promise<TaskSelect | null>;
2994
+ declare const updateTask: (db: DatabaseClient) => (params: {
2995
+ taskId: string;
2996
+ data: {
2997
+ status?: string;
2998
+ metadata?: any;
2999
+ };
3000
+ }) => Promise<{
3001
+ tenantId: string;
3002
+ projectId: string;
3003
+ id: string;
3004
+ createdAt: string;
3005
+ updatedAt: string;
3006
+ metadata: TaskMetadataConfig | null;
3007
+ status: string;
3008
+ contextId: string;
3009
+ agentId: string;
3010
+ }>;
3011
+ declare const listTaskIdsByContextId: (db: DatabaseClient) => (params: {
3012
+ contextId: string;
3013
+ }) => Promise<string[]>;
3014
+
3015
+ declare const dbResultToMcpTool: (dbResult: ToolSelect) => McpTool;
3016
+ declare const getToolById: (db: DatabaseClient) => (params: {
3017
+ scopes: ScopeConfig;
3018
+ toolId: string;
3019
+ }) => Promise<{
3020
+ tenantId: string;
3021
+ projectId: string;
3022
+ id: string;
3023
+ name: string;
3024
+ config: {
3025
+ type: "mcp";
3026
+ mcp: ToolMcpConfig;
3027
+ };
3028
+ credentialReferenceId: string | null;
3029
+ createdAt: string;
3030
+ updatedAt: string;
3031
+ headers: Record<string, string> | null;
3032
+ status: string;
3033
+ capabilities: ToolServerCapabilities | null;
3034
+ imageUrl: string | null;
3035
+ lastHealthCheck: string | null;
3036
+ lastError: string | null;
3037
+ availableTools: McpToolDefinition[] | null;
3038
+ lastToolsSync: string | null;
3039
+ } | null>;
3040
+ declare const listTools: (db: DatabaseClient) => (params: {
3041
+ scopes: ScopeConfig;
3042
+ pagination?: PaginationConfig;
3043
+ }) => Promise<{
3044
+ data: {
3045
+ tenantId: string;
3046
+ projectId: string;
3047
+ id: string;
3048
+ name: string;
3049
+ config: {
3050
+ type: "mcp";
3051
+ mcp: ToolMcpConfig;
3052
+ };
3053
+ credentialReferenceId: string | null;
3054
+ headers: Record<string, string> | null;
3055
+ imageUrl: string | null;
3056
+ capabilities: ToolServerCapabilities | null;
3057
+ status: string;
3058
+ lastHealthCheck: string | null;
3059
+ lastError: string | null;
3060
+ availableTools: McpToolDefinition[] | null;
3061
+ lastToolsSync: string | null;
3062
+ createdAt: string;
3063
+ updatedAt: string;
3064
+ }[];
3065
+ pagination: {
3066
+ page: number;
3067
+ limit: number;
3068
+ total: number;
3069
+ pages: number;
3070
+ };
3071
+ }>;
3072
+ declare const getToolsByStatus: (db: DatabaseClient) => (params: {
3073
+ scopes: ScopeConfig;
3074
+ status: string;
3075
+ }) => Promise<{
3076
+ tenantId: string;
3077
+ projectId: string;
3078
+ id: string;
3079
+ name: string;
3080
+ config: {
3081
+ type: "mcp";
3082
+ mcp: ToolMcpConfig;
3083
+ };
3084
+ credentialReferenceId: string | null;
3085
+ headers: Record<string, string> | null;
3086
+ imageUrl: string | null;
3087
+ capabilities: ToolServerCapabilities | null;
3088
+ status: string;
3089
+ lastHealthCheck: string | null;
3090
+ lastError: string | null;
3091
+ availableTools: McpToolDefinition[] | null;
3092
+ lastToolsSync: string | null;
3093
+ createdAt: string;
3094
+ updatedAt: string;
3095
+ }[]>;
3096
+ declare const listToolsByStatus: (db: DatabaseClient) => (params: {
3097
+ scopes: ScopeConfig;
3098
+ status: McpToolStatus;
3099
+ }) => Promise<{
3100
+ tenantId: string;
3101
+ projectId: string;
3102
+ id: string;
3103
+ name: string;
3104
+ config: {
3105
+ type: "mcp";
3106
+ mcp: ToolMcpConfig;
3107
+ };
3108
+ credentialReferenceId: string | null;
3109
+ createdAt: string;
3110
+ updatedAt: string;
3111
+ headers: Record<string, string> | null;
3112
+ status: string;
3113
+ capabilities: ToolServerCapabilities | null;
3114
+ imageUrl: string | null;
3115
+ lastHealthCheck: string | null;
3116
+ lastError: string | null;
3117
+ availableTools: McpToolDefinition[] | null;
3118
+ lastToolsSync: string | null;
3119
+ }[]>;
3120
+ declare const createTool: (db: DatabaseClient) => (params: ToolInsert) => Promise<{
3121
+ tenantId: string;
3122
+ projectId: string;
3123
+ id: string;
3124
+ name: string;
3125
+ config: {
3126
+ type: "mcp";
3127
+ mcp: ToolMcpConfig;
3128
+ };
3129
+ credentialReferenceId: string | null;
3130
+ createdAt: string;
3131
+ updatedAt: string;
3132
+ headers: Record<string, string> | null;
3133
+ status: string;
3134
+ capabilities: ToolServerCapabilities | null;
3135
+ imageUrl: string | null;
3136
+ lastHealthCheck: string | null;
3137
+ lastError: string | null;
3138
+ availableTools: McpToolDefinition[] | null;
3139
+ lastToolsSync: string | null;
3140
+ }>;
3141
+ declare const updateTool: (db: DatabaseClient) => (params: {
3142
+ scopes: ScopeConfig;
3143
+ toolId: string;
3144
+ data: ToolUpdate;
3145
+ }) => Promise<{
3146
+ tenantId: string;
3147
+ projectId: string;
3148
+ id: string;
3149
+ name: string;
3150
+ config: {
3151
+ type: "mcp";
3152
+ mcp: ToolMcpConfig;
3153
+ };
3154
+ credentialReferenceId: string | null;
3155
+ createdAt: string;
3156
+ updatedAt: string;
3157
+ headers: Record<string, string> | null;
3158
+ status: string;
3159
+ capabilities: ToolServerCapabilities | null;
3160
+ imageUrl: string | null;
3161
+ lastHealthCheck: string | null;
3162
+ lastError: string | null;
3163
+ availableTools: McpToolDefinition[] | null;
3164
+ lastToolsSync: string | null;
3165
+ }>;
3166
+ declare const deleteTool: (db: DatabaseClient) => (params: {
3167
+ scopes: ScopeConfig;
3168
+ toolId: string;
3169
+ }) => Promise<boolean>;
3170
+ declare const addToolToAgent: (db: DatabaseClient) => (params: {
3171
+ scopes: ScopeConfig;
3172
+ agentId: string;
3173
+ toolId: string;
3174
+ selectedTools?: string[] | null;
3175
+ }) => Promise<{
3176
+ tenantId: string;
3177
+ projectId: string;
3178
+ id: string;
3179
+ createdAt: string;
3180
+ updatedAt: string;
3181
+ selectedTools: string[] | null;
3182
+ agentId: string;
3183
+ toolId: string;
3184
+ }>;
3185
+ declare const removeToolFromAgent: (db: DatabaseClient) => (params: {
3186
+ scopes: ScopeConfig;
3187
+ agentId: string;
3188
+ toolId: string;
3189
+ }) => Promise<{
3190
+ tenantId: string;
3191
+ projectId: string;
3192
+ id: string;
3193
+ createdAt: string;
3194
+ updatedAt: string;
3195
+ selectedTools: string[] | null;
3196
+ agentId: string;
3197
+ toolId: string;
3198
+ }>;
3199
+ /**
3200
+ * Upsert agent-tool relation (create if it doesn't exist, update if it does)
3201
+ */
3202
+ declare const upsertAgentToolRelation: (db: DatabaseClient) => (params: {
3203
+ scopes: ScopeConfig;
3204
+ agentId: string;
3205
+ toolId: string;
3206
+ selectedTools?: string[] | null;
3207
+ }) => Promise<{
3208
+ tenantId: string;
3209
+ projectId: string;
3210
+ id: string;
3211
+ createdAt: string;
3212
+ updatedAt: string;
3213
+ selectedTools: string[] | null;
3214
+ agentId: string;
3215
+ toolId: string;
3216
+ }>;
3217
+ declare const updateToolStatus: (db: DatabaseClient) => (params: {
3218
+ scopes: ScopeConfig;
3219
+ toolId: string;
3220
+ status: string;
3221
+ lastHealthCheck?: string;
3222
+ lastError?: string;
3223
+ }) => Promise<{
3224
+ tenantId: string;
3225
+ projectId: string;
3226
+ id: string;
3227
+ name: string;
3228
+ config: {
3229
+ type: "mcp";
3230
+ mcp: ToolMcpConfig;
3231
+ };
3232
+ credentialReferenceId: string | null;
3233
+ createdAt: string;
3234
+ updatedAt: string;
3235
+ headers: Record<string, string> | null;
3236
+ status: string;
3237
+ capabilities: ToolServerCapabilities | null;
3238
+ imageUrl: string | null;
3239
+ lastHealthCheck: string | null;
3240
+ lastError: string | null;
3241
+ availableTools: McpToolDefinition[] | null;
3242
+ lastToolsSync: string | null;
3243
+ }>;
3244
+ /**
3245
+ * Upsert a tool (create if it doesn't exist, update if it does)
3246
+ */
3247
+ declare const upsertTool: (db: DatabaseClient) => (params: {
3248
+ data: ToolInsert;
3249
+ }) => Promise<{
3250
+ tenantId: string;
3251
+ projectId: string;
3252
+ id: string;
3253
+ name: string;
3254
+ config: {
3255
+ type: "mcp";
3256
+ mcp: ToolMcpConfig;
3257
+ };
3258
+ credentialReferenceId: string | null;
3259
+ createdAt: string;
3260
+ updatedAt: string;
3261
+ headers: Record<string, string> | null;
3262
+ status: string;
3263
+ capabilities: ToolServerCapabilities | null;
3264
+ imageUrl: string | null;
3265
+ lastHealthCheck: string | null;
3266
+ lastError: string | null;
3267
+ availableTools: McpToolDefinition[] | null;
3268
+ lastToolsSync: string | null;
3269
+ }>;
3270
+ declare const getHealthyToolsForAgent: (db: DatabaseClient) => (params: {
3271
+ scopes: ScopeConfig;
3272
+ agentId: string;
3273
+ }) => Promise<{
3274
+ tenantId: string;
3275
+ projectId: string;
3276
+ id: string;
3277
+ name: string;
3278
+ config: {
3279
+ type: "mcp";
3280
+ mcp: ToolMcpConfig;
3281
+ };
3282
+ credentialReferenceId: string | null;
3283
+ headers: Record<string, string> | null;
3284
+ imageUrl: string | null;
3285
+ capabilities: ToolServerCapabilities | null;
3286
+ status: string;
3287
+ lastHealthCheck: string | null;
3288
+ lastError: string | null;
3289
+ availableTools: McpToolDefinition[] | null;
3290
+ lastToolsSync: string | null;
3291
+ createdAt: string;
3292
+ updatedAt: string;
3293
+ }[]>;
3294
+
3295
+ /**
3296
+ * Validates that a project exists before performing database operations
3297
+ * This provides runtime validation even when foreign key constraints are not enforced
3298
+ */
3299
+ declare const validateProjectExists: (db: DatabaseClient, tenantId: string, projectId: string) => Promise<void>;
3300
+ /**
3301
+ * Wraps a database operation with project validation
3302
+ * Ensures the project exists before executing the operation
3303
+ */
3304
+ declare const withProjectValidation: <T extends (...args: any[]) => Promise<any>>(db: DatabaseClient, operation: T) => (params: Parameters<T>[0]) => Promise<ReturnType<T>>;
3305
+ /**
3306
+ * Creates a validated version of data access functions
3307
+ * Automatically adds project validation to insert/update operations
3308
+ */
3309
+ declare const createValidatedDataAccess: <T extends Record<string, any>>(db: DatabaseClient, dataAccessFunctions: T) => T;
3310
+
3311
+ declare const HTTP_REQUEST_PARTS: readonly ["headers"];
3312
+ type HttpRequestPart = (typeof HTTP_REQUEST_PARTS)[number];
3313
+ interface ContextValidationError {
3314
+ field: string;
3315
+ message: string;
3316
+ value?: unknown;
3317
+ }
3318
+ interface ContextValidationResult {
3319
+ valid: boolean;
3320
+ errors: ContextValidationError[];
3321
+ validatedContext?: Record<string, unknown> | ParsedHttpRequest;
3322
+ }
3323
+ interface ParsedHttpRequest {
3324
+ headers?: Record<string, string>;
3325
+ }
3326
+ declare function isValidHttpRequest(obj: any): obj is ParsedHttpRequest;
3327
+ declare function getCachedValidator(schema: Record<string, unknown>): ValidateFunction;
3328
+ declare function validationHelper(jsonSchema: Record<string, unknown>): ValidateFunction<unknown>;
3329
+ declare function validateAgainstJsonSchema(jsonSchema: Record<string, unknown>, context: unknown): boolean;
3330
+ /**
3331
+ * Validates HTTP request headers against schema
3332
+ */
3333
+ declare function validateHttpRequestHeaders(headersSchema: any, httpRequest: ParsedHttpRequest): Promise<ContextValidationResult>;
3334
+ /**
3335
+ * Validates request context against the JSON Schema stored in context configuration
3336
+ * Supports both legacy simple schemas and new comprehensive HTTP request schemas
3337
+ */
3338
+ declare function validateRequestContext({ tenantId, projectId, graphId, conversationId, parsedRequest, dbClient, credentialStores, }: {
3339
+ tenantId: string;
3340
+ projectId: string;
3341
+ graphId: string;
3342
+ conversationId: string;
3343
+ parsedRequest: ParsedHttpRequest;
3344
+ dbClient: DatabaseClient;
3345
+ credentialStores?: CredentialStoreRegistry;
3346
+ }): Promise<ContextValidationResult>;
3347
+ /**
3348
+ * Hono middleware for context validation
3349
+ */
3350
+ declare function contextValidationMiddleware(dbClient: DatabaseClient): (c: Context, next: Next) => Promise<void | (Response & hono.TypedResponse<{
3351
+ error: string;
3352
+ details: {
3353
+ field: string;
3354
+ message: string;
3355
+ value?: undefined;
3356
+ }[];
3357
+ }, 400, "json">) | (Response & hono.TypedResponse<{
3358
+ error: string;
3359
+ message: string;
3360
+ }, 500, "json">)>;
3361
+
3362
+ type ApiKeyGenerationResult = {
3363
+ id: string;
3364
+ publicId: string;
3365
+ key: string;
3366
+ keyHash: string;
3367
+ keyPrefix: string;
3368
+ };
3369
+ /**
3370
+ * Generate a new API key with secure random bytes
3371
+ */
3372
+ declare function generateApiKey(): Promise<ApiKeyGenerationResult>;
3373
+ /**
3374
+ * Hash an API key using scrypt
3375
+ */
3376
+ declare function hashApiKey(key: string): Promise<string>;
3377
+ /**
3378
+ * Validate an API key against its hash
3379
+ */
3380
+ declare function validateApiKey(key: string, storedHash: string): Promise<boolean>;
3381
+ /**
3382
+ * Check if an API key has expired
3383
+ */
3384
+ declare function isApiKeyExpired(expiresAt?: string | null): boolean;
3385
+ /**
3386
+ * Extract the publicId from an API key
3387
+ */
3388
+ declare function extractPublicId(key: string): string | null;
3389
+ /**
3390
+ * Mask an API key for display (show only prefix and last 4 chars)
3391
+ */
3392
+ declare function maskApiKey(keyPrefix: string): string;
3393
+
3394
+ /**
3395
+ * Logger factory for core utilities package
3396
+ * Designed to work with Pino-style loggers and request context
3397
+ */
3398
+ interface Logger {
3399
+ debug: (obj: any, msg?: string) => void;
3400
+ info: (obj: any, msg?: string) => void;
3401
+ warn: (obj: any, msg?: string) => void;
3402
+ error: (obj: any, msg?: string) => void;
3403
+ }
3404
+
3405
+ /**
3406
+ * Centralized authentication detection utilities for MCP tools
3407
+ */
3408
+
3409
+ /**
3410
+ * OAuth configuration interface
3411
+ */
3412
+ interface OAuthConfig {
3413
+ authorizationUrl: string;
3414
+ tokenUrl: string;
3415
+ registrationUrl?: string;
3416
+ supportsDynamicRegistration: boolean;
3417
+ }
3418
+ /**
3419
+ * Full OAuth endpoint discovery with complete configuration
3420
+ */
3421
+ declare const discoverOAuthEndpoints: (serverUrl: string, logger?: Logger) => Promise<OAuthConfig | null>;
3422
+ /**
3423
+ * Detect if OAuth 2.1/PKCE authentication is specifically required for a tool
3424
+ */
3425
+ declare const detectAuthenticationRequired: (tool: McpTool, error: Error, logger?: Logger) => Promise<boolean>;
3426
+
3427
+ /**
3428
+ * Get a lookup key for a credential store from retrieval params
3429
+ * @param retrievalParams - The retrieval params for the credential store
3430
+ * @param credentialStoreType - The type of credential store
3431
+ * @returns A lookup key for the credential store, used to call <CredentialStore>.get()
3432
+ */
3433
+ declare function getCredentialStoreLookupKeyFromRetrievalParams({ retrievalParams, credentialStoreType, }: {
3434
+ retrievalParams: Record<string, unknown>;
3435
+ credentialStoreType: keyof typeof CredentialStoreType;
3436
+ }): string | null;
3437
+
3438
+ declare const ErrorCode: z$1.ZodEnum<{
3439
+ unauthorized: "unauthorized";
3440
+ bad_request: "bad_request";
3441
+ forbidden: "forbidden";
3442
+ not_found: "not_found";
3443
+ conflict: "conflict";
3444
+ internal_server_error: "internal_server_error";
3445
+ unprocessable_entity: "unprocessable_entity";
3446
+ }>;
3447
+ declare const ERROR_DOCS_BASE_URL = "https://docs.inkeep.com/agents-api/errors";
3448
+ declare const problemDetailsSchema: z$1.ZodObject<{
3449
+ title: z$1.ZodString;
3450
+ status: z$1.ZodNumber;
3451
+ detail: z$1.ZodString;
3452
+ instance: z$1.ZodOptional<z$1.ZodString>;
3453
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3454
+ code: z$1.ZodEnum<{
3455
+ unauthorized: "unauthorized";
3456
+ bad_request: "bad_request";
3457
+ forbidden: "forbidden";
3458
+ not_found: "not_found";
3459
+ conflict: "conflict";
3460
+ internal_server_error: "internal_server_error";
3461
+ unprocessable_entity: "unprocessable_entity";
3462
+ }>;
3463
+ }, z$1.core.$strip>;
3464
+ type ProblemDetails = z$1.infer<typeof problemDetailsSchema>;
3465
+ type ErrorCodes = z$1.infer<typeof ErrorCode>;
3466
+ declare const errorResponseSchema: z$1.ZodObject<{
3467
+ error: z$1.ZodObject<{
3468
+ code: z$1.ZodEnum<{
3469
+ unauthorized: "unauthorized";
3470
+ bad_request: "bad_request";
3471
+ forbidden: "forbidden";
3472
+ not_found: "not_found";
3473
+ conflict: "conflict";
3474
+ internal_server_error: "internal_server_error";
3475
+ unprocessable_entity: "unprocessable_entity";
3476
+ }>;
3477
+ message: z$1.ZodString;
3478
+ }, z$1.core.$strip>;
3479
+ }, z$1.core.$strip>;
3480
+ type ErrorResponse = z$1.infer<typeof errorResponseSchema>;
3481
+ declare function createApiError({ code, message, instance, requestId, }: {
3482
+ code: ErrorCodes;
3483
+ message: string;
3484
+ instance?: string;
3485
+ requestId?: string;
3486
+ }): HTTPException;
3487
+ declare function handleApiError(error: unknown, requestId?: string): Promise<ProblemDetails & {
3488
+ error: {
3489
+ code: ErrorCodes;
3490
+ message: string;
3491
+ };
3492
+ }>;
3493
+ declare const errorSchemaFactory: (code: ErrorCodes, description: string) => {
3494
+ description: string;
3495
+ content: {
3496
+ 'application/problem+json': {
3497
+ schema: z$1.ZodObject<{
3498
+ instance: z$1.ZodOptional<z$1.ZodString>;
3499
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3500
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3501
+ detail: z$1.ZodString;
3502
+ title: z$1.ZodString;
3503
+ status: z$1.ZodLiteral<number>;
3504
+ error: z$1.ZodObject<{
3505
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3506
+ message: z$1.ZodString;
3507
+ }, z$1.core.$strip>;
3508
+ }, z$1.core.$strip>;
3509
+ };
3510
+ };
3511
+ };
3512
+ declare const commonCreateErrorResponses: {
3513
+ readonly 400: {
3514
+ description: string;
3515
+ content: {
3516
+ 'application/problem+json': {
3517
+ schema: z$1.ZodObject<{
3518
+ instance: z$1.ZodOptional<z$1.ZodString>;
3519
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3520
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3521
+ detail: z$1.ZodString;
3522
+ title: z$1.ZodString;
3523
+ status: z$1.ZodLiteral<number>;
3524
+ error: z$1.ZodObject<{
3525
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3526
+ message: z$1.ZodString;
3527
+ }, z$1.core.$strip>;
3528
+ }, z$1.core.$strip>;
3529
+ };
3530
+ };
3531
+ };
3532
+ readonly 401: {
3533
+ description: string;
3534
+ content: {
3535
+ 'application/problem+json': {
3536
+ schema: z$1.ZodObject<{
3537
+ instance: z$1.ZodOptional<z$1.ZodString>;
3538
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3539
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3540
+ detail: z$1.ZodString;
3541
+ title: z$1.ZodString;
3542
+ status: z$1.ZodLiteral<number>;
3543
+ error: z$1.ZodObject<{
3544
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3545
+ message: z$1.ZodString;
3546
+ }, z$1.core.$strip>;
3547
+ }, z$1.core.$strip>;
3548
+ };
3549
+ };
3550
+ };
3551
+ readonly 403: {
3552
+ description: string;
3553
+ content: {
3554
+ 'application/problem+json': {
3555
+ schema: z$1.ZodObject<{
3556
+ instance: z$1.ZodOptional<z$1.ZodString>;
3557
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3558
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3559
+ detail: z$1.ZodString;
3560
+ title: z$1.ZodString;
3561
+ status: z$1.ZodLiteral<number>;
3562
+ error: z$1.ZodObject<{
3563
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3564
+ message: z$1.ZodString;
3565
+ }, z$1.core.$strip>;
3566
+ }, z$1.core.$strip>;
3567
+ };
3568
+ };
3569
+ };
3570
+ readonly 422: {
3571
+ description: string;
3572
+ content: {
3573
+ 'application/problem+json': {
3574
+ schema: z$1.ZodObject<{
3575
+ instance: z$1.ZodOptional<z$1.ZodString>;
3576
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3577
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3578
+ detail: z$1.ZodString;
3579
+ title: z$1.ZodString;
3580
+ status: z$1.ZodLiteral<number>;
3581
+ error: z$1.ZodObject<{
3582
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3583
+ message: z$1.ZodString;
3584
+ }, z$1.core.$strip>;
3585
+ }, z$1.core.$strip>;
3586
+ };
3587
+ };
3588
+ };
3589
+ readonly 500: {
3590
+ description: string;
3591
+ content: {
3592
+ 'application/problem+json': {
3593
+ schema: z$1.ZodObject<{
3594
+ instance: z$1.ZodOptional<z$1.ZodString>;
3595
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3596
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3597
+ detail: z$1.ZodString;
3598
+ title: z$1.ZodString;
3599
+ status: z$1.ZodLiteral<number>;
3600
+ error: z$1.ZodObject<{
3601
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3602
+ message: z$1.ZodString;
3603
+ }, z$1.core.$strip>;
3604
+ }, z$1.core.$strip>;
3605
+ };
3606
+ };
3607
+ };
3608
+ };
3609
+ declare const commonUpdateErrorResponses: {
3610
+ readonly 400: {
3611
+ description: string;
3612
+ content: {
3613
+ 'application/problem+json': {
3614
+ schema: z$1.ZodObject<{
3615
+ instance: z$1.ZodOptional<z$1.ZodString>;
3616
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3617
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3618
+ detail: z$1.ZodString;
3619
+ title: z$1.ZodString;
3620
+ status: z$1.ZodLiteral<number>;
3621
+ error: z$1.ZodObject<{
3622
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3623
+ message: z$1.ZodString;
3624
+ }, z$1.core.$strip>;
3625
+ }, z$1.core.$strip>;
3626
+ };
3627
+ };
3628
+ };
3629
+ readonly 401: {
3630
+ description: string;
3631
+ content: {
3632
+ 'application/problem+json': {
3633
+ schema: z$1.ZodObject<{
3634
+ instance: z$1.ZodOptional<z$1.ZodString>;
3635
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3636
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3637
+ detail: z$1.ZodString;
3638
+ title: z$1.ZodString;
3639
+ status: z$1.ZodLiteral<number>;
3640
+ error: z$1.ZodObject<{
3641
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3642
+ message: z$1.ZodString;
3643
+ }, z$1.core.$strip>;
3644
+ }, z$1.core.$strip>;
3645
+ };
3646
+ };
3647
+ };
3648
+ readonly 403: {
3649
+ description: string;
3650
+ content: {
3651
+ 'application/problem+json': {
3652
+ schema: z$1.ZodObject<{
3653
+ instance: z$1.ZodOptional<z$1.ZodString>;
3654
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3655
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3656
+ detail: z$1.ZodString;
3657
+ title: z$1.ZodString;
3658
+ status: z$1.ZodLiteral<number>;
3659
+ error: z$1.ZodObject<{
3660
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3661
+ message: z$1.ZodString;
3662
+ }, z$1.core.$strip>;
3663
+ }, z$1.core.$strip>;
3664
+ };
3665
+ };
3666
+ };
3667
+ readonly 404: {
3668
+ description: string;
3669
+ content: {
3670
+ 'application/problem+json': {
3671
+ schema: z$1.ZodObject<{
3672
+ instance: z$1.ZodOptional<z$1.ZodString>;
3673
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3674
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3675
+ detail: z$1.ZodString;
3676
+ title: z$1.ZodString;
3677
+ status: z$1.ZodLiteral<number>;
3678
+ error: z$1.ZodObject<{
3679
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3680
+ message: z$1.ZodString;
3681
+ }, z$1.core.$strip>;
3682
+ }, z$1.core.$strip>;
3683
+ };
3684
+ };
3685
+ };
3686
+ readonly 422: {
3687
+ description: string;
3688
+ content: {
3689
+ 'application/problem+json': {
3690
+ schema: z$1.ZodObject<{
3691
+ instance: z$1.ZodOptional<z$1.ZodString>;
3692
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3693
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3694
+ detail: z$1.ZodString;
3695
+ title: z$1.ZodString;
3696
+ status: z$1.ZodLiteral<number>;
3697
+ error: z$1.ZodObject<{
3698
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3699
+ message: z$1.ZodString;
3700
+ }, z$1.core.$strip>;
3701
+ }, z$1.core.$strip>;
3702
+ };
3703
+ };
3704
+ };
3705
+ readonly 500: {
3706
+ description: string;
3707
+ content: {
3708
+ 'application/problem+json': {
3709
+ schema: z$1.ZodObject<{
3710
+ instance: z$1.ZodOptional<z$1.ZodString>;
3711
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3712
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3713
+ detail: z$1.ZodString;
3714
+ title: z$1.ZodString;
3715
+ status: z$1.ZodLiteral<number>;
3716
+ error: z$1.ZodObject<{
3717
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3718
+ message: z$1.ZodString;
3719
+ }, z$1.core.$strip>;
3720
+ }, z$1.core.$strip>;
3721
+ };
3722
+ };
3723
+ };
3724
+ };
3725
+ declare const commonGetErrorResponses: {
3726
+ readonly 400: {
3727
+ description: string;
3728
+ content: {
3729
+ 'application/problem+json': {
3730
+ schema: z$1.ZodObject<{
3731
+ instance: z$1.ZodOptional<z$1.ZodString>;
3732
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3733
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3734
+ detail: z$1.ZodString;
3735
+ title: z$1.ZodString;
3736
+ status: z$1.ZodLiteral<number>;
3737
+ error: z$1.ZodObject<{
3738
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3739
+ message: z$1.ZodString;
3740
+ }, z$1.core.$strip>;
3741
+ }, z$1.core.$strip>;
3742
+ };
3743
+ };
3744
+ };
3745
+ readonly 401: {
3746
+ description: string;
3747
+ content: {
3748
+ 'application/problem+json': {
3749
+ schema: z$1.ZodObject<{
3750
+ instance: z$1.ZodOptional<z$1.ZodString>;
3751
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3752
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3753
+ detail: z$1.ZodString;
3754
+ title: z$1.ZodString;
3755
+ status: z$1.ZodLiteral<number>;
3756
+ error: z$1.ZodObject<{
3757
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3758
+ message: z$1.ZodString;
3759
+ }, z$1.core.$strip>;
3760
+ }, z$1.core.$strip>;
3761
+ };
3762
+ };
3763
+ };
3764
+ readonly 403: {
3765
+ description: string;
3766
+ content: {
3767
+ 'application/problem+json': {
3768
+ schema: z$1.ZodObject<{
3769
+ instance: z$1.ZodOptional<z$1.ZodString>;
3770
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3771
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3772
+ detail: z$1.ZodString;
3773
+ title: z$1.ZodString;
3774
+ status: z$1.ZodLiteral<number>;
3775
+ error: z$1.ZodObject<{
3776
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3777
+ message: z$1.ZodString;
3778
+ }, z$1.core.$strip>;
3779
+ }, z$1.core.$strip>;
3780
+ };
3781
+ };
3782
+ };
3783
+ readonly 404: {
3784
+ description: string;
3785
+ content: {
3786
+ 'application/problem+json': {
3787
+ schema: z$1.ZodObject<{
3788
+ instance: z$1.ZodOptional<z$1.ZodString>;
3789
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3790
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3791
+ detail: z$1.ZodString;
3792
+ title: z$1.ZodString;
3793
+ status: z$1.ZodLiteral<number>;
3794
+ error: z$1.ZodObject<{
3795
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3796
+ message: z$1.ZodString;
3797
+ }, z$1.core.$strip>;
3798
+ }, z$1.core.$strip>;
3799
+ };
3800
+ };
3801
+ };
3802
+ readonly 422: {
3803
+ description: string;
3804
+ content: {
3805
+ 'application/problem+json': {
3806
+ schema: z$1.ZodObject<{
3807
+ instance: z$1.ZodOptional<z$1.ZodString>;
3808
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3809
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3810
+ detail: z$1.ZodString;
3811
+ title: z$1.ZodString;
3812
+ status: z$1.ZodLiteral<number>;
3813
+ error: z$1.ZodObject<{
3814
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3815
+ message: z$1.ZodString;
3816
+ }, z$1.core.$strip>;
3817
+ }, z$1.core.$strip>;
3818
+ };
3819
+ };
3820
+ };
3821
+ readonly 500: {
3822
+ description: string;
3823
+ content: {
3824
+ 'application/problem+json': {
3825
+ schema: z$1.ZodObject<{
3826
+ instance: z$1.ZodOptional<z$1.ZodString>;
3827
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3828
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3829
+ detail: z$1.ZodString;
3830
+ title: z$1.ZodString;
3831
+ status: z$1.ZodLiteral<number>;
3832
+ error: z$1.ZodObject<{
3833
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3834
+ message: z$1.ZodString;
3835
+ }, z$1.core.$strip>;
3836
+ }, z$1.core.$strip>;
3837
+ };
3838
+ };
3839
+ };
3840
+ };
3841
+ declare const commonDeleteErrorResponses: {
3842
+ readonly 400: {
3843
+ description: string;
3844
+ content: {
3845
+ 'application/problem+json': {
3846
+ schema: z$1.ZodObject<{
3847
+ instance: z$1.ZodOptional<z$1.ZodString>;
3848
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3849
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3850
+ detail: z$1.ZodString;
3851
+ title: z$1.ZodString;
3852
+ status: z$1.ZodLiteral<number>;
3853
+ error: z$1.ZodObject<{
3854
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3855
+ message: z$1.ZodString;
3856
+ }, z$1.core.$strip>;
3857
+ }, z$1.core.$strip>;
3858
+ };
3859
+ };
3860
+ };
3861
+ readonly 401: {
3862
+ description: string;
3863
+ content: {
3864
+ 'application/problem+json': {
3865
+ schema: z$1.ZodObject<{
3866
+ instance: z$1.ZodOptional<z$1.ZodString>;
3867
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3868
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3869
+ detail: z$1.ZodString;
3870
+ title: z$1.ZodString;
3871
+ status: z$1.ZodLiteral<number>;
3872
+ error: z$1.ZodObject<{
3873
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3874
+ message: z$1.ZodString;
3875
+ }, z$1.core.$strip>;
3876
+ }, z$1.core.$strip>;
3877
+ };
3878
+ };
3879
+ };
3880
+ readonly 403: {
3881
+ description: string;
3882
+ content: {
3883
+ 'application/problem+json': {
3884
+ schema: z$1.ZodObject<{
3885
+ instance: z$1.ZodOptional<z$1.ZodString>;
3886
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3887
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3888
+ detail: z$1.ZodString;
3889
+ title: z$1.ZodString;
3890
+ status: z$1.ZodLiteral<number>;
3891
+ error: z$1.ZodObject<{
3892
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3893
+ message: z$1.ZodString;
3894
+ }, z$1.core.$strip>;
3895
+ }, z$1.core.$strip>;
3896
+ };
3897
+ };
3898
+ };
3899
+ readonly 404: {
3900
+ description: string;
3901
+ content: {
3902
+ 'application/problem+json': {
3903
+ schema: z$1.ZodObject<{
3904
+ instance: z$1.ZodOptional<z$1.ZodString>;
3905
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3906
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3907
+ detail: z$1.ZodString;
3908
+ title: z$1.ZodString;
3909
+ status: z$1.ZodLiteral<number>;
3910
+ error: z$1.ZodObject<{
3911
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3912
+ message: z$1.ZodString;
3913
+ }, z$1.core.$strip>;
3914
+ }, z$1.core.$strip>;
3915
+ };
3916
+ };
3917
+ };
3918
+ readonly 422: {
3919
+ description: string;
3920
+ content: {
3921
+ 'application/problem+json': {
3922
+ schema: z$1.ZodObject<{
3923
+ instance: z$1.ZodOptional<z$1.ZodString>;
3924
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3925
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3926
+ detail: z$1.ZodString;
3927
+ title: z$1.ZodString;
3928
+ status: z$1.ZodLiteral<number>;
3929
+ error: z$1.ZodObject<{
3930
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3931
+ message: z$1.ZodString;
3932
+ }, z$1.core.$strip>;
3933
+ }, z$1.core.$strip>;
3934
+ };
3935
+ };
3936
+ };
3937
+ readonly 500: {
3938
+ description: string;
3939
+ content: {
3940
+ 'application/problem+json': {
3941
+ schema: z$1.ZodObject<{
3942
+ instance: z$1.ZodOptional<z$1.ZodString>;
3943
+ requestId: z$1.ZodOptional<z$1.ZodString>;
3944
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3945
+ detail: z$1.ZodString;
3946
+ title: z$1.ZodString;
3947
+ status: z$1.ZodLiteral<number>;
3948
+ error: z$1.ZodObject<{
3949
+ code: z$1.ZodLiteral<"unauthorized" | "bad_request" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
3950
+ message: z$1.ZodString;
3951
+ }, z$1.core.$strip>;
3952
+ }, z$1.core.$strip>;
3953
+ };
3954
+ };
3955
+ };
3956
+ };
3957
+ type CommonCreateErrorResponses = typeof commonCreateErrorResponses;
3958
+ type CommonUpdateErrorResponses = typeof commonUpdateErrorResponses;
3959
+ type CommonGetErrorResponses = typeof commonGetErrorResponses;
3960
+ type CommonDeleteErrorResponses = typeof commonDeleteErrorResponses;
3961
+
3962
+ /**
3963
+ * Create execution context from middleware values
3964
+ */
3965
+ declare function createExecutionContext(params: {
3966
+ apiKey: string;
3967
+ tenantId: string;
3968
+ projectId: string;
3969
+ graphId: string;
3970
+ apiKeyId: string;
3971
+ baseUrl?: string;
3972
+ }): ExecutionContext;
3973
+ /**
3974
+ * Get execution context from API key authentication
3975
+ */
3976
+ declare function getRequestExecutionContext(c: Context): ExecutionContext;
3977
+
3978
+ /**
3979
+ * Helper function to handle span errors consistently
3980
+ * Records the exception, sets error status, and optionally logs
3981
+ */
3982
+ declare function setSpanWithError(span: Span, error: unknown, logger?: {
3983
+ error: (obj: any, msg?: string) => void;
3984
+ }, logMessage?: string): void;
3985
+ /**
3986
+ * Get a tracer instance for the specified service
3987
+ * Returns a no-op tracer if OpenTelemetry is not available
3988
+ */
3989
+ declare function getTracer(serviceName: string, serviceVersion?: string): Tracer;
3990
+
3991
+ export { AgentGraphInsert, AgentGraphUpdate, AgentInsert, AgentRelationInsert, AgentRelationUpdate, AgentSelect, AgentToolRelationUpdate, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, type CommonCreateErrorResponses, type CommonDeleteErrorResponses, type CommonGetErrorResponses, type CommonUpdateErrorResponses, ConsoleLogger, 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, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, type CredentialReferenceWithTools, type CredentialResolverInput, CredentialStore, type CredentialStoreReference, CredentialStoreRegistry, CredentialStoreType, CredentialStuffer, DataComponentInsert, DataComponentSelect, DataComponentUpdate, type DatabaseClient, type DatabaseConfig, ERROR_DOCS_BASE_URL, ErrorCode, type ErrorCodes, type ErrorResponse, ExecutionContext, ExternalAgentInsert, ExternalAgentRelationInsert, ExternalAgentSelect, ExternalAgentUpdate, FetchDefinition, type FetchResult, FullGraphDefinition, type GraphLogger, HTTP_REQUEST_PARTS, type HttpRequestPart, InMemoryCredentialStore, KeyChainStore, LedgerArtifactSelect, type Logger$1 as Logger, type LoggerFactoryConfig, MCPToolConfig, MCPTransportType, McpClient, type McpClientOptions, type McpSSEConfig, type McpServerConfig, type McpStreamableHttpConfig, McpTool, McpToolDefinition, McpToolStatus, MessageContent, MessageInsert, MessageMetadata, MessageUpdate, MessageVisibility, NangoCredentialStore, NoOpLogger, type OAuthConfig, PaginationConfig, PaginationResult, type ParsedHttpRequest, type ProblemDetails, ProjectInfo, ProjectInsert, ProjectResourceCounts, ProjectSelect, ProjectUpdate, type ResolvedContext, ScopeConfig, TaskInsert, TaskMetadataConfig, TaskSelect, type TemplateContext, TemplateEngine, type TemplateRenderOptions, ToolInsert, ToolMcpConfig, ToolSelect, ToolServerCapabilities, ToolUpdate, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, configureLogging, 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, 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, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraph, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentInGraphContext, 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, getGraphAgentInfos, getHealthyToolsForAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsByStatus, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgentToolRelationsByAgent, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, listToolsByStatus, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateMessage, updateProject, updateTask, updateTool, updateToolStatus, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };