@inkeep/agents-core 0.79.0 → 0.80.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 +227 -227
- package/dist/auth/auth-validation-schemas.d.ts +154 -154
- package/dist/auth/auth.js +1 -1
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/data-access/index.d.ts +2 -1
- package/dist/data-access/index.js +2 -1
- package/dist/data-access/manage/agents.d.ts +20 -20
- package/dist/data-access/manage/artifactComponents.d.ts +10 -10
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/dataComponents.d.ts +4 -4
- package/dist/data-access/manage/functionTools.d.ts +16 -16
- package/dist/data-access/manage/skills.d.ts +12 -12
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgentRelations.d.ts +32 -32
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgents.d.ts +12 -12
- package/dist/data-access/manage/tools.d.ts +24 -24
- package/dist/data-access/manage/tools.js +33 -8
- package/dist/data-access/manage/triggers.d.ts +4 -4
- package/dist/data-access/runtime/apiKeys.d.ts +20 -20
- package/dist/data-access/runtime/apps.d.ts +17 -17
- package/dist/data-access/runtime/conversations.d.ts +32 -32
- package/dist/data-access/runtime/evalRuns.d.ts +5 -0
- package/dist/data-access/runtime/evalRuns.js +3 -0
- package/dist/data-access/runtime/events.d.ts +4 -4
- package/dist/data-access/runtime/feedback.d.ts +8 -8
- package/dist/data-access/runtime/feedback.js +2 -2
- package/dist/data-access/runtime/messages.d.ts +27 -27
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +5 -5
- package/dist/data-access/runtime/scheduledTriggerUsers.d.ts +2 -2
- package/dist/data-access/runtime/tasks.d.ts +6 -6
- package/dist/data-access/runtime/toolApprovalDecisions.d.ts +37 -0
- package/dist/data-access/runtime/toolApprovalDecisions.js +76 -0
- package/dist/db/manage/manage-schema.d.ts +506 -506
- package/dist/db/runtime/runtime-schema.d.ts +602 -454
- package/dist/db/runtime/runtime-schema.js +30 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/utils/json-schema-walk.d.ts +50 -0
- package/dist/utils/json-schema-walk.js +202 -0
- package/dist/utils/mcp-client.js +14 -32
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/schemas/skills.d.ts +45 -45
- package/dist/validation/schemas.d.ts +2248 -2247
- package/dist/validation/schemas.js +1 -0
- package/drizzle/runtime/0044_productive_bromley.sql +12 -0
- package/drizzle/runtime/meta/0044_snapshot.json +6386 -0
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +5 -1
|
@@ -9,48 +9,48 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
9
9
|
id: string;
|
|
10
10
|
}) => Promise<{
|
|
11
11
|
id: string;
|
|
12
|
-
name: string | null;
|
|
13
|
-
createdAt: string;
|
|
14
|
-
updatedAt: string;
|
|
15
|
-
projectId: string;
|
|
16
12
|
tenantId: string;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
name: string | null;
|
|
17
15
|
agentId: string;
|
|
16
|
+
projectId: string;
|
|
17
|
+
updatedAt: string;
|
|
18
18
|
expiresAt: string | null;
|
|
19
|
+
lastUsedAt: string | null;
|
|
19
20
|
publicId: string;
|
|
20
21
|
keyHash: string;
|
|
21
22
|
keyPrefix: string;
|
|
22
|
-
lastUsedAt: string | null;
|
|
23
23
|
} | undefined>;
|
|
24
24
|
declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
|
|
25
25
|
id: string;
|
|
26
|
-
name: string | null;
|
|
27
|
-
createdAt: string;
|
|
28
|
-
updatedAt: string;
|
|
29
|
-
projectId: string;
|
|
30
26
|
tenantId: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
name: string | null;
|
|
31
29
|
agentId: string;
|
|
30
|
+
projectId: string;
|
|
31
|
+
updatedAt: string;
|
|
32
32
|
expiresAt: string | null;
|
|
33
|
+
lastUsedAt: string | null;
|
|
33
34
|
publicId: string;
|
|
34
35
|
keyHash: string;
|
|
35
36
|
keyPrefix: string;
|
|
36
|
-
lastUsedAt: string | null;
|
|
37
37
|
} | undefined>;
|
|
38
38
|
declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
|
|
39
39
|
scopes: ProjectScopeConfig;
|
|
40
40
|
agentId?: string;
|
|
41
41
|
}) => Promise<{
|
|
42
42
|
id: string;
|
|
43
|
-
name: string | null;
|
|
44
|
-
createdAt: string;
|
|
45
|
-
updatedAt: string;
|
|
46
|
-
projectId: string;
|
|
47
43
|
tenantId: string;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
name: string | null;
|
|
48
46
|
agentId: string;
|
|
47
|
+
projectId: string;
|
|
48
|
+
updatedAt: string;
|
|
49
49
|
expiresAt: string | null;
|
|
50
|
+
lastUsedAt: string | null;
|
|
50
51
|
publicId: string;
|
|
51
52
|
keyHash: string;
|
|
52
53
|
keyPrefix: string;
|
|
53
|
-
lastUsedAt: string | null;
|
|
54
54
|
}[]>;
|
|
55
55
|
declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
56
56
|
scopes: ProjectScopeConfig;
|
|
@@ -67,17 +67,17 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
67
67
|
}>;
|
|
68
68
|
declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
|
|
69
69
|
id: string;
|
|
70
|
-
name: string | null;
|
|
71
|
-
createdAt: string;
|
|
72
|
-
updatedAt: string;
|
|
73
|
-
projectId: string;
|
|
74
70
|
tenantId: string;
|
|
71
|
+
createdAt: string;
|
|
72
|
+
name: string | null;
|
|
75
73
|
agentId: string;
|
|
74
|
+
projectId: string;
|
|
75
|
+
updatedAt: string;
|
|
76
76
|
expiresAt: string | null;
|
|
77
|
+
lastUsedAt: string | null;
|
|
77
78
|
publicId: string;
|
|
78
79
|
keyHash: string;
|
|
79
80
|
keyPrefix: string;
|
|
80
|
-
lastUsedAt: string | null;
|
|
81
81
|
}>;
|
|
82
82
|
declare const updateApiKey: (db: AgentsRunDatabaseClient) => (params: {
|
|
83
83
|
scopes: ProjectScopeConfig;
|
|
@@ -6,15 +6,14 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
|
|
|
6
6
|
//#region src/data-access/runtime/apps.d.ts
|
|
7
7
|
declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
|
|
8
8
|
id: string;
|
|
9
|
+
tenantId: string | null;
|
|
10
|
+
createdAt: string;
|
|
9
11
|
name: string;
|
|
12
|
+
type: AppType;
|
|
10
13
|
description: string | null;
|
|
11
|
-
createdAt: string;
|
|
12
|
-
updatedAt: string;
|
|
13
14
|
projectId: string | null;
|
|
14
|
-
|
|
15
|
-
type: AppType;
|
|
15
|
+
updatedAt: string;
|
|
16
16
|
enabled: boolean;
|
|
17
|
-
prompt: string | null;
|
|
18
17
|
config: {
|
|
19
18
|
type: "web_client";
|
|
20
19
|
webClient: {
|
|
@@ -22,7 +21,7 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
|
|
|
22
21
|
publicKeys: {
|
|
23
22
|
kid: string;
|
|
24
23
|
publicKey: string;
|
|
25
|
-
algorithm: "
|
|
24
|
+
algorithm: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "EdDSA";
|
|
26
25
|
addedAt: string;
|
|
27
26
|
}[];
|
|
28
27
|
allowAnonymous: boolean;
|
|
@@ -45,9 +44,10 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
|
|
|
45
44
|
}[] | undefined;
|
|
46
45
|
};
|
|
47
46
|
};
|
|
48
|
-
|
|
49
|
-
defaultProjectId: string | null;
|
|
47
|
+
prompt: string | null;
|
|
50
48
|
defaultAgentId: string | null;
|
|
49
|
+
defaultProjectId: string | null;
|
|
50
|
+
lastUsedAt: string | null;
|
|
51
51
|
} | undefined>;
|
|
52
52
|
declare const updateAppLastUsed: (db: AgentsRunDatabaseClient) => (id: string) => Promise<void>;
|
|
53
53
|
declare const getAppByIdForTenant: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -75,15 +75,14 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
75
75
|
}>;
|
|
76
76
|
declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
|
|
77
77
|
id: string;
|
|
78
|
+
tenantId: string | null;
|
|
79
|
+
createdAt: string;
|
|
78
80
|
name: string;
|
|
81
|
+
type: AppType;
|
|
79
82
|
description: string | null;
|
|
80
|
-
createdAt: string;
|
|
81
|
-
updatedAt: string;
|
|
82
83
|
projectId: string | null;
|
|
83
|
-
|
|
84
|
-
type: AppType;
|
|
84
|
+
updatedAt: string;
|
|
85
85
|
enabled: boolean;
|
|
86
|
-
prompt: string | null;
|
|
87
86
|
config: {
|
|
88
87
|
type: "web_client";
|
|
89
88
|
webClient: {
|
|
@@ -91,7 +90,7 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
|
|
|
91
90
|
publicKeys: {
|
|
92
91
|
kid: string;
|
|
93
92
|
publicKey: string;
|
|
94
|
-
algorithm: "
|
|
93
|
+
algorithm: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "EdDSA";
|
|
95
94
|
addedAt: string;
|
|
96
95
|
}[];
|
|
97
96
|
allowAnonymous: boolean;
|
|
@@ -114,9 +113,10 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
|
|
|
114
113
|
}[] | undefined;
|
|
115
114
|
};
|
|
116
115
|
};
|
|
117
|
-
|
|
118
|
-
defaultProjectId: string | null;
|
|
116
|
+
prompt: string | null;
|
|
119
117
|
defaultAgentId: string | null;
|
|
118
|
+
defaultProjectId: string | null;
|
|
119
|
+
lastUsedAt: string | null;
|
|
120
120
|
}>;
|
|
121
121
|
declare const updateAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
|
|
122
122
|
scopes: TenantScopeConfig;
|
|
@@ -174,7 +174,7 @@ declare const updateApp: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
174
174
|
publicKeys: {
|
|
175
175
|
kid: string;
|
|
176
176
|
publicKey: string;
|
|
177
|
-
algorithm: "
|
|
177
|
+
algorithm: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "EdDSA";
|
|
178
178
|
addedAt: string;
|
|
179
179
|
}[];
|
|
180
180
|
allowAnonymous: boolean;
|
|
@@ -17,23 +17,23 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
17
17
|
}>;
|
|
18
18
|
declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
19
19
|
id: string;
|
|
20
|
-
metadata: ConversationMetadata | null;
|
|
21
|
-
createdAt: string;
|
|
22
|
-
updatedAt: string;
|
|
23
|
-
projectId: string;
|
|
24
20
|
tenantId: string;
|
|
25
|
-
|
|
21
|
+
createdAt: string;
|
|
22
|
+
metadata: ConversationMetadata | null;
|
|
26
23
|
title: string | null;
|
|
27
|
-
|
|
28
|
-
userId: string | null;
|
|
24
|
+
properties: Record<string, unknown> | null;
|
|
29
25
|
ref: {
|
|
30
26
|
type: "commit" | "tag" | "branch";
|
|
31
27
|
name: string;
|
|
32
28
|
hash: string;
|
|
33
29
|
} | null;
|
|
34
|
-
|
|
30
|
+
agentId: string | null;
|
|
31
|
+
projectId: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
userId: string | null;
|
|
35
34
|
activeSubAgentId: string;
|
|
36
35
|
lastContextResolution: string | null;
|
|
36
|
+
userProperties: Record<string, unknown> | null;
|
|
37
37
|
}>;
|
|
38
38
|
declare const updateConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
39
39
|
scopes: ProjectScopeConfig;
|
|
@@ -92,23 +92,23 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
92
92
|
conversationId: string;
|
|
93
93
|
}) => Promise<{
|
|
94
94
|
id: string;
|
|
95
|
-
metadata: ConversationMetadata | null;
|
|
96
|
-
createdAt: string;
|
|
97
|
-
updatedAt: string;
|
|
98
|
-
projectId: string;
|
|
99
95
|
tenantId: string;
|
|
100
|
-
|
|
96
|
+
createdAt: string;
|
|
97
|
+
metadata: ConversationMetadata | null;
|
|
101
98
|
title: string | null;
|
|
102
|
-
|
|
103
|
-
userId: string | null;
|
|
99
|
+
properties: Record<string, unknown> | null;
|
|
104
100
|
ref: {
|
|
105
101
|
type: "commit" | "tag" | "branch";
|
|
106
102
|
name: string;
|
|
107
103
|
hash: string;
|
|
108
104
|
} | null;
|
|
109
|
-
|
|
105
|
+
agentId: string | null;
|
|
106
|
+
projectId: string;
|
|
107
|
+
updatedAt: string;
|
|
108
|
+
userId: string | null;
|
|
110
109
|
activeSubAgentId: string;
|
|
111
110
|
lastContextResolution: string | null;
|
|
111
|
+
userProperties: Record<string, unknown> | null;
|
|
112
112
|
} | undefined>;
|
|
113
113
|
/**
|
|
114
114
|
* Batch-fetch conversations by id within a project scope.
|
|
@@ -147,23 +147,23 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
147
147
|
properties?: Record<string, unknown> | null | undefined;
|
|
148
148
|
} | {
|
|
149
149
|
id: string;
|
|
150
|
-
metadata: ConversationMetadata | null;
|
|
151
|
-
createdAt: string;
|
|
152
|
-
updatedAt: string;
|
|
153
|
-
projectId: string;
|
|
154
150
|
tenantId: string;
|
|
155
|
-
|
|
151
|
+
createdAt: string;
|
|
152
|
+
metadata: ConversationMetadata | null;
|
|
156
153
|
title: string | null;
|
|
157
|
-
|
|
158
|
-
userId: string | null;
|
|
154
|
+
properties: Record<string, unknown> | null;
|
|
159
155
|
ref: {
|
|
160
156
|
type: "commit" | "tag" | "branch";
|
|
161
157
|
name: string;
|
|
162
158
|
hash: string;
|
|
163
159
|
} | null;
|
|
164
|
-
|
|
160
|
+
agentId: string | null;
|
|
161
|
+
projectId: string;
|
|
162
|
+
updatedAt: string;
|
|
163
|
+
userId: string | null;
|
|
165
164
|
activeSubAgentId: string;
|
|
166
165
|
lastContextResolution: string | null;
|
|
166
|
+
userProperties: Record<string, unknown> | null;
|
|
167
167
|
}>;
|
|
168
168
|
/**
|
|
169
169
|
* Extract text content from message content object
|
|
@@ -185,23 +185,23 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
185
185
|
conversationId: string;
|
|
186
186
|
}) => Promise<{
|
|
187
187
|
id: string;
|
|
188
|
-
metadata: ConversationMetadata | null;
|
|
189
|
-
createdAt: string;
|
|
190
|
-
updatedAt: string;
|
|
191
|
-
projectId: string;
|
|
192
188
|
tenantId: string;
|
|
193
|
-
|
|
189
|
+
createdAt: string;
|
|
190
|
+
metadata: ConversationMetadata | null;
|
|
194
191
|
title: string | null;
|
|
195
|
-
|
|
196
|
-
userId: string | null;
|
|
192
|
+
properties: Record<string, unknown> | null;
|
|
197
193
|
ref: {
|
|
198
194
|
type: "commit" | "tag" | "branch";
|
|
199
195
|
name: string;
|
|
200
196
|
hash: string;
|
|
201
197
|
} | null;
|
|
202
|
-
|
|
198
|
+
agentId: string | null;
|
|
199
|
+
projectId: string;
|
|
200
|
+
updatedAt: string;
|
|
201
|
+
userId: string | null;
|
|
203
202
|
activeSubAgentId: string;
|
|
204
203
|
lastContextResolution: string | null;
|
|
204
|
+
userProperties: Record<string, unknown> | null;
|
|
205
205
|
} | undefined>;
|
|
206
206
|
/**
|
|
207
207
|
* Set active agent for a conversation (upsert operation)
|
|
@@ -94,6 +94,11 @@ declare const listEvaluationResultsByRun: (db: AgentsRunDatabaseClient) => (para
|
|
|
94
94
|
interface EvalResultsFilter {
|
|
95
95
|
evaluatorId?: string;
|
|
96
96
|
agentId?: string;
|
|
97
|
+
conversationId?: string;
|
|
98
|
+
/** ISO timestamp — only include results whose conversation was created on or after this instant. */
|
|
99
|
+
startDate?: string;
|
|
100
|
+
/** ISO timestamp — only include results whose conversation was created on or before this instant. */
|
|
101
|
+
endDate?: string;
|
|
97
102
|
}
|
|
98
103
|
interface EvalResultsPagination {
|
|
99
104
|
page: number;
|
|
@@ -112,6 +112,9 @@ function buildEvalResultsBaseQuery(db, params) {
|
|
|
112
112
|
const whereConditions = [projectScopedWhere(evaluationResult, params.scopes), inArray(evaluationResult.evaluationRunId, runIdSubquery)];
|
|
113
113
|
if (params.filters?.evaluatorId) whereConditions.push(eq(evaluationResult.evaluatorId, params.filters.evaluatorId));
|
|
114
114
|
if (params.filters?.agentId) whereConditions.push(eq(conversations.agentId, params.filters.agentId));
|
|
115
|
+
if (params.filters?.conversationId) whereConditions.push(eq(evaluationResult.conversationId, params.filters.conversationId));
|
|
116
|
+
if (params.filters?.startDate) whereConditions.push(gte(conversations.createdAt, params.filters.startDate));
|
|
117
|
+
if (params.filters?.endDate) whereConditions.push(lte(conversations.createdAt, params.filters.endDate));
|
|
115
118
|
return { whereConditions };
|
|
116
119
|
}
|
|
117
120
|
const listEvaluationResultsPaginated = (db) => async (params) => {
|
|
@@ -8,14 +8,14 @@ import { EventInsert } from "../../types/entities.js";
|
|
|
8
8
|
declare const createEvent: (db: AgentsRunDatabaseClient) => (params: EventInsert) => Promise<{
|
|
9
9
|
row: {
|
|
10
10
|
id: string;
|
|
11
|
-
metadata: Record<string, unknown> | null;
|
|
12
|
-
createdAt: string;
|
|
13
|
-
updatedAt: string;
|
|
14
|
-
projectId: string;
|
|
15
11
|
tenantId: string;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
metadata: Record<string, unknown> | null;
|
|
16
14
|
type: string;
|
|
17
15
|
properties: Record<string, unknown> | null;
|
|
18
16
|
agentId: string | null;
|
|
17
|
+
projectId: string;
|
|
18
|
+
updatedAt: string;
|
|
19
19
|
conversationId: string | null;
|
|
20
20
|
userProperties: Record<string, unknown> | null;
|
|
21
21
|
messageId: string | null;
|
|
@@ -71,14 +71,14 @@ declare const getFeedbackByIds: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
71
71
|
}[]>;
|
|
72
72
|
declare const createFeedback: (db: AgentsRunDatabaseClient) => (params: FeedbackInsert) => Promise<{
|
|
73
73
|
id: string;
|
|
74
|
-
createdAt: string;
|
|
75
|
-
updatedAt: string;
|
|
76
|
-
projectId: string;
|
|
77
74
|
tenantId: string;
|
|
75
|
+
createdAt: string;
|
|
78
76
|
type: "positive" | "negative";
|
|
79
|
-
|
|
77
|
+
projectId: string;
|
|
78
|
+
updatedAt: string;
|
|
80
79
|
conversationId: string;
|
|
81
80
|
messageId: string | null;
|
|
81
|
+
details: string | null;
|
|
82
82
|
}>;
|
|
83
83
|
declare const createFeedbackBulk: (db: AgentsRunDatabaseClient) => (items: FeedbackInsert[]) => Promise<(typeof feedback.$inferSelect)[]>;
|
|
84
84
|
declare const updateFeedback: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -101,14 +101,14 @@ declare const deleteFeedback: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
101
101
|
feedbackId: string;
|
|
102
102
|
}) => Promise<{
|
|
103
103
|
id: string;
|
|
104
|
-
createdAt: string;
|
|
105
|
-
updatedAt: string;
|
|
106
|
-
projectId: string;
|
|
107
104
|
tenantId: string;
|
|
105
|
+
createdAt: string;
|
|
108
106
|
type: "positive" | "negative";
|
|
109
|
-
|
|
107
|
+
projectId: string;
|
|
108
|
+
updatedAt: string;
|
|
110
109
|
conversationId: string;
|
|
111
110
|
messageId: string | null;
|
|
111
|
+
details: string | null;
|
|
112
112
|
}>;
|
|
113
113
|
//#endregion
|
|
114
114
|
export { createFeedback, createFeedbackBulk, deleteFeedback, getFeedbackById, getFeedbackByIds, listFeedback, listFeedbackByConversation, updateFeedback };
|
|
@@ -31,8 +31,8 @@ const listFeedback = (db) => async (params) => {
|
|
|
31
31
|
if (params.conversationId) conditions.push(eq(feedback.conversationId, params.conversationId));
|
|
32
32
|
if (params.messageId) conditions.push(eq(feedback.messageId, params.messageId));
|
|
33
33
|
if (params.type) conditions.push(eq(feedback.type, params.type));
|
|
34
|
-
if (params.startDate) conditions.push(gte(feedback.createdAt,
|
|
35
|
-
if (params.endDate) conditions.push(lte(feedback.createdAt,
|
|
34
|
+
if (params.startDate) conditions.push(gte(feedback.createdAt, params.startDate));
|
|
35
|
+
if (params.endDate) conditions.push(lte(feedback.createdAt, params.endDate));
|
|
36
36
|
if (params.agentId) conditions.push(eq(conversations.agentId, params.agentId));
|
|
37
37
|
const whereClause = and(...conditions);
|
|
38
38
|
const conversationsJoin = [
|
|
@@ -11,27 +11,27 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
11
11
|
messageId: string;
|
|
12
12
|
}) => Promise<{
|
|
13
13
|
id: string;
|
|
14
|
-
content: MessageContent;
|
|
15
|
-
metadata: MessageMetadata | null;
|
|
16
|
-
createdAt: string;
|
|
17
|
-
updatedAt: string;
|
|
18
|
-
projectId: string;
|
|
19
14
|
tenantId: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
metadata: MessageMetadata | null;
|
|
20
17
|
properties: Record<string, unknown> | null;
|
|
18
|
+
content: MessageContent;
|
|
19
|
+
projectId: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
conversationId: string;
|
|
22
|
+
userProperties: Record<string, unknown> | null;
|
|
21
23
|
role: string;
|
|
22
24
|
fromSubAgentId: string | null;
|
|
23
25
|
toSubAgentId: string | null;
|
|
24
26
|
fromExternalAgentId: string | null;
|
|
25
27
|
toExternalAgentId: string | null;
|
|
26
|
-
taskId: string | null;
|
|
27
|
-
a2aTaskId: string | null;
|
|
28
|
-
conversationId: string;
|
|
29
|
-
userProperties: Record<string, unknown> | null;
|
|
30
28
|
fromTeamAgentId: string | null;
|
|
31
29
|
toTeamAgentId: string | null;
|
|
32
30
|
visibility: string;
|
|
33
31
|
messageType: string;
|
|
32
|
+
taskId: string | null;
|
|
34
33
|
parentMessageId: string | null;
|
|
34
|
+
a2aTaskId: string | null;
|
|
35
35
|
a2aSessionId: string | null;
|
|
36
36
|
} | undefined>;
|
|
37
37
|
declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -184,27 +184,27 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
184
184
|
data: Omit<MessageInsert, "tenantId" | "projectId">;
|
|
185
185
|
}) => Promise<{
|
|
186
186
|
id: string;
|
|
187
|
-
content: MessageContent;
|
|
188
|
-
metadata: MessageMetadata | null;
|
|
189
|
-
createdAt: string;
|
|
190
|
-
updatedAt: string;
|
|
191
|
-
projectId: string;
|
|
192
187
|
tenantId: string;
|
|
188
|
+
createdAt: string;
|
|
189
|
+
metadata: MessageMetadata | null;
|
|
193
190
|
properties: Record<string, unknown> | null;
|
|
191
|
+
content: MessageContent;
|
|
192
|
+
projectId: string;
|
|
193
|
+
updatedAt: string;
|
|
194
|
+
conversationId: string;
|
|
195
|
+
userProperties: Record<string, unknown> | null;
|
|
194
196
|
role: string;
|
|
195
197
|
fromSubAgentId: string | null;
|
|
196
198
|
toSubAgentId: string | null;
|
|
197
199
|
fromExternalAgentId: string | null;
|
|
198
200
|
toExternalAgentId: string | null;
|
|
199
|
-
taskId: string | null;
|
|
200
|
-
a2aTaskId: string | null;
|
|
201
|
-
conversationId: string;
|
|
202
|
-
userProperties: Record<string, unknown> | null;
|
|
203
201
|
fromTeamAgentId: string | null;
|
|
204
202
|
toTeamAgentId: string | null;
|
|
205
203
|
visibility: string;
|
|
206
204
|
messageType: string;
|
|
205
|
+
taskId: string | null;
|
|
207
206
|
parentMessageId: string | null;
|
|
207
|
+
a2aTaskId: string | null;
|
|
208
208
|
a2aSessionId: string | null;
|
|
209
209
|
}>;
|
|
210
210
|
declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -241,27 +241,27 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
241
241
|
messageId: string;
|
|
242
242
|
}) => Promise<{
|
|
243
243
|
id: string;
|
|
244
|
-
content: MessageContent;
|
|
245
|
-
metadata: MessageMetadata | null;
|
|
246
|
-
createdAt: string;
|
|
247
|
-
updatedAt: string;
|
|
248
|
-
projectId: string;
|
|
249
244
|
tenantId: string;
|
|
245
|
+
createdAt: string;
|
|
246
|
+
metadata: MessageMetadata | null;
|
|
250
247
|
properties: Record<string, unknown> | null;
|
|
248
|
+
content: MessageContent;
|
|
249
|
+
projectId: string;
|
|
250
|
+
updatedAt: string;
|
|
251
|
+
conversationId: string;
|
|
252
|
+
userProperties: Record<string, unknown> | null;
|
|
251
253
|
role: string;
|
|
252
254
|
fromSubAgentId: string | null;
|
|
253
255
|
toSubAgentId: string | null;
|
|
254
256
|
fromExternalAgentId: string | null;
|
|
255
257
|
toExternalAgentId: string | null;
|
|
256
|
-
taskId: string | null;
|
|
257
|
-
a2aTaskId: string | null;
|
|
258
|
-
conversationId: string;
|
|
259
|
-
userProperties: Record<string, unknown> | null;
|
|
260
258
|
fromTeamAgentId: string | null;
|
|
261
259
|
toTeamAgentId: string | null;
|
|
262
260
|
visibility: string;
|
|
263
261
|
messageType: string;
|
|
262
|
+
taskId: string | null;
|
|
264
263
|
parentMessageId: string | null;
|
|
264
|
+
a2aTaskId: string | null;
|
|
265
265
|
a2aSessionId: string | null;
|
|
266
266
|
}>;
|
|
267
267
|
declare const countMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -40,7 +40,7 @@ declare const listScheduledTriggerInvocationsPaginated: (db: AgentsRunDatabaseCl
|
|
|
40
40
|
name: string;
|
|
41
41
|
hash: string;
|
|
42
42
|
} | null;
|
|
43
|
-
status: "pending" | "
|
|
43
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
44
44
|
scheduledFor: string;
|
|
45
45
|
startedAt: string | null;
|
|
46
46
|
completedAt: string | null;
|
|
@@ -199,7 +199,7 @@ declare const listUpcomingInvocationsForAgentPaginated: (db: AgentsRunDatabaseCl
|
|
|
199
199
|
name: string;
|
|
200
200
|
hash: string;
|
|
201
201
|
} | null;
|
|
202
|
-
status: "pending" | "
|
|
202
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
203
203
|
scheduledFor: string;
|
|
204
204
|
startedAt: string | null;
|
|
205
205
|
completedAt: string | null;
|
|
@@ -239,7 +239,7 @@ declare const listProjectScheduledTriggerInvocationsPaginated: (db: AgentsRunDat
|
|
|
239
239
|
name: string;
|
|
240
240
|
hash: string;
|
|
241
241
|
} | null;
|
|
242
|
-
status: "pending" | "
|
|
242
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
243
243
|
scheduledFor: string;
|
|
244
244
|
startedAt: string | null;
|
|
245
245
|
completedAt: string | null;
|
|
@@ -292,7 +292,7 @@ declare const listScheduledTriggerInvocationsByTriggerId: (db: AgentsRunDatabase
|
|
|
292
292
|
name: string;
|
|
293
293
|
hash: string;
|
|
294
294
|
} | null;
|
|
295
|
-
status: "pending" | "
|
|
295
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
296
296
|
scheduledFor: string;
|
|
297
297
|
startedAt: string | null;
|
|
298
298
|
completedAt: string | null;
|
|
@@ -320,7 +320,7 @@ declare const listScheduledTriggerInvocationsByDatasetRunId: (db: AgentsRunDatab
|
|
|
320
320
|
name: string;
|
|
321
321
|
hash: string;
|
|
322
322
|
} | null;
|
|
323
|
-
status: "pending" | "
|
|
323
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
324
324
|
scheduledFor: string;
|
|
325
325
|
startedAt: string | null;
|
|
326
326
|
completedAt: string | null;
|
|
@@ -15,10 +15,10 @@ declare const createScheduledTriggerUser: (db: AgentsRunDatabaseClient) => (para
|
|
|
15
15
|
scheduledTriggerId: string;
|
|
16
16
|
userId: string;
|
|
17
17
|
}) => Promise<{
|
|
18
|
-
createdAt: string;
|
|
19
18
|
tenantId: string;
|
|
20
|
-
|
|
19
|
+
createdAt: string;
|
|
21
20
|
scheduledTriggerId: string;
|
|
21
|
+
userId: string;
|
|
22
22
|
}>;
|
|
23
23
|
declare const deleteScheduledTriggerUser: (db: AgentsRunDatabaseClient) => (params: {
|
|
24
24
|
tenantId: string;
|
|
@@ -8,19 +8,19 @@ import { TaskInsert, TaskSelect } from "../../types/entities.js";
|
|
|
8
8
|
//#region src/data-access/runtime/tasks.d.ts
|
|
9
9
|
declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
|
|
10
10
|
id: string;
|
|
11
|
-
metadata: TaskMetadataConfig | null;
|
|
12
|
-
createdAt: string;
|
|
13
|
-
updatedAt: string;
|
|
14
|
-
projectId: string;
|
|
15
11
|
tenantId: string;
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
createdAt: string;
|
|
13
|
+
metadata: TaskMetadataConfig | null;
|
|
18
14
|
ref: {
|
|
19
15
|
type: "commit" | "tag" | "branch";
|
|
20
16
|
name: string;
|
|
21
17
|
hash: string;
|
|
22
18
|
} | null;
|
|
23
19
|
status: string;
|
|
20
|
+
agentId: string;
|
|
21
|
+
projectId: string;
|
|
22
|
+
subAgentId: string;
|
|
23
|
+
updatedAt: string;
|
|
24
24
|
contextId: string;
|
|
25
25
|
}>;
|
|
26
26
|
declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
2
|
+
|
|
3
|
+
//#region src/data-access/runtime/toolApprovalDecisions.d.ts
|
|
4
|
+
interface ToolApprovalScope {
|
|
5
|
+
tenantId: string;
|
|
6
|
+
projectId: string;
|
|
7
|
+
conversationId: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Persist an approval/denial so the instance running the suspended agent can
|
|
11
|
+
* pick it up. Used when the approval request lands on a different instance than
|
|
12
|
+
* the one holding the in-memory pending approval. Upserts so a retry/re-submit
|
|
13
|
+
* overwrites rather than conflicts.
|
|
14
|
+
*/
|
|
15
|
+
declare const recordToolApprovalDecision: (db: AgentsRunDatabaseClient) => (params: ToolApprovalScope & {
|
|
16
|
+
toolCallId: string;
|
|
17
|
+
approved: boolean;
|
|
18
|
+
reason?: string;
|
|
19
|
+
}) => Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Atomically read-and-delete a pending decision for a tool call. Returns null
|
|
22
|
+
* when none is present. The delete-on-read (DELETE ... RETURNING) guarantees a
|
|
23
|
+
* single waiter consumes any given decision exactly once.
|
|
24
|
+
*/
|
|
25
|
+
declare const consumeToolApprovalDecision: (db: AgentsRunDatabaseClient) => (params: ToolApprovalScope & {
|
|
26
|
+
toolCallId: string;
|
|
27
|
+
}) => Promise<{
|
|
28
|
+
approved: boolean;
|
|
29
|
+
reason: string | null;
|
|
30
|
+
} | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Delete decisions older than the timeout window. Batched to bound statement
|
|
33
|
+
* size, mirroring cleanupExpiredStreamChunks.
|
|
34
|
+
*/
|
|
35
|
+
declare const cleanupExpiredToolApprovalDecisions: (db: AgentsRunDatabaseClient) => (olderThanMinutes?: number, batchSize?: number) => Promise<void>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { cleanupExpiredToolApprovalDecisions, consumeToolApprovalDecision, recordToolApprovalDecision };
|