@liberseek/boft-cli-linux-x64 0.7.6 → 0.7.7
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 +69 -53
- package/app/console-web.js +563 -96
- package/app/desktop-controller.mjs +68 -20
- package/app/host-runtime.mjs +523 -124
- package/app/plugins/antigravity/plugin.mjs +804 -716
- package/app/plugins/claude-code/plugin.mjs +275 -115
- package/app/plugins/codebuddy/plugin.mjs +733 -662
- package/app/plugins/cursor-cli/plugin.mjs +446 -357
- package/app/plugins/deepseek-harness/plugin.mjs +25471 -26253
- package/app/plugins/grok/plugin.mjs +1398 -1309
- package/app/plugins/hermes/plugin.mjs +524 -435
- package/app/plugins/kimi-code/plugin.mjs +745 -671
- package/app/plugins/kiro-cli/plugin.mjs +15822 -15731
- package/app/plugins/muse/plugin.mjs +69 -53
- package/app/plugins/omp/plugin.mjs +1639 -1547
- package/app/plugins/opencode/plugin.mjs +736 -665
- package/app/plugins/pi/plugin.mjs +15771 -15663
- package/app/plugins/qoder/plugin.mjs +479 -390
- package/app/plugins/qoder-cn/plugin.mjs +145 -54
- package/app/plugins/workbuddy/plugin.mjs +69 -53
- package/app/renderer-extension.js +695 -212
- package/bin/boft +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/package.json +2 -2
|
@@ -12590,6 +12590,409 @@ var require_dist = __commonJS({
|
|
|
12590
12590
|
}
|
|
12591
12591
|
});
|
|
12592
12592
|
|
|
12593
|
+
// ../../harness-discovery/dist/environment.js
|
|
12594
|
+
import fs from "node:fs";
|
|
12595
|
+
import path from "node:path";
|
|
12596
|
+
function targetPath(platform) {
|
|
12597
|
+
return platform === "win32" ? path.win32 : path.posix;
|
|
12598
|
+
}
|
|
12599
|
+
function environmentValue(environment, name) {
|
|
12600
|
+
const lowered = name.toLowerCase();
|
|
12601
|
+
for (const [key, value] of Object.entries(environment)) {
|
|
12602
|
+
if (key.toLowerCase() === lowered)
|
|
12603
|
+
return value;
|
|
12604
|
+
}
|
|
12605
|
+
return void 0;
|
|
12606
|
+
}
|
|
12607
|
+
function pathDelimiter(platform) {
|
|
12608
|
+
return platform === "win32" ? ";" : ":";
|
|
12609
|
+
}
|
|
12610
|
+
function pathDirectories(environment, platform) {
|
|
12611
|
+
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
12612
|
+
}
|
|
12613
|
+
function executableExtensions(command, platform, environment) {
|
|
12614
|
+
if (platform !== "win32")
|
|
12615
|
+
return [""];
|
|
12616
|
+
if (targetPath(platform).extname(command) !== "")
|
|
12617
|
+
return [""];
|
|
12618
|
+
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
12619
|
+
}
|
|
12620
|
+
function isExecutableFile(filePath, platform) {
|
|
12621
|
+
try {
|
|
12622
|
+
fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
12623
|
+
return fs.statSync(filePath).isFile();
|
|
12624
|
+
} catch {
|
|
12625
|
+
return false;
|
|
12626
|
+
}
|
|
12627
|
+
}
|
|
12628
|
+
function subdirectoryNames(directory) {
|
|
12629
|
+
try {
|
|
12630
|
+
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
12631
|
+
} catch {
|
|
12632
|
+
return [];
|
|
12633
|
+
}
|
|
12634
|
+
}
|
|
12635
|
+
function newestFirst(names) {
|
|
12636
|
+
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
12637
|
+
}
|
|
12638
|
+
|
|
12639
|
+
// ../../harness-discovery/dist/invocation.js
|
|
12640
|
+
import path2 from "node:path";
|
|
12641
|
+
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
12642
|
+
const extension = path2.win32.extname(command).toLowerCase();
|
|
12643
|
+
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
12644
|
+
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
12645
|
+
}
|
|
12646
|
+
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
12647
|
+
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
12648
|
+
return {
|
|
12649
|
+
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
12650
|
+
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
12651
|
+
windowsVerbatimArguments: true
|
|
12652
|
+
};
|
|
12653
|
+
}
|
|
12654
|
+
|
|
12655
|
+
// ../../harness-discovery/dist/node-runtime.js
|
|
12656
|
+
import path3 from "node:path";
|
|
12657
|
+
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
12658
|
+
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
12659
|
+
const delimiter = platform === "win32" ? ";" : ":";
|
|
12660
|
+
const runtimeDirectory = path3.dirname(runtimeExecutable);
|
|
12661
|
+
const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
|
|
12662
|
+
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
12663
|
+
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
12664
|
+
directories.push(runtimeDirectory);
|
|
12665
|
+
}
|
|
12666
|
+
return { ...environment, [pathKey]: directories.join(delimiter) };
|
|
12667
|
+
}
|
|
12668
|
+
|
|
12669
|
+
// ../../harness-discovery/dist/resolve.js
|
|
12670
|
+
import os from "node:os";
|
|
12671
|
+
|
|
12672
|
+
// ../../harness-discovery/dist/version-managers.js
|
|
12673
|
+
function versionManagerBinaryDirectories(context) {
|
|
12674
|
+
const { platform, environment, home } = context;
|
|
12675
|
+
const list = context.subdirectories ?? subdirectoryNames;
|
|
12676
|
+
const pathFlavor = targetPath(platform);
|
|
12677
|
+
const value = (name) => environmentValue(environment, name);
|
|
12678
|
+
const directories = [];
|
|
12679
|
+
const versioned = (root, ...tail) => {
|
|
12680
|
+
for (const version2 of newestFirst(list(root))) {
|
|
12681
|
+
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
12682
|
+
}
|
|
12683
|
+
};
|
|
12684
|
+
if (platform === "win32") {
|
|
12685
|
+
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
12686
|
+
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
12687
|
+
versioned(pathFlavor.join(appData, "nvm"));
|
|
12688
|
+
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
12689
|
+
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
12690
|
+
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
12691
|
+
const pnpmHome2 = value("PNPM_HOME");
|
|
12692
|
+
if (pnpmHome2)
|
|
12693
|
+
directories.push(pnpmHome2);
|
|
12694
|
+
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
12695
|
+
return directories;
|
|
12696
|
+
}
|
|
12697
|
+
versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
|
|
12698
|
+
const fnmRoots = [
|
|
12699
|
+
value("FNM_DIR"),
|
|
12700
|
+
pathFlavor.join(home, ".local", "share", "fnm"),
|
|
12701
|
+
pathFlavor.join(home, "Library", "Application Support", "fnm")
|
|
12702
|
+
].filter((root) => root !== void 0);
|
|
12703
|
+
for (const root of fnmRoots) {
|
|
12704
|
+
versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
|
|
12705
|
+
}
|
|
12706
|
+
const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
|
|
12707
|
+
versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
|
|
12708
|
+
directories.push(pathFlavor.join(voltaHome, "bin"));
|
|
12709
|
+
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
12710
|
+
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
12711
|
+
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
12712
|
+
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
12713
|
+
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
12714
|
+
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
12715
|
+
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
12716
|
+
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
12717
|
+
const pnpmHome = value("PNPM_HOME");
|
|
12718
|
+
if (pnpmHome)
|
|
12719
|
+
directories.push(pnpmHome);
|
|
12720
|
+
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
12721
|
+
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
12722
|
+
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
12723
|
+
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
12724
|
+
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
12725
|
+
}
|
|
12726
|
+
}
|
|
12727
|
+
return directories;
|
|
12728
|
+
}
|
|
12729
|
+
|
|
12730
|
+
// ../../harness-discovery/dist/resolve.js
|
|
12731
|
+
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
12732
|
+
function installRootExtensions(platform) {
|
|
12733
|
+
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
12734
|
+
}
|
|
12735
|
+
function resolveHomeDirectory(input) {
|
|
12736
|
+
return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
|
|
12737
|
+
}
|
|
12738
|
+
function templateVariables(environment, platform, home) {
|
|
12739
|
+
const pathFlavor = targetPath(platform);
|
|
12740
|
+
return {
|
|
12741
|
+
HOME: home,
|
|
12742
|
+
USERPROFILE: home,
|
|
12743
|
+
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
12744
|
+
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
12745
|
+
};
|
|
12746
|
+
}
|
|
12747
|
+
function joinTemplate(platform, value) {
|
|
12748
|
+
const pathFlavor = targetPath(platform);
|
|
12749
|
+
const segments = value.split("/");
|
|
12750
|
+
const head = segments[0] ?? "";
|
|
12751
|
+
const tail = segments.slice(1);
|
|
12752
|
+
if (head === "")
|
|
12753
|
+
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
12754
|
+
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
12755
|
+
}
|
|
12756
|
+
function expandInstallRoot(template, environment, platform, home) {
|
|
12757
|
+
const variables = templateVariables(environment, platform, home);
|
|
12758
|
+
let unresolved = false;
|
|
12759
|
+
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
12760
|
+
const value = variables[name] ?? environmentValue(environment, name);
|
|
12761
|
+
if (value === void 0 || value === "") {
|
|
12762
|
+
unresolved = true;
|
|
12763
|
+
return "";
|
|
12764
|
+
}
|
|
12765
|
+
return value;
|
|
12766
|
+
});
|
|
12767
|
+
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
12768
|
+
}
|
|
12769
|
+
function installRootDirectories(spec, input, dependencies, platform, home) {
|
|
12770
|
+
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
12771
|
+
const directories = [];
|
|
12772
|
+
for (const template of templates) {
|
|
12773
|
+
if (template === VERSION_MANAGER_ROOTS) {
|
|
12774
|
+
directories.push(...versionManagerBinaryDirectories({
|
|
12775
|
+
platform,
|
|
12776
|
+
environment: input.environment,
|
|
12777
|
+
home,
|
|
12778
|
+
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
12779
|
+
}));
|
|
12780
|
+
continue;
|
|
12781
|
+
}
|
|
12782
|
+
const directory = expandInstallRoot(template, input.environment, platform, home);
|
|
12783
|
+
if (directory !== void 0)
|
|
12784
|
+
directories.push(directory);
|
|
12785
|
+
}
|
|
12786
|
+
return directories;
|
|
12787
|
+
}
|
|
12788
|
+
function harnessCandidates(spec, input, dependencies = {}) {
|
|
12789
|
+
const platform = input.platform ?? process.platform;
|
|
12790
|
+
const pathFlavor = targetPath(platform);
|
|
12791
|
+
const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
|
|
12792
|
+
const command = configured ?? spec.command;
|
|
12793
|
+
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
12794
|
+
return [{ candidate: command, source: "configured" }];
|
|
12795
|
+
}
|
|
12796
|
+
const candidates = [];
|
|
12797
|
+
const extensions = executableExtensions(command, platform, input.environment);
|
|
12798
|
+
for (const directory of pathDirectories(input.environment, platform)) {
|
|
12799
|
+
for (const extension of extensions) {
|
|
12800
|
+
candidates.push({
|
|
12801
|
+
candidate: pathFlavor.join(directory, command + extension),
|
|
12802
|
+
source: "path"
|
|
12803
|
+
});
|
|
12804
|
+
}
|
|
12805
|
+
}
|
|
12806
|
+
if (configured !== void 0)
|
|
12807
|
+
return candidates;
|
|
12808
|
+
const home = resolveHomeDirectory(input);
|
|
12809
|
+
for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
|
|
12810
|
+
for (const extension of installRootExtensions(platform)) {
|
|
12811
|
+
candidates.push({
|
|
12812
|
+
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
12813
|
+
source: "install-root"
|
|
12814
|
+
});
|
|
12815
|
+
}
|
|
12816
|
+
}
|
|
12817
|
+
return candidates;
|
|
12818
|
+
}
|
|
12819
|
+
function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
12820
|
+
const platform = input.platform ?? process.platform;
|
|
12821
|
+
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
12822
|
+
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
12823
|
+
const context = { platform, isExecutable };
|
|
12824
|
+
for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
|
|
12825
|
+
const executable = runnable(candidate, context);
|
|
12826
|
+
if (executable !== void 0 && isExecutable(executable))
|
|
12827
|
+
return { executable, source };
|
|
12828
|
+
}
|
|
12829
|
+
return void 0;
|
|
12830
|
+
}
|
|
12831
|
+
|
|
12832
|
+
// ../../harness-discovery/dist/installation.js
|
|
12833
|
+
import { execFile } from "node:child_process";
|
|
12834
|
+
import { homedir } from "node:os";
|
|
12835
|
+
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
12836
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
12837
|
+
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
12838
|
+
return new Promise((resolve, reject) => {
|
|
12839
|
+
const child = execFile(invocation.command, invocation.arguments, {
|
|
12840
|
+
env,
|
|
12841
|
+
cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
12842
|
+
encoding: "utf8",
|
|
12843
|
+
timeout,
|
|
12844
|
+
killSignal: "SIGKILL",
|
|
12845
|
+
maxBuffer: 1024 * 1024,
|
|
12846
|
+
windowsHide: true,
|
|
12847
|
+
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
12848
|
+
}, (error51, stdout, stderr) => {
|
|
12849
|
+
if (error51)
|
|
12850
|
+
reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
|
|
12851
|
+
else
|
|
12852
|
+
resolve((stdout || stderr).trim());
|
|
12853
|
+
});
|
|
12854
|
+
child.stdin?.end();
|
|
12855
|
+
});
|
|
12856
|
+
}
|
|
12857
|
+
function installationVersion(value) {
|
|
12858
|
+
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
12859
|
+
throw new Error("Harness returned an invalid version");
|
|
12860
|
+
return value.trim().replace(/^v/, "");
|
|
12861
|
+
}
|
|
12862
|
+
function versionFromOutput(output) {
|
|
12863
|
+
return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
|
|
12864
|
+
}
|
|
12865
|
+
function newerInstallationVersion(current, latest) {
|
|
12866
|
+
const a = installationVersion(current).replace(/\+.*/, "");
|
|
12867
|
+
const b = installationVersion(latest).replace(/\+.*/, "");
|
|
12868
|
+
const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
|
|
12869
|
+
const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
|
|
12870
|
+
for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
|
|
12871
|
+
if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
|
|
12872
|
+
return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
|
|
12873
|
+
}
|
|
12874
|
+
const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
|
|
12875
|
+
const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
|
|
12876
|
+
if (!preA.length || !preB.length)
|
|
12877
|
+
return !!preA.length && !preB.length;
|
|
12878
|
+
for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
|
|
12879
|
+
const x3 = preA[i];
|
|
12880
|
+
const y = preB[i];
|
|
12881
|
+
if (x3 === y)
|
|
12882
|
+
continue;
|
|
12883
|
+
if (x3 === void 0 || y === void 0)
|
|
12884
|
+
return x3 === void 0;
|
|
12885
|
+
const numericX = /^\d+$/.test(x3);
|
|
12886
|
+
const numericY = /^\d+$/.test(y);
|
|
12887
|
+
if (numericX && numericY) {
|
|
12888
|
+
if (BigInt(x3) === BigInt(y))
|
|
12889
|
+
continue;
|
|
12890
|
+
return BigInt(y) > BigInt(x3);
|
|
12891
|
+
}
|
|
12892
|
+
if (numericX !== numericY)
|
|
12893
|
+
return numericX;
|
|
12894
|
+
return y > x3;
|
|
12895
|
+
}
|
|
12896
|
+
return false;
|
|
12897
|
+
}
|
|
12898
|
+
function createInstallationManager(options) {
|
|
12899
|
+
let checking;
|
|
12900
|
+
let updating;
|
|
12901
|
+
const check2 = () => checking ??= options.check().finally(() => {
|
|
12902
|
+
checking = void 0;
|
|
12903
|
+
});
|
|
12904
|
+
return (action) => {
|
|
12905
|
+
if (updating)
|
|
12906
|
+
return updating;
|
|
12907
|
+
if (action === "check")
|
|
12908
|
+
return check2();
|
|
12909
|
+
updating = (async () => {
|
|
12910
|
+
const before = await check2();
|
|
12911
|
+
if (!before.updateAvailable)
|
|
12912
|
+
return before;
|
|
12913
|
+
if (!before.canUpdate)
|
|
12914
|
+
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
12915
|
+
await options.update(before);
|
|
12916
|
+
const after = await check2();
|
|
12917
|
+
if (after.currentVersion === before.currentVersion)
|
|
12918
|
+
throw new Error("The Harness version did not change; check the native updater and retry");
|
|
12919
|
+
return after;
|
|
12920
|
+
})().finally(() => {
|
|
12921
|
+
updating = void 0;
|
|
12922
|
+
});
|
|
12923
|
+
return updating;
|
|
12924
|
+
};
|
|
12925
|
+
}
|
|
12926
|
+
async function fetchInstallationText(url2) {
|
|
12927
|
+
const request = async () => {
|
|
12928
|
+
const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
|
|
12929
|
+
if (!response.ok)
|
|
12930
|
+
throw new Error("Could not check the latest Harness version");
|
|
12931
|
+
return response.text();
|
|
12932
|
+
};
|
|
12933
|
+
try {
|
|
12934
|
+
return await request();
|
|
12935
|
+
} catch (error51) {
|
|
12936
|
+
if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
|
|
12937
|
+
throw error51;
|
|
12938
|
+
return request();
|
|
12939
|
+
}
|
|
12940
|
+
}
|
|
12941
|
+
|
|
12942
|
+
// ../../harness-discovery/dist/installer.js
|
|
12943
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
12944
|
+
import { tmpdir } from "node:os";
|
|
12945
|
+
import { join } from "node:path";
|
|
12946
|
+
function createHarnessInstaller(environment, source) {
|
|
12947
|
+
return async () => {
|
|
12948
|
+
if (!["darwin", "linux", "win32"].includes(process.platform))
|
|
12949
|
+
throw new Error("Unsupported installation platform");
|
|
12950
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
12951
|
+
if ("npm" in source) {
|
|
12952
|
+
const npm = resolveHarnessExecutable({
|
|
12953
|
+
id: "npm",
|
|
12954
|
+
command: "npm",
|
|
12955
|
+
installRoots: {
|
|
12956
|
+
posix: [
|
|
12957
|
+
"~/.npm-global/bin",
|
|
12958
|
+
"~/.local/bin",
|
|
12959
|
+
VERSION_MANAGER_ROOTS,
|
|
12960
|
+
"/opt/homebrew/bin",
|
|
12961
|
+
"/usr/local/bin",
|
|
12962
|
+
"/usr/bin"
|
|
12963
|
+
],
|
|
12964
|
+
windows: [
|
|
12965
|
+
"${APPDATA}/npm",
|
|
12966
|
+
VERSION_MANAGER_ROOTS,
|
|
12967
|
+
"${ProgramFiles}/nodejs",
|
|
12968
|
+
"${LOCALAPPDATA}/Programs/nodejs"
|
|
12969
|
+
]
|
|
12970
|
+
}
|
|
12971
|
+
}, { environment: env });
|
|
12972
|
+
if (!npm)
|
|
12973
|
+
throw new Error("Install Node.js and npm first");
|
|
12974
|
+
await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
|
|
12975
|
+
...env,
|
|
12976
|
+
...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
|
|
12977
|
+
}, 6e5);
|
|
12978
|
+
return;
|
|
12979
|
+
}
|
|
12980
|
+
const windows = process.platform === "win32";
|
|
12981
|
+
const url2 = windows ? source.windows : source.posix;
|
|
12982
|
+
if (new URL(url2).protocol !== "https:")
|
|
12983
|
+
throw new Error("Installer requires HTTPS");
|
|
12984
|
+
const script = await fetchInstallationText(url2);
|
|
12985
|
+
const directory = await mkdtemp(join(tmpdir(), "codexhost-installer-"));
|
|
12986
|
+
try {
|
|
12987
|
+
const file2 = join(directory, windows ? "install.ps1" : "install.sh");
|
|
12988
|
+
await writeFile(file2, script, { mode: 384 });
|
|
12989
|
+
await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
|
|
12990
|
+
} finally {
|
|
12991
|
+
await rm(directory, { recursive: true, force: true });
|
|
12992
|
+
}
|
|
12993
|
+
};
|
|
12994
|
+
}
|
|
12995
|
+
|
|
12593
12996
|
// dist/qoder-adapter.js
|
|
12594
12997
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
12595
12998
|
import path5 from "node:path";
|
|
@@ -27178,6 +27581,71 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
27178
27581
|
initializeOnly: external_exports.boolean().optional()
|
|
27179
27582
|
});
|
|
27180
27583
|
|
|
27584
|
+
// ../../shared-contracts/dist/ids.js
|
|
27585
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
27586
|
+
message: "Identifier must not be empty or whitespace"
|
|
27587
|
+
});
|
|
27588
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
27589
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
27590
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
27591
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
27592
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
27593
|
+
|
|
27594
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
27595
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
27596
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
27597
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
27598
|
+
var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
|
|
27599
|
+
var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
27600
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
27601
|
+
var pluginPresentationShape = {
|
|
27602
|
+
id: harnessPluginIdSchema,
|
|
27603
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
27604
|
+
version: external_exports.string().min(1).max(128),
|
|
27605
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
27606
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
27607
|
+
links: external_exports.object({
|
|
27608
|
+
documentation: documentationUrlSchema.optional(),
|
|
27609
|
+
installation: documentationUrlSchema.optional()
|
|
27610
|
+
}).strict().optional()
|
|
27611
|
+
};
|
|
27612
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
27613
|
+
manifestVersion: external_exports.literal(1),
|
|
27614
|
+
...pluginPresentationShape,
|
|
27615
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
27616
|
+
entry: relativeResourceSchema,
|
|
27617
|
+
icon: relativeResourceSchema.optional()
|
|
27618
|
+
}).strict();
|
|
27619
|
+
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
27620
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
27621
|
+
...pluginPresentationShape,
|
|
27622
|
+
icon: harnessPluginIconSchema.optional()
|
|
27623
|
+
}).strict();
|
|
27624
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
27625
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
27626
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
27627
|
+
}).strict();
|
|
27628
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
27629
|
+
version: external_exports.literal(1),
|
|
27630
|
+
enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
27631
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
27632
|
+
message: "Enabled plugin IDs must be unique",
|
|
27633
|
+
path: ["enabled"]
|
|
27634
|
+
});
|
|
27635
|
+
|
|
27636
|
+
// ../../shared-contracts/dist/harness-long-context.js
|
|
27637
|
+
var HARNESS_LONG_CONTEXT_GET_METHOD = "codexhost/harness/long-context/get";
|
|
27638
|
+
var HARNESS_LONG_CONTEXT_SET_METHOD = "codexhost/harness/long-context/set";
|
|
27639
|
+
var harnessLongContextGetSchema = external_exports.object({
|
|
27640
|
+
harnessId: harnessPluginIdSchema
|
|
27641
|
+
}).strict();
|
|
27642
|
+
var harnessLongContextSetSchema = harnessLongContextGetSchema.extend({
|
|
27643
|
+
enabled: external_exports.boolean()
|
|
27644
|
+
});
|
|
27645
|
+
var harnessLongContextSchema = external_exports.object({
|
|
27646
|
+
enabled: external_exports.boolean()
|
|
27647
|
+
}).strict();
|
|
27648
|
+
|
|
27181
27649
|
// ../../shared-contracts/dist/console.js
|
|
27182
27650
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
27183
27651
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -27194,8 +27662,11 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
27194
27662
|
"codexhost/harness/display-settings/get",
|
|
27195
27663
|
"codexhost/harness/display-settings/set",
|
|
27196
27664
|
"codexhost/harness/inspect",
|
|
27665
|
+
"codexhost/harness/installation",
|
|
27197
27666
|
"codexhost/harness/launch-settings/get",
|
|
27198
27667
|
"codexhost/harness/launch-settings/set",
|
|
27668
|
+
HARNESS_LONG_CONTEXT_GET_METHOD,
|
|
27669
|
+
HARNESS_LONG_CONTEXT_SET_METHOD,
|
|
27199
27670
|
"codexhost/harness/web-ui/open",
|
|
27200
27671
|
"codexhost/harness/accounts/sources",
|
|
27201
27672
|
"codexhost/harness/accounts/list",
|
|
@@ -27255,16 +27726,6 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
|
|
|
27255
27726
|
inactiveMs: external_exports.number().nonnegative()
|
|
27256
27727
|
}));
|
|
27257
27728
|
|
|
27258
|
-
// ../../shared-contracts/dist/ids.js
|
|
27259
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
27260
|
-
message: "Identifier must not be empty or whitespace"
|
|
27261
|
-
});
|
|
27262
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
27263
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
27264
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
27265
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
27266
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
27267
|
-
|
|
27268
27729
|
// ../../shared-contracts/dist/manual-compaction.js
|
|
27269
27730
|
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
27270
27731
|
threadId: hostThreadIdSchema,
|
|
@@ -27794,48 +28255,6 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
27794
28255
|
}
|
|
27795
28256
|
});
|
|
27796
28257
|
|
|
27797
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
27798
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
27799
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
27800
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
27801
|
-
var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
|
|
27802
|
-
var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
27803
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
27804
|
-
var pluginPresentationShape = {
|
|
27805
|
-
id: harnessPluginIdSchema,
|
|
27806
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
27807
|
-
version: external_exports.string().min(1).max(128),
|
|
27808
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
27809
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
27810
|
-
links: external_exports.object({
|
|
27811
|
-
documentation: documentationUrlSchema.optional(),
|
|
27812
|
-
installation: documentationUrlSchema.optional()
|
|
27813
|
-
}).strict().optional()
|
|
27814
|
-
};
|
|
27815
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
27816
|
-
manifestVersion: external_exports.literal(1),
|
|
27817
|
-
...pluginPresentationShape,
|
|
27818
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
27819
|
-
entry: relativeResourceSchema,
|
|
27820
|
-
icon: relativeResourceSchema.optional()
|
|
27821
|
-
}).strict();
|
|
27822
|
-
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
27823
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
27824
|
-
...pluginPresentationShape,
|
|
27825
|
-
icon: harnessPluginIconSchema.optional()
|
|
27826
|
-
}).strict();
|
|
27827
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
27828
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
27829
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
27830
|
-
}).strict();
|
|
27831
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
27832
|
-
version: external_exports.literal(1),
|
|
27833
|
-
enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
27834
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
27835
|
-
message: "Enabled plugin IDs must be unique",
|
|
27836
|
-
path: ["enabled"]
|
|
27837
|
-
});
|
|
27838
|
-
|
|
27839
28258
|
// ../../shared-contracts/dist/harness-route.js
|
|
27840
28259
|
var harnessPluginRouteSchema = external_exports.object({
|
|
27841
28260
|
harnessId: harnessPluginIdSchema,
|
|
@@ -27860,7 +28279,7 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
27860
28279
|
// ../../shared-contracts/dist/harness-installation.js
|
|
27861
28280
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
27862
28281
|
harnessId: harnessIdSchema,
|
|
27863
|
-
action: external_exports.enum(["check", "update"])
|
|
28282
|
+
action: external_exports.enum(["check", "update", "install"])
|
|
27864
28283
|
}).strict();
|
|
27865
28284
|
var harnessInstallationStateSchema = external_exports.object({
|
|
27866
28285
|
currentVersion: external_exports.string().min(1).max(128),
|
|
@@ -28186,342 +28605,6 @@ var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT
|
|
|
28186
28605
|
|
|
28187
28606
|
// dist/qoder-command.js
|
|
28188
28607
|
import path4 from "node:path";
|
|
28189
|
-
|
|
28190
|
-
// ../../harness-discovery/dist/environment.js
|
|
28191
|
-
import fs from "node:fs";
|
|
28192
|
-
import path from "node:path";
|
|
28193
|
-
function targetPath(platform) {
|
|
28194
|
-
return platform === "win32" ? path.win32 : path.posix;
|
|
28195
|
-
}
|
|
28196
|
-
function environmentValue(environment, name) {
|
|
28197
|
-
const lowered = name.toLowerCase();
|
|
28198
|
-
for (const [key, value] of Object.entries(environment)) {
|
|
28199
|
-
if (key.toLowerCase() === lowered)
|
|
28200
|
-
return value;
|
|
28201
|
-
}
|
|
28202
|
-
return void 0;
|
|
28203
|
-
}
|
|
28204
|
-
function pathDelimiter(platform) {
|
|
28205
|
-
return platform === "win32" ? ";" : ":";
|
|
28206
|
-
}
|
|
28207
|
-
function pathDirectories(environment, platform) {
|
|
28208
|
-
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
28209
|
-
}
|
|
28210
|
-
function executableExtensions(command, platform, environment) {
|
|
28211
|
-
if (platform !== "win32")
|
|
28212
|
-
return [""];
|
|
28213
|
-
if (targetPath(platform).extname(command) !== "")
|
|
28214
|
-
return [""];
|
|
28215
|
-
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
28216
|
-
}
|
|
28217
|
-
function isExecutableFile(filePath, platform) {
|
|
28218
|
-
try {
|
|
28219
|
-
fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
28220
|
-
return fs.statSync(filePath).isFile();
|
|
28221
|
-
} catch {
|
|
28222
|
-
return false;
|
|
28223
|
-
}
|
|
28224
|
-
}
|
|
28225
|
-
function subdirectoryNames(directory) {
|
|
28226
|
-
try {
|
|
28227
|
-
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
28228
|
-
} catch {
|
|
28229
|
-
return [];
|
|
28230
|
-
}
|
|
28231
|
-
}
|
|
28232
|
-
function newestFirst(names) {
|
|
28233
|
-
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
28234
|
-
}
|
|
28235
|
-
|
|
28236
|
-
// ../../harness-discovery/dist/invocation.js
|
|
28237
|
-
import path2 from "node:path";
|
|
28238
|
-
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
28239
|
-
const extension = path2.win32.extname(command).toLowerCase();
|
|
28240
|
-
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
28241
|
-
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
28242
|
-
}
|
|
28243
|
-
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
28244
|
-
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
28245
|
-
return {
|
|
28246
|
-
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
28247
|
-
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
28248
|
-
windowsVerbatimArguments: true
|
|
28249
|
-
};
|
|
28250
|
-
}
|
|
28251
|
-
|
|
28252
|
-
// ../../harness-discovery/dist/node-runtime.js
|
|
28253
|
-
import path3 from "node:path";
|
|
28254
|
-
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
28255
|
-
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
28256
|
-
const delimiter = platform === "win32" ? ";" : ":";
|
|
28257
|
-
const runtimeDirectory = path3.dirname(runtimeExecutable);
|
|
28258
|
-
const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
|
|
28259
|
-
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
28260
|
-
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
28261
|
-
directories.push(runtimeDirectory);
|
|
28262
|
-
}
|
|
28263
|
-
return { ...environment, [pathKey]: directories.join(delimiter) };
|
|
28264
|
-
}
|
|
28265
|
-
|
|
28266
|
-
// ../../harness-discovery/dist/resolve.js
|
|
28267
|
-
import os from "node:os";
|
|
28268
|
-
|
|
28269
|
-
// ../../harness-discovery/dist/version-managers.js
|
|
28270
|
-
function versionManagerBinaryDirectories(context) {
|
|
28271
|
-
const { platform, environment, home } = context;
|
|
28272
|
-
const list = context.subdirectories ?? subdirectoryNames;
|
|
28273
|
-
const pathFlavor = targetPath(platform);
|
|
28274
|
-
const value = (name) => environmentValue(environment, name);
|
|
28275
|
-
const directories = [];
|
|
28276
|
-
const versioned = (root, ...tail) => {
|
|
28277
|
-
for (const version2 of newestFirst(list(root))) {
|
|
28278
|
-
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
28279
|
-
}
|
|
28280
|
-
};
|
|
28281
|
-
if (platform === "win32") {
|
|
28282
|
-
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
28283
|
-
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
28284
|
-
versioned(pathFlavor.join(appData, "nvm"));
|
|
28285
|
-
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
28286
|
-
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
28287
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
28288
|
-
const pnpmHome2 = value("PNPM_HOME");
|
|
28289
|
-
if (pnpmHome2)
|
|
28290
|
-
directories.push(pnpmHome2);
|
|
28291
|
-
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
28292
|
-
return directories;
|
|
28293
|
-
}
|
|
28294
|
-
versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
|
|
28295
|
-
const fnmRoots = [
|
|
28296
|
-
value("FNM_DIR"),
|
|
28297
|
-
pathFlavor.join(home, ".local", "share", "fnm"),
|
|
28298
|
-
pathFlavor.join(home, "Library", "Application Support", "fnm")
|
|
28299
|
-
].filter((root) => root !== void 0);
|
|
28300
|
-
for (const root of fnmRoots) {
|
|
28301
|
-
versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
|
|
28302
|
-
}
|
|
28303
|
-
const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
|
|
28304
|
-
versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
|
|
28305
|
-
directories.push(pathFlavor.join(voltaHome, "bin"));
|
|
28306
|
-
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
28307
|
-
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
28308
|
-
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
28309
|
-
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
28310
|
-
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
28311
|
-
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
28312
|
-
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
28313
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
28314
|
-
const pnpmHome = value("PNPM_HOME");
|
|
28315
|
-
if (pnpmHome)
|
|
28316
|
-
directories.push(pnpmHome);
|
|
28317
|
-
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
28318
|
-
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
28319
|
-
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
28320
|
-
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
28321
|
-
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
28322
|
-
}
|
|
28323
|
-
}
|
|
28324
|
-
return directories;
|
|
28325
|
-
}
|
|
28326
|
-
|
|
28327
|
-
// ../../harness-discovery/dist/resolve.js
|
|
28328
|
-
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
28329
|
-
function installRootExtensions(platform) {
|
|
28330
|
-
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
28331
|
-
}
|
|
28332
|
-
function resolveHomeDirectory(input) {
|
|
28333
|
-
return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
|
|
28334
|
-
}
|
|
28335
|
-
function templateVariables(environment, platform, home) {
|
|
28336
|
-
const pathFlavor = targetPath(platform);
|
|
28337
|
-
return {
|
|
28338
|
-
HOME: home,
|
|
28339
|
-
USERPROFILE: home,
|
|
28340
|
-
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
28341
|
-
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
28342
|
-
};
|
|
28343
|
-
}
|
|
28344
|
-
function joinTemplate(platform, value) {
|
|
28345
|
-
const pathFlavor = targetPath(platform);
|
|
28346
|
-
const segments = value.split("/");
|
|
28347
|
-
const head = segments[0] ?? "";
|
|
28348
|
-
const tail = segments.slice(1);
|
|
28349
|
-
if (head === "")
|
|
28350
|
-
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
28351
|
-
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
28352
|
-
}
|
|
28353
|
-
function expandInstallRoot(template, environment, platform, home) {
|
|
28354
|
-
const variables = templateVariables(environment, platform, home);
|
|
28355
|
-
let unresolved = false;
|
|
28356
|
-
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
28357
|
-
const value = variables[name] ?? environmentValue(environment, name);
|
|
28358
|
-
if (value === void 0 || value === "") {
|
|
28359
|
-
unresolved = true;
|
|
28360
|
-
return "";
|
|
28361
|
-
}
|
|
28362
|
-
return value;
|
|
28363
|
-
});
|
|
28364
|
-
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
28365
|
-
}
|
|
28366
|
-
function installRootDirectories(spec, input, dependencies, platform, home) {
|
|
28367
|
-
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
28368
|
-
const directories = [];
|
|
28369
|
-
for (const template of templates) {
|
|
28370
|
-
if (template === VERSION_MANAGER_ROOTS) {
|
|
28371
|
-
directories.push(...versionManagerBinaryDirectories({
|
|
28372
|
-
platform,
|
|
28373
|
-
environment: input.environment,
|
|
28374
|
-
home,
|
|
28375
|
-
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
28376
|
-
}));
|
|
28377
|
-
continue;
|
|
28378
|
-
}
|
|
28379
|
-
const directory = expandInstallRoot(template, input.environment, platform, home);
|
|
28380
|
-
if (directory !== void 0)
|
|
28381
|
-
directories.push(directory);
|
|
28382
|
-
}
|
|
28383
|
-
return directories;
|
|
28384
|
-
}
|
|
28385
|
-
function harnessCandidates(spec, input, dependencies = {}) {
|
|
28386
|
-
const platform = input.platform ?? process.platform;
|
|
28387
|
-
const pathFlavor = targetPath(platform);
|
|
28388
|
-
const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
|
|
28389
|
-
const command = configured ?? spec.command;
|
|
28390
|
-
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
28391
|
-
return [{ candidate: command, source: "configured" }];
|
|
28392
|
-
}
|
|
28393
|
-
const candidates = [];
|
|
28394
|
-
const extensions = executableExtensions(command, platform, input.environment);
|
|
28395
|
-
for (const directory of pathDirectories(input.environment, platform)) {
|
|
28396
|
-
for (const extension of extensions) {
|
|
28397
|
-
candidates.push({
|
|
28398
|
-
candidate: pathFlavor.join(directory, command + extension),
|
|
28399
|
-
source: "path"
|
|
28400
|
-
});
|
|
28401
|
-
}
|
|
28402
|
-
}
|
|
28403
|
-
if (configured !== void 0)
|
|
28404
|
-
return candidates;
|
|
28405
|
-
const home = resolveHomeDirectory(input);
|
|
28406
|
-
for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
|
|
28407
|
-
for (const extension of installRootExtensions(platform)) {
|
|
28408
|
-
candidates.push({
|
|
28409
|
-
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
28410
|
-
source: "install-root"
|
|
28411
|
-
});
|
|
28412
|
-
}
|
|
28413
|
-
}
|
|
28414
|
-
return candidates;
|
|
28415
|
-
}
|
|
28416
|
-
function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
28417
|
-
const platform = input.platform ?? process.platform;
|
|
28418
|
-
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
28419
|
-
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
28420
|
-
const context = { platform, isExecutable };
|
|
28421
|
-
for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
|
|
28422
|
-
const executable = runnable(candidate, context);
|
|
28423
|
-
if (executable !== void 0 && isExecutable(executable))
|
|
28424
|
-
return { executable, source };
|
|
28425
|
-
}
|
|
28426
|
-
return void 0;
|
|
28427
|
-
}
|
|
28428
|
-
|
|
28429
|
-
// ../../harness-discovery/dist/installation.js
|
|
28430
|
-
import { execFile } from "node:child_process";
|
|
28431
|
-
import { homedir } from "node:os";
|
|
28432
|
-
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
28433
|
-
const env = withNodeRuntimeOnPath(environment);
|
|
28434
|
-
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
28435
|
-
return new Promise((resolve, reject) => {
|
|
28436
|
-
const child = execFile(invocation.command, invocation.arguments, {
|
|
28437
|
-
env,
|
|
28438
|
-
cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
28439
|
-
encoding: "utf8",
|
|
28440
|
-
timeout,
|
|
28441
|
-
killSignal: "SIGKILL",
|
|
28442
|
-
maxBuffer: 1024 * 1024,
|
|
28443
|
-
windowsHide: true,
|
|
28444
|
-
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
28445
|
-
}, (error51, stdout, stderr) => {
|
|
28446
|
-
if (error51)
|
|
28447
|
-
reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
|
|
28448
|
-
else
|
|
28449
|
-
resolve((stdout || stderr).trim());
|
|
28450
|
-
});
|
|
28451
|
-
child.stdin?.end();
|
|
28452
|
-
});
|
|
28453
|
-
}
|
|
28454
|
-
function installationVersion(value) {
|
|
28455
|
-
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
28456
|
-
throw new Error("Harness returned an invalid version");
|
|
28457
|
-
return value.trim().replace(/^v/, "");
|
|
28458
|
-
}
|
|
28459
|
-
function versionFromOutput(output) {
|
|
28460
|
-
return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
|
|
28461
|
-
}
|
|
28462
|
-
function newerInstallationVersion(current, latest) {
|
|
28463
|
-
const a = installationVersion(current).replace(/\+.*/, "");
|
|
28464
|
-
const b = installationVersion(latest).replace(/\+.*/, "");
|
|
28465
|
-
const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
|
|
28466
|
-
const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
|
|
28467
|
-
for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
|
|
28468
|
-
if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
|
|
28469
|
-
return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
|
|
28470
|
-
}
|
|
28471
|
-
const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
|
|
28472
|
-
const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
|
|
28473
|
-
if (!preA.length || !preB.length)
|
|
28474
|
-
return !!preA.length && !preB.length;
|
|
28475
|
-
for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
|
|
28476
|
-
const x3 = preA[i];
|
|
28477
|
-
const y = preB[i];
|
|
28478
|
-
if (x3 === y)
|
|
28479
|
-
continue;
|
|
28480
|
-
if (x3 === void 0 || y === void 0)
|
|
28481
|
-
return x3 === void 0;
|
|
28482
|
-
const numericX = /^\d+$/.test(x3);
|
|
28483
|
-
const numericY = /^\d+$/.test(y);
|
|
28484
|
-
if (numericX && numericY) {
|
|
28485
|
-
if (BigInt(x3) === BigInt(y))
|
|
28486
|
-
continue;
|
|
28487
|
-
return BigInt(y) > BigInt(x3);
|
|
28488
|
-
}
|
|
28489
|
-
if (numericX !== numericY)
|
|
28490
|
-
return numericX;
|
|
28491
|
-
return y > x3;
|
|
28492
|
-
}
|
|
28493
|
-
return false;
|
|
28494
|
-
}
|
|
28495
|
-
function createInstallationManager(options) {
|
|
28496
|
-
let checking;
|
|
28497
|
-
let updating;
|
|
28498
|
-
const check2 = () => checking ??= options.check().finally(() => {
|
|
28499
|
-
checking = void 0;
|
|
28500
|
-
});
|
|
28501
|
-
return (action) => {
|
|
28502
|
-
if (updating)
|
|
28503
|
-
return updating;
|
|
28504
|
-
if (action === "check")
|
|
28505
|
-
return check2();
|
|
28506
|
-
updating = (async () => {
|
|
28507
|
-
const before = await check2();
|
|
28508
|
-
if (!before.updateAvailable)
|
|
28509
|
-
return before;
|
|
28510
|
-
if (!before.canUpdate)
|
|
28511
|
-
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
28512
|
-
await options.update(before);
|
|
28513
|
-
const after = await check2();
|
|
28514
|
-
if (after.currentVersion === before.currentVersion)
|
|
28515
|
-
throw new Error("The Harness version did not change; check the native updater and retry");
|
|
28516
|
-
return after;
|
|
28517
|
-
})().finally(() => {
|
|
28518
|
-
updating = void 0;
|
|
28519
|
-
});
|
|
28520
|
-
return updating;
|
|
28521
|
-
};
|
|
28522
|
-
}
|
|
28523
|
-
|
|
28524
|
-
// dist/qoder-command.js
|
|
28525
28608
|
var QoderExecutableError = class extends Error {
|
|
28526
28609
|
code = "QODER_NOT_FOUND";
|
|
28527
28610
|
};
|
|
@@ -52795,7 +52878,13 @@ function createHarnessAdapter(context, variant = "global") {
|
|
|
52795
52878
|
variant,
|
|
52796
52879
|
environment,
|
|
52797
52880
|
platform: context.platform
|
|
52798
|
-
}), {
|
|
52881
|
+
}), {
|
|
52882
|
+
installation: createQoderInstallation(environment, command, variant),
|
|
52883
|
+
install: createHarnessInstaller(environment, variant === "cn" ? {
|
|
52884
|
+
posix: "https://static.qoder.com.cn/qoder-cli-cn/install.sh",
|
|
52885
|
+
windows: "https://static.qoder.com.cn/qoder-cli-cn/install.ps1"
|
|
52886
|
+
} : { posix: "https://qoder.com/install", windows: "https://qoder.com/install.ps1" })
|
|
52887
|
+
});
|
|
52799
52888
|
}
|
|
52800
52889
|
export {
|
|
52801
52890
|
CODEXHOST_QODER_COMMAND,
|