@inkeep/agents-api 0.0.0-dev-20260122081407 → 0.0.0-dev-20260122090358
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/step.cjs +130 -130
- package/dist/.well-known/workflow/v1/step.cjs.debug.json +2 -2
- package/dist/data/db/manageDbClient.d.ts +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/evals/workflow/world.js +3 -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/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/routes/webhooks.js +33 -340
- package/dist/domains/run/services/TriggerService.d.ts +31 -0
- package/dist/domains/run/services/TriggerService.js +377 -0
- package/dist/factory.d.ts +22 -22
- package/dist/index.d.ts +22 -22
- 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 +4 -3
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
2
|
+
import { env } from "../../../env.js";
|
|
3
|
+
import manageDbPool_default from "../../../data/db/manageDbPool.js";
|
|
4
|
+
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
5
|
+
import { createSSEStreamHelper } from "../utils/stream-helpers.js";
|
|
6
|
+
import { ExecutionHandler } from "../handlers/executionHandler.js";
|
|
7
|
+
import { JsonTransformer, createMessage, createOrGetConversation, createTriggerInvocation, generateId, getConversationId, getFullProjectWithRelationIds, getTriggerById, interpolateTemplate, setActiveAgentForConversation, updateTriggerInvocationStatus, verifySigningSecret, verifyTriggerAuth, withRef } from "@inkeep/agents-core";
|
|
8
|
+
import Ajv from "ajv";
|
|
9
|
+
|
|
10
|
+
//#region src/domains/run/services/TriggerService.ts
|
|
11
|
+
const logger = getLogger$1("TriggerService");
|
|
12
|
+
const ajv = new Ajv({ allErrors: true });
|
|
13
|
+
/**
|
|
14
|
+
* Process a trigger webhook request.
|
|
15
|
+
* Handles validation, transformation, and dispatches async execution.
|
|
16
|
+
*/
|
|
17
|
+
async function processWebhook(params) {
|
|
18
|
+
const { tenantId, projectId, agentId, triggerId, resolvedRef, rawBody, honoContext } = params;
|
|
19
|
+
const trigger = await loadTrigger({
|
|
20
|
+
tenantId,
|
|
21
|
+
projectId,
|
|
22
|
+
agentId,
|
|
23
|
+
triggerId,
|
|
24
|
+
resolvedRef
|
|
25
|
+
});
|
|
26
|
+
if (!trigger) return {
|
|
27
|
+
success: false,
|
|
28
|
+
error: `Trigger ${triggerId} not found`,
|
|
29
|
+
status: 404
|
|
30
|
+
};
|
|
31
|
+
if (!trigger.enabled) return {
|
|
32
|
+
success: false,
|
|
33
|
+
error: "Trigger is disabled",
|
|
34
|
+
status: 404
|
|
35
|
+
};
|
|
36
|
+
const payload = rawBody ? JSON.parse(rawBody) : {};
|
|
37
|
+
const authResult = await verifyAuthentication(trigger, honoContext);
|
|
38
|
+
if (!authResult.success) return authResult;
|
|
39
|
+
const signatureResult = verifySignature(trigger, honoContext, rawBody);
|
|
40
|
+
if (!signatureResult.success) return signatureResult;
|
|
41
|
+
const validationResult = validatePayload(trigger, payload);
|
|
42
|
+
if (!validationResult.success) return validationResult;
|
|
43
|
+
const transformResult = await transformPayload(trigger, payload, {
|
|
44
|
+
tenantId,
|
|
45
|
+
projectId,
|
|
46
|
+
triggerId
|
|
47
|
+
});
|
|
48
|
+
if (!transformResult.success) return transformResult;
|
|
49
|
+
const transformedPayload = transformResult.payload;
|
|
50
|
+
const { messageParts, userMessageText } = buildMessage(trigger, transformedPayload, triggerId);
|
|
51
|
+
const { invocationId, conversationId } = await dispatchExecution({
|
|
52
|
+
tenantId,
|
|
53
|
+
projectId,
|
|
54
|
+
agentId,
|
|
55
|
+
triggerId,
|
|
56
|
+
resolvedRef,
|
|
57
|
+
payload,
|
|
58
|
+
transformedPayload,
|
|
59
|
+
messageParts,
|
|
60
|
+
userMessageText
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
success: true,
|
|
64
|
+
invocationId,
|
|
65
|
+
conversationId
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async function loadTrigger(params) {
|
|
69
|
+
const { tenantId, projectId, agentId, triggerId, resolvedRef } = params;
|
|
70
|
+
return await withRef(manageDbPool_default, resolvedRef, (db) => getTriggerById(db)({
|
|
71
|
+
scopes: {
|
|
72
|
+
tenantId,
|
|
73
|
+
projectId,
|
|
74
|
+
agentId
|
|
75
|
+
},
|
|
76
|
+
triggerId
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
async function verifyAuthentication(trigger, honoContext) {
|
|
80
|
+
if (!trigger.authentication) return { success: true };
|
|
81
|
+
const authResult = await verifyTriggerAuth(honoContext, trigger.authentication);
|
|
82
|
+
if (!authResult.success) {
|
|
83
|
+
if (authResult.status === 401) return {
|
|
84
|
+
success: false,
|
|
85
|
+
error: authResult.message || "Unauthorized",
|
|
86
|
+
status: 401
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
success: false,
|
|
90
|
+
error: authResult.message || "Forbidden",
|
|
91
|
+
status: 403
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return { success: true };
|
|
95
|
+
}
|
|
96
|
+
function verifySignature(trigger, honoContext, rawBody) {
|
|
97
|
+
if (!trigger.signingSecret) return { success: true };
|
|
98
|
+
const signatureResult = verifySigningSecret(honoContext, trigger.signingSecret, rawBody);
|
|
99
|
+
if (!signatureResult.success) return {
|
|
100
|
+
success: false,
|
|
101
|
+
error: signatureResult.message || "Invalid signature",
|
|
102
|
+
status: 403
|
|
103
|
+
};
|
|
104
|
+
return { success: true };
|
|
105
|
+
}
|
|
106
|
+
function validatePayload(trigger, payload) {
|
|
107
|
+
if (!trigger.inputSchema) return { success: true };
|
|
108
|
+
const validate = ajv.compile(trigger.inputSchema);
|
|
109
|
+
if (!validate(payload)) return {
|
|
110
|
+
success: false,
|
|
111
|
+
error: "Payload validation failed",
|
|
112
|
+
status: 400,
|
|
113
|
+
validationErrors: validate.errors?.map((err) => `${err.instancePath} ${err.message}`)
|
|
114
|
+
};
|
|
115
|
+
return { success: true };
|
|
116
|
+
}
|
|
117
|
+
async function transformPayload(trigger, payload, context) {
|
|
118
|
+
if (!trigger.outputTransform) return {
|
|
119
|
+
success: true,
|
|
120
|
+
payload
|
|
121
|
+
};
|
|
122
|
+
try {
|
|
123
|
+
const transformedPayload = await JsonTransformer.transformWithConfig(payload, trigger.outputTransform);
|
|
124
|
+
logger.debug(context, "Payload transformation successful");
|
|
125
|
+
return {
|
|
126
|
+
success: true,
|
|
127
|
+
payload: transformedPayload
|
|
128
|
+
};
|
|
129
|
+
} catch (error) {
|
|
130
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
131
|
+
logger.error({
|
|
132
|
+
...context,
|
|
133
|
+
error: errorMessage
|
|
134
|
+
}, "Payload transformation failed");
|
|
135
|
+
return {
|
|
136
|
+
success: false,
|
|
137
|
+
error: `Payload transformation failed: ${errorMessage}`,
|
|
138
|
+
status: 422
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function buildMessage(trigger, transformedPayload, triggerId) {
|
|
143
|
+
const messageParts = [];
|
|
144
|
+
if (trigger.messageTemplate) {
|
|
145
|
+
const payloadForTemplate = typeof transformedPayload === "object" && transformedPayload !== null && !Array.isArray(transformedPayload) ? transformedPayload : {};
|
|
146
|
+
const interpolatedMessage = interpolateTemplate(trigger.messageTemplate, payloadForTemplate);
|
|
147
|
+
messageParts.push({
|
|
148
|
+
kind: "text",
|
|
149
|
+
text: interpolatedMessage
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (transformedPayload != null) messageParts.push({
|
|
153
|
+
kind: "data",
|
|
154
|
+
data: transformedPayload,
|
|
155
|
+
metadata: {
|
|
156
|
+
source: "trigger",
|
|
157
|
+
triggerId
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return {
|
|
161
|
+
messageParts,
|
|
162
|
+
userMessageText: trigger.messageTemplate ? (() => {
|
|
163
|
+
const payloadForTemplate = typeof transformedPayload === "object" && transformedPayload !== null && !Array.isArray(transformedPayload) ? transformedPayload : {};
|
|
164
|
+
return interpolateTemplate(trigger.messageTemplate, payloadForTemplate);
|
|
165
|
+
})() : JSON.stringify(transformedPayload)
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
async function dispatchExecution(params) {
|
|
169
|
+
const { tenantId, projectId, agentId, triggerId, resolvedRef, payload, transformedPayload, messageParts, userMessageText } = params;
|
|
170
|
+
const conversationId = getConversationId();
|
|
171
|
+
const invocationId = generateId();
|
|
172
|
+
await createTriggerInvocation(runDbClient_default)({
|
|
173
|
+
id: invocationId,
|
|
174
|
+
triggerId,
|
|
175
|
+
tenantId,
|
|
176
|
+
projectId,
|
|
177
|
+
agentId,
|
|
178
|
+
conversationId,
|
|
179
|
+
status: "pending",
|
|
180
|
+
requestPayload: payload,
|
|
181
|
+
transformedPayload
|
|
182
|
+
});
|
|
183
|
+
logger.info({
|
|
184
|
+
tenantId,
|
|
185
|
+
projectId,
|
|
186
|
+
agentId,
|
|
187
|
+
triggerId,
|
|
188
|
+
invocationId,
|
|
189
|
+
conversationId
|
|
190
|
+
}, "Trigger invocation created");
|
|
191
|
+
const executionPromise = executeAgentAsync({
|
|
192
|
+
tenantId,
|
|
193
|
+
projectId,
|
|
194
|
+
agentId,
|
|
195
|
+
triggerId,
|
|
196
|
+
invocationId,
|
|
197
|
+
conversationId,
|
|
198
|
+
userMessage: userMessageText,
|
|
199
|
+
messageParts,
|
|
200
|
+
resolvedRef
|
|
201
|
+
});
|
|
202
|
+
if (process.env.VERCEL) import("@vercel/functions").then(({ waitUntil }) => {
|
|
203
|
+
waitUntil(executionPromise);
|
|
204
|
+
}).catch((err) => {
|
|
205
|
+
logger.error({ err }, "Failed to import @vercel/functions");
|
|
206
|
+
});
|
|
207
|
+
else executionPromise.catch((error) => {
|
|
208
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
209
|
+
const errorStack = error instanceof Error ? error.stack : void 0;
|
|
210
|
+
logger.error({
|
|
211
|
+
err: errorMessage,
|
|
212
|
+
errorStack,
|
|
213
|
+
tenantId,
|
|
214
|
+
projectId,
|
|
215
|
+
agentId,
|
|
216
|
+
triggerId,
|
|
217
|
+
invocationId
|
|
218
|
+
}, "Background trigger execution failed");
|
|
219
|
+
});
|
|
220
|
+
logger.info({
|
|
221
|
+
tenantId,
|
|
222
|
+
projectId,
|
|
223
|
+
agentId,
|
|
224
|
+
triggerId,
|
|
225
|
+
invocationId,
|
|
226
|
+
conversationId
|
|
227
|
+
}, "Async execution dispatched");
|
|
228
|
+
return {
|
|
229
|
+
invocationId,
|
|
230
|
+
conversationId
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Execute the agent asynchronously.
|
|
235
|
+
* This runs after the webhook response is sent.
|
|
236
|
+
*/
|
|
237
|
+
async function executeAgentAsync(params) {
|
|
238
|
+
const { tenantId, projectId, agentId, triggerId, invocationId, conversationId, userMessage, messageParts, resolvedRef } = params;
|
|
239
|
+
logger.info({
|
|
240
|
+
tenantId,
|
|
241
|
+
projectId,
|
|
242
|
+
agentId,
|
|
243
|
+
triggerId,
|
|
244
|
+
invocationId,
|
|
245
|
+
conversationId
|
|
246
|
+
}, "Starting async trigger execution");
|
|
247
|
+
try {
|
|
248
|
+
const project = await withRef(manageDbPool_default, resolvedRef, async (db) => {
|
|
249
|
+
return await getFullProjectWithRelationIds(db)({ scopes: {
|
|
250
|
+
tenantId,
|
|
251
|
+
projectId
|
|
252
|
+
} });
|
|
253
|
+
});
|
|
254
|
+
if (!project) throw new Error(`Project ${projectId} not found`);
|
|
255
|
+
const agent = project.agents?.[agentId];
|
|
256
|
+
if (!agent) throw new Error(`Agent ${agentId} not found in project`);
|
|
257
|
+
const defaultSubAgentId = agent.defaultSubAgentId;
|
|
258
|
+
if (!defaultSubAgentId) throw new Error(`Agent ${agentId} has no default sub-agent configured`);
|
|
259
|
+
await createOrGetConversation(runDbClient_default)({
|
|
260
|
+
id: conversationId,
|
|
261
|
+
tenantId,
|
|
262
|
+
projectId,
|
|
263
|
+
agentId,
|
|
264
|
+
activeSubAgentId: defaultSubAgentId,
|
|
265
|
+
ref: resolvedRef
|
|
266
|
+
});
|
|
267
|
+
await setActiveAgentForConversation(runDbClient_default)({
|
|
268
|
+
scopes: {
|
|
269
|
+
tenantId,
|
|
270
|
+
projectId
|
|
271
|
+
},
|
|
272
|
+
conversationId,
|
|
273
|
+
subAgentId: defaultSubAgentId,
|
|
274
|
+
agentId,
|
|
275
|
+
ref: resolvedRef
|
|
276
|
+
});
|
|
277
|
+
await createMessage(runDbClient_default)({
|
|
278
|
+
id: generateId(),
|
|
279
|
+
tenantId,
|
|
280
|
+
projectId,
|
|
281
|
+
conversationId,
|
|
282
|
+
role: "user",
|
|
283
|
+
content: {
|
|
284
|
+
text: userMessage,
|
|
285
|
+
parts: messageParts
|
|
286
|
+
},
|
|
287
|
+
metadata: { a2a_metadata: {
|
|
288
|
+
triggerId,
|
|
289
|
+
invocationId
|
|
290
|
+
} }
|
|
291
|
+
});
|
|
292
|
+
const executionContext = {
|
|
293
|
+
tenantId,
|
|
294
|
+
projectId,
|
|
295
|
+
agentId,
|
|
296
|
+
baseUrl: env.INKEEP_AGENTS_API_URL || "http://localhost:3002",
|
|
297
|
+
apiKey: env.INKEEP_AGENTS_RUN_API_BYPASS_SECRET || "",
|
|
298
|
+
apiKeyId: "trigger-invocation",
|
|
299
|
+
resolvedRef,
|
|
300
|
+
project,
|
|
301
|
+
metadata: { initiatedBy: {
|
|
302
|
+
type: "api_key",
|
|
303
|
+
id: triggerId
|
|
304
|
+
} }
|
|
305
|
+
};
|
|
306
|
+
const requestId = `trigger-${invocationId}`;
|
|
307
|
+
const noOpStreamHelper = createSSEStreamHelper({
|
|
308
|
+
writeSSE: async () => {},
|
|
309
|
+
sleep: async () => {}
|
|
310
|
+
}, requestId, Math.floor(Date.now() / 1e3));
|
|
311
|
+
await new ExecutionHandler().execute({
|
|
312
|
+
executionContext,
|
|
313
|
+
conversationId,
|
|
314
|
+
userMessage,
|
|
315
|
+
messageParts,
|
|
316
|
+
initialAgentId: agentId,
|
|
317
|
+
requestId,
|
|
318
|
+
sseHelper: noOpStreamHelper,
|
|
319
|
+
emitOperations: false
|
|
320
|
+
});
|
|
321
|
+
await updateTriggerInvocationStatus(runDbClient_default)({
|
|
322
|
+
scopes: {
|
|
323
|
+
tenantId,
|
|
324
|
+
projectId,
|
|
325
|
+
agentId
|
|
326
|
+
},
|
|
327
|
+
triggerId,
|
|
328
|
+
invocationId,
|
|
329
|
+
data: { status: "success" }
|
|
330
|
+
});
|
|
331
|
+
logger.info({
|
|
332
|
+
tenantId,
|
|
333
|
+
projectId,
|
|
334
|
+
agentId,
|
|
335
|
+
triggerId,
|
|
336
|
+
invocationId,
|
|
337
|
+
conversationId
|
|
338
|
+
}, "Async trigger execution completed successfully");
|
|
339
|
+
} catch (error) {
|
|
340
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
341
|
+
const errorStack = error instanceof Error ? error.stack : void 0;
|
|
342
|
+
logger.error({
|
|
343
|
+
err: errorMessage,
|
|
344
|
+
errorStack,
|
|
345
|
+
tenantId,
|
|
346
|
+
projectId,
|
|
347
|
+
agentId,
|
|
348
|
+
triggerId,
|
|
349
|
+
invocationId
|
|
350
|
+
}, "Async trigger execution failed");
|
|
351
|
+
try {
|
|
352
|
+
await updateTriggerInvocationStatus(runDbClient_default)({
|
|
353
|
+
scopes: {
|
|
354
|
+
tenantId,
|
|
355
|
+
projectId,
|
|
356
|
+
agentId
|
|
357
|
+
},
|
|
358
|
+
triggerId,
|
|
359
|
+
invocationId,
|
|
360
|
+
data: {
|
|
361
|
+
status: "failed",
|
|
362
|
+
errorMessage
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
} catch (updateError) {
|
|
366
|
+
const updateErrorMessage = updateError instanceof Error ? updateError.message : String(updateError);
|
|
367
|
+
logger.error({
|
|
368
|
+
err: updateErrorMessage,
|
|
369
|
+
invocationId
|
|
370
|
+
}, "Failed to update invocation status to failed");
|
|
371
|
+
}
|
|
372
|
+
throw error;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
//#endregion
|
|
377
|
+
export { processWebhook };
|
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 "organization" | "
|
|
799
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
798
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
799
|
+
actions: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", 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<"organization" | "
|
|
802
|
+
statements: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
803
803
|
};
|
|
804
804
|
admin: {
|
|
805
|
-
authorize<K_1 extends "organization" | "
|
|
806
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
805
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
806
|
+
actions: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", 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<"organization" | "
|
|
809
|
+
statements: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
810
810
|
};
|
|
811
811
|
owner: {
|
|
812
|
-
authorize<K_1 extends "organization" | "
|
|
813
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
812
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
813
|
+
actions: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", 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<"organization" | "
|
|
816
|
+
statements: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
817
817
|
};
|
|
818
818
|
};
|
|
819
819
|
membershipLimit: number;
|
|
@@ -987,7 +987,7 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
987
987
|
id: string;
|
|
988
988
|
organizationId: string;
|
|
989
989
|
email: string;
|
|
990
|
-
role: "
|
|
990
|
+
role: "owner" | "admin" | "member";
|
|
991
991
|
status: better_auth_plugins0.InvitationStatus;
|
|
992
992
|
inviterId: string;
|
|
993
993
|
expiresAt: Date;
|
|
@@ -996,7 +996,7 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
996
996
|
Member: {
|
|
997
997
|
id: string;
|
|
998
998
|
organizationId: string;
|
|
999
|
-
role: "
|
|
999
|
+
role: "owner" | "admin" | "member";
|
|
1000
1000
|
createdAt: Date;
|
|
1001
1001
|
userId: string;
|
|
1002
1002
|
user: {
|
|
@@ -1012,7 +1012,7 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
1012
1012
|
members: {
|
|
1013
1013
|
id: string;
|
|
1014
1014
|
organizationId: string;
|
|
1015
|
-
role: "
|
|
1015
|
+
role: "owner" | "admin" | "member";
|
|
1016
1016
|
createdAt: Date;
|
|
1017
1017
|
userId: string;
|
|
1018
1018
|
user: {
|
|
@@ -1026,7 +1026,7 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
|
|
|
1026
1026
|
id: string;
|
|
1027
1027
|
organizationId: string;
|
|
1028
1028
|
email: string;
|
|
1029
|
-
role: "
|
|
1029
|
+
role: "owner" | "admin" | "member";
|
|
1030
1030
|
status: better_auth_plugins0.InvitationStatus;
|
|
1031
1031
|
inviterId: string;
|
|
1032
1032
|
expiresAt: Date;
|
|
@@ -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 "organization" | "
|
|
1108
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
1107
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
1108
|
+
actions: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", 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<"organization" | "
|
|
1111
|
+
statements: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
1112
1112
|
};
|
|
1113
1113
|
admin: {
|
|
1114
|
-
authorize<K_1 extends "organization" | "
|
|
1115
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
1114
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
1115
|
+
actions: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", 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<"organization" | "
|
|
1118
|
+
statements: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
1119
1119
|
};
|
|
1120
1120
|
owner: {
|
|
1121
|
-
authorize<K_1 extends "organization" | "
|
|
1122
|
-
actions: better_auth_plugins0.Subset<"organization" | "
|
|
1121
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
1122
|
+
actions: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", 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<"organization" | "
|
|
1125
|
+
statements: better_auth_plugins0.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
1126
1126
|
};
|
|
1127
1127
|
};
|
|
1128
1128
|
membershipLimit: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -796,25 +796,25 @@ declare const auth: better_auth78.Auth<{
|
|
|
796
796
|
ac: better_auth_plugins69.AccessControl;
|
|
797
797
|
roles: {
|
|
798
798
|
member: {
|
|
799
|
-
authorize<K_1 extends "organization" | "
|
|
800
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
799
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
|
|
800
|
+
actions: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key];
|
|
801
801
|
connector: "OR" | "AND";
|
|
802
802
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
803
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
803
|
+
statements: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>;
|
|
804
804
|
};
|
|
805
805
|
admin: {
|
|
806
|
-
authorize<K_1 extends "organization" | "
|
|
807
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
806
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
|
|
807
|
+
actions: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key];
|
|
808
808
|
connector: "OR" | "AND";
|
|
809
809
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
810
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
810
|
+
statements: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>;
|
|
811
811
|
};
|
|
812
812
|
owner: {
|
|
813
|
-
authorize<K_1 extends "organization" | "
|
|
814
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
813
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
|
|
814
|
+
actions: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key];
|
|
815
815
|
connector: "OR" | "AND";
|
|
816
816
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
817
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
817
|
+
statements: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>;
|
|
818
818
|
};
|
|
819
819
|
};
|
|
820
820
|
membershipLimit: number;
|
|
@@ -988,7 +988,7 @@ declare const auth: better_auth78.Auth<{
|
|
|
988
988
|
id: string;
|
|
989
989
|
organizationId: string;
|
|
990
990
|
email: string;
|
|
991
|
-
role: "
|
|
991
|
+
role: "owner" | "admin" | "member";
|
|
992
992
|
status: better_auth_plugins69.InvitationStatus;
|
|
993
993
|
inviterId: string;
|
|
994
994
|
expiresAt: Date;
|
|
@@ -997,7 +997,7 @@ declare const auth: better_auth78.Auth<{
|
|
|
997
997
|
Member: {
|
|
998
998
|
id: string;
|
|
999
999
|
organizationId: string;
|
|
1000
|
-
role: "
|
|
1000
|
+
role: "owner" | "admin" | "member";
|
|
1001
1001
|
createdAt: Date;
|
|
1002
1002
|
userId: string;
|
|
1003
1003
|
user: {
|
|
@@ -1013,7 +1013,7 @@ declare const auth: better_auth78.Auth<{
|
|
|
1013
1013
|
members: {
|
|
1014
1014
|
id: string;
|
|
1015
1015
|
organizationId: string;
|
|
1016
|
-
role: "
|
|
1016
|
+
role: "owner" | "admin" | "member";
|
|
1017
1017
|
createdAt: Date;
|
|
1018
1018
|
userId: string;
|
|
1019
1019
|
user: {
|
|
@@ -1027,7 +1027,7 @@ declare const auth: better_auth78.Auth<{
|
|
|
1027
1027
|
id: string;
|
|
1028
1028
|
organizationId: string;
|
|
1029
1029
|
email: string;
|
|
1030
|
-
role: "
|
|
1030
|
+
role: "owner" | "admin" | "member";
|
|
1031
1031
|
status: better_auth_plugins69.InvitationStatus;
|
|
1032
1032
|
inviterId: string;
|
|
1033
1033
|
expiresAt: Date;
|
|
@@ -1105,25 +1105,25 @@ declare const auth: better_auth78.Auth<{
|
|
|
1105
1105
|
ac: better_auth_plugins69.AccessControl;
|
|
1106
1106
|
roles: {
|
|
1107
1107
|
member: {
|
|
1108
|
-
authorize<K_1 extends "organization" | "
|
|
1109
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
1108
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
|
|
1109
|
+
actions: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key];
|
|
1110
1110
|
connector: "OR" | "AND";
|
|
1111
1111
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
1112
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
1112
|
+
statements: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>;
|
|
1113
1113
|
};
|
|
1114
1114
|
admin: {
|
|
1115
|
-
authorize<K_1 extends "organization" | "
|
|
1116
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
1115
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
|
|
1116
|
+
actions: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key];
|
|
1117
1117
|
connector: "OR" | "AND";
|
|
1118
1118
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
1119
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
1119
|
+
statements: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>;
|
|
1120
1120
|
};
|
|
1121
1121
|
owner: {
|
|
1122
|
-
authorize<K_1 extends "organization" | "
|
|
1123
|
-
actions: better_auth_plugins69.Subset<"organization" | "
|
|
1122
|
+
authorize<K_1 extends "organization" | "project" | "member" | "invitation" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
|
|
1123
|
+
actions: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>[key];
|
|
1124
1124
|
connector: "OR" | "AND";
|
|
1125
1125
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
1126
|
-
statements: better_auth_plugins69.Subset<"organization" | "
|
|
1126
|
+
statements: better_auth_plugins69.Subset<"organization" | "project" | "member" | "invitation" | "team" | "ac", better_auth_plugins69.Statements>;
|
|
1127
1127
|
};
|
|
1128
1128
|
};
|
|
1129
1129
|
membershipLimit: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono0 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: () => hono0.MiddlewareHandler<{
|
|
11
11
|
Variables: {
|
|
12
12
|
executionContext: BaseExecutionContext;
|
|
13
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono1 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: () => hono1.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 hono2 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) => hono2.MiddlewareHandler<Env$1, string, {}, Response>;
|
|
30
30
|
//#endregion
|
|
31
31
|
export { ProjectPermission, requireProjectPermission };
|