@inkeep/agents-api 0.43.0 → 0.45.0
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 +1 -1
- package/dist/.well-known/workflow/v1/step.cjs +211602 -195751
- package/dist/createApp.js +11 -9
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- 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 +8 -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/branches.js +9 -0
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/evals/datasetItems.js +13 -0
- package/dist/domains/manage/routes/evals/datasets.js +9 -0
- package/dist/domains/manage/routes/evals/evaluationJobConfigEvaluatorRelations.js +5 -0
- package/dist/domains/manage/routes/evals/evaluationJobConfigs.js +9 -0
- package/dist/domains/manage/routes/evals/evaluationResults.d.ts +4 -2
- package/dist/domains/manage/routes/evals/evaluationResults.js +9 -0
- package/dist/domains/manage/routes/evals/evaluationRunConfigs.js +9 -0
- package/dist/domains/manage/routes/evals/evaluationSuiteConfigEvaluatorRelations.js +5 -0
- package/dist/domains/manage/routes/evals/evaluationSuiteConfigs.js +9 -0
- package/dist/domains/manage/routes/evals/evaluators.js +9 -0
- package/dist/domains/manage/routes/github.d.ts +16 -0
- package/dist/domains/manage/routes/github.js +511 -0
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/invitations.d.ts +4 -3
- package/dist/domains/manage/routes/invitations.js +16 -28
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/mcpToolGithubAccess.d.ts +9 -0
- package/dist/domains/manage/routes/mcpToolGithubAccess.js +205 -0
- package/dist/domains/manage/routes/playgroundToken.js +3 -2
- package/dist/domains/manage/routes/projectGithubAccess.d.ts +9 -0
- package/dist/domains/manage/routes/projectGithubAccess.js +167 -0
- package/dist/domains/manage/routes/projectMembers.js +1 -14
- package/dist/domains/manage/routes/projectPermissions.js +2 -9
- package/dist/domains/manage/routes/projects.js +14 -16
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.js +22 -16
- package/dist/domains/manage/routes/tools.js +4 -2
- package/dist/domains/manage/routes/userOrganizations.d.ts +4 -3
- package/dist/domains/manage/routes/userOrganizations.js +16 -45
- package/dist/domains/manage/routes/userProjectMemberships.js +1 -2
- package/dist/domains/run/agents/Agent.js +29 -2
- package/dist/domains/run/agents/relationTools.js +2 -1
- package/dist/domains/run/constants/execution-limits/defaults.d.ts +1 -1
- package/dist/domains/run/constants/execution-limits/defaults.js +1 -1
- package/dist/domains/run/constants/execution-limits/index.d.ts +1 -1
- package/dist/domains/run/context/ContextResolver.js +1 -1
- package/dist/domains/run/context/validation.d.ts +1 -1
- package/dist/domains/run/services/AgentSession.js +5 -1
- package/dist/domains/run/services/BaseCompressor.js +1 -1
- package/dist/domains/run/services/TriggerService.d.ts +1 -1
- package/dist/domains/run/services/TriggerService.js +15 -13
- package/dist/domains/run/tools/sandbox-utils.js +1 -1
- package/dist/domains/run/types/executionContext.js +3 -1
- package/dist/env.d.ts +12 -2
- package/dist/env.js +37 -32
- package/dist/factory.d.ts +7 -7
- package/dist/factory.js +4 -10
- package/dist/index.d.ts +6 -5
- package/dist/index.js +3 -5
- package/dist/middleware/branchScopedDb.d.ts +1 -1
- package/dist/middleware/evalsAuth.d.ts +1 -1
- package/dist/middleware/manageAuth.d.ts +1 -1
- package/dist/middleware/projectAccess.d.ts +2 -11
- package/dist/middleware/projectAccess.js +7 -33
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/ref.d.ts +1 -1
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/requirePermission.js +1 -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/sessionAuth.js +1 -2
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/openapi.d.ts +1 -2
- package/dist/openapi.js +1 -2
- package/dist/types/runExecutionContext.js +3 -1
- package/package.json +5 -4
- package/dist/domains/github/config.d.ts +0 -14
- package/dist/domains/github/config.js +0 -47
- package/dist/domains/github/index.d.ts +0 -12
- package/dist/domains/github/index.js +0 -18
- package/dist/domains/github/installation.d.ts +0 -34
- package/dist/domains/github/installation.js +0 -172
- package/dist/domains/github/jwks.d.ts +0 -20
- package/dist/domains/github/jwks.js +0 -85
- package/dist/domains/github/oidcToken.d.ts +0 -22
- package/dist/domains/github/oidcToken.js +0 -140
- package/dist/domains/github/routes/tokenExchange.d.ts +0 -7
- package/dist/domains/github/routes/tokenExchange.js +0 -130
- package/dist/initialization.d.ts +0 -6
- package/dist/initialization.js +0 -72
|
@@ -1,57 +1,28 @@
|
|
|
1
1
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { sessionAuth } from "../../../middleware/sessionAuth.js";
|
|
3
|
+
import { createApiError, getUserOrganizationsFromDb } from "@inkeep/agents-core";
|
|
4
|
+
import { Hono } from "hono";
|
|
5
5
|
|
|
6
6
|
//#region src/domains/manage/routes/userOrganizations.ts
|
|
7
|
-
const userOrganizationsRoutes = new
|
|
8
|
-
userOrganizationsRoutes.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
const { userId } = c.req.valid("param");
|
|
7
|
+
const userOrganizationsRoutes = new Hono();
|
|
8
|
+
userOrganizationsRoutes.use("*", sessionAuth());
|
|
9
|
+
userOrganizationsRoutes.get("/", async (c) => {
|
|
10
|
+
const userId = c.req.param("userId");
|
|
11
|
+
const authenticatedUserId = c.get("userId");
|
|
12
|
+
if (!userId) throw createApiError({
|
|
13
|
+
code: "bad_request",
|
|
14
|
+
message: "User ID is required"
|
|
15
|
+
});
|
|
16
|
+
if (userId !== authenticatedUserId) throw createApiError({
|
|
17
|
+
code: "forbidden",
|
|
18
|
+
message: "Cannot access another user's organizations"
|
|
19
|
+
});
|
|
21
20
|
const userOrganizations = (await getUserOrganizationsFromDb(runDbClient_default)(userId)).map((org) => ({
|
|
22
21
|
...org,
|
|
23
22
|
createdAt: org.createdAt.toISOString()
|
|
24
23
|
}));
|
|
25
24
|
return c.json(userOrganizations);
|
|
26
25
|
});
|
|
27
|
-
userOrganizationsRoutes.openapi(createRoute({
|
|
28
|
-
method: "post",
|
|
29
|
-
path: "/",
|
|
30
|
-
tags: ["User Organizations"],
|
|
31
|
-
summary: "Add user to organization",
|
|
32
|
-
description: "Associate a user with an organization",
|
|
33
|
-
request: {
|
|
34
|
-
params: z.object({ userId: z.string().describe("User ID") }),
|
|
35
|
-
body: { content: { "application/json": { schema: AddUserToOrganizationRequestSchema } } }
|
|
36
|
-
},
|
|
37
|
-
responses: { 201: {
|
|
38
|
-
description: "User added to organization",
|
|
39
|
-
content: { "application/json": { schema: AddUserToOrganizationResponseSchema } }
|
|
40
|
-
} }
|
|
41
|
-
}), async (c) => {
|
|
42
|
-
const { userId } = c.req.valid("param");
|
|
43
|
-
const { organizationId, role } = c.req.valid("json");
|
|
44
|
-
await addUserToOrganization(runDbClient_default)({
|
|
45
|
-
userId,
|
|
46
|
-
organizationId,
|
|
47
|
-
role
|
|
48
|
-
});
|
|
49
|
-
return c.json({
|
|
50
|
-
organizationId,
|
|
51
|
-
role,
|
|
52
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
53
|
-
}, 201);
|
|
54
|
-
});
|
|
55
26
|
var userOrganizations_default = userOrganizationsRoutes;
|
|
56
27
|
|
|
57
28
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
2
|
-
import { ProjectRoles, commonGetErrorResponses,
|
|
2
|
+
import { ProjectRoles, commonGetErrorResponses, listUserProjectMembershipsInSpiceDb } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/userProjectMemberships.ts
|
|
5
5
|
const app = new OpenAPIHono();
|
|
@@ -32,7 +32,6 @@ app.openapi(createRoute({
|
|
|
32
32
|
}
|
|
33
33
|
}), async (c) => {
|
|
34
34
|
const { tenantId, userId } = c.req.valid("param");
|
|
35
|
-
if (!isAuthzEnabled()) return c.json({ data: [] });
|
|
36
35
|
const memberships = await listUserProjectMembershipsInSpiceDb({
|
|
37
36
|
tenantId,
|
|
38
37
|
userId
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
2
|
+
import { env } from "../../../env.js";
|
|
2
3
|
import manageDbPool_default from "../../../data/db/manageDbPool.js";
|
|
3
4
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
4
5
|
import { AGENT_EXECUTION_MAX_GENERATION_STEPS, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS } from "../constants/execution-limits/index.js";
|
|
@@ -26,7 +27,7 @@ import { SystemPromptBuilder } from "./SystemPromptBuilder.js";
|
|
|
26
27
|
import { Phase1Config, V1_BREAKDOWN_SCHEMA } from "./versions/v1/Phase1Config.js";
|
|
27
28
|
import { Phase2Config } from "./versions/v1/Phase2Config.js";
|
|
28
29
|
import { z } from "@hono/zod-openapi";
|
|
29
|
-
import { CredentialStuffer, JsonTransformer, MCPServerType, MCPTransportType, McpClient, ModelFactory, TemplateEngine, buildComposioMCPUrl, createMessage, generateId, getFunctionToolsForSubAgent, getLedgerArtifacts, listTaskIdsByContextId, parseEmbeddedJson, withRef } from "@inkeep/agents-core";
|
|
30
|
+
import { CredentialStuffer, JsonTransformer, MCPServerType, MCPTransportType, McpClient, ModelFactory, TemplateEngine, buildComposioMCPUrl, createMessage, generateId, getFunctionToolsForSubAgent, getLedgerArtifacts, isGithubWorkAppTool, listTaskIdsByContextId, parseEmbeddedJson, withRef } from "@inkeep/agents-core";
|
|
30
31
|
import { Output, generateText, streamText, tool } from "ai";
|
|
31
32
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
32
33
|
|
|
@@ -681,6 +682,11 @@ var Agent = class {
|
|
|
681
682
|
headers: agentToolRelationHeaders
|
|
682
683
|
};
|
|
683
684
|
}
|
|
685
|
+
if (isGithubWorkAppTool(tool$1)) serverConfig.headers = {
|
|
686
|
+
...serverConfig.headers,
|
|
687
|
+
"x-inkeep-tool-id": tool$1.id,
|
|
688
|
+
Authorization: `Bearer ${env.GITHUB_MCP_API_KEY}`
|
|
689
|
+
};
|
|
684
690
|
if (serverConfig.url) serverConfig.url = buildComposioMCPUrl(serverConfig.url.toString(), this.config.tenantId, this.config.projectId, isUserScoped ? "user" : "project", userId);
|
|
685
691
|
if (this.config.forwardedHeaders && Object.keys(this.config.forwardedHeaders).length > 0) serverConfig.headers = {
|
|
686
692
|
...serverConfig.headers,
|
|
@@ -1980,7 +1986,28 @@ ${typeof cleanResult === "string" ? cleanResult : JSON.stringify(cleanResult, nu
|
|
|
1980
1986
|
if (includeThinkingComplete && hasThinkingComplete && "toolResults" in currentStep && currentStep.toolResults) return true;
|
|
1981
1987
|
}
|
|
1982
1988
|
}
|
|
1983
|
-
|
|
1989
|
+
const maxSteps = this.getMaxGenerationSteps();
|
|
1990
|
+
if (steps.length >= maxSteps) {
|
|
1991
|
+
logger.warn({
|
|
1992
|
+
subAgentId: this.config.id,
|
|
1993
|
+
agentId: this.config.agentId,
|
|
1994
|
+
stepsCompleted: steps.length,
|
|
1995
|
+
maxSteps,
|
|
1996
|
+
conversationId: this.conversationId
|
|
1997
|
+
}, "Sub-agent reached maximum generation steps limit");
|
|
1998
|
+
tracer.startActiveSpan("agent.max_steps_reached", { attributes: {
|
|
1999
|
+
"agent.max_steps_reached": true,
|
|
2000
|
+
"agent.steps_completed": steps.length,
|
|
2001
|
+
"agent.max_steps": maxSteps,
|
|
2002
|
+
"agent.id": this.config.agentId,
|
|
2003
|
+
"subAgent.id": this.config.id
|
|
2004
|
+
} }, (span) => {
|
|
2005
|
+
span.addEvent("max_generation_steps_reached", { message: `Sub-agent "${this.config.id}" reached maximum generation steps (${steps.length}/${maxSteps})` });
|
|
2006
|
+
span.end();
|
|
2007
|
+
});
|
|
2008
|
+
return true;
|
|
2009
|
+
}
|
|
2010
|
+
return false;
|
|
1984
2011
|
}
|
|
1985
2012
|
setupStreamParser(sessionId, contextId) {
|
|
1986
2013
|
const streamHelper = this.getStreamingHelper();
|
|
@@ -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,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
declare const executionLimitsDefaults: {
|
|
7
7
|
readonly AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3;
|
|
8
|
-
readonly AGENT_EXECUTION_MAX_GENERATION_STEPS:
|
|
8
|
+
readonly AGENT_EXECUTION_MAX_GENERATION_STEPS: 50;
|
|
9
9
|
readonly LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING: 270000;
|
|
10
10
|
readonly LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING: 90000;
|
|
11
11
|
readonly LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS: 90000;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
const executionLimitsDefaults = {
|
|
7
7
|
AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3,
|
|
8
|
-
AGENT_EXECUTION_MAX_GENERATION_STEPS:
|
|
8
|
+
AGENT_EXECUTION_MAX_GENERATION_STEPS: 50,
|
|
9
9
|
LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING: 27e4,
|
|
10
10
|
LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING: 9e4,
|
|
11
11
|
LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS: 9e4,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { executionLimitsDefaults } from "./defaults.js";
|
|
2
2
|
|
|
3
3
|
//#region src/domains/run/constants/execution-limits/index.d.ts
|
|
4
|
-
declare const AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3, AGENT_EXECUTION_MAX_GENERATION_STEPS:
|
|
4
|
+
declare const AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3, AGENT_EXECUTION_MAX_GENERATION_STEPS: 50, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING: 270000, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING: 90000, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS: 90000, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS: 600000, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT: 30000, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT: 4, FUNCTION_TOOL_SANDBOX_POOL_TTL_MS: 300000, FUNCTION_TOOL_SANDBOX_MAX_USE_COUNT: 50, FUNCTION_TOOL_SANDBOX_MAX_OUTPUT_SIZE_BYTES: 1048576, FUNCTION_TOOL_SANDBOX_QUEUE_WAIT_TIMEOUT_MS: 30000, FUNCTION_TOOL_SANDBOX_CLEANUP_INTERVAL_MS: 60000, MCP_TOOL_REQUEST_TIMEOUT_MS_DEFAULT: 60000, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS: 100, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS: 10000, DELEGATION_TOOL_BACKOFF_EXPONENT: 2, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS: 20000, A2A_BACKOFF_INITIAL_INTERVAL_MS: 500, A2A_BACKOFF_MAX_INTERVAL_MS: 60000, A2A_BACKOFF_EXPONENT: 1.5, A2A_BACKOFF_MAX_ELAPSED_TIME_MS: 30000, ARTIFACT_GENERATION_MAX_RETRIES: 3, ARTIFACT_SESSION_MAX_PENDING: 100, ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES: 3, ARTIFACT_GENERATION_BACKOFF_INITIAL_MS: 1000, ARTIFACT_GENERATION_BACKOFF_MAX_MS: 10000, SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS: 300000, SESSION_CLEANUP_INTERVAL_MS: 60000, STATUS_UPDATE_DEFAULT_NUM_EVENTS: 1, STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS: 2, STREAM_PARSER_MAX_SNAPSHOT_SIZE: 100, STREAM_PARSER_MAX_STREAMED_SIZE: 1000, STREAM_PARSER_MAX_COLLECTED_PARTS: 10000, STREAM_BUFFER_MAX_SIZE_BYTES: 5242880, STREAM_TEXT_GAP_THRESHOLD_MS: 2000, STREAM_MAX_LIFETIME_MS: 600000, CONVERSATION_HISTORY_DEFAULT_LIMIT: 50, CONVERSATION_ARTIFACTS_LIMIT: 12, COMPRESSION_HARD_LIMIT: 120000, COMPRESSION_SAFETY_BUFFER: 20000, COMPRESSION_ENABLED: true;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { A2A_BACKOFF_EXPONENT, A2A_BACKOFF_INITIAL_INTERVAL_MS, A2A_BACKOFF_MAX_ELAPSED_TIME_MS, A2A_BACKOFF_MAX_INTERVAL_MS, AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS, AGENT_EXECUTION_MAX_GENERATION_STEPS, ARTIFACT_GENERATION_BACKOFF_INITIAL_MS, ARTIFACT_GENERATION_BACKOFF_MAX_MS, ARTIFACT_GENERATION_MAX_RETRIES, ARTIFACT_SESSION_MAX_PENDING, ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES, COMPRESSION_ENABLED, COMPRESSION_HARD_LIMIT, COMPRESSION_SAFETY_BUFFER, CONVERSATION_ARTIFACTS_LIMIT, CONVERSATION_HISTORY_DEFAULT_LIMIT, DELEGATION_TOOL_BACKOFF_EXPONENT, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT, FUNCTION_TOOL_SANDBOX_CLEANUP_INTERVAL_MS, FUNCTION_TOOL_SANDBOX_MAX_OUTPUT_SIZE_BYTES, FUNCTION_TOOL_SANDBOX_MAX_USE_COUNT, FUNCTION_TOOL_SANDBOX_POOL_TTL_MS, FUNCTION_TOOL_SANDBOX_QUEUE_WAIT_TIMEOUT_MS, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS, MCP_TOOL_REQUEST_TIMEOUT_MS_DEFAULT, SESSION_CLEANUP_INTERVAL_MS, SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS, STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS, STATUS_UPDATE_DEFAULT_NUM_EVENTS, STREAM_BUFFER_MAX_SIZE_BYTES, STREAM_MAX_LIFETIME_MS, STREAM_PARSER_MAX_COLLECTED_PARTS, STREAM_PARSER_MAX_SNAPSHOT_SIZE, STREAM_PARSER_MAX_STREAMED_SIZE, STREAM_TEXT_GAP_THRESHOLD_MS, executionLimitsDefaults };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ContextCache } from "./contextCache.js";
|
|
2
2
|
import { ContextFetcher, MissingRequiredVariableError } from "./ContextFetcher.js";
|
|
3
3
|
import { getLogger, getTracer, setSpanWithError } from "@inkeep/agents-core";
|
|
4
|
-
import crypto from "node:crypto";
|
|
5
4
|
import { SpanStatusCode } from "@opentelemetry/api";
|
|
5
|
+
import crypto from "node:crypto";
|
|
6
6
|
|
|
7
7
|
//#region src/domains/run/context/ContextResolver.ts
|
|
8
8
|
const logger = getLogger("context-resolver");
|
|
@@ -1129,7 +1129,11 @@ var AgentSessionManager = class {
|
|
|
1129
1129
|
recordEvent(sessionId, eventType, subAgentId, data) {
|
|
1130
1130
|
const session = this.sessions.get(sessionId);
|
|
1131
1131
|
if (!session) {
|
|
1132
|
-
logger.warn({
|
|
1132
|
+
logger.warn({
|
|
1133
|
+
sessionId,
|
|
1134
|
+
eventType,
|
|
1135
|
+
subAgentId
|
|
1136
|
+
}, "Attempted to record event in non-existent session (likely session already ended)");
|
|
1133
1137
|
return;
|
|
1134
1138
|
}
|
|
1135
1139
|
session.recordEvent(eventType, subAgentId, data);
|
|
@@ -5,8 +5,8 @@ import { getCompressionConfigForModel } from "../utils/model-context-utils.js";
|
|
|
5
5
|
import { tracer } from "../utils/tracer.js";
|
|
6
6
|
import { agentSessionManager } from "./AgentSession.js";
|
|
7
7
|
import { getLedgerArtifacts } from "@inkeep/agents-core";
|
|
8
|
-
import { randomUUID } from "node:crypto";
|
|
9
8
|
import { SpanStatusCode } from "@opentelemetry/api";
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
10
10
|
|
|
11
11
|
//#region src/domains/run/services/BaseCompressor.ts
|
|
12
12
|
const logger = getLogger$1("BaseCompressor");
|
|
@@ -364,7 +364,19 @@ async function dispatchExecution(params) {
|
|
|
364
364
|
*/
|
|
365
365
|
async function executeAgentAsync(params) {
|
|
366
366
|
const { tenantId, projectId, agentId, triggerId, invocationId, conversationId, userMessage, messageParts, resolvedRef } = params;
|
|
367
|
-
const
|
|
367
|
+
const project = await withRef(manageDbPool_default, resolvedRef, async (db) => {
|
|
368
|
+
return await getFullProjectWithRelationIds(db)({ scopes: {
|
|
369
|
+
tenantId,
|
|
370
|
+
projectId
|
|
371
|
+
} });
|
|
372
|
+
});
|
|
373
|
+
if (!project) throw new Error(`Project ${projectId} not found`);
|
|
374
|
+
const agent = project.agents?.[agentId];
|
|
375
|
+
if (!agent) throw new Error(`Agent ${agentId} not found in project`);
|
|
376
|
+
const defaultSubAgentId = agent.defaultSubAgentId;
|
|
377
|
+
if (!defaultSubAgentId) throw new Error(`Agent ${agentId} has no default sub-agent configured`);
|
|
378
|
+
const agentName = agent.name;
|
|
379
|
+
const baggage = propagation.createBaggage().setEntry("conversation.id", { value: conversationId }).setEntry("tenant.id", { value: tenantId }).setEntry("project.id", { value: projectId }).setEntry("agent.id", { value: agentId }).setEntry("agent.name", { value: agentName });
|
|
368
380
|
const ctxWithBaggage = propagation.setBaggage(context.active(), baggage);
|
|
369
381
|
return tracer.startActiveSpan("trigger.execute_async", {
|
|
370
382
|
root: true,
|
|
@@ -372,6 +384,7 @@ async function executeAgentAsync(params) {
|
|
|
372
384
|
"tenant.id": tenantId,
|
|
373
385
|
"project.id": projectId,
|
|
374
386
|
"agent.id": agentId,
|
|
387
|
+
"agent.name": agentName,
|
|
375
388
|
"trigger.id": triggerId,
|
|
376
389
|
"trigger.invocation.id": invocationId,
|
|
377
390
|
"conversation.id": conversationId,
|
|
@@ -382,6 +395,7 @@ async function executeAgentAsync(params) {
|
|
|
382
395
|
"tenant.id": tenantId,
|
|
383
396
|
"project.id": projectId,
|
|
384
397
|
"agent.id": agentId,
|
|
398
|
+
"agent.name": agentName,
|
|
385
399
|
"trigger.id": triggerId,
|
|
386
400
|
"trigger.invocation.id": invocationId,
|
|
387
401
|
"conversation.id": conversationId,
|
|
@@ -400,18 +414,6 @@ async function executeAgentAsync(params) {
|
|
|
400
414
|
conversationId
|
|
401
415
|
}, "Starting async trigger execution");
|
|
402
416
|
try {
|
|
403
|
-
const project = await withRef(manageDbPool_default, resolvedRef, async (db) => {
|
|
404
|
-
return await getFullProjectWithRelationIds(db)({ scopes: {
|
|
405
|
-
tenantId,
|
|
406
|
-
projectId
|
|
407
|
-
} });
|
|
408
|
-
});
|
|
409
|
-
if (!project) throw new Error(`Project ${projectId} not found`);
|
|
410
|
-
const agent = project.agents?.[agentId];
|
|
411
|
-
if (!agent) throw new Error(`Agent ${agentId} not found in project`);
|
|
412
|
-
const defaultSubAgentId = agent.defaultSubAgentId;
|
|
413
|
-
if (!defaultSubAgentId) throw new Error(`Agent ${agentId} has no default sub-agent configured`);
|
|
414
|
-
span.setAttribute("agent.name", agent.name || agentId);
|
|
415
417
|
await createOrGetConversation(runDbClient_default)({
|
|
416
418
|
id: conversationId,
|
|
417
419
|
tenantId,
|
|
@@ -12,7 +12,7 @@ function createExecutionWrapper(executeCode, args) {
|
|
|
12
12
|
const args = ${JSON.stringify(args, null, 2)};
|
|
13
13
|
|
|
14
14
|
// User's function code
|
|
15
|
-
const execute = ${executeCode}
|
|
15
|
+
const execute = ${executeCode};
|
|
16
16
|
|
|
17
17
|
// Execute the function and output the result
|
|
18
18
|
(async () => {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { env } from "../../../env.js";
|
|
2
|
+
|
|
1
3
|
//#region src/domains/run/types/executionContext.ts
|
|
2
4
|
/**
|
|
3
5
|
* Extract userId from execution context metadata (when available)
|
|
@@ -16,7 +18,7 @@ function createBaseExecutionContext(params) {
|
|
|
16
18
|
tenantId: params.tenantId,
|
|
17
19
|
projectId: params.projectId,
|
|
18
20
|
agentId: params.agentId,
|
|
19
|
-
baseUrl: params.baseUrl ||
|
|
21
|
+
baseUrl: params.baseUrl || env.INKEEP_AGENTS_API_URL,
|
|
20
22
|
apiKeyId: params.apiKeyId,
|
|
21
23
|
subAgentId: params.subAgentId,
|
|
22
24
|
ref: params.ref,
|
package/dist/env.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ declare const envSchema: z.ZodObject<{
|
|
|
37
37
|
NANGO_SECRET_KEY: z.ZodOptional<z.ZodString>;
|
|
38
38
|
OTEL_BSP_SCHEDULE_DELAY: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
39
39
|
OTEL_BSP_MAX_EXPORT_BATCH_SIZE: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
40
|
-
DISABLE_AUTH: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodTransform<boolean, string>>;
|
|
41
40
|
TENANT_ID: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
42
41
|
SIGNOZ_URL: z.ZodOptional<z.ZodString>;
|
|
43
42
|
SIGNOZ_API_KEY: z.ZodOptional<z.ZodString>;
|
|
@@ -45,6 +44,12 @@ declare const envSchema: z.ZodObject<{
|
|
|
45
44
|
ANTHROPIC_API_KEY: z.ZodString;
|
|
46
45
|
OPENAI_API_KEY: z.ZodOptional<z.ZodString>;
|
|
47
46
|
GOOGLE_GENERATIVE_AI_API_KEY: z.ZodOptional<z.ZodString>;
|
|
47
|
+
GITHUB_APP_ID: z.ZodOptional<z.ZodString>;
|
|
48
|
+
GITHUB_APP_PRIVATE_KEY: z.ZodOptional<z.ZodString>;
|
|
49
|
+
GITHUB_WEBHOOK_SECRET: z.ZodOptional<z.ZodString>;
|
|
50
|
+
GITHUB_STATE_SIGNING_SECRET: z.ZodOptional<z.ZodString>;
|
|
51
|
+
GITHUB_APP_NAME: z.ZodOptional<z.ZodString>;
|
|
52
|
+
GITHUB_MCP_API_KEY: z.ZodOptional<z.ZodString>;
|
|
48
53
|
WORKFLOW_TARGET_WORLD: z.ZodOptional<z.ZodString>;
|
|
49
54
|
WORKFLOW_POSTGRES_URL: z.ZodOptional<z.ZodString>;
|
|
50
55
|
WORKFLOW_POSTGRES_JOB_PREFIX: z.ZodOptional<z.ZodString>;
|
|
@@ -60,7 +65,6 @@ declare const env: {
|
|
|
60
65
|
NANGO_SERVER_URL: string;
|
|
61
66
|
OTEL_BSP_SCHEDULE_DELAY: number;
|
|
62
67
|
OTEL_BSP_MAX_EXPORT_BATCH_SIZE: number;
|
|
63
|
-
DISABLE_AUTH: boolean;
|
|
64
68
|
TENANT_ID: string;
|
|
65
69
|
ANTHROPIC_API_KEY: string;
|
|
66
70
|
INKEEP_AGENTS_MANAGE_UI_URL?: string | undefined;
|
|
@@ -79,6 +83,12 @@ declare const env: {
|
|
|
79
83
|
PUBLIC_SIGNOZ_URL?: string | undefined;
|
|
80
84
|
OPENAI_API_KEY?: string | undefined;
|
|
81
85
|
GOOGLE_GENERATIVE_AI_API_KEY?: string | undefined;
|
|
86
|
+
GITHUB_APP_ID?: string | undefined;
|
|
87
|
+
GITHUB_APP_PRIVATE_KEY?: string | undefined;
|
|
88
|
+
GITHUB_WEBHOOK_SECRET?: string | undefined;
|
|
89
|
+
GITHUB_STATE_SIGNING_SECRET?: string | undefined;
|
|
90
|
+
GITHUB_APP_NAME?: string | undefined;
|
|
91
|
+
GITHUB_MCP_API_KEY?: string | undefined;
|
|
82
92
|
WORKFLOW_TARGET_WORLD?: string | undefined;
|
|
83
93
|
WORKFLOW_POSTGRES_URL?: string | undefined;
|
|
84
94
|
WORKFLOW_POSTGRES_JOB_PREFIX?: string | undefined;
|
package/dist/env.js
CHANGED
|
@@ -8,49 +8,54 @@ const envSchema = z.object({
|
|
|
8
8
|
"development",
|
|
9
9
|
"production",
|
|
10
10
|
"test"
|
|
11
|
-
]).default("development"),
|
|
11
|
+
]).default("development").describe("Node.js environment mode"),
|
|
12
12
|
ENVIRONMENT: z.enum([
|
|
13
13
|
"development",
|
|
14
14
|
"production",
|
|
15
15
|
"pentest",
|
|
16
16
|
"test"
|
|
17
|
-
]).default("development"),
|
|
17
|
+
]).default("development").describe("Application environment mode"),
|
|
18
18
|
LOG_LEVEL: z.enum([
|
|
19
19
|
"trace",
|
|
20
20
|
"debug",
|
|
21
21
|
"info",
|
|
22
22
|
"warn",
|
|
23
23
|
"error"
|
|
24
|
-
]).default("info"),
|
|
25
|
-
INKEEP_AGENTS_MANAGE_DATABASE_URL: z.string(),
|
|
26
|
-
INKEEP_AGENTS_RUN_DATABASE_URL: z.string(),
|
|
27
|
-
INKEEP_AGENTS_MANAGE_UI_URL: z.string().optional(),
|
|
28
|
-
INKEEP_AGENTS_API_URL: z.string().optional().default("http://localhost:3002"),
|
|
29
|
-
BETTER_AUTH_SECRET: z.string().optional(),
|
|
30
|
-
INKEEP_AGENTS_MANAGE_UI_USERNAME: z.string().optional().refine((val) => !val || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), { message: "Invalid email address" }),
|
|
31
|
-
INKEEP_AGENTS_MANAGE_UI_PASSWORD: z.string().optional().refine((val) => !val || val.length >= 8, { message: "Password must be at least 8 characters" }),
|
|
32
|
-
INKEEP_AGENTS_API_BYPASS_SECRET: z.string().optional(),
|
|
33
|
-
INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET: z.string().optional(),
|
|
34
|
-
INKEEP_AGENTS_RUN_API_BYPASS_SECRET: z.string().optional(),
|
|
35
|
-
INKEEP_AGENTS_EVAL_API_BYPASS_SECRET: z.string().optional(),
|
|
36
|
-
INKEEP_AGENTS_TEMP_JWT_PUBLIC_KEY: z.string().optional(),
|
|
37
|
-
INKEEP_AGENTS_TEMP_JWT_PRIVATE_KEY: z.string().optional(),
|
|
38
|
-
NANGO_SERVER_URL: z.string().optional().default("https://api.nango.dev"),
|
|
39
|
-
NANGO_SECRET_KEY: z.string().optional(),
|
|
40
|
-
OTEL_BSP_SCHEDULE_DELAY: z.coerce.number().optional().default(500),
|
|
41
|
-
OTEL_BSP_MAX_EXPORT_BATCH_SIZE: z.coerce.number().optional().default(64),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
24
|
+
]).default("info").describe("Logging verbosity level"),
|
|
25
|
+
INKEEP_AGENTS_MANAGE_DATABASE_URL: z.string().describe("PostgreSQL connection URL for the management database (Doltgres with Git version control)"),
|
|
26
|
+
INKEEP_AGENTS_RUN_DATABASE_URL: z.string().describe("PostgreSQL connection URL for the runtime database (Doltgres with Git version control)"),
|
|
27
|
+
INKEEP_AGENTS_MANAGE_UI_URL: z.string().optional().describe("URL where the management UI is hosted"),
|
|
28
|
+
INKEEP_AGENTS_API_URL: z.string().optional().default("http://localhost:3002").describe("URL where the agents management API is running"),
|
|
29
|
+
BETTER_AUTH_SECRET: z.string().optional().describe("Secret key for Better Auth session encryption (change in production)"),
|
|
30
|
+
INKEEP_AGENTS_MANAGE_UI_USERNAME: z.string().optional().refine((val) => !val || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), { message: "Invalid email address" }).describe("Admin email address for management UI login"),
|
|
31
|
+
INKEEP_AGENTS_MANAGE_UI_PASSWORD: z.string().optional().refine((val) => !val || val.length >= 8, { message: "Password must be at least 8 characters" }).describe("Admin password for management UI login (min 8 characters)"),
|
|
32
|
+
INKEEP_AGENTS_API_BYPASS_SECRET: z.string().optional().describe("API bypass secret for local development and testing (skips auth)"),
|
|
33
|
+
INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET: z.string().optional().describe("Management API bypass secret for local development and testing (skips auth)"),
|
|
34
|
+
INKEEP_AGENTS_RUN_API_BYPASS_SECRET: z.string().optional().describe("Run API bypass secret for local development and testing (skips auth)"),
|
|
35
|
+
INKEEP_AGENTS_EVAL_API_BYPASS_SECRET: z.string().optional().describe("Eval API bypass secret for local development and testing (skips auth)"),
|
|
36
|
+
INKEEP_AGENTS_TEMP_JWT_PUBLIC_KEY: z.string().optional().describe("Temporary JWT public key for Playground (generate with scripts/generate-jwt-keys.sh)"),
|
|
37
|
+
INKEEP_AGENTS_TEMP_JWT_PRIVATE_KEY: z.string().optional().describe("Temporary JWT private key for Playground (generate with scripts/generate-jwt-keys.sh)"),
|
|
38
|
+
NANGO_SERVER_URL: z.string().optional().default("https://api.nango.dev").describe("Nango server URL for OAuth integrations"),
|
|
39
|
+
NANGO_SECRET_KEY: z.string().optional().describe("Nango secret key for OAuth integrations"),
|
|
40
|
+
OTEL_BSP_SCHEDULE_DELAY: z.coerce.number().optional().default(500).describe("OpenTelemetry batch span processor schedule delay in milliseconds"),
|
|
41
|
+
OTEL_BSP_MAX_EXPORT_BATCH_SIZE: z.coerce.number().optional().default(64).describe("OpenTelemetry batch span processor max export batch size"),
|
|
42
|
+
TENANT_ID: z.string().optional().default("default").describe("Default tenant ID for development"),
|
|
43
|
+
SIGNOZ_URL: z.string().optional().describe("SigNoz server URL for observability"),
|
|
44
|
+
SIGNOZ_API_KEY: z.string().optional().describe("SigNoz API key for authentication"),
|
|
45
|
+
PUBLIC_SIGNOZ_URL: z.string().optional().describe("Public SigNoz URL accessible from the browser"),
|
|
46
|
+
ANTHROPIC_API_KEY: z.string().describe("Anthropic API key for Claude models (required for agent execution). Get from https://console.anthropic.com/"),
|
|
47
|
+
OPENAI_API_KEY: z.string().optional().describe("OpenAI API key for GPT models. Get from https://platform.openai.com/"),
|
|
48
|
+
GOOGLE_GENERATIVE_AI_API_KEY: z.string().optional().describe("Google Generative AI API key for Gemini models"),
|
|
49
|
+
GITHUB_APP_ID: z.string().optional().describe("GitHub App ID for GitHub integration"),
|
|
50
|
+
GITHUB_APP_PRIVATE_KEY: z.string().optional().describe("GitHub App private key for authentication"),
|
|
51
|
+
GITHUB_WEBHOOK_SECRET: z.string().optional().describe("Secret for validating GitHub webhook payloads"),
|
|
52
|
+
GITHUB_STATE_SIGNING_SECRET: z.string().min(32, "GITHUB_STATE_SIGNING_SECRET must be at least 32 characters").optional().describe("Secret for signing GitHub OAuth state (minimum 32 characters)"),
|
|
53
|
+
GITHUB_APP_NAME: z.string().optional().describe("Name of the GitHub App"),
|
|
54
|
+
GITHUB_MCP_API_KEY: z.string().optional().describe("API key for the GitHub MCP"),
|
|
55
|
+
WORKFLOW_TARGET_WORLD: z.string().optional().describe("Target world for workflow execution"),
|
|
56
|
+
WORKFLOW_POSTGRES_URL: z.string().optional().describe("PostgreSQL connection URL for workflow job queue"),
|
|
57
|
+
WORKFLOW_POSTGRES_JOB_PREFIX: z.string().optional().describe("Prefix for workflow job names in the queue"),
|
|
58
|
+
WORKFLOW_POSTGRES_WORKER_CONCURRENCY: z.string().optional().describe("Number of concurrent workflow workers")
|
|
54
59
|
});
|
|
55
60
|
const parseEnv = () => {
|
|
56
61
|
try {
|
package/dist/factory.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SandboxConfig } from "./types/app.js";
|
|
2
2
|
import "./types/index.js";
|
|
3
3
|
import { createAgentsHono } from "./createApp.js";
|
|
4
|
-
import { initializeDefaultUser } from "./initialization.js";
|
|
5
4
|
import { createAuth0Provider, createOIDCProvider } from "./ssoHelpers.js";
|
|
6
|
-
import * as hono0 from "hono";
|
|
7
5
|
import { CredentialStore, ServerConfig } from "@inkeep/agents-core";
|
|
6
|
+
import * as hono0 from "hono";
|
|
8
7
|
import * as zod0 from "zod";
|
|
9
8
|
import { SSOProviderConfig, UserAuthConfig } from "@inkeep/agents-core/auth";
|
|
10
9
|
import * as hono_types1 from "hono/types";
|
|
@@ -122,11 +121,11 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
122
121
|
useSecureCookies?: boolean | undefined;
|
|
123
122
|
disableCSRFCheck?: boolean | undefined;
|
|
124
123
|
disableOriginCheck?: boolean | undefined;
|
|
125
|
-
crossSubDomainCookies
|
|
124
|
+
crossSubDomainCookies?: {
|
|
126
125
|
enabled: boolean;
|
|
127
126
|
additionalCookies?: string[];
|
|
128
127
|
domain?: string;
|
|
129
|
-
};
|
|
128
|
+
} | undefined;
|
|
130
129
|
cookies?: {
|
|
131
130
|
[key: string]: {
|
|
132
131
|
name?: string;
|
|
@@ -816,6 +815,7 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
816
815
|
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
|
|
817
816
|
};
|
|
818
817
|
};
|
|
818
|
+
creatorRole: "admin";
|
|
819
819
|
membershipLimit: number;
|
|
820
820
|
invitationLimit: number;
|
|
821
821
|
invitationExpiresIn: number;
|
|
@@ -1125,6 +1125,7 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
1125
1125
|
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
|
|
1126
1126
|
};
|
|
1127
1127
|
};
|
|
1128
|
+
creatorRole: "admin";
|
|
1128
1129
|
membershipLimit: number;
|
|
1129
1130
|
invitationLimit: number;
|
|
1130
1131
|
invitationExpiresIn: number;
|
|
@@ -1529,13 +1530,12 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
1529
1530
|
verificationUri?: string | undefined;
|
|
1530
1531
|
}>;
|
|
1531
1532
|
}];
|
|
1532
|
-
}
|
|
1533
|
+
}>;
|
|
1533
1534
|
declare function createAgentsApp(config?: {
|
|
1534
1535
|
serverConfig?: ServerConfig;
|
|
1535
1536
|
credentialStores?: CredentialStore[];
|
|
1536
1537
|
auth?: UserAuthConfig;
|
|
1537
1538
|
sandboxConfig?: SandboxConfig;
|
|
1538
|
-
skipInitialization?: boolean;
|
|
1539
1539
|
}): hono0.Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
|
|
1540
1540
|
//#endregion
|
|
1541
|
-
export { type SSOProviderConfig, type UserAuthConfig, createAgentsApp, createAgentsAuth, createAgentsHono, createAuth0Provider, createOIDCProvider
|
|
1541
|
+
export { type SSOProviderConfig, type UserAuthConfig, createAgentsApp, createAgentsAuth, createAgentsHono, createAuth0Provider, createOIDCProvider };
|
package/dist/factory.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { env } from "./env.js";
|
|
2
2
|
import runDbClient_default from "./data/db/runDbClient.js";
|
|
3
3
|
import { createAgentsHono } from "./createApp.js";
|
|
4
|
-
import { initializeDefaultUser } from "./initialization.js";
|
|
5
4
|
import { createAuth0Provider, createOIDCProvider } from "./ssoHelpers.js";
|
|
6
5
|
import { CredentialStoreRegistry, createDefaultCredentialStores } from "@inkeep/agents-core";
|
|
7
6
|
import { createAuth } from "@inkeep/agents-core/auth";
|
|
@@ -16,7 +15,6 @@ const defaultConfig = {
|
|
|
16
15
|
}
|
|
17
16
|
};
|
|
18
17
|
function createAgentsAuth(userAuthConfig) {
|
|
19
|
-
if (env.DISABLE_AUTH) return null;
|
|
20
18
|
return createAuth({
|
|
21
19
|
baseURL: env.INKEEP_AGENTS_API_URL || `http://localhost:3002`,
|
|
22
20
|
secret: env.BETTER_AUTH_SECRET || "development-secret-change-in-production",
|
|
@@ -26,17 +24,13 @@ function createAgentsAuth(userAuthConfig) {
|
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
26
|
function createAgentsApp(config) {
|
|
29
|
-
const serverConfig = config?.serverConfig ?? defaultConfig;
|
|
30
|
-
const registry = new CredentialStoreRegistry(config?.credentialStores ?? createDefaultCredentialStores());
|
|
31
|
-
const auth$1 = createAgentsAuth(config?.auth);
|
|
32
|
-
if (!config?.skipInitialization && env.ENVIRONMENT !== "test") initializeDefaultUser(auth$1);
|
|
33
27
|
return createAgentsHono({
|
|
34
|
-
serverConfig,
|
|
35
|
-
credentialStores:
|
|
36
|
-
auth: auth
|
|
28
|
+
serverConfig: config?.serverConfig ?? defaultConfig,
|
|
29
|
+
credentialStores: new CredentialStoreRegistry(config?.credentialStores ?? createDefaultCredentialStores()),
|
|
30
|
+
auth: createAgentsAuth(config?.auth),
|
|
37
31
|
sandboxConfig: config?.sandboxConfig
|
|
38
32
|
});
|
|
39
33
|
}
|
|
40
34
|
|
|
41
35
|
//#endregion
|
|
42
|
-
export { createAgentsApp, createAgentsAuth, createAgentsHono, createAuth0Provider, createOIDCProvider
|
|
36
|
+
export { createAgentsApp, createAgentsAuth, createAgentsHono, createAuth0Provider, createOIDCProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import "./types/index.js";
|
|
|
3
3
|
import { createAgentsHono } from "./createApp.js";
|
|
4
4
|
import { NativeSandboxConfig, SandboxConfig, VercelSandboxConfig } from "./domains/run/types/executionContext.js";
|
|
5
5
|
import "./env.js";
|
|
6
|
-
import { initializeDefaultUser } from "./initialization.js";
|
|
7
6
|
import { createAuth0Provider, createOIDCProvider } from "./ssoHelpers.js";
|
|
8
7
|
import { SSOProviderConfig, UserAuthConfig, createAgentsApp } from "./factory.js";
|
|
9
8
|
import { Hono } from "hono";
|
|
@@ -123,11 +122,11 @@ declare const auth: better_auth78.Auth<{
|
|
|
123
122
|
useSecureCookies?: boolean | undefined;
|
|
124
123
|
disableCSRFCheck?: boolean | undefined;
|
|
125
124
|
disableOriginCheck?: boolean | undefined;
|
|
126
|
-
crossSubDomainCookies
|
|
125
|
+
crossSubDomainCookies?: {
|
|
127
126
|
enabled: boolean;
|
|
128
127
|
additionalCookies?: string[];
|
|
129
128
|
domain?: string;
|
|
130
|
-
};
|
|
129
|
+
} | undefined;
|
|
131
130
|
cookies?: {
|
|
132
131
|
[key: string]: {
|
|
133
132
|
name?: string;
|
|
@@ -817,6 +816,7 @@ declare const auth: better_auth78.Auth<{
|
|
|
817
816
|
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>;
|
|
818
817
|
};
|
|
819
818
|
};
|
|
819
|
+
creatorRole: "admin";
|
|
820
820
|
membershipLimit: number;
|
|
821
821
|
invitationLimit: number;
|
|
822
822
|
invitationExpiresIn: number;
|
|
@@ -1126,6 +1126,7 @@ declare const auth: better_auth78.Auth<{
|
|
|
1126
1126
|
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>;
|
|
1127
1127
|
};
|
|
1128
1128
|
};
|
|
1129
|
+
creatorRole: "admin";
|
|
1129
1130
|
membershipLimit: number;
|
|
1130
1131
|
invitationLimit: number;
|
|
1131
1132
|
invitationExpiresIn: number;
|
|
@@ -1530,7 +1531,7 @@ declare const auth: better_auth78.Auth<{
|
|
|
1530
1531
|
verificationUri?: string | undefined;
|
|
1531
1532
|
}>;
|
|
1532
1533
|
}];
|
|
1533
|
-
}
|
|
1534
|
+
}>;
|
|
1534
1535
|
declare const app: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
|
|
1535
1536
|
//#endregion
|
|
1536
|
-
export { type AppConfig, type AppVariables, Hono, type NativeSandboxConfig, type SSOProviderConfig, type SandboxConfig, type UserAuthConfig, type VercelSandboxConfig, auth, createAgentsApp, createAgentsHono, createAuth0Provider, createOIDCProvider, app as default
|
|
1537
|
+
export { type AppConfig, type AppVariables, Hono, type NativeSandboxConfig, type SSOProviderConfig, type SandboxConfig, type UserAuthConfig, type VercelSandboxConfig, auth, createAgentsApp, createAgentsHono, createAuth0Provider, createOIDCProvider, app as default };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./env.js";
|
|
2
2
|
import { defaultSDK } from "./instrumentation.js";
|
|
3
3
|
import { createAgentsHono } from "./createApp.js";
|
|
4
|
-
import { initializeDefaultUser } from "./initialization.js";
|
|
5
4
|
import { createAuth0Provider, createOIDCProvider } from "./ssoHelpers.js";
|
|
6
5
|
import { createAgentsApp, createAgentsAuth } from "./factory.js";
|
|
7
|
-
import { Hono } from "hono";
|
|
8
6
|
import { CredentialStoreRegistry, createDefaultCredentialStores } from "@inkeep/agents-core";
|
|
7
|
+
import { Hono } from "hono";
|
|
9
8
|
|
|
10
9
|
//#region src/index.ts
|
|
11
10
|
defaultSDK.start();
|
|
@@ -52,8 +51,7 @@ const app = createAgentsHono({
|
|
|
52
51
|
auth,
|
|
53
52
|
sandboxConfig
|
|
54
53
|
});
|
|
55
|
-
if (env.ENVIRONMENT === "development") initializeDefaultUser(auth);
|
|
56
54
|
var src_default = app;
|
|
57
55
|
|
|
58
56
|
//#endregion
|
|
59
|
-
export { Hono, auth, createAgentsApp, createAgentsHono, createAuth0Provider, createOIDCProvider, src_default as default
|
|
57
|
+
export { Hono, auth, createAgentsApp, createAgentsHono, createAuth0Provider, createOIDCProvider, src_default as default };
|