@codexhost/cli-darwin-x64 0.11.0 → 0.12.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 +16496 -16342
- package/app/console-web.js +4290 -2314
- package/app/desktop-controller.mjs +16266 -360
- package/app/host-runtime.mjs +4707 -986
- package/app/plugins/antigravity/plugin.mjs +1201 -1044
- package/app/plugins/claude-code/plugin.mjs +517 -139
- package/app/plugins/codebuddy/plugin.mjs +1521 -868
- package/app/plugins/cursor-cli/plugin.mjs +824 -436
- package/app/plugins/deepseek-harness/plugin.mjs +25516 -26242
- package/app/plugins/enabled.json +2 -1
- package/app/plugins/grok/plugin.mjs +995 -515
- package/app/plugins/hermes/plugin.mjs +18815 -23119
- package/app/plugins/kimi-code/plugin.mjs +1105 -713
- package/app/plugins/kiro-cli/plugin.mjs +1018 -600
- package/app/plugins/omp/plugin.mjs +1097 -586
- package/app/plugins/opencode/plugin.mjs +1020 -710
- package/app/plugins/pi/plugin.mjs +15952 -15716
- package/app/plugins/qoder/plugin.mjs +738 -385
- package/app/plugins/qoder-cn/plugin.mjs +404 -49
- package/app/plugins/workbuddy/plugin.mjs +715 -108
- package/app/plugins/zcode/assets/icon.svg +8 -0
- package/app/plugins/zcode/manifest.json +14 -0
- package/app/plugins/zcode/plugin.mjs +19251 -0
- package/app/renderer-extension.js +2854 -630
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -3229,8 +3229,8 @@ var require_utils = __commonJS({
|
|
|
3229
3229
|
}
|
|
3230
3230
|
return ind;
|
|
3231
3231
|
}
|
|
3232
|
-
function removeDotSegments(
|
|
3233
|
-
let input =
|
|
3232
|
+
function removeDotSegments(path7) {
|
|
3233
|
+
let input = path7;
|
|
3234
3234
|
const output = [];
|
|
3235
3235
|
let nextSlash = -1;
|
|
3236
3236
|
let len = 0;
|
|
@@ -3482,8 +3482,8 @@ var require_schemes = __commonJS({
|
|
|
3482
3482
|
wsComponent.secure = void 0;
|
|
3483
3483
|
}
|
|
3484
3484
|
if (wsComponent.resourceName) {
|
|
3485
|
-
const [
|
|
3486
|
-
wsComponent.path =
|
|
3485
|
+
const [path7, query] = wsComponent.resourceName.split("?");
|
|
3486
|
+
wsComponent.path = path7 && path7 !== "/" ? path7 : void 0;
|
|
3487
3487
|
wsComponent.query = query;
|
|
3488
3488
|
wsComponent.resourceName = void 0;
|
|
3489
3489
|
}
|
|
@@ -12590,9 +12590,412 @@ 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
|
-
import
|
|
12998
|
+
import path6 from "node:path";
|
|
12596
12999
|
|
|
12597
13000
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
12598
13001
|
var external_exports = {};
|
|
@@ -13360,10 +13763,10 @@ function mergeDefs(...defs) {
|
|
|
13360
13763
|
function cloneDef(schema) {
|
|
13361
13764
|
return mergeDefs(schema._zod.def);
|
|
13362
13765
|
}
|
|
13363
|
-
function getElementAtPath(obj,
|
|
13364
|
-
if (!
|
|
13766
|
+
function getElementAtPath(obj, path7) {
|
|
13767
|
+
if (!path7)
|
|
13365
13768
|
return obj;
|
|
13366
|
-
return
|
|
13769
|
+
return path7.reduce((acc, key) => acc?.[key], obj);
|
|
13367
13770
|
}
|
|
13368
13771
|
function promiseAllObject(promisesObj) {
|
|
13369
13772
|
const keys = Object.keys(promisesObj);
|
|
@@ -13772,11 +14175,11 @@ function explicitlyAborted(x3, startIndex = 0) {
|
|
|
13772
14175
|
}
|
|
13773
14176
|
return false;
|
|
13774
14177
|
}
|
|
13775
|
-
function prefixIssues(
|
|
14178
|
+
function prefixIssues(path7, issues) {
|
|
13776
14179
|
return issues.map((iss) => {
|
|
13777
14180
|
var _a5;
|
|
13778
14181
|
(_a5 = iss).path ?? (_a5.path = []);
|
|
13779
|
-
iss.path.unshift(
|
|
14182
|
+
iss.path.unshift(path7);
|
|
13780
14183
|
return iss;
|
|
13781
14184
|
});
|
|
13782
14185
|
}
|
|
@@ -13923,16 +14326,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
13923
14326
|
}
|
|
13924
14327
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
13925
14328
|
const fieldErrors = { _errors: [] };
|
|
13926
|
-
const processError = (error52,
|
|
14329
|
+
const processError = (error52, path7 = []) => {
|
|
13927
14330
|
for (const issue2 of error52.issues) {
|
|
13928
14331
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
13929
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
14332
|
+
issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
|
|
13930
14333
|
} else if (issue2.code === "invalid_key") {
|
|
13931
|
-
processError({ issues: issue2.issues }, [...
|
|
14334
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
13932
14335
|
} else if (issue2.code === "invalid_element") {
|
|
13933
|
-
processError({ issues: issue2.issues }, [...
|
|
14336
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
13934
14337
|
} else {
|
|
13935
|
-
const fullpath = [...
|
|
14338
|
+
const fullpath = [...path7, ...issue2.path];
|
|
13936
14339
|
if (fullpath.length === 0) {
|
|
13937
14340
|
fieldErrors._errors.push(mapper(issue2));
|
|
13938
14341
|
} else {
|
|
@@ -13959,17 +14362,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
13959
14362
|
}
|
|
13960
14363
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
13961
14364
|
const result = { errors: [] };
|
|
13962
|
-
const processError = (error52,
|
|
14365
|
+
const processError = (error52, path7 = []) => {
|
|
13963
14366
|
var _a5, _b;
|
|
13964
14367
|
for (const issue2 of error52.issues) {
|
|
13965
14368
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
13966
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
14369
|
+
issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
|
|
13967
14370
|
} else if (issue2.code === "invalid_key") {
|
|
13968
|
-
processError({ issues: issue2.issues }, [...
|
|
14371
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
13969
14372
|
} else if (issue2.code === "invalid_element") {
|
|
13970
|
-
processError({ issues: issue2.issues }, [...
|
|
14373
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
13971
14374
|
} else {
|
|
13972
|
-
const fullpath = [...
|
|
14375
|
+
const fullpath = [...path7, ...issue2.path];
|
|
13973
14376
|
if (fullpath.length === 0) {
|
|
13974
14377
|
result.errors.push(mapper(issue2));
|
|
13975
14378
|
continue;
|
|
@@ -14001,8 +14404,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
14001
14404
|
}
|
|
14002
14405
|
function toDotPath(_path) {
|
|
14003
14406
|
const segs = [];
|
|
14004
|
-
const
|
|
14005
|
-
for (const seg of
|
|
14407
|
+
const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
14408
|
+
for (const seg of path7) {
|
|
14006
14409
|
if (typeof seg === "number")
|
|
14007
14410
|
segs.push(`[${seg}]`);
|
|
14008
14411
|
else if (typeof seg === "symbol")
|
|
@@ -26694,13 +27097,13 @@ function resolveRef(ref, ctx) {
|
|
|
26694
27097
|
if (!ref.startsWith("#")) {
|
|
26695
27098
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
26696
27099
|
}
|
|
26697
|
-
const
|
|
26698
|
-
if (
|
|
27100
|
+
const path7 = ref.slice(1).split("/").filter(Boolean);
|
|
27101
|
+
if (path7.length === 0) {
|
|
26699
27102
|
return ctx.rootSchema;
|
|
26700
27103
|
}
|
|
26701
27104
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
26702
|
-
if (
|
|
26703
|
-
const key =
|
|
27105
|
+
if (path7[0] === defsKey) {
|
|
27106
|
+
const key = path7[1];
|
|
26704
27107
|
if (!key || !ctx.defs[key]) {
|
|
26705
27108
|
throw new Error(`Reference not found: ${ref}`);
|
|
26706
27109
|
}
|
|
@@ -27178,6 +27581,20 @@ 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/thread-prewarm.js
|
|
27595
|
+
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
27596
|
+
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
27597
|
+
|
|
27181
27598
|
// ../../shared-contracts/dist/console.js
|
|
27182
27599
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
27183
27600
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -27190,10 +27607,14 @@ var consoleOpenResultSchema = external_exports.strictObject({
|
|
|
27190
27607
|
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
27191
27608
|
});
|
|
27192
27609
|
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
27610
|
+
"codexhost/console/remote-connections",
|
|
27611
|
+
"codexhost/runtime/status",
|
|
27612
|
+
"codexhost/remote/ssh-setup",
|
|
27193
27613
|
"codexhost/harness/plugins/list",
|
|
27194
27614
|
"codexhost/harness/display-settings/get",
|
|
27195
27615
|
"codexhost/harness/display-settings/set",
|
|
27196
27616
|
"codexhost/harness/inspect",
|
|
27617
|
+
"codexhost/harness/installation",
|
|
27197
27618
|
"codexhost/harness/launch-settings/get",
|
|
27198
27619
|
"codexhost/harness/launch-settings/set",
|
|
27199
27620
|
"codexhost/harness/web-ui/open",
|
|
@@ -27255,16 +27676,6 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
|
|
|
27255
27676
|
inactiveMs: external_exports.number().nonnegative()
|
|
27256
27677
|
}));
|
|
27257
27678
|
|
|
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
27679
|
// ../../shared-contracts/dist/manual-compaction.js
|
|
27269
27680
|
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
27270
27681
|
threadId: hostThreadIdSchema,
|
|
@@ -27840,14 +28251,17 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
27840
28251
|
// ../../shared-contracts/dist/harness-installation.js
|
|
27841
28252
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
27842
28253
|
harnessId: harnessIdSchema,
|
|
27843
|
-
action: external_exports.enum(["check", "update"])
|
|
28254
|
+
action: external_exports.enum(["check", "update", "install"])
|
|
27844
28255
|
}).strict();
|
|
27845
28256
|
var harnessInstallationStateSchema = external_exports.object({
|
|
27846
28257
|
currentVersion: external_exports.string().min(1).max(128),
|
|
27847
28258
|
latestVersion: external_exports.string().min(1).max(128),
|
|
27848
28259
|
updateAvailable: external_exports.boolean(),
|
|
27849
28260
|
canUpdate: external_exports.boolean(),
|
|
27850
|
-
|
|
28261
|
+
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
28262
|
+
message: external_exports.string().max(2048).optional(),
|
|
28263
|
+
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
28264
|
+
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
27851
28265
|
}).strict();
|
|
27852
28266
|
|
|
27853
28267
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
@@ -28149,347 +28563,85 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
28149
28563
|
status: updateStatusSchema.nullable()
|
|
28150
28564
|
});
|
|
28151
28565
|
|
|
28566
|
+
// ../../shared-contracts/dist/remote-runtime.js
|
|
28567
|
+
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
28568
|
+
"idle",
|
|
28569
|
+
"installing",
|
|
28570
|
+
"restarting",
|
|
28571
|
+
"succeeded",
|
|
28572
|
+
"failed"
|
|
28573
|
+
]);
|
|
28574
|
+
var runtimeStatusSchema = external_exports.object({
|
|
28575
|
+
runningVersion: external_exports.string().nullable(),
|
|
28576
|
+
installedVersion: external_exports.string().nullable(),
|
|
28577
|
+
restartRequired: external_exports.boolean(),
|
|
28578
|
+
remote: external_exports.boolean(),
|
|
28579
|
+
updateSupported: external_exports.boolean(),
|
|
28580
|
+
update: external_exports.object({
|
|
28581
|
+
phase: remoteUpdatePhaseSchema,
|
|
28582
|
+
targetVersion: external_exports.string().nullable(),
|
|
28583
|
+
error: external_exports.string().nullable()
|
|
28584
|
+
})
|
|
28585
|
+
});
|
|
28586
|
+
var remoteUpdateParamsSchema = external_exports.object({
|
|
28587
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
28588
|
+
}).strict();
|
|
28589
|
+
var remoteSshSetupParamsSchema = external_exports.object({
|
|
28590
|
+
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
28591
|
+
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28592
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
28593
|
+
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
28594
|
+
uninstallPackage: external_exports.boolean().optional(),
|
|
28595
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
28596
|
+
}).strict();
|
|
28597
|
+
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
28598
|
+
|
|
28599
|
+
// ../../shared-contracts/dist/remote-connections.js
|
|
28600
|
+
var hostId = external_exports.string().min(1).max(1024);
|
|
28601
|
+
var codexSshConnectionSchema = external_exports.object({
|
|
28602
|
+
hostId,
|
|
28603
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
28604
|
+
source: external_exports.enum(["codex-managed", "discovered"]),
|
|
28605
|
+
sshAlias: external_exports.string().max(1024).nullable(),
|
|
28606
|
+
sshHost: external_exports.string().min(1).max(1024),
|
|
28607
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28608
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
28609
|
+
autoConnect: external_exports.boolean(),
|
|
28610
|
+
connectionAnalyticsId: external_exports.string().max(1024).optional()
|
|
28611
|
+
});
|
|
28612
|
+
var codexSshDraftSchema = external_exports.strictObject({
|
|
28613
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
28614
|
+
hostname: external_exports.string().min(1).max(1024),
|
|
28615
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28616
|
+
identity: external_exports.string().max(4096).nullable()
|
|
28617
|
+
});
|
|
28618
|
+
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
28619
|
+
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
28620
|
+
external_exports.strictObject({
|
|
28621
|
+
action: external_exports.literal("save"),
|
|
28622
|
+
draft: codexSshDraftSchema,
|
|
28623
|
+
previous: codexSshConnectionSchema.nullable()
|
|
28624
|
+
}),
|
|
28625
|
+
external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
|
|
28626
|
+
external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
|
|
28627
|
+
external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
|
|
28628
|
+
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
28629
|
+
external_exports.strictObject({
|
|
28630
|
+
action: external_exports.literal("update"),
|
|
28631
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
28632
|
+
version: remoteUpdateParamsSchema.shape.version
|
|
28633
|
+
})
|
|
28634
|
+
]);
|
|
28635
|
+
var remoteConnectionsReplySchema = external_exports.union([
|
|
28636
|
+
external_exports.strictObject({ result: jsonValueSchema }),
|
|
28637
|
+
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
28638
|
+
]);
|
|
28639
|
+
|
|
28152
28640
|
// ../../shared-contracts/dist/index.js
|
|
28153
28641
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
28154
28642
|
|
|
28155
28643
|
// dist/qoder-command.js
|
|
28156
28644
|
import path4 from "node:path";
|
|
28157
|
-
|
|
28158
|
-
// ../../harness-discovery/dist/environment.js
|
|
28159
|
-
import fs from "node:fs";
|
|
28160
|
-
import path from "node:path";
|
|
28161
|
-
function targetPath(platform) {
|
|
28162
|
-
return platform === "win32" ? path.win32 : path.posix;
|
|
28163
|
-
}
|
|
28164
|
-
function environmentValue(environment, name) {
|
|
28165
|
-
const lowered = name.toLowerCase();
|
|
28166
|
-
for (const [key, value] of Object.entries(environment)) {
|
|
28167
|
-
if (key.toLowerCase() === lowered)
|
|
28168
|
-
return value;
|
|
28169
|
-
}
|
|
28170
|
-
return void 0;
|
|
28171
|
-
}
|
|
28172
|
-
function pathDelimiter(platform) {
|
|
28173
|
-
return platform === "win32" ? ";" : ":";
|
|
28174
|
-
}
|
|
28175
|
-
function pathDirectories(environment, platform) {
|
|
28176
|
-
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
28177
|
-
}
|
|
28178
|
-
function executableExtensions(command, platform, environment) {
|
|
28179
|
-
if (platform !== "win32")
|
|
28180
|
-
return [""];
|
|
28181
|
-
if (targetPath(platform).extname(command) !== "")
|
|
28182
|
-
return [""];
|
|
28183
|
-
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
28184
|
-
}
|
|
28185
|
-
function isExecutableFile(filePath, platform) {
|
|
28186
|
-
try {
|
|
28187
|
-
fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
28188
|
-
return fs.statSync(filePath).isFile();
|
|
28189
|
-
} catch {
|
|
28190
|
-
return false;
|
|
28191
|
-
}
|
|
28192
|
-
}
|
|
28193
|
-
function subdirectoryNames(directory) {
|
|
28194
|
-
try {
|
|
28195
|
-
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
28196
|
-
} catch {
|
|
28197
|
-
return [];
|
|
28198
|
-
}
|
|
28199
|
-
}
|
|
28200
|
-
function newestFirst(names) {
|
|
28201
|
-
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
28202
|
-
}
|
|
28203
|
-
|
|
28204
|
-
// ../../harness-discovery/dist/invocation.js
|
|
28205
|
-
import path2 from "node:path";
|
|
28206
|
-
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
28207
|
-
const extension = path2.win32.extname(command).toLowerCase();
|
|
28208
|
-
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
28209
|
-
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
28210
|
-
}
|
|
28211
|
-
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
28212
|
-
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
28213
|
-
return {
|
|
28214
|
-
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
28215
|
-
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
28216
|
-
windowsVerbatimArguments: true
|
|
28217
|
-
};
|
|
28218
|
-
}
|
|
28219
|
-
|
|
28220
|
-
// ../../harness-discovery/dist/node-runtime.js
|
|
28221
|
-
import path3 from "node:path";
|
|
28222
|
-
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
28223
|
-
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
28224
|
-
const delimiter = platform === "win32" ? ";" : ":";
|
|
28225
|
-
const runtimeDirectory = path3.dirname(runtimeExecutable);
|
|
28226
|
-
const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
|
|
28227
|
-
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
28228
|
-
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
28229
|
-
directories.push(runtimeDirectory);
|
|
28230
|
-
}
|
|
28231
|
-
return { ...environment, [pathKey]: directories.join(delimiter) };
|
|
28232
|
-
}
|
|
28233
|
-
|
|
28234
|
-
// ../../harness-discovery/dist/resolve.js
|
|
28235
|
-
import os from "node:os";
|
|
28236
|
-
|
|
28237
|
-
// ../../harness-discovery/dist/version-managers.js
|
|
28238
|
-
function versionManagerBinaryDirectories(context) {
|
|
28239
|
-
const { platform, environment, home } = context;
|
|
28240
|
-
const list = context.subdirectories ?? subdirectoryNames;
|
|
28241
|
-
const pathFlavor = targetPath(platform);
|
|
28242
|
-
const value = (name) => environmentValue(environment, name);
|
|
28243
|
-
const directories = [];
|
|
28244
|
-
const versioned = (root, ...tail) => {
|
|
28245
|
-
for (const version2 of newestFirst(list(root))) {
|
|
28246
|
-
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
28247
|
-
}
|
|
28248
|
-
};
|
|
28249
|
-
if (platform === "win32") {
|
|
28250
|
-
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
28251
|
-
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
28252
|
-
versioned(pathFlavor.join(appData, "nvm"));
|
|
28253
|
-
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
28254
|
-
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
28255
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
28256
|
-
const pnpmHome2 = value("PNPM_HOME");
|
|
28257
|
-
if (pnpmHome2)
|
|
28258
|
-
directories.push(pnpmHome2);
|
|
28259
|
-
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
28260
|
-
return directories;
|
|
28261
|
-
}
|
|
28262
|
-
versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
|
|
28263
|
-
const fnmRoots = [
|
|
28264
|
-
value("FNM_DIR"),
|
|
28265
|
-
pathFlavor.join(home, ".local", "share", "fnm"),
|
|
28266
|
-
pathFlavor.join(home, "Library", "Application Support", "fnm")
|
|
28267
|
-
].filter((root) => root !== void 0);
|
|
28268
|
-
for (const root of fnmRoots) {
|
|
28269
|
-
versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
|
|
28270
|
-
}
|
|
28271
|
-
const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
|
|
28272
|
-
versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
|
|
28273
|
-
directories.push(pathFlavor.join(voltaHome, "bin"));
|
|
28274
|
-
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
28275
|
-
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
28276
|
-
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
28277
|
-
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
28278
|
-
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
28279
|
-
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
28280
|
-
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
28281
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
28282
|
-
const pnpmHome = value("PNPM_HOME");
|
|
28283
|
-
if (pnpmHome)
|
|
28284
|
-
directories.push(pnpmHome);
|
|
28285
|
-
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
28286
|
-
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
28287
|
-
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
28288
|
-
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
28289
|
-
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
28290
|
-
}
|
|
28291
|
-
}
|
|
28292
|
-
return directories;
|
|
28293
|
-
}
|
|
28294
|
-
|
|
28295
|
-
// ../../harness-discovery/dist/resolve.js
|
|
28296
|
-
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
28297
|
-
function installRootExtensions(platform) {
|
|
28298
|
-
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
28299
|
-
}
|
|
28300
|
-
function resolveHomeDirectory(input) {
|
|
28301
|
-
return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
|
|
28302
|
-
}
|
|
28303
|
-
function templateVariables(environment, platform, home) {
|
|
28304
|
-
const pathFlavor = targetPath(platform);
|
|
28305
|
-
return {
|
|
28306
|
-
HOME: home,
|
|
28307
|
-
USERPROFILE: home,
|
|
28308
|
-
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
28309
|
-
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
28310
|
-
};
|
|
28311
|
-
}
|
|
28312
|
-
function joinTemplate(platform, value) {
|
|
28313
|
-
const pathFlavor = targetPath(platform);
|
|
28314
|
-
const segments = value.split("/");
|
|
28315
|
-
const head = segments[0] ?? "";
|
|
28316
|
-
const tail = segments.slice(1);
|
|
28317
|
-
if (head === "")
|
|
28318
|
-
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
28319
|
-
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
28320
|
-
}
|
|
28321
|
-
function expandInstallRoot(template, environment, platform, home) {
|
|
28322
|
-
const variables = templateVariables(environment, platform, home);
|
|
28323
|
-
let unresolved = false;
|
|
28324
|
-
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
28325
|
-
const value = variables[name] ?? environmentValue(environment, name);
|
|
28326
|
-
if (value === void 0 || value === "") {
|
|
28327
|
-
unresolved = true;
|
|
28328
|
-
return "";
|
|
28329
|
-
}
|
|
28330
|
-
return value;
|
|
28331
|
-
});
|
|
28332
|
-
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
28333
|
-
}
|
|
28334
|
-
function installRootDirectories(spec, input, dependencies, platform, home) {
|
|
28335
|
-
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
28336
|
-
const directories = [];
|
|
28337
|
-
for (const template of templates) {
|
|
28338
|
-
if (template === VERSION_MANAGER_ROOTS) {
|
|
28339
|
-
directories.push(...versionManagerBinaryDirectories({
|
|
28340
|
-
platform,
|
|
28341
|
-
environment: input.environment,
|
|
28342
|
-
home,
|
|
28343
|
-
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
28344
|
-
}));
|
|
28345
|
-
continue;
|
|
28346
|
-
}
|
|
28347
|
-
const directory = expandInstallRoot(template, input.environment, platform, home);
|
|
28348
|
-
if (directory !== void 0)
|
|
28349
|
-
directories.push(directory);
|
|
28350
|
-
}
|
|
28351
|
-
return directories;
|
|
28352
|
-
}
|
|
28353
|
-
function harnessCandidates(spec, input, dependencies = {}) {
|
|
28354
|
-
const platform = input.platform ?? process.platform;
|
|
28355
|
-
const pathFlavor = targetPath(platform);
|
|
28356
|
-
const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
|
|
28357
|
-
const command = configured ?? spec.command;
|
|
28358
|
-
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
28359
|
-
return [{ candidate: command, source: "configured" }];
|
|
28360
|
-
}
|
|
28361
|
-
const candidates = [];
|
|
28362
|
-
const extensions = executableExtensions(command, platform, input.environment);
|
|
28363
|
-
for (const directory of pathDirectories(input.environment, platform)) {
|
|
28364
|
-
for (const extension of extensions) {
|
|
28365
|
-
candidates.push({
|
|
28366
|
-
candidate: pathFlavor.join(directory, command + extension),
|
|
28367
|
-
source: "path"
|
|
28368
|
-
});
|
|
28369
|
-
}
|
|
28370
|
-
}
|
|
28371
|
-
if (configured !== void 0)
|
|
28372
|
-
return candidates;
|
|
28373
|
-
const home = resolveHomeDirectory(input);
|
|
28374
|
-
for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
|
|
28375
|
-
for (const extension of installRootExtensions(platform)) {
|
|
28376
|
-
candidates.push({
|
|
28377
|
-
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
28378
|
-
source: "install-root"
|
|
28379
|
-
});
|
|
28380
|
-
}
|
|
28381
|
-
}
|
|
28382
|
-
return candidates;
|
|
28383
|
-
}
|
|
28384
|
-
function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
28385
|
-
const platform = input.platform ?? process.platform;
|
|
28386
|
-
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
28387
|
-
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
28388
|
-
const context = { platform, isExecutable };
|
|
28389
|
-
for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
|
|
28390
|
-
const executable = runnable(candidate, context);
|
|
28391
|
-
if (executable !== void 0 && isExecutable(executable))
|
|
28392
|
-
return { executable, source };
|
|
28393
|
-
}
|
|
28394
|
-
return void 0;
|
|
28395
|
-
}
|
|
28396
|
-
|
|
28397
|
-
// ../../harness-discovery/dist/installation.js
|
|
28398
|
-
import { execFile } from "node:child_process";
|
|
28399
|
-
import { homedir } from "node:os";
|
|
28400
|
-
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
28401
|
-
const env = withNodeRuntimeOnPath(environment);
|
|
28402
|
-
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
28403
|
-
return new Promise((resolve, reject) => {
|
|
28404
|
-
const child = execFile(invocation.command, invocation.arguments, {
|
|
28405
|
-
env,
|
|
28406
|
-
cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
28407
|
-
encoding: "utf8",
|
|
28408
|
-
timeout,
|
|
28409
|
-
killSignal: "SIGKILL",
|
|
28410
|
-
maxBuffer: 1024 * 1024,
|
|
28411
|
-
windowsHide: true,
|
|
28412
|
-
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
28413
|
-
}, (error51, stdout, stderr) => {
|
|
28414
|
-
if (error51)
|
|
28415
|
-
reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
|
|
28416
|
-
else
|
|
28417
|
-
resolve((stdout || stderr).trim());
|
|
28418
|
-
});
|
|
28419
|
-
child.stdin?.end();
|
|
28420
|
-
});
|
|
28421
|
-
}
|
|
28422
|
-
function installationVersion(value) {
|
|
28423
|
-
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
28424
|
-
throw new Error("Harness returned an invalid version");
|
|
28425
|
-
return value.trim().replace(/^v/, "");
|
|
28426
|
-
}
|
|
28427
|
-
function versionFromOutput(output) {
|
|
28428
|
-
return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
|
|
28429
|
-
}
|
|
28430
|
-
function newerInstallationVersion(current, latest) {
|
|
28431
|
-
const a = installationVersion(current).replace(/\+.*/, "");
|
|
28432
|
-
const b = installationVersion(latest).replace(/\+.*/, "");
|
|
28433
|
-
const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
|
|
28434
|
-
const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
|
|
28435
|
-
for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
|
|
28436
|
-
if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
|
|
28437
|
-
return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
|
|
28438
|
-
}
|
|
28439
|
-
const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
|
|
28440
|
-
const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
|
|
28441
|
-
if (!preA.length || !preB.length)
|
|
28442
|
-
return !!preA.length && !preB.length;
|
|
28443
|
-
for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
|
|
28444
|
-
const x3 = preA[i];
|
|
28445
|
-
const y = preB[i];
|
|
28446
|
-
if (x3 === y)
|
|
28447
|
-
continue;
|
|
28448
|
-
if (x3 === void 0 || y === void 0)
|
|
28449
|
-
return x3 === void 0;
|
|
28450
|
-
const numericX = /^\d+$/.test(x3);
|
|
28451
|
-
const numericY = /^\d+$/.test(y);
|
|
28452
|
-
if (numericX && numericY) {
|
|
28453
|
-
if (BigInt(x3) === BigInt(y))
|
|
28454
|
-
continue;
|
|
28455
|
-
return BigInt(y) > BigInt(x3);
|
|
28456
|
-
}
|
|
28457
|
-
if (numericX !== numericY)
|
|
28458
|
-
return numericX;
|
|
28459
|
-
return y > x3;
|
|
28460
|
-
}
|
|
28461
|
-
return false;
|
|
28462
|
-
}
|
|
28463
|
-
function createInstallationManager(options) {
|
|
28464
|
-
let checking;
|
|
28465
|
-
let updating;
|
|
28466
|
-
const check2 = () => checking ??= options.check().finally(() => {
|
|
28467
|
-
checking = void 0;
|
|
28468
|
-
});
|
|
28469
|
-
return (action) => {
|
|
28470
|
-
if (updating)
|
|
28471
|
-
return updating;
|
|
28472
|
-
if (action === "check")
|
|
28473
|
-
return check2();
|
|
28474
|
-
updating = (async () => {
|
|
28475
|
-
const before = await check2();
|
|
28476
|
-
if (!before.updateAvailable)
|
|
28477
|
-
return before;
|
|
28478
|
-
if (!before.canUpdate)
|
|
28479
|
-
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
28480
|
-
await options.update(before);
|
|
28481
|
-
const after = await check2();
|
|
28482
|
-
if (after.currentVersion === before.currentVersion)
|
|
28483
|
-
throw new Error("The Harness version did not change; check the native updater and retry");
|
|
28484
|
-
return after;
|
|
28485
|
-
})().finally(() => {
|
|
28486
|
-
updating = void 0;
|
|
28487
|
-
});
|
|
28488
|
-
return updating;
|
|
28489
|
-
};
|
|
28490
|
-
}
|
|
28491
|
-
|
|
28492
|
-
// dist/qoder-command.js
|
|
28493
28645
|
var QoderExecutableError = class extends Error {
|
|
28494
28646
|
code = "QODER_NOT_FOUND";
|
|
28495
28647
|
};
|
|
@@ -28745,6 +28897,26 @@ function mapQoderException(error51) {
|
|
|
28745
28897
|
};
|
|
28746
28898
|
}
|
|
28747
28899
|
|
|
28900
|
+
// dist/qoder-login-check.js
|
|
28901
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
28902
|
+
function qoderLoginRequired(text) {
|
|
28903
|
+
return /\bnot logged in\b|\bauthentication (?:required|expired)\b/i.test(text);
|
|
28904
|
+
}
|
|
28905
|
+
function checkQoderLogin(executable, environment, cwd) {
|
|
28906
|
+
return new Promise((resolve) => {
|
|
28907
|
+
execFile2(executable, ["--list-models"], {
|
|
28908
|
+
env: environment,
|
|
28909
|
+
cwd,
|
|
28910
|
+
timeout: 1e4,
|
|
28911
|
+
maxBuffer: 64 * 1024,
|
|
28912
|
+
windowsHide: true
|
|
28913
|
+
}, (error51, stdout, stderr) => {
|
|
28914
|
+
resolve(Boolean(error51 && !error51.killed && qoderLoginRequired(`${stdout}
|
|
28915
|
+
${stderr}`)));
|
|
28916
|
+
});
|
|
28917
|
+
});
|
|
28918
|
+
}
|
|
28919
|
+
|
|
28748
28920
|
// ../../harness-adapter/dist/approval.js
|
|
28749
28921
|
function invalidRequest(message) {
|
|
28750
28922
|
return { code: "invalidRequest", message, retryable: false };
|
|
@@ -30096,8 +30268,8 @@ function getErrorMap2() {
|
|
|
30096
30268
|
|
|
30097
30269
|
// ../../../node_modules/zod/v3/helpers/parseUtil.js
|
|
30098
30270
|
var makeIssue = (params) => {
|
|
30099
|
-
const { data, path:
|
|
30100
|
-
const fullPath = [...
|
|
30271
|
+
const { data, path: path7, errorMaps, issueData } = params;
|
|
30272
|
+
const fullPath = [...path7, ...issueData.path || []];
|
|
30101
30273
|
const fullIssue = {
|
|
30102
30274
|
...issueData,
|
|
30103
30275
|
path: fullPath
|
|
@@ -30212,11 +30384,11 @@ var errorUtil;
|
|
|
30212
30384
|
|
|
30213
30385
|
// ../../../node_modules/zod/v3/types.js
|
|
30214
30386
|
var ParseInputLazyPath = class {
|
|
30215
|
-
constructor(parent, value,
|
|
30387
|
+
constructor(parent, value, path7, key) {
|
|
30216
30388
|
this._cachedPath = [];
|
|
30217
30389
|
this.parent = parent;
|
|
30218
30390
|
this.data = value;
|
|
30219
|
-
this._path =
|
|
30391
|
+
this._path = path7;
|
|
30220
30392
|
this._key = key;
|
|
30221
30393
|
}
|
|
30222
30394
|
get path() {
|
|
@@ -33743,11 +33915,11 @@ function normalizeObjectSchema(schema) {
|
|
|
33743
33915
|
}
|
|
33744
33916
|
return void 0;
|
|
33745
33917
|
}
|
|
33746
|
-
function getDotPath(
|
|
33747
|
-
if (
|
|
33918
|
+
function getDotPath(path7) {
|
|
33919
|
+
if (path7.length === 0) {
|
|
33748
33920
|
return "object root";
|
|
33749
33921
|
}
|
|
33750
|
-
return
|
|
33922
|
+
return path7.reduce((acc, seg, index) => {
|
|
33751
33923
|
if (index === 0) {
|
|
33752
33924
|
return String(seg);
|
|
33753
33925
|
}
|
|
@@ -52318,12 +52490,171 @@ var QoderSession = class {
|
|
|
52318
52490
|
}
|
|
52319
52491
|
};
|
|
52320
52492
|
|
|
52493
|
+
// dist/qoder-session-import.js
|
|
52494
|
+
import { stat } from "node:fs/promises";
|
|
52495
|
+
import path5 from "node:path";
|
|
52496
|
+
|
|
52497
|
+
// ../../harness-adapter/dist/session-import.js
|
|
52498
|
+
var STORAGE_ACCESS_ERRORS = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EIO", "EMFILE", "ENFILE"]);
|
|
52499
|
+
function isStorageAccessError(error51) {
|
|
52500
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && typeof error51.code === "string" && STORAGE_ACCESS_ERRORS.has(error51.code);
|
|
52501
|
+
}
|
|
52502
|
+
function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
|
|
52503
|
+
if (typeof value !== "string")
|
|
52504
|
+
return null;
|
|
52505
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
52506
|
+
if (!normalized)
|
|
52507
|
+
return null;
|
|
52508
|
+
if (normalized.length <= maxLength)
|
|
52509
|
+
return normalized;
|
|
52510
|
+
const characters = [...normalized];
|
|
52511
|
+
if (characters.length <= maxLength)
|
|
52512
|
+
return normalized;
|
|
52513
|
+
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
52514
|
+
}
|
|
52515
|
+
function sessionImportCandidate(input) {
|
|
52516
|
+
const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
|
|
52517
|
+
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
52518
|
+
nativeSessionId: input.nativeSessionId,
|
|
52519
|
+
cwd: input.cwd,
|
|
52520
|
+
title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
|
|
52521
|
+
updatedAt: Math.floor(time3),
|
|
52522
|
+
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
52523
|
+
running: typeof input.running === "boolean" ? input.running : null
|
|
52524
|
+
});
|
|
52525
|
+
return parsed.success ? parsed.data : null;
|
|
52526
|
+
}
|
|
52527
|
+
var SessionImportScope = class {
|
|
52528
|
+
#abort = new AbortController();
|
|
52529
|
+
#options;
|
|
52530
|
+
#pending = /* @__PURE__ */ new Set();
|
|
52531
|
+
constructor(options) {
|
|
52532
|
+
this.#options = options;
|
|
52533
|
+
}
|
|
52534
|
+
#closed() {
|
|
52535
|
+
return {
|
|
52536
|
+
ok: false,
|
|
52537
|
+
error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
|
|
52538
|
+
};
|
|
52539
|
+
}
|
|
52540
|
+
read(operation) {
|
|
52541
|
+
const signal = this.#abort.signal;
|
|
52542
|
+
if (signal.aborted)
|
|
52543
|
+
return Promise.resolve(this.#closed());
|
|
52544
|
+
let started;
|
|
52545
|
+
try {
|
|
52546
|
+
started = operation(signal);
|
|
52547
|
+
} catch (error51) {
|
|
52548
|
+
started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
|
|
52549
|
+
}
|
|
52550
|
+
const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
|
|
52551
|
+
ok: false,
|
|
52552
|
+
error: {
|
|
52553
|
+
code: "unavailable",
|
|
52554
|
+
message: this.#options.unavailableMessage,
|
|
52555
|
+
retryable: true
|
|
52556
|
+
}
|
|
52557
|
+
}).finally(() => this.#pending.delete(request));
|
|
52558
|
+
this.#pending.add(request);
|
|
52559
|
+
return request;
|
|
52560
|
+
}
|
|
52561
|
+
/** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
|
|
52562
|
+
async resolve(operation) {
|
|
52563
|
+
const result = await this.read(operation);
|
|
52564
|
+
if (!result.ok)
|
|
52565
|
+
return result;
|
|
52566
|
+
return result.value ? { ok: true, value: result.value } : {
|
|
52567
|
+
ok: false,
|
|
52568
|
+
error: {
|
|
52569
|
+
code: "sessionNotFound",
|
|
52570
|
+
message: this.#options.notFoundMessage,
|
|
52571
|
+
retryable: false
|
|
52572
|
+
}
|
|
52573
|
+
};
|
|
52574
|
+
}
|
|
52575
|
+
/** Idempotent. Resolves after every started read has settled. */
|
|
52576
|
+
async close() {
|
|
52577
|
+
this.#abort.abort();
|
|
52578
|
+
await Promise.allSettled(this.#pending);
|
|
52579
|
+
}
|
|
52580
|
+
};
|
|
52581
|
+
|
|
52582
|
+
// dist/qoder-session-import.js
|
|
52583
|
+
var QoderSessionImport = class {
|
|
52584
|
+
#dependencies;
|
|
52585
|
+
#scope;
|
|
52586
|
+
constructor(dependencies) {
|
|
52587
|
+
this.#dependencies = dependencies;
|
|
52588
|
+
const name = dependencies.displayName;
|
|
52589
|
+
this.#scope = new SessionImportScope({
|
|
52590
|
+
closedMessage: `${name} Session import is closed`,
|
|
52591
|
+
unavailableMessage: `${name} sessions could not be read; check storage access and retry`,
|
|
52592
|
+
notFoundMessage: `${name} Session is no longer importable`
|
|
52593
|
+
});
|
|
52594
|
+
}
|
|
52595
|
+
listCandidates() {
|
|
52596
|
+
return this.#scope.read(async (signal) => {
|
|
52597
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
52598
|
+
for (const info of await this.#dependencies.listSessions()) {
|
|
52599
|
+
signal.throwIfAborted();
|
|
52600
|
+
const candidate = await this.#candidate(info);
|
|
52601
|
+
if (candidate && !candidates.has(candidate.nativeSessionId))
|
|
52602
|
+
candidates.set(candidate.nativeSessionId, candidate);
|
|
52603
|
+
}
|
|
52604
|
+
return [...candidates.values()];
|
|
52605
|
+
});
|
|
52606
|
+
}
|
|
52607
|
+
resolveCandidate(nativeSessionId) {
|
|
52608
|
+
return this.#scope.resolve(async (signal) => {
|
|
52609
|
+
const info = await this.#dependencies.getSessionInfo(nativeSessionId);
|
|
52610
|
+
signal.throwIfAborted();
|
|
52611
|
+
if (info?.sessionId !== nativeSessionId)
|
|
52612
|
+
return null;
|
|
52613
|
+
const candidate = await this.#candidate(info);
|
|
52614
|
+
if (!candidate)
|
|
52615
|
+
return null;
|
|
52616
|
+
return {
|
|
52617
|
+
candidate,
|
|
52618
|
+
nativeRef: nativeSessionRefSchema.parse({
|
|
52619
|
+
harnessId: this.#dependencies.harnessId,
|
|
52620
|
+
nativeSessionId,
|
|
52621
|
+
formatVersion: 1
|
|
52622
|
+
})
|
|
52623
|
+
};
|
|
52624
|
+
});
|
|
52625
|
+
}
|
|
52626
|
+
close() {
|
|
52627
|
+
return this.#scope.close();
|
|
52628
|
+
}
|
|
52629
|
+
async #candidate(info) {
|
|
52630
|
+
if (typeof info.cwd !== "string" || !path5.isAbsolute(info.cwd))
|
|
52631
|
+
return null;
|
|
52632
|
+
const cwd = path5.resolve(info.cwd);
|
|
52633
|
+
try {
|
|
52634
|
+
if (!(await stat(cwd)).isDirectory())
|
|
52635
|
+
return null;
|
|
52636
|
+
} catch (error51) {
|
|
52637
|
+
if (isStorageAccessError(error51))
|
|
52638
|
+
throw error51;
|
|
52639
|
+
return null;
|
|
52640
|
+
}
|
|
52641
|
+
return sessionImportCandidate({
|
|
52642
|
+
nativeSessionId: info.sessionId,
|
|
52643
|
+
cwd,
|
|
52644
|
+
title: sessionImportTitle(info.customTitle) ?? sessionImportTitle(info.summary) ?? sessionImportTitle(info.firstPrompt),
|
|
52645
|
+
updatedAt: info.lastModified
|
|
52646
|
+
// The SDK exposes no cross-process activity marker: idleness cannot be established.
|
|
52647
|
+
});
|
|
52648
|
+
}
|
|
52649
|
+
};
|
|
52650
|
+
|
|
52321
52651
|
// dist/qoder-adapter.js
|
|
52322
52652
|
var QoderAdapter = class {
|
|
52323
52653
|
harnessId;
|
|
52324
52654
|
#variant;
|
|
52325
52655
|
commandCatalog = QODER_FALLBACK_COMMAND_CATALOG;
|
|
52326
52656
|
liveCommandCatalog = true;
|
|
52657
|
+
sessionImport;
|
|
52327
52658
|
#commandOverride;
|
|
52328
52659
|
#environment;
|
|
52329
52660
|
#platform;
|
|
@@ -52347,6 +52678,12 @@ var QoderAdapter = class {
|
|
|
52347
52678
|
this.#forkSession = options.forkSession ?? runtime.sdk.forkSession;
|
|
52348
52679
|
this.#getSessionMessages = options.getSessionMessages ?? runtime.sdk.getSessionMessages;
|
|
52349
52680
|
this.#getSessionInfo = options.getSessionInfo ?? runtime.sdk.getSessionInfo;
|
|
52681
|
+
this.sessionImport = new QoderSessionImport({
|
|
52682
|
+
harnessId: this.harnessId,
|
|
52683
|
+
displayName: this.#variant === "cn" ? "Qoder CN" : "Qoder",
|
|
52684
|
+
listSessions: options.listSessions ?? (() => runtime.sdk.listSessions()),
|
|
52685
|
+
getSessionInfo: this.#getSessionInfo
|
|
52686
|
+
});
|
|
52350
52687
|
this.#getAvailableModels = options.getAvailableModels;
|
|
52351
52688
|
this.#resolveExecutable = options.resolveExecutable ?? ((input, dependencies) => resolveQoderExecutable({ ...input, variant: this.#variant }, dependencies));
|
|
52352
52689
|
}
|
|
@@ -52411,11 +52748,15 @@ var QoderAdapter = class {
|
|
|
52411
52748
|
} catch {
|
|
52412
52749
|
}
|
|
52413
52750
|
} else {
|
|
52751
|
+
let stderr = "";
|
|
52414
52752
|
try {
|
|
52415
52753
|
const probeQuery = this.#queryFactory({
|
|
52416
52754
|
prompt: "",
|
|
52417
52755
|
options: {
|
|
52418
52756
|
cwd: input?.cwd ?? process.cwd(),
|
|
52757
|
+
stderr: (chunk) => {
|
|
52758
|
+
stderr = (stderr + chunk).slice(-8192);
|
|
52759
|
+
},
|
|
52419
52760
|
pathToQoderCLIExecutable: executable,
|
|
52420
52761
|
...this.#environment ? { env: this.#environment } : {},
|
|
52421
52762
|
auth: qoderAuthForEnvironment(this.#variant, this.#environment)
|
|
@@ -52432,9 +52773,14 @@ var QoderAdapter = class {
|
|
|
52432
52773
|
}
|
|
52433
52774
|
}
|
|
52434
52775
|
} catch (error51) {
|
|
52776
|
+
const needsLogin = qoderLoginRequired(stderr) || error51 instanceof Error && error51.message === "Transport closed" && qoderAuthForEnvironment(this.#variant, this.#environment).type === "qodercli" && await checkQoderLogin(executable, this.#environment, input?.cwd);
|
|
52435
52777
|
const result2 = {
|
|
52436
52778
|
status: "unavailable",
|
|
52437
|
-
error:
|
|
52779
|
+
error: needsLogin ? {
|
|
52780
|
+
code: "authenticationRequired",
|
|
52781
|
+
message: `Please run ${this.#variant === "cn" ? "qoderclicn" : "qodercli"} login to authenticate.`,
|
|
52782
|
+
retryable: false
|
|
52783
|
+
} : mapQoderException(error51)
|
|
52438
52784
|
};
|
|
52439
52785
|
return result2;
|
|
52440
52786
|
}
|
|
@@ -52556,7 +52902,7 @@ var QoderAdapter = class {
|
|
|
52556
52902
|
sourceInfo = await this.#getSessionInfo(sourceRef.data.nativeSessionId, { dir: input.cwd });
|
|
52557
52903
|
} catch {
|
|
52558
52904
|
}
|
|
52559
|
-
if (sourceInfo?.cwd &&
|
|
52905
|
+
if (sourceInfo?.cwd && path6.resolve(sourceInfo.cwd) !== path6.resolve(input.cwd)) {
|
|
52560
52906
|
return {
|
|
52561
52907
|
ok: false,
|
|
52562
52908
|
error: {
|
|
@@ -52706,7 +53052,7 @@ var QoderAdapter = class {
|
|
|
52706
53052
|
this.#sessions.clear();
|
|
52707
53053
|
this.#inspections.clear();
|
|
52708
53054
|
this.#inFlightInspections.clear();
|
|
52709
|
-
await Promise.all(sessions.map((s) => s.close()));
|
|
53055
|
+
await Promise.all([this.sessionImport.close(), ...sessions.map((s) => s.close())]);
|
|
52710
53056
|
}
|
|
52711
53057
|
};
|
|
52712
53058
|
|
|
@@ -52722,6 +53068,7 @@ function createQoderInstallation(environment, command, variant = "global") {
|
|
|
52722
53068
|
latestVersion: "Unknown",
|
|
52723
53069
|
updateAvailable: false,
|
|
52724
53070
|
canUpdate: false,
|
|
53071
|
+
messageCode: "qoder-check-unavailable",
|
|
52725
53072
|
message: "This Qoder China release does not expose a non-installing update check. Use its original installer."
|
|
52726
53073
|
};
|
|
52727
53074
|
const output = await run(["update", "--check"]);
|
|
@@ -52757,7 +53104,13 @@ function createHarnessAdapter(context, variant = "global") {
|
|
|
52757
53104
|
variant,
|
|
52758
53105
|
environment,
|
|
52759
53106
|
platform: context.platform
|
|
52760
|
-
}), {
|
|
53107
|
+
}), {
|
|
53108
|
+
installation: createQoderInstallation(environment, command, variant),
|
|
53109
|
+
install: createHarnessInstaller(environment, variant === "cn" ? {
|
|
53110
|
+
posix: "https://static.qoder.com.cn/qoder-cli-cn/install.sh",
|
|
53111
|
+
windows: "https://static.qoder.com.cn/qoder-cli-cn/install.ps1"
|
|
53112
|
+
} : { posix: "https://qoder.com/install", windows: "https://qoder.com/install.ps1" })
|
|
53113
|
+
});
|
|
52761
53114
|
}
|
|
52762
53115
|
export {
|
|
52763
53116
|
CODEXHOST_QODER_COMMAND,
|