@inkeep/agents-core 0.55.2 → 0.56.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 +107 -107
- package/dist/auth/auth-validation-schemas.d.ts +135 -135
- package/dist/auth/auth.d.ts +9 -9
- package/dist/auth/auth.js +2 -2
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/client-exports.d.ts +2 -2
- package/dist/client-exports.js +2 -2
- package/dist/data-access/index.d.ts +3 -3
- package/dist/data-access/index.js +3 -3
- package/dist/data-access/manage/agents.d.ts +25 -25
- package/dist/data-access/manage/agents.js +25 -11
- package/dist/data-access/manage/artifactComponents.d.ts +2 -2
- package/dist/data-access/manage/functionTools.d.ts +6 -6
- package/dist/data-access/manage/skills.d.ts +7 -7
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +6 -6
- package/dist/data-access/manage/subAgentRelations.d.ts +4 -4
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +6 -6
- package/dist/data-access/manage/subAgents.d.ts +15 -15
- package/dist/data-access/manage/tools.d.ts +9 -9
- package/dist/data-access/manage/triggerCleanup.d.ts +12 -0
- package/dist/data-access/manage/triggerCleanup.js +51 -0
- package/dist/data-access/manage/triggers.d.ts +14 -3
- package/dist/data-access/manage/triggers.js +8 -1
- package/dist/data-access/runtime/apiKeys.d.ts +4 -4
- package/dist/data-access/runtime/conversations.d.ts +28 -28
- package/dist/data-access/runtime/messages.d.ts +15 -15
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
- package/dist/data-access/runtime/tasks.d.ts +6 -6
- package/dist/data-access/runtime/users.d.ts +5 -1
- package/dist/data-access/runtime/users.js +14 -1
- package/dist/db/manage/manage-schema.d.ts +489 -451
- package/dist/db/manage/manage-schema.js +2 -0
- package/dist/db/runtime/runtime-schema.d.ts +294 -294
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/utils/error.d.ts +51 -51
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/dist/validation/schemas.d.ts +1788 -1619
- package/dist/validation/schemas.js +18 -5
- package/drizzle/manage/0012_petite_weapon_omega.sql +2 -0
- package/drizzle/manage/meta/0012_snapshot.json +3697 -0
- package/drizzle/manage/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/dist/auth/cleanup.d.ts +0 -12
- package/dist/auth/cleanup.js +0 -43
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { manage_schema_exports } from "../../db/manage/manage-schema.js";
|
|
2
|
+
import { getLogger } from "../../utils/logger.js";
|
|
3
|
+
import { resolveProjectMainRefs } from "../../dolt/ref-helpers.js";
|
|
4
|
+
import { listProjectsMetadata } from "../runtime/projects.js";
|
|
5
|
+
import { deleteScheduledTriggersByRunAsUserId } from "./scheduledTriggers.js";
|
|
6
|
+
import { deleteTriggersByRunAsUserId } from "./triggers.js";
|
|
7
|
+
import { withRef } from "../../dolt/ref-scope.js";
|
|
8
|
+
import { drizzle } from "drizzle-orm/node-postgres";
|
|
9
|
+
|
|
10
|
+
//#region src/data-access/manage/triggerCleanup.ts
|
|
11
|
+
const logger = getLogger("auth-cleanup");
|
|
12
|
+
async function cleanupUserTriggers(params) {
|
|
13
|
+
const { tenantId, userId, runDb, manageDbPool } = params;
|
|
14
|
+
const projects = await listProjectsMetadata(runDb)({ tenantId });
|
|
15
|
+
if (projects.length === 0) return;
|
|
16
|
+
const connection = await manageDbPool.connect();
|
|
17
|
+
let resolvedRefs;
|
|
18
|
+
try {
|
|
19
|
+
resolvedRefs = await resolveProjectMainRefs(drizzle(connection, { schema: manage_schema_exports }))(tenantId, projects.map((p) => p.id));
|
|
20
|
+
} finally {
|
|
21
|
+
connection.release();
|
|
22
|
+
}
|
|
23
|
+
const results = await Promise.allSettled(resolvedRefs.map(({ projectId, ref }) => withRef(manageDbPool, ref, async (db) => {
|
|
24
|
+
await deleteScheduledTriggersByRunAsUserId(db)({
|
|
25
|
+
tenantId,
|
|
26
|
+
projectId,
|
|
27
|
+
runAsUserId: userId
|
|
28
|
+
});
|
|
29
|
+
await deleteTriggersByRunAsUserId(db)({
|
|
30
|
+
tenantId,
|
|
31
|
+
projectId,
|
|
32
|
+
runAsUserId: userId
|
|
33
|
+
});
|
|
34
|
+
}, {
|
|
35
|
+
commit: true,
|
|
36
|
+
commitMessage: `Remove triggers for departing user ${userId}`
|
|
37
|
+
})));
|
|
38
|
+
for (let i = 0; i < results.length; i++) {
|
|
39
|
+
const result = results[i];
|
|
40
|
+
const { projectId } = resolvedRefs[i];
|
|
41
|
+
if (result.status === "rejected") logger.error({
|
|
42
|
+
tenantId,
|
|
43
|
+
projectId,
|
|
44
|
+
userId,
|
|
45
|
+
error: result.reason
|
|
46
|
+
}, "Failed to clean up scheduled triggers for project");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { cleanupUserTriggers };
|
|
@@ -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" | "
|
|
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" | "
|
|
49
|
+
source: "literal" | "header" | "body";
|
|
50
50
|
required: boolean;
|
|
51
51
|
key?: string | undefined;
|
|
52
52
|
value?: string | undefined;
|
|
@@ -62,6 +62,8 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
|
|
|
62
62
|
normalizeUnicode: boolean;
|
|
63
63
|
} | undefined;
|
|
64
64
|
} | null;
|
|
65
|
+
runAsUserId: string | null;
|
|
66
|
+
createdBy: string | null;
|
|
65
67
|
name: string;
|
|
66
68
|
description: string | null;
|
|
67
69
|
agentId: string;
|
|
@@ -95,6 +97,15 @@ declare const deleteTrigger: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
95
97
|
scopes: AgentScopeConfig;
|
|
96
98
|
triggerId: string;
|
|
97
99
|
}) => Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Delete all webhook triggers for a given runAsUserId within a tenant+project scope.
|
|
102
|
+
* Operates across all agents in the project (not agent-scoped).
|
|
103
|
+
*/
|
|
104
|
+
declare const deleteTriggersByRunAsUserId: (db: AgentsManageDatabaseClient) => (params: {
|
|
105
|
+
tenantId: string;
|
|
106
|
+
projectId: string;
|
|
107
|
+
runAsUserId: string;
|
|
108
|
+
}) => Promise<void>;
|
|
98
109
|
/**
|
|
99
110
|
* Upsert a trigger (create or update based on existence)
|
|
100
111
|
*/
|
|
@@ -103,4 +114,4 @@ declare const upsertTrigger: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
103
114
|
data: TriggerInsert;
|
|
104
115
|
}) => Promise<TriggerSelect>;
|
|
105
116
|
//#endregion
|
|
106
|
-
export { createTrigger, deleteTrigger, getTriggerById, listTriggers, listTriggersPaginated, updateTrigger, upsertTrigger };
|
|
117
|
+
export { createTrigger, deleteTrigger, deleteTriggersByRunAsUserId, getTriggerById, listTriggers, listTriggersPaginated, updateTrigger, upsertTrigger };
|
|
@@ -58,6 +58,13 @@ const deleteTrigger = (db) => async (params) => {
|
|
|
58
58
|
await db.delete(triggers).where(and(eq(triggers.tenantId, params.scopes.tenantId), eq(triggers.projectId, params.scopes.projectId), eq(triggers.agentId, params.scopes.agentId), eq(triggers.id, params.triggerId)));
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
|
+
* Delete all webhook triggers for a given runAsUserId within a tenant+project scope.
|
|
62
|
+
* Operates across all agents in the project (not agent-scoped).
|
|
63
|
+
*/
|
|
64
|
+
const deleteTriggersByRunAsUserId = (db) => async (params) => {
|
|
65
|
+
await db.delete(triggers).where(and(eq(triggers.tenantId, params.tenantId), eq(triggers.projectId, params.projectId), eq(triggers.runAsUserId, params.runAsUserId)));
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
61
68
|
* Upsert a trigger (create or update based on existence)
|
|
62
69
|
*/
|
|
63
70
|
const upsertTrigger = (db) => async (params) => {
|
|
@@ -78,4 +85,4 @@ const upsertTrigger = (db) => async (params) => {
|
|
|
78
85
|
};
|
|
79
86
|
|
|
80
87
|
//#endregion
|
|
81
|
-
export { createTrigger, deleteTrigger, getTriggerById, listTriggers, listTriggersPaginated, updateTrigger, upsertTrigger };
|
|
88
|
+
export { createTrigger, deleteTrigger, deleteTriggersByRunAsUserId, getTriggerById, listTriggers, listTriggersPaginated, updateTrigger, upsertTrigger };
|
|
@@ -12,10 +12,10 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
12
12
|
name: string | null;
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
|
-
expiresAt: string | null;
|
|
16
15
|
tenantId: string;
|
|
17
16
|
projectId: string;
|
|
18
17
|
agentId: string;
|
|
18
|
+
expiresAt: string | null;
|
|
19
19
|
publicId: string;
|
|
20
20
|
keyHash: string;
|
|
21
21
|
keyPrefix: string;
|
|
@@ -26,10 +26,10 @@ declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: s
|
|
|
26
26
|
name: string | null;
|
|
27
27
|
createdAt: string;
|
|
28
28
|
updatedAt: string;
|
|
29
|
-
expiresAt: string | null;
|
|
30
29
|
tenantId: string;
|
|
31
30
|
projectId: string;
|
|
32
31
|
agentId: string;
|
|
32
|
+
expiresAt: string | null;
|
|
33
33
|
publicId: string;
|
|
34
34
|
keyHash: string;
|
|
35
35
|
keyPrefix: string;
|
|
@@ -43,10 +43,10 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
43
43
|
name: string | null;
|
|
44
44
|
createdAt: string;
|
|
45
45
|
updatedAt: string;
|
|
46
|
-
expiresAt: string | null;
|
|
47
46
|
tenantId: string;
|
|
48
47
|
projectId: string;
|
|
49
48
|
agentId: string;
|
|
49
|
+
expiresAt: string | null;
|
|
50
50
|
publicId: string;
|
|
51
51
|
keyHash: string;
|
|
52
52
|
keyPrefix: string;
|
|
@@ -70,10 +70,10 @@ declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInse
|
|
|
70
70
|
name: string | null;
|
|
71
71
|
createdAt: string;
|
|
72
72
|
updatedAt: string;
|
|
73
|
-
expiresAt: string | null;
|
|
74
73
|
tenantId: string;
|
|
75
74
|
projectId: string;
|
|
76
75
|
agentId: string;
|
|
76
|
+
expiresAt: string | null;
|
|
77
77
|
publicId: string;
|
|
78
78
|
keyHash: string;
|
|
79
79
|
keyPrefix: string;
|
|
@@ -17,20 +17,20 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
17
17
|
}>;
|
|
18
18
|
declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
19
19
|
id: string;
|
|
20
|
+
title: string | null;
|
|
20
21
|
createdAt: string;
|
|
21
22
|
updatedAt: string;
|
|
23
|
+
tenantId: string;
|
|
24
|
+
projectId: string;
|
|
25
|
+
metadata: ConversationMetadata | null;
|
|
26
|
+
agentId: string | null;
|
|
27
|
+
userId: string | null;
|
|
28
|
+
activeSubAgentId: string;
|
|
22
29
|
ref: {
|
|
23
30
|
type: "commit" | "tag" | "branch";
|
|
24
31
|
name: string;
|
|
25
32
|
hash: string;
|
|
26
33
|
} | null;
|
|
27
|
-
userId: string | null;
|
|
28
|
-
metadata: ConversationMetadata | null;
|
|
29
|
-
tenantId: string;
|
|
30
|
-
projectId: string;
|
|
31
|
-
title: string | null;
|
|
32
|
-
agentId: string | null;
|
|
33
|
-
activeSubAgentId: string;
|
|
34
34
|
lastContextResolution: string | null;
|
|
35
35
|
}>;
|
|
36
36
|
declare const updateConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -86,20 +86,20 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
86
86
|
conversationId: string;
|
|
87
87
|
}) => Promise<{
|
|
88
88
|
id: string;
|
|
89
|
+
title: string | null;
|
|
89
90
|
createdAt: string;
|
|
90
91
|
updatedAt: string;
|
|
92
|
+
tenantId: string;
|
|
93
|
+
projectId: string;
|
|
94
|
+
metadata: ConversationMetadata | null;
|
|
95
|
+
agentId: string | null;
|
|
96
|
+
userId: string | null;
|
|
97
|
+
activeSubAgentId: string;
|
|
91
98
|
ref: {
|
|
92
99
|
type: "commit" | "tag" | "branch";
|
|
93
100
|
name: string;
|
|
94
101
|
hash: string;
|
|
95
102
|
} | null;
|
|
96
|
-
userId: string | null;
|
|
97
|
-
metadata: ConversationMetadata | null;
|
|
98
|
-
tenantId: string;
|
|
99
|
-
projectId: string;
|
|
100
|
-
title: string | null;
|
|
101
|
-
agentId: string | null;
|
|
102
|
-
activeSubAgentId: string;
|
|
103
103
|
lastContextResolution: string | null;
|
|
104
104
|
} | undefined>;
|
|
105
105
|
declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input: ConversationInsert) => Promise<{
|
|
@@ -122,20 +122,20 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
122
122
|
contextConfigId?: string | undefined;
|
|
123
123
|
} | {
|
|
124
124
|
id: string;
|
|
125
|
+
title: string | null;
|
|
125
126
|
createdAt: string;
|
|
126
127
|
updatedAt: string;
|
|
128
|
+
tenantId: string;
|
|
129
|
+
projectId: string;
|
|
130
|
+
metadata: ConversationMetadata | null;
|
|
131
|
+
agentId: string | null;
|
|
132
|
+
userId: string | null;
|
|
133
|
+
activeSubAgentId: string;
|
|
127
134
|
ref: {
|
|
128
135
|
type: "commit" | "tag" | "branch";
|
|
129
136
|
name: string;
|
|
130
137
|
hash: string;
|
|
131
138
|
} | null;
|
|
132
|
-
userId: string | null;
|
|
133
|
-
metadata: ConversationMetadata | null;
|
|
134
|
-
tenantId: string;
|
|
135
|
-
projectId: string;
|
|
136
|
-
title: string | null;
|
|
137
|
-
agentId: string | null;
|
|
138
|
-
activeSubAgentId: string;
|
|
139
139
|
lastContextResolution: string | null;
|
|
140
140
|
}>;
|
|
141
141
|
/**
|
|
@@ -154,20 +154,20 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
154
154
|
conversationId: string;
|
|
155
155
|
}) => Promise<{
|
|
156
156
|
id: string;
|
|
157
|
+
title: string | null;
|
|
157
158
|
createdAt: string;
|
|
158
159
|
updatedAt: string;
|
|
160
|
+
tenantId: string;
|
|
161
|
+
projectId: string;
|
|
162
|
+
metadata: ConversationMetadata | null;
|
|
163
|
+
agentId: string | null;
|
|
164
|
+
userId: string | null;
|
|
165
|
+
activeSubAgentId: string;
|
|
159
166
|
ref: {
|
|
160
167
|
type: "commit" | "tag" | "branch";
|
|
161
168
|
name: string;
|
|
162
169
|
hash: string;
|
|
163
170
|
} | null;
|
|
164
|
-
userId: string | null;
|
|
165
|
-
metadata: ConversationMetadata | null;
|
|
166
|
-
tenantId: string;
|
|
167
|
-
projectId: string;
|
|
168
|
-
title: string | null;
|
|
169
|
-
agentId: string | null;
|
|
170
|
-
activeSubAgentId: string;
|
|
171
171
|
lastContextResolution: string | null;
|
|
172
172
|
} | undefined>;
|
|
173
173
|
/**
|
|
@@ -13,23 +13,23 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
13
13
|
id: string;
|
|
14
14
|
createdAt: string;
|
|
15
15
|
updatedAt: string;
|
|
16
|
-
metadata: MessageMetadata | null;
|
|
17
|
-
role: string;
|
|
18
16
|
tenantId: string;
|
|
19
17
|
projectId: string;
|
|
18
|
+
metadata: MessageMetadata | null;
|
|
20
19
|
content: MessageContent;
|
|
20
|
+
conversationId: string;
|
|
21
|
+
role: string;
|
|
21
22
|
fromSubAgentId: string | null;
|
|
22
23
|
toSubAgentId: string | null;
|
|
23
24
|
fromExternalAgentId: string | null;
|
|
24
25
|
toExternalAgentId: string | null;
|
|
25
|
-
taskId: string | null;
|
|
26
|
-
a2aTaskId: string | null;
|
|
27
|
-
conversationId: string;
|
|
28
26
|
fromTeamAgentId: string | null;
|
|
29
27
|
toTeamAgentId: string | null;
|
|
30
28
|
visibility: string;
|
|
31
29
|
messageType: string;
|
|
30
|
+
taskId: string | null;
|
|
32
31
|
parentMessageId: string | null;
|
|
32
|
+
a2aTaskId: string | null;
|
|
33
33
|
a2aSessionId: string | null;
|
|
34
34
|
} | undefined>;
|
|
35
35
|
declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -144,23 +144,23 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageIn
|
|
|
144
144
|
id: string;
|
|
145
145
|
createdAt: string;
|
|
146
146
|
updatedAt: string;
|
|
147
|
-
metadata: MessageMetadata | null;
|
|
148
|
-
role: string;
|
|
149
147
|
tenantId: string;
|
|
150
148
|
projectId: string;
|
|
149
|
+
metadata: MessageMetadata | null;
|
|
151
150
|
content: MessageContent;
|
|
151
|
+
conversationId: string;
|
|
152
|
+
role: string;
|
|
152
153
|
fromSubAgentId: string | null;
|
|
153
154
|
toSubAgentId: string | null;
|
|
154
155
|
fromExternalAgentId: string | null;
|
|
155
156
|
toExternalAgentId: string | null;
|
|
156
|
-
taskId: string | null;
|
|
157
|
-
a2aTaskId: string | null;
|
|
158
|
-
conversationId: string;
|
|
159
157
|
fromTeamAgentId: string | null;
|
|
160
158
|
toTeamAgentId: string | null;
|
|
161
159
|
visibility: string;
|
|
162
160
|
messageType: string;
|
|
161
|
+
taskId: string | null;
|
|
163
162
|
parentMessageId: string | null;
|
|
163
|
+
a2aTaskId: string | null;
|
|
164
164
|
a2aSessionId: string | null;
|
|
165
165
|
}>;
|
|
166
166
|
declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -197,23 +197,23 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
197
197
|
id: string;
|
|
198
198
|
createdAt: string;
|
|
199
199
|
updatedAt: string;
|
|
200
|
-
metadata: MessageMetadata | null;
|
|
201
|
-
role: string;
|
|
202
200
|
tenantId: string;
|
|
203
201
|
projectId: string;
|
|
202
|
+
metadata: MessageMetadata | null;
|
|
204
203
|
content: MessageContent;
|
|
204
|
+
conversationId: string;
|
|
205
|
+
role: string;
|
|
205
206
|
fromSubAgentId: string | null;
|
|
206
207
|
toSubAgentId: string | null;
|
|
207
208
|
fromExternalAgentId: string | null;
|
|
208
209
|
toExternalAgentId: string | null;
|
|
209
|
-
taskId: string | null;
|
|
210
|
-
a2aTaskId: string | null;
|
|
211
|
-
conversationId: string;
|
|
212
210
|
fromTeamAgentId: string | null;
|
|
213
211
|
toTeamAgentId: string | null;
|
|
214
212
|
visibility: string;
|
|
215
213
|
messageType: string;
|
|
214
|
+
taskId: string | null;
|
|
216
215
|
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" | "
|
|
37
|
+
status: "pending" | "running" | "completed" | "failed" | "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" | "
|
|
177
|
+
status: "pending" | "running" | "completed" | "failed" | "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" | "
|
|
211
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
212
212
|
scheduledFor: string;
|
|
213
213
|
startedAt: string | null;
|
|
214
214
|
completedAt: string | null;
|
|
@@ -9,17 +9,17 @@ declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert)
|
|
|
9
9
|
id: string;
|
|
10
10
|
createdAt: string;
|
|
11
11
|
updatedAt: string;
|
|
12
|
+
tenantId: string;
|
|
13
|
+
projectId: string;
|
|
14
|
+
metadata: TaskMetadataConfig | null;
|
|
15
|
+
agentId: string;
|
|
16
|
+
subAgentId: string;
|
|
17
|
+
status: string;
|
|
12
18
|
ref: {
|
|
13
19
|
type: "commit" | "tag" | "branch";
|
|
14
20
|
name: string;
|
|
15
21
|
hash: string;
|
|
16
22
|
} | null;
|
|
17
|
-
metadata: TaskMetadataConfig | null;
|
|
18
|
-
status: string;
|
|
19
|
-
tenantId: string;
|
|
20
|
-
projectId: string;
|
|
21
|
-
agentId: string;
|
|
22
|
-
subAgentId: string;
|
|
23
23
|
contextId: string;
|
|
24
24
|
}>;
|
|
25
25
|
declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -19,9 +19,13 @@ declare const getUserByEmail: (db: AgentsRunDatabaseClient) => (email: string) =
|
|
|
19
19
|
* Get organization member by email
|
|
20
20
|
* Returns the user if they are a member of the specified organization
|
|
21
21
|
*/
|
|
22
|
+
declare const getOrganizationMemberByUserId: (db: AgentsRunDatabaseClient) => (organizationId: string, userId: string) => Promise<(User & {
|
|
23
|
+
role: string;
|
|
24
|
+
memberId: string;
|
|
25
|
+
}) | null>;
|
|
22
26
|
declare const getOrganizationMemberByEmail: (db: AgentsRunDatabaseClient) => (organizationId: string, email: string) => Promise<(User & {
|
|
23
27
|
role: string;
|
|
24
28
|
memberId: string;
|
|
25
29
|
}) | null>;
|
|
26
30
|
//#endregion
|
|
27
|
-
export { getOrganizationMemberByEmail, getUserByEmail, getUserById };
|
|
31
|
+
export { getOrganizationMemberByEmail, getOrganizationMemberByUserId, getUserByEmail, getUserById };
|
|
@@ -22,6 +22,19 @@ const getUserByEmail = (db) => async (email) => {
|
|
|
22
22
|
* Get organization member by email
|
|
23
23
|
* Returns the user if they are a member of the specified organization
|
|
24
24
|
*/
|
|
25
|
+
const getOrganizationMemberByUserId = (db) => async (organizationId, userId) => {
|
|
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.id, userId))).limit(1))[0] || null;
|
|
37
|
+
};
|
|
25
38
|
const getOrganizationMemberByEmail = (db) => async (organizationId, email) => {
|
|
26
39
|
return (await db.select({
|
|
27
40
|
id: user.id,
|
|
@@ -37,4 +50,4 @@ const getOrganizationMemberByEmail = (db) => async (organizationId, email) => {
|
|
|
37
50
|
};
|
|
38
51
|
|
|
39
52
|
//#endregion
|
|
40
|
-
export { getOrganizationMemberByEmail, getUserByEmail, getUserById };
|
|
53
|
+
export { getOrganizationMemberByEmail, getOrganizationMemberByUserId, getUserByEmail, getUserById };
|