@drewpayment/mink 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dashboard/out/404.html +1 -1
  2. package/dashboard/out/action-log.html +1 -1
  3. package/dashboard/out/action-log.txt +1 -1
  4. package/dashboard/out/activity.html +1 -1
  5. package/dashboard/out/activity.txt +1 -1
  6. package/dashboard/out/bugs.html +1 -1
  7. package/dashboard/out/bugs.txt +1 -1
  8. package/dashboard/out/capture.html +1 -1
  9. package/dashboard/out/capture.txt +1 -1
  10. package/dashboard/out/config.html +1 -1
  11. package/dashboard/out/config.txt +1 -1
  12. package/dashboard/out/daemon.html +1 -1
  13. package/dashboard/out/daemon.txt +1 -1
  14. package/dashboard/out/design.html +1 -1
  15. package/dashboard/out/design.txt +1 -1
  16. package/dashboard/out/discord.html +1 -1
  17. package/dashboard/out/discord.txt +1 -1
  18. package/dashboard/out/file-index.html +1 -1
  19. package/dashboard/out/file-index.txt +1 -1
  20. package/dashboard/out/index.html +1 -1
  21. package/dashboard/out/index.txt +1 -1
  22. package/dashboard/out/insights.html +1 -1
  23. package/dashboard/out/insights.txt +1 -1
  24. package/dashboard/out/learning.html +1 -1
  25. package/dashboard/out/learning.txt +1 -1
  26. package/dashboard/out/overview.html +1 -1
  27. package/dashboard/out/overview.txt +1 -1
  28. package/dashboard/out/scheduler.html +1 -1
  29. package/dashboard/out/scheduler.txt +1 -1
  30. package/dashboard/out/sync.html +1 -1
  31. package/dashboard/out/sync.txt +1 -1
  32. package/dashboard/out/tokens.html +1 -1
  33. package/dashboard/out/tokens.txt +1 -1
  34. package/dashboard/out/waste.html +1 -1
  35. package/dashboard/out/waste.txt +1 -1
  36. package/dashboard/out/wiki.html +1 -1
  37. package/dashboard/out/wiki.txt +1 -1
  38. package/dist/cli.js +888 -425
  39. package/package.json +1 -1
  40. package/src/cli.ts +8 -1
  41. package/src/commands/upgrade.ts +128 -0
  42. package/src/core/self-update.ts +363 -0
  43. package/src/core/task-registry.ts +52 -2
  44. package/src/types/config.ts +24 -0
  45. /package/dashboard/out/_next/static/{r7Xr9mrUpunsz4QtD3jh1 → frTrvF6NV-Xl2bLk21NkY}/_buildManifest.js +0 -0
  46. /package/dashboard/out/_next/static/{r7Xr9mrUpunsz4QtD3jh1 → frTrvF6NV-Xl2bLk21NkY}/_ssgManifest.js +0 -0
package/dist/cli.js CHANGED
@@ -797,6 +797,27 @@ var init_config = __esm(() => {
797
797
  envVar: "MINK_CHANNEL_SKIP_PERMISSIONS",
798
798
  description: "Pass --dangerously-skip-permissions so the channel can run without terminal prompts",
799
799
  scope: "shared"
800
+ },
801
+ {
802
+ key: "cli.auto-update",
803
+ default: "false",
804
+ envVar: "MINK_CLI_AUTO_UPDATE",
805
+ description: "Auto-upgrade the mink CLI on schedule via the background scheduler",
806
+ scope: "shared"
807
+ },
808
+ {
809
+ key: "cli.auto-update-schedule",
810
+ default: "0 4 * * *",
811
+ envVar: "MINK_CLI_AUTO_UPDATE_SCHEDULE",
812
+ description: "Cron expression governing the cli-self-update scheduled task",
813
+ scope: "shared"
814
+ },
815
+ {
816
+ key: "cli.auto-update-package-manager",
817
+ default: "auto",
818
+ envVar: "MINK_CLI_AUTO_UPDATE_PACKAGE_MANAGER",
819
+ description: "Force a package manager (auto|npm|bun) for self-upgrade installs",
820
+ scope: "local"
800
821
  }
801
822
  ];
802
823
  VALID_KEYS = new Set(CONFIG_KEYS.map((k) => k.key));
@@ -5709,12 +5730,304 @@ var init_detect_waste2 = __esm(() => {
5709
5730
  init_device();
5710
5731
  });
5711
5732
 
5733
+ // src/core/self-update.ts
5734
+ var exports_self_update = {};
5735
+ __export(exports_self_update, {
5736
+ selfUpdateLogPath: () => selfUpdateLogPath,
5737
+ runSelfUpgrade: () => runSelfUpgrade,
5738
+ parseSemver: () => parseSemver,
5739
+ getInstallInfo: () => getInstallInfo,
5740
+ detectPackageManager: () => detectPackageManager,
5741
+ compareSemver: () => compareSemver,
5742
+ PACKAGE_NAME: () => PACKAGE_NAME
5743
+ });
5744
+ import { spawnSync as spawnSync2 } from "child_process";
5745
+ import { existsSync as existsSync19, readFileSync as readFileSync18 } from "fs";
5746
+ import { dirname as dirname9 } from "path";
5747
+ import { join as join20 } from "path";
5748
+ function parseSemver(input) {
5749
+ const trimmed = input.trim().replace(/^v/, "");
5750
+ if (!trimmed)
5751
+ return null;
5752
+ const [versionPart, ...prereleaseParts] = trimmed.split("-");
5753
+ const numbers = versionPart.split(".").map((s) => Number.parseInt(s, 10));
5754
+ if (numbers.some((n) => Number.isNaN(n)))
5755
+ return null;
5756
+ return {
5757
+ numbers,
5758
+ prerelease: prereleaseParts.length ? prereleaseParts.join("-") : null
5759
+ };
5760
+ }
5761
+ function compareSemver(a, b) {
5762
+ const pa = parseSemver(a);
5763
+ const pb = parseSemver(b);
5764
+ if (!pa && !pb)
5765
+ return 0;
5766
+ if (!pa)
5767
+ return -1;
5768
+ if (!pb)
5769
+ return 1;
5770
+ const len = Math.max(pa.numbers.length, pb.numbers.length);
5771
+ for (let i = 0;i < len; i++) {
5772
+ const ai = pa.numbers[i] ?? 0;
5773
+ const bi = pb.numbers[i] ?? 0;
5774
+ if (ai > bi)
5775
+ return 1;
5776
+ if (ai < bi)
5777
+ return -1;
5778
+ }
5779
+ if (pa.prerelease === pb.prerelease)
5780
+ return 0;
5781
+ if (pa.prerelease === null)
5782
+ return 1;
5783
+ if (pb.prerelease === null)
5784
+ return -1;
5785
+ if (pa.prerelease > pb.prerelease)
5786
+ return 1;
5787
+ if (pa.prerelease < pb.prerelease)
5788
+ return -1;
5789
+ return 0;
5790
+ }
5791
+ function getInstallInfo() {
5792
+ const selfPath = new URL(import.meta.url).pathname;
5793
+ const isDevMode = selfPath.endsWith(".ts");
5794
+ let dir = dirname9(selfPath);
5795
+ let packageJsonPath = null;
5796
+ for (let i = 0;i < 10; i++) {
5797
+ const candidate = join20(dir, "package.json");
5798
+ if (existsSync19(candidate)) {
5799
+ packageJsonPath = candidate;
5800
+ break;
5801
+ }
5802
+ const parent = dirname9(dir);
5803
+ if (parent === dir)
5804
+ break;
5805
+ dir = parent;
5806
+ }
5807
+ if (!packageJsonPath) {
5808
+ throw new Error("Unable to locate package.json for the running mink CLI");
5809
+ }
5810
+ let currentVersion = "0.0.0";
5811
+ try {
5812
+ const pkg = JSON.parse(readFileSync18(packageJsonPath, "utf-8"));
5813
+ if (typeof pkg.version === "string")
5814
+ currentVersion = pkg.version;
5815
+ } catch {}
5816
+ return {
5817
+ cliPath: selfPath,
5818
+ packageJsonPath,
5819
+ currentVersion,
5820
+ isDevMode
5821
+ };
5822
+ }
5823
+ async function fetchLatestVersion(url, currentVersion) {
5824
+ const controller = new AbortController;
5825
+ const timer = setTimeout(() => controller.abort(), NETWORK_TIMEOUT_MS);
5826
+ try {
5827
+ const res = await fetch(url, {
5828
+ signal: controller.signal,
5829
+ headers: {
5830
+ "User-Agent": `mink-self-update/${currentVersion}`,
5831
+ Accept: "application/json"
5832
+ }
5833
+ });
5834
+ if (!res.ok) {
5835
+ throw new Error(`registry returned ${res.status}`);
5836
+ }
5837
+ const body = await res.json();
5838
+ if (typeof body.version !== "string") {
5839
+ throw new Error("registry response missing version field");
5840
+ }
5841
+ return body.version;
5842
+ } finally {
5843
+ clearTimeout(timer);
5844
+ }
5845
+ }
5846
+ function isOnPath(bin) {
5847
+ const result = spawnSync2(bin, ["--version"], { stdio: "ignore" });
5848
+ return !result.error && result.status === 0;
5849
+ }
5850
+ function detectPackageManager(cliPath) {
5851
+ const configured = resolveConfigValue("cli.auto-update-package-manager").value;
5852
+ if (configured === "bun" && isOnPath("bun"))
5853
+ return "bun";
5854
+ if (configured === "npm" && isOnPath("npm"))
5855
+ return "npm";
5856
+ const looksLikeBun = /[\\/]\.bun[\\/]/.test(cliPath);
5857
+ if (looksLikeBun && isOnPath("bun"))
5858
+ return "bun";
5859
+ if (isOnPath("npm"))
5860
+ return "npm";
5861
+ if (isOnPath("bun"))
5862
+ return "bun";
5863
+ return null;
5864
+ }
5865
+ function buildInstallCommand(pm, version) {
5866
+ const ref = `${PACKAGE_NAME}@${version}`;
5867
+ if (pm === "bun")
5868
+ return ["bun", "add", "-g", ref];
5869
+ return ["npm", "install", "-g", ref];
5870
+ }
5871
+ function selfUpdateLogPath() {
5872
+ return join20(minkRoot(), "self-update.log");
5873
+ }
5874
+ function appendLogEntry(entry) {
5875
+ const path = selfUpdateLogPath();
5876
+ const line = JSON.stringify({ timestamp: new Date().toISOString(), ...entry }) + `
5877
+ `;
5878
+ try {
5879
+ safeAppendText(path, line);
5880
+ rotateLogIfNeeded(path);
5881
+ } catch {}
5882
+ }
5883
+ function rotateLogIfNeeded(path) {
5884
+ try {
5885
+ const content = readFileSync18(path, "utf-8");
5886
+ const lines = content.split(`
5887
+ `);
5888
+ if (lines.length <= LOG_MAX_LINES + 1)
5889
+ return;
5890
+ const trimmed = lines.slice(lines.length - LOG_MAX_LINES - 1).join(`
5891
+ `);
5892
+ atomicWriteText(path, trimmed);
5893
+ } catch {}
5894
+ }
5895
+ async function runSelfUpgrade(opts) {
5896
+ const result = await runSelfUpgradeInner(opts);
5897
+ appendLogEntry({ source: opts.source, ...result });
5898
+ return result;
5899
+ }
5900
+ async function runSelfUpgradeInner(opts) {
5901
+ if (process.env.MINK_DISABLE_AUTO_UPDATE === "1" && opts.source === "scheduler") {
5902
+ return { status: "skipped", reason: "MINK_DISABLE_AUTO_UPDATE=1" };
5903
+ }
5904
+ if (opts.source === "scheduler") {
5905
+ const enabled = resolveConfigValue("cli.auto-update").value;
5906
+ if (enabled !== "true") {
5907
+ return { status: "skipped", reason: "cli.auto-update is disabled" };
5908
+ }
5909
+ }
5910
+ let info;
5911
+ try {
5912
+ info = getInstallInfo();
5913
+ } catch (err) {
5914
+ return {
5915
+ status: "error",
5916
+ reason: err instanceof Error ? err.message : String(err),
5917
+ transient: false
5918
+ };
5919
+ }
5920
+ if (info.isDevMode) {
5921
+ return {
5922
+ status: "skipped",
5923
+ reason: "running from source tree; refuse to self-upgrade in dev mode"
5924
+ };
5925
+ }
5926
+ let latest;
5927
+ try {
5928
+ latest = await fetchLatestVersion(opts.registryUrlOverride ?? NPM_REGISTRY_URL, info.currentVersion);
5929
+ } catch (err) {
5930
+ return {
5931
+ status: "error",
5932
+ reason: "failed to fetch latest version: " + (err instanceof Error ? err.message : String(err)),
5933
+ transient: true
5934
+ };
5935
+ }
5936
+ const cmp = compareSemver(latest, info.currentVersion);
5937
+ if (cmp <= 0 && !opts.force) {
5938
+ return { status: "up-to-date", current: info.currentVersion, latest };
5939
+ }
5940
+ const pm = detectPackageManager(info.cliPath);
5941
+ if (!pm) {
5942
+ return {
5943
+ status: "error",
5944
+ reason: "no package manager (npm or bun) available on PATH",
5945
+ transient: false
5946
+ };
5947
+ }
5948
+ const cmd = buildInstallCommand(pm, latest);
5949
+ if (opts.checkOnly) {
5950
+ return {
5951
+ status: "update-available",
5952
+ current: info.currentVersion,
5953
+ latest,
5954
+ packageManager: pm
5955
+ };
5956
+ }
5957
+ if (opts.dryRun) {
5958
+ return {
5959
+ status: "would-upgrade",
5960
+ current: info.currentVersion,
5961
+ latest,
5962
+ packageManager: pm,
5963
+ command: cmd.join(" ")
5964
+ };
5965
+ }
5966
+ const stdio = opts.interactive ? "inherit" : "pipe";
5967
+ const spawned = spawnSync2(cmd[0], cmd.slice(1), {
5968
+ stdio,
5969
+ timeout: INSTALL_TIMEOUT_MS
5970
+ });
5971
+ if (spawned.error) {
5972
+ return {
5973
+ status: "error",
5974
+ reason: `install command failed to spawn: ${spawned.error.message}`,
5975
+ transient: true
5976
+ };
5977
+ }
5978
+ if (spawned.status !== 0) {
5979
+ const stderr = spawned.stderr ? spawned.stderr.toString().trim() : "";
5980
+ return {
5981
+ status: "error",
5982
+ reason: `${cmd.join(" ")} exited with code ${spawned.status}${stderr ? ": " + stderr.slice(0, 500) : ""}`,
5983
+ transient: true
5984
+ };
5985
+ }
5986
+ let verifiedVersion = latest;
5987
+ try {
5988
+ const pkg = JSON.parse(readFileSync18(info.packageJsonPath, "utf-8"));
5989
+ if (typeof pkg.version === "string")
5990
+ verifiedVersion = pkg.version;
5991
+ } catch {}
5992
+ return {
5993
+ status: "upgraded",
5994
+ from: info.currentVersion,
5995
+ to: verifiedVersion,
5996
+ packageManager: pm
5997
+ };
5998
+ }
5999
+ var PACKAGE_NAME = "@drewpayment/mink", NPM_REGISTRY_URL, NETWORK_TIMEOUT_MS = 5000, INSTALL_TIMEOUT_MS, LOG_MAX_LINES = 1000;
6000
+ var init_self_update = __esm(() => {
6001
+ init_global_config();
6002
+ init_paths();
6003
+ init_fs_utils();
6004
+ NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
6005
+ INSTALL_TIMEOUT_MS = 10 * 60000;
6006
+ });
6007
+
5712
6008
  // src/core/task-registry.ts
6009
+ function resolveTaskSchedule(taskId, defaultSchedule) {
6010
+ if (taskId !== "cli-self-update")
6011
+ return defaultSchedule;
6012
+ try {
6013
+ const value = resolveConfigValue("cli.auto-update-schedule").value;
6014
+ parseCronExpression(value);
6015
+ return value;
6016
+ } catch {
6017
+ return defaultSchedule;
6018
+ }
6019
+ }
6020
+ function applyDynamicOverrides(task) {
6021
+ if (task.id !== "cli-self-update")
6022
+ return task;
6023
+ return { ...task, schedule: resolveTaskSchedule(task.id, task.schedule) };
6024
+ }
5713
6025
  function getBuiltInTasks() {
5714
- return BUILT_IN_TASKS;
6026
+ return BUILT_IN_TASKS.map(applyDynamicOverrides);
5715
6027
  }
5716
6028
  function getTaskById(id) {
5717
- return BUILT_IN_TASKS.find((t) => t.id === id);
6029
+ const task = BUILT_IN_TASKS.find((t) => t.id === id);
6030
+ return task ? applyDynamicOverrides(task) : undefined;
5718
6031
  }
5719
6032
  async function executeAiCli(prompt, timeoutMs) {
5720
6033
  const env = {};
@@ -5778,10 +6091,10 @@ async function executeTask(taskId, projectCwd) {
5778
6091
  if (task.actionType === "ai-cli") {
5779
6092
  try {
5780
6093
  const { learningMemoryPath: learningMemoryPath5 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
5781
- const { readFileSync: readFileSync18 } = await import("fs");
6094
+ const { readFileSync: readFileSync19 } = await import("fs");
5782
6095
  let memoryContent;
5783
6096
  try {
5784
- memoryContent = readFileSync18(learningMemoryPath5(projectCwd), "utf-8");
6097
+ memoryContent = readFileSync19(learningMemoryPath5(projectCwd), "utf-8");
5785
6098
  } catch {
5786
6099
  console.log("[mink] no learning memory found, skipping reflection");
5787
6100
  return;
@@ -5803,12 +6116,29 @@ ${memoryContent}`;
5803
6116
  console.log("[mink] project-suggestions: not yet implemented — skipping");
5804
6117
  break;
5805
6118
  }
6119
+ case "cli-self-update": {
6120
+ const { runSelfUpgrade: runSelfUpgrade2 } = await Promise.resolve().then(() => (init_self_update(), exports_self_update));
6121
+ const result = await runSelfUpgrade2({
6122
+ source: "scheduler",
6123
+ interactive: false
6124
+ });
6125
+ if (result.status === "error") {
6126
+ const err = new Error(result.reason);
6127
+ if (!result.transient) {
6128
+ err.message = `[non-transient] ${err.message}`;
6129
+ }
6130
+ throw err;
6131
+ }
6132
+ console.log(`[mink] cli-self-update: ${result.status}`);
6133
+ break;
6134
+ }
5806
6135
  default:
5807
6136
  throw new Error(`No executor defined for task: ${taskId}`);
5808
6137
  }
5809
6138
  }
5810
6139
  var BUILT_IN_TASKS, API_KEY_ENV_VARS;
5811
6140
  var init_task_registry = __esm(() => {
6141
+ init_global_config();
5812
6142
  BUILT_IN_TASKS = [
5813
6143
  {
5814
6144
  id: "file-index-rescan",
@@ -5859,6 +6189,16 @@ var init_task_registry = __esm(() => {
5859
6189
  enabled: true,
5860
6190
  retryPolicy: { maxAttempts: 3, baseDelayMs: 60000 },
5861
6191
  timeoutMs: 300000
6192
+ },
6193
+ {
6194
+ id: "cli-self-update",
6195
+ name: "CLI Self-Update",
6196
+ description: "Check npm for a newer mink release and install it (gated by cli.auto-update)",
6197
+ schedule: "0 4 * * *",
6198
+ actionType: "function",
6199
+ enabled: true,
6200
+ retryPolicy: { maxAttempts: 3, baseDelayMs: 60000 },
6201
+ timeoutMs: 10 * 60000
5862
6202
  }
5863
6203
  ];
5864
6204
  API_KEY_ENV_VARS = [
@@ -6318,22 +6658,22 @@ var init_cron = __esm(() => {
6318
6658
  });
6319
6659
 
6320
6660
  // src/core/vault-templates.ts
6321
- import { join as join20 } from "path";
6322
- import { existsSync as existsSync19, writeFileSync as writeFileSync9, readFileSync as readFileSync18, mkdirSync as mkdirSync11 } from "fs";
6661
+ import { join as join21 } from "path";
6662
+ import { existsSync as existsSync20, writeFileSync as writeFileSync9, readFileSync as readFileSync19, mkdirSync as mkdirSync11 } from "fs";
6323
6663
  function seedTemplates(templatesDir) {
6324
6664
  mkdirSync11(templatesDir, { recursive: true });
6325
6665
  for (const [name, content] of Object.entries(DEFAULT_TEMPLATES)) {
6326
- const filePath = join20(templatesDir, `${name}.md`);
6327
- if (!existsSync19(filePath)) {
6666
+ const filePath = join21(templatesDir, `${name}.md`);
6667
+ if (!existsSync20(filePath)) {
6328
6668
  writeFileSync9(filePath, content);
6329
6669
  }
6330
6670
  }
6331
6671
  }
6332
6672
  function loadTemplate(templatesDir, templateName, vars) {
6333
- const filePath = join20(templatesDir, `${templateName}.md`);
6673
+ const filePath = join21(templatesDir, `${templateName}.md`);
6334
6674
  let content;
6335
- if (existsSync19(filePath)) {
6336
- content = readFileSync18(filePath, "utf-8");
6675
+ if (existsSync20(filePath)) {
6676
+ content = readFileSync19(filePath, "utf-8");
6337
6677
  } else if (DEFAULT_TEMPLATES[templateName]) {
6338
6678
  content = DEFAULT_TEMPLATES[templateName];
6339
6679
  } else {
@@ -6486,33 +6826,33 @@ category: resources
6486
6826
  });
6487
6827
 
6488
6828
  // src/core/note-writer.ts
6489
- import { join as join21 } from "path";
6490
- import { existsSync as existsSync20, readFileSync as readFileSync19 } from "fs";
6829
+ import { join as join22 } from "path";
6830
+ import { existsSync as existsSync21, readFileSync as readFileSync20 } from "fs";
6491
6831
  import { createHash as createHash2 } from "crypto";
6492
6832
  function sha256(content) {
6493
6833
  return createHash2("sha256").update(content).digest("hex");
6494
6834
  }
6495
6835
  function resolveUniqueNotePath(dir, baseSlug, content) {
6496
6836
  const targetHash = sha256(content);
6497
- const primary = join21(dir, `${baseSlug}.md`);
6498
- if (!existsSync20(primary))
6837
+ const primary = join22(dir, `${baseSlug}.md`);
6838
+ if (!existsSync21(primary))
6499
6839
  return primary;
6500
6840
  if (sameContent(primary, targetHash))
6501
6841
  return primary;
6502
6842
  const dev4 = getOrCreateDeviceId().replace(/-/g, "").slice(0, 4);
6503
6843
  for (let i = 0;i < MAX_COLLISION_ATTEMPTS; i++) {
6504
6844
  const suffix = i === 0 ? dev4 : `${dev4}-${i + 1}`;
6505
- const candidate = join21(dir, `${baseSlug}-${suffix}.md`);
6506
- if (!existsSync20(candidate))
6845
+ const candidate = join22(dir, `${baseSlug}-${suffix}.md`);
6846
+ if (!existsSync21(candidate))
6507
6847
  return candidate;
6508
6848
  if (sameContent(candidate, targetHash))
6509
6849
  return candidate;
6510
6850
  }
6511
- return join21(dir, `${baseSlug}-${Date.now()}.md`);
6851
+ return join22(dir, `${baseSlug}-${Date.now()}.md`);
6512
6852
  }
6513
6853
  function sameContent(filePath, expectedHash) {
6514
6854
  try {
6515
- return sha256(readFileSync19(filePath, "utf-8")) === expectedHash;
6855
+ return sha256(readFileSync20(filePath, "utf-8")) === expectedHash;
6516
6856
  } catch {
6517
6857
  return false;
6518
6858
  }
@@ -6583,8 +6923,8 @@ ${meta.body}
6583
6923
  }
6584
6924
  function appendToDaily(date, content) {
6585
6925
  const dir = vaultDailyDir();
6586
- const filePath = join21(dir, `${date}.md`);
6587
- if (existsSync20(filePath)) {
6926
+ const filePath = join22(dir, `${date}.md`);
6927
+ if (existsSync21(filePath)) {
6588
6928
  const timestamp = new Date().toLocaleTimeString("en-US", {
6589
6929
  hour: "2-digit",
6590
6930
  minute: "2-digit",
@@ -6621,7 +6961,7 @@ ${content}
6621
6961
  return filePath;
6622
6962
  }
6623
6963
  function ingestFile(sourcePath, meta) {
6624
- const raw = readFileSync19(sourcePath, "utf-8");
6964
+ const raw = readFileSync20(sourcePath, "utf-8");
6625
6965
  const now = new Date().toISOString();
6626
6966
  const headingMatch = raw.match(/^#\s+(.+)$/m);
6627
6967
  const title = headingMatch?.[1] ?? sourcePath.split("/").pop().replace(/\.md$/, "");
@@ -6693,9 +7033,9 @@ var init_design_eval = __esm(() => {
6693
7033
  });
6694
7034
 
6695
7035
  // src/core/dashboard-api.ts
6696
- import { existsSync as existsSync21, readFileSync as readFileSync20 } from "fs";
7036
+ import { existsSync as existsSync22, readFileSync as readFileSync21 } from "fs";
6697
7037
  import { readdirSync as readdirSync7, readFileSync as readFileSyncFS, existsSync as fsExistsSync } from "fs";
6698
- import { join as join22, resolve as resolve4, normalize, sep } from "path";
7038
+ import { join as join23, resolve as resolve5, normalize, sep } from "path";
6699
7039
  import { execSync as execSync5 } from "child_process";
6700
7040
  function isSecretKey(key) {
6701
7041
  return SECRET_KEY_PATTERNS.some((re) => re.test(key));
@@ -6708,7 +7048,7 @@ function maskSecret(value, showLast = 4) {
6708
7048
  return "••••" + value.slice(-showLast);
6709
7049
  }
6710
7050
  function checkJsonFile2(name, filePath, validator) {
6711
- if (!existsSync21(filePath))
7051
+ if (!existsSync22(filePath))
6712
7052
  return { name, status: "missing" };
6713
7053
  const data = safeReadJson(filePath);
6714
7054
  if (data === null)
@@ -6718,10 +7058,10 @@ function checkJsonFile2(name, filePath, validator) {
6718
7058
  return { name, status: "ok" };
6719
7059
  }
6720
7060
  function checkTextFile2(name, filePath) {
6721
- if (!existsSync21(filePath))
7061
+ if (!existsSync22(filePath))
6722
7062
  return { name, status: "missing" };
6723
7063
  try {
6724
- readFileSync20(filePath, "utf-8");
7064
+ readFileSync21(filePath, "utf-8");
6725
7065
  return { name, status: "ok" };
6726
7066
  } catch {
6727
7067
  return { name, status: "corrupt" };
@@ -6977,7 +7317,7 @@ function countMarkdownIn(dir) {
6977
7317
  for (const entry of readdirSync7(dir, { withFileTypes: true })) {
6978
7318
  if (WIKI_TREE_EXCLUDES.has(entry.name) || entry.name.startsWith("."))
6979
7319
  continue;
6980
- const fullPath = join22(dir, entry.name);
7320
+ const fullPath = join23(dir, entry.name);
6981
7321
  if (entry.isDirectory()) {
6982
7322
  count += countMarkdownIn(fullPath);
6983
7323
  } else if (entry.name.endsWith(".md") && !entry.name.startsWith("_")) {
@@ -7006,7 +7346,7 @@ function buildVaultTree(root) {
7006
7346
  for (const entry of entries) {
7007
7347
  if (!entry.isDir)
7008
7348
  continue;
7009
- const fullPath = join22(dir, entry.name);
7349
+ const fullPath = join23(dir, entry.name);
7010
7350
  const relPath = fullPath.slice(root.length + 1);
7011
7351
  const count = countMarkdownIn(fullPath);
7012
7352
  nodes.push({ name: entry.name, path: relPath, count, depth });
@@ -7091,7 +7431,7 @@ function resolveVaultRelativePath(relPath) {
7091
7431
  if (!relPath || relPath.includes("\x00"))
7092
7432
  return null;
7093
7433
  const root = resolveVaultPath();
7094
- const absolute = resolve4(root, relPath);
7434
+ const absolute = resolve5(root, relPath);
7095
7435
  const normalizedRoot = normalize(root) + sep;
7096
7436
  if (!absolute.startsWith(normalizedRoot) && absolute !== normalize(root)) {
7097
7437
  return null;
@@ -7429,7 +7769,7 @@ async function triggerIngestFile(sourcePath, category, tags, dedupKey) {
7429
7769
  if (!isValidCategory(category)) {
7430
7770
  return { success: false, error: `Invalid category: ${category}` };
7431
7771
  }
7432
- const expanded = sourcePath.startsWith("~/") ? join22(process.env.HOME ?? "", sourcePath.slice(2)) : sourcePath;
7772
+ const expanded = sourcePath.startsWith("~/") ? join23(process.env.HOME ?? "", sourcePath.slice(2)) : sourcePath;
7433
7773
  if (!fsExistsSync(expanded)) {
7434
7774
  return { success: false, error: `Source file not found: ${sourcePath}` };
7435
7775
  }
@@ -7509,10 +7849,10 @@ var init_dashboard_api = __esm(() => {
7509
7849
  });
7510
7850
 
7511
7851
  // src/core/project-registry.ts
7512
- import { readdirSync as readdirSync8, existsSync as existsSync22 } from "fs";
7513
- import { join as join23 } from "path";
7852
+ import { readdirSync as readdirSync8, existsSync as existsSync23 } from "fs";
7853
+ import { join as join24 } from "path";
7514
7854
  function getProjectMeta(projDir) {
7515
- const metaPath = join23(projDir, "project-meta.json");
7855
+ const metaPath = join24(projDir, "project-meta.json");
7516
7856
  const raw = safeReadJson(metaPath);
7517
7857
  if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
7518
7858
  return null;
@@ -7529,15 +7869,15 @@ function getProjectMeta(projDir) {
7529
7869
  };
7530
7870
  }
7531
7871
  function listRegisteredProjects() {
7532
- const projectsDir = join23(minkRoot(), "projects");
7533
- if (!existsSync22(projectsDir))
7872
+ const projectsDir = join24(minkRoot(), "projects");
7873
+ if (!existsSync23(projectsDir))
7534
7874
  return [];
7535
7875
  const entries = readdirSync8(projectsDir, { withFileTypes: true });
7536
7876
  const projects = [];
7537
7877
  for (const entry of entries) {
7538
7878
  if (!entry.isDirectory())
7539
7879
  continue;
7540
- const projDir = join23(projectsDir, entry.name);
7880
+ const projDir = join24(projectsDir, entry.name);
7541
7881
  const meta = getProjectMeta(projDir);
7542
7882
  if (meta) {
7543
7883
  projects.push({
@@ -7561,8 +7901,8 @@ __export(exports_dashboard_server, {
7561
7901
  startDashboardServer: () => startDashboardServer
7562
7902
  });
7563
7903
  import { watch } from "fs";
7564
- import { existsSync as existsSync23 } from "fs";
7565
- import { basename as basename7, dirname as dirname9, join as join24, extname as extname2 } from "path";
7904
+ import { existsSync as existsSync24 } from "fs";
7905
+ import { basename as basename7, dirname as dirname10, join as join25, extname as extname2 } from "path";
7566
7906
 
7567
7907
  class SSEManager {
7568
7908
  clients = new Map;
@@ -7735,15 +8075,15 @@ async function startDashboardServer(cwd, options = {}) {
7735
8075
  timestamp: new Date().toISOString()
7736
8076
  });
7737
8077
  });
7738
- const __dir = dirname9(new URL(import.meta.url).pathname);
8078
+ const __dir = dirname10(new URL(import.meta.url).pathname);
7739
8079
  let pkgRoot = __dir;
7740
- while (pkgRoot !== dirname9(pkgRoot)) {
7741
- if (existsSync23(join24(pkgRoot, "package.json")))
8080
+ while (pkgRoot !== dirname10(pkgRoot)) {
8081
+ if (existsSync24(join25(pkgRoot, "package.json")))
7742
8082
  break;
7743
- pkgRoot = dirname9(pkgRoot);
8083
+ pkgRoot = dirname10(pkgRoot);
7744
8084
  }
7745
- const dashboardOutDir = join24(pkgRoot, "dashboard", "out");
7746
- const dashboardBuilt = existsSync23(join24(dashboardOutDir, "index.html"));
8085
+ const dashboardOutDir = join25(pkgRoot, "dashboard", "out");
8086
+ const dashboardBuilt = existsSync24(join25(dashboardOutDir, "index.html"));
7747
8087
  let clientIdCounter = 0;
7748
8088
  if (!dashboardBuilt) {
7749
8089
  console.warn("[mink] dashboard not built. Run: cd dashboard && bun run build");
@@ -7773,9 +8113,9 @@ async function startDashboardServer(cwd, options = {}) {
7773
8113
  } else {
7774
8114
  let filePath;
7775
8115
  if (pathname === "/") {
7776
- filePath = join24(dashboardOutDir, "index.html");
8116
+ filePath = join25(dashboardOutDir, "index.html");
7777
8117
  } else {
7778
- filePath = join24(dashboardOutDir, pathname);
8118
+ filePath = join25(dashboardOutDir, pathname);
7779
8119
  }
7780
8120
  if (!filePath.startsWith(dashboardOutDir)) {
7781
8121
  return jsonResponse({ error: "Forbidden" }, 403);
@@ -7788,7 +8128,7 @@ async function startDashboardServer(cwd, options = {}) {
7788
8128
  const htmlServed = await serveFile(filePath + ".html", "text/html; charset=utf-8");
7789
8129
  if (htmlServed)
7790
8130
  return htmlServed;
7791
- const indexServed = await serveFile(join24(dashboardOutDir, "index.html"), "text/html; charset=utf-8");
8131
+ const indexServed = await serveFile(join25(dashboardOutDir, "index.html"), "text/html; charset=utf-8");
7792
8132
  if (indexServed)
7793
8133
  return indexServed;
7794
8134
  }
@@ -7897,7 +8237,7 @@ retry: 3000
7897
8237
  if (!filename || filename.includes("..") || filename.includes("/")) {
7898
8238
  return jsonResponse({ error: "Invalid filename" }, 400);
7899
8239
  }
7900
- const imgPath = join24(designCapturesDir(resolvedCwd), filename);
8240
+ const imgPath = join25(designCapturesDir(resolvedCwd), filename);
7901
8241
  const served = await serveFile(imgPath, "image/jpeg");
7902
8242
  if (served) {
7903
8243
  served.headers.set("Cache-Control", "public, max-age=60");
@@ -8131,9 +8471,9 @@ var exports_dashboard = {};
8131
8471
  __export(exports_dashboard, {
8132
8472
  dashboard: () => dashboard
8133
8473
  });
8134
- import { existsSync as existsSync24 } from "fs";
8474
+ import { existsSync as existsSync25 } from "fs";
8135
8475
  async function dashboard(cwd, args) {
8136
- if (!existsSync24(projectDir(cwd))) {
8476
+ if (!existsSync25(projectDir(cwd))) {
8137
8477
  console.error("[mink] project not initialized. Run: mink init");
8138
8478
  process.exit(1);
8139
8479
  }
@@ -8151,19 +8491,19 @@ var init_dashboard = __esm(() => {
8151
8491
  });
8152
8492
 
8153
8493
  // src/commands/init.ts
8154
- import { mkdirSync as mkdirSync12, existsSync as existsSync25 } from "fs";
8155
- import { resolve as resolve5, dirname as dirname10, basename as basename8, join as join25 } from "path";
8494
+ import { mkdirSync as mkdirSync12, existsSync as existsSync26 } from "fs";
8495
+ import { resolve as resolve6, dirname as dirname11, basename as basename8, join as join26 } from "path";
8156
8496
  function resolveCliPath2() {
8157
8497
  const selfPath = new URL(import.meta.url).pathname;
8158
- const selfDir = dirname10(selfPath);
8498
+ const selfDir = dirname11(selfPath);
8159
8499
  if (selfPath.endsWith("dist/cli.js")) {
8160
8500
  return selfPath;
8161
8501
  }
8162
- const projectRoot = resolve5(selfDir, "../..");
8163
- const distPath = join25(projectRoot, "dist", "cli.js");
8164
- if (existsSync25(distPath))
8502
+ const projectRoot = resolve6(selfDir, "../..");
8503
+ const distPath = join26(projectRoot, "dist", "cli.js");
8504
+ if (existsSync26(distPath))
8165
8505
  return distPath;
8166
- return resolve5(selfDir, "../cli.ts");
8506
+ return resolve6(selfDir, "../cli.ts");
8167
8507
  }
8168
8508
  function buildHooksConfig2(cliPath) {
8169
8509
  const isTsSource = cliPath.endsWith(".ts");
@@ -8202,7 +8542,7 @@ function isMinkHook2(entry) {
8202
8542
  return false;
8203
8543
  }
8204
8544
  function mergeHooksIntoSettings2(settingsPath, newHooks) {
8205
- mkdirSync12(dirname10(settingsPath), { recursive: true });
8545
+ mkdirSync12(dirname11(settingsPath), { recursive: true });
8206
8546
  const existing = safeReadJson(settingsPath) ?? {};
8207
8547
  const existingHooks = existing.hooks ?? {};
8208
8548
  for (const [event, entries] of Object.entries(newHooks)) {
@@ -8222,9 +8562,9 @@ var init_init2 = __esm(() => {
8222
8562
 
8223
8563
  // src/core/daemon-service.ts
8224
8564
  import { execSync as execSync6 } from "child_process";
8225
- import { existsSync as existsSync26, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "fs";
8565
+ import { existsSync as existsSync27, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "fs";
8226
8566
  import { homedir as homedir4 } from "os";
8227
- import { dirname as dirname11, join as join26 } from "path";
8567
+ import { dirname as dirname12, join as join27 } from "path";
8228
8568
  function detectPlatform() {
8229
8569
  if (process.platform === "linux")
8230
8570
  return "systemd";
@@ -8234,11 +8574,11 @@ function detectPlatform() {
8234
8574
  }
8235
8575
  function resolveServiceInvocation() {
8236
8576
  const entry = process.argv[1];
8237
- if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) && existsSync26(entry)) {
8577
+ if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) && existsSync27(entry)) {
8238
8578
  return {
8239
8579
  executable: entry,
8240
8580
  args: ["daemon", "start"],
8241
- pathDir: dirname11(entry)
8581
+ pathDir: dirname12(entry)
8242
8582
  };
8243
8583
  }
8244
8584
  const cliPath = resolveCliPath2();
@@ -8246,17 +8586,17 @@ function resolveServiceInvocation() {
8246
8586
  return {
8247
8587
  executable: interpreter,
8248
8588
  args: [cliPath, "daemon", "start"],
8249
- pathDir: dirname11(interpreter)
8589
+ pathDir: dirname12(interpreter)
8250
8590
  };
8251
8591
  }
8252
8592
  function servicePaths(platform2) {
8253
8593
  const home = homedir4();
8254
8594
  if (platform2 === "systemd") {
8255
- const unitDir2 = join26(home, ".config", "systemd", "user");
8256
- return { unitDir: unitDir2, unitFile: join26(unitDir2, "mink-daemon.service") };
8595
+ const unitDir2 = join27(home, ".config", "systemd", "user");
8596
+ return { unitDir: unitDir2, unitFile: join27(unitDir2, "mink-daemon.service") };
8257
8597
  }
8258
- const unitDir = join26(home, "Library", "LaunchAgents");
8259
- return { unitDir, unitFile: join26(unitDir, "com.mink.daemon.plist") };
8598
+ const unitDir = join27(home, "Library", "LaunchAgents");
8599
+ return { unitDir, unitFile: join27(unitDir, "com.mink.daemon.plist") };
8260
8600
  }
8261
8601
  function renderSystemdUnit(inv) {
8262
8602
  const execStart = [inv.executable, ...inv.args].join(" ");
@@ -8330,7 +8670,7 @@ function installService(options = {}) {
8330
8670
  process.exit(1);
8331
8671
  }
8332
8672
  const paths = servicePaths(platform2);
8333
- if (existsSync26(paths.unitFile) && !options.force) {
8673
+ if (existsSync27(paths.unitFile) && !options.force) {
8334
8674
  console.error(`[mink] unit file already exists: ${paths.unitFile}`);
8335
8675
  console.error(" re-run with --force to overwrite, or run `mink daemon uninstall` first");
8336
8676
  process.exit(1);
@@ -8363,7 +8703,7 @@ function uninstallService() {
8363
8703
  process.exit(1);
8364
8704
  }
8365
8705
  const paths = servicePaths(platform2);
8366
- if (!existsSync26(paths.unitFile)) {
8706
+ if (!existsSync27(paths.unitFile)) {
8367
8707
  console.log(`[mink] no unit file at ${paths.unitFile} — nothing to uninstall`);
8368
8708
  return;
8369
8709
  }
@@ -8395,7 +8735,7 @@ var exports_daemon = {};
8395
8735
  __export(exports_daemon, {
8396
8736
  daemon: () => daemon
8397
8737
  });
8398
- import { readFileSync as readFileSync21, existsSync as existsSync27 } from "fs";
8738
+ import { readFileSync as readFileSync22, existsSync as existsSync28 } from "fs";
8399
8739
  async function daemon(cwd, args) {
8400
8740
  const subcommand = args[0];
8401
8741
  switch (subcommand) {
@@ -8411,12 +8751,12 @@ async function daemon(cwd, args) {
8411
8751
  break;
8412
8752
  case "logs": {
8413
8753
  const logPath = schedulerLogPath();
8414
- if (!existsSync27(logPath)) {
8754
+ if (!existsSync28(logPath)) {
8415
8755
  console.log("[mink] no log file found");
8416
8756
  return;
8417
8757
  }
8418
8758
  try {
8419
- const content = readFileSync21(logPath, "utf-8");
8759
+ const content = readFileSync22(logPath, "utf-8");
8420
8760
  const lines = content.split(`
8421
8761
  `);
8422
8762
  const tail = lines.slice(-50).join(`
@@ -8683,13 +9023,13 @@ function printValidKeys() {
8683
9023
  }
8684
9024
  }
8685
9025
  function readLineFromStdin() {
8686
- return new Promise((resolve7) => {
9026
+ return new Promise((resolve8) => {
8687
9027
  const chunks = [];
8688
9028
  process.stdin.resume();
8689
9029
  process.stdin.setEncoding("utf-8");
8690
9030
  process.stdin.once("data", (data) => {
8691
9031
  process.stdin.pause();
8692
- resolve7(String(data).trim());
9032
+ resolve8(String(data).trim());
8693
9033
  });
8694
9034
  });
8695
9035
  }
@@ -8764,7 +9104,7 @@ var exports_update = {};
8764
9104
  __export(exports_update, {
8765
9105
  update: () => update
8766
9106
  });
8767
- import { resolve as resolve7 } from "path";
9107
+ import { resolve as resolve8 } from "path";
8768
9108
  function parseArgs(args) {
8769
9109
  let dryRun = false;
8770
9110
  let project = null;
@@ -8822,7 +9162,7 @@ async function update(cwd, args) {
8822
9162
  }
8823
9163
  const backupName = createBackup(target.cwd);
8824
9164
  console.log(` backup: ${backupName}`);
8825
- const settingsPath = resolve7(target.cwd, ".claude", "settings.json");
9165
+ const settingsPath = resolve8(target.cwd, ".claude", "settings.json");
8826
9166
  mergeHooksIntoSettings2(settingsPath, newHooks);
8827
9167
  console.log(" hooks: updated");
8828
9168
  const metaPath = projectMetaPath(target.cwd);
@@ -8847,6 +9187,123 @@ var init_update = __esm(() => {
8847
9187
  init_init2();
8848
9188
  });
8849
9189
 
9190
+ // src/commands/upgrade.ts
9191
+ var exports_upgrade = {};
9192
+ __export(exports_upgrade, {
9193
+ upgrade: () => upgrade
9194
+ });
9195
+ function parseArgs2(args) {
9196
+ const out = {
9197
+ check: false,
9198
+ dryRun: false,
9199
+ force: false,
9200
+ yes: false,
9201
+ help: false
9202
+ };
9203
+ for (const arg of args) {
9204
+ switch (arg) {
9205
+ case "--check":
9206
+ out.check = true;
9207
+ break;
9208
+ case "--dry-run":
9209
+ out.dryRun = true;
9210
+ break;
9211
+ case "--force":
9212
+ out.force = true;
9213
+ break;
9214
+ case "--yes":
9215
+ case "-y":
9216
+ out.yes = true;
9217
+ break;
9218
+ case "--help":
9219
+ case "-h":
9220
+ out.help = true;
9221
+ break;
9222
+ }
9223
+ }
9224
+ return out;
9225
+ }
9226
+ function printHelp() {
9227
+ console.log("Usage: mink upgrade [options]");
9228
+ console.log("");
9229
+ console.log("Check the npm registry for a newer mink release and install it.");
9230
+ console.log(`Tracks the 'latest' dist-tag of ${PACKAGE_NAME}.`);
9231
+ console.log("");
9232
+ console.log("Options:");
9233
+ console.log(" --check Report whether an upgrade is available; do not install");
9234
+ console.log(" --dry-run Resolve everything but do not run the install command");
9235
+ console.log(" --force Install the latest version even if it is not strictly newer");
9236
+ console.log(" --yes, -y Skip the interactive confirmation prompt");
9237
+ console.log(" --help, -h Show this help");
9238
+ console.log("");
9239
+ console.log("Auto-update on a schedule:");
9240
+ console.log(" mink config set cli.auto-update true");
9241
+ console.log(' mink config set cli.auto-update-schedule "0 4 * * *"');
9242
+ }
9243
+ function describeResult(r) {
9244
+ switch (r.status) {
9245
+ case "up-to-date":
9246
+ return `Already up-to-date — ${r.current} matches latest.`;
9247
+ case "update-available":
9248
+ return `Update available: ${r.current} → ${r.latest}` + (r.packageManager ? ` (would install via ${r.packageManager})` : "");
9249
+ case "would-upgrade":
9250
+ return `Would upgrade: ${r.current} → ${r.latest}
9251
+ command: ${r.command}`;
9252
+ case "upgraded":
9253
+ return `Upgraded ${r.from} → ${r.to} (via ${r.packageManager}).`;
9254
+ case "skipped":
9255
+ return `Skipped: ${r.reason}`;
9256
+ case "error":
9257
+ return `Error: ${r.reason}`;
9258
+ }
9259
+ }
9260
+ async function confirm(prompt) {
9261
+ if (!process.stdin.isTTY)
9262
+ return false;
9263
+ process.stdout.write(prompt);
9264
+ return new Promise((resolveConfirm) => {
9265
+ process.stdin.setEncoding("utf-8");
9266
+ process.stdin.once("data", (chunk) => {
9267
+ const answer = String(chunk).trim().toLowerCase();
9268
+ resolveConfirm(answer === "y" || answer === "yes");
9269
+ });
9270
+ });
9271
+ }
9272
+ async function upgrade(_cwd, args) {
9273
+ const parsed = parseArgs2(args);
9274
+ if (parsed.help) {
9275
+ printHelp();
9276
+ return;
9277
+ }
9278
+ const isCheckLike = parsed.check || parsed.dryRun;
9279
+ if (!isCheckLike && !parsed.yes && process.stdin.isTTY) {
9280
+ const probe = await runSelfUpgrade({ source: "manual", checkOnly: true, force: parsed.force });
9281
+ console.log(describeResult(probe));
9282
+ if (probe.status !== "update-available" && !parsed.force) {
9283
+ return;
9284
+ }
9285
+ const ok = await confirm("Proceed with install? [y/N] ");
9286
+ if (!ok) {
9287
+ console.log("Aborted.");
9288
+ return;
9289
+ }
9290
+ }
9291
+ const result = await runSelfUpgrade({
9292
+ source: "manual",
9293
+ checkOnly: parsed.check,
9294
+ dryRun: parsed.dryRun,
9295
+ force: parsed.force,
9296
+ interactive: true
9297
+ });
9298
+ console.log(describeResult(result));
9299
+ if (result.status === "error") {
9300
+ process.exit(1);
9301
+ }
9302
+ }
9303
+ var init_upgrade = __esm(() => {
9304
+ init_self_update();
9305
+ });
9306
+
8850
9307
  // src/commands/restore.ts
8851
9308
  var exports_restore = {};
8852
9309
  __export(exports_restore, {
@@ -8880,8 +9337,8 @@ var init_restore = __esm(() => {
8880
9337
  });
8881
9338
 
8882
9339
  // src/core/design-eval/server-detect.ts
8883
- import { readFileSync as readFileSync22 } from "fs";
8884
- import { join as join27 } from "path";
9340
+ import { readFileSync as readFileSync23 } from "fs";
9341
+ import { join as join28 } from "path";
8885
9342
  async function probePort(port) {
8886
9343
  try {
8887
9344
  const controller = new AbortController;
@@ -8903,7 +9360,7 @@ async function findRunningServer(ports = DEFAULT_PROBE_PORTS) {
8903
9360
  }
8904
9361
  function detectDevCommand(cwd) {
8905
9362
  try {
8906
- const raw = readFileSync22(join27(cwd, "package.json"), "utf-8");
9363
+ const raw = readFileSync23(join28(cwd, "package.json"), "utf-8");
8907
9364
  const pkg = JSON.parse(raw);
8908
9365
  const scripts = pkg.scripts;
8909
9366
  if (!scripts || typeof scripts !== "object")
@@ -8923,10 +9380,10 @@ var init_server_detect = __esm(() => {
8923
9380
  });
8924
9381
 
8925
9382
  // src/core/design-eval/route-detect.ts
8926
- import { existsSync as existsSync28, readdirSync as readdirSync9, statSync as statSync11 } from "fs";
8927
- import { join as join28, relative as relative6, sep as sep2 } from "path";
9383
+ import { existsSync as existsSync29, readdirSync as readdirSync9, statSync as statSync11 } from "fs";
9384
+ import { join as join29, relative as relative6, sep as sep2 } from "path";
8928
9385
  function detectFramework(cwd) {
8929
- const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync28(join28(cwd, `${name}.${ext}`))) || existsSync28(join28(cwd, name));
9386
+ const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync29(join29(cwd, `${name}.${ext}`))) || existsSync29(join29(cwd, name));
8930
9387
  if (has("next.config"))
8931
9388
  return "nextjs";
8932
9389
  if (has("svelte.config"))
@@ -8951,8 +9408,8 @@ function detectRoutes(cwd) {
8951
9408
  }
8952
9409
  function detectNextRoutes(cwd) {
8953
9410
  const routes = [];
8954
- const appDir = join28(cwd, "app");
8955
- if (existsSync28(appDir)) {
9411
+ const appDir = join29(cwd, "app");
9412
+ if (existsSync29(appDir)) {
8956
9413
  const pageFiles = findFiles(appDir, /^page\.(tsx?|jsx?)$/);
8957
9414
  for (const file of pageFiles) {
8958
9415
  const rel = relative6(appDir, file);
@@ -8963,8 +9420,8 @@ function detectNextRoutes(cwd) {
8963
9420
  routes.push(route);
8964
9421
  }
8965
9422
  }
8966
- const pagesDir = join28(cwd, "pages");
8967
- if (existsSync28(pagesDir)) {
9423
+ const pagesDir = join29(cwd, "pages");
9424
+ if (existsSync29(pagesDir)) {
8968
9425
  const pageFiles = findFiles(pagesDir, /\.(tsx?|jsx?)$/);
8969
9426
  for (const file of pageFiles) {
8970
9427
  const rel = relative6(pagesDir, file);
@@ -8983,8 +9440,8 @@ function detectNextRoutes(cwd) {
8983
9440
  return unique.length > 0 ? unique.sort() : ["/"];
8984
9441
  }
8985
9442
  function detectSvelteKitRoutes(cwd) {
8986
- const routesDir = join28(cwd, "src", "routes");
8987
- if (!existsSync28(routesDir))
9443
+ const routesDir = join29(cwd, "src", "routes");
9444
+ if (!existsSync29(routesDir))
8988
9445
  return ["/"];
8989
9446
  const routes = [];
8990
9447
  const pageFiles = findFiles(routesDir, /^\+page\.svelte$/);
@@ -8999,8 +9456,8 @@ function detectSvelteKitRoutes(cwd) {
8999
9456
  return routes.length > 0 ? routes.sort() : ["/"];
9000
9457
  }
9001
9458
  function detectNuxtRoutes(cwd) {
9002
- const pagesDir = join28(cwd, "pages");
9003
- if (!existsSync28(pagesDir))
9459
+ const pagesDir = join29(cwd, "pages");
9460
+ if (!existsSync29(pagesDir))
9004
9461
  return ["/"];
9005
9462
  const routes = [];
9006
9463
  const vueFiles = findFiles(pagesDir, /\.vue$/);
@@ -9026,7 +9483,7 @@ function findFiles(dir, pattern) {
9026
9483
  for (const entry of entries) {
9027
9484
  if (entry.startsWith(".") || entry === "node_modules")
9028
9485
  continue;
9029
- const full = join28(current, entry);
9486
+ const full = join29(current, entry);
9030
9487
  try {
9031
9488
  const stat2 = statSync11(full);
9032
9489
  if (stat2.isDirectory()) {
@@ -9054,11 +9511,11 @@ function __extends(d, b) {
9054
9511
  }
9055
9512
  function __awaiter(thisArg, _arguments, P, generator) {
9056
9513
  function adopt(value) {
9057
- return value instanceof P ? value : new P(function(resolve8) {
9058
- resolve8(value);
9514
+ return value instanceof P ? value : new P(function(resolve9) {
9515
+ resolve9(value);
9059
9516
  });
9060
9517
  }
9061
- return new (P || (P = Promise))(function(resolve8, reject) {
9518
+ return new (P || (P = Promise))(function(resolve9, reject) {
9062
9519
  function fulfilled(value) {
9063
9520
  try {
9064
9521
  step(generator.next(value));
@@ -9074,7 +9531,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
9074
9531
  }
9075
9532
  }
9076
9533
  function step(result) {
9077
- result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
9534
+ result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
9078
9535
  }
9079
9536
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9080
9537
  });
@@ -9257,14 +9714,14 @@ function __asyncValues(o) {
9257
9714
  }, i);
9258
9715
  function verb(n) {
9259
9716
  i[n] = o[n] && function(v) {
9260
- return new Promise(function(resolve8, reject) {
9261
- v = o[n](v), settle(resolve8, reject, v.done, v.value);
9717
+ return new Promise(function(resolve9, reject) {
9718
+ v = o[n](v), settle(resolve9, reject, v.done, v.value);
9262
9719
  });
9263
9720
  };
9264
9721
  }
9265
- function settle(resolve8, reject, d, v) {
9722
+ function settle(resolve9, reject, d, v) {
9266
9723
  Promise.resolve(v).then(function(v2) {
9267
- resolve8({ value: v2, done: d });
9724
+ resolve9({ value: v2, done: d });
9268
9725
  }, reject);
9269
9726
  }
9270
9727
  }
@@ -9795,7 +10252,7 @@ function of() {
9795
10252
  }
9796
10253
  function lastValueFrom(source, config22) {
9797
10254
  var hasConfig = typeof config22 === "object";
9798
- return new Promise(function(resolve8, reject) {
10255
+ return new Promise(function(resolve9, reject) {
9799
10256
  var _hasValue = false;
9800
10257
  var _value;
9801
10258
  source.subscribe({
@@ -9806,9 +10263,9 @@ function lastValueFrom(source, config22) {
9806
10263
  error: reject,
9807
10264
  complete: function() {
9808
10265
  if (_hasValue) {
9809
- resolve8(_value);
10266
+ resolve9(_value);
9810
10267
  } else if (hasConfig) {
9811
- resolve8(config22.defaultValue);
10268
+ resolve9(config22.defaultValue);
9812
10269
  } else {
9813
10270
  reject(new EmptyError);
9814
10271
  }
@@ -9818,16 +10275,16 @@ function lastValueFrom(source, config22) {
9818
10275
  }
9819
10276
  function firstValueFrom(source, config22) {
9820
10277
  var hasConfig = typeof config22 === "object";
9821
- return new Promise(function(resolve8, reject) {
10278
+ return new Promise(function(resolve9, reject) {
9822
10279
  var subscriber = new SafeSubscriber({
9823
10280
  next: function(value) {
9824
- resolve8(value);
10281
+ resolve9(value);
9825
10282
  subscriber.unsubscribe();
9826
10283
  },
9827
10284
  error: reject,
9828
10285
  complete: function() {
9829
10286
  if (hasConfig) {
9830
- resolve8(config22.defaultValue);
10287
+ resolve9(config22.defaultValue);
9831
10288
  } else {
9832
10289
  reject(new EmptyError);
9833
10290
  }
@@ -10879,7 +11336,7 @@ var init_rxjs = __esm(() => {
10879
11336
  Observable2.prototype.forEach = function(next, promiseCtor) {
10880
11337
  var _this = this;
10881
11338
  promiseCtor = getPromiseCtor(promiseCtor);
10882
- return new promiseCtor(function(resolve8, reject) {
11339
+ return new promiseCtor(function(resolve9, reject) {
10883
11340
  var subscriber = new SafeSubscriber({
10884
11341
  next: function(value) {
10885
11342
  try {
@@ -10890,7 +11347,7 @@ var init_rxjs = __esm(() => {
10890
11347
  }
10891
11348
  },
10892
11349
  error: reject,
10893
- complete: resolve8
11350
+ complete: resolve9
10894
11351
  });
10895
11352
  _this.subscribe(subscriber);
10896
11353
  });
@@ -10912,14 +11369,14 @@ var init_rxjs = __esm(() => {
10912
11369
  Observable2.prototype.toPromise = function(promiseCtor) {
10913
11370
  var _this = this;
10914
11371
  promiseCtor = getPromiseCtor(promiseCtor);
10915
- return new promiseCtor(function(resolve8, reject) {
11372
+ return new promiseCtor(function(resolve9, reject) {
10916
11373
  var value;
10917
11374
  _this.subscribe(function(x) {
10918
11375
  return value = x;
10919
11376
  }, function(err) {
10920
11377
  return reject(err);
10921
11378
  }, function() {
10922
- return resolve8(value);
11379
+ return resolve9(value);
10923
11380
  });
10924
11381
  });
10925
11382
  };
@@ -12845,8 +13302,8 @@ class Deferred {
12845
13302
  #isRejected = false;
12846
13303
  #value;
12847
13304
  #resolve;
12848
- #taskPromise = new Promise((resolve8) => {
12849
- this.#resolve = resolve8;
13305
+ #taskPromise = new Promise((resolve9) => {
13306
+ this.#resolve = resolve9;
12850
13307
  });
12851
13308
  #timeoutId;
12852
13309
  #timeoutError;
@@ -12935,12 +13392,12 @@ var init_Mutex = __esm(() => {
12935
13392
  return new Mutex.Guard(this, onRelease);
12936
13393
  }
12937
13394
  release() {
12938
- const resolve8 = this.#acquirers.shift();
12939
- if (!resolve8) {
13395
+ const resolve9 = this.#acquirers.shift();
13396
+ if (!resolve9) {
12940
13397
  this.#locked = false;
12941
13398
  return;
12942
13399
  }
12943
- resolve8();
13400
+ resolve9();
12944
13401
  }
12945
13402
  };
12946
13403
  });
@@ -14684,12 +15141,12 @@ var init_locators = __esm(() => {
14684
15141
  }
14685
15142
  return defer(() => {
14686
15143
  return from(handle.evaluate((element) => {
14687
- return new Promise((resolve8) => {
15144
+ return new Promise((resolve9) => {
14688
15145
  window.requestAnimationFrame(() => {
14689
15146
  const rect1 = element.getBoundingClientRect();
14690
15147
  window.requestAnimationFrame(() => {
14691
15148
  const rect2 = element.getBoundingClientRect();
14692
- resolve8([
15149
+ resolve9([
14693
15150
  {
14694
15151
  x: rect1.x,
14695
15152
  y: rect1.y,
@@ -15980,9 +16437,9 @@ var init_ElementHandle = __esm(() => {
15980
16437
  const handle = await this.#asSVGElementHandle();
15981
16438
  const target = __addDisposableResource6(env_5, handle && await handle.#getOwnerSVGElement(), false);
15982
16439
  return await (target ?? this).evaluate(async (element, threshold) => {
15983
- const visibleRatio = await new Promise((resolve8) => {
16440
+ const visibleRatio = await new Promise((resolve9) => {
15984
16441
  const observer = new IntersectionObserver((entries) => {
15985
- resolve8(entries[0].intersectionRatio);
16442
+ resolve9(entries[0].intersectionRatio);
15986
16443
  observer.disconnect();
15987
16444
  });
15988
16445
  observer.observe(element);
@@ -16376,7 +16833,7 @@ var init_Frame = __esm(() => {
16376
16833
  }
16377
16834
  type = type ?? "text/javascript";
16378
16835
  return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, id, type: type2, content: content2 }) => {
16379
- return await new Promise((resolve8, reject) => {
16836
+ return await new Promise((resolve9, reject) => {
16380
16837
  const script = document.createElement("script");
16381
16838
  script.type = type2;
16382
16839
  script.text = content2;
@@ -16389,12 +16846,12 @@ var init_Frame = __esm(() => {
16389
16846
  if (url) {
16390
16847
  script.src = url;
16391
16848
  script.addEventListener("load", () => {
16392
- resolve8(script);
16849
+ resolve9(script);
16393
16850
  }, { once: true });
16394
16851
  document.head.appendChild(script);
16395
16852
  } else {
16396
16853
  document.head.appendChild(script);
16397
- resolve8(script);
16854
+ resolve9(script);
16398
16855
  }
16399
16856
  });
16400
16857
  }, { ...options, type, content }));
@@ -16411,7 +16868,7 @@ var init_Frame = __esm(() => {
16411
16868
  options.content = content;
16412
16869
  }
16413
16870
  return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, content: content2 }) => {
16414
- return await new Promise((resolve8, reject) => {
16871
+ return await new Promise((resolve9, reject) => {
16415
16872
  let element;
16416
16873
  if (!url) {
16417
16874
  element = document.createElement("style");
@@ -16423,7 +16880,7 @@ var init_Frame = __esm(() => {
16423
16880
  element = link;
16424
16881
  }
16425
16882
  element.addEventListener("load", () => {
16426
- resolve8(element);
16883
+ resolve9(element);
16427
16884
  }, { once: true });
16428
16885
  element.addEventListener("error", (event) => {
16429
16886
  reject(new Error(event.message ?? "Could not load style"));
@@ -17277,9 +17734,9 @@ var init_Page = __esm(() => {
17277
17734
  ++this.#screencastSessionCount;
17278
17735
  if (!this.#startScreencastPromise) {
17279
17736
  this.#startScreencastPromise = this.mainFrame().client.send("Page.startScreencast", { format: "png" }).then(() => {
17280
- return new Promise((resolve8) => {
17737
+ return new Promise((resolve9) => {
17281
17738
  return this.mainFrame().client.once("Page.screencastFrame", () => {
17282
- return resolve8();
17739
+ return resolve9();
17283
17740
  });
17284
17741
  });
17285
17742
  });
@@ -19937,11 +20394,11 @@ function addPageBinding(type, name, prefix) {
19937
20394
  return value instanceof Node;
19938
20395
  })
19939
20396
  }));
19940
- return new Promise((resolve8, reject) => {
20397
+ return new Promise((resolve9, reject) => {
19941
20398
  callPuppeteer.callbacks.set(seq, {
19942
20399
  resolve(value) {
19943
20400
  callPuppeteer.args.delete(seq);
19944
- resolve8(value);
20401
+ resolve9(value);
19945
20402
  },
19946
20403
  reject(value) {
19947
20404
  callPuppeteer.args.delete(seq);
@@ -23404,8 +23861,8 @@ var init_Input2 = __esm(() => {
23404
23861
  if (typeof delay === "number") {
23405
23862
  await Promise.all(actions);
23406
23863
  actions.length = 0;
23407
- await new Promise((resolve8) => {
23408
- setTimeout(resolve8, delay);
23864
+ await new Promise((resolve9) => {
23865
+ setTimeout(resolve9, delay);
23409
23866
  });
23410
23867
  }
23411
23868
  actions.push(this.up({ ...options, clickCount }));
@@ -23425,9 +23882,9 @@ var init_Input2 = __esm(() => {
23425
23882
  });
23426
23883
  }
23427
23884
  async drag(start, target) {
23428
- const promise = new Promise((resolve8) => {
23885
+ const promise = new Promise((resolve9) => {
23429
23886
  this.#client.once("Input.dragIntercepted", (event) => {
23430
- return resolve8(event.data);
23887
+ return resolve9(event.data);
23431
23888
  });
23432
23889
  });
23433
23890
  await this.move(start.x, start.y);
@@ -23468,8 +23925,8 @@ var init_Input2 = __esm(() => {
23468
23925
  await this.dragEnter(target, data);
23469
23926
  await this.dragOver(target, data);
23470
23927
  if (delay) {
23471
- await new Promise((resolve8) => {
23472
- return setTimeout(resolve8, delay);
23928
+ await new Promise((resolve9) => {
23929
+ return setTimeout(resolve9, delay);
23473
23930
  });
23474
23931
  }
23475
23932
  await this.drop(target, data);
@@ -24281,9 +24738,9 @@ var init_Page2 = __esm(() => {
24281
24738
  async captureHeapSnapshot(options) {
24282
24739
  const { createWriteStream } = environment.value.fs;
24283
24740
  const stream = createWriteStream(options.path);
24284
- const streamPromise = new Promise((resolve8, reject) => {
24741
+ const streamPromise = new Promise((resolve9, reject) => {
24285
24742
  stream.on("error", reject);
24286
- stream.on("finish", resolve8);
24743
+ stream.on("finish", resolve9);
24287
24744
  });
24288
24745
  const client = this.#primaryTargetClient;
24289
24746
  await client.send("HeapProfiler.enable");
@@ -25796,10 +26253,10 @@ __export(exports_BrowserWebSocketTransport, {
25796
26253
 
25797
26254
  class BrowserWebSocketTransport {
25798
26255
  static create(url) {
25799
- return new Promise((resolve8, reject) => {
26256
+ return new Promise((resolve9, reject) => {
25800
26257
  const ws = new WebSocket(url);
25801
26258
  ws.addEventListener("open", () => {
25802
- return resolve8(new BrowserWebSocketTransport(ws));
26259
+ return resolve9(new BrowserWebSocketTransport(ws));
25803
26260
  });
25804
26261
  ws.addEventListener("error", reject);
25805
26262
  });
@@ -28633,11 +29090,11 @@ var require_BrowsingContextProcessor = __commonJS((exports) => {
28633
29090
  }
28634
29091
  const parentCdpClient = context2.cdpTarget.parentCdpClient;
28635
29092
  try {
28636
- const detachedFromTargetPromise = new Promise((resolve8) => {
29093
+ const detachedFromTargetPromise = new Promise((resolve9) => {
28637
29094
  const onContextDestroyed = (event) => {
28638
29095
  if (event.targetId === params.context) {
28639
29096
  parentCdpClient.off("Target.detachedFromTarget", onContextDestroyed);
28640
- resolve8();
29097
+ resolve9();
28641
29098
  }
28642
29099
  };
28643
29100
  parentCdpClient.on("Target.detachedFromTarget", onContextDestroyed);
@@ -29957,7 +30414,7 @@ var require_ActionDispatcher = __commonJS((exports) => {
29957
30414
  }
29958
30415
  }
29959
30416
  const promises = [
29960
- new Promise((resolve8) => setTimeout(resolve8, this.#tickDuration))
30417
+ new Promise((resolve9) => setTimeout(resolve9, this.#tickDuration))
29961
30418
  ];
29962
30419
  for (const option of options) {
29963
30420
  promises.push(this.#dispatchAction(option));
@@ -30556,8 +31013,8 @@ var require_Mutex = __commonJS((exports) => {
30556
31013
  acquire() {
30557
31014
  const state = { resolved: false };
30558
31015
  if (this.#locked) {
30559
- return new Promise((resolve8) => {
30560
- this.#acquirers.push(() => resolve8(this.#release.bind(this, state)));
31016
+ return new Promise((resolve9) => {
31017
+ this.#acquirers.push(() => resolve9(this.#release.bind(this, state)));
30561
31018
  });
30562
31019
  }
30563
31020
  this.#locked = true;
@@ -30568,12 +31025,12 @@ var require_Mutex = __commonJS((exports) => {
30568
31025
  throw new Error("Cannot release more than once.");
30569
31026
  }
30570
31027
  state.resolved = true;
30571
- const resolve8 = this.#acquirers.shift();
30572
- if (!resolve8) {
31028
+ const resolve9 = this.#acquirers.shift();
31029
+ if (!resolve9) {
30573
31030
  this.#locked = false;
30574
31031
  return;
30575
31032
  }
30576
- resolve8();
31033
+ resolve9();
30577
31034
  }
30578
31035
  async run(action) {
30579
31036
  const release = await this.acquire();
@@ -31700,8 +32157,8 @@ var require_ChannelProxy = __commonJS((exports) => {
31700
32157
  let queueNonEmptyResolver = null;
31701
32158
  return {
31702
32159
  async getMessage() {
31703
- const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve8) => {
31704
- queueNonEmptyResolver = resolve8;
32160
+ const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve9) => {
32161
+ queueNonEmptyResolver = resolve9;
31705
32162
  });
31706
32163
  await onMessage;
31707
32164
  return queue.shift();
@@ -31787,7 +32244,7 @@ var require_ChannelProxy = __commonJS((exports) => {
31787
32244
  functionDeclaration: String((id) => {
31788
32245
  const w = window;
31789
32246
  if (w[id] === undefined) {
31790
- return new Promise((resolve8) => w[id] = resolve8);
32247
+ return new Promise((resolve9) => w[id] = resolve9);
31791
32248
  }
31792
32249
  const channelProxy = w[id];
31793
32250
  delete w[id];
@@ -33138,8 +33595,8 @@ var require_Deferred = __commonJS((exports) => {
33138
33595
  return this.#result;
33139
33596
  }
33140
33597
  constructor() {
33141
- this.#promise = new Promise((resolve8, reject) => {
33142
- this.#resolve = resolve8;
33598
+ this.#promise = new Promise((resolve9, reject) => {
33599
+ this.#resolve = resolve9;
33143
33600
  this.#reject = reject;
33144
33601
  });
33145
33602
  this.#promise.catch((_error) => {});
@@ -37464,11 +37921,11 @@ var require_BrowsingContextStorage = __commonJS((exports) => {
37464
37921
  if (this.#contexts.has(browsingContextId)) {
37465
37922
  return Promise.resolve(this.getContext(browsingContextId));
37466
37923
  }
37467
- return new Promise((resolve8) => {
37924
+ return new Promise((resolve9) => {
37468
37925
  const listener = (event) => {
37469
37926
  if (event.browsingContext.id === browsingContextId) {
37470
37927
  this.#eventEmitter.off("added", listener);
37471
- resolve8(event.browsingContext);
37928
+ resolve9(event.browsingContext);
37472
37929
  }
37473
37930
  };
37474
37931
  this.#eventEmitter.on("added", listener);
@@ -40964,8 +41421,8 @@ var init_ExposedFunction = __esm(() => {
40964
41421
  const functionDeclaration = stringifyFunction(interpolateFunction((callback) => {
40965
41422
  Object.assign(globalThis, {
40966
41423
  [PLACEHOLDER("name")]: function(...args) {
40967
- return new Promise((resolve8, reject) => {
40968
- callback([resolve8, reject, args]);
41424
+ return new Promise((resolve9, reject) => {
41425
+ callback([resolve9, reject, args]);
40969
41426
  });
40970
41427
  }
40971
41428
  });
@@ -41053,8 +41510,8 @@ var init_ExposedFunction = __esm(() => {
41053
41510
  return;
41054
41511
  }
41055
41512
  try {
41056
- await dataHandle.evaluate(([resolve8], result2) => {
41057
- resolve8(result2);
41513
+ await dataHandle.evaluate(([resolve9], result2) => {
41514
+ resolve9(result2);
41058
41515
  }, result);
41059
41516
  } catch (error) {
41060
41517
  debugError(error);
@@ -47645,8 +48102,8 @@ var require_websocket = __commonJS((exports, module) => {
47645
48102
  if (websocket.readyState !== WebSocket2.CONNECTING)
47646
48103
  return;
47647
48104
  req = websocket._req = null;
47648
- const upgrade = res.headers.upgrade;
47649
- if (upgrade === undefined || upgrade.toLowerCase() !== "websocket") {
48105
+ const upgrade2 = res.headers.upgrade;
48106
+ if (upgrade2 === undefined || upgrade2.toLowerCase() !== "websocket") {
47650
48107
  abortHandshake(websocket, socket, "Invalid Upgrade header");
47651
48108
  return;
47652
48109
  }
@@ -48149,14 +48606,14 @@ var require_websocket_server = __commonJS((exports, module) => {
48149
48606
  handleUpgrade(req, socket, head, cb) {
48150
48607
  socket.on("error", socketOnError);
48151
48608
  const key = req.headers["sec-websocket-key"];
48152
- const upgrade = req.headers.upgrade;
48609
+ const upgrade2 = req.headers.upgrade;
48153
48610
  const version = +req.headers["sec-websocket-version"];
48154
48611
  if (req.method !== "GET") {
48155
48612
  const message = "Invalid HTTP method";
48156
48613
  abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
48157
48614
  return;
48158
48615
  }
48159
- if (upgrade === undefined || upgrade.toLowerCase() !== "websocket") {
48616
+ if (upgrade2 === undefined || upgrade2.toLowerCase() !== "websocket") {
48160
48617
  const message = "Invalid Upgrade header";
48161
48618
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
48162
48619
  return;
@@ -48346,7 +48803,7 @@ __export(exports_NodeWebSocketTransport, {
48346
48803
 
48347
48804
  class NodeWebSocketTransport {
48348
48805
  static create(url, headers) {
48349
- return new Promise((resolve8, reject) => {
48806
+ return new Promise((resolve9, reject) => {
48350
48807
  const ws = new wrapper_default(url, [], {
48351
48808
  followRedirects: true,
48352
48809
  perMessageDeflate: false,
@@ -48358,7 +48815,7 @@ class NodeWebSocketTransport {
48358
48815
  }
48359
48816
  });
48360
48817
  ws.addEventListener("open", () => {
48361
- return resolve8(new NodeWebSocketTransport(ws));
48818
+ return resolve9(new NodeWebSocketTransport(ws));
48362
48819
  });
48363
48820
  ws.addEventListener("error", reject);
48364
48821
  });
@@ -51250,8 +51707,8 @@ var require_helpers = __commonJS((exports) => {
51250
51707
  function req(url, opts = {}) {
51251
51708
  const href = typeof url === "string" ? url : url.href;
51252
51709
  const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
51253
- const promise = new Promise((resolve8, reject) => {
51254
- req2.once("response", resolve8).once("error", reject).end();
51710
+ const promise = new Promise((resolve9, reject) => {
51711
+ req2.once("response", resolve9).once("error", reject).end();
51255
51712
  });
51256
51713
  req2.then = promise.then.bind(promise);
51257
51714
  return req2;
@@ -51622,7 +52079,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
51622
52079
  var debug_1 = __importDefault(require_src());
51623
52080
  var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
51624
52081
  function parseProxyResponse(socket) {
51625
- return new Promise((resolve8, reject) => {
52082
+ return new Promise((resolve9, reject) => {
51626
52083
  let buffersLength = 0;
51627
52084
  const buffers = [];
51628
52085
  function read() {
@@ -51691,7 +52148,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
51691
52148
  }
51692
52149
  debug2("got proxy server response: %o %o", firstLine, headers);
51693
52150
  cleanup();
51694
- resolve8({
52151
+ resolve9({
51695
52152
  connect: {
51696
52153
  statusCode,
51697
52154
  statusText,
@@ -53795,11 +54252,11 @@ var require_receivebuffer = __commonJS((exports) => {
53795
54252
  var require_socksclient = __commonJS((exports) => {
53796
54253
  var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
53797
54254
  function adopt(value) {
53798
- return value instanceof P ? value : new P(function(resolve8) {
53799
- resolve8(value);
54255
+ return value instanceof P ? value : new P(function(resolve9) {
54256
+ resolve9(value);
53800
54257
  });
53801
54258
  }
53802
- return new (P || (P = Promise))(function(resolve8, reject) {
54259
+ return new (P || (P = Promise))(function(resolve9, reject) {
53803
54260
  function fulfilled(value) {
53804
54261
  try {
53805
54262
  step(generator.next(value));
@@ -53815,7 +54272,7 @@ var require_socksclient = __commonJS((exports) => {
53815
54272
  }
53816
54273
  }
53817
54274
  function step(result) {
53818
- result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
54275
+ result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
53819
54276
  }
53820
54277
  step((generator = generator.apply(thisArg, _arguments || [])).next());
53821
54278
  });
@@ -53842,13 +54299,13 @@ var require_socksclient = __commonJS((exports) => {
53842
54299
  this.setState(constants_1.SocksClientState.Created);
53843
54300
  }
53844
54301
  static createConnection(options, callback) {
53845
- return new Promise((resolve8, reject) => {
54302
+ return new Promise((resolve9, reject) => {
53846
54303
  try {
53847
54304
  (0, helpers_1.validateSocksClientOptions)(options, ["connect"]);
53848
54305
  } catch (err) {
53849
54306
  if (typeof callback === "function") {
53850
54307
  callback(err);
53851
- return resolve8(err);
54308
+ return resolve9(err);
53852
54309
  } else {
53853
54310
  return reject(err);
53854
54311
  }
@@ -53859,16 +54316,16 @@ var require_socksclient = __commonJS((exports) => {
53859
54316
  client.removeAllListeners();
53860
54317
  if (typeof callback === "function") {
53861
54318
  callback(null, info);
53862
- resolve8(info);
54319
+ resolve9(info);
53863
54320
  } else {
53864
- resolve8(info);
54321
+ resolve9(info);
53865
54322
  }
53866
54323
  });
53867
54324
  client.once("error", (err) => {
53868
54325
  client.removeAllListeners();
53869
54326
  if (typeof callback === "function") {
53870
54327
  callback(err);
53871
- resolve8(err);
54328
+ resolve9(err);
53872
54329
  } else {
53873
54330
  reject(err);
53874
54331
  }
@@ -53876,13 +54333,13 @@ var require_socksclient = __commonJS((exports) => {
53876
54333
  });
53877
54334
  }
53878
54335
  static createConnectionChain(options, callback) {
53879
- return new Promise((resolve8, reject) => __awaiter2(this, undefined, undefined, function* () {
54336
+ return new Promise((resolve9, reject) => __awaiter2(this, undefined, undefined, function* () {
53880
54337
  try {
53881
54338
  (0, helpers_1.validateSocksClientChainOptions)(options);
53882
54339
  } catch (err) {
53883
54340
  if (typeof callback === "function") {
53884
54341
  callback(err);
53885
- return resolve8(err);
54342
+ return resolve9(err);
53886
54343
  } else {
53887
54344
  return reject(err);
53888
54345
  }
@@ -53908,14 +54365,14 @@ var require_socksclient = __commonJS((exports) => {
53908
54365
  }
53909
54366
  if (typeof callback === "function") {
53910
54367
  callback(null, { socket: sock });
53911
- resolve8({ socket: sock });
54368
+ resolve9({ socket: sock });
53912
54369
  } else {
53913
- resolve8({ socket: sock });
54370
+ resolve9({ socket: sock });
53914
54371
  }
53915
54372
  } catch (err) {
53916
54373
  if (typeof callback === "function") {
53917
54374
  callback(err);
53918
- resolve8(err);
54375
+ resolve9(err);
53919
54376
  } else {
53920
54377
  reject(err);
53921
54378
  }
@@ -54515,12 +54972,12 @@ var require_dist4 = __commonJS((exports) => {
54515
54972
  let { host } = opts;
54516
54973
  const { port, lookup: lookupFn = dns.lookup } = opts;
54517
54974
  if (shouldLookup) {
54518
- host = await new Promise((resolve8, reject) => {
54975
+ host = await new Promise((resolve9, reject) => {
54519
54976
  lookupFn(host, {}, (err, res) => {
54520
54977
  if (err) {
54521
54978
  reject(err);
54522
54979
  } else {
54523
- resolve8(res);
54980
+ resolve9(res);
54524
54981
  }
54525
54982
  });
54526
54983
  });
@@ -55527,7 +55984,7 @@ var require_netUtils = __commonJS((exports) => {
55527
55984
  return `${socket.remoteAddress}:${socket.remotePort}`;
55528
55985
  }
55529
55986
  function upgradeSocket(socket, options) {
55530
- return new Promise((resolve8, reject) => {
55987
+ return new Promise((resolve9, reject) => {
55531
55988
  const tlsOptions = Object.assign({}, options, {
55532
55989
  socket
55533
55990
  });
@@ -55537,7 +55994,7 @@ var require_netUtils = __commonJS((exports) => {
55537
55994
  reject(tlsSocket.authorizationError);
55538
55995
  } else {
55539
55996
  tlsSocket.removeAllListeners("error");
55540
- resolve8(tlsSocket);
55997
+ resolve9(tlsSocket);
55541
55998
  }
55542
55999
  }).once("error", (error) => {
55543
56000
  reject(error);
@@ -55629,7 +56086,7 @@ var require_transfer = __commonJS((exports) => {
55629
56086
  };
55630
56087
  }
55631
56088
  function connectForPassiveTransfer(host, port, ftp) {
55632
- return new Promise((resolve8, reject) => {
56089
+ return new Promise((resolve9, reject) => {
55633
56090
  let socket = ftp._newSocket();
55634
56091
  const handleConnErr = function(err) {
55635
56092
  err.message = "Can't open data connection in passive mode: " + err.message;
@@ -55652,7 +56109,7 @@ var require_transfer = __commonJS((exports) => {
55652
56109
  socket.removeListener("error", handleConnErr);
55653
56110
  socket.removeListener("timeout", handleTimeout);
55654
56111
  ftp.dataSocket = socket;
55655
- resolve8();
56112
+ resolve9();
55656
56113
  });
55657
56114
  });
55658
56115
  }
@@ -57730,7 +58187,7 @@ var require_util2 = __commonJS((exports) => {
57730
58187
  return path;
57731
58188
  }
57732
58189
  exports.normalize = normalize2;
57733
- function join29(aRoot, aPath) {
58190
+ function join30(aRoot, aPath) {
57734
58191
  if (aRoot === "") {
57735
58192
  aRoot = ".";
57736
58193
  }
@@ -57762,7 +58219,7 @@ var require_util2 = __commonJS((exports) => {
57762
58219
  }
57763
58220
  return joined;
57764
58221
  }
57765
- exports.join = join29;
58222
+ exports.join = join30;
57766
58223
  exports.isAbsolute = function(aPath) {
57767
58224
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
57768
58225
  };
@@ -57935,7 +58392,7 @@ var require_util2 = __commonJS((exports) => {
57935
58392
  parsed.path = parsed.path.substring(0, index + 1);
57936
58393
  }
57937
58394
  }
57938
- sourceURL = join29(urlGenerate(parsed), sourceURL);
58395
+ sourceURL = join30(urlGenerate(parsed), sourceURL);
57939
58396
  }
57940
58397
  return normalize2(sourceURL);
57941
58398
  }
@@ -59667,7 +60124,7 @@ var require_escodegen = __commonJS((exports) => {
59667
60124
  function noEmptySpace() {
59668
60125
  return space ? space : " ";
59669
60126
  }
59670
- function join29(left, right) {
60127
+ function join30(left, right) {
59671
60128
  var leftSource, rightSource, leftCharCode, rightCharCode;
59672
60129
  leftSource = toSourceNodeWhenNeeded(left).toString();
59673
60130
  if (leftSource.length === 0) {
@@ -60008,8 +60465,8 @@ var require_escodegen = __commonJS((exports) => {
60008
60465
  } else {
60009
60466
  result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT));
60010
60467
  }
60011
- result = join29(result, operator);
60012
- result = [join29(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
60468
+ result = join30(result, operator);
60469
+ result = [join30(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
60013
60470
  });
60014
60471
  result.push(this.maybeBlock(stmt.body, flags));
60015
60472
  return result;
@@ -60147,11 +60604,11 @@ var require_escodegen = __commonJS((exports) => {
60147
60604
  var result, fragment;
60148
60605
  result = ["class"];
60149
60606
  if (stmt.id) {
60150
- result = join29(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
60607
+ result = join30(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
60151
60608
  }
60152
60609
  if (stmt.superClass) {
60153
- fragment = join29("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
60154
- result = join29(result, fragment);
60610
+ fragment = join30("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
60611
+ result = join30(result, fragment);
60155
60612
  }
60156
60613
  result.push(space);
60157
60614
  result.push(this.generateStatement(stmt.body, S_TFFT));
@@ -60164,9 +60621,9 @@ var require_escodegen = __commonJS((exports) => {
60164
60621
  return escapeDirective(stmt.directive) + this.semicolon(flags);
60165
60622
  },
60166
60623
  DoWhileStatement: function(stmt, flags) {
60167
- var result = join29("do", this.maybeBlock(stmt.body, S_TFFF));
60624
+ var result = join30("do", this.maybeBlock(stmt.body, S_TFFF));
60168
60625
  result = this.maybeBlockSuffix(stmt.body, result);
60169
- return join29(result, [
60626
+ return join30(result, [
60170
60627
  "while" + space + "(",
60171
60628
  this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
60172
60629
  ")" + this.semicolon(flags)
@@ -60202,11 +60659,11 @@ var require_escodegen = __commonJS((exports) => {
60202
60659
  ExportDefaultDeclaration: function(stmt, flags) {
60203
60660
  var result = ["export"], bodyFlags;
60204
60661
  bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
60205
- result = join29(result, "default");
60662
+ result = join30(result, "default");
60206
60663
  if (isStatement(stmt.declaration)) {
60207
- result = join29(result, this.generateStatement(stmt.declaration, bodyFlags));
60664
+ result = join30(result, this.generateStatement(stmt.declaration, bodyFlags));
60208
60665
  } else {
60209
- result = join29(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
60666
+ result = join30(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
60210
60667
  }
60211
60668
  return result;
60212
60669
  },
@@ -60214,15 +60671,15 @@ var require_escodegen = __commonJS((exports) => {
60214
60671
  var result = ["export"], bodyFlags, that = this;
60215
60672
  bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
60216
60673
  if (stmt.declaration) {
60217
- return join29(result, this.generateStatement(stmt.declaration, bodyFlags));
60674
+ return join30(result, this.generateStatement(stmt.declaration, bodyFlags));
60218
60675
  }
60219
60676
  if (stmt.specifiers) {
60220
60677
  if (stmt.specifiers.length === 0) {
60221
- result = join29(result, "{" + space + "}");
60678
+ result = join30(result, "{" + space + "}");
60222
60679
  } else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) {
60223
- result = join29(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
60680
+ result = join30(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
60224
60681
  } else {
60225
- result = join29(result, "{");
60682
+ result = join30(result, "{");
60226
60683
  withIndent(function(indent2) {
60227
60684
  var i, iz;
60228
60685
  result.push(newline);
@@ -60240,7 +60697,7 @@ var require_escodegen = __commonJS((exports) => {
60240
60697
  result.push(base + "}");
60241
60698
  }
60242
60699
  if (stmt.source) {
60243
- result = join29(result, [
60700
+ result = join30(result, [
60244
60701
  "from" + space,
60245
60702
  this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
60246
60703
  this.semicolon(flags)
@@ -60324,7 +60781,7 @@ var require_escodegen = __commonJS((exports) => {
60324
60781
  ];
60325
60782
  cursor = 0;
60326
60783
  if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) {
60327
- result = join29(result, [
60784
+ result = join30(result, [
60328
60785
  this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
60329
60786
  ]);
60330
60787
  ++cursor;
@@ -60334,7 +60791,7 @@ var require_escodegen = __commonJS((exports) => {
60334
60791
  result.push(",");
60335
60792
  }
60336
60793
  if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) {
60337
- result = join29(result, [
60794
+ result = join30(result, [
60338
60795
  space,
60339
60796
  this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
60340
60797
  ]);
@@ -60363,7 +60820,7 @@ var require_escodegen = __commonJS((exports) => {
60363
60820
  }
60364
60821
  }
60365
60822
  }
60366
- result = join29(result, [
60823
+ result = join30(result, [
60367
60824
  "from" + space,
60368
60825
  this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
60369
60826
  this.semicolon(flags)
@@ -60417,7 +60874,7 @@ var require_escodegen = __commonJS((exports) => {
60417
60874
  return result;
60418
60875
  },
60419
60876
  ThrowStatement: function(stmt, flags) {
60420
- return [join29("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
60877
+ return [join30("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
60421
60878
  },
60422
60879
  TryStatement: function(stmt, flags) {
60423
60880
  var result, i, iz, guardedHandlers;
@@ -60425,7 +60882,7 @@ var require_escodegen = __commonJS((exports) => {
60425
60882
  result = this.maybeBlockSuffix(stmt.block, result);
60426
60883
  if (stmt.handlers) {
60427
60884
  for (i = 0, iz = stmt.handlers.length;i < iz; ++i) {
60428
- result = join29(result, this.generateStatement(stmt.handlers[i], S_TFFF));
60885
+ result = join30(result, this.generateStatement(stmt.handlers[i], S_TFFF));
60429
60886
  if (stmt.finalizer || i + 1 !== iz) {
60430
60887
  result = this.maybeBlockSuffix(stmt.handlers[i].body, result);
60431
60888
  }
@@ -60433,7 +60890,7 @@ var require_escodegen = __commonJS((exports) => {
60433
60890
  } else {
60434
60891
  guardedHandlers = stmt.guardedHandlers || [];
60435
60892
  for (i = 0, iz = guardedHandlers.length;i < iz; ++i) {
60436
- result = join29(result, this.generateStatement(guardedHandlers[i], S_TFFF));
60893
+ result = join30(result, this.generateStatement(guardedHandlers[i], S_TFFF));
60437
60894
  if (stmt.finalizer || i + 1 !== iz) {
60438
60895
  result = this.maybeBlockSuffix(guardedHandlers[i].body, result);
60439
60896
  }
@@ -60441,13 +60898,13 @@ var require_escodegen = __commonJS((exports) => {
60441
60898
  if (stmt.handler) {
60442
60899
  if (Array.isArray(stmt.handler)) {
60443
60900
  for (i = 0, iz = stmt.handler.length;i < iz; ++i) {
60444
- result = join29(result, this.generateStatement(stmt.handler[i], S_TFFF));
60901
+ result = join30(result, this.generateStatement(stmt.handler[i], S_TFFF));
60445
60902
  if (stmt.finalizer || i + 1 !== iz) {
60446
60903
  result = this.maybeBlockSuffix(stmt.handler[i].body, result);
60447
60904
  }
60448
60905
  }
60449
60906
  } else {
60450
- result = join29(result, this.generateStatement(stmt.handler, S_TFFF));
60907
+ result = join30(result, this.generateStatement(stmt.handler, S_TFFF));
60451
60908
  if (stmt.finalizer) {
60452
60909
  result = this.maybeBlockSuffix(stmt.handler.body, result);
60453
60910
  }
@@ -60455,7 +60912,7 @@ var require_escodegen = __commonJS((exports) => {
60455
60912
  }
60456
60913
  }
60457
60914
  if (stmt.finalizer) {
60458
- result = join29(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
60915
+ result = join30(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
60459
60916
  }
60460
60917
  return result;
60461
60918
  },
@@ -60489,7 +60946,7 @@ var require_escodegen = __commonJS((exports) => {
60489
60946
  withIndent(function() {
60490
60947
  if (stmt.test) {
60491
60948
  result = [
60492
- join29("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
60949
+ join30("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
60493
60950
  ":"
60494
60951
  ];
60495
60952
  } else {
@@ -60537,9 +60994,9 @@ var require_escodegen = __commonJS((exports) => {
60537
60994
  result.push(this.maybeBlock(stmt.consequent, S_TFFF));
60538
60995
  result = this.maybeBlockSuffix(stmt.consequent, result);
60539
60996
  if (stmt.alternate.type === Syntax.IfStatement) {
60540
- result = join29(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
60997
+ result = join30(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
60541
60998
  } else {
60542
- result = join29(result, join29("else", this.maybeBlock(stmt.alternate, bodyFlags)));
60999
+ result = join30(result, join30("else", this.maybeBlock(stmt.alternate, bodyFlags)));
60543
61000
  }
60544
61001
  } else {
60545
61002
  result.push(this.maybeBlock(stmt.consequent, bodyFlags));
@@ -60641,7 +61098,7 @@ var require_escodegen = __commonJS((exports) => {
60641
61098
  },
60642
61099
  ReturnStatement: function(stmt, flags) {
60643
61100
  if (stmt.argument) {
60644
- return [join29("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
61101
+ return [join30("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
60645
61102
  }
60646
61103
  return ["return" + this.semicolon(flags)];
60647
61104
  },
@@ -60723,14 +61180,14 @@ var require_escodegen = __commonJS((exports) => {
60723
61180
  if (leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) {
60724
61181
  result = [fragment, noEmptySpace(), expr.operator];
60725
61182
  } else {
60726
- result = join29(fragment, expr.operator);
61183
+ result = join30(fragment, expr.operator);
60727
61184
  }
60728
61185
  fragment = this.generateExpression(expr.right, rightPrecedence, flags);
60729
61186
  if (expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--") {
60730
61187
  result.push(noEmptySpace());
60731
61188
  result.push(fragment);
60732
61189
  } else {
60733
- result = join29(result, fragment);
61190
+ result = join30(result, fragment);
60734
61191
  }
60735
61192
  if (expr.operator === "in" && !(flags & F_ALLOW_IN)) {
60736
61193
  return ["(", result, ")"];
@@ -60770,7 +61227,7 @@ var require_escodegen = __commonJS((exports) => {
60770
61227
  var result, length, i, iz, itemFlags;
60771
61228
  length = expr["arguments"].length;
60772
61229
  itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF;
60773
- result = join29("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
61230
+ result = join30("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
60774
61231
  if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
60775
61232
  result.push("(");
60776
61233
  for (i = 0, iz = length;i < iz; ++i) {
@@ -60817,11 +61274,11 @@ var require_escodegen = __commonJS((exports) => {
60817
61274
  var result, fragment, rightCharCode, leftSource, leftCharCode;
60818
61275
  fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT);
60819
61276
  if (space === "") {
60820
- result = join29(expr.operator, fragment);
61277
+ result = join30(expr.operator, fragment);
60821
61278
  } else {
60822
61279
  result = [expr.operator];
60823
61280
  if (expr.operator.length > 2) {
60824
- result = join29(result, fragment);
61281
+ result = join30(result, fragment);
60825
61282
  } else {
60826
61283
  leftSource = toSourceNodeWhenNeeded(result).toString();
60827
61284
  leftCharCode = leftSource.charCodeAt(leftSource.length - 1);
@@ -60844,12 +61301,12 @@ var require_escodegen = __commonJS((exports) => {
60844
61301
  result = "yield";
60845
61302
  }
60846
61303
  if (expr.argument) {
60847
- result = join29(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
61304
+ result = join30(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
60848
61305
  }
60849
61306
  return parenthesize(result, Precedence.Yield, precedence);
60850
61307
  },
60851
61308
  AwaitExpression: function(expr, precedence, flags) {
60852
- var result = join29(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
61309
+ var result = join30(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
60853
61310
  return parenthesize(result, Precedence.Await, precedence);
60854
61311
  },
60855
61312
  UpdateExpression: function(expr, precedence, flags) {
@@ -60921,11 +61378,11 @@ var require_escodegen = __commonJS((exports) => {
60921
61378
  var result, fragment;
60922
61379
  result = ["class"];
60923
61380
  if (expr.id) {
60924
- result = join29(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
61381
+ result = join30(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
60925
61382
  }
60926
61383
  if (expr.superClass) {
60927
- fragment = join29("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
60928
- result = join29(result, fragment);
61384
+ fragment = join30("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
61385
+ result = join30(result, fragment);
60929
61386
  }
60930
61387
  result.push(space);
60931
61388
  result.push(this.generateStatement(expr.body, S_TFFT));
@@ -60940,7 +61397,7 @@ var require_escodegen = __commonJS((exports) => {
60940
61397
  }
60941
61398
  if (expr.kind === "get" || expr.kind === "set") {
60942
61399
  fragment = [
60943
- join29(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
61400
+ join30(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
60944
61401
  this.generateFunctionBody(expr.value)
60945
61402
  ];
60946
61403
  } else {
@@ -60950,7 +61407,7 @@ var require_escodegen = __commonJS((exports) => {
60950
61407
  this.generateFunctionBody(expr.value)
60951
61408
  ];
60952
61409
  }
60953
- return join29(result, fragment);
61410
+ return join30(result, fragment);
60954
61411
  },
60955
61412
  Property: function(expr, precedence, flags) {
60956
61413
  if (expr.kind === "get" || expr.kind === "set") {
@@ -61144,7 +61601,7 @@ var require_escodegen = __commonJS((exports) => {
61144
61601
  for (i = 0, iz = expr.blocks.length;i < iz; ++i) {
61145
61602
  fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT);
61146
61603
  if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) {
61147
- result = join29(result, fragment);
61604
+ result = join30(result, fragment);
61148
61605
  } else {
61149
61606
  result.push(fragment);
61150
61607
  }
@@ -61152,13 +61609,13 @@ var require_escodegen = __commonJS((exports) => {
61152
61609
  });
61153
61610
  }
61154
61611
  if (expr.filter) {
61155
- result = join29(result, "if" + space);
61612
+ result = join30(result, "if" + space);
61156
61613
  fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT);
61157
- result = join29(result, ["(", fragment, ")"]);
61614
+ result = join30(result, ["(", fragment, ")"]);
61158
61615
  }
61159
61616
  if (!extra.moz.comprehensionExpressionStartsWithAssignment) {
61160
61617
  fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
61161
- result = join29(result, fragment);
61618
+ result = join30(result, fragment);
61162
61619
  }
61163
61620
  result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]");
61164
61621
  return result;
@@ -61174,8 +61631,8 @@ var require_escodegen = __commonJS((exports) => {
61174
61631
  } else {
61175
61632
  fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT);
61176
61633
  }
61177
- fragment = join29(fragment, expr.of ? "of" : "in");
61178
- fragment = join29(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
61634
+ fragment = join30(fragment, expr.of ? "of" : "in");
61635
+ fragment = join30(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
61179
61636
  return ["for" + space + "(", fragment, ")"];
61180
61637
  },
61181
61638
  SpreadElement: function(expr, precedence, flags) {
@@ -67663,11 +68120,11 @@ var require_tslib = __commonJS((exports, module) => {
67663
68120
  };
67664
68121
  __awaiter2 = function(thisArg, _arguments, P, generator) {
67665
68122
  function adopt(value) {
67666
- return value instanceof P ? value : new P(function(resolve8) {
67667
- resolve8(value);
68123
+ return value instanceof P ? value : new P(function(resolve9) {
68124
+ resolve9(value);
67668
68125
  });
67669
68126
  }
67670
- return new (P || (P = Promise))(function(resolve8, reject) {
68127
+ return new (P || (P = Promise))(function(resolve9, reject) {
67671
68128
  function fulfilled(value) {
67672
68129
  try {
67673
68130
  step(generator.next(value));
@@ -67683,7 +68140,7 @@ var require_tslib = __commonJS((exports, module) => {
67683
68140
  }
67684
68141
  }
67685
68142
  function step(result) {
67686
- result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
68143
+ result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
67687
68144
  }
67688
68145
  step((generator = generator.apply(thisArg, _arguments || [])).next());
67689
68146
  });
@@ -67912,14 +68369,14 @@ var require_tslib = __commonJS((exports, module) => {
67912
68369
  }, i);
67913
68370
  function verb(n) {
67914
68371
  i[n] = o[n] && function(v) {
67915
- return new Promise(function(resolve8, reject) {
67916
- v = o[n](v), settle(resolve8, reject, v.done, v.value);
68372
+ return new Promise(function(resolve9, reject) {
68373
+ v = o[n](v), settle(resolve9, reject, v.done, v.value);
67917
68374
  });
67918
68375
  };
67919
68376
  }
67920
- function settle(resolve8, reject, d, v) {
68377
+ function settle(resolve9, reject, d, v) {
67921
68378
  Promise.resolve(v).then(function(v2) {
67922
- resolve8({ value: v2, done: d });
68379
+ resolve9({ value: v2, done: d });
67923
68380
  }, reject);
67924
68381
  }
67925
68382
  };
@@ -71158,12 +71615,12 @@ var require_util3 = __commonJS((exports) => {
71158
71615
  exports.isGMT = exports.dnsLookup = undefined;
71159
71616
  var dns_1 = __require("dns");
71160
71617
  function dnsLookup(host, opts) {
71161
- return new Promise((resolve8, reject) => {
71618
+ return new Promise((resolve9, reject) => {
71162
71619
  (0, dns_1.lookup)(host, opts, (err, res) => {
71163
71620
  if (err) {
71164
71621
  reject(err);
71165
71622
  } else {
71166
- resolve8(res);
71623
+ resolve9(res);
71167
71624
  }
71168
71625
  });
71169
71626
  });
@@ -71737,10 +72194,10 @@ var require_myIpAddress = __commonJS((exports) => {
71737
72194
  var ip_1 = require_ip();
71738
72195
  var net_1 = __importDefault(__require("net"));
71739
72196
  async function myIpAddress() {
71740
- return new Promise((resolve8, reject) => {
72197
+ return new Promise((resolve9, reject) => {
71741
72198
  const socket = net_1.default.connect({ host: "8.8.8.8", port: 53 });
71742
72199
  const onError = () => {
71743
- resolve8(ip_1.ip.address());
72200
+ resolve9(ip_1.ip.address());
71744
72201
  };
71745
72202
  socket.once("error", onError);
71746
72203
  socket.once("connect", () => {
@@ -71748,9 +72205,9 @@ var require_myIpAddress = __commonJS((exports) => {
71748
72205
  const addr = socket.address();
71749
72206
  socket.destroy();
71750
72207
  if (typeof addr === "string") {
71751
- resolve8(addr);
72208
+ resolve9(addr);
71752
72209
  } else if (addr.address) {
71753
- resolve8(addr.address);
72210
+ resolve9(addr.address);
71754
72211
  } else {
71755
72212
  reject(new Error("Expected a `string`"));
71756
72213
  }
@@ -72264,8 +72721,8 @@ var require_deferred_promise = __commonJS((exports) => {
72264
72721
  this.context = args.context;
72265
72722
  this.owner = args.context.runtime;
72266
72723
  this.handle = args.promiseHandle;
72267
- this.settled = new Promise((resolve8) => {
72268
- this.onSettled = resolve8;
72724
+ this.settled = new Promise((resolve9) => {
72725
+ this.onSettled = resolve9;
72269
72726
  });
72270
72727
  this.resolveHandle = args.resolveHandle;
72271
72728
  this.rejectHandle = args.rejectHandle;
@@ -72657,13 +73114,13 @@ var require_context = __commonJS((exports) => {
72657
73114
  if (vmResolveResult.error) {
72658
73115
  return Promise.resolve(vmResolveResult);
72659
73116
  }
72660
- return new Promise((resolve8) => {
73117
+ return new Promise((resolve9) => {
72661
73118
  lifetime_1.Scope.withScope((scope) => {
72662
73119
  const resolveHandle = scope.manage(this.newFunction("resolve", (value) => {
72663
- resolve8({ value: value && value.dup() });
73120
+ resolve9({ value: value && value.dup() });
72664
73121
  }));
72665
73122
  const rejectHandle = scope.manage(this.newFunction("reject", (error) => {
72666
- resolve8({ error: error && error.dup() });
73123
+ resolve9({ error: error && error.dup() });
72667
73124
  }));
72668
73125
  const promiseHandle = scope.manage(vmResolveResult.value);
72669
73126
  const promiseThenHandle = scope.manage(this.getProp(promiseHandle, "then"));
@@ -74777,13 +75234,13 @@ import * as http from "node:http";
74777
75234
  import * as https from "node:https";
74778
75235
  import { URL as URL2, urlToHttpOptions } from "node:url";
74779
75236
  function headHttpRequest(url) {
74780
- return new Promise((resolve8) => {
75237
+ return new Promise((resolve9) => {
74781
75238
  const request3 = httpRequest(url, "HEAD", (response) => {
74782
75239
  response.resume();
74783
- resolve8(response.statusCode === 200);
75240
+ resolve9(response.statusCode === 200);
74784
75241
  }, false);
74785
75242
  request3.on("error", () => {
74786
- resolve8(false);
75243
+ resolve9(false);
74787
75244
  });
74788
75245
  });
74789
75246
  }
@@ -74811,7 +75268,7 @@ function httpRequest(url, method, response, keepAlive = true) {
74811
75268
  return request3;
74812
75269
  }
74813
75270
  function downloadFile(url, destinationPath, progressCallback) {
74814
- return new Promise((resolve8, reject) => {
75271
+ return new Promise((resolve9, reject) => {
74815
75272
  let downloadedBytes = 0;
74816
75273
  let totalBytes = 0;
74817
75274
  function onData(chunk) {
@@ -74827,7 +75284,7 @@ function downloadFile(url, destinationPath, progressCallback) {
74827
75284
  }
74828
75285
  const file = createWriteStream(destinationPath);
74829
75286
  file.on("close", () => {
74830
- return resolve8();
75287
+ return resolve9();
74831
75288
  });
74832
75289
  file.on("error", (error) => {
74833
75290
  return reject(error);
@@ -74852,7 +75309,7 @@ async function getJSON(url) {
74852
75309
  }
74853
75310
  }
74854
75311
  function getText(url) {
74855
- return new Promise((resolve8, reject) => {
75312
+ return new Promise((resolve9, reject) => {
74856
75313
  const request3 = httpRequest(url, "GET", (response) => {
74857
75314
  let data = "";
74858
75315
  if (response.statusCode && response.statusCode >= 400) {
@@ -74863,7 +75320,7 @@ function getText(url) {
74863
75320
  });
74864
75321
  response.on("end", () => {
74865
75322
  try {
74866
- return resolve8(String(data));
75323
+ return resolve9(String(data));
74867
75324
  } catch {
74868
75325
  return reject(new Error(`Failed to read text response from ${url}`));
74869
75326
  }
@@ -76084,7 +76541,7 @@ class Process {
76084
76541
  if (opts.onExit) {
76085
76542
  this.#onExitHook = opts.onExit;
76086
76543
  }
76087
- this.#browserProcessExiting = new Promise((resolve8, reject) => {
76544
+ this.#browserProcessExiting = new Promise((resolve9, reject) => {
76088
76545
  this.#browserProcess.once("exit", async () => {
76089
76546
  debugLaunch(`Browser process ${this.#browserProcess.pid} onExit`);
76090
76547
  this.#clearListeners();
@@ -76095,7 +76552,7 @@ class Process {
76095
76552
  reject(err);
76096
76553
  return;
76097
76554
  }
76098
- resolve8();
76555
+ resolve9();
76099
76556
  });
76100
76557
  });
76101
76558
  }
@@ -76205,7 +76662,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
76205
76662
  return [...this.#logs];
76206
76663
  }
76207
76664
  waitForLineOutput(regex, timeout2 = 0) {
76208
- return new Promise((resolve8, reject) => {
76665
+ return new Promise((resolve9, reject) => {
76209
76666
  const onClose = (errorOrCode) => {
76210
76667
  cleanup();
76211
76668
  reject(new Error([
@@ -76243,7 +76700,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
76243
76700
  return;
76244
76701
  }
76245
76702
  cleanup();
76246
- resolve8(match[1]);
76703
+ resolve9(match[1]);
76247
76704
  }
76248
76705
  });
76249
76706
  }
@@ -76773,7 +77230,7 @@ var require_get_stream = __commonJS((exports, module) => {
76773
77230
  };
76774
77231
  const { maxBuffer } = options;
76775
77232
  let stream;
76776
- await new Promise((resolve8, reject) => {
77233
+ await new Promise((resolve9, reject) => {
76777
77234
  const rejectPromise = (error) => {
76778
77235
  if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
76779
77236
  error.bufferedData = stream.getBufferedValue();
@@ -76785,7 +77242,7 @@ var require_get_stream = __commonJS((exports, module) => {
76785
77242
  rejectPromise(error);
76786
77243
  return;
76787
77244
  }
76788
- resolve8();
77245
+ resolve9();
76789
77246
  });
76790
77247
  stream.on("data", () => {
76791
77248
  if (stream.getBufferedLength() > maxBuffer) {
@@ -78146,7 +78603,7 @@ var require_extract_zip = __commonJS((exports, module) => {
78146
78603
  debug4("opening", this.zipPath, "with opts", this.opts);
78147
78604
  this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
78148
78605
  this.canceled = false;
78149
- return new Promise((resolve8, reject) => {
78606
+ return new Promise((resolve9, reject) => {
78150
78607
  this.zipfile.on("error", (err) => {
78151
78608
  this.canceled = true;
78152
78609
  reject(err);
@@ -78155,7 +78612,7 @@ var require_extract_zip = __commonJS((exports, module) => {
78155
78612
  this.zipfile.on("close", () => {
78156
78613
  if (!this.canceled) {
78157
78614
  debug4("zip extraction complete");
78158
- resolve8();
78615
+ resolve9();
78159
78616
  }
78160
78617
  });
78161
78618
  this.zipfile.on("entry", async (entry) => {
@@ -79497,8 +79954,8 @@ var require_streamx = __commonJS((exports, module) => {
79497
79954
  return this;
79498
79955
  },
79499
79956
  next() {
79500
- return new Promise(function(resolve8, reject) {
79501
- promiseResolve = resolve8;
79957
+ return new Promise(function(resolve9, reject) {
79958
+ promiseResolve = resolve9;
79502
79959
  promiseReject = reject;
79503
79960
  const data = stream.read();
79504
79961
  if (data !== null)
@@ -79535,14 +79992,14 @@ var require_streamx = __commonJS((exports, module) => {
79535
79992
  }
79536
79993
  function destroy(err) {
79537
79994
  stream.destroy(err);
79538
- return new Promise((resolve8, reject) => {
79995
+ return new Promise((resolve9, reject) => {
79539
79996
  if (stream._duplexState & DESTROYED)
79540
- return resolve8({ value: undefined, done: true });
79997
+ return resolve9({ value: undefined, done: true });
79541
79998
  stream.once("close", function() {
79542
79999
  if (err)
79543
80000
  reject(err);
79544
80001
  else
79545
- resolve8({ value: undefined, done: true });
80002
+ resolve9({ value: undefined, done: true });
79546
80003
  });
79547
80004
  });
79548
80005
  }
@@ -79594,8 +80051,8 @@ var require_streamx = __commonJS((exports, module) => {
79594
80051
  return Promise.resolve(true);
79595
80052
  if (state.drains === null)
79596
80053
  state.drains = [];
79597
- return new Promise((resolve8) => {
79598
- state.drains.push({ writes, resolve: resolve8 });
80054
+ return new Promise((resolve9) => {
80055
+ state.drains.push({ writes, resolve: resolve9 });
79599
80056
  });
79600
80057
  }
79601
80058
  write(data) {
@@ -79709,11 +80166,11 @@ var require_streamx = __commonJS((exports, module) => {
79709
80166
  cb(null);
79710
80167
  }
79711
80168
  function pipelinePromise(...streams) {
79712
- return new Promise((resolve8, reject) => {
80169
+ return new Promise((resolve9, reject) => {
79713
80170
  return pipeline(...streams, (err) => {
79714
80171
  if (err)
79715
80172
  return reject(err);
79716
- resolve8();
80173
+ resolve9();
79717
80174
  });
79718
80175
  });
79719
80176
  }
@@ -80427,16 +80884,16 @@ var require_extract = __commonJS((exports, module) => {
80427
80884
  entryCallback = null;
80428
80885
  cb(err);
80429
80886
  }
80430
- function onnext(resolve8, reject) {
80887
+ function onnext(resolve9, reject) {
80431
80888
  if (error) {
80432
80889
  return reject(error);
80433
80890
  }
80434
80891
  if (entryStream) {
80435
- resolve8({ value: entryStream, done: false });
80892
+ resolve9({ value: entryStream, done: false });
80436
80893
  entryStream = null;
80437
80894
  return;
80438
80895
  }
80439
- promiseResolve = resolve8;
80896
+ promiseResolve = resolve9;
80440
80897
  promiseReject = reject;
80441
80898
  consumeCallback(null);
80442
80899
  if (extract._finished && promiseResolve) {
@@ -80467,14 +80924,14 @@ var require_extract = __commonJS((exports, module) => {
80467
80924
  function destroy(err) {
80468
80925
  extract.destroy(err);
80469
80926
  consumeCallback(err);
80470
- return new Promise((resolve8, reject) => {
80927
+ return new Promise((resolve9, reject) => {
80471
80928
  if (extract.destroyed)
80472
- return resolve8({ value: undefined, done: true });
80929
+ return resolve9({ value: undefined, done: true });
80473
80930
  extract.once("close", function() {
80474
80931
  if (err)
80475
80932
  reject(err);
80476
80933
  else
80477
- resolve8({ value: undefined, done: true });
80934
+ resolve9({ value: undefined, done: true });
80478
80935
  });
80479
80936
  });
80480
80937
  }
@@ -81142,7 +81599,7 @@ var require_tar_fs = __commonJS((exports) => {
81142
81599
  });
81143
81600
 
81144
81601
  // node_modules/@puppeteer/browsers/lib/esm/fileUtil.js
81145
- import { spawnSync as spawnSync2, spawn } from "node:child_process";
81602
+ import { spawnSync as spawnSync3, spawn } from "node:child_process";
81146
81603
  import { createReadStream } from "node:fs";
81147
81604
  import { mkdir, readdir } from "node:fs/promises";
81148
81605
  import * as path7 from "node:path";
@@ -81160,7 +81617,7 @@ async function unpackArchive(archivePath, folderPath) {
81160
81617
  await mkdir(folderPath);
81161
81618
  await installDMG(archivePath, folderPath);
81162
81619
  } else if (archivePath.endsWith(".exe")) {
81163
- const result = spawnSync2(archivePath, [`/ExtractDir=${folderPath}`], {
81620
+ const result = spawnSync3(archivePath, [`/ExtractDir=${folderPath}`], {
81164
81621
  env: {
81165
81622
  __compat_layer: "RunAsInvoker"
81166
81623
  }
@@ -81234,7 +81691,7 @@ async function extractTar(tarPath, folderPath, decompressUtilityName) {
81234
81691
  });
81235
81692
  }
81236
81693
  async function installDMG(dmgPath, folderPath) {
81237
- const { stdout } = spawnSync2(`hdiutil`, [
81694
+ const { stdout } = spawnSync3(`hdiutil`, [
81238
81695
  "attach",
81239
81696
  "-nobrowse",
81240
81697
  "-noautoopen",
@@ -81254,9 +81711,9 @@ async function installDMG(dmgPath, folderPath) {
81254
81711
  throw new Error(`Cannot find app in ${mountPath}`);
81255
81712
  }
81256
81713
  const mountedPath = path7.join(mountPath, appName);
81257
- spawnSync2("cp", ["-R", mountedPath, folderPath]);
81714
+ spawnSync3("cp", ["-R", mountedPath, folderPath]);
81258
81715
  } finally {
81259
- spawnSync2("hdiutil", ["detach", mountPath, "-quiet"]);
81716
+ spawnSync3("hdiutil", ["detach", mountPath, "-quiet"]);
81260
81717
  }
81261
81718
  }
81262
81719
  var import_debug4, debugFileUtil, internalConstantsForTesting;
@@ -81271,8 +81728,8 @@ var init_fileUtil = __esm(() => {
81271
81728
 
81272
81729
  // node_modules/@puppeteer/browsers/lib/esm/install.js
81273
81730
  import assert2 from "node:assert";
81274
- import { spawnSync as spawnSync3 } from "node:child_process";
81275
- import { existsSync as existsSync29, readFileSync as readFileSync23 } from "node:fs";
81731
+ import { spawnSync as spawnSync4 } from "node:child_process";
81732
+ import { existsSync as existsSync30, readFileSync as readFileSync24 } from "node:fs";
81276
81733
  import { mkdir as mkdir2, unlink } from "node:fs/promises";
81277
81734
  import os5 from "node:os";
81278
81735
  import path8 from "node:path";
@@ -81325,7 +81782,7 @@ async function installWithProviders(options) {
81325
81782
  continue;
81326
81783
  }
81327
81784
  debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
81328
- if (!existsSync29(browserRoot)) {
81785
+ if (!existsSync30(browserRoot)) {
81329
81786
  await mkdir2(browserRoot, { recursive: true });
81330
81787
  }
81331
81788
  return await installUrl(url, options, provider);
@@ -81358,21 +81815,21 @@ async function installDeps(installedBrowser) {
81358
81815
  return;
81359
81816
  }
81360
81817
  const depsPath = path8.join(path8.dirname(installedBrowser.executablePath), "deb.deps");
81361
- if (!existsSync29(depsPath)) {
81818
+ if (!existsSync30(depsPath)) {
81362
81819
  debugInstall(`deb.deps file was not found at ${depsPath}`);
81363
81820
  return;
81364
81821
  }
81365
- const data = readFileSync23(depsPath, "utf-8").split(`
81822
+ const data = readFileSync24(depsPath, "utf-8").split(`
81366
81823
  `).join(",");
81367
81824
  if (process.getuid?.() !== 0) {
81368
81825
  throw new Error("Installing system dependencies requires root privileges");
81369
81826
  }
81370
- let result = spawnSync3("apt-get", ["-v"]);
81827
+ let result = spawnSync4("apt-get", ["-v"]);
81371
81828
  if (result.status !== 0) {
81372
81829
  throw new Error("Failed to install system dependencies: apt-get does not seem to be available");
81373
81830
  }
81374
81831
  debugInstall(`Trying to install dependencies: ${data}`);
81375
- result = spawnSync3("apt-get", [
81832
+ result = spawnSync4("apt-get", [
81376
81833
  "satisfy",
81377
81834
  "-y",
81378
81835
  data,
@@ -81400,11 +81857,11 @@ async function installUrl(url, options, provider) {
81400
81857
  const cache = new Cache(options.cacheDir);
81401
81858
  const browserRoot = cache.browserRoot(options.browser);
81402
81859
  const archivePath = path8.join(browserRoot, `${options.buildId}-${fileName}`);
81403
- if (!existsSync29(browserRoot)) {
81860
+ if (!existsSync30(browserRoot)) {
81404
81861
  await mkdir2(browserRoot, { recursive: true });
81405
81862
  }
81406
81863
  if (!options.unpack) {
81407
- if (existsSync29(archivePath)) {
81864
+ if (existsSync30(archivePath)) {
81408
81865
  return archivePath;
81409
81866
  }
81410
81867
  debugInstall(`Downloading binary from ${url}`);
@@ -81425,8 +81882,8 @@ async function installUrl(url, options, provider) {
81425
81882
  cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath6);
81426
81883
  }
81427
81884
  try {
81428
- if (existsSync29(outputPath)) {
81429
- if (!existsSync29(installedBrowser.executablePath)) {
81885
+ if (existsSync30(outputPath)) {
81886
+ if (!existsSync30(installedBrowser.executablePath)) {
81430
81887
  throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
81431
81888
  }
81432
81889
  await runSetup(installedBrowser);
@@ -81435,7 +81892,7 @@ async function installUrl(url, options, provider) {
81435
81892
  }
81436
81893
  return installedBrowser;
81437
81894
  }
81438
- if (!existsSync29(archivePath)) {
81895
+ if (!existsSync30(archivePath)) {
81439
81896
  debugInstall(`Downloading binary from ${url}`);
81440
81897
  try {
81441
81898
  debugTime("download");
@@ -81464,7 +81921,7 @@ async function installUrl(url, options, provider) {
81464
81921
  }
81465
81922
  return installedBrowser;
81466
81923
  } finally {
81467
- if (existsSync29(archivePath)) {
81924
+ if (existsSync30(archivePath)) {
81468
81925
  await unlink(archivePath);
81469
81926
  }
81470
81927
  }
@@ -81475,10 +81932,10 @@ async function runSetup(installedBrowser) {
81475
81932
  debugTime("permissions");
81476
81933
  const browserDir = path8.dirname(installedBrowser.executablePath);
81477
81934
  const setupExePath = path8.join(browserDir, "setup.exe");
81478
- if (!existsSync29(setupExePath)) {
81935
+ if (!existsSync30(setupExePath)) {
81479
81936
  return;
81480
81937
  }
81481
- spawnSync3(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
81938
+ spawnSync4(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
81482
81939
  shell: true
81483
81940
  });
81484
81941
  } finally {
@@ -81856,19 +82313,19 @@ var init_cliui = __esm(() => {
81856
82313
  });
81857
82314
 
81858
82315
  // node_modules/escalade/sync/index.mjs
81859
- import { dirname as dirname12, resolve as resolve9 } from "path";
82316
+ import { dirname as dirname13, resolve as resolve10 } from "path";
81860
82317
  import { readdirSync as readdirSync10, statSync as statSync12 } from "fs";
81861
82318
  function sync_default(start, callback) {
81862
- let dir = resolve9(".", start);
82319
+ let dir = resolve10(".", start);
81863
82320
  let tmp, stats = statSync12(dir);
81864
82321
  if (!stats.isDirectory()) {
81865
- dir = dirname12(dir);
82322
+ dir = dirname13(dir);
81866
82323
  }
81867
82324
  while (true) {
81868
82325
  tmp = callback(dir, readdirSync10(dir));
81869
82326
  if (tmp)
81870
- return resolve9(dir, tmp);
81871
- dir = dirname12(tmp = dir);
82327
+ return resolve10(dir, tmp);
82328
+ dir = dirname13(tmp = dir);
81872
82329
  if (tmp === dir)
81873
82330
  break;
81874
82331
  }
@@ -82814,7 +83271,7 @@ var init_yargs_parser = __esm(() => {
82814
83271
 
82815
83272
  // node_modules/yargs-parser/build/lib/index.js
82816
83273
  import { format } from "util";
82817
- import { normalize as normalize2, resolve as resolve10 } from "path";
83274
+ import { normalize as normalize2, resolve as resolve11 } from "path";
82818
83275
  var _a3, _b, _c, minNodeVersion, nodeVersion, env, parser, yargsParser = function Parser(args, opts) {
82819
83276
  const result = parser.parse(args.slice(), opts);
82820
83277
  return result.argv;
@@ -82837,7 +83294,7 @@ var init_lib2 = __esm(() => {
82837
83294
  },
82838
83295
  format,
82839
83296
  normalize: normalize2,
82840
- resolve: resolve10,
83297
+ resolve: resolve11,
82841
83298
  require: (path9) => {
82842
83299
  if (true) {
82843
83300
  return __require(path9);
@@ -82888,18 +83345,18 @@ var init_yerror = __esm(() => {
82888
83345
  });
82889
83346
 
82890
83347
  // node_modules/y18n/build/lib/platform-shims/node.js
82891
- import { readFileSync as readFileSync24, statSync as statSync13, writeFile } from "fs";
83348
+ import { readFileSync as readFileSync25, statSync as statSync13, writeFile } from "fs";
82892
83349
  import { format as format2 } from "util";
82893
- import { resolve as resolve11 } from "path";
83350
+ import { resolve as resolve12 } from "path";
82894
83351
  var node_default;
82895
83352
  var init_node = __esm(() => {
82896
83353
  node_default = {
82897
83354
  fs: {
82898
- readFileSync: readFileSync24,
83355
+ readFileSync: readFileSync25,
82899
83356
  writeFile
82900
83357
  },
82901
83358
  format: format2,
82902
- resolve: resolve11,
83359
+ resolve: resolve12,
82903
83360
  exists: (file) => {
82904
83361
  try {
82905
83362
  return statSync13(file).isFile();
@@ -83080,9 +83537,9 @@ var init_y18n = __esm(() => {
83080
83537
  // node_modules/yargs/lib/platform-shims/esm.mjs
83081
83538
  import { notStrictEqual, strictEqual } from "assert";
83082
83539
  import { inspect } from "util";
83083
- import { readFileSync as readFileSync25 } from "fs";
83540
+ import { readFileSync as readFileSync26 } from "fs";
83084
83541
  import { fileURLToPath } from "url";
83085
- import { basename as basename9, dirname as dirname13, extname as extname3, relative as relative7, resolve as resolve12 } from "path";
83542
+ import { basename as basename9, dirname as dirname14, extname as extname3, relative as relative7, resolve as resolve13 } from "path";
83086
83543
  var REQUIRE_ERROR = "require is not supported by ESM", REQUIRE_DIRECTORY_ERROR = "loading a directory of commands is not supported yet for ESM", __dirname2, mainFilename, esm_default;
83087
83544
  var init_esm = __esm(() => {
83088
83545
  init_cliui();
@@ -83115,10 +83572,10 @@ var init_esm = __esm(() => {
83115
83572
  Parser: lib_default,
83116
83573
  path: {
83117
83574
  basename: basename9,
83118
- dirname: dirname13,
83575
+ dirname: dirname14,
83119
83576
  extname: extname3,
83120
83577
  relative: relative7,
83121
- resolve: resolve12
83578
+ resolve: resolve13
83122
83579
  },
83123
83580
  process: {
83124
83581
  argv: () => process.argv,
@@ -83129,7 +83586,7 @@ var init_esm = __esm(() => {
83129
83586
  nextTick: process.nextTick,
83130
83587
  stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
83131
83588
  },
83132
- readFileSync: readFileSync25,
83589
+ readFileSync: readFileSync26,
83133
83590
  require: () => {
83134
83591
  throw new YError(REQUIRE_ERROR);
83135
83592
  },
@@ -83140,7 +83597,7 @@ var init_esm = __esm(() => {
83140
83597
  return [...str].length;
83141
83598
  },
83142
83599
  y18n: y18n_default({
83143
- directory: resolve12(__dirname2, "../../../locales"),
83600
+ directory: resolve13(__dirname2, "../../../locales"),
83144
83601
  updateFiles: false
83145
83602
  })
83146
83603
  };
@@ -83197,7 +83654,7 @@ function parseCommand(cmd) {
83197
83654
 
83198
83655
  // node_modules/yargs/build/lib/argsert.js
83199
83656
  function argsert(arg1, arg2, arg3) {
83200
- function parseArgs2() {
83657
+ function parseArgs3() {
83201
83658
  return typeof arg1 === "object" ? [{ demanded: [], optional: [] }, arg1, arg2] : [
83202
83659
  parseCommand(`cmd ${arg1}`),
83203
83660
  arg2,
@@ -83206,7 +83663,7 @@ function argsert(arg1, arg2, arg3) {
83206
83663
  }
83207
83664
  try {
83208
83665
  let position = 0;
83209
- const [parsed, callerArguments, _length] = parseArgs2();
83666
+ const [parsed, callerArguments, _length] = parseArgs3();
83210
83667
  const args = [].slice.call(callerArguments);
83211
83668
  while (args.length && args[args.length - 1] === undefined)
83212
83669
  args.pop();
@@ -85388,12 +85845,12 @@ var init_yargs_factory = __esm(() => {
85388
85845
  async getCompletion(args, done) {
85389
85846
  argsert("<array> [function]", [args, done], arguments.length);
85390
85847
  if (!done) {
85391
- return new Promise((resolve13, reject) => {
85848
+ return new Promise((resolve14, reject) => {
85392
85849
  __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
85393
85850
  if (err)
85394
85851
  reject(err);
85395
85852
  else
85396
- resolve13(completions);
85853
+ resolve14(completions);
85397
85854
  });
85398
85855
  });
85399
85856
  } else {
@@ -86828,9 +87285,9 @@ async function getConnectionTransport(options) {
86828
87285
  throw new Error("Could not detect required browser platform");
86829
87286
  }
86830
87287
  const { convertPuppeteerChannelToBrowsersChannel: convertPuppeteerChannelToBrowsersChannel2 } = await Promise.resolve().then(() => (init_LaunchOptions(), exports_LaunchOptions));
86831
- const { join: join30 } = await import("node:path");
87288
+ const { join: join31 } = await import("node:path");
86832
87289
  const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform2, convertPuppeteerChannelToBrowsersChannel2(options.channel));
86833
- const portPath = join30(userDataDir, "DevToolsActivePort");
87290
+ const portPath = join31(userDataDir, "DevToolsActivePort");
86834
87291
  try {
86835
87292
  const fileContent = await environment.value.fs.promises.readFile(portPath, "ascii");
86836
87293
  const [rawPort, rawPath] = fileContent.split(`
@@ -87054,9 +87511,9 @@ var init_PipeTransport = __esm(() => {
87054
87511
  });
87055
87512
 
87056
87513
  // node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js
87057
- import { existsSync as existsSync30 } from "node:fs";
87514
+ import { existsSync as existsSync31 } from "node:fs";
87058
87515
  import { tmpdir } from "node:os";
87059
- import { join as join30 } from "node:path";
87516
+ import { join as join31 } from "node:path";
87060
87517
 
87061
87518
  class BrowserLauncher {
87062
87519
  #browser;
@@ -87081,7 +87538,7 @@ class BrowserLauncher {
87081
87538
  ...options,
87082
87539
  protocol
87083
87540
  });
87084
- if (!existsSync30(launchArgs.executablePath)) {
87541
+ if (!existsSync31(launchArgs.executablePath)) {
87085
87542
  throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
87086
87543
  }
87087
87544
  const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
@@ -87156,7 +87613,7 @@ class BrowserLauncher {
87156
87613
  browserCloseCallback();
87157
87614
  const logs = browserProcess.getRecentLogs().join(`
87158
87615
  `);
87159
- if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync30(join30(launchArgs.userDataDir, "lockfile"))) {
87616
+ if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync31(join31(launchArgs.userDataDir, "lockfile"))) {
87160
87617
  throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
87161
87618
  }
87162
87619
  if (logs.includes("Missing X server") && options.headless === false) {
@@ -87246,12 +87703,12 @@ class BrowserLauncher {
87246
87703
  });
87247
87704
  }
87248
87705
  getProfilePath() {
87249
- return join30(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
87706
+ return join31(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
87250
87707
  }
87251
87708
  resolveExecutablePath(headless, validatePath = true) {
87252
87709
  let executablePath = this.puppeteer.configuration.executablePath;
87253
87710
  if (executablePath) {
87254
- if (validatePath && !existsSync30(executablePath)) {
87711
+ if (validatePath && !existsSync31(executablePath)) {
87255
87712
  throw new Error(`Tried to find the browser at the configured path (${executablePath}), but no executable was found.`);
87256
87713
  }
87257
87714
  return executablePath;
@@ -87274,7 +87731,7 @@ class BrowserLauncher {
87274
87731
  browser: browserType,
87275
87732
  buildId: this.puppeteer.browserVersion
87276
87733
  });
87277
- if (validatePath && !existsSync30(executablePath)) {
87734
+ if (validatePath && !existsSync31(executablePath)) {
87278
87735
  const configVersion = this.puppeteer.configuration?.[this.browser]?.version;
87279
87736
  if (configVersion) {
87280
87737
  throw new Error(`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`);
@@ -87809,10 +88266,10 @@ var init_PuppeteerNode = __esm(() => {
87809
88266
  });
87810
88267
 
87811
88268
  // node_modules/puppeteer-core/lib/esm/puppeteer/node/ScreenRecorder.js
87812
- import { spawn as spawn2, spawnSync as spawnSync4 } from "node:child_process";
88269
+ import { spawn as spawn2, spawnSync as spawnSync5 } from "node:child_process";
87813
88270
  import fs5 from "node:fs";
87814
88271
  import os8 from "node:os";
87815
- import { dirname as dirname14 } from "node:path";
88272
+ import { dirname as dirname15 } from "node:path";
87816
88273
  import { PassThrough } from "node:stream";
87817
88274
  var import_debug6, __runInitializers22 = function(thisArg, initializers, value) {
87818
88275
  var useValue = arguments.length > 2;
@@ -87886,8 +88343,8 @@ var init_ScreenRecorder = __esm(() => {
87886
88343
  static {
87887
88344
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : undefined;
87888
88345
  __esDecorate22(this, _private_writeFrame_descriptor = { value: __setFunctionName5(async function(buffer) {
87889
- const error = await new Promise((resolve13) => {
87890
- this.#process.stdin.write(buffer, resolve13);
88346
+ const error = await new Promise((resolve14) => {
88347
+ this.#process.stdin.write(buffer, resolve14);
87891
88348
  });
87892
88349
  if (error) {
87893
88350
  console.log(`ffmpeg failed to write: ${error.message}.`);
@@ -87913,7 +88370,7 @@ var init_ScreenRecorder = __esm(() => {
87913
88370
  colors ??= 256;
87914
88371
  overwrite ??= true;
87915
88372
  this.#fps = fps;
87916
- const { error } = spawnSync4(ffmpegPath);
88373
+ const { error } = spawnSync5(ffmpegPath);
87917
88374
  if (error) {
87918
88375
  throw error;
87919
88376
  }
@@ -87936,7 +88393,7 @@ var init_ScreenRecorder = __esm(() => {
87936
88393
  filters.push(formatArgs.splice(vf, 2).at(-1) ?? "");
87937
88394
  }
87938
88395
  if (path11) {
87939
- fs5.mkdirSync(dirname14(path11), { recursive: overwrite });
88396
+ fs5.mkdirSync(dirname15(path11), { recursive: overwrite });
87940
88397
  }
87941
88398
  this.#process = spawn2(ffmpegPath, [
87942
88399
  ["-loglevel", "error"],
@@ -88042,8 +88499,8 @@ var init_ScreenRecorder = __esm(() => {
88042
88499
  const [buffer, timestamp] = await this.#lastFrame;
88043
88500
  await Promise.all(Array(Math.max(1, Math.round(this.#fps * (performance.now() - timestamp) / 1000))).fill(buffer).map(this.#writeFrame.bind(this)));
88044
88501
  this.#process.stdin.end();
88045
- await new Promise((resolve13) => {
88046
- this.#process.once("close", resolve13);
88502
+ await new Promise((resolve14) => {
88503
+ this.#process.once("close", resolve14);
88047
88504
  });
88048
88505
  }
88049
88506
  async[(_private_writeFrame_decorators = [guarded()], _stop_decorators = [guarded()], asyncDisposeSymbol)]() {
@@ -88089,17 +88546,17 @@ var init_puppeteer_core = __esm(() => {
88089
88546
  });
88090
88547
 
88091
88548
  // src/core/design-eval/capture.ts
88092
- import { mkdirSync as mkdirSync14, statSync as statSync14, existsSync as existsSync31 } from "fs";
88093
- import { join as join31 } from "path";
88549
+ import { mkdirSync as mkdirSync14, statSync as statSync14, existsSync as existsSync32 } from "fs";
88550
+ import { join as join32 } from "path";
88094
88551
  function findBrowser() {
88095
88552
  const platform2 = process.platform;
88096
88553
  const paths = CHROME_PATHS[platform2] ?? [];
88097
88554
  for (const p of paths) {
88098
- if (existsSync31(p))
88555
+ if (existsSync32(p))
88099
88556
  return p;
88100
88557
  }
88101
- const minkBrowsers = join31(minkRoot(), "browsers");
88102
- if (existsSync31(minkBrowsers)) {
88558
+ const minkBrowsers = join32(minkRoot(), "browsers");
88559
+ if (existsSync32(minkBrowsers)) {
88103
88560
  const found = findChromeInDir(minkBrowsers);
88104
88561
  if (found)
88105
88562
  return found;
@@ -88120,7 +88577,7 @@ function findChromeInDir(dir) {
88120
88577
  try {
88121
88578
  const entries = readdirSync11(dir);
88122
88579
  for (const entry of entries) {
88123
- const full = join31(dir, entry);
88580
+ const full = join32(dir, entry);
88124
88581
  try {
88125
88582
  const stat2 = statSync15(full);
88126
88583
  if (stat2.isDirectory()) {
@@ -88168,7 +88625,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
88168
88625
  const y = section * viewport.height;
88169
88626
  const clipHeight = Math.min(viewport.height, pageHeight - y);
88170
88627
  const fileName = `${prefix}-${viewport.name}-${section}.jpg`;
88171
- const filePath = join31(options.outputDir, fileName);
88628
+ const filePath = join32(options.outputDir, fileName);
88172
88629
  await page.screenshot({
88173
88630
  path: filePath,
88174
88631
  type: "jpeg",
@@ -89632,8 +90089,8 @@ var exports_wiki = {};
89632
90089
  __export(exports_wiki, {
89633
90090
  wiki: () => wiki
89634
90091
  });
89635
- import { existsSync as existsSync32, statSync as statSync15 } from "fs";
89636
- import { resolve as resolve13 } from "path";
90092
+ import { existsSync as existsSync33, statSync as statSync15 } from "fs";
90093
+ import { resolve as resolve14 } from "path";
89637
90094
  import { homedir as homedir5 } from "os";
89638
90095
  async function wiki(_cwd, args) {
89639
90096
  const sub = args[0];
@@ -89688,7 +90145,7 @@ async function wikiInit(args) {
89688
90145
  console.log(`[mink] initializing vault at ${targetPath}`);
89689
90146
  console.log(" (set a custom path with: mink wiki init /path/to/vault)");
89690
90147
  }
89691
- const isExisting = existsSync32(targetPath) && statSync15(targetPath).isDirectory();
90148
+ const isExisting = existsSync33(targetPath) && statSync15(targetPath).isDirectory();
89692
90149
  setConfigValue("wiki.path", targetPath);
89693
90150
  ensureVaultStructure();
89694
90151
  seedTemplates(vaultTemplates());
@@ -89892,9 +90349,9 @@ function wikiLinks() {
89892
90349
  }
89893
90350
  function expandPath(raw) {
89894
90351
  if (raw.startsWith("~/")) {
89895
- return resolve13(homedir5(), raw.slice(2));
90352
+ return resolve14(homedir5(), raw.slice(2));
89896
90353
  }
89897
- return resolve13(raw);
90354
+ return resolve14(raw);
89898
90355
  }
89899
90356
  var init_wiki = __esm(() => {
89900
90357
  init_vault();
@@ -89910,8 +90367,8 @@ var exports_note = {};
89910
90367
  __export(exports_note, {
89911
90368
  note: () => note
89912
90369
  });
89913
- import { resolve as resolve14 } from "path";
89914
- import { existsSync as existsSync33, readFileSync as readFileSync26 } from "fs";
90370
+ import { resolve as resolve15 } from "path";
90371
+ import { existsSync as existsSync34, readFileSync as readFileSync27 } from "fs";
89915
90372
  async function note(cwd, args) {
89916
90373
  if (!isWikiEnabled()) {
89917
90374
  console.error("[mink] wiki feature is disabled");
@@ -89936,13 +90393,13 @@ async function note(cwd, args) {
89936
90393
  const date = new Date().toISOString().split("T")[0];
89937
90394
  const content = parsed.positional || parsed.body || "";
89938
90395
  const filePath = appendToDaily(date, content);
89939
- updateVaultIndexForFile(filePath, readFileSync26(filePath, "utf-8"));
90396
+ updateVaultIndexForFile(filePath, readFileSync27(filePath, "utf-8"));
89940
90397
  console.log(`[mink] daily note: ${filePath}`);
89941
90398
  return;
89942
90399
  }
89943
90400
  if (parsed.file) {
89944
- const sourcePath = resolve14(cwd, parsed.file);
89945
- if (!existsSync33(sourcePath)) {
90401
+ const sourcePath = resolve15(cwd, parsed.file);
90402
+ if (!existsSync34(sourcePath)) {
89946
90403
  console.error(`[mink] file not found: ${sourcePath}`);
89947
90404
  process.exit(1);
89948
90405
  }
@@ -90103,10 +90560,10 @@ var exports_skill = {};
90103
90560
  __export(exports_skill, {
90104
90561
  skill: () => skill
90105
90562
  });
90106
- import { join as join32, resolve as resolve15, dirname as dirname15 } from "path";
90563
+ import { join as join33, resolve as resolve16, dirname as dirname16 } from "path";
90107
90564
  import { homedir as homedir6 } from "os";
90108
90565
  import {
90109
- existsSync as existsSync34,
90566
+ existsSync as existsSync35,
90110
90567
  mkdirSync as mkdirSync15,
90111
90568
  copyFileSync,
90112
90569
  unlinkSync as unlinkSync6,
@@ -90116,26 +90573,26 @@ import {
90116
90573
  lstatSync as lstatSync2
90117
90574
  } from "fs";
90118
90575
  function getSkillsSourceDir() {
90119
- let dir = dirname15(new URL(import.meta.url).pathname);
90576
+ let dir = dirname16(new URL(import.meta.url).pathname);
90120
90577
  while (true) {
90121
- if (existsSync34(join32(dir, "package.json")) && existsSync34(join32(dir, "skills"))) {
90122
- return join32(dir, "skills");
90578
+ if (existsSync35(join33(dir, "package.json")) && existsSync35(join33(dir, "skills"))) {
90579
+ return join33(dir, "skills");
90123
90580
  }
90124
- const parent = dirname15(dir);
90581
+ const parent = dirname16(dir);
90125
90582
  if (parent === dir)
90126
90583
  break;
90127
90584
  dir = parent;
90128
90585
  }
90129
- return resolve15(dirname15(new URL(import.meta.url).pathname), "../../skills");
90586
+ return resolve16(dirname16(new URL(import.meta.url).pathname), "../../skills");
90130
90587
  }
90131
90588
  function getAvailableSkills() {
90132
90589
  const dir = getSkillsSourceDir();
90133
- if (!existsSync34(dir))
90590
+ if (!existsSync35(dir))
90134
90591
  return [];
90135
- return readdirSync11(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync34(join32(dir, d.name, "SKILL.md"))).map((d) => d.name);
90592
+ return readdirSync11(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync35(join33(dir, d.name, "SKILL.md"))).map((d) => d.name);
90136
90593
  }
90137
90594
  function isInstalled(skillName) {
90138
- return existsSync34(join32(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
90595
+ return existsSync35(join33(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
90139
90596
  }
90140
90597
  async function skill(args) {
90141
90598
  const sub = args[0];
@@ -90171,26 +90628,26 @@ function skillInstall(name) {
90171
90628
  }
90172
90629
  mkdirSync15(AGENTS_SKILLS_DIR, { recursive: true });
90173
90630
  for (const skillName of skills) {
90174
- const srcDir = join32(sourceDir, skillName);
90175
- const srcFile = join32(srcDir, "SKILL.md");
90176
- const destDir = join32(AGENTS_SKILLS_DIR, skillName);
90177
- if (!existsSync34(srcFile)) {
90631
+ const srcDir = join33(sourceDir, skillName);
90632
+ const srcFile = join33(srcDir, "SKILL.md");
90633
+ const destDir = join33(AGENTS_SKILLS_DIR, skillName);
90634
+ if (!existsSync35(srcFile)) {
90178
90635
  console.error(`[mink] skill not found: ${skillName}`);
90179
90636
  continue;
90180
90637
  }
90181
90638
  mkdirSync15(destDir, { recursive: true });
90182
90639
  copyDirRecursive(srcDir, destDir);
90183
90640
  mkdirSync15(CLAUDE_SKILLS_DIR, { recursive: true });
90184
- const symlink = join32(CLAUDE_SKILLS_DIR, skillName);
90641
+ const symlink = join33(CLAUDE_SKILLS_DIR, skillName);
90185
90642
  try {
90186
- if (existsSync34(symlink)) {
90643
+ if (existsSync35(symlink)) {
90187
90644
  if (lstatSync2(symlink).isSymbolicLink() || lstatSync2(symlink).isFile()) {
90188
90645
  unlinkSync6(symlink);
90189
90646
  } else {
90190
90647
  rmSync(symlink, { recursive: true, force: true });
90191
90648
  }
90192
90649
  }
90193
- const relativeTarget = join32("..", "..", ".agents", "skills", skillName);
90650
+ const relativeTarget = join33("..", "..", ".agents", "skills", skillName);
90194
90651
  symlinkSync2(relativeTarget, symlink);
90195
90652
  } catch {}
90196
90653
  console.log(`[mink] installed: ${skillName} -> ${destDir}`);
@@ -90201,15 +90658,15 @@ function skillInstall(name) {
90201
90658
  function skillUninstall(name) {
90202
90659
  const skills = name ? [name] : getAvailableSkills();
90203
90660
  for (const skillName of skills) {
90204
- const destDir = join32(AGENTS_SKILLS_DIR, skillName);
90205
- if (!existsSync34(destDir)) {
90661
+ const destDir = join33(AGENTS_SKILLS_DIR, skillName);
90662
+ if (!existsSync35(destDir)) {
90206
90663
  console.log(`[mink] not installed: ${skillName}`);
90207
90664
  continue;
90208
90665
  }
90209
90666
  rmSync(destDir, { recursive: true, force: true });
90210
- const symlink = join32(CLAUDE_SKILLS_DIR, skillName);
90667
+ const symlink = join33(CLAUDE_SKILLS_DIR, skillName);
90211
90668
  try {
90212
- if (existsSync34(symlink))
90669
+ if (existsSync35(symlink))
90213
90670
  unlinkSync6(symlink);
90214
90671
  } catch {}
90215
90672
  console.log(`[mink] uninstalled: ${skillName}`);
@@ -90224,7 +90681,7 @@ function skillList() {
90224
90681
  if (installed.length > 0) {
90225
90682
  console.log(" Installed:");
90226
90683
  for (const s of installed) {
90227
- console.log(` ${s} (${join32(AGENTS_SKILLS_DIR, s)})`);
90684
+ console.log(` ${s} (${join33(AGENTS_SKILLS_DIR, s)})`);
90228
90685
  }
90229
90686
  }
90230
90687
  if (notInstalled.length > 0) {
@@ -90243,8 +90700,8 @@ function skillList() {
90243
90700
  function copyDirRecursive(src, dest) {
90244
90701
  const entries = readdirSync11(src, { withFileTypes: true });
90245
90702
  for (const entry of entries) {
90246
- const srcPath = join32(src, entry.name);
90247
- const destPath = join32(dest, entry.name);
90703
+ const srcPath = join33(src, entry.name);
90704
+ const destPath = join33(dest, entry.name);
90248
90705
  if (entry.isDirectory()) {
90249
90706
  mkdirSync15(destPath, { recursive: true });
90250
90707
  copyDirRecursive(srcPath, destPath);
@@ -90255,8 +90712,8 @@ function copyDirRecursive(src, dest) {
90255
90712
  }
90256
90713
  var AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR;
90257
90714
  var init_skill = __esm(() => {
90258
- AGENTS_SKILLS_DIR = join32(homedir6(), ".agents", "skills");
90259
- CLAUDE_SKILLS_DIR = join32(homedir6(), ".claude", "skills");
90715
+ AGENTS_SKILLS_DIR = join33(homedir6(), ".agents", "skills");
90716
+ CLAUDE_SKILLS_DIR = join33(homedir6(), ".claude", "skills");
90260
90717
  });
90261
90718
 
90262
90719
  // src/commands/agent.ts
@@ -90264,41 +90721,41 @@ var exports_agent = {};
90264
90721
  __export(exports_agent, {
90265
90722
  agent: () => agent
90266
90723
  });
90267
- import { join as join33, resolve as resolve16, dirname as dirname16 } from "path";
90724
+ import { join as join34, resolve as resolve17, dirname as dirname17 } from "path";
90268
90725
  import { homedir as homedir7 } from "os";
90269
90726
  import {
90270
- existsSync as existsSync35,
90727
+ existsSync as existsSync36,
90271
90728
  mkdirSync as mkdirSync16,
90272
- readFileSync as readFileSync27,
90729
+ readFileSync as readFileSync28,
90273
90730
  writeFileSync as writeFileSync11
90274
90731
  } from "fs";
90275
90732
  import { createHash as createHash3 } from "crypto";
90276
- import { spawnSync as spawnSync5 } from "child_process";
90733
+ import { spawnSync as spawnSync6 } from "child_process";
90277
90734
  function getAgentTemplatePath() {
90278
- let dir = dirname16(new URL(import.meta.url).pathname);
90735
+ let dir = dirname17(new URL(import.meta.url).pathname);
90279
90736
  while (true) {
90280
- if (existsSync35(join33(dir, "package.json")) && existsSync35(join33(dir, "agents", TEMPLATE_FILE))) {
90281
- return join33(dir, "agents", TEMPLATE_FILE);
90737
+ if (existsSync36(join34(dir, "package.json")) && existsSync36(join34(dir, "agents", TEMPLATE_FILE))) {
90738
+ return join34(dir, "agents", TEMPLATE_FILE);
90282
90739
  }
90283
- const parent = dirname16(dir);
90740
+ const parent = dirname17(dir);
90284
90741
  if (parent === dir)
90285
90742
  break;
90286
90743
  dir = parent;
90287
90744
  }
90288
- return resolve16(dirname16(new URL(import.meta.url).pathname), "../../agents", TEMPLATE_FILE);
90745
+ return resolve17(dirname17(new URL(import.meta.url).pathname), "../../agents", TEMPLATE_FILE);
90289
90746
  }
90290
90747
  function getMinkVersion() {
90291
- let dir = dirname16(new URL(import.meta.url).pathname);
90748
+ let dir = dirname17(new URL(import.meta.url).pathname);
90292
90749
  while (true) {
90293
- const pkgPath = join33(dir, "package.json");
90294
- if (existsSync35(pkgPath)) {
90750
+ const pkgPath = join34(dir, "package.json");
90751
+ if (existsSync36(pkgPath)) {
90295
90752
  try {
90296
- const pkg = JSON.parse(readFileSync27(pkgPath, "utf-8"));
90753
+ const pkg = JSON.parse(readFileSync28(pkgPath, "utf-8"));
90297
90754
  if (pkg.name && pkg.version)
90298
90755
  return pkg.version;
90299
90756
  } catch {}
90300
90757
  }
90301
- const parent = dirname16(dir);
90758
+ const parent = dirname17(dir);
90302
90759
  if (parent === dir)
90303
90760
  break;
90304
90761
  dir = parent;
@@ -90316,30 +90773,30 @@ function sha2562(text) {
90316
90773
  return createHash3("sha256").update(text).digest("hex");
90317
90774
  }
90318
90775
  function claudeAgentsDir() {
90319
- return join33(homedir7(), ".claude", "agents");
90776
+ return join34(homedir7(), ".claude", "agents");
90320
90777
  }
90321
90778
  function installedAgentPath() {
90322
- return join33(claudeAgentsDir(), INSTALLED_FILE);
90779
+ return join34(claudeAgentsDir(), INSTALLED_FILE);
90323
90780
  }
90324
90781
  function installAgentDefinition(opts) {
90325
90782
  const templatePath = getAgentTemplatePath();
90326
- if (!existsSync35(templatePath)) {
90783
+ if (!existsSync36(templatePath)) {
90327
90784
  throw new Error(`[mink agent] bundled agent template not found at ${templatePath}
90328
90785
  ` + " This usually means the package was installed without bundled assets.");
90329
90786
  }
90330
90787
  const installed = installedAgentPath();
90331
- if (opts.skip && existsSync35(installed)) {
90788
+ if (opts.skip && existsSync36(installed)) {
90332
90789
  return { action: "skipped", path: installed };
90333
90790
  }
90334
- const template = readFileSync27(templatePath, "utf-8");
90791
+ const template = readFileSync28(templatePath, "utf-8");
90335
90792
  const rendered = renderTemplate(template, {
90336
90793
  MINK_ROOT: minkRoot(),
90337
90794
  VAULT_PATH: resolveVaultPath(),
90338
90795
  MINK_VERSION: getMinkVersion()
90339
90796
  });
90340
- const exists = existsSync35(installed);
90797
+ const exists = existsSync36(installed);
90341
90798
  if (!opts.force && exists) {
90342
- const current = readFileSync27(installed, "utf-8");
90799
+ const current = readFileSync28(installed, "utf-8");
90343
90800
  if (sha2562(current) === sha2562(rendered)) {
90344
90801
  return { action: "unchanged", path: installed };
90345
90802
  }
@@ -90352,12 +90809,12 @@ function installAgentDefinition(opts) {
90352
90809
  };
90353
90810
  }
90354
90811
  function isClaudeOnPath() {
90355
- const result = spawnSync5("claude", ["--version"], {
90812
+ const result = spawnSync6("claude", ["--version"], {
90356
90813
  stdio: "ignore"
90357
90814
  });
90358
90815
  return !result.error && result.status === 0;
90359
90816
  }
90360
- function parseArgs2(args) {
90817
+ function parseArgs3(args) {
90361
90818
  const out = {
90362
90819
  noUpdate: false,
90363
90820
  reinstall: false,
@@ -90390,7 +90847,7 @@ function parseArgs2(args) {
90390
90847
  }
90391
90848
  return out;
90392
90849
  }
90393
- function printHelp() {
90850
+ function printHelp2() {
90394
90851
  console.log("Usage: mink agent [options] [-- <claude args...>]");
90395
90852
  console.log();
90396
90853
  console.log("Open an interactive Claude Code session in your mink home with");
@@ -90408,14 +90865,14 @@ function printHelp() {
90408
90865
  console.log("`mink config wiki.path` triggers a refresh on the next launch.");
90409
90866
  }
90410
90867
  async function agent(_cwd, rawArgs) {
90411
- const args = parseArgs2(rawArgs);
90868
+ const args = parseArgs3(rawArgs);
90412
90869
  if (args.showHelp) {
90413
- printHelp();
90870
+ printHelp2();
90414
90871
  return;
90415
90872
  }
90416
90873
  const skipUpdate = args.noUpdate || process.env.MINK_AGENT_NO_UPDATE === "1";
90417
90874
  const root = minkRoot();
90418
- if (!existsSync35(root)) {
90875
+ if (!existsSync36(root)) {
90419
90876
  mkdirSync16(root, { recursive: true });
90420
90877
  }
90421
90878
  let result;
@@ -90446,7 +90903,7 @@ async function agent(_cwd, rawArgs) {
90446
90903
  process.exit(1);
90447
90904
  }
90448
90905
  const claudeArgs = ["--agent", AGENT_NAME, ...args.passthrough];
90449
- const child = spawnSync5("claude", claudeArgs, {
90906
+ const child = spawnSync6("claude", claudeArgs, {
90450
90907
  cwd: root,
90451
90908
  stdio: "inherit"
90452
90909
  });
@@ -90467,25 +90924,25 @@ var init_agent = __esm(() => {
90467
90924
  });
90468
90925
 
90469
90926
  // src/core/sync-merge-drivers.ts
90470
- import { readFileSync as readFileSync28, writeFileSync as writeFileSync12, appendFileSync as appendFileSync2 } from "fs";
90471
- import { join as join34 } from "path";
90927
+ import { readFileSync as readFileSync29, writeFileSync as writeFileSync12, appendFileSync as appendFileSync2 } from "fs";
90928
+ import { join as join35 } from "path";
90472
90929
  function logWarning(driver, args, err) {
90473
90930
  try {
90474
90931
  const line = `[${new Date().toISOString()}] ${driver} fallback for ${args.filePath}: ${err instanceof Error ? err.message : String(err)}
90475
90932
  `;
90476
- appendFileSync2(join34(minkRoot(), "sync-warnings.log"), line);
90933
+ appendFileSync2(join35(minkRoot(), "sync-warnings.log"), line);
90477
90934
  } catch {}
90478
90935
  }
90479
90936
  function readJsonOrNull(path12) {
90480
90937
  try {
90481
- return JSON.parse(readFileSync28(path12, "utf-8"));
90938
+ return JSON.parse(readFileSync29(path12, "utf-8"));
90482
90939
  } catch {
90483
90940
  return null;
90484
90941
  }
90485
90942
  }
90486
90943
  function readTextOrEmpty(path12) {
90487
90944
  try {
90488
- return readFileSync28(path12, "utf-8");
90945
+ return readFileSync29(path12, "utf-8");
90489
90946
  } catch {
90490
90947
  return "";
90491
90948
  }
@@ -91167,6 +91624,11 @@ switch (command2) {
91167
91624
  await update2(cwd, process.argv.slice(3));
91168
91625
  break;
91169
91626
  }
91627
+ case "upgrade": {
91628
+ const { upgrade: upgrade2 } = await Promise.resolve().then(() => (init_upgrade(), exports_upgrade));
91629
+ await upgrade2(cwd, process.argv.slice(3));
91630
+ break;
91631
+ }
91170
91632
  case "restore": {
91171
91633
  const { restore: restore2 } = await Promise.resolve().then(() => (init_restore(), exports_restore));
91172
91634
  restore2(cwd, process.argv.slice(3));
@@ -91231,11 +91693,11 @@ switch (command2) {
91231
91693
  case "version":
91232
91694
  case "--version":
91233
91695
  case "-v": {
91234
- const { resolve: resolve17, dirname: dirname17 } = await import("path");
91235
- const cliPath = resolve17(dirname17(new URL(import.meta.url).pathname));
91236
- const { readFileSync: readFileSync29 } = await import("fs");
91696
+ const { resolve: resolve18, dirname: dirname18 } = await import("path");
91697
+ const cliPath = resolve18(dirname18(new URL(import.meta.url).pathname));
91698
+ const { readFileSync: readFileSync30 } = await import("fs");
91237
91699
  try {
91238
- const pkg = JSON.parse(readFileSync29(resolve17(cliPath, "../package.json"), "utf-8"));
91700
+ const pkg = JSON.parse(readFileSync30(resolve18(cliPath, "../package.json"), "utf-8"));
91239
91701
  console.log(`mink ${pkg.version}`);
91240
91702
  } catch {
91241
91703
  console.log("mink (unknown version)");
@@ -91288,7 +91750,8 @@ switch (command2) {
91288
91750
  console.log(" dashboard [--port=N] Open the real-time web dashboard");
91289
91751
  console.log(" daemon <cmd> Manage the background daemon (start|stop|restart|logs|install|uninstall)");
91290
91752
  console.log(" cron <cmd> [id] Manage scheduled tasks (list|run|retry)");
91291
- console.log(" update [options] Update Mink across registered projects");
91753
+ console.log(" update [options] Update Mink hooks across registered projects");
91754
+ console.log(" upgrade [options] Self-upgrade the mink CLI from npm (--check|--dry-run|--force)");
91292
91755
  console.log(" restore [backup] Restore state from a backup");
91293
91756
  console.log(" bug search <term> Search the bug log");
91294
91757
  console.log(" detect-waste Detect and flag wasteful patterns");