@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
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../types/app.js";
|
|
2
|
-
import * as hono3 from "hono";
|
|
3
2
|
import { ProjectPermissionLevel } from "@inkeep/agents-core";
|
|
3
|
+
import * as hono5 from "hono";
|
|
4
4
|
|
|
5
5
|
//#region src/middleware/projectAccess.d.ts
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* Middleware to check project-level access.
|
|
9
|
-
*
|
|
10
|
-
* When ENABLE_AUTHZ is false:
|
|
11
|
-
* - 'view' permission: all org members can view
|
|
12
|
-
* - 'edit': only org owner/admin
|
|
13
|
-
*
|
|
14
|
-
* When ENABLE_AUTHZ is true:
|
|
15
|
-
* - Uses SpiceDB to check permissions
|
|
16
|
-
* - Org owner/admin bypass (handled in canViewProject etc.)
|
|
17
8
|
*/
|
|
18
9
|
declare const requireProjectPermission: <Env$1 extends {
|
|
19
10
|
Variables: ManageAppVariables;
|
|
20
11
|
} = {
|
|
21
12
|
Variables: ManageAppVariables;
|
|
22
|
-
}>(permission?: ProjectPermissionLevel) =>
|
|
13
|
+
}>(permission?: ProjectPermissionLevel) => hono5.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
23
14
|
//#endregion
|
|
24
15
|
export { requireProjectPermission };
|
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { canEditProject, canUseProject, canViewProject, createApiError, isAuthzEnabled } from "@inkeep/agents-core";
|
|
1
|
+
import { canEditProject, canUseProject, canViewProject, createApiError } from "@inkeep/agents-core";
|
|
3
2
|
import { createMiddleware } from "hono/factory";
|
|
4
3
|
import { HTTPException } from "hono/http-exception";
|
|
5
4
|
|
|
6
5
|
//#region src/middleware/projectAccess.ts
|
|
7
6
|
/**
|
|
8
7
|
* Middleware to check project-level access.
|
|
9
|
-
*
|
|
10
|
-
* When ENABLE_AUTHZ is false:
|
|
11
|
-
* - 'view' permission: all org members can view
|
|
12
|
-
* - 'edit': only org owner/admin
|
|
13
|
-
*
|
|
14
|
-
* When ENABLE_AUTHZ is true:
|
|
15
|
-
* - Uses SpiceDB to check permissions
|
|
16
|
-
* - Org owner/admin bypass (handled in canViewProject etc.)
|
|
17
8
|
*/
|
|
18
9
|
const requireProjectPermission = (permission = "view") => createMiddleware(async (c, next) => {
|
|
19
|
-
|
|
20
|
-
if (env.DISABLE_AUTH || isTestEnvironment) {
|
|
10
|
+
if (process.env.ENVIRONMENT === "test") {
|
|
21
11
|
await next();
|
|
22
12
|
return;
|
|
23
13
|
}
|
|
@@ -64,27 +54,11 @@ const requireProjectPermission = (permission = "view") => createMiddleware(async
|
|
|
64
54
|
});
|
|
65
55
|
break;
|
|
66
56
|
}
|
|
67
|
-
if (!hasAccess) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
73
|
-
throw createApiError({
|
|
74
|
-
code: "forbidden",
|
|
75
|
-
message: `Permission denied. Required: project:${permission}`,
|
|
76
|
-
instance: c.req.path,
|
|
77
|
-
extensions: {
|
|
78
|
-
requiredPermissions: [`project:${permission}`],
|
|
79
|
-
context: {
|
|
80
|
-
userId,
|
|
81
|
-
organizationId: tenantId,
|
|
82
|
-
projectId,
|
|
83
|
-
currentRole: tenantRole
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
57
|
+
if (!hasAccess) throw createApiError({
|
|
58
|
+
code: "not_found",
|
|
59
|
+
message: "Project not found",
|
|
60
|
+
instance: c.req.path
|
|
61
|
+
});
|
|
88
62
|
await next();
|
|
89
63
|
} catch (error) {
|
|
90
64
|
if (error instanceof HTTPException) throw error;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as hono1 from "hono";
|
|
2
1
|
import { BaseExecutionContext, ResolvedRef } from "@inkeep/agents-core";
|
|
2
|
+
import * as hono6 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/projectConfig.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Middleware that fetches the full project definition from the Management API
|
|
7
7
|
*/
|
|
8
|
-
declare const projectConfigMiddleware:
|
|
8
|
+
declare const projectConfigMiddleware: hono6.MiddlewareHandler<{
|
|
9
9
|
Variables: {
|
|
10
10
|
executionContext: BaseExecutionContext;
|
|
11
11
|
resolvedRef: ResolvedRef;
|
|
@@ -15,7 +15,7 @@ declare const projectConfigMiddleware: hono1.MiddlewareHandler<{
|
|
|
15
15
|
* Creates a middleware that applies project config fetching except for specified route patterns
|
|
16
16
|
* @param skipRouteCheck - Function that returns true if the route should skip the middleware
|
|
17
17
|
*/
|
|
18
|
-
declare const projectConfigMiddlewareExcept: (skipRouteCheck: (path: string) => boolean) =>
|
|
18
|
+
declare const projectConfigMiddlewareExcept: (skipRouteCheck: (path: string) => boolean) => hono6.MiddlewareHandler<{
|
|
19
19
|
Variables: {
|
|
20
20
|
executionContext: BaseExecutionContext;
|
|
21
21
|
resolvedRef: ResolvedRef;
|
package/dist/middleware/ref.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../types/app.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono9 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) =>
|
|
12
|
+
}>(permissions: Permission) => hono9.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { requirePermission };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { env } from "../env.js";
|
|
2
1
|
import { createApiError } from "@inkeep/agents-core";
|
|
3
2
|
import { createMiddleware } from "hono/factory";
|
|
4
3
|
import { HTTPException } from "hono/http-exception";
|
|
@@ -15,7 +14,7 @@ function formatPermissionsForDisplay(permissions) {
|
|
|
15
14
|
const requirePermission = (permissions) => createMiddleware(async (c, next) => {
|
|
16
15
|
const isTestEnvironment = process.env.ENVIRONMENT === "test";
|
|
17
16
|
const auth = c.get("auth");
|
|
18
|
-
if (
|
|
17
|
+
if (isTestEnvironment || !auth) {
|
|
19
18
|
await next();
|
|
20
19
|
return;
|
|
21
20
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as hono5 from "hono";
|
|
2
1
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
2
|
+
import * as hono10 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/runAuth.d.ts
|
|
5
|
-
declare const runApiKeyAuth: () =>
|
|
5
|
+
declare const runApiKeyAuth: () => hono10.MiddlewareHandler<{
|
|
6
6
|
Variables: {
|
|
7
7
|
executionContext: BaseExecutionContext;
|
|
8
8
|
};
|
|
@@ -11,7 +11,7 @@ declare const runApiKeyAuth: () => hono5.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) =>
|
|
14
|
+
declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) => hono10.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: () =>
|
|
23
|
+
declare const runOptionalAuth: () => hono10.MiddlewareHandler<{
|
|
24
24
|
Variables: {
|
|
25
25
|
executionContext?: BaseExecutionContext;
|
|
26
26
|
};
|
|
@@ -2,7 +2,7 @@ import { getLogger as getLogger$1 } from "../logger.js";
|
|
|
2
2
|
import { env } from "../env.js";
|
|
3
3
|
import runDbClient_default from "../data/db/runDbClient.js";
|
|
4
4
|
import { createBaseExecutionContext } from "../types/runExecutionContext.js";
|
|
5
|
-
import { validateAndGetApiKey, validateTargetAgent, verifyServiceToken, verifyTempToken } from "@inkeep/agents-core";
|
|
5
|
+
import { canUseProjectStrict, validateAndGetApiKey, validateTargetAgent, verifyServiceToken, verifyTempToken } from "@inkeep/agents-core";
|
|
6
6
|
import { createMiddleware } from "hono/factory";
|
|
7
7
|
import { HTTPException } from "hono/http-exception";
|
|
8
8
|
|
|
@@ -51,21 +51,56 @@ function buildExecutionContext(authResult, reqData) {
|
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Attempts to authenticate using a JWT temporary token
|
|
54
|
+
*
|
|
55
|
+
* Throws HTTPException(403) if the JWT is valid but the user lacks permission.
|
|
56
|
+
* Returns null if the token is not a temp JWT (allowing fallback to other auth methods).
|
|
54
57
|
*/
|
|
55
58
|
async function tryTempJwtAuth(apiKey) {
|
|
56
59
|
if (!apiKey.startsWith("eyJ") || !env.INKEEP_AGENTS_TEMP_JWT_PUBLIC_KEY) return null;
|
|
57
60
|
try {
|
|
58
61
|
const payload = await verifyTempToken(Buffer.from(env.INKEEP_AGENTS_TEMP_JWT_PUBLIC_KEY, "base64").toString("utf-8"), apiKey);
|
|
59
|
-
|
|
62
|
+
const userId = payload.sub;
|
|
63
|
+
const projectId = payload.projectId;
|
|
64
|
+
const agentId = payload.agentId;
|
|
65
|
+
if (!projectId || !agentId) {
|
|
66
|
+
logger.warn({ userId }, "Missing projectId or agentId in JWT");
|
|
67
|
+
throw new HTTPException(400, { message: "Invalid token: missing projectId or agentId" });
|
|
68
|
+
}
|
|
69
|
+
let canUse;
|
|
70
|
+
try {
|
|
71
|
+
canUse = await canUseProjectStrict({
|
|
72
|
+
userId,
|
|
73
|
+
projectId
|
|
74
|
+
});
|
|
75
|
+
} catch (error) {
|
|
76
|
+
logger.error({
|
|
77
|
+
error,
|
|
78
|
+
userId,
|
|
79
|
+
projectId
|
|
80
|
+
}, "SpiceDB permission check failed");
|
|
81
|
+
throw new HTTPException(503, { message: "Authorization service temporarily unavailable" });
|
|
82
|
+
}
|
|
83
|
+
if (!canUse) {
|
|
84
|
+
logger.warn({
|
|
85
|
+
userId,
|
|
86
|
+
projectId
|
|
87
|
+
}, "User does not have use permission on project");
|
|
88
|
+
throw new HTTPException(403, { message: "Access denied: insufficient permissions" });
|
|
89
|
+
}
|
|
90
|
+
logger.info({
|
|
91
|
+
projectId,
|
|
92
|
+
agentId
|
|
93
|
+
}, "JWT temp token authenticated successfully");
|
|
60
94
|
return {
|
|
61
95
|
apiKey,
|
|
62
96
|
tenantId: payload.tenantId,
|
|
63
|
-
projectId
|
|
64
|
-
agentId
|
|
97
|
+
projectId,
|
|
98
|
+
agentId,
|
|
65
99
|
apiKeyId: "temp-jwt",
|
|
66
100
|
metadata: { initiatedBy: payload.initiatedBy }
|
|
67
101
|
};
|
|
68
102
|
} catch (error) {
|
|
103
|
+
if (error instanceof HTTPException) throw error;
|
|
69
104
|
logger.debug({ error }, "JWT verification failed");
|
|
70
105
|
return null;
|
|
71
106
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono13 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/sessionAuth.d.ts
|
|
4
4
|
|
|
@@ -7,11 +7,11 @@ import * as hono8 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: () =>
|
|
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: () =>
|
|
15
|
+
declare const sessionContext: () => hono13.MiddlewareHandler<any, string, {}, Response>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { sessionAuth, sessionContext };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { env } from "../env.js";
|
|
2
1
|
import { createApiError } from "@inkeep/agents-core";
|
|
3
2
|
import { createMiddleware } from "hono/factory";
|
|
4
3
|
import { HTTPException } from "hono/http-exception";
|
|
@@ -33,7 +32,7 @@ const sessionAuth = () => createMiddleware(async (c, next) => {
|
|
|
33
32
|
*/
|
|
34
33
|
const sessionContext = () => createMiddleware(async (c, next) => {
|
|
35
34
|
const auth = c.get("auth");
|
|
36
|
-
if (
|
|
35
|
+
if (!auth) {
|
|
37
36
|
c.set("user", null);
|
|
38
37
|
c.set("session", null);
|
|
39
38
|
await next();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono16 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tracing.d.ts
|
|
4
|
-
declare const otelBaggageMiddleware: () =>
|
|
5
|
-
declare const executionBaggageMiddleware: () =>
|
|
4
|
+
declare const otelBaggageMiddleware: () => hono16.MiddlewareHandler<any, string, {}, Response>;
|
|
5
|
+
declare const executionBaggageMiddleware: () => hono16.MiddlewareHandler<any, string, {}, Response>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { executionBaggageMiddleware, otelBaggageMiddleware };
|
package/dist/openapi.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare const TagToDescription: {
|
|
|
19
19
|
'External Agents': string;
|
|
20
20
|
'Function Tools': string;
|
|
21
21
|
Functions: string;
|
|
22
|
-
|
|
22
|
+
GitHub: string;
|
|
23
23
|
MCP: string;
|
|
24
24
|
'MCP Catalog': string;
|
|
25
25
|
OAuth: string;
|
|
@@ -31,7 +31,6 @@ declare const TagToDescription: {
|
|
|
31
31
|
'Third-Party MCP Servers': string;
|
|
32
32
|
Tools: string;
|
|
33
33
|
Triggers: string;
|
|
34
|
-
'User Organizations': string;
|
|
35
34
|
'User Project Memberships': string;
|
|
36
35
|
Webhooks: string;
|
|
37
36
|
Workflows: string;
|
package/dist/openapi.js
CHANGED
|
@@ -18,7 +18,7 @@ const TagToDescription = {
|
|
|
18
18
|
"External Agents": "Operations for managing external agents",
|
|
19
19
|
"Function Tools": "Operations for managing function tools",
|
|
20
20
|
Functions: "Operations for managing functions",
|
|
21
|
-
|
|
21
|
+
GitHub: "GitHub App integration endpoints",
|
|
22
22
|
MCP: "MCP (Model Context Protocol) endpoints",
|
|
23
23
|
"MCP Catalog": "Operations for MCP catalog",
|
|
24
24
|
OAuth: "OAuth authentication endpoints",
|
|
@@ -30,7 +30,6 @@ const TagToDescription = {
|
|
|
30
30
|
"Third-Party MCP Servers": "Operations for managing third-party MCP servers",
|
|
31
31
|
Tools: "Operations for managing MCP tools",
|
|
32
32
|
Triggers: "Operations for managing triggers",
|
|
33
|
-
"User Organizations": "Operations for managing user organizations",
|
|
34
33
|
"User Project Memberships": "Operations for managing user project memberships",
|
|
35
34
|
Webhooks: "Webhook endpoints",
|
|
36
35
|
Workflows: "Workflow trigger endpoints"
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { env } from "../env.js";
|
|
2
|
+
|
|
1
3
|
//#region src/types/runExecutionContext.ts
|
|
2
4
|
/**
|
|
3
5
|
* Extract userId from execution context metadata (when available)
|
|
@@ -16,7 +18,7 @@ function createBaseExecutionContext(params) {
|
|
|
16
18
|
tenantId: params.tenantId,
|
|
17
19
|
projectId: params.projectId,
|
|
18
20
|
agentId: params.agentId,
|
|
19
|
-
baseUrl: params.baseUrl ||
|
|
21
|
+
baseUrl: params.baseUrl || env.INKEEP_AGENTS_API_URL,
|
|
20
22
|
apiKeyId: params.apiKeyId,
|
|
21
23
|
subAgentId: params.subAgentId,
|
|
22
24
|
ref: params.ref,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "Unified Inkeep Agents API - combines management, runtime, and evaluation capabilities",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -66,9 +66,10 @@
|
|
|
66
66
|
"openid-client": "^6.8.1",
|
|
67
67
|
"pg": "^8.16.3",
|
|
68
68
|
"workflow": "4.0.1-beta.33",
|
|
69
|
-
"@inkeep/agents-core": "^0.
|
|
70
|
-
"@inkeep/agents-mcp": "^0.
|
|
71
|
-
"@inkeep/agents-
|
|
69
|
+
"@inkeep/agents-core": "^0.45.0",
|
|
70
|
+
"@inkeep/agents-manage-mcp": "^0.45.0",
|
|
71
|
+
"@inkeep/agents-mcp": "^0.45.0",
|
|
72
|
+
"@inkeep/agents-work-apps": "^0.45.0"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
75
|
"@hono/zod-openapi": "^1.1.5",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
|
|
3
|
-
//#region src/domains/github/config.d.ts
|
|
4
|
-
declare const GitHubAppConfigSchema: z.ZodObject<{
|
|
5
|
-
appId: z.ZodString;
|
|
6
|
-
privateKey: z.ZodString;
|
|
7
|
-
}, z.core.$strip>;
|
|
8
|
-
type GitHubAppConfig = z.infer<typeof GitHubAppConfigSchema>;
|
|
9
|
-
declare function getGitHubAppConfig(): GitHubAppConfig;
|
|
10
|
-
declare function isGitHubAppConfigured(): boolean;
|
|
11
|
-
declare function validateGitHubAppConfigOnStartup(): void;
|
|
12
|
-
declare function clearConfigCache(): void;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { GitHubAppConfig, clearConfigCache, getGitHubAppConfig, isGitHubAppConfigured, validateGitHubAppConfigOnStartup };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { getLogger } from "../../logger.js";
|
|
2
|
-
import { z } from "@hono/zod-openapi";
|
|
3
|
-
|
|
4
|
-
//#region src/domains/github/config.ts
|
|
5
|
-
const logger = getLogger("github-config");
|
|
6
|
-
const GitHubAppConfigSchema = z.object({
|
|
7
|
-
appId: z.string().min(1, "GITHUB_APP_ID is required"),
|
|
8
|
-
privateKey: z.string().min(1, "GITHUB_APP_PRIVATE_KEY is required")
|
|
9
|
-
});
|
|
10
|
-
let cachedConfig = null;
|
|
11
|
-
function getGitHubAppConfig() {
|
|
12
|
-
if (cachedConfig) return cachedConfig;
|
|
13
|
-
const appId = process.env.GITHUB_APP_ID;
|
|
14
|
-
const privateKey = process.env.GITHUB_APP_PRIVATE_KEY?.replace(/\\n/g, "\n");
|
|
15
|
-
const result = GitHubAppConfigSchema.safeParse({
|
|
16
|
-
appId,
|
|
17
|
-
privateKey
|
|
18
|
-
});
|
|
19
|
-
if (!result.success) {
|
|
20
|
-
const errorMessage = `GitHub App credentials are not configured. ${result.error.issues.map((issue) => issue.message).join(". ")}. Please set GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY environment variables.`;
|
|
21
|
-
logger.error({}, errorMessage);
|
|
22
|
-
throw new Error(errorMessage);
|
|
23
|
-
}
|
|
24
|
-
cachedConfig = result.data;
|
|
25
|
-
logger.info({}, "GitHub App credentials loaded successfully");
|
|
26
|
-
return cachedConfig;
|
|
27
|
-
}
|
|
28
|
-
function isGitHubAppConfigured() {
|
|
29
|
-
return Boolean(process.env.GITHUB_APP_ID && process.env.GITHUB_APP_PRIVATE_KEY);
|
|
30
|
-
}
|
|
31
|
-
function validateGitHubAppConfigOnStartup() {
|
|
32
|
-
if (!isGitHubAppConfigured()) {
|
|
33
|
-
logger.warn({}, "GitHub App credentials not configured. Token exchange endpoint will return 500 errors. Set GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY to enable the feature.");
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
getGitHubAppConfig();
|
|
38
|
-
} catch (error) {
|
|
39
|
-
logger.error({ error }, "GitHub App credentials are invalid. Token exchange endpoint will return 500 errors.");
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function clearConfigCache() {
|
|
43
|
-
cachedConfig = null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
export { clearConfigCache, getGitHubAppConfig, isGitHubAppConfigured, validateGitHubAppConfigOnStartup };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { GitHubAppConfig, getGitHubAppConfig, isGitHubAppConfigured } from "./config.js";
|
|
2
|
-
import { GenerateInstallationAccessTokenResult, GenerateTokenError, GenerateTokenResult, InstallationAccessToken, InstallationInfo, LookupInstallationError, LookupInstallationForRepoResult, LookupInstallationResult, generateInstallationAccessToken, lookupInstallationForRepo } from "./installation.js";
|
|
3
|
-
import { GetJwkResult, JwksError, JwksResult, clearJwksCache, getJwkForToken, getJwksCacheStatus } from "./jwks.js";
|
|
4
|
-
import { GitHubOidcClaims, ValidateOidcTokenResult, ValidateTokenError, ValidateTokenResult, validateOidcToken } from "./oidcToken.js";
|
|
5
|
-
import { Hono } from "hono";
|
|
6
|
-
import * as hono_types5 from "hono/types";
|
|
7
|
-
|
|
8
|
-
//#region src/domains/github/index.d.ts
|
|
9
|
-
declare function createGithubRoutes(): Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
|
|
10
|
-
declare const githubRoutes: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
|
|
11
|
-
//#endregion
|
|
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,18 +0,0 @@
|
|
|
1
|
-
import { getGitHubAppConfig, isGitHubAppConfigured, validateGitHubAppConfigOnStartup } from "./config.js";
|
|
2
|
-
import { generateInstallationAccessToken, lookupInstallationForRepo } from "./installation.js";
|
|
3
|
-
import { clearJwksCache, getJwkForToken, getJwksCacheStatus } from "./jwks.js";
|
|
4
|
-
import { validateOidcToken } from "./oidcToken.js";
|
|
5
|
-
import tokenExchange_default from "./routes/tokenExchange.js";
|
|
6
|
-
import { Hono } from "hono";
|
|
7
|
-
|
|
8
|
-
//#region src/domains/github/index.ts
|
|
9
|
-
function createGithubRoutes() {
|
|
10
|
-
validateGitHubAppConfigOnStartup();
|
|
11
|
-
const app = new Hono();
|
|
12
|
-
app.route("/token-exchange", tokenExchange_default);
|
|
13
|
-
return app;
|
|
14
|
-
}
|
|
15
|
-
const githubRoutes = createGithubRoutes();
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { clearJwksCache, createGithubRoutes, generateInstallationAccessToken, getGitHubAppConfig, getJwkForToken, getJwksCacheStatus, githubRoutes, isGitHubAppConfigured, lookupInstallationForRepo, validateOidcToken };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
//#region src/domains/github/installation.d.ts
|
|
2
|
-
interface InstallationInfo {
|
|
3
|
-
installationId: number;
|
|
4
|
-
accountLogin: string;
|
|
5
|
-
accountType: 'User' | 'Organization';
|
|
6
|
-
}
|
|
7
|
-
interface LookupInstallationResult {
|
|
8
|
-
success: true;
|
|
9
|
-
installation: InstallationInfo;
|
|
10
|
-
}
|
|
11
|
-
interface LookupInstallationError {
|
|
12
|
-
success: false;
|
|
13
|
-
errorType: 'not_installed' | 'api_error' | 'jwt_error';
|
|
14
|
-
message: string;
|
|
15
|
-
}
|
|
16
|
-
type LookupInstallationForRepoResult = LookupInstallationResult | LookupInstallationError;
|
|
17
|
-
interface InstallationAccessToken {
|
|
18
|
-
token: string;
|
|
19
|
-
expiresAt: string;
|
|
20
|
-
}
|
|
21
|
-
interface GenerateTokenResult {
|
|
22
|
-
success: true;
|
|
23
|
-
accessToken: InstallationAccessToken;
|
|
24
|
-
}
|
|
25
|
-
interface GenerateTokenError {
|
|
26
|
-
success: false;
|
|
27
|
-
errorType: 'api_error' | 'jwt_error';
|
|
28
|
-
message: string;
|
|
29
|
-
}
|
|
30
|
-
type GenerateInstallationAccessTokenResult = GenerateTokenResult | GenerateTokenError;
|
|
31
|
-
declare function lookupInstallationForRepo(repositoryOwner: string, repositoryName: string): Promise<LookupInstallationForRepoResult>;
|
|
32
|
-
declare function generateInstallationAccessToken(installationId: number): Promise<GenerateInstallationAccessTokenResult>;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { GenerateInstallationAccessTokenResult, GenerateTokenError, GenerateTokenResult, InstallationAccessToken, InstallationInfo, LookupInstallationError, LookupInstallationForRepoResult, LookupInstallationResult, generateInstallationAccessToken, lookupInstallationForRepo };
|