@inkeep/agents-core 0.78.3 → 0.78.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/auth/auth-schema.d.ts +227 -227
  2. package/dist/auth/auth-validation-schemas.d.ts +137 -137
  3. package/dist/auth/permissions.d.ts +9 -9
  4. package/dist/client-exports.d.ts +2 -2
  5. package/dist/client-exports.js +2 -2
  6. package/dist/data-access/index.d.ts +5 -5
  7. package/dist/data-access/index.js +5 -5
  8. package/dist/data-access/manage/agents.d.ts +25 -25
  9. package/dist/data-access/manage/artifactComponents.d.ts +10 -10
  10. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  11. package/dist/data-access/manage/dataComponents.d.ts +4 -4
  12. package/dist/data-access/manage/evalConfig.d.ts +19 -2
  13. package/dist/data-access/manage/evalConfig.js +20 -2
  14. package/dist/data-access/manage/functionTools.d.ts +14 -14
  15. package/dist/data-access/manage/skills.d.ts +12 -12
  16. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
  17. package/dist/data-access/manage/subAgentRelations.d.ts +26 -26
  18. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
  19. package/dist/data-access/manage/subAgents.d.ts +15 -15
  20. package/dist/data-access/manage/tools.d.ts +27 -27
  21. package/dist/data-access/manage/triggers.d.ts +3 -3
  22. package/dist/data-access/manage/webhookDestinations.d.ts +15 -3
  23. package/dist/data-access/manage/webhookDestinations.js +26 -8
  24. package/dist/data-access/runtime/apiKeys.d.ts +20 -20
  25. package/dist/data-access/runtime/apps.d.ts +14 -14
  26. package/dist/data-access/runtime/conversations.d.ts +28 -28
  27. package/dist/data-access/runtime/events.d.ts +4 -4
  28. package/dist/data-access/runtime/feedback.d.ts +6 -6
  29. package/dist/data-access/runtime/messages.d.ts +27 -27
  30. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +35 -3
  31. package/dist/data-access/runtime/scheduledTriggerInvocations.js +16 -3
  32. package/dist/data-access/runtime/scheduledTriggerUsers.d.ts +2 -2
  33. package/dist/data-access/runtime/scheduledTriggers.d.ts +28 -6
  34. package/dist/data-access/runtime/scheduledTriggers.js +34 -7
  35. package/dist/data-access/runtime/tasks.d.ts +4 -4
  36. package/dist/db/manage/manage-schema.d.ts +783 -482
  37. package/dist/db/manage/manage-schema.js +120 -2
  38. package/dist/db/runtime/runtime-schema.d.ts +460 -441
  39. package/dist/db/runtime/runtime-schema.js +3 -1
  40. package/dist/evaluation/pass-criteria-evaluator.js +69 -29
  41. package/dist/index.d.ts +9 -9
  42. package/dist/index.js +8 -8
  43. package/dist/types/entities.d.ts +5 -2
  44. package/dist/types/index.d.ts +3 -3
  45. package/dist/types/index.js +2 -2
  46. package/dist/types/utility.d.ts +13 -5
  47. package/dist/types/utility.js +2 -1
  48. package/dist/validation/index.d.ts +2 -2
  49. package/dist/validation/index.js +2 -2
  50. package/dist/validation/schemas/skills.d.ts +40 -40
  51. package/dist/validation/schemas.d.ts +2347 -2003
  52. package/dist/validation/schemas.js +64 -10
  53. package/drizzle/manage/0022_last_nemesis.sql +15 -0
  54. package/drizzle/manage/0023_flimsy_patriot.sql +13 -0
  55. package/drizzle/manage/meta/0022_snapshot.json +4216 -0
  56. package/drizzle/manage/meta/0023_snapshot.json +4317 -0
  57. package/drizzle/manage/meta/_journal.json +14 -0
  58. package/drizzle/runtime/0043_normal_beyonder.sql +2 -0
  59. package/drizzle/runtime/meta/0043_snapshot.json +6304 -0
  60. package/drizzle/runtime/meta/_journal.json +7 -0
  61. package/package.json +1 -1
@@ -9,48 +9,48 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
9
9
  id: string;
10
10
  }) => Promise<{
11
11
  id: string;
12
- name: string | null;
12
+ tenantId: string;
13
13
  createdAt: string;
14
+ name: string | null;
15
+ agentId: string;
16
+ projectId: string;
14
17
  updatedAt: string;
15
18
  expiresAt: string | null;
16
- tenantId: string;
17
- projectId: string;
18
- agentId: string;
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
- name: string | null;
26
+ tenantId: string;
27
27
  createdAt: string;
28
+ name: string | null;
29
+ agentId: string;
30
+ projectId: string;
28
31
  updatedAt: string;
29
32
  expiresAt: string | null;
30
- tenantId: string;
31
- projectId: string;
32
- agentId: string;
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;
40
40
  agentId?: string;
41
41
  }) => Promise<{
42
42
  id: string;
43
- name: string | null;
43
+ tenantId: string;
44
44
  createdAt: string;
45
+ name: string | null;
46
+ agentId: string;
47
+ projectId: string;
45
48
  updatedAt: string;
46
49
  expiresAt: string | null;
47
- tenantId: string;
48
- projectId: string;
49
- agentId: string;
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;
@@ -67,17 +67,17 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
67
67
  }>;
68
68
  declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
69
69
  id: string;
70
- name: string | null;
70
+ tenantId: string;
71
71
  createdAt: string;
72
+ name: string | null;
73
+ agentId: string;
74
+ projectId: string;
72
75
  updatedAt: string;
73
76
  expiresAt: string | null;
74
- tenantId: string;
75
- projectId: string;
76
- agentId: string;
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;
@@ -7,14 +7,13 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
7
7
  declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
8
8
  type: AppType;
9
9
  id: string;
10
- name: string;
10
+ tenantId: string | null;
11
11
  createdAt: string;
12
- updatedAt: string;
12
+ name: string;
13
13
  description: string | null;
14
- tenantId: string | null;
15
- enabled: boolean;
16
- prompt: string | null;
17
14
  projectId: string | null;
15
+ updatedAt: string;
16
+ enabled: boolean;
18
17
  config: {
19
18
  type: "web_client";
20
19
  webClient: {
@@ -45,9 +44,10 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
45
44
  }[] | undefined;
46
45
  };
47
46
  };
48
- lastUsedAt: string | null;
49
- defaultProjectId: string | null;
47
+ prompt: string | null;
50
48
  defaultAgentId: string | null;
49
+ defaultProjectId: string | null;
50
+ lastUsedAt: string | null;
51
51
  } | undefined>;
52
52
  declare const updateAppLastUsed: (db: AgentsRunDatabaseClient) => (id: string) => Promise<void>;
53
53
  declare const getAppByIdForTenant: (db: AgentsRunDatabaseClient) => (params: {
@@ -76,14 +76,13 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
76
76
  declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
77
77
  type: AppType;
78
78
  id: string;
79
- name: string;
79
+ tenantId: string | null;
80
80
  createdAt: string;
81
- updatedAt: string;
81
+ name: string;
82
82
  description: string | null;
83
- tenantId: string | null;
84
- enabled: boolean;
85
- prompt: string | null;
86
83
  projectId: string | null;
84
+ updatedAt: string;
85
+ enabled: boolean;
87
86
  config: {
88
87
  type: "web_client";
89
88
  webClient: {
@@ -114,9 +113,10 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
114
113
  }[] | undefined;
115
114
  };
116
115
  };
117
- lastUsedAt: string | null;
118
- defaultProjectId: string | null;
116
+ prompt: string | null;
119
117
  defaultAgentId: string | null;
118
+ defaultProjectId: string | null;
119
+ lastUsedAt: string | null;
120
120
  }>;
121
121
  declare const updateAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
122
122
  scopes: TenantScopeConfig;
@@ -17,20 +17,20 @@ 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;
20
21
  createdAt: string;
21
- updatedAt: string;
22
+ metadata: ConversationMetadata | null;
23
+ title: string | null;
24
+ properties: Record<string, unknown> | null;
22
25
  ref: {
23
26
  type: "commit" | "tag" | "branch";
24
27
  name: string;
25
28
  hash: string;
26
29
  } | null;
27
- userId: string | null;
28
- metadata: ConversationMetadata | null;
29
- properties: Record<string, unknown> | null;
30
- title: string | null;
31
- tenantId: string;
32
- projectId: string;
33
30
  agentId: string | null;
31
+ projectId: string;
32
+ updatedAt: string;
33
+ userId: string | null;
34
34
  activeSubAgentId: string;
35
35
  lastContextResolution: string | null;
36
36
  userProperties: Record<string, unknown> | null;
@@ -92,20 +92,20 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
92
92
  conversationId: string;
93
93
  }) => Promise<{
94
94
  id: string;
95
+ tenantId: string;
95
96
  createdAt: string;
96
- updatedAt: string;
97
+ metadata: ConversationMetadata | null;
98
+ title: string | null;
99
+ properties: Record<string, unknown> | null;
97
100
  ref: {
98
101
  type: "commit" | "tag" | "branch";
99
102
  name: string;
100
103
  hash: string;
101
104
  } | null;
102
- userId: string | null;
103
- metadata: ConversationMetadata | null;
104
- properties: Record<string, unknown> | null;
105
- title: string | null;
106
- tenantId: string;
107
- projectId: string;
108
105
  agentId: string | null;
106
+ projectId: string;
107
+ updatedAt: string;
108
+ userId: string | null;
109
109
  activeSubAgentId: string;
110
110
  lastContextResolution: string | null;
111
111
  userProperties: Record<string, unknown> | null;
@@ -147,20 +147,20 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
147
147
  properties?: Record<string, unknown> | null | undefined;
148
148
  } | {
149
149
  id: string;
150
+ tenantId: string;
150
151
  createdAt: string;
151
- updatedAt: string;
152
+ metadata: ConversationMetadata | null;
153
+ title: string | null;
154
+ properties: Record<string, unknown> | null;
152
155
  ref: {
153
156
  type: "commit" | "tag" | "branch";
154
157
  name: string;
155
158
  hash: string;
156
159
  } | null;
157
- userId: string | null;
158
- metadata: ConversationMetadata | null;
159
- properties: Record<string, unknown> | null;
160
- title: string | null;
161
- tenantId: string;
162
- projectId: string;
163
160
  agentId: string | null;
161
+ projectId: string;
162
+ updatedAt: string;
163
+ userId: string | null;
164
164
  activeSubAgentId: string;
165
165
  lastContextResolution: string | null;
166
166
  userProperties: Record<string, unknown> | null;
@@ -185,20 +185,20 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
185
185
  conversationId: string;
186
186
  }) => Promise<{
187
187
  id: string;
188
+ tenantId: string;
188
189
  createdAt: string;
189
- updatedAt: string;
190
+ metadata: ConversationMetadata | null;
191
+ title: string | null;
192
+ properties: Record<string, unknown> | null;
190
193
  ref: {
191
194
  type: "commit" | "tag" | "branch";
192
195
  name: string;
193
196
  hash: string;
194
197
  } | null;
195
- userId: string | null;
196
- metadata: ConversationMetadata | null;
197
- properties: Record<string, unknown> | null;
198
- title: string | null;
199
- tenantId: string;
200
- projectId: string;
201
198
  agentId: string | null;
199
+ projectId: string;
200
+ updatedAt: string;
201
+ userId: string | null;
202
202
  activeSubAgentId: string;
203
203
  lastContextResolution: string | null;
204
204
  userProperties: Record<string, unknown> | null;
@@ -9,15 +9,15 @@ declare const createEvent: (db: AgentsRunDatabaseClient) => (params: EventInsert
9
9
  row: {
10
10
  type: string;
11
11
  id: string;
12
+ tenantId: string;
12
13
  createdAt: string;
13
- updatedAt: string;
14
14
  metadata: Record<string, unknown> | null;
15
15
  properties: Record<string, unknown> | null;
16
- tenantId: string;
17
- projectId: string;
18
16
  agentId: string | null;
19
- userProperties: Record<string, unknown> | null;
17
+ projectId: string;
18
+ updatedAt: string;
20
19
  conversationId: string | null;
20
+ userProperties: Record<string, unknown> | null;
21
21
  messageId: string | null;
22
22
  serverMetadata: {
23
23
  [k: string]: unknown;
@@ -72,13 +72,13 @@ declare const getFeedbackByIds: (db: AgentsRunDatabaseClient) => (params: {
72
72
  declare const createFeedback: (db: AgentsRunDatabaseClient) => (params: FeedbackInsert) => Promise<{
73
73
  type: "positive" | "negative";
74
74
  id: string;
75
- createdAt: string;
76
- updatedAt: string;
77
75
  tenantId: string;
76
+ createdAt: string;
78
77
  projectId: string;
79
- details: string | null;
78
+ updatedAt: string;
80
79
  conversationId: string;
81
80
  messageId: string | null;
81
+ details: string | null;
82
82
  }>;
83
83
  declare const createFeedbackBulk: (db: AgentsRunDatabaseClient) => (items: FeedbackInsert[]) => Promise<(typeof feedback.$inferSelect)[]>;
84
84
  declare const updateFeedback: (db: AgentsRunDatabaseClient) => (params: {
@@ -102,13 +102,13 @@ declare const deleteFeedback: (db: AgentsRunDatabaseClient) => (params: {
102
102
  }) => Promise<{
103
103
  type: "positive" | "negative";
104
104
  id: string;
105
- createdAt: string;
106
- updatedAt: string;
107
105
  tenantId: string;
106
+ createdAt: string;
108
107
  projectId: string;
109
- details: string | null;
108
+ updatedAt: string;
110
109
  conversationId: string;
111
110
  messageId: string | null;
111
+ details: string | null;
112
112
  }>;
113
113
  //#endregion
114
114
  export { createFeedback, createFeedbackBulk, deleteFeedback, getFeedbackById, getFeedbackByIds, listFeedback, listFeedbackByConversation, updateFeedback };
@@ -11,27 +11,27 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
11
11
  messageId: string;
12
12
  }) => Promise<{
13
13
  id: string;
14
+ tenantId: string;
14
15
  createdAt: string;
15
- updatedAt: string;
16
16
  metadata: MessageMetadata | null;
17
- role: string;
18
17
  properties: Record<string, unknown> | null;
19
- tenantId: string;
20
- projectId: string;
21
18
  content: MessageContent;
19
+ projectId: string;
20
+ updatedAt: string;
21
+ conversationId: string;
22
+ userProperties: Record<string, unknown> | null;
23
+ role: string;
22
24
  fromSubAgentId: string | null;
23
25
  toSubAgentId: string | null;
24
26
  fromExternalAgentId: string | null;
25
27
  toExternalAgentId: string | null;
26
- taskId: string | null;
27
- a2aTaskId: string | null;
28
- visibility: string;
29
- userProperties: Record<string, unknown> | null;
30
- conversationId: string;
31
28
  fromTeamAgentId: string | null;
32
29
  toTeamAgentId: string | null;
30
+ visibility: string;
33
31
  messageType: string;
32
+ taskId: string | null;
34
33
  parentMessageId: string | null;
34
+ a2aTaskId: string | null;
35
35
  a2aSessionId: string | null;
36
36
  } | undefined>;
37
37
  declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
@@ -184,27 +184,27 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
184
184
  data: Omit<MessageInsert, "tenantId" | "projectId">;
185
185
  }) => Promise<{
186
186
  id: string;
187
+ tenantId: string;
187
188
  createdAt: string;
188
- updatedAt: string;
189
189
  metadata: MessageMetadata | null;
190
- role: string;
191
190
  properties: Record<string, unknown> | null;
192
- tenantId: string;
193
- projectId: string;
194
191
  content: MessageContent;
192
+ projectId: string;
193
+ updatedAt: string;
194
+ conversationId: string;
195
+ userProperties: Record<string, unknown> | null;
196
+ role: string;
195
197
  fromSubAgentId: string | null;
196
198
  toSubAgentId: string | null;
197
199
  fromExternalAgentId: string | null;
198
200
  toExternalAgentId: string | null;
199
- taskId: string | null;
200
- a2aTaskId: string | null;
201
- visibility: string;
202
- userProperties: Record<string, unknown> | null;
203
- conversationId: string;
204
201
  fromTeamAgentId: string | null;
205
202
  toTeamAgentId: string | null;
203
+ visibility: string;
206
204
  messageType: string;
205
+ taskId: string | null;
207
206
  parentMessageId: string | null;
207
+ a2aTaskId: string | null;
208
208
  a2aSessionId: string | null;
209
209
  }>;
210
210
  declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
@@ -241,27 +241,27 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
241
241
  messageId: string;
242
242
  }) => Promise<{
243
243
  id: string;
244
+ tenantId: string;
244
245
  createdAt: string;
245
- updatedAt: string;
246
246
  metadata: MessageMetadata | null;
247
- role: string;
248
247
  properties: Record<string, unknown> | null;
249
- tenantId: string;
250
- projectId: string;
251
248
  content: MessageContent;
249
+ projectId: string;
250
+ updatedAt: string;
251
+ conversationId: string;
252
+ userProperties: Record<string, unknown> | null;
253
+ role: string;
252
254
  fromSubAgentId: string | null;
253
255
  toSubAgentId: string | null;
254
256
  fromExternalAgentId: string | null;
255
257
  toExternalAgentId: string | null;
256
- taskId: string | null;
257
- a2aTaskId: string | null;
258
- visibility: string;
259
- userProperties: Record<string, unknown> | null;
260
- conversationId: string;
261
258
  fromTeamAgentId: string | null;
262
259
  toTeamAgentId: string | null;
260
+ visibility: string;
263
261
  messageType: string;
262
+ taskId: string | null;
264
263
  parentMessageId: string | null;
264
+ a2aTaskId: string | null;
265
265
  a2aSessionId: string | null;
266
266
  }>;
267
267
  declare const countMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: {
@@ -150,7 +150,7 @@ declare const markScheduledTriggerInvocationCancelled: (db: AgentsRunDatabaseCli
150
150
  * Used when a trigger is deleted
151
151
  */
152
152
  declare const cancelPendingInvocationsForTrigger: (db: AgentsRunDatabaseClient) => (params: {
153
- scopes: AgentScopeConfig;
153
+ scopes: ProjectScopeConfig;
154
154
  scheduledTriggerId: string;
155
155
  }) => Promise<number>;
156
156
  /**
@@ -158,7 +158,7 @@ declare const cancelPendingInvocationsForTrigger: (db: AgentsRunDatabaseClient)
158
158
  * Used when a trigger is disabled - keeps future invocations pending
159
159
  */
160
160
  declare const cancelPastPendingInvocationsForTrigger: (db: AgentsRunDatabaseClient) => (params: {
161
- scopes: AgentScopeConfig;
161
+ scopes: ProjectScopeConfig;
162
162
  scheduledTriggerId: string;
163
163
  }) => Promise<number>;
164
164
  type ScheduledTriggerRunInfo = {
@@ -307,5 +307,37 @@ declare const listScheduledTriggerInvocationsByTriggerId: (db: AgentsRunDatabase
307
307
  tenantId: string;
308
308
  id: string;
309
309
  }[]>;
310
+ declare const listScheduledTriggerInvocationsByDatasetRunId: (db: AgentsRunDatabaseClient) => (params: {
311
+ scopes: ProjectScopeConfig;
312
+ datasetRunId: string;
313
+ filters?: {
314
+ status?: string;
315
+ };
316
+ }) => Promise<{
317
+ scheduledTriggerId: string;
318
+ ref: {
319
+ type: "commit" | "tag" | "branch";
320
+ name: string;
321
+ hash: string;
322
+ } | null;
323
+ status: "pending" | "running" | "completed" | "failed" | "cancelled";
324
+ scheduledFor: string;
325
+ startedAt: string | null;
326
+ completedAt: string | null;
327
+ resolvedPayload: Record<string, unknown> | null;
328
+ conversationIds: string[] | null;
329
+ attemptNumber: number;
330
+ idempotencyKey: string;
331
+ runAsUserId: string | null;
332
+ createdAt: string;
333
+ agentId: string;
334
+ projectId: string;
335
+ tenantId: string;
336
+ id: string;
337
+ }[]>;
338
+ declare const getLastRunAtForTrigger: (db: AgentsRunDatabaseClient) => (params: {
339
+ scopes: ProjectScopeConfig;
340
+ scheduledTriggerId: string;
341
+ }) => Promise<string | null>;
310
342
  //#endregion
311
- export { ScheduledTriggerRunInfo, addConversationIdToInvocation, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, createScheduledTriggerInvocation, deletePendingInvocationsForTrigger, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerInvocationStatusSummary, getScheduledTriggerRunInfoBatch, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listScheduledTriggerInvocationsByTriggerId, listScheduledTriggerInvocationsPaginated, listUpcomingInvocationsForAgentPaginated, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, resetCancelledInvocationToPending, updateScheduledTriggerInvocationStatus };
343
+ export { ScheduledTriggerRunInfo, addConversationIdToInvocation, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, createScheduledTriggerInvocation, deletePendingInvocationsForTrigger, getLastRunAtForTrigger, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerInvocationStatusSummary, getScheduledTriggerRunInfoBatch, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listScheduledTriggerInvocationsByDatasetRunId, listScheduledTriggerInvocationsByTriggerId, listScheduledTriggerInvocationsPaginated, listUpcomingInvocationsForAgentPaginated, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, resetCancelledInvocationToPending, updateScheduledTriggerInvocationStatus };
@@ -133,7 +133,7 @@ const cancelPendingInvocationsForTrigger = (db) => async (params) => {
133
133
  return (await db.update(scheduledTriggerInvocations).set({
134
134
  status: "cancelled",
135
135
  completedAt: (/* @__PURE__ */ new Date()).toISOString()
136
- }).where(and(agentScopedWhere(scheduledTriggerInvocations, params.scopes), eq(scheduledTriggerInvocations.scheduledTriggerId, params.scheduledTriggerId), inArray(scheduledTriggerInvocations.status, ["pending", "running"]))).returning()).length;
136
+ }).where(and(projectScopedWhere(scheduledTriggerInvocations, params.scopes), eq(scheduledTriggerInvocations.scheduledTriggerId, params.scheduledTriggerId), inArray(scheduledTriggerInvocations.status, ["pending", "running"]))).returning()).length;
137
137
  };
138
138
  /**
139
139
  * Cancel only PAST pending invocations for a trigger (scheduledFor <= now)
@@ -144,7 +144,7 @@ const cancelPastPendingInvocationsForTrigger = (db) => async (params) => {
144
144
  return (await db.update(scheduledTriggerInvocations).set({
145
145
  status: "cancelled",
146
146
  completedAt: now
147
- }).where(and(agentScopedWhere(scheduledTriggerInvocations, params.scopes), eq(scheduledTriggerInvocations.scheduledTriggerId, params.scheduledTriggerId), inArray(scheduledTriggerInvocations.status, ["pending", "running"]), lte(scheduledTriggerInvocations.scheduledFor, now))).returning()).length;
147
+ }).where(and(projectScopedWhere(scheduledTriggerInvocations, params.scopes), eq(scheduledTriggerInvocations.scheduledTriggerId, params.scheduledTriggerId), inArray(scheduledTriggerInvocations.status, ["pending", "running"]), lte(scheduledTriggerInvocations.scheduledFor, now))).returning()).length;
148
148
  };
149
149
  /**
150
150
  * Get run info for multiple scheduled triggers in a single query.
@@ -314,6 +314,19 @@ const listScheduledTriggerInvocationsByTriggerId = (db) => async (params) => {
314
314
  if (params.filters?.status) conditions.push(eq(scheduledTriggerInvocations.status, params.filters.status));
315
315
  return await db.select().from(scheduledTriggerInvocations).where(and(...conditions)).orderBy(asc(scheduledTriggerInvocations.createdAt));
316
316
  };
317
+ const listScheduledTriggerInvocationsByDatasetRunId = (db) => async (params) => {
318
+ const conditions = [
319
+ eq(scheduledTriggerInvocations.tenantId, params.scopes.tenantId),
320
+ eq(scheduledTriggerInvocations.projectId, params.scopes.projectId),
321
+ sql`${scheduledTriggerInvocations.resolvedPayload}->>'datasetRunId' = ${params.datasetRunId}`
322
+ ];
323
+ if (params.filters?.status) conditions.push(eq(scheduledTriggerInvocations.status, params.filters.status));
324
+ return await db.select().from(scheduledTriggerInvocations).where(and(...conditions)).orderBy(asc(scheduledTriggerInvocations.createdAt));
325
+ };
326
+ const getLastRunAtForTrigger = (db) => async (params) => {
327
+ const [row] = await db.select({ completedAt: scheduledTriggerInvocations.completedAt }).from(scheduledTriggerInvocations).where(and(eq(scheduledTriggerInvocations.tenantId, params.scopes.tenantId), eq(scheduledTriggerInvocations.projectId, params.scopes.projectId), eq(scheduledTriggerInvocations.scheduledTriggerId, params.scheduledTriggerId), inArray(scheduledTriggerInvocations.status, ["completed", "failed"]))).orderBy(desc(scheduledTriggerInvocations.completedAt)).limit(1);
328
+ return row?.completedAt ?? null;
329
+ };
317
330
 
318
331
  //#endregion
319
- export { addConversationIdToInvocation, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, createScheduledTriggerInvocation, deletePendingInvocationsForTrigger, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerInvocationStatusSummary, getScheduledTriggerRunInfoBatch, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listScheduledTriggerInvocationsByTriggerId, listScheduledTriggerInvocationsPaginated, listUpcomingInvocationsForAgentPaginated, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, resetCancelledInvocationToPending, updateScheduledTriggerInvocationStatus };
332
+ export { addConversationIdToInvocation, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, createScheduledTriggerInvocation, deletePendingInvocationsForTrigger, getLastRunAtForTrigger, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerInvocationStatusSummary, getScheduledTriggerRunInfoBatch, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listScheduledTriggerInvocationsByDatasetRunId, listScheduledTriggerInvocationsByTriggerId, listScheduledTriggerInvocationsPaginated, listUpcomingInvocationsForAgentPaginated, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, resetCancelledInvocationToPending, updateScheduledTriggerInvocationStatus };
@@ -15,10 +15,10 @@ declare const createScheduledTriggerUser: (db: AgentsRunDatabaseClient) => (para
15
15
  scheduledTriggerId: string;
16
16
  userId: string;
17
17
  }) => Promise<{
18
- createdAt: string;
19
- userId: string;
20
18
  tenantId: string;
19
+ createdAt: string;
21
20
  scheduledTriggerId: string;
21
+ userId: string;
22
22
  }>;
23
23
  declare const deleteScheduledTriggerUser: (db: AgentsRunDatabaseClient) => (params: {
24
24
  tenantId: string;
@@ -5,7 +5,11 @@ import { ScheduledTrigger, ScheduledTriggerInsert } from "../../types/entities.j
5
5
 
6
6
  //#region src/data-access/runtime/scheduledTriggers.d.ts
7
7
  declare const getScheduledTriggerById: (db: AgentsRunDatabaseClient) => (params: {
8
- scopes: AgentScopeConfig;
8
+ scopes: {
9
+ tenantId: string;
10
+ projectId: string;
11
+ agentId?: string;
12
+ };
9
13
  scheduledTriggerId: string;
10
14
  }) => Promise<ScheduledTrigger | undefined>;
11
15
  declare const listScheduledTriggersPaginated: (db: AgentsRunDatabaseClient) => (params: {
@@ -15,6 +19,7 @@ declare const listScheduledTriggersPaginated: (db: AgentsRunDatabaseClient) => (
15
19
  data: {
16
20
  createdAt: string;
17
21
  updatedAt: string;
22
+ agentId: string | null;
18
23
  name: string;
19
24
  description: string | null;
20
25
  enabled: boolean;
@@ -31,7 +36,7 @@ declare const listScheduledTriggersPaginated: (db: AgentsRunDatabaseClient) => (
31
36
  nextRunAt: string | null;
32
37
  ref: string;
33
38
  dispatchDelayMs: number | null;
34
- agentId: string;
39
+ datasetRunConfigId: string | null;
35
40
  projectId: string;
36
41
  tenantId: string;
37
42
  id: string;
@@ -47,14 +52,22 @@ declare const createScheduledTrigger: (db: AgentsRunDatabaseClient) => (params:
47
52
  nextRunAt?: string | null;
48
53
  }) => Promise<ScheduledTrigger>;
49
54
  declare const updateScheduledTrigger: (db: AgentsRunDatabaseClient) => (params: {
50
- scopes: AgentScopeConfig;
55
+ scopes: {
56
+ tenantId: string;
57
+ projectId: string;
58
+ agentId?: string;
59
+ };
51
60
  scheduledTriggerId: string;
52
61
  data: Partial<ScheduledTriggerInsert> & {
53
62
  nextRunAt?: string | null;
54
63
  };
55
64
  }) => Promise<ScheduledTrigger>;
56
65
  declare const deleteScheduledTrigger: (db: AgentsRunDatabaseClient) => (params: {
57
- scopes: AgentScopeConfig;
66
+ scopes: {
67
+ tenantId: string;
68
+ projectId: string;
69
+ agentId?: string;
70
+ };
58
71
  scheduledTriggerId: string;
59
72
  }) => Promise<void>;
60
73
  declare const upsertScheduledTrigger: (db: AgentsRunDatabaseClient) => (params: {
@@ -81,10 +94,19 @@ declare const findDueScheduledTriggersAcrossProjects: (db: AgentsRunDatabaseClie
81
94
  * No withRef scope needed - direct update.
82
95
  */
83
96
  declare const advanceScheduledTriggerNextRunAt: (db: AgentsRunDatabaseClient) => (params: {
84
- scopes: AgentScopeConfig;
97
+ scopes: {
98
+ tenantId: string;
99
+ projectId: string;
100
+ agentId?: string;
101
+ };
85
102
  scheduledTriggerId: string;
86
103
  nextRunAt: string | null;
87
104
  enabled?: boolean;
88
105
  }) => Promise<void>;
106
+ declare const findScheduledTriggerByDatasetRunConfigId: (db: AgentsRunDatabaseClient) => (params: {
107
+ tenantId: string;
108
+ projectId: string;
109
+ datasetRunConfigId: string;
110
+ }) => Promise<ScheduledTrigger | undefined>;
89
111
  //#endregion
90
- export { advanceScheduledTriggerNextRunAt, createScheduledTrigger, deleteScheduledTrigger, deleteScheduledTriggersByRunAsUserId, findDueScheduledTriggersAcrossProjects, getScheduledTriggerById, listScheduledTriggers, listScheduledTriggersPaginated, updateScheduledTrigger, upsertScheduledTrigger };
112
+ export { advanceScheduledTriggerNextRunAt, createScheduledTrigger, deleteScheduledTrigger, deleteScheduledTriggersByRunAsUserId, findDueScheduledTriggersAcrossProjects, findScheduledTriggerByDatasetRunConfigId, getScheduledTriggerById, listScheduledTriggers, listScheduledTriggersPaginated, updateScheduledTrigger, upsertScheduledTrigger };