@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,21 +1,15 @@
|
|
|
1
1
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
2
2
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
3
3
|
import { speakeasyOffsetLimitPagination } from "../../../utils/speakeasy.js";
|
|
4
|
-
import { OpenAPIHono,
|
|
4
|
+
import { OpenAPIHono, 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";
|
|
6
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
6
7
|
|
|
7
8
|
//#region src/domains/manage/routes/apiKeys.ts
|
|
8
9
|
const app = new OpenAPIHono();
|
|
9
|
-
app.
|
|
10
|
-
if (c.req.method === "POST") return requireProjectPermission("use")(c, next);
|
|
11
|
-
return next();
|
|
12
|
-
});
|
|
13
|
-
app.use("/:id", async (c, next) => {
|
|
14
|
-
if (c.req.method === "PUT" || c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
15
|
-
return next();
|
|
16
|
-
});
|
|
17
|
-
app.openapi(createRoute({
|
|
10
|
+
app.openapi(createProtectedRoute({
|
|
18
11
|
method: "get",
|
|
12
|
+
permission: requireProjectPermission("view"),
|
|
19
13
|
path: "/",
|
|
20
14
|
summary: "List API Keys",
|
|
21
15
|
description: "List all API keys for a tenant with optional pagination",
|
|
@@ -55,13 +49,14 @@ app.openapi(createRoute({
|
|
|
55
49
|
pagination: result.pagination
|
|
56
50
|
});
|
|
57
51
|
});
|
|
58
|
-
app.openapi(
|
|
52
|
+
app.openapi(createProtectedRoute({
|
|
59
53
|
method: "get",
|
|
60
54
|
path: "/{id}",
|
|
61
55
|
summary: "Get API Key",
|
|
62
56
|
description: "Get a specific API key by ID (does not return the actual key)",
|
|
63
57
|
operationId: "get-api-key-by-id",
|
|
64
58
|
tags: ["API Keys"],
|
|
59
|
+
permission: requireProjectPermission("view"),
|
|
65
60
|
request: { params: TenantProjectIdParamsSchema },
|
|
66
61
|
responses: {
|
|
67
62
|
200: {
|
|
@@ -90,13 +85,14 @@ app.openapi(createRoute({
|
|
|
90
85
|
expiresAt: sanitizedApiKey.expiresAt ?? null
|
|
91
86
|
} });
|
|
92
87
|
});
|
|
93
|
-
app.openapi(
|
|
88
|
+
app.openapi(createProtectedRoute({
|
|
94
89
|
method: "post",
|
|
95
90
|
path: "/",
|
|
96
91
|
summary: "Create API Key",
|
|
97
92
|
description: "Create a new API key for an agent. Returns the full key (shown only once).",
|
|
98
93
|
operationId: "create-api-key",
|
|
99
94
|
tags: ["API Keys"],
|
|
95
|
+
permission: requireProjectPermission("use"),
|
|
100
96
|
request: {
|
|
101
97
|
params: TenantProjectParamsSchema,
|
|
102
98
|
body: { content: { "application/json": { schema: ApiKeyApiInsertSchema } } }
|
|
@@ -138,13 +134,14 @@ app.openapi(createRoute({
|
|
|
138
134
|
throw error;
|
|
139
135
|
}
|
|
140
136
|
});
|
|
141
|
-
app.openapi(
|
|
137
|
+
app.openapi(createProtectedRoute({
|
|
142
138
|
method: "put",
|
|
143
139
|
path: "/{id}",
|
|
144
140
|
summary: "Update API Key",
|
|
145
141
|
description: "Update an API key (currently only expiration date can be changed)",
|
|
146
142
|
operationId: "update-api-key",
|
|
147
143
|
tags: ["API Keys"],
|
|
144
|
+
permission: requireProjectPermission("edit"),
|
|
148
145
|
request: {
|
|
149
146
|
params: TenantProjectIdParamsSchema,
|
|
150
147
|
body: { content: { "application/json": { schema: ApiKeyApiUpdateSchema } } }
|
|
@@ -181,13 +178,14 @@ app.openapi(createRoute({
|
|
|
181
178
|
expiresAt: sanitizedApiKey.expiresAt ?? null
|
|
182
179
|
} });
|
|
183
180
|
});
|
|
184
|
-
app.openapi(
|
|
181
|
+
app.openapi(createProtectedRoute({
|
|
185
182
|
method: "delete",
|
|
186
183
|
path: "/{id}",
|
|
187
184
|
summary: "Delete API Key",
|
|
188
185
|
description: "Delete an API key permanently",
|
|
189
186
|
operationId: "delete-api-key",
|
|
190
187
|
tags: ["API Keys"],
|
|
188
|
+
permission: requireProjectPermission("edit"),
|
|
191
189
|
request: { params: TenantProjectIdParamsSchema },
|
|
192
190
|
responses: {
|
|
193
191
|
204: { description: "API key deleted successfully" },
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
2
2
|
import { speakeasyOffsetLimitPagination } from "../../../utils/speakeasy.js";
|
|
3
|
-
import { OpenAPIHono
|
|
3
|
+
import { OpenAPIHono } 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";
|
|
5
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
5
6
|
|
|
6
7
|
//#region src/domains/manage/routes/artifactComponents.ts
|
|
7
8
|
const app = new OpenAPIHono();
|
|
8
|
-
app.
|
|
9
|
-
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
10
|
-
return next();
|
|
11
|
-
});
|
|
12
|
-
app.use("/:id", async (c, next) => {
|
|
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
|
-
return next();
|
|
16
|
-
});
|
|
17
|
-
app.openapi(createRoute({
|
|
9
|
+
app.openapi(createProtectedRoute({
|
|
18
10
|
method: "get",
|
|
19
11
|
path: "/",
|
|
20
12
|
summary: "List Artifact Components",
|
|
21
13
|
operationId: "list-artifact-components",
|
|
22
14
|
tags: ["Artifact Components"],
|
|
15
|
+
permission: requireProjectPermission("view"),
|
|
23
16
|
request: {
|
|
24
17
|
params: TenantProjectParamsSchema,
|
|
25
18
|
query: PaginationQueryParamsSchema
|
|
@@ -49,12 +42,13 @@ app.openapi(createRoute({
|
|
|
49
42
|
});
|
|
50
43
|
return c.json(result);
|
|
51
44
|
});
|
|
52
|
-
app.openapi(
|
|
45
|
+
app.openapi(createProtectedRoute({
|
|
53
46
|
method: "get",
|
|
54
47
|
path: "/{id}",
|
|
55
48
|
summary: "Get Artifact Component",
|
|
56
49
|
operationId: "get-artifact-component-by-id",
|
|
57
50
|
tags: ["Artifact Components"],
|
|
51
|
+
permission: requireProjectPermission("view"),
|
|
58
52
|
request: { params: TenantProjectIdParamsSchema },
|
|
59
53
|
responses: {
|
|
60
54
|
200: {
|
|
@@ -79,12 +73,13 @@ app.openapi(createRoute({
|
|
|
79
73
|
});
|
|
80
74
|
return c.json({ data: artifactComponent });
|
|
81
75
|
});
|
|
82
|
-
app.openapi(
|
|
76
|
+
app.openapi(createProtectedRoute({
|
|
83
77
|
method: "post",
|
|
84
78
|
path: "/",
|
|
85
79
|
summary: "Create Artifact Component",
|
|
86
80
|
operationId: "create-artifact-component",
|
|
87
81
|
tags: ["Artifact Components"],
|
|
82
|
+
permission: requireProjectPermission("edit"),
|
|
88
83
|
request: {
|
|
89
84
|
params: TenantProjectParamsSchema,
|
|
90
85
|
body: { content: { "application/json": { schema: ArtifactComponentApiInsertSchema } } }
|
|
@@ -128,12 +123,13 @@ app.openapi(createRoute({
|
|
|
128
123
|
throw error;
|
|
129
124
|
}
|
|
130
125
|
});
|
|
131
|
-
app.openapi(
|
|
126
|
+
app.openapi(createProtectedRoute({
|
|
132
127
|
method: "put",
|
|
133
128
|
path: "/{id}",
|
|
134
129
|
summary: "Update Artifact Component",
|
|
135
130
|
operationId: "update-artifact-component",
|
|
136
131
|
tags: ["Artifact Components"],
|
|
132
|
+
permission: requireProjectPermission("edit"),
|
|
137
133
|
request: {
|
|
138
134
|
params: TenantProjectIdParamsSchema,
|
|
139
135
|
body: { content: { "application/json": { schema: ArtifactComponentApiUpdateSchema } } }
|
|
@@ -175,12 +171,13 @@ app.openapi(createRoute({
|
|
|
175
171
|
});
|
|
176
172
|
return c.json({ data: updatedArtifactComponent });
|
|
177
173
|
});
|
|
178
|
-
app.openapi(
|
|
174
|
+
app.openapi(createProtectedRoute({
|
|
179
175
|
method: "delete",
|
|
180
176
|
path: "/{id}",
|
|
181
177
|
summary: "Delete Artifact Component",
|
|
182
178
|
operationId: "delete-artifact-component",
|
|
183
179
|
tags: ["Artifact Components"],
|
|
180
|
+
permission: requireProjectPermission("edit"),
|
|
184
181
|
request: { params: TenantProjectIdParamsSchema },
|
|
185
182
|
responses: {
|
|
186
183
|
204: { description: "Artifact component deleted successfully" },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono16 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/availableAgents.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono16.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
2
2
|
import { env } from "../../../env.js";
|
|
3
3
|
import manageDbClient_default from "../../../data/db/manageDbClient.js";
|
|
4
|
-
import { OpenAPIHono,
|
|
4
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
5
5
|
import { createApiError, listAgentsAcrossProjectMainBranches, listUsableProjectIds, verifyTempToken } from "@inkeep/agents-core";
|
|
6
|
+
import { createProtectedRoute, inheritedAuth } from "@inkeep/agents-core/middleware";
|
|
6
7
|
|
|
7
8
|
//#region src/domains/manage/routes/availableAgents.ts
|
|
8
9
|
const logger = getLogger$1("availableAgents");
|
|
@@ -39,7 +40,7 @@ const AvailableAgentSchema = z.object({
|
|
|
39
40
|
projectId: z.string()
|
|
40
41
|
});
|
|
41
42
|
const AvailableAgentsResponseSchema = z.object({ data: z.array(AvailableAgentSchema) });
|
|
42
|
-
app.openapi(
|
|
43
|
+
app.openapi(createProtectedRoute({
|
|
43
44
|
method: "get",
|
|
44
45
|
path: "/",
|
|
45
46
|
summary: "List available agents",
|
|
@@ -47,6 +48,7 @@ app.openapi(createRoute({
|
|
|
47
48
|
tags: ["Agents"],
|
|
48
49
|
description: "List all agents the user can invoke. Requires a valid JWT token.",
|
|
49
50
|
security: [{ bearerAuth: [] }],
|
|
51
|
+
permission: inheritedAuth({ description: "Requires a valid JWT token (temp-jwt or work-app user token). Auth and SpiceDB authorization are enforced in the handler." }),
|
|
50
52
|
responses: {
|
|
51
53
|
200: {
|
|
52
54
|
description: "List of available agents",
|
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
2
2
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
3
|
-
import { OpenAPIHono
|
|
3
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
4
4
|
import { BranchListResponseSchema, BranchNameParamsSchema, BranchResponseSchema, CreateBranchRequestSchema, ErrorResponseSchema, TenantProjectAgentParamsSchema, TenantProjectParamsSchema, cascadeDeleteByBranch, commonGetErrorResponses, createApiError, createBranch, deleteBranch, getBranch, listBranches, listBranchesForAgent } from "@inkeep/agents-core";
|
|
5
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
5
6
|
|
|
6
7
|
//#region src/domains/manage/routes/branches.ts
|
|
7
8
|
const app = new OpenAPIHono();
|
|
8
|
-
app.
|
|
9
|
-
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
10
|
-
return next();
|
|
11
|
-
});
|
|
12
|
-
app.use("/:branchName", async (c, next) => {
|
|
13
|
-
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
14
|
-
return next();
|
|
15
|
-
});
|
|
16
|
-
app.openapi(createRoute({
|
|
9
|
+
app.openapi(createProtectedRoute({
|
|
17
10
|
method: "get",
|
|
18
11
|
path: "/",
|
|
19
12
|
summary: "List Branches",
|
|
20
13
|
description: "List all branches within a project",
|
|
21
14
|
operationId: "list-branches",
|
|
22
15
|
tags: ["Branches"],
|
|
16
|
+
permission: requireProjectPermission("view"),
|
|
23
17
|
request: { params: TenantProjectParamsSchema },
|
|
24
18
|
responses: {
|
|
25
19
|
200: {
|
|
@@ -37,13 +31,14 @@ app.openapi(createRoute({
|
|
|
37
31
|
});
|
|
38
32
|
return c.json({ data: branches });
|
|
39
33
|
});
|
|
40
|
-
app.openapi(
|
|
34
|
+
app.openapi(createProtectedRoute({
|
|
41
35
|
method: "get",
|
|
42
36
|
path: "/{branchName}",
|
|
43
37
|
summary: "Get Branch",
|
|
44
38
|
description: "Get a single branch by name",
|
|
45
39
|
operationId: "get-branch",
|
|
46
40
|
tags: ["Branches"],
|
|
41
|
+
permission: requireProjectPermission("view"),
|
|
47
42
|
request: { params: BranchNameParamsSchema },
|
|
48
43
|
responses: {
|
|
49
44
|
200: {
|
|
@@ -66,13 +61,14 @@ app.openapi(createRoute({
|
|
|
66
61
|
});
|
|
67
62
|
return c.json({ data: branch });
|
|
68
63
|
});
|
|
69
|
-
app.openapi(
|
|
64
|
+
app.openapi(createProtectedRoute({
|
|
70
65
|
method: "get",
|
|
71
66
|
path: "/agents/{agentId}",
|
|
72
67
|
summary: "List Branches for Agent",
|
|
73
68
|
description: "List all branches within a project that contain the agent",
|
|
74
69
|
operationId: "list-branches-for-agent",
|
|
75
70
|
tags: ["Branches"],
|
|
71
|
+
permission: requireProjectPermission("view"),
|
|
76
72
|
request: { params: TenantProjectAgentParamsSchema },
|
|
77
73
|
responses: {
|
|
78
74
|
200: {
|
|
@@ -91,13 +87,14 @@ app.openapi(createRoute({
|
|
|
91
87
|
});
|
|
92
88
|
return c.json({ data: branches });
|
|
93
89
|
});
|
|
94
|
-
app.openapi(
|
|
90
|
+
app.openapi(createProtectedRoute({
|
|
95
91
|
method: "post",
|
|
96
92
|
path: "/",
|
|
97
93
|
summary: "Create Branch",
|
|
98
94
|
description: "Create a new branch",
|
|
99
95
|
operationId: "create-branch",
|
|
100
96
|
tags: ["Branches"],
|
|
97
|
+
permission: requireProjectPermission("edit"),
|
|
101
98
|
request: {
|
|
102
99
|
params: TenantProjectParamsSchema,
|
|
103
100
|
body: { content: { "application/json": { schema: CreateBranchRequestSchema } } }
|
|
@@ -138,13 +135,14 @@ app.openapi(createRoute({
|
|
|
138
135
|
throw error;
|
|
139
136
|
}
|
|
140
137
|
});
|
|
141
|
-
app.openapi(
|
|
138
|
+
app.openapi(createProtectedRoute({
|
|
142
139
|
method: "delete",
|
|
143
140
|
path: "/{branchName}",
|
|
144
141
|
summary: "Delete Branch",
|
|
145
142
|
description: "Delete a branch. Cannot delete protected branches like main.",
|
|
146
143
|
operationId: "delete-branch",
|
|
147
144
|
tags: ["Branches"],
|
|
145
|
+
permission: requireProjectPermission("edit"),
|
|
148
146
|
request: { params: BranchNameParamsSchema },
|
|
149
147
|
responses: {
|
|
150
148
|
204: { description: "Branch deleted successfully" },
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
2
2
|
import { sessionAuth } from "../../../middleware/sessionAuth.js";
|
|
3
|
-
import { OpenAPIHono,
|
|
3
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
4
4
|
import { getUserOrganizationsFromDb } from "@inkeep/agents-core";
|
|
5
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
5
6
|
|
|
6
7
|
//#region src/domains/manage/routes/cliAuth.ts
|
|
7
8
|
const cliAuthRoutes = new OpenAPIHono();
|
|
@@ -18,13 +19,13 @@ const CLIMeResponseSchema = z.object({
|
|
|
18
19
|
role: z.string()
|
|
19
20
|
})
|
|
20
21
|
});
|
|
21
|
-
cliAuthRoutes.openapi(
|
|
22
|
+
cliAuthRoutes.openapi(createProtectedRoute({
|
|
22
23
|
method: "get",
|
|
23
24
|
path: "/me",
|
|
24
25
|
tags: ["CLI"],
|
|
25
26
|
summary: "Get CLI user info",
|
|
26
27
|
description: "Get the current authenticated user and their organization for CLI usage",
|
|
27
|
-
|
|
28
|
+
permission: sessionAuth(),
|
|
28
29
|
responses: {
|
|
29
30
|
200: {
|
|
30
31
|
description: "User info with organization",
|
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
2
2
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
3
3
|
import { speakeasyOffsetLimitPagination } from "../../../utils/speakeasy.js";
|
|
4
|
-
import { OpenAPIHono
|
|
4
|
+
import { OpenAPIHono } 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";
|
|
6
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
6
7
|
|
|
7
8
|
//#region src/domains/manage/routes/contextConfigs.ts
|
|
8
9
|
const app = new OpenAPIHono();
|
|
9
|
-
app.
|
|
10
|
-
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
11
|
-
return next();
|
|
12
|
-
});
|
|
13
|
-
app.use("/:id", async (c, next) => {
|
|
14
|
-
if (c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
|
|
15
|
-
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
16
|
-
return next();
|
|
17
|
-
});
|
|
18
|
-
app.openapi(createRoute({
|
|
10
|
+
app.openapi(createProtectedRoute({
|
|
19
11
|
method: "get",
|
|
20
12
|
path: "/",
|
|
21
13
|
summary: "List Context Configurations",
|
|
22
14
|
operationId: "list-context-configs",
|
|
23
15
|
tags: ["Context Configs"],
|
|
16
|
+
permission: requireProjectPermission("view"),
|
|
24
17
|
request: {
|
|
25
18
|
params: TenantProjectAgentParamsSchema,
|
|
26
19
|
query: PaginationQueryParamsSchema
|
|
@@ -51,12 +44,13 @@ app.openapi(createRoute({
|
|
|
51
44
|
});
|
|
52
45
|
return c.json(result);
|
|
53
46
|
});
|
|
54
|
-
app.openapi(
|
|
47
|
+
app.openapi(createProtectedRoute({
|
|
55
48
|
method: "get",
|
|
56
49
|
path: "/{id}",
|
|
57
50
|
summary: "Get Context Configuration",
|
|
58
51
|
operationId: "get-context-config-by-id",
|
|
59
52
|
tags: ["Context Configs"],
|
|
53
|
+
permission: requireProjectPermission("view"),
|
|
60
54
|
request: { params: TenantProjectAgentIdParamsSchema },
|
|
61
55
|
responses: {
|
|
62
56
|
200: {
|
|
@@ -82,12 +76,13 @@ app.openapi(createRoute({
|
|
|
82
76
|
});
|
|
83
77
|
return c.json({ data: contextConfig });
|
|
84
78
|
});
|
|
85
|
-
app.openapi(
|
|
79
|
+
app.openapi(createProtectedRoute({
|
|
86
80
|
method: "post",
|
|
87
81
|
path: "/",
|
|
88
82
|
summary: "Create Context Configuration",
|
|
89
83
|
operationId: "create-context-config",
|
|
90
84
|
tags: ["Context Configs"],
|
|
85
|
+
permission: requireProjectPermission("edit"),
|
|
91
86
|
request: {
|
|
92
87
|
params: TenantProjectAgentParamsSchema,
|
|
93
88
|
body: { content: { "application/json": { schema: ContextConfigApiInsertSchema } } }
|
|
@@ -111,12 +106,13 @@ app.openapi(createRoute({
|
|
|
111
106
|
const contextConfig = await createContextConfig(db)(configData);
|
|
112
107
|
return c.json({ data: contextConfig }, 201);
|
|
113
108
|
});
|
|
114
|
-
app.openapi(
|
|
109
|
+
app.openapi(createProtectedRoute({
|
|
115
110
|
method: "put",
|
|
116
111
|
path: "/{id}",
|
|
117
112
|
summary: "Update Context Configuration",
|
|
118
113
|
operationId: "update-context-config",
|
|
119
114
|
tags: ["Context Configs"],
|
|
115
|
+
permission: requireProjectPermission("edit"),
|
|
120
116
|
request: {
|
|
121
117
|
params: TenantProjectAgentIdParamsSchema,
|
|
122
118
|
body: { content: { "application/json": { schema: ContextConfigApiUpdateSchema } } }
|
|
@@ -147,12 +143,13 @@ app.openapi(createRoute({
|
|
|
147
143
|
});
|
|
148
144
|
return c.json({ data: updatedContextConfig });
|
|
149
145
|
});
|
|
150
|
-
app.openapi(
|
|
146
|
+
app.openapi(createProtectedRoute({
|
|
151
147
|
method: "delete",
|
|
152
148
|
path: "/{id}",
|
|
153
149
|
summary: "Delete Context Configuration",
|
|
154
150
|
operationId: "delete-context-config",
|
|
155
151
|
tags: ["Context Configs"],
|
|
152
|
+
permission: requireProjectPermission("edit"),
|
|
156
153
|
request: { params: TenantProjectAgentIdParamsSchema },
|
|
157
154
|
responses: {
|
|
158
155
|
204: { description: "Context configuration deleted successfully" },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono17 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono17.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
2
|
-
import {
|
|
2
|
+
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
3
|
+
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
3
4
|
import { TenantProjectIdParamsSchema, commonGetErrorResponses, createApiError, formatMessagesForLLMContext, getConversationHistory } from "@inkeep/agents-core";
|
|
5
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
4
6
|
|
|
5
7
|
//#region src/domains/manage/routes/conversations.ts
|
|
6
8
|
const app = new OpenAPIHono();
|
|
@@ -12,12 +14,13 @@ const ConversationWithFormattedMessagesResponse = z.object({ data: z.object({
|
|
|
12
14
|
messages: z.array(z.any()),
|
|
13
15
|
formatted: z.object({ llmContext: z.string() })
|
|
14
16
|
}) }).openapi("ConversationWithFormattedMessagesResponse");
|
|
15
|
-
app.openapi(
|
|
17
|
+
app.openapi(createProtectedRoute({
|
|
16
18
|
method: "get",
|
|
17
19
|
path: "/{id}",
|
|
18
20
|
summary: "Get Conversation",
|
|
19
21
|
operationId: "get-conversation",
|
|
20
22
|
tags: ["Conversations"],
|
|
23
|
+
permission: requireProjectPermission("view"),
|
|
21
24
|
request: {
|
|
22
25
|
params: TenantProjectIdParamsSchema,
|
|
23
26
|
query: ConversationQueryParamsSchema
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
2
|
-
import { OpenAPIHono
|
|
2
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
3
3
|
import { CreateCredentialInStoreRequestSchema, CreateCredentialInStoreResponseSchema, CredentialStoreListResponseSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError } from "@inkeep/agents-core";
|
|
4
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
4
5
|
|
|
5
6
|
//#region src/domains/manage/routes/credentialStores.ts
|
|
6
7
|
const app = new OpenAPIHono();
|
|
7
|
-
app.
|
|
8
|
-
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
9
|
-
return next();
|
|
10
|
-
});
|
|
11
|
-
app.openapi(createRoute({
|
|
8
|
+
app.openapi(createProtectedRoute({
|
|
12
9
|
method: "get",
|
|
13
10
|
path: "/",
|
|
14
11
|
summary: "List Credential Stores",
|
|
15
12
|
operationId: "list-credential-stores",
|
|
16
13
|
tags: ["Credential Stores"],
|
|
14
|
+
permission: requireProjectPermission("view"),
|
|
17
15
|
request: { params: TenantProjectParamsSchema },
|
|
18
16
|
responses: {
|
|
19
17
|
200: {
|
|
@@ -35,12 +33,13 @@ app.openapi(createRoute({
|
|
|
35
33
|
}));
|
|
36
34
|
return c.json({ data: storeStatuses });
|
|
37
35
|
});
|
|
38
|
-
app.openapi(
|
|
36
|
+
app.openapi(createProtectedRoute({
|
|
39
37
|
method: "post",
|
|
40
38
|
path: "/{id}/credentials",
|
|
41
39
|
summary: "Create Credential in Store",
|
|
42
40
|
operationId: "create-credential-in-store",
|
|
43
41
|
tags: ["Credential Stores"],
|
|
42
|
+
permission: requireProjectPermission("edit"),
|
|
44
43
|
request: {
|
|
45
44
|
params: TenantProjectIdParamsSchema,
|
|
46
45
|
body: { content: { "application/json": { schema: CreateCredentialInStoreRequestSchema } } }
|
|
@@ -53,7 +52,7 @@ app.openapi(createRoute({
|
|
|
53
52
|
...commonGetErrorResponses
|
|
54
53
|
}
|
|
55
54
|
}), async (c) => {
|
|
56
|
-
const { id: storeId } = c.req.param
|
|
55
|
+
const { id: storeId } = c.req.valid("param");
|
|
57
56
|
const { key, value, metadata } = await c.req.json();
|
|
58
57
|
const store = c.get("credentialStores").get(storeId);
|
|
59
58
|
if (!store) throw createApiError({
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
2
2
|
import { speakeasyOffsetLimitPagination } from "../../../utils/speakeasy.js";
|
|
3
|
-
import { OpenAPIHono
|
|
3
|
+
import { OpenAPIHono } 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";
|
|
5
|
+
import { createProtectedRoute } from "@inkeep/agents-core/middleware";
|
|
5
6
|
|
|
6
7
|
//#region src/domains/manage/routes/credentials.ts
|
|
7
8
|
const app = new OpenAPIHono();
|
|
8
|
-
app.
|
|
9
|
-
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
10
|
-
return next();
|
|
11
|
-
});
|
|
12
|
-
app.use("/:id", async (c, next) => {
|
|
13
|
-
if (c.req.method === "PATCH" || c.req.method === "DELETE" || c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
|
|
14
|
-
return next();
|
|
15
|
-
});
|
|
16
|
-
app.openapi(createRoute({
|
|
9
|
+
app.openapi(createProtectedRoute({
|
|
17
10
|
method: "get",
|
|
18
11
|
path: "/",
|
|
19
12
|
summary: "List Credentials",
|
|
20
13
|
operationId: "list-credentials",
|
|
21
14
|
tags: ["Credentials"],
|
|
15
|
+
permission: requireProjectPermission("view"),
|
|
22
16
|
request: {
|
|
23
17
|
params: TenantProjectParamsSchema,
|
|
24
18
|
query: PaginationQueryParamsSchema
|
|
@@ -49,12 +43,13 @@ app.openapi(createRoute({
|
|
|
49
43
|
const validatedResult = ListResponseSchema(CredentialReferenceApiSelectSchema).parse(result);
|
|
50
44
|
return c.json(validatedResult);
|
|
51
45
|
});
|
|
52
|
-
app.openapi(
|
|
46
|
+
app.openapi(createProtectedRoute({
|
|
53
47
|
method: "get",
|
|
54
48
|
path: "/{id}",
|
|
55
49
|
summary: "Get Credential",
|
|
56
50
|
operationId: "get-credential-by-id",
|
|
57
51
|
tags: ["Credentials"],
|
|
52
|
+
permission: requireProjectPermission("view"),
|
|
58
53
|
request: { params: TenantProjectIdParamsSchema },
|
|
59
54
|
responses: {
|
|
60
55
|
200: {
|
|
@@ -79,12 +74,13 @@ app.openapi(createRoute({
|
|
|
79
74
|
const validatedCredential = CredentialReferenceApiSelectSchema.parse(credential);
|
|
80
75
|
return c.json({ data: validatedCredential });
|
|
81
76
|
});
|
|
82
|
-
app.openapi(
|
|
77
|
+
app.openapi(createProtectedRoute({
|
|
83
78
|
method: "post",
|
|
84
79
|
path: "/",
|
|
85
80
|
summary: "Create Credential",
|
|
86
81
|
operationId: "create-credential",
|
|
87
82
|
tags: ["Credentials"],
|
|
83
|
+
permission: requireProjectPermission("edit"),
|
|
88
84
|
request: {
|
|
89
85
|
params: TenantProjectParamsSchema,
|
|
90
86
|
body: { content: { "application/json": { schema: CredentialReferenceApiInsertSchema } } }
|
|
@@ -108,12 +104,13 @@ app.openapi(createRoute({
|
|
|
108
104
|
const validatedCredential = CredentialReferenceApiSelectSchema.parse(credential);
|
|
109
105
|
return c.json({ data: validatedCredential }, 201);
|
|
110
106
|
});
|
|
111
|
-
app.openapi(
|
|
107
|
+
app.openapi(createProtectedRoute({
|
|
112
108
|
method: "put",
|
|
113
109
|
path: "/{id}",
|
|
114
110
|
summary: "Update Credential",
|
|
115
111
|
operationId: "update-credential",
|
|
116
112
|
tags: ["Credentials"],
|
|
113
|
+
permission: requireProjectPermission("edit"),
|
|
117
114
|
request: {
|
|
118
115
|
params: TenantProjectIdParamsSchema,
|
|
119
116
|
body: { content: { "application/json": { schema: CredentialReferenceApiUpdateSchema } } }
|
|
@@ -144,12 +141,13 @@ app.openapi(createRoute({
|
|
|
144
141
|
const validatedCredential = CredentialReferenceApiSelectSchema.parse(updatedCredential);
|
|
145
142
|
return c.json({ data: validatedCredential });
|
|
146
143
|
});
|
|
147
|
-
app.openapi(
|
|
144
|
+
app.openapi(createProtectedRoute({
|
|
148
145
|
method: "delete",
|
|
149
146
|
path: "/{id}",
|
|
150
147
|
summary: "Delete Credential",
|
|
151
148
|
operationId: "delete-credential",
|
|
152
149
|
tags: ["Credentials"],
|
|
150
|
+
permission: requireProjectPermission("edit"),
|
|
153
151
|
request: { params: TenantProjectIdParamsSchema },
|
|
154
152
|
responses: {
|
|
155
153
|
204: { description: "Credential deleted successfully" },
|