@inkeep/agents-core 0.74.3 → 0.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/auth-schema.d.ts +227 -227
- package/dist/auth/auth-validation-schemas.d.ts +154 -154
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/constants/models.d.ts +1 -0
- package/dist/constants/models.js +1 -0
- package/dist/data-access/manage/agents.d.ts +30 -30
- package/dist/data-access/manage/artifactComponents.d.ts +12 -12
- package/dist/data-access/manage/contextConfigs.d.ts +8 -8
- package/dist/data-access/manage/dataComponents.d.ts +4 -4
- package/dist/data-access/manage/functionTools.d.ts +12 -12
- package/dist/data-access/manage/skills.d.ts +13 -13
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgents.d.ts +18 -18
- package/dist/data-access/manage/tools.d.ts +21 -21
- package/dist/data-access/manage/triggers.d.ts +3 -3
- package/dist/data-access/runtime/apiKeys.d.ts +16 -16
- package/dist/data-access/runtime/apps.d.ts +17 -17
- package/dist/data-access/runtime/conversations.d.ts +28 -28
- package/dist/data-access/runtime/events.d.ts +4 -4
- package/dist/data-access/runtime/feedback.d.ts +4 -4
- package/dist/data-access/runtime/messages.d.ts +21 -21
- package/dist/data-access/runtime/tasks.d.ts +4 -4
- package/dist/db/manage/manage-schema.d.ts +484 -484
- package/dist/db/runtime/runtime-schema.d.ts +451 -451
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/setup/setup.js +0 -5
- package/dist/utils/error.d.ts +57 -51
- package/dist/utils/error.js +8 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +2 -2
- package/dist/utils/pow.d.ts +15 -1
- package/dist/utils/pow.js +59 -1
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/schemas/skills.d.ts +56 -56
- package/dist/validation/schemas.d.ts +2488 -2488
- package/package.json +1 -1
package/dist/utils/error.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ import { HTTPException } from "hono/http-exception";
|
|
|
9
9
|
*/
|
|
10
10
|
declare function getDatabaseErrorLogContext(error: unknown): Record<string, unknown>;
|
|
11
11
|
declare const ErrorCode: z.ZodEnum<{
|
|
12
|
-
unauthorized: "unauthorized";
|
|
13
12
|
bad_request: "bad_request";
|
|
13
|
+
unauthorized: "unauthorized";
|
|
14
14
|
payment_required: "payment_required";
|
|
15
15
|
forbidden: "forbidden";
|
|
16
16
|
not_found: "not_found";
|
|
@@ -18,6 +18,8 @@ declare const ErrorCode: z.ZodEnum<{
|
|
|
18
18
|
too_many_requests: "too_many_requests";
|
|
19
19
|
internal_server_error: "internal_server_error";
|
|
20
20
|
unprocessable_entity: "unprocessable_entity";
|
|
21
|
+
bad_gateway: "bad_gateway";
|
|
22
|
+
service_unavailable: "service_unavailable";
|
|
21
23
|
}>;
|
|
22
24
|
declare const ERROR_DOCS_BASE_URL = "https://docs.inkeep.com/agents-api/errors";
|
|
23
25
|
declare const problemDetailsSchema: z.ZodObject<{
|
|
@@ -27,8 +29,8 @@ declare const problemDetailsSchema: z.ZodObject<{
|
|
|
27
29
|
instance: z.ZodOptional<z.ZodString>;
|
|
28
30
|
requestId: z.ZodOptional<z.ZodString>;
|
|
29
31
|
code: z.ZodEnum<{
|
|
30
|
-
unauthorized: "unauthorized";
|
|
31
32
|
bad_request: "bad_request";
|
|
33
|
+
unauthorized: "unauthorized";
|
|
32
34
|
payment_required: "payment_required";
|
|
33
35
|
forbidden: "forbidden";
|
|
34
36
|
not_found: "not_found";
|
|
@@ -36,6 +38,8 @@ declare const problemDetailsSchema: z.ZodObject<{
|
|
|
36
38
|
too_many_requests: "too_many_requests";
|
|
37
39
|
internal_server_error: "internal_server_error";
|
|
38
40
|
unprocessable_entity: "unprocessable_entity";
|
|
41
|
+
bad_gateway: "bad_gateway";
|
|
42
|
+
service_unavailable: "service_unavailable";
|
|
39
43
|
}>;
|
|
40
44
|
}, z.core.$strip>;
|
|
41
45
|
type ProblemDetails = z.infer<typeof problemDetailsSchema>;
|
|
@@ -43,8 +47,8 @@ type ErrorCodes = z.infer<typeof ErrorCode>;
|
|
|
43
47
|
declare const errorResponseSchema: z.ZodObject<{
|
|
44
48
|
error: z.ZodObject<{
|
|
45
49
|
code: z.ZodEnum<{
|
|
46
|
-
unauthorized: "unauthorized";
|
|
47
50
|
bad_request: "bad_request";
|
|
51
|
+
unauthorized: "unauthorized";
|
|
48
52
|
payment_required: "payment_required";
|
|
49
53
|
forbidden: "forbidden";
|
|
50
54
|
not_found: "not_found";
|
|
@@ -52,6 +56,8 @@ declare const errorResponseSchema: z.ZodObject<{
|
|
|
52
56
|
too_many_requests: "too_many_requests";
|
|
53
57
|
internal_server_error: "internal_server_error";
|
|
54
58
|
unprocessable_entity: "unprocessable_entity";
|
|
59
|
+
bad_gateway: "bad_gateway";
|
|
60
|
+
service_unavailable: "service_unavailable";
|
|
55
61
|
}>;
|
|
56
62
|
message: z.ZodString;
|
|
57
63
|
}, z.core.$strip>;
|
|
@@ -83,12 +89,12 @@ declare const errorSchemaFactory: (code: ErrorCodes, description: string) => {
|
|
|
83
89
|
schema: z.ZodObject<{
|
|
84
90
|
instance: z.ZodOptional<z.ZodString>;
|
|
85
91
|
requestId: z.ZodOptional<z.ZodString>;
|
|
86
|
-
code: z.ZodLiteral<"
|
|
92
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
87
93
|
detail: z.ZodString;
|
|
88
94
|
title: z.ZodString;
|
|
89
95
|
status: z.ZodNumber;
|
|
90
96
|
error: z.ZodObject<{
|
|
91
|
-
code: z.ZodLiteral<"
|
|
97
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
92
98
|
message: z.ZodString;
|
|
93
99
|
}, z.core.$strip>;
|
|
94
100
|
}, z.core.$strip>;
|
|
@@ -105,12 +111,12 @@ declare const commonCreateErrorResponses: {
|
|
|
105
111
|
schema: z.ZodObject<{
|
|
106
112
|
instance: z.ZodOptional<z.ZodString>;
|
|
107
113
|
requestId: z.ZodOptional<z.ZodString>;
|
|
108
|
-
code: z.ZodLiteral<"
|
|
114
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
109
115
|
detail: z.ZodString;
|
|
110
116
|
title: z.ZodString;
|
|
111
117
|
status: z.ZodNumber;
|
|
112
118
|
error: z.ZodObject<{
|
|
113
|
-
code: z.ZodLiteral<"
|
|
119
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
114
120
|
message: z.ZodString;
|
|
115
121
|
}, z.core.$strip>;
|
|
116
122
|
}, z.core.$strip>;
|
|
@@ -124,12 +130,12 @@ declare const commonCreateErrorResponses: {
|
|
|
124
130
|
schema: z.ZodObject<{
|
|
125
131
|
instance: z.ZodOptional<z.ZodString>;
|
|
126
132
|
requestId: z.ZodOptional<z.ZodString>;
|
|
127
|
-
code: z.ZodLiteral<"
|
|
133
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
128
134
|
detail: z.ZodString;
|
|
129
135
|
title: z.ZodString;
|
|
130
136
|
status: z.ZodNumber;
|
|
131
137
|
error: z.ZodObject<{
|
|
132
|
-
code: z.ZodLiteral<"
|
|
138
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
133
139
|
message: z.ZodString;
|
|
134
140
|
}, z.core.$strip>;
|
|
135
141
|
}, z.core.$strip>;
|
|
@@ -143,12 +149,12 @@ declare const commonCreateErrorResponses: {
|
|
|
143
149
|
schema: z.ZodObject<{
|
|
144
150
|
instance: z.ZodOptional<z.ZodString>;
|
|
145
151
|
requestId: z.ZodOptional<z.ZodString>;
|
|
146
|
-
code: z.ZodLiteral<"
|
|
152
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
147
153
|
detail: z.ZodString;
|
|
148
154
|
title: z.ZodString;
|
|
149
155
|
status: z.ZodNumber;
|
|
150
156
|
error: z.ZodObject<{
|
|
151
|
-
code: z.ZodLiteral<"
|
|
157
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
152
158
|
message: z.ZodString;
|
|
153
159
|
}, z.core.$strip>;
|
|
154
160
|
}, z.core.$strip>;
|
|
@@ -162,12 +168,12 @@ declare const commonCreateErrorResponses: {
|
|
|
162
168
|
schema: z.ZodObject<{
|
|
163
169
|
instance: z.ZodOptional<z.ZodString>;
|
|
164
170
|
requestId: z.ZodOptional<z.ZodString>;
|
|
165
|
-
code: z.ZodLiteral<"
|
|
171
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
166
172
|
detail: z.ZodString;
|
|
167
173
|
title: z.ZodString;
|
|
168
174
|
status: z.ZodNumber;
|
|
169
175
|
error: z.ZodObject<{
|
|
170
|
-
code: z.ZodLiteral<"
|
|
176
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
171
177
|
message: z.ZodString;
|
|
172
178
|
}, z.core.$strip>;
|
|
173
179
|
}, z.core.$strip>;
|
|
@@ -181,12 +187,12 @@ declare const commonCreateErrorResponses: {
|
|
|
181
187
|
schema: z.ZodObject<{
|
|
182
188
|
instance: z.ZodOptional<z.ZodString>;
|
|
183
189
|
requestId: z.ZodOptional<z.ZodString>;
|
|
184
|
-
code: z.ZodLiteral<"
|
|
190
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
185
191
|
detail: z.ZodString;
|
|
186
192
|
title: z.ZodString;
|
|
187
193
|
status: z.ZodNumber;
|
|
188
194
|
error: z.ZodObject<{
|
|
189
|
-
code: z.ZodLiteral<"
|
|
195
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
190
196
|
message: z.ZodString;
|
|
191
197
|
}, z.core.$strip>;
|
|
192
198
|
}, z.core.$strip>;
|
|
@@ -202,12 +208,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
202
208
|
schema: z.ZodObject<{
|
|
203
209
|
instance: z.ZodOptional<z.ZodString>;
|
|
204
210
|
requestId: z.ZodOptional<z.ZodString>;
|
|
205
|
-
code: z.ZodLiteral<"
|
|
211
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
206
212
|
detail: z.ZodString;
|
|
207
213
|
title: z.ZodString;
|
|
208
214
|
status: z.ZodNumber;
|
|
209
215
|
error: z.ZodObject<{
|
|
210
|
-
code: z.ZodLiteral<"
|
|
216
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
211
217
|
message: z.ZodString;
|
|
212
218
|
}, z.core.$strip>;
|
|
213
219
|
}, z.core.$strip>;
|
|
@@ -221,12 +227,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
221
227
|
schema: z.ZodObject<{
|
|
222
228
|
instance: z.ZodOptional<z.ZodString>;
|
|
223
229
|
requestId: z.ZodOptional<z.ZodString>;
|
|
224
|
-
code: z.ZodLiteral<"
|
|
230
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
225
231
|
detail: z.ZodString;
|
|
226
232
|
title: z.ZodString;
|
|
227
233
|
status: z.ZodNumber;
|
|
228
234
|
error: z.ZodObject<{
|
|
229
|
-
code: z.ZodLiteral<"
|
|
235
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
230
236
|
message: z.ZodString;
|
|
231
237
|
}, z.core.$strip>;
|
|
232
238
|
}, z.core.$strip>;
|
|
@@ -240,12 +246,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
240
246
|
schema: z.ZodObject<{
|
|
241
247
|
instance: z.ZodOptional<z.ZodString>;
|
|
242
248
|
requestId: z.ZodOptional<z.ZodString>;
|
|
243
|
-
code: z.ZodLiteral<"
|
|
249
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
244
250
|
detail: z.ZodString;
|
|
245
251
|
title: z.ZodString;
|
|
246
252
|
status: z.ZodNumber;
|
|
247
253
|
error: z.ZodObject<{
|
|
248
|
-
code: z.ZodLiteral<"
|
|
254
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
249
255
|
message: z.ZodString;
|
|
250
256
|
}, z.core.$strip>;
|
|
251
257
|
}, z.core.$strip>;
|
|
@@ -259,12 +265,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
259
265
|
schema: z.ZodObject<{
|
|
260
266
|
instance: z.ZodOptional<z.ZodString>;
|
|
261
267
|
requestId: z.ZodOptional<z.ZodString>;
|
|
262
|
-
code: z.ZodLiteral<"
|
|
268
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
263
269
|
detail: z.ZodString;
|
|
264
270
|
title: z.ZodString;
|
|
265
271
|
status: z.ZodNumber;
|
|
266
272
|
error: z.ZodObject<{
|
|
267
|
-
code: z.ZodLiteral<"
|
|
273
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
268
274
|
message: z.ZodString;
|
|
269
275
|
}, z.core.$strip>;
|
|
270
276
|
}, z.core.$strip>;
|
|
@@ -278,12 +284,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
278
284
|
schema: z.ZodObject<{
|
|
279
285
|
instance: z.ZodOptional<z.ZodString>;
|
|
280
286
|
requestId: z.ZodOptional<z.ZodString>;
|
|
281
|
-
code: z.ZodLiteral<"
|
|
287
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
282
288
|
detail: z.ZodString;
|
|
283
289
|
title: z.ZodString;
|
|
284
290
|
status: z.ZodNumber;
|
|
285
291
|
error: z.ZodObject<{
|
|
286
|
-
code: z.ZodLiteral<"
|
|
292
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
287
293
|
message: z.ZodString;
|
|
288
294
|
}, z.core.$strip>;
|
|
289
295
|
}, z.core.$strip>;
|
|
@@ -297,12 +303,12 @@ declare const commonUpdateErrorResponses: {
|
|
|
297
303
|
schema: z.ZodObject<{
|
|
298
304
|
instance: z.ZodOptional<z.ZodString>;
|
|
299
305
|
requestId: z.ZodOptional<z.ZodString>;
|
|
300
|
-
code: z.ZodLiteral<"
|
|
306
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
301
307
|
detail: z.ZodString;
|
|
302
308
|
title: z.ZodString;
|
|
303
309
|
status: z.ZodNumber;
|
|
304
310
|
error: z.ZodObject<{
|
|
305
|
-
code: z.ZodLiteral<"
|
|
311
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
306
312
|
message: z.ZodString;
|
|
307
313
|
}, z.core.$strip>;
|
|
308
314
|
}, z.core.$strip>;
|
|
@@ -318,12 +324,12 @@ declare const commonGetErrorResponses: {
|
|
|
318
324
|
schema: z.ZodObject<{
|
|
319
325
|
instance: z.ZodOptional<z.ZodString>;
|
|
320
326
|
requestId: z.ZodOptional<z.ZodString>;
|
|
321
|
-
code: z.ZodLiteral<"
|
|
327
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
322
328
|
detail: z.ZodString;
|
|
323
329
|
title: z.ZodString;
|
|
324
330
|
status: z.ZodNumber;
|
|
325
331
|
error: z.ZodObject<{
|
|
326
|
-
code: z.ZodLiteral<"
|
|
332
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
327
333
|
message: z.ZodString;
|
|
328
334
|
}, z.core.$strip>;
|
|
329
335
|
}, z.core.$strip>;
|
|
@@ -337,12 +343,12 @@ declare const commonGetErrorResponses: {
|
|
|
337
343
|
schema: z.ZodObject<{
|
|
338
344
|
instance: z.ZodOptional<z.ZodString>;
|
|
339
345
|
requestId: z.ZodOptional<z.ZodString>;
|
|
340
|
-
code: z.ZodLiteral<"
|
|
346
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
341
347
|
detail: z.ZodString;
|
|
342
348
|
title: z.ZodString;
|
|
343
349
|
status: z.ZodNumber;
|
|
344
350
|
error: z.ZodObject<{
|
|
345
|
-
code: z.ZodLiteral<"
|
|
351
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
346
352
|
message: z.ZodString;
|
|
347
353
|
}, z.core.$strip>;
|
|
348
354
|
}, z.core.$strip>;
|
|
@@ -356,12 +362,12 @@ declare const commonGetErrorResponses: {
|
|
|
356
362
|
schema: z.ZodObject<{
|
|
357
363
|
instance: z.ZodOptional<z.ZodString>;
|
|
358
364
|
requestId: z.ZodOptional<z.ZodString>;
|
|
359
|
-
code: z.ZodLiteral<"
|
|
365
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
360
366
|
detail: z.ZodString;
|
|
361
367
|
title: z.ZodString;
|
|
362
368
|
status: z.ZodNumber;
|
|
363
369
|
error: z.ZodObject<{
|
|
364
|
-
code: z.ZodLiteral<"
|
|
370
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
365
371
|
message: z.ZodString;
|
|
366
372
|
}, z.core.$strip>;
|
|
367
373
|
}, z.core.$strip>;
|
|
@@ -375,12 +381,12 @@ declare const commonGetErrorResponses: {
|
|
|
375
381
|
schema: z.ZodObject<{
|
|
376
382
|
instance: z.ZodOptional<z.ZodString>;
|
|
377
383
|
requestId: z.ZodOptional<z.ZodString>;
|
|
378
|
-
code: z.ZodLiteral<"
|
|
384
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
379
385
|
detail: z.ZodString;
|
|
380
386
|
title: z.ZodString;
|
|
381
387
|
status: z.ZodNumber;
|
|
382
388
|
error: z.ZodObject<{
|
|
383
|
-
code: z.ZodLiteral<"
|
|
389
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
384
390
|
message: z.ZodString;
|
|
385
391
|
}, z.core.$strip>;
|
|
386
392
|
}, z.core.$strip>;
|
|
@@ -394,12 +400,12 @@ declare const commonGetErrorResponses: {
|
|
|
394
400
|
schema: z.ZodObject<{
|
|
395
401
|
instance: z.ZodOptional<z.ZodString>;
|
|
396
402
|
requestId: z.ZodOptional<z.ZodString>;
|
|
397
|
-
code: z.ZodLiteral<"
|
|
403
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
398
404
|
detail: z.ZodString;
|
|
399
405
|
title: z.ZodString;
|
|
400
406
|
status: z.ZodNumber;
|
|
401
407
|
error: z.ZodObject<{
|
|
402
|
-
code: z.ZodLiteral<"
|
|
408
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
403
409
|
message: z.ZodString;
|
|
404
410
|
}, z.core.$strip>;
|
|
405
411
|
}, z.core.$strip>;
|
|
@@ -413,12 +419,12 @@ declare const commonGetErrorResponses: {
|
|
|
413
419
|
schema: z.ZodObject<{
|
|
414
420
|
instance: z.ZodOptional<z.ZodString>;
|
|
415
421
|
requestId: z.ZodOptional<z.ZodString>;
|
|
416
|
-
code: z.ZodLiteral<"
|
|
422
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
417
423
|
detail: z.ZodString;
|
|
418
424
|
title: z.ZodString;
|
|
419
425
|
status: z.ZodNumber;
|
|
420
426
|
error: z.ZodObject<{
|
|
421
|
-
code: z.ZodLiteral<"
|
|
427
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
422
428
|
message: z.ZodString;
|
|
423
429
|
}, z.core.$strip>;
|
|
424
430
|
}, z.core.$strip>;
|
|
@@ -434,12 +440,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
434
440
|
schema: z.ZodObject<{
|
|
435
441
|
instance: z.ZodOptional<z.ZodString>;
|
|
436
442
|
requestId: z.ZodOptional<z.ZodString>;
|
|
437
|
-
code: z.ZodLiteral<"
|
|
443
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
438
444
|
detail: z.ZodString;
|
|
439
445
|
title: z.ZodString;
|
|
440
446
|
status: z.ZodNumber;
|
|
441
447
|
error: z.ZodObject<{
|
|
442
|
-
code: z.ZodLiteral<"
|
|
448
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
443
449
|
message: z.ZodString;
|
|
444
450
|
}, z.core.$strip>;
|
|
445
451
|
}, z.core.$strip>;
|
|
@@ -453,12 +459,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
453
459
|
schema: z.ZodObject<{
|
|
454
460
|
instance: z.ZodOptional<z.ZodString>;
|
|
455
461
|
requestId: z.ZodOptional<z.ZodString>;
|
|
456
|
-
code: z.ZodLiteral<"
|
|
462
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
457
463
|
detail: z.ZodString;
|
|
458
464
|
title: z.ZodString;
|
|
459
465
|
status: z.ZodNumber;
|
|
460
466
|
error: z.ZodObject<{
|
|
461
|
-
code: z.ZodLiteral<"
|
|
467
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
462
468
|
message: z.ZodString;
|
|
463
469
|
}, z.core.$strip>;
|
|
464
470
|
}, z.core.$strip>;
|
|
@@ -472,12 +478,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
472
478
|
schema: z.ZodObject<{
|
|
473
479
|
instance: z.ZodOptional<z.ZodString>;
|
|
474
480
|
requestId: z.ZodOptional<z.ZodString>;
|
|
475
|
-
code: z.ZodLiteral<"
|
|
481
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
476
482
|
detail: z.ZodString;
|
|
477
483
|
title: z.ZodString;
|
|
478
484
|
status: z.ZodNumber;
|
|
479
485
|
error: z.ZodObject<{
|
|
480
|
-
code: z.ZodLiteral<"
|
|
486
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
481
487
|
message: z.ZodString;
|
|
482
488
|
}, z.core.$strip>;
|
|
483
489
|
}, z.core.$strip>;
|
|
@@ -491,12 +497,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
491
497
|
schema: z.ZodObject<{
|
|
492
498
|
instance: z.ZodOptional<z.ZodString>;
|
|
493
499
|
requestId: z.ZodOptional<z.ZodString>;
|
|
494
|
-
code: z.ZodLiteral<"
|
|
500
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
495
501
|
detail: z.ZodString;
|
|
496
502
|
title: z.ZodString;
|
|
497
503
|
status: z.ZodNumber;
|
|
498
504
|
error: z.ZodObject<{
|
|
499
|
-
code: z.ZodLiteral<"
|
|
505
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
500
506
|
message: z.ZodString;
|
|
501
507
|
}, z.core.$strip>;
|
|
502
508
|
}, z.core.$strip>;
|
|
@@ -510,12 +516,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
510
516
|
schema: z.ZodObject<{
|
|
511
517
|
instance: z.ZodOptional<z.ZodString>;
|
|
512
518
|
requestId: z.ZodOptional<z.ZodString>;
|
|
513
|
-
code: z.ZodLiteral<"
|
|
519
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
514
520
|
detail: z.ZodString;
|
|
515
521
|
title: z.ZodString;
|
|
516
522
|
status: z.ZodNumber;
|
|
517
523
|
error: z.ZodObject<{
|
|
518
|
-
code: z.ZodLiteral<"
|
|
524
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
519
525
|
message: z.ZodString;
|
|
520
526
|
}, z.core.$strip>;
|
|
521
527
|
}, z.core.$strip>;
|
|
@@ -529,12 +535,12 @@ declare const commonDeleteErrorResponses: {
|
|
|
529
535
|
schema: z.ZodObject<{
|
|
530
536
|
instance: z.ZodOptional<z.ZodString>;
|
|
531
537
|
requestId: z.ZodOptional<z.ZodString>;
|
|
532
|
-
code: z.ZodLiteral<"
|
|
538
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
533
539
|
detail: z.ZodString;
|
|
534
540
|
title: z.ZodString;
|
|
535
541
|
status: z.ZodNumber;
|
|
536
542
|
error: z.ZodObject<{
|
|
537
|
-
code: z.ZodLiteral<"
|
|
543
|
+
code: z.ZodLiteral<"bad_request" | "unauthorized" | "payment_required" | "forbidden" | "not_found" | "conflict" | "too_many_requests" | "internal_server_error" | "unprocessable_entity" | "bad_gateway" | "service_unavailable">;
|
|
538
544
|
message: z.ZodString;
|
|
539
545
|
}, z.core.$strip>;
|
|
540
546
|
}, z.core.$strip>;
|
package/dist/utils/error.js
CHANGED
|
@@ -64,7 +64,9 @@ const ErrorCode = z.enum([
|
|
|
64
64
|
"conflict",
|
|
65
65
|
"too_many_requests",
|
|
66
66
|
"internal_server_error",
|
|
67
|
-
"unprocessable_entity"
|
|
67
|
+
"unprocessable_entity",
|
|
68
|
+
"bad_gateway",
|
|
69
|
+
"service_unavailable"
|
|
68
70
|
]);
|
|
69
71
|
const errorCodeToHttpStatus = {
|
|
70
72
|
bad_request: 400,
|
|
@@ -75,7 +77,9 @@ const errorCodeToHttpStatus = {
|
|
|
75
77
|
conflict: 409,
|
|
76
78
|
too_many_requests: 429,
|
|
77
79
|
unprocessable_entity: 422,
|
|
78
|
-
internal_server_error: 500
|
|
80
|
+
internal_server_error: 500,
|
|
81
|
+
bad_gateway: 502,
|
|
82
|
+
service_unavailable: 503
|
|
79
83
|
};
|
|
80
84
|
const ERROR_DOCS_BASE_URL = "https://docs.inkeep.com/agents-api/errors";
|
|
81
85
|
const problemDetailsSchema = z.object({
|
|
@@ -204,6 +208,8 @@ function getTitleFromCode(code) {
|
|
|
204
208
|
case "too_many_requests": return "Too Many Requests";
|
|
205
209
|
case "unprocessable_entity": return "Unprocessable Entity";
|
|
206
210
|
case "internal_server_error": return "Internal Server Error";
|
|
211
|
+
case "bad_gateway": return "Bad Gateway";
|
|
212
|
+
case "service_unavailable": return "Service Unavailable";
|
|
207
213
|
default: return "Error";
|
|
208
214
|
}
|
|
209
215
|
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { JsonTransformer } from "./JsonTransformer.js";
|
|
|
18
18
|
import { parseEmbeddedJson } from "./json-parser.js";
|
|
19
19
|
import { MockLanguageModel, createMockModel } from "./mock-provider.js";
|
|
20
20
|
import { ModelFactory } from "./model-factory.js";
|
|
21
|
-
import { PoWError, PoWResult, getPoWErrorMessage, isPoWEnabled, verifyPoW } from "./pow.js";
|
|
21
|
+
import { PoWError, PoWResult, SentinelError, SentinelVerifyResult, getPoWErrorMessage, isPoWEnabled, isSentinelEnabled, isSentinelUpstreamUnavailable, verifyPoW, verifySentinelPayload } from "./pow.js";
|
|
22
22
|
import { retryWithBackoff } from "./retry.js";
|
|
23
23
|
import { convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, extractPreviewFields, isZodSchema, makeAllPropertiesRequired, normalizeDataComponentSchema, preview, stripUnsupportedConstraints } from "./schema-conversion.js";
|
|
24
24
|
import { GenerateServiceTokenParams, ServiceTokenPayload, VerifyServiceTokenResult, generateServiceToken, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken } from "./service-token-auth.js";
|
|
@@ -39,4 +39,4 @@ import "./usage-tracker.js";
|
|
|
39
39
|
import { ValidatePublicKeyResult, validatePublicKey } from "./validate-public-key.js";
|
|
40
40
|
import { _resetWaitUntilCache, getWaitUntil } from "./wait-until.js";
|
|
41
41
|
import { TRUSTED_WORK_APP_MCP_PATHS, isTrustedWorkAppMcpUrl } from "./work-app-mcp.js";
|
|
42
|
-
export { ApiKeyGenerationResult, AppCredentialResult, AssembleResult, CommonCreateErrorResponses, CommonDeleteErrorResponses, CommonGetErrorResponses, CommonUpdateErrorResponses, ComposioAuthResult, CredentialScope, ERROR_DOCS_BASE_URL, ErrorCode, ErrorCodes, ErrorResponse, GenerateInternalServiceTokenParams, GenerateServiceTokenParams, GenerationType, HashedHeaderValue, InternalServiceId, InternalServiceTokenPayload, InternalServices, JsonTransformer, JwtVerifyResult, LLMMessage, LoggerFactoryConfig, McpClient, McpClientOptions, McpOAuthFlowResult, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig, McpTokenExchangeResult, MockLanguageModel, ModelFactory, OAuthConfig, ParsedSSEResponse, PinoLogger, PinoLoggerConfig, PoWError, PoWResult, ProblemDetails, SKILL_ENTRY_FILE_PATH, ServiceTokenPayload, SignJwtOptions, SignSlackLinkTokenParams, SignSlackUserTokenParams, SignatureVerificationErrorCode, SignatureVerificationResult, SlackAccessTokenPayload, SlackAccessTokenPayloadSchema, SlackLinkIntent, SlackLinkIntentSchema, SlackLinkTokenPayload, SlackLinkTokenPayloadSchema, TRUSTED_WORK_APP_MCP_PATHS, TempTokenPayload, TriggerAuthResult, ValidatePublicKeyResult, VerifyInternalServiceTokenResult, VerifyJwtOptions, VerifyServiceTokenResult, VerifySlackLinkTokenResult, VerifySlackUserTokenResult, _resetWaitUntilCache, activeMcpClients, buildConversationMetadata, buildConversationUserProperties, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, computeNextRunAt, computePrefixSignature, configureComposioMCPServer, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, countCacheMarkers, createApiError, createMockModel, decodeJwtPayload, deleteComposioConnectedAccount, deriveKidFromPublicKey, deriveRelationId, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, estimateTokens, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, extractUsageTokens, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, gatewayCostMiddleware, generateApiKey, generateAppCredential, generateId, generateInternalServiceToken, generateServiceToken, getComposioInstance, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getConversationProperties, getConversationUserProperties, getCredentialStoreLookupKeyFromRetrievalParams, getDatabaseErrorLogContext, getInProcessFetch, getJwtSecret, getLogger, getMessageUserProperties, getMetadataFromApiKey, getPoWErrorMessage, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isDevelopment, isInternalServiceToken, isPoWEnabled, isProduction, isSlackUserToken, isTest, isThirdPartyMCPServerAuthenticated, isTrustedWorkAppMcpUrl, isUniqueConstraintError, isZodSchema, loggerFactory, makeAllPropertiesRequired, maskApiKey, normalizeDataComponentSchema, normalizeDateString, normalizeModelId, parseEmbeddedJson, parseSSEResponse, parseSkillFromMarkdown, preview, problemDetailsSchema, registerAppFetch, retryWithBackoff, runWithLogContext, sanitizeAppConfig, serializeSkillToMarkdown, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, stripUnsupportedConstraints, throwIfUniqueConstraintError, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateOrigin, validatePublicKey, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyPoW, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
|
42
|
+
export { ApiKeyGenerationResult, AppCredentialResult, AssembleResult, CommonCreateErrorResponses, CommonDeleteErrorResponses, CommonGetErrorResponses, CommonUpdateErrorResponses, ComposioAuthResult, CredentialScope, ERROR_DOCS_BASE_URL, ErrorCode, ErrorCodes, ErrorResponse, GenerateInternalServiceTokenParams, GenerateServiceTokenParams, GenerationType, HashedHeaderValue, InternalServiceId, InternalServiceTokenPayload, InternalServices, JsonTransformer, JwtVerifyResult, LLMMessage, LoggerFactoryConfig, McpClient, McpClientOptions, McpOAuthFlowResult, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig, McpTokenExchangeResult, MockLanguageModel, ModelFactory, OAuthConfig, ParsedSSEResponse, PinoLogger, PinoLoggerConfig, PoWError, PoWResult, ProblemDetails, SKILL_ENTRY_FILE_PATH, SentinelError, SentinelVerifyResult, ServiceTokenPayload, SignJwtOptions, SignSlackLinkTokenParams, SignSlackUserTokenParams, SignatureVerificationErrorCode, SignatureVerificationResult, SlackAccessTokenPayload, SlackAccessTokenPayloadSchema, SlackLinkIntent, SlackLinkIntentSchema, SlackLinkTokenPayload, SlackLinkTokenPayloadSchema, TRUSTED_WORK_APP_MCP_PATHS, TempTokenPayload, TriggerAuthResult, ValidatePublicKeyResult, VerifyInternalServiceTokenResult, VerifyJwtOptions, VerifyServiceTokenResult, VerifySlackLinkTokenResult, VerifySlackUserTokenResult, _resetWaitUntilCache, activeMcpClients, buildConversationMetadata, buildConversationUserProperties, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, computeNextRunAt, computePrefixSignature, configureComposioMCPServer, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, countCacheMarkers, createApiError, createMockModel, decodeJwtPayload, deleteComposioConnectedAccount, deriveKidFromPublicKey, deriveRelationId, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, estimateTokens, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, extractUsageTokens, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, gatewayCostMiddleware, generateApiKey, generateAppCredential, generateId, generateInternalServiceToken, generateServiceToken, getComposioInstance, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getConversationProperties, getConversationUserProperties, getCredentialStoreLookupKeyFromRetrievalParams, getDatabaseErrorLogContext, getInProcessFetch, getJwtSecret, getLogger, getMessageUserProperties, getMetadataFromApiKey, getPoWErrorMessage, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isDevelopment, isInternalServiceToken, isPoWEnabled, isProduction, isSentinelEnabled, isSentinelUpstreamUnavailable, isSlackUserToken, isTest, isThirdPartyMCPServerAuthenticated, isTrustedWorkAppMcpUrl, isUniqueConstraintError, isZodSchema, loggerFactory, makeAllPropertiesRequired, maskApiKey, normalizeDataComponentSchema, normalizeDateString, normalizeModelId, parseEmbeddedJson, parseSSEResponse, parseSkillFromMarkdown, preview, problemDetailsSchema, registerAppFetch, retryWithBackoff, runWithLogContext, sanitizeAppConfig, serializeSkillToMarkdown, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, stripUnsupportedConstraints, throwIfUniqueConstraintError, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateOrigin, validatePublicKey, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyPoW, verifySentinelPayload, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
package/dist/utils/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import { McpClient, activeMcpClients } from "./mcp-client.js";
|
|
|
23
23
|
import { MockLanguageModel, createMockModel } from "./mock-provider.js";
|
|
24
24
|
import { computePrefixSignature, countCacheMarkers, extractUsageTokens, gatewayCostMiddleware, normalizeModelId } from "./usage-cost-middleware.js";
|
|
25
25
|
import { ModelFactory } from "./model-factory.js";
|
|
26
|
-
import { getPoWErrorMessage, isPoWEnabled, verifyPoW } from "./pow.js";
|
|
26
|
+
import { getPoWErrorMessage, isPoWEnabled, isSentinelEnabled, isSentinelUpstreamUnavailable, verifyPoW, verifySentinelPayload } from "./pow.js";
|
|
27
27
|
import { retryWithBackoff } from "./retry.js";
|
|
28
28
|
import { generateServiceToken, validateTargetAgent, validateTenantId, verifyAuthorizationHeader, verifyServiceToken } from "./service-token-auth.js";
|
|
29
29
|
import { SlackLinkIntentSchema, SlackLinkTokenPayloadSchema, signSlackLinkToken, verifySlackLinkToken } from "./slack-link-token.js";
|
|
@@ -38,4 +38,4 @@ import { validatePublicKey } from "./validate-public-key.js";
|
|
|
38
38
|
import { _resetWaitUntilCache, getWaitUntil } from "./wait-until.js";
|
|
39
39
|
import { TRUSTED_WORK_APP_MCP_PATHS, isTrustedWorkAppMcpUrl } from "./work-app-mcp.js";
|
|
40
40
|
|
|
41
|
-
export { ERROR_DOCS_BASE_URL, ErrorCode, InternalServices, JsonTransformer, McpClient, MockLanguageModel, ModelFactory, PinoLogger, SKILL_ENTRY_FILE_PATH, SlackAccessTokenPayloadSchema, SlackLinkIntentSchema, SlackLinkTokenPayloadSchema, TRUSTED_WORK_APP_MCP_PATHS, _resetWaitUntilCache, activeMcpClients, buildConversationMetadata, buildConversationUserProperties, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, computeNextRunAt, computePrefixSignature, configureComposioMCPServer, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, countCacheMarkers, createApiError, createMockModel, decodeJwtPayload, deleteComposioConnectedAccount, deriveKidFromPublicKey, deriveRelationId, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, estimateTokens, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, extractUsageTokens, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, gatewayCostMiddleware, generateApiKey, generateAppCredential, generateId, generateInternalServiceToken, generateServiceToken, getComposioInstance, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getConversationProperties, getConversationUserProperties, getCredentialStoreLookupKeyFromRetrievalParams, getDatabaseErrorLogContext, getInProcessFetch, getJwtSecret, getLogger, getMessageUserProperties, getMetadataFromApiKey, getPoWErrorMessage, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isDevelopment, isInternalServiceToken, isPoWEnabled, isProduction, isSlackUserToken, isTest, isThirdPartyMCPServerAuthenticated, isTrustedWorkAppMcpUrl, isUniqueConstraintError, isZodSchema, loggerFactory, makeAllPropertiesRequired, maskApiKey, normalizeDataComponentSchema, normalizeDateString, normalizeModelId, parseEmbeddedJson, parseSSEResponse, parseSkillFromMarkdown, preview, problemDetailsSchema, registerAppFetch, retryWithBackoff, runWithLogContext, sanitizeAppConfig, serializeSkillToMarkdown, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, stripUnsupportedConstraints, throwIfUniqueConstraintError, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateOrigin, validatePublicKey, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyPoW, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
|
41
|
+
export { ERROR_DOCS_BASE_URL, ErrorCode, InternalServices, JsonTransformer, McpClient, MockLanguageModel, ModelFactory, PinoLogger, SKILL_ENTRY_FILE_PATH, SlackAccessTokenPayloadSchema, SlackLinkIntentSchema, SlackLinkTokenPayloadSchema, TRUSTED_WORK_APP_MCP_PATHS, _resetWaitUntilCache, activeMcpClients, buildConversationMetadata, buildConversationUserProperties, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, computeNextRunAt, computePrefixSignature, configureComposioMCPServer, convertZodToJsonSchema, convertZodToJsonSchemaWithPreview, countCacheMarkers, createApiError, createMockModel, decodeJwtPayload, deleteComposioConnectedAccount, deriveKidFromPublicKey, deriveRelationId, detectAuthenticationRequired, errorResponseSchema, errorSchemaFactory, estimateTokens, exchangeMcpAuthorizationCode, extractBearerToken, extractComposioServerId, extractPreviewFields, extractPublicId, extractUsageTokens, fetchComposioServers, fetchSingleComposioServer, flushTraces, formatMessagesForLLM, formatMessagesForLLMContext, gatewayCostMiddleware, generateApiKey, generateAppCredential, generateId, generateInternalServiceToken, generateServiceToken, getComposioInstance, getComposioOAuthRedirectUrl, getComposioUserId, getConversationId, getConversationProperties, getConversationUserProperties, getCredentialStoreLookupKeyFromRetrievalParams, getDatabaseErrorLogContext, getInProcessFetch, getJwtSecret, getLogger, getMessageUserProperties, getMetadataFromApiKey, getPoWErrorMessage, getTracer, getWaitUntil, handleApiError, hasIssuer, hashApiKey, hashAuthenticationHeaders, hashTriggerHeaderValue, initiateMcpOAuthFlow, interpolateTemplate, isApiKeyExpired, isComposioMCPServerAuthenticated, isDevelopment, isInternalServiceToken, isPoWEnabled, isProduction, isSentinelEnabled, isSentinelUpstreamUnavailable, isSlackUserToken, isTest, isThirdPartyMCPServerAuthenticated, isTrustedWorkAppMcpUrl, isUniqueConstraintError, isZodSchema, loggerFactory, makeAllPropertiesRequired, maskApiKey, normalizeDataComponentSchema, normalizeDateString, normalizeModelId, parseEmbeddedJson, parseSSEResponse, parseSkillFromMarkdown, preview, problemDetailsSchema, registerAppFetch, retryWithBackoff, runWithLogContext, sanitizeAppConfig, serializeSkillToMarkdown, setSpanWithError, signJwt, signSlackLinkToken, signSlackUserToken, stripUnsupportedConstraints, throwIfUniqueConstraintError, toISODateString, unwrapError, validateApiKey, validateInternalServiceProjectAccess, validateInternalServiceTenantAccess, validateOrigin, validatePublicKey, validateTargetAgent, validateTenantId, validateTriggerHeaderValue, verifyAuthorizationHeader, verifyInternalServiceAuthHeader, verifyInternalServiceToken, verifyJwt, verifyPoW, verifySentinelPayload, verifyServiceToken, verifySignatureWithConfig, verifySlackLinkToken, verifySlackUserToken, verifyTempToken, verifyTriggerAuth };
|
package/dist/utils/pow.d.ts
CHANGED
|
@@ -6,8 +6,22 @@ type PoWResult = {
|
|
|
6
6
|
ok: false;
|
|
7
7
|
error: PoWError;
|
|
8
8
|
};
|
|
9
|
+
type SentinelError = 'sentinel_network_error' | 'sentinel_invalid_response' | 'sentinel_verify_failed' | 'sentinel_rejected';
|
|
10
|
+
type SentinelVerifyResult = {
|
|
11
|
+
ok: true;
|
|
12
|
+
classification: string;
|
|
13
|
+
score: number;
|
|
14
|
+
verificationId: string;
|
|
15
|
+
} | {
|
|
16
|
+
ok: false;
|
|
17
|
+
error: SentinelError;
|
|
18
|
+
reason: string;
|
|
19
|
+
};
|
|
20
|
+
declare function isSentinelUpstreamUnavailable(error: SentinelError): boolean;
|
|
9
21
|
declare function getPoWErrorMessage(error: PoWError): string;
|
|
10
22
|
declare function isPoWEnabled(hmacSecret: string | undefined): boolean;
|
|
11
23
|
declare function verifyPoW(request: Request, hmacSecret: string | undefined): Promise<PoWResult>;
|
|
24
|
+
declare function isSentinelEnabled(apiKeyId: string | undefined): apiKeyId is string;
|
|
25
|
+
declare function verifySentinelPayload(payload: string, sentinelBaseUrl: string, apiKeyId: string, apiKeySecret: string): Promise<SentinelVerifyResult>;
|
|
12
26
|
//#endregion
|
|
13
|
-
export { PoWError, PoWResult, getPoWErrorMessage, isPoWEnabled, verifyPoW };
|
|
27
|
+
export { PoWError, PoWResult, SentinelError, SentinelVerifyResult, getPoWErrorMessage, isPoWEnabled, isSentinelEnabled, isSentinelUpstreamUnavailable, verifyPoW, verifySentinelPayload };
|
package/dist/utils/pow.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { verifySolution } from "altcha-lib";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/pow.ts
|
|
4
|
+
function isSentinelUpstreamUnavailable(error) {
|
|
5
|
+
return error === "sentinel_network_error" || error === "sentinel_invalid_response";
|
|
6
|
+
}
|
|
4
7
|
const POW_ERROR_MESSAGES = {
|
|
5
8
|
pow_expired: "Proof-of-work challenge has expired. Please request a new challenge.",
|
|
6
9
|
pow_required: "Proof-of-work challenge solution is required.",
|
|
@@ -47,6 +50,61 @@ async function verifyPoW(request, hmacSecret) {
|
|
|
47
50
|
}
|
|
48
51
|
return { ok: true };
|
|
49
52
|
}
|
|
53
|
+
function isSentinelEnabled(apiKeyId) {
|
|
54
|
+
return !!apiKeyId;
|
|
55
|
+
}
|
|
56
|
+
async function verifySentinelPayload(payload, sentinelBaseUrl, apiKeyId, apiKeySecret) {
|
|
57
|
+
const url = `${sentinelBaseUrl}/v1/verify/signature?apiKey=${encodeURIComponent(apiKeyId)}&apiSecret=${encodeURIComponent(apiKeySecret)}`;
|
|
58
|
+
let response;
|
|
59
|
+
try {
|
|
60
|
+
response = await fetch(url, {
|
|
61
|
+
method: "POST",
|
|
62
|
+
headers: { "Content-Type": "application/json" },
|
|
63
|
+
body: JSON.stringify({ payload }),
|
|
64
|
+
signal: AbortSignal.timeout(5e3)
|
|
65
|
+
});
|
|
66
|
+
} catch (err) {
|
|
67
|
+
return {
|
|
68
|
+
ok: false,
|
|
69
|
+
error: "sentinel_network_error",
|
|
70
|
+
reason: err instanceof Error ? err.message : "Network error"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (!response.ok) {
|
|
74
|
+
let upstreamReason = `HTTP ${response.status}`;
|
|
75
|
+
try {
|
|
76
|
+
const errBody = await response.json();
|
|
77
|
+
if (typeof errBody.error === "string") upstreamReason = errBody.error;
|
|
78
|
+
} catch {}
|
|
79
|
+
return {
|
|
80
|
+
ok: false,
|
|
81
|
+
error: "sentinel_verify_failed",
|
|
82
|
+
reason: upstreamReason
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
let body;
|
|
86
|
+
try {
|
|
87
|
+
body = await response.json();
|
|
88
|
+
} catch (err) {
|
|
89
|
+
const parseMessage = err instanceof Error ? err.message : String(err);
|
|
90
|
+
return {
|
|
91
|
+
ok: false,
|
|
92
|
+
error: "sentinel_invalid_response",
|
|
93
|
+
reason: `Non-JSON response (HTTP ${response.status}): ${parseMessage}`
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (body.verified !== true) return {
|
|
97
|
+
ok: false,
|
|
98
|
+
error: "sentinel_rejected",
|
|
99
|
+
reason: typeof body.reason === "string" ? body.reason : "Verification rejected"
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
ok: true,
|
|
103
|
+
classification: typeof body.classification === "string" ? body.classification : "unknown",
|
|
104
|
+
score: typeof body.score === "number" ? body.score : 0,
|
|
105
|
+
verificationId: typeof body.verificationId === "string" ? body.verificationId : ""
|
|
106
|
+
};
|
|
107
|
+
}
|
|
50
108
|
|
|
51
109
|
//#endregion
|
|
52
|
-
export { getPoWErrorMessage, isPoWEnabled, verifyPoW };
|
|
110
|
+
export { getPoWErrorMessage, isPoWEnabled, isSentinelEnabled, isSentinelUpstreamUnavailable, verifyPoW, verifySentinelPayload };
|