@inkeep/agents-api 0.42.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.well-known/workflow/v1/manifest.debug.json +6 -6
- package/dist/.well-known/workflow/v1/step.cjs +220467 -203416
- package/dist/_virtual/rolldown_runtime.js +7 -0
- package/dist/createApp.js +47 -17
- package/dist/domains/evals/api/.well-known/workflow/v1/flow.d.ts +4 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/flow.js +12 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/step.d.ts +4 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/step.js +12 -0
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/evals/scripts/build-workflow.js +2 -2
- package/dist/domains/evals/workflow/world.js +3 -2
- package/dist/domains/manage/index.js +6 -2
- package/dist/domains/manage/routes/agent.js +7 -4
- package/dist/domains/manage/routes/agentFull.js +9 -6
- package/dist/domains/manage/routes/apiKeys.js +1 -2
- package/dist/domains/manage/routes/artifactComponents.js +5 -5
- package/dist/domains/manage/routes/cliAuth.js +3 -3
- package/dist/domains/manage/routes/contextConfigs.js +5 -5
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/credentialStores.js +2 -2
- package/dist/domains/manage/routes/credentials.js +6 -7
- package/dist/domains/manage/routes/dataComponents.js +6 -7
- package/dist/domains/manage/routes/externalAgents.js +1 -2
- package/dist/domains/manage/routes/github.d.ts +16 -0
- package/dist/domains/manage/routes/github.js +511 -0
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/index.js +4 -0
- package/dist/domains/manage/routes/invitations.js +1 -1
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/{agentToolRelations.d.ts → mcpToolGithubAccess.d.ts} +1 -1
- package/dist/domains/manage/routes/mcpToolGithubAccess.js +205 -0
- package/dist/domains/manage/routes/playgroundToken.js +1 -2
- package/dist/domains/manage/routes/projectFull.js +33 -11
- package/dist/domains/manage/routes/projectGithubAccess.d.ts +9 -0
- package/dist/domains/manage/routes/projectGithubAccess.js +167 -0
- package/dist/domains/manage/routes/projectMembers.js +12 -44
- package/dist/domains/manage/routes/projectPermissions.js +11 -11
- package/dist/domains/manage/routes/projects.js +15 -18
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.js +7 -4
- package/dist/domains/manage/routes/subAgentArtifactComponents.js +5 -5
- package/dist/domains/manage/routes/subAgentDataComponents.js +5 -5
- package/dist/domains/manage/routes/subAgentExternalAgentRelations.js +5 -5
- package/dist/domains/manage/routes/subAgentFunctionTools.js +5 -5
- package/dist/domains/manage/routes/subAgentRelations.js +6 -6
- package/dist/domains/manage/routes/subAgentTeamAgentRelations.js +6 -6
- package/dist/domains/manage/routes/subAgentToolRelations.js +6 -6
- package/dist/domains/manage/routes/subAgents.js +5 -5
- package/dist/domains/manage/routes/tools.js +28 -5
- package/dist/domains/manage/routes/triggers.js +49 -24
- package/dist/domains/manage/routes/userOrganizations.js +4 -4
- package/dist/domains/manage/routes/userProjectMemberships.d.ts +9 -0
- package/dist/domains/manage/routes/userProjectMemberships.js +44 -0
- package/dist/domains/mcp/routes/mcp.d.ts +7 -0
- package/dist/domains/mcp/routes/mcp.js +45 -0
- package/dist/domains/run/agents/Agent.d.ts +1 -0
- package/dist/domains/run/agents/Agent.js +235 -45
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/constants/execution-limits/defaults.d.ts +1 -1
- package/dist/domains/run/constants/execution-limits/defaults.js +1 -1
- package/dist/domains/run/constants/execution-limits/index.d.ts +1 -1
- package/dist/domains/run/context/ContextFetcher.js +8 -7
- package/dist/domains/run/context/validation.d.ts +1 -1
- package/dist/domains/run/handlers/executionHandler.js +143 -79
- package/dist/domains/run/routes/agents.js +1 -1
- package/dist/domains/run/routes/chat.js +47 -1
- package/dist/domains/run/routes/chatDataStream.js +107 -14
- package/dist/domains/run/routes/webhooks.js +40 -348
- package/dist/domains/run/services/AgentSession.d.ts +3 -0
- package/dist/domains/run/services/AgentSession.js +14 -1
- package/dist/domains/run/services/ToolApprovalUiBus.d.ts +28 -0
- package/dist/domains/run/services/ToolApprovalUiBus.js +44 -0
- package/dist/domains/run/services/TriggerService.d.ts +31 -0
- package/dist/domains/run/services/TriggerService.js +545 -0
- package/dist/domains/run/tools/NativeSandboxExecutor.d.ts +3 -2
- package/dist/domains/run/tools/NativeSandboxExecutor.js +76 -48
- package/dist/domains/run/tools/SandboxExecutorFactory.d.ts +11 -1
- package/dist/domains/run/tools/SandboxExecutorFactory.js +27 -3
- package/dist/domains/run/tools/VercelSandboxExecutor.d.ts +3 -11
- package/dist/domains/run/tools/VercelSandboxExecutor.js +137 -127
- package/dist/domains/run/tools/sandbox-utils.js +1 -1
- package/dist/domains/run/types/executionContext.js +3 -1
- package/dist/domains/run/utils/stream-helpers.d.ts +134 -0
- package/dist/domains/run/utils/stream-helpers.js +182 -0
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/env.d.ts +12 -2
- package/dist/env.js +37 -32
- package/dist/factory.d.ts +31 -31
- package/dist/factory.js +4 -10
- package/dist/index.d.ts +30 -29
- package/dist/index.js +3 -5
- package/dist/middleware/branchScopedDb.d.ts +1 -1
- package/dist/middleware/cors.js +1 -1
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectAccess.d.ts +4 -20
- package/dist/middleware/projectAccess.js +7 -49
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/ref.d.ts +1 -1
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/requirePermission.js +1 -2
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/sessionAuth.js +1 -2
- package/dist/middleware/tenantAccess.d.ts +2 -2
- package/dist/middleware/tenantAccess.js +4 -4
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/openapi.d.ts +36 -1
- package/dist/openapi.js +40 -95
- package/dist/routes/healthChecks.d.ts +10 -0
- package/dist/routes/healthChecks.js +75 -0
- package/dist/types/app.d.ts +2 -0
- package/dist/types/runExecutionContext.js +3 -1
- package/dist/utils/healthChecks.d.ts +8 -0
- package/dist/utils/healthChecks.js +38 -0
- package/dist/utils/signozHelpers.d.ts +2 -2
- package/dist/utils/signozHelpers.js +15 -3
- package/package.json +8 -9
- package/dist/domains/evals/services/startEvaluation.d.ts +0 -19
- package/dist/domains/evals/services/startEvaluation.js +0 -18
- package/dist/domains/index.d.ts +0 -4
- package/dist/domains/index.js +0 -5
- package/dist/domains/manage/routes/agentToolRelations.js +0 -289
- package/dist/domains/run/agents/ModelFactory.d.ts +0 -63
- package/dist/domains/run/agents/ModelFactory.js +0 -194
- package/dist/domains/run/data/agent.d.ts +0 -7
- package/dist/domains/run/data/agent.js +0 -67
- package/dist/domains/run/services/evaluationRunConfigMatcher.d.ts +0 -4
- package/dist/domains/run/services/evaluationRunConfigMatcher.js +0 -7
- package/dist/domains/run/utils/cleanup.d.ts +0 -21
- package/dist/domains/run/utils/cleanup.js +0 -59
- package/dist/initialization.d.ts +0 -6
- package/dist/initialization.js +0 -65
- package/dist/utils/tempApiKeys.d.ts +0 -17
- package/dist/utils/tempApiKeys.js +0 -26
- package/dist/utils/workflowApiHelpers.d.ts +0 -1
- package/dist/utils/workflowApiHelpers.js +0 -1
package/dist/createApp.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { getLogger } from "./logger.js";
|
|
1
|
+
import { getLogger as getLogger$1 } from "./logger.js";
|
|
2
2
|
import { env } from "./env.js";
|
|
3
3
|
import { evalRoutes } from "./domains/evals/index.js";
|
|
4
4
|
import { workflowRoutes } from "./domains/evals/workflow/routes.js";
|
|
5
5
|
import { sessionAuth, sessionContext } from "./middleware/sessionAuth.js";
|
|
6
6
|
import { manageRoutes } from "./domains/manage/index.js";
|
|
7
|
+
import mcp_default from "./domains/mcp/routes/mcp.js";
|
|
7
8
|
import { flushBatchProcessor } from "./instrumentation.js";
|
|
8
9
|
import { runRoutes } from "./domains/run/index.js";
|
|
9
10
|
import { authCorsConfig, defaultCorsConfig, playgroundCorsConfig, runCorsConfig, signozCorsConfig } from "./middleware/cors.js";
|
|
@@ -18,14 +19,17 @@ import { evalApiKeyAuth } from "./middleware/evalsAuth.js";
|
|
|
18
19
|
import { projectConfigMiddleware, projectConfigMiddlewareExcept } from "./middleware/projectConfig.js";
|
|
19
20
|
import { executionBaggageMiddleware } from "./middleware/tracing.js";
|
|
20
21
|
import { setupOpenAPIRoutes } from "./openapi.js";
|
|
21
|
-
import {
|
|
22
|
+
import { healthChecksHandler } from "./routes/healthChecks.js";
|
|
23
|
+
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
24
|
+
import { OrgRoles } from "@inkeep/agents-core";
|
|
25
|
+
import { githubRoutes } from "@inkeep/agents-work-apps/github";
|
|
22
26
|
import { Hono } from "hono";
|
|
23
27
|
import { cors } from "hono/cors";
|
|
24
28
|
import { requestId } from "hono/request-id";
|
|
25
29
|
import { pinoLogger } from "hono-pino";
|
|
26
30
|
|
|
27
31
|
//#region src/createApp.ts
|
|
28
|
-
const logger = getLogger("agents-api");
|
|
32
|
+
const logger = getLogger$1("agents-api");
|
|
29
33
|
const isTestEnvironment = () => env.ENVIRONMENT === "test";
|
|
30
34
|
const isWebhookRoute = (path) => {
|
|
31
35
|
return path.includes("/triggers/") && !path.endsWith("/triggers") && !path.endsWith("/triggers/");
|
|
@@ -33,6 +37,11 @@ const isWebhookRoute = (path) => {
|
|
|
33
37
|
function createAgentsHono(config) {
|
|
34
38
|
const { serverConfig, credentialStores, auth, sandboxConfig } = config;
|
|
35
39
|
const app = new OpenAPIHono();
|
|
40
|
+
const CapabilitiesResponseSchema = z.object({ sandbox: z.object({
|
|
41
|
+
configured: z.boolean().describe("Whether a sandbox provider is configured. Required for Function Tools execution."),
|
|
42
|
+
provider: z.enum(["native", "vercel"]).optional().describe("The configured sandbox provider, if enabled."),
|
|
43
|
+
runtime: z.enum(["node22", "typescript"]).optional().describe("The configured sandbox runtime, if enabled.")
|
|
44
|
+
}).describe("Sandbox execution capabilities (used by Function Tools).") }).describe("Optional server capabilities and configuration.").openapi("CapabilitiesResponseSchema");
|
|
36
45
|
app.use("*", requestId());
|
|
37
46
|
if (auth) {
|
|
38
47
|
app.use("/api/auth/*", cors(authCorsConfig));
|
|
@@ -48,6 +57,7 @@ function createAgentsHono(config) {
|
|
|
48
57
|
if (c.req.path.startsWith("/run/")) return next();
|
|
49
58
|
if (c.req.path.includes("/playground/token")) return next();
|
|
50
59
|
if (c.req.path.includes("/signoz/")) return next();
|
|
60
|
+
if (c.req.path.includes("/work-apps/github/")) return next();
|
|
51
61
|
return cors(defaultCorsConfig)(c, next);
|
|
52
62
|
});
|
|
53
63
|
app.use("*", async (c, next) => {
|
|
@@ -73,7 +83,7 @@ function createAgentsHono(config) {
|
|
|
73
83
|
return next();
|
|
74
84
|
});
|
|
75
85
|
app.use(pinoLogger({
|
|
76
|
-
pino: getLogger("agents-api").getPinoInstance(),
|
|
86
|
+
pino: getLogger$1("agents-api").getPinoInstance(),
|
|
77
87
|
http: { onResLevel(c) {
|
|
78
88
|
if (c.res.status >= 500) return "error";
|
|
79
89
|
if (c.req.path.includes("/signoz/")) return "debug";
|
|
@@ -82,20 +92,11 @@ function createAgentsHono(config) {
|
|
|
82
92
|
}));
|
|
83
93
|
app.onError(errorHandler);
|
|
84
94
|
app.use("*", sessionContext());
|
|
85
|
-
app.
|
|
86
|
-
method: "get",
|
|
87
|
-
path: "/health",
|
|
88
|
-
operationId: "health",
|
|
89
|
-
summary: "Health check",
|
|
90
|
-
description: "Check if the management service is healthy",
|
|
91
|
-
responses: { 204: { description: "Service is healthy" } }
|
|
92
|
-
}), (c) => {
|
|
93
|
-
return c.body(null, 204);
|
|
94
|
-
});
|
|
95
|
+
app.route("/", healthChecksHandler);
|
|
95
96
|
app.openapi(createRoute({
|
|
96
97
|
method: "get",
|
|
97
98
|
path: "/api/workflow/process",
|
|
98
|
-
tags: ["
|
|
99
|
+
tags: ["Workflows"],
|
|
99
100
|
summary: "Process workflow jobs",
|
|
100
101
|
description: "Keeps the workflow worker active to process queued jobs (called by cron)",
|
|
101
102
|
responses: { 200: { description: "Processing complete" } }
|
|
@@ -107,18 +108,45 @@ function createAgentsHono(config) {
|
|
|
107
108
|
});
|
|
108
109
|
});
|
|
109
110
|
app.use("/manage/tenants/*", async (c, next) => {
|
|
110
|
-
if (
|
|
111
|
+
if (isTestEnvironment()) {
|
|
111
112
|
await next();
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
114
115
|
if (c.req.header("Authorization")?.startsWith("Bearer ")) return manageApiKeyAuth()(c, next);
|
|
115
116
|
return sessionAuth()(c, next);
|
|
116
117
|
});
|
|
117
|
-
|
|
118
|
+
app.use("/manage/capabilities", async (c, next) => {
|
|
119
|
+
if (!auth || isTestEnvironment()) {
|
|
120
|
+
await next();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (c.req.header("Authorization")?.startsWith("Bearer ")) return manageApiKeyAuth()(c, next);
|
|
124
|
+
return sessionAuth()(c, next);
|
|
125
|
+
});
|
|
126
|
+
app.openapi(createRoute({
|
|
127
|
+
method: "get",
|
|
128
|
+
path: "/manage/capabilities",
|
|
129
|
+
operationId: "capabilities",
|
|
130
|
+
summary: "Get server capabilities",
|
|
131
|
+
description: "Get information about optional server-side capabilities and configuration.",
|
|
132
|
+
responses: { 200: {
|
|
133
|
+
description: "Server capabilities",
|
|
134
|
+
content: { "application/json": { schema: CapabilitiesResponseSchema } }
|
|
135
|
+
} }
|
|
136
|
+
}), (c) => {
|
|
137
|
+
if (!sandboxConfig) return c.json({ sandbox: { configured: false } });
|
|
138
|
+
return c.json({ sandbox: {
|
|
139
|
+
configured: true,
|
|
140
|
+
provider: sandboxConfig.provider,
|
|
141
|
+
runtime: sandboxConfig.runtime
|
|
142
|
+
} });
|
|
143
|
+
});
|
|
144
|
+
if (isTestEnvironment()) app.use("/manage/tenants/:tenantId/*", async (c, next) => {
|
|
118
145
|
const tenantId = c.req.param("tenantId");
|
|
119
146
|
if (tenantId) {
|
|
120
147
|
c.set("tenantId", tenantId);
|
|
121
148
|
c.set("userId", "anonymous");
|
|
149
|
+
c.set("tenantRole", OrgRoles.OWNER);
|
|
122
150
|
}
|
|
123
151
|
await next();
|
|
124
152
|
});
|
|
@@ -156,6 +184,8 @@ function createAgentsHono(config) {
|
|
|
156
184
|
return fetch(forwardedRequest);
|
|
157
185
|
});
|
|
158
186
|
app.route("/evals", evalRoutes);
|
|
187
|
+
app.route("/work-apps/github", githubRoutes);
|
|
188
|
+
app.route("/mcp", mcp_default);
|
|
159
189
|
setupOpenAPIRoutes(app);
|
|
160
190
|
app.use("/run/*", async (_c, next) => {
|
|
161
191
|
await next();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region src/domains/evals/api/.well-known/workflow/v1/flow.ts
|
|
4
|
+
console.log("[WF CONSUMER] flow.ts loaded", (/* @__PURE__ */ new Date()).toISOString());
|
|
5
|
+
const flowModule = createRequire(import.meta.url)("../../../../dist/.well-known/workflow/v1/flow.cjs");
|
|
6
|
+
async function handler(req) {
|
|
7
|
+
console.log("[WF CONSUMER HIT] flow.ts", (/* @__PURE__ */ new Date()).toISOString(), req.method, req.url);
|
|
8
|
+
return flowModule.default(req);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { handler as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region src/domains/evals/api/.well-known/workflow/v1/step.ts
|
|
4
|
+
console.log("[WF CONSUMER] step.ts loaded", (/* @__PURE__ */ new Date()).toISOString());
|
|
5
|
+
const stepModule = createRequire(import.meta.url)("../../../../dist/.well-known/workflow/v1/step.cjs");
|
|
6
|
+
async function handler(req) {
|
|
7
|
+
console.log("[WF CONSUMER HIT] step.ts", (/* @__PURE__ */ new Date()).toISOString(), req.method, req.url);
|
|
8
|
+
return stepModule.default(req);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { handler as default };
|
|
@@ -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/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono17.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono0 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono0.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -5,7 +5,7 @@ import { StandaloneBuilder } from "@workflow/builders";
|
|
|
5
5
|
* Custom workflow build script that supports externalizing native modules.
|
|
6
6
|
*
|
|
7
7
|
* The default `workflow build` CLI doesn't expose the externalPackages option,
|
|
8
|
-
* so we use the builder directly to exclude native modules like
|
|
8
|
+
* so we use the builder directly to exclude native modules like @napi-rs/keyring.
|
|
9
9
|
*/
|
|
10
10
|
const config = {
|
|
11
11
|
dirs: ["./src/domains/evals/workflow"],
|
|
@@ -14,7 +14,7 @@ const config = {
|
|
|
14
14
|
stepsBundlePath: "./.well-known/workflow/v1/step.cjs",
|
|
15
15
|
workflowsBundlePath: "./.well-known/workflow/v1/flow.cjs",
|
|
16
16
|
webhookBundlePath: "./.well-known/workflow/v1/webhook.mjs",
|
|
17
|
-
externalPackages: ["
|
|
17
|
+
externalPackages: ["@napi-rs/keyring"]
|
|
18
18
|
};
|
|
19
19
|
async function build() {
|
|
20
20
|
console.log("Building workflow bundles...");
|
|
@@ -11,8 +11,9 @@ import { createVercelWorld } from "@workflow/world-vercel";
|
|
|
11
11
|
* Vercel's NFT can't trace dynamic imports in bundled code.
|
|
12
12
|
*
|
|
13
13
|
* Set WORKFLOW_TARGET_WORLD to: 'local' | 'vercel' | '@workflow/world-postgres'
|
|
14
|
+
* Defaults to 'local' for development if not set.
|
|
14
15
|
*/
|
|
15
|
-
const targetWorld = env.WORKFLOW_TARGET_WORLD;
|
|
16
|
+
const targetWorld = env.WORKFLOW_TARGET_WORLD || "local";
|
|
16
17
|
let world;
|
|
17
18
|
if (targetWorld === "vercel") {
|
|
18
19
|
const token = process.env.WORKFLOW_VERCEL_AUTH_TOKEN;
|
|
@@ -30,7 +31,7 @@ if (targetWorld === "vercel") {
|
|
|
30
31
|
jobPrefix: env.WORKFLOW_POSTGRES_JOB_PREFIX,
|
|
31
32
|
queueConcurrency: Number(env.WORKFLOW_POSTGRES_WORKER_CONCURRENCY) || 10
|
|
32
33
|
});
|
|
33
|
-
else
|
|
34
|
+
else world = createLocalWorld();
|
|
34
35
|
|
|
35
36
|
//#endregion
|
|
36
37
|
export { world };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import cliAuth_default from "./routes/cliAuth.js";
|
|
2
|
-
import
|
|
2
|
+
import github_default from "./routes/github.js";
|
|
3
3
|
import routes_default from "./routes/index.js";
|
|
4
4
|
import invitations_default from "./routes/invitations.js";
|
|
5
5
|
import mcp_default from "./routes/mcp.js";
|
|
6
|
+
import mcpToolGithubAccess_default from "./routes/mcpToolGithubAccess.js";
|
|
6
7
|
import oauth_default from "./routes/oauth.js";
|
|
7
8
|
import playgroundToken_default from "./routes/playgroundToken.js";
|
|
8
9
|
import projectFull_default from "./routes/projectFull.js";
|
|
10
|
+
import projectGithubAccess_default from "./routes/projectGithubAccess.js";
|
|
9
11
|
import signoz_default from "./routes/signoz.js";
|
|
10
12
|
import userOrganizations_default from "./routes/userOrganizations.js";
|
|
11
13
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
@@ -19,8 +21,10 @@ function createManageRoutes() {
|
|
|
19
21
|
app.route("/tenants/:tenantId", routes_default);
|
|
20
22
|
app.route("/tenants/:tenantId/playground/token", playgroundToken_default);
|
|
21
23
|
app.route("/tenants/:tenantId/signoz", signoz_default);
|
|
24
|
+
app.route("/tenants/:tenantId/github", github_default);
|
|
25
|
+
app.route("/tenants/:tenantId/projects/:projectId/github-access", projectGithubAccess_default);
|
|
26
|
+
app.route("/tenants/:tenantId/projects/:projectId/tools/:toolId/github-access", mcpToolGithubAccess_default);
|
|
22
27
|
app.route("/tenants/:tenantId", projectFull_default);
|
|
23
|
-
app.route("/tenants/:tenantId/projects/:projectId/evals", evals_default);
|
|
24
28
|
app.route("/oauth", oauth_default);
|
|
25
29
|
app.route("/mcp", mcp_default);
|
|
26
30
|
return app;
|
|
@@ -11,8 +11,11 @@ app.use("/", async (c, next) => {
|
|
|
11
11
|
return next();
|
|
12
12
|
});
|
|
13
13
|
app.use("/:id", async (c, next) => {
|
|
14
|
-
if (
|
|
15
|
-
|
|
14
|
+
if ([
|
|
15
|
+
"PUT",
|
|
16
|
+
"PATCH",
|
|
17
|
+
"DELETE"
|
|
18
|
+
].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
|
|
16
19
|
return next();
|
|
17
20
|
});
|
|
18
21
|
app.openapi(createRoute({
|
|
@@ -82,7 +85,7 @@ app.openapi(createRoute({
|
|
|
82
85
|
path: "/{agentId}/sub-agents/{subAgentId}/related",
|
|
83
86
|
summary: "Get Related Agent Infos",
|
|
84
87
|
operationId: "get-related-agent-infos",
|
|
85
|
-
tags: ["
|
|
88
|
+
tags: ["Agents"],
|
|
86
89
|
request: { params: TenantProjectAgentSubAgentParamsSchema },
|
|
87
90
|
responses: {
|
|
88
91
|
200: {
|
|
@@ -116,7 +119,7 @@ app.openapi(createRoute({
|
|
|
116
119
|
path: "/{agentId}/full",
|
|
117
120
|
summary: "Get Full Agent Definition",
|
|
118
121
|
operationId: "get-full-agent-definition",
|
|
119
|
-
tags: ["
|
|
122
|
+
tags: ["Agents"],
|
|
120
123
|
request: { params: TenantProjectAgentParamsSchema },
|
|
121
124
|
responses: {
|
|
122
125
|
200: {
|
|
@@ -12,8 +12,11 @@ app.use("/", async (c, next) => {
|
|
|
12
12
|
return next();
|
|
13
13
|
});
|
|
14
14
|
app.use("/:agentId", async (c, next) => {
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
if ([
|
|
16
|
+
"PUT",
|
|
17
|
+
"PATCH",
|
|
18
|
+
"DELETE"
|
|
19
|
+
].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
|
|
17
20
|
return next();
|
|
18
21
|
});
|
|
19
22
|
app.openapi(createRoute({
|
|
@@ -21,7 +24,7 @@ app.openapi(createRoute({
|
|
|
21
24
|
path: "/",
|
|
22
25
|
summary: "Create Full Agent",
|
|
23
26
|
operationId: "create-full-agent",
|
|
24
|
-
tags: ["
|
|
27
|
+
tags: ["Agents"],
|
|
25
28
|
description: "Create a complete agent with all agents, tools, and relationships from JSON definition",
|
|
26
29
|
request: {
|
|
27
30
|
params: TenantProjectParamsSchema,
|
|
@@ -54,7 +57,7 @@ app.openapi(createRoute({
|
|
|
54
57
|
path: "/{agentId}",
|
|
55
58
|
summary: "Get Full Agent",
|
|
56
59
|
operationId: "get-full-agent",
|
|
57
|
-
tags: ["
|
|
60
|
+
tags: ["Agents"],
|
|
58
61
|
description: "Retrieve a complete agent definition with all agents, tools, and relationships",
|
|
59
62
|
request: { params: TenantProjectAgentParamsSchema },
|
|
60
63
|
responses: {
|
|
@@ -94,7 +97,7 @@ app.openapi(createRoute({
|
|
|
94
97
|
path: "/{agentId}",
|
|
95
98
|
summary: "Update Full Agent",
|
|
96
99
|
operationId: "update-full-agent",
|
|
97
|
-
tags: ["
|
|
100
|
+
tags: ["Agents"],
|
|
98
101
|
description: "Update or create a complete agent with all agents, tools, and relationships from JSON definition",
|
|
99
102
|
request: {
|
|
100
103
|
params: TenantProjectAgentParamsSchema,
|
|
@@ -155,7 +158,7 @@ app.openapi(createRoute({
|
|
|
155
158
|
path: "/{agentId}",
|
|
156
159
|
summary: "Delete Full Agent",
|
|
157
160
|
operationId: "delete-full-agent",
|
|
158
|
-
tags: ["
|
|
161
|
+
tags: ["Agents"],
|
|
159
162
|
description: "Delete a complete agent and cascade to all related entities (relationships, not other agents/tools)",
|
|
160
163
|
request: { params: TenantProjectAgentParamsSchema },
|
|
161
164
|
responses: {
|
|
@@ -11,8 +11,7 @@ app.use("/", async (c, next) => {
|
|
|
11
11
|
return next();
|
|
12
12
|
});
|
|
13
13
|
app.use("/:id", async (c, next) => {
|
|
14
|
-
if (c.req.method === "
|
|
15
|
-
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
14
|
+
if (c.req.method === "PUT" || c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
16
15
|
return next();
|
|
17
16
|
});
|
|
18
17
|
app.openapi(createRoute({
|
|
@@ -19,7 +19,7 @@ app.openapi(createRoute({
|
|
|
19
19
|
path: "/",
|
|
20
20
|
summary: "List Artifact Components",
|
|
21
21
|
operationId: "list-artifact-components",
|
|
22
|
-
tags: ["Artifact
|
|
22
|
+
tags: ["Artifact Components"],
|
|
23
23
|
request: {
|
|
24
24
|
params: TenantProjectParamsSchema,
|
|
25
25
|
query: PaginationQueryParamsSchema
|
|
@@ -54,7 +54,7 @@ app.openapi(createRoute({
|
|
|
54
54
|
path: "/{id}",
|
|
55
55
|
summary: "Get Artifact Component",
|
|
56
56
|
operationId: "get-artifact-component-by-id",
|
|
57
|
-
tags: ["Artifact
|
|
57
|
+
tags: ["Artifact Components"],
|
|
58
58
|
request: { params: TenantProjectIdParamsSchema },
|
|
59
59
|
responses: {
|
|
60
60
|
200: {
|
|
@@ -84,7 +84,7 @@ app.openapi(createRoute({
|
|
|
84
84
|
path: "/",
|
|
85
85
|
summary: "Create Artifact Component",
|
|
86
86
|
operationId: "create-artifact-component",
|
|
87
|
-
tags: ["Artifact
|
|
87
|
+
tags: ["Artifact Components"],
|
|
88
88
|
request: {
|
|
89
89
|
params: TenantProjectParamsSchema,
|
|
90
90
|
body: { content: { "application/json": { schema: ArtifactComponentApiInsertSchema } } }
|
|
@@ -133,7 +133,7 @@ app.openapi(createRoute({
|
|
|
133
133
|
path: "/{id}",
|
|
134
134
|
summary: "Update Artifact Component",
|
|
135
135
|
operationId: "update-artifact-component",
|
|
136
|
-
tags: ["Artifact
|
|
136
|
+
tags: ["Artifact Components"],
|
|
137
137
|
request: {
|
|
138
138
|
params: TenantProjectIdParamsSchema,
|
|
139
139
|
body: { content: { "application/json": { schema: ArtifactComponentApiUpdateSchema } } }
|
|
@@ -180,7 +180,7 @@ app.openapi(createRoute({
|
|
|
180
180
|
path: "/{id}",
|
|
181
181
|
summary: "Delete Artifact Component",
|
|
182
182
|
operationId: "delete-artifact-component",
|
|
183
|
-
tags: ["Artifact
|
|
183
|
+
tags: ["Artifact Components"],
|
|
184
184
|
request: { params: TenantProjectIdParamsSchema },
|
|
185
185
|
responses: {
|
|
186
186
|
204: { description: "Artifact component deleted successfully" },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
2
2
|
import { sessionAuth } from "../../../middleware/sessionAuth.js";
|
|
3
3
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
4
|
-
import {
|
|
4
|
+
import { getUserOrganizationsFromDb } from "@inkeep/agents-core";
|
|
5
5
|
|
|
6
6
|
//#region src/domains/manage/routes/cliAuth.ts
|
|
7
7
|
const cliAuthRoutes = new OpenAPIHono();
|
|
@@ -21,7 +21,7 @@ const CLIMeResponseSchema = z.object({
|
|
|
21
21
|
cliAuthRoutes.openapi(createRoute({
|
|
22
22
|
method: "get",
|
|
23
23
|
path: "/me",
|
|
24
|
-
tags: ["
|
|
24
|
+
tags: ["CLI"],
|
|
25
25
|
summary: "Get CLI user info",
|
|
26
26
|
description: "Get the current authenticated user and their organization for CLI usage",
|
|
27
27
|
middleware: [sessionAuth()],
|
|
@@ -37,7 +37,7 @@ cliAuthRoutes.openapi(createRoute({
|
|
|
37
37
|
const user = c.get("user");
|
|
38
38
|
const userId = c.get("userId");
|
|
39
39
|
if (!user || !userId) return c.json({ error: "Not authenticated" }, 401);
|
|
40
|
-
const organizations = await
|
|
40
|
+
const organizations = await getUserOrganizationsFromDb(runDbClient_default)(userId);
|
|
41
41
|
if (organizations.length === 0) return c.json({ error: "User has no organization" }, 404);
|
|
42
42
|
const org = organizations[0];
|
|
43
43
|
return c.json({
|
|
@@ -20,7 +20,7 @@ app.openapi(createRoute({
|
|
|
20
20
|
path: "/",
|
|
21
21
|
summary: "List Context Configurations",
|
|
22
22
|
operationId: "list-context-configs",
|
|
23
|
-
tags: ["Context
|
|
23
|
+
tags: ["Context Configs"],
|
|
24
24
|
request: {
|
|
25
25
|
params: TenantProjectAgentParamsSchema,
|
|
26
26
|
query: PaginationQueryParamsSchema
|
|
@@ -56,7 +56,7 @@ app.openapi(createRoute({
|
|
|
56
56
|
path: "/{id}",
|
|
57
57
|
summary: "Get Context Configuration",
|
|
58
58
|
operationId: "get-context-config-by-id",
|
|
59
|
-
tags: ["Context
|
|
59
|
+
tags: ["Context Configs"],
|
|
60
60
|
request: { params: TenantProjectAgentIdParamsSchema },
|
|
61
61
|
responses: {
|
|
62
62
|
200: {
|
|
@@ -87,7 +87,7 @@ app.openapi(createRoute({
|
|
|
87
87
|
path: "/",
|
|
88
88
|
summary: "Create Context Configuration",
|
|
89
89
|
operationId: "create-context-config",
|
|
90
|
-
tags: ["Context
|
|
90
|
+
tags: ["Context Configs"],
|
|
91
91
|
request: {
|
|
92
92
|
params: TenantProjectAgentParamsSchema,
|
|
93
93
|
body: { content: { "application/json": { schema: ContextConfigApiInsertSchema } } }
|
|
@@ -116,7 +116,7 @@ app.openapi(createRoute({
|
|
|
116
116
|
path: "/{id}",
|
|
117
117
|
summary: "Update Context Configuration",
|
|
118
118
|
operationId: "update-context-config",
|
|
119
|
-
tags: ["Context
|
|
119
|
+
tags: ["Context Configs"],
|
|
120
120
|
request: {
|
|
121
121
|
params: TenantProjectAgentIdParamsSchema,
|
|
122
122
|
body: { content: { "application/json": { schema: ContextConfigApiUpdateSchema } } }
|
|
@@ -152,7 +152,7 @@ app.openapi(createRoute({
|
|
|
152
152
|
path: "/{id}",
|
|
153
153
|
summary: "Delete Context Configuration",
|
|
154
154
|
operationId: "delete-context-config",
|
|
155
|
-
tags: ["Context
|
|
155
|
+
tags: ["Context Configs"],
|
|
156
156
|
request: { params: TenantProjectAgentIdParamsSchema },
|
|
157
157
|
responses: {
|
|
158
158
|
204: { description: "Context configuration deleted successfully" },
|
|
@@ -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/domains/manage/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono7.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -13,7 +13,7 @@ app.openapi(createRoute({
|
|
|
13
13
|
path: "/",
|
|
14
14
|
summary: "List Credential Stores",
|
|
15
15
|
operationId: "list-credential-stores",
|
|
16
|
-
tags: ["Credential
|
|
16
|
+
tags: ["Credential Stores"],
|
|
17
17
|
request: { params: TenantProjectParamsSchema },
|
|
18
18
|
responses: {
|
|
19
19
|
200: {
|
|
@@ -40,7 +40,7 @@ app.openapi(createRoute({
|
|
|
40
40
|
path: "/{id}/credentials",
|
|
41
41
|
summary: "Create Credential in Store",
|
|
42
42
|
operationId: "create-credential-in-store",
|
|
43
|
-
tags: ["Credential
|
|
43
|
+
tags: ["Credential Stores"],
|
|
44
44
|
request: {
|
|
45
45
|
params: TenantProjectIdParamsSchema,
|
|
46
46
|
body: { content: { "application/json": { schema: CreateCredentialInStoreRequestSchema } } }
|
|
@@ -10,8 +10,7 @@ app.use("/", async (c, next) => {
|
|
|
10
10
|
return next();
|
|
11
11
|
});
|
|
12
12
|
app.use("/:id", async (c, next) => {
|
|
13
|
-
if (c.req.method === "PATCH") return requireProjectPermission("edit")(c, next);
|
|
14
|
-
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
13
|
+
if (c.req.method === "PATCH" || c.req.method === "DELETE" || c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
|
|
15
14
|
return next();
|
|
16
15
|
});
|
|
17
16
|
app.openapi(createRoute({
|
|
@@ -19,7 +18,7 @@ app.openapi(createRoute({
|
|
|
19
18
|
path: "/",
|
|
20
19
|
summary: "List Credentials",
|
|
21
20
|
operationId: "list-credentials",
|
|
22
|
-
tags: ["
|
|
21
|
+
tags: ["Credentials"],
|
|
23
22
|
request: {
|
|
24
23
|
params: TenantProjectParamsSchema,
|
|
25
24
|
query: PaginationQueryParamsSchema
|
|
@@ -55,7 +54,7 @@ app.openapi(createRoute({
|
|
|
55
54
|
path: "/{id}",
|
|
56
55
|
summary: "Get Credential",
|
|
57
56
|
operationId: "get-credential-by-id",
|
|
58
|
-
tags: ["
|
|
57
|
+
tags: ["Credentials"],
|
|
59
58
|
request: { params: TenantProjectIdParamsSchema },
|
|
60
59
|
responses: {
|
|
61
60
|
200: {
|
|
@@ -85,7 +84,7 @@ app.openapi(createRoute({
|
|
|
85
84
|
path: "/",
|
|
86
85
|
summary: "Create Credential",
|
|
87
86
|
operationId: "create-credential",
|
|
88
|
-
tags: ["
|
|
87
|
+
tags: ["Credentials"],
|
|
89
88
|
request: {
|
|
90
89
|
params: TenantProjectParamsSchema,
|
|
91
90
|
body: { content: { "application/json": { schema: CredentialReferenceApiInsertSchema } } }
|
|
@@ -114,7 +113,7 @@ app.openapi(createRoute({
|
|
|
114
113
|
path: "/{id}",
|
|
115
114
|
summary: "Update Credential",
|
|
116
115
|
operationId: "update-credential",
|
|
117
|
-
tags: ["
|
|
116
|
+
tags: ["Credentials"],
|
|
118
117
|
request: {
|
|
119
118
|
params: TenantProjectIdParamsSchema,
|
|
120
119
|
body: { content: { "application/json": { schema: CredentialReferenceApiUpdateSchema } } }
|
|
@@ -150,7 +149,7 @@ app.openapi(createRoute({
|
|
|
150
149
|
path: "/{id}",
|
|
151
150
|
summary: "Delete Credential",
|
|
152
151
|
operationId: "delete-credential",
|
|
153
|
-
tags: ["
|
|
152
|
+
tags: ["Credentials"],
|
|
154
153
|
request: { params: TenantProjectIdParamsSchema },
|
|
155
154
|
responses: {
|
|
156
155
|
204: { description: "Credential deleted successfully" },
|
|
@@ -10,8 +10,7 @@ app.use("/", async (c, next) => {
|
|
|
10
10
|
return next();
|
|
11
11
|
});
|
|
12
12
|
app.use("/:id", async (c, next) => {
|
|
13
|
-
if (c.req.method === "
|
|
14
|
-
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
13
|
+
if (c.req.method === "PUT" || c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
15
14
|
return next();
|
|
16
15
|
});
|
|
17
16
|
app.openapi(createRoute({
|
|
@@ -19,7 +18,7 @@ app.openapi(createRoute({
|
|
|
19
18
|
path: "/",
|
|
20
19
|
summary: "List Data Components",
|
|
21
20
|
operationId: "list-data-components",
|
|
22
|
-
tags: ["Data
|
|
21
|
+
tags: ["Data Components"],
|
|
23
22
|
request: {
|
|
24
23
|
params: TenantProjectParamsSchema,
|
|
25
24
|
query: PaginationQueryParamsSchema
|
|
@@ -54,7 +53,7 @@ app.openapi(createRoute({
|
|
|
54
53
|
path: "/{id}",
|
|
55
54
|
summary: "Get Data Component",
|
|
56
55
|
operationId: "get-data-component-by-id",
|
|
57
|
-
tags: ["Data
|
|
56
|
+
tags: ["Data Components"],
|
|
58
57
|
request: { params: TenantProjectIdParamsSchema },
|
|
59
58
|
responses: {
|
|
60
59
|
200: {
|
|
@@ -84,7 +83,7 @@ app.openapi(createRoute({
|
|
|
84
83
|
path: "/",
|
|
85
84
|
summary: "Create Data Component",
|
|
86
85
|
operationId: "create-data-component",
|
|
87
|
-
tags: ["Data
|
|
86
|
+
tags: ["Data Components"],
|
|
88
87
|
request: {
|
|
89
88
|
params: TenantProjectParamsSchema,
|
|
90
89
|
body: { content: { "application/json": { schema: DataComponentApiInsertSchema } } }
|
|
@@ -120,7 +119,7 @@ app.openapi(createRoute({
|
|
|
120
119
|
path: "/{id}",
|
|
121
120
|
summary: "Update Data Component",
|
|
122
121
|
operationId: "update-data-component",
|
|
123
|
-
tags: ["Data
|
|
122
|
+
tags: ["Data Components"],
|
|
124
123
|
request: {
|
|
125
124
|
params: TenantProjectIdParamsSchema,
|
|
126
125
|
body: { content: { "application/json": { schema: DataComponentApiUpdateSchema } } }
|
|
@@ -162,7 +161,7 @@ app.openapi(createRoute({
|
|
|
162
161
|
path: "/{id}",
|
|
163
162
|
summary: "Delete Data Component",
|
|
164
163
|
operationId: "delete-data-component",
|
|
165
|
-
tags: ["Data
|
|
164
|
+
tags: ["Data Components"],
|
|
166
165
|
request: { params: TenantProjectIdParamsSchema },
|
|
167
166
|
responses: {
|
|
168
167
|
204: { description: "Data component deleted successfully" },
|
|
@@ -10,8 +10,7 @@ app.use("/", async (c, next) => {
|
|
|
10
10
|
return next();
|
|
11
11
|
});
|
|
12
12
|
app.use("/:id", async (c, next) => {
|
|
13
|
-
if (c.req.method === "
|
|
14
|
-
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
13
|
+
if (c.req.method === "PUT" || c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
15
14
|
return next();
|
|
16
15
|
});
|
|
17
16
|
app.openapi(createRoute({
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
3
|
+
|
|
4
|
+
//#region src/domains/manage/routes/github.d.ts
|
|
5
|
+
declare const app: OpenAPIHono<{
|
|
6
|
+
Variables: ManageAppVariables;
|
|
7
|
+
}, {}, "/">;
|
|
8
|
+
declare const STATE_JWT_ISSUER = "inkeep-agents-api";
|
|
9
|
+
declare const STATE_JWT_AUDIENCE = "github-app-install";
|
|
10
|
+
/**
|
|
11
|
+
* Signs a JWT state token for the GitHub App installation flow.
|
|
12
|
+
* The state contains the tenantId and expires after 10 minutes.
|
|
13
|
+
*/
|
|
14
|
+
declare function signStateToken(tenantId: string): Promise<string>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { STATE_JWT_AUDIENCE, STATE_JWT_ISSUER, app as default, signStateToken };
|