@inkeep/agents-core 0.78.3 → 0.78.5

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.
Files changed (66) hide show
  1. package/dist/auth/auth-validation-schemas.d.ts +154 -154
  2. package/dist/auth/auth.d.ts +9 -9
  3. package/dist/auth/permissions.d.ts +13 -13
  4. package/dist/client-exports.d.ts +2 -2
  5. package/dist/client-exports.js +2 -2
  6. package/dist/data-access/index.d.ts +6 -6
  7. package/dist/data-access/index.js +6 -6
  8. package/dist/data-access/manage/agents.d.ts +15 -15
  9. package/dist/data-access/manage/artifactComponents.d.ts +4 -4
  10. package/dist/data-access/manage/contextConfigs.d.ts +8 -8
  11. package/dist/data-access/manage/dataComponents.d.ts +2 -2
  12. package/dist/data-access/manage/evalConfig.d.ts +19 -2
  13. package/dist/data-access/manage/evalConfig.js +20 -2
  14. package/dist/data-access/manage/functionTools.d.ts +6 -6
  15. package/dist/data-access/manage/skills.d.ts +7 -7
  16. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +6 -6
  17. package/dist/data-access/manage/subAgentRelations.d.ts +12 -12
  18. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +6 -6
  19. package/dist/data-access/manage/subAgents.d.ts +9 -9
  20. package/dist/data-access/manage/tools.d.ts +15 -15
  21. package/dist/data-access/manage/triggers.d.ts +3 -3
  22. package/dist/data-access/manage/webhookDestinations.d.ts +15 -3
  23. package/dist/data-access/manage/webhookDestinations.js +26 -8
  24. package/dist/data-access/runtime/apiKeys.d.ts +4 -4
  25. package/dist/data-access/runtime/apps.d.ts +7 -7
  26. package/dist/data-access/runtime/conversations.d.ts +12 -12
  27. package/dist/data-access/runtime/evalRuns.d.ts +47 -6
  28. package/dist/data-access/runtime/evalRuns.js +96 -6
  29. package/dist/data-access/runtime/events.d.ts +3 -3
  30. package/dist/data-access/runtime/feedback.d.ts +2 -2
  31. package/dist/data-access/runtime/messages.d.ts +15 -15
  32. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +39 -7
  33. package/dist/data-access/runtime/scheduledTriggerInvocations.js +16 -3
  34. package/dist/data-access/runtime/scheduledTriggers.d.ts +28 -6
  35. package/dist/data-access/runtime/scheduledTriggers.js +34 -7
  36. package/dist/data-access/runtime/tasks.d.ts +1 -1
  37. package/dist/db/manage/manage-schema.d.ts +686 -385
  38. package/dist/db/manage/manage-schema.js +120 -2
  39. package/dist/db/runtime/runtime-schema.d.ts +472 -453
  40. package/dist/db/runtime/runtime-schema.js +3 -1
  41. package/dist/evaluation/pass-criteria-evaluator.js +69 -29
  42. package/dist/index.d.ts +10 -10
  43. package/dist/index.js +9 -9
  44. package/dist/types/entities.d.ts +5 -2
  45. package/dist/types/index.d.ts +3 -3
  46. package/dist/types/index.js +2 -2
  47. package/dist/types/utility.d.ts +13 -5
  48. package/dist/types/utility.js +2 -1
  49. package/dist/utils/error.d.ts +51 -51
  50. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  51. package/dist/validation/index.d.ts +2 -2
  52. package/dist/validation/index.js +2 -2
  53. package/dist/validation/schemas/shared.d.ts +1 -0
  54. package/dist/validation/schemas/shared.js +2 -1
  55. package/dist/validation/schemas/skills.d.ts +33 -32
  56. package/dist/validation/schemas.d.ts +2330 -1958
  57. package/dist/validation/schemas.js +64 -10
  58. package/drizzle/manage/0022_last_nemesis.sql +15 -0
  59. package/drizzle/manage/0023_flimsy_patriot.sql +13 -0
  60. package/drizzle/manage/meta/0022_snapshot.json +4216 -0
  61. package/drizzle/manage/meta/0023_snapshot.json +4317 -0
  62. package/drizzle/manage/meta/_journal.json +14 -0
  63. package/drizzle/runtime/0043_normal_beyonder.sql +2 -0
  64. package/drizzle/runtime/meta/0043_snapshot.json +6304 -0
  65. package/drizzle/runtime/meta/_journal.json +7 -0
  66. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { agentDatasetRelations, agentEvaluatorRelations, dataset, datasetItem, datasetRunConfig, datasetRunConfigAgentRelations, evaluationJobConfig, evaluationJobConfigEvaluatorRelations, evaluationRunConfig, evaluationRunConfigEvaluationSuiteConfigRelations, evaluationSuiteConfig, evaluationSuiteConfigEvaluatorRelations, evaluator } from "../../db/manage/manage-schema.js";
1
+ import { agentDatasetRelations, agentEvaluatorRelations, dataset, datasetItem, datasetRunConfig, datasetRunConfigAgentRelations, datasetRunConfigEvaluatorRelations, evaluationJobConfig, evaluationJobConfigEvaluatorRelations, evaluationRunConfig, evaluationRunConfigEvaluationSuiteConfigRelations, evaluationSuiteConfig, evaluationSuiteConfigEvaluatorRelations, evaluator } from "../../db/manage/manage-schema.js";
2
2
  import { datasetRun } from "../../db/runtime/runtime-schema.js";
3
3
  import { projectScopedWhere } from "./scope-helpers.js";
4
4
  import { and, eq, inArray, isNull, or } from "drizzle-orm";
@@ -103,6 +103,24 @@ const createDatasetRunConfigAgentRelation = (db) => async (data) => {
103
103
  const deleteDatasetRunConfigAgentRelation = (db) => async (params) => {
104
104
  return (await db.delete(datasetRunConfigAgentRelations).where(and(projectScopedWhere(datasetRunConfigAgentRelations, params.scopes), eq(datasetRunConfigAgentRelations.datasetRunConfigId, params.scopes.datasetRunConfigId), eq(datasetRunConfigAgentRelations.agentId, params.scopes.agentId))).returning()).length > 0;
105
105
  };
106
+ const getDatasetRunConfigEvaluatorRelations = (db) => async (params) => {
107
+ return await db.select().from(datasetRunConfigEvaluatorRelations).where(and(projectScopedWhere(datasetRunConfigEvaluatorRelations, params.scopes), eq(datasetRunConfigEvaluatorRelations.datasetRunConfigId, params.scopes.datasetRunConfigId)));
108
+ };
109
+ const createDatasetRunConfigEvaluatorRelation = (db) => async (data) => {
110
+ const now = (/* @__PURE__ */ new Date()).toISOString();
111
+ const [created] = await db.insert(datasetRunConfigEvaluatorRelations).values({
112
+ ...data,
113
+ createdAt: now,
114
+ updatedAt: now
115
+ }).returning();
116
+ return created;
117
+ };
118
+ const deleteDatasetRunConfigEvaluatorRelation = (db) => async (params) => {
119
+ return (await db.delete(datasetRunConfigEvaluatorRelations).where(and(projectScopedWhere(datasetRunConfigEvaluatorRelations, params.scopes), eq(datasetRunConfigEvaluatorRelations.datasetRunConfigId, params.scopes.datasetRunConfigId), eq(datasetRunConfigEvaluatorRelations.evaluatorId, params.scopes.evaluatorId))).returning()).length > 0;
120
+ };
121
+ const deleteDatasetRunConfigEvaluatorRelationsByConfigId = (db) => async (params) => {
122
+ await db.delete(datasetRunConfigEvaluatorRelations).where(and(projectScopedWhere(datasetRunConfigEvaluatorRelations, params.scopes), eq(datasetRunConfigEvaluatorRelations.datasetRunConfigId, params.scopes.datasetRunConfigId)));
123
+ };
106
124
  const getEvaluatorById = (db) => async (params) => {
107
125
  return (await db.select().from(evaluator).where(and(projectScopedWhere(evaluator, params.scopes), eq(evaluator.id, params.scopes.evaluatorId))).limit(1))[0] ?? null;
108
126
  };
@@ -331,4 +349,4 @@ const getAgentIdsForEvaluators = (db) => async (params) => {
331
349
  };
332
350
 
333
351
  //#endregion
334
- export { createAgentDatasetRelation, createAgentEvaluatorRelation, createDataset, createDatasetItem, createDatasetItems, createDatasetRunConfig, createDatasetRunConfigAgentRelation, createEvaluationJobConfig, createEvaluationJobConfigEvaluatorRelation, createEvaluationRunConfig, createEvaluationRunConfigEvaluationSuiteConfigRelation, createEvaluationSuiteConfig, createEvaluationSuiteConfigEvaluatorRelation, createEvaluator, deleteAgentDatasetRelation, deleteAgentEvaluatorRelation, deleteDataset, deleteDatasetItem, deleteDatasetItemsByDataset, deleteDatasetRunConfig, deleteDatasetRunConfigAgentRelation, deleteEvaluationJobConfig, deleteEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfigEvaluatorRelationsByEvaluator, deleteEvaluationRunConfig, deleteEvaluationRunConfigEvaluationSuiteConfigRelation, deleteEvaluationSuiteConfig, deleteEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfigEvaluatorRelationsByEvaluator, deleteEvaluator, getAgentDatasetRelationsByAgent, getAgentDatasetRelationsByDataset, getAgentEvaluatorRelationsByAgent, getAgentEvaluatorRelationsByEvaluator, getAgentIdsForEvaluators, getDatasetById, getDatasetItemById, getDatasetRunConfigAgentRelations, getDatasetRunConfigById, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluationRunConfigById, getEvaluationRunConfigEvaluationSuiteConfigRelations, getEvaluationSuiteConfigById, getEvaluationSuiteConfigEvaluatorRelations, getEvaluatorById, getEvaluatorsByIds, linkDatasetRunToEvaluationJobConfig, listDatasetItems, listDatasetRunConfigs, listDatasets, listDatasetsForAgent, listEvaluationJobConfigs, listEvaluationRunConfigs, listEvaluationRunConfigsWithSuiteConfigs, listEvaluationSuiteConfigs, listEvaluators, listEvaluatorsForAgent, updateDataset, updateDatasetItem, updateDatasetRunConfig, updateEvaluationRunConfig, updateEvaluationSuiteConfig, updateEvaluator };
352
+ export { createAgentDatasetRelation, createAgentEvaluatorRelation, createDataset, createDatasetItem, createDatasetItems, createDatasetRunConfig, createDatasetRunConfigAgentRelation, createDatasetRunConfigEvaluatorRelation, createEvaluationJobConfig, createEvaluationJobConfigEvaluatorRelation, createEvaluationRunConfig, createEvaluationRunConfigEvaluationSuiteConfigRelation, createEvaluationSuiteConfig, createEvaluationSuiteConfigEvaluatorRelation, createEvaluator, deleteAgentDatasetRelation, deleteAgentEvaluatorRelation, deleteDataset, deleteDatasetItem, deleteDatasetItemsByDataset, deleteDatasetRunConfig, deleteDatasetRunConfigAgentRelation, deleteDatasetRunConfigEvaluatorRelation, deleteDatasetRunConfigEvaluatorRelationsByConfigId, deleteEvaluationJobConfig, deleteEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfigEvaluatorRelationsByEvaluator, deleteEvaluationRunConfig, deleteEvaluationRunConfigEvaluationSuiteConfigRelation, deleteEvaluationSuiteConfig, deleteEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfigEvaluatorRelationsByEvaluator, deleteEvaluator, getAgentDatasetRelationsByAgent, getAgentDatasetRelationsByDataset, getAgentEvaluatorRelationsByAgent, getAgentEvaluatorRelationsByEvaluator, getAgentIdsForEvaluators, getDatasetById, getDatasetItemById, getDatasetRunConfigAgentRelations, getDatasetRunConfigById, getDatasetRunConfigEvaluatorRelations, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluationRunConfigById, getEvaluationRunConfigEvaluationSuiteConfigRelations, getEvaluationSuiteConfigById, getEvaluationSuiteConfigEvaluatorRelations, getEvaluatorById, getEvaluatorsByIds, linkDatasetRunToEvaluationJobConfig, listDatasetItems, listDatasetRunConfigs, listDatasets, listDatasetsForAgent, listEvaluationJobConfigs, listEvaluationRunConfigs, listEvaluationRunConfigsWithSuiteConfigs, listEvaluationSuiteConfigs, listEvaluators, listEvaluatorsForAgent, updateDataset, updateDatasetItem, updateDatasetRunConfig, updateEvaluationRunConfig, updateEvaluationSuiteConfig, updateEvaluator };
@@ -58,8 +58,8 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
58
58
  createdAt: string;
59
59
  updatedAt: string;
60
60
  description: string | null;
61
- tenantId: string;
62
61
  projectId: string;
62
+ tenantId: string;
63
63
  agentId: string;
64
64
  functionId: string;
65
65
  }>;
@@ -100,8 +100,8 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
100
100
  createdAt: string;
101
101
  updatedAt: string;
102
102
  description: string | null;
103
- tenantId: string;
104
103
  projectId: string;
104
+ tenantId: string;
105
105
  agentId: string;
106
106
  functionId: string;
107
107
  }>;
@@ -160,14 +160,14 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
160
160
  id: string;
161
161
  createdAt: string;
162
162
  updatedAt: string;
163
- tenantId: string;
164
163
  projectId: string;
164
+ tenantId: string;
165
165
  agentId: string;
166
166
  subAgentId: string;
167
+ functionToolId: string;
167
168
  toolPolicies: Record<string, {
168
169
  needsApproval?: boolean;
169
170
  }> | null;
170
- functionToolId: string;
171
171
  }>;
172
172
  /**
173
173
  * Update an agent-function tool relation
@@ -225,14 +225,14 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
225
225
  id: string;
226
226
  createdAt: string;
227
227
  updatedAt: string;
228
- tenantId: string;
229
228
  projectId: string;
229
+ tenantId: string;
230
230
  agentId: string;
231
231
  subAgentId: string;
232
+ functionToolId: string;
232
233
  toolPolicies: Record<string, {
233
234
  needsApproval?: boolean;
234
235
  }> | null;
235
- functionToolId: string;
236
236
  }>;
237
237
  //#endregion
238
238
  export { addFunctionToolToSubAgent, associateFunctionToolWithSubAgent, createFunctionTool, deleteFunctionTool, getFunctionToolById, getFunctionToolsForSubAgent, getSubAgentsUsingFunctionTool, isFunctionToolAssociatedWithSubAgent, listFunctionTools, removeFunctionToolFromSubAgent, updateFunctionTool, updateSubAgentFunctionToolRelation, upsertFunctionTool, upsertSubAgentFunctionToolRelation };
@@ -21,9 +21,9 @@ declare const getSkillById: (db: AgentsManageDatabaseClient) => (params: {
21
21
  updatedAt: string;
22
22
  metadata: Record<string, string> | null;
23
23
  description: string;
24
- tenantId: string;
25
- projectId: string;
26
24
  content: string;
25
+ projectId: string;
26
+ tenantId: string;
27
27
  } | null>;
28
28
  declare const getSkillByIdWithFiles: (db: AgentsManageDatabaseClient) => (params: {
29
29
  scopes: ProjectScopeConfig;
@@ -116,9 +116,9 @@ declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillApiIn
116
116
  updatedAt: string;
117
117
  metadata: Record<string, string> | null;
118
118
  description: string;
119
- tenantId: string;
120
- projectId: string;
121
119
  content: string;
120
+ projectId: string;
121
+ tenantId: string;
122
122
  }>;
123
123
  declare const updateSkill: (db: AgentsManageDatabaseClient) => (params: {
124
124
  scopes: ProjectScopeConfig;
@@ -142,13 +142,13 @@ declare const upsertSubAgentSkill: (db: AgentsManageDatabaseClient) => (params:
142
142
  id: string;
143
143
  createdAt: string;
144
144
  updatedAt: string;
145
- tenantId: string;
146
145
  projectId: string;
146
+ tenantId: string;
147
147
  agentId: string;
148
- skillId: string;
148
+ subAgentId: string;
149
149
  index: number;
150
150
  alwaysLoaded: boolean;
151
- subAgentId: string;
151
+ skillId: string;
152
152
  }>;
153
153
  declare const deleteSubAgentSkill: (db: AgentsManageDatabaseClient) => (params: {
154
154
  scopes: AgentScopeConfig;
@@ -12,8 +12,8 @@ declare const getSubAgentExternalAgentRelationById: (db: AgentsManageDatabaseCli
12
12
  id: string;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
- tenantId: string;
16
15
  projectId: string;
16
+ tenantId: string;
17
17
  agentId: string;
18
18
  headers: Record<string, string> | null;
19
19
  subAgentId: string;
@@ -47,8 +47,8 @@ declare const getSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient
47
47
  id: string;
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
- tenantId: string;
51
50
  projectId: string;
51
+ tenantId: string;
52
52
  agentId: string;
53
53
  headers: Record<string, string> | null;
54
54
  subAgentId: string;
@@ -60,8 +60,8 @@ declare const getSubAgentExternalAgentRelationsByAgent: (db: AgentsManageDatabas
60
60
  id: string;
61
61
  createdAt: string;
62
62
  updatedAt: string;
63
- tenantId: string;
64
63
  projectId: string;
64
+ tenantId: string;
65
65
  agentId: string;
66
66
  headers: Record<string, string> | null;
67
67
  subAgentId: string;
@@ -189,8 +189,8 @@ declare const createSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
189
189
  id: string;
190
190
  createdAt: string;
191
191
  updatedAt: string;
192
- tenantId: string;
193
192
  projectId: string;
193
+ tenantId: string;
194
194
  agentId: string;
195
195
  headers: Record<string, string> | null;
196
196
  subAgentId: string;
@@ -206,8 +206,8 @@ declare const getSubAgentExternalAgentRelationByParams: (db: AgentsManageDatabas
206
206
  id: string;
207
207
  createdAt: string;
208
208
  updatedAt: string;
209
- tenantId: string;
210
209
  projectId: string;
210
+ tenantId: string;
211
211
  agentId: string;
212
212
  headers: Record<string, string> | null;
213
213
  subAgentId: string;
@@ -227,8 +227,8 @@ declare const upsertSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
227
227
  id: string;
228
228
  createdAt: string;
229
229
  updatedAt: string;
230
- tenantId: string;
231
230
  projectId: string;
231
+ tenantId: string;
232
232
  agentId: string;
233
233
  headers: Record<string, string> | null;
234
234
  subAgentId: string;
@@ -12,8 +12,8 @@ declare const getAgentRelationById: (db: AgentsManageDatabaseClient) => (params:
12
12
  id: string;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
- tenantId: string;
16
15
  projectId: string;
16
+ tenantId: string;
17
17
  agentId: string;
18
18
  sourceSubAgentId: string;
19
19
  targetSubAgentId: string | null;
@@ -47,8 +47,8 @@ declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
47
47
  id: string;
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
- tenantId: string;
51
50
  projectId: string;
51
+ tenantId: string;
52
52
  agentId: string;
53
53
  sourceSubAgentId: string;
54
54
  targetSubAgentId: string | null;
@@ -60,8 +60,8 @@ declare const getAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (par
60
60
  id: string;
61
61
  createdAt: string;
62
62
  updatedAt: string;
63
- tenantId: string;
64
63
  projectId: string;
64
+ tenantId: string;
65
65
  agentId: string;
66
66
  sourceSubAgentId: string;
67
67
  targetSubAgentId: string | null;
@@ -129,8 +129,8 @@ declare const createSubAgentRelation: (db: AgentsManageDatabaseClient) => (param
129
129
  id: string;
130
130
  createdAt: string;
131
131
  updatedAt: string;
132
- tenantId: string;
133
132
  projectId: string;
133
+ tenantId: string;
134
134
  agentId: string;
135
135
  sourceSubAgentId: string;
136
136
  targetSubAgentId: string | null;
@@ -148,8 +148,8 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
148
148
  id: string;
149
149
  createdAt: string;
150
150
  updatedAt: string;
151
- tenantId: string;
152
151
  projectId: string;
152
+ tenantId: string;
153
153
  agentId: string;
154
154
  sourceSubAgentId: string;
155
155
  targetSubAgentId: string | null;
@@ -162,8 +162,8 @@ declare const upsertSubAgentRelation: (db: AgentsManageDatabaseClient) => (param
162
162
  id: string;
163
163
  createdAt: string;
164
164
  updatedAt: string;
165
- tenantId: string;
166
165
  projectId: string;
166
+ tenantId: string;
167
167
  agentId: string;
168
168
  sourceSubAgentId: string;
169
169
  targetSubAgentId: string | null;
@@ -207,16 +207,16 @@ declare const createAgentToolRelation: (db: AgentsManageDatabaseClient) => (para
207
207
  id: string;
208
208
  createdAt: string;
209
209
  updatedAt: string;
210
- tenantId: string;
211
210
  projectId: string;
211
+ tenantId: string;
212
212
  agentId: string;
213
- toolId: string;
214
213
  headers: Record<string, string> | null;
215
214
  subAgentId: string;
216
- selectedTools: string[] | null;
215
+ toolId: string;
217
216
  toolPolicies: Record<string, {
218
217
  needsApproval?: boolean;
219
218
  }> | null;
219
+ selectedTools: string[] | null;
220
220
  }>;
221
221
  declare const updateAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
222
222
  scopes: AgentScopeConfig;
@@ -251,16 +251,16 @@ declare const getAgentToolRelationById: (db: AgentsManageDatabaseClient) => (par
251
251
  id: string;
252
252
  createdAt: string;
253
253
  updatedAt: string;
254
- tenantId: string;
255
254
  projectId: string;
255
+ tenantId: string;
256
256
  agentId: string;
257
- toolId: string;
258
257
  headers: Record<string, string> | null;
259
258
  subAgentId: string;
260
- selectedTools: string[] | null;
259
+ toolId: string;
261
260
  toolPolicies: Record<string, {
262
261
  needsApproval?: boolean;
263
262
  }> | null;
263
+ selectedTools: string[] | null;
264
264
  } | undefined>;
265
265
  declare const getAgentToolRelationByAgent: (db: AgentsManageDatabaseClient) => (params: {
266
266
  scopes: SubAgentScopeConfig;
@@ -12,8 +12,8 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
12
12
  id: string;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
- tenantId: string;
16
15
  projectId: string;
16
+ tenantId: string;
17
17
  agentId: string;
18
18
  headers: Record<string, string> | null;
19
19
  subAgentId: string;
@@ -47,8 +47,8 @@ declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =>
47
47
  id: string;
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
- tenantId: string;
51
50
  projectId: string;
51
+ tenantId: string;
52
52
  agentId: string;
53
53
  headers: Record<string, string> | null;
54
54
  subAgentId: string;
@@ -60,8 +60,8 @@ declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseCli
60
60
  id: string;
61
61
  createdAt: string;
62
62
  updatedAt: string;
63
- tenantId: string;
64
63
  projectId: string;
64
+ tenantId: string;
65
65
  agentId: string;
66
66
  headers: Record<string, string> | null;
67
67
  subAgentId: string;
@@ -225,8 +225,8 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
225
225
  id: string;
226
226
  createdAt: string;
227
227
  updatedAt: string;
228
- tenantId: string;
229
228
  projectId: string;
229
+ tenantId: string;
230
230
  agentId: string;
231
231
  headers: Record<string, string> | null;
232
232
  subAgentId: string;
@@ -242,8 +242,8 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
242
242
  id: string;
243
243
  createdAt: string;
244
244
  updatedAt: string;
245
- tenantId: string;
246
245
  projectId: string;
246
+ tenantId: string;
247
247
  agentId: string;
248
248
  headers: Record<string, string> | null;
249
249
  subAgentId: string;
@@ -263,8 +263,8 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
263
263
  id: string;
264
264
  createdAt: string;
265
265
  updatedAt: string;
266
- tenantId: string;
267
266
  projectId: string;
267
+ tenantId: string;
268
268
  agentId: string;
269
269
  headers: Record<string, string> | null;
270
270
  subAgentId: string;
@@ -14,6 +14,8 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
14
14
  createdAt: string;
15
15
  updatedAt: string;
16
16
  description: string | null;
17
+ projectId: string;
18
+ tenantId: string;
17
19
  models: {
18
20
  base?: {
19
21
  model?: string | undefined;
@@ -37,10 +39,8 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
37
39
  stopWhen: {
38
40
  stepCountIs?: number | undefined;
39
41
  } | null;
40
- tenantId: string;
41
- prompt: string | null;
42
- projectId: string;
43
42
  agentId: string;
43
+ prompt: string | null;
44
44
  conversationHistoryConfig: ConversationHistoryConfig | null;
45
45
  outputContract: {
46
46
  [x: string]: unknown;
@@ -60,6 +60,8 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
60
60
  createdAt: string;
61
61
  updatedAt: string;
62
62
  description: string | null;
63
+ projectId: string;
64
+ tenantId: string;
63
65
  models: {
64
66
  base?: {
65
67
  model?: string | undefined;
@@ -83,10 +85,8 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
83
85
  stopWhen: {
84
86
  stepCountIs?: number | undefined;
85
87
  } | null;
86
- tenantId: string;
87
- prompt: string | null;
88
- projectId: string;
89
88
  agentId: string;
89
+ prompt: string | null;
90
90
  conversationHistoryConfig: ConversationHistoryConfig | null;
91
91
  outputContract: {
92
92
  [x: string]: unknown;
@@ -159,6 +159,8 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
159
159
  createdAt: string;
160
160
  updatedAt: string;
161
161
  description: string | null;
162
+ projectId: string;
163
+ tenantId: string;
162
164
  models: {
163
165
  base?: {
164
166
  model?: string | undefined;
@@ -182,10 +184,8 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
182
184
  stopWhen: {
183
185
  stepCountIs?: number | undefined;
184
186
  } | null;
185
- tenantId: string;
186
- prompt: string | null;
187
- projectId: string;
188
187
  agentId: string;
188
+ prompt: string | null;
189
189
  conversationHistoryConfig: ConversationHistoryConfig | null;
190
190
  outputContract: {
191
191
  [x: string]: unknown;
@@ -25,14 +25,14 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
25
25
  createdAt: string;
26
26
  updatedAt: string;
27
27
  description: string | null;
28
- tenantId: string;
29
28
  projectId: string;
29
+ tenantId: string;
30
30
  headers: Record<string, string> | null;
31
- credentialReferenceId: string | null;
32
31
  config: {
33
32
  type: "mcp";
34
33
  mcp: ToolMcpConfig;
35
34
  };
35
+ credentialReferenceId: string | null;
36
36
  credentialScope: string;
37
37
  imageUrl: string | null;
38
38
  capabilities: ToolServerCapabilities | null;
@@ -83,14 +83,14 @@ declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInser
83
83
  createdAt: string;
84
84
  updatedAt: string;
85
85
  description: string | null;
86
- tenantId: string;
87
86
  projectId: string;
87
+ tenantId: string;
88
88
  headers: Record<string, string> | null;
89
- credentialReferenceId: string | null;
90
89
  config: {
91
90
  type: "mcp";
92
91
  mcp: ToolMcpConfig;
93
92
  };
93
+ credentialReferenceId: string | null;
94
94
  credentialScope: string;
95
95
  imageUrl: string | null;
96
96
  capabilities: ToolServerCapabilities | null;
@@ -138,16 +138,16 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
138
138
  id: string;
139
139
  createdAt: string;
140
140
  updatedAt: string;
141
- tenantId: string;
142
141
  projectId: string;
142
+ tenantId: string;
143
143
  agentId: string;
144
- toolId: string;
145
144
  headers: Record<string, string> | null;
146
145
  subAgentId: string;
147
- selectedTools: string[] | null;
146
+ toolId: string;
148
147
  toolPolicies: Record<string, {
149
148
  needsApproval?: boolean;
150
149
  }> | null;
150
+ selectedTools: string[] | null;
151
151
  }>;
152
152
  declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
153
153
  scopes: AgentScopeConfig;
@@ -157,16 +157,16 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
157
157
  id: string;
158
158
  createdAt: string;
159
159
  updatedAt: string;
160
- tenantId: string;
161
160
  projectId: string;
161
+ tenantId: string;
162
162
  agentId: string;
163
- toolId: string;
164
163
  headers: Record<string, string> | null;
165
164
  subAgentId: string;
166
- selectedTools: string[] | null;
165
+ toolId: string;
167
166
  toolPolicies: Record<string, {
168
167
  needsApproval?: boolean;
169
168
  }> | null;
169
+ selectedTools: string[] | null;
170
170
  }>;
171
171
  /**
172
172
  * Upsert agent-tool relation (create if it doesn't exist, update if it does)
@@ -185,16 +185,16 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
185
185
  id: string;
186
186
  createdAt: string;
187
187
  updatedAt: string;
188
- tenantId: string;
189
188
  projectId: string;
189
+ tenantId: string;
190
190
  agentId: string;
191
- toolId: string;
192
191
  headers: Record<string, string> | null;
193
192
  subAgentId: string;
194
- selectedTools: string[] | null;
193
+ toolId: string;
195
194
  toolPolicies: Record<string, {
196
195
  needsApproval?: boolean;
197
196
  }> | null;
197
+ selectedTools: string[] | null;
198
198
  }>;
199
199
  /**
200
200
  * Upsert a tool (create if it doesn't exist, update if it does)
@@ -207,14 +207,14 @@ declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
207
207
  createdAt: string;
208
208
  updatedAt: string;
209
209
  description: string | null;
210
- tenantId: string;
211
210
  projectId: string;
211
+ tenantId: string;
212
212
  headers: Record<string, string> | null;
213
- credentialReferenceId: string | null;
214
213
  config: {
215
214
  type: "mcp";
216
215
  mcp: ToolMcpConfig;
217
216
  };
217
+ credentialReferenceId: string | null;
218
218
  credentialScope: string;
219
219
  imageUrl: string | null;
220
220
  capabilities: ToolServerCapabilities | null;
@@ -40,13 +40,13 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
40
40
  algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
41
41
  encoding: "hex" | "base64";
42
42
  signature: {
43
- source: "query" | "header" | "body";
43
+ source: "query" | "body" | "header";
44
44
  key: string;
45
45
  prefix?: string | undefined;
46
46
  regex?: string | undefined;
47
47
  };
48
48
  signedComponents: {
49
- source: "literal" | "header" | "body";
49
+ source: "literal" | "body" | "header";
50
50
  required: boolean;
51
51
  key?: string | undefined;
52
52
  value?: string | undefined;
@@ -133,8 +133,8 @@ declare const createTriggerUser: (db: AgentsManageDatabaseClient) => (params: {
133
133
  }) => Promise<{
134
134
  createdAt: string;
135
135
  userId: string;
136
- tenantId: string;
137
136
  projectId: string;
137
+ tenantId: string;
138
138
  agentId: string;
139
139
  triggerId: string;
140
140
  }>;
@@ -33,13 +33,16 @@ declare const listWebhookDestinationsPaginated: (db: AgentsManageDatabaseClient)
33
33
  pages: number;
34
34
  };
35
35
  }>;
36
- type WebhookDestinationWithAgents = WebhookDestinationSelect & {
36
+ type WebhookDestinationWithScoping = WebhookDestinationSelect & {
37
37
  agentIds: string[];
38
+ evaluatorIds: string[];
38
39
  };
40
+ /** @deprecated Use {@link WebhookDestinationWithScoping} instead. */
41
+ type WebhookDestinationWithAgents = WebhookDestinationWithScoping;
39
42
  declare const listEnabledWebhookDestinations: (db: AgentsManageDatabaseClient) => (params: {
40
43
  scopes: ProjectScopeConfig;
41
44
  agentId: string;
42
- }) => Promise<WebhookDestinationWithAgents[]>;
45
+ }) => Promise<WebhookDestinationWithScoping[]>;
43
46
  declare const createWebhookDestination: (db: AgentsManageDatabaseClient) => (params: WebhookDestinationInsert) => Promise<WebhookDestinationSelect>;
44
47
  declare const updateWebhookDestination: (db: AgentsManageDatabaseClient) => (params: {
45
48
  scopes: ProjectScopeConfig;
@@ -59,5 +62,14 @@ declare const setWebhookDestinationAgentIds: (db: AgentsManageDatabaseClient) =>
59
62
  webhookDestinationId: string;
60
63
  agentIds: string[];
61
64
  }) => Promise<void>;
65
+ declare const getWebhookDestinationEvaluatorIds: (db: AgentsManageDatabaseClient) => (params: {
66
+ scopes: ProjectScopeConfig;
67
+ webhookDestinationId: string;
68
+ }) => Promise<string[]>;
69
+ declare const setWebhookDestinationEvaluatorIds: (db: AgentsManageDatabaseClient) => (params: {
70
+ scopes: ProjectScopeConfig;
71
+ webhookDestinationId: string;
72
+ evaluatorIds: string[];
73
+ }) => Promise<void>;
62
74
  //#endregion
63
- export { WebhookDestinationWithAgents, createWebhookDestination, deleteWebhookDestination, getWebhookDestinationAgentIds, getWebhookDestinationById, listEnabledWebhookDestinations, listWebhookDestinationsPaginated, setWebhookDestinationAgentIds, updateWebhookDestination };
75
+ export { WebhookDestinationWithAgents, WebhookDestinationWithScoping, createWebhookDestination, deleteWebhookDestination, getWebhookDestinationAgentIds, getWebhookDestinationById, getWebhookDestinationEvaluatorIds, listEnabledWebhookDestinations, listWebhookDestinationsPaginated, setWebhookDestinationAgentIds, setWebhookDestinationEvaluatorIds, updateWebhookDestination };
@@ -1,4 +1,4 @@
1
- import { webhookDestinationAgents, webhookDestinations } from "../../db/manage/manage-schema.js";
1
+ import { webhookDestinationAgents, webhookDestinationEvaluators, webhookDestinations } from "../../db/manage/manage-schema.js";
2
2
  import { generateId } from "../../utils/conversations.js";
3
3
  import { projectScopedWhere } from "./scope-helpers.js";
4
4
  import { and, count, desc, eq, inArray } from "drizzle-orm";
@@ -65,22 +65,26 @@ const listEnabledWebhookDestinations = (db) => async (params) => {
65
65
  const { scopes, agentId } = params;
66
66
  const rows = await db.select({
67
67
  dest: webhookDestinations,
68
- scopedAgentId: webhookDestinationAgents.agentId
69
- }).from(webhookDestinations).leftJoin(webhookDestinationAgents, and(eq(webhookDestinationAgents.tenantId, webhookDestinations.tenantId), eq(webhookDestinationAgents.projectId, webhookDestinations.projectId), eq(webhookDestinationAgents.webhookDestinationId, webhookDestinations.id))).where(and(projectScopedWhere(webhookDestinations, scopes), eq(webhookDestinations.enabled, true)));
68
+ scopedAgentId: webhookDestinationAgents.agentId,
69
+ scopedEvaluatorId: webhookDestinationEvaluators.evaluatorId
70
+ }).from(webhookDestinations).leftJoin(webhookDestinationAgents, and(eq(webhookDestinationAgents.tenantId, webhookDestinations.tenantId), eq(webhookDestinationAgents.projectId, webhookDestinations.projectId), eq(webhookDestinationAgents.webhookDestinationId, webhookDestinations.id))).leftJoin(webhookDestinationEvaluators, and(eq(webhookDestinationEvaluators.tenantId, webhookDestinations.tenantId), eq(webhookDestinationEvaluators.projectId, webhookDestinations.projectId), eq(webhookDestinationEvaluators.webhookDestinationId, webhookDestinations.id))).where(and(projectScopedWhere(webhookDestinations, scopes), eq(webhookDestinations.enabled, true)));
70
71
  if (rows.length === 0) return [];
71
72
  const destMap = /* @__PURE__ */ new Map();
72
73
  for (const row of rows) {
73
74
  const existing = destMap.get(row.dest.id);
74
75
  if (existing) {
75
- if (row.scopedAgentId) existing.agentIds.push(row.scopedAgentId);
76
+ if (row.scopedAgentId) existing.agentIds.add(row.scopedAgentId);
77
+ if (row.scopedEvaluatorId) existing.evaluatorIds.add(row.scopedEvaluatorId);
76
78
  } else destMap.set(row.dest.id, {
77
79
  dest: row.dest,
78
- agentIds: row.scopedAgentId ? [row.scopedAgentId] : []
80
+ agentIds: new Set(row.scopedAgentId ? [row.scopedAgentId] : []),
81
+ evaluatorIds: new Set(row.scopedEvaluatorId ? [row.scopedEvaluatorId] : [])
79
82
  });
80
83
  }
81
- return Array.from(destMap.values()).filter(({ agentIds }) => agentIds.length === 0 || agentIds.includes(agentId)).map(({ dest, agentIds }) => ({
84
+ return Array.from(destMap.values()).filter(({ agentIds }) => agentIds.size === 0 || agentIds.has(agentId)).map(({ dest, agentIds, evaluatorIds }) => ({
82
85
  ...dest,
83
- agentIds
86
+ agentIds: Array.from(agentIds),
87
+ evaluatorIds: Array.from(evaluatorIds)
84
88
  }));
85
89
  };
86
90
  const createWebhookDestination = (db) => async (params) => {
@@ -110,6 +114,20 @@ const setWebhookDestinationAgentIds = (db) => async (params) => {
110
114
  agentId
111
115
  })));
112
116
  };
117
+ const getWebhookDestinationEvaluatorIds = (db) => async (params) => {
118
+ return (await db.select({ evaluatorId: webhookDestinationEvaluators.evaluatorId }).from(webhookDestinationEvaluators).where(and(eq(webhookDestinationEvaluators.tenantId, params.scopes.tenantId), eq(webhookDestinationEvaluators.projectId, params.scopes.projectId), eq(webhookDestinationEvaluators.webhookDestinationId, params.webhookDestinationId)))).map((r) => r.evaluatorId);
119
+ };
120
+ const setWebhookDestinationEvaluatorIds = (db) => async (params) => {
121
+ const { scopes, webhookDestinationId, evaluatorIds } = params;
122
+ await db.delete(webhookDestinationEvaluators).where(and(eq(webhookDestinationEvaluators.tenantId, scopes.tenantId), eq(webhookDestinationEvaluators.projectId, scopes.projectId), eq(webhookDestinationEvaluators.webhookDestinationId, webhookDestinationId)));
123
+ if (evaluatorIds.length > 0) await db.insert(webhookDestinationEvaluators).values(evaluatorIds.map((evaluatorId) => ({
124
+ id: generateId(),
125
+ tenantId: scopes.tenantId,
126
+ projectId: scopes.projectId,
127
+ webhookDestinationId,
128
+ evaluatorId
129
+ })));
130
+ };
113
131
 
114
132
  //#endregion
115
- export { createWebhookDestination, deleteWebhookDestination, getWebhookDestinationAgentIds, getWebhookDestinationById, listEnabledWebhookDestinations, listWebhookDestinationsPaginated, setWebhookDestinationAgentIds, updateWebhookDestination };
133
+ export { createWebhookDestination, deleteWebhookDestination, getWebhookDestinationAgentIds, getWebhookDestinationById, getWebhookDestinationEvaluatorIds, listEnabledWebhookDestinations, listWebhookDestinationsPaginated, setWebhookDestinationAgentIds, setWebhookDestinationEvaluatorIds, updateWebhookDestination };