@inkeep/agents-api 0.0.0-dev-20260204075611 → 0.0.0-dev-20260204152302
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 +19 -19
- package/dist/.well-known/workflow/v1/step.cjs +300 -299
- package/dist/createApp.d.ts +2 -2
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/manage/index.js +2 -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/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/invitations.d.ts +2 -2
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/playgroundToken.js +3 -2
- package/dist/domains/mcp/routes/mcp.d.ts +2 -2
- package/dist/env.d.ts +2 -2
- package/dist/factory.d.ts +24 -24
- package/dist/index.d.ts +22 -22
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectAccess.d.ts +2 -2
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/requirePermission.d.ts +2 -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/tenantAccess.d.ts +2 -2
- package/dist/middleware/tracing.d.ts +3 -3
- package/package.json +5 -5
|
@@ -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 hono8 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/sessionAuth.d.ts
|
|
4
4
|
|
|
@@ -7,11 +7,11 @@ import * as hono9 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: () => hono8.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: () => hono8.MiddlewareHandler<any, string, {}, Response>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { sessionAuth, sessionContext };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono2 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tenantAccess.d.ts
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ import * as hono11 from "hono";
|
|
|
11
11
|
* - API key user: Access only to the tenant associated with the API key
|
|
12
12
|
* - Session user: Access based on organization membership
|
|
13
13
|
*/
|
|
14
|
-
declare const requireTenantAccess: () =>
|
|
14
|
+
declare const requireTenantAccess: () => hono2.MiddlewareHandler<{
|
|
15
15
|
Variables: {
|
|
16
16
|
userId: string;
|
|
17
17
|
tenantId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono13 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tracing.d.ts
|
|
4
|
-
declare const otelBaggageMiddleware: () =>
|
|
5
|
-
declare const executionBaggageMiddleware: () =>
|
|
4
|
+
declare const otelBaggageMiddleware: () => hono13.MiddlewareHandler<any, string, {}, Response>;
|
|
5
|
+
declare const executionBaggageMiddleware: () => hono13.MiddlewareHandler<any, string, {}, Response>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { executionBaggageMiddleware, otelBaggageMiddleware };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-api",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260204152302",
|
|
4
4
|
"description": "Unified Inkeep Agents API - combines management, runtime, and evaluation capabilities",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -66,10 +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.0.0-dev-
|
|
70
|
-
"@inkeep/agents-manage-mcp": "^0.0.0-dev-
|
|
71
|
-
"@inkeep/agents-mcp": "^0.0.0-dev-
|
|
72
|
-
"@inkeep/agents-work-apps": "^0.0.0-dev-
|
|
69
|
+
"@inkeep/agents-core": "^0.0.0-dev-20260204152302",
|
|
70
|
+
"@inkeep/agents-manage-mcp": "^0.0.0-dev-20260204152302",
|
|
71
|
+
"@inkeep/agents-mcp": "^0.0.0-dev-20260204152302",
|
|
72
|
+
"@inkeep/agents-work-apps": "^0.0.0-dev-20260204152302"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@hono/zod-openapi": "^1.1.5",
|