@inkeep/agents-core 0.50.5 → 0.51.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 +139 -105
- package/dist/auth/auth-schema.js +3 -1
- package/dist/auth/auth-validation-schemas.d.ts +216 -148
- package/dist/auth/auth.d.ts +55 -23
- package/dist/auth/auth.js +22 -8
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/data-access/index.d.ts +3 -3
- package/dist/data-access/index.js +3 -3
- package/dist/data-access/runtime/apiKeys.d.ts +4 -4
- package/dist/data-access/runtime/conversations.d.ts +11 -11
- package/dist/data-access/runtime/messages.d.ts +12 -12
- package/dist/data-access/runtime/organizations.d.ts +11 -1
- package/dist/data-access/runtime/organizations.js +27 -1
- package/dist/data-access/runtime/tasks.d.ts +5 -5
- package/dist/data-access/runtime/users.d.ts +9 -1
- package/dist/data-access/runtime/users.js +20 -3
- package/dist/data-access/runtime/workAppSlack.d.ts +1 -1
- package/dist/db/manage/manage-schema.d.ts +445 -445
- package/dist/db/manage/manage-schema.js +1 -1
- package/dist/db/runtime/runtime-schema.d.ts +314 -297
- package/dist/db/runtime/runtime-schema.js +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/validation/dolt-schemas.d.ts +1 -1
- package/dist/validation/schemas.d.ts +1597 -1597
- package/dist/validation/stream-event-schemas.d.ts +4 -0
- package/dist/validation/stream-event-schemas.js +3 -1
- package/drizzle/manage/meta/_journal.json +0 -7
- package/drizzle/runtime/0015_soft_payback.sql +3 -0
- package/drizzle/{manage/meta/0010_snapshot.json → runtime/meta/0015_snapshot.json} +1897 -1798
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/drizzle/manage/0010_oval_angel.sql +0 -2
|
@@ -16,19 +16,19 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
16
16
|
updatedAt: string;
|
|
17
17
|
metadata: MessageMetadata | null;
|
|
18
18
|
content: MessageContent;
|
|
19
|
-
role: string;
|
|
20
|
-
conversationId: string;
|
|
21
19
|
fromSubAgentId: string | null;
|
|
22
20
|
toSubAgentId: string | null;
|
|
23
21
|
fromExternalAgentId: string | null;
|
|
24
22
|
toExternalAgentId: string | null;
|
|
23
|
+
taskId: string | null;
|
|
24
|
+
a2aTaskId: string | null;
|
|
25
|
+
conversationId: string;
|
|
26
|
+
role: string;
|
|
25
27
|
fromTeamAgentId: string | null;
|
|
26
28
|
toTeamAgentId: string | null;
|
|
27
29
|
visibility: string;
|
|
28
30
|
messageType: string;
|
|
29
|
-
taskId: string | null;
|
|
30
31
|
parentMessageId: string | null;
|
|
31
|
-
a2aTaskId: string | null;
|
|
32
32
|
a2aSessionId: string | null;
|
|
33
33
|
} | undefined>;
|
|
34
34
|
declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -147,19 +147,19 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageIn
|
|
|
147
147
|
updatedAt: string;
|
|
148
148
|
metadata: MessageMetadata | null;
|
|
149
149
|
content: MessageContent;
|
|
150
|
-
role: string;
|
|
151
|
-
conversationId: string;
|
|
152
150
|
fromSubAgentId: string | null;
|
|
153
151
|
toSubAgentId: string | null;
|
|
154
152
|
fromExternalAgentId: string | null;
|
|
155
153
|
toExternalAgentId: string | null;
|
|
154
|
+
taskId: string | null;
|
|
155
|
+
a2aTaskId: string | null;
|
|
156
|
+
conversationId: string;
|
|
157
|
+
role: string;
|
|
156
158
|
fromTeamAgentId: string | null;
|
|
157
159
|
toTeamAgentId: string | null;
|
|
158
160
|
visibility: string;
|
|
159
161
|
messageType: string;
|
|
160
|
-
taskId: string | null;
|
|
161
162
|
parentMessageId: string | null;
|
|
162
|
-
a2aTaskId: string | null;
|
|
163
163
|
a2aSessionId: string | null;
|
|
164
164
|
}>;
|
|
165
165
|
declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -200,19 +200,19 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
200
200
|
updatedAt: string;
|
|
201
201
|
metadata: MessageMetadata | null;
|
|
202
202
|
content: MessageContent;
|
|
203
|
-
role: string;
|
|
204
|
-
conversationId: string;
|
|
205
203
|
fromSubAgentId: string | null;
|
|
206
204
|
toSubAgentId: string | null;
|
|
207
205
|
fromExternalAgentId: string | null;
|
|
208
206
|
toExternalAgentId: string | null;
|
|
207
|
+
taskId: string | null;
|
|
208
|
+
a2aTaskId: string | null;
|
|
209
|
+
conversationId: string;
|
|
210
|
+
role: string;
|
|
209
211
|
fromTeamAgentId: string | null;
|
|
210
212
|
toTeamAgentId: string | null;
|
|
211
213
|
visibility: string;
|
|
212
214
|
messageType: string;
|
|
213
|
-
taskId: string | null;
|
|
214
215
|
parentMessageId: string | null;
|
|
215
|
-
a2aTaskId: string | null;
|
|
216
216
|
a2aSessionId: string | null;
|
|
217
217
|
}>;
|
|
218
218
|
declare const countMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -57,5 +57,15 @@ interface UserProviderInfo {
|
|
|
57
57
|
* Returns which providers each user has linked (e.g., 'credential', 'google', 'auth0').
|
|
58
58
|
*/
|
|
59
59
|
declare const getUserProvidersFromDb: (db: AgentsRunDatabaseClient) => (userIds: string[]) => Promise<UserProviderInfo[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Create an invitation directly in db
|
|
62
|
+
* Used when shouldAllowJoinFromWorkspace is enabled for a work_app_slack_workspaces
|
|
63
|
+
*/
|
|
64
|
+
declare const createInvitationInDb: (db: AgentsRunDatabaseClient) => (data: {
|
|
65
|
+
organizationId: string;
|
|
66
|
+
email: string;
|
|
67
|
+
}) => Promise<{
|
|
68
|
+
id: string;
|
|
69
|
+
}>;
|
|
60
70
|
//#endregion
|
|
61
|
-
export { UserProviderInfo, addUserToOrganization, getPendingInvitationsByEmail, getUserOrganizationsFromDb, getUserProvidersFromDb, upsertOrganization };
|
|
71
|
+
export { UserProviderInfo, addUserToOrganization, createInvitationInDb, getPendingInvitationsByEmail, getUserOrganizationsFromDb, getUserProvidersFromDb, upsertOrganization };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { account, invitation, member, organization } from "../../auth/auth-schema.js";
|
|
2
2
|
import { and, desc, eq, inArray, or } from "drizzle-orm";
|
|
3
|
+
import { generateId } from "better-auth";
|
|
3
4
|
|
|
4
5
|
//#region src/data-access/runtime/organizations.ts
|
|
5
6
|
/**
|
|
@@ -91,6 +92,31 @@ const getUserProvidersFromDb = (db) => async (userIds) => {
|
|
|
91
92
|
providers: providerMap.get(userId) || []
|
|
92
93
|
}));
|
|
93
94
|
};
|
|
95
|
+
/**
|
|
96
|
+
* Create an invitation directly in db
|
|
97
|
+
* Used when shouldAllowJoinFromWorkspace is enabled for a work_app_slack_workspaces
|
|
98
|
+
*/
|
|
99
|
+
const createInvitationInDb = (db) => async (data) => {
|
|
100
|
+
const orgSettings = (await db.select({
|
|
101
|
+
serviceAccountUserId: organization.serviceAccountUserId,
|
|
102
|
+
preferredAuthMethod: organization.preferredAuthMethod
|
|
103
|
+
}).from(organization).where(eq(organization.id, data.organizationId)).limit(1))[0];
|
|
104
|
+
if (!orgSettings?.serviceAccountUserId) throw new Error(`Organization ${data.organizationId} does not have a serviceAccountUserId configured`);
|
|
105
|
+
if (!orgSettings?.preferredAuthMethod) throw new Error(`Organization ${data.organizationId} does not have a preferredAuthMethod configured`);
|
|
106
|
+
const inviteId = generateId();
|
|
107
|
+
const expiresAt = new Date(Date.now() + 3600 * 1e3);
|
|
108
|
+
await db.insert(invitation).values({
|
|
109
|
+
id: inviteId,
|
|
110
|
+
organizationId: data.organizationId,
|
|
111
|
+
email: data.email,
|
|
112
|
+
role: "member",
|
|
113
|
+
status: "pending",
|
|
114
|
+
expiresAt,
|
|
115
|
+
inviterId: orgSettings.serviceAccountUserId,
|
|
116
|
+
authMethod: orgSettings.preferredAuthMethod
|
|
117
|
+
});
|
|
118
|
+
return { id: inviteId };
|
|
119
|
+
};
|
|
94
120
|
|
|
95
121
|
//#endregion
|
|
96
|
-
export { addUserToOrganization, getPendingInvitationsByEmail, getUserOrganizationsFromDb, getUserProvidersFromDb, upsertOrganization };
|
|
122
|
+
export { addUserToOrganization, createInvitationInDb, getPendingInvitationsByEmail, getUserOrganizationsFromDb, getUserProvidersFromDb, upsertOrganization };
|
|
@@ -13,14 +13,14 @@ declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert)
|
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
15
|
metadata: TaskMetadataConfig | null;
|
|
16
|
+
subAgentId: string;
|
|
17
|
+
status: string;
|
|
18
|
+
contextId: string;
|
|
16
19
|
ref: {
|
|
17
|
-
type: "
|
|
20
|
+
type: "commit" | "tag" | "branch";
|
|
18
21
|
name: string;
|
|
19
22
|
hash: string;
|
|
20
23
|
} | null;
|
|
21
|
-
status: string;
|
|
22
|
-
contextId: string;
|
|
23
|
-
subAgentId: string;
|
|
24
24
|
}>;
|
|
25
25
|
declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
|
|
26
26
|
id: string;
|
|
@@ -36,7 +36,7 @@ declare const updateTask: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
36
36
|
updatedAt: string;
|
|
37
37
|
contextId: string;
|
|
38
38
|
ref: {
|
|
39
|
-
type: "
|
|
39
|
+
type: "commit" | "tag" | "branch";
|
|
40
40
|
name: string;
|
|
41
41
|
hash: string;
|
|
42
42
|
} | null;
|
|
@@ -15,5 +15,13 @@ declare const getUserById: (db: AgentsRunDatabaseClient) => (userId: string) =>
|
|
|
15
15
|
* Get user by email
|
|
16
16
|
*/
|
|
17
17
|
declare const getUserByEmail: (db: AgentsRunDatabaseClient) => (email: string) => Promise<User | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Get organization member by email
|
|
20
|
+
* Returns the user if they are a member of the specified organization
|
|
21
|
+
*/
|
|
22
|
+
declare const getOrganizationMemberByEmail: (db: AgentsRunDatabaseClient) => (organizationId: string, email: string) => Promise<(User & {
|
|
23
|
+
role: string;
|
|
24
|
+
memberId: string;
|
|
25
|
+
}) | null>;
|
|
18
26
|
//#endregion
|
|
19
|
-
export { getUserByEmail, getUserById };
|
|
27
|
+
export { getOrganizationMemberByEmail, getUserByEmail, getUserById };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { user } from "../../auth/auth-schema.js";
|
|
2
|
-
import { eq } from "drizzle-orm";
|
|
1
|
+
import { member, user } from "../../auth/auth-schema.js";
|
|
2
|
+
import { and, eq } from "drizzle-orm";
|
|
3
3
|
|
|
4
4
|
//#region src/data-access/runtime/users.ts
|
|
5
5
|
/**
|
|
@@ -18,6 +18,23 @@ const getUserById = (db) => async (userId) => {
|
|
|
18
18
|
const getUserByEmail = (db) => async (email) => {
|
|
19
19
|
return (await db.select().from(user).where(eq(user.email, email)).limit(1))[0] || null;
|
|
20
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Get organization member by email
|
|
23
|
+
* Returns the user if they are a member of the specified organization
|
|
24
|
+
*/
|
|
25
|
+
const getOrganizationMemberByEmail = (db) => async (organizationId, email) => {
|
|
26
|
+
return (await db.select({
|
|
27
|
+
id: user.id,
|
|
28
|
+
name: user.name,
|
|
29
|
+
email: user.email,
|
|
30
|
+
emailVerified: user.emailVerified,
|
|
31
|
+
image: user.image,
|
|
32
|
+
createdAt: user.createdAt,
|
|
33
|
+
updatedAt: user.updatedAt,
|
|
34
|
+
role: member.role,
|
|
35
|
+
memberId: member.id
|
|
36
|
+
}).from(member).innerJoin(user, eq(member.userId, user.id)).where(and(eq(member.organizationId, organizationId), eq(user.email, email))).limit(1))[0] || null;
|
|
37
|
+
};
|
|
21
38
|
|
|
22
39
|
//#endregion
|
|
23
|
-
export { getUserByEmail, getUserById };
|
|
40
|
+
export { getOrganizationMemberByEmail, getUserByEmail, getUserById };
|
|
@@ -25,7 +25,7 @@ declare const findWorkAppSlackWorkspaceBySlackTeamId: (db: AgentsRunDatabaseClie
|
|
|
25
25
|
*/
|
|
26
26
|
declare const findWorkAppSlackWorkspaceByNangoConnectionId: (db: AgentsRunDatabaseClient) => (nangoConnectionId: string) => Promise<WorkAppSlackWorkspaceSelect | null>;
|
|
27
27
|
declare const listWorkAppSlackWorkspacesByTenant: (db: AgentsRunDatabaseClient) => (tenantId: string) => Promise<WorkAppSlackWorkspaceSelect[]>;
|
|
28
|
-
declare const updateWorkAppSlackWorkspace: (db: AgentsRunDatabaseClient) => (id: string, data: Partial<Pick<WorkAppSlackWorkspaceInsert, "status" | "slackTeamName">>) => Promise<WorkAppSlackWorkspaceSelect | null>;
|
|
28
|
+
declare const updateWorkAppSlackWorkspace: (db: AgentsRunDatabaseClient) => (id: string, data: Partial<Pick<WorkAppSlackWorkspaceInsert, "status" | "slackTeamName" | "shouldAllowJoinFromWorkspace">>) => Promise<WorkAppSlackWorkspaceSelect | null>;
|
|
29
29
|
declare const deleteWorkAppSlackWorkspace: (db: AgentsRunDatabaseClient) => (id: string) => Promise<boolean>;
|
|
30
30
|
declare const deleteWorkAppSlackWorkspaceByNangoConnectionId: (db: AgentsRunDatabaseClient) => (nangoConnectionId: string) => Promise<boolean>;
|
|
31
31
|
declare const findWorkAppSlackUserMapping: (db: AgentsRunDatabaseClient) => (tenantId: string, slackUserId: string, slackTeamId: string, clientId?: string) => Promise<WorkAppSlackUserMappingSelect | null>;
|