@inkeep/agents-api 0.0.0-dev-20260219033751 → 0.0.0-dev-20260219045007
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.json +34 -34
- package/dist/createApp.js +16 -90
- package/dist/data/db/manageDbClient.d.ts +2 -2
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/datasetTriggers.js +5 -2
- package/dist/domains/evals/routes/evaluationTriggers.js +9 -4
- 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 +4 -0
- package/dist/domains/manage/routes/agent.js +16 -20
- package/dist/domains/manage/routes/agentFull.js +10 -17
- package/dist/domains/manage/routes/apiKeys.js +12 -14
- package/dist/domains/manage/routes/artifactComponents.js +12 -15
- package/dist/domains/manage/routes/availableAgents.d.ts +2 -2
- package/dist/domains/manage/routes/availableAgents.js +4 -2
- package/dist/domains/manage/routes/branches.js +12 -14
- package/dist/domains/manage/routes/cliAuth.js +4 -3
- package/dist/domains/manage/routes/contextConfigs.js +12 -15
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/conversations.js +5 -2
- package/dist/domains/manage/routes/credentialStores.js +7 -8
- package/dist/domains/manage/routes/credentials.js +12 -14
- package/dist/domains/manage/routes/dataComponents.js +12 -14
- package/dist/domains/manage/routes/evals/datasetItems.js +14 -19
- package/dist/domains/manage/routes/evals/datasetRunConfigs.js +13 -6
- package/dist/domains/manage/routes/evals/datasetRuns.js +7 -3
- package/dist/domains/manage/routes/evals/datasets.js +12 -14
- package/dist/domains/manage/routes/evals/evaluationJobConfigEvaluatorRelations.js +8 -8
- package/dist/domains/manage/routes/evals/evaluationJobConfigs.js +12 -14
- package/dist/domains/manage/routes/evals/evaluationResults.js +10 -13
- package/dist/domains/manage/routes/evals/evaluationRunConfigs.js +14 -15
- package/dist/domains/manage/routes/evals/evaluationSuiteConfigEvaluatorRelations.js +8 -8
- package/dist/domains/manage/routes/evals/evaluationSuiteConfigs.js +12 -14
- package/dist/domains/manage/routes/evals/evaluators.js +14 -15
- package/dist/domains/manage/routes/externalAgents.js +12 -14
- package/dist/domains/manage/routes/functionTools.js +12 -15
- package/dist/domains/manage/routes/functions.js +12 -15
- package/dist/domains/manage/routes/github.js +16 -8
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/index.js +0 -4
- package/dist/domains/manage/routes/invitations.d.ts +2 -2
- package/dist/domains/manage/routes/mcpCatalog.js +5 -2
- package/dist/domains/manage/routes/mcpToolGithubAccess.js +6 -4
- package/dist/domains/manage/routes/oauth.js +6 -66
- package/dist/domains/manage/routes/passwordResetLinks.d.ts +2 -2
- package/dist/domains/manage/routes/playgroundToken.js +4 -2
- package/dist/domains/manage/routes/projectFull.js +13 -26
- package/dist/domains/manage/routes/projectGithubAccess.js +7 -3
- package/dist/domains/manage/routes/projectMembers.js +14 -13
- package/dist/domains/manage/routes/projectPermissions.js +5 -2
- package/dist/domains/manage/routes/projects.js +12 -16
- package/dist/domains/manage/routes/ref.js +5 -2
- package/dist/domains/manage/routes/scheduledTriggers.js +24 -21
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/skills.js +12 -15
- package/dist/domains/manage/routes/subAgentArtifactComponents.js +12 -14
- package/dist/domains/manage/routes/subAgentDataComponents.js +12 -14
- package/dist/domains/manage/routes/subAgentExternalAgentRelations.js +12 -15
- package/dist/domains/manage/routes/subAgentFunctionTools.js +12 -14
- package/dist/domains/manage/routes/subAgentRelations.js +12 -15
- package/dist/domains/manage/routes/subAgentSkills.js +8 -12
- package/dist/domains/manage/routes/subAgentTeamAgentRelations.js +12 -15
- package/dist/domains/manage/routes/subAgentToolRelations.js +14 -16
- package/dist/domains/manage/routes/subAgents.js +12 -15
- package/dist/domains/manage/routes/thirdPartyMCPServers.js +7 -3
- package/dist/domains/manage/routes/tools.js +79 -16
- package/dist/domains/manage/routes/triggers.js +18 -22
- package/dist/domains/manage/routes/userProjectMemberships.js +5 -3
- package/dist/domains/manage/routes/users.d.ts +2 -2
- package/dist/domains/mcp/routes/mcp.d.ts +2 -2
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/routes/agents.js +4 -2
- package/dist/domains/run/routes/chat.js +4 -2
- package/dist/domains/run/routes/chatDataStream.js +6 -3
- package/dist/domains/run/routes/mcp.js +4 -2
- package/dist/domains/run/routes/webhooks.js +5 -3
- package/dist/domains/run/tools/distill-conversation-history-tool.d.ts +1 -1
- package/dist/domains/run/types/chat.d.ts +4 -4
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/domains/run/workflow/steps/scheduledTriggerSteps.d.ts +5 -5
- package/dist/factory.d.ts +21 -21
- package/dist/index.d.ts +18 -18
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/evalsAuth.js +37 -32
- package/dist/middleware/index.d.ts +2 -3
- package/dist/middleware/index.js +3 -4
- package/dist/middleware/manageAuth.d.ts +9 -4
- package/dist/middleware/manageAuth.js +24 -2
- package/dist/middleware/projectAccess.d.ts +4 -3
- package/dist/middleware/projectAccess.js +78 -64
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/ref.d.ts +1 -5
- package/dist/middleware/ref.js +1 -21
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/requirePermission.js +64 -64
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/sessionAuth.js +23 -18
- package/dist/middleware/tenantAccess.d.ts +3 -2
- package/dist/middleware/tenantAccess.js +12 -1
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/middleware/tracing.js +1 -1
- package/dist/routes/capabilities.d.ts +10 -0
- package/dist/routes/capabilities.js +35 -0
- package/dist/routes/healthChecks.js +6 -3
- package/dist/routes/workflowProcess.d.ts +10 -0
- package/dist/routes/workflowProcess.js +23 -0
- package/dist/types/app.d.ts +3 -3
- package/package.json +4 -4
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
2
2
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
3
|
-
import { OpenAPIHono,
|
|
3
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
4
4
|
import { TenantParamsSchema, WorkAppGitHubRepositorySelectSchema, WorkAppGithubInstallationApiSelectSchema, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, createApiError, deleteInstallation, disconnectInstallation, getInstallationById, getInstallationsByTenantId, getRepositoriesByInstallationId, getRepositoryCountsByTenantId, syncRepositories, updateInstallationStatus } from "@inkeep/agents-core";
|
|
5
5
|
import { createAppJwt, fetchInstallationRepositories, getGitHubAppName, getStateSigningSecret, isGitHubAppNameConfigured, isStateSigningConfigured } from "@inkeep/agents-work-apps/github";
|
|
6
|
+
import { createProtectedRoute, inheritedManageTenantAuth } from "@inkeep/agents-core/middleware";
|
|
6
7
|
import { HTTPException } from "hono/http-exception";
|
|
7
8
|
import { SignJWT } from "jose";
|
|
8
9
|
|
|
@@ -24,13 +25,14 @@ async function signStateToken(tenantId) {
|
|
|
24
25
|
typ: "JWT"
|
|
25
26
|
}).setIssuer(STATE_JWT_ISSUER).setAudience(STATE_JWT_AUDIENCE).setIssuedAt().setExpirationTime("10m").sign(secretKey);
|
|
26
27
|
}
|
|
27
|
-
app.openapi(
|
|
28
|
+
app.openapi(createProtectedRoute({
|
|
28
29
|
method: "get",
|
|
29
30
|
path: "/install-url",
|
|
30
31
|
summary: "Get GitHub App installation URL",
|
|
31
32
|
operationId: "get-github-install-url",
|
|
32
33
|
tags: ["GitHub"],
|
|
33
34
|
description: "Generates a URL to install the GitHub App on an organization or user account. The URL includes a signed state parameter that encodes the tenant ID and expires after 10 minutes. After installation, GitHub will redirect back to our callback endpoint with this state.",
|
|
35
|
+
permission: inheritedManageTenantAuth(),
|
|
34
36
|
request: { params: TenantParamsSchema },
|
|
35
37
|
responses: {
|
|
36
38
|
200: {
|
|
@@ -65,13 +67,14 @@ app.openapi(createRoute({
|
|
|
65
67
|
const InstallationWithRepoCountSchema = WorkAppGithubInstallationApiSelectSchema.extend({ repositoryCount: z.number().describe("Number of repositories accessible to this installation") });
|
|
66
68
|
const ListInstallationsResponseSchema = z.object({ installations: z.array(InstallationWithRepoCountSchema).describe("List of GitHub App installations") });
|
|
67
69
|
const ListInstallationsQuerySchema = z.object({ includeDisconnected: z.string().optional().transform((val) => val === "true").describe("Include disconnected installations in the response") });
|
|
68
|
-
app.openapi(
|
|
70
|
+
app.openapi(createProtectedRoute({
|
|
69
71
|
method: "get",
|
|
70
72
|
path: "/installations",
|
|
71
73
|
summary: "List GitHub App installations",
|
|
72
74
|
operationId: "list-github-installations",
|
|
73
75
|
tags: ["GitHub"],
|
|
74
76
|
description: "Returns a list of GitHub App installations connected to this tenant. By default, deleted installations are filtered out. Use the includeDisconnected query parameter to include them.",
|
|
77
|
+
permission: inheritedManageTenantAuth(),
|
|
75
78
|
request: {
|
|
76
79
|
params: TenantParamsSchema,
|
|
77
80
|
query: ListInstallationsQuerySchema
|
|
@@ -119,13 +122,14 @@ const InstallationDetailResponseSchema = z.object({
|
|
|
119
122
|
installation: WorkAppGithubInstallationApiSelectSchema.describe("Installation details"),
|
|
120
123
|
repositories: z.array(WorkAppGitHubRepositorySelectSchema).describe("List of repositories")
|
|
121
124
|
});
|
|
122
|
-
app.openapi(
|
|
125
|
+
app.openapi(createProtectedRoute({
|
|
123
126
|
method: "get",
|
|
124
127
|
path: "/installations/{installationId}",
|
|
125
128
|
summary: "Get GitHub App installation details",
|
|
126
129
|
operationId: "get-github-installation-details",
|
|
127
130
|
tags: ["GitHub"],
|
|
128
131
|
description: "Returns detailed information about a specific GitHub App installation, including the full list of repositories.",
|
|
132
|
+
permission: inheritedManageTenantAuth(),
|
|
129
133
|
request: { params: TenantParamsSchema.merge(InstallationIdParamSchema) },
|
|
130
134
|
responses: {
|
|
131
135
|
200: {
|
|
@@ -174,13 +178,14 @@ app.openapi(createRoute({
|
|
|
174
178
|
}, 200);
|
|
175
179
|
});
|
|
176
180
|
const DisconnectInstallationResponseSchema = z.object({ success: z.literal(true).describe("Whether the disconnection was successful") });
|
|
177
|
-
app.openapi(
|
|
181
|
+
app.openapi(createProtectedRoute({
|
|
178
182
|
method: "post",
|
|
179
183
|
path: "/installations/{installationId}/disconnect",
|
|
180
184
|
summary: "Disconnect a GitHub App installation",
|
|
181
185
|
operationId: "disconnect-github-installation",
|
|
182
186
|
tags: ["GitHub"],
|
|
183
187
|
description: "Disconnects a GitHub App installation from the tenant. This soft deletes the installation (sets status to \"disconnected\") and removes all project repository access entries. The installation record is preserved for audit purposes. Note: This does NOT uninstall the GitHub App from GitHub - the user can do that separately from GitHub settings.",
|
|
188
|
+
permission: inheritedManageTenantAuth(),
|
|
184
189
|
request: { params: TenantParamsSchema.merge(InstallationIdParamSchema) },
|
|
185
190
|
responses: {
|
|
186
191
|
200: {
|
|
@@ -281,13 +286,14 @@ const serviceUnavailableSchema = {
|
|
|
281
286
|
})
|
|
282
287
|
}) } }
|
|
283
288
|
};
|
|
284
|
-
app.openapi(
|
|
289
|
+
app.openapi(createProtectedRoute({
|
|
285
290
|
method: "post",
|
|
286
291
|
path: "/installations/{installationId}/reconnect",
|
|
287
292
|
summary: "Reconnect a disconnected GitHub App installation",
|
|
288
293
|
operationId: "reconnect-github-installation",
|
|
289
294
|
tags: ["GitHub"],
|
|
290
295
|
description: "Reconnects a previously disconnected GitHub App installation by setting its status back to \"active\" and syncing the available repositories from GitHub. This can only be used on installations with \"disconnected\" status.",
|
|
296
|
+
permission: inheritedManageTenantAuth(),
|
|
291
297
|
request: { params: TenantParamsSchema.merge(InstallationIdParamSchema) },
|
|
292
298
|
responses: {
|
|
293
299
|
200: {
|
|
@@ -386,13 +392,14 @@ app.openapi(createRoute({
|
|
|
386
392
|
}
|
|
387
393
|
}, 200);
|
|
388
394
|
});
|
|
389
|
-
app.openapi(
|
|
395
|
+
app.openapi(createProtectedRoute({
|
|
390
396
|
method: "delete",
|
|
391
397
|
path: "/installations/{installationId}",
|
|
392
398
|
summary: "Delete a GitHub App installation permanently",
|
|
393
399
|
operationId: "delete-github-installation",
|
|
394
400
|
tags: ["GitHub"],
|
|
395
401
|
description: "Permanently deletes a GitHub App installation from the tenant. This hard deletes the installation record, all associated repositories, and project repository access entries. This action cannot be undone. Use POST /disconnect for soft delete instead. Note: This does NOT uninstall the GitHub App from GitHub - the user can do that separately from GitHub settings.",
|
|
402
|
+
permission: inheritedManageTenantAuth(),
|
|
396
403
|
request: { params: TenantParamsSchema.merge(InstallationIdParamSchema) },
|
|
397
404
|
responses: {
|
|
398
405
|
200: {
|
|
@@ -428,13 +435,14 @@ const SyncRepositoriesResponseSchema = z.object({
|
|
|
428
435
|
updated: z.number().describe("Number of repositories updated")
|
|
429
436
|
})
|
|
430
437
|
});
|
|
431
|
-
app.openapi(
|
|
438
|
+
app.openapi(createProtectedRoute({
|
|
432
439
|
method: "post",
|
|
433
440
|
path: "/installations/{installationId}/sync",
|
|
434
441
|
summary: "Sync repositories for a GitHub App installation",
|
|
435
442
|
operationId: "sync-github-installation-repositories",
|
|
436
443
|
tags: ["GitHub"],
|
|
437
444
|
description: "Manually refreshes the repository list for a GitHub App installation by fetching the current list from GitHub API. This is useful if webhooks were missed or to ensure the local data is in sync with GitHub.",
|
|
445
|
+
permission: inheritedManageTenantAuth(),
|
|
438
446
|
request: { params: TenantParamsSchema.merge(InstallationIdParamSchema) },
|
|
439
447
|
responses: {
|
|
440
448
|
200: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono18 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono18.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
2
1
|
import agent_default from "./agent.js";
|
|
3
2
|
import agentFull_default from "./agentFull.js";
|
|
4
3
|
import apiKeys_default from "./apiKeys.js";
|
|
@@ -32,13 +31,11 @@ import subAgentToolRelations_default from "./subAgentToolRelations.js";
|
|
|
32
31
|
import thirdPartyMCPServers_default from "./thirdPartyMCPServers.js";
|
|
33
32
|
import tools_default from "./tools.js";
|
|
34
33
|
import triggers_default from "./triggers.js";
|
|
35
|
-
import userProjectMemberships_default from "./userProjectMemberships.js";
|
|
36
34
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
37
35
|
|
|
38
36
|
//#region src/domains/manage/routes/index.ts
|
|
39
37
|
const app = new OpenAPIHono();
|
|
40
38
|
app.route("/projects", projects_default);
|
|
41
|
-
app.use("/projects/:projectId/*", requireProjectPermission("view"));
|
|
42
39
|
app.route("/projects/:projectId/branches", branches_default);
|
|
43
40
|
app.route("/projects/:projectId/refs", ref_default);
|
|
44
41
|
app.route("/projects/:projectId/members", projectMembers_default);
|
|
@@ -71,7 +68,6 @@ app.route("/projects/:projectId/third-party-mcp-servers", thirdPartyMCPServers_d
|
|
|
71
68
|
app.route("/projects/:projectId/agents/:agentId/triggers", triggers_default);
|
|
72
69
|
app.route("/projects/:projectId/agents/:agentId/scheduled-triggers", scheduledTriggers_default);
|
|
73
70
|
app.route("/projects/:projectId/evals", evals_default);
|
|
74
|
-
app.route("/users/:userId/project-memberships", userProjectMemberships_default);
|
|
75
71
|
var routes_default = app;
|
|
76
72
|
|
|
77
73
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types8 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/invitations.d.ts
|
|
6
6
|
declare const invitationsRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types8.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { invitationsRoutes as default };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
2
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
3
|
import { MCPCatalogListResponse, MCPTransportType, TenantProjectParamsSchema, commonGetErrorResponses, fetchComposioServers } from "@inkeep/agents-core";
|
|
4
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
3
5
|
|
|
4
6
|
//#region src/domains/manage/routes/mcpCatalog.ts
|
|
5
7
|
const app = new OpenAPIHono();
|
|
@@ -424,13 +426,14 @@ const PREBUILT_MCP_SERVERS = [
|
|
|
424
426
|
description: "AI-powered content creation"
|
|
425
427
|
}
|
|
426
428
|
];
|
|
427
|
-
app.openapi(
|
|
429
|
+
app.openapi(createProtectedRoute({
|
|
428
430
|
method: "get",
|
|
429
431
|
path: "/",
|
|
430
432
|
summary: "List MCP Server Catalog",
|
|
431
433
|
operationId: "list-mcp-catalog",
|
|
432
434
|
tags: ["MCP Catalog"],
|
|
433
435
|
description: "Get a list of available prebuilt MCP servers. If COMPOSIO_API_KEY is configured, also includes Composio servers for the tenant/project.",
|
|
436
|
+
permission: requireProjectPermission("view"),
|
|
434
437
|
request: { params: TenantProjectParamsSchema },
|
|
435
438
|
responses: {
|
|
436
439
|
200: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
2
2
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
3
3
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
4
|
-
import { OpenAPIHono,
|
|
4
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
5
5
|
import { TenantProjectParamsSchema, WorkAppGitHubAccessModeSchema, WorkAppGitHubAccessSetRequestSchema, WorkAppGitHubAccessSetResponseSchema, WorkAppGitHubRepositorySelectSchema, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, getMcpToolAccessMode, getMcpToolRepositoryAccessWithDetails, getToolById, setMcpToolAccessMode, setMcpToolRepositoryAccess, validateRepositoryOwnership } from "@inkeep/agents-core";
|
|
6
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
6
7
|
|
|
7
8
|
//#region src/domains/manage/routes/mcpToolGithubAccess.ts
|
|
8
9
|
const logger = getLogger$1("mcp-tool-github-access");
|
|
@@ -39,14 +40,14 @@ async function validateGitHubWorkappTool(db, tenantId, projectId, toolId) {
|
|
|
39
40
|
message: "GitHub access can only be configured for GitHub MCP tools"
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
app.
|
|
43
|
-
app.openapi(createRoute({
|
|
43
|
+
app.openapi(createProtectedRoute({
|
|
44
44
|
method: "get",
|
|
45
45
|
path: "/",
|
|
46
46
|
summary: "Get MCP tool GitHub repository access",
|
|
47
47
|
operationId: "get-mcp-tool-github-access",
|
|
48
48
|
tags: ["Tools"],
|
|
49
49
|
description: "Returns the current GitHub repository access configuration for an MCP tool. If mode is \"all\", the tool has access to all repositories the project can access. If mode is \"selected\", the tool is scoped to specific repositories. ",
|
|
50
|
+
permission: requireProjectPermission("edit"),
|
|
50
51
|
request: { params: TenantProjectToolParamsSchema },
|
|
51
52
|
responses: {
|
|
52
53
|
200: {
|
|
@@ -97,13 +98,14 @@ app.openapi(createRoute({
|
|
|
97
98
|
}))
|
|
98
99
|
}, 200);
|
|
99
100
|
});
|
|
100
|
-
app.openapi(
|
|
101
|
+
app.openapi(createProtectedRoute({
|
|
101
102
|
method: "put",
|
|
102
103
|
path: "/",
|
|
103
104
|
summary: "Set MCP tool GitHub repository access",
|
|
104
105
|
operationId: "set-mcp-tool-github-access",
|
|
105
106
|
tags: ["Tools"],
|
|
106
107
|
description: "Configures which GitHub repositories an MCP tool can access. When mode is \"all\", the tool has access to all repositories the project can access. When mode is \"selected\", the tool is scoped to specific repositories (repositoryIds required). This replaces any existing access configuration. This endpoint only works for GitHub workapp MCP tools (isWorkApp=true and URL contains /github).",
|
|
108
|
+
permission: requireProjectPermission("edit"),
|
|
107
109
|
request: {
|
|
108
110
|
params: TenantProjectToolParamsSchema,
|
|
109
111
|
body: { content: { "application/json": { schema: SetGitHubAccessRequestSchema } } }
|
|
@@ -2,8 +2,9 @@ import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
|
2
2
|
import manageDbClient_default from "../../../data/db/manageDbClient.js";
|
|
3
3
|
import manageDbPool_default from "../../../data/db/manageDbPool.js";
|
|
4
4
|
import { oauthService, retrievePKCEVerifier } from "../../../utils/oauthService.js";
|
|
5
|
-
import { OpenAPIHono,
|
|
6
|
-
import { CredentialReferenceApiSelectSchema, CredentialStoreType, OAuthCallbackQuerySchema,
|
|
5
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
6
|
+
import { CredentialReferenceApiSelectSchema, CredentialStoreType, OAuthCallbackQuerySchema, createCredentialReference, generateId, getCredentialReferenceWithResources, getProjectMainResolvedRef, getToolById, updateTool, withRef } from "@inkeep/agents-core";
|
|
7
|
+
import { createProtectedRoute, noAuth } from "@inkeep/agents-core/middleware";
|
|
7
8
|
|
|
8
9
|
//#region src/domains/manage/routes/oauth.ts
|
|
9
10
|
/**
|
|
@@ -124,75 +125,14 @@ function generateOAuthCallbackPage(params) {
|
|
|
124
125
|
</html>
|
|
125
126
|
`;
|
|
126
127
|
}
|
|
127
|
-
app.openapi(
|
|
128
|
-
method: "get",
|
|
129
|
-
path: "/login",
|
|
130
|
-
summary: "Initiate OAuth login for MCP tool",
|
|
131
|
-
description: "Detects OAuth requirements and redirects to authorization server (public endpoint)",
|
|
132
|
-
operationId: "initiate-oauth-login-public",
|
|
133
|
-
tags: ["OAuth"],
|
|
134
|
-
request: { query: OAuthLoginQuerySchema },
|
|
135
|
-
responses: {
|
|
136
|
-
302: { description: "Redirect to OAuth authorization server" },
|
|
137
|
-
400: {
|
|
138
|
-
description: "OAuth not supported or configuration error",
|
|
139
|
-
content: { "text/html": { schema: z.string() } }
|
|
140
|
-
},
|
|
141
|
-
404: {
|
|
142
|
-
description: "Tool not found",
|
|
143
|
-
content: { "text/html": { schema: z.string() } }
|
|
144
|
-
},
|
|
145
|
-
500: {
|
|
146
|
-
description: "Internal server error",
|
|
147
|
-
content: { "text/html": { schema: z.string() } }
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}), async (c) => {
|
|
151
|
-
const { tenantId, projectId, toolId } = c.req.valid("query");
|
|
152
|
-
const db = c.get("db");
|
|
153
|
-
try {
|
|
154
|
-
const tool = await getToolById(db)({
|
|
155
|
-
scopes: {
|
|
156
|
-
tenantId,
|
|
157
|
-
projectId
|
|
158
|
-
},
|
|
159
|
-
toolId
|
|
160
|
-
});
|
|
161
|
-
if (!tool) {
|
|
162
|
-
logger.error({
|
|
163
|
-
toolId,
|
|
164
|
-
tenantId,
|
|
165
|
-
projectId
|
|
166
|
-
}, "Tool not found for OAuth login");
|
|
167
|
-
return c.text("Tool not found", 404);
|
|
168
|
-
}
|
|
169
|
-
const baseUrl = getBaseUrlFromRequest(c);
|
|
170
|
-
const { redirectUrl } = await oauthService.initiateOAuthFlow({
|
|
171
|
-
tenantId,
|
|
172
|
-
projectId,
|
|
173
|
-
toolId,
|
|
174
|
-
mcpServerUrl: tool.config.mcp.server.url,
|
|
175
|
-
baseUrl
|
|
176
|
-
});
|
|
177
|
-
return c.redirect(redirectUrl, 302);
|
|
178
|
-
} catch (error) {
|
|
179
|
-
logger.error({
|
|
180
|
-
toolId,
|
|
181
|
-
tenantId,
|
|
182
|
-
projectId,
|
|
183
|
-
error
|
|
184
|
-
}, "OAuth login failed");
|
|
185
|
-
const errorMessage = error instanceof Error ? error.message : "Failed to initiate OAuth login";
|
|
186
|
-
return c.text(`OAuth Error: ${errorMessage}`, 500);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
app.openapi(createRoute({
|
|
128
|
+
app.openapi(createProtectedRoute({
|
|
190
129
|
method: "get",
|
|
191
130
|
path: "/callback",
|
|
192
131
|
summary: "MCP OAuth authorization callback",
|
|
193
|
-
description: "Handles OAuth authorization codes for MCP tools and completes the authentication flow",
|
|
132
|
+
description: "Handles OAuth authorization codes for MCP tools and completes the authentication flow. Secured via PKCE state parameter (not HTTP authentication) since this is an external redirect from an OAuth provider.",
|
|
194
133
|
operationId: "mcp-oauth-callback",
|
|
195
134
|
tags: ["OAuth"],
|
|
135
|
+
permission: noAuth(),
|
|
196
136
|
request: { query: OAuthCallbackQuerySchema },
|
|
197
137
|
responses: {
|
|
198
138
|
302: { description: "Redirect to frontend after successful OAuth" },
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types5 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/passwordResetLinks.d.ts
|
|
6
6
|
declare const passwordResetLinksRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types5.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { passwordResetLinksRoutes as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
2
2
|
import { env } from "../../../env.js";
|
|
3
|
-
import { OpenAPIHono,
|
|
3
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
4
4
|
import { ErrorResponseSchema, TenantParamsSchema, canUseProject, createApiError, getAgentById, projectExists, signTempToken } from "@inkeep/agents-core";
|
|
5
|
+
import { createProtectedRoute, inheritedManageTenantAuth } from "@inkeep/agents-core/middleware";
|
|
5
6
|
|
|
6
7
|
//#region src/domains/manage/routes/playgroundToken.ts
|
|
7
8
|
const logger = getLogger$1("playgroundToken");
|
|
@@ -14,7 +15,7 @@ const PlaygroundTokenResponseSchema = z.object({
|
|
|
14
15
|
apiKey: z.string().describe("Temporary API key for playground use"),
|
|
15
16
|
expiresAt: z.string().describe("ISO 8601 timestamp when the key expires")
|
|
16
17
|
});
|
|
17
|
-
app.openapi(
|
|
18
|
+
app.openapi(createProtectedRoute({
|
|
18
19
|
method: "post",
|
|
19
20
|
path: "/",
|
|
20
21
|
summary: "Generate temporary API key for playground",
|
|
@@ -22,6 +23,7 @@ app.openapi(createRoute({
|
|
|
22
23
|
tags: ["API Keys"],
|
|
23
24
|
description: "Generates a short-lived API key (1 hour expiry) for authenticated users to access the run-api from the playground",
|
|
24
25
|
security: [{ cookieAuth: [] }],
|
|
26
|
+
permission: inheritedManageTenantAuth(),
|
|
25
27
|
request: {
|
|
26
28
|
params: TenantParamsSchema,
|
|
27
29
|
body: { content: { "application/json": { schema: PlaygroundTokenRequestSchema } } }
|
|
@@ -4,24 +4,13 @@ import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
|
4
4
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
5
5
|
import { onTriggerCreated, onTriggerDeleted, onTriggerUpdated } from "../../run/services/ScheduledTriggerService.js";
|
|
6
6
|
import { requirePermission } from "../../../middleware/requirePermission.js";
|
|
7
|
-
import { OpenAPIHono,
|
|
7
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
8
8
|
import { ErrorResponseSchema, FullProjectDefinitionSchema, FullProjectSelectResponse, FullProjectSelectWithRelationIdsResponse, TenantParamsSchema, TenantProjectParamsSchema, cascadeDeleteByProject, checkoutBranch, commonGetErrorResponses, createApiError, createFullProjectServerSide, createProjectMetadataAndBranch, deleteFullProject, deleteProjectWithBranch, doltCheckout, getFullProject, getFullProjectWithRelationIds, getProjectMainBranchName, getProjectMetadata, listScheduledTriggers, removeProjectFromSpiceDb, syncProjectToSpiceDb, updateFullProjectServerSide } from "@inkeep/agents-core";
|
|
9
|
+
import { createProtectedRoute, registerAuthzMeta } from "@inkeep/agents-core/middleware";
|
|
9
10
|
|
|
10
11
|
//#region src/domains/manage/routes/projectFull.ts
|
|
11
12
|
const logger = getLogger$1("projectFull");
|
|
12
13
|
const app = new OpenAPIHono();
|
|
13
|
-
app.use("/project-full", async (c, next) => {
|
|
14
|
-
if (c.req.method === "POST") return requirePermission({ project: ["create"] })(c, next);
|
|
15
|
-
return next();
|
|
16
|
-
});
|
|
17
|
-
app.use("/project-full/:projectId", async (c, next) => {
|
|
18
|
-
if (c.req.method === "GET") return requireProjectPermission("view")(c, next);
|
|
19
|
-
return next();
|
|
20
|
-
});
|
|
21
|
-
app.use("/project-full/:projectId/with-relation-ids", async (c, next) => {
|
|
22
|
-
if (c.req.method === "GET") return requireProjectPermission("view")(c, next);
|
|
23
|
-
return next();
|
|
24
|
-
});
|
|
25
14
|
const requireProjectUpsertPermission = async (c, next) => {
|
|
26
15
|
const tenantId = c.get("tenantId");
|
|
27
16
|
const projectId = c.req.param("projectId");
|
|
@@ -36,13 +25,15 @@ const requireProjectUpsertPermission = async (c, next) => {
|
|
|
36
25
|
c.set("isProjectCreate", !exists);
|
|
37
26
|
return exists ? requireProjectPermission("edit")(c, next) : requirePermission({ project: ["create"] })(c, next);
|
|
38
27
|
};
|
|
39
|
-
|
|
28
|
+
registerAuthzMeta(requireProjectUpsertPermission, { description: "Dynamic: requires organization admin for new projects, or project edit permission for existing projects." });
|
|
29
|
+
app.openapi(createProtectedRoute({
|
|
40
30
|
method: "post",
|
|
41
31
|
path: "/project-full",
|
|
42
32
|
summary: "Create Full Project",
|
|
43
33
|
operationId: "create-full-project",
|
|
44
34
|
tags: ["Projects"],
|
|
45
35
|
description: "Create a complete project with all Agents, Sub Agents, tools, and relationships from JSON definition",
|
|
36
|
+
permission: requirePermission({ project: ["create"] }),
|
|
46
37
|
request: {
|
|
47
38
|
params: TenantParamsSchema,
|
|
48
39
|
body: { content: { "application/json": { schema: FullProjectDefinitionSchema } } }
|
|
@@ -130,13 +121,14 @@ app.openapi(createRoute({
|
|
|
130
121
|
throw error;
|
|
131
122
|
}
|
|
132
123
|
});
|
|
133
|
-
app.openapi(
|
|
124
|
+
app.openapi(createProtectedRoute({
|
|
134
125
|
method: "get",
|
|
135
126
|
path: "/project-full/{projectId}",
|
|
136
127
|
summary: "Get Full Project",
|
|
137
128
|
operationId: "get-full-project",
|
|
138
129
|
tags: ["Projects"],
|
|
139
130
|
description: "Retrieve a complete project definition with all Agents, Sub Agents, tools, and relationships",
|
|
131
|
+
permission: requireProjectPermission("view"),
|
|
140
132
|
request: { params: TenantProjectParamsSchema },
|
|
141
133
|
responses: {
|
|
142
134
|
200: {
|
|
@@ -169,13 +161,14 @@ app.openapi(createRoute({
|
|
|
169
161
|
});
|
|
170
162
|
}
|
|
171
163
|
});
|
|
172
|
-
app.openapi(
|
|
164
|
+
app.openapi(createProtectedRoute({
|
|
173
165
|
method: "get",
|
|
174
166
|
path: "/project-full/{projectId}/with-relation-ids",
|
|
175
167
|
summary: "Get Full Project with Relation IDs",
|
|
176
168
|
operationId: "get-full-project-with-relation-ids",
|
|
177
169
|
tags: ["Projects"],
|
|
178
170
|
description: "Retrieve a complete project definition with all Agents, Sub Agents, tools, and relationships",
|
|
171
|
+
permission: requireProjectPermission("view"),
|
|
179
172
|
request: { params: TenantProjectParamsSchema },
|
|
180
173
|
responses: {
|
|
181
174
|
200: {
|
|
@@ -208,17 +201,14 @@ app.openapi(createRoute({
|
|
|
208
201
|
});
|
|
209
202
|
}
|
|
210
203
|
});
|
|
211
|
-
app.
|
|
212
|
-
if (c.req.method === "PUT") return requireProjectUpsertPermission(c, next);
|
|
213
|
-
return next();
|
|
214
|
-
});
|
|
215
|
-
app.openapi(createRoute({
|
|
204
|
+
app.openapi(createProtectedRoute({
|
|
216
205
|
method: "put",
|
|
217
206
|
path: "/project-full/{projectId}",
|
|
218
207
|
summary: "Update Full Project",
|
|
219
208
|
operationId: "update-full-project",
|
|
220
209
|
tags: ["Projects"],
|
|
221
210
|
description: "Update or create a complete project with all Agents, Sub Agents, tools, and relationships from JSON definition",
|
|
211
|
+
permission: requireProjectUpsertPermission,
|
|
222
212
|
request: {
|
|
223
213
|
params: TenantProjectParamsSchema,
|
|
224
214
|
body: { content: { "application/json": { schema: FullProjectDefinitionSchema } } }
|
|
@@ -416,17 +406,14 @@ app.openapi(createRoute({
|
|
|
416
406
|
});
|
|
417
407
|
}
|
|
418
408
|
});
|
|
419
|
-
app.
|
|
420
|
-
if (c.req.method === "DELETE") return requirePermission({ project: ["delete"] })(c, next);
|
|
421
|
-
return next();
|
|
422
|
-
});
|
|
423
|
-
app.openapi(createRoute({
|
|
409
|
+
app.openapi(createProtectedRoute({
|
|
424
410
|
method: "delete",
|
|
425
411
|
path: "/project-full/{projectId}",
|
|
426
412
|
summary: "Delete Full Project",
|
|
427
413
|
operationId: "delete-full-project",
|
|
428
414
|
tags: ["Projects"],
|
|
429
415
|
description: "Delete a complete project and cascade to all related entities (Agents, Sub Agents, tools, relationships)",
|
|
416
|
+
permission: requirePermission({ project: ["delete"] }),
|
|
430
417
|
request: { params: TenantProjectParamsSchema },
|
|
431
418
|
responses: {
|
|
432
419
|
204: { description: "Project deleted successfully" },
|
|
@@ -1,7 +1,9 @@
|
|
|
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/projectAccess.js";
|
|
4
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
4
5
|
import { TenantProjectParamsSchema, WorkAppGitHubAccessGetResponseSchema, WorkAppGitHubAccessModeSchema, WorkAppGitHubAccessSetRequestSchema, WorkAppGitHubAccessSetResponseSchema, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, getProjectAccessMode, getProjectRepositoryAccessWithDetails, setProjectAccessMode, setProjectRepositoryAccess, validateRepositoryOwnership } from "@inkeep/agents-core";
|
|
6
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
5
7
|
|
|
6
8
|
//#region src/domains/manage/routes/projectGithubAccess.ts
|
|
7
9
|
const logger = getLogger$1("project-github-access");
|
|
@@ -13,13 +15,14 @@ const SetGitHubAccessResponseSchema = WorkAppGitHubAccessSetResponseSchema.exten
|
|
|
13
15
|
mode: ProjectGitHubAccessModeSchema,
|
|
14
16
|
repositoryCount: z.number().describe("Number of repositories the project now has access to (0 when mode=\"all\")")
|
|
15
17
|
});
|
|
16
|
-
app.openapi(
|
|
18
|
+
app.openapi(createProtectedRoute({
|
|
17
19
|
method: "get",
|
|
18
20
|
path: "/",
|
|
19
21
|
summary: "Get project GitHub repository access",
|
|
20
22
|
operationId: "get-project-github-access",
|
|
21
23
|
tags: ["Projects"],
|
|
22
24
|
description: "Returns the current GitHub repository access configuration for a project. If mode is \"all\", the project has access to all repositories from tenant GitHub installations. If mode is \"selected\", the project is scoped to specific repositories.",
|
|
25
|
+
permission: requireProjectPermission("view"),
|
|
23
26
|
request: { params: TenantProjectParamsSchema },
|
|
24
27
|
responses: {
|
|
25
28
|
200: {
|
|
@@ -70,13 +73,14 @@ app.openapi(createRoute({
|
|
|
70
73
|
}))
|
|
71
74
|
}, 200);
|
|
72
75
|
});
|
|
73
|
-
app.openapi(
|
|
76
|
+
app.openapi(createProtectedRoute({
|
|
74
77
|
method: "put",
|
|
75
78
|
path: "/",
|
|
76
79
|
summary: "Set project GitHub repository access",
|
|
77
80
|
operationId: "set-project-github-access",
|
|
78
81
|
tags: ["Projects"],
|
|
79
82
|
description: "Configures which GitHub repositories a project can access. When mode is \"all\", the project has access to all repositories from tenant GitHub installations. When mode is \"selected\", the project is scoped to specific repositories (repositoryIds required). This replaces any existing access configuration.",
|
|
83
|
+
permission: requireProjectPermission("edit"),
|
|
80
84
|
request: {
|
|
81
85
|
params: TenantProjectParamsSchema,
|
|
82
86
|
body: { content: { "application/json": { schema: SetGitHubAccessRequestSchema } } }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
2
|
-
import { OpenAPIHono,
|
|
2
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
3
3
|
import { ProjectRoles, changeProjectRole, commonGetErrorResponses, createApiError, grantProjectAccess, listProjectMembers, revokeProjectAccess } from "@inkeep/agents-core";
|
|
4
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
4
5
|
|
|
5
6
|
//#region src/domains/manage/routes/projectMembers.ts
|
|
6
7
|
const app = new OpenAPIHono();
|
|
@@ -31,13 +32,14 @@ const UpdateRoleSchema = z.object({
|
|
|
31
32
|
role: projectRoleEnum,
|
|
32
33
|
previousRole: projectRoleEnum.optional()
|
|
33
34
|
});
|
|
34
|
-
app.openapi(
|
|
35
|
+
app.openapi(createProtectedRoute({
|
|
35
36
|
method: "get",
|
|
36
37
|
path: "/",
|
|
37
38
|
summary: "List Project Members",
|
|
38
|
-
description: "List all users with explicit project access.
|
|
39
|
+
description: "List all users with explicit project access.",
|
|
39
40
|
operationId: "list-project-members",
|
|
40
41
|
tags: ["Project Members"],
|
|
42
|
+
permission: requireProjectPermission("view"),
|
|
41
43
|
request: { params: ProjectMemberParamsSchema },
|
|
42
44
|
responses: {
|
|
43
45
|
200: {
|
|
@@ -57,17 +59,14 @@ app.openapi(createRoute({
|
|
|
57
59
|
});
|
|
58
60
|
return c.json({ data: members });
|
|
59
61
|
});
|
|
60
|
-
app.
|
|
61
|
-
if (c.req.method === "GET") return next();
|
|
62
|
-
return requireProjectPermission("edit")(c, next);
|
|
63
|
-
});
|
|
64
|
-
app.openapi(createRoute({
|
|
62
|
+
app.openapi(createProtectedRoute({
|
|
65
63
|
method: "post",
|
|
66
64
|
path: "/",
|
|
67
65
|
summary: "Add Project Member",
|
|
68
|
-
description: "Add a user to a project with a specified role.
|
|
66
|
+
description: "Add a user to a project with a specified role.",
|
|
69
67
|
operationId: "add-project-member",
|
|
70
68
|
tags: ["Project Members"],
|
|
69
|
+
permission: requireProjectPermission("edit"),
|
|
71
70
|
request: {
|
|
72
71
|
params: ProjectMemberParamsSchema,
|
|
73
72
|
body: { content: { "application/json": { schema: ProjectMemberSchema } } }
|
|
@@ -94,13 +93,14 @@ app.openapi(createRoute({
|
|
|
94
93
|
projectId
|
|
95
94
|
} }, 201);
|
|
96
95
|
});
|
|
97
|
-
app.openapi(
|
|
96
|
+
app.openapi(createProtectedRoute({
|
|
98
97
|
method: "patch",
|
|
99
98
|
path: "/{userId}",
|
|
100
99
|
summary: "Update Project Member Role",
|
|
101
|
-
description: "Update a project member's role.
|
|
100
|
+
description: "Update a project member's role. Include previousRole to specify which role to revoke.",
|
|
102
101
|
operationId: "update-project-member",
|
|
103
102
|
tags: ["Project Members"],
|
|
103
|
+
permission: requireProjectPermission("edit"),
|
|
104
104
|
request: {
|
|
105
105
|
params: ProjectMemberUserParamsSchema,
|
|
106
106
|
body: { content: { "application/json": { schema: UpdateRoleSchema } } }
|
|
@@ -137,13 +137,14 @@ app.openapi(createRoute({
|
|
|
137
137
|
projectId
|
|
138
138
|
} });
|
|
139
139
|
});
|
|
140
|
-
app.openapi(
|
|
140
|
+
app.openapi(createProtectedRoute({
|
|
141
141
|
method: "delete",
|
|
142
142
|
path: "/{userId}",
|
|
143
143
|
summary: "Remove Project Member",
|
|
144
|
-
description: "Remove a user from a project.
|
|
144
|
+
description: "Remove a user from a project. Pass role as query param to specify which role to revoke.",
|
|
145
145
|
operationId: "remove-project-member",
|
|
146
146
|
tags: ["Project Members"],
|
|
147
|
+
permission: requireProjectPermission("edit"),
|
|
147
148
|
request: {
|
|
148
149
|
params: ProjectMemberUserParamsSchema,
|
|
149
150
|
query: z.object({ role: projectRoleEnum })
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
2
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
2
3
|
import { OrgRoles, SpiceDbProjectPermissions, SpiceDbResourceTypes, checkBulkPermissions, commonGetErrorResponses, createApiError } from "@inkeep/agents-core";
|
|
4
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
3
5
|
|
|
4
6
|
//#region src/domains/manage/routes/projectPermissions.ts
|
|
5
7
|
const app = new OpenAPIHono();
|
|
@@ -12,13 +14,14 @@ const ProjectPermissionsResponseSchema = z.object({ data: z.object({
|
|
|
12
14
|
canUse: z.boolean(),
|
|
13
15
|
canEdit: z.boolean()
|
|
14
16
|
}) });
|
|
15
|
-
app.openapi(
|
|
17
|
+
app.openapi(createProtectedRoute({
|
|
16
18
|
method: "get",
|
|
17
19
|
path: "/",
|
|
18
20
|
summary: "Get Project Permissions",
|
|
19
21
|
description: "Get the current user's permissions for a project. Returns which actions the user can perform.",
|
|
20
22
|
operationId: "get-project-permissions",
|
|
21
23
|
tags: ["Project Permissions"],
|
|
24
|
+
permission: requireProjectPermission("view"),
|
|
22
25
|
request: { params: ProjectPermissionsParamsSchema },
|
|
23
26
|
responses: {
|
|
24
27
|
200: {
|