@liberseek/boft-cli-win32-arm64 0.7.5 → 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 +17950 -0
- package/app/console-web.js +27484 -0
- package/app/desktop-controller.mjs +221 -33
- package/app/host-runtime.mjs +3590 -1251
- package/app/plugins/antigravity/plugin.mjs +726 -357
- package/app/plugins/claude-code/plugin.mjs +3067 -2208
- package/app/plugins/codebuddy/plugin.mjs +798 -386
- package/app/plugins/cursor-cli/manifest.json +1 -1
- package/app/plugins/cursor-cli/plugin.mjs +1230 -555
- package/app/plugins/deepseek-harness/plugin.mjs +4761 -4967
- package/app/plugins/grok/plugin.mjs +670 -361
- package/app/plugins/hermes/plugin.mjs +764 -441
- package/app/plugins/kimi-code/plugin.mjs +1095 -428
- package/app/plugins/kiro-cli/plugin.mjs +603 -332
- package/app/plugins/muse/plugin.mjs +189 -58
- package/app/plugins/omp/plugin.mjs +689 -334
- package/app/plugins/opencode/plugin.mjs +946 -478
- package/app/plugins/pi/plugin.mjs +1325 -587
- package/app/plugins/qoder/plugin.mjs +756 -308
- package/app/plugins/qoder-cn/plugin.mjs +555 -99
- package/app/plugins/workbuddy/plugin.mjs +192 -58
- package/app/renderer-extension.js +3703 -1703
- package/bin/boft.exe +0 -0
- package/libexec/boft-node-repl.exe +0 -0
- package/libexec/boft-shim.exe +0 -0
- package/libexec/boft-updater.exe +0 -0
- package/package.json +2 -2
|
@@ -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(path6) {
|
|
3233
|
+
let input = path6;
|
|
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 [path6, query] = wsComponent.resourceName.split("?");
|
|
3486
|
+
wsComponent.path = path6 && path6 !== "/" ? path6 : 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 path5 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, path6) {
|
|
13767
|
+
if (!path6)
|
|
13365
13768
|
return obj;
|
|
13366
|
-
return
|
|
13769
|
+
return path6.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(path6, 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(path6);
|
|
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, path6 = []) => {
|
|
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 }, [...path6, ...issue2.path]));
|
|
13930
14333
|
} else if (issue2.code === "invalid_key") {
|
|
13931
|
-
processError({ issues: issue2.issues }, [...
|
|
14334
|
+
processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
|
|
13932
14335
|
} else if (issue2.code === "invalid_element") {
|
|
13933
|
-
processError({ issues: issue2.issues }, [...
|
|
14336
|
+
processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
|
|
13934
14337
|
} else {
|
|
13935
|
-
const fullpath = [...
|
|
14338
|
+
const fullpath = [...path6, ...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, path6 = []) => {
|
|
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 }, [...path6, ...issue2.path]));
|
|
13967
14370
|
} else if (issue2.code === "invalid_key") {
|
|
13968
|
-
processError({ issues: issue2.issues }, [...
|
|
14371
|
+
processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
|
|
13969
14372
|
} else if (issue2.code === "invalid_element") {
|
|
13970
|
-
processError({ issues: issue2.issues }, [...
|
|
14373
|
+
processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
|
|
13971
14374
|
} else {
|
|
13972
|
-
const fullpath = [...
|
|
14375
|
+
const fullpath = [...path6, ...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 path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
14408
|
+
for (const seg of path6) {
|
|
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 path6 = ref.slice(1).split("/").filter(Boolean);
|
|
27101
|
+
if (path6.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 (path6[0] === defsKey) {
|
|
27106
|
+
const key = path6[1];
|
|
26704
27107
|
if (!key || !ctx.defs[key]) {
|
|
26705
27108
|
throw new Error(`Reference not found: ${ref}`);
|
|
26706
27109
|
}
|
|
@@ -27163,6 +27566,123 @@ var credentialImportsParamsSchema = external_exports.object({
|
|
|
27163
27566
|
request: credentialImportsRequestSchema
|
|
27164
27567
|
}).strict();
|
|
27165
27568
|
|
|
27569
|
+
// ../../shared-contracts/dist/harness-display-settings.js
|
|
27570
|
+
var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
|
|
27571
|
+
agent: external_exports.string().min(1).max(128),
|
|
27572
|
+
section: external_exports.enum(["main", "more", "auto"])
|
|
27573
|
+
})).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
|
|
27574
|
+
var harnessDisplaySettingsSchema = external_exports.strictObject({
|
|
27575
|
+
entries: harnessDisplayEntriesSchema.nullable()
|
|
27576
|
+
});
|
|
27577
|
+
var harnessDisplayGetSchema = external_exports.strictObject({});
|
|
27578
|
+
var harnessDisplaySetSchema = external_exports.strictObject({
|
|
27579
|
+
entries: harnessDisplayEntriesSchema,
|
|
27580
|
+
/** Import legacy Desktop preferences only if no shared settings exist yet. */
|
|
27581
|
+
initializeOnly: external_exports.boolean().optional()
|
|
27582
|
+
});
|
|
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
|
+
|
|
27649
|
+
// ../../shared-contracts/dist/console.js
|
|
27650
|
+
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
27651
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
27652
|
+
type: external_exports.enum(["info", "warning", "danger"]),
|
|
27653
|
+
body: external_exports.string().trim().min(1).max(16 * 1024)
|
|
27654
|
+
});
|
|
27655
|
+
var consoleOpenParamsSchema = external_exports.strictObject({});
|
|
27656
|
+
var consoleOpenResultSchema = external_exports.strictObject({
|
|
27657
|
+
/** The console address. */
|
|
27658
|
+
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
27659
|
+
});
|
|
27660
|
+
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
27661
|
+
"codexhost/harness/plugins/list",
|
|
27662
|
+
"codexhost/harness/display-settings/get",
|
|
27663
|
+
"codexhost/harness/display-settings/set",
|
|
27664
|
+
"codexhost/harness/inspect",
|
|
27665
|
+
"codexhost/harness/installation",
|
|
27666
|
+
"codexhost/harness/launch-settings/get",
|
|
27667
|
+
"codexhost/harness/launch-settings/set",
|
|
27668
|
+
HARNESS_LONG_CONTEXT_GET_METHOD,
|
|
27669
|
+
HARNESS_LONG_CONTEXT_SET_METHOD,
|
|
27670
|
+
"codexhost/harness/web-ui/open",
|
|
27671
|
+
"codexhost/harness/accounts/sources",
|
|
27672
|
+
"codexhost/harness/accounts/list",
|
|
27673
|
+
"codexhost/harness/accounts/inspect",
|
|
27674
|
+
"codexhost/harness/credential-imports",
|
|
27675
|
+
"codexhost/harness/session-import/sources",
|
|
27676
|
+
"codexhost/harness/session-import/list",
|
|
27677
|
+
"codexhost/harness/session-import/import",
|
|
27678
|
+
"codexhost/account/list",
|
|
27679
|
+
"codexhost/account/refresh",
|
|
27680
|
+
"codexhost/account/usage/inspect",
|
|
27681
|
+
"codexhost/update/check",
|
|
27682
|
+
"codexhost/update/start",
|
|
27683
|
+
"codexhost/update/status"
|
|
27684
|
+
]);
|
|
27685
|
+
|
|
27166
27686
|
// ../../shared-contracts/dist/version.js
|
|
27167
27687
|
var WORKSPACE_CONTRACT_VERSION = 1;
|
|
27168
27688
|
|
|
@@ -27206,15 +27726,11 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
|
|
|
27206
27726
|
inactiveMs: external_exports.number().nonnegative()
|
|
27207
27727
|
}));
|
|
27208
27728
|
|
|
27209
|
-
// ../../shared-contracts/dist/
|
|
27210
|
-
var
|
|
27211
|
-
|
|
27729
|
+
// ../../shared-contracts/dist/manual-compaction.js
|
|
27730
|
+
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
27731
|
+
threadId: hostThreadIdSchema,
|
|
27732
|
+
turnId: hostTurnIdSchema
|
|
27212
27733
|
});
|
|
27213
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
27214
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
27215
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
27216
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
27217
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
27218
27734
|
|
|
27219
27735
|
// ../../shared-contracts/dist/thread-usage.js
|
|
27220
27736
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
@@ -27276,6 +27792,10 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27276
27792
|
var usagePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
27277
27793
|
var accountCreditsProductUsageSchema = external_exports.object({
|
|
27278
27794
|
product: external_exports.string().min(1),
|
|
27795
|
+
used: external_exports.number().finite().nonnegative().optional(),
|
|
27796
|
+
// Zero is a real empty cap, not an absent field.
|
|
27797
|
+
limit: external_exports.number().finite().nonnegative().optional(),
|
|
27798
|
+
unit: external_exports.string().min(1).max(32).optional(),
|
|
27279
27799
|
usagePercent: usagePercentSchema,
|
|
27280
27800
|
resetsAt: external_exports.string().min(1).optional()
|
|
27281
27801
|
}).strict();
|
|
@@ -27285,11 +27805,14 @@ var accountResetCreditsSchema = external_exports.object({
|
|
|
27285
27805
|
expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
|
|
27286
27806
|
}).strict();
|
|
27287
27807
|
var accountCreditsSnapshotSchema = external_exports.object({
|
|
27808
|
+
used: external_exports.number().finite().nonnegative().optional(),
|
|
27809
|
+
// Zero is a real empty cap, not an absent field.
|
|
27810
|
+
limit: external_exports.number().finite().nonnegative().optional(),
|
|
27811
|
+
unit: external_exports.string().trim().min(1).max(32).optional(),
|
|
27288
27812
|
/** Native label when the primary limit is scoped to a model or product group. */
|
|
27289
27813
|
label: external_exports.string().min(1).optional(),
|
|
27290
27814
|
usedPercent: usagePercentSchema.optional(),
|
|
27291
27815
|
remaining: external_exports.number().finite().optional(),
|
|
27292
|
-
unit: external_exports.string().trim().min(1).max(32).optional(),
|
|
27293
27816
|
resetsAt: external_exports.string().min(1).optional(),
|
|
27294
27817
|
periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
|
|
27295
27818
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
@@ -27320,12 +27843,27 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
27320
27843
|
}).strict();
|
|
27321
27844
|
|
|
27322
27845
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
27323
|
-
var
|
|
27846
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
27847
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
27848
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
27849
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
27850
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
27851
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
27852
|
+
}).strict();
|
|
27853
|
+
var harnessAccountSnapshotObject = external_exports.object({
|
|
27324
27854
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
27325
27855
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
27326
27856
|
plan: external_exports.string().trim().min(1).max(128).optional(),
|
|
27327
|
-
credits: accountCreditsSnapshotSchema
|
|
27857
|
+
credits: accountCreditsSnapshotSchema.optional(),
|
|
27858
|
+
balance: accountBalanceSnapshotSchema.optional()
|
|
27328
27859
|
}).strict();
|
|
27860
|
+
function requireReportedQuota(schema) {
|
|
27861
|
+
return schema.refine((value) => {
|
|
27862
|
+
const reported = value;
|
|
27863
|
+
return reported.credits !== void 0 || reported.balance !== void 0;
|
|
27864
|
+
}, { message: "Account must report either credits or a balance" });
|
|
27865
|
+
}
|
|
27866
|
+
var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
|
|
27329
27867
|
var harnessAccountIdentityShape = {
|
|
27330
27868
|
harnessId: harnessIdSchema,
|
|
27331
27869
|
harnessName: external_exports.string().trim().min(1).max(128)
|
|
@@ -27336,11 +27874,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
|
|
|
27336
27874
|
var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
|
|
27337
27875
|
var harnessAccountInspectResultSchema = external_exports.object({
|
|
27338
27876
|
...harnessAccountIdentityShape,
|
|
27339
|
-
account: harnessAccountSnapshotSchema.nullable()
|
|
27877
|
+
account: harnessAccountSnapshotSchema.nullable(),
|
|
27878
|
+
/** Every Billing Source from one Harness; `account` remains the first for older clients. */
|
|
27879
|
+
accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
|
|
27340
27880
|
}).strict();
|
|
27341
27881
|
var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
|
|
27342
27882
|
var harnessAccountListResultSchema = external_exports.object({
|
|
27343
|
-
accounts: external_exports.array(
|
|
27883
|
+
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
27344
27884
|
}).strict();
|
|
27345
27885
|
|
|
27346
27886
|
// ../../shared-contracts/dist/json-value.js
|
|
@@ -27478,6 +28018,8 @@ var harnessModelSchema = external_exports.object({
|
|
|
27478
28018
|
ref: harnessModelRefSchema,
|
|
27479
28019
|
label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
|
|
27480
28020
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
28021
|
+
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
28022
|
+
fastModel: harnessModelRefSchema.optional(),
|
|
27481
28023
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
27482
28024
|
}).strict();
|
|
27483
28025
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
@@ -27510,6 +28052,16 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
27510
28052
|
});
|
|
27511
28053
|
}
|
|
27512
28054
|
refs.add(model.ref.id);
|
|
28055
|
+
if (model.fastModel) {
|
|
28056
|
+
if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
|
|
28057
|
+
context.addIssue({
|
|
28058
|
+
code: "custom",
|
|
28059
|
+
message: "Fast Model refs must be distinct and unique",
|
|
28060
|
+
path: ["models", index, "fastModel"]
|
|
28061
|
+
});
|
|
28062
|
+
}
|
|
28063
|
+
refs.add(model.fastModel.id);
|
|
28064
|
+
}
|
|
27513
28065
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
27514
28066
|
for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
|
|
27515
28067
|
if (supportedThinkingIds.has(optionId)) {
|
|
@@ -27632,11 +28184,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
|
|
|
27632
28184
|
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
27633
28185
|
}).strict();
|
|
27634
28186
|
var threadInspectionParamsSchema = external_exports.object({
|
|
27635
|
-
threadId: hostThreadIdSchema
|
|
28187
|
+
threadId: hostThreadIdSchema,
|
|
28188
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
27636
28189
|
}).strict();
|
|
27637
28190
|
var codexThreadInspectionSchema = external_exports.object({
|
|
27638
28191
|
owner: external_exports.literal("codex"),
|
|
27639
|
-
locked: external_exports.literal(true)
|
|
28192
|
+
locked: external_exports.literal(true),
|
|
28193
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
27640
28194
|
}).strict();
|
|
27641
28195
|
var externalThreadInspectionSchema = external_exports.object({
|
|
27642
28196
|
owner: external_exports.literal("external"),
|
|
@@ -27701,48 +28255,6 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
27701
28255
|
}
|
|
27702
28256
|
});
|
|
27703
28257
|
|
|
27704
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
27705
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
27706
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
27707
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
27708
|
-
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);
|
|
27709
|
-
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");
|
|
27710
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
27711
|
-
var pluginPresentationShape = {
|
|
27712
|
-
id: harnessPluginIdSchema,
|
|
27713
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
27714
|
-
version: external_exports.string().min(1).max(128),
|
|
27715
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
27716
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
27717
|
-
links: external_exports.object({
|
|
27718
|
-
documentation: documentationUrlSchema.optional(),
|
|
27719
|
-
installation: documentationUrlSchema.optional()
|
|
27720
|
-
}).strict().optional()
|
|
27721
|
-
};
|
|
27722
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
27723
|
-
manifestVersion: external_exports.literal(1),
|
|
27724
|
-
...pluginPresentationShape,
|
|
27725
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
27726
|
-
entry: relativeResourceSchema,
|
|
27727
|
-
icon: relativeResourceSchema.optional()
|
|
27728
|
-
}).strict();
|
|
27729
|
-
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);
|
|
27730
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
27731
|
-
...pluginPresentationShape,
|
|
27732
|
-
icon: harnessPluginIconSchema.optional()
|
|
27733
|
-
}).strict();
|
|
27734
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
27735
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
27736
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
27737
|
-
}).strict();
|
|
27738
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
27739
|
-
version: external_exports.literal(1),
|
|
27740
|
-
enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
27741
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
27742
|
-
message: "Enabled plugin IDs must be unique",
|
|
27743
|
-
path: ["enabled"]
|
|
27744
|
-
});
|
|
27745
|
-
|
|
27746
28258
|
// ../../shared-contracts/dist/harness-route.js
|
|
27747
28259
|
var harnessPluginRouteSchema = external_exports.object({
|
|
27748
28260
|
harnessId: harnessPluginIdSchema,
|
|
@@ -27764,10 +28276,31 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
27764
28276
|
restartRequired: external_exports.boolean()
|
|
27765
28277
|
}).strict();
|
|
27766
28278
|
|
|
28279
|
+
// ../../shared-contracts/dist/harness-installation.js
|
|
28280
|
+
var harnessInstallationParamsSchema = external_exports.object({
|
|
28281
|
+
harnessId: harnessIdSchema,
|
|
28282
|
+
action: external_exports.enum(["check", "update", "install"])
|
|
28283
|
+
}).strict();
|
|
28284
|
+
var harnessInstallationStateSchema = external_exports.object({
|
|
28285
|
+
currentVersion: external_exports.string().min(1).max(128),
|
|
28286
|
+
latestVersion: external_exports.string().min(1).max(128),
|
|
28287
|
+
updateAvailable: external_exports.boolean(),
|
|
28288
|
+
canUpdate: external_exports.boolean(),
|
|
28289
|
+
message: external_exports.string().max(2048).optional()
|
|
28290
|
+
}).strict();
|
|
28291
|
+
|
|
27767
28292
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
27768
28293
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
27769
28294
|
var nonBlankTextSchema3 = external_exports.string().trim().min(1);
|
|
27770
28295
|
var codexAccountAuthKindSchema = external_exports.enum(["api", "chatgpt"]);
|
|
28296
|
+
var codexAccountSiteUrlPattern = /^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;
|
|
28297
|
+
function isCodexAccountSiteUrl(value) {
|
|
28298
|
+
return value.length > 0 && value.length <= 2048 && codexAccountSiteUrlPattern.test(value);
|
|
28299
|
+
}
|
|
28300
|
+
var externalUrlOpenParamsSchema = external_exports.object({
|
|
28301
|
+
url: external_exports.string().max(2048).refine(isCodexAccountSiteUrl, "External URL must be http(s)")
|
|
28302
|
+
}).strict();
|
|
28303
|
+
var externalUrlOpenResultSchema = external_exports.object({}).strict();
|
|
27771
28304
|
var codexAccountPlanTypeSchema = external_exports.enum([
|
|
27772
28305
|
"free",
|
|
27773
28306
|
"go",
|
|
@@ -27793,7 +28326,8 @@ var codexAccountSchema = external_exports.object({
|
|
|
27793
28326
|
email: external_exports.string().email().max(320).optional(),
|
|
27794
28327
|
planType: codexAccountPlanTypeSchema.optional(),
|
|
27795
28328
|
authKind: codexAccountAuthKindSchema.optional(),
|
|
27796
|
-
authIdentity: nonBlankTextSchema3.max(256).optional()
|
|
28329
|
+
authIdentity: nonBlankTextSchema3.max(256).optional(),
|
|
28330
|
+
siteUrl: external_exports.string().refine(isCodexAccountSiteUrl, "Account site URL must be http(s)").optional()
|
|
27797
28331
|
}).strict();
|
|
27798
28332
|
var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
|
|
27799
28333
|
var codexAccountListResultSchema = external_exports.object({
|
|
@@ -28070,218 +28604,7 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
28070
28604
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
28071
28605
|
|
|
28072
28606
|
// dist/qoder-command.js
|
|
28073
|
-
import
|
|
28074
|
-
|
|
28075
|
-
// ../../harness-discovery/dist/environment.js
|
|
28076
|
-
import fs from "node:fs";
|
|
28077
|
-
import path from "node:path";
|
|
28078
|
-
function targetPath(platform) {
|
|
28079
|
-
return platform === "win32" ? path.win32 : path.posix;
|
|
28080
|
-
}
|
|
28081
|
-
function environmentValue(environment, name) {
|
|
28082
|
-
const lowered = name.toLowerCase();
|
|
28083
|
-
for (const [key, value] of Object.entries(environment)) {
|
|
28084
|
-
if (key.toLowerCase() === lowered)
|
|
28085
|
-
return value;
|
|
28086
|
-
}
|
|
28087
|
-
return void 0;
|
|
28088
|
-
}
|
|
28089
|
-
function pathDelimiter(platform) {
|
|
28090
|
-
return platform === "win32" ? ";" : ":";
|
|
28091
|
-
}
|
|
28092
|
-
function pathDirectories(environment, platform) {
|
|
28093
|
-
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
28094
|
-
}
|
|
28095
|
-
function executableExtensions(command, platform, environment) {
|
|
28096
|
-
if (platform !== "win32")
|
|
28097
|
-
return [""];
|
|
28098
|
-
if (targetPath(platform).extname(command) !== "")
|
|
28099
|
-
return [""];
|
|
28100
|
-
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
28101
|
-
}
|
|
28102
|
-
function isExecutableFile(filePath, platform) {
|
|
28103
|
-
try {
|
|
28104
|
-
fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
28105
|
-
return fs.statSync(filePath).isFile();
|
|
28106
|
-
} catch {
|
|
28107
|
-
return false;
|
|
28108
|
-
}
|
|
28109
|
-
}
|
|
28110
|
-
function subdirectoryNames(directory) {
|
|
28111
|
-
try {
|
|
28112
|
-
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
28113
|
-
} catch {
|
|
28114
|
-
return [];
|
|
28115
|
-
}
|
|
28116
|
-
}
|
|
28117
|
-
function newestFirst(names) {
|
|
28118
|
-
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
28119
|
-
}
|
|
28120
|
-
|
|
28121
|
-
// ../../harness-discovery/dist/resolve.js
|
|
28122
|
-
import os from "node:os";
|
|
28123
|
-
|
|
28124
|
-
// ../../harness-discovery/dist/version-managers.js
|
|
28125
|
-
function versionManagerBinaryDirectories(context) {
|
|
28126
|
-
const { platform, environment, home } = context;
|
|
28127
|
-
const list = context.subdirectories ?? subdirectoryNames;
|
|
28128
|
-
const pathFlavor = targetPath(platform);
|
|
28129
|
-
const value = (name) => environmentValue(environment, name);
|
|
28130
|
-
const directories = [];
|
|
28131
|
-
const versioned = (root, ...tail) => {
|
|
28132
|
-
for (const version2 of newestFirst(list(root))) {
|
|
28133
|
-
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
28134
|
-
}
|
|
28135
|
-
};
|
|
28136
|
-
if (platform === "win32") {
|
|
28137
|
-
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
28138
|
-
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
28139
|
-
versioned(pathFlavor.join(appData, "nvm"));
|
|
28140
|
-
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
28141
|
-
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
28142
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
28143
|
-
const pnpmHome2 = value("PNPM_HOME");
|
|
28144
|
-
if (pnpmHome2)
|
|
28145
|
-
directories.push(pnpmHome2);
|
|
28146
|
-
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
28147
|
-
return directories;
|
|
28148
|
-
}
|
|
28149
|
-
versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
|
|
28150
|
-
const fnmRoots = [
|
|
28151
|
-
value("FNM_DIR"),
|
|
28152
|
-
pathFlavor.join(home, ".local", "share", "fnm"),
|
|
28153
|
-
pathFlavor.join(home, "Library", "Application Support", "fnm")
|
|
28154
|
-
].filter((root) => root !== void 0);
|
|
28155
|
-
for (const root of fnmRoots) {
|
|
28156
|
-
versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
|
|
28157
|
-
}
|
|
28158
|
-
const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
|
|
28159
|
-
versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
|
|
28160
|
-
directories.push(pathFlavor.join(voltaHome, "bin"));
|
|
28161
|
-
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
28162
|
-
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
28163
|
-
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
28164
|
-
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
28165
|
-
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
28166
|
-
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
28167
|
-
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
28168
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
28169
|
-
const pnpmHome = value("PNPM_HOME");
|
|
28170
|
-
if (pnpmHome)
|
|
28171
|
-
directories.push(pnpmHome);
|
|
28172
|
-
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
28173
|
-
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
28174
|
-
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
28175
|
-
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
28176
|
-
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
28177
|
-
}
|
|
28178
|
-
}
|
|
28179
|
-
return directories;
|
|
28180
|
-
}
|
|
28181
|
-
|
|
28182
|
-
// ../../harness-discovery/dist/resolve.js
|
|
28183
|
-
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
28184
|
-
function installRootExtensions(platform) {
|
|
28185
|
-
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
28186
|
-
}
|
|
28187
|
-
function resolveHomeDirectory(input) {
|
|
28188
|
-
return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
|
|
28189
|
-
}
|
|
28190
|
-
function templateVariables(environment, platform, home) {
|
|
28191
|
-
const pathFlavor = targetPath(platform);
|
|
28192
|
-
return {
|
|
28193
|
-
HOME: home,
|
|
28194
|
-
USERPROFILE: home,
|
|
28195
|
-
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
28196
|
-
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
28197
|
-
};
|
|
28198
|
-
}
|
|
28199
|
-
function joinTemplate(platform, value) {
|
|
28200
|
-
const pathFlavor = targetPath(platform);
|
|
28201
|
-
const segments = value.split("/");
|
|
28202
|
-
const head = segments[0] ?? "";
|
|
28203
|
-
const tail = segments.slice(1);
|
|
28204
|
-
if (head === "")
|
|
28205
|
-
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
28206
|
-
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
28207
|
-
}
|
|
28208
|
-
function expandInstallRoot(template, environment, platform, home) {
|
|
28209
|
-
const variables = templateVariables(environment, platform, home);
|
|
28210
|
-
let unresolved = false;
|
|
28211
|
-
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
28212
|
-
const value = variables[name] ?? environmentValue(environment, name);
|
|
28213
|
-
if (value === void 0 || value === "") {
|
|
28214
|
-
unresolved = true;
|
|
28215
|
-
return "";
|
|
28216
|
-
}
|
|
28217
|
-
return value;
|
|
28218
|
-
});
|
|
28219
|
-
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
28220
|
-
}
|
|
28221
|
-
function installRootDirectories(spec, input, dependencies, platform, home) {
|
|
28222
|
-
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
28223
|
-
const directories = [];
|
|
28224
|
-
for (const template of templates) {
|
|
28225
|
-
if (template === VERSION_MANAGER_ROOTS) {
|
|
28226
|
-
directories.push(...versionManagerBinaryDirectories({
|
|
28227
|
-
platform,
|
|
28228
|
-
environment: input.environment,
|
|
28229
|
-
home,
|
|
28230
|
-
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
28231
|
-
}));
|
|
28232
|
-
continue;
|
|
28233
|
-
}
|
|
28234
|
-
const directory = expandInstallRoot(template, input.environment, platform, home);
|
|
28235
|
-
if (directory !== void 0)
|
|
28236
|
-
directories.push(directory);
|
|
28237
|
-
}
|
|
28238
|
-
return directories;
|
|
28239
|
-
}
|
|
28240
|
-
function harnessCandidates(spec, input, dependencies = {}) {
|
|
28241
|
-
const platform = input.platform ?? process.platform;
|
|
28242
|
-
const pathFlavor = targetPath(platform);
|
|
28243
|
-
const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
|
|
28244
|
-
const command = configured ?? spec.command;
|
|
28245
|
-
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
28246
|
-
return [{ candidate: command, source: "configured" }];
|
|
28247
|
-
}
|
|
28248
|
-
const candidates = [];
|
|
28249
|
-
const extensions = executableExtensions(command, platform, input.environment);
|
|
28250
|
-
for (const directory of pathDirectories(input.environment, platform)) {
|
|
28251
|
-
for (const extension of extensions) {
|
|
28252
|
-
candidates.push({
|
|
28253
|
-
candidate: pathFlavor.join(directory, command + extension),
|
|
28254
|
-
source: "path"
|
|
28255
|
-
});
|
|
28256
|
-
}
|
|
28257
|
-
}
|
|
28258
|
-
if (configured !== void 0)
|
|
28259
|
-
return candidates;
|
|
28260
|
-
const home = resolveHomeDirectory(input);
|
|
28261
|
-
for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
|
|
28262
|
-
for (const extension of installRootExtensions(platform)) {
|
|
28263
|
-
candidates.push({
|
|
28264
|
-
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
28265
|
-
source: "install-root"
|
|
28266
|
-
});
|
|
28267
|
-
}
|
|
28268
|
-
}
|
|
28269
|
-
return candidates;
|
|
28270
|
-
}
|
|
28271
|
-
function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
28272
|
-
const platform = input.platform ?? process.platform;
|
|
28273
|
-
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
28274
|
-
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
28275
|
-
const context = { platform, isExecutable };
|
|
28276
|
-
for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
|
|
28277
|
-
const executable = runnable(candidate, context);
|
|
28278
|
-
if (executable !== void 0 && isExecutable(executable))
|
|
28279
|
-
return { executable, source };
|
|
28280
|
-
}
|
|
28281
|
-
return void 0;
|
|
28282
|
-
}
|
|
28283
|
-
|
|
28284
|
-
// dist/qoder-command.js
|
|
28607
|
+
import path4 from "node:path";
|
|
28285
28608
|
var QoderExecutableError = class extends Error {
|
|
28286
28609
|
code = "QODER_NOT_FOUND";
|
|
28287
28610
|
};
|
|
@@ -28344,7 +28667,52 @@ function resolveQoderExecutable(input = {}, dependencies = {}) {
|
|
|
28344
28667
|
}, dependencies);
|
|
28345
28668
|
if (!resolution)
|
|
28346
28669
|
throw new QoderExecutableError("Qoder CLI is not installed");
|
|
28347
|
-
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable :
|
|
28670
|
+
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
|
|
28671
|
+
}
|
|
28672
|
+
|
|
28673
|
+
// dist/qoder-account.js
|
|
28674
|
+
var record2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
28675
|
+
var nonnegative = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
28676
|
+
function creditAmount(used, limit, unit) {
|
|
28677
|
+
if (!nonnegative(used) || !nonnegative(limit))
|
|
28678
|
+
return void 0;
|
|
28679
|
+
return {
|
|
28680
|
+
used,
|
|
28681
|
+
limit,
|
|
28682
|
+
unit: typeof unit === "string" && unit.trim() ? unit : "credits"
|
|
28683
|
+
};
|
|
28684
|
+
}
|
|
28685
|
+
function projectQoderAccount(usage, identity) {
|
|
28686
|
+
const data = record2(usage);
|
|
28687
|
+
const account = record2(identity);
|
|
28688
|
+
const quota = record2(data.userQuota);
|
|
28689
|
+
const shared = record2(data.orgResourcePackage);
|
|
28690
|
+
const nativePercent = quota.percentage ?? data.totalUsagePercentage;
|
|
28691
|
+
const usedPercent = nonnegative(nativePercent) ? Math.min(100, nativePercent) : nonnegative(quota.used) && nonnegative(quota.total) && quota.total > 0 ? Math.min(100, quota.used / quota.total * 100) : void 0;
|
|
28692
|
+
if (usedPercent === void 0)
|
|
28693
|
+
return null;
|
|
28694
|
+
const result = harnessAccountSnapshotSchema.safeParse({
|
|
28695
|
+
...typeof account.email === "string" && account.email ? { email: account.email } : {},
|
|
28696
|
+
...typeof account.subscriptionType === "string" && account.subscriptionType ? { plan: account.subscriptionType } : typeof data.userType === "string" ? { plan: data.userType } : {},
|
|
28697
|
+
credits: {
|
|
28698
|
+
usedPercent,
|
|
28699
|
+
periodType: "unknown",
|
|
28700
|
+
label: "Plan credits",
|
|
28701
|
+
...shared.available === true && nonnegative(shared.percentage) && nonnegative(shared.used) && nonnegative(shared.cap) && shared.cap > 0 ? {
|
|
28702
|
+
productUsage: [
|
|
28703
|
+
{
|
|
28704
|
+
product: "Shared resource credits",
|
|
28705
|
+
usagePercent: Math.min(100, shared.percentage),
|
|
28706
|
+
used: shared.used,
|
|
28707
|
+
limit: shared.cap,
|
|
28708
|
+
unit: typeof shared.unit === "string" ? shared.unit : "credits"
|
|
28709
|
+
}
|
|
28710
|
+
]
|
|
28711
|
+
} : {},
|
|
28712
|
+
...creditAmount(quota.used, quota.total, quota.unit)
|
|
28713
|
+
}
|
|
28714
|
+
});
|
|
28715
|
+
return result.success ? result.data : null;
|
|
28348
28716
|
}
|
|
28349
28717
|
|
|
28350
28718
|
// dist/qoder-errors.js
|
|
@@ -29849,8 +30217,8 @@ function getErrorMap2() {
|
|
|
29849
30217
|
|
|
29850
30218
|
// ../../../node_modules/zod/v3/helpers/parseUtil.js
|
|
29851
30219
|
var makeIssue = (params) => {
|
|
29852
|
-
const { data, path:
|
|
29853
|
-
const fullPath = [...
|
|
30220
|
+
const { data, path: path6, errorMaps, issueData } = params;
|
|
30221
|
+
const fullPath = [...path6, ...issueData.path || []];
|
|
29854
30222
|
const fullIssue = {
|
|
29855
30223
|
...issueData,
|
|
29856
30224
|
path: fullPath
|
|
@@ -29965,11 +30333,11 @@ var errorUtil;
|
|
|
29965
30333
|
|
|
29966
30334
|
// ../../../node_modules/zod/v3/types.js
|
|
29967
30335
|
var ParseInputLazyPath = class {
|
|
29968
|
-
constructor(parent, value,
|
|
30336
|
+
constructor(parent, value, path6, key) {
|
|
29969
30337
|
this._cachedPath = [];
|
|
29970
30338
|
this.parent = parent;
|
|
29971
30339
|
this.data = value;
|
|
29972
|
-
this._path =
|
|
30340
|
+
this._path = path6;
|
|
29973
30341
|
this._key = key;
|
|
29974
30342
|
}
|
|
29975
30343
|
get path() {
|
|
@@ -33496,11 +33864,11 @@ function normalizeObjectSchema(schema) {
|
|
|
33496
33864
|
}
|
|
33497
33865
|
return void 0;
|
|
33498
33866
|
}
|
|
33499
|
-
function getDotPath(
|
|
33500
|
-
if (
|
|
33867
|
+
function getDotPath(path6) {
|
|
33868
|
+
if (path6.length === 0) {
|
|
33501
33869
|
return "object root";
|
|
33502
33870
|
}
|
|
33503
|
-
return
|
|
33871
|
+
return path6.reduce((acc, seg, index) => {
|
|
33504
33872
|
if (index === 0) {
|
|
33505
33873
|
return String(seg);
|
|
33506
33874
|
}
|
|
@@ -52103,6 +52471,40 @@ var QoderAdapter = class {
|
|
|
52103
52471
|
this.#getAvailableModels = options.getAvailableModels;
|
|
52104
52472
|
this.#resolveExecutable = options.resolveExecutable ?? ((input, dependencies) => resolveQoderExecutable({ ...input, variant: this.#variant }, dependencies));
|
|
52105
52473
|
}
|
|
52474
|
+
async inspectAccount() {
|
|
52475
|
+
let probe;
|
|
52476
|
+
let timer;
|
|
52477
|
+
try {
|
|
52478
|
+
const executable = this.#resolveExecutable({
|
|
52479
|
+
...this.#commandOverride ? { command: this.#commandOverride } : {},
|
|
52480
|
+
environment: this.#environment,
|
|
52481
|
+
platform: this.#platform
|
|
52482
|
+
});
|
|
52483
|
+
probe = this.#queryFactory({
|
|
52484
|
+
prompt: "",
|
|
52485
|
+
options: {
|
|
52486
|
+
cwd: process.cwd(),
|
|
52487
|
+
pathToQoderCLIExecutable: executable,
|
|
52488
|
+
...this.#environment ? { env: this.#environment } : {},
|
|
52489
|
+
auth: qoderAuthForEnvironment(this.#variant, this.#environment)
|
|
52490
|
+
}
|
|
52491
|
+
});
|
|
52492
|
+
return await Promise.race([
|
|
52493
|
+
Promise.all([probe.getUsageInfo?.(), probe.accountInfo?.().catch(() => void 0)]).then(([usage, identity]) => projectQoderAccount(usage, identity)),
|
|
52494
|
+
new Promise((resolve) => {
|
|
52495
|
+
timer = setTimeout(() => resolve(null), 1e4);
|
|
52496
|
+
})
|
|
52497
|
+
]);
|
|
52498
|
+
} catch {
|
|
52499
|
+
return null;
|
|
52500
|
+
} finally {
|
|
52501
|
+
clearTimeout(timer);
|
|
52502
|
+
try {
|
|
52503
|
+
await probe?.close();
|
|
52504
|
+
} catch {
|
|
52505
|
+
}
|
|
52506
|
+
}
|
|
52507
|
+
}
|
|
52106
52508
|
async inspect(input) {
|
|
52107
52509
|
const cacheKey = input?.cwd ?? "";
|
|
52108
52510
|
if (input?.refresh) {
|
|
@@ -52275,7 +52677,7 @@ var QoderAdapter = class {
|
|
|
52275
52677
|
sourceInfo = await this.#getSessionInfo(sourceRef.data.nativeSessionId, { dir: input.cwd });
|
|
52276
52678
|
} catch {
|
|
52277
52679
|
}
|
|
52278
|
-
if (sourceInfo?.cwd &&
|
|
52680
|
+
if (sourceInfo?.cwd && path5.resolve(sourceInfo.cwd) !== path5.resolve(input.cwd)) {
|
|
52279
52681
|
return {
|
|
52280
52682
|
ok: false,
|
|
52281
52683
|
error: {
|
|
@@ -52429,13 +52831,59 @@ var QoderAdapter = class {
|
|
|
52429
52831
|
}
|
|
52430
52832
|
};
|
|
52431
52833
|
|
|
52834
|
+
// dist/installation.js
|
|
52835
|
+
function createQoderInstallation(environment, command, variant = "global") {
|
|
52836
|
+
const run = (args, timeout) => runInstallationCommand(resolveQoderExecutable({ environment, variant, ...command ? { command } : {} }), args, environment, timeout);
|
|
52837
|
+
return createInstallationManager({
|
|
52838
|
+
async check() {
|
|
52839
|
+
const currentVersion = versionFromOutput(await run(["--version"]));
|
|
52840
|
+
if (variant === "cn" && !(await run(["update", "--help"]).catch(() => "")).includes("--check"))
|
|
52841
|
+
return {
|
|
52842
|
+
currentVersion,
|
|
52843
|
+
latestVersion: "Unknown",
|
|
52844
|
+
updateAvailable: false,
|
|
52845
|
+
canUpdate: false,
|
|
52846
|
+
message: "This Qoder China release does not expose a non-installing update check. Use its original installer."
|
|
52847
|
+
};
|
|
52848
|
+
const output = await run(["update", "--check"]);
|
|
52849
|
+
const available = output.match(/Update available:\s*\S+\s*(?:->|\u2192)\s*(\S+)/i);
|
|
52850
|
+
if (available?.[1])
|
|
52851
|
+
return {
|
|
52852
|
+
currentVersion,
|
|
52853
|
+
latestVersion: installationVersion(available[1]),
|
|
52854
|
+
updateAvailable: newerInstallationVersion(currentVersion, installationVersion(available[1])),
|
|
52855
|
+
canUpdate: true
|
|
52856
|
+
};
|
|
52857
|
+
if (!/already\s+(?:on|at)\s+(?:the\s+)?latest|up.to.date|no updates?\s+available/i.test(output))
|
|
52858
|
+
throw new Error("Qoder update check returned an unknown response");
|
|
52859
|
+
return {
|
|
52860
|
+
currentVersion,
|
|
52861
|
+
latestVersion: currentVersion,
|
|
52862
|
+
updateAvailable: false,
|
|
52863
|
+
canUpdate: true
|
|
52864
|
+
};
|
|
52865
|
+
},
|
|
52866
|
+
async update() {
|
|
52867
|
+
await run(["update"], 3e5);
|
|
52868
|
+
}
|
|
52869
|
+
});
|
|
52870
|
+
}
|
|
52871
|
+
|
|
52432
52872
|
// dist/plugin.js
|
|
52433
|
-
function createHarnessAdapter(context) {
|
|
52873
|
+
function createHarnessAdapter(context, variant = "global") {
|
|
52434
52874
|
const environment = { ...context.environment };
|
|
52435
|
-
|
|
52436
|
-
|
|
52875
|
+
const command = environment[variant === "cn" ? CODEXHOST_QODERCN_COMMAND : CODEXHOST_QODER_COMMAND];
|
|
52876
|
+
return Object.assign(new QoderAdapter({
|
|
52877
|
+
...command ? { commandOverride: command } : {},
|
|
52878
|
+
variant,
|
|
52437
52879
|
environment,
|
|
52438
52880
|
platform: context.platform
|
|
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" })
|
|
52439
52887
|
});
|
|
52440
52888
|
}
|
|
52441
52889
|
export {
|