@inkeep/agents-core 0.70.8 → 0.72.0
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 +227 -227
- package/dist/auth/auth-validation-schemas.d.ts +137 -137
- package/dist/auth/auth.d.ts +113 -113
- package/dist/auth/password-policy.d.ts +2 -2
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/client-exports.d.ts +3 -3
- package/dist/client-exports.js +3 -3
- package/dist/constants/allowed-file-formats.d.ts +3 -1
- package/dist/constants/allowed-file-formats.js +38 -26
- package/dist/constants/index.d.ts +3 -3
- package/dist/constants/index.js +3 -3
- package/dist/constants/signoz-queries.d.ts +8 -2
- package/dist/constants/signoz-queries.js +17 -10
- package/dist/data-access/index.d.ts +3 -1
- package/dist/data-access/index.js +3 -1
- package/dist/data-access/manage/agents.d.ts +32 -32
- package/dist/data-access/manage/artifactComponents.d.ts +12 -12
- package/dist/data-access/manage/contextConfigs.d.ts +20 -20
- package/dist/data-access/manage/dataComponents.d.ts +8 -8
- package/dist/data-access/manage/functionTools.d.ts +16 -16
- package/dist/data-access/manage/skills.d.ts +11 -11
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentRelations.d.ts +30 -30
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgents.d.ts +12 -12
- package/dist/data-access/manage/tools.d.ts +30 -30
- package/dist/data-access/manage/triggers.d.ts +5 -5
- package/dist/data-access/manage/webhookDestinations.d.ts +60 -0
- package/dist/data-access/manage/webhookDestinations.js +113 -0
- package/dist/data-access/runtime/apiKeys.d.ts +12 -12
- package/dist/data-access/runtime/apps.d.ts +9 -9
- package/dist/data-access/runtime/conversations.d.ts +36 -20
- package/dist/data-access/runtime/conversations.js +30 -8
- package/dist/data-access/runtime/events.d.ts +93 -0
- package/dist/data-access/runtime/events.js +43 -0
- package/dist/data-access/runtime/feedback.d.ts +6 -6
- package/dist/data-access/runtime/messages.d.ts +34 -18
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +4 -4
- package/dist/data-access/runtime/scheduledTriggerUsers.d.ts +1 -1
- package/dist/data-access/runtime/tasks.d.ts +5 -5
- package/dist/db/manage/manage-schema.d.ts +790 -459
- package/dist/db/manage/manage-schema.js +93 -2
- package/dist/db/runtime/runtime-schema.d.ts +769 -437
- package/dist/db/runtime/runtime-schema.js +52 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.js +8 -6
- package/dist/setup/setup.d.ts +1 -0
- package/dist/setup/setup.js +4 -1
- package/dist/types/entities.d.ts +13 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/conversations.d.ts +7 -2
- package/dist/utils/conversations.js +16 -3
- package/dist/utils/error.d.ts +51 -51
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +2 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/dist/validation/schemas/skills.d.ts +48 -48
- package/dist/validation/schemas.d.ts +3337 -2934
- package/dist/validation/schemas.js +124 -8
- package/drizzle/manage/0019_hesitant_runaways.sql +28 -0
- package/drizzle/manage/meta/0019_snapshot.json +4086 -0
- package/drizzle/manage/meta/_journal.json +7 -0
- package/drizzle/runtime/0039_abandoned_old_lace.sql +21 -0
- package/drizzle/runtime/0040_living_forgotten_one.sql +4 -0
- package/drizzle/runtime/meta/0039_snapshot.json +6309 -0
- package/drizzle/runtime/meta/0040_snapshot.json +6333 -0
- package/drizzle/runtime/meta/_journal.json +14 -0
- package/package.json +1 -1
|
@@ -20,20 +20,20 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
20
20
|
scopes: ProjectScopeConfig;
|
|
21
21
|
toolId: string;
|
|
22
22
|
}) => Promise<{
|
|
23
|
-
tenantId: string;
|
|
24
|
-
projectId: string;
|
|
25
23
|
id: string;
|
|
26
24
|
createdAt: string;
|
|
27
25
|
name: string;
|
|
28
26
|
updatedAt: string;
|
|
27
|
+
projectId: string;
|
|
28
|
+
tenantId: string;
|
|
29
29
|
description: string | null;
|
|
30
|
-
|
|
30
|
+
headers: Record<string, string> | null;
|
|
31
31
|
config: {
|
|
32
32
|
type: "mcp";
|
|
33
33
|
mcp: ToolMcpConfig;
|
|
34
34
|
};
|
|
35
|
+
credentialReferenceId: string | null;
|
|
35
36
|
credentialScope: string;
|
|
36
|
-
headers: Record<string, string> | null;
|
|
37
37
|
imageUrl: string | null;
|
|
38
38
|
capabilities: ToolServerCapabilities | null;
|
|
39
39
|
lastError: string | null;
|
|
@@ -78,20 +78,20 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
78
78
|
};
|
|
79
79
|
}>;
|
|
80
80
|
declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
|
|
81
|
-
tenantId: string;
|
|
82
|
-
projectId: string;
|
|
83
81
|
id: string;
|
|
84
82
|
createdAt: string;
|
|
85
83
|
name: string;
|
|
86
84
|
updatedAt: string;
|
|
85
|
+
projectId: string;
|
|
86
|
+
tenantId: string;
|
|
87
87
|
description: string | null;
|
|
88
|
-
|
|
88
|
+
headers: Record<string, string> | null;
|
|
89
89
|
config: {
|
|
90
90
|
type: "mcp";
|
|
91
91
|
mcp: ToolMcpConfig;
|
|
92
92
|
};
|
|
93
|
+
credentialReferenceId: string | null;
|
|
93
94
|
credentialScope: string;
|
|
94
|
-
headers: Record<string, string> | null;
|
|
95
95
|
imageUrl: string | null;
|
|
96
96
|
capabilities: ToolServerCapabilities | null;
|
|
97
97
|
lastError: string | null;
|
|
@@ -135,38 +135,38 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
135
135
|
needsApproval?: boolean;
|
|
136
136
|
}> | null;
|
|
137
137
|
}) => Promise<{
|
|
138
|
-
tenantId: string;
|
|
139
|
-
projectId: string;
|
|
140
|
-
agentId: string;
|
|
141
|
-
subAgentId: string;
|
|
142
|
-
toolId: string;
|
|
143
138
|
id: string;
|
|
144
139
|
createdAt: string;
|
|
145
140
|
updatedAt: string;
|
|
141
|
+
agentId: string;
|
|
142
|
+
projectId: string;
|
|
143
|
+
tenantId: string;
|
|
144
|
+
subAgentId: string;
|
|
145
|
+
toolId: string;
|
|
146
146
|
headers: Record<string, string> | null;
|
|
147
|
-
selectedTools: string[] | null;
|
|
148
147
|
toolPolicies: Record<string, {
|
|
149
148
|
needsApproval?: boolean;
|
|
150
149
|
}> | null;
|
|
150
|
+
selectedTools: string[] | null;
|
|
151
151
|
}>;
|
|
152
152
|
declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
153
153
|
scopes: AgentScopeConfig;
|
|
154
154
|
subAgentId: string;
|
|
155
155
|
toolId: string;
|
|
156
156
|
}) => Promise<{
|
|
157
|
-
tenantId: string;
|
|
158
|
-
projectId: string;
|
|
159
|
-
agentId: string;
|
|
160
|
-
subAgentId: string;
|
|
161
|
-
toolId: string;
|
|
162
157
|
id: string;
|
|
163
158
|
createdAt: string;
|
|
164
159
|
updatedAt: string;
|
|
160
|
+
agentId: string;
|
|
161
|
+
projectId: string;
|
|
162
|
+
tenantId: string;
|
|
163
|
+
subAgentId: string;
|
|
164
|
+
toolId: string;
|
|
165
165
|
headers: Record<string, string> | null;
|
|
166
|
-
selectedTools: string[] | null;
|
|
167
166
|
toolPolicies: Record<string, {
|
|
168
167
|
needsApproval?: boolean;
|
|
169
168
|
}> | null;
|
|
169
|
+
selectedTools: string[] | null;
|
|
170
170
|
}>;
|
|
171
171
|
/**
|
|
172
172
|
* Upsert agent-tool relation (create if it doesn't exist, update if it does)
|
|
@@ -182,19 +182,19 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
182
182
|
}> | null;
|
|
183
183
|
relationId?: string;
|
|
184
184
|
}) => Promise<{
|
|
185
|
-
tenantId: string;
|
|
186
|
-
projectId: string;
|
|
187
|
-
agentId: string;
|
|
188
|
-
subAgentId: string;
|
|
189
|
-
toolId: string;
|
|
190
185
|
id: string;
|
|
191
186
|
createdAt: string;
|
|
192
187
|
updatedAt: string;
|
|
188
|
+
agentId: string;
|
|
189
|
+
projectId: string;
|
|
190
|
+
tenantId: string;
|
|
191
|
+
subAgentId: string;
|
|
192
|
+
toolId: string;
|
|
193
193
|
headers: Record<string, string> | null;
|
|
194
|
-
selectedTools: string[] | null;
|
|
195
194
|
toolPolicies: Record<string, {
|
|
196
195
|
needsApproval?: boolean;
|
|
197
196
|
}> | null;
|
|
197
|
+
selectedTools: string[] | null;
|
|
198
198
|
}>;
|
|
199
199
|
/**
|
|
200
200
|
* Upsert a tool (create if it doesn't exist, update if it does)
|
|
@@ -202,20 +202,20 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
202
202
|
declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
203
203
|
data: ToolInsert;
|
|
204
204
|
}) => Promise<{
|
|
205
|
-
tenantId: string;
|
|
206
|
-
projectId: string;
|
|
207
205
|
id: string;
|
|
208
206
|
createdAt: string;
|
|
209
207
|
name: string;
|
|
210
208
|
updatedAt: string;
|
|
209
|
+
projectId: string;
|
|
210
|
+
tenantId: string;
|
|
211
211
|
description: string | null;
|
|
212
|
-
|
|
212
|
+
headers: Record<string, string> | null;
|
|
213
213
|
config: {
|
|
214
214
|
type: "mcp";
|
|
215
215
|
mcp: ToolMcpConfig;
|
|
216
216
|
};
|
|
217
|
+
credentialReferenceId: string | null;
|
|
217
218
|
credentialScope: string;
|
|
218
|
-
headers: Record<string, string> | null;
|
|
219
219
|
imageUrl: string | null;
|
|
220
220
|
capabilities: ToolServerCapabilities | null;
|
|
221
221
|
lastError: string | null;
|
|
@@ -37,8 +37,8 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
|
|
|
37
37
|
authentication: unknown;
|
|
38
38
|
signingSecretCredentialReferenceId: string | null;
|
|
39
39
|
signatureVerification: {
|
|
40
|
-
algorithm: "
|
|
41
|
-
encoding: "
|
|
40
|
+
algorithm: "md5" | "sha256" | "sha512" | "sha384" | "sha1";
|
|
41
|
+
encoding: "base64" | "hex";
|
|
42
42
|
signature: {
|
|
43
43
|
source: "query" | "header" | "body";
|
|
44
44
|
key: string;
|
|
@@ -131,10 +131,10 @@ declare const createTriggerUser: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
131
131
|
triggerId: string;
|
|
132
132
|
userId: string;
|
|
133
133
|
}) => Promise<{
|
|
134
|
-
tenantId: string;
|
|
135
|
-
projectId: string;
|
|
136
|
-
agentId: string;
|
|
137
134
|
createdAt: string;
|
|
135
|
+
agentId: string;
|
|
136
|
+
projectId: string;
|
|
137
|
+
tenantId: string;
|
|
138
138
|
userId: string;
|
|
139
139
|
triggerId: string;
|
|
140
140
|
}>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
|
|
2
|
+
import { PaginationConfig } from "../../types/utility.js";
|
|
3
|
+
import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
|
|
4
|
+
import { WebhookDestinationInsert, WebhookDestinationSelect, WebhookDestinationUpdate } from "../../types/entities.js";
|
|
5
|
+
|
|
6
|
+
//#region src/data-access/manage/webhookDestinations.d.ts
|
|
7
|
+
declare const getWebhookDestinationById: (db: AgentsManageDatabaseClient) => (params: {
|
|
8
|
+
scopes: ProjectScopeConfig;
|
|
9
|
+
webhookDestinationId: string;
|
|
10
|
+
}) => Promise<WebhookDestinationSelect | undefined>;
|
|
11
|
+
declare const listWebhookDestinationsPaginated: (db: AgentsManageDatabaseClient) => (params: {
|
|
12
|
+
scopes: ProjectScopeConfig;
|
|
13
|
+
pagination?: PaginationConfig;
|
|
14
|
+
agentId?: string;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
data: {
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
url: string;
|
|
21
|
+
eventTypes: string[];
|
|
22
|
+
name: string;
|
|
23
|
+
description: string | null;
|
|
24
|
+
projectId: string;
|
|
25
|
+
tenantId: string;
|
|
26
|
+
id: string;
|
|
27
|
+
}[];
|
|
28
|
+
pagination: {
|
|
29
|
+
page: number;
|
|
30
|
+
limit: number;
|
|
31
|
+
total: number;
|
|
32
|
+
pages: number;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
declare const listWebhookDestinationsForEvent: (db: AgentsManageDatabaseClient) => (params: {
|
|
36
|
+
scopes: ProjectScopeConfig;
|
|
37
|
+
eventType: string;
|
|
38
|
+
agentId: string;
|
|
39
|
+
}) => Promise<WebhookDestinationSelect[]>;
|
|
40
|
+
declare const createWebhookDestination: (db: AgentsManageDatabaseClient) => (params: WebhookDestinationInsert) => Promise<WebhookDestinationSelect>;
|
|
41
|
+
declare const updateWebhookDestination: (db: AgentsManageDatabaseClient) => (params: {
|
|
42
|
+
scopes: ProjectScopeConfig;
|
|
43
|
+
webhookDestinationId: string;
|
|
44
|
+
data: WebhookDestinationUpdate;
|
|
45
|
+
}) => Promise<WebhookDestinationSelect | undefined>;
|
|
46
|
+
declare const deleteWebhookDestination: (db: AgentsManageDatabaseClient) => (params: {
|
|
47
|
+
scopes: ProjectScopeConfig;
|
|
48
|
+
webhookDestinationId: string;
|
|
49
|
+
}) => Promise<boolean>;
|
|
50
|
+
declare const getWebhookDestinationAgentIds: (db: AgentsManageDatabaseClient) => (params: {
|
|
51
|
+
scopes: ProjectScopeConfig;
|
|
52
|
+
webhookDestinationId: string;
|
|
53
|
+
}) => Promise<string[]>;
|
|
54
|
+
declare const setWebhookDestinationAgentIds: (db: AgentsManageDatabaseClient) => (params: {
|
|
55
|
+
scopes: ProjectScopeConfig;
|
|
56
|
+
webhookDestinationId: string;
|
|
57
|
+
agentIds: string[];
|
|
58
|
+
}) => Promise<void>;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { createWebhookDestination, deleteWebhookDestination, getWebhookDestinationAgentIds, getWebhookDestinationById, listWebhookDestinationsForEvent, listWebhookDestinationsPaginated, setWebhookDestinationAgentIds, updateWebhookDestination };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { webhookDestinationAgents, webhookDestinations } from "../../db/manage/manage-schema.js";
|
|
2
|
+
import { generateId } from "../../utils/conversations.js";
|
|
3
|
+
import { projectScopedWhere } from "./scope-helpers.js";
|
|
4
|
+
import { and, count, desc, eq, inArray } from "drizzle-orm";
|
|
5
|
+
|
|
6
|
+
//#region src/data-access/manage/webhookDestinations.ts
|
|
7
|
+
const getWebhookDestinationById = (db) => async (params) => {
|
|
8
|
+
const { scopes, webhookDestinationId } = params;
|
|
9
|
+
return await db.query.webhookDestinations.findFirst({ where: and(projectScopedWhere(webhookDestinations, scopes), eq(webhookDestinations.id, webhookDestinationId)) });
|
|
10
|
+
};
|
|
11
|
+
const listWebhookDestinationsPaginated = (db) => async (params) => {
|
|
12
|
+
const page = params.pagination?.page || 1;
|
|
13
|
+
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
14
|
+
const offset = (page - 1) * limit;
|
|
15
|
+
const baseWhere = projectScopedWhere(webhookDestinations, params.scopes);
|
|
16
|
+
if (!params.agentId) {
|
|
17
|
+
const [data, totalResult] = await Promise.all([db.select().from(webhookDestinations).where(baseWhere).limit(limit).offset(offset).orderBy(desc(webhookDestinations.createdAt)), db.select({ count: count() }).from(webhookDestinations).where(baseWhere)]);
|
|
18
|
+
const total$1 = totalResult[0]?.count || 0;
|
|
19
|
+
return {
|
|
20
|
+
data,
|
|
21
|
+
pagination: {
|
|
22
|
+
page,
|
|
23
|
+
limit,
|
|
24
|
+
total: total$1,
|
|
25
|
+
pages: Math.ceil(total$1 / limit)
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const agentId = params.agentId;
|
|
30
|
+
const allDests = await db.select().from(webhookDestinations).where(baseWhere).orderBy(desc(webhookDestinations.createdAt));
|
|
31
|
+
const destIds = allDests.map((d) => d.id);
|
|
32
|
+
if (destIds.length === 0) return {
|
|
33
|
+
data: [],
|
|
34
|
+
pagination: {
|
|
35
|
+
page,
|
|
36
|
+
limit,
|
|
37
|
+
total: 0,
|
|
38
|
+
pages: 0
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const agentRows = await db.select().from(webhookDestinationAgents).where(and(eq(webhookDestinationAgents.tenantId, params.scopes.tenantId), eq(webhookDestinationAgents.projectId, params.scopes.projectId), inArray(webhookDestinationAgents.webhookDestinationId, destIds)));
|
|
42
|
+
const agentsByDest = /* @__PURE__ */ new Map();
|
|
43
|
+
for (const row of agentRows) {
|
|
44
|
+
const list = agentsByDest.get(row.webhookDestinationId) ?? [];
|
|
45
|
+
list.push(row.agentId);
|
|
46
|
+
agentsByDest.set(row.webhookDestinationId, list);
|
|
47
|
+
}
|
|
48
|
+
const filtered = allDests.filter((dest) => {
|
|
49
|
+
const agents = agentsByDest.get(dest.id);
|
|
50
|
+
return !agents || agents.length === 0 || agents.includes(agentId);
|
|
51
|
+
});
|
|
52
|
+
const total = filtered.length;
|
|
53
|
+
const pages = Math.ceil(total / limit);
|
|
54
|
+
return {
|
|
55
|
+
data: filtered.slice(offset, offset + limit),
|
|
56
|
+
pagination: {
|
|
57
|
+
page,
|
|
58
|
+
limit,
|
|
59
|
+
total,
|
|
60
|
+
pages
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const listWebhookDestinationsForEvent = (db) => async (params) => {
|
|
65
|
+
const { scopes, eventType, agentId } = params;
|
|
66
|
+
const eventMatched = (await db.select().from(webhookDestinations).where(and(projectScopedWhere(webhookDestinations, scopes), eq(webhookDestinations.enabled, true)))).filter((dest) => {
|
|
67
|
+
const types = dest.eventTypes;
|
|
68
|
+
return Array.isArray(types) && types.includes(eventType);
|
|
69
|
+
});
|
|
70
|
+
if (eventMatched.length === 0) return [];
|
|
71
|
+
const destIds = eventMatched.map((d) => d.id);
|
|
72
|
+
const agentRows = await db.select().from(webhookDestinationAgents).where(and(eq(webhookDestinationAgents.tenantId, scopes.tenantId), eq(webhookDestinationAgents.projectId, scopes.projectId), inArray(webhookDestinationAgents.webhookDestinationId, destIds)));
|
|
73
|
+
const agentsByDest = /* @__PURE__ */ new Map();
|
|
74
|
+
for (const row of agentRows) {
|
|
75
|
+
const list = agentsByDest.get(row.webhookDestinationId) ?? [];
|
|
76
|
+
list.push(row.agentId);
|
|
77
|
+
agentsByDest.set(row.webhookDestinationId, list);
|
|
78
|
+
}
|
|
79
|
+
return eventMatched.filter((dest) => {
|
|
80
|
+
const agents = agentsByDest.get(dest.id);
|
|
81
|
+
return !agents || agents.includes(agentId);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const createWebhookDestination = (db) => async (params) => {
|
|
85
|
+
return (await db.insert(webhookDestinations).values(params).returning())[0];
|
|
86
|
+
};
|
|
87
|
+
const updateWebhookDestination = (db) => async (params) => {
|
|
88
|
+
const updateData = {
|
|
89
|
+
...params.data,
|
|
90
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
91
|
+
};
|
|
92
|
+
return (await db.update(webhookDestinations).set(updateData).where(and(projectScopedWhere(webhookDestinations, params.scopes), eq(webhookDestinations.id, params.webhookDestinationId))).returning())[0];
|
|
93
|
+
};
|
|
94
|
+
const deleteWebhookDestination = (db) => async (params) => {
|
|
95
|
+
return (await db.delete(webhookDestinations).where(and(projectScopedWhere(webhookDestinations, params.scopes), eq(webhookDestinations.id, params.webhookDestinationId))).returning()).length > 0;
|
|
96
|
+
};
|
|
97
|
+
const getWebhookDestinationAgentIds = (db) => async (params) => {
|
|
98
|
+
return (await db.select({ agentId: webhookDestinationAgents.agentId }).from(webhookDestinationAgents).where(and(eq(webhookDestinationAgents.tenantId, params.scopes.tenantId), eq(webhookDestinationAgents.projectId, params.scopes.projectId), eq(webhookDestinationAgents.webhookDestinationId, params.webhookDestinationId)))).map((r) => r.agentId);
|
|
99
|
+
};
|
|
100
|
+
const setWebhookDestinationAgentIds = (db) => async (params) => {
|
|
101
|
+
const { scopes, webhookDestinationId, agentIds } = params;
|
|
102
|
+
await db.delete(webhookDestinationAgents).where(and(eq(webhookDestinationAgents.tenantId, scopes.tenantId), eq(webhookDestinationAgents.projectId, scopes.projectId), eq(webhookDestinationAgents.webhookDestinationId, webhookDestinationId)));
|
|
103
|
+
if (agentIds.length > 0) await db.insert(webhookDestinationAgents).values(agentIds.map((agentId) => ({
|
|
104
|
+
id: generateId(),
|
|
105
|
+
tenantId: scopes.tenantId,
|
|
106
|
+
projectId: scopes.projectId,
|
|
107
|
+
webhookDestinationId,
|
|
108
|
+
agentId
|
|
109
|
+
})));
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
export { createWebhookDestination, deleteWebhookDestination, getWebhookDestinationAgentIds, getWebhookDestinationById, listWebhookDestinationsForEvent, listWebhookDestinationsPaginated, setWebhookDestinationAgentIds, updateWebhookDestination };
|
|
@@ -8,13 +8,13 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
8
8
|
scopes: ProjectScopeConfig;
|
|
9
9
|
id: string;
|
|
10
10
|
}) => Promise<{
|
|
11
|
-
tenantId: string;
|
|
12
|
-
projectId: string;
|
|
13
|
-
agentId: string;
|
|
14
11
|
id: string;
|
|
15
12
|
createdAt: string;
|
|
16
13
|
name: string | null;
|
|
17
14
|
updatedAt: string;
|
|
15
|
+
agentId: string;
|
|
16
|
+
projectId: string;
|
|
17
|
+
tenantId: string;
|
|
18
18
|
expiresAt: string | null;
|
|
19
19
|
publicId: string;
|
|
20
20
|
keyHash: string;
|
|
@@ -22,13 +22,13 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
22
22
|
lastUsedAt: string | null;
|
|
23
23
|
} | undefined>;
|
|
24
24
|
declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
|
|
25
|
-
tenantId: string;
|
|
26
|
-
projectId: string;
|
|
27
|
-
agentId: string;
|
|
28
25
|
id: string;
|
|
29
26
|
createdAt: string;
|
|
30
27
|
name: string | null;
|
|
31
28
|
updatedAt: string;
|
|
29
|
+
agentId: string;
|
|
30
|
+
projectId: string;
|
|
31
|
+
tenantId: string;
|
|
32
32
|
expiresAt: string | null;
|
|
33
33
|
publicId: string;
|
|
34
34
|
keyHash: string;
|
|
@@ -39,13 +39,13 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
39
39
|
scopes: ProjectScopeConfig;
|
|
40
40
|
agentId?: string;
|
|
41
41
|
}) => Promise<{
|
|
42
|
-
tenantId: string;
|
|
43
|
-
projectId: string;
|
|
44
|
-
agentId: string;
|
|
45
42
|
id: string;
|
|
46
43
|
createdAt: string;
|
|
47
44
|
name: string | null;
|
|
48
45
|
updatedAt: string;
|
|
46
|
+
agentId: string;
|
|
47
|
+
projectId: string;
|
|
48
|
+
tenantId: string;
|
|
49
49
|
expiresAt: string | null;
|
|
50
50
|
publicId: string;
|
|
51
51
|
keyHash: string;
|
|
@@ -66,13 +66,13 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
66
66
|
};
|
|
67
67
|
}>;
|
|
68
68
|
declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
|
|
69
|
-
tenantId: string;
|
|
70
|
-
projectId: string;
|
|
71
|
-
agentId: string;
|
|
72
69
|
id: string;
|
|
73
70
|
createdAt: string;
|
|
74
71
|
name: string | null;
|
|
75
72
|
updatedAt: string;
|
|
73
|
+
agentId: string;
|
|
74
|
+
projectId: string;
|
|
75
|
+
tenantId: string;
|
|
76
76
|
expiresAt: string | null;
|
|
77
77
|
publicId: string;
|
|
78
78
|
keyHash: string;
|
|
@@ -6,14 +6,14 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
|
|
|
6
6
|
//#region src/data-access/runtime/apps.d.ts
|
|
7
7
|
declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
|
|
8
8
|
type: AppType;
|
|
9
|
-
|
|
10
|
-
projectId: string | null;
|
|
9
|
+
enabled: boolean;
|
|
11
10
|
id: string;
|
|
12
11
|
createdAt: string;
|
|
13
12
|
name: string;
|
|
14
13
|
updatedAt: string;
|
|
14
|
+
projectId: string | null;
|
|
15
|
+
tenantId: string | null;
|
|
15
16
|
description: string | null;
|
|
16
|
-
enabled: boolean;
|
|
17
17
|
prompt: string | null;
|
|
18
18
|
config: {
|
|
19
19
|
type: "web_client";
|
|
@@ -22,7 +22,7 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
|
|
|
22
22
|
publicKeys: {
|
|
23
23
|
kid: string;
|
|
24
24
|
publicKey: string;
|
|
25
|
-
algorithm: "
|
|
25
|
+
algorithm: "EdDSA" | "ES256" | "ES512" | "RS256" | "RS384" | "RS512" | "ES384";
|
|
26
26
|
addedAt: string;
|
|
27
27
|
}[];
|
|
28
28
|
allowAnonymous: boolean;
|
|
@@ -75,14 +75,14 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
75
75
|
}>;
|
|
76
76
|
declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
|
|
77
77
|
type: AppType;
|
|
78
|
-
|
|
79
|
-
projectId: string | null;
|
|
78
|
+
enabled: boolean;
|
|
80
79
|
id: string;
|
|
81
80
|
createdAt: string;
|
|
82
81
|
name: string;
|
|
83
82
|
updatedAt: string;
|
|
83
|
+
projectId: string | null;
|
|
84
|
+
tenantId: string | null;
|
|
84
85
|
description: string | null;
|
|
85
|
-
enabled: boolean;
|
|
86
86
|
prompt: string | null;
|
|
87
87
|
config: {
|
|
88
88
|
type: "web_client";
|
|
@@ -91,7 +91,7 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
|
|
|
91
91
|
publicKeys: {
|
|
92
92
|
kid: string;
|
|
93
93
|
publicKey: string;
|
|
94
|
-
algorithm: "
|
|
94
|
+
algorithm: "EdDSA" | "ES256" | "ES512" | "RS256" | "RS384" | "RS512" | "ES384";
|
|
95
95
|
addedAt: string;
|
|
96
96
|
}[];
|
|
97
97
|
allowAnonymous: boolean;
|
|
@@ -174,7 +174,7 @@ declare const updateApp: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
174
174
|
publicKeys: {
|
|
175
175
|
kid: string;
|
|
176
176
|
publicKey: string;
|
|
177
|
-
algorithm: "
|
|
177
|
+
algorithm: "EdDSA" | "ES256" | "ES512" | "RS256" | "RS384" | "RS512" | "ES384";
|
|
178
178
|
addedAt: string;
|
|
179
179
|
}[];
|
|
180
180
|
allowAnonymous: boolean;
|
|
@@ -15,20 +15,22 @@ 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;
|
|
20
|
-
agentId: string | null;
|
|
21
18
|
id: string;
|
|
22
19
|
createdAt: string;
|
|
23
20
|
updatedAt: string;
|
|
24
|
-
|
|
21
|
+
agentId: string | null;
|
|
22
|
+
projectId: string;
|
|
23
|
+
tenantId: string;
|
|
24
|
+
properties: Record<string, unknown> | null;
|
|
25
25
|
title: string | null;
|
|
26
|
-
|
|
26
|
+
metadata: ConversationMetadata | null;
|
|
27
27
|
ref: {
|
|
28
28
|
type: "commit" | "tag" | "branch";
|
|
29
29
|
name: string;
|
|
30
30
|
hash: string;
|
|
31
31
|
} | null;
|
|
32
|
+
userId: string | null;
|
|
33
|
+
userProperties: Record<string, unknown> | null;
|
|
32
34
|
activeSubAgentId: string;
|
|
33
35
|
lastContextResolution: string | null;
|
|
34
36
|
}>;
|
|
@@ -50,6 +52,8 @@ declare const updateConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
50
52
|
title: string | null;
|
|
51
53
|
lastContextResolution: string | null;
|
|
52
54
|
metadata: ConversationMetadata | null;
|
|
55
|
+
userProperties: Record<string, unknown> | null;
|
|
56
|
+
properties: Record<string, unknown> | null;
|
|
53
57
|
projectId: string;
|
|
54
58
|
tenantId: string;
|
|
55
59
|
id: string;
|
|
@@ -76,6 +80,8 @@ declare const updateConversationActiveSubAgent: (db: AgentsRunDatabaseClient) =>
|
|
|
76
80
|
title: string | null;
|
|
77
81
|
lastContextResolution: string | null;
|
|
78
82
|
metadata: ConversationMetadata | null;
|
|
83
|
+
userProperties: Record<string, unknown> | null;
|
|
84
|
+
properties: Record<string, unknown> | null;
|
|
79
85
|
projectId: string;
|
|
80
86
|
tenantId: string;
|
|
81
87
|
id: string;
|
|
@@ -84,20 +90,22 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
84
90
|
scopes: ProjectScopeConfig;
|
|
85
91
|
conversationId: string;
|
|
86
92
|
}) => Promise<{
|
|
87
|
-
tenantId: string;
|
|
88
|
-
projectId: string;
|
|
89
|
-
agentId: string | null;
|
|
90
93
|
id: string;
|
|
91
94
|
createdAt: string;
|
|
92
95
|
updatedAt: string;
|
|
93
|
-
|
|
96
|
+
agentId: string | null;
|
|
97
|
+
projectId: string;
|
|
98
|
+
tenantId: string;
|
|
99
|
+
properties: Record<string, unknown> | null;
|
|
94
100
|
title: string | null;
|
|
95
|
-
|
|
101
|
+
metadata: ConversationMetadata | null;
|
|
96
102
|
ref: {
|
|
97
103
|
type: "commit" | "tag" | "branch";
|
|
98
104
|
name: string;
|
|
99
105
|
hash: string;
|
|
100
106
|
} | null;
|
|
107
|
+
userId: string | null;
|
|
108
|
+
userProperties: Record<string, unknown> | null;
|
|
101
109
|
activeSubAgentId: string;
|
|
102
110
|
lastContextResolution: string | null;
|
|
103
111
|
} | undefined>;
|
|
@@ -119,21 +127,25 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
119
127
|
lastContextResolution?: string | null | undefined;
|
|
120
128
|
metadata?: ConversationMetadata | null | undefined;
|
|
121
129
|
contextConfigId?: string | undefined;
|
|
130
|
+
userProperties?: Record<string, unknown> | null | undefined;
|
|
131
|
+
properties?: Record<string, unknown> | null | undefined;
|
|
122
132
|
} | {
|
|
123
|
-
tenantId: string;
|
|
124
|
-
projectId: string;
|
|
125
|
-
agentId: string | null;
|
|
126
133
|
id: string;
|
|
127
134
|
createdAt: string;
|
|
128
135
|
updatedAt: string;
|
|
129
|
-
|
|
136
|
+
agentId: string | null;
|
|
137
|
+
projectId: string;
|
|
138
|
+
tenantId: string;
|
|
139
|
+
properties: Record<string, unknown> | null;
|
|
130
140
|
title: string | null;
|
|
131
|
-
|
|
141
|
+
metadata: ConversationMetadata | null;
|
|
132
142
|
ref: {
|
|
133
143
|
type: "commit" | "tag" | "branch";
|
|
134
144
|
name: string;
|
|
135
145
|
hash: string;
|
|
136
146
|
} | null;
|
|
147
|
+
userId: string | null;
|
|
148
|
+
userProperties: Record<string, unknown> | null;
|
|
137
149
|
activeSubAgentId: string;
|
|
138
150
|
lastContextResolution: string | null;
|
|
139
151
|
}>;
|
|
@@ -152,20 +164,22 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
152
164
|
scopes: ProjectScopeConfig;
|
|
153
165
|
conversationId: string;
|
|
154
166
|
}) => Promise<{
|
|
155
|
-
tenantId: string;
|
|
156
|
-
projectId: string;
|
|
157
|
-
agentId: string | null;
|
|
158
167
|
id: string;
|
|
159
168
|
createdAt: string;
|
|
160
169
|
updatedAt: string;
|
|
161
|
-
|
|
170
|
+
agentId: string | null;
|
|
171
|
+
projectId: string;
|
|
172
|
+
tenantId: string;
|
|
173
|
+
properties: Record<string, unknown> | null;
|
|
162
174
|
title: string | null;
|
|
163
|
-
|
|
175
|
+
metadata: ConversationMetadata | null;
|
|
164
176
|
ref: {
|
|
165
177
|
type: "commit" | "tag" | "branch";
|
|
166
178
|
name: string;
|
|
167
179
|
hash: string;
|
|
168
180
|
} | null;
|
|
181
|
+
userId: string | null;
|
|
182
|
+
userProperties: Record<string, unknown> | null;
|
|
169
183
|
activeSubAgentId: string;
|
|
170
184
|
lastContextResolution: string | null;
|
|
171
185
|
} | undefined>;
|
|
@@ -180,6 +194,8 @@ declare const setActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
180
194
|
ref: ResolvedRef;
|
|
181
195
|
userId?: string;
|
|
182
196
|
metadata?: ConversationMetadata;
|
|
197
|
+
userProperties?: Record<string, unknown> | null;
|
|
198
|
+
properties?: Record<string, unknown> | null;
|
|
183
199
|
}) => Promise<void>;
|
|
184
200
|
declare const setActiveAgentForThread: (db: AgentsRunDatabaseClient) => ({
|
|
185
201
|
scopes,
|