@inkeep/agents-manage-api 0.0.0-dev-20251010175818 → 0.0.0-dev-20251010180500

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 +386 -133
  2. package/dist/index.js +387 -134
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { loadEnvironmentFiles, getLogger, createDatabaseClient, commonGetErrorResponses, ListResponseSchema, PaginationQueryParamsSchema, TenantProjectParamsSchema, AgentGraphApiSelectSchema, listAgentGraphs, SingleResponseSchema, TenantProjectIdParamsSchema, getAgentGraphById, createApiError, getGraphAgentInfos, GraphWithinContextOfProjectSchema, getFullGraphDefinition, AgentGraphApiInsertSchema, createAgentGraph, AgentGraphApiUpdateSchema, updateAgentGraph, ErrorResponseSchema, deleteAgentGraph, TenantProjectGraphParamsSchema, SubAgentApiSelectSchema, listSubAgentsPaginated, TenantProjectGraphIdParamsSchema, getSubAgentById, SubAgentApiInsertSchema, createSubAgent, SubAgentApiUpdateSchema, updateSubAgent, deleteSubAgent, SubAgentToolRelationApiSelectSchema, getAgentToolRelationByAgent, getAgentToolRelationByTool, listAgentToolRelations, getAgentToolRelationById, getAgentsForTool, SubAgentToolRelationApiInsertSchema, createAgentToolRelation, SubAgentToolRelationApiUpdateSchema, updateAgentToolRelation, deleteAgentToolRelation, ApiKeyApiSelectSchema, listApiKeysPaginated, getApiKeyById, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, generateApiKey, createApiKey, ApiKeyApiUpdateSchema, updateApiKey, deleteApiKey, ArtifactComponentApiSelectSchema, listArtifactComponentsPaginated, getArtifactComponentById, ArtifactComponentApiInsertSchema, validatePropsAsJsonSchema, createArtifactComponent, ArtifactComponentApiUpdateSchema, updateArtifactComponent, deleteArtifactComponent, ContextConfigApiSelectSchema, listContextConfigsPaginated, getContextConfigById, ContextConfigApiInsertSchema, createContextConfig, commonUpdateErrorResponses, ContextConfigApiUpdateSchema, updateContextConfig, commonDeleteErrorResponses, deleteContextConfig, CredentialReferenceApiSelectSchema, listCredentialReferencesPaginated, getCredentialReferenceWithTools, CredentialReferenceApiInsertSchema, createCredentialReference, CredentialReferenceApiUpdateSchema, updateCredentialReference, getCredentialReferenceById, getCredentialStoreLookupKeyFromRetrievalParams, deleteCredentialReference, DataComponentApiSelectSchema, listDataComponentsPaginated, getDataComponent, DataComponentApiInsertSchema, createDataComponent, DataComponentApiUpdateSchema, updateDataComponent, deleteDataComponent, ExternalAgentApiSelectSchema, listExternalAgentsPaginated, getExternalAgent, ExternalAgentApiInsertSchema, createExternalAgent, ExternalAgentApiUpdateSchema, updateExternalAgent, deleteExternalAgent, FunctionApiSelectSchema, listFunctions, getFunction, FunctionApiInsertSchema, upsertFunction, FunctionApiUpdateSchema, deleteFunction, createFullGraphServerSide, getFullGraph, updateFullGraphServerSide, deleteFullGraph, TenantParamsSchema, ProjectApiSelectSchema, listProjectsPaginated, TenantIdParamsSchema, getProject, ProjectApiInsertSchema, createProject, ProjectApiUpdateSchema, updateProject, deleteProject, getArtifactComponentsForAgent, getAgentsUsingArtifactComponent, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, isArtifactComponentAssociatedWithAgent, associateArtifactComponentWithAgent, RemovedResponseSchema, removeArtifactComponentFromAgent, ExistsResponseSchema, getDataComponentsForAgent, getAgentsUsingDataComponent, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, isDataComponentAssociatedWithAgent, associateDataComponentWithAgent, removeDataComponentFromAgent, SubAgentRelationApiSelectSchema, SubAgentRelationQuerySchema, getAgentRelationsBySource, getAgentRelationsByTarget, getExternalAgentRelations, listAgentRelations, getAgentRelationById, SubAgentRelationApiInsertSchema, validateExternalAgent, validateInternalSubAgent, createSubAgentRelation, SubAgentRelationApiUpdateSchema, updateAgentRelation, deleteSubAgentRelation, McpToolSchema, ToolStatusSchema, listTools, dbResultToMcpTool, getToolById, ToolApiInsertSchema, createTool, ToolApiUpdateSchema, updateTool, deleteTool, CredentialStoreType, generateIdFromName, FullProjectDefinitionSchema, createFullProjectServerSide, getFullProject, updateFullProjectServerSide, deleteFullProject, createDefaultCredentialStores, CredentialStoreRegistry, discoverOAuthEndpoints, handleApiError } from '@inkeep/agents-core';
1
+ import { loadEnvironmentFiles, getLogger, createDatabaseClient, commonGetErrorResponses, ListResponseSchema, PaginationQueryParamsSchema, TenantProjectParamsSchema, AgentGraphApiSelectSchema, listAgentGraphs, SingleResponseSchema, TenantProjectIdParamsSchema, getAgentGraphById, createApiError, getGraphAgentInfos, GraphWithinContextOfProjectSchema, getFullGraphDefinition, AgentGraphApiInsertSchema, createAgentGraph, AgentGraphApiUpdateSchema, updateAgentGraph, ErrorResponseSchema, deleteAgentGraph, TenantProjectGraphParamsSchema, SubAgentApiSelectSchema, listSubAgentsPaginated, TenantProjectGraphIdParamsSchema, getSubAgentById, SubAgentApiInsertSchema, createSubAgent, SubAgentApiUpdateSchema, updateSubAgent, deleteSubAgent, SubAgentToolRelationApiSelectSchema, getAgentToolRelationByAgent, getAgentToolRelationByTool, listAgentToolRelations, getAgentToolRelationById, getAgentsForTool, SubAgentToolRelationApiInsertSchema, createAgentToolRelation, SubAgentToolRelationApiUpdateSchema, updateAgentToolRelation, deleteAgentToolRelation, ApiKeyApiSelectSchema, listApiKeysPaginated, getApiKeyById, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, generateApiKey, createApiKey, ApiKeyApiUpdateSchema, updateApiKey, deleteApiKey, ArtifactComponentApiSelectSchema, listArtifactComponentsPaginated, getArtifactComponentById, ArtifactComponentApiInsertSchema, validatePropsAsJsonSchema, createArtifactComponent, ArtifactComponentApiUpdateSchema, updateArtifactComponent, deleteArtifactComponent, ContextConfigApiSelectSchema, listContextConfigsPaginated, getContextConfigById, ContextConfigApiInsertSchema, createContextConfig, commonUpdateErrorResponses, ContextConfigApiUpdateSchema, updateContextConfig, commonDeleteErrorResponses, deleteContextConfig, CredentialReferenceApiSelectSchema, listCredentialReferencesPaginated, getCredentialReferenceWithTools, CredentialReferenceApiInsertSchema, createCredentialReference, CredentialReferenceApiUpdateSchema, updateCredentialReference, getCredentialReferenceById, getCredentialStoreLookupKeyFromRetrievalParams, deleteCredentialReference, DataComponentApiSelectSchema, listDataComponentsPaginated, getDataComponent, DataComponentApiInsertSchema, createDataComponent, DataComponentApiUpdateSchema, updateDataComponent, deleteDataComponent, ExternalAgentApiSelectSchema, listExternalAgentsPaginated, getExternalAgent, ExternalAgentApiInsertSchema, createExternalAgent, ExternalAgentApiUpdateSchema, updateExternalAgent, deleteExternalAgent, FunctionApiSelectSchema, listFunctions, getFunction, FunctionApiInsertSchema, upsertFunction, FunctionApiUpdateSchema, deleteFunction, FunctionToolApiSelectSchema, listFunctionTools, getFunctionToolById, FunctionToolApiInsertSchema, createFunctionTool, FunctionToolApiUpdateSchema, updateFunctionTool, deleteFunctionTool, createFullGraphServerSide, getFullGraph, updateFullGraphServerSide, deleteFullGraph, TenantParamsSchema, ProjectApiSelectSchema, listProjectsPaginated, TenantIdParamsSchema, getProject, ProjectApiInsertSchema, createProject, ProjectApiUpdateSchema, updateProject, deleteProject, getArtifactComponentsForAgent, getAgentsUsingArtifactComponent, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, isArtifactComponentAssociatedWithAgent, associateArtifactComponentWithAgent, RemovedResponseSchema, removeArtifactComponentFromAgent, ExistsResponseSchema, getDataComponentsForAgent, getAgentsUsingDataComponent, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, isDataComponentAssociatedWithAgent, associateDataComponentWithAgent, removeDataComponentFromAgent, SubAgentRelationApiSelectSchema, SubAgentRelationQuerySchema, getAgentRelationsBySource, getAgentRelationsByTarget, getExternalAgentRelations, listAgentRelations, getAgentRelationById, SubAgentRelationApiInsertSchema, validateExternalAgent, validateInternalSubAgent, createSubAgentRelation, SubAgentRelationApiUpdateSchema, updateAgentRelation, deleteSubAgentRelation, McpToolSchema, ToolStatusSchema, listTools, dbResultToMcpTool, getToolById, ToolApiInsertSchema, createTool, ToolApiUpdateSchema, updateTool, deleteTool, CredentialStoreType, generateIdFromName, FullProjectDefinitionSchema, createFullProjectServerSide, getFullProject, updateFullProjectServerSide, deleteFullProject, createDefaultCredentialStores, CredentialStoreRegistry, discoverOAuthEndpoints, handleApiError } 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';
@@ -66,10 +66,10 @@ var apiKeyAuth = () => createMiddleware(async (c, next) => {
66
66
  await next();
67
67
  return;
68
68
  });
69
- function setupOpenAPIRoutes(app21) {
70
- app21.get("/openapi.json", (c) => {
69
+ function setupOpenAPIRoutes(app22) {
70
+ app22.get("/openapi.json", (c) => {
71
71
  try {
72
- const document = app21.getOpenAPIDocument({
72
+ const document = app22.getOpenAPIDocument({
73
73
  openapi: "3.0.0",
74
74
  info: {
75
75
  title: "Inkeep Agents Manage API",
@@ -90,7 +90,7 @@ function setupOpenAPIRoutes(app21) {
90
90
  return c.json({ error: "Failed to generate OpenAPI document", details: errorDetails }, 500);
91
91
  }
92
92
  });
93
- app21.get(
93
+ app22.get(
94
94
  "/docs",
95
95
  swaggerUI({
96
96
  url: "/openapi.json",
@@ -2558,8 +2558,260 @@ app10.openapi(
2558
2558
  }
2559
2559
  );
2560
2560
  var functions_default = app10;
2561
- var logger3 = getLogger("graphFull");
2561
+ var logger3 = getLogger("functionTools");
2562
2562
  var app11 = new OpenAPIHono();
2563
+ app11.openapi(
2564
+ createRoute({
2565
+ method: "get",
2566
+ path: "/",
2567
+ summary: "List Function Tools",
2568
+ operationId: "list-function-tools",
2569
+ tags: ["Function Tools"],
2570
+ request: {
2571
+ params: TenantProjectGraphParamsSchema,
2572
+ query: PaginationQueryParamsSchema
2573
+ },
2574
+ responses: {
2575
+ 200: {
2576
+ description: "List of function tools retrieved successfully",
2577
+ content: {
2578
+ "application/json": {
2579
+ schema: ListResponseSchema(FunctionToolApiSelectSchema)
2580
+ }
2581
+ }
2582
+ },
2583
+ ...commonGetErrorResponses
2584
+ }
2585
+ }),
2586
+ async (c) => {
2587
+ const { tenantId, projectId, graphId } = c.req.valid("param");
2588
+ const { page, limit } = c.req.valid("query");
2589
+ try {
2590
+ const result = await listFunctionTools(dbClient_default)({
2591
+ scopes: { tenantId, projectId, graphId },
2592
+ pagination: { page, limit }
2593
+ });
2594
+ return c.json(result);
2595
+ } catch (error) {
2596
+ logger3.error({ error, tenantId, projectId, graphId }, "Failed to list function tools");
2597
+ return c.json(
2598
+ createApiError({ code: "internal_server_error", message: "Failed to list function tools" }),
2599
+ 500
2600
+ );
2601
+ }
2602
+ }
2603
+ );
2604
+ app11.openapi(
2605
+ createRoute({
2606
+ method: "get",
2607
+ path: "/:id",
2608
+ summary: "Get Function Tool by ID",
2609
+ operationId: "get-function-tool",
2610
+ tags: ["Function Tools"],
2611
+ request: {
2612
+ params: TenantProjectGraphParamsSchema.extend({
2613
+ id: z.string()
2614
+ })
2615
+ },
2616
+ responses: {
2617
+ 200: {
2618
+ description: "Function tool retrieved successfully",
2619
+ content: {
2620
+ "application/json": {
2621
+ schema: SingleResponseSchema(FunctionToolApiSelectSchema)
2622
+ }
2623
+ }
2624
+ },
2625
+ ...commonGetErrorResponses
2626
+ }
2627
+ }),
2628
+ async (c) => {
2629
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
2630
+ try {
2631
+ const functionTool = await getFunctionToolById(dbClient_default)({
2632
+ scopes: { tenantId, projectId, graphId },
2633
+ functionToolId: id
2634
+ });
2635
+ if (!functionTool) {
2636
+ return c.json(
2637
+ createApiError({ code: "not_found", message: "Function tool not found" }),
2638
+ 404
2639
+ );
2640
+ }
2641
+ return c.json({ data: functionTool });
2642
+ } catch (error) {
2643
+ logger3.error({ error, tenantId, projectId, graphId, id }, "Failed to get function tool");
2644
+ return c.json(
2645
+ createApiError({ code: "internal_server_error", message: "Failed to get function tool" }),
2646
+ 500
2647
+ );
2648
+ }
2649
+ }
2650
+ );
2651
+ app11.openapi(
2652
+ createRoute({
2653
+ method: "post",
2654
+ path: "/",
2655
+ summary: "Create Function Tool",
2656
+ operationId: "create-function-tool",
2657
+ tags: ["Function Tools"],
2658
+ request: {
2659
+ params: TenantProjectGraphParamsSchema,
2660
+ body: {
2661
+ content: {
2662
+ "application/json": {
2663
+ schema: FunctionToolApiInsertSchema
2664
+ }
2665
+ }
2666
+ }
2667
+ },
2668
+ responses: {
2669
+ 201: {
2670
+ description: "Function tool created successfully",
2671
+ content: {
2672
+ "application/json": {
2673
+ schema: SingleResponseSchema(FunctionToolApiSelectSchema)
2674
+ }
2675
+ }
2676
+ },
2677
+ ...commonGetErrorResponses
2678
+ }
2679
+ }),
2680
+ async (c) => {
2681
+ const { tenantId, projectId, graphId } = c.req.valid("param");
2682
+ const body = c.req.valid("json");
2683
+ try {
2684
+ const id = body.id || nanoid();
2685
+ const functionTool = await createFunctionTool(dbClient_default)({
2686
+ scopes: { tenantId, projectId, graphId },
2687
+ data: {
2688
+ ...body,
2689
+ id
2690
+ }
2691
+ });
2692
+ return c.json({ data: functionTool }, 201);
2693
+ } catch (error) {
2694
+ logger3.error({ error, tenantId, projectId, graphId, body }, "Failed to create function tool");
2695
+ return c.json(
2696
+ createApiError({
2697
+ code: "internal_server_error",
2698
+ message: "Failed to create function tool"
2699
+ }),
2700
+ 500
2701
+ );
2702
+ }
2703
+ }
2704
+ );
2705
+ app11.openapi(
2706
+ createRoute({
2707
+ method: "put",
2708
+ path: "/:id",
2709
+ summary: "Update Function Tool",
2710
+ operationId: "update-function-tool",
2711
+ tags: ["Function Tools"],
2712
+ request: {
2713
+ params: TenantProjectGraphParamsSchema.extend({
2714
+ id: z.string()
2715
+ }),
2716
+ body: {
2717
+ content: {
2718
+ "application/json": {
2719
+ schema: FunctionToolApiUpdateSchema
2720
+ }
2721
+ }
2722
+ }
2723
+ },
2724
+ responses: {
2725
+ 200: {
2726
+ description: "Function tool updated successfully",
2727
+ content: {
2728
+ "application/json": {
2729
+ schema: SingleResponseSchema(FunctionToolApiSelectSchema)
2730
+ }
2731
+ }
2732
+ },
2733
+ ...commonGetErrorResponses
2734
+ }
2735
+ }),
2736
+ async (c) => {
2737
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
2738
+ const body = c.req.valid("json");
2739
+ try {
2740
+ const functionTool = await updateFunctionTool(dbClient_default)({
2741
+ scopes: { tenantId, projectId, graphId },
2742
+ functionToolId: id,
2743
+ data: body
2744
+ });
2745
+ if (!functionTool) {
2746
+ return c.json(
2747
+ createApiError({ code: "not_found", message: "Function tool not found" }),
2748
+ 404
2749
+ );
2750
+ }
2751
+ return c.json({ data: functionTool });
2752
+ } catch (error) {
2753
+ logger3.error(
2754
+ { error, tenantId, projectId, graphId, id, body },
2755
+ "Failed to update function tool"
2756
+ );
2757
+ return c.json(
2758
+ createApiError({
2759
+ code: "internal_server_error",
2760
+ message: "Failed to update function tool"
2761
+ }),
2762
+ 500
2763
+ );
2764
+ }
2765
+ }
2766
+ );
2767
+ app11.openapi(
2768
+ createRoute({
2769
+ method: "delete",
2770
+ path: "/:id",
2771
+ summary: "Delete Function Tool",
2772
+ operationId: "delete-function-tool",
2773
+ tags: ["Function Tools"],
2774
+ request: {
2775
+ params: TenantProjectGraphParamsSchema.extend({
2776
+ id: z.string()
2777
+ })
2778
+ },
2779
+ responses: {
2780
+ 204: {
2781
+ description: "Function tool deleted successfully"
2782
+ },
2783
+ ...commonGetErrorResponses
2784
+ }
2785
+ }),
2786
+ async (c) => {
2787
+ const { tenantId, projectId, graphId, id } = c.req.valid("param");
2788
+ try {
2789
+ const deleted = await deleteFunctionTool(dbClient_default)({
2790
+ scopes: { tenantId, projectId, graphId },
2791
+ functionToolId: id
2792
+ });
2793
+ if (!deleted) {
2794
+ return c.json(
2795
+ createApiError({ code: "not_found", message: "Function tool not found" }),
2796
+ 404
2797
+ );
2798
+ }
2799
+ return c.body(null, 204);
2800
+ } catch (error) {
2801
+ logger3.error({ error, tenantId, projectId, graphId, id }, "Failed to delete function tool");
2802
+ return c.json(
2803
+ createApiError({
2804
+ code: "internal_server_error",
2805
+ message: "Failed to delete function tool"
2806
+ }),
2807
+ 500
2808
+ );
2809
+ }
2810
+ }
2811
+ );
2812
+ var functionTools_default = app11;
2813
+ var logger4 = getLogger("graphFull");
2814
+ var app12 = new OpenAPIHono();
2563
2815
  var GraphIdParamsSchema = z.object({
2564
2816
  tenantId: z.string().openapi({
2565
2817
  description: "Tenant identifier",
@@ -2574,7 +2826,7 @@ var GraphIdParamsSchema = z.object({
2574
2826
  example: "graph_789"
2575
2827
  })
2576
2828
  }).openapi("GraphIdParams");
2577
- app11.openapi(
2829
+ app12.openapi(
2578
2830
  createRoute({
2579
2831
  method: "post",
2580
2832
  path: "/",
@@ -2616,14 +2868,14 @@ app11.openapi(
2616
2868
  const { tenantId, projectId } = c.req.valid("param");
2617
2869
  const graphData = c.req.valid("json");
2618
2870
  const validatedGraphData = GraphWithinContextOfProjectSchema.parse(graphData);
2619
- const createdGraph = await createFullGraphServerSide(dbClient_default, logger3)(
2871
+ const createdGraph = await createFullGraphServerSide(dbClient_default, logger4)(
2620
2872
  { tenantId, projectId },
2621
2873
  validatedGraphData
2622
2874
  );
2623
2875
  return c.json({ data: createdGraph }, 201);
2624
2876
  }
2625
2877
  );
2626
- app11.openapi(
2878
+ app12.openapi(
2627
2879
  createRoute({
2628
2880
  method: "get",
2629
2881
  path: "/{graphId}",
@@ -2651,7 +2903,7 @@ app11.openapi(
2651
2903
  try {
2652
2904
  const graph = await getFullGraph(
2653
2905
  dbClient_default,
2654
- logger3
2906
+ logger4
2655
2907
  )({
2656
2908
  scopes: { tenantId, projectId, graphId }
2657
2909
  });
@@ -2676,7 +2928,7 @@ app11.openapi(
2676
2928
  }
2677
2929
  }
2678
2930
  );
2679
- app11.openapi(
2931
+ app12.openapi(
2680
2932
  createRoute({
2681
2933
  method: "put",
2682
2934
  path: "/{graphId}",
@@ -2727,15 +2979,15 @@ app11.openapi(
2727
2979
  }
2728
2980
  const existingGraph = await getFullGraph(
2729
2981
  dbClient_default,
2730
- logger3
2982
+ logger4
2731
2983
  )({
2732
2984
  scopes: { tenantId, projectId, graphId }
2733
2985
  });
2734
2986
  const isCreate = !existingGraph;
2735
- const updatedGraph = isCreate ? await createFullGraphServerSide(dbClient_default, logger3)(
2987
+ const updatedGraph = isCreate ? await createFullGraphServerSide(dbClient_default, logger4)(
2736
2988
  { tenantId, projectId },
2737
2989
  validatedGraphData
2738
- ) : await updateFullGraphServerSide(dbClient_default, logger3)(
2990
+ ) : await updateFullGraphServerSide(dbClient_default, logger4)(
2739
2991
  { tenantId, projectId },
2740
2992
  validatedGraphData
2741
2993
  );
@@ -2760,7 +3012,7 @@ app11.openapi(
2760
3012
  }
2761
3013
  }
2762
3014
  );
2763
- app11.openapi(
3015
+ app12.openapi(
2764
3016
  createRoute({
2765
3017
  method: "delete",
2766
3018
  path: "/{graphId}",
@@ -2783,7 +3035,7 @@ app11.openapi(
2783
3035
  try {
2784
3036
  const deleted = await deleteFullGraph(
2785
3037
  dbClient_default,
2786
- logger3
3038
+ logger4
2787
3039
  )({
2788
3040
  scopes: { tenantId, projectId, graphId }
2789
3041
  });
@@ -2808,9 +3060,9 @@ app11.openapi(
2808
3060
  }
2809
3061
  }
2810
3062
  );
2811
- var graphFull_default = app11;
2812
- var app12 = new OpenAPIHono();
2813
- app12.openapi(
3063
+ var graphFull_default = app12;
3064
+ var app13 = new OpenAPIHono();
3065
+ app13.openapi(
2814
3066
  createRoute({
2815
3067
  method: "get",
2816
3068
  path: "/",
@@ -2845,7 +3097,7 @@ app12.openapi(
2845
3097
  return c.json(result);
2846
3098
  }
2847
3099
  );
2848
- app12.openapi(
3100
+ app13.openapi(
2849
3101
  createRoute({
2850
3102
  method: "get",
2851
3103
  path: "/{id}",
@@ -2880,7 +3132,7 @@ app12.openapi(
2880
3132
  return c.json({ data: project });
2881
3133
  }
2882
3134
  );
2883
- app12.openapi(
3135
+ app13.openapi(
2884
3136
  createRoute({
2885
3137
  method: "post",
2886
3138
  path: "/",
@@ -2938,7 +3190,7 @@ app12.openapi(
2938
3190
  }
2939
3191
  }
2940
3192
  );
2941
- app12.openapi(
3193
+ app13.openapi(
2942
3194
  createRoute({
2943
3195
  method: "patch",
2944
3196
  path: "/{id}",
@@ -2984,7 +3236,7 @@ app12.openapi(
2984
3236
  return c.json({ data: project });
2985
3237
  }
2986
3238
  );
2987
- app12.openapi(
3239
+ app13.openapi(
2988
3240
  createRoute({
2989
3241
  method: "delete",
2990
3242
  path: "/{id}",
@@ -3034,9 +3286,9 @@ app12.openapi(
3034
3286
  }
3035
3287
  }
3036
3288
  );
3037
- var projects_default = app12;
3038
- var app13 = new OpenAPIHono();
3039
- app13.openapi(
3289
+ var projects_default = app13;
3290
+ var app14 = new OpenAPIHono();
3291
+ app14.openapi(
3040
3292
  createRoute({
3041
3293
  method: "get",
3042
3294
  path: "/agent/:subAgentId",
@@ -3072,7 +3324,7 @@ app13.openapi(
3072
3324
  });
3073
3325
  }
3074
3326
  );
3075
- app13.openapi(
3327
+ app14.openapi(
3076
3328
  createRoute({
3077
3329
  method: "get",
3078
3330
  path: "/component/:artifactComponentId/agents",
@@ -3112,7 +3364,7 @@ app13.openapi(
3112
3364
  return c.json({ data: agents });
3113
3365
  }
3114
3366
  );
3115
- app13.openapi(
3367
+ app14.openapi(
3116
3368
  createRoute({
3117
3369
  method: "post",
3118
3370
  path: "/",
@@ -3189,7 +3441,7 @@ app13.openapi(
3189
3441
  return c.json({ data: association }, 201);
3190
3442
  }
3191
3443
  );
3192
- app13.openapi(
3444
+ app14.openapi(
3193
3445
  createRoute({
3194
3446
  method: "delete",
3195
3447
  path: "/agent/:subAgentId/component/:artifactComponentId",
@@ -3232,7 +3484,7 @@ app13.openapi(
3232
3484
  });
3233
3485
  }
3234
3486
  );
3235
- app13.openapi(
3487
+ app14.openapi(
3236
3488
  createRoute({
3237
3489
  method: "get",
3238
3490
  path: "/agent/:subAgentId/component/:artifactComponentId/exists",
@@ -3266,9 +3518,9 @@ app13.openapi(
3266
3518
  return c.json({ exists });
3267
3519
  }
3268
3520
  );
3269
- var subAgentArtifactComponents_default = app13;
3270
- var app14 = new OpenAPIHono();
3271
- app14.openapi(
3521
+ var subAgentArtifactComponents_default = app14;
3522
+ var app15 = new OpenAPIHono();
3523
+ app15.openapi(
3272
3524
  createRoute({
3273
3525
  method: "get",
3274
3526
  path: "/agent/:subAgentId",
@@ -3302,7 +3554,7 @@ app14.openapi(
3302
3554
  return c.json({ data: dataComponents });
3303
3555
  }
3304
3556
  );
3305
- app14.openapi(
3557
+ app15.openapi(
3306
3558
  createRoute({
3307
3559
  method: "get",
3308
3560
  path: "/component/:dataComponentId/agents",
@@ -3342,7 +3594,7 @@ app14.openapi(
3342
3594
  return c.json({ data: agents });
3343
3595
  }
3344
3596
  );
3345
- app14.openapi(
3597
+ app15.openapi(
3346
3598
  createRoute({
3347
3599
  method: "post",
3348
3600
  path: "/",
@@ -3415,7 +3667,7 @@ app14.openapi(
3415
3667
  return c.json({ data: association }, 201);
3416
3668
  }
3417
3669
  );
3418
- app14.openapi(
3670
+ app15.openapi(
3419
3671
  createRoute({
3420
3672
  method: "delete",
3421
3673
  path: "/agent/:subAgentId/component/:dataComponentId",
@@ -3458,7 +3710,7 @@ app14.openapi(
3458
3710
  });
3459
3711
  }
3460
3712
  );
3461
- app14.openapi(
3713
+ app15.openapi(
3462
3714
  createRoute({
3463
3715
  method: "get",
3464
3716
  path: "/agent/:subAgentId/component/:dataComponentId/exists",
@@ -3492,9 +3744,9 @@ app14.openapi(
3492
3744
  return c.json({ exists });
3493
3745
  }
3494
3746
  );
3495
- var subAgentDataComponents_default = app14;
3496
- var app15 = new OpenAPIHono();
3497
- app15.openapi(
3747
+ var subAgentDataComponents_default = app15;
3748
+ var app16 = new OpenAPIHono();
3749
+ app16.openapi(
3498
3750
  createRoute({
3499
3751
  method: "get",
3500
3752
  path: "/",
@@ -3567,7 +3819,7 @@ app15.openapi(
3567
3819
  }
3568
3820
  }
3569
3821
  );
3570
- app15.openapi(
3822
+ app16.openapi(
3571
3823
  createRoute({
3572
3824
  method: "get",
3573
3825
  path: "/{id}",
@@ -3604,7 +3856,7 @@ app15.openapi(
3604
3856
  return c.json({ data: agentRelation });
3605
3857
  }
3606
3858
  );
3607
- app15.openapi(
3859
+ app16.openapi(
3608
3860
  createRoute({
3609
3861
  method: "post",
3610
3862
  path: "/",
@@ -3695,7 +3947,7 @@ app15.openapi(
3695
3947
  return c.json({ data: agentRelation }, 201);
3696
3948
  }
3697
3949
  );
3698
- app15.openapi(
3950
+ app16.openapi(
3699
3951
  createRoute({
3700
3952
  method: "put",
3701
3953
  path: "/{id}",
@@ -3741,7 +3993,7 @@ app15.openapi(
3741
3993
  return c.json({ data: updatedAgentRelation });
3742
3994
  }
3743
3995
  );
3744
- app15.openapi(
3996
+ app16.openapi(
3745
3997
  createRoute({
3746
3998
  method: "delete",
3747
3999
  path: "/{id}",
@@ -3780,10 +4032,10 @@ app15.openapi(
3780
4032
  return c.body(null, 204);
3781
4033
  }
3782
4034
  );
3783
- var subAgentRelations_default = app15;
3784
- var logger4 = getLogger("tools");
3785
- var app16 = new OpenAPIHono();
3786
- app16.openapi(
4035
+ var subAgentRelations_default = app16;
4036
+ var logger5 = getLogger("tools");
4037
+ var app17 = new OpenAPIHono();
4038
+ app17.openapi(
3787
4039
  createRoute({
3788
4040
  method: "get",
3789
4041
  path: "/",
@@ -3843,7 +4095,7 @@ app16.openapi(
3843
4095
  return c.json(result);
3844
4096
  }
3845
4097
  );
3846
- app16.openapi(
4098
+ app17.openapi(
3847
4099
  createRoute({
3848
4100
  method: "get",
3849
4101
  path: "/{id}",
@@ -3880,7 +4132,7 @@ app16.openapi(
3880
4132
  });
3881
4133
  }
3882
4134
  );
3883
- app16.openapi(
4135
+ app17.openapi(
3884
4136
  createRoute({
3885
4137
  method: "post",
3886
4138
  path: "/",
@@ -3913,7 +4165,7 @@ app16.openapi(
3913
4165
  const { tenantId, projectId } = c.req.valid("param");
3914
4166
  const body = c.req.valid("json");
3915
4167
  const credentialStores = c.get("credentialStores");
3916
- logger4.info({ body }, "body");
4168
+ logger5.info({ body }, "body");
3917
4169
  const id = body.id || nanoid();
3918
4170
  const tool = await createTool(dbClient_default)({
3919
4171
  tenantId,
@@ -3933,7 +4185,7 @@ app16.openapi(
3933
4185
  );
3934
4186
  }
3935
4187
  );
3936
- app16.openapi(
4188
+ app17.openapi(
3937
4189
  createRoute({
3938
4190
  method: "put",
3939
4191
  path: "/{id}",
@@ -3994,7 +4246,7 @@ app16.openapi(
3994
4246
  });
3995
4247
  }
3996
4248
  );
3997
- app16.openapi(
4249
+ app17.openapi(
3998
4250
  createRoute({
3999
4251
  method: "delete",
4000
4252
  path: "/{id}",
@@ -4030,34 +4282,35 @@ app16.openapi(
4030
4282
  return c.body(null, 204);
4031
4283
  }
4032
4284
  );
4033
- var tools_default = app16;
4285
+ var tools_default = app17;
4034
4286
 
4035
4287
  // src/routes/index.ts
4036
- var app17 = new OpenAPIHono();
4037
- app17.route("/projects", projects_default);
4038
- app17.route("/projects/:projectId/graphs/:graphId/sub-agents", subAgents_default);
4039
- app17.route("/projects/:projectId/graphs/:graphId/sub-agent-relations", subAgentRelations_default);
4040
- app17.route("/projects/:projectId/agent-graphs", agentGraph_default);
4041
- app17.route("/projects/:projectId/graphs/:graphId/sub-agent-tool-relations", subAgentToolRelations_default);
4042
- app17.route(
4288
+ var app18 = new OpenAPIHono();
4289
+ app18.route("/projects", projects_default);
4290
+ app18.route("/projects/:projectId/graphs/:graphId/sub-agents", subAgents_default);
4291
+ app18.route("/projects/:projectId/graphs/:graphId/sub-agent-relations", subAgentRelations_default);
4292
+ app18.route("/projects/:projectId/agent-graphs", agentGraph_default);
4293
+ app18.route("/projects/:projectId/graphs/:graphId/sub-agent-tool-relations", subAgentToolRelations_default);
4294
+ app18.route(
4043
4295
  "/projects/:projectId/graphs/:graphId/sub-agent-artifact-components",
4044
4296
  subAgentArtifactComponents_default
4045
4297
  );
4046
- app17.route(
4298
+ app18.route(
4047
4299
  "/projects/:projectId/graphs/:graphId/sub-agent-data-components",
4048
4300
  subAgentDataComponents_default
4049
4301
  );
4050
- app17.route("/projects/:projectId/artifact-components", artifactComponents_default);
4051
- app17.route("/projects/:projectId/graphs/:graphId/context-configs", contextConfigs_default);
4052
- app17.route("/projects/:projectId/credentials", credentials_default);
4053
- app17.route("/projects/:projectId/data-components", dataComponents_default);
4054
- app17.route("/projects/:projectId/graphs/:graphId/external-agents", externalAgents_default);
4055
- app17.route("/projects/:projectId/functions", functions_default);
4056
- app17.route("/projects/:projectId/tools", tools_default);
4057
- app17.route("/projects/:projectId/api-keys", apiKeys_default);
4058
- app17.route("/projects/:projectId/graph", graphFull_default);
4059
- var routes_default = app17;
4060
- var logger5 = getLogger("oauth-service");
4302
+ app18.route("/projects/:projectId/artifact-components", artifactComponents_default);
4303
+ app18.route("/projects/:projectId/graphs/:graphId/context-configs", contextConfigs_default);
4304
+ app18.route("/projects/:projectId/credentials", credentials_default);
4305
+ app18.route("/projects/:projectId/data-components", dataComponents_default);
4306
+ app18.route("/projects/:projectId/graphs/:graphId/external-agents", externalAgents_default);
4307
+ app18.route("/projects/:projectId/graphs/:graphId/function-tools", functionTools_default);
4308
+ app18.route("/projects/:projectId/functions", functions_default);
4309
+ app18.route("/projects/:projectId/tools", tools_default);
4310
+ app18.route("/projects/:projectId/api-keys", apiKeys_default);
4311
+ app18.route("/projects/:projectId/graph", graphFull_default);
4312
+ var routes_default = app18;
4313
+ var logger6 = getLogger("oauth-service");
4061
4314
  var pkceStore = /* @__PURE__ */ new Map();
4062
4315
  function storePKCEVerifier(state, codeVerifier, toolId, tenantId, projectId, clientId) {
4063
4316
  pkceStore.set(state, { codeVerifier, toolId, tenantId, projectId, clientId });
@@ -4095,7 +4348,7 @@ var OAuthService = class {
4095
4348
  if (tool.config.type !== "mcp") {
4096
4349
  throw new Error("OAuth is only supported for MCP tools");
4097
4350
  }
4098
- const oAuthConfig = await discoverOAuthEndpoints(tool.config.mcp.server.url, logger5);
4351
+ const oAuthConfig = await discoverOAuthEndpoints(tool.config.mcp.server.url, logger6);
4099
4352
  if (!oAuthConfig) {
4100
4353
  throw new Error("OAuth not supported by this server");
4101
4354
  }
@@ -4119,7 +4372,7 @@ var OAuthService = class {
4119
4372
  resource: tool.config.mcp.server.url
4120
4373
  });
4121
4374
  storePKCEVerifier(state, codeVerifier, toolId, tenantId, projectId, clientId);
4122
- logger5.info({ toolId, oAuthConfig, tenantId, projectId }, "OAuth flow initiated successfully");
4375
+ logger6.info({ toolId, oAuthConfig, tenantId, projectId }, "OAuth flow initiated successfully");
4123
4376
  return {
4124
4377
  redirectUrl: authUrl,
4125
4378
  state
@@ -4133,7 +4386,7 @@ var OAuthService = class {
4133
4386
  if (tool.config.type !== "mcp") {
4134
4387
  throw new Error("OAuth is only supported for MCP tools");
4135
4388
  }
4136
- const oAuthConfig = await discoverOAuthEndpoints(tool.config.mcp.server.url, logger5);
4389
+ const oAuthConfig = await discoverOAuthEndpoints(tool.config.mcp.server.url, logger6);
4137
4390
  if (!oAuthConfig?.tokenUrl) {
4138
4391
  throw new Error("Could not discover OAuth token endpoint");
4139
4392
  }
@@ -4148,9 +4401,9 @@ var OAuthService = class {
4148
4401
  codeVerifier,
4149
4402
  redirectUri
4150
4403
  });
4151
- logger5.info({ tokenType: tokens.token_type }, "Token exchange successful with openid-client");
4404
+ logger6.info({ tokenType: tokens.token_type }, "Token exchange successful with openid-client");
4152
4405
  } catch (error) {
4153
- logger5.warn(
4406
+ logger6.warn(
4154
4407
  { error: error instanceof Error ? error.message : error },
4155
4408
  "openid-client failed, falling back to manual token exchange"
4156
4409
  );
@@ -4161,7 +4414,7 @@ var OAuthService = class {
4161
4414
  codeVerifier,
4162
4415
  redirectUri
4163
4416
  });
4164
- logger5.info({ tokenType: tokens.token_type }, "Manual token exchange successful");
4417
+ logger6.info({ tokenType: tokens.token_type }, "Manual token exchange successful");
4165
4418
  }
4166
4419
  return { tokens, oAuthConfig };
4167
4420
  }
@@ -4169,7 +4422,7 @@ var OAuthService = class {
4169
4422
  * Perform dynamic client registration
4170
4423
  */
4171
4424
  async performDynamicClientRegistration(registrationUrl, redirectUri) {
4172
- logger5.info({ registrationUrl }, "Attempting dynamic client registration");
4425
+ logger6.info({ registrationUrl }, "Attempting dynamic client registration");
4173
4426
  try {
4174
4427
  const registrationResponse = await fetch(registrationUrl, {
4175
4428
  method: "POST",
@@ -4192,11 +4445,11 @@ var OAuthService = class {
4192
4445
  });
4193
4446
  if (registrationResponse.ok) {
4194
4447
  const registration = await registrationResponse.json();
4195
- logger5.info({ clientId: registration.client_id }, "Dynamic client registration successful");
4448
+ logger6.info({ clientId: registration.client_id }, "Dynamic client registration successful");
4196
4449
  return registration.client_id;
4197
4450
  } else {
4198
4451
  const errorText = await registrationResponse.text();
4199
- logger5.warn(
4452
+ logger6.warn(
4200
4453
  {
4201
4454
  status: registrationResponse.status,
4202
4455
  errorText
@@ -4205,7 +4458,7 @@ var OAuthService = class {
4205
4458
  );
4206
4459
  }
4207
4460
  } catch (regError) {
4208
- logger5.warn(
4461
+ logger6.warn(
4209
4462
  { error: regError },
4210
4463
  "Dynamic client registration error, using default client_id"
4211
4464
  );
@@ -4235,7 +4488,7 @@ var OAuthService = class {
4235
4488
  const oauth = await import('openid-client');
4236
4489
  const tokenUrl = new URL(oAuthConfig.tokenUrl);
4237
4490
  const oauthServerUrl = `${tokenUrl.protocol}//${tokenUrl.host}`;
4238
- logger5.info({ oauthServerUrl, clientId }, "Attempting openid-client discovery");
4491
+ logger6.info({ oauthServerUrl, clientId }, "Attempting openid-client discovery");
4239
4492
  const config = await oauth.discovery(
4240
4493
  new URL(oauthServerUrl),
4241
4494
  clientId,
@@ -4267,7 +4520,7 @@ var OAuthService = class {
4267
4520
  */
4268
4521
  async exchangeManually(params) {
4269
4522
  const { oAuthConfig, clientId, code, codeVerifier, redirectUri } = params;
4270
- logger5.info({ tokenUrl: oAuthConfig.tokenUrl }, "Attempting manual token exchange");
4523
+ logger6.info({ tokenUrl: oAuthConfig.tokenUrl }, "Attempting manual token exchange");
4271
4524
  const tokenResponse = await fetch(oAuthConfig.tokenUrl, {
4272
4525
  method: "POST",
4273
4526
  headers: {
@@ -4285,7 +4538,7 @@ var OAuthService = class {
4285
4538
  });
4286
4539
  if (!tokenResponse.ok) {
4287
4540
  const errorText = await tokenResponse.text();
4288
- logger5.error(
4541
+ logger6.error(
4289
4542
  {
4290
4543
  status: tokenResponse.status,
4291
4544
  statusText: tokenResponse.statusText,
@@ -4328,8 +4581,8 @@ async function findOrCreateCredential(tenantId, projectId, credentialData) {
4328
4581
  throw new Error(`Failed to save credential '${credentialData.id}' to database`);
4329
4582
  }
4330
4583
  }
4331
- var app18 = new OpenAPIHono();
4332
- var logger6 = getLogger("oauth-callback");
4584
+ var app19 = new OpenAPIHono();
4585
+ var logger7 = getLogger("oauth-callback");
4333
4586
  function getBaseUrlFromRequest(c) {
4334
4587
  const url = new URL(c.req.url);
4335
4588
  return `${url.protocol}//${url.host}`;
@@ -4415,7 +4668,7 @@ var OAuthCallbackQuerySchema = z$1.object({
4415
4668
  error: z$1.string().optional(),
4416
4669
  error_description: z$1.string().optional()
4417
4670
  });
4418
- app18.openapi(
4671
+ app19.openapi(
4419
4672
  createRoute({
4420
4673
  method: "get",
4421
4674
  path: "/login",
@@ -4461,7 +4714,7 @@ app18.openapi(
4461
4714
  try {
4462
4715
  const tool = await getToolById(dbClient_default)({ scopes: { tenantId, projectId }, toolId });
4463
4716
  if (!tool) {
4464
- logger6.error({ toolId, tenantId, projectId }, "Tool not found for OAuth login");
4717
+ logger7.error({ toolId, tenantId, projectId }, "Tool not found for OAuth login");
4465
4718
  return c.text("Tool not found", 404);
4466
4719
  }
4467
4720
  const credentialStores = c.get("credentialStores");
@@ -4476,13 +4729,13 @@ app18.openapi(
4476
4729
  });
4477
4730
  return c.redirect(redirectUrl, 302);
4478
4731
  } catch (error) {
4479
- logger6.error({ toolId, tenantId, projectId, error }, "OAuth login failed");
4732
+ logger7.error({ toolId, tenantId, projectId, error }, "OAuth login failed");
4480
4733
  const errorMessage = error instanceof Error ? error.message : "Failed to initiate OAuth login";
4481
4734
  return c.text(`OAuth Error: ${errorMessage}`, 500);
4482
4735
  }
4483
4736
  }
4484
4737
  );
4485
- app18.openapi(
4738
+ app19.openapi(
4486
4739
  createRoute({
4487
4740
  method: "get",
4488
4741
  path: "/callback",
@@ -4518,9 +4771,9 @@ app18.openapi(
4518
4771
  async (c) => {
4519
4772
  try {
4520
4773
  const { code, state, error, error_description } = c.req.valid("query");
4521
- logger6.info({ state, hasCode: !!code }, "OAuth callback received");
4774
+ logger7.info({ state, hasCode: !!code }, "OAuth callback received");
4522
4775
  if (error) {
4523
- logger6.error({ error, error_description }, "OAuth authorization failed");
4776
+ logger7.error({ error, error_description }, "OAuth authorization failed");
4524
4777
  const errorMessage = error_description || error || "OAuth Authorization Failed. Please try again.";
4525
4778
  const errorPage = generateOAuthCallbackPage({
4526
4779
  title: "Authentication Failed",
@@ -4531,7 +4784,7 @@ app18.openapi(
4531
4784
  }
4532
4785
  const pkceData = retrievePKCEVerifier(state);
4533
4786
  if (!pkceData) {
4534
- logger6.error({ state }, "Invalid or expired OAuth state");
4787
+ logger7.error({ state }, "Invalid or expired OAuth state");
4535
4788
  const errorMessage = "OAuth Session Expired: The OAuth session has expired or is invalid. Please try again.";
4536
4789
  const expiredPage = generateOAuthCallbackPage({
4537
4790
  title: "Session Expired",
@@ -4548,8 +4801,8 @@ app18.openapi(
4548
4801
  if (!tool) {
4549
4802
  throw new Error(`Tool ${toolId} not found`);
4550
4803
  }
4551
- logger6.info({ toolId, tenantId, projectId }, "Processing OAuth callback");
4552
- logger6.info({ toolId }, "Exchanging authorization code for access token");
4804
+ logger7.info({ toolId, tenantId, projectId }, "Processing OAuth callback");
4805
+ logger7.info({ toolId }, "Exchanging authorization code for access token");
4553
4806
  const credentialStores = c.get("credentialStores");
4554
4807
  const mcpTool = await dbResultToMcpTool(tool, dbClient_default, credentialStores);
4555
4808
  const baseUrl = getBaseUrlFromRequest(c);
@@ -4560,7 +4813,7 @@ app18.openapi(
4560
4813
  tool: mcpTool,
4561
4814
  baseUrl
4562
4815
  });
4563
- logger6.info(
4816
+ logger7.info(
4564
4817
  { toolId, tokenType: tokens.token_type, hasRefresh: !!tokens.refresh_token },
4565
4818
  "Token exchange successful"
4566
4819
  );
@@ -4607,7 +4860,7 @@ app18.openapi(
4607
4860
  credentialReferenceId: newCredential.id
4608
4861
  }
4609
4862
  });
4610
- logger6.info({ toolId, credentialId: newCredential.id }, "OAuth flow completed successfully");
4863
+ logger7.info({ toolId, credentialId: newCredential.id }, "OAuth flow completed successfully");
4611
4864
  const successPage = generateOAuthCallbackPage({
4612
4865
  title: "Authentication Complete",
4613
4866
  message: "You have been successfully authenticated.",
@@ -4615,7 +4868,7 @@ app18.openapi(
4615
4868
  });
4616
4869
  return c.html(successPage);
4617
4870
  } catch (error) {
4618
- logger6.error({ error }, "OAuth callback processing failed");
4871
+ logger7.error({ error }, "OAuth callback processing failed");
4619
4872
  const errorMessage = "OAuth Processing Failed. Please try again.";
4620
4873
  const errorPage = generateOAuthCallbackPage({
4621
4874
  title: "Processing Failed",
@@ -4626,9 +4879,9 @@ app18.openapi(
4626
4879
  }
4627
4880
  }
4628
4881
  );
4629
- var oauth_default = app18;
4630
- var logger7 = getLogger("projectFull");
4631
- var app19 = new OpenAPIHono();
4882
+ var oauth_default = app19;
4883
+ var logger8 = getLogger("projectFull");
4884
+ var app20 = new OpenAPIHono();
4632
4885
  var ProjectIdParamsSchema = z.object({
4633
4886
  tenantId: z.string().openapi({
4634
4887
  description: "Tenant identifier",
@@ -4645,7 +4898,7 @@ var TenantParamsSchema2 = z.object({
4645
4898
  example: "tenant_123"
4646
4899
  })
4647
4900
  }).openapi("TenantParams");
4648
- app19.openapi(
4901
+ app20.openapi(
4649
4902
  createRoute({
4650
4903
  method: "post",
4651
4904
  path: "/project-full",
@@ -4688,7 +4941,7 @@ app19.openapi(
4688
4941
  const projectData = c.req.valid("json");
4689
4942
  const validatedProjectData = FullProjectDefinitionSchema.parse(projectData);
4690
4943
  try {
4691
- const createdProject = await createFullProjectServerSide(dbClient_default, logger7)(
4944
+ const createdProject = await createFullProjectServerSide(dbClient_default, logger8)(
4692
4945
  { tenantId, projectId: validatedProjectData.id },
4693
4946
  validatedProjectData
4694
4947
  );
@@ -4704,7 +4957,7 @@ app19.openapi(
4704
4957
  }
4705
4958
  }
4706
4959
  );
4707
- app19.openapi(
4960
+ app20.openapi(
4708
4961
  createRoute({
4709
4962
  method: "get",
4710
4963
  path: "/project-full/{projectId}",
@@ -4732,7 +4985,7 @@ app19.openapi(
4732
4985
  try {
4733
4986
  const project = await getFullProject(
4734
4987
  dbClient_default,
4735
- logger7
4988
+ logger8
4736
4989
  )({
4737
4990
  scopes: { tenantId, projectId }
4738
4991
  });
@@ -4757,7 +5010,7 @@ app19.openapi(
4757
5010
  }
4758
5011
  }
4759
5012
  );
4760
- app19.openapi(
5013
+ app20.openapi(
4761
5014
  createRoute({
4762
5015
  method: "put",
4763
5016
  path: "/project-full/{projectId}",
@@ -4808,15 +5061,15 @@ app19.openapi(
4808
5061
  }
4809
5062
  const existingProject = await getFullProject(
4810
5063
  dbClient_default,
4811
- logger7
5064
+ logger8
4812
5065
  )({
4813
5066
  scopes: { tenantId, projectId }
4814
5067
  });
4815
5068
  const isCreate = !existingProject;
4816
- const updatedProject = isCreate ? await createFullProjectServerSide(dbClient_default, logger7)(
5069
+ const updatedProject = isCreate ? await createFullProjectServerSide(dbClient_default, logger8)(
4817
5070
  { tenantId, projectId },
4818
5071
  validatedProjectData
4819
- ) : await updateFullProjectServerSide(dbClient_default, logger7)(
5072
+ ) : await updateFullProjectServerSide(dbClient_default, logger8)(
4820
5073
  { tenantId, projectId },
4821
5074
  validatedProjectData
4822
5075
  );
@@ -4841,7 +5094,7 @@ app19.openapi(
4841
5094
  }
4842
5095
  }
4843
5096
  );
4844
- app19.openapi(
5097
+ app20.openapi(
4845
5098
  createRoute({
4846
5099
  method: "delete",
4847
5100
  path: "/project-full/{projectId}",
@@ -4864,7 +5117,7 @@ app19.openapi(
4864
5117
  try {
4865
5118
  const deleted = await deleteFullProject(
4866
5119
  dbClient_default,
4867
- logger7
5120
+ logger8
4868
5121
  )({
4869
5122
  scopes: { tenantId, projectId }
4870
5123
  });
@@ -4889,20 +5142,20 @@ app19.openapi(
4889
5142
  }
4890
5143
  }
4891
5144
  );
4892
- var projectFull_default = app19;
5145
+ var projectFull_default = app20;
4893
5146
 
4894
5147
  // src/app.ts
4895
- var logger8 = getLogger("agents-manage-api");
4896
- logger8.info({ logger: logger8.getTransports() }, "Logger initialized");
5148
+ var logger9 = getLogger("agents-manage-api");
5149
+ logger9.info({ logger: logger9.getTransports() }, "Logger initialized");
4897
5150
  function createManagementHono(serverConfig, credentialStores) {
4898
- const app21 = new OpenAPIHono();
4899
- app21.use("*", requestId());
4900
- app21.use("*", async (c, next) => {
5151
+ const app22 = new OpenAPIHono();
5152
+ app22.use("*", requestId());
5153
+ app22.use("*", async (c, next) => {
4901
5154
  c.set("serverConfig", serverConfig);
4902
5155
  c.set("credentialStores", credentialStores);
4903
5156
  return next();
4904
5157
  });
4905
- app21.use(
5158
+ app22.use(
4906
5159
  pinoLogger({
4907
5160
  pino: getLogger("agents-manage-api").getPinoInstance(),
4908
5161
  http: {
@@ -4915,7 +5168,7 @@ function createManagementHono(serverConfig, credentialStores) {
4915
5168
  }
4916
5169
  })
4917
5170
  );
4918
- app21.onError(async (err, c) => {
5171
+ app22.onError(async (err, c) => {
4919
5172
  const isExpectedError = err instanceof HTTPException;
4920
5173
  const status = isExpectedError ? err.status : 500;
4921
5174
  const requestId2 = c.get("requestId") || "unknown";
@@ -4948,7 +5201,7 @@ function createManagementHono(serverConfig, credentialStores) {
4948
5201
  if (!isExpectedError) {
4949
5202
  const errorMessage = err instanceof Error ? err.message : String(err);
4950
5203
  const errorStack = err instanceof Error ? err.stack : void 0;
4951
- logger8.error(
5204
+ logger9.error(
4952
5205
  {
4953
5206
  error: err,
4954
5207
  message: errorMessage,
@@ -4959,7 +5212,7 @@ function createManagementHono(serverConfig, credentialStores) {
4959
5212
  "Unexpected server error occurred"
4960
5213
  );
4961
5214
  } else {
4962
- logger8.error(
5215
+ logger9.error(
4963
5216
  {
4964
5217
  error: err,
4965
5218
  path: c.req.path,
@@ -4975,7 +5228,7 @@ function createManagementHono(serverConfig, credentialStores) {
4975
5228
  const response = err.getResponse();
4976
5229
  return response;
4977
5230
  } catch (responseError) {
4978
- logger8.error({ error: responseError }, "Error while handling HTTPException response");
5231
+ logger9.error({ error: responseError }, "Error while handling HTTPException response");
4979
5232
  }
4980
5233
  }
4981
5234
  const { status: respStatus, title, detail, instance } = await handleApiError(err, requestId2);
@@ -4990,7 +5243,7 @@ function createManagementHono(serverConfig, credentialStores) {
4990
5243
  ...instance && { instance }
4991
5244
  });
4992
5245
  });
4993
- app21.use(
5246
+ app22.use(
4994
5247
  "*",
4995
5248
  cors({
4996
5249
  origin: (origin) => {
@@ -5004,7 +5257,7 @@ function createManagementHono(serverConfig, credentialStores) {
5004
5257
  credentials: true
5005
5258
  })
5006
5259
  );
5007
- app21.openapi(
5260
+ app22.openapi(
5008
5261
  createRoute({
5009
5262
  method: "get",
5010
5263
  path: "/health",
@@ -5021,13 +5274,13 @@ function createManagementHono(serverConfig, credentialStores) {
5021
5274
  return c.body(null, 204);
5022
5275
  }
5023
5276
  );
5024
- app21.use("/tenants/*", apiKeyAuth());
5025
- app21.route("/tenants/:tenantId", routes_default);
5026
- app21.route("/tenants/:tenantId", projectFull_default);
5027
- app21.route("/oauth", oauth_default);
5028
- setupOpenAPIRoutes(app21);
5277
+ app22.use("/tenants/*", apiKeyAuth());
5278
+ app22.route("/tenants/:tenantId", routes_default);
5279
+ app22.route("/tenants/:tenantId", projectFull_default);
5280
+ app22.route("/oauth", oauth_default);
5281
+ setupOpenAPIRoutes(app22);
5029
5282
  const baseApp = new Hono();
5030
- baseApp.route("/", app21);
5283
+ baseApp.route("/", app22);
5031
5284
  return baseApp;
5032
5285
  }
5033
5286
 
@@ -5043,8 +5296,8 @@ var defaultConfig = {
5043
5296
  };
5044
5297
  var defaultStores = createDefaultCredentialStores();
5045
5298
  var defaultRegistry = new CredentialStoreRegistry(defaultStores);
5046
- var app20 = createManagementHono(defaultConfig, defaultRegistry);
5047
- var index_default = app20;
5299
+ var app21 = createManagementHono(defaultConfig, defaultRegistry);
5300
+ var index_default = app21;
5048
5301
  function createManagementApp(config) {
5049
5302
  const serverConfig = config?.serverConfig ?? defaultConfig;
5050
5303
  const stores = config?.credentialStores ?? defaultStores;