@inkeep/agents-manage-api 0.37.0 → 0.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { F, u, R, x, T, h, U, L, or, C, Vr, ce, ur, P } from './chunk-SBJLXGYG.js';
2
- import { loadEnvironmentFiles, getLogger, createDatabaseClient, commonGetErrorResponses, AgentListResponse, PaginationQueryParamsSchema, TenantProjectParamsSchema, listAgents, AgentResponse, TenantProjectIdParamsSchema, getAgentById, createApiError, RelatedAgentInfoListResponse, TenantProjectAgentSubAgentParamsSchema, getAgentSubAgentInfos, AgentWithinContextOfProjectResponse, TenantProjectAgentParamsSchema, getFullAgentDefinition, AgentApiInsertSchema, createAgent, generateId, AgentApiUpdateSchema, updateAgent, ErrorResponseSchema, deleteAgent, AgentWithinContextOfProjectSchema, createFullAgentServerSide, getFullAgent, updateFullAgentServerSide, deleteFullAgent, ApiKeyListResponse, listApiKeysPaginated, ApiKeyResponse, getApiKeyById, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, generateApiKey, createApiKey, ApiKeyApiUpdateSchema, updateApiKey, deleteApiKey, ArtifactComponentListResponse, listArtifactComponentsPaginated, ArtifactComponentResponse, getArtifactComponentById, ArtifactComponentApiInsertSchema, validatePropsAsJsonSchema, createArtifactComponent, ArtifactComponentApiUpdateSchema, updateArtifactComponent, deleteArtifactComponent, ContextConfigListResponse, listContextConfigsPaginated, ContextConfigResponse, TenantProjectAgentIdParamsSchema, getContextConfigById, ContextConfigApiInsertSchema, createContextConfig, commonUpdateErrorResponses, ContextConfigApiUpdateSchema, updateContextConfig, commonDeleteErrorResponses, deleteContextConfig, CredentialStoreListResponseSchema, CreateCredentialInStoreResponseSchema, CreateCredentialInStoreRequestSchema, CredentialReferenceListResponse, listCredentialReferencesPaginated, ListResponseSchema, CredentialReferenceApiSelectSchema, CredentialReferenceResponse, getCredentialReferenceWithResources, CredentialReferenceApiInsertSchema, createCredentialReference, CredentialReferenceApiUpdateSchema, updateCredentialReference, getCredentialReferenceById, getCredentialStoreLookupKeyFromRetrievalParams, deleteCredentialReference, DataComponentListResponse, listDataComponentsPaginated, DataComponentResponse, getDataComponent, DataComponentApiInsertSchema, createDataComponent, DataComponentApiUpdateSchema, updateDataComponent, deleteDataComponent, ExternalAgentListResponse, listExternalAgentsPaginated, ExternalAgentResponse, getExternalAgent, ExternalAgentApiInsertSchema, createExternalAgent, ExternalAgentApiUpdateSchema, updateExternalAgent, deleteExternalAgent, FunctionListResponse, listFunctions, FunctionResponse, getFunction, FunctionApiInsertSchema, upsertFunction, FunctionApiUpdateSchema, deleteFunction, FunctionToolListResponse, listFunctionTools, FunctionToolResponse, getFunctionToolById, FunctionToolApiInsertSchema, createFunctionTool, FunctionToolApiUpdateSchema, updateFunctionTool, deleteFunctionTool, MCPCatalogListResponse, fetchComposioServers, MCPTransportType, ProjectListResponse, TenantParamsSchema, listProjectsPaginated, ProjectResponse, TenantIdParamsSchema, getProject, ProjectApiInsertSchema, createProject, ProjectApiUpdateSchema, updateProject, deleteProject, ArtifactComponentArrayResponse, getArtifactComponentsForAgent, ComponentAssociationListResponse, getAgentsUsingArtifactComponent, SubAgentArtifactComponentResponse, SubAgentArtifactComponentApiInsertSchema, getSubAgentById, isArtifactComponentAssociatedWithAgent, associateArtifactComponentWithAgent, RemovedResponseSchema, removeArtifactComponentFromAgent, ExistsResponseSchema, DataComponentArrayResponse, getDataComponentsForAgent, getAgentsUsingDataComponent, SubAgentDataComponentResponse, SubAgentDataComponentApiInsertSchema, isDataComponentAssociatedWithAgent, associateDataComponentWithAgent, removeDataComponentFromAgent, SubAgentExternalAgentRelationListResponse, listSubAgentExternalAgentRelations, SubAgentExternalAgentRelationResponse, TenantProjectAgentSubAgentIdParamsSchema, getSubAgentExternalAgentRelationById, SubAgentExternalAgentRelationApiInsertSchema, createSubAgentExternalAgentRelation, SubAgentExternalAgentRelationApiUpdateSchema, updateSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelation, SubAgentRelationListResponse, SubAgentRelationQuerySchema, getAgentRelationsBySource, getSubAgentRelationsByTarget, listAgentRelations, SubAgentRelationResponse, getAgentRelationById, SubAgentRelationApiInsertSchema, validateSubAgent, createSubAgentRelation, SubAgentRelationApiUpdateSchema, updateAgentRelation, deleteSubAgentRelation, SubAgentListResponse, listSubAgentsPaginated, SubAgentResponse, SubAgentApiInsertSchema, createSubAgent, SubAgentApiUpdateSchema, updateSubAgent, deleteSubAgent, SubAgentTeamAgentRelationListResponse, listSubAgentTeamAgentRelations, SubAgentTeamAgentRelationResponse, getSubAgentTeamAgentRelationById, SubAgentTeamAgentRelationApiInsertSchema, createSubAgentTeamAgentRelation, SubAgentTeamAgentRelationApiUpdateSchema, updateSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelation, SubAgentToolRelationListResponse, getAgentToolRelationByAgent, getAgentToolRelationByTool, listAgentToolRelations, SubAgentToolRelationResponse, getAgentToolRelationById, getAgentsForTool, SubAgentToolRelationApiInsertSchema, createAgentToolRelation, SubAgentToolRelationApiUpdateSchema, updateAgentToolRelation, deleteAgentToolRelation, ThirdPartyMCPServerResponse, fetchSingleComposioServer, McpToolListResponse, ToolStatusSchema, listTools, dbResultToMcpTool, McpToolResponse, getToolById, ToolApiInsertSchema, createTool, ToolApiUpdateSchema, updateTool, deleteTool, getPendingInvitationsByEmail, OAuthLoginQuerySchema, OAuthCallbackQuerySchema, CredentialStoreType, projectExists, signTempToken, FullProjectDefinitionResponse, FullProjectDefinitionSchema, createFullProjectServerSide, getFullProject, updateFullProjectServerSide, deleteFullProject, getUserOrganizations, addUserToOrganization, initiateMcpOAuthFlow, exchangeMcpAuthorizationCode, handleApiError, organization, getUserByEmail, member, createDefaultCredentialStores, CredentialStoreRegistry } from '@inkeep/agents-core';
2
+ import { loadEnvironmentFiles, getLogger, createDatabaseClient, commonGetErrorResponses, AgentListResponse, PaginationQueryParamsSchema, TenantProjectParamsSchema, listAgents, AgentResponse, TenantProjectIdParamsSchema, getAgentById, createApiError, RelatedAgentInfoListResponse, TenantProjectAgentSubAgentParamsSchema, getAgentSubAgentInfos, AgentWithinContextOfProjectResponse, TenantProjectAgentParamsSchema, getFullAgentDefinition, AgentApiInsertSchema, createAgent, generateId, AgentApiUpdateSchema, updateAgent, ErrorResponseSchema, deleteAgent, AgentWithinContextOfProjectSchema, createFullAgentServerSide, getFullAgent, updateFullAgentServerSide, deleteFullAgent, ApiKeyListResponse, listApiKeysPaginated, ApiKeyResponse, getApiKeyById, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, generateApiKey, createApiKey, ApiKeyApiUpdateSchema, updateApiKey, deleteApiKey, ArtifactComponentListResponse, listArtifactComponentsPaginated, ArtifactComponentResponse, getArtifactComponentById, ArtifactComponentApiInsertSchema, validatePropsAsJsonSchema, createArtifactComponent, ArtifactComponentApiUpdateSchema, updateArtifactComponent, deleteArtifactComponent, ContextConfigListResponse, listContextConfigsPaginated, ContextConfigResponse, TenantProjectAgentIdParamsSchema, getContextConfigById, ContextConfigApiInsertSchema, createContextConfig, commonUpdateErrorResponses, ContextConfigApiUpdateSchema, updateContextConfig, commonDeleteErrorResponses, deleteContextConfig, getConversationHistory, formatMessagesForLLMContext, CredentialStoreListResponseSchema, CreateCredentialInStoreResponseSchema, CreateCredentialInStoreRequestSchema, CredentialReferenceListResponse, listCredentialReferencesPaginated, ListResponseSchema, CredentialReferenceApiSelectSchema, CredentialReferenceResponse, getCredentialReferenceWithResources, CredentialReferenceApiInsertSchema, createCredentialReference, CredentialReferenceApiUpdateSchema, updateCredentialReference, getCredentialReferenceById, getCredentialStoreLookupKeyFromRetrievalParams, deleteCredentialReference, DataComponentListResponse, listDataComponentsPaginated, DataComponentResponse, getDataComponent, DataComponentApiInsertSchema, createDataComponent, DataComponentApiUpdateSchema, updateDataComponent, deleteDataComponent, ExternalAgentListResponse, listExternalAgentsPaginated, ExternalAgentResponse, getExternalAgent, ExternalAgentApiInsertSchema, createExternalAgent, ExternalAgentApiUpdateSchema, updateExternalAgent, deleteExternalAgent, FunctionListResponse, listFunctions, FunctionResponse, getFunction, FunctionApiInsertSchema, upsertFunction, FunctionApiUpdateSchema, deleteFunction, FunctionToolListResponse, listFunctionTools, FunctionToolResponse, getFunctionToolById, FunctionToolApiInsertSchema, createFunctionTool, FunctionToolApiUpdateSchema, updateFunctionTool, deleteFunctionTool, MCPCatalogListResponse, fetchComposioServers, MCPTransportType, ProjectListResponse, TenantParamsSchema, listProjectsPaginated, ProjectResponse, TenantIdParamsSchema, getProject, ProjectApiInsertSchema, createProject, ProjectApiUpdateSchema, updateProject, deleteProject, ArtifactComponentArrayResponse, getArtifactComponentsForAgent, ComponentAssociationListResponse, getAgentsUsingArtifactComponent, SubAgentArtifactComponentResponse, SubAgentArtifactComponentApiInsertSchema, getSubAgentById, isArtifactComponentAssociatedWithAgent, associateArtifactComponentWithAgent, RemovedResponseSchema, removeArtifactComponentFromAgent, ExistsResponseSchema, DataComponentArrayResponse, getDataComponentsForAgent, getAgentsUsingDataComponent, SubAgentDataComponentResponse, SubAgentDataComponentApiInsertSchema, isDataComponentAssociatedWithAgent, associateDataComponentWithAgent, removeDataComponentFromAgent, SubAgentExternalAgentRelationListResponse, listSubAgentExternalAgentRelations, SubAgentExternalAgentRelationResponse, TenantProjectAgentSubAgentIdParamsSchema, getSubAgentExternalAgentRelationById, SubAgentExternalAgentRelationApiInsertSchema, createSubAgentExternalAgentRelation, SubAgentExternalAgentRelationApiUpdateSchema, updateSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelation, SubAgentRelationListResponse, SubAgentRelationQuerySchema, getAgentRelationsBySource, getSubAgentRelationsByTarget, listAgentRelations, SubAgentRelationResponse, getAgentRelationById, SubAgentRelationApiInsertSchema, validateSubAgent, createSubAgentRelation, SubAgentRelationApiUpdateSchema, updateAgentRelation, deleteSubAgentRelation, SubAgentListResponse, listSubAgentsPaginated, SubAgentResponse, SubAgentApiInsertSchema, createSubAgent, SubAgentApiUpdateSchema, updateSubAgent, deleteSubAgent, SubAgentIsDefaultError, SubAgentTeamAgentRelationListResponse, listSubAgentTeamAgentRelations, SubAgentTeamAgentRelationResponse, getSubAgentTeamAgentRelationById, SubAgentTeamAgentRelationApiInsertSchema, createSubAgentTeamAgentRelation, SubAgentTeamAgentRelationApiUpdateSchema, updateSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelation, SubAgentToolRelationListResponse, getAgentToolRelationByAgent, getAgentToolRelationByTool, listAgentToolRelations, SubAgentToolRelationResponse, getAgentToolRelationById, getAgentsForTool, SubAgentToolRelationApiInsertSchema, createAgentToolRelation, SubAgentToolRelationApiUpdateSchema, updateAgentToolRelation, deleteAgentToolRelation, ThirdPartyMCPServerResponse, fetchSingleComposioServer, McpToolListResponse, ToolStatusSchema, listTools, dbResultToMcpTool, McpToolResponse, getToolById, ToolApiInsertSchema, createTool, ToolApiUpdateSchema, updateTool, deleteTool, getPendingInvitationsByEmail, OAuthLoginQuerySchema, OAuthCallbackQuerySchema, CredentialStoreType, projectExists, signTempToken, FullProjectDefinitionResponse, FullProjectDefinitionSchema, createFullProjectServerSide, getFullProject, updateFullProjectServerSide, deleteFullProject, getUserOrganizations, addUserToOrganization, initiateMcpOAuthFlow, exchangeMcpAuthorizationCode, handleApiError, organization, getUserByEmail, member, createDefaultCredentialStores, CredentialStoreRegistry } from '@inkeep/agents-core';
3
3
  import { createAuth } from '@inkeep/agents-core/auth';
4
4
  import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
5
5
  import { Hono } from 'hono';
@@ -13,6 +13,8 @@ import * as schema from '@inkeep/agents-core/db/schema';
13
13
  import { drizzle } from 'drizzle-orm/pglite';
14
14
  import { swaggerUI } from '@hono/swagger-ui';
15
15
  import { nanoid } from 'nanoid';
16
+ import { StreamableHTTPTransport } from '@hono/mcp';
17
+ import { createConsoleLogger, createMCPServer } from '@inkeep/agents-manage-mcp';
16
18
  import { UserOrganizationsResponseSchema, AddUserToOrganizationResponseSchema, AddUserToOrganizationRequestSchema } from '@inkeep/agents-core/auth/validation';
17
19
  import { eq, and } from 'drizzle-orm';
18
20
  import * as client from 'openid-client';
@@ -68,11 +70,10 @@ var apiKeyAuth = () => createMiddleware(async (c, next) => {
68
70
  logger.info({}, "Bypass secret authenticated successfully");
69
71
  await next();
70
72
  return;
71
- } else {
72
- throw new HTTPException(401, {
73
- message: "Invalid Token"
74
- });
75
73
  }
74
+ throw new HTTPException(401, {
75
+ message: "Invalid Token"
76
+ });
76
77
  }
77
78
  await next();
78
79
  return;
@@ -5201,11 +5202,11 @@ var requireTenantAccess = () => createMiddleware(async (c, next) => {
5201
5202
  });
5202
5203
  }
5203
5204
  });
5204
- function setupOpenAPIRoutes(app27) {
5205
- app27.get("/openapi.json", (c) => {
5205
+ function setupOpenAPIRoutes(app29) {
5206
+ app29.get("/openapi.json", (c) => {
5206
5207
  try {
5207
5208
  const serverUrl = process.env.VERCEL_ENV === "production" && process.env.VERCEL_PROJECT_PRODUCTION_URL ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}` : process.env.VERCEL_ENV === "preview" && process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : env.INKEEP_AGENTS_MANAGE_API_URL;
5208
- const document2 = app27.getOpenAPIDocument({
5209
+ const document2 = app29.getOpenAPIDocument({
5209
5210
  openapi: "3.0.0",
5210
5211
  info: {
5211
5212
  title: "Inkeep Agents Manage API",
@@ -5344,7 +5345,7 @@ function setupOpenAPIRoutes(app27) {
5344
5345
  return c.json({ error: "Failed to generate OpenAPI document", details: errorDetails }, 500);
5345
5346
  }
5346
5347
  });
5347
- app27.get(
5348
+ app29.get(
5348
5349
  "/docs",
5349
5350
  swaggerUI({
5350
5351
  url: "/openapi.json",
@@ -5593,15 +5594,26 @@ app.openapi(
5593
5594
  async (c) => {
5594
5595
  const { tenantId, projectId } = c.req.valid("param");
5595
5596
  const validatedBody = c.req.valid("json");
5596
- const agent = await createAgent(dbClient_default)({
5597
- tenantId,
5598
- projectId,
5599
- id: validatedBody.id || generateId(),
5600
- name: validatedBody.name,
5601
- defaultSubAgentId: validatedBody.defaultSubAgentId,
5602
- contextConfigId: validatedBody.contextConfigId ?? void 0
5603
- });
5604
- return c.json({ data: agent }, 201);
5597
+ try {
5598
+ const agent = await createAgent(dbClient_default)({
5599
+ tenantId,
5600
+ projectId,
5601
+ id: validatedBody.id || generateId(),
5602
+ name: validatedBody.name,
5603
+ defaultSubAgentId: validatedBody.defaultSubAgentId,
5604
+ contextConfigId: validatedBody.contextConfigId ?? void 0
5605
+ });
5606
+ return c.json({ data: agent }, 201);
5607
+ } catch (error) {
5608
+ if (error?.cause?.code === "23505") {
5609
+ const agentId = validatedBody.id || "unknown";
5610
+ throw createApiError({
5611
+ code: "conflict",
5612
+ message: `An agent with ID '${agentId}' already exists`
5613
+ });
5614
+ }
5615
+ throw error;
5616
+ }
5605
5617
  }
5606
5618
  );
5607
5619
  app.openapi(
@@ -6685,7 +6697,72 @@ app5.openapi(
6685
6697
  );
6686
6698
  var contextConfigs_default = app5;
6687
6699
  var app6 = new OpenAPIHono();
6700
+ var ConversationQueryParamsSchema = z.object({
6701
+ limit: z.coerce.number().min(1).max(200).default(20).optional(),
6702
+ includeInternal: z.coerce.boolean().default(false).optional()
6703
+ });
6704
+ var ConversationWithFormattedMessagesResponse = z.object({
6705
+ data: z.object({
6706
+ messages: z.array(z.any()),
6707
+ formatted: z.object({
6708
+ llmContext: z.string()
6709
+ })
6710
+ })
6711
+ }).openapi("ConversationWithFormattedMessagesResponse");
6688
6712
  app6.openapi(
6713
+ createRoute({
6714
+ method: "get",
6715
+ path: "/{id}",
6716
+ summary: "Get Conversation",
6717
+ operationId: "get-conversation",
6718
+ tags: ["Conversations"],
6719
+ request: {
6720
+ params: TenantProjectIdParamsSchema,
6721
+ query: ConversationQueryParamsSchema
6722
+ },
6723
+ responses: {
6724
+ 200: {
6725
+ description: "Conversation found with formatted messages for LLM use",
6726
+ content: {
6727
+ "application/json": {
6728
+ schema: ConversationWithFormattedMessagesResponse
6729
+ }
6730
+ }
6731
+ },
6732
+ ...commonGetErrorResponses
6733
+ }
6734
+ }),
6735
+ async (c) => {
6736
+ const { tenantId, projectId, id } = c.req.valid("param");
6737
+ const { limit = 20, includeInternal = true } = c.req.valid("query");
6738
+ const messages = await getConversationHistory(dbClient_default)({
6739
+ scopes: { tenantId, projectId },
6740
+ conversationId: id,
6741
+ options: {
6742
+ limit,
6743
+ includeInternal
6744
+ }
6745
+ });
6746
+ if (!messages || messages.length === 0) {
6747
+ throw createApiError({
6748
+ code: "not_found",
6749
+ message: "Conversation not found"
6750
+ });
6751
+ }
6752
+ const llmContext = formatMessagesForLLMContext(messages);
6753
+ return c.json({
6754
+ data: {
6755
+ messages,
6756
+ formatted: {
6757
+ llmContext
6758
+ }
6759
+ }
6760
+ });
6761
+ }
6762
+ );
6763
+ var conversations_default = app6;
6764
+ var app7 = new OpenAPIHono();
6765
+ app7.openapi(
6689
6766
  createRoute({
6690
6767
  method: "get",
6691
6768
  path: "/",
@@ -6726,7 +6803,7 @@ app6.openapi(
6726
6803
  });
6727
6804
  }
6728
6805
  );
6729
- app6.openapi(
6806
+ app7.openapi(
6730
6807
  createRoute({
6731
6808
  method: "post",
6732
6809
  path: "/{id}/credentials",
@@ -6794,33 +6871,30 @@ app6.openapi(
6794
6871
  }
6795
6872
  }
6796
6873
  );
6797
- var credentialStores_default = app6;
6798
- var app7 = new OpenAPIHono();
6799
- app7.use("/", async (c, next) => {
6874
+ var credentialStores_default = app7;
6875
+ var app8 = new OpenAPIHono();
6876
+ app8.use("/", async (c, next) => {
6800
6877
  if (c.req.method === "POST") {
6801
- return requirePermission({ credential: ["create"] })(
6802
- c,
6803
- next
6804
- );
6878
+ return requirePermission({
6879
+ credential: ["create"]
6880
+ })(c, next);
6805
6881
  }
6806
6882
  return next();
6807
6883
  });
6808
- app7.use("/:id", async (c, next) => {
6884
+ app8.use("/:id", async (c, next) => {
6809
6885
  if (c.req.method === "PATCH") {
6810
- return requirePermission({ credential: ["update"] })(
6811
- c,
6812
- next
6813
- );
6886
+ return requirePermission({
6887
+ credential: ["update"]
6888
+ })(c, next);
6814
6889
  }
6815
6890
  if (c.req.method === "DELETE") {
6816
- return requirePermission({ credential: ["delete"] })(
6817
- c,
6818
- next
6819
- );
6891
+ return requirePermission({
6892
+ credential: ["delete"]
6893
+ })(c, next);
6820
6894
  }
6821
6895
  return next();
6822
6896
  });
6823
- app7.openapi(
6897
+ app8.openapi(
6824
6898
  createRoute({
6825
6899
  method: "get",
6826
6900
  path: "/",
@@ -6855,7 +6929,7 @@ app7.openapi(
6855
6929
  return c.json(validatedResult);
6856
6930
  }
6857
6931
  );
6858
- app7.openapi(
6932
+ app8.openapi(
6859
6933
  createRoute({
6860
6934
  method: "get",
6861
6935
  path: "/{id}",
@@ -6893,7 +6967,7 @@ app7.openapi(
6893
6967
  return c.json({ data: validatedCredential });
6894
6968
  }
6895
6969
  );
6896
- app7.openapi(
6970
+ app8.openapi(
6897
6971
  createRoute({
6898
6972
  method: "post",
6899
6973
  path: "/",
@@ -6935,7 +7009,7 @@ app7.openapi(
6935
7009
  return c.json({ data: validatedCredential }, 201);
6936
7010
  }
6937
7011
  );
6938
- app7.openapi(
7012
+ app8.openapi(
6939
7013
  createRoute({
6940
7014
  method: "put",
6941
7015
  path: "/{id}",
@@ -6982,7 +7056,7 @@ app7.openapi(
6982
7056
  return c.json({ data: validatedCredential });
6983
7057
  }
6984
7058
  );
6985
- app7.openapi(
7059
+ app8.openapi(
6986
7060
  createRoute({
6987
7061
  method: "delete",
6988
7062
  path: "/{id}",
@@ -7053,15 +7127,15 @@ app7.openapi(
7053
7127
  return c.body(null, 204);
7054
7128
  }
7055
7129
  );
7056
- var credentials_default = app7;
7057
- var app8 = new OpenAPIHono();
7058
- app8.use("/", async (c, next) => {
7130
+ var credentials_default = app8;
7131
+ var app9 = new OpenAPIHono();
7132
+ app9.use("/", async (c, next) => {
7059
7133
  if (c.req.method === "POST") {
7060
7134
  return requirePermission({ data_component: ["create"] })(c, next);
7061
7135
  }
7062
7136
  return next();
7063
7137
  });
7064
- app8.use("/:id", async (c, next) => {
7138
+ app9.use("/:id", async (c, next) => {
7065
7139
  if (c.req.method === "PATCH") {
7066
7140
  return requirePermission({ data_component: ["update"] })(c, next);
7067
7141
  }
@@ -7070,7 +7144,7 @@ app8.use("/:id", async (c, next) => {
7070
7144
  }
7071
7145
  return next();
7072
7146
  });
7073
- app8.openapi(
7147
+ app9.openapi(
7074
7148
  createRoute({
7075
7149
  method: "get",
7076
7150
  path: "/",
@@ -7104,7 +7178,7 @@ app8.openapi(
7104
7178
  return c.json(result);
7105
7179
  }
7106
7180
  );
7107
- app8.openapi(
7181
+ app9.openapi(
7108
7182
  createRoute({
7109
7183
  method: "get",
7110
7184
  path: "/{id}",
@@ -7141,7 +7215,7 @@ app8.openapi(
7141
7215
  return c.json({ data: dataComponent });
7142
7216
  }
7143
7217
  );
7144
- app8.openapi(
7218
+ app9.openapi(
7145
7219
  createRoute({
7146
7220
  method: "post",
7147
7221
  path: "/",
@@ -7192,7 +7266,7 @@ app8.openapi(
7192
7266
  return c.json({ data: dataComponent }, 201);
7193
7267
  }
7194
7268
  );
7195
- app8.openapi(
7269
+ app9.openapi(
7196
7270
  createRoute({
7197
7271
  method: "put",
7198
7272
  path: "/{id}",
@@ -7248,7 +7322,7 @@ app8.openapi(
7248
7322
  return c.json({ data: updatedDataComponent });
7249
7323
  }
7250
7324
  );
7251
- app8.openapi(
7325
+ app9.openapi(
7252
7326
  createRoute({
7253
7327
  method: "delete",
7254
7328
  path: "/{id}",
@@ -7287,15 +7361,15 @@ app8.openapi(
7287
7361
  return c.body(null, 204);
7288
7362
  }
7289
7363
  );
7290
- var dataComponents_default = app8;
7291
- var app9 = new OpenAPIHono();
7292
- app9.use("/", async (c, next) => {
7364
+ var dataComponents_default = app9;
7365
+ var app10 = new OpenAPIHono();
7366
+ app10.use("/", async (c, next) => {
7293
7367
  if (c.req.method === "POST") {
7294
7368
  return requirePermission({ external_agent: ["create"] })(c, next);
7295
7369
  }
7296
7370
  return next();
7297
7371
  });
7298
- app9.use("/:id", async (c, next) => {
7372
+ app10.use("/:id", async (c, next) => {
7299
7373
  if (c.req.method === "PATCH") {
7300
7374
  return requirePermission({ external_agent: ["update"] })(c, next);
7301
7375
  }
@@ -7304,7 +7378,7 @@ app9.use("/:id", async (c, next) => {
7304
7378
  }
7305
7379
  return next();
7306
7380
  });
7307
- app9.openapi(
7381
+ app10.openapi(
7308
7382
  createRoute({
7309
7383
  method: "get",
7310
7384
  path: "/",
@@ -7344,7 +7418,7 @@ app9.openapi(
7344
7418
  return c.json(dataWithType);
7345
7419
  }
7346
7420
  );
7347
- app9.openapi(
7421
+ app10.openapi(
7348
7422
  createRoute({
7349
7423
  method: "get",
7350
7424
  path: "/{id}",
@@ -7385,7 +7459,7 @@ app9.openapi(
7385
7459
  return c.json({ data: agentWithType });
7386
7460
  }
7387
7461
  );
7388
- app9.openapi(
7462
+ app10.openapi(
7389
7463
  createRoute({
7390
7464
  method: "post",
7391
7465
  path: "/",
@@ -7434,7 +7508,7 @@ app9.openapi(
7434
7508
  return c.json({ data: agentWithType }, 201);
7435
7509
  }
7436
7510
  );
7437
- app9.openapi(
7511
+ app10.openapi(
7438
7512
  createRoute({
7439
7513
  method: "put",
7440
7514
  path: "/{id}",
@@ -7484,7 +7558,7 @@ app9.openapi(
7484
7558
  return c.json({ data: agentWithType });
7485
7559
  }
7486
7560
  );
7487
- app9.openapi(
7561
+ app10.openapi(
7488
7562
  createRoute({
7489
7563
  method: "delete",
7490
7564
  path: "/{id}",
@@ -7523,16 +7597,16 @@ app9.openapi(
7523
7597
  return c.body(null, 204);
7524
7598
  }
7525
7599
  );
7526
- var externalAgents_default = app9;
7600
+ var externalAgents_default = app10;
7527
7601
  var logger3 = getLogger("functions");
7528
- var app10 = new OpenAPIHono();
7529
- app10.use("/", async (c, next) => {
7602
+ var app11 = new OpenAPIHono();
7603
+ app11.use("/", async (c, next) => {
7530
7604
  if (c.req.method === "POST") {
7531
7605
  return requirePermission({ function: ["create"] })(c, next);
7532
7606
  }
7533
7607
  return next();
7534
7608
  });
7535
- app10.use("/:id", async (c, next) => {
7609
+ app11.use("/:id", async (c, next) => {
7536
7610
  if (c.req.method === "PUT") {
7537
7611
  return requirePermission({ function: ["update"] })(c, next);
7538
7612
  }
@@ -7541,7 +7615,7 @@ app10.use("/:id", async (c, next) => {
7541
7615
  }
7542
7616
  return next();
7543
7617
  });
7544
- app10.openapi(
7618
+ app11.openapi(
7545
7619
  createRoute({
7546
7620
  method: "get",
7547
7621
  path: "/",
@@ -7586,7 +7660,7 @@ app10.openapi(
7586
7660
  }
7587
7661
  }
7588
7662
  );
7589
- app10.openapi(
7663
+ app11.openapi(
7590
7664
  createRoute({
7591
7665
  method: "get",
7592
7666
  path: "/{id}",
@@ -7631,7 +7705,7 @@ app10.openapi(
7631
7705
  }
7632
7706
  }
7633
7707
  );
7634
- app10.openapi(
7708
+ app11.openapi(
7635
7709
  createRoute({
7636
7710
  method: "post",
7637
7711
  path: "/",
@@ -7687,7 +7761,7 @@ app10.openapi(
7687
7761
  }
7688
7762
  }
7689
7763
  );
7690
- app10.openapi(
7764
+ app11.openapi(
7691
7765
  createRoute({
7692
7766
  method: "put",
7693
7767
  path: "/{id}",
@@ -7753,7 +7827,7 @@ app10.openapi(
7753
7827
  }
7754
7828
  }
7755
7829
  );
7756
- app10.openapi(
7830
+ app11.openapi(
7757
7831
  createRoute({
7758
7832
  method: "delete",
7759
7833
  path: "/{id}",
@@ -7798,16 +7872,16 @@ app10.openapi(
7798
7872
  }
7799
7873
  }
7800
7874
  );
7801
- var functions_default = app10;
7875
+ var functions_default = app11;
7802
7876
  var logger4 = getLogger("functionTools");
7803
- var app11 = new OpenAPIHono();
7804
- app11.use("/", async (c, next) => {
7877
+ var app12 = new OpenAPIHono();
7878
+ app12.use("/", async (c, next) => {
7805
7879
  if (c.req.method === "POST") {
7806
7880
  return requirePermission({ function: ["create"] })(c, next);
7807
7881
  }
7808
7882
  return next();
7809
7883
  });
7810
- app11.use("/:id", async (c, next) => {
7884
+ app12.use("/:id", async (c, next) => {
7811
7885
  if (c.req.method === "PUT") {
7812
7886
  return requirePermission({ function: ["update"] })(c, next);
7813
7887
  }
@@ -7816,7 +7890,7 @@ app11.use("/:id", async (c, next) => {
7816
7890
  }
7817
7891
  return next();
7818
7892
  });
7819
- app11.openapi(
7893
+ app12.openapi(
7820
7894
  createRoute({
7821
7895
  method: "get",
7822
7896
  path: "/",
@@ -7857,7 +7931,7 @@ app11.openapi(
7857
7931
  }
7858
7932
  }
7859
7933
  );
7860
- app11.openapi(
7934
+ app12.openapi(
7861
7935
  createRoute({
7862
7936
  method: "get",
7863
7937
  path: "/{id}",
@@ -7902,7 +7976,7 @@ app11.openapi(
7902
7976
  }
7903
7977
  }
7904
7978
  );
7905
- app11.openapi(
7979
+ app12.openapi(
7906
7980
  createRoute({
7907
7981
  method: "post",
7908
7982
  path: "/",
@@ -7956,7 +8030,7 @@ app11.openapi(
7956
8030
  }
7957
8031
  }
7958
8032
  );
7959
- app11.openapi(
8033
+ app12.openapi(
7960
8034
  createRoute({
7961
8035
  method: "put",
7962
8036
  path: "/{id}",
@@ -8016,7 +8090,7 @@ app11.openapi(
8016
8090
  }
8017
8091
  }
8018
8092
  );
8019
- app11.openapi(
8093
+ app12.openapi(
8020
8094
  createRoute({
8021
8095
  method: "delete",
8022
8096
  path: "/{id}",
@@ -8059,8 +8133,8 @@ app11.openapi(
8059
8133
  }
8060
8134
  }
8061
8135
  );
8062
- var functionTools_default = app11;
8063
- var app12 = new OpenAPIHono();
8136
+ var functionTools_default = app12;
8137
+ var app13 = new OpenAPIHono();
8064
8138
  var PREBUILT_MCP_SERVERS = [
8065
8139
  {
8066
8140
  id: "apify",
@@ -8482,7 +8556,7 @@ var PREBUILT_MCP_SERVERS = [
8482
8556
  description: "AI-powered content creation"
8483
8557
  }
8484
8558
  ];
8485
- app12.openapi(
8559
+ app13.openapi(
8486
8560
  createRoute({
8487
8561
  method: "get",
8488
8562
  path: "/",
@@ -8517,15 +8591,15 @@ app12.openapi(
8517
8591
  });
8518
8592
  }
8519
8593
  );
8520
- var mcpCatalog_default = app12;
8521
- var app13 = new OpenAPIHono();
8522
- app13.use("/", async (c, next) => {
8594
+ var mcpCatalog_default = app13;
8595
+ var app14 = new OpenAPIHono();
8596
+ app14.use("/", async (c, next) => {
8523
8597
  if (c.req.method === "POST") {
8524
8598
  return requirePermission({ project: ["create"] })(c, next);
8525
8599
  }
8526
8600
  return next();
8527
8601
  });
8528
- app13.use("/:id", async (c, next) => {
8602
+ app14.use("/:id", async (c, next) => {
8529
8603
  if (c.req.method === "PATCH") {
8530
8604
  return requirePermission({ project: ["update"] })(c, next);
8531
8605
  }
@@ -8534,7 +8608,7 @@ app13.use("/:id", async (c, next) => {
8534
8608
  }
8535
8609
  return next();
8536
8610
  });
8537
- app13.openapi(
8611
+ app14.openapi(
8538
8612
  createRoute({
8539
8613
  method: "get",
8540
8614
  path: "/",
@@ -8569,7 +8643,7 @@ app13.openapi(
8569
8643
  return c.json(result);
8570
8644
  }
8571
8645
  );
8572
- app13.openapi(
8646
+ app14.openapi(
8573
8647
  createRoute({
8574
8648
  method: "get",
8575
8649
  path: "/{id}",
@@ -8604,7 +8678,7 @@ app13.openapi(
8604
8678
  return c.json({ data: project });
8605
8679
  }
8606
8680
  );
8607
- app13.openapi(
8681
+ app14.openapi(
8608
8682
  createRoute({
8609
8683
  method: "post",
8610
8684
  path: "/",
@@ -8662,7 +8736,7 @@ app13.openapi(
8662
8736
  }
8663
8737
  }
8664
8738
  );
8665
- app13.openapi(
8739
+ app14.openapi(
8666
8740
  createRoute({
8667
8741
  method: "patch",
8668
8742
  path: "/{id}",
@@ -8708,7 +8782,7 @@ app13.openapi(
8708
8782
  return c.json({ data: project });
8709
8783
  }
8710
8784
  );
8711
- app13.openapi(
8785
+ app14.openapi(
8712
8786
  createRoute({
8713
8787
  method: "delete",
8714
8788
  path: "/{id}",
@@ -8758,21 +8832,21 @@ app13.openapi(
8758
8832
  }
8759
8833
  }
8760
8834
  );
8761
- var projects_default = app13;
8762
- var app14 = new OpenAPIHono();
8763
- app14.use("/", async (c, next) => {
8835
+ var projects_default = app14;
8836
+ var app15 = new OpenAPIHono();
8837
+ app15.use("/", async (c, next) => {
8764
8838
  if (c.req.method === "POST") {
8765
8839
  return requirePermission({ sub_agent: ["create"] })(c, next);
8766
8840
  }
8767
8841
  return next();
8768
8842
  });
8769
- app14.use("/agent/:subAgentId/component/:artifactComponentId", async (c, next) => {
8843
+ app15.use("/agent/:subAgentId/component/:artifactComponentId", async (c, next) => {
8770
8844
  if (c.req.method === "DELETE") {
8771
8845
  return requirePermission({ sub_agent: ["delete"] })(c, next);
8772
8846
  }
8773
8847
  return next();
8774
8848
  });
8775
- app14.openapi(
8849
+ app15.openapi(
8776
8850
  createRoute({
8777
8851
  method: "get",
8778
8852
  path: "/agent/{subAgentId}",
@@ -8804,7 +8878,7 @@ app14.openapi(
8804
8878
  });
8805
8879
  }
8806
8880
  );
8807
- app14.openapi(
8881
+ app15.openapi(
8808
8882
  createRoute({
8809
8883
  method: "get",
8810
8884
  path: "/component/{artifactComponentId}/agents",
@@ -8837,7 +8911,7 @@ app14.openapi(
8837
8911
  return c.json({ data: agents });
8838
8912
  }
8839
8913
  );
8840
- app14.openapi(
8914
+ app15.openapi(
8841
8915
  createRoute({
8842
8916
  method: "post",
8843
8917
  path: "/",
@@ -8914,7 +8988,7 @@ app14.openapi(
8914
8988
  return c.json({ data: association }, 201);
8915
8989
  }
8916
8990
  );
8917
- app14.openapi(
8991
+ app15.openapi(
8918
8992
  createRoute({
8919
8993
  method: "delete",
8920
8994
  path: "/agent/{subAgentId}/component/{artifactComponentId}",
@@ -8956,7 +9030,7 @@ app14.openapi(
8956
9030
  });
8957
9031
  }
8958
9032
  );
8959
- app14.openapi(
9033
+ app15.openapi(
8960
9034
  createRoute({
8961
9035
  method: "get",
8962
9036
  path: "/agent/{subAgentId}/component/{artifactComponentId}/exists",
@@ -8989,21 +9063,21 @@ app14.openapi(
8989
9063
  return c.json({ exists });
8990
9064
  }
8991
9065
  );
8992
- var subAgentArtifactComponents_default = app14;
8993
- var app15 = new OpenAPIHono();
8994
- app15.use("/", async (c, next) => {
9066
+ var subAgentArtifactComponents_default = app15;
9067
+ var app16 = new OpenAPIHono();
9068
+ app16.use("/", async (c, next) => {
8995
9069
  if (c.req.method === "POST") {
8996
9070
  return requirePermission({ sub_agent: ["create"] })(c, next);
8997
9071
  }
8998
9072
  return next();
8999
9073
  });
9000
- app15.use("/agent/:subAgentId/component/:dataComponentId", async (c, next) => {
9074
+ app16.use("/agent/:subAgentId/component/:dataComponentId", async (c, next) => {
9001
9075
  if (c.req.method === "DELETE") {
9002
9076
  return requirePermission({ sub_agent: ["delete"] })(c, next);
9003
9077
  }
9004
9078
  return next();
9005
9079
  });
9006
- app15.openapi(
9080
+ app16.openapi(
9007
9081
  createRoute({
9008
9082
  method: "get",
9009
9083
  path: "/agent/{subAgentId}",
@@ -9033,7 +9107,7 @@ app15.openapi(
9033
9107
  return c.json({ data: dataComponents });
9034
9108
  }
9035
9109
  );
9036
- app15.openapi(
9110
+ app16.openapi(
9037
9111
  createRoute({
9038
9112
  method: "get",
9039
9113
  path: "/component/{dataComponentId}/agents",
@@ -9066,7 +9140,7 @@ app15.openapi(
9066
9140
  return c.json({ data: agents });
9067
9141
  }
9068
9142
  );
9069
- app15.openapi(
9143
+ app16.openapi(
9070
9144
  createRoute({
9071
9145
  method: "post",
9072
9146
  path: "/",
@@ -9139,7 +9213,7 @@ app15.openapi(
9139
9213
  return c.json({ data: association }, 201);
9140
9214
  }
9141
9215
  );
9142
- app15.openapi(
9216
+ app16.openapi(
9143
9217
  createRoute({
9144
9218
  method: "delete",
9145
9219
  path: "/agent/{subAgentId}/component/{dataComponentId}",
@@ -9181,7 +9255,7 @@ app15.openapi(
9181
9255
  });
9182
9256
  }
9183
9257
  );
9184
- app15.openapi(
9258
+ app16.openapi(
9185
9259
  createRoute({
9186
9260
  method: "get",
9187
9261
  path: "/agent/{subAgentId}/component/{dataComponentId}/exists",
@@ -9214,15 +9288,15 @@ app15.openapi(
9214
9288
  return c.json({ exists });
9215
9289
  }
9216
9290
  );
9217
- var subAgentDataComponents_default = app15;
9218
- var app16 = new OpenAPIHono();
9219
- app16.use("/", async (c, next) => {
9291
+ var subAgentDataComponents_default = app16;
9292
+ var app17 = new OpenAPIHono();
9293
+ app17.use("/", async (c, next) => {
9220
9294
  if (c.req.method === "POST") {
9221
9295
  return requirePermission({ sub_agent: ["create"] })(c, next);
9222
9296
  }
9223
9297
  return next();
9224
9298
  });
9225
- app16.use("/:id", async (c, next) => {
9299
+ app17.use("/:id", async (c, next) => {
9226
9300
  if (c.req.method === "PUT") {
9227
9301
  return requirePermission({ sub_agent: ["update"] })(c, next);
9228
9302
  }
@@ -9231,7 +9305,7 @@ app16.use("/:id", async (c, next) => {
9231
9305
  }
9232
9306
  return next();
9233
9307
  });
9234
- app16.openapi(
9308
+ app17.openapi(
9235
9309
  createRoute({
9236
9310
  method: "get",
9237
9311
  path: "/",
@@ -9273,7 +9347,7 @@ app16.openapi(
9273
9347
  }
9274
9348
  }
9275
9349
  );
9276
- app16.openapi(
9350
+ app17.openapi(
9277
9351
  createRoute({
9278
9352
  method: "get",
9279
9353
  path: "/{id}",
@@ -9310,7 +9384,7 @@ app16.openapi(
9310
9384
  return c.json({ data: relation });
9311
9385
  }
9312
9386
  );
9313
- app16.openapi(
9387
+ app17.openapi(
9314
9388
  createRoute({
9315
9389
  method: "post",
9316
9390
  path: "/",
@@ -9366,7 +9440,7 @@ app16.openapi(
9366
9440
  return c.json({ data: relation }, 201);
9367
9441
  }
9368
9442
  );
9369
- app16.openapi(
9443
+ app17.openapi(
9370
9444
  createRoute({
9371
9445
  method: "put",
9372
9446
  path: "/{id}",
@@ -9412,7 +9486,7 @@ app16.openapi(
9412
9486
  return c.json({ data: updatedRelation });
9413
9487
  }
9414
9488
  );
9415
- app16.openapi(
9489
+ app17.openapi(
9416
9490
  createRoute({
9417
9491
  method: "delete",
9418
9492
  path: "/{id}",
@@ -9451,15 +9525,15 @@ app16.openapi(
9451
9525
  return c.body(null, 204);
9452
9526
  }
9453
9527
  );
9454
- var subAgentExternalAgentRelations_default = app16;
9455
- var app17 = new OpenAPIHono();
9456
- app17.use("/", async (c, next) => {
9528
+ var subAgentExternalAgentRelations_default = app17;
9529
+ var app18 = new OpenAPIHono();
9530
+ app18.use("/", async (c, next) => {
9457
9531
  if (c.req.method === "POST") {
9458
9532
  return requirePermission({ sub_agent: ["create"] })(c, next);
9459
9533
  }
9460
9534
  return next();
9461
9535
  });
9462
- app17.use("/:id", async (c, next) => {
9536
+ app18.use("/:id", async (c, next) => {
9463
9537
  if (c.req.method === "PUT") {
9464
9538
  return requirePermission({ sub_agent: ["update"] })(c, next);
9465
9539
  }
@@ -9468,7 +9542,7 @@ app17.use("/:id", async (c, next) => {
9468
9542
  }
9469
9543
  return next();
9470
9544
  });
9471
- app17.openapi(
9545
+ app18.openapi(
9472
9546
  createRoute({
9473
9547
  method: "get",
9474
9548
  path: "/",
@@ -9528,7 +9602,7 @@ app17.openapi(
9528
9602
  }
9529
9603
  }
9530
9604
  );
9531
- app17.openapi(
9605
+ app18.openapi(
9532
9606
  createRoute({
9533
9607
  method: "get",
9534
9608
  path: "/{id}",
@@ -9565,7 +9639,7 @@ app17.openapi(
9565
9639
  return c.json({ data: agentRelation });
9566
9640
  }
9567
9641
  );
9568
- app17.openapi(
9642
+ app18.openapi(
9569
9643
  createRoute({
9570
9644
  method: "post",
9571
9645
  path: "/",
@@ -9639,7 +9713,7 @@ app17.openapi(
9639
9713
  return c.json({ data: agentRelation }, 201);
9640
9714
  }
9641
9715
  );
9642
- app17.openapi(
9716
+ app18.openapi(
9643
9717
  createRoute({
9644
9718
  method: "put",
9645
9719
  path: "/{id}",
@@ -9685,7 +9759,7 @@ app17.openapi(
9685
9759
  return c.json({ data: updatedAgentRelation });
9686
9760
  }
9687
9761
  );
9688
- app17.openapi(
9762
+ app18.openapi(
9689
9763
  createRoute({
9690
9764
  method: "delete",
9691
9765
  path: "/{id}",
@@ -9724,15 +9798,15 @@ app17.openapi(
9724
9798
  return c.body(null, 204);
9725
9799
  }
9726
9800
  );
9727
- var subAgentRelations_default = app17;
9728
- var app18 = new OpenAPIHono();
9729
- app18.use("/", async (c, next) => {
9801
+ var subAgentRelations_default = app18;
9802
+ var app19 = new OpenAPIHono();
9803
+ app19.use("/", async (c, next) => {
9730
9804
  if (c.req.method === "POST") {
9731
9805
  return requirePermission({ sub_agent: ["create"] })(c, next);
9732
9806
  }
9733
9807
  return next();
9734
9808
  });
9735
- app18.use("/:id", async (c, next) => {
9809
+ app19.use("/:id", async (c, next) => {
9736
9810
  if (c.req.method === "PUT") {
9737
9811
  return requirePermission({ sub_agent: ["update"] })(c, next);
9738
9812
  }
@@ -9741,7 +9815,7 @@ app18.use("/:id", async (c, next) => {
9741
9815
  }
9742
9816
  return next();
9743
9817
  });
9744
- app18.openapi(
9818
+ app19.openapi(
9745
9819
  createRoute({
9746
9820
  method: "get",
9747
9821
  path: "/",
@@ -9782,7 +9856,7 @@ app18.openapi(
9782
9856
  return c.json(dataWithType);
9783
9857
  }
9784
9858
  );
9785
- app18.openapi(
9859
+ app19.openapi(
9786
9860
  createRoute({
9787
9861
  method: "get",
9788
9862
  path: "/{id}",
@@ -9823,7 +9897,7 @@ app18.openapi(
9823
9897
  return c.json({ data: subAgentWithType });
9824
9898
  }
9825
9899
  );
9826
- app18.openapi(
9900
+ app19.openapi(
9827
9901
  createRoute({
9828
9902
  method: "post",
9829
9903
  path: "/",
@@ -9870,7 +9944,7 @@ app18.openapi(
9870
9944
  return c.json({ data: subAgentWithType }, 201);
9871
9945
  }
9872
9946
  );
9873
- app18.openapi(
9947
+ app19.openapi(
9874
9948
  createRoute({
9875
9949
  method: "put",
9876
9950
  path: "/{id}",
@@ -9920,7 +9994,7 @@ app18.openapi(
9920
9994
  return c.json({ data: subAgentWithType });
9921
9995
  }
9922
9996
  );
9923
- app18.openapi(
9997
+ app19.openapi(
9924
9998
  createRoute({
9925
9999
  method: "delete",
9926
10000
  path: "/{id}",
@@ -9941,33 +10015,51 @@ app18.openapi(
9941
10015
  schema: ErrorResponseSchema
9942
10016
  }
9943
10017
  }
10018
+ },
10019
+ 409: {
10020
+ description: "SubAgent is set as default and cannot be deleted",
10021
+ content: {
10022
+ "application/json": {
10023
+ schema: ErrorResponseSchema
10024
+ }
10025
+ }
9944
10026
  }
9945
10027
  }
9946
10028
  }),
9947
10029
  async (c) => {
9948
10030
  const { tenantId, projectId, agentId, id } = c.req.valid("param");
9949
- const deleted = await deleteSubAgent(dbClient_default)({
9950
- scopes: { tenantId, projectId, agentId },
9951
- subAgentId: id
9952
- });
9953
- if (!deleted) {
9954
- throw createApiError({
9955
- code: "not_found",
9956
- message: "SubAgent not found"
10031
+ try {
10032
+ const deleted = await deleteSubAgent(dbClient_default)({
10033
+ scopes: { tenantId, projectId, agentId },
10034
+ subAgentId: id
9957
10035
  });
10036
+ if (!deleted) {
10037
+ throw createApiError({
10038
+ code: "not_found",
10039
+ message: "SubAgent not found"
10040
+ });
10041
+ }
10042
+ return c.body(null, 204);
10043
+ } catch (error) {
10044
+ if (error instanceof SubAgentIsDefaultError) {
10045
+ throw createApiError({
10046
+ code: "conflict",
10047
+ message: error.message
10048
+ });
10049
+ }
10050
+ throw error;
9958
10051
  }
9959
- return c.body(null, 204);
9960
10052
  }
9961
10053
  );
9962
- var subAgents_default = app18;
9963
- var app19 = new OpenAPIHono();
9964
- app19.use("/", async (c, next) => {
10054
+ var subAgents_default = app19;
10055
+ var app20 = new OpenAPIHono();
10056
+ app20.use("/", async (c, next) => {
9965
10057
  if (c.req.method === "POST") {
9966
10058
  return requirePermission({ sub_agent: ["create"] })(c, next);
9967
10059
  }
9968
10060
  return next();
9969
10061
  });
9970
- app19.use("/:id", async (c, next) => {
10062
+ app20.use("/:id", async (c, next) => {
9971
10063
  if (c.req.method === "PUT") {
9972
10064
  return requirePermission({ sub_agent: ["update"] })(c, next);
9973
10065
  }
@@ -9976,7 +10068,7 @@ app19.use("/:id", async (c, next) => {
9976
10068
  }
9977
10069
  return next();
9978
10070
  });
9979
- app19.openapi(
10071
+ app20.openapi(
9980
10072
  createRoute({
9981
10073
  method: "get",
9982
10074
  path: "/",
@@ -10018,7 +10110,7 @@ app19.openapi(
10018
10110
  }
10019
10111
  }
10020
10112
  );
10021
- app19.openapi(
10113
+ app20.openapi(
10022
10114
  createRoute({
10023
10115
  method: "get",
10024
10116
  path: "/{id}",
@@ -10055,7 +10147,7 @@ app19.openapi(
10055
10147
  return c.json({ data: relation });
10056
10148
  }
10057
10149
  );
10058
- app19.openapi(
10150
+ app20.openapi(
10059
10151
  createRoute({
10060
10152
  method: "post",
10061
10153
  path: "/",
@@ -10111,7 +10203,7 @@ app19.openapi(
10111
10203
  return c.json({ data: relation }, 201);
10112
10204
  }
10113
10205
  );
10114
- app19.openapi(
10206
+ app20.openapi(
10115
10207
  createRoute({
10116
10208
  method: "put",
10117
10209
  path: "/{id}",
@@ -10157,7 +10249,7 @@ app19.openapi(
10157
10249
  return c.json({ data: updatedRelation });
10158
10250
  }
10159
10251
  );
10160
- app19.openapi(
10252
+ app20.openapi(
10161
10253
  createRoute({
10162
10254
  method: "delete",
10163
10255
  path: "/{id}",
@@ -10196,15 +10288,15 @@ app19.openapi(
10196
10288
  return c.body(null, 204);
10197
10289
  }
10198
10290
  );
10199
- var subAgentTeamAgentRelations_default = app19;
10200
- var app20 = new OpenAPIHono();
10201
- app20.use("/", async (c, next) => {
10291
+ var subAgentTeamAgentRelations_default = app20;
10292
+ var app21 = new OpenAPIHono();
10293
+ app21.use("/", async (c, next) => {
10202
10294
  if (c.req.method === "POST") {
10203
10295
  return requirePermission({ sub_agent: ["create"] })(c, next);
10204
10296
  }
10205
10297
  return next();
10206
10298
  });
10207
- app20.use("/:id", async (c, next) => {
10299
+ app21.use("/:id", async (c, next) => {
10208
10300
  if (c.req.method === "PUT") {
10209
10301
  return requirePermission({ sub_agent: ["update"] })(c, next);
10210
10302
  }
@@ -10213,7 +10305,7 @@ app20.use("/:id", async (c, next) => {
10213
10305
  }
10214
10306
  return next();
10215
10307
  });
10216
- app20.openapi(
10308
+ app21.openapi(
10217
10309
  createRoute({
10218
10310
  method: "get",
10219
10311
  path: "/",
@@ -10275,7 +10367,7 @@ app20.openapi(
10275
10367
  return c.json(result);
10276
10368
  }
10277
10369
  );
10278
- app20.openapi(
10370
+ app21.openapi(
10279
10371
  createRoute({
10280
10372
  method: "get",
10281
10373
  path: "/{id}",
@@ -10312,7 +10404,7 @@ app20.openapi(
10312
10404
  return c.json({ data: agentToolRelation });
10313
10405
  }
10314
10406
  );
10315
- app20.openapi(
10407
+ app21.openapi(
10316
10408
  createRoute({
10317
10409
  method: "get",
10318
10410
  path: "/tool/{toolId}/sub-agents",
@@ -10348,7 +10440,7 @@ app20.openapi(
10348
10440
  return c.json(dbResult);
10349
10441
  }
10350
10442
  );
10351
- app20.openapi(
10443
+ app21.openapi(
10352
10444
  createRoute({
10353
10445
  method: "post",
10354
10446
  path: "/",
@@ -10411,7 +10503,7 @@ app20.openapi(
10411
10503
  }
10412
10504
  }
10413
10505
  );
10414
- app20.openapi(
10506
+ app21.openapi(
10415
10507
  createRoute({
10416
10508
  method: "put",
10417
10509
  path: "/{id}",
@@ -10463,7 +10555,7 @@ app20.openapi(
10463
10555
  return c.json({ data: updatedAgentToolRelation });
10464
10556
  }
10465
10557
  );
10466
- app20.openapi(
10558
+ app21.openapi(
10467
10559
  createRoute({
10468
10560
  method: "delete",
10469
10561
  path: "/{id}",
@@ -10502,12 +10594,12 @@ app20.openapi(
10502
10594
  return c.body(null, 204);
10503
10595
  }
10504
10596
  );
10505
- var subAgentToolRelations_default = app20;
10506
- var app21 = new OpenAPIHono();
10597
+ var subAgentToolRelations_default = app21;
10598
+ var app22 = new OpenAPIHono();
10507
10599
  var ThirdPartyMCPServerBodySchema = z.object({
10508
10600
  url: z.url().describe("The MCP server URL to fetch details for")
10509
10601
  });
10510
- app21.openapi(
10602
+ app22.openapi(
10511
10603
  createRoute({
10512
10604
  method: "post",
10513
10605
  path: "/",
@@ -10546,10 +10638,10 @@ app21.openapi(
10546
10638
  });
10547
10639
  }
10548
10640
  );
10549
- var thirdPartyMCPServers_default = app21;
10641
+ var thirdPartyMCPServers_default = app22;
10550
10642
  var logger5 = getLogger("tools");
10551
- var app22 = new OpenAPIHono();
10552
- app22.use("/", async (c, next) => {
10643
+ var app23 = new OpenAPIHono();
10644
+ app23.use("/", async (c, next) => {
10553
10645
  if (c.req.method === "POST") {
10554
10646
  return requirePermission({ tool: ["create"] })(
10555
10647
  c,
@@ -10558,7 +10650,7 @@ app22.use("/", async (c, next) => {
10558
10650
  }
10559
10651
  return next();
10560
10652
  });
10561
- app22.use("/:id", async (c, next) => {
10653
+ app23.use("/:id", async (c, next) => {
10562
10654
  if (c.req.method === "PUT") {
10563
10655
  return requirePermission({ tool: ["update"] })(
10564
10656
  c,
@@ -10573,7 +10665,7 @@ app22.use("/:id", async (c, next) => {
10573
10665
  }
10574
10666
  return next();
10575
10667
  });
10576
- app22.openapi(
10668
+ app23.openapi(
10577
10669
  createRoute({
10578
10670
  method: "get",
10579
10671
  path: "/",
@@ -10633,7 +10725,7 @@ app22.openapi(
10633
10725
  return c.json(result);
10634
10726
  }
10635
10727
  );
10636
- app22.openapi(
10728
+ app23.openapi(
10637
10729
  createRoute({
10638
10730
  method: "get",
10639
10731
  path: "/{id}",
@@ -10670,7 +10762,7 @@ app22.openapi(
10670
10762
  });
10671
10763
  }
10672
10764
  );
10673
- app22.openapi(
10765
+ app23.openapi(
10674
10766
  createRoute({
10675
10767
  method: "post",
10676
10768
  path: "/",
@@ -10723,7 +10815,7 @@ app22.openapi(
10723
10815
  );
10724
10816
  }
10725
10817
  );
10726
- app22.openapi(
10818
+ app23.openapi(
10727
10819
  createRoute({
10728
10820
  method: "put",
10729
10821
  path: "/{id}",
@@ -10784,7 +10876,7 @@ app22.openapi(
10784
10876
  });
10785
10877
  }
10786
10878
  );
10787
- app22.openapi(
10879
+ app23.openapi(
10788
10880
  createRoute({
10789
10881
  method: "delete",
10790
10882
  path: "/{id}",
@@ -10813,48 +10905,49 @@ app22.openapi(
10813
10905
  return c.body(null, 204);
10814
10906
  }
10815
10907
  );
10816
- var tools_default = app22;
10908
+ var tools_default = app23;
10817
10909
 
10818
10910
  // src/routes/index.ts
10819
- var app23 = new OpenAPIHono();
10820
- app23.route("/projects", projects_default);
10821
- app23.route("/projects/:projectId/agents/:agentId/sub-agents", subAgents_default);
10822
- app23.route("/projects/:projectId/agents/:agentId/sub-agent-relations", subAgentRelations_default);
10823
- app23.route(
10911
+ var app24 = new OpenAPIHono();
10912
+ app24.route("/projects", projects_default);
10913
+ app24.route("/projects/:projectId/agents/:agentId/sub-agents", subAgents_default);
10914
+ app24.route("/projects/:projectId/agents/:agentId/sub-agent-relations", subAgentRelations_default);
10915
+ app24.route(
10824
10916
  "/projects/:projectId/agents/:agentId/sub-agents/:subAgentId/external-agent-relations",
10825
10917
  subAgentExternalAgentRelations_default
10826
10918
  );
10827
- app23.route(
10919
+ app24.route(
10828
10920
  "/projects/:projectId/agents/:agentId/sub-agents/:subAgentId/team-agent-relations",
10829
10921
  subAgentTeamAgentRelations_default
10830
10922
  );
10831
- app23.route("/projects/:projectId/agents", agent_default);
10832
- app23.route(
10923
+ app24.route("/projects/:projectId/agents", agent_default);
10924
+ app24.route(
10833
10925
  "/projects/:projectId/agents/:agentId/sub-agent-tool-relations",
10834
10926
  subAgentToolRelations_default
10835
10927
  );
10836
- app23.route(
10928
+ app24.route(
10837
10929
  "/projects/:projectId/agents/:agentId/sub-agent-artifact-components",
10838
10930
  subAgentArtifactComponents_default
10839
10931
  );
10840
- app23.route(
10932
+ app24.route(
10841
10933
  "/projects/:projectId/agents/:agentId/sub-agent-data-components",
10842
10934
  subAgentDataComponents_default
10843
10935
  );
10844
- app23.route("/projects/:projectId/artifact-components", artifactComponents_default);
10845
- app23.route("/projects/:projectId/agents/:agentId/context-configs", contextConfigs_default);
10846
- app23.route("/projects/:projectId/credentials", credentials_default);
10847
- app23.route("/projects/:projectId/credential-stores", credentialStores_default);
10848
- app23.route("/projects/:projectId/data-components", dataComponents_default);
10849
- app23.route("/projects/:projectId/external-agents", externalAgents_default);
10850
- app23.route("/projects/:projectId/agents/:agentId/function-tools", functionTools_default);
10851
- app23.route("/projects/:projectId/functions", functions_default);
10852
- app23.route("/projects/:projectId/tools", tools_default);
10853
- app23.route("/projects/:projectId/api-keys", apiKeys_default);
10854
- app23.route("/projects/:projectId/agent", agentFull_default);
10855
- app23.route("/projects/:projectId/mcp-catalog", mcpCatalog_default);
10856
- app23.route("/projects/:projectId/third-party-mcp-servers", thirdPartyMCPServers_default);
10857
- var routes_default = app23;
10936
+ app24.route("/projects/:projectId/artifact-components", artifactComponents_default);
10937
+ app24.route("/projects/:projectId/agents/:agentId/context-configs", contextConfigs_default);
10938
+ app24.route("/projects/:projectId/conversations", conversations_default);
10939
+ app24.route("/projects/:projectId/credentials", credentials_default);
10940
+ app24.route("/projects/:projectId/credential-stores", credentialStores_default);
10941
+ app24.route("/projects/:projectId/data-components", dataComponents_default);
10942
+ app24.route("/projects/:projectId/external-agents", externalAgents_default);
10943
+ app24.route("/projects/:projectId/agents/:agentId/function-tools", functionTools_default);
10944
+ app24.route("/projects/:projectId/functions", functions_default);
10945
+ app24.route("/projects/:projectId/tools", tools_default);
10946
+ app24.route("/projects/:projectId/api-keys", apiKeys_default);
10947
+ app24.route("/projects/:projectId/agent", agentFull_default);
10948
+ app24.route("/projects/:projectId/mcp-catalog", mcpCatalog_default);
10949
+ app24.route("/projects/:projectId/third-party-mcp-servers", thirdPartyMCPServers_default);
10950
+ var routes_default = app24;
10858
10951
  var invitationsRoutes = new OpenAPIHono();
10859
10952
  var PendingInvitationSchema = z$1.object({
10860
10953
  id: z$1.string(),
@@ -10902,6 +10995,17 @@ invitationsRoutes.openapi(
10902
10995
  }
10903
10996
  );
10904
10997
  var invitations_default = invitationsRoutes;
10998
+ var app25 = new Hono();
10999
+ app25.all("/", async (c) => {
11000
+ const transport = new StreamableHTTPTransport();
11001
+ const noOpLogger = createConsoleLogger("error");
11002
+ const mcpServer = createMCPServer({
11003
+ logger: noOpLogger
11004
+ });
11005
+ await mcpServer.connect(transport);
11006
+ return transport.handleRequest(c);
11007
+ });
11008
+ var mcp_default = app25;
10905
11009
  var logger6 = getLogger("oauth-service");
10906
11010
  var pkceStore = /* @__PURE__ */ new Map();
10907
11011
  function storePKCEVerifier(state, codeVerifier, toolId, tenantId, projectId, clientInformation, metadata2, resourceUrl) {
@@ -11039,7 +11143,7 @@ async function findOrCreateCredential(tenantId, projectId, credentialData) {
11039
11143
  throw new Error(`Failed to save credential '${credentialData.id}' to database`);
11040
11144
  }
11041
11145
  }
11042
- var app24 = new OpenAPIHono();
11146
+ var app26 = new OpenAPIHono();
11043
11147
  var logger7 = getLogger("oauth-callback");
11044
11148
  function getBaseUrlFromRequest(c) {
11045
11149
  const url = new URL(c.req.url);
@@ -11115,7 +11219,7 @@ function generateOAuthCallbackPage(params) {
11115
11219
  </html>
11116
11220
  `;
11117
11221
  }
11118
- app24.openapi(
11222
+ app26.openapi(
11119
11223
  createRoute({
11120
11224
  method: "get",
11121
11225
  path: "/login",
@@ -11180,7 +11284,7 @@ app24.openapi(
11180
11284
  }
11181
11285
  }
11182
11286
  );
11183
- app24.openapi(
11287
+ app26.openapi(
11184
11288
  createRoute({
11185
11289
  method: "get",
11186
11290
  path: "/callback",
@@ -11323,10 +11427,10 @@ app24.openapi(
11323
11427
  }
11324
11428
  }
11325
11429
  );
11326
- var oauth_default = app24;
11430
+ var oauth_default = app26;
11327
11431
  var logger8 = getLogger("playgroundToken");
11328
- var app25 = new OpenAPIHono();
11329
- app25.use("/", requirePermission({ agent: ["create"] }));
11432
+ var app27 = new OpenAPIHono();
11433
+ app27.use("/", requirePermission({ agent: ["create"] }));
11330
11434
  var PlaygroundTokenRequestSchema = z$1.object({
11331
11435
  projectId: z$1.string(),
11332
11436
  agentId: z$1.string()
@@ -11335,7 +11439,7 @@ var PlaygroundTokenResponseSchema = z$1.object({
11335
11439
  apiKey: z$1.string().describe("Temporary API key for playground use"),
11336
11440
  expiresAt: z$1.string().describe("ISO 8601 timestamp when the key expires")
11337
11441
  });
11338
- app25.openapi(
11442
+ app27.openapi(
11339
11443
  createRoute({
11340
11444
  method: "post",
11341
11445
  path: "/",
@@ -11426,16 +11530,16 @@ app25.openapi(
11426
11530
  );
11427
11531
  }
11428
11532
  );
11429
- var playgroundToken_default = app25;
11533
+ var playgroundToken_default = app27;
11430
11534
  var logger9 = getLogger("projectFull");
11431
- var app26 = new OpenAPIHono();
11432
- app26.use("/project-full", async (c, next) => {
11535
+ var app28 = new OpenAPIHono();
11536
+ app28.use("/project-full", async (c, next) => {
11433
11537
  if (c.req.method === "POST") {
11434
11538
  return requirePermission({ project: ["create"] })(c, next);
11435
11539
  }
11436
11540
  return next();
11437
11541
  });
11438
- app26.use("/project-full/:projectId", async (c, next) => {
11542
+ app28.use("/project-full/:projectId", async (c, next) => {
11439
11543
  if (c.req.method === "PUT") {
11440
11544
  return requirePermission({ project: ["update"] })(c, next);
11441
11545
  }
@@ -11444,7 +11548,7 @@ app26.use("/project-full/:projectId", async (c, next) => {
11444
11548
  }
11445
11549
  return next();
11446
11550
  });
11447
- app26.openapi(
11551
+ app28.openapi(
11448
11552
  createRoute({
11449
11553
  method: "post",
11450
11554
  path: "/project-full",
@@ -11504,7 +11608,7 @@ app26.openapi(
11504
11608
  }
11505
11609
  }
11506
11610
  );
11507
- app26.openapi(
11611
+ app28.openapi(
11508
11612
  createRoute({
11509
11613
  method: "get",
11510
11614
  path: "/project-full/{projectId}",
@@ -11557,7 +11661,7 @@ app26.openapi(
11557
11661
  }
11558
11662
  }
11559
11663
  );
11560
- app26.openapi(
11664
+ app28.openapi(
11561
11665
  createRoute({
11562
11666
  method: "put",
11563
11667
  path: "/project-full/{projectId}",
@@ -11641,7 +11745,7 @@ app26.openapi(
11641
11745
  }
11642
11746
  }
11643
11747
  );
11644
- app26.openapi(
11748
+ app28.openapi(
11645
11749
  createRoute({
11646
11750
  method: "delete",
11647
11751
  path: "/project-full/{projectId}",
@@ -11689,7 +11793,7 @@ app26.openapi(
11689
11793
  }
11690
11794
  }
11691
11795
  );
11692
- var projectFull_default = app26;
11796
+ var projectFull_default = app28;
11693
11797
  var userOrganizationsRoutes = new OpenAPIHono();
11694
11798
  userOrganizationsRoutes.openapi(
11695
11799
  createRoute({
@@ -11784,15 +11888,15 @@ function isOriginAllowed(origin) {
11784
11888
  }
11785
11889
  }
11786
11890
  function createManagementHono(serverConfig, credentialStores, auth) {
11787
- const app27 = new OpenAPIHono();
11788
- app27.use("*", requestId());
11789
- app27.use("*", async (c, next) => {
11891
+ const app29 = new OpenAPIHono();
11892
+ app29.use("*", requestId());
11893
+ app29.use("*", async (c, next) => {
11790
11894
  c.set("serverConfig", serverConfig);
11791
11895
  c.set("credentialStores", credentialStores);
11792
11896
  c.set("auth", auth);
11793
11897
  return next();
11794
11898
  });
11795
- app27.use(
11899
+ app29.use(
11796
11900
  pinoLogger({
11797
11901
  pino: getLogger("agents-manage-api").getPinoInstance(),
11798
11902
  http: {
@@ -11805,7 +11909,7 @@ function createManagementHono(serverConfig, credentialStores, auth) {
11805
11909
  }
11806
11910
  })
11807
11911
  );
11808
- app27.onError(async (err2, c) => {
11912
+ app29.onError(async (err2, c) => {
11809
11913
  const isExpectedError = err2 instanceof HTTPException;
11810
11914
  const status = isExpectedError ? err2.status : 500;
11811
11915
  const requestId2 = c.get("requestId") || "unknown";
@@ -11875,7 +11979,7 @@ function createManagementHono(serverConfig, credentialStores, auth) {
11875
11979
  return c.body(JSON.stringify(responseBody));
11876
11980
  });
11877
11981
  if (auth) {
11878
- app27.use(
11982
+ app29.use(
11879
11983
  "/api/auth/*",
11880
11984
  cors({
11881
11985
  origin: (origin) => {
@@ -11888,11 +11992,11 @@ function createManagementHono(serverConfig, credentialStores, auth) {
11888
11992
  credentials: true
11889
11993
  })
11890
11994
  );
11891
- app27.on(["POST", "GET"], "/api/auth/*", (c) => {
11995
+ app29.on(["POST", "GET", "OPTIONS"], "/api/auth/*", (c) => {
11892
11996
  return auth.handler(c.req.raw);
11893
11997
  });
11894
11998
  }
11895
- app27.use(
11999
+ app29.use(
11896
12000
  "/tenants/*/playground/token",
11897
12001
  cors({
11898
12002
  origin: (origin) => {
@@ -11905,7 +12009,7 @@ function createManagementHono(serverConfig, credentialStores, auth) {
11905
12009
  credentials: true
11906
12010
  })
11907
12011
  );
11908
- app27.use("*", async (c, next) => {
12012
+ app29.use("*", async (c, next) => {
11909
12013
  if (auth && c.req.path.startsWith("/api/auth/")) {
11910
12014
  return next();
11911
12015
  }
@@ -11923,7 +12027,7 @@ function createManagementHono(serverConfig, credentialStores, auth) {
11923
12027
  credentials: true
11924
12028
  })(c, next);
11925
12029
  });
11926
- app27.use("*", async (c, next) => {
12030
+ app29.use("*", async (c, next) => {
11927
12031
  if (env.DISABLE_AUTH || !auth) {
11928
12032
  c.set("user", null);
11929
12033
  c.set("session", null);
@@ -11941,7 +12045,7 @@ function createManagementHono(serverConfig, credentialStores, auth) {
11941
12045
  c.set("session", session.session);
11942
12046
  await next();
11943
12047
  });
11944
- app27.openapi(
12048
+ app29.openapi(
11945
12049
  createRoute({
11946
12050
  method: "get",
11947
12051
  path: "/health",
@@ -11958,7 +12062,7 @@ function createManagementHono(serverConfig, credentialStores, auth) {
11958
12062
  return c.body(null, 204);
11959
12063
  }
11960
12064
  );
11961
- app27.use("/tenants/*", async (c, next) => {
12065
+ app29.use("/tenants/*", async (c, next) => {
11962
12066
  const isTestEnvironment = process.env.ENVIRONMENT === "test";
11963
12067
  if (env.DISABLE_AUTH || isTestEnvironment) {
11964
12068
  await next();
@@ -11972,17 +12076,18 @@ function createManagementHono(serverConfig, credentialStores, auth) {
11972
12076
  });
11973
12077
  const isTestEnv = process.env.ENVIRONMENT === "test";
11974
12078
  if (!env.DISABLE_AUTH && !isTestEnv) {
11975
- app27.use("/tenants/:tenantId/*", requireTenantAccess());
11976
- }
11977
- app27.route("/api/users/:userId/organizations", userOrganizations_default);
11978
- app27.route("/api/invitations", invitations_default);
11979
- app27.route("/tenants/:tenantId", routes_default);
11980
- app27.route("/tenants/:tenantId/playground/token", playgroundToken_default);
11981
- app27.route("/tenants/:tenantId", projectFull_default);
11982
- app27.route("/oauth", oauth_default);
11983
- setupOpenAPIRoutes(app27);
12079
+ app29.use("/tenants/:tenantId/*", requireTenantAccess());
12080
+ }
12081
+ app29.route("/api/users/:userId/organizations", userOrganizations_default);
12082
+ app29.route("/api/invitations", invitations_default);
12083
+ app29.route("/tenants/:tenantId", routes_default);
12084
+ app29.route("/tenants/:tenantId/playground/token", playgroundToken_default);
12085
+ app29.route("/tenants/:tenantId", projectFull_default);
12086
+ app29.route("/oauth", oauth_default);
12087
+ app29.route("/mcp", mcp_default);
12088
+ setupOpenAPIRoutes(app29);
11984
12089
  const baseApp = new Hono();
11985
- baseApp.route("/", app27);
12090
+ baseApp.route("/", app29);
11986
12091
  return baseApp;
11987
12092
  }
11988
12093
  var logger11 = getLogger("initialization");
@@ -12081,7 +12186,9 @@ async function createOIDCProvider(options) {
12081
12186
  const config = await client.discovery(issuerUrl, client.randomPKCECodeVerifier());
12082
12187
  const metadata2 = config.serverMetadata();
12083
12188
  if (!metadata2.issuer || !metadata2.authorization_endpoint || !metadata2.token_endpoint || !metadata2.userinfo_endpoint || !metadata2.jwks_uri) {
12084
- console.log("Some OIDC configuration endpoints are missing, which might cause issues with SSO");
12189
+ console.log(
12190
+ "Some OIDC configuration endpoints are missing, which might cause issues with SSO"
12191
+ );
12085
12192
  }
12086
12193
  const oidcConfig = {
12087
12194
  clientId: options.clientId,