@inkeep/agents-api 0.0.0-dev-20260123080829 → 0.0.0-dev-20260123091222
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 +15 -15
- package/dist/.well-known/workflow/v1/step.cjs +43161 -43016
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/triggers.js +49 -24
- package/dist/domains/run/routes/webhooks.js +4 -0
- package/dist/domains/run/services/TriggerService.d.ts +1 -1
- package/dist/domains/run/services/TriggerService.js +111 -11
- package/dist/domains/run/tools/NativeSandboxExecutor.js +0 -2
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectAccess.d.ts +2 -2
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/package.json +3 -3
|
@@ -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/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono16.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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono3 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono3.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 hono17 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono17.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -4,21 +4,11 @@ import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
|
4
4
|
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
5
5
|
import { speakeasyOffsetLimitPagination } from "../../../utils/speakeasy.js";
|
|
6
6
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
7
|
-
import { PaginationQueryParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TriggerApiInsertSchema,
|
|
7
|
+
import { PaginationQueryParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TriggerApiInsertSchema, TriggerApiUpdateSchema, TriggerInvocationListResponse, TriggerInvocationResponse, TriggerInvocationStatusEnum, TriggerWithWebhookUrlListResponse, TriggerWithWebhookUrlResponse, commonGetErrorResponses, createApiError, createTrigger, deleteTrigger, generateId, getCredentialReference, getTriggerById, getTriggerInvocationById, hashAuthenticationHeaders, listTriggerInvocationsPaginated, listTriggersPaginated, updateTrigger } from "@inkeep/agents-core";
|
|
8
8
|
|
|
9
9
|
//#region src/domains/manage/routes/triggers.ts
|
|
10
10
|
const logger = getLogger$1("triggers");
|
|
11
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
12
|
app.use("/", async (c, next) => {
|
|
23
13
|
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
24
14
|
return next();
|
|
@@ -51,7 +41,7 @@ app.openapi(createRoute({
|
|
|
51
41
|
responses: {
|
|
52
42
|
200: {
|
|
53
43
|
description: "List of triggers retrieved successfully",
|
|
54
|
-
content: { "application/json": { schema:
|
|
44
|
+
content: { "application/json": { schema: TriggerWithWebhookUrlListResponse } }
|
|
55
45
|
},
|
|
56
46
|
...commonGetErrorResponses
|
|
57
47
|
},
|
|
@@ -103,7 +93,7 @@ app.openapi(createRoute({
|
|
|
103
93
|
responses: {
|
|
104
94
|
200: {
|
|
105
95
|
description: "Trigger found",
|
|
106
|
-
content: { "application/json": { schema:
|
|
96
|
+
content: { "application/json": { schema: TriggerWithWebhookUrlResponse } }
|
|
107
97
|
},
|
|
108
98
|
...commonGetErrorResponses
|
|
109
99
|
}
|
|
@@ -151,7 +141,7 @@ app.openapi(createRoute({
|
|
|
151
141
|
responses: {
|
|
152
142
|
201: {
|
|
153
143
|
description: "Trigger created successfully",
|
|
154
|
-
content: { "application/json": { schema:
|
|
144
|
+
content: { "application/json": { schema: TriggerWithWebhookUrlResponse } }
|
|
155
145
|
},
|
|
156
146
|
...commonGetErrorResponses
|
|
157
147
|
}
|
|
@@ -161,12 +151,29 @@ app.openapi(createRoute({
|
|
|
161
151
|
const body = c.req.valid("json");
|
|
162
152
|
const apiBaseUrl = env.INKEEP_AGENTS_API_URL;
|
|
163
153
|
const id = body.id || generateId();
|
|
164
|
-
logger.
|
|
154
|
+
logger.debug({
|
|
165
155
|
tenantId,
|
|
166
156
|
projectId,
|
|
167
157
|
agentId,
|
|
168
158
|
triggerId: id
|
|
169
159
|
}, "Creating trigger");
|
|
160
|
+
if (body.signingSecretCredentialReferenceId) {
|
|
161
|
+
const credentialRef = await getCredentialReference(db)({
|
|
162
|
+
scopes: {
|
|
163
|
+
tenantId,
|
|
164
|
+
projectId
|
|
165
|
+
},
|
|
166
|
+
id: body.signingSecretCredentialReferenceId
|
|
167
|
+
});
|
|
168
|
+
if (!credentialRef) throw createApiError({
|
|
169
|
+
code: "bad_request",
|
|
170
|
+
message: `Credential reference not found: ${body.signingSecretCredentialReferenceId}`
|
|
171
|
+
});
|
|
172
|
+
if (credentialRef.userId) throw createApiError({
|
|
173
|
+
code: "bad_request",
|
|
174
|
+
message: "Only project-scoped credentials can be attached to triggers. User-scoped credentials are not allowed."
|
|
175
|
+
});
|
|
176
|
+
}
|
|
170
177
|
let hashedAuthentication;
|
|
171
178
|
const authInput = body.authentication;
|
|
172
179
|
if (authInput?.headers && authInput.headers.length > 0) hashedAuthentication = { headers: await hashAuthenticationHeaders(authInput.headers) };
|
|
@@ -182,7 +189,8 @@ app.openapi(createRoute({
|
|
|
182
189
|
outputTransform: body.outputTransform,
|
|
183
190
|
messageTemplate: body.messageTemplate,
|
|
184
191
|
authentication: hashedAuthentication,
|
|
185
|
-
|
|
192
|
+
signingSecretCredentialReferenceId: body.signingSecretCredentialReferenceId,
|
|
193
|
+
signatureVerification: body.signatureVerification
|
|
186
194
|
});
|
|
187
195
|
const { tenantId: _tid, projectId: _pid, agentId: _aid, ...triggerWithoutScopes } = trigger;
|
|
188
196
|
return c.json({ data: {
|
|
@@ -212,7 +220,7 @@ app.openapi(createRoute({
|
|
|
212
220
|
responses: {
|
|
213
221
|
200: {
|
|
214
222
|
description: "Trigger updated successfully",
|
|
215
|
-
content: { "application/json": { schema:
|
|
223
|
+
content: { "application/json": { schema: TriggerWithWebhookUrlResponse } }
|
|
216
224
|
},
|
|
217
225
|
...commonGetErrorResponses
|
|
218
226
|
}
|
|
@@ -221,16 +229,33 @@ app.openapi(createRoute({
|
|
|
221
229
|
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
222
230
|
const body = c.req.valid("json");
|
|
223
231
|
const apiBaseUrl = env.INKEEP_AGENTS_API_URL;
|
|
224
|
-
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.
|
|
232
|
+
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.signingSecretCredentialReferenceId !== void 0 || body.signatureVerification !== void 0)) throw createApiError({
|
|
225
233
|
code: "bad_request",
|
|
226
234
|
message: "No fields to update"
|
|
227
235
|
});
|
|
228
|
-
logger.
|
|
236
|
+
logger.debug({
|
|
229
237
|
tenantId,
|
|
230
238
|
projectId,
|
|
231
239
|
agentId,
|
|
232
240
|
triggerId: id
|
|
233
241
|
}, "Updating trigger");
|
|
242
|
+
if (body.signingSecretCredentialReferenceId) {
|
|
243
|
+
const credentialRef = await getCredentialReference(db)({
|
|
244
|
+
scopes: {
|
|
245
|
+
tenantId,
|
|
246
|
+
projectId
|
|
247
|
+
},
|
|
248
|
+
id: body.signingSecretCredentialReferenceId
|
|
249
|
+
});
|
|
250
|
+
if (!credentialRef) throw createApiError({
|
|
251
|
+
code: "bad_request",
|
|
252
|
+
message: `Credential reference not found: ${body.signingSecretCredentialReferenceId}`
|
|
253
|
+
});
|
|
254
|
+
if (credentialRef.userId) throw createApiError({
|
|
255
|
+
code: "bad_request",
|
|
256
|
+
message: "Only project-scoped credentials can be attached to triggers. User-scoped credentials are not allowed."
|
|
257
|
+
});
|
|
258
|
+
}
|
|
234
259
|
let hashedAuthentication;
|
|
235
260
|
const authInput = body.authentication;
|
|
236
261
|
if (authInput?.headers && authInput.headers.length > 0) {
|
|
@@ -259,7 +284,6 @@ app.openapi(createRoute({
|
|
|
259
284
|
}
|
|
260
285
|
hashedAuthentication = hashedHeaders.length > 0 ? { headers: hashedHeaders } : void 0;
|
|
261
286
|
} else if (body.authentication !== void 0) hashedAuthentication = body.authentication;
|
|
262
|
-
const signingSecretUpdate = body.keepExistingSigningSecret ? void 0 : body.signingSecret;
|
|
263
287
|
const updatedTrigger = await updateTrigger(db)({
|
|
264
288
|
scopes: {
|
|
265
289
|
tenantId,
|
|
@@ -275,7 +299,8 @@ app.openapi(createRoute({
|
|
|
275
299
|
outputTransform: body.outputTransform,
|
|
276
300
|
messageTemplate: body.messageTemplate,
|
|
277
301
|
authentication: hashedAuthentication,
|
|
278
|
-
|
|
302
|
+
signingSecretCredentialReferenceId: body.signingSecretCredentialReferenceId,
|
|
303
|
+
signatureVerification: body.signatureVerification
|
|
279
304
|
}
|
|
280
305
|
});
|
|
281
306
|
if (!updatedTrigger) throw createApiError({
|
|
@@ -311,7 +336,7 @@ app.openapi(createRoute({
|
|
|
311
336
|
}), async (c) => {
|
|
312
337
|
const db = c.get("db");
|
|
313
338
|
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
314
|
-
logger.
|
|
339
|
+
logger.debug({
|
|
315
340
|
tenantId,
|
|
316
341
|
projectId,
|
|
317
342
|
agentId,
|
|
@@ -372,7 +397,7 @@ app.openapi(createRoute({
|
|
|
372
397
|
}), async (c) => {
|
|
373
398
|
const { tenantId, projectId, agentId, id: triggerId } = c.req.valid("param");
|
|
374
399
|
const { page, limit, status, from, to } = c.req.valid("query");
|
|
375
|
-
logger.
|
|
400
|
+
logger.debug({
|
|
376
401
|
tenantId,
|
|
377
402
|
projectId,
|
|
378
403
|
agentId,
|
|
@@ -426,7 +451,7 @@ app.openapi(createRoute({
|
|
|
426
451
|
}
|
|
427
452
|
}), async (c) => {
|
|
428
453
|
const { tenantId, projectId, agentId, id: triggerId, invocationId } = c.req.valid("param");
|
|
429
|
-
logger.
|
|
454
|
+
logger.debug({
|
|
430
455
|
tenantId,
|
|
431
456
|
projectId,
|
|
432
457
|
agentId,
|
|
@@ -55,6 +55,10 @@ const triggerWebhookRoute = createRoute({
|
|
|
55
55
|
422: {
|
|
56
56
|
description: "Payload transformation failed",
|
|
57
57
|
content: { "application/json": { schema: z.object({ error: z.string() }) } }
|
|
58
|
+
},
|
|
59
|
+
500: {
|
|
60
|
+
description: "Internal server error",
|
|
61
|
+
content: { "application/json": { schema: z.object({ error: z.string() }) } }
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
});
|
|
@@ -4,13 +4,15 @@ import manageDbPool_default from "../../../data/db/manageDbPool.js";
|
|
|
4
4
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
5
5
|
import { createSSEStreamHelper } from "../utils/stream-helpers.js";
|
|
6
6
|
import { ExecutionHandler } from "../handlers/executionHandler.js";
|
|
7
|
-
import { JsonTransformer, createMessage, createOrGetConversation, createTriggerInvocation, generateId, getConversationId, getFullProjectWithRelationIds, getTriggerById, interpolateTemplate, setActiveAgentForConversation, updateTriggerInvocationStatus,
|
|
7
|
+
import { JsonTransformer, createKeyChainStore, createMessage, createOrGetConversation, createTriggerInvocation, generateId, getConversationId, getCredentialReference, getCredentialStoreLookupKeyFromRetrievalParams, getFullProjectWithRelationIds, getTriggerById, interpolateTemplate, setActiveAgentForConversation, updateTriggerInvocationStatus, verifySignatureWithConfig, verifyTriggerAuth, withRef } from "@inkeep/agents-core";
|
|
8
8
|
import { ROOT_CONTEXT, SpanStatusCode, propagation, trace } from "@opentelemetry/api";
|
|
9
9
|
import Ajv from "ajv";
|
|
10
10
|
|
|
11
11
|
//#region src/domains/run/services/TriggerService.ts
|
|
12
12
|
const logger = getLogger$1("TriggerService");
|
|
13
13
|
const ajv = new Ajv({ allErrors: true });
|
|
14
|
+
const credentialCache = /* @__PURE__ */ new Map();
|
|
15
|
+
const CACHE_TTL_MS = 300 * 1e3;
|
|
14
16
|
/**
|
|
15
17
|
* Process a trigger webhook request.
|
|
16
18
|
* Handles validation, transformation, and dispatches async execution.
|
|
@@ -37,7 +39,14 @@ async function processWebhook(params) {
|
|
|
37
39
|
const payload = rawBody ? JSON.parse(rawBody) : {};
|
|
38
40
|
const authResult = await verifyAuthentication(trigger, honoContext);
|
|
39
41
|
if (!authResult.success) return authResult;
|
|
40
|
-
const signatureResult = verifySignature(
|
|
42
|
+
const signatureResult = await verifySignature({
|
|
43
|
+
trigger,
|
|
44
|
+
tenantId,
|
|
45
|
+
projectId,
|
|
46
|
+
resolvedRef,
|
|
47
|
+
honoContext,
|
|
48
|
+
rawBody
|
|
49
|
+
});
|
|
41
50
|
if (!signatureResult.success) return signatureResult;
|
|
42
51
|
const validationResult = validatePayload(trigger, payload);
|
|
43
52
|
if (!validationResult.success) return validationResult;
|
|
@@ -94,15 +103,106 @@ async function verifyAuthentication(trigger, honoContext) {
|
|
|
94
103
|
}
|
|
95
104
|
return { success: true };
|
|
96
105
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Resolve signing secret from credential reference with caching
|
|
108
|
+
*/
|
|
109
|
+
async function resolveSigningSecret(params) {
|
|
110
|
+
const { tenantId, projectId, credentialReferenceId, resolvedRef } = params;
|
|
111
|
+
const cacheKey = `${tenantId}:${projectId}:${credentialReferenceId}`;
|
|
112
|
+
const cached = credentialCache.get(cacheKey);
|
|
113
|
+
if (cached && cached.expiresAt > Date.now()) return cached.secret;
|
|
114
|
+
const credentialRef = await withRef(manageDbPool_default, resolvedRef, (db) => getCredentialReference(db)({
|
|
115
|
+
scopes: {
|
|
116
|
+
tenantId,
|
|
117
|
+
projectId
|
|
118
|
+
},
|
|
119
|
+
id: credentialReferenceId
|
|
120
|
+
}));
|
|
121
|
+
if (!credentialRef) {
|
|
122
|
+
logger.warn({
|
|
123
|
+
tenantId,
|
|
124
|
+
projectId,
|
|
125
|
+
credentialReferenceId
|
|
126
|
+
}, "Credential reference not found");
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const lookupKey = getCredentialStoreLookupKeyFromRetrievalParams({
|
|
130
|
+
retrievalParams: credentialRef.retrievalParams ?? {},
|
|
131
|
+
credentialStoreType: credentialRef.type
|
|
132
|
+
});
|
|
133
|
+
if (!lookupKey) {
|
|
134
|
+
logger.warn({
|
|
135
|
+
tenantId,
|
|
136
|
+
projectId,
|
|
137
|
+
credentialReferenceId,
|
|
138
|
+
retrievalParams: credentialRef.retrievalParams
|
|
139
|
+
}, "Could not determine lookup key from credential reference");
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
let secret = null;
|
|
143
|
+
if (credentialRef.type === "keychain" || credentialRef.credentialStoreId?.startsWith("keychain")) secret = await createKeyChainStore(credentialRef.credentialStoreId ?? "keychain-default").get(lookupKey);
|
|
144
|
+
else {
|
|
145
|
+
logger.warn({
|
|
146
|
+
credentialStoreType: credentialRef.type,
|
|
147
|
+
credentialStoreId: credentialRef.credentialStoreId
|
|
148
|
+
}, "Unsupported credential store type for signing secret");
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
if (!secret) {
|
|
152
|
+
logger.warn({
|
|
153
|
+
tenantId,
|
|
154
|
+
projectId,
|
|
155
|
+
credentialReferenceId,
|
|
156
|
+
lookupKey
|
|
157
|
+
}, "No secret found in credential store");
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
if (secret.startsWith("{")) try {
|
|
161
|
+
const parsed = JSON.parse(secret);
|
|
162
|
+
const extractedSecret = parsed.access_token || parsed.secret || parsed.value || parsed.token || parsed.key;
|
|
163
|
+
if (extractedSecret && typeof extractedSecret === "string") secret = extractedSecret;
|
|
164
|
+
} catch {}
|
|
165
|
+
credentialCache.set(cacheKey, {
|
|
166
|
+
secret,
|
|
167
|
+
expiresAt: Date.now() + CACHE_TTL_MS
|
|
168
|
+
});
|
|
169
|
+
return secret;
|
|
170
|
+
}
|
|
171
|
+
async function verifySignature(params) {
|
|
172
|
+
const { trigger, tenantId, projectId, resolvedRef, honoContext, rawBody } = params;
|
|
173
|
+
if (!trigger.signatureVerification || !trigger.signingSecretCredentialReferenceId) return { success: true };
|
|
174
|
+
try {
|
|
175
|
+
const secret = await resolveSigningSecret({
|
|
176
|
+
tenantId,
|
|
177
|
+
projectId,
|
|
178
|
+
credentialReferenceId: trigger.signingSecretCredentialReferenceId,
|
|
179
|
+
resolvedRef
|
|
180
|
+
});
|
|
181
|
+
if (!secret) return {
|
|
182
|
+
success: false,
|
|
183
|
+
error: "Failed to resolve signing secret from credential reference",
|
|
184
|
+
status: 500
|
|
185
|
+
};
|
|
186
|
+
const result = verifySignatureWithConfig(honoContext, trigger.signatureVerification, secret, rawBody);
|
|
187
|
+
if (!result.success) return {
|
|
188
|
+
success: false,
|
|
189
|
+
error: result.message || "Invalid signature",
|
|
190
|
+
status: 403
|
|
191
|
+
};
|
|
192
|
+
return { success: true };
|
|
193
|
+
} catch (error) {
|
|
194
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
195
|
+
logger.error({
|
|
196
|
+
error: errorMessage,
|
|
197
|
+
tenantId,
|
|
198
|
+
projectId
|
|
199
|
+
}, "Error during signature verification");
|
|
200
|
+
return {
|
|
201
|
+
success: false,
|
|
202
|
+
error: "Signature verification failed",
|
|
203
|
+
status: 500
|
|
204
|
+
};
|
|
205
|
+
}
|
|
106
206
|
}
|
|
107
207
|
function validatePayload(trigger, payload) {
|
|
108
208
|
if (!trigger.inputSchema) return { success: true };
|
|
@@ -312,8 +312,6 @@ var NativeSandboxExecutor = class {
|
|
|
312
312
|
mkdirSync(runDir, { recursive: true });
|
|
313
313
|
writeFileSync(join(runDir, `index.${moduleType === "esm" ? "mjs" : "cjs"}`), executionCode, "utf8");
|
|
314
314
|
return await this.executeInSandbox(runDir, config.sandboxConfig?.timeout || FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT, moduleType, config.sandboxConfig);
|
|
315
|
-
} catch (error) {
|
|
316
|
-
throw error;
|
|
317
315
|
} finally {
|
|
318
316
|
if (runDir) try {
|
|
319
317
|
rmSync(runDir, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono1 from "hono";
|
|
2
2
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/evalsAuth.d.ts
|
|
@@ -7,7 +7,7 @@ import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
|
7
7
|
* Middleware to authenticate API requests using Bearer token authentication
|
|
8
8
|
* First checks if token matches INKEEP_AGENTS_EVAL_API_BYPASS_SECRET,
|
|
9
9
|
*/
|
|
10
|
-
declare const evalApiKeyAuth: () =>
|
|
10
|
+
declare const evalApiKeyAuth: () => hono1.MiddlewareHandler<{
|
|
11
11
|
Variables: {
|
|
12
12
|
executionContext: BaseExecutionContext;
|
|
13
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono2 from "hono";
|
|
2
2
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
3
3
|
import { createAuth } from "@inkeep/agents-core/auth";
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ import { createAuth } from "@inkeep/agents-core/auth";
|
|
|
12
12
|
* 3. Database API key
|
|
13
13
|
* 4. Internal service token
|
|
14
14
|
*/
|
|
15
|
-
declare const manageApiKeyAuth: () =>
|
|
15
|
+
declare const manageApiKeyAuth: () => hono2.MiddlewareHandler<{
|
|
16
16
|
Variables: {
|
|
17
17
|
executionContext: BaseExecutionContext;
|
|
18
18
|
userId?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../types/app.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono4 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/projectAccess.d.ts
|
|
5
5
|
|
|
@@ -26,6 +26,6 @@ declare const requireProjectPermission: <Env$1 extends {
|
|
|
26
26
|
Variables: ManageAppVariables;
|
|
27
27
|
} = {
|
|
28
28
|
Variables: ManageAppVariables;
|
|
29
|
-
}>(permission?: ProjectPermission) =>
|
|
29
|
+
}>(permission?: ProjectPermission) => hono4.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
30
30
|
//#endregion
|
|
31
31
|
export { ProjectPermission, requireProjectPermission };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono5 from "hono";
|
|
2
2
|
import { BaseExecutionContext, ResolvedRef } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/projectConfig.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Middleware that fetches the full project definition from the Management API
|
|
7
7
|
*/
|
|
8
|
-
declare const projectConfigMiddleware:
|
|
8
|
+
declare const projectConfigMiddleware: hono5.MiddlewareHandler<{
|
|
9
9
|
Variables: {
|
|
10
10
|
executionContext: BaseExecutionContext;
|
|
11
11
|
resolvedRef: ResolvedRef;
|
|
@@ -15,7 +15,7 @@ declare const projectConfigMiddleware: hono3.MiddlewareHandler<{
|
|
|
15
15
|
* Creates a middleware that applies project config fetching except for specified route patterns
|
|
16
16
|
* @param skipRouteCheck - Function that returns true if the route should skip the middleware
|
|
17
17
|
*/
|
|
18
|
-
declare const projectConfigMiddlewareExcept: (skipRouteCheck: (path: string) => boolean) =>
|
|
18
|
+
declare const projectConfigMiddlewareExcept: (skipRouteCheck: (path: string) => boolean) => hono5.MiddlewareHandler<{
|
|
19
19
|
Variables: {
|
|
20
20
|
executionContext: BaseExecutionContext;
|
|
21
21
|
resolvedRef: ResolvedRef;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../types/app.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono7 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/requirePermission.d.ts
|
|
5
5
|
type Permission = {
|
|
@@ -9,6 +9,6 @@ declare const requirePermission: <Env$1 extends {
|
|
|
9
9
|
Variables: ManageAppVariables;
|
|
10
10
|
} = {
|
|
11
11
|
Variables: ManageAppVariables;
|
|
12
|
-
}>(permissions: Permission) =>
|
|
12
|
+
}>(permissions: Permission) => hono7.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { requirePermission };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono8 from "hono";
|
|
2
2
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/runAuth.d.ts
|
|
5
|
-
declare const runApiKeyAuth: () =>
|
|
5
|
+
declare const runApiKeyAuth: () => hono8.MiddlewareHandler<{
|
|
6
6
|
Variables: {
|
|
7
7
|
executionContext: BaseExecutionContext;
|
|
8
8
|
};
|
|
@@ -11,7 +11,7 @@ declare const runApiKeyAuth: () => hono7.MiddlewareHandler<{
|
|
|
11
11
|
* Creates a middleware that applies API key authentication except for specified route patterns
|
|
12
12
|
* @param skipRouteCheck - Function that returns true if the route should skip authentication
|
|
13
13
|
*/
|
|
14
|
-
declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) =>
|
|
14
|
+
declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) => hono8.MiddlewareHandler<{
|
|
15
15
|
Variables: {
|
|
16
16
|
executionContext: BaseExecutionContext;
|
|
17
17
|
};
|
|
@@ -20,7 +20,7 @@ declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) =
|
|
|
20
20
|
* Helper middleware for endpoints that optionally support API key authentication
|
|
21
21
|
* If no auth header is present, it continues without setting the executionContext
|
|
22
22
|
*/
|
|
23
|
-
declare const runOptionalAuth: () =>
|
|
23
|
+
declare const runOptionalAuth: () => hono8.MiddlewareHandler<{
|
|
24
24
|
Variables: {
|
|
25
25
|
executionContext?: BaseExecutionContext;
|
|
26
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono11 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/sessionAuth.d.ts
|
|
4
4
|
|
|
@@ -7,11 +7,11 @@ import * as hono10 from "hono";
|
|
|
7
7
|
* Requires that a user has already been authenticated via Better Auth session.
|
|
8
8
|
* Used primarily for manage routes that require an active user session.
|
|
9
9
|
*/
|
|
10
|
-
declare const sessionAuth: () =>
|
|
10
|
+
declare const sessionAuth: () => hono11.MiddlewareHandler<any, string, {}, Response>;
|
|
11
11
|
/**
|
|
12
12
|
* Global session middleware - sets user and session in context for all routes
|
|
13
13
|
* Used for all routes that require an active user session.
|
|
14
14
|
*/
|
|
15
|
-
declare const sessionContext: () =>
|
|
15
|
+
declare const sessionContext: () => hono11.MiddlewareHandler<any, string, {}, Response>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { sessionAuth, sessionContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-api",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260123091222",
|
|
4
4
|
"description": "Unified Inkeep Agents API - combines management, runtime, and evaluation capabilities",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"openid-client": "^6.8.1",
|
|
72
72
|
"pg": "^8.16.3",
|
|
73
73
|
"workflow": "4.0.1-beta.33",
|
|
74
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
75
|
-
"@inkeep/agents-manage-mcp": "^0.0.0-dev-
|
|
74
|
+
"@inkeep/agents-core": "^0.0.0-dev-20260123091222",
|
|
75
|
+
"@inkeep/agents-manage-mcp": "^0.0.0-dev-20260123091222"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@hono/zod-openapi": "^1.1.5",
|