@inkeep/agents-core 0.0.0-dev-20251009194333 → 0.0.0-dev-20251009215610
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-VPJ6Z5QZ.js → chunk-5LRSB445.js} +115 -118
- package/dist/{chunk-TO2HNKGP.js → chunk-BVURASVM.js} +74 -110
- package/dist/chunk-TCLX6C3C.js +271 -0
- package/dist/chunk-ZSQFZL3Y.js +173 -0
- package/dist/client-exports.cjs +483 -225
- 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 +114 -117
- 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 +1687 -1360
- package/dist/index.d.cts +1530 -1524
- package/dist/index.d.ts +1530 -1524
- package/dist/index.js +1016 -989
- package/dist/{schema-Ct2NlO81.d.cts → schema-B1rukNyF.d.ts} +118 -137
- package/dist/{schema-BQk_FMBV.d.ts → schema-BIYOOKX_.d.cts} +118 -137
- 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-BEeDGMP9.d.cts} +226 -297
- package/dist/{utility-s9c5CVOe.d.ts → utility-BEeDGMP9.d.ts} +226 -297
- package/dist/validation/index.cjs +243 -238
- 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/meta/0005_snapshot.json +2558 -0
- package/drizzle/meta/_journal.json +7 -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
|
);
|
|
@@ -384,10 +421,10 @@ var functions = sqliteCore.sqliteTable(
|
|
|
384
421
|
}).onDelete("cascade")
|
|
385
422
|
]
|
|
386
423
|
);
|
|
387
|
-
var
|
|
388
|
-
"
|
|
424
|
+
var subAgentToolRelations = sqliteCore.sqliteTable(
|
|
425
|
+
"sub_agent_tool_relations",
|
|
389
426
|
{
|
|
390
|
-
...
|
|
427
|
+
...subAgentScoped,
|
|
391
428
|
toolId: sqliteCore.text("tool_id").notNull(),
|
|
392
429
|
selectedTools: sqliteCore.blob("selected_tools", { mode: "json" }).$type(),
|
|
393
430
|
headers: sqliteCore.blob("headers", { mode: "json" }).$type(),
|
|
@@ -397,15 +434,15 @@ var agentToolRelations = sqliteCore.sqliteTable(
|
|
|
397
434
|
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
398
435
|
// Foreign key constraint to agents table (which includes project and graph scope)
|
|
399
436
|
sqliteCore.foreignKey({
|
|
400
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
401
|
-
foreignColumns: [
|
|
402
|
-
name: "
|
|
437
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
438
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
439
|
+
name: "sub_agent_tool_relations_agent_fk"
|
|
403
440
|
}).onDelete("cascade"),
|
|
404
441
|
// Foreign key constraint to tools table
|
|
405
442
|
sqliteCore.foreignKey({
|
|
406
443
|
columns: [table.tenantId, table.projectId, table.toolId],
|
|
407
444
|
foreignColumns: [tools.tenantId, tools.projectId, tools.id],
|
|
408
|
-
name: "
|
|
445
|
+
name: "sub_agent_tool_relations_tool_fk"
|
|
409
446
|
}).onDelete("cascade")
|
|
410
447
|
]
|
|
411
448
|
);
|
|
@@ -414,7 +451,7 @@ var conversations = sqliteCore.sqliteTable(
|
|
|
414
451
|
{
|
|
415
452
|
...projectScoped,
|
|
416
453
|
userId: sqliteCore.text("user_id"),
|
|
417
|
-
|
|
454
|
+
activeSubAgentId: sqliteCore.text("active_sub_agent_id").notNull(),
|
|
418
455
|
title: sqliteCore.text("title"),
|
|
419
456
|
lastContextResolution: sqliteCore.text("last_context_resolution"),
|
|
420
457
|
metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
|
|
@@ -438,15 +475,15 @@ var messages = sqliteCore.sqliteTable(
|
|
|
438
475
|
role: sqliteCore.text("role").notNull(),
|
|
439
476
|
// 'user' | 'agent' | 'system'
|
|
440
477
|
// Agent sender/recipient tracking (nullable - only populated when relevant)
|
|
441
|
-
|
|
478
|
+
fromSubAgentId: sqliteCore.text("from_sub_agent_id"),
|
|
442
479
|
// Populated when message is from an agent
|
|
443
|
-
|
|
480
|
+
toSubAgentId: sqliteCore.text("to_sub_agent_id"),
|
|
444
481
|
// Populated when message is directed to a specific agent (e.g., transfers/delegations)
|
|
445
482
|
// External agent sender tracking
|
|
446
|
-
fromExternalAgentId: sqliteCore.text("
|
|
483
|
+
fromExternalAgentId: sqliteCore.text("from_external_sub_agent_id"),
|
|
447
484
|
// Populated when message is directed from an external agent
|
|
448
485
|
// External agent recipient tracking
|
|
449
|
-
toExternalAgentId: sqliteCore.text("
|
|
486
|
+
toExternalAgentId: sqliteCore.text("to_external_sub_agent_id"),
|
|
450
487
|
// Populated when message is directed to an external agent
|
|
451
488
|
// Message content stored as JSON to support both formats
|
|
452
489
|
content: sqliteCore.blob("content", { mode: "json" }).$type().notNull(),
|
|
@@ -455,8 +492,6 @@ var messages = sqliteCore.sqliteTable(
|
|
|
455
492
|
// 'user-facing' | 'internal' | 'system' | 'external'
|
|
456
493
|
messageType: sqliteCore.text("message_type").notNull().default("chat"),
|
|
457
494
|
// '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
495
|
taskId: sqliteCore.text("task_id"),
|
|
461
496
|
parentMessageId: sqliteCore.text("parent_message_id"),
|
|
462
497
|
// Remove self-reference constraint here
|
|
@@ -583,10 +618,9 @@ drizzleOrm.relations(tasks, ({ one, many }) => ({
|
|
|
583
618
|
childRelations: many(taskRelations, {
|
|
584
619
|
relationName: "parentTask"
|
|
585
620
|
}),
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
references: [agents.id]
|
|
621
|
+
subAgent: one(subAgents, {
|
|
622
|
+
fields: [tasks.subAgentId],
|
|
623
|
+
references: [subAgents.id]
|
|
590
624
|
}),
|
|
591
625
|
// A task can have many messages associated with it
|
|
592
626
|
messages: many(messages),
|
|
@@ -594,7 +628,7 @@ drizzleOrm.relations(tasks, ({ one, many }) => ({
|
|
|
594
628
|
ledgerArtifacts: many(ledgerArtifacts)
|
|
595
629
|
}));
|
|
596
630
|
drizzleOrm.relations(projects, ({ many }) => ({
|
|
597
|
-
|
|
631
|
+
subAgents: many(subAgents),
|
|
598
632
|
agentGraphs: many(agentGraph),
|
|
599
633
|
tools: many(tools),
|
|
600
634
|
contextConfigs: many(contextConfigs),
|
|
@@ -632,17 +666,17 @@ drizzleOrm.relations(contextCache, ({ one }) => ({
|
|
|
632
666
|
references: [contextConfigs.id]
|
|
633
667
|
})
|
|
634
668
|
}));
|
|
635
|
-
drizzleOrm.relations(
|
|
669
|
+
drizzleOrm.relations(subAgents, ({ many, one }) => ({
|
|
636
670
|
project: one(projects, {
|
|
637
|
-
fields: [
|
|
671
|
+
fields: [subAgents.tenantId, subAgents.projectId],
|
|
638
672
|
references: [projects.tenantId, projects.id]
|
|
639
673
|
}),
|
|
640
674
|
tasks: many(tasks),
|
|
641
675
|
defaultForGraphs: many(agentGraph),
|
|
642
|
-
sourceRelations: many(
|
|
676
|
+
sourceRelations: many(subAgentRelations, {
|
|
643
677
|
relationName: "sourceRelations"
|
|
644
678
|
}),
|
|
645
|
-
targetRelations: many(
|
|
679
|
+
targetRelations: many(subAgentRelations, {
|
|
646
680
|
relationName: "targetRelations"
|
|
647
681
|
}),
|
|
648
682
|
sentMessages: many(messages, {
|
|
@@ -654,18 +688,18 @@ drizzleOrm.relations(agents, ({ many, one }) => ({
|
|
|
654
688
|
associatedMessages: many(messages, {
|
|
655
689
|
relationName: "associatedAgent"
|
|
656
690
|
}),
|
|
657
|
-
toolRelations: many(
|
|
658
|
-
dataComponentRelations: many(
|
|
659
|
-
artifactComponentRelations: many(
|
|
691
|
+
toolRelations: many(subAgentToolRelations),
|
|
692
|
+
dataComponentRelations: many(subAgentDataComponents),
|
|
693
|
+
artifactComponentRelations: many(subAgentArtifactComponents)
|
|
660
694
|
}));
|
|
661
695
|
drizzleOrm.relations(agentGraph, ({ one }) => ({
|
|
662
696
|
project: one(projects, {
|
|
663
697
|
fields: [agentGraph.tenantId, agentGraph.projectId],
|
|
664
698
|
references: [projects.tenantId, projects.id]
|
|
665
699
|
}),
|
|
666
|
-
|
|
667
|
-
fields: [agentGraph.
|
|
668
|
-
references: [
|
|
700
|
+
defaultSubAgent: one(subAgents, {
|
|
701
|
+
fields: [agentGraph.defaultSubAgentId],
|
|
702
|
+
references: [subAgents.id]
|
|
669
703
|
}),
|
|
670
704
|
contextConfig: one(contextConfigs, {
|
|
671
705
|
fields: [agentGraph.contextConfigId],
|
|
@@ -677,7 +711,7 @@ drizzleOrm.relations(externalAgents, ({ one, many }) => ({
|
|
|
677
711
|
fields: [externalAgents.tenantId, externalAgents.projectId],
|
|
678
712
|
references: [projects.tenantId, projects.id]
|
|
679
713
|
}),
|
|
680
|
-
|
|
714
|
+
subAgentRelations: many(subAgentRelations),
|
|
681
715
|
credentialReference: one(credentialReferences, {
|
|
682
716
|
fields: [externalAgents.credentialReferenceId],
|
|
683
717
|
references: [credentialReferences.id]
|
|
@@ -693,13 +727,13 @@ drizzleOrm.relations(apiKeys, ({ one }) => ({
|
|
|
693
727
|
references: [agentGraph.id]
|
|
694
728
|
})
|
|
695
729
|
}));
|
|
696
|
-
drizzleOrm.relations(
|
|
697
|
-
|
|
698
|
-
fields: [
|
|
699
|
-
references: [
|
|
730
|
+
drizzleOrm.relations(subAgentToolRelations, ({ one }) => ({
|
|
731
|
+
subAgent: one(subAgents, {
|
|
732
|
+
fields: [subAgentToolRelations.subAgentId],
|
|
733
|
+
references: [subAgents.id]
|
|
700
734
|
}),
|
|
701
735
|
tool: one(tools, {
|
|
702
|
-
fields: [
|
|
736
|
+
fields: [subAgentToolRelations.toolId],
|
|
703
737
|
references: [tools.id]
|
|
704
738
|
})
|
|
705
739
|
}));
|
|
@@ -711,7 +745,7 @@ drizzleOrm.relations(tools, ({ one, many }) => ({
|
|
|
711
745
|
fields: [tools.tenantId, tools.projectId],
|
|
712
746
|
references: [projects.tenantId, projects.id]
|
|
713
747
|
}),
|
|
714
|
-
|
|
748
|
+
subAgentRelations: many(subAgentToolRelations),
|
|
715
749
|
credentialReference: one(credentialReferences, {
|
|
716
750
|
fields: [tools.credentialReferenceId],
|
|
717
751
|
references: [credentialReferences.id]
|
|
@@ -727,9 +761,9 @@ drizzleOrm.relations(conversations, ({ one, many }) => ({
|
|
|
727
761
|
references: [projects.tenantId, projects.id]
|
|
728
762
|
}),
|
|
729
763
|
messages: many(messages),
|
|
730
|
-
|
|
731
|
-
fields: [conversations.
|
|
732
|
-
references: [
|
|
764
|
+
activeSubAgent: one(subAgents, {
|
|
765
|
+
fields: [conversations.activeSubAgentId],
|
|
766
|
+
references: [subAgents.id]
|
|
733
767
|
})
|
|
734
768
|
}));
|
|
735
769
|
drizzleOrm.relations(messages, ({ one, many }) => ({
|
|
@@ -737,20 +771,14 @@ drizzleOrm.relations(messages, ({ one, many }) => ({
|
|
|
737
771
|
fields: [messages.conversationId],
|
|
738
772
|
references: [conversations.id]
|
|
739
773
|
}),
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
references: [agents.id],
|
|
744
|
-
relationName: "associatedAgent"
|
|
745
|
-
}),
|
|
746
|
-
fromAgent: one(agents, {
|
|
747
|
-
fields: [messages.fromAgentId],
|
|
748
|
-
references: [agents.id],
|
|
774
|
+
fromSubAgent: one(subAgents, {
|
|
775
|
+
fields: [messages.fromSubAgentId],
|
|
776
|
+
references: [subAgents.id],
|
|
749
777
|
relationName: "sentMessages"
|
|
750
778
|
}),
|
|
751
|
-
|
|
752
|
-
fields: [messages.
|
|
753
|
-
references: [
|
|
779
|
+
toSubAgent: one(subAgents, {
|
|
780
|
+
fields: [messages.toSubAgentId],
|
|
781
|
+
references: [subAgents.id],
|
|
754
782
|
relationName: "receivedMessages"
|
|
755
783
|
}),
|
|
756
784
|
fromExternalAgent: one(externalAgents, {
|
|
@@ -776,33 +804,40 @@ drizzleOrm.relations(messages, ({ one, many }) => ({
|
|
|
776
804
|
relationName: "parentChild"
|
|
777
805
|
})
|
|
778
806
|
}));
|
|
779
|
-
drizzleOrm.relations(artifactComponents, ({ many }) => ({
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
agent: one(agents, {
|
|
784
|
-
fields: [agentArtifactComponents.agentId],
|
|
785
|
-
references: [agents.id]
|
|
807
|
+
drizzleOrm.relations(artifactComponents, ({ many, one }) => ({
|
|
808
|
+
project: one(projects, {
|
|
809
|
+
fields: [artifactComponents.tenantId, artifactComponents.projectId],
|
|
810
|
+
references: [projects.tenantId, projects.id]
|
|
786
811
|
}),
|
|
787
|
-
|
|
788
|
-
fields: [agentArtifactComponents.artifactComponentId],
|
|
789
|
-
references: [artifactComponents.id]
|
|
790
|
-
})
|
|
812
|
+
subAgentRelations: many(subAgentArtifactComponents)
|
|
791
813
|
}));
|
|
814
|
+
drizzleOrm.relations(
|
|
815
|
+
subAgentArtifactComponents,
|
|
816
|
+
({ one }) => ({
|
|
817
|
+
subAgent: one(subAgents, {
|
|
818
|
+
fields: [subAgentArtifactComponents.subAgentId],
|
|
819
|
+
references: [subAgents.id]
|
|
820
|
+
}),
|
|
821
|
+
artifactComponent: one(artifactComponents, {
|
|
822
|
+
fields: [subAgentArtifactComponents.artifactComponentId],
|
|
823
|
+
references: [artifactComponents.id]
|
|
824
|
+
})
|
|
825
|
+
})
|
|
826
|
+
);
|
|
792
827
|
drizzleOrm.relations(dataComponents, ({ many, one }) => ({
|
|
793
828
|
project: one(projects, {
|
|
794
829
|
fields: [dataComponents.tenantId, dataComponents.projectId],
|
|
795
830
|
references: [projects.tenantId, projects.id]
|
|
796
831
|
}),
|
|
797
|
-
|
|
832
|
+
subAgentRelations: many(subAgentDataComponents)
|
|
798
833
|
}));
|
|
799
|
-
drizzleOrm.relations(
|
|
800
|
-
|
|
801
|
-
fields: [
|
|
802
|
-
references: [
|
|
834
|
+
drizzleOrm.relations(subAgentDataComponents, ({ one }) => ({
|
|
835
|
+
subAgent: one(subAgents, {
|
|
836
|
+
fields: [subAgentDataComponents.subAgentId],
|
|
837
|
+
references: [subAgents.id]
|
|
803
838
|
}),
|
|
804
839
|
dataComponent: one(dataComponents, {
|
|
805
|
-
fields: [
|
|
840
|
+
fields: [subAgentDataComponents.dataComponentId],
|
|
806
841
|
references: [dataComponents.id]
|
|
807
842
|
})
|
|
808
843
|
}));
|
|
@@ -819,23 +854,23 @@ drizzleOrm.relations(ledgerArtifacts, ({ one }) => ({
|
|
|
819
854
|
drizzleOrm.relations(functions, ({ many }) => ({
|
|
820
855
|
tools: many(tools)
|
|
821
856
|
}));
|
|
822
|
-
drizzleOrm.relations(
|
|
857
|
+
drizzleOrm.relations(subAgentRelations, ({ one }) => ({
|
|
823
858
|
graph: one(agentGraph, {
|
|
824
|
-
fields: [
|
|
859
|
+
fields: [subAgentRelations.graphId],
|
|
825
860
|
references: [agentGraph.id]
|
|
826
861
|
}),
|
|
827
|
-
|
|
828
|
-
fields: [
|
|
829
|
-
references: [
|
|
862
|
+
sourceSubAgent: one(subAgents, {
|
|
863
|
+
fields: [subAgentRelations.sourceSubAgentId],
|
|
864
|
+
references: [subAgents.id],
|
|
830
865
|
relationName: "sourceRelations"
|
|
831
866
|
}),
|
|
832
|
-
|
|
833
|
-
fields: [
|
|
834
|
-
references: [
|
|
867
|
+
targetSubAgent: one(subAgents, {
|
|
868
|
+
fields: [subAgentRelations.targetSubAgentId],
|
|
869
|
+
references: [subAgents.id],
|
|
835
870
|
relationName: "targetRelations"
|
|
836
871
|
}),
|
|
837
872
|
externalAgent: one(externalAgents, {
|
|
838
|
-
fields: [
|
|
873
|
+
fields: [subAgentRelations.externalSubAgentId],
|
|
839
874
|
references: [externalAgents.id]
|
|
840
875
|
})
|
|
841
876
|
}));
|
|
@@ -906,22 +941,22 @@ var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId:
|
|
|
906
941
|
var createGraphScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
|
|
907
942
|
var createGraphScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
|
|
908
943
|
var createGraphScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true }).partial();
|
|
909
|
-
var
|
|
910
|
-
var
|
|
944
|
+
var SubAgentSelectSchema = drizzleZod.createSelectSchema(subAgents);
|
|
945
|
+
var SubAgentInsertSchema = drizzleZod.createInsertSchema(subAgents).extend({
|
|
911
946
|
id: resourceIdSchema,
|
|
912
947
|
models: ModelSchema.optional()
|
|
913
948
|
});
|
|
914
|
-
var
|
|
915
|
-
var
|
|
916
|
-
var
|
|
917
|
-
var
|
|
918
|
-
var AgentRelationSelectSchema = drizzleZod.createSelectSchema(
|
|
919
|
-
var AgentRelationInsertSchema = drizzleZod.createInsertSchema(
|
|
949
|
+
var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
|
|
950
|
+
var SubAgentApiSelectSchema = createGraphScopedApiSchema(SubAgentSelectSchema);
|
|
951
|
+
var SubAgentApiInsertSchema = createGraphScopedApiInsertSchema(SubAgentInsertSchema);
|
|
952
|
+
var SubAgentApiUpdateSchema = createGraphScopedApiUpdateSchema(SubAgentUpdateSchema);
|
|
953
|
+
var AgentRelationSelectSchema = drizzleZod.createSelectSchema(subAgentRelations);
|
|
954
|
+
var AgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
|
|
920
955
|
id: resourceIdSchema,
|
|
921
956
|
graphId: resourceIdSchema,
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
957
|
+
sourceSubAgentId: resourceIdSchema,
|
|
958
|
+
targetSubAgentId: resourceIdSchema.optional(),
|
|
959
|
+
externalSubAgentId: resourceIdSchema.optional()
|
|
925
960
|
});
|
|
926
961
|
var AgentRelationUpdateSchema = AgentRelationInsertSchema.partial();
|
|
927
962
|
var AgentRelationApiSelectSchema = createGraphScopedApiSchema(AgentRelationSelectSchema);
|
|
@@ -931,13 +966,13 @@ var AgentRelationApiInsertSchema = createGraphScopedApiInsertSchema(
|
|
|
931
966
|
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES)
|
|
932
967
|
}).refine(
|
|
933
968
|
(data) => {
|
|
934
|
-
const hasTarget = data.
|
|
935
|
-
const hasExternal = data.
|
|
969
|
+
const hasTarget = data.targetSubAgentId != null;
|
|
970
|
+
const hasExternal = data.externalSubAgentId != null;
|
|
936
971
|
return hasTarget !== hasExternal;
|
|
937
972
|
},
|
|
938
973
|
{
|
|
939
|
-
message: "Must specify exactly one of
|
|
940
|
-
path: ["
|
|
974
|
+
message: "Must specify exactly one of targetSubAgentId or externalSubAgentId",
|
|
975
|
+
path: ["targetSubAgentId", "externalSubAgentId"]
|
|
941
976
|
}
|
|
942
977
|
);
|
|
943
978
|
var AgentRelationApiUpdateSchema = createGraphScopedApiUpdateSchema(
|
|
@@ -946,28 +981,28 @@ var AgentRelationApiUpdateSchema = createGraphScopedApiUpdateSchema(
|
|
|
946
981
|
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES).optional()
|
|
947
982
|
}).refine(
|
|
948
983
|
(data) => {
|
|
949
|
-
const hasTarget = data.
|
|
950
|
-
const hasExternal = data.
|
|
984
|
+
const hasTarget = data.targetSubAgentId != null;
|
|
985
|
+
const hasExternal = data.externalSubAgentId != null;
|
|
951
986
|
if (!hasTarget && !hasExternal) {
|
|
952
987
|
return true;
|
|
953
988
|
}
|
|
954
989
|
return hasTarget !== hasExternal;
|
|
955
990
|
},
|
|
956
991
|
{
|
|
957
|
-
message: "Must specify exactly one of
|
|
958
|
-
path: ["
|
|
992
|
+
message: "Must specify exactly one of targetSubAgentId or externalSubAgentId when updating agent relationships",
|
|
993
|
+
path: ["targetSubAgentId", "externalSubAgentId"]
|
|
959
994
|
}
|
|
960
995
|
);
|
|
961
996
|
var AgentRelationQuerySchema = zodOpenapi.z.object({
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
997
|
+
sourceSubAgentId: zodOpenapi.z.string().optional(),
|
|
998
|
+
targetSubAgentId: zodOpenapi.z.string().optional(),
|
|
999
|
+
externalSubAgentId: zodOpenapi.z.string().optional()
|
|
965
1000
|
});
|
|
966
|
-
var ExternalAgentRelationInsertSchema = drizzleZod.createInsertSchema(
|
|
1001
|
+
var ExternalAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
|
|
967
1002
|
id: resourceIdSchema,
|
|
968
1003
|
graphId: resourceIdSchema,
|
|
969
|
-
|
|
970
|
-
|
|
1004
|
+
sourceSubAgentId: resourceIdSchema,
|
|
1005
|
+
externalSubAgentId: resourceIdSchema
|
|
971
1006
|
});
|
|
972
1007
|
var ExternalAgentRelationApiInsertSchema = createApiInsertSchema(
|
|
973
1008
|
ExternalAgentRelationInsertSchema
|
|
@@ -1101,8 +1136,8 @@ var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
|
|
|
1101
1136
|
var DataComponentApiSelectSchema = createApiSchema(DataComponentSelectSchema);
|
|
1102
1137
|
var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema);
|
|
1103
1138
|
var DataComponentApiUpdateSchema = createApiUpdateSchema(DataComponentUpdateSchema);
|
|
1104
|
-
var AgentDataComponentSelectSchema = drizzleZod.createSelectSchema(
|
|
1105
|
-
var AgentDataComponentInsertSchema = drizzleZod.createInsertSchema(
|
|
1139
|
+
var AgentDataComponentSelectSchema = drizzleZod.createSelectSchema(subAgentDataComponents);
|
|
1140
|
+
var AgentDataComponentInsertSchema = drizzleZod.createInsertSchema(subAgentDataComponents);
|
|
1106
1141
|
var AgentDataComponentUpdateSchema = AgentDataComponentInsertSchema.partial();
|
|
1107
1142
|
var AgentDataComponentApiSelectSchema = createGraphScopedApiSchema(
|
|
1108
1143
|
AgentDataComponentSelectSchema
|
|
@@ -1131,12 +1166,12 @@ var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
|
|
|
1131
1166
|
var ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
|
|
1132
1167
|
ArtifactComponentUpdateSchema
|
|
1133
1168
|
);
|
|
1134
|
-
var AgentArtifactComponentSelectSchema = drizzleZod.createSelectSchema(
|
|
1169
|
+
var AgentArtifactComponentSelectSchema = drizzleZod.createSelectSchema(subAgentArtifactComponents);
|
|
1135
1170
|
var AgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
|
|
1136
|
-
|
|
1171
|
+
subAgentArtifactComponents
|
|
1137
1172
|
).extend({
|
|
1138
1173
|
id: resourceIdSchema,
|
|
1139
|
-
|
|
1174
|
+
subAgentId: resourceIdSchema,
|
|
1140
1175
|
artifactComponentId: resourceIdSchema
|
|
1141
1176
|
});
|
|
1142
1177
|
var AgentArtifactComponentUpdateSchema = AgentArtifactComponentInsertSchema.partial();
|
|
@@ -1164,7 +1199,7 @@ var ExternalAgentApiSelectSchema = createGraphScopedApiSchema(ExternalAgentSelec
|
|
|
1164
1199
|
var ExternalAgentApiInsertSchema = createGraphScopedApiInsertSchema(ExternalAgentInsertSchema);
|
|
1165
1200
|
var ExternalAgentApiUpdateSchema = createGraphScopedApiUpdateSchema(ExternalAgentUpdateSchema);
|
|
1166
1201
|
var AllAgentSchema = zodOpenapi.z.discriminatedUnion("type", [
|
|
1167
|
-
|
|
1202
|
+
SubAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
|
|
1168
1203
|
ExternalAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
1169
1204
|
]);
|
|
1170
1205
|
var ApiKeySelectSchema = drizzleZod.createSelectSchema(apiKeys);
|
|
@@ -1319,10 +1354,10 @@ var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSche
|
|
|
1319
1354
|
var ContextConfigApiUpdateSchema = createApiUpdateSchema(ContextConfigUpdateSchema).omit({
|
|
1320
1355
|
graphId: true
|
|
1321
1356
|
});
|
|
1322
|
-
var AgentToolRelationSelectSchema = drizzleZod.createSelectSchema(
|
|
1323
|
-
var AgentToolRelationInsertSchema = drizzleZod.createInsertSchema(
|
|
1357
|
+
var AgentToolRelationSelectSchema = drizzleZod.createSelectSchema(subAgentToolRelations);
|
|
1358
|
+
var AgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToolRelations).extend({
|
|
1324
1359
|
id: resourceIdSchema,
|
|
1325
|
-
|
|
1360
|
+
subAgentId: resourceIdSchema,
|
|
1326
1361
|
toolId: resourceIdSchema,
|
|
1327
1362
|
selectedTools: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
|
|
1328
1363
|
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
@@ -1365,7 +1400,7 @@ var CanUseItemSchema = zodOpenapi.z.object({
|
|
|
1365
1400
|
toolSelection: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
|
|
1366
1401
|
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1367
1402
|
});
|
|
1368
|
-
var FullGraphAgentInsertSchema =
|
|
1403
|
+
var FullGraphAgentInsertSchema = SubAgentApiInsertSchema.extend({
|
|
1369
1404
|
type: zodOpenapi.z.literal("internal"),
|
|
1370
1405
|
canUse: zodOpenapi.z.array(CanUseItemSchema),
|
|
1371
1406
|
// All tools (both MCP and function tools)
|
|
@@ -1374,27 +1409,17 @@ var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
|
|
|
1374
1409
|
canTransferTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1375
1410
|
canDelegateTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
1376
1411
|
});
|
|
1377
|
-
var FullGraphDefinitionSchema = AgentGraphApiInsertSchema.extend({
|
|
1378
|
-
agents: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])),
|
|
1379
|
-
// Lookup maps for UI to resolve canUse items
|
|
1380
|
-
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
|
|
1381
|
-
// Get tool name/description from toolId
|
|
1382
|
-
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1383
|
-
// Get function code for function tools
|
|
1384
|
-
contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
|
|
1385
|
-
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
1386
|
-
models: ModelSchema.optional(),
|
|
1387
|
-
stopWhen: GraphStopWhenSchema.optional(),
|
|
1388
|
-
graphPrompt: zodOpenapi.z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
|
|
1389
|
-
});
|
|
1390
1412
|
var GraphWithinContextOfProjectSchema = AgentGraphApiInsertSchema.extend({
|
|
1391
|
-
|
|
1413
|
+
subAgents: zodOpenapi.z.record(
|
|
1392
1414
|
zodOpenapi.z.string(),
|
|
1393
1415
|
zodOpenapi.z.discriminatedUnion("type", [
|
|
1394
1416
|
FullGraphAgentInsertSchema,
|
|
1395
1417
|
ExternalAgentApiInsertSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
1396
1418
|
])
|
|
1397
1419
|
),
|
|
1420
|
+
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
|
|
1421
|
+
// Get tool name/description from toolId
|
|
1422
|
+
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1398
1423
|
contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
|
|
1399
1424
|
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
1400
1425
|
models: ModelSchema.optional(),
|
|
@@ -1466,72 +1491,46 @@ var HeadersScopeSchema = zodOpenapi.z.object({
|
|
|
1466
1491
|
example: "graph_789"
|
|
1467
1492
|
})
|
|
1468
1493
|
});
|
|
1494
|
+
var TenantId = zodOpenapi.z.string().openapi({
|
|
1495
|
+
description: "Tenant identifier",
|
|
1496
|
+
example: "tenant_123"
|
|
1497
|
+
});
|
|
1498
|
+
var ProjectId = zodOpenapi.z.string().openapi({
|
|
1499
|
+
description: "Project identifier",
|
|
1500
|
+
example: "project_456"
|
|
1501
|
+
});
|
|
1502
|
+
var GraphId = zodOpenapi.z.string().openapi({
|
|
1503
|
+
description: "Graph identifier",
|
|
1504
|
+
example: "graph_789"
|
|
1505
|
+
});
|
|
1506
|
+
var SubAgentId = zodOpenapi.z.string().openapi({
|
|
1507
|
+
description: "Sub-agent identifier",
|
|
1508
|
+
example: "sub_agent_123"
|
|
1509
|
+
});
|
|
1469
1510
|
var TenantParamsSchema = zodOpenapi.z.object({
|
|
1470
|
-
tenantId:
|
|
1471
|
-
description: "Tenant identifier",
|
|
1472
|
-
example: "tenant_123"
|
|
1473
|
-
})
|
|
1511
|
+
tenantId: TenantId
|
|
1474
1512
|
}).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
|
-
}),
|
|
1513
|
+
var TenantIdParamsSchema = TenantParamsSchema.extend({
|
|
1512
1514
|
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
|
-
}),
|
|
1515
|
+
}).openapi("TenantIdParams");
|
|
1516
|
+
var TenantProjectParamsSchema = TenantParamsSchema.extend({
|
|
1517
|
+
projectId: ProjectId
|
|
1518
|
+
}).openapi("TenantProjectParams");
|
|
1519
|
+
var TenantProjectIdParamsSchema = TenantProjectParamsSchema.extend({
|
|
1523
1520
|
id: resourceIdSchema
|
|
1524
1521
|
}).openapi("TenantProjectIdParams");
|
|
1525
|
-
var
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
}),
|
|
1522
|
+
var TenantProjectGraphParamsSchema = TenantProjectParamsSchema.extend({
|
|
1523
|
+
graphId: GraphId
|
|
1524
|
+
}).openapi("TenantProjectGraphParams");
|
|
1525
|
+
var TenantProjectGraphIdParamsSchema = TenantProjectGraphParamsSchema.extend({
|
|
1530
1526
|
id: resourceIdSchema
|
|
1531
|
-
}).openapi("
|
|
1532
|
-
var
|
|
1527
|
+
}).openapi("TenantProjectGraphIdParams");
|
|
1528
|
+
var TenantProjectGraphSubAgentParamsSchema = TenantProjectGraphParamsSchema.extend({
|
|
1529
|
+
subAgentId: SubAgentId
|
|
1530
|
+
}).openapi("TenantProjectGraphSubAgentParams");
|
|
1531
|
+
var TenantProjectGraphSubAgentIdParamsSchema = TenantProjectGraphSubAgentParamsSchema.extend({
|
|
1533
1532
|
id: resourceIdSchema
|
|
1534
|
-
}).openapi("
|
|
1533
|
+
}).openapi("TenantProjectGraphSubAgentIdParams");
|
|
1535
1534
|
var PaginationQueryParamsSchema = zodOpenapi.z.object({
|
|
1536
1535
|
page: zodOpenapi.z.coerce.number().min(1).default(1),
|
|
1537
1536
|
limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10)
|
|
@@ -1545,18 +1544,18 @@ function isExternalAgent(agent) {
|
|
|
1545
1544
|
return "baseUrl" in agent;
|
|
1546
1545
|
}
|
|
1547
1546
|
function validateAndTypeGraphData(data) {
|
|
1548
|
-
return
|
|
1547
|
+
return GraphWithinContextOfProjectSchema.parse(data);
|
|
1549
1548
|
}
|
|
1550
1549
|
function validateToolReferences(graphData, availableToolIds) {
|
|
1551
1550
|
if (!availableToolIds) {
|
|
1552
1551
|
return;
|
|
1553
1552
|
}
|
|
1554
1553
|
const errors = [];
|
|
1555
|
-
for (const [
|
|
1554
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
1556
1555
|
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
1557
1556
|
for (const canUseItem of agentData.canUse) {
|
|
1558
1557
|
if (!availableToolIds.has(canUseItem.toolId)) {
|
|
1559
|
-
errors.push(`Agent '${
|
|
1558
|
+
errors.push(`Agent '${subAgentId}' references non-existent tool '${canUseItem.toolId}'`);
|
|
1560
1559
|
}
|
|
1561
1560
|
}
|
|
1562
1561
|
}
|
|
@@ -1571,12 +1570,12 @@ function validateDataComponentReferences(graphData, availableDataComponentIds) {
|
|
|
1571
1570
|
return;
|
|
1572
1571
|
}
|
|
1573
1572
|
const errors = [];
|
|
1574
|
-
for (const [
|
|
1573
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
1575
1574
|
if (isInternalAgent(agentData) && agentData.dataComponents) {
|
|
1576
1575
|
for (const dataComponentId of agentData.dataComponents) {
|
|
1577
1576
|
if (!availableDataComponentIds.has(dataComponentId)) {
|
|
1578
1577
|
errors.push(
|
|
1579
|
-
`Agent '${
|
|
1578
|
+
`Agent '${subAgentId}' references non-existent dataComponent '${dataComponentId}'`
|
|
1580
1579
|
);
|
|
1581
1580
|
}
|
|
1582
1581
|
}
|
|
@@ -1592,12 +1591,12 @@ function validateArtifactComponentReferences(graphData, availableArtifactCompone
|
|
|
1592
1591
|
return;
|
|
1593
1592
|
}
|
|
1594
1593
|
const errors = [];
|
|
1595
|
-
for (const [
|
|
1594
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
1596
1595
|
if (isInternalAgent(agentData) && agentData.artifactComponents) {
|
|
1597
1596
|
for (const artifactComponentId of agentData.artifactComponents) {
|
|
1598
1597
|
if (!availableArtifactComponentIds.has(artifactComponentId)) {
|
|
1599
1598
|
errors.push(
|
|
1600
|
-
`Agent '${
|
|
1599
|
+
`Agent '${subAgentId}' references non-existent artifactComponent '${artifactComponentId}'`
|
|
1601
1600
|
);
|
|
1602
1601
|
}
|
|
1603
1602
|
}
|
|
@@ -1610,14 +1609,14 @@ ${errors.join("\n")}`);
|
|
|
1610
1609
|
}
|
|
1611
1610
|
function validateAgentRelationships(graphData) {
|
|
1612
1611
|
const errors = [];
|
|
1613
|
-
const availableAgentIds = new Set(Object.keys(graphData.
|
|
1614
|
-
for (const [
|
|
1612
|
+
const availableAgentIds = new Set(Object.keys(graphData.subAgents));
|
|
1613
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
1615
1614
|
if (isInternalAgent(agentData)) {
|
|
1616
1615
|
if (agentData.canTransferTo && Array.isArray(agentData.canTransferTo)) {
|
|
1617
1616
|
for (const targetId of agentData.canTransferTo) {
|
|
1618
1617
|
if (!availableAgentIds.has(targetId)) {
|
|
1619
1618
|
errors.push(
|
|
1620
|
-
`Agent '${
|
|
1619
|
+
`Agent '${subAgentId}' has transfer target '${targetId}' that doesn't exist in graph`
|
|
1621
1620
|
);
|
|
1622
1621
|
}
|
|
1623
1622
|
}
|
|
@@ -1626,7 +1625,7 @@ function validateAgentRelationships(graphData) {
|
|
|
1626
1625
|
for (const targetId of agentData.canDelegateTo) {
|
|
1627
1626
|
if (!availableAgentIds.has(targetId)) {
|
|
1628
1627
|
errors.push(
|
|
1629
|
-
`Agent '${
|
|
1628
|
+
`Agent '${subAgentId}' has delegation target '${targetId}' that doesn't exist in graph`
|
|
1630
1629
|
);
|
|
1631
1630
|
}
|
|
1632
1631
|
}
|
|
@@ -1639,8 +1638,8 @@ ${errors.join("\n")}`);
|
|
|
1639
1638
|
}
|
|
1640
1639
|
}
|
|
1641
1640
|
function validateGraphStructure(graphData, projectResources) {
|
|
1642
|
-
if (graphData.
|
|
1643
|
-
throw new Error(`Default agent '${graphData.
|
|
1641
|
+
if (graphData.defaultSubAgentId && !graphData.subAgents[graphData.defaultSubAgentId]) {
|
|
1642
|
+
throw new Error(`Default agent '${graphData.defaultSubAgentId}' does not exist in agents`);
|
|
1644
1643
|
}
|
|
1645
1644
|
if (projectResources) {
|
|
1646
1645
|
validateToolReferences(graphData, projectResources.toolIds);
|
|
@@ -1770,9 +1769,7 @@ function validatePropsAsJsonSchema(props) {
|
|
|
1770
1769
|
}
|
|
1771
1770
|
}
|
|
1772
1771
|
|
|
1773
|
-
exports.
|
|
1774
|
-
exports.AgentApiSelectSchema = AgentApiSelectSchema;
|
|
1775
|
-
exports.AgentApiUpdateSchema = AgentApiUpdateSchema;
|
|
1772
|
+
exports.A2AMessageMetadataSchema = A2AMessageMetadataSchema;
|
|
1776
1773
|
exports.AgentArtifactComponentApiInsertSchema = AgentArtifactComponentApiInsertSchema;
|
|
1777
1774
|
exports.AgentArtifactComponentApiSelectSchema = AgentArtifactComponentApiSelectSchema;
|
|
1778
1775
|
exports.AgentArtifactComponentApiUpdateSchema = AgentArtifactComponentApiUpdateSchema;
|
|
@@ -1791,7 +1788,6 @@ exports.AgentGraphApiUpdateSchema = AgentGraphApiUpdateSchema;
|
|
|
1791
1788
|
exports.AgentGraphInsertSchema = AgentGraphInsertSchema;
|
|
1792
1789
|
exports.AgentGraphSelectSchema = AgentGraphSelectSchema;
|
|
1793
1790
|
exports.AgentGraphUpdateSchema = AgentGraphUpdateSchema;
|
|
1794
|
-
exports.AgentInsertSchema = AgentInsertSchema;
|
|
1795
1791
|
exports.AgentRelationApiInsertSchema = AgentRelationApiInsertSchema;
|
|
1796
1792
|
exports.AgentRelationApiSelectSchema = AgentRelationApiSelectSchema;
|
|
1797
1793
|
exports.AgentRelationApiUpdateSchema = AgentRelationApiUpdateSchema;
|
|
@@ -1799,7 +1795,6 @@ exports.AgentRelationInsertSchema = AgentRelationInsertSchema;
|
|
|
1799
1795
|
exports.AgentRelationQuerySchema = AgentRelationQuerySchema;
|
|
1800
1796
|
exports.AgentRelationSelectSchema = AgentRelationSelectSchema;
|
|
1801
1797
|
exports.AgentRelationUpdateSchema = AgentRelationUpdateSchema;
|
|
1802
|
-
exports.AgentSelectSchema = AgentSelectSchema;
|
|
1803
1798
|
exports.AgentStopWhenSchema = AgentStopWhenSchema;
|
|
1804
1799
|
exports.AgentToolRelationApiInsertSchema = AgentToolRelationApiInsertSchema;
|
|
1805
1800
|
exports.AgentToolRelationApiSelectSchema = AgentToolRelationApiSelectSchema;
|
|
@@ -1807,7 +1802,6 @@ exports.AgentToolRelationApiUpdateSchema = AgentToolRelationApiUpdateSchema;
|
|
|
1807
1802
|
exports.AgentToolRelationInsertSchema = AgentToolRelationInsertSchema;
|
|
1808
1803
|
exports.AgentToolRelationSelectSchema = AgentToolRelationSelectSchema;
|
|
1809
1804
|
exports.AgentToolRelationUpdateSchema = AgentToolRelationUpdateSchema;
|
|
1810
|
-
exports.AgentUpdateSchema = AgentUpdateSchema;
|
|
1811
1805
|
exports.AllAgentSchema = AllAgentSchema;
|
|
1812
1806
|
exports.ApiKeyApiCreationResponseSchema = ApiKeyApiCreationResponseSchema;
|
|
1813
1807
|
exports.ApiKeyApiInsertSchema = ApiKeyApiInsertSchema;
|
|
@@ -1854,6 +1848,10 @@ exports.DataComponentBaseSchema = DataComponentBaseSchema;
|
|
|
1854
1848
|
exports.DataComponentInsertSchema = DataComponentInsertSchema;
|
|
1855
1849
|
exports.DataComponentSelectSchema = DataComponentSelectSchema;
|
|
1856
1850
|
exports.DataComponentUpdateSchema = DataComponentUpdateSchema;
|
|
1851
|
+
exports.DataOperationDetailsSchema = DataOperationDetailsSchema;
|
|
1852
|
+
exports.DataOperationEventSchema = DataOperationEventSchema;
|
|
1853
|
+
exports.DelegationReturnedDataSchema = DelegationReturnedDataSchema;
|
|
1854
|
+
exports.DelegationSentDataSchema = DelegationSentDataSchema;
|
|
1857
1855
|
exports.ErrorResponseSchema = ErrorResponseSchema;
|
|
1858
1856
|
exports.ExistsResponseSchema = ExistsResponseSchema;
|
|
1859
1857
|
exports.ExternalAgentApiInsertSchema = ExternalAgentApiInsertSchema;
|
|
@@ -1867,7 +1865,6 @@ exports.ExternalAgentUpdateSchema = ExternalAgentUpdateSchema;
|
|
|
1867
1865
|
exports.FetchConfigSchema = FetchConfigSchema;
|
|
1868
1866
|
exports.FetchDefinitionSchema = FetchDefinitionSchema;
|
|
1869
1867
|
exports.FullGraphAgentInsertSchema = FullGraphAgentInsertSchema;
|
|
1870
|
-
exports.FullGraphDefinitionSchema = FullGraphDefinitionSchema;
|
|
1871
1868
|
exports.FullProjectDefinitionSchema = FullProjectDefinitionSchema;
|
|
1872
1869
|
exports.FunctionApiInsertSchema = FunctionApiInsertSchema;
|
|
1873
1870
|
exports.FunctionApiSelectSchema = FunctionApiSelectSchema;
|
|
@@ -1879,7 +1876,6 @@ exports.FunctionUpdateSchema = FunctionUpdateSchema;
|
|
|
1879
1876
|
exports.GraphStopWhenSchema = GraphStopWhenSchema;
|
|
1880
1877
|
exports.GraphWithinContextOfProjectSchema = GraphWithinContextOfProjectSchema;
|
|
1881
1878
|
exports.HeadersScopeSchema = HeadersScopeSchema;
|
|
1882
|
-
exports.IdParamsSchema = IdParamsSchema;
|
|
1883
1879
|
exports.LedgerArtifactApiInsertSchema = LedgerArtifactApiInsertSchema;
|
|
1884
1880
|
exports.LedgerArtifactApiSelectSchema = LedgerArtifactApiSelectSchema;
|
|
1885
1881
|
exports.LedgerArtifactApiUpdateSchema = LedgerArtifactApiUpdateSchema;
|
|
@@ -1916,6 +1912,12 @@ exports.SingleResponseSchema = SingleResponseSchema;
|
|
|
1916
1912
|
exports.StatusComponentSchema = StatusComponentSchema;
|
|
1917
1913
|
exports.StatusUpdateSchema = StatusUpdateSchema;
|
|
1918
1914
|
exports.StopWhenSchema = StopWhenSchema;
|
|
1915
|
+
exports.SubAgentApiInsertSchema = SubAgentApiInsertSchema;
|
|
1916
|
+
exports.SubAgentApiSelectSchema = SubAgentApiSelectSchema;
|
|
1917
|
+
exports.SubAgentApiUpdateSchema = SubAgentApiUpdateSchema;
|
|
1918
|
+
exports.SubAgentInsertSchema = SubAgentInsertSchema;
|
|
1919
|
+
exports.SubAgentSelectSchema = SubAgentSelectSchema;
|
|
1920
|
+
exports.SubAgentUpdateSchema = SubAgentUpdateSchema;
|
|
1919
1921
|
exports.TaskApiInsertSchema = TaskApiInsertSchema;
|
|
1920
1922
|
exports.TaskApiSelectSchema = TaskApiSelectSchema;
|
|
1921
1923
|
exports.TaskApiUpdateSchema = TaskApiUpdateSchema;
|
|
@@ -1932,6 +1934,8 @@ exports.TenantIdParamsSchema = TenantIdParamsSchema;
|
|
|
1932
1934
|
exports.TenantParamsSchema = TenantParamsSchema;
|
|
1933
1935
|
exports.TenantProjectGraphIdParamsSchema = TenantProjectGraphIdParamsSchema;
|
|
1934
1936
|
exports.TenantProjectGraphParamsSchema = TenantProjectGraphParamsSchema;
|
|
1937
|
+
exports.TenantProjectGraphSubAgentIdParamsSchema = TenantProjectGraphSubAgentIdParamsSchema;
|
|
1938
|
+
exports.TenantProjectGraphSubAgentParamsSchema = TenantProjectGraphSubAgentParamsSchema;
|
|
1935
1939
|
exports.TenantProjectIdParamsSchema = TenantProjectIdParamsSchema;
|
|
1936
1940
|
exports.TenantProjectParamsSchema = TenantProjectParamsSchema;
|
|
1937
1941
|
exports.ToolApiInsertSchema = ToolApiInsertSchema;
|
|
@@ -1941,6 +1945,7 @@ exports.ToolInsertSchema = ToolInsertSchema;
|
|
|
1941
1945
|
exports.ToolSelectSchema = ToolSelectSchema;
|
|
1942
1946
|
exports.ToolStatusSchema = ToolStatusSchema;
|
|
1943
1947
|
exports.ToolUpdateSchema = ToolUpdateSchema;
|
|
1948
|
+
exports.TransferDataSchema = TransferDataSchema;
|
|
1944
1949
|
exports.URL_SAFE_ID_PATTERN = URL_SAFE_ID_PATTERN;
|
|
1945
1950
|
exports.generateIdFromName = generateIdFromName;
|
|
1946
1951
|
exports.isExternalAgent = isExternalAgent;
|