@inkeep/agents-manage-api 0.0.0-dev-20260118170655 → 0.0.0-dev-20260119170007
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/index.d.ts +78 -18
- package/dist/middleware/project-access.d.ts +31 -0
- package/dist/middleware/project-access.js +118 -0
- package/dist/middleware/require-permission.d.ts +2 -2
- package/dist/middleware/session-auth.d.ts +2 -2
- package/dist/middleware/tenant-access.d.ts +2 -2
- package/dist/routes/agent.js +4 -4
- package/dist/routes/agentFull.js +4 -4
- package/dist/routes/agentToolRelations.js +4 -4
- package/dist/routes/apiKeys.js +4 -4
- package/dist/routes/artifactComponents.js +4 -4
- package/dist/routes/contextConfigs.js +4 -4
- package/dist/routes/conversations.d.ts +2 -2
- package/dist/routes/credentialStores.d.ts +2 -2
- package/dist/routes/credentialStores.js +5 -0
- package/dist/routes/credentials.js +4 -4
- package/dist/routes/dataComponents.js +4 -4
- package/dist/routes/evals/evaluationResults.d.ts +2 -2
- package/dist/routes/externalAgents.js +4 -4
- package/dist/routes/functionTools.js +4 -4
- package/dist/routes/functions.js +4 -4
- package/dist/routes/index.js +6 -0
- package/dist/routes/playgroundToken.js +18 -3
- package/dist/routes/projectFull.js +3 -2
- package/dist/routes/projectMembers.d.ts +9 -0
- package/dist/routes/projectMembers.js +201 -0
- package/dist/routes/projectPermissions.d.ts +9 -0
- package/dist/routes/projectPermissions.js +64 -0
- package/dist/routes/projects.js +38 -7
- package/dist/routes/subAgentArtifactComponents.js +3 -3
- package/dist/routes/subAgentDataComponents.js +3 -3
- package/dist/routes/subAgentExternalAgentRelations.js +4 -4
- package/dist/routes/subAgentFunctionTools.js +3 -3
- package/dist/routes/subAgentRelations.js +4 -4
- package/dist/routes/subAgentTeamAgentRelations.js +4 -4
- package/dist/routes/subAgentToolRelations.js +4 -4
- package/dist/routes/subAgents.js +4 -4
- package/dist/routes/tools.js +4 -4
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -785,25 +785,25 @@ declare const auth: better_auth0.Auth<{
|
|
|
785
785
|
ac: better_auth_plugins0.AccessControl;
|
|
786
786
|
roles: {
|
|
787
787
|
member: {
|
|
788
|
-
authorize<K_1 extends "
|
|
789
|
-
actions: better_auth_plugins0.Subset<"
|
|
788
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
789
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
790
790
|
connector: "OR" | "AND";
|
|
791
791
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
792
|
-
statements: better_auth_plugins0.Subset<"
|
|
792
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
793
793
|
};
|
|
794
794
|
admin: {
|
|
795
|
-
authorize<K_1 extends "
|
|
796
|
-
actions: better_auth_plugins0.Subset<"
|
|
795
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
796
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
797
797
|
connector: "OR" | "AND";
|
|
798
798
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
799
|
-
statements: better_auth_plugins0.Subset<"
|
|
799
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
800
800
|
};
|
|
801
801
|
owner: {
|
|
802
|
-
authorize<K_1 extends "
|
|
803
|
-
actions: better_auth_plugins0.Subset<"
|
|
802
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
803
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
804
804
|
connector: "OR" | "AND";
|
|
805
805
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
806
|
-
statements: better_auth_plugins0.Subset<"
|
|
806
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
807
807
|
};
|
|
808
808
|
};
|
|
809
809
|
membershipLimit: number;
|
|
@@ -819,6 +819,36 @@ declare const auth: better_auth0.Auth<{
|
|
|
819
819
|
user: better_auth0.User;
|
|
820
820
|
};
|
|
821
821
|
}): Promise<void>;
|
|
822
|
+
organizationHooks: {
|
|
823
|
+
afterAcceptInvitation: ({
|
|
824
|
+
member,
|
|
825
|
+
user,
|
|
826
|
+
organization: org
|
|
827
|
+
}: {
|
|
828
|
+
invitation: better_auth_plugins0.Invitation & Record<string, any>;
|
|
829
|
+
member: better_auth_plugins0.Member & Record<string, any>;
|
|
830
|
+
user: better_auth0.User & Record<string, any>;
|
|
831
|
+
organization: better_auth_plugins0.Organization & Record<string, any>;
|
|
832
|
+
}) => Promise<void>;
|
|
833
|
+
afterUpdateMemberRole: ({
|
|
834
|
+
member,
|
|
835
|
+
organization: org,
|
|
836
|
+
previousRole
|
|
837
|
+
}: {
|
|
838
|
+
member: better_auth_plugins0.Member & Record<string, any>;
|
|
839
|
+
previousRole: string;
|
|
840
|
+
user: better_auth0.User & Record<string, any>;
|
|
841
|
+
organization: better_auth_plugins0.Organization & Record<string, any>;
|
|
842
|
+
}) => Promise<void>;
|
|
843
|
+
afterRemoveMember: ({
|
|
844
|
+
member,
|
|
845
|
+
organization: org
|
|
846
|
+
}: {
|
|
847
|
+
member: better_auth_plugins0.Member & Record<string, any>;
|
|
848
|
+
user: better_auth0.User & Record<string, any>;
|
|
849
|
+
organization: better_auth_plugins0.Organization & Record<string, any>;
|
|
850
|
+
}) => Promise<void>;
|
|
851
|
+
};
|
|
822
852
|
}>;
|
|
823
853
|
schema: {
|
|
824
854
|
organization: {
|
|
@@ -1064,25 +1094,25 @@ declare const auth: better_auth0.Auth<{
|
|
|
1064
1094
|
ac: better_auth_plugins0.AccessControl;
|
|
1065
1095
|
roles: {
|
|
1066
1096
|
member: {
|
|
1067
|
-
authorize<K_1 extends "
|
|
1068
|
-
actions: better_auth_plugins0.Subset<"
|
|
1097
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
1098
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
1069
1099
|
connector: "OR" | "AND";
|
|
1070
1100
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1071
|
-
statements: better_auth_plugins0.Subset<"
|
|
1101
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
1072
1102
|
};
|
|
1073
1103
|
admin: {
|
|
1074
|
-
authorize<K_1 extends "
|
|
1075
|
-
actions: better_auth_plugins0.Subset<"
|
|
1104
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
1105
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
1076
1106
|
connector: "OR" | "AND";
|
|
1077
1107
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1078
|
-
statements: better_auth_plugins0.Subset<"
|
|
1108
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
1079
1109
|
};
|
|
1080
1110
|
owner: {
|
|
1081
|
-
authorize<K_1 extends "
|
|
1082
|
-
actions: better_auth_plugins0.Subset<"
|
|
1111
|
+
authorize<K_1 extends "organization" | "ac" | "member" | "project" | "team" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
1112
|
+
actions: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>[key];
|
|
1083
1113
|
connector: "OR" | "AND";
|
|
1084
1114
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1085
|
-
statements: better_auth_plugins0.Subset<"
|
|
1115
|
+
statements: better_auth_plugins0.Subset<"organization" | "ac" | "member" | "project" | "team" | "invitation", better_auth_plugins0.Statements>;
|
|
1086
1116
|
};
|
|
1087
1117
|
};
|
|
1088
1118
|
membershipLimit: number;
|
|
@@ -1098,6 +1128,36 @@ declare const auth: better_auth0.Auth<{
|
|
|
1098
1128
|
user: better_auth0.User;
|
|
1099
1129
|
};
|
|
1100
1130
|
}): Promise<void>;
|
|
1131
|
+
organizationHooks: {
|
|
1132
|
+
afterAcceptInvitation: ({
|
|
1133
|
+
member,
|
|
1134
|
+
user,
|
|
1135
|
+
organization: org
|
|
1136
|
+
}: {
|
|
1137
|
+
invitation: better_auth_plugins0.Invitation & Record<string, any>;
|
|
1138
|
+
member: better_auth_plugins0.Member & Record<string, any>;
|
|
1139
|
+
user: better_auth0.User & Record<string, any>;
|
|
1140
|
+
organization: better_auth_plugins0.Organization & Record<string, any>;
|
|
1141
|
+
}) => Promise<void>;
|
|
1142
|
+
afterUpdateMemberRole: ({
|
|
1143
|
+
member,
|
|
1144
|
+
organization: org,
|
|
1145
|
+
previousRole
|
|
1146
|
+
}: {
|
|
1147
|
+
member: better_auth_plugins0.Member & Record<string, any>;
|
|
1148
|
+
previousRole: string;
|
|
1149
|
+
user: better_auth0.User & Record<string, any>;
|
|
1150
|
+
organization: better_auth_plugins0.Organization & Record<string, any>;
|
|
1151
|
+
}) => Promise<void>;
|
|
1152
|
+
afterRemoveMember: ({
|
|
1153
|
+
member,
|
|
1154
|
+
organization: org
|
|
1155
|
+
}: {
|
|
1156
|
+
member: better_auth_plugins0.Member & Record<string, any>;
|
|
1157
|
+
user: better_auth0.User & Record<string, any>;
|
|
1158
|
+
organization: better_auth_plugins0.Organization & Record<string, any>;
|
|
1159
|
+
}) => Promise<void>;
|
|
1160
|
+
};
|
|
1101
1161
|
}>;
|
|
1102
1162
|
}, {
|
|
1103
1163
|
id: "device-authorization";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseAppVariables } from "../types/app.js";
|
|
2
|
+
import * as hono2 from "hono";
|
|
3
|
+
|
|
4
|
+
//#region src/middleware/project-access.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
|
+
/**
|
|
15
|
+
* 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
|
+
*/
|
|
25
|
+
declare const requireProjectPermission: <Env$1 extends {
|
|
26
|
+
Variables: BaseAppVariables;
|
|
27
|
+
} = {
|
|
28
|
+
Variables: BaseAppVariables;
|
|
29
|
+
}>(permission?: ProjectPermission) => hono2.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ProjectPermission, requireProjectPermission };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { env } from "../env.js";
|
|
2
|
+
import { canEditProject, canUseProject, canViewProject, createApiError, isAuthzEnabled } from "@inkeep/agents-core";
|
|
3
|
+
import { createMiddleware } from "hono/factory";
|
|
4
|
+
import { HTTPException } from "hono/http-exception";
|
|
5
|
+
|
|
6
|
+
//#region src/middleware/project-access.ts
|
|
7
|
+
/**
|
|
8
|
+
* 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
|
+
*/
|
|
18
|
+
const requireProjectPermission = (permission = "view") => createMiddleware(async (c, next) => {
|
|
19
|
+
const isTestEnvironment = process.env.ENVIRONMENT === "test";
|
|
20
|
+
if (env.DISABLE_AUTH || isTestEnvironment) {
|
|
21
|
+
await next();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const userId = c.get("userId");
|
|
25
|
+
const tenantId = c.get("tenantId");
|
|
26
|
+
const tenantRole = c.get("tenantRole");
|
|
27
|
+
const projectId = c.req.param("projectId") || c.req.param("id");
|
|
28
|
+
if (!userId || !tenantId) throw createApiError({
|
|
29
|
+
code: "unauthorized",
|
|
30
|
+
message: "User or organization context not found",
|
|
31
|
+
instance: c.req.path
|
|
32
|
+
});
|
|
33
|
+
if (!projectId) throw createApiError({
|
|
34
|
+
code: "bad_request",
|
|
35
|
+
message: "Project ID is required",
|
|
36
|
+
instance: c.req.path
|
|
37
|
+
});
|
|
38
|
+
if (userId === "system" || userId.startsWith("apikey:")) {
|
|
39
|
+
await next();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
let hasAccess = false;
|
|
44
|
+
switch (permission) {
|
|
45
|
+
case "view":
|
|
46
|
+
hasAccess = await canViewProject({
|
|
47
|
+
tenantId,
|
|
48
|
+
userId,
|
|
49
|
+
projectId,
|
|
50
|
+
orgRole: tenantRole
|
|
51
|
+
});
|
|
52
|
+
break;
|
|
53
|
+
case "use":
|
|
54
|
+
hasAccess = await canUseProject({
|
|
55
|
+
tenantId,
|
|
56
|
+
userId,
|
|
57
|
+
projectId,
|
|
58
|
+
orgRole: tenantRole
|
|
59
|
+
});
|
|
60
|
+
break;
|
|
61
|
+
case "edit":
|
|
62
|
+
hasAccess = await canEditProject({
|
|
63
|
+
tenantId,
|
|
64
|
+
userId,
|
|
65
|
+
projectId,
|
|
66
|
+
orgRole: tenantRole
|
|
67
|
+
});
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
if (!hasAccess) {
|
|
71
|
+
if (isAuthzEnabled(tenantId) && permission !== "view") {
|
|
72
|
+
if (await canViewProject({
|
|
73
|
+
tenantId,
|
|
74
|
+
userId,
|
|
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
|
+
}
|
|
104
|
+
await next();
|
|
105
|
+
} catch (error) {
|
|
106
|
+
if (error instanceof HTTPException) throw error;
|
|
107
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
108
|
+
throw createApiError({
|
|
109
|
+
code: "internal_server_error",
|
|
110
|
+
message: "Failed to verify project access",
|
|
111
|
+
instance: c.req.path,
|
|
112
|
+
extensions: { internalError: errorMessage }
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
export { requireProjectPermission };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseAppVariables } from "../types/app.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono3 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/require-permission.d.ts
|
|
5
5
|
type Permission = {
|
|
@@ -9,6 +9,6 @@ declare const requirePermission: <Env$1 extends {
|
|
|
9
9
|
Variables: BaseAppVariables;
|
|
10
10
|
} = {
|
|
11
11
|
Variables: BaseAppVariables;
|
|
12
|
-
}>(permissions: Permission) =>
|
|
12
|
+
}>(permissions: Permission) => hono3.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { requirePermission };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono5 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/session-auth.d.ts
|
|
4
|
-
declare const sessionAuth: () =>
|
|
4
|
+
declare const sessionAuth: () => hono5.MiddlewareHandler<any, string, {}, Response>;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { sessionAuth };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono6 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tenant-access.d.ts
|
|
4
|
-
declare const requireTenantAccess: () =>
|
|
4
|
+
declare const requireTenantAccess: () => hono6.MiddlewareHandler<{
|
|
5
5
|
Variables: {
|
|
6
6
|
userId: string;
|
|
7
7
|
tenantId: string;
|
package/dist/routes/agent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import runDbClient_default from "../data/db/runDbClient.js";
|
|
2
|
-
import {
|
|
2
|
+
import { requireProjectPermission } from "../middleware/project-access.js";
|
|
3
3
|
import { speakeasyOffsetLimitPagination } from "./shared.js";
|
|
4
4
|
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
5
5
|
import { AgentApiInsertSchema, AgentApiUpdateSchema, AgentListResponse, AgentResponse, AgentWithinContextOfProjectResponse, ErrorResponseSchema, PaginationQueryParamsSchema, RelatedAgentInfoListResponse, TenantProjectAgentParamsSchema, TenantProjectAgentSubAgentParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, cascadeDeleteByAgent, commonGetErrorResponses, createAgent, createApiError, deleteAgent, generateId, getAgentById, getAgentSubAgentInfos, getFullAgentDefinition, listAgentsPaginated, listSubAgents, updateAgent } from "@inkeep/agents-core";
|
|
@@ -7,12 +7,12 @@ import { AgentApiInsertSchema, AgentApiUpdateSchema, AgentListResponse, AgentRes
|
|
|
7
7
|
//#region src/routes/agent.ts
|
|
8
8
|
const app = new OpenAPIHono();
|
|
9
9
|
app.use("/", async (c, next) => {
|
|
10
|
-
if (c.req.method === "POST") return
|
|
10
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
11
11
|
return next();
|
|
12
12
|
});
|
|
13
13
|
app.use("/:id", async (c, next) => {
|
|
14
|
-
if (c.req.method === "PUT") return
|
|
15
|
-
if (c.req.method === "DELETE") return
|
|
14
|
+
if (c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
|
|
15
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
16
16
|
return next();
|
|
17
17
|
});
|
|
18
18
|
app.openapi(createRoute({
|
package/dist/routes/agentFull.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../logger.js";
|
|
2
2
|
import runDbClient_default from "../data/db/runDbClient.js";
|
|
3
|
-
import {
|
|
3
|
+
import { requireProjectPermission } from "../middleware/project-access.js";
|
|
4
4
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
5
5
|
import { AgentWithinContextOfProjectResponse, AgentWithinContextOfProjectSchema, ErrorResponseSchema, TenantProjectAgentParamsSchema, TenantProjectParamsSchema, cascadeDeleteByAgent, commonGetErrorResponses, createApiError, createFullAgentServerSide, deleteFullAgent, getFullAgent, listSubAgents, updateFullAgentServerSide } from "@inkeep/agents-core";
|
|
6
6
|
|
|
@@ -8,12 +8,12 @@ import { AgentWithinContextOfProjectResponse, AgentWithinContextOfProjectSchema,
|
|
|
8
8
|
const logger = getLogger$1("agentFull");
|
|
9
9
|
const app = new OpenAPIHono();
|
|
10
10
|
app.use("/", async (c, next) => {
|
|
11
|
-
if (c.req.method === "POST") return
|
|
11
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
12
12
|
return next();
|
|
13
13
|
});
|
|
14
14
|
app.use("/:agentId", async (c, next) => {
|
|
15
|
-
if (c.req.method === "PUT") return
|
|
16
|
-
if (c.req.method === "DELETE") return
|
|
15
|
+
if (c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
|
|
16
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
17
17
|
return next();
|
|
18
18
|
});
|
|
19
19
|
app.openapi(createRoute({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requireProjectPermission } from "../middleware/project-access.js";
|
|
2
2
|
import { speakeasyOffsetLimitPagination } from "./shared.js";
|
|
3
3
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
4
4
|
import { ErrorResponseSchema, PaginationQueryParamsSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationListResponse, SubAgentToolRelationResponse, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, commonGetErrorResponses, createAgentToolRelation, createApiError, deleteAgentToolRelation, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsForTool, listAgentToolRelations, updateAgentToolRelation } from "@inkeep/agents-core";
|
|
@@ -6,12 +6,12 @@ import { ErrorResponseSchema, PaginationQueryParamsSchema, SubAgentToolRelationA
|
|
|
6
6
|
//#region src/routes/agentToolRelations.ts
|
|
7
7
|
const app = new OpenAPIHono();
|
|
8
8
|
app.use("/", async (c, next) => {
|
|
9
|
-
if (c.req.method === "POST") return
|
|
9
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
10
10
|
return next();
|
|
11
11
|
});
|
|
12
12
|
app.use("/:id", async (c, next) => {
|
|
13
|
-
if (c.req.method === "PUT") return
|
|
14
|
-
if (c.req.method === "DELETE") return
|
|
13
|
+
if (c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
|
|
14
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
15
15
|
return next();
|
|
16
16
|
});
|
|
17
17
|
app.openapi(createRoute({
|
package/dist/routes/apiKeys.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import runDbClient_default from "../data/db/runDbClient.js";
|
|
2
|
-
import {
|
|
2
|
+
import { requireProjectPermission } from "../middleware/project-access.js";
|
|
3
3
|
import { speakeasyOffsetLimitPagination } from "./shared.js";
|
|
4
4
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
5
5
|
import { ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiUpdateSchema, ApiKeyListResponse, ApiKeyResponse, ErrorResponseSchema, PaginationQueryParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createApiKey, deleteApiKey, generateApiKey, getApiKeyById, listApiKeysPaginated, updateApiKey } from "@inkeep/agents-core";
|
|
@@ -7,12 +7,12 @@ import { ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiUpdate
|
|
|
7
7
|
//#region src/routes/apiKeys.ts
|
|
8
8
|
const app = new OpenAPIHono();
|
|
9
9
|
app.use("/", async (c, next) => {
|
|
10
|
-
if (c.req.method === "POST") return
|
|
10
|
+
if (c.req.method === "POST") return requireProjectPermission("use")(c, next);
|
|
11
11
|
return next();
|
|
12
12
|
});
|
|
13
13
|
app.use("/:id", async (c, next) => {
|
|
14
|
-
if (c.req.method === "PATCH") return
|
|
15
|
-
if (c.req.method === "DELETE") return
|
|
14
|
+
if (c.req.method === "PATCH") return requireProjectPermission("edit")(c, next);
|
|
15
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
16
16
|
return next();
|
|
17
17
|
});
|
|
18
18
|
app.openapi(createRoute({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requireProjectPermission } from "../middleware/project-access.js";
|
|
2
2
|
import { speakeasyOffsetLimitPagination } from "./shared.js";
|
|
3
3
|
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
4
4
|
import { ArtifactComponentApiInsertSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentListResponse, ArtifactComponentResponse, ErrorResponseSchema, PaginationQueryParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createArtifactComponent, deleteArtifactComponent, generateId, getArtifactComponentById, listArtifactComponentsPaginated, updateArtifactComponent, validatePropsAsJsonSchema } from "@inkeep/agents-core";
|
|
@@ -6,12 +6,12 @@ import { ArtifactComponentApiInsertSchema, ArtifactComponentApiUpdateSchema, Art
|
|
|
6
6
|
//#region src/routes/artifactComponents.ts
|
|
7
7
|
const app = new OpenAPIHono();
|
|
8
8
|
app.use("/", async (c, next) => {
|
|
9
|
-
if (c.req.method === "POST") return
|
|
9
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
10
10
|
return next();
|
|
11
11
|
});
|
|
12
12
|
app.use("/:id", async (c, next) => {
|
|
13
|
-
if (c.req.method === "PATCH") return
|
|
14
|
-
if (c.req.method === "DELETE") return
|
|
13
|
+
if (c.req.method === "PATCH" || c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
|
|
14
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
15
15
|
return next();
|
|
16
16
|
});
|
|
17
17
|
app.openapi(createRoute({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import runDbClient_default from "../data/db/runDbClient.js";
|
|
2
|
-
import {
|
|
2
|
+
import { requireProjectPermission } from "../middleware/project-access.js";
|
|
3
3
|
import { speakeasyOffsetLimitPagination } from "./shared.js";
|
|
4
4
|
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
5
5
|
import { ContextConfigApiInsertSchema, ContextConfigApiUpdateSchema, ContextConfigListResponse, ContextConfigResponse, PaginationQueryParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, cascadeDeleteByContextConfig, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, createContextConfig, deleteContextConfig, getContextConfigById, listContextConfigsPaginated, updateContextConfig } from "@inkeep/agents-core";
|
|
@@ -7,12 +7,12 @@ import { ContextConfigApiInsertSchema, ContextConfigApiUpdateSchema, ContextConf
|
|
|
7
7
|
//#region src/routes/contextConfigs.ts
|
|
8
8
|
const app = new OpenAPIHono();
|
|
9
9
|
app.use("/", async (c, next) => {
|
|
10
|
-
if (c.req.method === "POST") return
|
|
10
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
11
11
|
return next();
|
|
12
12
|
});
|
|
13
13
|
app.use("/:id", async (c, next) => {
|
|
14
|
-
if (c.req.method === "PUT") return
|
|
15
|
-
if (c.req.method === "DELETE") return
|
|
14
|
+
if (c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
|
|
15
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
16
16
|
return next();
|
|
17
17
|
});
|
|
18
18
|
app.openapi(createRoute({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono1 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono1.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppVariablesWithCredentials } from "../types/app.js";
|
|
2
2
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
3
3
|
|
|
4
4
|
//#region src/routes/credentialStores.d.ts
|
|
5
5
|
declare const app: OpenAPIHono<{
|
|
6
|
-
Variables:
|
|
6
|
+
Variables: AppVariablesWithCredentials;
|
|
7
7
|
}, {}, "/">;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { app as default };
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { requireProjectPermission } from "../middleware/project-access.js";
|
|
1
2
|
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
2
3
|
import { CreateCredentialInStoreRequestSchema, CreateCredentialInStoreResponseSchema, CredentialStoreListResponseSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError } from "@inkeep/agents-core";
|
|
3
4
|
|
|
4
5
|
//#region src/routes/credentialStores.ts
|
|
5
6
|
const app = new OpenAPIHono();
|
|
7
|
+
app.use("/:id/credentials", async (c, next) => {
|
|
8
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
9
|
+
return next();
|
|
10
|
+
});
|
|
6
11
|
app.openapi(createRoute({
|
|
7
12
|
method: "get",
|
|
8
13
|
path: "/",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requireProjectPermission } from "../middleware/project-access.js";
|
|
2
2
|
import { speakeasyOffsetLimitPagination } from "./shared.js";
|
|
3
3
|
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
4
4
|
import { CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceListResponse, CredentialReferenceResponse, ErrorResponseSchema, ListResponseSchema, PaginationQueryParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createCredentialReference, deleteCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getCredentialStoreLookupKeyFromRetrievalParams, listCredentialReferencesPaginated, updateCredentialReference } from "@inkeep/agents-core";
|
|
@@ -6,12 +6,12 @@ import { CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema,
|
|
|
6
6
|
//#region src/routes/credentials.ts
|
|
7
7
|
const app = new OpenAPIHono();
|
|
8
8
|
app.use("/", async (c, next) => {
|
|
9
|
-
if (c.req.method === "POST") return
|
|
9
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
10
10
|
return next();
|
|
11
11
|
});
|
|
12
12
|
app.use("/:id", async (c, next) => {
|
|
13
|
-
if (c.req.method === "PATCH") return
|
|
14
|
-
if (c.req.method === "DELETE") return
|
|
13
|
+
if (c.req.method === "PATCH") return requireProjectPermission("edit")(c, next);
|
|
14
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
15
15
|
return next();
|
|
16
16
|
});
|
|
17
17
|
app.openapi(createRoute({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requireProjectPermission } from "../middleware/project-access.js";
|
|
2
2
|
import { speakeasyOffsetLimitPagination } from "./shared.js";
|
|
3
3
|
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
4
4
|
import { DataComponentApiInsertSchema, DataComponentApiUpdateSchema, DataComponentListResponse, DataComponentResponse, ErrorResponseSchema, PaginationQueryParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createDataComponent, deleteDataComponent, getDataComponent, listDataComponentsPaginated, updateDataComponent, validatePropsAsJsonSchema } from "@inkeep/agents-core";
|
|
@@ -6,12 +6,12 @@ import { DataComponentApiInsertSchema, DataComponentApiUpdateSchema, DataCompone
|
|
|
6
6
|
//#region src/routes/dataComponents.ts
|
|
7
7
|
const app = new OpenAPIHono();
|
|
8
8
|
app.use("/", async (c, next) => {
|
|
9
|
-
if (c.req.method === "POST") return
|
|
9
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
10
10
|
return next();
|
|
11
11
|
});
|
|
12
12
|
app.use("/:id", async (c, next) => {
|
|
13
|
-
if (c.req.method === "PATCH") return
|
|
14
|
-
if (c.req.method === "DELETE") return
|
|
13
|
+
if (c.req.method === "PATCH") return requireProjectPermission("edit")(c, next);
|
|
14
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
15
15
|
return next();
|
|
16
16
|
});
|
|
17
17
|
app.openapi(createRoute({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono7 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/routes/evals/evaluationResults.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono7.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requireProjectPermission } from "../middleware/project-access.js";
|
|
2
2
|
import { speakeasyOffsetLimitPagination } from "./shared.js";
|
|
3
3
|
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
4
4
|
import { ErrorResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiUpdateSchema, ExternalAgentListResponse, ExternalAgentResponse, PaginationQueryParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createExternalAgent, deleteExternalAgent, generateId, getExternalAgent, listExternalAgentsPaginated, updateExternalAgent } from "@inkeep/agents-core";
|
|
@@ -6,12 +6,12 @@ import { ErrorResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiUpda
|
|
|
6
6
|
//#region src/routes/externalAgents.ts
|
|
7
7
|
const app = new OpenAPIHono();
|
|
8
8
|
app.use("/", async (c, next) => {
|
|
9
|
-
if (c.req.method === "POST") return
|
|
9
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
10
10
|
return next();
|
|
11
11
|
});
|
|
12
12
|
app.use("/:id", async (c, next) => {
|
|
13
|
-
if (c.req.method === "PATCH") return
|
|
14
|
-
if (c.req.method === "DELETE") return
|
|
13
|
+
if (c.req.method === "PATCH") return requireProjectPermission("edit")(c, next);
|
|
14
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
15
15
|
return next();
|
|
16
16
|
});
|
|
17
17
|
app.openapi(createRoute({
|