@inkeep/agents-core 0.58.18 → 0.58.20
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/client-exports.d.ts +3 -3
- package/dist/constants/models.d.ts +2 -0
- package/dist/constants/models.js +2 -0
- package/dist/data-access/index.d.ts +2 -2
- package/dist/data-access/index.js +2 -2
- package/dist/data-access/manage/agents.d.ts +24 -24
- package/dist/data-access/manage/artifactComponents.d.ts +6 -6
- package/dist/data-access/manage/contextConfigs.d.ts +4 -4
- package/dist/data-access/manage/dataComponents.d.ts +2 -2
- 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 +24 -24
- package/dist/data-access/manage/subAgentRelations.d.ts +26 -26
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgents.d.ts +12 -12
- package/dist/data-access/manage/tools.d.ts +21 -21
- package/dist/data-access/manage/tools.js +4 -2
- 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/apps.d.ts +29 -16
- package/dist/data-access/runtime/apps.js +14 -7
- package/dist/data-access/runtime/cascade-delete.d.ts +4 -0
- package/dist/data-access/runtime/cascade-delete.js +27 -1
- package/dist/data-access/runtime/conversations.d.ts +20 -20
- package/dist/data-access/runtime/messages.d.ts +18 -18
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +15 -0
- package/dist/data-access/runtime/tasks.d.ts +4 -4
- package/dist/data-access/runtime/triggerInvocations.d.ts +5 -0
- package/dist/db/manage/manage-schema.d.ts +453 -453
- package/dist/db/runtime/runtime-schema.d.ts +434 -326
- package/dist/db/runtime/runtime-schema.js +4 -0
- package/dist/env.js +7 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/utils/env-detection.d.ts +6 -0
- package/dist/utils/env-detection.js +13 -0
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/work-app-mcp.d.ts +8 -0
- package/dist/utils/work-app-mcp.js +18 -0
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/schemas.d.ts +2945 -4751
- package/dist/validation/schemas.js +10 -9
- package/drizzle/runtime/0023_bumpy_vampiro.sql +4 -0
- package/drizzle/runtime/meta/0023_snapshot.json +4264 -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
|
-
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
|
+
lastUsedAt: string | null;
|
|
19
20
|
publicId: string;
|
|
20
21
|
keyHash: string;
|
|
21
22
|
keyPrefix: string;
|
|
22
|
-
lastUsedAt: 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
|
-
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
|
+
lastUsedAt: string | null;
|
|
33
34
|
publicId: string;
|
|
34
35
|
keyHash: string;
|
|
35
36
|
keyPrefix: string;
|
|
36
|
-
lastUsedAt: 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
|
-
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
|
+
lastUsedAt: string | null;
|
|
50
51
|
publicId: string;
|
|
51
52
|
keyHash: string;
|
|
52
53
|
keyPrefix: string;
|
|
53
|
-
lastUsedAt: 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
|
-
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
|
+
lastUsedAt: string | null;
|
|
77
78
|
publicId: string;
|
|
78
79
|
keyHash: string;
|
|
79
80
|
keyPrefix: string;
|
|
80
|
-
lastUsedAt: string | null;
|
|
81
81
|
}>;
|
|
82
82
|
declare const updateApiKey: (db: AgentsRunDatabaseClient) => (params: {
|
|
83
83
|
scopes: ProjectScopeConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TenantScopeConfig } from "../../db/manage/scope-definitions.js";
|
|
1
|
+
import { ProjectScopeConfig, TenantScopeConfig } from "../../db/manage/scope-definitions.js";
|
|
2
2
|
import { AppType, PaginationConfig } from "../../types/utility.js";
|
|
3
3
|
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
4
4
|
import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
|
|
@@ -7,16 +7,13 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
|
|
|
7
7
|
declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
|
|
8
8
|
id: string;
|
|
9
9
|
name: string;
|
|
10
|
-
createdAt: string;
|
|
11
|
-
updatedAt: string;
|
|
12
10
|
description: string | null;
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
type: AppType;
|
|
15
11
|
tenantId: string | null;
|
|
16
12
|
projectId: string | null;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
type: AppType;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
enabled: boolean;
|
|
20
17
|
config: {
|
|
21
18
|
type: "web_client";
|
|
22
19
|
webClient: {
|
|
@@ -26,12 +23,19 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
|
|
|
26
23
|
type: "api";
|
|
27
24
|
api: Record<string, never>;
|
|
28
25
|
};
|
|
26
|
+
defaultAgentId: string | null;
|
|
27
|
+
defaultProjectId: string | null;
|
|
28
|
+
lastUsedAt: string | null;
|
|
29
29
|
} | undefined>;
|
|
30
30
|
declare const updateAppLastUsed: (db: AgentsRunDatabaseClient) => (id: string) => Promise<void>;
|
|
31
31
|
declare const getAppByIdForTenant: (db: AgentsRunDatabaseClient) => (params: {
|
|
32
32
|
scopes: TenantScopeConfig;
|
|
33
33
|
id: string;
|
|
34
34
|
}) => Promise<AppSelect | undefined>;
|
|
35
|
+
declare const getAppByIdForProject: (db: AgentsRunDatabaseClient) => (params: {
|
|
36
|
+
scopes: ProjectScopeConfig;
|
|
37
|
+
id: string;
|
|
38
|
+
}) => Promise<AppSelect | undefined>;
|
|
35
39
|
declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
36
40
|
scopes: TenantScopeConfig & {
|
|
37
41
|
projectId?: string;
|
|
@@ -50,16 +54,13 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
50
54
|
declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
|
|
51
55
|
id: string;
|
|
52
56
|
name: string;
|
|
53
|
-
createdAt: string;
|
|
54
|
-
updatedAt: string;
|
|
55
57
|
description: string | null;
|
|
56
|
-
enabled: boolean;
|
|
57
|
-
type: AppType;
|
|
58
58
|
tenantId: string | null;
|
|
59
59
|
projectId: string | null;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
type: AppType;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
updatedAt: string;
|
|
63
|
+
enabled: boolean;
|
|
63
64
|
config: {
|
|
64
65
|
type: "web_client";
|
|
65
66
|
webClient: {
|
|
@@ -69,16 +70,28 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
|
|
|
69
70
|
type: "api";
|
|
70
71
|
api: Record<string, never>;
|
|
71
72
|
};
|
|
73
|
+
defaultAgentId: string | null;
|
|
74
|
+
defaultProjectId: string | null;
|
|
75
|
+
lastUsedAt: string | null;
|
|
72
76
|
}>;
|
|
73
77
|
declare const updateAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
|
|
74
78
|
scopes: TenantScopeConfig;
|
|
75
79
|
id: string;
|
|
76
80
|
data: AppUpdate;
|
|
77
81
|
}) => Promise<AppSelect | undefined>;
|
|
82
|
+
declare const updateAppForProject: (db: AgentsRunDatabaseClient) => (params: {
|
|
83
|
+
scopes: ProjectScopeConfig;
|
|
84
|
+
id: string;
|
|
85
|
+
data: AppUpdate;
|
|
86
|
+
}) => Promise<AppSelect | undefined>;
|
|
78
87
|
declare const deleteAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
|
|
79
88
|
scopes: TenantScopeConfig;
|
|
80
89
|
id: string;
|
|
81
90
|
}) => Promise<boolean>;
|
|
91
|
+
declare const deleteAppForProject: (db: AgentsRunDatabaseClient) => (params: {
|
|
92
|
+
scopes: ProjectScopeConfig;
|
|
93
|
+
id: string;
|
|
94
|
+
}) => Promise<boolean>;
|
|
82
95
|
declare const deleteAppsByProject: (db: AgentsRunDatabaseClient) => (tenantId: string, projectId: string) => Promise<number>;
|
|
83
96
|
declare const clearAppDefaultsByProject: (db: AgentsRunDatabaseClient) => (tenantId: string, projectId: string) => Promise<number>;
|
|
84
97
|
declare const clearAppDefaultsByAgent: (db: AgentsRunDatabaseClient) => (tenantId: string, agentId: string) => Promise<number>;
|
|
@@ -110,4 +123,4 @@ declare const updateApp: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
110
123
|
}>;
|
|
111
124
|
declare const deleteApp: (db: AgentsRunDatabaseClient) => (id: string) => Promise<boolean>;
|
|
112
125
|
//#endregion
|
|
113
|
-
export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForTenant, deleteAppsByProject, getAppById, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppForTenant, updateAppLastUsed };
|
|
126
|
+
export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForProject, deleteAppForTenant, deleteAppsByProject, getAppById, getAppByIdForProject, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppForProject, updateAppForTenant, updateAppLastUsed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apps } from "../../db/runtime/runtime-schema.js";
|
|
2
|
-
import { tenantScopedWhere } from "../manage/scope-helpers.js";
|
|
2
|
+
import { projectScopedWhere, tenantScopedWhere } from "../manage/scope-helpers.js";
|
|
3
3
|
import { and, count, desc, eq } from "drizzle-orm";
|
|
4
4
|
|
|
5
5
|
//#region src/data-access/runtime/apps.ts
|
|
@@ -12,6 +12,9 @@ const updateAppLastUsed = (db) => async (id) => {
|
|
|
12
12
|
const getAppByIdForTenant = (db) => async (params) => {
|
|
13
13
|
return db.query.apps.findFirst({ where: and(eq(apps.id, params.id), tenantScopedWhere(apps, params.scopes)) });
|
|
14
14
|
};
|
|
15
|
+
const getAppByIdForProject = (db) => async (params) => {
|
|
16
|
+
return db.query.apps.findFirst({ where: and(eq(apps.id, params.id), projectScopedWhere(apps, params.scopes)) });
|
|
17
|
+
};
|
|
15
18
|
const listAppsPaginated = (db) => async (params) => {
|
|
16
19
|
const page = params.pagination?.page || 1;
|
|
17
20
|
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
@@ -42,17 +45,21 @@ const createApp = (db) => async (params) => {
|
|
|
42
45
|
}).returning();
|
|
43
46
|
return app;
|
|
44
47
|
};
|
|
45
|
-
const
|
|
48
|
+
const _updateApp = (db, scopeWhere) => async (id, data) => {
|
|
46
49
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
47
50
|
const [updatedApp] = await db.update(apps).set({
|
|
48
|
-
...
|
|
51
|
+
...data,
|
|
49
52
|
updatedAt: now
|
|
50
|
-
}).where(and(eq(apps.id,
|
|
53
|
+
}).where(and(eq(apps.id, id), scopeWhere)).returning();
|
|
51
54
|
return updatedApp;
|
|
52
55
|
};
|
|
53
|
-
const
|
|
54
|
-
return (await db.delete(apps).where(and(eq(apps.id,
|
|
56
|
+
const _deleteApp = (db, scopeWhere) => async (id) => {
|
|
57
|
+
return (await db.delete(apps).where(and(eq(apps.id, id), scopeWhere)).returning()).length > 0;
|
|
55
58
|
};
|
|
59
|
+
const updateAppForTenant = (db) => async (params) => _updateApp(db, tenantScopedWhere(apps, params.scopes))(params.id, params.data);
|
|
60
|
+
const updateAppForProject = (db) => async (params) => _updateApp(db, projectScopedWhere(apps, params.scopes))(params.id, params.data);
|
|
61
|
+
const deleteAppForTenant = (db) => async (params) => _deleteApp(db, tenantScopedWhere(apps, params.scopes))(params.id);
|
|
62
|
+
const deleteAppForProject = (db) => async (params) => _deleteApp(db, projectScopedWhere(apps, params.scopes))(params.id);
|
|
56
63
|
const deleteAppsByProject = (db) => async (tenantId, projectId) => {
|
|
57
64
|
return (await db.delete(apps).where(and(tenantScopedWhere(apps, { tenantId }), eq(apps.projectId, projectId))).returning()).length;
|
|
58
65
|
};
|
|
@@ -84,4 +91,4 @@ const deleteApp = (db) => async (id) => {
|
|
|
84
91
|
};
|
|
85
92
|
|
|
86
93
|
//#endregion
|
|
87
|
-
export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForTenant, deleteAppsByProject, getAppById, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppForTenant, updateAppLastUsed };
|
|
94
|
+
export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForProject, deleteAppForTenant, deleteAppsByProject, getAppById, getAppByIdForProject, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppForProject, updateAppForTenant, updateAppLastUsed };
|
|
@@ -10,6 +10,10 @@ type CascadeDeleteResult = {
|
|
|
10
10
|
conversationsDeleted: number;
|
|
11
11
|
tasksDeleted: number;
|
|
12
12
|
contextCacheDeleted: number;
|
|
13
|
+
triggerInvocationsDeleted: number;
|
|
14
|
+
scheduledTriggerInvocationsDeleted: number;
|
|
15
|
+
datasetRunsDeleted: number;
|
|
16
|
+
evaluationRunsDeleted: number;
|
|
13
17
|
apiKeysDeleted: number;
|
|
14
18
|
slackChannelConfigsDeleted: number;
|
|
15
19
|
slackWorkspaceDefaultsCleared: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { apiKeys, contextCache, conversations, tasks, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess } from "../../db/runtime/runtime-schema.js";
|
|
1
|
+
import { apiKeys, contextCache, conversations, datasetRun, evaluationRun, scheduledTriggerInvocations, tasks, triggerInvocations, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess } from "../../db/runtime/runtime-schema.js";
|
|
2
2
|
import { projectScopedWhere } from "../manage/scope-helpers.js";
|
|
3
3
|
import { clearAppDefaultsByAgent, clearAppDefaultsByProject, deleteAppsByProject } from "./apps.js";
|
|
4
4
|
import { deleteSlackMcpToolAccessConfig } from "./slack-work-app-mcp.js";
|
|
@@ -18,10 +18,18 @@ const cascadeDeleteByBranch = (db) => async (params) => {
|
|
|
18
18
|
const contextCacheResult = await db.delete(contextCache).where(and(projectScopedWhere(contextCache, scopes), sql`${contextCache.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
19
19
|
const conversationsResult = await db.delete(conversations).where(and(projectScopedWhere(conversations, scopes), sql`${conversations.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
20
20
|
const tasksResult = await db.delete(tasks).where(and(projectScopedWhere(tasks, scopes), sql`${tasks.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
21
|
+
const triggerInvocationsResult = await db.delete(triggerInvocations).where(and(eq(triggerInvocations.tenantId, scopes.tenantId), eq(triggerInvocations.projectId, scopes.projectId), sql`${triggerInvocations.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
22
|
+
const scheduledTriggerInvocationsResult = await db.delete(scheduledTriggerInvocations).where(and(eq(scheduledTriggerInvocations.tenantId, scopes.tenantId), eq(scheduledTriggerInvocations.projectId, scopes.projectId), sql`${scheduledTriggerInvocations.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
23
|
+
const datasetRunsResult = await db.delete(datasetRun).where(and(eq(datasetRun.tenantId, scopes.tenantId), eq(datasetRun.projectId, scopes.projectId), sql`${datasetRun.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
24
|
+
const evaluationRunsResult = await db.delete(evaluationRun).where(and(eq(evaluationRun.tenantId, scopes.tenantId), eq(evaluationRun.projectId, scopes.projectId), sql`${evaluationRun.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
21
25
|
return {
|
|
22
26
|
conversationsDeleted: conversationsResult.length,
|
|
23
27
|
tasksDeleted: tasksResult.length,
|
|
24
28
|
contextCacheDeleted: contextCacheResult.length,
|
|
29
|
+
triggerInvocationsDeleted: triggerInvocationsResult.length,
|
|
30
|
+
scheduledTriggerInvocationsDeleted: scheduledTriggerInvocationsResult.length,
|
|
31
|
+
datasetRunsDeleted: datasetRunsResult.length,
|
|
32
|
+
evaluationRunsDeleted: evaluationRunsResult.length,
|
|
25
33
|
apiKeysDeleted: 0,
|
|
26
34
|
slackChannelConfigsDeleted: 0,
|
|
27
35
|
slackWorkspaceDefaultsCleared: 0,
|
|
@@ -42,6 +50,10 @@ const cascadeDeleteByProject = (db) => async (params) => {
|
|
|
42
50
|
const contextCacheResult = await db.delete(contextCache).where(and(projectScopedWhere(contextCache, scopes), sql`${contextCache.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
43
51
|
const conversationsResult = await db.delete(conversations).where(and(projectScopedWhere(conversations, scopes), sql`${conversations.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
44
52
|
const tasksResult = await db.delete(tasks).where(and(projectScopedWhere(tasks, scopes), sql`${tasks.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
53
|
+
const triggerInvocationsResult = await db.delete(triggerInvocations).where(and(eq(triggerInvocations.tenantId, scopes.tenantId), eq(triggerInvocations.projectId, scopes.projectId), sql`${triggerInvocations.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
54
|
+
const scheduledTriggerInvocationsResult = await db.delete(scheduledTriggerInvocations).where(and(eq(scheduledTriggerInvocations.tenantId, scopes.tenantId), eq(scheduledTriggerInvocations.projectId, scopes.projectId), sql`${scheduledTriggerInvocations.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
55
|
+
const datasetRunsResult = await db.delete(datasetRun).where(and(eq(datasetRun.tenantId, scopes.tenantId), eq(datasetRun.projectId, scopes.projectId), sql`${datasetRun.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
56
|
+
const evaluationRunsResult = await db.delete(evaluationRun).where(and(eq(evaluationRun.tenantId, scopes.tenantId), eq(evaluationRun.projectId, scopes.projectId), sql`${evaluationRun.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
45
57
|
const apiKeysResult = await db.delete(apiKeys).where(projectScopedWhere(apiKeys, scopes)).returning();
|
|
46
58
|
await cascadeDeleteGitHubAccessByProject(db)({
|
|
47
59
|
tenantId: scopes.tenantId,
|
|
@@ -56,6 +68,10 @@ const cascadeDeleteByProject = (db) => async (params) => {
|
|
|
56
68
|
conversationsDeleted: conversationsResult.length,
|
|
57
69
|
tasksDeleted: tasksResult.length,
|
|
58
70
|
contextCacheDeleted: contextCacheResult.length,
|
|
71
|
+
triggerInvocationsDeleted: triggerInvocationsResult.length,
|
|
72
|
+
scheduledTriggerInvocationsDeleted: scheduledTriggerInvocationsResult.length,
|
|
73
|
+
datasetRunsDeleted: datasetRunsResult.length,
|
|
74
|
+
evaluationRunsDeleted: evaluationRunsResult.length,
|
|
59
75
|
apiKeysDeleted: apiKeysResult.length,
|
|
60
76
|
slackChannelConfigsDeleted,
|
|
61
77
|
slackWorkspaceDefaultsCleared,
|
|
@@ -85,6 +101,8 @@ const cascadeDeleteByAgent = (db) => async (params) => {
|
|
|
85
101
|
}
|
|
86
102
|
}
|
|
87
103
|
tasksDeleted = (await db.delete(tasks).where(and(projectScopedWhere(tasks, scopes), eq(tasks.agentId, scopes.agentId), sql`${tasks.ref}->>'name' = ${fullBranchName}`)).returning()).length;
|
|
104
|
+
const triggerInvocationsResult = await db.delete(triggerInvocations).where(and(eq(triggerInvocations.tenantId, scopes.tenantId), eq(triggerInvocations.projectId, scopes.projectId), eq(triggerInvocations.agentId, scopes.agentId), sql`${triggerInvocations.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
105
|
+
const scheduledTriggerInvocationsResult = await db.delete(scheduledTriggerInvocations).where(and(eq(scheduledTriggerInvocations.tenantId, scopes.tenantId), eq(scheduledTriggerInvocations.projectId, scopes.projectId), eq(scheduledTriggerInvocations.agentId, scopes.agentId), sql`${scheduledTriggerInvocations.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
88
106
|
apiKeysDeleted = (await db.delete(apiKeys).where(and(projectScopedWhere(apiKeys, scopes), eq(apiKeys.agentId, scopes.agentId))).returning()).length;
|
|
89
107
|
const appDefaultsCleared = await clearAppDefaultsByAgent(db)(scopes.tenantId, scopes.agentId);
|
|
90
108
|
const slackChannelConfigsDeleted = await deleteWorkAppSlackChannelAgentConfigsByAgent(db)(scopes.tenantId, scopes.projectId, scopes.agentId);
|
|
@@ -94,6 +112,10 @@ const cascadeDeleteByAgent = (db) => async (params) => {
|
|
|
94
112
|
conversationsDeleted,
|
|
95
113
|
tasksDeleted,
|
|
96
114
|
contextCacheDeleted,
|
|
115
|
+
triggerInvocationsDeleted: triggerInvocationsResult.length,
|
|
116
|
+
scheduledTriggerInvocationsDeleted: scheduledTriggerInvocationsResult.length,
|
|
117
|
+
datasetRunsDeleted: 0,
|
|
118
|
+
evaluationRunsDeleted: 0,
|
|
97
119
|
apiKeysDeleted,
|
|
98
120
|
slackChannelConfigsDeleted,
|
|
99
121
|
slackWorkspaceDefaultsCleared,
|
|
@@ -121,6 +143,10 @@ const cascadeDeleteBySubAgent = (db) => async (params) => {
|
|
|
121
143
|
conversationsDeleted,
|
|
122
144
|
tasksDeleted: tasksResult.length,
|
|
123
145
|
contextCacheDeleted,
|
|
146
|
+
triggerInvocationsDeleted: 0,
|
|
147
|
+
scheduledTriggerInvocationsDeleted: 0,
|
|
148
|
+
datasetRunsDeleted: 0,
|
|
149
|
+
evaluationRunsDeleted: 0,
|
|
124
150
|
apiKeysDeleted: 0,
|
|
125
151
|
slackChannelConfigsDeleted: 0,
|
|
126
152
|
slackWorkspaceDefaultsCleared: 0,
|
|
@@ -17,19 +17,19 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
17
17
|
}>;
|
|
18
18
|
declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
19
19
|
id: string;
|
|
20
|
+
tenantId: string;
|
|
21
|
+
projectId: string;
|
|
22
|
+
agentId: string | null;
|
|
23
|
+
title: string | null;
|
|
20
24
|
createdAt: string;
|
|
21
25
|
updatedAt: string;
|
|
26
|
+
metadata: ConversationMetadata | null;
|
|
22
27
|
ref: {
|
|
23
28
|
type: "commit" | "tag" | "branch";
|
|
24
29
|
name: string;
|
|
25
30
|
hash: string;
|
|
26
31
|
} | null;
|
|
27
32
|
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
|
}>;
|
|
@@ -86,19 +86,19 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
86
86
|
conversationId: string;
|
|
87
87
|
}) => Promise<{
|
|
88
88
|
id: string;
|
|
89
|
+
tenantId: string;
|
|
90
|
+
projectId: string;
|
|
91
|
+
agentId: string | null;
|
|
92
|
+
title: string | null;
|
|
89
93
|
createdAt: string;
|
|
90
94
|
updatedAt: string;
|
|
95
|
+
metadata: ConversationMetadata | null;
|
|
91
96
|
ref: {
|
|
92
97
|
type: "commit" | "tag" | "branch";
|
|
93
98
|
name: string;
|
|
94
99
|
hash: string;
|
|
95
100
|
} | null;
|
|
96
101
|
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>;
|
|
@@ -122,19 +122,19 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
122
122
|
contextConfigId?: string | undefined;
|
|
123
123
|
} | {
|
|
124
124
|
id: string;
|
|
125
|
+
tenantId: string;
|
|
126
|
+
projectId: string;
|
|
127
|
+
agentId: string | null;
|
|
128
|
+
title: string | null;
|
|
125
129
|
createdAt: string;
|
|
126
130
|
updatedAt: string;
|
|
131
|
+
metadata: ConversationMetadata | null;
|
|
127
132
|
ref: {
|
|
128
133
|
type: "commit" | "tag" | "branch";
|
|
129
134
|
name: string;
|
|
130
135
|
hash: string;
|
|
131
136
|
} | null;
|
|
132
137
|
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
|
}>;
|
|
@@ -154,19 +154,19 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
154
154
|
conversationId: string;
|
|
155
155
|
}) => Promise<{
|
|
156
156
|
id: string;
|
|
157
|
+
tenantId: string;
|
|
158
|
+
projectId: string;
|
|
159
|
+
agentId: string | null;
|
|
160
|
+
title: string | null;
|
|
157
161
|
createdAt: string;
|
|
158
162
|
updatedAt: string;
|
|
163
|
+
metadata: ConversationMetadata | null;
|
|
159
164
|
ref: {
|
|
160
165
|
type: "commit" | "tag" | "branch";
|
|
161
166
|
name: string;
|
|
162
167
|
hash: string;
|
|
163
168
|
} | null;
|
|
164
169
|
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>;
|
|
@@ -11,25 +11,25 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
11
11
|
messageId: string;
|
|
12
12
|
}) => Promise<{
|
|
13
13
|
id: string;
|
|
14
|
+
tenantId: string;
|
|
15
|
+
projectId: string;
|
|
14
16
|
createdAt: string;
|
|
15
17
|
updatedAt: string;
|
|
16
18
|
metadata: MessageMetadata | null;
|
|
17
|
-
role: string;
|
|
18
|
-
tenantId: string;
|
|
19
|
-
projectId: string;
|
|
20
19
|
content: MessageContent;
|
|
21
20
|
conversationId: string;
|
|
22
21
|
fromSubAgentId: string | null;
|
|
23
22
|
toSubAgentId: string | null;
|
|
24
23
|
fromExternalAgentId: string | null;
|
|
25
24
|
toExternalAgentId: string | null;
|
|
25
|
+
taskId: string | null;
|
|
26
|
+
a2aTaskId: string | null;
|
|
27
|
+
role: string;
|
|
28
|
+
visibility: string;
|
|
26
29
|
fromTeamAgentId: string | null;
|
|
27
30
|
toTeamAgentId: string | null;
|
|
28
|
-
visibility: string;
|
|
29
31
|
messageType: string;
|
|
30
|
-
taskId: string | null;
|
|
31
32
|
parentMessageId: string | null;
|
|
32
|
-
a2aTaskId: string | null;
|
|
33
33
|
a2aSessionId: string | null;
|
|
34
34
|
} | undefined>;
|
|
35
35
|
declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -145,25 +145,25 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
145
145
|
data: Omit<MessageInsert, "tenantId" | "projectId">;
|
|
146
146
|
}) => Promise<{
|
|
147
147
|
id: string;
|
|
148
|
+
tenantId: string;
|
|
149
|
+
projectId: string;
|
|
148
150
|
createdAt: string;
|
|
149
151
|
updatedAt: string;
|
|
150
152
|
metadata: MessageMetadata | null;
|
|
151
|
-
role: string;
|
|
152
|
-
tenantId: string;
|
|
153
|
-
projectId: string;
|
|
154
153
|
content: MessageContent;
|
|
155
154
|
conversationId: string;
|
|
156
155
|
fromSubAgentId: string | null;
|
|
157
156
|
toSubAgentId: string | null;
|
|
158
157
|
fromExternalAgentId: string | null;
|
|
159
158
|
toExternalAgentId: string | null;
|
|
159
|
+
taskId: string | null;
|
|
160
|
+
a2aTaskId: string | null;
|
|
161
|
+
role: string;
|
|
162
|
+
visibility: string;
|
|
160
163
|
fromTeamAgentId: string | null;
|
|
161
164
|
toTeamAgentId: string | null;
|
|
162
|
-
visibility: string;
|
|
163
165
|
messageType: string;
|
|
164
|
-
taskId: string | null;
|
|
165
166
|
parentMessageId: string | null;
|
|
166
|
-
a2aTaskId: string | null;
|
|
167
167
|
a2aSessionId: string | null;
|
|
168
168
|
}>;
|
|
169
169
|
declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -198,25 +198,25 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
198
198
|
messageId: string;
|
|
199
199
|
}) => Promise<{
|
|
200
200
|
id: string;
|
|
201
|
+
tenantId: string;
|
|
202
|
+
projectId: string;
|
|
201
203
|
createdAt: string;
|
|
202
204
|
updatedAt: string;
|
|
203
205
|
metadata: MessageMetadata | null;
|
|
204
|
-
role: string;
|
|
205
|
-
tenantId: string;
|
|
206
|
-
projectId: string;
|
|
207
206
|
content: MessageContent;
|
|
208
207
|
conversationId: string;
|
|
209
208
|
fromSubAgentId: string | null;
|
|
210
209
|
toSubAgentId: string | null;
|
|
211
210
|
fromExternalAgentId: string | null;
|
|
212
211
|
toExternalAgentId: string | null;
|
|
212
|
+
taskId: string | null;
|
|
213
|
+
a2aTaskId: string | null;
|
|
214
|
+
role: string;
|
|
215
|
+
visibility: string;
|
|
213
216
|
fromTeamAgentId: string | null;
|
|
214
217
|
toTeamAgentId: string | null;
|
|
215
|
-
visibility: string;
|
|
216
218
|
messageType: string;
|
|
217
|
-
taskId: string | null;
|
|
218
219
|
parentMessageId: string | null;
|
|
219
|
-
a2aTaskId: string | null;
|
|
220
220
|
a2aSessionId: string | null;
|
|
221
221
|
}>;
|
|
222
222
|
declare const countMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -34,6 +34,11 @@ declare const listScheduledTriggerInvocationsPaginated: (db: AgentsRunDatabaseCl
|
|
|
34
34
|
}) => Promise<{
|
|
35
35
|
data: {
|
|
36
36
|
scheduledTriggerId: string;
|
|
37
|
+
ref: {
|
|
38
|
+
type: "commit" | "tag" | "branch";
|
|
39
|
+
name: string;
|
|
40
|
+
hash: string;
|
|
41
|
+
} | null;
|
|
37
42
|
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
38
43
|
scheduledFor: string;
|
|
39
44
|
startedAt: string | null;
|
|
@@ -174,6 +179,11 @@ declare const listUpcomingInvocationsForAgentPaginated: (db: AgentsRunDatabaseCl
|
|
|
174
179
|
}) => Promise<{
|
|
175
180
|
data: {
|
|
176
181
|
scheduledTriggerId: string;
|
|
182
|
+
ref: {
|
|
183
|
+
type: "commit" | "tag" | "branch";
|
|
184
|
+
name: string;
|
|
185
|
+
hash: string;
|
|
186
|
+
} | null;
|
|
177
187
|
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
178
188
|
scheduledFor: string;
|
|
179
189
|
startedAt: string | null;
|
|
@@ -208,6 +218,11 @@ declare const listProjectScheduledTriggerInvocationsPaginated: (db: AgentsRunDat
|
|
|
208
218
|
}) => Promise<{
|
|
209
219
|
data: {
|
|
210
220
|
scheduledTriggerId: string;
|
|
221
|
+
ref: {
|
|
222
|
+
type: "commit" | "tag" | "branch";
|
|
223
|
+
name: string;
|
|
224
|
+
hash: string;
|
|
225
|
+
} | null;
|
|
211
226
|
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
212
227
|
scheduledFor: string;
|
|
213
228
|
startedAt: string | null;
|
|
@@ -8,18 +8,18 @@ import { TaskInsert, TaskSelect } from "../../types/entities.js";
|
|
|
8
8
|
//#region src/data-access/runtime/tasks.d.ts
|
|
9
9
|
declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
|
|
10
10
|
id: string;
|
|
11
|
+
tenantId: string;
|
|
12
|
+
projectId: string;
|
|
13
|
+
agentId: string;
|
|
11
14
|
createdAt: string;
|
|
12
15
|
updatedAt: string;
|
|
16
|
+
metadata: TaskMetadataConfig | null;
|
|
13
17
|
ref: {
|
|
14
18
|
type: "commit" | "tag" | "branch";
|
|
15
19
|
name: string;
|
|
16
20
|
hash: string;
|
|
17
21
|
} | null;
|
|
18
|
-
metadata: TaskMetadataConfig | null;
|
|
19
22
|
status: string;
|
|
20
|
-
tenantId: string;
|
|
21
|
-
projectId: string;
|
|
22
|
-
agentId: string;
|
|
23
23
|
subAgentId: string;
|
|
24
24
|
contextId: string;
|
|
25
25
|
}>;
|
|
@@ -28,6 +28,11 @@ declare const listTriggerInvocationsPaginated: (db: AgentsRunDatabaseClient) =>
|
|
|
28
28
|
data: {
|
|
29
29
|
triggerId: string;
|
|
30
30
|
conversationId: string | null;
|
|
31
|
+
ref: {
|
|
32
|
+
type: "commit" | "tag" | "branch";
|
|
33
|
+
name: string;
|
|
34
|
+
hash: string;
|
|
35
|
+
} | null;
|
|
31
36
|
status: string;
|
|
32
37
|
requestPayload: unknown;
|
|
33
38
|
transformedPayload: unknown;
|