@inkeep/agents-core 0.0.0-dev-20260409191739 → 0.0.0-dev-20260409192310

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 (45) hide show
  1. package/dist/auth/auth-schema.d.ts +108 -108
  2. package/dist/auth/auth-validation-schemas.d.ts +137 -137
  3. package/dist/client-exports.d.ts +2 -2
  4. package/dist/client-exports.js +2 -2
  5. package/dist/constants/otel-attributes.d.ts +2 -0
  6. package/dist/constants/otel-attributes.js +2 -0
  7. package/dist/data-access/index.d.ts +2 -2
  8. package/dist/data-access/index.js +2 -2
  9. package/dist/data-access/manage/agentFull.js +23 -3
  10. package/dist/data-access/manage/agents.d.ts +5 -5
  11. package/dist/data-access/manage/agents.js +12 -1
  12. package/dist/data-access/manage/contextConfigs.d.ts +4 -4
  13. package/dist/data-access/manage/skills.d.ts +3 -3
  14. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +6 -6
  15. package/dist/data-access/manage/subAgentRelations.d.ts +4 -4
  16. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +6 -6
  17. package/dist/data-access/manage/subAgents.d.ts +3 -3
  18. package/dist/data-access/manage/tools.d.ts +9 -9
  19. package/dist/data-access/manage/triggerCleanup.js +6 -1
  20. package/dist/data-access/manage/triggers.d.ts +62 -3
  21. package/dist/data-access/manage/triggers.js +88 -3
  22. package/dist/data-access/runtime/apps.d.ts +4 -4
  23. package/dist/data-access/runtime/messages.d.ts +3 -3
  24. package/dist/data-access/runtime/triggerInvocations.d.ts +2 -0
  25. package/dist/db/manage/dolt-safe-jsonb.d.ts +2 -2
  26. package/dist/db/manage/manage-schema.d.ts +587 -451
  27. package/dist/db/manage/manage-schema.js +43 -2
  28. package/dist/db/runtime/runtime-schema.d.ts +443 -405
  29. package/dist/db/runtime/runtime-schema.js +4 -1
  30. package/dist/index.d.ts +4 -4
  31. package/dist/index.js +4 -4
  32. package/dist/middleware/no-auth.d.ts +2 -2
  33. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  34. package/dist/validation/index.d.ts +2 -2
  35. package/dist/validation/index.js +2 -2
  36. package/dist/validation/schemas/skills.d.ts +21 -21
  37. package/dist/validation/schemas.d.ts +1588 -1394
  38. package/dist/validation/schemas.js +35 -13
  39. package/drizzle/manage/0018_gorgeous_captain_america.sql +14 -0
  40. package/drizzle/manage/meta/0018_snapshot.json +3884 -0
  41. package/drizzle/manage/meta/_journal.json +7 -0
  42. package/drizzle/runtime/0035_many_steel_serpent.sql +3 -0
  43. package/drizzle/runtime/meta/0035_snapshot.json +5321 -0
  44. package/drizzle/runtime/meta/_journal.json +7 -0
  45. package/package.json +1 -1
@@ -12,7 +12,7 @@ import { createSubAgentRelation, deleteAgentRelationsByAgent, deleteAgentToolRel
12
12
  import { deleteSubAgent, listSubAgents, upsertSubAgent } from "./subAgents.js";
13
13
  import { deleteSubAgentTeamAgentRelation, getSubAgentTeamAgentRelationsByAgent, upsertSubAgentTeamAgentRelation } from "./subAgentTeamAgentRelations.js";
14
14
  import { upsertSubAgentToolRelation } from "./tools.js";
15
- import { deleteTrigger, listTriggers, upsertTrigger } from "./triggers.js";
15
+ import { deleteTrigger, listTriggers, setTriggerUsers, upsertTrigger } from "./triggers.js";
16
16
  import { deleteAgent, getAgentById, getFullAgentDefinition, getFullAgentDefinitionWithRelationIds, updateAgent, upsertAgent } from "./agents.js";
17
17
  import { associateArtifactComponentWithAgent, deleteAgentArtifactComponentRelationByAgent, upsertAgentArtifactComponentRelation } from "./artifactComponents.js";
18
18
  import { associateDataComponentWithAgent, deleteAgentDataComponentRelationByAgent, upsertAgentDataComponentRelation } from "./dataComponents.js";
@@ -285,6 +285,7 @@ const createFullAgentServerSide = (db) => async (scopes, agentData) => {
285
285
  agentId: finalAgentId,
286
286
  triggerId
287
287
  }, "Creating trigger in agent");
288
+ const { runAsUserIds, ...triggerInsertData } = triggerData;
288
289
  await upsertTrigger(db)({
289
290
  scopes: {
290
291
  tenantId,
@@ -292,13 +293,22 @@ const createFullAgentServerSide = (db) => async (scopes, agentData) => {
292
293
  agentId: finalAgentId
293
294
  },
294
295
  data: {
295
- ...triggerData,
296
+ ...triggerInsertData,
296
297
  id: triggerId,
297
298
  tenantId,
298
299
  projectId,
299
300
  agentId: finalAgentId
300
301
  }
301
302
  });
303
+ if (runAsUserIds && runAsUserIds.length > 0) await setTriggerUsers(db)({
304
+ scopes: {
305
+ tenantId,
306
+ projectId,
307
+ agentId: finalAgentId
308
+ },
309
+ triggerId,
310
+ userIds: runAsUserIds
311
+ });
302
312
  logger.info({
303
313
  agentId: finalAgentId,
304
314
  triggerId
@@ -857,6 +867,7 @@ const updateFullAgentServerSide = (db) => async (scopes, agentData) => {
857
867
  agentId: finalAgentId,
858
868
  triggerId
859
869
  }, "Updating trigger in agent");
870
+ const { runAsUserIds, ...triggerInsertData } = triggerData;
860
871
  await upsertTrigger(db)({
861
872
  scopes: {
862
873
  tenantId,
@@ -864,13 +875,22 @@ const updateFullAgentServerSide = (db) => async (scopes, agentData) => {
864
875
  agentId: finalAgentId
865
876
  },
866
877
  data: {
867
- ...triggerData,
878
+ ...triggerInsertData,
868
879
  id: triggerId,
869
880
  tenantId,
870
881
  projectId,
871
882
  agentId: finalAgentId
872
883
  }
873
884
  });
885
+ if (runAsUserIds !== void 0) await setTriggerUsers(db)({
886
+ scopes: {
887
+ tenantId,
888
+ projectId,
889
+ agentId: finalAgentId
890
+ },
891
+ triggerId,
892
+ userIds: runAsUserIds
893
+ });
874
894
  logger.info({
875
895
  agentId: finalAgentId,
876
896
  triggerId
@@ -39,6 +39,7 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
39
39
  transferCountIs?: number | undefined;
40
40
  } | null;
41
41
  tenantId: string;
42
+ projectId: string;
42
43
  defaultSubAgentId: string | null;
43
44
  contextConfigId: string | null;
44
45
  prompt: string | null;
@@ -58,7 +59,6 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
58
59
  }[] | undefined;
59
60
  } | null;
60
61
  executionMode: "classic" | "durable";
61
- projectId: string;
62
62
  } | null>;
63
63
  declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
64
64
  scopes: AgentScopeConfig;
@@ -92,6 +92,7 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
92
92
  transferCountIs?: number | undefined;
93
93
  } | null;
94
94
  tenantId: string;
95
+ projectId: string;
95
96
  defaultSubAgentId: string | null;
96
97
  contextConfigId: string | null;
97
98
  prompt: string | null;
@@ -111,7 +112,6 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
111
112
  }[] | undefined;
112
113
  } | null;
113
114
  executionMode: "classic" | "durable";
114
- projectId: string;
115
115
  defaultSubAgent: {
116
116
  id: string;
117
117
  name: string;
@@ -142,9 +142,9 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
142
142
  stepCountIs?: number | undefined;
143
143
  } | null;
144
144
  tenantId: string;
145
- prompt: string | null;
146
145
  projectId: string;
147
146
  agentId: string;
147
+ prompt: string | null;
148
148
  conversationHistoryConfig: ConversationHistoryConfig | null;
149
149
  } | null;
150
150
  } | null>;
@@ -180,6 +180,7 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
180
180
  transferCountIs?: number | undefined;
181
181
  } | null;
182
182
  tenantId: string;
183
+ projectId: string;
183
184
  defaultSubAgentId: string | null;
184
185
  contextConfigId: string | null;
185
186
  prompt: string | null;
@@ -199,7 +200,6 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
199
200
  }[] | undefined;
200
201
  } | null;
201
202
  executionMode: "classic" | "durable";
202
- projectId: string;
203
203
  }[]>;
204
204
  declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
205
205
  scopes: ProjectScopeConfig;
@@ -310,6 +310,7 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
310
310
  transferCountIs?: number | undefined;
311
311
  } | null;
312
312
  tenantId: string;
313
+ projectId: string;
313
314
  defaultSubAgentId: string | null;
314
315
  contextConfigId: string | null;
315
316
  prompt: string | null;
@@ -329,7 +330,6 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
329
330
  }[] | undefined;
330
331
  } | null;
331
332
  executionMode: "classic" | "durable";
332
- projectId: string;
333
333
  }>;
334
334
  declare const updateAgent: (db: AgentsManageDatabaseClient) => (params: {
335
335
  scopes: AgentScopeConfig;
@@ -16,7 +16,7 @@ import { getAgentRelations, getAgentRelationsByAgent } from "./subAgentRelations
16
16
  import { getSubAgentById } from "./subAgents.js";
17
17
  import { getSubAgentTeamAgentRelationsByAgent } from "./subAgentTeamAgentRelations.js";
18
18
  import { listTools } from "./tools.js";
19
- import { listTriggers } from "./triggers.js";
19
+ import { getTriggerUsersBatch, listTriggers } from "./triggers.js";
20
20
  import { and, count, desc, eq, inArray, sql } from "drizzle-orm";
21
21
 
22
22
  //#region src/data-access/manage/agents.ts
@@ -552,6 +552,15 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
552
552
  count: triggersList.length
553
553
  }, "Fetched triggers for agent");
554
554
  if (triggersList.length > 0) {
555
+ const triggerIds = triggersList.map((t) => t.id);
556
+ const usersByTrigger = await getTriggerUsersBatch(db)({
557
+ scopes: {
558
+ tenantId,
559
+ projectId,
560
+ agentId
561
+ },
562
+ triggerIds
563
+ });
555
564
  const triggersObject = {};
556
565
  for (const trigger of triggersList) triggersObject[trigger.id] = {
557
566
  id: trigger.id,
@@ -564,7 +573,9 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
564
573
  authentication: trigger.authentication,
565
574
  signingSecretCredentialReferenceId: trigger.signingSecretCredentialReferenceId,
566
575
  signatureVerification: trigger.signatureVerification,
576
+ dispatchDelayMs: trigger.dispatchDelayMs,
567
577
  runAsUserId: trigger.runAsUserId,
578
+ runAsUserIds: usersByTrigger.get(trigger.id) ?? [],
568
579
  createdBy: trigger.createdBy
569
580
  };
570
581
  result.triggers = triggersObject;
@@ -14,9 +14,9 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
14
14
  updatedAt: string;
15
15
  tenantId: string;
16
16
  projectId: string;
17
+ agentId: string;
17
18
  headersSchema: unknown;
18
19
  contextVariables: Record<string, ContextFetchDefinition> | null;
19
- agentId: string;
20
20
  } | undefined>;
21
21
  declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
22
22
  scopes: AgentScopeConfig;
@@ -26,9 +26,9 @@ declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
26
26
  updatedAt: string;
27
27
  tenantId: string;
28
28
  projectId: string;
29
+ agentId: string;
29
30
  headersSchema: unknown;
30
31
  contextVariables: Record<string, ContextFetchDefinition> | null;
31
- agentId: string;
32
32
  }[]>;
33
33
  declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (params: {
34
34
  scopes: AgentScopeConfig;
@@ -48,9 +48,9 @@ declare const createContextConfig: (db: AgentsManageDatabaseClient) => (params:
48
48
  updatedAt: string;
49
49
  tenantId: string;
50
50
  projectId: string;
51
+ agentId: string;
51
52
  headersSchema: unknown;
52
53
  contextVariables: Record<string, ContextFetchDefinition> | null;
53
- agentId: string;
54
54
  }>;
55
55
  declare const updateContextConfig: (db: AgentsManageDatabaseClient) => (params: {
56
56
  scopes: AgentScopeConfig;
@@ -88,9 +88,9 @@ declare const upsertContextConfig: (db: AgentsManageDatabaseClient) => (params:
88
88
  updatedAt: string;
89
89
  tenantId: string;
90
90
  projectId: string;
91
+ agentId: string;
91
92
  headersSchema: unknown;
92
93
  contextVariables: Record<string, ContextFetchDefinition> | null;
93
- agentId: string;
94
94
  }>;
95
95
  //#endregion
96
96
  export { countContextConfigs, createContextConfig, deleteContextConfig, getContextConfigById, hasContextConfig, listContextConfigs, listContextConfigsPaginated, updateContextConfig, upsertContextConfig };
@@ -22,8 +22,8 @@ declare const getSkillById: (db: AgentsManageDatabaseClient) => (params: {
22
22
  metadata: Record<string, string> | null;
23
23
  description: string;
24
24
  tenantId: string;
25
- projectId: string;
26
25
  content: string;
26
+ projectId: string;
27
27
  } | null>;
28
28
  declare const getSkillByIdWithFiles: (db: AgentsManageDatabaseClient) => (params: {
29
29
  scopes: ProjectScopeConfig;
@@ -117,8 +117,8 @@ declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillApiIn
117
117
  metadata: Record<string, string> | null;
118
118
  description: string;
119
119
  tenantId: string;
120
- projectId: string;
121
120
  content: string;
121
+ projectId: string;
122
122
  }>;
123
123
  declare const updateSkill: (db: AgentsManageDatabaseClient) => (params: {
124
124
  scopes: ProjectScopeConfig;
@@ -145,10 +145,10 @@ declare const upsertSubAgentSkill: (db: AgentsManageDatabaseClient) => (params:
145
145
  tenantId: string;
146
146
  projectId: string;
147
147
  agentId: string;
148
+ subAgentId: string;
148
149
  skillId: string;
149
150
  index: number;
150
151
  alwaysLoaded: boolean;
151
- subAgentId: string;
152
152
  }>;
153
153
  declare const deleteSubAgentSkill: (db: AgentsManageDatabaseClient) => (params: {
154
154
  scopes: AgentScopeConfig;
@@ -12,11 +12,11 @@ declare const getSubAgentExternalAgentRelationById: (db: AgentsManageDatabaseCli
12
12
  id: string;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
+ headers: Record<string, string> | null;
15
16
  tenantId: string;
16
17
  projectId: string;
17
18
  agentId: string;
18
19
  subAgentId: string;
19
- headers: Record<string, string> | null;
20
20
  externalAgentId: string;
21
21
  } | undefined>;
22
22
  declare const listSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
@@ -47,11 +47,11 @@ declare const getSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient
47
47
  id: string;
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
+ headers: Record<string, string> | null;
50
51
  tenantId: string;
51
52
  projectId: string;
52
53
  agentId: string;
53
54
  subAgentId: string;
54
- headers: Record<string, string> | null;
55
55
  externalAgentId: string;
56
56
  }[]>;
57
57
  declare const getSubAgentExternalAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -60,11 +60,11 @@ declare const getSubAgentExternalAgentRelationsByAgent: (db: AgentsManageDatabas
60
60
  id: string;
61
61
  createdAt: string;
62
62
  updatedAt: string;
63
+ headers: Record<string, string> | null;
63
64
  tenantId: string;
64
65
  projectId: string;
65
66
  agentId: string;
66
67
  subAgentId: string;
67
- headers: Record<string, string> | null;
68
68
  externalAgentId: string;
69
69
  }[]>;
70
70
  declare const getSubAgentExternalAgentRelationsByExternalAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -189,11 +189,11 @@ declare const createSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
189
189
  id: string;
190
190
  createdAt: string;
191
191
  updatedAt: string;
192
+ headers: Record<string, string> | null;
192
193
  tenantId: string;
193
194
  projectId: string;
194
195
  agentId: string;
195
196
  subAgentId: string;
196
- headers: Record<string, string> | null;
197
197
  externalAgentId: string;
198
198
  }>;
199
199
  /**
@@ -206,11 +206,11 @@ declare const getSubAgentExternalAgentRelationByParams: (db: AgentsManageDatabas
206
206
  id: string;
207
207
  createdAt: string;
208
208
  updatedAt: string;
209
+ headers: Record<string, string> | null;
209
210
  tenantId: string;
210
211
  projectId: string;
211
212
  agentId: string;
212
213
  subAgentId: string;
213
- headers: Record<string, string> | null;
214
214
  externalAgentId: string;
215
215
  } | undefined>;
216
216
  /**
@@ -227,11 +227,11 @@ declare const upsertSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
227
227
  id: string;
228
228
  createdAt: string;
229
229
  updatedAt: string;
230
+ headers: Record<string, string> | null;
230
231
  tenantId: string;
231
232
  projectId: string;
232
233
  agentId: string;
233
234
  subAgentId: string;
234
- headers: Record<string, string> | null;
235
235
  externalAgentId: string;
236
236
  }>;
237
237
  declare const updateSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
@@ -207,12 +207,12 @@ declare const createAgentToolRelation: (db: AgentsManageDatabaseClient) => (para
207
207
  id: string;
208
208
  createdAt: string;
209
209
  updatedAt: string;
210
+ headers: Record<string, string> | null;
210
211
  tenantId: string;
211
212
  projectId: string;
212
213
  agentId: string;
213
- toolId: string;
214
214
  subAgentId: string;
215
- headers: Record<string, string> | null;
215
+ toolId: string;
216
216
  selectedTools: string[] | null;
217
217
  toolPolicies: Record<string, {
218
218
  needsApproval?: boolean;
@@ -251,12 +251,12 @@ declare const getAgentToolRelationById: (db: AgentsManageDatabaseClient) => (par
251
251
  id: string;
252
252
  createdAt: string;
253
253
  updatedAt: string;
254
+ headers: Record<string, string> | null;
254
255
  tenantId: string;
255
256
  projectId: string;
256
257
  agentId: string;
257
- toolId: string;
258
258
  subAgentId: string;
259
- headers: Record<string, string> | null;
259
+ toolId: string;
260
260
  selectedTools: string[] | null;
261
261
  toolPolicies: Record<string, {
262
262
  needsApproval?: boolean;
@@ -12,11 +12,11 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
12
12
  id: string;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
+ headers: Record<string, string> | null;
15
16
  tenantId: string;
16
17
  projectId: string;
17
18
  agentId: string;
18
19
  subAgentId: string;
19
- headers: Record<string, string> | null;
20
20
  targetAgentId: string;
21
21
  } | undefined>;
22
22
  declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
@@ -47,11 +47,11 @@ declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =>
47
47
  id: string;
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
+ headers: Record<string, string> | null;
50
51
  tenantId: string;
51
52
  projectId: string;
52
53
  agentId: string;
53
54
  subAgentId: string;
54
- headers: Record<string, string> | null;
55
55
  targetAgentId: string;
56
56
  }[]>;
57
57
  declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -60,11 +60,11 @@ declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseCli
60
60
  id: string;
61
61
  createdAt: string;
62
62
  updatedAt: string;
63
+ headers: Record<string, string> | null;
63
64
  tenantId: string;
64
65
  projectId: string;
65
66
  agentId: string;
66
67
  subAgentId: string;
67
- headers: Record<string, string> | null;
68
68
  targetAgentId: string;
69
69
  }[]>;
70
70
  declare const getSubAgentTeamAgentRelationsByTeamAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -225,11 +225,11 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
225
225
  id: string;
226
226
  createdAt: string;
227
227
  updatedAt: string;
228
+ headers: Record<string, string> | null;
228
229
  tenantId: string;
229
230
  projectId: string;
230
231
  agentId: string;
231
232
  subAgentId: string;
232
- headers: Record<string, string> | null;
233
233
  targetAgentId: string;
234
234
  }>;
235
235
  /**
@@ -242,11 +242,11 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
242
242
  id: string;
243
243
  createdAt: string;
244
244
  updatedAt: string;
245
+ headers: Record<string, string> | null;
245
246
  tenantId: string;
246
247
  projectId: string;
247
248
  agentId: string;
248
249
  subAgentId: string;
249
- headers: Record<string, string> | null;
250
250
  targetAgentId: string;
251
251
  } | undefined>;
252
252
  /**
@@ -263,11 +263,11 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
263
263
  id: string;
264
264
  createdAt: string;
265
265
  updatedAt: string;
266
+ headers: Record<string, string> | null;
266
267
  tenantId: string;
267
268
  projectId: string;
268
269
  agentId: string;
269
270
  subAgentId: string;
270
- headers: Record<string, string> | null;
271
271
  targetAgentId: string;
272
272
  }>;
273
273
  declare const updateSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
@@ -38,9 +38,9 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
38
38
  stepCountIs?: number | undefined;
39
39
  } | null;
40
40
  tenantId: string;
41
- prompt: string | null;
42
41
  projectId: string;
43
42
  agentId: string;
43
+ prompt: string | null;
44
44
  conversationHistoryConfig: ConversationHistoryConfig | null;
45
45
  } | undefined>;
46
46
  declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
@@ -75,9 +75,9 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
75
75
  stepCountIs?: number | undefined;
76
76
  } | null;
77
77
  tenantId: string;
78
- prompt: string | null;
79
78
  projectId: string;
80
79
  agentId: string;
80
+ prompt: string | null;
81
81
  conversationHistoryConfig: ConversationHistoryConfig | null;
82
82
  }[]>;
83
83
  declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
@@ -156,9 +156,9 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
156
156
  stepCountIs?: number | undefined;
157
157
  } | null;
158
158
  tenantId: string;
159
- prompt: string | null;
160
159
  projectId: string;
161
160
  agentId: string;
161
+ prompt: string | null;
162
162
  conversationHistoryConfig: ConversationHistoryConfig | null;
163
163
  }>;
164
164
  declare const updateSubAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -25,6 +25,7 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
25
25
  createdAt: string;
26
26
  updatedAt: string;
27
27
  description: string | null;
28
+ headers: Record<string, string> | null;
28
29
  tenantId: string;
29
30
  projectId: string;
30
31
  credentialReferenceId: string | null;
@@ -33,7 +34,6 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
33
34
  mcp: ToolMcpConfig;
34
35
  };
35
36
  credentialScope: string;
36
- headers: Record<string, string> | null;
37
37
  imageUrl: string | null;
38
38
  capabilities: ToolServerCapabilities | null;
39
39
  lastError: string | null;
@@ -83,6 +83,7 @@ declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInser
83
83
  createdAt: string;
84
84
  updatedAt: string;
85
85
  description: string | null;
86
+ headers: Record<string, string> | null;
86
87
  tenantId: string;
87
88
  projectId: string;
88
89
  credentialReferenceId: string | null;
@@ -91,7 +92,6 @@ declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInser
91
92
  mcp: ToolMcpConfig;
92
93
  };
93
94
  credentialScope: string;
94
- headers: Record<string, string> | null;
95
95
  imageUrl: string | null;
96
96
  capabilities: ToolServerCapabilities | null;
97
97
  lastError: string | null;
@@ -138,12 +138,12 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
138
138
  id: string;
139
139
  createdAt: string;
140
140
  updatedAt: string;
141
+ headers: Record<string, string> | null;
141
142
  tenantId: string;
142
143
  projectId: string;
143
144
  agentId: string;
144
- toolId: string;
145
145
  subAgentId: string;
146
- headers: Record<string, string> | null;
146
+ toolId: string;
147
147
  selectedTools: string[] | null;
148
148
  toolPolicies: Record<string, {
149
149
  needsApproval?: boolean;
@@ -157,12 +157,12 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
157
157
  id: string;
158
158
  createdAt: string;
159
159
  updatedAt: string;
160
+ headers: Record<string, string> | null;
160
161
  tenantId: string;
161
162
  projectId: string;
162
163
  agentId: string;
163
- toolId: string;
164
164
  subAgentId: string;
165
- headers: Record<string, string> | null;
165
+ toolId: string;
166
166
  selectedTools: string[] | null;
167
167
  toolPolicies: Record<string, {
168
168
  needsApproval?: boolean;
@@ -185,12 +185,12 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
185
185
  id: string;
186
186
  createdAt: string;
187
187
  updatedAt: string;
188
+ headers: Record<string, string> | null;
188
189
  tenantId: string;
189
190
  projectId: string;
190
191
  agentId: string;
191
- toolId: string;
192
192
  subAgentId: string;
193
- headers: Record<string, string> | null;
193
+ toolId: string;
194
194
  selectedTools: string[] | null;
195
195
  toolPolicies: Record<string, {
196
196
  needsApproval?: boolean;
@@ -207,6 +207,7 @@ declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
207
207
  createdAt: string;
208
208
  updatedAt: string;
209
209
  description: string | null;
210
+ headers: Record<string, string> | null;
210
211
  tenantId: string;
211
212
  projectId: string;
212
213
  credentialReferenceId: string | null;
@@ -215,7 +216,6 @@ declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
215
216
  mcp: ToolMcpConfig;
216
217
  };
217
218
  credentialScope: string;
218
- headers: Record<string, string> | null;
219
219
  imageUrl: string | null;
220
220
  capabilities: ToolServerCapabilities | null;
221
221
  lastError: string | null;
@@ -2,7 +2,7 @@ import { manage_schema_exports } from "../../db/manage/manage-schema.js";
2
2
  import { getLogger } from "../../utils/logger.js";
3
3
  import { resolveProjectMainRefs } from "../../dolt/ref-helpers.js";
4
4
  import { listProjectsMetadata } from "../runtime/projects.js";
5
- import { deleteTriggersByRunAsUserId } from "./triggers.js";
5
+ import { deleteTriggersByRunAsUserId, removeUserFromProjectTriggerUsers } from "./triggers.js";
6
6
  import { deleteScheduledTriggersByRunAsUserId } from "../runtime/scheduledTriggers.js";
7
7
  import { withRef } from "../../dolt/ref-scope.js";
8
8
  import { drizzle } from "drizzle-orm/node-postgres";
@@ -42,6 +42,11 @@ async function cleanupUserTriggers(params) {
42
42
  projectId,
43
43
  runAsUserId: userId
44
44
  });
45
+ await removeUserFromProjectTriggerUsers(db)({
46
+ tenantId,
47
+ projectId,
48
+ userId
49
+ });
45
50
  }, {
46
51
  commit: true,
47
52
  commitMessage: `Remove triggers for departing user ${userId}`
@@ -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;
@@ -63,6 +63,7 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
63
63
  } | undefined;
64
64
  } | null;
65
65
  runAsUserId: string | null;
66
+ dispatchDelayMs: number | null;
66
67
  createdBy: string | null;
67
68
  name: string;
68
69
  description: string | null;
@@ -82,6 +83,10 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
82
83
  * Create a new trigger (agent-scoped)
83
84
  */
84
85
  declare const createTrigger: (db: AgentsManageDatabaseClient) => (params: TriggerInsert) => Promise<TriggerSelect>;
86
+ declare const createTriggerWithUsers: (db: AgentsManageDatabaseClient) => (params: {
87
+ trigger: TriggerInsert;
88
+ userIds: string[];
89
+ }) => Promise<TriggerSelect>;
85
90
  /**
86
91
  * Update a trigger (agent-scoped)
87
92
  */
@@ -106,6 +111,60 @@ declare const deleteTriggersByRunAsUserId: (db: AgentsManageDatabaseClient) => (
106
111
  projectId: string;
107
112
  runAsUserId: string;
108
113
  }) => Promise<void>;
114
+ declare const getTriggerUsers: (db: AgentsManageDatabaseClient) => (params: {
115
+ scopes: AgentScopeConfig;
116
+ triggerId: string;
117
+ }) => Promise<{
118
+ tenantId: string;
119
+ projectId: string;
120
+ agentId: string;
121
+ triggerId: string;
122
+ userId: string;
123
+ createdAt: string;
124
+ }[]>;
125
+ declare const getTriggerUsersBatch: (db: AgentsManageDatabaseClient) => (params: {
126
+ scopes: AgentScopeConfig;
127
+ triggerIds: string[];
128
+ }) => Promise<Map<string, string[]>>;
129
+ declare const createTriggerUser: (db: AgentsManageDatabaseClient) => (params: {
130
+ scopes: AgentScopeConfig;
131
+ triggerId: string;
132
+ userId: string;
133
+ }) => Promise<{
134
+ createdAt: string;
135
+ userId: string;
136
+ tenantId: string;
137
+ projectId: string;
138
+ agentId: string;
139
+ triggerId: string;
140
+ }>;
141
+ declare const deleteTriggerUser: (db: AgentsManageDatabaseClient) => (params: {
142
+ scopes: AgentScopeConfig;
143
+ triggerId: string;
144
+ userId: string;
145
+ }) => Promise<void>;
146
+ declare const setTriggerUsers: (db: AgentsManageDatabaseClient) => (params: {
147
+ scopes: AgentScopeConfig;
148
+ triggerId: string;
149
+ userIds: string[];
150
+ }) => Promise<void>;
151
+ declare const getTriggerUserCount: (db: AgentsManageDatabaseClient) => (params: {
152
+ scopes: AgentScopeConfig;
153
+ triggerId: string;
154
+ }) => Promise<number>;
155
+ declare const getWebhookTriggerIdsWithUser: (db: AgentsManageDatabaseClient) => (params: {
156
+ tenantId: string;
157
+ projectId: string;
158
+ userId: string;
159
+ }) => Promise<{
160
+ agentId: string;
161
+ id: string;
162
+ }[]>;
163
+ declare const removeUserFromProjectTriggerUsers: (db: AgentsManageDatabaseClient) => (params: {
164
+ tenantId: string;
165
+ projectId: string;
166
+ userId: string;
167
+ }) => Promise<void>;
109
168
  /**
110
169
  * Upsert a trigger (create or update based on existence)
111
170
  */
@@ -114,4 +173,4 @@ declare const upsertTrigger: (db: AgentsManageDatabaseClient) => (params: {
114
173
  data: TriggerInsert;
115
174
  }) => Promise<TriggerSelect>;
116
175
  //#endregion
117
- export { createTrigger, deleteTrigger, deleteTriggersByRunAsUserId, getTriggerById, listTriggers, listTriggersPaginated, updateTrigger, upsertTrigger };
176
+ export { createTrigger, createTriggerUser, createTriggerWithUsers, deleteTrigger, deleteTriggerUser, deleteTriggersByRunAsUserId, getTriggerById, getTriggerUserCount, getTriggerUsers, getTriggerUsersBatch, getWebhookTriggerIdsWithUser, listTriggers, listTriggersPaginated, removeUserFromProjectTriggerUsers, setTriggerUsers, updateTrigger, upsertTrigger };