@liberseek/boft-cli-linux-x64 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12694,6 +12694,373 @@ var require_content_type = __commonJS({
12694
12694
  }
12695
12695
  });
12696
12696
 
12697
+ // ../../harness-discovery/dist/environment.js
12698
+ import fs from "node:fs";
12699
+ import path from "node:path";
12700
+ function targetPath(platform) {
12701
+ return platform === "win32" ? path.win32 : path.posix;
12702
+ }
12703
+ function environmentValue(environment, name) {
12704
+ const lowered = name.toLowerCase();
12705
+ for (const [key, value] of Object.entries(environment)) {
12706
+ if (key.toLowerCase() === lowered)
12707
+ return value;
12708
+ }
12709
+ return void 0;
12710
+ }
12711
+ function pathDelimiter(platform) {
12712
+ return platform === "win32" ? ";" : ":";
12713
+ }
12714
+ function pathDirectories(environment, platform) {
12715
+ return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
12716
+ }
12717
+ function executableExtensions(command, platform, environment) {
12718
+ if (platform !== "win32")
12719
+ return [""];
12720
+ if (targetPath(platform).extname(command) !== "")
12721
+ return [""];
12722
+ return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
12723
+ }
12724
+ function isExecutableFile(filePath, platform) {
12725
+ try {
12726
+ fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
12727
+ return fs.statSync(filePath).isFile();
12728
+ } catch {
12729
+ return false;
12730
+ }
12731
+ }
12732
+ function subdirectoryNames(directory) {
12733
+ try {
12734
+ return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
12735
+ } catch {
12736
+ return [];
12737
+ }
12738
+ }
12739
+ function newestFirst(names) {
12740
+ return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
12741
+ }
12742
+
12743
+ // ../../harness-discovery/dist/invocation.js
12744
+ import path2 from "node:path";
12745
+ function commandInvocation(command, arguments_, environment, platform = process.platform) {
12746
+ const extension = path2.win32.extname(command).toLowerCase();
12747
+ if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
12748
+ return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
12749
+ }
12750
+ const quote2 = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
12751
+ const commandLine = [command, ...arguments_].map(quote2).join(" ");
12752
+ return {
12753
+ command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
12754
+ arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
12755
+ windowsVerbatimArguments: true
12756
+ };
12757
+ }
12758
+
12759
+ // ../../harness-discovery/dist/node-runtime.js
12760
+ import path3 from "node:path";
12761
+ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
12762
+ const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
12763
+ const delimiter = platform === "win32" ? ";" : ":";
12764
+ const runtimeDirectory = path3.dirname(runtimeExecutable);
12765
+ const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
12766
+ const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
12767
+ if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
12768
+ directories.push(runtimeDirectory);
12769
+ }
12770
+ return { ...environment, [pathKey]: directories.join(delimiter) };
12771
+ }
12772
+
12773
+ // ../../harness-discovery/dist/resolve.js
12774
+ import os from "node:os";
12775
+
12776
+ // ../../harness-discovery/dist/version-managers.js
12777
+ function versionManagerBinaryDirectories(context) {
12778
+ const { platform, environment, home } = context;
12779
+ const list = context.subdirectories ?? subdirectoryNames;
12780
+ const pathFlavor = targetPath(platform);
12781
+ const value = (name) => environmentValue(environment, name);
12782
+ const directories = [];
12783
+ const versioned = (root, ...tail) => {
12784
+ for (const version2 of newestFirst(list(root))) {
12785
+ directories.push(pathFlavor.join(root, version2, ...tail));
12786
+ }
12787
+ };
12788
+ if (platform === "win32") {
12789
+ const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
12790
+ const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
12791
+ versioned(pathFlavor.join(appData, "nvm"));
12792
+ versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
12793
+ directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
12794
+ directories.push(pathFlavor.join(home, ".bun", "bin"));
12795
+ const pnpmHome2 = value("PNPM_HOME");
12796
+ if (pnpmHome2)
12797
+ directories.push(pnpmHome2);
12798
+ directories.push(pathFlavor.join(localAppData, "pnpm"));
12799
+ return directories;
12800
+ }
12801
+ versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
12802
+ const fnmRoots = [
12803
+ value("FNM_DIR"),
12804
+ pathFlavor.join(home, ".local", "share", "fnm"),
12805
+ pathFlavor.join(home, "Library", "Application Support", "fnm")
12806
+ ].filter((root) => root !== void 0);
12807
+ for (const root of fnmRoots) {
12808
+ versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
12809
+ }
12810
+ const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
12811
+ versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
12812
+ directories.push(pathFlavor.join(voltaHome, "bin"));
12813
+ const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
12814
+ versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
12815
+ directories.push(pathFlavor.join(asdfHome, "shims"));
12816
+ const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
12817
+ versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
12818
+ directories.push(pathFlavor.join(nodenvHome, "shims"));
12819
+ versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
12820
+ directories.push(pathFlavor.join(home, ".bun", "bin"));
12821
+ const pnpmHome = value("PNPM_HOME");
12822
+ if (pnpmHome)
12823
+ directories.push(pnpmHome);
12824
+ directories.push(pathFlavor.join(home, "Library", "pnpm"));
12825
+ directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
12826
+ for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
12827
+ for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
12828
+ directories.push(pathFlavor.join(prefix, formula, "bin"));
12829
+ }
12830
+ }
12831
+ return directories;
12832
+ }
12833
+
12834
+ // ../../harness-discovery/dist/resolve.js
12835
+ var VERSION_MANAGER_ROOTS = "<version-managers>";
12836
+ function installRootExtensions(platform) {
12837
+ return platform === "win32" ? [".exe", ".cmd"] : [""];
12838
+ }
12839
+ function resolveHomeDirectory(input) {
12840
+ return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
12841
+ }
12842
+ function templateVariables(environment, platform, home) {
12843
+ const pathFlavor = targetPath(platform);
12844
+ return {
12845
+ HOME: home,
12846
+ USERPROFILE: home,
12847
+ APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
12848
+ LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
12849
+ };
12850
+ }
12851
+ function joinTemplate(platform, value) {
12852
+ const pathFlavor = targetPath(platform);
12853
+ const segments = value.split("/");
12854
+ const head = segments[0] ?? "";
12855
+ const tail = segments.slice(1);
12856
+ if (head === "")
12857
+ return pathFlavor.join(pathFlavor.sep, ...tail);
12858
+ return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
12859
+ }
12860
+ function expandInstallRoot(template, environment, platform, home) {
12861
+ const variables = templateVariables(environment, platform, home);
12862
+ let unresolved = false;
12863
+ const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
12864
+ const value = variables[name] ?? environmentValue(environment, name);
12865
+ if (value === void 0 || value === "") {
12866
+ unresolved = true;
12867
+ return "";
12868
+ }
12869
+ return value;
12870
+ });
12871
+ return unresolved ? void 0 : joinTemplate(platform, substituted);
12872
+ }
12873
+ function installRootDirectories(spec, input, dependencies, platform, home) {
12874
+ const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
12875
+ const directories = [];
12876
+ for (const template of templates) {
12877
+ if (template === VERSION_MANAGER_ROOTS) {
12878
+ directories.push(...versionManagerBinaryDirectories({
12879
+ platform,
12880
+ environment: input.environment,
12881
+ home,
12882
+ ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
12883
+ }));
12884
+ continue;
12885
+ }
12886
+ const directory = expandInstallRoot(template, input.environment, platform, home);
12887
+ if (directory !== void 0)
12888
+ directories.push(directory);
12889
+ }
12890
+ return directories;
12891
+ }
12892
+ function harnessCandidates(spec, input, dependencies = {}) {
12893
+ const platform = input.platform ?? process.platform;
12894
+ const pathFlavor = targetPath(platform);
12895
+ const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
12896
+ const command = configured ?? spec.command;
12897
+ if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
12898
+ return [{ candidate: command, source: "configured" }];
12899
+ }
12900
+ const candidates = [];
12901
+ const extensions = executableExtensions(command, platform, input.environment);
12902
+ for (const directory of pathDirectories(input.environment, platform)) {
12903
+ for (const extension of extensions) {
12904
+ candidates.push({
12905
+ candidate: pathFlavor.join(directory, command + extension),
12906
+ source: "path"
12907
+ });
12908
+ }
12909
+ }
12910
+ if (configured !== void 0)
12911
+ return candidates;
12912
+ const home = resolveHomeDirectory(input);
12913
+ for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
12914
+ for (const extension of installRootExtensions(platform)) {
12915
+ candidates.push({
12916
+ candidate: pathFlavor.join(directory, spec.command + extension),
12917
+ source: "install-root"
12918
+ });
12919
+ }
12920
+ }
12921
+ return candidates;
12922
+ }
12923
+ function resolveHarnessExecutable(spec, input, dependencies = {}) {
12924
+ const platform = input.platform ?? process.platform;
12925
+ const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
12926
+ const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
12927
+ const context = { platform, isExecutable };
12928
+ for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
12929
+ const executable = runnable(candidate, context);
12930
+ if (executable !== void 0 && isExecutable(executable))
12931
+ return { executable, source };
12932
+ }
12933
+ return void 0;
12934
+ }
12935
+
12936
+ // ../../harness-discovery/dist/installation.js
12937
+ import { execFile } from "node:child_process";
12938
+ import { homedir } from "node:os";
12939
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
12940
+ const env = withNodeRuntimeOnPath(environment);
12941
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
12942
+ return new Promise((resolve, reject) => {
12943
+ const child = execFile(invocation.command, invocation.arguments, {
12944
+ env,
12945
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
12946
+ encoding: "utf8",
12947
+ timeout,
12948
+ killSignal: "SIGKILL",
12949
+ maxBuffer: 1024 * 1024,
12950
+ windowsHide: true,
12951
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
12952
+ }, (error51, stdout, stderr) => {
12953
+ if (error51)
12954
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
12955
+ else
12956
+ resolve((stdout || stderr).trim());
12957
+ });
12958
+ child.stdin?.end();
12959
+ });
12960
+ }
12961
+ function installationVersion(value) {
12962
+ if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
12963
+ throw new Error("Harness returned an invalid version");
12964
+ return value.trim().replace(/^v/, "");
12965
+ }
12966
+ function createInstallationManager(options) {
12967
+ let checking;
12968
+ let updating;
12969
+ const check2 = () => checking ??= options.check().finally(() => {
12970
+ checking = void 0;
12971
+ });
12972
+ return (action) => {
12973
+ if (updating)
12974
+ return updating;
12975
+ if (action === "check")
12976
+ return check2();
12977
+ updating = (async () => {
12978
+ const before = await check2();
12979
+ if (!before.updateAvailable)
12980
+ return before;
12981
+ if (!before.canUpdate)
12982
+ throw new Error(before.message ?? "This installation cannot be updated automatically");
12983
+ await options.update(before);
12984
+ const after = await check2();
12985
+ if (after.currentVersion === before.currentVersion)
12986
+ throw new Error("The Harness version did not change; check the native updater and retry");
12987
+ return after;
12988
+ })().finally(() => {
12989
+ updating = void 0;
12990
+ });
12991
+ return updating;
12992
+ };
12993
+ }
12994
+ async function fetchInstallationText(url2) {
12995
+ const request = async () => {
12996
+ const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
12997
+ if (!response.ok)
12998
+ throw new Error("Could not check the latest Harness version");
12999
+ return response.text();
13000
+ };
13001
+ try {
13002
+ return await request();
13003
+ } catch (error51) {
13004
+ if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
13005
+ throw error51;
13006
+ return request();
13007
+ }
13008
+ }
13009
+
13010
+ // ../../harness-discovery/dist/installer.js
13011
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
13012
+ import { tmpdir } from "node:os";
13013
+ import { join } from "node:path";
13014
+ function createHarnessInstaller(environment, source) {
13015
+ return async () => {
13016
+ if (!["darwin", "linux", "win32"].includes(process.platform))
13017
+ throw new Error("Unsupported installation platform");
13018
+ const env = withNodeRuntimeOnPath(environment);
13019
+ if ("npm" in source) {
13020
+ const npm = resolveHarnessExecutable({
13021
+ id: "npm",
13022
+ command: "npm",
13023
+ installRoots: {
13024
+ posix: [
13025
+ "~/.npm-global/bin",
13026
+ "~/.local/bin",
13027
+ VERSION_MANAGER_ROOTS,
13028
+ "/opt/homebrew/bin",
13029
+ "/usr/local/bin",
13030
+ "/usr/bin"
13031
+ ],
13032
+ windows: [
13033
+ "${APPDATA}/npm",
13034
+ VERSION_MANAGER_ROOTS,
13035
+ "${ProgramFiles}/nodejs",
13036
+ "${LOCALAPPDATA}/Programs/nodejs"
13037
+ ]
13038
+ }
13039
+ }, { environment: env });
13040
+ if (!npm)
13041
+ throw new Error("Install Node.js and npm first");
13042
+ await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
13043
+ ...env,
13044
+ ...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
13045
+ }, 6e5);
13046
+ return;
13047
+ }
13048
+ const windows = process.platform === "win32";
13049
+ const url2 = windows ? source.windows : source.posix;
13050
+ if (new URL(url2).protocol !== "https:")
13051
+ throw new Error("Installer requires HTTPS");
13052
+ const script = await fetchInstallationText(url2);
13053
+ const directory = await mkdtemp(join(tmpdir(), "codexhost-installer-"));
13054
+ try {
13055
+ const file2 = join(directory, windows ? "install.ps1" : "install.sh");
13056
+ await writeFile(file2, script, { mode: 384 });
13057
+ await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
13058
+ } finally {
13059
+ await rm(directory, { recursive: true, force: true });
13060
+ }
13061
+ };
13062
+ }
13063
+
12697
13064
  // ../../../node_modules/zod/v4/classic/external.js
12698
13065
  var external_exports = {};
12699
13066
  __export(external_exports, {
@@ -27278,6 +27645,71 @@ var harnessDisplaySetSchema = external_exports.strictObject({
27278
27645
  initializeOnly: external_exports.boolean().optional()
27279
27646
  });
27280
27647
 
27648
+ // ../../shared-contracts/dist/ids.js
27649
+ var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
27650
+ message: "Identifier must not be empty or whitespace"
27651
+ });
27652
+ var harnessIdSchema = opaqueIdSchema.brand();
27653
+ var hostThreadIdSchema = opaqueIdSchema.brand();
27654
+ var hostTurnIdSchema = opaqueIdSchema.brand();
27655
+ var hostItemIdSchema = opaqueIdSchema.brand();
27656
+ var hostInteractionIdSchema = opaqueIdSchema.brand();
27657
+
27658
+ // ../../shared-contracts/dist/harness-plugins.js
27659
+ var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
27660
+ var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
27661
+ var HARNESS_PLUGIN_LIMIT = 128;
27662
+ 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);
27663
+ 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");
27664
+ var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
27665
+ var pluginPresentationShape = {
27666
+ id: harnessPluginIdSchema,
27667
+ name: external_exports.string().trim().min(1).max(128),
27668
+ version: external_exports.string().min(1).max(128),
27669
+ /** The factory accepts a persisted local entrypoint through its construction context. */
27670
+ launchCommand: external_exports.literal(true).optional(),
27671
+ links: external_exports.object({
27672
+ documentation: documentationUrlSchema.optional(),
27673
+ installation: documentationUrlSchema.optional()
27674
+ }).strict().optional()
27675
+ };
27676
+ var harnessPluginManifestSchema = external_exports.object({
27677
+ manifestVersion: external_exports.literal(1),
27678
+ ...pluginPresentationShape,
27679
+ adapterApiVersion: external_exports.number().int().positive(),
27680
+ entry: relativeResourceSchema,
27681
+ icon: relativeResourceSchema.optional()
27682
+ }).strict();
27683
+ 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);
27684
+ var harnessPluginDescriptorSchema = external_exports.object({
27685
+ ...pluginPresentationShape,
27686
+ icon: harnessPluginIconSchema.optional()
27687
+ }).strict();
27688
+ var harnessPluginListParamsSchema = external_exports.object({}).strict();
27689
+ var harnessPluginListResultSchema = external_exports.object({
27690
+ plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
27691
+ }).strict();
27692
+ var harnessPluginConfigurationSchema = external_exports.object({
27693
+ version: external_exports.literal(1),
27694
+ enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
27695
+ }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
27696
+ message: "Enabled plugin IDs must be unique",
27697
+ path: ["enabled"]
27698
+ });
27699
+
27700
+ // ../../shared-contracts/dist/harness-long-context.js
27701
+ var HARNESS_LONG_CONTEXT_GET_METHOD = "codexhost/harness/long-context/get";
27702
+ var HARNESS_LONG_CONTEXT_SET_METHOD = "codexhost/harness/long-context/set";
27703
+ var harnessLongContextGetSchema = external_exports.object({
27704
+ harnessId: harnessPluginIdSchema
27705
+ }).strict();
27706
+ var harnessLongContextSetSchema = harnessLongContextGetSchema.extend({
27707
+ enabled: external_exports.boolean()
27708
+ });
27709
+ var harnessLongContextSchema = external_exports.object({
27710
+ enabled: external_exports.boolean()
27711
+ }).strict();
27712
+
27281
27713
  // ../../shared-contracts/dist/console.js
27282
27714
  var consoleAnnouncementSchema = external_exports.strictObject({
27283
27715
  title: external_exports.string().trim().min(1).max(200),
@@ -27294,8 +27726,11 @@ var CONSOLE_HOST_METHODS = Object.freeze([
27294
27726
  "codexhost/harness/display-settings/get",
27295
27727
  "codexhost/harness/display-settings/set",
27296
27728
  "codexhost/harness/inspect",
27729
+ "codexhost/harness/installation",
27297
27730
  "codexhost/harness/launch-settings/get",
27298
27731
  "codexhost/harness/launch-settings/set",
27732
+ HARNESS_LONG_CONTEXT_GET_METHOD,
27733
+ HARNESS_LONG_CONTEXT_SET_METHOD,
27299
27734
  "codexhost/harness/web-ui/open",
27300
27735
  "codexhost/harness/accounts/sources",
27301
27736
  "codexhost/harness/accounts/list",
@@ -27355,16 +27790,6 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
27355
27790
  inactiveMs: external_exports.number().nonnegative()
27356
27791
  }));
27357
27792
 
27358
- // ../../shared-contracts/dist/ids.js
27359
- var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
27360
- message: "Identifier must not be empty or whitespace"
27361
- });
27362
- var harnessIdSchema = opaqueIdSchema.brand();
27363
- var hostThreadIdSchema = opaqueIdSchema.brand();
27364
- var hostTurnIdSchema = opaqueIdSchema.brand();
27365
- var hostItemIdSchema = opaqueIdSchema.brand();
27366
- var hostInteractionIdSchema = opaqueIdSchema.brand();
27367
-
27368
27793
  // ../../shared-contracts/dist/manual-compaction.js
27369
27794
  var threadManualCompactionStartedSchema = external_exports.strictObject({
27370
27795
  threadId: hostThreadIdSchema,
@@ -27894,48 +28319,6 @@ var threadOwnershipListResultSchema = external_exports.object({
27894
28319
  }
27895
28320
  });
27896
28321
 
27897
- // ../../shared-contracts/dist/harness-plugins.js
27898
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
27899
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
27900
- var HARNESS_PLUGIN_LIMIT = 128;
27901
- 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);
27902
- 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");
27903
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
27904
- var pluginPresentationShape = {
27905
- id: harnessPluginIdSchema,
27906
- name: external_exports.string().trim().min(1).max(128),
27907
- version: external_exports.string().min(1).max(128),
27908
- /** The factory accepts a persisted local entrypoint through its construction context. */
27909
- launchCommand: external_exports.literal(true).optional(),
27910
- links: external_exports.object({
27911
- documentation: documentationUrlSchema.optional(),
27912
- installation: documentationUrlSchema.optional()
27913
- }).strict().optional()
27914
- };
27915
- var harnessPluginManifestSchema = external_exports.object({
27916
- manifestVersion: external_exports.literal(1),
27917
- ...pluginPresentationShape,
27918
- adapterApiVersion: external_exports.number().int().positive(),
27919
- entry: relativeResourceSchema,
27920
- icon: relativeResourceSchema.optional()
27921
- }).strict();
27922
- 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);
27923
- var harnessPluginDescriptorSchema = external_exports.object({
27924
- ...pluginPresentationShape,
27925
- icon: harnessPluginIconSchema.optional()
27926
- }).strict();
27927
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
27928
- var harnessPluginListResultSchema = external_exports.object({
27929
- plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
27930
- }).strict();
27931
- var harnessPluginConfigurationSchema = external_exports.object({
27932
- version: external_exports.literal(1),
27933
- enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
27934
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
27935
- message: "Enabled plugin IDs must be unique",
27936
- path: ["enabled"]
27937
- });
27938
-
27939
28322
  // ../../shared-contracts/dist/harness-route.js
27940
28323
  var harnessPluginRouteSchema = external_exports.object({
27941
28324
  harnessId: harnessPluginIdSchema,
@@ -27960,7 +28343,7 @@ var harnessLaunchSettingsSchema = external_exports.object({
27960
28343
  // ../../shared-contracts/dist/harness-installation.js
27961
28344
  var harnessInstallationParamsSchema = external_exports.object({
27962
28345
  harnessId: harnessIdSchema,
27963
- action: external_exports.enum(["check", "update"])
28346
+ action: external_exports.enum(["check", "update", "install"])
27964
28347
  }).strict();
27965
28348
  var harnessInstallationStateSchema = external_exports.object({
27966
28349
  currentVersion: external_exports.string().min(1).max(128),
@@ -28625,304 +29008,6 @@ function cursorCommandPrompt(command, catalog) {
28625
29008
  return { ok: true, value: `${descriptor.invocation}${text2 ? ` ${text2}` : ""}` };
28626
29009
  }
28627
29010
 
28628
- // ../../harness-discovery/dist/environment.js
28629
- import fs from "node:fs";
28630
- import path from "node:path";
28631
- function targetPath(platform) {
28632
- return platform === "win32" ? path.win32 : path.posix;
28633
- }
28634
- function environmentValue(environment, name) {
28635
- const lowered = name.toLowerCase();
28636
- for (const [key, value] of Object.entries(environment)) {
28637
- if (key.toLowerCase() === lowered)
28638
- return value;
28639
- }
28640
- return void 0;
28641
- }
28642
- function pathDelimiter(platform) {
28643
- return platform === "win32" ? ";" : ":";
28644
- }
28645
- function pathDirectories(environment, platform) {
28646
- return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
28647
- }
28648
- function executableExtensions(command, platform, environment) {
28649
- if (platform !== "win32")
28650
- return [""];
28651
- if (targetPath(platform).extname(command) !== "")
28652
- return [""];
28653
- return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
28654
- }
28655
- function isExecutableFile(filePath, platform) {
28656
- try {
28657
- fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
28658
- return fs.statSync(filePath).isFile();
28659
- } catch {
28660
- return false;
28661
- }
28662
- }
28663
- function subdirectoryNames(directory) {
28664
- try {
28665
- return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
28666
- } catch {
28667
- return [];
28668
- }
28669
- }
28670
- function newestFirst(names) {
28671
- return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
28672
- }
28673
-
28674
- // ../../harness-discovery/dist/invocation.js
28675
- import path2 from "node:path";
28676
- function commandInvocation(command, arguments_, environment, platform = process.platform) {
28677
- const extension = path2.win32.extname(command).toLowerCase();
28678
- if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
28679
- return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
28680
- }
28681
- const quote2 = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
28682
- const commandLine = [command, ...arguments_].map(quote2).join(" ");
28683
- return {
28684
- command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
28685
- arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
28686
- windowsVerbatimArguments: true
28687
- };
28688
- }
28689
-
28690
- // ../../harness-discovery/dist/node-runtime.js
28691
- import path3 from "node:path";
28692
- function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
28693
- const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
28694
- const delimiter = platform === "win32" ? ";" : ":";
28695
- const runtimeDirectory = path3.dirname(runtimeExecutable);
28696
- const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
28697
- const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
28698
- if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
28699
- directories.push(runtimeDirectory);
28700
- }
28701
- return { ...environment, [pathKey]: directories.join(delimiter) };
28702
- }
28703
-
28704
- // ../../harness-discovery/dist/resolve.js
28705
- import os from "node:os";
28706
-
28707
- // ../../harness-discovery/dist/version-managers.js
28708
- function versionManagerBinaryDirectories(context) {
28709
- const { platform, environment, home } = context;
28710
- const list = context.subdirectories ?? subdirectoryNames;
28711
- const pathFlavor = targetPath(platform);
28712
- const value = (name) => environmentValue(environment, name);
28713
- const directories = [];
28714
- const versioned = (root, ...tail) => {
28715
- for (const version2 of newestFirst(list(root))) {
28716
- directories.push(pathFlavor.join(root, version2, ...tail));
28717
- }
28718
- };
28719
- if (platform === "win32") {
28720
- const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
28721
- const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
28722
- versioned(pathFlavor.join(appData, "nvm"));
28723
- versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
28724
- directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
28725
- directories.push(pathFlavor.join(home, ".bun", "bin"));
28726
- const pnpmHome2 = value("PNPM_HOME");
28727
- if (pnpmHome2)
28728
- directories.push(pnpmHome2);
28729
- directories.push(pathFlavor.join(localAppData, "pnpm"));
28730
- return directories;
28731
- }
28732
- versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
28733
- const fnmRoots = [
28734
- value("FNM_DIR"),
28735
- pathFlavor.join(home, ".local", "share", "fnm"),
28736
- pathFlavor.join(home, "Library", "Application Support", "fnm")
28737
- ].filter((root) => root !== void 0);
28738
- for (const root of fnmRoots) {
28739
- versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
28740
- }
28741
- const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
28742
- versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
28743
- directories.push(pathFlavor.join(voltaHome, "bin"));
28744
- const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
28745
- versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
28746
- directories.push(pathFlavor.join(asdfHome, "shims"));
28747
- const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
28748
- versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
28749
- directories.push(pathFlavor.join(nodenvHome, "shims"));
28750
- versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
28751
- directories.push(pathFlavor.join(home, ".bun", "bin"));
28752
- const pnpmHome = value("PNPM_HOME");
28753
- if (pnpmHome)
28754
- directories.push(pnpmHome);
28755
- directories.push(pathFlavor.join(home, "Library", "pnpm"));
28756
- directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
28757
- for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
28758
- for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
28759
- directories.push(pathFlavor.join(prefix, formula, "bin"));
28760
- }
28761
- }
28762
- return directories;
28763
- }
28764
-
28765
- // ../../harness-discovery/dist/resolve.js
28766
- var VERSION_MANAGER_ROOTS = "<version-managers>";
28767
- function installRootExtensions(platform) {
28768
- return platform === "win32" ? [".exe", ".cmd"] : [""];
28769
- }
28770
- function resolveHomeDirectory(input) {
28771
- return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
28772
- }
28773
- function templateVariables(environment, platform, home) {
28774
- const pathFlavor = targetPath(platform);
28775
- return {
28776
- HOME: home,
28777
- USERPROFILE: home,
28778
- APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
28779
- LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
28780
- };
28781
- }
28782
- function joinTemplate(platform, value) {
28783
- const pathFlavor = targetPath(platform);
28784
- const segments = value.split("/");
28785
- const head = segments[0] ?? "";
28786
- const tail = segments.slice(1);
28787
- if (head === "")
28788
- return pathFlavor.join(pathFlavor.sep, ...tail);
28789
- return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
28790
- }
28791
- function expandInstallRoot(template, environment, platform, home) {
28792
- const variables = templateVariables(environment, platform, home);
28793
- let unresolved = false;
28794
- const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
28795
- const value = variables[name] ?? environmentValue(environment, name);
28796
- if (value === void 0 || value === "") {
28797
- unresolved = true;
28798
- return "";
28799
- }
28800
- return value;
28801
- });
28802
- return unresolved ? void 0 : joinTemplate(platform, substituted);
28803
- }
28804
- function installRootDirectories(spec, input, dependencies, platform, home) {
28805
- const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
28806
- const directories = [];
28807
- for (const template of templates) {
28808
- if (template === VERSION_MANAGER_ROOTS) {
28809
- directories.push(...versionManagerBinaryDirectories({
28810
- platform,
28811
- environment: input.environment,
28812
- home,
28813
- ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
28814
- }));
28815
- continue;
28816
- }
28817
- const directory = expandInstallRoot(template, input.environment, platform, home);
28818
- if (directory !== void 0)
28819
- directories.push(directory);
28820
- }
28821
- return directories;
28822
- }
28823
- function harnessCandidates(spec, input, dependencies = {}) {
28824
- const platform = input.platform ?? process.platform;
28825
- const pathFlavor = targetPath(platform);
28826
- const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
28827
- const command = configured ?? spec.command;
28828
- if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
28829
- return [{ candidate: command, source: "configured" }];
28830
- }
28831
- const candidates = [];
28832
- const extensions = executableExtensions(command, platform, input.environment);
28833
- for (const directory of pathDirectories(input.environment, platform)) {
28834
- for (const extension of extensions) {
28835
- candidates.push({
28836
- candidate: pathFlavor.join(directory, command + extension),
28837
- source: "path"
28838
- });
28839
- }
28840
- }
28841
- if (configured !== void 0)
28842
- return candidates;
28843
- const home = resolveHomeDirectory(input);
28844
- for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
28845
- for (const extension of installRootExtensions(platform)) {
28846
- candidates.push({
28847
- candidate: pathFlavor.join(directory, spec.command + extension),
28848
- source: "install-root"
28849
- });
28850
- }
28851
- }
28852
- return candidates;
28853
- }
28854
- function resolveHarnessExecutable(spec, input, dependencies = {}) {
28855
- const platform = input.platform ?? process.platform;
28856
- const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
28857
- const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
28858
- const context = { platform, isExecutable };
28859
- for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
28860
- const executable = runnable(candidate, context);
28861
- if (executable !== void 0 && isExecutable(executable))
28862
- return { executable, source };
28863
- }
28864
- return void 0;
28865
- }
28866
-
28867
- // ../../harness-discovery/dist/installation.js
28868
- import { execFile } from "node:child_process";
28869
- import { homedir } from "node:os";
28870
- function runInstallationCommand(command, args, environment, timeout = 3e4) {
28871
- const env = withNodeRuntimeOnPath(environment);
28872
- const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
28873
- return new Promise((resolve, reject) => {
28874
- const child = execFile(invocation.command, invocation.arguments, {
28875
- env,
28876
- cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
28877
- encoding: "utf8",
28878
- timeout,
28879
- killSignal: "SIGKILL",
28880
- maxBuffer: 1024 * 1024,
28881
- windowsHide: true,
28882
- windowsVerbatimArguments: invocation.windowsVerbatimArguments
28883
- }, (error51, stdout, stderr) => {
28884
- if (error51)
28885
- reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
28886
- else
28887
- resolve((stdout || stderr).trim());
28888
- });
28889
- child.stdin?.end();
28890
- });
28891
- }
28892
- function installationVersion(value) {
28893
- if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
28894
- throw new Error("Harness returned an invalid version");
28895
- return value.trim().replace(/^v/, "");
28896
- }
28897
- function createInstallationManager(options) {
28898
- let checking;
28899
- let updating;
28900
- const check2 = () => checking ??= options.check().finally(() => {
28901
- checking = void 0;
28902
- });
28903
- return (action) => {
28904
- if (updating)
28905
- return updating;
28906
- if (action === "check")
28907
- return check2();
28908
- updating = (async () => {
28909
- const before = await check2();
28910
- if (!before.updateAvailable)
28911
- return before;
28912
- if (!before.canUpdate)
28913
- throw new Error(before.message ?? "This installation cannot be updated automatically");
28914
- await options.update(before);
28915
- const after = await check2();
28916
- if (after.currentVersion === before.currentVersion)
28917
- throw new Error("The Harness version did not change; check the native updater and retry");
28918
- return after;
28919
- })().finally(() => {
28920
- updating = void 0;
28921
- });
28922
- return updating;
28923
- };
28924
- }
28925
-
28926
29011
  // dist/command.js
28927
29012
  import { existsSync, readdirSync } from "node:fs";
28928
29013
  import path4 from "node:path";
@@ -46576,7 +46661,7 @@ var CursorInteractions = class {
46576
46661
 
46577
46662
  // dist/fork.js
46578
46663
  import { createHash as createHash2 } from "node:crypto";
46579
- import { copyFile, mkdir, mkdtemp, readdir, readFile as readFile3, realpath as realpath2, rm, writeFile } from "node:fs/promises";
46664
+ import { copyFile, mkdir, mkdtemp as mkdtemp2, readdir, readFile as readFile3, realpath as realpath2, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
46580
46665
  import { readdirSync as readdirSync2 } from "node:fs";
46581
46666
  import os3 from "node:os";
46582
46667
  import path9 from "node:path";
@@ -46747,12 +46832,12 @@ async function forkCursorSession(source, checkpoint, options, signal) {
46747
46832
  if (rewindTurn && !rewindTurn.rewindRoot)
46748
46833
  throw new Error("Cursor target has no native rewind checkpoint");
46749
46834
  const original = storeIdentity(sourceDirectory);
46750
- const temporary = await mkdtemp(path9.join(os3.tmpdir(), "codexhost-cursor-fork-"));
46835
+ const temporary = await mkdtemp2(path9.join(os3.tmpdir(), "codexhost-cursor-fork-"));
46751
46836
  let target;
46752
46837
  let committed = false;
46753
46838
  const discard = async () => {
46754
46839
  if (target && !committed)
46755
- await rm(target, { recursive: true, force: true });
46840
+ await rm2(target, { recursive: true, force: true });
46756
46841
  };
46757
46842
  try {
46758
46843
  signal.throwIfAborted();
@@ -46769,7 +46854,7 @@ async function forkCursorSession(source, checkpoint, options, signal) {
46769
46854
  if (!(error51 instanceof Error && "code" in error51 && error51.code === "ENOENT"))
46770
46855
  throw error51;
46771
46856
  }
46772
- await writeFile(path9.join(config2, "cli-config.json"), JSON.stringify({ ...settings, rewind: true }), { mode: 384 });
46857
+ await writeFile2(path9.join(config2, "cli-config.json"), JSON.stringify({ ...settings, rewind: true }), { mode: 384 });
46773
46858
  const chats = path9.join(config2, "chats", createHash2("md5").update(await realpath2(options.cwd)).digest("hex"));
46774
46859
  const copy = path9.join(chats, source.nativeSessionId);
46775
46860
  await mkdir(copy, { recursive: true });
@@ -46823,7 +46908,7 @@ async function forkCursorSession(source, checkpoint, options, signal) {
46823
46908
  throw error51;
46824
46909
  } finally {
46825
46910
  try {
46826
- await rm(temporary, { recursive: true, force: true });
46911
+ await rm2(temporary, { recursive: true, force: true });
46827
46912
  } catch (error51) {
46828
46913
  await discard();
46829
46914
  throw error51;
@@ -48471,7 +48556,11 @@ function createHarnessAdapter(context) {
48471
48556
  });
48472
48557
  const environment = { ...context.environment };
48473
48558
  return Object.assign(new CursorAdapter({ environment }), {
48474
- installation: createCursorInstallation(environment)
48559
+ installation: createCursorInstallation(environment),
48560
+ install: createHarnessInstaller(environment, {
48561
+ posix: "https://cursor.com/install",
48562
+ windows: "https://cursor.com/install?win32=true"
48563
+ })
48475
48564
  });
48476
48565
  }
48477
48566
  export {