@inkeep/agents-core 0.18.1 → 0.19.0
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 +4 -4
- package/dist/{chunk-E4SFK6AI.js → chunk-3GZBRBXP.js} +84 -87
- package/dist/{chunk-JTHQYGCX.js → chunk-3XUV5Q4D.js} +34 -34
- package/dist/{chunk-ID4CFGVF.js → chunk-B6F3RF4T.js} +87 -120
- package/dist/chunk-E6R6PML7.js +19 -0
- package/dist/chunk-HYS7HUYJ.js +27 -0
- package/dist/{chunk-H6PMWHNV.js → chunk-SLL6V3AE.js} +12 -12
- package/dist/{chunk-R2EERZSW.js → chunk-YECQCT5N.js} +1 -1
- package/dist/client-exports.cjs +189 -225
- package/dist/client-exports.d.cts +13 -14
- package/dist/client-exports.d.ts +13 -14
- package/dist/client-exports.js +10 -10
- package/dist/constants/models.cjs +31 -0
- package/dist/constants/models.d.cts +33 -0
- package/dist/constants/models.d.ts +33 -0
- package/dist/constants/models.js +1 -0
- package/dist/db/schema.cjs +85 -118
- package/dist/db/schema.d.cts +2 -3
- package/dist/db/schema.d.ts +2 -3
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +213931 -1040
- package/dist/index.d.cts +209 -208
- package/dist/index.d.ts +209 -208
- package/dist/index.js +213657 -767
- package/dist/{schema-ULFEZCOL.d.cts → schema-Dp-qgdBT.d.ts} +54 -52
- package/dist/{schema-wbZXiVWb.d.ts → schema-DrDaCn6H.d.cts} +54 -52
- package/dist/{signoz-queries-BuiipZTk.d.cts → signoz-queries-CuWMQh1H.d.cts} +10 -10
- package/dist/{signoz-queries-BuiipZTk.d.ts → signoz-queries-CuWMQh1H.d.ts} +10 -10
- package/dist/types/index.d.cts +2 -3
- package/dist/types/index.d.ts +2 -3
- package/dist/{utility-CyPQ1tC_.d.cts → utility-BxbySenH.d.cts} +152 -301
- package/dist/{utility-CyPQ1tC_.d.ts → utility-BxbySenH.d.ts} +152 -301
- package/dist/utils/schema-conversion.js +1 -1
- package/dist/validation/index.cjs +212 -249
- package/dist/validation/index.d.cts +12 -13
- package/dist/validation/index.d.ts +12 -13
- package/dist/validation/index.js +2 -2
- package/drizzle/0007_mighty_typhoid_mary.sql +227 -0
- package/drizzle/meta/0007_snapshot.json +2766 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +6 -1
- package/dist/chunk-MKBO26DX.js +0 -9
|
@@ -57,12 +57,12 @@ var projectScoped = {
|
|
|
57
57
|
...tenantScoped,
|
|
58
58
|
projectId: sqliteCore.text("project_id").notNull()
|
|
59
59
|
};
|
|
60
|
-
var
|
|
60
|
+
var agentScoped = {
|
|
61
61
|
...projectScoped,
|
|
62
|
-
|
|
62
|
+
agentId: sqliteCore.text("agent_id").notNull()
|
|
63
63
|
};
|
|
64
64
|
var subAgentScoped = {
|
|
65
|
-
...
|
|
65
|
+
...agentScoped,
|
|
66
66
|
subAgentId: sqliteCore.text("sub_agent_id").notNull()
|
|
67
67
|
};
|
|
68
68
|
var uiProperties = {
|
|
@@ -78,9 +78,9 @@ var projects = sqliteCore.sqliteTable(
|
|
|
78
78
|
{
|
|
79
79
|
...tenantScoped,
|
|
80
80
|
...uiProperties,
|
|
81
|
-
// Project-level default model settings that can be inherited by
|
|
81
|
+
// Project-level default model settings that can be inherited by agents
|
|
82
82
|
models: sqliteCore.text("models", { mode: "json" }).$type(),
|
|
83
|
-
// Project-level stopWhen configuration that can be inherited by
|
|
83
|
+
// Project-level stopWhen configuration that can be inherited by agents
|
|
84
84
|
stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
|
|
85
85
|
// Project-level sandbox configuration for function execution
|
|
86
86
|
sandboxConfig: sqliteCore.text("sandbox_config", { mode: "json" }).$type(),
|
|
@@ -88,23 +88,17 @@ var projects = sqliteCore.sqliteTable(
|
|
|
88
88
|
},
|
|
89
89
|
(table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.id] })]
|
|
90
90
|
);
|
|
91
|
-
var
|
|
92
|
-
"
|
|
91
|
+
var agents = sqliteCore.sqliteTable(
|
|
92
|
+
"agent",
|
|
93
93
|
{
|
|
94
94
|
...projectScoped,
|
|
95
95
|
name: sqliteCore.text("name").notNull(),
|
|
96
96
|
description: sqliteCore.text("description"),
|
|
97
97
|
defaultSubAgentId: sqliteCore.text("default_sub_agent_id"),
|
|
98
|
-
// Reference to shared context configuration for all agents in this graph
|
|
99
98
|
contextConfigId: sqliteCore.text("context_config_id"),
|
|
100
|
-
// add fk relationship
|
|
101
|
-
// Graph-level model settingsuration that can be inherited by agents
|
|
102
99
|
models: sqliteCore.text("models", { mode: "json" }).$type(),
|
|
103
|
-
// Status updates configuration for intelligent progress summaries
|
|
104
100
|
statusUpdates: sqliteCore.text("status_updates", { mode: "json" }).$type(),
|
|
105
|
-
|
|
106
|
-
graphPrompt: sqliteCore.text("graph_prompt"),
|
|
107
|
-
// Graph-level stopWhen configuration that can be inherited by agents
|
|
101
|
+
prompt: sqliteCore.text("prompt"),
|
|
108
102
|
stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
|
|
109
103
|
...timestamps
|
|
110
104
|
},
|
|
@@ -113,27 +107,26 @@ var agentGraph = sqliteCore.sqliteTable(
|
|
|
113
107
|
sqliteCore.foreignKey({
|
|
114
108
|
columns: [table.tenantId, table.projectId],
|
|
115
109
|
foreignColumns: [projects.tenantId, projects.id],
|
|
116
|
-
name: "
|
|
110
|
+
name: "agent_project_fk"
|
|
117
111
|
}).onDelete("cascade")
|
|
118
112
|
]
|
|
119
113
|
);
|
|
120
114
|
var contextConfigs = sqliteCore.sqliteTable(
|
|
121
115
|
"context_configs",
|
|
122
116
|
{
|
|
123
|
-
...
|
|
117
|
+
...agentScoped,
|
|
124
118
|
// Developer-defined Zod schema for validating incoming request context
|
|
125
119
|
headersSchema: sqliteCore.blob("headers_schema", { mode: "json" }).$type(),
|
|
126
|
-
// Stores serialized Zod schema
|
|
127
120
|
// Object mapping template keys to fetch definitions that use request context data
|
|
128
121
|
contextVariables: sqliteCore.blob("context_variables", { mode: "json" }).$type(),
|
|
129
122
|
...timestamps
|
|
130
123
|
},
|
|
131
124
|
(table) => [
|
|
132
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.
|
|
125
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
133
126
|
sqliteCore.foreignKey({
|
|
134
|
-
columns: [table.tenantId, table.projectId, table.
|
|
135
|
-
foreignColumns: [
|
|
136
|
-
name: "
|
|
127
|
+
columns: [table.tenantId, table.projectId, table.agentId],
|
|
128
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
129
|
+
name: "context_configs_agent_fk"
|
|
137
130
|
}).onDelete("cascade")
|
|
138
131
|
]
|
|
139
132
|
);
|
|
@@ -146,16 +139,12 @@ var contextCache = sqliteCore.sqliteTable(
|
|
|
146
139
|
// Reference to the context config and specific fetch definition
|
|
147
140
|
contextConfigId: sqliteCore.text("context_config_id").notNull(),
|
|
148
141
|
contextVariableKey: sqliteCore.text("context_variable_key").notNull(),
|
|
149
|
-
// Key from contextVariables object
|
|
150
|
-
// The actual cached context data
|
|
151
142
|
value: sqliteCore.blob("value", { mode: "json" }).$type().notNull(),
|
|
152
143
|
// Request hash for cache invalidation based on context changes
|
|
153
144
|
requestHash: sqliteCore.text("request_hash"),
|
|
154
|
-
// Hash of request context that triggered this cache
|
|
155
145
|
// Metadata for monitoring and debugging
|
|
156
146
|
fetchedAt: sqliteCore.text("fetched_at").notNull(),
|
|
157
147
|
fetchSource: sqliteCore.text("fetch_source"),
|
|
158
|
-
// URL or source identifier
|
|
159
148
|
fetchDurationMs: sqliteCore.integer("fetch_duration_ms"),
|
|
160
149
|
...timestamps
|
|
161
150
|
},
|
|
@@ -176,30 +165,29 @@ var contextCache = sqliteCore.sqliteTable(
|
|
|
176
165
|
var subAgents = sqliteCore.sqliteTable(
|
|
177
166
|
"sub_agents",
|
|
178
167
|
{
|
|
179
|
-
...
|
|
168
|
+
...agentScoped,
|
|
180
169
|
...uiProperties,
|
|
181
170
|
prompt: sqliteCore.text("prompt").notNull(),
|
|
182
171
|
conversationHistoryConfig: sqliteCore.text("conversation_history_config", {
|
|
183
172
|
mode: "json"
|
|
184
173
|
}).$type(),
|
|
185
174
|
models: sqliteCore.text("models", { mode: "json" }).$type(),
|
|
186
|
-
// Agent-level stopWhen configuration (inherited from project)
|
|
187
175
|
stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
|
|
188
176
|
...timestamps
|
|
189
177
|
},
|
|
190
178
|
(table) => [
|
|
191
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.
|
|
179
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
192
180
|
sqliteCore.foreignKey({
|
|
193
|
-
columns: [table.tenantId, table.projectId, table.
|
|
194
|
-
foreignColumns: [
|
|
195
|
-
name: "
|
|
181
|
+
columns: [table.tenantId, table.projectId, table.agentId],
|
|
182
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
183
|
+
name: "sub_agents_agents_fk"
|
|
196
184
|
}).onDelete("cascade")
|
|
197
185
|
]
|
|
198
186
|
);
|
|
199
187
|
var subAgentRelations = sqliteCore.sqliteTable(
|
|
200
188
|
"sub_agent_relations",
|
|
201
189
|
{
|
|
202
|
-
...
|
|
190
|
+
...agentScoped,
|
|
203
191
|
sourceSubAgentId: sqliteCore.text("source_sub_agent_id").notNull(),
|
|
204
192
|
// For internal relationships
|
|
205
193
|
targetSubAgentId: sqliteCore.text("target_sub_agent_id"),
|
|
@@ -209,31 +197,30 @@ var subAgentRelations = sqliteCore.sqliteTable(
|
|
|
209
197
|
...timestamps
|
|
210
198
|
},
|
|
211
199
|
(table) => [
|
|
212
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.
|
|
200
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
213
201
|
sqliteCore.foreignKey({
|
|
214
|
-
columns: [table.tenantId, table.projectId, table.
|
|
215
|
-
foreignColumns: [
|
|
216
|
-
name: "
|
|
202
|
+
columns: [table.tenantId, table.projectId, table.agentId],
|
|
203
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
204
|
+
name: "sub_agent_relations_agent_fk"
|
|
217
205
|
}).onDelete("cascade")
|
|
218
206
|
]
|
|
219
207
|
);
|
|
220
208
|
var externalAgents = sqliteCore.sqliteTable(
|
|
221
209
|
"external_agents",
|
|
222
210
|
{
|
|
223
|
-
...
|
|
211
|
+
...agentScoped,
|
|
224
212
|
...uiProperties,
|
|
225
213
|
baseUrl: sqliteCore.text("base_url").notNull(),
|
|
226
|
-
// A2A endpoint URL
|
|
227
214
|
credentialReferenceId: sqliteCore.text("credential_reference_id"),
|
|
228
215
|
headers: sqliteCore.blob("headers", { mode: "json" }).$type(),
|
|
229
216
|
...timestamps
|
|
230
217
|
},
|
|
231
218
|
(table) => [
|
|
232
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.
|
|
219
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
233
220
|
sqliteCore.foreignKey({
|
|
234
|
-
columns: [table.tenantId, table.projectId, table.
|
|
235
|
-
foreignColumns: [
|
|
236
|
-
name: "
|
|
221
|
+
columns: [table.tenantId, table.projectId, table.agentId],
|
|
222
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
223
|
+
name: "external_agents_agent_fk"
|
|
237
224
|
}).onDelete("cascade"),
|
|
238
225
|
sqliteCore.foreignKey({
|
|
239
226
|
columns: [table.tenantId, table.projectId, table.credentialReferenceId],
|
|
@@ -258,8 +245,8 @@ var tasks = sqliteCore.sqliteTable(
|
|
|
258
245
|
(table) => [
|
|
259
246
|
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
260
247
|
sqliteCore.foreignKey({
|
|
261
|
-
columns: [table.tenantId, table.projectId, table.
|
|
262
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.
|
|
248
|
+
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
249
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
263
250
|
name: "tasks_sub_agent_fk"
|
|
264
251
|
}).onDelete("cascade")
|
|
265
252
|
]
|
|
@@ -271,7 +258,6 @@ var taskRelations = sqliteCore.sqliteTable(
|
|
|
271
258
|
parentTaskId: sqliteCore.text("parent_task_id").notNull(),
|
|
272
259
|
childTaskId: sqliteCore.text("child_task_id").notNull(),
|
|
273
260
|
relationType: sqliteCore.text("relation_type").default("parent_child"),
|
|
274
|
-
// Could be extended for other relation types
|
|
275
261
|
...timestamps
|
|
276
262
|
},
|
|
277
263
|
(table) => [
|
|
@@ -309,13 +295,11 @@ var subAgentDataComponents = sqliteCore.sqliteTable(
|
|
|
309
295
|
},
|
|
310
296
|
(table) => [
|
|
311
297
|
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
312
|
-
// Foreign key constraint to agents table (ensures graph and project exist via cascade)
|
|
313
298
|
sqliteCore.foreignKey({
|
|
314
|
-
columns: [table.tenantId, table.projectId, table.
|
|
315
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.
|
|
299
|
+
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
300
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
316
301
|
name: "sub_agent_data_components_sub_agent_fk"
|
|
317
302
|
}).onDelete("cascade"),
|
|
318
|
-
// Foreign key constraint to data_components table
|
|
319
303
|
sqliteCore.foreignKey({
|
|
320
304
|
columns: [table.tenantId, table.projectId, table.dataComponentId],
|
|
321
305
|
foreignColumns: [dataComponents.tenantId, dataComponents.projectId, dataComponents.id],
|
|
@@ -349,15 +333,13 @@ var subAgentArtifactComponents = sqliteCore.sqliteTable(
|
|
|
349
333
|
},
|
|
350
334
|
(table) => [
|
|
351
335
|
sqliteCore.primaryKey({
|
|
352
|
-
columns: [table.tenantId, table.projectId, table.
|
|
336
|
+
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId, table.id]
|
|
353
337
|
}),
|
|
354
|
-
// Foreign key constraint to agents table (ensures graph and project exist via cascade)
|
|
355
338
|
sqliteCore.foreignKey({
|
|
356
|
-
columns: [table.tenantId, table.projectId, table.
|
|
357
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.
|
|
339
|
+
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
340
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
358
341
|
name: "sub_agent_artifact_components_sub_agent_fk"
|
|
359
342
|
}).onDelete("cascade"),
|
|
360
|
-
// Foreign key constraint to artifact_components table
|
|
361
343
|
sqliteCore.foreignKey({
|
|
362
344
|
columns: [table.tenantId, table.projectId, table.artifactComponentId],
|
|
363
345
|
foreignColumns: [
|
|
@@ -397,18 +379,18 @@ var tools = sqliteCore.sqliteTable(
|
|
|
397
379
|
var functionTools = sqliteCore.sqliteTable(
|
|
398
380
|
"function_tools",
|
|
399
381
|
{
|
|
400
|
-
...
|
|
382
|
+
...agentScoped,
|
|
401
383
|
name: sqliteCore.text("name").notNull(),
|
|
402
384
|
description: sqliteCore.text("description"),
|
|
403
385
|
functionId: sqliteCore.text("function_id").notNull(),
|
|
404
386
|
...timestamps
|
|
405
387
|
},
|
|
406
388
|
(table) => [
|
|
407
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.
|
|
389
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
408
390
|
sqliteCore.foreignKey({
|
|
409
|
-
columns: [table.tenantId, table.projectId, table.
|
|
410
|
-
foreignColumns: [
|
|
411
|
-
name: "
|
|
391
|
+
columns: [table.tenantId, table.projectId, table.agentId],
|
|
392
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
393
|
+
name: "function_tools_agent_fk"
|
|
412
394
|
}).onDelete("cascade"),
|
|
413
395
|
// Foreign key constraint to functions table
|
|
414
396
|
sqliteCore.foreignKey({
|
|
@@ -446,14 +428,12 @@ var subAgentToolRelations = sqliteCore.sqliteTable(
|
|
|
446
428
|
...timestamps
|
|
447
429
|
},
|
|
448
430
|
(table) => [
|
|
449
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.
|
|
450
|
-
// Foreign key constraint to agents table (which includes project and graph scope)
|
|
431
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
451
432
|
sqliteCore.foreignKey({
|
|
452
|
-
columns: [table.tenantId, table.projectId, table.
|
|
453
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.
|
|
433
|
+
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
434
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
454
435
|
name: "sub_agent_tool_relations_agent_fk"
|
|
455
436
|
}).onDelete("cascade"),
|
|
456
|
-
// Foreign key constraint to tools table (MCP tools)
|
|
457
437
|
sqliteCore.foreignKey({
|
|
458
438
|
columns: [table.tenantId, table.projectId, table.toolId],
|
|
459
439
|
foreignColumns: [tools.tenantId, tools.projectId, tools.id],
|
|
@@ -469,20 +449,20 @@ var agentFunctionToolRelations = sqliteCore.sqliteTable(
|
|
|
469
449
|
...timestamps
|
|
470
450
|
},
|
|
471
451
|
(table) => [
|
|
472
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.
|
|
452
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
473
453
|
// Foreign key constraint to agents table
|
|
474
454
|
sqliteCore.foreignKey({
|
|
475
|
-
columns: [table.tenantId, table.projectId, table.
|
|
476
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.
|
|
455
|
+
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
456
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
477
457
|
name: "agent_function_tool_relations_agent_fk"
|
|
478
458
|
}).onDelete("cascade"),
|
|
479
459
|
// Foreign key constraint to functionTools table
|
|
480
460
|
sqliteCore.foreignKey({
|
|
481
|
-
columns: [table.tenantId, table.projectId, table.
|
|
461
|
+
columns: [table.tenantId, table.projectId, table.agentId, table.functionToolId],
|
|
482
462
|
foreignColumns: [
|
|
483
463
|
functionTools.tenantId,
|
|
484
464
|
functionTools.projectId,
|
|
485
|
-
functionTools.
|
|
465
|
+
functionTools.agentId,
|
|
486
466
|
functionTools.id
|
|
487
467
|
],
|
|
488
468
|
name: "agent_function_tool_relations_function_tool_fk"
|
|
@@ -516,33 +496,23 @@ var messages = sqliteCore.sqliteTable(
|
|
|
516
496
|
conversationId: sqliteCore.text("conversation_id").notNull(),
|
|
517
497
|
// Role mapping: user, agent, system (unified for both formats)
|
|
518
498
|
role: sqliteCore.text("role").notNull(),
|
|
519
|
-
// 'user' | 'agent' | 'system'
|
|
520
499
|
// Agent sender/recipient tracking (nullable - only populated when relevant)
|
|
521
500
|
fromSubAgentId: sqliteCore.text("from_sub_agent_id"),
|
|
522
|
-
// Populated when message is from an agent
|
|
523
501
|
toSubAgentId: sqliteCore.text("to_sub_agent_id"),
|
|
524
|
-
// Populated when message is directed to a specific agent (e.g., transfers/delegations)
|
|
525
502
|
// External agent sender tracking
|
|
526
503
|
fromExternalAgentId: sqliteCore.text("from_external_sub_agent_id"),
|
|
527
|
-
// Populated when message is directed from an external agent
|
|
528
504
|
// External agent recipient tracking
|
|
529
505
|
toExternalAgentId: sqliteCore.text("to_external_sub_agent_id"),
|
|
530
|
-
// Populated when message is directed to an external agent
|
|
531
506
|
// Message content stored as JSON to support both formats
|
|
532
507
|
content: sqliteCore.blob("content", { mode: "json" }).$type().notNull(),
|
|
533
508
|
// Message classification and filtering
|
|
534
509
|
visibility: sqliteCore.text("visibility").notNull().default("user-facing"),
|
|
535
|
-
// 'user-facing' | 'internal' | 'system' | 'external'
|
|
536
510
|
messageType: sqliteCore.text("message_type").notNull().default("chat"),
|
|
537
|
-
// 'chat' | 'a2a-request' | 'a2a-response' | 'task-update' | 'tool-call'
|
|
538
511
|
taskId: sqliteCore.text("task_id"),
|
|
539
512
|
parentMessageId: sqliteCore.text("parent_message_id"),
|
|
540
|
-
// Remove self-reference constraint here
|
|
541
513
|
// A2A specific fields
|
|
542
514
|
a2aTaskId: sqliteCore.text("a2a_task_id"),
|
|
543
|
-
// Links to A2A task when relevant
|
|
544
515
|
a2aSessionId: sqliteCore.text("a2a_session_id"),
|
|
545
|
-
// A2A session identifier
|
|
546
516
|
// Metadata for extensions
|
|
547
517
|
metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
|
|
548
518
|
...timestamps
|
|
@@ -563,7 +533,6 @@ var ledgerArtifacts = sqliteCore.sqliteTable(
|
|
|
563
533
|
// Links
|
|
564
534
|
taskId: sqliteCore.text("task_id").notNull(),
|
|
565
535
|
toolCallId: sqliteCore.text("tool_call_id"),
|
|
566
|
-
// Added for traceability to the specific tool execution
|
|
567
536
|
contextId: sqliteCore.text("context_id").notNull(),
|
|
568
537
|
// Core Artifact fields
|
|
569
538
|
type: sqliteCore.text("type").notNull().default("source"),
|
|
@@ -599,13 +568,10 @@ var ledgerArtifacts = sqliteCore.sqliteTable(
|
|
|
599
568
|
var apiKeys = sqliteCore.sqliteTable(
|
|
600
569
|
"api_keys",
|
|
601
570
|
{
|
|
602
|
-
...
|
|
571
|
+
...agentScoped,
|
|
603
572
|
publicId: sqliteCore.text("public_id").notNull().unique(),
|
|
604
|
-
// Public ID for O(1) lookup (e.g., "abc123def456")
|
|
605
573
|
keyHash: sqliteCore.text("key_hash").notNull(),
|
|
606
|
-
// Hashed API key (never store plaintext)
|
|
607
574
|
keyPrefix: sqliteCore.text("key_prefix").notNull(),
|
|
608
|
-
// First 8 chars for identification (e.g., "sk_live_abc...")
|
|
609
575
|
name: sqliteCore.text("name"),
|
|
610
576
|
lastUsedAt: sqliteCore.text("last_used_at"),
|
|
611
577
|
expiresAt: sqliteCore.text("expires_at"),
|
|
@@ -618,11 +584,11 @@ var apiKeys = sqliteCore.sqliteTable(
|
|
|
618
584
|
name: "api_keys_project_fk"
|
|
619
585
|
}).onDelete("cascade"),
|
|
620
586
|
sqliteCore.foreignKey({
|
|
621
|
-
columns: [t.tenantId, t.projectId, t.
|
|
622
|
-
foreignColumns: [
|
|
623
|
-
name: "
|
|
587
|
+
columns: [t.tenantId, t.projectId, t.agentId],
|
|
588
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
589
|
+
name: "api_keys_agent_fk"
|
|
624
590
|
}).onDelete("cascade"),
|
|
625
|
-
sqliteCore.index("
|
|
591
|
+
sqliteCore.index("api_keys_tenant_agent_idx").on(t.tenantId, t.agentId),
|
|
626
592
|
sqliteCore.index("api_keys_prefix_idx").on(t.keyPrefix),
|
|
627
593
|
sqliteCore.index("api_keys_public_id_idx").on(t.publicId)
|
|
628
594
|
]
|
|
@@ -632,9 +598,7 @@ var credentialReferences = sqliteCore.sqliteTable(
|
|
|
632
598
|
{
|
|
633
599
|
...projectScoped,
|
|
634
600
|
type: sqliteCore.text("type").notNull(),
|
|
635
|
-
// Implementation type: 'keychain', 'nango', 'memory', etc.
|
|
636
601
|
credentialStoreId: sqliteCore.text("credential_store_id").notNull(),
|
|
637
|
-
// Maps to framework.getCredentialStore(id)
|
|
638
602
|
retrievalParams: sqliteCore.blob("retrieval_params", { mode: "json" }).$type(),
|
|
639
603
|
...timestamps
|
|
640
604
|
},
|
|
@@ -648,7 +612,6 @@ var credentialReferences = sqliteCore.sqliteTable(
|
|
|
648
612
|
]
|
|
649
613
|
);
|
|
650
614
|
drizzleOrm.relations(tasks, ({ one, many }) => ({
|
|
651
|
-
// A task belongs to one project
|
|
652
615
|
project: one(projects, {
|
|
653
616
|
fields: [tasks.tenantId, tasks.projectId],
|
|
654
617
|
references: [projects.tenantId, projects.id]
|
|
@@ -665,14 +628,12 @@ drizzleOrm.relations(tasks, ({ one, many }) => ({
|
|
|
665
628
|
fields: [tasks.subAgentId],
|
|
666
629
|
references: [subAgents.id]
|
|
667
630
|
}),
|
|
668
|
-
// A task can have many messages associated with it
|
|
669
631
|
messages: many(messages),
|
|
670
|
-
// A task can have many ledger artifacts
|
|
671
632
|
ledgerArtifacts: many(ledgerArtifacts)
|
|
672
633
|
}));
|
|
673
634
|
drizzleOrm.relations(projects, ({ many }) => ({
|
|
674
635
|
subAgents: many(subAgents),
|
|
675
|
-
|
|
636
|
+
agents: many(agents),
|
|
676
637
|
tools: many(tools),
|
|
677
638
|
functions: many(functions),
|
|
678
639
|
contextConfigs: many(contextConfigs),
|
|
@@ -701,7 +662,7 @@ drizzleOrm.relations(contextConfigs, ({ many, one }) => ({
|
|
|
701
662
|
fields: [contextConfigs.tenantId, contextConfigs.projectId],
|
|
702
663
|
references: [projects.tenantId, projects.id]
|
|
703
664
|
}),
|
|
704
|
-
|
|
665
|
+
agents: many(agents),
|
|
705
666
|
cache: many(contextCache)
|
|
706
667
|
}));
|
|
707
668
|
drizzleOrm.relations(contextCache, ({ one }) => ({
|
|
@@ -716,7 +677,7 @@ drizzleOrm.relations(subAgents, ({ many, one }) => ({
|
|
|
716
677
|
references: [projects.tenantId, projects.id]
|
|
717
678
|
}),
|
|
718
679
|
tasks: many(tasks),
|
|
719
|
-
|
|
680
|
+
defaultForAgents: many(agents),
|
|
720
681
|
sourceRelations: many(subAgentRelations, {
|
|
721
682
|
relationName: "sourceRelations"
|
|
722
683
|
}),
|
|
@@ -729,25 +690,22 @@ drizzleOrm.relations(subAgents, ({ many, one }) => ({
|
|
|
729
690
|
receivedMessages: many(messages, {
|
|
730
691
|
relationName: "receivedMessages"
|
|
731
692
|
}),
|
|
732
|
-
associatedMessages: many(messages, {
|
|
733
|
-
relationName: "associatedAgent"
|
|
734
|
-
}),
|
|
735
693
|
toolRelations: many(subAgentToolRelations),
|
|
736
694
|
functionToolRelations: many(agentFunctionToolRelations),
|
|
737
695
|
dataComponentRelations: many(subAgentDataComponents),
|
|
738
696
|
artifactComponentRelations: many(subAgentArtifactComponents)
|
|
739
697
|
}));
|
|
740
|
-
drizzleOrm.relations(
|
|
698
|
+
drizzleOrm.relations(agents, ({ one, many }) => ({
|
|
741
699
|
project: one(projects, {
|
|
742
|
-
fields: [
|
|
700
|
+
fields: [agents.tenantId, agents.projectId],
|
|
743
701
|
references: [projects.tenantId, projects.id]
|
|
744
702
|
}),
|
|
745
703
|
defaultSubAgent: one(subAgents, {
|
|
746
|
-
fields: [
|
|
704
|
+
fields: [agents.defaultSubAgentId],
|
|
747
705
|
references: [subAgents.id]
|
|
748
706
|
}),
|
|
749
707
|
contextConfig: one(contextConfigs, {
|
|
750
|
-
fields: [
|
|
708
|
+
fields: [agents.contextConfigId],
|
|
751
709
|
references: [contextConfigs.id]
|
|
752
710
|
}),
|
|
753
711
|
functionTools: many(functionTools)
|
|
@@ -768,9 +726,9 @@ drizzleOrm.relations(apiKeys, ({ one }) => ({
|
|
|
768
726
|
fields: [apiKeys.tenantId, apiKeys.projectId],
|
|
769
727
|
references: [projects.tenantId, projects.id]
|
|
770
728
|
}),
|
|
771
|
-
|
|
772
|
-
fields: [apiKeys.
|
|
773
|
-
references: [
|
|
729
|
+
agent: one(agents, {
|
|
730
|
+
fields: [apiKeys.agentId],
|
|
731
|
+
references: [agents.id]
|
|
774
732
|
})
|
|
775
733
|
}));
|
|
776
734
|
drizzleOrm.relations(subAgentToolRelations, ({ one }) => ({
|
|
@@ -783,8 +741,13 @@ drizzleOrm.relations(subAgentToolRelations, ({ one }) => ({
|
|
|
783
741
|
references: [tools.id]
|
|
784
742
|
})
|
|
785
743
|
}));
|
|
786
|
-
drizzleOrm.relations(credentialReferences, ({ many }) => ({
|
|
787
|
-
|
|
744
|
+
drizzleOrm.relations(credentialReferences, ({ one, many }) => ({
|
|
745
|
+
project: one(projects, {
|
|
746
|
+
fields: [credentialReferences.tenantId, credentialReferences.projectId],
|
|
747
|
+
references: [projects.tenantId, projects.id]
|
|
748
|
+
}),
|
|
749
|
+
tools: many(tools),
|
|
750
|
+
externalAgents: many(externalAgents)
|
|
788
751
|
}));
|
|
789
752
|
drizzleOrm.relations(tools, ({ one, many }) => ({
|
|
790
753
|
project: one(projects, {
|
|
@@ -893,13 +856,17 @@ drizzleOrm.relations(ledgerArtifacts, ({ one }) => ({
|
|
|
893
856
|
references: [tasks.id]
|
|
894
857
|
})
|
|
895
858
|
}));
|
|
896
|
-
drizzleOrm.relations(functions, ({ many }) => ({
|
|
897
|
-
functionTools: many(functionTools)
|
|
859
|
+
drizzleOrm.relations(functions, ({ many, one }) => ({
|
|
860
|
+
functionTools: many(functionTools),
|
|
861
|
+
project: one(projects, {
|
|
862
|
+
fields: [functions.tenantId, functions.projectId],
|
|
863
|
+
references: [projects.tenantId, projects.id]
|
|
864
|
+
})
|
|
898
865
|
}));
|
|
899
866
|
drizzleOrm.relations(subAgentRelations, ({ one }) => ({
|
|
900
|
-
|
|
901
|
-
fields: [subAgentRelations.
|
|
902
|
-
references: [
|
|
867
|
+
agent: one(agents, {
|
|
868
|
+
fields: [subAgentRelations.agentId],
|
|
869
|
+
references: [agents.id]
|
|
903
870
|
}),
|
|
904
871
|
sourceSubAgent: one(subAgents, {
|
|
905
872
|
fields: [subAgentRelations.sourceSubAgentId],
|
|
@@ -921,9 +888,9 @@ drizzleOrm.relations(functionTools, ({ one, many }) => ({
|
|
|
921
888
|
fields: [functionTools.tenantId, functionTools.projectId],
|
|
922
889
|
references: [projects.tenantId, projects.id]
|
|
923
890
|
}),
|
|
924
|
-
|
|
925
|
-
fields: [functionTools.tenantId, functionTools.projectId, functionTools.
|
|
926
|
-
references: [
|
|
891
|
+
agent: one(agents, {
|
|
892
|
+
fields: [functionTools.tenantId, functionTools.projectId, functionTools.agentId],
|
|
893
|
+
references: [agents.tenantId, agents.projectId, agents.id]
|
|
927
894
|
}),
|
|
928
895
|
function: one(functions, {
|
|
929
896
|
fields: [functionTools.tenantId, functionTools.projectId, functionTools.functionId],
|
|
@@ -967,7 +934,7 @@ var StopWhenSchema = zodOpenapi.z.object({
|
|
|
967
934
|
transferCountIs: zodOpenapi.z.number().min(1).max(100).optional(),
|
|
968
935
|
stepCountIs: zodOpenapi.z.number().min(1).max(1e3).optional()
|
|
969
936
|
});
|
|
970
|
-
var
|
|
937
|
+
var AgentStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true });
|
|
971
938
|
var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true });
|
|
972
939
|
var MIN_ID_LENGTH = 1;
|
|
973
940
|
var MAX_ID_LENGTH = 255;
|
|
@@ -1008,31 +975,31 @@ var FunctionToolConfigSchema = zodOpenapi.z.object({
|
|
|
1008
975
|
var createApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
1009
976
|
var createApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
1010
977
|
var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true }).partial();
|
|
1011
|
-
var
|
|
1012
|
-
var
|
|
1013
|
-
var
|
|
978
|
+
var createAgentScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
|
|
979
|
+
var createAgentScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
|
|
980
|
+
var createAgentScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true }).partial();
|
|
1014
981
|
var SubAgentSelectSchema = drizzleZod.createSelectSchema(subAgents);
|
|
1015
982
|
var SubAgentInsertSchema = drizzleZod.createInsertSchema(subAgents).extend({
|
|
1016
983
|
id: resourceIdSchema,
|
|
1017
984
|
models: ModelSchema.optional()
|
|
1018
985
|
});
|
|
1019
986
|
var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
|
|
1020
|
-
var SubAgentApiSelectSchema =
|
|
1021
|
-
var SubAgentApiInsertSchema =
|
|
1022
|
-
var SubAgentApiUpdateSchema =
|
|
987
|
+
var SubAgentApiSelectSchema = createAgentScopedApiSchema(SubAgentSelectSchema);
|
|
988
|
+
var SubAgentApiInsertSchema = createAgentScopedApiInsertSchema(SubAgentInsertSchema);
|
|
989
|
+
var SubAgentApiUpdateSchema = createAgentScopedApiUpdateSchema(SubAgentUpdateSchema);
|
|
1023
990
|
var SubAgentRelationSelectSchema = drizzleZod.createSelectSchema(subAgentRelations);
|
|
1024
991
|
var SubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
|
|
1025
992
|
id: resourceIdSchema,
|
|
1026
|
-
|
|
993
|
+
agentId: resourceIdSchema,
|
|
1027
994
|
sourceSubAgentId: resourceIdSchema,
|
|
1028
995
|
targetSubAgentId: resourceIdSchema.optional(),
|
|
1029
996
|
externalSubAgentId: resourceIdSchema.optional()
|
|
1030
997
|
});
|
|
1031
998
|
var SubAgentRelationUpdateSchema = SubAgentRelationInsertSchema.partial();
|
|
1032
|
-
var SubAgentRelationApiSelectSchema =
|
|
999
|
+
var SubAgentRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
1033
1000
|
SubAgentRelationSelectSchema
|
|
1034
1001
|
);
|
|
1035
|
-
var SubAgentRelationApiInsertSchema =
|
|
1002
|
+
var SubAgentRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
1036
1003
|
SubAgentRelationInsertSchema
|
|
1037
1004
|
).extend({
|
|
1038
1005
|
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES)
|
|
@@ -1047,7 +1014,7 @@ var SubAgentRelationApiInsertSchema = createGraphScopedApiInsertSchema(
|
|
|
1047
1014
|
path: ["targetSubAgentId", "externalSubAgentId"]
|
|
1048
1015
|
}
|
|
1049
1016
|
);
|
|
1050
|
-
var SubAgentRelationApiUpdateSchema =
|
|
1017
|
+
var SubAgentRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
1051
1018
|
SubAgentRelationUpdateSchema
|
|
1052
1019
|
).extend({
|
|
1053
1020
|
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES).optional()
|
|
@@ -1072,23 +1039,23 @@ var SubAgentRelationQuerySchema = zodOpenapi.z.object({
|
|
|
1072
1039
|
});
|
|
1073
1040
|
var ExternalSubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
|
|
1074
1041
|
id: resourceIdSchema,
|
|
1075
|
-
|
|
1042
|
+
agentId: resourceIdSchema,
|
|
1076
1043
|
sourceSubAgentId: resourceIdSchema,
|
|
1077
1044
|
externalSubAgentId: resourceIdSchema
|
|
1078
1045
|
});
|
|
1079
1046
|
var ExternalSubAgentRelationApiInsertSchema = createApiInsertSchema(
|
|
1080
1047
|
ExternalSubAgentRelationInsertSchema
|
|
1081
1048
|
);
|
|
1082
|
-
var
|
|
1083
|
-
var
|
|
1049
|
+
var AgentSelectSchema = drizzleZod.createSelectSchema(agents);
|
|
1050
|
+
var AgentInsertSchema = drizzleZod.createInsertSchema(agents).extend({
|
|
1084
1051
|
id: resourceIdSchema
|
|
1085
1052
|
});
|
|
1086
|
-
var
|
|
1087
|
-
var
|
|
1088
|
-
var
|
|
1053
|
+
var AgentUpdateSchema = AgentInsertSchema.partial();
|
|
1054
|
+
var AgentApiSelectSchema = createApiSchema(AgentSelectSchema);
|
|
1055
|
+
var AgentApiInsertSchema = createApiInsertSchema(AgentInsertSchema).extend({
|
|
1089
1056
|
id: resourceIdSchema
|
|
1090
1057
|
});
|
|
1091
|
-
var
|
|
1058
|
+
var AgentApiUpdateSchema = createApiUpdateSchema(AgentUpdateSchema);
|
|
1092
1059
|
var TaskSelectSchema = drizzleZod.createSelectSchema(tasks);
|
|
1093
1060
|
var TaskInsertSchema = drizzleZod.createInsertSchema(tasks).extend({
|
|
1094
1061
|
id: resourceIdSchema,
|
|
@@ -1131,7 +1098,10 @@ var McpTransportConfigSchema = zodOpenapi.z.object({
|
|
|
1131
1098
|
type: zodOpenapi.z.enum(MCPTransportType),
|
|
1132
1099
|
requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1133
1100
|
eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1134
|
-
reconnectionOptions: zodOpenapi.z.
|
|
1101
|
+
reconnectionOptions: zodOpenapi.z.any().optional().openapi({
|
|
1102
|
+
type: "object",
|
|
1103
|
+
description: "Reconnection options for streamable HTTP transport"
|
|
1104
|
+
}),
|
|
1135
1105
|
sessionId: zodOpenapi.z.string().optional()
|
|
1136
1106
|
});
|
|
1137
1107
|
var ToolStatusSchema = zodOpenapi.z.enum(TOOL_STATUS_VALUES);
|
|
@@ -1148,13 +1118,16 @@ var ToolInsertSchema = drizzleZod.createInsertSchema(tools).extend({
|
|
|
1148
1118
|
type: zodOpenapi.z.literal("mcp"),
|
|
1149
1119
|
mcp: zodOpenapi.z.object({
|
|
1150
1120
|
server: zodOpenapi.z.object({
|
|
1151
|
-
url: zodOpenapi.z.
|
|
1121
|
+
url: zodOpenapi.z.url()
|
|
1152
1122
|
}),
|
|
1153
1123
|
transport: zodOpenapi.z.object({
|
|
1154
1124
|
type: zodOpenapi.z.enum(MCPTransportType),
|
|
1155
1125
|
requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1156
1126
|
eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1157
|
-
reconnectionOptions: zodOpenapi.z.
|
|
1127
|
+
reconnectionOptions: zodOpenapi.z.any().optional().openapi({
|
|
1128
|
+
type: "object",
|
|
1129
|
+
description: "Reconnection options for streamable HTTP transport"
|
|
1130
|
+
}),
|
|
1158
1131
|
sessionId: zodOpenapi.z.string().optional()
|
|
1159
1132
|
}).optional(),
|
|
1160
1133
|
activeTools: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
@@ -1201,7 +1174,7 @@ var DataComponentApiUpdateSchema = createApiUpdateSchema(DataComponentUpdateSche
|
|
|
1201
1174
|
var SubAgentDataComponentSelectSchema = drizzleZod.createSelectSchema(subAgentDataComponents);
|
|
1202
1175
|
var SubAgentDataComponentInsertSchema = drizzleZod.createInsertSchema(subAgentDataComponents);
|
|
1203
1176
|
var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
|
|
1204
|
-
var SubAgentDataComponentApiSelectSchema =
|
|
1177
|
+
var SubAgentDataComponentApiSelectSchema = createAgentScopedApiSchema(
|
|
1205
1178
|
SubAgentDataComponentSelectSchema
|
|
1206
1179
|
);
|
|
1207
1180
|
var SubAgentDataComponentApiInsertSchema = SubAgentDataComponentInsertSchema.omit({
|
|
@@ -1210,7 +1183,7 @@ var SubAgentDataComponentApiInsertSchema = SubAgentDataComponentInsertSchema.omi
|
|
|
1210
1183
|
id: true,
|
|
1211
1184
|
createdAt: true
|
|
1212
1185
|
});
|
|
1213
|
-
var SubAgentDataComponentApiUpdateSchema =
|
|
1186
|
+
var SubAgentDataComponentApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
1214
1187
|
SubAgentDataComponentUpdateSchema
|
|
1215
1188
|
);
|
|
1216
1189
|
var ArtifactComponentSelectSchema = drizzleZod.createSelectSchema(artifactComponents);
|
|
@@ -1237,7 +1210,7 @@ var SubAgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
|
|
|
1237
1210
|
artifactComponentId: resourceIdSchema
|
|
1238
1211
|
});
|
|
1239
1212
|
var SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentInsertSchema.partial();
|
|
1240
|
-
var SubAgentArtifactComponentApiSelectSchema =
|
|
1213
|
+
var SubAgentArtifactComponentApiSelectSchema = createAgentScopedApiSchema(
|
|
1241
1214
|
SubAgentArtifactComponentSelectSchema
|
|
1242
1215
|
);
|
|
1243
1216
|
var SubAgentArtifactComponentApiInsertSchema = SubAgentArtifactComponentInsertSchema.omit({
|
|
@@ -1246,7 +1219,7 @@ var SubAgentArtifactComponentApiInsertSchema = SubAgentArtifactComponentInsertSc
|
|
|
1246
1219
|
id: true,
|
|
1247
1220
|
createdAt: true
|
|
1248
1221
|
});
|
|
1249
|
-
var SubAgentArtifactComponentApiUpdateSchema =
|
|
1222
|
+
var SubAgentArtifactComponentApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
1250
1223
|
SubAgentArtifactComponentUpdateSchema
|
|
1251
1224
|
);
|
|
1252
1225
|
var ExternalAgentSelectSchema = drizzleZod.createSelectSchema(externalAgents).extend({
|
|
@@ -1257,9 +1230,9 @@ var ExternalAgentInsertSchema = drizzleZod.createInsertSchema(externalAgents).ex
|
|
|
1257
1230
|
id: resourceIdSchema
|
|
1258
1231
|
});
|
|
1259
1232
|
var ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
|
|
1260
|
-
var ExternalAgentApiSelectSchema =
|
|
1261
|
-
var ExternalAgentApiInsertSchema =
|
|
1262
|
-
var ExternalAgentApiUpdateSchema =
|
|
1233
|
+
var ExternalAgentApiSelectSchema = createAgentScopedApiSchema(ExternalAgentSelectSchema);
|
|
1234
|
+
var ExternalAgentApiInsertSchema = createAgentScopedApiInsertSchema(ExternalAgentInsertSchema);
|
|
1235
|
+
var ExternalAgentApiUpdateSchema = createAgentScopedApiUpdateSchema(ExternalAgentUpdateSchema);
|
|
1263
1236
|
var AllAgentSchema = zodOpenapi.z.discriminatedUnion("type", [
|
|
1264
1237
|
SubAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
|
|
1265
1238
|
ExternalAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
@@ -1267,7 +1240,7 @@ var AllAgentSchema = zodOpenapi.z.discriminatedUnion("type", [
|
|
|
1267
1240
|
var ApiKeySelectSchema = drizzleZod.createSelectSchema(apiKeys);
|
|
1268
1241
|
var ApiKeyInsertSchema = drizzleZod.createInsertSchema(apiKeys).extend({
|
|
1269
1242
|
id: resourceIdSchema,
|
|
1270
|
-
|
|
1243
|
+
agentId: resourceIdSchema
|
|
1271
1244
|
});
|
|
1272
1245
|
var ApiKeyUpdateSchema = ApiKeyInsertSchema.partial().omit({
|
|
1273
1246
|
tenantId: true,
|
|
@@ -1375,7 +1348,7 @@ var FunctionToolInsertSchema = drizzleZod.createInsertSchema(functionTools).exte
|
|
|
1375
1348
|
});
|
|
1376
1349
|
var FunctionToolUpdateSchema = FunctionToolInsertSchema.partial();
|
|
1377
1350
|
var FunctionToolApiSelectSchema = createApiSchema(FunctionToolSelectSchema);
|
|
1378
|
-
var FunctionToolApiInsertSchema =
|
|
1351
|
+
var FunctionToolApiInsertSchema = createAgentScopedApiInsertSchema(FunctionToolInsertSchema);
|
|
1379
1352
|
var FunctionToolApiUpdateSchema = createApiUpdateSchema(FunctionToolUpdateSchema);
|
|
1380
1353
|
var FunctionSelectSchema = drizzleZod.createSelectSchema(functions);
|
|
1381
1354
|
var FunctionInsertSchema = drizzleZod.createInsertSchema(functions).extend({
|
|
@@ -1401,28 +1374,40 @@ var FetchDefinitionSchema = zodOpenapi.z.object({
|
|
|
1401
1374
|
fetchConfig: FetchConfigSchema,
|
|
1402
1375
|
responseSchema: zodOpenapi.z.any().optional(),
|
|
1403
1376
|
// JSON Schema for validating HTTP response
|
|
1404
|
-
defaultValue: zodOpenapi.z.
|
|
1377
|
+
defaultValue: zodOpenapi.z.any().optional().openapi({
|
|
1378
|
+
description: "Default value if fetch fails"
|
|
1379
|
+
}),
|
|
1405
1380
|
credential: CredentialReferenceApiInsertSchema.optional()
|
|
1406
1381
|
});
|
|
1407
1382
|
var ContextConfigSelectSchema = drizzleZod.createSelectSchema(contextConfigs).extend({
|
|
1408
|
-
headersSchema: zodOpenapi.z.
|
|
1383
|
+
headersSchema: zodOpenapi.z.any().optional().openapi({
|
|
1384
|
+
type: "object",
|
|
1385
|
+
description: "JSON Schema for validating request headers"
|
|
1386
|
+
})
|
|
1409
1387
|
});
|
|
1410
1388
|
var ContextConfigInsertSchema = drizzleZod.createInsertSchema(contextConfigs).extend({
|
|
1411
1389
|
id: resourceIdSchema.optional(),
|
|
1412
|
-
headersSchema: zodOpenapi.z.
|
|
1390
|
+
headersSchema: zodOpenapi.z.any().nullable().optional().openapi({
|
|
1391
|
+
type: "object",
|
|
1392
|
+
description: "JSON Schema for validating request headers"
|
|
1393
|
+
}),
|
|
1394
|
+
contextVariables: zodOpenapi.z.any().nullable().optional().openapi({
|
|
1395
|
+
type: "object",
|
|
1396
|
+
description: "Context variables configuration with fetch definitions"
|
|
1397
|
+
})
|
|
1413
1398
|
}).omit({
|
|
1414
1399
|
createdAt: true,
|
|
1415
1400
|
updatedAt: true
|
|
1416
1401
|
});
|
|
1417
1402
|
var ContextConfigUpdateSchema = ContextConfigInsertSchema.partial();
|
|
1418
1403
|
var ContextConfigApiSelectSchema = createApiSchema(ContextConfigSelectSchema).omit({
|
|
1419
|
-
|
|
1404
|
+
agentId: true
|
|
1420
1405
|
});
|
|
1421
1406
|
var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSchema).omit({
|
|
1422
|
-
|
|
1407
|
+
agentId: true
|
|
1423
1408
|
});
|
|
1424
1409
|
var ContextConfigApiUpdateSchema = createApiUpdateSchema(ContextConfigUpdateSchema).omit({
|
|
1425
|
-
|
|
1410
|
+
agentId: true
|
|
1426
1411
|
});
|
|
1427
1412
|
var SubAgentToolRelationSelectSchema = drizzleZod.createSelectSchema(subAgentToolRelations);
|
|
1428
1413
|
var SubAgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToolRelations).extend({
|
|
@@ -1433,13 +1418,13 @@ var SubAgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToo
|
|
|
1433
1418
|
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1434
1419
|
});
|
|
1435
1420
|
var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
|
|
1436
|
-
var SubAgentToolRelationApiSelectSchema =
|
|
1421
|
+
var SubAgentToolRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
1437
1422
|
SubAgentToolRelationSelectSchema
|
|
1438
1423
|
);
|
|
1439
|
-
var SubAgentToolRelationApiInsertSchema =
|
|
1424
|
+
var SubAgentToolRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
1440
1425
|
SubAgentToolRelationInsertSchema
|
|
1441
1426
|
);
|
|
1442
|
-
var SubAgentToolRelationApiUpdateSchema =
|
|
1427
|
+
var SubAgentToolRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
1443
1428
|
SubAgentToolRelationUpdateSchema
|
|
1444
1429
|
);
|
|
1445
1430
|
var LedgerArtifactSelectSchema = drizzleZod.createSelectSchema(ledgerArtifacts);
|
|
@@ -1470,7 +1455,7 @@ var CanUseItemSchema = zodOpenapi.z.object({
|
|
|
1470
1455
|
toolSelection: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
|
|
1471
1456
|
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1472
1457
|
});
|
|
1473
|
-
var
|
|
1458
|
+
var FullAgentAgentInsertSchema = SubAgentApiInsertSchema.extend({
|
|
1474
1459
|
type: zodOpenapi.z.literal("internal"),
|
|
1475
1460
|
canUse: zodOpenapi.z.array(CanUseItemSchema),
|
|
1476
1461
|
// All tools (both MCP and function tools)
|
|
@@ -1479,44 +1464,23 @@ var FullGraphAgentInsertSchema = SubAgentApiInsertSchema.extend({
|
|
|
1479
1464
|
canTransferTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1480
1465
|
canDelegateTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
1481
1466
|
});
|
|
1482
|
-
var
|
|
1467
|
+
var AgentWithinContextOfProjectSchema = AgentApiInsertSchema.extend({
|
|
1483
1468
|
subAgents: zodOpenapi.z.record(
|
|
1484
1469
|
zodOpenapi.z.string(),
|
|
1485
|
-
zodOpenapi.z.union([
|
|
1470
|
+
zodOpenapi.z.union([FullAgentAgentInsertSchema, ExternalAgentApiInsertSchema])
|
|
1486
1471
|
),
|
|
1487
1472
|
// Lookup maps for UI to resolve canUse items
|
|
1488
1473
|
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
|
|
1489
1474
|
// MCP tools (project-scoped)
|
|
1490
1475
|
functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
|
|
1491
|
-
// Function tools (
|
|
1476
|
+
// Function tools (agent-scoped)
|
|
1492
1477
|
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1493
1478
|
// Get function code for function tools
|
|
1494
1479
|
contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
|
|
1495
1480
|
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
1496
1481
|
models: ModelSchema.optional(),
|
|
1497
|
-
stopWhen:
|
|
1498
|
-
|
|
1499
|
-
});
|
|
1500
|
-
var GraphWithinContextOfProjectSchema = AgentGraphApiInsertSchema.extend({
|
|
1501
|
-
subAgents: zodOpenapi.z.record(
|
|
1502
|
-
zodOpenapi.z.string(),
|
|
1503
|
-
zodOpenapi.z.discriminatedUnion("type", [
|
|
1504
|
-
FullGraphAgentInsertSchema,
|
|
1505
|
-
ExternalAgentApiInsertSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
1506
|
-
])
|
|
1507
|
-
),
|
|
1508
|
-
// Lookup maps for UI to resolve canUse items
|
|
1509
|
-
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
|
|
1510
|
-
// MCP tools (project-scoped)
|
|
1511
|
-
functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
|
|
1512
|
-
// Function tools (graph-scoped)
|
|
1513
|
-
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1514
|
-
// Get function code for function tools
|
|
1515
|
-
contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
|
|
1516
|
-
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
1517
|
-
models: ModelSchema.optional(),
|
|
1518
|
-
stopWhen: GraphStopWhenSchema.optional(),
|
|
1519
|
-
graphPrompt: zodOpenapi.z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
|
|
1482
|
+
stopWhen: AgentStopWhenSchema.optional(),
|
|
1483
|
+
prompt: zodOpenapi.z.string().max(5e3, "Agent prompt cannot exceed 5000 characters").optional()
|
|
1520
1484
|
});
|
|
1521
1485
|
var PaginationSchema = zodOpenapi.z.object({
|
|
1522
1486
|
page: zodOpenapi.z.coerce.number().min(1).default(1),
|
|
@@ -1534,7 +1498,9 @@ var SingleResponseSchema = (itemSchema) => zodOpenapi.z.object({
|
|
|
1534
1498
|
var ErrorResponseSchema = zodOpenapi.z.object({
|
|
1535
1499
|
error: zodOpenapi.z.string(),
|
|
1536
1500
|
message: zodOpenapi.z.string().optional(),
|
|
1537
|
-
details: zodOpenapi.z.
|
|
1501
|
+
details: zodOpenapi.z.any().optional().openapi({
|
|
1502
|
+
description: "Additional error details"
|
|
1503
|
+
})
|
|
1538
1504
|
});
|
|
1539
1505
|
var ExistsResponseSchema = zodOpenapi.z.object({
|
|
1540
1506
|
exists: zodOpenapi.z.boolean()
|
|
@@ -1557,11 +1523,9 @@ var ProjectApiSelectSchema = ProjectSelectSchema.omit({ tenantId: true });
|
|
|
1557
1523
|
var ProjectApiInsertSchema = ProjectInsertSchema.omit({ tenantId: true });
|
|
1558
1524
|
var ProjectApiUpdateSchema = ProjectUpdateSchema.omit({ tenantId: true });
|
|
1559
1525
|
var FullProjectDefinitionSchema = ProjectApiInsertSchema.extend({
|
|
1560
|
-
|
|
1526
|
+
agents: zodOpenapi.z.record(zodOpenapi.z.string(), AgentWithinContextOfProjectSchema),
|
|
1561
1527
|
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema),
|
|
1562
|
-
// MCP tools (project-scoped)
|
|
1563
1528
|
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1564
|
-
// Functions (project-scoped)
|
|
1565
1529
|
dataComponents: zodOpenapi.z.record(zodOpenapi.z.string(), DataComponentApiInsertSchema).optional(),
|
|
1566
1530
|
artifactComponents: zodOpenapi.z.record(zodOpenapi.z.string(), ArtifactComponentApiInsertSchema).optional(),
|
|
1567
1531
|
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
@@ -1578,9 +1542,9 @@ var HeadersScopeSchema = zodOpenapi.z.object({
|
|
|
1578
1542
|
description: "Project identifier",
|
|
1579
1543
|
example: "project_456"
|
|
1580
1544
|
}),
|
|
1581
|
-
"x-inkeep-
|
|
1582
|
-
description: "
|
|
1583
|
-
example: "
|
|
1545
|
+
"x-inkeep-agent-id": zodOpenapi.z.string().optional().openapi({
|
|
1546
|
+
description: "Agent identifier",
|
|
1547
|
+
example: "agent_789"
|
|
1584
1548
|
})
|
|
1585
1549
|
});
|
|
1586
1550
|
var TenantId = zodOpenapi.z.string().openapi({
|
|
@@ -1591,9 +1555,9 @@ var ProjectId = zodOpenapi.z.string().openapi({
|
|
|
1591
1555
|
description: "Project identifier",
|
|
1592
1556
|
example: "project_456"
|
|
1593
1557
|
});
|
|
1594
|
-
var
|
|
1595
|
-
description: "
|
|
1596
|
-
example: "
|
|
1558
|
+
var AgentId = zodOpenapi.z.string().openapi({
|
|
1559
|
+
description: "Agent identifier",
|
|
1560
|
+
example: "agent_789"
|
|
1597
1561
|
});
|
|
1598
1562
|
var SubAgentId = zodOpenapi.z.string().openapi({
|
|
1599
1563
|
description: "Sub-agent identifier",
|
|
@@ -1611,41 +1575,41 @@ var TenantProjectParamsSchema = TenantParamsSchema.extend({
|
|
|
1611
1575
|
var TenantProjectIdParamsSchema = TenantProjectParamsSchema.extend({
|
|
1612
1576
|
id: resourceIdSchema
|
|
1613
1577
|
}).openapi("TenantProjectIdParams");
|
|
1614
|
-
var
|
|
1615
|
-
|
|
1616
|
-
}).openapi("
|
|
1617
|
-
var
|
|
1578
|
+
var TenantProjectAgentParamsSchema = TenantProjectParamsSchema.extend({
|
|
1579
|
+
agentId: AgentId
|
|
1580
|
+
}).openapi("TenantProjectAgentParams");
|
|
1581
|
+
var TenantProjectAgentIdParamsSchema = TenantProjectAgentParamsSchema.extend({
|
|
1618
1582
|
id: resourceIdSchema
|
|
1619
|
-
}).openapi("
|
|
1620
|
-
var
|
|
1583
|
+
}).openapi("TenantProjectAgentIdParams");
|
|
1584
|
+
var TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentParamsSchema.extend({
|
|
1621
1585
|
subAgentId: SubAgentId
|
|
1622
|
-
}).openapi("
|
|
1623
|
-
var
|
|
1586
|
+
}).openapi("TenantProjectAgentSubAgentParams");
|
|
1587
|
+
var TenantProjectAgentSubAgentIdParamsSchema = TenantProjectAgentSubAgentParamsSchema.extend({
|
|
1624
1588
|
id: resourceIdSchema
|
|
1625
|
-
}).openapi("
|
|
1589
|
+
}).openapi("TenantProjectAgentSubAgentIdParams");
|
|
1626
1590
|
var PaginationQueryParamsSchema = zodOpenapi.z.object({
|
|
1627
1591
|
page: zodOpenapi.z.coerce.number().min(1).default(1),
|
|
1628
1592
|
limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10)
|
|
1629
1593
|
});
|
|
1630
1594
|
|
|
1631
|
-
// src/validation/
|
|
1595
|
+
// src/validation/agentFull.ts
|
|
1632
1596
|
function isInternalAgent(agent) {
|
|
1633
1597
|
return "prompt" in agent;
|
|
1634
1598
|
}
|
|
1635
1599
|
function isExternalAgent(agent) {
|
|
1636
1600
|
return "baseUrl" in agent;
|
|
1637
1601
|
}
|
|
1638
|
-
function
|
|
1639
|
-
return
|
|
1602
|
+
function validateAndTypeAgentData(data) {
|
|
1603
|
+
return AgentWithinContextOfProjectSchema.parse(data);
|
|
1640
1604
|
}
|
|
1641
|
-
function validateToolReferences(
|
|
1605
|
+
function validateToolReferences(agentData, availableToolIds) {
|
|
1642
1606
|
if (!availableToolIds) {
|
|
1643
1607
|
return;
|
|
1644
1608
|
}
|
|
1645
1609
|
const errors = [];
|
|
1646
|
-
for (const [subAgentId,
|
|
1647
|
-
if (isInternalAgent(
|
|
1648
|
-
for (const canUseItem of
|
|
1610
|
+
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
1611
|
+
if (isInternalAgent(subAgent) && subAgent.canUse && Array.isArray(subAgent.canUse)) {
|
|
1612
|
+
for (const canUseItem of subAgent.canUse) {
|
|
1649
1613
|
if (!availableToolIds.has(canUseItem.toolId)) {
|
|
1650
1614
|
errors.push(`Agent '${subAgentId}' references non-existent tool '${canUseItem.toolId}'`);
|
|
1651
1615
|
}
|
|
@@ -1657,14 +1621,14 @@ function validateToolReferences(graphData, availableToolIds) {
|
|
|
1657
1621
|
${errors.join("\n")}`);
|
|
1658
1622
|
}
|
|
1659
1623
|
}
|
|
1660
|
-
function validateDataComponentReferences(
|
|
1624
|
+
function validateDataComponentReferences(agentData, availableDataComponentIds) {
|
|
1661
1625
|
if (!availableDataComponentIds) {
|
|
1662
1626
|
return;
|
|
1663
1627
|
}
|
|
1664
1628
|
const errors = [];
|
|
1665
|
-
for (const [subAgentId,
|
|
1666
|
-
if (isInternalAgent(
|
|
1667
|
-
for (const dataComponentId of
|
|
1629
|
+
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
1630
|
+
if (isInternalAgent(subAgent) && subAgent.dataComponents) {
|
|
1631
|
+
for (const dataComponentId of subAgent.dataComponents) {
|
|
1668
1632
|
if (!availableDataComponentIds.has(dataComponentId)) {
|
|
1669
1633
|
errors.push(
|
|
1670
1634
|
`Agent '${subAgentId}' references non-existent dataComponent '${dataComponentId}'`
|
|
@@ -1678,14 +1642,14 @@ function validateDataComponentReferences(graphData, availableDataComponentIds) {
|
|
|
1678
1642
|
${errors.join("\n")}`);
|
|
1679
1643
|
}
|
|
1680
1644
|
}
|
|
1681
|
-
function validateArtifactComponentReferences(
|
|
1645
|
+
function validateArtifactComponentReferences(agentData, availableArtifactComponentIds) {
|
|
1682
1646
|
if (!availableArtifactComponentIds) {
|
|
1683
1647
|
return;
|
|
1684
1648
|
}
|
|
1685
1649
|
const errors = [];
|
|
1686
|
-
for (const [subAgentId,
|
|
1687
|
-
if (isInternalAgent(
|
|
1688
|
-
for (const artifactComponentId of
|
|
1650
|
+
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
1651
|
+
if (isInternalAgent(subAgent) && subAgent.artifactComponents) {
|
|
1652
|
+
for (const artifactComponentId of subAgent.artifactComponents) {
|
|
1689
1653
|
if (!availableArtifactComponentIds.has(artifactComponentId)) {
|
|
1690
1654
|
errors.push(
|
|
1691
1655
|
`Agent '${subAgentId}' references non-existent artifactComponent '${artifactComponentId}'`
|
|
@@ -1699,25 +1663,25 @@ function validateArtifactComponentReferences(graphData, availableArtifactCompone
|
|
|
1699
1663
|
${errors.join("\n")}`);
|
|
1700
1664
|
}
|
|
1701
1665
|
}
|
|
1702
|
-
function validateAgentRelationships(
|
|
1666
|
+
function validateAgentRelationships(agentData) {
|
|
1703
1667
|
const errors = [];
|
|
1704
|
-
const availableAgentIds = new Set(Object.keys(
|
|
1705
|
-
for (const [subAgentId,
|
|
1706
|
-
if (isInternalAgent(
|
|
1707
|
-
if (
|
|
1708
|
-
for (const targetId of
|
|
1668
|
+
const availableAgentIds = new Set(Object.keys(agentData.subAgents));
|
|
1669
|
+
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
1670
|
+
if (isInternalAgent(subAgent)) {
|
|
1671
|
+
if (subAgent.canTransferTo && Array.isArray(subAgent.canTransferTo)) {
|
|
1672
|
+
for (const targetId of subAgent.canTransferTo) {
|
|
1709
1673
|
if (!availableAgentIds.has(targetId)) {
|
|
1710
1674
|
errors.push(
|
|
1711
|
-
`Agent '${subAgentId}' has transfer target '${targetId}' that doesn't exist in
|
|
1675
|
+
`Agent '${subAgentId}' has transfer target '${targetId}' that doesn't exist in agent`
|
|
1712
1676
|
);
|
|
1713
1677
|
}
|
|
1714
1678
|
}
|
|
1715
1679
|
}
|
|
1716
|
-
if (
|
|
1717
|
-
for (const targetId of
|
|
1680
|
+
if (subAgent.canDelegateTo && Array.isArray(subAgent.canDelegateTo)) {
|
|
1681
|
+
for (const targetId of subAgent.canDelegateTo) {
|
|
1718
1682
|
if (!availableAgentIds.has(targetId)) {
|
|
1719
1683
|
errors.push(
|
|
1720
|
-
`Agent '${subAgentId}' has delegation target '${targetId}' that doesn't exist in
|
|
1684
|
+
`Agent '${subAgentId}' has delegation target '${targetId}' that doesn't exist in agent`
|
|
1721
1685
|
);
|
|
1722
1686
|
}
|
|
1723
1687
|
}
|
|
@@ -1729,16 +1693,16 @@ function validateAgentRelationships(graphData) {
|
|
|
1729
1693
|
${errors.join("\n")}`);
|
|
1730
1694
|
}
|
|
1731
1695
|
}
|
|
1732
|
-
function
|
|
1733
|
-
if (
|
|
1734
|
-
throw new Error(`Default agent '${
|
|
1696
|
+
function validateAgentStructure(agentData, projectResources) {
|
|
1697
|
+
if (agentData.defaultSubAgentId && !agentData.subAgents[agentData.defaultSubAgentId]) {
|
|
1698
|
+
throw new Error(`Default agent '${agentData.defaultSubAgentId}' does not exist in agents`);
|
|
1735
1699
|
}
|
|
1736
1700
|
if (projectResources) {
|
|
1737
|
-
validateToolReferences(
|
|
1738
|
-
validateDataComponentReferences(
|
|
1739
|
-
validateArtifactComponentReferences(
|
|
1701
|
+
validateToolReferences(agentData, projectResources.toolIds);
|
|
1702
|
+
validateDataComponentReferences(agentData, projectResources.dataComponentIds);
|
|
1703
|
+
validateArtifactComponentReferences(agentData, projectResources.artifactComponentIds);
|
|
1740
1704
|
}
|
|
1741
|
-
validateAgentRelationships(
|
|
1705
|
+
validateAgentRelationships(agentData);
|
|
1742
1706
|
}
|
|
1743
1707
|
|
|
1744
1708
|
// src/validation/id-validation.ts
|
|
@@ -1862,12 +1826,14 @@ function validatePropsAsJsonSchema(props) {
|
|
|
1862
1826
|
}
|
|
1863
1827
|
|
|
1864
1828
|
exports.A2AMessageMetadataSchema = A2AMessageMetadataSchema;
|
|
1865
|
-
exports.
|
|
1866
|
-
exports.
|
|
1867
|
-
exports.
|
|
1868
|
-
exports.
|
|
1869
|
-
exports.
|
|
1870
|
-
exports.
|
|
1829
|
+
exports.AgentApiInsertSchema = AgentApiInsertSchema;
|
|
1830
|
+
exports.AgentApiSelectSchema = AgentApiSelectSchema;
|
|
1831
|
+
exports.AgentApiUpdateSchema = AgentApiUpdateSchema;
|
|
1832
|
+
exports.AgentInsertSchema = AgentInsertSchema;
|
|
1833
|
+
exports.AgentSelectSchema = AgentSelectSchema;
|
|
1834
|
+
exports.AgentStopWhenSchema = AgentStopWhenSchema;
|
|
1835
|
+
exports.AgentUpdateSchema = AgentUpdateSchema;
|
|
1836
|
+
exports.AgentWithinContextOfProjectSchema = AgentWithinContextOfProjectSchema;
|
|
1871
1837
|
exports.AllAgentSchema = AllAgentSchema;
|
|
1872
1838
|
exports.ApiKeyApiCreationResponseSchema = ApiKeyApiCreationResponseSchema;
|
|
1873
1839
|
exports.ApiKeyApiInsertSchema = ApiKeyApiInsertSchema;
|
|
@@ -1930,8 +1896,7 @@ exports.ExternalSubAgentRelationApiInsertSchema = ExternalSubAgentRelationApiIns
|
|
|
1930
1896
|
exports.ExternalSubAgentRelationInsertSchema = ExternalSubAgentRelationInsertSchema;
|
|
1931
1897
|
exports.FetchConfigSchema = FetchConfigSchema;
|
|
1932
1898
|
exports.FetchDefinitionSchema = FetchDefinitionSchema;
|
|
1933
|
-
exports.
|
|
1934
|
-
exports.FullGraphDefinitionSchema = FullGraphDefinitionSchema;
|
|
1899
|
+
exports.FullAgentAgentInsertSchema = FullAgentAgentInsertSchema;
|
|
1935
1900
|
exports.FullProjectDefinitionSchema = FullProjectDefinitionSchema;
|
|
1936
1901
|
exports.FunctionApiInsertSchema = FunctionApiInsertSchema;
|
|
1937
1902
|
exports.FunctionApiSelectSchema = FunctionApiSelectSchema;
|
|
@@ -1946,8 +1911,6 @@ exports.FunctionToolInsertSchema = FunctionToolInsertSchema;
|
|
|
1946
1911
|
exports.FunctionToolSelectSchema = FunctionToolSelectSchema;
|
|
1947
1912
|
exports.FunctionToolUpdateSchema = FunctionToolUpdateSchema;
|
|
1948
1913
|
exports.FunctionUpdateSchema = FunctionUpdateSchema;
|
|
1949
|
-
exports.GraphStopWhenSchema = GraphStopWhenSchema;
|
|
1950
|
-
exports.GraphWithinContextOfProjectSchema = GraphWithinContextOfProjectSchema;
|
|
1951
1914
|
exports.HeadersScopeSchema = HeadersScopeSchema;
|
|
1952
1915
|
exports.LedgerArtifactApiInsertSchema = LedgerArtifactApiInsertSchema;
|
|
1953
1916
|
exports.LedgerArtifactApiSelectSchema = LedgerArtifactApiSelectSchema;
|
|
@@ -2031,10 +1994,10 @@ exports.TaskSelectSchema = TaskSelectSchema;
|
|
|
2031
1994
|
exports.TaskUpdateSchema = TaskUpdateSchema;
|
|
2032
1995
|
exports.TenantIdParamsSchema = TenantIdParamsSchema;
|
|
2033
1996
|
exports.TenantParamsSchema = TenantParamsSchema;
|
|
2034
|
-
exports.
|
|
2035
|
-
exports.
|
|
2036
|
-
exports.
|
|
2037
|
-
exports.
|
|
1997
|
+
exports.TenantProjectAgentIdParamsSchema = TenantProjectAgentIdParamsSchema;
|
|
1998
|
+
exports.TenantProjectAgentParamsSchema = TenantProjectAgentParamsSchema;
|
|
1999
|
+
exports.TenantProjectAgentSubAgentIdParamsSchema = TenantProjectAgentSubAgentIdParamsSchema;
|
|
2000
|
+
exports.TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentSubAgentParamsSchema;
|
|
2038
2001
|
exports.TenantProjectIdParamsSchema = TenantProjectIdParamsSchema;
|
|
2039
2002
|
exports.TenantProjectParamsSchema = TenantProjectParamsSchema;
|
|
2040
2003
|
exports.ToolApiInsertSchema = ToolApiInsertSchema;
|
|
@@ -2052,9 +2015,9 @@ exports.isInternalAgent = isInternalAgent;
|
|
|
2052
2015
|
exports.isValidResourceId = isValidResourceId;
|
|
2053
2016
|
exports.resourceIdSchema = resourceIdSchema;
|
|
2054
2017
|
exports.validateAgentRelationships = validateAgentRelationships;
|
|
2055
|
-
exports.
|
|
2018
|
+
exports.validateAgentStructure = validateAgentStructure;
|
|
2019
|
+
exports.validateAndTypeAgentData = validateAndTypeAgentData;
|
|
2056
2020
|
exports.validateArtifactComponentReferences = validateArtifactComponentReferences;
|
|
2057
2021
|
exports.validateDataComponentReferences = validateDataComponentReferences;
|
|
2058
|
-
exports.validateGraphStructure = validateGraphStructure;
|
|
2059
2022
|
exports.validatePropsAsJsonSchema = validatePropsAsJsonSchema;
|
|
2060
2023
|
exports.validateToolReferences = validateToolReferences;
|