@perstack/api-client 0.0.50 → 0.0.52
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/index.d.mts +6292 -1351
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +90 -229
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -5
- package/dist/chunk-Bdv87wj9.mjs +0 -42
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { r as __toESM, t as __commonJSMin } from "./chunk-Bdv87wj9.mjs";
|
|
2
1
|
import { z } from "zod";
|
|
3
2
|
import { activityOrGroupSchema, checkpointSchema as perstackCheckpointSchema, instructionMessageSchema, messageSchema, stepSchema, toolCallSchema, toolMessageSchema, toolResultSchema, usageSchema, userMessageSchema } from "@perstack/core";
|
|
4
3
|
|
|
@@ -74,16 +73,16 @@ function createNetworkError(error) {
|
|
|
74
73
|
cause: error instanceof Error ? error : void 0
|
|
75
74
|
};
|
|
76
75
|
}
|
|
77
|
-
async function handleHttpError(response$
|
|
76
|
+
async function handleHttpError(response$19) {
|
|
78
77
|
let errorBody;
|
|
79
78
|
try {
|
|
80
|
-
errorBody = await response$
|
|
79
|
+
errorBody = await response$19.json();
|
|
81
80
|
} catch {
|
|
82
81
|
errorBody = void 0;
|
|
83
82
|
}
|
|
84
83
|
return {
|
|
85
84
|
ok: false,
|
|
86
|
-
error: createHttpError(response$
|
|
85
|
+
error: createHttpError(response$19.status, response$19.statusText, errorBody)
|
|
87
86
|
};
|
|
88
87
|
}
|
|
89
88
|
function createHttpError(status, statusText, body) {
|
|
@@ -220,20 +219,20 @@ function createFetcher(config) {
|
|
|
220
219
|
}
|
|
221
220
|
});
|
|
222
221
|
}
|
|
223
|
-
async function request$
|
|
222
|
+
async function request$19(method, path, body, options) {
|
|
224
223
|
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
225
224
|
try {
|
|
226
|
-
const response$
|
|
225
|
+
const response$19 = await fetch(buildUrl(path), {
|
|
227
226
|
method,
|
|
228
227
|
headers: buildHeaders(body ? { hasBody: true } : void 0),
|
|
229
228
|
body: body ? JSON.stringify(body) : void 0,
|
|
230
229
|
signal,
|
|
231
230
|
credentials: getCredentials()
|
|
232
231
|
});
|
|
233
|
-
if (!response$
|
|
232
|
+
if (!response$19.ok) return handleHttpError(response$19);
|
|
234
233
|
return {
|
|
235
234
|
ok: true,
|
|
236
|
-
data: await response$
|
|
235
|
+
data: await response$19.json()
|
|
237
236
|
};
|
|
238
237
|
} catch (error) {
|
|
239
238
|
if (error instanceof Error && error.name === "AbortError") {
|
|
@@ -257,16 +256,16 @@ function createFetcher(config) {
|
|
|
257
256
|
async function requestBlob(path, options) {
|
|
258
257
|
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
259
258
|
try {
|
|
260
|
-
const response$
|
|
259
|
+
const response$19 = await fetch(buildUrl(path), {
|
|
261
260
|
method: "GET",
|
|
262
261
|
headers: buildHeaders(),
|
|
263
262
|
signal,
|
|
264
263
|
credentials: getCredentials()
|
|
265
264
|
});
|
|
266
|
-
if (!response$
|
|
265
|
+
if (!response$19.ok) return handleHttpError(response$19);
|
|
267
266
|
return {
|
|
268
267
|
ok: true,
|
|
269
|
-
data: await response$
|
|
268
|
+
data: await response$19.blob()
|
|
270
269
|
};
|
|
271
270
|
} catch (error) {
|
|
272
271
|
if (error instanceof Error && error.name === "AbortError") {
|
|
@@ -290,17 +289,17 @@ function createFetcher(config) {
|
|
|
290
289
|
async function requestStream(path, options) {
|
|
291
290
|
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
292
291
|
try {
|
|
293
|
-
const response$
|
|
292
|
+
const response$19 = await fetch(buildUrl(path), {
|
|
294
293
|
method: "GET",
|
|
295
294
|
headers: buildHeaders(),
|
|
296
295
|
signal,
|
|
297
296
|
credentials: getCredentials()
|
|
298
297
|
});
|
|
299
|
-
if (!response$
|
|
298
|
+
if (!response$19.ok) {
|
|
300
299
|
cleanup();
|
|
301
|
-
return handleHttpError(response$
|
|
300
|
+
return handleHttpError(response$19);
|
|
302
301
|
}
|
|
303
|
-
if (!response$
|
|
302
|
+
if (!response$19.body) {
|
|
304
303
|
cleanup();
|
|
305
304
|
return {
|
|
306
305
|
ok: false,
|
|
@@ -311,7 +310,7 @@ function createFetcher(config) {
|
|
|
311
310
|
const idleTimeout = options?.streamIdleTimeout ?? timeout;
|
|
312
311
|
return {
|
|
313
312
|
ok: true,
|
|
314
|
-
data: wrapStreamWithIdleTimeout(response$
|
|
313
|
+
data: wrapStreamWithIdleTimeout(response$19.body, idleTimeout, options?.signal)
|
|
315
314
|
};
|
|
316
315
|
} catch (error) {
|
|
317
316
|
cleanup();
|
|
@@ -334,13 +333,13 @@ function createFetcher(config) {
|
|
|
334
333
|
async function requestNoContent(method, path, options) {
|
|
335
334
|
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
336
335
|
try {
|
|
337
|
-
const response$
|
|
336
|
+
const response$19 = await fetch(buildUrl(path), {
|
|
338
337
|
method,
|
|
339
338
|
headers: buildHeaders(),
|
|
340
339
|
signal,
|
|
341
340
|
credentials: getCredentials()
|
|
342
341
|
});
|
|
343
|
-
if (!response$
|
|
342
|
+
if (!response$19.ok) return handleHttpError(response$19);
|
|
344
343
|
return {
|
|
345
344
|
ok: true,
|
|
346
345
|
data: void 0
|
|
@@ -365,10 +364,10 @@ function createFetcher(config) {
|
|
|
365
364
|
}
|
|
366
365
|
}
|
|
367
366
|
return {
|
|
368
|
-
get: (path, options) => request$
|
|
369
|
-
post: (path, body, options) => request$
|
|
370
|
-
put: (path, body, options) => request$
|
|
371
|
-
delete: (path, options) => request$
|
|
367
|
+
get: (path, options) => request$19("GET", path, void 0, options),
|
|
368
|
+
post: (path, body, options) => request$19("POST", path, body, options),
|
|
369
|
+
put: (path, body, options) => request$19("PUT", path, body, options),
|
|
370
|
+
delete: (path, options) => request$19("DELETE", path, void 0, options),
|
|
372
371
|
deleteNoContent: (path, options) => requestNoContent("DELETE", path, options),
|
|
373
372
|
getBlob: (path, options) => requestBlob(path, options),
|
|
374
373
|
getStream: (path, options) => requestStream(path, options)
|
|
@@ -509,129 +508,42 @@ const organizationSchema = z.object({
|
|
|
509
508
|
});
|
|
510
509
|
|
|
511
510
|
//#endregion
|
|
512
|
-
//#region ../models/src/
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
//#region ../models/src/domain/apiKey.ts
|
|
533
|
-
const apiKeyPermissionsSchema = z.object({
|
|
534
|
-
operations: z.array(z.string()),
|
|
535
|
-
experts: z.union([z.array(z.string()), z.literal("*")]).optional()
|
|
536
|
-
});
|
|
537
|
-
const apiKeySchema = z.object({
|
|
538
|
-
type: z.literal("apiKey"),
|
|
539
|
-
id: cuidSchema,
|
|
540
|
-
name: z.string().min(1).max(255).optional(),
|
|
541
|
-
start: z.string().optional(),
|
|
542
|
-
prefix: z.string().optional(),
|
|
543
|
-
user: userSchema.optional(),
|
|
544
|
-
enabled: z.boolean(),
|
|
545
|
-
expiresAt: datetimeSchema.optional(),
|
|
546
|
-
permissions: apiKeyPermissionsSchema.optional(),
|
|
547
|
-
lastRequest: datetimeSchema.optional(),
|
|
548
|
-
createdAt: datetimeSchema,
|
|
549
|
-
updatedAt: datetimeSchema
|
|
550
|
-
});
|
|
551
|
-
const createApiKeyInputSchema = z.object({
|
|
552
|
-
name: z.string().min(1).max(255).optional(),
|
|
553
|
-
organizationId: cuidSchema,
|
|
554
|
-
operations: z.array(z.string()).optional(),
|
|
555
|
-
experts: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
556
|
-
expiresIn: z.number().min(60).optional()
|
|
557
|
-
});
|
|
558
|
-
const createApiKeyResponseSchema = z.object({
|
|
559
|
-
apiKey: apiKeySchema,
|
|
560
|
-
key: z.string()
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
//#endregion
|
|
564
|
-
//#region ../models/src/api/api-keys/create.ts
|
|
565
|
-
const request$22 = { body: z.object({
|
|
566
|
-
name: z.string().min(1).max(255).optional(),
|
|
567
|
-
operations: z.array(z.string()).optional(),
|
|
568
|
-
experts: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
569
|
-
wildcardApplicationAccess: z.boolean().optional(),
|
|
570
|
-
applicationIds: z.array(cuidSchema).optional(),
|
|
571
|
-
expiresIn: z.number().min(60).optional()
|
|
572
|
-
}) };
|
|
573
|
-
const response$22 = z.object({ data: z.object({
|
|
574
|
-
apiKey: apiKeySchema.extend({
|
|
575
|
-
permissions: apiKeyPermissionsSchema.optional(),
|
|
576
|
-
wildcardApplicationAccess: z.boolean(),
|
|
577
|
-
applicationIds: z.array(cuidSchema)
|
|
578
|
-
}),
|
|
579
|
-
key: z.string()
|
|
580
|
-
}) });
|
|
581
|
-
|
|
582
|
-
//#endregion
|
|
583
|
-
//#region ../models/src/api/api-keys/get.ts
|
|
584
|
-
const request$21 = { params: z.object({ apiKeyId: cuidSchema }) };
|
|
585
|
-
const response$21 = z.object({ data: z.object({ apiKey: apiKeySchema.extend({
|
|
586
|
-
permissions: apiKeyPermissionsSchema.optional(),
|
|
587
|
-
wildcardApplicationAccess: z.boolean(),
|
|
588
|
-
applicationIds: z.array(cuidSchema)
|
|
589
|
-
}) }) });
|
|
590
|
-
|
|
591
|
-
//#endregion
|
|
592
|
-
//#region ../../node_modules/ts-dedent/dist/index.js
|
|
593
|
-
var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
594
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
595
|
-
exports.dedent = void 0;
|
|
596
|
-
function dedent(templ) {
|
|
597
|
-
var values = [];
|
|
598
|
-
for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
|
|
599
|
-
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
600
|
-
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
601
|
-
var indentLengths = strings.reduce(function(arr, str) {
|
|
602
|
-
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
603
|
-
if (matches) return arr.concat(matches.map(function(match) {
|
|
604
|
-
var _a, _b;
|
|
605
|
-
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
606
|
-
}));
|
|
607
|
-
return arr;
|
|
608
|
-
}, []);
|
|
609
|
-
if (indentLengths.length) {
|
|
610
|
-
var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
|
|
611
|
-
strings = strings.map(function(str) {
|
|
612
|
-
return str.replace(pattern_1, "\n");
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
616
|
-
var string = strings[0];
|
|
617
|
-
values.forEach(function(value, i) {
|
|
618
|
-
var endentations = string.match(/(?:^|\n)( *)$/);
|
|
619
|
-
var endentation = endentations ? endentations[1] : "";
|
|
620
|
-
var indentedValue = value;
|
|
621
|
-
if (typeof value === "string" && value.includes("\n")) indentedValue = String(value).split("\n").map(function(str, i$1) {
|
|
622
|
-
return i$1 === 0 ? str : "" + endentation + str;
|
|
623
|
-
}).join("\n");
|
|
624
|
-
string += indentedValue + strings[i + 1];
|
|
625
|
-
});
|
|
626
|
-
return string;
|
|
511
|
+
//#region ../models/src/lib/dedent.ts
|
|
512
|
+
/**
|
|
513
|
+
* Dedent function for multi-line template strings.
|
|
514
|
+
* Adapted from ts-dedent (MIT License) to provide pure ESM support.
|
|
515
|
+
*
|
|
516
|
+
* Removes leading indentation from multi-line strings while preserving
|
|
517
|
+
* relative indentation between lines.
|
|
518
|
+
*/
|
|
519
|
+
function dedent(templ, ...values) {
|
|
520
|
+
let strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
521
|
+
const lastIndex = strings.length - 1;
|
|
522
|
+
strings[lastIndex] = (strings[lastIndex] ?? "").replace(/\r?\n([\t ]*)$/, "");
|
|
523
|
+
const indentLengths = strings.reduce((arr, str) => {
|
|
524
|
+
const matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
525
|
+
if (matches) return arr.concat(matches.map((match) => match.match(/[\t ]/g)?.length ?? 0));
|
|
526
|
+
return arr;
|
|
527
|
+
}, []);
|
|
528
|
+
if (indentLengths.length) {
|
|
529
|
+
const pattern = new RegExp(`\n[\t ]{${Math.min(...indentLengths)}}`, "g");
|
|
530
|
+
strings = strings.map((str) => str.replace(pattern, "\n"));
|
|
627
531
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
532
|
+
strings[0] = (strings[0] ?? "").replace(/^\r?\n/, "");
|
|
533
|
+
let string = strings[0] ?? "";
|
|
534
|
+
values.forEach((value, i) => {
|
|
535
|
+
const endentation = string.match(/(?:^|\n)( *)$/)?.[1] ?? "";
|
|
536
|
+
let indentedValue = value;
|
|
537
|
+
if (typeof value === "string" && value.includes("\n")) indentedValue = String(value).split("\n").map((str, j) => {
|
|
538
|
+
return j === 0 ? str : `${endentation}${str}`;
|
|
539
|
+
}).join("\n");
|
|
540
|
+
string += String(indentedValue) + (strings[i + 1] ?? "");
|
|
541
|
+
});
|
|
542
|
+
return string;
|
|
543
|
+
}
|
|
631
544
|
|
|
632
545
|
//#endregion
|
|
633
546
|
//#region ../models/src/api/common.ts
|
|
634
|
-
var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
|
|
635
547
|
const errorBadRequest = z.object({
|
|
636
548
|
code: z.literal(400),
|
|
637
549
|
error: z.literal("Bad Request"),
|
|
@@ -641,7 +553,7 @@ const errorUnauthorized = z.object({
|
|
|
641
553
|
code: z.literal(401),
|
|
642
554
|
error: z.literal("Unauthorized"),
|
|
643
555
|
reason: z.literal("Failed to authenticate")
|
|
644
|
-
}).describe(
|
|
556
|
+
}).describe(dedent`
|
|
645
557
|
Authentication failed. Possible reasons:
|
|
646
558
|
- Authorization header is not provided
|
|
647
559
|
- Invalid API key
|
|
@@ -652,6 +564,16 @@ const errorForbidden = z.object({
|
|
|
652
564
|
error: z.literal("Forbidden"),
|
|
653
565
|
reason: z.string()
|
|
654
566
|
}).describe("Access denied. The authenticated user does not have permission to perform this action.");
|
|
567
|
+
const errorUsageLimitExceeded = z.object({
|
|
568
|
+
code: z.literal(403),
|
|
569
|
+
error: z.literal("Forbidden"),
|
|
570
|
+
reason: z.string(),
|
|
571
|
+
details: z.object({
|
|
572
|
+
minutesUsed: z.number(),
|
|
573
|
+
limitMinutes: z.number(),
|
|
574
|
+
upgradeUrl: z.string()
|
|
575
|
+
})
|
|
576
|
+
}).describe("Usage limit exceeded. Upgrade your plan to continue.");
|
|
655
577
|
const errorNotFound = z.object({
|
|
656
578
|
code: z.literal(404),
|
|
657
579
|
error: z.literal("Not Found"),
|
|
@@ -673,30 +595,6 @@ const errorUnauthorizedFlexible = z.object({
|
|
|
673
595
|
reason: z.string()
|
|
674
596
|
}).describe("Unauthorized");
|
|
675
597
|
|
|
676
|
-
//#endregion
|
|
677
|
-
//#region ../models/src/api/api-keys/revoke.ts
|
|
678
|
-
const request$20 = { params: z.object({ apiKeyId: cuidSchema }) };
|
|
679
|
-
const response$20 = z.object({ data: z.object({ apiKey: apiKeySchema.extend({
|
|
680
|
-
permissions: apiKeyPermissionsSchema.optional(),
|
|
681
|
-
wildcardApplicationAccess: z.boolean(),
|
|
682
|
-
applicationIds: z.array(cuidSchema)
|
|
683
|
-
}) }) });
|
|
684
|
-
|
|
685
|
-
//#endregion
|
|
686
|
-
//#region ../models/src/api/api-keys/update.ts
|
|
687
|
-
const request$19 = {
|
|
688
|
-
params: z.object({ apiKeyId: cuidSchema }),
|
|
689
|
-
body: z.object({
|
|
690
|
-
applicationIds: z.array(cuidSchema).optional(),
|
|
691
|
-
wildcardApplicationAccess: z.boolean().optional()
|
|
692
|
-
})
|
|
693
|
-
};
|
|
694
|
-
const response$19 = z.object({ data: z.object({ apiKey: apiKeySchema.extend({
|
|
695
|
-
permissions: apiKeyPermissionsSchema.optional(),
|
|
696
|
-
wildcardApplicationAccess: z.boolean(),
|
|
697
|
-
applicationIds: z.array(cuidSchema)
|
|
698
|
-
}) }) });
|
|
699
|
-
|
|
700
598
|
//#endregion
|
|
701
599
|
//#region ../models/src/domain/application.ts
|
|
702
600
|
const applicationNameSchema = z.string().min(1).max(maxApplicationNameLength).regex(applicationNameRegex);
|
|
@@ -715,7 +613,9 @@ const applicationSchema = z.object({
|
|
|
715
613
|
name: applicationNameSchema,
|
|
716
614
|
status: applicationStatusSchema,
|
|
717
615
|
expertCount: z.number().describe("Number of expert draft scopes associated with this application").optional(),
|
|
718
|
-
providers: z.array(providerSchema).describe("List of configured providers for this application").optional()
|
|
616
|
+
providers: z.array(providerSchema).describe("List of configured providers for this application").optional(),
|
|
617
|
+
totalJobs: z.number().describe("Total number of jobs executed for this application").optional(),
|
|
618
|
+
lastJobExecutionAt: z.string().datetime({ offset: true }).nullable().describe("Timestamp of the most recent job execution").optional()
|
|
719
619
|
});
|
|
720
620
|
|
|
721
621
|
//#endregion
|
|
@@ -873,7 +773,8 @@ const expertVersionSchema = z.object({
|
|
|
873
773
|
updatedAt: datetimeSchema,
|
|
874
774
|
createdBy: cuidSchema,
|
|
875
775
|
updatedBy: cuidSchema,
|
|
876
|
-
tags: z.array(expertTagFieldSchema)
|
|
776
|
+
tags: z.array(expertTagFieldSchema),
|
|
777
|
+
readmeUrl: z.string().optional()
|
|
877
778
|
});
|
|
878
779
|
const expertScopeWithVersionsSchema = expertScopeSchema.extend({ versions: z.array(expertVersionSchema) });
|
|
879
780
|
|
|
@@ -1279,6 +1180,7 @@ const jobSchema = z.object({
|
|
|
1279
1180
|
query: z.string().min(1).max(maxExpertJobQueryLength).optional(),
|
|
1280
1181
|
files: z.array(z.string().min(1).max(maxExpertJobFileNameLength)),
|
|
1281
1182
|
expert: expertWithMetadataSchema,
|
|
1183
|
+
expertDraftRefId: cuidSchema.optional(),
|
|
1282
1184
|
provider: providerSchema,
|
|
1283
1185
|
model: modelEnum,
|
|
1284
1186
|
reasoningBudget: reasoningBudgetSchema,
|
|
@@ -1287,7 +1189,8 @@ const jobSchema = z.object({
|
|
|
1287
1189
|
currentStep: z.number().int().min(0),
|
|
1288
1190
|
totalSteps: z.number().int().min(0),
|
|
1289
1191
|
totalDuration: z.number().min(0),
|
|
1290
|
-
usage: usageSchema
|
|
1192
|
+
usage: usageSchema,
|
|
1193
|
+
lastActivity: activityOrGroupSchema.nullable().optional()
|
|
1291
1194
|
});
|
|
1292
1195
|
|
|
1293
1196
|
//#endregion
|
|
@@ -1297,7 +1200,7 @@ const request$6 = {
|
|
|
1297
1200
|
body: z.object({
|
|
1298
1201
|
query: jobSchema.shape.query.optional(),
|
|
1299
1202
|
interactiveToolCallResult: z.boolean().optional(),
|
|
1300
|
-
files: z.union([z.
|
|
1203
|
+
files: z.union([z.file(), z.array(z.file())]).optional(),
|
|
1301
1204
|
provider: providerSchema.optional(),
|
|
1302
1205
|
model: jobSchema.shape.model.optional(),
|
|
1303
1206
|
reasoningBudget: reasoningBudgetSchema.optional(),
|
|
@@ -1309,17 +1212,24 @@ const response$6 = z.object({ data: z.object({ job: jobSchema }) });
|
|
|
1309
1212
|
|
|
1310
1213
|
//#endregion
|
|
1311
1214
|
//#region ../models/src/api/jobs/create.ts
|
|
1312
|
-
const
|
|
1215
|
+
const baseBodySchema = z.object({
|
|
1313
1216
|
applicationId: cuidSchema.describe("Application ID to create the job in"),
|
|
1314
|
-
expertKey: expertKeyFieldSchema,
|
|
1315
1217
|
query: jobSchema.shape.query.optional(),
|
|
1316
|
-
files: z.union([z.
|
|
1218
|
+
files: z.union([z.file(), z.array(z.file())]).optional(),
|
|
1317
1219
|
provider: providerSchema,
|
|
1318
1220
|
model: jobSchema.shape.model.optional(),
|
|
1319
1221
|
reasoningBudget: reasoningBudgetSchema.optional(),
|
|
1320
1222
|
maxSteps: z.coerce.number().optional(),
|
|
1321
1223
|
maxRetries: z.coerce.number().optional()
|
|
1322
|
-
})
|
|
1224
|
+
});
|
|
1225
|
+
const request$5 = { body: baseBodySchema.extend({
|
|
1226
|
+
expertKey: expertKeyFieldSchema.optional(),
|
|
1227
|
+
draftRefId: cuidSchema.describe("Draft ref ID to run the job with").optional()
|
|
1228
|
+
}).refine((data) => {
|
|
1229
|
+
const hasExpertKey = data.expertKey !== void 0;
|
|
1230
|
+
const hasDraftRefId = data.draftRefId !== void 0;
|
|
1231
|
+
return hasExpertKey && !hasDraftRefId || !hasExpertKey && hasDraftRefId;
|
|
1232
|
+
}, { message: "Either expertKey or draftRefId must be provided, but not both" }) };
|
|
1323
1233
|
const response$5 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1324
1234
|
|
|
1325
1235
|
//#endregion
|
|
@@ -1328,7 +1238,12 @@ const request$4 = { query: z.object({
|
|
|
1328
1238
|
sort: z.enum(["createdAt", "updatedAt"]).optional(),
|
|
1329
1239
|
order: z.enum(["asc", "desc"]).optional(),
|
|
1330
1240
|
take: z.coerce.number().min(1).max(100).default(20),
|
|
1331
|
-
skip: z.coerce.number().min(0).default(0)
|
|
1241
|
+
skip: z.coerce.number().min(0).default(0),
|
|
1242
|
+
expertScopeId: cuidSchema.optional(),
|
|
1243
|
+
expertDraftScopeId: cuidSchema.optional(),
|
|
1244
|
+
applicationId: cuidSchema.optional(),
|
|
1245
|
+
statuses: z.preprocess((val) => typeof val === "string" ? val.split(",") : val, z.array(jobStatusSchema).optional()),
|
|
1246
|
+
expertKeyFilter: z.string().max(100).optional()
|
|
1332
1247
|
}) };
|
|
1333
1248
|
const response$4 = z.object({
|
|
1334
1249
|
data: z.object({ jobs: z.array(jobSchema) }),
|
|
@@ -1452,59 +1367,6 @@ const request = {
|
|
|
1452
1367
|
};
|
|
1453
1368
|
const response = z.object({ data: z.object({ providerSetting: providerSettingResponseSchema }) });
|
|
1454
1369
|
|
|
1455
|
-
//#endregion
|
|
1456
|
-
//#region src/endpoints/api-keys.ts
|
|
1457
|
-
const BASE_PATH$6 = "/api/v1/api_keys";
|
|
1458
|
-
function createApiKeysApi(fetcher) {
|
|
1459
|
-
return {
|
|
1460
|
-
async create(input, options) {
|
|
1461
|
-
const result = request$22.body.safeParse(input);
|
|
1462
|
-
if (!result.success) return {
|
|
1463
|
-
ok: false,
|
|
1464
|
-
error: createValidationError(result.error)
|
|
1465
|
-
};
|
|
1466
|
-
return fetcher.post(BASE_PATH$6, input, options);
|
|
1467
|
-
},
|
|
1468
|
-
async list(input, options) {
|
|
1469
|
-
const queryParams = new URLSearchParams();
|
|
1470
|
-
if (input?.take !== void 0) queryParams.set("take", String(input.take));
|
|
1471
|
-
if (input?.skip !== void 0) queryParams.set("skip", String(input.skip));
|
|
1472
|
-
const queryString = queryParams.toString();
|
|
1473
|
-
const url = queryString ? `${BASE_PATH$6}?${queryString}` : BASE_PATH$6;
|
|
1474
|
-
return fetcher.get(url, options);
|
|
1475
|
-
},
|
|
1476
|
-
async get(id, options) {
|
|
1477
|
-
const result = request$21.params.safeParse({ apiKeyId: id });
|
|
1478
|
-
if (!result.success) return {
|
|
1479
|
-
ok: false,
|
|
1480
|
-
error: createValidationError(result.error)
|
|
1481
|
-
};
|
|
1482
|
-
return fetcher.get(`${BASE_PATH$6}/${id}`, options);
|
|
1483
|
-
},
|
|
1484
|
-
async revoke(id, options) {
|
|
1485
|
-
const result = request$20.params.safeParse({ apiKeyId: id });
|
|
1486
|
-
if (!result.success) return {
|
|
1487
|
-
ok: false,
|
|
1488
|
-
error: createValidationError(result.error)
|
|
1489
|
-
};
|
|
1490
|
-
return fetcher.post(`${BASE_PATH$6}/${id}/revoke`, {}, options);
|
|
1491
|
-
},
|
|
1492
|
-
async update(id, input, options) {
|
|
1493
|
-
const paramsResult = request$19.params.safeParse({ apiKeyId: id });
|
|
1494
|
-
if (!paramsResult.success) return {
|
|
1495
|
-
ok: false,
|
|
1496
|
-
error: createValidationError(paramsResult.error)
|
|
1497
|
-
};
|
|
1498
|
-
const bodyResult = request$19.body.safeParse(input);
|
|
1499
|
-
if (!bodyResult.success) return {
|
|
1500
|
-
ok: false,
|
|
1501
|
-
error: createValidationError(bodyResult.error)
|
|
1502
|
-
};
|
|
1503
|
-
return fetcher.post(`${BASE_PATH$6}/${id}`, input, options);
|
|
1504
|
-
}
|
|
1505
|
-
};
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
1370
|
//#endregion
|
|
1509
1371
|
//#region src/endpoints/applications.ts
|
|
1510
1372
|
const BASE_PATH$5 = "/api/v1/applications";
|
|
@@ -1857,7 +1719,6 @@ function createProviderSettingsApi(fetcher) {
|
|
|
1857
1719
|
function createApiClient(config) {
|
|
1858
1720
|
const fetcher = createFetcher(config);
|
|
1859
1721
|
return {
|
|
1860
|
-
apiKeys: createApiKeysApi(fetcher),
|
|
1861
1722
|
applications: createApplicationsApi(fetcher),
|
|
1862
1723
|
env: createEnvApi(fetcher),
|
|
1863
1724
|
jobs: createJobsApi(fetcher),
|