@inkeep/agents-api 0.0.0-dev-20260204091343 → 0.0.0-dev-20260204160325
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/domains/evals/routes/datasetTriggers.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/manage/routes/userOrganizations.d.ts +2 -2
- package/dist/domains/mcp/routes/mcp.d.ts +2 -2
- package/dist/domains/run/agents/relationTools.js +2 -1
- package/dist/factory.d.ts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectAccess.d.ts +2 -2
- package/dist/middleware/runAuth.js +39 -4
- package/dist/middleware/tracing.d.ts +3 -3
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono12 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono12.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import availableAgents_default from "./routes/availableAgents.js";
|
|
1
2
|
import cliAuth_default from "./routes/cliAuth.js";
|
|
2
3
|
import github_default from "./routes/github.js";
|
|
3
4
|
import routes_default from "./routes/index.js";
|
|
@@ -27,6 +28,7 @@ function createManageRoutes() {
|
|
|
27
28
|
app.route("/tenants/:tenantId", projectFull_default);
|
|
28
29
|
app.route("/oauth", oauth_default);
|
|
29
30
|
app.route("/mcp", mcp_default);
|
|
31
|
+
app.route("/available-agents", availableAgents_default);
|
|
30
32
|
return app;
|
|
31
33
|
}
|
|
32
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,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono18 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono18.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 hono16 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono16.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types10 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/invitations.d.ts
|
|
6
6
|
declare const invitationsRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types10.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { invitationsRoutes as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types11 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/mcp.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types11.BlankEnv, hono_types11.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types13 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/userOrganizations.d.ts
|
|
6
6
|
declare const userOrganizationsRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types13.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { userOrganizationsRoutes as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types8 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/mcp/routes/mcp.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types8.BlankEnv, hono_types8.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -140,7 +140,8 @@ function createDelegateToAgentTool({ delegateConfig, callingAgentId, executionCo
|
|
|
140
140
|
if (activeSpan) activeSpan.setAttributes({
|
|
141
141
|
[SPAN_KEYS.DELEGATION_FROM_SUB_AGENT_ID]: callingAgentId,
|
|
142
142
|
[SPAN_KEYS.DELEGATION_TO_SUB_AGENT_ID]: delegateConfig.config.id ?? "unknown",
|
|
143
|
-
[SPAN_KEYS.DELEGATION_ID]: delegationId
|
|
143
|
+
[SPAN_KEYS.DELEGATION_ID]: delegationId,
|
|
144
|
+
[SPAN_KEYS.DELEGATION_TYPE]: delegateConfig.type
|
|
144
145
|
});
|
|
145
146
|
if (metadata.streamRequestId) agentSessionManager.recordEvent(metadata.streamRequestId, "delegation_sent", callingAgentId, {
|
|
146
147
|
delegationId,
|
package/dist/factory.d.ts
CHANGED
|
@@ -794,25 +794,25 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
794
794
|
ac: better_auth_plugins0.AccessControl;
|
|
795
795
|
roles: {
|
|
796
796
|
member: {
|
|
797
|
-
authorize<K_1 extends "organization" | "
|
|
798
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
797
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
798
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
799
799
|
connector: "OR" | "AND";
|
|
800
800
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
801
|
-
statements: better_auth_plugins0.Subset<"organization" | "
|
|
801
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
802
802
|
};
|
|
803
803
|
admin: {
|
|
804
|
-
authorize<K_1 extends "organization" | "
|
|
805
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
804
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
805
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
806
806
|
connector: "OR" | "AND";
|
|
807
807
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
808
|
-
statements: better_auth_plugins0.Subset<"organization" | "
|
|
808
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
809
809
|
};
|
|
810
810
|
owner: {
|
|
811
|
-
authorize<K_1 extends "organization" | "
|
|
812
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
811
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
812
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
813
813
|
connector: "OR" | "AND";
|
|
814
814
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
815
|
-
statements: better_auth_plugins0.Subset<"organization" | "
|
|
815
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
816
816
|
};
|
|
817
817
|
};
|
|
818
818
|
creatorRole: "admin";
|
|
@@ -1104,25 +1104,25 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
1104
1104
|
ac: better_auth_plugins0.AccessControl;
|
|
1105
1105
|
roles: {
|
|
1106
1106
|
member: {
|
|
1107
|
-
authorize<K_1 extends "organization" | "
|
|
1108
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
1107
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
1108
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
1109
1109
|
connector: "OR" | "AND";
|
|
1110
1110
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1111
|
-
statements: better_auth_plugins0.Subset<"organization" | "
|
|
1111
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
1112
1112
|
};
|
|
1113
1113
|
admin: {
|
|
1114
|
-
authorize<K_1 extends "organization" | "
|
|
1115
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
1114
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
1115
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
1116
1116
|
connector: "OR" | "AND";
|
|
1117
1117
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1118
|
-
statements: better_auth_plugins0.Subset<"organization" | "
|
|
1118
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
1119
1119
|
};
|
|
1120
1120
|
owner: {
|
|
1121
|
-
authorize<K_1 extends "organization" | "
|
|
1122
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
1121
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
1122
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
1123
1123
|
connector: "OR" | "AND";
|
|
1124
1124
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1125
|
-
statements: better_auth_plugins0.Subset<"organization" | "
|
|
1125
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
1126
1126
|
};
|
|
1127
1127
|
};
|
|
1128
1128
|
creatorRole: "admin";
|
package/dist/index.d.ts
CHANGED
|
@@ -795,25 +795,25 @@ declare const auth: better_auth78.Auth<{
|
|
|
795
795
|
ac: better_auth_plugins69.AccessControl;
|
|
796
796
|
roles: {
|
|
797
797
|
member: {
|
|
798
|
-
authorize<K_1 extends "organization" | "
|
|
799
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
798
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
|
|
799
|
+
actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
|
|
800
800
|
connector: "OR" | "AND";
|
|
801
801
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
802
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
802
|
+
statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
|
|
803
803
|
};
|
|
804
804
|
admin: {
|
|
805
|
-
authorize<K_1 extends "organization" | "
|
|
806
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
805
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
|
|
806
|
+
actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
|
|
807
807
|
connector: "OR" | "AND";
|
|
808
808
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
809
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
809
|
+
statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
|
|
810
810
|
};
|
|
811
811
|
owner: {
|
|
812
|
-
authorize<K_1 extends "organization" | "
|
|
813
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
812
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
|
|
813
|
+
actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
|
|
814
814
|
connector: "OR" | "AND";
|
|
815
815
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
816
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
816
|
+
statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
|
|
817
817
|
};
|
|
818
818
|
};
|
|
819
819
|
creatorRole: "admin";
|
|
@@ -1105,25 +1105,25 @@ declare const auth: better_auth78.Auth<{
|
|
|
1105
1105
|
ac: better_auth_plugins69.AccessControl;
|
|
1106
1106
|
roles: {
|
|
1107
1107
|
member: {
|
|
1108
|
-
authorize<K_1 extends "organization" | "
|
|
1109
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
1108
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
|
|
1109
|
+
actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
|
|
1110
1110
|
connector: "OR" | "AND";
|
|
1111
1111
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
1112
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
1112
|
+
statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
|
|
1113
1113
|
};
|
|
1114
1114
|
admin: {
|
|
1115
|
-
authorize<K_1 extends "organization" | "
|
|
1116
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
1115
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
|
|
1116
|
+
actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
|
|
1117
1117
|
connector: "OR" | "AND";
|
|
1118
1118
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
1119
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
1119
|
+
statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
|
|
1120
1120
|
};
|
|
1121
1121
|
owner: {
|
|
1122
|
-
authorize<K_1 extends "organization" | "
|
|
1123
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
1122
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key] | {
|
|
1123
|
+
actions: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>[key];
|
|
1124
1124
|
connector: "OR" | "AND";
|
|
1125
1125
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
1126
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
1126
|
+
statements: better_auth_plugins69.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins69.Statements>;
|
|
1127
1127
|
};
|
|
1128
1128
|
};
|
|
1129
1129
|
creatorRole: "admin";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono0 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/evalsAuth.d.ts
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ import * as hono1 from "hono";
|
|
|
7
7
|
* Middleware to authenticate API requests using Bearer token authentication
|
|
8
8
|
* First checks if token matches INKEEP_AGENTS_EVAL_API_BYPASS_SECRET,
|
|
9
9
|
*/
|
|
10
|
-
declare const evalApiKeyAuth: () =>
|
|
10
|
+
declare const evalApiKeyAuth: () => hono0.MiddlewareHandler<{
|
|
11
11
|
Variables: {
|
|
12
12
|
executionContext: BaseExecutionContext;
|
|
13
13
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono1 from "hono";
|
|
3
3
|
import { createAuth } from "@inkeep/agents-core/auth";
|
|
4
4
|
|
|
5
5
|
//#region src/middleware/manageAuth.d.ts
|
|
@@ -12,7 +12,7 @@ import { createAuth } from "@inkeep/agents-core/auth";
|
|
|
12
12
|
* 3. Database API key
|
|
13
13
|
* 4. Internal service token
|
|
14
14
|
*/
|
|
15
|
-
declare const manageApiKeyAuth: () =>
|
|
15
|
+
declare const manageApiKeyAuth: () => hono1.MiddlewareHandler<{
|
|
16
16
|
Variables: {
|
|
17
17
|
executionContext: BaseExecutionContext;
|
|
18
18
|
userId?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../types/app.js";
|
|
2
2
|
import { ProjectPermissionLevel } from "@inkeep/agents-core";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono2 from "hono";
|
|
4
4
|
|
|
5
5
|
//#region src/middleware/projectAccess.d.ts
|
|
6
6
|
/**
|
|
@@ -10,6 +10,6 @@ declare const requireProjectPermission: <Env$1 extends {
|
|
|
10
10
|
Variables: ManageAppVariables;
|
|
11
11
|
} = {
|
|
12
12
|
Variables: ManageAppVariables;
|
|
13
|
-
}>(permission?: ProjectPermissionLevel) =>
|
|
13
|
+
}>(permission?: ProjectPermissionLevel) => hono2.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { requireProjectPermission };
|
|
@@ -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,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-20260204160325",
|
|
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-20260204160325",
|
|
70
|
+
"@inkeep/agents-manage-mcp": "^0.0.0-dev-20260204160325",
|
|
71
|
+
"@inkeep/agents-mcp": "^0.0.0-dev-20260204160325",
|
|
72
|
+
"@inkeep/agents-work-apps": "^0.0.0-dev-20260204160325"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@hono/zod-openapi": "^1.1.5",
|