@inkeep/agents-core 0.56.2 → 0.58.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 (44) hide show
  1. package/dist/auth/auth.d.ts +9 -9
  2. package/dist/auth/auth.js +6 -0
  3. package/dist/auth/permissions.d.ts +9 -9
  4. package/dist/client-exports.d.ts +4 -4
  5. package/dist/client-exports.js +2 -2
  6. package/dist/data-access/index.d.ts +2 -1
  7. package/dist/data-access/index.js +2 -1
  8. package/dist/data-access/manage/agents.d.ts +21 -21
  9. package/dist/data-access/manage/artifactComponents.d.ts +14 -14
  10. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  11. package/dist/data-access/manage/dataComponents.d.ts +6 -6
  12. package/dist/data-access/manage/functionTools.d.ts +16 -16
  13. package/dist/data-access/manage/skills.d.ts +18 -18
  14. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
  15. package/dist/data-access/manage/subAgentRelations.d.ts +26 -26
  16. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
  17. package/dist/data-access/manage/subAgents.d.ts +15 -15
  18. package/dist/data-access/manage/tools.d.ts +27 -27
  19. package/dist/data-access/manage/triggers.d.ts +2 -2
  20. package/dist/data-access/runtime/apiKeys.d.ts +20 -20
  21. package/dist/data-access/runtime/apiKeys.js +1 -8
  22. package/dist/data-access/runtime/conversations.d.ts +24 -24
  23. package/dist/data-access/runtime/messages.d.ts +21 -21
  24. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
  25. package/dist/data-access/runtime/tasks.d.ts +6 -6
  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/types/entities.d.ts +7 -2
  34. package/dist/types/index.d.ts +2 -2
  35. package/dist/utils/model-factory.d.ts +10 -2
  36. package/dist/utils/model-factory.js +21 -13
  37. package/dist/validation/index.d.ts +2 -2
  38. package/dist/validation/index.js +2 -2
  39. package/dist/validation/schemas.d.ts +1992 -1749
  40. package/dist/validation/schemas.js +18 -3
  41. package/drizzle/runtime/0019_easy_bedlam.sql +24 -0
  42. package/drizzle/runtime/meta/0019_snapshot.json +4003 -0
  43. package/drizzle/runtime/meta/_journal.json +7 -0
  44. package/package.json +2 -2
@@ -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 };