diff --git a/agents/opentoad.ts b/agents/opentoad.ts index 6033ff9..7e4b897 100644 --- a/agents/opentoad.ts +++ b/agents/opentoad.ts @@ -10,7 +10,7 @@ * the agent process itself gets full env (needs LLM API keys, PATH, etc.). * security is enforced at the tool layer, not the process layer. */ -import { execFileSync } from "node:child_process"; +import { execFileSync, spawnSync } from "node:child_process"; import { mkdirSync } from "node:fs"; import { join } from "node:path"; import { performance } from "node:perf_hooks"; @@ -21,16 +21,14 @@ import { log } from "../utils/cli.ts"; import { installFromNpmTarball } from "../utils/install.ts"; import { spawn } from "../utils/subprocess.ts"; import { ThinkingTimer } from "../utils/timer.ts"; +import { getDevDependencyVersion } from "../utils/version.ts"; import type { TodoTracker } from "../utils/todoTracking.ts"; import { type AgentResult, type AgentRunContext, type AgentUsage, agent } from "./shared.ts"; -// pinned CLI version -const OPENCODE_CLI_VERSION = "1.1.56"; - async function installOpencodeCli(): Promise { return await installFromNpmTarball({ packageName: "opencode-ai", - version: OPENCODE_CLI_VERSION, + version: getDevDependencyVersion("opencode-ai"), executablePath: "bin/opencode", installDependencies: true, }); @@ -55,6 +53,7 @@ function buildSecurityConfig(ctx: AgentRunContext, model: string | undefined): s read: "allow", webfetch: "allow", external_directory: "deny", + skill: "allow", }, mcp: { [ghPullfrogMcpName]: { type: "remote", url: ctx.mcpServerUrl }, @@ -175,6 +174,23 @@ function detectProviderError(text: string): string | null { return null; } +function addSkill(params: { ref: string; skill: string; env: Record }): void { + const result = spawnSync( + "npx", + ["skills", "add", params.ref, "--skill", params.skill, "-g", "-a", "opencode", "-y"], + { + env: { ...process.env, ...params.env }, + stdio: "pipe", + timeout: 30_000, + } + ); + if (result.status === 0) { + log.info(`installed ${params.skill} skill`); + } else { + log.info(`${params.skill} skill install failed: ${(result.stderr?.toString() || "").trim()}`); + } +} + // ── NDJSON event types ───────────────────────────────────────────────────────── interface OpenCodeInitEvent { @@ -652,8 +668,19 @@ export const opentoad = agent({ modelSlug: ctx.payload.model, }); - const tempHome = ctx.tmpdir; - mkdirSync(join(tempHome, ".config", "opencode"), { recursive: true }); + const homeEnv = { + HOME: ctx.tmpdir, + XDG_CONFIG_HOME: join(ctx.tmpdir, ".config"), + }; + + mkdirSync(join(homeEnv.XDG_CONFIG_HOME, "opencode"), { recursive: true }); + + const agentBrowserVersion = getDevDependencyVersion("agent-browser"); + addSkill({ + ref: `vercel-labs/agent-browser@v${agentBrowserVersion}`, + skill: "agent-browser", + env: homeEnv, + }); const args = ["run", ctx.instructions.full, "--format", "json", "--print-logs"]; @@ -661,8 +688,7 @@ export const opentoad = agent({ // security is enforced via OPENCODE_CONFIG_CONTENT (bash: deny) and MCP tool filtering. const env: Record = { ...process.env, - HOME: tempHome, - XDG_CONFIG_HOME: join(tempHome, ".config"), + ...homeEnv, OPENCODE_CONFIG_CONTENT: buildSecurityConfig(ctx, model), GOOGLE_GENERATIVE_AI_API_KEY: process.env.GOOGLE_GENERATIVE_AI_API_KEY || process.env.GEMINI_API_KEY, diff --git a/entry b/entry index efd25f0..683f675 100755 --- a/entry +++ b/entry @@ -64078,7 +64078,7 @@ var require_snapshot_recorder = __commonJS({ "node_modules/.pnpm/undici@7.22.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) { "use strict"; var { writeFile: writeFile2, readFile, mkdir } = __require("node:fs/promises"); - var { dirname: dirname3, resolve: resolve2 } = __require("node:path"); + var { dirname: dirname4, resolve: resolve2 } = __require("node:path"); var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers"); var { InvalidArgumentError, UndiciError } = require_errors4(); var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils(); @@ -64309,7 +64309,7 @@ var require_snapshot_recorder = __commonJS({ throw new InvalidArgumentError("Snapshot path is required"); } const resolvedPath = resolve2(path3); - await mkdir(dirname3(resolvedPath), { recursive: true }); + await mkdir(dirname4(resolvedPath), { recursive: true }); const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot2]) => ({ hash: hash2, snapshot: snapshot2 @@ -75626,6 +75626,1936 @@ var init_index_DoHiaFQM = __esm({ } }); +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js +var require_constants11 = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js"(exports, module) { + "use strict"; + var SEMVER_SPEC_VERSION = "2.0.0"; + var MAX_LENGTH = 256; + var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */ + 9007199254740991; + var MAX_SAFE_COMPONENT_LENGTH = 16; + var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6; + var RELEASE_TYPES = [ + "major", + "premajor", + "minor", + "preminor", + "patch", + "prepatch", + "prerelease" + ]; + module.exports = { + MAX_LENGTH, + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_SAFE_INTEGER, + RELEASE_TYPES, + SEMVER_SPEC_VERSION, + FLAG_INCLUDE_PRERELEASE: 1, + FLAG_LOOSE: 2 + }; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js +var require_debug = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js"(exports, module) { + "use strict"; + var debug3 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args2) => console.error("SEMVER", ...args2) : () => { + }; + module.exports = debug3; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js +var require_re = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js"(exports, module) { + "use strict"; + var { + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_LENGTH + } = require_constants11(); + var debug3 = require_debug(); + exports = module.exports = {}; + var re = exports.re = []; + var safeRe = exports.safeRe = []; + var src = exports.src = []; + var safeSrc = exports.safeSrc = []; + var t = exports.t = {}; + var R = 0; + var LETTERDASHNUMBER = "[a-zA-Z0-9-]"; + var safeRegexReplacements = [ + ["\\s", 1], + ["\\d", MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH] + ]; + var makeSafeRegex = (value2) => { + for (const [token, max] of safeRegexReplacements) { + value2 = value2.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`); + } + return value2; + }; + var createToken = (name, value2, isGlobal) => { + const safe = makeSafeRegex(value2); + const index = R++; + debug3(name, index, value2); + t[name] = index; + src[index] = value2; + safeSrc[index] = safe; + re[index] = new RegExp(value2, isGlobal ? "g" : void 0); + safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0); + }; + createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*"); + createToken("NUMERICIDENTIFIERLOOSE", "\\d+"); + createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`); + createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`); + createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`); + createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`); + createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`); + createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); + createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); + createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`); + createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); + createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`); + createToken("FULL", `^${src[t.FULLPLAIN]}$`); + createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`); + createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`); + createToken("GTLT", "((?:<|>)?=?)"); + createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); + createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); + createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`); + createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`); + createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); + createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); + createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`); + createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`); + createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`); + createToken("COERCERTL", src[t.COERCE], true); + createToken("COERCERTLFULL", src[t.COERCEFULL], true); + createToken("LONETILDE", "(?:~>?)"); + createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true); + exports.tildeTrimReplace = "$1~"; + createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); + createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken("LONECARET", "(?:\\^)"); + createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true); + exports.caretTrimReplace = "$1^"; + createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); + createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); + createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); + createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); + exports.comparatorTrimReplace = "$1$2$3"; + createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`); + createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`); + createToken("STAR", "(<|>)?=?\\s*\\*"); + createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"); + createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$"); + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js +var require_parse_options = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js"(exports, module) { + "use strict"; + var looseOption = Object.freeze({ loose: true }); + var emptyOpts = Object.freeze({}); + var parseOptions = (options) => { + if (!options) { + return emptyOpts; + } + if (typeof options !== "object") { + return looseOption; + } + return options; + }; + module.exports = parseOptions; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js +var require_identifiers = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js"(exports, module) { + "use strict"; + var numeric = /^[0-9]+$/; + var compareIdentifiers = (a, b) => { + if (typeof a === "number" && typeof b === "number") { + return a === b ? 0 : a < b ? -1 : 1; + } + const anum = numeric.test(a); + const bnum = numeric.test(b); + if (anum && bnum) { + a = +a; + b = +b; + } + return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; + }; + var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a); + module.exports = { + compareIdentifiers, + rcompareIdentifiers + }; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js +var require_semver = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js"(exports, module) { + "use strict"; + var debug3 = require_debug(); + var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants11(); + var { safeRe: re, t } = require_re(); + var parseOptions = require_parse_options(); + var { compareIdentifiers } = require_identifiers(); + var SemVer = class _SemVer { + constructor(version3, options) { + options = parseOptions(options); + if (version3 instanceof _SemVer) { + if (version3.loose === !!options.loose && version3.includePrerelease === !!options.includePrerelease) { + return version3; + } else { + version3 = version3.version; + } + } else if (typeof version3 !== "string") { + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version3}".`); + } + if (version3.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ); + } + debug3("SemVer", version3, options); + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + const m = version3.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); + if (!m) { + throw new TypeError(`Invalid Version: ${version3}`); + } + this.raw = version3; + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError("Invalid major version"); + } + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError("Invalid minor version"); + } + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError("Invalid patch version"); + } + if (!m[4]) { + this.prerelease = []; + } else { + this.prerelease = m[4].split(".").map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num; + } + } + return id; + }); + } + this.build = m[5] ? m[5].split(".") : []; + this.format(); + } + format() { + this.version = `${this.major}.${this.minor}.${this.patch}`; + if (this.prerelease.length) { + this.version += `-${this.prerelease.join(".")}`; + } + return this.version; + } + toString() { + return this.version; + } + compare(other) { + debug3("SemVer.compare", this.version, this.options, other); + if (!(other instanceof _SemVer)) { + if (typeof other === "string" && other === this.version) { + return 0; + } + other = new _SemVer(other, this.options); + } + if (other.version === this.version) { + return 0; + } + return this.compareMain(other) || this.comparePre(other); + } + compareMain(other) { + if (!(other instanceof _SemVer)) { + other = new _SemVer(other, this.options); + } + if (this.major < other.major) { + return -1; + } + if (this.major > other.major) { + return 1; + } + if (this.minor < other.minor) { + return -1; + } + if (this.minor > other.minor) { + return 1; + } + if (this.patch < other.patch) { + return -1; + } + if (this.patch > other.patch) { + return 1; + } + return 0; + } + comparePre(other) { + if (!(other instanceof _SemVer)) { + other = new _SemVer(other, this.options); + } + if (this.prerelease.length && !other.prerelease.length) { + return -1; + } else if (!this.prerelease.length && other.prerelease.length) { + return 1; + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0; + } + let i = 0; + do { + const a = this.prerelease[i]; + const b = other.prerelease[i]; + debug3("prerelease compare", i, a, b); + if (a === void 0 && b === void 0) { + return 0; + } else if (b === void 0) { + return 1; + } else if (a === void 0) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + compareBuild(other) { + if (!(other instanceof _SemVer)) { + other = new _SemVer(other, this.options); + } + let i = 0; + do { + const a = this.build[i]; + const b = other.build[i]; + debug3("build compare", i, a, b); + if (a === void 0 && b === void 0) { + return 0; + } else if (b === void 0) { + return 1; + } else if (a === void 0) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc(release, identifier, identifierBase) { + if (release.startsWith("pre")) { + if (!identifier && identifierBase === false) { + throw new Error("invalid increment argument: identifier is empty"); + } + if (identifier) { + const match3 = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]); + if (!match3 || match3[1] !== identifier) { + throw new Error(`invalid identifier: ${identifier}`); + } + } + } + switch (release) { + case "premajor": + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc("pre", identifier, identifierBase); + break; + case "preminor": + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc("pre", identifier, identifierBase); + break; + case "prepatch": + this.prerelease.length = 0; + this.inc("patch", identifier, identifierBase); + this.inc("pre", identifier, identifierBase); + break; + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case "prerelease": + if (this.prerelease.length === 0) { + this.inc("patch", identifier, identifierBase); + } + this.inc("pre", identifier, identifierBase); + break; + case "release": + if (this.prerelease.length === 0) { + throw new Error(`version ${this.raw} is not a prerelease`); + } + this.prerelease.length = 0; + break; + case "major": + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { + this.major++; + } + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case "minor": + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } + this.patch = 0; + this.prerelease = []; + break; + case "patch": + if (this.prerelease.length === 0) { + this.patch++; + } + this.prerelease = []; + break; + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case "pre": { + const base = Number(identifierBase) ? 1 : 0; + if (this.prerelease.length === 0) { + this.prerelease = [base]; + } else { + let i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === "number") { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) { + if (identifier === this.prerelease.join(".") && identifierBase === false) { + throw new Error("invalid increment argument: identifier already exists"); + } + this.prerelease.push(base); + } + } + if (identifier) { + let prerelease = [identifier, base]; + if (identifierBase === false) { + prerelease = [identifier]; + } + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = prerelease; + } + } else { + this.prerelease = prerelease; + } + } + break; + } + default: + throw new Error(`invalid increment argument: ${release}`); + } + this.raw = this.format(); + if (this.build.length) { + this.raw += `+${this.build.join(".")}`; + } + return this; + } + }; + module.exports = SemVer; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js +var require_parse3 = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var parse5 = (version3, options, throwErrors = false) => { + if (version3 instanceof SemVer) { + return version3; + } + try { + return new SemVer(version3, options); + } catch (er) { + if (!throwErrors) { + return null; + } + throw er; + } + }; + module.exports = parse5; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js +var require_valid = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js"(exports, module) { + "use strict"; + var parse5 = require_parse3(); + var valid = (version3, options) => { + const v = parse5(version3, options); + return v ? v.version : null; + }; + module.exports = valid; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js +var require_clean = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js"(exports, module) { + "use strict"; + var parse5 = require_parse3(); + var clean = (version3, options) => { + const s = parse5(version3.trim().replace(/^[=v]+/, ""), options); + return s ? s.version : null; + }; + module.exports = clean; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js +var require_inc = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var inc = (version3, release, options, identifier, identifierBase) => { + if (typeof options === "string") { + identifierBase = identifier; + identifier = options; + options = void 0; + } + try { + return new SemVer( + version3 instanceof SemVer ? version3.version : version3, + options + ).inc(release, identifier, identifierBase).version; + } catch (er) { + return null; + } + }; + module.exports = inc; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js +var require_diff = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js"(exports, module) { + "use strict"; + var parse5 = require_parse3(); + var diff = (version1, version22) => { + const v1 = parse5(version1, null, true); + const v2 = parse5(version22, null, true); + const comparison = v1.compare(v2); + if (comparison === 0) { + return null; + } + const v1Higher = comparison > 0; + const highVersion = v1Higher ? v1 : v2; + const lowVersion = v1Higher ? v2 : v1; + const highHasPre = !!highVersion.prerelease.length; + const lowHasPre = !!lowVersion.prerelease.length; + if (lowHasPre && !highHasPre) { + if (!lowVersion.patch && !lowVersion.minor) { + return "major"; + } + if (lowVersion.compareMain(highVersion) === 0) { + if (lowVersion.minor && !lowVersion.patch) { + return "minor"; + } + return "patch"; + } + } + const prefix = highHasPre ? "pre" : ""; + if (v1.major !== v2.major) { + return prefix + "major"; + } + if (v1.minor !== v2.minor) { + return prefix + "minor"; + } + if (v1.patch !== v2.patch) { + return prefix + "patch"; + } + return "prerelease"; + }; + module.exports = diff; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.js +var require_major = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var major = (a, loose) => new SemVer(a, loose).major; + module.exports = major; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.js +var require_minor = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var minor = (a, loose) => new SemVer(a, loose).minor; + module.exports = minor; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.js +var require_patch = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var patch = (a, loose) => new SemVer(a, loose).patch; + module.exports = patch; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js +var require_prerelease = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js"(exports, module) { + "use strict"; + var parse5 = require_parse3(); + var prerelease = (version3, options) => { + const parsed2 = parse5(version3, options); + return parsed2 && parsed2.prerelease.length ? parsed2.prerelease : null; + }; + module.exports = prerelease; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js +var require_compare = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)); + module.exports = compare; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.js +var require_rcompare = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.js"(exports, module) { + "use strict"; + var compare = require_compare(); + var rcompare = (a, b, loose) => compare(b, a, loose); + module.exports = rcompare; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.js +var require_compare_loose = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.js"(exports, module) { + "use strict"; + var compare = require_compare(); + var compareLoose = (a, b) => compare(a, b, true); + module.exports = compareLoose; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.js +var require_compare_build = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose); + const versionB = new SemVer(b, loose); + return versionA.compare(versionB) || versionA.compareBuild(versionB); + }; + module.exports = compareBuild; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.js +var require_sort = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.js"(exports, module) { + "use strict"; + var compareBuild = require_compare_build(); + var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)); + module.exports = sort; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.js +var require_rsort = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.js"(exports, module) { + "use strict"; + var compareBuild = require_compare_build(); + var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)); + module.exports = rsort; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.js +var require_gt = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.js"(exports, module) { + "use strict"; + var compare = require_compare(); + var gt = (a, b, loose) => compare(a, b, loose) > 0; + module.exports = gt; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js +var require_lt = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js"(exports, module) { + "use strict"; + var compare = require_compare(); + var lt = (a, b, loose) => compare(a, b, loose) < 0; + module.exports = lt; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.js +var require_eq = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.js"(exports, module) { + "use strict"; + var compare = require_compare(); + var eq = (a, b, loose) => compare(a, b, loose) === 0; + module.exports = eq; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.js +var require_neq = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.js"(exports, module) { + "use strict"; + var compare = require_compare(); + var neq = (a, b, loose) => compare(a, b, loose) !== 0; + module.exports = neq; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js +var require_gte = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js"(exports, module) { + "use strict"; + var compare = require_compare(); + var gte = (a, b, loose) => compare(a, b, loose) >= 0; + module.exports = gte; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.js +var require_lte = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.js"(exports, module) { + "use strict"; + var compare = require_compare(); + var lte = (a, b, loose) => compare(a, b, loose) <= 0; + module.exports = lte; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.js +var require_cmp = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.js"(exports, module) { + "use strict"; + var eq = require_eq(); + var neq = require_neq(); + var gt = require_gt(); + var gte = require_gte(); + var lt = require_lt(); + var lte = require_lte(); + var cmp = (a, op, b, loose) => { + switch (op) { + case "===": + if (typeof a === "object") { + a = a.version; + } + if (typeof b === "object") { + b = b.version; + } + return a === b; + case "!==": + if (typeof a === "object") { + a = a.version; + } + if (typeof b === "object") { + b = b.version; + } + return a !== b; + case "": + case "=": + case "==": + return eq(a, b, loose); + case "!=": + return neq(a, b, loose); + case ">": + return gt(a, b, loose); + case ">=": + return gte(a, b, loose); + case "<": + return lt(a, b, loose); + case "<=": + return lte(a, b, loose); + default: + throw new TypeError(`Invalid operator: ${op}`); + } + }; + module.exports = cmp; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js +var require_coerce = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var parse5 = require_parse3(); + var { safeRe: re, t } = require_re(); + var coerce = (version3, options) => { + if (version3 instanceof SemVer) { + return version3; + } + if (typeof version3 === "number") { + version3 = String(version3); + } + if (typeof version3 !== "string") { + return null; + } + options = options || {}; + let match3 = null; + if (!options.rtl) { + match3 = version3.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]); + } else { + const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]; + let next2; + while ((next2 = coerceRtlRegex.exec(version3)) && (!match3 || match3.index + match3[0].length !== version3.length)) { + if (!match3 || next2.index + next2[0].length !== match3.index + match3[0].length) { + match3 = next2; + } + coerceRtlRegex.lastIndex = next2.index + next2[1].length + next2[2].length; + } + coerceRtlRegex.lastIndex = -1; + } + if (match3 === null) { + return null; + } + const major = match3[2]; + const minor = match3[3] || "0"; + const patch = match3[4] || "0"; + const prerelease = options.includePrerelease && match3[5] ? `-${match3[5]}` : ""; + const build = options.includePrerelease && match3[6] ? `+${match3[6]}` : ""; + return parse5(`${major}.${minor}.${patch}${prerelease}${build}`, options); + }; + module.exports = coerce; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.js +var require_lrucache = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.js"(exports, module) { + "use strict"; + var LRUCache = class { + constructor() { + this.max = 1e3; + this.map = /* @__PURE__ */ new Map(); + } + get(key) { + const value2 = this.map.get(key); + if (value2 === void 0) { + return void 0; + } else { + this.map.delete(key); + this.map.set(key, value2); + return value2; + } + } + delete(key) { + return this.map.delete(key); + } + set(key, value2) { + const deleted = this.delete(key); + if (!deleted && value2 !== void 0) { + if (this.map.size >= this.max) { + const firstKey = this.map.keys().next().value; + this.delete(firstKey); + } + this.map.set(key, value2); + } + return this; + } + }; + module.exports = LRUCache; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.js +var require_range = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.js"(exports, module) { + "use strict"; + var SPACE_CHARACTERS = /\s+/g; + var Range = class _Range { + constructor(range2, options) { + options = parseOptions(options); + if (range2 instanceof _Range) { + if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) { + return range2; + } else { + return new _Range(range2.raw, options); + } + } + if (range2 instanceof Comparator) { + this.raw = range2.value; + this.set = [[range2]]; + this.formatted = void 0; + return this; + } + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + this.raw = range2.trim().replace(SPACE_CHARACTERS, " "); + this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length); + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${this.raw}`); + } + if (this.set.length > 1) { + const first = this.set[0]; + this.set = this.set.filter((c) => !isNullSet(c[0])); + if (this.set.length === 0) { + this.set = [first]; + } else if (this.set.length > 1) { + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c]; + break; + } + } + } + } + this.formatted = void 0; + } + get range() { + if (this.formatted === void 0) { + this.formatted = ""; + for (let i = 0; i < this.set.length; i++) { + if (i > 0) { + this.formatted += "||"; + } + const comps = this.set[i]; + for (let k = 0; k < comps.length; k++) { + if (k > 0) { + this.formatted += " "; + } + this.formatted += comps[k].toString().trim(); + } + } + } + return this.formatted; + } + format() { + return this.range; + } + toString() { + return this.range; + } + parseRange(range2) { + const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE); + const memoKey = memoOpts + ":" + range2; + const cached4 = cache.get(memoKey); + if (cached4) { + return cached4; + } + const loose = this.options.loose; + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; + range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease)); + debug3("hyphen replace", range2); + range2 = range2.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); + debug3("comparator trim", range2); + range2 = range2.replace(re[t.TILDETRIM], tildeTrimReplace); + debug3("tilde trim", range2); + range2 = range2.replace(re[t.CARETTRIM], caretTrimReplace); + debug3("caret trim", range2); + let rangeList = range2.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)); + if (loose) { + rangeList = rangeList.filter((comp) => { + debug3("loose invalid filter", comp, this.options); + return !!comp.match(re[t.COMPARATORLOOSE]); + }); + } + debug3("range list", rangeList); + const rangeMap = /* @__PURE__ */ new Map(); + const comparators = rangeList.map((comp) => new Comparator(comp, this.options)); + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp]; + } + rangeMap.set(comp.value, comp); + } + if (rangeMap.size > 1 && rangeMap.has("")) { + rangeMap.delete(""); + } + const result = [...rangeMap.values()]; + cache.set(memoKey, result); + return result; + } + intersects(range2, options) { + if (!(range2 instanceof _Range)) { + throw new TypeError("a Range is required"); + } + return this.set.some((thisComparators) => { + return isSatisfiable(thisComparators, options) && range2.set.some((rangeComparators) => { + return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options); + }); + }); + }); + }); + } + // if ANY of the sets match ALL of its comparators, then pass + test(version3) { + if (!version3) { + return false; + } + if (typeof version3 === "string") { + try { + version3 = new SemVer(version3, this.options); + } catch (er) { + return false; + } + } + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version3, this.options)) { + return true; + } + } + return false; + } + }; + module.exports = Range; + var LRU = require_lrucache(); + var cache = new LRU(); + var parseOptions = require_parse_options(); + var Comparator = require_comparator(); + var debug3 = require_debug(); + var SemVer = require_semver(); + var { + safeRe: re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace + } = require_re(); + var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants11(); + var isNullSet = (c) => c.value === "<0.0.0-0"; + var isAny = (c) => c.value === ""; + var isSatisfiable = (comparators, options) => { + let result = true; + const remainingComparators = comparators.slice(); + let testComparator = remainingComparators.pop(); + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options); + }); + testComparator = remainingComparators.pop(); + } + return result; + }; + var parseComparator = (comp, options) => { + comp = comp.replace(re[t.BUILD], ""); + debug3("comp", comp, options); + comp = replaceCarets(comp, options); + debug3("caret", comp); + comp = replaceTildes(comp, options); + debug3("tildes", comp); + comp = replaceXRanges(comp, options); + debug3("xrange", comp); + comp = replaceStars(comp, options); + debug3("stars", comp); + return comp; + }; + var isX = (id) => !id || id.toLowerCase() === "x" || id === "*"; + var replaceTildes = (comp, options) => { + return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" "); + }; + var replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]; + return comp.replace(r, (_, M, m, p, pr) => { + debug3("tilde", comp, _, M, m, p, pr); + let ret; + if (isX(M)) { + ret = ""; + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0`; + } else if (isX(p)) { + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`; + } else if (pr) { + debug3("replaceTilde pr", pr); + ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + } else { + ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`; + } + debug3("tilde return", ret); + return ret; + }); + }; + var replaceCarets = (comp, options) => { + return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" "); + }; + var replaceCaret = (comp, options) => { + debug3("caret", comp, options); + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]; + const z2 = options.includePrerelease ? "-0" : ""; + return comp.replace(r, (_, M, m, p, pr) => { + debug3("caret", comp, _, M, m, p, pr); + let ret; + if (isX(M)) { + ret = ""; + } else if (isX(m)) { + ret = `>=${M}.0.0${z2} <${+M + 1}.0.0-0`; + } else if (isX(p)) { + if (M === "0") { + ret = `>=${M}.${m}.0${z2} <${M}.${+m + 1}.0-0`; + } else { + ret = `>=${M}.${m}.0${z2} <${+M + 1}.0.0-0`; + } + } else if (pr) { + debug3("replaceCaret pr", pr); + if (M === "0") { + if (m === "0") { + ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`; + } else { + ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + } + } else { + ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`; + } + } else { + debug3("no pr"); + if (M === "0") { + if (m === "0") { + ret = `>=${M}.${m}.${p}${z2} <${M}.${m}.${+p + 1}-0`; + } else { + ret = `>=${M}.${m}.${p}${z2} <${M}.${+m + 1}.0-0`; + } + } else { + ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`; + } + } + debug3("caret return", ret); + return ret; + }); + }; + var replaceXRanges = (comp, options) => { + debug3("replaceXRanges", comp, options); + return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" "); + }; + var replaceXRange = (comp, options) => { + comp = comp.trim(); + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug3("xRange", comp, ret, gtlt, M, m, p, pr); + const xM = isX(M); + const xm = xM || isX(m); + const xp = xm || isX(p); + const anyX = xp; + if (gtlt === "=" && anyX) { + gtlt = ""; + } + pr = options.includePrerelease ? "-0" : ""; + if (xM) { + if (gtlt === ">" || gtlt === "<") { + ret = "<0.0.0-0"; + } else { + ret = "*"; + } + } else if (gtlt && anyX) { + if (xm) { + m = 0; + } + p = 0; + if (gtlt === ">") { + gtlt = ">="; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else { + m = +m + 1; + p = 0; + } + } else if (gtlt === "<=") { + gtlt = "<"; + if (xm) { + M = +M + 1; + } else { + m = +m + 1; + } + } + if (gtlt === "<") { + pr = "-0"; + } + ret = `${gtlt + M}.${m}.${p}${pr}`; + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`; + } else if (xp) { + ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`; + } + debug3("xRange return", ret); + return ret; + }); + }; + var replaceStars = (comp, options) => { + debug3("replaceStars", comp, options); + return comp.trim().replace(re[t.STAR], ""); + }; + var replaceGTE0 = (comp, options) => { + debug3("replaceGTE0", comp, options); + return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], ""); + }; + var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => { + if (isX(fM)) { + from = ""; + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? "-0" : ""}`; + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`; + } else if (fpr) { + from = `>=${from}`; + } else { + from = `>=${from}${incPr ? "-0" : ""}`; + } + if (isX(tM)) { + to = ""; + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0`; + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0`; + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}`; + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0`; + } else { + to = `<=${to}`; + } + return `${from} ${to}`.trim(); + }; + var testSet = (set2, version3, options) => { + for (let i = 0; i < set2.length; i++) { + if (!set2[i].test(version3)) { + return false; + } + } + if (version3.prerelease.length && !options.includePrerelease) { + for (let i = 0; i < set2.length; i++) { + debug3(set2[i].semver); + if (set2[i].semver === Comparator.ANY) { + continue; + } + if (set2[i].semver.prerelease.length > 0) { + const allowed = set2[i].semver; + if (allowed.major === version3.major && allowed.minor === version3.minor && allowed.patch === version3.patch) { + return true; + } + } + } + return false; + } + return true; + }; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.js +var require_comparator = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.js"(exports, module) { + "use strict"; + var ANY = Symbol("SemVer ANY"); + var Comparator = class _Comparator { + static get ANY() { + return ANY; + } + constructor(comp, options) { + options = parseOptions(options); + if (comp instanceof _Comparator) { + if (comp.loose === !!options.loose) { + return comp; + } else { + comp = comp.value; + } + } + comp = comp.trim().split(/\s+/).join(" "); + debug3("comparator", comp, options); + this.options = options; + this.loose = !!options.loose; + this.parse(comp); + if (this.semver === ANY) { + this.value = ""; + } else { + this.value = this.operator + this.semver.version; + } + debug3("comp", this); + } + parse(comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; + const m = comp.match(r); + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`); + } + this.operator = m[1] !== void 0 ? m[1] : ""; + if (this.operator === "=") { + this.operator = ""; + } + if (!m[2]) { + this.semver = ANY; + } else { + this.semver = new SemVer(m[2], this.options.loose); + } + } + toString() { + return this.value; + } + test(version3) { + debug3("Comparator.test", version3, this.options.loose); + if (this.semver === ANY || version3 === ANY) { + return true; + } + if (typeof version3 === "string") { + try { + version3 = new SemVer(version3, this.options); + } catch (er) { + return false; + } + } + return cmp(version3, this.operator, this.semver, this.options); + } + intersects(comp, options) { + if (!(comp instanceof _Comparator)) { + throw new TypeError("a Comparator is required"); + } + if (this.operator === "") { + if (this.value === "") { + return true; + } + return new Range(comp.value, options).test(this.value); + } else if (comp.operator === "") { + if (comp.value === "") { + return true; + } + return new Range(this.value, options).test(comp.semver); + } + options = parseOptions(options); + if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) { + return false; + } + if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) { + return false; + } + if (this.operator.startsWith(">") && comp.operator.startsWith(">")) { + return true; + } + if (this.operator.startsWith("<") && comp.operator.startsWith("<")) { + return true; + } + if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) { + return true; + } + if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) { + return true; + } + if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) { + return true; + } + return false; + } + }; + module.exports = Comparator; + var parseOptions = require_parse_options(); + var { safeRe: re, t } = require_re(); + var cmp = require_cmp(); + var debug3 = require_debug(); + var SemVer = require_semver(); + var Range = require_range(); + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js +var require_satisfies = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js"(exports, module) { + "use strict"; + var Range = require_range(); + var satisfies = (version3, range2, options) => { + try { + range2 = new Range(range2, options); + } catch (er) { + return false; + } + return range2.test(version3); + }; + module.exports = satisfies; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.js +var require_to_comparators = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.js"(exports, module) { + "use strict"; + var Range = require_range(); + var toComparators = (range2, options) => new Range(range2, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" ")); + module.exports = toComparators; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.js +var require_max_satisfying = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var Range = require_range(); + var maxSatisfying = (versions, range2, options) => { + let max = null; + let maxSV = null; + let rangeObj = null; + try { + rangeObj = new Range(range2, options); + } catch (er) { + return null; + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + if (!max || maxSV.compare(v) === -1) { + max = v; + maxSV = new SemVer(max, options); + } + } + }); + return max; + }; + module.exports = maxSatisfying; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.js +var require_min_satisfying = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var Range = require_range(); + var minSatisfying = (versions, range2, options) => { + let min = null; + let minSV = null; + let rangeObj = null; + try { + rangeObj = new Range(range2, options); + } catch (er) { + return null; + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + if (!min || minSV.compare(v) === 1) { + min = v; + minSV = new SemVer(min, options); + } + } + }); + return min; + }; + module.exports = minSatisfying; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.js +var require_min_version = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var Range = require_range(); + var gt = require_gt(); + var minVersion = (range2, loose) => { + range2 = new Range(range2, loose); + let minver = new SemVer("0.0.0"); + if (range2.test(minver)) { + return minver; + } + minver = new SemVer("0.0.0-0"); + if (range2.test(minver)) { + return minver; + } + minver = null; + for (let i = 0; i < range2.set.length; ++i) { + const comparators = range2.set[i]; + let setMin = null; + comparators.forEach((comparator) => { + const compver = new SemVer(comparator.semver.version); + switch (comparator.operator) { + case ">": + if (compver.prerelease.length === 0) { + compver.patch++; + } else { + compver.prerelease.push(0); + } + compver.raw = compver.format(); + /* fallthrough */ + case "": + case ">=": + if (!setMin || gt(compver, setMin)) { + setMin = compver; + } + break; + case "<": + case "<=": + break; + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`); + } + }); + if (setMin && (!minver || gt(minver, setMin))) { + minver = setMin; + } + } + if (minver && range2.test(minver)) { + return minver; + } + return null; + }; + module.exports = minVersion; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.js +var require_valid2 = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.js"(exports, module) { + "use strict"; + var Range = require_range(); + var validRange = (range2, options) => { + try { + return new Range(range2, options).range || "*"; + } catch (er) { + return null; + } + }; + module.exports = validRange; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.js +var require_outside = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.js"(exports, module) { + "use strict"; + var SemVer = require_semver(); + var Comparator = require_comparator(); + var { ANY } = Comparator; + var Range = require_range(); + var satisfies = require_satisfies(); + var gt = require_gt(); + var lt = require_lt(); + var lte = require_lte(); + var gte = require_gte(); + var outside = (version3, range2, hilo, options) => { + version3 = new SemVer(version3, options); + range2 = new Range(range2, options); + let gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case ">": + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = ">"; + ecomp = ">="; + break; + case "<": + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = "<"; + ecomp = "<="; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + if (satisfies(version3, range2, options)) { + return false; + } + for (let i = 0; i < range2.set.length; ++i) { + const comparators = range2.set[i]; + let high = null; + let low = null; + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator(">=0.0.0"); + } + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator; + } + }); + if (high.operator === comp || high.operator === ecomp) { + return false; + } + if ((!low.operator || low.operator === comp) && ltefn(version3, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version3, low.semver)) { + return false; + } + } + return true; + }; + module.exports = outside; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js +var require_gtr = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js"(exports, module) { + "use strict"; + var outside = require_outside(); + var gtr = (version3, range2, options) => outside(version3, range2, ">", options); + module.exports = gtr; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js +var require_ltr = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js"(exports, module) { + "use strict"; + var outside = require_outside(); + var ltr = (version3, range2, options) => outside(version3, range2, "<", options); + module.exports = ltr; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.js +var require_intersects = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.js"(exports, module) { + "use strict"; + var Range = require_range(); + var intersects = (r1, r2, options) => { + r1 = new Range(r1, options); + r2 = new Range(r2, options); + return r1.intersects(r2, options); + }; + module.exports = intersects; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.js +var require_simplify = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.js"(exports, module) { + "use strict"; + var satisfies = require_satisfies(); + var compare = require_compare(); + module.exports = (versions, range2, options) => { + const set2 = []; + let first = null; + let prev = null; + const v = versions.sort((a, b) => compare(a, b, options)); + for (const version3 of v) { + const included = satisfies(version3, range2, options); + if (included) { + prev = version3; + if (!first) { + first = version3; + } + } else { + if (prev) { + set2.push([first, prev]); + } + prev = null; + first = null; + } + } + if (first) { + set2.push([first, null]); + } + const ranges = []; + for (const [min, max] of set2) { + if (min === max) { + ranges.push(min); + } else if (!max && min === v[0]) { + ranges.push("*"); + } else if (!max) { + ranges.push(`>=${min}`); + } else if (min === v[0]) { + ranges.push(`<=${max}`); + } else { + ranges.push(`${min} - ${max}`); + } + } + const simplified = ranges.join(" || "); + const original = typeof range2.raw === "string" ? range2.raw : String(range2); + return simplified.length < original.length ? simplified : range2; + }; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.js +var require_subset = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.js"(exports, module) { + "use strict"; + var Range = require_range(); + var Comparator = require_comparator(); + var { ANY } = Comparator; + var satisfies = require_satisfies(); + var compare = require_compare(); + var subset = (sub, dom, options = {}) => { + if (sub === dom) { + return true; + } + sub = new Range(sub, options); + dom = new Range(dom, options); + let sawNonNull = false; + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options); + sawNonNull = sawNonNull || isSub !== null; + if (isSub) { + continue OUTER; + } + } + if (sawNonNull) { + return false; + } + } + return true; + }; + var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")]; + var minimumVersion = [new Comparator(">=0.0.0")]; + var simpleSubset = (sub, dom, options) => { + if (sub === dom) { + return true; + } + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true; + } else if (options.includePrerelease) { + sub = minimumVersionWithPreRelease; + } else { + sub = minimumVersion; + } + } + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true; + } else { + dom = minimumVersion; + } + } + const eqSet = /* @__PURE__ */ new Set(); + let gt, lt; + for (const c of sub) { + if (c.operator === ">" || c.operator === ">=") { + gt = higherGT(gt, c, options); + } else if (c.operator === "<" || c.operator === "<=") { + lt = lowerLT(lt, c, options); + } else { + eqSet.add(c.semver); + } + } + if (eqSet.size > 1) { + return null; + } + let gtltComp; + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options); + if (gtltComp > 0) { + return null; + } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) { + return null; + } + } + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) { + return null; + } + if (lt && !satisfies(eq, String(lt), options)) { + return null; + } + for (const c of dom) { + if (!satisfies(eq, String(c), options)) { + return false; + } + } + return true; + } + let higher, lower2; + let hasDomLT, hasDomGT; + let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false; + let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false; + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false; + } + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">="; + hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<="; + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false; + } + } + if (c.operator === ">" || c.operator === ">=") { + higher = higherGT(gt, c, options); + if (higher === c && higher !== gt) { + return false; + } + } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) { + return false; + } + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false; + } + } + if (c.operator === "<" || c.operator === "<=") { + lower2 = lowerLT(lt, c, options); + if (lower2 === c && lower2 !== lt) { + return false; + } + } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) { + return false; + } + } + if (!c.operator && (lt || gt) && gtltComp !== 0) { + return false; + } + } + if (gt && hasDomLT && !lt && gtltComp !== 0) { + return false; + } + if (lt && hasDomGT && !gt && gtltComp !== 0) { + return false; + } + if (needDomGTPre || needDomLTPre) { + return false; + } + return true; + }; + var higherGT = (a, b, options) => { + if (!a) { + return b; + } + const comp = compare(a.semver, b.semver, options); + return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a; + }; + var lowerLT = (a, b, options) => { + if (!a) { + return b; + } + const comp = compare(a.semver, b.semver, options); + return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a; + }; + module.exports = subset; + } +}); + +// node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js +var require_semver2 = __commonJS({ + "node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js"(exports, module) { + "use strict"; + var internalRe = require_re(); + var constants = require_constants11(); + var SemVer = require_semver(); + var identifiers = require_identifiers(); + var parse5 = require_parse3(); + var valid = require_valid(); + var clean = require_clean(); + var inc = require_inc(); + var diff = require_diff(); + var major = require_major(); + var minor = require_minor(); + var patch = require_patch(); + var prerelease = require_prerelease(); + var compare = require_compare(); + var rcompare = require_rcompare(); + var compareLoose = require_compare_loose(); + var compareBuild = require_compare_build(); + var sort = require_sort(); + var rsort = require_rsort(); + var gt = require_gt(); + var lt = require_lt(); + var eq = require_eq(); + var neq = require_neq(); + var gte = require_gte(); + var lte = require_lte(); + var cmp = require_cmp(); + var coerce = require_coerce(); + var Comparator = require_comparator(); + var Range = require_range(); + var satisfies = require_satisfies(); + var toComparators = require_to_comparators(); + var maxSatisfying = require_max_satisfying(); + var minSatisfying = require_min_satisfying(); + var minVersion = require_min_version(); + var validRange = require_valid2(); + var outside = require_outside(); + var gtr = require_gtr(); + var ltr = require_ltr(); + var intersects = require_intersects(); + var simplifyRange = require_simplify(); + var subset = require_subset(); + module.exports = { + parse: parse5, + valid, + clean, + inc, + diff, + major, + minor, + patch, + prerelease, + compare, + rcompare, + compareLoose, + compareBuild, + sort, + rsort, + gt, + lt, + eq, + neq, + gte, + lte, + cmp, + coerce, + Comparator, + Range, + satisfies, + toComparators, + maxSatisfying, + minSatisfying, + minVersion, + validRange, + outside, + gtr, + ltr, + intersects, + simplifyRange, + subset, + SemVer, + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, + RELEASE_TYPES: constants.RELEASE_TYPES, + compareIdentifiers: identifiers.compareIdentifiers, + rcompareIdentifiers: identifiers.rcompareIdentifiers + }; + } +}); + // node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/Errors.js var defaultMessages, EndOfStreamError, AbortError; var init_Errors = __esm({ @@ -96993,1939 +98923,9 @@ var require_turndown_cjs = __commonJS({ } }); -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js -var require_constants11 = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js"(exports, module) { - "use strict"; - var SEMVER_SPEC_VERSION = "2.0.0"; - var MAX_LENGTH = 256; - var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */ - 9007199254740991; - var MAX_SAFE_COMPONENT_LENGTH = 16; - var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6; - var RELEASE_TYPES = [ - "major", - "premajor", - "minor", - "preminor", - "patch", - "prepatch", - "prerelease" - ]; - module.exports = { - MAX_LENGTH, - MAX_SAFE_COMPONENT_LENGTH, - MAX_SAFE_BUILD_LENGTH, - MAX_SAFE_INTEGER, - RELEASE_TYPES, - SEMVER_SPEC_VERSION, - FLAG_INCLUDE_PRERELEASE: 1, - FLAG_LOOSE: 2 - }; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js -var require_debug = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js"(exports, module) { - "use strict"; - var debug3 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args2) => console.error("SEMVER", ...args2) : () => { - }; - module.exports = debug3; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js -var require_re = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.js"(exports, module) { - "use strict"; - var { - MAX_SAFE_COMPONENT_LENGTH, - MAX_SAFE_BUILD_LENGTH, - MAX_LENGTH - } = require_constants11(); - var debug3 = require_debug(); - exports = module.exports = {}; - var re = exports.re = []; - var safeRe = exports.safeRe = []; - var src = exports.src = []; - var safeSrc = exports.safeSrc = []; - var t = exports.t = {}; - var R = 0; - var LETTERDASHNUMBER = "[a-zA-Z0-9-]"; - var safeRegexReplacements = [ - ["\\s", 1], - ["\\d", MAX_LENGTH], - [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH] - ]; - var makeSafeRegex = (value2) => { - for (const [token, max] of safeRegexReplacements) { - value2 = value2.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`); - } - return value2; - }; - var createToken = (name, value2, isGlobal) => { - const safe = makeSafeRegex(value2); - const index = R++; - debug3(name, index, value2); - t[name] = index; - src[index] = value2; - safeSrc[index] = safe; - re[index] = new RegExp(value2, isGlobal ? "g" : void 0); - safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0); - }; - createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*"); - createToken("NUMERICIDENTIFIERLOOSE", "\\d+"); - createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`); - createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`); - createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`); - createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`); - createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`); - createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); - createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); - createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`); - createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); - createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`); - createToken("FULL", `^${src[t.FULLPLAIN]}$`); - createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`); - createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`); - createToken("GTLT", "((?:<|>)?=?)"); - createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); - createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); - createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`); - createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`); - createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); - createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); - createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`); - createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`); - createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`); - createToken("COERCERTL", src[t.COERCE], true); - createToken("COERCERTLFULL", src[t.COERCEFULL], true); - createToken("LONETILDE", "(?:~>?)"); - createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true); - exports.tildeTrimReplace = "$1~"; - createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); - createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); - createToken("LONECARET", "(?:\\^)"); - createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true); - exports.caretTrimReplace = "$1^"; - createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); - createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); - createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); - createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); - createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); - exports.comparatorTrimReplace = "$1$2$3"; - createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`); - createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`); - createToken("STAR", "(<|>)?=?\\s*\\*"); - createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"); - createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$"); - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js -var require_parse_options = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.js"(exports, module) { - "use strict"; - var looseOption = Object.freeze({ loose: true }); - var emptyOpts = Object.freeze({}); - var parseOptions = (options) => { - if (!options) { - return emptyOpts; - } - if (typeof options !== "object") { - return looseOption; - } - return options; - }; - module.exports = parseOptions; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js -var require_identifiers = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js"(exports, module) { - "use strict"; - var numeric = /^[0-9]+$/; - var compareIdentifiers = (a, b) => { - if (typeof a === "number" && typeof b === "number") { - return a === b ? 0 : a < b ? -1 : 1; - } - const anum = numeric.test(a); - const bnum = numeric.test(b); - if (anum && bnum) { - a = +a; - b = +b; - } - return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; - }; - var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a); - module.exports = { - compareIdentifiers, - rcompareIdentifiers - }; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js -var require_semver = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.js"(exports, module) { - "use strict"; - var debug3 = require_debug(); - var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants11(); - var { safeRe: re, t } = require_re(); - var parseOptions = require_parse_options(); - var { compareIdentifiers } = require_identifiers(); - var SemVer = class _SemVer { - constructor(version3, options) { - options = parseOptions(options); - if (version3 instanceof _SemVer) { - if (version3.loose === !!options.loose && version3.includePrerelease === !!options.includePrerelease) { - return version3; - } else { - version3 = version3.version; - } - } else if (typeof version3 !== "string") { - throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version3}".`); - } - if (version3.length > MAX_LENGTH) { - throw new TypeError( - `version is longer than ${MAX_LENGTH} characters` - ); - } - debug3("SemVer", version3, options); - this.options = options; - this.loose = !!options.loose; - this.includePrerelease = !!options.includePrerelease; - const m = version3.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); - if (!m) { - throw new TypeError(`Invalid Version: ${version3}`); - } - this.raw = version3; - this.major = +m[1]; - this.minor = +m[2]; - this.patch = +m[3]; - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError("Invalid major version"); - } - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError("Invalid minor version"); - } - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError("Invalid patch version"); - } - if (!m[4]) { - this.prerelease = []; - } else { - this.prerelease = m[4].split(".").map((id) => { - if (/^[0-9]+$/.test(id)) { - const num = +id; - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num; - } - } - return id; - }); - } - this.build = m[5] ? m[5].split(".") : []; - this.format(); - } - format() { - this.version = `${this.major}.${this.minor}.${this.patch}`; - if (this.prerelease.length) { - this.version += `-${this.prerelease.join(".")}`; - } - return this.version; - } - toString() { - return this.version; - } - compare(other) { - debug3("SemVer.compare", this.version, this.options, other); - if (!(other instanceof _SemVer)) { - if (typeof other === "string" && other === this.version) { - return 0; - } - other = new _SemVer(other, this.options); - } - if (other.version === this.version) { - return 0; - } - return this.compareMain(other) || this.comparePre(other); - } - compareMain(other) { - if (!(other instanceof _SemVer)) { - other = new _SemVer(other, this.options); - } - if (this.major < other.major) { - return -1; - } - if (this.major > other.major) { - return 1; - } - if (this.minor < other.minor) { - return -1; - } - if (this.minor > other.minor) { - return 1; - } - if (this.patch < other.patch) { - return -1; - } - if (this.patch > other.patch) { - return 1; - } - return 0; - } - comparePre(other) { - if (!(other instanceof _SemVer)) { - other = new _SemVer(other, this.options); - } - if (this.prerelease.length && !other.prerelease.length) { - return -1; - } else if (!this.prerelease.length && other.prerelease.length) { - return 1; - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0; - } - let i = 0; - do { - const a = this.prerelease[i]; - const b = other.prerelease[i]; - debug3("prerelease compare", i, a, b); - if (a === void 0 && b === void 0) { - return 0; - } else if (b === void 0) { - return 1; - } else if (a === void 0) { - return -1; - } else if (a === b) { - continue; - } else { - return compareIdentifiers(a, b); - } - } while (++i); - } - compareBuild(other) { - if (!(other instanceof _SemVer)) { - other = new _SemVer(other, this.options); - } - let i = 0; - do { - const a = this.build[i]; - const b = other.build[i]; - debug3("build compare", i, a, b); - if (a === void 0 && b === void 0) { - return 0; - } else if (b === void 0) { - return 1; - } else if (a === void 0) { - return -1; - } else if (a === b) { - continue; - } else { - return compareIdentifiers(a, b); - } - } while (++i); - } - // preminor will bump the version up to the next minor release, and immediately - // down to pre-release. premajor and prepatch work the same way. - inc(release, identifier, identifierBase) { - if (release.startsWith("pre")) { - if (!identifier && identifierBase === false) { - throw new Error("invalid increment argument: identifier is empty"); - } - if (identifier) { - const match3 = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]); - if (!match3 || match3[1] !== identifier) { - throw new Error(`invalid identifier: ${identifier}`); - } - } - } - switch (release) { - case "premajor": - this.prerelease.length = 0; - this.patch = 0; - this.minor = 0; - this.major++; - this.inc("pre", identifier, identifierBase); - break; - case "preminor": - this.prerelease.length = 0; - this.patch = 0; - this.minor++; - this.inc("pre", identifier, identifierBase); - break; - case "prepatch": - this.prerelease.length = 0; - this.inc("patch", identifier, identifierBase); - this.inc("pre", identifier, identifierBase); - break; - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case "prerelease": - if (this.prerelease.length === 0) { - this.inc("patch", identifier, identifierBase); - } - this.inc("pre", identifier, identifierBase); - break; - case "release": - if (this.prerelease.length === 0) { - throw new Error(`version ${this.raw} is not a prerelease`); - } - this.prerelease.length = 0; - break; - case "major": - if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { - this.major++; - } - this.minor = 0; - this.patch = 0; - this.prerelease = []; - break; - case "minor": - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++; - } - this.patch = 0; - this.prerelease = []; - break; - case "patch": - if (this.prerelease.length === 0) { - this.patch++; - } - this.prerelease = []; - break; - // This probably shouldn't be used publicly. - // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. - case "pre": { - const base = Number(identifierBase) ? 1 : 0; - if (this.prerelease.length === 0) { - this.prerelease = [base]; - } else { - let i = this.prerelease.length; - while (--i >= 0) { - if (typeof this.prerelease[i] === "number") { - this.prerelease[i]++; - i = -2; - } - } - if (i === -1) { - if (identifier === this.prerelease.join(".") && identifierBase === false) { - throw new Error("invalid increment argument: identifier already exists"); - } - this.prerelease.push(base); - } - } - if (identifier) { - let prerelease = [identifier, base]; - if (identifierBase === false) { - prerelease = [identifier]; - } - if (compareIdentifiers(this.prerelease[0], identifier) === 0) { - if (isNaN(this.prerelease[1])) { - this.prerelease = prerelease; - } - } else { - this.prerelease = prerelease; - } - } - break; - } - default: - throw new Error(`invalid increment argument: ${release}`); - } - this.raw = this.format(); - if (this.build.length) { - this.raw += `+${this.build.join(".")}`; - } - return this; - } - }; - module.exports = SemVer; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js -var require_parse3 = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var parse5 = (version3, options, throwErrors = false) => { - if (version3 instanceof SemVer) { - return version3; - } - try { - return new SemVer(version3, options); - } catch (er) { - if (!throwErrors) { - return null; - } - throw er; - } - }; - module.exports = parse5; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js -var require_valid = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.js"(exports, module) { - "use strict"; - var parse5 = require_parse3(); - var valid = (version3, options) => { - const v = parse5(version3, options); - return v ? v.version : null; - }; - module.exports = valid; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js -var require_clean = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.js"(exports, module) { - "use strict"; - var parse5 = require_parse3(); - var clean = (version3, options) => { - const s = parse5(version3.trim().replace(/^[=v]+/, ""), options); - return s ? s.version : null; - }; - module.exports = clean; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js -var require_inc = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var inc = (version3, release, options, identifier, identifierBase) => { - if (typeof options === "string") { - identifierBase = identifier; - identifier = options; - options = void 0; - } - try { - return new SemVer( - version3 instanceof SemVer ? version3.version : version3, - options - ).inc(release, identifier, identifierBase).version; - } catch (er) { - return null; - } - }; - module.exports = inc; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js -var require_diff = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.js"(exports, module) { - "use strict"; - var parse5 = require_parse3(); - var diff = (version1, version22) => { - const v1 = parse5(version1, null, true); - const v2 = parse5(version22, null, true); - const comparison = v1.compare(v2); - if (comparison === 0) { - return null; - } - const v1Higher = comparison > 0; - const highVersion = v1Higher ? v1 : v2; - const lowVersion = v1Higher ? v2 : v1; - const highHasPre = !!highVersion.prerelease.length; - const lowHasPre = !!lowVersion.prerelease.length; - if (lowHasPre && !highHasPre) { - if (!lowVersion.patch && !lowVersion.minor) { - return "major"; - } - if (lowVersion.compareMain(highVersion) === 0) { - if (lowVersion.minor && !lowVersion.patch) { - return "minor"; - } - return "patch"; - } - } - const prefix = highHasPre ? "pre" : ""; - if (v1.major !== v2.major) { - return prefix + "major"; - } - if (v1.minor !== v2.minor) { - return prefix + "minor"; - } - if (v1.patch !== v2.patch) { - return prefix + "patch"; - } - return "prerelease"; - }; - module.exports = diff; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.js -var require_major = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var major = (a, loose) => new SemVer(a, loose).major; - module.exports = major; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.js -var require_minor = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var minor = (a, loose) => new SemVer(a, loose).minor; - module.exports = minor; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.js -var require_patch = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var patch = (a, loose) => new SemVer(a, loose).patch; - module.exports = patch; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js -var require_prerelease = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.js"(exports, module) { - "use strict"; - var parse5 = require_parse3(); - var prerelease = (version3, options) => { - const parsed2 = parse5(version3, options); - return parsed2 && parsed2.prerelease.length ? parsed2.prerelease : null; - }; - module.exports = prerelease; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js -var require_compare = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)); - module.exports = compare; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.js -var require_rcompare = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.js"(exports, module) { - "use strict"; - var compare = require_compare(); - var rcompare = (a, b, loose) => compare(b, a, loose); - module.exports = rcompare; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.js -var require_compare_loose = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.js"(exports, module) { - "use strict"; - var compare = require_compare(); - var compareLoose = (a, b) => compare(a, b, true); - module.exports = compareLoose; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.js -var require_compare_build = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var compareBuild = (a, b, loose) => { - const versionA = new SemVer(a, loose); - const versionB = new SemVer(b, loose); - return versionA.compare(versionB) || versionA.compareBuild(versionB); - }; - module.exports = compareBuild; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.js -var require_sort = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.js"(exports, module) { - "use strict"; - var compareBuild = require_compare_build(); - var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)); - module.exports = sort; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.js -var require_rsort = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.js"(exports, module) { - "use strict"; - var compareBuild = require_compare_build(); - var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)); - module.exports = rsort; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.js -var require_gt = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.js"(exports, module) { - "use strict"; - var compare = require_compare(); - var gt = (a, b, loose) => compare(a, b, loose) > 0; - module.exports = gt; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js -var require_lt = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.js"(exports, module) { - "use strict"; - var compare = require_compare(); - var lt = (a, b, loose) => compare(a, b, loose) < 0; - module.exports = lt; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.js -var require_eq = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.js"(exports, module) { - "use strict"; - var compare = require_compare(); - var eq = (a, b, loose) => compare(a, b, loose) === 0; - module.exports = eq; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.js -var require_neq = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.js"(exports, module) { - "use strict"; - var compare = require_compare(); - var neq = (a, b, loose) => compare(a, b, loose) !== 0; - module.exports = neq; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js -var require_gte = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.js"(exports, module) { - "use strict"; - var compare = require_compare(); - var gte = (a, b, loose) => compare(a, b, loose) >= 0; - module.exports = gte; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.js -var require_lte = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.js"(exports, module) { - "use strict"; - var compare = require_compare(); - var lte = (a, b, loose) => compare(a, b, loose) <= 0; - module.exports = lte; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.js -var require_cmp = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.js"(exports, module) { - "use strict"; - var eq = require_eq(); - var neq = require_neq(); - var gt = require_gt(); - var gte = require_gte(); - var lt = require_lt(); - var lte = require_lte(); - var cmp = (a, op, b, loose) => { - switch (op) { - case "===": - if (typeof a === "object") { - a = a.version; - } - if (typeof b === "object") { - b = b.version; - } - return a === b; - case "!==": - if (typeof a === "object") { - a = a.version; - } - if (typeof b === "object") { - b = b.version; - } - return a !== b; - case "": - case "=": - case "==": - return eq(a, b, loose); - case "!=": - return neq(a, b, loose); - case ">": - return gt(a, b, loose); - case ">=": - return gte(a, b, loose); - case "<": - return lt(a, b, loose); - case "<=": - return lte(a, b, loose); - default: - throw new TypeError(`Invalid operator: ${op}`); - } - }; - module.exports = cmp; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js -var require_coerce = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var parse5 = require_parse3(); - var { safeRe: re, t } = require_re(); - var coerce = (version3, options) => { - if (version3 instanceof SemVer) { - return version3; - } - if (typeof version3 === "number") { - version3 = String(version3); - } - if (typeof version3 !== "string") { - return null; - } - options = options || {}; - let match3 = null; - if (!options.rtl) { - match3 = version3.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]); - } else { - const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]; - let next2; - while ((next2 = coerceRtlRegex.exec(version3)) && (!match3 || match3.index + match3[0].length !== version3.length)) { - if (!match3 || next2.index + next2[0].length !== match3.index + match3[0].length) { - match3 = next2; - } - coerceRtlRegex.lastIndex = next2.index + next2[1].length + next2[2].length; - } - coerceRtlRegex.lastIndex = -1; - } - if (match3 === null) { - return null; - } - const major = match3[2]; - const minor = match3[3] || "0"; - const patch = match3[4] || "0"; - const prerelease = options.includePrerelease && match3[5] ? `-${match3[5]}` : ""; - const build = options.includePrerelease && match3[6] ? `+${match3[6]}` : ""; - return parse5(`${major}.${minor}.${patch}${prerelease}${build}`, options); - }; - module.exports = coerce; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.js -var require_lrucache = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.js"(exports, module) { - "use strict"; - var LRUCache = class { - constructor() { - this.max = 1e3; - this.map = /* @__PURE__ */ new Map(); - } - get(key) { - const value2 = this.map.get(key); - if (value2 === void 0) { - return void 0; - } else { - this.map.delete(key); - this.map.set(key, value2); - return value2; - } - } - delete(key) { - return this.map.delete(key); - } - set(key, value2) { - const deleted = this.delete(key); - if (!deleted && value2 !== void 0) { - if (this.map.size >= this.max) { - const firstKey = this.map.keys().next().value; - this.delete(firstKey); - } - this.map.set(key, value2); - } - return this; - } - }; - module.exports = LRUCache; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.js -var require_range = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.js"(exports, module) { - "use strict"; - var SPACE_CHARACTERS = /\s+/g; - var Range = class _Range { - constructor(range2, options) { - options = parseOptions(options); - if (range2 instanceof _Range) { - if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) { - return range2; - } else { - return new _Range(range2.raw, options); - } - } - if (range2 instanceof Comparator) { - this.raw = range2.value; - this.set = [[range2]]; - this.formatted = void 0; - return this; - } - this.options = options; - this.loose = !!options.loose; - this.includePrerelease = !!options.includePrerelease; - this.raw = range2.trim().replace(SPACE_CHARACTERS, " "); - this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length); - if (!this.set.length) { - throw new TypeError(`Invalid SemVer Range: ${this.raw}`); - } - if (this.set.length > 1) { - const first = this.set[0]; - this.set = this.set.filter((c) => !isNullSet(c[0])); - if (this.set.length === 0) { - this.set = [first]; - } else if (this.set.length > 1) { - for (const c of this.set) { - if (c.length === 1 && isAny(c[0])) { - this.set = [c]; - break; - } - } - } - } - this.formatted = void 0; - } - get range() { - if (this.formatted === void 0) { - this.formatted = ""; - for (let i = 0; i < this.set.length; i++) { - if (i > 0) { - this.formatted += "||"; - } - const comps = this.set[i]; - for (let k = 0; k < comps.length; k++) { - if (k > 0) { - this.formatted += " "; - } - this.formatted += comps[k].toString().trim(); - } - } - } - return this.formatted; - } - format() { - return this.range; - } - toString() { - return this.range; - } - parseRange(range2) { - const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE); - const memoKey = memoOpts + ":" + range2; - const cached4 = cache.get(memoKey); - if (cached4) { - return cached4; - } - const loose = this.options.loose; - const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; - range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease)); - debug3("hyphen replace", range2); - range2 = range2.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); - debug3("comparator trim", range2); - range2 = range2.replace(re[t.TILDETRIM], tildeTrimReplace); - debug3("tilde trim", range2); - range2 = range2.replace(re[t.CARETTRIM], caretTrimReplace); - debug3("caret trim", range2); - let rangeList = range2.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)); - if (loose) { - rangeList = rangeList.filter((comp) => { - debug3("loose invalid filter", comp, this.options); - return !!comp.match(re[t.COMPARATORLOOSE]); - }); - } - debug3("range list", rangeList); - const rangeMap = /* @__PURE__ */ new Map(); - const comparators = rangeList.map((comp) => new Comparator(comp, this.options)); - for (const comp of comparators) { - if (isNullSet(comp)) { - return [comp]; - } - rangeMap.set(comp.value, comp); - } - if (rangeMap.size > 1 && rangeMap.has("")) { - rangeMap.delete(""); - } - const result = [...rangeMap.values()]; - cache.set(memoKey, result); - return result; - } - intersects(range2, options) { - if (!(range2 instanceof _Range)) { - throw new TypeError("a Range is required"); - } - return this.set.some((thisComparators) => { - return isSatisfiable(thisComparators, options) && range2.set.some((rangeComparators) => { - return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => { - return rangeComparators.every((rangeComparator) => { - return thisComparator.intersects(rangeComparator, options); - }); - }); - }); - }); - } - // if ANY of the sets match ALL of its comparators, then pass - test(version3) { - if (!version3) { - return false; - } - if (typeof version3 === "string") { - try { - version3 = new SemVer(version3, this.options); - } catch (er) { - return false; - } - } - for (let i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version3, this.options)) { - return true; - } - } - return false; - } - }; - module.exports = Range; - var LRU = require_lrucache(); - var cache = new LRU(); - var parseOptions = require_parse_options(); - var Comparator = require_comparator(); - var debug3 = require_debug(); - var SemVer = require_semver(); - var { - safeRe: re, - t, - comparatorTrimReplace, - tildeTrimReplace, - caretTrimReplace - } = require_re(); - var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants11(); - var isNullSet = (c) => c.value === "<0.0.0-0"; - var isAny = (c) => c.value === ""; - var isSatisfiable = (comparators, options) => { - let result = true; - const remainingComparators = comparators.slice(); - let testComparator = remainingComparators.pop(); - while (result && remainingComparators.length) { - result = remainingComparators.every((otherComparator) => { - return testComparator.intersects(otherComparator, options); - }); - testComparator = remainingComparators.pop(); - } - return result; - }; - var parseComparator = (comp, options) => { - comp = comp.replace(re[t.BUILD], ""); - debug3("comp", comp, options); - comp = replaceCarets(comp, options); - debug3("caret", comp); - comp = replaceTildes(comp, options); - debug3("tildes", comp); - comp = replaceXRanges(comp, options); - debug3("xrange", comp); - comp = replaceStars(comp, options); - debug3("stars", comp); - return comp; - }; - var isX = (id) => !id || id.toLowerCase() === "x" || id === "*"; - var replaceTildes = (comp, options) => { - return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" "); - }; - var replaceTilde = (comp, options) => { - const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]; - return comp.replace(r, (_, M, m, p, pr) => { - debug3("tilde", comp, _, M, m, p, pr); - let ret; - if (isX(M)) { - ret = ""; - } else if (isX(m)) { - ret = `>=${M}.0.0 <${+M + 1}.0.0-0`; - } else if (isX(p)) { - ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`; - } else if (pr) { - debug3("replaceTilde pr", pr); - ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; - } else { - ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`; - } - debug3("tilde return", ret); - return ret; - }); - }; - var replaceCarets = (comp, options) => { - return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" "); - }; - var replaceCaret = (comp, options) => { - debug3("caret", comp, options); - const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]; - const z2 = options.includePrerelease ? "-0" : ""; - return comp.replace(r, (_, M, m, p, pr) => { - debug3("caret", comp, _, M, m, p, pr); - let ret; - if (isX(M)) { - ret = ""; - } else if (isX(m)) { - ret = `>=${M}.0.0${z2} <${+M + 1}.0.0-0`; - } else if (isX(p)) { - if (M === "0") { - ret = `>=${M}.${m}.0${z2} <${M}.${+m + 1}.0-0`; - } else { - ret = `>=${M}.${m}.0${z2} <${+M + 1}.0.0-0`; - } - } else if (pr) { - debug3("replaceCaret pr", pr); - if (M === "0") { - if (m === "0") { - ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`; - } else { - ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; - } - } else { - ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`; - } - } else { - debug3("no pr"); - if (M === "0") { - if (m === "0") { - ret = `>=${M}.${m}.${p}${z2} <${M}.${m}.${+p + 1}-0`; - } else { - ret = `>=${M}.${m}.${p}${z2} <${M}.${+m + 1}.0-0`; - } - } else { - ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`; - } - } - debug3("caret return", ret); - return ret; - }); - }; - var replaceXRanges = (comp, options) => { - debug3("replaceXRanges", comp, options); - return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" "); - }; - var replaceXRange = (comp, options) => { - comp = comp.trim(); - const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; - return comp.replace(r, (ret, gtlt, M, m, p, pr) => { - debug3("xRange", comp, ret, gtlt, M, m, p, pr); - const xM = isX(M); - const xm = xM || isX(m); - const xp = xm || isX(p); - const anyX = xp; - if (gtlt === "=" && anyX) { - gtlt = ""; - } - pr = options.includePrerelease ? "-0" : ""; - if (xM) { - if (gtlt === ">" || gtlt === "<") { - ret = "<0.0.0-0"; - } else { - ret = "*"; - } - } else if (gtlt && anyX) { - if (xm) { - m = 0; - } - p = 0; - if (gtlt === ">") { - gtlt = ">="; - if (xm) { - M = +M + 1; - m = 0; - p = 0; - } else { - m = +m + 1; - p = 0; - } - } else if (gtlt === "<=") { - gtlt = "<"; - if (xm) { - M = +M + 1; - } else { - m = +m + 1; - } - } - if (gtlt === "<") { - pr = "-0"; - } - ret = `${gtlt + M}.${m}.${p}${pr}`; - } else if (xm) { - ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`; - } else if (xp) { - ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`; - } - debug3("xRange return", ret); - return ret; - }); - }; - var replaceStars = (comp, options) => { - debug3("replaceStars", comp, options); - return comp.trim().replace(re[t.STAR], ""); - }; - var replaceGTE0 = (comp, options) => { - debug3("replaceGTE0", comp, options); - return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], ""); - }; - var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => { - if (isX(fM)) { - from = ""; - } else if (isX(fm)) { - from = `>=${fM}.0.0${incPr ? "-0" : ""}`; - } else if (isX(fp)) { - from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`; - } else if (fpr) { - from = `>=${from}`; - } else { - from = `>=${from}${incPr ? "-0" : ""}`; - } - if (isX(tM)) { - to = ""; - } else if (isX(tm)) { - to = `<${+tM + 1}.0.0-0`; - } else if (isX(tp)) { - to = `<${tM}.${+tm + 1}.0-0`; - } else if (tpr) { - to = `<=${tM}.${tm}.${tp}-${tpr}`; - } else if (incPr) { - to = `<${tM}.${tm}.${+tp + 1}-0`; - } else { - to = `<=${to}`; - } - return `${from} ${to}`.trim(); - }; - var testSet = (set2, version3, options) => { - for (let i = 0; i < set2.length; i++) { - if (!set2[i].test(version3)) { - return false; - } - } - if (version3.prerelease.length && !options.includePrerelease) { - for (let i = 0; i < set2.length; i++) { - debug3(set2[i].semver); - if (set2[i].semver === Comparator.ANY) { - continue; - } - if (set2[i].semver.prerelease.length > 0) { - const allowed = set2[i].semver; - if (allowed.major === version3.major && allowed.minor === version3.minor && allowed.patch === version3.patch) { - return true; - } - } - } - return false; - } - return true; - }; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.js -var require_comparator = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.js"(exports, module) { - "use strict"; - var ANY = Symbol("SemVer ANY"); - var Comparator = class _Comparator { - static get ANY() { - return ANY; - } - constructor(comp, options) { - options = parseOptions(options); - if (comp instanceof _Comparator) { - if (comp.loose === !!options.loose) { - return comp; - } else { - comp = comp.value; - } - } - comp = comp.trim().split(/\s+/).join(" "); - debug3("comparator", comp, options); - this.options = options; - this.loose = !!options.loose; - this.parse(comp); - if (this.semver === ANY) { - this.value = ""; - } else { - this.value = this.operator + this.semver.version; - } - debug3("comp", this); - } - parse(comp) { - const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; - const m = comp.match(r); - if (!m) { - throw new TypeError(`Invalid comparator: ${comp}`); - } - this.operator = m[1] !== void 0 ? m[1] : ""; - if (this.operator === "=") { - this.operator = ""; - } - if (!m[2]) { - this.semver = ANY; - } else { - this.semver = new SemVer(m[2], this.options.loose); - } - } - toString() { - return this.value; - } - test(version3) { - debug3("Comparator.test", version3, this.options.loose); - if (this.semver === ANY || version3 === ANY) { - return true; - } - if (typeof version3 === "string") { - try { - version3 = new SemVer(version3, this.options); - } catch (er) { - return false; - } - } - return cmp(version3, this.operator, this.semver, this.options); - } - intersects(comp, options) { - if (!(comp instanceof _Comparator)) { - throw new TypeError("a Comparator is required"); - } - if (this.operator === "") { - if (this.value === "") { - return true; - } - return new Range(comp.value, options).test(this.value); - } else if (comp.operator === "") { - if (comp.value === "") { - return true; - } - return new Range(this.value, options).test(comp.semver); - } - options = parseOptions(options); - if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) { - return false; - } - if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) { - return false; - } - if (this.operator.startsWith(">") && comp.operator.startsWith(">")) { - return true; - } - if (this.operator.startsWith("<") && comp.operator.startsWith("<")) { - return true; - } - if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) { - return true; - } - if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) { - return true; - } - if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) { - return true; - } - return false; - } - }; - module.exports = Comparator; - var parseOptions = require_parse_options(); - var { safeRe: re, t } = require_re(); - var cmp = require_cmp(); - var debug3 = require_debug(); - var SemVer = require_semver(); - var Range = require_range(); - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js -var require_satisfies = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.js"(exports, module) { - "use strict"; - var Range = require_range(); - var satisfies = (version3, range2, options) => { - try { - range2 = new Range(range2, options); - } catch (er) { - return false; - } - return range2.test(version3); - }; - module.exports = satisfies; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.js -var require_to_comparators = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.js"(exports, module) { - "use strict"; - var Range = require_range(); - var toComparators = (range2, options) => new Range(range2, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" ")); - module.exports = toComparators; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.js -var require_max_satisfying = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var Range = require_range(); - var maxSatisfying = (versions, range2, options) => { - let max = null; - let maxSV = null; - let rangeObj = null; - try { - rangeObj = new Range(range2, options); - } catch (er) { - return null; - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - if (!max || maxSV.compare(v) === -1) { - max = v; - maxSV = new SemVer(max, options); - } - } - }); - return max; - }; - module.exports = maxSatisfying; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.js -var require_min_satisfying = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var Range = require_range(); - var minSatisfying = (versions, range2, options) => { - let min = null; - let minSV = null; - let rangeObj = null; - try { - rangeObj = new Range(range2, options); - } catch (er) { - return null; - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - if (!min || minSV.compare(v) === 1) { - min = v; - minSV = new SemVer(min, options); - } - } - }); - return min; - }; - module.exports = minSatisfying; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.js -var require_min_version = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var Range = require_range(); - var gt = require_gt(); - var minVersion = (range2, loose) => { - range2 = new Range(range2, loose); - let minver = new SemVer("0.0.0"); - if (range2.test(minver)) { - return minver; - } - minver = new SemVer("0.0.0-0"); - if (range2.test(minver)) { - return minver; - } - minver = null; - for (let i = 0; i < range2.set.length; ++i) { - const comparators = range2.set[i]; - let setMin = null; - comparators.forEach((comparator) => { - const compver = new SemVer(comparator.semver.version); - switch (comparator.operator) { - case ">": - if (compver.prerelease.length === 0) { - compver.patch++; - } else { - compver.prerelease.push(0); - } - compver.raw = compver.format(); - /* fallthrough */ - case "": - case ">=": - if (!setMin || gt(compver, setMin)) { - setMin = compver; - } - break; - case "<": - case "<=": - break; - /* istanbul ignore next */ - default: - throw new Error(`Unexpected operation: ${comparator.operator}`); - } - }); - if (setMin && (!minver || gt(minver, setMin))) { - minver = setMin; - } - } - if (minver && range2.test(minver)) { - return minver; - } - return null; - }; - module.exports = minVersion; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.js -var require_valid2 = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.js"(exports, module) { - "use strict"; - var Range = require_range(); - var validRange = (range2, options) => { - try { - return new Range(range2, options).range || "*"; - } catch (er) { - return null; - } - }; - module.exports = validRange; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.js -var require_outside = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.js"(exports, module) { - "use strict"; - var SemVer = require_semver(); - var Comparator = require_comparator(); - var { ANY } = Comparator; - var Range = require_range(); - var satisfies = require_satisfies(); - var gt = require_gt(); - var lt = require_lt(); - var lte = require_lte(); - var gte = require_gte(); - var outside = (version3, range2, hilo, options) => { - version3 = new SemVer(version3, options); - range2 = new Range(range2, options); - let gtfn, ltefn, ltfn, comp, ecomp; - switch (hilo) { - case ">": - gtfn = gt; - ltefn = lte; - ltfn = lt; - comp = ">"; - ecomp = ">="; - break; - case "<": - gtfn = lt; - ltefn = gte; - ltfn = gt; - comp = "<"; - ecomp = "<="; - break; - default: - throw new TypeError('Must provide a hilo val of "<" or ">"'); - } - if (satisfies(version3, range2, options)) { - return false; - } - for (let i = 0; i < range2.set.length; ++i) { - const comparators = range2.set[i]; - let high = null; - let low = null; - comparators.forEach((comparator) => { - if (comparator.semver === ANY) { - comparator = new Comparator(">=0.0.0"); - } - high = high || comparator; - low = low || comparator; - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator; - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator; - } - }); - if (high.operator === comp || high.operator === ecomp) { - return false; - } - if ((!low.operator || low.operator === comp) && ltefn(version3, low.semver)) { - return false; - } else if (low.operator === ecomp && ltfn(version3, low.semver)) { - return false; - } - } - return true; - }; - module.exports = outside; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js -var require_gtr = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.js"(exports, module) { - "use strict"; - var outside = require_outside(); - var gtr = (version3, range2, options) => outside(version3, range2, ">", options); - module.exports = gtr; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js -var require_ltr = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.js"(exports, module) { - "use strict"; - var outside = require_outside(); - var ltr = (version3, range2, options) => outside(version3, range2, "<", options); - module.exports = ltr; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.js -var require_intersects = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.js"(exports, module) { - "use strict"; - var Range = require_range(); - var intersects = (r1, r2, options) => { - r1 = new Range(r1, options); - r2 = new Range(r2, options); - return r1.intersects(r2, options); - }; - module.exports = intersects; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.js -var require_simplify = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.js"(exports, module) { - "use strict"; - var satisfies = require_satisfies(); - var compare = require_compare(); - module.exports = (versions, range2, options) => { - const set2 = []; - let first = null; - let prev = null; - const v = versions.sort((a, b) => compare(a, b, options)); - for (const version3 of v) { - const included = satisfies(version3, range2, options); - if (included) { - prev = version3; - if (!first) { - first = version3; - } - } else { - if (prev) { - set2.push([first, prev]); - } - prev = null; - first = null; - } - } - if (first) { - set2.push([first, null]); - } - const ranges = []; - for (const [min, max] of set2) { - if (min === max) { - ranges.push(min); - } else if (!max && min === v[0]) { - ranges.push("*"); - } else if (!max) { - ranges.push(`>=${min}`); - } else if (min === v[0]) { - ranges.push(`<=${max}`); - } else { - ranges.push(`${min} - ${max}`); - } - } - const simplified = ranges.join(" || "); - const original = typeof range2.raw === "string" ? range2.raw : String(range2); - return simplified.length < original.length ? simplified : range2; - }; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.js -var require_subset = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.js"(exports, module) { - "use strict"; - var Range = require_range(); - var Comparator = require_comparator(); - var { ANY } = Comparator; - var satisfies = require_satisfies(); - var compare = require_compare(); - var subset = (sub, dom, options = {}) => { - if (sub === dom) { - return true; - } - sub = new Range(sub, options); - dom = new Range(dom, options); - let sawNonNull = false; - OUTER: for (const simpleSub of sub.set) { - for (const simpleDom of dom.set) { - const isSub = simpleSubset(simpleSub, simpleDom, options); - sawNonNull = sawNonNull || isSub !== null; - if (isSub) { - continue OUTER; - } - } - if (sawNonNull) { - return false; - } - } - return true; - }; - var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")]; - var minimumVersion = [new Comparator(">=0.0.0")]; - var simpleSubset = (sub, dom, options) => { - if (sub === dom) { - return true; - } - if (sub.length === 1 && sub[0].semver === ANY) { - if (dom.length === 1 && dom[0].semver === ANY) { - return true; - } else if (options.includePrerelease) { - sub = minimumVersionWithPreRelease; - } else { - sub = minimumVersion; - } - } - if (dom.length === 1 && dom[0].semver === ANY) { - if (options.includePrerelease) { - return true; - } else { - dom = minimumVersion; - } - } - const eqSet = /* @__PURE__ */ new Set(); - let gt, lt; - for (const c of sub) { - if (c.operator === ">" || c.operator === ">=") { - gt = higherGT(gt, c, options); - } else if (c.operator === "<" || c.operator === "<=") { - lt = lowerLT(lt, c, options); - } else { - eqSet.add(c.semver); - } - } - if (eqSet.size > 1) { - return null; - } - let gtltComp; - if (gt && lt) { - gtltComp = compare(gt.semver, lt.semver, options); - if (gtltComp > 0) { - return null; - } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) { - return null; - } - } - for (const eq of eqSet) { - if (gt && !satisfies(eq, String(gt), options)) { - return null; - } - if (lt && !satisfies(eq, String(lt), options)) { - return null; - } - for (const c of dom) { - if (!satisfies(eq, String(c), options)) { - return false; - } - } - return true; - } - let higher, lower2; - let hasDomLT, hasDomGT; - let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false; - let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false; - if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) { - needDomLTPre = false; - } - for (const c of dom) { - hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">="; - hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<="; - if (gt) { - if (needDomGTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) { - needDomGTPre = false; - } - } - if (c.operator === ">" || c.operator === ">=") { - higher = higherGT(gt, c, options); - if (higher === c && higher !== gt) { - return false; - } - } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) { - return false; - } - } - if (lt) { - if (needDomLTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) { - needDomLTPre = false; - } - } - if (c.operator === "<" || c.operator === "<=") { - lower2 = lowerLT(lt, c, options); - if (lower2 === c && lower2 !== lt) { - return false; - } - } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) { - return false; - } - } - if (!c.operator && (lt || gt) && gtltComp !== 0) { - return false; - } - } - if (gt && hasDomLT && !lt && gtltComp !== 0) { - return false; - } - if (lt && hasDomGT && !gt && gtltComp !== 0) { - return false; - } - if (needDomGTPre || needDomLTPre) { - return false; - } - return true; - }; - var higherGT = (a, b, options) => { - if (!a) { - return b; - } - const comp = compare(a.semver, b.semver, options); - return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a; - }; - var lowerLT = (a, b, options) => { - if (!a) { - return b; - } - const comp = compare(a.semver, b.semver, options); - return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a; - }; - module.exports = subset; - } -}); - -// node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js -var require_semver2 = __commonJS({ - "node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.js"(exports, module) { - "use strict"; - var internalRe = require_re(); - var constants = require_constants11(); - var SemVer = require_semver(); - var identifiers = require_identifiers(); - var parse5 = require_parse3(); - var valid = require_valid(); - var clean = require_clean(); - var inc = require_inc(); - var diff = require_diff(); - var major = require_major(); - var minor = require_minor(); - var patch = require_patch(); - var prerelease = require_prerelease(); - var compare = require_compare(); - var rcompare = require_rcompare(); - var compareLoose = require_compare_loose(); - var compareBuild = require_compare_build(); - var sort = require_sort(); - var rsort = require_rsort(); - var gt = require_gt(); - var lt = require_lt(); - var eq = require_eq(); - var neq = require_neq(); - var gte = require_gte(); - var lte = require_lte(); - var cmp = require_cmp(); - var coerce = require_coerce(); - var Comparator = require_comparator(); - var Range = require_range(); - var satisfies = require_satisfies(); - var toComparators = require_to_comparators(); - var maxSatisfying = require_max_satisfying(); - var minSatisfying = require_min_satisfying(); - var minVersion = require_min_version(); - var validRange = require_valid2(); - var outside = require_outside(); - var gtr = require_gtr(); - var ltr = require_ltr(); - var intersects = require_intersects(); - var simplifyRange = require_simplify(); - var subset = require_subset(); - module.exports = { - parse: parse5, - valid, - clean, - inc, - diff, - major, - minor, - patch, - prerelease, - compare, - rcompare, - compareLoose, - compareBuild, - sort, - rsort, - gt, - lt, - eq, - neq, - gte, - lte, - cmp, - coerce, - Comparator, - Range, - satisfies, - toComparators, - maxSatisfying, - minSatisfying, - minVersion, - validRange, - outside, - gtr, - ltr, - intersects, - simplifyRange, - subset, - SemVer, - re: internalRe.re, - src: internalRe.src, - tokens: internalRe.t, - SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, - RELEASE_TYPES: constants.RELEASE_TYPES, - compareIdentifiers: identifiers.compareIdentifiers, - rcompareIdentifiers: identifiers.rcompareIdentifiers - }; - } -}); - // entry.ts var core6 = __toESM(require_core(), 1); -import { dirname as dirname2 } from "node:path"; +import { dirname as dirname3 } from "node:path"; // main.ts var core5 = __toESM(require_core(), 1); @@ -111657,6 +111657,7 @@ var Octokit2 = Octokit.plugin(requestLog, legacyRestEndpointMethods, paginateRes ); // utils/retry.ts +import { setTimeout as sleep } from "node:timers/promises"; var defaultShouldRetry = (error49) => { if (!(error49 instanceof Error)) return false; return error49.name === "AbortError" || error49.message.includes("fetch failed") || error49.message.includes("ECONNRESET") || error49.message.includes("ETIMEDOUT"); @@ -111677,7 +111678,7 @@ async function retry(fn2, options = {}) { } const delay2 = delayMs * attempt; log.info(`\xBB ${label} failed (attempt ${attempt}/${maxAttempts}), retrying in ${delay2}ms...`); - await new Promise((resolve2) => setTimeout(resolve2, delay2)); + await sleep(delay2); } } throw lastError; @@ -112687,6 +112688,7 @@ configure({ // mcp/server.ts import { createServer } from "node:net"; +import { setTimeout as sleep3 } from "node:timers/promises"; // node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js init_v3(); @@ -144525,14 +144527,10 @@ var pbkdf2Async = promisify(pbkdf2); // external.ts var ghPullfrogMcpName = "gh_pullfrog"; -// mcp/checkout.ts -import { writeFileSync } from "node:fs"; -import { join as join2 } from "node:path"; - -// utils/gitAuth.ts -import { execSync } from "node:child_process"; -import { createHash } from "node:crypto"; -import { readFileSync, realpathSync, unlinkSync } from "node:fs"; +// utils/browser.ts +import { execFileSync, spawnSync } from "node:child_process"; +import { existsSync as existsSync2 } from "node:fs"; +import { dirname as dirname2 } from "node:path"; // utils/token.ts var core3 = __toESM(require_core(), 1); @@ -144694,6 +144692,208 @@ function resolveEnv(mode) { return { ...filterEnv(), ...mode }; } +// utils/version.ts +var import_semver = __toESM(require_semver2(), 1); + +// package.json +var package_default = { + name: "@pullfrog/pullfrog", + version: "0.0.182", + type: "module", + files: [ + "index.js", + "index.cjs", + "index.d.ts", + "index.d.cts", + "agents", + "utils", + "main.js", + "main.d.ts" + ], + scripts: { + test: "vitest", + typecheck: "tsc --noEmit", + build: "node esbuild.config.js", + play: "node play.ts", + runtest: "node test/run.ts", + scratch: "node scratch.ts", + upDeps: "pnpm up --latest", + lock: "pnpm install --no-frozen-lockfile", + postinstall: "node scripts/generate-proxies.ts", + prepare: "cd .. && husky action/.husky" + }, + dependencies: { + "@actions/core": "^1.11.1", + "@ark/fs": "0.56.0", + "@ark/util": "0.56.0", + "@octokit/plugin-throttling": "^11.0.3", + "@octokit/rest": "^22.0.0", + "@octokit/webhooks-types": "^7.6.1", + "@standard-schema/spec": "1.1.0", + "@toon-format/toon": "^1.0.0", + ajv: "^8.18.0", + arkregex: "0.0.5", + arktype: "2.2.0", + dotenv: "^17.2.3", + execa: "^9.6.0", + fastmcp: "^3.34.0", + "file-type": "^21.3.0", + "package-manager-detector": "^1.6.0", + semver: "^7.7.3", + table: "^6.9.0", + turndown: "^7.2.0" + }, + devDependencies: { + "agent-browser": "0.21.0", + "@modelcontextprotocol/sdk": "^1.26.0", + "@types/node": "^24.7.2", + "@types/semver": "^7.7.1", + "@types/turndown": "^5.0.5", + arg: "^5.0.2", + esbuild: "^0.25.9", + husky: "^9.0.0", + "opencode-ai": "1.1.56", + typescript: "^5.9.3", + vitest: "^4.0.17", + yaml: "^2.8.2" + }, + repository: { + type: "git", + url: "git+https://github.com/pullfrog/pullfrog.git" + }, + keywords: [], + author: "", + license: "MIT", + bugs: { + url: "https://github.com/pullfrog/pullfrog/issues" + }, + homepage: "https://github.com/pullfrog/pullfrog#readme", + zshy: { + exports: "./index.ts" + }, + main: "./dist/index.cjs", + module: "./dist/index.js", + types: "./dist/index.d.cts", + exports: { + ".": { + types: "./dist/index.d.cts", + import: "./dist/index.js", + require: "./dist/index.cjs" + }, + "./internal": "./dist/internal.js", + "./package.json": "./package.json" + }, + packageManager: "pnpm@10.27.0+sha512.72d699da16b1179c14ba9e64dc71c9a40988cbdc65c264cb0e489db7de917f20dcf4d64d8723625f2969ba52d4b7e2a1170682d9ac2a5dcaeaab732b7e16f04a" +}; + +// utils/version.ts +function getDevDependencyVersion(name) { + const version3 = package_default.devDependencies[name]; + if (!import_semver.default.valid(version3)) { + throw new Error(`dev dependency "${name}" must be a pinned version, got "${version3}"`); + } + return version3; +} + +// utils/browser.ts +var CHROME_PATHS = ["/usr/bin/google-chrome-stable"]; +var systemChromePath; +function findSystemChromePath() { + if (typeof systemChromePath === "string") { + return systemChromePath || void 0; + } + for (const p of CHROME_PATHS) { + if (existsSync2(p)) { + systemChromePath = p; + log.info(`found system chrome: ${p}`); + return p; + } + } + systemChromePath = ""; + log.info(`no system chrome found (checked: ${CHROME_PATHS.join(", ")})`); +} +function buildEnv() { + const env2 = { ...filterEnv() }; + const chromePath = findSystemChromePath(); + if (chromePath) { + env2.AGENT_BROWSER_EXECUTABLE_PATH = chromePath; + } + return env2; +} +function ensureBrowserDaemon(toolState) { + if (toolState.browserDaemon) { + return toolState.browserDaemon.error; + } + const agentBrowserVersion = getDevDependencyVersion("agent-browser"); + log.info(`installing agent-browser@${agentBrowserVersion}...`); + const install = spawnSync("npm", ["install", "-g", `agent-browser@${agentBrowserVersion}`], { + stdio: "pipe", + encoding: "utf-8" + }); + if (install.status !== 0) { + const error49 = `agent-browser install failed: ${(install.stderr || install.stdout || "unknown error").trim()}`; + log.error(error49); + toolState.browserDaemon = { error: error49 }; + return error49; + } + log.info("agent-browser installed"); + let binDir; + try { + const binPath = execFileSync("which", ["agent-browser"], { encoding: "utf-8" }).trim(); + binDir = dirname2(binPath); + log.info(`agent-browser binary: ${binPath}`); + } catch { + const error49 = "agent-browser binary not found in PATH after install"; + log.error(error49); + toolState.browserDaemon = { error: error49 }; + return error49; + } + const env2 = buildEnv(); + log.info("starting browser daemon..."); + const seed = spawnSync("agent-browser", ["open", "about:blank"], { + env: env2, + stdio: "pipe", + encoding: "utf-8", + timeout: 3e4 + }); + if (seed.status !== 0) { + const output = (seed.stderr || seed.stdout || "unknown error").trim(); + const error49 = `agent-browser open about:blank failed (exit=${seed.status}): ${output}`; + log.error(error49); + toolState.browserDaemon = { error: error49 }; + return error49; + } + log.debug(`seed command done (exit=0): ${(seed.stdout || "").trim()}`); + toolState.browserDaemon = { binDir }; + log.info("browser daemon ready"); +} +function closeBrowserDaemon(toolState) { + if (!toolState.browserDaemon?.binDir) { + delete toolState.browserDaemon; + return; + } + delete toolState.browserDaemon; + try { + log.info("closing browser daemon..."); + spawnSync("agent-browser", ["close"], { + env: filterEnv(), + stdio: "pipe", + timeout: 1e4 + }); + log.info("browser daemon closed"); + } catch { + } +} + +// mcp/checkout.ts +import { writeFileSync } from "node:fs"; +import { join as join2 } from "node:path"; + +// utils/gitAuth.ts +import { execSync } from "node:child_process"; +import { createHash } from "node:crypto"; +import { readFileSync, realpathSync, unlinkSync } from "node:fs"; + // utils/subprocess.ts import { spawn as nodeSpawn } from "node:child_process"; import { performance as performance3 } from "node:perf_hooks"; @@ -145029,11 +145229,11 @@ ${output}` } // utils/shell.ts -import { spawnSync } from "node:child_process"; +import { spawnSync as spawnSync2 } from "node:child_process"; function $(cmd, args2, options) { const encoding = options?.encoding ?? "utf-8"; const env2 = resolveEnv(options?.env); - const result = spawnSync(cmd, args2, { + const result = spawnSync2(cmd, args2, { stdio: ["ignore", "pipe", "pipe"], encoding, cwd: options?.cwd, @@ -145574,7 +145774,7 @@ function CommitInfoTool(ctx) { import { performance as performance4 } from "node:perf_hooks"; // prep/installNodeDependencies.ts -import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs"; +import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs"; import { join as join5 } from "node:path"; // node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/commands.mjs @@ -145928,7 +146128,7 @@ var installNodeDependencies = { name: "installNodeDependencies", shouldRun: () => { const packageJsonPath = join5(process.cwd(), "package.json"); - return existsSync2(packageJsonPath); + return existsSync3(packageJsonPath); }, run: async (options) => { const fromPackageJson = getPackageManagerFromPackageJson(); @@ -146011,7 +146211,7 @@ ${errorMessage}`] }; // prep/installPythonDependencies.ts -import { existsSync as existsSync3 } from "node:fs"; +import { existsSync as existsSync4 } from "node:fs"; import { join as join6 } from "node:path"; var PYTHON_CONFIGS = [ { @@ -146084,11 +146284,11 @@ var installPythonDependencies = { return false; } const cwd = process.cwd(); - return PYTHON_CONFIGS.some((config3) => existsSync3(join6(cwd, config3.file))); + return PYTHON_CONFIGS.some((config3) => existsSync4(join6(cwd, config3.file))); }, run: async (options) => { const cwd = process.cwd(); - const config3 = PYTHON_CONFIGS.find((c) => existsSync3(join6(cwd, c.file))); + const config3 = PYTHON_CONFIGS.find((c) => existsSync4(join6(cwd, c.file))); if (!config3) { return { language: "python", @@ -148043,11 +148243,12 @@ function SelectModeTool(ctx) { } // mcp/shell.ts -import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process"; +import { spawn as spawn2, spawnSync as spawnSync3 } from "node:child_process"; import { randomUUID as randomUUID2 } from "node:crypto"; import { closeSync, openSync, writeFileSync as writeFileSync5 } from "node:fs"; import { userInfo } from "node:os"; import { join as join8 } from "node:path"; +import { setTimeout as sleep2 } from "node:timers/promises"; var ShellParams = type({ command: "string", description: "string", @@ -148066,7 +148267,7 @@ function detectSandboxMethod() { return "none"; } try { - const result = spawnSync2("unshare", ["--pid", "--fork", "--mount-proc", "true"], { + const result = spawnSync3("unshare", ["--pid", "--fork", "--mount-proc", "true"], { timeout: 5e3, stdio: "ignore" }); @@ -148078,7 +148279,7 @@ function detectSandboxMethod() { } catch { } try { - const result = spawnSync2("sudo", ["unshare", "--pid", "--fork", "--mount-proc", "true"], { + const result = spawnSync3("sudo", ["unshare", "--pid", "--fork", "--mount-proc", "true"], { timeout: 5e3, stdio: "ignore" }); @@ -148112,7 +148313,9 @@ function spawnShell(params) { } } const username = userInfo().username; - const escaped = params.command.replace(/'/g, "'\\''"); + const pathRestore = 'export PATH="${SANDBOX_PATH:-$PATH}"; '; + const escaped = (pathRestore + params.command).replace(/'/g, "'\\''"); + envArgs.push(`SANDBOX_PATH=${params.env.PATH ?? ""}`); return spawn2( "sudo", [ @@ -148178,6 +148381,20 @@ Do NOT use this tool for git commands \u2014 use the dedicated git tools instead const timeout = Math.min(params.timeout ?? 3e4, 12e4); const cwd = params.working_directory ?? process.cwd(); const env2 = resolveEnv(ctx.payload.shell === "enabled" ? "inherit" : "restricted"); + if (params.command.includes("agent-browser")) { + const daemonError = ensureBrowserDaemon(ctx.toolState); + if (daemonError) { + return { + output: `browser daemon unavailable: ${daemonError}`, + exit_code: 1, + timed_out: false + }; + } + const binDir = ctx.toolState.browserDaemon?.binDir; + if (binDir) { + env2.PATH = `${binDir}:${env2.PATH ?? ""}`; + } + } if (params.background) { const tempDir = getTempDir(); const handle = `bg-${randomUUID2().slice(0, 8)}`; @@ -148275,7 +148492,7 @@ function KillBackgroundTool(ctx) { process.kill(-proc.pid, "SIGTERM"); } catch { } - await new Promise((resolve2) => setTimeout(resolve2, 200)); + await sleep2(200); try { process.kill(-proc.pid, "SIGKILL"); } catch { @@ -148504,7 +148721,7 @@ async function killBackgroundProcesses(toolState) { } catch { } } - await new Promise((resolve2) => setTimeout(resolve2, 200)); + await sleep3(200); for (const proc of backgroundProcesses.values()) { try { process.kill(-proc.pid, "SIGKILL"); @@ -148519,6 +148736,7 @@ async function startMcpHttpServer(ctx, options) { return { url: startResult.url, [Symbol.asyncDispose]: async () => { + closeBrowserDaemon(ctx.toolState); await killBackgroundProcesses(ctx.toolState); await startResult.server.stop(); } @@ -148831,14 +149049,14 @@ ${permalinkTip}` var modes = computeModes(); // agents/opentoad.ts -import { execFileSync } from "node:child_process"; +import { execFileSync as execFileSync2, spawnSync as spawnSync5 } from "node:child_process"; import { mkdirSync as mkdirSync3 } from "node:fs"; import { join as join10 } from "node:path"; import { performance as performance6 } from "node:perf_hooks"; // utils/install.ts -import { spawnSync as spawnSync3 } from "node:child_process"; -import { chmodSync, createWriteStream, existsSync as existsSync4, mkdirSync as mkdirSync2 } from "node:fs"; +import { spawnSync as spawnSync4 } from "node:child_process"; +import { chmodSync, createWriteStream, existsSync as existsSync5, mkdirSync as mkdirSync2 } from "node:fs"; import { join as join9 } from "node:path"; import { pipeline } from "node:stream/promises"; async function installFromNpmTarball(params) { @@ -148846,7 +149064,7 @@ async function installFromNpmTarball(params) { if (!tempDir) throw new Error("PULLFROG_TEMP_DIR is not set"); const extractedDir = join9(tempDir, "package"); const cliPath = join9(extractedDir, params.executablePath); - if (existsSync4(cliPath)) { + if (existsSync5(cliPath)) { log.debug(`\xBB using cached binary at ${cliPath}`); return cliPath; } @@ -148890,7 +149108,7 @@ async function installFromNpmTarball(params) { await pipeline(response.body, fileStream); log.debug(`\xBB downloaded tarball to ${tarballPath}`); log.debug(`\xBB extracting tarball...`); - const extractResult = spawnSync3("tar", ["-xzf", tarballPath, "-C", tempDir], { + const extractResult = spawnSync4("tar", ["-xzf", tarballPath, "-C", tempDir], { stdio: "pipe", encoding: "utf-8" }); @@ -148899,12 +149117,12 @@ async function installFromNpmTarball(params) { `Failed to extract tarball: ${extractResult.stderr || extractResult.stdout || "Unknown error"}` ); } - if (!existsSync4(cliPath)) { + if (!existsSync5(cliPath)) { throw new Error(`Executable not found in extracted package at ${cliPath}`); } if (params.installDependencies) { log.debug(`\xBB installing dependencies for ${params.packageName}...`); - const installResult = spawnSync3("npm", ["install", "--production"], { + const installResult = spawnSync4("npm", ["install", "--production"], { cwd: extractedDir, stdio: "pipe", encoding: "utf-8" @@ -148979,11 +149197,10 @@ var agent = (input) => { }; // agents/opentoad.ts -var OPENCODE_CLI_VERSION = "1.1.56"; async function installOpencodeCli() { return await installFromNpmTarball({ packageName: "opencode-ai", - version: OPENCODE_CLI_VERSION, + version: getDevDependencyVersion("opencode-ai"), executablePath: "bin/opencode", installDependencies: true }); @@ -148995,7 +149212,8 @@ function buildSecurityConfig(ctx, model) { edit: "allow", read: "allow", webfetch: "allow", - external_directory: "deny" + external_directory: "deny", + skill: "allow" }, mcp: { [ghPullfrogMcpName]: { type: "remote", url: ctx.mcpServerUrl } @@ -149012,7 +149230,7 @@ function buildSecurityConfig(ctx, model) { } function getOpenCodeModels(cliPath) { try { - const output = execFileSync(cliPath, ["models"], { + const output = execFileSync2(cliPath, ["models"], { encoding: "utf-8", timeout: 3e4, env: process.env @@ -149080,6 +149298,22 @@ function detectProviderError(text) { } return null; } +function addSkill(params) { + const result = spawnSync5( + "npx", + ["skills", "add", params.ref, "--skill", params.skill, "-g", "-a", "opencode", "-y"], + { + env: { ...process.env, ...params.env }, + stdio: "pipe", + timeout: 3e4 + } + ); + if (result.status === 0) { + log.info(`installed ${params.skill} skill`); + } else { + log.info(`${params.skill} skill install failed: ${(result.stderr?.toString() || "").trim()}`); + } +} async function runOpenCode(params) { const startTime = performance6.now(); let eventCount = 0; @@ -149381,13 +149615,21 @@ var opentoad = agent({ cliPath, modelSlug: ctx.payload.model }); - const tempHome = ctx.tmpdir; - mkdirSync3(join10(tempHome, ".config", "opencode"), { recursive: true }); + const homeEnv = { + HOME: ctx.tmpdir, + XDG_CONFIG_HOME: join10(ctx.tmpdir, ".config") + }; + mkdirSync3(join10(homeEnv.XDG_CONFIG_HOME, "opencode"), { recursive: true }); + const agentBrowserVersion = getDevDependencyVersion("agent-browser"); + addSkill({ + ref: `vercel-labs/agent-browser@v${agentBrowserVersion}`, + skill: "agent-browser", + env: homeEnv + }); const args2 = ["run", ctx.instructions.full, "--format", "json", "--print-logs"]; const env2 = { ...process.env, - HOME: tempHome, - XDG_CONFIG_HOME: join10(tempHome, ".config"), + ...homeEnv, OPENCODE_CONFIG_CONTENT: buildSecurityConfig(ctx, model), GOOGLE_GENERATIVE_AI_API_KEY: process.env.GOOGLE_GENERATIVE_AI_API_KEY || process.env.GEMINI_API_KEY }; @@ -150043,110 +150285,20 @@ function normalizeEnv() { var core4 = __toESM(require_core(), 1); import { isAbsolute, resolve } from "node:path"; -// package.json -var package_default = { - name: "@pullfrog/pullfrog", - version: "0.0.182", - type: "module", - files: [ - "index.js", - "index.cjs", - "index.d.ts", - "index.d.cts", - "agents", - "utils", - "main.js", - "main.d.ts" - ], - scripts: { - test: "vitest", - typecheck: "tsc --noEmit", - build: "node esbuild.config.js", - play: "node play.ts", - runtest: "node test/run.ts", - scratch: "node scratch.ts", - upDeps: "pnpm up --latest", - lock: "pnpm install --no-frozen-lockfile", - postinstall: "node scripts/generate-proxies.ts", - prepare: "cd .. && husky action/.husky" - }, - dependencies: { - "@actions/core": "^1.11.1", - "@ark/fs": "0.56.0", - "@ark/util": "0.56.0", - "@octokit/plugin-throttling": "^11.0.3", - "@octokit/rest": "^22.0.0", - "@octokit/webhooks-types": "^7.6.1", - "@opencode-ai/sdk": "^1.0.143", - "@standard-schema/spec": "1.1.0", - "@toon-format/toon": "^1.0.0", - ajv: "^8.18.0", - arkregex: "0.0.5", - arktype: "2.2.0", - dotenv: "^17.2.3", - execa: "^9.6.0", - fastmcp: "^3.34.0", - "file-type": "^21.3.0", - "package-manager-detector": "^1.6.0", - semver: "^7.7.3", - table: "^6.9.0", - turndown: "^7.2.0" - }, - devDependencies: { - "@modelcontextprotocol/sdk": "^1.26.0", - "@types/node": "^24.7.2", - "@types/semver": "^7.7.1", - "@types/turndown": "^5.0.5", - arg: "^5.0.2", - esbuild: "^0.25.9", - husky: "^9.0.0", - typescript: "^5.9.3", - vitest: "^4.0.17", - yaml: "^2.8.2" - }, - repository: { - type: "git", - url: "git+https://github.com/pullfrog/pullfrog.git" - }, - keywords: [], - author: "", - license: "MIT", - bugs: { - url: "https://github.com/pullfrog/pullfrog/issues" - }, - homepage: "https://github.com/pullfrog/pullfrog#readme", - zshy: { - exports: "./index.ts" - }, - main: "./dist/index.cjs", - module: "./dist/index.js", - types: "./dist/index.d.cts", - exports: { - ".": { - types: "./dist/index.d.cts", - import: "./dist/index.js", - require: "./dist/index.cjs" - }, - "./internal": "./dist/internal.js", - "./package.json": "./package.json" - }, - packageManager: "pnpm@10.27.0+sha512.72d699da16b1179c14ba9e64dc71c9a40988cbdc65c264cb0e489db7de917f20dcf4d64d8723625f2969ba52d4b7e2a1170682d9ac2a5dcaeaab732b7e16f04a" -}; - // utils/versioning.ts -var import_semver = __toESM(require_semver2(), 1); +var import_semver2 = __toESM(require_semver2(), 1); var COMPATIBILITY_POLICY = "non-breaking"; function validateCompatibility(payloadVersion, actionVersion) { - const payloadSemVer = import_semver.default.parse(payloadVersion); + const payloadSemVer = import_semver2.default.parse(payloadVersion); if (!payloadSemVer) throw new Error(`Payload version ${payloadVersion} is not a valid semantic version.`); const major = payloadSemVer.major; const minor = payloadSemVer.minor; const patch = payloadSemVer.patch; const compatibilityRange = COMPATIBILITY_POLICY === "same-features" ? `^${major}.${minor}.${major === 0 ? patch : 0}` : `^${major}.${major === 0 ? minor : 0}.${major === 0 ? "x" : 0}`; - if (!import_semver.default.satisfies(actionVersion, compatibilityRange)) { + if (!import_semver2.default.satisfies(actionVersion, compatibilityRange)) { throw new Error( - `Payload version ${payloadVersion} is incompatible with action version ${actionVersion}. Please update your workflow to use at least ${import_semver.default.minVersion(compatibilityRange)} version of the action.` + `Payload version ${payloadVersion} is incompatible with action version ${actionVersion}. Please update your workflow to use at least ${import_semver2.default.minVersion(compatibilityRange)} version of the action.` ); } } @@ -150972,7 +151124,7 @@ ${instructions.user}` : null, } // entry.ts -process.env.PATH = `${dirname2(process.execPath)}:${process.env.PATH}`; +process.env.PATH = `${dirname3(process.execPath)}:${process.env.PATH}`; async function run() { try { const result = await main(); diff --git a/get-installation-token/entry b/get-installation-token/entry index dce7502..9a21ba4 100755 --- a/get-installation-token/entry +++ b/get-installation-token/entry @@ -25743,6 +25743,7 @@ async function apiFetch(options) { } // utils/retry.ts +import { setTimeout as sleep } from "node:timers/promises"; var defaultShouldRetry = (error2) => { if (!(error2 instanceof Error)) return false; return error2.name === "AbortError" || error2.message.includes("fetch failed") || error2.message.includes("ECONNRESET") || error2.message.includes("ETIMEDOUT"); @@ -25763,7 +25764,7 @@ async function retry(fn, options = {}) { } const delay = delayMs * attempt; log.info(`\xBB ${label} failed (attempt ${attempt}/${maxAttempts}), retrying in ${delay}ms...`); - await new Promise((resolve) => setTimeout(resolve, delay)); + await sleep(delay); } } throw lastError; diff --git a/mcp/server.ts b/mcp/server.ts index e44486f..11cd5e7 100644 --- a/mcp/server.ts +++ b/mcp/server.ts @@ -1,11 +1,13 @@ // this must be imported first import "./arkConfig.ts"; import { createServer } from "node:net"; +import { setTimeout as sleep } from "node:timers/promises"; import { FastMCP, type Tool } from "fastmcp"; import type { AgentUsage } from "../agents/index.ts"; import { ghPullfrogMcpName } from "../external.ts"; import type { Mode } from "../modes.ts"; import type { PrepResult } from "../prep/index.ts"; +import { closeBrowserDaemon } from "../utils/browser.ts"; import { log } from "../utils/cli.ts"; import type { OctokitWithPlugins } from "../utils/github.ts"; import type { ResolvedPayload } from "../utils/payload.ts"; @@ -51,6 +53,8 @@ export type BackgroundProcess = { pidPath: string; }; +export type BrowserDaemon = { binDir: string; error?: never } | { binDir?: never; error: string }; + export type StoredPushDest = { remoteName: string; remoteBranch: string; @@ -70,6 +74,7 @@ export interface ToolState { checkoutSha?: string; selectedMode?: string; backgroundProcesses: Map; + browserDaemon?: BrowserDaemon | undefined; review?: { id: number; nodeId: string; @@ -319,7 +324,7 @@ async function killBackgroundProcesses(toolState: ToolState): Promise { // already dead } } - await new Promise((resolve) => setTimeout(resolve, 200)); + await sleep(200); for (const proc of backgroundProcesses.values()) { try { process.kill(-proc.pid, "SIGKILL"); @@ -347,6 +352,7 @@ export async function startMcpHttpServer( return { url: startResult.url, [Symbol.asyncDispose]: async () => { + closeBrowserDaemon(ctx.toolState); await killBackgroundProcesses(ctx.toolState); await startResult.server.stop(); }, diff --git a/mcp/shell.ts b/mcp/shell.ts index 1baf605..e31f321 100644 --- a/mcp/shell.ts +++ b/mcp/shell.ts @@ -4,7 +4,9 @@ import { randomUUID } from "node:crypto"; import { closeSync, openSync, writeFileSync } from "node:fs"; import { userInfo } from "node:os"; import { join } from "node:path"; +import { setTimeout as sleep } from "node:timers/promises"; import { type } from "arktype"; +import { ensureBrowserDaemon } from "../utils/browser.ts"; import { log } from "../utils/log.ts"; import { resolveEnv } from "../utils/secrets.ts"; import type { ToolContext } from "./server.ts"; @@ -115,7 +117,12 @@ function spawnShell(params: SpawnParams): ChildProcess { // sudo is only needed for unshare; the actual command should run as the normal user // to avoid ownership mismatches with files created by the Node.js parent process. const username = userInfo().username; - const escaped = params.command.replace(/'/g, "'\\''"); + // su -p resets PATH on many Linux systems (ALWAYS_SET_PATH in /etc/login.defs). + // restore it from the SANDBOX_PATH env var that survives the su transition. + // biome-ignore lint/suspicious/noTemplateCurlyInString: we need to restore the PATH variable + const pathRestore = 'export PATH="${SANDBOX_PATH:-$PATH}"; '; + const escaped = (pathRestore + params.command).replace(/'/g, "'\\''"); + envArgs.push(`SANDBOX_PATH=${params.env.PATH ?? ""}`); return spawn( "sudo", [ @@ -195,6 +202,21 @@ Do NOT use this tool for git commands — use the dedicated git tools instead.`, const cwd = params.working_directory ?? process.cwd(); const env = resolveEnv(ctx.payload.shell === "enabled" ? "inherit" : "restricted"); + if (params.command.includes("agent-browser")) { + const daemonError = ensureBrowserDaemon(ctx.toolState); + if (daemonError) { + return { + output: `browser daemon unavailable: ${daemonError}`, + exit_code: 1, + timed_out: false, + }; + } + const binDir = ctx.toolState.browserDaemon?.binDir; + if (binDir) { + env.PATH = `${binDir}:${env.PATH ?? ""}`; + } + } + if (params.background) { const tempDir = getTempDir(); const handle = `bg-${randomUUID().slice(0, 8)}`; @@ -305,7 +327,7 @@ export function KillBackgroundTool(ctx: ToolContext) { } catch { // already dead } - await new Promise((resolve) => setTimeout(resolve, 200)); + await sleep(200); try { process.kill(-proc.pid, "SIGKILL"); } catch { diff --git a/package.json b/package.json index 9ae400f..72be257 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "@octokit/plugin-throttling": "^11.0.3", "@octokit/rest": "^22.0.0", "@octokit/webhooks-types": "^7.6.1", - "@opencode-ai/sdk": "^1.0.143", "@standard-schema/spec": "1.1.0", "@toon-format/toon": "^1.0.0", "ajv": "^8.18.0", @@ -47,6 +46,7 @@ "turndown": "^7.2.0" }, "devDependencies": { + "agent-browser": "0.21.0", "@modelcontextprotocol/sdk": "^1.26.0", "@types/node": "^24.7.2", "@types/semver": "^7.7.1", @@ -54,6 +54,7 @@ "arg": "^5.0.2", "esbuild": "^0.25.9", "husky": "^9.0.0", + "opencode-ai": "1.1.56", "typescript": "^5.9.3", "vitest": "^4.0.17", "yaml": "^2.8.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d97da9b..8494447 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,9 +26,6 @@ importers: '@octokit/webhooks-types': specifier: ^7.6.1 version: 7.6.1 - '@opencode-ai/sdk': - specifier: ^1.0.143 - version: 1.0.143 '@standard-schema/spec': specifier: 1.1.0 version: 1.1.0 @@ -81,6 +78,9 @@ importers: '@types/turndown': specifier: ^5.0.5 version: 5.0.6 + agent-browser: + specifier: 0.21.0 + version: 0.21.0 arg: specifier: ^5.0.2 version: 5.0.2 @@ -90,12 +90,15 @@ importers: husky: specifier: ^9.0.0 version: 9.1.7 + opencode-ai: + specifier: 1.1.56 + version: 1.1.56 typescript: specifier: ^5.9.3 version: 5.9.3 vitest: specifier: ^4.0.17 - version: 4.0.17(@types/node@24.7.2)(yaml@2.8.2) + version: 4.0.17(@types/node@24.7.2)(jiti@2.6.1)(yaml@2.8.2) yaml: specifier: ^2.8.2 version: 2.8.2 @@ -547,9 +550,6 @@ packages: '@octokit/webhooks-types@7.6.1': resolution: {integrity: sha512-S8u2cJzklBC0FgTwWVLaM8tMrDuDMVE4xiTK4EYXM9GntyvrdbSoxqDQa+Fh57CCNApyIpyeqPhhFEmHPfrXgw==} - '@opencode-ai/sdk@1.0.143': - resolution: {integrity: sha512-dtmkBfJ7IIAHzL6KCzAlwc9GybfJONVeCsF6ePYySpkuhslDbRkZBJYb5vqGd1H5zdsgjc6JjuvmOf0rPWUL6A==} - '@rollup/rollup-android-arm-eabi@4.55.1': resolution: {integrity: sha512-9R0DM/ykwfGIlNu6+2U09ga0WXeZ9MRC2Ter8jnz8415VbuIykVuc6bhdrbORFZANDmTDvq26mJrEVTl8TdnDg==} cpu: [arm] @@ -753,6 +753,10 @@ packages: resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==} engines: {node: '>= 0.6'} + agent-browser@0.21.0: + resolution: {integrity: sha512-isVHEeb2WL5hLhr4o+zNmcYwmBrldxvrH+FIoRoUmDxyrHr3bhIS6L8BlUMHqT77YtkPq0YSmwoBRrwqeouw9Q==} + hasBin: true + ajv-formats@3.0.1: resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} peerDependencies: @@ -1209,6 +1213,10 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + jiti@2.6.1: + resolution: {integrity: sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==} + hasBin: true + jose@6.1.3: resolution: {integrity: sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==} @@ -1316,6 +1324,65 @@ packages: once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + opencode-ai@1.1.56: + resolution: {integrity: sha512-OAF0G/1jVXpOrCh++M5gFEZ0bRLiXOnbxSYMFx5TOoD0OhCjHJS1JlARzaLDAx461qBnn+jocI9BBxD0wwFH3Q==} + hasBin: true + + opencode-darwin-arm64@1.1.56: + resolution: {integrity: sha512-0HqvLm7tcYZr4VJgEzi3Wicia5M9yCX66O7Cv470Qu4+GGbCC2sTTmzQu6pCehSleYgkZsiSBNRcFcW/6F7v0Q==} + cpu: [arm64] + os: [darwin] + + opencode-darwin-x64-baseline@1.1.56: + resolution: {integrity: sha512-Z9QO9cTC9TnlUxTfEtDbvZbRFxc5Je8rs2Ei0cLH46W9gHGhh1fW4oX64tcrlhF5NUDKJzr/qwdoMfmKkeu53A==} + cpu: [x64] + os: [darwin] + + opencode-darwin-x64@1.1.56: + resolution: {integrity: sha512-8ZhNd4sFbDviT1OJs42C35Bx2/z6mkcb7uNhPHX3KKm27KOm7cYjFQa1UTF5or3ZpjkjPQpR/cpo7TELvnnmRA==} + cpu: [x64] + os: [darwin] + + opencode-linux-arm64-musl@1.1.56: + resolution: {integrity: sha512-f30SmYX4xE2fUsnNl66dDX++8iTMI9PLXz7BRHhgXL4XAdMpUUJbOKIsw3ZUB0KWHwjR8cjkEJQOZxR3HPbrZg==} + cpu: [arm64] + os: [linux] + + opencode-linux-arm64@1.1.56: + resolution: {integrity: sha512-wEmIEXiEKghurQYgKY5yFUFOmnT/QIlAbYnVeH73gSqOwlYFUUlowXLDJnF+3OGd6m000qalhCxjExL7qKINWw==} + cpu: [arm64] + os: [linux] + + opencode-linux-x64-baseline-musl@1.1.56: + resolution: {integrity: sha512-EC8EGTJCgTZgGIMZdQjOKGXw02+igo0am1Ry6wrPrB0li7XBlYbY6dz8tL3FlknRVMLamtGtb3tXQ6tqbwjX0g==} + cpu: [x64] + os: [linux] + + opencode-linux-x64-baseline@1.1.56: + resolution: {integrity: sha512-jKOvhkNLcn0h6zmKX+hDdkODijSVDxjAGTZp8BPbJCCJVxnKll9dYfDMTqxi3YN6yXp6sBvyaJT1mcpf8knkeA==} + cpu: [x64] + os: [linux] + + opencode-linux-x64-musl@1.1.56: + resolution: {integrity: sha512-9BFYBPgpY2RrUd7/Ul0VNh+6B9l0FmCNRUV4yYmeFGee9ZDgPem5YGicsKAMQqS/5X0jW3ZWje+KBbBQz4RMwQ==} + cpu: [x64] + os: [linux] + + opencode-linux-x64@1.1.56: + resolution: {integrity: sha512-0FP3BzLjn+a9naTtm9hpHibJ+eV1RkI+tItcDQXKwHtvzoBUvytDRP8v6TotEHNtNF0ZLAb3OGurwDIIdtLarg==} + cpu: [x64] + os: [linux] + + opencode-windows-x64-baseline@1.1.56: + resolution: {integrity: sha512-zEokdohfoDjWzwULvlSq0Y/tRoVmz2/6GofYO936buPQf09cBcPqpAgLUjZV+pQI0Atyd05YG3BCO4PQxmXzdw==} + cpu: [x64] + os: [win32] + + opencode-windows-x64@1.1.56: + resolution: {integrity: sha512-zm/oaWT5uGrW3DumKRHiqv2L2pKwrTvhsT4XUSfIPLQn5EvrYNU6bh3WFO4v71ZBjSIKx5Q7rEvTEQvFiFEZFQ==} + cpu: [x64] + os: [win32] + package-manager-detector@1.6.0: resolution: {integrity: sha512-61A5ThoTiDG/C8s8UMZwSorAGwMJ0ERVGj2OjoW5pAalsNOg15+iQiPzrLJ4jhZ1HJzmC2PIHT2oEiH3R5fzNA==} @@ -2060,8 +2127,6 @@ snapshots: '@octokit/webhooks-types@7.6.1': {} - '@opencode-ai/sdk@1.0.143': {} - '@rollup/rollup-android-arm-eabi@4.55.1': optional: true @@ -2182,13 +2247,13 @@ snapshots: chai: 6.2.2 tinyrainbow: 3.0.3 - '@vitest/mocker@4.0.17(vite@7.3.1(@types/node@24.7.2)(yaml@2.8.2))': + '@vitest/mocker@4.0.17(vite@7.3.1(@types/node@24.7.2)(jiti@2.6.1)(yaml@2.8.2))': dependencies: '@vitest/spy': 4.0.17 estree-walker: 3.0.3 magic-string: 0.30.21 optionalDependencies: - vite: 7.3.1(@types/node@24.7.2)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.7.2)(jiti@2.6.1)(yaml@2.8.2) '@vitest/pretty-format@4.0.17': dependencies: @@ -2222,6 +2287,8 @@ snapshots: mime-types: 3.0.2 negotiator: 1.0.0 + agent-browser@0.21.0: {} + ajv-formats@3.0.1(ajv@8.17.1): optionalDependencies: ajv: 8.17.1 @@ -2752,6 +2819,9 @@ snapshots: isexe@2.0.0: {} + jiti@2.6.1: + optional: true + jose@6.1.3: {} jose@6.2.0: {} @@ -2855,6 +2925,53 @@ snapshots: dependencies: wrappy: 1.0.2 + opencode-ai@1.1.56: + optionalDependencies: + opencode-darwin-arm64: 1.1.56 + opencode-darwin-x64: 1.1.56 + opencode-darwin-x64-baseline: 1.1.56 + opencode-linux-arm64: 1.1.56 + opencode-linux-arm64-musl: 1.1.56 + opencode-linux-x64: 1.1.56 + opencode-linux-x64-baseline: 1.1.56 + opencode-linux-x64-baseline-musl: 1.1.56 + opencode-linux-x64-musl: 1.1.56 + opencode-windows-x64: 1.1.56 + opencode-windows-x64-baseline: 1.1.56 + + opencode-darwin-arm64@1.1.56: + optional: true + + opencode-darwin-x64-baseline@1.1.56: + optional: true + + opencode-darwin-x64@1.1.56: + optional: true + + opencode-linux-arm64-musl@1.1.56: + optional: true + + opencode-linux-arm64@1.1.56: + optional: true + + opencode-linux-x64-baseline-musl@1.1.56: + optional: true + + opencode-linux-x64-baseline@1.1.56: + optional: true + + opencode-linux-x64-musl@1.1.56: + optional: true + + opencode-linux-x64@1.1.56: + optional: true + + opencode-windows-x64-baseline@1.1.56: + optional: true + + opencode-windows-x64@1.1.56: + optional: true + package-manager-detector@1.6.0: {} parse-ms@4.0.0: {} @@ -3159,7 +3276,7 @@ snapshots: vary@1.1.2: {} - vite@7.3.1(@types/node@24.7.2)(yaml@2.8.2): + vite@7.3.1(@types/node@24.7.2)(jiti@2.6.1)(yaml@2.8.2): dependencies: esbuild: 0.27.2 fdir: 6.5.0(picomatch@4.0.3) @@ -3170,12 +3287,13 @@ snapshots: optionalDependencies: '@types/node': 24.7.2 fsevents: 2.3.3 + jiti: 2.6.1 yaml: 2.8.2 - vitest@4.0.17(@types/node@24.7.2)(yaml@2.8.2): + vitest@4.0.17(@types/node@24.7.2)(jiti@2.6.1)(yaml@2.8.2): dependencies: '@vitest/expect': 4.0.17 - '@vitest/mocker': 4.0.17(vite@7.3.1(@types/node@24.7.2)(yaml@2.8.2)) + '@vitest/mocker': 4.0.17(vite@7.3.1(@types/node@24.7.2)(jiti@2.6.1)(yaml@2.8.2)) '@vitest/pretty-format': 4.0.17 '@vitest/runner': 4.0.17 '@vitest/snapshot': 4.0.17 @@ -3192,7 +3310,7 @@ snapshots: tinyexec: 1.0.2 tinyglobby: 0.2.15 tinyrainbow: 3.0.3 - vite: 7.3.1(@types/node@24.7.2)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.7.2)(jiti@2.6.1)(yaml@2.8.2) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 24.7.2 diff --git a/post b/post index 6934957..38ea4a9 100755 --- a/post +++ b/post @@ -41587,7 +41587,6 @@ var package_default = { "@octokit/plugin-throttling": "^11.0.3", "@octokit/rest": "^22.0.0", "@octokit/webhooks-types": "^7.6.1", - "@opencode-ai/sdk": "^1.0.143", "@standard-schema/spec": "1.1.0", "@toon-format/toon": "^1.0.0", ajv: "^8.18.0", @@ -41603,6 +41602,7 @@ var package_default = { turndown: "^7.2.0" }, devDependencies: { + "agent-browser": "0.21.0", "@modelcontextprotocol/sdk": "^1.26.0", "@types/node": "^24.7.2", "@types/semver": "^7.7.1", @@ -41610,6 +41610,7 @@ var package_default = { arg: "^5.0.2", esbuild: "^0.25.9", husky: "^9.0.0", + "opencode-ai": "1.1.56", typescript: "^5.9.3", vitest: "^4.0.17", yaml: "^2.8.2" diff --git a/utils/browser.ts b/utils/browser.ts new file mode 100644 index 0000000..6b4a680 --- /dev/null +++ b/utils/browser.ts @@ -0,0 +1,133 @@ +import { execFileSync, spawnSync } from "node:child_process"; +import { existsSync } from "node:fs"; +import { dirname } from "node:path"; +import type { ToolState } from "../mcp/server.ts"; +import { log } from "./cli.ts"; +import { filterEnv } from "./secrets.ts"; +import { getDevDependencyVersion } from "./version.ts"; + +// agent-browser already discovers chrome via `which` and the playwright cache as fallbacks, +// so this list only needs to cover the GHA ubuntu-latest runner where we know the exact path. +const CHROME_PATHS = ["/usr/bin/google-chrome-stable"]; + +let systemChromePath: string | undefined; + +function findSystemChromePath(): string | undefined { + if (typeof systemChromePath === "string") { + // return cached result but normalize to undefined if empty + return systemChromePath || undefined; + } + for (const p of CHROME_PATHS) { + if (existsSync(p)) { + systemChromePath = p; + log.info(`found system chrome: ${p}`); + return p; + } + } + // set to an empty string to indicate no system chrome found + // and to avoid repeated lookups + systemChromePath = ""; + log.info(`no system chrome found (checked: ${CHROME_PATHS.join(", ")})`); +} + +function buildEnv(): Record { + const env: Record = { ...filterEnv() }; + const chromePath = findSystemChromePath(); + if (chromePath) { + env.AGENT_BROWSER_EXECUTABLE_PATH = chromePath; + } + return env; +} + +/** + * ensure the agent-browser daemon is running by issuing a real command. + * + * agent-browser is stateful — it manages a persistent browser process via a + * daemon that communicates over a Unix socket. we start the daemon here, + * outside of ShellTool, because ShellTool's child process lifecycle would + * kill it between invocations and the daemon must survive across calls. + * + * despite ShellTool commands running inside unshare-sandboxed namespaces, + * they can still reach this daemon because the Unix socket is discoverable + * regardless of unshare's PID/mount isolation. starting the daemon in the + * host namespace keeps it alive while sandboxed shells come and go. + * + * agent-browser auto-starts its daemon on the first CLI invocation and + * keeps it alive via the socket for subsequent commands. + * we run `open about:blank` as the seed command to trigger this. + * idempotent — only runs once. + */ +export function ensureBrowserDaemon(toolState: ToolState): string | undefined { + if (toolState.browserDaemon) { + return toolState.browserDaemon.error; + } + + const agentBrowserVersion = getDevDependencyVersion("agent-browser"); + log.info(`installing agent-browser@${agentBrowserVersion}...`); + const install = spawnSync("npm", ["install", "-g", `agent-browser@${agentBrowserVersion}`], { + stdio: "pipe", + encoding: "utf-8", + }); + if (install.status !== 0) { + const error = `agent-browser install failed: ${(install.stderr || install.stdout || "unknown error").trim()}`; + log.error(error); + toolState.browserDaemon = { error }; + return error; + } + log.info("agent-browser installed"); + + let binDir: string; + try { + const binPath = execFileSync("which", ["agent-browser"], { encoding: "utf-8" }).trim(); + binDir = dirname(binPath); + log.info(`agent-browser binary: ${binPath}`); + } catch { + const error = "agent-browser binary not found in PATH after install"; + log.error(error); + toolState.browserDaemon = { error }; + return error; + } + + const env = buildEnv(); + + // `open about:blank` triggers daemon auto-start and returns once the daemon + browser are ready + log.info("starting browser daemon..."); + const seed = spawnSync("agent-browser", ["open", "about:blank"], { + env, + stdio: "pipe", + encoding: "utf-8", + timeout: 30_000, + }); + + if (seed.status !== 0) { + const output = (seed.stderr || seed.stdout || "unknown error").trim(); + const error = `agent-browser open about:blank failed (exit=${seed.status}): ${output}`; + log.error(error); + toolState.browserDaemon = { error }; + return error; + } + log.debug(`seed command done (exit=0): ${(seed.stdout || "").trim()}`); + + toolState.browserDaemon = { binDir }; + log.info("browser daemon ready"); +} + +export function closeBrowserDaemon(toolState: ToolState): void { + if (!toolState.browserDaemon?.binDir) { + delete toolState.browserDaemon; + return; + } + delete toolState.browserDaemon; + + try { + log.info("closing browser daemon..."); + spawnSync("agent-browser", ["close"], { + env: filterEnv(), + stdio: "pipe", + timeout: 10_000, + }); + log.info("browser daemon closed"); + } catch { + // best-effort + } +} diff --git a/utils/install.ts b/utils/install.ts index 5bc20ae..19fb676 100644 --- a/utils/install.ts +++ b/utils/install.ts @@ -4,6 +4,7 @@ import { mkdtemp } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { pipeline } from "node:stream/promises"; +import { setTimeout as sleep } from "node:timers/promises"; import { log } from "./cli.ts"; export interface InstallFromNpmTarballParams { @@ -172,7 +173,7 @@ async function fetchWithRetry( const waitSeconds = parseInt(retryAfter, 10); if (!Number.isNaN(waitSeconds) && waitSeconds > 0) { log.info(`» rate limited, waiting ${waitSeconds} seconds before retry...`); - await new Promise((resolve) => setTimeout(resolve, waitSeconds * 1000)); + await sleep(waitSeconds * 1000); const retryResponse = await fetch(url, { headers }); if (!retryResponse.ok) { throw new Error( diff --git a/utils/retry.ts b/utils/retry.ts index fa64d69..9284144 100644 --- a/utils/retry.ts +++ b/utils/retry.ts @@ -1,3 +1,4 @@ +import { setTimeout as sleep } from "node:timers/promises"; import { log } from "./cli.ts"; export type RetryOptions = { @@ -38,7 +39,7 @@ export async function retry(fn: () => Promise, options: RetryOptions = {}) const delay = delayMs * attempt; log.info(`» ${label} failed (attempt ${attempt}/${maxAttempts}), retrying in ${delay}ms...`); - await new Promise((resolve) => setTimeout(resolve, delay)); + await sleep(delay); } } diff --git a/utils/version.ts b/utils/version.ts new file mode 100644 index 0000000..e65880e --- /dev/null +++ b/utils/version.ts @@ -0,0 +1,10 @@ +import semver from "semver"; +import packageJson from "../package.json" with { type: "json" }; + +export function getDevDependencyVersion(name: keyof typeof packageJson.devDependencies): string { + const version = packageJson.devDependencies[name]; + if (!semver.valid(version)) { + throw new Error(`dev dependency "${name}" must be a pinned version, got "${version}"`); + } + return version; +}