@inkeep/agents-core 0.18.1 → 0.19.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 (42) hide show
  1. package/README.md +4 -4
  2. package/dist/{chunk-E4SFK6AI.js → chunk-3GZBRBXP.js} +84 -87
  3. package/dist/{chunk-JTHQYGCX.js → chunk-3XUV5Q4D.js} +34 -34
  4. package/dist/{chunk-ID4CFGVF.js → chunk-B6F3RF4T.js} +87 -120
  5. package/dist/chunk-E6R6PML7.js +19 -0
  6. package/dist/chunk-HYS7HUYJ.js +27 -0
  7. package/dist/{chunk-H6PMWHNV.js → chunk-SLL6V3AE.js} +12 -12
  8. package/dist/{chunk-R2EERZSW.js → chunk-YECQCT5N.js} +1 -1
  9. package/dist/client-exports.cjs +189 -225
  10. package/dist/client-exports.d.cts +13 -14
  11. package/dist/client-exports.d.ts +13 -14
  12. package/dist/client-exports.js +10 -10
  13. package/dist/constants/models.cjs +31 -0
  14. package/dist/constants/models.d.cts +33 -0
  15. package/dist/constants/models.d.ts +33 -0
  16. package/dist/constants/models.js +1 -0
  17. package/dist/db/schema.cjs +85 -118
  18. package/dist/db/schema.d.cts +2 -3
  19. package/dist/db/schema.d.ts +2 -3
  20. package/dist/db/schema.js +1 -1
  21. package/dist/index.cjs +213931 -1040
  22. package/dist/index.d.cts +209 -208
  23. package/dist/index.d.ts +209 -208
  24. package/dist/index.js +213657 -767
  25. package/dist/{schema-ULFEZCOL.d.cts → schema-Dp-qgdBT.d.ts} +54 -52
  26. package/dist/{schema-wbZXiVWb.d.ts → schema-DrDaCn6H.d.cts} +54 -52
  27. package/dist/{signoz-queries-BuiipZTk.d.cts → signoz-queries-CuWMQh1H.d.cts} +10 -10
  28. package/dist/{signoz-queries-BuiipZTk.d.ts → signoz-queries-CuWMQh1H.d.ts} +10 -10
  29. package/dist/types/index.d.cts +2 -3
  30. package/dist/types/index.d.ts +2 -3
  31. package/dist/{utility-CyPQ1tC_.d.cts → utility-BxbySenH.d.cts} +152 -301
  32. package/dist/{utility-CyPQ1tC_.d.ts → utility-BxbySenH.d.ts} +152 -301
  33. package/dist/utils/schema-conversion.js +1 -1
  34. package/dist/validation/index.cjs +212 -249
  35. package/dist/validation/index.d.cts +12 -13
  36. package/dist/validation/index.d.ts +12 -13
  37. package/dist/validation/index.js +2 -2
  38. package/drizzle/0007_mighty_typhoid_mary.sql +227 -0
  39. package/drizzle/meta/0007_snapshot.json +2766 -0
  40. package/drizzle/meta/_journal.json +7 -0
  41. package/package.json +6 -1
  42. package/dist/chunk-MKBO26DX.js +0 -9
@@ -37,12 +37,12 @@ var projectScoped = {
37
37
  ...tenantScoped,
38
38
  projectId: sqliteCore.text("project_id").notNull()
39
39
  };
40
- var graphScoped = {
40
+ var agentScoped = {
41
41
  ...projectScoped,
42
- graphId: sqliteCore.text("graph_id").notNull()
42
+ agentId: sqliteCore.text("agent_id").notNull()
43
43
  };
44
44
  var subAgentScoped = {
45
- ...graphScoped,
45
+ ...agentScoped,
46
46
  subAgentId: sqliteCore.text("sub_agent_id").notNull()
47
47
  };
48
48
  var uiProperties = {
@@ -58,9 +58,9 @@ var projects = sqliteCore.sqliteTable(
58
58
  {
59
59
  ...tenantScoped,
60
60
  ...uiProperties,
61
- // Project-level default model settings that can be inherited by graphs and agents
61
+ // Project-level default model settings that can be inherited by agents
62
62
  models: sqliteCore.text("models", { mode: "json" }).$type(),
63
- // Project-level stopWhen configuration that can be inherited by graphs and agents
63
+ // Project-level stopWhen configuration that can be inherited by agents
64
64
  stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
65
65
  // Project-level sandbox configuration for function execution
66
66
  sandboxConfig: sqliteCore.text("sandbox_config", { mode: "json" }).$type(),
@@ -68,23 +68,17 @@ var projects = sqliteCore.sqliteTable(
68
68
  },
69
69
  (table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.id] })]
70
70
  );
71
- var agentGraph = sqliteCore.sqliteTable(
72
- "agent_graph",
71
+ var agents = sqliteCore.sqliteTable(
72
+ "agent",
73
73
  {
74
74
  ...projectScoped,
75
75
  name: sqliteCore.text("name").notNull(),
76
76
  description: sqliteCore.text("description"),
77
77
  defaultSubAgentId: sqliteCore.text("default_sub_agent_id"),
78
- // Reference to shared context configuration for all agents in this graph
79
78
  contextConfigId: sqliteCore.text("context_config_id"),
80
- // add fk relationship
81
- // Graph-level model settingsuration that can be inherited by agents
82
79
  models: sqliteCore.text("models", { mode: "json" }).$type(),
83
- // Status updates configuration for intelligent progress summaries
84
80
  statusUpdates: sqliteCore.text("status_updates", { mode: "json" }).$type(),
85
- // Graph-level prompt that can be used as additional context for agents
86
- graphPrompt: sqliteCore.text("graph_prompt"),
87
- // Graph-level stopWhen configuration that can be inherited by agents
81
+ prompt: sqliteCore.text("prompt"),
88
82
  stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
89
83
  ...timestamps
90
84
  },
@@ -93,27 +87,26 @@ var agentGraph = sqliteCore.sqliteTable(
93
87
  sqliteCore.foreignKey({
94
88
  columns: [table.tenantId, table.projectId],
95
89
  foreignColumns: [projects.tenantId, projects.id],
96
- name: "agent_graph_project_fk"
90
+ name: "agent_project_fk"
97
91
  }).onDelete("cascade")
98
92
  ]
99
93
  );
100
94
  var contextConfigs = sqliteCore.sqliteTable(
101
95
  "context_configs",
102
96
  {
103
- ...graphScoped,
97
+ ...agentScoped,
104
98
  // Developer-defined Zod schema for validating incoming request context
105
99
  headersSchema: sqliteCore.blob("headers_schema", { mode: "json" }).$type(),
106
- // Stores serialized Zod schema
107
100
  // Object mapping template keys to fetch definitions that use request context data
108
101
  contextVariables: sqliteCore.blob("context_variables", { mode: "json" }).$type(),
109
102
  ...timestamps
110
103
  },
111
104
  (table) => [
112
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
105
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
113
106
  sqliteCore.foreignKey({
114
- columns: [table.tenantId, table.projectId, table.graphId],
115
- foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
116
- name: "context_configs_graph_fk"
107
+ columns: [table.tenantId, table.projectId, table.agentId],
108
+ foreignColumns: [agents.tenantId, agents.projectId, agents.id],
109
+ name: "context_configs_agent_fk"
117
110
  }).onDelete("cascade")
118
111
  ]
119
112
  );
@@ -126,16 +119,12 @@ var contextCache = sqliteCore.sqliteTable(
126
119
  // Reference to the context config and specific fetch definition
127
120
  contextConfigId: sqliteCore.text("context_config_id").notNull(),
128
121
  contextVariableKey: sqliteCore.text("context_variable_key").notNull(),
129
- // Key from contextVariables object
130
- // The actual cached context data
131
122
  value: sqliteCore.blob("value", { mode: "json" }).$type().notNull(),
132
123
  // Request hash for cache invalidation based on context changes
133
124
  requestHash: sqliteCore.text("request_hash"),
134
- // Hash of request context that triggered this cache
135
125
  // Metadata for monitoring and debugging
136
126
  fetchedAt: sqliteCore.text("fetched_at").notNull(),
137
127
  fetchSource: sqliteCore.text("fetch_source"),
138
- // URL or source identifier
139
128
  fetchDurationMs: sqliteCore.integer("fetch_duration_ms"),
140
129
  ...timestamps
141
130
  },
@@ -156,30 +145,29 @@ var contextCache = sqliteCore.sqliteTable(
156
145
  var subAgents = sqliteCore.sqliteTable(
157
146
  "sub_agents",
158
147
  {
159
- ...graphScoped,
148
+ ...agentScoped,
160
149
  ...uiProperties,
161
150
  prompt: sqliteCore.text("prompt").notNull(),
162
151
  conversationHistoryConfig: sqliteCore.text("conversation_history_config", {
163
152
  mode: "json"
164
153
  }).$type(),
165
154
  models: sqliteCore.text("models", { mode: "json" }).$type(),
166
- // Agent-level stopWhen configuration (inherited from project)
167
155
  stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
168
156
  ...timestamps
169
157
  },
170
158
  (table) => [
171
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
159
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
172
160
  sqliteCore.foreignKey({
173
- columns: [table.tenantId, table.projectId, table.graphId],
174
- foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
175
- name: "agents_graph_fk"
161
+ columns: [table.tenantId, table.projectId, table.agentId],
162
+ foreignColumns: [agents.tenantId, agents.projectId, agents.id],
163
+ name: "sub_agents_agents_fk"
176
164
  }).onDelete("cascade")
177
165
  ]
178
166
  );
179
167
  var subAgentRelations = sqliteCore.sqliteTable(
180
168
  "sub_agent_relations",
181
169
  {
182
- ...graphScoped,
170
+ ...agentScoped,
183
171
  sourceSubAgentId: sqliteCore.text("source_sub_agent_id").notNull(),
184
172
  // For internal relationships
185
173
  targetSubAgentId: sqliteCore.text("target_sub_agent_id"),
@@ -189,31 +177,30 @@ var subAgentRelations = sqliteCore.sqliteTable(
189
177
  ...timestamps
190
178
  },
191
179
  (table) => [
192
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
180
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
193
181
  sqliteCore.foreignKey({
194
- columns: [table.tenantId, table.projectId, table.graphId],
195
- foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
196
- name: "sub_agent_relations_graph_fk"
182
+ columns: [table.tenantId, table.projectId, table.agentId],
183
+ foreignColumns: [agents.tenantId, agents.projectId, agents.id],
184
+ name: "sub_agent_relations_agent_fk"
197
185
  }).onDelete("cascade")
198
186
  ]
199
187
  );
200
188
  var externalAgents = sqliteCore.sqliteTable(
201
189
  "external_agents",
202
190
  {
203
- ...graphScoped,
191
+ ...agentScoped,
204
192
  ...uiProperties,
205
193
  baseUrl: sqliteCore.text("base_url").notNull(),
206
- // A2A endpoint URL
207
194
  credentialReferenceId: sqliteCore.text("credential_reference_id"),
208
195
  headers: sqliteCore.blob("headers", { mode: "json" }).$type(),
209
196
  ...timestamps
210
197
  },
211
198
  (table) => [
212
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
199
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
213
200
  sqliteCore.foreignKey({
214
- columns: [table.tenantId, table.projectId, table.graphId],
215
- foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
216
- name: "external_agents_graph_fk"
201
+ columns: [table.tenantId, table.projectId, table.agentId],
202
+ foreignColumns: [agents.tenantId, agents.projectId, agents.id],
203
+ name: "external_agents_agent_fk"
217
204
  }).onDelete("cascade"),
218
205
  sqliteCore.foreignKey({
219
206
  columns: [table.tenantId, table.projectId, table.credentialReferenceId],
@@ -238,8 +225,8 @@ var tasks = sqliteCore.sqliteTable(
238
225
  (table) => [
239
226
  sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
240
227
  sqliteCore.foreignKey({
241
- columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
242
- foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
228
+ columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
229
+ foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
243
230
  name: "tasks_sub_agent_fk"
244
231
  }).onDelete("cascade")
245
232
  ]
@@ -251,7 +238,6 @@ var taskRelations = sqliteCore.sqliteTable(
251
238
  parentTaskId: sqliteCore.text("parent_task_id").notNull(),
252
239
  childTaskId: sqliteCore.text("child_task_id").notNull(),
253
240
  relationType: sqliteCore.text("relation_type").default("parent_child"),
254
- // Could be extended for other relation types
255
241
  ...timestamps
256
242
  },
257
243
  (table) => [
@@ -289,13 +275,11 @@ var subAgentDataComponents = sqliteCore.sqliteTable(
289
275
  },
290
276
  (table) => [
291
277
  sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
292
- // Foreign key constraint to agents table (ensures graph and project exist via cascade)
293
278
  sqliteCore.foreignKey({
294
- columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
295
- foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
279
+ columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
280
+ foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
296
281
  name: "sub_agent_data_components_sub_agent_fk"
297
282
  }).onDelete("cascade"),
298
- // Foreign key constraint to data_components table
299
283
  sqliteCore.foreignKey({
300
284
  columns: [table.tenantId, table.projectId, table.dataComponentId],
301
285
  foreignColumns: [dataComponents.tenantId, dataComponents.projectId, dataComponents.id],
@@ -329,15 +313,13 @@ var subAgentArtifactComponents = sqliteCore.sqliteTable(
329
313
  },
330
314
  (table) => [
331
315
  sqliteCore.primaryKey({
332
- columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId, table.id]
316
+ columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId, table.id]
333
317
  }),
334
- // Foreign key constraint to agents table (ensures graph and project exist via cascade)
335
318
  sqliteCore.foreignKey({
336
- columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
337
- foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
319
+ columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
320
+ foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
338
321
  name: "sub_agent_artifact_components_sub_agent_fk"
339
322
  }).onDelete("cascade"),
340
- // Foreign key constraint to artifact_components table
341
323
  sqliteCore.foreignKey({
342
324
  columns: [table.tenantId, table.projectId, table.artifactComponentId],
343
325
  foreignColumns: [
@@ -377,18 +359,18 @@ var tools = sqliteCore.sqliteTable(
377
359
  var functionTools = sqliteCore.sqliteTable(
378
360
  "function_tools",
379
361
  {
380
- ...graphScoped,
362
+ ...agentScoped,
381
363
  name: sqliteCore.text("name").notNull(),
382
364
  description: sqliteCore.text("description"),
383
365
  functionId: sqliteCore.text("function_id").notNull(),
384
366
  ...timestamps
385
367
  },
386
368
  (table) => [
387
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
369
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
388
370
  sqliteCore.foreignKey({
389
- columns: [table.tenantId, table.projectId, table.graphId],
390
- foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
391
- name: "function_tools_graph_fk"
371
+ columns: [table.tenantId, table.projectId, table.agentId],
372
+ foreignColumns: [agents.tenantId, agents.projectId, agents.id],
373
+ name: "function_tools_agent_fk"
392
374
  }).onDelete("cascade"),
393
375
  // Foreign key constraint to functions table
394
376
  sqliteCore.foreignKey({
@@ -426,14 +408,12 @@ var subAgentToolRelations = sqliteCore.sqliteTable(
426
408
  ...timestamps
427
409
  },
428
410
  (table) => [
429
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
430
- // Foreign key constraint to agents table (which includes project and graph scope)
411
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
431
412
  sqliteCore.foreignKey({
432
- columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
433
- foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
413
+ columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
414
+ foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
434
415
  name: "sub_agent_tool_relations_agent_fk"
435
416
  }).onDelete("cascade"),
436
- // Foreign key constraint to tools table (MCP tools)
437
417
  sqliteCore.foreignKey({
438
418
  columns: [table.tenantId, table.projectId, table.toolId],
439
419
  foreignColumns: [tools.tenantId, tools.projectId, tools.id],
@@ -449,20 +429,20 @@ var agentFunctionToolRelations = sqliteCore.sqliteTable(
449
429
  ...timestamps
450
430
  },
451
431
  (table) => [
452
- sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
432
+ sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
453
433
  // Foreign key constraint to agents table
454
434
  sqliteCore.foreignKey({
455
- columns: [table.tenantId, table.projectId, table.graphId, table.subAgentId],
456
- foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.graphId, subAgents.id],
435
+ columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
436
+ foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
457
437
  name: "agent_function_tool_relations_agent_fk"
458
438
  }).onDelete("cascade"),
459
439
  // Foreign key constraint to functionTools table
460
440
  sqliteCore.foreignKey({
461
- columns: [table.tenantId, table.projectId, table.graphId, table.functionToolId],
441
+ columns: [table.tenantId, table.projectId, table.agentId, table.functionToolId],
462
442
  foreignColumns: [
463
443
  functionTools.tenantId,
464
444
  functionTools.projectId,
465
- functionTools.graphId,
445
+ functionTools.agentId,
466
446
  functionTools.id
467
447
  ],
468
448
  name: "agent_function_tool_relations_function_tool_fk"
@@ -496,33 +476,23 @@ var messages = sqliteCore.sqliteTable(
496
476
  conversationId: sqliteCore.text("conversation_id").notNull(),
497
477
  // Role mapping: user, agent, system (unified for both formats)
498
478
  role: sqliteCore.text("role").notNull(),
499
- // 'user' | 'agent' | 'system'
500
479
  // Agent sender/recipient tracking (nullable - only populated when relevant)
501
480
  fromSubAgentId: sqliteCore.text("from_sub_agent_id"),
502
- // Populated when message is from an agent
503
481
  toSubAgentId: sqliteCore.text("to_sub_agent_id"),
504
- // Populated when message is directed to a specific agent (e.g., transfers/delegations)
505
482
  // External agent sender tracking
506
483
  fromExternalAgentId: sqliteCore.text("from_external_sub_agent_id"),
507
- // Populated when message is directed from an external agent
508
484
  // External agent recipient tracking
509
485
  toExternalAgentId: sqliteCore.text("to_external_sub_agent_id"),
510
- // Populated when message is directed to an external agent
511
486
  // Message content stored as JSON to support both formats
512
487
  content: sqliteCore.blob("content", { mode: "json" }).$type().notNull(),
513
488
  // Message classification and filtering
514
489
  visibility: sqliteCore.text("visibility").notNull().default("user-facing"),
515
- // 'user-facing' | 'internal' | 'system' | 'external'
516
490
  messageType: sqliteCore.text("message_type").notNull().default("chat"),
517
- // 'chat' | 'a2a-request' | 'a2a-response' | 'task-update' | 'tool-call'
518
491
  taskId: sqliteCore.text("task_id"),
519
492
  parentMessageId: sqliteCore.text("parent_message_id"),
520
- // Remove self-reference constraint here
521
493
  // A2A specific fields
522
494
  a2aTaskId: sqliteCore.text("a2a_task_id"),
523
- // Links to A2A task when relevant
524
495
  a2aSessionId: sqliteCore.text("a2a_session_id"),
525
- // A2A session identifier
526
496
  // Metadata for extensions
527
497
  metadata: sqliteCore.blob("metadata", { mode: "json" }).$type(),
528
498
  ...timestamps
@@ -543,7 +513,6 @@ var ledgerArtifacts = sqliteCore.sqliteTable(
543
513
  // Links
544
514
  taskId: sqliteCore.text("task_id").notNull(),
545
515
  toolCallId: sqliteCore.text("tool_call_id"),
546
- // Added for traceability to the specific tool execution
547
516
  contextId: sqliteCore.text("context_id").notNull(),
548
517
  // Core Artifact fields
549
518
  type: sqliteCore.text("type").notNull().default("source"),
@@ -579,13 +548,10 @@ var ledgerArtifacts = sqliteCore.sqliteTable(
579
548
  var apiKeys = sqliteCore.sqliteTable(
580
549
  "api_keys",
581
550
  {
582
- ...graphScoped,
551
+ ...agentScoped,
583
552
  publicId: sqliteCore.text("public_id").notNull().unique(),
584
- // Public ID for O(1) lookup (e.g., "abc123def456")
585
553
  keyHash: sqliteCore.text("key_hash").notNull(),
586
- // Hashed API key (never store plaintext)
587
554
  keyPrefix: sqliteCore.text("key_prefix").notNull(),
588
- // First 8 chars for identification (e.g., "sk_live_abc...")
589
555
  name: sqliteCore.text("name"),
590
556
  lastUsedAt: sqliteCore.text("last_used_at"),
591
557
  expiresAt: sqliteCore.text("expires_at"),
@@ -598,11 +564,11 @@ var apiKeys = sqliteCore.sqliteTable(
598
564
  name: "api_keys_project_fk"
599
565
  }).onDelete("cascade"),
600
566
  sqliteCore.foreignKey({
601
- columns: [t.tenantId, t.projectId, t.graphId],
602
- foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
603
- name: "api_keys_graph_fk"
567
+ columns: [t.tenantId, t.projectId, t.agentId],
568
+ foreignColumns: [agents.tenantId, agents.projectId, agents.id],
569
+ name: "api_keys_agent_fk"
604
570
  }).onDelete("cascade"),
605
- sqliteCore.index("api_keys_tenant_graph_idx").on(t.tenantId, t.graphId),
571
+ sqliteCore.index("api_keys_tenant_agent_idx").on(t.tenantId, t.agentId),
606
572
  sqliteCore.index("api_keys_prefix_idx").on(t.keyPrefix),
607
573
  sqliteCore.index("api_keys_public_id_idx").on(t.publicId)
608
574
  ]
@@ -612,9 +578,7 @@ var credentialReferences = sqliteCore.sqliteTable(
612
578
  {
613
579
  ...projectScoped,
614
580
  type: sqliteCore.text("type").notNull(),
615
- // Implementation type: 'keychain', 'nango', 'memory', etc.
616
581
  credentialStoreId: sqliteCore.text("credential_store_id").notNull(),
617
- // Maps to framework.getCredentialStore(id)
618
582
  retrievalParams: sqliteCore.blob("retrieval_params", { mode: "json" }).$type(),
619
583
  ...timestamps
620
584
  },
@@ -628,7 +592,6 @@ var credentialReferences = sqliteCore.sqliteTable(
628
592
  ]
629
593
  );
630
594
  drizzleOrm.relations(tasks, ({ one, many }) => ({
631
- // A task belongs to one project
632
595
  project: one(projects, {
633
596
  fields: [tasks.tenantId, tasks.projectId],
634
597
  references: [projects.tenantId, projects.id]
@@ -645,14 +608,12 @@ drizzleOrm.relations(tasks, ({ one, many }) => ({
645
608
  fields: [tasks.subAgentId],
646
609
  references: [subAgents.id]
647
610
  }),
648
- // A task can have many messages associated with it
649
611
  messages: many(messages),
650
- // A task can have many ledger artifacts
651
612
  ledgerArtifacts: many(ledgerArtifacts)
652
613
  }));
653
614
  drizzleOrm.relations(projects, ({ many }) => ({
654
615
  subAgents: many(subAgents),
655
- agentGraphs: many(agentGraph),
616
+ agents: many(agents),
656
617
  tools: many(tools),
657
618
  functions: many(functions),
658
619
  contextConfigs: many(contextConfigs),
@@ -681,7 +642,7 @@ drizzleOrm.relations(contextConfigs, ({ many, one }) => ({
681
642
  fields: [contextConfigs.tenantId, contextConfigs.projectId],
682
643
  references: [projects.tenantId, projects.id]
683
644
  }),
684
- graphs: many(agentGraph),
645
+ agents: many(agents),
685
646
  cache: many(contextCache)
686
647
  }));
687
648
  drizzleOrm.relations(contextCache, ({ one }) => ({
@@ -696,7 +657,7 @@ drizzleOrm.relations(subAgents, ({ many, one }) => ({
696
657
  references: [projects.tenantId, projects.id]
697
658
  }),
698
659
  tasks: many(tasks),
699
- defaultForGraphs: many(agentGraph),
660
+ defaultForAgents: many(agents),
700
661
  sourceRelations: many(subAgentRelations, {
701
662
  relationName: "sourceRelations"
702
663
  }),
@@ -709,25 +670,22 @@ drizzleOrm.relations(subAgents, ({ many, one }) => ({
709
670
  receivedMessages: many(messages, {
710
671
  relationName: "receivedMessages"
711
672
  }),
712
- associatedMessages: many(messages, {
713
- relationName: "associatedAgent"
714
- }),
715
673
  toolRelations: many(subAgentToolRelations),
716
674
  functionToolRelations: many(agentFunctionToolRelations),
717
675
  dataComponentRelations: many(subAgentDataComponents),
718
676
  artifactComponentRelations: many(subAgentArtifactComponents)
719
677
  }));
720
- drizzleOrm.relations(agentGraph, ({ one, many }) => ({
678
+ drizzleOrm.relations(agents, ({ one, many }) => ({
721
679
  project: one(projects, {
722
- fields: [agentGraph.tenantId, agentGraph.projectId],
680
+ fields: [agents.tenantId, agents.projectId],
723
681
  references: [projects.tenantId, projects.id]
724
682
  }),
725
683
  defaultSubAgent: one(subAgents, {
726
- fields: [agentGraph.defaultSubAgentId],
684
+ fields: [agents.defaultSubAgentId],
727
685
  references: [subAgents.id]
728
686
  }),
729
687
  contextConfig: one(contextConfigs, {
730
- fields: [agentGraph.contextConfigId],
688
+ fields: [agents.contextConfigId],
731
689
  references: [contextConfigs.id]
732
690
  }),
733
691
  functionTools: many(functionTools)
@@ -748,9 +706,9 @@ drizzleOrm.relations(apiKeys, ({ one }) => ({
748
706
  fields: [apiKeys.tenantId, apiKeys.projectId],
749
707
  references: [projects.tenantId, projects.id]
750
708
  }),
751
- graph: one(agentGraph, {
752
- fields: [apiKeys.graphId],
753
- references: [agentGraph.id]
709
+ agent: one(agents, {
710
+ fields: [apiKeys.agentId],
711
+ references: [agents.id]
754
712
  })
755
713
  }));
756
714
  drizzleOrm.relations(subAgentToolRelations, ({ one }) => ({
@@ -763,8 +721,13 @@ drizzleOrm.relations(subAgentToolRelations, ({ one }) => ({
763
721
  references: [tools.id]
764
722
  })
765
723
  }));
766
- drizzleOrm.relations(credentialReferences, ({ many }) => ({
767
- tools: many(tools)
724
+ drizzleOrm.relations(credentialReferences, ({ one, many }) => ({
725
+ project: one(projects, {
726
+ fields: [credentialReferences.tenantId, credentialReferences.projectId],
727
+ references: [projects.tenantId, projects.id]
728
+ }),
729
+ tools: many(tools),
730
+ externalAgents: many(externalAgents)
768
731
  }));
769
732
  drizzleOrm.relations(tools, ({ one, many }) => ({
770
733
  project: one(projects, {
@@ -873,13 +836,17 @@ drizzleOrm.relations(ledgerArtifacts, ({ one }) => ({
873
836
  references: [tasks.id]
874
837
  })
875
838
  }));
876
- drizzleOrm.relations(functions, ({ many }) => ({
877
- functionTools: many(functionTools)
839
+ drizzleOrm.relations(functions, ({ many, one }) => ({
840
+ functionTools: many(functionTools),
841
+ project: one(projects, {
842
+ fields: [functions.tenantId, functions.projectId],
843
+ references: [projects.tenantId, projects.id]
844
+ })
878
845
  }));
879
846
  drizzleOrm.relations(subAgentRelations, ({ one }) => ({
880
- graph: one(agentGraph, {
881
- fields: [subAgentRelations.graphId],
882
- references: [agentGraph.id]
847
+ agent: one(agents, {
848
+ fields: [subAgentRelations.agentId],
849
+ references: [agents.id]
883
850
  }),
884
851
  sourceSubAgent: one(subAgents, {
885
852
  fields: [subAgentRelations.sourceSubAgentId],
@@ -901,9 +868,9 @@ drizzleOrm.relations(functionTools, ({ one, many }) => ({
901
868
  fields: [functionTools.tenantId, functionTools.projectId],
902
869
  references: [projects.tenantId, projects.id]
903
870
  }),
904
- graph: one(agentGraph, {
905
- fields: [functionTools.tenantId, functionTools.projectId, functionTools.graphId],
906
- references: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id]
871
+ agent: one(agents, {
872
+ fields: [functionTools.tenantId, functionTools.projectId, functionTools.agentId],
873
+ references: [agents.tenantId, agents.projectId, agents.id]
907
874
  }),
908
875
  function: one(functions, {
909
876
  fields: [functionTools.tenantId, functionTools.projectId, functionTools.functionId],
@@ -930,7 +897,7 @@ var StopWhenSchema = zodOpenapi.z.object({
930
897
  transferCountIs: zodOpenapi.z.number().min(1).max(100).optional(),
931
898
  stepCountIs: zodOpenapi.z.number().min(1).max(1e3).optional()
932
899
  });
933
- var GraphStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true });
900
+ var AgentStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true });
934
901
  var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true });
935
902
  var MIN_ID_LENGTH = 1;
936
903
  var MAX_ID_LENGTH = 255;
@@ -971,31 +938,31 @@ zodOpenapi.z.object({
971
938
  var createApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
972
939
  var createApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
973
940
  var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true }).partial();
974
- var createGraphScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
975
- var createGraphScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
976
- var createGraphScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true }).partial();
941
+ var createAgentScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
942
+ var createAgentScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
943
+ var createAgentScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true }).partial();
977
944
  var SubAgentSelectSchema = drizzleZod.createSelectSchema(subAgents);
978
945
  var SubAgentInsertSchema = drizzleZod.createInsertSchema(subAgents).extend({
979
946
  id: resourceIdSchema,
980
947
  models: ModelSchema.optional()
981
948
  });
982
949
  var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
983
- var SubAgentApiSelectSchema = createGraphScopedApiSchema(SubAgentSelectSchema);
984
- var SubAgentApiInsertSchema = createGraphScopedApiInsertSchema(SubAgentInsertSchema);
985
- createGraphScopedApiUpdateSchema(SubAgentUpdateSchema);
950
+ var SubAgentApiSelectSchema = createAgentScopedApiSchema(SubAgentSelectSchema);
951
+ var SubAgentApiInsertSchema = createAgentScopedApiInsertSchema(SubAgentInsertSchema);
952
+ createAgentScopedApiUpdateSchema(SubAgentUpdateSchema);
986
953
  var SubAgentRelationSelectSchema = drizzleZod.createSelectSchema(subAgentRelations);
987
954
  var SubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
988
955
  id: resourceIdSchema,
989
- graphId: resourceIdSchema,
956
+ agentId: resourceIdSchema,
990
957
  sourceSubAgentId: resourceIdSchema,
991
958
  targetSubAgentId: resourceIdSchema.optional(),
992
959
  externalSubAgentId: resourceIdSchema.optional()
993
960
  });
994
961
  var SubAgentRelationUpdateSchema = SubAgentRelationInsertSchema.partial();
995
- createGraphScopedApiSchema(
962
+ createAgentScopedApiSchema(
996
963
  SubAgentRelationSelectSchema
997
964
  );
998
- createGraphScopedApiInsertSchema(
965
+ createAgentScopedApiInsertSchema(
999
966
  SubAgentRelationInsertSchema
1000
967
  ).extend({
1001
968
  relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES)
@@ -1010,7 +977,7 @@ createGraphScopedApiInsertSchema(
1010
977
  path: ["targetSubAgentId", "externalSubAgentId"]
1011
978
  }
1012
979
  );
1013
- createGraphScopedApiUpdateSchema(
980
+ createAgentScopedApiUpdateSchema(
1014
981
  SubAgentRelationUpdateSchema
1015
982
  ).extend({
1016
983
  relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES).optional()
@@ -1035,23 +1002,23 @@ zodOpenapi.z.object({
1035
1002
  });
1036
1003
  var ExternalSubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
1037
1004
  id: resourceIdSchema,
1038
- graphId: resourceIdSchema,
1005
+ agentId: resourceIdSchema,
1039
1006
  sourceSubAgentId: resourceIdSchema,
1040
1007
  externalSubAgentId: resourceIdSchema
1041
1008
  });
1042
1009
  createApiInsertSchema(
1043
1010
  ExternalSubAgentRelationInsertSchema
1044
1011
  );
1045
- var AgentGraphSelectSchema = drizzleZod.createSelectSchema(agentGraph);
1046
- var AgentGraphInsertSchema = drizzleZod.createInsertSchema(agentGraph).extend({
1012
+ var AgentSelectSchema = drizzleZod.createSelectSchema(agents);
1013
+ var AgentInsertSchema = drizzleZod.createInsertSchema(agents).extend({
1047
1014
  id: resourceIdSchema
1048
1015
  });
1049
- var AgentGraphUpdateSchema = AgentGraphInsertSchema.partial();
1050
- createApiSchema(AgentGraphSelectSchema);
1051
- var AgentGraphApiInsertSchema = createApiInsertSchema(AgentGraphInsertSchema).extend({
1016
+ var AgentUpdateSchema = AgentInsertSchema.partial();
1017
+ createApiSchema(AgentSelectSchema);
1018
+ var AgentApiInsertSchema = createApiInsertSchema(AgentInsertSchema).extend({
1052
1019
  id: resourceIdSchema
1053
1020
  });
1054
- createApiUpdateSchema(AgentGraphUpdateSchema);
1021
+ createApiUpdateSchema(AgentUpdateSchema);
1055
1022
  var TaskSelectSchema = drizzleZod.createSelectSchema(tasks);
1056
1023
  var TaskInsertSchema = drizzleZod.createInsertSchema(tasks).extend({
1057
1024
  id: resourceIdSchema,
@@ -1094,7 +1061,10 @@ var McpTransportConfigSchema = zodOpenapi.z.object({
1094
1061
  type: zodOpenapi.z.enum(MCPTransportType),
1095
1062
  requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
1096
1063
  eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
1097
- reconnectionOptions: zodOpenapi.z.custom().optional(),
1064
+ reconnectionOptions: zodOpenapi.z.any().optional().openapi({
1065
+ type: "object",
1066
+ description: "Reconnection options for streamable HTTP transport"
1067
+ }),
1098
1068
  sessionId: zodOpenapi.z.string().optional()
1099
1069
  });
1100
1070
  var ToolStatusSchema = zodOpenapi.z.enum(TOOL_STATUS_VALUES);
@@ -1111,13 +1081,16 @@ var ToolInsertSchema = drizzleZod.createInsertSchema(tools).extend({
1111
1081
  type: zodOpenapi.z.literal("mcp"),
1112
1082
  mcp: zodOpenapi.z.object({
1113
1083
  server: zodOpenapi.z.object({
1114
- url: zodOpenapi.z.string().url()
1084
+ url: zodOpenapi.z.url()
1115
1085
  }),
1116
1086
  transport: zodOpenapi.z.object({
1117
1087
  type: zodOpenapi.z.enum(MCPTransportType),
1118
1088
  requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
1119
1089
  eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
1120
- reconnectionOptions: zodOpenapi.z.custom().optional(),
1090
+ reconnectionOptions: zodOpenapi.z.any().optional().openapi({
1091
+ type: "object",
1092
+ description: "Reconnection options for streamable HTTP transport"
1093
+ }),
1121
1094
  sessionId: zodOpenapi.z.string().optional()
1122
1095
  }).optional(),
1123
1096
  activeTools: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
@@ -1164,7 +1137,7 @@ createApiUpdateSchema(DataComponentUpdateSchema);
1164
1137
  var SubAgentDataComponentSelectSchema = drizzleZod.createSelectSchema(subAgentDataComponents);
1165
1138
  var SubAgentDataComponentInsertSchema = drizzleZod.createInsertSchema(subAgentDataComponents);
1166
1139
  var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
1167
- createGraphScopedApiSchema(
1140
+ createAgentScopedApiSchema(
1168
1141
  SubAgentDataComponentSelectSchema
1169
1142
  );
1170
1143
  SubAgentDataComponentInsertSchema.omit({
@@ -1173,7 +1146,7 @@ SubAgentDataComponentInsertSchema.omit({
1173
1146
  id: true,
1174
1147
  createdAt: true
1175
1148
  });
1176
- createGraphScopedApiUpdateSchema(
1149
+ createAgentScopedApiUpdateSchema(
1177
1150
  SubAgentDataComponentUpdateSchema
1178
1151
  );
1179
1152
  var ArtifactComponentSelectSchema = drizzleZod.createSelectSchema(artifactComponents);
@@ -1200,7 +1173,7 @@ var SubAgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
1200
1173
  artifactComponentId: resourceIdSchema
1201
1174
  });
1202
1175
  var SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentInsertSchema.partial();
1203
- createGraphScopedApiSchema(
1176
+ createAgentScopedApiSchema(
1204
1177
  SubAgentArtifactComponentSelectSchema
1205
1178
  );
1206
1179
  SubAgentArtifactComponentInsertSchema.omit({
@@ -1209,7 +1182,7 @@ SubAgentArtifactComponentInsertSchema.omit({
1209
1182
  id: true,
1210
1183
  createdAt: true
1211
1184
  });
1212
- createGraphScopedApiUpdateSchema(
1185
+ createAgentScopedApiUpdateSchema(
1213
1186
  SubAgentArtifactComponentUpdateSchema
1214
1187
  );
1215
1188
  var ExternalAgentSelectSchema = drizzleZod.createSelectSchema(externalAgents).extend({
@@ -1220,9 +1193,9 @@ var ExternalAgentInsertSchema = drizzleZod.createInsertSchema(externalAgents).ex
1220
1193
  id: resourceIdSchema
1221
1194
  });
1222
1195
  var ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
1223
- var ExternalAgentApiSelectSchema = createGraphScopedApiSchema(ExternalAgentSelectSchema);
1224
- var ExternalAgentApiInsertSchema = createGraphScopedApiInsertSchema(ExternalAgentInsertSchema);
1225
- createGraphScopedApiUpdateSchema(ExternalAgentUpdateSchema);
1196
+ var ExternalAgentApiSelectSchema = createAgentScopedApiSchema(ExternalAgentSelectSchema);
1197
+ var ExternalAgentApiInsertSchema = createAgentScopedApiInsertSchema(ExternalAgentInsertSchema);
1198
+ createAgentScopedApiUpdateSchema(ExternalAgentUpdateSchema);
1226
1199
  zodOpenapi.z.discriminatedUnion("type", [
1227
1200
  SubAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
1228
1201
  ExternalAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("external") })
@@ -1230,7 +1203,7 @@ zodOpenapi.z.discriminatedUnion("type", [
1230
1203
  var ApiKeySelectSchema = drizzleZod.createSelectSchema(apiKeys);
1231
1204
  var ApiKeyInsertSchema = drizzleZod.createInsertSchema(apiKeys).extend({
1232
1205
  id: resourceIdSchema,
1233
- graphId: resourceIdSchema
1206
+ agentId: resourceIdSchema
1234
1207
  });
1235
1208
  ApiKeyInsertSchema.partial().omit({
1236
1209
  tenantId: true,
@@ -1337,7 +1310,7 @@ var FunctionToolInsertSchema = drizzleZod.createInsertSchema(functionTools).exte
1337
1310
  });
1338
1311
  var FunctionToolUpdateSchema = FunctionToolInsertSchema.partial();
1339
1312
  createApiSchema(FunctionToolSelectSchema);
1340
- var FunctionToolApiInsertSchema = createGraphScopedApiInsertSchema(FunctionToolInsertSchema);
1313
+ var FunctionToolApiInsertSchema = createAgentScopedApiInsertSchema(FunctionToolInsertSchema);
1341
1314
  createApiUpdateSchema(FunctionToolUpdateSchema);
1342
1315
  var FunctionSelectSchema = drizzleZod.createSelectSchema(functions);
1343
1316
  var FunctionInsertSchema = drizzleZod.createInsertSchema(functions).extend({
@@ -1363,28 +1336,40 @@ zodOpenapi.z.object({
1363
1336
  fetchConfig: FetchConfigSchema,
1364
1337
  responseSchema: zodOpenapi.z.any().optional(),
1365
1338
  // JSON Schema for validating HTTP response
1366
- defaultValue: zodOpenapi.z.unknown().optional(),
1339
+ defaultValue: zodOpenapi.z.any().optional().openapi({
1340
+ description: "Default value if fetch fails"
1341
+ }),
1367
1342
  credential: CredentialReferenceApiInsertSchema.optional()
1368
1343
  });
1369
1344
  var ContextConfigSelectSchema = drizzleZod.createSelectSchema(contextConfigs).extend({
1370
- headersSchema: zodOpenapi.z.unknown().optional()
1345
+ headersSchema: zodOpenapi.z.any().optional().openapi({
1346
+ type: "object",
1347
+ description: "JSON Schema for validating request headers"
1348
+ })
1371
1349
  });
1372
1350
  var ContextConfigInsertSchema = drizzleZod.createInsertSchema(contextConfigs).extend({
1373
1351
  id: resourceIdSchema.optional(),
1374
- headersSchema: zodOpenapi.z.unknown().optional()
1352
+ headersSchema: zodOpenapi.z.any().nullable().optional().openapi({
1353
+ type: "object",
1354
+ description: "JSON Schema for validating request headers"
1355
+ }),
1356
+ contextVariables: zodOpenapi.z.any().nullable().optional().openapi({
1357
+ type: "object",
1358
+ description: "Context variables configuration with fetch definitions"
1359
+ })
1375
1360
  }).omit({
1376
1361
  createdAt: true,
1377
1362
  updatedAt: true
1378
1363
  });
1379
1364
  var ContextConfigUpdateSchema = ContextConfigInsertSchema.partial();
1380
1365
  createApiSchema(ContextConfigSelectSchema).omit({
1381
- graphId: true
1366
+ agentId: true
1382
1367
  });
1383
1368
  var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSchema).omit({
1384
- graphId: true
1369
+ agentId: true
1385
1370
  });
1386
1371
  createApiUpdateSchema(ContextConfigUpdateSchema).omit({
1387
- graphId: true
1372
+ agentId: true
1388
1373
  });
1389
1374
  var SubAgentToolRelationSelectSchema = drizzleZod.createSelectSchema(subAgentToolRelations);
1390
1375
  var SubAgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToolRelations).extend({
@@ -1395,13 +1380,13 @@ var SubAgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToo
1395
1380
  headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
1396
1381
  });
1397
1382
  var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
1398
- createGraphScopedApiSchema(
1383
+ createAgentScopedApiSchema(
1399
1384
  SubAgentToolRelationSelectSchema
1400
1385
  );
1401
- createGraphScopedApiInsertSchema(
1386
+ createAgentScopedApiInsertSchema(
1402
1387
  SubAgentToolRelationInsertSchema
1403
1388
  );
1404
- createGraphScopedApiUpdateSchema(
1389
+ createAgentScopedApiUpdateSchema(
1405
1390
  SubAgentToolRelationUpdateSchema
1406
1391
  );
1407
1392
  var LedgerArtifactSelectSchema = drizzleZod.createSelectSchema(ledgerArtifacts);
@@ -1432,7 +1417,7 @@ var CanUseItemSchema = zodOpenapi.z.object({
1432
1417
  toolSelection: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
1433
1418
  headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
1434
1419
  });
1435
- var FullGraphAgentInsertSchema = SubAgentApiInsertSchema.extend({
1420
+ var FullAgentAgentInsertSchema = SubAgentApiInsertSchema.extend({
1436
1421
  type: zodOpenapi.z.literal("internal"),
1437
1422
  canUse: zodOpenapi.z.array(CanUseItemSchema),
1438
1423
  // All tools (both MCP and function tools)
@@ -1441,44 +1426,23 @@ var FullGraphAgentInsertSchema = SubAgentApiInsertSchema.extend({
1441
1426
  canTransferTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
1442
1427
  canDelegateTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
1443
1428
  });
1444
- AgentGraphApiInsertSchema.extend({
1445
- subAgents: zodOpenapi.z.record(
1446
- zodOpenapi.z.string(),
1447
- zodOpenapi.z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])
1448
- ),
1449
- // Lookup maps for UI to resolve canUse items
1450
- tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
1451
- // MCP tools (project-scoped)
1452
- functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
1453
- // Function tools (graph-scoped)
1454
- functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
1455
- // Get function code for function tools
1456
- contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
1457
- statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
1458
- models: ModelSchema.optional(),
1459
- stopWhen: GraphStopWhenSchema.optional(),
1460
- graphPrompt: zodOpenapi.z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
1461
- });
1462
- var GraphWithinContextOfProjectSchema = AgentGraphApiInsertSchema.extend({
1429
+ var AgentWithinContextOfProjectSchema = AgentApiInsertSchema.extend({
1463
1430
  subAgents: zodOpenapi.z.record(
1464
1431
  zodOpenapi.z.string(),
1465
- zodOpenapi.z.discriminatedUnion("type", [
1466
- FullGraphAgentInsertSchema,
1467
- ExternalAgentApiInsertSchema.extend({ type: zodOpenapi.z.literal("external") })
1468
- ])
1432
+ zodOpenapi.z.union([FullAgentAgentInsertSchema, ExternalAgentApiInsertSchema])
1469
1433
  ),
1470
1434
  // Lookup maps for UI to resolve canUse items
1471
1435
  tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
1472
1436
  // MCP tools (project-scoped)
1473
1437
  functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
1474
- // Function tools (graph-scoped)
1438
+ // Function tools (agent-scoped)
1475
1439
  functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
1476
1440
  // Get function code for function tools
1477
1441
  contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
1478
1442
  statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
1479
1443
  models: ModelSchema.optional(),
1480
- stopWhen: GraphStopWhenSchema.optional(),
1481
- graphPrompt: zodOpenapi.z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
1444
+ stopWhen: AgentStopWhenSchema.optional(),
1445
+ prompt: zodOpenapi.z.string().max(5e3, "Agent prompt cannot exceed 5000 characters").optional()
1482
1446
  });
1483
1447
  zodOpenapi.z.object({
1484
1448
  page: zodOpenapi.z.coerce.number().min(1).default(1),
@@ -1489,7 +1453,9 @@ zodOpenapi.z.object({
1489
1453
  zodOpenapi.z.object({
1490
1454
  error: zodOpenapi.z.string(),
1491
1455
  message: zodOpenapi.z.string().optional(),
1492
- details: zodOpenapi.z.unknown().optional()
1456
+ details: zodOpenapi.z.any().optional().openapi({
1457
+ description: "Additional error details"
1458
+ })
1493
1459
  });
1494
1460
  zodOpenapi.z.object({
1495
1461
  exists: zodOpenapi.z.boolean()
@@ -1512,11 +1478,9 @@ ProjectSelectSchema.omit({ tenantId: true });
1512
1478
  var ProjectApiInsertSchema = ProjectInsertSchema.omit({ tenantId: true });
1513
1479
  ProjectUpdateSchema.omit({ tenantId: true });
1514
1480
  ProjectApiInsertSchema.extend({
1515
- graphs: zodOpenapi.z.record(zodOpenapi.z.string(), GraphWithinContextOfProjectSchema),
1481
+ agents: zodOpenapi.z.record(zodOpenapi.z.string(), AgentWithinContextOfProjectSchema),
1516
1482
  tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema),
1517
- // MCP tools (project-scoped)
1518
1483
  functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
1519
- // Functions (project-scoped)
1520
1484
  dataComponents: zodOpenapi.z.record(zodOpenapi.z.string(), DataComponentApiInsertSchema).optional(),
1521
1485
  artifactComponents: zodOpenapi.z.record(zodOpenapi.z.string(), ArtifactComponentApiInsertSchema).optional(),
1522
1486
  statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
@@ -1533,9 +1497,9 @@ zodOpenapi.z.object({
1533
1497
  description: "Project identifier",
1534
1498
  example: "project_456"
1535
1499
  }),
1536
- "x-inkeep-graph-id": zodOpenapi.z.string().optional().openapi({
1537
- description: "Graph identifier",
1538
- example: "graph_789"
1500
+ "x-inkeep-agent-id": zodOpenapi.z.string().optional().openapi({
1501
+ description: "Agent identifier",
1502
+ example: "agent_789"
1539
1503
  })
1540
1504
  });
1541
1505
  var TenantId = zodOpenapi.z.string().openapi({
@@ -1546,9 +1510,9 @@ var ProjectId = zodOpenapi.z.string().openapi({
1546
1510
  description: "Project identifier",
1547
1511
  example: "project_456"
1548
1512
  });
1549
- var GraphId = zodOpenapi.z.string().openapi({
1550
- description: "Graph identifier",
1551
- example: "graph_789"
1513
+ var AgentId = zodOpenapi.z.string().openapi({
1514
+ description: "Agent identifier",
1515
+ example: "agent_789"
1552
1516
  });
1553
1517
  var SubAgentId = zodOpenapi.z.string().openapi({
1554
1518
  description: "Sub-agent identifier",
@@ -1566,18 +1530,18 @@ var TenantProjectParamsSchema = TenantParamsSchema.extend({
1566
1530
  TenantProjectParamsSchema.extend({
1567
1531
  id: resourceIdSchema
1568
1532
  }).openapi("TenantProjectIdParams");
1569
- var TenantProjectGraphParamsSchema = TenantProjectParamsSchema.extend({
1570
- graphId: GraphId
1571
- }).openapi("TenantProjectGraphParams");
1572
- TenantProjectGraphParamsSchema.extend({
1533
+ var TenantProjectAgentParamsSchema = TenantProjectParamsSchema.extend({
1534
+ agentId: AgentId
1535
+ }).openapi("TenantProjectAgentParams");
1536
+ TenantProjectAgentParamsSchema.extend({
1573
1537
  id: resourceIdSchema
1574
- }).openapi("TenantProjectGraphIdParams");
1575
- var TenantProjectGraphSubAgentParamsSchema = TenantProjectGraphParamsSchema.extend({
1538
+ }).openapi("TenantProjectAgentIdParams");
1539
+ var TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentParamsSchema.extend({
1576
1540
  subAgentId: SubAgentId
1577
- }).openapi("TenantProjectGraphSubAgentParams");
1578
- TenantProjectGraphSubAgentParamsSchema.extend({
1541
+ }).openapi("TenantProjectAgentSubAgentParams");
1542
+ TenantProjectAgentSubAgentParamsSchema.extend({
1579
1543
  id: resourceIdSchema
1580
- }).openapi("TenantProjectGraphSubAgentIdParams");
1544
+ }).openapi("TenantProjectAgentSubAgentIdParams");
1581
1545
  zodOpenapi.z.object({
1582
1546
  page: zodOpenapi.z.coerce.number().min(1).default(1),
1583
1547
  limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10)
@@ -1697,7 +1661,7 @@ var SPAN_NAMES = {
1697
1661
  CONTEXT_HANDLE: "context.handle_context_resolution",
1698
1662
  AGENT_GENERATION: "agent.generate",
1699
1663
  CONTEXT_FETCHER: "context-fetcher.http-request",
1700
- ARTIFACT_PROCESSING: "graph_session.process_artifact"
1664
+ ARTIFACT_PROCESSING: "agent_session.process_artifact"
1701
1665
  };
1702
1666
  var AI_OPERATIONS = {
1703
1667
  GENERATE_TEXT: "ai.generateText.doGenerate",
@@ -1713,14 +1677,14 @@ var SPAN_KEYS = {
1713
1677
  STATUS_MESSAGE: "status_message",
1714
1678
  OTEL_STATUS_CODE: "otel.status_code",
1715
1679
  OTEL_STATUS_DESCRIPTION: "otel.status_description",
1716
- // Graph attributes
1717
- GRAPH_ID: "graph.id",
1718
- GRAPH_NAME: "graph.name",
1680
+ // Agent attributesa
1681
+ AGENT_ID: "agent.id",
1682
+ AGENT_NAME: "agent.name",
1719
1683
  TENANT_ID: "tenant.id",
1720
1684
  PROJECT_ID: "project.id",
1721
1685
  // AI/Agent attributes
1722
- AI_AGENT_NAME: "ai.agentName",
1723
- AI_AGENT_NAME_ALT: "ai.agent.name",
1686
+ AI_SUB_AGENT_NAME: "ai.subAgentName",
1687
+ AI_SUB_AGENT_NAME_ALT: "ai.subAgent.name",
1724
1688
  AI_OPERATION_ID: "ai.operationId",
1725
1689
  AI_RESPONSE_TIMESTAMP: "ai.response.timestamp",
1726
1690
  AI_RESPONSE_CONTENT: "ai.response.content",
@@ -1738,16 +1702,16 @@ var SPAN_KEYS = {
1738
1702
  AI_TOOL_CALL_ID: "ai.toolCall.id",
1739
1703
  AI_TOOL_TYPE: "ai.toolType",
1740
1704
  TOOL_PURPOSE: "tool.purpose",
1741
- // Agent attributes
1742
- AGENT_ID: "agent.id",
1743
- AGENT_NAME: "agent.name",
1705
+ // SubAgent attributes
1706
+ SUB_AGENT_ID: "subagent.id",
1707
+ SUB_AGENT_NAME: "subagent.name",
1744
1708
  // Token usage
1745
1709
  GEN_AI_USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens",
1746
1710
  GEN_AI_USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens",
1747
1711
  // Context attributes
1748
1712
  CONTEXT_URL: "context.url",
1749
1713
  CONTEXT_CONFIG_ID: "context.context_config_id",
1750
- CONTEXT_AGENT_GRAPH_ID: "context.agent_graph_id",
1714
+ CONTEXT_AGENT_ID: "context.agent_id",
1751
1715
  CONTEXT_HEADERS_KEYS: "context.headers_keys",
1752
1716
  // Message attributes
1753
1717
  MESSAGE_CONTENT: "message.content",
@@ -1899,7 +1863,7 @@ var QUERY_EXPRESSIONS = {
1899
1863
  CONTEXT_ERRORS: "contextErrors",
1900
1864
  AGENT_GENERATION_ERRORS: "agentGenerationErrors",
1901
1865
  USER_MESSAGES: "userMessages",
1902
- UNIQUE_GRAPHS: "uniqueGraphs",
1866
+ UNIQUE_AGENTS: "uniqueAgents",
1903
1867
  UNIQUE_MODELS: "uniqueModels",
1904
1868
  // Route-specific query names
1905
1869
  TOOL_CALLS: "toolCalls",
@@ -1933,7 +1897,7 @@ var QUERY_TYPES = {
1933
1897
  var PANEL_TYPES = {
1934
1898
  LIST: "list",
1935
1899
  TABLE: "table",
1936
- GRAPH: "graph",
1900
+ AGENT: "agent",
1937
1901
  VALUE: "value"
1938
1902
  };
1939
1903
  var DATA_SOURCES = {
@@ -1993,7 +1957,7 @@ var ErrorResponseSchema2 = zod.z.object({
1993
1957
  message: zod.z.string().optional(),
1994
1958
  details: zod.z.unknown().optional()
1995
1959
  });
1996
- var AgentApiInsertSchema = zod.z.object({
1960
+ var AgentApiInsertSchema2 = zod.z.object({
1997
1961
  id: zod.z.string().optional(),
1998
1962
  name: zod.z.string(),
1999
1963
  description: zod.z.string().optional(),
@@ -2018,7 +1982,7 @@ var ApiKeyApiSelectSchema2 = zod.z.object({
2018
1982
  id: zod.z.string(),
2019
1983
  tenantId: zod.z.string(),
2020
1984
  projectId: zod.z.string(),
2021
- graphId: zod.z.string(),
1985
+ agentId: zod.z.string(),
2022
1986
  publicId: zod.z.string(),
2023
1987
  keyHash: zod.z.string(),
2024
1988
  keyPrefix: zod.z.string(),
@@ -2065,17 +2029,17 @@ var ExternalAgentApiInsertSchema2 = zod.z.object({
2065
2029
  credentialReferenceId: zod.z.string().nullable().optional(),
2066
2030
  type: zod.z.literal("external").optional()
2067
2031
  });
2068
- var AgentGraphApiInsertSchema2 = zod.z.object({
2032
+ var AgentAgentApiInsertSchema = zod.z.object({
2069
2033
  id: zod.z.string().optional(),
2070
2034
  name: zod.z.string(),
2071
2035
  description: zod.z.string().optional(),
2072
2036
  defaultSubAgentId: zod.z.string().optional()
2073
2037
  });
2074
- var FullGraphDefinitionSchema2 = AgentGraphApiInsertSchema2.extend({
2038
+ var FullAgentDefinitionSchema = AgentAgentApiInsertSchema.extend({
2075
2039
  subAgents: zod.z.record(
2076
2040
  zod.z.string(),
2077
2041
  zod.z.union([
2078
- FullGraphAgentInsertSchema,
2042
+ FullAgentAgentInsertSchema,
2079
2043
  ExternalAgentApiInsertSchema2.extend({
2080
2044
  id: zod.z.string()
2081
2045
  })
@@ -2083,7 +2047,7 @@ var FullGraphDefinitionSchema2 = AgentGraphApiInsertSchema2.extend({
2083
2047
  ),
2084
2048
  // Removed project-scoped resources - these are now managed at project level:
2085
2049
  // tools, credentialReferences, dataComponents, artifactComponents
2086
- // Agent relationships to these resources are maintained via agent.tools, agent.dataComponents, etc.
2050
+ // Agent relationships to these resources are maintained vian agent.tools, agent.dataComponents, etc.
2087
2051
  contextConfig: zod.z.optional(ContextConfigApiInsertSchema2),
2088
2052
  models: zod.z.object({
2089
2053
  base: zod.z.object({
@@ -2102,7 +2066,7 @@ var FullGraphDefinitionSchema2 = AgentGraphApiInsertSchema2.extend({
2102
2066
  stopWhen: zod.z.object({
2103
2067
  transferCountIs: zod.z.number().min(1).max(100).optional()
2104
2068
  }).optional(),
2105
- graphPrompt: zod.z.string().max(5e3).optional(),
2069
+ agentPrompt: zod.z.string().max(5e3).optional(),
2106
2070
  statusUpdates: zod.z.object({
2107
2071
  enabled: zod.z.boolean().optional(),
2108
2072
  numEvents: zod.z.number().min(1).max(100).optional(),
@@ -2138,9 +2102,9 @@ exports.AGENT_IDS = AGENT_IDS;
2138
2102
  exports.AGGREGATE_OPERATORS = AGGREGATE_OPERATORS;
2139
2103
  exports.AI_OPERATIONS = AI_OPERATIONS;
2140
2104
  exports.AI_TOOL_TYPES = AI_TOOL_TYPES;
2141
- exports.AgentApiInsertSchema = AgentApiInsertSchema;
2142
- exports.AgentGraphApiInsertSchema = AgentGraphApiInsertSchema2;
2143
- exports.AgentStopWhenSchema = SubAgentStopWhenSchema;
2105
+ exports.AgentAgentApiInsertSchema = AgentAgentApiInsertSchema;
2106
+ exports.AgentApiInsertSchema = AgentApiInsertSchema2;
2107
+ exports.AgentStopWhenSchema = AgentStopWhenSchema;
2144
2108
  exports.ApiKeyApiCreationResponseSchema = ApiKeyApiCreationResponseSchema2;
2145
2109
  exports.ApiKeyApiSelectSchema = ApiKeyApiSelectSchema2;
2146
2110
  exports.ArtifactComponentApiInsertSchema = ArtifactComponentApiInsertSchema2;
@@ -2156,11 +2120,10 @@ exports.DataComponentApiInsertSchema = DataComponentApiInsertSchema2;
2156
2120
  exports.ErrorResponseSchema = ErrorResponseSchema2;
2157
2121
  exports.ExternalAgentApiInsertSchema = ExternalAgentApiInsertSchema2;
2158
2122
  exports.FIELD_TYPES = FIELD_TYPES;
2159
- exports.FullGraphDefinitionSchema = FullGraphDefinitionSchema2;
2123
+ exports.FullAgentDefinitionSchema = FullAgentDefinitionSchema;
2160
2124
  exports.FunctionApiInsertSchema = FunctionApiInsertSchema;
2161
2125
  exports.FunctionApiSelectSchema = FunctionApiSelectSchema;
2162
2126
  exports.FunctionApiUpdateSchema = FunctionApiUpdateSchema;
2163
- exports.GraphStopWhenSchema = GraphStopWhenSchema;
2164
2127
  exports.IdParamsSchema = IdParamsSchema;
2165
2128
  exports.ListResponseSchema = ListResponseSchema;
2166
2129
  exports.MAX_ID_LENGTH = MAX_ID_LENGTH2;
@@ -2181,6 +2144,7 @@ exports.SPAN_NAMES = SPAN_NAMES;
2181
2144
  exports.SandboxConfigSchema = SandboxConfigSchema;
2182
2145
  exports.SingleResponseSchema = SingleResponseSchema;
2183
2146
  exports.StopWhenSchema = StopWhenSchema;
2147
+ exports.SubAgentStopWhenSchema = SubAgentStopWhenSchema;
2184
2148
  exports.TRANSFER_FROM_SUB_AGENT_ID = TRANSFER_FROM_SUB_AGENT_ID;
2185
2149
  exports.TRANSFER_TO_SUB_AGENT_ID = TRANSFER_TO_SUB_AGENT_ID;
2186
2150
  exports.TenantParamsSchema = TenantParamsSchema2;