@inkeep/agents-core 0.58.2 → 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.
- package/dist/auth/auth-schema.d.ts +85 -85
- package/dist/auth/auth-validation-schemas.d.ts +152 -152
- package/dist/auth/auth.d.ts +28 -28
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/client-exports.d.ts +5 -5
- package/dist/client-exports.js +2 -2
- package/dist/data-access/index.d.ts +2 -1
- package/dist/data-access/index.js +2 -1
- package/dist/data-access/manage/agents.d.ts +15 -15
- package/dist/data-access/manage/artifactComponents.d.ts +14 -14
- package/dist/data-access/manage/contextConfigs.d.ts +4 -4
- package/dist/data-access/manage/dataComponents.d.ts +4 -4
- package/dist/data-access/manage/functionTools.d.ts +10 -10
- package/dist/data-access/manage/skills.d.ts +12 -12
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgents.d.ts +9 -9
- package/dist/data-access/manage/tools.d.ts +15 -15
- package/dist/data-access/manage/tools.js +14 -2
- package/dist/data-access/runtime/apiKeys.d.ts +8 -8
- package/dist/data-access/runtime/cascade-delete.d.ts +3 -0
- package/dist/data-access/runtime/cascade-delete.js +9 -2
- package/dist/data-access/runtime/conversations.d.ts +24 -24
- package/dist/data-access/runtime/messages.d.ts +24 -24
- package/dist/data-access/runtime/slack-work-app-mcp.d.ts +26 -0
- package/dist/data-access/runtime/slack-work-app-mcp.js +69 -0
- package/dist/data-access/runtime/tasks.d.ts +7 -7
- package/dist/data-access/runtime/workAppSlack.js +2 -2
- package/dist/db/manage/scope-definitions.d.ts +3 -1
- package/dist/db/manage/scope-definitions.js +5 -0
- package/dist/db/runtime/runtime-schema.d.ts +156 -2
- package/dist/db/runtime/runtime-schema.js +24 -1
- package/dist/env.d.ts +2 -0
- package/dist/env.js +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/utility.d.ts +9 -2
- package/dist/utils/error.d.ts +51 -51
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/dist/validation/schemas.d.ts +1825 -1796
- package/dist/validation/schemas.js +16 -2
- package/drizzle/runtime/0020_tiny_killmonger.sql +15 -0
- package/drizzle/runtime/meta/0020_snapshot.json +4122 -0
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +1 -1
|
@@ -9,12 +9,12 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
|
|
|
9
9
|
scopes: SubAgentScopeConfig;
|
|
10
10
|
relationId: string;
|
|
11
11
|
}) => Promise<{
|
|
12
|
+
subAgentId: string;
|
|
12
13
|
id: string;
|
|
13
14
|
createdAt: string;
|
|
14
15
|
updatedAt: string;
|
|
15
|
-
tenantId: string;
|
|
16
16
|
projectId: string;
|
|
17
|
-
|
|
17
|
+
tenantId: string;
|
|
18
18
|
agentId: string;
|
|
19
19
|
headers: Record<string, string> | null;
|
|
20
20
|
targetAgentId: string;
|
|
@@ -44,12 +44,12 @@ declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =
|
|
|
44
44
|
declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
45
45
|
scopes: SubAgentScopeConfig;
|
|
46
46
|
}) => Promise<{
|
|
47
|
+
subAgentId: string;
|
|
47
48
|
id: string;
|
|
48
49
|
createdAt: string;
|
|
49
50
|
updatedAt: string;
|
|
50
|
-
tenantId: string;
|
|
51
51
|
projectId: string;
|
|
52
|
-
|
|
52
|
+
tenantId: string;
|
|
53
53
|
agentId: string;
|
|
54
54
|
headers: Record<string, string> | null;
|
|
55
55
|
targetAgentId: string;
|
|
@@ -57,12 +57,12 @@ declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =>
|
|
|
57
57
|
declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
58
58
|
scopes: AgentScopeConfig;
|
|
59
59
|
}) => Promise<{
|
|
60
|
+
subAgentId: string;
|
|
60
61
|
id: string;
|
|
61
62
|
createdAt: string;
|
|
62
63
|
updatedAt: string;
|
|
63
|
-
tenantId: string;
|
|
64
64
|
projectId: string;
|
|
65
|
-
|
|
65
|
+
tenantId: string;
|
|
66
66
|
agentId: string;
|
|
67
67
|
headers: Record<string, string> | null;
|
|
68
68
|
targetAgentId: string;
|
|
@@ -210,12 +210,12 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
|
|
|
210
210
|
headers?: Record<string, string> | null;
|
|
211
211
|
};
|
|
212
212
|
}) => Promise<{
|
|
213
|
+
subAgentId: string;
|
|
213
214
|
id: string;
|
|
214
215
|
createdAt: string;
|
|
215
216
|
updatedAt: string;
|
|
216
|
-
tenantId: string;
|
|
217
217
|
projectId: string;
|
|
218
|
-
|
|
218
|
+
tenantId: string;
|
|
219
219
|
agentId: string;
|
|
220
220
|
headers: Record<string, string> | null;
|
|
221
221
|
targetAgentId: string;
|
|
@@ -227,12 +227,12 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
|
|
|
227
227
|
scopes: SubAgentScopeConfig;
|
|
228
228
|
targetAgentId: string;
|
|
229
229
|
}) => Promise<{
|
|
230
|
+
subAgentId: string;
|
|
230
231
|
id: string;
|
|
231
232
|
createdAt: string;
|
|
232
233
|
updatedAt: string;
|
|
233
|
-
tenantId: string;
|
|
234
234
|
projectId: string;
|
|
235
|
-
|
|
235
|
+
tenantId: string;
|
|
236
236
|
agentId: string;
|
|
237
237
|
headers: Record<string, string> | null;
|
|
238
238
|
targetAgentId: string;
|
|
@@ -248,12 +248,12 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
|
|
|
248
248
|
headers?: Record<string, string> | null;
|
|
249
249
|
};
|
|
250
250
|
}) => Promise<{
|
|
251
|
+
subAgentId: string;
|
|
251
252
|
id: string;
|
|
252
253
|
createdAt: string;
|
|
253
254
|
updatedAt: string;
|
|
254
|
-
tenantId: string;
|
|
255
255
|
projectId: string;
|
|
256
|
-
|
|
256
|
+
tenantId: string;
|
|
257
257
|
agentId: string;
|
|
258
258
|
headers: Record<string, string> | null;
|
|
259
259
|
targetAgentId: string;
|
|
@@ -9,13 +9,13 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
9
9
|
scopes: AgentScopeConfig;
|
|
10
10
|
subAgentId: string;
|
|
11
11
|
}) => Promise<{
|
|
12
|
+
description: string | null;
|
|
12
13
|
id: string;
|
|
13
14
|
name: string;
|
|
14
15
|
createdAt: string;
|
|
15
16
|
updatedAt: string;
|
|
16
|
-
description: string | null;
|
|
17
|
-
tenantId: string;
|
|
18
17
|
projectId: string;
|
|
18
|
+
tenantId: string;
|
|
19
19
|
models: {
|
|
20
20
|
base?: {
|
|
21
21
|
model?: string | undefined;
|
|
@@ -33,20 +33,20 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
33
33
|
stopWhen: {
|
|
34
34
|
stepCountIs?: number | undefined;
|
|
35
35
|
} | null;
|
|
36
|
-
agentId: string;
|
|
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
|
+
description: string | null;
|
|
43
44
|
id: string;
|
|
44
45
|
name: string;
|
|
45
46
|
createdAt: string;
|
|
46
47
|
updatedAt: string;
|
|
47
|
-
description: string | null;
|
|
48
|
-
tenantId: string;
|
|
49
48
|
projectId: string;
|
|
49
|
+
tenantId: string;
|
|
50
50
|
models: {
|
|
51
51
|
base?: {
|
|
52
52
|
model?: string | undefined;
|
|
@@ -64,9 +64,9 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
64
64
|
stopWhen: {
|
|
65
65
|
stepCountIs?: number | undefined;
|
|
66
66
|
} | null;
|
|
67
|
-
agentId: string;
|
|
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,13 +109,13 @@ declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (param
|
|
|
109
109
|
};
|
|
110
110
|
}>;
|
|
111
111
|
declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAgentInsert) => Promise<{
|
|
112
|
+
description: string | null;
|
|
112
113
|
id: string;
|
|
113
114
|
name: string;
|
|
114
115
|
createdAt: string;
|
|
115
116
|
updatedAt: string;
|
|
116
|
-
description: string | null;
|
|
117
|
-
tenantId: string;
|
|
118
117
|
projectId: string;
|
|
118
|
+
tenantId: string;
|
|
119
119
|
models: {
|
|
120
120
|
base?: {
|
|
121
121
|
model?: string | undefined;
|
|
@@ -133,9 +133,9 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
|
|
|
133
133
|
stopWhen: {
|
|
134
134
|
stepCountIs?: number | undefined;
|
|
135
135
|
} | null;
|
|
136
|
-
agentId: string;
|
|
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,13 +19,13 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
19
19
|
scopes: ProjectScopeConfig;
|
|
20
20
|
toolId: string;
|
|
21
21
|
}) => Promise<{
|
|
22
|
+
description: string | null;
|
|
22
23
|
id: string;
|
|
23
24
|
name: string;
|
|
24
25
|
createdAt: string;
|
|
25
26
|
updatedAt: string;
|
|
26
|
-
description: string | null;
|
|
27
|
-
tenantId: string;
|
|
28
27
|
projectId: string;
|
|
28
|
+
tenantId: string;
|
|
29
29
|
headers: Record<string, string> | null;
|
|
30
30
|
config: {
|
|
31
31
|
type: "mcp";
|
|
@@ -77,13 +77,13 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
77
77
|
};
|
|
78
78
|
}>;
|
|
79
79
|
declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
|
|
80
|
+
description: string | null;
|
|
80
81
|
id: string;
|
|
81
82
|
name: string;
|
|
82
83
|
createdAt: string;
|
|
83
84
|
updatedAt: string;
|
|
84
|
-
description: string | null;
|
|
85
|
-
tenantId: string;
|
|
86
85
|
projectId: string;
|
|
86
|
+
tenantId: string;
|
|
87
87
|
headers: Record<string, string> | null;
|
|
88
88
|
config: {
|
|
89
89
|
type: "mcp";
|
|
@@ -134,15 +134,15 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
134
134
|
needsApproval?: boolean;
|
|
135
135
|
}> | null;
|
|
136
136
|
}) => Promise<{
|
|
137
|
+
subAgentId: string;
|
|
137
138
|
id: string;
|
|
138
139
|
createdAt: string;
|
|
139
140
|
updatedAt: string;
|
|
140
|
-
tenantId: string;
|
|
141
141
|
projectId: string;
|
|
142
|
-
|
|
142
|
+
tenantId: string;
|
|
143
143
|
agentId: string;
|
|
144
|
-
toolId: string;
|
|
145
144
|
headers: Record<string, string> | null;
|
|
145
|
+
toolId: string;
|
|
146
146
|
toolPolicies: Record<string, {
|
|
147
147
|
needsApproval?: boolean;
|
|
148
148
|
}> | null;
|
|
@@ -153,15 +153,15 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
|
|
|
153
153
|
subAgentId: string;
|
|
154
154
|
toolId: string;
|
|
155
155
|
}) => Promise<{
|
|
156
|
+
subAgentId: string;
|
|
156
157
|
id: string;
|
|
157
158
|
createdAt: string;
|
|
158
159
|
updatedAt: string;
|
|
159
|
-
tenantId: string;
|
|
160
160
|
projectId: string;
|
|
161
|
-
|
|
161
|
+
tenantId: string;
|
|
162
162
|
agentId: string;
|
|
163
|
-
toolId: string;
|
|
164
163
|
headers: Record<string, string> | null;
|
|
164
|
+
toolId: string;
|
|
165
165
|
toolPolicies: Record<string, {
|
|
166
166
|
needsApproval?: boolean;
|
|
167
167
|
}> | null;
|
|
@@ -181,15 +181,15 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
181
181
|
}> | null;
|
|
182
182
|
relationId?: string;
|
|
183
183
|
}) => Promise<{
|
|
184
|
+
subAgentId: string;
|
|
184
185
|
id: string;
|
|
185
186
|
createdAt: string;
|
|
186
187
|
updatedAt: string;
|
|
187
|
-
tenantId: string;
|
|
188
188
|
projectId: string;
|
|
189
|
-
|
|
189
|
+
tenantId: string;
|
|
190
190
|
agentId: string;
|
|
191
|
-
toolId: string;
|
|
192
191
|
headers: Record<string, string> | null;
|
|
192
|
+
toolId: string;
|
|
193
193
|
toolPolicies: Record<string, {
|
|
194
194
|
needsApproval?: boolean;
|
|
195
195
|
}> | null;
|
|
@@ -201,13 +201,13 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
201
201
|
declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
202
202
|
data: ToolInsert;
|
|
203
203
|
}) => Promise<{
|
|
204
|
+
description: string | null;
|
|
204
205
|
id: string;
|
|
205
206
|
name: string;
|
|
206
207
|
createdAt: string;
|
|
207
208
|
updatedAt: string;
|
|
208
|
-
description: string | null;
|
|
209
|
-
tenantId: string;
|
|
210
209
|
projectId: string;
|
|
210
|
+
tenantId: 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";
|
|
@@ -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())({
|
|
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,
|
|
@@ -12,28 +12,28 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
12
12
|
name: string | null;
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
|
-
expiresAt: string | null;
|
|
16
|
-
tenantId: string;
|
|
17
15
|
projectId: string;
|
|
16
|
+
tenantId: string;
|
|
18
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
25
|
id: string;
|
|
26
26
|
name: string | null;
|
|
27
27
|
createdAt: string;
|
|
28
28
|
updatedAt: string;
|
|
29
|
-
expiresAt: string | null;
|
|
30
|
-
tenantId: string;
|
|
31
29
|
projectId: string;
|
|
30
|
+
tenantId: string;
|
|
32
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;
|
|
@@ -43,14 +43,14 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
43
43
|
name: string | null;
|
|
44
44
|
createdAt: string;
|
|
45
45
|
updatedAt: string;
|
|
46
|
-
expiresAt: string | null;
|
|
47
|
-
tenantId: string;
|
|
48
46
|
projectId: string;
|
|
47
|
+
tenantId: string;
|
|
49
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;
|
|
@@ -70,14 +70,14 @@ declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInse
|
|
|
70
70
|
name: string | null;
|
|
71
71
|
createdAt: string;
|
|
72
72
|
updatedAt: string;
|
|
73
|
-
expiresAt: string | null;
|
|
74
|
-
tenantId: string;
|
|
75
73
|
projectId: string;
|
|
74
|
+
tenantId: string;
|
|
76
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,20 +16,20 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
16
16
|
total: number;
|
|
17
17
|
}>;
|
|
18
18
|
declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
19
|
+
title: string | null;
|
|
19
20
|
id: string;
|
|
20
21
|
createdAt: string;
|
|
21
22
|
updatedAt: string;
|
|
23
|
+
projectId: string;
|
|
24
|
+
tenantId: string;
|
|
25
|
+
metadata: ConversationMetadata | null;
|
|
26
|
+
agentId: string | null;
|
|
27
|
+
userId: string | null;
|
|
22
28
|
ref: {
|
|
23
29
|
type: "commit" | "tag" | "branch";
|
|
24
30
|
name: string;
|
|
25
31
|
hash: string;
|
|
26
32
|
} | null;
|
|
27
|
-
userId: string | null;
|
|
28
|
-
metadata: ConversationMetadata | null;
|
|
29
|
-
title: string | null;
|
|
30
|
-
tenantId: string;
|
|
31
|
-
projectId: string;
|
|
32
|
-
agentId: string | null;
|
|
33
33
|
activeSubAgentId: string;
|
|
34
34
|
lastContextResolution: string | null;
|
|
35
35
|
}>;
|
|
@@ -85,20 +85,20 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
85
85
|
scopes: ProjectScopeConfig;
|
|
86
86
|
conversationId: string;
|
|
87
87
|
}) => Promise<{
|
|
88
|
+
title: string | null;
|
|
88
89
|
id: string;
|
|
89
90
|
createdAt: string;
|
|
90
91
|
updatedAt: string;
|
|
92
|
+
projectId: string;
|
|
93
|
+
tenantId: string;
|
|
94
|
+
metadata: ConversationMetadata | null;
|
|
95
|
+
agentId: string | null;
|
|
96
|
+
userId: string | null;
|
|
91
97
|
ref: {
|
|
92
98
|
type: "commit" | "tag" | "branch";
|
|
93
99
|
name: string;
|
|
94
100
|
hash: string;
|
|
95
101
|
} | null;
|
|
96
|
-
userId: string | null;
|
|
97
|
-
metadata: ConversationMetadata | null;
|
|
98
|
-
title: string | null;
|
|
99
|
-
tenantId: string;
|
|
100
|
-
projectId: string;
|
|
101
|
-
agentId: string | null;
|
|
102
102
|
activeSubAgentId: string;
|
|
103
103
|
lastContextResolution: string | null;
|
|
104
104
|
} | undefined>;
|
|
@@ -121,20 +121,20 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
121
121
|
metadata?: ConversationMetadata | null | undefined;
|
|
122
122
|
contextConfigId?: string | undefined;
|
|
123
123
|
} | {
|
|
124
|
+
title: string | null;
|
|
124
125
|
id: string;
|
|
125
126
|
createdAt: string;
|
|
126
127
|
updatedAt: string;
|
|
128
|
+
projectId: string;
|
|
129
|
+
tenantId: string;
|
|
130
|
+
metadata: ConversationMetadata | null;
|
|
131
|
+
agentId: string | null;
|
|
132
|
+
userId: string | null;
|
|
127
133
|
ref: {
|
|
128
134
|
type: "commit" | "tag" | "branch";
|
|
129
135
|
name: string;
|
|
130
136
|
hash: string;
|
|
131
137
|
} | null;
|
|
132
|
-
userId: string | null;
|
|
133
|
-
metadata: ConversationMetadata | null;
|
|
134
|
-
title: string | null;
|
|
135
|
-
tenantId: string;
|
|
136
|
-
projectId: string;
|
|
137
|
-
agentId: string | null;
|
|
138
138
|
activeSubAgentId: string;
|
|
139
139
|
lastContextResolution: string | null;
|
|
140
140
|
}>;
|
|
@@ -153,20 +153,20 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
153
153
|
scopes: ProjectScopeConfig;
|
|
154
154
|
conversationId: string;
|
|
155
155
|
}) => Promise<{
|
|
156
|
+
title: string | null;
|
|
156
157
|
id: string;
|
|
157
158
|
createdAt: string;
|
|
158
159
|
updatedAt: string;
|
|
160
|
+
projectId: string;
|
|
161
|
+
tenantId: string;
|
|
162
|
+
metadata: ConversationMetadata | null;
|
|
163
|
+
agentId: string | null;
|
|
164
|
+
userId: string | null;
|
|
159
165
|
ref: {
|
|
160
166
|
type: "commit" | "tag" | "branch";
|
|
161
167
|
name: string;
|
|
162
168
|
hash: string;
|
|
163
169
|
} | null;
|
|
164
|
-
userId: string | null;
|
|
165
|
-
metadata: ConversationMetadata | null;
|
|
166
|
-
title: string | null;
|
|
167
|
-
tenantId: string;
|
|
168
|
-
projectId: string;
|
|
169
|
-
agentId: string | null;
|
|
170
170
|
activeSubAgentId: string;
|
|
171
171
|
lastContextResolution: string | null;
|
|
172
172
|
} | undefined>;
|
|
@@ -10,21 +10,21 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
10
10
|
scopes: ProjectScopeConfig;
|
|
11
11
|
messageId: string;
|
|
12
12
|
}) => Promise<{
|
|
13
|
-
id: string;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
updatedAt: string;
|
|
16
|
-
metadata: MessageMetadata | null;
|
|
17
|
-
role: string;
|
|
18
|
-
content: MessageContent;
|
|
19
|
-
tenantId: string;
|
|
20
|
-
projectId: string;
|
|
21
13
|
fromSubAgentId: string | null;
|
|
22
14
|
toSubAgentId: string | null;
|
|
23
15
|
fromExternalAgentId: string | null;
|
|
24
16
|
toExternalAgentId: string | null;
|
|
25
17
|
taskId: string | null;
|
|
26
18
|
a2aTaskId: string | null;
|
|
19
|
+
id: string;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
updatedAt: string;
|
|
22
|
+
projectId: string;
|
|
23
|
+
tenantId: string;
|
|
24
|
+
metadata: MessageMetadata | null;
|
|
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,21 +141,21 @@ declare const getVisibleMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
141
141
|
id: string;
|
|
142
142
|
}[]>;
|
|
143
143
|
declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageInsert) => Promise<{
|
|
144
|
-
id: string;
|
|
145
|
-
createdAt: string;
|
|
146
|
-
updatedAt: string;
|
|
147
|
-
metadata: MessageMetadata | null;
|
|
148
|
-
role: string;
|
|
149
|
-
content: MessageContent;
|
|
150
|
-
tenantId: string;
|
|
151
|
-
projectId: string;
|
|
152
144
|
fromSubAgentId: string | null;
|
|
153
145
|
toSubAgentId: string | null;
|
|
154
146
|
fromExternalAgentId: string | null;
|
|
155
147
|
toExternalAgentId: string | null;
|
|
156
148
|
taskId: string | null;
|
|
157
149
|
a2aTaskId: string | null;
|
|
150
|
+
id: string;
|
|
151
|
+
createdAt: string;
|
|
152
|
+
updatedAt: string;
|
|
153
|
+
projectId: string;
|
|
154
|
+
tenantId: string;
|
|
155
|
+
metadata: MessageMetadata | null;
|
|
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,21 +194,21 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
194
194
|
scopes: ProjectScopeConfig;
|
|
195
195
|
messageId: string;
|
|
196
196
|
}) => Promise<{
|
|
197
|
-
id: string;
|
|
198
|
-
createdAt: string;
|
|
199
|
-
updatedAt: string;
|
|
200
|
-
metadata: MessageMetadata | null;
|
|
201
|
-
role: string;
|
|
202
|
-
content: MessageContent;
|
|
203
|
-
tenantId: string;
|
|
204
|
-
projectId: string;
|
|
205
197
|
fromSubAgentId: string | null;
|
|
206
198
|
toSubAgentId: string | null;
|
|
207
199
|
fromExternalAgentId: string | null;
|
|
208
200
|
toExternalAgentId: string | null;
|
|
209
201
|
taskId: string | null;
|
|
210
202
|
a2aTaskId: string | null;
|
|
203
|
+
id: string;
|
|
204
|
+
createdAt: string;
|
|
205
|
+
updatedAt: string;
|
|
206
|
+
projectId: string;
|
|
207
|
+
tenantId: string;
|
|
208
|
+
metadata: MessageMetadata | null;
|
|
209
|
+
content: MessageContent;
|
|
211
210
|
conversationId: string;
|
|
211
|
+
role: string;
|
|
212
212
|
fromTeamAgentId: string | null;
|
|
213
213
|
toTeamAgentId: string | null;
|
|
214
214
|
visibility: string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ToolScopeConfig } from "../../db/manage/scope-definitions.js";
|
|
2
|
+
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
3
|
+
import { McpTool, ToolSelect } from "../../types/entities.js";
|
|
4
|
+
|
|
5
|
+
//#region src/data-access/runtime/slack-work-app-mcp.d.ts
|
|
6
|
+
type SlackMcpToolAccessConfig = {
|
|
7
|
+
channelAccessMode: 'all' | 'selected';
|
|
8
|
+
dmEnabled: boolean;
|
|
9
|
+
channelIds: string[];
|
|
10
|
+
};
|
|
11
|
+
declare const getSlackMcpToolAccessConfig: (db: AgentsRunDatabaseClient) => (scope: ToolScopeConfig) => Promise<SlackMcpToolAccessConfig>;
|
|
12
|
+
declare const setSlackMcpToolAccessConfig: (db: AgentsRunDatabaseClient) => (params: {
|
|
13
|
+
toolId: string;
|
|
14
|
+
tenantId: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
channelAccessMode: "all" | "selected";
|
|
17
|
+
dmEnabled: boolean;
|
|
18
|
+
channelIds: string[];
|
|
19
|
+
}) => Promise<void>;
|
|
20
|
+
declare const updateSlackMcpToolAccessChannelIds: (db: AgentsRunDatabaseClient) => (scope: ToolScopeConfig, channelIds: string[]) => Promise<void>;
|
|
21
|
+
declare const deleteSlackMcpToolAccessConfig: (db: AgentsRunDatabaseClient) => (scope: ToolScopeConfig) => Promise<boolean>;
|
|
22
|
+
declare const deleteAllSlackMcpToolAccessConfigsByTenant: (db: AgentsRunDatabaseClient) => (tenantId: string) => Promise<number>;
|
|
23
|
+
declare const isSlackWorkAppTool: (tool: ToolSelect | McpTool) => boolean | undefined;
|
|
24
|
+
declare const resolveSlackUserContext: (db: AgentsRunDatabaseClient) => (inkeepUserId: string) => Promise<string | undefined>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { SlackMcpToolAccessConfig, deleteAllSlackMcpToolAccessConfigsByTenant, deleteSlackMcpToolAccessConfig, getSlackMcpToolAccessConfig, isSlackWorkAppTool, resolveSlackUserContext, setSlackMcpToolAccessConfig, updateSlackMcpToolAccessChannelIds };
|