@inkeep/agents-api 0.42.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.well-known/workflow/v1/manifest.debug.json +6 -6
- package/dist/.well-known/workflow/v1/step.cjs +220467 -203416
- package/dist/_virtual/rolldown_runtime.js +7 -0
- package/dist/createApp.js +47 -17
- package/dist/domains/evals/api/.well-known/workflow/v1/flow.d.ts +4 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/flow.js +12 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/step.d.ts +4 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/step.js +12 -0
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/evals/scripts/build-workflow.js +2 -2
- package/dist/domains/evals/workflow/world.js +3 -2
- package/dist/domains/manage/index.js +6 -2
- package/dist/domains/manage/routes/agent.js +7 -4
- package/dist/domains/manage/routes/agentFull.js +9 -6
- package/dist/domains/manage/routes/apiKeys.js +1 -2
- package/dist/domains/manage/routes/artifactComponents.js +5 -5
- package/dist/domains/manage/routes/cliAuth.js +3 -3
- package/dist/domains/manage/routes/contextConfigs.js +5 -5
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/credentialStores.js +2 -2
- package/dist/domains/manage/routes/credentials.js +6 -7
- package/dist/domains/manage/routes/dataComponents.js +6 -7
- package/dist/domains/manage/routes/externalAgents.js +1 -2
- package/dist/domains/manage/routes/github.d.ts +16 -0
- package/dist/domains/manage/routes/github.js +511 -0
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/index.js +4 -0
- package/dist/domains/manage/routes/invitations.js +1 -1
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/{agentToolRelations.d.ts → mcpToolGithubAccess.d.ts} +1 -1
- package/dist/domains/manage/routes/mcpToolGithubAccess.js +205 -0
- package/dist/domains/manage/routes/playgroundToken.js +1 -2
- package/dist/domains/manage/routes/projectFull.js +33 -11
- package/dist/domains/manage/routes/projectGithubAccess.d.ts +9 -0
- package/dist/domains/manage/routes/projectGithubAccess.js +167 -0
- package/dist/domains/manage/routes/projectMembers.js +12 -44
- package/dist/domains/manage/routes/projectPermissions.js +11 -11
- package/dist/domains/manage/routes/projects.js +15 -18
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.js +7 -4
- package/dist/domains/manage/routes/subAgentArtifactComponents.js +5 -5
- package/dist/domains/manage/routes/subAgentDataComponents.js +5 -5
- package/dist/domains/manage/routes/subAgentExternalAgentRelations.js +5 -5
- package/dist/domains/manage/routes/subAgentFunctionTools.js +5 -5
- package/dist/domains/manage/routes/subAgentRelations.js +6 -6
- package/dist/domains/manage/routes/subAgentTeamAgentRelations.js +6 -6
- package/dist/domains/manage/routes/subAgentToolRelations.js +6 -6
- package/dist/domains/manage/routes/subAgents.js +5 -5
- package/dist/domains/manage/routes/tools.js +28 -5
- package/dist/domains/manage/routes/triggers.js +49 -24
- package/dist/domains/manage/routes/userOrganizations.js +4 -4
- package/dist/domains/manage/routes/userProjectMemberships.d.ts +9 -0
- package/dist/domains/manage/routes/userProjectMemberships.js +44 -0
- package/dist/domains/mcp/routes/mcp.d.ts +7 -0
- package/dist/domains/mcp/routes/mcp.js +45 -0
- package/dist/domains/run/agents/Agent.d.ts +1 -0
- package/dist/domains/run/agents/Agent.js +235 -45
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/constants/execution-limits/defaults.d.ts +1 -1
- package/dist/domains/run/constants/execution-limits/defaults.js +1 -1
- package/dist/domains/run/constants/execution-limits/index.d.ts +1 -1
- package/dist/domains/run/context/ContextFetcher.js +8 -7
- package/dist/domains/run/context/validation.d.ts +1 -1
- package/dist/domains/run/handlers/executionHandler.js +143 -79
- package/dist/domains/run/routes/agents.js +1 -1
- package/dist/domains/run/routes/chat.js +47 -1
- package/dist/domains/run/routes/chatDataStream.js +107 -14
- package/dist/domains/run/routes/webhooks.js +40 -348
- package/dist/domains/run/services/AgentSession.d.ts +3 -0
- package/dist/domains/run/services/AgentSession.js +14 -1
- package/dist/domains/run/services/ToolApprovalUiBus.d.ts +28 -0
- package/dist/domains/run/services/ToolApprovalUiBus.js +44 -0
- package/dist/domains/run/services/TriggerService.d.ts +31 -0
- package/dist/domains/run/services/TriggerService.js +545 -0
- package/dist/domains/run/tools/NativeSandboxExecutor.d.ts +3 -2
- package/dist/domains/run/tools/NativeSandboxExecutor.js +76 -48
- package/dist/domains/run/tools/SandboxExecutorFactory.d.ts +11 -1
- package/dist/domains/run/tools/SandboxExecutorFactory.js +27 -3
- package/dist/domains/run/tools/VercelSandboxExecutor.d.ts +3 -11
- package/dist/domains/run/tools/VercelSandboxExecutor.js +137 -127
- package/dist/domains/run/tools/sandbox-utils.js +1 -1
- package/dist/domains/run/types/executionContext.js +3 -1
- package/dist/domains/run/utils/stream-helpers.d.ts +134 -0
- package/dist/domains/run/utils/stream-helpers.js +182 -0
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/env.d.ts +12 -2
- package/dist/env.js +37 -32
- package/dist/factory.d.ts +31 -31
- package/dist/factory.js +4 -10
- package/dist/index.d.ts +30 -29
- package/dist/index.js +3 -5
- package/dist/middleware/branchScopedDb.d.ts +1 -1
- package/dist/middleware/cors.js +1 -1
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectAccess.d.ts +4 -20
- package/dist/middleware/projectAccess.js +7 -49
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/ref.d.ts +1 -1
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/requirePermission.js +1 -2
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/sessionAuth.js +1 -2
- package/dist/middleware/tenantAccess.d.ts +2 -2
- package/dist/middleware/tenantAccess.js +4 -4
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/openapi.d.ts +36 -1
- package/dist/openapi.js +40 -95
- package/dist/routes/healthChecks.d.ts +10 -0
- package/dist/routes/healthChecks.js +75 -0
- package/dist/types/app.d.ts +2 -0
- package/dist/types/runExecutionContext.js +3 -1
- package/dist/utils/healthChecks.d.ts +8 -0
- package/dist/utils/healthChecks.js +38 -0
- package/dist/utils/signozHelpers.d.ts +2 -2
- package/dist/utils/signozHelpers.js +15 -3
- package/package.json +8 -9
- package/dist/domains/evals/services/startEvaluation.d.ts +0 -19
- package/dist/domains/evals/services/startEvaluation.js +0 -18
- package/dist/domains/index.d.ts +0 -4
- package/dist/domains/index.js +0 -5
- package/dist/domains/manage/routes/agentToolRelations.js +0 -289
- package/dist/domains/run/agents/ModelFactory.d.ts +0 -63
- package/dist/domains/run/agents/ModelFactory.js +0 -194
- package/dist/domains/run/data/agent.d.ts +0 -7
- package/dist/domains/run/data/agent.js +0 -67
- package/dist/domains/run/services/evaluationRunConfigMatcher.d.ts +0 -4
- package/dist/domains/run/services/evaluationRunConfigMatcher.js +0 -7
- package/dist/domains/run/utils/cleanup.d.ts +0 -21
- package/dist/domains/run/utils/cleanup.js +0 -59
- package/dist/initialization.d.ts +0 -6
- package/dist/initialization.js +0 -65
- package/dist/utils/tempApiKeys.d.ts +0 -17
- package/dist/utils/tempApiKeys.js +0 -26
- package/dist/utils/workflowApiHelpers.d.ts +0 -1
- package/dist/utils/workflowApiHelpers.js +0 -1
|
@@ -4,7 +4,7 @@ import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
|
4
4
|
import { speakeasyOffsetLimitPagination } from "../../../utils/speakeasy.js";
|
|
5
5
|
import { requirePermission } from "../../../middleware/requirePermission.js";
|
|
6
6
|
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
7
|
-
import { ErrorResponseSchema, PaginationQueryParamsSchema, ProjectApiInsertSchema, ProjectApiUpdateSchema, ProjectListResponse, ProjectResponse, TenantIdParamsSchema, TenantParamsSchema, cascadeDeleteByProject, commonGetErrorResponses, createApiError, createProject, createProjectMetadataAndBranch, deleteProject, deleteProjectWithBranch, doltCheckout, getProject, getProjectMainBranchName,
|
|
7
|
+
import { ErrorResponseSchema, PaginationQueryParamsSchema, ProjectApiInsertSchema, ProjectApiUpdateSchema, ProjectListResponse, ProjectResponse, TenantIdParamsSchema, TenantParamsSchema, cascadeDeleteByProject, commonGetErrorResponses, createApiError, createProject, createProjectMetadataAndBranch, deleteProject, deleteProjectWithBranch, doltCheckout, getProject, getProjectMainBranchName, listAccessibleProjectIds, listProjectsWithMetadataPaginated, removeProjectFromSpiceDb, syncProjectToSpiceDb, updateProject } from "@inkeep/agents-core";
|
|
8
8
|
|
|
9
9
|
//#region src/domains/manage/routes/projects.ts
|
|
10
10
|
const app = new OpenAPIHono();
|
|
@@ -15,7 +15,7 @@ app.use("/", async (c, next) => {
|
|
|
15
15
|
app.use("/:id", async (c, next) => {
|
|
16
16
|
if (c.req.method === "GET") return requireProjectPermission("view")(c, next);
|
|
17
17
|
if (c.req.method === "PATCH") return requireProjectPermission("edit")(c, next);
|
|
18
|
-
if (c.req.method === "DELETE") return
|
|
18
|
+
if (c.req.method === "DELETE") return requirePermission({ project: ["delete"] })(c, next);
|
|
19
19
|
return next();
|
|
20
20
|
});
|
|
21
21
|
app.openapi(createRoute({
|
|
@@ -45,9 +45,8 @@ app.openapi(createRoute({
|
|
|
45
45
|
const page = Number(c.req.query("page")) || 1;
|
|
46
46
|
const limit = Math.min(Number(c.req.query("limit")) || 10, 100);
|
|
47
47
|
let accessibleIds;
|
|
48
|
-
if (
|
|
48
|
+
if (userId) {
|
|
49
49
|
const result$1 = await listAccessibleProjectIds({
|
|
50
|
-
tenantId,
|
|
51
50
|
userId,
|
|
52
51
|
orgRole: tenantRole
|
|
53
52
|
});
|
|
@@ -149,20 +148,18 @@ app.openapi(createRoute({
|
|
|
149
148
|
tenantId,
|
|
150
149
|
...body
|
|
151
150
|
});
|
|
152
|
-
if (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
if (!userId) throw createApiError({
|
|
152
|
+
code: "unauthorized",
|
|
153
|
+
message: "User not found"
|
|
154
|
+
});
|
|
155
|
+
try {
|
|
156
|
+
await syncProjectToSpiceDb({
|
|
157
|
+
tenantId,
|
|
158
|
+
projectId: body.id,
|
|
159
|
+
creatorUserId: userId
|
|
156
160
|
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
tenantId,
|
|
160
|
-
projectId: body.id,
|
|
161
|
-
creatorUserId: userId
|
|
162
|
-
});
|
|
163
|
-
} catch (syncError) {
|
|
164
|
-
console.warn("Failed to sync project to SpiceDB:", syncError);
|
|
165
|
-
}
|
|
161
|
+
} catch (syncError) {
|
|
162
|
+
console.warn("Failed to sync project to SpiceDB:", syncError);
|
|
166
163
|
}
|
|
167
164
|
return c.json({ data: {
|
|
168
165
|
...projectConfig,
|
|
@@ -256,7 +253,7 @@ app.openapi(createRoute({
|
|
|
256
253
|
code: "not_found",
|
|
257
254
|
message: "Project not found"
|
|
258
255
|
});
|
|
259
|
-
|
|
256
|
+
try {
|
|
260
257
|
await removeProjectFromSpiceDb({
|
|
261
258
|
tenantId,
|
|
262
259
|
projectId: id
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types7 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/signoz.d.ts
|
|
6
6
|
declare const app: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types7.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { app as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
2
2
|
import { env } from "../../../env.js";
|
|
3
|
-
import {
|
|
4
|
-
import { Hono } from "hono";
|
|
3
|
+
import { enforceSecurityFilters } from "../../../utils/signozHelpers.js";
|
|
5
4
|
import { createApiError, projectExists } from "@inkeep/agents-core";
|
|
5
|
+
import { Hono } from "hono";
|
|
6
6
|
import axios from "axios";
|
|
7
7
|
|
|
8
8
|
//#region src/domains/manage/routes/signoz.ts
|
|
@@ -36,9 +36,12 @@ app.post("/query", async (c) => {
|
|
|
36
36
|
message: "You do not have access to this project"
|
|
37
37
|
}, 403);
|
|
38
38
|
}
|
|
39
|
-
payload = enforceProjectFilter(payload, requestedProjectId);
|
|
40
|
-
logger.debug({ projectId: requestedProjectId }, "Project filter enforced");
|
|
41
39
|
}
|
|
40
|
+
payload = enforceSecurityFilters(payload, tenantId, requestedProjectId);
|
|
41
|
+
logger.debug({
|
|
42
|
+
tenantId,
|
|
43
|
+
projectId: requestedProjectId
|
|
44
|
+
}, "Security filters enforced");
|
|
42
45
|
const signozUrl = env.SIGNOZ_URL || env.PUBLIC_SIGNOZ_URL;
|
|
43
46
|
const signozApiKey = env.SIGNOZ_API_KEY;
|
|
44
47
|
if (!signozUrl || !signozApiKey) {
|
|
@@ -17,7 +17,7 @@ app.openapi(createRoute({
|
|
|
17
17
|
path: "/agent/{subAgentId}",
|
|
18
18
|
summary: "Get Artifact Components for Agent",
|
|
19
19
|
operationId: "get-artifact-components-for-agent",
|
|
20
|
-
tags: ["
|
|
20
|
+
tags: ["Agents", "Artifact Components"],
|
|
21
21
|
request: { params: TenantProjectAgentSubAgentParamsSchema },
|
|
22
22
|
responses: {
|
|
23
23
|
200: {
|
|
@@ -42,7 +42,7 @@ app.openapi(createRoute({
|
|
|
42
42
|
path: "/component/{artifactComponentId}/agents",
|
|
43
43
|
summary: "Get Agents Using Artifact Component",
|
|
44
44
|
operationId: "get-agents-using-artifact-component",
|
|
45
|
-
tags: ["
|
|
45
|
+
tags: ["Agents", "Artifact Components"],
|
|
46
46
|
request: { params: TenantProjectAgentParamsSchema.extend({ artifactComponentId: z.string() }) },
|
|
47
47
|
responses: {
|
|
48
48
|
200: {
|
|
@@ -68,7 +68,7 @@ app.openapi(createRoute({
|
|
|
68
68
|
path: "/",
|
|
69
69
|
summary: "Associate Artifact Component with Agent",
|
|
70
70
|
operationId: "associate-artifact-component-with-agent",
|
|
71
|
-
tags: ["
|
|
71
|
+
tags: ["Agents", "Artifact Components"],
|
|
72
72
|
request: {
|
|
73
73
|
params: TenantProjectAgentParamsSchema,
|
|
74
74
|
body: { content: { "application/json": { schema: SubAgentArtifactComponentApiInsertSchema } } }
|
|
@@ -139,7 +139,7 @@ app.openapi(createRoute({
|
|
|
139
139
|
path: "/agent/{subAgentId}/component/{artifactComponentId}",
|
|
140
140
|
summary: "Remove Artifact Component from Agent",
|
|
141
141
|
operationId: "remove-artifact-component-from-agent",
|
|
142
|
-
tags: ["
|
|
142
|
+
tags: ["Agents", "Artifact Components"],
|
|
143
143
|
request: { params: TenantProjectAgentSubAgentParamsSchema.extend({ artifactComponentId: z.string() }) },
|
|
144
144
|
responses: {
|
|
145
145
|
200: {
|
|
@@ -173,7 +173,7 @@ app.openapi(createRoute({
|
|
|
173
173
|
path: "/agent/{subAgentId}/component/{artifactComponentId}/exists",
|
|
174
174
|
summary: "Check if Artifact Component is Associated with Agent",
|
|
175
175
|
operationId: "check-artifact-component-agent-association",
|
|
176
|
-
tags: ["
|
|
176
|
+
tags: ["Agents", "Artifact Components"],
|
|
177
177
|
request: { params: TenantProjectAgentSubAgentParamsSchema.extend({ artifactComponentId: z.string() }) },
|
|
178
178
|
responses: {
|
|
179
179
|
200: {
|
|
@@ -17,7 +17,7 @@ app.openapi(createRoute({
|
|
|
17
17
|
path: "/agent/{subAgentId}",
|
|
18
18
|
summary: "Get Data Components for Agent",
|
|
19
19
|
operationId: "get-data-components-for-agent",
|
|
20
|
-
tags: ["
|
|
20
|
+
tags: ["Agents", "Data Components"],
|
|
21
21
|
request: { params: TenantProjectAgentSubAgentParamsSchema },
|
|
22
22
|
responses: {
|
|
23
23
|
200: {
|
|
@@ -42,7 +42,7 @@ app.openapi(createRoute({
|
|
|
42
42
|
path: "/component/{dataComponentId}/agents",
|
|
43
43
|
summary: "Get Agents Using Data Component",
|
|
44
44
|
operationId: "get-agents-using-data-component",
|
|
45
|
-
tags: ["
|
|
45
|
+
tags: ["Agents", "Data Components"],
|
|
46
46
|
request: { params: TenantProjectAgentParamsSchema.extend({ dataComponentId: z.string() }) },
|
|
47
47
|
responses: {
|
|
48
48
|
200: {
|
|
@@ -68,7 +68,7 @@ app.openapi(createRoute({
|
|
|
68
68
|
path: "/",
|
|
69
69
|
summary: "Associate Data Component with Agent",
|
|
70
70
|
operationId: "associate-data-component-with-agent",
|
|
71
|
-
tags: ["
|
|
71
|
+
tags: ["Agents", "Data Components"],
|
|
72
72
|
request: {
|
|
73
73
|
params: TenantProjectAgentParamsSchema,
|
|
74
74
|
body: { content: { "application/json": { schema: SubAgentDataComponentApiInsertSchema } } }
|
|
@@ -138,7 +138,7 @@ app.openapi(createRoute({
|
|
|
138
138
|
path: "/agent/{subAgentId}/component/{dataComponentId}",
|
|
139
139
|
summary: "Remove Data Component from Agent",
|
|
140
140
|
operationId: "remove-data-component-from-agent",
|
|
141
|
-
tags: ["
|
|
141
|
+
tags: ["Agents", "Data Components"],
|
|
142
142
|
request: { params: TenantProjectAgentSubAgentParamsSchema.extend({ dataComponentId: z.string() }) },
|
|
143
143
|
responses: {
|
|
144
144
|
200: {
|
|
@@ -172,7 +172,7 @@ app.openapi(createRoute({
|
|
|
172
172
|
path: "/agent/{subAgentId}/component/{dataComponentId}/exists",
|
|
173
173
|
summary: "Check if Data Component is Associated with Agent",
|
|
174
174
|
operationId: "check-data-component-agent-association",
|
|
175
|
-
tags: ["
|
|
175
|
+
tags: ["Agents", "Data Components"],
|
|
176
176
|
request: { params: TenantProjectAgentSubAgentParamsSchema.extend({ dataComponentId: z.string() }) },
|
|
177
177
|
responses: {
|
|
178
178
|
200: {
|
|
@@ -19,7 +19,7 @@ app.openapi(createRoute({
|
|
|
19
19
|
path: "/",
|
|
20
20
|
summary: "List Sub Agent External Agent Relations",
|
|
21
21
|
operationId: "list-sub-agent-external-agent-relations",
|
|
22
|
-
tags: ["
|
|
22
|
+
tags: ["SubAgents", "External Agents"],
|
|
23
23
|
request: {
|
|
24
24
|
params: TenantProjectAgentSubAgentParamsSchema,
|
|
25
25
|
query: PaginationQueryParamsSchema
|
|
@@ -64,7 +64,7 @@ app.openapi(createRoute({
|
|
|
64
64
|
path: "/{id}",
|
|
65
65
|
summary: "Get Sub Agent External Agent Relation",
|
|
66
66
|
operationId: "get-sub-agent-external-agent-relation-by-id",
|
|
67
|
-
tags: ["
|
|
67
|
+
tags: ["SubAgents", "External Agents"],
|
|
68
68
|
request: { params: TenantProjectAgentSubAgentIdParamsSchema },
|
|
69
69
|
responses: {
|
|
70
70
|
200: {
|
|
@@ -96,7 +96,7 @@ app.openapi(createRoute({
|
|
|
96
96
|
path: "/",
|
|
97
97
|
summary: "Create Sub Agent External Agent Relation",
|
|
98
98
|
operationId: "create-sub-agent-external-agent-relation",
|
|
99
|
-
tags: ["
|
|
99
|
+
tags: ["SubAgents", "External Agents"],
|
|
100
100
|
request: {
|
|
101
101
|
params: TenantProjectAgentSubAgentParamsSchema,
|
|
102
102
|
body: { content: { "application/json": { schema: SubAgentExternalAgentRelationApiInsertSchema } } }
|
|
@@ -147,7 +147,7 @@ app.openapi(createRoute({
|
|
|
147
147
|
path: "/{id}",
|
|
148
148
|
summary: "Update Sub Agent External Agent Relation",
|
|
149
149
|
operationId: "update-sub-agent-external-agent-relation",
|
|
150
|
-
tags: ["
|
|
150
|
+
tags: ["SubAgents", "External Agents"],
|
|
151
151
|
request: {
|
|
152
152
|
params: TenantProjectAgentSubAgentIdParamsSchema,
|
|
153
153
|
body: { content: { "application/json": { schema: SubAgentExternalAgentRelationApiUpdateSchema } } }
|
|
@@ -184,7 +184,7 @@ app.openapi(createRoute({
|
|
|
184
184
|
path: "/{id}",
|
|
185
185
|
summary: "Delete Sub Agent External Agent Relation",
|
|
186
186
|
operationId: "delete-sub-agent-external-agent-relation",
|
|
187
|
-
tags: ["
|
|
187
|
+
tags: ["SubAgents", "External Agents"],
|
|
188
188
|
request: { params: TenantProjectAgentSubAgentIdParamsSchema },
|
|
189
189
|
responses: {
|
|
190
190
|
204: { description: "Sub Agent External Agent Relation deleted successfully" },
|
|
@@ -17,7 +17,7 @@ app.openapi(createRoute({
|
|
|
17
17
|
path: "/sub-agent/{subAgentId}",
|
|
18
18
|
summary: "Get Function Tools for SubAgent",
|
|
19
19
|
operationId: "get-function-tools-for-sub-agent",
|
|
20
|
-
tags: ["
|
|
20
|
+
tags: ["SubAgents", "Function Tools"],
|
|
21
21
|
request: { params: TenantProjectAgentSubAgentParamsSchema },
|
|
22
22
|
responses: {
|
|
23
23
|
200: {
|
|
@@ -44,7 +44,7 @@ app.openapi(createRoute({
|
|
|
44
44
|
path: "/function-tool/{functionToolId}/sub-agents",
|
|
45
45
|
summary: "Get SubAgents Using Function Tool",
|
|
46
46
|
operationId: "get-sub-agents-using-function-tool",
|
|
47
|
-
tags: ["
|
|
47
|
+
tags: ["SubAgents", "Function Tools"],
|
|
48
48
|
request: { params: TenantProjectAgentParamsSchema.extend({ functionToolId: z.string() }) },
|
|
49
49
|
responses: {
|
|
50
50
|
200: {
|
|
@@ -71,7 +71,7 @@ app.openapi(createRoute({
|
|
|
71
71
|
path: "/",
|
|
72
72
|
summary: "Associate Function Tool with SubAgent",
|
|
73
73
|
operationId: "associate-function-tool-with-sub-agent",
|
|
74
|
-
tags: ["
|
|
74
|
+
tags: ["SubAgents", "Function Tools"],
|
|
75
75
|
request: {
|
|
76
76
|
params: TenantProjectAgentParamsSchema,
|
|
77
77
|
body: { content: { "application/json": { schema: SubAgentFunctionToolRelationApiInsertSchema } } }
|
|
@@ -142,7 +142,7 @@ app.openapi(createRoute({
|
|
|
142
142
|
path: "/sub-agent/{subAgentId}/function-tool/{functionToolId}",
|
|
143
143
|
summary: "Remove Function Tool from SubAgent",
|
|
144
144
|
operationId: "remove-function-tool-from-sub-agent",
|
|
145
|
-
tags: ["
|
|
145
|
+
tags: ["SubAgents", "Function Tools"],
|
|
146
146
|
request: { params: TenantProjectAgentSubAgentParamsSchema.extend({ functionToolId: z.string() }) },
|
|
147
147
|
responses: {
|
|
148
148
|
200: {
|
|
@@ -176,7 +176,7 @@ app.openapi(createRoute({
|
|
|
176
176
|
path: "/sub-agent/{subAgentId}/function-tool/{functionToolId}/exists",
|
|
177
177
|
summary: "Check if Function Tool is Associated with SubAgent",
|
|
178
178
|
operationId: "check-function-tool-sub-agent-association",
|
|
179
|
-
tags: ["
|
|
179
|
+
tags: ["SubAgents", "Function Tools"],
|
|
180
180
|
request: { params: TenantProjectAgentSubAgentParamsSchema.extend({ functionToolId: z.string() }) },
|
|
181
181
|
responses: {
|
|
182
182
|
200: {
|
|
@@ -19,7 +19,7 @@ app.openapi(createRoute({
|
|
|
19
19
|
path: "/",
|
|
20
20
|
summary: "List Sub Agent Relations",
|
|
21
21
|
operationId: "list-sub-agent-relations",
|
|
22
|
-
tags: ["
|
|
22
|
+
tags: ["SubAgents"],
|
|
23
23
|
request: {
|
|
24
24
|
params: TenantProjectAgentParamsSchema,
|
|
25
25
|
query: PaginationQueryParamsSchema.merge(SubAgentRelationQuerySchema)
|
|
@@ -92,7 +92,7 @@ app.openapi(createRoute({
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
return c.json(result);
|
|
95
|
-
} catch
|
|
95
|
+
} catch {
|
|
96
96
|
throw createApiError({
|
|
97
97
|
code: "internal_server_error",
|
|
98
98
|
message: "Failed to retrieve sub agent relations"
|
|
@@ -104,7 +104,7 @@ app.openapi(createRoute({
|
|
|
104
104
|
path: "/{id}",
|
|
105
105
|
summary: "Get Sub Agent Relation",
|
|
106
106
|
operationId: "get-sub-agent-relation-by-id",
|
|
107
|
-
tags: ["
|
|
107
|
+
tags: ["SubAgents"],
|
|
108
108
|
request: { params: TenantProjectAgentIdParamsSchema },
|
|
109
109
|
responses: {
|
|
110
110
|
200: {
|
|
@@ -135,7 +135,7 @@ app.openapi(createRoute({
|
|
|
135
135
|
path: "/",
|
|
136
136
|
summary: "Create Sub Agent Relation",
|
|
137
137
|
operationId: "create-sub-agent-relation",
|
|
138
|
-
tags: ["
|
|
138
|
+
tags: ["SubAgents"],
|
|
139
139
|
request: {
|
|
140
140
|
params: TenantProjectAgentParamsSchema,
|
|
141
141
|
body: { content: { "application/json": { schema: SubAgentRelationApiInsertSchema } } }
|
|
@@ -196,7 +196,7 @@ app.openapi(createRoute({
|
|
|
196
196
|
path: "/{id}",
|
|
197
197
|
summary: "Update Sub Agent Relation",
|
|
198
198
|
operationId: "update-sub-agent-relation",
|
|
199
|
-
tags: ["
|
|
199
|
+
tags: ["SubAgents"],
|
|
200
200
|
request: {
|
|
201
201
|
params: TenantProjectAgentIdParamsSchema,
|
|
202
202
|
body: { content: { "application/json": { schema: SubAgentRelationApiUpdateSchema } } }
|
|
@@ -232,7 +232,7 @@ app.openapi(createRoute({
|
|
|
232
232
|
path: "/{id}",
|
|
233
233
|
summary: "Delete Sub Agent Relation",
|
|
234
234
|
operationId: "delete-sub-agent-relation",
|
|
235
|
-
tags: ["
|
|
235
|
+
tags: ["SubAgents"],
|
|
236
236
|
request: { params: TenantProjectAgentIdParamsSchema },
|
|
237
237
|
responses: {
|
|
238
238
|
204: { description: "Sub Agent Relation deleted successfully" },
|
|
@@ -19,7 +19,7 @@ app.openapi(createRoute({
|
|
|
19
19
|
path: "/",
|
|
20
20
|
summary: "List Sub Agent Team Agent Relations",
|
|
21
21
|
operationId: "list-sub-agent-team-agent-relations",
|
|
22
|
-
tags: ["
|
|
22
|
+
tags: ["SubAgents"],
|
|
23
23
|
request: {
|
|
24
24
|
params: TenantProjectAgentSubAgentParamsSchema,
|
|
25
25
|
query: PaginationQueryParamsSchema
|
|
@@ -52,7 +52,7 @@ app.openapi(createRoute({
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
return c.json(result);
|
|
55
|
-
} catch
|
|
55
|
+
} catch {
|
|
56
56
|
throw createApiError({
|
|
57
57
|
code: "internal_server_error",
|
|
58
58
|
message: "Failed to retrieve sub agent team agent relations"
|
|
@@ -64,7 +64,7 @@ app.openapi(createRoute({
|
|
|
64
64
|
path: "/{id}",
|
|
65
65
|
summary: "Get Sub Agent Team Agent Relation",
|
|
66
66
|
operationId: "get-sub-agent-team-agent-relation-by-id",
|
|
67
|
-
tags: ["
|
|
67
|
+
tags: ["SubAgents"],
|
|
68
68
|
request: { params: TenantProjectAgentSubAgentIdParamsSchema },
|
|
69
69
|
responses: {
|
|
70
70
|
200: {
|
|
@@ -96,7 +96,7 @@ app.openapi(createRoute({
|
|
|
96
96
|
path: "/",
|
|
97
97
|
summary: "Create Sub Agent Team Agent Relation",
|
|
98
98
|
operationId: "create-sub-agent-team-agent-relation",
|
|
99
|
-
tags: ["
|
|
99
|
+
tags: ["SubAgents"],
|
|
100
100
|
request: {
|
|
101
101
|
params: TenantProjectAgentSubAgentParamsSchema,
|
|
102
102
|
body: { content: { "application/json": { schema: SubAgentTeamAgentRelationApiInsertSchema } } }
|
|
@@ -147,7 +147,7 @@ app.openapi(createRoute({
|
|
|
147
147
|
path: "/{id}",
|
|
148
148
|
summary: "Update Sub Agent Team Agent Relation",
|
|
149
149
|
operationId: "update-sub-agent-team-agent-relation",
|
|
150
|
-
tags: ["
|
|
150
|
+
tags: ["SubAgents"],
|
|
151
151
|
request: {
|
|
152
152
|
params: TenantProjectAgentSubAgentIdParamsSchema,
|
|
153
153
|
body: { content: { "application/json": { schema: SubAgentTeamAgentRelationApiUpdateSchema } } }
|
|
@@ -184,7 +184,7 @@ app.openapi(createRoute({
|
|
|
184
184
|
path: "/{id}",
|
|
185
185
|
summary: "Delete Sub Agent Team Agent Relation",
|
|
186
186
|
operationId: "delete-sub-agent-team-agent-relation",
|
|
187
|
-
tags: ["
|
|
187
|
+
tags: ["SubAgents"],
|
|
188
188
|
request: { params: TenantProjectAgentSubAgentIdParamsSchema },
|
|
189
189
|
responses: {
|
|
190
190
|
204: { description: "Sub Agent Team Agent Relation deleted successfully" },
|
|
@@ -19,7 +19,7 @@ app.openapi(createRoute({
|
|
|
19
19
|
path: "/",
|
|
20
20
|
summary: "List SubAgent Tool Relations",
|
|
21
21
|
operationId: "list-subagent-tool-relations",
|
|
22
|
-
tags: ["
|
|
22
|
+
tags: ["SubAgents", "Tools"],
|
|
23
23
|
request: {
|
|
24
24
|
params: TenantProjectAgentParamsSchema,
|
|
25
25
|
query: PaginationQueryParamsSchema.extend({
|
|
@@ -98,7 +98,7 @@ app.openapi(createRoute({
|
|
|
98
98
|
path: "/{id}",
|
|
99
99
|
summary: "Get SubAgent Tool Relation",
|
|
100
100
|
operationId: "get-subagent-tool-relation",
|
|
101
|
-
tags: ["
|
|
101
|
+
tags: ["SubAgents", "Tools"],
|
|
102
102
|
request: { params: TenantProjectAgentIdParamsSchema },
|
|
103
103
|
responses: {
|
|
104
104
|
200: {
|
|
@@ -130,7 +130,7 @@ app.openapi(createRoute({
|
|
|
130
130
|
path: "/tool/{toolId}/sub-agents",
|
|
131
131
|
summary: "Get SubAgents for Tool",
|
|
132
132
|
operationId: "get-subagents-for-tool",
|
|
133
|
-
tags: ["
|
|
133
|
+
tags: ["SubAgents", "Tools"],
|
|
134
134
|
request: {
|
|
135
135
|
params: TenantProjectAgentParamsSchema.extend({ toolId: z.string() }),
|
|
136
136
|
query: PaginationQueryParamsSchema
|
|
@@ -165,7 +165,7 @@ app.openapi(createRoute({
|
|
|
165
165
|
path: "/",
|
|
166
166
|
summary: "Create SubAgent Tool Relation",
|
|
167
167
|
operationId: "create-subagent-tool-relation",
|
|
168
|
-
tags: ["
|
|
168
|
+
tags: ["SubAgents", "Tools"],
|
|
169
169
|
request: {
|
|
170
170
|
params: TenantProjectAgentParamsSchema,
|
|
171
171
|
body: { content: { "application/json": { schema: SubAgentToolRelationApiInsertSchema } } }
|
|
@@ -218,7 +218,7 @@ app.openapi(createRoute({
|
|
|
218
218
|
path: "/{id}",
|
|
219
219
|
summary: "Update SubAgent Tool Relation",
|
|
220
220
|
operationId: "update-subagent-tool-relation",
|
|
221
|
-
tags: ["
|
|
221
|
+
tags: ["SubAgents", "Tools"],
|
|
222
222
|
request: {
|
|
223
223
|
params: TenantProjectAgentIdParamsSchema,
|
|
224
224
|
body: { content: { "application/json": { schema: SubAgentToolRelationApiUpdateSchema } } }
|
|
@@ -258,7 +258,7 @@ app.openapi(createRoute({
|
|
|
258
258
|
path: "/{id}",
|
|
259
259
|
summary: "Delete SubAgent Tool Relation",
|
|
260
260
|
operationId: "delete-subagent-tool-relation",
|
|
261
|
-
tags: ["
|
|
261
|
+
tags: ["SubAgents", "Tools"],
|
|
262
262
|
request: { params: TenantProjectAgentIdParamsSchema },
|
|
263
263
|
responses: {
|
|
264
264
|
204: { description: "SubAgent tool relation deleted successfully" },
|
|
@@ -20,7 +20,7 @@ app.openapi(createRoute({
|
|
|
20
20
|
path: "/",
|
|
21
21
|
summary: "List SubAgents",
|
|
22
22
|
operationId: "list-subagents",
|
|
23
|
-
tags: ["
|
|
23
|
+
tags: ["SubAgents"],
|
|
24
24
|
request: {
|
|
25
25
|
params: TenantProjectAgentParamsSchema,
|
|
26
26
|
query: PaginationQueryParamsSchema
|
|
@@ -62,7 +62,7 @@ app.openapi(createRoute({
|
|
|
62
62
|
path: "/{id}",
|
|
63
63
|
summary: "Get SubAgent",
|
|
64
64
|
operationId: "get-subagent-by-id",
|
|
65
|
-
tags: ["
|
|
65
|
+
tags: ["SubAgents"],
|
|
66
66
|
request: { params: TenantProjectAgentIdParamsSchema },
|
|
67
67
|
responses: {
|
|
68
68
|
200: {
|
|
@@ -96,7 +96,7 @@ app.openapi(createRoute({
|
|
|
96
96
|
path: "/",
|
|
97
97
|
summary: "Create SubAgent",
|
|
98
98
|
operationId: "create-subagent",
|
|
99
|
-
tags: ["
|
|
99
|
+
tags: ["SubAgents"],
|
|
100
100
|
request: {
|
|
101
101
|
params: TenantProjectAgentParamsSchema,
|
|
102
102
|
body: { content: { "application/json": { schema: SubAgentApiInsertSchema } } }
|
|
@@ -129,7 +129,7 @@ app.openapi(createRoute({
|
|
|
129
129
|
path: "/{id}",
|
|
130
130
|
summary: "Update SubAgent",
|
|
131
131
|
operationId: "update-subagent",
|
|
132
|
-
tags: ["
|
|
132
|
+
tags: ["SubAgents"],
|
|
133
133
|
request: {
|
|
134
134
|
params: TenantProjectAgentIdParamsSchema,
|
|
135
135
|
body: { content: { "application/json": { schema: SubAgentApiUpdateSchema } } }
|
|
@@ -168,7 +168,7 @@ app.openapi(createRoute({
|
|
|
168
168
|
path: "/{id}",
|
|
169
169
|
summary: "Delete SubAgent",
|
|
170
170
|
operationId: "delete-subagent",
|
|
171
|
-
tags: ["
|
|
171
|
+
tags: ["SubAgents"],
|
|
172
172
|
request: { params: TenantProjectAgentIdParamsSchema },
|
|
173
173
|
responses: {
|
|
174
174
|
204: { description: "SubAgent deleted successfully" },
|
|
@@ -2,7 +2,8 @@ import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
|
2
2
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
3
3
|
import { speakeasyOffsetLimitPagination } from "../../../utils/speakeasy.js";
|
|
4
4
|
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
5
|
-
import { CredentialReferenceApiSelectSchema, CredentialReferenceResponse, McpToolListResponse, McpToolResponse, PaginationQueryParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiUpdateSchema, ToolStatusSchema, commonGetErrorResponses, createApiError, createTool, dbResultToMcpTool, deleteTool, generateId, getToolById, getUserScopedCredentialReference, listTools, updateTool } from "@inkeep/agents-core";
|
|
5
|
+
import { CredentialReferenceApiSelectSchema, CredentialReferenceResponse, McpToolListResponse, McpToolResponse, PaginationQueryParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiUpdateSchema, ToolStatusSchema, commonGetErrorResponses, createApiError, createTool, dbResultToMcpTool, dbResultToMcpToolSkeleton, deleteTool, generateId, getToolById, getUserScopedCredentialReference, listTools, updateTool } from "@inkeep/agents-core";
|
|
6
|
+
import { z as z$1 } from "zod";
|
|
6
7
|
|
|
7
8
|
//#region src/domains/manage/routes/tools.ts
|
|
8
9
|
const logger = getLogger$1("tools");
|
|
@@ -24,7 +25,10 @@ app.openapi(createRoute({
|
|
|
24
25
|
tags: ["Tools"],
|
|
25
26
|
request: {
|
|
26
27
|
params: TenantProjectParamsSchema,
|
|
27
|
-
query: PaginationQueryParamsSchema.extend({
|
|
28
|
+
query: PaginationQueryParamsSchema.extend({
|
|
29
|
+
status: ToolStatusSchema.optional(),
|
|
30
|
+
skipDiscovery: z$1.enum(["true", "false"]).optional().transform((val) => val === "true").describe("Skip MCP server discovery for faster response. Status will be \"unknown\".")
|
|
31
|
+
})
|
|
28
32
|
},
|
|
29
33
|
responses: {
|
|
30
34
|
200: {
|
|
@@ -37,10 +41,27 @@ app.openapi(createRoute({
|
|
|
37
41
|
}), async (c) => {
|
|
38
42
|
const db = c.get("db");
|
|
39
43
|
const { tenantId, projectId } = c.req.valid("param");
|
|
40
|
-
const { page, limit, status } = c.req.valid("query");
|
|
44
|
+
const { page, limit, status, skipDiscovery } = c.req.valid("query");
|
|
41
45
|
let result;
|
|
42
46
|
const credentialStores = c.get("credentialStores");
|
|
43
47
|
const userId = c.get("userId");
|
|
48
|
+
if (skipDiscovery) {
|
|
49
|
+
const dbResult = await listTools(db)({
|
|
50
|
+
scopes: {
|
|
51
|
+
tenantId,
|
|
52
|
+
projectId
|
|
53
|
+
},
|
|
54
|
+
pagination: {
|
|
55
|
+
page,
|
|
56
|
+
limit
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
result = {
|
|
60
|
+
data: dbResult.data.map((tool) => dbResultToMcpToolSkeleton(tool)),
|
|
61
|
+
pagination: dbResult.pagination
|
|
62
|
+
};
|
|
63
|
+
return c.json(result);
|
|
64
|
+
}
|
|
44
65
|
if (status) {
|
|
45
66
|
const dbResult = await listTools(db)({
|
|
46
67
|
scopes: {
|
|
@@ -140,7 +161,8 @@ app.openapi(createRoute({
|
|
|
140
161
|
credentialReferenceId: body.credentialReferenceId,
|
|
141
162
|
credentialScope: body.credentialScope,
|
|
142
163
|
imageUrl: body.imageUrl,
|
|
143
|
-
headers: body.headers
|
|
164
|
+
headers: body.headers,
|
|
165
|
+
isWorkApp: body.isWorkApp
|
|
144
166
|
});
|
|
145
167
|
return c.json({ data: await dbResultToMcpTool(tool, db, credentialStores, void 0, userId) }, 201);
|
|
146
168
|
});
|
|
@@ -183,7 +205,8 @@ app.openapi(createRoute({
|
|
|
183
205
|
credentialReferenceId: body.credentialReferenceId,
|
|
184
206
|
credentialScope: body.credentialScope,
|
|
185
207
|
imageUrl: body.imageUrl,
|
|
186
|
-
headers: body.headers
|
|
208
|
+
headers: body.headers,
|
|
209
|
+
isWorkApp: body.isWorkApp
|
|
187
210
|
}
|
|
188
211
|
});
|
|
189
212
|
if (!updatedTool) throw createApiError({
|