@inkeep/agents-core 0.70.8 → 0.71.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.
Files changed (46) hide show
  1. package/dist/auth/auth-schema.d.ts +227 -227
  2. package/dist/auth/auth-validation-schemas.d.ts +137 -137
  3. package/dist/auth/permissions.d.ts +9 -9
  4. package/dist/client-exports.d.ts +3 -3
  5. package/dist/client-exports.js +3 -3
  6. package/dist/constants/allowed-file-formats.d.ts +3 -1
  7. package/dist/constants/allowed-file-formats.js +38 -26
  8. package/dist/constants/index.d.ts +3 -3
  9. package/dist/constants/index.js +3 -3
  10. package/dist/constants/signoz-queries.d.ts +6 -2
  11. package/dist/constants/signoz-queries.js +14 -9
  12. package/dist/data-access/index.d.ts +2 -1
  13. package/dist/data-access/index.js +2 -1
  14. package/dist/data-access/manage/agents.d.ts +9 -9
  15. package/dist/data-access/manage/artifactComponents.d.ts +2 -2
  16. package/dist/data-access/manage/functionTools.d.ts +2 -2
  17. package/dist/data-access/manage/skills.d.ts +7 -7
  18. package/dist/data-access/manage/subAgents.d.ts +3 -3
  19. package/dist/data-access/manage/tools.d.ts +6 -6
  20. package/dist/data-access/manage/triggers.d.ts +4 -4
  21. package/dist/data-access/manage/webhookDestinations.d.ts +60 -0
  22. package/dist/data-access/manage/webhookDestinations.js +113 -0
  23. package/dist/data-access/runtime/apiKeys.d.ts +4 -4
  24. package/dist/data-access/runtime/apps.d.ts +11 -11
  25. package/dist/data-access/runtime/feedback.d.ts +2 -2
  26. package/dist/data-access/runtime/messages.d.ts +3 -3
  27. package/dist/data-access/runtime/tasks.d.ts +1 -1
  28. package/dist/db/manage/manage-schema.d.ts +794 -463
  29. package/dist/db/manage/manage-schema.js +93 -2
  30. package/dist/db/runtime/runtime-schema.d.ts +425 -425
  31. package/dist/index.d.ts +6 -5
  32. package/dist/index.js +5 -4
  33. package/dist/setup/setup.d.ts +1 -0
  34. package/dist/setup/setup.js +4 -1
  35. package/dist/types/entities.d.ts +9 -2
  36. package/dist/types/index.d.ts +2 -2
  37. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  38. package/dist/validation/index.d.ts +2 -2
  39. package/dist/validation/index.js +2 -2
  40. package/dist/validation/schemas/skills.d.ts +57 -57
  41. package/dist/validation/schemas.d.ts +2542 -1975
  42. package/dist/validation/schemas.js +67 -3
  43. package/drizzle/manage/0019_hesitant_runaways.sql +28 -0
  44. package/drizzle/manage/meta/0019_snapshot.json +4086 -0
  45. package/drizzle/manage/meta/_journal.json +7 -0
  46. package/package.json +1 -1
@@ -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 };
@@ -12,8 +12,8 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
12
12
  projectId: string;
13
13
  agentId: string;
14
14
  id: string;
15
- createdAt: string;
16
15
  name: string | null;
16
+ createdAt: string;
17
17
  updatedAt: string;
18
18
  expiresAt: string | null;
19
19
  publicId: string;
@@ -26,8 +26,8 @@ declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: s
26
26
  projectId: string;
27
27
  agentId: string;
28
28
  id: string;
29
- createdAt: string;
30
29
  name: string | null;
30
+ createdAt: string;
31
31
  updatedAt: string;
32
32
  expiresAt: string | null;
33
33
  publicId: string;
@@ -43,8 +43,8 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
43
43
  projectId: string;
44
44
  agentId: string;
45
45
  id: string;
46
- createdAt: string;
47
46
  name: string | null;
47
+ createdAt: string;
48
48
  updatedAt: string;
49
49
  expiresAt: string | null;
50
50
  publicId: string;
@@ -70,8 +70,8 @@ declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInse
70
70
  projectId: string;
71
71
  agentId: string;
72
72
  id: string;
73
- createdAt: string;
74
73
  name: string | null;
74
+ createdAt: string;
75
75
  updatedAt: string;
76
76
  expiresAt: string | null;
77
77
  publicId: string;
@@ -5,16 +5,14 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
5
5
 
6
6
  //#region src/data-access/runtime/apps.d.ts
7
7
  declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
8
- type: AppType;
9
8
  tenantId: string | null;
10
9
  projectId: string | null;
10
+ type: AppType;
11
11
  id: string;
12
- createdAt: string;
13
12
  name: string;
13
+ createdAt: string;
14
14
  updatedAt: string;
15
15
  description: string | null;
16
- enabled: boolean;
17
- prompt: string | null;
18
16
  config: {
19
17
  type: "web_client";
20
18
  webClient: {
@@ -22,7 +20,7 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
22
20
  publicKeys: {
23
21
  kid: string;
24
22
  publicKey: string;
25
- algorithm: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "EdDSA";
23
+ algorithm: "EdDSA" | "ES256" | "ES512" | "RS256" | "RS384" | "RS512" | "ES384";
26
24
  addedAt: string;
27
25
  }[];
28
26
  allowAnonymous: boolean;
@@ -45,6 +43,8 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
45
43
  }[] | undefined;
46
44
  };
47
45
  };
46
+ prompt: string | null;
47
+ enabled: boolean;
48
48
  lastUsedAt: string | null;
49
49
  defaultProjectId: string | null;
50
50
  defaultAgentId: string | null;
@@ -74,16 +74,14 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
74
74
  };
75
75
  }>;
76
76
  declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
77
- type: AppType;
78
77
  tenantId: string | null;
79
78
  projectId: string | null;
79
+ type: AppType;
80
80
  id: string;
81
- createdAt: string;
82
81
  name: string;
82
+ createdAt: string;
83
83
  updatedAt: string;
84
84
  description: string | null;
85
- enabled: boolean;
86
- prompt: string | null;
87
85
  config: {
88
86
  type: "web_client";
89
87
  webClient: {
@@ -91,7 +89,7 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
91
89
  publicKeys: {
92
90
  kid: string;
93
91
  publicKey: string;
94
- algorithm: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "EdDSA";
92
+ algorithm: "EdDSA" | "ES256" | "ES512" | "RS256" | "RS384" | "RS512" | "ES384";
95
93
  addedAt: string;
96
94
  }[];
97
95
  allowAnonymous: boolean;
@@ -114,6 +112,8 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
114
112
  }[] | undefined;
115
113
  };
116
114
  };
115
+ prompt: string | null;
116
+ enabled: boolean;
117
117
  lastUsedAt: string | null;
118
118
  defaultProjectId: string | null;
119
119
  defaultAgentId: string | null;
@@ -174,7 +174,7 @@ declare const updateApp: (db: AgentsRunDatabaseClient) => (params: {
174
174
  publicKeys: {
175
175
  kid: string;
176
176
  publicKey: string;
177
- algorithm: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "EdDSA";
177
+ algorithm: "EdDSA" | "ES256" | "ES512" | "RS256" | "RS384" | "RS512" | "ES384";
178
178
  addedAt: string;
179
179
  }[];
180
180
  allowAnonymous: boolean;
@@ -70,9 +70,9 @@ declare const getFeedbackByIds: (db: AgentsRunDatabaseClient) => (params: {
70
70
  agentId: string | null;
71
71
  }[]>;
72
72
  declare const createFeedback: (db: AgentsRunDatabaseClient) => (params: FeedbackInsert) => Promise<{
73
- type: "positive" | "negative";
74
73
  tenantId: string;
75
74
  projectId: string;
75
+ type: "positive" | "negative";
76
76
  id: string;
77
77
  createdAt: string;
78
78
  updatedAt: string;
@@ -100,9 +100,9 @@ declare const deleteFeedback: (db: AgentsRunDatabaseClient) => (params: {
100
100
  scopes: ProjectScopeConfig;
101
101
  feedbackId: string;
102
102
  }) => Promise<{
103
- type: "positive" | "negative";
104
103
  tenantId: string;
105
104
  projectId: string;
105
+ type: "positive" | "negative";
106
106
  id: string;
107
107
  createdAt: string;
108
108
  updatedAt: string;
@@ -13,10 +13,10 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
13
13
  tenantId: string;
14
14
  projectId: string;
15
15
  id: string;
16
- content: MessageContent;
17
16
  createdAt: string;
18
17
  updatedAt: string;
19
18
  metadata: MessageMetadata | null;
19
+ content: MessageContent;
20
20
  role: string;
21
21
  conversationId: string;
22
22
  fromSubAgentId: string | null;
@@ -147,10 +147,10 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
147
147
  tenantId: string;
148
148
  projectId: string;
149
149
  id: string;
150
- content: MessageContent;
151
150
  createdAt: string;
152
151
  updatedAt: string;
153
152
  metadata: MessageMetadata | null;
153
+ content: MessageContent;
154
154
  role: string;
155
155
  conversationId: string;
156
156
  fromSubAgentId: string | null;
@@ -200,10 +200,10 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
200
200
  tenantId: string;
201
201
  projectId: string;
202
202
  id: string;
203
- content: MessageContent;
204
203
  createdAt: string;
205
204
  updatedAt: string;
206
205
  metadata: MessageMetadata | null;
206
+ content: MessageContent;
207
207
  role: string;
208
208
  conversationId: string;
209
209
  fromSubAgentId: string | null;
@@ -12,10 +12,10 @@ declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert)
12
12
  agentId: string;
13
13
  subAgentId: string;
14
14
  id: string;
15
+ status: string;
15
16
  createdAt: string;
16
17
  updatedAt: string;
17
18
  metadata: TaskMetadataConfig | null;
18
- status: string;
19
19
  ref: {
20
20
  type: "commit" | "tag" | "branch";
21
21
  name: string;