@inkeep/agents-core 0.71.0 → 0.72.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 +163 -163
- package/dist/auth/auth-validation-schemas.d.ts +137 -137
- package/dist/auth/auth.d.ts +113 -113
- package/dist/auth/password-policy.d.ts +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/constants/signoz-queries.d.ts +2 -0
- package/dist/constants/signoz-queries.js +3 -1
- 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 +37 -37
- package/dist/data-access/manage/artifactComponents.d.ts +14 -14
- package/dist/data-access/manage/contextConfigs.d.ts +20 -20
- package/dist/data-access/manage/dataComponents.d.ts +8 -8
- package/dist/data-access/manage/functionTools.d.ts +18 -18
- package/dist/data-access/manage/skills.d.ts +13 -13
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentRelations.d.ts +30 -30
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgents.d.ts +15 -15
- package/dist/data-access/manage/tools.d.ts +30 -30
- package/dist/data-access/manage/triggers.d.ts +5 -5
- package/dist/data-access/runtime/apiKeys.d.ts +16 -16
- package/dist/data-access/runtime/apps.d.ts +10 -10
- package/dist/data-access/runtime/conversations.d.ts +36 -20
- package/dist/data-access/runtime/conversations.js +30 -8
- package/dist/data-access/runtime/events.d.ts +93 -0
- package/dist/data-access/runtime/events.js +43 -0
- package/dist/data-access/runtime/feedback.d.ts +6 -6
- package/dist/data-access/runtime/messages.d.ts +31 -15
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +4 -4
- package/dist/data-access/runtime/scheduledTriggerUsers.d.ts +1 -1
- package/dist/data-access/runtime/tasks.d.ts +5 -5
- package/dist/db/manage/manage-schema.d.ts +482 -482
- package/dist/db/runtime/runtime-schema.d.ts +767 -435
- package/dist/db/runtime/runtime-schema.js +52 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +5 -4
- package/dist/types/entities.d.ts +6 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/conversations.d.ts +7 -2
- package/dist/utils/conversations.js +16 -3
- package/dist/utils/error.d.ts +51 -51
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +2 -2
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/dist/validation/schemas/skills.d.ts +44 -44
- package/dist/validation/schemas.d.ts +2693 -2857
- package/dist/validation/schemas.js +61 -9
- package/drizzle/runtime/0039_abandoned_old_lace.sql +21 -0
- package/drizzle/runtime/0040_living_forgotten_one.sql +4 -0
- package/drizzle/runtime/meta/0039_snapshot.json +6309 -0
- package/drizzle/runtime/meta/0040_snapshot.json +6333 -0
- package/drizzle/runtime/meta/_journal.json +14 -0
- package/package.json +1 -1
|
@@ -5,14 +5,16 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
|
|
|
5
5
|
|
|
6
6
|
//#region src/data-access/runtime/apps.d.ts
|
|
7
7
|
declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
|
|
8
|
-
tenantId: string | null;
|
|
9
|
-
projectId: string | null;
|
|
10
8
|
type: AppType;
|
|
9
|
+
enabled: boolean;
|
|
11
10
|
id: string;
|
|
12
|
-
name: string;
|
|
13
11
|
createdAt: string;
|
|
12
|
+
name: string;
|
|
14
13
|
updatedAt: string;
|
|
14
|
+
projectId: string | null;
|
|
15
|
+
tenantId: string | null;
|
|
15
16
|
description: string | null;
|
|
17
|
+
prompt: string | null;
|
|
16
18
|
config: {
|
|
17
19
|
type: "web_client";
|
|
18
20
|
webClient: {
|
|
@@ -43,8 +45,6 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
|
|
|
43
45
|
}[] | undefined;
|
|
44
46
|
};
|
|
45
47
|
};
|
|
46
|
-
prompt: string | null;
|
|
47
|
-
enabled: boolean;
|
|
48
48
|
lastUsedAt: string | null;
|
|
49
49
|
defaultProjectId: string | null;
|
|
50
50
|
defaultAgentId: string | null;
|
|
@@ -74,14 +74,16 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
74
74
|
};
|
|
75
75
|
}>;
|
|
76
76
|
declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
|
|
77
|
-
tenantId: string | null;
|
|
78
|
-
projectId: string | null;
|
|
79
77
|
type: AppType;
|
|
78
|
+
enabled: boolean;
|
|
80
79
|
id: string;
|
|
81
|
-
name: string;
|
|
82
80
|
createdAt: string;
|
|
81
|
+
name: string;
|
|
83
82
|
updatedAt: string;
|
|
83
|
+
projectId: string | null;
|
|
84
|
+
tenantId: string | null;
|
|
84
85
|
description: string | null;
|
|
86
|
+
prompt: string | null;
|
|
85
87
|
config: {
|
|
86
88
|
type: "web_client";
|
|
87
89
|
webClient: {
|
|
@@ -112,8 +114,6 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
|
|
|
112
114
|
}[] | undefined;
|
|
113
115
|
};
|
|
114
116
|
};
|
|
115
|
-
prompt: string | null;
|
|
116
|
-
enabled: boolean;
|
|
117
117
|
lastUsedAt: string | null;
|
|
118
118
|
defaultProjectId: string | null;
|
|
119
119
|
defaultAgentId: string | null;
|
|
@@ -15,20 +15,22 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
15
15
|
total: number;
|
|
16
16
|
}>;
|
|
17
17
|
declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
18
|
-
tenantId: string;
|
|
19
|
-
projectId: string;
|
|
20
|
-
agentId: string | null;
|
|
21
18
|
id: string;
|
|
22
19
|
createdAt: string;
|
|
23
20
|
updatedAt: string;
|
|
24
|
-
|
|
21
|
+
agentId: string | null;
|
|
22
|
+
projectId: string;
|
|
23
|
+
tenantId: string;
|
|
24
|
+
properties: Record<string, unknown> | null;
|
|
25
25
|
title: string | null;
|
|
26
|
-
|
|
26
|
+
metadata: ConversationMetadata | null;
|
|
27
27
|
ref: {
|
|
28
28
|
type: "commit" | "tag" | "branch";
|
|
29
29
|
name: string;
|
|
30
30
|
hash: string;
|
|
31
31
|
} | null;
|
|
32
|
+
userId: string | null;
|
|
33
|
+
userProperties: Record<string, unknown> | null;
|
|
32
34
|
activeSubAgentId: string;
|
|
33
35
|
lastContextResolution: string | null;
|
|
34
36
|
}>;
|
|
@@ -50,6 +52,8 @@ declare const updateConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
50
52
|
title: string | null;
|
|
51
53
|
lastContextResolution: string | null;
|
|
52
54
|
metadata: ConversationMetadata | null;
|
|
55
|
+
userProperties: Record<string, unknown> | null;
|
|
56
|
+
properties: Record<string, unknown> | null;
|
|
53
57
|
projectId: string;
|
|
54
58
|
tenantId: string;
|
|
55
59
|
id: string;
|
|
@@ -76,6 +80,8 @@ declare const updateConversationActiveSubAgent: (db: AgentsRunDatabaseClient) =>
|
|
|
76
80
|
title: string | null;
|
|
77
81
|
lastContextResolution: string | null;
|
|
78
82
|
metadata: ConversationMetadata | null;
|
|
83
|
+
userProperties: Record<string, unknown> | null;
|
|
84
|
+
properties: Record<string, unknown> | null;
|
|
79
85
|
projectId: string;
|
|
80
86
|
tenantId: string;
|
|
81
87
|
id: string;
|
|
@@ -84,20 +90,22 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
84
90
|
scopes: ProjectScopeConfig;
|
|
85
91
|
conversationId: string;
|
|
86
92
|
}) => Promise<{
|
|
87
|
-
tenantId: string;
|
|
88
|
-
projectId: string;
|
|
89
|
-
agentId: string | null;
|
|
90
93
|
id: string;
|
|
91
94
|
createdAt: string;
|
|
92
95
|
updatedAt: string;
|
|
93
|
-
|
|
96
|
+
agentId: string | null;
|
|
97
|
+
projectId: string;
|
|
98
|
+
tenantId: string;
|
|
99
|
+
properties: Record<string, unknown> | null;
|
|
94
100
|
title: string | null;
|
|
95
|
-
|
|
101
|
+
metadata: ConversationMetadata | null;
|
|
96
102
|
ref: {
|
|
97
103
|
type: "commit" | "tag" | "branch";
|
|
98
104
|
name: string;
|
|
99
105
|
hash: string;
|
|
100
106
|
} | null;
|
|
107
|
+
userId: string | null;
|
|
108
|
+
userProperties: Record<string, unknown> | null;
|
|
101
109
|
activeSubAgentId: string;
|
|
102
110
|
lastContextResolution: string | null;
|
|
103
111
|
} | undefined>;
|
|
@@ -119,21 +127,25 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
119
127
|
lastContextResolution?: string | null | undefined;
|
|
120
128
|
metadata?: ConversationMetadata | null | undefined;
|
|
121
129
|
contextConfigId?: string | undefined;
|
|
130
|
+
userProperties?: Record<string, unknown> | null | undefined;
|
|
131
|
+
properties?: Record<string, unknown> | null | undefined;
|
|
122
132
|
} | {
|
|
123
|
-
tenantId: string;
|
|
124
|
-
projectId: string;
|
|
125
|
-
agentId: string | null;
|
|
126
133
|
id: string;
|
|
127
134
|
createdAt: string;
|
|
128
135
|
updatedAt: string;
|
|
129
|
-
|
|
136
|
+
agentId: string | null;
|
|
137
|
+
projectId: string;
|
|
138
|
+
tenantId: string;
|
|
139
|
+
properties: Record<string, unknown> | null;
|
|
130
140
|
title: string | null;
|
|
131
|
-
|
|
141
|
+
metadata: ConversationMetadata | null;
|
|
132
142
|
ref: {
|
|
133
143
|
type: "commit" | "tag" | "branch";
|
|
134
144
|
name: string;
|
|
135
145
|
hash: string;
|
|
136
146
|
} | null;
|
|
147
|
+
userId: string | null;
|
|
148
|
+
userProperties: Record<string, unknown> | null;
|
|
137
149
|
activeSubAgentId: string;
|
|
138
150
|
lastContextResolution: string | null;
|
|
139
151
|
}>;
|
|
@@ -152,20 +164,22 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
152
164
|
scopes: ProjectScopeConfig;
|
|
153
165
|
conversationId: string;
|
|
154
166
|
}) => Promise<{
|
|
155
|
-
tenantId: string;
|
|
156
|
-
projectId: string;
|
|
157
|
-
agentId: string | null;
|
|
158
167
|
id: string;
|
|
159
168
|
createdAt: string;
|
|
160
169
|
updatedAt: string;
|
|
161
|
-
|
|
170
|
+
agentId: string | null;
|
|
171
|
+
projectId: string;
|
|
172
|
+
tenantId: string;
|
|
173
|
+
properties: Record<string, unknown> | null;
|
|
162
174
|
title: string | null;
|
|
163
|
-
|
|
175
|
+
metadata: ConversationMetadata | null;
|
|
164
176
|
ref: {
|
|
165
177
|
type: "commit" | "tag" | "branch";
|
|
166
178
|
name: string;
|
|
167
179
|
hash: string;
|
|
168
180
|
} | null;
|
|
181
|
+
userId: string | null;
|
|
182
|
+
userProperties: Record<string, unknown> | null;
|
|
169
183
|
activeSubAgentId: string;
|
|
170
184
|
lastContextResolution: string | null;
|
|
171
185
|
} | undefined>;
|
|
@@ -180,6 +194,8 @@ declare const setActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
180
194
|
ref: ResolvedRef;
|
|
181
195
|
userId?: string;
|
|
182
196
|
metadata?: ConversationMetadata;
|
|
197
|
+
userProperties?: Record<string, unknown> | null;
|
|
198
|
+
properties?: Record<string, unknown> | null;
|
|
183
199
|
}) => Promise<void>;
|
|
184
200
|
declare const setActiveAgentForThread: (db: AgentsRunDatabaseClient) => ({
|
|
185
201
|
scopes,
|
|
@@ -60,14 +60,27 @@ const createOrGetConversation = (db) => async (input) => {
|
|
|
60
60
|
if (input.id) {
|
|
61
61
|
const existing = await db.query.conversations.findFirst({ where: and(eq(conversations.tenantId, input.tenantId), eq(conversations.id, input.id)) });
|
|
62
62
|
if (existing) {
|
|
63
|
+
const updateSet = { updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
64
|
+
let needsUpdate = false;
|
|
63
65
|
if (existing.activeSubAgentId !== input.activeSubAgentId) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
updateSet.activeSubAgentId = input.activeSubAgentId;
|
|
67
|
+
needsUpdate = true;
|
|
68
|
+
}
|
|
69
|
+
if (input.userProperties !== void 0) {
|
|
70
|
+
updateSet.userProperties = input.userProperties;
|
|
71
|
+
needsUpdate = true;
|
|
72
|
+
}
|
|
73
|
+
if (input.properties !== void 0) {
|
|
74
|
+
updateSet.properties = input.properties;
|
|
75
|
+
needsUpdate = true;
|
|
76
|
+
}
|
|
77
|
+
if (needsUpdate) {
|
|
78
|
+
await db.update(conversations).set(updateSet).where(eq(conversations.id, input.id));
|
|
68
79
|
return {
|
|
69
80
|
...existing,
|
|
70
|
-
activeSubAgentId:
|
|
81
|
+
...updateSet.activeSubAgentId ? { activeSubAgentId: updateSet.activeSubAgentId } : {},
|
|
82
|
+
...input.userProperties !== void 0 ? { userProperties: input.userProperties } : {},
|
|
83
|
+
...input.properties !== void 0 ? { properties: input.properties } : {}
|
|
71
84
|
};
|
|
72
85
|
}
|
|
73
86
|
return existing;
|
|
@@ -83,6 +96,8 @@ const createOrGetConversation = (db) => async (input) => {
|
|
|
83
96
|
title: input.title,
|
|
84
97
|
lastContextResolution: input.lastContextResolution,
|
|
85
98
|
metadata: input.metadata,
|
|
99
|
+
userProperties: input.userProperties,
|
|
100
|
+
properties: input.properties,
|
|
86
101
|
ref: input.ref,
|
|
87
102
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
88
103
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -134,6 +149,8 @@ function applyContextWindowManagement(messageHistory, maxOutputTokens) {
|
|
|
134
149
|
a2aTaskId: null,
|
|
135
150
|
a2aSessionId: null,
|
|
136
151
|
metadata: null,
|
|
152
|
+
userProperties: null,
|
|
153
|
+
properties: null,
|
|
137
154
|
createdAt: referenceMessage.createdAt,
|
|
138
155
|
updatedAt: referenceMessage.updatedAt
|
|
139
156
|
};
|
|
@@ -167,6 +184,7 @@ const getActiveAgentForConversation = (db) => async (params) => {
|
|
|
167
184
|
* Set active agent for a conversation (upsert operation)
|
|
168
185
|
*/
|
|
169
186
|
const setActiveAgentForConversation = (db) => async (params) => {
|
|
187
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
170
188
|
await db.insert(conversations).values({
|
|
171
189
|
id: params.conversationId,
|
|
172
190
|
tenantId: params.scopes.tenantId,
|
|
@@ -176,8 +194,10 @@ const setActiveAgentForConversation = (db) => async (params) => {
|
|
|
176
194
|
ref: params.ref,
|
|
177
195
|
userId: params.userId,
|
|
178
196
|
metadata: params.metadata,
|
|
179
|
-
|
|
180
|
-
|
|
197
|
+
userProperties: params.userProperties,
|
|
198
|
+
properties: params.properties,
|
|
199
|
+
createdAt: now,
|
|
200
|
+
updatedAt: now
|
|
181
201
|
}).onConflictDoUpdate({
|
|
182
202
|
target: [
|
|
183
203
|
conversations.tenantId,
|
|
@@ -186,7 +206,9 @@ const setActiveAgentForConversation = (db) => async (params) => {
|
|
|
186
206
|
],
|
|
187
207
|
set: {
|
|
188
208
|
activeSubAgentId: params.subAgentId,
|
|
189
|
-
updatedAt:
|
|
209
|
+
updatedAt: now,
|
|
210
|
+
...params.userProperties !== void 0 ? { userProperties: params.userProperties } : {},
|
|
211
|
+
...params.properties !== void 0 ? { properties: params.properties } : {}
|
|
190
212
|
}
|
|
191
213
|
});
|
|
192
214
|
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
|
|
2
|
+
import { PaginationConfig } from "../../types/utility.js";
|
|
3
|
+
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
4
|
+
import "../../types/index.js";
|
|
5
|
+
import { EventInsert } from "../../types/entities.js";
|
|
6
|
+
|
|
7
|
+
//#region src/data-access/runtime/events.d.ts
|
|
8
|
+
declare const createEvent: (db: AgentsRunDatabaseClient) => (params: EventInsert) => Promise<{
|
|
9
|
+
row: {
|
|
10
|
+
type: string;
|
|
11
|
+
id: string;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
agentId: string | null;
|
|
15
|
+
projectId: string;
|
|
16
|
+
tenantId: string;
|
|
17
|
+
properties: Record<string, unknown> | null;
|
|
18
|
+
metadata: Record<string, unknown> | null;
|
|
19
|
+
conversationId: string | null;
|
|
20
|
+
userProperties: Record<string, unknown> | null;
|
|
21
|
+
messageId: string | null;
|
|
22
|
+
serverMetadata: {
|
|
23
|
+
[k: string]: unknown;
|
|
24
|
+
authMethod?: string;
|
|
25
|
+
} | null;
|
|
26
|
+
};
|
|
27
|
+
conflict: false;
|
|
28
|
+
} | {
|
|
29
|
+
row: {
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
type: string;
|
|
33
|
+
agentId: string | null;
|
|
34
|
+
conversationId: string | null;
|
|
35
|
+
messageId: string | null;
|
|
36
|
+
properties: Record<string, unknown> | null;
|
|
37
|
+
userProperties: Record<string, unknown> | null;
|
|
38
|
+
metadata: Record<string, unknown> | null;
|
|
39
|
+
serverMetadata: {
|
|
40
|
+
[k: string]: unknown;
|
|
41
|
+
authMethod?: string;
|
|
42
|
+
} | null;
|
|
43
|
+
projectId: string;
|
|
44
|
+
tenantId: string;
|
|
45
|
+
id: string;
|
|
46
|
+
};
|
|
47
|
+
conflict: true;
|
|
48
|
+
}>;
|
|
49
|
+
declare const getEventById: (db: AgentsRunDatabaseClient) => (params: {
|
|
50
|
+
scopes: ProjectScopeConfig;
|
|
51
|
+
eventId: string;
|
|
52
|
+
}) => Promise<{
|
|
53
|
+
createdAt: string;
|
|
54
|
+
updatedAt: string;
|
|
55
|
+
type: string;
|
|
56
|
+
agentId: string | null;
|
|
57
|
+
conversationId: string | null;
|
|
58
|
+
messageId: string | null;
|
|
59
|
+
properties: Record<string, unknown> | null;
|
|
60
|
+
userProperties: Record<string, unknown> | null;
|
|
61
|
+
metadata: Record<string, unknown> | null;
|
|
62
|
+
serverMetadata: {
|
|
63
|
+
[k: string]: unknown;
|
|
64
|
+
authMethod?: string;
|
|
65
|
+
} | null;
|
|
66
|
+
projectId: string;
|
|
67
|
+
tenantId: string;
|
|
68
|
+
id: string;
|
|
69
|
+
}>;
|
|
70
|
+
declare const listEventsByConversationId: (db: AgentsRunDatabaseClient) => (params: {
|
|
71
|
+
scopes: ProjectScopeConfig;
|
|
72
|
+
conversationId: string;
|
|
73
|
+
pagination?: PaginationConfig;
|
|
74
|
+
}) => Promise<{
|
|
75
|
+
createdAt: string;
|
|
76
|
+
updatedAt: string;
|
|
77
|
+
type: string;
|
|
78
|
+
agentId: string | null;
|
|
79
|
+
conversationId: string | null;
|
|
80
|
+
messageId: string | null;
|
|
81
|
+
properties: Record<string, unknown> | null;
|
|
82
|
+
userProperties: Record<string, unknown> | null;
|
|
83
|
+
metadata: Record<string, unknown> | null;
|
|
84
|
+
serverMetadata: {
|
|
85
|
+
[k: string]: unknown;
|
|
86
|
+
authMethod?: string;
|
|
87
|
+
} | null;
|
|
88
|
+
projectId: string;
|
|
89
|
+
tenantId: string;
|
|
90
|
+
id: string;
|
|
91
|
+
}[]>;
|
|
92
|
+
//#endregion
|
|
93
|
+
export { createEvent, getEventById, listEventsByConversationId };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { events } from "../../db/runtime/runtime-schema.js";
|
|
2
|
+
import { projectScopedWhere } from "../manage/scope-helpers.js";
|
|
3
|
+
import { and, desc, eq } from "drizzle-orm";
|
|
4
|
+
|
|
5
|
+
//#region src/data-access/runtime/events.ts
|
|
6
|
+
const createEvent = (db) => async (params) => {
|
|
7
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
8
|
+
const [inserted] = await db.insert(events).values({
|
|
9
|
+
...params,
|
|
10
|
+
createdAt: now,
|
|
11
|
+
updatedAt: now
|
|
12
|
+
}).onConflictDoNothing({ target: [
|
|
13
|
+
events.tenantId,
|
|
14
|
+
events.projectId,
|
|
15
|
+
events.id
|
|
16
|
+
] }).returning();
|
|
17
|
+
if (inserted) return {
|
|
18
|
+
row: inserted,
|
|
19
|
+
conflict: false
|
|
20
|
+
};
|
|
21
|
+
const [existing] = await db.select().from(events).where(and(projectScopedWhere(events, {
|
|
22
|
+
tenantId: params.tenantId,
|
|
23
|
+
projectId: params.projectId
|
|
24
|
+
}), eq(events.id, params.id))).limit(1);
|
|
25
|
+
if (!existing) throw new Error(`createEvent: insert returned no row and no existing row found for id=${params.id}`);
|
|
26
|
+
return {
|
|
27
|
+
row: existing,
|
|
28
|
+
conflict: true
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const getEventById = (db) => async (params) => {
|
|
32
|
+
const [result] = await db.select().from(events).where(and(projectScopedWhere(events, params.scopes), eq(events.id, params.eventId))).limit(1);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
const listEventsByConversationId = (db) => async (params) => {
|
|
36
|
+
const page = params.pagination?.page || 1;
|
|
37
|
+
const limit = Math.min(params.pagination?.limit || 100, 100);
|
|
38
|
+
const offset = (page - 1) * limit;
|
|
39
|
+
return db.select().from(events).where(and(projectScopedWhere(events, params.scopes), eq(events.conversationId, params.conversationId))).orderBy(desc(events.createdAt)).limit(limit).offset(offset);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { createEvent, getEventById, listEventsByConversationId };
|
|
@@ -70,15 +70,15 @@ declare const getFeedbackByIds: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
70
70
|
agentId: string | null;
|
|
71
71
|
}[]>;
|
|
72
72
|
declare const createFeedback: (db: AgentsRunDatabaseClient) => (params: FeedbackInsert) => Promise<{
|
|
73
|
-
tenantId: string;
|
|
74
|
-
projectId: string;
|
|
75
73
|
type: "positive" | "negative";
|
|
76
74
|
id: string;
|
|
77
75
|
createdAt: string;
|
|
78
76
|
updatedAt: string;
|
|
77
|
+
projectId: string;
|
|
78
|
+
tenantId: string;
|
|
79
|
+
details: string | null;
|
|
79
80
|
conversationId: string;
|
|
80
81
|
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: {
|
|
@@ -100,15 +100,15 @@ declare const deleteFeedback: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
100
100
|
scopes: ProjectScopeConfig;
|
|
101
101
|
feedbackId: string;
|
|
102
102
|
}) => Promise<{
|
|
103
|
-
tenantId: string;
|
|
104
|
-
projectId: string;
|
|
105
103
|
type: "positive" | "negative";
|
|
106
104
|
id: string;
|
|
107
105
|
createdAt: string;
|
|
108
106
|
updatedAt: string;
|
|
107
|
+
projectId: string;
|
|
108
|
+
tenantId: string;
|
|
109
|
+
details: string | null;
|
|
109
110
|
conversationId: string;
|
|
110
111
|
messageId: string | null;
|
|
111
|
-
details: string | null;
|
|
112
112
|
}>;
|
|
113
113
|
//#endregion
|
|
114
114
|
export { createFeedback, createFeedbackBulk, deleteFeedback, getFeedbackById, getFeedbackByIds, listFeedback, listFeedbackByConversation, updateFeedback };
|
|
@@ -10,26 +10,28 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
10
10
|
scopes: ProjectScopeConfig;
|
|
11
11
|
messageId: string;
|
|
12
12
|
}) => Promise<{
|
|
13
|
-
tenantId: string;
|
|
14
|
-
projectId: string;
|
|
15
13
|
id: string;
|
|
16
14
|
createdAt: string;
|
|
17
15
|
updatedAt: string;
|
|
16
|
+
projectId: string;
|
|
17
|
+
tenantId: string;
|
|
18
|
+
properties: Record<string, unknown> | null;
|
|
18
19
|
metadata: MessageMetadata | null;
|
|
19
20
|
content: MessageContent;
|
|
20
21
|
role: string;
|
|
21
|
-
conversationId: string;
|
|
22
22
|
fromSubAgentId: string | null;
|
|
23
23
|
toSubAgentId: string | null;
|
|
24
24
|
fromExternalAgentId: string | null;
|
|
25
25
|
toExternalAgentId: string | null;
|
|
26
|
+
taskId: string | null;
|
|
27
|
+
a2aTaskId: string | null;
|
|
28
|
+
conversationId: string;
|
|
29
|
+
userProperties: Record<string, unknown> | null;
|
|
26
30
|
fromTeamAgentId: string | null;
|
|
27
31
|
toTeamAgentId: string | null;
|
|
28
32
|
visibility: string;
|
|
29
33
|
messageType: string;
|
|
30
|
-
taskId: string | null;
|
|
31
34
|
parentMessageId: string | null;
|
|
32
|
-
a2aTaskId: string | null;
|
|
33
35
|
a2aSessionId: string | null;
|
|
34
36
|
} | undefined>;
|
|
35
37
|
declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -54,6 +56,8 @@ declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
54
56
|
a2aTaskId: string | null;
|
|
55
57
|
a2aSessionId: string | null;
|
|
56
58
|
metadata: MessageMetadata | null;
|
|
59
|
+
userProperties: Record<string, unknown> | null;
|
|
60
|
+
properties: Record<string, unknown> | null;
|
|
57
61
|
projectId: string;
|
|
58
62
|
tenantId: string;
|
|
59
63
|
id: string;
|
|
@@ -81,6 +85,8 @@ declare const getMessagesByConversation: (db: AgentsRunDatabaseClient) => (param
|
|
|
81
85
|
a2aTaskId: string | null;
|
|
82
86
|
a2aSessionId: string | null;
|
|
83
87
|
metadata: MessageMetadata | null;
|
|
88
|
+
userProperties: Record<string, unknown> | null;
|
|
89
|
+
properties: Record<string, unknown> | null;
|
|
84
90
|
projectId: string;
|
|
85
91
|
tenantId: string;
|
|
86
92
|
id: string;
|
|
@@ -108,6 +114,8 @@ declare const getMessagesByTask: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
108
114
|
a2aTaskId: string | null;
|
|
109
115
|
a2aSessionId: string | null;
|
|
110
116
|
metadata: MessageMetadata | null;
|
|
117
|
+
userProperties: Record<string, unknown> | null;
|
|
118
|
+
properties: Record<string, unknown> | null;
|
|
111
119
|
projectId: string;
|
|
112
120
|
tenantId: string;
|
|
113
121
|
id: string;
|
|
@@ -136,6 +144,8 @@ declare const getVisibleMessages: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
136
144
|
a2aTaskId: string | null;
|
|
137
145
|
a2aSessionId: string | null;
|
|
138
146
|
metadata: MessageMetadata | null;
|
|
147
|
+
userProperties: Record<string, unknown> | null;
|
|
148
|
+
properties: Record<string, unknown> | null;
|
|
139
149
|
projectId: string;
|
|
140
150
|
tenantId: string;
|
|
141
151
|
id: string;
|
|
@@ -144,26 +154,28 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
144
154
|
scopes: ProjectScopeConfig;
|
|
145
155
|
data: Omit<MessageInsert, "tenantId" | "projectId">;
|
|
146
156
|
}) => Promise<{
|
|
147
|
-
tenantId: string;
|
|
148
|
-
projectId: string;
|
|
149
157
|
id: string;
|
|
150
158
|
createdAt: string;
|
|
151
159
|
updatedAt: string;
|
|
160
|
+
projectId: string;
|
|
161
|
+
tenantId: string;
|
|
162
|
+
properties: Record<string, unknown> | null;
|
|
152
163
|
metadata: MessageMetadata | null;
|
|
153
164
|
content: MessageContent;
|
|
154
165
|
role: string;
|
|
155
|
-
conversationId: string;
|
|
156
166
|
fromSubAgentId: string | null;
|
|
157
167
|
toSubAgentId: string | null;
|
|
158
168
|
fromExternalAgentId: string | null;
|
|
159
169
|
toExternalAgentId: string | null;
|
|
170
|
+
taskId: string | null;
|
|
171
|
+
a2aTaskId: string | null;
|
|
172
|
+
conversationId: string;
|
|
173
|
+
userProperties: Record<string, unknown> | null;
|
|
160
174
|
fromTeamAgentId: string | null;
|
|
161
175
|
toTeamAgentId: string | null;
|
|
162
176
|
visibility: string;
|
|
163
177
|
messageType: string;
|
|
164
|
-
taskId: string | null;
|
|
165
178
|
parentMessageId: string | null;
|
|
166
|
-
a2aTaskId: string | null;
|
|
167
179
|
a2aSessionId: string | null;
|
|
168
180
|
}>;
|
|
169
181
|
declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
@@ -189,6 +201,8 @@ declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
189
201
|
a2aTaskId: string | null;
|
|
190
202
|
a2aSessionId: string | null;
|
|
191
203
|
metadata: MessageMetadata | null;
|
|
204
|
+
userProperties: Record<string, unknown> | null;
|
|
205
|
+
properties: Record<string, unknown> | null;
|
|
192
206
|
projectId: string;
|
|
193
207
|
tenantId: string;
|
|
194
208
|
id: string;
|
|
@@ -197,26 +211,28 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
197
211
|
scopes: ProjectScopeConfig;
|
|
198
212
|
messageId: string;
|
|
199
213
|
}) => Promise<{
|
|
200
|
-
tenantId: string;
|
|
201
|
-
projectId: string;
|
|
202
214
|
id: string;
|
|
203
215
|
createdAt: string;
|
|
204
216
|
updatedAt: string;
|
|
217
|
+
projectId: string;
|
|
218
|
+
tenantId: string;
|
|
219
|
+
properties: Record<string, unknown> | null;
|
|
205
220
|
metadata: MessageMetadata | null;
|
|
206
221
|
content: MessageContent;
|
|
207
222
|
role: string;
|
|
208
|
-
conversationId: string;
|
|
209
223
|
fromSubAgentId: string | null;
|
|
210
224
|
toSubAgentId: string | null;
|
|
211
225
|
fromExternalAgentId: string | null;
|
|
212
226
|
toExternalAgentId: string | null;
|
|
227
|
+
taskId: string | null;
|
|
228
|
+
a2aTaskId: string | null;
|
|
229
|
+
conversationId: string;
|
|
230
|
+
userProperties: Record<string, unknown> | null;
|
|
213
231
|
fromTeamAgentId: string | null;
|
|
214
232
|
toTeamAgentId: string | null;
|
|
215
233
|
visibility: string;
|
|
216
234
|
messageType: string;
|
|
217
|
-
taskId: string | null;
|
|
218
235
|
parentMessageId: string | null;
|
|
219
|
-
a2aTaskId: string | null;
|
|
220
236
|
a2aSessionId: string | null;
|
|
221
237
|
}>;
|
|
222
238
|
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" | "failed" | "running" | "completed" | "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" | "failed" | "running" | "completed" | "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" | "failed" | "running" | "completed" | "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" | "failed" | "running" | "completed" | "cancelled";
|
|
296
296
|
scheduledFor: string;
|
|
297
297
|
startedAt: string | null;
|
|
298
298
|
completedAt: string | null;
|
|
@@ -15,8 +15,8 @@ declare const createScheduledTriggerUser: (db: AgentsRunDatabaseClient) => (para
|
|
|
15
15
|
scheduledTriggerId: string;
|
|
16
16
|
userId: string;
|
|
17
17
|
}) => Promise<{
|
|
18
|
-
tenantId: string;
|
|
19
18
|
createdAt: string;
|
|
19
|
+
tenantId: string;
|
|
20
20
|
userId: string;
|
|
21
21
|
scheduledTriggerId: string;
|
|
22
22
|
}>;
|
|
@@ -7,20 +7,20 @@ import { TaskInsert, TaskSelect } from "../../types/entities.js";
|
|
|
7
7
|
|
|
8
8
|
//#region src/data-access/runtime/tasks.d.ts
|
|
9
9
|
declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
|
|
10
|
-
tenantId: string;
|
|
11
|
-
projectId: string;
|
|
12
|
-
agentId: string;
|
|
13
|
-
subAgentId: string;
|
|
14
10
|
id: string;
|
|
15
|
-
status: string;
|
|
16
11
|
createdAt: string;
|
|
17
12
|
updatedAt: string;
|
|
13
|
+
agentId: string;
|
|
14
|
+
projectId: string;
|
|
15
|
+
tenantId: string;
|
|
18
16
|
metadata: TaskMetadataConfig | null;
|
|
19
17
|
ref: {
|
|
20
18
|
type: "commit" | "tag" | "branch";
|
|
21
19
|
name: string;
|
|
22
20
|
hash: string;
|
|
23
21
|
} | null;
|
|
22
|
+
status: string;
|
|
23
|
+
subAgentId: string;
|
|
24
24
|
contextId: string;
|
|
25
25
|
}>;
|
|
26
26
|
declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
|