@inkeep/agents-core 0.0.0-dev-20260120175022 → 0.0.0-dev-20260120193424
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 +82 -82
- package/dist/auth/auth-validation-schemas.d.ts +129 -129
- package/dist/auth/auth.d.ts +53 -53
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/client-exports.d.ts +6 -2
- package/dist/client-exports.js +2 -2
- package/dist/constants/otel-attributes.d.ts +3 -0
- package/dist/constants/otel-attributes.js +3 -0
- package/dist/data-access/index.d.ts +3 -1
- package/dist/data-access/index.js +3 -1
- package/dist/data-access/manage/agentFull.js +114 -0
- package/dist/data-access/manage/agents.d.ts +16 -16
- package/dist/data-access/manage/agents.js +27 -0
- package/dist/data-access/manage/artifactComponents.d.ts +10 -10
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/dataComponents.d.ts +6 -6
- package/dist/data-access/manage/functionTools.d.ts +12 -12
- package/dist/data-access/manage/projectFull.d.ts +4 -0
- package/dist/data-access/manage/projectFull.js +31 -8
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgentRelations.d.ts +24 -24
- 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 +27 -27
- package/dist/data-access/manage/triggers.d.ts +84 -0
- package/dist/data-access/manage/triggers.js +95 -0
- package/dist/data-access/runtime/apiKeys.d.ts +20 -20
- package/dist/data-access/runtime/conversations.d.ts +16 -16
- package/dist/data-access/runtime/evalRuns.d.ts +2 -2
- package/dist/data-access/runtime/evalRuns.js +11 -1
- package/dist/data-access/runtime/messages.d.ts +12 -12
- package/dist/data-access/runtime/tasks.d.ts +5 -5
- package/dist/data-access/runtime/triggerInvocations.d.ts +62 -0
- package/dist/data-access/runtime/triggerInvocations.js +54 -0
- package/dist/db/manage/manage-schema.d.ts +269 -4
- package/dist/db/manage/manage-schema.js +31 -2
- package/dist/db/runtime/runtime-schema.d.ts +364 -149
- package/dist/db/runtime/runtime-schema.js +33 -3
- package/dist/dolt/branch.d.ts +55 -1
- package/dist/dolt/branch.js +85 -1
- package/dist/dolt/index.d.ts +2 -2
- package/dist/dolt/index.js +2 -2
- package/dist/index.d.ts +10 -6
- package/dist/index.js +10 -6
- package/dist/types/entities.d.ts +14 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/template-interpolation.d.ts +22 -0
- package/dist/utils/template-interpolation.js +62 -0
- package/dist/utils/trigger-auth.d.ts +32 -0
- package/dist/utils/trigger-auth.js +130 -0
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/dist/validation/schemas.d.ts +3465 -1227
- package/dist/validation/schemas.js +87 -4
- package/drizzle/manage/0001_broken_wendell_vaughn.sql +19 -0
- package/drizzle/manage/meta/0001_snapshot.json +3115 -0
- package/drizzle/manage/meta/_journal.json +7 -0
- package/drizzle/runtime/0009_freezing_leo.sql +17 -0
- package/drizzle/runtime/meta/0009_snapshot.json +2397 -0
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +1 -1
|
@@ -15,15 +15,15 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
15
15
|
total: number;
|
|
16
16
|
}>;
|
|
17
17
|
declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
18
|
+
tenantId: string;
|
|
19
|
+
projectId: string;
|
|
18
20
|
id: string;
|
|
21
|
+
title: string | null;
|
|
22
|
+
agentId: string | null;
|
|
19
23
|
createdAt: string;
|
|
20
24
|
updatedAt: string;
|
|
21
|
-
projectId: string;
|
|
22
|
-
tenantId: string;
|
|
23
|
-
title: string | null;
|
|
24
25
|
userId: string | null;
|
|
25
26
|
metadata: ConversationMetadata | null;
|
|
26
|
-
agentId: string | null;
|
|
27
27
|
ref: {
|
|
28
28
|
type: "tag" | "commit" | "branch";
|
|
29
29
|
name: string;
|
|
@@ -84,15 +84,15 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
84
84
|
scopes: ProjectScopeConfig;
|
|
85
85
|
conversationId: string;
|
|
86
86
|
}) => Promise<{
|
|
87
|
+
tenantId: string;
|
|
88
|
+
projectId: string;
|
|
87
89
|
id: string;
|
|
90
|
+
title: string | null;
|
|
91
|
+
agentId: string | null;
|
|
88
92
|
createdAt: string;
|
|
89
93
|
updatedAt: string;
|
|
90
|
-
projectId: string;
|
|
91
|
-
tenantId: string;
|
|
92
|
-
title: string | null;
|
|
93
94
|
userId: string | null;
|
|
94
95
|
metadata: ConversationMetadata | null;
|
|
95
|
-
agentId: string | null;
|
|
96
96
|
ref: {
|
|
97
97
|
type: "tag" | "commit" | "branch";
|
|
98
98
|
name: string;
|
|
@@ -120,15 +120,15 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
120
120
|
metadata?: ConversationMetadata | null | undefined;
|
|
121
121
|
contextConfigId?: string | undefined;
|
|
122
122
|
} | {
|
|
123
|
+
tenantId: string;
|
|
124
|
+
projectId: string;
|
|
123
125
|
id: string;
|
|
126
|
+
title: string | null;
|
|
127
|
+
agentId: string | null;
|
|
124
128
|
createdAt: string;
|
|
125
129
|
updatedAt: string;
|
|
126
|
-
projectId: string;
|
|
127
|
-
tenantId: string;
|
|
128
|
-
title: string | null;
|
|
129
130
|
userId: string | null;
|
|
130
131
|
metadata: ConversationMetadata | null;
|
|
131
|
-
agentId: string | null;
|
|
132
132
|
ref: {
|
|
133
133
|
type: "tag" | "commit" | "branch";
|
|
134
134
|
name: string;
|
|
@@ -152,15 +152,15 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
152
152
|
scopes: ProjectScopeConfig;
|
|
153
153
|
conversationId: string;
|
|
154
154
|
}) => Promise<{
|
|
155
|
+
tenantId: string;
|
|
156
|
+
projectId: string;
|
|
155
157
|
id: string;
|
|
158
|
+
title: string | null;
|
|
159
|
+
agentId: string | null;
|
|
156
160
|
createdAt: string;
|
|
157
161
|
updatedAt: string;
|
|
158
|
-
projectId: string;
|
|
159
|
-
tenantId: string;
|
|
160
|
-
title: string | null;
|
|
161
162
|
userId: string | null;
|
|
162
163
|
metadata: ConversationMetadata | null;
|
|
163
|
-
agentId: string | null;
|
|
164
164
|
ref: {
|
|
165
165
|
type: "tag" | "commit" | "branch";
|
|
166
166
|
name: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EvaluationJobFilterCriteria, ProjectScopeConfig } from "../../types/utility.js";
|
|
1
|
+
import { EvaluationJobFilterCriteria, Filter, ProjectScopeConfig } from "../../types/utility.js";
|
|
2
2
|
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
3
3
|
import { ConversationSelect, DatasetRunConversationRelationInsert, DatasetRunConversationRelationSelect, DatasetRunInsert, DatasetRunSelect, EvaluationResultInsert, EvaluationResultSelect, EvaluationResultUpdate, EvaluationRunInsert, EvaluationRunSelect, EvaluationRunUpdate } from "../../types/entities.js";
|
|
4
4
|
|
|
@@ -114,7 +114,7 @@ declare const deleteEvaluationResultsByRun: (db: AgentsRunDatabaseClient) => (pa
|
|
|
114
114
|
*/
|
|
115
115
|
declare const filterConversationsForJob: (db: AgentsRunDatabaseClient) => (params: {
|
|
116
116
|
scopes: ProjectScopeConfig;
|
|
117
|
-
jobFilters: EvaluationJobFilterCriteria | null | undefined;
|
|
117
|
+
jobFilters: Filter<EvaluationJobFilterCriteria> | null | undefined;
|
|
118
118
|
}) => Promise<ConversationSelect[]>;
|
|
119
119
|
//#endregion
|
|
120
120
|
export { createDatasetRun, createDatasetRunConversationRelation, createDatasetRunConversationRelations, createEvaluationResult, createEvaluationResults, createEvaluationRun, deleteDatasetRun, deleteDatasetRunConversationRelation, deleteDatasetRunConversationRelationsByRun, deleteEvaluationResult, deleteEvaluationResultsByRun, deleteEvaluationRun, filterConversationsForJob, getDatasetRunById, getDatasetRunConversationRelationByConversation, getDatasetRunConversationRelations, getEvaluationResultById, getEvaluationRunById, getEvaluationRunByJobConfigId, listDatasetRuns, listDatasetRunsByConfig, listEvaluationResults, listEvaluationResultsByConversation, listEvaluationResultsByRun, listEvaluationRuns, listEvaluationRunsByJobConfigId, updateEvaluationResult, updateEvaluationRun };
|
|
@@ -126,10 +126,20 @@ const deleteEvaluationResultsByRun = (db) => async (params) => {
|
|
|
126
126
|
return (await db.delete(evaluationResult).where(and(eq(evaluationResult.tenantId, params.scopes.tenantId), eq(evaluationResult.projectId, params.scopes.projectId), eq(evaluationResult.evaluationRunId, params.scopes.evaluationRunId))).returning()).length;
|
|
127
127
|
};
|
|
128
128
|
/**
|
|
129
|
+
* Helper to extract plain filter criteria from a Filter wrapper.
|
|
130
|
+
* Currently only handles plain objects - and/or combinators are not yet supported.
|
|
131
|
+
*/
|
|
132
|
+
function extractPlainFilterCriteria(filter) {
|
|
133
|
+
if (!filter) return null;
|
|
134
|
+
if ("and" in filter || "or" in filter) return null;
|
|
135
|
+
return filter;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
129
138
|
* Filter conversations based on evaluation job filter criteria
|
|
130
139
|
*/
|
|
131
140
|
const filterConversationsForJob = (db) => async (params) => {
|
|
132
|
-
const { scopes, jobFilters } = params;
|
|
141
|
+
const { scopes, jobFilters: rawJobFilters } = params;
|
|
142
|
+
const jobFilters = extractPlainFilterCriteria(rawJobFilters);
|
|
133
143
|
const { tenantId, projectId } = scopes;
|
|
134
144
|
const whereConditions = [eq(conversations.tenantId, tenantId), eq(conversations.projectId, projectId)];
|
|
135
145
|
if (jobFilters?.conversationIds && Array.isArray(jobFilters.conversationIds) && jobFilters.conversationIds.length > 0) whereConditions.push(inArray(conversations.id, jobFilters.conversationIds));
|
|
@@ -9,16 +9,14 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
9
9
|
scopes: ProjectScopeConfig;
|
|
10
10
|
messageId: string;
|
|
11
11
|
}) => Promise<{
|
|
12
|
+
tenantId: string;
|
|
13
|
+
projectId: string;
|
|
12
14
|
id: string;
|
|
13
15
|
createdAt: string;
|
|
14
16
|
updatedAt: string;
|
|
15
|
-
projectId: string;
|
|
16
|
-
tenantId: string;
|
|
17
17
|
metadata: MessageMetadata | null;
|
|
18
18
|
content: MessageContent;
|
|
19
19
|
role: string;
|
|
20
|
-
taskId: string | null;
|
|
21
|
-
visibility: string;
|
|
22
20
|
conversationId: string;
|
|
23
21
|
fromSubAgentId: string | null;
|
|
24
22
|
toSubAgentId: string | null;
|
|
@@ -26,7 +24,9 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
26
24
|
toExternalAgentId: string | null;
|
|
27
25
|
fromTeamAgentId: string | null;
|
|
28
26
|
toTeamAgentId: string | null;
|
|
27
|
+
visibility: string;
|
|
29
28
|
messageType: string;
|
|
29
|
+
taskId: string | null;
|
|
30
30
|
parentMessageId: string | null;
|
|
31
31
|
a2aTaskId: string | null;
|
|
32
32
|
a2aSessionId: string | null;
|
|
@@ -140,16 +140,14 @@ declare const getVisibleMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
140
140
|
id: string;
|
|
141
141
|
}[]>;
|
|
142
142
|
declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageInsert) => Promise<{
|
|
143
|
+
tenantId: string;
|
|
144
|
+
projectId: string;
|
|
143
145
|
id: string;
|
|
144
146
|
createdAt: string;
|
|
145
147
|
updatedAt: string;
|
|
146
|
-
projectId: string;
|
|
147
|
-
tenantId: string;
|
|
148
148
|
metadata: MessageMetadata | null;
|
|
149
149
|
content: MessageContent;
|
|
150
150
|
role: string;
|
|
151
|
-
taskId: string | null;
|
|
152
|
-
visibility: string;
|
|
153
151
|
conversationId: string;
|
|
154
152
|
fromSubAgentId: string | null;
|
|
155
153
|
toSubAgentId: string | null;
|
|
@@ -157,7 +155,9 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageIn
|
|
|
157
155
|
toExternalAgentId: string | null;
|
|
158
156
|
fromTeamAgentId: string | null;
|
|
159
157
|
toTeamAgentId: string | null;
|
|
158
|
+
visibility: string;
|
|
160
159
|
messageType: string;
|
|
160
|
+
taskId: string | null;
|
|
161
161
|
parentMessageId: string | null;
|
|
162
162
|
a2aTaskId: string | null;
|
|
163
163
|
a2aSessionId: string | null;
|
|
@@ -193,16 +193,14 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
193
193
|
scopes: ProjectScopeConfig;
|
|
194
194
|
messageId: string;
|
|
195
195
|
}) => Promise<{
|
|
196
|
+
tenantId: string;
|
|
197
|
+
projectId: string;
|
|
196
198
|
id: string;
|
|
197
199
|
createdAt: string;
|
|
198
200
|
updatedAt: string;
|
|
199
|
-
projectId: string;
|
|
200
|
-
tenantId: string;
|
|
201
201
|
metadata: MessageMetadata | null;
|
|
202
202
|
content: MessageContent;
|
|
203
203
|
role: string;
|
|
204
|
-
taskId: string | null;
|
|
205
|
-
visibility: string;
|
|
206
204
|
conversationId: string;
|
|
207
205
|
fromSubAgentId: string | null;
|
|
208
206
|
toSubAgentId: string | null;
|
|
@@ -210,7 +208,9 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
210
208
|
toExternalAgentId: string | null;
|
|
211
209
|
fromTeamAgentId: string | null;
|
|
212
210
|
toTeamAgentId: string | null;
|
|
211
|
+
visibility: string;
|
|
213
212
|
messageType: string;
|
|
213
|
+
taskId: string | null;
|
|
214
214
|
parentMessageId: string | null;
|
|
215
215
|
a2aTaskId: string | null;
|
|
216
216
|
a2aSessionId: string | null;
|
|
@@ -6,21 +6,21 @@ import { TaskInsert, TaskSelect } from "../../types/entities.js";
|
|
|
6
6
|
|
|
7
7
|
//#region src/data-access/runtime/tasks.d.ts
|
|
8
8
|
declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
|
|
9
|
+
tenantId: string;
|
|
10
|
+
projectId: string;
|
|
9
11
|
id: string;
|
|
12
|
+
agentId: string;
|
|
10
13
|
createdAt: string;
|
|
11
14
|
updatedAt: string;
|
|
12
|
-
projectId: string;
|
|
13
|
-
tenantId: string;
|
|
14
15
|
metadata: TaskMetadataConfig | null;
|
|
15
|
-
agentId: string;
|
|
16
16
|
ref: {
|
|
17
17
|
type: "tag" | "commit" | "branch";
|
|
18
18
|
name: string;
|
|
19
19
|
hash: string;
|
|
20
20
|
} | null;
|
|
21
21
|
status: string;
|
|
22
|
-
contextId: string;
|
|
23
22
|
subAgentId: string;
|
|
23
|
+
contextId: string;
|
|
24
24
|
}>;
|
|
25
25
|
declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
|
|
26
26
|
id: string;
|
|
@@ -42,8 +42,8 @@ declare const updateTask: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
42
42
|
} | null;
|
|
43
43
|
status: string;
|
|
44
44
|
metadata: TaskMetadataConfig | null;
|
|
45
|
-
agentId: string;
|
|
46
45
|
subAgentId: string;
|
|
46
|
+
agentId: string;
|
|
47
47
|
projectId: string;
|
|
48
48
|
tenantId: string;
|
|
49
49
|
id: string;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { AgentScopeConfig, PaginationConfig } from "../../types/utility.js";
|
|
2
|
+
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
3
|
+
import { TriggerInvocationInsert, TriggerInvocationSelect, TriggerInvocationUpdate } from "../../types/entities.js";
|
|
4
|
+
|
|
5
|
+
//#region src/data-access/runtime/triggerInvocations.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get a trigger invocation by ID (agent-scoped)
|
|
9
|
+
*/
|
|
10
|
+
declare const getTriggerInvocationById: (db: AgentsRunDatabaseClient) => (params: {
|
|
11
|
+
scopes: AgentScopeConfig;
|
|
12
|
+
triggerId: string;
|
|
13
|
+
invocationId: string;
|
|
14
|
+
}) => Promise<TriggerInvocationSelect | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* List trigger invocations with optional filtering (agent-scoped)
|
|
17
|
+
*/
|
|
18
|
+
declare const listTriggerInvocationsPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
19
|
+
scopes: AgentScopeConfig;
|
|
20
|
+
triggerId: string;
|
|
21
|
+
pagination?: PaginationConfig;
|
|
22
|
+
filters?: {
|
|
23
|
+
status?: "pending" | "success" | "failed";
|
|
24
|
+
from?: string;
|
|
25
|
+
to?: string;
|
|
26
|
+
};
|
|
27
|
+
}) => Promise<{
|
|
28
|
+
data: {
|
|
29
|
+
triggerId: string;
|
|
30
|
+
conversationId: string | null;
|
|
31
|
+
status: string;
|
|
32
|
+
requestPayload: unknown;
|
|
33
|
+
transformedPayload: unknown;
|
|
34
|
+
errorMessage: string | null;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
agentId: string;
|
|
37
|
+
projectId: string;
|
|
38
|
+
tenantId: string;
|
|
39
|
+
id: string;
|
|
40
|
+
}[];
|
|
41
|
+
pagination: {
|
|
42
|
+
page: number;
|
|
43
|
+
limit: number;
|
|
44
|
+
total: number;
|
|
45
|
+
pages: number;
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Create a new trigger invocation (agent-scoped)
|
|
50
|
+
*/
|
|
51
|
+
declare const createTriggerInvocation: (db: AgentsRunDatabaseClient) => (params: TriggerInvocationInsert) => Promise<TriggerInvocationSelect>;
|
|
52
|
+
/**
|
|
53
|
+
* Update trigger invocation status (agent-scoped)
|
|
54
|
+
*/
|
|
55
|
+
declare const updateTriggerInvocationStatus: (db: AgentsRunDatabaseClient) => (params: {
|
|
56
|
+
scopes: AgentScopeConfig;
|
|
57
|
+
triggerId: string;
|
|
58
|
+
invocationId: string;
|
|
59
|
+
data: TriggerInvocationUpdate;
|
|
60
|
+
}) => Promise<TriggerInvocationSelect>;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { createTriggerInvocation, getTriggerInvocationById, listTriggerInvocationsPaginated, updateTriggerInvocationStatus };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { triggerInvocations } from "../../db/runtime/runtime-schema.js";
|
|
2
|
+
import { and, count, desc, eq, gte, lte } from "drizzle-orm";
|
|
3
|
+
|
|
4
|
+
//#region src/data-access/runtime/triggerInvocations.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get a trigger invocation by ID (agent-scoped)
|
|
7
|
+
*/
|
|
8
|
+
const getTriggerInvocationById = (db) => async (params) => {
|
|
9
|
+
return await db.query.triggerInvocations.findFirst({ where: and(eq(triggerInvocations.tenantId, params.scopes.tenantId), eq(triggerInvocations.projectId, params.scopes.projectId), eq(triggerInvocations.agentId, params.scopes.agentId), eq(triggerInvocations.triggerId, params.triggerId), eq(triggerInvocations.id, params.invocationId)) });
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* List trigger invocations with optional filtering (agent-scoped)
|
|
13
|
+
*/
|
|
14
|
+
const listTriggerInvocationsPaginated = (db) => async (params) => {
|
|
15
|
+
const page = params.pagination?.page || 1;
|
|
16
|
+
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
17
|
+
const offset = (page - 1) * limit;
|
|
18
|
+
const conditions = [
|
|
19
|
+
eq(triggerInvocations.tenantId, params.scopes.tenantId),
|
|
20
|
+
eq(triggerInvocations.projectId, params.scopes.projectId),
|
|
21
|
+
eq(triggerInvocations.agentId, params.scopes.agentId),
|
|
22
|
+
eq(triggerInvocations.triggerId, params.triggerId)
|
|
23
|
+
];
|
|
24
|
+
if (params.filters?.status) conditions.push(eq(triggerInvocations.status, params.filters.status));
|
|
25
|
+
if (params.filters?.from) conditions.push(gte(triggerInvocations.createdAt, params.filters.from));
|
|
26
|
+
if (params.filters?.to) conditions.push(lte(triggerInvocations.createdAt, params.filters.to));
|
|
27
|
+
const whereClause = and(...conditions);
|
|
28
|
+
const [data, totalResult] = await Promise.all([db.select().from(triggerInvocations).where(whereClause).limit(limit).offset(offset).orderBy(desc(triggerInvocations.createdAt)), db.select({ count: count() }).from(triggerInvocations).where(whereClause)]);
|
|
29
|
+
const total = totalResult[0]?.count || 0;
|
|
30
|
+
return {
|
|
31
|
+
data,
|
|
32
|
+
pagination: {
|
|
33
|
+
page,
|
|
34
|
+
limit,
|
|
35
|
+
total,
|
|
36
|
+
pages: Math.ceil(total / limit)
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Create a new trigger invocation (agent-scoped)
|
|
42
|
+
*/
|
|
43
|
+
const createTriggerInvocation = (db) => async (params) => {
|
|
44
|
+
return (await db.insert(triggerInvocations).values(params).returning())[0];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Update trigger invocation status (agent-scoped)
|
|
48
|
+
*/
|
|
49
|
+
const updateTriggerInvocationStatus = (db) => async (params) => {
|
|
50
|
+
return (await db.update(triggerInvocations).set(params.data).where(and(eq(triggerInvocations.tenantId, params.scopes.tenantId), eq(triggerInvocations.projectId, params.scopes.projectId), eq(triggerInvocations.agentId, params.scopes.agentId), eq(triggerInvocations.triggerId, params.triggerId), eq(triggerInvocations.id, params.invocationId))).returning())[0];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { createTriggerInvocation, getTriggerInvocationById, listTriggerInvocationsPaginated, updateTriggerInvocationStatus };
|
|
@@ -4,7 +4,7 @@ import * as drizzle_orm_pg_core208 from "drizzle-orm/pg-core";
|
|
|
4
4
|
|
|
5
5
|
//#region src/db/manage/manage-schema.d.ts
|
|
6
6
|
declare namespace manage_schema_d_exports {
|
|
7
|
-
export { agentRelations, agentToolRelationsRelations, agents, artifactComponents, artifactComponentsRelations, contextConfigs, contextConfigsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, dataset, datasetItem, datasetRunConfig, datasetRunConfigAgentRelations, evaluationJobConfig, evaluationJobConfigEvaluatorRelations, evaluationRunConfig, evaluationRunConfigEvaluationSuiteConfigRelations, evaluationSuiteConfig, evaluationSuiteConfigEvaluatorRelations, evaluator, externalAgents, externalAgentsRelations, functionTools, functionToolsRelations, functions, functionsRelations, projects, projectsRelations, subAgentArtifactComponents, subAgentArtifactComponentsRelations, subAgentDataComponents, subAgentDataComponentsRelations, subAgentExternalAgentRelations, subAgentExternalAgentRelationsRelations, subAgentFunctionToolRelations, subAgentFunctionToolRelationsRelations, subAgentRelations, subAgentRelationsRelations, subAgentTeamAgentRelations, subAgentTeamAgentRelationsRelations, subAgentToolRelations, subAgents, subAgentsRelations, tools, toolsRelations };
|
|
7
|
+
export { agentRelations, agentToolRelationsRelations, agents, artifactComponents, artifactComponentsRelations, contextConfigs, contextConfigsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, dataset, datasetItem, datasetRunConfig, datasetRunConfigAgentRelations, evaluationJobConfig, evaluationJobConfigEvaluatorRelations, evaluationRunConfig, evaluationRunConfigEvaluationSuiteConfigRelations, evaluationSuiteConfig, evaluationSuiteConfigEvaluatorRelations, evaluator, externalAgents, externalAgentsRelations, functionTools, functionToolsRelations, functions, functionsRelations, projects, projectsRelations, subAgentArtifactComponents, subAgentArtifactComponentsRelations, subAgentDataComponents, subAgentDataComponentsRelations, subAgentExternalAgentRelations, subAgentExternalAgentRelationsRelations, subAgentFunctionToolRelations, subAgentFunctionToolRelationsRelations, subAgentRelations, subAgentRelationsRelations, subAgentTeamAgentRelations, subAgentTeamAgentRelationsRelations, subAgentToolRelations, subAgents, subAgentsRelations, tools, toolsRelations, triggers };
|
|
8
8
|
}
|
|
9
9
|
declare const projects: drizzle_orm_pg_core208.PgTableWithColumns<{
|
|
10
10
|
name: "projects";
|
|
@@ -650,6 +650,273 @@ declare const contextConfigs: drizzle_orm_pg_core208.PgTableWithColumns<{
|
|
|
650
650
|
};
|
|
651
651
|
dialect: "pg";
|
|
652
652
|
}>;
|
|
653
|
+
declare const triggers: drizzle_orm_pg_core208.PgTableWithColumns<{
|
|
654
|
+
name: "triggers";
|
|
655
|
+
schema: undefined;
|
|
656
|
+
columns: {
|
|
657
|
+
createdAt: drizzle_orm_pg_core208.PgColumn<{
|
|
658
|
+
name: "created_at";
|
|
659
|
+
tableName: "triggers";
|
|
660
|
+
dataType: "string";
|
|
661
|
+
columnType: "PgTimestampString";
|
|
662
|
+
data: string;
|
|
663
|
+
driverParam: string;
|
|
664
|
+
notNull: true;
|
|
665
|
+
hasDefault: true;
|
|
666
|
+
isPrimaryKey: false;
|
|
667
|
+
isAutoincrement: false;
|
|
668
|
+
hasRuntimeDefault: false;
|
|
669
|
+
enumValues: undefined;
|
|
670
|
+
baseColumn: never;
|
|
671
|
+
identity: undefined;
|
|
672
|
+
generated: undefined;
|
|
673
|
+
}, {}, {}>;
|
|
674
|
+
updatedAt: drizzle_orm_pg_core208.PgColumn<{
|
|
675
|
+
name: "updated_at";
|
|
676
|
+
tableName: "triggers";
|
|
677
|
+
dataType: "string";
|
|
678
|
+
columnType: "PgTimestampString";
|
|
679
|
+
data: string;
|
|
680
|
+
driverParam: string;
|
|
681
|
+
notNull: true;
|
|
682
|
+
hasDefault: true;
|
|
683
|
+
isPrimaryKey: false;
|
|
684
|
+
isAutoincrement: false;
|
|
685
|
+
hasRuntimeDefault: false;
|
|
686
|
+
enumValues: undefined;
|
|
687
|
+
baseColumn: never;
|
|
688
|
+
identity: undefined;
|
|
689
|
+
generated: undefined;
|
|
690
|
+
}, {}, {}>;
|
|
691
|
+
enabled: drizzle_orm_pg_core208.PgColumn<{
|
|
692
|
+
name: "enabled";
|
|
693
|
+
tableName: "triggers";
|
|
694
|
+
dataType: "boolean";
|
|
695
|
+
columnType: "PgBoolean";
|
|
696
|
+
data: boolean;
|
|
697
|
+
driverParam: boolean;
|
|
698
|
+
notNull: true;
|
|
699
|
+
hasDefault: true;
|
|
700
|
+
isPrimaryKey: false;
|
|
701
|
+
isAutoincrement: false;
|
|
702
|
+
hasRuntimeDefault: false;
|
|
703
|
+
enumValues: undefined;
|
|
704
|
+
baseColumn: never;
|
|
705
|
+
identity: undefined;
|
|
706
|
+
generated: undefined;
|
|
707
|
+
}, {}, {}>;
|
|
708
|
+
inputSchema: drizzle_orm_pg_core208.PgColumn<{
|
|
709
|
+
name: "input_schema";
|
|
710
|
+
tableName: "triggers";
|
|
711
|
+
dataType: "json";
|
|
712
|
+
columnType: "PgJsonb";
|
|
713
|
+
data: Record<string, unknown>;
|
|
714
|
+
driverParam: unknown;
|
|
715
|
+
notNull: false;
|
|
716
|
+
hasDefault: false;
|
|
717
|
+
isPrimaryKey: false;
|
|
718
|
+
isAutoincrement: false;
|
|
719
|
+
hasRuntimeDefault: false;
|
|
720
|
+
enumValues: undefined;
|
|
721
|
+
baseColumn: never;
|
|
722
|
+
identity: undefined;
|
|
723
|
+
generated: undefined;
|
|
724
|
+
}, {}, {
|
|
725
|
+
$type: Record<string, unknown>;
|
|
726
|
+
}>;
|
|
727
|
+
outputTransform: drizzle_orm_pg_core208.PgColumn<{
|
|
728
|
+
name: "output_transform";
|
|
729
|
+
tableName: "triggers";
|
|
730
|
+
dataType: "json";
|
|
731
|
+
columnType: "PgJsonb";
|
|
732
|
+
data: {
|
|
733
|
+
jmespath?: string;
|
|
734
|
+
objectTransformation?: Record<string, string>;
|
|
735
|
+
};
|
|
736
|
+
driverParam: unknown;
|
|
737
|
+
notNull: false;
|
|
738
|
+
hasDefault: false;
|
|
739
|
+
isPrimaryKey: false;
|
|
740
|
+
isAutoincrement: false;
|
|
741
|
+
hasRuntimeDefault: false;
|
|
742
|
+
enumValues: undefined;
|
|
743
|
+
baseColumn: never;
|
|
744
|
+
identity: undefined;
|
|
745
|
+
generated: undefined;
|
|
746
|
+
}, {}, {
|
|
747
|
+
$type: {
|
|
748
|
+
jmespath?: string;
|
|
749
|
+
objectTransformation?: Record<string, string>;
|
|
750
|
+
};
|
|
751
|
+
}>;
|
|
752
|
+
messageTemplate: drizzle_orm_pg_core208.PgColumn<{
|
|
753
|
+
name: "message_template";
|
|
754
|
+
tableName: "triggers";
|
|
755
|
+
dataType: "string";
|
|
756
|
+
columnType: "PgText";
|
|
757
|
+
data: string;
|
|
758
|
+
driverParam: string;
|
|
759
|
+
notNull: true;
|
|
760
|
+
hasDefault: false;
|
|
761
|
+
isPrimaryKey: false;
|
|
762
|
+
isAutoincrement: false;
|
|
763
|
+
hasRuntimeDefault: false;
|
|
764
|
+
enumValues: [string, ...string[]];
|
|
765
|
+
baseColumn: never;
|
|
766
|
+
identity: undefined;
|
|
767
|
+
generated: undefined;
|
|
768
|
+
}, {}, {}>;
|
|
769
|
+
authentication: drizzle_orm_pg_core208.PgColumn<{
|
|
770
|
+
name: "authentication";
|
|
771
|
+
tableName: "triggers";
|
|
772
|
+
dataType: "json";
|
|
773
|
+
columnType: "PgJsonb";
|
|
774
|
+
data: unknown;
|
|
775
|
+
driverParam: unknown;
|
|
776
|
+
notNull: false;
|
|
777
|
+
hasDefault: false;
|
|
778
|
+
isPrimaryKey: false;
|
|
779
|
+
isAutoincrement: false;
|
|
780
|
+
hasRuntimeDefault: false;
|
|
781
|
+
enumValues: undefined;
|
|
782
|
+
baseColumn: never;
|
|
783
|
+
identity: undefined;
|
|
784
|
+
generated: undefined;
|
|
785
|
+
}, {}, {
|
|
786
|
+
$type: unknown;
|
|
787
|
+
}>;
|
|
788
|
+
signingSecret: drizzle_orm_pg_core208.PgColumn<{
|
|
789
|
+
name: "signing_secret";
|
|
790
|
+
tableName: "triggers";
|
|
791
|
+
dataType: "string";
|
|
792
|
+
columnType: "PgText";
|
|
793
|
+
data: string;
|
|
794
|
+
driverParam: string;
|
|
795
|
+
notNull: false;
|
|
796
|
+
hasDefault: false;
|
|
797
|
+
isPrimaryKey: false;
|
|
798
|
+
isAutoincrement: false;
|
|
799
|
+
hasRuntimeDefault: false;
|
|
800
|
+
enumValues: [string, ...string[]];
|
|
801
|
+
baseColumn: never;
|
|
802
|
+
identity: undefined;
|
|
803
|
+
generated: undefined;
|
|
804
|
+
}, {}, {}>;
|
|
805
|
+
name: drizzle_orm_pg_core208.PgColumn<{
|
|
806
|
+
name: "name";
|
|
807
|
+
tableName: "triggers";
|
|
808
|
+
dataType: "string";
|
|
809
|
+
columnType: "PgVarchar";
|
|
810
|
+
data: string;
|
|
811
|
+
driverParam: string;
|
|
812
|
+
notNull: true;
|
|
813
|
+
hasDefault: false;
|
|
814
|
+
isPrimaryKey: false;
|
|
815
|
+
isAutoincrement: false;
|
|
816
|
+
hasRuntimeDefault: false;
|
|
817
|
+
enumValues: [string, ...string[]];
|
|
818
|
+
baseColumn: never;
|
|
819
|
+
identity: undefined;
|
|
820
|
+
generated: undefined;
|
|
821
|
+
}, {}, {
|
|
822
|
+
length: 256;
|
|
823
|
+
}>;
|
|
824
|
+
description: drizzle_orm_pg_core208.PgColumn<{
|
|
825
|
+
name: "description";
|
|
826
|
+
tableName: "triggers";
|
|
827
|
+
dataType: "string";
|
|
828
|
+
columnType: "PgText";
|
|
829
|
+
data: string;
|
|
830
|
+
driverParam: string;
|
|
831
|
+
notNull: false;
|
|
832
|
+
hasDefault: false;
|
|
833
|
+
isPrimaryKey: false;
|
|
834
|
+
isAutoincrement: false;
|
|
835
|
+
hasRuntimeDefault: false;
|
|
836
|
+
enumValues: [string, ...string[]];
|
|
837
|
+
baseColumn: never;
|
|
838
|
+
identity: undefined;
|
|
839
|
+
generated: undefined;
|
|
840
|
+
}, {}, {}>;
|
|
841
|
+
agentId: drizzle_orm_pg_core208.PgColumn<{
|
|
842
|
+
name: "agent_id";
|
|
843
|
+
tableName: "triggers";
|
|
844
|
+
dataType: "string";
|
|
845
|
+
columnType: "PgVarchar";
|
|
846
|
+
data: string;
|
|
847
|
+
driverParam: string;
|
|
848
|
+
notNull: true;
|
|
849
|
+
hasDefault: false;
|
|
850
|
+
isPrimaryKey: false;
|
|
851
|
+
isAutoincrement: false;
|
|
852
|
+
hasRuntimeDefault: false;
|
|
853
|
+
enumValues: [string, ...string[]];
|
|
854
|
+
baseColumn: never;
|
|
855
|
+
identity: undefined;
|
|
856
|
+
generated: undefined;
|
|
857
|
+
}, {}, {
|
|
858
|
+
length: 256;
|
|
859
|
+
}>;
|
|
860
|
+
projectId: drizzle_orm_pg_core208.PgColumn<{
|
|
861
|
+
name: "project_id";
|
|
862
|
+
tableName: "triggers";
|
|
863
|
+
dataType: "string";
|
|
864
|
+
columnType: "PgVarchar";
|
|
865
|
+
data: string;
|
|
866
|
+
driverParam: string;
|
|
867
|
+
notNull: true;
|
|
868
|
+
hasDefault: false;
|
|
869
|
+
isPrimaryKey: false;
|
|
870
|
+
isAutoincrement: false;
|
|
871
|
+
hasRuntimeDefault: false;
|
|
872
|
+
enumValues: [string, ...string[]];
|
|
873
|
+
baseColumn: never;
|
|
874
|
+
identity: undefined;
|
|
875
|
+
generated: undefined;
|
|
876
|
+
}, {}, {
|
|
877
|
+
length: 256;
|
|
878
|
+
}>;
|
|
879
|
+
tenantId: drizzle_orm_pg_core208.PgColumn<{
|
|
880
|
+
name: "tenant_id";
|
|
881
|
+
tableName: "triggers";
|
|
882
|
+
dataType: "string";
|
|
883
|
+
columnType: "PgVarchar";
|
|
884
|
+
data: string;
|
|
885
|
+
driverParam: string;
|
|
886
|
+
notNull: true;
|
|
887
|
+
hasDefault: false;
|
|
888
|
+
isPrimaryKey: false;
|
|
889
|
+
isAutoincrement: false;
|
|
890
|
+
hasRuntimeDefault: false;
|
|
891
|
+
enumValues: [string, ...string[]];
|
|
892
|
+
baseColumn: never;
|
|
893
|
+
identity: undefined;
|
|
894
|
+
generated: undefined;
|
|
895
|
+
}, {}, {
|
|
896
|
+
length: 256;
|
|
897
|
+
}>;
|
|
898
|
+
id: drizzle_orm_pg_core208.PgColumn<{
|
|
899
|
+
name: "id";
|
|
900
|
+
tableName: "triggers";
|
|
901
|
+
dataType: "string";
|
|
902
|
+
columnType: "PgVarchar";
|
|
903
|
+
data: string;
|
|
904
|
+
driverParam: string;
|
|
905
|
+
notNull: true;
|
|
906
|
+
hasDefault: false;
|
|
907
|
+
isPrimaryKey: false;
|
|
908
|
+
isAutoincrement: false;
|
|
909
|
+
hasRuntimeDefault: false;
|
|
910
|
+
enumValues: [string, ...string[]];
|
|
911
|
+
baseColumn: never;
|
|
912
|
+
identity: undefined;
|
|
913
|
+
generated: undefined;
|
|
914
|
+
}, {}, {
|
|
915
|
+
length: 256;
|
|
916
|
+
}>;
|
|
917
|
+
};
|
|
918
|
+
dialect: "pg";
|
|
919
|
+
}>;
|
|
653
920
|
declare const subAgents: drizzle_orm_pg_core208.PgTableWithColumns<{
|
|
654
921
|
name: "sub_agents";
|
|
655
922
|
schema: undefined;
|
|
@@ -4771,7 +5038,6 @@ declare const evaluationJobConfig: drizzle_orm_pg_core208.PgTableWithColumns<{
|
|
|
4771
5038
|
dataType: "json";
|
|
4772
5039
|
columnType: "PgJsonb";
|
|
4773
5040
|
data: Filter<{
|
|
4774
|
-
[x: string]: unknown;
|
|
4775
5041
|
datasetRunIds?: string[] | undefined;
|
|
4776
5042
|
conversationIds?: string[] | undefined;
|
|
4777
5043
|
dateRange?: {
|
|
@@ -4791,7 +5057,6 @@ declare const evaluationJobConfig: drizzle_orm_pg_core208.PgTableWithColumns<{
|
|
|
4791
5057
|
generated: undefined;
|
|
4792
5058
|
}, {}, {
|
|
4793
5059
|
$type: Filter<{
|
|
4794
|
-
[x: string]: unknown;
|
|
4795
5060
|
datasetRunIds?: string[] | undefined;
|
|
4796
5061
|
conversationIds?: string[] | undefined;
|
|
4797
5062
|
dateRange?: {
|
|
@@ -5232,4 +5497,4 @@ declare const datasetRunConfigAgentRelations: drizzle_orm_pg_core208.PgTableWith
|
|
|
5232
5497
|
dialect: "pg";
|
|
5233
5498
|
}>;
|
|
5234
5499
|
//#endregion
|
|
5235
|
-
export { agentRelations, agentToolRelationsRelations, agents, artifactComponents, artifactComponentsRelations, contextConfigs, contextConfigsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, dataset, datasetItem, datasetRunConfig, datasetRunConfigAgentRelations, evaluationJobConfig, evaluationJobConfigEvaluatorRelations, evaluationRunConfig, evaluationRunConfigEvaluationSuiteConfigRelations, evaluationSuiteConfig, evaluationSuiteConfigEvaluatorRelations, evaluator, externalAgents, externalAgentsRelations, functionTools, functionToolsRelations, functions, functionsRelations, manage_schema_d_exports, projects, projectsRelations, subAgentArtifactComponents, subAgentArtifactComponentsRelations, subAgentDataComponents, subAgentDataComponentsRelations, subAgentExternalAgentRelations, subAgentExternalAgentRelationsRelations, subAgentFunctionToolRelations, subAgentFunctionToolRelationsRelations, subAgentRelations, subAgentRelationsRelations, subAgentTeamAgentRelations, subAgentTeamAgentRelationsRelations, subAgentToolRelations, subAgents, subAgentsRelations, tools, toolsRelations };
|
|
5500
|
+
export { agentRelations, agentToolRelationsRelations, agents, artifactComponents, artifactComponentsRelations, contextConfigs, contextConfigsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, dataset, datasetItem, datasetRunConfig, datasetRunConfigAgentRelations, evaluationJobConfig, evaluationJobConfigEvaluatorRelations, evaluationRunConfig, evaluationRunConfigEvaluationSuiteConfigRelations, evaluationSuiteConfig, evaluationSuiteConfigEvaluatorRelations, evaluator, externalAgents, externalAgentsRelations, functionTools, functionToolsRelations, functions, functionsRelations, manage_schema_d_exports, projects, projectsRelations, subAgentArtifactComponents, subAgentArtifactComponentsRelations, subAgentDataComponents, subAgentDataComponentsRelations, subAgentExternalAgentRelations, subAgentExternalAgentRelationsRelations, subAgentFunctionToolRelations, subAgentFunctionToolRelationsRelations, subAgentRelations, subAgentRelationsRelations, subAgentTeamAgentRelations, subAgentTeamAgentRelationsRelations, subAgentToolRelations, subAgents, subAgentsRelations, tools, toolsRelations, triggers };
|