@inkeep/agents-core 0.58.2 → 0.58.4

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 (59) hide show
  1. package/dist/auth/auth-schema.d.ts +85 -85
  2. package/dist/auth/auth-validation-schemas.d.ts +152 -152
  3. package/dist/auth/auth.d.ts +9 -9
  4. package/dist/auth/permissions.d.ts +9 -9
  5. package/dist/client-exports.d.ts +5 -5
  6. package/dist/client-exports.js +2 -2
  7. package/dist/constants/models.d.ts +34 -2
  8. package/dist/constants/models.js +37 -5
  9. package/dist/data-access/index.d.ts +2 -1
  10. package/dist/data-access/index.js +2 -1
  11. package/dist/data-access/manage/agents.d.ts +21 -21
  12. package/dist/data-access/manage/artifactComponents.d.ts +8 -8
  13. package/dist/data-access/manage/contextConfigs.d.ts +8 -8
  14. package/dist/data-access/manage/dataComponents.d.ts +4 -4
  15. package/dist/data-access/manage/functionTools.d.ts +10 -10
  16. package/dist/data-access/manage/skills.d.ts +12 -12
  17. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +18 -18
  18. package/dist/data-access/manage/subAgentRelations.d.ts +18 -18
  19. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
  20. package/dist/data-access/manage/subAgents.d.ts +15 -15
  21. package/dist/data-access/manage/tools.d.ts +15 -15
  22. package/dist/data-access/manage/tools.js +16 -2
  23. package/dist/data-access/manage/triggers.d.ts +2 -2
  24. package/dist/data-access/runtime/apiKeys.d.ts +12 -12
  25. package/dist/data-access/runtime/cascade-delete.d.ts +3 -0
  26. package/dist/data-access/runtime/cascade-delete.js +11 -4
  27. package/dist/data-access/runtime/conversations.d.ts +31 -31
  28. package/dist/data-access/runtime/github-work-app-installations.d.ts +25 -5
  29. package/dist/data-access/runtime/github-work-app-installations.js +20 -17
  30. package/dist/data-access/runtime/messages.d.ts +9 -9
  31. package/dist/data-access/runtime/slack-work-app-mcp.d.ts +26 -0
  32. package/dist/data-access/runtime/slack-work-app-mcp.js +69 -0
  33. package/dist/data-access/runtime/tasks.d.ts +9 -9
  34. package/dist/data-access/runtime/workAppSlack.js +2 -2
  35. package/dist/db/manage/manage-schema.d.ts +453 -453
  36. package/dist/db/manage/scope-definitions.d.ts +3 -1
  37. package/dist/db/manage/scope-definitions.js +5 -0
  38. package/dist/db/runtime/runtime-schema.d.ts +465 -311
  39. package/dist/db/runtime/runtime-schema.js +29 -2
  40. package/dist/env.d.ts +2 -0
  41. package/dist/env.js +1 -0
  42. package/dist/index.d.ts +5 -4
  43. package/dist/index.js +4 -3
  44. package/dist/middleware/no-auth.d.ts +2 -2
  45. package/dist/setup/setup.js +14 -3
  46. package/dist/types/index.d.ts +2 -2
  47. package/dist/types/utility.d.ts +9 -2
  48. package/dist/validation/dolt-schemas.d.ts +1 -1
  49. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  50. package/dist/validation/index.d.ts +2 -2
  51. package/dist/validation/index.js +2 -2
  52. package/dist/validation/schemas.d.ts +1922 -1893
  53. package/dist/validation/schemas.js +16 -2
  54. package/drizzle/runtime/0020_tiny_killmonger.sql +15 -0
  55. package/drizzle/runtime/0021_careful_xorn.sql +2 -0
  56. package/drizzle/runtime/meta/0020_snapshot.json +4122 -0
  57. package/drizzle/runtime/meta/0021_snapshot.json +4124 -0
  58. package/drizzle/runtime/meta/_journal.json +14 -0
  59. package/package.json +1 -1
@@ -10,11 +10,11 @@ declare const getAgentRelationById: (db: AgentsManageDatabaseClient) => (params:
10
10
  relationId: string;
11
11
  }) => Promise<{
12
12
  id: string;
13
- createdAt: string;
14
- updatedAt: string;
15
13
  tenantId: string;
16
14
  projectId: string;
17
15
  agentId: string;
16
+ createdAt: string;
17
+ updatedAt: string;
18
18
  sourceSubAgentId: string;
19
19
  targetSubAgentId: string | null;
20
20
  relationType: string | null;
@@ -45,11 +45,11 @@ declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
45
45
  scopes: SubAgentScopeConfig;
46
46
  }) => Promise<{
47
47
  id: string;
48
- createdAt: string;
49
- updatedAt: string;
50
48
  tenantId: string;
51
49
  projectId: string;
52
50
  agentId: string;
51
+ createdAt: string;
52
+ updatedAt: string;
53
53
  sourceSubAgentId: string;
54
54
  targetSubAgentId: string | null;
55
55
  relationType: string | null;
@@ -58,11 +58,11 @@ declare const getAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (par
58
58
  scopes: AgentScopeConfig;
59
59
  }) => Promise<{
60
60
  id: string;
61
- createdAt: string;
62
- updatedAt: string;
63
61
  tenantId: string;
64
62
  projectId: string;
65
63
  agentId: string;
64
+ createdAt: string;
65
+ updatedAt: string;
66
66
  sourceSubAgentId: string;
67
67
  targetSubAgentId: string | null;
68
68
  relationType: string | null;
@@ -127,11 +127,11 @@ declare const getRelatedAgentsForAgent: (db: AgentsManageDatabaseClient) => (par
127
127
  }>;
128
128
  declare const createSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
129
129
  id: string;
130
- createdAt: string;
131
- updatedAt: string;
132
130
  tenantId: string;
133
131
  projectId: string;
134
132
  agentId: string;
133
+ createdAt: string;
134
+ updatedAt: string;
135
135
  sourceSubAgentId: string;
136
136
  targetSubAgentId: string | null;
137
137
  relationType: string | null;
@@ -146,11 +146,11 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
146
146
  relationType: string;
147
147
  }) => Promise<{
148
148
  id: string;
149
- createdAt: string;
150
- updatedAt: string;
151
149
  tenantId: string;
152
150
  projectId: string;
153
151
  agentId: string;
152
+ createdAt: string;
153
+ updatedAt: string;
154
154
  sourceSubAgentId: string;
155
155
  targetSubAgentId: string | null;
156
156
  relationType: string | null;
@@ -160,11 +160,11 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
160
160
  */
161
161
  declare const upsertSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
162
162
  id: string;
163
- createdAt: string;
164
- updatedAt: string;
165
163
  tenantId: string;
166
164
  projectId: string;
167
165
  agentId: string;
166
+ createdAt: string;
167
+ updatedAt: string;
168
168
  sourceSubAgentId: string;
169
169
  targetSubAgentId: string | null;
170
170
  relationType: string | null;
@@ -205,17 +205,17 @@ declare const createAgentToolRelation: (db: AgentsManageDatabaseClient) => (para
205
205
  };
206
206
  }) => Promise<{
207
207
  id: string;
208
- createdAt: string;
209
- updatedAt: string;
210
208
  tenantId: string;
211
209
  projectId: string;
212
- subAgentId: string;
213
210
  agentId: string;
211
+ createdAt: string;
212
+ updatedAt: string;
214
213
  toolId: string;
215
214
  headers: Record<string, string> | null;
216
215
  toolPolicies: Record<string, {
217
216
  needsApproval?: boolean;
218
217
  }> | null;
218
+ subAgentId: string;
219
219
  selectedTools: string[] | null;
220
220
  }>;
221
221
  declare const updateAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
@@ -249,17 +249,17 @@ declare const getAgentToolRelationById: (db: AgentsManageDatabaseClient) => (par
249
249
  relationId: string;
250
250
  }) => Promise<{
251
251
  id: string;
252
- createdAt: string;
253
- updatedAt: string;
254
252
  tenantId: string;
255
253
  projectId: string;
256
- subAgentId: string;
257
254
  agentId: string;
255
+ createdAt: string;
256
+ updatedAt: string;
258
257
  toolId: string;
259
258
  headers: Record<string, string> | null;
260
259
  toolPolicies: Record<string, {
261
260
  needsApproval?: boolean;
262
261
  }> | null;
262
+ subAgentId: string;
263
263
  selectedTools: string[] | null;
264
264
  } | undefined>;
265
265
  declare const getAgentToolRelationByAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -10,13 +10,13 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
10
10
  relationId: string;
11
11
  }) => Promise<{
12
12
  id: string;
13
- createdAt: string;
14
- updatedAt: string;
15
13
  tenantId: string;
16
14
  projectId: string;
17
- subAgentId: string;
18
15
  agentId: string;
16
+ createdAt: string;
17
+ updatedAt: string;
19
18
  headers: Record<string, string> | null;
19
+ subAgentId: string;
20
20
  targetAgentId: string;
21
21
  } | undefined>;
22
22
  declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
@@ -45,26 +45,26 @@ declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =>
45
45
  scopes: SubAgentScopeConfig;
46
46
  }) => Promise<{
47
47
  id: string;
48
- createdAt: string;
49
- updatedAt: string;
50
48
  tenantId: string;
51
49
  projectId: string;
52
- subAgentId: string;
53
50
  agentId: string;
51
+ createdAt: string;
52
+ updatedAt: string;
54
53
  headers: Record<string, string> | null;
54
+ subAgentId: string;
55
55
  targetAgentId: string;
56
56
  }[]>;
57
57
  declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
58
58
  scopes: AgentScopeConfig;
59
59
  }) => Promise<{
60
60
  id: string;
61
- createdAt: string;
62
- updatedAt: string;
63
61
  tenantId: string;
64
62
  projectId: string;
65
- subAgentId: string;
66
63
  agentId: string;
64
+ createdAt: string;
65
+ updatedAt: string;
67
66
  headers: Record<string, string> | null;
67
+ subAgentId: string;
68
68
  targetAgentId: string;
69
69
  }[]>;
70
70
  declare const getSubAgentTeamAgentRelationsByTeamAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -211,13 +211,13 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
211
211
  };
212
212
  }) => Promise<{
213
213
  id: string;
214
- createdAt: string;
215
- updatedAt: string;
216
214
  tenantId: string;
217
215
  projectId: string;
218
- subAgentId: string;
219
216
  agentId: string;
217
+ createdAt: string;
218
+ updatedAt: string;
220
219
  headers: Record<string, string> | null;
220
+ subAgentId: string;
221
221
  targetAgentId: string;
222
222
  }>;
223
223
  /**
@@ -228,13 +228,13 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
228
228
  targetAgentId: string;
229
229
  }) => Promise<{
230
230
  id: string;
231
- createdAt: string;
232
- updatedAt: string;
233
231
  tenantId: string;
234
232
  projectId: string;
235
- subAgentId: string;
236
233
  agentId: string;
234
+ createdAt: string;
235
+ updatedAt: string;
237
236
  headers: Record<string, string> | null;
237
+ subAgentId: string;
238
238
  targetAgentId: string;
239
239
  } | undefined>;
240
240
  /**
@@ -249,13 +249,13 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
249
249
  };
250
250
  }) => Promise<{
251
251
  id: string;
252
- createdAt: string;
253
- updatedAt: string;
254
252
  tenantId: string;
255
253
  projectId: string;
256
- subAgentId: string;
257
254
  agentId: string;
255
+ createdAt: string;
256
+ updatedAt: string;
258
257
  headers: Record<string, string> | null;
258
+ subAgentId: string;
259
259
  targetAgentId: string;
260
260
  }>;
261
261
  declare const updateSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
@@ -11,11 +11,12 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
11
11
  }) => Promise<{
12
12
  id: string;
13
13
  name: string;
14
- createdAt: string;
15
- updatedAt: string;
16
14
  description: string | null;
17
15
  tenantId: string;
18
16
  projectId: string;
17
+ agentId: string;
18
+ prompt: string | null;
19
+ conversationHistoryConfig: ConversationHistoryConfig | null;
19
20
  models: {
20
21
  base?: {
21
22
  model?: string | undefined;
@@ -33,20 +34,20 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
33
34
  stopWhen: {
34
35
  stepCountIs?: number | undefined;
35
36
  } | null;
36
- agentId: string;
37
- prompt: string | null;
38
- conversationHistoryConfig: ConversationHistoryConfig | null;
37
+ createdAt: string;
38
+ updatedAt: string;
39
39
  } | undefined>;
40
40
  declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
41
41
  scopes: AgentScopeConfig;
42
42
  }) => Promise<{
43
43
  id: string;
44
44
  name: string;
45
- createdAt: string;
46
- updatedAt: string;
47
45
  description: string | null;
48
46
  tenantId: string;
49
47
  projectId: string;
48
+ agentId: string;
49
+ prompt: string | null;
50
+ conversationHistoryConfig: ConversationHistoryConfig | null;
50
51
  models: {
51
52
  base?: {
52
53
  model?: string | undefined;
@@ -64,9 +65,8 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
64
65
  stopWhen: {
65
66
  stepCountIs?: number | undefined;
66
67
  } | null;
67
- agentId: string;
68
- prompt: string | null;
69
- conversationHistoryConfig: ConversationHistoryConfig | null;
68
+ createdAt: string;
69
+ updatedAt: string;
70
70
  }[]>;
71
71
  declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
72
72
  scopes: AgentScopeConfig;
@@ -111,11 +111,12 @@ declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (param
111
111
  declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAgentInsert) => Promise<{
112
112
  id: string;
113
113
  name: string;
114
- createdAt: string;
115
- updatedAt: string;
116
114
  description: string | null;
117
115
  tenantId: string;
118
116
  projectId: string;
117
+ agentId: string;
118
+ prompt: string | null;
119
+ conversationHistoryConfig: ConversationHistoryConfig | null;
119
120
  models: {
120
121
  base?: {
121
122
  model?: string | undefined;
@@ -133,9 +134,8 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
133
134
  stopWhen: {
134
135
  stepCountIs?: number | undefined;
135
136
  } | null;
136
- agentId: string;
137
- prompt: string | null;
138
- conversationHistoryConfig: ConversationHistoryConfig | null;
137
+ createdAt: string;
138
+ updatedAt: string;
139
139
  }>;
140
140
  declare const updateSubAgent: (db: AgentsManageDatabaseClient) => (params: {
141
141
  scopes: AgentScopeConfig;
@@ -21,11 +21,11 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
21
21
  }) => Promise<{
22
22
  id: string;
23
23
  name: string;
24
- createdAt: string;
25
- updatedAt: string;
26
24
  description: string | null;
27
25
  tenantId: string;
28
26
  projectId: string;
27
+ createdAt: string;
28
+ updatedAt: string;
29
29
  headers: Record<string, string> | null;
30
30
  config: {
31
31
  type: "mcp";
@@ -79,11 +79,11 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
79
79
  declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
80
80
  id: string;
81
81
  name: string;
82
- createdAt: string;
83
- updatedAt: string;
84
82
  description: string | null;
85
83
  tenantId: string;
86
84
  projectId: string;
85
+ createdAt: string;
86
+ updatedAt: string;
87
87
  headers: Record<string, string> | null;
88
88
  config: {
89
89
  type: "mcp";
@@ -135,17 +135,17 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
135
135
  }> | null;
136
136
  }) => Promise<{
137
137
  id: string;
138
- createdAt: string;
139
- updatedAt: string;
140
138
  tenantId: string;
141
139
  projectId: string;
142
- subAgentId: string;
143
140
  agentId: string;
141
+ createdAt: string;
142
+ updatedAt: string;
144
143
  toolId: string;
145
144
  headers: Record<string, string> | null;
146
145
  toolPolicies: Record<string, {
147
146
  needsApproval?: boolean;
148
147
  }> | null;
148
+ subAgentId: string;
149
149
  selectedTools: string[] | null;
150
150
  }>;
151
151
  declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -154,17 +154,17 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
154
154
  toolId: string;
155
155
  }) => Promise<{
156
156
  id: string;
157
- createdAt: string;
158
- updatedAt: string;
159
157
  tenantId: string;
160
158
  projectId: string;
161
- subAgentId: string;
162
159
  agentId: string;
160
+ createdAt: string;
161
+ updatedAt: string;
163
162
  toolId: string;
164
163
  headers: Record<string, string> | null;
165
164
  toolPolicies: Record<string, {
166
165
  needsApproval?: boolean;
167
166
  }> | null;
167
+ subAgentId: string;
168
168
  selectedTools: string[] | null;
169
169
  }>;
170
170
  /**
@@ -182,17 +182,17 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
182
182
  relationId?: string;
183
183
  }) => Promise<{
184
184
  id: string;
185
- createdAt: string;
186
- updatedAt: string;
187
185
  tenantId: string;
188
186
  projectId: string;
189
- subAgentId: string;
190
187
  agentId: string;
188
+ createdAt: string;
189
+ updatedAt: string;
191
190
  toolId: string;
192
191
  headers: Record<string, string> | null;
193
192
  toolPolicies: Record<string, {
194
193
  needsApproval?: boolean;
195
194
  }> | null;
195
+ subAgentId: string;
196
196
  selectedTools: string[] | null;
197
197
  }>;
198
198
  /**
@@ -203,11 +203,11 @@ declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
203
203
  }) => Promise<{
204
204
  id: string;
205
205
  name: string;
206
- createdAt: string;
207
- updatedAt: string;
208
206
  description: string | null;
209
207
  tenantId: string;
210
208
  projectId: string;
209
+ createdAt: string;
210
+ updatedAt: string;
211
211
  headers: Record<string, string> | null;
212
212
  config: {
213
213
  type: "mcp";
@@ -9,6 +9,7 @@ import "../../credential-stuffer/index.js";
9
9
  import { createAgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
10
10
  import { generateId } from "../../utils/conversations.js";
11
11
  import { getActiveBranch } from "../../dolt/schema-sync.js";
12
+ import { isSlackWorkAppTool } from "../runtime/slack-work-app-mcp.js";
12
13
  import { cascadeDeleteByTool } from "../runtime/cascade-delete.js";
13
14
  import { updateAgentToolRelation } from "./subAgentRelations.js";
14
15
  import { toISODateString } from "../../utils/date.js";
@@ -122,8 +123,17 @@ const discoverToolsFromServer = async (tool, credentialReference, credentialStor
122
123
  if (isGithubWorkAppTool(tool)) serverConfig.headers = {
123
124
  ...serverConfig.headers,
124
125
  "x-inkeep-tool-id": tool.id,
126
+ "x-inkeep-tenant-id": tool.tenantId,
127
+ "x-inkeep-project-id": tool.projectId,
125
128
  Authorization: `Bearer ${env.GITHUB_MCP_API_KEY}`
126
129
  };
130
+ if (isSlackWorkAppTool(tool)) serverConfig.headers = {
131
+ ...serverConfig.headers,
132
+ "x-inkeep-tool-id": tool.id,
133
+ "x-inkeep-tenant-id": tool.tenantId,
134
+ "x-inkeep-project-id": tool.projectId,
135
+ Authorization: `Bearer ${env.SLACK_MCP_API_KEY}`
136
+ };
127
137
  const client = new McpClient({
128
138
  name: tool.name,
129
139
  server: serverConfig
@@ -330,8 +340,12 @@ const updateTool = (db) => async (params) => {
330
340
  const deleteTool = (db) => async (params) => {
331
341
  const [deleted] = await db.delete(tools).where(and(eq(tools.tenantId, params.scopes.tenantId), eq(tools.projectId, params.scopes.projectId), eq(tools.id, params.toolId))).returning();
332
342
  if (!deleted) return false;
333
- if (deleted.isWorkApp && deleted.config.mcp.server.url.includes("/github/mcp")) try {
334
- if (await getActiveBranch(db)() === `${params.scopes.tenantId}_${params.scopes.projectId}_main`) await cascadeDeleteByTool(createAgentsRunDatabaseClient())({ toolId: params.toolId });
343
+ if (deleted.isWorkApp && deleted.config.mcp.server.url.includes("/github/mcp") || isSlackWorkAppTool(deleted)) try {
344
+ if (await getActiveBranch(db)() === `${params.scopes.tenantId}_${params.scopes.projectId}_main`) await cascadeDeleteByTool(createAgentsRunDatabaseClient())({
345
+ toolId: params.toolId,
346
+ tenantId: params.scopes.tenantId,
347
+ projectId: params.scopes.projectId
348
+ });
335
349
  } catch (error) {
336
350
  logger.debug({
337
351
  error,
@@ -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;
@@ -10,12 +10,12 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
10
10
  }) => Promise<{
11
11
  id: string;
12
12
  name: string | null;
13
- createdAt: string;
14
- updatedAt: string;
15
- expiresAt: string | null;
16
13
  tenantId: string;
17
14
  projectId: string;
18
15
  agentId: string;
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ expiresAt: string | null;
19
19
  publicId: string;
20
20
  keyHash: string;
21
21
  keyPrefix: string;
@@ -24,12 +24,12 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
24
24
  declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
25
25
  id: string;
26
26
  name: string | null;
27
- createdAt: string;
28
- updatedAt: string;
29
- expiresAt: string | null;
30
27
  tenantId: string;
31
28
  projectId: string;
32
29
  agentId: string;
30
+ createdAt: string;
31
+ updatedAt: string;
32
+ expiresAt: string | null;
33
33
  publicId: string;
34
34
  keyHash: string;
35
35
  keyPrefix: string;
@@ -41,12 +41,12 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
41
41
  }) => Promise<{
42
42
  id: string;
43
43
  name: string | null;
44
- createdAt: string;
45
- updatedAt: string;
46
- expiresAt: string | null;
47
44
  tenantId: string;
48
45
  projectId: string;
49
46
  agentId: string;
47
+ createdAt: string;
48
+ updatedAt: string;
49
+ expiresAt: string | null;
50
50
  publicId: string;
51
51
  keyHash: string;
52
52
  keyPrefix: string;
@@ -68,12 +68,12 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
68
68
  declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
69
69
  id: string;
70
70
  name: string | null;
71
- createdAt: string;
72
- updatedAt: string;
73
- expiresAt: string | null;
74
71
  tenantId: string;
75
72
  projectId: string;
76
73
  agentId: string;
74
+ createdAt: string;
75
+ updatedAt: string;
76
+ expiresAt: string | null;
77
77
  publicId: string;
78
78
  keyHash: string;
79
79
  keyPrefix: string;
@@ -81,6 +81,7 @@ declare const cascadeDeleteByContextConfig: (db: AgentsRunDatabaseClient) => (pa
81
81
  type ToolCascadeDeleteResult = {
82
82
  mcpToolRepositoryAccessDeleted: number;
83
83
  mcpToolAccessModeDeleted: boolean;
84
+ slackMcpToolAccessConfigDeleted: boolean;
84
85
  };
85
86
  /**
86
87
  * Delete all runtime entities for a specific MCP tool.
@@ -95,6 +96,8 @@ type ToolCascadeDeleteResult = {
95
96
  */
96
97
  declare const cascadeDeleteByTool: (db: AgentsRunDatabaseClient) => (params: {
97
98
  toolId: string;
99
+ tenantId: string;
100
+ projectId: string;
98
101
  }) => Promise<ToolCascadeDeleteResult>;
99
102
  /**
100
103
  * Result of a project cascade delete operation (GitHub access only)
@@ -1,4 +1,5 @@
1
1
  import { apiKeys, contextCache, conversations, tasks, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess } from "../../db/runtime/runtime-schema.js";
2
+ import { deleteSlackMcpToolAccessConfig } from "./slack-work-app-mcp.js";
2
3
  import { clearDevConfigWorkspaceDefaultsByAgent, clearDevConfigWorkspaceDefaultsByProject, clearWorkspaceDefaultsByAgent, clearWorkspaceDefaultsByProject, deleteWorkAppSlackChannelAgentConfigsByAgent, deleteWorkAppSlackChannelAgentConfigsByProject } from "./workAppSlack.js";
3
4
  import { and, eq, inArray, sql } from "drizzle-orm";
4
5
 
@@ -137,12 +138,18 @@ const cascadeDeleteByContextConfig = (db) => async (params) => {
137
138
  * @returns Function that performs the cascade delete
138
139
  */
139
140
  const cascadeDeleteByTool = (db) => async (params) => {
140
- const { toolId } = params;
141
- const repositoryAccessResult = await db.delete(workAppGitHubMcpToolRepositoryAccess).where(eq(workAppGitHubMcpToolRepositoryAccess.toolId, toolId)).returning();
142
- const accessModeResult = await db.delete(workAppGitHubMcpToolAccessMode).where(eq(workAppGitHubMcpToolAccessMode.toolId, toolId)).returning();
141
+ const { toolId, tenantId, projectId } = params;
142
+ const repositoryAccessResult = await db.delete(workAppGitHubMcpToolRepositoryAccess).where(and(eq(workAppGitHubMcpToolRepositoryAccess.tenantId, tenantId), eq(workAppGitHubMcpToolRepositoryAccess.projectId, projectId), eq(workAppGitHubMcpToolRepositoryAccess.toolId, toolId))).returning();
143
+ const accessModeResult = await db.delete(workAppGitHubMcpToolAccessMode).where(and(eq(workAppGitHubMcpToolAccessMode.tenantId, tenantId), eq(workAppGitHubMcpToolAccessMode.projectId, projectId), eq(workAppGitHubMcpToolAccessMode.toolId, toolId))).returning();
144
+ const slackMcpDeleted = await deleteSlackMcpToolAccessConfig(db)({
145
+ tenantId,
146
+ projectId,
147
+ toolId
148
+ });
143
149
  return {
144
150
  mcpToolRepositoryAccessDeleted: repositoryAccessResult.length,
145
- mcpToolAccessModeDeleted: accessModeResult.length > 0
151
+ mcpToolAccessModeDeleted: accessModeResult.length > 0,
152
+ slackMcpToolAccessConfigDeleted: slackMcpDeleted
146
153
  };
147
154
  };
148
155
  /**