@inkeep/agents-manage-api 0.2.1 → 0.3.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 (3) hide show
  1. package/dist/index.cjs +224 -291
  2. package/dist/index.js +225 -268
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getLogger as getLogger$1, createDatabaseClient, commonGetErrorResponses, TenantProjectParamsSchema, ArtifactComponentApiSelectSchema, getArtifactComponentsForAgent, getAgentsUsingArtifactComponent, ErrorResponseSchema, SingleResponseSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, getAgentById, getArtifactComponentById, createApiError, isArtifactComponentAssociatedWithAgent, associateArtifactComponentWithAgent, RemovedResponseSchema, removeArtifactComponentFromAgent, ExistsResponseSchema, DataComponentApiSelectSchema, getDataComponentsForAgent, getAgentsUsingDataComponent, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, getDataComponent, isDataComponentAssociatedWithAgent, associateDataComponentWithAgent, removeDataComponentFromAgent, ListResponseSchema, PaginationQueryParamsSchema, AgentGraphApiSelectSchema, listAgentGraphs, IdParamsSchema, getAgentGraph, getGraphAgentInfos, FullGraphDefinitionSchema, getFullGraphDefinition, AgentGraphApiInsertSchema, createAgentGraph, AgentGraphApiUpdateSchema, updateAgentGraph, deleteAgentGraph, AgentRelationApiSelectSchema, AgentRelationQuerySchema, getAgentRelationsBySource, getAgentRelationsByTarget, getExternalAgentRelations, listAgentRelations, getAgentRelationById, AgentRelationApiInsertSchema, validateExternalAgent, validateInternalAgent, createAgentRelation, AgentRelationApiUpdateSchema, updateAgentRelation, deleteAgentRelation, AgentApiSelectSchema, listAgentsPaginated, TenantProjectIdParamsSchema, AgentApiInsertSchema, createAgent, AgentApiUpdateSchema, updateAgent, deleteAgent, AgentToolRelationApiSelectSchema, getAgentToolRelationByAgent, getAgentToolRelationByTool, listAgentToolRelations, getAgentToolRelationById, getToolsForAgent, getAgentsForTool, AgentToolRelationApiInsertSchema, createAgentToolRelation, AgentToolRelationApiUpdateSchema, updateAgentToolRelation, deleteAgentToolRelation, ApiKeyApiSelectSchema, listApiKeysPaginated, getApiKeyById, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, generateApiKey, createApiKey, ApiKeyApiUpdateSchema, updateApiKey, deleteApiKey, listArtifactComponentsPaginated, ArtifactComponentApiInsertSchema, createArtifactComponent, ArtifactComponentApiUpdateSchema, updateArtifactComponent, deleteArtifactComponent, ContextConfigApiSelectSchema, listContextConfigsPaginated, getContextConfigById, ContextConfigApiInsertSchema, createContextConfig, commonUpdateErrorResponses, ContextConfigApiUpdateSchema, updateContextConfig, commonDeleteErrorResponses, deleteContextConfig, CredentialReferenceApiSelectSchema, listCredentialReferencesPaginated, getCredentialReferenceById, CredentialReferenceApiInsertSchema, createCredentialReference, CredentialReferenceApiUpdateSchema, updateCredentialReference, getCredentialStoreLookupKeyFromRetrievalParams, deleteCredentialReference, listDataComponentsPaginated, DataComponentApiInsertSchema, createDataComponent, DataComponentApiUpdateSchema, updateDataComponent, deleteDataComponent, ExternalAgentApiSelectSchema, listExternalAgentsPaginated, getExternalAgent, ExternalAgentApiInsertSchema, createExternalAgent, ExternalAgentApiUpdateSchema, updateExternalAgent, deleteExternalAgent, createFullGraphServerSide, getFullGraph, updateFullGraphServerSide, deleteFullGraph, TenantParamsSchema, ProjectApiSelectSchema, listProjectsPaginated, TenantIdParamsSchema, getProject, ProjectApiInsertSchema, createProject, ProjectApiUpdateSchema, updateProject, deleteProject, McpToolSchema, ToolStatusSchema, listToolsByStatus, dbResultToMcpTool, listTools, getToolById, ToolApiInsertSchema, createTool, ToolApiUpdateSchema, updateTool, deleteTool, getCredentialReference, CredentialStoreType, FullProjectDefinitionSchema, createFullProjectServerSide, getFullProject, updateFullProjectServerSide, deleteFullProject, createDefaultCredentialStores, CredentialStoreRegistry, ContextResolver, CredentialStuffer, McpClient, detectAuthenticationRequired, handleApiError, MCPServerType, MCPTransportType } from '@inkeep/agents-core';
1
+ import { loadEnvironmentFiles, getLogger as getLogger$1, createDatabaseClient, commonGetErrorResponses, TenantProjectGraphParamsSchema, ArtifactComponentApiSelectSchema, getArtifactComponentsForAgent, getAgentsUsingArtifactComponent, ErrorResponseSchema, SingleResponseSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, getAgentById, getArtifactComponentById, createApiError, isArtifactComponentAssociatedWithAgent, associateArtifactComponentWithAgent, RemovedResponseSchema, removeArtifactComponentFromAgent, ExistsResponseSchema, DataComponentApiSelectSchema, getDataComponentsForAgent, getAgentsUsingDataComponent, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, getDataComponent, isDataComponentAssociatedWithAgent, associateDataComponentWithAgent, removeDataComponentFromAgent, ListResponseSchema, PaginationQueryParamsSchema, TenantProjectParamsSchema, AgentGraphApiSelectSchema, listAgentGraphs, IdParamsSchema, getAgentGraphById, getGraphAgentInfos, FullGraphDefinitionSchema, getFullGraphDefinition, AgentGraphApiInsertSchema, createAgentGraph, AgentGraphApiUpdateSchema, updateAgentGraph, deleteAgentGraph, AgentRelationApiSelectSchema, AgentRelationQuerySchema, getAgentRelationsBySource, getAgentRelationsByTarget, getExternalAgentRelations, listAgentRelations, TenantProjectGraphIdParamsSchema, getAgentRelationById, AgentRelationApiInsertSchema, validateExternalAgent, validateInternalAgent, createAgentRelation, AgentRelationApiUpdateSchema, updateAgentRelation, deleteAgentRelation, AgentApiSelectSchema, listAgentsPaginated, AgentApiInsertSchema, createAgent, AgentApiUpdateSchema, updateAgent, deleteAgent, AgentToolRelationApiSelectSchema, getAgentToolRelationByAgent, getAgentToolRelationByTool, listAgentToolRelations, getAgentToolRelationById, getToolsForAgent, getAgentsForTool, AgentToolRelationApiInsertSchema, createAgentToolRelation, AgentToolRelationApiUpdateSchema, updateAgentToolRelation, deleteAgentToolRelation, ApiKeyApiSelectSchema, listApiKeysPaginated, getApiKeyById, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, generateApiKey, createApiKey, ApiKeyApiUpdateSchema, updateApiKey, deleteApiKey, listArtifactComponentsPaginated, ArtifactComponentApiInsertSchema, createArtifactComponent, ArtifactComponentApiUpdateSchema, updateArtifactComponent, deleteArtifactComponent, ContextConfigApiSelectSchema, listContextConfigsPaginated, getContextConfigById, ContextConfigApiInsertSchema, createContextConfig, commonUpdateErrorResponses, ContextConfigApiUpdateSchema, updateContextConfig, commonDeleteErrorResponses, deleteContextConfig, CredentialReferenceApiSelectSchema, listCredentialReferencesPaginated, getCredentialReferenceById, CredentialReferenceApiInsertSchema, createCredentialReference, CredentialReferenceApiUpdateSchema, updateCredentialReference, getCredentialStoreLookupKeyFromRetrievalParams, deleteCredentialReference, listDataComponentsPaginated, DataComponentApiInsertSchema, createDataComponent, DataComponentApiUpdateSchema, updateDataComponent, deleteDataComponent, ExternalAgentApiSelectSchema, listExternalAgentsPaginated, getExternalAgent, ExternalAgentApiInsertSchema, createExternalAgent, ExternalAgentApiUpdateSchema, updateExternalAgent, deleteExternalAgent, createFullGraphServerSide, getFullGraph, updateFullGraphServerSide, deleteFullGraph, TenantParamsSchema, ProjectApiSelectSchema, listProjectsPaginated, TenantIdParamsSchema, getProject, ProjectApiInsertSchema, createProject, ProjectApiUpdateSchema, updateProject, deleteProject, McpToolSchema, ToolStatusSchema, listToolsByStatus, dbResultToMcpTool, listTools, getToolById, ToolApiInsertSchema, createTool, ToolApiUpdateSchema, updateTool, deleteTool, getCredentialReference, CredentialStoreType, FullProjectDefinitionSchema, createFullProjectServerSide, getFullProject, updateFullProjectServerSide, deleteFullProject, createDefaultCredentialStores, CredentialStoreRegistry, ContextResolver, CredentialStuffer, McpClient, detectAuthenticationRequired, handleApiError, MCPServerType, MCPTransportType } from '@inkeep/agents-core';
2
2
  import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
3
3
  import { Hono } from 'hono';
4
4
  import { cors } from 'hono/cors';
@@ -7,9 +7,6 @@ import { requestId } from 'hono/request-id';
7
7
  import { pinoLogger } from 'hono-pino';
8
8
  import { AsyncLocalStorage } from 'async_hooks';
9
9
  import { pino } from 'pino';
10
- import fs from 'fs';
11
- import path from 'path';
12
- import * as dotenv from 'dotenv';
13
10
  import { z } from 'zod';
14
11
  import { createMiddleware } from 'hono/factory';
15
12
  import { swaggerUI } from '@hono/swagger-ui';
@@ -18,29 +15,12 @@ import { nanoid } from 'nanoid';
18
15
  var __defProp = Object.defineProperty;
19
16
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20
17
  var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
21
- dotenv.config({ quiet: true });
22
- z.enum(["development", "production"]).default("development");
23
- var environmentSchema = z.enum(["development", "pentest", "production", "test"]);
24
- var criticalEnv = z.object({
25
- ENVIRONMENT: environmentSchema
26
- }).parse(process.env);
27
- var loadEnvFile = () => {
28
- const envPath = path.resolve(process.cwd(), `.env.${criticalEnv.ENVIRONMENT}.nonsecret`);
29
- if (fs.existsSync(envPath)) {
30
- const envConfig = dotenv.parse(fs.readFileSync(envPath));
31
- for (const k in envConfig) {
32
- if (!(k in process.env)) {
33
- process.env[k] = envConfig[k];
34
- }
35
- }
36
- }
37
- };
38
- loadEnvFile();
18
+ loadEnvironmentFiles();
39
19
  var envSchema = z.object({
40
20
  NODE_ENV: z.enum(["development", "production", "test"]).optional(),
41
21
  ENVIRONMENT: z.enum(["development", "production", "pentest", "test"]).optional(),
42
22
  AGENTS_MANAGE_API_URL: z.string().optional().default("http://localhost:3002"),
43
- DB_FILE_NAME: z.string().default("file:../local.db"),
23
+ DB_FILE_NAME: z.string(),
44
24
  LOG_LEVEL: z.enum(["trace", "debug", "info", "warn", "error"]).optional().default("debug"),
45
25
  NANGO_SECRET_KEY: z.string().optional(),
46
26
  INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET: z.string().optional()
@@ -166,9 +146,9 @@ app.openapi(
166
146
  path: "/agent/:agentId",
167
147
  summary: "Get Artifact Components for Agent",
168
148
  operationId: "get-artifact-components-for-agent",
169
- tags: ["CRUD Agent Artifact Component Relations"],
149
+ tags: ["Agent Artifact Component Relations"],
170
150
  request: {
171
- params: TenantProjectParamsSchema.extend({
151
+ params: TenantProjectGraphParamsSchema.extend({
172
152
  agentId: z.string()
173
153
  })
174
154
  },
@@ -187,10 +167,9 @@ app.openapi(
187
167
  }
188
168
  }),
189
169
  async (c) => {
190
- const { tenantId, projectId, agentId } = c.req.valid("param");
170
+ const { tenantId, projectId, graphId, agentId } = c.req.valid("param");
191
171
  const artifactComponents = await getArtifactComponentsForAgent(dbClient_default)({
192
- scopes: { tenantId, projectId },
193
- agentId
172
+ scopes: { tenantId, projectId, graphId, agentId }
194
173
  });
195
174
  return c.json({
196
175
  data: artifactComponents
@@ -203,9 +182,9 @@ app.openapi(
203
182
  path: "/component/:artifactComponentId/agents",
204
183
  summary: "Get Agents Using Artifact Component",
205
184
  operationId: "get-agents-using-artifact-component",
206
- tags: ["CRUD Agent Artifact Component Relations"],
185
+ tags: ["Agent Artifact Component Relations"],
207
186
  request: {
208
- params: TenantProjectParamsSchema.extend({
187
+ params: TenantProjectGraphParamsSchema.extend({
209
188
  artifactComponentId: z.string()
210
189
  })
211
190
  },
@@ -243,9 +222,9 @@ app.openapi(
243
222
  path: "/",
244
223
  summary: "Associate Artifact Component with Agent",
245
224
  operationId: "associate-artifact-component-with-agent",
246
- tags: ["CRUD Agent Artifact Component Relations"],
225
+ tags: ["Agent Artifact Component Relations"],
247
226
  request: {
248
- params: TenantProjectParamsSchema,
227
+ params: TenantProjectGraphParamsSchema,
249
228
  body: {
250
229
  content: {
251
230
  "application/json": {
@@ -275,9 +254,12 @@ app.openapi(
275
254
  }
276
255
  }),
277
256
  async (c) => {
278
- const { tenantId, projectId } = c.req.valid("param");
257
+ const { tenantId, projectId, graphId } = c.req.valid("param");
279
258
  const { agentId, artifactComponentId } = c.req.valid("json");
280
- const agent = await getAgentById(dbClient_default)({ scopes: { tenantId, projectId }, agentId });
259
+ const agent = await getAgentById(dbClient_default)({
260
+ scopes: { tenantId, projectId, graphId },
261
+ agentId
262
+ });
281
263
  const artifactComponent = await getArtifactComponentById(dbClient_default)({
282
264
  scopes: { tenantId, projectId },
283
265
  id: artifactComponentId
@@ -295,8 +277,7 @@ app.openapi(
295
277
  });
296
278
  }
297
279
  const exists = await isArtifactComponentAssociatedWithAgent(dbClient_default)({
298
- scopes: { tenantId, projectId },
299
- agentId,
280
+ scopes: { tenantId, projectId, graphId, agentId },
300
281
  artifactComponentId
301
282
  });
302
283
  if (exists) {
@@ -306,8 +287,7 @@ app.openapi(
306
287
  });
307
288
  }
308
289
  const association = await associateArtifactComponentWithAgent(dbClient_default)({
309
- scopes: { tenantId, projectId },
310
- agentId,
290
+ scopes: { tenantId, projectId, graphId, agentId },
311
291
  artifactComponentId
312
292
  });
313
293
  return c.json({ data: association }, 201);
@@ -319,9 +299,9 @@ app.openapi(
319
299
  path: "/agent/:agentId/component/:artifactComponentId",
320
300
  summary: "Remove Artifact Component from Agent",
321
301
  operationId: "remove-artifact-component-from-agent",
322
- tags: ["CRUD Agent Artifact Component Relations"],
302
+ tags: ["Agent Artifact Component Relations"],
323
303
  request: {
324
- params: TenantProjectParamsSchema.extend({
304
+ params: TenantProjectGraphParamsSchema.extend({
325
305
  agentId: z.string(),
326
306
  artifactComponentId: z.string()
327
307
  })
@@ -339,10 +319,9 @@ app.openapi(
339
319
  }
340
320
  }),
341
321
  async (c) => {
342
- const { tenantId, projectId, agentId, artifactComponentId } = c.req.valid("param");
322
+ const { tenantId, projectId, graphId, agentId, artifactComponentId } = c.req.valid("param");
343
323
  const removed = await removeArtifactComponentFromAgent(dbClient_default)({
344
- scopes: { tenantId, projectId },
345
- agentId,
324
+ scopes: { tenantId, projectId, graphId, agentId },
346
325
  artifactComponentId
347
326
  });
348
327
  if (!removed) {
@@ -363,9 +342,9 @@ app.openapi(
363
342
  path: "/agent/:agentId/component/:artifactComponentId/exists",
364
343
  summary: "Check if Artifact Component is Associated with Agent",
365
344
  operationId: "check-artifact-component-agent-association",
366
- tags: ["CRUD Agent Artifact Component Relations"],
345
+ tags: ["Agent Artifact Component Relations"],
367
346
  request: {
368
- params: TenantProjectParamsSchema.extend({
347
+ params: TenantProjectGraphParamsSchema.extend({
369
348
  agentId: z.string(),
370
349
  artifactComponentId: z.string()
371
350
  })
@@ -383,10 +362,9 @@ app.openapi(
383
362
  }
384
363
  }),
385
364
  async (c) => {
386
- const { tenantId, projectId, agentId, artifactComponentId } = c.req.valid("param");
365
+ const { tenantId, projectId, graphId, agentId, artifactComponentId } = c.req.valid("param");
387
366
  const exists = await isArtifactComponentAssociatedWithAgent(dbClient_default)({
388
- scopes: { tenantId, projectId },
389
- agentId,
367
+ scopes: { tenantId, projectId, graphId, agentId },
390
368
  artifactComponentId
391
369
  });
392
370
  return c.json({ exists });
@@ -400,9 +378,9 @@ app2.openapi(
400
378
  path: "/agent/:agentId",
401
379
  summary: "Get Data Components for Agent",
402
380
  operationId: "get-data-components-for-agent",
403
- tags: ["CRUD Agent Data Component Relations"],
381
+ tags: ["Agent Data Component Relations"],
404
382
  request: {
405
- params: TenantProjectParamsSchema.extend({
383
+ params: TenantProjectGraphParamsSchema.extend({
406
384
  agentId: z.string()
407
385
  })
408
386
  },
@@ -421,10 +399,9 @@ app2.openapi(
421
399
  }
422
400
  }),
423
401
  async (c) => {
424
- const { tenantId, projectId, agentId } = c.req.valid("param");
402
+ const { tenantId, projectId, graphId, agentId } = c.req.valid("param");
425
403
  const dataComponents = await getDataComponentsForAgent(dbClient_default)({
426
- scopes: { tenantId, projectId },
427
- agentId
404
+ scopes: { tenantId, projectId, graphId, agentId }
428
405
  });
429
406
  return c.json({ data: dataComponents });
430
407
  }
@@ -435,9 +412,9 @@ app2.openapi(
435
412
  path: "/component/:dataComponentId/agents",
436
413
  summary: "Get Agents Using Data Component",
437
414
  operationId: "get-agents-using-data-component",
438
- tags: ["CRUD Agent Data Component Relations"],
415
+ tags: ["Agent Data Component Relations"],
439
416
  request: {
440
- params: TenantProjectParamsSchema.extend({
417
+ params: TenantProjectGraphParamsSchema.extend({
441
418
  dataComponentId: z.string()
442
419
  })
443
420
  },
@@ -475,9 +452,9 @@ app2.openapi(
475
452
  path: "/",
476
453
  summary: "Associate Data Component with Agent",
477
454
  operationId: "associate-data-component-with-agent",
478
- tags: ["CRUD Agent Data Component Relations"],
455
+ tags: ["Agent Data Component Relations"],
479
456
  request: {
480
- params: TenantProjectParamsSchema,
457
+ params: TenantProjectGraphParamsSchema,
481
458
  body: {
482
459
  content: {
483
460
  "application/json": {
@@ -507,10 +484,10 @@ app2.openapi(
507
484
  }
508
485
  }),
509
486
  async (c) => {
510
- const { tenantId, projectId } = c.req.valid("param");
487
+ const { tenantId, projectId, graphId } = c.req.valid("param");
511
488
  const { agentId, dataComponentId } = c.req.valid("json");
512
489
  const [agent, dataComponent] = await Promise.all([
513
- getAgentById(dbClient_default)({ scopes: { tenantId, projectId }, agentId }),
490
+ getAgentById(dbClient_default)({ scopes: { tenantId, projectId, graphId }, agentId }),
514
491
  getDataComponent(dbClient_default)({ scopes: { tenantId, projectId }, dataComponentId })
515
492
  ]);
516
493
  if (!agent) {
@@ -526,8 +503,7 @@ app2.openapi(
526
503
  });
527
504
  }
528
505
  const exists = await isDataComponentAssociatedWithAgent(dbClient_default)({
529
- scopes: { tenantId, projectId },
530
- agentId,
506
+ scopes: { tenantId, projectId, graphId, agentId },
531
507
  dataComponentId
532
508
  });
533
509
  if (exists) {
@@ -537,8 +513,7 @@ app2.openapi(
537
513
  });
538
514
  }
539
515
  const association = await associateDataComponentWithAgent(dbClient_default)({
540
- scopes: { tenantId, projectId },
541
- agentId,
516
+ scopes: { tenantId, projectId, graphId, agentId },
542
517
  dataComponentId
543
518
  });
544
519
  return c.json({ data: association }, 201);
@@ -550,9 +525,9 @@ app2.openapi(
550
525
  path: "/agent/:agentId/component/:dataComponentId",
551
526
  summary: "Remove Data Component from Agent",
552
527
  operationId: "remove-data-component-from-agent",
553
- tags: ["CRUD Agent Data Component Relations"],
528
+ tags: ["Agent Data Component Relations"],
554
529
  request: {
555
- params: TenantProjectParamsSchema.extend({
530
+ params: TenantProjectGraphParamsSchema.extend({
556
531
  agentId: z.string(),
557
532
  dataComponentId: z.string()
558
533
  })
@@ -570,10 +545,9 @@ app2.openapi(
570
545
  }
571
546
  }),
572
547
  async (c) => {
573
- const { tenantId, projectId, agentId, dataComponentId } = c.req.valid("param");
548
+ const { tenantId, projectId, graphId, agentId, dataComponentId } = c.req.valid("param");
574
549
  const removed = await removeDataComponentFromAgent(dbClient_default)({
575
- scopes: { tenantId, projectId },
576
- agentId,
550
+ scopes: { tenantId, projectId, graphId, agentId },
577
551
  dataComponentId
578
552
  });
579
553
  if (!removed) {
@@ -594,9 +568,9 @@ app2.openapi(
594
568
  path: "/agent/:agentId/component/:dataComponentId/exists",
595
569
  summary: "Check if Data Component is Associated with Agent",
596
570
  operationId: "check-data-component-agent-association",
597
- tags: ["CRUD Agent Data Component Relations"],
571
+ tags: ["Agent Data Component Relations"],
598
572
  request: {
599
- params: TenantProjectParamsSchema.extend({
573
+ params: TenantProjectGraphParamsSchema.extend({
600
574
  agentId: z.string(),
601
575
  dataComponentId: z.string()
602
576
  })
@@ -614,10 +588,9 @@ app2.openapi(
614
588
  }
615
589
  }),
616
590
  async (c) => {
617
- const { tenantId, projectId, agentId, dataComponentId } = c.req.valid("param");
591
+ const { tenantId, projectId, graphId, agentId, dataComponentId } = c.req.valid("param");
618
592
  const exists = await isDataComponentAssociatedWithAgent(dbClient_default)({
619
- scopes: { tenantId, projectId },
620
- agentId,
593
+ scopes: { tenantId, projectId, graphId, agentId },
621
594
  dataComponentId
622
595
  });
623
596
  return c.json({ exists });
@@ -631,7 +604,7 @@ app3.openapi(
631
604
  path: "/",
632
605
  summary: "List Agent Graphs",
633
606
  operationId: "list-agent-graphs",
634
- tags: ["CRUD Agent Graph"],
607
+ tags: ["Agent Graph"],
635
608
  request: {
636
609
  params: TenantProjectParamsSchema,
637
610
  query: PaginationQueryParamsSchema
@@ -670,7 +643,7 @@ app3.openapi(
670
643
  path: "/{id}",
671
644
  summary: "Get Agent Graph",
672
645
  operationId: "get-agent-graph",
673
- tags: ["CRUD Agent Graph"],
646
+ tags: ["Agent Graph"],
674
647
  request: {
675
648
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
676
649
  },
@@ -688,9 +661,8 @@ app3.openapi(
688
661
  }),
689
662
  async (c) => {
690
663
  const { tenantId, projectId, id } = c.req.valid("param");
691
- const graph = await getAgentGraph(dbClient_default)({
692
- scopes: { tenantId, projectId },
693
- graphId: id
664
+ const graph = await getAgentGraphById(dbClient_default)({
665
+ scopes: { tenantId, projectId, graphId: id }
694
666
  });
695
667
  if (!graph) {
696
668
  throw createApiError({
@@ -707,7 +679,7 @@ app3.openapi(
707
679
  path: "/{graphId}/agents/{agentId}/related",
708
680
  summary: "Get Related Agent Infos",
709
681
  operationId: "get-related-agent-infos",
710
- tags: ["CRUD Agent Graph"],
682
+ tags: ["Agent Graph"],
711
683
  request: {
712
684
  params: TenantProjectParamsSchema.extend({
713
685
  graphId: z.string(),
@@ -756,7 +728,7 @@ app3.openapi(
756
728
  path: "/{graphId}/full",
757
729
  summary: "Get Full Graph Definition",
758
730
  operationId: "get-full-graph-definition",
759
- tags: ["CRUD Agent Graph"],
731
+ tags: ["Agent Graph"],
760
732
  request: {
761
733
  params: TenantProjectParamsSchema.extend({
762
734
  graphId: z.string()
@@ -777,8 +749,7 @@ app3.openapi(
777
749
  async (c) => {
778
750
  const { tenantId, projectId, graphId } = c.req.valid("param");
779
751
  const fullGraph = await getFullGraphDefinition(dbClient_default)({
780
- scopes: { tenantId, projectId },
781
- graphId
752
+ scopes: { tenantId, projectId, graphId }
782
753
  });
783
754
  if (!fullGraph) {
784
755
  throw createApiError({
@@ -795,7 +766,7 @@ app3.openapi(
795
766
  path: "/",
796
767
  summary: "Create Agent Graph",
797
768
  operationId: "create-agent-graph",
798
- tags: ["CRUD Agent Graph"],
769
+ tags: ["Agent Graph"],
799
770
  request: {
800
771
  params: TenantProjectParamsSchema,
801
772
  body: {
@@ -838,7 +809,7 @@ app3.openapi(
838
809
  path: "/{id}",
839
810
  summary: "Update Agent Graph",
840
811
  operationId: "update-agent-graph",
841
- tags: ["CRUD Agent Graph"],
812
+ tags: ["Agent Graph"],
842
813
  request: {
843
814
  params: TenantProjectParamsSchema.merge(IdParamsSchema),
844
815
  body: {
@@ -865,8 +836,7 @@ app3.openapi(
865
836
  const { tenantId, projectId, id } = c.req.valid("param");
866
837
  const validatedBody = c.req.valid("json");
867
838
  const updatedGraph = await updateAgentGraph(dbClient_default)({
868
- scopes: { tenantId, projectId },
869
- graphId: id,
839
+ scopes: { tenantId, projectId, graphId: id },
870
840
  data: {
871
841
  defaultAgentId: validatedBody.defaultAgentId,
872
842
  contextConfigId: validatedBody.contextConfigId ?? void 0
@@ -887,7 +857,7 @@ app3.openapi(
887
857
  path: "/{id}",
888
858
  summary: "Delete Agent Graph",
889
859
  operationId: "delete-agent-graph",
890
- tags: ["CRUD Agent Graph"],
860
+ tags: ["Agent Graph"],
891
861
  request: {
892
862
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
893
863
  },
@@ -908,8 +878,7 @@ app3.openapi(
908
878
  async (c) => {
909
879
  const { tenantId, projectId, id } = c.req.valid("param");
910
880
  const deleted = await deleteAgentGraph(dbClient_default)({
911
- scopes: { tenantId, projectId },
912
- graphId: id
881
+ scopes: { tenantId, projectId, graphId: id }
913
882
  });
914
883
  if (!deleted) {
915
884
  throw createApiError({
@@ -928,9 +897,9 @@ app4.openapi(
928
897
  path: "/",
929
898
  summary: "List Agent Relations",
930
899
  operationId: "list-agent-relations",
931
- tags: ["CRUD Agent Relations"],
900
+ tags: ["Agent Relations"],
932
901
  request: {
933
- params: TenantProjectParamsSchema,
902
+ params: TenantProjectGraphParamsSchema,
934
903
  query: PaginationQueryParamsSchema.merge(AgentRelationQuerySchema)
935
904
  },
936
905
  responses: {
@@ -946,7 +915,7 @@ app4.openapi(
946
915
  }
947
916
  }),
948
917
  async (c) => {
949
- const { tenantId, projectId } = c.req.valid("param");
918
+ const { tenantId, projectId, graphId } = c.req.valid("param");
950
919
  const {
951
920
  page = 1,
952
921
  limit = 10,
@@ -960,28 +929,28 @@ app4.openapi(
960
929
  let result;
961
930
  if (sourceAgentId) {
962
931
  const rawResult = await getAgentRelationsBySource(dbClient_default)({
963
- scopes: { tenantId, projectId },
932
+ scopes: { tenantId, projectId, graphId },
964
933
  sourceAgentId,
965
934
  pagination: { page: pageNum, limit: limitNum }
966
935
  });
967
936
  result = { ...rawResult, data: rawResult.data };
968
937
  } else if (targetAgentId) {
969
938
  const rawResult = await getAgentRelationsByTarget(dbClient_default)({
970
- scopes: { tenantId, projectId },
939
+ scopes: { tenantId, projectId, graphId },
971
940
  targetAgentId,
972
941
  pagination: { page: pageNum, limit: limitNum }
973
942
  });
974
943
  result = { ...rawResult, data: rawResult.data };
975
944
  } else if (externalAgentId) {
976
945
  const rawResult = await getExternalAgentRelations(dbClient_default)({
977
- scopes: { tenantId, projectId },
946
+ scopes: { tenantId, projectId, graphId },
978
947
  externalAgentId,
979
948
  pagination: { page: pageNum, limit: limitNum }
980
949
  });
981
950
  result = { ...rawResult, data: rawResult.data };
982
951
  } else {
983
952
  const rawResult = await listAgentRelations(dbClient_default)({
984
- scopes: { tenantId, projectId },
953
+ scopes: { tenantId, projectId, graphId },
985
954
  pagination: { page: pageNum, limit: limitNum }
986
955
  });
987
956
  result = { ...rawResult, data: rawResult.data };
@@ -1001,9 +970,9 @@ app4.openapi(
1001
970
  path: "/{id}",
1002
971
  summary: "Get Agent Relation",
1003
972
  operationId: "get-agent-relation-by-id",
1004
- tags: ["CRUD Agent Relations"],
973
+ tags: ["Agent Relations"],
1005
974
  request: {
1006
- params: TenantProjectParamsSchema.merge(IdParamsSchema)
975
+ params: TenantProjectGraphIdParamsSchema
1007
976
  },
1008
977
  responses: {
1009
978
  200: {
@@ -1018,9 +987,9 @@ app4.openapi(
1018
987
  }
1019
988
  }),
1020
989
  async (c) => {
1021
- const { tenantId, projectId, id } = c.req.valid("param");
990
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
1022
991
  const agentRelation = await getAgentRelationById(dbClient_default)({
1023
- scopes: { tenantId, projectId },
992
+ scopes: { tenantId, projectId, graphId },
1024
993
  relationId: id
1025
994
  });
1026
995
  if (!agentRelation) {
@@ -1038,9 +1007,9 @@ app4.openapi(
1038
1007
  path: "/",
1039
1008
  summary: "Create Agent Relation",
1040
1009
  operationId: "create-agent-relation",
1041
- tags: ["CRUD Agent Relations"],
1010
+ tags: ["Agent Relations"],
1042
1011
  request: {
1043
- params: TenantProjectParamsSchema,
1012
+ params: TenantProjectGraphParamsSchema,
1044
1013
  body: {
1045
1014
  content: {
1046
1015
  "application/json": {
@@ -1062,13 +1031,12 @@ app4.openapi(
1062
1031
  }
1063
1032
  }),
1064
1033
  async (c) => {
1065
- const { tenantId, projectId } = c.req.valid("param");
1034
+ const { tenantId, projectId, graphId } = c.req.valid("param");
1066
1035
  const body = await c.req.valid("json");
1067
1036
  const isExternalAgent = body.externalAgentId != null;
1068
1037
  if (isExternalAgent && body.externalAgentId) {
1069
1038
  const externalAgentExists = await validateExternalAgent(dbClient_default)({
1070
- scopes: { tenantId, projectId },
1071
- agentId: body.externalAgentId
1039
+ scopes: { tenantId, projectId, graphId, agentId: body.externalAgentId }
1072
1040
  });
1073
1041
  if (!externalAgentExists) {
1074
1042
  throw createApiError({
@@ -1079,8 +1047,7 @@ app4.openapi(
1079
1047
  }
1080
1048
  if (!isExternalAgent && body.targetAgentId) {
1081
1049
  const internalAgentExists = await validateInternalAgent(dbClient_default)({
1082
- scopes: { tenantId, projectId },
1083
- agentId: body.targetAgentId
1050
+ scopes: { tenantId, projectId, graphId, agentId: body.targetAgentId }
1084
1051
  });
1085
1052
  if (!internalAgentExists) {
1086
1053
  throw createApiError({
@@ -1090,11 +1057,11 @@ app4.openapi(
1090
1057
  }
1091
1058
  }
1092
1059
  const existingRelations = await listAgentRelations(dbClient_default)({
1093
- scopes: { tenantId, projectId },
1060
+ scopes: { tenantId, projectId, graphId },
1094
1061
  pagination: { page: 1, limit: 1e3 }
1095
1062
  });
1096
1063
  const isDuplicate = existingRelations.data.some((relation) => {
1097
- if (relation.graphId !== body.graphId || relation.sourceAgentId !== body.sourceAgentId) {
1064
+ if (relation.graphId !== graphId || relation.sourceAgentId !== body.sourceAgentId) {
1098
1065
  return false;
1099
1066
  }
1100
1067
  if (isExternalAgent) {
@@ -1110,7 +1077,7 @@ app4.openapi(
1110
1077
  });
1111
1078
  }
1112
1079
  const relationData = {
1113
- graphId: body.graphId,
1080
+ graphId,
1114
1081
  tenantId,
1115
1082
  id: nanoid(),
1116
1083
  projectId,
@@ -1131,9 +1098,9 @@ app4.openapi(
1131
1098
  path: "/{id}",
1132
1099
  summary: "Update Agent Relation",
1133
1100
  operationId: "update-agent-relation",
1134
- tags: ["CRUD Agent Relations"],
1101
+ tags: ["Agent Relations"],
1135
1102
  request: {
1136
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
1103
+ params: TenantProjectGraphIdParamsSchema,
1137
1104
  body: {
1138
1105
  content: {
1139
1106
  "application/json": {
@@ -1155,10 +1122,10 @@ app4.openapi(
1155
1122
  }
1156
1123
  }),
1157
1124
  async (c) => {
1158
- const { tenantId, projectId, id } = c.req.valid("param");
1125
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
1159
1126
  const body = await c.req.valid("json");
1160
1127
  const updatedAgentRelation = await updateAgentRelation(dbClient_default)({
1161
- scopes: { tenantId, projectId },
1128
+ scopes: { tenantId, projectId, graphId },
1162
1129
  relationId: id,
1163
1130
  data: body
1164
1131
  });
@@ -1177,9 +1144,9 @@ app4.openapi(
1177
1144
  path: "/{id}",
1178
1145
  summary: "Delete Agent Relation",
1179
1146
  operationId: "delete-agent-relation",
1180
- tags: ["CRUD Agent Relations"],
1147
+ tags: ["Agent Relations"],
1181
1148
  request: {
1182
- params: TenantProjectParamsSchema.merge(IdParamsSchema)
1149
+ params: TenantProjectGraphIdParamsSchema
1183
1150
  },
1184
1151
  responses: {
1185
1152
  204: {
@@ -1196,9 +1163,9 @@ app4.openapi(
1196
1163
  }
1197
1164
  }),
1198
1165
  async (c) => {
1199
- const { tenantId, projectId, id } = c.req.valid("param");
1166
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
1200
1167
  const deleted = await deleteAgentRelation(dbClient_default)({
1201
- scopes: { tenantId, projectId },
1168
+ scopes: { tenantId, projectId, graphId },
1202
1169
  relationId: id
1203
1170
  });
1204
1171
  if (!deleted) {
@@ -1218,9 +1185,9 @@ app5.openapi(
1218
1185
  path: "/",
1219
1186
  summary: "List Agents",
1220
1187
  operationId: "list-agents",
1221
- tags: ["CRUD Agent"],
1188
+ tags: ["Agent"],
1222
1189
  request: {
1223
- params: TenantProjectParamsSchema,
1190
+ params: TenantProjectGraphParamsSchema,
1224
1191
  query: PaginationQueryParamsSchema
1225
1192
  },
1226
1193
  responses: {
@@ -1236,11 +1203,11 @@ app5.openapi(
1236
1203
  }
1237
1204
  }),
1238
1205
  async (c) => {
1239
- const { tenantId, projectId } = c.req.valid("param");
1206
+ const { tenantId, projectId, graphId } = c.req.valid("param");
1240
1207
  const page = Number(c.req.query("page")) || 1;
1241
1208
  const limit = Math.min(Number(c.req.query("limit")) || 10, 100);
1242
1209
  const result = await listAgentsPaginated(dbClient_default)({
1243
- scopes: { tenantId, projectId },
1210
+ scopes: { tenantId, projectId, graphId },
1244
1211
  pagination: { page, limit }
1245
1212
  });
1246
1213
  const dataWithType = {
@@ -1259,9 +1226,9 @@ app5.openapi(
1259
1226
  path: "/{id}",
1260
1227
  summary: "Get Agent",
1261
1228
  operationId: "get-agent-by-id",
1262
- tags: ["CRUD Agent"],
1229
+ tags: ["Agent"],
1263
1230
  request: {
1264
- params: TenantProjectIdParamsSchema
1231
+ params: TenantProjectGraphIdParamsSchema
1265
1232
  },
1266
1233
  responses: {
1267
1234
  200: {
@@ -1276,9 +1243,9 @@ app5.openapi(
1276
1243
  }
1277
1244
  }),
1278
1245
  async (c) => {
1279
- const { tenantId, projectId, id } = c.req.valid("param");
1246
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
1280
1247
  const agent = await getAgentById(dbClient_default)({
1281
- scopes: { tenantId, projectId },
1248
+ scopes: { tenantId, projectId, graphId },
1282
1249
  agentId: id
1283
1250
  });
1284
1251
  if (!agent) {
@@ -1300,9 +1267,9 @@ app5.openapi(
1300
1267
  path: "/",
1301
1268
  summary: "Create Agent",
1302
1269
  operationId: "create-agent",
1303
- tags: ["CRUD Agent"],
1270
+ tags: ["Agent"],
1304
1271
  request: {
1305
- params: TenantProjectParamsSchema,
1272
+ params: TenantProjectGraphParamsSchema,
1306
1273
  body: {
1307
1274
  content: {
1308
1275
  "application/json": {
@@ -1324,14 +1291,15 @@ app5.openapi(
1324
1291
  }
1325
1292
  }),
1326
1293
  async (c) => {
1327
- const { tenantId, projectId } = c.req.valid("param");
1294
+ const { tenantId, projectId, graphId } = c.req.valid("param");
1328
1295
  const body = c.req.valid("json");
1329
1296
  const agentId = body.id ? String(body.id) : nanoid();
1330
1297
  const agent = await createAgent(dbClient_default)({
1331
1298
  ...body,
1332
1299
  id: agentId,
1333
1300
  tenantId,
1334
- projectId
1301
+ projectId,
1302
+ graphId
1335
1303
  });
1336
1304
  const agentWithType = {
1337
1305
  ...agent,
@@ -1346,9 +1314,9 @@ app5.openapi(
1346
1314
  path: "/{id}",
1347
1315
  summary: "Update Agent",
1348
1316
  operationId: "update-agent",
1349
- tags: ["CRUD Agent"],
1317
+ tags: ["Agent"],
1350
1318
  request: {
1351
- params: TenantProjectIdParamsSchema,
1319
+ params: TenantProjectGraphIdParamsSchema,
1352
1320
  body: {
1353
1321
  content: {
1354
1322
  "application/json": {
@@ -1370,10 +1338,10 @@ app5.openapi(
1370
1338
  }
1371
1339
  }),
1372
1340
  async (c) => {
1373
- const { tenantId, projectId, id } = c.req.valid("param");
1341
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
1374
1342
  const body = c.req.valid("json");
1375
1343
  const updatedAgent = await updateAgent(dbClient_default)({
1376
- scopes: { tenantId, projectId },
1344
+ scopes: { tenantId, projectId, graphId },
1377
1345
  agentId: id,
1378
1346
  data: body
1379
1347
  });
@@ -1396,9 +1364,9 @@ app5.openapi(
1396
1364
  path: "/{id}",
1397
1365
  summary: "Delete Agent",
1398
1366
  operationId: "delete-agent",
1399
- tags: ["CRUD Agent"],
1367
+ tags: ["Agent"],
1400
1368
  request: {
1401
- params: TenantProjectIdParamsSchema
1369
+ params: TenantProjectGraphIdParamsSchema
1402
1370
  },
1403
1371
  responses: {
1404
1372
  204: {
@@ -1415,9 +1383,9 @@ app5.openapi(
1415
1383
  }
1416
1384
  }),
1417
1385
  async (c) => {
1418
- const { tenantId, projectId, id } = c.req.valid("param");
1386
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
1419
1387
  const deleted = await deleteAgent(dbClient_default)({
1420
- scopes: { tenantId, projectId },
1388
+ scopes: { tenantId, projectId, graphId },
1421
1389
  agentId: id
1422
1390
  });
1423
1391
  if (!deleted) {
@@ -1437,9 +1405,9 @@ app6.openapi(
1437
1405
  path: "/",
1438
1406
  summary: "List Agent Tool Relations",
1439
1407
  operationId: "list-agent-tool-relations",
1440
- tags: ["CRUD Agent Tool Relations"],
1408
+ tags: ["Agent Tool Relations"],
1441
1409
  request: {
1442
- params: TenantProjectParamsSchema,
1410
+ params: TenantProjectGraphParamsSchema,
1443
1411
  query: PaginationQueryParamsSchema.extend({
1444
1412
  agentId: z.string().optional(),
1445
1413
  toolId: z.string().optional()
@@ -1458,13 +1426,12 @@ app6.openapi(
1458
1426
  }
1459
1427
  }),
1460
1428
  async (c) => {
1461
- const { tenantId, projectId } = c.req.valid("param");
1429
+ const { tenantId, projectId, graphId } = c.req.valid("param");
1462
1430
  const { page, limit, agentId, toolId } = c.req.valid("query");
1463
1431
  let result;
1464
1432
  if (agentId) {
1465
1433
  const dbResult = await getAgentToolRelationByAgent(dbClient_default)({
1466
- scopes: { tenantId, projectId },
1467
- agentId,
1434
+ scopes: { tenantId, projectId, graphId, agentId },
1468
1435
  pagination: { page, limit }
1469
1436
  });
1470
1437
  result = {
@@ -1473,7 +1440,7 @@ app6.openapi(
1473
1440
  };
1474
1441
  } else if (toolId) {
1475
1442
  const dbResult = await getAgentToolRelationByTool(dbClient_default)({
1476
- scopes: { tenantId, projectId },
1443
+ scopes: { tenantId, projectId, graphId },
1477
1444
  toolId,
1478
1445
  pagination: { page, limit }
1479
1446
  });
@@ -1483,7 +1450,7 @@ app6.openapi(
1483
1450
  };
1484
1451
  } else {
1485
1452
  const dbResult = await listAgentToolRelations(dbClient_default)({
1486
- scopes: { tenantId, projectId },
1453
+ scopes: { tenantId, projectId, graphId },
1487
1454
  pagination: { page, limit }
1488
1455
  });
1489
1456
  result = {
@@ -1500,9 +1467,9 @@ app6.openapi(
1500
1467
  path: "/{id}",
1501
1468
  summary: "Get Agent Tool Relation",
1502
1469
  operationId: "get-agent-tool-relation",
1503
- tags: ["CRUD Agent Tool Relations"],
1470
+ tags: ["Agent Tool Relations"],
1504
1471
  request: {
1505
- params: TenantProjectParamsSchema.merge(IdParamsSchema)
1472
+ params: TenantProjectGraphParamsSchema.merge(IdParamsSchema)
1506
1473
  },
1507
1474
  responses: {
1508
1475
  200: {
@@ -1517,9 +1484,9 @@ app6.openapi(
1517
1484
  }
1518
1485
  }),
1519
1486
  async (c) => {
1520
- const { tenantId, projectId, id } = c.req.valid("param");
1487
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
1521
1488
  const agentToolRelation = await getAgentToolRelationById(dbClient_default)({
1522
- scopes: { tenantId, projectId },
1489
+ scopes: { tenantId, projectId, graphId, agentId: id },
1523
1490
  relationId: id
1524
1491
  });
1525
1492
  if (!agentToolRelation) {
@@ -1537,9 +1504,9 @@ app6.openapi(
1537
1504
  path: "/agent/{agentId}/tools",
1538
1505
  summary: "Get Tools for Agent",
1539
1506
  operationId: "get-tools-for-agent",
1540
- tags: ["CRUD Agent Tool Relations"],
1507
+ tags: ["Agent Tool Relations"],
1541
1508
  request: {
1542
- params: TenantProjectParamsSchema.extend({
1509
+ params: TenantProjectGraphParamsSchema.extend({
1543
1510
  agentId: z.string()
1544
1511
  }),
1545
1512
  query: PaginationQueryParamsSchema
@@ -1557,11 +1524,10 @@ app6.openapi(
1557
1524
  }
1558
1525
  }),
1559
1526
  async (c) => {
1560
- const { tenantId, projectId, agentId } = c.req.valid("param");
1527
+ const { tenantId, projectId, graphId, agentId } = c.req.valid("param");
1561
1528
  const { page, limit } = c.req.valid("query");
1562
1529
  const dbResult = await getToolsForAgent(dbClient_default)({
1563
- scopes: { tenantId, projectId },
1564
- agentId,
1530
+ scopes: { tenantId, projectId, graphId, agentId },
1565
1531
  pagination: { page, limit }
1566
1532
  });
1567
1533
  const result = {
@@ -1577,9 +1543,9 @@ app6.openapi(
1577
1543
  path: "/tool/{toolId}/agents",
1578
1544
  summary: "Get Agents for Tool",
1579
1545
  operationId: "get-agents-for-tool",
1580
- tags: ["CRUD Agent Tool Relations"],
1546
+ tags: ["Agent Tool Relations"],
1581
1547
  request: {
1582
- params: TenantProjectParamsSchema.extend({
1548
+ params: TenantProjectGraphParamsSchema.extend({
1583
1549
  toolId: z.string()
1584
1550
  }),
1585
1551
  query: PaginationQueryParamsSchema
@@ -1597,18 +1563,14 @@ app6.openapi(
1597
1563
  }
1598
1564
  }),
1599
1565
  async (c) => {
1600
- const { tenantId, projectId, toolId } = c.req.valid("param");
1566
+ const { tenantId, projectId, graphId, toolId } = c.req.valid("param");
1601
1567
  const { page, limit } = c.req.valid("query");
1602
1568
  const dbResult = await getAgentsForTool(dbClient_default)({
1603
- scopes: { tenantId, projectId },
1569
+ scopes: { tenantId, projectId, graphId },
1604
1570
  toolId,
1605
1571
  pagination: { page, limit }
1606
1572
  });
1607
- const result = {
1608
- data: dbResult.data,
1609
- pagination: dbResult.pagination
1610
- };
1611
- return c.json(result);
1573
+ return c.json(dbResult);
1612
1574
  }
1613
1575
  );
1614
1576
  app6.openapi(
@@ -1617,9 +1579,9 @@ app6.openapi(
1617
1579
  path: "/",
1618
1580
  summary: "Create Agent Tool Relation",
1619
1581
  operationId: "create-agent-tool-relation",
1620
- tags: ["CRUD Agent Tool Relations"],
1582
+ tags: ["Agent Tool Relations"],
1621
1583
  request: {
1622
- params: TenantProjectParamsSchema,
1584
+ params: TenantProjectGraphParamsSchema,
1623
1585
  body: {
1624
1586
  content: {
1625
1587
  "application/json": {
@@ -1641,10 +1603,10 @@ app6.openapi(
1641
1603
  }
1642
1604
  }),
1643
1605
  async (c) => {
1644
- const { tenantId, projectId } = c.req.valid("param");
1606
+ const { tenantId, projectId, graphId } = c.req.valid("param");
1645
1607
  const body = c.req.valid("json");
1646
1608
  const existingRelations = await listAgentToolRelations(dbClient_default)({
1647
- scopes: { tenantId, projectId },
1609
+ scopes: { tenantId, projectId, graphId },
1648
1610
  pagination: { limit: 1e3 }
1649
1611
  });
1650
1612
  const isDuplicate = existingRelations.data.some((relation) => {
@@ -1659,7 +1621,7 @@ app6.openapi(
1659
1621
  }
1660
1622
  try {
1661
1623
  const agentToolRelation = await createAgentToolRelation(dbClient_default)({
1662
- scopes: { tenantId, projectId },
1624
+ scopes: { tenantId, projectId, graphId },
1663
1625
  data: body
1664
1626
  });
1665
1627
  return c.json({ data: agentToolRelation }, 201);
@@ -1680,9 +1642,9 @@ app6.openapi(
1680
1642
  path: "/{id}",
1681
1643
  summary: "Update Agent Tool Relation",
1682
1644
  operationId: "update-agent-tool-relation",
1683
- tags: ["CRUD Agent Tool Relations"],
1645
+ tags: ["Agent Tool Relations"],
1684
1646
  request: {
1685
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
1647
+ params: TenantProjectGraphParamsSchema.merge(IdParamsSchema),
1686
1648
  body: {
1687
1649
  content: {
1688
1650
  "application/json": {
@@ -1704,7 +1666,7 @@ app6.openapi(
1704
1666
  }
1705
1667
  }),
1706
1668
  async (c) => {
1707
- const { tenantId, projectId, id } = c.req.valid("param");
1669
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
1708
1670
  console.log("id", id);
1709
1671
  const body = await c.req.valid("json");
1710
1672
  if (Object.keys(body).length === 0) {
@@ -1714,7 +1676,7 @@ app6.openapi(
1714
1676
  });
1715
1677
  }
1716
1678
  const updatedAgentToolRelation = await updateAgentToolRelation(dbClient_default)({
1717
- scopes: { tenantId, projectId },
1679
+ scopes: { tenantId, projectId, graphId },
1718
1680
  relationId: id,
1719
1681
  data: body
1720
1682
  });
@@ -1733,9 +1695,9 @@ app6.openapi(
1733
1695
  path: "/{id}",
1734
1696
  summary: "Delete Agent Tool Relation",
1735
1697
  operationId: "delete-agent-tool-relation",
1736
- tags: ["CRUD Agent Tool Relations"],
1698
+ tags: ["Agent Tool Relations"],
1737
1699
  request: {
1738
- params: TenantProjectParamsSchema.merge(IdParamsSchema)
1700
+ params: TenantProjectGraphParamsSchema.merge(IdParamsSchema)
1739
1701
  },
1740
1702
  responses: {
1741
1703
  204: {
@@ -1752,9 +1714,9 @@ app6.openapi(
1752
1714
  }
1753
1715
  }),
1754
1716
  async (c) => {
1755
- const { tenantId, projectId, id } = c.req.valid("param");
1717
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
1756
1718
  const deleted = await deleteAgentToolRelation(dbClient_default)({
1757
- scopes: { tenantId, projectId },
1719
+ scopes: { tenantId, projectId, graphId },
1758
1720
  relationId: id
1759
1721
  });
1760
1722
  if (!deleted) {
@@ -1775,7 +1737,7 @@ app7.openapi(
1775
1737
  summary: "List API Keys",
1776
1738
  description: "List all API keys for a tenant with optional pagination",
1777
1739
  operationId: "list-api-keys",
1778
- tags: ["CRUD API Keys"],
1740
+ tags: ["API Keys"],
1779
1741
  request: {
1780
1742
  params: TenantProjectParamsSchema,
1781
1743
  query: PaginationQueryParamsSchema.extend({
@@ -1818,7 +1780,7 @@ app7.openapi(
1818
1780
  summary: "Get API Key",
1819
1781
  description: "Get a specific API key by ID (does not return the actual key)",
1820
1782
  operationId: "get-api-key-by-id",
1821
- tags: ["CRUD API Keys"],
1783
+ tags: ["API Keys"],
1822
1784
  request: {
1823
1785
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
1824
1786
  },
@@ -1863,7 +1825,7 @@ app7.openapi(
1863
1825
  summary: "Create API Key",
1864
1826
  description: "Create a new API key for a graph. Returns the full key (shown only once).",
1865
1827
  operationId: "create-api-key",
1866
- tags: ["CRUD API Keys"],
1828
+ tags: ["API Keys"],
1867
1829
  request: {
1868
1830
  params: TenantProjectParamsSchema,
1869
1831
  body: {
@@ -1932,7 +1894,7 @@ app7.openapi(
1932
1894
  summary: "Update API Key",
1933
1895
  description: "Update an API key (currently only expiration date can be changed)",
1934
1896
  operationId: "update-api-key",
1935
- tags: ["CRUD API Keys"],
1897
+ tags: ["API Keys"],
1936
1898
  request: {
1937
1899
  params: TenantProjectParamsSchema.merge(IdParamsSchema),
1938
1900
  body: {
@@ -1988,7 +1950,7 @@ app7.openapi(
1988
1950
  summary: "Delete API Key",
1989
1951
  description: "Delete an API key permanently",
1990
1952
  operationId: "delete-api-key",
1991
- tags: ["CRUD API Keys"],
1953
+ tags: ["API Keys"],
1992
1954
  request: {
1993
1955
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
1994
1956
  },
@@ -2029,7 +1991,7 @@ app8.openapi(
2029
1991
  path: "/",
2030
1992
  summary: "List Artifact Components",
2031
1993
  operationId: "list-artifact-components",
2032
- tags: ["CRUD Artifact Component"],
1994
+ tags: ["Artifact Component"],
2033
1995
  request: {
2034
1996
  params: TenantProjectParamsSchema,
2035
1997
  query: PaginationQueryParamsSchema
@@ -2063,7 +2025,7 @@ app8.openapi(
2063
2025
  path: "/{id}",
2064
2026
  summary: "Get Artifact Component",
2065
2027
  operationId: "get-artifact-component-by-id",
2066
- tags: ["CRUD Artifact Component"],
2028
+ tags: ["Artifact Component"],
2067
2029
  request: {
2068
2030
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
2069
2031
  },
@@ -2100,7 +2062,7 @@ app8.openapi(
2100
2062
  path: "/",
2101
2063
  summary: "Create Artifact Component",
2102
2064
  operationId: "create-artifact-component",
2103
- tags: ["CRUD Artifact Component"],
2065
+ tags: ["Artifact Component"],
2104
2066
  request: {
2105
2067
  params: TenantProjectParamsSchema,
2106
2068
  body: {
@@ -2158,7 +2120,7 @@ app8.openapi(
2158
2120
  path: "/{id}",
2159
2121
  summary: "Update Artifact Component",
2160
2122
  operationId: "update-artifact-component",
2161
- tags: ["CRUD Artifact Component"],
2123
+ tags: ["Artifact Component"],
2162
2124
  request: {
2163
2125
  params: TenantProjectParamsSchema.merge(IdParamsSchema),
2164
2126
  body: {
@@ -2209,7 +2171,7 @@ app8.openapi(
2209
2171
  path: "/{id}",
2210
2172
  summary: "Delete Artifact Component",
2211
2173
  operationId: "delete-artifact-component",
2212
- tags: ["CRUD Artifact Component"],
2174
+ tags: ["Artifact Component"],
2213
2175
  request: {
2214
2176
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
2215
2177
  },
@@ -2250,7 +2212,7 @@ app9.openapi(
2250
2212
  path: "/",
2251
2213
  summary: "List Context Configurations",
2252
2214
  operationId: "list-context-configs",
2253
- tags: ["CRUD Context Config"],
2215
+ tags: ["Context Config"],
2254
2216
  request: {
2255
2217
  params: TenantProjectParamsSchema,
2256
2218
  query: PaginationQueryParamsSchema
@@ -2284,7 +2246,7 @@ app9.openapi(
2284
2246
  path: "/{id}",
2285
2247
  summary: "Get Context Configuration",
2286
2248
  operationId: "get-context-config-by-id",
2287
- tags: ["CRUD Context Config"],
2249
+ tags: ["Context Config"],
2288
2250
  request: {
2289
2251
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
2290
2252
  },
@@ -2321,7 +2283,7 @@ app9.openapi(
2321
2283
  path: "/",
2322
2284
  summary: "Create Context Configuration",
2323
2285
  operationId: "create-context-config",
2324
- tags: ["CRUD Context Config"],
2286
+ tags: ["Context Config"],
2325
2287
  request: {
2326
2288
  params: TenantProjectParamsSchema,
2327
2289
  body: {
@@ -2362,7 +2324,7 @@ app9.openapi(
2362
2324
  path: "/{id}",
2363
2325
  summary: "Update Context Configuration",
2364
2326
  operationId: "update-context-config",
2365
- tags: ["CRUD Context Config"],
2327
+ tags: ["Context Config"],
2366
2328
  request: {
2367
2329
  params: TenantProjectParamsSchema.merge(IdParamsSchema),
2368
2330
  body: {
@@ -2408,7 +2370,7 @@ app9.openapi(
2408
2370
  path: "/{id}",
2409
2371
  summary: "Delete Context Configuration",
2410
2372
  operationId: "delete-context-config",
2411
- tags: ["CRUD Context Config"],
2373
+ tags: ["Context Config"],
2412
2374
  request: {
2413
2375
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
2414
2376
  },
@@ -2442,7 +2404,7 @@ app10.openapi(
2442
2404
  path: "/",
2443
2405
  summary: "List Credentials",
2444
2406
  operationId: "list-credentials",
2445
- tags: ["CRUD Credential"],
2407
+ tags: ["Credential"],
2446
2408
  request: {
2447
2409
  params: TenantProjectParamsSchema,
2448
2410
  query: PaginationQueryParamsSchema
@@ -2477,7 +2439,7 @@ app10.openapi(
2477
2439
  path: "/{id}",
2478
2440
  summary: "Get Credential",
2479
2441
  operationId: "get-credential-by-id",
2480
- tags: ["CRUD Credential"],
2442
+ tags: ["Credential"],
2481
2443
  request: {
2482
2444
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
2483
2445
  },
@@ -2515,7 +2477,7 @@ app10.openapi(
2515
2477
  path: "/",
2516
2478
  summary: "Create Credential",
2517
2479
  operationId: "create-credential",
2518
- tags: ["CRUD Credential"],
2480
+ tags: ["Credential"],
2519
2481
  request: {
2520
2482
  params: TenantProjectParamsSchema,
2521
2483
  body: {
@@ -2557,7 +2519,7 @@ app10.openapi(
2557
2519
  path: "/{id}",
2558
2520
  summary: "Update Credential",
2559
2521
  operationId: "update-credential",
2560
- tags: ["CRUD Credential"],
2522
+ tags: ["Credential"],
2561
2523
  request: {
2562
2524
  params: TenantProjectParamsSchema.merge(IdParamsSchema),
2563
2525
  body: {
@@ -2604,7 +2566,7 @@ app10.openapi(
2604
2566
  path: "/{id}",
2605
2567
  summary: "Delete Credential",
2606
2568
  operationId: "delete-credential",
2607
- tags: ["CRUD Credential"],
2569
+ tags: ["Credential"],
2608
2570
  request: {
2609
2571
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
2610
2572
  },
@@ -2677,7 +2639,7 @@ app11.openapi(
2677
2639
  path: "/",
2678
2640
  summary: "List Data Components",
2679
2641
  operationId: "list-data-components",
2680
- tags: ["CRUD Data Component"],
2642
+ tags: ["Data Component"],
2681
2643
  request: {
2682
2644
  params: TenantProjectParamsSchema,
2683
2645
  query: PaginationQueryParamsSchema
@@ -2711,7 +2673,7 @@ app11.openapi(
2711
2673
  path: "/{id}",
2712
2674
  summary: "Get Data Component",
2713
2675
  operationId: "get-data-component-by-id",
2714
- tags: ["CRUD Data Component"],
2676
+ tags: ["Data Component"],
2715
2677
  request: {
2716
2678
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
2717
2679
  },
@@ -2748,7 +2710,7 @@ app11.openapi(
2748
2710
  path: "/",
2749
2711
  summary: "Create Data Component",
2750
2712
  operationId: "create-data-component",
2751
- tags: ["CRUD Data Component"],
2713
+ tags: ["Data Component"],
2752
2714
  request: {
2753
2715
  params: TenantProjectParamsSchema,
2754
2716
  body: {
@@ -2789,7 +2751,7 @@ app11.openapi(
2789
2751
  path: "/{id}",
2790
2752
  summary: "Update Data Component",
2791
2753
  operationId: "update-data-component",
2792
- tags: ["CRUD Data Component"],
2754
+ tags: ["Data Component"],
2793
2755
  request: {
2794
2756
  params: TenantProjectParamsSchema.merge(IdParamsSchema),
2795
2757
  body: {
@@ -2835,7 +2797,7 @@ app11.openapi(
2835
2797
  path: "/{id}",
2836
2798
  summary: "Delete Data Component",
2837
2799
  operationId: "delete-data-component",
2838
- tags: ["CRUD Data Component"],
2800
+ tags: ["Data Component"],
2839
2801
  request: {
2840
2802
  params: TenantProjectParamsSchema.merge(IdParamsSchema)
2841
2803
  },
@@ -2876,9 +2838,9 @@ app12.openapi(
2876
2838
  path: "/",
2877
2839
  summary: "List External Agents",
2878
2840
  operationId: "list-external-agents",
2879
- tags: ["CRUD External Agents"],
2841
+ tags: ["External Agents"],
2880
2842
  request: {
2881
- params: TenantProjectParamsSchema,
2843
+ params: TenantProjectGraphParamsSchema,
2882
2844
  query: PaginationQueryParamsSchema
2883
2845
  },
2884
2846
  responses: {
@@ -2894,10 +2856,10 @@ app12.openapi(
2894
2856
  }
2895
2857
  }),
2896
2858
  async (c) => {
2897
- const { tenantId, projectId } = c.req.valid("param");
2859
+ const { tenantId, projectId, graphId } = c.req.valid("param");
2898
2860
  const { page, limit } = c.req.valid("query");
2899
2861
  const result = await listExternalAgentsPaginated(dbClient_default)({
2900
- scopes: { tenantId, projectId },
2862
+ scopes: { tenantId, projectId, graphId },
2901
2863
  pagination: { page, limit }
2902
2864
  });
2903
2865
  const dataWithType = {
@@ -2916,9 +2878,9 @@ app12.openapi(
2916
2878
  path: "/{id}",
2917
2879
  summary: "Get External Agent",
2918
2880
  operationId: "get-external-agent-by-id",
2919
- tags: ["CRUD External Agents"],
2881
+ tags: ["External Agents"],
2920
2882
  request: {
2921
- params: TenantProjectParamsSchema.merge(IdParamsSchema)
2883
+ params: TenantProjectGraphIdParamsSchema
2922
2884
  },
2923
2885
  responses: {
2924
2886
  200: {
@@ -2933,9 +2895,9 @@ app12.openapi(
2933
2895
  }
2934
2896
  }),
2935
2897
  async (c) => {
2936
- const { tenantId, projectId, id } = c.req.valid("param");
2898
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
2937
2899
  const externalAgent = await getExternalAgent(dbClient_default)({
2938
- scopes: { tenantId, projectId },
2900
+ scopes: { tenantId, projectId, graphId },
2939
2901
  agentId: id
2940
2902
  });
2941
2903
  if (!externalAgent) {
@@ -2957,9 +2919,9 @@ app12.openapi(
2957
2919
  path: "/",
2958
2920
  summary: "Create External Agent",
2959
2921
  operationId: "create-external-agent",
2960
- tags: ["CRUD External Agents"],
2922
+ tags: ["External Agents"],
2961
2923
  request: {
2962
- params: TenantProjectParamsSchema,
2924
+ params: TenantProjectGraphParamsSchema,
2963
2925
  body: {
2964
2926
  content: {
2965
2927
  "application/json": {
@@ -2981,11 +2943,12 @@ app12.openapi(
2981
2943
  }
2982
2944
  }),
2983
2945
  async (c) => {
2984
- const { tenantId, projectId } = c.req.valid("param");
2946
+ const { tenantId, projectId, graphId } = c.req.valid("param");
2985
2947
  const body = c.req.valid("json");
2986
2948
  const externalAgentData = {
2987
2949
  tenantId,
2988
2950
  projectId,
2951
+ graphId,
2989
2952
  id: body.id ? String(body.id) : nanoid(),
2990
2953
  name: body.name,
2991
2954
  description: body.description,
@@ -3007,9 +2970,9 @@ app12.openapi(
3007
2970
  path: "/{id}",
3008
2971
  summary: "Update External Agent",
3009
2972
  operationId: "update-external-agent",
3010
- tags: ["CRUD External Agents"],
2973
+ tags: ["External Agents"],
3011
2974
  request: {
3012
- params: TenantProjectParamsSchema.merge(IdParamsSchema),
2975
+ params: TenantProjectGraphIdParamsSchema,
3013
2976
  body: {
3014
2977
  content: {
3015
2978
  "application/json": {
@@ -3031,10 +2994,10 @@ app12.openapi(
3031
2994
  }
3032
2995
  }),
3033
2996
  async (c) => {
3034
- const { tenantId, projectId, id } = c.req.valid("param");
2997
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
3035
2998
  const body = c.req.valid("json");
3036
2999
  const updatedExternalAgent = await updateExternalAgent(dbClient_default)({
3037
- scopes: { tenantId, projectId },
3000
+ scopes: { tenantId, projectId, graphId },
3038
3001
  agentId: id,
3039
3002
  data: body
3040
3003
  });
@@ -3057,9 +3020,9 @@ app12.openapi(
3057
3020
  path: "/{id}",
3058
3021
  summary: "Delete External Agent",
3059
3022
  operationId: "delete-external-agent",
3060
- tags: ["CRUD External Agents"],
3023
+ tags: ["External Agents"],
3061
3024
  request: {
3062
- params: TenantProjectParamsSchema.merge(IdParamsSchema)
3025
+ params: TenantProjectGraphIdParamsSchema
3063
3026
  },
3064
3027
  responses: {
3065
3028
  204: {
@@ -3076,9 +3039,9 @@ app12.openapi(
3076
3039
  }
3077
3040
  }),
3078
3041
  async (c) => {
3079
- const { tenantId, projectId, id } = c.req.valid("param");
3042
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
3080
3043
  const deleted = await deleteExternalAgent(dbClient_default)({
3081
- scopes: { tenantId, projectId },
3044
+ scopes: { tenantId, projectId, graphId },
3082
3045
  agentId: id
3083
3046
  });
3084
3047
  if (!deleted) {
@@ -3113,7 +3076,7 @@ app13.openapi(
3113
3076
  path: "/",
3114
3077
  summary: "Create Full Graph",
3115
3078
  operationId: "create-full-graph",
3116
- tags: ["CRUD Full Graph"],
3079
+ tags: ["Full Graph"],
3117
3080
  description: "Create a complete agent graph with all agents, tools, and relationships from JSON definition",
3118
3081
  request: {
3119
3082
  params: TenantProjectParamsSchema,
@@ -3162,7 +3125,7 @@ app13.openapi(
3162
3125
  path: "/{graphId}",
3163
3126
  summary: "Get Full Graph",
3164
3127
  operationId: "get-full-graph",
3165
- tags: ["CRUD Full Graph"],
3128
+ tags: ["Full Graph"],
3166
3129
  description: "Retrieve a complete agent graph definition with all agents, tools, and relationships",
3167
3130
  request: {
3168
3131
  params: GraphIdParamsSchema
@@ -3186,8 +3149,7 @@ app13.openapi(
3186
3149
  dbClient_default,
3187
3150
  logger3
3188
3151
  )({
3189
- scopes: { tenantId, projectId },
3190
- graphId
3152
+ scopes: { tenantId, projectId, graphId }
3191
3153
  });
3192
3154
  if (!graph) {
3193
3155
  throw createApiError({
@@ -3216,7 +3178,7 @@ app13.openapi(
3216
3178
  path: "/{graphId}",
3217
3179
  summary: "Update Full Graph",
3218
3180
  operationId: "update-full-graph",
3219
- tags: ["CRUD Full Graph"],
3181
+ tags: ["Full Graph"],
3220
3182
  description: "Update or create a complete agent graph with all agents, tools, and relationships from JSON definition",
3221
3183
  request: {
3222
3184
  params: GraphIdParamsSchema,
@@ -3263,8 +3225,7 @@ app13.openapi(
3263
3225
  dbClient_default,
3264
3226
  logger3
3265
3227
  )({
3266
- scopes: { tenantId, projectId },
3267
- graphId
3228
+ scopes: { tenantId, projectId, graphId }
3268
3229
  });
3269
3230
  const isCreate = !existingGraph;
3270
3231
  const updatedGraph = isCreate ? await createFullGraphServerSide(dbClient_default, logger3)(
@@ -3301,7 +3262,7 @@ app13.openapi(
3301
3262
  path: "/{graphId}",
3302
3263
  summary: "Delete Full Graph",
3303
3264
  operationId: "delete-full-graph",
3304
- tags: ["CRUD Full Graph"],
3265
+ tags: ["Full Graph"],
3305
3266
  description: "Delete a complete agent graph and cascade to all related entities (relationships, not agents/tools)",
3306
3267
  request: {
3307
3268
  params: GraphIdParamsSchema
@@ -3320,8 +3281,7 @@ app13.openapi(
3320
3281
  dbClient_default,
3321
3282
  logger3
3322
3283
  )({
3323
- scopes: { tenantId, projectId },
3324
- graphId
3284
+ scopes: { tenantId, projectId, graphId }
3325
3285
  });
3326
3286
  if (!deleted) {
3327
3287
  throw createApiError({
@@ -3922,14 +3882,14 @@ function retrievePKCEVerifier(state) {
3922
3882
  return null;
3923
3883
  }
3924
3884
  var OAuthService = class {
3925
- constructor(config2 = {}) {
3885
+ constructor(config = {}) {
3926
3886
  __publicField(this, "defaultConfig");
3927
3887
  this.defaultConfig = {
3928
- defaultClientId: config2.defaultClientId || process.env.DEFAULT_OAUTH_CLIENT_ID || "mcp-client",
3929
- clientName: config2.clientName || process.env.OAUTH_CLIENT_NAME || "Inkeep Agent Framework",
3930
- clientUri: config2.clientUri || process.env.OAUTH_CLIENT_URI || "https://inkeep.com",
3931
- logoUri: config2.logoUri || process.env.OAUTH_CLIENT_LOGO_URI || "https://inkeep.com/images/logos/inkeep-logo-blue.svg",
3932
- redirectBaseUrl: config2.redirectBaseUrl || process.env.OAUTH_REDIRECT_BASE_URL || "http://localhost:3002"
3888
+ defaultClientId: config.defaultClientId || process.env.DEFAULT_OAUTH_CLIENT_ID || "mcp-client",
3889
+ clientName: config.clientName || process.env.OAUTH_CLIENT_NAME || "Inkeep Agent Framework",
3890
+ clientUri: config.clientUri || process.env.OAUTH_CLIENT_URI || "https://inkeep.com",
3891
+ logoUri: config.logoUri || process.env.OAUTH_CLIENT_LOGO_URI || "https://inkeep.com/images/logos/inkeep-logo-blue.svg",
3892
+ redirectBaseUrl: config.redirectBaseUrl || process.env.OAUTH_REDIRECT_BASE_URL || "http://localhost:3002"
3933
3893
  };
3934
3894
  }
3935
3895
  /**
@@ -4073,7 +4033,7 @@ var OAuthService = class {
4073
4033
  const tokenUrl = new URL(oAuthConfig.tokenUrl);
4074
4034
  const oauthServerUrl = `${tokenUrl.protocol}//${tokenUrl.host}`;
4075
4035
  logger6.info({ oauthServerUrl, clientId }, "Attempting openid-client discovery");
4076
- const config2 = await oauth.discovery(
4036
+ const config = await oauth.discovery(
4077
4037
  new URL(oauthServerUrl),
4078
4038
  clientId,
4079
4039
  void 0
@@ -4082,7 +4042,7 @@ var OAuthService = class {
4082
4042
  const callbackUrl = new URL(
4083
4043
  `${redirectUri}?${new URLSearchParams({ code, state: "unused" }).toString()}`
4084
4044
  );
4085
- return await oauth.authorizationCodeGrant(config2, callbackUrl, {
4045
+ return await oauth.authorizationCodeGrant(config, callbackUrl, {
4086
4046
  pkceCodeVerifier: codeVerifier
4087
4047
  });
4088
4048
  }
@@ -4147,7 +4107,7 @@ app15.openapi(
4147
4107
  path: "/",
4148
4108
  summary: "List Tools",
4149
4109
  operationId: "list-tools",
4150
- tags: ["CRUD Tools"],
4110
+ tags: ["Tools"],
4151
4111
  request: {
4152
4112
  params: TenantProjectParamsSchema,
4153
4113
  query: PaginationQueryParamsSchema.extend({
@@ -4200,7 +4160,7 @@ app15.openapi(
4200
4160
  path: "/{id}",
4201
4161
  summary: "Get Tool",
4202
4162
  operationId: "get-tool",
4203
- tags: ["CRUD Tools"],
4163
+ tags: ["Tools"],
4204
4164
  request: {
4205
4165
  params: TenantProjectParamsSchema.extend(IdParamsSchema.shape)
4206
4166
  },
@@ -4236,7 +4196,7 @@ app15.openapi(
4236
4196
  path: "/",
4237
4197
  summary: "Create Tool",
4238
4198
  operationId: "create-tool",
4239
- tags: ["CRUD Tools"],
4199
+ tags: ["Tools"],
4240
4200
  request: {
4241
4201
  params: TenantProjectParamsSchema,
4242
4202
  body: {
@@ -4288,7 +4248,7 @@ app15.openapi(
4288
4248
  path: "/{id}",
4289
4249
  summary: "Update Tool",
4290
4250
  operationId: "update-tool",
4291
- tags: ["CRUD Tools"],
4251
+ tags: ["Tools"],
4292
4252
  request: {
4293
4253
  params: TenantProjectParamsSchema.extend(IdParamsSchema.shape),
4294
4254
  body: {
@@ -4348,7 +4308,7 @@ app15.openapi(
4348
4308
  path: "/{id}",
4349
4309
  summary: "Delete Tool",
4350
4310
  operationId: "delete-tool",
4351
- tags: ["CRUD Tools"],
4311
+ tags: ["Tools"],
4352
4312
  request: {
4353
4313
  params: TenantProjectParamsSchema.extend(IdParamsSchema.shape)
4354
4314
  },
@@ -4384,7 +4344,7 @@ app15.openapi(
4384
4344
  path: "/{id}/health-check",
4385
4345
  summary: "Check Tool Health",
4386
4346
  operationId: "check-tool-health",
4387
- tags: ["CRUD Tools"],
4347
+ tags: ["Tools"],
4388
4348
  request: {
4389
4349
  params: TenantProjectParamsSchema.extend(IdParamsSchema.shape)
4390
4350
  },
@@ -4440,7 +4400,7 @@ app15.openapi(
4440
4400
  path: "/health-check-all",
4441
4401
  summary: "Check All Tools Health",
4442
4402
  operationId: "check-all-tools-health",
4443
- tags: ["CRUD Tools"],
4403
+ tags: ["Tools"],
4444
4404
  request: {
4445
4405
  params: TenantProjectParamsSchema
4446
4406
  },
@@ -4504,7 +4464,7 @@ app15.openapi(
4504
4464
  path: "/{id}/sync",
4505
4465
  summary: "Sync Tool Definitions",
4506
4466
  operationId: "sync-tool-definitions",
4507
- tags: ["CRUD Tools"],
4467
+ tags: ["Tools"],
4508
4468
  request: {
4509
4469
  params: TenantProjectParamsSchema.extend(IdParamsSchema.shape)
4510
4470
  },
@@ -4548,7 +4508,7 @@ app15.openapi(
4548
4508
  path: "/{id}/available-tools",
4549
4509
  summary: "Get Available Tools",
4550
4510
  operationId: "get-available-tools",
4551
- tags: ["CRUD Tools"],
4511
+ tags: ["Tools"],
4552
4512
  request: {
4553
4513
  params: TenantProjectParamsSchema.extend(IdParamsSchema.shape)
4554
4514
  },
@@ -4600,7 +4560,7 @@ app15.openapi(
4600
4560
  path: "/{id}/status",
4601
4561
  summary: "Update Tool Status",
4602
4562
  operationId: "update-tool-status",
4603
- tags: ["CRUD Tools"],
4563
+ tags: ["Tools"],
4604
4564
  request: {
4605
4565
  params: TenantProjectParamsSchema.extend(IdParamsSchema.shape),
4606
4566
  body: {
@@ -4720,17 +4680,17 @@ var tools_default = app15;
4720
4680
  // src/routes/index.ts
4721
4681
  var app16 = new OpenAPIHono();
4722
4682
  app16.route("/projects", projects_default);
4723
- app16.route("/projects/:projectId/agents", agents_default);
4724
- app16.route("/projects/:projectId/agent-relations", agentRelations_default);
4683
+ app16.route("/projects/:projectId/graphs/:graphId/agents", agents_default);
4684
+ app16.route("/projects/:projectId/graphs/:graphId/agent-relations", agentRelations_default);
4725
4685
  app16.route("/projects/:projectId/agent-graphs", agentGraph_default);
4726
- app16.route("/projects/:projectId/agent-tool-relations", agentToolRelations_default);
4727
- app16.route("/projects/:projectId/agent-artifact-components", agentArtifactComponents_default);
4728
- app16.route("/projects/:projectId/agent-data-components", agentDataComponents_default);
4686
+ app16.route("/projects/:projectId/graphs/:graphId/agent-tool-relations", agentToolRelations_default);
4687
+ app16.route("/projects/:projectId/graphs/:graphId/agent-artifact-components", agentArtifactComponents_default);
4688
+ app16.route("/projects/:projectId/graphs/:graphId/agent-data-components", agentDataComponents_default);
4729
4689
  app16.route("/projects/:projectId/artifact-components", artifactComponents_default);
4730
4690
  app16.route("/projects/:projectId/context-configs", contextConfigs_default);
4731
4691
  app16.route("/projects/:projectId/credentials", credentials_default);
4732
4692
  app16.route("/projects/:projectId/data-components", dataComponents_default);
4733
- app16.route("/projects/:projectId/external-agents", externalAgents_default);
4693
+ app16.route("/projects/:projectId/graphs/:graphId/external-agents", externalAgents_default);
4734
4694
  app16.route("/projects/:projectId/tools", tools_default);
4735
4695
  app16.route("/projects/:projectId/api-keys", apiKeys_default);
4736
4696
  app16.route("/projects/:projectId/graph", graphFull_default);
@@ -4930,7 +4890,7 @@ app18.openapi(
4930
4890
  path: "/project-full",
4931
4891
  summary: "Create Full Project",
4932
4892
  operationId: "create-full-project",
4933
- tags: ["CRUD Full Project"],
4893
+ tags: ["Full Project"],
4934
4894
  description: "Create a complete project with all graphs, agents, tools, and relationships from JSON definition",
4935
4895
  request: {
4936
4896
  params: TenantParamsSchema2,
@@ -4989,7 +4949,7 @@ app18.openapi(
4989
4949
  path: "/project-full/{projectId}",
4990
4950
  summary: "Get Full Project",
4991
4951
  operationId: "get-full-project",
4992
- tags: ["CRUD Full Project"],
4952
+ tags: ["Full Project"],
4993
4953
  description: "Retrieve a complete project definition with all graphs, agents, tools, and relationships",
4994
4954
  request: {
4995
4955
  params: ProjectIdParamsSchema
@@ -5013,8 +4973,7 @@ app18.openapi(
5013
4973
  dbClient_default,
5014
4974
  logger8
5015
4975
  )({
5016
- scopes: { tenantId, projectId },
5017
- projectId
4976
+ scopes: { tenantId, projectId }
5018
4977
  });
5019
4978
  if (!project) {
5020
4979
  throw createApiError({
@@ -5043,7 +5002,7 @@ app18.openapi(
5043
5002
  path: "/project-full/{projectId}",
5044
5003
  summary: "Update Full Project",
5045
5004
  operationId: "update-full-project",
5046
- tags: ["CRUD Full Project"],
5005
+ tags: ["Full Project"],
5047
5006
  description: "Update or create a complete project with all graphs, agents, tools, and relationships from JSON definition",
5048
5007
  request: {
5049
5008
  params: ProjectIdParamsSchema,
@@ -5090,8 +5049,7 @@ app18.openapi(
5090
5049
  dbClient_default,
5091
5050
  logger8
5092
5051
  )({
5093
- scopes: { tenantId, projectId },
5094
- projectId
5052
+ scopes: { tenantId, projectId }
5095
5053
  });
5096
5054
  const isCreate = !existingProject;
5097
5055
  const updatedProject = isCreate ? await createFullProjectServerSide(dbClient_default, logger8)(
@@ -5128,7 +5086,7 @@ app18.openapi(
5128
5086
  path: "/project-full/{projectId}",
5129
5087
  summary: "Delete Full Project",
5130
5088
  operationId: "delete-full-project",
5131
- tags: ["CRUD Full Project"],
5089
+ tags: ["Full Project"],
5132
5090
  description: "Delete a complete project and cascade to all related entities (graphs, agents, tools, relationships)",
5133
5091
  request: {
5134
5092
  params: ProjectIdParamsSchema
@@ -5147,8 +5105,7 @@ app18.openapi(
5147
5105
  dbClient_default,
5148
5106
  logger8
5149
5107
  )({
5150
- scopes: { tenantId, projectId },
5151
- projectId
5108
+ scopes: { tenantId, projectId }
5152
5109
  });
5153
5110
  if (!deleted) {
5154
5111
  throw createApiError({
@@ -5302,7 +5259,7 @@ function createManagementHono(serverConfig, credentialStores) {
5302
5259
  }
5303
5260
  );
5304
5261
  app20.use("/tenants/*", apiKeyAuth());
5305
- app20.route("/tenants/:tenantId/crud", routes_default);
5262
+ app20.route("/tenants/:tenantId", routes_default);
5306
5263
  app20.route("/tenants/:tenantId", projectFull_default);
5307
5264
  app20.route("/oauth", oauth_default);
5308
5265
  setupOpenAPIRoutes(app20);
@@ -5325,9 +5282,9 @@ var defaultStores = createDefaultCredentialStores();
5325
5282
  var defaultRegistry = new CredentialStoreRegistry(defaultStores);
5326
5283
  var app19 = createManagementHono(defaultConfig, defaultRegistry);
5327
5284
  var index_default = app19;
5328
- function createManagementApp(config2) {
5329
- const serverConfig = config2?.serverConfig ?? defaultConfig;
5330
- const stores = config2?.credentialStores ?? defaultStores;
5285
+ function createManagementApp(config) {
5286
+ const serverConfig = config?.serverConfig ?? defaultConfig;
5287
+ const stores = config?.credentialStores ?? defaultStores;
5331
5288
  const registry = new CredentialStoreRegistry(stores);
5332
5289
  return createManagementHono(serverConfig, registry);
5333
5290
  }