@inkeep/agents-core 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +2 -2
  2. package/dist/{chunk-TO2HNKGP.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 +1664 -1544
  16. package/dist/index.d.ts +1664 -1544
  17. package/dist/index.js +1953 -1467
  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-L53XWAYG.js +0 -134
package/README.md CHANGED
@@ -35,7 +35,7 @@ All data access functions follow a consistent functional pattern with dependency
35
35
  export const getAgentById = (db: DatabaseClient) => async (params: {
36
36
  tenantId: string;
37
37
  projectId: string;
38
- agentId: string;
38
+ subAgentId: string;
39
39
  }) => {
40
40
  // Implementation
41
41
  };
@@ -76,7 +76,7 @@ const getAgent = getAgentById(db);
76
76
  const agent = await getAgent({
77
77
  tenantId: 'tenant-1',
78
78
  projectId: 'project-1',
79
- agentId: 'agent-1'
79
+ subAgentId: 'agent-1'
80
80
  });
81
81
  ```
82
82
 
@@ -1,4 +1,4 @@
1
- import { agents, agentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, externalAgents, apiKeys, credentialReferences, functions, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-VPJ6Z5QZ.js';
1
+ import { subAgents, subAgentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, subAgentDataComponents, artifactComponents, subAgentArtifactComponents, externalAgents, apiKeys, credentialReferences, functionTools, functions, contextConfigs, subAgentToolRelations, ledgerArtifacts, projects } from './chunk-ID4CFGVF.js';
2
2
  import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-YFHT5M2R.js';
3
3
  import { z } from '@hono/zod-openapi';
4
4
  import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
@@ -9,7 +9,7 @@ var StopWhenSchema = z.object({
9
9
  stepCountIs: z.number().min(1).max(1e3).optional()
10
10
  });
11
11
  var GraphStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true });
12
- var AgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true });
12
+ var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true });
13
13
  var MIN_ID_LENGTH = 1;
14
14
  var MAX_ID_LENGTH = 255;
15
15
  var URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
@@ -52,71 +52,73 @@ var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId:
52
52
  var createGraphScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
53
53
  var createGraphScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
54
54
  var createGraphScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true }).partial();
55
- var AgentSelectSchema = createSelectSchema(agents);
56
- var AgentInsertSchema = createInsertSchema(agents).extend({
55
+ var SubAgentSelectSchema = createSelectSchema(subAgents);
56
+ var SubAgentInsertSchema = createInsertSchema(subAgents).extend({
57
57
  id: resourceIdSchema,
58
58
  models: ModelSchema.optional()
59
59
  });
60
- var AgentUpdateSchema = AgentInsertSchema.partial();
61
- var AgentApiSelectSchema = createGraphScopedApiSchema(AgentSelectSchema);
62
- var AgentApiInsertSchema = createGraphScopedApiInsertSchema(AgentInsertSchema);
63
- var AgentApiUpdateSchema = createGraphScopedApiUpdateSchema(AgentUpdateSchema);
64
- var AgentRelationSelectSchema = createSelectSchema(agentRelations);
65
- var AgentRelationInsertSchema = createInsertSchema(agentRelations).extend({
60
+ var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
61
+ var SubAgentApiSelectSchema = createGraphScopedApiSchema(SubAgentSelectSchema);
62
+ var SubAgentApiInsertSchema = createGraphScopedApiInsertSchema(SubAgentInsertSchema);
63
+ var SubAgentApiUpdateSchema = createGraphScopedApiUpdateSchema(SubAgentUpdateSchema);
64
+ var SubAgentRelationSelectSchema = createSelectSchema(subAgentRelations);
65
+ var SubAgentRelationInsertSchema = createInsertSchema(subAgentRelations).extend({
66
66
  id: resourceIdSchema,
67
67
  graphId: resourceIdSchema,
68
- sourceAgentId: resourceIdSchema,
69
- targetAgentId: resourceIdSchema.optional(),
70
- externalAgentId: resourceIdSchema.optional()
71
- });
72
- var AgentRelationUpdateSchema = AgentRelationInsertSchema.partial();
73
- var AgentRelationApiSelectSchema = createGraphScopedApiSchema(AgentRelationSelectSchema);
74
- var AgentRelationApiInsertSchema = createGraphScopedApiInsertSchema(
75
- AgentRelationInsertSchema
68
+ sourceSubAgentId: resourceIdSchema,
69
+ targetSubAgentId: resourceIdSchema.optional(),
70
+ externalSubAgentId: resourceIdSchema.optional()
71
+ });
72
+ var SubAgentRelationUpdateSchema = SubAgentRelationInsertSchema.partial();
73
+ var SubAgentRelationApiSelectSchema = createGraphScopedApiSchema(
74
+ SubAgentRelationSelectSchema
75
+ );
76
+ var SubAgentRelationApiInsertSchema = createGraphScopedApiInsertSchema(
77
+ SubAgentRelationInsertSchema
76
78
  ).extend({
77
79
  relationType: z.enum(VALID_RELATION_TYPES)
78
80
  }).refine(
79
81
  (data) => {
80
- const hasTarget = data.targetAgentId != null;
81
- const hasExternal = data.externalAgentId != null;
82
+ const hasTarget = data.targetSubAgentId != null;
83
+ const hasExternal = data.externalSubAgentId != null;
82
84
  return hasTarget !== hasExternal;
83
85
  },
84
86
  {
85
- message: "Must specify exactly one of targetAgentId or externalAgentId",
86
- path: ["targetAgentId", "externalAgentId"]
87
+ message: "Must specify exactly one of targetSubAgentId or externalSubAgentId",
88
+ path: ["targetSubAgentId", "externalSubAgentId"]
87
89
  }
88
90
  );
89
- var AgentRelationApiUpdateSchema = createGraphScopedApiUpdateSchema(
90
- AgentRelationUpdateSchema
91
+ var SubAgentRelationApiUpdateSchema = createGraphScopedApiUpdateSchema(
92
+ SubAgentRelationUpdateSchema
91
93
  ).extend({
92
94
  relationType: z.enum(VALID_RELATION_TYPES).optional()
93
95
  }).refine(
94
96
  (data) => {
95
- const hasTarget = data.targetAgentId != null;
96
- const hasExternal = data.externalAgentId != null;
97
+ const hasTarget = data.targetSubAgentId != null;
98
+ const hasExternal = data.externalSubAgentId != null;
97
99
  if (!hasTarget && !hasExternal) {
98
100
  return true;
99
101
  }
100
102
  return hasTarget !== hasExternal;
101
103
  },
102
104
  {
103
- message: "Must specify exactly one of targetAgentId or externalAgentId when updating agent relationships",
104
- path: ["targetAgentId", "externalAgentId"]
105
+ message: "Must specify exactly one of targetSubAgentId or externalSubAgentId when updating sub-agent relationships",
106
+ path: ["targetSubAgentId", "externalSubAgentId"]
105
107
  }
106
108
  );
107
- var AgentRelationQuerySchema = z.object({
108
- sourceAgentId: z.string().optional(),
109
- targetAgentId: z.string().optional(),
110
- externalAgentId: z.string().optional()
109
+ var SubAgentRelationQuerySchema = z.object({
110
+ sourceSubAgentId: z.string().optional(),
111
+ targetSubAgentId: z.string().optional(),
112
+ externalSubAgentId: z.string().optional()
111
113
  });
112
- var ExternalAgentRelationInsertSchema = createInsertSchema(agentRelations).extend({
114
+ var ExternalSubAgentRelationInsertSchema = createInsertSchema(subAgentRelations).extend({
113
115
  id: resourceIdSchema,
114
116
  graphId: resourceIdSchema,
115
- sourceAgentId: resourceIdSchema,
116
- externalAgentId: resourceIdSchema
117
+ sourceSubAgentId: resourceIdSchema,
118
+ externalSubAgentId: resourceIdSchema
117
119
  });
118
- var ExternalAgentRelationApiInsertSchema = createApiInsertSchema(
119
- ExternalAgentRelationInsertSchema
120
+ var ExternalSubAgentRelationApiInsertSchema = createApiInsertSchema(
121
+ ExternalSubAgentRelationInsertSchema
120
122
  );
121
123
  var AgentGraphSelectSchema = createSelectSchema(agentGraph);
122
124
  var AgentGraphInsertSchema = createInsertSchema(agentGraph).extend({
@@ -183,32 +185,22 @@ var ToolSelectSchema = createSelectSchema(tools);
183
185
  var ToolInsertSchema = createInsertSchema(tools).extend({
184
186
  id: resourceIdSchema,
185
187
  imageUrl: imageUrlSchema,
186
- functionId: resourceIdSchema.optional(),
187
- // For function tools, reference to global functions table
188
- config: z.discriminatedUnion("type", [
189
- // MCP tools
190
- z.object({
191
- type: z.literal("mcp"),
192
- mcp: z.object({
193
- server: z.object({
194
- url: z.string().url()
195
- }),
196
- transport: z.object({
197
- type: z.enum(MCPTransportType),
198
- requestInit: z.record(z.string(), z.unknown()).optional(),
199
- eventSourceInit: z.record(z.string(), z.unknown()).optional(),
200
- reconnectionOptions: z.custom().optional(),
201
- sessionId: z.string().optional()
202
- }).optional(),
203
- activeTools: z.array(z.string()).optional()
204
- })
205
- }),
206
- // Function tools (reference-only, no inline duplication)
207
- z.object({
208
- type: z.literal("function")
209
- // No inline function details - they're in the functions table via functionId
188
+ config: z.object({
189
+ type: z.literal("mcp"),
190
+ mcp: z.object({
191
+ server: z.object({
192
+ url: z.string().url()
193
+ }),
194
+ transport: z.object({
195
+ type: z.enum(MCPTransportType),
196
+ requestInit: z.record(z.string(), z.unknown()).optional(),
197
+ eventSourceInit: z.record(z.string(), z.unknown()).optional(),
198
+ reconnectionOptions: z.custom().optional(),
199
+ sessionId: z.string().optional()
200
+ }).optional(),
201
+ activeTools: z.array(z.string()).optional()
210
202
  })
211
- ])
203
+ })
212
204
  });
213
205
  var ConversationSelectSchema = createSelectSchema(conversations);
214
206
  var ConversationInsertSchema = createInsertSchema(conversations).extend({
@@ -247,20 +239,20 @@ var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
247
239
  var DataComponentApiSelectSchema = createApiSchema(DataComponentSelectSchema);
248
240
  var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema);
249
241
  var DataComponentApiUpdateSchema = createApiUpdateSchema(DataComponentUpdateSchema);
250
- var AgentDataComponentSelectSchema = createSelectSchema(agentDataComponents);
251
- var AgentDataComponentInsertSchema = createInsertSchema(agentDataComponents);
252
- var AgentDataComponentUpdateSchema = AgentDataComponentInsertSchema.partial();
253
- var AgentDataComponentApiSelectSchema = createGraphScopedApiSchema(
254
- AgentDataComponentSelectSchema
242
+ var SubAgentDataComponentSelectSchema = createSelectSchema(subAgentDataComponents);
243
+ var SubAgentDataComponentInsertSchema = createInsertSchema(subAgentDataComponents);
244
+ var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
245
+ var SubAgentDataComponentApiSelectSchema = createGraphScopedApiSchema(
246
+ SubAgentDataComponentSelectSchema
255
247
  );
256
- var AgentDataComponentApiInsertSchema = AgentDataComponentInsertSchema.omit({
248
+ var SubAgentDataComponentApiInsertSchema = SubAgentDataComponentInsertSchema.omit({
257
249
  tenantId: true,
258
250
  projectId: true,
259
251
  id: true,
260
252
  createdAt: true
261
253
  });
262
- var AgentDataComponentApiUpdateSchema = createGraphScopedApiUpdateSchema(
263
- AgentDataComponentUpdateSchema
254
+ var SubAgentDataComponentApiUpdateSchema = createGraphScopedApiUpdateSchema(
255
+ SubAgentDataComponentUpdateSchema
264
256
  );
265
257
  var ArtifactComponentSelectSchema = createSelectSchema(artifactComponents);
266
258
  var ArtifactComponentInsertSchema = createInsertSchema(artifactComponents).extend({
@@ -277,26 +269,26 @@ var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
277
269
  var ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
278
270
  ArtifactComponentUpdateSchema
279
271
  );
280
- var AgentArtifactComponentSelectSchema = createSelectSchema(agentArtifactComponents);
281
- var AgentArtifactComponentInsertSchema = createInsertSchema(
282
- agentArtifactComponents
272
+ var SubAgentArtifactComponentSelectSchema = createSelectSchema(subAgentArtifactComponents);
273
+ var SubAgentArtifactComponentInsertSchema = createInsertSchema(
274
+ subAgentArtifactComponents
283
275
  ).extend({
284
276
  id: resourceIdSchema,
285
- agentId: resourceIdSchema,
277
+ subAgentId: resourceIdSchema,
286
278
  artifactComponentId: resourceIdSchema
287
279
  });
288
- var AgentArtifactComponentUpdateSchema = AgentArtifactComponentInsertSchema.partial();
289
- var AgentArtifactComponentApiSelectSchema = createGraphScopedApiSchema(
290
- AgentArtifactComponentSelectSchema
280
+ var SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentInsertSchema.partial();
281
+ var SubAgentArtifactComponentApiSelectSchema = createGraphScopedApiSchema(
282
+ SubAgentArtifactComponentSelectSchema
291
283
  );
292
- var AgentArtifactComponentApiInsertSchema = AgentArtifactComponentInsertSchema.omit({
284
+ var SubAgentArtifactComponentApiInsertSchema = SubAgentArtifactComponentInsertSchema.omit({
293
285
  tenantId: true,
294
286
  projectId: true,
295
287
  id: true,
296
288
  createdAt: true
297
289
  });
298
- var AgentArtifactComponentApiUpdateSchema = createGraphScopedApiUpdateSchema(
299
- AgentArtifactComponentUpdateSchema
290
+ var SubAgentArtifactComponentApiUpdateSchema = createGraphScopedApiUpdateSchema(
291
+ SubAgentArtifactComponentUpdateSchema
300
292
  );
301
293
  var ExternalAgentSelectSchema = createSelectSchema(externalAgents).extend({
302
294
  credentialReferenceId: z.string().nullable().optional(),
@@ -310,7 +302,7 @@ var ExternalAgentApiSelectSchema = createGraphScopedApiSchema(ExternalAgentSelec
310
302
  var ExternalAgentApiInsertSchema = createGraphScopedApiInsertSchema(ExternalAgentInsertSchema);
311
303
  var ExternalAgentApiUpdateSchema = createGraphScopedApiUpdateSchema(ExternalAgentUpdateSchema);
312
304
  var AllAgentSchema = z.discriminatedUnion("type", [
313
- AgentApiSelectSchema.extend({ type: z.literal("internal") }),
305
+ SubAgentApiSelectSchema.extend({ type: z.literal("internal") }),
314
306
  ExternalAgentApiSelectSchema.extend({ type: z.literal("external") })
315
307
  ]);
316
308
  var ApiKeySelectSchema = createSelectSchema(apiKeys);
@@ -418,6 +410,14 @@ var ToolUpdateSchema = ToolInsertSchema.partial();
418
410
  var ToolApiSelectSchema = createApiSchema(ToolSelectSchema);
419
411
  var ToolApiInsertSchema = createApiInsertSchema(ToolInsertSchema);
420
412
  var ToolApiUpdateSchema = createApiUpdateSchema(ToolUpdateSchema);
413
+ var FunctionToolSelectSchema = createSelectSchema(functionTools);
414
+ var FunctionToolInsertSchema = createInsertSchema(functionTools).extend({
415
+ id: resourceIdSchema
416
+ });
417
+ var FunctionToolUpdateSchema = FunctionToolInsertSchema.partial();
418
+ var FunctionToolApiSelectSchema = createApiSchema(FunctionToolSelectSchema);
419
+ var FunctionToolApiInsertSchema = createGraphScopedApiInsertSchema(FunctionToolInsertSchema);
420
+ var FunctionToolApiUpdateSchema = createApiUpdateSchema(FunctionToolUpdateSchema);
421
421
  var FunctionSelectSchema = createSelectSchema(functions);
422
422
  var FunctionInsertSchema = createInsertSchema(functions).extend({
423
423
  id: resourceIdSchema
@@ -465,23 +465,23 @@ var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSche
465
465
  var ContextConfigApiUpdateSchema = createApiUpdateSchema(ContextConfigUpdateSchema).omit({
466
466
  graphId: true
467
467
  });
468
- var AgentToolRelationSelectSchema = createSelectSchema(agentToolRelations);
469
- var AgentToolRelationInsertSchema = createInsertSchema(agentToolRelations).extend({
468
+ var SubAgentToolRelationSelectSchema = createSelectSchema(subAgentToolRelations);
469
+ var SubAgentToolRelationInsertSchema = createInsertSchema(subAgentToolRelations).extend({
470
470
  id: resourceIdSchema,
471
- agentId: resourceIdSchema,
471
+ subAgentId: resourceIdSchema,
472
472
  toolId: resourceIdSchema,
473
473
  selectedTools: z.array(z.string()).nullish(),
474
474
  headers: z.record(z.string(), z.string()).nullish()
475
475
  });
476
- var AgentToolRelationUpdateSchema = AgentToolRelationInsertSchema.partial();
477
- var AgentToolRelationApiSelectSchema = createGraphScopedApiSchema(
478
- AgentToolRelationSelectSchema
476
+ var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
477
+ var SubAgentToolRelationApiSelectSchema = createGraphScopedApiSchema(
478
+ SubAgentToolRelationSelectSchema
479
479
  );
480
- var AgentToolRelationApiInsertSchema = createGraphScopedApiInsertSchema(
481
- AgentToolRelationInsertSchema
480
+ var SubAgentToolRelationApiInsertSchema = createGraphScopedApiInsertSchema(
481
+ SubAgentToolRelationInsertSchema
482
482
  );
483
- var AgentToolRelationApiUpdateSchema = createGraphScopedApiUpdateSchema(
484
- AgentToolRelationUpdateSchema
483
+ var SubAgentToolRelationApiUpdateSchema = createGraphScopedApiUpdateSchema(
484
+ SubAgentToolRelationUpdateSchema
485
485
  );
486
486
  var LedgerArtifactSelectSchema = createSelectSchema(ledgerArtifacts);
487
487
  var LedgerArtifactInsertSchema = createInsertSchema(ledgerArtifacts);
@@ -511,7 +511,7 @@ var CanUseItemSchema = z.object({
511
511
  toolSelection: z.array(z.string()).nullish(),
512
512
  headers: z.record(z.string(), z.string()).nullish()
513
513
  });
514
- var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
514
+ var FullGraphAgentInsertSchema = SubAgentApiInsertSchema.extend({
515
515
  type: z.literal("internal"),
516
516
  canUse: z.array(CanUseItemSchema),
517
517
  // All tools (both MCP and function tools)
@@ -521,10 +521,15 @@ var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
521
521
  canDelegateTo: z.array(z.string()).optional()
522
522
  });
523
523
  var FullGraphDefinitionSchema = AgentGraphApiInsertSchema.extend({
524
- agents: z.record(z.string(), z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])),
524
+ subAgents: z.record(
525
+ z.string(),
526
+ z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])
527
+ ),
525
528
  // Lookup maps for UI to resolve canUse items
526
529
  tools: z.record(z.string(), ToolApiInsertSchema).optional(),
527
- // Get tool name/description from toolId
530
+ // MCP tools (project-scoped)
531
+ functionTools: z.record(z.string(), FunctionToolApiInsertSchema).optional(),
532
+ // Function tools (graph-scoped)
528
533
  functions: z.record(z.string(), FunctionApiInsertSchema).optional(),
529
534
  // Get function code for function tools
530
535
  contextConfig: z.optional(ContextConfigApiInsertSchema),
@@ -534,13 +539,20 @@ var FullGraphDefinitionSchema = AgentGraphApiInsertSchema.extend({
534
539
  graphPrompt: z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
535
540
  });
536
541
  var GraphWithinContextOfProjectSchema = AgentGraphApiInsertSchema.extend({
537
- agents: z.record(
542
+ subAgents: z.record(
538
543
  z.string(),
539
544
  z.discriminatedUnion("type", [
540
545
  FullGraphAgentInsertSchema,
541
546
  ExternalAgentApiInsertSchema.extend({ type: z.literal("external") })
542
547
  ])
543
548
  ),
549
+ // Lookup maps for UI to resolve canUse items
550
+ tools: z.record(z.string(), ToolApiInsertSchema).optional(),
551
+ // MCP tools (project-scoped)
552
+ functionTools: z.record(z.string(), FunctionToolApiInsertSchema).optional(),
553
+ // Function tools (graph-scoped)
554
+ functions: z.record(z.string(), FunctionApiInsertSchema).optional(),
555
+ // Get function code for function tools
544
556
  contextConfig: z.optional(ContextConfigApiInsertSchema),
545
557
  statusUpdates: z.optional(StatusUpdateSchema),
546
558
  models: ModelSchema.optional(),
@@ -588,9 +600,9 @@ var ProjectApiUpdateSchema = ProjectUpdateSchema.omit({ tenantId: true });
588
600
  var FullProjectDefinitionSchema = ProjectApiInsertSchema.extend({
589
601
  graphs: z.record(z.string(), GraphWithinContextOfProjectSchema),
590
602
  tools: z.record(z.string(), ToolApiInsertSchema),
591
- // Now includes both MCP and function tools
603
+ // MCP tools (project-scoped)
592
604
  functions: z.record(z.string(), FunctionApiInsertSchema).optional(),
593
- // Global functions
605
+ // Functions (project-scoped)
594
606
  dataComponents: z.record(z.string(), DataComponentApiInsertSchema).optional(),
595
607
  artifactComponents: z.record(z.string(), ArtifactComponentApiInsertSchema).optional(),
596
608
  statusUpdates: z.optional(StatusUpdateSchema),
@@ -612,72 +624,46 @@ var HeadersScopeSchema = z.object({
612
624
  example: "graph_789"
613
625
  })
614
626
  });
627
+ var TenantId = z.string().openapi({
628
+ description: "Tenant identifier",
629
+ example: "tenant_123"
630
+ });
631
+ var ProjectId = z.string().openapi({
632
+ description: "Project identifier",
633
+ example: "project_456"
634
+ });
635
+ var GraphId = z.string().openapi({
636
+ description: "Graph identifier",
637
+ example: "graph_789"
638
+ });
639
+ var SubAgentId = z.string().openapi({
640
+ description: "Sub-agent identifier",
641
+ example: "sub_agent_123"
642
+ });
615
643
  var TenantParamsSchema = z.object({
616
- tenantId: z.string().openapi({
617
- description: "Tenant identifier",
618
- example: "tenant_123"
619
- })
644
+ tenantId: TenantId
620
645
  }).openapi("TenantParams");
621
- var TenantProjectParamsSchema = z.object({
622
- tenantId: z.string().openapi({
623
- description: "Tenant identifier",
624
- example: "tenant_123"
625
- }),
626
- projectId: z.string().openapi({
627
- description: "Project identifier",
628
- example: "project_456"
629
- })
630
- }).openapi("TenantProjectParams");
631
- var TenantProjectGraphParamsSchema = z.object({
632
- tenantId: z.string().openapi({
633
- description: "Tenant identifier",
634
- example: "tenant_123"
635
- }),
636
- projectId: z.string().openapi({
637
- description: "Project identifier",
638
- example: "project_456"
639
- }),
640
- graphId: z.string().openapi({
641
- description: "Graph identifier",
642
- example: "graph_789"
643
- })
644
- }).openapi("TenantProjectGraphParams");
645
- var TenantProjectGraphIdParamsSchema = z.object({
646
- tenantId: z.string().openapi({
647
- description: "Tenant identifier",
648
- example: "tenant_123"
649
- }),
650
- projectId: z.string().openapi({
651
- description: "Project identifier",
652
- example: "project_456"
653
- }),
654
- graphId: z.string().openapi({
655
- description: "Graph identifier",
656
- example: "graph_789"
657
- }),
646
+ var TenantIdParamsSchema = TenantParamsSchema.extend({
658
647
  id: resourceIdSchema
659
- }).openapi("TenantProjectGraphIdParams");
660
- var TenantProjectIdParamsSchema = z.object({
661
- tenantId: z.string().openapi({
662
- description: "Tenant identifier",
663
- example: "tenant_123"
664
- }),
665
- projectId: z.string().openapi({
666
- description: "Project identifier",
667
- example: "project_456"
668
- }),
648
+ }).openapi("TenantIdParams");
649
+ var TenantProjectParamsSchema = TenantParamsSchema.extend({
650
+ projectId: ProjectId
651
+ }).openapi("TenantProjectParams");
652
+ var TenantProjectIdParamsSchema = TenantProjectParamsSchema.extend({
669
653
  id: resourceIdSchema
670
654
  }).openapi("TenantProjectIdParams");
671
- var TenantIdParamsSchema = z.object({
672
- tenantId: z.string().openapi({
673
- description: "Tenant identifier",
674
- example: "tenant_123"
675
- }),
655
+ var TenantProjectGraphParamsSchema = TenantProjectParamsSchema.extend({
656
+ graphId: GraphId
657
+ }).openapi("TenantProjectGraphParams");
658
+ var TenantProjectGraphIdParamsSchema = TenantProjectGraphParamsSchema.extend({
676
659
  id: resourceIdSchema
677
- }).openapi("TenantIdParams");
678
- var IdParamsSchema = z.object({
660
+ }).openapi("TenantProjectGraphIdParams");
661
+ var TenantProjectGraphSubAgentParamsSchema = TenantProjectGraphParamsSchema.extend({
662
+ subAgentId: SubAgentId
663
+ }).openapi("TenantProjectGraphSubAgentParams");
664
+ var TenantProjectGraphSubAgentIdParamsSchema = TenantProjectGraphSubAgentParamsSchema.extend({
679
665
  id: resourceIdSchema
680
- }).openapi("IdParams");
666
+ }).openapi("TenantProjectGraphSubAgentIdParams");
681
667
  var PaginationQueryParamsSchema = z.object({
682
668
  page: z.coerce.number().min(1).default(1),
683
669
  limit: z.coerce.number().min(1).max(100).default(10)
@@ -785,4 +771,4 @@ function validatePropsAsJsonSchema(props) {
785
771
  }
786
772
  }
787
773
 
788
- export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, FunctionInsertSchema, FunctionSelectSchema, FunctionToolConfigSchema, FunctionUpdateSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SandboxConfigSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema, validatePropsAsJsonSchema };
774
+ export { AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, ExternalSubAgentRelationApiInsertSchema, ExternalSubAgentRelationInsertSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, FunctionInsertSchema, FunctionSelectSchema, FunctionToolApiInsertSchema, FunctionToolApiSelectSchema, FunctionToolApiUpdateSchema, FunctionToolConfigSchema, FunctionToolInsertSchema, FunctionToolSelectSchema, FunctionToolUpdateSchema, FunctionUpdateSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, HeadersScopeSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SandboxConfigSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, SubAgentApiInsertSchema, SubAgentApiSelectSchema, SubAgentApiUpdateSchema, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, SubAgentArtifactComponentApiUpdateSchema, SubAgentArtifactComponentInsertSchema, SubAgentArtifactComponentSelectSchema, SubAgentArtifactComponentUpdateSchema, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, SubAgentDataComponentApiUpdateSchema, SubAgentDataComponentInsertSchema, SubAgentDataComponentSelectSchema, SubAgentDataComponentUpdateSchema, SubAgentInsertSchema, SubAgentRelationApiInsertSchema, SubAgentRelationApiSelectSchema, SubAgentRelationApiUpdateSchema, SubAgentRelationInsertSchema, SubAgentRelationQuerySchema, SubAgentRelationSelectSchema, SubAgentRelationUpdateSchema, SubAgentSelectSchema, SubAgentStopWhenSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationSelectSchema, SubAgentToolRelationUpdateSchema, SubAgentUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectGraphSubAgentIdParamsSchema, TenantProjectGraphSubAgentParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema, validatePropsAsJsonSchema };