@inkeep/agents-core 0.0.0-dev-20250910233133 → 0.0.0-dev-20250910233441

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