@inkeep/agents-api 0.42.0 → 0.44.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 +6 -6
- package/dist/.well-known/workflow/v1/step.cjs +220467 -203416
- package/dist/_virtual/rolldown_runtime.js +7 -0
- package/dist/createApp.js +47 -17
- package/dist/domains/evals/api/.well-known/workflow/v1/flow.d.ts +4 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/flow.js +12 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/step.d.ts +4 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/step.js +12 -0
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/evals/scripts/build-workflow.js +2 -2
- package/dist/domains/evals/workflow/world.js +3 -2
- package/dist/domains/manage/index.js +6 -2
- package/dist/domains/manage/routes/agent.js +7 -4
- package/dist/domains/manage/routes/agentFull.js +9 -6
- package/dist/domains/manage/routes/apiKeys.js +1 -2
- package/dist/domains/manage/routes/artifactComponents.js +5 -5
- package/dist/domains/manage/routes/cliAuth.js +3 -3
- package/dist/domains/manage/routes/contextConfigs.js +5 -5
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/credentialStores.js +2 -2
- package/dist/domains/manage/routes/credentials.js +6 -7
- package/dist/domains/manage/routes/dataComponents.js +6 -7
- package/dist/domains/manage/routes/externalAgents.js +1 -2
- 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/index.js +4 -0
- package/dist/domains/manage/routes/invitations.js +1 -1
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/{agentToolRelations.d.ts → mcpToolGithubAccess.d.ts} +1 -1
- package/dist/domains/manage/routes/mcpToolGithubAccess.js +205 -0
- package/dist/domains/manage/routes/playgroundToken.js +1 -2
- package/dist/domains/manage/routes/projectFull.js +33 -11
- 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 +12 -44
- package/dist/domains/manage/routes/projectPermissions.js +11 -11
- package/dist/domains/manage/routes/projects.js +15 -18
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.js +7 -4
- package/dist/domains/manage/routes/subAgentArtifactComponents.js +5 -5
- package/dist/domains/manage/routes/subAgentDataComponents.js +5 -5
- package/dist/domains/manage/routes/subAgentExternalAgentRelations.js +5 -5
- package/dist/domains/manage/routes/subAgentFunctionTools.js +5 -5
- package/dist/domains/manage/routes/subAgentRelations.js +6 -6
- package/dist/domains/manage/routes/subAgentTeamAgentRelations.js +6 -6
- package/dist/domains/manage/routes/subAgentToolRelations.js +6 -6
- package/dist/domains/manage/routes/subAgents.js +5 -5
- package/dist/domains/manage/routes/tools.js +28 -5
- package/dist/domains/manage/routes/triggers.js +49 -24
- package/dist/domains/manage/routes/userOrganizations.js +4 -4
- package/dist/domains/manage/routes/userProjectMemberships.d.ts +9 -0
- package/dist/domains/manage/routes/userProjectMemberships.js +44 -0
- package/dist/domains/mcp/routes/mcp.d.ts +7 -0
- package/dist/domains/mcp/routes/mcp.js +45 -0
- package/dist/domains/run/agents/Agent.d.ts +1 -0
- package/dist/domains/run/agents/Agent.js +235 -45
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- 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/ContextFetcher.js +8 -7
- package/dist/domains/run/context/validation.d.ts +1 -1
- package/dist/domains/run/handlers/executionHandler.js +143 -79
- package/dist/domains/run/routes/agents.js +1 -1
- package/dist/domains/run/routes/chat.js +47 -1
- package/dist/domains/run/routes/chatDataStream.js +107 -14
- package/dist/domains/run/routes/webhooks.js +40 -348
- package/dist/domains/run/services/AgentSession.d.ts +3 -0
- package/dist/domains/run/services/AgentSession.js +14 -1
- package/dist/domains/run/services/ToolApprovalUiBus.d.ts +28 -0
- package/dist/domains/run/services/ToolApprovalUiBus.js +44 -0
- package/dist/domains/run/services/TriggerService.d.ts +31 -0
- package/dist/domains/run/services/TriggerService.js +545 -0
- package/dist/domains/run/tools/NativeSandboxExecutor.d.ts +3 -2
- package/dist/domains/run/tools/NativeSandboxExecutor.js +76 -48
- package/dist/domains/run/tools/SandboxExecutorFactory.d.ts +11 -1
- package/dist/domains/run/tools/SandboxExecutorFactory.js +27 -3
- package/dist/domains/run/tools/VercelSandboxExecutor.d.ts +3 -11
- package/dist/domains/run/tools/VercelSandboxExecutor.js +137 -127
- package/dist/domains/run/tools/sandbox-utils.js +1 -1
- package/dist/domains/run/types/executionContext.js +3 -1
- package/dist/domains/run/utils/stream-helpers.d.ts +134 -0
- package/dist/domains/run/utils/stream-helpers.js +182 -0
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/env.d.ts +12 -2
- package/dist/env.js +37 -32
- package/dist/factory.d.ts +31 -31
- package/dist/factory.js +4 -10
- package/dist/index.d.ts +30 -29
- package/dist/index.js +3 -5
- package/dist/middleware/branchScopedDb.d.ts +1 -1
- package/dist/middleware/cors.js +1 -1
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectAccess.d.ts +4 -20
- package/dist/middleware/projectAccess.js +7 -49
- 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/sessionAuth.d.ts +3 -3
- package/dist/middleware/sessionAuth.js +1 -2
- package/dist/middleware/tenantAccess.d.ts +2 -2
- package/dist/middleware/tenantAccess.js +4 -4
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/openapi.d.ts +36 -1
- package/dist/openapi.js +40 -95
- package/dist/routes/healthChecks.d.ts +10 -0
- package/dist/routes/healthChecks.js +75 -0
- package/dist/types/app.d.ts +2 -0
- package/dist/types/runExecutionContext.js +3 -1
- package/dist/utils/healthChecks.d.ts +8 -0
- package/dist/utils/healthChecks.js +38 -0
- package/dist/utils/signozHelpers.d.ts +2 -2
- package/dist/utils/signozHelpers.js +15 -3
- package/package.json +8 -9
- package/dist/domains/evals/services/startEvaluation.d.ts +0 -19
- package/dist/domains/evals/services/startEvaluation.js +0 -18
- package/dist/domains/index.d.ts +0 -4
- package/dist/domains/index.js +0 -5
- package/dist/domains/manage/routes/agentToolRelations.js +0 -289
- package/dist/domains/run/agents/ModelFactory.d.ts +0 -63
- package/dist/domains/run/agents/ModelFactory.js +0 -194
- package/dist/domains/run/data/agent.d.ts +0 -7
- package/dist/domains/run/data/agent.js +0 -67
- package/dist/domains/run/services/evaluationRunConfigMatcher.d.ts +0 -4
- package/dist/domains/run/services/evaluationRunConfigMatcher.js +0 -7
- package/dist/domains/run/utils/cleanup.d.ts +0 -21
- package/dist/domains/run/utils/cleanup.js +0 -59
- package/dist/initialization.d.ts +0 -6
- package/dist/initialization.js +0 -65
- package/dist/utils/tempApiKeys.d.ts +0 -17
- package/dist/utils/tempApiKeys.js +0 -26
- package/dist/utils/workflowApiHelpers.d.ts +0 -1
- package/dist/utils/workflowApiHelpers.js +0 -1
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;
|
|
@@ -796,27 +795,28 @@ declare const auth: better_auth78.Auth<{
|
|
|
796
795
|
ac: better_auth_plugins69.AccessControl;
|
|
797
796
|
roles: {
|
|
798
797
|
member: {
|
|
799
|
-
authorize<K_1 extends "organization" | "
|
|
800
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
798
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
|
|
799
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key];
|
|
801
800
|
connector: "OR" | "AND";
|
|
802
801
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
803
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
802
|
+
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>;
|
|
804
803
|
};
|
|
805
804
|
admin: {
|
|
806
|
-
authorize<K_1 extends "organization" | "
|
|
807
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
805
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
|
|
806
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key];
|
|
808
807
|
connector: "OR" | "AND";
|
|
809
808
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
810
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
809
|
+
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>;
|
|
811
810
|
};
|
|
812
811
|
owner: {
|
|
813
|
-
authorize<K_1 extends "organization" | "
|
|
814
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
812
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
|
|
813
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key];
|
|
815
814
|
connector: "OR" | "AND";
|
|
816
815
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
817
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
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;
|
|
@@ -841,13 +841,13 @@ declare const auth: better_auth78.Auth<{
|
|
|
841
841
|
user: better_auth78.User & Record<string, any>;
|
|
842
842
|
organization: better_auth_plugins69.Organization & Record<string, any>;
|
|
843
843
|
}) => Promise<void>;
|
|
844
|
-
|
|
844
|
+
beforeUpdateMemberRole: ({
|
|
845
845
|
member,
|
|
846
846
|
organization: org,
|
|
847
|
-
|
|
847
|
+
newRole
|
|
848
848
|
}: {
|
|
849
849
|
member: better_auth_plugins69.Member & Record<string, any>;
|
|
850
|
-
|
|
850
|
+
newRole: string;
|
|
851
851
|
user: better_auth78.User & Record<string, any>;
|
|
852
852
|
organization: better_auth_plugins69.Organization & Record<string, any>;
|
|
853
853
|
}) => Promise<void>;
|
|
@@ -1105,27 +1105,28 @@ 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" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
|
|
1109
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", 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" | "member" | "invitation" | "ac" | "project" | "team", 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" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
|
|
1116
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", 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" | "member" | "invitation" | "ac" | "project" | "team", 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" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
|
|
1123
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", 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" | "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;
|
|
@@ -1150,13 +1151,13 @@ declare const auth: better_auth78.Auth<{
|
|
|
1150
1151
|
user: better_auth78.User & Record<string, any>;
|
|
1151
1152
|
organization: better_auth_plugins69.Organization & Record<string, any>;
|
|
1152
1153
|
}) => Promise<void>;
|
|
1153
|
-
|
|
1154
|
+
beforeUpdateMemberRole: ({
|
|
1154
1155
|
member,
|
|
1155
1156
|
organization: org,
|
|
1156
|
-
|
|
1157
|
+
newRole
|
|
1157
1158
|
}: {
|
|
1158
1159
|
member: better_auth_plugins69.Member & Record<string, any>;
|
|
1159
|
-
|
|
1160
|
+
newRole: string;
|
|
1160
1161
|
user: better_auth78.User & Record<string, any>;
|
|
1161
1162
|
organization: better_auth_plugins69.Organization & Record<string, any>;
|
|
1162
1163
|
}) => Promise<void>;
|
|
@@ -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 };
|
package/dist/middleware/cors.js
CHANGED
|
@@ -18,7 +18,7 @@ function isOriginAllowed(origin) {
|
|
|
18
18
|
if (!origin) return false;
|
|
19
19
|
try {
|
|
20
20
|
const requestUrl = new URL(origin);
|
|
21
|
-
const apiUrl = new URL(env.INKEEP_AGENTS_API_URL ||
|
|
21
|
+
const apiUrl = new URL(env.INKEEP_AGENTS_API_URL || "http://localhost:3002");
|
|
22
22
|
const uiUrl = env.INKEEP_AGENTS_MANAGE_UI_URL ? new URL(env.INKEEP_AGENTS_MANAGE_UI_URL) : null;
|
|
23
23
|
if (requestUrl.hostname === "localhost" || requestUrl.hostname === "127.0.0.1") return true;
|
|
24
24
|
if (uiUrl && requestUrl.hostname === uiUrl.hostname) return true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as hono0 from "hono";
|
|
2
1
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
2
|
+
import * as hono2 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/evalsAuth.d.ts
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
|
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: () => hono2.MiddlewareHandler<{
|
|
11
11
|
Variables: {
|
|
12
12
|
executionContext: BaseExecutionContext;
|
|
13
13
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as hono1 from "hono";
|
|
2
1
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
2
|
+
import * as hono3 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: () => hono3.MiddlewareHandler<{
|
|
16
16
|
Variables: {
|
|
17
17
|
executionContext: BaseExecutionContext;
|
|
18
18
|
userId?: string;
|
|
@@ -1,31 +1,15 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../types/app.js";
|
|
2
|
-
import
|
|
2
|
+
import { ProjectPermissionLevel } from "@inkeep/agents-core";
|
|
3
|
+
import * as hono4 from "hono";
|
|
3
4
|
|
|
4
5
|
//#region src/middleware/projectAccess.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Permission levels for project access
|
|
8
|
-
*
|
|
9
|
-
* - view: Can see project and resources (read-only)
|
|
10
|
-
* - use: Can invoke agents, create API keys, view traces
|
|
11
|
-
* - edit: Can modify configurations and manage members
|
|
12
|
-
*/
|
|
13
|
-
type ProjectPermission = 'view' | 'use' | 'edit';
|
|
14
6
|
/**
|
|
15
7
|
* Middleware to check project-level access.
|
|
16
|
-
*
|
|
17
|
-
* When ENABLE_AUTHZ is false:
|
|
18
|
-
* - 'view' permission: all org members can view
|
|
19
|
-
* - 'edit': only org owner/admin
|
|
20
|
-
*
|
|
21
|
-
* When ENABLE_AUTHZ is true:
|
|
22
|
-
* - Uses SpiceDB to check permissions
|
|
23
|
-
* - Org owner/admin bypass (handled in canViewProject etc.)
|
|
24
8
|
*/
|
|
25
9
|
declare const requireProjectPermission: <Env$1 extends {
|
|
26
10
|
Variables: ManageAppVariables;
|
|
27
11
|
} = {
|
|
28
12
|
Variables: ManageAppVariables;
|
|
29
|
-
}>(permission?:
|
|
13
|
+
}>(permission?: ProjectPermissionLevel) => hono4.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
30
14
|
//#endregion
|
|
31
|
-
export {
|
|
15
|
+
export { requireProjectPermission };
|
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { canEditProject, canUseProject, canViewProject, createApiError, isAuthzEnabled } from "@inkeep/agents-core";
|
|
1
|
+
import { canEditProject, canUseProject, canViewProject, createApiError } from "@inkeep/agents-core";
|
|
3
2
|
import { createMiddleware } from "hono/factory";
|
|
4
3
|
import { HTTPException } from "hono/http-exception";
|
|
5
4
|
|
|
6
5
|
//#region src/middleware/projectAccess.ts
|
|
7
6
|
/**
|
|
8
7
|
* Middleware to check project-level access.
|
|
9
|
-
*
|
|
10
|
-
* When ENABLE_AUTHZ is false:
|
|
11
|
-
* - 'view' permission: all org members can view
|
|
12
|
-
* - 'edit': only org owner/admin
|
|
13
|
-
*
|
|
14
|
-
* When ENABLE_AUTHZ is true:
|
|
15
|
-
* - Uses SpiceDB to check permissions
|
|
16
|
-
* - Org owner/admin bypass (handled in canViewProject etc.)
|
|
17
8
|
*/
|
|
18
9
|
const requireProjectPermission = (permission = "view") => createMiddleware(async (c, next) => {
|
|
19
|
-
|
|
20
|
-
if (env.DISABLE_AUTH || isTestEnvironment) {
|
|
10
|
+
if (process.env.ENVIRONMENT === "test") {
|
|
21
11
|
await next();
|
|
22
12
|
return;
|
|
23
13
|
}
|
|
@@ -44,7 +34,6 @@ const requireProjectPermission = (permission = "view") => createMiddleware(async
|
|
|
44
34
|
switch (permission) {
|
|
45
35
|
case "view":
|
|
46
36
|
hasAccess = await canViewProject({
|
|
47
|
-
tenantId,
|
|
48
37
|
userId,
|
|
49
38
|
projectId,
|
|
50
39
|
orgRole: tenantRole
|
|
@@ -52,7 +41,6 @@ const requireProjectPermission = (permission = "view") => createMiddleware(async
|
|
|
52
41
|
break;
|
|
53
42
|
case "use":
|
|
54
43
|
hasAccess = await canUseProject({
|
|
55
|
-
tenantId,
|
|
56
44
|
userId,
|
|
57
45
|
projectId,
|
|
58
46
|
orgRole: tenantRole
|
|
@@ -60,47 +48,17 @@ const requireProjectPermission = (permission = "view") => createMiddleware(async
|
|
|
60
48
|
break;
|
|
61
49
|
case "edit":
|
|
62
50
|
hasAccess = await canEditProject({
|
|
63
|
-
tenantId,
|
|
64
51
|
userId,
|
|
65
52
|
projectId,
|
|
66
53
|
orgRole: tenantRole
|
|
67
54
|
});
|
|
68
55
|
break;
|
|
69
56
|
}
|
|
70
|
-
if (!hasAccess) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
projectId,
|
|
76
|
-
orgRole: tenantRole
|
|
77
|
-
})) throw createApiError({
|
|
78
|
-
code: "forbidden",
|
|
79
|
-
message: `Permission denied. Required: project:${permission}`,
|
|
80
|
-
instance: c.req.path,
|
|
81
|
-
extensions: { requiredPermissions: [`project:${permission}`] }
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
if (isAuthzEnabled(tenantId)) throw createApiError({
|
|
85
|
-
code: "not_found",
|
|
86
|
-
message: "Project not found",
|
|
87
|
-
instance: c.req.path
|
|
88
|
-
});
|
|
89
|
-
throw createApiError({
|
|
90
|
-
code: "forbidden",
|
|
91
|
-
message: `Permission denied. Required: project:${permission}`,
|
|
92
|
-
instance: c.req.path,
|
|
93
|
-
extensions: {
|
|
94
|
-
requiredPermissions: [`project:${permission}`],
|
|
95
|
-
context: {
|
|
96
|
-
userId,
|
|
97
|
-
organizationId: tenantId,
|
|
98
|
-
projectId,
|
|
99
|
-
currentRole: tenantRole
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
57
|
+
if (!hasAccess) throw createApiError({
|
|
58
|
+
code: "not_found",
|
|
59
|
+
message: "Project not found",
|
|
60
|
+
instance: c.req.path
|
|
61
|
+
});
|
|
104
62
|
await next();
|
|
105
63
|
} catch (error) {
|
|
106
64
|
if (error instanceof HTTPException) throw error;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as hono3 from "hono";
|
|
2
1
|
import { BaseExecutionContext, ResolvedRef } from "@inkeep/agents-core";
|
|
2
|
+
import * as hono5 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/projectConfig.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Middleware that fetches the full project definition from the Management API
|
|
7
7
|
*/
|
|
8
|
-
declare const projectConfigMiddleware:
|
|
8
|
+
declare const projectConfigMiddleware: hono5.MiddlewareHandler<{
|
|
9
9
|
Variables: {
|
|
10
10
|
executionContext: BaseExecutionContext;
|
|
11
11
|
resolvedRef: ResolvedRef;
|
|
@@ -15,7 +15,7 @@ declare const projectConfigMiddleware: hono3.MiddlewareHandler<{
|
|
|
15
15
|
* Creates a middleware that applies project config fetching except for specified route patterns
|
|
16
16
|
* @param skipRouteCheck - Function that returns true if the route should skip the middleware
|
|
17
17
|
*/
|
|
18
|
-
declare const projectConfigMiddlewareExcept: (skipRouteCheck: (path: string) => boolean) =>
|
|
18
|
+
declare const projectConfigMiddlewareExcept: (skipRouteCheck: (path: string) => boolean) => hono5.MiddlewareHandler<{
|
|
19
19
|
Variables: {
|
|
20
20
|
executionContext: BaseExecutionContext;
|
|
21
21
|
resolvedRef: ResolvedRef;
|
package/dist/middleware/ref.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../types/app.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono8 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) => hono8.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { requirePermission };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { env } from "../env.js";
|
|
2
1
|
import { createApiError } from "@inkeep/agents-core";
|
|
3
2
|
import { createMiddleware } from "hono/factory";
|
|
4
3
|
import { HTTPException } from "hono/http-exception";
|
|
@@ -15,7 +14,7 @@ function formatPermissionsForDisplay(permissions) {
|
|
|
15
14
|
const requirePermission = (permissions) => createMiddleware(async (c, next) => {
|
|
16
15
|
const isTestEnvironment = process.env.ENVIRONMENT === "test";
|
|
17
16
|
const auth = c.get("auth");
|
|
18
|
-
if (
|
|
17
|
+
if (isTestEnvironment || !auth) {
|
|
19
18
|
await next();
|
|
20
19
|
return;
|
|
21
20
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as hono6 from "hono";
|
|
2
1
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
2
|
+
import * as hono9 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/runAuth.d.ts
|
|
5
|
-
declare const runApiKeyAuth: () =>
|
|
5
|
+
declare const runApiKeyAuth: () => hono9.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) => hono9.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: () => hono9.MiddlewareHandler<{
|
|
24
24
|
Variables: {
|
|
25
25
|
executionContext?: BaseExecutionContext;
|
|
26
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono12 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/sessionAuth.d.ts
|
|
4
4
|
|
|
@@ -7,11 +7,11 @@ import * as hono9 from "hono";
|
|
|
7
7
|
* Requires that a user has already been authenticated via Better Auth session.
|
|
8
8
|
* Used primarily for manage routes that require an active user session.
|
|
9
9
|
*/
|
|
10
|
-
declare const sessionAuth: () =>
|
|
10
|
+
declare const sessionAuth: () => hono12.MiddlewareHandler<any, string, {}, Response>;
|
|
11
11
|
/**
|
|
12
12
|
* Global session middleware - sets user and session in context for all routes
|
|
13
13
|
* Used for all routes that require an active user session.
|
|
14
14
|
*/
|
|
15
|
-
declare const sessionContext: () =>
|
|
15
|
+
declare const sessionContext: () => hono12.MiddlewareHandler<any, string, {}, Response>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { sessionAuth, sessionContext };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { env } from "../env.js";
|
|
2
1
|
import { createApiError } from "@inkeep/agents-core";
|
|
3
2
|
import { createMiddleware } from "hono/factory";
|
|
4
3
|
import { HTTPException } from "hono/http-exception";
|
|
@@ -33,7 +32,7 @@ const sessionAuth = () => createMiddleware(async (c, next) => {
|
|
|
33
32
|
*/
|
|
34
33
|
const sessionContext = () => createMiddleware(async (c, next) => {
|
|
35
34
|
const auth = c.get("auth");
|
|
36
|
-
if (
|
|
35
|
+
if (!auth) {
|
|
37
36
|
c.set("user", null);
|
|
38
37
|
c.set("session", null);
|
|
39
38
|
await next();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono14 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tenantAccess.d.ts
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ import * as hono11 from "hono";
|
|
|
11
11
|
* - API key user: Access only to the tenant associated with the API key
|
|
12
12
|
* - Session user: Access based on organization membership
|
|
13
13
|
*/
|
|
14
|
-
declare const requireTenantAccess: () =>
|
|
14
|
+
declare const requireTenantAccess: () => hono14.MiddlewareHandler<{
|
|
15
15
|
Variables: {
|
|
16
16
|
userId: string;
|
|
17
17
|
tenantId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import runDbClient_default from "../data/db/runDbClient.js";
|
|
2
|
-
import { createApiError,
|
|
2
|
+
import { OrgRoles, createApiError, getUserOrganizationsFromDb } from "@inkeep/agents-core";
|
|
3
3
|
import { createMiddleware } from "hono/factory";
|
|
4
4
|
import { HTTPException } from "hono/http-exception";
|
|
5
5
|
|
|
@@ -26,7 +26,7 @@ const requireTenantAccess = () => createMiddleware(async (c, next) => {
|
|
|
26
26
|
});
|
|
27
27
|
if (userId === "system") {
|
|
28
28
|
c.set("tenantId", tenantId);
|
|
29
|
-
c.set("tenantRole",
|
|
29
|
+
c.set("tenantRole", OrgRoles.OWNER);
|
|
30
30
|
await next();
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
@@ -37,12 +37,12 @@ const requireTenantAccess = () => createMiddleware(async (c, next) => {
|
|
|
37
37
|
message: "API key does not have access to this organization"
|
|
38
38
|
});
|
|
39
39
|
c.set("tenantId", tenantId);
|
|
40
|
-
c.set("tenantRole",
|
|
40
|
+
c.set("tenantRole", OrgRoles.OWNER);
|
|
41
41
|
await next();
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
try {
|
|
45
|
-
const organizationAccess = (await
|
|
45
|
+
const organizationAccess = (await getUserOrganizationsFromDb(runDbClient_default)(userId)).find((org) => org.organizationId === tenantId);
|
|
46
46
|
if (!organizationAccess) throw createApiError({
|
|
47
47
|
code: "forbidden",
|
|
48
48
|
message: "Access denied to this organization"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono15 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tracing.d.ts
|
|
4
|
-
declare const otelBaggageMiddleware: () =>
|
|
5
|
-
declare const executionBaggageMiddleware: () =>
|
|
4
|
+
declare const otelBaggageMiddleware: () => hono15.MiddlewareHandler<any, string, {}, Response>;
|
|
5
|
+
declare const executionBaggageMiddleware: () => hono15.MiddlewareHandler<any, string, {}, Response>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { executionBaggageMiddleware, otelBaggageMiddleware };
|
package/dist/openapi.d.ts
CHANGED
|
@@ -2,6 +2,41 @@ import { OpenAPIHono } from "@hono/zod-openapi";
|
|
|
2
2
|
import { Env } from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/openapi.d.ts
|
|
5
|
+
declare const TagToDescription: {
|
|
6
|
+
A2A: string;
|
|
7
|
+
'API Keys': string;
|
|
8
|
+
Agents: string;
|
|
9
|
+
'Artifact Components': string;
|
|
10
|
+
Branches: string;
|
|
11
|
+
CLI: string;
|
|
12
|
+
Chat: string;
|
|
13
|
+
'Context Configs': string;
|
|
14
|
+
Conversations: string;
|
|
15
|
+
Credentials: string;
|
|
16
|
+
'Credential Stores': string;
|
|
17
|
+
'Data Components': string;
|
|
18
|
+
Evaluations: string;
|
|
19
|
+
'External Agents': string;
|
|
20
|
+
'Function Tools': string;
|
|
21
|
+
Functions: string;
|
|
22
|
+
GitHub: string;
|
|
23
|
+
Invitations: string;
|
|
24
|
+
MCP: string;
|
|
25
|
+
'MCP Catalog': string;
|
|
26
|
+
OAuth: string;
|
|
27
|
+
'Project Members': string;
|
|
28
|
+
'Project Permissions': string;
|
|
29
|
+
Projects: string;
|
|
30
|
+
Refs: string;
|
|
31
|
+
SubAgents: string;
|
|
32
|
+
'Third-Party MCP Servers': string;
|
|
33
|
+
Tools: string;
|
|
34
|
+
Triggers: string;
|
|
35
|
+
'User Organizations': string;
|
|
36
|
+
'User Project Memberships': string;
|
|
37
|
+
Webhooks: string;
|
|
38
|
+
Workflows: string;
|
|
39
|
+
};
|
|
5
40
|
declare function setupOpenAPIRoutes<E extends Env = Env>(app: OpenAPIHono<E>): void;
|
|
6
41
|
//#endregion
|
|
7
|
-
export { setupOpenAPIRoutes };
|
|
42
|
+
export { TagToDescription, setupOpenAPIRoutes };
|