@inkeep/agents-core 0.62.2 → 0.63.1
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-config-utils.js +1 -1
- package/dist/auth/auth.d.ts +6 -6
- package/dist/auth/auth.js +1 -1
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/client-exports.d.ts +2 -2
- package/dist/client-exports.js +2 -2
- package/dist/data-access/index.d.ts +4 -7
- package/dist/data-access/index.js +4 -7
- package/dist/data-access/manage/agentFull.js +0 -116
- package/dist/data-access/manage/agents.d.ts +41 -41
- package/dist/data-access/manage/agents.js +0 -30
- package/dist/data-access/manage/artifactComponents.d.ts +10 -10
- package/dist/data-access/manage/audit-queries.d.ts +1 -14
- package/dist/data-access/manage/audit-queries.js +2 -16
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/dataComponents.d.ts +4 -4
- package/dist/data-access/manage/functionTools.d.ts +16 -16
- 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 +15 -15
- package/dist/data-access/manage/tools.d.ts +30 -30
- package/dist/data-access/manage/triggerCleanup.js +18 -7
- package/dist/data-access/manage/triggers.d.ts +2 -2
- package/dist/data-access/runtime/apiKeys.d.ts +12 -12
- package/dist/data-access/runtime/apps.d.ts +8 -8
- package/dist/data-access/runtime/cascade-delete.d.ts +2 -0
- package/dist/data-access/runtime/cascade-delete.js +13 -6
- package/dist/data-access/runtime/conversations.d.ts +24 -24
- package/dist/data-access/runtime/messages.d.ts +18 -18
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +2 -1
- package/dist/data-access/runtime/scheduledTriggers.d.ts +89 -0
- package/dist/data-access/runtime/scheduledTriggers.js +91 -0
- package/dist/data-access/runtime/schedulerState.d.ts +11 -0
- package/dist/data-access/runtime/schedulerState.js +30 -0
- package/dist/data-access/runtime/tasks.d.ts +6 -6
- package/dist/data-reconciliation/index.d.ts +2 -2
- package/dist/data-reconciliation/types.d.ts +1 -28
- package/dist/db/manage/manage-schema.d.ts +433 -787
- package/dist/db/manage/manage-schema.js +2 -4
- package/dist/db/runtime/runtime-schema.d.ts +807 -346
- package/dist/db/runtime/runtime-schema.js +38 -5
- package/dist/index.d.ts +11 -12
- package/dist/index.js +8 -10
- package/dist/types/entities.d.ts +12 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/compute-next-run-at.d.ts +9 -0
- package/dist/utils/compute-next-run-at.js +18 -0
- package/dist/utils/error.d.ts +51 -51
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/dist/validation/schemas.d.ts +1062 -2042
- package/dist/validation/schemas.js +16 -32
- package/drizzle/runtime/0028_thick_squirrel_girl.sql +36 -0
- package/drizzle/runtime/meta/0028_snapshot.json +4661 -0
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +2 -1
- package/dist/data-access/manage/scheduledTriggers.d.ts +0 -91
- package/dist/data-access/manage/scheduledTriggers.js +0 -87
- package/dist/data-access/manage/scheduledWorkflows.d.ts +0 -29
- package/dist/data-access/manage/scheduledWorkflows.js +0 -33
|
@@ -20,20 +20,20 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
20
20
|
scopes: ProjectScopeConfig;
|
|
21
21
|
toolId: string;
|
|
22
22
|
}) => Promise<{
|
|
23
|
+
description: string | null;
|
|
24
|
+
tenantId: string;
|
|
25
|
+
projectId: string;
|
|
23
26
|
id: string;
|
|
24
27
|
name: string;
|
|
25
28
|
createdAt: string;
|
|
26
29
|
updatedAt: string;
|
|
27
|
-
|
|
28
|
-
headers: Record<string, string> | null;
|
|
29
|
-
tenantId: string;
|
|
30
|
-
projectId: string;
|
|
30
|
+
credentialReferenceId: string | null;
|
|
31
31
|
config: {
|
|
32
32
|
type: "mcp";
|
|
33
33
|
mcp: ToolMcpConfig;
|
|
34
34
|
};
|
|
35
|
-
credentialReferenceId: string | null;
|
|
36
35
|
credentialScope: string;
|
|
36
|
+
headers: Record<string, string> | null;
|
|
37
37
|
imageUrl: string | null;
|
|
38
38
|
capabilities: ToolServerCapabilities | null;
|
|
39
39
|
lastError: string | null;
|
|
@@ -78,20 +78,20 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
78
78
|
};
|
|
79
79
|
}>;
|
|
80
80
|
declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
|
|
81
|
+
description: string | null;
|
|
82
|
+
tenantId: string;
|
|
83
|
+
projectId: string;
|
|
81
84
|
id: string;
|
|
82
85
|
name: string;
|
|
83
86
|
createdAt: string;
|
|
84
87
|
updatedAt: string;
|
|
85
|
-
|
|
86
|
-
headers: Record<string, string> | null;
|
|
87
|
-
tenantId: string;
|
|
88
|
-
projectId: string;
|
|
88
|
+
credentialReferenceId: string | null;
|
|
89
89
|
config: {
|
|
90
90
|
type: "mcp";
|
|
91
91
|
mcp: ToolMcpConfig;
|
|
92
92
|
};
|
|
93
|
-
credentialReferenceId: string | null;
|
|
94
93
|
credentialScope: string;
|
|
94
|
+
headers: Record<string, string> | null;
|
|
95
95
|
imageUrl: string | null;
|
|
96
96
|
capabilities: ToolServerCapabilities | null;
|
|
97
97
|
lastError: string | null;
|
|
@@ -135,38 +135,38 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
135
135
|
needsApproval?: boolean;
|
|
136
136
|
}> | null;
|
|
137
137
|
}) => Promise<{
|
|
138
|
-
id: string;
|
|
139
|
-
createdAt: string;
|
|
140
|
-
updatedAt: string;
|
|
141
|
-
headers: Record<string, string> | null;
|
|
142
138
|
tenantId: string;
|
|
143
139
|
projectId: string;
|
|
144
140
|
agentId: string;
|
|
145
141
|
subAgentId: string;
|
|
146
142
|
toolId: string;
|
|
143
|
+
id: string;
|
|
144
|
+
createdAt: string;
|
|
145
|
+
updatedAt: string;
|
|
146
|
+
headers: Record<string, string> | null;
|
|
147
|
+
selectedTools: string[] | null;
|
|
147
148
|
toolPolicies: Record<string, {
|
|
148
149
|
needsApproval?: boolean;
|
|
149
150
|
}> | null;
|
|
150
|
-
selectedTools: string[] | null;
|
|
151
151
|
}>;
|
|
152
152
|
declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
153
153
|
scopes: AgentScopeConfig;
|
|
154
154
|
subAgentId: string;
|
|
155
155
|
toolId: string;
|
|
156
156
|
}) => Promise<{
|
|
157
|
-
id: string;
|
|
158
|
-
createdAt: string;
|
|
159
|
-
updatedAt: string;
|
|
160
|
-
headers: Record<string, string> | null;
|
|
161
157
|
tenantId: string;
|
|
162
158
|
projectId: string;
|
|
163
159
|
agentId: string;
|
|
164
160
|
subAgentId: string;
|
|
165
161
|
toolId: string;
|
|
162
|
+
id: string;
|
|
163
|
+
createdAt: string;
|
|
164
|
+
updatedAt: string;
|
|
165
|
+
headers: Record<string, string> | null;
|
|
166
|
+
selectedTools: string[] | null;
|
|
166
167
|
toolPolicies: Record<string, {
|
|
167
168
|
needsApproval?: boolean;
|
|
168
169
|
}> | null;
|
|
169
|
-
selectedTools: string[] | null;
|
|
170
170
|
}>;
|
|
171
171
|
/**
|
|
172
172
|
* Upsert agent-tool relation (create if it doesn't exist, update if it does)
|
|
@@ -182,19 +182,19 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
182
182
|
}> | null;
|
|
183
183
|
relationId?: string;
|
|
184
184
|
}) => Promise<{
|
|
185
|
-
id: string;
|
|
186
|
-
createdAt: string;
|
|
187
|
-
updatedAt: string;
|
|
188
|
-
headers: Record<string, string> | null;
|
|
189
185
|
tenantId: string;
|
|
190
186
|
projectId: string;
|
|
191
187
|
agentId: string;
|
|
192
188
|
subAgentId: string;
|
|
193
189
|
toolId: string;
|
|
190
|
+
id: string;
|
|
191
|
+
createdAt: string;
|
|
192
|
+
updatedAt: string;
|
|
193
|
+
headers: Record<string, string> | null;
|
|
194
|
+
selectedTools: string[] | null;
|
|
194
195
|
toolPolicies: Record<string, {
|
|
195
196
|
needsApproval?: boolean;
|
|
196
197
|
}> | null;
|
|
197
|
-
selectedTools: string[] | null;
|
|
198
198
|
}>;
|
|
199
199
|
/**
|
|
200
200
|
* Upsert a tool (create if it doesn't exist, update if it does)
|
|
@@ -202,20 +202,20 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
202
202
|
declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
203
203
|
data: ToolInsert;
|
|
204
204
|
}) => Promise<{
|
|
205
|
+
description: string | null;
|
|
206
|
+
tenantId: string;
|
|
207
|
+
projectId: string;
|
|
205
208
|
id: string;
|
|
206
209
|
name: string;
|
|
207
210
|
createdAt: string;
|
|
208
211
|
updatedAt: string;
|
|
209
|
-
|
|
210
|
-
headers: Record<string, string> | null;
|
|
211
|
-
tenantId: string;
|
|
212
|
-
projectId: string;
|
|
212
|
+
credentialReferenceId: string | null;
|
|
213
213
|
config: {
|
|
214
214
|
type: "mcp";
|
|
215
215
|
mcp: ToolMcpConfig;
|
|
216
216
|
};
|
|
217
|
-
credentialReferenceId: string | null;
|
|
218
217
|
credentialScope: string;
|
|
218
|
+
headers: Record<string, string> | null;
|
|
219
219
|
imageUrl: string | null;
|
|
220
220
|
capabilities: ToolServerCapabilities | null;
|
|
221
221
|
lastError: string | null;
|
|
@@ -2,8 +2,8 @@ import { manage_schema_exports } from "../../db/manage/manage-schema.js";
|
|
|
2
2
|
import { getLogger } from "../../utils/logger.js";
|
|
3
3
|
import { resolveProjectMainRefs } from "../../dolt/ref-helpers.js";
|
|
4
4
|
import { listProjectsMetadata } from "../runtime/projects.js";
|
|
5
|
-
import { deleteScheduledTriggersByRunAsUserId } from "./scheduledTriggers.js";
|
|
6
5
|
import { deleteTriggersByRunAsUserId } from "./triggers.js";
|
|
6
|
+
import { deleteScheduledTriggersByRunAsUserId } from "../runtime/scheduledTriggers.js";
|
|
7
7
|
import { withRef } from "../../dolt/ref-scope.js";
|
|
8
8
|
import { drizzle } from "drizzle-orm/node-postgres";
|
|
9
9
|
|
|
@@ -13,6 +13,22 @@ async function cleanupUserTriggers(params) {
|
|
|
13
13
|
const { tenantId, userId, runDb, manageDbPool } = params;
|
|
14
14
|
const projects = await listProjectsMetadata(runDb)({ tenantId });
|
|
15
15
|
if (projects.length === 0) return;
|
|
16
|
+
await Promise.allSettled(projects.map(async (project) => {
|
|
17
|
+
try {
|
|
18
|
+
await deleteScheduledTriggersByRunAsUserId(runDb)({
|
|
19
|
+
tenantId,
|
|
20
|
+
projectId: project.id,
|
|
21
|
+
runAsUserId: userId
|
|
22
|
+
});
|
|
23
|
+
} catch (err) {
|
|
24
|
+
logger.error({
|
|
25
|
+
tenantId,
|
|
26
|
+
projectId: project.id,
|
|
27
|
+
userId,
|
|
28
|
+
error: err
|
|
29
|
+
}, "Failed to clean up scheduled triggers for project");
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
16
32
|
const connection = await manageDbPool.connect();
|
|
17
33
|
let resolvedRefs;
|
|
18
34
|
try {
|
|
@@ -21,11 +37,6 @@ async function cleanupUserTriggers(params) {
|
|
|
21
37
|
connection.release();
|
|
22
38
|
}
|
|
23
39
|
const results = await Promise.allSettled(resolvedRefs.map(({ projectId, ref }) => withRef(manageDbPool, ref, async (db) => {
|
|
24
|
-
await deleteScheduledTriggersByRunAsUserId(db)({
|
|
25
|
-
tenantId,
|
|
26
|
-
projectId,
|
|
27
|
-
runAsUserId: userId
|
|
28
|
-
});
|
|
29
40
|
await deleteTriggersByRunAsUserId(db)({
|
|
30
41
|
tenantId,
|
|
31
42
|
projectId,
|
|
@@ -43,7 +54,7 @@ async function cleanupUserTriggers(params) {
|
|
|
43
54
|
projectId,
|
|
44
55
|
userId,
|
|
45
56
|
error: result.reason
|
|
46
|
-
}, "Failed to clean up
|
|
57
|
+
}, "Failed to clean up webhook triggers for project");
|
|
47
58
|
}
|
|
48
59
|
}
|
|
49
60
|
|
|
@@ -40,13 +40,13 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
|
|
|
40
40
|
algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
|
|
41
41
|
encoding: "hex" | "base64";
|
|
42
42
|
signature: {
|
|
43
|
-
source: "
|
|
43
|
+
source: "header" | "query" | "body";
|
|
44
44
|
key: string;
|
|
45
45
|
prefix?: string | undefined;
|
|
46
46
|
regex?: string | undefined;
|
|
47
47
|
};
|
|
48
48
|
signedComponents: {
|
|
49
|
-
source: "literal" | "
|
|
49
|
+
source: "literal" | "header" | "body";
|
|
50
50
|
required: boolean;
|
|
51
51
|
key?: string | undefined;
|
|
52
52
|
value?: string | undefined;
|
|
@@ -8,28 +8,28 @@ 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;
|
|
11
14
|
id: string;
|
|
12
15
|
name: string | null;
|
|
13
16
|
createdAt: string;
|
|
14
17
|
updatedAt: string;
|
|
15
18
|
expiresAt: string | null;
|
|
16
|
-
tenantId: string;
|
|
17
|
-
projectId: string;
|
|
18
|
-
agentId: string;
|
|
19
19
|
publicId: string;
|
|
20
20
|
keyHash: string;
|
|
21
21
|
keyPrefix: string;
|
|
22
22
|
lastUsedAt: string | null;
|
|
23
23
|
} | undefined>;
|
|
24
24
|
declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
|
|
25
|
+
tenantId: string;
|
|
26
|
+
projectId: string;
|
|
27
|
+
agentId: string;
|
|
25
28
|
id: string;
|
|
26
29
|
name: string | null;
|
|
27
30
|
createdAt: string;
|
|
28
31
|
updatedAt: string;
|
|
29
32
|
expiresAt: string | null;
|
|
30
|
-
tenantId: string;
|
|
31
|
-
projectId: string;
|
|
32
|
-
agentId: string;
|
|
33
33
|
publicId: string;
|
|
34
34
|
keyHash: string;
|
|
35
35
|
keyPrefix: string;
|
|
@@ -39,14 +39,14 @@ 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;
|
|
42
45
|
id: string;
|
|
43
46
|
name: string | null;
|
|
44
47
|
createdAt: string;
|
|
45
48
|
updatedAt: string;
|
|
46
49
|
expiresAt: string | null;
|
|
47
|
-
tenantId: string;
|
|
48
|
-
projectId: string;
|
|
49
|
-
agentId: string;
|
|
50
50
|
publicId: string;
|
|
51
51
|
keyHash: string;
|
|
52
52
|
keyPrefix: string;
|
|
@@ -66,14 +66,14 @@ 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;
|
|
69
72
|
id: string;
|
|
70
73
|
name: string | null;
|
|
71
74
|
createdAt: string;
|
|
72
75
|
updatedAt: string;
|
|
73
76
|
expiresAt: string | null;
|
|
74
|
-
tenantId: string;
|
|
75
|
-
projectId: string;
|
|
76
|
-
agentId: string;
|
|
77
77
|
publicId: string;
|
|
78
78
|
keyHash: string;
|
|
79
79
|
keyPrefix: string;
|
|
@@ -5,15 +5,15 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
|
|
|
5
5
|
|
|
6
6
|
//#region src/data-access/runtime/apps.d.ts
|
|
7
7
|
declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
|
|
8
|
+
type: AppType;
|
|
9
|
+
description: string | null;
|
|
10
|
+
tenantId: string | null;
|
|
11
|
+
projectId: string | null;
|
|
8
12
|
id: string;
|
|
9
13
|
name: string;
|
|
10
14
|
createdAt: string;
|
|
11
15
|
updatedAt: string;
|
|
12
|
-
description: string | null;
|
|
13
16
|
enabled: boolean;
|
|
14
|
-
type: AppType;
|
|
15
|
-
tenantId: string | null;
|
|
16
|
-
projectId: string | null;
|
|
17
17
|
prompt: string | null;
|
|
18
18
|
config: {
|
|
19
19
|
type: "web_client";
|
|
@@ -64,15 +64,15 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
64
64
|
};
|
|
65
65
|
}>;
|
|
66
66
|
declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
|
|
67
|
+
type: AppType;
|
|
68
|
+
description: string | null;
|
|
69
|
+
tenantId: string | null;
|
|
70
|
+
projectId: string | null;
|
|
67
71
|
id: string;
|
|
68
72
|
name: string;
|
|
69
73
|
createdAt: string;
|
|
70
74
|
updatedAt: string;
|
|
71
|
-
description: string | null;
|
|
72
75
|
enabled: boolean;
|
|
73
|
-
type: AppType;
|
|
74
|
-
tenantId: string | null;
|
|
75
|
-
projectId: string | null;
|
|
76
76
|
prompt: string | null;
|
|
77
77
|
config: {
|
|
78
78
|
type: "web_client";
|
|
@@ -19,6 +19,7 @@ type CascadeDeleteResult = {
|
|
|
19
19
|
slackWorkspaceDefaultsCleared: number;
|
|
20
20
|
appsDeleted: number;
|
|
21
21
|
appDefaultsCleared: number;
|
|
22
|
+
scheduledTriggersDeleted: number;
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
24
25
|
* Delete all runtime entities for a specific branch.
|
|
@@ -30,6 +31,7 @@ type CascadeDeleteResult = {
|
|
|
30
31
|
declare const cascadeDeleteByBranch: (db: AgentsRunDatabaseClient) => (params: {
|
|
31
32
|
scopes: ProjectScopeConfig;
|
|
32
33
|
fullBranchName: string;
|
|
34
|
+
ref: string;
|
|
33
35
|
}) => Promise<CascadeDeleteResult>;
|
|
34
36
|
/**
|
|
35
37
|
* Delete all runtime entities for a project on a specific branch.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { apiKeys, contextCache, conversations, datasetRun, evaluationRun, scheduledTriggerInvocations, tasks, triggerInvocations, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess } from "../../db/runtime/runtime-schema.js";
|
|
1
|
+
import { apiKeys, contextCache, conversations, datasetRun, evaluationRun, scheduledTriggerInvocations, scheduledTriggers, 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";
|
|
@@ -14,7 +14,7 @@ import { and, eq, inArray, sql } from "drizzle-orm";
|
|
|
14
14
|
* @returns Function that performs the cascade delete
|
|
15
15
|
*/
|
|
16
16
|
const cascadeDeleteByBranch = (db) => async (params) => {
|
|
17
|
-
const { scopes, fullBranchName } = params;
|
|
17
|
+
const { scopes, fullBranchName, ref } = 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();
|
|
@@ -22,6 +22,7 @@ const cascadeDeleteByBranch = (db) => async (params) => {
|
|
|
22
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
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
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();
|
|
25
|
+
const scheduledTriggersResult = await db.delete(scheduledTriggers).where(and(eq(scheduledTriggers.tenantId, scopes.tenantId), eq(scheduledTriggers.projectId, scopes.projectId), eq(scheduledTriggers.ref, ref))).returning();
|
|
25
26
|
return {
|
|
26
27
|
conversationsDeleted: conversationsResult.length,
|
|
27
28
|
tasksDeleted: tasksResult.length,
|
|
@@ -34,7 +35,8 @@ const cascadeDeleteByBranch = (db) => async (params) => {
|
|
|
34
35
|
slackChannelConfigsDeleted: 0,
|
|
35
36
|
slackWorkspaceDefaultsCleared: 0,
|
|
36
37
|
appsDeleted: 0,
|
|
37
|
-
appDefaultsCleared: 0
|
|
38
|
+
appDefaultsCleared: 0,
|
|
39
|
+
scheduledTriggersDeleted: scheduledTriggersResult.length
|
|
38
40
|
};
|
|
39
41
|
};
|
|
40
42
|
/**
|
|
@@ -64,6 +66,7 @@ const cascadeDeleteByProject = (db) => async (params) => {
|
|
|
64
66
|
const slackChannelConfigsDeleted = await deleteWorkAppSlackChannelAgentConfigsByProject(db)(scopes.tenantId, scopes.projectId);
|
|
65
67
|
const slackWorkspaceDefaultsCleared = await clearWorkspaceDefaultsByProject(db)(scopes.tenantId, scopes.projectId);
|
|
66
68
|
clearDevConfigWorkspaceDefaultsByProject(scopes.projectId);
|
|
69
|
+
const scheduledTriggersResult = await db.delete(scheduledTriggers).where(and(eq(scheduledTriggers.tenantId, scopes.tenantId), eq(scheduledTriggers.projectId, scopes.projectId))).returning();
|
|
67
70
|
return {
|
|
68
71
|
conversationsDeleted: conversationsResult.length,
|
|
69
72
|
tasksDeleted: tasksResult.length,
|
|
@@ -76,7 +79,8 @@ const cascadeDeleteByProject = (db) => async (params) => {
|
|
|
76
79
|
slackChannelConfigsDeleted,
|
|
77
80
|
slackWorkspaceDefaultsCleared,
|
|
78
81
|
appsDeleted,
|
|
79
|
-
appDefaultsCleared
|
|
82
|
+
appDefaultsCleared,
|
|
83
|
+
scheduledTriggersDeleted: scheduledTriggersResult.length
|
|
80
84
|
};
|
|
81
85
|
};
|
|
82
86
|
/**
|
|
@@ -108,6 +112,7 @@ const cascadeDeleteByAgent = (db) => async (params) => {
|
|
|
108
112
|
const slackChannelConfigsDeleted = await deleteWorkAppSlackChannelAgentConfigsByAgent(db)(scopes.tenantId, scopes.projectId, scopes.agentId);
|
|
109
113
|
const slackWorkspaceDefaultsCleared = await clearWorkspaceDefaultsByAgent(db)(scopes.tenantId, scopes.projectId, scopes.agentId);
|
|
110
114
|
clearDevConfigWorkspaceDefaultsByAgent(scopes.projectId, scopes.agentId);
|
|
115
|
+
const scheduledTriggersResult = await db.delete(scheduledTriggers).where(and(eq(scheduledTriggers.tenantId, scopes.tenantId), eq(scheduledTriggers.projectId, scopes.projectId), eq(scheduledTriggers.agentId, scopes.agentId))).returning();
|
|
111
116
|
return {
|
|
112
117
|
conversationsDeleted,
|
|
113
118
|
tasksDeleted,
|
|
@@ -120,7 +125,8 @@ const cascadeDeleteByAgent = (db) => async (params) => {
|
|
|
120
125
|
slackChannelConfigsDeleted,
|
|
121
126
|
slackWorkspaceDefaultsCleared,
|
|
122
127
|
appsDeleted: 0,
|
|
123
|
-
appDefaultsCleared
|
|
128
|
+
appDefaultsCleared,
|
|
129
|
+
scheduledTriggersDeleted: scheduledTriggersResult.length
|
|
124
130
|
};
|
|
125
131
|
};
|
|
126
132
|
/**
|
|
@@ -151,7 +157,8 @@ const cascadeDeleteBySubAgent = (db) => async (params) => {
|
|
|
151
157
|
slackChannelConfigsDeleted: 0,
|
|
152
158
|
slackWorkspaceDefaultsCleared: 0,
|
|
153
159
|
appsDeleted: 0,
|
|
154
|
-
appDefaultsCleared: 0
|
|
160
|
+
appDefaultsCleared: 0,
|
|
161
|
+
scheduledTriggersDeleted: 0
|
|
155
162
|
};
|
|
156
163
|
};
|
|
157
164
|
/**
|
|
@@ -15,20 +15,20 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
15
15
|
total: number;
|
|
16
16
|
}>;
|
|
17
17
|
declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
18
|
+
title: string | null;
|
|
19
|
+
tenantId: string;
|
|
20
|
+
projectId: string;
|
|
21
|
+
agentId: string | null;
|
|
18
22
|
id: string;
|
|
19
23
|
createdAt: string;
|
|
20
24
|
updatedAt: string;
|
|
25
|
+
userId: string | null;
|
|
26
|
+
metadata: ConversationMetadata | null;
|
|
21
27
|
ref: {
|
|
22
28
|
type: "commit" | "tag" | "branch";
|
|
23
29
|
name: string;
|
|
24
30
|
hash: string;
|
|
25
31
|
} | null;
|
|
26
|
-
userId: string | null;
|
|
27
|
-
metadata: ConversationMetadata | null;
|
|
28
|
-
title: string | null;
|
|
29
|
-
tenantId: string;
|
|
30
|
-
projectId: string;
|
|
31
|
-
agentId: string | null;
|
|
32
32
|
activeSubAgentId: string;
|
|
33
33
|
lastContextResolution: string | null;
|
|
34
34
|
}>;
|
|
@@ -84,20 +84,20 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
84
84
|
scopes: ProjectScopeConfig;
|
|
85
85
|
conversationId: string;
|
|
86
86
|
}) => Promise<{
|
|
87
|
+
title: string | null;
|
|
88
|
+
tenantId: string;
|
|
89
|
+
projectId: string;
|
|
90
|
+
agentId: string | null;
|
|
87
91
|
id: string;
|
|
88
92
|
createdAt: string;
|
|
89
93
|
updatedAt: string;
|
|
94
|
+
userId: string | null;
|
|
95
|
+
metadata: ConversationMetadata | null;
|
|
90
96
|
ref: {
|
|
91
97
|
type: "commit" | "tag" | "branch";
|
|
92
98
|
name: string;
|
|
93
99
|
hash: string;
|
|
94
100
|
} | null;
|
|
95
|
-
userId: string | null;
|
|
96
|
-
metadata: ConversationMetadata | null;
|
|
97
|
-
title: string | null;
|
|
98
|
-
tenantId: string;
|
|
99
|
-
projectId: string;
|
|
100
|
-
agentId: string | null;
|
|
101
101
|
activeSubAgentId: string;
|
|
102
102
|
lastContextResolution: string | null;
|
|
103
103
|
} | undefined>;
|
|
@@ -120,20 +120,20 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
120
120
|
metadata?: ConversationMetadata | null | undefined;
|
|
121
121
|
contextConfigId?: string | undefined;
|
|
122
122
|
} | {
|
|
123
|
+
title: string | null;
|
|
124
|
+
tenantId: string;
|
|
125
|
+
projectId: string;
|
|
126
|
+
agentId: string | null;
|
|
123
127
|
id: string;
|
|
124
128
|
createdAt: string;
|
|
125
129
|
updatedAt: string;
|
|
130
|
+
userId: string | null;
|
|
131
|
+
metadata: ConversationMetadata | null;
|
|
126
132
|
ref: {
|
|
127
133
|
type: "commit" | "tag" | "branch";
|
|
128
134
|
name: string;
|
|
129
135
|
hash: string;
|
|
130
136
|
} | null;
|
|
131
|
-
userId: string | null;
|
|
132
|
-
metadata: ConversationMetadata | null;
|
|
133
|
-
title: string | null;
|
|
134
|
-
tenantId: string;
|
|
135
|
-
projectId: string;
|
|
136
|
-
agentId: string | null;
|
|
137
137
|
activeSubAgentId: string;
|
|
138
138
|
lastContextResolution: string | null;
|
|
139
139
|
}>;
|
|
@@ -152,20 +152,20 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
152
152
|
scopes: ProjectScopeConfig;
|
|
153
153
|
conversationId: string;
|
|
154
154
|
}) => Promise<{
|
|
155
|
+
title: string | null;
|
|
156
|
+
tenantId: string;
|
|
157
|
+
projectId: string;
|
|
158
|
+
agentId: string | null;
|
|
155
159
|
id: string;
|
|
156
160
|
createdAt: string;
|
|
157
161
|
updatedAt: string;
|
|
162
|
+
userId: string | null;
|
|
163
|
+
metadata: ConversationMetadata | null;
|
|
158
164
|
ref: {
|
|
159
165
|
type: "commit" | "tag" | "branch";
|
|
160
166
|
name: string;
|
|
161
167
|
hash: string;
|
|
162
168
|
} | null;
|
|
163
|
-
userId: string | null;
|
|
164
|
-
metadata: ConversationMetadata | null;
|
|
165
|
-
title: string | null;
|
|
166
|
-
tenantId: string;
|
|
167
|
-
projectId: string;
|
|
168
|
-
agentId: string | null;
|
|
169
169
|
activeSubAgentId: string;
|
|
170
170
|
lastContextResolution: string | null;
|
|
171
171
|
} | undefined>;
|
|
@@ -10,26 +10,26 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
10
10
|
scopes: ProjectScopeConfig;
|
|
11
11
|
messageId: string;
|
|
12
12
|
}) => Promise<{
|
|
13
|
+
tenantId: string;
|
|
14
|
+
projectId: string;
|
|
13
15
|
id: string;
|
|
14
16
|
createdAt: string;
|
|
15
17
|
updatedAt: string;
|
|
18
|
+
content: MessageContent;
|
|
16
19
|
metadata: MessageMetadata | null;
|
|
17
20
|
role: string;
|
|
18
|
-
|
|
19
|
-
tenantId: string;
|
|
20
|
-
projectId: string;
|
|
21
|
+
conversationId: string;
|
|
21
22
|
fromSubAgentId: string | null;
|
|
22
23
|
toSubAgentId: string | null;
|
|
23
24
|
fromExternalAgentId: string | null;
|
|
24
25
|
toExternalAgentId: string | null;
|
|
25
|
-
taskId: string | null;
|
|
26
|
-
a2aTaskId: string | null;
|
|
27
|
-
conversationId: string;
|
|
28
26
|
fromTeamAgentId: string | null;
|
|
29
27
|
toTeamAgentId: string | null;
|
|
30
28
|
visibility: string;
|
|
31
29
|
messageType: string;
|
|
30
|
+
taskId: string | null;
|
|
32
31
|
parentMessageId: string | null;
|
|
32
|
+
a2aTaskId: string | null;
|
|
33
33
|
a2aSessionId: string | null;
|
|
34
34
|
} | undefined>;
|
|
35
35
|
declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -144,26 +144,26 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
144
144
|
scopes: ProjectScopeConfig;
|
|
145
145
|
data: Omit<MessageInsert, "tenantId" | "projectId">;
|
|
146
146
|
}) => Promise<{
|
|
147
|
+
tenantId: string;
|
|
148
|
+
projectId: string;
|
|
147
149
|
id: string;
|
|
148
150
|
createdAt: string;
|
|
149
151
|
updatedAt: string;
|
|
152
|
+
content: MessageContent;
|
|
150
153
|
metadata: MessageMetadata | null;
|
|
151
154
|
role: string;
|
|
152
|
-
|
|
153
|
-
tenantId: string;
|
|
154
|
-
projectId: string;
|
|
155
|
+
conversationId: string;
|
|
155
156
|
fromSubAgentId: string | null;
|
|
156
157
|
toSubAgentId: string | null;
|
|
157
158
|
fromExternalAgentId: string | null;
|
|
158
159
|
toExternalAgentId: string | null;
|
|
159
|
-
taskId: string | null;
|
|
160
|
-
a2aTaskId: string | null;
|
|
161
|
-
conversationId: string;
|
|
162
160
|
fromTeamAgentId: string | null;
|
|
163
161
|
toTeamAgentId: string | null;
|
|
164
162
|
visibility: string;
|
|
165
163
|
messageType: string;
|
|
164
|
+
taskId: string | null;
|
|
166
165
|
parentMessageId: string | null;
|
|
166
|
+
a2aTaskId: string | null;
|
|
167
167
|
a2aSessionId: string | null;
|
|
168
168
|
}>;
|
|
169
169
|
declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -197,26 +197,26 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
197
197
|
scopes: ProjectScopeConfig;
|
|
198
198
|
messageId: string;
|
|
199
199
|
}) => Promise<{
|
|
200
|
+
tenantId: string;
|
|
201
|
+
projectId: string;
|
|
200
202
|
id: string;
|
|
201
203
|
createdAt: string;
|
|
202
204
|
updatedAt: string;
|
|
205
|
+
content: MessageContent;
|
|
203
206
|
metadata: MessageMetadata | null;
|
|
204
207
|
role: string;
|
|
205
|
-
|
|
206
|
-
tenantId: string;
|
|
207
|
-
projectId: string;
|
|
208
|
+
conversationId: string;
|
|
208
209
|
fromSubAgentId: string | null;
|
|
209
210
|
toSubAgentId: string | null;
|
|
210
211
|
fromExternalAgentId: string | null;
|
|
211
212
|
toExternalAgentId: string | null;
|
|
212
|
-
taskId: string | null;
|
|
213
|
-
a2aTaskId: string | null;
|
|
214
|
-
conversationId: string;
|
|
215
213
|
fromTeamAgentId: string | null;
|
|
216
214
|
toTeamAgentId: string | null;
|
|
217
215
|
visibility: string;
|
|
218
216
|
messageType: string;
|
|
217
|
+
taskId: string | null;
|
|
219
218
|
parentMessageId: string | null;
|
|
219
|
+
a2aTaskId: string | null;
|
|
220
220
|
a2aSessionId: string | null;
|
|
221
221
|
}>;
|
|
222
222
|
declare const countMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AgentScopeConfig } from "../../db/manage/scope-definitions.js";
|
|
2
2
|
import { PaginationConfig } from "../../types/utility.js";
|
|
3
3
|
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ScheduledTriggerInvocationStatus } from "../../validation/schemas.js";
|
|
5
|
+
import { ScheduledTriggerInvocation, ScheduledTriggerInvocationInsert, ScheduledTriggerInvocationUpdate } from "../../types/entities.js";
|
|
5
6
|
|
|
6
7
|
//#region src/data-access/runtime/scheduledTriggerInvocations.d.ts
|
|
7
8
|
/**
|