@inkeep/agents-manage-api 0.0.0-dev-20260120175022 → 0.0.0-dev-20260120221941
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/data/db/dbClient.d.ts +2 -2
- package/dist/data/db/runDbClient.d.ts +2 -2
- package/dist/env.d.ts +2 -0
- package/dist/env.js +1 -0
- package/dist/index.d.ts +18 -18
- package/dist/middleware/require-permission.d.ts +2 -2
- package/dist/middleware/session-auth.d.ts +2 -2
- package/dist/middleware/tenant-access.d.ts +2 -2
- package/dist/routes/evals/evaluationJobConfigs.js +10 -1
- package/dist/routes/evals/evaluationResults.d.ts +2 -2
- package/dist/routes/index.js +2 -0
- package/dist/routes/mcp.d.ts +2 -2
- package/dist/routes/signoz.d.ts +2 -2
- package/dist/routes/triggers.d.ts +9 -0
- package/dist/routes/triggers.js +423 -0
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core1 from "@inkeep/agents-core";
|
|
2
2
|
|
|
3
3
|
//#region src/data/db/dbClient.d.ts
|
|
4
|
-
declare const manageDbClient:
|
|
4
|
+
declare const manageDbClient: _inkeep_agents_core1.AgentsManageDatabaseClient;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { manageDbClient as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core0 from "@inkeep/agents-core";
|
|
2
2
|
|
|
3
3
|
//#region src/data/db/runDbClient.d.ts
|
|
4
|
-
declare const runDbClient:
|
|
4
|
+
declare const runDbClient: _inkeep_agents_core0.AgentsRunDatabaseClient;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { runDbClient as default };
|
package/dist/env.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare const envSchema: z.ZodObject<{
|
|
|
16
16
|
INKEEP_AGENTS_MANAGE_API_URL: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
17
17
|
INKEEP_AGENTS_MANAGE_UI_URL: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
18
18
|
INKEEP_AGENTS_EVAL_API_URL: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
19
|
+
INKEEP_AGENTS_RUN_API_URL: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
19
20
|
INKEEP_AGENTS_MANAGE_DATABASE_URL: z.ZodOptional<z.ZodString>;
|
|
20
21
|
INKEEP_AGENTS_RUN_DATABASE_URL: z.ZodOptional<z.ZodString>;
|
|
21
22
|
LOG_LEVEL: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
@@ -42,6 +43,7 @@ declare const env: {
|
|
|
42
43
|
INKEEP_AGENTS_MANAGE_API_URL: string;
|
|
43
44
|
INKEEP_AGENTS_MANAGE_UI_URL: string;
|
|
44
45
|
INKEEP_AGENTS_EVAL_API_URL: string;
|
|
46
|
+
INKEEP_AGENTS_RUN_API_URL: string;
|
|
45
47
|
LOG_LEVEL: "trace" | "debug" | "info" | "warn" | "error";
|
|
46
48
|
NANGO_SERVER_URL: string;
|
|
47
49
|
TENANT_ID: string;
|
package/dist/env.js
CHANGED
|
@@ -18,6 +18,7 @@ const envSchema = z.object({
|
|
|
18
18
|
INKEEP_AGENTS_MANAGE_API_URL: z.string().optional().default("http://localhost:3002"),
|
|
19
19
|
INKEEP_AGENTS_MANAGE_UI_URL: z.string().optional().default("http://localhost:3000"),
|
|
20
20
|
INKEEP_AGENTS_EVAL_API_URL: z.string().optional().default("http://localhost:3005"),
|
|
21
|
+
INKEEP_AGENTS_RUN_API_URL: z.string().optional().default("http://localhost:8080"),
|
|
21
22
|
INKEEP_AGENTS_MANAGE_DATABASE_URL: z.string().optional(),
|
|
22
23
|
INKEEP_AGENTS_RUN_DATABASE_URL: z.string().optional(),
|
|
23
24
|
LOG_LEVEL: z.enum([
|
package/dist/index.d.ts
CHANGED
|
@@ -785,25 +785,25 @@ declare const auth: better_auth0.Auth<{
|
|
|
785
785
|
ac: better_auth_plugins0.AccessControl;
|
|
786
786
|
roles: {
|
|
787
787
|
member: {
|
|
788
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
789
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
788
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
|
|
789
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
|
|
790
790
|
connector: "OR" | "AND";
|
|
791
791
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
792
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
792
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
|
|
793
793
|
};
|
|
794
794
|
admin: {
|
|
795
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
796
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
795
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
|
|
796
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
|
|
797
797
|
connector: "OR" | "AND";
|
|
798
798
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
799
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
799
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
|
|
800
800
|
};
|
|
801
801
|
owner: {
|
|
802
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
803
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
802
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
|
|
803
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
|
|
804
804
|
connector: "OR" | "AND";
|
|
805
805
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
806
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
806
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
|
|
807
807
|
};
|
|
808
808
|
};
|
|
809
809
|
membershipLimit: number;
|
|
@@ -1094,25 +1094,25 @@ declare const auth: better_auth0.Auth<{
|
|
|
1094
1094
|
ac: better_auth_plugins0.AccessControl;
|
|
1095
1095
|
roles: {
|
|
1096
1096
|
member: {
|
|
1097
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
1098
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1097
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
|
|
1098
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
|
|
1099
1099
|
connector: "OR" | "AND";
|
|
1100
1100
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1101
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1101
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
|
|
1102
1102
|
};
|
|
1103
1103
|
admin: {
|
|
1104
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
1105
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1104
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
|
|
1105
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
|
|
1106
1106
|
connector: "OR" | "AND";
|
|
1107
1107
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1108
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1108
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
|
|
1109
1109
|
};
|
|
1110
1110
|
owner: {
|
|
1111
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
1112
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1111
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
|
|
1112
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
|
|
1113
1113
|
connector: "OR" | "AND";
|
|
1114
1114
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1115
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1115
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
|
|
1116
1116
|
};
|
|
1117
1117
|
};
|
|
1118
1118
|
membershipLimit: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseAppVariables } from "../types/app.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono2 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/require-permission.d.ts
|
|
5
5
|
type Permission = {
|
|
@@ -9,6 +9,6 @@ declare const requirePermission: <Env$1 extends {
|
|
|
9
9
|
Variables: BaseAppVariables;
|
|
10
10
|
} = {
|
|
11
11
|
Variables: BaseAppVariables;
|
|
12
|
-
}>(permissions: Permission) =>
|
|
12
|
+
}>(permissions: Permission) => hono2.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { requirePermission };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono3 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/session-auth.d.ts
|
|
4
|
-
declare const sessionAuth: () =>
|
|
4
|
+
declare const sessionAuth: () => hono3.MiddlewareHandler<any, string, {}, Response>;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { sessionAuth };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono4 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tenant-access.d.ts
|
|
4
|
-
declare const requireTenantAccess: () =>
|
|
4
|
+
declare const requireTenantAccess: () => hono4.MiddlewareHandler<{
|
|
5
5
|
Variables: {
|
|
6
6
|
userId: string;
|
|
7
7
|
tenantId: string;
|
|
@@ -7,6 +7,15 @@ import { EvalApiClient, EvaluationJobConfigApiInsertSchema, EvaluationJobConfigA
|
|
|
7
7
|
//#region src/routes/evals/evaluationJobConfigs.ts
|
|
8
8
|
const app = new OpenAPIHono();
|
|
9
9
|
const logger = getLogger$1("evaluationJobConfigs");
|
|
10
|
+
/**
|
|
11
|
+
* Extract plain filter criteria from a potential Filter wrapper.
|
|
12
|
+
* Returns null if the filter is a complex and/or combinator.
|
|
13
|
+
*/
|
|
14
|
+
function getPlainJobFilters(filter) {
|
|
15
|
+
if (!filter) return null;
|
|
16
|
+
if ("and" in filter || "or" in filter) return null;
|
|
17
|
+
return filter;
|
|
18
|
+
}
|
|
10
19
|
app.openapi(createRoute({
|
|
11
20
|
method: "get",
|
|
12
21
|
path: "/",
|
|
@@ -144,7 +153,7 @@ app.openapi(createRoute({
|
|
|
144
153
|
}).triggerEvaluationJob({
|
|
145
154
|
evaluationJobConfigId: id,
|
|
146
155
|
evaluatorIds,
|
|
147
|
-
jobFilters: created.jobFilters
|
|
156
|
+
jobFilters: getPlainJobFilters(created.jobFilters)
|
|
148
157
|
}).then((result) => {
|
|
149
158
|
logger.info({
|
|
150
159
|
tenantId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono7 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/routes/evals/evaluationResults.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono7.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
package/dist/routes/index.js
CHANGED
|
@@ -27,6 +27,7 @@ import subAgentTeamAgentRelations_default from "./subAgentTeamAgentRelations.js"
|
|
|
27
27
|
import subAgentToolRelations_default from "./subAgentToolRelations.js";
|
|
28
28
|
import thirdPartyMCPServers_default from "./thirdPartyMCPServers.js";
|
|
29
29
|
import tools_default from "./tools.js";
|
|
30
|
+
import triggers_default from "./triggers.js";
|
|
30
31
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
31
32
|
|
|
32
33
|
//#region src/routes/index.ts
|
|
@@ -60,6 +61,7 @@ app.route("/projects/:projectId/api-keys", apiKeys_default);
|
|
|
60
61
|
app.route("/projects/:projectId/agent", agentFull_default);
|
|
61
62
|
app.route("/projects/:projectId/mcp-catalog", mcpCatalog_default);
|
|
62
63
|
app.route("/projects/:projectId/third-party-mcp-servers", thirdPartyMCPServers_default);
|
|
64
|
+
app.route("/projects/:projectId/agents/:agentId/triggers", triggers_default);
|
|
63
65
|
var routes_default = app;
|
|
64
66
|
|
|
65
67
|
//#endregion
|
package/dist/routes/mcp.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types3 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/routes/mcp.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
package/dist/routes/signoz.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BaseAppVariables } 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/routes/signoz.d.ts
|
|
6
6
|
declare const app: Hono<{
|
|
7
7
|
Variables: BaseAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types5.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { app as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseAppVariables } from "../types/app.js";
|
|
2
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
3
|
+
|
|
4
|
+
//#region src/routes/triggers.d.ts
|
|
5
|
+
declare const app: OpenAPIHono<{
|
|
6
|
+
Variables: BaseAppVariables;
|
|
7
|
+
}, {}, "/">;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { app as default };
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { env } from "../env.js";
|
|
2
|
+
import { getLogger as getLogger$1 } from "../logger.js";
|
|
3
|
+
import runDbClient_default from "../data/db/runDbClient.js";
|
|
4
|
+
import { speakeasyOffsetLimitPagination } from "./shared.js";
|
|
5
|
+
import { requirePermission } from "../middleware/require-permission.js";
|
|
6
|
+
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
7
|
+
import { PaginationQueryParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TriggerApiInsertSchema, TriggerApiSelectSchema, TriggerApiUpdateSchema, TriggerInvocationListResponse, TriggerInvocationResponse, TriggerInvocationStatusEnum, commonGetErrorResponses, createApiError, createTrigger, deleteTrigger, generateId, getTriggerById, getTriggerInvocationById, listTriggerInvocationsPaginated, listTriggersPaginated, updateTrigger } from "@inkeep/agents-core";
|
|
8
|
+
|
|
9
|
+
//#region src/routes/triggers.ts
|
|
10
|
+
const logger = getLogger$1("triggers");
|
|
11
|
+
const app = new OpenAPIHono();
|
|
12
|
+
const TriggerResponse = z.object({ data: TriggerApiSelectSchema.extend({ webhookUrl: z.string().describe("Fully qualified webhook URL for this trigger") }) });
|
|
13
|
+
const TriggerListResponse = z.object({
|
|
14
|
+
data: z.array(TriggerApiSelectSchema.extend({ webhookUrl: z.string().describe("Fully qualified webhook URL for this trigger") })),
|
|
15
|
+
pagination: z.object({
|
|
16
|
+
page: z.number(),
|
|
17
|
+
limit: z.number(),
|
|
18
|
+
total: z.number(),
|
|
19
|
+
pages: z.number()
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
app.use("/", async (c, next) => {
|
|
23
|
+
if (c.req.method === "POST") return requirePermission({ trigger: ["create"] })(c, next);
|
|
24
|
+
return next();
|
|
25
|
+
});
|
|
26
|
+
app.use("/:id", async (c, next) => {
|
|
27
|
+
if (c.req.method === "PATCH") return requirePermission({ trigger: ["update"] })(c, next);
|
|
28
|
+
if (c.req.method === "DELETE") return requirePermission({ trigger: ["delete"] })(c, next);
|
|
29
|
+
return next();
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Generate webhook URL for a trigger
|
|
33
|
+
*/
|
|
34
|
+
function generateWebhookUrl(params) {
|
|
35
|
+
const { baseUrl, tenantId, projectId, agentId, triggerId } = params;
|
|
36
|
+
return `${baseUrl}/tenants/${tenantId}/projects/${projectId}/agents/${agentId}/triggers/${triggerId}`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* List Triggers for an Agent
|
|
40
|
+
*/
|
|
41
|
+
app.openapi(createRoute({
|
|
42
|
+
method: "get",
|
|
43
|
+
path: "/",
|
|
44
|
+
summary: "List Triggers",
|
|
45
|
+
operationId: "list-triggers",
|
|
46
|
+
tags: ["Triggers"],
|
|
47
|
+
request: {
|
|
48
|
+
params: TenantProjectAgentParamsSchema,
|
|
49
|
+
query: PaginationQueryParamsSchema
|
|
50
|
+
},
|
|
51
|
+
responses: {
|
|
52
|
+
200: {
|
|
53
|
+
description: "List of triggers retrieved successfully",
|
|
54
|
+
content: { "application/json": { schema: TriggerListResponse } }
|
|
55
|
+
},
|
|
56
|
+
...commonGetErrorResponses
|
|
57
|
+
},
|
|
58
|
+
...speakeasyOffsetLimitPagination
|
|
59
|
+
}), async (c) => {
|
|
60
|
+
const db = c.get("db");
|
|
61
|
+
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
62
|
+
const { page, limit } = c.req.valid("query");
|
|
63
|
+
const runApiBaseUrl = env.INKEEP_AGENTS_RUN_API_URL;
|
|
64
|
+
const result = await listTriggersPaginated(db)({
|
|
65
|
+
scopes: {
|
|
66
|
+
tenantId,
|
|
67
|
+
projectId,
|
|
68
|
+
agentId
|
|
69
|
+
},
|
|
70
|
+
pagination: {
|
|
71
|
+
page,
|
|
72
|
+
limit
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const dataWithWebhookUrl = result.data.map((trigger) => {
|
|
76
|
+
const { tenantId: _tid, projectId: _pid, agentId: _aid, ...triggerWithoutScopes } = trigger;
|
|
77
|
+
return {
|
|
78
|
+
...triggerWithoutScopes,
|
|
79
|
+
webhookUrl: generateWebhookUrl({
|
|
80
|
+
baseUrl: runApiBaseUrl,
|
|
81
|
+
tenantId,
|
|
82
|
+
projectId,
|
|
83
|
+
agentId,
|
|
84
|
+
triggerId: trigger.id
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
return c.json({
|
|
89
|
+
data: dataWithWebhookUrl,
|
|
90
|
+
pagination: result.pagination
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* Get Trigger by ID
|
|
95
|
+
*/
|
|
96
|
+
app.openapi(createRoute({
|
|
97
|
+
method: "get",
|
|
98
|
+
path: "/{id}",
|
|
99
|
+
summary: "Get Trigger",
|
|
100
|
+
operationId: "get-trigger-by-id",
|
|
101
|
+
tags: ["Triggers"],
|
|
102
|
+
request: { params: TenantProjectAgentIdParamsSchema },
|
|
103
|
+
responses: {
|
|
104
|
+
200: {
|
|
105
|
+
description: "Trigger found",
|
|
106
|
+
content: { "application/json": { schema: TriggerResponse } }
|
|
107
|
+
},
|
|
108
|
+
...commonGetErrorResponses
|
|
109
|
+
}
|
|
110
|
+
}), async (c) => {
|
|
111
|
+
const db = c.get("db");
|
|
112
|
+
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
113
|
+
const runApiBaseUrl = env.INKEEP_AGENTS_RUN_API_URL;
|
|
114
|
+
const trigger = await getTriggerById(db)({
|
|
115
|
+
scopes: {
|
|
116
|
+
tenantId,
|
|
117
|
+
projectId,
|
|
118
|
+
agentId
|
|
119
|
+
},
|
|
120
|
+
triggerId: id
|
|
121
|
+
});
|
|
122
|
+
if (!trigger) throw createApiError({
|
|
123
|
+
code: "not_found",
|
|
124
|
+
message: "Trigger not found"
|
|
125
|
+
});
|
|
126
|
+
const { tenantId: _tid, projectId: _pid, agentId: _aid, ...triggerWithoutScopes } = trigger;
|
|
127
|
+
return c.json({ data: {
|
|
128
|
+
...triggerWithoutScopes,
|
|
129
|
+
webhookUrl: generateWebhookUrl({
|
|
130
|
+
baseUrl: runApiBaseUrl,
|
|
131
|
+
tenantId,
|
|
132
|
+
projectId,
|
|
133
|
+
agentId,
|
|
134
|
+
triggerId: trigger.id
|
|
135
|
+
})
|
|
136
|
+
} });
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* Create Trigger
|
|
140
|
+
*/
|
|
141
|
+
app.openapi(createRoute({
|
|
142
|
+
method: "post",
|
|
143
|
+
path: "/",
|
|
144
|
+
summary: "Create Trigger",
|
|
145
|
+
operationId: "create-trigger",
|
|
146
|
+
tags: ["Triggers"],
|
|
147
|
+
request: {
|
|
148
|
+
params: TenantProjectAgentParamsSchema,
|
|
149
|
+
body: { content: { "application/json": { schema: TriggerApiInsertSchema } } }
|
|
150
|
+
},
|
|
151
|
+
responses: {
|
|
152
|
+
201: {
|
|
153
|
+
description: "Trigger created successfully",
|
|
154
|
+
content: { "application/json": { schema: TriggerResponse } }
|
|
155
|
+
},
|
|
156
|
+
...commonGetErrorResponses
|
|
157
|
+
}
|
|
158
|
+
}), async (c) => {
|
|
159
|
+
const db = c.get("db");
|
|
160
|
+
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
161
|
+
const body = c.req.valid("json");
|
|
162
|
+
const runApiBaseUrl = env.INKEEP_AGENTS_RUN_API_URL;
|
|
163
|
+
const id = body.id || generateId();
|
|
164
|
+
logger.info({
|
|
165
|
+
tenantId,
|
|
166
|
+
projectId,
|
|
167
|
+
agentId,
|
|
168
|
+
triggerId: id
|
|
169
|
+
}, "Creating trigger");
|
|
170
|
+
const trigger = await createTrigger(db)({
|
|
171
|
+
id,
|
|
172
|
+
tenantId,
|
|
173
|
+
projectId,
|
|
174
|
+
agentId,
|
|
175
|
+
name: body.name,
|
|
176
|
+
description: body.description,
|
|
177
|
+
enabled: body.enabled !== void 0 ? body.enabled : true,
|
|
178
|
+
inputSchema: body.inputSchema,
|
|
179
|
+
outputTransform: body.outputTransform,
|
|
180
|
+
messageTemplate: body.messageTemplate,
|
|
181
|
+
authentication: body.authentication,
|
|
182
|
+
signingSecret: body.signingSecret
|
|
183
|
+
});
|
|
184
|
+
const { tenantId: _tid, projectId: _pid, agentId: _aid, ...triggerWithoutScopes } = trigger;
|
|
185
|
+
return c.json({ data: {
|
|
186
|
+
...triggerWithoutScopes,
|
|
187
|
+
webhookUrl: generateWebhookUrl({
|
|
188
|
+
baseUrl: runApiBaseUrl,
|
|
189
|
+
tenantId,
|
|
190
|
+
projectId,
|
|
191
|
+
agentId,
|
|
192
|
+
triggerId: trigger.id
|
|
193
|
+
})
|
|
194
|
+
} }, 201);
|
|
195
|
+
});
|
|
196
|
+
/**
|
|
197
|
+
* Update Trigger
|
|
198
|
+
*/
|
|
199
|
+
app.openapi(createRoute({
|
|
200
|
+
method: "patch",
|
|
201
|
+
path: "/{id}",
|
|
202
|
+
summary: "Update Trigger",
|
|
203
|
+
operationId: "update-trigger",
|
|
204
|
+
tags: ["Triggers"],
|
|
205
|
+
request: {
|
|
206
|
+
params: TenantProjectAgentIdParamsSchema,
|
|
207
|
+
body: { content: { "application/json": { schema: TriggerApiUpdateSchema } } }
|
|
208
|
+
},
|
|
209
|
+
responses: {
|
|
210
|
+
200: {
|
|
211
|
+
description: "Trigger updated successfully",
|
|
212
|
+
content: { "application/json": { schema: TriggerResponse } }
|
|
213
|
+
},
|
|
214
|
+
...commonGetErrorResponses
|
|
215
|
+
}
|
|
216
|
+
}), async (c) => {
|
|
217
|
+
const db = c.get("db");
|
|
218
|
+
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
219
|
+
const body = c.req.valid("json");
|
|
220
|
+
const runApiBaseUrl = env.INKEEP_AGENTS_RUN_API_URL;
|
|
221
|
+
if (!(body.name !== void 0 || body.description !== void 0 || body.enabled !== void 0 || body.inputSchema !== void 0 || body.outputTransform !== void 0 || body.messageTemplate !== void 0 || body.authentication !== void 0 || body.signingSecret !== void 0)) throw createApiError({
|
|
222
|
+
code: "bad_request",
|
|
223
|
+
message: "No fields to update"
|
|
224
|
+
});
|
|
225
|
+
logger.info({
|
|
226
|
+
tenantId,
|
|
227
|
+
projectId,
|
|
228
|
+
agentId,
|
|
229
|
+
triggerId: id
|
|
230
|
+
}, "Updating trigger");
|
|
231
|
+
const updatedTrigger = await updateTrigger(db)({
|
|
232
|
+
scopes: {
|
|
233
|
+
tenantId,
|
|
234
|
+
projectId,
|
|
235
|
+
agentId
|
|
236
|
+
},
|
|
237
|
+
triggerId: id,
|
|
238
|
+
data: {
|
|
239
|
+
name: body.name,
|
|
240
|
+
description: body.description,
|
|
241
|
+
enabled: body.enabled,
|
|
242
|
+
inputSchema: body.inputSchema,
|
|
243
|
+
outputTransform: body.outputTransform,
|
|
244
|
+
messageTemplate: body.messageTemplate,
|
|
245
|
+
authentication: body.authentication,
|
|
246
|
+
signingSecret: body.signingSecret
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
if (!updatedTrigger) throw createApiError({
|
|
250
|
+
code: "not_found",
|
|
251
|
+
message: "Trigger not found"
|
|
252
|
+
});
|
|
253
|
+
const { tenantId: _tid, projectId: _pid, agentId: _aid, ...triggerWithoutScopes } = updatedTrigger;
|
|
254
|
+
return c.json({ data: {
|
|
255
|
+
...triggerWithoutScopes,
|
|
256
|
+
webhookUrl: generateWebhookUrl({
|
|
257
|
+
baseUrl: runApiBaseUrl,
|
|
258
|
+
tenantId,
|
|
259
|
+
projectId,
|
|
260
|
+
agentId,
|
|
261
|
+
triggerId: updatedTrigger.id
|
|
262
|
+
})
|
|
263
|
+
} });
|
|
264
|
+
});
|
|
265
|
+
/**
|
|
266
|
+
* Delete Trigger
|
|
267
|
+
*/
|
|
268
|
+
app.openapi(createRoute({
|
|
269
|
+
method: "delete",
|
|
270
|
+
path: "/{id}",
|
|
271
|
+
summary: "Delete Trigger",
|
|
272
|
+
operationId: "delete-trigger",
|
|
273
|
+
tags: ["Triggers"],
|
|
274
|
+
request: { params: TenantProjectAgentIdParamsSchema },
|
|
275
|
+
responses: {
|
|
276
|
+
204: { description: "Trigger deleted successfully" },
|
|
277
|
+
...commonGetErrorResponses
|
|
278
|
+
}
|
|
279
|
+
}), async (c) => {
|
|
280
|
+
const db = c.get("db");
|
|
281
|
+
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
282
|
+
logger.info({
|
|
283
|
+
tenantId,
|
|
284
|
+
projectId,
|
|
285
|
+
agentId,
|
|
286
|
+
triggerId: id
|
|
287
|
+
}, "Deleting trigger");
|
|
288
|
+
if (!await getTriggerById(db)({
|
|
289
|
+
scopes: {
|
|
290
|
+
tenantId,
|
|
291
|
+
projectId,
|
|
292
|
+
agentId
|
|
293
|
+
},
|
|
294
|
+
triggerId: id
|
|
295
|
+
})) throw createApiError({
|
|
296
|
+
code: "not_found",
|
|
297
|
+
message: "Trigger not found"
|
|
298
|
+
});
|
|
299
|
+
await deleteTrigger(db)({
|
|
300
|
+
scopes: {
|
|
301
|
+
tenantId,
|
|
302
|
+
projectId,
|
|
303
|
+
agentId
|
|
304
|
+
},
|
|
305
|
+
triggerId: id
|
|
306
|
+
});
|
|
307
|
+
return c.body(null, 204);
|
|
308
|
+
});
|
|
309
|
+
/**
|
|
310
|
+
* ========================================
|
|
311
|
+
* Trigger Invocation Endpoints
|
|
312
|
+
* ========================================
|
|
313
|
+
*/
|
|
314
|
+
const TriggerInvocationQueryParamsSchema = PaginationQueryParamsSchema.extend({
|
|
315
|
+
status: TriggerInvocationStatusEnum.optional().openapi({ description: "Filter by invocation status" }),
|
|
316
|
+
from: z.string().datetime().optional().openapi({ description: "Start date for filtering (ISO8601)" }),
|
|
317
|
+
to: z.string().datetime().optional().openapi({ description: "End date for filtering (ISO8601)" })
|
|
318
|
+
}).openapi("TriggerInvocationQueryParams");
|
|
319
|
+
/**
|
|
320
|
+
* List Trigger Invocations
|
|
321
|
+
*/
|
|
322
|
+
app.openapi(createRoute({
|
|
323
|
+
method: "get",
|
|
324
|
+
path: "/{id}/invocations",
|
|
325
|
+
summary: "List Trigger Invocations",
|
|
326
|
+
operationId: "list-trigger-invocations",
|
|
327
|
+
tags: ["Triggers"],
|
|
328
|
+
request: {
|
|
329
|
+
params: TenantProjectAgentIdParamsSchema,
|
|
330
|
+
query: TriggerInvocationQueryParamsSchema
|
|
331
|
+
},
|
|
332
|
+
responses: {
|
|
333
|
+
200: {
|
|
334
|
+
description: "List of trigger invocations retrieved successfully",
|
|
335
|
+
content: { "application/json": { schema: TriggerInvocationListResponse } }
|
|
336
|
+
},
|
|
337
|
+
...commonGetErrorResponses
|
|
338
|
+
},
|
|
339
|
+
...speakeasyOffsetLimitPagination
|
|
340
|
+
}), async (c) => {
|
|
341
|
+
const { tenantId, projectId, agentId, id: triggerId } = c.req.valid("param");
|
|
342
|
+
const { page, limit, status, from, to } = c.req.valid("query");
|
|
343
|
+
logger.info({
|
|
344
|
+
tenantId,
|
|
345
|
+
projectId,
|
|
346
|
+
agentId,
|
|
347
|
+
triggerId,
|
|
348
|
+
status,
|
|
349
|
+
from,
|
|
350
|
+
to
|
|
351
|
+
}, "Listing trigger invocations");
|
|
352
|
+
const result = await listTriggerInvocationsPaginated(runDbClient_default)({
|
|
353
|
+
scopes: {
|
|
354
|
+
tenantId,
|
|
355
|
+
projectId,
|
|
356
|
+
agentId
|
|
357
|
+
},
|
|
358
|
+
triggerId,
|
|
359
|
+
pagination: {
|
|
360
|
+
page,
|
|
361
|
+
limit
|
|
362
|
+
},
|
|
363
|
+
filters: {
|
|
364
|
+
status,
|
|
365
|
+
from,
|
|
366
|
+
to
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
const dataWithoutScopes = result.data.map((invocation) => {
|
|
370
|
+
const { tenantId: _tid, projectId: _pid, agentId: _aid, ...rest } = invocation;
|
|
371
|
+
return rest;
|
|
372
|
+
});
|
|
373
|
+
return c.json({
|
|
374
|
+
data: dataWithoutScopes,
|
|
375
|
+
pagination: result.pagination
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
/**
|
|
379
|
+
* Get Trigger Invocation by ID
|
|
380
|
+
*/
|
|
381
|
+
app.openapi(createRoute({
|
|
382
|
+
method: "get",
|
|
383
|
+
path: "/{id}/invocations/{invocationId}",
|
|
384
|
+
summary: "Get Trigger Invocation",
|
|
385
|
+
operationId: "get-trigger-invocation-by-id",
|
|
386
|
+
tags: ["Triggers"],
|
|
387
|
+
request: { params: TenantProjectAgentIdParamsSchema.extend({ invocationId: z.string().describe("Trigger Invocation ID") }) },
|
|
388
|
+
responses: {
|
|
389
|
+
200: {
|
|
390
|
+
description: "Trigger invocation found",
|
|
391
|
+
content: { "application/json": { schema: TriggerInvocationResponse } }
|
|
392
|
+
},
|
|
393
|
+
...commonGetErrorResponses
|
|
394
|
+
}
|
|
395
|
+
}), async (c) => {
|
|
396
|
+
const { tenantId, projectId, agentId, id: triggerId, invocationId } = c.req.valid("param");
|
|
397
|
+
logger.info({
|
|
398
|
+
tenantId,
|
|
399
|
+
projectId,
|
|
400
|
+
agentId,
|
|
401
|
+
triggerId,
|
|
402
|
+
invocationId
|
|
403
|
+
}, "Getting trigger invocation");
|
|
404
|
+
const invocation = await getTriggerInvocationById(runDbClient_default)({
|
|
405
|
+
scopes: {
|
|
406
|
+
tenantId,
|
|
407
|
+
projectId,
|
|
408
|
+
agentId
|
|
409
|
+
},
|
|
410
|
+
triggerId,
|
|
411
|
+
invocationId
|
|
412
|
+
});
|
|
413
|
+
if (!invocation) throw createApiError({
|
|
414
|
+
code: "not_found",
|
|
415
|
+
message: "Trigger invocation not found"
|
|
416
|
+
});
|
|
417
|
+
const { tenantId: _tid, projectId: _pid, agentId: _aid, ...invocationWithoutScopes } = invocation;
|
|
418
|
+
return c.json({ data: invocationWithoutScopes });
|
|
419
|
+
});
|
|
420
|
+
var triggers_default = app;
|
|
421
|
+
|
|
422
|
+
//#endregion
|
|
423
|
+
export { triggers_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-manage-api",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260120221941",
|
|
4
4
|
"description": "Agents Manage API for Inkeep Agent Framework - handles CRUD operations and OAuth",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"openid-client": "^6.6.4",
|
|
30
30
|
"pg": "^8.16.3",
|
|
31
31
|
"pino": "^9.7.0",
|
|
32
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
33
|
-
"@inkeep/agents-manage-mcp": "^0.0.0-dev-
|
|
32
|
+
"@inkeep/agents-core": "^0.0.0-dev-20260120221941",
|
|
33
|
+
"@inkeep/agents-manage-mcp": "^0.0.0-dev-20260120221941"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@hono/zod-openapi": "^1.1.5",
|