@inkeep/agents-api 0.0.0-dev-20260211235751 → 0.0.0-dev-20260212003026
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 +11 -11
- package/dist/.well-known/workflow/v1/step.cjs +220 -418
- package/dist/createApp.d.ts +2 -2
- package/dist/createApp.js +1 -12
- package/dist/data/db/manageDbClient.d.ts +2 -2
- package/dist/data/db/runDbClient.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/evals/services/EvaluationService.d.ts +5 -0
- package/dist/domains/evals/services/EvaluationService.js +51 -2
- package/dist/domains/evals/workflow/routes.d.ts +2 -2
- 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/passwordResetLinks.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- 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/utils/token-estimator.d.ts +2 -2
- package/dist/factory.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/middleware/cors.d.ts +1 -6
- package/dist/middleware/cors.js +1 -27
- package/dist/middleware/index.d.ts +2 -3
- package/dist/middleware/index.js +2 -3
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.js +1 -16
- package/dist/middleware/projectAccess.d.ts +2 -2
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/runAuth.js +1 -71
- package/dist/openapi.d.ts +0 -5
- package/dist/openapi.js +1 -6
- package/package.json +5 -5
- package/dist/domains/work-apps/index.d.ts +0 -13
- package/dist/domains/work-apps/index.js +0 -23
- package/dist/middleware/workAppsAuth.d.ts +0 -7
- package/dist/middleware/workAppsAuth.js +0 -30
|
@@ -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 { canUseProjectStrict,
|
|
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
|
|
|
@@ -125,73 +125,6 @@ async function tryApiKeyAuth(apiKey) {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
* Authenticate using a Slack user JWT token (for Slack work app delegation)
|
|
129
|
-
*/
|
|
130
|
-
async function trySlackUserJwtAuth(token, reqData) {
|
|
131
|
-
if (!isSlackUserToken(token)) return { authResult: null };
|
|
132
|
-
const result = await verifySlackUserToken(token);
|
|
133
|
-
if (!result.valid || !result.payload) {
|
|
134
|
-
logger.warn({ error: result.error }, "Invalid Slack user JWT token");
|
|
135
|
-
return {
|
|
136
|
-
authResult: null,
|
|
137
|
-
failureMessage: `Invalid Slack user token: ${result.error || "Invalid token"}`
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
const payload = result.payload;
|
|
141
|
-
if (!reqData.projectId || !reqData.agentId) {
|
|
142
|
-
logger.warn({
|
|
143
|
-
hasProjectId: !!reqData.projectId,
|
|
144
|
-
hasAgentId: !!reqData.agentId
|
|
145
|
-
}, "Slack user JWT requires x-inkeep-project-id and x-inkeep-agent-id headers");
|
|
146
|
-
return {
|
|
147
|
-
authResult: null,
|
|
148
|
-
failureMessage: "Slack user token requires x-inkeep-project-id and x-inkeep-agent-id headers"
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
try {
|
|
152
|
-
if (!await canUseProjectStrict({
|
|
153
|
-
userId: payload.sub,
|
|
154
|
-
projectId: reqData.projectId
|
|
155
|
-
})) {
|
|
156
|
-
logger.warn({
|
|
157
|
-
userId: payload.sub,
|
|
158
|
-
tenantId: payload.tenantId,
|
|
159
|
-
projectId: reqData.projectId
|
|
160
|
-
}, "Slack user JWT: user does not have access to requested project");
|
|
161
|
-
return {
|
|
162
|
-
authResult: null,
|
|
163
|
-
failureMessage: "Access denied: insufficient permissions for the requested project"
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
} catch (error) {
|
|
167
|
-
logger.error({
|
|
168
|
-
error,
|
|
169
|
-
userId: payload.sub,
|
|
170
|
-
projectId: reqData.projectId
|
|
171
|
-
}, "SpiceDB permission check failed for Slack JWT");
|
|
172
|
-
throw new HTTPException(503, { message: "Authorization service temporarily unavailable" });
|
|
173
|
-
}
|
|
174
|
-
logger.info({
|
|
175
|
-
inkeepUserId: payload.sub,
|
|
176
|
-
tenantId: payload.tenantId,
|
|
177
|
-
slackTeamId: payload.slack.teamId,
|
|
178
|
-
slackUserId: payload.slack.userId,
|
|
179
|
-
projectId: reqData.projectId,
|
|
180
|
-
agentId: reqData.agentId
|
|
181
|
-
}, "Slack user JWT token authenticated successfully");
|
|
182
|
-
return { authResult: {
|
|
183
|
-
apiKey: "slack-user-jwt",
|
|
184
|
-
tenantId: payload.tenantId,
|
|
185
|
-
projectId: reqData.projectId,
|
|
186
|
-
agentId: reqData.agentId,
|
|
187
|
-
apiKeyId: "slack-user-token",
|
|
188
|
-
metadata: { initiatedBy: {
|
|
189
|
-
type: "user",
|
|
190
|
-
id: payload.sub
|
|
191
|
-
} }
|
|
192
|
-
} };
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
128
|
* Authenticate using a team agent JWT token (for intra-tenant delegation)
|
|
196
129
|
*/
|
|
197
130
|
async function tryTeamAgentAuth(token, expectedSubAgentId) {
|
|
@@ -277,9 +210,6 @@ async function authenticateRequest(reqData) {
|
|
|
277
210
|
if (jwtResult) return { authResult: jwtResult };
|
|
278
211
|
const bypassResult = tryBypassAuth(apiKey, reqData);
|
|
279
212
|
if (bypassResult) return { authResult: bypassResult };
|
|
280
|
-
const slackAttempt = await trySlackUserJwtAuth(apiKey, reqData);
|
|
281
|
-
if (slackAttempt.authResult) return { authResult: slackAttempt.authResult };
|
|
282
|
-
if (slackAttempt.failureMessage) return slackAttempt;
|
|
283
213
|
const apiKeyResult = await tryApiKeyAuth(apiKey);
|
|
284
214
|
if (apiKeyResult) return { authResult: apiKeyResult };
|
|
285
215
|
const teamAttempt = await tryTeamAgentAuth(apiKey, subAgentId);
|
package/dist/openapi.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ declare const TagToDescription: {
|
|
|
8
8
|
Agents: string;
|
|
9
9
|
'Artifact Components': string;
|
|
10
10
|
Branches: string;
|
|
11
|
-
Channels: string;
|
|
12
11
|
CLI: string;
|
|
13
12
|
Chat: string;
|
|
14
13
|
'Context Configs': string;
|
|
@@ -28,17 +27,13 @@ declare const TagToDescription: {
|
|
|
28
27
|
'Project Permissions': string;
|
|
29
28
|
Projects: string;
|
|
30
29
|
Refs: string;
|
|
31
|
-
Slack: string;
|
|
32
30
|
SubAgents: string;
|
|
33
31
|
'Third-Party MCP Servers': string;
|
|
34
32
|
Tools: string;
|
|
35
33
|
Triggers: string;
|
|
36
34
|
'User Project Memberships': string;
|
|
37
|
-
Users: string;
|
|
38
35
|
Webhooks: string;
|
|
39
|
-
'Work Apps': string;
|
|
40
36
|
Workflows: string;
|
|
41
|
-
Workspaces: string;
|
|
42
37
|
};
|
|
43
38
|
declare function setupOpenAPIRoutes<E extends Env = Env>(app: OpenAPIHono<E>): void;
|
|
44
39
|
//#endregion
|
package/dist/openapi.js
CHANGED
|
@@ -7,7 +7,6 @@ const TagToDescription = {
|
|
|
7
7
|
Agents: "Operations for managing agents",
|
|
8
8
|
"Artifact Components": "Operations for managing artifact components",
|
|
9
9
|
Branches: "Operations for managing branches",
|
|
10
|
-
Channels: "Operations for managing Slack channels",
|
|
11
10
|
CLI: "CLI authentication endpoints",
|
|
12
11
|
Chat: "Chat completions endpoints",
|
|
13
12
|
"Context Configs": "Operations for managing context configurations",
|
|
@@ -27,17 +26,13 @@ const TagToDescription = {
|
|
|
27
26
|
"Project Permissions": "Operations for managing project permissions",
|
|
28
27
|
Projects: "Operations for managing projects",
|
|
29
28
|
Refs: "Operations for the resolved ref (branch name, tag name, or commit hash)",
|
|
30
|
-
Slack: "Slack App integration endpoints",
|
|
31
29
|
SubAgents: "Operations for managing sub agents",
|
|
32
30
|
"Third-Party MCP Servers": "Operations for managing third-party MCP servers",
|
|
33
31
|
Tools: "Operations for managing MCP tools",
|
|
34
32
|
Triggers: "Operations for managing triggers",
|
|
35
33
|
"User Project Memberships": "Operations for managing user project memberships",
|
|
36
|
-
Users: "Operations for managing users",
|
|
37
34
|
Webhooks: "Webhook endpoints",
|
|
38
|
-
|
|
39
|
-
Workflows: "Workflow trigger endpoints",
|
|
40
|
-
Workspaces: "Operations for managing Slack workspaces"
|
|
35
|
+
Workflows: "Workflow trigger endpoints"
|
|
41
36
|
};
|
|
42
37
|
function setupOpenAPIRoutes(app) {
|
|
43
38
|
app.get("/openapi.json", (c) => {
|
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-20260212003026",
|
|
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-20260212003026",
|
|
70
|
+
"@inkeep/agents-manage-mcp": "^0.0.0-dev-20260212003026",
|
|
71
|
+
"@inkeep/agents-mcp": "^0.0.0-dev-20260212003026",
|
|
72
|
+
"@inkeep/agents-work-apps": "^0.0.0-dev-20260212003026"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@hono/zod-openapi": "^1.1.5",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import { WorkAppsVariables } from "@inkeep/agents-work-apps/slack";
|
|
3
|
-
|
|
4
|
-
//#region src/domains/work-apps/index.d.ts
|
|
5
|
-
|
|
6
|
-
declare function createWorkAppsRoutes(): OpenAPIHono<{
|
|
7
|
-
Variables: WorkAppsVariables;
|
|
8
|
-
}, {}, "/">;
|
|
9
|
-
declare const workAppsRoutes: OpenAPIHono<{
|
|
10
|
-
Variables: WorkAppsVariables;
|
|
11
|
-
}, {}, "/">;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { createWorkAppsRoutes, workAppsRoutes };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import { slackRoutes } from "@inkeep/agents-work-apps/slack";
|
|
3
|
-
|
|
4
|
-
//#region src/domains/work-apps/index.ts
|
|
5
|
-
/**
|
|
6
|
-
* Work Apps Domain
|
|
7
|
-
*
|
|
8
|
-
* Modular integration layer for third-party work applications (Slack, GitHub, etc.)
|
|
9
|
-
* Work app implementations are in @inkeep/agents-work-apps package.
|
|
10
|
-
*
|
|
11
|
-
* Each work app is mounted as a sub-route:
|
|
12
|
-
* - /work-apps/slack/* - Slack workspace installation, user linking, commands
|
|
13
|
-
* - /work-apps/github/* - GitHub integration (mounted separately in createApp)
|
|
14
|
-
*/
|
|
15
|
-
function createWorkAppsRoutes() {
|
|
16
|
-
const app = new OpenAPIHono();
|
|
17
|
-
app.route("/slack", slackRoutes);
|
|
18
|
-
return app;
|
|
19
|
-
}
|
|
20
|
-
const workAppsRoutes = createWorkAppsRoutes();
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
export { createWorkAppsRoutes, workAppsRoutes };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { env } from "../env.js";
|
|
2
|
-
import { sessionAuth } from "./sessionAuth.js";
|
|
3
|
-
import { manageApiKeyAuth } from "./manageAuth.js";
|
|
4
|
-
|
|
5
|
-
//#region src/middleware/workAppsAuth.ts
|
|
6
|
-
const isTestEnvironment = () => env.ENVIRONMENT === "test";
|
|
7
|
-
const workAppsAuth = async (c, next) => {
|
|
8
|
-
if (isTestEnvironment()) {
|
|
9
|
-
await next();
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
if (env.ENVIRONMENT === "development") {
|
|
13
|
-
const origin = c.req.header("Origin");
|
|
14
|
-
if (origin) try {
|
|
15
|
-
const originUrl = new URL(origin);
|
|
16
|
-
if (originUrl.hostname === "localhost" || originUrl.hostname === "127.0.0.1") {
|
|
17
|
-
c.set("userId", "dev-user");
|
|
18
|
-
c.set("tenantId", "default");
|
|
19
|
-
c.set("tenantRole", "owner");
|
|
20
|
-
await next();
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
} catch {}
|
|
24
|
-
}
|
|
25
|
-
if (c.req.header("Authorization")?.startsWith("Bearer ")) return manageApiKeyAuth()(c, next);
|
|
26
|
-
return sessionAuth()(c, next);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
export { workAppsAuth };
|