@inkeep/agents-core 0.17.0 → 0.18.1
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-H6PMWHNV.js +278 -0
- package/dist/{chunk-VPJ6Z5QZ.js → chunk-ID4CFGVF.js} +202 -131
- package/dist/chunk-JTHQYGCX.js +173 -0
- package/dist/client-exports.cjs +628 -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 +2740 -1831
- package/dist/index.d.cts +1664 -1544
- package/dist/index.d.ts +1664 -1544
- package/dist/index.js +1953 -1467
- package/dist/{schema-Ct2NlO81.d.cts → schema-ULFEZCOL.d.cts} +475 -174
- package/dist/{schema-BQk_FMBV.d.ts → schema-wbZXiVWb.d.ts} +475 -174
- package/dist/signoz-queries-BuiipZTk.d.cts +274 -0
- package/dist/signoz-queries-BuiipZTk.d.ts +274 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/{utility-s9c5CVOe.d.cts → utility-CyPQ1tC_.d.cts} +591 -390
- package/dist/{utility-s9c5CVOe.d.ts → utility-CyPQ1tC_.d.ts} +591 -390
- 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
package/dist/client-exports.cjs
CHANGED
|
@@ -41,9 +41,9 @@ var graphScoped = {
|
|
|
41
41
|
...projectScoped,
|
|
42
42
|
graphId: sqliteCore.text("graph_id").notNull()
|
|
43
43
|
};
|
|
44
|
-
var
|
|
44
|
+
var subAgentScoped = {
|
|
45
45
|
...graphScoped,
|
|
46
|
-
|
|
46
|
+
subAgentId: sqliteCore.text("sub_agent_id").notNull()
|
|
47
47
|
};
|
|
48
48
|
var uiProperties = {
|
|
49
49
|
name: sqliteCore.text("name").notNull(),
|
|
@@ -74,7 +74,7 @@ var agentGraph = sqliteCore.sqliteTable(
|
|
|
74
74
|
...projectScoped,
|
|
75
75
|
name: sqliteCore.text("name").notNull(),
|
|
76
76
|
description: sqliteCore.text("description"),
|
|
77
|
-
|
|
77
|
+
defaultSubAgentId: sqliteCore.text("default_sub_agent_id"),
|
|
78
78
|
// Reference to shared context configuration for all agents in this graph
|
|
79
79
|
contextConfigId: sqliteCore.text("context_config_id"),
|
|
80
80
|
// add fk relationship
|
|
@@ -153,8 +153,8 @@ var contextCache = sqliteCore.sqliteTable(
|
|
|
153
153
|
)
|
|
154
154
|
]
|
|
155
155
|
);
|
|
156
|
-
var
|
|
157
|
-
"
|
|
156
|
+
var subAgents = sqliteCore.sqliteTable(
|
|
157
|
+
"sub_agents",
|
|
158
158
|
{
|
|
159
159
|
...graphScoped,
|
|
160
160
|
...uiProperties,
|
|
@@ -176,17 +176,16 @@ var agents = sqliteCore.sqliteTable(
|
|
|
176
176
|
}).onDelete("cascade")
|
|
177
177
|
]
|
|
178
178
|
);
|
|
179
|
-
var
|
|
180
|
-
"
|
|
179
|
+
var subAgentRelations = sqliteCore.sqliteTable(
|
|
180
|
+
"sub_agent_relations",
|
|
181
181
|
{
|
|
182
182
|
...graphScoped,
|
|
183
|
-
|
|
183
|
+
sourceSubAgentId: sqliteCore.text("source_sub_agent_id").notNull(),
|
|
184
184
|
// For internal relationships
|
|
185
|
-
|
|
185
|
+
targetSubAgentId: sqliteCore.text("target_sub_agent_id"),
|
|
186
186
|
// For external relationships
|
|
187
|
-
|
|
187
|
+
externalSubAgentId: sqliteCore.text("external_sub_agent_id"),
|
|
188
188
|
relationType: sqliteCore.text("relation_type"),
|
|
189
|
-
// 'transfer' | 'delegate'
|
|
190
189
|
...timestamps
|
|
191
190
|
},
|
|
192
191
|
(table) => [
|
|
@@ -194,7 +193,7 @@ var agentRelations = sqliteCore.sqliteTable(
|
|
|
194
193
|
sqliteCore.foreignKey({
|
|
195
194
|
columns: [table.tenantId, table.projectId, table.graphId],
|
|
196
195
|
foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
|
|
197
|
-
name: "
|
|
196
|
+
name: "sub_agent_relations_graph_fk"
|
|
198
197
|
}).onDelete("cascade")
|
|
199
198
|
]
|
|
200
199
|
);
|
|
@@ -230,7 +229,7 @@ var externalAgents = sqliteCore.sqliteTable(
|
|
|
230
229
|
var tasks = sqliteCore.sqliteTable(
|
|
231
230
|
"tasks",
|
|
232
231
|
{
|
|
233
|
-
...
|
|
232
|
+
...subAgentScoped,
|
|
234
233
|
contextId: sqliteCore.text("context_id").notNull(),
|
|
235
234
|
status: sqliteCore.text("status").notNull(),
|
|
236
235
|
metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
|
|
@@ -239,9 +238,9 @@ var tasks = sqliteCore.sqliteTable(
|
|
|
239
238
|
(table) => [
|
|
240
239
|
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
241
240
|
sqliteCore.foreignKey({
|
|
242
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
243
|
-
foreignColumns: [
|
|
244
|
-
name: "
|
|
241
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
242
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
243
|
+
name: "tasks_sub_agent_fk"
|
|
245
244
|
}).onDelete("cascade")
|
|
246
245
|
]
|
|
247
246
|
);
|
|
@@ -281,10 +280,10 @@ var dataComponents = sqliteCore.sqliteTable(
|
|
|
281
280
|
}).onDelete("cascade")
|
|
282
281
|
]
|
|
283
282
|
);
|
|
284
|
-
var
|
|
285
|
-
"
|
|
283
|
+
var subAgentDataComponents = sqliteCore.sqliteTable(
|
|
284
|
+
"sub_agent_data_components",
|
|
286
285
|
{
|
|
287
|
-
...
|
|
286
|
+
...subAgentScoped,
|
|
288
287
|
dataComponentId: sqliteCore.text("data_component_id").notNull(),
|
|
289
288
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
290
289
|
},
|
|
@@ -292,15 +291,15 @@ var agentDataComponents = sqliteCore.sqliteTable(
|
|
|
292
291
|
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
293
292
|
// Foreign key constraint to agents table (ensures graph and project exist via cascade)
|
|
294
293
|
sqliteCore.foreignKey({
|
|
295
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
296
|
-
foreignColumns: [
|
|
297
|
-
name: "
|
|
294
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
295
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
296
|
+
name: "sub_agent_data_components_sub_agent_fk"
|
|
298
297
|
}).onDelete("cascade"),
|
|
299
298
|
// Foreign key constraint to data_components table
|
|
300
299
|
sqliteCore.foreignKey({
|
|
301
300
|
columns: [table.tenantId, table.projectId, table.dataComponentId],
|
|
302
301
|
foreignColumns: [dataComponents.tenantId, dataComponents.projectId, dataComponents.id],
|
|
303
|
-
name: "
|
|
302
|
+
name: "sub_agent_data_components_data_component_fk"
|
|
304
303
|
}).onDelete("cascade")
|
|
305
304
|
]
|
|
306
305
|
);
|
|
@@ -321,22 +320,22 @@ var artifactComponents = sqliteCore.sqliteTable(
|
|
|
321
320
|
}).onDelete("cascade")
|
|
322
321
|
]
|
|
323
322
|
);
|
|
324
|
-
var
|
|
325
|
-
"
|
|
323
|
+
var subAgentArtifactComponents = sqliteCore.sqliteTable(
|
|
324
|
+
"sub_agent_artifact_components",
|
|
326
325
|
{
|
|
327
|
-
...
|
|
326
|
+
...subAgentScoped,
|
|
328
327
|
artifactComponentId: sqliteCore.text("artifact_component_id").notNull(),
|
|
329
328
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
330
329
|
},
|
|
331
330
|
(table) => [
|
|
332
331
|
sqliteCore.primaryKey({
|
|
333
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
332
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId, table.id]
|
|
334
333
|
}),
|
|
335
334
|
// Foreign key constraint to agents table (ensures graph and project exist via cascade)
|
|
336
335
|
sqliteCore.foreignKey({
|
|
337
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
338
|
-
foreignColumns: [
|
|
339
|
-
name: "
|
|
336
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
337
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
338
|
+
name: "sub_agent_artifact_components_sub_agent_fk"
|
|
340
339
|
}).onDelete("cascade"),
|
|
341
340
|
// Foreign key constraint to artifact_components table
|
|
342
341
|
sqliteCore.foreignKey({
|
|
@@ -346,7 +345,7 @@ var agentArtifactComponents = sqliteCore.sqliteTable(
|
|
|
346
345
|
artifactComponents.projectId,
|
|
347
346
|
artifactComponents.id
|
|
348
347
|
],
|
|
349
|
-
name: "
|
|
348
|
+
name: "sub_agent_artifact_components_artifact_component_fk"
|
|
350
349
|
}).onDelete("cascade")
|
|
351
350
|
]
|
|
352
351
|
);
|
|
@@ -356,10 +355,7 @@ var tools = sqliteCore.sqliteTable(
|
|
|
356
355
|
...projectScoped,
|
|
357
356
|
name: sqliteCore.text("name").notNull(),
|
|
358
357
|
description: sqliteCore.text("description"),
|
|
359
|
-
// Tool configuration - supports both MCP and function tools
|
|
360
358
|
config: sqliteCore.blob("config", { mode: "json" }).$type().notNull(),
|
|
361
|
-
// For function tools, reference the global functions table
|
|
362
|
-
functionId: sqliteCore.text("function_id"),
|
|
363
359
|
credentialReferenceId: sqliteCore.text("credential_reference_id"),
|
|
364
360
|
headers: sqliteCore.blob("headers", { mode: "json" }).$type(),
|
|
365
361
|
// Image URL for custom tool icon (supports regular URLs and base64 encoded images)
|
|
@@ -375,12 +371,30 @@ var tools = sqliteCore.sqliteTable(
|
|
|
375
371
|
columns: [table.tenantId, table.projectId],
|
|
376
372
|
foreignColumns: [projects.tenantId, projects.id],
|
|
377
373
|
name: "tools_project_fk"
|
|
374
|
+
}).onDelete("cascade")
|
|
375
|
+
]
|
|
376
|
+
);
|
|
377
|
+
var functionTools = sqliteCore.sqliteTable(
|
|
378
|
+
"function_tools",
|
|
379
|
+
{
|
|
380
|
+
...graphScoped,
|
|
381
|
+
name: sqliteCore.text("name").notNull(),
|
|
382
|
+
description: sqliteCore.text("description"),
|
|
383
|
+
functionId: sqliteCore.text("function_id").notNull(),
|
|
384
|
+
...timestamps
|
|
385
|
+
},
|
|
386
|
+
(table) => [
|
|
387
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
388
|
+
sqliteCore.foreignKey({
|
|
389
|
+
columns: [table.tenantId, table.projectId, table.graphId],
|
|
390
|
+
foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
|
|
391
|
+
name: "function_tools_graph_fk"
|
|
378
392
|
}).onDelete("cascade"),
|
|
379
|
-
// Foreign key constraint to functions table
|
|
393
|
+
// Foreign key constraint to functions table
|
|
380
394
|
sqliteCore.foreignKey({
|
|
381
395
|
columns: [table.tenantId, table.projectId, table.functionId],
|
|
382
396
|
foreignColumns: [functions.tenantId, functions.projectId, functions.id],
|
|
383
|
-
name: "
|
|
397
|
+
name: "function_tools_function_fk"
|
|
384
398
|
}).onDelete("cascade")
|
|
385
399
|
]
|
|
386
400
|
);
|
|
@@ -402,10 +416,10 @@ var functions = sqliteCore.sqliteTable(
|
|
|
402
416
|
}).onDelete("cascade")
|
|
403
417
|
]
|
|
404
418
|
);
|
|
405
|
-
var
|
|
406
|
-
"
|
|
419
|
+
var subAgentToolRelations = sqliteCore.sqliteTable(
|
|
420
|
+
"sub_agent_tool_relations",
|
|
407
421
|
{
|
|
408
|
-
...
|
|
422
|
+
...subAgentScoped,
|
|
409
423
|
toolId: sqliteCore.text("tool_id").notNull(),
|
|
410
424
|
selectedTools: sqliteCore.blob("selected_tools", { mode: "json" }).$type(),
|
|
411
425
|
headers: sqliteCore.blob("headers", { mode: "json" }).$type(),
|
|
@@ -415,15 +429,43 @@ var agentToolRelations = sqliteCore.sqliteTable(
|
|
|
415
429
|
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
416
430
|
// Foreign key constraint to agents table (which includes project and graph scope)
|
|
417
431
|
sqliteCore.foreignKey({
|
|
418
|
-
columns: [table.tenantId, table.projectId, table.graphId, table.
|
|
419
|
-
foreignColumns: [
|
|
420
|
-
name: "
|
|
432
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
433
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
434
|
+
name: "sub_agent_tool_relations_agent_fk"
|
|
421
435
|
}).onDelete("cascade"),
|
|
422
|
-
// Foreign key constraint to tools table
|
|
436
|
+
// Foreign key constraint to tools table (MCP tools)
|
|
423
437
|
sqliteCore.foreignKey({
|
|
424
438
|
columns: [table.tenantId, table.projectId, table.toolId],
|
|
425
439
|
foreignColumns: [tools.tenantId, tools.projectId, tools.id],
|
|
426
|
-
name: "
|
|
440
|
+
name: "sub_agent_tool_relations_tool_fk"
|
|
441
|
+
}).onDelete("cascade")
|
|
442
|
+
]
|
|
443
|
+
);
|
|
444
|
+
var agentFunctionToolRelations = sqliteCore.sqliteTable(
|
|
445
|
+
"agent_function_tool_relations",
|
|
446
|
+
{
|
|
447
|
+
...subAgentScoped,
|
|
448
|
+
functionToolId: sqliteCore.text("function_tool_id").notNull(),
|
|
449
|
+
...timestamps
|
|
450
|
+
},
|
|
451
|
+
(table) => [
|
|
452
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
453
|
+
// Foreign key constraint to agents table
|
|
454
|
+
sqliteCore.foreignKey({
|
|
455
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
|
|
456
|
+
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
|
|
457
|
+
name: "agent_function_tool_relations_agent_fk"
|
|
458
|
+
}).onDelete("cascade"),
|
|
459
|
+
// Foreign key constraint to functionTools table
|
|
460
|
+
sqliteCore.foreignKey({
|
|
461
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.functionToolId],
|
|
462
|
+
foreignColumns: [
|
|
463
|
+
functionTools.tenantId,
|
|
464
|
+
functionTools.projectId,
|
|
465
|
+
functionTools.graphId,
|
|
466
|
+
functionTools.id
|
|
467
|
+
],
|
|
468
|
+
name: "agent_function_tool_relations_function_tool_fk"
|
|
427
469
|
}).onDelete("cascade")
|
|
428
470
|
]
|
|
429
471
|
);
|
|
@@ -432,7 +474,7 @@ var conversations = sqliteCore.sqliteTable(
|
|
|
432
474
|
{
|
|
433
475
|
...projectScoped,
|
|
434
476
|
userId: sqliteCore.text("user_id"),
|
|
435
|
-
|
|
477
|
+
activeSubAgentId: sqliteCore.text("active_sub_agent_id").notNull(),
|
|
436
478
|
title: sqliteCore.text("title"),
|
|
437
479
|
lastContextResolution: sqliteCore.text("last_context_resolution"),
|
|
438
480
|
metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
|
|
@@ -456,15 +498,15 @@ var messages = sqliteCore.sqliteTable(
|
|
|
456
498
|
role: sqliteCore.text("role").notNull(),
|
|
457
499
|
// 'user' | 'agent' | 'system'
|
|
458
500
|
// Agent sender/recipient tracking (nullable - only populated when relevant)
|
|
459
|
-
|
|
501
|
+
fromSubAgentId: sqliteCore.text("from_sub_agent_id"),
|
|
460
502
|
// Populated when message is from an agent
|
|
461
|
-
|
|
503
|
+
toSubAgentId: sqliteCore.text("to_sub_agent_id"),
|
|
462
504
|
// Populated when message is directed to a specific agent (e.g., transfers/delegations)
|
|
463
505
|
// External agent sender tracking
|
|
464
|
-
fromExternalAgentId: sqliteCore.text("
|
|
506
|
+
fromExternalAgentId: sqliteCore.text("from_external_sub_agent_id"),
|
|
465
507
|
// Populated when message is directed from an external agent
|
|
466
508
|
// External agent recipient tracking
|
|
467
|
-
toExternalAgentId: sqliteCore.text("
|
|
509
|
+
toExternalAgentId: sqliteCore.text("to_external_sub_agent_id"),
|
|
468
510
|
// Populated when message is directed to an external agent
|
|
469
511
|
// Message content stored as JSON to support both formats
|
|
470
512
|
content: sqliteCore.blob("content", { mode: "json" }).$type().notNull(),
|
|
@@ -473,8 +515,6 @@ var messages = sqliteCore.sqliteTable(
|
|
|
473
515
|
// 'user-facing' | 'internal' | 'system' | 'external'
|
|
474
516
|
messageType: sqliteCore.text("message_type").notNull().default("chat"),
|
|
475
517
|
// 'chat' | 'a2a-request' | 'a2a-response' | 'task-update' | 'tool-call'
|
|
476
|
-
// Legacy agent association (consider deprecating in favor of fromAgentId/toAgentId)
|
|
477
|
-
agentId: sqliteCore.text("agent_id"),
|
|
478
518
|
taskId: sqliteCore.text("task_id"),
|
|
479
519
|
parentMessageId: sqliteCore.text("parent_message_id"),
|
|
480
520
|
// Remove self-reference constraint here
|
|
@@ -601,10 +641,9 @@ drizzleOrm.relations(tasks, ({ one, many }) => ({
|
|
|
601
641
|
childRelations: many(taskRelations, {
|
|
602
642
|
relationName: "parentTask"
|
|
603
643
|
}),
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
references: [agents.id]
|
|
644
|
+
subAgent: one(subAgents, {
|
|
645
|
+
fields: [tasks.subAgentId],
|
|
646
|
+
references: [subAgents.id]
|
|
608
647
|
}),
|
|
609
648
|
// A task can have many messages associated with it
|
|
610
649
|
messages: many(messages),
|
|
@@ -612,9 +651,10 @@ drizzleOrm.relations(tasks, ({ one, many }) => ({
|
|
|
612
651
|
ledgerArtifacts: many(ledgerArtifacts)
|
|
613
652
|
}));
|
|
614
653
|
drizzleOrm.relations(projects, ({ many }) => ({
|
|
615
|
-
|
|
654
|
+
subAgents: many(subAgents),
|
|
616
655
|
agentGraphs: many(agentGraph),
|
|
617
656
|
tools: many(tools),
|
|
657
|
+
functions: many(functions),
|
|
618
658
|
contextConfigs: many(contextConfigs),
|
|
619
659
|
externalAgents: many(externalAgents),
|
|
620
660
|
conversations: many(conversations),
|
|
@@ -650,17 +690,17 @@ drizzleOrm.relations(contextCache, ({ one }) => ({
|
|
|
650
690
|
references: [contextConfigs.id]
|
|
651
691
|
})
|
|
652
692
|
}));
|
|
653
|
-
drizzleOrm.relations(
|
|
693
|
+
drizzleOrm.relations(subAgents, ({ many, one }) => ({
|
|
654
694
|
project: one(projects, {
|
|
655
|
-
fields: [
|
|
695
|
+
fields: [subAgents.tenantId, subAgents.projectId],
|
|
656
696
|
references: [projects.tenantId, projects.id]
|
|
657
697
|
}),
|
|
658
698
|
tasks: many(tasks),
|
|
659
699
|
defaultForGraphs: many(agentGraph),
|
|
660
|
-
sourceRelations: many(
|
|
700
|
+
sourceRelations: many(subAgentRelations, {
|
|
661
701
|
relationName: "sourceRelations"
|
|
662
702
|
}),
|
|
663
|
-
targetRelations: many(
|
|
703
|
+
targetRelations: many(subAgentRelations, {
|
|
664
704
|
relationName: "targetRelations"
|
|
665
705
|
}),
|
|
666
706
|
sentMessages: many(messages, {
|
|
@@ -672,30 +712,32 @@ drizzleOrm.relations(agents, ({ many, one }) => ({
|
|
|
672
712
|
associatedMessages: many(messages, {
|
|
673
713
|
relationName: "associatedAgent"
|
|
674
714
|
}),
|
|
675
|
-
toolRelations: many(
|
|
676
|
-
|
|
677
|
-
|
|
715
|
+
toolRelations: many(subAgentToolRelations),
|
|
716
|
+
functionToolRelations: many(agentFunctionToolRelations),
|
|
717
|
+
dataComponentRelations: many(subAgentDataComponents),
|
|
718
|
+
artifactComponentRelations: many(subAgentArtifactComponents)
|
|
678
719
|
}));
|
|
679
|
-
drizzleOrm.relations(agentGraph, ({ one }) => ({
|
|
720
|
+
drizzleOrm.relations(agentGraph, ({ one, many }) => ({
|
|
680
721
|
project: one(projects, {
|
|
681
722
|
fields: [agentGraph.tenantId, agentGraph.projectId],
|
|
682
723
|
references: [projects.tenantId, projects.id]
|
|
683
724
|
}),
|
|
684
|
-
|
|
685
|
-
fields: [agentGraph.
|
|
686
|
-
references: [
|
|
725
|
+
defaultSubAgent: one(subAgents, {
|
|
726
|
+
fields: [agentGraph.defaultSubAgentId],
|
|
727
|
+
references: [subAgents.id]
|
|
687
728
|
}),
|
|
688
729
|
contextConfig: one(contextConfigs, {
|
|
689
730
|
fields: [agentGraph.contextConfigId],
|
|
690
731
|
references: [contextConfigs.id]
|
|
691
|
-
})
|
|
732
|
+
}),
|
|
733
|
+
functionTools: many(functionTools)
|
|
692
734
|
}));
|
|
693
735
|
drizzleOrm.relations(externalAgents, ({ one, many }) => ({
|
|
694
736
|
project: one(projects, {
|
|
695
737
|
fields: [externalAgents.tenantId, externalAgents.projectId],
|
|
696
738
|
references: [projects.tenantId, projects.id]
|
|
697
739
|
}),
|
|
698
|
-
|
|
740
|
+
subAgentRelations: many(subAgentRelations),
|
|
699
741
|
credentialReference: one(credentialReferences, {
|
|
700
742
|
fields: [externalAgents.credentialReferenceId],
|
|
701
743
|
references: [credentialReferences.id]
|
|
@@ -711,13 +753,13 @@ drizzleOrm.relations(apiKeys, ({ one }) => ({
|
|
|
711
753
|
references: [agentGraph.id]
|
|
712
754
|
})
|
|
713
755
|
}));
|
|
714
|
-
drizzleOrm.relations(
|
|
715
|
-
|
|
716
|
-
fields: [
|
|
717
|
-
references: [
|
|
756
|
+
drizzleOrm.relations(subAgentToolRelations, ({ one }) => ({
|
|
757
|
+
subAgent: one(subAgents, {
|
|
758
|
+
fields: [subAgentToolRelations.subAgentId],
|
|
759
|
+
references: [subAgents.id]
|
|
718
760
|
}),
|
|
719
761
|
tool: one(tools, {
|
|
720
|
-
fields: [
|
|
762
|
+
fields: [subAgentToolRelations.toolId],
|
|
721
763
|
references: [tools.id]
|
|
722
764
|
})
|
|
723
765
|
}));
|
|
@@ -729,14 +771,10 @@ drizzleOrm.relations(tools, ({ one, many }) => ({
|
|
|
729
771
|
fields: [tools.tenantId, tools.projectId],
|
|
730
772
|
references: [projects.tenantId, projects.id]
|
|
731
773
|
}),
|
|
732
|
-
|
|
774
|
+
subAgentRelations: many(subAgentToolRelations),
|
|
733
775
|
credentialReference: one(credentialReferences, {
|
|
734
776
|
fields: [tools.credentialReferenceId],
|
|
735
777
|
references: [credentialReferences.id]
|
|
736
|
-
}),
|
|
737
|
-
function: one(functions, {
|
|
738
|
-
fields: [tools.functionId],
|
|
739
|
-
references: [functions.id]
|
|
740
778
|
})
|
|
741
779
|
}));
|
|
742
780
|
drizzleOrm.relations(conversations, ({ one, many }) => ({
|
|
@@ -745,9 +783,9 @@ drizzleOrm.relations(conversations, ({ one, many }) => ({
|
|
|
745
783
|
references: [projects.tenantId, projects.id]
|
|
746
784
|
}),
|
|
747
785
|
messages: many(messages),
|
|
748
|
-
|
|
749
|
-
fields: [conversations.
|
|
750
|
-
references: [
|
|
786
|
+
activeSubAgent: one(subAgents, {
|
|
787
|
+
fields: [conversations.activeSubAgentId],
|
|
788
|
+
references: [subAgents.id]
|
|
751
789
|
})
|
|
752
790
|
}));
|
|
753
791
|
drizzleOrm.relations(messages, ({ one, many }) => ({
|
|
@@ -755,20 +793,14 @@ drizzleOrm.relations(messages, ({ one, many }) => ({
|
|
|
755
793
|
fields: [messages.conversationId],
|
|
756
794
|
references: [conversations.id]
|
|
757
795
|
}),
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
references: [agents.id],
|
|
762
|
-
relationName: "associatedAgent"
|
|
763
|
-
}),
|
|
764
|
-
fromAgent: one(agents, {
|
|
765
|
-
fields: [messages.fromAgentId],
|
|
766
|
-
references: [agents.id],
|
|
796
|
+
fromSubAgent: one(subAgents, {
|
|
797
|
+
fields: [messages.fromSubAgentId],
|
|
798
|
+
references: [subAgents.id],
|
|
767
799
|
relationName: "sentMessages"
|
|
768
800
|
}),
|
|
769
|
-
|
|
770
|
-
fields: [messages.
|
|
771
|
-
references: [
|
|
801
|
+
toSubAgent: one(subAgents, {
|
|
802
|
+
fields: [messages.toSubAgentId],
|
|
803
|
+
references: [subAgents.id],
|
|
772
804
|
relationName: "receivedMessages"
|
|
773
805
|
}),
|
|
774
806
|
fromExternalAgent: one(externalAgents, {
|
|
@@ -794,33 +826,40 @@ drizzleOrm.relations(messages, ({ one, many }) => ({
|
|
|
794
826
|
relationName: "parentChild"
|
|
795
827
|
})
|
|
796
828
|
}));
|
|
797
|
-
drizzleOrm.relations(artifactComponents, ({ many }) => ({
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
agent: one(agents, {
|
|
802
|
-
fields: [agentArtifactComponents.agentId],
|
|
803
|
-
references: [agents.id]
|
|
829
|
+
drizzleOrm.relations(artifactComponents, ({ many, one }) => ({
|
|
830
|
+
project: one(projects, {
|
|
831
|
+
fields: [artifactComponents.tenantId, artifactComponents.projectId],
|
|
832
|
+
references: [projects.tenantId, projects.id]
|
|
804
833
|
}),
|
|
805
|
-
|
|
806
|
-
fields: [agentArtifactComponents.artifactComponentId],
|
|
807
|
-
references: [artifactComponents.id]
|
|
808
|
-
})
|
|
834
|
+
subAgentRelations: many(subAgentArtifactComponents)
|
|
809
835
|
}));
|
|
836
|
+
drizzleOrm.relations(
|
|
837
|
+
subAgentArtifactComponents,
|
|
838
|
+
({ one }) => ({
|
|
839
|
+
subAgent: one(subAgents, {
|
|
840
|
+
fields: [subAgentArtifactComponents.subAgentId],
|
|
841
|
+
references: [subAgents.id]
|
|
842
|
+
}),
|
|
843
|
+
artifactComponent: one(artifactComponents, {
|
|
844
|
+
fields: [subAgentArtifactComponents.artifactComponentId],
|
|
845
|
+
references: [artifactComponents.id]
|
|
846
|
+
})
|
|
847
|
+
})
|
|
848
|
+
);
|
|
810
849
|
drizzleOrm.relations(dataComponents, ({ many, one }) => ({
|
|
811
850
|
project: one(projects, {
|
|
812
851
|
fields: [dataComponents.tenantId, dataComponents.projectId],
|
|
813
852
|
references: [projects.tenantId, projects.id]
|
|
814
853
|
}),
|
|
815
|
-
|
|
854
|
+
subAgentRelations: many(subAgentDataComponents)
|
|
816
855
|
}));
|
|
817
|
-
drizzleOrm.relations(
|
|
818
|
-
|
|
819
|
-
fields: [
|
|
820
|
-
references: [
|
|
856
|
+
drizzleOrm.relations(subAgentDataComponents, ({ one }) => ({
|
|
857
|
+
subAgent: one(subAgents, {
|
|
858
|
+
fields: [subAgentDataComponents.subAgentId],
|
|
859
|
+
references: [subAgents.id]
|
|
821
860
|
}),
|
|
822
861
|
dataComponent: one(dataComponents, {
|
|
823
|
-
fields: [
|
|
862
|
+
fields: [subAgentDataComponents.dataComponentId],
|
|
824
863
|
references: [dataComponents.id]
|
|
825
864
|
})
|
|
826
865
|
}));
|
|
@@ -835,28 +874,56 @@ drizzleOrm.relations(ledgerArtifacts, ({ one }) => ({
|
|
|
835
874
|
})
|
|
836
875
|
}));
|
|
837
876
|
drizzleOrm.relations(functions, ({ many }) => ({
|
|
838
|
-
|
|
877
|
+
functionTools: many(functionTools)
|
|
839
878
|
}));
|
|
840
|
-
drizzleOrm.relations(
|
|
879
|
+
drizzleOrm.relations(subAgentRelations, ({ one }) => ({
|
|
841
880
|
graph: one(agentGraph, {
|
|
842
|
-
fields: [
|
|
881
|
+
fields: [subAgentRelations.graphId],
|
|
843
882
|
references: [agentGraph.id]
|
|
844
883
|
}),
|
|
845
|
-
|
|
846
|
-
fields: [
|
|
847
|
-
references: [
|
|
884
|
+
sourceSubAgent: one(subAgents, {
|
|
885
|
+
fields: [subAgentRelations.sourceSubAgentId],
|
|
886
|
+
references: [subAgents.id],
|
|
848
887
|
relationName: "sourceRelations"
|
|
849
888
|
}),
|
|
850
|
-
|
|
851
|
-
fields: [
|
|
852
|
-
references: [
|
|
889
|
+
targetSubAgent: one(subAgents, {
|
|
890
|
+
fields: [subAgentRelations.targetSubAgentId],
|
|
891
|
+
references: [subAgents.id],
|
|
853
892
|
relationName: "targetRelations"
|
|
854
893
|
}),
|
|
855
894
|
externalAgent: one(externalAgents, {
|
|
856
|
-
fields: [
|
|
895
|
+
fields: [subAgentRelations.externalSubAgentId],
|
|
857
896
|
references: [externalAgents.id]
|
|
858
897
|
})
|
|
859
898
|
}));
|
|
899
|
+
drizzleOrm.relations(functionTools, ({ one, many }) => ({
|
|
900
|
+
project: one(projects, {
|
|
901
|
+
fields: [functionTools.tenantId, functionTools.projectId],
|
|
902
|
+
references: [projects.tenantId, projects.id]
|
|
903
|
+
}),
|
|
904
|
+
graph: one(agentGraph, {
|
|
905
|
+
fields: [functionTools.tenantId, functionTools.projectId, functionTools.graphId],
|
|
906
|
+
references: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id]
|
|
907
|
+
}),
|
|
908
|
+
function: one(functions, {
|
|
909
|
+
fields: [functionTools.tenantId, functionTools.projectId, functionTools.functionId],
|
|
910
|
+
references: [functions.tenantId, functions.projectId, functions.id]
|
|
911
|
+
}),
|
|
912
|
+
agentRelations: many(agentFunctionToolRelations)
|
|
913
|
+
}));
|
|
914
|
+
drizzleOrm.relations(
|
|
915
|
+
agentFunctionToolRelations,
|
|
916
|
+
({ one }) => ({
|
|
917
|
+
agent: one(subAgents, {
|
|
918
|
+
fields: [agentFunctionToolRelations.subAgentId],
|
|
919
|
+
references: [subAgents.id]
|
|
920
|
+
}),
|
|
921
|
+
functionTool: one(functionTools, {
|
|
922
|
+
fields: [agentFunctionToolRelations.functionToolId],
|
|
923
|
+
references: [functionTools.id]
|
|
924
|
+
})
|
|
925
|
+
})
|
|
926
|
+
);
|
|
860
927
|
|
|
861
928
|
// src/validation/schemas.ts
|
|
862
929
|
var StopWhenSchema = zodOpenapi.z.object({
|
|
@@ -864,7 +931,7 @@ var StopWhenSchema = zodOpenapi.z.object({
|
|
|
864
931
|
stepCountIs: zodOpenapi.z.number().min(1).max(1e3).optional()
|
|
865
932
|
});
|
|
866
933
|
var GraphStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true });
|
|
867
|
-
var
|
|
934
|
+
var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true });
|
|
868
935
|
var MIN_ID_LENGTH = 1;
|
|
869
936
|
var MAX_ID_LENGTH = 255;
|
|
870
937
|
var URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
|
|
@@ -907,71 +974,73 @@ var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId:
|
|
|
907
974
|
var createGraphScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
|
|
908
975
|
var createGraphScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
|
|
909
976
|
var createGraphScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true }).partial();
|
|
910
|
-
var
|
|
911
|
-
var
|
|
977
|
+
var SubAgentSelectSchema = drizzleZod.createSelectSchema(subAgents);
|
|
978
|
+
var SubAgentInsertSchema = drizzleZod.createInsertSchema(subAgents).extend({
|
|
912
979
|
id: resourceIdSchema,
|
|
913
980
|
models: ModelSchema.optional()
|
|
914
981
|
});
|
|
915
|
-
var
|
|
916
|
-
var
|
|
917
|
-
var
|
|
918
|
-
createGraphScopedApiUpdateSchema(
|
|
919
|
-
var
|
|
920
|
-
var
|
|
982
|
+
var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
|
|
983
|
+
var SubAgentApiSelectSchema = createGraphScopedApiSchema(SubAgentSelectSchema);
|
|
984
|
+
var SubAgentApiInsertSchema = createGraphScopedApiInsertSchema(SubAgentInsertSchema);
|
|
985
|
+
createGraphScopedApiUpdateSchema(SubAgentUpdateSchema);
|
|
986
|
+
var SubAgentRelationSelectSchema = drizzleZod.createSelectSchema(subAgentRelations);
|
|
987
|
+
var SubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
|
|
921
988
|
id: resourceIdSchema,
|
|
922
989
|
graphId: resourceIdSchema,
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
990
|
+
sourceSubAgentId: resourceIdSchema,
|
|
991
|
+
targetSubAgentId: resourceIdSchema.optional(),
|
|
992
|
+
externalSubAgentId: resourceIdSchema.optional()
|
|
926
993
|
});
|
|
927
|
-
var
|
|
928
|
-
createGraphScopedApiSchema(
|
|
994
|
+
var SubAgentRelationUpdateSchema = SubAgentRelationInsertSchema.partial();
|
|
995
|
+
createGraphScopedApiSchema(
|
|
996
|
+
SubAgentRelationSelectSchema
|
|
997
|
+
);
|
|
929
998
|
createGraphScopedApiInsertSchema(
|
|
930
|
-
|
|
999
|
+
SubAgentRelationInsertSchema
|
|
931
1000
|
).extend({
|
|
932
1001
|
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES)
|
|
933
1002
|
}).refine(
|
|
934
1003
|
(data) => {
|
|
935
|
-
const hasTarget = data.
|
|
936
|
-
const hasExternal = data.
|
|
1004
|
+
const hasTarget = data.targetSubAgentId != null;
|
|
1005
|
+
const hasExternal = data.externalSubAgentId != null;
|
|
937
1006
|
return hasTarget !== hasExternal;
|
|
938
1007
|
},
|
|
939
1008
|
{
|
|
940
|
-
message: "Must specify exactly one of
|
|
941
|
-
path: ["
|
|
1009
|
+
message: "Must specify exactly one of targetSubAgentId or externalSubAgentId",
|
|
1010
|
+
path: ["targetSubAgentId", "externalSubAgentId"]
|
|
942
1011
|
}
|
|
943
1012
|
);
|
|
944
1013
|
createGraphScopedApiUpdateSchema(
|
|
945
|
-
|
|
1014
|
+
SubAgentRelationUpdateSchema
|
|
946
1015
|
).extend({
|
|
947
1016
|
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES).optional()
|
|
948
1017
|
}).refine(
|
|
949
1018
|
(data) => {
|
|
950
|
-
const hasTarget = data.
|
|
951
|
-
const hasExternal = data.
|
|
1019
|
+
const hasTarget = data.targetSubAgentId != null;
|
|
1020
|
+
const hasExternal = data.externalSubAgentId != null;
|
|
952
1021
|
if (!hasTarget && !hasExternal) {
|
|
953
1022
|
return true;
|
|
954
1023
|
}
|
|
955
1024
|
return hasTarget !== hasExternal;
|
|
956
1025
|
},
|
|
957
1026
|
{
|
|
958
|
-
message: "Must specify exactly one of
|
|
959
|
-
path: ["
|
|
1027
|
+
message: "Must specify exactly one of targetSubAgentId or externalSubAgentId when updating sub-agent relationships",
|
|
1028
|
+
path: ["targetSubAgentId", "externalSubAgentId"]
|
|
960
1029
|
}
|
|
961
1030
|
);
|
|
962
1031
|
zodOpenapi.z.object({
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
1032
|
+
sourceSubAgentId: zodOpenapi.z.string().optional(),
|
|
1033
|
+
targetSubAgentId: zodOpenapi.z.string().optional(),
|
|
1034
|
+
externalSubAgentId: zodOpenapi.z.string().optional()
|
|
966
1035
|
});
|
|
967
|
-
var
|
|
1036
|
+
var ExternalSubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
|
|
968
1037
|
id: resourceIdSchema,
|
|
969
1038
|
graphId: resourceIdSchema,
|
|
970
|
-
|
|
971
|
-
|
|
1039
|
+
sourceSubAgentId: resourceIdSchema,
|
|
1040
|
+
externalSubAgentId: resourceIdSchema
|
|
972
1041
|
});
|
|
973
1042
|
createApiInsertSchema(
|
|
974
|
-
|
|
1043
|
+
ExternalSubAgentRelationInsertSchema
|
|
975
1044
|
);
|
|
976
1045
|
var AgentGraphSelectSchema = drizzleZod.createSelectSchema(agentGraph);
|
|
977
1046
|
var AgentGraphInsertSchema = drizzleZod.createInsertSchema(agentGraph).extend({
|
|
@@ -1038,32 +1107,22 @@ var ToolSelectSchema = drizzleZod.createSelectSchema(tools);
|
|
|
1038
1107
|
var ToolInsertSchema = drizzleZod.createInsertSchema(tools).extend({
|
|
1039
1108
|
id: resourceIdSchema,
|
|
1040
1109
|
imageUrl: imageUrlSchema,
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
reconnectionOptions: zodOpenapi.z.custom().optional(),
|
|
1056
|
-
sessionId: zodOpenapi.z.string().optional()
|
|
1057
|
-
}).optional(),
|
|
1058
|
-
activeTools: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
1059
|
-
})
|
|
1060
|
-
}),
|
|
1061
|
-
// Function tools (reference-only, no inline duplication)
|
|
1062
|
-
zodOpenapi.z.object({
|
|
1063
|
-
type: zodOpenapi.z.literal("function")
|
|
1064
|
-
// No inline function details - they're in the functions table via functionId
|
|
1110
|
+
config: zodOpenapi.z.object({
|
|
1111
|
+
type: zodOpenapi.z.literal("mcp"),
|
|
1112
|
+
mcp: zodOpenapi.z.object({
|
|
1113
|
+
server: zodOpenapi.z.object({
|
|
1114
|
+
url: zodOpenapi.z.string().url()
|
|
1115
|
+
}),
|
|
1116
|
+
transport: zodOpenapi.z.object({
|
|
1117
|
+
type: zodOpenapi.z.enum(MCPTransportType),
|
|
1118
|
+
requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1119
|
+
eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1120
|
+
reconnectionOptions: zodOpenapi.z.custom().optional(),
|
|
1121
|
+
sessionId: zodOpenapi.z.string().optional()
|
|
1122
|
+
}).optional(),
|
|
1123
|
+
activeTools: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
1065
1124
|
})
|
|
1066
|
-
|
|
1125
|
+
})
|
|
1067
1126
|
});
|
|
1068
1127
|
var ConversationSelectSchema = drizzleZod.createSelectSchema(conversations);
|
|
1069
1128
|
var ConversationInsertSchema = drizzleZod.createInsertSchema(conversations).extend({
|
|
@@ -1102,20 +1161,20 @@ var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
|
|
|
1102
1161
|
createApiSchema(DataComponentSelectSchema);
|
|
1103
1162
|
var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema);
|
|
1104
1163
|
createApiUpdateSchema(DataComponentUpdateSchema);
|
|
1105
|
-
var
|
|
1106
|
-
var
|
|
1107
|
-
var
|
|
1164
|
+
var SubAgentDataComponentSelectSchema = drizzleZod.createSelectSchema(subAgentDataComponents);
|
|
1165
|
+
var SubAgentDataComponentInsertSchema = drizzleZod.createInsertSchema(subAgentDataComponents);
|
|
1166
|
+
var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
|
|
1108
1167
|
createGraphScopedApiSchema(
|
|
1109
|
-
|
|
1168
|
+
SubAgentDataComponentSelectSchema
|
|
1110
1169
|
);
|
|
1111
|
-
|
|
1170
|
+
SubAgentDataComponentInsertSchema.omit({
|
|
1112
1171
|
tenantId: true,
|
|
1113
1172
|
projectId: true,
|
|
1114
1173
|
id: true,
|
|
1115
1174
|
createdAt: true
|
|
1116
1175
|
});
|
|
1117
1176
|
createGraphScopedApiUpdateSchema(
|
|
1118
|
-
|
|
1177
|
+
SubAgentDataComponentUpdateSchema
|
|
1119
1178
|
);
|
|
1120
1179
|
var ArtifactComponentSelectSchema = drizzleZod.createSelectSchema(artifactComponents);
|
|
1121
1180
|
var ArtifactComponentInsertSchema = drizzleZod.createInsertSchema(artifactComponents).extend({
|
|
@@ -1132,26 +1191,26 @@ var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
|
|
|
1132
1191
|
createApiUpdateSchema(
|
|
1133
1192
|
ArtifactComponentUpdateSchema
|
|
1134
1193
|
);
|
|
1135
|
-
var
|
|
1136
|
-
var
|
|
1137
|
-
|
|
1194
|
+
var SubAgentArtifactComponentSelectSchema = drizzleZod.createSelectSchema(subAgentArtifactComponents);
|
|
1195
|
+
var SubAgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
|
|
1196
|
+
subAgentArtifactComponents
|
|
1138
1197
|
).extend({
|
|
1139
1198
|
id: resourceIdSchema,
|
|
1140
|
-
|
|
1199
|
+
subAgentId: resourceIdSchema,
|
|
1141
1200
|
artifactComponentId: resourceIdSchema
|
|
1142
1201
|
});
|
|
1143
|
-
var
|
|
1202
|
+
var SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentInsertSchema.partial();
|
|
1144
1203
|
createGraphScopedApiSchema(
|
|
1145
|
-
|
|
1204
|
+
SubAgentArtifactComponentSelectSchema
|
|
1146
1205
|
);
|
|
1147
|
-
|
|
1206
|
+
SubAgentArtifactComponentInsertSchema.omit({
|
|
1148
1207
|
tenantId: true,
|
|
1149
1208
|
projectId: true,
|
|
1150
1209
|
id: true,
|
|
1151
1210
|
createdAt: true
|
|
1152
1211
|
});
|
|
1153
1212
|
createGraphScopedApiUpdateSchema(
|
|
1154
|
-
|
|
1213
|
+
SubAgentArtifactComponentUpdateSchema
|
|
1155
1214
|
);
|
|
1156
1215
|
var ExternalAgentSelectSchema = drizzleZod.createSelectSchema(externalAgents).extend({
|
|
1157
1216
|
credentialReferenceId: zodOpenapi.z.string().nullable().optional(),
|
|
@@ -1165,7 +1224,7 @@ var ExternalAgentApiSelectSchema = createGraphScopedApiSchema(ExternalAgentSelec
|
|
|
1165
1224
|
var ExternalAgentApiInsertSchema = createGraphScopedApiInsertSchema(ExternalAgentInsertSchema);
|
|
1166
1225
|
createGraphScopedApiUpdateSchema(ExternalAgentUpdateSchema);
|
|
1167
1226
|
zodOpenapi.z.discriminatedUnion("type", [
|
|
1168
|
-
|
|
1227
|
+
SubAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
|
|
1169
1228
|
ExternalAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
1170
1229
|
]);
|
|
1171
1230
|
var ApiKeySelectSchema = drizzleZod.createSelectSchema(apiKeys);
|
|
@@ -1272,6 +1331,14 @@ var ToolUpdateSchema = ToolInsertSchema.partial();
|
|
|
1272
1331
|
createApiSchema(ToolSelectSchema);
|
|
1273
1332
|
var ToolApiInsertSchema = createApiInsertSchema(ToolInsertSchema);
|
|
1274
1333
|
createApiUpdateSchema(ToolUpdateSchema);
|
|
1334
|
+
var FunctionToolSelectSchema = drizzleZod.createSelectSchema(functionTools);
|
|
1335
|
+
var FunctionToolInsertSchema = drizzleZod.createInsertSchema(functionTools).extend({
|
|
1336
|
+
id: resourceIdSchema
|
|
1337
|
+
});
|
|
1338
|
+
var FunctionToolUpdateSchema = FunctionToolInsertSchema.partial();
|
|
1339
|
+
createApiSchema(FunctionToolSelectSchema);
|
|
1340
|
+
var FunctionToolApiInsertSchema = createGraphScopedApiInsertSchema(FunctionToolInsertSchema);
|
|
1341
|
+
createApiUpdateSchema(FunctionToolUpdateSchema);
|
|
1275
1342
|
var FunctionSelectSchema = drizzleZod.createSelectSchema(functions);
|
|
1276
1343
|
var FunctionInsertSchema = drizzleZod.createInsertSchema(functions).extend({
|
|
1277
1344
|
id: resourceIdSchema
|
|
@@ -1319,23 +1386,23 @@ var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSche
|
|
|
1319
1386
|
createApiUpdateSchema(ContextConfigUpdateSchema).omit({
|
|
1320
1387
|
graphId: true
|
|
1321
1388
|
});
|
|
1322
|
-
var
|
|
1323
|
-
var
|
|
1389
|
+
var SubAgentToolRelationSelectSchema = drizzleZod.createSelectSchema(subAgentToolRelations);
|
|
1390
|
+
var SubAgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToolRelations).extend({
|
|
1324
1391
|
id: resourceIdSchema,
|
|
1325
|
-
|
|
1392
|
+
subAgentId: resourceIdSchema,
|
|
1326
1393
|
toolId: resourceIdSchema,
|
|
1327
1394
|
selectedTools: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
|
|
1328
1395
|
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1329
1396
|
});
|
|
1330
|
-
var
|
|
1397
|
+
var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
|
|
1331
1398
|
createGraphScopedApiSchema(
|
|
1332
|
-
|
|
1399
|
+
SubAgentToolRelationSelectSchema
|
|
1333
1400
|
);
|
|
1334
1401
|
createGraphScopedApiInsertSchema(
|
|
1335
|
-
|
|
1402
|
+
SubAgentToolRelationInsertSchema
|
|
1336
1403
|
);
|
|
1337
1404
|
createGraphScopedApiUpdateSchema(
|
|
1338
|
-
|
|
1405
|
+
SubAgentToolRelationUpdateSchema
|
|
1339
1406
|
);
|
|
1340
1407
|
var LedgerArtifactSelectSchema = drizzleZod.createSelectSchema(ledgerArtifacts);
|
|
1341
1408
|
var LedgerArtifactInsertSchema = drizzleZod.createInsertSchema(ledgerArtifacts);
|
|
@@ -1365,7 +1432,7 @@ var CanUseItemSchema = zodOpenapi.z.object({
|
|
|
1365
1432
|
toolSelection: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
|
|
1366
1433
|
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1367
1434
|
});
|
|
1368
|
-
var FullGraphAgentInsertSchema =
|
|
1435
|
+
var FullGraphAgentInsertSchema = SubAgentApiInsertSchema.extend({
|
|
1369
1436
|
type: zodOpenapi.z.literal("internal"),
|
|
1370
1437
|
canUse: zodOpenapi.z.array(CanUseItemSchema),
|
|
1371
1438
|
// All tools (both MCP and function tools)
|
|
@@ -1375,10 +1442,15 @@ var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
|
|
|
1375
1442
|
canDelegateTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
1376
1443
|
});
|
|
1377
1444
|
AgentGraphApiInsertSchema.extend({
|
|
1378
|
-
|
|
1445
|
+
subAgents: zodOpenapi.z.record(
|
|
1446
|
+
zodOpenapi.z.string(),
|
|
1447
|
+
zodOpenapi.z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])
|
|
1448
|
+
),
|
|
1379
1449
|
// Lookup maps for UI to resolve canUse items
|
|
1380
1450
|
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
|
|
1381
|
-
//
|
|
1451
|
+
// MCP tools (project-scoped)
|
|
1452
|
+
functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
|
|
1453
|
+
// Function tools (graph-scoped)
|
|
1382
1454
|
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1383
1455
|
// Get function code for function tools
|
|
1384
1456
|
contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
|
|
@@ -1388,13 +1460,20 @@ AgentGraphApiInsertSchema.extend({
|
|
|
1388
1460
|
graphPrompt: zodOpenapi.z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
|
|
1389
1461
|
});
|
|
1390
1462
|
var GraphWithinContextOfProjectSchema = AgentGraphApiInsertSchema.extend({
|
|
1391
|
-
|
|
1463
|
+
subAgents: zodOpenapi.z.record(
|
|
1392
1464
|
zodOpenapi.z.string(),
|
|
1393
1465
|
zodOpenapi.z.discriminatedUnion("type", [
|
|
1394
1466
|
FullGraphAgentInsertSchema,
|
|
1395
1467
|
ExternalAgentApiInsertSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
1396
1468
|
])
|
|
1397
1469
|
),
|
|
1470
|
+
// Lookup maps for UI to resolve canUse items
|
|
1471
|
+
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
|
|
1472
|
+
// MCP tools (project-scoped)
|
|
1473
|
+
functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
|
|
1474
|
+
// Function tools (graph-scoped)
|
|
1475
|
+
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1476
|
+
// Get function code for function tools
|
|
1398
1477
|
contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
|
|
1399
1478
|
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
1400
1479
|
models: ModelSchema.optional(),
|
|
@@ -1435,9 +1514,9 @@ ProjectUpdateSchema.omit({ tenantId: true });
|
|
|
1435
1514
|
ProjectApiInsertSchema.extend({
|
|
1436
1515
|
graphs: zodOpenapi.z.record(zodOpenapi.z.string(), GraphWithinContextOfProjectSchema),
|
|
1437
1516
|
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema),
|
|
1438
|
-
//
|
|
1517
|
+
// MCP tools (project-scoped)
|
|
1439
1518
|
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1440
|
-
//
|
|
1519
|
+
// Functions (project-scoped)
|
|
1441
1520
|
dataComponents: zodOpenapi.z.record(zodOpenapi.z.string(), DataComponentApiInsertSchema).optional(),
|
|
1442
1521
|
artifactComponents: zodOpenapi.z.record(zodOpenapi.z.string(), ArtifactComponentApiInsertSchema).optional(),
|
|
1443
1522
|
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
@@ -1459,72 +1538,46 @@ zodOpenapi.z.object({
|
|
|
1459
1538
|
example: "graph_789"
|
|
1460
1539
|
})
|
|
1461
1540
|
});
|
|
1462
|
-
zodOpenapi.z.
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1541
|
+
var TenantId = zodOpenapi.z.string().openapi({
|
|
1542
|
+
description: "Tenant identifier",
|
|
1543
|
+
example: "tenant_123"
|
|
1544
|
+
});
|
|
1545
|
+
var ProjectId = zodOpenapi.z.string().openapi({
|
|
1546
|
+
description: "Project identifier",
|
|
1547
|
+
example: "project_456"
|
|
1548
|
+
});
|
|
1549
|
+
var GraphId = zodOpenapi.z.string().openapi({
|
|
1550
|
+
description: "Graph identifier",
|
|
1551
|
+
example: "graph_789"
|
|
1552
|
+
});
|
|
1553
|
+
var SubAgentId = zodOpenapi.z.string().openapi({
|
|
1554
|
+
description: "Sub-agent identifier",
|
|
1555
|
+
example: "sub_agent_123"
|
|
1556
|
+
});
|
|
1557
|
+
var TenantParamsSchema = zodOpenapi.z.object({
|
|
1558
|
+
tenantId: TenantId
|
|
1467
1559
|
}).openapi("TenantParams");
|
|
1468
|
-
|
|
1469
|
-
tenantId: zodOpenapi.z.string().openapi({
|
|
1470
|
-
description: "Tenant identifier",
|
|
1471
|
-
example: "tenant_123"
|
|
1472
|
-
}),
|
|
1473
|
-
projectId: zodOpenapi.z.string().openapi({
|
|
1474
|
-
description: "Project identifier",
|
|
1475
|
-
example: "project_456"
|
|
1476
|
-
})
|
|
1477
|
-
}).openapi("TenantProjectParams");
|
|
1478
|
-
zodOpenapi.z.object({
|
|
1479
|
-
tenantId: zodOpenapi.z.string().openapi({
|
|
1480
|
-
description: "Tenant identifier",
|
|
1481
|
-
example: "tenant_123"
|
|
1482
|
-
}),
|
|
1483
|
-
projectId: zodOpenapi.z.string().openapi({
|
|
1484
|
-
description: "Project identifier",
|
|
1485
|
-
example: "project_456"
|
|
1486
|
-
}),
|
|
1487
|
-
graphId: zodOpenapi.z.string().openapi({
|
|
1488
|
-
description: "Graph identifier",
|
|
1489
|
-
example: "graph_789"
|
|
1490
|
-
})
|
|
1491
|
-
}).openapi("TenantProjectGraphParams");
|
|
1492
|
-
zodOpenapi.z.object({
|
|
1493
|
-
tenantId: zodOpenapi.z.string().openapi({
|
|
1494
|
-
description: "Tenant identifier",
|
|
1495
|
-
example: "tenant_123"
|
|
1496
|
-
}),
|
|
1497
|
-
projectId: zodOpenapi.z.string().openapi({
|
|
1498
|
-
description: "Project identifier",
|
|
1499
|
-
example: "project_456"
|
|
1500
|
-
}),
|
|
1501
|
-
graphId: zodOpenapi.z.string().openapi({
|
|
1502
|
-
description: "Graph identifier",
|
|
1503
|
-
example: "graph_789"
|
|
1504
|
-
}),
|
|
1560
|
+
TenantParamsSchema.extend({
|
|
1505
1561
|
id: resourceIdSchema
|
|
1506
|
-
}).openapi("
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
}),
|
|
1512
|
-
projectId: zodOpenapi.z.string().openapi({
|
|
1513
|
-
description: "Project identifier",
|
|
1514
|
-
example: "project_456"
|
|
1515
|
-
}),
|
|
1562
|
+
}).openapi("TenantIdParams");
|
|
1563
|
+
var TenantProjectParamsSchema = TenantParamsSchema.extend({
|
|
1564
|
+
projectId: ProjectId
|
|
1565
|
+
}).openapi("TenantProjectParams");
|
|
1566
|
+
TenantProjectParamsSchema.extend({
|
|
1516
1567
|
id: resourceIdSchema
|
|
1517
1568
|
}).openapi("TenantProjectIdParams");
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
}),
|
|
1569
|
+
var TenantProjectGraphParamsSchema = TenantProjectParamsSchema.extend({
|
|
1570
|
+
graphId: GraphId
|
|
1571
|
+
}).openapi("TenantProjectGraphParams");
|
|
1572
|
+
TenantProjectGraphParamsSchema.extend({
|
|
1523
1573
|
id: resourceIdSchema
|
|
1524
|
-
}).openapi("
|
|
1525
|
-
|
|
1574
|
+
}).openapi("TenantProjectGraphIdParams");
|
|
1575
|
+
var TenantProjectGraphSubAgentParamsSchema = TenantProjectGraphParamsSchema.extend({
|
|
1576
|
+
subAgentId: SubAgentId
|
|
1577
|
+
}).openapi("TenantProjectGraphSubAgentParams");
|
|
1578
|
+
TenantProjectGraphSubAgentParamsSchema.extend({
|
|
1526
1579
|
id: resourceIdSchema
|
|
1527
|
-
}).openapi("
|
|
1580
|
+
}).openapi("TenantProjectGraphSubAgentIdParams");
|
|
1528
1581
|
zodOpenapi.z.object({
|
|
1529
1582
|
page: zodOpenapi.z.coerce.number().min(1).default(1),
|
|
1530
1583
|
limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10)
|
|
@@ -1632,6 +1685,283 @@ function validatePropsAsJsonSchema(props) {
|
|
|
1632
1685
|
}
|
|
1633
1686
|
}
|
|
1634
1687
|
|
|
1688
|
+
// src/constants/otel-attributes.ts
|
|
1689
|
+
var DELEGATION_FROM_SUB_AGENT_ID = "delegation.from_sub_agent_id";
|
|
1690
|
+
var DELEGATION_TO_SUB_AGENT_ID = "delegation.to_sub_agent_id";
|
|
1691
|
+
var DELEGATION_ID = "delegation.id";
|
|
1692
|
+
var TRANSFER_FROM_SUB_AGENT_ID = "transfer.from_sub_agent_id";
|
|
1693
|
+
var TRANSFER_TO_SUB_AGENT_ID = "transfer.to_sub_agent_id";
|
|
1694
|
+
var SPAN_NAMES = {
|
|
1695
|
+
AI_TOOL_CALL: "ai.toolCall",
|
|
1696
|
+
CONTEXT_RESOLUTION: "context-resolver.resolve_single_fetch_definition",
|
|
1697
|
+
CONTEXT_HANDLE: "context.handle_context_resolution",
|
|
1698
|
+
AGENT_GENERATION: "agent.generate",
|
|
1699
|
+
CONTEXT_FETCHER: "context-fetcher.http-request",
|
|
1700
|
+
ARTIFACT_PROCESSING: "graph_session.process_artifact"
|
|
1701
|
+
};
|
|
1702
|
+
var AI_OPERATIONS = {
|
|
1703
|
+
GENERATE_TEXT: "ai.generateText.doGenerate",
|
|
1704
|
+
STREAM_TEXT: "ai.streamText.doStream"
|
|
1705
|
+
};
|
|
1706
|
+
var SPAN_KEYS = {
|
|
1707
|
+
// Core span attributes
|
|
1708
|
+
SPAN_ID: "spanID",
|
|
1709
|
+
TRACE_ID: "traceID",
|
|
1710
|
+
DURATION_NANO: "durationNano",
|
|
1711
|
+
TIMESTAMP: "timestamp",
|
|
1712
|
+
HAS_ERROR: "hasError",
|
|
1713
|
+
STATUS_MESSAGE: "status_message",
|
|
1714
|
+
OTEL_STATUS_CODE: "otel.status_code",
|
|
1715
|
+
OTEL_STATUS_DESCRIPTION: "otel.status_description",
|
|
1716
|
+
// Graph attributes
|
|
1717
|
+
GRAPH_ID: "graph.id",
|
|
1718
|
+
GRAPH_NAME: "graph.name",
|
|
1719
|
+
TENANT_ID: "tenant.id",
|
|
1720
|
+
PROJECT_ID: "project.id",
|
|
1721
|
+
// AI/Agent attributes
|
|
1722
|
+
AI_AGENT_NAME: "ai.agentName",
|
|
1723
|
+
AI_AGENT_NAME_ALT: "ai.agent.name",
|
|
1724
|
+
AI_OPERATION_ID: "ai.operationId",
|
|
1725
|
+
AI_RESPONSE_TIMESTAMP: "ai.response.timestamp",
|
|
1726
|
+
AI_RESPONSE_CONTENT: "ai.response.content",
|
|
1727
|
+
AI_RESPONSE_TEXT: "ai.response.text",
|
|
1728
|
+
AI_RESPONSE_MODEL: "ai.response.model",
|
|
1729
|
+
AI_RESPONSE_TOOL_CALLS: "ai.response.toolCalls",
|
|
1730
|
+
AI_PROMPT_MESSAGES: "ai.prompt.messages",
|
|
1731
|
+
AI_MODEL_PROVIDER: "ai.model.provider",
|
|
1732
|
+
AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId",
|
|
1733
|
+
AI_MODEL_ID: "ai.model.id",
|
|
1734
|
+
// Tool attributes
|
|
1735
|
+
AI_TOOL_CALL_NAME: "ai.toolCall.name",
|
|
1736
|
+
AI_TOOL_CALL_RESULT: "ai.toolCall.result",
|
|
1737
|
+
AI_TOOL_CALL_ARGS: "ai.toolCall.args",
|
|
1738
|
+
AI_TOOL_CALL_ID: "ai.toolCall.id",
|
|
1739
|
+
AI_TOOL_TYPE: "ai.toolType",
|
|
1740
|
+
TOOL_PURPOSE: "tool.purpose",
|
|
1741
|
+
// Agent attributes
|
|
1742
|
+
AGENT_ID: "agent.id",
|
|
1743
|
+
AGENT_NAME: "agent.name",
|
|
1744
|
+
// Token usage
|
|
1745
|
+
GEN_AI_USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens",
|
|
1746
|
+
GEN_AI_USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens",
|
|
1747
|
+
// Context attributes
|
|
1748
|
+
CONTEXT_URL: "context.url",
|
|
1749
|
+
CONTEXT_CONFIG_ID: "context.context_config_id",
|
|
1750
|
+
CONTEXT_AGENT_GRAPH_ID: "context.agent_graph_id",
|
|
1751
|
+
CONTEXT_HEADERS_KEYS: "context.headers_keys",
|
|
1752
|
+
// Message attributes
|
|
1753
|
+
MESSAGE_CONTENT: "message.content",
|
|
1754
|
+
MESSAGE_TIMESTAMP: "message.timestamp",
|
|
1755
|
+
MCP_TOOL_DESCRIPTION: "mcp.tool.description",
|
|
1756
|
+
// Delegation/Transfer attributes
|
|
1757
|
+
DELEGATION_FROM_SUB_AGENT_ID,
|
|
1758
|
+
DELEGATION_TO_SUB_AGENT_ID,
|
|
1759
|
+
DELEGATION_ID,
|
|
1760
|
+
TRANSFER_FROM_SUB_AGENT_ID,
|
|
1761
|
+
TRANSFER_TO_SUB_AGENT_ID,
|
|
1762
|
+
// HTTP attributes
|
|
1763
|
+
HTTP_URL: "http.url",
|
|
1764
|
+
HTTP_STATUS_CODE: "http.status_code",
|
|
1765
|
+
HTTP_RESPONSE_BODY_SIZE: "http.response.body_size",
|
|
1766
|
+
// Core attributes
|
|
1767
|
+
NAME: "name",
|
|
1768
|
+
PARENT_SPAN_ID: "parentSpanID",
|
|
1769
|
+
CONVERSATION_ID: "conversation.id",
|
|
1770
|
+
// Artifact processing attributes
|
|
1771
|
+
ARTIFACT_ID: "artifact.id",
|
|
1772
|
+
ARTIFACT_TYPE: "artifact.type",
|
|
1773
|
+
ARTIFACT_AGENT_ID: "artifact.agent_id",
|
|
1774
|
+
ARTIFACT_TOOL_CALL_ID: "artifact.tool_call_id",
|
|
1775
|
+
ARTIFACT_DATA: "artifact.data",
|
|
1776
|
+
ARTIFACT_NAME: "artifact.name",
|
|
1777
|
+
ARTIFACT_DESCRIPTION: "artifact.description"
|
|
1778
|
+
};
|
|
1779
|
+
var UNKNOWN_VALUE = "unknown";
|
|
1780
|
+
var ACTIVITY_TYPES = {
|
|
1781
|
+
TOOL_CALL: "tool_call",
|
|
1782
|
+
AI_GENERATION: "ai_generation",
|
|
1783
|
+
AGENT_GENERATION: "agent_generation",
|
|
1784
|
+
CONTEXT_FETCH: "context_fetch",
|
|
1785
|
+
CONTEXT_RESOLUTION: "context_resolution",
|
|
1786
|
+
USER_MESSAGE: "user_message",
|
|
1787
|
+
AI_ASSISTANT_MESSAGE: "ai_assistant_message",
|
|
1788
|
+
AI_MODEL_STREAMED_TEXT: "ai_model_streamed_text"
|
|
1789
|
+
};
|
|
1790
|
+
var ACTIVITY_STATUS = {
|
|
1791
|
+
SUCCESS: "success",
|
|
1792
|
+
ERROR: "error",
|
|
1793
|
+
PENDING: "pending"
|
|
1794
|
+
};
|
|
1795
|
+
var AGENT_IDS = {
|
|
1796
|
+
USER: "user",
|
|
1797
|
+
AI_ASSISTANT: "ai-assistant"
|
|
1798
|
+
};
|
|
1799
|
+
var ACTIVITY_NAMES = {
|
|
1800
|
+
CONTEXT_FETCH: "Context Fetch",
|
|
1801
|
+
USER_MESSAGE: "User Message",
|
|
1802
|
+
AI_ASSISTANT_MESSAGE: "AI Assistant Message",
|
|
1803
|
+
AI_TEXT_GENERATION: "AI Text Generation",
|
|
1804
|
+
AI_STREAMING_TEXT: "AI Streaming Text",
|
|
1805
|
+
UNKNOWN_AGENT: "Unknown Agent",
|
|
1806
|
+
USER: "User"
|
|
1807
|
+
};
|
|
1808
|
+
var AI_TOOL_TYPES = {
|
|
1809
|
+
MCP: "mcp",
|
|
1810
|
+
TRANSFER: "transfer",
|
|
1811
|
+
DELEGATION: "delegation"
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1814
|
+
// src/constants/signoz-queries.ts
|
|
1815
|
+
var DATA_TYPES = {
|
|
1816
|
+
STRING: "string",
|
|
1817
|
+
INT64: "int64",
|
|
1818
|
+
FLOAT64: "float64",
|
|
1819
|
+
BOOL: "bool"
|
|
1820
|
+
};
|
|
1821
|
+
var FIELD_TYPES = {
|
|
1822
|
+
TAG: "tag",
|
|
1823
|
+
RESOURCE: "resource"
|
|
1824
|
+
};
|
|
1825
|
+
var QUERY_FIELD_CONFIGS = {
|
|
1826
|
+
// String tag fields
|
|
1827
|
+
STRING_TAG: {
|
|
1828
|
+
dataType: DATA_TYPES.STRING,
|
|
1829
|
+
type: FIELD_TYPES.TAG,
|
|
1830
|
+
isColumn: false
|
|
1831
|
+
},
|
|
1832
|
+
STRING_TAG_COLUMN: {
|
|
1833
|
+
dataType: DATA_TYPES.STRING,
|
|
1834
|
+
type: FIELD_TYPES.TAG,
|
|
1835
|
+
isColumn: true
|
|
1836
|
+
},
|
|
1837
|
+
// Numeric tag fields
|
|
1838
|
+
INT64_TAG: {
|
|
1839
|
+
dataType: DATA_TYPES.INT64,
|
|
1840
|
+
type: FIELD_TYPES.TAG,
|
|
1841
|
+
isColumn: false
|
|
1842
|
+
},
|
|
1843
|
+
INT64_TAG_COLUMN: {
|
|
1844
|
+
dataType: DATA_TYPES.INT64,
|
|
1845
|
+
type: FIELD_TYPES.TAG,
|
|
1846
|
+
isColumn: true
|
|
1847
|
+
},
|
|
1848
|
+
FLOAT64_TAG: {
|
|
1849
|
+
dataType: DATA_TYPES.FLOAT64,
|
|
1850
|
+
type: FIELD_TYPES.TAG,
|
|
1851
|
+
isColumn: false
|
|
1852
|
+
},
|
|
1853
|
+
FLOAT64_TAG_COLUMN: {
|
|
1854
|
+
dataType: DATA_TYPES.FLOAT64,
|
|
1855
|
+
type: FIELD_TYPES.TAG,
|
|
1856
|
+
isColumn: true
|
|
1857
|
+
},
|
|
1858
|
+
// Boolean tag fields
|
|
1859
|
+
BOOL_TAG: {
|
|
1860
|
+
dataType: DATA_TYPES.BOOL,
|
|
1861
|
+
type: FIELD_TYPES.TAG,
|
|
1862
|
+
isColumn: false
|
|
1863
|
+
},
|
|
1864
|
+
BOOL_TAG_COLUMN: {
|
|
1865
|
+
dataType: DATA_TYPES.BOOL,
|
|
1866
|
+
type: FIELD_TYPES.TAG,
|
|
1867
|
+
isColumn: true
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
var OPERATORS = {
|
|
1871
|
+
// Comparison operators
|
|
1872
|
+
EQUALS: "=",
|
|
1873
|
+
NOT_EQUALS: "!=",
|
|
1874
|
+
LESS_THAN: "<",
|
|
1875
|
+
GREATER_THAN: ">",
|
|
1876
|
+
LESS_THAN_OR_EQUAL: "<=",
|
|
1877
|
+
GREATER_THAN_OR_EQUAL: ">=",
|
|
1878
|
+
// String operators
|
|
1879
|
+
LIKE: "like",
|
|
1880
|
+
NOT_LIKE: "nlike",
|
|
1881
|
+
// Existence operators
|
|
1882
|
+
EXISTS: "exists",
|
|
1883
|
+
NOT_EXISTS: "nexists",
|
|
1884
|
+
// Logical operators
|
|
1885
|
+
AND: "AND",
|
|
1886
|
+
OR: "OR"
|
|
1887
|
+
};
|
|
1888
|
+
var QUERY_EXPRESSIONS = {
|
|
1889
|
+
SPAN_NAMES: "spanNames",
|
|
1890
|
+
AGENT_MODEL_CALLS: "agentModelCalls",
|
|
1891
|
+
MODEL_CALLS: "modelCalls",
|
|
1892
|
+
LAST_ACTIVITY: "lastActivity",
|
|
1893
|
+
CONVERSATION_METADATA: "conversationMetadata",
|
|
1894
|
+
FILTERED_CONVERSATIONS: "filteredConversations",
|
|
1895
|
+
TOOLS: "tools",
|
|
1896
|
+
TRANSFERS: "transfers",
|
|
1897
|
+
DELEGATIONS: "delegations",
|
|
1898
|
+
AI_CALLS: "aiCalls",
|
|
1899
|
+
CONTEXT_ERRORS: "contextErrors",
|
|
1900
|
+
AGENT_GENERATION_ERRORS: "agentGenerationErrors",
|
|
1901
|
+
USER_MESSAGES: "userMessages",
|
|
1902
|
+
UNIQUE_GRAPHS: "uniqueGraphs",
|
|
1903
|
+
UNIQUE_MODELS: "uniqueModels",
|
|
1904
|
+
// Route-specific query names
|
|
1905
|
+
TOOL_CALLS: "toolCalls",
|
|
1906
|
+
CONTEXT_RESOLUTION: "contextResolution",
|
|
1907
|
+
CONTEXT_HANDLE: "contextHandle",
|
|
1908
|
+
AI_ASSISTANT_MESSAGES: "aiAssistantMessages",
|
|
1909
|
+
AI_GENERATIONS: "aiGenerations",
|
|
1910
|
+
AI_STREAMING_TEXT: "aiStreamingText",
|
|
1911
|
+
CONTEXT_FETCHERS: "contextFetchers",
|
|
1912
|
+
DURATION_SPANS: "durationSpans",
|
|
1913
|
+
AGENT_GENERATIONS: "agentGenerations",
|
|
1914
|
+
SPANS_WITH_ERRORS: "spansWithErrors",
|
|
1915
|
+
ARTIFACT_PROCESSING: "artifactProcessing"
|
|
1916
|
+
};
|
|
1917
|
+
var REDUCE_OPERATIONS = {
|
|
1918
|
+
SUM: "sum",
|
|
1919
|
+
MAX: "max",
|
|
1920
|
+
MIN: "min",
|
|
1921
|
+
AVG: "avg",
|
|
1922
|
+
COUNT: "count"
|
|
1923
|
+
};
|
|
1924
|
+
var ORDER_DIRECTIONS = {
|
|
1925
|
+
ASC: "asc",
|
|
1926
|
+
DESC: "desc"
|
|
1927
|
+
};
|
|
1928
|
+
var QUERY_TYPES = {
|
|
1929
|
+
BUILDER: "builder",
|
|
1930
|
+
CLICKHOUSE: "clickhouse",
|
|
1931
|
+
PROMQL: "promql"
|
|
1932
|
+
};
|
|
1933
|
+
var PANEL_TYPES = {
|
|
1934
|
+
LIST: "list",
|
|
1935
|
+
TABLE: "table",
|
|
1936
|
+
GRAPH: "graph",
|
|
1937
|
+
VALUE: "value"
|
|
1938
|
+
};
|
|
1939
|
+
var DATA_SOURCES = {
|
|
1940
|
+
TRACES: "traces",
|
|
1941
|
+
METRICS: "metrics",
|
|
1942
|
+
LOGS: "logs"
|
|
1943
|
+
};
|
|
1944
|
+
var AGGREGATE_OPERATORS = {
|
|
1945
|
+
COUNT: "count",
|
|
1946
|
+
SUM: "sum",
|
|
1947
|
+
AVG: "avg",
|
|
1948
|
+
MIN: "min",
|
|
1949
|
+
MAX: "max",
|
|
1950
|
+
NOOP: "noop"
|
|
1951
|
+
};
|
|
1952
|
+
var QUERY_DEFAULTS = {
|
|
1953
|
+
STEP: 60,
|
|
1954
|
+
STEP_INTERVAL: 60,
|
|
1955
|
+
OFFSET: 0,
|
|
1956
|
+
DISABLED: false,
|
|
1957
|
+
HAVING: [],
|
|
1958
|
+
LEGEND: "",
|
|
1959
|
+
LIMIT_NULL: null,
|
|
1960
|
+
LIMIT_ZERO: 0,
|
|
1961
|
+
LIMIT_1000: 1e3,
|
|
1962
|
+
EMPTY_GROUP_BY: []
|
|
1963
|
+
};
|
|
1964
|
+
|
|
1635
1965
|
// src/client-exports.ts
|
|
1636
1966
|
var TenantParamsSchema2 = zod.z.object({
|
|
1637
1967
|
tenantId: zod.z.string()
|
|
@@ -1642,7 +1972,7 @@ var TenantProjectParamsSchema2 = TenantParamsSchema2.extend({
|
|
|
1642
1972
|
var TenantProjectIdParamsSchema2 = TenantProjectParamsSchema2.extend({
|
|
1643
1973
|
id: zod.z.string()
|
|
1644
1974
|
});
|
|
1645
|
-
var
|
|
1975
|
+
var IdParamsSchema = zod.z.object({
|
|
1646
1976
|
id: zod.z.string()
|
|
1647
1977
|
});
|
|
1648
1978
|
var PaginationSchema2 = zod.z.object({
|
|
@@ -1663,7 +1993,7 @@ var ErrorResponseSchema2 = zod.z.object({
|
|
|
1663
1993
|
message: zod.z.string().optional(),
|
|
1664
1994
|
details: zod.z.unknown().optional()
|
|
1665
1995
|
});
|
|
1666
|
-
var
|
|
1996
|
+
var AgentApiInsertSchema = zod.z.object({
|
|
1667
1997
|
id: zod.z.string().optional(),
|
|
1668
1998
|
name: zod.z.string(),
|
|
1669
1999
|
description: zod.z.string().optional(),
|
|
@@ -1739,10 +2069,10 @@ var AgentGraphApiInsertSchema2 = zod.z.object({
|
|
|
1739
2069
|
id: zod.z.string().optional(),
|
|
1740
2070
|
name: zod.z.string(),
|
|
1741
2071
|
description: zod.z.string().optional(),
|
|
1742
|
-
|
|
2072
|
+
defaultSubAgentId: zod.z.string().optional()
|
|
1743
2073
|
});
|
|
1744
2074
|
var FullGraphDefinitionSchema2 = AgentGraphApiInsertSchema2.extend({
|
|
1745
|
-
|
|
2075
|
+
subAgents: zod.z.record(
|
|
1746
2076
|
zod.z.string(),
|
|
1747
2077
|
zod.z.union([
|
|
1748
2078
|
FullGraphAgentInsertSchema,
|
|
@@ -1801,37 +2131,63 @@ function generateIdFromName(name) {
|
|
|
1801
2131
|
return name.toLowerCase().replace(/[^a-zA-Z0-9]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, MAX_ID_LENGTH2);
|
|
1802
2132
|
}
|
|
1803
2133
|
|
|
1804
|
-
exports.
|
|
2134
|
+
exports.ACTIVITY_NAMES = ACTIVITY_NAMES;
|
|
2135
|
+
exports.ACTIVITY_STATUS = ACTIVITY_STATUS;
|
|
2136
|
+
exports.ACTIVITY_TYPES = ACTIVITY_TYPES;
|
|
2137
|
+
exports.AGENT_IDS = AGENT_IDS;
|
|
2138
|
+
exports.AGGREGATE_OPERATORS = AGGREGATE_OPERATORS;
|
|
2139
|
+
exports.AI_OPERATIONS = AI_OPERATIONS;
|
|
2140
|
+
exports.AI_TOOL_TYPES = AI_TOOL_TYPES;
|
|
2141
|
+
exports.AgentApiInsertSchema = AgentApiInsertSchema;
|
|
1805
2142
|
exports.AgentGraphApiInsertSchema = AgentGraphApiInsertSchema2;
|
|
1806
|
-
exports.AgentStopWhenSchema =
|
|
2143
|
+
exports.AgentStopWhenSchema = SubAgentStopWhenSchema;
|
|
1807
2144
|
exports.ApiKeyApiCreationResponseSchema = ApiKeyApiCreationResponseSchema2;
|
|
1808
2145
|
exports.ApiKeyApiSelectSchema = ApiKeyApiSelectSchema2;
|
|
1809
2146
|
exports.ArtifactComponentApiInsertSchema = ArtifactComponentApiInsertSchema2;
|
|
1810
2147
|
exports.ContextConfigApiInsertSchema = ContextConfigApiInsertSchema2;
|
|
1811
2148
|
exports.CredentialReferenceApiInsertSchema = CredentialReferenceApiInsertSchema2;
|
|
1812
2149
|
exports.CredentialStoreType = CredentialStoreType;
|
|
2150
|
+
exports.DATA_SOURCES = DATA_SOURCES;
|
|
2151
|
+
exports.DATA_TYPES = DATA_TYPES;
|
|
2152
|
+
exports.DELEGATION_FROM_SUB_AGENT_ID = DELEGATION_FROM_SUB_AGENT_ID;
|
|
2153
|
+
exports.DELEGATION_ID = DELEGATION_ID;
|
|
2154
|
+
exports.DELEGATION_TO_SUB_AGENT_ID = DELEGATION_TO_SUB_AGENT_ID;
|
|
1813
2155
|
exports.DataComponentApiInsertSchema = DataComponentApiInsertSchema2;
|
|
1814
2156
|
exports.ErrorResponseSchema = ErrorResponseSchema2;
|
|
1815
2157
|
exports.ExternalAgentApiInsertSchema = ExternalAgentApiInsertSchema2;
|
|
2158
|
+
exports.FIELD_TYPES = FIELD_TYPES;
|
|
1816
2159
|
exports.FullGraphDefinitionSchema = FullGraphDefinitionSchema2;
|
|
1817
2160
|
exports.FunctionApiInsertSchema = FunctionApiInsertSchema;
|
|
1818
2161
|
exports.FunctionApiSelectSchema = FunctionApiSelectSchema;
|
|
1819
2162
|
exports.FunctionApiUpdateSchema = FunctionApiUpdateSchema;
|
|
1820
2163
|
exports.GraphStopWhenSchema = GraphStopWhenSchema;
|
|
1821
|
-
exports.IdParamsSchema =
|
|
2164
|
+
exports.IdParamsSchema = IdParamsSchema;
|
|
1822
2165
|
exports.ListResponseSchema = ListResponseSchema;
|
|
1823
2166
|
exports.MAX_ID_LENGTH = MAX_ID_LENGTH2;
|
|
1824
2167
|
exports.MCPTransportType = MCPTransportType;
|
|
1825
2168
|
exports.MIN_ID_LENGTH = MIN_ID_LENGTH2;
|
|
1826
2169
|
exports.ModelSettingsSchema = ModelSettingsSchema;
|
|
2170
|
+
exports.OPERATORS = OPERATORS;
|
|
2171
|
+
exports.ORDER_DIRECTIONS = ORDER_DIRECTIONS;
|
|
2172
|
+
exports.PANEL_TYPES = PANEL_TYPES;
|
|
1827
2173
|
exports.PaginationSchema = PaginationSchema2;
|
|
2174
|
+
exports.QUERY_DEFAULTS = QUERY_DEFAULTS;
|
|
2175
|
+
exports.QUERY_EXPRESSIONS = QUERY_EXPRESSIONS;
|
|
2176
|
+
exports.QUERY_FIELD_CONFIGS = QUERY_FIELD_CONFIGS;
|
|
2177
|
+
exports.QUERY_TYPES = QUERY_TYPES;
|
|
2178
|
+
exports.REDUCE_OPERATIONS = REDUCE_OPERATIONS;
|
|
2179
|
+
exports.SPAN_KEYS = SPAN_KEYS;
|
|
2180
|
+
exports.SPAN_NAMES = SPAN_NAMES;
|
|
1828
2181
|
exports.SandboxConfigSchema = SandboxConfigSchema;
|
|
1829
2182
|
exports.SingleResponseSchema = SingleResponseSchema;
|
|
1830
2183
|
exports.StopWhenSchema = StopWhenSchema;
|
|
2184
|
+
exports.TRANSFER_FROM_SUB_AGENT_ID = TRANSFER_FROM_SUB_AGENT_ID;
|
|
2185
|
+
exports.TRANSFER_TO_SUB_AGENT_ID = TRANSFER_TO_SUB_AGENT_ID;
|
|
1831
2186
|
exports.TenantParamsSchema = TenantParamsSchema2;
|
|
1832
2187
|
exports.TenantProjectIdParamsSchema = TenantProjectIdParamsSchema2;
|
|
1833
2188
|
exports.TenantProjectParamsSchema = TenantProjectParamsSchema2;
|
|
1834
2189
|
exports.ToolApiInsertSchema = ToolApiInsertSchema2;
|
|
2190
|
+
exports.UNKNOWN_VALUE = UNKNOWN_VALUE;
|
|
1835
2191
|
exports.URL_SAFE_ID_PATTERN = URL_SAFE_ID_PATTERN2;
|
|
1836
2192
|
exports.generateIdFromName = generateIdFromName;
|
|
1837
2193
|
exports.resourceIdSchema = resourceIdSchema2;
|