@inkeep/agents-core 0.62.1 → 0.63.0

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 (63) hide show
  1. package/dist/auth/auth-config-utils.js +1 -1
  2. package/dist/auth/auth.js +1 -1
  3. package/dist/auth/init.js +12 -2
  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 +4 -7
  7. package/dist/data-access/index.js +4 -7
  8. package/dist/data-access/manage/agentFull.js +0 -116
  9. package/dist/data-access/manage/agents.d.ts +27 -27
  10. package/dist/data-access/manage/agents.js +0 -30
  11. package/dist/data-access/manage/artifactComponents.d.ts +6 -6
  12. package/dist/data-access/manage/audit-queries.d.ts +1 -14
  13. package/dist/data-access/manage/audit-queries.js +2 -16
  14. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  15. package/dist/data-access/manage/dataComponents.d.ts +4 -4
  16. package/dist/data-access/manage/functionTools.d.ts +10 -10
  17. package/dist/data-access/manage/skills.d.ts +5 -5
  18. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  19. package/dist/data-access/manage/subAgentRelations.d.ts +18 -18
  20. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
  21. package/dist/data-access/manage/subAgents.d.ts +9 -9
  22. package/dist/data-access/manage/tools.d.ts +15 -15
  23. package/dist/data-access/manage/triggerCleanup.js +18 -7
  24. package/dist/data-access/runtime/apiKeys.d.ts +8 -8
  25. package/dist/data-access/runtime/apps.d.ts +4 -4
  26. package/dist/data-access/runtime/cascade-delete.d.ts +2 -0
  27. package/dist/data-access/runtime/cascade-delete.js +13 -6
  28. package/dist/data-access/runtime/conversations.d.ts +8 -8
  29. package/dist/data-access/runtime/messages.d.ts +3 -3
  30. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +5 -4
  31. package/dist/data-access/runtime/scheduledTriggers.d.ts +89 -0
  32. package/dist/data-access/runtime/scheduledTriggers.js +91 -0
  33. package/dist/data-access/runtime/schedulerState.d.ts +11 -0
  34. package/dist/data-access/runtime/schedulerState.js +30 -0
  35. package/dist/data-access/runtime/tasks.d.ts +2 -2
  36. package/dist/data-reconciliation/index.d.ts +2 -2
  37. package/dist/data-reconciliation/types.d.ts +1 -28
  38. package/dist/db/manage/manage-schema.d.ts +340 -694
  39. package/dist/db/manage/manage-schema.js +2 -4
  40. package/dist/db/runtime/runtime-schema.d.ts +811 -350
  41. package/dist/db/runtime/runtime-schema.js +38 -5
  42. package/dist/index.d.ts +11 -12
  43. package/dist/index.js +8 -10
  44. package/dist/middleware/no-auth.d.ts +2 -2
  45. package/dist/types/entities.d.ts +12 -2
  46. package/dist/types/index.d.ts +2 -2
  47. package/dist/utils/compute-next-run-at.d.ts +9 -0
  48. package/dist/utils/compute-next-run-at.js +18 -0
  49. package/dist/utils/index.d.ts +2 -1
  50. package/dist/utils/index.js +2 -1
  51. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  52. package/dist/validation/index.d.ts +2 -2
  53. package/dist/validation/index.js +2 -2
  54. package/dist/validation/schemas.d.ts +2714 -3694
  55. package/dist/validation/schemas.js +16 -32
  56. package/drizzle/runtime/0028_thick_squirrel_girl.sql +36 -0
  57. package/drizzle/runtime/meta/0028_snapshot.json +4661 -0
  58. package/drizzle/runtime/meta/_journal.json +7 -0
  59. package/package.json +2 -1
  60. package/dist/data-access/manage/scheduledTriggers.d.ts +0 -91
  61. package/dist/data-access/manage/scheduledTriggers.js +0 -87
  62. package/dist/data-access/manage/scheduledWorkflows.d.ts +0 -29
  63. package/dist/data-access/manage/scheduledWorkflows.js +0 -33
@@ -58,9 +58,9 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
58
58
  createdAt: string;
59
59
  updatedAt: string;
60
60
  description: string | null;
61
- agentId: string;
62
- projectId: string;
63
61
  tenantId: string;
62
+ projectId: string;
63
+ agentId: string;
64
64
  functionId: string;
65
65
  }>;
66
66
  /**
@@ -100,9 +100,9 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
100
100
  createdAt: string;
101
101
  updatedAt: string;
102
102
  description: string | null;
103
- agentId: string;
104
- projectId: string;
105
103
  tenantId: string;
104
+ projectId: string;
105
+ agentId: string;
106
106
  functionId: string;
107
107
  }>;
108
108
  declare const getFunctionToolsForSubAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -160,14 +160,14 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
160
160
  id: string;
161
161
  createdAt: string;
162
162
  updatedAt: string;
163
- agentId: string;
164
- projectId: string;
165
163
  tenantId: string;
164
+ projectId: string;
165
+ agentId: string;
166
166
  subAgentId: string;
167
- functionToolId: string;
168
167
  toolPolicies: Record<string, {
169
168
  needsApproval?: boolean;
170
169
  }> | 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
- agentId: string;
229
- projectId: string;
230
228
  tenantId: string;
229
+ projectId: string;
230
+ agentId: string;
231
231
  subAgentId: string;
232
- functionToolId: string;
233
232
  toolPolicies: Record<string, {
234
233
  needsApproval?: boolean;
235
234
  }> | 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 };
@@ -14,9 +14,9 @@ declare const getSkillById: (db: AgentsManageDatabaseClient) => (params: {
14
14
  updatedAt: string;
15
15
  metadata: Record<string, string> | null;
16
16
  description: string;
17
- projectId: string;
18
17
  tenantId: string;
19
18
  content: string;
19
+ projectId: string;
20
20
  } | null>;
21
21
  declare const listSkills: (db: AgentsManageDatabaseClient) => (params: {
22
22
  scopes: ProjectScopeConfig;
@@ -47,9 +47,9 @@ declare const createSkill: (db: AgentsManageDatabaseClient) => (data: SkillInser
47
47
  updatedAt: string;
48
48
  metadata: Record<string, string> | null;
49
49
  description: string;
50
- projectId: string;
51
50
  tenantId: string;
52
51
  content: string;
52
+ projectId: string;
53
53
  }>;
54
54
  declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillInsert) => Promise<{
55
55
  id: string;
@@ -58,9 +58,9 @@ declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillInser
58
58
  updatedAt: string;
59
59
  metadata: Record<string, string> | null;
60
60
  description: string;
61
- projectId: string;
62
61
  tenantId: string;
63
62
  content: string;
63
+ projectId: string;
64
64
  }>;
65
65
  declare const updateSkill: (db: AgentsManageDatabaseClient) => (params: {
66
66
  scopes: ProjectScopeConfig;
@@ -94,9 +94,9 @@ declare const upsertSubAgentSkill: (db: AgentsManageDatabaseClient) => (params:
94
94
  id: string;
95
95
  createdAt: string;
96
96
  updatedAt: string;
97
- agentId: string;
98
- projectId: string;
99
97
  tenantId: string;
98
+ projectId: string;
99
+ agentId: string;
100
100
  subAgentId: string;
101
101
  skillId: string;
102
102
  index: number;
@@ -13,9 +13,9 @@ declare const getSubAgentExternalAgentRelationById: (db: AgentsManageDatabaseCli
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
15
  headers: Record<string, string> | null;
16
- agentId: string;
17
- projectId: string;
18
16
  tenantId: string;
17
+ projectId: string;
18
+ agentId: string;
19
19
  subAgentId: string;
20
20
  externalAgentId: string;
21
21
  } | undefined>;
@@ -48,9 +48,9 @@ declare const getSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
50
  headers: Record<string, string> | null;
51
- agentId: string;
52
- projectId: string;
53
51
  tenantId: string;
52
+ projectId: string;
53
+ agentId: string;
54
54
  subAgentId: string;
55
55
  externalAgentId: string;
56
56
  }[]>;
@@ -61,9 +61,9 @@ declare const getSubAgentExternalAgentRelationsByAgent: (db: AgentsManageDatabas
61
61
  createdAt: string;
62
62
  updatedAt: string;
63
63
  headers: Record<string, string> | null;
64
- agentId: string;
65
- projectId: string;
66
64
  tenantId: string;
65
+ projectId: string;
66
+ agentId: string;
67
67
  subAgentId: string;
68
68
  externalAgentId: string;
69
69
  }[]>;
@@ -184,9 +184,9 @@ declare const createSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
184
184
  createdAt: string;
185
185
  updatedAt: string;
186
186
  headers: Record<string, string> | null;
187
- agentId: string;
188
- projectId: string;
189
187
  tenantId: string;
188
+ projectId: string;
189
+ agentId: string;
190
190
  subAgentId: string;
191
191
  externalAgentId: string;
192
192
  }>;
@@ -201,9 +201,9 @@ declare const getSubAgentExternalAgentRelationByParams: (db: AgentsManageDatabas
201
201
  createdAt: string;
202
202
  updatedAt: string;
203
203
  headers: Record<string, string> | null;
204
- agentId: string;
205
- projectId: string;
206
204
  tenantId: string;
205
+ projectId: string;
206
+ agentId: string;
207
207
  subAgentId: string;
208
208
  externalAgentId: string;
209
209
  } | undefined>;
@@ -222,9 +222,9 @@ declare const upsertSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
222
222
  createdAt: string;
223
223
  updatedAt: string;
224
224
  headers: Record<string, string> | null;
225
- agentId: string;
226
- projectId: string;
227
225
  tenantId: string;
226
+ projectId: string;
227
+ agentId: string;
228
228
  subAgentId: string;
229
229
  externalAgentId: string;
230
230
  }>;
@@ -12,9 +12,9 @@ declare const getAgentRelationById: (db: AgentsManageDatabaseClient) => (params:
12
12
  id: string;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
- agentId: string;
16
- projectId: string;
17
15
  tenantId: string;
16
+ projectId: string;
17
+ agentId: string;
18
18
  sourceSubAgentId: string;
19
19
  targetSubAgentId: string | null;
20
20
  relationType: string | null;
@@ -47,9 +47,9 @@ declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
47
47
  id: string;
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
- agentId: string;
51
- projectId: string;
52
50
  tenantId: string;
51
+ projectId: string;
52
+ agentId: string;
53
53
  sourceSubAgentId: string;
54
54
  targetSubAgentId: string | null;
55
55
  relationType: string | null;
@@ -60,9 +60,9 @@ declare const getAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (par
60
60
  id: string;
61
61
  createdAt: string;
62
62
  updatedAt: string;
63
- agentId: string;
64
- projectId: string;
65
63
  tenantId: string;
64
+ projectId: string;
65
+ agentId: string;
66
66
  sourceSubAgentId: string;
67
67
  targetSubAgentId: string | null;
68
68
  relationType: string | null;
@@ -129,9 +129,9 @@ declare const createSubAgentRelation: (db: AgentsManageDatabaseClient) => (param
129
129
  id: string;
130
130
  createdAt: string;
131
131
  updatedAt: string;
132
- agentId: string;
133
- projectId: string;
134
132
  tenantId: string;
133
+ projectId: string;
134
+ agentId: string;
135
135
  sourceSubAgentId: string;
136
136
  targetSubAgentId: string | null;
137
137
  relationType: string | null;
@@ -148,9 +148,9 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
148
148
  id: string;
149
149
  createdAt: string;
150
150
  updatedAt: string;
151
- agentId: string;
152
- projectId: string;
153
151
  tenantId: string;
152
+ projectId: string;
153
+ agentId: string;
154
154
  sourceSubAgentId: string;
155
155
  targetSubAgentId: string | null;
156
156
  relationType: string | null;
@@ -162,9 +162,9 @@ declare const upsertSubAgentRelation: (db: AgentsManageDatabaseClient) => (param
162
162
  id: string;
163
163
  createdAt: string;
164
164
  updatedAt: string;
165
- agentId: string;
166
- projectId: string;
167
165
  tenantId: string;
166
+ projectId: string;
167
+ agentId: string;
168
168
  sourceSubAgentId: string;
169
169
  targetSubAgentId: string | null;
170
170
  relationType: string | null;
@@ -208,15 +208,15 @@ declare const createAgentToolRelation: (db: AgentsManageDatabaseClient) => (para
208
208
  createdAt: string;
209
209
  updatedAt: string;
210
210
  headers: Record<string, string> | null;
211
- agentId: string;
212
- projectId: string;
213
211
  tenantId: string;
212
+ projectId: string;
213
+ agentId: string;
214
214
  subAgentId: string;
215
215
  toolId: string;
216
+ selectedTools: string[] | null;
216
217
  toolPolicies: Record<string, {
217
218
  needsApproval?: boolean;
218
219
  }> | null;
219
- selectedTools: string[] | null;
220
220
  }>;
221
221
  declare const updateAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
222
222
  scopes: AgentScopeConfig;
@@ -252,15 +252,15 @@ declare const getAgentToolRelationById: (db: AgentsManageDatabaseClient) => (par
252
252
  createdAt: string;
253
253
  updatedAt: string;
254
254
  headers: Record<string, string> | null;
255
- agentId: string;
256
- projectId: string;
257
255
  tenantId: string;
256
+ projectId: string;
257
+ agentId: string;
258
258
  subAgentId: string;
259
259
  toolId: string;
260
+ selectedTools: string[] | null;
260
261
  toolPolicies: Record<string, {
261
262
  needsApproval?: boolean;
262
263
  }> | null;
263
- selectedTools: string[] | null;
264
264
  } | undefined>;
265
265
  declare const getAgentToolRelationByAgent: (db: AgentsManageDatabaseClient) => (params: {
266
266
  scopes: SubAgentScopeConfig;
@@ -13,9 +13,9 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
15
  headers: Record<string, string> | null;
16
- agentId: string;
17
- projectId: string;
18
16
  tenantId: string;
17
+ projectId: string;
18
+ agentId: string;
19
19
  subAgentId: string;
20
20
  targetAgentId: string;
21
21
  } | undefined>;
@@ -48,9 +48,9 @@ declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =>
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
50
  headers: Record<string, string> | null;
51
- agentId: string;
52
- projectId: string;
53
51
  tenantId: string;
52
+ projectId: string;
53
+ agentId: string;
54
54
  subAgentId: string;
55
55
  targetAgentId: string;
56
56
  }[]>;
@@ -61,9 +61,9 @@ declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseCli
61
61
  createdAt: string;
62
62
  updatedAt: string;
63
63
  headers: Record<string, string> | null;
64
- agentId: string;
65
- projectId: string;
66
64
  tenantId: string;
65
+ projectId: string;
66
+ agentId: string;
67
67
  subAgentId: string;
68
68
  targetAgentId: string;
69
69
  }[]>;
@@ -214,9 +214,9 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
214
214
  createdAt: string;
215
215
  updatedAt: string;
216
216
  headers: Record<string, string> | null;
217
- agentId: string;
218
- projectId: string;
219
217
  tenantId: string;
218
+ projectId: string;
219
+ agentId: string;
220
220
  subAgentId: string;
221
221
  targetAgentId: string;
222
222
  }>;
@@ -231,9 +231,9 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
231
231
  createdAt: string;
232
232
  updatedAt: string;
233
233
  headers: Record<string, string> | null;
234
- agentId: string;
235
- projectId: string;
236
234
  tenantId: string;
235
+ projectId: string;
236
+ agentId: string;
237
237
  subAgentId: string;
238
238
  targetAgentId: string;
239
239
  } | undefined>;
@@ -252,9 +252,9 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
252
252
  createdAt: string;
253
253
  updatedAt: string;
254
254
  headers: Record<string, string> | null;
255
- agentId: string;
256
- projectId: string;
257
255
  tenantId: string;
256
+ projectId: string;
257
+ agentId: string;
258
258
  subAgentId: string;
259
259
  targetAgentId: string;
260
260
  }>;
@@ -14,8 +14,6 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
14
14
  createdAt: string;
15
15
  updatedAt: string;
16
16
  description: string | null;
17
- agentId: string;
18
- projectId: string;
19
17
  tenantId: string;
20
18
  models: {
21
19
  base?: {
@@ -31,10 +29,12 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
31
29
  providerOptions?: Record<string, unknown> | undefined;
32
30
  } | undefined;
33
31
  } | null;
34
- prompt: string | null;
35
32
  stopWhen: {
36
33
  stepCountIs?: number | undefined;
37
34
  } | null;
35
+ projectId: string;
36
+ agentId: string;
37
+ prompt: string | null;
38
38
  conversationHistoryConfig: ConversationHistoryConfig | null;
39
39
  } | undefined>;
40
40
  declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
@@ -45,8 +45,6 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
45
45
  createdAt: string;
46
46
  updatedAt: string;
47
47
  description: string | null;
48
- agentId: string;
49
- projectId: string;
50
48
  tenantId: string;
51
49
  models: {
52
50
  base?: {
@@ -62,10 +60,12 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
62
60
  providerOptions?: Record<string, unknown> | undefined;
63
61
  } | undefined;
64
62
  } | null;
65
- prompt: string | null;
66
63
  stopWhen: {
67
64
  stepCountIs?: number | undefined;
68
65
  } | null;
66
+ projectId: string;
67
+ agentId: string;
68
+ prompt: string | null;
69
69
  conversationHistoryConfig: ConversationHistoryConfig | null;
70
70
  }[]>;
71
71
  declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
@@ -114,8 +114,6 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
114
114
  createdAt: string;
115
115
  updatedAt: string;
116
116
  description: string | null;
117
- agentId: string;
118
- projectId: string;
119
117
  tenantId: string;
120
118
  models: {
121
119
  base?: {
@@ -131,10 +129,12 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
131
129
  providerOptions?: Record<string, unknown> | undefined;
132
130
  } | undefined;
133
131
  } | null;
134
- prompt: string | null;
135
132
  stopWhen: {
136
133
  stepCountIs?: number | undefined;
137
134
  } | null;
135
+ projectId: string;
136
+ agentId: string;
137
+ prompt: string | null;
138
138
  conversationHistoryConfig: ConversationHistoryConfig | null;
139
139
  }>;
140
140
  declare const updateSubAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -26,13 +26,13 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
26
26
  updatedAt: string;
27
27
  description: string | null;
28
28
  headers: Record<string, string> | null;
29
- projectId: string;
30
29
  tenantId: string;
30
+ projectId: string;
31
+ credentialReferenceId: string | null;
31
32
  config: {
32
33
  type: "mcp";
33
34
  mcp: ToolMcpConfig;
34
35
  };
35
- credentialReferenceId: string | null;
36
36
  credentialScope: string;
37
37
  imageUrl: string | null;
38
38
  capabilities: ToolServerCapabilities | null;
@@ -84,13 +84,13 @@ declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInser
84
84
  updatedAt: string;
85
85
  description: string | null;
86
86
  headers: Record<string, string> | null;
87
- projectId: string;
88
87
  tenantId: string;
88
+ projectId: string;
89
+ credentialReferenceId: string | null;
89
90
  config: {
90
91
  type: "mcp";
91
92
  mcp: ToolMcpConfig;
92
93
  };
93
- credentialReferenceId: string | null;
94
94
  credentialScope: string;
95
95
  imageUrl: string | null;
96
96
  capabilities: ToolServerCapabilities | null;
@@ -139,15 +139,15 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
139
139
  createdAt: string;
140
140
  updatedAt: string;
141
141
  headers: Record<string, string> | null;
142
- agentId: string;
143
- projectId: string;
144
142
  tenantId: string;
143
+ projectId: string;
144
+ agentId: string;
145
145
  subAgentId: string;
146
146
  toolId: string;
147
+ selectedTools: string[] | null;
147
148
  toolPolicies: Record<string, {
148
149
  needsApproval?: boolean;
149
150
  }> | null;
150
- selectedTools: string[] | null;
151
151
  }>;
152
152
  declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
153
153
  scopes: AgentScopeConfig;
@@ -158,15 +158,15 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
158
158
  createdAt: string;
159
159
  updatedAt: string;
160
160
  headers: Record<string, string> | null;
161
- agentId: string;
162
- projectId: string;
163
161
  tenantId: string;
162
+ projectId: string;
163
+ agentId: string;
164
164
  subAgentId: string;
165
165
  toolId: string;
166
+ selectedTools: string[] | null;
166
167
  toolPolicies: Record<string, {
167
168
  needsApproval?: boolean;
168
169
  }> | 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)
@@ -186,15 +186,15 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
186
186
  createdAt: string;
187
187
  updatedAt: string;
188
188
  headers: Record<string, string> | null;
189
- agentId: string;
190
- projectId: string;
191
189
  tenantId: string;
190
+ projectId: string;
191
+ agentId: string;
192
192
  subAgentId: string;
193
193
  toolId: string;
194
+ selectedTools: string[] | null;
194
195
  toolPolicies: Record<string, {
195
196
  needsApproval?: boolean;
196
197
  }> | null;
197
- selectedTools: string[] | null;
198
198
  }>;
199
199
  /**
200
200
  * Upsert a tool (create if it doesn't exist, update if it does)
@@ -208,13 +208,13 @@ declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
208
208
  updatedAt: string;
209
209
  description: string | null;
210
210
  headers: Record<string, string> | null;
211
- projectId: string;
212
211
  tenantId: string;
212
+ projectId: string;
213
+ credentialReferenceId: string | null;
213
214
  config: {
214
215
  type: "mcp";
215
216
  mcp: ToolMcpConfig;
216
217
  };
217
- credentialReferenceId: string | null;
218
218
  credentialScope: string;
219
219
  imageUrl: string | null;
220
220
  capabilities: ToolServerCapabilities | null;
@@ -2,8 +2,8 @@ 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 { deleteScheduledTriggersByRunAsUserId } from "./scheduledTriggers.js";
6
5
  import { deleteTriggersByRunAsUserId } from "./triggers.js";
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";
9
9
 
@@ -13,6 +13,22 @@ async function cleanupUserTriggers(params) {
13
13
  const { tenantId, userId, runDb, manageDbPool } = params;
14
14
  const projects = await listProjectsMetadata(runDb)({ tenantId });
15
15
  if (projects.length === 0) return;
16
+ await Promise.allSettled(projects.map(async (project) => {
17
+ try {
18
+ await deleteScheduledTriggersByRunAsUserId(runDb)({
19
+ tenantId,
20
+ projectId: project.id,
21
+ runAsUserId: userId
22
+ });
23
+ } catch (err) {
24
+ logger.error({
25
+ tenantId,
26
+ projectId: project.id,
27
+ userId,
28
+ error: err
29
+ }, "Failed to clean up scheduled triggers for project");
30
+ }
31
+ }));
16
32
  const connection = await manageDbPool.connect();
17
33
  let resolvedRefs;
18
34
  try {
@@ -21,11 +37,6 @@ async function cleanupUserTriggers(params) {
21
37
  connection.release();
22
38
  }
23
39
  const results = await Promise.allSettled(resolvedRefs.map(({ projectId, ref }) => withRef(manageDbPool, ref, async (db) => {
24
- await deleteScheduledTriggersByRunAsUserId(db)({
25
- tenantId,
26
- projectId,
27
- runAsUserId: userId
28
- });
29
40
  await deleteTriggersByRunAsUserId(db)({
30
41
  tenantId,
31
42
  projectId,
@@ -43,7 +54,7 @@ async function cleanupUserTriggers(params) {
43
54
  projectId,
44
55
  userId,
45
56
  error: result.reason
46
- }, "Failed to clean up scheduled triggers for project");
57
+ }, "Failed to clean up webhook triggers for project");
47
58
  }
48
59
  }
49
60
 
@@ -13,9 +13,9 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
15
  expiresAt: string | null;
16
- agentId: string;
17
- projectId: string;
18
16
  tenantId: string;
17
+ projectId: string;
18
+ agentId: string;
19
19
  publicId: string;
20
20
  keyHash: string;
21
21
  keyPrefix: string;
@@ -27,9 +27,9 @@ declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: s
27
27
  createdAt: string;
28
28
  updatedAt: string;
29
29
  expiresAt: string | null;
30
- agentId: string;
31
- projectId: string;
32
30
  tenantId: string;
31
+ projectId: string;
32
+ agentId: string;
33
33
  publicId: string;
34
34
  keyHash: string;
35
35
  keyPrefix: string;
@@ -44,9 +44,9 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
44
44
  createdAt: string;
45
45
  updatedAt: string;
46
46
  expiresAt: string | null;
47
- agentId: string;
48
- projectId: string;
49
47
  tenantId: string;
48
+ projectId: string;
49
+ agentId: string;
50
50
  publicId: string;
51
51
  keyHash: string;
52
52
  keyPrefix: string;
@@ -71,9 +71,9 @@ declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInse
71
71
  createdAt: string;
72
72
  updatedAt: string;
73
73
  expiresAt: string | null;
74
- agentId: string;
75
- projectId: string;
76
74
  tenantId: string;
75
+ projectId: string;
76
+ agentId: string;
77
77
  publicId: string;
78
78
  keyHash: string;
79
79
  keyPrefix: string;
@@ -5,15 +5,15 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
5
5
 
6
6
  //#region src/data-access/runtime/apps.d.ts
7
7
  declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
8
- type: AppType;
9
8
  id: string;
10
9
  name: string;
11
10
  createdAt: string;
12
11
  updatedAt: string;
13
12
  description: string | null;
14
13
  enabled: boolean;
15
- projectId: string | null;
14
+ type: AppType;
16
15
  tenantId: string | null;
16
+ projectId: string | null;
17
17
  prompt: string | null;
18
18
  config: {
19
19
  type: "web_client";
@@ -64,15 +64,15 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
64
64
  };
65
65
  }>;
66
66
  declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
67
- type: AppType;
68
67
  id: string;
69
68
  name: string;
70
69
  createdAt: string;
71
70
  updatedAt: string;
72
71
  description: string | null;
73
72
  enabled: boolean;
74
- projectId: string | null;
73
+ type: AppType;
75
74
  tenantId: string | null;
75
+ projectId: string | null;
76
76
  prompt: string | null;
77
77
  config: {
78
78
  type: "web_client";
@@ -19,6 +19,7 @@ type CascadeDeleteResult = {
19
19
  slackWorkspaceDefaultsCleared: number;
20
20
  appsDeleted: number;
21
21
  appDefaultsCleared: number;
22
+ scheduledTriggersDeleted: number;
22
23
  };
23
24
  /**
24
25
  * Delete all runtime entities for a specific branch.
@@ -30,6 +31,7 @@ type CascadeDeleteResult = {
30
31
  declare const cascadeDeleteByBranch: (db: AgentsRunDatabaseClient) => (params: {
31
32
  scopes: ProjectScopeConfig;
32
33
  fullBranchName: string;
34
+ ref: string;
33
35
  }) => Promise<CascadeDeleteResult>;
34
36
  /**
35
37
  * Delete all runtime entities for a project on a specific branch.