@codexhost/cli-linux-arm64 0.24.0 → 0.25.1
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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +3166 -3040
- package/app/console-web.js +1156 -585
- package/app/desktop-controller.mjs +645 -264
- package/app/host-runtime.mjs +10906 -10282
- package/app/plugins/antigravity/plugin.mjs +515 -369
- package/app/plugins/claude-code/plugin.mjs +583 -438
- package/app/plugins/codebuddy/plugin.mjs +551 -429
- package/app/plugins/codex-usage/plugin.mjs +344 -224
- package/app/plugins/copilot/plugin.mjs +408 -286
- package/app/plugins/cursor-cli/plugin.mjs +499 -360
- package/app/plugins/deepseek-harness/plugin.mjs +759 -520
- package/app/plugins/devin/plugin.mjs +385 -265
- package/app/plugins/grok/plugin.mjs +638 -516
- package/app/plugins/hermes/plugin.mjs +456 -334
- package/app/plugins/kimi-code/plugin.mjs +454 -332
- package/app/plugins/kiro-cli/plugin.mjs +445 -325
- package/app/plugins/omp/plugin.mjs +707 -339
- package/app/plugins/opencode/plugin.mjs +873 -741
- package/app/plugins/pi/plugin.mjs +481 -359
- package/app/plugins/qoder/plugin.mjs +682 -560
- package/app/plugins/qoder-cn/plugin.mjs +682 -560
- package/app/plugins/qwen-code/plugin.mjs +475 -355
- package/app/plugins/workbuddy/plugin.mjs +549 -429
- package/app/plugins/zcode/plugin.mjs +352 -232
- package/app/renderer-extension.js +1706 -945
- package/app/web/assets/{index-IvFk9KT-.js → index-DUOvhHbV.js} +82 -82
- package/app/web/codexhost-settings.js +416 -51
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +64 -64
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-shortcuts/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-brand-official/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +72 -72
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +97 -97
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +8 -8
- package/app/web-modules/server.mjs +2132 -1312
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -3851,8 +3851,8 @@ var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
|
3851
3851
|
function installRootExtensions(platform) {
|
|
3852
3852
|
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
3853
3853
|
}
|
|
3854
|
-
function resolveHomeDirectory(
|
|
3855
|
-
return
|
|
3854
|
+
function resolveHomeDirectory(input2) {
|
|
3855
|
+
return input2.homeDirectory ?? environmentValue(input2.environment, "HOME") ?? environmentValue(input2.environment, "USERPROFILE") ?? os.homedir();
|
|
3856
3856
|
}
|
|
3857
3857
|
function templateVariables(environment, platform, home) {
|
|
3858
3858
|
const pathFlavor = targetPath(platform);
|
|
@@ -3885,36 +3885,36 @@ function expandInstallRoot(template, environment, platform, home) {
|
|
|
3885
3885
|
});
|
|
3886
3886
|
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
3887
3887
|
}
|
|
3888
|
-
function installRootDirectories(spec,
|
|
3888
|
+
function installRootDirectories(spec, input2, dependencies, platform, home) {
|
|
3889
3889
|
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
3890
3890
|
const directories = [];
|
|
3891
3891
|
for (const template of templates) {
|
|
3892
3892
|
if (template === VERSION_MANAGER_ROOTS) {
|
|
3893
3893
|
directories.push(...versionManagerBinaryDirectories({
|
|
3894
3894
|
platform,
|
|
3895
|
-
environment:
|
|
3895
|
+
environment: input2.environment,
|
|
3896
3896
|
home,
|
|
3897
3897
|
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
3898
3898
|
}));
|
|
3899
3899
|
continue;
|
|
3900
3900
|
}
|
|
3901
|
-
const directory = expandInstallRoot(template,
|
|
3901
|
+
const directory = expandInstallRoot(template, input2.environment, platform, home);
|
|
3902
3902
|
if (directory !== void 0)
|
|
3903
3903
|
directories.push(directory);
|
|
3904
3904
|
}
|
|
3905
3905
|
return directories;
|
|
3906
3906
|
}
|
|
3907
|
-
function harnessCandidates(spec,
|
|
3908
|
-
const platform =
|
|
3907
|
+
function harnessCandidates(spec, input2, dependencies = {}) {
|
|
3908
|
+
const platform = input2.platform ?? process.platform;
|
|
3909
3909
|
const pathFlavor = targetPath(platform);
|
|
3910
|
-
const configured =
|
|
3910
|
+
const configured = input2.command ?? (spec.commandEnvironmentVariable ? environmentValue(input2.environment, spec.commandEnvironmentVariable) : void 0);
|
|
3911
3911
|
const command = configured ?? spec.command;
|
|
3912
3912
|
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
3913
3913
|
return [{ candidate: command, source: "configured" }];
|
|
3914
3914
|
}
|
|
3915
3915
|
const candidates = [];
|
|
3916
|
-
const extensions = executableExtensions(command, platform,
|
|
3917
|
-
for (const directory of pathDirectories(
|
|
3916
|
+
const extensions = executableExtensions(command, platform, input2.environment);
|
|
3917
|
+
for (const directory of pathDirectories(input2.environment, platform)) {
|
|
3918
3918
|
for (const extension2 of extensions) {
|
|
3919
3919
|
candidates.push({
|
|
3920
3920
|
candidate: pathFlavor.join(directory, command + extension2),
|
|
@@ -3924,8 +3924,8 @@ function harnessCandidates(spec, input, dependencies = {}) {
|
|
|
3924
3924
|
}
|
|
3925
3925
|
if (configured !== void 0)
|
|
3926
3926
|
return candidates;
|
|
3927
|
-
const home = resolveHomeDirectory(
|
|
3928
|
-
for (const directory of installRootDirectories(spec,
|
|
3927
|
+
const home = resolveHomeDirectory(input2);
|
|
3928
|
+
for (const directory of installRootDirectories(spec, input2, dependencies, platform, home)) {
|
|
3929
3929
|
for (const extension2 of installRootExtensions(platform)) {
|
|
3930
3930
|
candidates.push({
|
|
3931
3931
|
candidate: pathFlavor.join(directory, spec.command + extension2),
|
|
@@ -3935,12 +3935,12 @@ function harnessCandidates(spec, input, dependencies = {}) {
|
|
|
3935
3935
|
}
|
|
3936
3936
|
return candidates;
|
|
3937
3937
|
}
|
|
3938
|
-
function resolveHarnessExecutable(spec,
|
|
3939
|
-
const platform =
|
|
3938
|
+
function resolveHarnessExecutable(spec, input2, dependencies = {}) {
|
|
3939
|
+
const platform = input2.platform ?? process.platform;
|
|
3940
3940
|
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
3941
3941
|
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
3942
3942
|
const context = { platform, isExecutable };
|
|
3943
|
-
for (const { candidate, source } of harnessCandidates(spec,
|
|
3943
|
+
for (const { candidate, source } of harnessCandidates(spec, input2, dependencies)) {
|
|
3944
3944
|
const executable = runnable(candidate, context);
|
|
3945
3945
|
if (executable !== void 0 && isExecutable(executable))
|
|
3946
3946
|
return { executable, source };
|
|
@@ -3951,13 +3951,13 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
|
3951
3951
|
// ../../harness-discovery/dist/installation.js
|
|
3952
3952
|
import { execFile } from "node:child_process";
|
|
3953
3953
|
import { homedir } from "node:os";
|
|
3954
|
-
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
3954
|
+
function runInstallationCommand(command, args, environment, timeout = 3e4, cwd) {
|
|
3955
3955
|
const env = withNodeRuntimeOnPath(environment);
|
|
3956
3956
|
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
3957
3957
|
return new Promise((resolve, reject) => {
|
|
3958
3958
|
const child = execFile(invocation.command, invocation.arguments, {
|
|
3959
3959
|
env,
|
|
3960
|
-
cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
3960
|
+
cwd: cwd ?? env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
3961
3961
|
encoding: "utf8",
|
|
3962
3962
|
timeout,
|
|
3963
3963
|
killSignal: "SIGKILL",
|
|
@@ -4020,7 +4020,7 @@ function createInstallationManager(options) {
|
|
|
4020
4020
|
const check2 = () => checking ??= options.check().finally(() => {
|
|
4021
4021
|
checking = void 0;
|
|
4022
4022
|
});
|
|
4023
|
-
return (action) => {
|
|
4023
|
+
return (action, confirmedVersion) => {
|
|
4024
4024
|
if (updating)
|
|
4025
4025
|
return updating;
|
|
4026
4026
|
if (action === "check")
|
|
@@ -4031,6 +4031,8 @@ function createInstallationManager(options) {
|
|
|
4031
4031
|
return before;
|
|
4032
4032
|
if (!before.canUpdate)
|
|
4033
4033
|
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
4034
|
+
if ((before.latestVerifiedVersion !== void 0 || confirmedVersion !== void 0) && before.latestVersion !== confirmedVersion)
|
|
4035
|
+
return { ...before, confirmationRequired: true };
|
|
4034
4036
|
await options.update(before);
|
|
4035
4037
|
const after = await check2();
|
|
4036
4038
|
if (after.currentVersion === before.currentVersion)
|
|
@@ -4065,8 +4067,8 @@ function referencesNpmBin(shim, name, bin) {
|
|
|
4065
4067
|
if (bin.includes(".."))
|
|
4066
4068
|
return false;
|
|
4067
4069
|
const target2 = `node_modules/${name}/${bin.replace(/^\.\//, "")}`.toLowerCase();
|
|
4068
|
-
const
|
|
4069
|
-
return
|
|
4070
|
+
const text2 = shim.replaceAll("\\", "/").toLowerCase();
|
|
4071
|
+
return text2.includes(`%dp0%/${target2}"`) || text2.includes(`%~dp0/${target2}"`);
|
|
4070
4072
|
}
|
|
4071
4073
|
async function npmInstallation(command, packages, environment) {
|
|
4072
4074
|
let selected = await realpath(command);
|
|
@@ -4075,7 +4077,7 @@ async function npmInstallation(command, packages, environment) {
|
|
|
4075
4077
|
const root = path4.dirname(selected);
|
|
4076
4078
|
for (const name of packages) {
|
|
4077
4079
|
const directory2 = path4.join(root, "node_modules", ...name.split("/"));
|
|
4078
|
-
const metadata = await readFile(path4.join(directory2, "package.json"), "utf8").then((
|
|
4080
|
+
const metadata = await readFile(path4.join(directory2, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
4079
4081
|
const bins = typeof metadata?.bin === "string" ? [metadata.bin] : Object.values(metadata?.bin ?? {});
|
|
4080
4082
|
const bin = bins.find((entry) => referencesNpmBin(shim, name, entry));
|
|
4081
4083
|
if (bin) {
|
|
@@ -4086,7 +4088,7 @@ async function npmInstallation(command, packages, environment) {
|
|
|
4086
4088
|
}
|
|
4087
4089
|
let directory = path4.dirname(selected);
|
|
4088
4090
|
for (let depth = 0; depth < 8; depth++) {
|
|
4089
|
-
const metadata = await readFile(path4.join(directory, "package.json"), "utf8").then((
|
|
4091
|
+
const metadata = await readFile(path4.join(directory, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
4090
4092
|
if (metadata?.name && packages.includes(metadata.name)) {
|
|
4091
4093
|
const name = metadata.name;
|
|
4092
4094
|
const currentVersion = installationVersion(metadata.version);
|
|
@@ -4902,8 +4904,8 @@ function cached(getter) {
|
|
|
4902
4904
|
}
|
|
4903
4905
|
};
|
|
4904
4906
|
}
|
|
4905
|
-
function nullish(
|
|
4906
|
-
return
|
|
4907
|
+
function nullish(input2) {
|
|
4908
|
+
return input2 === null || input2 === void 0;
|
|
4907
4909
|
}
|
|
4908
4910
|
function cleanRegex(source) {
|
|
4909
4911
|
const start = source.startsWith("^") ? 1 : 0;
|
|
@@ -4963,10 +4965,10 @@ function mergeDefs(...defs) {
|
|
|
4963
4965
|
function cloneDef(schema) {
|
|
4964
4966
|
return mergeDefs(schema._zod.def);
|
|
4965
4967
|
}
|
|
4966
|
-
function getElementAtPath(obj,
|
|
4967
|
-
if (!
|
|
4968
|
+
function getElementAtPath(obj, path13) {
|
|
4969
|
+
if (!path13)
|
|
4968
4970
|
return obj;
|
|
4969
|
-
return
|
|
4971
|
+
return path13.reduce((acc, key) => acc?.[key], obj);
|
|
4970
4972
|
}
|
|
4971
4973
|
function promiseAllObject(promisesObj) {
|
|
4972
4974
|
const keys = Object.keys(promisesObj);
|
|
@@ -4990,8 +4992,8 @@ function randomString(length = 10) {
|
|
|
4990
4992
|
function esc(str) {
|
|
4991
4993
|
return JSON.stringify(str);
|
|
4992
4994
|
}
|
|
4993
|
-
function slugify(
|
|
4994
|
-
return
|
|
4995
|
+
function slugify(input2) {
|
|
4996
|
+
return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
4995
4997
|
}
|
|
4996
4998
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
4997
4999
|
};
|
|
@@ -5375,11 +5377,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
5375
5377
|
}
|
|
5376
5378
|
return false;
|
|
5377
5379
|
}
|
|
5378
|
-
function prefixIssues(
|
|
5380
|
+
function prefixIssues(path13, issues) {
|
|
5379
5381
|
return issues.map((iss) => {
|
|
5380
5382
|
var _a3;
|
|
5381
5383
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
5382
|
-
iss.path.unshift(
|
|
5384
|
+
iss.path.unshift(path13);
|
|
5383
5385
|
return iss;
|
|
5384
5386
|
});
|
|
5385
5387
|
}
|
|
@@ -5396,19 +5398,19 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
5396
5398
|
}
|
|
5397
5399
|
return rest;
|
|
5398
5400
|
}
|
|
5399
|
-
function getSizableOrigin(
|
|
5400
|
-
if (
|
|
5401
|
+
function getSizableOrigin(input2) {
|
|
5402
|
+
if (input2 instanceof Set)
|
|
5401
5403
|
return "set";
|
|
5402
|
-
if (
|
|
5404
|
+
if (input2 instanceof Map)
|
|
5403
5405
|
return "map";
|
|
5404
|
-
if (
|
|
5406
|
+
if (input2 instanceof File)
|
|
5405
5407
|
return "file";
|
|
5406
5408
|
return "unknown";
|
|
5407
5409
|
}
|
|
5408
|
-
function getLengthableOrigin(
|
|
5409
|
-
if (Array.isArray(
|
|
5410
|
+
function getLengthableOrigin(input2) {
|
|
5411
|
+
if (Array.isArray(input2))
|
|
5410
5412
|
return "array";
|
|
5411
|
-
if (typeof
|
|
5413
|
+
if (typeof input2 === "string")
|
|
5412
5414
|
return "string";
|
|
5413
5415
|
return "unknown";
|
|
5414
5416
|
}
|
|
@@ -5434,12 +5436,12 @@ function parsedType(data) {
|
|
|
5434
5436
|
return t;
|
|
5435
5437
|
}
|
|
5436
5438
|
function issue(...args) {
|
|
5437
|
-
const [iss,
|
|
5439
|
+
const [iss, input2, inst] = args;
|
|
5438
5440
|
if (typeof iss === "string") {
|
|
5439
5441
|
return {
|
|
5440
5442
|
message: iss,
|
|
5441
5443
|
code: "custom",
|
|
5442
|
-
input,
|
|
5444
|
+
input: input2,
|
|
5443
5445
|
inst
|
|
5444
5446
|
};
|
|
5445
5447
|
}
|
|
@@ -5526,16 +5528,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5526
5528
|
}
|
|
5527
5529
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
5528
5530
|
const fieldErrors = { _errors: [] };
|
|
5529
|
-
const processError = (error52,
|
|
5531
|
+
const processError = (error52, path13 = []) => {
|
|
5530
5532
|
for (const issue2 of error52.issues) {
|
|
5531
5533
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5532
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5534
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
5533
5535
|
} else if (issue2.code === "invalid_key") {
|
|
5534
|
-
processError({ issues: issue2.issues }, [...
|
|
5536
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
5535
5537
|
} else if (issue2.code === "invalid_element") {
|
|
5536
|
-
processError({ issues: issue2.issues }, [...
|
|
5538
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
5537
5539
|
} else {
|
|
5538
|
-
const fullpath = [...
|
|
5540
|
+
const fullpath = [...path13, ...issue2.path];
|
|
5539
5541
|
if (fullpath.length === 0) {
|
|
5540
5542
|
fieldErrors._errors.push(mapper(issue2));
|
|
5541
5543
|
} else {
|
|
@@ -5562,17 +5564,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5562
5564
|
}
|
|
5563
5565
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
5564
5566
|
const result = { errors: [] };
|
|
5565
|
-
const processError = (error52,
|
|
5567
|
+
const processError = (error52, path13 = []) => {
|
|
5566
5568
|
var _a3, _b;
|
|
5567
5569
|
for (const issue2 of error52.issues) {
|
|
5568
5570
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5569
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5571
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
5570
5572
|
} else if (issue2.code === "invalid_key") {
|
|
5571
|
-
processError({ issues: issue2.issues }, [...
|
|
5573
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
5572
5574
|
} else if (issue2.code === "invalid_element") {
|
|
5573
|
-
processError({ issues: issue2.issues }, [...
|
|
5575
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
5574
5576
|
} else {
|
|
5575
|
-
const fullpath = [...
|
|
5577
|
+
const fullpath = [...path13, ...issue2.path];
|
|
5576
5578
|
if (fullpath.length === 0) {
|
|
5577
5579
|
result.errors.push(mapper(issue2));
|
|
5578
5580
|
continue;
|
|
@@ -5604,8 +5606,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5604
5606
|
}
|
|
5605
5607
|
function toDotPath(_path) {
|
|
5606
5608
|
const segs = [];
|
|
5607
|
-
const
|
|
5608
|
-
for (const seg of
|
|
5609
|
+
const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
5610
|
+
for (const seg of path13) {
|
|
5609
5611
|
if (typeof seg === "number")
|
|
5610
5612
|
segs.push(`[${seg}]`);
|
|
5611
5613
|
else if (typeof seg === "symbol")
|
|
@@ -5983,23 +5985,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
5983
5985
|
bag.pattern = integer;
|
|
5984
5986
|
});
|
|
5985
5987
|
inst._zod.check = (payload) => {
|
|
5986
|
-
const
|
|
5988
|
+
const input2 = payload.value;
|
|
5987
5989
|
if (isInt) {
|
|
5988
|
-
if (!Number.isInteger(
|
|
5990
|
+
if (!Number.isInteger(input2)) {
|
|
5989
5991
|
payload.issues.push({
|
|
5990
5992
|
expected: origin,
|
|
5991
5993
|
format: def.format,
|
|
5992
5994
|
code: "invalid_type",
|
|
5993
5995
|
continue: false,
|
|
5994
|
-
input,
|
|
5996
|
+
input: input2,
|
|
5995
5997
|
inst
|
|
5996
5998
|
});
|
|
5997
5999
|
return;
|
|
5998
6000
|
}
|
|
5999
|
-
if (!Number.isSafeInteger(
|
|
6000
|
-
if (
|
|
6001
|
+
if (!Number.isSafeInteger(input2)) {
|
|
6002
|
+
if (input2 > 0) {
|
|
6001
6003
|
payload.issues.push({
|
|
6002
|
-
input,
|
|
6004
|
+
input: input2,
|
|
6003
6005
|
code: "too_big",
|
|
6004
6006
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
6005
6007
|
note: "Integers must be within the safe integer range.",
|
|
@@ -6010,7 +6012,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
6010
6012
|
});
|
|
6011
6013
|
} else {
|
|
6012
6014
|
payload.issues.push({
|
|
6013
|
-
input,
|
|
6015
|
+
input: input2,
|
|
6014
6016
|
code: "too_small",
|
|
6015
6017
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
6016
6018
|
note: "Integers must be within the safe integer range.",
|
|
@@ -6023,10 +6025,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
6023
6025
|
return;
|
|
6024
6026
|
}
|
|
6025
6027
|
}
|
|
6026
|
-
if (
|
|
6028
|
+
if (input2 < minimum) {
|
|
6027
6029
|
payload.issues.push({
|
|
6028
6030
|
origin: "number",
|
|
6029
|
-
input,
|
|
6031
|
+
input: input2,
|
|
6030
6032
|
code: "too_small",
|
|
6031
6033
|
minimum,
|
|
6032
6034
|
inclusive: true,
|
|
@@ -6034,10 +6036,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
6034
6036
|
continue: !def.abort
|
|
6035
6037
|
});
|
|
6036
6038
|
}
|
|
6037
|
-
if (
|
|
6039
|
+
if (input2 > maximum) {
|
|
6038
6040
|
payload.issues.push({
|
|
6039
6041
|
origin: "number",
|
|
6040
|
-
input,
|
|
6042
|
+
input: input2,
|
|
6041
6043
|
code: "too_big",
|
|
6042
6044
|
maximum,
|
|
6043
6045
|
inclusive: true,
|
|
@@ -6057,11 +6059,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
6057
6059
|
bag.maximum = maximum;
|
|
6058
6060
|
});
|
|
6059
6061
|
inst._zod.check = (payload) => {
|
|
6060
|
-
const
|
|
6061
|
-
if (
|
|
6062
|
+
const input2 = payload.value;
|
|
6063
|
+
if (input2 < minimum) {
|
|
6062
6064
|
payload.issues.push({
|
|
6063
6065
|
origin: "bigint",
|
|
6064
|
-
input,
|
|
6066
|
+
input: input2,
|
|
6065
6067
|
code: "too_small",
|
|
6066
6068
|
minimum,
|
|
6067
6069
|
inclusive: true,
|
|
@@ -6069,10 +6071,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
6069
6071
|
continue: !def.abort
|
|
6070
6072
|
});
|
|
6071
6073
|
}
|
|
6072
|
-
if (
|
|
6074
|
+
if (input2 > maximum) {
|
|
6073
6075
|
payload.issues.push({
|
|
6074
6076
|
origin: "bigint",
|
|
6075
|
-
input,
|
|
6077
|
+
input: input2,
|
|
6076
6078
|
code: "too_big",
|
|
6077
6079
|
maximum,
|
|
6078
6080
|
inclusive: true,
|
|
@@ -6095,16 +6097,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
6095
6097
|
inst2._zod.bag.maximum = def.maximum;
|
|
6096
6098
|
});
|
|
6097
6099
|
inst._zod.check = (payload) => {
|
|
6098
|
-
const
|
|
6099
|
-
const size =
|
|
6100
|
+
const input2 = payload.value;
|
|
6101
|
+
const size = input2.size;
|
|
6100
6102
|
if (size <= def.maximum)
|
|
6101
6103
|
return;
|
|
6102
6104
|
payload.issues.push({
|
|
6103
|
-
origin: getSizableOrigin(
|
|
6105
|
+
origin: getSizableOrigin(input2),
|
|
6104
6106
|
code: "too_big",
|
|
6105
6107
|
maximum: def.maximum,
|
|
6106
6108
|
inclusive: true,
|
|
6107
|
-
input,
|
|
6109
|
+
input: input2,
|
|
6108
6110
|
inst,
|
|
6109
6111
|
continue: !def.abort
|
|
6110
6112
|
});
|
|
@@ -6123,16 +6125,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
6123
6125
|
inst2._zod.bag.minimum = def.minimum;
|
|
6124
6126
|
});
|
|
6125
6127
|
inst._zod.check = (payload) => {
|
|
6126
|
-
const
|
|
6127
|
-
const size =
|
|
6128
|
+
const input2 = payload.value;
|
|
6129
|
+
const size = input2.size;
|
|
6128
6130
|
if (size >= def.minimum)
|
|
6129
6131
|
return;
|
|
6130
6132
|
payload.issues.push({
|
|
6131
|
-
origin: getSizableOrigin(
|
|
6133
|
+
origin: getSizableOrigin(input2),
|
|
6132
6134
|
code: "too_small",
|
|
6133
6135
|
minimum: def.minimum,
|
|
6134
6136
|
inclusive: true,
|
|
6135
|
-
input,
|
|
6137
|
+
input: input2,
|
|
6136
6138
|
inst,
|
|
6137
6139
|
continue: !def.abort
|
|
6138
6140
|
});
|
|
@@ -6152,13 +6154,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
6152
6154
|
bag.size = def.size;
|
|
6153
6155
|
});
|
|
6154
6156
|
inst._zod.check = (payload) => {
|
|
6155
|
-
const
|
|
6156
|
-
const size =
|
|
6157
|
+
const input2 = payload.value;
|
|
6158
|
+
const size = input2.size;
|
|
6157
6159
|
if (size === def.size)
|
|
6158
6160
|
return;
|
|
6159
6161
|
const tooBig = size > def.size;
|
|
6160
6162
|
payload.issues.push({
|
|
6161
|
-
origin: getSizableOrigin(
|
|
6163
|
+
origin: getSizableOrigin(input2),
|
|
6162
6164
|
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
6163
6165
|
inclusive: true,
|
|
6164
6166
|
exact: true,
|
|
@@ -6181,17 +6183,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
6181
6183
|
inst2._zod.bag.maximum = def.maximum;
|
|
6182
6184
|
});
|
|
6183
6185
|
inst._zod.check = (payload) => {
|
|
6184
|
-
const
|
|
6185
|
-
const length =
|
|
6186
|
+
const input2 = payload.value;
|
|
6187
|
+
const length = input2.length;
|
|
6186
6188
|
if (length <= def.maximum)
|
|
6187
6189
|
return;
|
|
6188
|
-
const origin = getLengthableOrigin(
|
|
6190
|
+
const origin = getLengthableOrigin(input2);
|
|
6189
6191
|
payload.issues.push({
|
|
6190
6192
|
origin,
|
|
6191
6193
|
code: "too_big",
|
|
6192
6194
|
maximum: def.maximum,
|
|
6193
6195
|
inclusive: true,
|
|
6194
|
-
input,
|
|
6196
|
+
input: input2,
|
|
6195
6197
|
inst,
|
|
6196
6198
|
continue: !def.abort
|
|
6197
6199
|
});
|
|
@@ -6210,17 +6212,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
6210
6212
|
inst2._zod.bag.minimum = def.minimum;
|
|
6211
6213
|
});
|
|
6212
6214
|
inst._zod.check = (payload) => {
|
|
6213
|
-
const
|
|
6214
|
-
const length =
|
|
6215
|
+
const input2 = payload.value;
|
|
6216
|
+
const length = input2.length;
|
|
6215
6217
|
if (length >= def.minimum)
|
|
6216
6218
|
return;
|
|
6217
|
-
const origin = getLengthableOrigin(
|
|
6219
|
+
const origin = getLengthableOrigin(input2);
|
|
6218
6220
|
payload.issues.push({
|
|
6219
6221
|
origin,
|
|
6220
6222
|
code: "too_small",
|
|
6221
6223
|
minimum: def.minimum,
|
|
6222
6224
|
inclusive: true,
|
|
6223
|
-
input,
|
|
6225
|
+
input: input2,
|
|
6224
6226
|
inst,
|
|
6225
6227
|
continue: !def.abort
|
|
6226
6228
|
});
|
|
@@ -6240,11 +6242,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
6240
6242
|
bag.length = def.length;
|
|
6241
6243
|
});
|
|
6242
6244
|
inst._zod.check = (payload) => {
|
|
6243
|
-
const
|
|
6244
|
-
const length =
|
|
6245
|
+
const input2 = payload.value;
|
|
6246
|
+
const length = input2.length;
|
|
6245
6247
|
if (length === def.length)
|
|
6246
6248
|
return;
|
|
6247
|
-
const origin = getLengthableOrigin(
|
|
6249
|
+
const origin = getLengthableOrigin(input2);
|
|
6248
6250
|
const tooBig = length > def.length;
|
|
6249
6251
|
payload.issues.push({
|
|
6250
6252
|
origin,
|
|
@@ -6915,15 +6917,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
6915
6917
|
payload.value = Number(payload.value);
|
|
6916
6918
|
} catch (_) {
|
|
6917
6919
|
}
|
|
6918
|
-
const
|
|
6919
|
-
if (typeof
|
|
6920
|
+
const input2 = payload.value;
|
|
6921
|
+
if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
|
|
6920
6922
|
return payload;
|
|
6921
6923
|
}
|
|
6922
|
-
const received = typeof
|
|
6924
|
+
const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
|
|
6923
6925
|
payload.issues.push({
|
|
6924
6926
|
expected: "number",
|
|
6925
6927
|
code: "invalid_type",
|
|
6926
|
-
input,
|
|
6928
|
+
input: input2,
|
|
6927
6929
|
inst,
|
|
6928
6930
|
...received ? { received } : {}
|
|
6929
6931
|
});
|
|
@@ -6943,13 +6945,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
6943
6945
|
payload.value = Boolean(payload.value);
|
|
6944
6946
|
} catch (_) {
|
|
6945
6947
|
}
|
|
6946
|
-
const
|
|
6947
|
-
if (typeof
|
|
6948
|
+
const input2 = payload.value;
|
|
6949
|
+
if (typeof input2 === "boolean")
|
|
6948
6950
|
return payload;
|
|
6949
6951
|
payload.issues.push({
|
|
6950
6952
|
expected: "boolean",
|
|
6951
6953
|
code: "invalid_type",
|
|
6952
|
-
input,
|
|
6954
|
+
input: input2,
|
|
6953
6955
|
inst
|
|
6954
6956
|
});
|
|
6955
6957
|
return payload;
|
|
@@ -6982,13 +6984,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
|
|
|
6982
6984
|
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
|
|
6983
6985
|
$ZodType.init(inst, def);
|
|
6984
6986
|
inst._zod.parse = (payload, _ctx) => {
|
|
6985
|
-
const
|
|
6986
|
-
if (typeof
|
|
6987
|
+
const input2 = payload.value;
|
|
6988
|
+
if (typeof input2 === "symbol")
|
|
6987
6989
|
return payload;
|
|
6988
6990
|
payload.issues.push({
|
|
6989
6991
|
expected: "symbol",
|
|
6990
6992
|
code: "invalid_type",
|
|
6991
|
-
input,
|
|
6993
|
+
input: input2,
|
|
6992
6994
|
inst
|
|
6993
6995
|
});
|
|
6994
6996
|
return payload;
|
|
@@ -6999,13 +7001,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
|
|
|
6999
7001
|
inst._zod.pattern = _undefined;
|
|
7000
7002
|
inst._zod.values = /* @__PURE__ */ new Set([void 0]);
|
|
7001
7003
|
inst._zod.parse = (payload, _ctx) => {
|
|
7002
|
-
const
|
|
7003
|
-
if (typeof
|
|
7004
|
+
const input2 = payload.value;
|
|
7005
|
+
if (typeof input2 === "undefined")
|
|
7004
7006
|
return payload;
|
|
7005
7007
|
payload.issues.push({
|
|
7006
7008
|
expected: "undefined",
|
|
7007
7009
|
code: "invalid_type",
|
|
7008
|
-
input,
|
|
7010
|
+
input: input2,
|
|
7009
7011
|
inst
|
|
7010
7012
|
});
|
|
7011
7013
|
return payload;
|
|
@@ -7016,13 +7018,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
|
7016
7018
|
inst._zod.pattern = _null;
|
|
7017
7019
|
inst._zod.values = /* @__PURE__ */ new Set([null]);
|
|
7018
7020
|
inst._zod.parse = (payload, _ctx) => {
|
|
7019
|
-
const
|
|
7020
|
-
if (
|
|
7021
|
+
const input2 = payload.value;
|
|
7022
|
+
if (input2 === null)
|
|
7021
7023
|
return payload;
|
|
7022
7024
|
payload.issues.push({
|
|
7023
7025
|
expected: "null",
|
|
7024
7026
|
code: "invalid_type",
|
|
7025
|
-
input,
|
|
7027
|
+
input: input2,
|
|
7026
7028
|
inst
|
|
7027
7029
|
});
|
|
7028
7030
|
return payload;
|
|
@@ -7051,13 +7053,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
7051
7053
|
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
|
|
7052
7054
|
$ZodType.init(inst, def);
|
|
7053
7055
|
inst._zod.parse = (payload, _ctx) => {
|
|
7054
|
-
const
|
|
7055
|
-
if (typeof
|
|
7056
|
+
const input2 = payload.value;
|
|
7057
|
+
if (typeof input2 === "undefined")
|
|
7056
7058
|
return payload;
|
|
7057
7059
|
payload.issues.push({
|
|
7058
7060
|
expected: "void",
|
|
7059
7061
|
code: "invalid_type",
|
|
7060
|
-
input,
|
|
7062
|
+
input: input2,
|
|
7061
7063
|
inst
|
|
7062
7064
|
});
|
|
7063
7065
|
return payload;
|
|
@@ -7072,15 +7074,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
7072
7074
|
} catch (_err) {
|
|
7073
7075
|
}
|
|
7074
7076
|
}
|
|
7075
|
-
const
|
|
7076
|
-
const isDate =
|
|
7077
|
-
const isValidDate = isDate && !Number.isNaN(
|
|
7077
|
+
const input2 = payload.value;
|
|
7078
|
+
const isDate = input2 instanceof Date;
|
|
7079
|
+
const isValidDate = isDate && !Number.isNaN(input2.getTime());
|
|
7078
7080
|
if (isValidDate)
|
|
7079
7081
|
return payload;
|
|
7080
7082
|
payload.issues.push({
|
|
7081
7083
|
expected: "date",
|
|
7082
7084
|
code: "invalid_type",
|
|
7083
|
-
input,
|
|
7085
|
+
input: input2,
|
|
7084
7086
|
...isDate ? { received: "Invalid Date" } : {},
|
|
7085
7087
|
inst
|
|
7086
7088
|
});
|
|
@@ -7096,20 +7098,20 @@ function handleArrayResult(result, final, index) {
|
|
|
7096
7098
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
7097
7099
|
$ZodType.init(inst, def);
|
|
7098
7100
|
inst._zod.parse = (payload, ctx) => {
|
|
7099
|
-
const
|
|
7100
|
-
if (!Array.isArray(
|
|
7101
|
+
const input2 = payload.value;
|
|
7102
|
+
if (!Array.isArray(input2)) {
|
|
7101
7103
|
payload.issues.push({
|
|
7102
7104
|
expected: "array",
|
|
7103
7105
|
code: "invalid_type",
|
|
7104
|
-
input,
|
|
7106
|
+
input: input2,
|
|
7105
7107
|
inst
|
|
7106
7108
|
});
|
|
7107
7109
|
return payload;
|
|
7108
7110
|
}
|
|
7109
|
-
payload.value = Array(
|
|
7111
|
+
payload.value = Array(input2.length);
|
|
7110
7112
|
const proms = [];
|
|
7111
|
-
for (let i = 0; i <
|
|
7112
|
-
const item =
|
|
7113
|
+
for (let i = 0; i < input2.length; i++) {
|
|
7114
|
+
const item = input2[i];
|
|
7113
7115
|
const result = def.element._zod.run({
|
|
7114
7116
|
value: item,
|
|
7115
7117
|
issues: []
|
|
@@ -7126,8 +7128,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
7126
7128
|
return payload;
|
|
7127
7129
|
};
|
|
7128
7130
|
});
|
|
7129
|
-
function handlePropertyResult(result, final, key,
|
|
7130
|
-
const isPresent = key in
|
|
7131
|
+
function handlePropertyResult(result, final, key, input2, isOptionalIn, isOptionalOut) {
|
|
7132
|
+
const isPresent = key in input2;
|
|
7131
7133
|
if (result.issues.length) {
|
|
7132
7134
|
if (isOptionalIn && isOptionalOut && !isPresent) {
|
|
7133
7135
|
return;
|
|
@@ -7169,14 +7171,14 @@ function normalizeDef(def) {
|
|
|
7169
7171
|
optionalKeys: new Set(okeys)
|
|
7170
7172
|
};
|
|
7171
7173
|
}
|
|
7172
|
-
function handleCatchall(proms,
|
|
7174
|
+
function handleCatchall(proms, input2, payload, ctx, def, inst) {
|
|
7173
7175
|
const unrecognized = [];
|
|
7174
7176
|
const keySet = def.keySet;
|
|
7175
7177
|
const _catchall = def.catchall._zod;
|
|
7176
7178
|
const t = _catchall.def.type;
|
|
7177
7179
|
const isOptionalIn = _catchall.optin === "optional";
|
|
7178
7180
|
const isOptionalOut = _catchall.optout === "optional";
|
|
7179
|
-
for (const key in
|
|
7181
|
+
for (const key in input2) {
|
|
7180
7182
|
if (key === "__proto__")
|
|
7181
7183
|
continue;
|
|
7182
7184
|
if (keySet.has(key))
|
|
@@ -7185,18 +7187,18 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
7185
7187
|
unrecognized.push(key);
|
|
7186
7188
|
continue;
|
|
7187
7189
|
}
|
|
7188
|
-
const r = _catchall.run({ value:
|
|
7190
|
+
const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
|
|
7189
7191
|
if (r instanceof Promise) {
|
|
7190
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
7192
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
|
|
7191
7193
|
} else {
|
|
7192
|
-
handlePropertyResult(r, payload, key,
|
|
7194
|
+
handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
|
|
7193
7195
|
}
|
|
7194
7196
|
}
|
|
7195
7197
|
if (unrecognized.length) {
|
|
7196
7198
|
payload.issues.push({
|
|
7197
7199
|
code: "unrecognized_keys",
|
|
7198
7200
|
keys: unrecognized,
|
|
7199
|
-
input,
|
|
7201
|
+
input: input2,
|
|
7200
7202
|
inst
|
|
7201
7203
|
});
|
|
7202
7204
|
}
|
|
@@ -7240,12 +7242,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
7240
7242
|
let value;
|
|
7241
7243
|
inst._zod.parse = (payload, ctx) => {
|
|
7242
7244
|
value ?? (value = _normalized.value);
|
|
7243
|
-
const
|
|
7244
|
-
if (!isObject2(
|
|
7245
|
+
const input2 = payload.value;
|
|
7246
|
+
if (!isObject2(input2)) {
|
|
7245
7247
|
payload.issues.push({
|
|
7246
7248
|
expected: "object",
|
|
7247
7249
|
code: "invalid_type",
|
|
7248
|
-
input,
|
|
7250
|
+
input: input2,
|
|
7249
7251
|
inst
|
|
7250
7252
|
});
|
|
7251
7253
|
return payload;
|
|
@@ -7257,17 +7259,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
7257
7259
|
const el = shape[key];
|
|
7258
7260
|
const isOptionalIn = el._zod.optin === "optional";
|
|
7259
7261
|
const isOptionalOut = el._zod.optout === "optional";
|
|
7260
|
-
const r = el._zod.run({ value:
|
|
7262
|
+
const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
7261
7263
|
if (r instanceof Promise) {
|
|
7262
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
7264
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalIn, isOptionalOut)));
|
|
7263
7265
|
} else {
|
|
7264
|
-
handlePropertyResult(r, payload, key,
|
|
7266
|
+
handlePropertyResult(r, payload, key, input2, isOptionalIn, isOptionalOut);
|
|
7265
7267
|
}
|
|
7266
7268
|
}
|
|
7267
7269
|
if (!catchall) {
|
|
7268
7270
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
7269
7271
|
}
|
|
7270
|
-
return handleCatchall(proms,
|
|
7272
|
+
return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
|
|
7271
7273
|
};
|
|
7272
7274
|
});
|
|
7273
7275
|
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -7376,12 +7378,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7376
7378
|
let value;
|
|
7377
7379
|
inst._zod.parse = (payload, ctx) => {
|
|
7378
7380
|
value ?? (value = _normalized.value);
|
|
7379
|
-
const
|
|
7380
|
-
if (!isObject2(
|
|
7381
|
+
const input2 = payload.value;
|
|
7382
|
+
if (!isObject2(input2)) {
|
|
7381
7383
|
payload.issues.push({
|
|
7382
7384
|
expected: "object",
|
|
7383
7385
|
code: "invalid_type",
|
|
7384
|
-
input,
|
|
7386
|
+
input: input2,
|
|
7385
7387
|
inst
|
|
7386
7388
|
});
|
|
7387
7389
|
return payload;
|
|
@@ -7392,7 +7394,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7392
7394
|
payload = fastpass(payload, ctx);
|
|
7393
7395
|
if (!catchall)
|
|
7394
7396
|
return payload;
|
|
7395
|
-
return handleCatchall([],
|
|
7397
|
+
return handleCatchall([], input2, payload, ctx, value, inst);
|
|
7396
7398
|
}
|
|
7397
7399
|
return superParse(payload, ctx);
|
|
7398
7400
|
};
|
|
@@ -7552,17 +7554,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
7552
7554
|
return map2;
|
|
7553
7555
|
});
|
|
7554
7556
|
inst._zod.parse = (payload, ctx) => {
|
|
7555
|
-
const
|
|
7556
|
-
if (!isObject(
|
|
7557
|
+
const input2 = payload.value;
|
|
7558
|
+
if (!isObject(input2)) {
|
|
7557
7559
|
payload.issues.push({
|
|
7558
7560
|
code: "invalid_type",
|
|
7559
7561
|
expected: "object",
|
|
7560
|
-
input,
|
|
7562
|
+
input: input2,
|
|
7561
7563
|
inst
|
|
7562
7564
|
});
|
|
7563
7565
|
return payload;
|
|
7564
7566
|
}
|
|
7565
|
-
const opt = disc.value.get(
|
|
7567
|
+
const opt = disc.value.get(input2?.[def.discriminator]);
|
|
7566
7568
|
if (opt) {
|
|
7567
7569
|
return opt._zod.run(payload, ctx);
|
|
7568
7570
|
}
|
|
@@ -7575,7 +7577,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
7575
7577
|
note: "No matching discriminator",
|
|
7576
7578
|
discriminator: def.discriminator,
|
|
7577
7579
|
options: Array.from(disc.value.keys()),
|
|
7578
|
-
input,
|
|
7580
|
+
input: input2,
|
|
7579
7581
|
path: [def.discriminator],
|
|
7580
7582
|
inst
|
|
7581
7583
|
});
|
|
@@ -7585,9 +7587,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
7585
7587
|
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
7586
7588
|
$ZodType.init(inst, def);
|
|
7587
7589
|
inst._zod.parse = (payload, ctx) => {
|
|
7588
|
-
const
|
|
7589
|
-
const left = def.left._zod.run({ value:
|
|
7590
|
-
const right = def.right._zod.run({ value:
|
|
7590
|
+
const input2 = payload.value;
|
|
7591
|
+
const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
|
|
7592
|
+
const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
|
|
7591
7593
|
const async = left instanceof Promise || right instanceof Promise;
|
|
7592
7594
|
if (async) {
|
|
7593
7595
|
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
@@ -7684,10 +7686,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7684
7686
|
$ZodType.init(inst, def);
|
|
7685
7687
|
const items = def.items;
|
|
7686
7688
|
inst._zod.parse = (payload, ctx) => {
|
|
7687
|
-
const
|
|
7688
|
-
if (!Array.isArray(
|
|
7689
|
+
const input2 = payload.value;
|
|
7690
|
+
if (!Array.isArray(input2)) {
|
|
7689
7691
|
payload.issues.push({
|
|
7690
|
-
input,
|
|
7692
|
+
input: input2,
|
|
7691
7693
|
inst,
|
|
7692
7694
|
expected: "tuple",
|
|
7693
7695
|
code: "invalid_type"
|
|
@@ -7699,23 +7701,23 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7699
7701
|
const optinStart = getTupleOptStart(items, "optin");
|
|
7700
7702
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
7701
7703
|
if (!def.rest) {
|
|
7702
|
-
if (
|
|
7704
|
+
if (input2.length < optinStart) {
|
|
7703
7705
|
payload.issues.push({
|
|
7704
7706
|
code: "too_small",
|
|
7705
7707
|
minimum: optinStart,
|
|
7706
7708
|
inclusive: true,
|
|
7707
|
-
input,
|
|
7709
|
+
input: input2,
|
|
7708
7710
|
inst,
|
|
7709
7711
|
origin: "array"
|
|
7710
7712
|
});
|
|
7711
7713
|
return payload;
|
|
7712
7714
|
}
|
|
7713
|
-
if (
|
|
7715
|
+
if (input2.length > items.length) {
|
|
7714
7716
|
payload.issues.push({
|
|
7715
7717
|
code: "too_big",
|
|
7716
7718
|
maximum: items.length,
|
|
7717
7719
|
inclusive: true,
|
|
7718
|
-
input,
|
|
7720
|
+
input: input2,
|
|
7719
7721
|
inst,
|
|
7720
7722
|
origin: "array"
|
|
7721
7723
|
});
|
|
@@ -7723,7 +7725,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7723
7725
|
}
|
|
7724
7726
|
const itemResults = new Array(items.length);
|
|
7725
7727
|
for (let i = 0; i < items.length; i++) {
|
|
7726
|
-
const r = items[i]._zod.run({ value:
|
|
7728
|
+
const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx);
|
|
7727
7729
|
if (r instanceof Promise) {
|
|
7728
7730
|
proms.push(r.then((rr) => {
|
|
7729
7731
|
itemResults[i] = rr;
|
|
@@ -7734,7 +7736,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7734
7736
|
}
|
|
7735
7737
|
if (def.rest) {
|
|
7736
7738
|
let i = items.length - 1;
|
|
7737
|
-
const rest =
|
|
7739
|
+
const rest = input2.slice(items.length);
|
|
7738
7740
|
for (const el of rest) {
|
|
7739
7741
|
i++;
|
|
7740
7742
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
@@ -7746,9 +7748,9 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7746
7748
|
}
|
|
7747
7749
|
}
|
|
7748
7750
|
if (proms.length) {
|
|
7749
|
-
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items,
|
|
7751
|
+
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart));
|
|
7750
7752
|
}
|
|
7751
|
-
return handleTupleResults(itemResults, payload, items,
|
|
7753
|
+
return handleTupleResults(itemResults, payload, items, input2, optoutStart);
|
|
7752
7754
|
};
|
|
7753
7755
|
});
|
|
7754
7756
|
function getTupleOptStart(items, key) {
|
|
@@ -7764,10 +7766,10 @@ function handleTupleResult(result, final, index) {
|
|
|
7764
7766
|
}
|
|
7765
7767
|
final.value[index] = result.value;
|
|
7766
7768
|
}
|
|
7767
|
-
function handleTupleResults(itemResults, final, items,
|
|
7769
|
+
function handleTupleResults(itemResults, final, items, input2, optoutStart) {
|
|
7768
7770
|
for (let i = 0; i < items.length; i++) {
|
|
7769
7771
|
const r = itemResults[i];
|
|
7770
|
-
const isPresent = i <
|
|
7772
|
+
const isPresent = i < input2.length;
|
|
7771
7773
|
if (r.issues.length) {
|
|
7772
7774
|
if (!isPresent && i >= optoutStart) {
|
|
7773
7775
|
final.value.length = i;
|
|
@@ -7777,7 +7779,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
7777
7779
|
}
|
|
7778
7780
|
final.value[i] = r.value;
|
|
7779
7781
|
}
|
|
7780
|
-
for (let i = final.value.length - 1; i >=
|
|
7782
|
+
for (let i = final.value.length - 1; i >= input2.length; i--) {
|
|
7781
7783
|
if (items[i]._zod.optout === "optional" && final.value[i] === void 0) {
|
|
7782
7784
|
final.value.length = i;
|
|
7783
7785
|
} else {
|
|
@@ -7789,12 +7791,12 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
7789
7791
|
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
7790
7792
|
$ZodType.init(inst, def);
|
|
7791
7793
|
inst._zod.parse = (payload, ctx) => {
|
|
7792
|
-
const
|
|
7793
|
-
if (!isPlainObject(
|
|
7794
|
+
const input2 = payload.value;
|
|
7795
|
+
if (!isPlainObject(input2)) {
|
|
7794
7796
|
payload.issues.push({
|
|
7795
7797
|
expected: "record",
|
|
7796
7798
|
code: "invalid_type",
|
|
7797
|
-
input,
|
|
7799
|
+
input: input2,
|
|
7798
7800
|
inst
|
|
7799
7801
|
});
|
|
7800
7802
|
return payload;
|
|
@@ -7823,7 +7825,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7823
7825
|
continue;
|
|
7824
7826
|
}
|
|
7825
7827
|
const outKey = keyResult.value;
|
|
7826
|
-
const result = def.valueType._zod.run({ value:
|
|
7828
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
7827
7829
|
if (result instanceof Promise) {
|
|
7828
7830
|
proms.push(result.then((result2) => {
|
|
7829
7831
|
if (result2.issues.length) {
|
|
@@ -7840,7 +7842,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7840
7842
|
}
|
|
7841
7843
|
}
|
|
7842
7844
|
let unrecognized;
|
|
7843
|
-
for (const key in
|
|
7845
|
+
for (const key in input2) {
|
|
7844
7846
|
if (!recordKeys.has(key)) {
|
|
7845
7847
|
unrecognized = unrecognized ?? [];
|
|
7846
7848
|
unrecognized.push(key);
|
|
@@ -7849,17 +7851,17 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7849
7851
|
if (unrecognized && unrecognized.length > 0) {
|
|
7850
7852
|
payload.issues.push({
|
|
7851
7853
|
code: "unrecognized_keys",
|
|
7852
|
-
input,
|
|
7854
|
+
input: input2,
|
|
7853
7855
|
inst,
|
|
7854
7856
|
keys: unrecognized
|
|
7855
7857
|
});
|
|
7856
7858
|
}
|
|
7857
7859
|
} else {
|
|
7858
7860
|
payload.value = {};
|
|
7859
|
-
for (const key of Reflect.ownKeys(
|
|
7861
|
+
for (const key of Reflect.ownKeys(input2)) {
|
|
7860
7862
|
if (key === "__proto__")
|
|
7861
7863
|
continue;
|
|
7862
|
-
if (!Object.prototype.propertyIsEnumerable.call(
|
|
7864
|
+
if (!Object.prototype.propertyIsEnumerable.call(input2, key))
|
|
7863
7865
|
continue;
|
|
7864
7866
|
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
7865
7867
|
if (keyResult instanceof Promise) {
|
|
@@ -7877,7 +7879,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7877
7879
|
}
|
|
7878
7880
|
if (keyResult.issues.length) {
|
|
7879
7881
|
if (def.mode === "loose") {
|
|
7880
|
-
payload.value[key] =
|
|
7882
|
+
payload.value[key] = input2[key];
|
|
7881
7883
|
} else {
|
|
7882
7884
|
payload.issues.push({
|
|
7883
7885
|
code: "invalid_key",
|
|
@@ -7890,7 +7892,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7890
7892
|
}
|
|
7891
7893
|
continue;
|
|
7892
7894
|
}
|
|
7893
|
-
const result = def.valueType._zod.run({ value:
|
|
7895
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
7894
7896
|
if (result instanceof Promise) {
|
|
7895
7897
|
proms.push(result.then((result2) => {
|
|
7896
7898
|
if (result2.issues.length) {
|
|
@@ -7915,27 +7917,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7915
7917
|
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
7916
7918
|
$ZodType.init(inst, def);
|
|
7917
7919
|
inst._zod.parse = (payload, ctx) => {
|
|
7918
|
-
const
|
|
7919
|
-
if (!(
|
|
7920
|
+
const input2 = payload.value;
|
|
7921
|
+
if (!(input2 instanceof Map)) {
|
|
7920
7922
|
payload.issues.push({
|
|
7921
7923
|
expected: "map",
|
|
7922
7924
|
code: "invalid_type",
|
|
7923
|
-
input,
|
|
7925
|
+
input: input2,
|
|
7924
7926
|
inst
|
|
7925
7927
|
});
|
|
7926
7928
|
return payload;
|
|
7927
7929
|
}
|
|
7928
7930
|
const proms = [];
|
|
7929
7931
|
payload.value = /* @__PURE__ */ new Map();
|
|
7930
|
-
for (const [key, value] of
|
|
7932
|
+
for (const [key, value] of input2) {
|
|
7931
7933
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
7932
7934
|
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
7933
7935
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
7934
7936
|
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
7935
|
-
handleMapResult(keyResult2, valueResult2, payload, key,
|
|
7937
|
+
handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
|
|
7936
7938
|
}));
|
|
7937
7939
|
} else {
|
|
7938
|
-
handleMapResult(keyResult, valueResult, payload, key,
|
|
7940
|
+
handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
|
|
7939
7941
|
}
|
|
7940
7942
|
}
|
|
7941
7943
|
if (proms.length)
|
|
@@ -7943,7 +7945,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
7943
7945
|
return payload;
|
|
7944
7946
|
};
|
|
7945
7947
|
});
|
|
7946
|
-
function handleMapResult(keyResult, valueResult, final, key,
|
|
7948
|
+
function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
|
|
7947
7949
|
if (keyResult.issues.length) {
|
|
7948
7950
|
if (propertyKeyTypes.has(typeof key)) {
|
|
7949
7951
|
final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
@@ -7951,7 +7953,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
7951
7953
|
final.issues.push({
|
|
7952
7954
|
code: "invalid_key",
|
|
7953
7955
|
origin: "map",
|
|
7954
|
-
input,
|
|
7956
|
+
input: input2,
|
|
7955
7957
|
inst,
|
|
7956
7958
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
7957
7959
|
});
|
|
@@ -7964,7 +7966,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
7964
7966
|
final.issues.push({
|
|
7965
7967
|
origin: "map",
|
|
7966
7968
|
code: "invalid_element",
|
|
7967
|
-
input,
|
|
7969
|
+
input: input2,
|
|
7968
7970
|
inst,
|
|
7969
7971
|
key,
|
|
7970
7972
|
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
@@ -7976,10 +7978,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
7976
7978
|
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
7977
7979
|
$ZodType.init(inst, def);
|
|
7978
7980
|
inst._zod.parse = (payload, ctx) => {
|
|
7979
|
-
const
|
|
7980
|
-
if (!(
|
|
7981
|
+
const input2 = payload.value;
|
|
7982
|
+
if (!(input2 instanceof Set)) {
|
|
7981
7983
|
payload.issues.push({
|
|
7982
|
-
input,
|
|
7984
|
+
input: input2,
|
|
7983
7985
|
inst,
|
|
7984
7986
|
expected: "set",
|
|
7985
7987
|
code: "invalid_type"
|
|
@@ -7988,7 +7990,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
7988
7990
|
}
|
|
7989
7991
|
const proms = [];
|
|
7990
7992
|
payload.value = /* @__PURE__ */ new Set();
|
|
7991
|
-
for (const item of
|
|
7993
|
+
for (const item of input2) {
|
|
7992
7994
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
7993
7995
|
if (result instanceof Promise) {
|
|
7994
7996
|
proms.push(result.then((result2) => handleSetResult(result2, payload)));
|
|
@@ -8013,14 +8015,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
8013
8015
|
inst._zod.values = valuesSet;
|
|
8014
8016
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
8015
8017
|
inst._zod.parse = (payload, _ctx) => {
|
|
8016
|
-
const
|
|
8017
|
-
if (valuesSet.has(
|
|
8018
|
+
const input2 = payload.value;
|
|
8019
|
+
if (valuesSet.has(input2)) {
|
|
8018
8020
|
return payload;
|
|
8019
8021
|
}
|
|
8020
8022
|
payload.issues.push({
|
|
8021
8023
|
code: "invalid_value",
|
|
8022
8024
|
values,
|
|
8023
|
-
input,
|
|
8025
|
+
input: input2,
|
|
8024
8026
|
inst
|
|
8025
8027
|
});
|
|
8026
8028
|
return payload;
|
|
@@ -8035,14 +8037,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
8035
8037
|
inst._zod.values = values;
|
|
8036
8038
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
8037
8039
|
inst._zod.parse = (payload, _ctx) => {
|
|
8038
|
-
const
|
|
8039
|
-
if (values.has(
|
|
8040
|
+
const input2 = payload.value;
|
|
8041
|
+
if (values.has(input2)) {
|
|
8040
8042
|
return payload;
|
|
8041
8043
|
}
|
|
8042
8044
|
payload.issues.push({
|
|
8043
8045
|
code: "invalid_value",
|
|
8044
8046
|
values: def.values,
|
|
8045
|
-
input,
|
|
8047
|
+
input: input2,
|
|
8046
8048
|
inst
|
|
8047
8049
|
});
|
|
8048
8050
|
return payload;
|
|
@@ -8051,13 +8053,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
8051
8053
|
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
|
|
8052
8054
|
$ZodType.init(inst, def);
|
|
8053
8055
|
inst._zod.parse = (payload, _ctx) => {
|
|
8054
|
-
const
|
|
8055
|
-
if (
|
|
8056
|
+
const input2 = payload.value;
|
|
8057
|
+
if (input2 instanceof File)
|
|
8056
8058
|
return payload;
|
|
8057
8059
|
payload.issues.push({
|
|
8058
8060
|
expected: "file",
|
|
8059
8061
|
code: "invalid_type",
|
|
8060
|
-
input,
|
|
8062
|
+
input: input2,
|
|
8061
8063
|
inst
|
|
8062
8064
|
});
|
|
8063
8065
|
return payload;
|
|
@@ -8087,8 +8089,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
8087
8089
|
return payload;
|
|
8088
8090
|
};
|
|
8089
8091
|
});
|
|
8090
|
-
function handleOptionalResult(result,
|
|
8091
|
-
if (
|
|
8092
|
+
function handleOptionalResult(result, input2) {
|
|
8093
|
+
if (input2 === void 0 && (result.issues.length || result.fallback)) {
|
|
8092
8094
|
return { issues: [], value: void 0 };
|
|
8093
8095
|
}
|
|
8094
8096
|
return result;
|
|
@@ -8106,11 +8108,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
8106
8108
|
});
|
|
8107
8109
|
inst._zod.parse = (payload, ctx) => {
|
|
8108
8110
|
if (def.innerType._zod.optin === "optional") {
|
|
8109
|
-
const
|
|
8111
|
+
const input2 = payload.value;
|
|
8110
8112
|
const result = def.innerType._zod.run(payload, ctx);
|
|
8111
8113
|
if (result instanceof Promise)
|
|
8112
|
-
return result.then((r) => handleOptionalResult(r,
|
|
8113
|
-
return handleOptionalResult(result,
|
|
8114
|
+
return result.then((r) => handleOptionalResult(r, input2));
|
|
8115
|
+
return handleOptionalResult(result, input2);
|
|
8114
8116
|
}
|
|
8115
8117
|
if (payload.value === void 0) {
|
|
8116
8118
|
return payload;
|
|
@@ -8535,20 +8537,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
8535
8537
|
return payload;
|
|
8536
8538
|
};
|
|
8537
8539
|
inst._zod.check = (payload) => {
|
|
8538
|
-
const
|
|
8539
|
-
const r = def.fn(
|
|
8540
|
+
const input2 = payload.value;
|
|
8541
|
+
const r = def.fn(input2);
|
|
8540
8542
|
if (r instanceof Promise) {
|
|
8541
|
-
return r.then((r2) => handleRefineResult(r2, payload,
|
|
8543
|
+
return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
|
|
8542
8544
|
}
|
|
8543
|
-
handleRefineResult(r, payload,
|
|
8545
|
+
handleRefineResult(r, payload, input2, inst);
|
|
8544
8546
|
return;
|
|
8545
8547
|
};
|
|
8546
8548
|
});
|
|
8547
|
-
function handleRefineResult(result, payload,
|
|
8549
|
+
function handleRefineResult(result, payload, input2, inst) {
|
|
8548
8550
|
if (!result) {
|
|
8549
8551
|
const _iss = {
|
|
8550
8552
|
code: "custom",
|
|
8551
|
-
input,
|
|
8553
|
+
input: input2,
|
|
8552
8554
|
inst,
|
|
8553
8555
|
// incorporates params.error into issue reporting
|
|
8554
8556
|
path: [...inst._zod.def.path ?? []],
|
|
@@ -11835,8 +11837,8 @@ function ko_default() {
|
|
|
11835
11837
|
}
|
|
11836
11838
|
|
|
11837
11839
|
// ../../../node_modules/zod/v4/locales/lt.js
|
|
11838
|
-
var capitalizeFirstCharacter = (
|
|
11839
|
-
return
|
|
11840
|
+
var capitalizeFirstCharacter = (text2) => {
|
|
11841
|
+
return text2.charAt(0).toUpperCase() + text2.slice(1);
|
|
11840
11842
|
};
|
|
11841
11843
|
function getUnitTypeFromNumber(number4) {
|
|
11842
11844
|
const abs = Math.abs(number4);
|
|
@@ -15236,23 +15238,23 @@ function _overwrite(tx) {
|
|
|
15236
15238
|
}
|
|
15237
15239
|
// @__NO_SIDE_EFFECTS__
|
|
15238
15240
|
function _normalize(form) {
|
|
15239
|
-
return /* @__PURE__ */ _overwrite((
|
|
15241
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
|
|
15240
15242
|
}
|
|
15241
15243
|
// @__NO_SIDE_EFFECTS__
|
|
15242
15244
|
function _trim() {
|
|
15243
|
-
return /* @__PURE__ */ _overwrite((
|
|
15245
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.trim());
|
|
15244
15246
|
}
|
|
15245
15247
|
// @__NO_SIDE_EFFECTS__
|
|
15246
15248
|
function _toLowerCase() {
|
|
15247
|
-
return /* @__PURE__ */ _overwrite((
|
|
15249
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
|
|
15248
15250
|
}
|
|
15249
15251
|
// @__NO_SIDE_EFFECTS__
|
|
15250
15252
|
function _toUpperCase() {
|
|
15251
|
-
return /* @__PURE__ */ _overwrite((
|
|
15253
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
|
|
15252
15254
|
}
|
|
15253
15255
|
// @__NO_SIDE_EFFECTS__
|
|
15254
15256
|
function _slugify() {
|
|
15255
|
-
return /* @__PURE__ */ _overwrite((
|
|
15257
|
+
return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
|
|
15256
15258
|
}
|
|
15257
15259
|
// @__NO_SIDE_EFFECTS__
|
|
15258
15260
|
function _array(Class2, element, params) {
|
|
@@ -15557,8 +15559,8 @@ function _stringbool(Classes, _params) {
|
|
|
15557
15559
|
type: "pipe",
|
|
15558
15560
|
in: stringSchema,
|
|
15559
15561
|
out: booleanSchema,
|
|
15560
|
-
transform: ((
|
|
15561
|
-
let data =
|
|
15562
|
+
transform: ((input2, payload) => {
|
|
15563
|
+
let data = input2;
|
|
15562
15564
|
if (params.case !== "sensitive")
|
|
15563
15565
|
data = data.toLowerCase();
|
|
15564
15566
|
if (truthySet.has(data)) {
|
|
@@ -15577,8 +15579,8 @@ function _stringbool(Classes, _params) {
|
|
|
15577
15579
|
return {};
|
|
15578
15580
|
}
|
|
15579
15581
|
}),
|
|
15580
|
-
reverseTransform: ((
|
|
15581
|
-
if (
|
|
15582
|
+
reverseTransform: ((input2, _payload) => {
|
|
15583
|
+
if (input2 === true) {
|
|
15582
15584
|
return truthyArray[0] || "true";
|
|
15583
15585
|
} else {
|
|
15584
15586
|
return falsyArray[0] || "false";
|
|
@@ -16474,9 +16476,9 @@ var allProcessors = {
|
|
|
16474
16476
|
optional: optionalProcessor,
|
|
16475
16477
|
lazy: lazyProcessor
|
|
16476
16478
|
};
|
|
16477
|
-
function toJSONSchema(
|
|
16478
|
-
if ("_idmap" in
|
|
16479
|
-
const registry2 =
|
|
16479
|
+
function toJSONSchema(input2, params) {
|
|
16480
|
+
if ("_idmap" in input2) {
|
|
16481
|
+
const registry2 = input2;
|
|
16480
16482
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
16481
16483
|
const defs = {};
|
|
16482
16484
|
for (const entry of registry2._idmap.entries()) {
|
|
@@ -16504,9 +16506,9 @@ function toJSONSchema(input, params) {
|
|
|
16504
16506
|
return { schemas };
|
|
16505
16507
|
}
|
|
16506
16508
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
16507
|
-
process2(
|
|
16508
|
-
extractDefs(ctx,
|
|
16509
|
-
return finalize(ctx,
|
|
16509
|
+
process2(input2, ctx);
|
|
16510
|
+
extractDefs(ctx, input2);
|
|
16511
|
+
return finalize(ctx, input2);
|
|
16510
16512
|
}
|
|
16511
16513
|
|
|
16512
16514
|
// ../../../node_modules/zod/v4/core/json-schema-generator.js
|
|
@@ -18297,13 +18299,13 @@ function resolveRef(ref, ctx) {
|
|
|
18297
18299
|
if (!ref.startsWith("#")) {
|
|
18298
18300
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
18299
18301
|
}
|
|
18300
|
-
const
|
|
18301
|
-
if (
|
|
18302
|
+
const path13 = ref.slice(1).split("/").filter(Boolean);
|
|
18303
|
+
if (path13.length === 0) {
|
|
18302
18304
|
return ctx.rootSchema;
|
|
18303
18305
|
}
|
|
18304
18306
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
18305
|
-
if (
|
|
18306
|
-
const key =
|
|
18307
|
+
if (path13[0] === defsKey) {
|
|
18308
|
+
const key = path13[1];
|
|
18307
18309
|
if (!key || !ctx.defs[key]) {
|
|
18308
18310
|
throw new Error(`Reference not found: ${ref}`);
|
|
18309
18311
|
}
|
|
@@ -18783,7 +18785,7 @@ var codexhostErrorSchema = external_exports.strictObject({
|
|
|
18783
18785
|
|
|
18784
18786
|
// ../../shared-contracts/dist/harness-presentation.js
|
|
18785
18787
|
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
18786
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((
|
|
18788
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
18787
18789
|
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
18788
18790
|
label: displayText(256).optional(),
|
|
18789
18791
|
description: displayText(1024).optional()
|
|
@@ -18872,7 +18874,7 @@ var usageMeasurementsSchema = external_exports.object({
|
|
|
18872
18874
|
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
|
|
18873
18875
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
18874
18876
|
}).strict();
|
|
18875
|
-
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((
|
|
18877
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
|
|
18876
18878
|
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
18877
18879
|
kind: external_exports.literal("countdown"),
|
|
18878
18880
|
id: external_exports.string().min(1).max(64),
|
|
@@ -19255,6 +19257,8 @@ var externalThreadInspectionSchema = external_exports.object({
|
|
|
19255
19257
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
19256
19258
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
19257
19259
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
19260
|
+
/** Live Session catalog when it, not the Adapter inspection, contains `effectiveModel`. */
|
|
19261
|
+
catalog: harnessModelCatalogSchema.optional(),
|
|
19258
19262
|
history: harnessHistoryCapabilitiesSchema,
|
|
19259
19263
|
usage: threadUsageSnapshotSchema.optional(),
|
|
19260
19264
|
locked: external_exports.literal(true)
|
|
@@ -19313,9 +19317,9 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
19313
19317
|
}).strict();
|
|
19314
19318
|
var threadSteeringContextSchema = external_exports.object({
|
|
19315
19319
|
kind: external_exports.literal("application"),
|
|
19316
|
-
value: external_exports.string().transform((
|
|
19320
|
+
value: external_exports.string().transform((text2, context) => {
|
|
19317
19321
|
try {
|
|
19318
|
-
return JSON.parse(
|
|
19322
|
+
return JSON.parse(text2);
|
|
19319
19323
|
} catch {
|
|
19320
19324
|
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
19321
19325
|
return external_exports.NEVER;
|
|
@@ -19450,8 +19454,8 @@ var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).r
|
|
|
19450
19454
|
const { username, password } = new URL(value);
|
|
19451
19455
|
return !username && !password && !/[\\\s]/u.test(value);
|
|
19452
19456
|
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
19453
|
-
function localizedText(
|
|
19454
|
-
return external_exports.strictObject({ en:
|
|
19457
|
+
function localizedText(text2) {
|
|
19458
|
+
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
19455
19459
|
}
|
|
19456
19460
|
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
19457
19461
|
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
@@ -19501,7 +19505,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
|
|
|
19501
19505
|
default: external_exports.string().optional()
|
|
19502
19506
|
})
|
|
19503
19507
|
]).superRefine((field2, ctx) => {
|
|
19504
|
-
const issue2 = (
|
|
19508
|
+
const issue2 = (path13, message) => ctx.addIssue({ code: "custom", path: [path13], message });
|
|
19505
19509
|
if (field2.type === "number" || field2.type === "range") {
|
|
19506
19510
|
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
19507
19511
|
if (min > max)
|
|
@@ -19568,8 +19572,8 @@ var desktopExtensionTrustTierSchema = external_exports.enum(["official", "commun
|
|
|
19568
19572
|
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
19569
19573
|
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
19570
19574
|
}
|
|
19571
|
-
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((
|
|
19572
|
-
const url2 = new URL(
|
|
19575
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input2) => {
|
|
19576
|
+
const url2 = new URL(input2);
|
|
19573
19577
|
return /\.zip$/iu.test(url2.pathname) || isGitHubDesktopExtensionZipballUrl(url2) || url2.origin === "https://github.com" && /^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(url2.pathname) || url2.origin === "https://codeload.github.com" && /^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(url2.pathname);
|
|
19574
19578
|
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
19575
19579
|
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
@@ -19607,16 +19611,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
|
|
|
19607
19611
|
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
19608
19612
|
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
19609
19613
|
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
19610
|
-
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((
|
|
19614
|
+
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path13) => path13.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
19611
19615
|
var legacy = desktopExtensionManifestSchema.shape;
|
|
19612
19616
|
var localized = (max, min = 0) => external_exports.strictObject({
|
|
19613
19617
|
en: external_exports.string().trim().min(min).max(max),
|
|
19614
19618
|
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
19615
19619
|
});
|
|
19616
|
-
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((
|
|
19620
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path13) => path13.endsWith(suffix), `Expected a ${suffix} file`);
|
|
19617
19621
|
var moduleEntry = resourceWithSuffix(".mjs");
|
|
19618
19622
|
var style = resourceWithSuffix(".css").optional();
|
|
19619
|
-
var hostExtensionCanonicalPath = (
|
|
19623
|
+
var hostExtensionCanonicalPath = (path13) => path13.normalize("NFC").toLowerCase();
|
|
19620
19624
|
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
19621
19625
|
manifestVersion: external_exports.literal(2),
|
|
19622
19626
|
id: hostExtensionIdSchema,
|
|
@@ -19626,8 +19630,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
|
19626
19630
|
details: localized(16384).optional(),
|
|
19627
19631
|
author: legacy.author,
|
|
19628
19632
|
repository: legacy.repository,
|
|
19629
|
-
icon: legacy.icon.refine((
|
|
19630
|
-
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((
|
|
19633
|
+
icon: legacy.icon.refine((path13) => path13 === void 0 || hostExtensionResourcePathSchema.safeParse(path13).success),
|
|
19634
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path13) => hostExtensionResourcePathSchema.safeParse(path13).success)),
|
|
19631
19635
|
categories: legacy.categories,
|
|
19632
19636
|
settingsSchema: legacy.settingsSchema,
|
|
19633
19637
|
slots: legacy.slots.removeDefault().optional(),
|
|
@@ -19706,7 +19710,7 @@ var active = {
|
|
|
19706
19710
|
digest: hostExtensionDigestSchema
|
|
19707
19711
|
};
|
|
19708
19712
|
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
19709
|
-
var filePath = external_exports.string().min(1).max(4096).refine((
|
|
19713
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path13) => /^(?:\/|[a-z]:[/\\])/iu.test(path13) && !path13.includes("\0") && !path13.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
19710
19714
|
var gitRef = external_exports.string().min(1).max(256).refine((ref) => ref.split("/").every((part) => part && /^[a-z0-9_.-]+$/iu.test(part) && part !== "." && part !== ".."), "Invalid GitHub ref");
|
|
19711
19715
|
function base643(maxBytes) {
|
|
19712
19716
|
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
@@ -19920,6 +19924,8 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
19920
19924
|
"codexhost/workspace/read",
|
|
19921
19925
|
"codexhost/thread/tree/read",
|
|
19922
19926
|
"codexhost/thread/pins/list",
|
|
19927
|
+
"codexhost/thread/sections/list",
|
|
19928
|
+
"codexhost/thread/sections/move",
|
|
19923
19929
|
"codexhost/thread/pins/set",
|
|
19924
19930
|
"codexhost/harness/plugins/list",
|
|
19925
19931
|
"codexhost/harness/inspect",
|
|
@@ -19958,8 +19964,21 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
19958
19964
|
"codexhost/update/check",
|
|
19959
19965
|
"codexhost/update/start",
|
|
19960
19966
|
"codexhost/update/status",
|
|
19967
|
+
"codexhost/announcement/get",
|
|
19968
|
+
"codexhost/announcement/acknowledge",
|
|
19961
19969
|
"codexhost/sessions/loaded/list"
|
|
19962
19970
|
];
|
|
19971
|
+
var clientThreadSectionsSchema = external_exports.object({
|
|
19972
|
+
sections: external_exports.array(external_exports.object({
|
|
19973
|
+
id: external_exports.string().min(1),
|
|
19974
|
+
name: external_exports.string().min(1),
|
|
19975
|
+
threads: external_exports.array(jsonObjectSchema)
|
|
19976
|
+
}).strict())
|
|
19977
|
+
}).strict();
|
|
19978
|
+
var clientThreadSectionMoveSchema = external_exports.object({
|
|
19979
|
+
threadId: external_exports.string().min(1).max(1024),
|
|
19980
|
+
sectionId: external_exports.string().min(1).max(1024).nullable()
|
|
19981
|
+
}).strict();
|
|
19963
19982
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
19964
19983
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
19965
19984
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -20501,8 +20520,8 @@ var harnessPreferencePatchSchema = external_exports.strictObject({
|
|
|
20501
20520
|
operations: external_exports.array(harnessPreferenceOperationSchema).min(1).max(256),
|
|
20502
20521
|
initializeOnly: external_exports.boolean().optional(),
|
|
20503
20522
|
expectedRevision: external_exports.number().int().nonnegative().optional()
|
|
20504
|
-
}).superRefine((
|
|
20505
|
-
for (const operation of
|
|
20523
|
+
}).superRefine((input2, ctx) => {
|
|
20524
|
+
for (const operation of input2.operations) {
|
|
20506
20525
|
if (operation.kind === "newThread" && (!operation.lastHarness && !operation.configuration || Boolean(operation.harnessId) !== Boolean(operation.configuration)))
|
|
20507
20526
|
ctx.addIssue({
|
|
20508
20527
|
code: "custom",
|
|
@@ -20904,13 +20923,18 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
20904
20923
|
// ../../shared-contracts/dist/harness-installation.js
|
|
20905
20924
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
20906
20925
|
harnessId: harnessIdSchema,
|
|
20907
|
-
action: external_exports.enum(["check", "update", "install"])
|
|
20908
|
-
|
|
20926
|
+
action: external_exports.enum(["check", "update", "install"]),
|
|
20927
|
+
confirmedVersion: external_exports.string().min(1).max(128).optional()
|
|
20928
|
+
}).strict().refine(({ action, confirmedVersion }) => action === "update" || confirmedVersion === void 0);
|
|
20909
20929
|
var harnessInstallationStateSchema = external_exports.object({
|
|
20910
20930
|
currentVersion: external_exports.string().min(1).max(128),
|
|
20911
20931
|
latestVersion: external_exports.string().min(1).max(128),
|
|
20912
20932
|
updateAvailable: external_exports.boolean(),
|
|
20913
20933
|
canUpdate: external_exports.boolean(),
|
|
20934
|
+
/** Present when the Adapter has a verified list and the available target is outside it. */
|
|
20935
|
+
latestVerifiedVersion: external_exports.string().min(1).max(128).optional(),
|
|
20936
|
+
/** Update preflight stopped before running the installer; latestVersion needs confirmation. */
|
|
20937
|
+
confirmationRequired: external_exports.literal(true).optional(),
|
|
20914
20938
|
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
20915
20939
|
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
20916
20940
|
/** Official download opened by the user; does not imply an automatic installation. */
|
|
@@ -21244,6 +21268,38 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
21244
21268
|
status: updateStatusSchema.nullable()
|
|
21245
21269
|
});
|
|
21246
21270
|
|
|
21271
|
+
// ../../shared-contracts/dist/release-announcement.js
|
|
21272
|
+
var RELEASE_ANNOUNCEMENT_MAX_THEMES = 12;
|
|
21273
|
+
var releaseAnnouncementThemeSchema = external_exports.strictObject({
|
|
21274
|
+
icon: external_exports.string().min(1).max(16).optional(),
|
|
21275
|
+
title: external_exports.string().min(1).max(120),
|
|
21276
|
+
body: external_exports.string().min(1).max(1200),
|
|
21277
|
+
contributors: external_exports.array(external_exports.string().min(1).max(39)).max(30)
|
|
21278
|
+
});
|
|
21279
|
+
var releaseAnnouncementContentSchema = external_exports.strictObject({
|
|
21280
|
+
summary: external_exports.string().min(1).max(600).optional(),
|
|
21281
|
+
themes: external_exports.array(releaseAnnouncementThemeSchema).min(1).max(RELEASE_ANNOUNCEMENT_MAX_THEMES)
|
|
21282
|
+
});
|
|
21283
|
+
var releaseAnnouncementSchema = external_exports.strictObject({
|
|
21284
|
+
version: updateSemanticVersionSchema,
|
|
21285
|
+
publishedAt: external_exports.iso.datetime(),
|
|
21286
|
+
url: external_exports.string().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),
|
|
21287
|
+
zh: releaseAnnouncementContentSchema.nullable(),
|
|
21288
|
+
en: releaseAnnouncementContentSchema.nullable()
|
|
21289
|
+
}).refine((value) => value.zh !== null || value.en !== null, {
|
|
21290
|
+
message: "an announcement needs at least one language"
|
|
21291
|
+
});
|
|
21292
|
+
var releaseAnnouncementGetParamsSchema = external_exports.strictObject({
|
|
21293
|
+
manual: external_exports.boolean().optional()
|
|
21294
|
+
});
|
|
21295
|
+
var releaseAnnouncementGetResultSchema = external_exports.strictObject({
|
|
21296
|
+
announcement: releaseAnnouncementSchema.nullable(),
|
|
21297
|
+
unread: external_exports.boolean()
|
|
21298
|
+
});
|
|
21299
|
+
var releaseAnnouncementAcknowledgeParamsSchema = external_exports.strictObject({
|
|
21300
|
+
version: updateSemanticVersionSchema
|
|
21301
|
+
});
|
|
21302
|
+
|
|
21247
21303
|
// ../../shared-contracts/dist/thread-watch-notice.js
|
|
21248
21304
|
var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
21249
21305
|
"completed",
|
|
@@ -21291,17 +21347,67 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
|
|
|
21291
21347
|
|
|
21292
21348
|
// ../../shared-contracts/dist/remote-sessions.js
|
|
21293
21349
|
var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
|
|
21294
|
-
var
|
|
21350
|
+
var REMOTE_IDENTITY_MAX_LENGTH = 1024;
|
|
21351
|
+
var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
|
|
21295
21352
|
var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
|
|
21296
21353
|
var thread = { ...target, threadId: identity };
|
|
21354
|
+
var text = external_exports.string().min(1).max(8e3);
|
|
21355
|
+
var input = { text, requestId: identity };
|
|
21356
|
+
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
21357
|
+
external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
|
|
21358
|
+
external_exports.object({
|
|
21359
|
+
accepted: external_exports.literal(false),
|
|
21360
|
+
code: external_exports.enum([
|
|
21361
|
+
"remote/queue-unavailable",
|
|
21362
|
+
"remote/steer-unavailable",
|
|
21363
|
+
"remote/turn-changed",
|
|
21364
|
+
"remote/send-rejected",
|
|
21365
|
+
"session/queue-item-not-found",
|
|
21366
|
+
"session/queue-item-starting"
|
|
21367
|
+
]),
|
|
21368
|
+
message: external_exports.string()
|
|
21369
|
+
})
|
|
21370
|
+
]);
|
|
21371
|
+
var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available", [
|
|
21372
|
+
external_exports.object({ available: external_exports.literal(false) }),
|
|
21373
|
+
external_exports.object({
|
|
21374
|
+
available: external_exports.literal(true),
|
|
21375
|
+
items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
|
|
21376
|
+
})
|
|
21377
|
+
]);
|
|
21297
21378
|
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
21298
21379
|
external_exports.strictObject({ kind: external_exports.literal("hosts") }),
|
|
21380
|
+
external_exports.strictObject({
|
|
21381
|
+
kind: external_exports.literal("create"),
|
|
21382
|
+
...target,
|
|
21383
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
21384
|
+
epoch: identity
|
|
21385
|
+
}),
|
|
21386
|
+
external_exports.strictObject({ kind: external_exports.literal("projectHarnesses"), ...target, epoch: identity }),
|
|
21387
|
+
external_exports.strictObject({
|
|
21388
|
+
kind: external_exports.literal("inspectHarness"),
|
|
21389
|
+
...target,
|
|
21390
|
+
epoch: identity,
|
|
21391
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
21392
|
+
harnessId: identity
|
|
21393
|
+
}),
|
|
21394
|
+
external_exports.strictObject({
|
|
21395
|
+
kind: external_exports.literal("startSelected"),
|
|
21396
|
+
...target,
|
|
21397
|
+
epoch: identity,
|
|
21398
|
+
cwd: external_exports.string().min(1).max(8192),
|
|
21399
|
+
harnessId: identity,
|
|
21400
|
+
model: external_exports.string().min(1).max(4096),
|
|
21401
|
+
serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
|
|
21402
|
+
reasoningEffort: identity.optional()
|
|
21403
|
+
}),
|
|
21299
21404
|
external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
|
|
21300
21405
|
external_exports.strictObject({
|
|
21301
21406
|
kind: external_exports.literal("list"),
|
|
21302
21407
|
...target,
|
|
21303
21408
|
cursor: external_exports.string().nullable(),
|
|
21304
|
-
archived: external_exports.boolean()
|
|
21409
|
+
archived: external_exports.boolean(),
|
|
21410
|
+
includeLoaded: external_exports.literal(true).optional()
|
|
21305
21411
|
}),
|
|
21306
21412
|
external_exports.strictObject({
|
|
21307
21413
|
kind: external_exports.literal("read"),
|
|
@@ -21331,9 +21437,25 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
21331
21437
|
kind: external_exports.literal("prompt"),
|
|
21332
21438
|
...thread,
|
|
21333
21439
|
epoch: identity,
|
|
21334
|
-
text
|
|
21440
|
+
text,
|
|
21335
21441
|
requestId: identity.optional()
|
|
21336
21442
|
}),
|
|
21443
|
+
external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread, epoch: identity }),
|
|
21444
|
+
external_exports.strictObject({
|
|
21445
|
+
kind: external_exports.literal("delivery"),
|
|
21446
|
+
...thread,
|
|
21447
|
+
epoch: identity,
|
|
21448
|
+
action: external_exports.discriminatedUnion("kind", [
|
|
21449
|
+
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input }),
|
|
21450
|
+
external_exports.strictObject({ kind: external_exports.literal("steer"), ...input, turnId: identity }),
|
|
21451
|
+
external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
|
|
21452
|
+
external_exports.strictObject({
|
|
21453
|
+
kind: external_exports.literal("start"),
|
|
21454
|
+
itemId: identity,
|
|
21455
|
+
onlyIfHead: external_exports.literal(true).optional()
|
|
21456
|
+
})
|
|
21457
|
+
])
|
|
21458
|
+
}),
|
|
21337
21459
|
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
21338
21460
|
external_exports.strictObject({
|
|
21339
21461
|
kind: external_exports.literal("rename"),
|
|
@@ -21467,8 +21589,8 @@ function unquote(value) {
|
|
|
21467
21589
|
return (quoted[2] ?? "").trim();
|
|
21468
21590
|
return trimmed.replace(/(?:^|\s+)#.*$/u, "").trim();
|
|
21469
21591
|
}
|
|
21470
|
-
function readCredentialRef(
|
|
21471
|
-
const lines =
|
|
21592
|
+
function readCredentialRef(text2, name) {
|
|
21593
|
+
const lines = text2.split(/\r?\n/u);
|
|
21472
21594
|
const entry = new RegExp(`^(\\s*)${name}\\s*:(.*)$`, "u");
|
|
21473
21595
|
let inRefs = false;
|
|
21474
21596
|
let refsIndent = -1;
|
|
@@ -21557,17 +21679,17 @@ function projectDeepSeekBalances(payload) {
|
|
|
21557
21679
|
return parsed.success ? [parsed.data] : [];
|
|
21558
21680
|
});
|
|
21559
21681
|
}
|
|
21560
|
-
async function fetchDeepSeekBalances(
|
|
21682
|
+
async function fetchDeepSeekBalances(input2 = {}) {
|
|
21561
21683
|
try {
|
|
21562
21684
|
const timeout = AbortSignal.timeout(REQUEST_TIMEOUT_MS);
|
|
21563
|
-
const signal =
|
|
21685
|
+
const signal = input2.signal ? AbortSignal.any([input2.signal, timeout]) : timeout;
|
|
21564
21686
|
signal.throwIfAborted();
|
|
21565
|
-
const environment =
|
|
21566
|
-
const key = await (
|
|
21687
|
+
const environment = input2.environment ?? process.env;
|
|
21688
|
+
const key = await (input2.readApiKey ? input2.readApiKey() : readDeepSeekApiKey(environment, signal));
|
|
21567
21689
|
if (!key)
|
|
21568
21690
|
return [];
|
|
21569
21691
|
signal.throwIfAborted();
|
|
21570
|
-
const response = await (
|
|
21692
|
+
const response = await (input2.fetch ?? fetch)(DEEPSEEK_BALANCE_ENDPOINT, {
|
|
21571
21693
|
headers: { Authorization: `Bearer ${key}`, Accept: "application/json" },
|
|
21572
21694
|
redirect: "error",
|
|
21573
21695
|
signal
|
|
@@ -22180,10 +22302,10 @@ function parseUnaryResponse(value, rpcId) {
|
|
|
22180
22302
|
}
|
|
22181
22303
|
throw new TypeError("Modern DSH Web returned an invalid Remote result");
|
|
22182
22304
|
}
|
|
22183
|
-
function parseStreamFrame(
|
|
22305
|
+
function parseStreamFrame(text2) {
|
|
22184
22306
|
let value;
|
|
22185
22307
|
try {
|
|
22186
|
-
value = JSON.parse(
|
|
22308
|
+
value = JSON.parse(text2);
|
|
22187
22309
|
} catch {
|
|
22188
22310
|
throw new TypeError("Modern DSH Web emitted a non-JSON Remote stream frame");
|
|
22189
22311
|
}
|
|
@@ -22418,16 +22540,16 @@ var Diff = class {
|
|
|
22418
22540
|
}
|
|
22419
22541
|
}
|
|
22420
22542
|
}
|
|
22421
|
-
addToPath(
|
|
22422
|
-
const last =
|
|
22543
|
+
addToPath(path13, added, removed, oldPosInc, options) {
|
|
22544
|
+
const last = path13.lastComponent;
|
|
22423
22545
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
22424
22546
|
return {
|
|
22425
|
-
oldPos:
|
|
22547
|
+
oldPos: path13.oldPos + oldPosInc,
|
|
22426
22548
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
22427
22549
|
};
|
|
22428
22550
|
} else {
|
|
22429
22551
|
return {
|
|
22430
|
-
oldPos:
|
|
22552
|
+
oldPos: path13.oldPos + oldPosInc,
|
|
22431
22553
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
22432
22554
|
};
|
|
22433
22555
|
}
|
|
@@ -22722,9 +22844,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
22722
22844
|
} }));
|
|
22723
22845
|
}
|
|
22724
22846
|
}
|
|
22725
|
-
function splitLines(
|
|
22726
|
-
const hasTrailingNl =
|
|
22727
|
-
const result =
|
|
22847
|
+
function splitLines(text2) {
|
|
22848
|
+
const hasTrailingNl = text2.endsWith("\n");
|
|
22849
|
+
const result = text2.split("\n").map((line) => line + "\n");
|
|
22728
22850
|
if (hasTrailingNl) {
|
|
22729
22851
|
result.pop();
|
|
22730
22852
|
} else {
|
|
@@ -22761,14 +22883,14 @@ function projectToolResult(value, limit) {
|
|
|
22761
22883
|
const callId = value.source.callId;
|
|
22762
22884
|
if (!nonBlankString(callId) || !Array.isArray(value.content) || value.role !== "tool" || value.toolCallId !== callId || value.isError !== void 0 && typeof value.isError !== "boolean")
|
|
22763
22885
|
return null;
|
|
22764
|
-
const
|
|
22765
|
-
const truncated =
|
|
22886
|
+
const text2 = contentText(value);
|
|
22887
|
+
const truncated = text2.length > limit;
|
|
22766
22888
|
return {
|
|
22767
22889
|
callId,
|
|
22768
22890
|
failed: value.isError === true,
|
|
22769
|
-
...
|
|
22891
|
+
...text2 ? {
|
|
22770
22892
|
output: {
|
|
22771
|
-
content: [{ type: "text", text: truncated ?
|
|
22893
|
+
content: [{ type: "text", text: truncated ? text2.slice(0, limit) : text2 }],
|
|
22772
22894
|
...truncated ? { truncated: true } : {}
|
|
22773
22895
|
}
|
|
22774
22896
|
} : {}
|
|
@@ -23691,12 +23813,12 @@ function deepSeekUsageRecord(event, historical) {
|
|
|
23691
23813
|
return data.interrupted === true ? { kind: "none" } : { kind: "missing" };
|
|
23692
23814
|
if (!isRecord5(usage))
|
|
23693
23815
|
return { kind: "missing" };
|
|
23694
|
-
const
|
|
23816
|
+
const input2 = count2(usage.inputTokens);
|
|
23695
23817
|
const output = count2(usage.outputTokens);
|
|
23696
23818
|
const cacheRead = count2(usage.cacheReadTokens ?? 0);
|
|
23697
23819
|
const cacheWrite = count2(usage.cacheWriteTokens ?? 0);
|
|
23698
23820
|
const reasoning2 = usage.reasoningTokens === void 0 ? null : count2(usage.reasoningTokens);
|
|
23699
|
-
if (
|
|
23821
|
+
if (input2 === null || output === null || cacheRead === null || cacheWrite === null) {
|
|
23700
23822
|
return { kind: "missing" };
|
|
23701
23823
|
}
|
|
23702
23824
|
const startedAtMs = historical ? null : count2(firstTokenTime(chunks, reasoning2));
|
|
@@ -23708,7 +23830,7 @@ function deepSeekUsageRecord(event, historical) {
|
|
|
23708
23830
|
requestId: message.id,
|
|
23709
23831
|
...historical ? { historical: true } : {},
|
|
23710
23832
|
model: source.model,
|
|
23711
|
-
inputTokens:
|
|
23833
|
+
inputTokens: input2 + cacheRead + cacheWrite,
|
|
23712
23834
|
cachedInputTokens: cacheRead,
|
|
23713
23835
|
cacheWriteInputTokens: cacheWrite,
|
|
23714
23836
|
outputTokens: output,
|
|
@@ -23777,10 +23899,10 @@ function zstdFrames(buffer) {
|
|
|
23777
23899
|
}
|
|
23778
23900
|
async function readDshUsage(file2) {
|
|
23779
23901
|
const buffer = await readFile3(file2);
|
|
23780
|
-
const
|
|
23902
|
+
const text2 = file2.endsWith(".zstd") ? zstdFrames(buffer).map((frame) => zstdDecompressSync(frame).toString("utf8")).join("") : buffer.toString("utf8");
|
|
23781
23903
|
const entries = [];
|
|
23782
23904
|
let session = {};
|
|
23783
|
-
for (const line of
|
|
23905
|
+
for (const line of text2.split("\n")) {
|
|
23784
23906
|
if (entries.length === 0 && line.startsWith('{"type":"session"')) {
|
|
23785
23907
|
try {
|
|
23786
23908
|
const header = JSON.parse(line);
|
|
@@ -23893,15 +24015,15 @@ function parseDeepSeekHarnessCommand(command) {
|
|
|
23893
24015
|
if (arguments_ && Object.keys(arguments_).some((key) => key !== "text")) {
|
|
23894
24016
|
return invalidArguments(`DeepSeek Harness ${nativeInvocation} command has an unknown argument`);
|
|
23895
24017
|
}
|
|
23896
|
-
const
|
|
23897
|
-
if (definition.id === "dsh.goal" &&
|
|
24018
|
+
const text2 = arguments_?.text?.trim() ?? "";
|
|
24019
|
+
if (definition.id === "dsh.goal" && text2.toLowerCase() === "edit") {
|
|
23898
24020
|
return invalidArguments("DeepSeek Harness /goal edit command requires a replacement objective");
|
|
23899
24021
|
}
|
|
23900
24022
|
return {
|
|
23901
24023
|
ok: true,
|
|
23902
24024
|
value: {
|
|
23903
24025
|
commandId: definition.id,
|
|
23904
|
-
line:
|
|
24026
|
+
line: text2.length > 0 ? `${nativeInvocation} ${text2}` : nativeInvocation
|
|
23905
24027
|
}
|
|
23906
24028
|
};
|
|
23907
24029
|
}
|
|
@@ -23911,7 +24033,8 @@ import { spawn } from "node:child_process";
|
|
|
23911
24033
|
|
|
23912
24034
|
// dist/executable.js
|
|
23913
24035
|
import { spawnSync } from "node:child_process";
|
|
23914
|
-
import { accessSync, constants, statSync } from "node:fs";
|
|
24036
|
+
import { accessSync, constants, readFileSync, statSync } from "node:fs";
|
|
24037
|
+
import { homedir as homedir2 } from "node:os";
|
|
23915
24038
|
import path7 from "node:path";
|
|
23916
24039
|
function environmentValue2(environment, name) {
|
|
23917
24040
|
return Object.entries(environment).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
@@ -23936,6 +24059,20 @@ function resolveExecutable(command, environment) {
|
|
|
23936
24059
|
}
|
|
23937
24060
|
return null;
|
|
23938
24061
|
}
|
|
24062
|
+
function deepSeekNpxVersionFile(environment) {
|
|
24063
|
+
const dataDirectory = environment.CODEXHOST_DATA_DIR ?? path7.join(environment.HOME ?? environment.USERPROFILE ?? homedir2(), ".codexhost");
|
|
24064
|
+
return path7.join(dataDirectory, "deepseek-npx-version");
|
|
24065
|
+
}
|
|
24066
|
+
function deepSeekNpxSpecifier(environment) {
|
|
24067
|
+
try {
|
|
24068
|
+
const version2 = installationVersion(readFileSync(deepSeekNpxVersionFile(environment), "utf8"));
|
|
24069
|
+
return `@deepseek-ai/dsh@${version2}`;
|
|
24070
|
+
} catch (error51) {
|
|
24071
|
+
if (error51.code !== "ENOENT")
|
|
24072
|
+
throw error51;
|
|
24073
|
+
return "@deepseek-ai/dsh";
|
|
24074
|
+
}
|
|
24075
|
+
}
|
|
23939
24076
|
function resolveDeepSeekCommand(configured, environment) {
|
|
23940
24077
|
if (configured) {
|
|
23941
24078
|
const command = resolveExecutable(configured, environment);
|
|
@@ -23947,7 +24084,7 @@ function resolveDeepSeekCommand(configured, environment) {
|
|
|
23947
24084
|
const npx = resolveExecutable(process.platform === "win32" ? "npx.cmd" : "npx", environment);
|
|
23948
24085
|
return npx ? {
|
|
23949
24086
|
command: npx,
|
|
23950
|
-
arguments: ["--offline", "--no-install",
|
|
24087
|
+
arguments: ["--offline", "--no-install", deepSeekNpxSpecifier(environment)],
|
|
23951
24088
|
kind: "npx"
|
|
23952
24089
|
} : null;
|
|
23953
24090
|
}
|
|
@@ -23985,6 +24122,12 @@ function killDeepSeekProcessTree(child, platform, timeoutMs) {
|
|
|
23985
24122
|
});
|
|
23986
24123
|
if (result.error)
|
|
23987
24124
|
throw result.error;
|
|
24125
|
+
if (result.signal) {
|
|
24126
|
+
throw new Error(`Windows taskkill terminated with signal ${result.signal}`);
|
|
24127
|
+
}
|
|
24128
|
+
if (result.status !== 0) {
|
|
24129
|
+
throw new Error(`Windows taskkill exited with status ${String(result.status)}`);
|
|
24130
|
+
}
|
|
23988
24131
|
return;
|
|
23989
24132
|
}
|
|
23990
24133
|
try {
|
|
@@ -24223,14 +24366,14 @@ async function terminateVersionProcess(child, closed, cleanupTimeoutMs, dependen
|
|
|
24223
24366
|
}
|
|
24224
24367
|
return failures.length === 0 ? null : new AggregateError(failures, "DeepSeek Harness version process cleanup failed");
|
|
24225
24368
|
}
|
|
24226
|
-
async function captureVersionOutput(child,
|
|
24369
|
+
async function captureVersionOutput(child, input2, dependencies) {
|
|
24227
24370
|
const childStdout = child.stdout;
|
|
24228
24371
|
const childStderr = child.stderr;
|
|
24229
24372
|
const stdout = { chunks: [], bytes: 0 };
|
|
24230
24373
|
const stderr = { chunks: [], bytes: 0 };
|
|
24231
24374
|
let stderrDiagnosticTail = "";
|
|
24232
|
-
const timeout = AbortSignal.timeout(
|
|
24233
|
-
const lifetime =
|
|
24375
|
+
const timeout = AbortSignal.timeout(input2.timeoutMs);
|
|
24376
|
+
const lifetime = input2.signal ? AbortSignal.any([input2.signal, timeout]) : timeout;
|
|
24234
24377
|
let closeObserved = false;
|
|
24235
24378
|
let resolveClosed = () => void 0;
|
|
24236
24379
|
const closed = new Promise((resolve) => {
|
|
@@ -24246,7 +24389,7 @@ async function captureVersionOutput(child, input, dependencies) {
|
|
|
24246
24389
|
reject({ error: error51, requiresCleanup });
|
|
24247
24390
|
};
|
|
24248
24391
|
const append = (target2, value) => {
|
|
24249
|
-
if (finished || appendOutput(target2, value,
|
|
24392
|
+
if (finished || appendOutput(target2, value, input2.outputLimitBytes))
|
|
24250
24393
|
return;
|
|
24251
24394
|
rejectOnce(probeError("protocolError", "DeepSeek Harness --version exceeded the bounded output limit"), true);
|
|
24252
24395
|
};
|
|
@@ -24267,7 +24410,7 @@ async function captureVersionOutput(child, input, dependencies) {
|
|
|
24267
24410
|
finished = true;
|
|
24268
24411
|
if (code !== 0) {
|
|
24269
24412
|
reject({
|
|
24270
|
-
error:
|
|
24413
|
+
error: input2.invocationKind === "npx" ? probeError("notInstalled", "DeepSeek Harness package is not installed") : probeError("processExited", `DeepSeek Harness --version exited ${signal ? `with signal ${signal}` : `with code ${String(code)}`}`),
|
|
24271
24414
|
requiresCleanup: false
|
|
24272
24415
|
});
|
|
24273
24416
|
return;
|
|
@@ -24275,7 +24418,7 @@ async function captureVersionOutput(child, input, dependencies) {
|
|
|
24275
24418
|
resolve({ stdout: capturedText(stdout), stderr: capturedText(stderr) });
|
|
24276
24419
|
};
|
|
24277
24420
|
const onAbort = () => {
|
|
24278
|
-
rejectOnce(
|
|
24421
|
+
rejectOnce(input2.signal?.aborted ? probeError("cancelled", "DeepSeek Harness version probe was cancelled") : probeError("unavailable", "DeepSeek Harness version probe timed out"), true);
|
|
24279
24422
|
};
|
|
24280
24423
|
cleanup = () => {
|
|
24281
24424
|
childStdout?.off("data", onStdout);
|
|
@@ -24309,7 +24452,7 @@ async function captureVersionOutput(child, input, dependencies) {
|
|
|
24309
24452
|
stderrTail
|
|
24310
24453
|
});
|
|
24311
24454
|
}
|
|
24312
|
-
const cleanupError = await terminateVersionProcess(child, closeObserved ? Promise.resolve() : closed,
|
|
24455
|
+
const cleanupError = await terminateVersionProcess(child, closeObserved ? Promise.resolve() : closed, input2.cleanupTimeoutMs, dependencies);
|
|
24313
24456
|
if (cleanupError) {
|
|
24314
24457
|
throw probeError("processExited", "DeepSeek Harness version probe failed and its process cleanup did not complete", {
|
|
24315
24458
|
cause: new AggregateError([failure.error, cleanupError]),
|
|
@@ -24539,7 +24682,7 @@ function positiveSafeInteger2(value, name, maximum) {
|
|
|
24539
24682
|
}
|
|
24540
24683
|
var DEFAULT_DEPENDENCIES = {
|
|
24541
24684
|
spawn: (command, args, options) => spawn2(command, args, options),
|
|
24542
|
-
fetch: (
|
|
24685
|
+
fetch: (input2, init) => globalThis.fetch(input2, init),
|
|
24543
24686
|
createWebSocket: (url2, cookie, maxPayloadBytes) => new wrapper_default(url2, {
|
|
24544
24687
|
headers: { Cookie: cookie },
|
|
24545
24688
|
maxPayload: maxPayloadBytes
|
|
@@ -25456,14 +25599,14 @@ async function readBoundedJson(response, maxBytes) {
|
|
|
25456
25599
|
} finally {
|
|
25457
25600
|
reader.releaseLock();
|
|
25458
25601
|
}
|
|
25459
|
-
let
|
|
25602
|
+
let text2;
|
|
25460
25603
|
try {
|
|
25461
|
-
|
|
25604
|
+
text2 = new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks, bytes));
|
|
25462
25605
|
} catch {
|
|
25463
25606
|
throw new BoundedResponseProtocolError("DeepSeek Harness Remote response was not valid UTF-8");
|
|
25464
25607
|
}
|
|
25465
25608
|
try {
|
|
25466
|
-
return JSON.parse(
|
|
25609
|
+
return JSON.parse(text2);
|
|
25467
25610
|
} catch {
|
|
25468
25611
|
throw new BoundedResponseProtocolError("DeepSeek Harness Remote response was not valid JSON");
|
|
25469
25612
|
}
|
|
@@ -25585,13 +25728,13 @@ function assertBoundedJson(value) {
|
|
|
25585
25728
|
seen.delete(candidate);
|
|
25586
25729
|
};
|
|
25587
25730
|
visit(value, 0);
|
|
25588
|
-
let
|
|
25731
|
+
let text2;
|
|
25589
25732
|
try {
|
|
25590
|
-
|
|
25733
|
+
text2 = JSON.stringify(value);
|
|
25591
25734
|
} catch {
|
|
25592
25735
|
throw catalogError("protocolError", "DeepSeek Harness returned an invalid model catalog");
|
|
25593
25736
|
}
|
|
25594
|
-
if (Buffer3.byteLength(
|
|
25737
|
+
if (Buffer3.byteLength(text2, "utf8") > MAX_CATALOG_BYTES) {
|
|
25595
25738
|
throw catalogError("limitExceeded", "DeepSeek Harness model catalog exceeded its byte bound");
|
|
25596
25739
|
}
|
|
25597
25740
|
}
|
|
@@ -25661,8 +25804,8 @@ function validateBadge(value) {
|
|
|
25661
25804
|
if (!isPlainRecord(texts) || !Object.hasOwn(texts, "en")) {
|
|
25662
25805
|
throw catalogError("protocolError", "DeepSeek Harness returned an invalid Model badge");
|
|
25663
25806
|
}
|
|
25664
|
-
for (const
|
|
25665
|
-
boundedString(
|
|
25807
|
+
for (const text2 of Object.values(texts))
|
|
25808
|
+
boundedString(text2, MAX_NAME_LENGTH, "Model badge");
|
|
25666
25809
|
}
|
|
25667
25810
|
function groups(value, routable) {
|
|
25668
25811
|
let modelCount = 0;
|
|
@@ -26698,16 +26841,16 @@ function assertBoundedJson2(value) {
|
|
|
26698
26841
|
seen.delete(candidate);
|
|
26699
26842
|
};
|
|
26700
26843
|
visit(value, 0);
|
|
26701
|
-
let
|
|
26844
|
+
let text2;
|
|
26702
26845
|
try {
|
|
26703
|
-
|
|
26846
|
+
text2 = JSON.stringify(value);
|
|
26704
26847
|
} catch {
|
|
26705
26848
|
throw permissionError("protocolError", "DeepSeek Harness returned invalid permission catalog data");
|
|
26706
26849
|
}
|
|
26707
|
-
if (
|
|
26850
|
+
if (text2 === void 0) {
|
|
26708
26851
|
throw permissionError("protocolError", "DeepSeek Harness returned invalid permission catalog data");
|
|
26709
26852
|
}
|
|
26710
|
-
if (Buffer4.byteLength(
|
|
26853
|
+
if (Buffer4.byteLength(text2, "utf8") > MAX_CATALOG_BYTES2) {
|
|
26711
26854
|
throw permissionError("limitExceeded", "DeepSeek Harness permission catalog exceeded its byte bound");
|
|
26712
26855
|
}
|
|
26713
26856
|
}
|
|
@@ -26936,16 +27079,16 @@ function stateForSelection(nativeRef, selection3, catalog, permissionModeId) {
|
|
|
26936
27079
|
...permissionModeId ? { effectivePermissionModeId: permissionModeId } : {}
|
|
26937
27080
|
};
|
|
26938
27081
|
}
|
|
26939
|
-
function readModernConfigurationSnapshot(
|
|
26940
|
-
const rows =
|
|
27082
|
+
function readModernConfigurationSnapshot(input2) {
|
|
27083
|
+
const rows = input2.control.snapshot(input2.sessionId);
|
|
26941
27084
|
if (!rows) {
|
|
26942
27085
|
throw configurationError("protocolError", "DeepSeek Harness control state is detached");
|
|
26943
27086
|
}
|
|
26944
|
-
const model2 = readModernModelSelectionState(rows[MODERN_MODEL_SELECTION_PROJECTION_KEY],
|
|
26945
|
-
const permission = readModernPermissionModeState(rows[MODERN_PERMISSION_PROJECTION_KEY],
|
|
27087
|
+
const model2 = readModernModelSelectionState(rows[MODERN_MODEL_SELECTION_PROJECTION_KEY], input2.modelCatalog);
|
|
27088
|
+
const permission = readModernPermissionModeState(rows[MODERN_PERMISSION_PROJECTION_KEY], input2.permissionModes);
|
|
26946
27089
|
return {
|
|
26947
27090
|
model: model2,
|
|
26948
|
-
state: stateForSelection(
|
|
27091
|
+
state: stateForSelection(input2.nativeRef, model2.selection, input2.modelCatalog, permission?.permissionModeId),
|
|
26949
27092
|
...permission ? { permissionProjectionSeq: permission.projectionSeq } : {}
|
|
26950
27093
|
};
|
|
26951
27094
|
}
|
|
@@ -27873,7 +28016,7 @@ function isApprovalDisplayReason(value) {
|
|
|
27873
28016
|
const entries = Object.entries(value);
|
|
27874
28017
|
if (entries.length === 0)
|
|
27875
28018
|
return false;
|
|
27876
|
-
return entries.every(([locale,
|
|
28019
|
+
return entries.every(([locale, text2]) => locale.length > 0 && nonBlankString3(text2) && boundedString3(text2));
|
|
27877
28020
|
}
|
|
27878
28021
|
function parseQuestionRequest(value) {
|
|
27879
28022
|
if (!hasOnlyKeys(value, ["questions"], ["wait"]) || !Array.isArray(value.questions)) {
|
|
@@ -27973,7 +28116,7 @@ function validApprovalSubject(value) {
|
|
|
27973
28116
|
return isPlainRecord6(value) && hasOnlyKeys(value, ["name"], ["icon"]) && nonBlankString3(value.name) && (!Object.hasOwn(value, "icon") || boundedString3(value.icon));
|
|
27974
28117
|
}
|
|
27975
28118
|
function validApprovalDisplay(value) {
|
|
27976
|
-
return isPlainRecord6(value) && hasOnlyKeys(value, ["question"], ["detail", "approve"]) && Object.values(value).every((
|
|
28119
|
+
return isPlainRecord6(value) && hasOnlyKeys(value, ["question"], ["detail", "approve"]) && Object.values(value).every((text2) => isPlainRecord6(text2) && Object.hasOwn(text2, "en") && Object.values(text2).every((variant) => boundedString3(variant)));
|
|
27977
28120
|
}
|
|
27978
28121
|
function parseQuestionAnswer(value) {
|
|
27979
28122
|
if (!isPlainRecord6(value) || !hasExactKeys5(value, ["answers"]) || !Array.isArray(value.answers)) {
|
|
@@ -28489,15 +28632,15 @@ function resolveOptions(options) {
|
|
|
28489
28632
|
return resolved;
|
|
28490
28633
|
}
|
|
28491
28634
|
function assertWireBytes(value, maxBytes, label) {
|
|
28492
|
-
let
|
|
28635
|
+
let text2;
|
|
28493
28636
|
try {
|
|
28494
|
-
|
|
28637
|
+
text2 = JSON.stringify(value);
|
|
28495
28638
|
} catch {
|
|
28496
28639
|
throw protocolError(`${label} is not JSON-serializable`);
|
|
28497
28640
|
}
|
|
28498
|
-
if (
|
|
28641
|
+
if (text2 === void 0)
|
|
28499
28642
|
throw protocolError(`${label} is not a JSON value`);
|
|
28500
|
-
const bytes = Buffer.byteLength(
|
|
28643
|
+
const bytes = Buffer.byteLength(text2, "utf8");
|
|
28501
28644
|
if (bytes > maxBytes) {
|
|
28502
28645
|
throw limitError(`${label} exceeded maxRecordBytes`);
|
|
28503
28646
|
}
|
|
@@ -28710,8 +28853,8 @@ var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
28710
28853
|
".webm",
|
|
28711
28854
|
".webp"
|
|
28712
28855
|
]);
|
|
28713
|
-
function rewriteLocalMediaMarkdown(
|
|
28714
|
-
return projectLocalMedia(
|
|
28856
|
+
function rewriteLocalMediaMarkdown(text2, roots, options = {}) {
|
|
28857
|
+
return projectLocalMedia(text2, roots, options.exists ?? mediaFileExists, options.holdIncomplete === true, options.relativeImagesOnly === true).text;
|
|
28715
28858
|
}
|
|
28716
28859
|
var LocalMediaMarkdownStream = class {
|
|
28717
28860
|
#roots;
|
|
@@ -28740,8 +28883,8 @@ var LocalMediaMarkdownStream = class {
|
|
|
28740
28883
|
return this.#text;
|
|
28741
28884
|
}
|
|
28742
28885
|
/** Add native text and return the projected text it makes publishable, possibly empty. */
|
|
28743
|
-
append(
|
|
28744
|
-
this.#native +=
|
|
28886
|
+
append(text2) {
|
|
28887
|
+
this.#native += text2;
|
|
28745
28888
|
return this.#advance(true);
|
|
28746
28889
|
}
|
|
28747
28890
|
/** Return the projected text still held at the end of the stream. */
|
|
@@ -28763,89 +28906,89 @@ var LocalMediaMarkdownStream = class {
|
|
|
28763
28906
|
return delta;
|
|
28764
28907
|
}
|
|
28765
28908
|
};
|
|
28766
|
-
function projectLocalMedia(
|
|
28909
|
+
function projectLocalMedia(text2, roots, exists, holdIncomplete, relativeImagesOnly) {
|
|
28767
28910
|
let output = "";
|
|
28768
28911
|
let index = 0;
|
|
28769
28912
|
let fence = null;
|
|
28770
|
-
while (index <
|
|
28913
|
+
while (index < text2.length) {
|
|
28771
28914
|
if (fence) {
|
|
28772
|
-
const close = closingFenceEnd(
|
|
28915
|
+
const close = closingFenceEnd(text2, index, fence.marker, fence.length);
|
|
28773
28916
|
if (close === -1)
|
|
28774
28917
|
break;
|
|
28775
|
-
output +=
|
|
28918
|
+
output += text2.slice(index, close);
|
|
28776
28919
|
index = close;
|
|
28777
28920
|
fence = null;
|
|
28778
28921
|
continue;
|
|
28779
28922
|
}
|
|
28780
28923
|
const next = earliestIndex([
|
|
28781
|
-
|
|
28782
|
-
|
|
28783
|
-
indexOfLineStartTilde(
|
|
28924
|
+
text2.indexOf("![", index),
|
|
28925
|
+
text2.indexOf("`", index),
|
|
28926
|
+
indexOfLineStartTilde(text2, index)
|
|
28784
28927
|
]);
|
|
28785
28928
|
if (next === -1)
|
|
28786
28929
|
break;
|
|
28787
|
-
output +=
|
|
28930
|
+
output += text2.slice(index, next);
|
|
28788
28931
|
index = next;
|
|
28789
|
-
const marker =
|
|
28932
|
+
const marker = text2[next];
|
|
28790
28933
|
let markerLength = 1;
|
|
28791
28934
|
if (marker === "`" || marker === "~") {
|
|
28792
28935
|
let runEnd = next;
|
|
28793
|
-
while (
|
|
28936
|
+
while (text2[runEnd] === marker)
|
|
28794
28937
|
runEnd += 1;
|
|
28795
28938
|
markerLength = runEnd - next;
|
|
28796
|
-
if (runEnd ===
|
|
28939
|
+
if (runEnd === text2.length && holdIncomplete) {
|
|
28797
28940
|
return { text: output, consumed: next };
|
|
28798
28941
|
}
|
|
28799
28942
|
if (runEnd - next >= 3) {
|
|
28800
|
-
const kind = fenceLineKind(
|
|
28943
|
+
const kind = fenceLineKind(text2, next);
|
|
28801
28944
|
if (kind === "opaque")
|
|
28802
28945
|
break;
|
|
28803
28946
|
if (kind === "flat") {
|
|
28804
28947
|
fence = { marker, length: runEnd - next };
|
|
28805
|
-
output +=
|
|
28948
|
+
output += text2.slice(next, runEnd);
|
|
28806
28949
|
index = runEnd;
|
|
28807
28950
|
continue;
|
|
28808
28951
|
}
|
|
28809
28952
|
}
|
|
28810
28953
|
if (marker === "~") {
|
|
28811
|
-
output +=
|
|
28954
|
+
output += text2.slice(next, runEnd);
|
|
28812
28955
|
index = runEnd;
|
|
28813
28956
|
continue;
|
|
28814
28957
|
}
|
|
28815
28958
|
}
|
|
28816
|
-
if (
|
|
28817
|
-
const image = parseMarkdownImage(
|
|
28959
|
+
if (text2.startsWith("![", next)) {
|
|
28960
|
+
const image = parseMarkdownImage(text2, next);
|
|
28818
28961
|
if (image.kind === "text") {
|
|
28819
|
-
output +=
|
|
28962
|
+
output += text2.slice(next, image.end);
|
|
28820
28963
|
index = image.end;
|
|
28821
28964
|
continue;
|
|
28822
28965
|
}
|
|
28823
28966
|
if (image.kind === "open") {
|
|
28824
28967
|
if (!holdIncomplete)
|
|
28825
28968
|
break;
|
|
28826
|
-
return { text: output +
|
|
28969
|
+
return { text: output + text2.slice(next, image.holdFrom), consumed: image.holdFrom };
|
|
28827
28970
|
}
|
|
28828
28971
|
const resolved2 = relativeImagesOnly && /^(?:[\\/]|[a-z][a-z\d+.-]*:)/i.test(image.destination.trim()) ? null : resolveLocalMediaPath(image.destination, roots, exists);
|
|
28829
|
-
output += resolved2 === null ?
|
|
28972
|
+
output += resolved2 === null ? text2.slice(next, image.end) : text2.slice(next, image.destinationStart) + markdownDestination(resolved2, image.bracketed) + text2.slice(image.destinationEnd, image.end);
|
|
28830
28973
|
index = image.end;
|
|
28831
28974
|
continue;
|
|
28832
28975
|
}
|
|
28833
|
-
const code = parseInlineCode(
|
|
28834
|
-
if (code.kind !== "code" || holdIncomplete && code.end ===
|
|
28976
|
+
const code = parseInlineCode(text2, next, markerLength);
|
|
28977
|
+
if (code.kind !== "code" || holdIncomplete && code.end === text2.length) {
|
|
28835
28978
|
if (holdIncomplete && code.kind !== "text")
|
|
28836
28979
|
return { text: output, consumed: next };
|
|
28837
|
-
output +=
|
|
28980
|
+
output += text2.slice(next, next + markerLength);
|
|
28838
28981
|
index = next + markerLength;
|
|
28839
28982
|
continue;
|
|
28840
28983
|
}
|
|
28841
28984
|
const resolved = relativeImagesOnly || markerLength !== 1 || /[\r\n]/u.test(code.content) ? null : resolveLocalMediaPath(code.content, roots, exists);
|
|
28842
|
-
output += resolved === null ?
|
|
28985
|
+
output += resolved === null ? text2.slice(next, code.end) : mediaMarkdownImage(resolved);
|
|
28843
28986
|
index = code.end;
|
|
28844
28987
|
}
|
|
28845
|
-
return { text: output +
|
|
28988
|
+
return { text: output + text2.slice(index), consumed: text2.length };
|
|
28846
28989
|
}
|
|
28847
|
-
function fenceLineKind(
|
|
28848
|
-
const prefix =
|
|
28990
|
+
function fenceLineKind(text2, index) {
|
|
28991
|
+
const prefix = text2.slice(text2.lastIndexOf("\n", index - 1) + 1, index);
|
|
28849
28992
|
if (prefix === "")
|
|
28850
28993
|
return "flat";
|
|
28851
28994
|
let remaining = prefix.replace(/^[ \t]+/u, "");
|
|
@@ -28857,21 +29000,21 @@ function fenceLineKind(text, index) {
|
|
|
28857
29000
|
}
|
|
28858
29001
|
return "opaque";
|
|
28859
29002
|
}
|
|
28860
|
-
function indexOfLineStartTilde(
|
|
28861
|
-
for (let tilde =
|
|
28862
|
-
if (fenceLineKind(
|
|
29003
|
+
function indexOfLineStartTilde(text2, start) {
|
|
29004
|
+
for (let tilde = text2.indexOf("~", start); tilde !== -1; tilde = text2.indexOf("~", tilde + 1)) {
|
|
29005
|
+
if (fenceLineKind(text2, tilde) !== null)
|
|
28863
29006
|
return tilde;
|
|
28864
29007
|
}
|
|
28865
29008
|
return -1;
|
|
28866
29009
|
}
|
|
28867
|
-
function closingFenceEnd(
|
|
29010
|
+
function closingFenceEnd(text2, start, marker, length) {
|
|
28868
29011
|
const closing = new RegExp(`^ {0,3}${marker === "`" ? "`" : "~"}{${length},}[ \\t]*\\r?$`, "u");
|
|
28869
|
-
let lineStart =
|
|
29012
|
+
let lineStart = text2.indexOf("\n", start);
|
|
28870
29013
|
while (lineStart !== -1) {
|
|
28871
29014
|
lineStart += 1;
|
|
28872
|
-
const newline =
|
|
28873
|
-
const lineEnd = newline === -1 ?
|
|
28874
|
-
if (closing.test(
|
|
29015
|
+
const newline = text2.indexOf("\n", lineStart);
|
|
29016
|
+
const lineEnd = newline === -1 ? text2.length : newline;
|
|
29017
|
+
if (closing.test(text2.slice(lineStart, lineEnd)))
|
|
28875
29018
|
return lineEnd;
|
|
28876
29019
|
lineStart = newline;
|
|
28877
29020
|
}
|
|
@@ -28887,30 +29030,30 @@ function earliestIndex(candidates) {
|
|
|
28887
29030
|
}
|
|
28888
29031
|
return next;
|
|
28889
29032
|
}
|
|
28890
|
-
function parseInlineCode(
|
|
29033
|
+
function parseInlineCode(text2, start, length) {
|
|
28891
29034
|
let index = start + length;
|
|
28892
|
-
while (index <
|
|
28893
|
-
const tick =
|
|
28894
|
-
if (/\n[^\S\n]*\n/u.test(
|
|
29035
|
+
while (index < text2.length) {
|
|
29036
|
+
const tick = text2.indexOf("`", index);
|
|
29037
|
+
if (/\n[^\S\n]*\n/u.test(text2.slice(index, tick < 0 ? text2.length : tick))) {
|
|
28895
29038
|
return { kind: "text" };
|
|
28896
29039
|
}
|
|
28897
29040
|
if (tick === -1)
|
|
28898
29041
|
break;
|
|
28899
29042
|
let end = tick + 1;
|
|
28900
|
-
while (
|
|
29043
|
+
while (text2[end] === "`")
|
|
28901
29044
|
end += 1;
|
|
28902
29045
|
if (end - tick === length) {
|
|
28903
|
-
return { kind: "code", content:
|
|
29046
|
+
return { kind: "code", content: text2.slice(start + length, tick), end };
|
|
28904
29047
|
}
|
|
28905
29048
|
index = end;
|
|
28906
29049
|
}
|
|
28907
29050
|
return { kind: "open" };
|
|
28908
29051
|
}
|
|
28909
|
-
function parseMarkdownImage(
|
|
29052
|
+
function parseMarkdownImage(text2, start) {
|
|
28910
29053
|
const openLabel = { kind: "open", holdFrom: start + 2 };
|
|
28911
29054
|
let index = start + 2;
|
|
28912
|
-
while (index <
|
|
28913
|
-
const character =
|
|
29055
|
+
while (index < text2.length) {
|
|
29056
|
+
const character = text2[index];
|
|
28914
29057
|
if (character === "\n")
|
|
28915
29058
|
return { kind: "text", end: start + 1 };
|
|
28916
29059
|
if (character === "\\") {
|
|
@@ -28921,62 +29064,62 @@ function parseMarkdownImage(text, start) {
|
|
|
28921
29064
|
break;
|
|
28922
29065
|
index += 1;
|
|
28923
29066
|
}
|
|
28924
|
-
if (index + 1 >=
|
|
29067
|
+
if (index + 1 >= text2.length)
|
|
28925
29068
|
return openLabel;
|
|
28926
|
-
if (
|
|
29069
|
+
if (text2[index + 1] !== "(")
|
|
28927
29070
|
return { kind: "text", end: start + 1 };
|
|
28928
29071
|
const destinationStart = index + 2;
|
|
28929
29072
|
const open = { kind: "open", holdFrom: destinationStart };
|
|
28930
29073
|
const malformed = { kind: "text", end: destinationStart };
|
|
28931
|
-
index = skipBlanks(
|
|
28932
|
-
if (index >=
|
|
29074
|
+
index = skipBlanks(text2, destinationStart);
|
|
29075
|
+
if (index >= text2.length)
|
|
28933
29076
|
return open;
|
|
28934
29077
|
let destination;
|
|
28935
29078
|
let destinationEnd;
|
|
28936
29079
|
let bracketed = false;
|
|
28937
|
-
if (
|
|
29080
|
+
if (text2[index] === "<") {
|
|
28938
29081
|
bracketed = true;
|
|
28939
29082
|
let close = index + 1;
|
|
28940
|
-
while (close <
|
|
29083
|
+
while (close < text2.length && text2[close] !== ">" && text2[close] !== "\n")
|
|
28941
29084
|
close += 1;
|
|
28942
|
-
if (close >=
|
|
29085
|
+
if (close >= text2.length)
|
|
28943
29086
|
return open;
|
|
28944
|
-
if (
|
|
29087
|
+
if (text2[close] === "\n")
|
|
28945
29088
|
return malformed;
|
|
28946
|
-
destination =
|
|
29089
|
+
destination = text2.slice(index + 1, close);
|
|
28947
29090
|
destinationEnd = close + 1;
|
|
28948
29091
|
index = destinationEnd;
|
|
28949
29092
|
} else {
|
|
28950
29093
|
const begin = index;
|
|
28951
|
-
while (index <
|
|
28952
|
-
const character =
|
|
29094
|
+
while (index < text2.length) {
|
|
29095
|
+
const character = text2[index];
|
|
28953
29096
|
if (character === "\n" || character === " " || character === " " || character === ")")
|
|
28954
29097
|
break;
|
|
28955
29098
|
index += character === "\\" ? 2 : 1;
|
|
28956
29099
|
}
|
|
28957
|
-
if (index >=
|
|
29100
|
+
if (index >= text2.length)
|
|
28958
29101
|
return open;
|
|
28959
|
-
destination = unescapeMarkdown(
|
|
29102
|
+
destination = unescapeMarkdown(text2.slice(begin, index));
|
|
28960
29103
|
destinationEnd = index;
|
|
28961
29104
|
}
|
|
28962
|
-
index = skipBlanks(
|
|
28963
|
-
if (index >=
|
|
29105
|
+
index = skipBlanks(text2, index);
|
|
29106
|
+
if (index >= text2.length)
|
|
28964
29107
|
return open;
|
|
28965
|
-
const opener =
|
|
29108
|
+
const opener = text2[index];
|
|
28966
29109
|
if (opener === '"' || opener === "'" || opener === "(") {
|
|
28967
29110
|
const closer = opener === "(" ? ")" : opener;
|
|
28968
29111
|
index += 1;
|
|
28969
|
-
while (index <
|
|
29112
|
+
while (index < text2.length && text2[index] !== closer && text2[index] !== "\n")
|
|
28970
29113
|
index += 1;
|
|
28971
|
-
if (index >=
|
|
29114
|
+
if (index >= text2.length)
|
|
28972
29115
|
return open;
|
|
28973
|
-
if (
|
|
29116
|
+
if (text2[index] === "\n")
|
|
28974
29117
|
return malformed;
|
|
28975
|
-
index = skipBlanks(
|
|
28976
|
-
if (index >=
|
|
29118
|
+
index = skipBlanks(text2, index + 1);
|
|
29119
|
+
if (index >= text2.length)
|
|
28977
29120
|
return open;
|
|
28978
29121
|
}
|
|
28979
|
-
if (
|
|
29122
|
+
if (text2[index] !== ")")
|
|
28980
29123
|
return malformed;
|
|
28981
29124
|
return {
|
|
28982
29125
|
kind: "image",
|
|
@@ -28987,9 +29130,9 @@ function parseMarkdownImage(text, start) {
|
|
|
28987
29130
|
bracketed
|
|
28988
29131
|
};
|
|
28989
29132
|
}
|
|
28990
|
-
function skipBlanks(
|
|
29133
|
+
function skipBlanks(text2, start) {
|
|
28991
29134
|
let index = start;
|
|
28992
|
-
while (
|
|
29135
|
+
while (text2[index] === " " || text2[index] === " ")
|
|
28993
29136
|
index += 1;
|
|
28994
29137
|
return index;
|
|
28995
29138
|
}
|
|
@@ -29089,12 +29232,12 @@ function ptcDispatchItem(itemId, data) {
|
|
|
29089
29232
|
};
|
|
29090
29233
|
}
|
|
29091
29234
|
function ptcDispatchOutput(data, limit) {
|
|
29092
|
-
const
|
|
29093
|
-
if (!
|
|
29235
|
+
const text2 = contentText(data);
|
|
29236
|
+
if (!text2)
|
|
29094
29237
|
return void 0;
|
|
29095
|
-
const truncated =
|
|
29238
|
+
const truncated = text2.length > limit;
|
|
29096
29239
|
return {
|
|
29097
|
-
content: [{ type: "text", text: truncated ?
|
|
29240
|
+
content: [{ type: "text", text: truncated ? text2.slice(0, limit) : text2 }],
|
|
29098
29241
|
...truncated ? { truncated: true } : {}
|
|
29099
29242
|
};
|
|
29100
29243
|
}
|
|
@@ -29660,21 +29803,21 @@ function matchesModernForkHistory(expectedPrefix, childEvents, profile = DEEPSEE
|
|
|
29660
29803
|
}
|
|
29661
29804
|
return profile.matchesForkTail(expectedPrefix, childEvents);
|
|
29662
29805
|
}
|
|
29663
|
-
function projectModernHistory(
|
|
29664
|
-
if (!nonBlankString(
|
|
29806
|
+
function projectModernHistory(input2) {
|
|
29807
|
+
if (!nonBlankString(input2.sessionId))
|
|
29665
29808
|
throw new TypeError("sessionId must be a non-empty string");
|
|
29666
|
-
const harnessId =
|
|
29667
|
-
const profile =
|
|
29668
|
-
const toolOutputLimit = boundedInteger(
|
|
29669
|
-
const validator = new ModernEventValidator(
|
|
29809
|
+
const harnessId = input2.harnessId ?? DEEPSEEK_HARNESS_ID;
|
|
29810
|
+
const profile = input2.profile ?? DEEPSEEK_V4_PROFILE;
|
|
29811
|
+
const toolOutputLimit = boundedInteger(input2.toolOutputLimit ?? MODERN_TOOL_OUTPUT_LIMIT, "toolOutputLimit", 0);
|
|
29812
|
+
const validator = new ModernEventValidator(input2.maxEvents, profile);
|
|
29670
29813
|
const turns = [];
|
|
29671
29814
|
let active2 = null;
|
|
29672
|
-
let effectiveModel =
|
|
29673
|
-
let effectiveThinkingOptionId =
|
|
29815
|
+
let effectiveModel = input2.fallbackModel;
|
|
29816
|
+
let effectiveThinkingOptionId = input2.fallbackThinkingOptionId;
|
|
29674
29817
|
let contextWindowTokens;
|
|
29675
29818
|
let usage = null;
|
|
29676
|
-
let workingDirectory =
|
|
29677
|
-
const media =
|
|
29819
|
+
let workingDirectory = input2.cwd;
|
|
29820
|
+
const media = input2.media ?? input2.cwd !== void 0;
|
|
29678
29821
|
const rawUsageByStep = /* @__PURE__ */ new Map();
|
|
29679
29822
|
const rebuildUsage = () => {
|
|
29680
29823
|
usage = null;
|
|
@@ -29691,7 +29834,7 @@ function projectModernHistory(input) {
|
|
|
29691
29834
|
rawUsageByStep.set(`settlement:${eventSeq}`, raw);
|
|
29692
29835
|
rebuildUsage();
|
|
29693
29836
|
};
|
|
29694
|
-
for (const [index, event] of
|
|
29837
|
+
for (const [index, event] of input2.events.entries()) {
|
|
29695
29838
|
validator.accept(event);
|
|
29696
29839
|
if (!KNOWN_EVENT_TYPES.has(event.type) || !isRecord4(event.data))
|
|
29697
29840
|
continue;
|
|
@@ -29711,7 +29854,7 @@ function projectModernHistory(input) {
|
|
|
29711
29854
|
};
|
|
29712
29855
|
break;
|
|
29713
29856
|
case "model/selection": {
|
|
29714
|
-
const selection3 = selectionFrom(data,
|
|
29857
|
+
const selection3 = selectionFrom(data, input2.modelIndex);
|
|
29715
29858
|
effectiveModel = selection3.model;
|
|
29716
29859
|
effectiveThinkingOptionId = selection3.thinking;
|
|
29717
29860
|
if (active2)
|
|
@@ -29719,7 +29862,7 @@ function projectModernHistory(input) {
|
|
|
29719
29862
|
break;
|
|
29720
29863
|
}
|
|
29721
29864
|
case "request/header": {
|
|
29722
|
-
const selection3 = selectionFromHeader(data,
|
|
29865
|
+
const selection3 = selectionFromHeader(data, input2.modelIndex);
|
|
29723
29866
|
effectiveModel = selection3.model;
|
|
29724
29867
|
effectiveThinkingOptionId = selection3.thinking;
|
|
29725
29868
|
if (active2)
|
|
@@ -29742,7 +29885,7 @@ function projectModernHistory(input) {
|
|
|
29742
29885
|
if (event.surfaceOp === "append") {
|
|
29743
29886
|
recordSettlementUsage(data, event.seq);
|
|
29744
29887
|
if (active2) {
|
|
29745
|
-
projectAssistantMessage(active2,
|
|
29888
|
+
projectAssistantMessage(active2, input2.sessionId, data, media ? modernMediaRoots(workingDirectory, input2.cwd) : void 0);
|
|
29746
29889
|
}
|
|
29747
29890
|
}
|
|
29748
29891
|
break;
|
|
@@ -29755,7 +29898,7 @@ function projectModernHistory(input) {
|
|
|
29755
29898
|
active2.items.push({
|
|
29756
29899
|
item: {
|
|
29757
29900
|
type: "contextCompaction",
|
|
29758
|
-
itemId: modernItemId(
|
|
29901
|
+
itemId: modernItemId(input2.sessionId, `compaction:${nativeId}`)
|
|
29759
29902
|
},
|
|
29760
29903
|
outcome: { status: "succeeded" }
|
|
29761
29904
|
});
|
|
@@ -29775,20 +29918,20 @@ function projectModernHistory(input) {
|
|
|
29775
29918
|
break;
|
|
29776
29919
|
case "tool/call":
|
|
29777
29920
|
if (active2)
|
|
29778
|
-
projectToolCall(active2,
|
|
29921
|
+
projectToolCall(active2, input2.sessionId, data, event.seq);
|
|
29779
29922
|
break;
|
|
29780
29923
|
case "tool/result":
|
|
29781
29924
|
if (active2 && event.surfaceOp === "append") {
|
|
29782
|
-
projectToolResultEvent(active2,
|
|
29925
|
+
projectToolResultEvent(active2, input2.sessionId, event, toolOutputLimit);
|
|
29783
29926
|
}
|
|
29784
29927
|
break;
|
|
29785
29928
|
case "tool/ptc-dispatch-start":
|
|
29786
29929
|
if (active2)
|
|
29787
|
-
projectPtcDispatchStart(active2,
|
|
29930
|
+
projectPtcDispatchStart(active2, input2.sessionId, data, event.seq);
|
|
29788
29931
|
break;
|
|
29789
29932
|
case "tool/ptc-dispatch":
|
|
29790
29933
|
if (active2) {
|
|
29791
|
-
projectPtcDispatchSettle(active2,
|
|
29934
|
+
projectPtcDispatchSettle(active2, input2.sessionId, data, event.seq, toolOutputLimit);
|
|
29792
29935
|
}
|
|
29793
29936
|
break;
|
|
29794
29937
|
case "turn/end":
|
|
@@ -29808,8 +29951,8 @@ function projectModernHistory(input) {
|
|
|
29808
29951
|
};
|
|
29809
29952
|
}
|
|
29810
29953
|
turns.push({
|
|
29811
|
-
nativeTurnRef: modernNativeTurnRef(harnessId,
|
|
29812
|
-
checkpoint: modernCheckpointRef(harnessId,
|
|
29954
|
+
nativeTurnRef: modernNativeTurnRef(harnessId, input2.sessionId, active2.turn),
|
|
29955
|
+
checkpoint: modernCheckpointRef(harnessId, input2.sessionId, event.seq, profile),
|
|
29813
29956
|
input: active2.input,
|
|
29814
29957
|
items: active2.items,
|
|
29815
29958
|
outcome: terminal.history,
|
|
@@ -29824,7 +29967,7 @@ function projectModernHistory(input) {
|
|
|
29824
29967
|
}
|
|
29825
29968
|
const nativeRef = nativeSessionRefSchema.parse({
|
|
29826
29969
|
harnessId,
|
|
29827
|
-
nativeSessionId:
|
|
29970
|
+
nativeSessionId: input2.sessionId,
|
|
29828
29971
|
formatVersion: 1,
|
|
29829
29972
|
locator: { dshVersion: profile.version }
|
|
29830
29973
|
});
|
|
@@ -29836,12 +29979,12 @@ function projectModernHistory(input) {
|
|
|
29836
29979
|
return {
|
|
29837
29980
|
snapshot: { turns, state },
|
|
29838
29981
|
nativeRef,
|
|
29839
|
-
lastSeq:
|
|
29982
|
+
lastSeq: input2.events.length - 1,
|
|
29840
29983
|
effectiveModel,
|
|
29841
29984
|
effectiveThinkingOptionId,
|
|
29842
29985
|
contextWindowTokens,
|
|
29843
29986
|
usage,
|
|
29844
|
-
incompleteTurn: active2 ? { turn: active2.turn, events:
|
|
29987
|
+
incompleteTurn: active2 ? { turn: active2.turn, events: input2.events.slice(active2.startIndex) } : void 0
|
|
29845
29988
|
};
|
|
29846
29989
|
}
|
|
29847
29990
|
function modernNativeTurnRef(harnessId, sessionId, turn) {
|
|
@@ -29896,12 +30039,12 @@ function projectAssistantMessage(turn, sessionId, data, mediaRoots) {
|
|
|
29896
30039
|
};
|
|
29897
30040
|
turn.items.push({ item, outcome: { status: "succeeded" } });
|
|
29898
30041
|
}
|
|
29899
|
-
const
|
|
29900
|
-
if (
|
|
30042
|
+
const text2 = contentByType(message.content, "text");
|
|
30043
|
+
if (text2) {
|
|
29901
30044
|
const item = {
|
|
29902
30045
|
type: "agentMessage",
|
|
29903
30046
|
itemId: modernItemId(sessionId, `turn:${turn.turn}:step:${String(data.step)}:assistant`),
|
|
29904
|
-
text: mediaRoots ? rewriteLocalMediaMarkdown(
|
|
30047
|
+
text: mediaRoots ? rewriteLocalMediaMarkdown(text2, mediaRoots) : text2
|
|
29905
30048
|
};
|
|
29906
30049
|
turn.items.push({ item, outcome: { status: "succeeded" } });
|
|
29907
30050
|
}
|
|
@@ -30269,7 +30412,7 @@ function isApprovalDisplayReason2(value) {
|
|
|
30269
30412
|
const entries = Object.entries(value);
|
|
30270
30413
|
if (entries.length === 0)
|
|
30271
30414
|
return false;
|
|
30272
|
-
return entries.every(([locale,
|
|
30415
|
+
return entries.every(([locale, text2]) => locale.length > 0 && typeof text2 === "string" && text2.length > 0 && nonBlankString(text2));
|
|
30273
30416
|
}
|
|
30274
30417
|
function validateApprovalDecided(data) {
|
|
30275
30418
|
exactKeys(data, ["id", "outcome"]);
|
|
@@ -30718,6 +30861,7 @@ var ModernHarnessSession = class {
|
|
|
30718
30861
|
#acceptedCorrelationTimeoutMs;
|
|
30719
30862
|
#onClosed;
|
|
30720
30863
|
#flushSession;
|
|
30864
|
+
#managedProcessStop;
|
|
30721
30865
|
#fallbackModel;
|
|
30722
30866
|
#fallbackThinkingOptionId;
|
|
30723
30867
|
#sessionDirectory;
|
|
@@ -30754,7 +30898,8 @@ var ModernHarnessSession = class {
|
|
|
30754
30898
|
#closedNotified = false;
|
|
30755
30899
|
#faulted;
|
|
30756
30900
|
#faultMayHaveNativeWork = false;
|
|
30757
|
-
#
|
|
30901
|
+
#closeStopUnconfirmed = false;
|
|
30902
|
+
#localClosePromise;
|
|
30758
30903
|
#pumpPromise;
|
|
30759
30904
|
constructor(options) {
|
|
30760
30905
|
if (!options.sessionId || options.sessionId.trim() === "") {
|
|
@@ -30785,6 +30930,7 @@ var ModernHarnessSession = class {
|
|
|
30785
30930
|
this.#acceptedCorrelationTimeoutMs = safeTimerDelay(options.acceptedCorrelationTimeoutMs ?? MODERN_ACCEPTED_CORRELATION_TIMEOUT_MS, "acceptedCorrelationTimeoutMs");
|
|
30786
30931
|
this.#onClosed = options.onClosed ?? (() => void 0);
|
|
30787
30932
|
this.#flushSession = options.flushSession;
|
|
30933
|
+
this.#managedProcessStop = options.managedProcessStop;
|
|
30788
30934
|
this.#events = [...options.journal.events];
|
|
30789
30935
|
this.#historyBytes = journalHistoryBytes(this.#events, this.#maxHistoryBytes);
|
|
30790
30936
|
this.#validator = new ModernEventValidator(this.#maxEvents, this.#profile);
|
|
@@ -30918,15 +31064,26 @@ var ModernHarnessSession = class {
|
|
|
30918
31064
|
}
|
|
30919
31065
|
}
|
|
30920
31066
|
close() {
|
|
30921
|
-
|
|
30922
|
-
|
|
30923
|
-
this.#
|
|
30924
|
-
|
|
30925
|
-
|
|
30926
|
-
|
|
30927
|
-
|
|
30928
|
-
|
|
30929
|
-
|
|
31067
|
+
this.#localClosePromise ??= this.#performClose();
|
|
31068
|
+
return this.#localClosePromise.then(() => {
|
|
31069
|
+
if (!this.#faultMayHaveNativeWork)
|
|
31070
|
+
return;
|
|
31071
|
+
const processStop = this.#managedProcessStop?.();
|
|
31072
|
+
if (processStop)
|
|
31073
|
+
return processStop;
|
|
31074
|
+
throw new Error("DeepSeek Harness native execution stop was not confirmed before the Session fault");
|
|
31075
|
+
}, (error51) => {
|
|
31076
|
+
if (this.#faulted || this.#closeStopUnconfirmed) {
|
|
31077
|
+
const processStop = this.#managedProcessStop?.();
|
|
31078
|
+
if (processStop)
|
|
31079
|
+
return processStop;
|
|
31080
|
+
}
|
|
31081
|
+
throw error51;
|
|
31082
|
+
});
|
|
31083
|
+
}
|
|
31084
|
+
/** Adapter-owned local teardown drain after fault; never waits on managed process exit. */
|
|
31085
|
+
async waitForFaultCleanup() {
|
|
31086
|
+
await this.#localClosePromise?.catch(() => void 0);
|
|
30930
31087
|
}
|
|
30931
31088
|
/** Adapter-owned transport/control fault convergence. */
|
|
30932
31089
|
fault(error51) {
|
|
@@ -31404,7 +31561,7 @@ ${question.detail}` : question.question;
|
|
|
31404
31561
|
}
|
|
31405
31562
|
}
|
|
31406
31563
|
async #start(command) {
|
|
31407
|
-
if (!Array.isArray(command.input) || command.input.length === 0 || command.input.some((part) => part.type !== "text" || typeof part.text !== "string") || !command.input.some(({ text }) =>
|
|
31564
|
+
if (!Array.isArray(command.input) || command.input.length === 0 || command.input.some((part) => part.type !== "text" || typeof part.text !== "string") || !command.input.some(({ text: text2 }) => text2.trim().length > 0)) {
|
|
31408
31565
|
return {
|
|
31409
31566
|
ok: false,
|
|
31410
31567
|
error: {
|
|
@@ -31456,7 +31613,7 @@ ${question.detail}` : question.question;
|
|
|
31456
31613
|
requestId,
|
|
31457
31614
|
sessionId: this.#sessionId,
|
|
31458
31615
|
mode: "queue",
|
|
31459
|
-
content: command.input.map(({ text }) => ({ type: "text", text }))
|
|
31616
|
+
content: command.input.map(({ text: text2 }) => ({ type: "text", text: text2 }))
|
|
31460
31617
|
}
|
|
31461
31618
|
}, abort.signal), abort.signal);
|
|
31462
31619
|
if (!response.ok) {
|
|
@@ -32220,14 +32377,14 @@ ${question.detail}` : question.question;
|
|
|
32220
32377
|
});
|
|
32221
32378
|
this.#materialize(buffer, turnId, buffer.input, true, initialReplay);
|
|
32222
32379
|
}
|
|
32223
|
-
#materialize(buffer, turnId,
|
|
32380
|
+
#materialize(buffer, turnId, input2, autonomous, initialReplay) {
|
|
32224
32381
|
if (buffer.active || this.#active) {
|
|
32225
32382
|
throw new ModernHistoryError("protocolError", "Modern Host Turns overlap");
|
|
32226
32383
|
}
|
|
32227
32384
|
const active2 = {
|
|
32228
32385
|
turnId,
|
|
32229
32386
|
nativeTurn: buffer.nativeTurn,
|
|
32230
|
-
input: [...
|
|
32387
|
+
input: [...input2],
|
|
32231
32388
|
autonomous,
|
|
32232
32389
|
tools: /* @__PURE__ */ new Map(),
|
|
32233
32390
|
advertisedTools: /* @__PURE__ */ new Map(),
|
|
@@ -32341,8 +32498,8 @@ ${question.detail}` : question.question;
|
|
|
32341
32498
|
this.#publishUsageChanges(active2.turnId);
|
|
32342
32499
|
}
|
|
32343
32500
|
}
|
|
32344
|
-
#appendAgent(active2,
|
|
32345
|
-
if (!
|
|
32501
|
+
#appendAgent(active2, text2, step, attemptId) {
|
|
32502
|
+
if (!text2)
|
|
32346
32503
|
return;
|
|
32347
32504
|
if (!active2.agent) {
|
|
32348
32505
|
const item = {
|
|
@@ -32356,8 +32513,8 @@ ${question.detail}` : question.question;
|
|
|
32356
32513
|
active2.agent = { item, text: "", media: new LocalMediaMarkdownStream(roots) };
|
|
32357
32514
|
this.#emit({ type: "item.started", turnId: active2.turnId, item });
|
|
32358
32515
|
}
|
|
32359
|
-
active2.agent.text +=
|
|
32360
|
-
this.#publishAgent(active2, active2.agent, active2.agent.media.append(
|
|
32516
|
+
active2.agent.text += text2;
|
|
32517
|
+
this.#publishAgent(active2, active2.agent, active2.agent.media.append(text2));
|
|
32361
32518
|
}
|
|
32362
32519
|
/** Publish text the media projection held for a trailing construct before the Item ends. */
|
|
32363
32520
|
#flushAgent(active2, agent) {
|
|
@@ -32393,11 +32550,11 @@ ${question.detail}` : question.question;
|
|
|
32393
32550
|
}
|
|
32394
32551
|
return active2.reasoning;
|
|
32395
32552
|
}
|
|
32396
|
-
#appendReasoning(active2,
|
|
32397
|
-
if (!
|
|
32553
|
+
#appendReasoning(active2, text2, step, provisional = false, attemptId, final = false) {
|
|
32554
|
+
if (!text2)
|
|
32398
32555
|
return;
|
|
32399
32556
|
const reasoning2 = this.#startReasoning(active2, step, provisional, attemptId);
|
|
32400
|
-
const candidate = final ?
|
|
32557
|
+
const candidate = final ? text2 : reasoning2.pendingLineBreaks + text2;
|
|
32401
32558
|
const appended = final ? candidate : candidate.replace(/[\r\n]+$/u, "");
|
|
32402
32559
|
reasoning2.pendingLineBreaks = final ? "" : candidate.slice(appended.length);
|
|
32403
32560
|
if (!appended)
|
|
@@ -32425,11 +32582,11 @@ ${question.detail}` : question.question;
|
|
|
32425
32582
|
}
|
|
32426
32583
|
}
|
|
32427
32584
|
const reasoning2 = contentText2(message.content, "reasoning");
|
|
32428
|
-
const
|
|
32429
|
-
if (active2.agent && !
|
|
32585
|
+
const text2 = contentText2(message.content, "text");
|
|
32586
|
+
if (active2.agent && !text2.startsWith(active2.agent.text))
|
|
32430
32587
|
this.#cancelAgentItem(active2);
|
|
32431
32588
|
this.#completeReasoning(active2, reasoning2, step);
|
|
32432
|
-
this.#completeAgentPrefix(active2,
|
|
32589
|
+
this.#completeAgentPrefix(active2, text2, step);
|
|
32433
32590
|
}
|
|
32434
32591
|
#completeReasoning(active2, finalText, step) {
|
|
32435
32592
|
if (active2.reasoning && !finalText.startsWith(active2.reasoning.text)) {
|
|
@@ -32673,7 +32830,8 @@ ${question.detail}` : question.question;
|
|
|
32673
32830
|
}
|
|
32674
32831
|
this.#settleAllPromptCorrelationGraces({ kind: "fault", error: failure });
|
|
32675
32832
|
this.#abortOperations();
|
|
32676
|
-
this.#
|
|
32833
|
+
this.#nativeCloseTerminal?.();
|
|
32834
|
+
this.#localClosePromise ??= this.#performFault(failure, acceptedPending);
|
|
32677
32835
|
}
|
|
32678
32836
|
async #performFault(failure, acceptedPending) {
|
|
32679
32837
|
await this.#detachEvents().catch(() => void 0);
|
|
@@ -32743,7 +32901,7 @@ ${question.detail}` : question.question;
|
|
|
32743
32901
|
let timer;
|
|
32744
32902
|
const terminal = new Promise((resolve) => {
|
|
32745
32903
|
this.#nativeCloseTerminal = () => {
|
|
32746
|
-
if (activeAtClose?.terminal)
|
|
32904
|
+
if (activeAtClose?.terminal || this.#faulted)
|
|
32747
32905
|
resolve();
|
|
32748
32906
|
};
|
|
32749
32907
|
});
|
|
@@ -32827,14 +32985,18 @@ ${question.detail}` : question.question;
|
|
|
32827
32985
|
this.#channel.end();
|
|
32828
32986
|
}
|
|
32829
32987
|
await Promise.allSettled([this.#journal.close(), this.#pumpPromise]);
|
|
32988
|
+
let flushFailure;
|
|
32830
32989
|
try {
|
|
32831
32990
|
await this.#flushSession?.();
|
|
32832
32991
|
} catch (error51) {
|
|
32992
|
+
flushFailure = error51;
|
|
32833
32993
|
stopFailure ??= error51;
|
|
32834
32994
|
}
|
|
32835
32995
|
this.#notifyClosed();
|
|
32836
|
-
if (stopFailure)
|
|
32996
|
+
if (stopFailure) {
|
|
32997
|
+
this.#closeStopUnconfirmed = !flushFailure;
|
|
32837
32998
|
throw stopFailure;
|
|
32999
|
+
}
|
|
32838
33000
|
}
|
|
32839
33001
|
#abortOperations() {
|
|
32840
33002
|
for (const controller of this.#operationControllers) {
|
|
@@ -33121,11 +33283,11 @@ function ptcDispatchQuestionOutcome(data) {
|
|
|
33121
33283
|
function pendingQuestionPayload(content) {
|
|
33122
33284
|
if (!Array.isArray(content))
|
|
33123
33285
|
return false;
|
|
33124
|
-
const
|
|
33125
|
-
if (!isRecord4(
|
|
33286
|
+
const text2 = content.find((block) => isRecord4(block) && block.type === "text");
|
|
33287
|
+
if (!isRecord4(text2) || typeof text2.text !== "string")
|
|
33126
33288
|
return false;
|
|
33127
33289
|
try {
|
|
33128
|
-
const parsed = JSON.parse(
|
|
33290
|
+
const parsed = JSON.parse(text2.text);
|
|
33129
33291
|
return isRecord4(parsed) && parsed.pending === true;
|
|
33130
33292
|
} catch {
|
|
33131
33293
|
return false;
|
|
@@ -33281,16 +33443,16 @@ function assertBoundedJson4(value) {
|
|
|
33281
33443
|
ancestors.delete(candidate);
|
|
33282
33444
|
};
|
|
33283
33445
|
visit(value, 0);
|
|
33284
|
-
let
|
|
33446
|
+
let text2;
|
|
33285
33447
|
try {
|
|
33286
|
-
|
|
33448
|
+
text2 = JSON.stringify(value);
|
|
33287
33449
|
} catch {
|
|
33288
33450
|
throw sessionListError("protocolError", "DeepSeek Harness returned an invalid Session list");
|
|
33289
33451
|
}
|
|
33290
|
-
if (
|
|
33452
|
+
if (text2 === void 0) {
|
|
33291
33453
|
throw sessionListError("protocolError", "DeepSeek Harness returned an invalid Session list");
|
|
33292
33454
|
}
|
|
33293
|
-
if (Buffer5.byteLength(
|
|
33455
|
+
if (Buffer5.byteLength(text2, "utf8") > MAX_SESSION_LIST_BYTES) {
|
|
33294
33456
|
throw sessionListError("limitExceeded", "DeepSeek Harness Session list exceeded its byte bound");
|
|
33295
33457
|
}
|
|
33296
33458
|
}
|
|
@@ -33434,8 +33596,10 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33434
33596
|
#permissionModesLoaded = false;
|
|
33435
33597
|
#permissionModesPromise;
|
|
33436
33598
|
#closePromise;
|
|
33599
|
+
#faultStopPromise;
|
|
33437
33600
|
#fault;
|
|
33438
33601
|
#declaredEventFailure;
|
|
33602
|
+
#faultNotified = false;
|
|
33439
33603
|
#normalClose = false;
|
|
33440
33604
|
#eventRecovery;
|
|
33441
33605
|
#eventReplacementUsed = false;
|
|
@@ -33447,6 +33611,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33447
33611
|
...options
|
|
33448
33612
|
};
|
|
33449
33613
|
delete connectionOptions.version;
|
|
33614
|
+
delete connectionOptions.onFault;
|
|
33450
33615
|
this.#connection = this.#dependencies.createConnection(connectionOptions);
|
|
33451
33616
|
if (options.openWebUi && this.#connection.openWebUi) {
|
|
33452
33617
|
this.webUi = Object.freeze({
|
|
@@ -33465,30 +33630,26 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33465
33630
|
this.#fail(toHarnessError(error51, "unavailable"));
|
|
33466
33631
|
});
|
|
33467
33632
|
}
|
|
33468
|
-
inspect(
|
|
33469
|
-
return this.#track(this.#inspect(
|
|
33633
|
+
inspect(input2 = {}) {
|
|
33634
|
+
return this.#track(this.#inspect(input2.refresh === true));
|
|
33470
33635
|
}
|
|
33471
|
-
open(
|
|
33636
|
+
open(input2) {
|
|
33472
33637
|
if (!this.#accepting)
|
|
33473
33638
|
return Promise.resolve({ ok: false, error: this.#stoppedError() });
|
|
33474
|
-
const rejected = validateOpen(
|
|
33639
|
+
const rejected = validateOpen(input2);
|
|
33475
33640
|
if (rejected)
|
|
33476
33641
|
return Promise.resolve({ ok: false, error: rejected });
|
|
33477
|
-
return this.#track(this.#open(
|
|
33642
|
+
return this.#track(this.#open(input2));
|
|
33478
33643
|
}
|
|
33479
33644
|
close() {
|
|
33480
33645
|
if (!this.#closePromise) {
|
|
33481
33646
|
this.#accepting = false;
|
|
33482
33647
|
const failure = this.#declaredEventFailure;
|
|
33483
33648
|
if (failure) {
|
|
33484
|
-
this.#
|
|
33485
|
-
await this.#events.fail(failure).catch(() => void 0);
|
|
33486
|
-
await this.#performClose(this.#fault ?? failure);
|
|
33487
|
-
})();
|
|
33488
|
-
} else {
|
|
33489
|
-
this.#normalClose = true;
|
|
33490
|
-
this.#closePromise = this.#performClose();
|
|
33649
|
+
return this.#startFaultClose(failure, true);
|
|
33491
33650
|
}
|
|
33651
|
+
this.#normalClose = true;
|
|
33652
|
+
this.#closePromise = this.#performNormalClose();
|
|
33492
33653
|
}
|
|
33493
33654
|
return this.#closePromise;
|
|
33494
33655
|
}
|
|
@@ -33538,18 +33699,18 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33538
33699
|
return { ok: false, error: toHarnessError(error51, "unavailable") };
|
|
33539
33700
|
}
|
|
33540
33701
|
}
|
|
33541
|
-
async #open(
|
|
33702
|
+
async #open(input2) {
|
|
33542
33703
|
let detachControl;
|
|
33543
33704
|
let journal;
|
|
33544
33705
|
let reservedSessionId;
|
|
33545
33706
|
let session;
|
|
33546
33707
|
let forkExpectation;
|
|
33547
33708
|
try {
|
|
33548
|
-
const cwd = path11.resolve(
|
|
33549
|
-
let forkInput =
|
|
33550
|
-
const rollbackSourceSessionId =
|
|
33709
|
+
const cwd = path11.resolve(input2.cwd);
|
|
33710
|
+
let forkInput = input2.kind === "fork" ? parseModernForkInput(input2, this.#profile) : void 0;
|
|
33711
|
+
const rollbackSourceSessionId = input2.kind === "rollbackLastTurn" ? modernSessionId(input2.sourceRef, "roll back") : void 0;
|
|
33551
33712
|
let rollbackPlan;
|
|
33552
|
-
let sessionId =
|
|
33713
|
+
let sessionId = input2.kind === "create" ? `session-${this.#dependencies.randomUUID()}` : input2.kind === "resume" ? modernSessionId(input2.nativeRef, "resume") : void 0;
|
|
33553
33714
|
if (sessionId) {
|
|
33554
33715
|
if (this.#sessionIds.has(sessionId)) {
|
|
33555
33716
|
throw new AdapterOperationError({
|
|
@@ -33568,7 +33729,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33568
33729
|
this.#assertAccepting();
|
|
33569
33730
|
const permissionModes = await this.#loadPermissionModes(false);
|
|
33570
33731
|
this.#assertAccepting();
|
|
33571
|
-
const createConfiguration =
|
|
33732
|
+
const createConfiguration = input2.kind === "create" ? resolveCreateConfiguration(input2, catalog, permissionModes) : void 0;
|
|
33572
33733
|
try {
|
|
33573
33734
|
await this.#control.start();
|
|
33574
33735
|
} catch (error51) {
|
|
@@ -33609,7 +33770,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33609
33770
|
}
|
|
33610
33771
|
if (!sessionId)
|
|
33611
33772
|
throw new Error("unreachable Session open mode");
|
|
33612
|
-
if (
|
|
33773
|
+
if (input2.kind === "create" || rollbackPlan?.kind === "create") {
|
|
33613
33774
|
await this.#createSession(sessionId, cwd, rollbackPlan?.kind === "create" ? rollbackPlan.agentPreset : void 0);
|
|
33614
33775
|
this.#assertAccepting();
|
|
33615
33776
|
if (createConfiguration?.model) {
|
|
@@ -33686,6 +33847,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33686
33847
|
permissionModes,
|
|
33687
33848
|
sessionId,
|
|
33688
33849
|
flushSession: () => this.#connection.flushSession(sessionId),
|
|
33850
|
+
managedProcessStop: () => this.#faultStopPromise,
|
|
33689
33851
|
randomUUID: this.#dependencies.randomUUID,
|
|
33690
33852
|
now: this.#dependencies.now,
|
|
33691
33853
|
...this.#options.toolOutputLimit === void 0 ? {} : { toolOutputLimit: this.#options.toolOutputLimit },
|
|
@@ -33707,10 +33869,10 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33707
33869
|
this.#sessions.add(openedSession);
|
|
33708
33870
|
await this.#startEvents();
|
|
33709
33871
|
this.#assertAccepting();
|
|
33710
|
-
if (
|
|
33872
|
+
if (input2.kind === "resume" && input2.permissionModeId) {
|
|
33711
33873
|
const restored = await openedSession.execute({
|
|
33712
33874
|
type: "permissionMode.select",
|
|
33713
|
-
permissionModeId:
|
|
33875
|
+
permissionModeId: input2.permissionModeId
|
|
33714
33876
|
});
|
|
33715
33877
|
if (!restored.ok)
|
|
33716
33878
|
throw new AdapterOperationError(restored.error);
|
|
@@ -33731,7 +33893,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33731
33893
|
}
|
|
33732
33894
|
return {
|
|
33733
33895
|
ok: false,
|
|
33734
|
-
error:
|
|
33896
|
+
error: input2.kind === "fork" ? { ...failure, retryable: false } : failure
|
|
33735
33897
|
};
|
|
33736
33898
|
}
|
|
33737
33899
|
}
|
|
@@ -33811,27 +33973,27 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33811
33973
|
await source.close();
|
|
33812
33974
|
}
|
|
33813
33975
|
}
|
|
33814
|
-
async #forkSession(
|
|
33976
|
+
async #forkSession(input2, cwd, catalog) {
|
|
33815
33977
|
const source = await openModernJournal(this.#connection, {
|
|
33816
|
-
sessionId:
|
|
33978
|
+
sessionId: input2.sourceSessionId,
|
|
33817
33979
|
cwd
|
|
33818
33980
|
}, this.#journalOptions());
|
|
33819
33981
|
let atSeq;
|
|
33820
33982
|
let seedLength;
|
|
33821
33983
|
try {
|
|
33822
|
-
const boundary = resolveModernForkBoundary(source.events,
|
|
33984
|
+
const boundary = resolveModernForkBoundary(source.events, input2.checkpointId, this.#profile);
|
|
33823
33985
|
if (!boundary)
|
|
33824
33986
|
throw forkCheckpointError();
|
|
33825
33987
|
const projected = projectModernHistory({
|
|
33826
33988
|
modelIndex: catalog.index,
|
|
33827
33989
|
harnessId: this.harnessId,
|
|
33828
|
-
sessionId:
|
|
33990
|
+
sessionId: input2.sourceSessionId,
|
|
33829
33991
|
events: boundary.events,
|
|
33830
33992
|
profile: this.#profile,
|
|
33831
33993
|
...this.#options.toolOutputLimit === void 0 ? {} : { toolOutputLimit: this.#options.toolOutputLimit },
|
|
33832
33994
|
...this.#options.maxEvents === void 0 ? {} : { maxEvents: this.#options.maxEvents }
|
|
33833
33995
|
});
|
|
33834
|
-
if (projected.incompleteTurn || projected.snapshot.turns.at(-1)?.checkpoint?.checkpointId !==
|
|
33996
|
+
if (projected.incompleteTurn || projected.snapshot.turns.at(-1)?.checkpoint?.checkpointId !== input2.checkpointId) {
|
|
33835
33997
|
throw forkCheckpointError();
|
|
33836
33998
|
}
|
|
33837
33999
|
atSeq = boundary.atSeq;
|
|
@@ -33840,14 +34002,14 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33840
34002
|
await source.close();
|
|
33841
34003
|
}
|
|
33842
34004
|
this.#assertAccepting();
|
|
33843
|
-
const result = await this.#connection.call("session/fork", { request: { sessionId:
|
|
34005
|
+
const result = await this.#connection.call("session/fork", { request: { sessionId: input2.sourceSessionId, atSeq } }, this.#lifetime.signal);
|
|
33844
34006
|
if (!result.ok)
|
|
33845
34007
|
throw new AdapterOperationError(forkRemoteFailure(result.error));
|
|
33846
|
-
if (!isRecord8(result.value) || !hasExactOptionalKeys(result.value, ["sessionId"], []) || typeof result.value.sessionId !== "string" || result.value.sessionId.trim() === "" || result.value.sessionId ===
|
|
34008
|
+
if (!isRecord8(result.value) || !hasExactOptionalKeys(result.value, ["sessionId"], []) || typeof result.value.sessionId !== "string" || result.value.sessionId.trim() === "" || result.value.sessionId === input2.sourceSessionId) {
|
|
33847
34009
|
throw forkProtocolError();
|
|
33848
34010
|
}
|
|
33849
34011
|
return {
|
|
33850
|
-
...
|
|
34012
|
+
...input2,
|
|
33851
34013
|
childSessionId: result.value.sessionId,
|
|
33852
34014
|
atSeq,
|
|
33853
34015
|
seedLength
|
|
@@ -33968,6 +34130,15 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33968
34130
|
...normalized.stderrTail || !stderrTail ? {} : { stderrTail: sanitizeDiagnosticTail(stderrTail) }
|
|
33969
34131
|
});
|
|
33970
34132
|
}
|
|
34133
|
+
#notifyFault(error51) {
|
|
34134
|
+
if (this.#faultNotified)
|
|
34135
|
+
return;
|
|
34136
|
+
this.#faultNotified = true;
|
|
34137
|
+
try {
|
|
34138
|
+
this.#options.onFault?.(error51);
|
|
34139
|
+
} catch {
|
|
34140
|
+
}
|
|
34141
|
+
}
|
|
33971
34142
|
#fail(error51) {
|
|
33972
34143
|
if (this.#fault || this.#normalClose)
|
|
33973
34144
|
return;
|
|
@@ -33975,19 +34146,20 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
33975
34146
|
this.#fault = failure;
|
|
33976
34147
|
this.#accepting = false;
|
|
33977
34148
|
this.#lifetime.abort(new Error("DeepSeek Harness Adapter faulted"));
|
|
34149
|
+
this.#startFaultClose(failure);
|
|
34150
|
+
this.#closePromise?.catch(() => void 0);
|
|
33978
34151
|
for (const session of this.#sessions)
|
|
33979
34152
|
session.fault(failure);
|
|
33980
|
-
|
|
33981
|
-
return;
|
|
33982
|
-
this.#closePromise = this.#performClose(failure);
|
|
33983
|
-
this.#closePromise.catch(() => void 0);
|
|
34153
|
+
this.#notifyFault(failure);
|
|
33984
34154
|
}
|
|
33985
34155
|
#sealEventFailure(error51) {
|
|
33986
34156
|
if (this.#fault || this.#normalClose || this.#declaredEventFailure)
|
|
33987
34157
|
return;
|
|
33988
|
-
|
|
34158
|
+
const failure = sanitizedHarnessError2(error51);
|
|
34159
|
+
this.#declaredEventFailure = failure;
|
|
33989
34160
|
this.#accepting = false;
|
|
33990
34161
|
this.#lifetime.abort(new Error("DeepSeek Harness event gateway failed"));
|
|
34162
|
+
this.#notifyFault(failure);
|
|
33991
34163
|
}
|
|
33992
34164
|
#recoverEvents(error51) {
|
|
33993
34165
|
if (!this.#accepting || this.#eventRecovery)
|
|
@@ -34012,20 +34184,38 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
34012
34184
|
this.#assertAccepting();
|
|
34013
34185
|
await this.#events.start();
|
|
34014
34186
|
}
|
|
34015
|
-
|
|
34187
|
+
#startFaultClose(failure, failEventsFirst = false) {
|
|
34188
|
+
if (!this.#closePromise) {
|
|
34189
|
+
const processStop = (async () => {
|
|
34190
|
+
if (failEventsFirst)
|
|
34191
|
+
await this.#events.fail(failure).catch(() => void 0);
|
|
34192
|
+
await this.#stopAfterFault(this.#fault ?? failure);
|
|
34193
|
+
})();
|
|
34194
|
+
this.#faultStopPromise = processStop;
|
|
34195
|
+
this.#closePromise = processStop.finally(() => Promise.allSettled([...this.#inflight, this.#eventRecovery]));
|
|
34196
|
+
}
|
|
34197
|
+
return this.#closePromise;
|
|
34198
|
+
}
|
|
34199
|
+
async #stopAfterFault(failure) {
|
|
34016
34200
|
this.#lifetime.abort(new Error("DeepSeek Harness Adapter closed"));
|
|
34017
34201
|
this.#removeConnectionFaultListener();
|
|
34018
34202
|
const sessions = [...this.#sessions];
|
|
34019
|
-
|
|
34020
|
-
|
|
34021
|
-
|
|
34022
|
-
|
|
34023
|
-
|
|
34024
|
-
|
|
34203
|
+
await Promise.allSettled(sessions.map((session) => {
|
|
34204
|
+
session.fault(failure);
|
|
34205
|
+
return session.waitForFaultCleanup();
|
|
34206
|
+
}));
|
|
34207
|
+
await this.#events.close().catch(() => void 0);
|
|
34208
|
+
await this.#control.close().catch(() => void 0);
|
|
34209
|
+
await this.#connection.close();
|
|
34210
|
+
}
|
|
34211
|
+
async #performNormalClose() {
|
|
34212
|
+
this.#lifetime.abort(new Error("DeepSeek Harness Adapter closed"));
|
|
34213
|
+
this.#removeConnectionFaultListener();
|
|
34214
|
+
const sessions = [...this.#sessions];
|
|
34215
|
+
const sessionResults = await Promise.allSettled(sessions.map((session) => session.close()));
|
|
34025
34216
|
await this.#events.close().catch(() => void 0);
|
|
34026
34217
|
await this.#control.close().catch(() => void 0);
|
|
34027
|
-
const
|
|
34028
|
-
const [connectionResult] = await Promise.allSettled([connectionClose]);
|
|
34218
|
+
const [connectionResult] = await Promise.allSettled([this.#connection.close()]);
|
|
34029
34219
|
await Promise.allSettled([...this.#inflight, this.#eventRecovery]);
|
|
34030
34220
|
if (connectionResult.status === "rejected")
|
|
34031
34221
|
throw connectionResult.reason;
|
|
@@ -34042,15 +34232,15 @@ var AdapterOperationError = class extends Error {
|
|
|
34042
34232
|
this.name = "AdapterOperationError";
|
|
34043
34233
|
}
|
|
34044
34234
|
};
|
|
34045
|
-
function validateOpen(
|
|
34046
|
-
if (typeof
|
|
34235
|
+
function validateOpen(input2) {
|
|
34236
|
+
if (typeof input2.cwd !== "string" || input2.cwd.trim() === "") {
|
|
34047
34237
|
return {
|
|
34048
34238
|
code: "invalidRequest",
|
|
34049
34239
|
message: "DeepSeek Harness requires cwd",
|
|
34050
34240
|
retryable: false
|
|
34051
34241
|
};
|
|
34052
34242
|
}
|
|
34053
|
-
const kind =
|
|
34243
|
+
const kind = input2.kind;
|
|
34054
34244
|
if (kind !== "create" && kind !== "resume" && kind !== "fork" && kind !== "rollbackLastTurn") {
|
|
34055
34245
|
return {
|
|
34056
34246
|
code: "unsupported",
|
|
@@ -34058,7 +34248,7 @@ function validateOpen(input) {
|
|
|
34058
34248
|
retryable: false
|
|
34059
34249
|
};
|
|
34060
34250
|
}
|
|
34061
|
-
if (
|
|
34251
|
+
if (input2.kind === "create" && input2.permissionModeId && input2.executionPolicy === "unattended-full-access") {
|
|
34062
34252
|
return {
|
|
34063
34253
|
code: "invalidRequest",
|
|
34064
34254
|
message: "DeepSeek Harness cannot combine an explicit Permission Mode with delegation",
|
|
@@ -34085,10 +34275,10 @@ function verifyCreateConfiguration(requested, observed) {
|
|
|
34085
34275
|
});
|
|
34086
34276
|
}
|
|
34087
34277
|
}
|
|
34088
|
-
function resolveCreateConfiguration(
|
|
34278
|
+
function resolveCreateConfiguration(input2, modelCatalog, permissionModes) {
|
|
34089
34279
|
let model2;
|
|
34090
|
-
if (
|
|
34091
|
-
const requestedModel =
|
|
34280
|
+
if (input2.model || input2.thinkingOptionId) {
|
|
34281
|
+
const requestedModel = input2.model ?? modelCatalog.catalog.defaultModel;
|
|
34092
34282
|
if (!requestedModel) {
|
|
34093
34283
|
throw new AdapterOperationError({
|
|
34094
34284
|
code: "invalidRequest",
|
|
@@ -34096,10 +34286,10 @@ function resolveCreateConfiguration(input, modelCatalog, permissionModes) {
|
|
|
34096
34286
|
retryable: false
|
|
34097
34287
|
});
|
|
34098
34288
|
}
|
|
34099
|
-
model2 = modernSelectionForModel(modelCatalog, requestedModel,
|
|
34289
|
+
model2 = modernSelectionForModel(modelCatalog, requestedModel, input2.thinkingOptionId);
|
|
34100
34290
|
}
|
|
34101
|
-
const unattended =
|
|
34102
|
-
const permissionModeId =
|
|
34291
|
+
const unattended = input2.executionPolicy === "unattended-full-access";
|
|
34292
|
+
const permissionModeId = input2.permissionModeId ?? (unattended ? harnessPermissionModeIdSchema.parse(DELEGATION_PERMISSION_PRESET) : void 0);
|
|
34103
34293
|
if (permissionModeId && !permissionModes?.modes.some(({ id: id2 }) => id2 === permissionModeId)) {
|
|
34104
34294
|
throw new AdapterOperationError({
|
|
34105
34295
|
code: permissionModes ? "invalidRequest" : "unsupported",
|
|
@@ -34141,9 +34331,9 @@ function modernSessionId(ref, operation) {
|
|
|
34141
34331
|
}
|
|
34142
34332
|
return parsed.data.nativeSessionId;
|
|
34143
34333
|
}
|
|
34144
|
-
function parseModernForkInput(
|
|
34145
|
-
const source = nativeSessionRefSchema.safeParse(
|
|
34146
|
-
const checkpoint = nativeCheckpointRefSchema.safeParse(
|
|
34334
|
+
function parseModernForkInput(input2, profile) {
|
|
34335
|
+
const source = nativeSessionRefSchema.safeParse(input2.sourceRef);
|
|
34336
|
+
const checkpoint = nativeCheckpointRefSchema.safeParse(input2.checkpoint);
|
|
34147
34337
|
if (!source.success || !checkpoint.success || source.data.harnessId !== DEEPSEEK_HARNESS_ID3 || checkpoint.data.harnessId !== DEEPSEEK_HARNESS_ID3 || !sessionLocatorMatches(source.data.locator) || !checkpointLocatorMatches(checkpoint.data.locator, profile) || checkpoint.data.nativeSessionId !== source.data.nativeSessionId) {
|
|
34148
34338
|
throw new AdapterOperationError({
|
|
34149
34339
|
code: "invalidRequest",
|
|
@@ -34386,11 +34576,12 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34386
34576
|
/** Aborted by close() so a balance request in flight does not outlive the Adapter. */
|
|
34387
34577
|
#accountInspection = new AbortController();
|
|
34388
34578
|
#candidate;
|
|
34389
|
-
#
|
|
34579
|
+
#cleanupFailed = false;
|
|
34390
34580
|
#closePromise;
|
|
34391
34581
|
#closed = false;
|
|
34392
34582
|
#delegate;
|
|
34393
34583
|
#failure;
|
|
34584
|
+
#retiring;
|
|
34394
34585
|
#selection;
|
|
34395
34586
|
#terminalFailure;
|
|
34396
34587
|
constructor(options = {}, dependencies = {}) {
|
|
@@ -34400,16 +34591,16 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34400
34591
|
signal: this.#accountInspection.signal
|
|
34401
34592
|
}));
|
|
34402
34593
|
this.usageStatistics = createDshUsageStatistics(options.environment ?? process.env);
|
|
34403
|
-
this.#probeExecutable = dependencies.probeExecutable ?? ((
|
|
34594
|
+
this.#probeExecutable = dependencies.probeExecutable ?? ((input2) => probeDeepSeekExecutableGeneration(input2));
|
|
34404
34595
|
this.#createModernAdapter = dependencies.createModernAdapter ?? ((modernOptions2) => new ModernDeepSeekHarnessAdapter(modernOptions2));
|
|
34405
34596
|
}
|
|
34406
|
-
async inspect(
|
|
34597
|
+
async inspect(input2 = {}) {
|
|
34407
34598
|
if (this.#closed)
|
|
34408
34599
|
return { status: "unavailable", error: closedError2() };
|
|
34409
34600
|
if (this.#delegate)
|
|
34410
|
-
return this.#delegate.adapter.inspect(
|
|
34601
|
+
return this.#delegate.adapter.inspect(input2);
|
|
34411
34602
|
try {
|
|
34412
|
-
return (await this.#select(
|
|
34603
|
+
return (await this.#select(input2.refresh === true)).inspection;
|
|
34413
34604
|
} catch (error51) {
|
|
34414
34605
|
const failure = this.#selectionError(error51);
|
|
34415
34606
|
return {
|
|
@@ -34418,12 +34609,12 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34418
34609
|
};
|
|
34419
34610
|
}
|
|
34420
34611
|
}
|
|
34421
|
-
async open(
|
|
34612
|
+
async open(input2) {
|
|
34422
34613
|
try {
|
|
34423
34614
|
const selected = await this.#select(false);
|
|
34424
34615
|
if (this.#closed)
|
|
34425
34616
|
return { ok: false, error: closedError2() };
|
|
34426
|
-
return selected.adapter.open(
|
|
34617
|
+
return selected.adapter.open(input2);
|
|
34427
34618
|
} catch (error51) {
|
|
34428
34619
|
return { ok: false, error: this.#selectionError(error51) };
|
|
34429
34620
|
}
|
|
@@ -34493,6 +34684,10 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34493
34684
|
throw new DelegateSelectionError(closedError2());
|
|
34494
34685
|
}
|
|
34495
34686
|
this.#candidate = void 0;
|
|
34687
|
+
if (selected.faultError) {
|
|
34688
|
+
await this.#closeFailedCandidate(selected);
|
|
34689
|
+
throw new DelegateSelectionError(selected.faultError);
|
|
34690
|
+
}
|
|
34496
34691
|
this.#delegate = selected;
|
|
34497
34692
|
return selected;
|
|
34498
34693
|
}).catch((error51) => {
|
|
@@ -34509,6 +34704,13 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34509
34704
|
return promise2;
|
|
34510
34705
|
}
|
|
34511
34706
|
async #performSelection(signal) {
|
|
34707
|
+
while (this.#retiring) {
|
|
34708
|
+
await this.#retiring;
|
|
34709
|
+
}
|
|
34710
|
+
if (this.#closed || signal.aborted)
|
|
34711
|
+
throw new DelegateSelectionError(closedError2());
|
|
34712
|
+
if (this.#terminalFailure)
|
|
34713
|
+
throw new DelegateSelectionError(this.#terminalFailure);
|
|
34512
34714
|
const startedAt = Date.now();
|
|
34513
34715
|
let endpoint;
|
|
34514
34716
|
try {
|
|
@@ -34532,7 +34734,7 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34532
34734
|
durationMs: Math.max(0, Date.now() - startedAt)
|
|
34533
34735
|
};
|
|
34534
34736
|
if (this.#closed || signal.aborted)
|
|
34535
|
-
this.#
|
|
34737
|
+
this.#cleanupFailed = true;
|
|
34536
34738
|
else
|
|
34537
34739
|
this.#terminalFailure ??= failure2;
|
|
34538
34740
|
throw new DelegateSelectionError(this.#terminalFailure ?? failure2);
|
|
@@ -34578,7 +34780,8 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34578
34780
|
...modernOptions(this.#options),
|
|
34579
34781
|
version: executable.version,
|
|
34580
34782
|
command: executable.command.command,
|
|
34581
|
-
commandArguments: executable.command.arguments
|
|
34783
|
+
commandArguments: executable.command.arguments,
|
|
34784
|
+
onFault: (error51) => this.#handleDelegateFault(owner, error51)
|
|
34582
34785
|
});
|
|
34583
34786
|
const owner = {
|
|
34584
34787
|
adapter,
|
|
@@ -34595,10 +34798,28 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34595
34798
|
owner.inspection = inspection;
|
|
34596
34799
|
return owner;
|
|
34597
34800
|
} catch (error51) {
|
|
34598
|
-
|
|
34599
|
-
|
|
34801
|
+
const firstFault = owner.faultError;
|
|
34802
|
+
const cleanupFailure = await this.#closeFailedCandidate(owner);
|
|
34803
|
+
if (firstFault)
|
|
34804
|
+
throw new DelegateSelectionError(firstFault);
|
|
34805
|
+
throw cleanupFailure ?? error51;
|
|
34600
34806
|
}
|
|
34601
34807
|
}
|
|
34808
|
+
#handleDelegateFault(owner, error51) {
|
|
34809
|
+
owner.faultError ??= error51;
|
|
34810
|
+
if (this.#closed || this.#delegate !== owner)
|
|
34811
|
+
return;
|
|
34812
|
+
this.#delegate = void 0;
|
|
34813
|
+
this.#failure = void 0;
|
|
34814
|
+
const previous = this.#retiring ?? Promise.resolve();
|
|
34815
|
+
const retiring = previous.then(() => this.#closeOwner(owner).catch(() => {
|
|
34816
|
+
this.#recordCleanupFailure();
|
|
34817
|
+
})).finally(() => {
|
|
34818
|
+
if (this.#retiring === retiring)
|
|
34819
|
+
this.#retiring = void 0;
|
|
34820
|
+
});
|
|
34821
|
+
this.#retiring = retiring;
|
|
34822
|
+
}
|
|
34602
34823
|
async #performClose() {
|
|
34603
34824
|
this.#closed = true;
|
|
34604
34825
|
this.#accountInspection.abort(new Error("DeepSeek Harness account inspection closed"));
|
|
@@ -34606,6 +34827,9 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34606
34827
|
let cleanupFailed = false;
|
|
34607
34828
|
const selection3 = this.#selection;
|
|
34608
34829
|
selection3?.abort.abort(new Error("DeepSeek Harness generation selection closed"));
|
|
34830
|
+
while (this.#retiring) {
|
|
34831
|
+
await this.#retiring;
|
|
34832
|
+
}
|
|
34609
34833
|
const candidate = this.#candidate;
|
|
34610
34834
|
if (candidate) {
|
|
34611
34835
|
await this.#closeOwner(candidate).catch(() => {
|
|
@@ -34625,7 +34849,7 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34625
34849
|
cleanupFailed = true;
|
|
34626
34850
|
});
|
|
34627
34851
|
}
|
|
34628
|
-
if (cleanupFailed || this.#
|
|
34852
|
+
if (cleanupFailed || this.#cleanupFailed) {
|
|
34629
34853
|
throw new Error("DeepSeek Harness Adapter cleanup did not complete");
|
|
34630
34854
|
}
|
|
34631
34855
|
}
|
|
@@ -34637,7 +34861,7 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34637
34861
|
try {
|
|
34638
34862
|
await this.#closeOwner(owner);
|
|
34639
34863
|
} catch {
|
|
34640
|
-
|
|
34864
|
+
return this.#recordCleanupFailure();
|
|
34641
34865
|
} finally {
|
|
34642
34866
|
if (this.#candidate === owner)
|
|
34643
34867
|
this.#candidate = void 0;
|
|
@@ -34650,9 +34874,8 @@ var DeepSeekHarnessAdapter = class {
|
|
|
34650
34874
|
retryable: false,
|
|
34651
34875
|
stage: "cleanup"
|
|
34652
34876
|
};
|
|
34653
|
-
|
|
34654
|
-
|
|
34655
|
-
else
|
|
34877
|
+
this.#cleanupFailed = true;
|
|
34878
|
+
if (!this.#closed)
|
|
34656
34879
|
this.#terminalFailure ??= failure;
|
|
34657
34880
|
return new DelegateSelectionError(this.#terminalFailure ?? failure);
|
|
34658
34881
|
}
|
|
@@ -34755,6 +34978,9 @@ function closedError2() {
|
|
|
34755
34978
|
}
|
|
34756
34979
|
|
|
34757
34980
|
// dist/installation.js
|
|
34981
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
34982
|
+
import { mkdir, rename, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
34983
|
+
import path12 from "node:path";
|
|
34758
34984
|
function createDeepSeekInstallation(environment, command) {
|
|
34759
34985
|
let update;
|
|
34760
34986
|
return createInstallationManager({
|
|
@@ -34768,19 +34994,32 @@ function createDeepSeekInstallation(environment, command) {
|
|
|
34768
34994
|
const isNpx = invocation.kind === "npx";
|
|
34769
34995
|
const npm = isNpx ? null : await npmInstallation(invocation.command, ["@deepseek-ai/dsh"], environment);
|
|
34770
34996
|
update = isNpx ? async (version2) => {
|
|
34771
|
-
const
|
|
34997
|
+
const specifier = `@deepseek-ai/dsh@${version2}`;
|
|
34998
|
+
const output = await runInstallationCommand(invocation.command, ["--yes", "--prefer-online", specifier, "--version"], environment, 6e5);
|
|
34772
34999
|
if (versionFromOutput(output) !== version2)
|
|
34773
35000
|
throw new Error("DSH npx update did not select the requested version");
|
|
34774
|
-
const offline = await runInstallationCommand(invocation.command, [
|
|
35001
|
+
const offline = await runInstallationCommand(invocation.command, ["--offline", "--no-install", specifier, "--version"], environment);
|
|
34775
35002
|
if (versionFromOutput(offline) !== version2)
|
|
34776
35003
|
throw new Error("DSH offline npx launch still selects a different version");
|
|
35004
|
+
const destination = deepSeekNpxVersionFile(environment);
|
|
35005
|
+
const temporary = `${destination}.${randomUUID3()}.tmp`;
|
|
35006
|
+
await mkdir(path12.dirname(destination), { recursive: true, mode: 448 });
|
|
35007
|
+
try {
|
|
35008
|
+
await writeFile2(temporary, `${version2}
|
|
35009
|
+
`, { flag: "wx", mode: 384 });
|
|
35010
|
+
await rename(temporary, destination);
|
|
35011
|
+
} finally {
|
|
35012
|
+
await rm2(temporary, { force: true }).catch(() => void 0);
|
|
35013
|
+
}
|
|
34777
35014
|
} : npm?.update;
|
|
34778
35015
|
const canUpdate = isNpx || (npm?.canUpdate ?? false);
|
|
35016
|
+
const updateAvailable = newerInstallationVersion(currentVersion, latestVersion);
|
|
34779
35017
|
return {
|
|
34780
35018
|
currentVersion,
|
|
34781
35019
|
latestVersion,
|
|
34782
|
-
updateAvailable
|
|
35020
|
+
updateAvailable,
|
|
34783
35021
|
canUpdate,
|
|
35022
|
+
...updateAvailable && !DEEPSEEK_VERIFIED_VERSIONS.includes(latestVersion) ? { latestVerifiedVersion: DEEPSEEK_NEWEST_VERIFIED_VERSION } : {},
|
|
34784
35023
|
...!canUpdate ? {
|
|
34785
35024
|
messageCode: "deepseek-original-installer",
|
|
34786
35025
|
notice: {
|