@inkeep/agents-core 0.58.3 → 0.58.5
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 +9 -9
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/constants/models.d.ts +34 -2
- package/dist/constants/models.js +37 -5
- package/dist/data-access/manage/agents.d.ts +31 -31
- package/dist/data-access/manage/artifactComponents.d.ts +16 -16
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/dataComponents.d.ts +6 -6
- package/dist/data-access/manage/functionTools.d.ts +18 -18
- package/dist/data-access/manage/skills.d.ts +14 -14
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentRelations.d.ts +28 -28
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgents.d.ts +21 -21
- package/dist/data-access/manage/tools.d.ts +24 -24
- package/dist/data-access/manage/tools.js +2 -0
- package/dist/data-access/manage/triggers.d.ts +2 -2
- package/dist/data-access/runtime/apiKeys.d.ts +16 -16
- package/dist/data-access/runtime/cascade-delete.js +2 -2
- package/dist/data-access/runtime/conversations.d.ts +20 -20
- package/dist/data-access/runtime/github-work-app-installations.d.ts +25 -5
- package/dist/data-access/runtime/github-work-app-installations.js +20 -17
- package/dist/data-access/runtime/messages.d.ts +24 -24
- package/dist/data-access/runtime/tasks.d.ts +6 -6
- package/dist/db/manage/manage-schema.d.ts +453 -453
- package/dist/db/runtime/runtime-schema.d.ts +310 -310
- package/dist/db/runtime/runtime-schema.js +5 -1
- package/dist/middleware/no-auth.d.ts +2 -2
- package/dist/setup/setup.js +14 -3
- package/dist/utils/error.d.ts +51 -51
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/schemas.d.ts +1916 -1916
- package/drizzle/runtime/0021_careful_xorn.sql +2 -0
- package/drizzle/runtime/meta/0021_snapshot.json +4124 -0
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +1 -1
|
@@ -10,30 +10,30 @@ 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
|
-
projectId: string;
|
|
16
13
|
tenantId: string;
|
|
14
|
+
projectId: string;
|
|
17
15
|
agentId: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
expiresAt: string | null;
|
|
18
19
|
publicId: string;
|
|
19
20
|
keyHash: string;
|
|
20
21
|
keyPrefix: string;
|
|
21
22
|
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
|
-
createdAt: string;
|
|
28
|
-
updatedAt: string;
|
|
29
|
-
projectId: string;
|
|
30
27
|
tenantId: string;
|
|
28
|
+
projectId: string;
|
|
31
29
|
agentId: string;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
expiresAt: string | null;
|
|
32
33
|
publicId: string;
|
|
33
34
|
keyHash: string;
|
|
34
35
|
keyPrefix: string;
|
|
35
36
|
lastUsedAt: string | null;
|
|
36
|
-
expiresAt: string | null;
|
|
37
37
|
} | undefined>;
|
|
38
38
|
declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
|
|
39
39
|
scopes: ProjectScopeConfig;
|
|
@@ -41,16 +41,16 @@ 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
|
-
projectId: string;
|
|
47
44
|
tenantId: string;
|
|
45
|
+
projectId: string;
|
|
48
46
|
agentId: string;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
updatedAt: string;
|
|
49
|
+
expiresAt: string | null;
|
|
49
50
|
publicId: string;
|
|
50
51
|
keyHash: string;
|
|
51
52
|
keyPrefix: string;
|
|
52
53
|
lastUsedAt: string | null;
|
|
53
|
-
expiresAt: string | null;
|
|
54
54
|
}[]>;
|
|
55
55
|
declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
56
56
|
scopes: ProjectScopeConfig;
|
|
@@ -68,16 +68,16 @@ 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
|
-
projectId: string;
|
|
74
71
|
tenantId: string;
|
|
72
|
+
projectId: string;
|
|
75
73
|
agentId: string;
|
|
74
|
+
createdAt: string;
|
|
75
|
+
updatedAt: string;
|
|
76
|
+
expiresAt: string | null;
|
|
76
77
|
publicId: string;
|
|
77
78
|
keyHash: string;
|
|
78
79
|
keyPrefix: string;
|
|
79
80
|
lastUsedAt: string | null;
|
|
80
|
-
expiresAt: string | null;
|
|
81
81
|
}>;
|
|
82
82
|
declare const updateApiKey: (db: AgentsRunDatabaseClient) => (params: {
|
|
83
83
|
scopes: ProjectScopeConfig;
|
|
@@ -139,8 +139,8 @@ const cascadeDeleteByContextConfig = (db) => async (params) => {
|
|
|
139
139
|
*/
|
|
140
140
|
const cascadeDeleteByTool = (db) => async (params) => {
|
|
141
141
|
const { toolId, tenantId, projectId } = params;
|
|
142
|
-
const repositoryAccessResult = await db.delete(workAppGitHubMcpToolRepositoryAccess).where(eq(workAppGitHubMcpToolRepositoryAccess.toolId, toolId)).returning();
|
|
143
|
-
const accessModeResult = await db.delete(workAppGitHubMcpToolAccessMode).where(eq(workAppGitHubMcpToolAccessMode.toolId, toolId)).returning();
|
|
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
144
|
const slackMcpDeleted = await deleteSlackMcpToolAccessConfig(db)({
|
|
145
145
|
tenantId,
|
|
146
146
|
projectId,
|
|
@@ -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;
|
|
20
19
|
id: string;
|
|
20
|
+
tenantId: string;
|
|
21
|
+
projectId: string;
|
|
22
|
+
agentId: string | null;
|
|
23
|
+
title: string | null;
|
|
21
24
|
createdAt: string;
|
|
22
25
|
updatedAt: string;
|
|
23
|
-
projectId: string;
|
|
24
|
-
tenantId: string;
|
|
25
26
|
metadata: ConversationMetadata | null;
|
|
26
|
-
agentId: string | null;
|
|
27
|
-
userId: string | null;
|
|
28
27
|
ref: {
|
|
29
28
|
type: "commit" | "tag" | "branch";
|
|
30
29
|
name: string;
|
|
31
30
|
hash: string;
|
|
32
31
|
} | null;
|
|
32
|
+
userId: 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;
|
|
89
88
|
id: string;
|
|
89
|
+
tenantId: string;
|
|
90
|
+
projectId: string;
|
|
91
|
+
agentId: string | null;
|
|
92
|
+
title: string | null;
|
|
90
93
|
createdAt: string;
|
|
91
94
|
updatedAt: string;
|
|
92
|
-
projectId: string;
|
|
93
|
-
tenantId: string;
|
|
94
95
|
metadata: ConversationMetadata | null;
|
|
95
|
-
agentId: string | null;
|
|
96
|
-
userId: string | null;
|
|
97
96
|
ref: {
|
|
98
97
|
type: "commit" | "tag" | "branch";
|
|
99
98
|
name: string;
|
|
100
99
|
hash: string;
|
|
101
100
|
} | null;
|
|
101
|
+
userId: 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;
|
|
125
124
|
id: string;
|
|
125
|
+
tenantId: string;
|
|
126
|
+
projectId: string;
|
|
127
|
+
agentId: string | null;
|
|
128
|
+
title: string | null;
|
|
126
129
|
createdAt: string;
|
|
127
130
|
updatedAt: string;
|
|
128
|
-
projectId: string;
|
|
129
|
-
tenantId: string;
|
|
130
131
|
metadata: ConversationMetadata | null;
|
|
131
|
-
agentId: string | null;
|
|
132
|
-
userId: string | null;
|
|
133
132
|
ref: {
|
|
134
133
|
type: "commit" | "tag" | "branch";
|
|
135
134
|
name: string;
|
|
136
135
|
hash: string;
|
|
137
136
|
} | null;
|
|
137
|
+
userId: 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;
|
|
157
156
|
id: string;
|
|
157
|
+
tenantId: string;
|
|
158
|
+
projectId: string;
|
|
159
|
+
agentId: string | null;
|
|
160
|
+
title: string | null;
|
|
158
161
|
createdAt: string;
|
|
159
162
|
updatedAt: string;
|
|
160
|
-
projectId: string;
|
|
161
|
-
tenantId: string;
|
|
162
163
|
metadata: ConversationMetadata | null;
|
|
163
|
-
agentId: string | null;
|
|
164
|
-
userId: string | null;
|
|
165
164
|
ref: {
|
|
166
165
|
type: "commit" | "tag" | "branch";
|
|
167
166
|
name: string;
|
|
168
167
|
hash: string;
|
|
169
168
|
} | null;
|
|
169
|
+
userId: string | null;
|
|
170
170
|
activeSubAgentId: string;
|
|
171
171
|
lastContextResolution: string | null;
|
|
172
172
|
} | undefined>;
|
|
@@ -187,7 +187,11 @@ declare const setMcpToolRepositoryAccess: (db: AgentsRunDatabaseClient) => (para
|
|
|
187
187
|
* Get MCP tool repository access entries
|
|
188
188
|
* These entries are used when mode='selected'. Check mode via getMcpToolAccessMode().
|
|
189
189
|
*/
|
|
190
|
-
declare const getMcpToolRepositoryAccess: (db: AgentsRunDatabaseClient) => (
|
|
190
|
+
declare const getMcpToolRepositoryAccess: (db: AgentsRunDatabaseClient) => (scope: {
|
|
191
|
+
tenantId: string;
|
|
192
|
+
projectId: string;
|
|
193
|
+
toolId: string;
|
|
194
|
+
}) => Promise<{
|
|
191
195
|
id: string;
|
|
192
196
|
toolId: string;
|
|
193
197
|
tenantId: string;
|
|
@@ -201,7 +205,11 @@ declare const getMcpToolRepositoryAccess: (db: AgentsRunDatabaseClient) => (tool
|
|
|
201
205
|
* If the tool's access mode is 'all', returns all repositories the project has access to.
|
|
202
206
|
* If mode is 'selected' (or not set), returns only explicitly granted repositories.
|
|
203
207
|
*/
|
|
204
|
-
declare const getMcpToolRepositoryAccessWithDetails: (db: AgentsRunDatabaseClient) => (
|
|
208
|
+
declare const getMcpToolRepositoryAccessWithDetails: (db: AgentsRunDatabaseClient) => (scope: {
|
|
209
|
+
tenantId: string;
|
|
210
|
+
projectId: string;
|
|
211
|
+
toolId: string;
|
|
212
|
+
}) => Promise<(WorkAppGitHubRepositorySelect & {
|
|
205
213
|
accessId: string;
|
|
206
214
|
installationAccountLogin: string;
|
|
207
215
|
installationId: string;
|
|
@@ -209,7 +217,11 @@ declare const getMcpToolRepositoryAccessWithDetails: (db: AgentsRunDatabaseClien
|
|
|
209
217
|
/**
|
|
210
218
|
* Remove all MCP tool repository access for a specific tool
|
|
211
219
|
*/
|
|
212
|
-
declare const clearMcpToolRepositoryAccess: (db: AgentsRunDatabaseClient) => (
|
|
220
|
+
declare const clearMcpToolRepositoryAccess: (db: AgentsRunDatabaseClient) => (scope: {
|
|
221
|
+
tenantId: string;
|
|
222
|
+
projectId: string;
|
|
223
|
+
toolId: string;
|
|
224
|
+
}) => Promise<number>;
|
|
213
225
|
declare const isGithubWorkAppTool: (tool: ToolSelect | McpTool) => boolean | undefined;
|
|
214
226
|
type WorkAppGitHubAccessMode = 'all' | 'selected';
|
|
215
227
|
/**
|
|
@@ -252,10 +264,18 @@ declare const setMcpToolAccessMode: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
252
264
|
* Get the access mode for an MCP tool's GitHub repository access.
|
|
253
265
|
* Returns 'selected' if no mode is explicitly set (fail-safe default).
|
|
254
266
|
*/
|
|
255
|
-
declare const getMcpToolAccessMode: (db: AgentsRunDatabaseClient) => (
|
|
267
|
+
declare const getMcpToolAccessMode: (db: AgentsRunDatabaseClient) => (scope: {
|
|
268
|
+
tenantId: string;
|
|
269
|
+
projectId: string;
|
|
270
|
+
toolId: string;
|
|
271
|
+
}) => Promise<WorkAppGitHubAccessMode>;
|
|
256
272
|
/**
|
|
257
273
|
* Delete the access mode entry for an MCP tool
|
|
258
274
|
*/
|
|
259
|
-
declare const deleteMcpToolAccessMode: (db: AgentsRunDatabaseClient) => (
|
|
275
|
+
declare const deleteMcpToolAccessMode: (db: AgentsRunDatabaseClient) => (scope: {
|
|
276
|
+
tenantId: string;
|
|
277
|
+
projectId: string;
|
|
278
|
+
toolId: string;
|
|
279
|
+
}) => Promise<boolean>;
|
|
260
280
|
//#endregion
|
|
261
281
|
export { WorkAppGitHubAccessMode, addRepositories, checkProjectRepositoryAccess, clearMcpToolRepositoryAccess, clearProjectRepositoryAccess, createInstallation, deleteInstallation, deleteMcpToolAccessMode, deleteProjectAccessMode, disconnectInstallation, getInstallationByGitHubId, getInstallationById, getInstallationsByTenantId, getMcpToolAccessMode, getMcpToolRepositoryAccess, getMcpToolRepositoryAccessWithDetails, getProjectAccessMode, getProjectRepositoryAccess, getProjectRepositoryAccessWithDetails, getRepositoriesByInstallationId, getRepositoriesByTenantId, getRepositoryByFullName, getRepositoryById, getRepositoryCount, getRepositoryCountsByTenantId, isGithubWorkAppTool, removeRepositories, setMcpToolAccessMode, setMcpToolRepositoryAccess, setProjectAccessMode, setProjectRepositoryAccess, syncRepositories, updateInstallationStatus, updateInstallationStatusByGitHubId, validateRepositoryOwnership };
|
|
@@ -327,7 +327,7 @@ const getRepositoryCountsByTenantId = (db) => async (params) => {
|
|
|
327
327
|
*/
|
|
328
328
|
const setMcpToolRepositoryAccess = (db) => async (params) => {
|
|
329
329
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
330
|
-
await db.delete(workAppGitHubMcpToolRepositoryAccess).where(eq(workAppGitHubMcpToolRepositoryAccess.toolId, params.toolId));
|
|
330
|
+
await db.delete(workAppGitHubMcpToolRepositoryAccess).where(and(eq(workAppGitHubMcpToolRepositoryAccess.tenantId, params.tenantId), eq(workAppGitHubMcpToolRepositoryAccess.projectId, params.projectId), eq(workAppGitHubMcpToolRepositoryAccess.toolId, params.toolId)));
|
|
331
331
|
if (params.repositoryIds.length > 0) await db.insert(workAppGitHubMcpToolRepositoryAccess).values(params.repositoryIds.map((repoId) => ({
|
|
332
332
|
id: generateId(),
|
|
333
333
|
toolId: params.toolId,
|
|
@@ -342,23 +342,22 @@ const setMcpToolRepositoryAccess = (db) => async (params) => {
|
|
|
342
342
|
* Get MCP tool repository access entries
|
|
343
343
|
* These entries are used when mode='selected'. Check mode via getMcpToolAccessMode().
|
|
344
344
|
*/
|
|
345
|
-
const getMcpToolRepositoryAccess = (db) => async (
|
|
346
|
-
return await db.select().from(workAppGitHubMcpToolRepositoryAccess).where(eq(workAppGitHubMcpToolRepositoryAccess.toolId, toolId));
|
|
345
|
+
const getMcpToolRepositoryAccess = (db) => async (scope) => {
|
|
346
|
+
return await db.select().from(workAppGitHubMcpToolRepositoryAccess).where(and(eq(workAppGitHubMcpToolRepositoryAccess.tenantId, scope.tenantId), eq(workAppGitHubMcpToolRepositoryAccess.projectId, scope.projectId), eq(workAppGitHubMcpToolRepositoryAccess.toolId, scope.toolId)));
|
|
347
347
|
};
|
|
348
348
|
/**
|
|
349
349
|
* Get MCP tool repository access with full repository details.
|
|
350
350
|
* If the tool's access mode is 'all', returns all repositories the project has access to.
|
|
351
351
|
* If mode is 'selected' (or not set), returns only explicitly granted repositories.
|
|
352
352
|
*/
|
|
353
|
-
const getMcpToolRepositoryAccessWithDetails = (db) => async (
|
|
354
|
-
|
|
353
|
+
const getMcpToolRepositoryAccessWithDetails = (db) => async (scope) => {
|
|
354
|
+
if ((await db.select({
|
|
355
355
|
mode: workAppGitHubMcpToolAccessMode.mode,
|
|
356
356
|
projectId: workAppGitHubMcpToolAccessMode.projectId,
|
|
357
357
|
tenantId: workAppGitHubMcpToolAccessMode.tenantId
|
|
358
|
-
}).from(workAppGitHubMcpToolAccessMode).where(eq(workAppGitHubMcpToolAccessMode.toolId, toolId)).limit(1))[0]
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
projectId: accessMode.projectId
|
|
358
|
+
}).from(workAppGitHubMcpToolAccessMode).where(and(eq(workAppGitHubMcpToolAccessMode.tenantId, scope.tenantId), eq(workAppGitHubMcpToolAccessMode.projectId, scope.projectId), eq(workAppGitHubMcpToolAccessMode.toolId, scope.toolId))).limit(1))[0]?.mode === "all") return getProjectRepositoryAccessWithDetails(db)({
|
|
359
|
+
tenantId: scope.tenantId,
|
|
360
|
+
projectId: scope.projectId
|
|
362
361
|
});
|
|
363
362
|
return await db.select({
|
|
364
363
|
accessId: workAppGitHubMcpToolRepositoryAccess.id,
|
|
@@ -372,13 +371,13 @@ const getMcpToolRepositoryAccessWithDetails = (db) => async (toolId) => {
|
|
|
372
371
|
createdAt: workAppGitHubRepositories.createdAt,
|
|
373
372
|
updatedAt: workAppGitHubRepositories.updatedAt,
|
|
374
373
|
installationAccountLogin: workAppGitHubInstallations.accountLogin
|
|
375
|
-
}).from(workAppGitHubMcpToolRepositoryAccess).innerJoin(workAppGitHubRepositories, eq(workAppGitHubMcpToolRepositoryAccess.repositoryDbId, workAppGitHubRepositories.id)).innerJoin(workAppGitHubInstallations, eq(workAppGitHubRepositories.installationDbId, workAppGitHubInstallations.id)).where(eq(workAppGitHubMcpToolRepositoryAccess.toolId, toolId));
|
|
374
|
+
}).from(workAppGitHubMcpToolRepositoryAccess).innerJoin(workAppGitHubRepositories, eq(workAppGitHubMcpToolRepositoryAccess.repositoryDbId, workAppGitHubRepositories.id)).innerJoin(workAppGitHubInstallations, eq(workAppGitHubRepositories.installationDbId, workAppGitHubInstallations.id)).where(and(eq(workAppGitHubMcpToolRepositoryAccess.tenantId, scope.tenantId), eq(workAppGitHubMcpToolRepositoryAccess.projectId, scope.projectId), eq(workAppGitHubMcpToolRepositoryAccess.toolId, scope.toolId)));
|
|
376
375
|
};
|
|
377
376
|
/**
|
|
378
377
|
* Remove all MCP tool repository access for a specific tool
|
|
379
378
|
*/
|
|
380
|
-
const clearMcpToolRepositoryAccess = (db) => async (
|
|
381
|
-
return (await db.delete(workAppGitHubMcpToolRepositoryAccess).where(eq(workAppGitHubMcpToolRepositoryAccess.toolId, toolId)).returning()).length;
|
|
379
|
+
const clearMcpToolRepositoryAccess = (db) => async (scope) => {
|
|
380
|
+
return (await db.delete(workAppGitHubMcpToolRepositoryAccess).where(and(eq(workAppGitHubMcpToolRepositoryAccess.tenantId, scope.tenantId), eq(workAppGitHubMcpToolRepositoryAccess.projectId, scope.projectId), eq(workAppGitHubMcpToolRepositoryAccess.toolId, scope.toolId))).returning()).length;
|
|
382
381
|
};
|
|
383
382
|
const isGithubWorkAppTool = (tool) => {
|
|
384
383
|
return tool.isWorkApp && tool.config.mcp.server.url.includes("/github/mcp");
|
|
@@ -432,7 +431,11 @@ const setMcpToolAccessMode = (db) => async (params) => {
|
|
|
432
431
|
createdAt: now,
|
|
433
432
|
updatedAt: now
|
|
434
433
|
}).onConflictDoUpdate({
|
|
435
|
-
target: [
|
|
434
|
+
target: [
|
|
435
|
+
workAppGitHubMcpToolAccessMode.tenantId,
|
|
436
|
+
workAppGitHubMcpToolAccessMode.projectId,
|
|
437
|
+
workAppGitHubMcpToolAccessMode.toolId
|
|
438
|
+
],
|
|
436
439
|
set: {
|
|
437
440
|
mode: params.mode,
|
|
438
441
|
updatedAt: now
|
|
@@ -443,14 +446,14 @@ const setMcpToolAccessMode = (db) => async (params) => {
|
|
|
443
446
|
* Get the access mode for an MCP tool's GitHub repository access.
|
|
444
447
|
* Returns 'selected' if no mode is explicitly set (fail-safe default).
|
|
445
448
|
*/
|
|
446
|
-
const getMcpToolAccessMode = (db) => async (
|
|
447
|
-
return (await db.select({ mode: workAppGitHubMcpToolAccessMode.mode }).from(workAppGitHubMcpToolAccessMode).where(eq(workAppGitHubMcpToolAccessMode.toolId, toolId)).limit(1))[0]?.mode ?? "selected";
|
|
449
|
+
const getMcpToolAccessMode = (db) => async (scope) => {
|
|
450
|
+
return (await db.select({ mode: workAppGitHubMcpToolAccessMode.mode }).from(workAppGitHubMcpToolAccessMode).where(and(eq(workAppGitHubMcpToolAccessMode.tenantId, scope.tenantId), eq(workAppGitHubMcpToolAccessMode.projectId, scope.projectId), eq(workAppGitHubMcpToolAccessMode.toolId, scope.toolId))).limit(1))[0]?.mode ?? "selected";
|
|
448
451
|
};
|
|
449
452
|
/**
|
|
450
453
|
* Delete the access mode entry for an MCP tool
|
|
451
454
|
*/
|
|
452
|
-
const deleteMcpToolAccessMode = (db) => async (
|
|
453
|
-
return (await db.delete(workAppGitHubMcpToolAccessMode).where(eq(workAppGitHubMcpToolAccessMode.toolId, toolId)).returning()).length > 0;
|
|
455
|
+
const deleteMcpToolAccessMode = (db) => async (scope) => {
|
|
456
|
+
return (await db.delete(workAppGitHubMcpToolAccessMode).where(and(eq(workAppGitHubMcpToolAccessMode.tenantId, scope.tenantId), eq(workAppGitHubMcpToolAccessMode.projectId, scope.projectId), eq(workAppGitHubMcpToolAccessMode.toolId, scope.toolId))).returning()).length > 0;
|
|
454
457
|
};
|
|
455
458
|
|
|
456
459
|
//#endregion
|
|
@@ -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
|
+
tenantId: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
metadata: MessageMetadata | null;
|
|
19
|
+
content: MessageContent;
|
|
20
|
+
role: string;
|
|
13
21
|
fromSubAgentId: string | null;
|
|
14
22
|
toSubAgentId: string | null;
|
|
15
23
|
fromExternalAgentId: string | null;
|
|
16
24
|
toExternalAgentId: string | null;
|
|
17
25
|
taskId: string | null;
|
|
18
26
|
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;
|
|
26
27
|
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
|
+
tenantId: string;
|
|
146
|
+
projectId: string;
|
|
147
|
+
createdAt: string;
|
|
148
|
+
updatedAt: string;
|
|
149
|
+
metadata: MessageMetadata | null;
|
|
150
|
+
content: MessageContent;
|
|
151
|
+
role: string;
|
|
144
152
|
fromSubAgentId: string | null;
|
|
145
153
|
toSubAgentId: string | null;
|
|
146
154
|
fromExternalAgentId: string | null;
|
|
147
155
|
toExternalAgentId: string | null;
|
|
148
156
|
taskId: string | null;
|
|
149
157
|
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;
|
|
157
158
|
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
|
+
tenantId: string;
|
|
199
|
+
projectId: string;
|
|
200
|
+
createdAt: string;
|
|
201
|
+
updatedAt: string;
|
|
202
|
+
metadata: MessageMetadata | null;
|
|
203
|
+
content: MessageContent;
|
|
204
|
+
role: string;
|
|
197
205
|
fromSubAgentId: string | null;
|
|
198
206
|
toSubAgentId: string | null;
|
|
199
207
|
fromExternalAgentId: string | null;
|
|
200
208
|
toExternalAgentId: string | null;
|
|
201
209
|
taskId: string | null;
|
|
202
210
|
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;
|
|
210
211
|
conversationId: string;
|
|
211
|
-
role: string;
|
|
212
212
|
fromTeamAgentId: string | null;
|
|
213
213
|
toTeamAgentId: string | null;
|
|
214
214
|
visibility: string;
|
|
@@ -6,21 +6,21 @@ import { TaskInsert, TaskSelect } from "../../types/entities.js";
|
|
|
6
6
|
|
|
7
7
|
//#region src/data-access/runtime/tasks.d.ts
|
|
8
8
|
declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
|
|
9
|
-
subAgentId: string;
|
|
10
9
|
id: string;
|
|
10
|
+
tenantId: string;
|
|
11
|
+
projectId: string;
|
|
12
|
+
agentId: string;
|
|
11
13
|
createdAt: string;
|
|
12
14
|
updatedAt: string;
|
|
13
|
-
projectId: string;
|
|
14
|
-
tenantId: string;
|
|
15
15
|
metadata: TaskMetadataConfig | null;
|
|
16
|
-
agentId: string;
|
|
17
|
-
status: string;
|
|
18
|
-
contextId: string;
|
|
19
16
|
ref: {
|
|
20
17
|
type: "commit" | "tag" | "branch";
|
|
21
18
|
name: string;
|
|
22
19
|
hash: string;
|
|
23
20
|
} | null;
|
|
21
|
+
status: string;
|
|
22
|
+
subAgentId: string;
|
|
23
|
+
contextId: string;
|
|
24
24
|
}>;
|
|
25
25
|
declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
|
|
26
26
|
id: string;
|