@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
package/dist/createApp.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AppConfig } from "./types/app.js";
|
|
2
2
|
import "./types/index.js";
|
|
3
3
|
import { Hono } from "hono";
|
|
4
|
-
import * as
|
|
4
|
+
import * as hono_types1 from "hono/types";
|
|
5
5
|
|
|
6
6
|
//#region src/createApp.d.ts
|
|
7
7
|
declare const isWebhookRoute: (path: string) => boolean;
|
|
8
|
-
declare function createAgentsHono(config: AppConfig): Hono<
|
|
8
|
+
declare function createAgentsHono(config: AppConfig): Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { createAgentsHono, isWebhookRoute };
|
package/dist/createApp.js
CHANGED
|
@@ -7,14 +7,12 @@ import { flushBatchProcessor } from "./instrumentation.js";
|
|
|
7
7
|
import { manageRoutes } from "./domains/manage/index.js";
|
|
8
8
|
import mcp_default from "./domains/mcp/routes/mcp.js";
|
|
9
9
|
import { runRoutes } from "./domains/run/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import { authCorsConfig, defaultCorsConfig, playgroundCorsConfig, runCorsConfig, signozCorsConfig, workAppsCorsConfig } from "./middleware/cors.js";
|
|
10
|
+
import { authCorsConfig, defaultCorsConfig, playgroundCorsConfig, runCorsConfig, signozCorsConfig } from "./middleware/cors.js";
|
|
12
11
|
import { errorHandler } from "./middleware/errorHandler.js";
|
|
13
12
|
import { manageApiKeyAuth } from "./middleware/manageAuth.js";
|
|
14
13
|
import { manageRefMiddleware, oauthRefMiddleware, runRefMiddleware, writeProtectionMiddleware } from "./middleware/ref.js";
|
|
15
14
|
import { runApiKeyAuth, runApiKeyAuthExcept } from "./middleware/runAuth.js";
|
|
16
15
|
import { requireTenantAccess } from "./middleware/tenantAccess.js";
|
|
17
|
-
import { workAppsAuth } from "./middleware/workAppsAuth.js";
|
|
18
16
|
import "./middleware/index.js";
|
|
19
17
|
import { branchScopedDbMiddleware } from "./middleware/branchScopedDb.js";
|
|
20
18
|
import { evalApiKeyAuth } from "./middleware/evalsAuth.js";
|
|
@@ -54,11 +52,9 @@ function createAgentsHono(config) {
|
|
|
54
52
|
app.use("/run/*", cors(runCorsConfig));
|
|
55
53
|
app.use("/manage/tenants/*/playground/token", cors(playgroundCorsConfig));
|
|
56
54
|
app.use("/manage/tenants/*/signoz/*", cors(signozCorsConfig));
|
|
57
|
-
app.use("/work-apps/*", cors(workAppsCorsConfig));
|
|
58
55
|
app.use("*", async (c, next) => {
|
|
59
56
|
if (auth && c.req.path.startsWith("/api/auth/")) return next();
|
|
60
57
|
if (c.req.path.startsWith("/run/")) return next();
|
|
61
|
-
if (c.req.path.startsWith("/work-apps/")) return next();
|
|
62
58
|
if (c.req.path.includes("/playground/token")) return next();
|
|
63
59
|
if (c.req.path.includes("/signoz/")) return next();
|
|
64
60
|
if (c.req.path.includes("/work-apps/github/")) return next();
|
|
@@ -73,10 +69,6 @@ function createAgentsHono(config) {
|
|
|
73
69
|
c.set("auth", auth);
|
|
74
70
|
await next();
|
|
75
71
|
});
|
|
76
|
-
app.use("/work-apps/*", async (c, next) => {
|
|
77
|
-
c.set("auth", auth);
|
|
78
|
-
await next();
|
|
79
|
-
});
|
|
80
72
|
app.use("/run/*", async (c, next) => {
|
|
81
73
|
if (sandboxConfig) c.set("sandboxConfig", sandboxConfig);
|
|
82
74
|
await next();
|
|
@@ -193,9 +185,6 @@ function createAgentsHono(config) {
|
|
|
193
185
|
});
|
|
194
186
|
app.route("/evals", evalRoutes);
|
|
195
187
|
app.route("/work-apps/github", githubRoutes);
|
|
196
|
-
app.use("/work-apps/slack/workspaces/*", workAppsAuth);
|
|
197
|
-
app.use("/work-apps/slack/users/*", workAppsAuth);
|
|
198
|
-
app.route("/work-apps", workAppsRoutes);
|
|
199
188
|
app.route("/mcp", mcp_default);
|
|
200
189
|
setupOpenAPIRoutes(app);
|
|
201
190
|
app.use("/run/*", async (_c, next) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core2 from "@inkeep/agents-core";
|
|
2
2
|
|
|
3
3
|
//#region src/data/db/manageDbClient.d.ts
|
|
4
|
-
declare const manageDbClient:
|
|
4
|
+
declare const manageDbClient: _inkeep_agents_core2.AgentsManageDatabaseClient;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { manageDbClient as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core3 from "@inkeep/agents-core";
|
|
2
2
|
|
|
3
3
|
//#region src/data/db/runDbClient.d.ts
|
|
4
|
-
declare const runDbClient:
|
|
4
|
+
declare const runDbClient: _inkeep_agents_core3.AgentsRunDatabaseClient;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { runDbClient as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono15 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono15.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/evals/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 };
|
|
@@ -43,6 +43,11 @@ declare class EvaluationService {
|
|
|
43
43
|
* Extract messages from dataset item input
|
|
44
44
|
*/
|
|
45
45
|
private extractMessagesFromDatasetItem;
|
|
46
|
+
/**
|
|
47
|
+
* Parse SSE (Server-Sent Events) response from chat API
|
|
48
|
+
* Handles text deltas, error operations, and other data operations
|
|
49
|
+
*/
|
|
50
|
+
private parseSSEResponse;
|
|
46
51
|
/**
|
|
47
52
|
* Run an evaluation job based on an evaluation job config
|
|
48
53
|
* Filters conversations based on jobFilters and runs evaluations with configured evaluators
|
|
@@ -3,7 +3,7 @@ import { env } from "../../../env.js";
|
|
|
3
3
|
import manageDbClient_default from "../../../data/db/manageDbClient.js";
|
|
4
4
|
import manageDbPool_default from "../../../data/db/manageDbPool.js";
|
|
5
5
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
6
|
-
import { ModelFactory, createEvaluationResult, createEvaluationRun, filterConversationsForJob, generateId, getConversationHistory, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluatorById, getFullAgent, getProjectScopedRef,
|
|
6
|
+
import { ModelFactory, createEvaluationResult, createEvaluationRun, filterConversationsForJob, generateId, getConversationHistory, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluatorById, getFullAgent, getProjectScopedRef, resolveRef, updateEvaluationResult, withRef } from "@inkeep/agents-core";
|
|
7
7
|
import { generateObject, generateText } from "ai";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
|
|
@@ -105,7 +105,8 @@ var EvaluationService = class {
|
|
|
105
105
|
error: `Chat API error: ${response.status} ${response.statusText}`
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
const
|
|
108
|
+
const responseText = await response.text();
|
|
109
|
+
const parseResult = this.parseSSEResponse(responseText);
|
|
109
110
|
if (parseResult.error) {
|
|
110
111
|
logger.error({
|
|
111
112
|
datasetItemId: datasetItem.id,
|
|
@@ -313,6 +314,54 @@ Generate the next user message:`;
|
|
|
313
314
|
return null;
|
|
314
315
|
}
|
|
315
316
|
/**
|
|
317
|
+
* Parse SSE (Server-Sent Events) response from chat API
|
|
318
|
+
* Handles text deltas, error operations, and other data operations
|
|
319
|
+
*/
|
|
320
|
+
parseSSEResponse(sseText) {
|
|
321
|
+
let textContent = "";
|
|
322
|
+
let hasError = false;
|
|
323
|
+
let errorMessage = "";
|
|
324
|
+
const lines = sseText.split("\n").filter((line) => line.startsWith("data: "));
|
|
325
|
+
for (const line of lines) try {
|
|
326
|
+
const data = JSON.parse(line.slice(6));
|
|
327
|
+
if (data.object === "chat.completion.chunk" && data.choices?.[0]?.delta) {
|
|
328
|
+
const delta = data.choices[0].delta;
|
|
329
|
+
if (delta.content) textContent += delta.content;
|
|
330
|
+
if (delta.content && typeof delta.content === "string") try {
|
|
331
|
+
const parsedContent = JSON.parse(delta.content);
|
|
332
|
+
if (parsedContent.type === "data-operation" && parsedContent.data?.type === "error") {
|
|
333
|
+
hasError = true;
|
|
334
|
+
errorMessage = parsedContent.data.message || "Unknown error occurred";
|
|
335
|
+
logger.warn({
|
|
336
|
+
errorMessage,
|
|
337
|
+
errorData: parsedContent.data
|
|
338
|
+
}, "Received error operation from chat API");
|
|
339
|
+
}
|
|
340
|
+
} catch {}
|
|
341
|
+
} else if (data.type === "text-delta" && data.delta) textContent += data.delta;
|
|
342
|
+
else if (data.type === "data-operation" && data.data?.type === "error") {
|
|
343
|
+
hasError = true;
|
|
344
|
+
errorMessage = data.data.message || "Unknown error occurred";
|
|
345
|
+
logger.warn({
|
|
346
|
+
errorMessage,
|
|
347
|
+
errorData: data.data
|
|
348
|
+
}, "Received error operation from chat API");
|
|
349
|
+
} else if (data.type === "error") {
|
|
350
|
+
hasError = true;
|
|
351
|
+
errorMessage = data.message || "Unknown error occurred";
|
|
352
|
+
logger.warn({
|
|
353
|
+
errorMessage,
|
|
354
|
+
errorData: data
|
|
355
|
+
}, "Received error event from chat API");
|
|
356
|
+
} else if (data.content) textContent += typeof data.content === "string" ? data.content : JSON.stringify(data.content);
|
|
357
|
+
} catch {}
|
|
358
|
+
if (hasError) return {
|
|
359
|
+
text: textContent.trim(),
|
|
360
|
+
error: errorMessage
|
|
361
|
+
};
|
|
362
|
+
return { text: textContent.trim() };
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
316
365
|
* Run an evaluation job based on an evaluation job config
|
|
317
366
|
* Filters conversations based on jobFilters and runs evaluations with configured evaluators
|
|
318
367
|
*/
|
|
@@ -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/evals/workflow/routes.d.ts
|
|
5
|
-
declare const workflowRoutes: Hono<
|
|
5
|
+
declare const workflowRoutes: Hono<hono_types11.BlankEnv, hono_types11.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { workflowRoutes };
|
|
@@ -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 hono14 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono14.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_types6 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_types6.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_types7 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_types7.BlankEnv, hono_types7.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_types9 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/passwordResetLinks.d.ts
|
|
6
6
|
declare const passwordResetLinksRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types9.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { passwordResetLinksRoutes 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/signoz.d.ts
|
|
6
6
|
declare const app: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types10.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
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_types3 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/users.d.ts
|
|
6
6
|
declare const usersRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types3.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { usersRoutes as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types4 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_types4.BlankEnv, hono_types4.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentConfig, DelegateRelation } from "./Agent.js";
|
|
2
2
|
import { InternalRelation } from "../utils/project.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _inkeep_agents_core0 from "@inkeep/agents-core";
|
|
4
4
|
import { CredentialStoreRegistry, FullExecutionContext } from "@inkeep/agents-core";
|
|
5
5
|
import * as ai0 from "ai";
|
|
6
6
|
|
|
@@ -44,7 +44,7 @@ declare function createDelegateToAgentTool({
|
|
|
44
44
|
message: string;
|
|
45
45
|
}, {
|
|
46
46
|
toolCallId: any;
|
|
47
|
-
result:
|
|
47
|
+
result: _inkeep_agents_core0.Message | _inkeep_agents_core0.Task;
|
|
48
48
|
}>;
|
|
49
49
|
/**
|
|
50
50
|
* Parameters for building a transfer relation config
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core1 from "@inkeep/agents-core";
|
|
2
2
|
import { BreakdownComponentDef, ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/run/utils/token-estimator.d.ts
|
|
@@ -17,7 +17,7 @@ interface AssembleResult {
|
|
|
17
17
|
/** The assembled prompt string */
|
|
18
18
|
prompt: string;
|
|
19
19
|
/** Token breakdown for each component */
|
|
20
|
-
breakdown:
|
|
20
|
+
breakdown: _inkeep_agents_core1.ContextBreakdown;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
export { AssembleResult, type BreakdownComponentDef, type ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown, estimateTokens };
|
package/dist/factory.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { CredentialStore, ServerConfig } from "@inkeep/agents-core";
|
|
|
6
6
|
import * as hono0 from "hono";
|
|
7
7
|
import * as zod0 from "zod";
|
|
8
8
|
import { SSOProviderConfig, UserAuthConfig } from "@inkeep/agents-core/auth";
|
|
9
|
-
import * as
|
|
9
|
+
import * as hono_types0 from "hono/types";
|
|
10
10
|
import * as better_auth0 from "better-auth";
|
|
11
11
|
import * as better_auth_plugins0 from "better-auth/plugins";
|
|
12
12
|
import * as _better_auth_sso0 from "@better-auth/sso";
|
|
@@ -1570,6 +1570,6 @@ declare function createAgentsApp(config?: {
|
|
|
1570
1570
|
credentialStores?: CredentialStore[];
|
|
1571
1571
|
auth?: UserAuthConfig;
|
|
1572
1572
|
sandboxConfig?: SandboxConfig;
|
|
1573
|
-
}): hono0.Hono<
|
|
1573
|
+
}): hono0.Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
|
|
1574
1574
|
//#endregion
|
|
1575
1575
|
export { type SSOProviderConfig, type UserAuthConfig, createAgentsApp, createAgentsAuth, createAgentsHono, createAuth0Provider, createOIDCProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { createAuth0Provider, createOIDCProvider } from "./ssoHelpers.js";
|
|
|
7
7
|
import { SSOProviderConfig, UserAuthConfig, createAgentsApp } from "./factory.js";
|
|
8
8
|
import { Hono } from "hono";
|
|
9
9
|
import * as zod205 from "zod";
|
|
10
|
-
import * as
|
|
10
|
+
import * as hono_types13 from "hono/types";
|
|
11
11
|
import * as better_auth79 from "better-auth";
|
|
12
12
|
import * as better_auth_plugins69 from "better-auth/plugins";
|
|
13
13
|
import * as _better_auth_sso10 from "@better-auth/sso";
|
|
@@ -1566,6 +1566,6 @@ declare const auth: better_auth79.Auth<{
|
|
|
1566
1566
|
}>;
|
|
1567
1567
|
}];
|
|
1568
1568
|
}>;
|
|
1569
|
-
declare const app: Hono<
|
|
1569
|
+
declare const app: Hono<hono_types13.BlankEnv, hono_types13.BlankSchema, "/">;
|
|
1570
1570
|
//#endregion
|
|
1571
1571
|
export { type AppConfig, type AppVariables, Hono, type NativeSandboxConfig, type SSOProviderConfig, type SandboxConfig, type UserAuthConfig, type VercelSandboxConfig, auth, createAgentsApp, createAgentsHono, createAuth0Provider, createOIDCProvider, app as default };
|
|
@@ -37,10 +37,5 @@ declare const runCorsConfig: CorsOptions;
|
|
|
37
37
|
* CORS configuration for SigNoz proxy routes
|
|
38
38
|
*/
|
|
39
39
|
declare const signozCorsConfig: CorsOptions;
|
|
40
|
-
/**
|
|
41
|
-
* CORS configuration for work-apps routes (Slack, etc.)
|
|
42
|
-
* Needs to allow cross-origin requests with credentials for dashboard integration
|
|
43
|
-
*/
|
|
44
|
-
declare const workAppsCorsConfig: CorsOptions;
|
|
45
40
|
//#endregion
|
|
46
|
-
export { authCorsConfig, defaultCorsConfig, getBaseDomain, getRootDomain, isOriginAllowed, playgroundCorsConfig, runCorsConfig, signozCorsConfig
|
|
41
|
+
export { authCorsConfig, defaultCorsConfig, getBaseDomain, getRootDomain, isOriginAllowed, playgroundCorsConfig, runCorsConfig, signozCorsConfig };
|
package/dist/middleware/cors.js
CHANGED
|
@@ -141,32 +141,6 @@ const signozCorsConfig = {
|
|
|
141
141
|
maxAge: 600,
|
|
142
142
|
credentials: true
|
|
143
143
|
};
|
|
144
|
-
/**
|
|
145
|
-
* CORS configuration for work-apps routes (Slack, etc.)
|
|
146
|
-
* Needs to allow cross-origin requests with credentials for dashboard integration
|
|
147
|
-
*/
|
|
148
|
-
const workAppsCorsConfig = {
|
|
149
|
-
origin: originHandler,
|
|
150
|
-
allowHeaders: [
|
|
151
|
-
"content-type",
|
|
152
|
-
"Content-Type",
|
|
153
|
-
"authorization",
|
|
154
|
-
"Authorization",
|
|
155
|
-
"User-Agent",
|
|
156
|
-
"Cookie"
|
|
157
|
-
],
|
|
158
|
-
allowMethods: [
|
|
159
|
-
"GET",
|
|
160
|
-
"POST",
|
|
161
|
-
"PUT",
|
|
162
|
-
"DELETE",
|
|
163
|
-
"OPTIONS",
|
|
164
|
-
"PATCH"
|
|
165
|
-
],
|
|
166
|
-
exposeHeaders: ["Content-Length"],
|
|
167
|
-
maxAge: 600,
|
|
168
|
-
credentials: true
|
|
169
|
-
};
|
|
170
144
|
|
|
171
145
|
//#endregion
|
|
172
|
-
export { authCorsConfig, defaultCorsConfig, getBaseDomain, getRootDomain, isOriginAllowed, playgroundCorsConfig, runCorsConfig, signozCorsConfig
|
|
146
|
+
export { authCorsConfig, defaultCorsConfig, getBaseDomain, getRootDomain, isOriginAllowed, playgroundCorsConfig, runCorsConfig, signozCorsConfig };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { authCorsConfig, defaultCorsConfig, getBaseDomain, isOriginAllowed, playgroundCorsConfig, runCorsConfig, signozCorsConfig
|
|
1
|
+
import { authCorsConfig, defaultCorsConfig, getBaseDomain, isOriginAllowed, playgroundCorsConfig, runCorsConfig, signozCorsConfig } from "./cors.js";
|
|
2
2
|
import { errorHandler } from "./errorHandler.js";
|
|
3
3
|
import { manageApiKeyAuth } from "./manageAuth.js";
|
|
4
4
|
import { oauthRefMiddleware } from "./ref.js";
|
|
5
5
|
import { runApiKeyAuth, runApiKeyAuthExcept, runOptionalAuth } from "./runAuth.js";
|
|
6
6
|
import { sessionAuth } from "./sessionAuth.js";
|
|
7
7
|
import { requireTenantAccess } from "./tenantAccess.js";
|
|
8
|
-
|
|
9
|
-
export { authCorsConfig, defaultCorsConfig, errorHandler, getBaseDomain, isOriginAllowed, manageApiKeyAuth, oauthRefMiddleware, playgroundCorsConfig, requireTenantAccess, runApiKeyAuth, runApiKeyAuthExcept, runCorsConfig, runOptionalAuth, sessionAuth, signozCorsConfig, workAppsAuth, workAppsCorsConfig };
|
|
8
|
+
export { authCorsConfig, defaultCorsConfig, errorHandler, getBaseDomain, isOriginAllowed, manageApiKeyAuth, oauthRefMiddleware, playgroundCorsConfig, requireTenantAccess, runApiKeyAuth, runApiKeyAuthExcept, runCorsConfig, runOptionalAuth, sessionAuth, signozCorsConfig };
|
package/dist/middleware/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { sessionAuth } from "./sessionAuth.js";
|
|
2
|
-
import { authCorsConfig, defaultCorsConfig, getBaseDomain, isOriginAllowed, playgroundCorsConfig, runCorsConfig, signozCorsConfig
|
|
2
|
+
import { authCorsConfig, defaultCorsConfig, getBaseDomain, isOriginAllowed, playgroundCorsConfig, runCorsConfig, signozCorsConfig } from "./cors.js";
|
|
3
3
|
import { errorHandler } from "./errorHandler.js";
|
|
4
4
|
import { manageApiKeyAuth } from "./manageAuth.js";
|
|
5
5
|
import { oauthRefMiddleware } from "./ref.js";
|
|
6
6
|
import { runApiKeyAuth, runApiKeyAuthExcept, runOptionalAuth } from "./runAuth.js";
|
|
7
7
|
import { requireTenantAccess } from "./tenantAccess.js";
|
|
8
|
-
import { workAppsAuth } from "./workAppsAuth.js";
|
|
9
8
|
|
|
10
|
-
export { authCorsConfig, defaultCorsConfig, errorHandler, getBaseDomain, isOriginAllowed, manageApiKeyAuth, oauthRefMiddleware, playgroundCorsConfig, requireTenantAccess, runApiKeyAuth, runApiKeyAuthExcept, runCorsConfig, runOptionalAuth, sessionAuth, signozCorsConfig
|
|
9
|
+
export { authCorsConfig, defaultCorsConfig, errorHandler, getBaseDomain, isOriginAllowed, manageApiKeyAuth, oauthRefMiddleware, playgroundCorsConfig, requireTenantAccess, runApiKeyAuth, runApiKeyAuthExcept, runCorsConfig, runOptionalAuth, sessionAuth, signozCorsConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono2 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: () => hono2.MiddlewareHandler<{
|
|
16
16
|
Variables: {
|
|
17
17
|
executionContext: BaseExecutionContext;
|
|
18
18
|
userId?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { env } from "../env.js";
|
|
2
2
|
import runDbClient_default from "../data/db/runDbClient.js";
|
|
3
|
-
import { getLogger, isInternalServiceToken,
|
|
3
|
+
import { getLogger, isInternalServiceToken, validateAndGetApiKey, verifyInternalServiceAuthHeader } from "@inkeep/agents-core";
|
|
4
4
|
import { createMiddleware } from "hono/factory";
|
|
5
5
|
import { HTTPException } from "hono/http-exception";
|
|
6
6
|
|
|
@@ -58,21 +58,6 @@ const manageApiKeyAuth = () => createMiddleware(async (c, next) => {
|
|
|
58
58
|
await next();
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
if (isSlackUserToken(token)) {
|
|
62
|
-
const result = await verifySlackUserToken(token);
|
|
63
|
-
if (!result.valid || !result.payload) throw new HTTPException(401, { message: result.error || "Invalid Slack user token" });
|
|
64
|
-
logger.info({
|
|
65
|
-
inkeepUserId: result.payload.sub,
|
|
66
|
-
tenantId: result.payload.tenantId,
|
|
67
|
-
slackTeamId: result.payload.slack.teamId,
|
|
68
|
-
slackUserId: result.payload.slack.userId
|
|
69
|
-
}, "Slack user JWT authenticated successfully");
|
|
70
|
-
c.set("userId", result.payload.sub);
|
|
71
|
-
if (result.payload.slack.email) c.set("userEmail", result.payload.slack.email);
|
|
72
|
-
c.set("tenantId", result.payload.tenantId);
|
|
73
|
-
await next();
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
61
|
if (isInternalServiceToken(token)) {
|
|
77
62
|
const result = await verifyInternalServiceAuthHeader(authHeader);
|
|
78
63
|
if (!result.valid || !result.payload) throw new HTTPException(401, { message: result.error || "Invalid internal service token" });
|
|
@@ -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 hono8 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) => hono8.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { requireProjectPermission };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../types/app.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono0 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) => hono0.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { requirePermission };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono5 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/runAuth.d.ts
|
|
5
|
-
declare const runApiKeyAuth: () =>
|
|
5
|
+
declare const runApiKeyAuth: () => hono5.MiddlewareHandler<{
|
|
6
6
|
Variables: {
|
|
7
7
|
executionContext: BaseExecutionContext;
|
|
8
8
|
};
|
|
@@ -11,7 +11,7 @@ declare const runApiKeyAuth: () => hono6.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) => hono5.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: () => hono5.MiddlewareHandler<{
|
|
24
24
|
Variables: {
|
|
25
25
|
executionContext?: BaseExecutionContext;
|
|
26
26
|
};
|