@inkeep/agents-core 0.18.1 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +4 -4
  2. package/dist/{chunk-JTHQYGCX.js → chunk-4FMDWUE4.js} +34 -34
  3. package/dist/{chunk-ID4CFGVF.js → chunk-B6F3RF4T.js} +87 -120
  4. package/dist/chunk-E6R6PML7.js +19 -0
  5. package/dist/chunk-HYS7HUYJ.js +27 -0
  6. package/dist/{chunk-H6PMWHNV.js → chunk-SLL6V3AE.js} +12 -12
  7. package/dist/{chunk-E4SFK6AI.js → chunk-VICWT3WO.js} +281 -142
  8. package/dist/{chunk-R2EERZSW.js → chunk-YECQCT5N.js} +1 -1
  9. package/dist/client-exports.cjs +390 -283
  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 +214164 -1095
  22. package/dist/index.d.cts +215 -214
  23. package/dist/index.d.ts +215 -214
  24. package/dist/index.js +213657 -767
  25. package/dist/{schema-ULFEZCOL.d.cts → schema-CcSN2XcZ.d.cts} +54 -52
  26. package/dist/{schema-wbZXiVWb.d.ts → schema-D8h85qdU.d.ts} +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-HqRMF7sM.d.cts} +1775 -320
  32. package/dist/{utility-CyPQ1tC_.d.ts → utility-HqRMF7sM.d.ts} +1775 -320
  33. package/dist/utils/schema-conversion.js +1 -1
  34. package/dist/validation/index.cjs +445 -304
  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],
@@ -929,9 +896,13 @@ drizzleOrm.relations(
929
896
  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
- });
933
- var GraphStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true });
934
- var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true });
899
+ }).openapi("StopWhen");
900
+ var AgentStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true }).openapi(
901
+ "AgentStopWhen"
902
+ );
903
+ var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true }).openapi(
904
+ "SubAgentStopWhen"
905
+ );
935
906
  var MIN_ID_LENGTH = 1;
936
907
  var MAX_ID_LENGTH = 255;
937
908
  var URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
@@ -944,23 +915,23 @@ var resourceIdSchema = zodOpenapi.z.string().min(MIN_ID_LENGTH).max(MAX_ID_LENGT
944
915
  var ModelSettingsSchema = zodOpenapi.z.object({
945
916
  model: zodOpenapi.z.string().optional(),
946
917
  providerOptions: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.any()).optional()
947
- });
918
+ }).openapi("ModelSettings");
948
919
  var ModelSchema = zodOpenapi.z.object({
949
920
  base: ModelSettingsSchema.optional(),
950
921
  structuredOutput: ModelSettingsSchema.optional(),
951
922
  summarizer: ModelSettingsSchema.optional()
952
- });
923
+ }).openapi("Model");
953
924
  var ProjectModelSchema = zodOpenapi.z.object({
954
925
  base: ModelSettingsSchema,
955
926
  structuredOutput: ModelSettingsSchema.optional(),
956
927
  summarizer: ModelSettingsSchema.optional()
957
- });
928
+ }).openapi("ProjectModel");
958
929
  var SandboxConfigSchema = zodOpenapi.z.object({
959
930
  provider: zodOpenapi.z.enum(["vercel", "local"]),
960
931
  runtime: zodOpenapi.z.enum(["node22", "typescript"]),
961
932
  timeout: zodOpenapi.z.number().min(1e3).max(3e5).optional(),
962
933
  vcpus: zodOpenapi.z.number().min(1).max(8).optional()
963
- });
934
+ }).openapi("SandboxConfig");
964
935
  zodOpenapi.z.object({
965
936
  name: zodOpenapi.z.string(),
966
937
  description: zodOpenapi.z.string(),
@@ -971,31 +942,37 @@ zodOpenapi.z.object({
971
942
  var createApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
972
943
  var createApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
973
944
  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();
945
+ var createAgentScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
946
+ var createAgentScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
947
+ var createAgentScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true }).partial();
977
948
  var SubAgentSelectSchema = drizzleZod.createSelectSchema(subAgents);
978
949
  var SubAgentInsertSchema = drizzleZod.createInsertSchema(subAgents).extend({
979
950
  id: resourceIdSchema,
980
951
  models: ModelSchema.optional()
981
952
  });
982
953
  var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
983
- var SubAgentApiSelectSchema = createGraphScopedApiSchema(SubAgentSelectSchema);
984
- var SubAgentApiInsertSchema = createGraphScopedApiInsertSchema(SubAgentInsertSchema);
985
- createGraphScopedApiUpdateSchema(SubAgentUpdateSchema);
954
+ var SubAgentApiSelectSchema = createAgentScopedApiSchema(SubAgentSelectSchema).openapi(
955
+ "SubAgent"
956
+ );
957
+ var SubAgentApiInsertSchema = createAgentScopedApiInsertSchema(
958
+ SubAgentInsertSchema
959
+ ).openapi("SubAgentCreate");
960
+ createAgentScopedApiUpdateSchema(
961
+ SubAgentUpdateSchema
962
+ ).openapi("SubAgentUpdate");
986
963
  var SubAgentRelationSelectSchema = drizzleZod.createSelectSchema(subAgentRelations);
987
964
  var SubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
988
965
  id: resourceIdSchema,
989
- graphId: resourceIdSchema,
966
+ agentId: resourceIdSchema,
990
967
  sourceSubAgentId: resourceIdSchema,
991
968
  targetSubAgentId: resourceIdSchema.optional(),
992
969
  externalSubAgentId: resourceIdSchema.optional()
993
970
  });
994
971
  var SubAgentRelationUpdateSchema = SubAgentRelationInsertSchema.partial();
995
- createGraphScopedApiSchema(
972
+ var SubAgentRelationApiSelectSchema = createAgentScopedApiSchema(
996
973
  SubAgentRelationSelectSchema
997
- );
998
- createGraphScopedApiInsertSchema(
974
+ ).openapi("SubAgentRelation");
975
+ createAgentScopedApiInsertSchema(
999
976
  SubAgentRelationInsertSchema
1000
977
  ).extend({
1001
978
  relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES)
@@ -1009,8 +986,8 @@ createGraphScopedApiInsertSchema(
1009
986
  message: "Must specify exactly one of targetSubAgentId or externalSubAgentId",
1010
987
  path: ["targetSubAgentId", "externalSubAgentId"]
1011
988
  }
1012
- );
1013
- createGraphScopedApiUpdateSchema(
989
+ ).openapi("SubAgentRelationCreate");
990
+ createAgentScopedApiUpdateSchema(
1014
991
  SubAgentRelationUpdateSchema
1015
992
  ).extend({
1016
993
  relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES).optional()
@@ -1027,7 +1004,7 @@ createGraphScopedApiUpdateSchema(
1027
1004
  message: "Must specify exactly one of targetSubAgentId or externalSubAgentId when updating sub-agent relationships",
1028
1005
  path: ["targetSubAgentId", "externalSubAgentId"]
1029
1006
  }
1030
- );
1007
+ ).openapi("SubAgentRelationUpdate");
1031
1008
  zodOpenapi.z.object({
1032
1009
  sourceSubAgentId: zodOpenapi.z.string().optional(),
1033
1010
  targetSubAgentId: zodOpenapi.z.string().optional(),
@@ -1035,23 +1012,25 @@ zodOpenapi.z.object({
1035
1012
  });
1036
1013
  var ExternalSubAgentRelationInsertSchema = drizzleZod.createInsertSchema(subAgentRelations).extend({
1037
1014
  id: resourceIdSchema,
1038
- graphId: resourceIdSchema,
1015
+ agentId: resourceIdSchema,
1039
1016
  sourceSubAgentId: resourceIdSchema,
1040
1017
  externalSubAgentId: resourceIdSchema
1041
1018
  });
1042
1019
  createApiInsertSchema(
1043
1020
  ExternalSubAgentRelationInsertSchema
1044
1021
  );
1045
- var AgentGraphSelectSchema = drizzleZod.createSelectSchema(agentGraph);
1046
- var AgentGraphInsertSchema = drizzleZod.createInsertSchema(agentGraph).extend({
1022
+ var AgentSelectSchema = drizzleZod.createSelectSchema(agents);
1023
+ var AgentInsertSchema = drizzleZod.createInsertSchema(agents).extend({
1047
1024
  id: resourceIdSchema
1048
1025
  });
1049
- var AgentGraphUpdateSchema = AgentGraphInsertSchema.partial();
1050
- createApiSchema(AgentGraphSelectSchema);
1051
- var AgentGraphApiInsertSchema = createApiInsertSchema(AgentGraphInsertSchema).extend({
1026
+ var AgentUpdateSchema = AgentInsertSchema.partial();
1027
+ var AgentApiSelectSchema = createApiSchema(AgentSelectSchema).openapi("Agent");
1028
+ var AgentApiInsertSchema = createApiInsertSchema(AgentInsertSchema).extend({
1052
1029
  id: resourceIdSchema
1053
- });
1054
- createApiUpdateSchema(AgentGraphUpdateSchema);
1030
+ }).openapi("AgentCreate");
1031
+ createApiUpdateSchema(AgentUpdateSchema).openapi(
1032
+ "AgentUpdate"
1033
+ );
1055
1034
  var TaskSelectSchema = drizzleZod.createSelectSchema(tasks);
1056
1035
  var TaskInsertSchema = drizzleZod.createInsertSchema(tasks).extend({
1057
1036
  id: resourceIdSchema,
@@ -1094,9 +1073,12 @@ var McpTransportConfigSchema = zodOpenapi.z.object({
1094
1073
  type: zodOpenapi.z.enum(MCPTransportType),
1095
1074
  requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
1096
1075
  eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
1097
- reconnectionOptions: zodOpenapi.z.custom().optional(),
1076
+ reconnectionOptions: zodOpenapi.z.any().optional().openapi({
1077
+ type: "object",
1078
+ description: "Reconnection options for streamable HTTP transport"
1079
+ }),
1098
1080
  sessionId: zodOpenapi.z.string().optional()
1099
- });
1081
+ }).openapi("McpTransportConfig");
1100
1082
  var ToolStatusSchema = zodOpenapi.z.enum(TOOL_STATUS_VALUES);
1101
1083
  var McpToolDefinitionSchema = zodOpenapi.z.object({
1102
1084
  name: zodOpenapi.z.string(),
@@ -1111,13 +1093,16 @@ var ToolInsertSchema = drizzleZod.createInsertSchema(tools).extend({
1111
1093
  type: zodOpenapi.z.literal("mcp"),
1112
1094
  mcp: zodOpenapi.z.object({
1113
1095
  server: zodOpenapi.z.object({
1114
- url: zodOpenapi.z.string().url()
1096
+ url: zodOpenapi.z.url()
1115
1097
  }),
1116
1098
  transport: zodOpenapi.z.object({
1117
1099
  type: zodOpenapi.z.enum(MCPTransportType),
1118
1100
  requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
1119
1101
  eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
1120
- reconnectionOptions: zodOpenapi.z.custom().optional(),
1102
+ reconnectionOptions: zodOpenapi.z.any().optional().openapi({
1103
+ type: "object",
1104
+ description: "Reconnection options for streamable HTTP transport"
1105
+ }),
1121
1106
  sessionId: zodOpenapi.z.string().optional()
1122
1107
  }).optional(),
1123
1108
  activeTools: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
@@ -1130,9 +1115,15 @@ var ConversationInsertSchema = drizzleZod.createInsertSchema(conversations).exte
1130
1115
  contextConfigId: resourceIdSchema.optional()
1131
1116
  });
1132
1117
  var ConversationUpdateSchema = ConversationInsertSchema.partial();
1133
- createApiSchema(ConversationSelectSchema);
1134
- createApiInsertSchema(ConversationInsertSchema);
1135
- createApiUpdateSchema(ConversationUpdateSchema);
1118
+ var ConversationApiSelectSchema = createApiSchema(ConversationSelectSchema).openapi(
1119
+ "Conversation"
1120
+ );
1121
+ createApiInsertSchema(ConversationInsertSchema).openapi(
1122
+ "ConversationCreate"
1123
+ );
1124
+ createApiUpdateSchema(ConversationUpdateSchema).openapi(
1125
+ "ConversationUpdate"
1126
+ );
1136
1127
  var MessageSelectSchema = drizzleZod.createSelectSchema(messages);
1137
1128
  var MessageInsertSchema = drizzleZod.createInsertSchema(messages).extend({
1138
1129
  id: resourceIdSchema,
@@ -1140,9 +1131,13 @@ var MessageInsertSchema = drizzleZod.createInsertSchema(messages).extend({
1140
1131
  taskId: resourceIdSchema.optional()
1141
1132
  });
1142
1133
  var MessageUpdateSchema = MessageInsertSchema.partial();
1143
- createApiSchema(MessageSelectSchema);
1144
- createApiInsertSchema(MessageInsertSchema);
1145
- createApiUpdateSchema(MessageUpdateSchema);
1134
+ var MessageApiSelectSchema = createApiSchema(MessageSelectSchema).openapi("Message");
1135
+ createApiInsertSchema(MessageInsertSchema).openapi(
1136
+ "MessageCreate"
1137
+ );
1138
+ createApiUpdateSchema(MessageUpdateSchema).openapi(
1139
+ "MessageUpdate"
1140
+ );
1146
1141
  var ContextCacheSelectSchema = drizzleZod.createSelectSchema(contextCache);
1147
1142
  var ContextCacheInsertSchema = drizzleZod.createInsertSchema(contextCache);
1148
1143
  var ContextCacheUpdateSchema = ContextCacheInsertSchema.partial();
@@ -1158,13 +1153,19 @@ DataComponentInsertSchema.omit({
1158
1153
  updatedAt: true
1159
1154
  });
1160
1155
  var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
1161
- createApiSchema(DataComponentSelectSchema);
1162
- var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema);
1163
- createApiUpdateSchema(DataComponentUpdateSchema);
1156
+ var DataComponentApiSelectSchema = createApiSchema(
1157
+ DataComponentSelectSchema
1158
+ ).openapi("DataComponent");
1159
+ var DataComponentApiInsertSchema = createApiInsertSchema(
1160
+ DataComponentInsertSchema
1161
+ ).openapi("DataComponentCreate");
1162
+ createApiUpdateSchema(
1163
+ DataComponentUpdateSchema
1164
+ ).openapi("DataComponentUpdate");
1164
1165
  var SubAgentDataComponentSelectSchema = drizzleZod.createSelectSchema(subAgentDataComponents);
1165
1166
  var SubAgentDataComponentInsertSchema = drizzleZod.createInsertSchema(subAgentDataComponents);
1166
1167
  var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
1167
- createGraphScopedApiSchema(
1168
+ var SubAgentDataComponentApiSelectSchema = createAgentScopedApiSchema(
1168
1169
  SubAgentDataComponentSelectSchema
1169
1170
  );
1170
1171
  SubAgentDataComponentInsertSchema.omit({
@@ -1173,7 +1174,7 @@ SubAgentDataComponentInsertSchema.omit({
1173
1174
  id: true,
1174
1175
  createdAt: true
1175
1176
  });
1176
- createGraphScopedApiUpdateSchema(
1177
+ createAgentScopedApiUpdateSchema(
1177
1178
  SubAgentDataComponentUpdateSchema
1178
1179
  );
1179
1180
  var ArtifactComponentSelectSchema = drizzleZod.createSelectSchema(artifactComponents);
@@ -1181,16 +1182,18 @@ var ArtifactComponentInsertSchema = drizzleZod.createInsertSchema(artifactCompon
1181
1182
  id: resourceIdSchema
1182
1183
  });
1183
1184
  var ArtifactComponentUpdateSchema = ArtifactComponentInsertSchema.partial();
1184
- createApiSchema(ArtifactComponentSelectSchema);
1185
+ var ArtifactComponentApiSelectSchema = createApiSchema(
1186
+ ArtifactComponentSelectSchema
1187
+ ).openapi("ArtifactComponent");
1185
1188
  var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
1186
1189
  tenantId: true,
1187
1190
  projectId: true,
1188
1191
  createdAt: true,
1189
1192
  updatedAt: true
1190
- });
1193
+ }).openapi("ArtifactComponentCreate");
1191
1194
  createApiUpdateSchema(
1192
1195
  ArtifactComponentUpdateSchema
1193
- );
1196
+ ).openapi("ArtifactComponentUpdate");
1194
1197
  var SubAgentArtifactComponentSelectSchema = drizzleZod.createSelectSchema(subAgentArtifactComponents);
1195
1198
  var SubAgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
1196
1199
  subAgentArtifactComponents
@@ -1200,7 +1203,7 @@ var SubAgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
1200
1203
  artifactComponentId: resourceIdSchema
1201
1204
  });
1202
1205
  var SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentInsertSchema.partial();
1203
- createGraphScopedApiSchema(
1206
+ var SubAgentArtifactComponentApiSelectSchema = createAgentScopedApiSchema(
1204
1207
  SubAgentArtifactComponentSelectSchema
1205
1208
  );
1206
1209
  SubAgentArtifactComponentInsertSchema.omit({
@@ -1209,7 +1212,7 @@ SubAgentArtifactComponentInsertSchema.omit({
1209
1212
  id: true,
1210
1213
  createdAt: true
1211
1214
  });
1212
- createGraphScopedApiUpdateSchema(
1215
+ createAgentScopedApiUpdateSchema(
1213
1216
  SubAgentArtifactComponentUpdateSchema
1214
1217
  );
1215
1218
  var ExternalAgentSelectSchema = drizzleZod.createSelectSchema(externalAgents).extend({
@@ -1220,9 +1223,15 @@ var ExternalAgentInsertSchema = drizzleZod.createInsertSchema(externalAgents).ex
1220
1223
  id: resourceIdSchema
1221
1224
  });
1222
1225
  var ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
1223
- var ExternalAgentApiSelectSchema = createGraphScopedApiSchema(ExternalAgentSelectSchema);
1224
- var ExternalAgentApiInsertSchema = createGraphScopedApiInsertSchema(ExternalAgentInsertSchema);
1225
- createGraphScopedApiUpdateSchema(ExternalAgentUpdateSchema);
1226
+ var ExternalAgentApiSelectSchema = createAgentScopedApiSchema(
1227
+ ExternalAgentSelectSchema
1228
+ ).openapi("ExternalAgent");
1229
+ var ExternalAgentApiInsertSchema = createAgentScopedApiInsertSchema(
1230
+ ExternalAgentInsertSchema
1231
+ ).openapi("ExternalAgentCreate");
1232
+ createAgentScopedApiUpdateSchema(
1233
+ ExternalAgentUpdateSchema
1234
+ ).openapi("ExternalAgentUpdate");
1226
1235
  zodOpenapi.z.discriminatedUnion("type", [
1227
1236
  SubAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
1228
1237
  ExternalAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("external") })
@@ -1230,9 +1239,9 @@ zodOpenapi.z.discriminatedUnion("type", [
1230
1239
  var ApiKeySelectSchema = drizzleZod.createSelectSchema(apiKeys);
1231
1240
  var ApiKeyInsertSchema = drizzleZod.createInsertSchema(apiKeys).extend({
1232
1241
  id: resourceIdSchema,
1233
- graphId: resourceIdSchema
1242
+ agentId: resourceIdSchema
1234
1243
  });
1235
- ApiKeyInsertSchema.partial().omit({
1244
+ var ApiKeyUpdateSchema = ApiKeyInsertSchema.partial().omit({
1236
1245
  tenantId: true,
1237
1246
  projectId: true,
1238
1247
  id: true,
@@ -1246,7 +1255,7 @@ var ApiKeyApiSelectSchema = ApiKeySelectSchema.omit({
1246
1255
  projectId: true,
1247
1256
  keyHash: true
1248
1257
  // Never expose the hash
1249
- });
1258
+ }).openapi("ApiKey");
1250
1259
  zodOpenapi.z.object({
1251
1260
  data: zodOpenapi.z.object({
1252
1261
  apiKey: ApiKeyApiSelectSchema,
@@ -1266,7 +1275,8 @@ ApiKeyInsertSchema.omit({
1266
1275
  // Auto-generated
1267
1276
  lastUsedAt: true
1268
1277
  // Not set on creation
1269
- });
1278
+ }).openapi("ApiKeyCreate");
1279
+ ApiKeyUpdateSchema.openapi("ApiKeyUpdate");
1270
1280
  var CredentialReferenceSelectSchema = zodOpenapi.z.object({
1271
1281
  id: zodOpenapi.z.string(),
1272
1282
  tenantId: zodOpenapi.z.string(),
@@ -1284,22 +1294,22 @@ var CredentialReferenceInsertSchema = drizzleZod.createInsertSchema(credentialRe
1284
1294
  retrievalParams: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).nullish()
1285
1295
  });
1286
1296
  var CredentialReferenceUpdateSchema = CredentialReferenceInsertSchema.partial();
1287
- createApiSchema(
1297
+ var CredentialReferenceApiSelectSchema = createApiSchema(
1288
1298
  CredentialReferenceSelectSchema
1289
1299
  ).extend({
1290
1300
  type: zodOpenapi.z.enum(CredentialStoreType),
1291
1301
  tools: zodOpenapi.z.array(ToolSelectSchema).optional()
1292
- });
1302
+ }).openapi("CredentialReference");
1293
1303
  var CredentialReferenceApiInsertSchema = createApiInsertSchema(
1294
1304
  CredentialReferenceInsertSchema
1295
1305
  ).extend({
1296
1306
  type: zodOpenapi.z.enum(CredentialStoreType)
1297
- });
1307
+ }).openapi("CredentialReferenceCreate");
1298
1308
  createApiUpdateSchema(
1299
1309
  CredentialReferenceUpdateSchema
1300
1310
  ).extend({
1301
1311
  type: zodOpenapi.z.enum(CredentialStoreType).optional()
1302
- });
1312
+ }).openapi("CredentialReferenceUpdate");
1303
1313
  var McpToolSchema = ToolInsertSchema.extend({
1304
1314
  imageUrl: imageUrlSchema,
1305
1315
  availableTools: zodOpenapi.z.array(McpToolDefinitionSchema).optional(),
@@ -1328,25 +1338,35 @@ McpToolSchema.omit({
1328
1338
  credential: CredentialReferenceApiInsertSchema.optional()
1329
1339
  });
1330
1340
  var ToolUpdateSchema = ToolInsertSchema.partial();
1331
- createApiSchema(ToolSelectSchema);
1332
- var ToolApiInsertSchema = createApiInsertSchema(ToolInsertSchema);
1333
- createApiUpdateSchema(ToolUpdateSchema);
1341
+ var ToolApiSelectSchema = createApiSchema(ToolSelectSchema).openapi("Tool");
1342
+ var ToolApiInsertSchema = createApiInsertSchema(ToolInsertSchema).openapi("ToolCreate");
1343
+ createApiUpdateSchema(ToolUpdateSchema).openapi("ToolUpdate");
1334
1344
  var FunctionToolSelectSchema = drizzleZod.createSelectSchema(functionTools);
1335
1345
  var FunctionToolInsertSchema = drizzleZod.createInsertSchema(functionTools).extend({
1336
1346
  id: resourceIdSchema
1337
1347
  });
1338
1348
  var FunctionToolUpdateSchema = FunctionToolInsertSchema.partial();
1339
- createApiSchema(FunctionToolSelectSchema);
1340
- var FunctionToolApiInsertSchema = createGraphScopedApiInsertSchema(FunctionToolInsertSchema);
1341
- createApiUpdateSchema(FunctionToolUpdateSchema);
1349
+ var FunctionToolApiSelectSchema = createApiSchema(FunctionToolSelectSchema).openapi(
1350
+ "FunctionTool"
1351
+ );
1352
+ var FunctionToolApiInsertSchema = createAgentScopedApiInsertSchema(
1353
+ FunctionToolInsertSchema
1354
+ ).openapi("FunctionToolCreate");
1355
+ createApiUpdateSchema(
1356
+ FunctionToolUpdateSchema
1357
+ ).openapi("FunctionToolUpdate");
1342
1358
  var FunctionSelectSchema = drizzleZod.createSelectSchema(functions);
1343
1359
  var FunctionInsertSchema = drizzleZod.createInsertSchema(functions).extend({
1344
1360
  id: resourceIdSchema
1345
1361
  });
1346
1362
  var FunctionUpdateSchema = FunctionInsertSchema.partial();
1347
- var FunctionApiSelectSchema = createApiSchema(FunctionSelectSchema);
1348
- var FunctionApiInsertSchema = createApiInsertSchema(FunctionInsertSchema);
1349
- var FunctionApiUpdateSchema = createApiUpdateSchema(FunctionUpdateSchema);
1363
+ var FunctionApiSelectSchema = createApiSchema(FunctionSelectSchema).openapi("Function");
1364
+ var FunctionApiInsertSchema = createApiInsertSchema(FunctionInsertSchema).openapi(
1365
+ "FunctionCreate"
1366
+ );
1367
+ var FunctionApiUpdateSchema = createApiUpdateSchema(FunctionUpdateSchema).openapi(
1368
+ "FunctionUpdate"
1369
+ );
1350
1370
  var FetchConfigSchema = zodOpenapi.z.object({
1351
1371
  url: zodOpenapi.z.string().min(1, "URL is required"),
1352
1372
  method: zodOpenapi.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).optional().default("GET"),
@@ -1355,7 +1375,7 @@ var FetchConfigSchema = zodOpenapi.z.object({
1355
1375
  transform: zodOpenapi.z.string().optional(),
1356
1376
  // JSONPath or JS transform function
1357
1377
  timeout: zodOpenapi.z.number().min(0).optional().default(1e4).optional()
1358
- });
1378
+ }).openapi("FetchConfig");
1359
1379
  zodOpenapi.z.object({
1360
1380
  id: zodOpenapi.z.string().min(1, "Fetch definition ID is required"),
1361
1381
  name: zodOpenapi.z.string().optional(),
@@ -1363,29 +1383,41 @@ zodOpenapi.z.object({
1363
1383
  fetchConfig: FetchConfigSchema,
1364
1384
  responseSchema: zodOpenapi.z.any().optional(),
1365
1385
  // JSON Schema for validating HTTP response
1366
- defaultValue: zodOpenapi.z.unknown().optional(),
1386
+ defaultValue: zodOpenapi.z.any().optional().openapi({
1387
+ description: "Default value if fetch fails"
1388
+ }),
1367
1389
  credential: CredentialReferenceApiInsertSchema.optional()
1368
- });
1390
+ }).openapi("FetchDefinition");
1369
1391
  var ContextConfigSelectSchema = drizzleZod.createSelectSchema(contextConfigs).extend({
1370
- headersSchema: zodOpenapi.z.unknown().optional()
1392
+ headersSchema: zodOpenapi.z.any().optional().openapi({
1393
+ type: "object",
1394
+ description: "JSON Schema for validating request headers"
1395
+ })
1371
1396
  });
1372
1397
  var ContextConfigInsertSchema = drizzleZod.createInsertSchema(contextConfigs).extend({
1373
1398
  id: resourceIdSchema.optional(),
1374
- headersSchema: zodOpenapi.z.unknown().optional()
1399
+ headersSchema: zodOpenapi.z.any().nullable().optional().openapi({
1400
+ type: "object",
1401
+ description: "JSON Schema for validating request headers"
1402
+ }),
1403
+ contextVariables: zodOpenapi.z.any().nullable().optional().openapi({
1404
+ type: "object",
1405
+ description: "Context variables configuration with fetch definitions"
1406
+ })
1375
1407
  }).omit({
1376
1408
  createdAt: true,
1377
1409
  updatedAt: true
1378
1410
  });
1379
1411
  var ContextConfigUpdateSchema = ContextConfigInsertSchema.partial();
1380
- createApiSchema(ContextConfigSelectSchema).omit({
1381
- graphId: true
1382
- });
1412
+ var ContextConfigApiSelectSchema = createApiSchema(ContextConfigSelectSchema).omit({
1413
+ agentId: true
1414
+ }).openapi("ContextConfig");
1383
1415
  var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSchema).omit({
1384
- graphId: true
1385
- });
1416
+ agentId: true
1417
+ }).openapi("ContextConfigCreate");
1386
1418
  createApiUpdateSchema(ContextConfigUpdateSchema).omit({
1387
- graphId: true
1388
- });
1419
+ agentId: true
1420
+ }).openapi("ContextConfigUpdate");
1389
1421
  var SubAgentToolRelationSelectSchema = drizzleZod.createSelectSchema(subAgentToolRelations);
1390
1422
  var SubAgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToolRelations).extend({
1391
1423
  id: resourceIdSchema,
@@ -1395,15 +1427,15 @@ var SubAgentToolRelationInsertSchema = drizzleZod.createInsertSchema(subAgentToo
1395
1427
  headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
1396
1428
  });
1397
1429
  var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
1398
- createGraphScopedApiSchema(
1430
+ var SubAgentToolRelationApiSelectSchema = createAgentScopedApiSchema(
1399
1431
  SubAgentToolRelationSelectSchema
1400
- );
1401
- createGraphScopedApiInsertSchema(
1432
+ ).openapi("SubAgentToolRelation");
1433
+ createAgentScopedApiInsertSchema(
1402
1434
  SubAgentToolRelationInsertSchema
1403
- );
1404
- createGraphScopedApiUpdateSchema(
1435
+ ).openapi("SubAgentToolRelationCreate");
1436
+ createAgentScopedApiUpdateSchema(
1405
1437
  SubAgentToolRelationUpdateSchema
1406
- );
1438
+ ).openapi("SubAgentToolRelationUpdate");
1407
1439
  var LedgerArtifactSelectSchema = drizzleZod.createSelectSchema(ledgerArtifacts);
1408
1440
  var LedgerArtifactInsertSchema = drizzleZod.createInsertSchema(ledgerArtifacts);
1409
1441
  var LedgerArtifactUpdateSchema = LedgerArtifactInsertSchema.partial();
@@ -1418,21 +1450,21 @@ var StatusComponentSchema = zodOpenapi.z.object({
1418
1450
  properties: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.any()),
1419
1451
  required: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
1420
1452
  }).optional()
1421
- });
1453
+ }).openapi("StatusComponent");
1422
1454
  var StatusUpdateSchema = zodOpenapi.z.object({
1423
1455
  enabled: zodOpenapi.z.boolean().optional(),
1424
1456
  numEvents: zodOpenapi.z.number().min(1).max(100).optional(),
1425
1457
  timeInSeconds: zodOpenapi.z.number().min(1).max(600).optional(),
1426
1458
  prompt: zodOpenapi.z.string().max(2e3, "Custom prompt cannot exceed 2000 characters").optional(),
1427
1459
  statusComponents: zodOpenapi.z.array(StatusComponentSchema).optional()
1428
- });
1460
+ }).openapi("StatusUpdate");
1429
1461
  var CanUseItemSchema = zodOpenapi.z.object({
1430
1462
  agentToolRelationId: zodOpenapi.z.string().optional(),
1431
1463
  toolId: zodOpenapi.z.string(),
1432
1464
  toolSelection: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
1433
1465
  headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
1434
- });
1435
- var FullGraphAgentInsertSchema = SubAgentApiInsertSchema.extend({
1466
+ }).openapi("CanUseItem");
1467
+ var FullAgentAgentInsertSchema = SubAgentApiInsertSchema.extend({
1436
1468
  type: zodOpenapi.z.literal("internal"),
1437
1469
  canUse: zodOpenapi.z.array(CanUseItemSchema),
1438
1470
  // All tools (both MCP and function tools)
@@ -1441,63 +1473,44 @@ var FullGraphAgentInsertSchema = SubAgentApiInsertSchema.extend({
1441
1473
  canTransferTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
1442
1474
  canDelegateTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
1443
1475
  });
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({
1476
+ var AgentWithinContextOfProjectSchema = AgentApiInsertSchema.extend({
1463
1477
  subAgents: zodOpenapi.z.record(
1464
1478
  zodOpenapi.z.string(),
1465
- zodOpenapi.z.discriminatedUnion("type", [
1466
- FullGraphAgentInsertSchema,
1467
- ExternalAgentApiInsertSchema.extend({ type: zodOpenapi.z.literal("external") })
1468
- ])
1479
+ zodOpenapi.z.union([FullAgentAgentInsertSchema, ExternalAgentApiInsertSchema])
1469
1480
  ),
1470
1481
  // Lookup maps for UI to resolve canUse items
1471
1482
  tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
1472
1483
  // MCP tools (project-scoped)
1473
1484
  functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
1474
- // Function tools (graph-scoped)
1485
+ // Function tools (agent-scoped)
1475
1486
  functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
1476
1487
  // Get function code for function tools
1477
1488
  contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
1478
1489
  statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
1479
1490
  models: ModelSchema.optional(),
1480
- stopWhen: GraphStopWhenSchema.optional(),
1481
- graphPrompt: zodOpenapi.z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
1491
+ stopWhen: AgentStopWhenSchema.optional(),
1492
+ prompt: zodOpenapi.z.string().max(5e3, "Agent prompt cannot exceed 5000 characters").optional()
1482
1493
  });
1483
- zodOpenapi.z.object({
1494
+ var PaginationSchema = zodOpenapi.z.object({
1484
1495
  page: zodOpenapi.z.coerce.number().min(1).default(1),
1485
1496
  limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10),
1486
1497
  total: zodOpenapi.z.number(),
1487
1498
  pages: zodOpenapi.z.number()
1488
- });
1499
+ }).openapi("Pagination");
1489
1500
  zodOpenapi.z.object({
1490
1501
  error: zodOpenapi.z.string(),
1491
1502
  message: zodOpenapi.z.string().optional(),
1492
- details: zodOpenapi.z.unknown().optional()
1493
- });
1503
+ details: zodOpenapi.z.any().optional().openapi({
1504
+ description: "Additional error details"
1505
+ })
1506
+ }).openapi("ErrorResponse");
1494
1507
  zodOpenapi.z.object({
1495
1508
  exists: zodOpenapi.z.boolean()
1496
- });
1509
+ }).openapi("ExistsResponse");
1497
1510
  zodOpenapi.z.object({
1498
1511
  message: zodOpenapi.z.string(),
1499
1512
  removed: zodOpenapi.z.boolean()
1500
- });
1513
+ }).openapi("RemovedResponse");
1501
1514
  var ProjectSelectSchema = drizzleZod.createSelectSchema(projects);
1502
1515
  var ProjectInsertSchema = drizzleZod.createInsertSchema(projects).extend({
1503
1516
  models: ProjectModelSchema,
@@ -1508,15 +1521,19 @@ var ProjectInsertSchema = drizzleZod.createInsertSchema(projects).extend({
1508
1521
  updatedAt: true
1509
1522
  });
1510
1523
  var ProjectUpdateSchema = ProjectInsertSchema.partial();
1511
- ProjectSelectSchema.omit({ tenantId: true });
1512
- var ProjectApiInsertSchema = ProjectInsertSchema.omit({ tenantId: true });
1513
- ProjectUpdateSchema.omit({ tenantId: true });
1524
+ var ProjectApiSelectSchema = ProjectSelectSchema.omit({ tenantId: true }).openapi(
1525
+ "Project"
1526
+ );
1527
+ var ProjectApiInsertSchema = ProjectInsertSchema.omit({ tenantId: true }).openapi(
1528
+ "ProjectCreate"
1529
+ );
1530
+ ProjectUpdateSchema.omit({ tenantId: true }).openapi(
1531
+ "ProjectUpdate"
1532
+ );
1514
1533
  ProjectApiInsertSchema.extend({
1515
- graphs: zodOpenapi.z.record(zodOpenapi.z.string(), GraphWithinContextOfProjectSchema),
1534
+ agents: zodOpenapi.z.record(zodOpenapi.z.string(), AgentWithinContextOfProjectSchema),
1516
1535
  tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema),
1517
- // MCP tools (project-scoped)
1518
1536
  functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
1519
- // Functions (project-scoped)
1520
1537
  dataComponents: zodOpenapi.z.record(zodOpenapi.z.string(), DataComponentApiInsertSchema).optional(),
1521
1538
  artifactComponents: zodOpenapi.z.record(zodOpenapi.z.string(), ArtifactComponentApiInsertSchema).optional(),
1522
1539
  statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
@@ -1524,6 +1541,96 @@ ProjectApiInsertSchema.extend({
1524
1541
  createdAt: zodOpenapi.z.string().optional(),
1525
1542
  updatedAt: zodOpenapi.z.string().optional()
1526
1543
  });
1544
+ zodOpenapi.z.object({ data: ProjectApiSelectSchema }).openapi("ProjectResponse");
1545
+ zodOpenapi.z.object({ data: SubAgentApiSelectSchema }).openapi("SubAgentResponse");
1546
+ zodOpenapi.z.object({ data: AgentApiSelectSchema }).openapi("AgentResponse");
1547
+ zodOpenapi.z.object({ data: ToolApiSelectSchema }).openapi("ToolResponse");
1548
+ zodOpenapi.z.object({ data: ExternalAgentApiSelectSchema }).openapi("ExternalAgentResponse");
1549
+ zodOpenapi.z.object({ data: ContextConfigApiSelectSchema }).openapi("ContextConfigResponse");
1550
+ zodOpenapi.z.object({ data: ApiKeyApiSelectSchema }).openapi("ApiKeyResponse");
1551
+ zodOpenapi.z.object({ data: CredentialReferenceApiSelectSchema }).openapi("CredentialReferenceResponse");
1552
+ zodOpenapi.z.object({ data: FunctionApiSelectSchema }).openapi("FunctionResponse");
1553
+ zodOpenapi.z.object({ data: FunctionToolApiSelectSchema }).openapi("FunctionToolResponse");
1554
+ zodOpenapi.z.object({ data: DataComponentApiSelectSchema }).openapi("DataComponentResponse");
1555
+ zodOpenapi.z.object({ data: ArtifactComponentApiSelectSchema }).openapi("ArtifactComponentResponse");
1556
+ zodOpenapi.z.object({ data: SubAgentRelationApiSelectSchema }).openapi("SubAgentRelationResponse");
1557
+ zodOpenapi.z.object({ data: SubAgentToolRelationApiSelectSchema }).openapi("SubAgentToolRelationResponse");
1558
+ zodOpenapi.z.object({ data: ConversationApiSelectSchema }).openapi("ConversationResponse");
1559
+ zodOpenapi.z.object({ data: MessageApiSelectSchema }).openapi("MessageResponse");
1560
+ zodOpenapi.z.object({
1561
+ data: zodOpenapi.z.array(ProjectApiSelectSchema),
1562
+ pagination: PaginationSchema
1563
+ }).openapi("ProjectListResponse");
1564
+ zodOpenapi.z.object({
1565
+ data: zodOpenapi.z.array(SubAgentApiSelectSchema),
1566
+ pagination: PaginationSchema
1567
+ }).openapi("SubAgentListResponse");
1568
+ zodOpenapi.z.object({
1569
+ data: zodOpenapi.z.array(AgentApiSelectSchema),
1570
+ pagination: PaginationSchema
1571
+ }).openapi("AgentListResponse");
1572
+ zodOpenapi.z.object({
1573
+ data: zodOpenapi.z.array(ToolApiSelectSchema),
1574
+ pagination: PaginationSchema
1575
+ }).openapi("ToolListResponse");
1576
+ zodOpenapi.z.object({
1577
+ data: zodOpenapi.z.array(ExternalAgentApiSelectSchema),
1578
+ pagination: PaginationSchema
1579
+ }).openapi("ExternalAgentListResponse");
1580
+ zodOpenapi.z.object({
1581
+ data: zodOpenapi.z.array(ContextConfigApiSelectSchema),
1582
+ pagination: PaginationSchema
1583
+ }).openapi("ContextConfigListResponse");
1584
+ zodOpenapi.z.object({
1585
+ data: zodOpenapi.z.array(ApiKeyApiSelectSchema),
1586
+ pagination: PaginationSchema
1587
+ }).openapi("ApiKeyListResponse");
1588
+ zodOpenapi.z.object({
1589
+ data: zodOpenapi.z.array(CredentialReferenceApiSelectSchema),
1590
+ pagination: PaginationSchema
1591
+ }).openapi("CredentialReferenceListResponse");
1592
+ zodOpenapi.z.object({
1593
+ data: zodOpenapi.z.array(FunctionApiSelectSchema),
1594
+ pagination: PaginationSchema
1595
+ }).openapi("FunctionListResponse");
1596
+ zodOpenapi.z.object({
1597
+ data: zodOpenapi.z.array(FunctionToolApiSelectSchema),
1598
+ pagination: PaginationSchema
1599
+ }).openapi("FunctionToolListResponse");
1600
+ zodOpenapi.z.object({
1601
+ data: zodOpenapi.z.array(DataComponentApiSelectSchema),
1602
+ pagination: PaginationSchema
1603
+ }).openapi("DataComponentListResponse");
1604
+ zodOpenapi.z.object({
1605
+ data: zodOpenapi.z.array(ArtifactComponentApiSelectSchema),
1606
+ pagination: PaginationSchema
1607
+ }).openapi("ArtifactComponentListResponse");
1608
+ zodOpenapi.z.object({
1609
+ data: zodOpenapi.z.array(SubAgentRelationApiSelectSchema),
1610
+ pagination: PaginationSchema
1611
+ }).openapi("SubAgentRelationListResponse");
1612
+ zodOpenapi.z.object({
1613
+ data: zodOpenapi.z.array(SubAgentToolRelationApiSelectSchema),
1614
+ pagination: PaginationSchema
1615
+ }).openapi("SubAgentToolRelationListResponse");
1616
+ zodOpenapi.z.object({
1617
+ data: zodOpenapi.z.array(ConversationApiSelectSchema),
1618
+ pagination: PaginationSchema
1619
+ }).openapi("ConversationListResponse");
1620
+ zodOpenapi.z.object({
1621
+ data: zodOpenapi.z.array(MessageApiSelectSchema),
1622
+ pagination: PaginationSchema
1623
+ }).openapi("MessageListResponse");
1624
+ zodOpenapi.z.object({ data: SubAgentDataComponentApiSelectSchema }).openapi("SubAgentDataComponentResponse");
1625
+ zodOpenapi.z.object({ data: SubAgentArtifactComponentApiSelectSchema }).openapi("SubAgentArtifactComponentResponse");
1626
+ zodOpenapi.z.object({
1627
+ data: zodOpenapi.z.array(SubAgentDataComponentApiSelectSchema),
1628
+ pagination: PaginationSchema
1629
+ }).openapi("SubAgentDataComponentListResponse");
1630
+ zodOpenapi.z.object({
1631
+ data: zodOpenapi.z.array(SubAgentArtifactComponentApiSelectSchema),
1632
+ pagination: PaginationSchema
1633
+ }).openapi("SubAgentArtifactComponentListResponse");
1527
1634
  zodOpenapi.z.object({
1528
1635
  "x-inkeep-tenant-id": zodOpenapi.z.string().optional().openapi({
1529
1636
  description: "Tenant identifier",
@@ -1533,9 +1640,9 @@ zodOpenapi.z.object({
1533
1640
  description: "Project identifier",
1534
1641
  example: "project_456"
1535
1642
  }),
1536
- "x-inkeep-graph-id": zodOpenapi.z.string().optional().openapi({
1537
- description: "Graph identifier",
1538
- example: "graph_789"
1643
+ "x-inkeep-agent-id": zodOpenapi.z.string().optional().openapi({
1644
+ description: "Agent identifier",
1645
+ example: "agent_789"
1539
1646
  })
1540
1647
  });
1541
1648
  var TenantId = zodOpenapi.z.string().openapi({
@@ -1546,9 +1653,9 @@ var ProjectId = zodOpenapi.z.string().openapi({
1546
1653
  description: "Project identifier",
1547
1654
  example: "project_456"
1548
1655
  });
1549
- var GraphId = zodOpenapi.z.string().openapi({
1550
- description: "Graph identifier",
1551
- example: "graph_789"
1656
+ var AgentId = zodOpenapi.z.string().openapi({
1657
+ description: "Agent identifier",
1658
+ example: "agent_789"
1552
1659
  });
1553
1660
  var SubAgentId = zodOpenapi.z.string().openapi({
1554
1661
  description: "Sub-agent identifier",
@@ -1566,18 +1673,18 @@ var TenantProjectParamsSchema = TenantParamsSchema.extend({
1566
1673
  TenantProjectParamsSchema.extend({
1567
1674
  id: resourceIdSchema
1568
1675
  }).openapi("TenantProjectIdParams");
1569
- var TenantProjectGraphParamsSchema = TenantProjectParamsSchema.extend({
1570
- graphId: GraphId
1571
- }).openapi("TenantProjectGraphParams");
1572
- TenantProjectGraphParamsSchema.extend({
1676
+ var TenantProjectAgentParamsSchema = TenantProjectParamsSchema.extend({
1677
+ agentId: AgentId
1678
+ }).openapi("TenantProjectAgentParams");
1679
+ TenantProjectAgentParamsSchema.extend({
1573
1680
  id: resourceIdSchema
1574
- }).openapi("TenantProjectGraphIdParams");
1575
- var TenantProjectGraphSubAgentParamsSchema = TenantProjectGraphParamsSchema.extend({
1681
+ }).openapi("TenantProjectAgentIdParams");
1682
+ var TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentParamsSchema.extend({
1576
1683
  subAgentId: SubAgentId
1577
- }).openapi("TenantProjectGraphSubAgentParams");
1578
- TenantProjectGraphSubAgentParamsSchema.extend({
1684
+ }).openapi("TenantProjectAgentSubAgentParams");
1685
+ TenantProjectAgentSubAgentParamsSchema.extend({
1579
1686
  id: resourceIdSchema
1580
- }).openapi("TenantProjectGraphSubAgentIdParams");
1687
+ }).openapi("TenantProjectAgentSubAgentIdParams");
1581
1688
  zodOpenapi.z.object({
1582
1689
  page: zodOpenapi.z.coerce.number().min(1).default(1),
1583
1690
  limit: zodOpenapi.z.coerce.number().min(1).max(100).default(10)
@@ -1697,7 +1804,7 @@ var SPAN_NAMES = {
1697
1804
  CONTEXT_HANDLE: "context.handle_context_resolution",
1698
1805
  AGENT_GENERATION: "agent.generate",
1699
1806
  CONTEXT_FETCHER: "context-fetcher.http-request",
1700
- ARTIFACT_PROCESSING: "graph_session.process_artifact"
1807
+ ARTIFACT_PROCESSING: "agent_session.process_artifact"
1701
1808
  };
1702
1809
  var AI_OPERATIONS = {
1703
1810
  GENERATE_TEXT: "ai.generateText.doGenerate",
@@ -1713,14 +1820,14 @@ var SPAN_KEYS = {
1713
1820
  STATUS_MESSAGE: "status_message",
1714
1821
  OTEL_STATUS_CODE: "otel.status_code",
1715
1822
  OTEL_STATUS_DESCRIPTION: "otel.status_description",
1716
- // Graph attributes
1717
- GRAPH_ID: "graph.id",
1718
- GRAPH_NAME: "graph.name",
1823
+ // Agent attributesa
1824
+ AGENT_ID: "agent.id",
1825
+ AGENT_NAME: "agent.name",
1719
1826
  TENANT_ID: "tenant.id",
1720
1827
  PROJECT_ID: "project.id",
1721
1828
  // AI/Agent attributes
1722
- AI_AGENT_NAME: "ai.agentName",
1723
- AI_AGENT_NAME_ALT: "ai.agent.name",
1829
+ AI_SUB_AGENT_NAME: "ai.subAgentName",
1830
+ AI_SUB_AGENT_NAME_ALT: "ai.subAgent.name",
1724
1831
  AI_OPERATION_ID: "ai.operationId",
1725
1832
  AI_RESPONSE_TIMESTAMP: "ai.response.timestamp",
1726
1833
  AI_RESPONSE_CONTENT: "ai.response.content",
@@ -1738,16 +1845,16 @@ var SPAN_KEYS = {
1738
1845
  AI_TOOL_CALL_ID: "ai.toolCall.id",
1739
1846
  AI_TOOL_TYPE: "ai.toolType",
1740
1847
  TOOL_PURPOSE: "tool.purpose",
1741
- // Agent attributes
1742
- AGENT_ID: "agent.id",
1743
- AGENT_NAME: "agent.name",
1848
+ // SubAgent attributes
1849
+ SUB_AGENT_ID: "subagent.id",
1850
+ SUB_AGENT_NAME: "subagent.name",
1744
1851
  // Token usage
1745
1852
  GEN_AI_USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens",
1746
1853
  GEN_AI_USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens",
1747
1854
  // Context attributes
1748
1855
  CONTEXT_URL: "context.url",
1749
1856
  CONTEXT_CONFIG_ID: "context.context_config_id",
1750
- CONTEXT_AGENT_GRAPH_ID: "context.agent_graph_id",
1857
+ CONTEXT_AGENT_ID: "context.agent_id",
1751
1858
  CONTEXT_HEADERS_KEYS: "context.headers_keys",
1752
1859
  // Message attributes
1753
1860
  MESSAGE_CONTENT: "message.content",
@@ -1899,7 +2006,7 @@ var QUERY_EXPRESSIONS = {
1899
2006
  CONTEXT_ERRORS: "contextErrors",
1900
2007
  AGENT_GENERATION_ERRORS: "agentGenerationErrors",
1901
2008
  USER_MESSAGES: "userMessages",
1902
- UNIQUE_GRAPHS: "uniqueGraphs",
2009
+ UNIQUE_AGENTS: "uniqueAgents",
1903
2010
  UNIQUE_MODELS: "uniqueModels",
1904
2011
  // Route-specific query names
1905
2012
  TOOL_CALLS: "toolCalls",
@@ -1933,7 +2040,7 @@ var QUERY_TYPES = {
1933
2040
  var PANEL_TYPES = {
1934
2041
  LIST: "list",
1935
2042
  TABLE: "table",
1936
- GRAPH: "graph",
2043
+ AGENT: "agent",
1937
2044
  VALUE: "value"
1938
2045
  };
1939
2046
  var DATA_SOURCES = {
@@ -1993,7 +2100,7 @@ var ErrorResponseSchema2 = zod.z.object({
1993
2100
  message: zod.z.string().optional(),
1994
2101
  details: zod.z.unknown().optional()
1995
2102
  });
1996
- var AgentApiInsertSchema = zod.z.object({
2103
+ var AgentApiInsertSchema2 = zod.z.object({
1997
2104
  id: zod.z.string().optional(),
1998
2105
  name: zod.z.string(),
1999
2106
  description: zod.z.string().optional(),
@@ -2018,7 +2125,7 @@ var ApiKeyApiSelectSchema2 = zod.z.object({
2018
2125
  id: zod.z.string(),
2019
2126
  tenantId: zod.z.string(),
2020
2127
  projectId: zod.z.string(),
2021
- graphId: zod.z.string(),
2128
+ agentId: zod.z.string(),
2022
2129
  publicId: zod.z.string(),
2023
2130
  keyHash: zod.z.string(),
2024
2131
  keyPrefix: zod.z.string(),
@@ -2065,17 +2172,17 @@ var ExternalAgentApiInsertSchema2 = zod.z.object({
2065
2172
  credentialReferenceId: zod.z.string().nullable().optional(),
2066
2173
  type: zod.z.literal("external").optional()
2067
2174
  });
2068
- var AgentGraphApiInsertSchema2 = zod.z.object({
2175
+ var AgentAgentApiInsertSchema = zod.z.object({
2069
2176
  id: zod.z.string().optional(),
2070
2177
  name: zod.z.string(),
2071
2178
  description: zod.z.string().optional(),
2072
2179
  defaultSubAgentId: zod.z.string().optional()
2073
2180
  });
2074
- var FullGraphDefinitionSchema2 = AgentGraphApiInsertSchema2.extend({
2181
+ var FullAgentDefinitionSchema = AgentAgentApiInsertSchema.extend({
2075
2182
  subAgents: zod.z.record(
2076
2183
  zod.z.string(),
2077
2184
  zod.z.union([
2078
- FullGraphAgentInsertSchema,
2185
+ FullAgentAgentInsertSchema,
2079
2186
  ExternalAgentApiInsertSchema2.extend({
2080
2187
  id: zod.z.string()
2081
2188
  })
@@ -2083,7 +2190,7 @@ var FullGraphDefinitionSchema2 = AgentGraphApiInsertSchema2.extend({
2083
2190
  ),
2084
2191
  // Removed project-scoped resources - these are now managed at project level:
2085
2192
  // tools, credentialReferences, dataComponents, artifactComponents
2086
- // Agent relationships to these resources are maintained via agent.tools, agent.dataComponents, etc.
2193
+ // Agent relationships to these resources are maintained vian agent.tools, agent.dataComponents, etc.
2087
2194
  contextConfig: zod.z.optional(ContextConfigApiInsertSchema2),
2088
2195
  models: zod.z.object({
2089
2196
  base: zod.z.object({
@@ -2102,7 +2209,7 @@ var FullGraphDefinitionSchema2 = AgentGraphApiInsertSchema2.extend({
2102
2209
  stopWhen: zod.z.object({
2103
2210
  transferCountIs: zod.z.number().min(1).max(100).optional()
2104
2211
  }).optional(),
2105
- graphPrompt: zod.z.string().max(5e3).optional(),
2212
+ agentPrompt: zod.z.string().max(5e3).optional(),
2106
2213
  statusUpdates: zod.z.object({
2107
2214
  enabled: zod.z.boolean().optional(),
2108
2215
  numEvents: zod.z.number().min(1).max(100).optional(),
@@ -2138,9 +2245,9 @@ exports.AGENT_IDS = AGENT_IDS;
2138
2245
  exports.AGGREGATE_OPERATORS = AGGREGATE_OPERATORS;
2139
2246
  exports.AI_OPERATIONS = AI_OPERATIONS;
2140
2247
  exports.AI_TOOL_TYPES = AI_TOOL_TYPES;
2141
- exports.AgentApiInsertSchema = AgentApiInsertSchema;
2142
- exports.AgentGraphApiInsertSchema = AgentGraphApiInsertSchema2;
2143
- exports.AgentStopWhenSchema = SubAgentStopWhenSchema;
2248
+ exports.AgentAgentApiInsertSchema = AgentAgentApiInsertSchema;
2249
+ exports.AgentApiInsertSchema = AgentApiInsertSchema2;
2250
+ exports.AgentStopWhenSchema = AgentStopWhenSchema;
2144
2251
  exports.ApiKeyApiCreationResponseSchema = ApiKeyApiCreationResponseSchema2;
2145
2252
  exports.ApiKeyApiSelectSchema = ApiKeyApiSelectSchema2;
2146
2253
  exports.ArtifactComponentApiInsertSchema = ArtifactComponentApiInsertSchema2;
@@ -2156,11 +2263,10 @@ exports.DataComponentApiInsertSchema = DataComponentApiInsertSchema2;
2156
2263
  exports.ErrorResponseSchema = ErrorResponseSchema2;
2157
2264
  exports.ExternalAgentApiInsertSchema = ExternalAgentApiInsertSchema2;
2158
2265
  exports.FIELD_TYPES = FIELD_TYPES;
2159
- exports.FullGraphDefinitionSchema = FullGraphDefinitionSchema2;
2266
+ exports.FullAgentDefinitionSchema = FullAgentDefinitionSchema;
2160
2267
  exports.FunctionApiInsertSchema = FunctionApiInsertSchema;
2161
2268
  exports.FunctionApiSelectSchema = FunctionApiSelectSchema;
2162
2269
  exports.FunctionApiUpdateSchema = FunctionApiUpdateSchema;
2163
- exports.GraphStopWhenSchema = GraphStopWhenSchema;
2164
2270
  exports.IdParamsSchema = IdParamsSchema;
2165
2271
  exports.ListResponseSchema = ListResponseSchema;
2166
2272
  exports.MAX_ID_LENGTH = MAX_ID_LENGTH2;
@@ -2181,6 +2287,7 @@ exports.SPAN_NAMES = SPAN_NAMES;
2181
2287
  exports.SandboxConfigSchema = SandboxConfigSchema;
2182
2288
  exports.SingleResponseSchema = SingleResponseSchema;
2183
2289
  exports.StopWhenSchema = StopWhenSchema;
2290
+ exports.SubAgentStopWhenSchema = SubAgentStopWhenSchema;
2184
2291
  exports.TRANSFER_FROM_SUB_AGENT_ID = TRANSFER_FROM_SUB_AGENT_ID;
2185
2292
  exports.TRANSFER_TO_SUB_AGENT_ID = TRANSFER_TO_SUB_AGENT_ID;
2186
2293
  exports.TenantParamsSchema = TenantParamsSchema2;