@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
@@ -0,0 +1,1617 @@
1
+ 'use strict';
2
+
3
+ var zodOpenapi = require('@hono/zod-openapi');
4
+ var drizzleZod = require('drizzle-zod');
5
+ var drizzleOrm = require('drizzle-orm');
6
+ var sqliteCore = require('drizzle-orm/sqlite-core');
7
+
8
+ // src/validation/schemas.ts
9
+ var projects = sqliteCore.sqliteTable(
10
+ "projects",
11
+ {
12
+ tenantId: sqliteCore.text("tenant_id").notNull(),
13
+ id: sqliteCore.text("id").notNull(),
14
+ // This IS the project ID
15
+ name: sqliteCore.text("name").notNull(),
16
+ description: sqliteCore.text("description").notNull(),
17
+ // Project-level default model settingsuration that can be inherited by graphs and agents
18
+ models: sqliteCore.text("models", { mode: "json" }).$type(),
19
+ // Project-level stopWhen configuration that can be inherited by graphs and agents
20
+ stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
21
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
22
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
23
+ },
24
+ (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.id] })]
25
+ );
26
+ var contextConfigs = sqliteCore.sqliteTable(
27
+ "context_configs",
28
+ {
29
+ tenantId: sqliteCore.text("tenant_id").notNull(),
30
+ projectId: sqliteCore.text("project_id").notNull(),
31
+ id: sqliteCore.text("id").notNull(),
32
+ name: sqliteCore.text("name").notNull(),
33
+ description: sqliteCore.text("description").notNull(),
34
+ // Developer-defined Zod schema for validating incoming request context
35
+ requestContextSchema: sqliteCore.blob("request_context_schema", { mode: "json" }).$type(),
36
+ // Stores serialized Zod schema
37
+ // Object mapping template keys to fetch definitions that use request context data
38
+ contextVariables: sqliteCore.blob("context_variables", { mode: "json" }).$type(),
39
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
40
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
41
+ },
42
+ (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] })]
43
+ );
44
+ var contextCache = sqliteCore.sqliteTable(
45
+ "context_cache",
46
+ {
47
+ tenantId: sqliteCore.text("tenant_id").notNull(),
48
+ projectId: sqliteCore.text("project_id").notNull(),
49
+ id: sqliteCore.text("id").notNull(),
50
+ // Always scoped to conversation for complete data isolation
51
+ conversationId: sqliteCore.text("conversation_id").notNull(),
52
+ // Reference to the context config and specific fetch definition
53
+ contextConfigId: sqliteCore.text("context_config_id").notNull(),
54
+ contextVariableKey: sqliteCore.text("context_variable_key").notNull(),
55
+ // Key from contextVariables object
56
+ // The actual cached context data
57
+ value: sqliteCore.blob("value", { mode: "json" }).$type().notNull(),
58
+ // Request hash for cache invalidation based on context changes
59
+ requestHash: sqliteCore.text("request_hash"),
60
+ // Hash of request context that triggered this cache
61
+ // Metadata for monitoring and debugging
62
+ fetchedAt: sqliteCore.text("fetched_at").notNull(),
63
+ fetchSource: sqliteCore.text("fetch_source"),
64
+ // URL or source identifier
65
+ fetchDurationMs: sqliteCore.integer("fetch_duration_ms"),
66
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
67
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
68
+ },
69
+ (table) => [
70
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
71
+ sqliteCore.index("context_cache_lookup_idx").on(
72
+ table.conversationId,
73
+ table.contextConfigId,
74
+ table.contextVariableKey
75
+ )
76
+ ]
77
+ );
78
+ var agents = sqliteCore.sqliteTable(
79
+ "agents",
80
+ {
81
+ tenantId: sqliteCore.text("tenant_id").notNull(),
82
+ projectId: sqliteCore.text("project_id").notNull(),
83
+ id: sqliteCore.text("id").notNull(),
84
+ name: sqliteCore.text("name").notNull(),
85
+ description: sqliteCore.text("description").notNull(),
86
+ prompt: sqliteCore.text("prompt").notNull(),
87
+ conversationHistoryConfig: sqliteCore.text("conversation_history_config", {
88
+ mode: "json"
89
+ }).$type(),
90
+ models: sqliteCore.text("models", { mode: "json" }).$type(),
91
+ // Agent-level stopWhen configuration (inherited from project)
92
+ stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
93
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
94
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
95
+ },
96
+ (table) => [
97
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
98
+ sqliteCore.foreignKey({
99
+ columns: [table.tenantId, table.projectId],
100
+ foreignColumns: [projects.tenantId, projects.id],
101
+ name: "agents_project_fk"
102
+ })
103
+ ]
104
+ );
105
+ var agentRelations = sqliteCore.sqliteTable(
106
+ "agent_relations",
107
+ {
108
+ tenantId: sqliteCore.text("tenant_id").notNull(),
109
+ projectId: sqliteCore.text("project_id").notNull(),
110
+ id: sqliteCore.text("id").notNull(),
111
+ graphId: sqliteCore.text("graph_id").notNull(),
112
+ sourceAgentId: sqliteCore.text("source_agent_id").notNull(),
113
+ // For internal relationships
114
+ targetAgentId: sqliteCore.text("target_agent_id"),
115
+ // For external relationships
116
+ externalAgentId: sqliteCore.text("external_agent_id"),
117
+ relationType: sqliteCore.text("relation_type"),
118
+ // 'transfer' | 'delegate'
119
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
120
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
121
+ },
122
+ (table) => [
123
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
124
+ sqliteCore.foreignKey({
125
+ columns: [table.tenantId, table.projectId],
126
+ foreignColumns: [projects.tenantId, projects.id],
127
+ name: "agent_relations_project_fk"
128
+ })
129
+ ]
130
+ );
131
+ var externalAgents = sqliteCore.sqliteTable(
132
+ "external_agents",
133
+ {
134
+ tenantId: sqliteCore.text("tenant_id").notNull(),
135
+ projectId: sqliteCore.text("project_id").notNull(),
136
+ id: sqliteCore.text("id").notNull(),
137
+ name: sqliteCore.text("name").notNull(),
138
+ description: sqliteCore.text("description").notNull(),
139
+ baseUrl: sqliteCore.text("base_url").notNull(),
140
+ // A2A endpoint URL
141
+ credentialReferenceId: sqliteCore.text("credential_reference_id"),
142
+ headers: sqliteCore.blob("headers", { mode: "json" }).$type(),
143
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
144
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
145
+ },
146
+ (table) => [
147
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
148
+ sqliteCore.foreignKey({
149
+ columns: [table.tenantId, table.projectId, table.credentialReferenceId],
150
+ foreignColumns: [
151
+ credentialReferences.tenantId,
152
+ credentialReferences.projectId,
153
+ credentialReferences.id
154
+ ],
155
+ name: "external_agents_credential_reference_fk"
156
+ }).onDelete("set null")
157
+ ]
158
+ );
159
+ var agentGraph = sqliteCore.sqliteTable(
160
+ "agent_graph",
161
+ {
162
+ tenantId: sqliteCore.text("tenant_id").notNull(),
163
+ projectId: sqliteCore.text("project_id").notNull(),
164
+ id: sqliteCore.text("id").notNull(),
165
+ name: sqliteCore.text("name").notNull(),
166
+ description: sqliteCore.text("description"),
167
+ defaultAgentId: sqliteCore.text("default_agent_id").notNull(),
168
+ // Reference to shared context configuration for all agents in this graph
169
+ contextConfigId: sqliteCore.text("context_config_id"),
170
+ // Graph-level model settingsuration that can be inherited by agents
171
+ models: sqliteCore.text("models", { mode: "json" }).$type(),
172
+ // Status updates configuration for intelligent progress summaries
173
+ statusUpdates: sqliteCore.text("status_updates", { mode: "json" }).$type(),
174
+ // Graph-level prompt that can be used as additional context for agents
175
+ graphPrompt: sqliteCore.text("graph_prompt"),
176
+ // Graph-level stopWhen configuration that can be inherited by agents
177
+ stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
178
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
179
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
180
+ },
181
+ (table) => [
182
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
183
+ sqliteCore.foreignKey({
184
+ columns: [table.tenantId, table.projectId],
185
+ foreignColumns: [projects.tenantId, projects.id],
186
+ name: "agent_graph_project_fk"
187
+ })
188
+ ]
189
+ );
190
+ var tasks = sqliteCore.sqliteTable(
191
+ "tasks",
192
+ {
193
+ tenantId: sqliteCore.text("tenant_id").notNull(),
194
+ projectId: sqliteCore.text("project_id").notNull(),
195
+ id: sqliteCore.text("id").notNull(),
196
+ contextId: sqliteCore.text("context_id").notNull(),
197
+ status: sqliteCore.text("status").notNull(),
198
+ metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
199
+ agentId: sqliteCore.text("agent_id").notNull(),
200
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
201
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
202
+ },
203
+ (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] })]
204
+ );
205
+ var taskRelations = sqliteCore.sqliteTable(
206
+ "task_relations",
207
+ {
208
+ tenantId: sqliteCore.text("tenant_id").notNull(),
209
+ projectId: sqliteCore.text("project_id").notNull(),
210
+ id: sqliteCore.text("id").notNull(),
211
+ parentTaskId: sqliteCore.text("parent_task_id").notNull(),
212
+ childTaskId: sqliteCore.text("child_task_id").notNull(),
213
+ relationType: sqliteCore.text("relation_type").default("parent_child"),
214
+ // Could be extended for other relation types
215
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
216
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
217
+ },
218
+ (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] })]
219
+ );
220
+ var dataComponents = sqliteCore.sqliteTable(
221
+ "data_components",
222
+ {
223
+ tenantId: sqliteCore.text("tenant_id").notNull(),
224
+ projectId: sqliteCore.text("project_id").notNull(),
225
+ id: sqliteCore.text("id").notNull(),
226
+ name: sqliteCore.text("name").notNull(),
227
+ description: sqliteCore.text("description").notNull(),
228
+ props: sqliteCore.blob("props", { mode: "json" }).$type(),
229
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
230
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
231
+ },
232
+ (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] })]
233
+ );
234
+ var agentDataComponents = sqliteCore.sqliteTable(
235
+ "agent_data_components",
236
+ {
237
+ tenantId: sqliteCore.text("tenant_id").notNull(),
238
+ projectId: sqliteCore.text("project_id").notNull(),
239
+ id: sqliteCore.text("id").notNull(),
240
+ agentId: sqliteCore.text("agent_id").notNull(),
241
+ dataComponentId: sqliteCore.text("data_component_id").notNull(),
242
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
243
+ },
244
+ (table) => [
245
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
246
+ // Foreign key constraint to agents table
247
+ sqliteCore.foreignKey({
248
+ columns: [table.tenantId, table.projectId, table.agentId],
249
+ foreignColumns: [agents.tenantId, agents.projectId, agents.id],
250
+ name: "agent_data_components_agent_fk"
251
+ }).onDelete("cascade"),
252
+ // Foreign key constraint to data_components table
253
+ sqliteCore.foreignKey({
254
+ columns: [table.tenantId, table.projectId, table.dataComponentId],
255
+ foreignColumns: [dataComponents.tenantId, dataComponents.projectId, dataComponents.id],
256
+ name: "agent_data_components_data_component_fk"
257
+ }).onDelete("cascade")
258
+ ]
259
+ );
260
+ var artifactComponents = sqliteCore.sqliteTable(
261
+ "artifact_components",
262
+ {
263
+ tenantId: sqliteCore.text("tenant_id").notNull(),
264
+ projectId: sqliteCore.text("project_id").notNull(),
265
+ id: sqliteCore.text("id").notNull(),
266
+ name: sqliteCore.text("name").notNull(),
267
+ description: sqliteCore.text("description").notNull(),
268
+ summaryProps: sqliteCore.blob("summary_props", { mode: "json" }).$type(),
269
+ fullProps: sqliteCore.blob("full_props", { mode: "json" }).$type(),
270
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
271
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
272
+ },
273
+ (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] })]
274
+ );
275
+ var agentArtifactComponents = sqliteCore.sqliteTable(
276
+ "agent_artifact_components",
277
+ {
278
+ tenantId: sqliteCore.text("tenant_id").notNull(),
279
+ projectId: sqliteCore.text("project_id").notNull(),
280
+ id: sqliteCore.text("id").notNull(),
281
+ agentId: sqliteCore.text("agent_id").notNull(),
282
+ artifactComponentId: sqliteCore.text("artifact_component_id").notNull(),
283
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
284
+ },
285
+ (table) => [
286
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
287
+ // Foreign key constraint to agents table
288
+ sqliteCore.foreignKey({
289
+ columns: [table.tenantId, table.projectId, table.agentId],
290
+ foreignColumns: [agents.tenantId, agents.projectId, agents.id],
291
+ name: "agent_artifact_components_agent_fk"
292
+ }).onDelete("cascade"),
293
+ // Foreign key constraint to artifact_components table
294
+ sqliteCore.foreignKey({
295
+ columns: [table.tenantId, table.projectId, table.artifactComponentId],
296
+ foreignColumns: [
297
+ artifactComponents.tenantId,
298
+ artifactComponents.projectId,
299
+ artifactComponents.id
300
+ ],
301
+ name: "agent_artifact_components_artifact_component_fk"
302
+ }).onDelete("cascade")
303
+ ]
304
+ );
305
+ var tools = sqliteCore.sqliteTable(
306
+ "tools",
307
+ {
308
+ tenantId: sqliteCore.text("tenant_id").notNull(),
309
+ projectId: sqliteCore.text("project_id").notNull(),
310
+ id: sqliteCore.text("id").notNull(),
311
+ name: sqliteCore.text("name").notNull(),
312
+ // Enhanced MCP configuration
313
+ config: sqliteCore.blob("config", { mode: "json" }).$type().notNull(),
314
+ credentialReferenceId: sqliteCore.text("credential_reference_id"),
315
+ headers: sqliteCore.blob("headers", { mode: "json" }).$type(),
316
+ // Image URL for custom tool icon (supports regular URLs and base64 encoded images)
317
+ imageUrl: sqliteCore.text("image_url"),
318
+ // Server capabilities and status
319
+ capabilities: sqliteCore.blob("capabilities", { mode: "json" }).$type(),
320
+ // Connection health and monitoring
321
+ status: sqliteCore.text("status").notNull().default("unknown"),
322
+ lastHealthCheck: sqliteCore.text("last_health_check"),
323
+ lastError: sqliteCore.text("last_error"),
324
+ // Tool discovery cache
325
+ availableTools: sqliteCore.blob("available_tools", { mode: "json" }).$type(),
326
+ lastToolsSync: sqliteCore.text("last_tools_sync"),
327
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
328
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
329
+ },
330
+ (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] })]
331
+ );
332
+ var agentToolRelations = sqliteCore.sqliteTable(
333
+ "agent_tool_relations",
334
+ {
335
+ tenantId: sqliteCore.text("tenant_id").notNull(),
336
+ projectId: sqliteCore.text("project_id").notNull(),
337
+ id: sqliteCore.text("id").notNull(),
338
+ agentId: sqliteCore.text("agent_id").notNull(),
339
+ toolId: sqliteCore.text("tool_id").notNull(),
340
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
341
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
342
+ },
343
+ (table) => [
344
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
345
+ // Foreign key constraint to agents table
346
+ sqliteCore.foreignKey({
347
+ columns: [table.tenantId, table.projectId, table.agentId],
348
+ foreignColumns: [agents.tenantId, agents.projectId, agents.id],
349
+ name: "agent_tool_relations_agent_fk"
350
+ }).onDelete("cascade"),
351
+ // Foreign key constraint to tools table
352
+ sqliteCore.foreignKey({
353
+ columns: [table.tenantId, table.projectId, table.toolId],
354
+ foreignColumns: [tools.tenantId, tools.projectId, tools.id],
355
+ name: "agent_tool_relations_tool_fk"
356
+ }).onDelete("cascade")
357
+ ]
358
+ );
359
+ var conversations = sqliteCore.sqliteTable(
360
+ "conversations",
361
+ {
362
+ tenantId: sqliteCore.text("tenant_id").notNull(),
363
+ projectId: sqliteCore.text("project_id").notNull(),
364
+ id: sqliteCore.text("id").notNull(),
365
+ userId: sqliteCore.text("user_id"),
366
+ activeAgentId: sqliteCore.text("active_agent_id").notNull(),
367
+ title: sqliteCore.text("title"),
368
+ lastContextResolution: sqliteCore.text("last_context_resolution"),
369
+ metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
370
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
371
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
372
+ },
373
+ (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] })]
374
+ );
375
+ var messages = sqliteCore.sqliteTable(
376
+ "messages",
377
+ {
378
+ tenantId: sqliteCore.text("tenant_id").notNull(),
379
+ projectId: sqliteCore.text("project_id").notNull(),
380
+ id: sqliteCore.text("id").notNull(),
381
+ conversationId: sqliteCore.text("conversation_id").notNull(),
382
+ // Role mapping: user, agent, system (unified for both formats)
383
+ role: sqliteCore.text("role").notNull(),
384
+ // 'user' | 'agent' | 'system'
385
+ // Agent sender/recipient tracking (nullable - only populated when relevant)
386
+ fromAgentId: sqliteCore.text("from_agent_id"),
387
+ // Populated when message is from an agent
388
+ toAgentId: sqliteCore.text("to_agent_id"),
389
+ // Populated when message is directed to a specific agent (e.g., transfers/delegations)
390
+ // External agent sender tracking
391
+ fromExternalAgentId: sqliteCore.text("from_external_agent_id"),
392
+ // Populated when message is directed from an external agent
393
+ // External agent recipient tracking
394
+ toExternalAgentId: sqliteCore.text("to_external_agent_id"),
395
+ // Populated when message is directed to an external agent
396
+ // Message content stored as JSON to support both formats
397
+ content: sqliteCore.blob("content", { mode: "json" }).$type().notNull(),
398
+ // Message classification and filtering
399
+ visibility: sqliteCore.text("visibility").notNull().default("user-facing"),
400
+ // 'user-facing' | 'internal' | 'system' | 'external'
401
+ messageType: sqliteCore.text("message_type").notNull().default("chat"),
402
+ // 'chat' | 'a2a-request' | 'a2a-response' | 'task-update' | 'tool-call'
403
+ // Legacy agent association (consider deprecating in favor of fromAgentId/toAgentId)
404
+ agentId: sqliteCore.text("agent_id"),
405
+ taskId: sqliteCore.text("task_id"),
406
+ parentMessageId: sqliteCore.text("parent_message_id"),
407
+ // Remove self-reference constraint here
408
+ // A2A specific fields
409
+ a2aTaskId: sqliteCore.text("a2a_task_id"),
410
+ // Links to A2A task when relevant
411
+ a2aSessionId: sqliteCore.text("a2a_session_id"),
412
+ // A2A session identifier
413
+ // Metadata for extensions
414
+ metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
415
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
416
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
417
+ },
418
+ (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] })]
419
+ );
420
+ var ledgerArtifacts = sqliteCore.sqliteTable(
421
+ "ledger_artifacts",
422
+ {
423
+ // Primary identifier (maps to `artifactId`)
424
+ tenantId: sqliteCore.text("tenant_id").notNull(),
425
+ projectId: sqliteCore.text("project_id").notNull(),
426
+ id: sqliteCore.text("id").notNull(),
427
+ // Links
428
+ taskId: sqliteCore.text("task_id"),
429
+ contextId: sqliteCore.text("context_id").notNull(),
430
+ // Core Artifact fields
431
+ type: sqliteCore.text("type").notNull().default("source"),
432
+ name: sqliteCore.text("name"),
433
+ description: sqliteCore.text("description"),
434
+ parts: sqliteCore.blob("parts", { mode: "json" }).$type(),
435
+ metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
436
+ // Extra ledger information (not part of the Artifact spec – kept optional)
437
+ summary: sqliteCore.text("summary"),
438
+ mime: sqliteCore.blob("mime", { mode: "json" }).$type(),
439
+ visibility: sqliteCore.text("visibility").default("context"),
440
+ allowedAgents: sqliteCore.blob("allowed_agents", { mode: "json" }).$type(),
441
+ derivedFrom: sqliteCore.text("derived_from"),
442
+ // Timestamps
443
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
444
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
445
+ },
446
+ (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] })]
447
+ );
448
+ var apiKeys = sqliteCore.sqliteTable(
449
+ "api_keys",
450
+ {
451
+ id: sqliteCore.text("id").primaryKey(),
452
+ tenantId: sqliteCore.text("tenant_id").notNull(),
453
+ projectId: sqliteCore.text("project_id").notNull(),
454
+ graphId: sqliteCore.text("graph_id").notNull(),
455
+ publicId: sqliteCore.text("public_id").notNull().unique(),
456
+ // Public ID for O(1) lookup (e.g., "abc123def456")
457
+ keyHash: sqliteCore.text("key_hash").notNull(),
458
+ // Hashed API key (never store plaintext)
459
+ keyPrefix: sqliteCore.text("key_prefix").notNull(),
460
+ // First 8 chars for identification (e.g., "sk_live_abc...")
461
+ lastUsedAt: sqliteCore.text("last_used_at"),
462
+ expiresAt: sqliteCore.text("expires_at"),
463
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
464
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
465
+ },
466
+ (t) => [
467
+ sqliteCore.foreignKey({
468
+ columns: [t.tenantId, t.projectId, t.graphId],
469
+ foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
470
+ name: "api_keys_graph_fk"
471
+ }).onDelete("cascade"),
472
+ sqliteCore.index("api_keys_tenant_graph_idx").on(t.tenantId, t.graphId),
473
+ sqliteCore.index("api_keys_prefix_idx").on(t.keyPrefix),
474
+ sqliteCore.index("api_keys_public_id_idx").on(t.publicId)
475
+ ]
476
+ );
477
+ var credentialReferences = sqliteCore.sqliteTable(
478
+ "credential_references",
479
+ {
480
+ tenantId: sqliteCore.text("tenant_id").notNull(),
481
+ projectId: sqliteCore.text("project_id").notNull(),
482
+ id: sqliteCore.text("id").notNull(),
483
+ type: sqliteCore.text("type").notNull(),
484
+ // Implementation type: 'vault', 'nango', 'inmemory', etc.
485
+ credentialStoreId: sqliteCore.text("credential_store_id").notNull(),
486
+ // Maps to framework.getCredentialStore(id)
487
+ retrievalParams: sqliteCore.blob("retrieval_params", { mode: "json" }).$type(),
488
+ createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
489
+ updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
490
+ },
491
+ (t) => [sqliteCore.primaryKey({ columns: [t.tenantId, t.projectId, t.id] })]
492
+ );
493
+ sqliteCore.index("ledger_artifacts_task_id_idx").on(
494
+ ledgerArtifacts.taskId
495
+ );
496
+ sqliteCore.index("ledger_artifacts_context_id_idx").on(
497
+ ledgerArtifacts.contextId
498
+ );
499
+ sqliteCore.unique(
500
+ "ledger_artifacts_task_context_name_unique"
501
+ ).on(ledgerArtifacts.taskId, ledgerArtifacts.contextId, ledgerArtifacts.name);
502
+ drizzleOrm.relations(tasks, ({ one, many }) => ({
503
+ // A task belongs to one project
504
+ project: one(projects, {
505
+ fields: [tasks.tenantId, tasks.projectId],
506
+ references: [projects.tenantId, projects.id]
507
+ }),
508
+ // A task can have many parent relationships (where it's the child)
509
+ parentRelations: many(taskRelations, {
510
+ relationName: "childTask"
511
+ }),
512
+ // A task can have many child relationships (where it's the parent)
513
+ childRelations: many(taskRelations, {
514
+ relationName: "parentTask"
515
+ }),
516
+ // A task belongs to one agent
517
+ agent: one(agents, {
518
+ fields: [tasks.agentId],
519
+ references: [agents.id]
520
+ }),
521
+ // A task can have many messages associated with it
522
+ messages: many(messages)
523
+ }));
524
+ drizzleOrm.relations(projects, ({ many }) => ({
525
+ // A project can have many agents
526
+ agents: many(agents),
527
+ // A project can have many agent graphs
528
+ agentGraphs: many(agentGraph),
529
+ // A project can have many tools
530
+ tools: many(tools),
531
+ // A project can have many context configs
532
+ contextConfigs: many(contextConfigs),
533
+ // A project can have many external agents
534
+ externalAgents: many(externalAgents),
535
+ // A project can have many conversations
536
+ conversations: many(conversations),
537
+ // A project can have many tasks
538
+ tasks: many(tasks)
539
+ }));
540
+ drizzleOrm.relations(taskRelations, ({ one }) => ({
541
+ // Each relation has one parent task
542
+ parentTask: one(tasks, {
543
+ fields: [taskRelations.parentTaskId],
544
+ references: [tasks.id],
545
+ relationName: "parentTask"
546
+ }),
547
+ // Each relation has one child task
548
+ childTask: one(tasks, {
549
+ fields: [taskRelations.childTaskId],
550
+ references: [tasks.id],
551
+ relationName: "childTask"
552
+ })
553
+ }));
554
+ drizzleOrm.relations(contextConfigs, ({ many, one }) => ({
555
+ // A context config belongs to one project
556
+ project: one(projects, {
557
+ fields: [contextConfigs.tenantId, contextConfigs.projectId],
558
+ references: [projects.tenantId, projects.id]
559
+ }),
560
+ // A context config can be used by many agent graphs
561
+ graphs: many(agentGraph),
562
+ // A context config can have many cached entries
563
+ cache: many(contextCache)
564
+ }));
565
+ drizzleOrm.relations(contextCache, ({ one }) => ({
566
+ // Each cache entry belongs to one context config
567
+ contextConfig: one(contextConfigs, {
568
+ fields: [contextCache.contextConfigId],
569
+ references: [contextConfigs.id]
570
+ })
571
+ }));
572
+ drizzleOrm.relations(agents, ({ many, one }) => ({
573
+ // A context config belongs to one project
574
+ project: one(projects, {
575
+ fields: [agents.tenantId, agents.projectId],
576
+ references: [projects.tenantId, projects.id]
577
+ }),
578
+ // An agent can have many tasks
579
+ tasks: many(tasks),
580
+ // An agent can be the default agent for many graphs
581
+ defaultForGraphs: many(agentGraph),
582
+ // Agent relation tracking
583
+ sourceRelations: many(agentRelations, {
584
+ relationName: "sourceRelations"
585
+ }),
586
+ targetRelations: many(agentRelations, {
587
+ relationName: "targetRelations"
588
+ }),
589
+ // Message tracking relations
590
+ sentMessages: many(messages, {
591
+ relationName: "sentMessages"
592
+ }),
593
+ receivedMessages: many(messages, {
594
+ relationName: "receivedMessages"
595
+ }),
596
+ // Legacy message association (consider deprecating)
597
+ associatedMessages: many(messages, {
598
+ relationName: "associatedAgent"
599
+ }),
600
+ toolRelations: many(agentToolRelations)
601
+ }));
602
+ drizzleOrm.relations(agentGraph, ({ one }) => ({
603
+ // An agent graph belongs to one project
604
+ project: one(projects, {
605
+ fields: [agentGraph.tenantId, agentGraph.projectId],
606
+ references: [projects.tenantId, projects.id]
607
+ }),
608
+ // An agent graph belongs to one default agent
609
+ defaultAgent: one(agents, {
610
+ fields: [agentGraph.defaultAgentId],
611
+ references: [agents.id]
612
+ }),
613
+ // An agent graph can reference one context config
614
+ contextConfig: one(contextConfigs, {
615
+ fields: [agentGraph.contextConfigId],
616
+ references: [contextConfigs.id]
617
+ })
618
+ }));
619
+ drizzleOrm.relations(externalAgents, ({ one, many }) => ({
620
+ // An external agent belongs to one project
621
+ project: one(projects, {
622
+ fields: [externalAgents.tenantId, externalAgents.projectId],
623
+ references: [projects.tenantId, projects.id]
624
+ }),
625
+ // An external agent can be referenced by many agent relations
626
+ agentRelations: many(agentRelations),
627
+ // An external agent may have one credential reference
628
+ credentialReference: one(credentialReferences, {
629
+ fields: [externalAgents.credentialReferenceId],
630
+ references: [credentialReferences.id]
631
+ })
632
+ }));
633
+ drizzleOrm.relations(apiKeys, ({ one }) => ({
634
+ // An API key belongs to one project
635
+ project: one(projects, {
636
+ fields: [apiKeys.tenantId, apiKeys.projectId],
637
+ references: [projects.tenantId, projects.id]
638
+ }),
639
+ // An API key belongs to one tenant and graph
640
+ graph: one(agentGraph, {
641
+ fields: [apiKeys.graphId],
642
+ references: [agentGraph.id]
643
+ })
644
+ }));
645
+ drizzleOrm.relations(agentToolRelations, ({ one }) => ({
646
+ // An agent-tool relation belongs to one agent
647
+ agent: one(agents, {
648
+ fields: [agentToolRelations.agentId],
649
+ references: [agents.id]
650
+ }),
651
+ // An agent-tool relation belongs to one tool
652
+ tool: one(tools, {
653
+ fields: [agentToolRelations.toolId],
654
+ references: [tools.id]
655
+ })
656
+ }));
657
+ drizzleOrm.relations(credentialReferences, ({ many }) => ({
658
+ tools: many(tools)
659
+ }));
660
+ drizzleOrm.relations(tools, ({ one, many }) => ({
661
+ // A tool belongs to one project
662
+ project: one(projects, {
663
+ fields: [tools.tenantId, tools.projectId],
664
+ references: [projects.tenantId, projects.id]
665
+ }),
666
+ // A tool can be used by many agents through agent-tool relations
667
+ agentRelations: many(agentToolRelations),
668
+ // A tool may have one credential reference
669
+ credentialReference: one(credentialReferences, {
670
+ fields: [tools.credentialReferenceId],
671
+ references: [credentialReferences.id]
672
+ })
673
+ }));
674
+ drizzleOrm.relations(conversations, ({ one, many }) => ({
675
+ // A conversation belongs to one project
676
+ project: one(projects, {
677
+ fields: [conversations.tenantId, conversations.projectId],
678
+ references: [projects.tenantId, projects.id]
679
+ }),
680
+ // A conversation has many messages
681
+ messages: many(messages),
682
+ // A conversation has one active agent
683
+ activeAgent: one(agents, {
684
+ fields: [conversations.activeAgentId],
685
+ references: [agents.id]
686
+ })
687
+ }));
688
+ drizzleOrm.relations(messages, ({ one, many }) => ({
689
+ // A message belongs to one conversation
690
+ conversation: one(conversations, {
691
+ fields: [messages.conversationId],
692
+ references: [conversations.id]
693
+ }),
694
+ // Legacy agent association (consider deprecating)
695
+ agent: one(agents, {
696
+ fields: [messages.agentId],
697
+ references: [agents.id],
698
+ relationName: "associatedAgent"
699
+ }),
700
+ // Sender tracking relations
701
+ fromAgent: one(agents, {
702
+ fields: [messages.fromAgentId],
703
+ references: [agents.id],
704
+ relationName: "sentMessages"
705
+ }),
706
+ // Recipient tracking relations
707
+ toAgent: one(agents, {
708
+ fields: [messages.toAgentId],
709
+ references: [agents.id],
710
+ relationName: "receivedMessages"
711
+ }),
712
+ // External agent sender tracking relations
713
+ fromExternalAgent: one(externalAgents, {
714
+ fields: [messages.fromExternalAgentId],
715
+ references: [externalAgents.id],
716
+ relationName: "receivedExternalMessages"
717
+ }),
718
+ // External agent recipient tracking relations
719
+ toExternalAgent: one(externalAgents, {
720
+ fields: [messages.toExternalAgentId],
721
+ references: [externalAgents.id],
722
+ relationName: "sentExternalMessages"
723
+ }),
724
+ // A message may be associated with a task
725
+ task: one(tasks, {
726
+ fields: [messages.taskId],
727
+ references: [tasks.id]
728
+ }),
729
+ // A message may have a parent message (for threading)
730
+ parentMessage: one(messages, {
731
+ fields: [messages.parentMessageId],
732
+ references: [messages.id],
733
+ relationName: "parentChild"
734
+ }),
735
+ // A message may have child messages
736
+ childMessages: many(messages, {
737
+ relationName: "parentChild"
738
+ })
739
+ }));
740
+ drizzleOrm.relations(artifactComponents, ({ many }) => ({
741
+ // An artifact component can be associated with many agents
742
+ agentRelations: many(agentArtifactComponents)
743
+ }));
744
+ drizzleOrm.relations(agentArtifactComponents, ({ one }) => ({
745
+ // An agent-artifact component relation belongs to one agent
746
+ agent: one(agents, {
747
+ fields: [agentArtifactComponents.agentId],
748
+ references: [agents.id]
749
+ }),
750
+ // An agent-artifact component relation belongs to one artifact component
751
+ artifactComponent: one(artifactComponents, {
752
+ fields: [agentArtifactComponents.artifactComponentId],
753
+ references: [artifactComponents.id]
754
+ })
755
+ }));
756
+ drizzleOrm.relations(agentRelations, ({ one }) => ({
757
+ // An agent relation belongs to one graph
758
+ graph: one(agentGraph, {
759
+ fields: [agentRelations.graphId],
760
+ references: [agentGraph.id]
761
+ }),
762
+ // An agent relation has one source agent
763
+ sourceAgent: one(agents, {
764
+ fields: [agentRelations.sourceAgentId],
765
+ references: [agents.id],
766
+ relationName: "sourceRelations"
767
+ }),
768
+ // An agent relation may have one target agent (for internal relations)
769
+ targetAgent: one(agents, {
770
+ fields: [agentRelations.targetAgentId],
771
+ references: [agents.id],
772
+ relationName: "targetRelations"
773
+ }),
774
+ // An agent relation may have one external agent (for external relations)
775
+ externalAgent: one(externalAgents, {
776
+ fields: [agentRelations.externalAgentId],
777
+ references: [externalAgents.id]
778
+ })
779
+ }));
780
+
781
+ // src/types/utility.ts
782
+ var TOOL_STATUS_VALUES = [
783
+ "healthy",
784
+ "unhealthy",
785
+ "unknown",
786
+ "disabled",
787
+ "needs_auth"
788
+ ];
789
+ var VALID_RELATION_TYPES = ["transfer", "delegate"];
790
+
791
+ // src/validation/schemas.ts
792
+ var MIN_ID_LENGTH = 1;
793
+ var MAX_ID_LENGTH = 255;
794
+ var URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
795
+ var resourceIdSchema = zodOpenapi.z.string().min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).regex(URL_SAFE_ID_PATTERN, {
796
+ message: "ID must contain only letters, numbers, hyphens, underscores, and dots"
797
+ }).openapi({
798
+ description: "Resource identifier",
799
+ example: "resource_789"
800
+ });
801
+ var ModelSettingsSchema = zodOpenapi.z.object({
802
+ model: zodOpenapi.z.string().optional(),
803
+ providerOptions: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional()
804
+ });
805
+ var ModelSchema = zodOpenapi.z.object({
806
+ base: ModelSettingsSchema.optional(),
807
+ structuredOutput: ModelSettingsSchema.optional(),
808
+ summarizer: ModelSettingsSchema.optional()
809
+ });
810
+ var createApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
811
+ var createApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
812
+ var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true }).partial();
813
+ var AgentSelectSchema = drizzleZod.createSelectSchema(agents);
814
+ var AgentInsertSchema = drizzleZod.createInsertSchema(agents).extend({
815
+ id: resourceIdSchema,
816
+ models: ModelSchema.optional()
817
+ });
818
+ var AgentUpdateSchema = AgentInsertSchema.partial();
819
+ var AgentApiSelectSchema = createApiSchema(AgentSelectSchema);
820
+ var AgentApiInsertSchema = createApiInsertSchema(AgentInsertSchema);
821
+ var AgentApiUpdateSchema = createApiUpdateSchema(AgentUpdateSchema);
822
+ var AgentRelationSelectSchema = drizzleZod.createSelectSchema(agentRelations);
823
+ var AgentRelationInsertSchema = drizzleZod.createInsertSchema(agentRelations).extend({
824
+ id: resourceIdSchema,
825
+ graphId: resourceIdSchema,
826
+ sourceAgentId: resourceIdSchema,
827
+ targetAgentId: resourceIdSchema.optional(),
828
+ externalAgentId: resourceIdSchema.optional()
829
+ });
830
+ var AgentRelationUpdateSchema = AgentRelationInsertSchema.partial();
831
+ var AgentRelationApiSelectSchema = createApiSchema(AgentRelationSelectSchema);
832
+ var AgentRelationApiInsertSchema = createApiInsertSchema(AgentRelationInsertSchema).extend({
833
+ relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES)
834
+ }).refine(
835
+ (data) => {
836
+ const hasTarget = data.targetAgentId != null;
837
+ const hasExternal = data.externalAgentId != null;
838
+ return hasTarget !== hasExternal;
839
+ },
840
+ {
841
+ message: "Must specify exactly one of targetAgentId or externalAgentId",
842
+ path: ["targetAgentId", "externalAgentId"]
843
+ }
844
+ );
845
+ var AgentRelationApiUpdateSchema = createApiUpdateSchema(AgentRelationUpdateSchema).extend({
846
+ relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES).optional()
847
+ }).refine(
848
+ (data) => {
849
+ const hasTarget = data.targetAgentId != null;
850
+ const hasExternal = data.externalAgentId != null;
851
+ if (!hasTarget && !hasExternal) {
852
+ return true;
853
+ }
854
+ return hasTarget !== hasExternal;
855
+ },
856
+ {
857
+ message: "Must specify exactly one of targetAgentId or externalAgentId when updating agent relationships",
858
+ path: ["targetAgentId", "externalAgentId"]
859
+ }
860
+ );
861
+ var AgentRelationQuerySchema = zodOpenapi.z.object({
862
+ sourceAgentId: zodOpenapi.z.string().optional(),
863
+ targetAgentId: zodOpenapi.z.string().optional(),
864
+ externalAgentId: zodOpenapi.z.string().optional()
865
+ });
866
+ var ExternalAgentRelationInsertSchema = drizzleZod.createInsertSchema(agentRelations).extend({
867
+ id: resourceIdSchema,
868
+ graphId: resourceIdSchema,
869
+ sourceAgentId: resourceIdSchema,
870
+ externalAgentId: resourceIdSchema
871
+ });
872
+ var ExternalAgentRelationApiInsertSchema = createApiInsertSchema(
873
+ ExternalAgentRelationInsertSchema
874
+ );
875
+ var AgentGraphSelectSchema = drizzleZod.createSelectSchema(agentGraph);
876
+ var AgentGraphInsertSchema = drizzleZod.createInsertSchema(agentGraph).extend({
877
+ id: resourceIdSchema
878
+ });
879
+ var AgentGraphUpdateSchema = AgentGraphInsertSchema.partial();
880
+ var AgentGraphApiSelectSchema = createApiSchema(AgentGraphSelectSchema);
881
+ var AgentGraphApiInsertSchema = createApiInsertSchema(AgentGraphInsertSchema).extend({
882
+ id: resourceIdSchema.optional()
883
+ });
884
+ var AgentGraphApiUpdateSchema = createApiUpdateSchema(AgentGraphUpdateSchema);
885
+ var TaskSelectSchema = drizzleZod.createSelectSchema(tasks);
886
+ var TaskInsertSchema = drizzleZod.createInsertSchema(tasks).extend({
887
+ id: resourceIdSchema,
888
+ conversationId: resourceIdSchema.optional()
889
+ });
890
+ var TaskUpdateSchema = TaskInsertSchema.partial();
891
+ var TaskApiSelectSchema = createApiSchema(TaskSelectSchema);
892
+ var TaskApiInsertSchema = createApiInsertSchema(TaskInsertSchema);
893
+ var TaskApiUpdateSchema = createApiUpdateSchema(TaskUpdateSchema);
894
+ var TaskRelationSelectSchema = drizzleZod.createSelectSchema(taskRelations);
895
+ var TaskRelationInsertSchema = drizzleZod.createInsertSchema(taskRelations).extend({
896
+ id: resourceIdSchema,
897
+ parentTaskId: resourceIdSchema,
898
+ childTaskId: resourceIdSchema
899
+ });
900
+ var TaskRelationUpdateSchema = TaskRelationInsertSchema.partial();
901
+ var TaskRelationApiSelectSchema = createApiSchema(TaskRelationSelectSchema);
902
+ var TaskRelationApiInsertSchema = createApiInsertSchema(TaskRelationInsertSchema);
903
+ var TaskRelationApiUpdateSchema = createApiUpdateSchema(TaskRelationUpdateSchema);
904
+ var imageUrlSchema = zodOpenapi.z.string().optional().refine(
905
+ (url) => {
906
+ if (!url) return true;
907
+ if (url.startsWith("data:image/")) {
908
+ const base64Part = url.split(",")[1];
909
+ if (!base64Part) return false;
910
+ return base64Part.length < 14e5;
911
+ }
912
+ try {
913
+ const parsed = new URL(url);
914
+ return parsed.protocol === "http:" || parsed.protocol === "https:";
915
+ } catch {
916
+ return false;
917
+ }
918
+ },
919
+ {
920
+ message: "Image URL must be a valid HTTP(S) URL or a base64 data URL (max 1MB)"
921
+ }
922
+ );
923
+ var McpTransportConfigSchema = zodOpenapi.z.object({
924
+ type: zodOpenapi.z.enum(["streamable_http", "sse"]),
925
+ requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
926
+ eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
927
+ reconnectionOptions: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
928
+ sessionId: zodOpenapi.z.string().optional()
929
+ });
930
+ var ToolStatusSchema = zodOpenapi.z.enum(TOOL_STATUS_VALUES);
931
+ var McpToolDefinitionSchema = zodOpenapi.z.object({
932
+ name: zodOpenapi.z.string(),
933
+ description: zodOpenapi.z.string().optional(),
934
+ inputSchema: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional()
935
+ });
936
+ var ToolSelectSchema = drizzleZod.createSelectSchema(tools);
937
+ var ToolInsertSchema = drizzleZod.createInsertSchema(tools).extend({
938
+ id: resourceIdSchema,
939
+ imageUrl: imageUrlSchema
940
+ });
941
+ var ConversationSelectSchema = drizzleZod.createSelectSchema(conversations);
942
+ var ConversationInsertSchema = drizzleZod.createInsertSchema(conversations).extend({
943
+ id: resourceIdSchema,
944
+ contextConfigId: resourceIdSchema.optional()
945
+ });
946
+ var ConversationUpdateSchema = ConversationInsertSchema.partial();
947
+ var ConversationApiSelectSchema = createApiSchema(ConversationSelectSchema);
948
+ var ConversationApiInsertSchema = createApiInsertSchema(ConversationInsertSchema);
949
+ var ConversationApiUpdateSchema = createApiUpdateSchema(ConversationUpdateSchema);
950
+ var MessageSelectSchema = drizzleZod.createSelectSchema(messages);
951
+ var MessageInsertSchema = drizzleZod.createInsertSchema(messages).extend({
952
+ id: resourceIdSchema,
953
+ conversationId: resourceIdSchema,
954
+ taskId: resourceIdSchema.optional()
955
+ });
956
+ var MessageUpdateSchema = MessageInsertSchema.partial();
957
+ var MessageApiSelectSchema = createApiSchema(MessageSelectSchema);
958
+ var MessageApiInsertSchema = createApiInsertSchema(MessageInsertSchema);
959
+ var MessageApiUpdateSchema = createApiUpdateSchema(MessageUpdateSchema);
960
+ var ContextCacheSelectSchema = drizzleZod.createSelectSchema(contextCache);
961
+ var ContextCacheInsertSchema = drizzleZod.createInsertSchema(contextCache);
962
+ var ContextCacheUpdateSchema = ContextCacheInsertSchema.partial();
963
+ var ContextCacheApiSelectSchema = createApiSchema(ContextCacheSelectSchema);
964
+ var ContextCacheApiInsertSchema = createApiInsertSchema(ContextCacheInsertSchema);
965
+ var ContextCacheApiUpdateSchema = createApiUpdateSchema(ContextCacheUpdateSchema);
966
+ var DataComponentSelectSchema = drizzleZod.createSelectSchema(dataComponents);
967
+ var DataComponentInsertSchema = drizzleZod.createInsertSchema(dataComponents).extend({
968
+ id: resourceIdSchema
969
+ });
970
+ var DataComponentBaseSchema = DataComponentInsertSchema.omit({
971
+ createdAt: true,
972
+ updatedAt: true
973
+ });
974
+ var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
975
+ var DataComponentApiSelectSchema = createApiSchema(DataComponentSelectSchema);
976
+ var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema);
977
+ var DataComponentApiUpdateSchema = createApiUpdateSchema(DataComponentUpdateSchema);
978
+ var AgentDataComponentSelectSchema = drizzleZod.createSelectSchema(agentDataComponents);
979
+ var AgentDataComponentInsertSchema = drizzleZod.createInsertSchema(agentDataComponents);
980
+ var AgentDataComponentUpdateSchema = AgentDataComponentInsertSchema.partial();
981
+ var AgentDataComponentApiSelectSchema = createApiSchema(AgentDataComponentSelectSchema);
982
+ var AgentDataComponentApiInsertSchema = createApiInsertSchema(
983
+ AgentDataComponentInsertSchema
984
+ );
985
+ var AgentDataComponentApiUpdateSchema = createApiUpdateSchema(
986
+ AgentDataComponentUpdateSchema
987
+ );
988
+ var ArtifactComponentSelectSchema = drizzleZod.createSelectSchema(artifactComponents);
989
+ var ArtifactComponentInsertSchema = drizzleZod.createInsertSchema(artifactComponents).extend({
990
+ id: resourceIdSchema
991
+ });
992
+ var ArtifactComponentUpdateSchema = ArtifactComponentInsertSchema.partial();
993
+ var ArtifactComponentApiSelectSchema = createApiSchema(ArtifactComponentSelectSchema);
994
+ var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
995
+ tenantId: true,
996
+ projectId: true,
997
+ createdAt: true,
998
+ updatedAt: true
999
+ }).extend({
1000
+ id: resourceIdSchema.optional()
1001
+ });
1002
+ var ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
1003
+ ArtifactComponentUpdateSchema
1004
+ );
1005
+ var AgentArtifactComponentSelectSchema = drizzleZod.createSelectSchema(agentArtifactComponents);
1006
+ var AgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
1007
+ agentArtifactComponents
1008
+ ).extend({
1009
+ id: resourceIdSchema,
1010
+ agentId: resourceIdSchema,
1011
+ artifactComponentId: resourceIdSchema
1012
+ });
1013
+ var AgentArtifactComponentUpdateSchema = AgentArtifactComponentInsertSchema.partial();
1014
+ var AgentArtifactComponentApiSelectSchema = createApiSchema(
1015
+ AgentArtifactComponentSelectSchema
1016
+ );
1017
+ var AgentArtifactComponentApiInsertSchema = AgentArtifactComponentInsertSchema.omit({
1018
+ tenantId: true,
1019
+ projectId: true,
1020
+ id: true,
1021
+ createdAt: true
1022
+ });
1023
+ var AgentArtifactComponentApiUpdateSchema = createApiUpdateSchema(
1024
+ AgentArtifactComponentUpdateSchema
1025
+ );
1026
+ var ExternalAgentSelectSchema = drizzleZod.createSelectSchema(externalAgents).extend({
1027
+ credentialReferenceId: zodOpenapi.z.string().nullable().optional(),
1028
+ headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullable().optional()
1029
+ });
1030
+ var ExternalAgentInsertSchema = drizzleZod.createInsertSchema(externalAgents).extend({
1031
+ id: resourceIdSchema
1032
+ });
1033
+ var ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
1034
+ var ExternalAgentApiSelectSchema = createApiSchema(ExternalAgentSelectSchema);
1035
+ var ExternalAgentApiInsertSchema = createApiInsertSchema(ExternalAgentInsertSchema);
1036
+ var ExternalAgentApiUpdateSchema = createApiUpdateSchema(ExternalAgentUpdateSchema);
1037
+ var AllAgentSchema = zodOpenapi.z.discriminatedUnion("type", [
1038
+ AgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
1039
+ ExternalAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("external") })
1040
+ ]);
1041
+ var ApiKeySelectSchema = drizzleZod.createSelectSchema(apiKeys);
1042
+ var ApiKeyInsertSchema = drizzleZod.createInsertSchema(apiKeys).extend({
1043
+ id: resourceIdSchema,
1044
+ graphId: resourceIdSchema
1045
+ });
1046
+ var ApiKeyUpdateSchema = ApiKeyInsertSchema.partial().omit({
1047
+ tenantId: true,
1048
+ projectId: true,
1049
+ id: true,
1050
+ publicId: true,
1051
+ keyHash: true,
1052
+ keyPrefix: true,
1053
+ createdAt: true
1054
+ });
1055
+ var ApiKeyApiSelectSchema = ApiKeySelectSchema.omit({
1056
+ tenantId: true,
1057
+ projectId: true,
1058
+ keyHash: true
1059
+ // Never expose the hash
1060
+ });
1061
+ var ApiKeyApiCreationResponseSchema = zodOpenapi.z.object({
1062
+ data: zodOpenapi.z.object({
1063
+ apiKey: ApiKeyApiSelectSchema,
1064
+ key: zodOpenapi.z.string().describe("The full API key (shown only once)")
1065
+ })
1066
+ });
1067
+ var ApiKeyApiInsertSchema = ApiKeyInsertSchema.omit({
1068
+ tenantId: true,
1069
+ projectId: true,
1070
+ id: true,
1071
+ // Auto-generated
1072
+ publicId: true,
1073
+ // Auto-generated
1074
+ keyHash: true,
1075
+ // Auto-generated
1076
+ keyPrefix: true,
1077
+ // Auto-generated
1078
+ lastUsedAt: true
1079
+ // Not set on creation
1080
+ });
1081
+ var ApiKeyApiUpdateSchema = ApiKeyUpdateSchema;
1082
+ var CredentialReferenceSelectSchema = zodOpenapi.z.object({
1083
+ id: zodOpenapi.z.string(),
1084
+ tenantId: zodOpenapi.z.string(),
1085
+ projectId: zodOpenapi.z.string(),
1086
+ type: zodOpenapi.z.string(),
1087
+ credentialStoreId: zodOpenapi.z.string(),
1088
+ retrievalParams: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).nullish(),
1089
+ createdAt: zodOpenapi.z.string(),
1090
+ updatedAt: zodOpenapi.z.string()
1091
+ });
1092
+ var CredentialReferenceInsertSchema = zodOpenapi.z.object({
1093
+ id: resourceIdSchema,
1094
+ tenantId: zodOpenapi.z.string(),
1095
+ projectId: zodOpenapi.z.string(),
1096
+ type: zodOpenapi.z.string(),
1097
+ credentialStoreId: resourceIdSchema,
1098
+ retrievalParams: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).nullish()
1099
+ });
1100
+ var CredentialReferenceUpdateSchema = CredentialReferenceInsertSchema.partial();
1101
+ var CredentialReferenceApiSelectSchema = createApiSchema(CredentialReferenceSelectSchema);
1102
+ var CredentialReferenceApiInsertSchema = createApiInsertSchema(
1103
+ CredentialReferenceInsertSchema
1104
+ );
1105
+ var CredentialReferenceApiUpdateSchema = createApiUpdateSchema(
1106
+ CredentialReferenceUpdateSchema
1107
+ );
1108
+ var McpToolSchema = ToolInsertSchema.extend({
1109
+ imageUrl: imageUrlSchema,
1110
+ status: ToolStatusSchema.default("unknown"),
1111
+ lastHealthCheck: zodOpenapi.z.date().optional(),
1112
+ lastToolsSync: zodOpenapi.z.date().optional(),
1113
+ version: zodOpenapi.z.string().optional(),
1114
+ createdAt: zodOpenapi.z.date(),
1115
+ updatedAt: zodOpenapi.z.date()
1116
+ });
1117
+ var McpToolServerConfigSchema = zodOpenapi.z.object({
1118
+ type: zodOpenapi.z.string(),
1119
+ version: zodOpenapi.z.string().optional()
1120
+ });
1121
+ var MCPToolConfigSchema = McpToolSchema.omit({
1122
+ config: true,
1123
+ tenantId: true,
1124
+ projectId: true,
1125
+ status: true,
1126
+ lastHealthCheck: true,
1127
+ lastToolsSync: true,
1128
+ version: true,
1129
+ createdAt: true,
1130
+ updatedAt: true,
1131
+ credentialReferenceId: true
1132
+ }).extend({
1133
+ tenantId: zodOpenapi.z.string().optional(),
1134
+ projectId: zodOpenapi.z.string().optional(),
1135
+ description: zodOpenapi.z.string().optional(),
1136
+ server: McpToolServerConfigSchema.optional(),
1137
+ serverUrl: zodOpenapi.z.url(),
1138
+ toolName: zodOpenapi.z.string().optional(),
1139
+ activeTools: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
1140
+ mcpType: zodOpenapi.z.enum(["nango", "generic"]).optional(),
1141
+ transport: McpTransportConfigSchema.optional(),
1142
+ credential: CredentialReferenceApiInsertSchema.optional()
1143
+ });
1144
+ var ToolUpdateSchema = ToolInsertSchema.partial();
1145
+ var ToolApiSelectSchema = createApiSchema(ToolSelectSchema);
1146
+ var ToolApiInsertSchema = createApiInsertSchema(ToolInsertSchema);
1147
+ var ToolApiUpdateSchema = createApiUpdateSchema(ToolUpdateSchema);
1148
+ var FetchConfigSchema = zodOpenapi.z.object({
1149
+ url: zodOpenapi.z.string().min(1, "URL is required"),
1150
+ method: zodOpenapi.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).optional().default("GET"),
1151
+ headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).optional(),
1152
+ body: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
1153
+ transform: zodOpenapi.z.string().optional(),
1154
+ // JSONPath or JS transform function
1155
+ timeout: zodOpenapi.z.number().min(0).optional().default(1e4).optional()
1156
+ });
1157
+ var FetchDefinitionSchema = zodOpenapi.z.object({
1158
+ id: zodOpenapi.z.string().min(1, "Fetch definition ID is required"),
1159
+ name: zodOpenapi.z.string().optional(),
1160
+ trigger: zodOpenapi.z.enum(["initialization", "invocation"]),
1161
+ fetchConfig: FetchConfigSchema,
1162
+ responseSchema: zodOpenapi.z.any().optional(),
1163
+ // JSON Schema for validating HTTP response
1164
+ defaultValue: zodOpenapi.z.unknown().optional(),
1165
+ credential: CredentialReferenceApiInsertSchema.optional()
1166
+ });
1167
+ var ContextConfigSelectSchema = drizzleZod.createSelectSchema(contextConfigs).extend({
1168
+ requestContextSchema: zodOpenapi.z.unknown().optional()
1169
+ });
1170
+ var ContextConfigInsertSchema = drizzleZod.createInsertSchema(contextConfigs).extend({
1171
+ id: resourceIdSchema,
1172
+ requestContextSchema: zodOpenapi.z.unknown().optional()
1173
+ }).omit({
1174
+ createdAt: true,
1175
+ updatedAt: true
1176
+ });
1177
+ var ContextConfigUpdateSchema = ContextConfigInsertSchema.partial();
1178
+ var ContextConfigApiSelectSchema = createApiSchema(ContextConfigSelectSchema);
1179
+ var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSchema);
1180
+ var ContextConfigApiUpdateSchema = createApiUpdateSchema(ContextConfigUpdateSchema);
1181
+ var AgentToolRelationSelectSchema = drizzleZod.createSelectSchema(agentToolRelations);
1182
+ var AgentToolRelationInsertSchema = drizzleZod.createInsertSchema(agentToolRelations).extend({
1183
+ id: resourceIdSchema,
1184
+ agentId: resourceIdSchema,
1185
+ toolId: resourceIdSchema
1186
+ });
1187
+ var AgentToolRelationUpdateSchema = AgentToolRelationInsertSchema.partial();
1188
+ var AgentToolRelationApiSelectSchema = createApiSchema(AgentToolRelationSelectSchema);
1189
+ var AgentToolRelationApiInsertSchema = createApiInsertSchema(
1190
+ AgentToolRelationInsertSchema
1191
+ );
1192
+ var AgentToolRelationApiUpdateSchema = createApiUpdateSchema(
1193
+ AgentToolRelationUpdateSchema
1194
+ );
1195
+ var LedgerArtifactSelectSchema = drizzleZod.createSelectSchema(ledgerArtifacts);
1196
+ var LedgerArtifactInsertSchema = drizzleZod.createInsertSchema(ledgerArtifacts);
1197
+ var LedgerArtifactUpdateSchema = LedgerArtifactInsertSchema.partial();
1198
+ var LedgerArtifactApiSelectSchema = createApiSchema(LedgerArtifactSelectSchema);
1199
+ var LedgerArtifactApiInsertSchema = createApiInsertSchema(LedgerArtifactInsertSchema);
1200
+ var LedgerArtifactApiUpdateSchema = createApiUpdateSchema(LedgerArtifactUpdateSchema);
1201
+ var StatusComponentSchema = zodOpenapi.z.object({
1202
+ type: zodOpenapi.z.string(),
1203
+ description: zodOpenapi.z.string().optional(),
1204
+ detailsSchema: zodOpenapi.z.object({
1205
+ type: zodOpenapi.z.literal("object"),
1206
+ properties: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.any()),
1207
+ required: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
1208
+ }).optional()
1209
+ });
1210
+ var StatusUpdateSchema = zodOpenapi.z.object({
1211
+ enabled: zodOpenapi.z.boolean().optional(),
1212
+ numEvents: zodOpenapi.z.number().min(1).max(100).optional(),
1213
+ timeInSeconds: zodOpenapi.z.number().min(1).max(600).optional(),
1214
+ prompt: zodOpenapi.z.string().max(2e3, "Custom prompt cannot exceed 2000 characters").optional(),
1215
+ statusComponents: zodOpenapi.z.array(StatusComponentSchema).optional()
1216
+ });
1217
+ var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
1218
+ tools: zodOpenapi.z.array(zodOpenapi.z.string()),
1219
+ dataComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
1220
+ artifactComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
1221
+ canTransferTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
1222
+ canDelegateTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
1223
+ });
1224
+ var FullGraphDefinitionSchema = AgentGraphApiInsertSchema.extend({
1225
+ agents: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])),
1226
+ tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema),
1227
+ credentialReferences: zodOpenapi.z.array(CredentialReferenceApiInsertSchema).optional(),
1228
+ dataComponents: zodOpenapi.z.record(zodOpenapi.z.string(), DataComponentApiInsertSchema).optional(),
1229
+ artifactComponents: zodOpenapi.z.record(zodOpenapi.z.string(), ArtifactComponentApiInsertSchema).optional(),
1230
+ contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
1231
+ statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
1232
+ models: ModelSchema.optional(),
1233
+ stopWhen: zodOpenapi.z.object({
1234
+ transferCountIs: zodOpenapi.z.number().min(1).max(100).optional()
1235
+ }).optional(),
1236
+ graphPrompt: zodOpenapi.z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
1237
+ });
1238
+ var PaginationSchema = zodOpenapi.z.object({
1239
+ page: zodOpenapi.z.coerce.number().min(1).default(1),
1240
+ limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10),
1241
+ total: zodOpenapi.z.number(),
1242
+ pages: zodOpenapi.z.number()
1243
+ });
1244
+ var ListResponseSchema = (itemSchema) => zodOpenapi.z.object({
1245
+ data: zodOpenapi.z.array(itemSchema),
1246
+ pagination: PaginationSchema
1247
+ });
1248
+ var SingleResponseSchema = (itemSchema) => zodOpenapi.z.object({
1249
+ data: itemSchema
1250
+ });
1251
+ var ErrorResponseSchema = zodOpenapi.z.object({
1252
+ error: zodOpenapi.z.string(),
1253
+ message: zodOpenapi.z.string().optional(),
1254
+ details: zodOpenapi.z.unknown().optional()
1255
+ });
1256
+ var ExistsResponseSchema = zodOpenapi.z.object({
1257
+ exists: zodOpenapi.z.boolean()
1258
+ });
1259
+ var RemovedResponseSchema = zodOpenapi.z.object({
1260
+ message: zodOpenapi.z.string(),
1261
+ removed: zodOpenapi.z.boolean()
1262
+ });
1263
+ var ProjectSelectSchema = drizzleZod.createSelectSchema(projects);
1264
+ var ProjectInsertSchema = drizzleZod.createInsertSchema(projects).omit({
1265
+ createdAt: true,
1266
+ updatedAt: true
1267
+ });
1268
+ var ProjectUpdateSchema = ProjectInsertSchema.partial();
1269
+ var ProjectApiSelectSchema = ProjectSelectSchema.omit({ tenantId: true });
1270
+ var ProjectApiInsertSchema = ProjectInsertSchema.omit({ tenantId: true });
1271
+ var ProjectApiUpdateSchema = ProjectUpdateSchema.omit({ tenantId: true });
1272
+ var HeadersScopeSchema = zodOpenapi.z.object({
1273
+ "x-inkeep-tenant-id": zodOpenapi.z.string().optional().openapi({
1274
+ description: "Tenant identifier",
1275
+ example: "tenant_123"
1276
+ }),
1277
+ "x-inkeep-project-id": zodOpenapi.z.string().optional().openapi({
1278
+ description: "Project identifier",
1279
+ example: "project_456"
1280
+ }),
1281
+ "x-inkeep-graph-id": zodOpenapi.z.string().optional().openapi({
1282
+ description: "Graph identifier",
1283
+ example: "graph_789"
1284
+ })
1285
+ });
1286
+ var TenantParamsSchema = zodOpenapi.z.object({
1287
+ tenantId: zodOpenapi.z.string().openapi({
1288
+ description: "Tenant identifier",
1289
+ example: "tenant_123"
1290
+ })
1291
+ }).openapi("TenantParams");
1292
+ var TenantProjectParamsSchema = zodOpenapi.z.object({
1293
+ tenantId: zodOpenapi.z.string().openapi({
1294
+ description: "Tenant identifier",
1295
+ example: "tenant_123"
1296
+ }),
1297
+ projectId: zodOpenapi.z.string().openapi({
1298
+ description: "Project identifier",
1299
+ example: "project_456"
1300
+ })
1301
+ }).openapi("TenantProjectParams");
1302
+ var TenantProjectIdParamsSchema = zodOpenapi.z.object({
1303
+ tenantId: zodOpenapi.z.string().openapi({
1304
+ description: "Tenant identifier",
1305
+ example: "tenant_123"
1306
+ }),
1307
+ projectId: zodOpenapi.z.string().openapi({
1308
+ description: "Project identifier",
1309
+ example: "project_456"
1310
+ }),
1311
+ id: resourceIdSchema
1312
+ }).openapi("TenantProjectIdParams");
1313
+ var TenantIdParamsSchema = zodOpenapi.z.object({
1314
+ tenantId: zodOpenapi.z.string().openapi({
1315
+ description: "Tenant identifier",
1316
+ example: "tenant_123"
1317
+ }),
1318
+ id: resourceIdSchema
1319
+ }).openapi("TenantIdParams");
1320
+ var IdParamsSchema = zodOpenapi.z.object({
1321
+ id: resourceIdSchema
1322
+ }).openapi("IdParams");
1323
+ var PaginationQueryParamsSchema = zodOpenapi.z.object({
1324
+ page: zodOpenapi.z.coerce.number().min(1).default(1),
1325
+ limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10)
1326
+ });
1327
+
1328
+ // src/validation/graphFull.ts
1329
+ function isInternalAgent(agent) {
1330
+ return "prompt" in agent;
1331
+ }
1332
+ function isExternalAgent(agent) {
1333
+ return "baseUrl" in agent;
1334
+ }
1335
+ function validateAndTypeGraphData(data) {
1336
+ return FullGraphDefinitionSchema.parse(data);
1337
+ }
1338
+ function validateToolReferences(graphData) {
1339
+ const errors = [];
1340
+ const availableToolIds = new Set(Object.keys(graphData.tools));
1341
+ for (const [agentId, agentData] of Object.entries(graphData.agents)) {
1342
+ if (isInternalAgent(agentData) && agentData.tools && Array.isArray(agentData.tools)) {
1343
+ for (const toolId of agentData.tools) {
1344
+ if (!availableToolIds.has(toolId)) {
1345
+ errors.push(`Agent '${agentId}' references non-existent tool '${toolId}'`);
1346
+ }
1347
+ }
1348
+ }
1349
+ }
1350
+ if (errors.length > 0) {
1351
+ throw new Error(`Tool reference validation failed:
1352
+ ${errors.join("\n")}`);
1353
+ }
1354
+ }
1355
+ function validateDataComponentReferences(graphData) {
1356
+ const errors = [];
1357
+ const availableDataComponentIds = new Set(Object.keys(graphData.dataComponents || {}));
1358
+ for (const [agentId, agentData] of Object.entries(graphData.agents)) {
1359
+ if (isInternalAgent(agentData) && agentData.dataComponents) {
1360
+ for (const dataComponentId of agentData.dataComponents) {
1361
+ if (!availableDataComponentIds.has(dataComponentId)) {
1362
+ errors.push(
1363
+ `Agent '${agentId}' references non-existent dataComponent '${dataComponentId}'`
1364
+ );
1365
+ }
1366
+ }
1367
+ }
1368
+ }
1369
+ if (errors.length > 0) {
1370
+ throw new Error(`DataComponent reference validation failed:
1371
+ ${errors.join("\n")}`);
1372
+ }
1373
+ }
1374
+ function validateArtifactComponentReferences(graphData) {
1375
+ const errors = [];
1376
+ const availableArtifactComponentIds = new Set(Object.keys(graphData.artifactComponents || {}));
1377
+ for (const [agentId, agentData] of Object.entries(graphData.agents)) {
1378
+ if (isInternalAgent(agentData) && agentData.artifactComponents) {
1379
+ for (const artifactComponentId of agentData.artifactComponents) {
1380
+ if (!availableArtifactComponentIds.has(artifactComponentId)) {
1381
+ errors.push(
1382
+ `Agent '${agentId}' references non-existent artifactComponent '${artifactComponentId}'`
1383
+ );
1384
+ }
1385
+ }
1386
+ }
1387
+ }
1388
+ if (errors.length > 0) {
1389
+ throw new Error(`ArtifactComponent reference validation failed:
1390
+ ${errors.join("\n")}`);
1391
+ }
1392
+ }
1393
+ function validateAgentRelationships(graphData) {
1394
+ const errors = [];
1395
+ const availableAgentIds = new Set(Object.keys(graphData.agents));
1396
+ for (const [agentId, agentData] of Object.entries(graphData.agents)) {
1397
+ if (isInternalAgent(agentData)) {
1398
+ if (agentData.canTransferTo && Array.isArray(agentData.canTransferTo)) {
1399
+ for (const targetId of agentData.canTransferTo) {
1400
+ if (!availableAgentIds.has(targetId)) {
1401
+ errors.push(
1402
+ `Agent '${agentId}' has transfer target '${targetId}' that doesn't exist in graph`
1403
+ );
1404
+ }
1405
+ }
1406
+ }
1407
+ if (agentData.canDelegateTo && Array.isArray(agentData.canDelegateTo)) {
1408
+ for (const targetId of agentData.canDelegateTo) {
1409
+ if (!availableAgentIds.has(targetId)) {
1410
+ errors.push(
1411
+ `Agent '${agentId}' has delegation target '${targetId}' that doesn't exist in graph`
1412
+ );
1413
+ }
1414
+ }
1415
+ }
1416
+ }
1417
+ }
1418
+ if (errors.length > 0) {
1419
+ throw new Error(`Agent relationship validation failed:
1420
+ ${errors.join("\n")}`);
1421
+ }
1422
+ }
1423
+ function validateGraphStructure(graphData) {
1424
+ if (!graphData.agents[graphData.defaultAgentId]) {
1425
+ throw new Error(`Default agent '${graphData.defaultAgentId}' does not exist in agents`);
1426
+ }
1427
+ validateToolReferences(graphData);
1428
+ validateDataComponentReferences(graphData);
1429
+ validateArtifactComponentReferences(graphData);
1430
+ validateAgentRelationships(graphData);
1431
+ }
1432
+
1433
+ // src/validation/id-validation.ts
1434
+ function isValidResourceId(id) {
1435
+ const result = resourceIdSchema.safeParse(id);
1436
+ return result.success;
1437
+ }
1438
+ function generateIdFromName(name) {
1439
+ const id = name.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
1440
+ if (!id) {
1441
+ throw new Error("Cannot generate valid ID from provided name");
1442
+ }
1443
+ const truncatedId = id.substring(0, MAX_ID_LENGTH);
1444
+ const result = resourceIdSchema.safeParse(truncatedId);
1445
+ if (!result.success) {
1446
+ throw new Error(`Generated ID "${truncatedId}" is not valid: ${result.error.message}`);
1447
+ }
1448
+ return truncatedId;
1449
+ }
1450
+
1451
+ exports.AgentApiInsertSchema = AgentApiInsertSchema;
1452
+ exports.AgentApiSelectSchema = AgentApiSelectSchema;
1453
+ exports.AgentApiUpdateSchema = AgentApiUpdateSchema;
1454
+ exports.AgentArtifactComponentApiInsertSchema = AgentArtifactComponentApiInsertSchema;
1455
+ exports.AgentArtifactComponentApiSelectSchema = AgentArtifactComponentApiSelectSchema;
1456
+ exports.AgentArtifactComponentApiUpdateSchema = AgentArtifactComponentApiUpdateSchema;
1457
+ exports.AgentArtifactComponentInsertSchema = AgentArtifactComponentInsertSchema;
1458
+ exports.AgentArtifactComponentSelectSchema = AgentArtifactComponentSelectSchema;
1459
+ exports.AgentArtifactComponentUpdateSchema = AgentArtifactComponentUpdateSchema;
1460
+ exports.AgentDataComponentApiInsertSchema = AgentDataComponentApiInsertSchema;
1461
+ exports.AgentDataComponentApiSelectSchema = AgentDataComponentApiSelectSchema;
1462
+ exports.AgentDataComponentApiUpdateSchema = AgentDataComponentApiUpdateSchema;
1463
+ exports.AgentDataComponentInsertSchema = AgentDataComponentInsertSchema;
1464
+ exports.AgentDataComponentSelectSchema = AgentDataComponentSelectSchema;
1465
+ exports.AgentDataComponentUpdateSchema = AgentDataComponentUpdateSchema;
1466
+ exports.AgentGraphApiInsertSchema = AgentGraphApiInsertSchema;
1467
+ exports.AgentGraphApiSelectSchema = AgentGraphApiSelectSchema;
1468
+ exports.AgentGraphApiUpdateSchema = AgentGraphApiUpdateSchema;
1469
+ exports.AgentGraphInsertSchema = AgentGraphInsertSchema;
1470
+ exports.AgentGraphSelectSchema = AgentGraphSelectSchema;
1471
+ exports.AgentGraphUpdateSchema = AgentGraphUpdateSchema;
1472
+ exports.AgentInsertSchema = AgentInsertSchema;
1473
+ exports.AgentRelationApiInsertSchema = AgentRelationApiInsertSchema;
1474
+ exports.AgentRelationApiSelectSchema = AgentRelationApiSelectSchema;
1475
+ exports.AgentRelationApiUpdateSchema = AgentRelationApiUpdateSchema;
1476
+ exports.AgentRelationInsertSchema = AgentRelationInsertSchema;
1477
+ exports.AgentRelationQuerySchema = AgentRelationQuerySchema;
1478
+ exports.AgentRelationSelectSchema = AgentRelationSelectSchema;
1479
+ exports.AgentRelationUpdateSchema = AgentRelationUpdateSchema;
1480
+ exports.AgentSelectSchema = AgentSelectSchema;
1481
+ exports.AgentToolRelationApiInsertSchema = AgentToolRelationApiInsertSchema;
1482
+ exports.AgentToolRelationApiSelectSchema = AgentToolRelationApiSelectSchema;
1483
+ exports.AgentToolRelationApiUpdateSchema = AgentToolRelationApiUpdateSchema;
1484
+ exports.AgentToolRelationInsertSchema = AgentToolRelationInsertSchema;
1485
+ exports.AgentToolRelationSelectSchema = AgentToolRelationSelectSchema;
1486
+ exports.AgentToolRelationUpdateSchema = AgentToolRelationUpdateSchema;
1487
+ exports.AgentUpdateSchema = AgentUpdateSchema;
1488
+ exports.AllAgentSchema = AllAgentSchema;
1489
+ exports.ApiKeyApiCreationResponseSchema = ApiKeyApiCreationResponseSchema;
1490
+ exports.ApiKeyApiInsertSchema = ApiKeyApiInsertSchema;
1491
+ exports.ApiKeyApiSelectSchema = ApiKeyApiSelectSchema;
1492
+ exports.ApiKeyApiUpdateSchema = ApiKeyApiUpdateSchema;
1493
+ exports.ApiKeyInsertSchema = ApiKeyInsertSchema;
1494
+ exports.ApiKeySelectSchema = ApiKeySelectSchema;
1495
+ exports.ApiKeyUpdateSchema = ApiKeyUpdateSchema;
1496
+ exports.ArtifactComponentApiInsertSchema = ArtifactComponentApiInsertSchema;
1497
+ exports.ArtifactComponentApiSelectSchema = ArtifactComponentApiSelectSchema;
1498
+ exports.ArtifactComponentApiUpdateSchema = ArtifactComponentApiUpdateSchema;
1499
+ exports.ArtifactComponentInsertSchema = ArtifactComponentInsertSchema;
1500
+ exports.ArtifactComponentSelectSchema = ArtifactComponentSelectSchema;
1501
+ exports.ArtifactComponentUpdateSchema = ArtifactComponentUpdateSchema;
1502
+ exports.ContextCacheApiInsertSchema = ContextCacheApiInsertSchema;
1503
+ exports.ContextCacheApiSelectSchema = ContextCacheApiSelectSchema;
1504
+ exports.ContextCacheApiUpdateSchema = ContextCacheApiUpdateSchema;
1505
+ exports.ContextCacheInsertSchema = ContextCacheInsertSchema;
1506
+ exports.ContextCacheSelectSchema = ContextCacheSelectSchema;
1507
+ exports.ContextCacheUpdateSchema = ContextCacheUpdateSchema;
1508
+ exports.ContextConfigApiInsertSchema = ContextConfigApiInsertSchema;
1509
+ exports.ContextConfigApiSelectSchema = ContextConfigApiSelectSchema;
1510
+ exports.ContextConfigApiUpdateSchema = ContextConfigApiUpdateSchema;
1511
+ exports.ContextConfigInsertSchema = ContextConfigInsertSchema;
1512
+ exports.ContextConfigSelectSchema = ContextConfigSelectSchema;
1513
+ exports.ContextConfigUpdateSchema = ContextConfigUpdateSchema;
1514
+ exports.ConversationApiInsertSchema = ConversationApiInsertSchema;
1515
+ exports.ConversationApiSelectSchema = ConversationApiSelectSchema;
1516
+ exports.ConversationApiUpdateSchema = ConversationApiUpdateSchema;
1517
+ exports.ConversationInsertSchema = ConversationInsertSchema;
1518
+ exports.ConversationSelectSchema = ConversationSelectSchema;
1519
+ exports.ConversationUpdateSchema = ConversationUpdateSchema;
1520
+ exports.CredentialReferenceApiInsertSchema = CredentialReferenceApiInsertSchema;
1521
+ exports.CredentialReferenceApiSelectSchema = CredentialReferenceApiSelectSchema;
1522
+ exports.CredentialReferenceApiUpdateSchema = CredentialReferenceApiUpdateSchema;
1523
+ exports.CredentialReferenceInsertSchema = CredentialReferenceInsertSchema;
1524
+ exports.CredentialReferenceSelectSchema = CredentialReferenceSelectSchema;
1525
+ exports.CredentialReferenceUpdateSchema = CredentialReferenceUpdateSchema;
1526
+ exports.DataComponentApiInsertSchema = DataComponentApiInsertSchema;
1527
+ exports.DataComponentApiSelectSchema = DataComponentApiSelectSchema;
1528
+ exports.DataComponentApiUpdateSchema = DataComponentApiUpdateSchema;
1529
+ exports.DataComponentBaseSchema = DataComponentBaseSchema;
1530
+ exports.DataComponentInsertSchema = DataComponentInsertSchema;
1531
+ exports.DataComponentSelectSchema = DataComponentSelectSchema;
1532
+ exports.DataComponentUpdateSchema = DataComponentUpdateSchema;
1533
+ exports.ErrorResponseSchema = ErrorResponseSchema;
1534
+ exports.ExistsResponseSchema = ExistsResponseSchema;
1535
+ exports.ExternalAgentApiInsertSchema = ExternalAgentApiInsertSchema;
1536
+ exports.ExternalAgentApiSelectSchema = ExternalAgentApiSelectSchema;
1537
+ exports.ExternalAgentApiUpdateSchema = ExternalAgentApiUpdateSchema;
1538
+ exports.ExternalAgentInsertSchema = ExternalAgentInsertSchema;
1539
+ exports.ExternalAgentRelationApiInsertSchema = ExternalAgentRelationApiInsertSchema;
1540
+ exports.ExternalAgentRelationInsertSchema = ExternalAgentRelationInsertSchema;
1541
+ exports.ExternalAgentSelectSchema = ExternalAgentSelectSchema;
1542
+ exports.ExternalAgentUpdateSchema = ExternalAgentUpdateSchema;
1543
+ exports.FetchConfigSchema = FetchConfigSchema;
1544
+ exports.FetchDefinitionSchema = FetchDefinitionSchema;
1545
+ exports.FullGraphAgentInsertSchema = FullGraphAgentInsertSchema;
1546
+ exports.FullGraphDefinitionSchema = FullGraphDefinitionSchema;
1547
+ exports.HeadersScopeSchema = HeadersScopeSchema;
1548
+ exports.IdParamsSchema = IdParamsSchema;
1549
+ exports.LedgerArtifactApiInsertSchema = LedgerArtifactApiInsertSchema;
1550
+ exports.LedgerArtifactApiSelectSchema = LedgerArtifactApiSelectSchema;
1551
+ exports.LedgerArtifactApiUpdateSchema = LedgerArtifactApiUpdateSchema;
1552
+ exports.LedgerArtifactInsertSchema = LedgerArtifactInsertSchema;
1553
+ exports.LedgerArtifactSelectSchema = LedgerArtifactSelectSchema;
1554
+ exports.LedgerArtifactUpdateSchema = LedgerArtifactUpdateSchema;
1555
+ exports.ListResponseSchema = ListResponseSchema;
1556
+ exports.MAX_ID_LENGTH = MAX_ID_LENGTH;
1557
+ exports.MCPToolConfigSchema = MCPToolConfigSchema;
1558
+ exports.MIN_ID_LENGTH = MIN_ID_LENGTH;
1559
+ exports.McpToolDefinitionSchema = McpToolDefinitionSchema;
1560
+ exports.McpToolSchema = McpToolSchema;
1561
+ exports.McpToolServerConfigSchema = McpToolServerConfigSchema;
1562
+ exports.McpTransportConfigSchema = McpTransportConfigSchema;
1563
+ exports.MessageApiInsertSchema = MessageApiInsertSchema;
1564
+ exports.MessageApiSelectSchema = MessageApiSelectSchema;
1565
+ exports.MessageApiUpdateSchema = MessageApiUpdateSchema;
1566
+ exports.MessageInsertSchema = MessageInsertSchema;
1567
+ exports.MessageSelectSchema = MessageSelectSchema;
1568
+ exports.MessageUpdateSchema = MessageUpdateSchema;
1569
+ exports.ModelSchema = ModelSchema;
1570
+ exports.ModelSettingsSchema = ModelSettingsSchema;
1571
+ exports.PaginationQueryParamsSchema = PaginationQueryParamsSchema;
1572
+ exports.PaginationSchema = PaginationSchema;
1573
+ exports.ProjectApiInsertSchema = ProjectApiInsertSchema;
1574
+ exports.ProjectApiSelectSchema = ProjectApiSelectSchema;
1575
+ exports.ProjectApiUpdateSchema = ProjectApiUpdateSchema;
1576
+ exports.ProjectInsertSchema = ProjectInsertSchema;
1577
+ exports.ProjectSelectSchema = ProjectSelectSchema;
1578
+ exports.ProjectUpdateSchema = ProjectUpdateSchema;
1579
+ exports.RemovedResponseSchema = RemovedResponseSchema;
1580
+ exports.SingleResponseSchema = SingleResponseSchema;
1581
+ exports.StatusComponentSchema = StatusComponentSchema;
1582
+ exports.StatusUpdateSchema = StatusUpdateSchema;
1583
+ exports.TaskApiInsertSchema = TaskApiInsertSchema;
1584
+ exports.TaskApiSelectSchema = TaskApiSelectSchema;
1585
+ exports.TaskApiUpdateSchema = TaskApiUpdateSchema;
1586
+ exports.TaskInsertSchema = TaskInsertSchema;
1587
+ exports.TaskRelationApiInsertSchema = TaskRelationApiInsertSchema;
1588
+ exports.TaskRelationApiSelectSchema = TaskRelationApiSelectSchema;
1589
+ exports.TaskRelationApiUpdateSchema = TaskRelationApiUpdateSchema;
1590
+ exports.TaskRelationInsertSchema = TaskRelationInsertSchema;
1591
+ exports.TaskRelationSelectSchema = TaskRelationSelectSchema;
1592
+ exports.TaskRelationUpdateSchema = TaskRelationUpdateSchema;
1593
+ exports.TaskSelectSchema = TaskSelectSchema;
1594
+ exports.TaskUpdateSchema = TaskUpdateSchema;
1595
+ exports.TenantIdParamsSchema = TenantIdParamsSchema;
1596
+ exports.TenantParamsSchema = TenantParamsSchema;
1597
+ exports.TenantProjectIdParamsSchema = TenantProjectIdParamsSchema;
1598
+ exports.TenantProjectParamsSchema = TenantProjectParamsSchema;
1599
+ exports.ToolApiInsertSchema = ToolApiInsertSchema;
1600
+ exports.ToolApiSelectSchema = ToolApiSelectSchema;
1601
+ exports.ToolApiUpdateSchema = ToolApiUpdateSchema;
1602
+ exports.ToolInsertSchema = ToolInsertSchema;
1603
+ exports.ToolSelectSchema = ToolSelectSchema;
1604
+ exports.ToolStatusSchema = ToolStatusSchema;
1605
+ exports.ToolUpdateSchema = ToolUpdateSchema;
1606
+ exports.URL_SAFE_ID_PATTERN = URL_SAFE_ID_PATTERN;
1607
+ exports.generateIdFromName = generateIdFromName;
1608
+ exports.isExternalAgent = isExternalAgent;
1609
+ exports.isInternalAgent = isInternalAgent;
1610
+ exports.isValidResourceId = isValidResourceId;
1611
+ exports.resourceIdSchema = resourceIdSchema;
1612
+ exports.validateAgentRelationships = validateAgentRelationships;
1613
+ exports.validateAndTypeGraphData = validateAndTypeGraphData;
1614
+ exports.validateArtifactComponentReferences = validateArtifactComponentReferences;
1615
+ exports.validateDataComponentReferences = validateDataComponentReferences;
1616
+ exports.validateGraphStructure = validateGraphStructure;
1617
+ exports.validateToolReferences = validateToolReferences;