@inkeep/agents-core 0.17.0 → 0.18.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 +2 -2
- package/dist/{chunk-TO2HNKGP.js → chunk-E4SFK6AI.js} +143 -157
- package/dist/{chunk-VPJ6Z5QZ.js → chunk-ID4CFGVF.js} +202 -131
- package/dist/chunk-JTHQYGCX.js +173 -0
- package/dist/chunk-TCLX6C3C.js +271 -0
- package/dist/client-exports.cjs +622 -272
- package/dist/client-exports.d.cts +6 -5
- package/dist/client-exports.d.ts +6 -5
- package/dist/client-exports.js +5 -4
- package/dist/db/schema.cjs +201 -130
- package/dist/db/schema.d.cts +2 -2
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +2734 -1831
- package/dist/index.d.cts +1664 -1544
- package/dist/index.d.ts +1664 -1544
- package/dist/index.js +1953 -1467
- package/dist/{schema-BQk_FMBV.d.ts → schema-Bjy5TkFv.d.cts} +473 -172
- package/dist/{schema-Ct2NlO81.d.cts → schema-CfWbqju2.d.ts} +473 -172
- package/dist/signoz-queries-CifqdbnO.d.cts +269 -0
- package/dist/signoz-queries-CifqdbnO.d.ts +269 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/{utility-s9c5CVOe.d.cts → utility-Fxoh7s82.d.cts} +585 -384
- package/dist/{utility-s9c5CVOe.d.ts → utility-Fxoh7s82.d.ts} +585 -384
- package/dist/validation/index.cjs +429 -325
- package/dist/validation/index.d.cts +76 -4
- package/dist/validation/index.d.ts +76 -4
- package/dist/validation/index.js +2 -2
- package/drizzle/0005_wide_shriek.sql +127 -0
- package/drizzle/0006_damp_lenny_balinger.sql +52 -0
- package/drizzle/meta/0005_snapshot.json +2558 -0
- package/drizzle/meta/0006_snapshot.json +2751 -0
- package/drizzle/meta/_journal.json +14 -0
- package/package.json +1 -1
- package/dist/chunk-L53XWAYG.js +0 -134
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var zod = require('zod');
|
|
3
4
|
var zodOpenapi = require('@hono/zod-openapi');
|
|
4
5
|
var drizzleZod = require('drizzle-zod');
|
|
5
6
|
var drizzleOrm = require('drizzle-orm');
|
|
@@ -10,7 +11,44 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
10
11
|
|
|
11
12
|
var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
|
|
12
13
|
|
|
13
|
-
// src/validation/schemas.ts
|
|
14
|
+
// src/validation/event-schemas.ts
|
|
15
|
+
var TransferDataSchema = zod.z.object({
|
|
16
|
+
fromSubAgent: zod.z.string().describe("ID of the sub-agent transferring control"),
|
|
17
|
+
targetSubAgent: zod.z.string().describe("ID of the sub-agent receiving control"),
|
|
18
|
+
reason: zod.z.string().optional().describe("Reason for the transfer"),
|
|
19
|
+
context: zod.z.any().optional().describe("Additional context data")
|
|
20
|
+
});
|
|
21
|
+
var DelegationSentDataSchema = zod.z.object({
|
|
22
|
+
delegationId: zod.z.string().describe("Unique identifier for this delegation"),
|
|
23
|
+
fromSubAgent: zod.z.string().describe("ID of the delegating sub-agent"),
|
|
24
|
+
targetSubAgent: zod.z.string().describe("ID of the sub-agent receiving the delegation"),
|
|
25
|
+
taskDescription: zod.z.string().describe("Description of the delegated task"),
|
|
26
|
+
context: zod.z.any().optional().describe("Additional context data")
|
|
27
|
+
});
|
|
28
|
+
var DelegationReturnedDataSchema = zod.z.object({
|
|
29
|
+
delegationId: zod.z.string().describe("Unique identifier matching the original delegation"),
|
|
30
|
+
fromSubAgent: zod.z.string().describe("ID of the sub-agent that completed the task"),
|
|
31
|
+
targetSubAgent: zod.z.string().describe("ID of the sub-agent receiving the result"),
|
|
32
|
+
result: zod.z.any().optional().describe("Result data from the delegated task")
|
|
33
|
+
});
|
|
34
|
+
var DataOperationDetailsSchema = zod.z.object({
|
|
35
|
+
timestamp: zod.z.number().describe("Unix timestamp in milliseconds"),
|
|
36
|
+
subAgentId: zod.z.string().describe("ID of the sub-agent that generated this data"),
|
|
37
|
+
data: zod.z.any().describe("The actual data payload")
|
|
38
|
+
});
|
|
39
|
+
var DataOperationEventSchema = zod.z.object({
|
|
40
|
+
type: zod.z.string().describe("Event type identifier"),
|
|
41
|
+
label: zod.z.string().describe("Human-readable label for the event"),
|
|
42
|
+
details: DataOperationDetailsSchema
|
|
43
|
+
});
|
|
44
|
+
var A2AMessageMetadataSchema = zod.z.object({
|
|
45
|
+
fromSubAgentId: zod.z.string().optional().describe("ID of the sending sub-agent"),
|
|
46
|
+
toSubAgentId: zod.z.string().optional().describe("ID of the receiving sub-agent"),
|
|
47
|
+
fromExternalAgentId: zod.z.string().optional().describe("ID of the sending external agent"),
|
|
48
|
+
toExternalAgentId: zod.z.string().optional().describe("ID of the receiving external agent"),
|
|
49
|
+
taskId: zod.z.string().optional().describe("Associated task ID"),
|
|
50
|
+
a2aTaskId: zod.z.string().optional().describe("A2A-specific task ID")
|
|
51
|
+
});
|
|
14
52
|
var tenantScoped = {
|
|
15
53
|
tenantId: sqliteCore.text("tenant_id").notNull(),
|
|
16
54
|
id: sqliteCore.text("id").notNull()
|
|
@@ -23,9 +61,9 @@ var graphScoped = {
|
|
|
23
61
|
...projectScoped,
|
|
24
62
|
graphId: sqliteCore.text("graph_id").notNull()
|
|
25
63
|
};
|
|
26
|
-
var
|
|
64
|
+
var subAgentScoped = {
|
|
27
65
|
...graphScoped,
|
|
28
|
-
|
|
66
|
+
subAgentId: sqliteCore.text("sub_agent_id").notNull()
|
|
29
67
|
};
|
|
30
68
|
var uiProperties = {
|
|
31
69
|
name: sqliteCore.text("name").notNull(),
|
|
@@ -56,7 +94,7 @@ var agentGraph = sqliteCore.sqliteTable(
|
|
|
56
94
|
...projectScoped,
|
|
57
95
|
name: sqliteCore.text("name").notNull(),
|
|
58
96
|
description: sqliteCore.text("description"),
|
|
59
|
-
|
|
97
|
+
defaultSubAgentId: sqliteCore.text("default_sub_agent_id"),
|
|
60
98
|
// Reference to shared context configuration for all agents in this graph
|
|
61
99
|
contextConfigId: sqliteCore.text("context_config_id"),
|
|
62
100
|
// add fk relationship
|
|
@@ -135,8 +173,8 @@ var contextCache = sqliteCore.sqliteTable(
|
|
|
135
173
|
)
|
|
136
174
|
]
|
|
137
175
|
);
|
|
138
|
-
var
|
|
139
|
-
"
|
|
176
|
+
var subAgents = sqliteCore.sqliteTable(
|
|
177
|
+
"sub_agents",
|
|
140
178
|
{
|
|
141
179
|
...graphScoped,
|
|
142
180
|
...uiProperties,
|
|
@@ -158,17 +196,16 @@ var agents = sqliteCore.sqliteTable(
|
|
|
158
196
|
}).onDelete("cascade")
|
|
159
197
|
]
|
|
160
198
|
);
|
|
161
|
-
var
|
|
162
|
-
"
|
|
199
|
+
var subAgentRelations = sqliteCore.sqliteTable(
|
|
200
|
+
"sub_agent_relations",
|
|
163
201
|
{
|
|
164
202
|
...graphScoped,
|
|
165
|
-
|
|
203
|
+
sourceSubAgentId: sqliteCore.text("source_sub_agent_id").notNull(),
|
|
166
204
|
// For internal relationships
|
|
167
|
-
|
|
205
|
+
targetSubAgentId: sqliteCore.text("target_sub_agent_id"),
|
|
168
206
|
// For external relationships
|
|
169
|
-
|
|
207
|
+
externalSubAgentId: sqliteCore.text("external_sub_agent_id"),
|
|
170
208
|
relationType: sqliteCore.text("relation_type"),
|
|
171
|
-
// 'transfer' | 'delegate'
|
|
172
209
|
...timestamps
|
|
173
210
|
},
|
|
174
211
|
(table) => [
|
|
@@ -176,7 +213,7 @@ var agentRelations = sqliteCore.sqliteTable(
|
|
|
176
213
|
sqliteCore.foreignKey({
|
|
177
214
|
columns: [table.tenantId, table.projectId, table.graphId],
|
|
178
215
|
foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
|
|
179
|
-
name: "
|
|
216
|
+
name: "sub_agent_relations_graph_fk"
|
|
180
217
|
}).onDelete("cascade")
|
|
181
218
|
]
|
|
182
219
|
);
|
|
@@ -212,7 +249,7 @@ var externalAgents = sqliteCore.sqliteTable(
|
|
|
212
249
|
var tasks = sqliteCore.sqliteTable(
|
|
213
250
|
"tasks",
|
|
214
251
|
{
|
|
215
|
-
...
|
|
252
|
+
...subAgentScoped,
|
|
216
253
|
contextId: sqliteCore.text("context_id").notNull(),
|
|
217
254
|
status: sqliteCore.text("status").notNull(),
|
|
218
255
|
metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
|
|
@@ -221,9 +258,9 @@ var tasks = sqliteCore.sqliteTable(
|
|
|
221
258
|
(table) => [
|
|
222
259
|
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
223
260
|
sqliteCore.foreignKey({
|
|
224
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
225
|
-
foreignColumns: [
|
|
226
|
-
name: "
|
|
261
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
262
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
263
|
+
name: "tasks_sub_agent_fk"
|
|
227
264
|
}).onDelete("cascade")
|
|
228
265
|
]
|
|
229
266
|
);
|
|
@@ -263,10 +300,10 @@ var dataComponents = sqliteCore.sqliteTable(
|
|
|
263
300
|
}).onDelete("cascade")
|
|
264
301
|
]
|
|
265
302
|
);
|
|
266
|
-
var
|
|
267
|
-
"
|
|
303
|
+
var subAgentDataComponents = sqliteCore.sqliteTable(
|
|
304
|
+
"sub_agent_data_components",
|
|
268
305
|
{
|
|
269
|
-
...
|
|
306
|
+
...subAgentScoped,
|
|
270
307
|
dataComponentId: sqliteCore.text("data_component_id").notNull(),
|
|
271
308
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
272
309
|
},
|
|
@@ -274,15 +311,15 @@ var agentDataComponents = sqliteCore.sqliteTable(
|
|
|
274
311
|
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
275
312
|
// Foreign key constraint to agents table (ensures graph and project exist via cascade)
|
|
276
313
|
sqliteCore.foreignKey({
|
|
277
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
278
|
-
foreignColumns: [
|
|
279
|
-
name: "
|
|
314
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
315
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
316
|
+
name: "sub_agent_data_components_sub_agent_fk"
|
|
280
317
|
}).onDelete("cascade"),
|
|
281
318
|
// Foreign key constraint to data_components table
|
|
282
319
|
sqliteCore.foreignKey({
|
|
283
320
|
columns: [table.tenantId, table.projectId, table.dataComponentId],
|
|
284
321
|
foreignColumns: [dataComponents.tenantId, dataComponents.projectId, dataComponents.id],
|
|
285
|
-
name: "
|
|
322
|
+
name: "sub_agent_data_components_data_component_fk"
|
|
286
323
|
}).onDelete("cascade")
|
|
287
324
|
]
|
|
288
325
|
);
|
|
@@ -303,22 +340,22 @@ var artifactComponents = sqliteCore.sqliteTable(
|
|
|
303
340
|
}).onDelete("cascade")
|
|
304
341
|
]
|
|
305
342
|
);
|
|
306
|
-
var
|
|
307
|
-
"
|
|
343
|
+
var subAgentArtifactComponents = sqliteCore.sqliteTable(
|
|
344
|
+
"sub_agent_artifact_components",
|
|
308
345
|
{
|
|
309
|
-
...
|
|
346
|
+
...subAgentScoped,
|
|
310
347
|
artifactComponentId: sqliteCore.text("artifact_component_id").notNull(),
|
|
311
348
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
312
349
|
},
|
|
313
350
|
(table) => [
|
|
314
351
|
sqliteCore.primaryKey({
|
|
315
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
352
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId, table.id]
|
|
316
353
|
}),
|
|
317
354
|
// Foreign key constraint to agents table (ensures graph and project exist via cascade)
|
|
318
355
|
sqliteCore.foreignKey({
|
|
319
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
320
|
-
foreignColumns: [
|
|
321
|
-
name: "
|
|
356
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
357
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
358
|
+
name: "sub_agent_artifact_components_sub_agent_fk"
|
|
322
359
|
}).onDelete("cascade"),
|
|
323
360
|
// Foreign key constraint to artifact_components table
|
|
324
361
|
sqliteCore.foreignKey({
|
|
@@ -328,7 +365,7 @@ var agentArtifactComponents = sqliteCore.sqliteTable(
|
|
|
328
365
|
artifactComponents.projectId,
|
|
329
366
|
artifactComponents.id
|
|
330
367
|
],
|
|
331
|
-
name: "
|
|
368
|
+
name: "sub_agent_artifact_components_artifact_component_fk"
|
|
332
369
|
}).onDelete("cascade")
|
|
333
370
|
]
|
|
334
371
|
);
|
|
@@ -338,10 +375,7 @@ var tools = sqliteCore.sqliteTable(
|
|
|
338
375
|
...projectScoped,
|
|
339
376
|
name: sqliteCore.text("name").notNull(),
|
|
340
377
|
description: sqliteCore.text("description"),
|
|
341
|
-
// Tool configuration - supports both MCP and function tools
|
|
342
378
|
config: sqliteCore.blob("config", { mode: "json" }).$type().notNull(),
|
|
343
|
-
// For function tools, reference the global functions table
|
|
344
|
-
functionId: sqliteCore.text("function_id"),
|
|
345
379
|
credentialReferenceId: sqliteCore.text("credential_reference_id"),
|
|
346
380
|
headers: sqliteCore.blob("headers", { mode: "json" }).$type(),
|
|
347
381
|
// Image URL for custom tool icon (supports regular URLs and base64 encoded images)
|
|
@@ -357,12 +391,30 @@ var tools = sqliteCore.sqliteTable(
|
|
|
357
391
|
columns: [table.tenantId, table.projectId],
|
|
358
392
|
foreignColumns: [projects.tenantId, projects.id],
|
|
359
393
|
name: "tools_project_fk"
|
|
394
|
+
}).onDelete("cascade")
|
|
395
|
+
]
|
|
396
|
+
);
|
|
397
|
+
var functionTools = sqliteCore.sqliteTable(
|
|
398
|
+
"function_tools",
|
|
399
|
+
{
|
|
400
|
+
...graphScoped,
|
|
401
|
+
name: sqliteCore.text("name").notNull(),
|
|
402
|
+
description: sqliteCore.text("description"),
|
|
403
|
+
functionId: sqliteCore.text("function_id").notNull(),
|
|
404
|
+
...timestamps
|
|
405
|
+
},
|
|
406
|
+
(table) => [
|
|
407
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
408
|
+
sqliteCore.foreignKey({
|
|
409
|
+
columns: [table.tenantId, table.projectId, table.graphId],
|
|
410
|
+
foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
|
|
411
|
+
name: "function_tools_graph_fk"
|
|
360
412
|
}).onDelete("cascade"),
|
|
361
|
-
// Foreign key constraint to functions table
|
|
413
|
+
// Foreign key constraint to functions table
|
|
362
414
|
sqliteCore.foreignKey({
|
|
363
415
|
columns: [table.tenantId, table.projectId, table.functionId],
|
|
364
416
|
foreignColumns: [functions.tenantId, functions.projectId, functions.id],
|
|
365
|
-
name: "
|
|
417
|
+
name: "function_tools_function_fk"
|
|
366
418
|
}).onDelete("cascade")
|
|
367
419
|
]
|
|
368
420
|
);
|
|
@@ -384,10 +436,10 @@ var functions = sqliteCore.sqliteTable(
|
|
|
384
436
|
}).onDelete("cascade")
|
|
385
437
|
]
|
|
386
438
|
);
|
|
387
|
-
var
|
|
388
|
-
"
|
|
439
|
+
var subAgentToolRelations = sqliteCore.sqliteTable(
|
|
440
|
+
"sub_agent_tool_relations",
|
|
389
441
|
{
|
|
390
|
-
...
|
|
442
|
+
...subAgentScoped,
|
|
391
443
|
toolId: sqliteCore.text("tool_id").notNull(),
|
|
392
444
|
selectedTools: sqliteCore.blob("selected_tools", { mode: "json" }).$type(),
|
|
393
445
|
headers: sqliteCore.blob("headers", { mode: "json" }).$type(),
|
|
@@ -397,15 +449,43 @@ var agentToolRelations = sqliteCore.sqliteTable(
|
|
|
397
449
|
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
398
450
|
// Foreign key constraint to agents table (which includes project and graph scope)
|
|
399
451
|
sqliteCore.foreignKey({
|
|
400
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
401
|
-
foreignColumns: [
|
|
402
|
-
name: "
|
|
452
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
453
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
454
|
+
name: "sub_agent_tool_relations_agent_fk"
|
|
403
455
|
}).onDelete("cascade"),
|
|
404
|
-
// Foreign key constraint to tools table
|
|
456
|
+
// Foreign key constraint to tools table (MCP tools)
|
|
405
457
|
sqliteCore.foreignKey({
|
|
406
458
|
columns: [table.tenantId, table.projectId, table.toolId],
|
|
407
459
|
foreignColumns: [tools.tenantId, tools.projectId, tools.id],
|
|
408
|
-
name: "
|
|
460
|
+
name: "sub_agent_tool_relations_tool_fk"
|
|
461
|
+
}).onDelete("cascade")
|
|
462
|
+
]
|
|
463
|
+
);
|
|
464
|
+
var agentFunctionToolRelations = sqliteCore.sqliteTable(
|
|
465
|
+
"agent_function_tool_relations",
|
|
466
|
+
{
|
|
467
|
+
...subAgentScoped,
|
|
468
|
+
functionToolId: sqliteCore.text("function_tool_id").notNull(),
|
|
469
|
+
...timestamps
|
|
470
|
+
},
|
|
471
|
+
(table) => [
|
|
472
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
473
|
+
// Foreign key constraint to agents table
|
|
474
|
+
sqliteCore.foreignKey({
|
|
475
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
476
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
477
|
+
name: "agent_function_tool_relations_agent_fk"
|
|
478
|
+
}).onDelete("cascade"),
|
|
479
|
+
// Foreign key constraint to functionTools table
|
|
480
|
+
sqliteCore.foreignKey({
|
|
481
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.functionToolId],
|
|
482
|
+
foreignColumns: [
|
|
483
|
+
functionTools.tenantId,
|
|
484
|
+
functionTools.projectId,
|
|
485
|
+
functionTools.graphId,
|
|
486
|
+
functionTools.id
|
|
487
|
+
],
|
|
488
|
+
name: "agent_function_tool_relations_function_tool_fk"
|
|
409
489
|
}).onDelete("cascade")
|
|
410
490
|
]
|
|
411
491
|
);
|
|
@@ -414,7 +494,7 @@ var conversations = sqliteCore.sqliteTable(
|
|
|
414
494
|
{
|
|
415
495
|
...projectScoped,
|
|
416
496
|
userId: sqliteCore.text("user_id"),
|
|
417
|
-
|
|
497
|
+
activeSubAgentId: sqliteCore.text("active_sub_agent_id").notNull(),
|
|
418
498
|
title: sqliteCore.text("title"),
|
|
419
499
|
lastContextResolution: sqliteCore.text("last_context_resolution"),
|
|
420
500
|
metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
|
|
@@ -438,15 +518,15 @@ var messages = sqliteCore.sqliteTable(
|
|
|
438
518
|
role: sqliteCore.text("role").notNull(),
|
|
439
519
|
// 'user' | 'agent' | 'system'
|
|
440
520
|
// Agent sender/recipient tracking (nullable - only populated when relevant)
|
|
441
|
-
|
|
521
|
+
fromSubAgentId: sqliteCore.text("from_sub_agent_id"),
|
|
442
522
|
// Populated when message is from an agent
|
|
443
|
-
|
|
523
|
+
toSubAgentId: sqliteCore.text("to_sub_agent_id"),
|
|
444
524
|
// Populated when message is directed to a specific agent (e.g., transfers/delegations)
|
|
445
525
|
// External agent sender tracking
|
|
446
|
-
fromExternalAgentId: sqliteCore.text("
|
|
526
|
+
fromExternalAgentId: sqliteCore.text("from_external_sub_agent_id"),
|
|
447
527
|
// Populated when message is directed from an external agent
|
|
448
528
|
// External agent recipient tracking
|
|
449
|
-
toExternalAgentId: sqliteCore.text("
|
|
529
|
+
toExternalAgentId: sqliteCore.text("to_external_sub_agent_id"),
|
|
450
530
|
// Populated when message is directed to an external agent
|
|
451
531
|
// Message content stored as JSON to support both formats
|
|
452
532
|
content: sqliteCore.blob("content", { mode: "json" }).$type().notNull(),
|
|
@@ -455,8 +535,6 @@ var messages = sqliteCore.sqliteTable(
|
|
|
455
535
|
// 'user-facing' | 'internal' | 'system' | 'external'
|
|
456
536
|
messageType: sqliteCore.text("message_type").notNull().default("chat"),
|
|
457
537
|
// 'chat' | 'a2a-request' | 'a2a-response' | 'task-update' | 'tool-call'
|
|
458
|
-
// Legacy agent association (consider deprecating in favor of fromAgentId/toAgentId)
|
|
459
|
-
agentId: sqliteCore.text("agent_id"),
|
|
460
538
|
taskId: sqliteCore.text("task_id"),
|
|
461
539
|
parentMessageId: sqliteCore.text("parent_message_id"),
|
|
462
540
|
// Remove self-reference constraint here
|
|
@@ -583,10 +661,9 @@ drizzleOrm.relations(tasks, ({ one, many }) => ({
|
|
|
583
661
|
childRelations: many(taskRelations, {
|
|
584
662
|
relationName: "parentTask"
|
|
585
663
|
}),
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
references: [agents.id]
|
|
664
|
+
subAgent: one(subAgents, {
|
|
665
|
+
fields: [tasks.subAgentId],
|
|
666
|
+
references: [subAgents.id]
|
|
590
667
|
}),
|
|
591
668
|
// A task can have many messages associated with it
|
|
592
669
|
messages: many(messages),
|
|
@@ -594,9 +671,10 @@ drizzleOrm.relations(tasks, ({ one, many }) => ({
|
|
|
594
671
|
ledgerArtifacts: many(ledgerArtifacts)
|
|
595
672
|
}));
|
|
596
673
|
drizzleOrm.relations(projects, ({ many }) => ({
|
|
597
|
-
|
|
674
|
+
subAgents: many(subAgents),
|
|
598
675
|
agentGraphs: many(agentGraph),
|
|
599
676
|
tools: many(tools),
|
|
677
|
+
functions: many(functions),
|
|
600
678
|
contextConfigs: many(contextConfigs),
|
|
601
679
|
externalAgents: many(externalAgents),
|
|
602
680
|
conversations: many(conversations),
|
|
@@ -632,17 +710,17 @@ drizzleOrm.relations(contextCache, ({ one }) => ({
|
|
|
632
710
|
references: [contextConfigs.id]
|
|
633
711
|
})
|
|
634
712
|
}));
|
|
635
|
-
drizzleOrm.relations(
|
|
713
|
+
drizzleOrm.relations(subAgents, ({ many, one }) => ({
|
|
636
714
|
project: one(projects, {
|
|
637
|
-
fields: [
|
|
715
|
+
fields: [subAgents.tenantId, subAgents.projectId],
|
|
638
716
|
references: [projects.tenantId, projects.id]
|
|
639
717
|
}),
|
|
640
718
|
tasks: many(tasks),
|
|
641
719
|
defaultForGraphs: many(agentGraph),
|
|
642
|
-
sourceRelations: many(
|
|
720
|
+
sourceRelations: many(subAgentRelations, {
|
|
643
721
|
relationName: "sourceRelations"
|
|
644
722
|
}),
|
|
645
|
-
targetRelations: many(
|
|
723
|
+
targetRelations: many(subAgentRelations, {
|
|
646
724
|
relationName: "targetRelations"
|
|
647
725
|
}),
|
|
648
726
|
sentMessages: many(messages, {
|
|
@@ -654,30 +732,32 @@ drizzleOrm.relations(agents, ({ many, one }) => ({
|
|
|
654
732
|
associatedMessages: many(messages, {
|
|
655
733
|
relationName: "associatedAgent"
|
|
656
734
|
}),
|
|
657
|
-
toolRelations: many(
|
|
658
|
-
|
|
659
|
-
|
|
735
|
+
toolRelations: many(subAgentToolRelations),
|
|
736
|
+
functionToolRelations: many(agentFunctionToolRelations),
|
|
737
|
+
dataComponentRelations: many(subAgentDataComponents),
|
|
738
|
+
artifactComponentRelations: many(subAgentArtifactComponents)
|
|
660
739
|
}));
|
|
661
|
-
drizzleOrm.relations(agentGraph, ({ one }) => ({
|
|
740
|
+
drizzleOrm.relations(agentGraph, ({ one, many }) => ({
|
|
662
741
|
project: one(projects, {
|
|
663
742
|
fields: [agentGraph.tenantId, agentGraph.projectId],
|
|
664
743
|
references: [projects.tenantId, projects.id]
|
|
665
744
|
}),
|
|
666
|
-
|
|
667
|
-
fields: [agentGraph.
|
|
668
|
-
references: [
|
|
745
|
+
defaultSubAgent: one(subAgents, {
|
|
746
|
+
fields: [agentGraph.defaultSubAgentId],
|
|
747
|
+
references: [subAgents.id]
|
|
669
748
|
}),
|
|
670
749
|
contextConfig: one(contextConfigs, {
|
|
671
750
|
fields: [agentGraph.contextConfigId],
|
|
672
751
|
references: [contextConfigs.id]
|
|
673
|
-
})
|
|
752
|
+
}),
|
|
753
|
+
functionTools: many(functionTools)
|
|
674
754
|
}));
|
|
675
755
|
drizzleOrm.relations(externalAgents, ({ one, many }) => ({
|
|
676
756
|
project: one(projects, {
|
|
677
757
|
fields: [externalAgents.tenantId, externalAgents.projectId],
|
|
678
758
|
references: [projects.tenantId, projects.id]
|
|
679
759
|
}),
|
|
680
|
-
|
|
760
|
+
subAgentRelations: many(subAgentRelations),
|
|
681
761
|
credentialReference: one(credentialReferences, {
|
|
682
762
|
fields: [externalAgents.credentialReferenceId],
|
|
683
763
|
references: [credentialReferences.id]
|
|
@@ -693,13 +773,13 @@ drizzleOrm.relations(apiKeys, ({ one }) => ({
|
|
|
693
773
|
references: [agentGraph.id]
|
|
694
774
|
})
|
|
695
775
|
}));
|
|
696
|
-
drizzleOrm.relations(
|
|
697
|
-
|
|
698
|
-
fields: [
|
|
699
|
-
references: [
|
|
776
|
+
drizzleOrm.relations(subAgentToolRelations, ({ one }) => ({
|
|
777
|
+
subAgent: one(subAgents, {
|
|
778
|
+
fields: [subAgentToolRelations.subAgentId],
|
|
779
|
+
references: [subAgents.id]
|
|
700
780
|
}),
|
|
701
781
|
tool: one(tools, {
|
|
702
|
-
fields: [
|
|
782
|
+
fields: [subAgentToolRelations.toolId],
|
|
703
783
|
references: [tools.id]
|
|
704
784
|
})
|
|
705
785
|
}));
|
|
@@ -711,14 +791,10 @@ drizzleOrm.relations(tools, ({ one, many }) => ({
|
|
|
711
791
|
fields: [tools.tenantId, tools.projectId],
|
|
712
792
|
references: [projects.tenantId, projects.id]
|
|
713
793
|
}),
|
|
714
|
-
|
|
794
|
+
subAgentRelations: many(subAgentToolRelations),
|
|
715
795
|
credentialReference: one(credentialReferences, {
|
|
716
796
|
fields: [tools.credentialReferenceId],
|
|
717
797
|
references: [credentialReferences.id]
|
|
718
|
-
}),
|
|
719
|
-
function: one(functions, {
|
|
720
|
-
fields: [tools.functionId],
|
|
721
|
-
references: [functions.id]
|
|
722
798
|
})
|
|
723
799
|
}));
|
|
724
800
|
drizzleOrm.relations(conversations, ({ one, many }) => ({
|
|
@@ -727,9 +803,9 @@ drizzleOrm.relations(conversations, ({ one, many }) => ({
|
|
|
727
803
|
references: [projects.tenantId, projects.id]
|
|
728
804
|
}),
|
|
729
805
|
messages: many(messages),
|
|
730
|
-
|
|
731
|
-
fields: [conversations.
|
|
732
|
-
references: [
|
|
806
|
+
activeSubAgent: one(subAgents, {
|
|
807
|
+
fields: [conversations.activeSubAgentId],
|
|
808
|
+
references: [subAgents.id]
|
|
733
809
|
})
|
|
734
810
|
}));
|
|
735
811
|
drizzleOrm.relations(messages, ({ one, many }) => ({
|
|
@@ -737,20 +813,14 @@ drizzleOrm.relations(messages, ({ one, many }) => ({
|
|
|
737
813
|
fields: [messages.conversationId],
|
|
738
814
|
references: [conversations.id]
|
|
739
815
|
}),
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
references: [agents.id],
|
|
744
|
-
relationName: "associatedAgent"
|
|
745
|
-
}),
|
|
746
|
-
fromAgent: one(agents, {
|
|
747
|
-
fields: [messages.fromAgentId],
|
|
748
|
-
references: [agents.id],
|
|
816
|
+
fromSubAgent: one(subAgents, {
|
|
817
|
+
fields: [messages.fromSubAgentId],
|
|
818
|
+
references: [subAgents.id],
|
|
749
819
|
relationName: "sentMessages"
|
|
750
820
|
}),
|
|
751
|
-
|
|
752
|
-
fields: [messages.
|
|
753
|
-
references: [
|
|
821
|
+
toSubAgent: one(subAgents, {
|
|
822
|
+
fields: [messages.toSubAgentId],
|
|
823
|
+
references: [subAgents.id],
|
|
754
824
|
relationName: "receivedMessages"
|
|
755
825
|
}),
|
|
756
826
|
fromExternalAgent: one(externalAgents, {
|
|
@@ -776,33 +846,40 @@ drizzleOrm.relations(messages, ({ one, many }) => ({
|
|
|
776
846
|
relationName: "parentChild"
|
|
777
847
|
})
|
|
778
848
|
}));
|
|
779
|
-
drizzleOrm.relations(artifactComponents, ({ many }) => ({
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
agent: one(agents, {
|
|
784
|
-
fields: [agentArtifactComponents.agentId],
|
|
785
|
-
references: [agents.id]
|
|
849
|
+
drizzleOrm.relations(artifactComponents, ({ many, one }) => ({
|
|
850
|
+
project: one(projects, {
|
|
851
|
+
fields: [artifactComponents.tenantId, artifactComponents.projectId],
|
|
852
|
+
references: [projects.tenantId, projects.id]
|
|
786
853
|
}),
|
|
787
|
-
|
|
788
|
-
fields: [agentArtifactComponents.artifactComponentId],
|
|
789
|
-
references: [artifactComponents.id]
|
|
790
|
-
})
|
|
854
|
+
subAgentRelations: many(subAgentArtifactComponents)
|
|
791
855
|
}));
|
|
856
|
+
drizzleOrm.relations(
|
|
857
|
+
subAgentArtifactComponents,
|
|
858
|
+
({ one }) => ({
|
|
859
|
+
subAgent: one(subAgents, {
|
|
860
|
+
fields: [subAgentArtifactComponents.subAgentId],
|
|
861
|
+
references: [subAgents.id]
|
|
862
|
+
}),
|
|
863
|
+
artifactComponent: one(artifactComponents, {
|
|
864
|
+
fields: [subAgentArtifactComponents.artifactComponentId],
|
|
865
|
+
references: [artifactComponents.id]
|
|
866
|
+
})
|
|
867
|
+
})
|
|
868
|
+
);
|
|
792
869
|
drizzleOrm.relations(dataComponents, ({ many, one }) => ({
|
|
793
870
|
project: one(projects, {
|
|
794
871
|
fields: [dataComponents.tenantId, dataComponents.projectId],
|
|
795
872
|
references: [projects.tenantId, projects.id]
|
|
796
873
|
}),
|
|
797
|
-
|
|
874
|
+
subAgentRelations: many(subAgentDataComponents)
|
|
798
875
|
}));
|
|
799
|
-
drizzleOrm.relations(
|
|
800
|
-
|
|
801
|
-
fields: [
|
|
802
|
-
references: [
|
|
876
|
+
drizzleOrm.relations(subAgentDataComponents, ({ one }) => ({
|
|
877
|
+
subAgent: one(subAgents, {
|
|
878
|
+
fields: [subAgentDataComponents.subAgentId],
|
|
879
|
+
references: [subAgents.id]
|
|
803
880
|
}),
|
|
804
881
|
dataComponent: one(dataComponents, {
|
|
805
|
-
fields: [
|
|
882
|
+
fields: [subAgentDataComponents.dataComponentId],
|
|
806
883
|
references: [dataComponents.id]
|
|
807
884
|
})
|
|
808
885
|
}));
|
|
@@ -817,28 +894,56 @@ drizzleOrm.relations(ledgerArtifacts, ({ one }) => ({
|
|
|
817
894
|
})
|
|
818
895
|
}));
|
|
819
896
|
drizzleOrm.relations(functions, ({ many }) => ({
|
|
820
|
-
|
|
897
|
+
functionTools: many(functionTools)
|
|
821
898
|
}));
|
|
822
|
-
drizzleOrm.relations(
|
|
899
|
+
drizzleOrm.relations(subAgentRelations, ({ one }) => ({
|
|
823
900
|
graph: one(agentGraph, {
|
|
824
|
-
fields: [
|
|
901
|
+
fields: [subAgentRelations.graphId],
|
|
825
902
|
references: [agentGraph.id]
|
|
826
903
|
}),
|
|
827
|
-
|
|
828
|
-
fields: [
|
|
829
|
-
references: [
|
|
904
|
+
sourceSubAgent: one(subAgents, {
|
|
905
|
+
fields: [subAgentRelations.sourceSubAgentId],
|
|
906
|
+
references: [subAgents.id],
|
|
830
907
|
relationName: "sourceRelations"
|
|
831
908
|
}),
|
|
832
|
-
|
|
833
|
-
fields: [
|
|
834
|
-
references: [
|
|
909
|
+
targetSubAgent: one(subAgents, {
|
|
910
|
+
fields: [subAgentRelations.targetSubAgentId],
|
|
911
|
+
references: [subAgents.id],
|
|
835
912
|
relationName: "targetRelations"
|
|
836
913
|
}),
|
|
837
914
|
externalAgent: one(externalAgents, {
|
|
838
|
-
fields: [
|
|
915
|
+
fields: [subAgentRelations.externalSubAgentId],
|
|
839
916
|
references: [externalAgents.id]
|
|
840
917
|
})
|
|
841
918
|
}));
|
|
919
|
+
drizzleOrm.relations(functionTools, ({ one, many }) => ({
|
|
920
|
+
project: one(projects, {
|
|
921
|
+
fields: [functionTools.tenantId, functionTools.projectId],
|
|
922
|
+
references: [projects.tenantId, projects.id]
|
|
923
|
+
}),
|
|
924
|
+
graph: one(agentGraph, {
|
|
925
|
+
fields: [functionTools.tenantId, functionTools.projectId, functionTools.graphId],
|
|
926
|
+
references: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id]
|
|
927
|
+
}),
|
|
928
|
+
function: one(functions, {
|
|
929
|
+
fields: [functionTools.tenantId, functionTools.projectId, functionTools.functionId],
|
|
930
|
+
references: [functions.tenantId, functions.projectId, functions.id]
|
|
931
|
+
}),
|
|
932
|
+
agentRelations: many(agentFunctionToolRelations)
|
|
933
|
+
}));
|
|
934
|
+
drizzleOrm.relations(
|
|
935
|
+
agentFunctionToolRelations,
|
|
936
|
+
({ one }) => ({
|
|
937
|
+
agent: one(subAgents, {
|
|
938
|
+
fields: [agentFunctionToolRelations.subAgentId],
|
|
939
|
+
references: [subAgents.id]
|
|
940
|
+
}),
|
|
941
|
+
functionTool: one(functionTools, {
|
|
942
|
+
fields: [agentFunctionToolRelations.functionToolId],
|
|
943
|
+
references: [functionTools.id]
|
|
944
|
+
})
|
|
945
|
+
})
|
|
946
|
+
);
|
|
842
947
|
|
|
843
948
|
// src/types/utility.ts
|
|
844
949
|
var TOOL_STATUS_VALUES = ["healthy", "unhealthy", "unknown", "needs_auth"];
|
|
@@ -863,7 +968,7 @@ var StopWhenSchema = zodOpenapi.z.object({
|
|
|
863
968
|
stepCountIs: zodOpenapi.z.number().min(1).max(1e3).optional()
|
|
864
969
|
});
|
|
865
970
|
var GraphStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true });
|
|
866
|
-
var
|
|
971
|
+
var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true });
|
|
867
972
|
var MIN_ID_LENGTH = 1;
|
|
868
973
|
var MAX_ID_LENGTH = 255;
|
|
869
974
|
var URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
|
|
@@ -906,71 +1011,73 @@ var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId:
|
|
|
906
1011
|
var createGraphScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
|
|
907
1012
|
var createGraphScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
|
|
908
1013
|
var createGraphScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true }).partial();
|
|
909
|
-
var
|
|
910
|
-
var
|
|
1014
|
+
var SubAgentSelectSchema = drizzleZod.createSelectSchema(subAgents);
|
|
1015
|
+
var SubAgentInsertSchema = drizzleZod.createInsertSchema(subAgents).extend({
|
|
911
1016
|
id: resourceIdSchema,
|
|
912
1017
|
models: ModelSchema.optional()
|
|
913
1018
|
});
|
|
914
|
-
var
|
|
915
|
-
var
|
|
916
|
-
var
|
|
917
|
-
var
|
|
918
|
-
var
|
|
919
|
-
var
|
|
1019
|
+
var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
|
|
1020
|
+
var SubAgentApiSelectSchema = createGraphScopedApiSchema(SubAgentSelectSchema);
|
|
1021
|
+
var SubAgentApiInsertSchema = createGraphScopedApiInsertSchema(SubAgentInsertSchema);
|
|
1022
|
+
var SubAgentApiUpdateSchema = createGraphScopedApiUpdateSchema(SubAgentUpdateSchema);
|
|
1023
|
+
var SubAgentRelationSelectSchema = drizzleZod.createSelectSchema(subAgentRelations);
|
|
1024
|
+
var SubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
|
|
920
1025
|
id: resourceIdSchema,
|
|
921
1026
|
graphId: resourceIdSchema,
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
});
|
|
926
|
-
var
|
|
927
|
-
var
|
|
928
|
-
|
|
929
|
-
|
|
1027
|
+
sourceSubAgentId: resourceIdSchema,
|
|
1028
|
+
targetSubAgentId: resourceIdSchema.optional(),
|
|
1029
|
+
externalSubAgentId: resourceIdSchema.optional()
|
|
1030
|
+
});
|
|
1031
|
+
var SubAgentRelationUpdateSchema = SubAgentRelationInsertSchema.partial();
|
|
1032
|
+
var SubAgentRelationApiSelectSchema = createGraphScopedApiSchema(
|
|
1033
|
+
SubAgentRelationSelectSchema
|
|
1034
|
+
);
|
|
1035
|
+
var SubAgentRelationApiInsertSchema = createGraphScopedApiInsertSchema(
|
|
1036
|
+
SubAgentRelationInsertSchema
|
|
930
1037
|
).extend({
|
|
931
1038
|
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES)
|
|
932
1039
|
}).refine(
|
|
933
1040
|
(data) => {
|
|
934
|
-
const hasTarget = data.
|
|
935
|
-
const hasExternal = data.
|
|
1041
|
+
const hasTarget = data.targetSubAgentId != null;
|
|
1042
|
+
const hasExternal = data.externalSubAgentId != null;
|
|
936
1043
|
return hasTarget !== hasExternal;
|
|
937
1044
|
},
|
|
938
1045
|
{
|
|
939
|
-
message: "Must specify exactly one of
|
|
940
|
-
path: ["
|
|
1046
|
+
message: "Must specify exactly one of targetSubAgentId or externalSubAgentId",
|
|
1047
|
+
path: ["targetSubAgentId", "externalSubAgentId"]
|
|
941
1048
|
}
|
|
942
1049
|
);
|
|
943
|
-
var
|
|
944
|
-
|
|
1050
|
+
var SubAgentRelationApiUpdateSchema = createGraphScopedApiUpdateSchema(
|
|
1051
|
+
SubAgentRelationUpdateSchema
|
|
945
1052
|
).extend({
|
|
946
1053
|
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES).optional()
|
|
947
1054
|
}).refine(
|
|
948
1055
|
(data) => {
|
|
949
|
-
const hasTarget = data.
|
|
950
|
-
const hasExternal = data.
|
|
1056
|
+
const hasTarget = data.targetSubAgentId != null;
|
|
1057
|
+
const hasExternal = data.externalSubAgentId != null;
|
|
951
1058
|
if (!hasTarget && !hasExternal) {
|
|
952
1059
|
return true;
|
|
953
1060
|
}
|
|
954
1061
|
return hasTarget !== hasExternal;
|
|
955
1062
|
},
|
|
956
1063
|
{
|
|
957
|
-
message: "Must specify exactly one of
|
|
958
|
-
path: ["
|
|
1064
|
+
message: "Must specify exactly one of targetSubAgentId or externalSubAgentId when updating sub-agent relationships",
|
|
1065
|
+
path: ["targetSubAgentId", "externalSubAgentId"]
|
|
959
1066
|
}
|
|
960
1067
|
);
|
|
961
|
-
var
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1068
|
+
var SubAgentRelationQuerySchema = zodOpenapi.z.object({
|
|
1069
|
+
sourceSubAgentId: zodOpenapi.z.string().optional(),
|
|
1070
|
+
targetSubAgentId: zodOpenapi.z.string().optional(),
|
|
1071
|
+
externalSubAgentId: zodOpenapi.z.string().optional()
|
|
965
1072
|
});
|
|
966
|
-
var
|
|
1073
|
+
var ExternalSubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
|
|
967
1074
|
id: resourceIdSchema,
|
|
968
1075
|
graphId: resourceIdSchema,
|
|
969
|
-
|
|
970
|
-
|
|
1076
|
+
sourceSubAgentId: resourceIdSchema,
|
|
1077
|
+
externalSubAgentId: resourceIdSchema
|
|
971
1078
|
});
|
|
972
|
-
var
|
|
973
|
-
|
|
1079
|
+
var ExternalSubAgentRelationApiInsertSchema = createApiInsertSchema(
|
|
1080
|
+
ExternalSubAgentRelationInsertSchema
|
|
974
1081
|
);
|
|
975
1082
|
var AgentGraphSelectSchema = drizzleZod.createSelectSchema(agentGraph);
|
|
976
1083
|
var AgentGraphInsertSchema = drizzleZod.createInsertSchema(agentGraph).extend({
|
|
@@ -1037,32 +1144,22 @@ var ToolSelectSchema = drizzleZod.createSelectSchema(tools);
|
|
|
1037
1144
|
var ToolInsertSchema = drizzleZod.createInsertSchema(tools).extend({
|
|
1038
1145
|
id: resourceIdSchema,
|
|
1039
1146
|
imageUrl: imageUrlSchema,
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
reconnectionOptions: zodOpenapi.z.custom().optional(),
|
|
1055
|
-
sessionId: zodOpenapi.z.string().optional()
|
|
1056
|
-
}).optional(),
|
|
1057
|
-
activeTools: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
1058
|
-
})
|
|
1059
|
-
}),
|
|
1060
|
-
// Function tools (reference-only, no inline duplication)
|
|
1061
|
-
zodOpenapi.z.object({
|
|
1062
|
-
type: zodOpenapi.z.literal("function")
|
|
1063
|
-
// No inline function details - they're in the functions table via functionId
|
|
1147
|
+
config: zodOpenapi.z.object({
|
|
1148
|
+
type: zodOpenapi.z.literal("mcp"),
|
|
1149
|
+
mcp: zodOpenapi.z.object({
|
|
1150
|
+
server: zodOpenapi.z.object({
|
|
1151
|
+
url: zodOpenapi.z.string().url()
|
|
1152
|
+
}),
|
|
1153
|
+
transport: zodOpenapi.z.object({
|
|
1154
|
+
type: zodOpenapi.z.enum(MCPTransportType),
|
|
1155
|
+
requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1156
|
+
eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1157
|
+
reconnectionOptions: zodOpenapi.z.custom().optional(),
|
|
1158
|
+
sessionId: zodOpenapi.z.string().optional()
|
|
1159
|
+
}).optional(),
|
|
1160
|
+
activeTools: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
1064
1161
|
})
|
|
1065
|
-
|
|
1162
|
+
})
|
|
1066
1163
|
});
|
|
1067
1164
|
var ConversationSelectSchema = drizzleZod.createSelectSchema(conversations);
|
|
1068
1165
|
var ConversationInsertSchema = drizzleZod.createInsertSchema(conversations).extend({
|
|
@@ -1101,20 +1198,20 @@ var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
|
|
|
1101
1198
|
var DataComponentApiSelectSchema = createApiSchema(DataComponentSelectSchema);
|
|
1102
1199
|
var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema);
|
|
1103
1200
|
var DataComponentApiUpdateSchema = createApiUpdateSchema(DataComponentUpdateSchema);
|
|
1104
|
-
var
|
|
1105
|
-
var
|
|
1106
|
-
var
|
|
1107
|
-
var
|
|
1108
|
-
|
|
1201
|
+
var SubAgentDataComponentSelectSchema = drizzleZod.createSelectSchema(subAgentDataComponents);
|
|
1202
|
+
var SubAgentDataComponentInsertSchema = drizzleZod.createInsertSchema(subAgentDataComponents);
|
|
1203
|
+
var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
|
|
1204
|
+
var SubAgentDataComponentApiSelectSchema = createGraphScopedApiSchema(
|
|
1205
|
+
SubAgentDataComponentSelectSchema
|
|
1109
1206
|
);
|
|
1110
|
-
var
|
|
1207
|
+
var SubAgentDataComponentApiInsertSchema = SubAgentDataComponentInsertSchema.omit({
|
|
1111
1208
|
tenantId: true,
|
|
1112
1209
|
projectId: true,
|
|
1113
1210
|
id: true,
|
|
1114
1211
|
createdAt: true
|
|
1115
1212
|
});
|
|
1116
|
-
var
|
|
1117
|
-
|
|
1213
|
+
var SubAgentDataComponentApiUpdateSchema = createGraphScopedApiUpdateSchema(
|
|
1214
|
+
SubAgentDataComponentUpdateSchema
|
|
1118
1215
|
);
|
|
1119
1216
|
var ArtifactComponentSelectSchema = drizzleZod.createSelectSchema(artifactComponents);
|
|
1120
1217
|
var ArtifactComponentInsertSchema = drizzleZod.createInsertSchema(artifactComponents).extend({
|
|
@@ -1131,26 +1228,26 @@ var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
|
|
|
1131
1228
|
var ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
|
|
1132
1229
|
ArtifactComponentUpdateSchema
|
|
1133
1230
|
);
|
|
1134
|
-
var
|
|
1135
|
-
var
|
|
1136
|
-
|
|
1231
|
+
var SubAgentArtifactComponentSelectSchema = drizzleZod.createSelectSchema(subAgentArtifactComponents);
|
|
1232
|
+
var SubAgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
|
|
1233
|
+
subAgentArtifactComponents
|
|
1137
1234
|
).extend({
|
|
1138
1235
|
id: resourceIdSchema,
|
|
1139
|
-
|
|
1236
|
+
subAgentId: resourceIdSchema,
|
|
1140
1237
|
artifactComponentId: resourceIdSchema
|
|
1141
1238
|
});
|
|
1142
|
-
var
|
|
1143
|
-
var
|
|
1144
|
-
|
|
1239
|
+
var SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentInsertSchema.partial();
|
|
1240
|
+
var SubAgentArtifactComponentApiSelectSchema = createGraphScopedApiSchema(
|
|
1241
|
+
SubAgentArtifactComponentSelectSchema
|
|
1145
1242
|
);
|
|
1146
|
-
var
|
|
1243
|
+
var SubAgentArtifactComponentApiInsertSchema = SubAgentArtifactComponentInsertSchema.omit({
|
|
1147
1244
|
tenantId: true,
|
|
1148
1245
|
projectId: true,
|
|
1149
1246
|
id: true,
|
|
1150
1247
|
createdAt: true
|
|
1151
1248
|
});
|
|
1152
|
-
var
|
|
1153
|
-
|
|
1249
|
+
var SubAgentArtifactComponentApiUpdateSchema = createGraphScopedApiUpdateSchema(
|
|
1250
|
+
SubAgentArtifactComponentUpdateSchema
|
|
1154
1251
|
);
|
|
1155
1252
|
var ExternalAgentSelectSchema = drizzleZod.createSelectSchema(externalAgents).extend({
|
|
1156
1253
|
credentialReferenceId: zodOpenapi.z.string().nullable().optional(),
|
|
@@ -1164,7 +1261,7 @@ var ExternalAgentApiSelectSchema = createGraphScopedApiSchema(ExternalAgentSelec
|
|
|
1164
1261
|
var ExternalAgentApiInsertSchema = createGraphScopedApiInsertSchema(ExternalAgentInsertSchema);
|
|
1165
1262
|
var ExternalAgentApiUpdateSchema = createGraphScopedApiUpdateSchema(ExternalAgentUpdateSchema);
|
|
1166
1263
|
var AllAgentSchema = zodOpenapi.z.discriminatedUnion("type", [
|
|
1167
|
-
|
|
1264
|
+
SubAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
|
|
1168
1265
|
ExternalAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
1169
1266
|
]);
|
|
1170
1267
|
var ApiKeySelectSchema = drizzleZod.createSelectSchema(apiKeys);
|
|
@@ -1272,6 +1369,14 @@ var ToolUpdateSchema = ToolInsertSchema.partial();
|
|
|
1272
1369
|
var ToolApiSelectSchema = createApiSchema(ToolSelectSchema);
|
|
1273
1370
|
var ToolApiInsertSchema = createApiInsertSchema(ToolInsertSchema);
|
|
1274
1371
|
var ToolApiUpdateSchema = createApiUpdateSchema(ToolUpdateSchema);
|
|
1372
|
+
var FunctionToolSelectSchema = drizzleZod.createSelectSchema(functionTools);
|
|
1373
|
+
var FunctionToolInsertSchema = drizzleZod.createInsertSchema(functionTools).extend({
|
|
1374
|
+
id: resourceIdSchema
|
|
1375
|
+
});
|
|
1376
|
+
var FunctionToolUpdateSchema = FunctionToolInsertSchema.partial();
|
|
1377
|
+
var FunctionToolApiSelectSchema = createApiSchema(FunctionToolSelectSchema);
|
|
1378
|
+
var FunctionToolApiInsertSchema = createGraphScopedApiInsertSchema(FunctionToolInsertSchema);
|
|
1379
|
+
var FunctionToolApiUpdateSchema = createApiUpdateSchema(FunctionToolUpdateSchema);
|
|
1275
1380
|
var FunctionSelectSchema = drizzleZod.createSelectSchema(functions);
|
|
1276
1381
|
var FunctionInsertSchema = drizzleZod.createInsertSchema(functions).extend({
|
|
1277
1382
|
id: resourceIdSchema
|
|
@@ -1319,23 +1424,23 @@ var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSche
|
|
|
1319
1424
|
var ContextConfigApiUpdateSchema = createApiUpdateSchema(ContextConfigUpdateSchema).omit({
|
|
1320
1425
|
graphId: true
|
|
1321
1426
|
});
|
|
1322
|
-
var
|
|
1323
|
-
var
|
|
1427
|
+
var SubAgentToolRelationSelectSchema = drizzleZod.createSelectSchema(subAgentToolRelations);
|
|
1428
|
+
var SubAgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToolRelations).extend({
|
|
1324
1429
|
id: resourceIdSchema,
|
|
1325
|
-
|
|
1430
|
+
subAgentId: resourceIdSchema,
|
|
1326
1431
|
toolId: resourceIdSchema,
|
|
1327
1432
|
selectedTools: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
|
|
1328
1433
|
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1329
1434
|
});
|
|
1330
|
-
var
|
|
1331
|
-
var
|
|
1332
|
-
|
|
1435
|
+
var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
|
|
1436
|
+
var SubAgentToolRelationApiSelectSchema = createGraphScopedApiSchema(
|
|
1437
|
+
SubAgentToolRelationSelectSchema
|
|
1333
1438
|
);
|
|
1334
|
-
var
|
|
1335
|
-
|
|
1439
|
+
var SubAgentToolRelationApiInsertSchema = createGraphScopedApiInsertSchema(
|
|
1440
|
+
SubAgentToolRelationInsertSchema
|
|
1336
1441
|
);
|
|
1337
|
-
var
|
|
1338
|
-
|
|
1442
|
+
var SubAgentToolRelationApiUpdateSchema = createGraphScopedApiUpdateSchema(
|
|
1443
|
+
SubAgentToolRelationUpdateSchema
|
|
1339
1444
|
);
|
|
1340
1445
|
var LedgerArtifactSelectSchema = drizzleZod.createSelectSchema(ledgerArtifacts);
|
|
1341
1446
|
var LedgerArtifactInsertSchema = drizzleZod.createInsertSchema(ledgerArtifacts);
|
|
@@ -1365,7 +1470,7 @@ var CanUseItemSchema = zodOpenapi.z.object({
|
|
|
1365
1470
|
toolSelection: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
|
|
1366
1471
|
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1367
1472
|
});
|
|
1368
|
-
var FullGraphAgentInsertSchema =
|
|
1473
|
+
var FullGraphAgentInsertSchema = SubAgentApiInsertSchema.extend({
|
|
1369
1474
|
type: zodOpenapi.z.literal("internal"),
|
|
1370
1475
|
canUse: zodOpenapi.z.array(CanUseItemSchema),
|
|
1371
1476
|
// All tools (both MCP and function tools)
|
|
@@ -1375,10 +1480,15 @@ var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
|
|
|
1375
1480
|
canDelegateTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
1376
1481
|
});
|
|
1377
1482
|
var FullGraphDefinitionSchema = AgentGraphApiInsertSchema.extend({
|
|
1378
|
-
|
|
1483
|
+
subAgents: zodOpenapi.z.record(
|
|
1484
|
+
zodOpenapi.z.string(),
|
|
1485
|
+
zodOpenapi.z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])
|
|
1486
|
+
),
|
|
1379
1487
|
// Lookup maps for UI to resolve canUse items
|
|
1380
1488
|
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
|
|
1381
|
-
//
|
|
1489
|
+
// MCP tools (project-scoped)
|
|
1490
|
+
functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
|
|
1491
|
+
// Function tools (graph-scoped)
|
|
1382
1492
|
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1383
1493
|
// Get function code for function tools
|
|
1384
1494
|
contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
|
|
@@ -1388,13 +1498,20 @@ var FullGraphDefinitionSchema = AgentGraphApiInsertSchema.extend({
|
|
|
1388
1498
|
graphPrompt: zodOpenapi.z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
|
|
1389
1499
|
});
|
|
1390
1500
|
var GraphWithinContextOfProjectSchema = AgentGraphApiInsertSchema.extend({
|
|
1391
|
-
|
|
1501
|
+
subAgents: zodOpenapi.z.record(
|
|
1392
1502
|
zodOpenapi.z.string(),
|
|
1393
1503
|
zodOpenapi.z.discriminatedUnion("type", [
|
|
1394
1504
|
FullGraphAgentInsertSchema,
|
|
1395
1505
|
ExternalAgentApiInsertSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
1396
1506
|
])
|
|
1397
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
|
|
1398
1515
|
contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
|
|
1399
1516
|
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
1400
1517
|
models: ModelSchema.optional(),
|
|
@@ -1442,9 +1559,9 @@ var ProjectApiUpdateSchema = ProjectUpdateSchema.omit({ tenantId: true });
|
|
|
1442
1559
|
var FullProjectDefinitionSchema = ProjectApiInsertSchema.extend({
|
|
1443
1560
|
graphs: zodOpenapi.z.record(zodOpenapi.z.string(), GraphWithinContextOfProjectSchema),
|
|
1444
1561
|
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema),
|
|
1445
|
-
//
|
|
1562
|
+
// MCP tools (project-scoped)
|
|
1446
1563
|
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1447
|
-
//
|
|
1564
|
+
// Functions (project-scoped)
|
|
1448
1565
|
dataComponents: zodOpenapi.z.record(zodOpenapi.z.string(), DataComponentApiInsertSchema).optional(),
|
|
1449
1566
|
artifactComponents: zodOpenapi.z.record(zodOpenapi.z.string(), ArtifactComponentApiInsertSchema).optional(),
|
|
1450
1567
|
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
@@ -1466,72 +1583,46 @@ var HeadersScopeSchema = zodOpenapi.z.object({
|
|
|
1466
1583
|
example: "graph_789"
|
|
1467
1584
|
})
|
|
1468
1585
|
});
|
|
1586
|
+
var TenantId = zodOpenapi.z.string().openapi({
|
|
1587
|
+
description: "Tenant identifier",
|
|
1588
|
+
example: "tenant_123"
|
|
1589
|
+
});
|
|
1590
|
+
var ProjectId = zodOpenapi.z.string().openapi({
|
|
1591
|
+
description: "Project identifier",
|
|
1592
|
+
example: "project_456"
|
|
1593
|
+
});
|
|
1594
|
+
var GraphId = zodOpenapi.z.string().openapi({
|
|
1595
|
+
description: "Graph identifier",
|
|
1596
|
+
example: "graph_789"
|
|
1597
|
+
});
|
|
1598
|
+
var SubAgentId = zodOpenapi.z.string().openapi({
|
|
1599
|
+
description: "Sub-agent identifier",
|
|
1600
|
+
example: "sub_agent_123"
|
|
1601
|
+
});
|
|
1469
1602
|
var TenantParamsSchema = zodOpenapi.z.object({
|
|
1470
|
-
tenantId:
|
|
1471
|
-
description: "Tenant identifier",
|
|
1472
|
-
example: "tenant_123"
|
|
1473
|
-
})
|
|
1603
|
+
tenantId: TenantId
|
|
1474
1604
|
}).openapi("TenantParams");
|
|
1475
|
-
var
|
|
1476
|
-
tenantId: zodOpenapi.z.string().openapi({
|
|
1477
|
-
description: "Tenant identifier",
|
|
1478
|
-
example: "tenant_123"
|
|
1479
|
-
}),
|
|
1480
|
-
projectId: zodOpenapi.z.string().openapi({
|
|
1481
|
-
description: "Project identifier",
|
|
1482
|
-
example: "project_456"
|
|
1483
|
-
})
|
|
1484
|
-
}).openapi("TenantProjectParams");
|
|
1485
|
-
var TenantProjectGraphParamsSchema = zodOpenapi.z.object({
|
|
1486
|
-
tenantId: zodOpenapi.z.string().openapi({
|
|
1487
|
-
description: "Tenant identifier",
|
|
1488
|
-
example: "tenant_123"
|
|
1489
|
-
}),
|
|
1490
|
-
projectId: zodOpenapi.z.string().openapi({
|
|
1491
|
-
description: "Project identifier",
|
|
1492
|
-
example: "project_456"
|
|
1493
|
-
}),
|
|
1494
|
-
graphId: zodOpenapi.z.string().openapi({
|
|
1495
|
-
description: "Graph identifier",
|
|
1496
|
-
example: "graph_789"
|
|
1497
|
-
})
|
|
1498
|
-
}).openapi("TenantProjectGraphParams");
|
|
1499
|
-
var TenantProjectGraphIdParamsSchema = zodOpenapi.z.object({
|
|
1500
|
-
tenantId: zodOpenapi.z.string().openapi({
|
|
1501
|
-
description: "Tenant identifier",
|
|
1502
|
-
example: "tenant_123"
|
|
1503
|
-
}),
|
|
1504
|
-
projectId: zodOpenapi.z.string().openapi({
|
|
1505
|
-
description: "Project identifier",
|
|
1506
|
-
example: "project_456"
|
|
1507
|
-
}),
|
|
1508
|
-
graphId: zodOpenapi.z.string().openapi({
|
|
1509
|
-
description: "Graph identifier",
|
|
1510
|
-
example: "graph_789"
|
|
1511
|
-
}),
|
|
1605
|
+
var TenantIdParamsSchema = TenantParamsSchema.extend({
|
|
1512
1606
|
id: resourceIdSchema
|
|
1513
|
-
}).openapi("
|
|
1514
|
-
var
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
}),
|
|
1519
|
-
projectId: zodOpenapi.z.string().openapi({
|
|
1520
|
-
description: "Project identifier",
|
|
1521
|
-
example: "project_456"
|
|
1522
|
-
}),
|
|
1607
|
+
}).openapi("TenantIdParams");
|
|
1608
|
+
var TenantProjectParamsSchema = TenantParamsSchema.extend({
|
|
1609
|
+
projectId: ProjectId
|
|
1610
|
+
}).openapi("TenantProjectParams");
|
|
1611
|
+
var TenantProjectIdParamsSchema = TenantProjectParamsSchema.extend({
|
|
1523
1612
|
id: resourceIdSchema
|
|
1524
1613
|
}).openapi("TenantProjectIdParams");
|
|
1525
|
-
var
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
}),
|
|
1614
|
+
var TenantProjectGraphParamsSchema = TenantProjectParamsSchema.extend({
|
|
1615
|
+
graphId: GraphId
|
|
1616
|
+
}).openapi("TenantProjectGraphParams");
|
|
1617
|
+
var TenantProjectGraphIdParamsSchema = TenantProjectGraphParamsSchema.extend({
|
|
1530
1618
|
id: resourceIdSchema
|
|
1531
|
-
}).openapi("
|
|
1532
|
-
var
|
|
1619
|
+
}).openapi("TenantProjectGraphIdParams");
|
|
1620
|
+
var TenantProjectGraphSubAgentParamsSchema = TenantProjectGraphParamsSchema.extend({
|
|
1621
|
+
subAgentId: SubAgentId
|
|
1622
|
+
}).openapi("TenantProjectGraphSubAgentParams");
|
|
1623
|
+
var TenantProjectGraphSubAgentIdParamsSchema = TenantProjectGraphSubAgentParamsSchema.extend({
|
|
1533
1624
|
id: resourceIdSchema
|
|
1534
|
-
}).openapi("
|
|
1625
|
+
}).openapi("TenantProjectGraphSubAgentIdParams");
|
|
1535
1626
|
var PaginationQueryParamsSchema = zodOpenapi.z.object({
|
|
1536
1627
|
page: zodOpenapi.z.coerce.number().min(1).default(1),
|
|
1537
1628
|
limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10)
|
|
@@ -1545,18 +1636,18 @@ function isExternalAgent(agent) {
|
|
|
1545
1636
|
return "baseUrl" in agent;
|
|
1546
1637
|
}
|
|
1547
1638
|
function validateAndTypeGraphData(data) {
|
|
1548
|
-
return
|
|
1639
|
+
return GraphWithinContextOfProjectSchema.parse(data);
|
|
1549
1640
|
}
|
|
1550
1641
|
function validateToolReferences(graphData, availableToolIds) {
|
|
1551
1642
|
if (!availableToolIds) {
|
|
1552
1643
|
return;
|
|
1553
1644
|
}
|
|
1554
1645
|
const errors = [];
|
|
1555
|
-
for (const [
|
|
1646
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
1556
1647
|
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
1557
1648
|
for (const canUseItem of agentData.canUse) {
|
|
1558
1649
|
if (!availableToolIds.has(canUseItem.toolId)) {
|
|
1559
|
-
errors.push(`Agent '${
|
|
1650
|
+
errors.push(`Agent '${subAgentId}' references non-existent tool '${canUseItem.toolId}'`);
|
|
1560
1651
|
}
|
|
1561
1652
|
}
|
|
1562
1653
|
}
|
|
@@ -1571,12 +1662,12 @@ function validateDataComponentReferences(graphData, availableDataComponentIds) {
|
|
|
1571
1662
|
return;
|
|
1572
1663
|
}
|
|
1573
1664
|
const errors = [];
|
|
1574
|
-
for (const [
|
|
1665
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
1575
1666
|
if (isInternalAgent(agentData) && agentData.dataComponents) {
|
|
1576
1667
|
for (const dataComponentId of agentData.dataComponents) {
|
|
1577
1668
|
if (!availableDataComponentIds.has(dataComponentId)) {
|
|
1578
1669
|
errors.push(
|
|
1579
|
-
`Agent '${
|
|
1670
|
+
`Agent '${subAgentId}' references non-existent dataComponent '${dataComponentId}'`
|
|
1580
1671
|
);
|
|
1581
1672
|
}
|
|
1582
1673
|
}
|
|
@@ -1592,12 +1683,12 @@ function validateArtifactComponentReferences(graphData, availableArtifactCompone
|
|
|
1592
1683
|
return;
|
|
1593
1684
|
}
|
|
1594
1685
|
const errors = [];
|
|
1595
|
-
for (const [
|
|
1686
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
1596
1687
|
if (isInternalAgent(agentData) && agentData.artifactComponents) {
|
|
1597
1688
|
for (const artifactComponentId of agentData.artifactComponents) {
|
|
1598
1689
|
if (!availableArtifactComponentIds.has(artifactComponentId)) {
|
|
1599
1690
|
errors.push(
|
|
1600
|
-
`Agent '${
|
|
1691
|
+
`Agent '${subAgentId}' references non-existent artifactComponent '${artifactComponentId}'`
|
|
1601
1692
|
);
|
|
1602
1693
|
}
|
|
1603
1694
|
}
|
|
@@ -1610,14 +1701,14 @@ ${errors.join("\n")}`);
|
|
|
1610
1701
|
}
|
|
1611
1702
|
function validateAgentRelationships(graphData) {
|
|
1612
1703
|
const errors = [];
|
|
1613
|
-
const availableAgentIds = new Set(Object.keys(graphData.
|
|
1614
|
-
for (const [
|
|
1704
|
+
const availableAgentIds = new Set(Object.keys(graphData.subAgents));
|
|
1705
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
1615
1706
|
if (isInternalAgent(agentData)) {
|
|
1616
1707
|
if (agentData.canTransferTo && Array.isArray(agentData.canTransferTo)) {
|
|
1617
1708
|
for (const targetId of agentData.canTransferTo) {
|
|
1618
1709
|
if (!availableAgentIds.has(targetId)) {
|
|
1619
1710
|
errors.push(
|
|
1620
|
-
`Agent '${
|
|
1711
|
+
`Agent '${subAgentId}' has transfer target '${targetId}' that doesn't exist in graph`
|
|
1621
1712
|
);
|
|
1622
1713
|
}
|
|
1623
1714
|
}
|
|
@@ -1626,7 +1717,7 @@ function validateAgentRelationships(graphData) {
|
|
|
1626
1717
|
for (const targetId of agentData.canDelegateTo) {
|
|
1627
1718
|
if (!availableAgentIds.has(targetId)) {
|
|
1628
1719
|
errors.push(
|
|
1629
|
-
`Agent '${
|
|
1720
|
+
`Agent '${subAgentId}' has delegation target '${targetId}' that doesn't exist in graph`
|
|
1630
1721
|
);
|
|
1631
1722
|
}
|
|
1632
1723
|
}
|
|
@@ -1639,8 +1730,8 @@ ${errors.join("\n")}`);
|
|
|
1639
1730
|
}
|
|
1640
1731
|
}
|
|
1641
1732
|
function validateGraphStructure(graphData, projectResources) {
|
|
1642
|
-
if (graphData.
|
|
1643
|
-
throw new Error(`Default agent '${graphData.
|
|
1733
|
+
if (graphData.defaultSubAgentId && !graphData.subAgents[graphData.defaultSubAgentId]) {
|
|
1734
|
+
throw new Error(`Default agent '${graphData.defaultSubAgentId}' does not exist in agents`);
|
|
1644
1735
|
}
|
|
1645
1736
|
if (projectResources) {
|
|
1646
1737
|
validateToolReferences(graphData, projectResources.toolIds);
|
|
@@ -1770,44 +1861,13 @@ function validatePropsAsJsonSchema(props) {
|
|
|
1770
1861
|
}
|
|
1771
1862
|
}
|
|
1772
1863
|
|
|
1773
|
-
exports.
|
|
1774
|
-
exports.AgentApiSelectSchema = AgentApiSelectSchema;
|
|
1775
|
-
exports.AgentApiUpdateSchema = AgentApiUpdateSchema;
|
|
1776
|
-
exports.AgentArtifactComponentApiInsertSchema = AgentArtifactComponentApiInsertSchema;
|
|
1777
|
-
exports.AgentArtifactComponentApiSelectSchema = AgentArtifactComponentApiSelectSchema;
|
|
1778
|
-
exports.AgentArtifactComponentApiUpdateSchema = AgentArtifactComponentApiUpdateSchema;
|
|
1779
|
-
exports.AgentArtifactComponentInsertSchema = AgentArtifactComponentInsertSchema;
|
|
1780
|
-
exports.AgentArtifactComponentSelectSchema = AgentArtifactComponentSelectSchema;
|
|
1781
|
-
exports.AgentArtifactComponentUpdateSchema = AgentArtifactComponentUpdateSchema;
|
|
1782
|
-
exports.AgentDataComponentApiInsertSchema = AgentDataComponentApiInsertSchema;
|
|
1783
|
-
exports.AgentDataComponentApiSelectSchema = AgentDataComponentApiSelectSchema;
|
|
1784
|
-
exports.AgentDataComponentApiUpdateSchema = AgentDataComponentApiUpdateSchema;
|
|
1785
|
-
exports.AgentDataComponentInsertSchema = AgentDataComponentInsertSchema;
|
|
1786
|
-
exports.AgentDataComponentSelectSchema = AgentDataComponentSelectSchema;
|
|
1787
|
-
exports.AgentDataComponentUpdateSchema = AgentDataComponentUpdateSchema;
|
|
1864
|
+
exports.A2AMessageMetadataSchema = A2AMessageMetadataSchema;
|
|
1788
1865
|
exports.AgentGraphApiInsertSchema = AgentGraphApiInsertSchema;
|
|
1789
1866
|
exports.AgentGraphApiSelectSchema = AgentGraphApiSelectSchema;
|
|
1790
1867
|
exports.AgentGraphApiUpdateSchema = AgentGraphApiUpdateSchema;
|
|
1791
1868
|
exports.AgentGraphInsertSchema = AgentGraphInsertSchema;
|
|
1792
1869
|
exports.AgentGraphSelectSchema = AgentGraphSelectSchema;
|
|
1793
1870
|
exports.AgentGraphUpdateSchema = AgentGraphUpdateSchema;
|
|
1794
|
-
exports.AgentInsertSchema = AgentInsertSchema;
|
|
1795
|
-
exports.AgentRelationApiInsertSchema = AgentRelationApiInsertSchema;
|
|
1796
|
-
exports.AgentRelationApiSelectSchema = AgentRelationApiSelectSchema;
|
|
1797
|
-
exports.AgentRelationApiUpdateSchema = AgentRelationApiUpdateSchema;
|
|
1798
|
-
exports.AgentRelationInsertSchema = AgentRelationInsertSchema;
|
|
1799
|
-
exports.AgentRelationQuerySchema = AgentRelationQuerySchema;
|
|
1800
|
-
exports.AgentRelationSelectSchema = AgentRelationSelectSchema;
|
|
1801
|
-
exports.AgentRelationUpdateSchema = AgentRelationUpdateSchema;
|
|
1802
|
-
exports.AgentSelectSchema = AgentSelectSchema;
|
|
1803
|
-
exports.AgentStopWhenSchema = AgentStopWhenSchema;
|
|
1804
|
-
exports.AgentToolRelationApiInsertSchema = AgentToolRelationApiInsertSchema;
|
|
1805
|
-
exports.AgentToolRelationApiSelectSchema = AgentToolRelationApiSelectSchema;
|
|
1806
|
-
exports.AgentToolRelationApiUpdateSchema = AgentToolRelationApiUpdateSchema;
|
|
1807
|
-
exports.AgentToolRelationInsertSchema = AgentToolRelationInsertSchema;
|
|
1808
|
-
exports.AgentToolRelationSelectSchema = AgentToolRelationSelectSchema;
|
|
1809
|
-
exports.AgentToolRelationUpdateSchema = AgentToolRelationUpdateSchema;
|
|
1810
|
-
exports.AgentUpdateSchema = AgentUpdateSchema;
|
|
1811
1871
|
exports.AllAgentSchema = AllAgentSchema;
|
|
1812
1872
|
exports.ApiKeyApiCreationResponseSchema = ApiKeyApiCreationResponseSchema;
|
|
1813
1873
|
exports.ApiKeyApiInsertSchema = ApiKeyApiInsertSchema;
|
|
@@ -1854,16 +1914,20 @@ exports.DataComponentBaseSchema = DataComponentBaseSchema;
|
|
|
1854
1914
|
exports.DataComponentInsertSchema = DataComponentInsertSchema;
|
|
1855
1915
|
exports.DataComponentSelectSchema = DataComponentSelectSchema;
|
|
1856
1916
|
exports.DataComponentUpdateSchema = DataComponentUpdateSchema;
|
|
1917
|
+
exports.DataOperationDetailsSchema = DataOperationDetailsSchema;
|
|
1918
|
+
exports.DataOperationEventSchema = DataOperationEventSchema;
|
|
1919
|
+
exports.DelegationReturnedDataSchema = DelegationReturnedDataSchema;
|
|
1920
|
+
exports.DelegationSentDataSchema = DelegationSentDataSchema;
|
|
1857
1921
|
exports.ErrorResponseSchema = ErrorResponseSchema;
|
|
1858
1922
|
exports.ExistsResponseSchema = ExistsResponseSchema;
|
|
1859
1923
|
exports.ExternalAgentApiInsertSchema = ExternalAgentApiInsertSchema;
|
|
1860
1924
|
exports.ExternalAgentApiSelectSchema = ExternalAgentApiSelectSchema;
|
|
1861
1925
|
exports.ExternalAgentApiUpdateSchema = ExternalAgentApiUpdateSchema;
|
|
1862
1926
|
exports.ExternalAgentInsertSchema = ExternalAgentInsertSchema;
|
|
1863
|
-
exports.ExternalAgentRelationApiInsertSchema = ExternalAgentRelationApiInsertSchema;
|
|
1864
|
-
exports.ExternalAgentRelationInsertSchema = ExternalAgentRelationInsertSchema;
|
|
1865
1927
|
exports.ExternalAgentSelectSchema = ExternalAgentSelectSchema;
|
|
1866
1928
|
exports.ExternalAgentUpdateSchema = ExternalAgentUpdateSchema;
|
|
1929
|
+
exports.ExternalSubAgentRelationApiInsertSchema = ExternalSubAgentRelationApiInsertSchema;
|
|
1930
|
+
exports.ExternalSubAgentRelationInsertSchema = ExternalSubAgentRelationInsertSchema;
|
|
1867
1931
|
exports.FetchConfigSchema = FetchConfigSchema;
|
|
1868
1932
|
exports.FetchDefinitionSchema = FetchDefinitionSchema;
|
|
1869
1933
|
exports.FullGraphAgentInsertSchema = FullGraphAgentInsertSchema;
|
|
@@ -1874,12 +1938,17 @@ exports.FunctionApiSelectSchema = FunctionApiSelectSchema;
|
|
|
1874
1938
|
exports.FunctionApiUpdateSchema = FunctionApiUpdateSchema;
|
|
1875
1939
|
exports.FunctionInsertSchema = FunctionInsertSchema;
|
|
1876
1940
|
exports.FunctionSelectSchema = FunctionSelectSchema;
|
|
1941
|
+
exports.FunctionToolApiInsertSchema = FunctionToolApiInsertSchema;
|
|
1942
|
+
exports.FunctionToolApiSelectSchema = FunctionToolApiSelectSchema;
|
|
1943
|
+
exports.FunctionToolApiUpdateSchema = FunctionToolApiUpdateSchema;
|
|
1877
1944
|
exports.FunctionToolConfigSchema = FunctionToolConfigSchema;
|
|
1945
|
+
exports.FunctionToolInsertSchema = FunctionToolInsertSchema;
|
|
1946
|
+
exports.FunctionToolSelectSchema = FunctionToolSelectSchema;
|
|
1947
|
+
exports.FunctionToolUpdateSchema = FunctionToolUpdateSchema;
|
|
1878
1948
|
exports.FunctionUpdateSchema = FunctionUpdateSchema;
|
|
1879
1949
|
exports.GraphStopWhenSchema = GraphStopWhenSchema;
|
|
1880
1950
|
exports.GraphWithinContextOfProjectSchema = GraphWithinContextOfProjectSchema;
|
|
1881
1951
|
exports.HeadersScopeSchema = HeadersScopeSchema;
|
|
1882
|
-
exports.IdParamsSchema = IdParamsSchema;
|
|
1883
1952
|
exports.LedgerArtifactApiInsertSchema = LedgerArtifactApiInsertSchema;
|
|
1884
1953
|
exports.LedgerArtifactApiSelectSchema = LedgerArtifactApiSelectSchema;
|
|
1885
1954
|
exports.LedgerArtifactApiUpdateSchema = LedgerArtifactApiUpdateSchema;
|
|
@@ -1916,6 +1985,38 @@ exports.SingleResponseSchema = SingleResponseSchema;
|
|
|
1916
1985
|
exports.StatusComponentSchema = StatusComponentSchema;
|
|
1917
1986
|
exports.StatusUpdateSchema = StatusUpdateSchema;
|
|
1918
1987
|
exports.StopWhenSchema = StopWhenSchema;
|
|
1988
|
+
exports.SubAgentApiInsertSchema = SubAgentApiInsertSchema;
|
|
1989
|
+
exports.SubAgentApiSelectSchema = SubAgentApiSelectSchema;
|
|
1990
|
+
exports.SubAgentApiUpdateSchema = SubAgentApiUpdateSchema;
|
|
1991
|
+
exports.SubAgentArtifactComponentApiInsertSchema = SubAgentArtifactComponentApiInsertSchema;
|
|
1992
|
+
exports.SubAgentArtifactComponentApiSelectSchema = SubAgentArtifactComponentApiSelectSchema;
|
|
1993
|
+
exports.SubAgentArtifactComponentApiUpdateSchema = SubAgentArtifactComponentApiUpdateSchema;
|
|
1994
|
+
exports.SubAgentArtifactComponentInsertSchema = SubAgentArtifactComponentInsertSchema;
|
|
1995
|
+
exports.SubAgentArtifactComponentSelectSchema = SubAgentArtifactComponentSelectSchema;
|
|
1996
|
+
exports.SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentUpdateSchema;
|
|
1997
|
+
exports.SubAgentDataComponentApiInsertSchema = SubAgentDataComponentApiInsertSchema;
|
|
1998
|
+
exports.SubAgentDataComponentApiSelectSchema = SubAgentDataComponentApiSelectSchema;
|
|
1999
|
+
exports.SubAgentDataComponentApiUpdateSchema = SubAgentDataComponentApiUpdateSchema;
|
|
2000
|
+
exports.SubAgentDataComponentInsertSchema = SubAgentDataComponentInsertSchema;
|
|
2001
|
+
exports.SubAgentDataComponentSelectSchema = SubAgentDataComponentSelectSchema;
|
|
2002
|
+
exports.SubAgentDataComponentUpdateSchema = SubAgentDataComponentUpdateSchema;
|
|
2003
|
+
exports.SubAgentInsertSchema = SubAgentInsertSchema;
|
|
2004
|
+
exports.SubAgentRelationApiInsertSchema = SubAgentRelationApiInsertSchema;
|
|
2005
|
+
exports.SubAgentRelationApiSelectSchema = SubAgentRelationApiSelectSchema;
|
|
2006
|
+
exports.SubAgentRelationApiUpdateSchema = SubAgentRelationApiUpdateSchema;
|
|
2007
|
+
exports.SubAgentRelationInsertSchema = SubAgentRelationInsertSchema;
|
|
2008
|
+
exports.SubAgentRelationQuerySchema = SubAgentRelationQuerySchema;
|
|
2009
|
+
exports.SubAgentRelationSelectSchema = SubAgentRelationSelectSchema;
|
|
2010
|
+
exports.SubAgentRelationUpdateSchema = SubAgentRelationUpdateSchema;
|
|
2011
|
+
exports.SubAgentSelectSchema = SubAgentSelectSchema;
|
|
2012
|
+
exports.SubAgentStopWhenSchema = SubAgentStopWhenSchema;
|
|
2013
|
+
exports.SubAgentToolRelationApiInsertSchema = SubAgentToolRelationApiInsertSchema;
|
|
2014
|
+
exports.SubAgentToolRelationApiSelectSchema = SubAgentToolRelationApiSelectSchema;
|
|
2015
|
+
exports.SubAgentToolRelationApiUpdateSchema = SubAgentToolRelationApiUpdateSchema;
|
|
2016
|
+
exports.SubAgentToolRelationInsertSchema = SubAgentToolRelationInsertSchema;
|
|
2017
|
+
exports.SubAgentToolRelationSelectSchema = SubAgentToolRelationSelectSchema;
|
|
2018
|
+
exports.SubAgentToolRelationUpdateSchema = SubAgentToolRelationUpdateSchema;
|
|
2019
|
+
exports.SubAgentUpdateSchema = SubAgentUpdateSchema;
|
|
1919
2020
|
exports.TaskApiInsertSchema = TaskApiInsertSchema;
|
|
1920
2021
|
exports.TaskApiSelectSchema = TaskApiSelectSchema;
|
|
1921
2022
|
exports.TaskApiUpdateSchema = TaskApiUpdateSchema;
|
|
@@ -1932,6 +2033,8 @@ exports.TenantIdParamsSchema = TenantIdParamsSchema;
|
|
|
1932
2033
|
exports.TenantParamsSchema = TenantParamsSchema;
|
|
1933
2034
|
exports.TenantProjectGraphIdParamsSchema = TenantProjectGraphIdParamsSchema;
|
|
1934
2035
|
exports.TenantProjectGraphParamsSchema = TenantProjectGraphParamsSchema;
|
|
2036
|
+
exports.TenantProjectGraphSubAgentIdParamsSchema = TenantProjectGraphSubAgentIdParamsSchema;
|
|
2037
|
+
exports.TenantProjectGraphSubAgentParamsSchema = TenantProjectGraphSubAgentParamsSchema;
|
|
1935
2038
|
exports.TenantProjectIdParamsSchema = TenantProjectIdParamsSchema;
|
|
1936
2039
|
exports.TenantProjectParamsSchema = TenantProjectParamsSchema;
|
|
1937
2040
|
exports.ToolApiInsertSchema = ToolApiInsertSchema;
|
|
@@ -1941,6 +2044,7 @@ exports.ToolInsertSchema = ToolInsertSchema;
|
|
|
1941
2044
|
exports.ToolSelectSchema = ToolSelectSchema;
|
|
1942
2045
|
exports.ToolStatusSchema = ToolStatusSchema;
|
|
1943
2046
|
exports.ToolUpdateSchema = ToolUpdateSchema;
|
|
2047
|
+
exports.TransferDataSchema = TransferDataSchema;
|
|
1944
2048
|
exports.URL_SAFE_ID_PATTERN = URL_SAFE_ID_PATTERN;
|
|
1945
2049
|
exports.generateIdFromName = generateIdFromName;
|
|
1946
2050
|
exports.isExternalAgent = isExternalAgent;
|