@inkeep/agents-api 0.0.0-dev-20260127201912 → 0.0.0-dev-20260127203411

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.
@@ -11,20 +11,6 @@
11
11
  "stepId": "__builtin_response_text"
12
12
  }
13
13
  },
14
- "src/domains/evals/workflow/functions/evaluateConversation.ts": {
15
- "executeEvaluatorStep": {
16
- "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//executeEvaluatorStep"
17
- },
18
- "getConversationStep": {
19
- "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//getConversationStep"
20
- },
21
- "getEvaluatorsStep": {
22
- "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//getEvaluatorsStep"
23
- },
24
- "logStep": {
25
- "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//logStep"
26
- }
27
- },
28
14
  "src/domains/evals/workflow/functions/runDatasetItem.ts": {
29
15
  "callChatApiStep": {
30
16
  "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//callChatApiStep"
@@ -38,6 +24,20 @@
38
24
  "logStep": {
39
25
  "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//logStep"
40
26
  }
27
+ },
28
+ "src/domains/evals/workflow/functions/evaluateConversation.ts": {
29
+ "executeEvaluatorStep": {
30
+ "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//executeEvaluatorStep"
31
+ },
32
+ "getConversationStep": {
33
+ "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//getConversationStep"
34
+ },
35
+ "getEvaluatorsStep": {
36
+ "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//getEvaluatorsStep"
37
+ },
38
+ "logStep": {
39
+ "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//logStep"
40
+ }
41
41
  }
42
42
  },
43
43
  "workflows": {
@@ -1,10 +1,10 @@
1
1
  import { AppConfig } from "./types/app.js";
2
2
  import "./types/index.js";
3
3
  import { Hono } from "hono";
4
- import * as hono_types12 from "hono/types";
4
+ import * as hono_types0 from "hono/types";
5
5
 
6
6
  //#region src/createApp.d.ts
7
7
  declare const isWebhookRoute: (path: string) => boolean;
8
- declare function createAgentsHono(config: AppConfig): Hono<hono_types12.BlankEnv, hono_types12.BlankSchema, "/">;
8
+ declare function createAgentsHono(config: AppConfig): Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { createAgentsHono, isWebhookRoute };
@@ -1,6 +1,6 @@
1
- import * as _inkeep_agents_core0 from "@inkeep/agents-core";
1
+ import * as _inkeep_agents_core2 from "@inkeep/agents-core";
2
2
 
3
3
  //#region src/data/db/manageDbClient.d.ts
4
- declare const manageDbClient: _inkeep_agents_core0.AgentsManageDatabaseClient;
4
+ declare const manageDbClient: _inkeep_agents_core2.AgentsManageDatabaseClient;
5
5
  //#endregion
6
6
  export { manageDbClient as default };
@@ -1,6 +1,6 @@
1
- import * as _inkeep_agents_core2 from "@inkeep/agents-core";
1
+ import * as _inkeep_agents_core3 from "@inkeep/agents-core";
2
2
 
3
3
  //#region src/data/db/runDbClient.d.ts
4
- declare const runDbClient: _inkeep_agents_core2.AgentsRunDatabaseClient;
4
+ declare const runDbClient: _inkeep_agents_core3.AgentsRunDatabaseClient;
5
5
  //#endregion
6
6
  export { runDbClient as default };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono7 from "hono";
2
+ import * as hono18 from "hono";
3
3
 
4
4
  //#region src/domains/evals/routes/datasetTriggers.d.ts
5
- declare const app: OpenAPIHono<hono7.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono18.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono17 from "hono";
2
+ import * as hono5 from "hono";
3
3
 
4
4
  //#region src/domains/evals/routes/index.d.ts
5
- declare const app: OpenAPIHono<hono17.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono5.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types1 from "hono/types";
2
+ import * as hono_types5 from "hono/types";
3
3
 
4
4
  //#region src/domains/evals/workflow/routes.d.ts
5
- declare const workflowRoutes: Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
5
+ declare const workflowRoutes: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { workflowRoutes };
@@ -3,10 +3,10 @@ import { GenerateInstallationAccessTokenResult, GenerateTokenError, GenerateToke
3
3
  import { GetJwkResult, JwksError, JwksResult, clearJwksCache, getJwkForToken, getJwksCacheStatus } from "./jwks.js";
4
4
  import { GitHubOidcClaims, ValidateOidcTokenResult, ValidateTokenError, ValidateTokenResult, validateOidcToken } from "./oidcToken.js";
5
5
  import { Hono } from "hono";
6
- import * as hono_types14 from "hono/types";
6
+ import * as hono_types12 from "hono/types";
7
7
 
8
8
  //#region src/domains/github/index.d.ts
9
- declare function createGithubRoutes(): Hono<hono_types14.BlankEnv, hono_types14.BlankSchema, "/">;
10
- declare const githubRoutes: Hono<hono_types14.BlankEnv, hono_types14.BlankSchema, "/">;
9
+ declare function createGithubRoutes(): Hono<hono_types12.BlankEnv, hono_types12.BlankSchema, "/">;
10
+ declare const githubRoutes: Hono<hono_types12.BlankEnv, hono_types12.BlankSchema, "/">;
11
11
  //#endregion
12
12
  export { type GenerateInstallationAccessTokenResult, type GenerateTokenError, type GenerateTokenResult, type GetJwkResult, type GitHubAppConfig, type GitHubOidcClaims, type InstallationAccessToken, type InstallationInfo, type JwksError, type JwksResult, type LookupInstallationError, type LookupInstallationForRepoResult, type LookupInstallationResult, type ValidateOidcTokenResult, type ValidateTokenError, type ValidateTokenResult, clearJwksCache, createGithubRoutes, generateInstallationAccessToken, getGitHubAppConfig, getJwkForToken, getJwksCacheStatus, githubRoutes, isGitHubAppConfigured, lookupInstallationForRepo, validateOidcToken };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types3 from "hono/types";
2
+ import * as hono_types16 from "hono/types";
3
3
 
4
4
  //#region src/domains/github/routes/tokenExchange.d.ts
5
- declare const app: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types16.BlankEnv, hono_types16.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono8 from "hono";
2
+ import * as hono6 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/conversations.d.ts
5
- declare const app: OpenAPIHono<hono8.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono6.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono18 from "hono";
2
+ import * as hono12 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/evals/evaluationResults.d.ts
5
- declare const app: OpenAPIHono<hono18.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono12.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono9 from "hono";
2
+ import * as hono7 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/index.d.ts
5
- declare const app: OpenAPIHono<hono9.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono7.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types7 from "hono/types";
2
+ import * as hono_types9 from "hono/types";
3
3
 
4
4
  //#region src/domains/manage/routes/mcp.d.ts
5
- declare const app: Hono<hono_types7.BlankEnv, hono_types7.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types9.BlankEnv, hono_types9.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types5 from "hono/types";
2
+ import * as hono_types7 from "hono/types";
3
3
 
4
4
  //#region src/domains/mcp/routes/mcp.d.ts
5
- declare const app: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types7.BlankEnv, hono_types7.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,4 +1,4 @@
1
- import * as _inkeep_agents_core3 from "@inkeep/agents-core";
1
+ import * as _inkeep_agents_core1 from "@inkeep/agents-core";
2
2
  import { BreakdownComponentDef, ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown } from "@inkeep/agents-core";
3
3
 
4
4
  //#region src/domains/run/utils/token-estimator.d.ts
@@ -17,7 +17,7 @@ interface AssembleResult {
17
17
  /** The assembled prompt string */
18
18
  prompt: string;
19
19
  /** Token breakdown for each component */
20
- breakdown: _inkeep_agents_core3.ContextBreakdown;
20
+ breakdown: _inkeep_agents_core1.ContextBreakdown;
21
21
  }
22
22
  //#endregion
23
23
  export { AssembleResult, type BreakdownComponentDef, type ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown, estimateTokens };
package/dist/factory.d.ts CHANGED
@@ -3,11 +3,11 @@ import "./types/index.js";
3
3
  import { createAgentsHono } from "./createApp.js";
4
4
  import { initializeDefaultUser } from "./initialization.js";
5
5
  import { createAuth0Provider, createOIDCProvider } from "./ssoHelpers.js";
6
- import * as hono11 from "hono";
6
+ import * as hono1 from "hono";
7
7
  import { CredentialStore, ServerConfig } from "@inkeep/agents-core";
8
8
  import * as zod205 from "zod";
9
9
  import { SSOProviderConfig, UserAuthConfig } from "@inkeep/agents-core/auth";
10
- import * as hono_types9 from "hono/types";
10
+ import * as hono_types3 from "hono/types";
11
11
  import * as better_auth78 from "better-auth";
12
12
  import * as better_auth_plugins69 from "better-auth/plugins";
13
13
  import * as _better_auth_sso10 from "@better-auth/sso";
@@ -1536,6 +1536,6 @@ declare function createAgentsApp(config?: {
1536
1536
  auth?: UserAuthConfig;
1537
1537
  sandboxConfig?: SandboxConfig;
1538
1538
  skipInitialization?: boolean;
1539
- }): hono11.Hono<hono_types9.BlankEnv, hono_types9.BlankSchema, "/">;
1539
+ }): hono1.Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
1540
1540
  //#endregion
1541
1541
  export { type SSOProviderConfig, type UserAuthConfig, createAgentsApp, createAgentsAuth, createAgentsHono, createAuth0Provider, createOIDCProvider, initializeDefaultUser };
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import { createAuth0Provider, createOIDCProvider } from "./ssoHelpers.js";
8
8
  import { SSOProviderConfig, UserAuthConfig, createAgentsApp } from "./factory.js";
9
9
  import { Hono } from "hono";
10
10
  import * as zod0 from "zod";
11
- import * as hono_types0 from "hono/types";
11
+ import * as hono_types1 from "hono/types";
12
12
  import * as better_auth0 from "better-auth";
13
13
  import * as better_auth_plugins0 from "better-auth/plugins";
14
14
  import * as _better_auth_sso0 from "@better-auth/sso";
@@ -1531,6 +1531,6 @@ declare const auth: better_auth0.Auth<{
1531
1531
  }>;
1532
1532
  }];
1533
1533
  }> | null;
1534
- declare const app: Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
1534
+ declare const app: Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
1535
1535
  //#endregion
1536
1536
  export { type AppConfig, type AppVariables, Hono, type NativeSandboxConfig, type SSOProviderConfig, type SandboxConfig, type UserAuthConfig, type VercelSandboxConfig, auth, createAgentsApp, createAgentsHono, createAuth0Provider, createOIDCProvider, app as default, initializeDefaultUser };
@@ -1,4 +1,4 @@
1
- import * as hono12 from "hono";
1
+ import * as hono17 from "hono";
2
2
  import { BaseExecutionContext } from "@inkeep/agents-core";
3
3
 
4
4
  //#region src/middleware/evalsAuth.d.ts
@@ -7,7 +7,7 @@ import { BaseExecutionContext } from "@inkeep/agents-core";
7
7
  * Middleware to authenticate API requests using Bearer token authentication
8
8
  * First checks if token matches INKEEP_AGENTS_EVAL_API_BYPASS_SECRET,
9
9
  */
10
- declare const evalApiKeyAuth: () => hono12.MiddlewareHandler<{
10
+ declare const evalApiKeyAuth: () => hono17.MiddlewareHandler<{
11
11
  Variables: {
12
12
  executionContext: BaseExecutionContext;
13
13
  };
@@ -1,4 +1,4 @@
1
- import * as hono10 from "hono";
1
+ import * as hono8 from "hono";
2
2
  import { BaseExecutionContext } from "@inkeep/agents-core";
3
3
  import { createAuth } from "@inkeep/agents-core/auth";
4
4
 
@@ -12,7 +12,7 @@ import { createAuth } from "@inkeep/agents-core/auth";
12
12
  * 3. Database API key
13
13
  * 4. Internal service token
14
14
  */
15
- declare const manageApiKeyAuth: () => hono10.MiddlewareHandler<{
15
+ declare const manageApiKeyAuth: () => hono8.MiddlewareHandler<{
16
16
  Variables: {
17
17
  executionContext: BaseExecutionContext;
18
18
  userId?: string;
@@ -1,5 +1,5 @@
1
1
  import { ManageAppVariables } from "../types/app.js";
2
- import * as hono1 from "hono";
2
+ import * as hono0 from "hono";
3
3
  import { ProjectPermissionLevel } from "@inkeep/agents-core";
4
4
 
5
5
  //#region src/middleware/projectAccess.d.ts
@@ -19,6 +19,6 @@ declare const requireProjectPermission: <Env$1 extends {
19
19
  Variables: ManageAppVariables;
20
20
  } = {
21
21
  Variables: ManageAppVariables;
22
- }>(permission?: ProjectPermissionLevel) => hono1.MiddlewareHandler<Env$1, string, {}, Response>;
22
+ }>(permission?: ProjectPermissionLevel) => hono0.MiddlewareHandler<Env$1, string, {}, Response>;
23
23
  //#endregion
24
24
  export { requireProjectPermission };
@@ -1,5 +1,5 @@
1
1
  import { ManageAppVariables } from "../types/app.js";
2
- import * as hono13 from "hono";
2
+ import * as hono2 from "hono";
3
3
 
4
4
  //#region src/middleware/requirePermission.d.ts
5
5
  type Permission = {
@@ -9,6 +9,6 @@ declare const requirePermission: <Env$1 extends {
9
9
  Variables: ManageAppVariables;
10
10
  } = {
11
11
  Variables: ManageAppVariables;
12
- }>(permissions: Permission) => hono13.MiddlewareHandler<Env$1, string, {}, Response>;
12
+ }>(permissions: Permission) => hono2.MiddlewareHandler<Env$1, string, {}, Response>;
13
13
  //#endregion
14
14
  export { requirePermission };
@@ -1,8 +1,8 @@
1
- import * as hono14 from "hono";
1
+ import * as hono9 from "hono";
2
2
  import { BaseExecutionContext } from "@inkeep/agents-core";
3
3
 
4
4
  //#region src/middleware/runAuth.d.ts
5
- declare const runApiKeyAuth: () => hono14.MiddlewareHandler<{
5
+ declare const runApiKeyAuth: () => hono9.MiddlewareHandler<{
6
6
  Variables: {
7
7
  executionContext: BaseExecutionContext;
8
8
  };
@@ -11,7 +11,7 @@ declare const runApiKeyAuth: () => hono14.MiddlewareHandler<{
11
11
  * Creates a middleware that applies API key authentication except for specified route patterns
12
12
  * @param skipRouteCheck - Function that returns true if the route should skip authentication
13
13
  */
14
- declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) => hono14.MiddlewareHandler<{
14
+ declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) => hono9.MiddlewareHandler<{
15
15
  Variables: {
16
16
  executionContext: BaseExecutionContext;
17
17
  };
@@ -20,7 +20,7 @@ declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) =
20
20
  * Helper middleware for endpoints that optionally support API key authentication
21
21
  * If no auth header is present, it continues without setting the executionContext
22
22
  */
23
- declare const runOptionalAuth: () => hono14.MiddlewareHandler<{
23
+ declare const runOptionalAuth: () => hono9.MiddlewareHandler<{
24
24
  Variables: {
25
25
  executionContext?: BaseExecutionContext;
26
26
  };
@@ -1,4 +1,4 @@
1
- import * as hono0 from "hono";
1
+ import * as hono13 from "hono";
2
2
 
3
3
  //#region src/middleware/sessionAuth.d.ts
4
4
 
@@ -7,11 +7,11 @@ import * as hono0 from "hono";
7
7
  * Requires that a user has already been authenticated via Better Auth session.
8
8
  * Used primarily for manage routes that require an active user session.
9
9
  */
10
- declare const sessionAuth: () => hono0.MiddlewareHandler<any, string, {}, Response>;
10
+ declare const sessionAuth: () => hono13.MiddlewareHandler<any, string, {}, Response>;
11
11
  /**
12
12
  * Global session middleware - sets user and session in context for all routes
13
13
  * Used for all routes that require an active user session.
14
14
  */
15
- declare const sessionContext: () => hono0.MiddlewareHandler<any, string, {}, Response>;
15
+ declare const sessionContext: () => hono13.MiddlewareHandler<any, string, {}, Response>;
16
16
  //#endregion
17
17
  export { sessionAuth, sessionContext };
@@ -1,4 +1,4 @@
1
- import * as hono2 from "hono";
1
+ import * as hono0 from "hono";
2
2
 
3
3
  //#region src/middleware/tenantAccess.d.ts
4
4
 
@@ -11,7 +11,7 @@ import * as hono2 from "hono";
11
11
  * - API key user: Access only to the tenant associated with the API key
12
12
  * - Session user: Access based on organization membership
13
13
  */
14
- declare const requireTenantAccess: () => hono2.MiddlewareHandler<{
14
+ declare const requireTenantAccess: () => hono0.MiddlewareHandler<{
15
15
  Variables: {
16
16
  userId: string;
17
17
  tenantId: string;
@@ -1,7 +1,7 @@
1
- import * as hono5 from "hono";
1
+ import * as hono15 from "hono";
2
2
 
3
3
  //#region src/middleware/tracing.d.ts
4
- declare const otelBaggageMiddleware: () => hono5.MiddlewareHandler<any, string, {}, Response>;
5
- declare const executionBaggageMiddleware: () => hono5.MiddlewareHandler<any, string, {}, Response>;
4
+ declare const otelBaggageMiddleware: () => hono15.MiddlewareHandler<any, string, {}, Response>;
5
+ declare const executionBaggageMiddleware: () => hono15.MiddlewareHandler<any, string, {}, Response>;
6
6
  //#endregion
7
7
  export { executionBaggageMiddleware, otelBaggageMiddleware };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-api",
3
- "version": "0.0.0-dev-20260127201912",
3
+ "version": "0.0.0-dev-20260127203411",
4
4
  "description": "Unified Inkeep Agents API - combines management, runtime, and evaluation capabilities",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -72,9 +72,9 @@
72
72
  "openid-client": "^6.8.1",
73
73
  "pg": "^8.16.3",
74
74
  "workflow": "4.0.1-beta.33",
75
- "@inkeep/agents-core": "^0.0.0-dev-20260127201912",
76
- "@inkeep/agents-manage-mcp": "^0.0.0-dev-20260127201912",
77
- "@inkeep/agents-mcp": "^0.0.0-dev-20260127201912"
75
+ "@inkeep/agents-core": "^0.0.0-dev-20260127203411",
76
+ "@inkeep/agents-manage-mcp": "^0.0.0-dev-20260127203411",
77
+ "@inkeep/agents-mcp": "^0.0.0-dev-20260127203411"
78
78
  },
79
79
  "peerDependencies": {
80
80
  "@hono/zod-openapi": "^1.1.5",
@@ -1,9 +0,0 @@
1
- import { ManageAppVariables } from "../../../types/app.js";
2
- import { OpenAPIHono } from "@hono/zod-openapi";
3
-
4
- //#region src/domains/manage/routes/agentToolRelations.d.ts
5
- declare const app: OpenAPIHono<{
6
- Variables: ManageAppVariables;
7
- }, {}, "/">;
8
- //#endregion
9
- export { app as default };
@@ -1,292 +0,0 @@
1
- import { requireProjectPermission } from "../../../middleware/projectAccess.js";
2
- import { speakeasyOffsetLimitPagination } from "../../../utils/speakeasy.js";
3
- import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
4
- import { ErrorResponseSchema, PaginationQueryParamsSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationListResponse, SubAgentToolRelationResponse, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, commonGetErrorResponses, createAgentToolRelation, createApiError, deleteAgentToolRelation, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsForTool, listAgentToolRelations, updateAgentToolRelation } from "@inkeep/agents-core";
5
-
6
- //#region src/domains/manage/routes/agentToolRelations.ts
7
- const app = new OpenAPIHono();
8
- app.use("/", async (c, next) => {
9
- if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
10
- return next();
11
- });
12
- app.use("/:id", async (c, next) => {
13
- if ([
14
- "PUT",
15
- "PATCH",
16
- "DELETE"
17
- ].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
18
- return next();
19
- });
20
- app.openapi(createRoute({
21
- method: "get",
22
- path: "/",
23
- summary: "List Agent Tool Relations",
24
- operationId: "list-agent-tool-relations",
25
- tags: ["Agents", "Tools"],
26
- request: {
27
- params: TenantProjectAgentParamsSchema,
28
- query: PaginationQueryParamsSchema.extend({
29
- subAgentId: z.string().optional(),
30
- toolId: z.string().optional()
31
- })
32
- },
33
- responses: {
34
- 200: {
35
- description: "List of agent tool relations retrieved successfully",
36
- content: { "application/json": { schema: SubAgentToolRelationListResponse } }
37
- },
38
- ...commonGetErrorResponses
39
- },
40
- ...speakeasyOffsetLimitPagination
41
- }), async (c) => {
42
- const db = c.get("db");
43
- const { tenantId, projectId, agentId } = c.req.valid("param");
44
- const { page, limit, subAgentId, toolId } = c.req.valid("query");
45
- let result;
46
- if (subAgentId) {
47
- const dbResult = await getAgentToolRelationByAgent(db)({
48
- scopes: {
49
- tenantId,
50
- projectId,
51
- agentId,
52
- subAgentId
53
- },
54
- pagination: {
55
- page,
56
- limit
57
- }
58
- });
59
- result = {
60
- data: dbResult.data,
61
- pagination: dbResult.pagination
62
- };
63
- } else if (toolId) {
64
- const dbResult = await getAgentToolRelationByTool(db)({
65
- scopes: {
66
- tenantId,
67
- projectId,
68
- agentId
69
- },
70
- toolId,
71
- pagination: {
72
- page,
73
- limit
74
- }
75
- });
76
- result = {
77
- data: dbResult.data,
78
- pagination: dbResult.pagination
79
- };
80
- } else {
81
- const dbResult = await listAgentToolRelations(db)({
82
- scopes: {
83
- tenantId,
84
- projectId,
85
- agentId
86
- },
87
- pagination: {
88
- page,
89
- limit
90
- }
91
- });
92
- result = {
93
- data: dbResult.data,
94
- pagination: dbResult.pagination
95
- };
96
- }
97
- return c.json(result);
98
- });
99
- app.openapi(createRoute({
100
- method: "get",
101
- path: "/{id}",
102
- summary: "Get Agent Tool Relation",
103
- operationId: "get-agent-tool-relation",
104
- tags: ["Agent", "Tools"],
105
- request: { params: TenantProjectAgentIdParamsSchema },
106
- responses: {
107
- 200: {
108
- description: "Agent tool relation found",
109
- content: { "application/json": { schema: SubAgentToolRelationResponse } }
110
- },
111
- ...commonGetErrorResponses
112
- }
113
- }), async (c) => {
114
- const db = c.get("db");
115
- const { tenantId, projectId, agentId, id } = c.req.valid("param");
116
- const agentToolRelation = await getAgentToolRelationById(db)({
117
- scopes: {
118
- tenantId,
119
- projectId,
120
- agentId,
121
- subAgentId: id
122
- },
123
- relationId: id
124
- });
125
- if (!agentToolRelation) throw createApiError({
126
- code: "not_found",
127
- message: "Agent tool relation not found"
128
- });
129
- return c.json({ data: agentToolRelation });
130
- });
131
- app.openapi(createRoute({
132
- method: "get",
133
- path: "/tool/{toolId}/agents",
134
- summary: "Get Agents for Tool",
135
- operationId: "get-agents-for-tool",
136
- tags: ["Agent", "Tools"],
137
- request: {
138
- params: TenantProjectAgentParamsSchema.extend({ toolId: z.string() }),
139
- query: PaginationQueryParamsSchema
140
- },
141
- responses: {
142
- 200: {
143
- description: "Agents for tool retrieved successfully",
144
- content: { "application/json": { schema: SubAgentToolRelationListResponse } }
145
- },
146
- ...commonGetErrorResponses
147
- }
148
- }), async (c) => {
149
- const db = c.get("db");
150
- const { tenantId, projectId, agentId, toolId } = c.req.valid("param");
151
- const { page, limit } = c.req.valid("query");
152
- const dbResult = await getAgentsForTool(db)({
153
- scopes: {
154
- tenantId,
155
- projectId,
156
- agentId
157
- },
158
- toolId,
159
- pagination: {
160
- page,
161
- limit
162
- }
163
- });
164
- return c.json(dbResult);
165
- });
166
- app.openapi(createRoute({
167
- method: "post",
168
- path: "/",
169
- summary: "Create Agent Tool Relation",
170
- operationId: "create-agent-tool-relation",
171
- tags: ["Agent", "Tools"],
172
- request: {
173
- params: TenantProjectAgentParamsSchema,
174
- body: { content: { "application/json": { schema: SubAgentToolRelationApiInsertSchema } } }
175
- },
176
- responses: {
177
- 201: {
178
- description: "Agent tool relation created successfully",
179
- content: { "application/json": { schema: SubAgentToolRelationResponse } }
180
- },
181
- ...commonGetErrorResponses
182
- }
183
- }), async (c) => {
184
- const db = c.get("db");
185
- const { tenantId, projectId, agentId } = c.req.valid("param");
186
- const body = c.req.valid("json");
187
- if ((await listAgentToolRelations(db)({
188
- scopes: {
189
- tenantId,
190
- projectId,
191
- agentId
192
- },
193
- pagination: { limit: 1e3 }
194
- })).data.some((relation) => {
195
- const typedRelation = relation;
196
- return typedRelation.subAgentId === body.subAgentId && typedRelation.toolId === body.toolId;
197
- })) throw createApiError({
198
- code: "unprocessable_entity",
199
- message: "Agent tool relation already exists"
200
- });
201
- try {
202
- const agentToolRelation = await createAgentToolRelation(db)({
203
- scopes: {
204
- tenantId,
205
- projectId,
206
- agentId
207
- },
208
- data: body
209
- });
210
- return c.json({ data: agentToolRelation }, 201);
211
- } catch (error) {
212
- if (error?.cause?.code === "23503") throw createApiError({
213
- code: "bad_request",
214
- message: "Invalid agent ID or tool ID - referenced entity does not exist"
215
- });
216
- throw error;
217
- }
218
- });
219
- app.openapi(createRoute({
220
- method: "put",
221
- path: "/{id}",
222
- summary: "Update Agent Tool Relation",
223
- operationId: "update-agent-tool-relation",
224
- tags: ["Agent", "Tools"],
225
- request: {
226
- params: TenantProjectAgentIdParamsSchema,
227
- body: { content: { "application/json": { schema: SubAgentToolRelationApiUpdateSchema } } }
228
- },
229
- responses: {
230
- 200: {
231
- description: "Agent tool relation updated successfully",
232
- content: { "application/json": { schema: SubAgentToolRelationResponse } }
233
- },
234
- ...commonGetErrorResponses
235
- }
236
- }), async (c) => {
237
- const db = c.get("db");
238
- const { tenantId, projectId, agentId, id } = c.req.valid("param");
239
- const body = await c.req.valid("json");
240
- if (Object.keys(body).length === 0) throw createApiError({
241
- code: "bad_request",
242
- message: "No fields to update"
243
- });
244
- const updatedSubAgentToolRelation = await updateAgentToolRelation(db)({
245
- scopes: {
246
- tenantId,
247
- projectId,
248
- agentId
249
- },
250
- relationId: id,
251
- data: body
252
- });
253
- if (!updatedSubAgentToolRelation) throw createApiError({
254
- code: "not_found",
255
- message: "Agent tool relation not found"
256
- });
257
- return c.json({ data: updatedSubAgentToolRelation });
258
- });
259
- app.openapi(createRoute({
260
- method: "delete",
261
- path: "/{id}",
262
- summary: "Delete Agent Tool Relation",
263
- operationId: "delete-agent-tool-relation",
264
- tags: ["Agent", "Tools"],
265
- request: { params: TenantProjectAgentIdParamsSchema },
266
- responses: {
267
- 204: { description: "Agent tool relation deleted successfully" },
268
- 404: {
269
- description: "Agent tool relation not found",
270
- content: { "application/json": { schema: ErrorResponseSchema } }
271
- }
272
- }
273
- }), async (c) => {
274
- const db = c.get("db");
275
- const { tenantId, projectId, agentId, id } = c.req.valid("param");
276
- if (!await deleteAgentToolRelation(db)({
277
- scopes: {
278
- tenantId,
279
- projectId,
280
- agentId
281
- },
282
- relationId: id
283
- })) throw createApiError({
284
- code: "not_found",
285
- message: "Agent tool relation not found"
286
- });
287
- return c.body(null, 204);
288
- });
289
- var agentToolRelations_default = app;
290
-
291
- //#endregion
292
- export { agentToolRelations_default as default };