@inkeep/agents-core 0.16.3 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +2 -2
  2. package/dist/{chunk-72MXE5SX.js → chunk-E4SFK6AI.js} +143 -157
  3. package/dist/{chunk-VPJ6Z5QZ.js → chunk-ID4CFGVF.js} +202 -131
  4. package/dist/chunk-JTHQYGCX.js +173 -0
  5. package/dist/chunk-TCLX6C3C.js +271 -0
  6. package/dist/client-exports.cjs +622 -272
  7. package/dist/client-exports.d.cts +6 -5
  8. package/dist/client-exports.d.ts +6 -5
  9. package/dist/client-exports.js +5 -4
  10. package/dist/db/schema.cjs +201 -130
  11. package/dist/db/schema.d.cts +2 -2
  12. package/dist/db/schema.d.ts +2 -2
  13. package/dist/db/schema.js +1 -1
  14. package/dist/index.cjs +2734 -1831
  15. package/dist/index.d.cts +1667 -1550
  16. package/dist/index.d.ts +1667 -1550
  17. package/dist/index.js +1880 -1394
  18. package/dist/{schema-BQk_FMBV.d.ts → schema-Bjy5TkFv.d.cts} +473 -172
  19. package/dist/{schema-Ct2NlO81.d.cts → schema-CfWbqju2.d.ts} +473 -172
  20. package/dist/signoz-queries-CifqdbnO.d.cts +269 -0
  21. package/dist/signoz-queries-CifqdbnO.d.ts +269 -0
  22. package/dist/types/index.d.cts +2 -2
  23. package/dist/types/index.d.ts +2 -2
  24. package/dist/{utility-s9c5CVOe.d.cts → utility-Fxoh7s82.d.cts} +585 -384
  25. package/dist/{utility-s9c5CVOe.d.ts → utility-Fxoh7s82.d.ts} +585 -384
  26. package/dist/validation/index.cjs +429 -325
  27. package/dist/validation/index.d.cts +76 -4
  28. package/dist/validation/index.d.ts +76 -4
  29. package/dist/validation/index.js +2 -2
  30. package/drizzle/0005_wide_shriek.sql +127 -0
  31. package/drizzle/0006_damp_lenny_balinger.sql +52 -0
  32. package/drizzle/meta/0005_snapshot.json +2558 -0
  33. package/drizzle/meta/0006_snapshot.json +2751 -0
  34. package/drizzle/meta/_journal.json +14 -0
  35. package/package.json +1 -1
  36. package/dist/chunk-N43VFJD3.js +0 -134
@@ -41,9 +41,9 @@ var graphScoped = {
41
41
  ...projectScoped,
42
42
  graphId: sqliteCore.text("graph_id").notNull()
43
43
  };
44
- var agentScoped = {
44
+ var subAgentScoped = {
45
45
  ...graphScoped,
46
- agentId: sqliteCore.text("agent_id").notNull()
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
- defaultAgentId: sqliteCore.text("default_agent_id"),
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 agents = sqliteCore.sqliteTable(
157
- "agents",
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 agentRelations = sqliteCore.sqliteTable(
180
- "agent_relations",
179
+ var subAgentRelations = sqliteCore.sqliteTable(
180
+ "sub_agent_relations",
181
181
  {
182
182
  ...graphScoped,
183
- sourceAgentId: sqliteCore.text("source_agent_id").notNull(),
183
+ sourceSubAgentId: sqliteCore.text("source_sub_agent_id").notNull(),
184
184
  // For internal relationships
185
- targetAgentId: sqliteCore.text("target_agent_id"),
185
+ targetSubAgentId: sqliteCore.text("target_sub_agent_id"),
186
186
  // For external relationships
187
- externalAgentId: sqliteCore.text("external_agent_id"),
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: "agent_relations_graph_fk"
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
- ...agentScoped,
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.agentId],
243
- foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
244
- name: "tasks_agent_fk"
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 agentDataComponents = sqliteCore.sqliteTable(
285
- "agent_data_components",
283
+ var subAgentDataComponents = sqliteCore.sqliteTable(
284
+ "sub_agent_data_components",
286
285
  {
287
- ...agentScoped,
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.agentId],
296
- foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
297
- name: "agent_data_components_agent_fk"
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: "agent_data_components_data_component_fk"
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 agentArtifactComponents = sqliteCore.sqliteTable(
325
- "agent_artifact_components",
323
+ var subAgentArtifactComponents = sqliteCore.sqliteTable(
324
+ "sub_agent_artifact_components",
326
325
  {
327
- ...agentScoped,
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.agentId, table.id]
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.agentId],
338
- foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
339
- name: "agent_artifact_components_agent_fk"
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: "agent_artifact_components_artifact_component_fk"
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 (for function tools)
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: "tools_function_fk"
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 agentToolRelations = sqliteCore.sqliteTable(
406
- "agent_tool_relations",
419
+ var subAgentToolRelations = sqliteCore.sqliteTable(
420
+ "sub_agent_tool_relations",
407
421
  {
408
- ...agentScoped,
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.agentId],
419
- foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
420
- name: "agent_tool_relations_agent_fk"
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: "agent_tool_relations_tool_fk"
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
- activeAgentId: sqliteCore.text("active_agent_id").notNull(),
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
- fromAgentId: sqliteCore.text("from_agent_id"),
501
+ fromSubAgentId: sqliteCore.text("from_sub_agent_id"),
460
502
  // Populated when message is from an agent
461
- toAgentId: sqliteCore.text("to_agent_id"),
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("from_external_agent_id"),
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("to_external_agent_id"),
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
- // A task belongs to one agent
605
- agent: one(agents, {
606
- fields: [tasks.agentId],
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
- agents: many(agents),
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(agents, ({ many, one }) => ({
693
+ drizzleOrm.relations(subAgents, ({ many, one }) => ({
654
694
  project: one(projects, {
655
- fields: [agents.tenantId, agents.projectId],
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(agentRelations, {
700
+ sourceRelations: many(subAgentRelations, {
661
701
  relationName: "sourceRelations"
662
702
  }),
663
- targetRelations: many(agentRelations, {
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(agentToolRelations),
676
- dataComponentRelations: many(agentDataComponents),
677
- artifactComponentRelations: many(agentArtifactComponents)
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
- defaultAgent: one(agents, {
685
- fields: [agentGraph.defaultAgentId],
686
- references: [agents.id]
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
- agentRelations: many(agentRelations),
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(agentToolRelations, ({ one }) => ({
715
- agent: one(agents, {
716
- fields: [agentToolRelations.agentId],
717
- references: [agents.id]
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: [agentToolRelations.toolId],
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
- agentRelations: many(agentToolRelations),
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
- activeAgent: one(agents, {
749
- fields: [conversations.activeAgentId],
750
- references: [agents.id]
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
- // Legacy agent association (consider deprecating)
759
- agent: one(agents, {
760
- fields: [messages.agentId],
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
- toAgent: one(agents, {
770
- fields: [messages.toAgentId],
771
- references: [agents.id],
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
- agentRelations: many(agentArtifactComponents)
799
- }));
800
- drizzleOrm.relations(agentArtifactComponents, ({ one }) => ({
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
- artifactComponent: one(artifactComponents, {
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
- agentRelations: many(agentDataComponents)
854
+ subAgentRelations: many(subAgentDataComponents)
816
855
  }));
817
- drizzleOrm.relations(agentDataComponents, ({ one }) => ({
818
- agent: one(agents, {
819
- fields: [agentDataComponents.agentId],
820
- references: [agents.id]
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: [agentDataComponents.dataComponentId],
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
- tools: many(tools)
877
+ functionTools: many(functionTools)
839
878
  }));
840
- drizzleOrm.relations(agentRelations, ({ one }) => ({
879
+ drizzleOrm.relations(subAgentRelations, ({ one }) => ({
841
880
  graph: one(agentGraph, {
842
- fields: [agentRelations.graphId],
881
+ fields: [subAgentRelations.graphId],
843
882
  references: [agentGraph.id]
844
883
  }),
845
- sourceAgent: one(agents, {
846
- fields: [agentRelations.sourceAgentId],
847
- references: [agents.id],
884
+ sourceSubAgent: one(subAgents, {
885
+ fields: [subAgentRelations.sourceSubAgentId],
886
+ references: [subAgents.id],
848
887
  relationName: "sourceRelations"
849
888
  }),
850
- targetAgent: one(agents, {
851
- fields: [agentRelations.targetAgentId],
852
- references: [agents.id],
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: [agentRelations.externalAgentId],
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 AgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true });
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 AgentSelectSchema = drizzleZod.createSelectSchema(agents);
911
- var AgentInsertSchema = drizzleZod.createInsertSchema(agents).extend({
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 AgentUpdateSchema = AgentInsertSchema.partial();
916
- var AgentApiSelectSchema = createGraphScopedApiSchema(AgentSelectSchema);
917
- var AgentApiInsertSchema = createGraphScopedApiInsertSchema(AgentInsertSchema);
918
- createGraphScopedApiUpdateSchema(AgentUpdateSchema);
919
- var AgentRelationSelectSchema = drizzleZod.createSelectSchema(agentRelations);
920
- var AgentRelationInsertSchema = drizzleZod.createInsertSchema(agentRelations).extend({
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
- sourceAgentId: resourceIdSchema,
924
- targetAgentId: resourceIdSchema.optional(),
925
- externalAgentId: resourceIdSchema.optional()
990
+ sourceSubAgentId: resourceIdSchema,
991
+ targetSubAgentId: resourceIdSchema.optional(),
992
+ externalSubAgentId: resourceIdSchema.optional()
926
993
  });
927
- var AgentRelationUpdateSchema = AgentRelationInsertSchema.partial();
928
- createGraphScopedApiSchema(AgentRelationSelectSchema);
994
+ var SubAgentRelationUpdateSchema = SubAgentRelationInsertSchema.partial();
995
+ createGraphScopedApiSchema(
996
+ SubAgentRelationSelectSchema
997
+ );
929
998
  createGraphScopedApiInsertSchema(
930
- AgentRelationInsertSchema
999
+ SubAgentRelationInsertSchema
931
1000
  ).extend({
932
1001
  relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES)
933
1002
  }).refine(
934
1003
  (data) => {
935
- const hasTarget = data.targetAgentId != null;
936
- const hasExternal = data.externalAgentId != null;
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 targetAgentId or externalAgentId",
941
- path: ["targetAgentId", "externalAgentId"]
1009
+ message: "Must specify exactly one of targetSubAgentId or externalSubAgentId",
1010
+ path: ["targetSubAgentId", "externalSubAgentId"]
942
1011
  }
943
1012
  );
944
1013
  createGraphScopedApiUpdateSchema(
945
- AgentRelationUpdateSchema
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.targetAgentId != null;
951
- const hasExternal = data.externalAgentId != null;
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 targetAgentId or externalAgentId when updating agent relationships",
959
- path: ["targetAgentId", "externalAgentId"]
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
- sourceAgentId: zodOpenapi.z.string().optional(),
964
- targetAgentId: zodOpenapi.z.string().optional(),
965
- externalAgentId: zodOpenapi.z.string().optional()
1032
+ sourceSubAgentId: zodOpenapi.z.string().optional(),
1033
+ targetSubAgentId: zodOpenapi.z.string().optional(),
1034
+ externalSubAgentId: zodOpenapi.z.string().optional()
966
1035
  });
967
- var ExternalAgentRelationInsertSchema = drizzleZod.createInsertSchema(agentRelations).extend({
1036
+ var ExternalSubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
968
1037
  id: resourceIdSchema,
969
1038
  graphId: resourceIdSchema,
970
- sourceAgentId: resourceIdSchema,
971
- externalAgentId: resourceIdSchema
1039
+ sourceSubAgentId: resourceIdSchema,
1040
+ externalSubAgentId: resourceIdSchema
972
1041
  });
973
1042
  createApiInsertSchema(
974
- ExternalAgentRelationInsertSchema
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
- functionId: resourceIdSchema.optional(),
1042
- // For function tools, reference to global functions table
1043
- config: zodOpenapi.z.discriminatedUnion("type", [
1044
- // MCP tools
1045
- zodOpenapi.z.object({
1046
- type: zodOpenapi.z.literal("mcp"),
1047
- mcp: zodOpenapi.z.object({
1048
- server: zodOpenapi.z.object({
1049
- url: zodOpenapi.z.string().url()
1050
- }),
1051
- transport: zodOpenapi.z.object({
1052
- type: zodOpenapi.z.enum(MCPTransportType),
1053
- requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
1054
- eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
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 AgentDataComponentSelectSchema = drizzleZod.createSelectSchema(agentDataComponents);
1106
- var AgentDataComponentInsertSchema = drizzleZod.createInsertSchema(agentDataComponents);
1107
- var AgentDataComponentUpdateSchema = AgentDataComponentInsertSchema.partial();
1164
+ var SubAgentDataComponentSelectSchema = drizzleZod.createSelectSchema(subAgentDataComponents);
1165
+ var SubAgentDataComponentInsertSchema = drizzleZod.createInsertSchema(subAgentDataComponents);
1166
+ var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
1108
1167
  createGraphScopedApiSchema(
1109
- AgentDataComponentSelectSchema
1168
+ SubAgentDataComponentSelectSchema
1110
1169
  );
1111
- AgentDataComponentInsertSchema.omit({
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
- AgentDataComponentUpdateSchema
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 AgentArtifactComponentSelectSchema = drizzleZod.createSelectSchema(agentArtifactComponents);
1136
- var AgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
1137
- agentArtifactComponents
1194
+ var SubAgentArtifactComponentSelectSchema = drizzleZod.createSelectSchema(subAgentArtifactComponents);
1195
+ var SubAgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
1196
+ subAgentArtifactComponents
1138
1197
  ).extend({
1139
1198
  id: resourceIdSchema,
1140
- agentId: resourceIdSchema,
1199
+ subAgentId: resourceIdSchema,
1141
1200
  artifactComponentId: resourceIdSchema
1142
1201
  });
1143
- var AgentArtifactComponentUpdateSchema = AgentArtifactComponentInsertSchema.partial();
1202
+ var SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentInsertSchema.partial();
1144
1203
  createGraphScopedApiSchema(
1145
- AgentArtifactComponentSelectSchema
1204
+ SubAgentArtifactComponentSelectSchema
1146
1205
  );
1147
- AgentArtifactComponentInsertSchema.omit({
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
- AgentArtifactComponentUpdateSchema
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
- AgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
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 AgentToolRelationSelectSchema = drizzleZod.createSelectSchema(agentToolRelations);
1323
- var AgentToolRelationInsertSchema = drizzleZod.createInsertSchema(agentToolRelations).extend({
1389
+ var SubAgentToolRelationSelectSchema = drizzleZod.createSelectSchema(subAgentToolRelations);
1390
+ var SubAgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToolRelations).extend({
1324
1391
  id: resourceIdSchema,
1325
- agentId: resourceIdSchema,
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 AgentToolRelationUpdateSchema = AgentToolRelationInsertSchema.partial();
1397
+ var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
1331
1398
  createGraphScopedApiSchema(
1332
- AgentToolRelationSelectSchema
1399
+ SubAgentToolRelationSelectSchema
1333
1400
  );
1334
1401
  createGraphScopedApiInsertSchema(
1335
- AgentToolRelationInsertSchema
1402
+ SubAgentToolRelationInsertSchema
1336
1403
  );
1337
1404
  createGraphScopedApiUpdateSchema(
1338
- AgentToolRelationUpdateSchema
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 = AgentApiInsertSchema.extend({
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
- agents: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])),
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
- // Get tool name/description from toolId
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
- agents: zodOpenapi.z.record(
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
- // Now includes both MCP and function tools
1517
+ // MCP tools (project-scoped)
1439
1518
  functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
1440
- // Global functions
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.object({
1463
- tenantId: zodOpenapi.z.string().openapi({
1464
- description: "Tenant identifier",
1465
- example: "tenant_123"
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
- zodOpenapi.z.object({
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("TenantProjectGraphIdParams");
1507
- zodOpenapi.z.object({
1508
- tenantId: zodOpenapi.z.string().openapi({
1509
- description: "Tenant identifier",
1510
- example: "tenant_123"
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
- zodOpenapi.z.object({
1519
- tenantId: zodOpenapi.z.string().openapi({
1520
- description: "Tenant identifier",
1521
- example: "tenant_123"
1522
- }),
1569
+ var TenantProjectGraphParamsSchema = TenantProjectParamsSchema.extend({
1570
+ graphId: GraphId
1571
+ }).openapi("TenantProjectGraphParams");
1572
+ TenantProjectGraphParamsSchema.extend({
1523
1573
  id: resourceIdSchema
1524
- }).openapi("TenantIdParams");
1525
- zodOpenapi.z.object({
1574
+ }).openapi("TenantProjectGraphIdParams");
1575
+ var TenantProjectGraphSubAgentParamsSchema = TenantProjectGraphParamsSchema.extend({
1576
+ subAgentId: SubAgentId
1577
+ }).openapi("TenantProjectGraphSubAgentParams");
1578
+ TenantProjectGraphSubAgentParamsSchema.extend({
1526
1579
  id: resourceIdSchema
1527
- }).openapi("IdParams");
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,276 @@ 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
+ };
1701
+ var AI_OPERATIONS = {
1702
+ GENERATE_TEXT: "ai.generateText.doGenerate",
1703
+ STREAM_TEXT: "ai.streamText.doStream"
1704
+ };
1705
+ var SPAN_KEYS = {
1706
+ // Core span attributes
1707
+ SPAN_ID: "spanID",
1708
+ TRACE_ID: "traceID",
1709
+ DURATION_NANO: "durationNano",
1710
+ TIMESTAMP: "timestamp",
1711
+ HAS_ERROR: "hasError",
1712
+ STATUS_MESSAGE: "status_message",
1713
+ OTEL_STATUS_CODE: "otel.status_code",
1714
+ OTEL_STATUS_DESCRIPTION: "otel.status_description",
1715
+ // Graph attributes
1716
+ GRAPH_ID: "graph.id",
1717
+ GRAPH_NAME: "graph.name",
1718
+ TENANT_ID: "tenant.id",
1719
+ PROJECT_ID: "project.id",
1720
+ // AI/Agent attributes
1721
+ AI_AGENT_NAME: "ai.agentName",
1722
+ AI_AGENT_NAME_ALT: "ai.agent.name",
1723
+ AI_OPERATION_ID: "ai.operationId",
1724
+ AI_RESPONSE_TIMESTAMP: "ai.response.timestamp",
1725
+ AI_RESPONSE_CONTENT: "ai.response.content",
1726
+ AI_RESPONSE_TEXT: "ai.response.text",
1727
+ AI_RESPONSE_MODEL: "ai.response.model",
1728
+ AI_RESPONSE_TOOL_CALLS: "ai.response.toolCalls",
1729
+ AI_PROMPT_MESSAGES: "ai.prompt.messages",
1730
+ AI_MODEL_PROVIDER: "ai.model.provider",
1731
+ AI_TELEMETRY_FUNCTION_ID: "ai.telemetry.functionId",
1732
+ AI_MODEL_ID: "ai.model.id",
1733
+ // Tool attributes
1734
+ AI_TOOL_CALL_NAME: "ai.toolCall.name",
1735
+ AI_TOOL_CALL_RESULT: "ai.toolCall.result",
1736
+ AI_TOOL_CALL_ARGS: "ai.toolCall.args",
1737
+ AI_TOOL_CALL_ID: "ai.toolCall.id",
1738
+ AI_TOOL_TYPE: "ai.toolType",
1739
+ TOOL_PURPOSE: "tool.purpose",
1740
+ // Agent attributes
1741
+ AGENT_ID: "agent.id",
1742
+ AGENT_NAME: "agent.name",
1743
+ // Token usage
1744
+ GEN_AI_USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens",
1745
+ GEN_AI_USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens",
1746
+ // Context attributes
1747
+ CONTEXT_URL: "context.url",
1748
+ CONTEXT_CONFIG_ID: "context.context_config_id",
1749
+ CONTEXT_AGENT_GRAPH_ID: "context.agent_graph_id",
1750
+ CONTEXT_HEADERS_KEYS: "context.headers_keys",
1751
+ // Message attributes
1752
+ MESSAGE_CONTENT: "message.content",
1753
+ MESSAGE_TIMESTAMP: "message.timestamp",
1754
+ MCP_TOOL_DESCRIPTION: "mcp.tool.description",
1755
+ // Delegation/Transfer attributes
1756
+ DELEGATION_FROM_SUB_AGENT_ID,
1757
+ DELEGATION_TO_SUB_AGENT_ID,
1758
+ DELEGATION_ID,
1759
+ TRANSFER_FROM_SUB_AGENT_ID,
1760
+ TRANSFER_TO_SUB_AGENT_ID,
1761
+ // HTTP attributes
1762
+ HTTP_URL: "http.url",
1763
+ HTTP_STATUS_CODE: "http.status_code",
1764
+ HTTP_RESPONSE_BODY_SIZE: "http.response.body_size",
1765
+ // Core attributes
1766
+ NAME: "name",
1767
+ PARENT_SPAN_ID: "parentSpanID",
1768
+ CONVERSATION_ID: "conversation.id"
1769
+ };
1770
+ var UNKNOWN_VALUE = "unknown";
1771
+ var ACTIVITY_TYPES = {
1772
+ TOOL_CALL: "tool_call",
1773
+ AI_GENERATION: "ai_generation",
1774
+ AGENT_GENERATION: "agent_generation",
1775
+ CONTEXT_FETCH: "context_fetch",
1776
+ CONTEXT_RESOLUTION: "context_resolution",
1777
+ USER_MESSAGE: "user_message",
1778
+ AI_ASSISTANT_MESSAGE: "ai_assistant_message",
1779
+ AI_MODEL_STREAMED_TEXT: "ai_model_streamed_text"
1780
+ };
1781
+ var ACTIVITY_STATUS = {
1782
+ SUCCESS: "success",
1783
+ ERROR: "error",
1784
+ PENDING: "pending"
1785
+ };
1786
+ var AGENT_IDS = {
1787
+ USER: "user",
1788
+ AI_ASSISTANT: "ai-assistant"
1789
+ };
1790
+ var ACTIVITY_NAMES = {
1791
+ CONTEXT_FETCH: "Context Fetch",
1792
+ USER_MESSAGE: "User Message",
1793
+ AI_ASSISTANT_MESSAGE: "AI Assistant Message",
1794
+ AI_TEXT_GENERATION: "AI Text Generation",
1795
+ AI_STREAMING_TEXT: "AI Streaming Text",
1796
+ UNKNOWN_AGENT: "Unknown Agent",
1797
+ USER: "User"
1798
+ };
1799
+ var TOOL_NAMES = {
1800
+ SAVE_TOOL_RESULT: "save_tool_result"
1801
+ };
1802
+ var AI_TOOL_TYPES = {
1803
+ MCP: "mcp",
1804
+ TRANSFER: "transfer",
1805
+ DELEGATION: "delegation"
1806
+ };
1807
+
1808
+ // src/constants/signoz-queries.ts
1809
+ var DATA_TYPES = {
1810
+ STRING: "string",
1811
+ INT64: "int64",
1812
+ FLOAT64: "float64",
1813
+ BOOL: "bool"
1814
+ };
1815
+ var FIELD_TYPES = {
1816
+ TAG: "tag",
1817
+ RESOURCE: "resource"
1818
+ };
1819
+ var QUERY_FIELD_CONFIGS = {
1820
+ // String tag fields
1821
+ STRING_TAG: {
1822
+ dataType: DATA_TYPES.STRING,
1823
+ type: FIELD_TYPES.TAG,
1824
+ isColumn: false
1825
+ },
1826
+ STRING_TAG_COLUMN: {
1827
+ dataType: DATA_TYPES.STRING,
1828
+ type: FIELD_TYPES.TAG,
1829
+ isColumn: true
1830
+ },
1831
+ // Numeric tag fields
1832
+ INT64_TAG: {
1833
+ dataType: DATA_TYPES.INT64,
1834
+ type: FIELD_TYPES.TAG,
1835
+ isColumn: false
1836
+ },
1837
+ INT64_TAG_COLUMN: {
1838
+ dataType: DATA_TYPES.INT64,
1839
+ type: FIELD_TYPES.TAG,
1840
+ isColumn: true
1841
+ },
1842
+ FLOAT64_TAG: {
1843
+ dataType: DATA_TYPES.FLOAT64,
1844
+ type: FIELD_TYPES.TAG,
1845
+ isColumn: false
1846
+ },
1847
+ FLOAT64_TAG_COLUMN: {
1848
+ dataType: DATA_TYPES.FLOAT64,
1849
+ type: FIELD_TYPES.TAG,
1850
+ isColumn: true
1851
+ },
1852
+ // Boolean tag fields
1853
+ BOOL_TAG: {
1854
+ dataType: DATA_TYPES.BOOL,
1855
+ type: FIELD_TYPES.TAG,
1856
+ isColumn: false
1857
+ },
1858
+ BOOL_TAG_COLUMN: {
1859
+ dataType: DATA_TYPES.BOOL,
1860
+ type: FIELD_TYPES.TAG,
1861
+ isColumn: true
1862
+ }
1863
+ };
1864
+ var OPERATORS = {
1865
+ // Comparison operators
1866
+ EQUALS: "=",
1867
+ NOT_EQUALS: "!=",
1868
+ LESS_THAN: "<",
1869
+ GREATER_THAN: ">",
1870
+ LESS_THAN_OR_EQUAL: "<=",
1871
+ GREATER_THAN_OR_EQUAL: ">=",
1872
+ // String operators
1873
+ LIKE: "like",
1874
+ NOT_LIKE: "nlike",
1875
+ // Existence operators
1876
+ EXISTS: "exists",
1877
+ NOT_EXISTS: "nexists",
1878
+ // Logical operators
1879
+ AND: "AND",
1880
+ OR: "OR"
1881
+ };
1882
+ var QUERY_EXPRESSIONS = {
1883
+ SPAN_NAMES: "spanNames",
1884
+ AGENT_MODEL_CALLS: "agentModelCalls",
1885
+ MODEL_CALLS: "modelCalls",
1886
+ LAST_ACTIVITY: "lastActivity",
1887
+ CONVERSATION_METADATA: "conversationMetadata",
1888
+ FILTERED_CONVERSATIONS: "filteredConversations",
1889
+ TOOLS: "tools",
1890
+ TRANSFERS: "transfers",
1891
+ DELEGATIONS: "delegations",
1892
+ AI_CALLS: "aiCalls",
1893
+ CONTEXT_ERRORS: "contextErrors",
1894
+ AGENT_GENERATION_ERRORS: "agentGenerationErrors",
1895
+ USER_MESSAGES: "userMessages",
1896
+ UNIQUE_GRAPHS: "uniqueGraphs",
1897
+ UNIQUE_MODELS: "uniqueModels",
1898
+ // Route-specific query names
1899
+ TOOL_CALLS: "toolCalls",
1900
+ CONTEXT_RESOLUTION: "contextResolution",
1901
+ CONTEXT_HANDLE: "contextHandle",
1902
+ AI_ASSISTANT_MESSAGES: "aiAssistantMessages",
1903
+ AI_GENERATIONS: "aiGenerations",
1904
+ AI_STREAMING_TEXT: "aiStreamingText",
1905
+ CONTEXT_FETCHERS: "contextFetchers",
1906
+ DURATION_SPANS: "durationSpans",
1907
+ AGENT_GENERATIONS: "agentGenerations",
1908
+ SPANS_WITH_ERRORS: "spansWithErrors"
1909
+ };
1910
+ var REDUCE_OPERATIONS = {
1911
+ SUM: "sum",
1912
+ MAX: "max",
1913
+ MIN: "min",
1914
+ AVG: "avg",
1915
+ COUNT: "count"
1916
+ };
1917
+ var ORDER_DIRECTIONS = {
1918
+ ASC: "asc",
1919
+ DESC: "desc"
1920
+ };
1921
+ var QUERY_TYPES = {
1922
+ BUILDER: "builder",
1923
+ CLICKHOUSE: "clickhouse",
1924
+ PROMQL: "promql"
1925
+ };
1926
+ var PANEL_TYPES = {
1927
+ LIST: "list",
1928
+ TABLE: "table",
1929
+ GRAPH: "graph",
1930
+ VALUE: "value"
1931
+ };
1932
+ var DATA_SOURCES = {
1933
+ TRACES: "traces",
1934
+ METRICS: "metrics",
1935
+ LOGS: "logs"
1936
+ };
1937
+ var AGGREGATE_OPERATORS = {
1938
+ COUNT: "count",
1939
+ SUM: "sum",
1940
+ AVG: "avg",
1941
+ MIN: "min",
1942
+ MAX: "max",
1943
+ NOOP: "noop"
1944
+ };
1945
+ var QUERY_DEFAULTS = {
1946
+ STEP: 60,
1947
+ STEP_INTERVAL: 60,
1948
+ OFFSET: 0,
1949
+ DISABLED: false,
1950
+ HAVING: [],
1951
+ LEGEND: "",
1952
+ LIMIT_NULL: null,
1953
+ LIMIT_ZERO: 0,
1954
+ LIMIT_1000: 1e3,
1955
+ EMPTY_GROUP_BY: []
1956
+ };
1957
+
1635
1958
  // src/client-exports.ts
1636
1959
  var TenantParamsSchema2 = zod.z.object({
1637
1960
  tenantId: zod.z.string()
@@ -1642,7 +1965,7 @@ var TenantProjectParamsSchema2 = TenantParamsSchema2.extend({
1642
1965
  var TenantProjectIdParamsSchema2 = TenantProjectParamsSchema2.extend({
1643
1966
  id: zod.z.string()
1644
1967
  });
1645
- var IdParamsSchema2 = zod.z.object({
1968
+ var IdParamsSchema = zod.z.object({
1646
1969
  id: zod.z.string()
1647
1970
  });
1648
1971
  var PaginationSchema2 = zod.z.object({
@@ -1663,7 +1986,7 @@ var ErrorResponseSchema2 = zod.z.object({
1663
1986
  message: zod.z.string().optional(),
1664
1987
  details: zod.z.unknown().optional()
1665
1988
  });
1666
- var AgentApiInsertSchema2 = zod.z.object({
1989
+ var AgentApiInsertSchema = zod.z.object({
1667
1990
  id: zod.z.string().optional(),
1668
1991
  name: zod.z.string(),
1669
1992
  description: zod.z.string().optional(),
@@ -1739,10 +2062,10 @@ var AgentGraphApiInsertSchema2 = zod.z.object({
1739
2062
  id: zod.z.string().optional(),
1740
2063
  name: zod.z.string(),
1741
2064
  description: zod.z.string().optional(),
1742
- defaultAgentId: zod.z.string().optional()
2065
+ defaultSubAgentId: zod.z.string().optional()
1743
2066
  });
1744
2067
  var FullGraphDefinitionSchema2 = AgentGraphApiInsertSchema2.extend({
1745
- agents: zod.z.record(
2068
+ subAgents: zod.z.record(
1746
2069
  zod.z.string(),
1747
2070
  zod.z.union([
1748
2071
  FullGraphAgentInsertSchema,
@@ -1801,37 +2124,64 @@ function generateIdFromName(name) {
1801
2124
  return name.toLowerCase().replace(/[^a-zA-Z0-9]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, MAX_ID_LENGTH2);
1802
2125
  }
1803
2126
 
1804
- exports.AgentApiInsertSchema = AgentApiInsertSchema2;
2127
+ exports.ACTIVITY_NAMES = ACTIVITY_NAMES;
2128
+ exports.ACTIVITY_STATUS = ACTIVITY_STATUS;
2129
+ exports.ACTIVITY_TYPES = ACTIVITY_TYPES;
2130
+ exports.AGENT_IDS = AGENT_IDS;
2131
+ exports.AGGREGATE_OPERATORS = AGGREGATE_OPERATORS;
2132
+ exports.AI_OPERATIONS = AI_OPERATIONS;
2133
+ exports.AI_TOOL_TYPES = AI_TOOL_TYPES;
2134
+ exports.AgentApiInsertSchema = AgentApiInsertSchema;
1805
2135
  exports.AgentGraphApiInsertSchema = AgentGraphApiInsertSchema2;
1806
- exports.AgentStopWhenSchema = AgentStopWhenSchema;
2136
+ exports.AgentStopWhenSchema = SubAgentStopWhenSchema;
1807
2137
  exports.ApiKeyApiCreationResponseSchema = ApiKeyApiCreationResponseSchema2;
1808
2138
  exports.ApiKeyApiSelectSchema = ApiKeyApiSelectSchema2;
1809
2139
  exports.ArtifactComponentApiInsertSchema = ArtifactComponentApiInsertSchema2;
1810
2140
  exports.ContextConfigApiInsertSchema = ContextConfigApiInsertSchema2;
1811
2141
  exports.CredentialReferenceApiInsertSchema = CredentialReferenceApiInsertSchema2;
1812
2142
  exports.CredentialStoreType = CredentialStoreType;
2143
+ exports.DATA_SOURCES = DATA_SOURCES;
2144
+ exports.DATA_TYPES = DATA_TYPES;
2145
+ exports.DELEGATION_FROM_SUB_AGENT_ID = DELEGATION_FROM_SUB_AGENT_ID;
2146
+ exports.DELEGATION_ID = DELEGATION_ID;
2147
+ exports.DELEGATION_TO_SUB_AGENT_ID = DELEGATION_TO_SUB_AGENT_ID;
1813
2148
  exports.DataComponentApiInsertSchema = DataComponentApiInsertSchema2;
1814
2149
  exports.ErrorResponseSchema = ErrorResponseSchema2;
1815
2150
  exports.ExternalAgentApiInsertSchema = ExternalAgentApiInsertSchema2;
2151
+ exports.FIELD_TYPES = FIELD_TYPES;
1816
2152
  exports.FullGraphDefinitionSchema = FullGraphDefinitionSchema2;
1817
2153
  exports.FunctionApiInsertSchema = FunctionApiInsertSchema;
1818
2154
  exports.FunctionApiSelectSchema = FunctionApiSelectSchema;
1819
2155
  exports.FunctionApiUpdateSchema = FunctionApiUpdateSchema;
1820
2156
  exports.GraphStopWhenSchema = GraphStopWhenSchema;
1821
- exports.IdParamsSchema = IdParamsSchema2;
2157
+ exports.IdParamsSchema = IdParamsSchema;
1822
2158
  exports.ListResponseSchema = ListResponseSchema;
1823
2159
  exports.MAX_ID_LENGTH = MAX_ID_LENGTH2;
1824
2160
  exports.MCPTransportType = MCPTransportType;
1825
2161
  exports.MIN_ID_LENGTH = MIN_ID_LENGTH2;
1826
2162
  exports.ModelSettingsSchema = ModelSettingsSchema;
2163
+ exports.OPERATORS = OPERATORS;
2164
+ exports.ORDER_DIRECTIONS = ORDER_DIRECTIONS;
2165
+ exports.PANEL_TYPES = PANEL_TYPES;
1827
2166
  exports.PaginationSchema = PaginationSchema2;
2167
+ exports.QUERY_DEFAULTS = QUERY_DEFAULTS;
2168
+ exports.QUERY_EXPRESSIONS = QUERY_EXPRESSIONS;
2169
+ exports.QUERY_FIELD_CONFIGS = QUERY_FIELD_CONFIGS;
2170
+ exports.QUERY_TYPES = QUERY_TYPES;
2171
+ exports.REDUCE_OPERATIONS = REDUCE_OPERATIONS;
2172
+ exports.SPAN_KEYS = SPAN_KEYS;
2173
+ exports.SPAN_NAMES = SPAN_NAMES;
1828
2174
  exports.SandboxConfigSchema = SandboxConfigSchema;
1829
2175
  exports.SingleResponseSchema = SingleResponseSchema;
1830
2176
  exports.StopWhenSchema = StopWhenSchema;
2177
+ exports.TOOL_NAMES = TOOL_NAMES;
2178
+ exports.TRANSFER_FROM_SUB_AGENT_ID = TRANSFER_FROM_SUB_AGENT_ID;
2179
+ exports.TRANSFER_TO_SUB_AGENT_ID = TRANSFER_TO_SUB_AGENT_ID;
1831
2180
  exports.TenantParamsSchema = TenantParamsSchema2;
1832
2181
  exports.TenantProjectIdParamsSchema = TenantProjectIdParamsSchema2;
1833
2182
  exports.TenantProjectParamsSchema = TenantProjectParamsSchema2;
1834
2183
  exports.ToolApiInsertSchema = ToolApiInsertSchema2;
2184
+ exports.UNKNOWN_VALUE = UNKNOWN_VALUE;
1835
2185
  exports.URL_SAFE_ID_PATTERN = URL_SAFE_ID_PATTERN2;
1836
2186
  exports.generateIdFromName = generateIdFromName;
1837
2187
  exports.resourceIdSchema = resourceIdSchema2;