@inkeep/agents-core 0.42.0 → 0.43.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.d.ts +24 -24
- package/dist/auth/auth.js +17 -13
- package/dist/auth/authz/client.d.ts +9 -3
- package/dist/auth/authz/client.js +24 -17
- package/dist/auth/authz/config.d.ts +51 -24
- package/dist/auth/authz/config.js +44 -27
- package/dist/auth/authz/index.d.ts +3 -3
- package/dist/auth/authz/index.js +3 -3
- package/dist/auth/authz/permissions.d.ts +0 -4
- package/dist/auth/authz/permissions.js +13 -13
- package/dist/auth/authz/sync.d.ts +23 -2
- package/dist/auth/authz/sync.js +136 -52
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/client-exports.d.ts +3 -2
- package/dist/client-exports.js +3 -2
- package/dist/constants/execution-limits-shared/defaults.d.ts +1 -1
- package/dist/constants/execution-limits-shared/defaults.js +1 -1
- package/dist/constants/execution-limits-shared/index.d.ts +1 -1
- package/dist/context/TemplateEngine.d.ts +0 -6
- package/dist/context/TemplateEngine.js +4 -18
- package/dist/credential-stores/keychain-store.d.ts +20 -8
- package/dist/credential-stores/keychain-store.js +107 -43
- package/dist/data-access/index.d.ts +3 -3
- package/dist/data-access/index.js +3 -3
- package/dist/data-access/manage/agentFull.js +28 -24
- package/dist/data-access/manage/agents.d.ts +41 -41
- package/dist/data-access/manage/agents.js +29 -21
- package/dist/data-access/manage/artifactComponents.d.ts +12 -12
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/dataComponents.d.ts +6 -6
- package/dist/data-access/manage/functionTools.d.ts +42 -19
- package/dist/data-access/manage/functionTools.js +34 -22
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentRelations.d.ts +36 -36
- 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 +40 -34
- package/dist/data-access/manage/tools.js +53 -30
- package/dist/data-access/manage/triggers.d.ts +27 -1
- package/dist/data-access/runtime/apiKeys.d.ts +20 -20
- package/dist/data-access/runtime/conversations.d.ts +31 -31
- package/dist/data-access/runtime/messages.d.ts +9 -9
- package/dist/data-access/runtime/organizations.d.ts +2 -2
- package/dist/data-access/runtime/organizations.js +2 -2
- package/dist/data-access/runtime/tasks.d.ts +7 -7
- package/dist/db/manage/manage-schema.d.ts +516 -402
- package/dist/db/manage/manage-schema.js +37 -27
- package/dist/db/runtime/runtime-schema.d.ts +181 -181
- package/dist/db/utils.d.ts +6 -0
- package/dist/db/utils.js +42 -0
- package/dist/dolt/index.d.ts +2 -2
- package/dist/dolt/index.js +2 -2
- package/dist/dolt/migrate-all-branches.js +5 -0
- package/dist/dolt/migrate-dolt.js +4 -1
- package/dist/dolt/schema-sync.d.ts +2 -1
- package/dist/dolt/schema-sync.js +10 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/types/@napi-rs__keyring/index.d.ts +14 -0
- package/dist/types/utility.d.ts +1 -1
- package/dist/types/utility.js +2 -1
- package/dist/utils/JsonTransformer.d.ts +1 -3
- package/dist/utils/JsonTransformer.js +14 -23
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/utils/jmespath-utils.d.ts +152 -0
- package/dist/utils/jmespath-utils.js +213 -0
- package/dist/utils/mcp-client.d.ts +1 -1
- package/dist/utils/mcp-client.js +1 -1
- package/dist/utils/signature-validation.d.ts +2 -0
- package/dist/utils/signature-validation.js +3 -0
- package/dist/utils/third-party-mcp-servers/composio-client.d.ts +13 -1
- package/dist/utils/third-party-mcp-servers/composio-client.js +24 -6
- package/dist/utils/third-party-mcp-servers/index.d.ts +2 -2
- package/dist/utils/third-party-mcp-servers/index.js +2 -2
- package/dist/utils/trigger-auth.d.ts +31 -8
- package/dist/utils/trigger-auth.js +121 -13
- package/dist/validation/dolt-schemas.d.ts +1 -1
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/index.d.ts +3 -3
- package/dist/validation/index.js +3 -3
- package/dist/validation/render-validation.js +19 -0
- package/dist/validation/schemas.d.ts +2502 -2285
- package/dist/validation/schemas.js +246 -16
- package/dist/validation/stream-event-schemas.d.ts +96 -1
- package/dist/validation/stream-event-schemas.js +67 -2
- package/drizzle/manage/0003_tiny_captain_universe.sql +8 -0
- package/drizzle/manage/0004_curious_phil_sheldon.sql +2 -0
- package/drizzle/manage/0005_silent_shatterstar.sql +53 -0
- package/drizzle/manage/meta/0003_snapshot.json +3134 -0
- package/drizzle/manage/meta/0004_snapshot.json +3141 -0
- package/drizzle/manage/meta/0005_snapshot.json +3141 -0
- package/drizzle/manage/meta/_journal.json +21 -0
- package/package.json +9 -4
- package/spicedb/schema.zed +114 -0
|
@@ -8,15 +8,15 @@ declare const getAgentRelationById: (db: AgentsManageDatabaseClient) => (params:
|
|
|
8
8
|
scopes: AgentScopeConfig;
|
|
9
9
|
relationId: string;
|
|
10
10
|
}) => Promise<{
|
|
11
|
-
tenantId: string;
|
|
12
|
-
projectId: string;
|
|
13
11
|
id: string;
|
|
14
|
-
agentId: string;
|
|
15
12
|
createdAt: string;
|
|
16
13
|
updatedAt: string;
|
|
14
|
+
tenantId: string;
|
|
15
|
+
agentId: string;
|
|
16
|
+
projectId: string;
|
|
17
|
+
relationType: string | null;
|
|
17
18
|
sourceSubAgentId: string;
|
|
18
19
|
targetSubAgentId: string | null;
|
|
19
|
-
relationType: string | null;
|
|
20
20
|
} | undefined>;
|
|
21
21
|
declare const listAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
22
22
|
scopes: AgentScopeConfig;
|
|
@@ -43,28 +43,28 @@ declare const listAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
43
43
|
declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
44
44
|
scopes: SubAgentScopeConfig;
|
|
45
45
|
}) => Promise<{
|
|
46
|
-
tenantId: string;
|
|
47
|
-
projectId: string;
|
|
48
46
|
id: string;
|
|
49
|
-
agentId: string;
|
|
50
47
|
createdAt: string;
|
|
51
48
|
updatedAt: string;
|
|
49
|
+
tenantId: string;
|
|
50
|
+
agentId: string;
|
|
51
|
+
projectId: string;
|
|
52
|
+
relationType: string | null;
|
|
52
53
|
sourceSubAgentId: string;
|
|
53
54
|
targetSubAgentId: string | null;
|
|
54
|
-
relationType: string | null;
|
|
55
55
|
}[]>;
|
|
56
56
|
declare const getAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
57
57
|
scopes: AgentScopeConfig;
|
|
58
58
|
}) => Promise<{
|
|
59
|
-
tenantId: string;
|
|
60
|
-
projectId: string;
|
|
61
59
|
id: string;
|
|
62
|
-
agentId: string;
|
|
63
60
|
createdAt: string;
|
|
64
61
|
updatedAt: string;
|
|
62
|
+
tenantId: string;
|
|
63
|
+
agentId: string;
|
|
64
|
+
projectId: string;
|
|
65
|
+
relationType: string | null;
|
|
65
66
|
sourceSubAgentId: string;
|
|
66
67
|
targetSubAgentId: string | null;
|
|
67
|
-
relationType: string | null;
|
|
68
68
|
}[]>;
|
|
69
69
|
declare const getAgentRelationsBySource: (db: AgentsManageDatabaseClient) => (params: {
|
|
70
70
|
scopes: AgentScopeConfig;
|
|
@@ -125,15 +125,15 @@ declare const getRelatedAgentsForAgent: (db: AgentsManageDatabaseClient) => (par
|
|
|
125
125
|
}[];
|
|
126
126
|
}>;
|
|
127
127
|
declare const createSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
|
|
128
|
-
tenantId: string;
|
|
129
|
-
projectId: string;
|
|
130
128
|
id: string;
|
|
131
|
-
agentId: string;
|
|
132
129
|
createdAt: string;
|
|
133
130
|
updatedAt: string;
|
|
131
|
+
tenantId: string;
|
|
132
|
+
agentId: string;
|
|
133
|
+
projectId: string;
|
|
134
|
+
relationType: string | null;
|
|
134
135
|
sourceSubAgentId: string;
|
|
135
136
|
targetSubAgentId: string | null;
|
|
136
|
-
relationType: string | null;
|
|
137
137
|
}>;
|
|
138
138
|
/**
|
|
139
139
|
* Check if sub-agent relation exists by agent, source, target, and relation type
|
|
@@ -144,29 +144,29 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
|
|
|
144
144
|
targetSubAgentId?: string;
|
|
145
145
|
relationType: string;
|
|
146
146
|
}) => Promise<{
|
|
147
|
-
tenantId: string;
|
|
148
|
-
projectId: string;
|
|
149
147
|
id: string;
|
|
150
|
-
agentId: string;
|
|
151
148
|
createdAt: string;
|
|
152
149
|
updatedAt: string;
|
|
150
|
+
tenantId: string;
|
|
151
|
+
agentId: string;
|
|
152
|
+
projectId: string;
|
|
153
|
+
relationType: string | null;
|
|
153
154
|
sourceSubAgentId: string;
|
|
154
155
|
targetSubAgentId: string | null;
|
|
155
|
-
relationType: string | null;
|
|
156
156
|
} | undefined>;
|
|
157
157
|
/**
|
|
158
158
|
* Upsert agent relation (create if it doesn't exist, no-op if it does)
|
|
159
159
|
*/
|
|
160
160
|
declare const upsertSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
|
|
161
|
-
tenantId: string;
|
|
162
|
-
projectId: string;
|
|
163
161
|
id: string;
|
|
164
|
-
agentId: string;
|
|
165
162
|
createdAt: string;
|
|
166
163
|
updatedAt: string;
|
|
164
|
+
tenantId: string;
|
|
165
|
+
agentId: string;
|
|
166
|
+
projectId: string;
|
|
167
|
+
relationType: string | null;
|
|
167
168
|
sourceSubAgentId: string;
|
|
168
169
|
targetSubAgentId: string | null;
|
|
169
|
-
relationType: string | null;
|
|
170
170
|
}>;
|
|
171
171
|
declare const updateAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
|
|
172
172
|
scopes: AgentScopeConfig;
|
|
@@ -203,19 +203,19 @@ declare const createAgentToolRelation: (db: AgentsManageDatabaseClient) => (para
|
|
|
203
203
|
}> | null;
|
|
204
204
|
};
|
|
205
205
|
}) => Promise<{
|
|
206
|
-
tenantId: string;
|
|
207
|
-
projectId: string;
|
|
208
206
|
id: string;
|
|
209
|
-
agentId: string;
|
|
210
207
|
createdAt: string;
|
|
211
208
|
updatedAt: string;
|
|
212
|
-
|
|
209
|
+
tenantId: string;
|
|
210
|
+
agentId: string;
|
|
211
|
+
projectId: string;
|
|
212
|
+
subAgentId: string;
|
|
213
213
|
headers: Record<string, string> | null;
|
|
214
|
+
toolId: string;
|
|
215
|
+
selectedTools: string[] | null;
|
|
214
216
|
toolPolicies: Record<string, {
|
|
215
217
|
needsApproval?: boolean;
|
|
216
218
|
}> | null;
|
|
217
|
-
subAgentId: string;
|
|
218
|
-
selectedTools: string[] | null;
|
|
219
219
|
}>;
|
|
220
220
|
declare const updateAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
|
|
221
221
|
scopes: AgentScopeConfig;
|
|
@@ -247,19 +247,19 @@ declare const getAgentToolRelationById: (db: AgentsManageDatabaseClient) => (par
|
|
|
247
247
|
scopes: SubAgentScopeConfig;
|
|
248
248
|
relationId: string;
|
|
249
249
|
}) => Promise<{
|
|
250
|
-
tenantId: string;
|
|
251
|
-
projectId: string;
|
|
252
250
|
id: string;
|
|
253
|
-
agentId: string;
|
|
254
251
|
createdAt: string;
|
|
255
252
|
updatedAt: string;
|
|
256
|
-
|
|
253
|
+
tenantId: string;
|
|
254
|
+
agentId: string;
|
|
255
|
+
projectId: string;
|
|
256
|
+
subAgentId: string;
|
|
257
257
|
headers: Record<string, string> | null;
|
|
258
|
+
toolId: string;
|
|
259
|
+
selectedTools: string[] | null;
|
|
258
260
|
toolPolicies: Record<string, {
|
|
259
261
|
needsApproval?: boolean;
|
|
260
262
|
}> | null;
|
|
261
|
-
subAgentId: string;
|
|
262
|
-
selectedTools: string[] | null;
|
|
263
263
|
} | undefined>;
|
|
264
264
|
declare const getAgentToolRelationByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
265
265
|
scopes: SubAgentScopeConfig;
|
|
@@ -8,14 +8,14 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
|
|
|
8
8
|
scopes: SubAgentScopeConfig;
|
|
9
9
|
relationId: string;
|
|
10
10
|
}) => Promise<{
|
|
11
|
-
tenantId: string;
|
|
12
|
-
projectId: string;
|
|
13
11
|
id: string;
|
|
14
|
-
agentId: string;
|
|
15
12
|
createdAt: string;
|
|
16
13
|
updatedAt: string;
|
|
17
|
-
|
|
14
|
+
tenantId: string;
|
|
15
|
+
agentId: string;
|
|
16
|
+
projectId: string;
|
|
18
17
|
subAgentId: string;
|
|
18
|
+
headers: Record<string, string> | null;
|
|
19
19
|
targetAgentId: string;
|
|
20
20
|
} | undefined>;
|
|
21
21
|
declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -43,27 +43,27 @@ declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =
|
|
|
43
43
|
declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
44
44
|
scopes: SubAgentScopeConfig;
|
|
45
45
|
}) => Promise<{
|
|
46
|
-
tenantId: string;
|
|
47
|
-
projectId: string;
|
|
48
46
|
id: string;
|
|
49
|
-
agentId: string;
|
|
50
47
|
createdAt: string;
|
|
51
48
|
updatedAt: string;
|
|
52
|
-
|
|
49
|
+
tenantId: string;
|
|
50
|
+
agentId: string;
|
|
51
|
+
projectId: string;
|
|
53
52
|
subAgentId: string;
|
|
53
|
+
headers: Record<string, string> | null;
|
|
54
54
|
targetAgentId: string;
|
|
55
55
|
}[]>;
|
|
56
56
|
declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
57
57
|
scopes: AgentScopeConfig;
|
|
58
58
|
}) => Promise<{
|
|
59
|
-
tenantId: string;
|
|
60
|
-
projectId: string;
|
|
61
59
|
id: string;
|
|
62
|
-
agentId: string;
|
|
63
60
|
createdAt: string;
|
|
64
61
|
updatedAt: string;
|
|
65
|
-
|
|
62
|
+
tenantId: string;
|
|
63
|
+
agentId: string;
|
|
64
|
+
projectId: string;
|
|
66
65
|
subAgentId: string;
|
|
66
|
+
headers: Record<string, string> | null;
|
|
67
67
|
targetAgentId: string;
|
|
68
68
|
}[]>;
|
|
69
69
|
declare const getSubAgentTeamAgentRelationsByTeamAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -209,14 +209,14 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
|
|
|
209
209
|
headers?: Record<string, string> | null;
|
|
210
210
|
};
|
|
211
211
|
}) => Promise<{
|
|
212
|
-
tenantId: string;
|
|
213
|
-
projectId: string;
|
|
214
212
|
id: string;
|
|
215
|
-
agentId: string;
|
|
216
213
|
createdAt: string;
|
|
217
214
|
updatedAt: string;
|
|
218
|
-
|
|
215
|
+
tenantId: string;
|
|
216
|
+
agentId: string;
|
|
217
|
+
projectId: string;
|
|
219
218
|
subAgentId: string;
|
|
219
|
+
headers: Record<string, string> | null;
|
|
220
220
|
targetAgentId: string;
|
|
221
221
|
}>;
|
|
222
222
|
/**
|
|
@@ -226,14 +226,14 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
|
|
|
226
226
|
scopes: SubAgentScopeConfig;
|
|
227
227
|
targetAgentId: string;
|
|
228
228
|
}) => Promise<{
|
|
229
|
-
tenantId: string;
|
|
230
|
-
projectId: string;
|
|
231
229
|
id: string;
|
|
232
|
-
agentId: string;
|
|
233
230
|
createdAt: string;
|
|
234
231
|
updatedAt: string;
|
|
235
|
-
|
|
232
|
+
tenantId: string;
|
|
233
|
+
agentId: string;
|
|
234
|
+
projectId: string;
|
|
236
235
|
subAgentId: string;
|
|
236
|
+
headers: Record<string, string> | null;
|
|
237
237
|
targetAgentId: string;
|
|
238
238
|
} | undefined>;
|
|
239
239
|
/**
|
|
@@ -247,14 +247,14 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
|
|
|
247
247
|
headers?: Record<string, string> | null;
|
|
248
248
|
};
|
|
249
249
|
}) => Promise<{
|
|
250
|
-
tenantId: string;
|
|
251
|
-
projectId: string;
|
|
252
250
|
id: string;
|
|
253
|
-
agentId: string;
|
|
254
251
|
createdAt: string;
|
|
255
252
|
updatedAt: string;
|
|
256
|
-
|
|
253
|
+
tenantId: string;
|
|
254
|
+
agentId: string;
|
|
255
|
+
projectId: string;
|
|
257
256
|
subAgentId: string;
|
|
257
|
+
headers: Record<string, string> | null;
|
|
258
258
|
targetAgentId: string;
|
|
259
259
|
}>;
|
|
260
260
|
declare const updateSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -8,15 +8,14 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
8
8
|
scopes: AgentScopeConfig;
|
|
9
9
|
subAgentId: string;
|
|
10
10
|
}) => Promise<{
|
|
11
|
-
tenantId: string;
|
|
12
|
-
projectId: string;
|
|
13
11
|
id: string;
|
|
14
12
|
name: string;
|
|
15
|
-
description: string | null;
|
|
16
|
-
prompt: string | null;
|
|
17
|
-
agentId: string;
|
|
18
13
|
createdAt: string;
|
|
19
14
|
updatedAt: string;
|
|
15
|
+
description: string | null;
|
|
16
|
+
tenantId: string;
|
|
17
|
+
agentId: string;
|
|
18
|
+
projectId: string;
|
|
20
19
|
models: {
|
|
21
20
|
base?: {
|
|
22
21
|
model?: string | undefined;
|
|
@@ -31,6 +30,7 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
31
30
|
providerOptions?: Record<string, any> | undefined;
|
|
32
31
|
} | undefined;
|
|
33
32
|
} | null;
|
|
33
|
+
prompt: string | null;
|
|
34
34
|
stopWhen: {
|
|
35
35
|
stepCountIs?: number | undefined;
|
|
36
36
|
} | null;
|
|
@@ -39,15 +39,14 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
39
39
|
declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
40
40
|
scopes: AgentScopeConfig;
|
|
41
41
|
}) => Promise<{
|
|
42
|
-
tenantId: string;
|
|
43
|
-
projectId: string;
|
|
44
42
|
id: string;
|
|
45
43
|
name: string;
|
|
46
|
-
description: string | null;
|
|
47
|
-
prompt: string | null;
|
|
48
|
-
agentId: string;
|
|
49
44
|
createdAt: string;
|
|
50
45
|
updatedAt: string;
|
|
46
|
+
description: string | null;
|
|
47
|
+
tenantId: string;
|
|
48
|
+
agentId: string;
|
|
49
|
+
projectId: string;
|
|
51
50
|
models: {
|
|
52
51
|
base?: {
|
|
53
52
|
model?: string | undefined;
|
|
@@ -62,6 +61,7 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
62
61
|
providerOptions?: Record<string, any> | undefined;
|
|
63
62
|
} | undefined;
|
|
64
63
|
} | null;
|
|
64
|
+
prompt: string | null;
|
|
65
65
|
stopWhen: {
|
|
66
66
|
stepCountIs?: number | undefined;
|
|
67
67
|
} | null;
|
|
@@ -108,15 +108,14 @@ declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (param
|
|
|
108
108
|
};
|
|
109
109
|
}>;
|
|
110
110
|
declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAgentInsert) => Promise<{
|
|
111
|
-
tenantId: string;
|
|
112
|
-
projectId: string;
|
|
113
111
|
id: string;
|
|
114
112
|
name: string;
|
|
115
|
-
description: string | null;
|
|
116
|
-
prompt: string | null;
|
|
117
|
-
agentId: string;
|
|
118
113
|
createdAt: string;
|
|
119
114
|
updatedAt: string;
|
|
115
|
+
description: string | null;
|
|
116
|
+
tenantId: string;
|
|
117
|
+
agentId: string;
|
|
118
|
+
projectId: string;
|
|
120
119
|
models: {
|
|
121
120
|
base?: {
|
|
122
121
|
model?: string | undefined;
|
|
@@ -131,6 +130,7 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
|
|
|
131
130
|
providerOptions?: Record<string, any> | undefined;
|
|
132
131
|
} | undefined;
|
|
133
132
|
} | null;
|
|
133
|
+
prompt: string | null;
|
|
134
134
|
stopWhen: {
|
|
135
135
|
stepCountIs?: number | undefined;
|
|
136
136
|
} | null;
|
|
@@ -7,24 +7,30 @@ import "../../index.js";
|
|
|
7
7
|
import { McpTool, ToolInsert, ToolSelect, ToolUpdate } from "../../types/entities.js";
|
|
8
8
|
|
|
9
9
|
//#region src/data-access/manage/tools.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Convert DB result to McpTool skeleton WITHOUT MCP discovery.
|
|
12
|
+
* This is a fast path that returns status='unknown' and empty availableTools.
|
|
13
|
+
* Use this for list views where you want instant page load.
|
|
14
|
+
*/
|
|
15
|
+
declare const dbResultToMcpToolSkeleton: (dbResult: ToolSelect, relationshipId?: string) => McpTool;
|
|
10
16
|
declare const dbResultToMcpTool: (dbResult: ToolSelect, dbClient: AgentsManageDatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry, relationshipId?: string, userId?: string) => Promise<McpTool>;
|
|
11
17
|
declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
|
|
12
18
|
scopes: ProjectScopeConfig;
|
|
13
19
|
toolId: string;
|
|
14
20
|
}) => Promise<{
|
|
15
|
-
tenantId: string;
|
|
16
|
-
projectId: string;
|
|
17
21
|
id: string;
|
|
18
22
|
name: string;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
19
25
|
description: string | null;
|
|
26
|
+
tenantId: string;
|
|
27
|
+
projectId: string;
|
|
28
|
+
headers: Record<string, string> | null;
|
|
20
29
|
config: {
|
|
21
30
|
type: "mcp";
|
|
22
31
|
mcp: ToolMcpConfig;
|
|
23
32
|
};
|
|
24
33
|
credentialReferenceId: string | null;
|
|
25
|
-
createdAt: string;
|
|
26
|
-
updatedAt: string;
|
|
27
|
-
headers: Record<string, string> | null;
|
|
28
34
|
credentialScope: string;
|
|
29
35
|
imageUrl: string | null;
|
|
30
36
|
capabilities: ToolServerCapabilities | null;
|
|
@@ -68,19 +74,19 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
68
74
|
};
|
|
69
75
|
}>;
|
|
70
76
|
declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
|
|
71
|
-
tenantId: string;
|
|
72
|
-
projectId: string;
|
|
73
77
|
id: string;
|
|
74
78
|
name: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
updatedAt: string;
|
|
75
81
|
description: string | null;
|
|
82
|
+
tenantId: string;
|
|
83
|
+
projectId: string;
|
|
84
|
+
headers: Record<string, string> | null;
|
|
76
85
|
config: {
|
|
77
86
|
type: "mcp";
|
|
78
87
|
mcp: ToolMcpConfig;
|
|
79
88
|
};
|
|
80
89
|
credentialReferenceId: string | null;
|
|
81
|
-
createdAt: string;
|
|
82
|
-
updatedAt: string;
|
|
83
|
-
headers: Record<string, string> | null;
|
|
84
90
|
credentialScope: string;
|
|
85
91
|
imageUrl: string | null;
|
|
86
92
|
capabilities: ToolServerCapabilities | null;
|
|
@@ -123,38 +129,38 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
123
129
|
needsApproval?: boolean;
|
|
124
130
|
}> | null;
|
|
125
131
|
}) => Promise<{
|
|
126
|
-
tenantId: string;
|
|
127
|
-
projectId: string;
|
|
128
132
|
id: string;
|
|
129
|
-
agentId: string;
|
|
130
133
|
createdAt: string;
|
|
131
134
|
updatedAt: string;
|
|
132
|
-
|
|
135
|
+
tenantId: string;
|
|
136
|
+
agentId: string;
|
|
137
|
+
projectId: string;
|
|
138
|
+
subAgentId: string;
|
|
133
139
|
headers: Record<string, string> | null;
|
|
140
|
+
toolId: string;
|
|
141
|
+
selectedTools: string[] | null;
|
|
134
142
|
toolPolicies: Record<string, {
|
|
135
143
|
needsApproval?: boolean;
|
|
136
144
|
}> | null;
|
|
137
|
-
subAgentId: string;
|
|
138
|
-
selectedTools: string[] | null;
|
|
139
145
|
}>;
|
|
140
146
|
declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
141
147
|
scopes: AgentScopeConfig;
|
|
142
148
|
subAgentId: string;
|
|
143
149
|
toolId: string;
|
|
144
150
|
}) => Promise<{
|
|
145
|
-
tenantId: string;
|
|
146
|
-
projectId: string;
|
|
147
151
|
id: string;
|
|
148
|
-
agentId: string;
|
|
149
152
|
createdAt: string;
|
|
150
153
|
updatedAt: string;
|
|
151
|
-
|
|
154
|
+
tenantId: string;
|
|
155
|
+
agentId: string;
|
|
156
|
+
projectId: string;
|
|
157
|
+
subAgentId: string;
|
|
152
158
|
headers: Record<string, string> | null;
|
|
159
|
+
toolId: string;
|
|
160
|
+
selectedTools: string[] | null;
|
|
153
161
|
toolPolicies: Record<string, {
|
|
154
162
|
needsApproval?: boolean;
|
|
155
163
|
}> | null;
|
|
156
|
-
subAgentId: string;
|
|
157
|
-
selectedTools: string[] | null;
|
|
158
164
|
}>;
|
|
159
165
|
/**
|
|
160
166
|
* Upsert agent-tool relation (create if it doesn't exist, update if it does)
|
|
@@ -170,19 +176,19 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
170
176
|
}> | null;
|
|
171
177
|
relationId?: string;
|
|
172
178
|
}) => Promise<{
|
|
173
|
-
tenantId: string;
|
|
174
|
-
projectId: string;
|
|
175
179
|
id: string;
|
|
176
|
-
agentId: string;
|
|
177
180
|
createdAt: string;
|
|
178
181
|
updatedAt: string;
|
|
179
|
-
|
|
182
|
+
tenantId: string;
|
|
183
|
+
agentId: string;
|
|
184
|
+
projectId: string;
|
|
185
|
+
subAgentId: string;
|
|
180
186
|
headers: Record<string, string> | null;
|
|
187
|
+
toolId: string;
|
|
188
|
+
selectedTools: string[] | null;
|
|
181
189
|
toolPolicies: Record<string, {
|
|
182
190
|
needsApproval?: boolean;
|
|
183
191
|
}> | null;
|
|
184
|
-
subAgentId: string;
|
|
185
|
-
selectedTools: string[] | null;
|
|
186
192
|
}>;
|
|
187
193
|
/**
|
|
188
194
|
* Upsert a tool (create if it doesn't exist, update if it does)
|
|
@@ -190,23 +196,23 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
190
196
|
declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
191
197
|
data: ToolInsert;
|
|
192
198
|
}) => Promise<{
|
|
193
|
-
tenantId: string;
|
|
194
|
-
projectId: string;
|
|
195
199
|
id: string;
|
|
196
200
|
name: string;
|
|
201
|
+
createdAt: string;
|
|
202
|
+
updatedAt: string;
|
|
197
203
|
description: string | null;
|
|
204
|
+
tenantId: string;
|
|
205
|
+
projectId: string;
|
|
206
|
+
headers: Record<string, string> | null;
|
|
198
207
|
config: {
|
|
199
208
|
type: "mcp";
|
|
200
209
|
mcp: ToolMcpConfig;
|
|
201
210
|
};
|
|
202
211
|
credentialReferenceId: string | null;
|
|
203
|
-
createdAt: string;
|
|
204
|
-
updatedAt: string;
|
|
205
|
-
headers: Record<string, string> | null;
|
|
206
212
|
credentialScope: string;
|
|
207
213
|
imageUrl: string | null;
|
|
208
214
|
capabilities: ToolServerCapabilities | null;
|
|
209
215
|
lastError: string | null;
|
|
210
216
|
}>;
|
|
211
217
|
//#endregion
|
|
212
|
-
export { addToolToAgent, createTool, dbResultToMcpTool, deleteTool, getMcpToolById, getToolById, listTools, removeToolFromAgent, updateTool, upsertSubAgentToolRelation, upsertTool };
|
|
218
|
+
export { addToolToAgent, createTool, dbResultToMcpTool, dbResultToMcpToolSkeleton, deleteTool, getMcpToolById, getToolById, listTools, removeToolFromAgent, updateTool, upsertSubAgentToolRelation, upsertTool };
|
|
@@ -9,12 +9,28 @@ import { generateId } from "../../utils/conversations.js";
|
|
|
9
9
|
import { updateAgentToolRelation } from "./subAgentRelations.js";
|
|
10
10
|
import { toISODateString } from "../../utils/date.js";
|
|
11
11
|
import { McpClient } from "../../utils/mcp-client.js";
|
|
12
|
+
import { buildComposioMCPUrl } from "../../utils/third-party-mcp-servers/composio-client.js";
|
|
12
13
|
import { isThirdPartyMCPServerAuthenticated } from "../../utils/third-party-mcp-servers/third-party-check.js";
|
|
13
14
|
import "../../utils/index.js";
|
|
14
15
|
import { getCredentialReference, getUserScopedCredentialReference } from "./credentialReferences.js";
|
|
15
16
|
import { and, count, desc, eq } from "drizzle-orm";
|
|
17
|
+
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
16
18
|
|
|
17
19
|
//#region src/data-access/manage/tools.ts
|
|
20
|
+
/**
|
|
21
|
+
* Check if an error is a timeout/connection error.
|
|
22
|
+
* Uses MCP SDK ErrorCode for proper type safety.
|
|
23
|
+
*/
|
|
24
|
+
function isTimeoutOrConnectionError(error) {
|
|
25
|
+
if (error instanceof McpError) return error.code === ErrorCode.RequestTimeout || error.code === ErrorCode.ConnectionClosed;
|
|
26
|
+
if (error instanceof Error) {
|
|
27
|
+
const message = error.message.toLowerCase();
|
|
28
|
+
const cause = error.cause;
|
|
29
|
+
if (message.includes("timed out") || message.includes("timeout")) return true;
|
|
30
|
+
if (cause?.code === "ETIMEDOUT" || cause?.code === "ECONNABORTED" || cause?.code === "ECONNRESET") return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
18
34
|
const logger = getLogger("tools");
|
|
19
35
|
/**
|
|
20
36
|
* Extract expiration date from credential data stored in credential store
|
|
@@ -70,24 +86,10 @@ const convertToMCPToolConfig = (tool) => {
|
|
|
70
86
|
toolOverrides: tool.config.mcp.toolOverrides
|
|
71
87
|
};
|
|
72
88
|
};
|
|
73
|
-
const discoverToolsFromServer = async (tool,
|
|
89
|
+
const discoverToolsFromServer = async (tool, credentialReference, credentialStoreRegistry, userId) => {
|
|
74
90
|
if (tool.config.type !== "mcp") throw new Error(`Cannot discover tools from non-MCP tool: ${tool.id}`);
|
|
75
91
|
try {
|
|
76
92
|
let serverConfig;
|
|
77
|
-
const credentialReference = tool.credentialReferenceId && tool.credentialScope !== "user" ? await getCredentialReference(dbClient)({
|
|
78
|
-
scopes: {
|
|
79
|
-
tenantId: tool.tenantId,
|
|
80
|
-
projectId: tool.projectId
|
|
81
|
-
},
|
|
82
|
-
id: tool.credentialReferenceId
|
|
83
|
-
}) : userId && tool.credentialScope === "user" ? await getUserScopedCredentialReference(dbClient)({
|
|
84
|
-
scopes: {
|
|
85
|
-
tenantId: tool.tenantId,
|
|
86
|
-
projectId: tool.projectId
|
|
87
|
-
},
|
|
88
|
-
toolId: tool.id,
|
|
89
|
-
userId
|
|
90
|
-
}) : void 0;
|
|
91
93
|
if (credentialReference) {
|
|
92
94
|
const storeReference = {
|
|
93
95
|
credentialStoreId: credentialReference.credentialStoreId,
|
|
@@ -111,12 +113,7 @@ const discoverToolsFromServer = async (tool, dbClient, credentialStoreRegistry,
|
|
|
111
113
|
reconnectionOptions: tool.config.mcp.transport?.reconnectionOptions,
|
|
112
114
|
sessionId: tool.config.mcp.transport?.sessionId
|
|
113
115
|
};
|
|
114
|
-
if (serverConfig.url
|
|
115
|
-
const urlObj = new URL(serverConfig.url.toString());
|
|
116
|
-
if (tool.credentialScope === "user" && userId) urlObj.searchParams.set("user_id", userId);
|
|
117
|
-
else urlObj.searchParams.set("user_id", `${tool.tenantId}||${tool.projectId}`);
|
|
118
|
-
serverConfig.url = urlObj.toString();
|
|
119
|
-
}
|
|
116
|
+
if (serverConfig.url) serverConfig.url = buildComposioMCPUrl(serverConfig.url.toString(), tool.tenantId, tool.projectId, tool.credentialScope === "user" ? "user" : "project", userId);
|
|
120
117
|
const client = new McpClient({
|
|
121
118
|
name: tool.name,
|
|
122
119
|
server: serverConfig
|
|
@@ -141,6 +138,27 @@ const discoverToolsFromServer = async (tool, dbClient, credentialStoreRegistry,
|
|
|
141
138
|
throw error;
|
|
142
139
|
}
|
|
143
140
|
};
|
|
141
|
+
/**
|
|
142
|
+
* Convert DB result to McpTool skeleton WITHOUT MCP discovery.
|
|
143
|
+
* This is a fast path that returns status='unknown' and empty availableTools.
|
|
144
|
+
* Use this for list views where you want instant page load.
|
|
145
|
+
*/
|
|
146
|
+
const dbResultToMcpToolSkeleton = (dbResult, relationshipId) => {
|
|
147
|
+
const { headers, capabilities, credentialReferenceId, imageUrl, createdAt, ...rest } = dbResult;
|
|
148
|
+
return {
|
|
149
|
+
...rest,
|
|
150
|
+
status: "unknown",
|
|
151
|
+
availableTools: [],
|
|
152
|
+
capabilities: capabilities || void 0,
|
|
153
|
+
credentialReferenceId: credentialReferenceId || void 0,
|
|
154
|
+
createdAt: toISODateString(createdAt),
|
|
155
|
+
updatedAt: toISODateString(dbResult.updatedAt),
|
|
156
|
+
lastError: dbResult.lastError || null,
|
|
157
|
+
headers: headers || void 0,
|
|
158
|
+
imageUrl: imageUrl || void 0,
|
|
159
|
+
relationshipId
|
|
160
|
+
};
|
|
161
|
+
};
|
|
144
162
|
const dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry, relationshipId, userId) => {
|
|
145
163
|
const { headers, capabilities, credentialReferenceId, imageUrl, createdAt, ...rest } = dbResult;
|
|
146
164
|
if (dbResult.config.type !== "mcp") return {
|
|
@@ -181,18 +199,23 @@ const dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry, re
|
|
|
181
199
|
}
|
|
182
200
|
const mcpServerUrl = dbResult.config.mcp.server.url;
|
|
183
201
|
try {
|
|
184
|
-
availableTools = await discoverToolsFromServer(dbResult,
|
|
202
|
+
availableTools = await discoverToolsFromServer(dbResult, credentialReference, credentialStoreRegistry, userId);
|
|
185
203
|
status = "healthy";
|
|
186
204
|
lastErrorComputed = null;
|
|
187
205
|
} catch (error) {
|
|
188
|
-
const toolNeedsAuth = error instanceof Error && await detectAuthenticationRequired({
|
|
189
|
-
serverUrl: mcpServerUrl,
|
|
190
|
-
error,
|
|
191
|
-
logger
|
|
192
|
-
});
|
|
193
|
-
status = toolNeedsAuth ? "needs_auth" : "unhealthy";
|
|
194
206
|
const errorMessage = error instanceof Error ? error.message : "Tool discovery failed";
|
|
195
|
-
|
|
207
|
+
if (isTimeoutOrConnectionError(error)) {
|
|
208
|
+
status = "unavailable";
|
|
209
|
+
lastErrorComputed = `Connection failed - the MCP server may be slow or temporarily unreachable.${error instanceof McpError ? ` (MCP error ${error.code})` : ""} ${errorMessage}`;
|
|
210
|
+
} else {
|
|
211
|
+
const toolNeedsAuth = await detectAuthenticationRequired({
|
|
212
|
+
serverUrl: mcpServerUrl,
|
|
213
|
+
error: error instanceof Error ? error : void 0,
|
|
214
|
+
logger
|
|
215
|
+
});
|
|
216
|
+
status = toolNeedsAuth ? "needs_auth" : "unhealthy";
|
|
217
|
+
lastErrorComputed = toolNeedsAuth ? `Authentication required - OAuth login needed. ${errorMessage}` : errorMessage;
|
|
218
|
+
}
|
|
196
219
|
}
|
|
197
220
|
if (dbResult.config.mcp.server.url.includes("composio.dev")) {
|
|
198
221
|
const credentialScope = dbResult.credentialScope || "project";
|
|
@@ -351,4 +374,4 @@ const upsertTool = (db) => async (params) => {
|
|
|
351
374
|
};
|
|
352
375
|
|
|
353
376
|
//#endregion
|
|
354
|
-
export { addToolToAgent, createTool, dbResultToMcpTool, deleteTool, getMcpToolById, getToolById, listTools, removeToolFromAgent, updateTool, upsertSubAgentToolRelation, upsertTool };
|
|
377
|
+
export { addToolToAgent, createTool, dbResultToMcpTool, dbResultToMcpToolSkeleton, deleteTool, getMcpToolById, getToolById, listTools, removeToolFromAgent, updateTool, upsertSubAgentToolRelation, upsertTool };
|
|
@@ -35,7 +35,33 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
|
|
|
35
35
|
} | null;
|
|
36
36
|
messageTemplate: string | null;
|
|
37
37
|
authentication: unknown;
|
|
38
|
-
|
|
38
|
+
signingSecretCredentialReferenceId: string | null;
|
|
39
|
+
signatureVerification: {
|
|
40
|
+
algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
|
|
41
|
+
encoding: "hex" | "base64";
|
|
42
|
+
signature: {
|
|
43
|
+
source: "query" | "body" | "header";
|
|
44
|
+
key: string;
|
|
45
|
+
prefix?: string | undefined;
|
|
46
|
+
regex?: string | undefined;
|
|
47
|
+
};
|
|
48
|
+
signedComponents: {
|
|
49
|
+
source: "literal" | "body" | "header";
|
|
50
|
+
required: boolean;
|
|
51
|
+
key?: string | undefined;
|
|
52
|
+
value?: string | undefined;
|
|
53
|
+
regex?: string | undefined;
|
|
54
|
+
}[];
|
|
55
|
+
componentJoin: {
|
|
56
|
+
strategy: "concatenate";
|
|
57
|
+
separator: string;
|
|
58
|
+
};
|
|
59
|
+
validation?: {
|
|
60
|
+
headerCaseSensitive: boolean;
|
|
61
|
+
allowEmptyBody: boolean;
|
|
62
|
+
normalizeUnicode: boolean;
|
|
63
|
+
} | undefined;
|
|
64
|
+
} | null;
|
|
39
65
|
name: string;
|
|
40
66
|
description: string | null;
|
|
41
67
|
agentId: string;
|