@drewpayment/mink 0.6.1 → 0.7.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.
- package/README.md +19 -0
- package/agents/mink-agent.md.tmpl +84 -0
- package/dashboard/out/404.html +1 -1
- package/dashboard/out/action-log.html +1 -1
- package/dashboard/out/action-log.txt +1 -1
- package/dashboard/out/activity.html +1 -1
- package/dashboard/out/activity.txt +1 -1
- package/dashboard/out/bugs.html +1 -1
- package/dashboard/out/bugs.txt +1 -1
- package/dashboard/out/capture.html +1 -1
- package/dashboard/out/capture.txt +1 -1
- package/dashboard/out/config.html +1 -1
- package/dashboard/out/config.txt +1 -1
- package/dashboard/out/daemon.html +1 -1
- package/dashboard/out/daemon.txt +1 -1
- package/dashboard/out/design.html +1 -1
- package/dashboard/out/design.txt +1 -1
- package/dashboard/out/discord.html +1 -1
- package/dashboard/out/discord.txt +1 -1
- package/dashboard/out/file-index.html +1 -1
- package/dashboard/out/file-index.txt +1 -1
- package/dashboard/out/index.html +1 -1
- package/dashboard/out/index.txt +1 -1
- package/dashboard/out/insights.html +1 -1
- package/dashboard/out/insights.txt +1 -1
- package/dashboard/out/learning.html +1 -1
- package/dashboard/out/learning.txt +1 -1
- package/dashboard/out/overview.html +1 -1
- package/dashboard/out/overview.txt +1 -1
- package/dashboard/out/scheduler.html +1 -1
- package/dashboard/out/scheduler.txt +1 -1
- package/dashboard/out/sync.html +1 -1
- package/dashboard/out/sync.txt +1 -1
- package/dashboard/out/tokens.html +1 -1
- package/dashboard/out/tokens.txt +1 -1
- package/dashboard/out/waste.html +1 -1
- package/dashboard/out/waste.txt +1 -1
- package/dashboard/out/wiki.html +1 -1
- package/dashboard/out/wiki.txt +1 -1
- package/dist/cli.js +778 -376
- package/package.json +2 -1
- package/src/cli.ts +8 -1
- package/src/commands/agent.ts +245 -0
- package/src/commands/daemon.ts +12 -1
- package/src/core/daemon-service.ts +227 -0
- /package/dashboard/out/_next/static/{FiL3S_40BA764FL66DRZV → IWTIkvB7I3-GawTXJW4-9}/_buildManifest.js +0 -0
- /package/dashboard/out/_next/static/{FiL3S_40BA764FL66DRZV → IWTIkvB7I3-GawTXJW4-9}/_ssgManifest.js +0 -0
package/dist/cli.js
CHANGED
|
@@ -7316,12 +7316,256 @@ var init_dashboard = __esm(() => {
|
|
|
7316
7316
|
init_paths();
|
|
7317
7317
|
});
|
|
7318
7318
|
|
|
7319
|
+
// src/commands/init.ts
|
|
7320
|
+
import { execSync as execSync4 } from "child_process";
|
|
7321
|
+
import { mkdirSync as mkdirSync11, existsSync as existsSync22 } from "fs";
|
|
7322
|
+
import { resolve as resolve5, dirname as dirname8, basename as basename8, join as join22 } from "path";
|
|
7323
|
+
function detectRuntime2() {
|
|
7324
|
+
try {
|
|
7325
|
+
execSync4("bun --version", { stdio: "ignore" });
|
|
7326
|
+
return "bun";
|
|
7327
|
+
} catch {
|
|
7328
|
+
return "node";
|
|
7329
|
+
}
|
|
7330
|
+
}
|
|
7331
|
+
function resolveCliPath2() {
|
|
7332
|
+
const selfPath = new URL(import.meta.url).pathname;
|
|
7333
|
+
const selfDir = dirname8(selfPath);
|
|
7334
|
+
if (selfPath.endsWith("dist/cli.js")) {
|
|
7335
|
+
return selfPath;
|
|
7336
|
+
}
|
|
7337
|
+
const projectRoot = resolve5(selfDir, "../..");
|
|
7338
|
+
const distPath = join22(projectRoot, "dist", "cli.js");
|
|
7339
|
+
if (existsSync22(distPath))
|
|
7340
|
+
return distPath;
|
|
7341
|
+
return resolve5(selfDir, "../cli.ts");
|
|
7342
|
+
}
|
|
7343
|
+
function buildHooksConfig2(runtime, cliPath) {
|
|
7344
|
+
const isTsSource = cliPath.endsWith(".ts");
|
|
7345
|
+
const prefix = isTsSource ? `bun run ${cliPath}` : runtime === "bun" ? `bun run ${cliPath}` : `node ${cliPath}`;
|
|
7346
|
+
const hook = (cmd) => [{ type: "command", command: cmd }];
|
|
7347
|
+
return {
|
|
7348
|
+
SessionStart: [{ matcher: "", hooks: hook(`${prefix} session-start`) }],
|
|
7349
|
+
Stop: [{ matcher: "", hooks: hook(`${prefix} session-stop`) }],
|
|
7350
|
+
PreToolUse: [
|
|
7351
|
+
{ matcher: "Read", hooks: hook(`${prefix} pre-read`) },
|
|
7352
|
+
{ matcher: "Edit", hooks: hook(`${prefix} pre-write`) },
|
|
7353
|
+
{ matcher: "Write", hooks: hook(`${prefix} pre-write`) }
|
|
7354
|
+
],
|
|
7355
|
+
PostToolUse: [
|
|
7356
|
+
{ matcher: "Read", hooks: hook(`${prefix} post-read`) },
|
|
7357
|
+
{ matcher: "Edit", hooks: hook(`${prefix} post-write`) },
|
|
7358
|
+
{ matcher: "Write", hooks: hook(`${prefix} post-write`) }
|
|
7359
|
+
]
|
|
7360
|
+
};
|
|
7361
|
+
}
|
|
7362
|
+
function isMinkCommand2(cmd) {
|
|
7363
|
+
return cmd.includes("cli") && (cmd.includes("session-start") || cmd.includes("session-stop") || cmd.includes("pre-read") || cmd.includes("post-read") || cmd.includes("pre-write") || cmd.includes("post-write"));
|
|
7364
|
+
}
|
|
7365
|
+
function isMinkHook2(entry) {
|
|
7366
|
+
if (Array.isArray(entry.hooks)) {
|
|
7367
|
+
return entry.hooks.some((h) => isMinkCommand2(h.command));
|
|
7368
|
+
}
|
|
7369
|
+
if (typeof entry.command === "string") {
|
|
7370
|
+
return isMinkCommand2(entry.command);
|
|
7371
|
+
}
|
|
7372
|
+
return false;
|
|
7373
|
+
}
|
|
7374
|
+
function mergeHooksIntoSettings2(settingsPath, newHooks) {
|
|
7375
|
+
mkdirSync11(dirname8(settingsPath), { recursive: true });
|
|
7376
|
+
const existing = safeReadJson(settingsPath) ?? {};
|
|
7377
|
+
const existingHooks = existing.hooks ?? {};
|
|
7378
|
+
for (const [event, entries] of Object.entries(newHooks)) {
|
|
7379
|
+
const current = existingHooks[event] ?? [];
|
|
7380
|
+
const withoutMink = current.filter((e) => !isMinkHook2(e));
|
|
7381
|
+
existingHooks[event] = [...withoutMink, ...entries];
|
|
7382
|
+
}
|
|
7383
|
+
existing.hooks = existingHooks;
|
|
7384
|
+
atomicWriteJson(settingsPath, existing);
|
|
7385
|
+
}
|
|
7386
|
+
var init_init2 = __esm(() => {
|
|
7387
|
+
init_paths();
|
|
7388
|
+
init_project_id();
|
|
7389
|
+
init_fs_utils();
|
|
7390
|
+
init_vault();
|
|
7391
|
+
});
|
|
7392
|
+
|
|
7393
|
+
// src/core/daemon-service.ts
|
|
7394
|
+
import { execSync as execSync5 } from "child_process";
|
|
7395
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync12, unlinkSync as unlinkSync4, writeFileSync as writeFileSync9 } from "fs";
|
|
7396
|
+
import { homedir as homedir4 } from "os";
|
|
7397
|
+
import { dirname as dirname9, join as join23 } from "path";
|
|
7398
|
+
function detectPlatform() {
|
|
7399
|
+
if (process.platform === "linux")
|
|
7400
|
+
return "systemd";
|
|
7401
|
+
if (process.platform === "darwin")
|
|
7402
|
+
return "launchd";
|
|
7403
|
+
return null;
|
|
7404
|
+
}
|
|
7405
|
+
function resolveServiceInvocation() {
|
|
7406
|
+
const entry = process.argv[1];
|
|
7407
|
+
if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) && existsSync23(entry)) {
|
|
7408
|
+
return {
|
|
7409
|
+
executable: entry,
|
|
7410
|
+
args: ["daemon", "start"],
|
|
7411
|
+
pathDir: dirname9(entry)
|
|
7412
|
+
};
|
|
7413
|
+
}
|
|
7414
|
+
const cliPath = resolveCliPath2();
|
|
7415
|
+
const interpreter = process.execPath;
|
|
7416
|
+
return {
|
|
7417
|
+
executable: interpreter,
|
|
7418
|
+
args: [cliPath, "daemon", "start"],
|
|
7419
|
+
pathDir: dirname9(interpreter)
|
|
7420
|
+
};
|
|
7421
|
+
}
|
|
7422
|
+
function servicePaths(platform2) {
|
|
7423
|
+
const home = homedir4();
|
|
7424
|
+
if (platform2 === "systemd") {
|
|
7425
|
+
const unitDir2 = join23(home, ".config", "systemd", "user");
|
|
7426
|
+
return { unitDir: unitDir2, unitFile: join23(unitDir2, "mink-daemon.service") };
|
|
7427
|
+
}
|
|
7428
|
+
const unitDir = join23(home, "Library", "LaunchAgents");
|
|
7429
|
+
return { unitDir, unitFile: join23(unitDir, "com.mink.daemon.plist") };
|
|
7430
|
+
}
|
|
7431
|
+
function renderSystemdUnit(inv) {
|
|
7432
|
+
const execStart = [inv.executable, ...inv.args].join(" ");
|
|
7433
|
+
const stopArgs = inv.args.map((a) => a === "start" ? "stop" : a);
|
|
7434
|
+
const execStop = [inv.executable, ...stopArgs].join(" ");
|
|
7435
|
+
const pathEnv = `${inv.pathDir}:/usr/local/bin:/usr/bin:/bin`;
|
|
7436
|
+
return [
|
|
7437
|
+
"[Unit]",
|
|
7438
|
+
"Description=Mink background daemon",
|
|
7439
|
+
"After=network-online.target",
|
|
7440
|
+
"Wants=network-online.target",
|
|
7441
|
+
"",
|
|
7442
|
+
"[Service]",
|
|
7443
|
+
"Type=forking",
|
|
7444
|
+
`ExecStart=${execStart}`,
|
|
7445
|
+
`ExecStop=${execStop}`,
|
|
7446
|
+
"Restart=on-failure",
|
|
7447
|
+
"RestartSec=10",
|
|
7448
|
+
`Environment="PATH=${pathEnv}"`,
|
|
7449
|
+
"",
|
|
7450
|
+
"[Install]",
|
|
7451
|
+
"WantedBy=default.target",
|
|
7452
|
+
""
|
|
7453
|
+
].join(`
|
|
7454
|
+
`);
|
|
7455
|
+
}
|
|
7456
|
+
function renderLaunchdPlist(inv, logPath) {
|
|
7457
|
+
const programArgs = [inv.executable, ...inv.args].map((a) => ` <string>${escapeXml(a)}</string>`).join(`
|
|
7458
|
+
`);
|
|
7459
|
+
const pathEnv = `${inv.pathDir}:/usr/local/bin:/usr/bin:/bin`;
|
|
7460
|
+
return [
|
|
7461
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
7462
|
+
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
|
|
7463
|
+
'<plist version="1.0">',
|
|
7464
|
+
"<dict>",
|
|
7465
|
+
" <key>Label</key>",
|
|
7466
|
+
" <string>com.mink.daemon</string>",
|
|
7467
|
+
" <key>ProgramArguments</key>",
|
|
7468
|
+
" <array>",
|
|
7469
|
+
programArgs,
|
|
7470
|
+
" </array>",
|
|
7471
|
+
" <key>RunAtLoad</key>",
|
|
7472
|
+
" <true/>",
|
|
7473
|
+
" <key>KeepAlive</key>",
|
|
7474
|
+
" <dict>",
|
|
7475
|
+
" <key>SuccessfulExit</key>",
|
|
7476
|
+
" <false/>",
|
|
7477
|
+
" </dict>",
|
|
7478
|
+
" <key>EnvironmentVariables</key>",
|
|
7479
|
+
" <dict>",
|
|
7480
|
+
" <key>PATH</key>",
|
|
7481
|
+
` <string>${escapeXml(pathEnv)}</string>`,
|
|
7482
|
+
" </dict>",
|
|
7483
|
+
" <key>StandardOutPath</key>",
|
|
7484
|
+
` <string>${escapeXml(logPath)}</string>`,
|
|
7485
|
+
" <key>StandardErrorPath</key>",
|
|
7486
|
+
` <string>${escapeXml(logPath)}</string>`,
|
|
7487
|
+
"</dict>",
|
|
7488
|
+
"</plist>",
|
|
7489
|
+
""
|
|
7490
|
+
].join(`
|
|
7491
|
+
`);
|
|
7492
|
+
}
|
|
7493
|
+
function escapeXml(s) {
|
|
7494
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7495
|
+
}
|
|
7496
|
+
function installService(options = {}) {
|
|
7497
|
+
const platform2 = detectPlatform();
|
|
7498
|
+
if (!platform2) {
|
|
7499
|
+
console.error(`[mink] daemon install is not supported on ${process.platform} (supported: linux, darwin)`);
|
|
7500
|
+
process.exit(1);
|
|
7501
|
+
}
|
|
7502
|
+
const paths = servicePaths(platform2);
|
|
7503
|
+
if (existsSync23(paths.unitFile) && !options.force) {
|
|
7504
|
+
console.error(`[mink] unit file already exists: ${paths.unitFile}`);
|
|
7505
|
+
console.error(" re-run with --force to overwrite, or run `mink daemon uninstall` first");
|
|
7506
|
+
process.exit(1);
|
|
7507
|
+
}
|
|
7508
|
+
const inv = resolveServiceInvocation();
|
|
7509
|
+
mkdirSync12(paths.unitDir, { recursive: true });
|
|
7510
|
+
if (platform2 === "systemd") {
|
|
7511
|
+
writeFileSync9(paths.unitFile, renderSystemdUnit(inv));
|
|
7512
|
+
try {
|
|
7513
|
+
execSync5("systemctl --user daemon-reload", { stdio: "ignore" });
|
|
7514
|
+
} catch {}
|
|
7515
|
+
console.log(`[mink] wrote ${paths.unitFile}`);
|
|
7516
|
+
console.log("[mink] next steps:");
|
|
7517
|
+
console.log(" systemctl --user enable --now mink-daemon.service");
|
|
7518
|
+
console.log(" # To survive logout (one-time, requires sudo):");
|
|
7519
|
+
console.log(` sudo loginctl enable-linger ${process.env.USER ?? "$USER"}`);
|
|
7520
|
+
} else {
|
|
7521
|
+
const { schedulerLogPath: schedulerLogPath3 } = (init_paths(), __toCommonJS(exports_paths));
|
|
7522
|
+
writeFileSync9(paths.unitFile, renderLaunchdPlist(inv, schedulerLogPath3()));
|
|
7523
|
+
console.log(`[mink] wrote ${paths.unitFile}`);
|
|
7524
|
+
console.log("[mink] next steps:");
|
|
7525
|
+
console.log(` launchctl load -w ${paths.unitFile}`);
|
|
7526
|
+
console.log(" # Launch agents run automatically on login; no lingering needed.");
|
|
7527
|
+
}
|
|
7528
|
+
}
|
|
7529
|
+
function uninstallService() {
|
|
7530
|
+
const platform2 = detectPlatform();
|
|
7531
|
+
if (!platform2) {
|
|
7532
|
+
console.error(`[mink] daemon uninstall is not supported on ${process.platform} (supported: linux, darwin)`);
|
|
7533
|
+
process.exit(1);
|
|
7534
|
+
}
|
|
7535
|
+
const paths = servicePaths(platform2);
|
|
7536
|
+
if (!existsSync23(paths.unitFile)) {
|
|
7537
|
+
console.log(`[mink] no unit file at ${paths.unitFile} — nothing to uninstall`);
|
|
7538
|
+
return;
|
|
7539
|
+
}
|
|
7540
|
+
if (platform2 === "systemd") {
|
|
7541
|
+
try {
|
|
7542
|
+
execSync5("systemctl --user disable --now mink-daemon.service", {
|
|
7543
|
+
stdio: "ignore"
|
|
7544
|
+
});
|
|
7545
|
+
} catch {}
|
|
7546
|
+
unlinkSync4(paths.unitFile);
|
|
7547
|
+
try {
|
|
7548
|
+
execSync5("systemctl --user daemon-reload", { stdio: "ignore" });
|
|
7549
|
+
} catch {}
|
|
7550
|
+
console.log(`[mink] removed ${paths.unitFile}`);
|
|
7551
|
+
} else {
|
|
7552
|
+
try {
|
|
7553
|
+
execSync5(`launchctl unload -w ${paths.unitFile}`, { stdio: "ignore" });
|
|
7554
|
+
} catch {}
|
|
7555
|
+
unlinkSync4(paths.unitFile);
|
|
7556
|
+
console.log(`[mink] removed ${paths.unitFile}`);
|
|
7557
|
+
}
|
|
7558
|
+
}
|
|
7559
|
+
var init_daemon_service = __esm(() => {
|
|
7560
|
+
init_init2();
|
|
7561
|
+
});
|
|
7562
|
+
|
|
7319
7563
|
// src/commands/daemon.ts
|
|
7320
7564
|
var exports_daemon = {};
|
|
7321
7565
|
__export(exports_daemon, {
|
|
7322
7566
|
daemon: () => daemon
|
|
7323
7567
|
});
|
|
7324
|
-
import { readFileSync as readFileSync22, existsSync as
|
|
7568
|
+
import { readFileSync as readFileSync22, existsSync as existsSync24 } from "fs";
|
|
7325
7569
|
async function daemon(cwd, args) {
|
|
7326
7570
|
const subcommand = args[0];
|
|
7327
7571
|
switch (subcommand) {
|
|
@@ -7337,7 +7581,7 @@ async function daemon(cwd, args) {
|
|
|
7337
7581
|
break;
|
|
7338
7582
|
case "logs": {
|
|
7339
7583
|
const logPath = schedulerLogPath();
|
|
7340
|
-
if (!
|
|
7584
|
+
if (!existsSync24(logPath)) {
|
|
7341
7585
|
console.log("[mink] no log file found");
|
|
7342
7586
|
return;
|
|
7343
7587
|
}
|
|
@@ -7353,14 +7597,21 @@ async function daemon(cwd, args) {
|
|
|
7353
7597
|
}
|
|
7354
7598
|
break;
|
|
7355
7599
|
}
|
|
7600
|
+
case "install":
|
|
7601
|
+
installService({ force: args.includes("--force") });
|
|
7602
|
+
break;
|
|
7603
|
+
case "uninstall":
|
|
7604
|
+
uninstallService();
|
|
7605
|
+
break;
|
|
7356
7606
|
default:
|
|
7357
7607
|
console.error(`[mink] unknown daemon subcommand: ${subcommand ?? "(none)"}`);
|
|
7358
|
-
console.error("Usage: mink daemon <start|stop|restart|logs>");
|
|
7608
|
+
console.error("Usage: mink daemon <start|stop|restart|logs|install|uninstall>");
|
|
7359
7609
|
process.exit(1);
|
|
7360
7610
|
}
|
|
7361
7611
|
}
|
|
7362
7612
|
var init_daemon2 = __esm(() => {
|
|
7363
7613
|
init_daemon();
|
|
7614
|
+
init_daemon_service();
|
|
7364
7615
|
init_paths();
|
|
7365
7616
|
});
|
|
7366
7617
|
|
|
@@ -7602,13 +7853,13 @@ function printValidKeys() {
|
|
|
7602
7853
|
}
|
|
7603
7854
|
}
|
|
7604
7855
|
function readLineFromStdin() {
|
|
7605
|
-
return new Promise((
|
|
7856
|
+
return new Promise((resolve7) => {
|
|
7606
7857
|
const chunks = [];
|
|
7607
7858
|
process.stdin.resume();
|
|
7608
7859
|
process.stdin.setEncoding("utf-8");
|
|
7609
7860
|
process.stdin.once("data", (data) => {
|
|
7610
7861
|
process.stdin.pause();
|
|
7611
|
-
|
|
7862
|
+
resolve7(String(data).trim());
|
|
7612
7863
|
});
|
|
7613
7864
|
});
|
|
7614
7865
|
}
|
|
@@ -7678,74 +7929,12 @@ var init_config2 = __esm(() => {
|
|
|
7678
7929
|
init_global_config();
|
|
7679
7930
|
});
|
|
7680
7931
|
|
|
7681
|
-
// src/commands/init.ts
|
|
7682
|
-
import { execSync as execSync4 } from "child_process";
|
|
7683
|
-
import { mkdirSync as mkdirSync11, existsSync as existsSync23 } from "fs";
|
|
7684
|
-
import { resolve as resolve5, dirname as dirname8, basename as basename8, join as join22 } from "path";
|
|
7685
|
-
function detectRuntime2() {
|
|
7686
|
-
try {
|
|
7687
|
-
execSync4("bun --version", { stdio: "ignore" });
|
|
7688
|
-
return "bun";
|
|
7689
|
-
} catch {
|
|
7690
|
-
return "node";
|
|
7691
|
-
}
|
|
7692
|
-
}
|
|
7693
|
-
function buildHooksConfig2(runtime, cliPath) {
|
|
7694
|
-
const isTsSource = cliPath.endsWith(".ts");
|
|
7695
|
-
const prefix = isTsSource ? `bun run ${cliPath}` : runtime === "bun" ? `bun run ${cliPath}` : `node ${cliPath}`;
|
|
7696
|
-
const hook = (cmd) => [{ type: "command", command: cmd }];
|
|
7697
|
-
return {
|
|
7698
|
-
SessionStart: [{ matcher: "", hooks: hook(`${prefix} session-start`) }],
|
|
7699
|
-
Stop: [{ matcher: "", hooks: hook(`${prefix} session-stop`) }],
|
|
7700
|
-
PreToolUse: [
|
|
7701
|
-
{ matcher: "Read", hooks: hook(`${prefix} pre-read`) },
|
|
7702
|
-
{ matcher: "Edit", hooks: hook(`${prefix} pre-write`) },
|
|
7703
|
-
{ matcher: "Write", hooks: hook(`${prefix} pre-write`) }
|
|
7704
|
-
],
|
|
7705
|
-
PostToolUse: [
|
|
7706
|
-
{ matcher: "Read", hooks: hook(`${prefix} post-read`) },
|
|
7707
|
-
{ matcher: "Edit", hooks: hook(`${prefix} post-write`) },
|
|
7708
|
-
{ matcher: "Write", hooks: hook(`${prefix} post-write`) }
|
|
7709
|
-
]
|
|
7710
|
-
};
|
|
7711
|
-
}
|
|
7712
|
-
function isMinkCommand2(cmd) {
|
|
7713
|
-
return cmd.includes("cli") && (cmd.includes("session-start") || cmd.includes("session-stop") || cmd.includes("pre-read") || cmd.includes("post-read") || cmd.includes("pre-write") || cmd.includes("post-write"));
|
|
7714
|
-
}
|
|
7715
|
-
function isMinkHook2(entry) {
|
|
7716
|
-
if (Array.isArray(entry.hooks)) {
|
|
7717
|
-
return entry.hooks.some((h) => isMinkCommand2(h.command));
|
|
7718
|
-
}
|
|
7719
|
-
if (typeof entry.command === "string") {
|
|
7720
|
-
return isMinkCommand2(entry.command);
|
|
7721
|
-
}
|
|
7722
|
-
return false;
|
|
7723
|
-
}
|
|
7724
|
-
function mergeHooksIntoSettings2(settingsPath, newHooks) {
|
|
7725
|
-
mkdirSync11(dirname8(settingsPath), { recursive: true });
|
|
7726
|
-
const existing = safeReadJson(settingsPath) ?? {};
|
|
7727
|
-
const existingHooks = existing.hooks ?? {};
|
|
7728
|
-
for (const [event, entries] of Object.entries(newHooks)) {
|
|
7729
|
-
const current = existingHooks[event] ?? [];
|
|
7730
|
-
const withoutMink = current.filter((e) => !isMinkHook2(e));
|
|
7731
|
-
existingHooks[event] = [...withoutMink, ...entries];
|
|
7732
|
-
}
|
|
7733
|
-
existing.hooks = existingHooks;
|
|
7734
|
-
atomicWriteJson(settingsPath, existing);
|
|
7735
|
-
}
|
|
7736
|
-
var init_init2 = __esm(() => {
|
|
7737
|
-
init_paths();
|
|
7738
|
-
init_project_id();
|
|
7739
|
-
init_fs_utils();
|
|
7740
|
-
init_vault();
|
|
7741
|
-
});
|
|
7742
|
-
|
|
7743
7932
|
// src/commands/update.ts
|
|
7744
7933
|
var exports_update = {};
|
|
7745
7934
|
__export(exports_update, {
|
|
7746
7935
|
update: () => update
|
|
7747
7936
|
});
|
|
7748
|
-
import { resolve as
|
|
7937
|
+
import { resolve as resolve7, dirname as dirname10 } from "path";
|
|
7749
7938
|
function parseArgs(args) {
|
|
7750
7939
|
let dryRun = false;
|
|
7751
7940
|
let project = null;
|
|
@@ -7793,7 +7982,7 @@ async function update(cwd, args) {
|
|
|
7793
7982
|
return;
|
|
7794
7983
|
}
|
|
7795
7984
|
const runtime = detectRuntime2();
|
|
7796
|
-
const cliPath =
|
|
7985
|
+
const cliPath = resolve7(dirname10(new URL(import.meta.url).pathname), "../cli.ts");
|
|
7797
7986
|
const newHooks = buildHooksConfig2(runtime, cliPath);
|
|
7798
7987
|
for (const target of targets) {
|
|
7799
7988
|
console.log(`[mink] updating: ${target.name} (${target.id})`);
|
|
@@ -7804,7 +7993,7 @@ async function update(cwd, args) {
|
|
|
7804
7993
|
}
|
|
7805
7994
|
const backupName = createBackup(target.cwd);
|
|
7806
7995
|
console.log(` backup: ${backupName}`);
|
|
7807
|
-
const settingsPath =
|
|
7996
|
+
const settingsPath = resolve7(target.cwd, ".claude", "settings.json");
|
|
7808
7997
|
mergeHooksIntoSettings2(settingsPath, newHooks);
|
|
7809
7998
|
console.log(" hooks: updated");
|
|
7810
7999
|
const metaPath = projectMetaPath(target.cwd);
|
|
@@ -7863,7 +8052,7 @@ var init_restore = __esm(() => {
|
|
|
7863
8052
|
|
|
7864
8053
|
// src/core/design-eval/server-detect.ts
|
|
7865
8054
|
import { readFileSync as readFileSync23 } from "fs";
|
|
7866
|
-
import { join as
|
|
8055
|
+
import { join as join24 } from "path";
|
|
7867
8056
|
async function probePort(port) {
|
|
7868
8057
|
try {
|
|
7869
8058
|
const controller = new AbortController;
|
|
@@ -7885,7 +8074,7 @@ async function findRunningServer(ports = DEFAULT_PROBE_PORTS) {
|
|
|
7885
8074
|
}
|
|
7886
8075
|
function detectDevCommand(cwd) {
|
|
7887
8076
|
try {
|
|
7888
|
-
const raw = readFileSync23(
|
|
8077
|
+
const raw = readFileSync23(join24(cwd, "package.json"), "utf-8");
|
|
7889
8078
|
const pkg = JSON.parse(raw);
|
|
7890
8079
|
const scripts = pkg.scripts;
|
|
7891
8080
|
if (!scripts || typeof scripts !== "object")
|
|
@@ -7905,10 +8094,10 @@ var init_server_detect = __esm(() => {
|
|
|
7905
8094
|
});
|
|
7906
8095
|
|
|
7907
8096
|
// src/core/design-eval/route-detect.ts
|
|
7908
|
-
import { existsSync as
|
|
7909
|
-
import { join as
|
|
8097
|
+
import { existsSync as existsSync25, readdirSync as readdirSync7, statSync as statSync9 } from "fs";
|
|
8098
|
+
import { join as join25, relative as relative6, sep as sep2 } from "path";
|
|
7910
8099
|
function detectFramework(cwd) {
|
|
7911
|
-
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) =>
|
|
8100
|
+
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync25(join25(cwd, `${name}.${ext}`))) || existsSync25(join25(cwd, name));
|
|
7912
8101
|
if (has("next.config"))
|
|
7913
8102
|
return "nextjs";
|
|
7914
8103
|
if (has("svelte.config"))
|
|
@@ -7933,8 +8122,8 @@ function detectRoutes(cwd) {
|
|
|
7933
8122
|
}
|
|
7934
8123
|
function detectNextRoutes(cwd) {
|
|
7935
8124
|
const routes = [];
|
|
7936
|
-
const appDir =
|
|
7937
|
-
if (
|
|
8125
|
+
const appDir = join25(cwd, "app");
|
|
8126
|
+
if (existsSync25(appDir)) {
|
|
7938
8127
|
const pageFiles = findFiles(appDir, /^page\.(tsx?|jsx?)$/);
|
|
7939
8128
|
for (const file of pageFiles) {
|
|
7940
8129
|
const rel = relative6(appDir, file);
|
|
@@ -7945,8 +8134,8 @@ function detectNextRoutes(cwd) {
|
|
|
7945
8134
|
routes.push(route);
|
|
7946
8135
|
}
|
|
7947
8136
|
}
|
|
7948
|
-
const pagesDir =
|
|
7949
|
-
if (
|
|
8137
|
+
const pagesDir = join25(cwd, "pages");
|
|
8138
|
+
if (existsSync25(pagesDir)) {
|
|
7950
8139
|
const pageFiles = findFiles(pagesDir, /\.(tsx?|jsx?)$/);
|
|
7951
8140
|
for (const file of pageFiles) {
|
|
7952
8141
|
const rel = relative6(pagesDir, file);
|
|
@@ -7965,8 +8154,8 @@ function detectNextRoutes(cwd) {
|
|
|
7965
8154
|
return unique.length > 0 ? unique.sort() : ["/"];
|
|
7966
8155
|
}
|
|
7967
8156
|
function detectSvelteKitRoutes(cwd) {
|
|
7968
|
-
const routesDir =
|
|
7969
|
-
if (!
|
|
8157
|
+
const routesDir = join25(cwd, "src", "routes");
|
|
8158
|
+
if (!existsSync25(routesDir))
|
|
7970
8159
|
return ["/"];
|
|
7971
8160
|
const routes = [];
|
|
7972
8161
|
const pageFiles = findFiles(routesDir, /^\+page\.svelte$/);
|
|
@@ -7981,8 +8170,8 @@ function detectSvelteKitRoutes(cwd) {
|
|
|
7981
8170
|
return routes.length > 0 ? routes.sort() : ["/"];
|
|
7982
8171
|
}
|
|
7983
8172
|
function detectNuxtRoutes(cwd) {
|
|
7984
|
-
const pagesDir =
|
|
7985
|
-
if (!
|
|
8173
|
+
const pagesDir = join25(cwd, "pages");
|
|
8174
|
+
if (!existsSync25(pagesDir))
|
|
7986
8175
|
return ["/"];
|
|
7987
8176
|
const routes = [];
|
|
7988
8177
|
const vueFiles = findFiles(pagesDir, /\.vue$/);
|
|
@@ -8008,7 +8197,7 @@ function findFiles(dir, pattern) {
|
|
|
8008
8197
|
for (const entry of entries) {
|
|
8009
8198
|
if (entry.startsWith(".") || entry === "node_modules")
|
|
8010
8199
|
continue;
|
|
8011
|
-
const full =
|
|
8200
|
+
const full = join25(current, entry);
|
|
8012
8201
|
try {
|
|
8013
8202
|
const stat2 = statSync9(full);
|
|
8014
8203
|
if (stat2.isDirectory()) {
|
|
@@ -8036,11 +8225,11 @@ function __extends(d, b) {
|
|
|
8036
8225
|
}
|
|
8037
8226
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
8038
8227
|
function adopt(value) {
|
|
8039
|
-
return value instanceof P ? value : new P(function(
|
|
8040
|
-
|
|
8228
|
+
return value instanceof P ? value : new P(function(resolve8) {
|
|
8229
|
+
resolve8(value);
|
|
8041
8230
|
});
|
|
8042
8231
|
}
|
|
8043
|
-
return new (P || (P = Promise))(function(
|
|
8232
|
+
return new (P || (P = Promise))(function(resolve8, reject) {
|
|
8044
8233
|
function fulfilled(value) {
|
|
8045
8234
|
try {
|
|
8046
8235
|
step(generator.next(value));
|
|
@@ -8056,7 +8245,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
8056
8245
|
}
|
|
8057
8246
|
}
|
|
8058
8247
|
function step(result) {
|
|
8059
|
-
result.done ?
|
|
8248
|
+
result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
8060
8249
|
}
|
|
8061
8250
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8062
8251
|
});
|
|
@@ -8239,14 +8428,14 @@ function __asyncValues(o) {
|
|
|
8239
8428
|
}, i);
|
|
8240
8429
|
function verb(n) {
|
|
8241
8430
|
i[n] = o[n] && function(v) {
|
|
8242
|
-
return new Promise(function(
|
|
8243
|
-
v = o[n](v), settle(
|
|
8431
|
+
return new Promise(function(resolve8, reject) {
|
|
8432
|
+
v = o[n](v), settle(resolve8, reject, v.done, v.value);
|
|
8244
8433
|
});
|
|
8245
8434
|
};
|
|
8246
8435
|
}
|
|
8247
|
-
function settle(
|
|
8436
|
+
function settle(resolve8, reject, d, v) {
|
|
8248
8437
|
Promise.resolve(v).then(function(v2) {
|
|
8249
|
-
|
|
8438
|
+
resolve8({ value: v2, done: d });
|
|
8250
8439
|
}, reject);
|
|
8251
8440
|
}
|
|
8252
8441
|
}
|
|
@@ -8777,7 +8966,7 @@ function of() {
|
|
|
8777
8966
|
}
|
|
8778
8967
|
function lastValueFrom(source, config22) {
|
|
8779
8968
|
var hasConfig = typeof config22 === "object";
|
|
8780
|
-
return new Promise(function(
|
|
8969
|
+
return new Promise(function(resolve8, reject) {
|
|
8781
8970
|
var _hasValue = false;
|
|
8782
8971
|
var _value;
|
|
8783
8972
|
source.subscribe({
|
|
@@ -8788,9 +8977,9 @@ function lastValueFrom(source, config22) {
|
|
|
8788
8977
|
error: reject,
|
|
8789
8978
|
complete: function() {
|
|
8790
8979
|
if (_hasValue) {
|
|
8791
|
-
|
|
8980
|
+
resolve8(_value);
|
|
8792
8981
|
} else if (hasConfig) {
|
|
8793
|
-
|
|
8982
|
+
resolve8(config22.defaultValue);
|
|
8794
8983
|
} else {
|
|
8795
8984
|
reject(new EmptyError);
|
|
8796
8985
|
}
|
|
@@ -8800,16 +8989,16 @@ function lastValueFrom(source, config22) {
|
|
|
8800
8989
|
}
|
|
8801
8990
|
function firstValueFrom(source, config22) {
|
|
8802
8991
|
var hasConfig = typeof config22 === "object";
|
|
8803
|
-
return new Promise(function(
|
|
8992
|
+
return new Promise(function(resolve8, reject) {
|
|
8804
8993
|
var subscriber = new SafeSubscriber({
|
|
8805
8994
|
next: function(value) {
|
|
8806
|
-
|
|
8995
|
+
resolve8(value);
|
|
8807
8996
|
subscriber.unsubscribe();
|
|
8808
8997
|
},
|
|
8809
8998
|
error: reject,
|
|
8810
8999
|
complete: function() {
|
|
8811
9000
|
if (hasConfig) {
|
|
8812
|
-
|
|
9001
|
+
resolve8(config22.defaultValue);
|
|
8813
9002
|
} else {
|
|
8814
9003
|
reject(new EmptyError);
|
|
8815
9004
|
}
|
|
@@ -9861,7 +10050,7 @@ var init_rxjs = __esm(() => {
|
|
|
9861
10050
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
9862
10051
|
var _this = this;
|
|
9863
10052
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
9864
|
-
return new promiseCtor(function(
|
|
10053
|
+
return new promiseCtor(function(resolve8, reject) {
|
|
9865
10054
|
var subscriber = new SafeSubscriber({
|
|
9866
10055
|
next: function(value) {
|
|
9867
10056
|
try {
|
|
@@ -9872,7 +10061,7 @@ var init_rxjs = __esm(() => {
|
|
|
9872
10061
|
}
|
|
9873
10062
|
},
|
|
9874
10063
|
error: reject,
|
|
9875
|
-
complete:
|
|
10064
|
+
complete: resolve8
|
|
9876
10065
|
});
|
|
9877
10066
|
_this.subscribe(subscriber);
|
|
9878
10067
|
});
|
|
@@ -9894,14 +10083,14 @@ var init_rxjs = __esm(() => {
|
|
|
9894
10083
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
9895
10084
|
var _this = this;
|
|
9896
10085
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
9897
|
-
return new promiseCtor(function(
|
|
10086
|
+
return new promiseCtor(function(resolve8, reject) {
|
|
9898
10087
|
var value;
|
|
9899
10088
|
_this.subscribe(function(x) {
|
|
9900
10089
|
return value = x;
|
|
9901
10090
|
}, function(err) {
|
|
9902
10091
|
return reject(err);
|
|
9903
10092
|
}, function() {
|
|
9904
|
-
return
|
|
10093
|
+
return resolve8(value);
|
|
9905
10094
|
});
|
|
9906
10095
|
});
|
|
9907
10096
|
};
|
|
@@ -11827,8 +12016,8 @@ class Deferred {
|
|
|
11827
12016
|
#isRejected = false;
|
|
11828
12017
|
#value;
|
|
11829
12018
|
#resolve;
|
|
11830
|
-
#taskPromise = new Promise((
|
|
11831
|
-
this.#resolve =
|
|
12019
|
+
#taskPromise = new Promise((resolve8) => {
|
|
12020
|
+
this.#resolve = resolve8;
|
|
11832
12021
|
});
|
|
11833
12022
|
#timeoutId;
|
|
11834
12023
|
#timeoutError;
|
|
@@ -11917,12 +12106,12 @@ var init_Mutex = __esm(() => {
|
|
|
11917
12106
|
return new Mutex.Guard(this, onRelease);
|
|
11918
12107
|
}
|
|
11919
12108
|
release() {
|
|
11920
|
-
const
|
|
11921
|
-
if (!
|
|
12109
|
+
const resolve8 = this.#acquirers.shift();
|
|
12110
|
+
if (!resolve8) {
|
|
11922
12111
|
this.#locked = false;
|
|
11923
12112
|
return;
|
|
11924
12113
|
}
|
|
11925
|
-
|
|
12114
|
+
resolve8();
|
|
11926
12115
|
}
|
|
11927
12116
|
};
|
|
11928
12117
|
});
|
|
@@ -13666,12 +13855,12 @@ var init_locators = __esm(() => {
|
|
|
13666
13855
|
}
|
|
13667
13856
|
return defer(() => {
|
|
13668
13857
|
return from(handle.evaluate((element) => {
|
|
13669
|
-
return new Promise((
|
|
13858
|
+
return new Promise((resolve8) => {
|
|
13670
13859
|
window.requestAnimationFrame(() => {
|
|
13671
13860
|
const rect1 = element.getBoundingClientRect();
|
|
13672
13861
|
window.requestAnimationFrame(() => {
|
|
13673
13862
|
const rect2 = element.getBoundingClientRect();
|
|
13674
|
-
|
|
13863
|
+
resolve8([
|
|
13675
13864
|
{
|
|
13676
13865
|
x: rect1.x,
|
|
13677
13866
|
y: rect1.y,
|
|
@@ -14962,9 +15151,9 @@ var init_ElementHandle = __esm(() => {
|
|
|
14962
15151
|
const handle = await this.#asSVGElementHandle();
|
|
14963
15152
|
const target = __addDisposableResource6(env_5, handle && await handle.#getOwnerSVGElement(), false);
|
|
14964
15153
|
return await (target ?? this).evaluate(async (element, threshold) => {
|
|
14965
|
-
const visibleRatio = await new Promise((
|
|
15154
|
+
const visibleRatio = await new Promise((resolve8) => {
|
|
14966
15155
|
const observer = new IntersectionObserver((entries) => {
|
|
14967
|
-
|
|
15156
|
+
resolve8(entries[0].intersectionRatio);
|
|
14968
15157
|
observer.disconnect();
|
|
14969
15158
|
});
|
|
14970
15159
|
observer.observe(element);
|
|
@@ -15358,7 +15547,7 @@ var init_Frame = __esm(() => {
|
|
|
15358
15547
|
}
|
|
15359
15548
|
type = type ?? "text/javascript";
|
|
15360
15549
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, id, type: type2, content: content2 }) => {
|
|
15361
|
-
return await new Promise((
|
|
15550
|
+
return await new Promise((resolve8, reject) => {
|
|
15362
15551
|
const script = document.createElement("script");
|
|
15363
15552
|
script.type = type2;
|
|
15364
15553
|
script.text = content2;
|
|
@@ -15371,12 +15560,12 @@ var init_Frame = __esm(() => {
|
|
|
15371
15560
|
if (url) {
|
|
15372
15561
|
script.src = url;
|
|
15373
15562
|
script.addEventListener("load", () => {
|
|
15374
|
-
|
|
15563
|
+
resolve8(script);
|
|
15375
15564
|
}, { once: true });
|
|
15376
15565
|
document.head.appendChild(script);
|
|
15377
15566
|
} else {
|
|
15378
15567
|
document.head.appendChild(script);
|
|
15379
|
-
|
|
15568
|
+
resolve8(script);
|
|
15380
15569
|
}
|
|
15381
15570
|
});
|
|
15382
15571
|
}, { ...options, type, content }));
|
|
@@ -15393,7 +15582,7 @@ var init_Frame = __esm(() => {
|
|
|
15393
15582
|
options.content = content;
|
|
15394
15583
|
}
|
|
15395
15584
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, content: content2 }) => {
|
|
15396
|
-
return await new Promise((
|
|
15585
|
+
return await new Promise((resolve8, reject) => {
|
|
15397
15586
|
let element;
|
|
15398
15587
|
if (!url) {
|
|
15399
15588
|
element = document.createElement("style");
|
|
@@ -15405,7 +15594,7 @@ var init_Frame = __esm(() => {
|
|
|
15405
15594
|
element = link;
|
|
15406
15595
|
}
|
|
15407
15596
|
element.addEventListener("load", () => {
|
|
15408
|
-
|
|
15597
|
+
resolve8(element);
|
|
15409
15598
|
}, { once: true });
|
|
15410
15599
|
element.addEventListener("error", (event) => {
|
|
15411
15600
|
reject(new Error(event.message ?? "Could not load style"));
|
|
@@ -16259,9 +16448,9 @@ var init_Page = __esm(() => {
|
|
|
16259
16448
|
++this.#screencastSessionCount;
|
|
16260
16449
|
if (!this.#startScreencastPromise) {
|
|
16261
16450
|
this.#startScreencastPromise = this.mainFrame().client.send("Page.startScreencast", { format: "png" }).then(() => {
|
|
16262
|
-
return new Promise((
|
|
16451
|
+
return new Promise((resolve8) => {
|
|
16263
16452
|
return this.mainFrame().client.once("Page.screencastFrame", () => {
|
|
16264
|
-
return
|
|
16453
|
+
return resolve8();
|
|
16265
16454
|
});
|
|
16266
16455
|
});
|
|
16267
16456
|
});
|
|
@@ -18919,11 +19108,11 @@ function addPageBinding(type, name, prefix) {
|
|
|
18919
19108
|
return value instanceof Node;
|
|
18920
19109
|
})
|
|
18921
19110
|
}));
|
|
18922
|
-
return new Promise((
|
|
19111
|
+
return new Promise((resolve8, reject) => {
|
|
18923
19112
|
callPuppeteer.callbacks.set(seq, {
|
|
18924
19113
|
resolve(value) {
|
|
18925
19114
|
callPuppeteer.args.delete(seq);
|
|
18926
|
-
|
|
19115
|
+
resolve8(value);
|
|
18927
19116
|
},
|
|
18928
19117
|
reject(value) {
|
|
18929
19118
|
callPuppeteer.args.delete(seq);
|
|
@@ -22386,8 +22575,8 @@ var init_Input2 = __esm(() => {
|
|
|
22386
22575
|
if (typeof delay === "number") {
|
|
22387
22576
|
await Promise.all(actions);
|
|
22388
22577
|
actions.length = 0;
|
|
22389
|
-
await new Promise((
|
|
22390
|
-
setTimeout(
|
|
22578
|
+
await new Promise((resolve8) => {
|
|
22579
|
+
setTimeout(resolve8, delay);
|
|
22391
22580
|
});
|
|
22392
22581
|
}
|
|
22393
22582
|
actions.push(this.up({ ...options, clickCount }));
|
|
@@ -22407,9 +22596,9 @@ var init_Input2 = __esm(() => {
|
|
|
22407
22596
|
});
|
|
22408
22597
|
}
|
|
22409
22598
|
async drag(start, target) {
|
|
22410
|
-
const promise = new Promise((
|
|
22599
|
+
const promise = new Promise((resolve8) => {
|
|
22411
22600
|
this.#client.once("Input.dragIntercepted", (event) => {
|
|
22412
|
-
return
|
|
22601
|
+
return resolve8(event.data);
|
|
22413
22602
|
});
|
|
22414
22603
|
});
|
|
22415
22604
|
await this.move(start.x, start.y);
|
|
@@ -22450,8 +22639,8 @@ var init_Input2 = __esm(() => {
|
|
|
22450
22639
|
await this.dragEnter(target, data);
|
|
22451
22640
|
await this.dragOver(target, data);
|
|
22452
22641
|
if (delay) {
|
|
22453
|
-
await new Promise((
|
|
22454
|
-
return setTimeout(
|
|
22642
|
+
await new Promise((resolve8) => {
|
|
22643
|
+
return setTimeout(resolve8, delay);
|
|
22455
22644
|
});
|
|
22456
22645
|
}
|
|
22457
22646
|
await this.drop(target, data);
|
|
@@ -23263,9 +23452,9 @@ var init_Page2 = __esm(() => {
|
|
|
23263
23452
|
async captureHeapSnapshot(options) {
|
|
23264
23453
|
const { createWriteStream } = environment.value.fs;
|
|
23265
23454
|
const stream = createWriteStream(options.path);
|
|
23266
|
-
const streamPromise = new Promise((
|
|
23455
|
+
const streamPromise = new Promise((resolve8, reject) => {
|
|
23267
23456
|
stream.on("error", reject);
|
|
23268
|
-
stream.on("finish",
|
|
23457
|
+
stream.on("finish", resolve8);
|
|
23269
23458
|
});
|
|
23270
23459
|
const client = this.#primaryTargetClient;
|
|
23271
23460
|
await client.send("HeapProfiler.enable");
|
|
@@ -24778,10 +24967,10 @@ __export(exports_BrowserWebSocketTransport, {
|
|
|
24778
24967
|
|
|
24779
24968
|
class BrowserWebSocketTransport {
|
|
24780
24969
|
static create(url) {
|
|
24781
|
-
return new Promise((
|
|
24970
|
+
return new Promise((resolve8, reject) => {
|
|
24782
24971
|
const ws = new WebSocket(url);
|
|
24783
24972
|
ws.addEventListener("open", () => {
|
|
24784
|
-
return
|
|
24973
|
+
return resolve8(new BrowserWebSocketTransport(ws));
|
|
24785
24974
|
});
|
|
24786
24975
|
ws.addEventListener("error", reject);
|
|
24787
24976
|
});
|
|
@@ -27615,11 +27804,11 @@ var require_BrowsingContextProcessor = __commonJS((exports) => {
|
|
|
27615
27804
|
}
|
|
27616
27805
|
const parentCdpClient = context2.cdpTarget.parentCdpClient;
|
|
27617
27806
|
try {
|
|
27618
|
-
const detachedFromTargetPromise = new Promise((
|
|
27807
|
+
const detachedFromTargetPromise = new Promise((resolve8) => {
|
|
27619
27808
|
const onContextDestroyed = (event) => {
|
|
27620
27809
|
if (event.targetId === params.context) {
|
|
27621
27810
|
parentCdpClient.off("Target.detachedFromTarget", onContextDestroyed);
|
|
27622
|
-
|
|
27811
|
+
resolve8();
|
|
27623
27812
|
}
|
|
27624
27813
|
};
|
|
27625
27814
|
parentCdpClient.on("Target.detachedFromTarget", onContextDestroyed);
|
|
@@ -28939,7 +29128,7 @@ var require_ActionDispatcher = __commonJS((exports) => {
|
|
|
28939
29128
|
}
|
|
28940
29129
|
}
|
|
28941
29130
|
const promises = [
|
|
28942
|
-
new Promise((
|
|
29131
|
+
new Promise((resolve8) => setTimeout(resolve8, this.#tickDuration))
|
|
28943
29132
|
];
|
|
28944
29133
|
for (const option of options) {
|
|
28945
29134
|
promises.push(this.#dispatchAction(option));
|
|
@@ -29538,8 +29727,8 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
29538
29727
|
acquire() {
|
|
29539
29728
|
const state = { resolved: false };
|
|
29540
29729
|
if (this.#locked) {
|
|
29541
|
-
return new Promise((
|
|
29542
|
-
this.#acquirers.push(() =>
|
|
29730
|
+
return new Promise((resolve8) => {
|
|
29731
|
+
this.#acquirers.push(() => resolve8(this.#release.bind(this, state)));
|
|
29543
29732
|
});
|
|
29544
29733
|
}
|
|
29545
29734
|
this.#locked = true;
|
|
@@ -29550,12 +29739,12 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
29550
29739
|
throw new Error("Cannot release more than once.");
|
|
29551
29740
|
}
|
|
29552
29741
|
state.resolved = true;
|
|
29553
|
-
const
|
|
29554
|
-
if (!
|
|
29742
|
+
const resolve8 = this.#acquirers.shift();
|
|
29743
|
+
if (!resolve8) {
|
|
29555
29744
|
this.#locked = false;
|
|
29556
29745
|
return;
|
|
29557
29746
|
}
|
|
29558
|
-
|
|
29747
|
+
resolve8();
|
|
29559
29748
|
}
|
|
29560
29749
|
async run(action) {
|
|
29561
29750
|
const release = await this.acquire();
|
|
@@ -30682,8 +30871,8 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
30682
30871
|
let queueNonEmptyResolver = null;
|
|
30683
30872
|
return {
|
|
30684
30873
|
async getMessage() {
|
|
30685
|
-
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((
|
|
30686
|
-
queueNonEmptyResolver =
|
|
30874
|
+
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve8) => {
|
|
30875
|
+
queueNonEmptyResolver = resolve8;
|
|
30687
30876
|
});
|
|
30688
30877
|
await onMessage;
|
|
30689
30878
|
return queue.shift();
|
|
@@ -30769,7 +30958,7 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
30769
30958
|
functionDeclaration: String((id) => {
|
|
30770
30959
|
const w = window;
|
|
30771
30960
|
if (w[id] === undefined) {
|
|
30772
|
-
return new Promise((
|
|
30961
|
+
return new Promise((resolve8) => w[id] = resolve8);
|
|
30773
30962
|
}
|
|
30774
30963
|
const channelProxy = w[id];
|
|
30775
30964
|
delete w[id];
|
|
@@ -32120,8 +32309,8 @@ var require_Deferred = __commonJS((exports) => {
|
|
|
32120
32309
|
return this.#result;
|
|
32121
32310
|
}
|
|
32122
32311
|
constructor() {
|
|
32123
|
-
this.#promise = new Promise((
|
|
32124
|
-
this.#resolve =
|
|
32312
|
+
this.#promise = new Promise((resolve8, reject) => {
|
|
32313
|
+
this.#resolve = resolve8;
|
|
32125
32314
|
this.#reject = reject;
|
|
32126
32315
|
});
|
|
32127
32316
|
this.#promise.catch((_error) => {});
|
|
@@ -36446,11 +36635,11 @@ var require_BrowsingContextStorage = __commonJS((exports) => {
|
|
|
36446
36635
|
if (this.#contexts.has(browsingContextId)) {
|
|
36447
36636
|
return Promise.resolve(this.getContext(browsingContextId));
|
|
36448
36637
|
}
|
|
36449
|
-
return new Promise((
|
|
36638
|
+
return new Promise((resolve8) => {
|
|
36450
36639
|
const listener = (event) => {
|
|
36451
36640
|
if (event.browsingContext.id === browsingContextId) {
|
|
36452
36641
|
this.#eventEmitter.off("added", listener);
|
|
36453
|
-
|
|
36642
|
+
resolve8(event.browsingContext);
|
|
36454
36643
|
}
|
|
36455
36644
|
};
|
|
36456
36645
|
this.#eventEmitter.on("added", listener);
|
|
@@ -39946,8 +40135,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
39946
40135
|
const functionDeclaration = stringifyFunction(interpolateFunction((callback) => {
|
|
39947
40136
|
Object.assign(globalThis, {
|
|
39948
40137
|
[PLACEHOLDER("name")]: function(...args) {
|
|
39949
|
-
return new Promise((
|
|
39950
|
-
callback([
|
|
40138
|
+
return new Promise((resolve8, reject) => {
|
|
40139
|
+
callback([resolve8, reject, args]);
|
|
39951
40140
|
});
|
|
39952
40141
|
}
|
|
39953
40142
|
});
|
|
@@ -40035,8 +40224,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
40035
40224
|
return;
|
|
40036
40225
|
}
|
|
40037
40226
|
try {
|
|
40038
|
-
await dataHandle.evaluate(([
|
|
40039
|
-
|
|
40227
|
+
await dataHandle.evaluate(([resolve8], result2) => {
|
|
40228
|
+
resolve8(result2);
|
|
40040
40229
|
}, result);
|
|
40041
40230
|
} catch (error) {
|
|
40042
40231
|
debugError(error);
|
|
@@ -47328,7 +47517,7 @@ __export(exports_NodeWebSocketTransport, {
|
|
|
47328
47517
|
|
|
47329
47518
|
class NodeWebSocketTransport {
|
|
47330
47519
|
static create(url, headers) {
|
|
47331
|
-
return new Promise((
|
|
47520
|
+
return new Promise((resolve8, reject) => {
|
|
47332
47521
|
const ws = new wrapper_default(url, [], {
|
|
47333
47522
|
followRedirects: true,
|
|
47334
47523
|
perMessageDeflate: false,
|
|
@@ -47340,7 +47529,7 @@ class NodeWebSocketTransport {
|
|
|
47340
47529
|
}
|
|
47341
47530
|
});
|
|
47342
47531
|
ws.addEventListener("open", () => {
|
|
47343
|
-
return
|
|
47532
|
+
return resolve8(new NodeWebSocketTransport(ws));
|
|
47344
47533
|
});
|
|
47345
47534
|
ws.addEventListener("error", reject);
|
|
47346
47535
|
});
|
|
@@ -50232,8 +50421,8 @@ var require_helpers = __commonJS((exports) => {
|
|
|
50232
50421
|
function req(url, opts = {}) {
|
|
50233
50422
|
const href = typeof url === "string" ? url : url.href;
|
|
50234
50423
|
const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
50235
|
-
const promise = new Promise((
|
|
50236
|
-
req2.once("response",
|
|
50424
|
+
const promise = new Promise((resolve8, reject) => {
|
|
50425
|
+
req2.once("response", resolve8).once("error", reject).end();
|
|
50237
50426
|
});
|
|
50238
50427
|
req2.then = promise.then.bind(promise);
|
|
50239
50428
|
return req2;
|
|
@@ -50604,7 +50793,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
50604
50793
|
var debug_1 = __importDefault(require_src());
|
|
50605
50794
|
var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
50606
50795
|
function parseProxyResponse(socket) {
|
|
50607
|
-
return new Promise((
|
|
50796
|
+
return new Promise((resolve8, reject) => {
|
|
50608
50797
|
let buffersLength = 0;
|
|
50609
50798
|
const buffers = [];
|
|
50610
50799
|
function read() {
|
|
@@ -50673,7 +50862,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
50673
50862
|
}
|
|
50674
50863
|
debug2("got proxy server response: %o %o", firstLine, headers);
|
|
50675
50864
|
cleanup();
|
|
50676
|
-
|
|
50865
|
+
resolve8({
|
|
50677
50866
|
connect: {
|
|
50678
50867
|
statusCode,
|
|
50679
50868
|
statusText,
|
|
@@ -52777,11 +52966,11 @@ var require_receivebuffer = __commonJS((exports) => {
|
|
|
52777
52966
|
var require_socksclient = __commonJS((exports) => {
|
|
52778
52967
|
var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
52779
52968
|
function adopt(value) {
|
|
52780
|
-
return value instanceof P ? value : new P(function(
|
|
52781
|
-
|
|
52969
|
+
return value instanceof P ? value : new P(function(resolve8) {
|
|
52970
|
+
resolve8(value);
|
|
52782
52971
|
});
|
|
52783
52972
|
}
|
|
52784
|
-
return new (P || (P = Promise))(function(
|
|
52973
|
+
return new (P || (P = Promise))(function(resolve8, reject) {
|
|
52785
52974
|
function fulfilled(value) {
|
|
52786
52975
|
try {
|
|
52787
52976
|
step(generator.next(value));
|
|
@@ -52797,7 +52986,7 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
52797
52986
|
}
|
|
52798
52987
|
}
|
|
52799
52988
|
function step(result) {
|
|
52800
|
-
result.done ?
|
|
52989
|
+
result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
52801
52990
|
}
|
|
52802
52991
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
52803
52992
|
});
|
|
@@ -52824,13 +53013,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
52824
53013
|
this.setState(constants_1.SocksClientState.Created);
|
|
52825
53014
|
}
|
|
52826
53015
|
static createConnection(options, callback) {
|
|
52827
|
-
return new Promise((
|
|
53016
|
+
return new Promise((resolve8, reject) => {
|
|
52828
53017
|
try {
|
|
52829
53018
|
(0, helpers_1.validateSocksClientOptions)(options, ["connect"]);
|
|
52830
53019
|
} catch (err) {
|
|
52831
53020
|
if (typeof callback === "function") {
|
|
52832
53021
|
callback(err);
|
|
52833
|
-
return
|
|
53022
|
+
return resolve8(err);
|
|
52834
53023
|
} else {
|
|
52835
53024
|
return reject(err);
|
|
52836
53025
|
}
|
|
@@ -52841,16 +53030,16 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
52841
53030
|
client.removeAllListeners();
|
|
52842
53031
|
if (typeof callback === "function") {
|
|
52843
53032
|
callback(null, info);
|
|
52844
|
-
|
|
53033
|
+
resolve8(info);
|
|
52845
53034
|
} else {
|
|
52846
|
-
|
|
53035
|
+
resolve8(info);
|
|
52847
53036
|
}
|
|
52848
53037
|
});
|
|
52849
53038
|
client.once("error", (err) => {
|
|
52850
53039
|
client.removeAllListeners();
|
|
52851
53040
|
if (typeof callback === "function") {
|
|
52852
53041
|
callback(err);
|
|
52853
|
-
|
|
53042
|
+
resolve8(err);
|
|
52854
53043
|
} else {
|
|
52855
53044
|
reject(err);
|
|
52856
53045
|
}
|
|
@@ -52858,13 +53047,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
52858
53047
|
});
|
|
52859
53048
|
}
|
|
52860
53049
|
static createConnectionChain(options, callback) {
|
|
52861
|
-
return new Promise((
|
|
53050
|
+
return new Promise((resolve8, reject) => __awaiter2(this, undefined, undefined, function* () {
|
|
52862
53051
|
try {
|
|
52863
53052
|
(0, helpers_1.validateSocksClientChainOptions)(options);
|
|
52864
53053
|
} catch (err) {
|
|
52865
53054
|
if (typeof callback === "function") {
|
|
52866
53055
|
callback(err);
|
|
52867
|
-
return
|
|
53056
|
+
return resolve8(err);
|
|
52868
53057
|
} else {
|
|
52869
53058
|
return reject(err);
|
|
52870
53059
|
}
|
|
@@ -52890,14 +53079,14 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
52890
53079
|
}
|
|
52891
53080
|
if (typeof callback === "function") {
|
|
52892
53081
|
callback(null, { socket: sock });
|
|
52893
|
-
|
|
53082
|
+
resolve8({ socket: sock });
|
|
52894
53083
|
} else {
|
|
52895
|
-
|
|
53084
|
+
resolve8({ socket: sock });
|
|
52896
53085
|
}
|
|
52897
53086
|
} catch (err) {
|
|
52898
53087
|
if (typeof callback === "function") {
|
|
52899
53088
|
callback(err);
|
|
52900
|
-
|
|
53089
|
+
resolve8(err);
|
|
52901
53090
|
} else {
|
|
52902
53091
|
reject(err);
|
|
52903
53092
|
}
|
|
@@ -53497,12 +53686,12 @@ var require_dist4 = __commonJS((exports) => {
|
|
|
53497
53686
|
let { host } = opts;
|
|
53498
53687
|
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
53499
53688
|
if (shouldLookup) {
|
|
53500
|
-
host = await new Promise((
|
|
53689
|
+
host = await new Promise((resolve8, reject) => {
|
|
53501
53690
|
lookupFn(host, {}, (err, res) => {
|
|
53502
53691
|
if (err) {
|
|
53503
53692
|
reject(err);
|
|
53504
53693
|
} else {
|
|
53505
|
-
|
|
53694
|
+
resolve8(res);
|
|
53506
53695
|
}
|
|
53507
53696
|
});
|
|
53508
53697
|
});
|
|
@@ -54509,7 +54698,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
54509
54698
|
return `${socket.remoteAddress}:${socket.remotePort}`;
|
|
54510
54699
|
}
|
|
54511
54700
|
function upgradeSocket(socket, options) {
|
|
54512
|
-
return new Promise((
|
|
54701
|
+
return new Promise((resolve8, reject) => {
|
|
54513
54702
|
const tlsOptions = Object.assign({}, options, {
|
|
54514
54703
|
socket
|
|
54515
54704
|
});
|
|
@@ -54519,7 +54708,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
54519
54708
|
reject(tlsSocket.authorizationError);
|
|
54520
54709
|
} else {
|
|
54521
54710
|
tlsSocket.removeAllListeners("error");
|
|
54522
|
-
|
|
54711
|
+
resolve8(tlsSocket);
|
|
54523
54712
|
}
|
|
54524
54713
|
}).once("error", (error) => {
|
|
54525
54714
|
reject(error);
|
|
@@ -54611,7 +54800,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
54611
54800
|
};
|
|
54612
54801
|
}
|
|
54613
54802
|
function connectForPassiveTransfer(host, port, ftp) {
|
|
54614
|
-
return new Promise((
|
|
54803
|
+
return new Promise((resolve8, reject) => {
|
|
54615
54804
|
let socket = ftp._newSocket();
|
|
54616
54805
|
const handleConnErr = function(err) {
|
|
54617
54806
|
err.message = "Can't open data connection in passive mode: " + err.message;
|
|
@@ -54634,7 +54823,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
54634
54823
|
socket.removeListener("error", handleConnErr);
|
|
54635
54824
|
socket.removeListener("timeout", handleTimeout);
|
|
54636
54825
|
ftp.dataSocket = socket;
|
|
54637
|
-
|
|
54826
|
+
resolve8();
|
|
54638
54827
|
});
|
|
54639
54828
|
});
|
|
54640
54829
|
}
|
|
@@ -56712,7 +56901,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
56712
56901
|
return path;
|
|
56713
56902
|
}
|
|
56714
56903
|
exports.normalize = normalize2;
|
|
56715
|
-
function
|
|
56904
|
+
function join26(aRoot, aPath) {
|
|
56716
56905
|
if (aRoot === "") {
|
|
56717
56906
|
aRoot = ".";
|
|
56718
56907
|
}
|
|
@@ -56744,7 +56933,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
56744
56933
|
}
|
|
56745
56934
|
return joined;
|
|
56746
56935
|
}
|
|
56747
|
-
exports.join =
|
|
56936
|
+
exports.join = join26;
|
|
56748
56937
|
exports.isAbsolute = function(aPath) {
|
|
56749
56938
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
56750
56939
|
};
|
|
@@ -56917,7 +57106,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
56917
57106
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
56918
57107
|
}
|
|
56919
57108
|
}
|
|
56920
|
-
sourceURL =
|
|
57109
|
+
sourceURL = join26(urlGenerate(parsed), sourceURL);
|
|
56921
57110
|
}
|
|
56922
57111
|
return normalize2(sourceURL);
|
|
56923
57112
|
}
|
|
@@ -58649,7 +58838,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58649
58838
|
function noEmptySpace() {
|
|
58650
58839
|
return space ? space : " ";
|
|
58651
58840
|
}
|
|
58652
|
-
function
|
|
58841
|
+
function join26(left, right) {
|
|
58653
58842
|
var leftSource, rightSource, leftCharCode, rightCharCode;
|
|
58654
58843
|
leftSource = toSourceNodeWhenNeeded(left).toString();
|
|
58655
58844
|
if (leftSource.length === 0) {
|
|
@@ -58990,8 +59179,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58990
59179
|
} else {
|
|
58991
59180
|
result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT));
|
|
58992
59181
|
}
|
|
58993
|
-
result =
|
|
58994
|
-
result = [
|
|
59182
|
+
result = join26(result, operator);
|
|
59183
|
+
result = [join26(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
|
|
58995
59184
|
});
|
|
58996
59185
|
result.push(this.maybeBlock(stmt.body, flags));
|
|
58997
59186
|
return result;
|
|
@@ -59129,11 +59318,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59129
59318
|
var result, fragment;
|
|
59130
59319
|
result = ["class"];
|
|
59131
59320
|
if (stmt.id) {
|
|
59132
|
-
result =
|
|
59321
|
+
result = join26(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
|
|
59133
59322
|
}
|
|
59134
59323
|
if (stmt.superClass) {
|
|
59135
|
-
fragment =
|
|
59136
|
-
result =
|
|
59324
|
+
fragment = join26("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
|
|
59325
|
+
result = join26(result, fragment);
|
|
59137
59326
|
}
|
|
59138
59327
|
result.push(space);
|
|
59139
59328
|
result.push(this.generateStatement(stmt.body, S_TFFT));
|
|
@@ -59146,9 +59335,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59146
59335
|
return escapeDirective(stmt.directive) + this.semicolon(flags);
|
|
59147
59336
|
},
|
|
59148
59337
|
DoWhileStatement: function(stmt, flags) {
|
|
59149
|
-
var result =
|
|
59338
|
+
var result = join26("do", this.maybeBlock(stmt.body, S_TFFF));
|
|
59150
59339
|
result = this.maybeBlockSuffix(stmt.body, result);
|
|
59151
|
-
return
|
|
59340
|
+
return join26(result, [
|
|
59152
59341
|
"while" + space + "(",
|
|
59153
59342
|
this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
59154
59343
|
")" + this.semicolon(flags)
|
|
@@ -59184,11 +59373,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59184
59373
|
ExportDefaultDeclaration: function(stmt, flags) {
|
|
59185
59374
|
var result = ["export"], bodyFlags;
|
|
59186
59375
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
59187
|
-
result =
|
|
59376
|
+
result = join26(result, "default");
|
|
59188
59377
|
if (isStatement(stmt.declaration)) {
|
|
59189
|
-
result =
|
|
59378
|
+
result = join26(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
59190
59379
|
} else {
|
|
59191
|
-
result =
|
|
59380
|
+
result = join26(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
|
|
59192
59381
|
}
|
|
59193
59382
|
return result;
|
|
59194
59383
|
},
|
|
@@ -59196,15 +59385,15 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59196
59385
|
var result = ["export"], bodyFlags, that = this;
|
|
59197
59386
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
59198
59387
|
if (stmt.declaration) {
|
|
59199
|
-
return
|
|
59388
|
+
return join26(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
59200
59389
|
}
|
|
59201
59390
|
if (stmt.specifiers) {
|
|
59202
59391
|
if (stmt.specifiers.length === 0) {
|
|
59203
|
-
result =
|
|
59392
|
+
result = join26(result, "{" + space + "}");
|
|
59204
59393
|
} else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) {
|
|
59205
|
-
result =
|
|
59394
|
+
result = join26(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
|
|
59206
59395
|
} else {
|
|
59207
|
-
result =
|
|
59396
|
+
result = join26(result, "{");
|
|
59208
59397
|
withIndent(function(indent2) {
|
|
59209
59398
|
var i, iz;
|
|
59210
59399
|
result.push(newline);
|
|
@@ -59222,7 +59411,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59222
59411
|
result.push(base + "}");
|
|
59223
59412
|
}
|
|
59224
59413
|
if (stmt.source) {
|
|
59225
|
-
result =
|
|
59414
|
+
result = join26(result, [
|
|
59226
59415
|
"from" + space,
|
|
59227
59416
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
59228
59417
|
this.semicolon(flags)
|
|
@@ -59306,7 +59495,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59306
59495
|
];
|
|
59307
59496
|
cursor = 0;
|
|
59308
59497
|
if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) {
|
|
59309
|
-
result =
|
|
59498
|
+
result = join26(result, [
|
|
59310
59499
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
59311
59500
|
]);
|
|
59312
59501
|
++cursor;
|
|
@@ -59316,7 +59505,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59316
59505
|
result.push(",");
|
|
59317
59506
|
}
|
|
59318
59507
|
if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) {
|
|
59319
|
-
result =
|
|
59508
|
+
result = join26(result, [
|
|
59320
59509
|
space,
|
|
59321
59510
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
59322
59511
|
]);
|
|
@@ -59345,7 +59534,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59345
59534
|
}
|
|
59346
59535
|
}
|
|
59347
59536
|
}
|
|
59348
|
-
result =
|
|
59537
|
+
result = join26(result, [
|
|
59349
59538
|
"from" + space,
|
|
59350
59539
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
59351
59540
|
this.semicolon(flags)
|
|
@@ -59399,7 +59588,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59399
59588
|
return result;
|
|
59400
59589
|
},
|
|
59401
59590
|
ThrowStatement: function(stmt, flags) {
|
|
59402
|
-
return [
|
|
59591
|
+
return [join26("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
59403
59592
|
},
|
|
59404
59593
|
TryStatement: function(stmt, flags) {
|
|
59405
59594
|
var result, i, iz, guardedHandlers;
|
|
@@ -59407,7 +59596,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59407
59596
|
result = this.maybeBlockSuffix(stmt.block, result);
|
|
59408
59597
|
if (stmt.handlers) {
|
|
59409
59598
|
for (i = 0, iz = stmt.handlers.length;i < iz; ++i) {
|
|
59410
|
-
result =
|
|
59599
|
+
result = join26(result, this.generateStatement(stmt.handlers[i], S_TFFF));
|
|
59411
59600
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
59412
59601
|
result = this.maybeBlockSuffix(stmt.handlers[i].body, result);
|
|
59413
59602
|
}
|
|
@@ -59415,7 +59604,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59415
59604
|
} else {
|
|
59416
59605
|
guardedHandlers = stmt.guardedHandlers || [];
|
|
59417
59606
|
for (i = 0, iz = guardedHandlers.length;i < iz; ++i) {
|
|
59418
|
-
result =
|
|
59607
|
+
result = join26(result, this.generateStatement(guardedHandlers[i], S_TFFF));
|
|
59419
59608
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
59420
59609
|
result = this.maybeBlockSuffix(guardedHandlers[i].body, result);
|
|
59421
59610
|
}
|
|
@@ -59423,13 +59612,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59423
59612
|
if (stmt.handler) {
|
|
59424
59613
|
if (Array.isArray(stmt.handler)) {
|
|
59425
59614
|
for (i = 0, iz = stmt.handler.length;i < iz; ++i) {
|
|
59426
|
-
result =
|
|
59615
|
+
result = join26(result, this.generateStatement(stmt.handler[i], S_TFFF));
|
|
59427
59616
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
59428
59617
|
result = this.maybeBlockSuffix(stmt.handler[i].body, result);
|
|
59429
59618
|
}
|
|
59430
59619
|
}
|
|
59431
59620
|
} else {
|
|
59432
|
-
result =
|
|
59621
|
+
result = join26(result, this.generateStatement(stmt.handler, S_TFFF));
|
|
59433
59622
|
if (stmt.finalizer) {
|
|
59434
59623
|
result = this.maybeBlockSuffix(stmt.handler.body, result);
|
|
59435
59624
|
}
|
|
@@ -59437,7 +59626,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59437
59626
|
}
|
|
59438
59627
|
}
|
|
59439
59628
|
if (stmt.finalizer) {
|
|
59440
|
-
result =
|
|
59629
|
+
result = join26(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
|
|
59441
59630
|
}
|
|
59442
59631
|
return result;
|
|
59443
59632
|
},
|
|
@@ -59471,7 +59660,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59471
59660
|
withIndent(function() {
|
|
59472
59661
|
if (stmt.test) {
|
|
59473
59662
|
result = [
|
|
59474
|
-
|
|
59663
|
+
join26("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
|
|
59475
59664
|
":"
|
|
59476
59665
|
];
|
|
59477
59666
|
} else {
|
|
@@ -59519,9 +59708,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59519
59708
|
result.push(this.maybeBlock(stmt.consequent, S_TFFF));
|
|
59520
59709
|
result = this.maybeBlockSuffix(stmt.consequent, result);
|
|
59521
59710
|
if (stmt.alternate.type === Syntax.IfStatement) {
|
|
59522
|
-
result =
|
|
59711
|
+
result = join26(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
|
|
59523
59712
|
} else {
|
|
59524
|
-
result =
|
|
59713
|
+
result = join26(result, join26("else", this.maybeBlock(stmt.alternate, bodyFlags)));
|
|
59525
59714
|
}
|
|
59526
59715
|
} else {
|
|
59527
59716
|
result.push(this.maybeBlock(stmt.consequent, bodyFlags));
|
|
@@ -59623,7 +59812,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59623
59812
|
},
|
|
59624
59813
|
ReturnStatement: function(stmt, flags) {
|
|
59625
59814
|
if (stmt.argument) {
|
|
59626
|
-
return [
|
|
59815
|
+
return [join26("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
59627
59816
|
}
|
|
59628
59817
|
return ["return" + this.semicolon(flags)];
|
|
59629
59818
|
},
|
|
@@ -59705,14 +59894,14 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59705
59894
|
if (leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) {
|
|
59706
59895
|
result = [fragment, noEmptySpace(), expr.operator];
|
|
59707
59896
|
} else {
|
|
59708
|
-
result =
|
|
59897
|
+
result = join26(fragment, expr.operator);
|
|
59709
59898
|
}
|
|
59710
59899
|
fragment = this.generateExpression(expr.right, rightPrecedence, flags);
|
|
59711
59900
|
if (expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--") {
|
|
59712
59901
|
result.push(noEmptySpace());
|
|
59713
59902
|
result.push(fragment);
|
|
59714
59903
|
} else {
|
|
59715
|
-
result =
|
|
59904
|
+
result = join26(result, fragment);
|
|
59716
59905
|
}
|
|
59717
59906
|
if (expr.operator === "in" && !(flags & F_ALLOW_IN)) {
|
|
59718
59907
|
return ["(", result, ")"];
|
|
@@ -59752,7 +59941,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59752
59941
|
var result, length, i, iz, itemFlags;
|
|
59753
59942
|
length = expr["arguments"].length;
|
|
59754
59943
|
itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF;
|
|
59755
|
-
result =
|
|
59944
|
+
result = join26("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
|
|
59756
59945
|
if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
|
|
59757
59946
|
result.push("(");
|
|
59758
59947
|
for (i = 0, iz = length;i < iz; ++i) {
|
|
@@ -59799,11 +59988,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59799
59988
|
var result, fragment, rightCharCode, leftSource, leftCharCode;
|
|
59800
59989
|
fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT);
|
|
59801
59990
|
if (space === "") {
|
|
59802
|
-
result =
|
|
59991
|
+
result = join26(expr.operator, fragment);
|
|
59803
59992
|
} else {
|
|
59804
59993
|
result = [expr.operator];
|
|
59805
59994
|
if (expr.operator.length > 2) {
|
|
59806
|
-
result =
|
|
59995
|
+
result = join26(result, fragment);
|
|
59807
59996
|
} else {
|
|
59808
59997
|
leftSource = toSourceNodeWhenNeeded(result).toString();
|
|
59809
59998
|
leftCharCode = leftSource.charCodeAt(leftSource.length - 1);
|
|
@@ -59826,12 +60015,12 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59826
60015
|
result = "yield";
|
|
59827
60016
|
}
|
|
59828
60017
|
if (expr.argument) {
|
|
59829
|
-
result =
|
|
60018
|
+
result = join26(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
|
|
59830
60019
|
}
|
|
59831
60020
|
return parenthesize(result, Precedence.Yield, precedence);
|
|
59832
60021
|
},
|
|
59833
60022
|
AwaitExpression: function(expr, precedence, flags) {
|
|
59834
|
-
var result =
|
|
60023
|
+
var result = join26(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
|
|
59835
60024
|
return parenthesize(result, Precedence.Await, precedence);
|
|
59836
60025
|
},
|
|
59837
60026
|
UpdateExpression: function(expr, precedence, flags) {
|
|
@@ -59903,11 +60092,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59903
60092
|
var result, fragment;
|
|
59904
60093
|
result = ["class"];
|
|
59905
60094
|
if (expr.id) {
|
|
59906
|
-
result =
|
|
60095
|
+
result = join26(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
|
|
59907
60096
|
}
|
|
59908
60097
|
if (expr.superClass) {
|
|
59909
|
-
fragment =
|
|
59910
|
-
result =
|
|
60098
|
+
fragment = join26("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
|
|
60099
|
+
result = join26(result, fragment);
|
|
59911
60100
|
}
|
|
59912
60101
|
result.push(space);
|
|
59913
60102
|
result.push(this.generateStatement(expr.body, S_TFFT));
|
|
@@ -59922,7 +60111,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59922
60111
|
}
|
|
59923
60112
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
59924
60113
|
fragment = [
|
|
59925
|
-
|
|
60114
|
+
join26(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
|
|
59926
60115
|
this.generateFunctionBody(expr.value)
|
|
59927
60116
|
];
|
|
59928
60117
|
} else {
|
|
@@ -59932,7 +60121,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59932
60121
|
this.generateFunctionBody(expr.value)
|
|
59933
60122
|
];
|
|
59934
60123
|
}
|
|
59935
|
-
return
|
|
60124
|
+
return join26(result, fragment);
|
|
59936
60125
|
},
|
|
59937
60126
|
Property: function(expr, precedence, flags) {
|
|
59938
60127
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
@@ -60126,7 +60315,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60126
60315
|
for (i = 0, iz = expr.blocks.length;i < iz; ++i) {
|
|
60127
60316
|
fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT);
|
|
60128
60317
|
if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
60129
|
-
result =
|
|
60318
|
+
result = join26(result, fragment);
|
|
60130
60319
|
} else {
|
|
60131
60320
|
result.push(fragment);
|
|
60132
60321
|
}
|
|
@@ -60134,13 +60323,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60134
60323
|
});
|
|
60135
60324
|
}
|
|
60136
60325
|
if (expr.filter) {
|
|
60137
|
-
result =
|
|
60326
|
+
result = join26(result, "if" + space);
|
|
60138
60327
|
fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT);
|
|
60139
|
-
result =
|
|
60328
|
+
result = join26(result, ["(", fragment, ")"]);
|
|
60140
60329
|
}
|
|
60141
60330
|
if (!extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
60142
60331
|
fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
|
|
60143
|
-
result =
|
|
60332
|
+
result = join26(result, fragment);
|
|
60144
60333
|
}
|
|
60145
60334
|
result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]");
|
|
60146
60335
|
return result;
|
|
@@ -60156,8 +60345,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60156
60345
|
} else {
|
|
60157
60346
|
fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT);
|
|
60158
60347
|
}
|
|
60159
|
-
fragment =
|
|
60160
|
-
fragment =
|
|
60348
|
+
fragment = join26(fragment, expr.of ? "of" : "in");
|
|
60349
|
+
fragment = join26(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
|
|
60161
60350
|
return ["for" + space + "(", fragment, ")"];
|
|
60162
60351
|
},
|
|
60163
60352
|
SpreadElement: function(expr, precedence, flags) {
|
|
@@ -66645,11 +66834,11 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
66645
66834
|
};
|
|
66646
66835
|
__awaiter2 = function(thisArg, _arguments, P, generator) {
|
|
66647
66836
|
function adopt(value) {
|
|
66648
|
-
return value instanceof P ? value : new P(function(
|
|
66649
|
-
|
|
66837
|
+
return value instanceof P ? value : new P(function(resolve8) {
|
|
66838
|
+
resolve8(value);
|
|
66650
66839
|
});
|
|
66651
66840
|
}
|
|
66652
|
-
return new (P || (P = Promise))(function(
|
|
66841
|
+
return new (P || (P = Promise))(function(resolve8, reject) {
|
|
66653
66842
|
function fulfilled(value) {
|
|
66654
66843
|
try {
|
|
66655
66844
|
step(generator.next(value));
|
|
@@ -66665,7 +66854,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
66665
66854
|
}
|
|
66666
66855
|
}
|
|
66667
66856
|
function step(result) {
|
|
66668
|
-
result.done ?
|
|
66857
|
+
result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
66669
66858
|
}
|
|
66670
66859
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
66671
66860
|
});
|
|
@@ -66894,14 +67083,14 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
66894
67083
|
}, i);
|
|
66895
67084
|
function verb(n) {
|
|
66896
67085
|
i[n] = o[n] && function(v) {
|
|
66897
|
-
return new Promise(function(
|
|
66898
|
-
v = o[n](v), settle(
|
|
67086
|
+
return new Promise(function(resolve8, reject) {
|
|
67087
|
+
v = o[n](v), settle(resolve8, reject, v.done, v.value);
|
|
66899
67088
|
});
|
|
66900
67089
|
};
|
|
66901
67090
|
}
|
|
66902
|
-
function settle(
|
|
67091
|
+
function settle(resolve8, reject, d, v) {
|
|
66903
67092
|
Promise.resolve(v).then(function(v2) {
|
|
66904
|
-
|
|
67093
|
+
resolve8({ value: v2, done: d });
|
|
66905
67094
|
}, reject);
|
|
66906
67095
|
}
|
|
66907
67096
|
};
|
|
@@ -70140,12 +70329,12 @@ var require_util3 = __commonJS((exports) => {
|
|
|
70140
70329
|
exports.isGMT = exports.dnsLookup = undefined;
|
|
70141
70330
|
var dns_1 = __require("dns");
|
|
70142
70331
|
function dnsLookup(host, opts) {
|
|
70143
|
-
return new Promise((
|
|
70332
|
+
return new Promise((resolve8, reject) => {
|
|
70144
70333
|
(0, dns_1.lookup)(host, opts, (err, res) => {
|
|
70145
70334
|
if (err) {
|
|
70146
70335
|
reject(err);
|
|
70147
70336
|
} else {
|
|
70148
|
-
|
|
70337
|
+
resolve8(res);
|
|
70149
70338
|
}
|
|
70150
70339
|
});
|
|
70151
70340
|
});
|
|
@@ -70719,10 +70908,10 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
70719
70908
|
var ip_1 = require_ip();
|
|
70720
70909
|
var net_1 = __importDefault(__require("net"));
|
|
70721
70910
|
async function myIpAddress() {
|
|
70722
|
-
return new Promise((
|
|
70911
|
+
return new Promise((resolve8, reject) => {
|
|
70723
70912
|
const socket = net_1.default.connect({ host: "8.8.8.8", port: 53 });
|
|
70724
70913
|
const onError = () => {
|
|
70725
|
-
|
|
70914
|
+
resolve8(ip_1.ip.address());
|
|
70726
70915
|
};
|
|
70727
70916
|
socket.once("error", onError);
|
|
70728
70917
|
socket.once("connect", () => {
|
|
@@ -70730,9 +70919,9 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
70730
70919
|
const addr = socket.address();
|
|
70731
70920
|
socket.destroy();
|
|
70732
70921
|
if (typeof addr === "string") {
|
|
70733
|
-
|
|
70922
|
+
resolve8(addr);
|
|
70734
70923
|
} else if (addr.address) {
|
|
70735
|
-
|
|
70924
|
+
resolve8(addr.address);
|
|
70736
70925
|
} else {
|
|
70737
70926
|
reject(new Error("Expected a `string`"));
|
|
70738
70927
|
}
|
|
@@ -71246,8 +71435,8 @@ var require_deferred_promise = __commonJS((exports) => {
|
|
|
71246
71435
|
this.context = args.context;
|
|
71247
71436
|
this.owner = args.context.runtime;
|
|
71248
71437
|
this.handle = args.promiseHandle;
|
|
71249
|
-
this.settled = new Promise((
|
|
71250
|
-
this.onSettled =
|
|
71438
|
+
this.settled = new Promise((resolve8) => {
|
|
71439
|
+
this.onSettled = resolve8;
|
|
71251
71440
|
});
|
|
71252
71441
|
this.resolveHandle = args.resolveHandle;
|
|
71253
71442
|
this.rejectHandle = args.rejectHandle;
|
|
@@ -71639,13 +71828,13 @@ var require_context = __commonJS((exports) => {
|
|
|
71639
71828
|
if (vmResolveResult.error) {
|
|
71640
71829
|
return Promise.resolve(vmResolveResult);
|
|
71641
71830
|
}
|
|
71642
|
-
return new Promise((
|
|
71831
|
+
return new Promise((resolve8) => {
|
|
71643
71832
|
lifetime_1.Scope.withScope((scope) => {
|
|
71644
71833
|
const resolveHandle = scope.manage(this.newFunction("resolve", (value) => {
|
|
71645
|
-
|
|
71834
|
+
resolve8({ value: value && value.dup() });
|
|
71646
71835
|
}));
|
|
71647
71836
|
const rejectHandle = scope.manage(this.newFunction("reject", (error) => {
|
|
71648
|
-
|
|
71837
|
+
resolve8({ error: error && error.dup() });
|
|
71649
71838
|
}));
|
|
71650
71839
|
const promiseHandle = scope.manage(vmResolveResult.value);
|
|
71651
71840
|
const promiseThenHandle = scope.manage(this.getProp(promiseHandle, "then"));
|
|
@@ -73759,13 +73948,13 @@ import * as http from "node:http";
|
|
|
73759
73948
|
import * as https from "node:https";
|
|
73760
73949
|
import { URL as URL2, urlToHttpOptions } from "node:url";
|
|
73761
73950
|
function headHttpRequest(url) {
|
|
73762
|
-
return new Promise((
|
|
73951
|
+
return new Promise((resolve8) => {
|
|
73763
73952
|
const request3 = httpRequest(url, "HEAD", (response) => {
|
|
73764
73953
|
response.resume();
|
|
73765
|
-
|
|
73954
|
+
resolve8(response.statusCode === 200);
|
|
73766
73955
|
}, false);
|
|
73767
73956
|
request3.on("error", () => {
|
|
73768
|
-
|
|
73957
|
+
resolve8(false);
|
|
73769
73958
|
});
|
|
73770
73959
|
});
|
|
73771
73960
|
}
|
|
@@ -73793,7 +73982,7 @@ function httpRequest(url, method, response, keepAlive = true) {
|
|
|
73793
73982
|
return request3;
|
|
73794
73983
|
}
|
|
73795
73984
|
function downloadFile(url, destinationPath, progressCallback) {
|
|
73796
|
-
return new Promise((
|
|
73985
|
+
return new Promise((resolve8, reject) => {
|
|
73797
73986
|
let downloadedBytes = 0;
|
|
73798
73987
|
let totalBytes = 0;
|
|
73799
73988
|
function onData(chunk) {
|
|
@@ -73809,7 +73998,7 @@ function downloadFile(url, destinationPath, progressCallback) {
|
|
|
73809
73998
|
}
|
|
73810
73999
|
const file = createWriteStream(destinationPath);
|
|
73811
74000
|
file.on("close", () => {
|
|
73812
|
-
return
|
|
74001
|
+
return resolve8();
|
|
73813
74002
|
});
|
|
73814
74003
|
file.on("error", (error) => {
|
|
73815
74004
|
return reject(error);
|
|
@@ -73834,7 +74023,7 @@ async function getJSON(url) {
|
|
|
73834
74023
|
}
|
|
73835
74024
|
}
|
|
73836
74025
|
function getText(url) {
|
|
73837
|
-
return new Promise((
|
|
74026
|
+
return new Promise((resolve8, reject) => {
|
|
73838
74027
|
const request3 = httpRequest(url, "GET", (response) => {
|
|
73839
74028
|
let data = "";
|
|
73840
74029
|
if (response.statusCode && response.statusCode >= 400) {
|
|
@@ -73845,7 +74034,7 @@ function getText(url) {
|
|
|
73845
74034
|
});
|
|
73846
74035
|
response.on("end", () => {
|
|
73847
74036
|
try {
|
|
73848
|
-
return
|
|
74037
|
+
return resolve8(String(data));
|
|
73849
74038
|
} catch {
|
|
73850
74039
|
return reject(new Error(`Failed to read text response from ${url}`));
|
|
73851
74040
|
}
|
|
@@ -73862,7 +74051,7 @@ var init_httpUtil = __esm(() => {
|
|
|
73862
74051
|
});
|
|
73863
74052
|
|
|
73864
74053
|
// node_modules/@puppeteer/browsers/lib/esm/browser-data/chrome.js
|
|
73865
|
-
import { execSync as
|
|
74054
|
+
import { execSync as execSync6 } from "node:child_process";
|
|
73866
74055
|
import os from "node:os";
|
|
73867
74056
|
import path from "node:path";
|
|
73868
74057
|
function folder(platform2) {
|
|
@@ -73952,7 +74141,7 @@ function getChromeWindowsLocation(channel2, locationsPrefixes) {
|
|
|
73952
74141
|
}
|
|
73953
74142
|
function getWslVariable(variable) {
|
|
73954
74143
|
try {
|
|
73955
|
-
const result =
|
|
74144
|
+
const result = execSync6(`cmd.exe /c echo %${variable.toLocaleUpperCase()}%`, {
|
|
73956
74145
|
stdio: ["ignore", "pipe", "ignore"],
|
|
73957
74146
|
encoding: "utf-8"
|
|
73958
74147
|
}).trim();
|
|
@@ -73963,7 +74152,7 @@ function getWslVariable(variable) {
|
|
|
73963
74152
|
return;
|
|
73964
74153
|
}
|
|
73965
74154
|
function getWslLocation(channel2) {
|
|
73966
|
-
const wslVersion =
|
|
74155
|
+
const wslVersion = execSync6("wslinfo --version", {
|
|
73967
74156
|
stdio: ["ignore", "pipe", "ignore"],
|
|
73968
74157
|
encoding: "utf-8"
|
|
73969
74158
|
}).trim();
|
|
@@ -73979,7 +74168,7 @@ function getWslLocation(channel2) {
|
|
|
73979
74168
|
}
|
|
73980
74169
|
const windowsPath = getChromeWindowsLocation(channel2, wslPrefixes);
|
|
73981
74170
|
return windowsPath.map((path2) => {
|
|
73982
|
-
return
|
|
74171
|
+
return execSync6(`wslpath "${path2}"`).toString().trim();
|
|
73983
74172
|
});
|
|
73984
74173
|
}
|
|
73985
74174
|
function getChromeLinuxOrWslLocation(channel2) {
|
|
@@ -75066,7 +75255,7 @@ class Process {
|
|
|
75066
75255
|
if (opts.onExit) {
|
|
75067
75256
|
this.#onExitHook = opts.onExit;
|
|
75068
75257
|
}
|
|
75069
|
-
this.#browserProcessExiting = new Promise((
|
|
75258
|
+
this.#browserProcessExiting = new Promise((resolve8, reject) => {
|
|
75070
75259
|
this.#browserProcess.once("exit", async () => {
|
|
75071
75260
|
debugLaunch(`Browser process ${this.#browserProcess.pid} onExit`);
|
|
75072
75261
|
this.#clearListeners();
|
|
@@ -75077,7 +75266,7 @@ class Process {
|
|
|
75077
75266
|
reject(err);
|
|
75078
75267
|
return;
|
|
75079
75268
|
}
|
|
75080
|
-
|
|
75269
|
+
resolve8();
|
|
75081
75270
|
});
|
|
75082
75271
|
});
|
|
75083
75272
|
}
|
|
@@ -75187,7 +75376,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
75187
75376
|
return [...this.#logs];
|
|
75188
75377
|
}
|
|
75189
75378
|
waitForLineOutput(regex, timeout2 = 0) {
|
|
75190
|
-
return new Promise((
|
|
75379
|
+
return new Promise((resolve8, reject) => {
|
|
75191
75380
|
const onClose = (errorOrCode) => {
|
|
75192
75381
|
cleanup();
|
|
75193
75382
|
reject(new Error([
|
|
@@ -75225,7 +75414,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
75225
75414
|
return;
|
|
75226
75415
|
}
|
|
75227
75416
|
cleanup();
|
|
75228
|
-
|
|
75417
|
+
resolve8(match[1]);
|
|
75229
75418
|
}
|
|
75230
75419
|
});
|
|
75231
75420
|
}
|
|
@@ -75755,7 +75944,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
75755
75944
|
};
|
|
75756
75945
|
const { maxBuffer } = options;
|
|
75757
75946
|
let stream;
|
|
75758
|
-
await new Promise((
|
|
75947
|
+
await new Promise((resolve8, reject) => {
|
|
75759
75948
|
const rejectPromise = (error) => {
|
|
75760
75949
|
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
75761
75950
|
error.bufferedData = stream.getBufferedValue();
|
|
@@ -75767,7 +75956,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
75767
75956
|
rejectPromise(error);
|
|
75768
75957
|
return;
|
|
75769
75958
|
}
|
|
75770
|
-
|
|
75959
|
+
resolve8();
|
|
75771
75960
|
});
|
|
75772
75961
|
stream.on("data", () => {
|
|
75773
75962
|
if (stream.getBufferedLength() > maxBuffer) {
|
|
@@ -77128,7 +77317,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
77128
77317
|
debug4("opening", this.zipPath, "with opts", this.opts);
|
|
77129
77318
|
this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
|
|
77130
77319
|
this.canceled = false;
|
|
77131
|
-
return new Promise((
|
|
77320
|
+
return new Promise((resolve8, reject) => {
|
|
77132
77321
|
this.zipfile.on("error", (err) => {
|
|
77133
77322
|
this.canceled = true;
|
|
77134
77323
|
reject(err);
|
|
@@ -77137,7 +77326,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
77137
77326
|
this.zipfile.on("close", () => {
|
|
77138
77327
|
if (!this.canceled) {
|
|
77139
77328
|
debug4("zip extraction complete");
|
|
77140
|
-
|
|
77329
|
+
resolve8();
|
|
77141
77330
|
}
|
|
77142
77331
|
});
|
|
77143
77332
|
this.zipfile.on("entry", async (entry) => {
|
|
@@ -78479,8 +78668,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
78479
78668
|
return this;
|
|
78480
78669
|
},
|
|
78481
78670
|
next() {
|
|
78482
|
-
return new Promise(function(
|
|
78483
|
-
promiseResolve =
|
|
78671
|
+
return new Promise(function(resolve8, reject) {
|
|
78672
|
+
promiseResolve = resolve8;
|
|
78484
78673
|
promiseReject = reject;
|
|
78485
78674
|
const data = stream.read();
|
|
78486
78675
|
if (data !== null)
|
|
@@ -78517,14 +78706,14 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
78517
78706
|
}
|
|
78518
78707
|
function destroy(err) {
|
|
78519
78708
|
stream.destroy(err);
|
|
78520
|
-
return new Promise((
|
|
78709
|
+
return new Promise((resolve8, reject) => {
|
|
78521
78710
|
if (stream._duplexState & DESTROYED)
|
|
78522
|
-
return
|
|
78711
|
+
return resolve8({ value: undefined, done: true });
|
|
78523
78712
|
stream.once("close", function() {
|
|
78524
78713
|
if (err)
|
|
78525
78714
|
reject(err);
|
|
78526
78715
|
else
|
|
78527
|
-
|
|
78716
|
+
resolve8({ value: undefined, done: true });
|
|
78528
78717
|
});
|
|
78529
78718
|
});
|
|
78530
78719
|
}
|
|
@@ -78576,8 +78765,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
78576
78765
|
return Promise.resolve(true);
|
|
78577
78766
|
if (state.drains === null)
|
|
78578
78767
|
state.drains = [];
|
|
78579
|
-
return new Promise((
|
|
78580
|
-
state.drains.push({ writes, resolve:
|
|
78768
|
+
return new Promise((resolve8) => {
|
|
78769
|
+
state.drains.push({ writes, resolve: resolve8 });
|
|
78581
78770
|
});
|
|
78582
78771
|
}
|
|
78583
78772
|
write(data) {
|
|
@@ -78691,11 +78880,11 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
78691
78880
|
cb(null);
|
|
78692
78881
|
}
|
|
78693
78882
|
function pipelinePromise(...streams) {
|
|
78694
|
-
return new Promise((
|
|
78883
|
+
return new Promise((resolve8, reject) => {
|
|
78695
78884
|
return pipeline(...streams, (err) => {
|
|
78696
78885
|
if (err)
|
|
78697
78886
|
return reject(err);
|
|
78698
|
-
|
|
78887
|
+
resolve8();
|
|
78699
78888
|
});
|
|
78700
78889
|
});
|
|
78701
78890
|
}
|
|
@@ -79409,16 +79598,16 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
79409
79598
|
entryCallback = null;
|
|
79410
79599
|
cb(err);
|
|
79411
79600
|
}
|
|
79412
|
-
function onnext(
|
|
79601
|
+
function onnext(resolve8, reject) {
|
|
79413
79602
|
if (error) {
|
|
79414
79603
|
return reject(error);
|
|
79415
79604
|
}
|
|
79416
79605
|
if (entryStream) {
|
|
79417
|
-
|
|
79606
|
+
resolve8({ value: entryStream, done: false });
|
|
79418
79607
|
entryStream = null;
|
|
79419
79608
|
return;
|
|
79420
79609
|
}
|
|
79421
|
-
promiseResolve =
|
|
79610
|
+
promiseResolve = resolve8;
|
|
79422
79611
|
promiseReject = reject;
|
|
79423
79612
|
consumeCallback(null);
|
|
79424
79613
|
if (extract._finished && promiseResolve) {
|
|
@@ -79449,14 +79638,14 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
79449
79638
|
function destroy(err) {
|
|
79450
79639
|
extract.destroy(err);
|
|
79451
79640
|
consumeCallback(err);
|
|
79452
|
-
return new Promise((
|
|
79641
|
+
return new Promise((resolve8, reject) => {
|
|
79453
79642
|
if (extract.destroyed)
|
|
79454
|
-
return
|
|
79643
|
+
return resolve8({ value: undefined, done: true });
|
|
79455
79644
|
extract.once("close", function() {
|
|
79456
79645
|
if (err)
|
|
79457
79646
|
reject(err);
|
|
79458
79647
|
else
|
|
79459
|
-
|
|
79648
|
+
resolve8({ value: undefined, done: true });
|
|
79460
79649
|
});
|
|
79461
79650
|
});
|
|
79462
79651
|
}
|
|
@@ -80254,7 +80443,7 @@ var init_fileUtil = __esm(() => {
|
|
|
80254
80443
|
// node_modules/@puppeteer/browsers/lib/esm/install.js
|
|
80255
80444
|
import assert2 from "node:assert";
|
|
80256
80445
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
80257
|
-
import { existsSync as
|
|
80446
|
+
import { existsSync as existsSync26, readFileSync as readFileSync24 } from "node:fs";
|
|
80258
80447
|
import { mkdir as mkdir2, unlink } from "node:fs/promises";
|
|
80259
80448
|
import os5 from "node:os";
|
|
80260
80449
|
import path8 from "node:path";
|
|
@@ -80307,7 +80496,7 @@ async function installWithProviders(options) {
|
|
|
80307
80496
|
continue;
|
|
80308
80497
|
}
|
|
80309
80498
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
|
|
80310
|
-
if (!
|
|
80499
|
+
if (!existsSync26(browserRoot)) {
|
|
80311
80500
|
await mkdir2(browserRoot, { recursive: true });
|
|
80312
80501
|
}
|
|
80313
80502
|
return await installUrl(url, options, provider);
|
|
@@ -80340,7 +80529,7 @@ async function installDeps(installedBrowser) {
|
|
|
80340
80529
|
return;
|
|
80341
80530
|
}
|
|
80342
80531
|
const depsPath = path8.join(path8.dirname(installedBrowser.executablePath), "deb.deps");
|
|
80343
|
-
if (!
|
|
80532
|
+
if (!existsSync26(depsPath)) {
|
|
80344
80533
|
debugInstall(`deb.deps file was not found at ${depsPath}`);
|
|
80345
80534
|
return;
|
|
80346
80535
|
}
|
|
@@ -80382,11 +80571,11 @@ async function installUrl(url, options, provider) {
|
|
|
80382
80571
|
const cache = new Cache(options.cacheDir);
|
|
80383
80572
|
const browserRoot = cache.browserRoot(options.browser);
|
|
80384
80573
|
const archivePath = path8.join(browserRoot, `${options.buildId}-${fileName}`);
|
|
80385
|
-
if (!
|
|
80574
|
+
if (!existsSync26(browserRoot)) {
|
|
80386
80575
|
await mkdir2(browserRoot, { recursive: true });
|
|
80387
80576
|
}
|
|
80388
80577
|
if (!options.unpack) {
|
|
80389
|
-
if (
|
|
80578
|
+
if (existsSync26(archivePath)) {
|
|
80390
80579
|
return archivePath;
|
|
80391
80580
|
}
|
|
80392
80581
|
debugInstall(`Downloading binary from ${url}`);
|
|
@@ -80407,8 +80596,8 @@ async function installUrl(url, options, provider) {
|
|
|
80407
80596
|
cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath6);
|
|
80408
80597
|
}
|
|
80409
80598
|
try {
|
|
80410
|
-
if (
|
|
80411
|
-
if (!
|
|
80599
|
+
if (existsSync26(outputPath)) {
|
|
80600
|
+
if (!existsSync26(installedBrowser.executablePath)) {
|
|
80412
80601
|
throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
|
|
80413
80602
|
}
|
|
80414
80603
|
await runSetup(installedBrowser);
|
|
@@ -80417,7 +80606,7 @@ async function installUrl(url, options, provider) {
|
|
|
80417
80606
|
}
|
|
80418
80607
|
return installedBrowser;
|
|
80419
80608
|
}
|
|
80420
|
-
if (!
|
|
80609
|
+
if (!existsSync26(archivePath)) {
|
|
80421
80610
|
debugInstall(`Downloading binary from ${url}`);
|
|
80422
80611
|
try {
|
|
80423
80612
|
debugTime("download");
|
|
@@ -80446,7 +80635,7 @@ async function installUrl(url, options, provider) {
|
|
|
80446
80635
|
}
|
|
80447
80636
|
return installedBrowser;
|
|
80448
80637
|
} finally {
|
|
80449
|
-
if (
|
|
80638
|
+
if (existsSync26(archivePath)) {
|
|
80450
80639
|
await unlink(archivePath);
|
|
80451
80640
|
}
|
|
80452
80641
|
}
|
|
@@ -80457,7 +80646,7 @@ async function runSetup(installedBrowser) {
|
|
|
80457
80646
|
debugTime("permissions");
|
|
80458
80647
|
const browserDir = path8.dirname(installedBrowser.executablePath);
|
|
80459
80648
|
const setupExePath = path8.join(browserDir, "setup.exe");
|
|
80460
|
-
if (!
|
|
80649
|
+
if (!existsSync26(setupExePath)) {
|
|
80461
80650
|
return;
|
|
80462
80651
|
}
|
|
80463
80652
|
spawnSync3(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
|
|
@@ -80838,19 +81027,19 @@ var init_cliui = __esm(() => {
|
|
|
80838
81027
|
});
|
|
80839
81028
|
|
|
80840
81029
|
// node_modules/escalade/sync/index.mjs
|
|
80841
|
-
import { dirname as
|
|
81030
|
+
import { dirname as dirname11, resolve as resolve9 } from "path";
|
|
80842
81031
|
import { readdirSync as readdirSync8, statSync as statSync10 } from "fs";
|
|
80843
81032
|
function sync_default(start, callback) {
|
|
80844
|
-
let dir =
|
|
81033
|
+
let dir = resolve9(".", start);
|
|
80845
81034
|
let tmp, stats = statSync10(dir);
|
|
80846
81035
|
if (!stats.isDirectory()) {
|
|
80847
|
-
dir =
|
|
81036
|
+
dir = dirname11(dir);
|
|
80848
81037
|
}
|
|
80849
81038
|
while (true) {
|
|
80850
81039
|
tmp = callback(dir, readdirSync8(dir));
|
|
80851
81040
|
if (tmp)
|
|
80852
|
-
return
|
|
80853
|
-
dir =
|
|
81041
|
+
return resolve9(dir, tmp);
|
|
81042
|
+
dir = dirname11(tmp = dir);
|
|
80854
81043
|
if (tmp === dir)
|
|
80855
81044
|
break;
|
|
80856
81045
|
}
|
|
@@ -81796,7 +81985,7 @@ var init_yargs_parser = __esm(() => {
|
|
|
81796
81985
|
|
|
81797
81986
|
// node_modules/yargs-parser/build/lib/index.js
|
|
81798
81987
|
import { format } from "util";
|
|
81799
|
-
import { normalize as normalize2, resolve as
|
|
81988
|
+
import { normalize as normalize2, resolve as resolve10 } from "path";
|
|
81800
81989
|
var _a3, _b, _c, minNodeVersion, nodeVersion, env, parser, yargsParser = function Parser(args, opts) {
|
|
81801
81990
|
const result = parser.parse(args.slice(), opts);
|
|
81802
81991
|
return result.argv;
|
|
@@ -81819,7 +82008,7 @@ var init_lib2 = __esm(() => {
|
|
|
81819
82008
|
},
|
|
81820
82009
|
format,
|
|
81821
82010
|
normalize: normalize2,
|
|
81822
|
-
resolve:
|
|
82011
|
+
resolve: resolve10,
|
|
81823
82012
|
require: (path9) => {
|
|
81824
82013
|
if (true) {
|
|
81825
82014
|
return __require(path9);
|
|
@@ -81872,7 +82061,7 @@ var init_yerror = __esm(() => {
|
|
|
81872
82061
|
// node_modules/y18n/build/lib/platform-shims/node.js
|
|
81873
82062
|
import { readFileSync as readFileSync25, statSync as statSync11, writeFile } from "fs";
|
|
81874
82063
|
import { format as format2 } from "util";
|
|
81875
|
-
import { resolve as
|
|
82064
|
+
import { resolve as resolve11 } from "path";
|
|
81876
82065
|
var node_default;
|
|
81877
82066
|
var init_node = __esm(() => {
|
|
81878
82067
|
node_default = {
|
|
@@ -81881,7 +82070,7 @@ var init_node = __esm(() => {
|
|
|
81881
82070
|
writeFile
|
|
81882
82071
|
},
|
|
81883
82072
|
format: format2,
|
|
81884
|
-
resolve:
|
|
82073
|
+
resolve: resolve11,
|
|
81885
82074
|
exists: (file) => {
|
|
81886
82075
|
try {
|
|
81887
82076
|
return statSync11(file).isFile();
|
|
@@ -82064,7 +82253,7 @@ import { notStrictEqual, strictEqual } from "assert";
|
|
|
82064
82253
|
import { inspect } from "util";
|
|
82065
82254
|
import { readFileSync as readFileSync26 } from "fs";
|
|
82066
82255
|
import { fileURLToPath } from "url";
|
|
82067
|
-
import { basename as basename10, dirname as
|
|
82256
|
+
import { basename as basename10, dirname as dirname12, extname as extname3, relative as relative7, resolve as resolve12 } from "path";
|
|
82068
82257
|
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;
|
|
82069
82258
|
var init_esm = __esm(() => {
|
|
82070
82259
|
init_cliui();
|
|
@@ -82097,10 +82286,10 @@ var init_esm = __esm(() => {
|
|
|
82097
82286
|
Parser: lib_default,
|
|
82098
82287
|
path: {
|
|
82099
82288
|
basename: basename10,
|
|
82100
|
-
dirname:
|
|
82289
|
+
dirname: dirname12,
|
|
82101
82290
|
extname: extname3,
|
|
82102
82291
|
relative: relative7,
|
|
82103
|
-
resolve:
|
|
82292
|
+
resolve: resolve12
|
|
82104
82293
|
},
|
|
82105
82294
|
process: {
|
|
82106
82295
|
argv: () => process.argv,
|
|
@@ -82122,7 +82311,7 @@ var init_esm = __esm(() => {
|
|
|
82122
82311
|
return [...str].length;
|
|
82123
82312
|
},
|
|
82124
82313
|
y18n: y18n_default({
|
|
82125
|
-
directory:
|
|
82314
|
+
directory: resolve12(__dirname2, "../../../locales"),
|
|
82126
82315
|
updateFiles: false
|
|
82127
82316
|
})
|
|
82128
82317
|
};
|
|
@@ -84370,12 +84559,12 @@ var init_yargs_factory = __esm(() => {
|
|
|
84370
84559
|
async getCompletion(args, done) {
|
|
84371
84560
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
84372
84561
|
if (!done) {
|
|
84373
|
-
return new Promise((
|
|
84562
|
+
return new Promise((resolve13, reject) => {
|
|
84374
84563
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
84375
84564
|
if (err)
|
|
84376
84565
|
reject(err);
|
|
84377
84566
|
else
|
|
84378
|
-
|
|
84567
|
+
resolve13(completions);
|
|
84379
84568
|
});
|
|
84380
84569
|
});
|
|
84381
84570
|
} else {
|
|
@@ -85810,9 +85999,9 @@ async function getConnectionTransport(options) {
|
|
|
85810
85999
|
throw new Error("Could not detect required browser platform");
|
|
85811
86000
|
}
|
|
85812
86001
|
const { convertPuppeteerChannelToBrowsersChannel: convertPuppeteerChannelToBrowsersChannel2 } = await Promise.resolve().then(() => (init_LaunchOptions(), exports_LaunchOptions));
|
|
85813
|
-
const { join:
|
|
86002
|
+
const { join: join27 } = await import("node:path");
|
|
85814
86003
|
const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform2, convertPuppeteerChannelToBrowsersChannel2(options.channel));
|
|
85815
|
-
const portPath =
|
|
86004
|
+
const portPath = join27(userDataDir, "DevToolsActivePort");
|
|
85816
86005
|
try {
|
|
85817
86006
|
const fileContent = await environment.value.fs.promises.readFile(portPath, "ascii");
|
|
85818
86007
|
const [rawPort, rawPath] = fileContent.split(`
|
|
@@ -86036,9 +86225,9 @@ var init_PipeTransport = __esm(() => {
|
|
|
86036
86225
|
});
|
|
86037
86226
|
|
|
86038
86227
|
// node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js
|
|
86039
|
-
import { existsSync as
|
|
86228
|
+
import { existsSync as existsSync27 } from "node:fs";
|
|
86040
86229
|
import { tmpdir } from "node:os";
|
|
86041
|
-
import { join as
|
|
86230
|
+
import { join as join27 } from "node:path";
|
|
86042
86231
|
|
|
86043
86232
|
class BrowserLauncher {
|
|
86044
86233
|
#browser;
|
|
@@ -86063,7 +86252,7 @@ class BrowserLauncher {
|
|
|
86063
86252
|
...options,
|
|
86064
86253
|
protocol
|
|
86065
86254
|
});
|
|
86066
|
-
if (!
|
|
86255
|
+
if (!existsSync27(launchArgs.executablePath)) {
|
|
86067
86256
|
throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
|
|
86068
86257
|
}
|
|
86069
86258
|
const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
|
|
@@ -86138,7 +86327,7 @@ class BrowserLauncher {
|
|
|
86138
86327
|
browserCloseCallback();
|
|
86139
86328
|
const logs = browserProcess.getRecentLogs().join(`
|
|
86140
86329
|
`);
|
|
86141
|
-
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" &&
|
|
86330
|
+
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync27(join27(launchArgs.userDataDir, "lockfile"))) {
|
|
86142
86331
|
throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
|
|
86143
86332
|
}
|
|
86144
86333
|
if (logs.includes("Missing X server") && options.headless === false) {
|
|
@@ -86228,12 +86417,12 @@ class BrowserLauncher {
|
|
|
86228
86417
|
});
|
|
86229
86418
|
}
|
|
86230
86419
|
getProfilePath() {
|
|
86231
|
-
return
|
|
86420
|
+
return join27(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
|
|
86232
86421
|
}
|
|
86233
86422
|
resolveExecutablePath(headless, validatePath = true) {
|
|
86234
86423
|
let executablePath = this.puppeteer.configuration.executablePath;
|
|
86235
86424
|
if (executablePath) {
|
|
86236
|
-
if (validatePath && !
|
|
86425
|
+
if (validatePath && !existsSync27(executablePath)) {
|
|
86237
86426
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}), but no executable was found.`);
|
|
86238
86427
|
}
|
|
86239
86428
|
return executablePath;
|
|
@@ -86256,7 +86445,7 @@ class BrowserLauncher {
|
|
|
86256
86445
|
browser: browserType,
|
|
86257
86446
|
buildId: this.puppeteer.browserVersion
|
|
86258
86447
|
});
|
|
86259
|
-
if (validatePath && !
|
|
86448
|
+
if (validatePath && !existsSync27(executablePath)) {
|
|
86260
86449
|
const configVersion = this.puppeteer.configuration?.[this.browser]?.version;
|
|
86261
86450
|
if (configVersion) {
|
|
86262
86451
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`);
|
|
@@ -86794,7 +86983,7 @@ var init_PuppeteerNode = __esm(() => {
|
|
|
86794
86983
|
import { spawn as spawn2, spawnSync as spawnSync4 } from "node:child_process";
|
|
86795
86984
|
import fs5 from "node:fs";
|
|
86796
86985
|
import os8 from "node:os";
|
|
86797
|
-
import { dirname as
|
|
86986
|
+
import { dirname as dirname13 } from "node:path";
|
|
86798
86987
|
import { PassThrough } from "node:stream";
|
|
86799
86988
|
var import_debug6, __runInitializers22 = function(thisArg, initializers, value) {
|
|
86800
86989
|
var useValue = arguments.length > 2;
|
|
@@ -86868,8 +87057,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
86868
87057
|
static {
|
|
86869
87058
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : undefined;
|
|
86870
87059
|
__esDecorate22(this, _private_writeFrame_descriptor = { value: __setFunctionName5(async function(buffer) {
|
|
86871
|
-
const error = await new Promise((
|
|
86872
|
-
this.#process.stdin.write(buffer,
|
|
87060
|
+
const error = await new Promise((resolve13) => {
|
|
87061
|
+
this.#process.stdin.write(buffer, resolve13);
|
|
86873
87062
|
});
|
|
86874
87063
|
if (error) {
|
|
86875
87064
|
console.log(`ffmpeg failed to write: ${error.message}.`);
|
|
@@ -86918,7 +87107,7 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
86918
87107
|
filters.push(formatArgs.splice(vf, 2).at(-1) ?? "");
|
|
86919
87108
|
}
|
|
86920
87109
|
if (path11) {
|
|
86921
|
-
fs5.mkdirSync(
|
|
87110
|
+
fs5.mkdirSync(dirname13(path11), { recursive: overwrite });
|
|
86922
87111
|
}
|
|
86923
87112
|
this.#process = spawn2(ffmpegPath, [
|
|
86924
87113
|
["-loglevel", "error"],
|
|
@@ -87024,8 +87213,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
87024
87213
|
const [buffer, timestamp] = await this.#lastFrame;
|
|
87025
87214
|
await Promise.all(Array(Math.max(1, Math.round(this.#fps * (performance.now() - timestamp) / 1000))).fill(buffer).map(this.#writeFrame.bind(this)));
|
|
87026
87215
|
this.#process.stdin.end();
|
|
87027
|
-
await new Promise((
|
|
87028
|
-
this.#process.once("close",
|
|
87216
|
+
await new Promise((resolve13) => {
|
|
87217
|
+
this.#process.once("close", resolve13);
|
|
87029
87218
|
});
|
|
87030
87219
|
}
|
|
87031
87220
|
async[(_private_writeFrame_decorators = [guarded()], _stop_decorators = [guarded()], asyncDisposeSymbol)]() {
|
|
@@ -87071,17 +87260,17 @@ var init_puppeteer_core = __esm(() => {
|
|
|
87071
87260
|
});
|
|
87072
87261
|
|
|
87073
87262
|
// src/core/design-eval/capture.ts
|
|
87074
|
-
import { mkdirSync as
|
|
87075
|
-
import { join as
|
|
87263
|
+
import { mkdirSync as mkdirSync13, statSync as statSync12, existsSync as existsSync28 } from "fs";
|
|
87264
|
+
import { join as join28 } from "path";
|
|
87076
87265
|
function findBrowser() {
|
|
87077
87266
|
const platform2 = process.platform;
|
|
87078
87267
|
const paths = CHROME_PATHS[platform2] ?? [];
|
|
87079
87268
|
for (const p of paths) {
|
|
87080
|
-
if (
|
|
87269
|
+
if (existsSync28(p))
|
|
87081
87270
|
return p;
|
|
87082
87271
|
}
|
|
87083
|
-
const minkBrowsers =
|
|
87084
|
-
if (
|
|
87272
|
+
const minkBrowsers = join28(minkRoot(), "browsers");
|
|
87273
|
+
if (existsSync28(minkBrowsers)) {
|
|
87085
87274
|
const found = findChromeInDir(minkBrowsers);
|
|
87086
87275
|
if (found)
|
|
87087
87276
|
return found;
|
|
@@ -87102,7 +87291,7 @@ function findChromeInDir(dir) {
|
|
|
87102
87291
|
try {
|
|
87103
87292
|
const entries = readdirSync9(dir);
|
|
87104
87293
|
for (const entry of entries) {
|
|
87105
|
-
const full =
|
|
87294
|
+
const full = join28(dir, entry);
|
|
87106
87295
|
try {
|
|
87107
87296
|
const stat2 = statSync13(full);
|
|
87108
87297
|
if (stat2.isDirectory()) {
|
|
@@ -87150,7 +87339,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
87150
87339
|
const y = section * viewport.height;
|
|
87151
87340
|
const clipHeight = Math.min(viewport.height, pageHeight - y);
|
|
87152
87341
|
const fileName = `${prefix}-${viewport.name}-${section}.jpg`;
|
|
87153
|
-
const filePath =
|
|
87342
|
+
const filePath = join28(options.outputDir, fileName);
|
|
87154
87343
|
await page.screenshot({
|
|
87155
87344
|
path: filePath,
|
|
87156
87345
|
type: "jpeg",
|
|
@@ -87182,7 +87371,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
87182
87371
|
return results;
|
|
87183
87372
|
}
|
|
87184
87373
|
async function captureAllRoutes(routes, baseUrl, viewports, options, outputDir) {
|
|
87185
|
-
|
|
87374
|
+
mkdirSync13(outputDir, { recursive: true });
|
|
87186
87375
|
const executablePath = findBrowser();
|
|
87187
87376
|
const browser = await puppeteer_core_default.launch({
|
|
87188
87377
|
executablePath,
|
|
@@ -88614,9 +88803,9 @@ var exports_wiki = {};
|
|
|
88614
88803
|
__export(exports_wiki, {
|
|
88615
88804
|
wiki: () => wiki
|
|
88616
88805
|
});
|
|
88617
|
-
import { existsSync as
|
|
88618
|
-
import { resolve as
|
|
88619
|
-
import { homedir as
|
|
88806
|
+
import { existsSync as existsSync29, statSync as statSync13 } from "fs";
|
|
88807
|
+
import { resolve as resolve13 } from "path";
|
|
88808
|
+
import { homedir as homedir5 } from "os";
|
|
88620
88809
|
async function wiki(_cwd, args) {
|
|
88621
88810
|
const sub = args[0];
|
|
88622
88811
|
switch (sub) {
|
|
@@ -88670,7 +88859,7 @@ async function wikiInit(args) {
|
|
|
88670
88859
|
console.log(`[mink] initializing vault at ${targetPath}`);
|
|
88671
88860
|
console.log(" (set a custom path with: mink wiki init /path/to/vault)");
|
|
88672
88861
|
}
|
|
88673
|
-
const isExisting =
|
|
88862
|
+
const isExisting = existsSync29(targetPath) && statSync13(targetPath).isDirectory();
|
|
88674
88863
|
setConfigValue("wiki.path", targetPath);
|
|
88675
88864
|
ensureVaultStructure();
|
|
88676
88865
|
seedTemplates(vaultTemplates());
|
|
@@ -88874,9 +89063,9 @@ function wikiLinks() {
|
|
|
88874
89063
|
}
|
|
88875
89064
|
function expandPath(raw) {
|
|
88876
89065
|
if (raw.startsWith("~/")) {
|
|
88877
|
-
return
|
|
89066
|
+
return resolve13(homedir5(), raw.slice(2));
|
|
88878
89067
|
}
|
|
88879
|
-
return
|
|
89068
|
+
return resolve13(raw);
|
|
88880
89069
|
}
|
|
88881
89070
|
var init_wiki = __esm(() => {
|
|
88882
89071
|
init_vault();
|
|
@@ -88892,8 +89081,8 @@ var exports_note = {};
|
|
|
88892
89081
|
__export(exports_note, {
|
|
88893
89082
|
note: () => note
|
|
88894
89083
|
});
|
|
88895
|
-
import { resolve as
|
|
88896
|
-
import { existsSync as
|
|
89084
|
+
import { resolve as resolve14 } from "path";
|
|
89085
|
+
import { existsSync as existsSync30, readFileSync as readFileSync27 } from "fs";
|
|
88897
89086
|
async function note(cwd, args) {
|
|
88898
89087
|
if (!isWikiEnabled()) {
|
|
88899
89088
|
console.error("[mink] wiki feature is disabled");
|
|
@@ -88923,8 +89112,8 @@ async function note(cwd, args) {
|
|
|
88923
89112
|
return;
|
|
88924
89113
|
}
|
|
88925
89114
|
if (parsed.file) {
|
|
88926
|
-
const sourcePath =
|
|
88927
|
-
if (!
|
|
89115
|
+
const sourcePath = resolve14(cwd, parsed.file);
|
|
89116
|
+
if (!existsSync30(sourcePath)) {
|
|
88928
89117
|
console.error(`[mink] file not found: ${sourcePath}`);
|
|
88929
89118
|
process.exit(1);
|
|
88930
89119
|
}
|
|
@@ -89085,39 +89274,39 @@ var exports_skill = {};
|
|
|
89085
89274
|
__export(exports_skill, {
|
|
89086
89275
|
skill: () => skill
|
|
89087
89276
|
});
|
|
89088
|
-
import { join as
|
|
89089
|
-
import { homedir as
|
|
89277
|
+
import { join as join29, resolve as resolve15, dirname as dirname14 } from "path";
|
|
89278
|
+
import { homedir as homedir6 } from "os";
|
|
89090
89279
|
import {
|
|
89091
|
-
existsSync as
|
|
89092
|
-
mkdirSync as
|
|
89280
|
+
existsSync as existsSync31,
|
|
89281
|
+
mkdirSync as mkdirSync14,
|
|
89093
89282
|
copyFileSync,
|
|
89094
|
-
unlinkSync as
|
|
89283
|
+
unlinkSync as unlinkSync5,
|
|
89095
89284
|
readdirSync as readdirSync9,
|
|
89096
89285
|
rmSync,
|
|
89097
89286
|
symlinkSync as symlinkSync2,
|
|
89098
89287
|
lstatSync as lstatSync2
|
|
89099
89288
|
} from "fs";
|
|
89100
89289
|
function getSkillsSourceDir() {
|
|
89101
|
-
let dir =
|
|
89290
|
+
let dir = dirname14(new URL(import.meta.url).pathname);
|
|
89102
89291
|
while (true) {
|
|
89103
|
-
if (
|
|
89104
|
-
return
|
|
89292
|
+
if (existsSync31(join29(dir, "package.json")) && existsSync31(join29(dir, "skills"))) {
|
|
89293
|
+
return join29(dir, "skills");
|
|
89105
89294
|
}
|
|
89106
|
-
const parent =
|
|
89295
|
+
const parent = dirname14(dir);
|
|
89107
89296
|
if (parent === dir)
|
|
89108
89297
|
break;
|
|
89109
89298
|
dir = parent;
|
|
89110
89299
|
}
|
|
89111
|
-
return
|
|
89300
|
+
return resolve15(dirname14(new URL(import.meta.url).pathname), "../../skills");
|
|
89112
89301
|
}
|
|
89113
89302
|
function getAvailableSkills() {
|
|
89114
89303
|
const dir = getSkillsSourceDir();
|
|
89115
|
-
if (!
|
|
89304
|
+
if (!existsSync31(dir))
|
|
89116
89305
|
return [];
|
|
89117
|
-
return readdirSync9(dir, { withFileTypes: true }).filter((d) => d.isDirectory() &&
|
|
89306
|
+
return readdirSync9(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync31(join29(dir, d.name, "SKILL.md"))).map((d) => d.name);
|
|
89118
89307
|
}
|
|
89119
89308
|
function isInstalled(skillName) {
|
|
89120
|
-
return
|
|
89309
|
+
return existsSync31(join29(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
|
|
89121
89310
|
}
|
|
89122
89311
|
async function skill(args) {
|
|
89123
89312
|
const sub = args[0];
|
|
@@ -89151,28 +89340,28 @@ function skillInstall(name) {
|
|
|
89151
89340
|
console.error(" Expected skills at: " + sourceDir);
|
|
89152
89341
|
return;
|
|
89153
89342
|
}
|
|
89154
|
-
|
|
89343
|
+
mkdirSync14(AGENTS_SKILLS_DIR, { recursive: true });
|
|
89155
89344
|
for (const skillName of skills) {
|
|
89156
|
-
const srcDir =
|
|
89157
|
-
const srcFile =
|
|
89158
|
-
const destDir =
|
|
89159
|
-
if (!
|
|
89345
|
+
const srcDir = join29(sourceDir, skillName);
|
|
89346
|
+
const srcFile = join29(srcDir, "SKILL.md");
|
|
89347
|
+
const destDir = join29(AGENTS_SKILLS_DIR, skillName);
|
|
89348
|
+
if (!existsSync31(srcFile)) {
|
|
89160
89349
|
console.error(`[mink] skill not found: ${skillName}`);
|
|
89161
89350
|
continue;
|
|
89162
89351
|
}
|
|
89163
|
-
|
|
89352
|
+
mkdirSync14(destDir, { recursive: true });
|
|
89164
89353
|
copyDirRecursive(srcDir, destDir);
|
|
89165
|
-
|
|
89166
|
-
const symlink =
|
|
89354
|
+
mkdirSync14(CLAUDE_SKILLS_DIR, { recursive: true });
|
|
89355
|
+
const symlink = join29(CLAUDE_SKILLS_DIR, skillName);
|
|
89167
89356
|
try {
|
|
89168
|
-
if (
|
|
89357
|
+
if (existsSync31(symlink)) {
|
|
89169
89358
|
if (lstatSync2(symlink).isSymbolicLink() || lstatSync2(symlink).isFile()) {
|
|
89170
|
-
|
|
89359
|
+
unlinkSync5(symlink);
|
|
89171
89360
|
} else {
|
|
89172
89361
|
rmSync(symlink, { recursive: true, force: true });
|
|
89173
89362
|
}
|
|
89174
89363
|
}
|
|
89175
|
-
const relativeTarget =
|
|
89364
|
+
const relativeTarget = join29("..", "..", ".agents", "skills", skillName);
|
|
89176
89365
|
symlinkSync2(relativeTarget, symlink);
|
|
89177
89366
|
} catch {}
|
|
89178
89367
|
console.log(`[mink] installed: ${skillName} -> ${destDir}`);
|
|
@@ -89183,16 +89372,16 @@ function skillInstall(name) {
|
|
|
89183
89372
|
function skillUninstall(name) {
|
|
89184
89373
|
const skills = name ? [name] : getAvailableSkills();
|
|
89185
89374
|
for (const skillName of skills) {
|
|
89186
|
-
const destDir =
|
|
89187
|
-
if (!
|
|
89375
|
+
const destDir = join29(AGENTS_SKILLS_DIR, skillName);
|
|
89376
|
+
if (!existsSync31(destDir)) {
|
|
89188
89377
|
console.log(`[mink] not installed: ${skillName}`);
|
|
89189
89378
|
continue;
|
|
89190
89379
|
}
|
|
89191
89380
|
rmSync(destDir, { recursive: true, force: true });
|
|
89192
|
-
const symlink =
|
|
89381
|
+
const symlink = join29(CLAUDE_SKILLS_DIR, skillName);
|
|
89193
89382
|
try {
|
|
89194
|
-
if (
|
|
89195
|
-
|
|
89383
|
+
if (existsSync31(symlink))
|
|
89384
|
+
unlinkSync5(symlink);
|
|
89196
89385
|
} catch {}
|
|
89197
89386
|
console.log(`[mink] uninstalled: ${skillName}`);
|
|
89198
89387
|
}
|
|
@@ -89206,7 +89395,7 @@ function skillList() {
|
|
|
89206
89395
|
if (installed.length > 0) {
|
|
89207
89396
|
console.log(" Installed:");
|
|
89208
89397
|
for (const s of installed) {
|
|
89209
|
-
console.log(` ${s} (${
|
|
89398
|
+
console.log(` ${s} (${join29(AGENTS_SKILLS_DIR, s)})`);
|
|
89210
89399
|
}
|
|
89211
89400
|
}
|
|
89212
89401
|
if (notInstalled.length > 0) {
|
|
@@ -89225,10 +89414,10 @@ function skillList() {
|
|
|
89225
89414
|
function copyDirRecursive(src, dest) {
|
|
89226
89415
|
const entries = readdirSync9(src, { withFileTypes: true });
|
|
89227
89416
|
for (const entry of entries) {
|
|
89228
|
-
const srcPath =
|
|
89229
|
-
const destPath =
|
|
89417
|
+
const srcPath = join29(src, entry.name);
|
|
89418
|
+
const destPath = join29(dest, entry.name);
|
|
89230
89419
|
if (entry.isDirectory()) {
|
|
89231
|
-
|
|
89420
|
+
mkdirSync14(destPath, { recursive: true });
|
|
89232
89421
|
copyDirRecursive(srcPath, destPath);
|
|
89233
89422
|
} else {
|
|
89234
89423
|
copyFileSync(srcPath, destPath);
|
|
@@ -89237,8 +89426,215 @@ function copyDirRecursive(src, dest) {
|
|
|
89237
89426
|
}
|
|
89238
89427
|
var AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR;
|
|
89239
89428
|
var init_skill = __esm(() => {
|
|
89240
|
-
AGENTS_SKILLS_DIR =
|
|
89241
|
-
CLAUDE_SKILLS_DIR =
|
|
89429
|
+
AGENTS_SKILLS_DIR = join29(homedir6(), ".agents", "skills");
|
|
89430
|
+
CLAUDE_SKILLS_DIR = join29(homedir6(), ".claude", "skills");
|
|
89431
|
+
});
|
|
89432
|
+
|
|
89433
|
+
// src/commands/agent.ts
|
|
89434
|
+
var exports_agent = {};
|
|
89435
|
+
__export(exports_agent, {
|
|
89436
|
+
agent: () => agent
|
|
89437
|
+
});
|
|
89438
|
+
import { join as join30, resolve as resolve16, dirname as dirname15 } from "path";
|
|
89439
|
+
import { homedir as homedir7 } from "os";
|
|
89440
|
+
import {
|
|
89441
|
+
existsSync as existsSync32,
|
|
89442
|
+
mkdirSync as mkdirSync15,
|
|
89443
|
+
readFileSync as readFileSync28,
|
|
89444
|
+
writeFileSync as writeFileSync10
|
|
89445
|
+
} from "fs";
|
|
89446
|
+
import { createHash as createHash2 } from "crypto";
|
|
89447
|
+
import { spawnSync as spawnSync5 } from "child_process";
|
|
89448
|
+
function getAgentTemplatePath() {
|
|
89449
|
+
let dir = dirname15(new URL(import.meta.url).pathname);
|
|
89450
|
+
while (true) {
|
|
89451
|
+
if (existsSync32(join30(dir, "package.json")) && existsSync32(join30(dir, "agents", TEMPLATE_FILE))) {
|
|
89452
|
+
return join30(dir, "agents", TEMPLATE_FILE);
|
|
89453
|
+
}
|
|
89454
|
+
const parent = dirname15(dir);
|
|
89455
|
+
if (parent === dir)
|
|
89456
|
+
break;
|
|
89457
|
+
dir = parent;
|
|
89458
|
+
}
|
|
89459
|
+
return resolve16(dirname15(new URL(import.meta.url).pathname), "../../agents", TEMPLATE_FILE);
|
|
89460
|
+
}
|
|
89461
|
+
function getMinkVersion() {
|
|
89462
|
+
let dir = dirname15(new URL(import.meta.url).pathname);
|
|
89463
|
+
while (true) {
|
|
89464
|
+
const pkgPath = join30(dir, "package.json");
|
|
89465
|
+
if (existsSync32(pkgPath)) {
|
|
89466
|
+
try {
|
|
89467
|
+
const pkg = JSON.parse(readFileSync28(pkgPath, "utf-8"));
|
|
89468
|
+
if (pkg.name && pkg.version)
|
|
89469
|
+
return pkg.version;
|
|
89470
|
+
} catch {}
|
|
89471
|
+
}
|
|
89472
|
+
const parent = dirname15(dir);
|
|
89473
|
+
if (parent === dir)
|
|
89474
|
+
break;
|
|
89475
|
+
dir = parent;
|
|
89476
|
+
}
|
|
89477
|
+
return "unknown";
|
|
89478
|
+
}
|
|
89479
|
+
function renderTemplate(template, vars) {
|
|
89480
|
+
let out = template;
|
|
89481
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
89482
|
+
out = out.split(`{{${key}}}`).join(value);
|
|
89483
|
+
}
|
|
89484
|
+
return out;
|
|
89485
|
+
}
|
|
89486
|
+
function sha256(text) {
|
|
89487
|
+
return createHash2("sha256").update(text).digest("hex");
|
|
89488
|
+
}
|
|
89489
|
+
function claudeAgentsDir() {
|
|
89490
|
+
return join30(homedir7(), ".claude", "agents");
|
|
89491
|
+
}
|
|
89492
|
+
function installedAgentPath() {
|
|
89493
|
+
return join30(claudeAgentsDir(), INSTALLED_FILE);
|
|
89494
|
+
}
|
|
89495
|
+
function installAgentDefinition(opts) {
|
|
89496
|
+
const templatePath = getAgentTemplatePath();
|
|
89497
|
+
if (!existsSync32(templatePath)) {
|
|
89498
|
+
throw new Error(`[mink agent] bundled agent template not found at ${templatePath}
|
|
89499
|
+
` + " This usually means the package was installed without bundled assets.");
|
|
89500
|
+
}
|
|
89501
|
+
const installed = installedAgentPath();
|
|
89502
|
+
if (opts.skip && existsSync32(installed)) {
|
|
89503
|
+
return { action: "skipped", path: installed };
|
|
89504
|
+
}
|
|
89505
|
+
const template = readFileSync28(templatePath, "utf-8");
|
|
89506
|
+
const rendered = renderTemplate(template, {
|
|
89507
|
+
MINK_ROOT: minkRoot(),
|
|
89508
|
+
VAULT_PATH: resolveVaultPath(),
|
|
89509
|
+
MINK_VERSION: getMinkVersion()
|
|
89510
|
+
});
|
|
89511
|
+
const exists = existsSync32(installed);
|
|
89512
|
+
if (!opts.force && exists) {
|
|
89513
|
+
const current = readFileSync28(installed, "utf-8");
|
|
89514
|
+
if (sha256(current) === sha256(rendered)) {
|
|
89515
|
+
return { action: "unchanged", path: installed };
|
|
89516
|
+
}
|
|
89517
|
+
}
|
|
89518
|
+
mkdirSync15(claudeAgentsDir(), { recursive: true });
|
|
89519
|
+
writeFileSync10(installed, rendered);
|
|
89520
|
+
return {
|
|
89521
|
+
action: exists ? "updated" : "installed",
|
|
89522
|
+
path: installed
|
|
89523
|
+
};
|
|
89524
|
+
}
|
|
89525
|
+
function isClaudeOnPath() {
|
|
89526
|
+
const result = spawnSync5("claude", ["--version"], {
|
|
89527
|
+
stdio: "ignore"
|
|
89528
|
+
});
|
|
89529
|
+
return !result.error && result.status === 0;
|
|
89530
|
+
}
|
|
89531
|
+
function parseArgs2(args) {
|
|
89532
|
+
const out = {
|
|
89533
|
+
noUpdate: false,
|
|
89534
|
+
reinstall: false,
|
|
89535
|
+
passthrough: [],
|
|
89536
|
+
showHelp: false
|
|
89537
|
+
};
|
|
89538
|
+
let inPassthrough = false;
|
|
89539
|
+
for (const arg of args) {
|
|
89540
|
+
if (inPassthrough) {
|
|
89541
|
+
out.passthrough.push(arg);
|
|
89542
|
+
continue;
|
|
89543
|
+
}
|
|
89544
|
+
if (arg === "--") {
|
|
89545
|
+
inPassthrough = true;
|
|
89546
|
+
continue;
|
|
89547
|
+
}
|
|
89548
|
+
if (arg === "--no-update") {
|
|
89549
|
+
out.noUpdate = true;
|
|
89550
|
+
continue;
|
|
89551
|
+
}
|
|
89552
|
+
if (arg === "--reinstall") {
|
|
89553
|
+
out.reinstall = true;
|
|
89554
|
+
continue;
|
|
89555
|
+
}
|
|
89556
|
+
if (arg === "--help" || arg === "-h") {
|
|
89557
|
+
out.showHelp = true;
|
|
89558
|
+
continue;
|
|
89559
|
+
}
|
|
89560
|
+
out.passthrough.push(arg);
|
|
89561
|
+
}
|
|
89562
|
+
return out;
|
|
89563
|
+
}
|
|
89564
|
+
function printHelp() {
|
|
89565
|
+
console.log("Usage: mink agent [options] [-- <claude args...>]");
|
|
89566
|
+
console.log();
|
|
89567
|
+
console.log("Open an interactive Claude Code session in your mink home with");
|
|
89568
|
+
console.log("the mink-agent persona — a proactive note/wiki assistant.");
|
|
89569
|
+
console.log();
|
|
89570
|
+
console.log("Options:");
|
|
89571
|
+
console.log(" --no-update Don't refresh ~/.claude/agents/mink-agent.md if it exists");
|
|
89572
|
+
console.log(" --reinstall Force overwrite the installed agent definition");
|
|
89573
|
+
console.log(" -- <args> Forward remaining arguments to `claude`");
|
|
89574
|
+
console.log();
|
|
89575
|
+
console.log("Environment:");
|
|
89576
|
+
console.log(" MINK_AGENT_NO_UPDATE=1 Equivalent to --no-update");
|
|
89577
|
+
console.log();
|
|
89578
|
+
console.log("The agent is bound to your mink root and resolved vault path. Changing");
|
|
89579
|
+
console.log("`mink config wiki.path` triggers a refresh on the next launch.");
|
|
89580
|
+
}
|
|
89581
|
+
async function agent(_cwd, rawArgs) {
|
|
89582
|
+
const args = parseArgs2(rawArgs);
|
|
89583
|
+
if (args.showHelp) {
|
|
89584
|
+
printHelp();
|
|
89585
|
+
return;
|
|
89586
|
+
}
|
|
89587
|
+
const skipUpdate = args.noUpdate || process.env.MINK_AGENT_NO_UPDATE === "1";
|
|
89588
|
+
const root = minkRoot();
|
|
89589
|
+
if (!existsSync32(root)) {
|
|
89590
|
+
mkdirSync15(root, { recursive: true });
|
|
89591
|
+
}
|
|
89592
|
+
let result;
|
|
89593
|
+
try {
|
|
89594
|
+
result = installAgentDefinition({
|
|
89595
|
+
force: args.reinstall,
|
|
89596
|
+
skip: skipUpdate && !args.reinstall
|
|
89597
|
+
});
|
|
89598
|
+
} catch (err) {
|
|
89599
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
89600
|
+
console.error(msg);
|
|
89601
|
+
process.exit(1);
|
|
89602
|
+
}
|
|
89603
|
+
switch (result.action) {
|
|
89604
|
+
case "installed":
|
|
89605
|
+
console.log(`[mink] installed mink-agent definition (v${getMinkVersion()}) -> ${result.path}`);
|
|
89606
|
+
break;
|
|
89607
|
+
case "updated":
|
|
89608
|
+
console.log(`[mink] updated mink-agent definition -> ${result.path}`);
|
|
89609
|
+
break;
|
|
89610
|
+
case "unchanged":
|
|
89611
|
+
case "skipped":
|
|
89612
|
+
break;
|
|
89613
|
+
}
|
|
89614
|
+
if (!isClaudeOnPath()) {
|
|
89615
|
+
console.error("[mink agent] `claude` (Claude Code CLI) was not found on PATH.");
|
|
89616
|
+
console.error(" Install Claude Code: https://claude.com/claude-code");
|
|
89617
|
+
process.exit(1);
|
|
89618
|
+
}
|
|
89619
|
+
const claudeArgs = ["--agent", AGENT_NAME, ...args.passthrough];
|
|
89620
|
+
const child = spawnSync5("claude", claudeArgs, {
|
|
89621
|
+
cwd: root,
|
|
89622
|
+
stdio: "inherit"
|
|
89623
|
+
});
|
|
89624
|
+
if (child.error) {
|
|
89625
|
+
console.error(`[mink agent] failed to launch claude: ${child.error.message}`);
|
|
89626
|
+
process.exit(1);
|
|
89627
|
+
}
|
|
89628
|
+
if (typeof child.status === "number") {
|
|
89629
|
+
process.exit(child.status);
|
|
89630
|
+
}
|
|
89631
|
+
}
|
|
89632
|
+
var AGENT_NAME = "mink-agent", TEMPLATE_FILE, INSTALLED_FILE;
|
|
89633
|
+
var init_agent = __esm(() => {
|
|
89634
|
+
init_paths();
|
|
89635
|
+
init_vault();
|
|
89636
|
+
TEMPLATE_FILE = `${AGENT_NAME}.md.tmpl`;
|
|
89637
|
+
INSTALLED_FILE = `${AGENT_NAME}.md`;
|
|
89242
89638
|
});
|
|
89243
89639
|
|
|
89244
89640
|
// src/commands/sync.ts
|
|
@@ -89738,6 +90134,11 @@ switch (command2) {
|
|
|
89738
90134
|
await skill2(process.argv.slice(3));
|
|
89739
90135
|
break;
|
|
89740
90136
|
}
|
|
90137
|
+
case "agent": {
|
|
90138
|
+
const { agent: agent2 } = await Promise.resolve().then(() => (init_agent(), exports_agent));
|
|
90139
|
+
await agent2(cwd, process.argv.slice(3));
|
|
90140
|
+
break;
|
|
90141
|
+
}
|
|
89741
90142
|
case "sync": {
|
|
89742
90143
|
const { sync: sync2 } = await Promise.resolve().then(() => (init_sync3(), exports_sync2));
|
|
89743
90144
|
await sync2(process.argv.slice(3));
|
|
@@ -89767,11 +90168,11 @@ switch (command2) {
|
|
|
89767
90168
|
case "version":
|
|
89768
90169
|
case "--version":
|
|
89769
90170
|
case "-v": {
|
|
89770
|
-
const { resolve:
|
|
89771
|
-
const cliPath =
|
|
89772
|
-
const { readFileSync:
|
|
90171
|
+
const { resolve: resolve17, dirname: dirname16 } = await import("path");
|
|
90172
|
+
const cliPath = resolve17(dirname16(new URL(import.meta.url).pathname));
|
|
90173
|
+
const { readFileSync: readFileSync29 } = await import("fs");
|
|
89773
90174
|
try {
|
|
89774
|
-
const pkg = JSON.parse(
|
|
90175
|
+
const pkg = JSON.parse(readFileSync29(resolve17(cliPath, "../package.json"), "utf-8"));
|
|
89775
90176
|
console.log(`mink ${pkg.version}`);
|
|
89776
90177
|
} catch {
|
|
89777
90178
|
console.log("mink (unknown version)");
|
|
@@ -89799,6 +90200,7 @@ switch (command2) {
|
|
|
89799
90200
|
console.log(" note list [filters] List notes (--category, --tag, --recent)");
|
|
89800
90201
|
console.log(" note search <term> Full-text search across the vault");
|
|
89801
90202
|
console.log(" skill install Install /mink:note skill for Claude Code");
|
|
90203
|
+
console.log(" agent Open a Claude Code session with the mink-agent persona");
|
|
89802
90204
|
console.log();
|
|
89803
90205
|
console.log("Devices & Sync:");
|
|
89804
90206
|
console.log(" device Show current device info");
|
|
@@ -89821,7 +90223,7 @@ switch (command2) {
|
|
|
89821
90223
|
console.log();
|
|
89822
90224
|
console.log("Automation & Analysis:");
|
|
89823
90225
|
console.log(" dashboard [--port=N] Open the real-time web dashboard");
|
|
89824
|
-
console.log(" daemon <cmd> Manage the background daemon (start|stop|restart|logs)");
|
|
90226
|
+
console.log(" daemon <cmd> Manage the background daemon (start|stop|restart|logs|install|uninstall)");
|
|
89825
90227
|
console.log(" cron <cmd> [id] Manage scheduled tasks (list|run|retry)");
|
|
89826
90228
|
console.log(" update [options] Update Mink across registered projects");
|
|
89827
90229
|
console.log(" restore [backup] Restore state from a backup");
|