@inkeep/agents-api 0.0.0-dev-20260123091222 → 0.0.0-dev-20260123094230
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 +16 -16
- package/dist/.well-known/workflow/v1/step.cjs +15299 -15444
- 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/evals/evaluationResults.d.ts +2 -2
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/triggers.js +24 -49
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/routes/webhooks.js +0 -4
- package/dist/domains/run/services/TriggerService.d.ts +1 -1
- package/dist/domains/run/services/TriggerService.js +11 -111
- package/dist/domains/run/tools/NativeSandboxExecutor.js +2 -0
- package/dist/domains/run/utils/token-estimator.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/runDatasetItem.ts",
|
|
4
|
+
"/home/runner/work/agents/agents/agents-api/src/domains/evals/workflow/functions/evaluateConversation.ts"
|
|
5
5
|
]
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core3 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_core3.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 hono12 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono12.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 hono13 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono13.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_types7 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_types7.BlankEnv, hono_types7.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 hono0 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/conversations.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 hono14 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/evals/evaluationResults.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono14.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 hono9 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono9.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_types5 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/mcp.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
|
|
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_types9 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_types9.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { app as default };
|
|
@@ -4,11 +4,21 @@ 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, TriggerApiUpdateSchema, TriggerInvocationListResponse, TriggerInvocationResponse, TriggerInvocationStatusEnum,
|
|
7
|
+
import { PaginationQueryParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TriggerApiInsertSchema, TriggerApiSelectSchema, TriggerApiUpdateSchema, TriggerInvocationListResponse, TriggerInvocationResponse, TriggerInvocationStatusEnum, commonGetErrorResponses, createApiError, createTrigger, deleteTrigger, generateId, 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
|
+
});
|
|
12
22
|
app.use("/", async (c, next) => {
|
|
13
23
|
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
14
24
|
return next();
|
|
@@ -41,7 +51,7 @@ app.openapi(createRoute({
|
|
|
41
51
|
responses: {
|
|
42
52
|
200: {
|
|
43
53
|
description: "List of triggers retrieved successfully",
|
|
44
|
-
content: { "application/json": { schema:
|
|
54
|
+
content: { "application/json": { schema: TriggerListResponse } }
|
|
45
55
|
},
|
|
46
56
|
...commonGetErrorResponses
|
|
47
57
|
},
|
|
@@ -93,7 +103,7 @@ app.openapi(createRoute({
|
|
|
93
103
|
responses: {
|
|
94
104
|
200: {
|
|
95
105
|
description: "Trigger found",
|
|
96
|
-
content: { "application/json": { schema:
|
|
106
|
+
content: { "application/json": { schema: TriggerResponse } }
|
|
97
107
|
},
|
|
98
108
|
...commonGetErrorResponses
|
|
99
109
|
}
|
|
@@ -141,7 +151,7 @@ app.openapi(createRoute({
|
|
|
141
151
|
responses: {
|
|
142
152
|
201: {
|
|
143
153
|
description: "Trigger created successfully",
|
|
144
|
-
content: { "application/json": { schema:
|
|
154
|
+
content: { "application/json": { schema: TriggerResponse } }
|
|
145
155
|
},
|
|
146
156
|
...commonGetErrorResponses
|
|
147
157
|
}
|
|
@@ -151,29 +161,12 @@ app.openapi(createRoute({
|
|
|
151
161
|
const body = c.req.valid("json");
|
|
152
162
|
const apiBaseUrl = env.INKEEP_AGENTS_API_URL;
|
|
153
163
|
const id = body.id || generateId();
|
|
154
|
-
logger.
|
|
164
|
+
logger.info({
|
|
155
165
|
tenantId,
|
|
156
166
|
projectId,
|
|
157
167
|
agentId,
|
|
158
168
|
triggerId: id
|
|
159
169
|
}, "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
|
-
}
|
|
177
170
|
let hashedAuthentication;
|
|
178
171
|
const authInput = body.authentication;
|
|
179
172
|
if (authInput?.headers && authInput.headers.length > 0) hashedAuthentication = { headers: await hashAuthenticationHeaders(authInput.headers) };
|
|
@@ -189,8 +182,7 @@ app.openapi(createRoute({
|
|
|
189
182
|
outputTransform: body.outputTransform,
|
|
190
183
|
messageTemplate: body.messageTemplate,
|
|
191
184
|
authentication: hashedAuthentication,
|
|
192
|
-
|
|
193
|
-
signatureVerification: body.signatureVerification
|
|
185
|
+
signingSecret: body.signingSecret
|
|
194
186
|
});
|
|
195
187
|
const { tenantId: _tid, projectId: _pid, agentId: _aid, ...triggerWithoutScopes } = trigger;
|
|
196
188
|
return c.json({ data: {
|
|
@@ -220,7 +212,7 @@ app.openapi(createRoute({
|
|
|
220
212
|
responses: {
|
|
221
213
|
200: {
|
|
222
214
|
description: "Trigger updated successfully",
|
|
223
|
-
content: { "application/json": { schema:
|
|
215
|
+
content: { "application/json": { schema: TriggerResponse } }
|
|
224
216
|
},
|
|
225
217
|
...commonGetErrorResponses
|
|
226
218
|
}
|
|
@@ -229,33 +221,16 @@ app.openapi(createRoute({
|
|
|
229
221
|
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
230
222
|
const body = c.req.valid("json");
|
|
231
223
|
const apiBaseUrl = env.INKEEP_AGENTS_API_URL;
|
|
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.
|
|
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.signingSecret !== void 0 || body.keepExistingSigningSecret !== void 0)) throw createApiError({
|
|
233
225
|
code: "bad_request",
|
|
234
226
|
message: "No fields to update"
|
|
235
227
|
});
|
|
236
|
-
logger.
|
|
228
|
+
logger.info({
|
|
237
229
|
tenantId,
|
|
238
230
|
projectId,
|
|
239
231
|
agentId,
|
|
240
232
|
triggerId: id
|
|
241
233
|
}, "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
|
-
}
|
|
259
234
|
let hashedAuthentication;
|
|
260
235
|
const authInput = body.authentication;
|
|
261
236
|
if (authInput?.headers && authInput.headers.length > 0) {
|
|
@@ -284,6 +259,7 @@ app.openapi(createRoute({
|
|
|
284
259
|
}
|
|
285
260
|
hashedAuthentication = hashedHeaders.length > 0 ? { headers: hashedHeaders } : void 0;
|
|
286
261
|
} else if (body.authentication !== void 0) hashedAuthentication = body.authentication;
|
|
262
|
+
const signingSecretUpdate = body.keepExistingSigningSecret ? void 0 : body.signingSecret;
|
|
287
263
|
const updatedTrigger = await updateTrigger(db)({
|
|
288
264
|
scopes: {
|
|
289
265
|
tenantId,
|
|
@@ -299,8 +275,7 @@ app.openapi(createRoute({
|
|
|
299
275
|
outputTransform: body.outputTransform,
|
|
300
276
|
messageTemplate: body.messageTemplate,
|
|
301
277
|
authentication: hashedAuthentication,
|
|
302
|
-
|
|
303
|
-
signatureVerification: body.signatureVerification
|
|
278
|
+
signingSecret: signingSecretUpdate
|
|
304
279
|
}
|
|
305
280
|
});
|
|
306
281
|
if (!updatedTrigger) throw createApiError({
|
|
@@ -336,7 +311,7 @@ app.openapi(createRoute({
|
|
|
336
311
|
}), async (c) => {
|
|
337
312
|
const db = c.get("db");
|
|
338
313
|
const { tenantId, projectId, agentId, id } = c.req.valid("param");
|
|
339
|
-
logger.
|
|
314
|
+
logger.info({
|
|
340
315
|
tenantId,
|
|
341
316
|
projectId,
|
|
342
317
|
agentId,
|
|
@@ -397,7 +372,7 @@ app.openapi(createRoute({
|
|
|
397
372
|
}), async (c) => {
|
|
398
373
|
const { tenantId, projectId, agentId, id: triggerId } = c.req.valid("param");
|
|
399
374
|
const { page, limit, status, from, to } = c.req.valid("query");
|
|
400
|
-
logger.
|
|
375
|
+
logger.info({
|
|
401
376
|
tenantId,
|
|
402
377
|
projectId,
|
|
403
378
|
agentId,
|
|
@@ -451,7 +426,7 @@ app.openapi(createRoute({
|
|
|
451
426
|
}
|
|
452
427
|
}), async (c) => {
|
|
453
428
|
const { tenantId, projectId, agentId, id: triggerId, invocationId } = c.req.valid("param");
|
|
454
|
-
logger.
|
|
429
|
+
logger.info({
|
|
455
430
|
tenantId,
|
|
456
431
|
projectId,
|
|
457
432
|
agentId,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentConfig, DelegateRelation } from "./Agent.js";
|
|
2
2
|
import { InternalRelation } from "../utils/project.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _inkeep_agents_core0 from "@inkeep/agents-core";
|
|
4
4
|
import { CredentialStoreRegistry, FullExecutionContext } from "@inkeep/agents-core";
|
|
5
5
|
import * as ai0 from "ai";
|
|
6
6
|
|
|
@@ -44,7 +44,7 @@ declare function createDelegateToAgentTool({
|
|
|
44
44
|
message: string;
|
|
45
45
|
}, {
|
|
46
46
|
toolCallId: any;
|
|
47
|
-
result:
|
|
47
|
+
result: _inkeep_agents_core0.Message | _inkeep_agents_core0.Task;
|
|
48
48
|
}>;
|
|
49
49
|
/**
|
|
50
50
|
* Parameters for building a transfer relation config
|
|
@@ -55,10 +55,6 @@ 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() }) } }
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
});
|
|
@@ -4,15 +4,13 @@ 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,
|
|
7
|
+
import { JsonTransformer, createMessage, createOrGetConversation, createTriggerInvocation, generateId, getConversationId, getFullProjectWithRelationIds, getTriggerById, interpolateTemplate, setActiveAgentForConversation, updateTriggerInvocationStatus, verifySigningSecret, 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;
|
|
16
14
|
/**
|
|
17
15
|
* Process a trigger webhook request.
|
|
18
16
|
* Handles validation, transformation, and dispatches async execution.
|
|
@@ -39,14 +37,7 @@ async function processWebhook(params) {
|
|
|
39
37
|
const payload = rawBody ? JSON.parse(rawBody) : {};
|
|
40
38
|
const authResult = await verifyAuthentication(trigger, honoContext);
|
|
41
39
|
if (!authResult.success) return authResult;
|
|
42
|
-
const signatureResult =
|
|
43
|
-
trigger,
|
|
44
|
-
tenantId,
|
|
45
|
-
projectId,
|
|
46
|
-
resolvedRef,
|
|
47
|
-
honoContext,
|
|
48
|
-
rawBody
|
|
49
|
-
});
|
|
40
|
+
const signatureResult = verifySignature(trigger, honoContext, rawBody);
|
|
50
41
|
if (!signatureResult.success) return signatureResult;
|
|
51
42
|
const validationResult = validatePayload(trigger, payload);
|
|
52
43
|
if (!validationResult.success) return validationResult;
|
|
@@ -103,106 +94,15 @@ async function verifyAuthentication(trigger, honoContext) {
|
|
|
103
94
|
}
|
|
104
95
|
return { success: true };
|
|
105
96
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
}
|
|
97
|
+
function verifySignature(trigger, honoContext, rawBody) {
|
|
98
|
+
if (!trigger.signingSecret) return { success: true };
|
|
99
|
+
const signatureResult = verifySigningSecret(honoContext, trigger.signingSecret, rawBody);
|
|
100
|
+
if (!signatureResult.success) return {
|
|
101
|
+
success: false,
|
|
102
|
+
error: signatureResult.message || "Invalid signature",
|
|
103
|
+
status: 403
|
|
104
|
+
};
|
|
105
|
+
return { success: true };
|
|
206
106
|
}
|
|
207
107
|
function validatePayload(trigger, payload) {
|
|
208
108
|
if (!trigger.inputSchema) return { success: true };
|
|
@@ -312,6 +312,8 @@ 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;
|
|
315
317
|
} finally {
|
|
316
318
|
if (runDir) try {
|
|
317
319
|
rmSync(runDir, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core2 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_core2.ContextBreakdown;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
export { AssembleResult, type BreakdownComponentDef, type ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown, estimateTokens };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono18 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: () => hono18.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 hono17 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) => hono17.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
30
30
|
//#endregion
|
|
31
31
|
export { ProjectPermission, requireProjectPermission };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono15 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: hono15.MiddlewareHandler<{
|
|
9
9
|
Variables: {
|
|
10
10
|
executionContext: BaseExecutionContext;
|
|
11
11
|
resolvedRef: ResolvedRef;
|
|
@@ -15,7 +15,7 @@ declare const projectConfigMiddleware: hono5.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) => hono15.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 hono2 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) => hono2.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { requirePermission };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono3 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: () => hono3.MiddlewareHandler<{
|
|
6
6
|
Variables: {
|
|
7
7
|
executionContext: BaseExecutionContext;
|
|
8
8
|
};
|
|
@@ -11,7 +11,7 @@ declare const runApiKeyAuth: () => hono8.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) => hono3.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: () => hono3.MiddlewareHandler<{
|
|
24
24
|
Variables: {
|
|
25
25
|
executionContext?: BaseExecutionContext;
|
|
26
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono6 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/sessionAuth.d.ts
|
|
4
4
|
|
|
@@ -7,11 +7,11 @@ import * as hono11 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: () => hono6.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: () => hono6.MiddlewareHandler<any, string, {}, Response>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { sessionAuth, sessionContext };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono8 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tenantAccess.d.ts
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ import * as hono13 from "hono";
|
|
|
11
11
|
* - API key user: Access only to the tenant associated with the API key
|
|
12
12
|
* - Session user: Access based on organization membership
|
|
13
13
|
*/
|
|
14
|
-
declare const requireTenantAccess: () =>
|
|
14
|
+
declare const requireTenantAccess: () => hono8.MiddlewareHandler<{
|
|
15
15
|
Variables: {
|
|
16
16
|
userId: string;
|
|
17
17
|
tenantId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono10 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tracing.d.ts
|
|
4
|
-
declare const otelBaggageMiddleware: () =>
|
|
5
|
-
declare const executionBaggageMiddleware: () =>
|
|
4
|
+
declare const otelBaggageMiddleware: () => hono10.MiddlewareHandler<any, string, {}, Response>;
|
|
5
|
+
declare const executionBaggageMiddleware: () => hono10.MiddlewareHandler<any, string, {}, Response>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { executionBaggageMiddleware, otelBaggageMiddleware };
|