perstack 0.0.89 → 0.0.90
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/bin/cli.js +88140 -57348
- package/dist/bin/cli.js.map +1 -1
- package/dist/{chunk-6IYHM4GX.js → chunk-OF74MEG2.js} +1572 -171
- package/dist/chunk-OF74MEG2.js.map +1 -0
- package/dist/{resolve-expert-YAM46GJH.js → resolve-expert-HLJ22XTR.js} +5 -8
- package/dist/resolve-expert-HLJ22XTR.js.map +1 -0
- package/package.json +6 -6
- package/dist/chunk-6IYHM4GX.js.map +0 -1
- package/dist/chunk-TQIAD37I.js +0 -41685
- package/dist/chunk-TQIAD37I.js.map +0 -1
- package/dist/chunk-ZIQDMPLE.js +0 -1571
- package/dist/chunk-ZIQDMPLE.js.map +0 -1
- package/dist/lockfile-skill-manager-LHWOM7VC.js +0 -6
- package/dist/lockfile-skill-manager-LHWOM7VC.js.map +0 -1
- package/dist/resolve-expert-YAM46GJH.js.map +0 -1
|
@@ -15851,72 +15851,12 @@ var editTextFileActivitySchema = baseActivitySchema.extend({
|
|
|
15851
15851
|
oldText: external_exports.string(),
|
|
15852
15852
|
error: external_exports.string().optional()
|
|
15853
15853
|
});
|
|
15854
|
-
var appendTextFileActivitySchema = baseActivitySchema.extend({
|
|
15855
|
-
type: external_exports.literal("appendTextFile"),
|
|
15856
|
-
path: external_exports.string(),
|
|
15857
|
-
text: external_exports.string(),
|
|
15858
|
-
error: external_exports.string().optional()
|
|
15859
|
-
});
|
|
15860
15854
|
var writeTextFileActivitySchema = baseActivitySchema.extend({
|
|
15861
15855
|
type: external_exports.literal("writeTextFile"),
|
|
15862
15856
|
path: external_exports.string(),
|
|
15863
15857
|
text: external_exports.string(),
|
|
15864
15858
|
error: external_exports.string().optional()
|
|
15865
15859
|
});
|
|
15866
|
-
var deleteFileActivitySchema = baseActivitySchema.extend({
|
|
15867
|
-
type: external_exports.literal("deleteFile"),
|
|
15868
|
-
path: external_exports.string(),
|
|
15869
|
-
error: external_exports.string().optional()
|
|
15870
|
-
});
|
|
15871
|
-
var deleteDirectoryActivitySchema = baseActivitySchema.extend({
|
|
15872
|
-
type: external_exports.literal("deleteDirectory"),
|
|
15873
|
-
path: external_exports.string(),
|
|
15874
|
-
recursive: external_exports.boolean().optional(),
|
|
15875
|
-
error: external_exports.string().optional()
|
|
15876
|
-
});
|
|
15877
|
-
var moveFileActivitySchema = baseActivitySchema.extend({
|
|
15878
|
-
type: external_exports.literal("moveFile"),
|
|
15879
|
-
source: external_exports.string(),
|
|
15880
|
-
destination: external_exports.string(),
|
|
15881
|
-
error: external_exports.string().optional()
|
|
15882
|
-
});
|
|
15883
|
-
var getFileInfoActivitySchema = baseActivitySchema.extend({
|
|
15884
|
-
type: external_exports.literal("getFileInfo"),
|
|
15885
|
-
path: external_exports.string(),
|
|
15886
|
-
info: external_exports.object({
|
|
15887
|
-
exists: external_exports.boolean(),
|
|
15888
|
-
name: external_exports.string(),
|
|
15889
|
-
directory: external_exports.string(),
|
|
15890
|
-
extension: external_exports.string().nullable(),
|
|
15891
|
-
type: external_exports.enum(["file", "directory"]),
|
|
15892
|
-
mimeType: external_exports.string().nullable(),
|
|
15893
|
-
size: external_exports.number(),
|
|
15894
|
-
sizeFormatted: external_exports.string(),
|
|
15895
|
-
created: external_exports.string(),
|
|
15896
|
-
modified: external_exports.string(),
|
|
15897
|
-
accessed: external_exports.string()
|
|
15898
|
-
}).optional(),
|
|
15899
|
-
error: external_exports.string().optional()
|
|
15900
|
-
});
|
|
15901
|
-
var createDirectoryActivitySchema = baseActivitySchema.extend({
|
|
15902
|
-
type: external_exports.literal("createDirectory"),
|
|
15903
|
-
path: external_exports.string(),
|
|
15904
|
-
error: external_exports.string().optional()
|
|
15905
|
-
});
|
|
15906
|
-
var listDirectoryActivitySchema = baseActivitySchema.extend({
|
|
15907
|
-
type: external_exports.literal("listDirectory"),
|
|
15908
|
-
path: external_exports.string(),
|
|
15909
|
-
items: external_exports.array(
|
|
15910
|
-
external_exports.object({
|
|
15911
|
-
name: external_exports.string(),
|
|
15912
|
-
path: external_exports.string(),
|
|
15913
|
-
type: external_exports.enum(["file", "directory"]),
|
|
15914
|
-
size: external_exports.number(),
|
|
15915
|
-
modified: external_exports.string()
|
|
15916
|
-
})
|
|
15917
|
-
).optional(),
|
|
15918
|
-
error: external_exports.string().optional()
|
|
15919
|
-
});
|
|
15920
15860
|
var execActivitySchema = baseActivitySchema.extend({
|
|
15921
15861
|
type: external_exports.literal("exec"),
|
|
15922
15862
|
command: external_exports.string(),
|
|
@@ -15962,14 +15902,7 @@ var activitySchema = external_exports.discriminatedUnion("type", [
|
|
|
15962
15902
|
readPdfFileActivitySchema,
|
|
15963
15903
|
readTextFileActivitySchema,
|
|
15964
15904
|
editTextFileActivitySchema,
|
|
15965
|
-
appendTextFileActivitySchema,
|
|
15966
15905
|
writeTextFileActivitySchema,
|
|
15967
|
-
deleteFileActivitySchema,
|
|
15968
|
-
deleteDirectoryActivitySchema,
|
|
15969
|
-
moveFileActivitySchema,
|
|
15970
|
-
getFileInfoActivitySchema,
|
|
15971
|
-
createDirectoryActivitySchema,
|
|
15972
|
-
listDirectoryActivitySchema,
|
|
15973
15906
|
execActivitySchema,
|
|
15974
15907
|
delegateActivitySchema,
|
|
15975
15908
|
delegationCompleteActivitySchema,
|
|
@@ -16224,8 +16157,7 @@ var mcpStdioSkillSchema = external_exports.object({
|
|
|
16224
16157
|
command: external_exports.string(),
|
|
16225
16158
|
packageName: external_exports.string().optional(),
|
|
16226
16159
|
args: external_exports.array(external_exports.string()).optional().default([]),
|
|
16227
|
-
requiredEnv: external_exports.array(external_exports.string()).optional().default([])
|
|
16228
|
-
lazyInit: external_exports.boolean().optional().default(false)
|
|
16160
|
+
requiredEnv: external_exports.array(external_exports.string()).optional().default([])
|
|
16229
16161
|
});
|
|
16230
16162
|
var mcpSseSkillSchema = external_exports.object({
|
|
16231
16163
|
type: external_exports.literal("mcpSseSkill"),
|
|
@@ -16283,8 +16215,7 @@ var expertSchema = external_exports.object({
|
|
|
16283
16215
|
args: ["-y", "@perstack/base"],
|
|
16284
16216
|
pick: [],
|
|
16285
16217
|
omit: [],
|
|
16286
|
-
requiredEnv: []
|
|
16287
|
-
lazyInit: false
|
|
16218
|
+
requiredEnv: []
|
|
16288
16219
|
}
|
|
16289
16220
|
}).transform((skills) => {
|
|
16290
16221
|
return Object.fromEntries(
|
|
@@ -16558,8 +16489,7 @@ var perstackConfigSchema = external_exports.object({
|
|
|
16558
16489
|
packageName: external_exports.string().optional(),
|
|
16559
16490
|
args: external_exports.array(external_exports.string()).optional(),
|
|
16560
16491
|
requiredEnv: external_exports.array(external_exports.string()).optional(),
|
|
16561
|
-
allowedDomains: external_exports.array(domainPatternSchema).optional()
|
|
16562
|
-
lazyInit: external_exports.boolean().optional().default(false)
|
|
16492
|
+
allowedDomains: external_exports.array(domainPatternSchema).optional()
|
|
16563
16493
|
}),
|
|
16564
16494
|
external_exports.object({
|
|
16565
16495
|
type: external_exports.literal("mcpSseSkill"),
|
|
@@ -16904,14 +16834,6 @@ function createBaseToolActivity(toolName, toolCall, toolResult, reasoning) {
|
|
|
16904
16834
|
oldText: String(args["oldText"] ?? ""),
|
|
16905
16835
|
error: errorText
|
|
16906
16836
|
};
|
|
16907
|
-
case "appendTextFile":
|
|
16908
|
-
return {
|
|
16909
|
-
type: "appendTextFile",
|
|
16910
|
-
...baseFields,
|
|
16911
|
-
path: String(args["path"] ?? ""),
|
|
16912
|
-
text: String(args["text"] ?? ""),
|
|
16913
|
-
error: errorText
|
|
16914
|
-
};
|
|
16915
16837
|
case "writeTextFile":
|
|
16916
16838
|
return {
|
|
16917
16839
|
type: "writeTextFile",
|
|
@@ -16920,52 +16842,6 @@ function createBaseToolActivity(toolName, toolCall, toolResult, reasoning) {
|
|
|
16920
16842
|
text: String(args["text"] ?? ""),
|
|
16921
16843
|
error: errorText
|
|
16922
16844
|
};
|
|
16923
|
-
case "deleteFile":
|
|
16924
|
-
return {
|
|
16925
|
-
type: "deleteFile",
|
|
16926
|
-
...baseFields,
|
|
16927
|
-
path: String(args["path"] ?? ""),
|
|
16928
|
-
error: errorText
|
|
16929
|
-
};
|
|
16930
|
-
case "deleteDirectory":
|
|
16931
|
-
return {
|
|
16932
|
-
type: "deleteDirectory",
|
|
16933
|
-
...baseFields,
|
|
16934
|
-
path: String(args["path"] ?? ""),
|
|
16935
|
-
recursive: typeof args["recursive"] === "boolean" ? args["recursive"] : void 0,
|
|
16936
|
-
error: errorText
|
|
16937
|
-
};
|
|
16938
|
-
case "moveFile":
|
|
16939
|
-
return {
|
|
16940
|
-
type: "moveFile",
|
|
16941
|
-
...baseFields,
|
|
16942
|
-
source: String(args["source"] ?? ""),
|
|
16943
|
-
destination: String(args["destination"] ?? ""),
|
|
16944
|
-
error: errorText
|
|
16945
|
-
};
|
|
16946
|
-
case "getFileInfo":
|
|
16947
|
-
return {
|
|
16948
|
-
type: "getFileInfo",
|
|
16949
|
-
...baseFields,
|
|
16950
|
-
path: String(args["path"] ?? ""),
|
|
16951
|
-
info: parseFileInfoFromResult(resultContents),
|
|
16952
|
-
error: errorText
|
|
16953
|
-
};
|
|
16954
|
-
case "createDirectory":
|
|
16955
|
-
return {
|
|
16956
|
-
type: "createDirectory",
|
|
16957
|
-
...baseFields,
|
|
16958
|
-
path: String(args["path"] ?? ""),
|
|
16959
|
-
error: errorText
|
|
16960
|
-
};
|
|
16961
|
-
case "listDirectory":
|
|
16962
|
-
return {
|
|
16963
|
-
type: "listDirectory",
|
|
16964
|
-
...baseFields,
|
|
16965
|
-
path: String(args["path"] ?? ""),
|
|
16966
|
-
items: parseListDirectoryFromResult(resultContents),
|
|
16967
|
-
error: errorText
|
|
16968
|
-
};
|
|
16969
16845
|
case "exec":
|
|
16970
16846
|
return {
|
|
16971
16847
|
type: "exec",
|
|
@@ -17075,47 +16951,6 @@ function parseTodosFromResult(result) {
|
|
|
17075
16951
|
}
|
|
17076
16952
|
return [];
|
|
17077
16953
|
}
|
|
17078
|
-
function parseFileInfoFromResult(result) {
|
|
17079
|
-
const textPart = result.find((p) => p.type === "textPart");
|
|
17080
|
-
if (!textPart?.text) return void 0;
|
|
17081
|
-
try {
|
|
17082
|
-
const parsed = JSON.parse(textPart.text);
|
|
17083
|
-
return {
|
|
17084
|
-
exists: typeof parsed.exists === "boolean" ? parsed.exists : true,
|
|
17085
|
-
name: String(parsed.name ?? ""),
|
|
17086
|
-
directory: String(parsed.directory ?? ""),
|
|
17087
|
-
extension: typeof parsed.extension === "string" ? parsed.extension : null,
|
|
17088
|
-
type: parsed.type === "directory" ? "directory" : "file",
|
|
17089
|
-
mimeType: typeof parsed.mimeType === "string" ? parsed.mimeType : null,
|
|
17090
|
-
size: typeof parsed.size === "number" ? parsed.size : 0,
|
|
17091
|
-
sizeFormatted: String(parsed.sizeFormatted ?? ""),
|
|
17092
|
-
created: String(parsed.created ?? ""),
|
|
17093
|
-
modified: String(parsed.modified ?? ""),
|
|
17094
|
-
accessed: String(parsed.accessed ?? "")
|
|
17095
|
-
};
|
|
17096
|
-
} catch {
|
|
17097
|
-
return void 0;
|
|
17098
|
-
}
|
|
17099
|
-
}
|
|
17100
|
-
function parseListDirectoryFromResult(result) {
|
|
17101
|
-
const textPart = result.find((p) => p.type === "textPart");
|
|
17102
|
-
if (!textPart?.text) return void 0;
|
|
17103
|
-
try {
|
|
17104
|
-
const parsed = JSON.parse(textPart.text);
|
|
17105
|
-
if (!Array.isArray(parsed.items)) return void 0;
|
|
17106
|
-
return parsed.items.map(
|
|
17107
|
-
(item) => ({
|
|
17108
|
-
name: String(item.name ?? ""),
|
|
17109
|
-
path: String(item.path ?? ""),
|
|
17110
|
-
type: item.type === "directory" ? "directory" : "file",
|
|
17111
|
-
size: typeof item.size === "number" ? item.size : 0,
|
|
17112
|
-
modified: String(item.modified ?? "")
|
|
17113
|
-
})
|
|
17114
|
-
);
|
|
17115
|
-
} catch {
|
|
17116
|
-
return void 0;
|
|
17117
|
-
}
|
|
17118
|
-
}
|
|
17119
16954
|
|
|
17120
16955
|
// ../../packages/core/src/utils/env-filter.ts
|
|
17121
16956
|
var SAFE_ENV_VARS = [
|
|
@@ -17202,12 +17037,1578 @@ function parseWithFriendlyError(schema, data, context) {
|
|
|
17202
17037
|
const prefix = context ? `${context}: ` : "";
|
|
17203
17038
|
throw new PerstackError(`${prefix}${formatZodError(result.error)}`);
|
|
17204
17039
|
}
|
|
17040
|
+
|
|
17041
|
+
// ../../node_modules/.pnpm/@perstack+api-client@0.0.55_@perstack+core@packages+core_zod@4.3.6/node_modules/@perstack/api-client/dist/index.mjs
|
|
17042
|
+
function createValidationError(error48) {
|
|
17043
|
+
return {
|
|
17044
|
+
errorType: "validation",
|
|
17045
|
+
code: 400,
|
|
17046
|
+
message: `Validation failed: ${error48.issues.map((issue2) => `${issue2.path.join(".")}: ${issue2.message}`).join("; ")}`,
|
|
17047
|
+
reason: error48.issues
|
|
17048
|
+
};
|
|
17049
|
+
}
|
|
17050
|
+
function createAbortError() {
|
|
17051
|
+
return {
|
|
17052
|
+
errorType: "abort",
|
|
17053
|
+
code: 0,
|
|
17054
|
+
message: "Request aborted",
|
|
17055
|
+
aborted: true
|
|
17056
|
+
};
|
|
17057
|
+
}
|
|
17058
|
+
function createTimeoutError() {
|
|
17059
|
+
return {
|
|
17060
|
+
errorType: "timeout",
|
|
17061
|
+
code: 0,
|
|
17062
|
+
message: "Request timed out"
|
|
17063
|
+
};
|
|
17064
|
+
}
|
|
17065
|
+
function createNetworkError(error48) {
|
|
17066
|
+
return {
|
|
17067
|
+
errorType: "network",
|
|
17068
|
+
code: 0,
|
|
17069
|
+
message: error48 instanceof Error ? error48.message : "Network error",
|
|
17070
|
+
reason: error48,
|
|
17071
|
+
cause: error48 instanceof Error ? error48 : void 0
|
|
17072
|
+
};
|
|
17073
|
+
}
|
|
17074
|
+
async function handleHttpError(response2) {
|
|
17075
|
+
let errorBody;
|
|
17076
|
+
try {
|
|
17077
|
+
errorBody = await response2.json();
|
|
17078
|
+
} catch {
|
|
17079
|
+
errorBody = void 0;
|
|
17080
|
+
}
|
|
17081
|
+
return {
|
|
17082
|
+
ok: false,
|
|
17083
|
+
error: createHttpError(response2.status, response2.statusText, errorBody)
|
|
17084
|
+
};
|
|
17085
|
+
}
|
|
17086
|
+
function createHttpError(status, statusText, body) {
|
|
17087
|
+
if (typeof body === "object" && body !== null) {
|
|
17088
|
+
const hasReason = "reason" in body;
|
|
17089
|
+
if ("error" in body && typeof body.error === "string") return {
|
|
17090
|
+
errorType: "http",
|
|
17091
|
+
code: status,
|
|
17092
|
+
message: body.error,
|
|
17093
|
+
reason: hasReason ? body.reason : void 0
|
|
17094
|
+
};
|
|
17095
|
+
if (hasReason) return {
|
|
17096
|
+
errorType: "http",
|
|
17097
|
+
code: status,
|
|
17098
|
+
message: statusText,
|
|
17099
|
+
reason: body.reason
|
|
17100
|
+
};
|
|
17101
|
+
}
|
|
17102
|
+
return {
|
|
17103
|
+
errorType: "http",
|
|
17104
|
+
code: status,
|
|
17105
|
+
message: statusText
|
|
17106
|
+
};
|
|
17107
|
+
}
|
|
17108
|
+
var DEFAULT_BASE_URL = "https://api.perstack.ai";
|
|
17109
|
+
var DEFAULT_TIMEOUT = 3e4;
|
|
17110
|
+
function createFetcher(config2) {
|
|
17111
|
+
const baseUrl = config2.baseUrl ?? DEFAULT_BASE_URL;
|
|
17112
|
+
const timeout = config2.timeout ?? DEFAULT_TIMEOUT;
|
|
17113
|
+
const useCredentials = "credentials" in config2 && config2.credentials === "include";
|
|
17114
|
+
const apiKey = "apiKey" in config2 ? config2.apiKey : void 0;
|
|
17115
|
+
function buildUrl(path) {
|
|
17116
|
+
return `${baseUrl}${path}`;
|
|
17117
|
+
}
|
|
17118
|
+
function buildHeaders(options) {
|
|
17119
|
+
const headers = {};
|
|
17120
|
+
if (options?.hasBody) headers["Content-Type"] = "application/json";
|
|
17121
|
+
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
17122
|
+
return headers;
|
|
17123
|
+
}
|
|
17124
|
+
function getCredentials() {
|
|
17125
|
+
return useCredentials ? "include" : void 0;
|
|
17126
|
+
}
|
|
17127
|
+
function createTimeoutSignal(externalSignal) {
|
|
17128
|
+
const controller = new AbortController();
|
|
17129
|
+
let timedOut = false;
|
|
17130
|
+
const timeoutId = setTimeout(() => {
|
|
17131
|
+
timedOut = true;
|
|
17132
|
+
controller.abort();
|
|
17133
|
+
}, timeout);
|
|
17134
|
+
let abortHandler;
|
|
17135
|
+
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
17136
|
+
else {
|
|
17137
|
+
abortHandler = () => controller.abort();
|
|
17138
|
+
externalSignal.addEventListener("abort", abortHandler);
|
|
17139
|
+
}
|
|
17140
|
+
return {
|
|
17141
|
+
signal: controller.signal,
|
|
17142
|
+
cleanup: () => {
|
|
17143
|
+
clearTimeout(timeoutId);
|
|
17144
|
+
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
17145
|
+
},
|
|
17146
|
+
isTimeout: () => timedOut
|
|
17147
|
+
};
|
|
17148
|
+
}
|
|
17149
|
+
function wrapStreamWithIdleTimeout(stream, idleTimeoutMs, externalSignal) {
|
|
17150
|
+
const reader = stream.getReader();
|
|
17151
|
+
const controller = new AbortController();
|
|
17152
|
+
let timeoutId;
|
|
17153
|
+
let abortHandler;
|
|
17154
|
+
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
17155
|
+
else {
|
|
17156
|
+
abortHandler = () => controller.abort();
|
|
17157
|
+
externalSignal.addEventListener("abort", abortHandler);
|
|
17158
|
+
}
|
|
17159
|
+
function resetTimeout() {
|
|
17160
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
17161
|
+
timeoutId = setTimeout(() => controller.abort(), idleTimeoutMs);
|
|
17162
|
+
}
|
|
17163
|
+
function cleanup() {
|
|
17164
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
17165
|
+
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
17166
|
+
}
|
|
17167
|
+
return new ReadableStream({
|
|
17168
|
+
start() {
|
|
17169
|
+
resetTimeout();
|
|
17170
|
+
},
|
|
17171
|
+
async pull(streamController) {
|
|
17172
|
+
try {
|
|
17173
|
+
const result = await Promise.race([reader.read(), new Promise((_, reject) => {
|
|
17174
|
+
if (controller.signal.aborted) reject(new DOMException("Stream idle timeout", "AbortError"));
|
|
17175
|
+
controller.signal.addEventListener("abort", () => {
|
|
17176
|
+
reject(new DOMException("Stream idle timeout", "AbortError"));
|
|
17177
|
+
});
|
|
17178
|
+
})]);
|
|
17179
|
+
if (result.done) {
|
|
17180
|
+
cleanup();
|
|
17181
|
+
streamController.close();
|
|
17182
|
+
return;
|
|
17183
|
+
}
|
|
17184
|
+
resetTimeout();
|
|
17185
|
+
streamController.enqueue(result.value);
|
|
17186
|
+
} catch (error48) {
|
|
17187
|
+
cleanup();
|
|
17188
|
+
reader.cancel().catch(() => {
|
|
17189
|
+
});
|
|
17190
|
+
if (error48 instanceof DOMException && error48.name === "AbortError") streamController.error(new DOMException("Stream idle timeout", "AbortError"));
|
|
17191
|
+
else streamController.error(error48);
|
|
17192
|
+
}
|
|
17193
|
+
},
|
|
17194
|
+
cancel(reason) {
|
|
17195
|
+
cleanup();
|
|
17196
|
+
reader.cancel(reason).catch(() => {
|
|
17197
|
+
});
|
|
17198
|
+
}
|
|
17199
|
+
});
|
|
17200
|
+
}
|
|
17201
|
+
async function request2(method, path, body, options) {
|
|
17202
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
17203
|
+
try {
|
|
17204
|
+
const response2 = await fetch(buildUrl(path), {
|
|
17205
|
+
method,
|
|
17206
|
+
headers: buildHeaders(body ? { hasBody: true } : void 0),
|
|
17207
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
17208
|
+
signal,
|
|
17209
|
+
credentials: getCredentials()
|
|
17210
|
+
});
|
|
17211
|
+
if (!response2.ok) return handleHttpError(response2);
|
|
17212
|
+
return {
|
|
17213
|
+
ok: true,
|
|
17214
|
+
data: await response2.json()
|
|
17215
|
+
};
|
|
17216
|
+
} catch (error48) {
|
|
17217
|
+
if (error48 instanceof Error && error48.name === "AbortError") {
|
|
17218
|
+
if (isTimeout()) return {
|
|
17219
|
+
ok: false,
|
|
17220
|
+
error: createTimeoutError()
|
|
17221
|
+
};
|
|
17222
|
+
return {
|
|
17223
|
+
ok: false,
|
|
17224
|
+
error: createAbortError()
|
|
17225
|
+
};
|
|
17226
|
+
}
|
|
17227
|
+
return {
|
|
17228
|
+
ok: false,
|
|
17229
|
+
error: createNetworkError(error48)
|
|
17230
|
+
};
|
|
17231
|
+
} finally {
|
|
17232
|
+
cleanup();
|
|
17233
|
+
}
|
|
17234
|
+
}
|
|
17235
|
+
async function requestBlob(path, options) {
|
|
17236
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
17237
|
+
try {
|
|
17238
|
+
const response2 = await fetch(buildUrl(path), {
|
|
17239
|
+
method: "GET",
|
|
17240
|
+
headers: buildHeaders(),
|
|
17241
|
+
signal,
|
|
17242
|
+
credentials: getCredentials()
|
|
17243
|
+
});
|
|
17244
|
+
if (!response2.ok) return handleHttpError(response2);
|
|
17245
|
+
return {
|
|
17246
|
+
ok: true,
|
|
17247
|
+
data: await response2.blob()
|
|
17248
|
+
};
|
|
17249
|
+
} catch (error48) {
|
|
17250
|
+
if (error48 instanceof Error && error48.name === "AbortError") {
|
|
17251
|
+
if (isTimeout()) return {
|
|
17252
|
+
ok: false,
|
|
17253
|
+
error: createTimeoutError()
|
|
17254
|
+
};
|
|
17255
|
+
return {
|
|
17256
|
+
ok: false,
|
|
17257
|
+
error: createAbortError()
|
|
17258
|
+
};
|
|
17259
|
+
}
|
|
17260
|
+
return {
|
|
17261
|
+
ok: false,
|
|
17262
|
+
error: createNetworkError(error48)
|
|
17263
|
+
};
|
|
17264
|
+
} finally {
|
|
17265
|
+
cleanup();
|
|
17266
|
+
}
|
|
17267
|
+
}
|
|
17268
|
+
async function requestStream(path, options) {
|
|
17269
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
17270
|
+
try {
|
|
17271
|
+
const response2 = await fetch(buildUrl(path), {
|
|
17272
|
+
method: "GET",
|
|
17273
|
+
headers: buildHeaders(),
|
|
17274
|
+
signal,
|
|
17275
|
+
credentials: getCredentials()
|
|
17276
|
+
});
|
|
17277
|
+
if (!response2.ok) {
|
|
17278
|
+
cleanup();
|
|
17279
|
+
return handleHttpError(response2);
|
|
17280
|
+
}
|
|
17281
|
+
if (!response2.body) {
|
|
17282
|
+
cleanup();
|
|
17283
|
+
return {
|
|
17284
|
+
ok: false,
|
|
17285
|
+
error: createNetworkError(/* @__PURE__ */ new Error("Response body is null"))
|
|
17286
|
+
};
|
|
17287
|
+
}
|
|
17288
|
+
cleanup();
|
|
17289
|
+
const idleTimeout = options?.streamIdleTimeout ?? timeout;
|
|
17290
|
+
return {
|
|
17291
|
+
ok: true,
|
|
17292
|
+
data: wrapStreamWithIdleTimeout(response2.body, idleTimeout, options?.signal)
|
|
17293
|
+
};
|
|
17294
|
+
} catch (error48) {
|
|
17295
|
+
cleanup();
|
|
17296
|
+
if (error48 instanceof Error && error48.name === "AbortError") {
|
|
17297
|
+
if (isTimeout()) return {
|
|
17298
|
+
ok: false,
|
|
17299
|
+
error: createTimeoutError()
|
|
17300
|
+
};
|
|
17301
|
+
return {
|
|
17302
|
+
ok: false,
|
|
17303
|
+
error: createAbortError()
|
|
17304
|
+
};
|
|
17305
|
+
}
|
|
17306
|
+
return {
|
|
17307
|
+
ok: false,
|
|
17308
|
+
error: createNetworkError(error48)
|
|
17309
|
+
};
|
|
17310
|
+
}
|
|
17311
|
+
}
|
|
17312
|
+
async function requestNoContent(method, path, options) {
|
|
17313
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
17314
|
+
try {
|
|
17315
|
+
const response2 = await fetch(buildUrl(path), {
|
|
17316
|
+
method,
|
|
17317
|
+
headers: buildHeaders(),
|
|
17318
|
+
signal,
|
|
17319
|
+
credentials: getCredentials()
|
|
17320
|
+
});
|
|
17321
|
+
if (!response2.ok) return handleHttpError(response2);
|
|
17322
|
+
return {
|
|
17323
|
+
ok: true,
|
|
17324
|
+
data: void 0
|
|
17325
|
+
};
|
|
17326
|
+
} catch (error48) {
|
|
17327
|
+
if (error48 instanceof Error && error48.name === "AbortError") {
|
|
17328
|
+
if (isTimeout()) return {
|
|
17329
|
+
ok: false,
|
|
17330
|
+
error: createTimeoutError()
|
|
17331
|
+
};
|
|
17332
|
+
return {
|
|
17333
|
+
ok: false,
|
|
17334
|
+
error: createAbortError()
|
|
17335
|
+
};
|
|
17336
|
+
}
|
|
17337
|
+
return {
|
|
17338
|
+
ok: false,
|
|
17339
|
+
error: createNetworkError(error48)
|
|
17340
|
+
};
|
|
17341
|
+
} finally {
|
|
17342
|
+
cleanup();
|
|
17343
|
+
}
|
|
17344
|
+
}
|
|
17345
|
+
return {
|
|
17346
|
+
get: (path, options) => request2("GET", path, void 0, options),
|
|
17347
|
+
post: (path, body, options) => request2("POST", path, body, options),
|
|
17348
|
+
put: (path, body, options) => request2("PUT", path, body, options),
|
|
17349
|
+
delete: (path, options) => request2("DELETE", path, void 0, options),
|
|
17350
|
+
deleteNoContent: (path, options) => requestNoContent("DELETE", path, options),
|
|
17351
|
+
getBlob: (path, options) => requestBlob(path, options),
|
|
17352
|
+
getStream: (path, options) => requestStream(path, options)
|
|
17353
|
+
};
|
|
17354
|
+
}
|
|
17355
|
+
function buildQueryString(params) {
|
|
17356
|
+
if (!params) return "";
|
|
17357
|
+
const searchParams = new URLSearchParams();
|
|
17358
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0) searchParams.set(key, String(value));
|
|
17359
|
+
const queryString = searchParams.toString();
|
|
17360
|
+
return queryString ? `?${queryString}` : "";
|
|
17361
|
+
}
|
|
17362
|
+
async function* parseSSEEvents(reader) {
|
|
17363
|
+
const decoder = new TextDecoder();
|
|
17364
|
+
let buffer = "";
|
|
17365
|
+
while (true) {
|
|
17366
|
+
const { value, done } = await reader.read();
|
|
17367
|
+
if (done) break;
|
|
17368
|
+
buffer += decoder.decode(value, { stream: true });
|
|
17369
|
+
const events = buffer.split("\n\n");
|
|
17370
|
+
buffer = events.pop() || "";
|
|
17371
|
+
for (const event of events) {
|
|
17372
|
+
if (event.trim() === "") continue;
|
|
17373
|
+
const lines = event.split("\n");
|
|
17374
|
+
const eventType = lines.find((line) => line.startsWith("event:"))?.slice(6).trim();
|
|
17375
|
+
const data = lines.find((line) => line.startsWith("data:"))?.slice(5).trim();
|
|
17376
|
+
if (!eventType || !data) continue;
|
|
17377
|
+
if (eventType !== "message" && eventType !== "error" && eventType !== "complete") continue;
|
|
17378
|
+
try {
|
|
17379
|
+
yield {
|
|
17380
|
+
event: eventType,
|
|
17381
|
+
data: JSON.parse(data)
|
|
17382
|
+
};
|
|
17383
|
+
} catch {
|
|
17384
|
+
}
|
|
17385
|
+
}
|
|
17386
|
+
}
|
|
17387
|
+
}
|
|
17388
|
+
var organizationNameRegex = /^[a-z0-9][a-z0-9_.-]*$/;
|
|
17389
|
+
var maxOrganizationNameLength = 128;
|
|
17390
|
+
var applicationNameRegex = /^[a-z0-9][a-z0-9_.-]*$/;
|
|
17391
|
+
var maxApplicationNameLength = 255;
|
|
17392
|
+
var maxVariableValueLength = 65536;
|
|
17393
|
+
var maxSecretValueLength = 65536;
|
|
17394
|
+
var expertKeyRegex2 = /^((?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*)(?:@((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?)|@([a-z0-9][a-z0-9_.-]*))?$/;
|
|
17395
|
+
var expertNameRegex2 = /^(@[a-z0-9][a-z0-9_-]*\/)?[a-z0-9][a-z0-9_-]*$/;
|
|
17396
|
+
var scopeNameRegex = /^[a-z0-9][a-z0-9_-]*$/;
|
|
17397
|
+
var scopeNameRefRegex = /^[a-z0-9][a-z0-9_-]*(?:@(?:(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?|[a-z0-9][a-z0-9_-]*))?$/;
|
|
17398
|
+
var expertVersionRegex2 = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?$/;
|
|
17399
|
+
var tagNameRegex2 = /^[a-z0-9][a-z0-9_-]*$/;
|
|
17400
|
+
var maxExpertNameLength2 = 255;
|
|
17401
|
+
var maxExpertVersionTagLength = 255;
|
|
17402
|
+
var maxExpertKeyLength = 511;
|
|
17403
|
+
var maxExpertDescriptionLength = 1024 * 2;
|
|
17404
|
+
var maxExpertInstructionLength = 1024 * 20;
|
|
17405
|
+
var maxExpertDelegateItems = 255;
|
|
17406
|
+
var maxExpertTagItems = 8;
|
|
17407
|
+
var maxExpertJobQueryLength = 1024 * 20;
|
|
17408
|
+
var packageWithVersionRegex = /^(?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*(?:@(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?|@[a-z0-9][a-z0-9_.-]*)?$/;
|
|
17409
|
+
var urlSafeRegex = /^[a-z0-9][a-z0-9_-]*$/;
|
|
17410
|
+
var maxSkillNameLength2 = 255;
|
|
17411
|
+
var maxSkillDescriptionLength = 1024 * 2;
|
|
17412
|
+
var maxSkillRuleLength = 1024 * 2;
|
|
17413
|
+
var maxSkillPickOmitItems = 255;
|
|
17414
|
+
var maxSkillRequiredEnvItems = 255;
|
|
17415
|
+
var maxSkillToolNameLength2 = 255;
|
|
17416
|
+
var maxSkillEndpointLength = 1024 * 2;
|
|
17417
|
+
var maxSkillInputJsonSchemaLength = 1024 * 20;
|
|
17418
|
+
var maxCheckpointToolCallIdLength = 255;
|
|
17419
|
+
var envNameRegex = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;
|
|
17420
|
+
var maxEnvNameLength = 255;
|
|
17421
|
+
var maxProviderBaseUrlLength = 2048;
|
|
17422
|
+
var maxProviderHeaderKeyLength = 255;
|
|
17423
|
+
var maxProviderHeaderValueLength = 2048;
|
|
17424
|
+
var maxProviderHeadersCount = 50;
|
|
17425
|
+
var cuidSchema = external_exports.string().cuid2();
|
|
17426
|
+
external_exports.string().min(24).cuid2();
|
|
17427
|
+
var runtimeVersionSchema2 = external_exports.enum(["v1.0"]);
|
|
17428
|
+
var providerSchema = external_exports.enum([
|
|
17429
|
+
"anthropic",
|
|
17430
|
+
"google",
|
|
17431
|
+
"openai",
|
|
17432
|
+
"deepseek",
|
|
17433
|
+
"azure-openai",
|
|
17434
|
+
"amazon-bedrock",
|
|
17435
|
+
"google-vertex"
|
|
17436
|
+
]);
|
|
17437
|
+
var datetimeSchema = external_exports.string().datetime({ offset: true });
|
|
17438
|
+
var expertKeyFieldSchema = external_exports.string().min(1).max(maxExpertKeyLength).regex(expertKeyRegex2);
|
|
17439
|
+
var expertNameFieldSchema = external_exports.string().min(1).max(maxExpertNameLength2).regex(expertNameRegex2);
|
|
17440
|
+
var expertVersionFieldSchema = external_exports.string().min(1).max(maxExpertVersionTagLength).regex(expertVersionRegex2);
|
|
17441
|
+
var expertTagFieldSchema = external_exports.string().min(1).max(maxExpertVersionTagLength).regex(tagNameRegex2);
|
|
17442
|
+
var expertCategoryFieldSchema = external_exports.enum([
|
|
17443
|
+
"general",
|
|
17444
|
+
"coding",
|
|
17445
|
+
"research",
|
|
17446
|
+
"writing",
|
|
17447
|
+
"data",
|
|
17448
|
+
"automation"
|
|
17449
|
+
]);
|
|
17450
|
+
var scopeNameSchema = external_exports.string().min(1).max(maxExpertNameLength2).regex(scopeNameRegex);
|
|
17451
|
+
external_exports.string().min(1).max(maxExpertNameLength2 + maxExpertVersionTagLength + 1).regex(scopeNameRefRegex);
|
|
17452
|
+
external_exports.string().min(1).max(30);
|
|
17453
|
+
var organizationStatusSchema = external_exports.enum([
|
|
17454
|
+
"active",
|
|
17455
|
+
"inactive",
|
|
17456
|
+
"deleted"
|
|
17457
|
+
]);
|
|
17458
|
+
var organizationTypeSchema = external_exports.enum([
|
|
17459
|
+
"personal",
|
|
17460
|
+
"personalPlus",
|
|
17461
|
+
"team",
|
|
17462
|
+
"serviceAdmin"
|
|
17463
|
+
]);
|
|
17464
|
+
var organizationSchema = external_exports.object({
|
|
17465
|
+
type: external_exports.literal("organization"),
|
|
17466
|
+
id: cuidSchema,
|
|
17467
|
+
createdAt: datetimeSchema,
|
|
17468
|
+
updatedAt: datetimeSchema,
|
|
17469
|
+
name: external_exports.string().min(1).max(maxOrganizationNameLength).regex(organizationNameRegex).optional(),
|
|
17470
|
+
nameChangedAt: datetimeSchema.optional(),
|
|
17471
|
+
status: organizationStatusSchema,
|
|
17472
|
+
organizationType: organizationTypeSchema,
|
|
17473
|
+
maxApplications: external_exports.number().int().min(0),
|
|
17474
|
+
maxApiKeys: external_exports.number().int().min(0),
|
|
17475
|
+
maxExperts: external_exports.number().int().min(0)
|
|
17476
|
+
});
|
|
17477
|
+
function dedent(templ, ...values) {
|
|
17478
|
+
let strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
17479
|
+
const lastIndex = strings.length - 1;
|
|
17480
|
+
strings[lastIndex] = (strings[lastIndex] ?? "").replace(/\r?\n([\t ]*)$/, "");
|
|
17481
|
+
const indentLengths = strings.reduce((arr, str) => {
|
|
17482
|
+
const matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
17483
|
+
if (matches) return arr.concat(matches.map((match) => match.match(/[\t ]/g)?.length ?? 0));
|
|
17484
|
+
return arr;
|
|
17485
|
+
}, []);
|
|
17486
|
+
if (indentLengths.length) {
|
|
17487
|
+
const pattern = new RegExp(`
|
|
17488
|
+
[ ]{${Math.min(...indentLengths)}}`, "g");
|
|
17489
|
+
strings = strings.map((str) => str.replace(pattern, "\n"));
|
|
17490
|
+
}
|
|
17491
|
+
strings[0] = (strings[0] ?? "").replace(/^\r?\n/, "");
|
|
17492
|
+
let string4 = strings[0] ?? "";
|
|
17493
|
+
values.forEach((value, i) => {
|
|
17494
|
+
const endentation = string4.match(/(?:^|\n)( *)$/)?.[1] ?? "";
|
|
17495
|
+
let indentedValue = value;
|
|
17496
|
+
if (typeof value === "string" && value.includes("\n")) indentedValue = String(value).split("\n").map((str, j) => {
|
|
17497
|
+
return j === 0 ? str : `${endentation}${str}`;
|
|
17498
|
+
}).join("\n");
|
|
17499
|
+
string4 += String(indentedValue) + (strings[i + 1] ?? "");
|
|
17500
|
+
});
|
|
17501
|
+
return string4;
|
|
17502
|
+
}
|
|
17503
|
+
external_exports.object({
|
|
17504
|
+
code: external_exports.literal(400),
|
|
17505
|
+
error: external_exports.literal("Bad Request"),
|
|
17506
|
+
reason: external_exports.string()
|
|
17507
|
+
}).describe("Bad Request");
|
|
17508
|
+
external_exports.object({
|
|
17509
|
+
code: external_exports.literal(401),
|
|
17510
|
+
error: external_exports.literal("Unauthorized"),
|
|
17511
|
+
reason: external_exports.literal("Failed to authenticate")
|
|
17512
|
+
}).describe(dedent`
|
|
17513
|
+
Authentication failed. Possible reasons:
|
|
17514
|
+
- Authorization header is not provided
|
|
17515
|
+
- Invalid API key
|
|
17516
|
+
- Session expired
|
|
17517
|
+
`);
|
|
17518
|
+
external_exports.object({
|
|
17519
|
+
code: external_exports.literal(403),
|
|
17520
|
+
error: external_exports.literal("Forbidden"),
|
|
17521
|
+
reason: external_exports.string()
|
|
17522
|
+
}).describe("Access denied. The authenticated user does not have permission to perform this action.");
|
|
17523
|
+
external_exports.object({
|
|
17524
|
+
code: external_exports.literal(403),
|
|
17525
|
+
error: external_exports.literal("Forbidden"),
|
|
17526
|
+
reason: external_exports.string(),
|
|
17527
|
+
details: external_exports.object({
|
|
17528
|
+
minutesUsed: external_exports.number(),
|
|
17529
|
+
limitMinutes: external_exports.number(),
|
|
17530
|
+
upgradeUrl: external_exports.string()
|
|
17531
|
+
})
|
|
17532
|
+
}).describe("Usage limit exceeded. Upgrade your plan to continue.");
|
|
17533
|
+
external_exports.object({
|
|
17534
|
+
code: external_exports.literal(404),
|
|
17535
|
+
error: external_exports.literal("Not Found"),
|
|
17536
|
+
reason: external_exports.string()
|
|
17537
|
+
}).describe("Resource not found.");
|
|
17538
|
+
external_exports.object({
|
|
17539
|
+
code: external_exports.literal(409),
|
|
17540
|
+
error: external_exports.literal("Conflict"),
|
|
17541
|
+
reason: external_exports.string()
|
|
17542
|
+
}).describe("Request conflicts with current state of the resource.");
|
|
17543
|
+
external_exports.object({
|
|
17544
|
+
code: external_exports.literal(503),
|
|
17545
|
+
error: external_exports.literal("Service Unavailable"),
|
|
17546
|
+
reason: external_exports.string()
|
|
17547
|
+
}).describe("Service temporarily unavailable. Retry with exponential backoff.");
|
|
17548
|
+
external_exports.object({
|
|
17549
|
+
code: external_exports.literal(422),
|
|
17550
|
+
error: external_exports.literal("Validation Failed"),
|
|
17551
|
+
reason: external_exports.unknown()
|
|
17552
|
+
}).describe("Request validation failed. Check the request body, query parameters, or path parameters.");
|
|
17553
|
+
var paginationMeta = external_exports.object({
|
|
17554
|
+
total: external_exports.number().int().min(0),
|
|
17555
|
+
take: external_exports.number().int().min(1),
|
|
17556
|
+
skip: external_exports.number().int().min(0)
|
|
17557
|
+
});
|
|
17558
|
+
external_exports.object({
|
|
17559
|
+
code: external_exports.literal(401),
|
|
17560
|
+
error: external_exports.literal("Unauthorized"),
|
|
17561
|
+
reason: external_exports.string()
|
|
17562
|
+
}).describe("Unauthorized");
|
|
17563
|
+
var applicationNameSchema = external_exports.string().min(1).max(maxApplicationNameLength).regex(applicationNameRegex);
|
|
17564
|
+
var applicationStatusSchema = external_exports.enum([
|
|
17565
|
+
"active",
|
|
17566
|
+
"inactive",
|
|
17567
|
+
"deleted"
|
|
17568
|
+
]);
|
|
17569
|
+
var applicationSchema = external_exports.object({
|
|
17570
|
+
type: external_exports.literal("application"),
|
|
17571
|
+
id: cuidSchema,
|
|
17572
|
+
organizationId: cuidSchema,
|
|
17573
|
+
organization: organizationSchema,
|
|
17574
|
+
createdAt: datetimeSchema,
|
|
17575
|
+
updatedAt: datetimeSchema,
|
|
17576
|
+
name: applicationNameSchema,
|
|
17577
|
+
status: applicationStatusSchema,
|
|
17578
|
+
expertCount: external_exports.number().describe("Number of expert draft scopes associated with this application").optional(),
|
|
17579
|
+
providers: external_exports.array(providerSchema).describe("List of configured providers for this application").optional(),
|
|
17580
|
+
totalJobs: external_exports.number().describe("Total number of jobs executed for this application").optional(),
|
|
17581
|
+
lastJobExecutionAt: external_exports.string().datetime({ offset: true }).nullable().describe("Timestamp of the most recent job execution").optional()
|
|
17582
|
+
});
|
|
17583
|
+
var request$17 = { body: external_exports.object({
|
|
17584
|
+
name: applicationNameSchema,
|
|
17585
|
+
applicationGroupId: cuidSchema.optional()
|
|
17586
|
+
}) };
|
|
17587
|
+
external_exports.object({ data: external_exports.object({ application: applicationSchema }) });
|
|
17588
|
+
var request$16 = { query: external_exports.object({
|
|
17589
|
+
name: external_exports.preprocess((val) => Array.isArray(val) ? val.join(",") : val, external_exports.string().optional()),
|
|
17590
|
+
sort: external_exports.enum([
|
|
17591
|
+
"name",
|
|
17592
|
+
"createdAt",
|
|
17593
|
+
"updatedAt"
|
|
17594
|
+
]).optional(),
|
|
17595
|
+
order: external_exports.enum(["asc", "desc"]).optional(),
|
|
17596
|
+
take: external_exports.coerce.number().min(1).max(100).default(20),
|
|
17597
|
+
skip: external_exports.coerce.number().min(0).default(0)
|
|
17598
|
+
}) };
|
|
17599
|
+
external_exports.object({
|
|
17600
|
+
data: external_exports.object({ applications: external_exports.array(applicationSchema) }),
|
|
17601
|
+
meta: paginationMeta
|
|
17602
|
+
});
|
|
17603
|
+
var request$15 = {
|
|
17604
|
+
params: external_exports.object({ applicationId: cuidSchema }),
|
|
17605
|
+
body: external_exports.object({
|
|
17606
|
+
name: applicationNameSchema.optional(),
|
|
17607
|
+
status: applicationStatusSchema.exclude(["deleted"]).optional()
|
|
17608
|
+
}).refine((data) => data.name !== void 0 || data.status !== void 0, { message: "At least one field must be provided" })
|
|
17609
|
+
};
|
|
17610
|
+
external_exports.object({ data: external_exports.object({ application: applicationSchema }) });
|
|
17611
|
+
var secretNameSchema = external_exports.string().min(1, "Secret name is required").max(255, "Secret name must be 255 characters or less").regex(/^[A-Z][A-Z0-9_]*$/, "Secret name must start with uppercase letter and contain only uppercase letters, numbers, and underscores");
|
|
17612
|
+
var secretValueSchema = external_exports.string().min(1, "Secret value is required").max(maxSecretValueLength);
|
|
17613
|
+
var secretMetadataSchema = external_exports.object({
|
|
17614
|
+
name: external_exports.string(),
|
|
17615
|
+
createdAt: datetimeSchema,
|
|
17616
|
+
updatedAt: datetimeSchema
|
|
17617
|
+
});
|
|
17618
|
+
external_exports.object({
|
|
17619
|
+
type: external_exports.literal("secret"),
|
|
17620
|
+
id: cuidSchema,
|
|
17621
|
+
name: secretNameSchema,
|
|
17622
|
+
applicationId: cuidSchema,
|
|
17623
|
+
createdAt: datetimeSchema,
|
|
17624
|
+
updatedAt: datetimeSchema
|
|
17625
|
+
});
|
|
17626
|
+
var request$14 = { body: external_exports.object({
|
|
17627
|
+
applicationId: cuidSchema,
|
|
17628
|
+
name: secretNameSchema,
|
|
17629
|
+
value: secretValueSchema
|
|
17630
|
+
}) };
|
|
17631
|
+
external_exports.object({ data: external_exports.object({ secret: secretMetadataSchema }) });
|
|
17632
|
+
var request$13 = { query: external_exports.object({ applicationId: cuidSchema.optional() }) };
|
|
17633
|
+
external_exports.object({ data: external_exports.object({ secrets: external_exports.array(secretMetadataSchema) }) });
|
|
17634
|
+
var request$12 = {
|
|
17635
|
+
params: external_exports.object({ name: external_exports.string().min(1) }),
|
|
17636
|
+
body: external_exports.object({
|
|
17637
|
+
applicationId: cuidSchema,
|
|
17638
|
+
value: secretValueSchema
|
|
17639
|
+
})
|
|
17640
|
+
};
|
|
17641
|
+
external_exports.object({ data: external_exports.object({ secret: secretMetadataSchema }) });
|
|
17642
|
+
var variableNameSchema = external_exports.string().min(1).max(255).regex(/^[A-Z][A-Z0-9_]*$/, "Variable name must start with uppercase letter and contain only uppercase letters, digits, and underscores");
|
|
17643
|
+
var variableValueSchema = external_exports.string().max(maxVariableValueLength);
|
|
17644
|
+
external_exports.object({
|
|
17645
|
+
type: external_exports.literal("variable"),
|
|
17646
|
+
id: cuidSchema,
|
|
17647
|
+
applicationId: cuidSchema,
|
|
17648
|
+
createdAt: datetimeSchema,
|
|
17649
|
+
updatedAt: datetimeSchema,
|
|
17650
|
+
name: variableNameSchema,
|
|
17651
|
+
value: variableValueSchema
|
|
17652
|
+
});
|
|
17653
|
+
var variableResponseSchema = external_exports.object({
|
|
17654
|
+
name: variableNameSchema,
|
|
17655
|
+
value: variableValueSchema,
|
|
17656
|
+
createdAt: datetimeSchema,
|
|
17657
|
+
updatedAt: datetimeSchema
|
|
17658
|
+
});
|
|
17659
|
+
var request$11 = { body: external_exports.object({
|
|
17660
|
+
applicationId: cuidSchema,
|
|
17661
|
+
name: variableNameSchema,
|
|
17662
|
+
value: variableValueSchema
|
|
17663
|
+
}) };
|
|
17664
|
+
external_exports.object({ data: external_exports.object({ variable: variableResponseSchema }) });
|
|
17665
|
+
var request$10 = { query: external_exports.object({ applicationId: cuidSchema }) };
|
|
17666
|
+
external_exports.object({ data: external_exports.object({ variables: external_exports.array(variableResponseSchema) }) });
|
|
17667
|
+
var request$9 = {
|
|
17668
|
+
params: external_exports.object({ name: external_exports.string().min(1) }),
|
|
17669
|
+
body: external_exports.object({
|
|
17670
|
+
applicationId: cuidSchema,
|
|
17671
|
+
value: variableValueSchema
|
|
17672
|
+
})
|
|
17673
|
+
};
|
|
17674
|
+
external_exports.object({ data: external_exports.object({ variable: variableResponseSchema }) });
|
|
17675
|
+
var expertScopeSchema = external_exports.object({
|
|
17676
|
+
id: cuidSchema,
|
|
17677
|
+
name: scopeNameSchema,
|
|
17678
|
+
organizationId: cuidSchema,
|
|
17679
|
+
expertDraftScopeId: cuidSchema,
|
|
17680
|
+
published: external_exports.boolean(),
|
|
17681
|
+
publishedAt: datetimeSchema.nullable(),
|
|
17682
|
+
category: expertCategoryFieldSchema,
|
|
17683
|
+
totalRuns: external_exports.number().int().min(0),
|
|
17684
|
+
totalJobs: external_exports.number().int().min(0),
|
|
17685
|
+
totalStars: external_exports.number().int().min(0),
|
|
17686
|
+
createdAt: datetimeSchema,
|
|
17687
|
+
updatedAt: datetimeSchema,
|
|
17688
|
+
createdBy: cuidSchema,
|
|
17689
|
+
updatedBy: cuidSchema
|
|
17690
|
+
});
|
|
17691
|
+
var expertVersionSchema = external_exports.object({
|
|
17692
|
+
id: cuidSchema,
|
|
17693
|
+
expertScopeId: cuidSchema,
|
|
17694
|
+
version: expertVersionFieldSchema,
|
|
17695
|
+
public: external_exports.boolean(),
|
|
17696
|
+
yanked: external_exports.boolean(),
|
|
17697
|
+
totalRuns: external_exports.number().int().min(0),
|
|
17698
|
+
totalJobs: external_exports.number().int().min(0),
|
|
17699
|
+
createdAt: datetimeSchema,
|
|
17700
|
+
updatedAt: datetimeSchema,
|
|
17701
|
+
createdBy: cuidSchema,
|
|
17702
|
+
updatedBy: cuidSchema,
|
|
17703
|
+
tags: external_exports.array(expertTagFieldSchema),
|
|
17704
|
+
readmeUrl: external_exports.string().optional()
|
|
17705
|
+
});
|
|
17706
|
+
expertScopeSchema.extend({ versions: external_exports.array(expertVersionSchema) });
|
|
17707
|
+
function isPrivateOrLocalIP2(hostname3) {
|
|
17708
|
+
if (hostname3 === "localhost" || hostname3 === "127.0.0.1" || hostname3 === "::1" || hostname3 === "0.0.0.0") return true;
|
|
17709
|
+
const ipv4Match = hostname3.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
|
|
17710
|
+
if (ipv4Match) {
|
|
17711
|
+
const a = Number(ipv4Match[1]);
|
|
17712
|
+
const b = Number(ipv4Match[2]);
|
|
17713
|
+
if (a === 10) return true;
|
|
17714
|
+
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
17715
|
+
if (a === 192 && b === 168) return true;
|
|
17716
|
+
if (a === 169 && b === 254) return true;
|
|
17717
|
+
if (a === 127) return true;
|
|
17718
|
+
}
|
|
17719
|
+
if (hostname3.includes(":")) {
|
|
17720
|
+
if (hostname3.startsWith("fe80:") || hostname3.startsWith("fc") || hostname3.startsWith("fd")) return true;
|
|
17721
|
+
}
|
|
17722
|
+
if (hostname3.startsWith("::ffff:")) {
|
|
17723
|
+
if (isPrivateOrLocalIP2(hostname3.slice(7))) return true;
|
|
17724
|
+
}
|
|
17725
|
+
return false;
|
|
17726
|
+
}
|
|
17727
|
+
var sseEndpointSchema3 = external_exports.string().max(maxSkillEndpointLength).url().refine((url2) => {
|
|
17728
|
+
try {
|
|
17729
|
+
const parsed = new URL(url2);
|
|
17730
|
+
if (parsed.protocol !== "https:") return false;
|
|
17731
|
+
if (isPrivateOrLocalIP2(parsed.hostname)) return false;
|
|
17732
|
+
return true;
|
|
17733
|
+
} catch {
|
|
17734
|
+
return false;
|
|
17735
|
+
}
|
|
17736
|
+
}, { message: "Endpoint must be a public HTTPS URL" });
|
|
17737
|
+
var skillNameSchema = external_exports.string().min(1).max(maxSkillNameLength2).regex(packageWithVersionRegex);
|
|
17738
|
+
var mcpStdioSkillCommandSchema = external_exports.enum(["npx", "uvx"]);
|
|
17739
|
+
var mcpStdioSkillSchema2 = external_exports.object({
|
|
17740
|
+
type: external_exports.literal("mcpStdioSkill"),
|
|
17741
|
+
name: external_exports.string().min(1),
|
|
17742
|
+
description: external_exports.string().min(1).max(maxSkillDescriptionLength),
|
|
17743
|
+
rule: external_exports.string().min(1).max(maxSkillRuleLength).optional(),
|
|
17744
|
+
pick: external_exports.array(external_exports.string().min(1).max(maxSkillToolNameLength2)).max(maxSkillPickOmitItems).optional().default([]),
|
|
17745
|
+
omit: external_exports.array(external_exports.string().min(1).max(maxSkillToolNameLength2)).max(maxSkillPickOmitItems).optional().default([]),
|
|
17746
|
+
command: mcpStdioSkillCommandSchema,
|
|
17747
|
+
packageName: external_exports.string().min(1).max(maxSkillNameLength2).regex(packageWithVersionRegex),
|
|
17748
|
+
requiredEnv: external_exports.array(external_exports.string().min(1).max(maxEnvNameLength).regex(envNameRegex)).max(maxSkillRequiredEnvItems).optional().default([])
|
|
17749
|
+
});
|
|
17750
|
+
var mcpSseSkillSchema2 = external_exports.object({
|
|
17751
|
+
type: external_exports.literal("mcpSseSkill"),
|
|
17752
|
+
name: external_exports.string().min(1),
|
|
17753
|
+
description: external_exports.string().min(1).max(maxSkillDescriptionLength),
|
|
17754
|
+
rule: external_exports.string().min(1).max(maxSkillRuleLength).optional(),
|
|
17755
|
+
pick: external_exports.array(external_exports.string().min(1).max(maxSkillToolNameLength2)).max(maxSkillPickOmitItems).optional().default([]),
|
|
17756
|
+
omit: external_exports.array(external_exports.string().min(1).max(maxSkillToolNameLength2)).max(maxSkillPickOmitItems).optional().default([]),
|
|
17757
|
+
endpoint: sseEndpointSchema3
|
|
17758
|
+
});
|
|
17759
|
+
var interactiveSkillSchema2 = external_exports.object({
|
|
17760
|
+
type: external_exports.literal("interactiveSkill"),
|
|
17761
|
+
name: external_exports.string().min(1),
|
|
17762
|
+
description: external_exports.string().min(1).max(maxSkillDescriptionLength),
|
|
17763
|
+
rule: external_exports.string().min(1).max(maxSkillRuleLength).optional(),
|
|
17764
|
+
tools: external_exports.record(external_exports.string().min(1).max(maxSkillToolNameLength2).regex(urlSafeRegex), external_exports.object({
|
|
17765
|
+
description: external_exports.string().min(1).max(maxSkillDescriptionLength),
|
|
17766
|
+
inputJsonSchema: external_exports.string().min(1).max(maxSkillInputJsonSchemaLength)
|
|
17767
|
+
}))
|
|
17768
|
+
});
|
|
17769
|
+
var skillSchema2 = external_exports.discriminatedUnion("type", [
|
|
17770
|
+
mcpStdioSkillSchema2,
|
|
17771
|
+
mcpSseSkillSchema2,
|
|
17772
|
+
interactiveSkillSchema2
|
|
17773
|
+
]);
|
|
17774
|
+
var expertSchema2 = external_exports.object({
|
|
17775
|
+
key: expertKeyFieldSchema,
|
|
17776
|
+
name: expertNameFieldSchema,
|
|
17777
|
+
version: expertVersionFieldSchema,
|
|
17778
|
+
description: external_exports.string().max(maxExpertDescriptionLength).optional(),
|
|
17779
|
+
instruction: external_exports.string().min(1).max(maxExpertInstructionLength),
|
|
17780
|
+
skills: external_exports.record(skillNameSchema, skillSchema2).optional().default({}),
|
|
17781
|
+
delegates: external_exports.array(expertKeyFieldSchema).min(0).max(maxExpertDelegateItems).optional().default([]),
|
|
17782
|
+
tags: external_exports.array(expertTagFieldSchema).min(0).max(maxExpertTagItems).optional().default([]),
|
|
17783
|
+
minRuntimeVersion: runtimeVersionSchema2.optional()
|
|
17784
|
+
});
|
|
17785
|
+
external_exports.object({
|
|
17786
|
+
scope: expertScopeSchema,
|
|
17787
|
+
version: expertVersionSchema
|
|
17788
|
+
});
|
|
17789
|
+
var expertWithMetadataSchema = expertSchema2.extend({
|
|
17790
|
+
scope: expertScopeSchema,
|
|
17791
|
+
version: expertVersionSchema
|
|
17792
|
+
});
|
|
17793
|
+
var request$8 = { query: external_exports.object({
|
|
17794
|
+
filter: external_exports.string().describe("Filter by scope name (partial match)").optional(),
|
|
17795
|
+
category: external_exports.enum([
|
|
17796
|
+
"general",
|
|
17797
|
+
"coding",
|
|
17798
|
+
"research",
|
|
17799
|
+
"writing",
|
|
17800
|
+
"data",
|
|
17801
|
+
"automation"
|
|
17802
|
+
]).describe("Filter by category").optional(),
|
|
17803
|
+
includeDrafts: external_exports.coerce.boolean().default(false).describe("Include unpublished scopes (owner only)").optional(),
|
|
17804
|
+
take: external_exports.coerce.number().min(1).max(100).default(20),
|
|
17805
|
+
skip: external_exports.coerce.number().min(0).default(0)
|
|
17806
|
+
}) };
|
|
17807
|
+
external_exports.object({
|
|
17808
|
+
data: external_exports.object({ experts: external_exports.array(expertScopeSchema.extend({ currentVersion: expertVersionSchema.nullable() })) }),
|
|
17809
|
+
meta: paginationMeta
|
|
17810
|
+
});
|
|
17811
|
+
var anthropicSupportModels = [
|
|
17812
|
+
{
|
|
17813
|
+
modelId: "claude-opus-4-5",
|
|
17814
|
+
default: false,
|
|
17815
|
+
provider: "anthropic",
|
|
17816
|
+
contextWindow: 2e5
|
|
17817
|
+
},
|
|
17818
|
+
{
|
|
17819
|
+
modelId: "claude-opus-4-1",
|
|
17820
|
+
default: false,
|
|
17821
|
+
provider: "anthropic",
|
|
17822
|
+
contextWindow: 2e5
|
|
17823
|
+
},
|
|
17824
|
+
{
|
|
17825
|
+
modelId: "claude-opus-4-20250514",
|
|
17826
|
+
default: false,
|
|
17827
|
+
provider: "anthropic",
|
|
17828
|
+
contextWindow: 2e5
|
|
17829
|
+
},
|
|
17830
|
+
{
|
|
17831
|
+
modelId: "claude-sonnet-4-5",
|
|
17832
|
+
default: true,
|
|
17833
|
+
provider: "anthropic",
|
|
17834
|
+
contextWindow: 2e5
|
|
17835
|
+
},
|
|
17836
|
+
{
|
|
17837
|
+
modelId: "claude-sonnet-4-20250514",
|
|
17838
|
+
default: false,
|
|
17839
|
+
provider: "anthropic",
|
|
17840
|
+
contextWindow: 2e5
|
|
17841
|
+
},
|
|
17842
|
+
{
|
|
17843
|
+
modelId: "claude-3-7-sonnet-20250219",
|
|
17844
|
+
default: false,
|
|
17845
|
+
provider: "anthropic",
|
|
17846
|
+
contextWindow: 2e5
|
|
17847
|
+
},
|
|
17848
|
+
{
|
|
17849
|
+
modelId: "claude-haiku-4-5",
|
|
17850
|
+
default: false,
|
|
17851
|
+
provider: "anthropic",
|
|
17852
|
+
contextWindow: 2e5
|
|
17853
|
+
},
|
|
17854
|
+
{
|
|
17855
|
+
modelId: "claude-3-5-haiku-latest",
|
|
17856
|
+
default: false,
|
|
17857
|
+
provider: "anthropic",
|
|
17858
|
+
contextWindow: 2e5
|
|
17859
|
+
}
|
|
17860
|
+
];
|
|
17861
|
+
var googleSupportModels = [
|
|
17862
|
+
{
|
|
17863
|
+
modelId: "gemini-3-pro-preview",
|
|
17864
|
+
default: false,
|
|
17865
|
+
provider: "google",
|
|
17866
|
+
contextWindow: 1e6
|
|
17867
|
+
},
|
|
17868
|
+
{
|
|
17869
|
+
modelId: "gemini-2.5-pro",
|
|
17870
|
+
default: true,
|
|
17871
|
+
provider: "google",
|
|
17872
|
+
contextWindow: 1e6
|
|
17873
|
+
},
|
|
17874
|
+
{
|
|
17875
|
+
modelId: "gemini-2.5-flash",
|
|
17876
|
+
default: false,
|
|
17877
|
+
provider: "google",
|
|
17878
|
+
contextWindow: 1e6
|
|
17879
|
+
},
|
|
17880
|
+
{
|
|
17881
|
+
modelId: "gemini-2.5-flash-lite",
|
|
17882
|
+
default: false,
|
|
17883
|
+
provider: "google",
|
|
17884
|
+
contextWindow: 1e6
|
|
17885
|
+
}
|
|
17886
|
+
];
|
|
17887
|
+
var openAiSupportModels = [
|
|
17888
|
+
{
|
|
17889
|
+
modelId: "gpt-5",
|
|
17890
|
+
default: true,
|
|
17891
|
+
provider: "openai",
|
|
17892
|
+
contextWindow: 4e5
|
|
17893
|
+
},
|
|
17894
|
+
{
|
|
17895
|
+
modelId: "gpt-5-mini",
|
|
17896
|
+
default: false,
|
|
17897
|
+
provider: "openai",
|
|
17898
|
+
contextWindow: 4e5
|
|
17899
|
+
},
|
|
17900
|
+
{
|
|
17901
|
+
modelId: "gpt-5-nano",
|
|
17902
|
+
default: false,
|
|
17903
|
+
provider: "openai",
|
|
17904
|
+
contextWindow: 4e5
|
|
17905
|
+
},
|
|
17906
|
+
{
|
|
17907
|
+
modelId: "gpt-5-chat-latest",
|
|
17908
|
+
default: false,
|
|
17909
|
+
provider: "openai",
|
|
17910
|
+
contextWindow: 128e3
|
|
17911
|
+
},
|
|
17912
|
+
{
|
|
17913
|
+
modelId: "o4-mini",
|
|
17914
|
+
default: false,
|
|
17915
|
+
provider: "openai",
|
|
17916
|
+
contextWindow: 2e5
|
|
17917
|
+
},
|
|
17918
|
+
{
|
|
17919
|
+
modelId: "o3",
|
|
17920
|
+
default: false,
|
|
17921
|
+
provider: "openai",
|
|
17922
|
+
contextWindow: 2e5
|
|
17923
|
+
},
|
|
17924
|
+
{
|
|
17925
|
+
modelId: "o3-mini",
|
|
17926
|
+
default: false,
|
|
17927
|
+
provider: "openai",
|
|
17928
|
+
contextWindow: 2e5
|
|
17929
|
+
},
|
|
17930
|
+
{
|
|
17931
|
+
modelId: "gpt-4.1",
|
|
17932
|
+
default: false,
|
|
17933
|
+
provider: "openai",
|
|
17934
|
+
contextWindow: 1e6
|
|
17935
|
+
}
|
|
17936
|
+
];
|
|
17937
|
+
var deepseekSupportModels = [{
|
|
17938
|
+
modelId: "deepseek-chat",
|
|
17939
|
+
default: true,
|
|
17940
|
+
provider: "deepseek",
|
|
17941
|
+
contextWindow: 128e3
|
|
17942
|
+
}, {
|
|
17943
|
+
modelId: "deepseek-reasoner",
|
|
17944
|
+
default: false,
|
|
17945
|
+
provider: "deepseek",
|
|
17946
|
+
contextWindow: 128e3
|
|
17947
|
+
}];
|
|
17948
|
+
var allSupportModels = [
|
|
17949
|
+
...anthropicSupportModels,
|
|
17950
|
+
...googleSupportModels,
|
|
17951
|
+
...openAiSupportModels,
|
|
17952
|
+
...deepseekSupportModels
|
|
17953
|
+
];
|
|
17954
|
+
var supportModels = Object.fromEntries(allSupportModels.map((model) => [model.modelId, model]));
|
|
17955
|
+
function getSupportModelNames() {
|
|
17956
|
+
return Object.keys(supportModels);
|
|
17957
|
+
}
|
|
17958
|
+
var reasoningBudgetSchema2 = external_exports.union([external_exports.enum([
|
|
17959
|
+
"none",
|
|
17960
|
+
"minimal",
|
|
17961
|
+
"low",
|
|
17962
|
+
"medium",
|
|
17963
|
+
"high"
|
|
17964
|
+
]), external_exports.number().int().min(0)]);
|
|
17965
|
+
var jobStatusSchema2 = external_exports.enum([
|
|
17966
|
+
"queued",
|
|
17967
|
+
"processing",
|
|
17968
|
+
"completed",
|
|
17969
|
+
"requestInteractiveToolResult",
|
|
17970
|
+
"requestDelegateResult",
|
|
17971
|
+
"exceededMaxSteps",
|
|
17972
|
+
"failed",
|
|
17973
|
+
"canceling",
|
|
17974
|
+
"canceled",
|
|
17975
|
+
"expired"
|
|
17976
|
+
]);
|
|
17977
|
+
var modelNames = getSupportModelNames();
|
|
17978
|
+
var firstModel = modelNames[0];
|
|
17979
|
+
if (firstModel === void 0) throw new Error("No support models available");
|
|
17980
|
+
var jobModelSchema = external_exports.enum([firstModel, ...modelNames.slice(1)]);
|
|
17981
|
+
var jobBaseSchema = external_exports.object({
|
|
17982
|
+
type: external_exports.literal("job"),
|
|
17983
|
+
id: cuidSchema,
|
|
17984
|
+
organizationId: cuidSchema,
|
|
17985
|
+
applicationId: cuidSchema,
|
|
17986
|
+
createdAt: datetimeSchema,
|
|
17987
|
+
updatedAt: datetimeSchema,
|
|
17988
|
+
status: jobStatusSchema2,
|
|
17989
|
+
currentExecutionId: cuidSchema.optional(),
|
|
17990
|
+
coordinatorExpertKey: expertKeyFieldSchema,
|
|
17991
|
+
query: external_exports.string().min(1).max(maxExpertJobQueryLength).optional(),
|
|
17992
|
+
expert: expertWithMetadataSchema,
|
|
17993
|
+
provider: providerSchema,
|
|
17994
|
+
model: jobModelSchema,
|
|
17995
|
+
reasoningBudget: reasoningBudgetSchema2,
|
|
17996
|
+
runtimeVersion: runtimeVersionSchema2,
|
|
17997
|
+
maxSteps: external_exports.number().int().min(1),
|
|
17998
|
+
maxRetries: external_exports.number().int().min(0),
|
|
17999
|
+
currentStep: external_exports.number().int().min(0),
|
|
18000
|
+
totalSteps: external_exports.number().int().min(0),
|
|
18001
|
+
totalDuration: external_exports.number().int().min(0),
|
|
18002
|
+
usage: usageSchema,
|
|
18003
|
+
lastActivity: activityOrGroupSchema.nullable().optional()
|
|
18004
|
+
});
|
|
18005
|
+
var publishedJobSchema = jobBaseSchema.extend({
|
|
18006
|
+
expertVersionId: cuidSchema,
|
|
18007
|
+
expertDraftRefId: external_exports.undefined()
|
|
18008
|
+
});
|
|
18009
|
+
var draftJobSchema = jobBaseSchema.extend({
|
|
18010
|
+
expertVersionId: external_exports.undefined(),
|
|
18011
|
+
expertDraftRefId: cuidSchema
|
|
18012
|
+
});
|
|
18013
|
+
var jobSchema2 = external_exports.union([publishedJobSchema, draftJobSchema]);
|
|
18014
|
+
var request$7 = {
|
|
18015
|
+
params: external_exports.object({ jobId: cuidSchema }),
|
|
18016
|
+
body: external_exports.object({
|
|
18017
|
+
query: external_exports.string().min(1).max(maxExpertJobQueryLength),
|
|
18018
|
+
provider: providerSchema.optional(),
|
|
18019
|
+
model: jobModelSchema.optional(),
|
|
18020
|
+
reasoningBudget: reasoningBudgetSchema2.optional(),
|
|
18021
|
+
maxSteps: external_exports.coerce.number().optional(),
|
|
18022
|
+
maxRetries: external_exports.coerce.number().optional()
|
|
18023
|
+
})
|
|
18024
|
+
};
|
|
18025
|
+
external_exports.object({ data: external_exports.object({ job: jobSchema2 }) });
|
|
18026
|
+
var baseBodySchema = external_exports.object({
|
|
18027
|
+
applicationId: cuidSchema.describe("Application ID to create the job in"),
|
|
18028
|
+
query: external_exports.string().min(1).max(maxExpertJobQueryLength),
|
|
18029
|
+
provider: providerSchema,
|
|
18030
|
+
model: jobModelSchema.optional(),
|
|
18031
|
+
reasoningBudget: reasoningBudgetSchema2.optional(),
|
|
18032
|
+
maxSteps: external_exports.coerce.number().optional(),
|
|
18033
|
+
maxRetries: external_exports.coerce.number().optional()
|
|
18034
|
+
});
|
|
18035
|
+
var request$6 = { body: baseBodySchema.extend({
|
|
18036
|
+
expertKey: expertKeyFieldSchema.optional(),
|
|
18037
|
+
draftRefId: cuidSchema.describe("Draft ref ID to run the job with").optional()
|
|
18038
|
+
}).refine((data) => {
|
|
18039
|
+
const hasExpertKey = data.expertKey !== void 0;
|
|
18040
|
+
const hasDraftRefId = data.draftRefId !== void 0;
|
|
18041
|
+
return hasExpertKey && !hasDraftRefId || !hasExpertKey && hasDraftRefId;
|
|
18042
|
+
}, { message: "Either expertKey or draftRefId must be provided, but not both" }) };
|
|
18043
|
+
external_exports.object({ data: external_exports.object({ job: jobSchema2 }) });
|
|
18044
|
+
var request$5 = { query: external_exports.object({
|
|
18045
|
+
sort: external_exports.enum(["createdAt", "updatedAt"]).optional(),
|
|
18046
|
+
order: external_exports.enum(["asc", "desc"]).optional(),
|
|
18047
|
+
take: external_exports.coerce.number().min(1).max(100).default(20),
|
|
18048
|
+
skip: external_exports.coerce.number().min(0).default(0),
|
|
18049
|
+
expertScopeId: cuidSchema.optional(),
|
|
18050
|
+
expertDraftScopeId: cuidSchema.optional(),
|
|
18051
|
+
applicationId: cuidSchema.optional(),
|
|
18052
|
+
statuses: external_exports.preprocess((val) => typeof val === "string" ? val.split(",") : val, external_exports.array(jobStatusSchema2).optional()),
|
|
18053
|
+
expertKeyFilter: external_exports.string().max(100).optional()
|
|
18054
|
+
}) };
|
|
18055
|
+
external_exports.object({
|
|
18056
|
+
data: external_exports.object({ jobs: external_exports.array(jobSchema2) }),
|
|
18057
|
+
meta: paginationMeta
|
|
18058
|
+
});
|
|
18059
|
+
var delegationTargetSchema2 = external_exports.object({
|
|
18060
|
+
expert: expertSchema2,
|
|
18061
|
+
toolCallId: external_exports.string().min(1).max(maxCheckpointToolCallIdLength),
|
|
18062
|
+
toolName: external_exports.string().min(1).max(maxSkillToolNameLength2),
|
|
18063
|
+
query: external_exports.string().min(1)
|
|
18064
|
+
});
|
|
18065
|
+
var apiCheckpointSchema = external_exports.object({
|
|
18066
|
+
type: external_exports.literal("checkpoint"),
|
|
18067
|
+
id: cuidSchema,
|
|
18068
|
+
jobId: cuidSchema,
|
|
18069
|
+
runId: cuidSchema,
|
|
18070
|
+
activities: external_exports.array(activityOrGroupSchema),
|
|
18071
|
+
stepNumber: external_exports.number().int().min(1),
|
|
18072
|
+
status: external_exports.enum([
|
|
18073
|
+
"init",
|
|
18074
|
+
"proceeding",
|
|
18075
|
+
"completed",
|
|
18076
|
+
"stoppedByInteractiveTool",
|
|
18077
|
+
"stoppedByDelegate",
|
|
18078
|
+
"stoppedByExceededMaxSteps",
|
|
18079
|
+
"stoppedByError"
|
|
18080
|
+
]),
|
|
18081
|
+
expert: expertSchema2,
|
|
18082
|
+
delegateTo: external_exports.array(delegationTargetSchema2).optional(),
|
|
18083
|
+
delegatedBy: external_exports.object({
|
|
18084
|
+
expert: expertSchema2,
|
|
18085
|
+
toolCallId: external_exports.string().min(1).max(maxCheckpointToolCallIdLength),
|
|
18086
|
+
toolName: external_exports.string().min(1).max(maxSkillToolNameLength2),
|
|
18087
|
+
checkpointId: cuidSchema,
|
|
18088
|
+
runId: cuidSchema
|
|
18089
|
+
}).optional(),
|
|
18090
|
+
inputMessages: external_exports.array(external_exports.union([
|
|
18091
|
+
instructionMessageSchema,
|
|
18092
|
+
userMessageSchema,
|
|
18093
|
+
toolMessageSchema
|
|
18094
|
+
])).optional(),
|
|
18095
|
+
messages: external_exports.array(messageSchema),
|
|
18096
|
+
newMessages: external_exports.array(messageSchema),
|
|
18097
|
+
toolCalls: external_exports.array(toolCallSchema).optional(),
|
|
18098
|
+
toolResults: external_exports.array(toolResultSchema).optional(),
|
|
18099
|
+
pendingToolCalls: external_exports.array(toolCallSchema).optional(),
|
|
18100
|
+
partialToolResults: external_exports.array(toolResultSchema).optional(),
|
|
18101
|
+
usage: usageSchema,
|
|
18102
|
+
contextWindow: external_exports.number().int().min(0).optional(),
|
|
18103
|
+
contextWindowUsage: external_exports.number().int().min(0).optional(),
|
|
18104
|
+
error: external_exports.object({
|
|
18105
|
+
name: external_exports.string().min(1),
|
|
18106
|
+
message: external_exports.string().min(1),
|
|
18107
|
+
statusCode: external_exports.number().int().min(100).max(599).optional(),
|
|
18108
|
+
isRetryable: external_exports.boolean()
|
|
18109
|
+
}).optional(),
|
|
18110
|
+
retryCount: external_exports.number().int().min(0).optional(),
|
|
18111
|
+
startedAt: datetimeSchema,
|
|
18112
|
+
finishedAt: datetimeSchema.optional()
|
|
18113
|
+
});
|
|
18114
|
+
var request$4 = {
|
|
18115
|
+
params: external_exports.object({
|
|
18116
|
+
jobId: cuidSchema,
|
|
18117
|
+
runId: cuidSchema
|
|
18118
|
+
}),
|
|
18119
|
+
query: external_exports.object({
|
|
18120
|
+
filter: external_exports.string().min(1).max(256).optional(),
|
|
18121
|
+
sort: external_exports.enum(["createdAt", "updatedAt"]).optional(),
|
|
18122
|
+
order: external_exports.enum(["asc", "desc"]).optional(),
|
|
18123
|
+
take: external_exports.coerce.number().min(1).max(100).default(20),
|
|
18124
|
+
skip: external_exports.coerce.number().min(0).default(0)
|
|
18125
|
+
})
|
|
18126
|
+
};
|
|
18127
|
+
external_exports.object({
|
|
18128
|
+
data: external_exports.object({ checkpoints: external_exports.array(apiCheckpointSchema) }),
|
|
18129
|
+
meta: paginationMeta
|
|
18130
|
+
});
|
|
18131
|
+
var runStatusSchema = external_exports.enum([
|
|
18132
|
+
"queued",
|
|
18133
|
+
"processing",
|
|
18134
|
+
"completed",
|
|
18135
|
+
"stoppedByInteractiveTool",
|
|
18136
|
+
"stoppedByDelegate",
|
|
18137
|
+
"stoppedByExceededMaxSteps",
|
|
18138
|
+
"stoppedByError"
|
|
18139
|
+
]);
|
|
18140
|
+
var runSchema = external_exports.object({
|
|
18141
|
+
type: external_exports.literal("run"),
|
|
18142
|
+
id: cuidSchema,
|
|
18143
|
+
jobId: cuidSchema,
|
|
18144
|
+
executionId: cuidSchema.optional(),
|
|
18145
|
+
parentRunId: cuidSchema.optional(),
|
|
18146
|
+
organizationId: cuidSchema,
|
|
18147
|
+
createdAt: datetimeSchema,
|
|
18148
|
+
updatedAt: datetimeSchema,
|
|
18149
|
+
status: runStatusSchema,
|
|
18150
|
+
expertKey: expertKeyFieldSchema,
|
|
18151
|
+
expert: expertWithMetadataSchema,
|
|
18152
|
+
stepNumber: external_exports.number().int().min(0),
|
|
18153
|
+
usage: usageSchema
|
|
18154
|
+
});
|
|
18155
|
+
var request$3 = {
|
|
18156
|
+
params: external_exports.object({ jobId: cuidSchema }),
|
|
18157
|
+
query: external_exports.object({
|
|
18158
|
+
sort: external_exports.enum(["createdAt", "updatedAt"]).optional(),
|
|
18159
|
+
order: external_exports.enum(["asc", "desc"]).optional(),
|
|
18160
|
+
take: external_exports.coerce.number().min(1).max(100).default(20),
|
|
18161
|
+
skip: external_exports.coerce.number().min(0).default(0)
|
|
18162
|
+
})
|
|
18163
|
+
};
|
|
18164
|
+
external_exports.object({
|
|
18165
|
+
data: external_exports.object({ runs: external_exports.array(runSchema) }),
|
|
18166
|
+
meta: paginationMeta
|
|
18167
|
+
});
|
|
18168
|
+
var baseUrlSchema = external_exports.string().url().max(maxProviderBaseUrlLength).optional();
|
|
18169
|
+
var headersSchema2 = external_exports.record(external_exports.string().min(1).max(maxProviderHeaderKeyLength), external_exports.string().max(maxProviderHeaderValueLength)).refine((headers) => Object.keys(headers).length <= maxProviderHeadersCount, { message: `Headers must have at most ${maxProviderHeadersCount} entries` }).optional();
|
|
18170
|
+
var anthropicProviderSettingsSchema = external_exports.object({
|
|
18171
|
+
baseUrl: baseUrlSchema,
|
|
18172
|
+
headers: headersSchema2
|
|
18173
|
+
});
|
|
18174
|
+
var googleProviderSettingsSchema = external_exports.object({
|
|
18175
|
+
baseUrl: baseUrlSchema,
|
|
18176
|
+
headers: headersSchema2
|
|
18177
|
+
});
|
|
18178
|
+
var openaiProviderSettingsSchema = external_exports.object({
|
|
18179
|
+
baseUrl: baseUrlSchema,
|
|
18180
|
+
headers: headersSchema2,
|
|
18181
|
+
organization: external_exports.string().min(1).optional(),
|
|
18182
|
+
project: external_exports.string().min(1).optional(),
|
|
18183
|
+
name: external_exports.string().min(1).optional()
|
|
18184
|
+
});
|
|
18185
|
+
var deepseekProviderSettingsSchema = external_exports.object({
|
|
18186
|
+
baseUrl: baseUrlSchema,
|
|
18187
|
+
headers: headersSchema2
|
|
18188
|
+
});
|
|
18189
|
+
var azureOpenaiProviderSettingsSchema = external_exports.object({
|
|
18190
|
+
baseUrl: baseUrlSchema,
|
|
18191
|
+
headers: headersSchema2,
|
|
18192
|
+
resourceName: external_exports.string().min(1).optional(),
|
|
18193
|
+
apiVersion: external_exports.string().min(1).optional(),
|
|
18194
|
+
useDeploymentBasedUrls: external_exports.boolean().optional()
|
|
18195
|
+
});
|
|
18196
|
+
var amazonBedrockProviderSettingsSchema = external_exports.object({ region: external_exports.string().min(1).optional() });
|
|
18197
|
+
var googleVertexProviderSettingsSchema = external_exports.object({
|
|
18198
|
+
baseUrl: baseUrlSchema,
|
|
18199
|
+
headers: headersSchema2,
|
|
18200
|
+
project: external_exports.string().min(1).optional(),
|
|
18201
|
+
location: external_exports.string().min(1).optional()
|
|
18202
|
+
});
|
|
18203
|
+
var providerSettingsSchema = external_exports.union([
|
|
18204
|
+
anthropicProviderSettingsSchema,
|
|
18205
|
+
googleProviderSettingsSchema,
|
|
18206
|
+
openaiProviderSettingsSchema,
|
|
18207
|
+
deepseekProviderSettingsSchema,
|
|
18208
|
+
azureOpenaiProviderSettingsSchema,
|
|
18209
|
+
amazonBedrockProviderSettingsSchema,
|
|
18210
|
+
googleVertexProviderSettingsSchema
|
|
18211
|
+
]);
|
|
18212
|
+
external_exports.object({
|
|
18213
|
+
type: external_exports.literal("providerSetting"),
|
|
18214
|
+
id: cuidSchema,
|
|
18215
|
+
applicationId: cuidSchema,
|
|
18216
|
+
provider: providerSchema,
|
|
18217
|
+
settings: providerSettingsSchema.optional(),
|
|
18218
|
+
application: applicationSchema,
|
|
18219
|
+
createdAt: datetimeSchema,
|
|
18220
|
+
updatedAt: datetimeSchema
|
|
18221
|
+
});
|
|
18222
|
+
var providerSettingResponseSchema = external_exports.object({
|
|
18223
|
+
type: external_exports.literal("providerSetting"),
|
|
18224
|
+
id: cuidSchema,
|
|
18225
|
+
provider: providerSchema,
|
|
18226
|
+
settings: providerSettingsSchema.optional(),
|
|
18227
|
+
createdAt: datetimeSchema,
|
|
18228
|
+
updatedAt: datetimeSchema
|
|
18229
|
+
});
|
|
18230
|
+
var providerApiKeyMetadataSchema = external_exports.object({
|
|
18231
|
+
id: cuidSchema,
|
|
18232
|
+
name: external_exports.string(),
|
|
18233
|
+
createdAt: datetimeSchema,
|
|
18234
|
+
updatedAt: datetimeSchema,
|
|
18235
|
+
lastUsedAt: datetimeSchema.nullable(),
|
|
18236
|
+
expiresAt: datetimeSchema.nullable()
|
|
18237
|
+
});
|
|
18238
|
+
var request$2 = {
|
|
18239
|
+
params: external_exports.object({
|
|
18240
|
+
applicationId: cuidSchema,
|
|
18241
|
+
provider: providerSchema
|
|
18242
|
+
}),
|
|
18243
|
+
body: external_exports.object({
|
|
18244
|
+
name: external_exports.string().min(1).max(255),
|
|
18245
|
+
value: external_exports.string().min(1)
|
|
18246
|
+
})
|
|
18247
|
+
};
|
|
18248
|
+
external_exports.object({ data: external_exports.object({ apiKey: providerApiKeyMetadataSchema }) });
|
|
18249
|
+
var request$1 = {
|
|
18250
|
+
params: external_exports.object({ applicationId: cuidSchema }),
|
|
18251
|
+
body: external_exports.object({
|
|
18252
|
+
provider: providerSchema,
|
|
18253
|
+
settings: providerSettingsSchema.optional()
|
|
18254
|
+
})
|
|
18255
|
+
};
|
|
18256
|
+
external_exports.object({ data: external_exports.object({ providerSetting: providerSettingResponseSchema }) });
|
|
18257
|
+
var request = {
|
|
18258
|
+
params: external_exports.object({
|
|
18259
|
+
applicationId: cuidSchema,
|
|
18260
|
+
provider: providerSchema
|
|
18261
|
+
}),
|
|
18262
|
+
body: external_exports.object({ settings: providerSettingsSchema.optional() })
|
|
18263
|
+
};
|
|
18264
|
+
external_exports.object({ data: external_exports.object({ providerSetting: providerSettingResponseSchema }) });
|
|
18265
|
+
function createRunCheckpointsApi(fetcher, basePath) {
|
|
18266
|
+
return {
|
|
18267
|
+
async list(jobId, runId, params, options) {
|
|
18268
|
+
if (params) {
|
|
18269
|
+
const result = request$4.query.safeParse(params);
|
|
18270
|
+
if (!result.success) return {
|
|
18271
|
+
ok: false,
|
|
18272
|
+
error: createValidationError(result.error)
|
|
18273
|
+
};
|
|
18274
|
+
}
|
|
18275
|
+
const queryString = buildQueryString(params);
|
|
18276
|
+
return fetcher.get(`${basePath}/${jobId}/runs/${runId}/checkpoints${queryString}`, options);
|
|
18277
|
+
},
|
|
18278
|
+
async get(jobId, runId, checkpointId, options) {
|
|
18279
|
+
return fetcher.get(`${basePath}/${jobId}/runs/${runId}/checkpoints/${checkpointId}`, options);
|
|
18280
|
+
}
|
|
18281
|
+
};
|
|
18282
|
+
}
|
|
18283
|
+
function createRunsApi(fetcher, basePath) {
|
|
18284
|
+
return {
|
|
18285
|
+
async list(jobId, params, options) {
|
|
18286
|
+
if (params) {
|
|
18287
|
+
const result = request$3.query.safeParse(params);
|
|
18288
|
+
if (!result.success) return {
|
|
18289
|
+
ok: false,
|
|
18290
|
+
error: createValidationError(result.error)
|
|
18291
|
+
};
|
|
18292
|
+
}
|
|
18293
|
+
const queryString = buildQueryString(params);
|
|
18294
|
+
return fetcher.get(`${basePath}/${jobId}/runs${queryString}`, options);
|
|
18295
|
+
},
|
|
18296
|
+
async get(jobId, runId, options) {
|
|
18297
|
+
return fetcher.get(`${basePath}/${jobId}/runs/${runId}`, options);
|
|
18298
|
+
},
|
|
18299
|
+
checkpoints: createRunCheckpointsApi(fetcher, basePath)
|
|
18300
|
+
};
|
|
18301
|
+
}
|
|
18302
|
+
var BASE_PATH$5 = "/api/v1/jobs";
|
|
18303
|
+
var StreamError = class extends Error {
|
|
18304
|
+
constructor(type, jobId, message) {
|
|
18305
|
+
super(message ?? `Stream error: ${type}`);
|
|
18306
|
+
this.type = type;
|
|
18307
|
+
this.jobId = jobId;
|
|
18308
|
+
this.name = "StreamError";
|
|
18309
|
+
}
|
|
18310
|
+
};
|
|
18311
|
+
var StreamConnectionError = class extends Error {
|
|
18312
|
+
constructor(message) {
|
|
18313
|
+
super(message);
|
|
18314
|
+
this.name = "StreamConnectionError";
|
|
18315
|
+
}
|
|
18316
|
+
};
|
|
18317
|
+
function isErrorEventData(data) {
|
|
18318
|
+
return typeof data === "object" && data !== null && "type" in data && typeof data.type === "string" && "jobId" in data && typeof data.jobId === "string";
|
|
18319
|
+
}
|
|
18320
|
+
function isCompleteEventData(data) {
|
|
18321
|
+
return typeof data === "object" && data !== null && "status" in data && typeof data.status === "string" && "jobId" in data && typeof data.jobId === "string";
|
|
18322
|
+
}
|
|
18323
|
+
function createJobsApi(fetcher) {
|
|
18324
|
+
return {
|
|
18325
|
+
async list(params, options) {
|
|
18326
|
+
if (params) {
|
|
18327
|
+
const result = request$5.query.safeParse(params);
|
|
18328
|
+
if (!result.success) return {
|
|
18329
|
+
ok: false,
|
|
18330
|
+
error: createValidationError(result.error)
|
|
18331
|
+
};
|
|
18332
|
+
}
|
|
18333
|
+
const queryString = buildQueryString(params);
|
|
18334
|
+
return fetcher.get(`${BASE_PATH$5}${queryString}`, options);
|
|
18335
|
+
},
|
|
18336
|
+
async get(id, options) {
|
|
18337
|
+
return fetcher.get(`${BASE_PATH$5}/${id}`, options);
|
|
18338
|
+
},
|
|
18339
|
+
async start(input, options) {
|
|
18340
|
+
const result = request$6.body.safeParse(input);
|
|
18341
|
+
if (!result.success) return {
|
|
18342
|
+
ok: false,
|
|
18343
|
+
error: createValidationError(result.error)
|
|
18344
|
+
};
|
|
18345
|
+
return fetcher.post(BASE_PATH$5, input, options);
|
|
18346
|
+
},
|
|
18347
|
+
async continue(id, input, options) {
|
|
18348
|
+
const result = request$7.body.safeParse(input);
|
|
18349
|
+
if (!result.success) return {
|
|
18350
|
+
ok: false,
|
|
18351
|
+
error: createValidationError(result.error)
|
|
18352
|
+
};
|
|
18353
|
+
return fetcher.post(`${BASE_PATH$5}/${id}/continue`, input, options);
|
|
18354
|
+
},
|
|
18355
|
+
async cancel(id, options) {
|
|
18356
|
+
return fetcher.post(`${BASE_PATH$5}/${id}/cancel`, {}, options);
|
|
18357
|
+
},
|
|
18358
|
+
async *stream(id, options) {
|
|
18359
|
+
const result = await fetcher.getStream(`${BASE_PATH$5}/${id}/stream`, options);
|
|
18360
|
+
if (!result.ok) throw new StreamConnectionError(result.error.message);
|
|
18361
|
+
const reader = result.data.getReader();
|
|
18362
|
+
try {
|
|
18363
|
+
for await (const sseEvent of parseSSEEvents(reader)) if (sseEvent.event === "message") yield sseEvent.data;
|
|
18364
|
+
else if (sseEvent.event === "error" && isErrorEventData(sseEvent.data)) throw new StreamError(sseEvent.data.type, sseEvent.data.jobId, sseEvent.data.message);
|
|
18365
|
+
else if (sseEvent.event === "complete" && isCompleteEventData(sseEvent.data)) return;
|
|
18366
|
+
} catch (error48) {
|
|
18367
|
+
if (error48 instanceof StreamError || error48 instanceof StreamConnectionError) throw error48;
|
|
18368
|
+
if (error48 instanceof DOMException && error48.name === "AbortError") throw error48;
|
|
18369
|
+
throw new StreamConnectionError(error48 instanceof Error ? error48.message : "Stream read error");
|
|
18370
|
+
}
|
|
18371
|
+
},
|
|
18372
|
+
runs: createRunsApi(fetcher, BASE_PATH$5)
|
|
18373
|
+
};
|
|
18374
|
+
}
|
|
18375
|
+
var BASE_PATH$4 = "/api/v1/applications";
|
|
18376
|
+
function createApplicationsApi(fetcher) {
|
|
18377
|
+
return {
|
|
18378
|
+
async list(params, options) {
|
|
18379
|
+
if (params) {
|
|
18380
|
+
const result = request$16.query.safeParse(params);
|
|
18381
|
+
if (!result.success) return {
|
|
18382
|
+
ok: false,
|
|
18383
|
+
error: createValidationError(result.error)
|
|
18384
|
+
};
|
|
18385
|
+
}
|
|
18386
|
+
const queryString = buildQueryString(params);
|
|
18387
|
+
return fetcher.get(`${BASE_PATH$4}${queryString}`, options);
|
|
18388
|
+
},
|
|
18389
|
+
async get(id, options) {
|
|
18390
|
+
return fetcher.get(`${BASE_PATH$4}/${id}`, options);
|
|
18391
|
+
},
|
|
18392
|
+
async create(input, options) {
|
|
18393
|
+
const result = request$17.body.safeParse(input);
|
|
18394
|
+
if (!result.success) return {
|
|
18395
|
+
ok: false,
|
|
18396
|
+
error: createValidationError(result.error)
|
|
18397
|
+
};
|
|
18398
|
+
return fetcher.post(BASE_PATH$4, input, options);
|
|
18399
|
+
},
|
|
18400
|
+
async update(id, input, options) {
|
|
18401
|
+
const result = request$15.body.safeParse(input);
|
|
18402
|
+
if (!result.success) return {
|
|
18403
|
+
ok: false,
|
|
18404
|
+
error: createValidationError(result.error)
|
|
18405
|
+
};
|
|
18406
|
+
return fetcher.post(`${BASE_PATH$4}/${id}`, input, options);
|
|
18407
|
+
},
|
|
18408
|
+
async delete(id, options) {
|
|
18409
|
+
return fetcher.delete(`${BASE_PATH$4}/${id}`, options);
|
|
18410
|
+
}
|
|
18411
|
+
};
|
|
18412
|
+
}
|
|
18413
|
+
var BASE_PATH$3 = "/api/v1/env/secrets";
|
|
18414
|
+
function createSecretsApi(fetcher) {
|
|
18415
|
+
return {
|
|
18416
|
+
async list(params, options) {
|
|
18417
|
+
if (params) {
|
|
18418
|
+
const result = request$13.query.safeParse(params);
|
|
18419
|
+
if (!result.success) return {
|
|
18420
|
+
ok: false,
|
|
18421
|
+
error: createValidationError(result.error)
|
|
18422
|
+
};
|
|
18423
|
+
}
|
|
18424
|
+
const queryString = buildQueryString(params);
|
|
18425
|
+
return fetcher.get(`${BASE_PATH$3}${queryString}`, options);
|
|
18426
|
+
},
|
|
18427
|
+
async get(name, options) {
|
|
18428
|
+
const encodedName = encodeURIComponent(name);
|
|
18429
|
+
return fetcher.get(`${BASE_PATH$3}/${encodedName}`, options);
|
|
18430
|
+
},
|
|
18431
|
+
async create(input, options) {
|
|
18432
|
+
const result = request$14.body.safeParse(input);
|
|
18433
|
+
if (!result.success) return {
|
|
18434
|
+
ok: false,
|
|
18435
|
+
error: createValidationError(result.error)
|
|
18436
|
+
};
|
|
18437
|
+
return fetcher.post(BASE_PATH$3, input, options);
|
|
18438
|
+
},
|
|
18439
|
+
async update(name, input, options) {
|
|
18440
|
+
const result = request$12.body.safeParse(input);
|
|
18441
|
+
if (!result.success) return {
|
|
18442
|
+
ok: false,
|
|
18443
|
+
error: createValidationError(result.error)
|
|
18444
|
+
};
|
|
18445
|
+
const encodedName = encodeURIComponent(name);
|
|
18446
|
+
return fetcher.put(`${BASE_PATH$3}/${encodedName}`, input, options);
|
|
18447
|
+
},
|
|
18448
|
+
async delete(name, options) {
|
|
18449
|
+
const encodedName = encodeURIComponent(name);
|
|
18450
|
+
return fetcher.deleteNoContent(`${BASE_PATH$3}/${encodedName}`, options);
|
|
18451
|
+
}
|
|
18452
|
+
};
|
|
18453
|
+
}
|
|
18454
|
+
var BASE_PATH$2 = "/api/v1/env/variables";
|
|
18455
|
+
function createVariablesApi(fetcher) {
|
|
18456
|
+
return {
|
|
18457
|
+
async list(params, options) {
|
|
18458
|
+
const result = request$10.query.safeParse(params);
|
|
18459
|
+
if (!result.success) return {
|
|
18460
|
+
ok: false,
|
|
18461
|
+
error: createValidationError(result.error)
|
|
18462
|
+
};
|
|
18463
|
+
const queryString = buildQueryString(params);
|
|
18464
|
+
return fetcher.get(`${BASE_PATH$2}${queryString}`, options);
|
|
18465
|
+
},
|
|
18466
|
+
async get(name, options) {
|
|
18467
|
+
const encodedName = encodeURIComponent(name);
|
|
18468
|
+
return fetcher.get(`${BASE_PATH$2}/${encodedName}`, options);
|
|
18469
|
+
},
|
|
18470
|
+
async create(input, options) {
|
|
18471
|
+
const result = request$11.body.safeParse(input);
|
|
18472
|
+
if (!result.success) return {
|
|
18473
|
+
ok: false,
|
|
18474
|
+
error: createValidationError(result.error)
|
|
18475
|
+
};
|
|
18476
|
+
return fetcher.post(BASE_PATH$2, input, options);
|
|
18477
|
+
},
|
|
18478
|
+
async update(name, input, options) {
|
|
18479
|
+
const result = request$9.body.safeParse(input);
|
|
18480
|
+
if (!result.success) return {
|
|
18481
|
+
ok: false,
|
|
18482
|
+
error: createValidationError(result.error)
|
|
18483
|
+
};
|
|
18484
|
+
const encodedName = encodeURIComponent(name);
|
|
18485
|
+
return fetcher.put(`${BASE_PATH$2}/${encodedName}`, input, options);
|
|
18486
|
+
},
|
|
18487
|
+
async delete(name, options) {
|
|
18488
|
+
const encodedName = encodeURIComponent(name);
|
|
18489
|
+
return fetcher.deleteNoContent(`${BASE_PATH$2}/${encodedName}`, options);
|
|
18490
|
+
}
|
|
18491
|
+
};
|
|
18492
|
+
}
|
|
18493
|
+
function createEnvApi(fetcher) {
|
|
18494
|
+
return {
|
|
18495
|
+
secrets: createSecretsApi(fetcher),
|
|
18496
|
+
variables: createVariablesApi(fetcher)
|
|
18497
|
+
};
|
|
18498
|
+
}
|
|
18499
|
+
function createVersionsApi(fetcher, basePath) {
|
|
18500
|
+
return { async list(scopeName, options) {
|
|
18501
|
+
const encodedScopeName = encodeURIComponent(scopeName);
|
|
18502
|
+
return fetcher.get(`${basePath}/${encodedScopeName}/versions`, options);
|
|
18503
|
+
} };
|
|
18504
|
+
}
|
|
18505
|
+
var BASE_PATH$1 = "/api/v1/experts";
|
|
18506
|
+
function createExpertsApi(fetcher) {
|
|
18507
|
+
return {
|
|
18508
|
+
async list(params, options) {
|
|
18509
|
+
if (params) {
|
|
18510
|
+
const result = request$8.query.safeParse(params);
|
|
18511
|
+
if (!result.success) return {
|
|
18512
|
+
ok: false,
|
|
18513
|
+
error: createValidationError(result.error)
|
|
18514
|
+
};
|
|
18515
|
+
}
|
|
18516
|
+
const queryString = buildQueryString(params);
|
|
18517
|
+
return fetcher.get(`${BASE_PATH$1}${queryString}`, options);
|
|
18518
|
+
},
|
|
18519
|
+
async get(key, options) {
|
|
18520
|
+
const encodedKey = encodeURIComponent(key);
|
|
18521
|
+
return fetcher.get(`${BASE_PATH$1}/${encodedKey}`, options);
|
|
18522
|
+
},
|
|
18523
|
+
async getFeatured(options) {
|
|
18524
|
+
return fetcher.get(`${BASE_PATH$1}/featured`, options);
|
|
18525
|
+
},
|
|
18526
|
+
async getMeta(key, options) {
|
|
18527
|
+
const encodedKey = encodeURIComponent(key);
|
|
18528
|
+
return fetcher.get(`${BASE_PATH$1}/${encodedKey}/meta`, options);
|
|
18529
|
+
},
|
|
18530
|
+
async publish(scopeName, options) {
|
|
18531
|
+
const encodedScopeName = encodeURIComponent(scopeName);
|
|
18532
|
+
return fetcher.post(`${BASE_PATH$1}/${encodedScopeName}/publish`, {}, options);
|
|
18533
|
+
},
|
|
18534
|
+
async unpublish(scopeName, options) {
|
|
18535
|
+
const encodedScopeName = encodeURIComponent(scopeName);
|
|
18536
|
+
return fetcher.post(`${BASE_PATH$1}/${encodedScopeName}/unpublish`, {}, options);
|
|
18537
|
+
},
|
|
18538
|
+
async yank(key, options) {
|
|
18539
|
+
const encodedKey = encodeURIComponent(key);
|
|
18540
|
+
return fetcher.delete(`${BASE_PATH$1}/${encodedKey}`, options);
|
|
18541
|
+
},
|
|
18542
|
+
versions: createVersionsApi(fetcher, BASE_PATH$1)
|
|
18543
|
+
};
|
|
18544
|
+
}
|
|
18545
|
+
var BASE_PATH = "/api/v1/applications";
|
|
18546
|
+
function createProviderSettingsApi(fetcher) {
|
|
18547
|
+
return {
|
|
18548
|
+
async list(applicationId, options) {
|
|
18549
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings`, options);
|
|
18550
|
+
},
|
|
18551
|
+
async get(applicationId, provider, options) {
|
|
18552
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18553
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, options);
|
|
18554
|
+
},
|
|
18555
|
+
async create(applicationId, input, options) {
|
|
18556
|
+
const result = request$1.body.safeParse(input);
|
|
18557
|
+
if (!result.success) return {
|
|
18558
|
+
ok: false,
|
|
18559
|
+
error: createValidationError(result.error)
|
|
18560
|
+
};
|
|
18561
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings`, input, options);
|
|
18562
|
+
},
|
|
18563
|
+
async update(applicationId, provider, input, options) {
|
|
18564
|
+
const result = request.body.safeParse(input);
|
|
18565
|
+
if (!result.success) return {
|
|
18566
|
+
ok: false,
|
|
18567
|
+
error: createValidationError(result.error)
|
|
18568
|
+
};
|
|
18569
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18570
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, input, options);
|
|
18571
|
+
},
|
|
18572
|
+
async delete(applicationId, provider, options) {
|
|
18573
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18574
|
+
return fetcher.deleteNoContent(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, options);
|
|
18575
|
+
},
|
|
18576
|
+
async listApiKeys(applicationId, provider, options) {
|
|
18577
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18578
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys`, options);
|
|
18579
|
+
},
|
|
18580
|
+
async createApiKey(applicationId, provider, input, options) {
|
|
18581
|
+
const result = request$2.body.safeParse(input);
|
|
18582
|
+
if (!result.success) return {
|
|
18583
|
+
ok: false,
|
|
18584
|
+
error: createValidationError(result.error)
|
|
18585
|
+
};
|
|
18586
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18587
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys`, input, options);
|
|
18588
|
+
},
|
|
18589
|
+
async deleteApiKey(applicationId, provider, apiKeyId, options) {
|
|
18590
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18591
|
+
const encodedApiKeyId = encodeURIComponent(apiKeyId);
|
|
18592
|
+
return fetcher.deleteNoContent(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys/${encodedApiKeyId}`, options);
|
|
18593
|
+
}
|
|
18594
|
+
};
|
|
18595
|
+
}
|
|
18596
|
+
function createApiClient(config2) {
|
|
18597
|
+
const fetcher = createFetcher(config2);
|
|
18598
|
+
return {
|
|
18599
|
+
applications: createApplicationsApi(fetcher),
|
|
18600
|
+
env: createEnvApi(fetcher),
|
|
18601
|
+
jobs: createJobsApi(fetcher),
|
|
18602
|
+
experts: createExpertsApi(fetcher),
|
|
18603
|
+
providerSettings: createProviderSettingsApi(fetcher)
|
|
18604
|
+
};
|
|
18605
|
+
}
|
|
17205
18606
|
/*! Bundled license information:
|
|
17206
18607
|
|
|
17207
18608
|
@noble/hashes/utils.js:
|
|
17208
18609
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
17209
18610
|
*/
|
|
17210
18611
|
|
|
17211
|
-
export { $ZodObject, $ZodType, $constructor, BASE_SKILL_PREFIX, NEVER, PerstackError, ZodIssueCode, ZodOptional, _enum2 as _enum, _null3 as _null,
|
|
17212
|
-
//# sourceMappingURL=chunk-
|
|
17213
|
-
//# sourceMappingURL=chunk-
|
|
18612
|
+
export { $ZodObject, $ZodType, $constructor, BASE_SKILL_PREFIX, NEVER, PerstackError, ZodIssueCode, ZodOptional, _enum2 as _enum, _null3 as _null, any, array, attemptCompletion, boolean2 as boolean, callTools, checkpointSchema, clone2 as clone, coerce_exports, completeRun, continueToNextStep, createApiClient, createBaseToolActivity, createFilteredEventListener, createGeneralToolActivity, createId, createRuntimeEvent, createStreamingEvent, custom, defaultMaxRetries, defaultPerstackApiBaseUrl, defaultTimeout, defineLazy, discriminatedUnion, expertSchema, external_exports, finishMcpTools, finishToolCall, getFilteredEnv, intersection, iso_exports, jobSchema, knownModels, literal, lockfileSchema, looseObject, normalizeParams, number2 as number, object, optional, parse, parseAsync, parseWithFriendlyError, perstackConfigSchema, preprocess, proceedToInteractiveTools, record, resolveToolResults, resumeFromStop, retry, runCommandInputSchema, runParamsSchema, runSettingSchema, safeParse, safeParseAsync, safeParseAsync2, skipDelegates, startCommandInputSchema, startGeneration, startRun, stopRunByDelegate, stopRunByError, stopRunByExceededMaxSteps, stopRunByInteractiveTool, string2 as string, toJSONSchema, union, unknown, url, validateEventFilter };
|
|
18613
|
+
//# sourceMappingURL=chunk-OF74MEG2.js.map
|
|
18614
|
+
//# sourceMappingURL=chunk-OF74MEG2.js.map
|