@inkeep/agents-core 0.50.6 → 0.52.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 (78) hide show
  1. package/dist/auth/auth-schema.d.ts +139 -105
  2. package/dist/auth/auth-schema.js +3 -1
  3. package/dist/auth/auth-validation-schemas.d.ts +216 -148
  4. package/dist/auth/auth.d.ts +55 -23
  5. package/dist/auth/auth.js +22 -8
  6. package/dist/auth/permissions.d.ts +9 -9
  7. package/dist/client-exports.d.ts +8 -14
  8. package/dist/data-access/index.d.ts +3 -3
  9. package/dist/data-access/index.js +3 -3
  10. package/dist/data-access/manage/agentFull.d.ts +2 -1
  11. package/dist/data-access/manage/agents.d.ts +39 -38
  12. package/dist/data-access/manage/artifactComponents.d.ts +18 -17
  13. package/dist/data-access/manage/contextConfigs.d.ts +18 -17
  14. package/dist/data-access/manage/credentialReferences.d.ts +2 -1
  15. package/dist/data-access/manage/dataComponents.d.ts +8 -7
  16. package/dist/data-access/manage/evalConfig.d.ts +2 -1
  17. package/dist/data-access/manage/externalAgents.d.ts +2 -1
  18. package/dist/data-access/manage/functionTools.d.ts +14 -14
  19. package/dist/data-access/manage/functions.d.ts +2 -2
  20. package/dist/data-access/manage/projectFull.d.ts +2 -1
  21. package/dist/data-access/manage/projects.d.ts +2 -1
  22. package/dist/data-access/manage/scheduledTriggers.d.ts +2 -2
  23. package/dist/data-access/manage/scheduledWorkflows.d.ts +2 -2
  24. package/dist/data-access/manage/scope-helpers.d.ts +15 -22
  25. package/dist/data-access/manage/scope-helpers.js +15 -12
  26. package/dist/data-access/manage/skills.d.ts +17 -16
  27. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +20 -19
  28. package/dist/data-access/manage/subAgentRelations.d.ts +22 -21
  29. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +20 -19
  30. package/dist/data-access/manage/subAgents.d.ts +17 -16
  31. package/dist/data-access/manage/tools.d.ts +29 -28
  32. package/dist/data-access/manage/triggers.d.ts +4 -4
  33. package/dist/data-access/runtime/apiKeys.d.ts +14 -13
  34. package/dist/data-access/runtime/cascade-delete.d.ts +1 -1
  35. package/dist/data-access/runtime/contextCache.d.ts +2 -2
  36. package/dist/data-access/runtime/conversations.d.ts +25 -24
  37. package/dist/data-access/runtime/evalRuns.d.ts +2 -1
  38. package/dist/data-access/runtime/ledgerArtifacts.d.ts +1 -1
  39. package/dist/data-access/runtime/messages.d.ts +23 -22
  40. package/dist/data-access/runtime/organizations.d.ts +11 -1
  41. package/dist/data-access/runtime/organizations.js +27 -1
  42. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +2 -2
  43. package/dist/data-access/runtime/tasks.d.ts +7 -7
  44. package/dist/data-access/runtime/triggerInvocations.d.ts +2 -2
  45. package/dist/data-access/runtime/users.d.ts +9 -1
  46. package/dist/data-access/runtime/users.js +20 -3
  47. package/dist/data-access/runtime/workAppSlack.d.ts +1 -1
  48. package/dist/db/manage/manage-schema.d.ts +449 -449
  49. package/dist/db/manage/manage-schema.js +1 -1
  50. package/dist/db/manage/scope-definitions.d.ts +31 -0
  51. package/dist/db/manage/scope-definitions.js +31 -0
  52. package/dist/db/runtime/runtime-schema.d.ts +314 -297
  53. package/dist/db/runtime/runtime-schema.js +1 -0
  54. package/dist/dolt/branches-api.d.ts +2 -1
  55. package/dist/index.d.ts +7 -5
  56. package/dist/index.js +5 -4
  57. package/dist/middleware/no-auth.d.ts +2 -2
  58. package/dist/types/index.d.ts +2 -1
  59. package/dist/types/utility.d.ts +2 -11
  60. package/dist/utils/error.d.ts +3 -1
  61. package/dist/utils/error.js +11 -1
  62. package/dist/utils/index.d.ts +3 -2
  63. package/dist/utils/index.js +3 -2
  64. package/dist/utils/retry.d.ts +8 -0
  65. package/dist/utils/retry.js +30 -0
  66. package/dist/validation/dolt-schemas.d.ts +1 -1
  67. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  68. package/dist/validation/schemas.d.ts +1826 -1856
  69. package/dist/validation/schemas.js +2 -1
  70. package/dist/validation/stream-event-schemas.d.ts +4 -0
  71. package/dist/validation/stream-event-schemas.js +3 -1
  72. package/drizzle/manage/0010_oval_angel.sql +2 -0
  73. package/drizzle/manage/meta/0010_snapshot.json +3673 -0
  74. package/drizzle/manage/meta/_journal.json +7 -0
  75. package/drizzle/runtime/0015_soft_payback.sql +3 -0
  76. package/drizzle/runtime/meta/0015_snapshot.json +3772 -0
  77. package/drizzle/runtime/meta/_journal.json +7 -0
  78. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- import { AgentScopeConfig, PaginationConfig } from "../../types/utility.js";
1
+ import { AgentScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig } from "../../types/utility.js";
2
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
4
  import { TriggerInsert, TriggerSelect, TriggerUpdate } from "../../types/entities.js";
4
5
 
5
6
  //#region src/data-access/manage/triggers.d.ts
6
-
7
7
  /**
8
8
  * Get a trigger by ID (agent-scoped)
9
9
  */
@@ -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;
@@ -1,4 +1,5 @@
1
- import { ApiKeyCreateResult, CreateApiKeyParams, PaginationConfig, ProjectScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { ApiKeyCreateResult, CreateApiKeyParams, PaginationConfig } from "../../types/utility.js";
2
3
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
3
4
  import { ApiKeyInsert, ApiKeySelect, ApiKeyUpdate } from "../../types/entities.js";
4
5
 
@@ -8,48 +9,48 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
8
9
  id: string;
9
10
  }) => Promise<{
10
11
  name: string | null;
12
+ tenantId: string;
13
+ projectId: string;
11
14
  id: string;
12
15
  createdAt: string;
13
16
  updatedAt: string;
14
17
  agentId: string;
15
- projectId: string;
16
- tenantId: string;
17
- expiresAt: string | null;
18
18
  publicId: string;
19
19
  keyHash: string;
20
20
  keyPrefix: string;
21
21
  lastUsedAt: string | null;
22
+ expiresAt: string | null;
22
23
  } | undefined>;
23
24
  declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
24
25
  name: string | null;
26
+ tenantId: string;
27
+ projectId: string;
25
28
  id: string;
26
29
  createdAt: string;
27
30
  updatedAt: string;
28
31
  agentId: string;
29
- projectId: string;
30
- tenantId: string;
31
- expiresAt: string | null;
32
32
  publicId: string;
33
33
  keyHash: string;
34
34
  keyPrefix: string;
35
35
  lastUsedAt: string | null;
36
+ expiresAt: string | null;
36
37
  } | undefined>;
37
38
  declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
38
39
  scopes: ProjectScopeConfig;
39
40
  agentId?: string;
40
41
  }) => Promise<{
41
42
  name: string | null;
43
+ tenantId: string;
44
+ projectId: string;
42
45
  id: string;
43
46
  createdAt: string;
44
47
  updatedAt: string;
45
48
  agentId: string;
46
- projectId: string;
47
- tenantId: string;
48
- expiresAt: string | null;
49
49
  publicId: string;
50
50
  keyHash: string;
51
51
  keyPrefix: string;
52
52
  lastUsedAt: string | null;
53
+ expiresAt: string | null;
53
54
  }[]>;
54
55
  declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
55
56
  scopes: ProjectScopeConfig;
@@ -66,17 +67,17 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
66
67
  }>;
67
68
  declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
68
69
  name: string | null;
70
+ tenantId: string;
71
+ projectId: string;
69
72
  id: string;
70
73
  createdAt: string;
71
74
  updatedAt: string;
72
75
  agentId: string;
73
- projectId: string;
74
- tenantId: string;
75
- expiresAt: string | null;
76
76
  publicId: string;
77
77
  keyHash: string;
78
78
  keyPrefix: string;
79
79
  lastUsedAt: string | null;
80
+ expiresAt: string | null;
80
81
  }>;
81
82
  declare const updateApiKey: (db: AgentsRunDatabaseClient) => (params: {
82
83
  scopes: ProjectScopeConfig;
@@ -1,4 +1,4 @@
1
- import { AgentScopeConfig, ProjectScopeConfig } from "../../types/utility.js";
1
+ import { AgentScopeConfig, ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
2
  import "../../types/index.js";
3
3
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
4
4
 
@@ -1,9 +1,9 @@
1
- import { ProjectScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import "../../types/utility.js";
2
3
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
3
4
  import { ContextCacheInsert, ContextCacheSelect } from "../../types/entities.js";
4
5
 
5
6
  //#region src/data-access/runtime/contextCache.d.ts
6
-
7
7
  /**
8
8
  * Get cached context data for a conversation with optional request hash validation
9
9
  */
@@ -1,5 +1,6 @@
1
1
  import { ResolvedRef } from "../../validation/dolt-schemas.js";
2
- import { ConversationHistoryConfig, ConversationMetadata, PaginationConfig, ProjectScopeConfig } from "../../types/utility.js";
2
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
3
+ import { ConversationHistoryConfig, ConversationMetadata, PaginationConfig } from "../../types/utility.js";
3
4
  import "../../types/index.js";
4
5
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
5
6
  import "../../index.js";
@@ -15,17 +16,17 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
15
16
  total: number;
16
17
  }>;
17
18
  declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
19
+ title: string | null;
20
+ tenantId: string;
21
+ projectId: string;
18
22
  id: string;
19
23
  createdAt: string;
20
24
  updatedAt: string;
21
- agentId: string | null;
22
- projectId: string;
23
- tenantId: string;
24
- title: string | null;
25
25
  metadata: ConversationMetadata | null;
26
+ agentId: string | null;
26
27
  userId: string | null;
27
28
  ref: {
28
- type: "tag" | "commit" | "branch";
29
+ type: "commit" | "tag" | "branch";
29
30
  name: string;
30
31
  hash: string;
31
32
  } | null;
@@ -43,7 +44,7 @@ declare const updateConversation: (db: AgentsRunDatabaseClient) => (params: {
43
44
  agentId: string | null;
44
45
  activeSubAgentId: string;
45
46
  ref: {
46
- type: "tag" | "commit" | "branch";
47
+ type: "commit" | "tag" | "branch";
47
48
  name: string;
48
49
  hash: string;
49
50
  } | null;
@@ -69,7 +70,7 @@ declare const updateConversationActiveSubAgent: (db: AgentsRunDatabaseClient) =>
69
70
  agentId: string | null;
70
71
  activeSubAgentId: string;
71
72
  ref: {
72
- type: "tag" | "commit" | "branch";
73
+ type: "commit" | "tag" | "branch";
73
74
  name: string;
74
75
  hash: string;
75
76
  } | null;
@@ -84,17 +85,17 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
84
85
  scopes: ProjectScopeConfig;
85
86
  conversationId: string;
86
87
  }) => Promise<{
88
+ title: string | null;
89
+ tenantId: string;
90
+ projectId: string;
87
91
  id: string;
88
92
  createdAt: string;
89
93
  updatedAt: string;
90
- agentId: string | null;
91
- projectId: string;
92
- tenantId: string;
93
- title: string | null;
94
94
  metadata: ConversationMetadata | null;
95
+ agentId: string | null;
95
96
  userId: string | null;
96
97
  ref: {
97
- type: "tag" | "commit" | "branch";
98
+ type: "commit" | "tag" | "branch";
98
99
  name: string;
99
100
  hash: string;
100
101
  } | null;
@@ -107,7 +108,7 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
107
108
  tenantId: string;
108
109
  id: string;
109
110
  ref: {
110
- type: "tag" | "commit" | "branch";
111
+ type: "commit" | "tag" | "branch";
111
112
  name: string;
112
113
  hash: string;
113
114
  };
@@ -120,17 +121,17 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
120
121
  metadata?: ConversationMetadata | null | undefined;
121
122
  contextConfigId?: string | undefined;
122
123
  } | {
124
+ title: string | null;
125
+ tenantId: string;
126
+ projectId: string;
123
127
  id: string;
124
128
  createdAt: string;
125
129
  updatedAt: string;
126
- agentId: string | null;
127
- projectId: string;
128
- tenantId: string;
129
- title: string | null;
130
130
  metadata: ConversationMetadata | null;
131
+ agentId: string | null;
131
132
  userId: string | null;
132
133
  ref: {
133
- type: "tag" | "commit" | "branch";
134
+ type: "commit" | "tag" | "branch";
134
135
  name: string;
135
136
  hash: string;
136
137
  } | null;
@@ -152,17 +153,17 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
152
153
  scopes: ProjectScopeConfig;
153
154
  conversationId: string;
154
155
  }) => Promise<{
156
+ title: string | null;
157
+ tenantId: string;
158
+ projectId: string;
155
159
  id: string;
156
160
  createdAt: string;
157
161
  updatedAt: string;
158
- agentId: string | null;
159
- projectId: string;
160
- tenantId: string;
161
- title: string | null;
162
162
  metadata: ConversationMetadata | null;
163
+ agentId: string | null;
163
164
  userId: string | null;
164
165
  ref: {
165
- type: "tag" | "commit" | "branch";
166
+ type: "commit" | "tag" | "branch";
166
167
  name: string;
167
168
  hash: string;
168
169
  } | null;
@@ -1,4 +1,5 @@
1
- import { EvaluationJobFilterCriteria, Filter, ProjectScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { EvaluationJobFilterCriteria, Filter } from "../../types/utility.js";
2
3
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
3
4
  import { ConversationSelect, DatasetRunConversationRelationInsert, DatasetRunConversationRelationSelect, DatasetRunInsert, DatasetRunSelect, EvaluationResultInsert, EvaluationResultSelect, EvaluationResultUpdate, EvaluationRunInsert, EvaluationRunSelect, EvaluationRunUpdate } from "../../types/entities.js";
4
5
 
@@ -1,5 +1,5 @@
1
1
  import { Artifact } from "../../types/a2a.js";
2
- import { ProjectScopeConfig } from "../../types/utility.js";
2
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
3
3
  import "../../types/index.js";
4
4
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
5
5
  import { LedgerArtifactSelect } from "../../types/entities.js";
@@ -1,4 +1,5 @@
1
- import { MessageContent, MessageMetadata, MessageVisibility, PaginationConfig, ProjectScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { MessageContent, MessageMetadata, MessageVisibility, PaginationConfig } from "../../types/utility.js";
2
3
  import "../../types/index.js";
3
4
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
4
5
  import "../../index.js";
@@ -9,21 +10,21 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
9
10
  scopes: ProjectScopeConfig;
10
11
  messageId: string;
11
12
  }) => Promise<{
12
- id: string;
13
- createdAt: string;
14
- updatedAt: string;
15
- projectId: string;
16
- tenantId: string;
17
- metadata: MessageMetadata | null;
18
13
  content: MessageContent;
19
- role: string;
14
+ tenantId: string;
15
+ projectId: string;
20
16
  fromSubAgentId: string | null;
21
17
  toSubAgentId: string | null;
22
18
  fromExternalAgentId: string | null;
23
19
  toExternalAgentId: string | null;
24
20
  taskId: string | null;
25
21
  a2aTaskId: string | null;
22
+ id: string;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ metadata: MessageMetadata | null;
26
26
  conversationId: string;
27
+ role: string;
27
28
  fromTeamAgentId: string | null;
28
29
  toTeamAgentId: string | null;
29
30
  visibility: string;
@@ -140,21 +141,21 @@ declare const getVisibleMessages: (db: AgentsRunDatabaseClient) => (params: {
140
141
  id: string;
141
142
  }[]>;
142
143
  declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageInsert) => Promise<{
143
- id: string;
144
- createdAt: string;
145
- updatedAt: string;
146
- projectId: string;
147
- tenantId: string;
148
- metadata: MessageMetadata | null;
149
144
  content: MessageContent;
150
- role: string;
145
+ tenantId: string;
146
+ projectId: string;
151
147
  fromSubAgentId: string | null;
152
148
  toSubAgentId: string | null;
153
149
  fromExternalAgentId: string | null;
154
150
  toExternalAgentId: string | null;
155
151
  taskId: string | null;
156
152
  a2aTaskId: string | null;
153
+ id: string;
154
+ createdAt: string;
155
+ updatedAt: string;
156
+ metadata: MessageMetadata | null;
157
157
  conversationId: string;
158
+ role: string;
158
159
  fromTeamAgentId: string | null;
159
160
  toTeamAgentId: string | null;
160
161
  visibility: string;
@@ -193,21 +194,21 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
193
194
  scopes: ProjectScopeConfig;
194
195
  messageId: string;
195
196
  }) => Promise<{
196
- id: string;
197
- createdAt: string;
198
- updatedAt: string;
199
- projectId: string;
200
- tenantId: string;
201
- metadata: MessageMetadata | null;
202
197
  content: MessageContent;
203
- role: string;
198
+ tenantId: string;
199
+ projectId: string;
204
200
  fromSubAgentId: string | null;
205
201
  toSubAgentId: string | null;
206
202
  fromExternalAgentId: string | null;
207
203
  toExternalAgentId: string | null;
208
204
  taskId: string | null;
209
205
  a2aTaskId: string | null;
206
+ id: string;
207
+ createdAt: string;
208
+ updatedAt: string;
209
+ metadata: MessageMetadata | null;
210
210
  conversationId: string;
211
+ role: string;
211
212
  fromTeamAgentId: string | null;
212
213
  toTeamAgentId: string | null;
213
214
  visibility: string;
@@ -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 };
@@ -1,9 +1,9 @@
1
- import { AgentScopeConfig, PaginationConfig } from "../../types/utility.js";
1
+ import { AgentScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig } from "../../types/utility.js";
2
3
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
3
4
  import { ScheduledTriggerInvocation, ScheduledTriggerInvocationInsert, ScheduledTriggerInvocationStatus, ScheduledTriggerInvocationUpdate } from "../../validation/schemas.js";
4
5
 
5
6
  //#region src/data-access/runtime/scheduledTriggerInvocations.d.ts
6
-
7
7
  /**
8
8
  * Get a scheduled trigger invocation by ID (agent-scoped)
9
9
  */
@@ -6,21 +6,21 @@ 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
+ tenantId: string;
10
+ projectId: string;
11
+ subAgentId: string;
9
12
  id: string;
10
13
  createdAt: string;
11
14
  updatedAt: string;
12
- agentId: string;
13
- projectId: string;
14
- tenantId: string;
15
15
  metadata: TaskMetadataConfig | null;
16
+ agentId: string;
16
17
  status: string;
18
+ contextId: string;
17
19
  ref: {
18
- type: "tag" | "commit" | "branch";
20
+ type: "commit" | "tag" | "branch";
19
21
  name: string;
20
22
  hash: string;
21
23
  } | null;
22
- subAgentId: string;
23
- contextId: 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: "tag" | "commit" | "branch";
39
+ type: "commit" | "tag" | "branch";
40
40
  name: string;
41
41
  hash: string;
42
42
  } | null;
@@ -1,9 +1,9 @@
1
- import { AgentScopeConfig, PaginationConfig } from "../../types/utility.js";
1
+ import { AgentScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig } from "../../types/utility.js";
2
3
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
3
4
  import { TriggerInvocationInsert, TriggerInvocationSelect, TriggerInvocationUpdate } from "../../types/entities.js";
4
5
 
5
6
  //#region src/data-access/runtime/triggerInvocations.d.ts
6
-
7
7
  /**
8
8
  * Get a trigger invocation by ID (agent-scoped)
9
9
  */
@@ -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>;