@inkeep/agents-api 0.0.0-dev-20260219033751 → 0.0.0-dev-20260219045007
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.json +34 -34
- package/dist/createApp.js +16 -90
- package/dist/data/db/manageDbClient.d.ts +2 -2
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/datasetTriggers.js +5 -2
- package/dist/domains/evals/routes/evaluationTriggers.js +9 -4
- 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 +4 -0
- package/dist/domains/manage/routes/agent.js +16 -20
- package/dist/domains/manage/routes/agentFull.js +10 -17
- package/dist/domains/manage/routes/apiKeys.js +12 -14
- package/dist/domains/manage/routes/artifactComponents.js +12 -15
- package/dist/domains/manage/routes/availableAgents.d.ts +2 -2
- package/dist/domains/manage/routes/availableAgents.js +4 -2
- package/dist/domains/manage/routes/branches.js +12 -14
- package/dist/domains/manage/routes/cliAuth.js +4 -3
- package/dist/domains/manage/routes/contextConfigs.js +12 -15
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/conversations.js +5 -2
- package/dist/domains/manage/routes/credentialStores.js +7 -8
- package/dist/domains/manage/routes/credentials.js +12 -14
- package/dist/domains/manage/routes/dataComponents.js +12 -14
- package/dist/domains/manage/routes/evals/datasetItems.js +14 -19
- package/dist/domains/manage/routes/evals/datasetRunConfigs.js +13 -6
- package/dist/domains/manage/routes/evals/datasetRuns.js +7 -3
- package/dist/domains/manage/routes/evals/datasets.js +12 -14
- package/dist/domains/manage/routes/evals/evaluationJobConfigEvaluatorRelations.js +8 -8
- package/dist/domains/manage/routes/evals/evaluationJobConfigs.js +12 -14
- package/dist/domains/manage/routes/evals/evaluationResults.js +10 -13
- package/dist/domains/manage/routes/evals/evaluationRunConfigs.js +14 -15
- package/dist/domains/manage/routes/evals/evaluationSuiteConfigEvaluatorRelations.js +8 -8
- package/dist/domains/manage/routes/evals/evaluationSuiteConfigs.js +12 -14
- package/dist/domains/manage/routes/evals/evaluators.js +14 -15
- package/dist/domains/manage/routes/externalAgents.js +12 -14
- package/dist/domains/manage/routes/functionTools.js +12 -15
- package/dist/domains/manage/routes/functions.js +12 -15
- package/dist/domains/manage/routes/github.js +16 -8
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/index.js +0 -4
- package/dist/domains/manage/routes/invitations.d.ts +2 -2
- package/dist/domains/manage/routes/mcpCatalog.js +5 -2
- package/dist/domains/manage/routes/mcpToolGithubAccess.js +6 -4
- package/dist/domains/manage/routes/oauth.js +6 -66
- package/dist/domains/manage/routes/passwordResetLinks.d.ts +2 -2
- package/dist/domains/manage/routes/playgroundToken.js +4 -2
- package/dist/domains/manage/routes/projectFull.js +13 -26
- package/dist/domains/manage/routes/projectGithubAccess.js +7 -3
- package/dist/domains/manage/routes/projectMembers.js +14 -13
- package/dist/domains/manage/routes/projectPermissions.js +5 -2
- package/dist/domains/manage/routes/projects.js +12 -16
- package/dist/domains/manage/routes/ref.js +5 -2
- package/dist/domains/manage/routes/scheduledTriggers.js +24 -21
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/skills.js +12 -15
- package/dist/domains/manage/routes/subAgentArtifactComponents.js +12 -14
- package/dist/domains/manage/routes/subAgentDataComponents.js +12 -14
- package/dist/domains/manage/routes/subAgentExternalAgentRelations.js +12 -15
- package/dist/domains/manage/routes/subAgentFunctionTools.js +12 -14
- package/dist/domains/manage/routes/subAgentRelations.js +12 -15
- package/dist/domains/manage/routes/subAgentSkills.js +8 -12
- package/dist/domains/manage/routes/subAgentTeamAgentRelations.js +12 -15
- package/dist/domains/manage/routes/subAgentToolRelations.js +14 -16
- package/dist/domains/manage/routes/subAgents.js +12 -15
- package/dist/domains/manage/routes/thirdPartyMCPServers.js +7 -3
- package/dist/domains/manage/routes/tools.js +79 -16
- package/dist/domains/manage/routes/triggers.js +18 -22
- package/dist/domains/manage/routes/userProjectMemberships.js +5 -3
- package/dist/domains/manage/routes/users.d.ts +2 -2
- package/dist/domains/mcp/routes/mcp.d.ts +2 -2
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/routes/agents.js +4 -2
- package/dist/domains/run/routes/chat.js +4 -2
- package/dist/domains/run/routes/chatDataStream.js +6 -3
- package/dist/domains/run/routes/mcp.js +4 -2
- package/dist/domains/run/routes/webhooks.js +5 -3
- package/dist/domains/run/tools/distill-conversation-history-tool.d.ts +1 -1
- package/dist/domains/run/types/chat.d.ts +4 -4
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/domains/run/workflow/steps/scheduledTriggerSteps.d.ts +5 -5
- package/dist/factory.d.ts +21 -21
- package/dist/index.d.ts +18 -18
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/evalsAuth.js +37 -32
- package/dist/middleware/index.d.ts +2 -3
- package/dist/middleware/index.js +3 -4
- package/dist/middleware/manageAuth.d.ts +9 -4
- package/dist/middleware/manageAuth.js +24 -2
- package/dist/middleware/projectAccess.d.ts +4 -3
- package/dist/middleware/projectAccess.js +78 -64
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/ref.d.ts +1 -5
- package/dist/middleware/ref.js +1 -21
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/requirePermission.js +64 -64
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/sessionAuth.js +23 -18
- package/dist/middleware/tenantAccess.d.ts +3 -2
- package/dist/middleware/tenantAccess.js +12 -1
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/middleware/tracing.js +1 -1
- package/dist/routes/capabilities.d.ts +10 -0
- package/dist/routes/capabilities.js +35 -0
- package/dist/routes/healthChecks.js +6 -3
- package/dist/routes/workflowProcess.d.ts +10 -0
- package/dist/routes/workflowProcess.js +23 -0
- package/dist/types/app.d.ts +3 -3
- package/package.json +4 -4
package/dist/middleware/ref.js
CHANGED
|
@@ -214,26 +214,6 @@ const runRefMiddleware = createRefMiddleware(manageDbClient_default, {
|
|
|
214
214
|
extractProjectId: extractProjectIdFromExecutionContext,
|
|
215
215
|
allowProjectIdFromBody: false
|
|
216
216
|
});
|
|
217
|
-
/**
|
|
218
|
-
* Extract tenantId from query parameters (for OAuth routes)
|
|
219
|
-
*/
|
|
220
|
-
const extractTenantIdFromQuery = (c) => {
|
|
221
|
-
return c.req.query("tenantId");
|
|
222
|
-
};
|
|
223
|
-
/**
|
|
224
|
-
* Extract projectId from query parameters (for OAuth routes)
|
|
225
|
-
*/
|
|
226
|
-
const extractProjectIdFromQuery = (c) => {
|
|
227
|
-
return c.req.query("projectId");
|
|
228
|
-
};
|
|
229
|
-
/**
|
|
230
|
-
* Ref middleware for OAuth routes - extracts tenant/project from query params
|
|
231
|
-
*/
|
|
232
|
-
const oauthRefMiddleware = createRefMiddleware(manageDbClient_default, {
|
|
233
|
-
extractTenantId: extractTenantIdFromQuery,
|
|
234
|
-
extractProjectId: extractProjectIdFromQuery,
|
|
235
|
-
allowProjectIdFromBody: false
|
|
236
|
-
});
|
|
237
217
|
|
|
238
218
|
//#endregion
|
|
239
|
-
export { createRefMiddleware, manageRefMiddleware,
|
|
219
|
+
export { createRefMiddleware, manageRefMiddleware, runRefMiddleware, writeProtectionMiddleware };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../types/app.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono11 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) => hono11.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { requirePermission };
|
|
@@ -1,79 +1,79 @@
|
|
|
1
1
|
import { createApiError } from "@inkeep/agents-core";
|
|
2
|
+
import { registerAuthzMeta } from "@inkeep/agents-core/middleware";
|
|
2
3
|
import { createMiddleware } from "hono/factory";
|
|
3
4
|
import { HTTPException } from "hono/http-exception";
|
|
4
5
|
|
|
5
6
|
//#region src/middleware/requirePermission.ts
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
const requirePermission = (permissions) => createMiddleware(async (c, next) => {
|
|
15
|
-
const isTestEnvironment = process.env.ENVIRONMENT === "test";
|
|
16
|
-
const auth = c.get("auth");
|
|
17
|
-
if (isTestEnvironment || !auth) {
|
|
18
|
-
await next();
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const userId = c.get("userId");
|
|
22
|
-
const tenantId = c.get("tenantId");
|
|
23
|
-
const tenantRole = c.get("tenantRole");
|
|
24
|
-
const requiredPermissions = formatPermissionsForDisplay(permissions);
|
|
25
|
-
if (userId === "system" || userId?.startsWith("apikey:")) {
|
|
26
|
-
await next();
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (!userId || !tenantId) throw createApiError({
|
|
30
|
-
code: "unauthorized",
|
|
31
|
-
message: "User or organization context not found. Ensure you are authenticated and belong to an organization.",
|
|
32
|
-
instance: c.req.path,
|
|
33
|
-
extensions: {
|
|
34
|
-
requiredPermissions,
|
|
35
|
-
context: {
|
|
36
|
-
hasUserId: !!userId,
|
|
37
|
-
hasTenantId: !!tenantId
|
|
38
|
-
}
|
|
7
|
+
const requirePermission = (permissions) => {
|
|
8
|
+
const mw = createMiddleware(async (c, next) => {
|
|
9
|
+
const isTestEnvironment = process.env.ENVIRONMENT === "test";
|
|
10
|
+
const auth = c.get("auth");
|
|
11
|
+
if (isTestEnvironment || !auth) {
|
|
12
|
+
await next();
|
|
13
|
+
return;
|
|
39
14
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
code: "forbidden",
|
|
51
|
-
message: `Permission denied. Required: ${requiredPermissions.join(", ")}`,
|
|
15
|
+
const userId = c.get("userId");
|
|
16
|
+
const tenantId = c.get("tenantId");
|
|
17
|
+
const tenantRole = c.get("tenantRole");
|
|
18
|
+
if (userId === "system" || userId?.startsWith("apikey:")) {
|
|
19
|
+
await next();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!userId || !tenantId) throw createApiError({
|
|
23
|
+
code: "unauthorized",
|
|
24
|
+
message: "User or organization context not found. Ensure you are authenticated and belong to an organization.",
|
|
52
25
|
instance: c.req.path,
|
|
53
26
|
extensions: {
|
|
54
|
-
|
|
27
|
+
permissions,
|
|
55
28
|
context: {
|
|
56
|
-
userId,
|
|
57
|
-
|
|
58
|
-
currentRole: tenantRole || "unknown"
|
|
29
|
+
hasUserId: !!userId,
|
|
30
|
+
hasTenantId: !!tenantId
|
|
59
31
|
}
|
|
60
32
|
}
|
|
61
33
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
34
|
+
try {
|
|
35
|
+
const result = await auth.api.hasPermission({
|
|
36
|
+
body: {
|
|
37
|
+
permissions,
|
|
38
|
+
organizationId: tenantId
|
|
39
|
+
},
|
|
40
|
+
headers: c.req.raw.headers
|
|
41
|
+
});
|
|
42
|
+
if (!result || !result.success) throw createApiError({
|
|
43
|
+
code: "forbidden",
|
|
44
|
+
message: "Permission denied. Required: organization admin.",
|
|
45
|
+
instance: c.req.path,
|
|
46
|
+
extensions: {
|
|
47
|
+
permissions,
|
|
48
|
+
context: {
|
|
49
|
+
userId,
|
|
50
|
+
organizationId: tenantId,
|
|
51
|
+
currentRole: tenantRole || "unknown"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
await next();
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (error instanceof HTTPException) throw error;
|
|
58
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
59
|
+
throw createApiError({
|
|
60
|
+
code: "internal_server_error",
|
|
61
|
+
message: "Failed to verify permissions",
|
|
62
|
+
instance: c.req.path,
|
|
63
|
+
extensions: {
|
|
64
|
+
permissions,
|
|
65
|
+
internalError: errorMessage
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
registerAuthzMeta(mw, {
|
|
71
|
+
resource: "organization",
|
|
72
|
+
permission: "admin",
|
|
73
|
+
description: "Requires organization admin role"
|
|
74
|
+
});
|
|
75
|
+
return mw;
|
|
76
|
+
};
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
79
|
export { requirePermission };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono3 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/runAuth.d.ts
|
|
5
|
-
declare const runApiKeyAuth: () =>
|
|
5
|
+
declare const runApiKeyAuth: () => hono3.MiddlewareHandler<{
|
|
6
6
|
Variables: {
|
|
7
7
|
executionContext: BaseExecutionContext;
|
|
8
8
|
};
|
|
@@ -11,7 +11,7 @@ declare const runApiKeyAuth: () => hono0.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) => hono3.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: () => hono3.MiddlewareHandler<{
|
|
24
24
|
Variables: {
|
|
25
25
|
executionContext?: BaseExecutionContext;
|
|
26
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono12 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/sessionAuth.d.ts
|
|
4
4
|
|
|
@@ -7,11 +7,11 @@ import * as hono13 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: () => hono12.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: () => hono12.MiddlewareHandler<any, string, {}, Response>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { sessionAuth, sessionContext };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createApiError } from "@inkeep/agents-core";
|
|
2
|
+
import { registerAuthzMeta } from "@inkeep/agents-core/middleware";
|
|
2
3
|
import { createMiddleware } from "hono/factory";
|
|
3
4
|
import { HTTPException } from "hono/http-exception";
|
|
4
5
|
|
|
@@ -8,24 +9,28 @@ import { HTTPException } from "hono/http-exception";
|
|
|
8
9
|
* Requires that a user has already been authenticated via Better Auth session.
|
|
9
10
|
* Used primarily for manage routes that require an active user session.
|
|
10
11
|
*/
|
|
11
|
-
const sessionAuth = () =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
12
|
+
const sessionAuth = () => {
|
|
13
|
+
const mw = createMiddleware(async (c, next) => {
|
|
14
|
+
try {
|
|
15
|
+
const user = c.get("user");
|
|
16
|
+
if (!user) throw createApiError({
|
|
17
|
+
code: "unauthorized",
|
|
18
|
+
message: "Please log in to access this resource"
|
|
19
|
+
});
|
|
20
|
+
c.set("userId", user.id);
|
|
21
|
+
c.set("userEmail", user.email);
|
|
22
|
+
await next();
|
|
23
|
+
} catch (error) {
|
|
24
|
+
if (error instanceof HTTPException) throw error;
|
|
25
|
+
throw createApiError({
|
|
26
|
+
code: "unauthorized",
|
|
27
|
+
message: "Authentication failed"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
registerAuthzMeta(mw, { description: "Requires an active user session (cookie-based)" });
|
|
32
|
+
return mw;
|
|
33
|
+
};
|
|
29
34
|
/**
|
|
30
35
|
* Global session middleware - sets user and session in context for all routes
|
|
31
36
|
* Used for all routes that require an active user session.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono6 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tenantAccess.d.ts
|
|
4
4
|
|
|
@@ -7,11 +7,12 @@ import * as hono17 from "hono";
|
|
|
7
7
|
* Verifies that the authenticated user has access to the requested tenant/organization.
|
|
8
8
|
*
|
|
9
9
|
* Access rules:
|
|
10
|
+
* - Test environment: Grants anonymous owner access (bypasses all checks)
|
|
10
11
|
* - System user (bypass auth): Full access to all tenants
|
|
11
12
|
* - API key user: Access only to the tenant associated with the API key
|
|
12
13
|
* - Session user: Access based on organization membership
|
|
13
14
|
*/
|
|
14
|
-
declare const requireTenantAccess: () =>
|
|
15
|
+
declare const requireTenantAccess: () => hono6.MiddlewareHandler<{
|
|
15
16
|
Variables: {
|
|
16
17
|
userId: string;
|
|
17
18
|
tenantId: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { env } from "../env.js";
|
|
1
2
|
import runDbClient_default from "../data/db/runDbClient.js";
|
|
2
3
|
import { OrgRoles, createApiError, getUserOrganizationsFromDb } from "@inkeep/agents-core";
|
|
3
4
|
import { createMiddleware } from "hono/factory";
|
|
@@ -9,13 +10,23 @@ import { HTTPException } from "hono/http-exception";
|
|
|
9
10
|
* Verifies that the authenticated user has access to the requested tenant/organization.
|
|
10
11
|
*
|
|
11
12
|
* Access rules:
|
|
13
|
+
* - Test environment: Grants anonymous owner access (bypasses all checks)
|
|
12
14
|
* - System user (bypass auth): Full access to all tenants
|
|
13
15
|
* - API key user: Access only to the tenant associated with the API key
|
|
14
16
|
* - Session user: Access based on organization membership
|
|
15
17
|
*/
|
|
16
18
|
const requireTenantAccess = () => createMiddleware(async (c, next) => {
|
|
17
|
-
const userId = c.get("userId");
|
|
18
19
|
const tenantId = c.req.param("tenantId");
|
|
20
|
+
if (env.ENVIRONMENT === "test") {
|
|
21
|
+
if (tenantId) {
|
|
22
|
+
c.set("tenantId", tenantId);
|
|
23
|
+
c.set("userId", "anonymous");
|
|
24
|
+
c.set("tenantRole", OrgRoles.OWNER);
|
|
25
|
+
}
|
|
26
|
+
await next();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const userId = c.get("userId");
|
|
19
30
|
if (!userId) throw createApiError({
|
|
20
31
|
code: "unauthorized",
|
|
21
32
|
message: "User ID not found"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono7 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tracing.d.ts
|
|
4
|
-
declare const otelBaggageMiddleware: () =>
|
|
5
|
-
declare const executionBaggageMiddleware: () =>
|
|
4
|
+
declare const otelBaggageMiddleware: () => hono7.MiddlewareHandler<any, string, {}, Response>;
|
|
5
|
+
declare const executionBaggageMiddleware: () => hono7.MiddlewareHandler<any, string, {}, Response>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { executionBaggageMiddleware, otelBaggageMiddleware };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getLogger } from "../logger.js";
|
|
2
|
-
import { context, propagation } from "@opentelemetry/api";
|
|
3
2
|
import { createMiddleware } from "hono/factory";
|
|
3
|
+
import { context, propagation } from "@opentelemetry/api";
|
|
4
4
|
|
|
5
5
|
//#region src/middleware/tracing.ts
|
|
6
6
|
const logger = getLogger("tracing-middleware");
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AppVariables } from "../types/app.js";
|
|
2
|
+
import "../types/index.js";
|
|
3
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
4
|
+
|
|
5
|
+
//#region src/routes/capabilities.d.ts
|
|
6
|
+
declare const capabilitiesHandler: OpenAPIHono<{
|
|
7
|
+
Variables: AppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { capabilitiesHandler };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { manageApiKeyOrSessionAuth } from "../middleware/manageAuth.js";
|
|
2
|
+
import "../middleware/index.js";
|
|
3
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
4
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
5
|
+
|
|
6
|
+
//#region src/routes/capabilities.ts
|
|
7
|
+
const capabilitiesHandler = new OpenAPIHono();
|
|
8
|
+
const CapabilitiesResponseSchema = z.object({ sandbox: z.object({
|
|
9
|
+
configured: z.boolean().describe("Whether a sandbox provider is configured. Required for Function Tools execution."),
|
|
10
|
+
provider: z.enum(["native", "vercel"]).optional().describe("The configured sandbox provider, if enabled."),
|
|
11
|
+
runtime: z.enum(["node22", "typescript"]).optional().describe("The configured sandbox runtime, if enabled.")
|
|
12
|
+
}).describe("Sandbox execution capabilities (used by Function Tools).") }).describe("Optional server capabilities and configuration.").openapi("CapabilitiesResponseSchema");
|
|
13
|
+
capabilitiesHandler.openapi(createProtectedRoute({
|
|
14
|
+
method: "get",
|
|
15
|
+
path: "/",
|
|
16
|
+
operationId: "capabilities",
|
|
17
|
+
summary: "Get server capabilities",
|
|
18
|
+
description: "Get information about optional server-side capabilities and configuration.",
|
|
19
|
+
permission: manageApiKeyOrSessionAuth(),
|
|
20
|
+
responses: { 200: {
|
|
21
|
+
description: "Server capabilities",
|
|
22
|
+
content: { "application/json": { schema: CapabilitiesResponseSchema } }
|
|
23
|
+
} }
|
|
24
|
+
}), (c) => {
|
|
25
|
+
const sandboxConfig = c.get("sandboxConfig");
|
|
26
|
+
if (!sandboxConfig) return c.json({ sandbox: { configured: false } });
|
|
27
|
+
return c.json({ sandbox: {
|
|
28
|
+
configured: true,
|
|
29
|
+
provider: sandboxConfig.provider,
|
|
30
|
+
runtime: sandboxConfig.runtime
|
|
31
|
+
} });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { capabilitiesHandler };
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import manageDbPool_default from "../data/db/manageDbPool.js";
|
|
2
2
|
import runDbClient_default from "../data/db/runDbClient.js";
|
|
3
3
|
import { checkManageDb, checkRunDb } from "../utils/healthChecks.js";
|
|
4
|
-
import { OpenAPIHono,
|
|
4
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
5
|
+
import { createProtectedRoute, noAuth } from "@inkeep/agents-core/middleware";
|
|
5
6
|
|
|
6
7
|
//#region src/routes/healthChecks.ts
|
|
7
8
|
const healthChecksHandler = new OpenAPIHono();
|
|
8
|
-
healthChecksHandler.openapi(
|
|
9
|
+
healthChecksHandler.openapi(createProtectedRoute({
|
|
9
10
|
method: "get",
|
|
10
11
|
path: "/health",
|
|
11
12
|
operationId: "health",
|
|
12
13
|
tags: ["Health"],
|
|
13
14
|
summary: "Health check",
|
|
14
15
|
description: "Check if the management service is healthy",
|
|
16
|
+
permission: noAuth(),
|
|
15
17
|
responses: { 204: { description: "Service is healthy" } }
|
|
16
18
|
}), (c) => {
|
|
17
19
|
return c.body(null, 204);
|
|
@@ -32,13 +34,14 @@ const ReadyErrorResponseSchema = z.object({
|
|
|
32
34
|
detail: z.string().describe("A human-readable explanation specific to this occurrence"),
|
|
33
35
|
checks: ReadyErrorChecksSchema
|
|
34
36
|
}).openapi("ReadyErrorResponse");
|
|
35
|
-
healthChecksHandler.openapi(
|
|
37
|
+
healthChecksHandler.openapi(createProtectedRoute({
|
|
36
38
|
method: "get",
|
|
37
39
|
path: "/ready",
|
|
38
40
|
operationId: "ready",
|
|
39
41
|
tags: ["Health"],
|
|
40
42
|
summary: "Readiness check",
|
|
41
43
|
description: "Check if the service is ready to serve traffic by verifying database connectivity",
|
|
44
|
+
permission: noAuth(),
|
|
42
45
|
responses: {
|
|
43
46
|
200: {
|
|
44
47
|
description: "Service is ready - all health checks passed",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AppVariables } from "../types/app.js";
|
|
2
|
+
import "../types/index.js";
|
|
3
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
4
|
+
|
|
5
|
+
//#region src/routes/workflowProcess.d.ts
|
|
6
|
+
declare const workflowProcessHandler: OpenAPIHono<{
|
|
7
|
+
Variables: AppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { workflowProcessHandler };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
+
import { createProtectedRoute, noAuth } from "@inkeep/agents-core/middleware";
|
|
3
|
+
|
|
4
|
+
//#region src/routes/workflowProcess.ts
|
|
5
|
+
const workflowProcessHandler = new OpenAPIHono();
|
|
6
|
+
workflowProcessHandler.openapi(createProtectedRoute({
|
|
7
|
+
method: "get",
|
|
8
|
+
path: "/api/workflow/process",
|
|
9
|
+
tags: ["Workflows"],
|
|
10
|
+
summary: "Process workflow jobs",
|
|
11
|
+
description: "Keeps the workflow worker active to process queued jobs (called by cron)",
|
|
12
|
+
permission: noAuth(),
|
|
13
|
+
responses: { 200: { description: "Processing complete" } }
|
|
14
|
+
}), async (c) => {
|
|
15
|
+
await new Promise((resolve) => setTimeout(resolve, 5e4));
|
|
16
|
+
return c.json({
|
|
17
|
+
processed: true,
|
|
18
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { workflowProcessHandler };
|
package/dist/types/app.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ type BaseAppVariables = {
|
|
|
28
28
|
type AppVariables = BaseAppVariables & {
|
|
29
29
|
serverConfig: ServerConfig;
|
|
30
30
|
credentialStores: CredentialStoreRegistry;
|
|
31
|
-
auth: ReturnType<typeof createAuth
|
|
31
|
+
auth: ReturnType<typeof createAuth>;
|
|
32
32
|
user: typeof auth.$Infer.Session.user | null;
|
|
33
33
|
session: typeof auth.$Infer.Session.session | null;
|
|
34
34
|
sandboxConfig?: SandboxConfig;
|
|
@@ -36,7 +36,7 @@ type AppVariables = BaseAppVariables & {
|
|
|
36
36
|
};
|
|
37
37
|
type ManageAppVariables = AppVariables & {
|
|
38
38
|
db: AgentsManageDatabaseClient;
|
|
39
|
-
auth: ReturnType<typeof createAuth
|
|
39
|
+
auth: ReturnType<typeof createAuth>;
|
|
40
40
|
resolvedRef: ResolvedRef;
|
|
41
41
|
/** Cached by projectFull middleware to avoid duplicate DB lookup for PUT upsert */
|
|
42
42
|
isProjectCreate?: boolean;
|
|
@@ -44,7 +44,7 @@ type ManageAppVariables = AppVariables & {
|
|
|
44
44
|
type AppConfig = {
|
|
45
45
|
serverConfig: ServerConfig;
|
|
46
46
|
credentialStores: CredentialStoreRegistry;
|
|
47
|
-
auth: ReturnType<typeof createAuth
|
|
47
|
+
auth: ReturnType<typeof createAuth>;
|
|
48
48
|
sandboxConfig?: SandboxConfig;
|
|
49
49
|
};
|
|
50
50
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-api",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260219045007",
|
|
4
4
|
"description": "Unified Inkeep Agents API - combines management, runtime, and evaluation capabilities",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"openid-client": "^6.8.1",
|
|
68
68
|
"pg": "^8.16.3",
|
|
69
69
|
"workflow": "^4.1.0-beta.54",
|
|
70
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
71
|
-
"@inkeep/agents-
|
|
72
|
-
"@inkeep/agents-
|
|
70
|
+
"@inkeep/agents-core": "^0.0.0-dev-20260219045007",
|
|
71
|
+
"@inkeep/agents-mcp": "^0.0.0-dev-20260219045007",
|
|
72
|
+
"@inkeep/agents-work-apps": "^0.0.0-dev-20260219045007"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@hono/zod-openapi": "^1.1.5",
|