@inkeep/agents-api 0.0.0-dev-20260123094230 → 0.0.0-dev-20260123202200
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/flow.cjs +44 -44
- package/dist/.well-known/workflow/v1/flow.cjs.debug.json +2 -2
- package/dist/.well-known/workflow/v1/manifest.debug.json +21 -21
- package/dist/.well-known/workflow/v1/step.cjs +43400 -43255
- package/dist/.well-known/workflow/v1/step.cjs.debug.json +2 -2
- package/dist/data/db/runDbClient.d.ts +2 -2
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/evals/workflow/routes.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/signoz.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/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/factory.d.ts +18 -18
- package/dist/index.d.ts +18 -18
- 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/dist/middleware/tenantAccess.d.ts +2 -2
- package/dist/middleware/tracing.d.ts +3 -3
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"stepFiles": [
|
|
3
|
-
"/home/runner/work/agents/agents/agents-api/src/domains/evals/workflow/functions/
|
|
4
|
-
"/home/runner/work/agents/agents/agents-api/src/domains/evals/workflow/functions/
|
|
3
|
+
"/home/runner/work/agents/agents/agents-api/src/domains/evals/workflow/functions/evaluateConversation.ts",
|
|
4
|
+
"/home/runner/work/agents/agents/agents-api/src/domains/evals/workflow/functions/runDatasetItem.ts"
|
|
5
5
|
]
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core2 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_core2.AgentsRunDatabaseClient;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { runDbClient as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono18 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono18.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 hono16 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/index.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 { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types8 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/workflow/routes.d.ts
|
|
5
|
-
declare const workflowRoutes: Hono<
|
|
5
|
+
declare const workflowRoutes: Hono<hono_types8.BlankEnv, hono_types8.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { workflowRoutes };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono17 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono17.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono15 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono15.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types7 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/signoz.d.ts
|
|
6
6
|
declare const app: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types7.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
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 _inkeep_agents_core3 from "@inkeep/agents-core";
|
|
2
2
|
import { BreakdownComponentDef, ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/run/utils/token-estimator.d.ts
|
|
@@ -17,7 +17,7 @@ interface AssembleResult {
|
|
|
17
17
|
/** The assembled prompt string */
|
|
18
18
|
prompt: string;
|
|
19
19
|
/** Token breakdown for each component */
|
|
20
|
-
breakdown:
|
|
20
|
+
breakdown: _inkeep_agents_core3.ContextBreakdown;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
export { AssembleResult, type BreakdownComponentDef, type ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown, estimateTokens };
|
package/dist/factory.d.ts
CHANGED
|
@@ -795,25 +795,25 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
795
795
|
ac: better_auth_plugins0.AccessControl;
|
|
796
796
|
roles: {
|
|
797
797
|
member: {
|
|
798
|
-
authorize<K_1 extends "
|
|
799
|
-
actions: better_auth_plugins0.Subset<"
|
|
798
|
+
authorize<K_1 extends "project" | "organization" | "team" | "member" | "ac" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
799
|
+
actions: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key];
|
|
800
800
|
connector: "OR" | "AND";
|
|
801
801
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
802
|
-
statements: better_auth_plugins0.Subset<"
|
|
802
|
+
statements: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>;
|
|
803
803
|
};
|
|
804
804
|
admin: {
|
|
805
|
-
authorize<K_1 extends "
|
|
806
|
-
actions: better_auth_plugins0.Subset<"
|
|
805
|
+
authorize<K_1 extends "project" | "organization" | "team" | "member" | "ac" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
806
|
+
actions: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key];
|
|
807
807
|
connector: "OR" | "AND";
|
|
808
808
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
809
|
-
statements: better_auth_plugins0.Subset<"
|
|
809
|
+
statements: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>;
|
|
810
810
|
};
|
|
811
811
|
owner: {
|
|
812
|
-
authorize<K_1 extends "
|
|
813
|
-
actions: better_auth_plugins0.Subset<"
|
|
812
|
+
authorize<K_1 extends "project" | "organization" | "team" | "member" | "ac" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
813
|
+
actions: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key];
|
|
814
814
|
connector: "OR" | "AND";
|
|
815
815
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
816
|
-
statements: better_auth_plugins0.Subset<"
|
|
816
|
+
statements: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>;
|
|
817
817
|
};
|
|
818
818
|
};
|
|
819
819
|
membershipLimit: number;
|
|
@@ -1104,25 +1104,25 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
1104
1104
|
ac: better_auth_plugins0.AccessControl;
|
|
1105
1105
|
roles: {
|
|
1106
1106
|
member: {
|
|
1107
|
-
authorize<K_1 extends "
|
|
1108
|
-
actions: better_auth_plugins0.Subset<"
|
|
1107
|
+
authorize<K_1 extends "project" | "organization" | "team" | "member" | "ac" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
1108
|
+
actions: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key];
|
|
1109
1109
|
connector: "OR" | "AND";
|
|
1110
1110
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1111
|
-
statements: better_auth_plugins0.Subset<"
|
|
1111
|
+
statements: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>;
|
|
1112
1112
|
};
|
|
1113
1113
|
admin: {
|
|
1114
|
-
authorize<K_1 extends "
|
|
1115
|
-
actions: better_auth_plugins0.Subset<"
|
|
1114
|
+
authorize<K_1 extends "project" | "organization" | "team" | "member" | "ac" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
1115
|
+
actions: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key];
|
|
1116
1116
|
connector: "OR" | "AND";
|
|
1117
1117
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1118
|
-
statements: better_auth_plugins0.Subset<"
|
|
1118
|
+
statements: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>;
|
|
1119
1119
|
};
|
|
1120
1120
|
owner: {
|
|
1121
|
-
authorize<K_1 extends "
|
|
1122
|
-
actions: better_auth_plugins0.Subset<"
|
|
1121
|
+
authorize<K_1 extends "project" | "organization" | "team" | "member" | "ac" | "invitation">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key] | {
|
|
1122
|
+
actions: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>[key];
|
|
1123
1123
|
connector: "OR" | "AND";
|
|
1124
1124
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1125
|
-
statements: better_auth_plugins0.Subset<"
|
|
1125
|
+
statements: better_auth_plugins0.Subset<"project" | "organization" | "team" | "member" | "ac" | "invitation", better_auth_plugins0.Statements>;
|
|
1126
1126
|
};
|
|
1127
1127
|
};
|
|
1128
1128
|
membershipLimit: number;
|