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