@inkeep/agents-core 0.53.12 → 0.53.13
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 +85 -85
- package/dist/auth/auth-validation-schemas.d.ts +152 -152
- package/dist/auth/auth.d.ts +9 -9
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/client-exports.d.ts +2 -2
- package/dist/data-access/manage/agents.d.ts +20 -20
- package/dist/data-access/manage/artifactComponents.d.ts +6 -6
- package/dist/data-access/manage/contextConfigs.d.ts +4 -4
- package/dist/data-access/manage/dataComponents.d.ts +4 -4
- package/dist/data-access/manage/functionTools.d.ts +10 -10
- package/dist/data-access/manage/skills.d.ts +9 -9
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgentRelations.d.ts +10 -10
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgents.d.ts +12 -12
- package/dist/data-access/manage/tools.d.ts +9 -9
- package/dist/data-access/runtime/apiKeys.d.ts +12 -12
- package/dist/data-access/runtime/conversations.d.ts +8 -8
- package/dist/data-access/runtime/messages.d.ts +18 -18
- package/dist/data-access/runtime/tasks.d.ts +5 -5
- package/dist/db/manage/manage-schema.d.ts +447 -447
- package/dist/db/runtime/runtime-schema.d.ts +290 -290
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- 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/utils/mcp-client.d.ts +2 -1
- package/dist/utils/mcp-client.js +20 -5
- package/dist/validation/schemas.d.ts +1757 -1757
- package/package.json +1 -1
package/dist/utils/error.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { HTTPException } from "hono/http-exception";
|
|
|
3
3
|
|
|
4
4
|
//#region src/utils/error.d.ts
|
|
5
5
|
declare const ErrorCode: z.ZodEnum<{
|
|
6
|
-
unauthorized: "unauthorized";
|
|
7
6
|
bad_request: "bad_request";
|
|
7
|
+
unauthorized: "unauthorized";
|
|
8
8
|
forbidden: "forbidden";
|
|
9
9
|
not_found: "not_found";
|
|
10
10
|
conflict: "conflict";
|
|
@@ -19,8 +19,8 @@ declare const problemDetailsSchema: z.ZodObject<{
|
|
|
19
19
|
instance: z.ZodOptional<z.ZodString>;
|
|
20
20
|
requestId: z.ZodOptional<z.ZodString>;
|
|
21
21
|
code: z.ZodEnum<{
|
|
22
|
-
unauthorized: "unauthorized";
|
|
23
22
|
bad_request: "bad_request";
|
|
23
|
+
unauthorized: "unauthorized";
|
|
24
24
|
forbidden: "forbidden";
|
|
25
25
|
not_found: "not_found";
|
|
26
26
|
conflict: "conflict";
|
|
@@ -33,8 +33,8 @@ type ErrorCodes = z.infer<typeof ErrorCode>;
|
|
|
33
33
|
declare const errorResponseSchema: z.ZodObject<{
|
|
34
34
|
error: z.ZodObject<{
|
|
35
35
|
code: z.ZodEnum<{
|
|
36
|
-
unauthorized: "unauthorized";
|
|
37
36
|
bad_request: "bad_request";
|
|
37
|
+
unauthorized: "unauthorized";
|
|
38
38
|
forbidden: "forbidden";
|
|
39
39
|
not_found: "not_found";
|
|
40
40
|
conflict: "conflict";
|
|
@@ -71,12 +71,12 @@ declare const errorSchemaFactory: (code: ErrorCodes, description: string) => {
|
|
|
71
71
|
schema: z.ZodObject<{
|
|
72
72
|
instance: z.ZodOptional<z.ZodString>;
|
|
73
73
|
requestId: z.ZodOptional<z.ZodString>;
|
|
74
|
-
code: z.ZodLiteral<"
|
|
74
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
75
75
|
detail: z.ZodString;
|
|
76
76
|
title: z.ZodString;
|
|
77
77
|
status: z.ZodNumber;
|
|
78
78
|
error: z.ZodObject<{
|
|
79
|
-
code: z.ZodLiteral<"
|
|
79
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
80
80
|
message: z.ZodString;
|
|
81
81
|
}, z.core.$strip>;
|
|
82
82
|
}, z.core.$strip>;
|
|
@@ -93,12 +93,12 @@ declare const commonCreateErrorResponses: {
|
|
|
93
93
|
schema: z.ZodObject<{
|
|
94
94
|
instance: z.ZodOptional<z.ZodString>;
|
|
95
95
|
requestId: z.ZodOptional<z.ZodString>;
|
|
96
|
-
code: z.ZodLiteral<"
|
|
96
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
97
97
|
detail: z.ZodString;
|
|
98
98
|
title: z.ZodString;
|
|
99
99
|
status: z.ZodNumber;
|
|
100
100
|
error: z.ZodObject<{
|
|
101
|
-
code: z.ZodLiteral<"
|
|
101
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
102
102
|
message: z.ZodString;
|
|
103
103
|
}, z.core.$strip>;
|
|
104
104
|
}, z.core.$strip>;
|
|
@@ -112,12 +112,12 @@ declare const commonCreateErrorResponses: {
|
|
|
112
112
|
schema: z.ZodObject<{
|
|
113
113
|
instance: z.ZodOptional<z.ZodString>;
|
|
114
114
|
requestId: z.ZodOptional<z.ZodString>;
|
|
115
|
-
code: z.ZodLiteral<"
|
|
115
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
116
116
|
detail: z.ZodString;
|
|
117
117
|
title: z.ZodString;
|
|
118
118
|
status: z.ZodNumber;
|
|
119
119
|
error: z.ZodObject<{
|
|
120
|
-
code: z.ZodLiteral<"
|
|
120
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
121
121
|
message: z.ZodString;
|
|
122
122
|
}, z.core.$strip>;
|
|
123
123
|
}, z.core.$strip>;
|
|
@@ -131,12 +131,12 @@ declare const commonCreateErrorResponses: {
|
|
|
131
131
|
schema: z.ZodObject<{
|
|
132
132
|
instance: z.ZodOptional<z.ZodString>;
|
|
133
133
|
requestId: z.ZodOptional<z.ZodString>;
|
|
134
|
-
code: z.ZodLiteral<"
|
|
134
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
135
135
|
detail: z.ZodString;
|
|
136
136
|
title: z.ZodString;
|
|
137
137
|
status: z.ZodNumber;
|
|
138
138
|
error: z.ZodObject<{
|
|
139
|
-
code: z.ZodLiteral<"
|
|
139
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
140
140
|
message: z.ZodString;
|
|
141
141
|
}, z.core.$strip>;
|
|
142
142
|
}, z.core.$strip>;
|
|
@@ -150,12 +150,12 @@ declare const commonCreateErrorResponses: {
|
|
|
150
150
|
schema: z.ZodObject<{
|
|
151
151
|
instance: z.ZodOptional<z.ZodString>;
|
|
152
152
|
requestId: z.ZodOptional<z.ZodString>;
|
|
153
|
-
code: z.ZodLiteral<"
|
|
153
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
154
154
|
detail: z.ZodString;
|
|
155
155
|
title: z.ZodString;
|
|
156
156
|
status: z.ZodNumber;
|
|
157
157
|
error: z.ZodObject<{
|
|
158
|
-
code: z.ZodLiteral<"
|
|
158
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
159
159
|
message: z.ZodString;
|
|
160
160
|
}, z.core.$strip>;
|
|
161
161
|
}, z.core.$strip>;
|
|
@@ -169,12 +169,12 @@ declare const commonCreateErrorResponses: {
|
|
|
169
169
|
schema: z.ZodObject<{
|
|
170
170
|
instance: z.ZodOptional<z.ZodString>;
|
|
171
171
|
requestId: z.ZodOptional<z.ZodString>;
|
|
172
|
-
code: z.ZodLiteral<"
|
|
172
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
173
173
|
detail: z.ZodString;
|
|
174
174
|
title: z.ZodString;
|
|
175
175
|
status: z.ZodNumber;
|
|
176
176
|
error: z.ZodObject<{
|
|
177
|
-
code: z.ZodLiteral<"
|
|
177
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
178
178
|
message: z.ZodString;
|
|
179
179
|
}, z.core.$strip>;
|
|
180
180
|
}, z.core.$strip>;
|
|
@@ -190,12 +190,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
190
190
|
schema: z.ZodObject<{
|
|
191
191
|
instance: z.ZodOptional<z.ZodString>;
|
|
192
192
|
requestId: z.ZodOptional<z.ZodString>;
|
|
193
|
-
code: z.ZodLiteral<"
|
|
193
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
194
194
|
detail: z.ZodString;
|
|
195
195
|
title: z.ZodString;
|
|
196
196
|
status: z.ZodNumber;
|
|
197
197
|
error: z.ZodObject<{
|
|
198
|
-
code: z.ZodLiteral<"
|
|
198
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
199
199
|
message: z.ZodString;
|
|
200
200
|
}, z.core.$strip>;
|
|
201
201
|
}, z.core.$strip>;
|
|
@@ -209,12 +209,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
209
209
|
schema: z.ZodObject<{
|
|
210
210
|
instance: z.ZodOptional<z.ZodString>;
|
|
211
211
|
requestId: z.ZodOptional<z.ZodString>;
|
|
212
|
-
code: z.ZodLiteral<"
|
|
212
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
213
213
|
detail: z.ZodString;
|
|
214
214
|
title: z.ZodString;
|
|
215
215
|
status: z.ZodNumber;
|
|
216
216
|
error: z.ZodObject<{
|
|
217
|
-
code: z.ZodLiteral<"
|
|
217
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
218
218
|
message: z.ZodString;
|
|
219
219
|
}, z.core.$strip>;
|
|
220
220
|
}, z.core.$strip>;
|
|
@@ -228,12 +228,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
228
228
|
schema: z.ZodObject<{
|
|
229
229
|
instance: z.ZodOptional<z.ZodString>;
|
|
230
230
|
requestId: z.ZodOptional<z.ZodString>;
|
|
231
|
-
code: z.ZodLiteral<"
|
|
231
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
232
232
|
detail: z.ZodString;
|
|
233
233
|
title: z.ZodString;
|
|
234
234
|
status: z.ZodNumber;
|
|
235
235
|
error: z.ZodObject<{
|
|
236
|
-
code: z.ZodLiteral<"
|
|
236
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
237
237
|
message: z.ZodString;
|
|
238
238
|
}, z.core.$strip>;
|
|
239
239
|
}, z.core.$strip>;
|
|
@@ -247,12 +247,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
247
247
|
schema: z.ZodObject<{
|
|
248
248
|
instance: z.ZodOptional<z.ZodString>;
|
|
249
249
|
requestId: z.ZodOptional<z.ZodString>;
|
|
250
|
-
code: z.ZodLiteral<"
|
|
250
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
251
251
|
detail: z.ZodString;
|
|
252
252
|
title: z.ZodString;
|
|
253
253
|
status: z.ZodNumber;
|
|
254
254
|
error: z.ZodObject<{
|
|
255
|
-
code: z.ZodLiteral<"
|
|
255
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
256
256
|
message: z.ZodString;
|
|
257
257
|
}, z.core.$strip>;
|
|
258
258
|
}, z.core.$strip>;
|
|
@@ -266,12 +266,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
266
266
|
schema: z.ZodObject<{
|
|
267
267
|
instance: z.ZodOptional<z.ZodString>;
|
|
268
268
|
requestId: z.ZodOptional<z.ZodString>;
|
|
269
|
-
code: z.ZodLiteral<"
|
|
269
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
270
270
|
detail: z.ZodString;
|
|
271
271
|
title: z.ZodString;
|
|
272
272
|
status: z.ZodNumber;
|
|
273
273
|
error: z.ZodObject<{
|
|
274
|
-
code: z.ZodLiteral<"
|
|
274
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
275
275
|
message: z.ZodString;
|
|
276
276
|
}, z.core.$strip>;
|
|
277
277
|
}, z.core.$strip>;
|
|
@@ -285,12 +285,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
285
285
|
schema: z.ZodObject<{
|
|
286
286
|
instance: z.ZodOptional<z.ZodString>;
|
|
287
287
|
requestId: z.ZodOptional<z.ZodString>;
|
|
288
|
-
code: z.ZodLiteral<"
|
|
288
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
289
289
|
detail: z.ZodString;
|
|
290
290
|
title: z.ZodString;
|
|
291
291
|
status: z.ZodNumber;
|
|
292
292
|
error: z.ZodObject<{
|
|
293
|
-
code: z.ZodLiteral<"
|
|
293
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
294
294
|
message: z.ZodString;
|
|
295
295
|
}, z.core.$strip>;
|
|
296
296
|
}, z.core.$strip>;
|
|
@@ -306,12 +306,12 @@ declare const commonGetErrorResponses: {
|
|
|
306
306
|
schema: z.ZodObject<{
|
|
307
307
|
instance: z.ZodOptional<z.ZodString>;
|
|
308
308
|
requestId: z.ZodOptional<z.ZodString>;
|
|
309
|
-
code: z.ZodLiteral<"
|
|
309
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
310
310
|
detail: z.ZodString;
|
|
311
311
|
title: z.ZodString;
|
|
312
312
|
status: z.ZodNumber;
|
|
313
313
|
error: z.ZodObject<{
|
|
314
|
-
code: z.ZodLiteral<"
|
|
314
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
315
315
|
message: z.ZodString;
|
|
316
316
|
}, z.core.$strip>;
|
|
317
317
|
}, z.core.$strip>;
|
|
@@ -325,12 +325,12 @@ declare const commonGetErrorResponses: {
|
|
|
325
325
|
schema: z.ZodObject<{
|
|
326
326
|
instance: z.ZodOptional<z.ZodString>;
|
|
327
327
|
requestId: z.ZodOptional<z.ZodString>;
|
|
328
|
-
code: z.ZodLiteral<"
|
|
328
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
329
329
|
detail: z.ZodString;
|
|
330
330
|
title: z.ZodString;
|
|
331
331
|
status: z.ZodNumber;
|
|
332
332
|
error: z.ZodObject<{
|
|
333
|
-
code: z.ZodLiteral<"
|
|
333
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
334
334
|
message: z.ZodString;
|
|
335
335
|
}, z.core.$strip>;
|
|
336
336
|
}, z.core.$strip>;
|
|
@@ -344,12 +344,12 @@ declare const commonGetErrorResponses: {
|
|
|
344
344
|
schema: z.ZodObject<{
|
|
345
345
|
instance: z.ZodOptional<z.ZodString>;
|
|
346
346
|
requestId: z.ZodOptional<z.ZodString>;
|
|
347
|
-
code: z.ZodLiteral<"
|
|
347
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
348
348
|
detail: z.ZodString;
|
|
349
349
|
title: z.ZodString;
|
|
350
350
|
status: z.ZodNumber;
|
|
351
351
|
error: z.ZodObject<{
|
|
352
|
-
code: z.ZodLiteral<"
|
|
352
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
353
353
|
message: z.ZodString;
|
|
354
354
|
}, z.core.$strip>;
|
|
355
355
|
}, z.core.$strip>;
|
|
@@ -363,12 +363,12 @@ declare const commonGetErrorResponses: {
|
|
|
363
363
|
schema: z.ZodObject<{
|
|
364
364
|
instance: z.ZodOptional<z.ZodString>;
|
|
365
365
|
requestId: z.ZodOptional<z.ZodString>;
|
|
366
|
-
code: z.ZodLiteral<"
|
|
366
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
367
367
|
detail: z.ZodString;
|
|
368
368
|
title: z.ZodString;
|
|
369
369
|
status: z.ZodNumber;
|
|
370
370
|
error: z.ZodObject<{
|
|
371
|
-
code: z.ZodLiteral<"
|
|
371
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
372
372
|
message: z.ZodString;
|
|
373
373
|
}, z.core.$strip>;
|
|
374
374
|
}, z.core.$strip>;
|
|
@@ -382,12 +382,12 @@ declare const commonGetErrorResponses: {
|
|
|
382
382
|
schema: z.ZodObject<{
|
|
383
383
|
instance: z.ZodOptional<z.ZodString>;
|
|
384
384
|
requestId: z.ZodOptional<z.ZodString>;
|
|
385
|
-
code: z.ZodLiteral<"
|
|
385
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
386
386
|
detail: z.ZodString;
|
|
387
387
|
title: z.ZodString;
|
|
388
388
|
status: z.ZodNumber;
|
|
389
389
|
error: z.ZodObject<{
|
|
390
|
-
code: z.ZodLiteral<"
|
|
390
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
391
391
|
message: z.ZodString;
|
|
392
392
|
}, z.core.$strip>;
|
|
393
393
|
}, z.core.$strip>;
|
|
@@ -401,12 +401,12 @@ declare const commonGetErrorResponses: {
|
|
|
401
401
|
schema: z.ZodObject<{
|
|
402
402
|
instance: z.ZodOptional<z.ZodString>;
|
|
403
403
|
requestId: z.ZodOptional<z.ZodString>;
|
|
404
|
-
code: z.ZodLiteral<"
|
|
404
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
405
405
|
detail: z.ZodString;
|
|
406
406
|
title: z.ZodString;
|
|
407
407
|
status: z.ZodNumber;
|
|
408
408
|
error: z.ZodObject<{
|
|
409
|
-
code: z.ZodLiteral<"
|
|
409
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
410
410
|
message: z.ZodString;
|
|
411
411
|
}, z.core.$strip>;
|
|
412
412
|
}, z.core.$strip>;
|
|
@@ -422,12 +422,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
422
422
|
schema: z.ZodObject<{
|
|
423
423
|
instance: z.ZodOptional<z.ZodString>;
|
|
424
424
|
requestId: z.ZodOptional<z.ZodString>;
|
|
425
|
-
code: z.ZodLiteral<"
|
|
425
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
426
426
|
detail: z.ZodString;
|
|
427
427
|
title: z.ZodString;
|
|
428
428
|
status: z.ZodNumber;
|
|
429
429
|
error: z.ZodObject<{
|
|
430
|
-
code: z.ZodLiteral<"
|
|
430
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
431
431
|
message: z.ZodString;
|
|
432
432
|
}, z.core.$strip>;
|
|
433
433
|
}, z.core.$strip>;
|
|
@@ -441,12 +441,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
441
441
|
schema: z.ZodObject<{
|
|
442
442
|
instance: z.ZodOptional<z.ZodString>;
|
|
443
443
|
requestId: z.ZodOptional<z.ZodString>;
|
|
444
|
-
code: z.ZodLiteral<"
|
|
444
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
445
445
|
detail: z.ZodString;
|
|
446
446
|
title: z.ZodString;
|
|
447
447
|
status: z.ZodNumber;
|
|
448
448
|
error: z.ZodObject<{
|
|
449
|
-
code: z.ZodLiteral<"
|
|
449
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
450
450
|
message: z.ZodString;
|
|
451
451
|
}, z.core.$strip>;
|
|
452
452
|
}, z.core.$strip>;
|
|
@@ -460,12 +460,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
460
460
|
schema: z.ZodObject<{
|
|
461
461
|
instance: z.ZodOptional<z.ZodString>;
|
|
462
462
|
requestId: z.ZodOptional<z.ZodString>;
|
|
463
|
-
code: z.ZodLiteral<"
|
|
463
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
464
464
|
detail: z.ZodString;
|
|
465
465
|
title: z.ZodString;
|
|
466
466
|
status: z.ZodNumber;
|
|
467
467
|
error: z.ZodObject<{
|
|
468
|
-
code: z.ZodLiteral<"
|
|
468
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
469
469
|
message: z.ZodString;
|
|
470
470
|
}, z.core.$strip>;
|
|
471
471
|
}, z.core.$strip>;
|
|
@@ -479,12 +479,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
479
479
|
schema: z.ZodObject<{
|
|
480
480
|
instance: z.ZodOptional<z.ZodString>;
|
|
481
481
|
requestId: z.ZodOptional<z.ZodString>;
|
|
482
|
-
code: z.ZodLiteral<"
|
|
482
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
483
483
|
detail: z.ZodString;
|
|
484
484
|
title: z.ZodString;
|
|
485
485
|
status: z.ZodNumber;
|
|
486
486
|
error: z.ZodObject<{
|
|
487
|
-
code: z.ZodLiteral<"
|
|
487
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
488
488
|
message: z.ZodString;
|
|
489
489
|
}, z.core.$strip>;
|
|
490
490
|
}, z.core.$strip>;
|
|
@@ -498,12 +498,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
498
498
|
schema: z.ZodObject<{
|
|
499
499
|
instance: z.ZodOptional<z.ZodString>;
|
|
500
500
|
requestId: z.ZodOptional<z.ZodString>;
|
|
501
|
-
code: z.ZodLiteral<"
|
|
501
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
502
502
|
detail: z.ZodString;
|
|
503
503
|
title: z.ZodString;
|
|
504
504
|
status: z.ZodNumber;
|
|
505
505
|
error: z.ZodObject<{
|
|
506
|
-
code: z.ZodLiteral<"
|
|
506
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
507
507
|
message: z.ZodString;
|
|
508
508
|
}, z.core.$strip>;
|
|
509
509
|
}, z.core.$strip>;
|
|
@@ -517,12 +517,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
517
517
|
schema: z.ZodObject<{
|
|
518
518
|
instance: z.ZodOptional<z.ZodString>;
|
|
519
519
|
requestId: z.ZodOptional<z.ZodString>;
|
|
520
|
-
code: z.ZodLiteral<"
|
|
520
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
521
521
|
detail: z.ZodString;
|
|
522
522
|
title: z.ZodString;
|
|
523
523
|
status: z.ZodNumber;
|
|
524
524
|
error: z.ZodObject<{
|
|
525
|
-
code: z.ZodLiteral<"
|
|
525
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "internal_server_error" | "unprocessable_entity">;
|
|
526
526
|
message: z.ZodString;
|
|
527
527
|
}, z.core.$strip>;
|
|
528
528
|
}, z.core.$strip>;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JwtVerifyResult, SignJwtOptions, VerifyJwtOptions, decodeJwtPayload, extractBearerToken, getJwtSecret, hasIssuer, signJwt, verifyJwt } from "./jwt-helpers.js";
|
|
2
2
|
import { GenerateInternalServiceTokenParams, InternalServiceId, InternalServiceTokenPayload, InternalServices, VerifyInternalServiceTokenResult, generateInternalServiceToken, isInternalServiceToken, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, verifyInternalServiceAuthHeader, verifyInternalServiceToken } from "./internal-service-auth.js";
|
|
3
3
|
import { LoggerFactoryConfig, PinoLogger, PinoLoggerConfig, getLogger, loggerFactory } from "./logger.js";
|
|
4
|
-
import { McpClient, McpClientOptions, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig } from "./mcp-client.js";
|
|
4
|
+
import { McpClient, McpClientOptions, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig, activeMcpClients } from "./mcp-client.js";
|
|
5
5
|
import { ApiKeyGenerationResult, extractPublicId, generateApiKey, getMetadataFromApiKey, hashApiKey, isApiKeyExpired, maskApiKey, validateApiKey } from "./apiKeys.js";
|
|
6
6
|
import { McpOAuthFlowResult, McpTokenExchangeResult, OAuthConfig, detectAuthenticationRequired, exchangeMcpAuthorizationCode, initiateMcpOAuthFlow } from "./auth-detection.js";
|
|
7
7
|
import { generateId, getConversationId } from "./conversations.js";
|
|
@@ -28,4 +28,4 @@ import "./third-party-mcp-servers/index.js";
|
|
|
28
28
|
import { flushTraces, getTracer, setSpanWithError, unwrapError } from "./tracer-factory.js";
|
|
29
29
|
import { HashedHeaderValue, SignatureVerificationErrorCode, SignatureVerificationResult, TriggerAuthResult, hashAuthenticationHeaders, hashTriggerHeaderValue, validateTriggerHeaderValue, verifySignatureWithConfig, verifyTriggerAuth } from "./trigger-auth.js";
|
|
30
30
|
import { _resetWaitUntilCache, getWaitUntil } from "./wait-until.js";
|
|
31
|
-
export { ApiKeyGenerationResult, CommonCreateErrorResponses, CommonDeleteErrorResponses, CommonGetErrorResponses, CommonUpdateErrorResponses, CredentialScope, ERROR_DOCS_BASE_URL, ErrorCode, ErrorCodes, ErrorResponse, GenerateInternalServiceTokenParams, GenerateServiceTokenParams, HashedHeaderValue, InternalServiceId, InternalServiceTokenPayload, InternalServices, JsonTransformer, JwtVerifyResult, LLMMessage, LoggerFactoryConfig, McpClient, McpClientOptions, McpOAuthFlowResult, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig, McpTokenExchangeResult, MockLanguageModel, ModelFactory, OAuthConfig, ParsedSSEResponse, PinoLogger, PinoLoggerConfig, ProblemDetails, ServiceTokenPayload, SignJwtOptions, SignSlackLinkTokenParams, SignSlackUserTokenParams, SignatureVerificationErrorCode, SignatureVerificationResult, SignedTempToken, SlackAccessTokenPayload, SlackAccessTokenPayloadSchema, SlackLinkIntent, SlackLinkIntentSchema, SlackLinkTokenPayload, SlackLinkTokenPayloadSchema, TempTokenPayload, TriggerAuthResult, VerifyInternalServiceTokenResult, VerifyJwtOptions, VerifyServiceTokenResult, VerifySlackLinkTokenResult, VerifySlackUserTokenResult, _resetWaitUntilCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, configureComposioMCPServer, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError, createMockModel, decodeJwtPayload, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateInternalServiceToken, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getInProcessFetch, getJwtSecret, getLogger, getMetadataFromApiKey, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isInternalServiceToken, isSlackUserToken, isThirdPartyMCPServerAuthenticated, isUniqueConstraintError, isZodSchema, loggerFactory, maskApiKey, normalizeDateString, parseEmbeddedJson, parseSSEResponse, preview, problemDetailsSchema, registerAppFetch, retryWithBackoff, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, signTempToken, throwIfUniqueConstraintError, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
|
31
|
+
export { ApiKeyGenerationResult, CommonCreateErrorResponses, CommonDeleteErrorResponses, CommonGetErrorResponses, CommonUpdateErrorResponses, CredentialScope, ERROR_DOCS_BASE_URL, ErrorCode, ErrorCodes, ErrorResponse, GenerateInternalServiceTokenParams, GenerateServiceTokenParams, HashedHeaderValue, InternalServiceId, InternalServiceTokenPayload, InternalServices, JsonTransformer, JwtVerifyResult, LLMMessage, LoggerFactoryConfig, McpClient, McpClientOptions, McpOAuthFlowResult, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig, McpTokenExchangeResult, MockLanguageModel, ModelFactory, OAuthConfig, ParsedSSEResponse, PinoLogger, PinoLoggerConfig, ProblemDetails, ServiceTokenPayload, SignJwtOptions, SignSlackLinkTokenParams, SignSlackUserTokenParams, SignatureVerificationErrorCode, SignatureVerificationResult, SignedTempToken, SlackAccessTokenPayload, SlackAccessTokenPayloadSchema, SlackLinkIntent, SlackLinkIntentSchema, SlackLinkTokenPayload, SlackLinkTokenPayloadSchema, TempTokenPayload, TriggerAuthResult, VerifyInternalServiceTokenResult, VerifyJwtOptions, VerifyServiceTokenResult, VerifySlackLinkTokenResult, VerifySlackUserTokenResult, _resetWaitUntilCache, activeMcpClients, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, configureComposioMCPServer, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError, createMockModel, decodeJwtPayload, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateInternalServiceToken, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getInProcessFetch, getJwtSecret, getLogger, getMetadataFromApiKey, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isInternalServiceToken, isSlackUserToken, isThirdPartyMCPServerAuthenticated, isUniqueConstraintError, isZodSchema, loggerFactory, maskApiKey, normalizeDateString, parseEmbeddedJson, parseSSEResponse, preview, problemDetailsSchema, registerAppFetch, retryWithBackoff, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, signTempToken, throwIfUniqueConstraintError, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
package/dist/utils/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { formatMessagesForLLM, formatMessagesForLLMContext } from "./format-mess
|
|
|
12
12
|
import { getInProcessFetch, registerAppFetch } from "./in-process-fetch.js";
|
|
13
13
|
import { JsonTransformer } from "./JsonTransformer.js";
|
|
14
14
|
import { parseEmbeddedJson } from "./json-parser.js";
|
|
15
|
-
import { McpClient } from "./mcp-client.js";
|
|
15
|
+
import { McpClient, activeMcpClients } from "./mcp-client.js";
|
|
16
16
|
import { MockLanguageModel, createMockModel } from "./mock-provider.js";
|
|
17
17
|
import { ModelFactory } from "./model-factory.js";
|
|
18
18
|
import { retryWithBackoff } from "./retry.js";
|
|
@@ -29,4 +29,4 @@ import { flushTraces, getTracer, setSpanWithError, unwrapError } from "./tracer-
|
|
|
29
29
|
import { hashAuthenticationHeaders, hashTriggerHeaderValue, validateTriggerHeaderValue, verifySignatureWithConfig, verifyTriggerAuth } from "./trigger-auth.js";
|
|
30
30
|
import { _resetWaitUntilCache, getWaitUntil } from "./wait-until.js";
|
|
31
31
|
|
|
32
|
-
export { ERROR_DOCS_BASE_URL, ErrorCode, InternalServices, JsonTransformer, McpClient, MockLanguageModel, ModelFactory, PinoLogger, SlackAccessTokenPayloadSchema, SlackLinkIntentSchema, SlackLinkTokenPayloadSchema, _resetWaitUntilCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, configureComposioMCPServer, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError, createMockModel, decodeJwtPayload, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateInternalServiceToken, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getInProcessFetch, getJwtSecret, getLogger, getMetadataFromApiKey, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isInternalServiceToken, isSlackUserToken, isThirdPartyMCPServerAuthenticated, isUniqueConstraintError, isZodSchema, loggerFactory, maskApiKey, normalizeDateString, parseEmbeddedJson, parseSSEResponse, preview, problemDetailsSchema, registerAppFetch, retryWithBackoff, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, signTempToken, throwIfUniqueConstraintError, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
|
32
|
+
export { ERROR_DOCS_BASE_URL, ErrorCode, InternalServices, JsonTransformer, McpClient, MockLanguageModel, ModelFactory, PinoLogger, SlackAccessTokenPayloadSchema, SlackLinkIntentSchema, SlackLinkTokenPayloadSchema, _resetWaitUntilCache, activeMcpClients, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, configureComposioMCPServer, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, createApiError, createMockModel, decodeJwtPayload, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, generateApiKey, generateId, generateInternalServiceToken, generateServiceToken, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getCredentialStoreLookupKeyFromRetrievalParams, getInProcessFetch, getJwtSecret, getLogger, getMetadataFromApiKey, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isInternalServiceToken, isSlackUserToken, isThirdPartyMCPServerAuthenticated, isUniqueConstraintError, isZodSchema, loggerFactory, maskApiKey, normalizeDateString, parseEmbeddedJson, parseSSEResponse, preview, problemDetailsSchema, registerAppFetch, retryWithBackoff, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, signTempToken, throwIfUniqueConstraintError, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
|
@@ -4,6 +4,7 @@ import { SSEClientTransportOptions } from "@modelcontextprotocol/sdk/client/sse.
|
|
|
4
4
|
import { StreamableHTTPClientTransportOptions } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/mcp-client.d.ts
|
|
7
|
+
declare const activeMcpClients: Set<McpClient>;
|
|
7
8
|
interface SharedServerConfig {
|
|
8
9
|
timeout?: number;
|
|
9
10
|
activeTools?: string[];
|
|
@@ -50,4 +51,4 @@ declare class McpClient {
|
|
|
50
51
|
tools(): Promise<Record<string, any>>;
|
|
51
52
|
}
|
|
52
53
|
//#endregion
|
|
53
|
-
export { McpClient, McpClientOptions, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig };
|
|
54
|
+
export { McpClient, McpClientOptions, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig, activeMcpClients };
|
package/dist/utils/mcp-client.js
CHANGED
|
@@ -7,10 +7,24 @@ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
|
7
7
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
8
8
|
import { DEFAULT_REQUEST_TIMEOUT_MSEC } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
9
9
|
import { tool } from "ai";
|
|
10
|
-
import { asyncExitHook
|
|
10
|
+
import { asyncExitHook } from "exit-hook";
|
|
11
11
|
import { match } from "ts-pattern";
|
|
12
12
|
|
|
13
13
|
//#region src/utils/mcp-client.ts
|
|
14
|
+
const activeMcpClients = /* @__PURE__ */ new Set();
|
|
15
|
+
let exitHookRegistered = false;
|
|
16
|
+
function ensureExitHook() {
|
|
17
|
+
if (exitHookRegistered) return;
|
|
18
|
+
exitHookRegistered = true;
|
|
19
|
+
asyncExitHook(async () => {
|
|
20
|
+
const clients = Array.from(activeMcpClients);
|
|
21
|
+
const results = await Promise.allSettled(clients.map((c) => c.disconnect()));
|
|
22
|
+
for (let i = 0; i < results.length; i++) {
|
|
23
|
+
const result = results[i];
|
|
24
|
+
if (result.status === "rejected") console.error(`[MCP] Failed to disconnect client "${clients[i]?.name}" during exit:`, result.reason);
|
|
25
|
+
}
|
|
26
|
+
}, { wait: 5e3 });
|
|
27
|
+
}
|
|
14
28
|
var McpClient = class {
|
|
15
29
|
name;
|
|
16
30
|
client;
|
|
@@ -39,8 +53,8 @@ var McpClient = class {
|
|
|
39
53
|
this.connected = false;
|
|
40
54
|
if (typeof close === "function") close();
|
|
41
55
|
};
|
|
42
|
-
|
|
43
|
-
|
|
56
|
+
ensureExitHook();
|
|
57
|
+
activeMcpClients.add(this);
|
|
44
58
|
}
|
|
45
59
|
async connectSSE(config) {
|
|
46
60
|
const url = typeof config.url === "string" ? config.url : config.url.toString();
|
|
@@ -88,11 +102,12 @@ var McpClient = class {
|
|
|
88
102
|
await this.client.connect(this.transport, { timeout: MCP_TOOL_CONNECTION_TIMEOUT_MS });
|
|
89
103
|
}
|
|
90
104
|
async disconnect() {
|
|
105
|
+
activeMcpClients.delete(this);
|
|
91
106
|
if (!this.transport) return;
|
|
92
107
|
try {
|
|
93
108
|
await this.transport.close();
|
|
94
109
|
} catch (e) {
|
|
95
|
-
console.error(e);
|
|
110
|
+
console.error(`[MCP] Error disconnecting client "${this.name}":`, e);
|
|
96
111
|
throw e;
|
|
97
112
|
} finally {
|
|
98
113
|
this.transport = void 0;
|
|
@@ -174,4 +189,4 @@ var McpClient = class {
|
|
|
174
189
|
};
|
|
175
190
|
|
|
176
191
|
//#endregion
|
|
177
|
-
export { McpClient };
|
|
192
|
+
export { McpClient, activeMcpClients };
|