@inkeep/agents-core 0.58.1 → 0.58.3

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 (61) hide show
  1. package/dist/auth/auth-schema.d.ts +85 -85
  2. package/dist/auth/auth-validation-schemas.d.ts +135 -135
  3. package/dist/client-exports.d.ts +2 -2
  4. package/dist/client-exports.js +2 -2
  5. package/dist/constants/allowed-image-formats.d.ts +8 -0
  6. package/dist/constants/allowed-image-formats.js +38 -0
  7. package/dist/constants/models.d.ts +2 -0
  8. package/dist/constants/models.js +2 -0
  9. package/dist/constants/otel-attributes.d.ts +1 -0
  10. package/dist/constants/otel-attributes.js +1 -0
  11. package/dist/data-access/index.d.ts +2 -1
  12. package/dist/data-access/index.js +2 -1
  13. package/dist/data-access/manage/agents.d.ts +20 -20
  14. package/dist/data-access/manage/artifactComponents.d.ts +12 -12
  15. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  16. package/dist/data-access/manage/dataComponents.d.ts +6 -6
  17. package/dist/data-access/manage/functionTools.d.ts +14 -14
  18. package/dist/data-access/manage/skills.d.ts +15 -15
  19. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +18 -18
  20. package/dist/data-access/manage/subAgentRelations.d.ts +28 -28
  21. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
  22. package/dist/data-access/manage/subAgents.d.ts +12 -12
  23. package/dist/data-access/manage/tools.d.ts +30 -30
  24. package/dist/data-access/manage/tools.js +14 -2
  25. package/dist/data-access/manage/triggers.d.ts +1 -1
  26. package/dist/data-access/runtime/apiKeys.d.ts +20 -20
  27. package/dist/data-access/runtime/cascade-delete.d.ts +3 -0
  28. package/dist/data-access/runtime/cascade-delete.js +9 -2
  29. package/dist/data-access/runtime/conversations.d.ts +16 -16
  30. package/dist/data-access/runtime/messages.d.ts +12 -12
  31. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
  32. package/dist/data-access/runtime/slack-work-app-mcp.d.ts +26 -0
  33. package/dist/data-access/runtime/slack-work-app-mcp.js +69 -0
  34. package/dist/data-access/runtime/tasks.d.ts +5 -5
  35. package/dist/data-access/runtime/workAppSlack.js +2 -2
  36. package/dist/db/manage/manage-schema.d.ts +451 -451
  37. package/dist/db/manage/scope-definitions.d.ts +3 -1
  38. package/dist/db/manage/scope-definitions.js +5 -0
  39. package/dist/db/runtime/runtime-schema.d.ts +459 -305
  40. package/dist/db/runtime/runtime-schema.js +24 -1
  41. package/dist/db/utils.js +4 -0
  42. package/dist/dolt/migrate-all-branches.js +4 -1
  43. package/dist/dolt/migrate-dolt.js +20 -3
  44. package/dist/env.d.ts +2 -0
  45. package/dist/env.js +1 -0
  46. package/dist/index.d.ts +5 -4
  47. package/dist/index.js +4 -3
  48. package/dist/middleware/authz-meta.d.ts +2 -2
  49. package/dist/middleware/create-protected-route.d.ts +2 -2
  50. package/dist/middleware/no-auth.d.ts +2 -2
  51. package/dist/types/index.d.ts +2 -2
  52. package/dist/types/utility.d.ts +9 -2
  53. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  54. package/dist/validation/index.d.ts +2 -2
  55. package/dist/validation/index.js +2 -2
  56. package/dist/validation/schemas.d.ts +1855 -1826
  57. package/dist/validation/schemas.js +16 -2
  58. package/drizzle/runtime/0020_tiny_killmonger.sql +15 -0
  59. package/drizzle/runtime/meta/0020_snapshot.json +4122 -0
  60. package/drizzle/runtime/meta/_journal.json +7 -0
  61. package/package.json +5 -1
@@ -9,13 +9,13 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
9
9
  scopes: SubAgentScopeConfig;
10
10
  relationId: string;
11
11
  }) => Promise<{
12
- tenantId: string;
13
- projectId: string;
14
- agentId: string;
15
12
  subAgentId: string;
16
13
  id: string;
17
14
  createdAt: string;
18
15
  updatedAt: string;
16
+ projectId: string;
17
+ tenantId: string;
18
+ agentId: string;
19
19
  headers: Record<string, string> | null;
20
20
  targetAgentId: string;
21
21
  } | undefined>;
@@ -44,26 +44,26 @@ declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =
44
44
  declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
45
45
  scopes: SubAgentScopeConfig;
46
46
  }) => Promise<{
47
- tenantId: string;
48
- projectId: string;
49
- agentId: string;
50
47
  subAgentId: string;
51
48
  id: string;
52
49
  createdAt: string;
53
50
  updatedAt: string;
51
+ projectId: string;
52
+ tenantId: string;
53
+ agentId: string;
54
54
  headers: Record<string, string> | null;
55
55
  targetAgentId: string;
56
56
  }[]>;
57
57
  declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
58
58
  scopes: AgentScopeConfig;
59
59
  }) => Promise<{
60
- tenantId: string;
61
- projectId: string;
62
- agentId: string;
63
60
  subAgentId: string;
64
61
  id: string;
65
62
  createdAt: string;
66
63
  updatedAt: string;
64
+ projectId: string;
65
+ tenantId: string;
66
+ agentId: string;
67
67
  headers: Record<string, string> | null;
68
68
  targetAgentId: string;
69
69
  }[]>;
@@ -210,13 +210,13 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
210
210
  headers?: Record<string, string> | null;
211
211
  };
212
212
  }) => Promise<{
213
- tenantId: string;
214
- projectId: string;
215
- agentId: string;
216
213
  subAgentId: string;
217
214
  id: string;
218
215
  createdAt: string;
219
216
  updatedAt: string;
217
+ projectId: string;
218
+ tenantId: string;
219
+ agentId: string;
220
220
  headers: Record<string, string> | null;
221
221
  targetAgentId: string;
222
222
  }>;
@@ -227,13 +227,13 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
227
227
  scopes: SubAgentScopeConfig;
228
228
  targetAgentId: string;
229
229
  }) => Promise<{
230
- tenantId: string;
231
- projectId: string;
232
- agentId: string;
233
230
  subAgentId: string;
234
231
  id: string;
235
232
  createdAt: string;
236
233
  updatedAt: string;
234
+ projectId: string;
235
+ tenantId: string;
236
+ agentId: string;
237
237
  headers: Record<string, string> | null;
238
238
  targetAgentId: string;
239
239
  } | undefined>;
@@ -248,13 +248,13 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
248
248
  headers?: Record<string, string> | null;
249
249
  };
250
250
  }) => Promise<{
251
- tenantId: string;
252
- projectId: string;
253
- agentId: string;
254
251
  subAgentId: string;
255
252
  id: string;
256
253
  createdAt: string;
257
254
  updatedAt: string;
255
+ projectId: string;
256
+ tenantId: string;
257
+ agentId: string;
258
258
  headers: Record<string, string> | null;
259
259
  targetAgentId: string;
260
260
  }>;
@@ -9,14 +9,13 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
9
9
  scopes: AgentScopeConfig;
10
10
  subAgentId: string;
11
11
  }) => Promise<{
12
- tenantId: string;
13
- projectId: string;
14
- agentId: string;
15
12
  description: string | null;
16
- name: string;
17
13
  id: string;
14
+ name: string;
18
15
  createdAt: string;
19
16
  updatedAt: string;
17
+ projectId: string;
18
+ tenantId: string;
20
19
  models: {
21
20
  base?: {
22
21
  model?: string | undefined;
@@ -36,18 +35,18 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
36
35
  } | null;
37
36
  prompt: string | null;
38
37
  conversationHistoryConfig: ConversationHistoryConfig | null;
38
+ agentId: string;
39
39
  } | undefined>;
40
40
  declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
41
41
  scopes: AgentScopeConfig;
42
42
  }) => Promise<{
43
- tenantId: string;
44
- projectId: string;
45
- agentId: string;
46
43
  description: string | null;
47
- name: string;
48
44
  id: string;
45
+ name: string;
49
46
  createdAt: string;
50
47
  updatedAt: string;
48
+ projectId: string;
49
+ tenantId: string;
51
50
  models: {
52
51
  base?: {
53
52
  model?: string | undefined;
@@ -67,6 +66,7 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
67
66
  } | null;
68
67
  prompt: string | null;
69
68
  conversationHistoryConfig: ConversationHistoryConfig | null;
69
+ agentId: string;
70
70
  }[]>;
71
71
  declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
72
72
  scopes: AgentScopeConfig;
@@ -109,14 +109,13 @@ declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (param
109
109
  };
110
110
  }>;
111
111
  declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAgentInsert) => Promise<{
112
- tenantId: string;
113
- projectId: string;
114
- agentId: string;
115
112
  description: string | null;
116
- name: string;
117
113
  id: string;
114
+ name: string;
118
115
  createdAt: string;
119
116
  updatedAt: string;
117
+ projectId: string;
118
+ tenantId: string;
120
119
  models: {
121
120
  base?: {
122
121
  model?: string | undefined;
@@ -136,6 +135,7 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
136
135
  } | null;
137
136
  prompt: string | null;
138
137
  conversationHistoryConfig: ConversationHistoryConfig | null;
138
+ agentId: string;
139
139
  }>;
140
140
  declare const updateSubAgent: (db: AgentsManageDatabaseClient) => (params: {
141
141
  scopes: AgentScopeConfig;
@@ -19,20 +19,20 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
19
19
  scopes: ProjectScopeConfig;
20
20
  toolId: string;
21
21
  }) => Promise<{
22
- tenantId: string;
23
- projectId: string;
24
22
  description: string | null;
25
- name: string;
26
23
  id: string;
24
+ name: string;
27
25
  createdAt: string;
28
26
  updatedAt: string;
29
- credentialReferenceId: string | null;
27
+ projectId: string;
28
+ tenantId: string;
29
+ headers: Record<string, string> | null;
30
30
  config: {
31
31
  type: "mcp";
32
32
  mcp: ToolMcpConfig;
33
33
  };
34
+ credentialReferenceId: string | null;
34
35
  credentialScope: string;
35
- headers: Record<string, string> | null;
36
36
  imageUrl: string | null;
37
37
  capabilities: ToolServerCapabilities | null;
38
38
  lastError: string | null;
@@ -77,20 +77,20 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
77
77
  };
78
78
  }>;
79
79
  declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
80
- tenantId: string;
81
- projectId: string;
82
80
  description: string | null;
83
- name: string;
84
81
  id: string;
82
+ name: string;
85
83
  createdAt: string;
86
84
  updatedAt: string;
87
- credentialReferenceId: string | null;
85
+ projectId: string;
86
+ tenantId: string;
87
+ headers: Record<string, string> | null;
88
88
  config: {
89
89
  type: "mcp";
90
90
  mcp: ToolMcpConfig;
91
91
  };
92
+ credentialReferenceId: string | null;
92
93
  credentialScope: string;
93
- headers: Record<string, string> | null;
94
94
  imageUrl: string | null;
95
95
  capabilities: ToolServerCapabilities | null;
96
96
  lastError: string | null;
@@ -134,18 +134,18 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
134
134
  needsApproval?: boolean;
135
135
  }> | null;
136
136
  }) => Promise<{
137
- tenantId: string;
138
- projectId: string;
139
- agentId: string;
140
137
  subAgentId: string;
141
138
  id: string;
142
139
  createdAt: string;
143
140
  updatedAt: string;
141
+ projectId: string;
142
+ tenantId: string;
143
+ agentId: string;
144
+ headers: Record<string, string> | null;
145
+ toolId: string;
144
146
  toolPolicies: Record<string, {
145
147
  needsApproval?: boolean;
146
148
  }> | null;
147
- toolId: string;
148
- headers: Record<string, string> | null;
149
149
  selectedTools: string[] | null;
150
150
  }>;
151
151
  declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -153,18 +153,18 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
153
153
  subAgentId: string;
154
154
  toolId: string;
155
155
  }) => Promise<{
156
- tenantId: string;
157
- projectId: string;
158
- agentId: string;
159
156
  subAgentId: string;
160
157
  id: string;
161
158
  createdAt: string;
162
159
  updatedAt: string;
160
+ projectId: string;
161
+ tenantId: string;
162
+ agentId: string;
163
+ headers: Record<string, string> | null;
164
+ toolId: string;
163
165
  toolPolicies: Record<string, {
164
166
  needsApproval?: boolean;
165
167
  }> | null;
166
- toolId: string;
167
- headers: Record<string, string> | null;
168
168
  selectedTools: string[] | null;
169
169
  }>;
170
170
  /**
@@ -181,18 +181,18 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
181
181
  }> | null;
182
182
  relationId?: string;
183
183
  }) => Promise<{
184
- tenantId: string;
185
- projectId: string;
186
- agentId: string;
187
184
  subAgentId: string;
188
185
  id: string;
189
186
  createdAt: string;
190
187
  updatedAt: string;
188
+ projectId: string;
189
+ tenantId: string;
190
+ agentId: string;
191
+ headers: Record<string, string> | null;
192
+ toolId: string;
191
193
  toolPolicies: Record<string, {
192
194
  needsApproval?: boolean;
193
195
  }> | null;
194
- toolId: string;
195
- headers: Record<string, string> | null;
196
196
  selectedTools: string[] | null;
197
197
  }>;
198
198
  /**
@@ -201,20 +201,20 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
201
201
  declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
202
202
  data: ToolInsert;
203
203
  }) => Promise<{
204
- tenantId: string;
205
- projectId: string;
206
204
  description: string | null;
207
- name: string;
208
205
  id: string;
206
+ name: string;
209
207
  createdAt: string;
210
208
  updatedAt: string;
211
- credentialReferenceId: string | null;
209
+ projectId: string;
210
+ tenantId: string;
211
+ headers: Record<string, string> | null;
212
212
  config: {
213
213
  type: "mcp";
214
214
  mcp: ToolMcpConfig;
215
215
  };
216
+ credentialReferenceId: string | null;
216
217
  credentialScope: string;
217
- headers: Record<string, string> | null;
218
218
  imageUrl: string | null;
219
219
  capabilities: ToolServerCapabilities | null;
220
220
  lastError: string | null;
@@ -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";
@@ -124,6 +125,13 @@ const discoverToolsFromServer = async (tool, credentialReference, credentialStor
124
125
  "x-inkeep-tool-id": tool.id,
125
126
  Authorization: `Bearer ${env.GITHUB_MCP_API_KEY}`
126
127
  };
128
+ if (isSlackWorkAppTool(tool)) serverConfig.headers = {
129
+ ...serverConfig.headers,
130
+ "x-inkeep-tool-id": tool.id,
131
+ "x-inkeep-tenant-id": tool.tenantId,
132
+ "x-inkeep-project-id": tool.projectId,
133
+ Authorization: `Bearer ${env.SLACK_MCP_API_KEY}`
134
+ };
127
135
  const client = new McpClient({
128
136
  name: tool.name,
129
137
  server: serverConfig
@@ -330,8 +338,12 @@ const updateTool = (db) => async (params) => {
330
338
  const deleteTool = (db) => async (params) => {
331
339
  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
340
  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 });
341
+ if (deleted.isWorkApp && deleted.config.mcp.server.url.includes("/github/mcp") || isSlackWorkAppTool(deleted)) try {
342
+ if (await getActiveBranch(db)() === `${params.scopes.tenantId}_${params.scopes.projectId}_main`) await cascadeDeleteByTool(createAgentsRunDatabaseClient())({
343
+ toolId: params.toolId,
344
+ tenantId: params.scopes.tenantId,
345
+ projectId: params.scopes.projectId
346
+ });
335
347
  } catch (error) {
336
348
  logger.debug({
337
349
  error,
@@ -46,7 +46,7 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
46
46
  regex?: string | undefined;
47
47
  };
48
48
  signedComponents: {
49
- source: "header" | "literal" | "body";
49
+ source: "literal" | "header" | "body";
50
50
  required: boolean;
51
51
  key?: string | undefined;
52
52
  value?: string | undefined;
@@ -8,49 +8,49 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
8
8
  scopes: ProjectScopeConfig;
9
9
  id: string;
10
10
  }) => Promise<{
11
- tenantId: string;
12
- projectId: string;
13
- agentId: string;
14
- name: string | null;
15
11
  id: string;
12
+ name: string | null;
16
13
  createdAt: string;
17
14
  updatedAt: string;
18
- expiresAt: string | null;
15
+ projectId: string;
16
+ tenantId: string;
17
+ agentId: string;
19
18
  publicId: string;
20
19
  keyHash: string;
21
20
  keyPrefix: string;
22
21
  lastUsedAt: string | null;
22
+ expiresAt: string | null;
23
23
  } | undefined>;
24
24
  declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
25
- tenantId: string;
26
- projectId: string;
27
- agentId: string;
28
- name: string | null;
29
25
  id: string;
26
+ name: string | null;
30
27
  createdAt: string;
31
28
  updatedAt: string;
32
- expiresAt: string | null;
29
+ projectId: string;
30
+ tenantId: string;
31
+ agentId: string;
33
32
  publicId: string;
34
33
  keyHash: string;
35
34
  keyPrefix: string;
36
35
  lastUsedAt: string | null;
36
+ expiresAt: string | null;
37
37
  } | undefined>;
38
38
  declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
39
39
  scopes: ProjectScopeConfig;
40
40
  agentId?: string;
41
41
  }) => Promise<{
42
- tenantId: string;
43
- projectId: string;
44
- agentId: string;
45
- name: string | null;
46
42
  id: string;
43
+ name: string | null;
47
44
  createdAt: string;
48
45
  updatedAt: string;
49
- expiresAt: string | null;
46
+ projectId: string;
47
+ tenantId: string;
48
+ agentId: string;
50
49
  publicId: string;
51
50
  keyHash: string;
52
51
  keyPrefix: string;
53
52
  lastUsedAt: string | null;
53
+ expiresAt: string | null;
54
54
  }[]>;
55
55
  declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
56
56
  scopes: ProjectScopeConfig;
@@ -66,18 +66,18 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
66
66
  };
67
67
  }>;
68
68
  declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
69
- tenantId: string;
70
- projectId: string;
71
- agentId: string;
72
- name: string | null;
73
69
  id: string;
70
+ name: string | null;
74
71
  createdAt: string;
75
72
  updatedAt: string;
76
- expiresAt: string | null;
73
+ projectId: string;
74
+ tenantId: string;
75
+ agentId: string;
77
76
  publicId: string;
78
77
  keyHash: string;
79
78
  keyPrefix: string;
80
79
  lastUsedAt: string | null;
80
+ expiresAt: string | null;
81
81
  }>;
82
82
  declare const updateApiKey: (db: AgentsRunDatabaseClient) => (params: {
83
83
  scopes: ProjectScopeConfig;
@@ -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 { toolId, tenantId, projectId } = params;
141
142
  const repositoryAccessResult = await db.delete(workAppGitHubMcpToolRepositoryAccess).where(eq(workAppGitHubMcpToolRepositoryAccess.toolId, toolId)).returning();
142
143
  const accessModeResult = await db.delete(workAppGitHubMcpToolAccessMode).where(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
  /**
@@ -16,15 +16,15 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
16
16
  total: number;
17
17
  }>;
18
18
  declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
19
- tenantId: string;
20
- projectId: string;
21
- agentId: string | null;
22
19
  title: string | null;
23
- userId: string | null;
24
20
  id: string;
25
21
  createdAt: string;
26
22
  updatedAt: string;
23
+ projectId: string;
24
+ tenantId: string;
27
25
  metadata: ConversationMetadata | null;
26
+ agentId: string | null;
27
+ userId: string | null;
28
28
  ref: {
29
29
  type: "commit" | "tag" | "branch";
30
30
  name: string;
@@ -85,15 +85,15 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
85
85
  scopes: ProjectScopeConfig;
86
86
  conversationId: string;
87
87
  }) => Promise<{
88
- tenantId: string;
89
- projectId: string;
90
- agentId: string | null;
91
88
  title: string | null;
92
- userId: string | null;
93
89
  id: string;
94
90
  createdAt: string;
95
91
  updatedAt: string;
92
+ projectId: string;
93
+ tenantId: string;
96
94
  metadata: ConversationMetadata | null;
95
+ agentId: string | null;
96
+ userId: string | null;
97
97
  ref: {
98
98
  type: "commit" | "tag" | "branch";
99
99
  name: string;
@@ -121,15 +121,15 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
121
121
  metadata?: ConversationMetadata | null | undefined;
122
122
  contextConfigId?: string | undefined;
123
123
  } | {
124
- tenantId: string;
125
- projectId: string;
126
- agentId: string | null;
127
124
  title: string | null;
128
- userId: string | null;
129
125
  id: string;
130
126
  createdAt: string;
131
127
  updatedAt: string;
128
+ projectId: string;
129
+ tenantId: string;
132
130
  metadata: ConversationMetadata | null;
131
+ agentId: string | null;
132
+ userId: string | null;
133
133
  ref: {
134
134
  type: "commit" | "tag" | "branch";
135
135
  name: string;
@@ -153,15 +153,15 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
153
153
  scopes: ProjectScopeConfig;
154
154
  conversationId: string;
155
155
  }) => Promise<{
156
- tenantId: string;
157
- projectId: string;
158
- agentId: string | null;
159
156
  title: string | null;
160
- userId: string | null;
161
157
  id: string;
162
158
  createdAt: string;
163
159
  updatedAt: string;
160
+ projectId: string;
161
+ tenantId: string;
164
162
  metadata: ConversationMetadata | null;
163
+ agentId: string | null;
164
+ userId: string | null;
165
165
  ref: {
166
166
  type: "commit" | "tag" | "branch";
167
167
  name: string;
@@ -10,9 +10,6 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
10
10
  scopes: ProjectScopeConfig;
11
11
  messageId: string;
12
12
  }) => Promise<{
13
- tenantId: string;
14
- projectId: string;
15
- content: MessageContent;
16
13
  fromSubAgentId: string | null;
17
14
  toSubAgentId: string | null;
18
15
  fromExternalAgentId: string | null;
@@ -22,9 +19,12 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
22
19
  id: string;
23
20
  createdAt: string;
24
21
  updatedAt: string;
22
+ projectId: string;
23
+ tenantId: string;
25
24
  metadata: MessageMetadata | null;
26
- role: string;
25
+ content: MessageContent;
27
26
  conversationId: string;
27
+ role: string;
28
28
  fromTeamAgentId: string | null;
29
29
  toTeamAgentId: string | null;
30
30
  visibility: string;
@@ -141,9 +141,6 @@ declare const getVisibleMessages: (db: AgentsRunDatabaseClient) => (params: {
141
141
  id: string;
142
142
  }[]>;
143
143
  declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageInsert) => Promise<{
144
- tenantId: string;
145
- projectId: string;
146
- content: MessageContent;
147
144
  fromSubAgentId: string | null;
148
145
  toSubAgentId: string | null;
149
146
  fromExternalAgentId: string | null;
@@ -153,9 +150,12 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageIn
153
150
  id: string;
154
151
  createdAt: string;
155
152
  updatedAt: string;
153
+ projectId: string;
154
+ tenantId: string;
156
155
  metadata: MessageMetadata | null;
157
- role: string;
156
+ content: MessageContent;
158
157
  conversationId: string;
158
+ role: string;
159
159
  fromTeamAgentId: string | null;
160
160
  toTeamAgentId: string | null;
161
161
  visibility: string;
@@ -194,9 +194,6 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
194
194
  scopes: ProjectScopeConfig;
195
195
  messageId: string;
196
196
  }) => Promise<{
197
- tenantId: string;
198
- projectId: string;
199
- content: MessageContent;
200
197
  fromSubAgentId: string | null;
201
198
  toSubAgentId: string | null;
202
199
  fromExternalAgentId: string | null;
@@ -206,9 +203,12 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
206
203
  id: string;
207
204
  createdAt: string;
208
205
  updatedAt: string;
206
+ projectId: string;
207
+ tenantId: string;
209
208
  metadata: MessageMetadata | null;
210
- role: string;
209
+ content: MessageContent;
211
210
  conversationId: string;
211
+ role: string;
212
212
  fromTeamAgentId: string | null;
213
213
  toTeamAgentId: string | null;
214
214
  visibility: string;
@@ -34,7 +34,7 @@ declare const listScheduledTriggerInvocationsPaginated: (db: AgentsRunDatabaseCl
34
34
  }) => Promise<{
35
35
  data: {
36
36
  scheduledTriggerId: string;
37
- status: "pending" | "running" | "completed" | "failed" | "cancelled";
37
+ status: "pending" | "failed" | "running" | "completed" | "cancelled";
38
38
  scheduledFor: string;
39
39
  startedAt: string | null;
40
40
  completedAt: string | null;
@@ -174,7 +174,7 @@ declare const listUpcomingInvocationsForAgentPaginated: (db: AgentsRunDatabaseCl
174
174
  }) => Promise<{
175
175
  data: {
176
176
  scheduledTriggerId: string;
177
- status: "pending" | "running" | "completed" | "failed" | "cancelled";
177
+ status: "pending" | "failed" | "running" | "completed" | "cancelled";
178
178
  scheduledFor: string;
179
179
  startedAt: string | null;
180
180
  completedAt: string | null;
@@ -208,7 +208,7 @@ declare const listProjectScheduledTriggerInvocationsPaginated: (db: AgentsRunDat
208
208
  }) => Promise<{
209
209
  data: {
210
210
  scheduledTriggerId: string;
211
- status: "pending" | "running" | "completed" | "failed" | "cancelled";
211
+ status: "pending" | "failed" | "running" | "completed" | "cancelled";
212
212
  scheduledFor: string;
213
213
  startedAt: string | null;
214
214
  completedAt: string | null;