@inkeep/agents-core 0.75.4 → 0.77.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 (59) hide show
  1. package/dist/auth/auth.js +3 -0
  2. package/dist/auth/sso-issuer-discovery.d.ts +50 -0
  3. package/dist/auth/sso-issuer-discovery.js +85 -0
  4. package/dist/constants/allowed-file-formats.d.ts +3 -1
  5. package/dist/constants/allowed-file-formats.js +3 -2
  6. package/dist/constants/index.d.ts +2 -2
  7. package/dist/constants/schema-validation/defaults.d.ts +1 -1
  8. package/dist/constants/schema-validation/defaults.js +1 -1
  9. package/dist/constants/schema-validation/index.d.ts +1 -1
  10. package/dist/data-access/index.d.ts +2 -2
  11. package/dist/data-access/index.js +2 -2
  12. package/dist/data-access/manage/agents.d.ts +26 -26
  13. package/dist/data-access/manage/artifactComponents.d.ts +2 -2
  14. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  15. package/dist/data-access/manage/dataComponents.d.ts +2 -2
  16. package/dist/data-access/manage/functionTools.d.ts +6 -6
  17. package/dist/data-access/manage/skills.d.ts +4 -4
  18. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  19. package/dist/data-access/manage/subAgentRelations.d.ts +12 -12
  20. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
  21. package/dist/data-access/manage/subAgents.d.ts +6 -6
  22. package/dist/data-access/manage/tools.d.ts +15 -15
  23. package/dist/data-access/manage/triggers.d.ts +5 -5
  24. package/dist/data-access/manage/webhookDestinations.d.ts +6 -4
  25. package/dist/data-access/manage/webhookDestinations.js +13 -15
  26. package/dist/data-access/runtime/apiKeys.d.ts +4 -4
  27. package/dist/data-access/runtime/apps.d.ts +2 -2
  28. package/dist/data-access/runtime/auth.d.ts +4 -1
  29. package/dist/data-access/runtime/auth.js +5 -1
  30. package/dist/data-access/runtime/conversations.d.ts +9 -8
  31. package/dist/data-access/runtime/conversations.js +8 -1
  32. package/dist/data-access/runtime/events.d.ts +1 -1
  33. package/dist/data-access/runtime/feedback.d.ts +2 -2
  34. package/dist/data-access/runtime/messages.d.ts +6 -6
  35. package/dist/data-access/runtime/tasks.d.ts +1 -1
  36. package/dist/db/manage/manage-schema.d.ts +387 -387
  37. package/dist/db/runtime/runtime-schema.d.ts +405 -405
  38. package/dist/external-fetch/external-file-downloader.d.ts +14 -0
  39. package/dist/external-fetch/external-file-downloader.js +146 -0
  40. package/dist/external-fetch/file-content-security.d.ts +18 -0
  41. package/dist/external-fetch/file-content-security.js +81 -0
  42. package/dist/external-fetch/file-security-constants.d.ts +12 -0
  43. package/dist/external-fetch/file-security-constants.js +16 -0
  44. package/dist/external-fetch/file-security-errors.d.ts +96 -0
  45. package/dist/external-fetch/file-security-errors.js +154 -0
  46. package/dist/external-fetch/file-url-security.d.ts +7 -0
  47. package/dist/external-fetch/file-url-security.js +75 -0
  48. package/dist/external-fetch/index.d.ts +6 -0
  49. package/dist/external-fetch/index.js +7 -0
  50. package/dist/index.d.ts +2 -2
  51. package/dist/index.js +2 -2
  52. package/dist/text-attachments/index.d.ts +2 -0
  53. package/dist/text-attachments/index.js +3 -0
  54. package/dist/text-attachments/text-document-attachments.d.ts +40 -0
  55. package/dist/text-attachments/text-document-attachments.js +86 -0
  56. package/dist/validation/schemas/skills.d.ts +29 -29
  57. package/dist/validation/schemas.d.ts +352 -352
  58. package/dist/validation/schemas.js +5 -3
  59. package/package.json +12 -1
@@ -61,29 +61,27 @@ const listWebhookDestinationsPaginated = (db) => async (params) => {
61
61
  }
62
62
  };
63
63
  };
64
- const listWebhookDestinationsForEvent = (db) => async (params) => {
65
- const { scopes, eventType, agentId } = params;
66
- const filtered = (await db.select({
64
+ const listEnabledWebhookDestinations = (db) => async (params) => {
65
+ const { scopes, agentId } = params;
66
+ const rows = await db.select({
67
67
  dest: webhookDestinations,
68
68
  scopedAgentId: webhookDestinationAgents.agentId
69
- }).from(webhookDestinations).leftJoin(webhookDestinationAgents, and(eq(webhookDestinationAgents.tenantId, webhookDestinations.tenantId), eq(webhookDestinationAgents.projectId, webhookDestinations.projectId), eq(webhookDestinationAgents.webhookDestinationId, webhookDestinations.id))).where(and(projectScopedWhere(webhookDestinations, scopes), eq(webhookDestinations.enabled, true)))).filter((row) => {
70
- const types = row.dest.eventTypes;
71
- return Array.isArray(types) && types.includes(eventType);
72
- });
73
- if (filtered.length === 0) return [];
69
+ }).from(webhookDestinations).leftJoin(webhookDestinationAgents, and(eq(webhookDestinationAgents.tenantId, webhookDestinations.tenantId), eq(webhookDestinationAgents.projectId, webhookDestinations.projectId), eq(webhookDestinationAgents.webhookDestinationId, webhookDestinations.id))).where(and(projectScopedWhere(webhookDestinations, scopes), eq(webhookDestinations.enabled, true)));
70
+ if (rows.length === 0) return [];
74
71
  const destMap = /* @__PURE__ */ new Map();
75
- for (const row of filtered) {
72
+ for (const row of rows) {
76
73
  const existing = destMap.get(row.dest.id);
77
74
  if (existing) {
78
- if (row.scopedAgentId) existing.agents.push(row.scopedAgentId);
75
+ if (row.scopedAgentId) existing.agentIds.push(row.scopedAgentId);
79
76
  } else destMap.set(row.dest.id, {
80
77
  dest: row.dest,
81
- agents: row.scopedAgentId ? [row.scopedAgentId] : []
78
+ agentIds: row.scopedAgentId ? [row.scopedAgentId] : []
82
79
  });
83
80
  }
84
- const results = [];
85
- for (const { dest, agents } of destMap.values()) if (agents.length === 0 || agents.includes(agentId)) results.push(dest);
86
- return results;
81
+ return Array.from(destMap.values()).filter(({ agentIds }) => agentIds.length === 0 || agentIds.includes(agentId)).map(({ dest, agentIds }) => ({
82
+ ...dest,
83
+ agentIds
84
+ }));
87
85
  };
88
86
  const createWebhookDestination = (db) => async (params) => {
89
87
  return (await db.insert(webhookDestinations).values(params).returning())[0];
@@ -114,4 +112,4 @@ const setWebhookDestinationAgentIds = (db) => async (params) => {
114
112
  };
115
113
 
116
114
  //#endregion
117
- export { createWebhookDestination, deleteWebhookDestination, getWebhookDestinationAgentIds, getWebhookDestinationById, listWebhookDestinationsForEvent, listWebhookDestinationsPaginated, setWebhookDestinationAgentIds, updateWebhookDestination };
115
+ export { createWebhookDestination, deleteWebhookDestination, getWebhookDestinationAgentIds, getWebhookDestinationById, listEnabledWebhookDestinations, listWebhookDestinationsPaginated, setWebhookDestinationAgentIds, updateWebhookDestination };
@@ -13,9 +13,9 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
15
  expiresAt: string | null;
16
- agentId: string;
17
16
  projectId: string;
18
17
  tenantId: string;
18
+ agentId: string;
19
19
  publicId: string;
20
20
  keyHash: string;
21
21
  keyPrefix: string;
@@ -27,9 +27,9 @@ declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: s
27
27
  createdAt: string;
28
28
  updatedAt: string;
29
29
  expiresAt: string | null;
30
- agentId: string;
31
30
  projectId: string;
32
31
  tenantId: string;
32
+ agentId: string;
33
33
  publicId: string;
34
34
  keyHash: string;
35
35
  keyPrefix: string;
@@ -44,9 +44,9 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
44
44
  createdAt: string;
45
45
  updatedAt: string;
46
46
  expiresAt: string | null;
47
- agentId: string;
48
47
  projectId: string;
49
48
  tenantId: string;
49
+ agentId: string;
50
50
  publicId: string;
51
51
  keyHash: string;
52
52
  keyPrefix: string;
@@ -71,9 +71,9 @@ declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInse
71
71
  createdAt: string;
72
72
  updatedAt: string;
73
73
  expiresAt: string | null;
74
- agentId: string;
75
74
  projectId: string;
76
75
  tenantId: string;
76
+ agentId: string;
77
77
  publicId: string;
78
78
  keyHash: string;
79
79
  keyPrefix: string;
@@ -12,9 +12,9 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
12
12
  updatedAt: string;
13
13
  description: string | null;
14
14
  enabled: boolean;
15
- prompt: string | null;
16
15
  projectId: string | null;
17
16
  tenantId: string | null;
17
+ prompt: string | null;
18
18
  config: {
19
19
  type: "web_client";
20
20
  webClient: {
@@ -81,9 +81,9 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
81
81
  updatedAt: string;
82
82
  description: string | null;
83
83
  enabled: boolean;
84
- prompt: string | null;
85
84
  projectId: string | null;
86
85
  tenantId: string | null;
86
+ prompt: string | null;
87
87
  config: {
88
88
  type: "web_client";
89
89
  webClient: {
@@ -8,6 +8,9 @@ declare const queryHasCredentialAccount: (db: AgentsRunDatabaseClient) => (userI
8
8
  declare const querySsoProviderIssuers: (db: AgentsRunDatabaseClient) => () => Promise<{
9
9
  issuer: string;
10
10
  }[]>;
11
+ declare const querySsoProviderById: (db: AgentsRunDatabaseClient) => (providerId: string) => Promise<{
12
+ issuer: string;
13
+ } | undefined>;
11
14
  declare const querySsoProviderIds: (db: AgentsRunDatabaseClient) => () => Promise<string[]>;
12
15
  declare const queryOrgAllowedAuthMethods: (db: AgentsRunDatabaseClient) => (orgId: string) => Promise<{
13
16
  allowedAuthMethods: string | null;
@@ -15,4 +18,4 @@ declare const queryOrgAllowedAuthMethods: (db: AgentsRunDatabaseClient) => (orgI
15
18
  declare const queryMemberExists: (db: AgentsRunDatabaseClient) => (userId: string, organizationId: string) => Promise<boolean>;
16
19
  declare const queryPendingInvitationExists: (db: AgentsRunDatabaseClient) => (email: string, organizationId: string) => Promise<boolean>;
17
20
  //#endregion
18
- export { getInitialOrganization, queryHasCredentialAccount, queryMemberExists, queryOrgAllowedAuthMethods, queryPendingInvitationExists, querySsoProviderIds, querySsoProviderIssuers };
21
+ export { getInitialOrganization, queryHasCredentialAccount, queryMemberExists, queryOrgAllowedAuthMethods, queryPendingInvitationExists, querySsoProviderById, querySsoProviderIds, querySsoProviderIssuers };
@@ -13,6 +13,10 @@ const queryHasCredentialAccount = (db) => async (userId) => {
13
13
  const querySsoProviderIssuers = (db) => async () => {
14
14
  return db.select({ issuer: ssoProvider.issuer }).from(ssoProvider);
15
15
  };
16
+ const querySsoProviderById = (db) => async (providerId) => {
17
+ const [row] = await db.select({ issuer: ssoProvider.issuer }).from(ssoProvider).where(eq(ssoProvider.providerId, providerId)).limit(1);
18
+ return row;
19
+ };
16
20
  const querySsoProviderIds = (db) => async () => {
17
21
  return (await db.select({ providerId: ssoProvider.providerId }).from(ssoProvider)).map((r) => r.providerId);
18
22
  };
@@ -30,4 +34,4 @@ const queryPendingInvitationExists = (db) => async (email, organizationId) => {
30
34
  };
31
35
 
32
36
  //#endregion
33
- export { getInitialOrganization, queryHasCredentialAccount, queryMemberExists, queryOrgAllowedAuthMethods, queryPendingInvitationExists, querySsoProviderIds, querySsoProviderIssuers };
37
+ export { getInitialOrganization, queryHasCredentialAccount, queryMemberExists, queryOrgAllowedAuthMethods, queryPendingInvitationExists, querySsoProviderById, querySsoProviderIds, querySsoProviderIssuers };
@@ -9,6 +9,7 @@ import { ConversationInsert, ConversationSelect, ConversationUpdate, MessageSele
9
9
  declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
10
10
  scopes: ProjectScopeConfig;
11
11
  userId?: string;
12
+ agentIds?: string[];
12
13
  pagination?: PaginationConfig;
13
14
  }) => Promise<{
14
15
  conversations: ConversationSelect[];
@@ -25,14 +26,14 @@ declare const createConversation: (db: AgentsRunDatabaseClient) => (params: Conv
25
26
  } | null;
26
27
  userId: string | null;
27
28
  metadata: ConversationMetadata | null;
28
- agentId: string | null;
29
29
  projectId: string;
30
30
  tenantId: string;
31
31
  properties: Record<string, unknown> | null;
32
32
  title: string | null;
33
- userProperties: Record<string, unknown> | null;
33
+ agentId: string | null;
34
34
  activeSubAgentId: string;
35
35
  lastContextResolution: string | null;
36
+ userProperties: Record<string, unknown> | null;
36
37
  }>;
37
38
  declare const updateConversation: (db: AgentsRunDatabaseClient) => (params: {
38
39
  scopes: ProjectScopeConfig;
@@ -100,14 +101,14 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
100
101
  } | null;
101
102
  userId: string | null;
102
103
  metadata: ConversationMetadata | null;
103
- agentId: string | null;
104
104
  projectId: string;
105
105
  tenantId: string;
106
106
  properties: Record<string, unknown> | null;
107
107
  title: string | null;
108
- userProperties: Record<string, unknown> | null;
108
+ agentId: string | null;
109
109
  activeSubAgentId: string;
110
110
  lastContextResolution: string | null;
111
+ userProperties: Record<string, unknown> | null;
111
112
  } | undefined>;
112
113
  declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input: ConversationInsert) => Promise<{
113
114
  activeSubAgentId: string;
@@ -140,14 +141,14 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
140
141
  } | null;
141
142
  userId: string | null;
142
143
  metadata: ConversationMetadata | null;
143
- agentId: string | null;
144
144
  projectId: string;
145
145
  tenantId: string;
146
146
  properties: Record<string, unknown> | null;
147
147
  title: string | null;
148
- userProperties: Record<string, unknown> | null;
148
+ agentId: string | null;
149
149
  activeSubAgentId: string;
150
150
  lastContextResolution: string | null;
151
+ userProperties: Record<string, unknown> | null;
151
152
  }>;
152
153
  /**
153
154
  * Get conversation history with filtering and context management
@@ -174,14 +175,14 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
174
175
  } | null;
175
176
  userId: string | null;
176
177
  metadata: ConversationMetadata | null;
177
- agentId: string | null;
178
178
  projectId: string;
179
179
  tenantId: string;
180
180
  properties: Record<string, unknown> | null;
181
181
  title: string | null;
182
- userProperties: Record<string, unknown> | null;
182
+ agentId: string | null;
183
183
  activeSubAgentId: string;
184
184
  lastContextResolution: string | null;
185
+ userProperties: Record<string, unknown> | null;
185
186
  } | undefined>;
186
187
  /**
187
188
  * Set active agent for a conversation (upsert operation)
@@ -8,12 +8,19 @@ import { and, count, desc, eq, inArray } from "drizzle-orm";
8
8
  //#region src/data-access/runtime/conversations.ts
9
9
  const logger = getLogger("data-access/runtime/conversations");
10
10
  const listConversations = (db) => async (params) => {
11
- const { userId, pagination } = params;
11
+ const { userId, agentIds, pagination } = params;
12
12
  const page = pagination?.page || 1;
13
13
  const limit = Math.min(pagination?.limit || 20, 200);
14
14
  const offset = (page - 1) * limit;
15
15
  const whereConditions = [projectScopedWhere(conversations, params.scopes)];
16
16
  if (userId) whereConditions.push(eq(conversations.userId, userId));
17
+ if (agentIds) {
18
+ if (agentIds.length === 0) return {
19
+ conversations: [],
20
+ total: 0
21
+ };
22
+ whereConditions.push(inArray(conversations.agentId, agentIds));
23
+ }
17
24
  const conversationList = await db.select().from(conversations).where(and(...whereConditions)).orderBy(desc(conversations.updatedAt)).limit(limit).offset(offset);
18
25
  const total = (await db.select({ count: count() }).from(conversations).where(and(...whereConditions)))[0]?.count || 0;
19
26
  return {
@@ -12,10 +12,10 @@ declare const createEvent: (db: AgentsRunDatabaseClient) => (params: EventInsert
12
12
  createdAt: string;
13
13
  updatedAt: string;
14
14
  metadata: Record<string, unknown> | null;
15
- agentId: string | null;
16
15
  projectId: string;
17
16
  tenantId: string;
18
17
  properties: Record<string, unknown> | null;
18
+ agentId: string | null;
19
19
  conversationId: string | null;
20
20
  userProperties: Record<string, unknown> | null;
21
21
  messageId: string | null;
@@ -76,8 +76,8 @@ declare const createFeedback: (db: AgentsRunDatabaseClient) => (params: Feedback
76
76
  updatedAt: string;
77
77
  projectId: string;
78
78
  tenantId: string;
79
- details: string | null;
80
79
  conversationId: string;
80
+ details: string | null;
81
81
  messageId: string | null;
82
82
  }>;
83
83
  declare const createFeedbackBulk: (db: AgentsRunDatabaseClient) => (items: FeedbackInsert[]) => Promise<(typeof feedback.$inferSelect)[]>;
@@ -106,8 +106,8 @@ declare const deleteFeedback: (db: AgentsRunDatabaseClient) => (params: {
106
106
  updatedAt: string;
107
107
  projectId: string;
108
108
  tenantId: string;
109
- details: string | null;
110
109
  conversationId: string;
110
+ details: string | null;
111
111
  messageId: string | null;
112
112
  }>;
113
113
  //#endregion
@@ -15,17 +15,17 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
15
15
  updatedAt: string;
16
16
  metadata: MessageMetadata | null;
17
17
  role: string;
18
+ content: MessageContent;
18
19
  projectId: string;
19
20
  tenantId: string;
20
21
  properties: Record<string, unknown> | null;
21
- content: MessageContent;
22
+ conversationId: string;
22
23
  fromSubAgentId: string | null;
23
24
  toSubAgentId: string | null;
24
25
  fromExternalAgentId: string | null;
25
26
  toExternalAgentId: string | null;
26
27
  taskId: string | null;
27
28
  a2aTaskId: string | null;
28
- conversationId: string;
29
29
  userProperties: Record<string, unknown> | null;
30
30
  fromTeamAgentId: string | null;
31
31
  toTeamAgentId: string | null;
@@ -159,17 +159,17 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
159
159
  updatedAt: string;
160
160
  metadata: MessageMetadata | null;
161
161
  role: string;
162
+ content: MessageContent;
162
163
  projectId: string;
163
164
  tenantId: string;
164
165
  properties: Record<string, unknown> | null;
165
- content: MessageContent;
166
+ conversationId: string;
166
167
  fromSubAgentId: string | null;
167
168
  toSubAgentId: string | null;
168
169
  fromExternalAgentId: string | null;
169
170
  toExternalAgentId: string | null;
170
171
  taskId: string | null;
171
172
  a2aTaskId: string | null;
172
- conversationId: string;
173
173
  userProperties: Record<string, unknown> | null;
174
174
  fromTeamAgentId: string | null;
175
175
  toTeamAgentId: string | null;
@@ -216,17 +216,17 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
216
216
  updatedAt: string;
217
217
  metadata: MessageMetadata | null;
218
218
  role: string;
219
+ content: MessageContent;
219
220
  projectId: string;
220
221
  tenantId: string;
221
222
  properties: Record<string, unknown> | null;
222
- content: MessageContent;
223
+ conversationId: string;
223
224
  fromSubAgentId: string | null;
224
225
  toSubAgentId: string | null;
225
226
  fromExternalAgentId: string | null;
226
227
  toExternalAgentId: string | null;
227
228
  taskId: string | null;
228
229
  a2aTaskId: string | null;
229
- conversationId: string;
230
230
  userProperties: Record<string, unknown> | null;
231
231
  fromTeamAgentId: string | null;
232
232
  toTeamAgentId: string | null;
@@ -17,9 +17,9 @@ declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert)
17
17
  } | null;
18
18
  metadata: TaskMetadataConfig | null;
19
19
  status: string;
20
- agentId: string;
21
20
  projectId: string;
22
21
  tenantId: string;
22
+ agentId: string;
23
23
  subAgentId: string;
24
24
  contextId: string;
25
25
  }>;