@inkeep/agents-api 0.43.0 → 0.45.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 +1 -1
- package/dist/.well-known/workflow/v1/step.cjs +211602 -195751
- package/dist/createApp.js +11 -9
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/evals/workflow/routes.d.ts +2 -2
- package/dist/domains/manage/index.js +8 -0
- package/dist/domains/manage/routes/availableAgents.d.ts +7 -0
- package/dist/domains/manage/routes/availableAgents.js +94 -0
- package/dist/domains/manage/routes/branches.js +9 -0
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/evals/datasetItems.js +13 -0
- package/dist/domains/manage/routes/evals/datasets.js +9 -0
- package/dist/domains/manage/routes/evals/evaluationJobConfigEvaluatorRelations.js +5 -0
- package/dist/domains/manage/routes/evals/evaluationJobConfigs.js +9 -0
- package/dist/domains/manage/routes/evals/evaluationResults.d.ts +4 -2
- package/dist/domains/manage/routes/evals/evaluationResults.js +9 -0
- package/dist/domains/manage/routes/evals/evaluationRunConfigs.js +9 -0
- package/dist/domains/manage/routes/evals/evaluationSuiteConfigEvaluatorRelations.js +5 -0
- package/dist/domains/manage/routes/evals/evaluationSuiteConfigs.js +9 -0
- package/dist/domains/manage/routes/evals/evaluators.js +9 -0
- 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/invitations.d.ts +4 -3
- package/dist/domains/manage/routes/invitations.js +16 -28
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/mcpToolGithubAccess.d.ts +9 -0
- package/dist/domains/manage/routes/mcpToolGithubAccess.js +205 -0
- package/dist/domains/manage/routes/playgroundToken.js +3 -2
- 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 +1 -14
- package/dist/domains/manage/routes/projectPermissions.js +2 -9
- package/dist/domains/manage/routes/projects.js +14 -16
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.js +22 -16
- package/dist/domains/manage/routes/tools.js +4 -2
- package/dist/domains/manage/routes/userOrganizations.d.ts +4 -3
- package/dist/domains/manage/routes/userOrganizations.js +16 -45
- package/dist/domains/manage/routes/userProjectMemberships.js +1 -2
- package/dist/domains/run/agents/Agent.js +29 -2
- package/dist/domains/run/agents/relationTools.js +2 -1
- 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/ContextResolver.js +1 -1
- package/dist/domains/run/context/validation.d.ts +1 -1
- package/dist/domains/run/services/AgentSession.js +5 -1
- package/dist/domains/run/services/BaseCompressor.js +1 -1
- package/dist/domains/run/services/TriggerService.d.ts +1 -1
- package/dist/domains/run/services/TriggerService.js +15 -13
- package/dist/domains/run/tools/sandbox-utils.js +1 -1
- package/dist/domains/run/types/executionContext.js +3 -1
- package/dist/env.d.ts +12 -2
- package/dist/env.js +37 -32
- package/dist/factory.d.ts +7 -7
- package/dist/factory.js +4 -10
- package/dist/index.d.ts +6 -5
- package/dist/index.js +3 -5
- package/dist/middleware/branchScopedDb.d.ts +1 -1
- package/dist/middleware/evalsAuth.d.ts +1 -1
- package/dist/middleware/manageAuth.d.ts +1 -1
- package/dist/middleware/projectAccess.d.ts +2 -11
- package/dist/middleware/projectAccess.js +7 -33
- 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/runAuth.js +39 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/sessionAuth.js +1 -2
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/openapi.d.ts +1 -2
- package/dist/openapi.js +1 -2
- package/dist/types/runExecutionContext.js +3 -1
- package/package.json +5 -4
- package/dist/domains/github/config.d.ts +0 -14
- package/dist/domains/github/config.js +0 -47
- package/dist/domains/github/index.d.ts +0 -12
- package/dist/domains/github/index.js +0 -18
- package/dist/domains/github/installation.d.ts +0 -34
- package/dist/domains/github/installation.js +0 -172
- package/dist/domains/github/jwks.d.ts +0 -20
- package/dist/domains/github/jwks.js +0 -85
- package/dist/domains/github/oidcToken.d.ts +0 -22
- package/dist/domains/github/oidcToken.js +0 -140
- package/dist/domains/github/routes/tokenExchange.d.ts +0 -7
- package/dist/domains/github/routes/tokenExchange.js +0 -130
- package/dist/initialization.d.ts +0 -6
- package/dist/initialization.js +0 -72
package/dist/createApp.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { getLogger } from "./logger.js";
|
|
1
|
+
import { getLogger as getLogger$1 } from "./logger.js";
|
|
2
2
|
import { env } from "./env.js";
|
|
3
3
|
import { evalRoutes } from "./domains/evals/index.js";
|
|
4
4
|
import { workflowRoutes } from "./domains/evals/workflow/routes.js";
|
|
5
|
-
import { githubRoutes } from "./domains/github/index.js";
|
|
6
5
|
import { sessionAuth, sessionContext } from "./middleware/sessionAuth.js";
|
|
7
6
|
import { manageRoutes } from "./domains/manage/index.js";
|
|
8
7
|
import mcp_default from "./domains/mcp/routes/mcp.js";
|
|
@@ -22,13 +21,15 @@ import { executionBaggageMiddleware } from "./middleware/tracing.js";
|
|
|
22
21
|
import { setupOpenAPIRoutes } from "./openapi.js";
|
|
23
22
|
import { healthChecksHandler } from "./routes/healthChecks.js";
|
|
24
23
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
24
|
+
import { OrgRoles } from "@inkeep/agents-core";
|
|
25
|
+
import { githubRoutes } from "@inkeep/agents-work-apps/github";
|
|
25
26
|
import { Hono } from "hono";
|
|
26
27
|
import { cors } from "hono/cors";
|
|
27
28
|
import { requestId } from "hono/request-id";
|
|
28
29
|
import { pinoLogger } from "hono-pino";
|
|
29
30
|
|
|
30
31
|
//#region src/createApp.ts
|
|
31
|
-
const logger = getLogger("agents-api");
|
|
32
|
+
const logger = getLogger$1("agents-api");
|
|
32
33
|
const isTestEnvironment = () => env.ENVIRONMENT === "test";
|
|
33
34
|
const isWebhookRoute = (path) => {
|
|
34
35
|
return path.includes("/triggers/") && !path.endsWith("/triggers") && !path.endsWith("/triggers/");
|
|
@@ -56,7 +57,7 @@ function createAgentsHono(config) {
|
|
|
56
57
|
if (c.req.path.startsWith("/run/")) return next();
|
|
57
58
|
if (c.req.path.includes("/playground/token")) return next();
|
|
58
59
|
if (c.req.path.includes("/signoz/")) return next();
|
|
59
|
-
if (c.req.path.includes("/
|
|
60
|
+
if (c.req.path.includes("/work-apps/github/")) return next();
|
|
60
61
|
return cors(defaultCorsConfig)(c, next);
|
|
61
62
|
});
|
|
62
63
|
app.use("*", async (c, next) => {
|
|
@@ -82,7 +83,7 @@ function createAgentsHono(config) {
|
|
|
82
83
|
return next();
|
|
83
84
|
});
|
|
84
85
|
app.use(pinoLogger({
|
|
85
|
-
pino: getLogger("agents-api").getPinoInstance(),
|
|
86
|
+
pino: getLogger$1("agents-api").getPinoInstance(),
|
|
86
87
|
http: { onResLevel(c) {
|
|
87
88
|
if (c.res.status >= 500) return "error";
|
|
88
89
|
if (c.req.path.includes("/signoz/")) return "debug";
|
|
@@ -107,7 +108,7 @@ function createAgentsHono(config) {
|
|
|
107
108
|
});
|
|
108
109
|
});
|
|
109
110
|
app.use("/manage/tenants/*", async (c, next) => {
|
|
110
|
-
if (
|
|
111
|
+
if (isTestEnvironment()) {
|
|
111
112
|
await next();
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
@@ -115,7 +116,7 @@ function createAgentsHono(config) {
|
|
|
115
116
|
return sessionAuth()(c, next);
|
|
116
117
|
});
|
|
117
118
|
app.use("/manage/capabilities", async (c, next) => {
|
|
118
|
-
if (!auth ||
|
|
119
|
+
if (!auth || isTestEnvironment()) {
|
|
119
120
|
await next();
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
@@ -140,11 +141,12 @@ function createAgentsHono(config) {
|
|
|
140
141
|
runtime: sandboxConfig.runtime
|
|
141
142
|
} });
|
|
142
143
|
});
|
|
143
|
-
if (
|
|
144
|
+
if (isTestEnvironment()) app.use("/manage/tenants/:tenantId/*", async (c, next) => {
|
|
144
145
|
const tenantId = c.req.param("tenantId");
|
|
145
146
|
if (tenantId) {
|
|
146
147
|
c.set("tenantId", tenantId);
|
|
147
148
|
c.set("userId", "anonymous");
|
|
149
|
+
c.set("tenantRole", OrgRoles.OWNER);
|
|
148
150
|
}
|
|
149
151
|
await next();
|
|
150
152
|
});
|
|
@@ -182,7 +184,7 @@ function createAgentsHono(config) {
|
|
|
182
184
|
return fetch(forwardedRequest);
|
|
183
185
|
});
|
|
184
186
|
app.route("/evals", evalRoutes);
|
|
185
|
-
app.route("/
|
|
187
|
+
app.route("/work-apps/github", githubRoutes);
|
|
186
188
|
app.route("/mcp", mcp_default);
|
|
187
189
|
setupOpenAPIRoutes(app);
|
|
188
190
|
app.use("/run/*", async (_c, next) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono2 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono2.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
|
|
2
|
+
import * as hono3 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono3.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
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<
|
|
5
|
+
declare const workflowRoutes: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { workflowRoutes };
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import availableAgents_default from "./routes/availableAgents.js";
|
|
1
2
|
import cliAuth_default from "./routes/cliAuth.js";
|
|
3
|
+
import github_default from "./routes/github.js";
|
|
2
4
|
import routes_default from "./routes/index.js";
|
|
3
5
|
import invitations_default from "./routes/invitations.js";
|
|
4
6
|
import mcp_default from "./routes/mcp.js";
|
|
7
|
+
import mcpToolGithubAccess_default from "./routes/mcpToolGithubAccess.js";
|
|
5
8
|
import oauth_default from "./routes/oauth.js";
|
|
6
9
|
import playgroundToken_default from "./routes/playgroundToken.js";
|
|
7
10
|
import projectFull_default from "./routes/projectFull.js";
|
|
11
|
+
import projectGithubAccess_default from "./routes/projectGithubAccess.js";
|
|
8
12
|
import signoz_default from "./routes/signoz.js";
|
|
9
13
|
import userOrganizations_default from "./routes/userOrganizations.js";
|
|
10
14
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
@@ -18,9 +22,13 @@ function createManageRoutes() {
|
|
|
18
22
|
app.route("/tenants/:tenantId", routes_default);
|
|
19
23
|
app.route("/tenants/:tenantId/playground/token", playgroundToken_default);
|
|
20
24
|
app.route("/tenants/:tenantId/signoz", signoz_default);
|
|
25
|
+
app.route("/tenants/:tenantId/github", github_default);
|
|
26
|
+
app.route("/tenants/:tenantId/projects/:projectId/github-access", projectGithubAccess_default);
|
|
27
|
+
app.route("/tenants/:tenantId/projects/:projectId/tools/:toolId/github-access", mcpToolGithubAccess_default);
|
|
21
28
|
app.route("/tenants/:tenantId", projectFull_default);
|
|
22
29
|
app.route("/oauth", oauth_default);
|
|
23
30
|
app.route("/mcp", mcp_default);
|
|
31
|
+
app.route("/available-agents", availableAgents_default);
|
|
24
32
|
return app;
|
|
25
33
|
}
|
|
26
34
|
const manageRoutes = createManageRoutes();
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
2
|
+
import { env } from "../../../env.js";
|
|
3
|
+
import manageDbClient_default from "../../../data/db/manageDbClient.js";
|
|
4
|
+
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
5
|
+
import { createApiError, listAgentsAcrossProjectBranches, listUsableProjectIds, verifyTempToken } from "@inkeep/agents-core";
|
|
6
|
+
|
|
7
|
+
//#region src/domains/manage/routes/availableAgents.ts
|
|
8
|
+
const logger = getLogger$1("availableAgents");
|
|
9
|
+
const app = new OpenAPIHono();
|
|
10
|
+
async function tryTempTokenAuth(token) {
|
|
11
|
+
if (!env.INKEEP_AGENTS_TEMP_JWT_PUBLIC_KEY) return null;
|
|
12
|
+
try {
|
|
13
|
+
const payload = await verifyTempToken(Buffer.from(env.INKEEP_AGENTS_TEMP_JWT_PUBLIC_KEY, "base64").toString("utf-8"), token);
|
|
14
|
+
return {
|
|
15
|
+
userId: payload.sub,
|
|
16
|
+
tenantId: payload.tenantId,
|
|
17
|
+
tokenType: "temp-jwt"
|
|
18
|
+
};
|
|
19
|
+
} catch (error) {
|
|
20
|
+
logger.warn({
|
|
21
|
+
token,
|
|
22
|
+
error
|
|
23
|
+
}, "Failed to verify temp token");
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Identify user from any supported token type
|
|
29
|
+
* Add new token types by adding them to this function
|
|
30
|
+
*/
|
|
31
|
+
async function identifyUserFromToken(token) {
|
|
32
|
+
const tempResult = await tryTempTokenAuth(token);
|
|
33
|
+
if (tempResult) return tempResult;
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const AvailableAgentSchema = z.object({
|
|
37
|
+
agentId: z.string(),
|
|
38
|
+
agentName: z.string(),
|
|
39
|
+
projectId: z.string()
|
|
40
|
+
});
|
|
41
|
+
const AvailableAgentsResponseSchema = z.object({ data: z.array(AvailableAgentSchema) });
|
|
42
|
+
app.openapi(createRoute({
|
|
43
|
+
method: "get",
|
|
44
|
+
path: "/",
|
|
45
|
+
summary: "List available agents",
|
|
46
|
+
operationId: "list-available-agents",
|
|
47
|
+
tags: ["Agents"],
|
|
48
|
+
description: "List all agents the user can invoke. Requires a valid JWT token.",
|
|
49
|
+
security: [{ bearerAuth: [] }],
|
|
50
|
+
responses: {
|
|
51
|
+
200: {
|
|
52
|
+
description: "List of available agents",
|
|
53
|
+
content: { "application/json": { schema: AvailableAgentsResponseSchema } }
|
|
54
|
+
},
|
|
55
|
+
401: { description: "Unauthorized - invalid or missing JWT token" },
|
|
56
|
+
500: { description: "Internal server error" }
|
|
57
|
+
}
|
|
58
|
+
}), async (c) => {
|
|
59
|
+
const authHeader = c.req.header("Authorization");
|
|
60
|
+
if (!authHeader?.startsWith("Bearer ")) throw createApiError({
|
|
61
|
+
code: "unauthorized",
|
|
62
|
+
message: "Missing or invalid authorization header. Expected: Bearer <jwt_token>"
|
|
63
|
+
});
|
|
64
|
+
const token = authHeader.substring(7);
|
|
65
|
+
if (!token.startsWith("eyJ")) throw createApiError({
|
|
66
|
+
code: "unauthorized",
|
|
67
|
+
message: "Invalid token format. Expected a JWT token."
|
|
68
|
+
});
|
|
69
|
+
const user = await identifyUserFromToken(token);
|
|
70
|
+
if (!user) {
|
|
71
|
+
logger.warn({}, "Token verification failed - no valid auth method found");
|
|
72
|
+
throw createApiError({
|
|
73
|
+
code: "unauthorized",
|
|
74
|
+
message: "Invalid or expired token"
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const { userId, tenantId } = user;
|
|
78
|
+
const projectIds = await listUsableProjectIds({ userId });
|
|
79
|
+
if (projectIds.length === 0) return c.json({ data: [] });
|
|
80
|
+
const agents = await listAgentsAcrossProjectBranches(manageDbClient_default, {
|
|
81
|
+
tenantId,
|
|
82
|
+
projectIds
|
|
83
|
+
});
|
|
84
|
+
logger.info({
|
|
85
|
+
userId,
|
|
86
|
+
tenantId,
|
|
87
|
+
agentCount: agents.length
|
|
88
|
+
}, "Returning usable agents");
|
|
89
|
+
return c.json({ data: agents });
|
|
90
|
+
});
|
|
91
|
+
var availableAgents_default = app;
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { availableAgents_default as default };
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
2
|
+
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
2
3
|
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
3
4
|
import { BranchListResponseSchema, BranchNameParamsSchema, BranchResponseSchema, CreateBranchRequestSchema, ErrorResponseSchema, TenantProjectAgentParamsSchema, TenantProjectParamsSchema, cascadeDeleteByBranch, commonGetErrorResponses, createApiError, createBranch, deleteBranch, getBranch, listBranches, listBranchesForAgent } from "@inkeep/agents-core";
|
|
4
5
|
|
|
5
6
|
//#region src/domains/manage/routes/branches.ts
|
|
6
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("/:branchName", async (c, next) => {
|
|
13
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
14
|
+
return next();
|
|
15
|
+
});
|
|
7
16
|
app.openapi(createRoute({
|
|
8
17
|
method: "get",
|
|
9
18
|
path: "/",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono8 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono8.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../../logger.js";
|
|
2
|
+
import { requireProjectPermission } from "../../../../middleware/projectAccess.js";
|
|
2
3
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
3
4
|
import { DatasetItemApiInsertSchema, DatasetItemApiSelectSchema, DatasetItemApiUpdateSchema, ListResponseSchema, SingleResponseSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createDatasetItem, createDatasetItems, deleteDatasetItem, generateId, getDatasetItemById, listDatasetItems, updateDatasetItem } from "@inkeep/agents-core";
|
|
4
5
|
|
|
5
6
|
//#region src/domains/manage/routes/evals/datasetItems.ts
|
|
6
7
|
const app = new OpenAPIHono();
|
|
7
8
|
const logger = getLogger$1("datasetItems");
|
|
9
|
+
app.use("/:datasetId/items", async (c, next) => {
|
|
10
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
11
|
+
return next();
|
|
12
|
+
});
|
|
13
|
+
app.use("/:datasetId/items/bulk", async (c, next) => {
|
|
14
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
15
|
+
return next();
|
|
16
|
+
});
|
|
17
|
+
app.use("/:datasetId/items/:itemId", async (c, next) => {
|
|
18
|
+
if (["PATCH", "DELETE"].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
|
|
19
|
+
return next();
|
|
20
|
+
});
|
|
8
21
|
app.openapi(createRoute({
|
|
9
22
|
method: "get",
|
|
10
23
|
path: "/{datasetId}",
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../../logger.js";
|
|
2
|
+
import { requireProjectPermission } from "../../../../middleware/projectAccess.js";
|
|
2
3
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
3
4
|
import { DatasetApiInsertSchema, DatasetApiSelectSchema, DatasetApiUpdateSchema, ListResponseSchema, SingleResponseSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createDataset, deleteDataset, generateId, getDatasetById, listDatasets, updateDataset } from "@inkeep/agents-core";
|
|
4
5
|
|
|
5
6
|
//#region src/domains/manage/routes/evals/datasets.ts
|
|
6
7
|
const app = new OpenAPIHono();
|
|
7
8
|
const logger = getLogger$1("datasets");
|
|
9
|
+
app.use("/", async (c, next) => {
|
|
10
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
11
|
+
return next();
|
|
12
|
+
});
|
|
13
|
+
app.use("/:datasetId", async (c, next) => {
|
|
14
|
+
if (["PATCH", "DELETE"].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
|
|
15
|
+
return next();
|
|
16
|
+
});
|
|
8
17
|
app.openapi(createRoute({
|
|
9
18
|
method: "get",
|
|
10
19
|
path: "/",
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../../logger.js";
|
|
2
|
+
import { requireProjectPermission } from "../../../../middleware/projectAccess.js";
|
|
2
3
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
3
4
|
import { TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfigEvaluatorRelation, generateId, getEvaluationJobConfigEvaluatorRelations } from "@inkeep/agents-core";
|
|
4
5
|
|
|
5
6
|
//#region src/domains/manage/routes/evals/evaluationJobConfigEvaluatorRelations.ts
|
|
6
7
|
const app = new OpenAPIHono();
|
|
7
8
|
const logger = getLogger$1("evaluationJobConfigEvaluatorRelations");
|
|
9
|
+
app.use("/:configId/evaluators/:evaluatorId", async (c, next) => {
|
|
10
|
+
if (["POST", "DELETE"].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
|
|
11
|
+
return next();
|
|
12
|
+
});
|
|
8
13
|
app.openapi(createRoute({
|
|
9
14
|
method: "get",
|
|
10
15
|
path: "/{configId}/evaluators",
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../../logger.js";
|
|
2
2
|
import runDbClient_default from "../../../../data/db/runDbClient.js";
|
|
3
3
|
import { queueEvaluationJobConversations } from "../../../evals/services/evaluationJob.js";
|
|
4
|
+
import { requireProjectPermission } from "../../../../middleware/projectAccess.js";
|
|
4
5
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
5
6
|
import { EvaluationJobConfigApiInsertSchema, EvaluationJobConfigApiSelectSchema, EvaluationResultApiSelectSchema, ListResponseSchema, SingleResponseSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createEvaluationJobConfig, createEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfig, generateId, getConversation, getEvaluationJobConfigById, getMessagesByConversation, listEvaluationJobConfigs, listEvaluationResultsByRun, listEvaluationRuns } from "@inkeep/agents-core";
|
|
6
7
|
|
|
7
8
|
//#region src/domains/manage/routes/evals/evaluationJobConfigs.ts
|
|
8
9
|
const app = new OpenAPIHono();
|
|
9
10
|
const logger = getLogger$1("evaluationJobConfigs");
|
|
11
|
+
app.use("/", async (c, next) => {
|
|
12
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
13
|
+
return next();
|
|
14
|
+
});
|
|
15
|
+
app.use("/:configId", async (c, next) => {
|
|
16
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
17
|
+
return next();
|
|
18
|
+
});
|
|
10
19
|
/**
|
|
11
20
|
* Extract plain filter criteria from a potential Filter wrapper.
|
|
12
21
|
* Returns null if the filter is a complex and/or combinator.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ManageAppVariables } from "../../../../types/app.js";
|
|
1
2
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as hono18 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/evals/evaluationResults.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<{
|
|
6
|
+
Variables: ManageAppVariables;
|
|
7
|
+
}, {}, "/">;
|
|
6
8
|
//#endregion
|
|
7
9
|
export { app as default };
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../../logger.js";
|
|
2
2
|
import runDbClient_default from "../../../../data/db/runDbClient.js";
|
|
3
|
+
import { requireProjectPermission } from "../../../../middleware/projectAccess.js";
|
|
3
4
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
4
5
|
import { EvaluationResultApiInsertSchema, EvaluationResultApiSelectSchema, EvaluationResultApiUpdateSchema, SingleResponseSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createEvaluationResult, deleteEvaluationResult, generateId, getEvaluationResultById, updateEvaluationResult } from "@inkeep/agents-core";
|
|
5
6
|
|
|
6
7
|
//#region src/domains/manage/routes/evals/evaluationResults.ts
|
|
7
8
|
const app = new OpenAPIHono();
|
|
8
9
|
const logger = getLogger$1("evaluationResults");
|
|
10
|
+
app.use("/", async (c, next) => {
|
|
11
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
12
|
+
return next();
|
|
13
|
+
});
|
|
14
|
+
app.use("/:resultId", async (c, next) => {
|
|
15
|
+
if (["PATCH", "DELETE"].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
|
|
16
|
+
return next();
|
|
17
|
+
});
|
|
9
18
|
app.openapi(createRoute({
|
|
10
19
|
method: "get",
|
|
11
20
|
path: "/{resultId}",
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../../logger.js";
|
|
2
2
|
import runDbClient_default from "../../../../data/db/runDbClient.js";
|
|
3
|
+
import { requireProjectPermission } from "../../../../middleware/projectAccess.js";
|
|
3
4
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
4
5
|
import { EvaluationResultApiSelectSchema, EvaluationRunConfigApiInsertSchema, EvaluationRunConfigApiUpdateSchema, EvaluationRunConfigWithSuiteConfigsApiSelectSchema, ListResponseSchema, SingleResponseSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createEvaluationRunConfig, createEvaluationRunConfigEvaluationSuiteConfigRelation, deleteEvaluationRunConfig, deleteEvaluationRunConfigEvaluationSuiteConfigRelation, generateId, getConversation, getEvaluationRunConfigById, getEvaluationRunConfigEvaluationSuiteConfigRelations, getMessagesByConversation, listEvaluationResultsByRun, listEvaluationRunConfigsWithSuiteConfigs, listEvaluationRuns, updateEvaluationRunConfig } from "@inkeep/agents-core";
|
|
5
6
|
|
|
6
7
|
//#region src/domains/manage/routes/evals/evaluationRunConfigs.ts
|
|
7
8
|
const app = new OpenAPIHono();
|
|
8
9
|
const logger = getLogger$1("evaluationRunConfigs");
|
|
10
|
+
app.use("/", async (c, next) => {
|
|
11
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
12
|
+
return next();
|
|
13
|
+
});
|
|
14
|
+
app.use("/:configId", async (c, next) => {
|
|
15
|
+
if (["PATCH", "DELETE"].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
|
|
16
|
+
return next();
|
|
17
|
+
});
|
|
9
18
|
app.openapi(createRoute({
|
|
10
19
|
method: "get",
|
|
11
20
|
path: "/",
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../../logger.js";
|
|
2
|
+
import { requireProjectPermission } from "../../../../middleware/projectAccess.js";
|
|
2
3
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
3
4
|
import { TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfigEvaluatorRelation, generateId, getEvaluationSuiteConfigEvaluatorRelations } from "@inkeep/agents-core";
|
|
4
5
|
|
|
5
6
|
//#region src/domains/manage/routes/evals/evaluationSuiteConfigEvaluatorRelations.ts
|
|
6
7
|
const app = new OpenAPIHono();
|
|
7
8
|
const logger = getLogger$1("evaluationSuiteConfigEvaluatorRelations");
|
|
9
|
+
app.use("/:configId/evaluators/:evaluatorId", async (c, next) => {
|
|
10
|
+
if (["POST", "DELETE"].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
|
|
11
|
+
return next();
|
|
12
|
+
});
|
|
8
13
|
app.openapi(createRoute({
|
|
9
14
|
method: "get",
|
|
10
15
|
path: "/{configId}/evaluators",
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../../logger.js";
|
|
2
|
+
import { requireProjectPermission } from "../../../../middleware/projectAccess.js";
|
|
2
3
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
3
4
|
import { EvaluationSuiteConfigApiInsertSchema, EvaluationSuiteConfigApiSelectSchema, EvaluationSuiteConfigApiUpdateSchema, ListResponseSchema, SingleResponseSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createEvaluationSuiteConfig, createEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfig, generateId, getEvaluationSuiteConfigById, listEvaluationSuiteConfigs, updateEvaluationSuiteConfig } from "@inkeep/agents-core";
|
|
4
5
|
|
|
5
6
|
//#region src/domains/manage/routes/evals/evaluationSuiteConfigs.ts
|
|
6
7
|
const app = new OpenAPIHono();
|
|
7
8
|
const logger = getLogger$1("evaluationSuiteConfigs");
|
|
9
|
+
app.use("/", async (c, next) => {
|
|
10
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
11
|
+
return next();
|
|
12
|
+
});
|
|
13
|
+
app.use("/:configId", async (c, next) => {
|
|
14
|
+
if (["PATCH", "DELETE"].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
|
|
15
|
+
return next();
|
|
16
|
+
});
|
|
8
17
|
app.openapi(createRoute({
|
|
9
18
|
method: "get",
|
|
10
19
|
path: "/",
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../../logger.js";
|
|
2
|
+
import { requireProjectPermission } from "../../../../middleware/projectAccess.js";
|
|
2
3
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
3
4
|
import { EvaluatorApiInsertSchema, EvaluatorApiSelectSchema, EvaluatorApiUpdateSchema, ListResponseSchema, SingleResponseSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createEvaluator, deleteEvaluator, generateId, getEvaluatorById, getEvaluatorsByIds, listEvaluators, updateEvaluator } from "@inkeep/agents-core";
|
|
4
5
|
|
|
5
6
|
//#region src/domains/manage/routes/evals/evaluators.ts
|
|
6
7
|
const app = new OpenAPIHono();
|
|
7
8
|
const logger = getLogger$1("evaluators");
|
|
9
|
+
app.use("/", async (c, next) => {
|
|
10
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
11
|
+
return next();
|
|
12
|
+
});
|
|
13
|
+
app.use("/:evaluatorId", async (c, next) => {
|
|
14
|
+
if (["PATCH", "DELETE"].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
|
|
15
|
+
return next();
|
|
16
|
+
});
|
|
8
17
|
app.openapi(createRoute({
|
|
9
18
|
method: "get",
|
|
10
19
|
path: "/",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
3
|
+
|
|
4
|
+
//#region src/domains/manage/routes/github.d.ts
|
|
5
|
+
declare const app: OpenAPIHono<{
|
|
6
|
+
Variables: ManageAppVariables;
|
|
7
|
+
}, {}, "/">;
|
|
8
|
+
declare const STATE_JWT_ISSUER = "inkeep-agents-api";
|
|
9
|
+
declare const STATE_JWT_AUDIENCE = "github-app-install";
|
|
10
|
+
/**
|
|
11
|
+
* Signs a JWT state token for the GitHub App installation flow.
|
|
12
|
+
* The state contains the tenantId and expires after 10 minutes.
|
|
13
|
+
*/
|
|
14
|
+
declare function signStateToken(tenantId: string): Promise<string>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { STATE_JWT_AUDIENCE, STATE_JWT_ISSUER, app as default, signStateToken };
|