@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
|
@@ -8,12 +8,12 @@ declare const getAgentRelationById: (db: AgentsManageDatabaseClient) => (params:
|
|
|
8
8
|
scopes: AgentScopeConfig;
|
|
9
9
|
relationId: string;
|
|
10
10
|
}) => Promise<{
|
|
11
|
+
tenantId: string;
|
|
12
|
+
projectId: string;
|
|
11
13
|
id: string;
|
|
14
|
+
agentId: string;
|
|
12
15
|
createdAt: string;
|
|
13
16
|
updatedAt: string;
|
|
14
|
-
projectId: string;
|
|
15
|
-
tenantId: string;
|
|
16
|
-
agentId: string;
|
|
17
17
|
sourceSubAgentId: string;
|
|
18
18
|
targetSubAgentId: string | null;
|
|
19
19
|
relationType: string | null;
|
|
@@ -43,12 +43,12 @@ declare const listAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
43
43
|
declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
44
44
|
scopes: SubAgentScopeConfig;
|
|
45
45
|
}) => Promise<{
|
|
46
|
+
tenantId: string;
|
|
47
|
+
projectId: string;
|
|
46
48
|
id: string;
|
|
49
|
+
agentId: string;
|
|
47
50
|
createdAt: string;
|
|
48
51
|
updatedAt: string;
|
|
49
|
-
projectId: string;
|
|
50
|
-
tenantId: string;
|
|
51
|
-
agentId: string;
|
|
52
52
|
sourceSubAgentId: string;
|
|
53
53
|
targetSubAgentId: string | null;
|
|
54
54
|
relationType: string | null;
|
|
@@ -56,12 +56,12 @@ declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
56
56
|
declare const getAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
57
57
|
scopes: AgentScopeConfig;
|
|
58
58
|
}) => Promise<{
|
|
59
|
+
tenantId: string;
|
|
60
|
+
projectId: string;
|
|
59
61
|
id: string;
|
|
62
|
+
agentId: string;
|
|
60
63
|
createdAt: string;
|
|
61
64
|
updatedAt: string;
|
|
62
|
-
projectId: string;
|
|
63
|
-
tenantId: string;
|
|
64
|
-
agentId: string;
|
|
65
65
|
sourceSubAgentId: string;
|
|
66
66
|
targetSubAgentId: string | null;
|
|
67
67
|
relationType: string | null;
|
|
@@ -125,12 +125,12 @@ declare const getRelatedAgentsForAgent: (db: AgentsManageDatabaseClient) => (par
|
|
|
125
125
|
}[];
|
|
126
126
|
}>;
|
|
127
127
|
declare const createSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
|
|
128
|
+
tenantId: string;
|
|
129
|
+
projectId: string;
|
|
128
130
|
id: string;
|
|
131
|
+
agentId: string;
|
|
129
132
|
createdAt: string;
|
|
130
133
|
updatedAt: string;
|
|
131
|
-
projectId: string;
|
|
132
|
-
tenantId: string;
|
|
133
|
-
agentId: string;
|
|
134
134
|
sourceSubAgentId: string;
|
|
135
135
|
targetSubAgentId: string | null;
|
|
136
136
|
relationType: string | null;
|
|
@@ -144,12 +144,12 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
|
|
|
144
144
|
targetSubAgentId?: string;
|
|
145
145
|
relationType: string;
|
|
146
146
|
}) => Promise<{
|
|
147
|
+
tenantId: string;
|
|
148
|
+
projectId: string;
|
|
147
149
|
id: string;
|
|
150
|
+
agentId: string;
|
|
148
151
|
createdAt: string;
|
|
149
152
|
updatedAt: string;
|
|
150
|
-
projectId: string;
|
|
151
|
-
tenantId: string;
|
|
152
|
-
agentId: string;
|
|
153
153
|
sourceSubAgentId: string;
|
|
154
154
|
targetSubAgentId: string | null;
|
|
155
155
|
relationType: string | null;
|
|
@@ -158,12 +158,12 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
|
|
|
158
158
|
* Upsert agent relation (create if it doesn't exist, no-op if it does)
|
|
159
159
|
*/
|
|
160
160
|
declare const upsertSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
|
|
161
|
+
tenantId: string;
|
|
162
|
+
projectId: string;
|
|
161
163
|
id: string;
|
|
164
|
+
agentId: string;
|
|
162
165
|
createdAt: string;
|
|
163
166
|
updatedAt: string;
|
|
164
|
-
projectId: string;
|
|
165
|
-
tenantId: string;
|
|
166
|
-
agentId: string;
|
|
167
167
|
sourceSubAgentId: string;
|
|
168
168
|
targetSubAgentId: string | null;
|
|
169
169
|
relationType: string | null;
|
|
@@ -203,13 +203,13 @@ declare const createAgentToolRelation: (db: AgentsManageDatabaseClient) => (para
|
|
|
203
203
|
}> | null;
|
|
204
204
|
};
|
|
205
205
|
}) => Promise<{
|
|
206
|
+
tenantId: string;
|
|
207
|
+
projectId: string;
|
|
206
208
|
id: string;
|
|
209
|
+
agentId: string;
|
|
207
210
|
createdAt: string;
|
|
208
211
|
updatedAt: string;
|
|
209
|
-
projectId: string;
|
|
210
|
-
tenantId: string;
|
|
211
212
|
toolId: string;
|
|
212
|
-
agentId: string;
|
|
213
213
|
headers: Record<string, string> | null;
|
|
214
214
|
toolPolicies: Record<string, {
|
|
215
215
|
needsApproval?: boolean;
|
|
@@ -247,13 +247,13 @@ declare const getAgentToolRelationById: (db: AgentsManageDatabaseClient) => (par
|
|
|
247
247
|
scopes: SubAgentScopeConfig;
|
|
248
248
|
relationId: string;
|
|
249
249
|
}) => Promise<{
|
|
250
|
+
tenantId: string;
|
|
251
|
+
projectId: string;
|
|
250
252
|
id: string;
|
|
253
|
+
agentId: string;
|
|
251
254
|
createdAt: string;
|
|
252
255
|
updatedAt: string;
|
|
253
|
-
projectId: string;
|
|
254
|
-
tenantId: string;
|
|
255
256
|
toolId: string;
|
|
256
|
-
agentId: string;
|
|
257
257
|
headers: Record<string, string> | null;
|
|
258
258
|
toolPolicies: Record<string, {
|
|
259
259
|
needsApproval?: boolean;
|
|
@@ -8,12 +8,12 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
|
|
|
8
8
|
scopes: SubAgentScopeConfig;
|
|
9
9
|
relationId: string;
|
|
10
10
|
}) => Promise<{
|
|
11
|
+
tenantId: string;
|
|
12
|
+
projectId: string;
|
|
11
13
|
id: string;
|
|
14
|
+
agentId: string;
|
|
12
15
|
createdAt: string;
|
|
13
16
|
updatedAt: string;
|
|
14
|
-
projectId: string;
|
|
15
|
-
tenantId: string;
|
|
16
|
-
agentId: string;
|
|
17
17
|
headers: Record<string, string> | null;
|
|
18
18
|
subAgentId: string;
|
|
19
19
|
targetAgentId: string;
|
|
@@ -43,12 +43,12 @@ declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =
|
|
|
43
43
|
declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
44
44
|
scopes: SubAgentScopeConfig;
|
|
45
45
|
}) => Promise<{
|
|
46
|
+
tenantId: string;
|
|
47
|
+
projectId: string;
|
|
46
48
|
id: string;
|
|
49
|
+
agentId: string;
|
|
47
50
|
createdAt: string;
|
|
48
51
|
updatedAt: string;
|
|
49
|
-
projectId: string;
|
|
50
|
-
tenantId: string;
|
|
51
|
-
agentId: string;
|
|
52
52
|
headers: Record<string, string> | null;
|
|
53
53
|
subAgentId: string;
|
|
54
54
|
targetAgentId: string;
|
|
@@ -56,12 +56,12 @@ declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =>
|
|
|
56
56
|
declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
57
57
|
scopes: AgentScopeConfig;
|
|
58
58
|
}) => Promise<{
|
|
59
|
+
tenantId: string;
|
|
60
|
+
projectId: string;
|
|
59
61
|
id: string;
|
|
62
|
+
agentId: string;
|
|
60
63
|
createdAt: string;
|
|
61
64
|
updatedAt: string;
|
|
62
|
-
projectId: string;
|
|
63
|
-
tenantId: string;
|
|
64
|
-
agentId: string;
|
|
65
65
|
headers: Record<string, string> | null;
|
|
66
66
|
subAgentId: string;
|
|
67
67
|
targetAgentId: string;
|
|
@@ -209,12 +209,12 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
|
|
|
209
209
|
headers?: Record<string, string> | null;
|
|
210
210
|
};
|
|
211
211
|
}) => Promise<{
|
|
212
|
+
tenantId: string;
|
|
213
|
+
projectId: string;
|
|
212
214
|
id: string;
|
|
215
|
+
agentId: string;
|
|
213
216
|
createdAt: string;
|
|
214
217
|
updatedAt: string;
|
|
215
|
-
projectId: string;
|
|
216
|
-
tenantId: string;
|
|
217
|
-
agentId: string;
|
|
218
218
|
headers: Record<string, string> | null;
|
|
219
219
|
subAgentId: string;
|
|
220
220
|
targetAgentId: string;
|
|
@@ -226,12 +226,12 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
|
|
|
226
226
|
scopes: SubAgentScopeConfig;
|
|
227
227
|
targetAgentId: string;
|
|
228
228
|
}) => Promise<{
|
|
229
|
+
tenantId: string;
|
|
230
|
+
projectId: string;
|
|
229
231
|
id: string;
|
|
232
|
+
agentId: string;
|
|
230
233
|
createdAt: string;
|
|
231
234
|
updatedAt: string;
|
|
232
|
-
projectId: string;
|
|
233
|
-
tenantId: string;
|
|
234
|
-
agentId: string;
|
|
235
235
|
headers: Record<string, string> | null;
|
|
236
236
|
subAgentId: string;
|
|
237
237
|
targetAgentId: string;
|
|
@@ -247,12 +247,12 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
|
|
|
247
247
|
headers?: Record<string, string> | null;
|
|
248
248
|
};
|
|
249
249
|
}) => Promise<{
|
|
250
|
+
tenantId: string;
|
|
251
|
+
projectId: string;
|
|
250
252
|
id: string;
|
|
253
|
+
agentId: string;
|
|
251
254
|
createdAt: string;
|
|
252
255
|
updatedAt: string;
|
|
253
|
-
projectId: string;
|
|
254
|
-
tenantId: string;
|
|
255
|
-
agentId: string;
|
|
256
256
|
headers: Record<string, string> | null;
|
|
257
257
|
subAgentId: string;
|
|
258
258
|
targetAgentId: string;
|
|
@@ -8,13 +8,15 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
8
8
|
scopes: AgentScopeConfig;
|
|
9
9
|
subAgentId: string;
|
|
10
10
|
}) => Promise<{
|
|
11
|
+
tenantId: string;
|
|
12
|
+
projectId: string;
|
|
11
13
|
id: string;
|
|
12
14
|
name: string;
|
|
13
15
|
description: string | null;
|
|
16
|
+
prompt: string | null;
|
|
17
|
+
agentId: string;
|
|
14
18
|
createdAt: string;
|
|
15
19
|
updatedAt: string;
|
|
16
|
-
projectId: string;
|
|
17
|
-
tenantId: string;
|
|
18
20
|
models: {
|
|
19
21
|
base?: {
|
|
20
22
|
model?: string | undefined;
|
|
@@ -32,20 +34,20 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
32
34
|
stopWhen: {
|
|
33
35
|
stepCountIs?: number | undefined;
|
|
34
36
|
} | null;
|
|
35
|
-
prompt: string | null;
|
|
36
|
-
agentId: string;
|
|
37
37
|
conversationHistoryConfig: ConversationHistoryConfig | null;
|
|
38
38
|
} | undefined>;
|
|
39
39
|
declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
40
40
|
scopes: AgentScopeConfig;
|
|
41
41
|
}) => Promise<{
|
|
42
|
+
tenantId: string;
|
|
43
|
+
projectId: string;
|
|
42
44
|
id: string;
|
|
43
45
|
name: string;
|
|
44
46
|
description: string | null;
|
|
47
|
+
prompt: string | null;
|
|
48
|
+
agentId: string;
|
|
45
49
|
createdAt: string;
|
|
46
50
|
updatedAt: string;
|
|
47
|
-
projectId: string;
|
|
48
|
-
tenantId: string;
|
|
49
51
|
models: {
|
|
50
52
|
base?: {
|
|
51
53
|
model?: string | undefined;
|
|
@@ -63,8 +65,6 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
63
65
|
stopWhen: {
|
|
64
66
|
stepCountIs?: number | undefined;
|
|
65
67
|
} | null;
|
|
66
|
-
prompt: string | null;
|
|
67
|
-
agentId: string;
|
|
68
68
|
conversationHistoryConfig: ConversationHistoryConfig | null;
|
|
69
69
|
}[]>;
|
|
70
70
|
declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -108,13 +108,15 @@ declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (param
|
|
|
108
108
|
};
|
|
109
109
|
}>;
|
|
110
110
|
declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAgentInsert) => Promise<{
|
|
111
|
+
tenantId: string;
|
|
112
|
+
projectId: string;
|
|
111
113
|
id: string;
|
|
112
114
|
name: string;
|
|
113
115
|
description: string | null;
|
|
116
|
+
prompt: string | null;
|
|
117
|
+
agentId: string;
|
|
114
118
|
createdAt: string;
|
|
115
119
|
updatedAt: string;
|
|
116
|
-
projectId: string;
|
|
117
|
-
tenantId: string;
|
|
118
120
|
models: {
|
|
119
121
|
base?: {
|
|
120
122
|
model?: string | undefined;
|
|
@@ -132,8 +134,6 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
|
|
|
132
134
|
stopWhen: {
|
|
133
135
|
stepCountIs?: number | undefined;
|
|
134
136
|
} | null;
|
|
135
|
-
prompt: string | null;
|
|
136
|
-
agentId: string;
|
|
137
137
|
conversationHistoryConfig: ConversationHistoryConfig | null;
|
|
138
138
|
}>;
|
|
139
139
|
declare const updateSubAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -12,19 +12,19 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
12
12
|
scopes: ProjectScopeConfig;
|
|
13
13
|
toolId: string;
|
|
14
14
|
}) => Promise<{
|
|
15
|
+
tenantId: string;
|
|
16
|
+
projectId: string;
|
|
15
17
|
id: string;
|
|
16
18
|
name: string;
|
|
17
19
|
description: string | null;
|
|
18
|
-
credentialReferenceId: string | null;
|
|
19
|
-
createdAt: string;
|
|
20
|
-
updatedAt: string;
|
|
21
|
-
projectId: string;
|
|
22
|
-
tenantId: string;
|
|
23
|
-
headers: Record<string, string> | null;
|
|
24
20
|
config: {
|
|
25
21
|
type: "mcp";
|
|
26
22
|
mcp: ToolMcpConfig;
|
|
27
23
|
};
|
|
24
|
+
credentialReferenceId: string | null;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
headers: Record<string, string> | null;
|
|
28
28
|
credentialScope: string;
|
|
29
29
|
imageUrl: string | null;
|
|
30
30
|
capabilities: ToolServerCapabilities | null;
|
|
@@ -61,19 +61,19 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
61
61
|
};
|
|
62
62
|
}>;
|
|
63
63
|
declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
|
|
64
|
+
tenantId: string;
|
|
65
|
+
projectId: string;
|
|
64
66
|
id: string;
|
|
65
67
|
name: string;
|
|
66
68
|
description: string | null;
|
|
67
|
-
credentialReferenceId: string | null;
|
|
68
|
-
createdAt: string;
|
|
69
|
-
updatedAt: string;
|
|
70
|
-
projectId: string;
|
|
71
|
-
tenantId: string;
|
|
72
|
-
headers: Record<string, string> | null;
|
|
73
69
|
config: {
|
|
74
70
|
type: "mcp";
|
|
75
71
|
mcp: ToolMcpConfig;
|
|
76
72
|
};
|
|
73
|
+
credentialReferenceId: string | null;
|
|
74
|
+
createdAt: string;
|
|
75
|
+
updatedAt: string;
|
|
76
|
+
headers: Record<string, string> | null;
|
|
77
77
|
credentialScope: string;
|
|
78
78
|
imageUrl: string | null;
|
|
79
79
|
capabilities: ToolServerCapabilities | null;
|
|
@@ -116,13 +116,13 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
116
116
|
needsApproval?: boolean;
|
|
117
117
|
}> | null;
|
|
118
118
|
}) => Promise<{
|
|
119
|
+
tenantId: string;
|
|
120
|
+
projectId: string;
|
|
119
121
|
id: string;
|
|
122
|
+
agentId: string;
|
|
120
123
|
createdAt: string;
|
|
121
124
|
updatedAt: string;
|
|
122
|
-
projectId: string;
|
|
123
|
-
tenantId: string;
|
|
124
125
|
toolId: string;
|
|
125
|
-
agentId: string;
|
|
126
126
|
headers: Record<string, string> | null;
|
|
127
127
|
toolPolicies: Record<string, {
|
|
128
128
|
needsApproval?: boolean;
|
|
@@ -135,13 +135,13 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
|
|
|
135
135
|
subAgentId: string;
|
|
136
136
|
toolId: string;
|
|
137
137
|
}) => Promise<{
|
|
138
|
+
tenantId: string;
|
|
139
|
+
projectId: string;
|
|
138
140
|
id: string;
|
|
141
|
+
agentId: string;
|
|
139
142
|
createdAt: string;
|
|
140
143
|
updatedAt: string;
|
|
141
|
-
projectId: string;
|
|
142
|
-
tenantId: string;
|
|
143
144
|
toolId: string;
|
|
144
|
-
agentId: string;
|
|
145
145
|
headers: Record<string, string> | null;
|
|
146
146
|
toolPolicies: Record<string, {
|
|
147
147
|
needsApproval?: boolean;
|
|
@@ -163,13 +163,13 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
163
163
|
}> | null;
|
|
164
164
|
relationId?: string;
|
|
165
165
|
}) => Promise<{
|
|
166
|
+
tenantId: string;
|
|
167
|
+
projectId: string;
|
|
166
168
|
id: string;
|
|
169
|
+
agentId: string;
|
|
167
170
|
createdAt: string;
|
|
168
171
|
updatedAt: string;
|
|
169
|
-
projectId: string;
|
|
170
|
-
tenantId: string;
|
|
171
172
|
toolId: string;
|
|
172
|
-
agentId: string;
|
|
173
173
|
headers: Record<string, string> | null;
|
|
174
174
|
toolPolicies: Record<string, {
|
|
175
175
|
needsApproval?: boolean;
|
|
@@ -183,19 +183,19 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
183
183
|
declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
184
184
|
data: ToolInsert;
|
|
185
185
|
}) => Promise<{
|
|
186
|
+
tenantId: string;
|
|
187
|
+
projectId: string;
|
|
186
188
|
id: string;
|
|
187
189
|
name: string;
|
|
188
190
|
description: string | null;
|
|
189
|
-
credentialReferenceId: string | null;
|
|
190
|
-
createdAt: string;
|
|
191
|
-
updatedAt: string;
|
|
192
|
-
projectId: string;
|
|
193
|
-
tenantId: string;
|
|
194
|
-
headers: Record<string, string> | null;
|
|
195
191
|
config: {
|
|
196
192
|
type: "mcp";
|
|
197
193
|
mcp: ToolMcpConfig;
|
|
198
194
|
};
|
|
195
|
+
credentialReferenceId: string | null;
|
|
196
|
+
createdAt: string;
|
|
197
|
+
updatedAt: string;
|
|
198
|
+
headers: Record<string, string> | null;
|
|
199
199
|
credentialScope: string;
|
|
200
200
|
imageUrl: string | null;
|
|
201
201
|
capabilities: ToolServerCapabilities | null;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { AgentScopeConfig, PaginationConfig } from "../../types/utility.js";
|
|
2
|
+
import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
|
|
3
|
+
import { TriggerInsert, TriggerSelect, TriggerUpdate } from "../../types/entities.js";
|
|
4
|
+
|
|
5
|
+
//#region src/data-access/manage/triggers.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get a trigger by ID (agent-scoped)
|
|
9
|
+
* Uses withBranch to checkout the project's main branch and query using Drizzle ORM,
|
|
10
|
+
* which handles column name mapping automatically.
|
|
11
|
+
*/
|
|
12
|
+
declare const getTriggerById: (db: AgentsManageDatabaseClient) => (params: {
|
|
13
|
+
scopes: AgentScopeConfig;
|
|
14
|
+
triggerId: string;
|
|
15
|
+
/** If true, uses withBranch to read from the project branch. Default: true for non-branch-scoped clients */
|
|
16
|
+
useBranchScope?: boolean;
|
|
17
|
+
}) => Promise<TriggerSelect | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* List all triggers for an agent
|
|
20
|
+
*/
|
|
21
|
+
declare const listTriggers: (db: AgentsManageDatabaseClient) => (params: {
|
|
22
|
+
scopes: AgentScopeConfig;
|
|
23
|
+
}) => Promise<TriggerSelect[]>;
|
|
24
|
+
/**
|
|
25
|
+
* List triggers for an agent with pagination
|
|
26
|
+
*/
|
|
27
|
+
declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params: {
|
|
28
|
+
scopes: AgentScopeConfig;
|
|
29
|
+
pagination?: PaginationConfig;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
data: {
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
inputSchema: Record<string, unknown> | null;
|
|
36
|
+
outputTransform: {
|
|
37
|
+
jmespath?: string;
|
|
38
|
+
objectTransformation?: Record<string, string>;
|
|
39
|
+
} | null;
|
|
40
|
+
messageTemplate: string;
|
|
41
|
+
authentication: unknown;
|
|
42
|
+
signingSecret: string | null;
|
|
43
|
+
name: string;
|
|
44
|
+
description: string | null;
|
|
45
|
+
agentId: string;
|
|
46
|
+
projectId: string;
|
|
47
|
+
tenantId: string;
|
|
48
|
+
id: string;
|
|
49
|
+
}[];
|
|
50
|
+
pagination: {
|
|
51
|
+
page: number;
|
|
52
|
+
limit: number;
|
|
53
|
+
total: number;
|
|
54
|
+
pages: number;
|
|
55
|
+
};
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Create a new trigger (agent-scoped)
|
|
59
|
+
*/
|
|
60
|
+
declare const createTrigger: (db: AgentsManageDatabaseClient) => (params: TriggerInsert) => Promise<TriggerSelect>;
|
|
61
|
+
/**
|
|
62
|
+
* Update a trigger (agent-scoped)
|
|
63
|
+
*/
|
|
64
|
+
declare const updateTrigger: (db: AgentsManageDatabaseClient) => (params: {
|
|
65
|
+
scopes: AgentScopeConfig;
|
|
66
|
+
triggerId: string;
|
|
67
|
+
data: TriggerUpdate;
|
|
68
|
+
}) => Promise<TriggerSelect>;
|
|
69
|
+
/**
|
|
70
|
+
* Delete a trigger (agent-scoped)
|
|
71
|
+
*/
|
|
72
|
+
declare const deleteTrigger: (db: AgentsManageDatabaseClient) => (params: {
|
|
73
|
+
scopes: AgentScopeConfig;
|
|
74
|
+
triggerId: string;
|
|
75
|
+
}) => Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Upsert a trigger (create or update based on existence)
|
|
78
|
+
*/
|
|
79
|
+
declare const upsertTrigger: (db: AgentsManageDatabaseClient) => (params: {
|
|
80
|
+
scopes: AgentScopeConfig;
|
|
81
|
+
data: TriggerInsert;
|
|
82
|
+
}) => Promise<TriggerSelect>;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { createTrigger, deleteTrigger, getTriggerById, listTriggers, listTriggersPaginated, updateTrigger, upsertTrigger };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { triggers } from "../../db/manage/manage-schema.js";
|
|
2
|
+
import { getProjectBranchName, withBranch } from "../../dolt/branch.js";
|
|
3
|
+
import { and, count, desc, eq } from "drizzle-orm";
|
|
4
|
+
|
|
5
|
+
//#region src/data-access/manage/triggers.ts
|
|
6
|
+
/**
|
|
7
|
+
* Get a trigger by ID (agent-scoped)
|
|
8
|
+
* Uses withBranch to checkout the project's main branch and query using Drizzle ORM,
|
|
9
|
+
* which handles column name mapping automatically.
|
|
10
|
+
*/
|
|
11
|
+
const getTriggerById = (db) => async (params) => {
|
|
12
|
+
const { scopes, triggerId, useBranchScope = true } = params;
|
|
13
|
+
if (useBranchScope) {
|
|
14
|
+
const branchName = getProjectBranchName(scopes.tenantId, scopes.projectId);
|
|
15
|
+
try {
|
|
16
|
+
return await withBranch(db)({
|
|
17
|
+
branchName,
|
|
18
|
+
callback: async (txDb) => {
|
|
19
|
+
return await txDb.query.triggers.findFirst({ where: and(eq(triggers.tenantId, scopes.tenantId), eq(triggers.projectId, scopes.projectId), eq(triggers.agentId, scopes.agentId), eq(triggers.id, triggerId)) });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
} catch {}
|
|
23
|
+
}
|
|
24
|
+
return await db.query.triggers.findFirst({ where: and(eq(triggers.tenantId, scopes.tenantId), eq(triggers.projectId, scopes.projectId), eq(triggers.agentId, scopes.agentId), eq(triggers.id, triggerId)) });
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* List all triggers for an agent
|
|
28
|
+
*/
|
|
29
|
+
const listTriggers = (db) => async (params) => {
|
|
30
|
+
return await db.query.triggers.findMany({ where: and(eq(triggers.tenantId, params.scopes.tenantId), eq(triggers.projectId, params.scopes.projectId), eq(triggers.agentId, params.scopes.agentId)) });
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* List triggers for an agent with pagination
|
|
34
|
+
*/
|
|
35
|
+
const listTriggersPaginated = (db) => async (params) => {
|
|
36
|
+
const page = params.pagination?.page || 1;
|
|
37
|
+
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
38
|
+
const offset = (page - 1) * limit;
|
|
39
|
+
const whereClause = and(eq(triggers.tenantId, params.scopes.tenantId), eq(triggers.projectId, params.scopes.projectId), eq(triggers.agentId, params.scopes.agentId));
|
|
40
|
+
const [data, totalResult] = await Promise.all([db.select().from(triggers).where(whereClause).limit(limit).offset(offset).orderBy(desc(triggers.createdAt)), db.select({ count: count() }).from(triggers).where(whereClause)]);
|
|
41
|
+
const total = totalResult[0]?.count || 0;
|
|
42
|
+
return {
|
|
43
|
+
data,
|
|
44
|
+
pagination: {
|
|
45
|
+
page,
|
|
46
|
+
limit,
|
|
47
|
+
total,
|
|
48
|
+
pages: Math.ceil(total / limit)
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Create a new trigger (agent-scoped)
|
|
54
|
+
*/
|
|
55
|
+
const createTrigger = (db) => async (params) => {
|
|
56
|
+
return (await db.insert(triggers).values(params).returning())[0];
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Update a trigger (agent-scoped)
|
|
60
|
+
*/
|
|
61
|
+
const updateTrigger = (db) => async (params) => {
|
|
62
|
+
const updateData = {
|
|
63
|
+
...params.data,
|
|
64
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
65
|
+
};
|
|
66
|
+
return (await db.update(triggers).set(updateData).where(and(eq(triggers.tenantId, params.scopes.tenantId), eq(triggers.projectId, params.scopes.projectId), eq(triggers.agentId, params.scopes.agentId), eq(triggers.id, params.triggerId))).returning())[0];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Delete a trigger (agent-scoped)
|
|
70
|
+
*/
|
|
71
|
+
const deleteTrigger = (db) => async (params) => {
|
|
72
|
+
await db.delete(triggers).where(and(eq(triggers.tenantId, params.scopes.tenantId), eq(triggers.projectId, params.scopes.projectId), eq(triggers.agentId, params.scopes.agentId), eq(triggers.id, params.triggerId)));
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Upsert a trigger (create or update based on existence)
|
|
76
|
+
*/
|
|
77
|
+
const upsertTrigger = (db) => async (params) => {
|
|
78
|
+
const { scopes, data } = params;
|
|
79
|
+
if (await db.query.triggers.findFirst({ where: and(eq(triggers.tenantId, scopes.tenantId), eq(triggers.projectId, scopes.projectId), eq(triggers.agentId, scopes.agentId), eq(triggers.id, data.id)) })) {
|
|
80
|
+
const updateData = {
|
|
81
|
+
...data,
|
|
82
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
83
|
+
};
|
|
84
|
+
return (await db.update(triggers).set(updateData).where(and(eq(triggers.tenantId, scopes.tenantId), eq(triggers.projectId, scopes.projectId), eq(triggers.agentId, scopes.agentId), eq(triggers.id, data.id))).returning())[0];
|
|
85
|
+
}
|
|
86
|
+
return (await db.insert(triggers).values({
|
|
87
|
+
...data,
|
|
88
|
+
tenantId: scopes.tenantId,
|
|
89
|
+
projectId: scopes.projectId,
|
|
90
|
+
agentId: scopes.agentId
|
|
91
|
+
}).returning())[0];
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
//#endregion
|
|
95
|
+
export { createTrigger, deleteTrigger, getTriggerById, listTriggers, listTriggersPaginated, updateTrigger, upsertTrigger };
|
|
@@ -7,49 +7,49 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
7
7
|
scopes: ProjectScopeConfig;
|
|
8
8
|
id: string;
|
|
9
9
|
}) => Promise<{
|
|
10
|
+
tenantId: string;
|
|
11
|
+
projectId: string;
|
|
10
12
|
id: string;
|
|
11
13
|
name: string | null;
|
|
12
|
-
createdAt: string;
|
|
13
|
-
updatedAt: string;
|
|
14
|
-
projectId: string;
|
|
15
|
-
tenantId: string;
|
|
16
14
|
agentId: string;
|
|
17
|
-
expiresAt: string | null;
|
|
18
15
|
publicId: string;
|
|
19
16
|
keyHash: string;
|
|
20
17
|
keyPrefix: string;
|
|
21
18
|
lastUsedAt: string | null;
|
|
19
|
+
expiresAt: string | null;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
updatedAt: string;
|
|
22
22
|
} | undefined>;
|
|
23
23
|
declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
|
|
24
|
+
tenantId: string;
|
|
25
|
+
projectId: string;
|
|
24
26
|
id: string;
|
|
25
27
|
name: string | null;
|
|
26
|
-
createdAt: string;
|
|
27
|
-
updatedAt: string;
|
|
28
|
-
projectId: string;
|
|
29
|
-
tenantId: string;
|
|
30
28
|
agentId: string;
|
|
31
|
-
expiresAt: string | null;
|
|
32
29
|
publicId: string;
|
|
33
30
|
keyHash: string;
|
|
34
31
|
keyPrefix: string;
|
|
35
32
|
lastUsedAt: string | null;
|
|
33
|
+
expiresAt: string | null;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
36
|
} | undefined>;
|
|
37
37
|
declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
|
|
38
38
|
scopes: ProjectScopeConfig;
|
|
39
39
|
agentId?: string;
|
|
40
40
|
}) => Promise<{
|
|
41
|
+
tenantId: string;
|
|
42
|
+
projectId: string;
|
|
41
43
|
id: string;
|
|
42
44
|
name: string | null;
|
|
43
|
-
createdAt: string;
|
|
44
|
-
updatedAt: string;
|
|
45
|
-
projectId: string;
|
|
46
|
-
tenantId: string;
|
|
47
45
|
agentId: string;
|
|
48
|
-
expiresAt: string | null;
|
|
49
46
|
publicId: string;
|
|
50
47
|
keyHash: string;
|
|
51
48
|
keyPrefix: string;
|
|
52
49
|
lastUsedAt: string | null;
|
|
50
|
+
expiresAt: string | null;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
53
|
}[]>;
|
|
54
54
|
declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
55
55
|
scopes: ProjectScopeConfig;
|
|
@@ -65,18 +65,18 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
65
65
|
};
|
|
66
66
|
}>;
|
|
67
67
|
declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
|
|
68
|
+
tenantId: string;
|
|
69
|
+
projectId: string;
|
|
68
70
|
id: string;
|
|
69
71
|
name: string | null;
|
|
70
|
-
createdAt: string;
|
|
71
|
-
updatedAt: string;
|
|
72
|
-
projectId: string;
|
|
73
|
-
tenantId: string;
|
|
74
72
|
agentId: string;
|
|
75
|
-
expiresAt: string | null;
|
|
76
73
|
publicId: string;
|
|
77
74
|
keyHash: string;
|
|
78
75
|
keyPrefix: string;
|
|
79
76
|
lastUsedAt: string | null;
|
|
77
|
+
expiresAt: string | null;
|
|
78
|
+
createdAt: string;
|
|
79
|
+
updatedAt: string;
|
|
80
80
|
}>;
|
|
81
81
|
declare const updateApiKey: (db: AgentsRunDatabaseClient) => (params: {
|
|
82
82
|
scopes: ProjectScopeConfig;
|