@inkeep/agents-core 0.0.0-dev-20260304205709 → 0.0.0-dev-20260304214404

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 (47) hide show
  1. package/dist/auth/auth-validation-schemas.d.ts +152 -152
  2. package/dist/auth/auth.d.ts +9 -9
  3. package/dist/auth/auth.js +6 -0
  4. package/dist/auth/permissions.d.ts +9 -9
  5. package/dist/client-exports.d.ts +2 -2
  6. package/dist/client-exports.js +2 -2
  7. package/dist/data-access/index.d.ts +2 -1
  8. package/dist/data-access/index.js +2 -1
  9. package/dist/data-access/manage/agents.d.ts +11 -11
  10. package/dist/data-access/manage/artifactComponents.d.ts +10 -10
  11. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  12. package/dist/data-access/manage/dataComponents.d.ts +6 -6
  13. package/dist/data-access/manage/functionTools.d.ts +12 -12
  14. package/dist/data-access/manage/skills.d.ts +9 -9
  15. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +18 -18
  16. package/dist/data-access/manage/subAgentRelations.d.ts +24 -24
  17. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
  18. package/dist/data-access/manage/subAgents.d.ts +9 -9
  19. package/dist/data-access/manage/tools.d.ts +15 -15
  20. package/dist/data-access/manage/triggers.d.ts +2 -2
  21. package/dist/data-access/runtime/apiKeys.d.ts +12 -12
  22. package/dist/data-access/runtime/conversations.d.ts +16 -16
  23. package/dist/data-access/runtime/messages.d.ts +15 -15
  24. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
  25. package/dist/data-access/runtime/tasks.d.ts +4 -4
  26. package/dist/data-access/runtime/userProfiles.d.ts +14 -0
  27. package/dist/data-access/runtime/userProfiles.js +45 -0
  28. package/dist/db/manage/manage-schema.d.ts +361 -361
  29. package/dist/db/runtime/runtime-schema.d.ts +384 -270
  30. package/dist/db/runtime/runtime-schema.js +14 -1
  31. package/dist/index.d.ts +5 -4
  32. package/dist/index.js +4 -3
  33. package/dist/middleware/no-auth.d.ts +2 -2
  34. package/dist/types/entities.d.ts +7 -2
  35. package/dist/types/index.d.ts +2 -2
  36. package/dist/utils/error.d.ts +51 -51
  37. package/dist/utils/model-factory.d.ts +10 -2
  38. package/dist/utils/model-factory.js +21 -13
  39. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  40. package/dist/validation/index.d.ts +2 -2
  41. package/dist/validation/index.js +2 -2
  42. package/dist/validation/schemas.d.ts +1998 -1753
  43. package/dist/validation/schemas.js +16 -2
  44. package/drizzle/runtime/0019_easy_bedlam.sql +24 -0
  45. package/drizzle/runtime/meta/0019_snapshot.json +4003 -0
  46. package/drizzle/runtime/meta/_journal.json +7 -0
  47. package/package.json +1 -1
@@ -19,11 +19,11 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
19
19
  scopes: ProjectScopeConfig;
20
20
  toolId: string;
21
21
  }) => Promise<{
22
- projectId: string;
23
- tenantId: string;
24
22
  id: string;
25
23
  name: string;
26
24
  description: string | null;
25
+ tenantId: string;
26
+ projectId: string;
27
27
  createdAt: string;
28
28
  updatedAt: string;
29
29
  headers: Record<string, string> | null;
@@ -77,11 +77,11 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
77
77
  };
78
78
  }>;
79
79
  declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
80
- projectId: string;
81
- tenantId: string;
82
80
  id: string;
83
81
  name: string;
84
82
  description: string | null;
83
+ tenantId: string;
84
+ projectId: string;
85
85
  createdAt: string;
86
86
  updatedAt: string;
87
87
  headers: Record<string, string> | null;
@@ -134,10 +134,10 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
134
134
  needsApproval?: boolean;
135
135
  }> | null;
136
136
  }) => Promise<{
137
- agentId: string;
138
- projectId: string;
139
- tenantId: string;
140
137
  id: string;
138
+ tenantId: string;
139
+ projectId: string;
140
+ agentId: string;
141
141
  createdAt: string;
142
142
  updatedAt: string;
143
143
  toolId: string;
@@ -153,10 +153,10 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
153
153
  subAgentId: string;
154
154
  toolId: string;
155
155
  }) => Promise<{
156
- agentId: string;
157
- projectId: string;
158
- tenantId: string;
159
156
  id: string;
157
+ tenantId: string;
158
+ projectId: string;
159
+ agentId: string;
160
160
  createdAt: string;
161
161
  updatedAt: string;
162
162
  toolId: string;
@@ -181,10 +181,10 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
181
181
  }> | null;
182
182
  relationId?: string;
183
183
  }) => Promise<{
184
- agentId: string;
185
- projectId: string;
186
- tenantId: string;
187
184
  id: string;
185
+ tenantId: string;
186
+ projectId: string;
187
+ agentId: string;
188
188
  createdAt: string;
189
189
  updatedAt: string;
190
190
  toolId: string;
@@ -201,11 +201,11 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
201
201
  declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
202
202
  data: ToolInsert;
203
203
  }) => Promise<{
204
- projectId: string;
205
- tenantId: string;
206
204
  id: string;
207
205
  name: string;
208
206
  description: string | null;
207
+ tenantId: string;
208
+ projectId: string;
209
209
  createdAt: string;
210
210
  updatedAt: string;
211
211
  headers: Record<string, string> | null;
@@ -40,13 +40,13 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
40
40
  algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
41
41
  encoding: "hex" | "base64";
42
42
  signature: {
43
- source: "query" | "body" | "header";
43
+ source: "query" | "header" | "body";
44
44
  key: string;
45
45
  prefix?: string | undefined;
46
46
  regex?: string | undefined;
47
47
  };
48
48
  signedComponents: {
49
- source: "literal" | "body" | "header";
49
+ source: "literal" | "header" | "body";
50
50
  required: boolean;
51
51
  key?: string | undefined;
52
52
  value?: string | undefined;
@@ -8,11 +8,11 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
8
8
  scopes: ProjectScopeConfig;
9
9
  id: string;
10
10
  }) => Promise<{
11
- agentId: string;
12
- projectId: string;
13
- tenantId: string;
14
11
  id: string;
15
12
  name: string | null;
13
+ tenantId: string;
14
+ projectId: string;
15
+ agentId: string;
16
16
  createdAt: string;
17
17
  updatedAt: string;
18
18
  expiresAt: string | null;
@@ -22,11 +22,11 @@ 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
- agentId: string;
26
- projectId: string;
27
- tenantId: string;
28
25
  id: string;
29
26
  name: string | null;
27
+ tenantId: string;
28
+ projectId: string;
29
+ agentId: string;
30
30
  createdAt: string;
31
31
  updatedAt: string;
32
32
  expiresAt: string | null;
@@ -39,11 +39,11 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
39
39
  scopes: ProjectScopeConfig;
40
40
  agentId?: string;
41
41
  }) => Promise<{
42
- agentId: string;
43
- projectId: string;
44
- tenantId: string;
45
42
  id: string;
46
43
  name: string | null;
44
+ tenantId: string;
45
+ projectId: string;
46
+ agentId: string;
47
47
  createdAt: string;
48
48
  updatedAt: string;
49
49
  expiresAt: string | null;
@@ -66,11 +66,11 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
66
66
  };
67
67
  }>;
68
68
  declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
69
- agentId: string;
70
- projectId: string;
71
- tenantId: string;
72
69
  id: string;
73
70
  name: string | null;
71
+ tenantId: string;
72
+ projectId: string;
73
+ agentId: string;
74
74
  createdAt: string;
75
75
  updatedAt: string;
76
76
  expiresAt: string | null;
@@ -16,11 +16,10 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
16
16
  total: number;
17
17
  }>;
18
18
  declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
19
- agentId: string | null;
20
- projectId: string;
21
- tenantId: string;
22
- userId: string | null;
23
19
  id: string;
20
+ tenantId: string;
21
+ projectId: string;
22
+ agentId: string | null;
24
23
  title: string | null;
25
24
  createdAt: string;
26
25
  updatedAt: string;
@@ -30,6 +29,7 @@ declare const createConversation: (db: AgentsRunDatabaseClient) => (params: Conv
30
29
  name: string;
31
30
  hash: string;
32
31
  } | null;
32
+ userId: string | null;
33
33
  activeSubAgentId: string;
34
34
  lastContextResolution: string | null;
35
35
  }>;
@@ -85,11 +85,10 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
85
85
  scopes: ProjectScopeConfig;
86
86
  conversationId: string;
87
87
  }) => Promise<{
88
- agentId: string | null;
89
- projectId: string;
90
- tenantId: string;
91
- userId: string | null;
92
88
  id: string;
89
+ tenantId: string;
90
+ projectId: string;
91
+ agentId: string | null;
93
92
  title: string | null;
94
93
  createdAt: string;
95
94
  updatedAt: string;
@@ -99,6 +98,7 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
99
98
  name: string;
100
99
  hash: string;
101
100
  } | null;
101
+ userId: string | null;
102
102
  activeSubAgentId: string;
103
103
  lastContextResolution: string | null;
104
104
  } | undefined>;
@@ -121,11 +121,10 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
121
121
  metadata?: ConversationMetadata | null | undefined;
122
122
  contextConfigId?: string | undefined;
123
123
  } | {
124
- agentId: string | null;
125
- projectId: string;
126
- tenantId: string;
127
- userId: string | null;
128
124
  id: string;
125
+ tenantId: string;
126
+ projectId: string;
127
+ agentId: string | null;
129
128
  title: string | null;
130
129
  createdAt: string;
131
130
  updatedAt: string;
@@ -135,6 +134,7 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
135
134
  name: string;
136
135
  hash: string;
137
136
  } | null;
137
+ userId: string | null;
138
138
  activeSubAgentId: string;
139
139
  lastContextResolution: string | null;
140
140
  }>;
@@ -153,11 +153,10 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
153
153
  scopes: ProjectScopeConfig;
154
154
  conversationId: string;
155
155
  }) => Promise<{
156
- agentId: string | null;
157
- projectId: string;
158
- tenantId: string;
159
- userId: string | null;
160
156
  id: string;
157
+ tenantId: string;
158
+ projectId: string;
159
+ agentId: string | null;
161
160
  title: string | null;
162
161
  createdAt: string;
163
162
  updatedAt: string;
@@ -167,6 +166,7 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
167
166
  name: string;
168
167
  hash: string;
169
168
  } | null;
169
+ userId: string | null;
170
170
  activeSubAgentId: string;
171
171
  lastContextResolution: string | null;
172
172
  } | undefined>;
@@ -10,26 +10,26 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
10
10
  scopes: ProjectScopeConfig;
11
11
  messageId: string;
12
12
  }) => Promise<{
13
- projectId: string;
14
- tenantId: string;
15
13
  id: string;
14
+ tenantId: string;
15
+ projectId: string;
16
16
  createdAt: string;
17
17
  updatedAt: string;
18
18
  metadata: MessageMetadata | null;
19
19
  content: MessageContent;
20
20
  role: string;
21
- conversationId: string;
22
21
  fromSubAgentId: string | null;
23
22
  toSubAgentId: string | null;
24
23
  fromExternalAgentId: string | null;
25
24
  toExternalAgentId: string | null;
25
+ taskId: string | null;
26
+ a2aTaskId: string | null;
27
+ conversationId: string;
26
28
  fromTeamAgentId: string | null;
27
29
  toTeamAgentId: string | null;
28
30
  visibility: string;
29
31
  messageType: string;
30
- taskId: string | null;
31
32
  parentMessageId: string | null;
32
- a2aTaskId: string | null;
33
33
  a2aSessionId: string | null;
34
34
  } | undefined>;
35
35
  declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
@@ -141,26 +141,26 @@ declare const getVisibleMessages: (db: AgentsRunDatabaseClient) => (params: {
141
141
  id: string;
142
142
  }[]>;
143
143
  declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageInsert) => Promise<{
144
- projectId: string;
145
- tenantId: string;
146
144
  id: string;
145
+ tenantId: string;
146
+ projectId: string;
147
147
  createdAt: string;
148
148
  updatedAt: string;
149
149
  metadata: MessageMetadata | null;
150
150
  content: MessageContent;
151
151
  role: string;
152
- conversationId: string;
153
152
  fromSubAgentId: string | null;
154
153
  toSubAgentId: string | null;
155
154
  fromExternalAgentId: string | null;
156
155
  toExternalAgentId: string | null;
156
+ taskId: string | null;
157
+ a2aTaskId: string | null;
158
+ conversationId: string;
157
159
  fromTeamAgentId: string | null;
158
160
  toTeamAgentId: string | null;
159
161
  visibility: string;
160
162
  messageType: string;
161
- taskId: string | null;
162
163
  parentMessageId: string | null;
163
- a2aTaskId: string | null;
164
164
  a2aSessionId: string | null;
165
165
  }>;
166
166
  declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
@@ -194,26 +194,26 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
194
194
  scopes: ProjectScopeConfig;
195
195
  messageId: string;
196
196
  }) => Promise<{
197
- projectId: string;
198
- tenantId: string;
199
197
  id: string;
198
+ tenantId: string;
199
+ projectId: string;
200
200
  createdAt: string;
201
201
  updatedAt: string;
202
202
  metadata: MessageMetadata | null;
203
203
  content: MessageContent;
204
204
  role: string;
205
- conversationId: string;
206
205
  fromSubAgentId: string | null;
207
206
  toSubAgentId: string | null;
208
207
  fromExternalAgentId: string | null;
209
208
  toExternalAgentId: string | null;
209
+ taskId: string | null;
210
+ a2aTaskId: string | null;
211
+ conversationId: string;
210
212
  fromTeamAgentId: string | null;
211
213
  toTeamAgentId: string | null;
212
214
  visibility: string;
213
215
  messageType: string;
214
- taskId: string | null;
215
216
  parentMessageId: string | null;
216
- a2aTaskId: string | null;
217
217
  a2aSessionId: string | null;
218
218
  }>;
219
219
  declare const countMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: {
@@ -34,7 +34,7 @@ declare const listScheduledTriggerInvocationsPaginated: (db: AgentsRunDatabaseCl
34
34
  }) => Promise<{
35
35
  data: {
36
36
  scheduledTriggerId: string;
37
- status: "pending" | "running" | "completed" | "failed" | "cancelled";
37
+ status: "pending" | "failed" | "running" | "completed" | "cancelled";
38
38
  scheduledFor: string;
39
39
  startedAt: string | null;
40
40
  completedAt: string | null;
@@ -174,7 +174,7 @@ declare const listUpcomingInvocationsForAgentPaginated: (db: AgentsRunDatabaseCl
174
174
  }) => Promise<{
175
175
  data: {
176
176
  scheduledTriggerId: string;
177
- status: "pending" | "running" | "completed" | "failed" | "cancelled";
177
+ status: "pending" | "failed" | "running" | "completed" | "cancelled";
178
178
  scheduledFor: string;
179
179
  startedAt: string | null;
180
180
  completedAt: string | null;
@@ -208,7 +208,7 @@ declare const listProjectScheduledTriggerInvocationsPaginated: (db: AgentsRunDat
208
208
  }) => Promise<{
209
209
  data: {
210
210
  scheduledTriggerId: string;
211
- status: "pending" | "running" | "completed" | "failed" | "cancelled";
211
+ status: "pending" | "failed" | "running" | "completed" | "cancelled";
212
212
  scheduledFor: string;
213
213
  startedAt: string | null;
214
214
  completedAt: string | null;
@@ -6,20 +6,20 @@ import { TaskInsert, TaskSelect } from "../../types/entities.js";
6
6
 
7
7
  //#region src/data-access/runtime/tasks.d.ts
8
8
  declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
9
- agentId: string;
10
- projectId: string;
11
- tenantId: string;
12
9
  id: string;
10
+ tenantId: string;
11
+ projectId: string;
12
+ agentId: string;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
15
  metadata: TaskMetadataConfig | null;
16
- subAgentId: string;
17
16
  ref: {
18
17
  type: "commit" | "tag" | "branch";
19
18
  name: string;
20
19
  hash: string;
21
20
  } | null;
22
21
  status: string;
22
+ subAgentId: string;
23
23
  contextId: string;
24
24
  }>;
25
25
  declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
@@ -0,0 +1,14 @@
1
+ import { userProfile } from "../../db/runtime/runtime-schema.js";
2
+ import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
3
+
4
+ //#region src/data-access/runtime/userProfiles.d.ts
5
+ type UserProfile = typeof userProfile.$inferSelect;
6
+ type UpsertUserProfileData = {
7
+ timezone?: string | null;
8
+ attributes?: Record<string, unknown>;
9
+ };
10
+ declare const getUserProfile: (db: AgentsRunDatabaseClient) => (userId: string) => Promise<UserProfile | null>;
11
+ declare const createUserProfileIfNotExists: (db: AgentsRunDatabaseClient) => (userId: string) => Promise<void>;
12
+ declare const upsertUserProfile: (db: AgentsRunDatabaseClient) => (userId: string, data: UpsertUserProfileData) => Promise<UserProfile>;
13
+ //#endregion
14
+ export { UpsertUserProfileData, UserProfile, createUserProfileIfNotExists, getUserProfile, upsertUserProfile };
@@ -0,0 +1,45 @@
1
+ import { userProfile } from "../../db/runtime/runtime-schema.js";
2
+ import { generateId } from "../../utils/conversations.js";
3
+ import "../../utils/index.js";
4
+ import { eq } from "drizzle-orm";
5
+
6
+ //#region src/data-access/runtime/userProfiles.ts
7
+ const getUserProfile = (db) => async (userId) => {
8
+ return (await db.select().from(userProfile).where(eq(userProfile.userId, userId)).limit(1))[0] ?? null;
9
+ };
10
+ const createUserProfileIfNotExists = (db) => async (userId) => {
11
+ const id = generateId();
12
+ const now = (/* @__PURE__ */ new Date()).toISOString();
13
+ await db.insert(userProfile).values({
14
+ id,
15
+ userId,
16
+ timezone: null,
17
+ attributes: {},
18
+ createdAt: now,
19
+ updatedAt: now
20
+ }).onConflictDoNothing();
21
+ };
22
+ const upsertUserProfile = (db) => async (userId, data) => {
23
+ const id = generateId();
24
+ const now = (/* @__PURE__ */ new Date()).toISOString();
25
+ const result = await db.insert(userProfile).values({
26
+ id,
27
+ userId,
28
+ timezone: data.timezone ?? null,
29
+ attributes: data.attributes ?? {},
30
+ createdAt: now,
31
+ updatedAt: now
32
+ }).onConflictDoUpdate({
33
+ target: userProfile.userId,
34
+ set: {
35
+ ...data.timezone !== void 0 && { timezone: data.timezone },
36
+ ...data.attributes !== void 0 && { attributes: data.attributes },
37
+ updatedAt: now
38
+ }
39
+ }).returning();
40
+ if (!result[0]) throw new Error(`Failed to upsert user profile for userId: ${userId}`);
41
+ return result[0];
42
+ };
43
+
44
+ //#endregion
45
+ export { createUserProfileIfNotExists, getUserProfile, upsertUserProfile };