@drewpayment/mink 0.12.0-beta.8 → 0.13.0-beta.1
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 +20 -4
- 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.bun.js +894 -484
- package/dist/cli.node.js +912 -499
- package/package.json +1 -1
- package/src/cli.ts +20 -3
- package/src/commands/init.ts +122 -9
- package/src/core/agent-detect.ts +88 -0
- package/src/core/agent-pi.ts +314 -0
- package/src/core/prompt.ts +27 -0
- /package/dashboard/out/_next/static/{JMh4Nbbot9RESlGvYp6_4 → UWfkbJY4zr9fSt7O-CAge}/_buildManifest.js +0 -0
- /package/dashboard/out/_next/static/{JMh4Nbbot9RESlGvYp6_4 → UWfkbJY4zr9fSt7O-CAge}/_ssgManifest.js +0 -0
package/dist/cli.bun.js
CHANGED
|
@@ -4727,6 +4727,342 @@ var init_reflect = __esm(() => {
|
|
|
4727
4727
|
init_fs_utils();
|
|
4728
4728
|
});
|
|
4729
4729
|
|
|
4730
|
+
// src/core/agent-detect.ts
|
|
4731
|
+
import { execSync as execSync5 } from "child_process";
|
|
4732
|
+
import { existsSync as existsSync17 } from "fs";
|
|
4733
|
+
import { join as join14 } from "path";
|
|
4734
|
+
import { homedir as homedir3 } from "os";
|
|
4735
|
+
function commandExists(bin) {
|
|
4736
|
+
try {
|
|
4737
|
+
const probe = process.platform === "win32" ? `where ${bin}` : `command -v ${bin}`;
|
|
4738
|
+
execSync5(probe, { stdio: "ignore" });
|
|
4739
|
+
return true;
|
|
4740
|
+
} catch {
|
|
4741
|
+
return false;
|
|
4742
|
+
}
|
|
4743
|
+
}
|
|
4744
|
+
function detectAgent(meta, cwd) {
|
|
4745
|
+
const signals = [];
|
|
4746
|
+
if (existsSync17(join14(cwd, meta.projectDir))) {
|
|
4747
|
+
signals.push(`project config (${meta.projectDir}/)`);
|
|
4748
|
+
}
|
|
4749
|
+
if (existsSync17(meta.globalDir)) {
|
|
4750
|
+
signals.push("global config");
|
|
4751
|
+
}
|
|
4752
|
+
if (commandExists(meta.bin)) {
|
|
4753
|
+
signals.push("on PATH");
|
|
4754
|
+
}
|
|
4755
|
+
return { ...meta, detected: signals.length > 0, signals };
|
|
4756
|
+
}
|
|
4757
|
+
function detectAgents(cwd) {
|
|
4758
|
+
return AGENTS.map((m) => detectAgent(m, cwd));
|
|
4759
|
+
}
|
|
4760
|
+
function resolveTargetsFromFlag(flag) {
|
|
4761
|
+
const normalized = flag.trim().toLowerCase();
|
|
4762
|
+
if (normalized === "all")
|
|
4763
|
+
return AGENTS.map((a) => a.id);
|
|
4764
|
+
const ids = normalized.split(",").map((s) => s.trim()).filter(Boolean);
|
|
4765
|
+
const valid = AGENTS.map((a) => a.id);
|
|
4766
|
+
const resolved = ids.filter((id) => valid.includes(id));
|
|
4767
|
+
return resolved;
|
|
4768
|
+
}
|
|
4769
|
+
var AGENTS;
|
|
4770
|
+
var init_agent_detect = __esm(() => {
|
|
4771
|
+
AGENTS = [
|
|
4772
|
+
{
|
|
4773
|
+
id: "claude",
|
|
4774
|
+
label: "Claude Code",
|
|
4775
|
+
projectDir: ".claude",
|
|
4776
|
+
globalDir: join14(homedir3(), ".claude"),
|
|
4777
|
+
bin: "claude"
|
|
4778
|
+
},
|
|
4779
|
+
{
|
|
4780
|
+
id: "pi",
|
|
4781
|
+
label: "Pi",
|
|
4782
|
+
projectDir: ".pi",
|
|
4783
|
+
globalDir: join14(homedir3(), ".pi"),
|
|
4784
|
+
bin: "pi"
|
|
4785
|
+
}
|
|
4786
|
+
];
|
|
4787
|
+
});
|
|
4788
|
+
|
|
4789
|
+
// src/core/agent-pi.ts
|
|
4790
|
+
import { join as join15, resolve as resolve2, dirname as dirname7 } from "path";
|
|
4791
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync8, copyFileSync, rmSync as rmSync2 } from "fs";
|
|
4792
|
+
function piExtensionPath(cwd) {
|
|
4793
|
+
return join15(cwd, ".pi", "extensions", "mink.ts");
|
|
4794
|
+
}
|
|
4795
|
+
function piGuidanceSkillPath(cwd) {
|
|
4796
|
+
return join15(cwd, ".pi", "skills", "mink", "SKILL.md");
|
|
4797
|
+
}
|
|
4798
|
+
function piNoteSkillPath(cwd) {
|
|
4799
|
+
return join15(cwd, ".pi", "skills", "mink-note", "SKILL.md");
|
|
4800
|
+
}
|
|
4801
|
+
function buildPiExtension(cliPath) {
|
|
4802
|
+
const isTsSource = cliPath.endsWith(".ts");
|
|
4803
|
+
const cmd = isTsSource ? "bun" : "mink";
|
|
4804
|
+
const baseArgs = isTsSource ? JSON.stringify(["run", cliPath]) : "[]";
|
|
4805
|
+
return `// AUTO-GENERATED by \`mink init\`. Do not edit \u2014 re-run \`mink init\` to refresh.
|
|
4806
|
+
//
|
|
4807
|
+
// Mink adapter for the Pi coding agent. Routes Pi lifecycle and tool events
|
|
4808
|
+
// into the \`mink\` CLI so Pi shares the same ~/.mink state, file index, ledger,
|
|
4809
|
+
// and wiki as every other assistant wired to this project.
|
|
4810
|
+
//
|
|
4811
|
+
// Field shapes confirmed against pi source (earendil-works/pi,
|
|
4812
|
+
// packages/coding-agent): read params {path, offset, limit}; write {path,
|
|
4813
|
+
// content}; edit {path, edits:[{oldText,newText}]} (with legacy file_path /
|
|
4814
|
+
// top-level oldText,newText). tool_call/tool_result events expose toolName,
|
|
4815
|
+
// toolCallId, input; tool_result also exposes content (a content-block array),
|
|
4816
|
+
// details, isError. Advisories are surfaced by returning a modified result from
|
|
4817
|
+
// the tool_result handler \u2014 the documented mechanism. pi.exec has no stdin, so
|
|
4818
|
+
// the canonical payload is piped to \`mink\` via a spawned child process. Every
|
|
4819
|
+
// host-API access is defensive: the adapter never throws into Pi or blocks a
|
|
4820
|
+
// tool \u2014 a failure degrades to "no advisory".
|
|
4821
|
+
|
|
4822
|
+
import { spawn } from "node:child_process";
|
|
4823
|
+
|
|
4824
|
+
const MINK_CMD = ${JSON.stringify(cmd)};
|
|
4825
|
+
const MINK_BASE_ARGS = ${baseArgs};
|
|
4826
|
+
const TIMEOUT_MS = 5000;
|
|
4827
|
+
|
|
4828
|
+
function runMink(sub, payload, cwd) {
|
|
4829
|
+
return new Promise((res) => {
|
|
4830
|
+
let done = false;
|
|
4831
|
+
const finish = (out) => {
|
|
4832
|
+
if (done) return;
|
|
4833
|
+
done = true;
|
|
4834
|
+
res(out);
|
|
4835
|
+
};
|
|
4836
|
+
try {
|
|
4837
|
+
const child = spawn(MINK_CMD, [...MINK_BASE_ARGS, sub], {
|
|
4838
|
+
cwd,
|
|
4839
|
+
stdio: ["pipe", "ignore", "pipe"],
|
|
4840
|
+
});
|
|
4841
|
+
let stderr = "";
|
|
4842
|
+
child.stderr?.on("data", (d) => {
|
|
4843
|
+
stderr += d.toString();
|
|
4844
|
+
});
|
|
4845
|
+
child.on("error", () => finish(""));
|
|
4846
|
+
child.on("close", () => finish(stderr.trim()));
|
|
4847
|
+
const timer = setTimeout(() => {
|
|
4848
|
+
try {
|
|
4849
|
+
child.kill();
|
|
4850
|
+
} catch {}
|
|
4851
|
+
finish("");
|
|
4852
|
+
}, TIMEOUT_MS);
|
|
4853
|
+
timer.unref?.();
|
|
4854
|
+
try {
|
|
4855
|
+
child.stdin?.end(payload ? JSON.stringify(payload) : "");
|
|
4856
|
+
} catch {}
|
|
4857
|
+
} catch {
|
|
4858
|
+
finish("");
|
|
4859
|
+
}
|
|
4860
|
+
});
|
|
4861
|
+
}
|
|
4862
|
+
|
|
4863
|
+
// Pi's edit tool takes an array of { oldText, newText } replacements (legacy
|
|
4864
|
+
// inputs may put oldText/newText/new_string at the top level). Concatenate the
|
|
4865
|
+
// replacement text so Mink's write-enforcement sees everything being written.
|
|
4866
|
+
function editNewText(input) {
|
|
4867
|
+
if (Array.isArray(input.edits)) {
|
|
4868
|
+
return input.edits
|
|
4869
|
+
.map((e) => e?.newText ?? e?.new_string ?? "")
|
|
4870
|
+
.filter(Boolean)
|
|
4871
|
+
.join("\\n");
|
|
4872
|
+
}
|
|
4873
|
+
return input.newText ?? input.new_string ?? input.replacement ?? "";
|
|
4874
|
+
}
|
|
4875
|
+
|
|
4876
|
+
// Resolve Pi's tool name + arguments to Mink's canonical operation. Only the
|
|
4877
|
+
// three file operations matter; anything else returns null and is ignored.
|
|
4878
|
+
function toolInfo(event) {
|
|
4879
|
+
const name = String(event?.toolName ?? event?.tool ?? event?.name ?? "").toLowerCase();
|
|
4880
|
+
const input = event?.input ?? event?.arguments ?? {};
|
|
4881
|
+
const filePath = input.path ?? input.file_path ?? input.filePath;
|
|
4882
|
+
if (!filePath) return null;
|
|
4883
|
+
if (name === "read") return { op: "read", filePath };
|
|
4884
|
+
if (name === "write") return { op: "write", filePath, content: input.content ?? input.text ?? "" };
|
|
4885
|
+
if (name === "edit") return { op: "edit", filePath, newString: editNewText(input) };
|
|
4886
|
+
return null;
|
|
4887
|
+
}
|
|
4888
|
+
|
|
4889
|
+
// A tool_result's content is an array of content blocks ({ type, text }); pull
|
|
4890
|
+
// the text out so Mink's post-read can estimate tokens from real content.
|
|
4891
|
+
function resultContent(event) {
|
|
4892
|
+
const c = event?.content;
|
|
4893
|
+
if (typeof c === "string") return c;
|
|
4894
|
+
if (Array.isArray(c)) {
|
|
4895
|
+
const text = c
|
|
4896
|
+
.map((b) => (typeof b === "string" ? b : b?.text ?? ""))
|
|
4897
|
+
.filter(Boolean)
|
|
4898
|
+
.join("\\n");
|
|
4899
|
+
return text || null;
|
|
4900
|
+
}
|
|
4901
|
+
return null;
|
|
4902
|
+
}
|
|
4903
|
+
|
|
4904
|
+
function prePayload(info) {
|
|
4905
|
+
if (info.op === "read")
|
|
4906
|
+
return { sub: "pre-read", payload: { tool_name: "Read", tool_input: { file_path: info.filePath } } };
|
|
4907
|
+
if (info.op === "write")
|
|
4908
|
+
return {
|
|
4909
|
+
sub: "pre-write",
|
|
4910
|
+
payload: { tool_name: "Write", tool_input: { file_path: info.filePath, content: info.content } },
|
|
4911
|
+
};
|
|
4912
|
+
return {
|
|
4913
|
+
sub: "pre-write",
|
|
4914
|
+
payload: { tool_name: "Edit", tool_input: { file_path: info.filePath, new_string: info.newString } },
|
|
4915
|
+
};
|
|
4916
|
+
}
|
|
4917
|
+
|
|
4918
|
+
function postPayload(info, content) {
|
|
4919
|
+
if (info.op === "read")
|
|
4920
|
+
return {
|
|
4921
|
+
sub: "post-read",
|
|
4922
|
+
payload: {
|
|
4923
|
+
tool_name: "Read",
|
|
4924
|
+
tool_input: { file_path: info.filePath },
|
|
4925
|
+
tool_output: content == null ? undefined : { content },
|
|
4926
|
+
},
|
|
4927
|
+
};
|
|
4928
|
+
if (info.op === "write")
|
|
4929
|
+
return {
|
|
4930
|
+
sub: "post-write",
|
|
4931
|
+
payload: { tool_name: "Write", tool_input: { file_path: info.filePath, content: info.content } },
|
|
4932
|
+
};
|
|
4933
|
+
return {
|
|
4934
|
+
sub: "post-write",
|
|
4935
|
+
payload: { tool_name: "Edit", tool_input: { file_path: info.filePath, new_string: info.newString } },
|
|
4936
|
+
};
|
|
4937
|
+
}
|
|
4938
|
+
|
|
4939
|
+
export default function (pi) {
|
|
4940
|
+
const cwd = pi?.ctx?.cwd || process.cwd();
|
|
4941
|
+
const pending = new Map();
|
|
4942
|
+
const keyOf = (event) => event?.toolCallId ?? event?.id ?? event?.callId ?? "";
|
|
4943
|
+
|
|
4944
|
+
pi.on?.("session_start", (event) => {
|
|
4945
|
+
// Skip hot-reloads so an extension reload mid-task doesn't reset the
|
|
4946
|
+
// ephemeral session state; every genuinely new/resumed session starts fresh.
|
|
4947
|
+
if (event?.reason === "reload") return;
|
|
4948
|
+
void runMink("session-start", null, cwd);
|
|
4949
|
+
});
|
|
4950
|
+
pi.on?.("agent_end", () => {
|
|
4951
|
+
void runMink("session-stop", null, cwd);
|
|
4952
|
+
});
|
|
4953
|
+
pi.on?.("session_shutdown", () => {
|
|
4954
|
+
void runMink("session-stop", null, cwd);
|
|
4955
|
+
});
|
|
4956
|
+
|
|
4957
|
+
pi.on?.("tool_call", async (event) => {
|
|
4958
|
+
const info = toolInfo(event);
|
|
4959
|
+
if (!info) return;
|
|
4960
|
+
const { sub, payload } = prePayload(info);
|
|
4961
|
+
const advisory = await runMink(sub, payload, cwd);
|
|
4962
|
+
if (advisory) pending.set(keyOf(event), advisory);
|
|
4963
|
+
});
|
|
4964
|
+
|
|
4965
|
+
pi.on?.("tool_result", async (event) => {
|
|
4966
|
+
const info = toolInfo(event);
|
|
4967
|
+
if (!info) return;
|
|
4968
|
+
const { sub, payload } = postPayload(info, resultContent(event));
|
|
4969
|
+
const post = await runMink(sub, payload, cwd);
|
|
4970
|
+
const pre = pending.get(keyOf(event)) ?? "";
|
|
4971
|
+
pending.delete(keyOf(event));
|
|
4972
|
+
const advisory = [pre, post].filter(Boolean).join("\\n");
|
|
4973
|
+
if (!advisory) return;
|
|
4974
|
+
|
|
4975
|
+
// Surface Mink's advisory into the model's context by appending a text
|
|
4976
|
+
// block to the tool result \u2014 the parity of Claude feeding hook stderr back.
|
|
4977
|
+
const base = Array.isArray(event.content)
|
|
4978
|
+
? event.content
|
|
4979
|
+
: typeof event.content === "string"
|
|
4980
|
+
? [{ type: "text", text: event.content }]
|
|
4981
|
+
: [];
|
|
4982
|
+
return {
|
|
4983
|
+
content: [...base, { type: "text", text: advisory }],
|
|
4984
|
+
details: event.details,
|
|
4985
|
+
isError: event.isError,
|
|
4986
|
+
};
|
|
4987
|
+
});
|
|
4988
|
+
}
|
|
4989
|
+
`;
|
|
4990
|
+
}
|
|
4991
|
+
function resolveSkillsSourceDir() {
|
|
4992
|
+
let dir = dirname7(new URL(import.meta.url).pathname);
|
|
4993
|
+
while (true) {
|
|
4994
|
+
if (existsSync18(join15(dir, "package.json")) && existsSync18(join15(dir, "skills"))) {
|
|
4995
|
+
return join15(dir, "skills");
|
|
4996
|
+
}
|
|
4997
|
+
const parent = dirname7(dir);
|
|
4998
|
+
if (parent === dir)
|
|
4999
|
+
break;
|
|
5000
|
+
dir = parent;
|
|
5001
|
+
}
|
|
5002
|
+
return resolve2(dirname7(new URL(import.meta.url).pathname), "../../skills");
|
|
5003
|
+
}
|
|
5004
|
+
function installPi(cwd, cliPath) {
|
|
5005
|
+
const extensionPath = piExtensionPath(cwd);
|
|
5006
|
+
mkdirSync8(dirname7(extensionPath), { recursive: true });
|
|
5007
|
+
atomicWriteText(extensionPath, buildPiExtension(cliPath));
|
|
5008
|
+
const guidancePath = piGuidanceSkillPath(cwd);
|
|
5009
|
+
mkdirSync8(dirname7(guidancePath), { recursive: true });
|
|
5010
|
+
atomicWriteText(guidancePath, PI_GUIDANCE_SKILL);
|
|
5011
|
+
let notePath = null;
|
|
5012
|
+
try {
|
|
5013
|
+
const src = join15(resolveSkillsSourceDir(), "mink-note", "SKILL.md");
|
|
5014
|
+
if (existsSync18(src)) {
|
|
5015
|
+
notePath = piNoteSkillPath(cwd);
|
|
5016
|
+
mkdirSync8(dirname7(notePath), { recursive: true });
|
|
5017
|
+
copyFileSync(src, notePath);
|
|
5018
|
+
}
|
|
5019
|
+
} catch {
|
|
5020
|
+
notePath = null;
|
|
5021
|
+
}
|
|
5022
|
+
return { extensionPath, guidancePath, notePath };
|
|
5023
|
+
}
|
|
5024
|
+
var PI_GUIDANCE_SKILL = `---
|
|
5025
|
+
name: mink
|
|
5026
|
+
description: Mink context management is active in this project. Read this to understand how Mink memory, write enforcement, and note capture work under Pi.
|
|
5027
|
+
---
|
|
5028
|
+
|
|
5029
|
+
# Mink \u2014 context management for this project
|
|
5030
|
+
|
|
5031
|
+
This project uses **Mink** (\`@drewpayment/mink\`) for cross-session context management.
|
|
5032
|
+
|
|
5033
|
+
## How it works
|
|
5034
|
+
- Mink runs automatically through a Pi extension at \`.pi/extensions/mink.ts\` that hooks session start/stop and every read/edit/write tool call.
|
|
5035
|
+
- All state lives in \`~/.mink/\` on the user's machine \u2014 **not** in this repository. Do not create or write to any in-repo state directory (no \`.wolf/\`, \`.mink/\`, etc.).
|
|
5036
|
+
- Read intelligence, write enforcement, bug memory, and the token ledger are handled by the extension. You do not need to manually read or update any state files.
|
|
5037
|
+
- Mink shares one \`~/.mink/\` state across every assistant wired to this project, so history is unified whether the user runs Pi or another assistant.
|
|
5038
|
+
|
|
5039
|
+
## When to act on Mink
|
|
5040
|
+
- If the user asks to "save a note", "remember this", "log this to my wiki", or similar, use the \`mink-note\` skill (\`/skill:mink-note\`) \u2014 it captures into the user's \`~/.mink/\` vault.
|
|
5041
|
+
- If the extension surfaces a learning, past bug, or repeat-read warning in context, treat that as authoritative project memory and follow it.
|
|
5042
|
+
- The \`mink dashboard\` and \`mink agent\` commands are user tools \u2014 do not invoke them on the user's behalf.
|
|
5043
|
+
`;
|
|
5044
|
+
var init_agent_pi = __esm(() => {
|
|
5045
|
+
init_fs_utils();
|
|
5046
|
+
});
|
|
5047
|
+
|
|
5048
|
+
// src/core/prompt.ts
|
|
5049
|
+
import { createInterface } from "readline";
|
|
5050
|
+
function stdinIsInteractive() {
|
|
5051
|
+
const stdin = process.stdin;
|
|
5052
|
+
const stdout = process.stdout;
|
|
5053
|
+
return Boolean(stdin.isTTY) && Boolean(stdout.isTTY) && process.env.MINK_NO_PROMPT !== "1" && !process.env.CI;
|
|
5054
|
+
}
|
|
5055
|
+
function ask(question) {
|
|
5056
|
+
return new Promise((resolve3) => {
|
|
5057
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
5058
|
+
rl.question(question, (answer) => {
|
|
5059
|
+
rl.close();
|
|
5060
|
+
resolve3(answer);
|
|
5061
|
+
});
|
|
5062
|
+
});
|
|
5063
|
+
}
|
|
5064
|
+
var init_prompt = () => {};
|
|
5065
|
+
|
|
4730
5066
|
// src/core/backup.ts
|
|
4731
5067
|
var exports_backup = {};
|
|
4732
5068
|
__export(exports_backup, {
|
|
@@ -4735,14 +5071,14 @@ __export(exports_backup, {
|
|
|
4735
5071
|
createBackup: () => createBackup
|
|
4736
5072
|
});
|
|
4737
5073
|
import {
|
|
4738
|
-
mkdirSync as
|
|
5074
|
+
mkdirSync as mkdirSync9,
|
|
4739
5075
|
readdirSync as readdirSync7,
|
|
4740
5076
|
readFileSync as readFileSync12,
|
|
4741
5077
|
writeFileSync as writeFileSync5,
|
|
4742
|
-
existsSync as
|
|
5078
|
+
existsSync as existsSync19,
|
|
4743
5079
|
statSync as statSync7
|
|
4744
5080
|
} from "fs";
|
|
4745
|
-
import { join as
|
|
5081
|
+
import { join as join16 } from "path";
|
|
4746
5082
|
function formatTimestamp(date) {
|
|
4747
5083
|
const y = date.getFullYear();
|
|
4748
5084
|
const mo = String(date.getMonth() + 1).padStart(2, "0");
|
|
@@ -4754,15 +5090,15 @@ function formatTimestamp(date) {
|
|
|
4754
5090
|
return `${y}${mo}${d}-${h}${mi}${s}${ms}`;
|
|
4755
5091
|
}
|
|
4756
5092
|
function copyDirectoryFiles(srcDir, destDir, excludeDirs) {
|
|
4757
|
-
|
|
5093
|
+
mkdirSync9(destDir, { recursive: true });
|
|
4758
5094
|
const entries = readdirSync7(srcDir, { withFileTypes: true });
|
|
4759
5095
|
for (const entry of entries) {
|
|
4760
5096
|
if (entry.isDirectory()) {
|
|
4761
5097
|
if (excludeDirs.includes(entry.name))
|
|
4762
5098
|
continue;
|
|
4763
|
-
copyDirectoryFiles(
|
|
5099
|
+
copyDirectoryFiles(join16(srcDir, entry.name), join16(destDir, entry.name), excludeDirs);
|
|
4764
5100
|
} else if (entry.isFile()) {
|
|
4765
|
-
writeFileSync5(
|
|
5101
|
+
writeFileSync5(join16(destDir, entry.name), readFileSync12(join16(srcDir, entry.name)));
|
|
4766
5102
|
}
|
|
4767
5103
|
}
|
|
4768
5104
|
}
|
|
@@ -4771,25 +5107,25 @@ function createBackup(cwd) {
|
|
|
4771
5107
|
const dir = backupDirPath(cwd);
|
|
4772
5108
|
let name = base;
|
|
4773
5109
|
let suffix = 1;
|
|
4774
|
-
while (
|
|
5110
|
+
while (existsSync19(join16(dir, name))) {
|
|
4775
5111
|
name = `${base}-${suffix}`;
|
|
4776
5112
|
suffix++;
|
|
4777
5113
|
}
|
|
4778
5114
|
const src = projectDir(cwd);
|
|
4779
|
-
const dest =
|
|
5115
|
+
const dest = join16(dir, name);
|
|
4780
5116
|
copyDirectoryFiles(src, dest, ["backups"]);
|
|
4781
5117
|
return name;
|
|
4782
5118
|
}
|
|
4783
5119
|
function listBackups(cwd) {
|
|
4784
5120
|
const dir = backupDirPath(cwd);
|
|
4785
|
-
if (!
|
|
5121
|
+
if (!existsSync19(dir))
|
|
4786
5122
|
return [];
|
|
4787
5123
|
const entries = readdirSync7(dir, { withFileTypes: true });
|
|
4788
5124
|
const backups = [];
|
|
4789
5125
|
for (const entry of entries) {
|
|
4790
5126
|
if (!entry.isDirectory() || !entry.name.startsWith("backup-"))
|
|
4791
5127
|
continue;
|
|
4792
|
-
const backupPath =
|
|
5128
|
+
const backupPath = join16(dir, entry.name);
|
|
4793
5129
|
const match = entry.name.match(/^backup-(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})(\d{3})?(?:-\d+)?$/);
|
|
4794
5130
|
let timestamp;
|
|
4795
5131
|
if (match) {
|
|
@@ -4812,8 +5148,8 @@ function listBackups(cwd) {
|
|
|
4812
5148
|
return backups;
|
|
4813
5149
|
}
|
|
4814
5150
|
function restoreBackup(cwd, backupName) {
|
|
4815
|
-
const backupPath =
|
|
4816
|
-
if (!
|
|
5151
|
+
const backupPath = join16(backupDirPath(cwd), backupName);
|
|
5152
|
+
if (!existsSync19(backupPath)) {
|
|
4817
5153
|
throw new Error(`backup not found: ${backupName}`);
|
|
4818
5154
|
}
|
|
4819
5155
|
createBackup(cwd);
|
|
@@ -4825,7 +5161,7 @@ var init_backup = __esm(() => {
|
|
|
4825
5161
|
|
|
4826
5162
|
// src/core/scanner.ts
|
|
4827
5163
|
import { readdirSync as readdirSync8, statSync as statSync8 } from "fs";
|
|
4828
|
-
import { join as
|
|
5164
|
+
import { join as join17, relative } from "path";
|
|
4829
5165
|
function matchesPattern(name, pattern) {
|
|
4830
5166
|
if (pattern.includes("*")) {
|
|
4831
5167
|
const regex = new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$");
|
|
@@ -4849,14 +5185,14 @@ function walkDirectory(dir, projectRoot, excludes, results) {
|
|
|
4849
5185
|
if (entry.isDirectory()) {
|
|
4850
5186
|
if (isExcluded(entry.name, excludes))
|
|
4851
5187
|
continue;
|
|
4852
|
-
walkDirectory(
|
|
5188
|
+
walkDirectory(join17(dir, entry.name), projectRoot, excludes, results);
|
|
4853
5189
|
continue;
|
|
4854
5190
|
}
|
|
4855
5191
|
if (entry.isFile()) {
|
|
4856
5192
|
if (isExcluded(entry.name, excludes))
|
|
4857
5193
|
continue;
|
|
4858
5194
|
try {
|
|
4859
|
-
const fullPath =
|
|
5195
|
+
const fullPath = join17(dir, entry.name);
|
|
4860
5196
|
const stat = statSync8(fullPath);
|
|
4861
5197
|
results.push({
|
|
4862
5198
|
relativePath: relative(projectRoot, fullPath),
|
|
@@ -5279,7 +5615,7 @@ __export(exports_scan, {
|
|
|
5279
5615
|
});
|
|
5280
5616
|
import { readFileSync as readFileSync13 } from "fs";
|
|
5281
5617
|
import { createHash as createHash2 } from "crypto";
|
|
5282
|
-
import { join as
|
|
5618
|
+
import { join as join18, relative as relative2 } from "path";
|
|
5283
5619
|
function configRelativePath(cfgPath, cwd) {
|
|
5284
5620
|
const rel = relative2(cwd, cfgPath);
|
|
5285
5621
|
return rel.startsWith("..") ? cfgPath : rel;
|
|
@@ -5330,7 +5666,7 @@ function scan(cwd, options) {
|
|
|
5330
5666
|
if (!stalePaths.has(file.relativePath)) {
|
|
5331
5667
|
continue;
|
|
5332
5668
|
}
|
|
5333
|
-
const fullPath =
|
|
5669
|
+
const fullPath = join18(cwd, file.relativePath);
|
|
5334
5670
|
let content;
|
|
5335
5671
|
try {
|
|
5336
5672
|
content = readFileSync13(fullPath, "utf-8");
|
|
@@ -5419,10 +5755,10 @@ __export(exports_seed, {
|
|
|
5419
5755
|
parseGoMod: () => parseGoMod,
|
|
5420
5756
|
parseCargoToml: () => parseCargoToml
|
|
5421
5757
|
});
|
|
5422
|
-
import { basename as basename4, join as
|
|
5423
|
-
import { readFileSync as readFileSync14, existsSync as
|
|
5758
|
+
import { basename as basename4, join as join19 } from "path";
|
|
5759
|
+
import { readFileSync as readFileSync14, existsSync as existsSync20 } from "fs";
|
|
5424
5760
|
function readFile(filePath) {
|
|
5425
|
-
if (!
|
|
5761
|
+
if (!existsSync20(filePath))
|
|
5426
5762
|
return null;
|
|
5427
5763
|
try {
|
|
5428
5764
|
return readFileSync14(filePath, "utf-8");
|
|
@@ -5515,10 +5851,10 @@ function parseGoMod(filePath) {
|
|
|
5515
5851
|
}
|
|
5516
5852
|
function seedLearningMemory(projectRoot) {
|
|
5517
5853
|
const parsers = [
|
|
5518
|
-
() => parsePackageJson(
|
|
5519
|
-
() => parsePyprojectToml(
|
|
5520
|
-
() => parseCargoToml(
|
|
5521
|
-
() => parseGoMod(
|
|
5854
|
+
() => parsePackageJson(join19(projectRoot, "package.json")),
|
|
5855
|
+
() => parsePyprojectToml(join19(projectRoot, "pyproject.toml")),
|
|
5856
|
+
() => parseCargoToml(join19(projectRoot, "Cargo.toml")),
|
|
5857
|
+
() => parseGoMod(join19(projectRoot, "go.mod"))
|
|
5522
5858
|
];
|
|
5523
5859
|
const infos = parsers.map((fn) => fn()).filter((info) => info !== null);
|
|
5524
5860
|
const projectName = infos.find((i) => i.projectName)?.projectName ?? basename4(projectRoot);
|
|
@@ -5596,34 +5932,37 @@ var init_seed = __esm(() => {
|
|
|
5596
5932
|
var exports_init = {};
|
|
5597
5933
|
__export(exports_init, {
|
|
5598
5934
|
writeMinkRule: () => writeMinkRule,
|
|
5935
|
+
resolveTargetsFromFlag: () => resolveTargetsFromFlag,
|
|
5936
|
+
resolveTargets: () => resolveTargets,
|
|
5599
5937
|
resolveCliPathFrom: () => resolveCliPathFrom,
|
|
5600
5938
|
resolveCliPath: () => resolveCliPath,
|
|
5601
5939
|
mergeHooksIntoSettings: () => mergeHooksIntoSettings,
|
|
5940
|
+
installClaude: () => installClaude,
|
|
5602
5941
|
init: () => init,
|
|
5603
5942
|
detectRuntime: () => detectRuntime,
|
|
5604
5943
|
buildHooksConfig: () => buildHooksConfig
|
|
5605
5944
|
});
|
|
5606
|
-
import { execSync as
|
|
5607
|
-
import { mkdirSync as
|
|
5608
|
-
import { resolve as
|
|
5945
|
+
import { execSync as execSync6 } from "child_process";
|
|
5946
|
+
import { mkdirSync as mkdirSync10, existsSync as existsSync21 } from "fs";
|
|
5947
|
+
import { resolve as resolve3, dirname as dirname8, basename as basename5, join as join20 } from "path";
|
|
5609
5948
|
function detectRuntime() {
|
|
5610
5949
|
try {
|
|
5611
|
-
|
|
5950
|
+
execSync6("bun --version", { stdio: "ignore" });
|
|
5612
5951
|
return "bun";
|
|
5613
5952
|
} catch {
|
|
5614
5953
|
return "node";
|
|
5615
5954
|
}
|
|
5616
5955
|
}
|
|
5617
5956
|
function resolveCliPathFrom(selfPath) {
|
|
5618
|
-
const selfDir =
|
|
5957
|
+
const selfDir = dirname8(selfPath);
|
|
5619
5958
|
if (selfPath.endsWith("dist/cli.js") || selfPath.endsWith("dist/cli.bun.js") || selfPath.endsWith("dist/cli.node.js")) {
|
|
5620
|
-
return
|
|
5959
|
+
return join20(selfDir, "cli.js");
|
|
5621
5960
|
}
|
|
5622
|
-
const packageRoot =
|
|
5623
|
-
const distShim =
|
|
5624
|
-
if (
|
|
5961
|
+
const packageRoot = resolve3(selfDir, "..", "..");
|
|
5962
|
+
const distShim = join20(packageRoot, "dist", "cli.js");
|
|
5963
|
+
if (existsSync21(distShim))
|
|
5625
5964
|
return distShim;
|
|
5626
|
-
return
|
|
5965
|
+
return join20(packageRoot, "src", "cli.ts");
|
|
5627
5966
|
}
|
|
5628
5967
|
function resolveCliPath() {
|
|
5629
5968
|
return resolveCliPathFrom(new URL(import.meta.url).pathname);
|
|
@@ -5665,13 +6004,13 @@ function isMinkHook(entry) {
|
|
|
5665
6004
|
return false;
|
|
5666
6005
|
}
|
|
5667
6006
|
function writeMinkRule(cwd) {
|
|
5668
|
-
const rulePath =
|
|
5669
|
-
|
|
6007
|
+
const rulePath = resolve3(cwd, ".claude", "rules", "mink.md");
|
|
6008
|
+
mkdirSync10(dirname8(rulePath), { recursive: true });
|
|
5670
6009
|
atomicWriteText(rulePath, MINK_RULE_CONTENT);
|
|
5671
6010
|
return rulePath;
|
|
5672
6011
|
}
|
|
5673
6012
|
function mergeHooksIntoSettings(settingsPath, newHooks) {
|
|
5674
|
-
|
|
6013
|
+
mkdirSync10(dirname8(settingsPath), { recursive: true });
|
|
5675
6014
|
const existing = safeReadJson(settingsPath) ?? {};
|
|
5676
6015
|
const existingHooks = existing.hooks ?? {};
|
|
5677
6016
|
for (const [event, entries] of Object.entries(newHooks)) {
|
|
@@ -5682,17 +6021,46 @@ function mergeHooksIntoSettings(settingsPath, newHooks) {
|
|
|
5682
6021
|
existing.hooks = existingHooks;
|
|
5683
6022
|
atomicWriteJson(settingsPath, existing);
|
|
5684
6023
|
}
|
|
6024
|
+
function installClaude(cwd, cliPath) {
|
|
6025
|
+
const settingsPath = resolve3(cwd, ".claude", "settings.json");
|
|
6026
|
+
mergeHooksIntoSettings(settingsPath, buildHooksConfig(cliPath));
|
|
6027
|
+
const rulePath = writeMinkRule(cwd);
|
|
6028
|
+
return { settingsPath, rulePath };
|
|
6029
|
+
}
|
|
6030
|
+
async function resolveTargets(cwd, opts) {
|
|
6031
|
+
if (opts.targets && opts.targets.length > 0)
|
|
6032
|
+
return opts.targets;
|
|
6033
|
+
const detected = detectAgents(cwd);
|
|
6034
|
+
const detectedIds = detected.filter((a) => a.detected).map((a) => a.id);
|
|
6035
|
+
if (opts.interactive && stdinIsInteractive()) {
|
|
6036
|
+
return promptForAgents(detected, detectedIds);
|
|
6037
|
+
}
|
|
6038
|
+
return detectedIds.length > 0 ? detectedIds : ["claude"];
|
|
6039
|
+
}
|
|
6040
|
+
async function promptForAgents(detected, defaults) {
|
|
6041
|
+
const fallback = defaults.length > 0 ? defaults : ["claude"];
|
|
6042
|
+
console.log("Which assistant(s) should Mink work with?");
|
|
6043
|
+
detected.forEach((a, i) => {
|
|
6044
|
+
const tag = a.detected ? ` (detected \u2014 ${a.signals.join(", ")})` : "";
|
|
6045
|
+
console.log(` ${i + 1}) ${a.label}${tag}`);
|
|
6046
|
+
});
|
|
6047
|
+
const answer = (await ask(`Enter numbers (comma-separated), 'a' for all [default: ${fallback.join(", ")}]: `)).trim().toLowerCase();
|
|
6048
|
+
if (answer === "")
|
|
6049
|
+
return fallback;
|
|
6050
|
+
if (answer === "a" || answer === "all")
|
|
6051
|
+
return AGENTS.map((a) => a.id);
|
|
6052
|
+
const picked = answer.split(",").map((s) => parseInt(s.trim(), 10)).filter((n) => Number.isInteger(n) && n >= 1 && n <= detected.length).map((n) => detected[n - 1].id);
|
|
6053
|
+
return picked.length > 0 ? picked : fallback;
|
|
6054
|
+
}
|
|
5685
6055
|
function isExistingInstallation(cwd) {
|
|
5686
6056
|
const dir = projectDir(cwd);
|
|
5687
|
-
if (!
|
|
6057
|
+
if (!existsSync21(dir))
|
|
5688
6058
|
return false;
|
|
5689
|
-
return
|
|
6059
|
+
return existsSync21(join20(dir, "file-index.json"));
|
|
5690
6060
|
}
|
|
5691
|
-
async function init(cwd) {
|
|
6061
|
+
async function init(cwd, opts = {}) {
|
|
5692
6062
|
const runtime = detectRuntime();
|
|
5693
6063
|
const cliPath = resolveCliPath();
|
|
5694
|
-
const hooks = buildHooksConfig(cliPath);
|
|
5695
|
-
const settingsPath = resolve2(cwd, ".claude", "settings.json");
|
|
5696
6064
|
const dir = projectDir(cwd);
|
|
5697
6065
|
const upgrading = isExistingInstallation(cwd);
|
|
5698
6066
|
if (upgrading) {
|
|
@@ -5701,9 +6069,22 @@ async function init(cwd) {
|
|
|
5701
6069
|
const backupName = createBackup2(cwd);
|
|
5702
6070
|
console.log(` backup: ${backupName}`);
|
|
5703
6071
|
}
|
|
5704
|
-
|
|
5705
|
-
const
|
|
5706
|
-
|
|
6072
|
+
const targets = await resolveTargets(cwd, opts);
|
|
6073
|
+
const wired = {};
|
|
6074
|
+
for (const target of targets) {
|
|
6075
|
+
if (target === "claude") {
|
|
6076
|
+
const { settingsPath, rulePath } = installClaude(cwd, cliPath);
|
|
6077
|
+
wired.claude = [`hooks: ${settingsPath}`, `rule: ${rulePath}`];
|
|
6078
|
+
} else if (target === "pi") {
|
|
6079
|
+
const r = installPi(cwd, cliPath);
|
|
6080
|
+
wired.pi = [
|
|
6081
|
+
`extension: ${r.extensionPath}`,
|
|
6082
|
+
`guidance: ${r.guidancePath}`,
|
|
6083
|
+
...r.notePath ? [`note skill: ${r.notePath}`] : []
|
|
6084
|
+
];
|
|
6085
|
+
}
|
|
6086
|
+
}
|
|
6087
|
+
mkdirSync10(dir, { recursive: true });
|
|
5707
6088
|
const identity = resolveProjectIdentity(cwd);
|
|
5708
6089
|
const projectId = identity.id;
|
|
5709
6090
|
const isNotesProject = isWikiEnabled() && isVaultInitialized() && isInsideVault(cwd);
|
|
@@ -5711,6 +6092,8 @@ async function init(cwd) {
|
|
|
5711
6092
|
const existingMeta = safeReadJson(metaPath);
|
|
5712
6093
|
const deviceId = getOrCreateDeviceId();
|
|
5713
6094
|
const existingPathsByDevice = existingMeta?.pathsByDevice && typeof existingMeta.pathsByDevice === "object" && !Array.isArray(existingMeta.pathsByDevice) ? existingMeta.pathsByDevice : {};
|
|
6095
|
+
const priorAgents = Array.isArray(existingMeta?.agents) ? existingMeta.agents : [];
|
|
6096
|
+
const agents = Array.from(new Set([...priorAgents, ...targets]));
|
|
5714
6097
|
atomicWriteJson(metaPath, {
|
|
5715
6098
|
...existingMeta ?? {},
|
|
5716
6099
|
cwd,
|
|
@@ -5718,20 +6101,29 @@ async function init(cwd) {
|
|
|
5718
6101
|
initTimestamp: existingMeta?.initTimestamp ?? new Date().toISOString(),
|
|
5719
6102
|
version: "0.1.0",
|
|
5720
6103
|
pathsByDevice: { ...existingPathsByDevice, [deviceId]: cwd },
|
|
6104
|
+
agents,
|
|
5721
6105
|
...isNotesProject ? { projectType: "notes" } : {}
|
|
5722
6106
|
});
|
|
6107
|
+
const printWiring = () => {
|
|
6108
|
+
for (const id of Object.keys(wired)) {
|
|
6109
|
+
const label = AGENTS.find((a) => a.id === id)?.label ?? id;
|
|
6110
|
+
console.log(` ${label}:`);
|
|
6111
|
+
for (const line of wired[id])
|
|
6112
|
+
console.log(` ${line}`);
|
|
6113
|
+
}
|
|
6114
|
+
};
|
|
5723
6115
|
if (upgrading) {
|
|
5724
6116
|
console.log(`[mink] upgrade complete`);
|
|
5725
6117
|
console.log(` project: ${projectId}`);
|
|
5726
|
-
console.log(`
|
|
5727
|
-
|
|
6118
|
+
console.log(` agents: ${agents.join(", ")}`);
|
|
6119
|
+
printWiring();
|
|
5728
6120
|
} else {
|
|
5729
6121
|
console.log(`[mink] initialized`);
|
|
5730
6122
|
console.log(` project: ${projectId} (${identity.source})`);
|
|
5731
6123
|
console.log(` state: ${dir}`);
|
|
5732
6124
|
console.log(` runtime: ${runtime}`);
|
|
5733
|
-
console.log(`
|
|
5734
|
-
|
|
6125
|
+
console.log(` agents: ${agents.join(", ")}`);
|
|
6126
|
+
printWiring();
|
|
5735
6127
|
}
|
|
5736
6128
|
if (identity.source === "path-derived") {
|
|
5737
6129
|
const root = getRepoRoot(cwd);
|
|
@@ -5743,7 +6135,7 @@ async function init(cwd) {
|
|
|
5743
6135
|
scan2(cwd, { check: false });
|
|
5744
6136
|
const { learningMemoryPath: learningMemoryPath2 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
|
|
5745
6137
|
const memPath = learningMemoryPath2(cwd);
|
|
5746
|
-
if (!
|
|
6138
|
+
if (!existsSync21(memPath)) {
|
|
5747
6139
|
const { seedLearningMemory: seedLearningMemory2 } = await Promise.resolve().then(() => (init_seed(), exports_seed));
|
|
5748
6140
|
const { serializeLearningMemory: serializeLearningMemory2 } = await Promise.resolve().then(() => (init_learning_memory(), exports_learning_memory));
|
|
5749
6141
|
const mem = seedLearningMemory2(cwd);
|
|
@@ -5752,8 +6144,8 @@ async function init(cwd) {
|
|
|
5752
6144
|
if (isWikiEnabled() && isVaultInitialized() && !isNotesProject) {
|
|
5753
6145
|
try {
|
|
5754
6146
|
const projectSlug = basename5(cwd);
|
|
5755
|
-
const overviewPath =
|
|
5756
|
-
if (!
|
|
6147
|
+
const overviewPath = join20(vaultProjects(projectSlug), "overview.md");
|
|
6148
|
+
if (!existsSync21(overviewPath)) {
|
|
5757
6149
|
const now = new Date().toISOString();
|
|
5758
6150
|
const overview = [
|
|
5759
6151
|
`---`,
|
|
@@ -5805,6 +6197,9 @@ var init_init = __esm(() => {
|
|
|
5805
6197
|
init_device();
|
|
5806
6198
|
init_git_identity();
|
|
5807
6199
|
init_vault();
|
|
6200
|
+
init_agent_detect();
|
|
6201
|
+
init_agent_pi();
|
|
6202
|
+
init_prompt();
|
|
5808
6203
|
});
|
|
5809
6204
|
|
|
5810
6205
|
// src/repositories/counters-repo.ts
|
|
@@ -5879,12 +6274,12 @@ var init_state_counters = __esm(() => {
|
|
|
5879
6274
|
});
|
|
5880
6275
|
|
|
5881
6276
|
// src/core/channel-templates.ts
|
|
5882
|
-
import { join as
|
|
5883
|
-
import { existsSync as
|
|
6277
|
+
import { join as join21 } from "path";
|
|
6278
|
+
import { existsSync as existsSync22, writeFileSync as writeFileSync6, mkdirSync as mkdirSync11 } from "fs";
|
|
5884
6279
|
function writeCompanionClaudeMd(vaultPath, overwrite = false) {
|
|
5885
|
-
|
|
5886
|
-
const claudeMdPath =
|
|
5887
|
-
if (
|
|
6280
|
+
mkdirSync11(vaultPath, { recursive: true });
|
|
6281
|
+
const claudeMdPath = join21(vaultPath, "CLAUDE.md");
|
|
6282
|
+
if (existsSync22(claudeMdPath) && !overwrite) {
|
|
5888
6283
|
return false;
|
|
5889
6284
|
}
|
|
5890
6285
|
writeFileSync6(claudeMdPath, COMPANION_CLAUDE_MD);
|
|
@@ -6036,8 +6431,8 @@ mink wiki rebuild-index
|
|
|
6036
6431
|
var init_channel_templates = () => {};
|
|
6037
6432
|
|
|
6038
6433
|
// src/core/channel-process.ts
|
|
6039
|
-
import { readFileSync as readFileSync15, writeFileSync as writeFileSync7, unlinkSync as unlinkSync3, mkdirSync as
|
|
6040
|
-
import { dirname as
|
|
6434
|
+
import { readFileSync as readFileSync15, writeFileSync as writeFileSync7, unlinkSync as unlinkSync3, mkdirSync as mkdirSync12, existsSync as existsSync23 } from "fs";
|
|
6435
|
+
import { dirname as dirname9, join as join22 } from "path";
|
|
6041
6436
|
import { spawnSync } from "child_process";
|
|
6042
6437
|
function readChannelPidFile() {
|
|
6043
6438
|
try {
|
|
@@ -6053,7 +6448,7 @@ function readChannelPidFile() {
|
|
|
6053
6448
|
}
|
|
6054
6449
|
function writeChannelPidFile(data) {
|
|
6055
6450
|
const pidPath = channelPidPath();
|
|
6056
|
-
|
|
6451
|
+
mkdirSync12(dirname9(pidPath), { recursive: true });
|
|
6057
6452
|
writeFileSync7(pidPath, JSON.stringify(data, null, 2));
|
|
6058
6453
|
}
|
|
6059
6454
|
function removeChannelPidFile() {
|
|
@@ -6183,12 +6578,12 @@ function getChannelLogs() {
|
|
|
6183
6578
|
return null;
|
|
6184
6579
|
if (!screenSessionExists(pidData.session))
|
|
6185
6580
|
return null;
|
|
6186
|
-
const tmpPath =
|
|
6581
|
+
const tmpPath = join22(minkRoot(), `.channel-capture-${Date.now()}-${process.pid}.txt`);
|
|
6187
6582
|
const result = spawnSync("screen", ["-S", pidData.session, "-X", "hardcopy", "-h", tmpPath], { stdio: "ignore" });
|
|
6188
6583
|
if (result.status !== 0)
|
|
6189
6584
|
return null;
|
|
6190
6585
|
for (let i = 0;i < 20; i++) {
|
|
6191
|
-
if (
|
|
6586
|
+
if (existsSync23(tmpPath))
|
|
6192
6587
|
break;
|
|
6193
6588
|
const delayUntil = Date.now() + 50;
|
|
6194
6589
|
while (Date.now() < delayUntil) {}
|
|
@@ -6292,7 +6687,7 @@ async function runtimeServe(opts) {
|
|
|
6292
6687
|
}
|
|
6293
6688
|
const { createServer } = await import("http");
|
|
6294
6689
|
const { Readable } = await import("stream");
|
|
6295
|
-
return new Promise((
|
|
6690
|
+
return new Promise((resolve4) => {
|
|
6296
6691
|
const httpServer = createServer(async (req, res) => {
|
|
6297
6692
|
const url = `http://${opts.hostname}:${opts.port}${req.url ?? "/"}`;
|
|
6298
6693
|
const headers = new Headers;
|
|
@@ -6351,7 +6746,7 @@ async function runtimeServe(opts) {
|
|
|
6351
6746
|
httpServer.listen(opts.port, opts.hostname, () => {
|
|
6352
6747
|
const addr = httpServer.address();
|
|
6353
6748
|
const boundPort = typeof addr === "object" && addr ? addr.port : opts.port;
|
|
6354
|
-
|
|
6749
|
+
resolve4({
|
|
6355
6750
|
port: boundPort,
|
|
6356
6751
|
stop: (close) => {
|
|
6357
6752
|
if (close)
|
|
@@ -6369,8 +6764,8 @@ var init_runtime = __esm(() => {
|
|
|
6369
6764
|
|
|
6370
6765
|
// src/core/daemon.ts
|
|
6371
6766
|
import { readFileSync as readFileSync16, writeFileSync as writeFileSync8, unlinkSync as unlinkSync4, openSync } from "fs";
|
|
6372
|
-
import { mkdirSync as
|
|
6373
|
-
import { dirname as
|
|
6767
|
+
import { mkdirSync as mkdirSync13 } from "fs";
|
|
6768
|
+
import { dirname as dirname10, resolve as resolve4 } from "path";
|
|
6374
6769
|
function readPidFile() {
|
|
6375
6770
|
try {
|
|
6376
6771
|
const raw = readFileSync16(schedulerPidPath(), "utf-8");
|
|
@@ -6385,7 +6780,7 @@ function readPidFile() {
|
|
|
6385
6780
|
}
|
|
6386
6781
|
function writePidFile(data) {
|
|
6387
6782
|
const pidPath = schedulerPidPath();
|
|
6388
|
-
|
|
6783
|
+
mkdirSync13(dirname10(pidPath), { recursive: true });
|
|
6389
6784
|
writeFileSync8(pidPath, JSON.stringify(data, null, 2));
|
|
6390
6785
|
}
|
|
6391
6786
|
function removePidFile() {
|
|
@@ -6410,10 +6805,10 @@ function startDaemon(cwd) {
|
|
|
6410
6805
|
if (existing) {
|
|
6411
6806
|
removePidFile();
|
|
6412
6807
|
}
|
|
6413
|
-
const __dir =
|
|
6414
|
-
const cliPath = process.argv[1] ??
|
|
6808
|
+
const __dir = dirname10(new URL(import.meta.url).pathname);
|
|
6809
|
+
const cliPath = process.argv[1] ?? resolve4(__dir, "../cli.ts");
|
|
6415
6810
|
const logPath = schedulerLogPath();
|
|
6416
|
-
|
|
6811
|
+
mkdirSync13(dirname10(logPath), { recursive: true });
|
|
6417
6812
|
const logFd = openSync(logPath, "a");
|
|
6418
6813
|
const proc = runtimeSpawn(["bun", "run", cliPath, "cron", "__daemon"], {
|
|
6419
6814
|
cwd,
|
|
@@ -6527,9 +6922,9 @@ var exports_status = {};
|
|
|
6527
6922
|
__export(exports_status, {
|
|
6528
6923
|
status: () => status
|
|
6529
6924
|
});
|
|
6530
|
-
import { existsSync as
|
|
6925
|
+
import { existsSync as existsSync25, readFileSync as readFileSync17, statSync as statSync9 } from "fs";
|
|
6531
6926
|
function checkJsonFile(name, filePath, validator) {
|
|
6532
|
-
if (!
|
|
6927
|
+
if (!existsSync25(filePath))
|
|
6533
6928
|
return { name, path: filePath, status: "missing" };
|
|
6534
6929
|
const data = safeReadJson(filePath);
|
|
6535
6930
|
if (data === null)
|
|
@@ -6539,7 +6934,7 @@ function checkJsonFile(name, filePath, validator) {
|
|
|
6539
6934
|
return { name, path: filePath, status: "ok" };
|
|
6540
6935
|
}
|
|
6541
6936
|
function checkDbFile(name, filePath) {
|
|
6542
|
-
if (!
|
|
6937
|
+
if (!existsSync25(filePath))
|
|
6543
6938
|
return { name, path: filePath, status: "missing" };
|
|
6544
6939
|
try {
|
|
6545
6940
|
const header = readFileSync17(filePath).slice(0, 16).toString("utf-8");
|
|
@@ -6554,7 +6949,7 @@ function checkDbFile(name, filePath) {
|
|
|
6554
6949
|
function checkShardedText(name, candidatePaths) {
|
|
6555
6950
|
const canonical = candidatePaths[0];
|
|
6556
6951
|
for (const p of candidatePaths) {
|
|
6557
|
-
if (!
|
|
6952
|
+
if (!existsSync25(p))
|
|
6558
6953
|
continue;
|
|
6559
6954
|
try {
|
|
6560
6955
|
if (statSync9(p).size === 0)
|
|
@@ -6647,7 +7042,7 @@ function status(cwd) {
|
|
|
6647
7042
|
console.log(` Decision Log: ${mem.sections["Decision Log"].length}`);
|
|
6648
7043
|
console.log(` Total entries: ${total}`);
|
|
6649
7044
|
const memPath = learningMemoryPath(cwd);
|
|
6650
|
-
if (
|
|
7045
|
+
if (existsSync25(memPath)) {
|
|
6651
7046
|
const mtime = statSync9(memPath).mtime;
|
|
6652
7047
|
console.log(` Canonical last modified: ${mtime.toISOString()}`);
|
|
6653
7048
|
}
|
|
@@ -7487,9 +7882,9 @@ __export(exports_self_update, {
|
|
|
7487
7882
|
PACKAGE_NAME: () => PACKAGE_NAME
|
|
7488
7883
|
});
|
|
7489
7884
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
7490
|
-
import { existsSync as
|
|
7491
|
-
import { dirname as
|
|
7492
|
-
import { join as
|
|
7885
|
+
import { existsSync as existsSync26, readFileSync as readFileSync20 } from "fs";
|
|
7886
|
+
import { dirname as dirname11 } from "path";
|
|
7887
|
+
import { join as join23 } from "path";
|
|
7493
7888
|
function parseSemver(input) {
|
|
7494
7889
|
const trimmed = input.trim().replace(/^v/, "");
|
|
7495
7890
|
if (!trimmed)
|
|
@@ -7536,15 +7931,15 @@ function compareSemver(a, b) {
|
|
|
7536
7931
|
function getInstallInfo() {
|
|
7537
7932
|
const selfPath = new URL(import.meta.url).pathname;
|
|
7538
7933
|
const isDevMode = selfPath.endsWith(".ts");
|
|
7539
|
-
let dir =
|
|
7934
|
+
let dir = dirname11(selfPath);
|
|
7540
7935
|
let packageJsonPath = null;
|
|
7541
7936
|
for (let i = 0;i < 10; i++) {
|
|
7542
|
-
const candidate =
|
|
7543
|
-
if (
|
|
7937
|
+
const candidate = join23(dir, "package.json");
|
|
7938
|
+
if (existsSync26(candidate)) {
|
|
7544
7939
|
packageJsonPath = candidate;
|
|
7545
7940
|
break;
|
|
7546
7941
|
}
|
|
7547
|
-
const parent =
|
|
7942
|
+
const parent = dirname11(dir);
|
|
7548
7943
|
if (parent === dir)
|
|
7549
7944
|
break;
|
|
7550
7945
|
dir = parent;
|
|
@@ -7614,7 +8009,7 @@ function buildInstallCommand(pm, version) {
|
|
|
7614
8009
|
return ["npm", "install", "-g", ref];
|
|
7615
8010
|
}
|
|
7616
8011
|
function selfUpdateLogPath() {
|
|
7617
|
-
return
|
|
8012
|
+
return join23(minkRoot(), "self-update.log");
|
|
7618
8013
|
}
|
|
7619
8014
|
function appendLogEntry(entry) {
|
|
7620
8015
|
const path = selfUpdateLogPath();
|
|
@@ -8403,21 +8798,21 @@ var init_cron = __esm(() => {
|
|
|
8403
8798
|
});
|
|
8404
8799
|
|
|
8405
8800
|
// src/core/vault-templates.ts
|
|
8406
|
-
import { join as
|
|
8407
|
-
import { existsSync as
|
|
8801
|
+
import { join as join24 } from "path";
|
|
8802
|
+
import { existsSync as existsSync27, writeFileSync as writeFileSync9, readFileSync as readFileSync21, mkdirSync as mkdirSync14 } from "fs";
|
|
8408
8803
|
function seedTemplates(templatesDir) {
|
|
8409
|
-
|
|
8804
|
+
mkdirSync14(templatesDir, { recursive: true });
|
|
8410
8805
|
for (const [name, content] of Object.entries(DEFAULT_TEMPLATES)) {
|
|
8411
|
-
const filePath =
|
|
8412
|
-
if (!
|
|
8806
|
+
const filePath = join24(templatesDir, `${name}.md`);
|
|
8807
|
+
if (!existsSync27(filePath)) {
|
|
8413
8808
|
writeFileSync9(filePath, content);
|
|
8414
8809
|
}
|
|
8415
8810
|
}
|
|
8416
8811
|
}
|
|
8417
8812
|
function loadTemplate(templatesDir, templateName, vars) {
|
|
8418
|
-
const filePath =
|
|
8813
|
+
const filePath = join24(templatesDir, `${templateName}.md`);
|
|
8419
8814
|
let content;
|
|
8420
|
-
if (
|
|
8815
|
+
if (existsSync27(filePath)) {
|
|
8421
8816
|
content = readFileSync21(filePath, "utf-8");
|
|
8422
8817
|
} else if (DEFAULT_TEMPLATES[templateName]) {
|
|
8423
8818
|
content = DEFAULT_TEMPLATES[templateName];
|
|
@@ -8571,29 +8966,29 @@ category: resources
|
|
|
8571
8966
|
});
|
|
8572
8967
|
|
|
8573
8968
|
// src/core/note-writer.ts
|
|
8574
|
-
import { join as
|
|
8575
|
-
import { existsSync as
|
|
8969
|
+
import { join as join25 } from "path";
|
|
8970
|
+
import { existsSync as existsSync28, readFileSync as readFileSync22 } from "fs";
|
|
8576
8971
|
import { createHash as createHash3 } from "crypto";
|
|
8577
8972
|
function sha256(content) {
|
|
8578
8973
|
return createHash3("sha256").update(content).digest("hex");
|
|
8579
8974
|
}
|
|
8580
8975
|
function resolveUniqueNotePath(dir, baseSlug, content) {
|
|
8581
8976
|
const targetHash = sha256(content);
|
|
8582
|
-
const primary =
|
|
8583
|
-
if (!
|
|
8977
|
+
const primary = join25(dir, `${baseSlug}.md`);
|
|
8978
|
+
if (!existsSync28(primary))
|
|
8584
8979
|
return primary;
|
|
8585
8980
|
if (sameContent(primary, targetHash))
|
|
8586
8981
|
return primary;
|
|
8587
8982
|
const dev4 = getOrCreateDeviceId().replace(/-/g, "").slice(0, 4);
|
|
8588
8983
|
for (let i = 0;i < MAX_COLLISION_ATTEMPTS; i++) {
|
|
8589
8984
|
const suffix = i === 0 ? dev4 : `${dev4}-${i + 1}`;
|
|
8590
|
-
const candidate =
|
|
8591
|
-
if (!
|
|
8985
|
+
const candidate = join25(dir, `${baseSlug}-${suffix}.md`);
|
|
8986
|
+
if (!existsSync28(candidate))
|
|
8592
8987
|
return candidate;
|
|
8593
8988
|
if (sameContent(candidate, targetHash))
|
|
8594
8989
|
return candidate;
|
|
8595
8990
|
}
|
|
8596
|
-
return
|
|
8991
|
+
return join25(dir, `${baseSlug}-${Date.now()}.md`);
|
|
8597
8992
|
}
|
|
8598
8993
|
function sameContent(filePath, expectedHash) {
|
|
8599
8994
|
try {
|
|
@@ -8668,8 +9063,8 @@ ${meta.body}
|
|
|
8668
9063
|
}
|
|
8669
9064
|
function appendToDaily(date, content) {
|
|
8670
9065
|
const dir = vaultDailyDir();
|
|
8671
|
-
const filePath =
|
|
8672
|
-
if (
|
|
9066
|
+
const filePath = join25(dir, `${date}.md`);
|
|
9067
|
+
if (existsSync28(filePath)) {
|
|
8673
9068
|
const timestamp = new Date().toLocaleTimeString("en-US", {
|
|
8674
9069
|
hour: "2-digit",
|
|
8675
9070
|
minute: "2-digit",
|
|
@@ -8778,10 +9173,10 @@ var init_design_eval = __esm(() => {
|
|
|
8778
9173
|
});
|
|
8779
9174
|
|
|
8780
9175
|
// src/core/dashboard-api.ts
|
|
8781
|
-
import { existsSync as
|
|
9176
|
+
import { existsSync as existsSync29, readFileSync as readFileSync23 } from "fs";
|
|
8782
9177
|
import { readdirSync as readdirSync9, readFileSync as readFileSyncFS, existsSync as fsExistsSync } from "fs";
|
|
8783
|
-
import { join as
|
|
8784
|
-
import { execSync as
|
|
9178
|
+
import { join as join26, resolve as resolve6, normalize, sep } from "path";
|
|
9179
|
+
import { execSync as execSync7 } from "child_process";
|
|
8785
9180
|
function isSecretKey(key) {
|
|
8786
9181
|
return SECRET_KEY_PATTERNS.some((re) => re.test(key));
|
|
8787
9182
|
}
|
|
@@ -8793,7 +9188,7 @@ function maskSecret(value, showLast = 4) {
|
|
|
8793
9188
|
return "\u2022\u2022\u2022\u2022" + value.slice(-showLast);
|
|
8794
9189
|
}
|
|
8795
9190
|
function checkJsonFile2(name, filePath, validator) {
|
|
8796
|
-
if (!
|
|
9191
|
+
if (!existsSync29(filePath))
|
|
8797
9192
|
return { name, status: "missing" };
|
|
8798
9193
|
const data = safeReadJson(filePath);
|
|
8799
9194
|
if (data === null)
|
|
@@ -8803,7 +9198,7 @@ function checkJsonFile2(name, filePath, validator) {
|
|
|
8803
9198
|
return { name, status: "ok" };
|
|
8804
9199
|
}
|
|
8805
9200
|
function checkTextFile(name, filePath) {
|
|
8806
|
-
if (!
|
|
9201
|
+
if (!existsSync29(filePath))
|
|
8807
9202
|
return { name, status: "missing" };
|
|
8808
9203
|
try {
|
|
8809
9204
|
readFileSync23(filePath, "utf-8");
|
|
@@ -8813,7 +9208,7 @@ function checkTextFile(name, filePath) {
|
|
|
8813
9208
|
}
|
|
8814
9209
|
}
|
|
8815
9210
|
function checkDbFile2(name, filePath) {
|
|
8816
|
-
if (!
|
|
9211
|
+
if (!existsSync29(filePath))
|
|
8817
9212
|
return { name, status: "missing" };
|
|
8818
9213
|
try {
|
|
8819
9214
|
const header = readFileSync23(filePath).slice(0, 16).toString("utf-8");
|
|
@@ -8995,7 +9390,7 @@ function getAheadBehind(branch) {
|
|
|
8995
9390
|
if (!branch)
|
|
8996
9391
|
return { ahead: 0, behind: 0 };
|
|
8997
9392
|
try {
|
|
8998
|
-
const raw =
|
|
9393
|
+
const raw = execSync7(`git rev-list --left-right --count origin/${branch}...${branch}`, { cwd: minkRoot(), timeout: 5000, stdio: ["pipe", "pipe", "pipe"] }).toString().trim();
|
|
8999
9394
|
const [behindStr, aheadStr] = raw.split(/\s+/);
|
|
9000
9395
|
return {
|
|
9001
9396
|
behind: Number(behindStr) || 0,
|
|
@@ -9007,7 +9402,7 @@ function getAheadBehind(branch) {
|
|
|
9007
9402
|
}
|
|
9008
9403
|
function getPendingChanges() {
|
|
9009
9404
|
try {
|
|
9010
|
-
const raw =
|
|
9405
|
+
const raw = execSync7("git status --porcelain", {
|
|
9011
9406
|
cwd: minkRoot(),
|
|
9012
9407
|
timeout: 5000,
|
|
9013
9408
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -9079,7 +9474,7 @@ function countMarkdownIn(dir) {
|
|
|
9079
9474
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
9080
9475
|
if (WIKI_TREE_EXCLUDES.has(entry.name) || entry.name.startsWith("."))
|
|
9081
9476
|
continue;
|
|
9082
|
-
const fullPath =
|
|
9477
|
+
const fullPath = join26(dir, entry.name);
|
|
9083
9478
|
if (entry.isDirectory()) {
|
|
9084
9479
|
count += countMarkdownIn(fullPath);
|
|
9085
9480
|
} else if (entry.name.endsWith(".md") && !entry.name.startsWith("_")) {
|
|
@@ -9108,7 +9503,7 @@ function buildVaultTree(root) {
|
|
|
9108
9503
|
for (const entry of entries) {
|
|
9109
9504
|
if (!entry.isDir)
|
|
9110
9505
|
continue;
|
|
9111
|
-
const fullPath =
|
|
9506
|
+
const fullPath = join26(dir, entry.name);
|
|
9112
9507
|
const relPath = fullPath.slice(root.length + 1);
|
|
9113
9508
|
const count = countMarkdownIn(fullPath);
|
|
9114
9509
|
nodes.push({ name: entry.name, path: relPath, count, depth });
|
|
@@ -9193,7 +9588,7 @@ function resolveVaultRelativePath(relPath) {
|
|
|
9193
9588
|
if (!relPath || relPath.includes("\x00"))
|
|
9194
9589
|
return null;
|
|
9195
9590
|
const root = resolveVaultPath();
|
|
9196
|
-
const absolute =
|
|
9591
|
+
const absolute = resolve6(root, relPath);
|
|
9197
9592
|
const normalizedRoot = normalize(root) + sep;
|
|
9198
9593
|
if (!absolute.startsWith(normalizedRoot) && absolute !== normalize(root)) {
|
|
9199
9594
|
return null;
|
|
@@ -9531,7 +9926,7 @@ async function triggerIngestFile(sourcePath, category, tags, dedupKey) {
|
|
|
9531
9926
|
if (!isValidCategory(category)) {
|
|
9532
9927
|
return { success: false, error: `Invalid category: ${category}` };
|
|
9533
9928
|
}
|
|
9534
|
-
const expanded = sourcePath.startsWith("~/") ?
|
|
9929
|
+
const expanded = sourcePath.startsWith("~/") ? join26(process.env.HOME ?? "", sourcePath.slice(2)) : sourcePath;
|
|
9535
9930
|
if (!fsExistsSync(expanded)) {
|
|
9536
9931
|
return { success: false, error: `Source file not found: ${sourcePath}` };
|
|
9537
9932
|
}
|
|
@@ -9618,8 +10013,8 @@ __export(exports_dashboard_server, {
|
|
|
9618
10013
|
startDashboardServer: () => startDashboardServer
|
|
9619
10014
|
});
|
|
9620
10015
|
import { watch } from "fs";
|
|
9621
|
-
import { existsSync as
|
|
9622
|
-
import { basename as basename7, dirname as
|
|
10016
|
+
import { existsSync as existsSync30 } from "fs";
|
|
10017
|
+
import { basename as basename7, dirname as dirname12, join as join27, extname as extname2 } from "path";
|
|
9623
10018
|
|
|
9624
10019
|
class SSEManager {
|
|
9625
10020
|
clients = new Map;
|
|
@@ -9796,15 +10191,15 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
9796
10191
|
timestamp: new Date().toISOString()
|
|
9797
10192
|
});
|
|
9798
10193
|
});
|
|
9799
|
-
const __dir =
|
|
10194
|
+
const __dir = dirname12(new URL(import.meta.url).pathname);
|
|
9800
10195
|
let pkgRoot = __dir;
|
|
9801
|
-
while (pkgRoot !==
|
|
9802
|
-
if (
|
|
10196
|
+
while (pkgRoot !== dirname12(pkgRoot)) {
|
|
10197
|
+
if (existsSync30(join27(pkgRoot, "package.json")))
|
|
9803
10198
|
break;
|
|
9804
|
-
pkgRoot =
|
|
10199
|
+
pkgRoot = dirname12(pkgRoot);
|
|
9805
10200
|
}
|
|
9806
|
-
const dashboardOutDir =
|
|
9807
|
-
const dashboardBuilt =
|
|
10201
|
+
const dashboardOutDir = join27(pkgRoot, "dashboard", "out");
|
|
10202
|
+
const dashboardBuilt = existsSync30(join27(dashboardOutDir, "index.html"));
|
|
9808
10203
|
let clientIdCounter = 0;
|
|
9809
10204
|
if (!dashboardBuilt) {
|
|
9810
10205
|
console.warn("[mink] dashboard not built. Run: cd dashboard && bun run build");
|
|
@@ -9834,9 +10229,9 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
9834
10229
|
} else {
|
|
9835
10230
|
let filePath;
|
|
9836
10231
|
if (pathname === "/") {
|
|
9837
|
-
filePath =
|
|
10232
|
+
filePath = join27(dashboardOutDir, "index.html");
|
|
9838
10233
|
} else {
|
|
9839
|
-
filePath =
|
|
10234
|
+
filePath = join27(dashboardOutDir, pathname);
|
|
9840
10235
|
}
|
|
9841
10236
|
if (!filePath.startsWith(dashboardOutDir)) {
|
|
9842
10237
|
return jsonResponse({ error: "Forbidden" }, 403);
|
|
@@ -9849,7 +10244,7 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
9849
10244
|
const htmlServed = await serveFile(filePath + ".html", "text/html; charset=utf-8");
|
|
9850
10245
|
if (htmlServed)
|
|
9851
10246
|
return htmlServed;
|
|
9852
|
-
const indexServed = await serveFile(
|
|
10247
|
+
const indexServed = await serveFile(join27(dashboardOutDir, "index.html"), "text/html; charset=utf-8");
|
|
9853
10248
|
if (indexServed)
|
|
9854
10249
|
return indexServed;
|
|
9855
10250
|
}
|
|
@@ -9958,7 +10353,7 @@ retry: 3000
|
|
|
9958
10353
|
if (!filename || filename.includes("..") || filename.includes("/")) {
|
|
9959
10354
|
return jsonResponse({ error: "Invalid filename" }, 400);
|
|
9960
10355
|
}
|
|
9961
|
-
const imgPath =
|
|
10356
|
+
const imgPath = join27(designCapturesDir(resolvedCwd), filename);
|
|
9962
10357
|
const served = await serveFile(imgPath, "image/jpeg");
|
|
9963
10358
|
if (served) {
|
|
9964
10359
|
served.headers.set("Cache-Control", "public, max-age=60");
|
|
@@ -10193,9 +10588,9 @@ __export(exports_dashboard, {
|
|
|
10193
10588
|
resolveStartupCwd: () => resolveStartupCwd,
|
|
10194
10589
|
dashboard: () => dashboard
|
|
10195
10590
|
});
|
|
10196
|
-
import { existsSync as
|
|
10591
|
+
import { existsSync as existsSync31 } from "fs";
|
|
10197
10592
|
function resolveStartupCwd(cwd, registered = listRegisteredProjects()) {
|
|
10198
|
-
if (
|
|
10593
|
+
if (existsSync31(projectDir(cwd))) {
|
|
10199
10594
|
return { kind: "active", cwd };
|
|
10200
10595
|
}
|
|
10201
10596
|
if (registered.length === 0) {
|
|
@@ -10232,10 +10627,10 @@ var init_dashboard = __esm(() => {
|
|
|
10232
10627
|
});
|
|
10233
10628
|
|
|
10234
10629
|
// src/core/daemon-service.ts
|
|
10235
|
-
import { execSync as
|
|
10236
|
-
import { existsSync as
|
|
10237
|
-
import { homedir as
|
|
10238
|
-
import { dirname as
|
|
10630
|
+
import { execSync as execSync8 } from "child_process";
|
|
10631
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync15, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "fs";
|
|
10632
|
+
import { homedir as homedir4 } from "os";
|
|
10633
|
+
import { dirname as dirname13, join as join28 } from "path";
|
|
10239
10634
|
function detectPlatform() {
|
|
10240
10635
|
if (process.platform === "linux")
|
|
10241
10636
|
return "systemd";
|
|
@@ -10245,11 +10640,11 @@ function detectPlatform() {
|
|
|
10245
10640
|
}
|
|
10246
10641
|
function resolveServiceInvocation() {
|
|
10247
10642
|
const entry = process.argv[1];
|
|
10248
|
-
if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) &&
|
|
10643
|
+
if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) && existsSync32(entry)) {
|
|
10249
10644
|
return {
|
|
10250
10645
|
executable: entry,
|
|
10251
10646
|
args: ["daemon", "start"],
|
|
10252
|
-
pathDir:
|
|
10647
|
+
pathDir: dirname13(entry)
|
|
10253
10648
|
};
|
|
10254
10649
|
}
|
|
10255
10650
|
const cliPath = resolveCliPath();
|
|
@@ -10257,17 +10652,17 @@ function resolveServiceInvocation() {
|
|
|
10257
10652
|
return {
|
|
10258
10653
|
executable: interpreter,
|
|
10259
10654
|
args: [cliPath, "daemon", "start"],
|
|
10260
|
-
pathDir:
|
|
10655
|
+
pathDir: dirname13(interpreter)
|
|
10261
10656
|
};
|
|
10262
10657
|
}
|
|
10263
10658
|
function servicePaths(platform2) {
|
|
10264
|
-
const home =
|
|
10659
|
+
const home = homedir4();
|
|
10265
10660
|
if (platform2 === "systemd") {
|
|
10266
|
-
const unitDir2 =
|
|
10267
|
-
return { unitDir: unitDir2, unitFile:
|
|
10661
|
+
const unitDir2 = join28(home, ".config", "systemd", "user");
|
|
10662
|
+
return { unitDir: unitDir2, unitFile: join28(unitDir2, "mink-daemon.service") };
|
|
10268
10663
|
}
|
|
10269
|
-
const unitDir =
|
|
10270
|
-
return { unitDir, unitFile:
|
|
10664
|
+
const unitDir = join28(home, "Library", "LaunchAgents");
|
|
10665
|
+
return { unitDir, unitFile: join28(unitDir, "com.mink.daemon.plist") };
|
|
10271
10666
|
}
|
|
10272
10667
|
function renderSystemdUnit(inv) {
|
|
10273
10668
|
const execStart = [inv.executable, ...inv.args].join(" ");
|
|
@@ -10341,17 +10736,17 @@ function installService(options = {}) {
|
|
|
10341
10736
|
process.exit(1);
|
|
10342
10737
|
}
|
|
10343
10738
|
const paths = servicePaths(platform2);
|
|
10344
|
-
if (
|
|
10739
|
+
if (existsSync32(paths.unitFile) && !options.force) {
|
|
10345
10740
|
console.error(`[mink] unit file already exists: ${paths.unitFile}`);
|
|
10346
10741
|
console.error(" re-run with --force to overwrite, or run `mink daemon uninstall` first");
|
|
10347
10742
|
process.exit(1);
|
|
10348
10743
|
}
|
|
10349
10744
|
const inv = resolveServiceInvocation();
|
|
10350
|
-
|
|
10745
|
+
mkdirSync15(paths.unitDir, { recursive: true });
|
|
10351
10746
|
if (platform2 === "systemd") {
|
|
10352
10747
|
writeFileSync10(paths.unitFile, renderSystemdUnit(inv));
|
|
10353
10748
|
try {
|
|
10354
|
-
|
|
10749
|
+
execSync8("systemctl --user daemon-reload", { stdio: "ignore" });
|
|
10355
10750
|
} catch {}
|
|
10356
10751
|
console.log(`[mink] wrote ${paths.unitFile}`);
|
|
10357
10752
|
console.log("[mink] next steps:");
|
|
@@ -10374,24 +10769,24 @@ function uninstallService() {
|
|
|
10374
10769
|
process.exit(1);
|
|
10375
10770
|
}
|
|
10376
10771
|
const paths = servicePaths(platform2);
|
|
10377
|
-
if (!
|
|
10772
|
+
if (!existsSync32(paths.unitFile)) {
|
|
10378
10773
|
console.log(`[mink] no unit file at ${paths.unitFile} \u2014 nothing to uninstall`);
|
|
10379
10774
|
return;
|
|
10380
10775
|
}
|
|
10381
10776
|
if (platform2 === "systemd") {
|
|
10382
10777
|
try {
|
|
10383
|
-
|
|
10778
|
+
execSync8("systemctl --user disable --now mink-daemon.service", {
|
|
10384
10779
|
stdio: "ignore"
|
|
10385
10780
|
});
|
|
10386
10781
|
} catch {}
|
|
10387
10782
|
unlinkSync5(paths.unitFile);
|
|
10388
10783
|
try {
|
|
10389
|
-
|
|
10784
|
+
execSync8("systemctl --user daemon-reload", { stdio: "ignore" });
|
|
10390
10785
|
} catch {}
|
|
10391
10786
|
console.log(`[mink] removed ${paths.unitFile}`);
|
|
10392
10787
|
} else {
|
|
10393
10788
|
try {
|
|
10394
|
-
|
|
10789
|
+
execSync8(`launchctl unload -w ${paths.unitFile}`, { stdio: "ignore" });
|
|
10395
10790
|
} catch {}
|
|
10396
10791
|
unlinkSync5(paths.unitFile);
|
|
10397
10792
|
console.log(`[mink] removed ${paths.unitFile}`);
|
|
@@ -10406,7 +10801,7 @@ var exports_daemon = {};
|
|
|
10406
10801
|
__export(exports_daemon, {
|
|
10407
10802
|
daemon: () => daemon
|
|
10408
10803
|
});
|
|
10409
|
-
import { readFileSync as readFileSync24, existsSync as
|
|
10804
|
+
import { readFileSync as readFileSync24, existsSync as existsSync33 } from "fs";
|
|
10410
10805
|
async function daemon(cwd, args) {
|
|
10411
10806
|
const subcommand = args[0];
|
|
10412
10807
|
switch (subcommand) {
|
|
@@ -10422,7 +10817,7 @@ async function daemon(cwd, args) {
|
|
|
10422
10817
|
break;
|
|
10423
10818
|
case "logs": {
|
|
10424
10819
|
const logPath = schedulerLogPath();
|
|
10425
|
-
if (!
|
|
10820
|
+
if (!existsSync33(logPath)) {
|
|
10426
10821
|
console.log("[mink] no log file found");
|
|
10427
10822
|
return;
|
|
10428
10823
|
}
|
|
@@ -10694,13 +11089,13 @@ function printValidKeys() {
|
|
|
10694
11089
|
}
|
|
10695
11090
|
}
|
|
10696
11091
|
function readLineFromStdin() {
|
|
10697
|
-
return new Promise((
|
|
11092
|
+
return new Promise((resolve8) => {
|
|
10698
11093
|
const chunks = [];
|
|
10699
11094
|
process.stdin.resume();
|
|
10700
11095
|
process.stdin.setEncoding("utf-8");
|
|
10701
11096
|
process.stdin.once("data", (data) => {
|
|
10702
11097
|
process.stdin.pause();
|
|
10703
|
-
|
|
11098
|
+
resolve8(String(data).trim());
|
|
10704
11099
|
});
|
|
10705
11100
|
});
|
|
10706
11101
|
}
|
|
@@ -10775,7 +11170,7 @@ var exports_update = {};
|
|
|
10775
11170
|
__export(exports_update, {
|
|
10776
11171
|
update: () => update
|
|
10777
11172
|
});
|
|
10778
|
-
import { resolve as
|
|
11173
|
+
import { resolve as resolve8 } from "path";
|
|
10779
11174
|
function parseArgs(args) {
|
|
10780
11175
|
let dryRun = false;
|
|
10781
11176
|
let project = null;
|
|
@@ -10833,7 +11228,7 @@ async function update(cwd, args) {
|
|
|
10833
11228
|
}
|
|
10834
11229
|
const backupName = createBackup(target.cwd);
|
|
10835
11230
|
console.log(` backup: ${backupName}`);
|
|
10836
|
-
const settingsPath =
|
|
11231
|
+
const settingsPath = resolve8(target.cwd, ".claude", "settings.json");
|
|
10837
11232
|
mergeHooksIntoSettings(settingsPath, newHooks);
|
|
10838
11233
|
console.log(" hooks: updated");
|
|
10839
11234
|
const metaPath = projectMetaPath(target.cwd);
|
|
@@ -11009,7 +11404,7 @@ var init_restore = __esm(() => {
|
|
|
11009
11404
|
|
|
11010
11405
|
// src/core/design-eval/server-detect.ts
|
|
11011
11406
|
import { readFileSync as readFileSync25 } from "fs";
|
|
11012
|
-
import { join as
|
|
11407
|
+
import { join as join29 } from "path";
|
|
11013
11408
|
async function probePort(port) {
|
|
11014
11409
|
try {
|
|
11015
11410
|
const controller = new AbortController;
|
|
@@ -11031,7 +11426,7 @@ async function findRunningServer(ports = DEFAULT_PROBE_PORTS) {
|
|
|
11031
11426
|
}
|
|
11032
11427
|
function detectDevCommand(cwd) {
|
|
11033
11428
|
try {
|
|
11034
|
-
const raw = readFileSync25(
|
|
11429
|
+
const raw = readFileSync25(join29(cwd, "package.json"), "utf-8");
|
|
11035
11430
|
const pkg = JSON.parse(raw);
|
|
11036
11431
|
const scripts = pkg.scripts;
|
|
11037
11432
|
if (!scripts || typeof scripts !== "object")
|
|
@@ -11051,10 +11446,10 @@ var init_server_detect = __esm(() => {
|
|
|
11051
11446
|
});
|
|
11052
11447
|
|
|
11053
11448
|
// src/core/design-eval/route-detect.ts
|
|
11054
|
-
import { existsSync as
|
|
11055
|
-
import { join as
|
|
11449
|
+
import { existsSync as existsSync34, readdirSync as readdirSync10, statSync as statSync11 } from "fs";
|
|
11450
|
+
import { join as join30, relative as relative7, sep as sep2 } from "path";
|
|
11056
11451
|
function detectFramework(cwd) {
|
|
11057
|
-
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) =>
|
|
11452
|
+
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync34(join30(cwd, `${name}.${ext}`))) || existsSync34(join30(cwd, name));
|
|
11058
11453
|
if (has("next.config"))
|
|
11059
11454
|
return "nextjs";
|
|
11060
11455
|
if (has("svelte.config"))
|
|
@@ -11079,8 +11474,8 @@ function detectRoutes(cwd) {
|
|
|
11079
11474
|
}
|
|
11080
11475
|
function detectNextRoutes(cwd) {
|
|
11081
11476
|
const routes = [];
|
|
11082
|
-
const appDir =
|
|
11083
|
-
if (
|
|
11477
|
+
const appDir = join30(cwd, "app");
|
|
11478
|
+
if (existsSync34(appDir)) {
|
|
11084
11479
|
const pageFiles = findFiles(appDir, /^page\.(tsx?|jsx?)$/);
|
|
11085
11480
|
for (const file of pageFiles) {
|
|
11086
11481
|
const rel = relative7(appDir, file);
|
|
@@ -11091,8 +11486,8 @@ function detectNextRoutes(cwd) {
|
|
|
11091
11486
|
routes.push(route);
|
|
11092
11487
|
}
|
|
11093
11488
|
}
|
|
11094
|
-
const pagesDir =
|
|
11095
|
-
if (
|
|
11489
|
+
const pagesDir = join30(cwd, "pages");
|
|
11490
|
+
if (existsSync34(pagesDir)) {
|
|
11096
11491
|
const pageFiles = findFiles(pagesDir, /\.(tsx?|jsx?)$/);
|
|
11097
11492
|
for (const file of pageFiles) {
|
|
11098
11493
|
const rel = relative7(pagesDir, file);
|
|
@@ -11111,8 +11506,8 @@ function detectNextRoutes(cwd) {
|
|
|
11111
11506
|
return unique.length > 0 ? unique.sort() : ["/"];
|
|
11112
11507
|
}
|
|
11113
11508
|
function detectSvelteKitRoutes(cwd) {
|
|
11114
|
-
const routesDir =
|
|
11115
|
-
if (!
|
|
11509
|
+
const routesDir = join30(cwd, "src", "routes");
|
|
11510
|
+
if (!existsSync34(routesDir))
|
|
11116
11511
|
return ["/"];
|
|
11117
11512
|
const routes = [];
|
|
11118
11513
|
const pageFiles = findFiles(routesDir, /^\+page\.svelte$/);
|
|
@@ -11127,8 +11522,8 @@ function detectSvelteKitRoutes(cwd) {
|
|
|
11127
11522
|
return routes.length > 0 ? routes.sort() : ["/"];
|
|
11128
11523
|
}
|
|
11129
11524
|
function detectNuxtRoutes(cwd) {
|
|
11130
|
-
const pagesDir =
|
|
11131
|
-
if (!
|
|
11525
|
+
const pagesDir = join30(cwd, "pages");
|
|
11526
|
+
if (!existsSync34(pagesDir))
|
|
11132
11527
|
return ["/"];
|
|
11133
11528
|
const routes = [];
|
|
11134
11529
|
const vueFiles = findFiles(pagesDir, /\.vue$/);
|
|
@@ -11154,7 +11549,7 @@ function findFiles(dir, pattern) {
|
|
|
11154
11549
|
for (const entry of entries) {
|
|
11155
11550
|
if (entry.startsWith(".") || entry === "node_modules")
|
|
11156
11551
|
continue;
|
|
11157
|
-
const full =
|
|
11552
|
+
const full = join30(current, entry);
|
|
11158
11553
|
try {
|
|
11159
11554
|
const stat2 = statSync11(full);
|
|
11160
11555
|
if (stat2.isDirectory()) {
|
|
@@ -11182,11 +11577,11 @@ function __extends(d, b) {
|
|
|
11182
11577
|
}
|
|
11183
11578
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
11184
11579
|
function adopt(value) {
|
|
11185
|
-
return value instanceof P ? value : new P(function(
|
|
11186
|
-
|
|
11580
|
+
return value instanceof P ? value : new P(function(resolve9) {
|
|
11581
|
+
resolve9(value);
|
|
11187
11582
|
});
|
|
11188
11583
|
}
|
|
11189
|
-
return new (P || (P = Promise))(function(
|
|
11584
|
+
return new (P || (P = Promise))(function(resolve9, reject) {
|
|
11190
11585
|
function fulfilled(value) {
|
|
11191
11586
|
try {
|
|
11192
11587
|
step(generator.next(value));
|
|
@@ -11202,7 +11597,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
11202
11597
|
}
|
|
11203
11598
|
}
|
|
11204
11599
|
function step(result) {
|
|
11205
|
-
result.done ?
|
|
11600
|
+
result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
11206
11601
|
}
|
|
11207
11602
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11208
11603
|
});
|
|
@@ -11385,14 +11780,14 @@ function __asyncValues(o) {
|
|
|
11385
11780
|
}, i);
|
|
11386
11781
|
function verb(n) {
|
|
11387
11782
|
i[n] = o[n] && function(v) {
|
|
11388
|
-
return new Promise(function(
|
|
11389
|
-
v = o[n](v), settle(
|
|
11783
|
+
return new Promise(function(resolve9, reject) {
|
|
11784
|
+
v = o[n](v), settle(resolve9, reject, v.done, v.value);
|
|
11390
11785
|
});
|
|
11391
11786
|
};
|
|
11392
11787
|
}
|
|
11393
|
-
function settle(
|
|
11788
|
+
function settle(resolve9, reject, d, v) {
|
|
11394
11789
|
Promise.resolve(v).then(function(v2) {
|
|
11395
|
-
|
|
11790
|
+
resolve9({ value: v2, done: d });
|
|
11396
11791
|
}, reject);
|
|
11397
11792
|
}
|
|
11398
11793
|
}
|
|
@@ -11923,7 +12318,7 @@ function of() {
|
|
|
11923
12318
|
}
|
|
11924
12319
|
function lastValueFrom(source, config22) {
|
|
11925
12320
|
var hasConfig = typeof config22 === "object";
|
|
11926
|
-
return new Promise(function(
|
|
12321
|
+
return new Promise(function(resolve9, reject) {
|
|
11927
12322
|
var _hasValue = false;
|
|
11928
12323
|
var _value;
|
|
11929
12324
|
source.subscribe({
|
|
@@ -11934,9 +12329,9 @@ function lastValueFrom(source, config22) {
|
|
|
11934
12329
|
error: reject,
|
|
11935
12330
|
complete: function() {
|
|
11936
12331
|
if (_hasValue) {
|
|
11937
|
-
|
|
12332
|
+
resolve9(_value);
|
|
11938
12333
|
} else if (hasConfig) {
|
|
11939
|
-
|
|
12334
|
+
resolve9(config22.defaultValue);
|
|
11940
12335
|
} else {
|
|
11941
12336
|
reject(new EmptyError);
|
|
11942
12337
|
}
|
|
@@ -11946,16 +12341,16 @@ function lastValueFrom(source, config22) {
|
|
|
11946
12341
|
}
|
|
11947
12342
|
function firstValueFrom(source, config22) {
|
|
11948
12343
|
var hasConfig = typeof config22 === "object";
|
|
11949
|
-
return new Promise(function(
|
|
12344
|
+
return new Promise(function(resolve9, reject) {
|
|
11950
12345
|
var subscriber = new SafeSubscriber({
|
|
11951
12346
|
next: function(value) {
|
|
11952
|
-
|
|
12347
|
+
resolve9(value);
|
|
11953
12348
|
subscriber.unsubscribe();
|
|
11954
12349
|
},
|
|
11955
12350
|
error: reject,
|
|
11956
12351
|
complete: function() {
|
|
11957
12352
|
if (hasConfig) {
|
|
11958
|
-
|
|
12353
|
+
resolve9(config22.defaultValue);
|
|
11959
12354
|
} else {
|
|
11960
12355
|
reject(new EmptyError);
|
|
11961
12356
|
}
|
|
@@ -13007,7 +13402,7 @@ var init_rxjs = __esm(() => {
|
|
|
13007
13402
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
13008
13403
|
var _this = this;
|
|
13009
13404
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
13010
|
-
return new promiseCtor(function(
|
|
13405
|
+
return new promiseCtor(function(resolve9, reject) {
|
|
13011
13406
|
var subscriber = new SafeSubscriber({
|
|
13012
13407
|
next: function(value) {
|
|
13013
13408
|
try {
|
|
@@ -13018,7 +13413,7 @@ var init_rxjs = __esm(() => {
|
|
|
13018
13413
|
}
|
|
13019
13414
|
},
|
|
13020
13415
|
error: reject,
|
|
13021
|
-
complete:
|
|
13416
|
+
complete: resolve9
|
|
13022
13417
|
});
|
|
13023
13418
|
_this.subscribe(subscriber);
|
|
13024
13419
|
});
|
|
@@ -13040,14 +13435,14 @@ var init_rxjs = __esm(() => {
|
|
|
13040
13435
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
13041
13436
|
var _this = this;
|
|
13042
13437
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
13043
|
-
return new promiseCtor(function(
|
|
13438
|
+
return new promiseCtor(function(resolve9, reject) {
|
|
13044
13439
|
var value;
|
|
13045
13440
|
_this.subscribe(function(x) {
|
|
13046
13441
|
return value = x;
|
|
13047
13442
|
}, function(err) {
|
|
13048
13443
|
return reject(err);
|
|
13049
13444
|
}, function() {
|
|
13050
|
-
return
|
|
13445
|
+
return resolve9(value);
|
|
13051
13446
|
});
|
|
13052
13447
|
});
|
|
13053
13448
|
};
|
|
@@ -14973,8 +15368,8 @@ class Deferred {
|
|
|
14973
15368
|
#isRejected = false;
|
|
14974
15369
|
#value;
|
|
14975
15370
|
#resolve;
|
|
14976
|
-
#taskPromise = new Promise((
|
|
14977
|
-
this.#resolve =
|
|
15371
|
+
#taskPromise = new Promise((resolve9) => {
|
|
15372
|
+
this.#resolve = resolve9;
|
|
14978
15373
|
});
|
|
14979
15374
|
#timeoutId;
|
|
14980
15375
|
#timeoutError;
|
|
@@ -15063,12 +15458,12 @@ var init_Mutex = __esm(() => {
|
|
|
15063
15458
|
return new Mutex.Guard(this, onRelease);
|
|
15064
15459
|
}
|
|
15065
15460
|
release() {
|
|
15066
|
-
const
|
|
15067
|
-
if (!
|
|
15461
|
+
const resolve9 = this.#acquirers.shift();
|
|
15462
|
+
if (!resolve9) {
|
|
15068
15463
|
this.#locked = false;
|
|
15069
15464
|
return;
|
|
15070
15465
|
}
|
|
15071
|
-
|
|
15466
|
+
resolve9();
|
|
15072
15467
|
}
|
|
15073
15468
|
};
|
|
15074
15469
|
});
|
|
@@ -16812,12 +17207,12 @@ var init_locators = __esm(() => {
|
|
|
16812
17207
|
}
|
|
16813
17208
|
return defer(() => {
|
|
16814
17209
|
return from(handle.evaluate((element) => {
|
|
16815
|
-
return new Promise((
|
|
17210
|
+
return new Promise((resolve9) => {
|
|
16816
17211
|
window.requestAnimationFrame(() => {
|
|
16817
17212
|
const rect1 = element.getBoundingClientRect();
|
|
16818
17213
|
window.requestAnimationFrame(() => {
|
|
16819
17214
|
const rect2 = element.getBoundingClientRect();
|
|
16820
|
-
|
|
17215
|
+
resolve9([
|
|
16821
17216
|
{
|
|
16822
17217
|
x: rect1.x,
|
|
16823
17218
|
y: rect1.y,
|
|
@@ -18108,9 +18503,9 @@ var init_ElementHandle = __esm(() => {
|
|
|
18108
18503
|
const handle = await this.#asSVGElementHandle();
|
|
18109
18504
|
const target = __addDisposableResource6(env_5, handle && await handle.#getOwnerSVGElement(), false);
|
|
18110
18505
|
return await (target ?? this).evaluate(async (element, threshold) => {
|
|
18111
|
-
const visibleRatio = await new Promise((
|
|
18506
|
+
const visibleRatio = await new Promise((resolve9) => {
|
|
18112
18507
|
const observer = new IntersectionObserver((entries) => {
|
|
18113
|
-
|
|
18508
|
+
resolve9(entries[0].intersectionRatio);
|
|
18114
18509
|
observer.disconnect();
|
|
18115
18510
|
});
|
|
18116
18511
|
observer.observe(element);
|
|
@@ -18504,7 +18899,7 @@ var init_Frame = __esm(() => {
|
|
|
18504
18899
|
}
|
|
18505
18900
|
type = type ?? "text/javascript";
|
|
18506
18901
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, id, type: type2, content: content2 }) => {
|
|
18507
|
-
return await new Promise((
|
|
18902
|
+
return await new Promise((resolve9, reject) => {
|
|
18508
18903
|
const script = document.createElement("script");
|
|
18509
18904
|
script.type = type2;
|
|
18510
18905
|
script.text = content2;
|
|
@@ -18517,12 +18912,12 @@ var init_Frame = __esm(() => {
|
|
|
18517
18912
|
if (url) {
|
|
18518
18913
|
script.src = url;
|
|
18519
18914
|
script.addEventListener("load", () => {
|
|
18520
|
-
|
|
18915
|
+
resolve9(script);
|
|
18521
18916
|
}, { once: true });
|
|
18522
18917
|
document.head.appendChild(script);
|
|
18523
18918
|
} else {
|
|
18524
18919
|
document.head.appendChild(script);
|
|
18525
|
-
|
|
18920
|
+
resolve9(script);
|
|
18526
18921
|
}
|
|
18527
18922
|
});
|
|
18528
18923
|
}, { ...options, type, content }));
|
|
@@ -18539,7 +18934,7 @@ var init_Frame = __esm(() => {
|
|
|
18539
18934
|
options.content = content;
|
|
18540
18935
|
}
|
|
18541
18936
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, content: content2 }) => {
|
|
18542
|
-
return await new Promise((
|
|
18937
|
+
return await new Promise((resolve9, reject) => {
|
|
18543
18938
|
let element;
|
|
18544
18939
|
if (!url) {
|
|
18545
18940
|
element = document.createElement("style");
|
|
@@ -18551,7 +18946,7 @@ var init_Frame = __esm(() => {
|
|
|
18551
18946
|
element = link;
|
|
18552
18947
|
}
|
|
18553
18948
|
element.addEventListener("load", () => {
|
|
18554
|
-
|
|
18949
|
+
resolve9(element);
|
|
18555
18950
|
}, { once: true });
|
|
18556
18951
|
element.addEventListener("error", (event) => {
|
|
18557
18952
|
reject(new Error(event.message ?? "Could not load style"));
|
|
@@ -19405,9 +19800,9 @@ var init_Page = __esm(() => {
|
|
|
19405
19800
|
++this.#screencastSessionCount;
|
|
19406
19801
|
if (!this.#startScreencastPromise) {
|
|
19407
19802
|
this.#startScreencastPromise = this.mainFrame().client.send("Page.startScreencast", { format: "png" }).then(() => {
|
|
19408
|
-
return new Promise((
|
|
19803
|
+
return new Promise((resolve9) => {
|
|
19409
19804
|
return this.mainFrame().client.once("Page.screencastFrame", () => {
|
|
19410
|
-
return
|
|
19805
|
+
return resolve9();
|
|
19411
19806
|
});
|
|
19412
19807
|
});
|
|
19413
19808
|
});
|
|
@@ -22065,11 +22460,11 @@ function addPageBinding(type, name, prefix) {
|
|
|
22065
22460
|
return value instanceof Node;
|
|
22066
22461
|
})
|
|
22067
22462
|
}));
|
|
22068
|
-
return new Promise((
|
|
22463
|
+
return new Promise((resolve9, reject) => {
|
|
22069
22464
|
callPuppeteer.callbacks.set(seq, {
|
|
22070
22465
|
resolve(value) {
|
|
22071
22466
|
callPuppeteer.args.delete(seq);
|
|
22072
|
-
|
|
22467
|
+
resolve9(value);
|
|
22073
22468
|
},
|
|
22074
22469
|
reject(value) {
|
|
22075
22470
|
callPuppeteer.args.delete(seq);
|
|
@@ -25532,8 +25927,8 @@ var init_Input2 = __esm(() => {
|
|
|
25532
25927
|
if (typeof delay === "number") {
|
|
25533
25928
|
await Promise.all(actions);
|
|
25534
25929
|
actions.length = 0;
|
|
25535
|
-
await new Promise((
|
|
25536
|
-
setTimeout(
|
|
25930
|
+
await new Promise((resolve9) => {
|
|
25931
|
+
setTimeout(resolve9, delay);
|
|
25537
25932
|
});
|
|
25538
25933
|
}
|
|
25539
25934
|
actions.push(this.up({ ...options, clickCount }));
|
|
@@ -25553,9 +25948,9 @@ var init_Input2 = __esm(() => {
|
|
|
25553
25948
|
});
|
|
25554
25949
|
}
|
|
25555
25950
|
async drag(start, target) {
|
|
25556
|
-
const promise = new Promise((
|
|
25951
|
+
const promise = new Promise((resolve9) => {
|
|
25557
25952
|
this.#client.once("Input.dragIntercepted", (event) => {
|
|
25558
|
-
return
|
|
25953
|
+
return resolve9(event.data);
|
|
25559
25954
|
});
|
|
25560
25955
|
});
|
|
25561
25956
|
await this.move(start.x, start.y);
|
|
@@ -25596,8 +25991,8 @@ var init_Input2 = __esm(() => {
|
|
|
25596
25991
|
await this.dragEnter(target, data);
|
|
25597
25992
|
await this.dragOver(target, data);
|
|
25598
25993
|
if (delay) {
|
|
25599
|
-
await new Promise((
|
|
25600
|
-
return setTimeout(
|
|
25994
|
+
await new Promise((resolve9) => {
|
|
25995
|
+
return setTimeout(resolve9, delay);
|
|
25601
25996
|
});
|
|
25602
25997
|
}
|
|
25603
25998
|
await this.drop(target, data);
|
|
@@ -26409,9 +26804,9 @@ var init_Page2 = __esm(() => {
|
|
|
26409
26804
|
async captureHeapSnapshot(options) {
|
|
26410
26805
|
const { createWriteStream } = environment.value.fs;
|
|
26411
26806
|
const stream = createWriteStream(options.path);
|
|
26412
|
-
const streamPromise = new Promise((
|
|
26807
|
+
const streamPromise = new Promise((resolve9, reject) => {
|
|
26413
26808
|
stream.on("error", reject);
|
|
26414
|
-
stream.on("finish",
|
|
26809
|
+
stream.on("finish", resolve9);
|
|
26415
26810
|
});
|
|
26416
26811
|
const client = this.#primaryTargetClient;
|
|
26417
26812
|
await client.send("HeapProfiler.enable");
|
|
@@ -27924,10 +28319,10 @@ __export(exports_BrowserWebSocketTransport, {
|
|
|
27924
28319
|
|
|
27925
28320
|
class BrowserWebSocketTransport {
|
|
27926
28321
|
static create(url) {
|
|
27927
|
-
return new Promise((
|
|
28322
|
+
return new Promise((resolve9, reject) => {
|
|
27928
28323
|
const ws = new WebSocket(url);
|
|
27929
28324
|
ws.addEventListener("open", () => {
|
|
27930
|
-
return
|
|
28325
|
+
return resolve9(new BrowserWebSocketTransport(ws));
|
|
27931
28326
|
});
|
|
27932
28327
|
ws.addEventListener("error", reject);
|
|
27933
28328
|
});
|
|
@@ -30761,11 +31156,11 @@ var require_BrowsingContextProcessor = __commonJS((exports) => {
|
|
|
30761
31156
|
}
|
|
30762
31157
|
const parentCdpClient = context2.cdpTarget.parentCdpClient;
|
|
30763
31158
|
try {
|
|
30764
|
-
const detachedFromTargetPromise = new Promise((
|
|
31159
|
+
const detachedFromTargetPromise = new Promise((resolve9) => {
|
|
30765
31160
|
const onContextDestroyed = (event) => {
|
|
30766
31161
|
if (event.targetId === params.context) {
|
|
30767
31162
|
parentCdpClient.off("Target.detachedFromTarget", onContextDestroyed);
|
|
30768
|
-
|
|
31163
|
+
resolve9();
|
|
30769
31164
|
}
|
|
30770
31165
|
};
|
|
30771
31166
|
parentCdpClient.on("Target.detachedFromTarget", onContextDestroyed);
|
|
@@ -32085,7 +32480,7 @@ var require_ActionDispatcher = __commonJS((exports) => {
|
|
|
32085
32480
|
}
|
|
32086
32481
|
}
|
|
32087
32482
|
const promises = [
|
|
32088
|
-
new Promise((
|
|
32483
|
+
new Promise((resolve9) => setTimeout(resolve9, this.#tickDuration))
|
|
32089
32484
|
];
|
|
32090
32485
|
for (const option of options) {
|
|
32091
32486
|
promises.push(this.#dispatchAction(option));
|
|
@@ -32684,8 +33079,8 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
32684
33079
|
acquire() {
|
|
32685
33080
|
const state = { resolved: false };
|
|
32686
33081
|
if (this.#locked) {
|
|
32687
|
-
return new Promise((
|
|
32688
|
-
this.#acquirers.push(() =>
|
|
33082
|
+
return new Promise((resolve9) => {
|
|
33083
|
+
this.#acquirers.push(() => resolve9(this.#release.bind(this, state)));
|
|
32689
33084
|
});
|
|
32690
33085
|
}
|
|
32691
33086
|
this.#locked = true;
|
|
@@ -32696,12 +33091,12 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
32696
33091
|
throw new Error("Cannot release more than once.");
|
|
32697
33092
|
}
|
|
32698
33093
|
state.resolved = true;
|
|
32699
|
-
const
|
|
32700
|
-
if (!
|
|
33094
|
+
const resolve9 = this.#acquirers.shift();
|
|
33095
|
+
if (!resolve9) {
|
|
32701
33096
|
this.#locked = false;
|
|
32702
33097
|
return;
|
|
32703
33098
|
}
|
|
32704
|
-
|
|
33099
|
+
resolve9();
|
|
32705
33100
|
}
|
|
32706
33101
|
async run(action) {
|
|
32707
33102
|
const release = await this.acquire();
|
|
@@ -33828,8 +34223,8 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
33828
34223
|
let queueNonEmptyResolver = null;
|
|
33829
34224
|
return {
|
|
33830
34225
|
async getMessage() {
|
|
33831
|
-
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((
|
|
33832
|
-
queueNonEmptyResolver =
|
|
34226
|
+
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve9) => {
|
|
34227
|
+
queueNonEmptyResolver = resolve9;
|
|
33833
34228
|
});
|
|
33834
34229
|
await onMessage;
|
|
33835
34230
|
return queue.shift();
|
|
@@ -33915,7 +34310,7 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
33915
34310
|
functionDeclaration: String((id) => {
|
|
33916
34311
|
const w = window;
|
|
33917
34312
|
if (w[id] === undefined) {
|
|
33918
|
-
return new Promise((
|
|
34313
|
+
return new Promise((resolve9) => w[id] = resolve9);
|
|
33919
34314
|
}
|
|
33920
34315
|
const channelProxy = w[id];
|
|
33921
34316
|
delete w[id];
|
|
@@ -35266,8 +35661,8 @@ var require_Deferred = __commonJS((exports) => {
|
|
|
35266
35661
|
return this.#result;
|
|
35267
35662
|
}
|
|
35268
35663
|
constructor() {
|
|
35269
|
-
this.#promise = new Promise((
|
|
35270
|
-
this.#resolve =
|
|
35664
|
+
this.#promise = new Promise((resolve9, reject) => {
|
|
35665
|
+
this.#resolve = resolve9;
|
|
35271
35666
|
this.#reject = reject;
|
|
35272
35667
|
});
|
|
35273
35668
|
this.#promise.catch((_error) => {});
|
|
@@ -39592,11 +39987,11 @@ var require_BrowsingContextStorage = __commonJS((exports) => {
|
|
|
39592
39987
|
if (this.#contexts.has(browsingContextId)) {
|
|
39593
39988
|
return Promise.resolve(this.getContext(browsingContextId));
|
|
39594
39989
|
}
|
|
39595
|
-
return new Promise((
|
|
39990
|
+
return new Promise((resolve9) => {
|
|
39596
39991
|
const listener = (event) => {
|
|
39597
39992
|
if (event.browsingContext.id === browsingContextId) {
|
|
39598
39993
|
this.#eventEmitter.off("added", listener);
|
|
39599
|
-
|
|
39994
|
+
resolve9(event.browsingContext);
|
|
39600
39995
|
}
|
|
39601
39996
|
};
|
|
39602
39997
|
this.#eventEmitter.on("added", listener);
|
|
@@ -43092,8 +43487,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
43092
43487
|
const functionDeclaration = stringifyFunction(interpolateFunction((callback) => {
|
|
43093
43488
|
Object.assign(globalThis, {
|
|
43094
43489
|
[PLACEHOLDER("name")]: function(...args) {
|
|
43095
|
-
return new Promise((
|
|
43096
|
-
callback([
|
|
43490
|
+
return new Promise((resolve9, reject) => {
|
|
43491
|
+
callback([resolve9, reject, args]);
|
|
43097
43492
|
});
|
|
43098
43493
|
}
|
|
43099
43494
|
});
|
|
@@ -43181,8 +43576,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
43181
43576
|
return;
|
|
43182
43577
|
}
|
|
43183
43578
|
try {
|
|
43184
|
-
await dataHandle.evaluate(([
|
|
43185
|
-
|
|
43579
|
+
await dataHandle.evaluate(([resolve9], result2) => {
|
|
43580
|
+
resolve9(result2);
|
|
43186
43581
|
}, result);
|
|
43187
43582
|
} catch (error) {
|
|
43188
43583
|
debugError(error);
|
|
@@ -47609,7 +48004,7 @@ import NodeWebSocket from "ws";
|
|
|
47609
48004
|
|
|
47610
48005
|
class NodeWebSocketTransport {
|
|
47611
48006
|
static create(url, headers) {
|
|
47612
|
-
return new Promise((
|
|
48007
|
+
return new Promise((resolve9, reject) => {
|
|
47613
48008
|
const ws = new NodeWebSocket(url, [], {
|
|
47614
48009
|
followRedirects: true,
|
|
47615
48010
|
perMessageDeflate: false,
|
|
@@ -47621,7 +48016,7 @@ class NodeWebSocketTransport {
|
|
|
47621
48016
|
}
|
|
47622
48017
|
});
|
|
47623
48018
|
ws.addEventListener("open", () => {
|
|
47624
|
-
return
|
|
48019
|
+
return resolve9(new NodeWebSocketTransport(ws));
|
|
47625
48020
|
});
|
|
47626
48021
|
ws.addEventListener("error", reject);
|
|
47627
48022
|
});
|
|
@@ -50511,8 +50906,8 @@ var require_helpers = __commonJS((exports) => {
|
|
|
50511
50906
|
function req(url, opts = {}) {
|
|
50512
50907
|
const href = typeof url === "string" ? url : url.href;
|
|
50513
50908
|
const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
50514
|
-
const promise = new Promise((
|
|
50515
|
-
req2.once("response",
|
|
50909
|
+
const promise = new Promise((resolve9, reject) => {
|
|
50910
|
+
req2.once("response", resolve9).once("error", reject).end();
|
|
50516
50911
|
});
|
|
50517
50912
|
req2.then = promise.then.bind(promise);
|
|
50518
50913
|
return req2;
|
|
@@ -50883,7 +51278,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
50883
51278
|
var debug_1 = __importDefault(require_src());
|
|
50884
51279
|
var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
50885
51280
|
function parseProxyResponse(socket) {
|
|
50886
|
-
return new Promise((
|
|
51281
|
+
return new Promise((resolve9, reject) => {
|
|
50887
51282
|
let buffersLength = 0;
|
|
50888
51283
|
const buffers = [];
|
|
50889
51284
|
function read() {
|
|
@@ -50952,7 +51347,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
50952
51347
|
}
|
|
50953
51348
|
debug2("got proxy server response: %o %o", firstLine, headers);
|
|
50954
51349
|
cleanup();
|
|
50955
|
-
|
|
51350
|
+
resolve9({
|
|
50956
51351
|
connect: {
|
|
50957
51352
|
statusCode,
|
|
50958
51353
|
statusText,
|
|
@@ -53056,11 +53451,11 @@ var require_receivebuffer = __commonJS((exports) => {
|
|
|
53056
53451
|
var require_socksclient = __commonJS((exports) => {
|
|
53057
53452
|
var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
53058
53453
|
function adopt(value) {
|
|
53059
|
-
return value instanceof P ? value : new P(function(
|
|
53060
|
-
|
|
53454
|
+
return value instanceof P ? value : new P(function(resolve9) {
|
|
53455
|
+
resolve9(value);
|
|
53061
53456
|
});
|
|
53062
53457
|
}
|
|
53063
|
-
return new (P || (P = Promise))(function(
|
|
53458
|
+
return new (P || (P = Promise))(function(resolve9, reject) {
|
|
53064
53459
|
function fulfilled(value) {
|
|
53065
53460
|
try {
|
|
53066
53461
|
step(generator.next(value));
|
|
@@ -53076,7 +53471,7 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
53076
53471
|
}
|
|
53077
53472
|
}
|
|
53078
53473
|
function step(result) {
|
|
53079
|
-
result.done ?
|
|
53474
|
+
result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
53080
53475
|
}
|
|
53081
53476
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
53082
53477
|
});
|
|
@@ -53103,13 +53498,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
53103
53498
|
this.setState(constants_1.SocksClientState.Created);
|
|
53104
53499
|
}
|
|
53105
53500
|
static createConnection(options, callback) {
|
|
53106
|
-
return new Promise((
|
|
53501
|
+
return new Promise((resolve9, reject) => {
|
|
53107
53502
|
try {
|
|
53108
53503
|
(0, helpers_1.validateSocksClientOptions)(options, ["connect"]);
|
|
53109
53504
|
} catch (err) {
|
|
53110
53505
|
if (typeof callback === "function") {
|
|
53111
53506
|
callback(err);
|
|
53112
|
-
return
|
|
53507
|
+
return resolve9(err);
|
|
53113
53508
|
} else {
|
|
53114
53509
|
return reject(err);
|
|
53115
53510
|
}
|
|
@@ -53120,16 +53515,16 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
53120
53515
|
client.removeAllListeners();
|
|
53121
53516
|
if (typeof callback === "function") {
|
|
53122
53517
|
callback(null, info);
|
|
53123
|
-
|
|
53518
|
+
resolve9(info);
|
|
53124
53519
|
} else {
|
|
53125
|
-
|
|
53520
|
+
resolve9(info);
|
|
53126
53521
|
}
|
|
53127
53522
|
});
|
|
53128
53523
|
client.once("error", (err) => {
|
|
53129
53524
|
client.removeAllListeners();
|
|
53130
53525
|
if (typeof callback === "function") {
|
|
53131
53526
|
callback(err);
|
|
53132
|
-
|
|
53527
|
+
resolve9(err);
|
|
53133
53528
|
} else {
|
|
53134
53529
|
reject(err);
|
|
53135
53530
|
}
|
|
@@ -53137,13 +53532,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
53137
53532
|
});
|
|
53138
53533
|
}
|
|
53139
53534
|
static createConnectionChain(options, callback) {
|
|
53140
|
-
return new Promise((
|
|
53535
|
+
return new Promise((resolve9, reject) => __awaiter2(this, undefined, undefined, function* () {
|
|
53141
53536
|
try {
|
|
53142
53537
|
(0, helpers_1.validateSocksClientChainOptions)(options);
|
|
53143
53538
|
} catch (err) {
|
|
53144
53539
|
if (typeof callback === "function") {
|
|
53145
53540
|
callback(err);
|
|
53146
|
-
return
|
|
53541
|
+
return resolve9(err);
|
|
53147
53542
|
} else {
|
|
53148
53543
|
return reject(err);
|
|
53149
53544
|
}
|
|
@@ -53169,14 +53564,14 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
53169
53564
|
}
|
|
53170
53565
|
if (typeof callback === "function") {
|
|
53171
53566
|
callback(null, { socket: sock });
|
|
53172
|
-
|
|
53567
|
+
resolve9({ socket: sock });
|
|
53173
53568
|
} else {
|
|
53174
|
-
|
|
53569
|
+
resolve9({ socket: sock });
|
|
53175
53570
|
}
|
|
53176
53571
|
} catch (err) {
|
|
53177
53572
|
if (typeof callback === "function") {
|
|
53178
53573
|
callback(err);
|
|
53179
|
-
|
|
53574
|
+
resolve9(err);
|
|
53180
53575
|
} else {
|
|
53181
53576
|
reject(err);
|
|
53182
53577
|
}
|
|
@@ -53776,12 +54171,12 @@ var require_dist4 = __commonJS((exports) => {
|
|
|
53776
54171
|
let { host } = opts;
|
|
53777
54172
|
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
53778
54173
|
if (shouldLookup) {
|
|
53779
|
-
host = await new Promise((
|
|
54174
|
+
host = await new Promise((resolve9, reject) => {
|
|
53780
54175
|
lookupFn(host, {}, (err, res) => {
|
|
53781
54176
|
if (err) {
|
|
53782
54177
|
reject(err);
|
|
53783
54178
|
} else {
|
|
53784
|
-
|
|
54179
|
+
resolve9(res);
|
|
53785
54180
|
}
|
|
53786
54181
|
});
|
|
53787
54182
|
});
|
|
@@ -54788,7 +55183,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
54788
55183
|
return `${socket.remoteAddress}:${socket.remotePort}`;
|
|
54789
55184
|
}
|
|
54790
55185
|
function upgradeSocket(socket, options) {
|
|
54791
|
-
return new Promise((
|
|
55186
|
+
return new Promise((resolve9, reject) => {
|
|
54792
55187
|
const tlsOptions = Object.assign({}, options, {
|
|
54793
55188
|
socket
|
|
54794
55189
|
});
|
|
@@ -54798,7 +55193,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
54798
55193
|
reject(tlsSocket.authorizationError);
|
|
54799
55194
|
} else {
|
|
54800
55195
|
tlsSocket.removeAllListeners("error");
|
|
54801
|
-
|
|
55196
|
+
resolve9(tlsSocket);
|
|
54802
55197
|
}
|
|
54803
55198
|
}).once("error", (error) => {
|
|
54804
55199
|
reject(error);
|
|
@@ -54890,7 +55285,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
54890
55285
|
};
|
|
54891
55286
|
}
|
|
54892
55287
|
function connectForPassiveTransfer(host, port, ftp) {
|
|
54893
|
-
return new Promise((
|
|
55288
|
+
return new Promise((resolve9, reject) => {
|
|
54894
55289
|
let socket = ftp._newSocket();
|
|
54895
55290
|
const handleConnErr = function(err) {
|
|
54896
55291
|
err.message = "Can't open data connection in passive mode: " + err.message;
|
|
@@ -54913,7 +55308,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
54913
55308
|
socket.removeListener("error", handleConnErr);
|
|
54914
55309
|
socket.removeListener("timeout", handleTimeout);
|
|
54915
55310
|
ftp.dataSocket = socket;
|
|
54916
|
-
|
|
55311
|
+
resolve9();
|
|
54917
55312
|
});
|
|
54918
55313
|
});
|
|
54919
55314
|
}
|
|
@@ -56991,7 +57386,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
56991
57386
|
return path;
|
|
56992
57387
|
}
|
|
56993
57388
|
exports.normalize = normalize2;
|
|
56994
|
-
function
|
|
57389
|
+
function join31(aRoot, aPath) {
|
|
56995
57390
|
if (aRoot === "") {
|
|
56996
57391
|
aRoot = ".";
|
|
56997
57392
|
}
|
|
@@ -57023,7 +57418,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
57023
57418
|
}
|
|
57024
57419
|
return joined;
|
|
57025
57420
|
}
|
|
57026
|
-
exports.join =
|
|
57421
|
+
exports.join = join31;
|
|
57027
57422
|
exports.isAbsolute = function(aPath) {
|
|
57028
57423
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
57029
57424
|
};
|
|
@@ -57196,7 +57591,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
57196
57591
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
57197
57592
|
}
|
|
57198
57593
|
}
|
|
57199
|
-
sourceURL =
|
|
57594
|
+
sourceURL = join31(urlGenerate(parsed), sourceURL);
|
|
57200
57595
|
}
|
|
57201
57596
|
return normalize2(sourceURL);
|
|
57202
57597
|
}
|
|
@@ -58928,7 +59323,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
58928
59323
|
function noEmptySpace() {
|
|
58929
59324
|
return space ? space : " ";
|
|
58930
59325
|
}
|
|
58931
|
-
function
|
|
59326
|
+
function join31(left, right) {
|
|
58932
59327
|
var leftSource, rightSource, leftCharCode, rightCharCode;
|
|
58933
59328
|
leftSource = toSourceNodeWhenNeeded(left).toString();
|
|
58934
59329
|
if (leftSource.length === 0) {
|
|
@@ -59269,8 +59664,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59269
59664
|
} else {
|
|
59270
59665
|
result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT));
|
|
59271
59666
|
}
|
|
59272
|
-
result =
|
|
59273
|
-
result = [
|
|
59667
|
+
result = join31(result, operator);
|
|
59668
|
+
result = [join31(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
|
|
59274
59669
|
});
|
|
59275
59670
|
result.push(this.maybeBlock(stmt.body, flags));
|
|
59276
59671
|
return result;
|
|
@@ -59408,11 +59803,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59408
59803
|
var result, fragment;
|
|
59409
59804
|
result = ["class"];
|
|
59410
59805
|
if (stmt.id) {
|
|
59411
|
-
result =
|
|
59806
|
+
result = join31(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
|
|
59412
59807
|
}
|
|
59413
59808
|
if (stmt.superClass) {
|
|
59414
|
-
fragment =
|
|
59415
|
-
result =
|
|
59809
|
+
fragment = join31("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
|
|
59810
|
+
result = join31(result, fragment);
|
|
59416
59811
|
}
|
|
59417
59812
|
result.push(space);
|
|
59418
59813
|
result.push(this.generateStatement(stmt.body, S_TFFT));
|
|
@@ -59425,9 +59820,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59425
59820
|
return escapeDirective(stmt.directive) + this.semicolon(flags);
|
|
59426
59821
|
},
|
|
59427
59822
|
DoWhileStatement: function(stmt, flags) {
|
|
59428
|
-
var result =
|
|
59823
|
+
var result = join31("do", this.maybeBlock(stmt.body, S_TFFF));
|
|
59429
59824
|
result = this.maybeBlockSuffix(stmt.body, result);
|
|
59430
|
-
return
|
|
59825
|
+
return join31(result, [
|
|
59431
59826
|
"while" + space + "(",
|
|
59432
59827
|
this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
59433
59828
|
")" + this.semicolon(flags)
|
|
@@ -59463,11 +59858,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59463
59858
|
ExportDefaultDeclaration: function(stmt, flags) {
|
|
59464
59859
|
var result = ["export"], bodyFlags;
|
|
59465
59860
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
59466
|
-
result =
|
|
59861
|
+
result = join31(result, "default");
|
|
59467
59862
|
if (isStatement(stmt.declaration)) {
|
|
59468
|
-
result =
|
|
59863
|
+
result = join31(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
59469
59864
|
} else {
|
|
59470
|
-
result =
|
|
59865
|
+
result = join31(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
|
|
59471
59866
|
}
|
|
59472
59867
|
return result;
|
|
59473
59868
|
},
|
|
@@ -59475,15 +59870,15 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59475
59870
|
var result = ["export"], bodyFlags, that = this;
|
|
59476
59871
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
59477
59872
|
if (stmt.declaration) {
|
|
59478
|
-
return
|
|
59873
|
+
return join31(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
59479
59874
|
}
|
|
59480
59875
|
if (stmt.specifiers) {
|
|
59481
59876
|
if (stmt.specifiers.length === 0) {
|
|
59482
|
-
result =
|
|
59877
|
+
result = join31(result, "{" + space + "}");
|
|
59483
59878
|
} else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) {
|
|
59484
|
-
result =
|
|
59879
|
+
result = join31(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
|
|
59485
59880
|
} else {
|
|
59486
|
-
result =
|
|
59881
|
+
result = join31(result, "{");
|
|
59487
59882
|
withIndent(function(indent2) {
|
|
59488
59883
|
var i, iz;
|
|
59489
59884
|
result.push(newline);
|
|
@@ -59501,7 +59896,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59501
59896
|
result.push(base + "}");
|
|
59502
59897
|
}
|
|
59503
59898
|
if (stmt.source) {
|
|
59504
|
-
result =
|
|
59899
|
+
result = join31(result, [
|
|
59505
59900
|
"from" + space,
|
|
59506
59901
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
59507
59902
|
this.semicolon(flags)
|
|
@@ -59585,7 +59980,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59585
59980
|
];
|
|
59586
59981
|
cursor = 0;
|
|
59587
59982
|
if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) {
|
|
59588
|
-
result =
|
|
59983
|
+
result = join31(result, [
|
|
59589
59984
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
59590
59985
|
]);
|
|
59591
59986
|
++cursor;
|
|
@@ -59595,7 +59990,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59595
59990
|
result.push(",");
|
|
59596
59991
|
}
|
|
59597
59992
|
if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) {
|
|
59598
|
-
result =
|
|
59993
|
+
result = join31(result, [
|
|
59599
59994
|
space,
|
|
59600
59995
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
59601
59996
|
]);
|
|
@@ -59624,7 +60019,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59624
60019
|
}
|
|
59625
60020
|
}
|
|
59626
60021
|
}
|
|
59627
|
-
result =
|
|
60022
|
+
result = join31(result, [
|
|
59628
60023
|
"from" + space,
|
|
59629
60024
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
59630
60025
|
this.semicolon(flags)
|
|
@@ -59678,7 +60073,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59678
60073
|
return result;
|
|
59679
60074
|
},
|
|
59680
60075
|
ThrowStatement: function(stmt, flags) {
|
|
59681
|
-
return [
|
|
60076
|
+
return [join31("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
59682
60077
|
},
|
|
59683
60078
|
TryStatement: function(stmt, flags) {
|
|
59684
60079
|
var result, i, iz, guardedHandlers;
|
|
@@ -59686,7 +60081,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59686
60081
|
result = this.maybeBlockSuffix(stmt.block, result);
|
|
59687
60082
|
if (stmt.handlers) {
|
|
59688
60083
|
for (i = 0, iz = stmt.handlers.length;i < iz; ++i) {
|
|
59689
|
-
result =
|
|
60084
|
+
result = join31(result, this.generateStatement(stmt.handlers[i], S_TFFF));
|
|
59690
60085
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
59691
60086
|
result = this.maybeBlockSuffix(stmt.handlers[i].body, result);
|
|
59692
60087
|
}
|
|
@@ -59694,7 +60089,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59694
60089
|
} else {
|
|
59695
60090
|
guardedHandlers = stmt.guardedHandlers || [];
|
|
59696
60091
|
for (i = 0, iz = guardedHandlers.length;i < iz; ++i) {
|
|
59697
|
-
result =
|
|
60092
|
+
result = join31(result, this.generateStatement(guardedHandlers[i], S_TFFF));
|
|
59698
60093
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
59699
60094
|
result = this.maybeBlockSuffix(guardedHandlers[i].body, result);
|
|
59700
60095
|
}
|
|
@@ -59702,13 +60097,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59702
60097
|
if (stmt.handler) {
|
|
59703
60098
|
if (Array.isArray(stmt.handler)) {
|
|
59704
60099
|
for (i = 0, iz = stmt.handler.length;i < iz; ++i) {
|
|
59705
|
-
result =
|
|
60100
|
+
result = join31(result, this.generateStatement(stmt.handler[i], S_TFFF));
|
|
59706
60101
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
59707
60102
|
result = this.maybeBlockSuffix(stmt.handler[i].body, result);
|
|
59708
60103
|
}
|
|
59709
60104
|
}
|
|
59710
60105
|
} else {
|
|
59711
|
-
result =
|
|
60106
|
+
result = join31(result, this.generateStatement(stmt.handler, S_TFFF));
|
|
59712
60107
|
if (stmt.finalizer) {
|
|
59713
60108
|
result = this.maybeBlockSuffix(stmt.handler.body, result);
|
|
59714
60109
|
}
|
|
@@ -59716,7 +60111,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59716
60111
|
}
|
|
59717
60112
|
}
|
|
59718
60113
|
if (stmt.finalizer) {
|
|
59719
|
-
result =
|
|
60114
|
+
result = join31(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
|
|
59720
60115
|
}
|
|
59721
60116
|
return result;
|
|
59722
60117
|
},
|
|
@@ -59750,7 +60145,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59750
60145
|
withIndent(function() {
|
|
59751
60146
|
if (stmt.test) {
|
|
59752
60147
|
result = [
|
|
59753
|
-
|
|
60148
|
+
join31("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
|
|
59754
60149
|
":"
|
|
59755
60150
|
];
|
|
59756
60151
|
} else {
|
|
@@ -59798,9 +60193,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59798
60193
|
result.push(this.maybeBlock(stmt.consequent, S_TFFF));
|
|
59799
60194
|
result = this.maybeBlockSuffix(stmt.consequent, result);
|
|
59800
60195
|
if (stmt.alternate.type === Syntax.IfStatement) {
|
|
59801
|
-
result =
|
|
60196
|
+
result = join31(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
|
|
59802
60197
|
} else {
|
|
59803
|
-
result =
|
|
60198
|
+
result = join31(result, join31("else", this.maybeBlock(stmt.alternate, bodyFlags)));
|
|
59804
60199
|
}
|
|
59805
60200
|
} else {
|
|
59806
60201
|
result.push(this.maybeBlock(stmt.consequent, bodyFlags));
|
|
@@ -59902,7 +60297,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59902
60297
|
},
|
|
59903
60298
|
ReturnStatement: function(stmt, flags) {
|
|
59904
60299
|
if (stmt.argument) {
|
|
59905
|
-
return [
|
|
60300
|
+
return [join31("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
59906
60301
|
}
|
|
59907
60302
|
return ["return" + this.semicolon(flags)];
|
|
59908
60303
|
},
|
|
@@ -59984,14 +60379,14 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59984
60379
|
if (leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) {
|
|
59985
60380
|
result = [fragment, noEmptySpace(), expr.operator];
|
|
59986
60381
|
} else {
|
|
59987
|
-
result =
|
|
60382
|
+
result = join31(fragment, expr.operator);
|
|
59988
60383
|
}
|
|
59989
60384
|
fragment = this.generateExpression(expr.right, rightPrecedence, flags);
|
|
59990
60385
|
if (expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--") {
|
|
59991
60386
|
result.push(noEmptySpace());
|
|
59992
60387
|
result.push(fragment);
|
|
59993
60388
|
} else {
|
|
59994
|
-
result =
|
|
60389
|
+
result = join31(result, fragment);
|
|
59995
60390
|
}
|
|
59996
60391
|
if (expr.operator === "in" && !(flags & F_ALLOW_IN)) {
|
|
59997
60392
|
return ["(", result, ")"];
|
|
@@ -60031,7 +60426,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60031
60426
|
var result, length, i, iz, itemFlags;
|
|
60032
60427
|
length = expr["arguments"].length;
|
|
60033
60428
|
itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF;
|
|
60034
|
-
result =
|
|
60429
|
+
result = join31("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
|
|
60035
60430
|
if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
|
|
60036
60431
|
result.push("(");
|
|
60037
60432
|
for (i = 0, iz = length;i < iz; ++i) {
|
|
@@ -60078,11 +60473,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60078
60473
|
var result, fragment, rightCharCode, leftSource, leftCharCode;
|
|
60079
60474
|
fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT);
|
|
60080
60475
|
if (space === "") {
|
|
60081
|
-
result =
|
|
60476
|
+
result = join31(expr.operator, fragment);
|
|
60082
60477
|
} else {
|
|
60083
60478
|
result = [expr.operator];
|
|
60084
60479
|
if (expr.operator.length > 2) {
|
|
60085
|
-
result =
|
|
60480
|
+
result = join31(result, fragment);
|
|
60086
60481
|
} else {
|
|
60087
60482
|
leftSource = toSourceNodeWhenNeeded(result).toString();
|
|
60088
60483
|
leftCharCode = leftSource.charCodeAt(leftSource.length - 1);
|
|
@@ -60105,12 +60500,12 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60105
60500
|
result = "yield";
|
|
60106
60501
|
}
|
|
60107
60502
|
if (expr.argument) {
|
|
60108
|
-
result =
|
|
60503
|
+
result = join31(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
|
|
60109
60504
|
}
|
|
60110
60505
|
return parenthesize(result, Precedence.Yield, precedence);
|
|
60111
60506
|
},
|
|
60112
60507
|
AwaitExpression: function(expr, precedence, flags) {
|
|
60113
|
-
var result =
|
|
60508
|
+
var result = join31(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
|
|
60114
60509
|
return parenthesize(result, Precedence.Await, precedence);
|
|
60115
60510
|
},
|
|
60116
60511
|
UpdateExpression: function(expr, precedence, flags) {
|
|
@@ -60182,11 +60577,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60182
60577
|
var result, fragment;
|
|
60183
60578
|
result = ["class"];
|
|
60184
60579
|
if (expr.id) {
|
|
60185
|
-
result =
|
|
60580
|
+
result = join31(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
|
|
60186
60581
|
}
|
|
60187
60582
|
if (expr.superClass) {
|
|
60188
|
-
fragment =
|
|
60189
|
-
result =
|
|
60583
|
+
fragment = join31("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
|
|
60584
|
+
result = join31(result, fragment);
|
|
60190
60585
|
}
|
|
60191
60586
|
result.push(space);
|
|
60192
60587
|
result.push(this.generateStatement(expr.body, S_TFFT));
|
|
@@ -60201,7 +60596,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60201
60596
|
}
|
|
60202
60597
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
60203
60598
|
fragment = [
|
|
60204
|
-
|
|
60599
|
+
join31(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
|
|
60205
60600
|
this.generateFunctionBody(expr.value)
|
|
60206
60601
|
];
|
|
60207
60602
|
} else {
|
|
@@ -60211,7 +60606,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60211
60606
|
this.generateFunctionBody(expr.value)
|
|
60212
60607
|
];
|
|
60213
60608
|
}
|
|
60214
|
-
return
|
|
60609
|
+
return join31(result, fragment);
|
|
60215
60610
|
},
|
|
60216
60611
|
Property: function(expr, precedence, flags) {
|
|
60217
60612
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
@@ -60405,7 +60800,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60405
60800
|
for (i = 0, iz = expr.blocks.length;i < iz; ++i) {
|
|
60406
60801
|
fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT);
|
|
60407
60802
|
if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
60408
|
-
result =
|
|
60803
|
+
result = join31(result, fragment);
|
|
60409
60804
|
} else {
|
|
60410
60805
|
result.push(fragment);
|
|
60411
60806
|
}
|
|
@@ -60413,13 +60808,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60413
60808
|
});
|
|
60414
60809
|
}
|
|
60415
60810
|
if (expr.filter) {
|
|
60416
|
-
result =
|
|
60811
|
+
result = join31(result, "if" + space);
|
|
60417
60812
|
fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT);
|
|
60418
|
-
result =
|
|
60813
|
+
result = join31(result, ["(", fragment, ")"]);
|
|
60419
60814
|
}
|
|
60420
60815
|
if (!extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
60421
60816
|
fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
|
|
60422
|
-
result =
|
|
60817
|
+
result = join31(result, fragment);
|
|
60423
60818
|
}
|
|
60424
60819
|
result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]");
|
|
60425
60820
|
return result;
|
|
@@ -60435,8 +60830,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60435
60830
|
} else {
|
|
60436
60831
|
fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT);
|
|
60437
60832
|
}
|
|
60438
|
-
fragment =
|
|
60439
|
-
fragment =
|
|
60833
|
+
fragment = join31(fragment, expr.of ? "of" : "in");
|
|
60834
|
+
fragment = join31(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
|
|
60440
60835
|
return ["for" + space + "(", fragment, ")"];
|
|
60441
60836
|
},
|
|
60442
60837
|
SpreadElement: function(expr, precedence, flags) {
|
|
@@ -66924,11 +67319,11 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
66924
67319
|
};
|
|
66925
67320
|
__awaiter2 = function(thisArg, _arguments, P, generator) {
|
|
66926
67321
|
function adopt(value) {
|
|
66927
|
-
return value instanceof P ? value : new P(function(
|
|
66928
|
-
|
|
67322
|
+
return value instanceof P ? value : new P(function(resolve9) {
|
|
67323
|
+
resolve9(value);
|
|
66929
67324
|
});
|
|
66930
67325
|
}
|
|
66931
|
-
return new (P || (P = Promise))(function(
|
|
67326
|
+
return new (P || (P = Promise))(function(resolve9, reject) {
|
|
66932
67327
|
function fulfilled(value) {
|
|
66933
67328
|
try {
|
|
66934
67329
|
step(generator.next(value));
|
|
@@ -66944,7 +67339,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
66944
67339
|
}
|
|
66945
67340
|
}
|
|
66946
67341
|
function step(result) {
|
|
66947
|
-
result.done ?
|
|
67342
|
+
result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
66948
67343
|
}
|
|
66949
67344
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
66950
67345
|
});
|
|
@@ -67173,14 +67568,14 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
67173
67568
|
}, i);
|
|
67174
67569
|
function verb(n) {
|
|
67175
67570
|
i[n] = o[n] && function(v) {
|
|
67176
|
-
return new Promise(function(
|
|
67177
|
-
v = o[n](v), settle(
|
|
67571
|
+
return new Promise(function(resolve9, reject) {
|
|
67572
|
+
v = o[n](v), settle(resolve9, reject, v.done, v.value);
|
|
67178
67573
|
});
|
|
67179
67574
|
};
|
|
67180
67575
|
}
|
|
67181
|
-
function settle(
|
|
67576
|
+
function settle(resolve9, reject, d, v) {
|
|
67182
67577
|
Promise.resolve(v).then(function(v2) {
|
|
67183
|
-
|
|
67578
|
+
resolve9({ value: v2, done: d });
|
|
67184
67579
|
}, reject);
|
|
67185
67580
|
}
|
|
67186
67581
|
};
|
|
@@ -70419,12 +70814,12 @@ var require_util3 = __commonJS((exports) => {
|
|
|
70419
70814
|
exports.isGMT = exports.dnsLookup = undefined;
|
|
70420
70815
|
var dns_1 = __require("dns");
|
|
70421
70816
|
function dnsLookup(host, opts) {
|
|
70422
|
-
return new Promise((
|
|
70817
|
+
return new Promise((resolve9, reject) => {
|
|
70423
70818
|
(0, dns_1.lookup)(host, opts, (err, res) => {
|
|
70424
70819
|
if (err) {
|
|
70425
70820
|
reject(err);
|
|
70426
70821
|
} else {
|
|
70427
|
-
|
|
70822
|
+
resolve9(res);
|
|
70428
70823
|
}
|
|
70429
70824
|
});
|
|
70430
70825
|
});
|
|
@@ -70998,10 +71393,10 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
70998
71393
|
var ip_1 = require_ip();
|
|
70999
71394
|
var net_1 = __importDefault(__require("net"));
|
|
71000
71395
|
async function myIpAddress() {
|
|
71001
|
-
return new Promise((
|
|
71396
|
+
return new Promise((resolve9, reject) => {
|
|
71002
71397
|
const socket = net_1.default.connect({ host: "8.8.8.8", port: 53 });
|
|
71003
71398
|
const onError = () => {
|
|
71004
|
-
|
|
71399
|
+
resolve9(ip_1.ip.address());
|
|
71005
71400
|
};
|
|
71006
71401
|
socket.once("error", onError);
|
|
71007
71402
|
socket.once("connect", () => {
|
|
@@ -71009,9 +71404,9 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
71009
71404
|
const addr = socket.address();
|
|
71010
71405
|
socket.destroy();
|
|
71011
71406
|
if (typeof addr === "string") {
|
|
71012
|
-
|
|
71407
|
+
resolve9(addr);
|
|
71013
71408
|
} else if (addr.address) {
|
|
71014
|
-
|
|
71409
|
+
resolve9(addr.address);
|
|
71015
71410
|
} else {
|
|
71016
71411
|
reject(new Error("Expected a `string`"));
|
|
71017
71412
|
}
|
|
@@ -71525,8 +71920,8 @@ var require_deferred_promise = __commonJS((exports) => {
|
|
|
71525
71920
|
this.context = args.context;
|
|
71526
71921
|
this.owner = args.context.runtime;
|
|
71527
71922
|
this.handle = args.promiseHandle;
|
|
71528
|
-
this.settled = new Promise((
|
|
71529
|
-
this.onSettled =
|
|
71923
|
+
this.settled = new Promise((resolve9) => {
|
|
71924
|
+
this.onSettled = resolve9;
|
|
71530
71925
|
});
|
|
71531
71926
|
this.resolveHandle = args.resolveHandle;
|
|
71532
71927
|
this.rejectHandle = args.rejectHandle;
|
|
@@ -71918,13 +72313,13 @@ var require_context = __commonJS((exports) => {
|
|
|
71918
72313
|
if (vmResolveResult.error) {
|
|
71919
72314
|
return Promise.resolve(vmResolveResult);
|
|
71920
72315
|
}
|
|
71921
|
-
return new Promise((
|
|
72316
|
+
return new Promise((resolve9) => {
|
|
71922
72317
|
lifetime_1.Scope.withScope((scope) => {
|
|
71923
72318
|
const resolveHandle = scope.manage(this.newFunction("resolve", (value) => {
|
|
71924
|
-
|
|
72319
|
+
resolve9({ value: value && value.dup() });
|
|
71925
72320
|
}));
|
|
71926
72321
|
const rejectHandle = scope.manage(this.newFunction("reject", (error) => {
|
|
71927
|
-
|
|
72322
|
+
resolve9({ error: error && error.dup() });
|
|
71928
72323
|
}));
|
|
71929
72324
|
const promiseHandle = scope.manage(vmResolveResult.value);
|
|
71930
72325
|
const promiseThenHandle = scope.manage(this.getProp(promiseHandle, "then"));
|
|
@@ -74038,13 +74433,13 @@ import * as http from "http";
|
|
|
74038
74433
|
import * as https from "https";
|
|
74039
74434
|
import { URL as URL2, urlToHttpOptions } from "url";
|
|
74040
74435
|
function headHttpRequest(url) {
|
|
74041
|
-
return new Promise((
|
|
74436
|
+
return new Promise((resolve9) => {
|
|
74042
74437
|
const request3 = httpRequest(url, "HEAD", (response) => {
|
|
74043
74438
|
response.resume();
|
|
74044
|
-
|
|
74439
|
+
resolve9(response.statusCode === 200);
|
|
74045
74440
|
}, false);
|
|
74046
74441
|
request3.on("error", () => {
|
|
74047
|
-
|
|
74442
|
+
resolve9(false);
|
|
74048
74443
|
});
|
|
74049
74444
|
});
|
|
74050
74445
|
}
|
|
@@ -74072,7 +74467,7 @@ function httpRequest(url, method, response, keepAlive = true) {
|
|
|
74072
74467
|
return request3;
|
|
74073
74468
|
}
|
|
74074
74469
|
function downloadFile(url, destinationPath, progressCallback) {
|
|
74075
|
-
return new Promise((
|
|
74470
|
+
return new Promise((resolve9, reject) => {
|
|
74076
74471
|
let downloadedBytes = 0;
|
|
74077
74472
|
let totalBytes = 0;
|
|
74078
74473
|
function onData(chunk) {
|
|
@@ -74088,7 +74483,7 @@ function downloadFile(url, destinationPath, progressCallback) {
|
|
|
74088
74483
|
}
|
|
74089
74484
|
const file = createWriteStream(destinationPath);
|
|
74090
74485
|
file.on("close", () => {
|
|
74091
|
-
return
|
|
74486
|
+
return resolve9();
|
|
74092
74487
|
});
|
|
74093
74488
|
file.on("error", (error) => {
|
|
74094
74489
|
return reject(error);
|
|
@@ -74113,7 +74508,7 @@ async function getJSON(url) {
|
|
|
74113
74508
|
}
|
|
74114
74509
|
}
|
|
74115
74510
|
function getText(url) {
|
|
74116
|
-
return new Promise((
|
|
74511
|
+
return new Promise((resolve9, reject) => {
|
|
74117
74512
|
const request3 = httpRequest(url, "GET", (response) => {
|
|
74118
74513
|
let data = "";
|
|
74119
74514
|
if (response.statusCode && response.statusCode >= 400) {
|
|
@@ -74124,7 +74519,7 @@ function getText(url) {
|
|
|
74124
74519
|
});
|
|
74125
74520
|
response.on("end", () => {
|
|
74126
74521
|
try {
|
|
74127
|
-
return
|
|
74522
|
+
return resolve9(String(data));
|
|
74128
74523
|
} catch {
|
|
74129
74524
|
return reject(new Error(`Failed to read text response from ${url}`));
|
|
74130
74525
|
}
|
|
@@ -74141,7 +74536,7 @@ var init_httpUtil = __esm(() => {
|
|
|
74141
74536
|
});
|
|
74142
74537
|
|
|
74143
74538
|
// node_modules/@puppeteer/browsers/lib/esm/browser-data/chrome.js
|
|
74144
|
-
import { execSync as
|
|
74539
|
+
import { execSync as execSync9 } from "child_process";
|
|
74145
74540
|
import os from "os";
|
|
74146
74541
|
import path from "path";
|
|
74147
74542
|
function folder(platform2) {
|
|
@@ -74231,7 +74626,7 @@ function getChromeWindowsLocation(channel2, locationsPrefixes) {
|
|
|
74231
74626
|
}
|
|
74232
74627
|
function getWslVariable(variable) {
|
|
74233
74628
|
try {
|
|
74234
|
-
const result =
|
|
74629
|
+
const result = execSync9(`cmd.exe /c echo %${variable.toLocaleUpperCase()}%`, {
|
|
74235
74630
|
stdio: ["ignore", "pipe", "ignore"],
|
|
74236
74631
|
encoding: "utf-8"
|
|
74237
74632
|
}).trim();
|
|
@@ -74242,7 +74637,7 @@ function getWslVariable(variable) {
|
|
|
74242
74637
|
return;
|
|
74243
74638
|
}
|
|
74244
74639
|
function getWslLocation(channel2) {
|
|
74245
|
-
const wslVersion =
|
|
74640
|
+
const wslVersion = execSync9("wslinfo --version", {
|
|
74246
74641
|
stdio: ["ignore", "pipe", "ignore"],
|
|
74247
74642
|
encoding: "utf-8"
|
|
74248
74643
|
}).trim();
|
|
@@ -74258,7 +74653,7 @@ function getWslLocation(channel2) {
|
|
|
74258
74653
|
}
|
|
74259
74654
|
const windowsPath = getChromeWindowsLocation(channel2, wslPrefixes);
|
|
74260
74655
|
return windowsPath.map((path2) => {
|
|
74261
|
-
return
|
|
74656
|
+
return execSync9(`wslpath "${path2}"`).toString().trim();
|
|
74262
74657
|
});
|
|
74263
74658
|
}
|
|
74264
74659
|
function getChromeLinuxOrWslLocation(channel2) {
|
|
@@ -75345,7 +75740,7 @@ class Process {
|
|
|
75345
75740
|
if (opts.onExit) {
|
|
75346
75741
|
this.#onExitHook = opts.onExit;
|
|
75347
75742
|
}
|
|
75348
|
-
this.#browserProcessExiting = new Promise((
|
|
75743
|
+
this.#browserProcessExiting = new Promise((resolve9, reject) => {
|
|
75349
75744
|
this.#browserProcess.once("exit", async () => {
|
|
75350
75745
|
debugLaunch(`Browser process ${this.#browserProcess.pid} onExit`);
|
|
75351
75746
|
this.#clearListeners();
|
|
@@ -75356,7 +75751,7 @@ class Process {
|
|
|
75356
75751
|
reject(err);
|
|
75357
75752
|
return;
|
|
75358
75753
|
}
|
|
75359
|
-
|
|
75754
|
+
resolve9();
|
|
75360
75755
|
});
|
|
75361
75756
|
});
|
|
75362
75757
|
}
|
|
@@ -75466,7 +75861,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
75466
75861
|
return [...this.#logs];
|
|
75467
75862
|
}
|
|
75468
75863
|
waitForLineOutput(regex, timeout2 = 0) {
|
|
75469
|
-
return new Promise((
|
|
75864
|
+
return new Promise((resolve9, reject) => {
|
|
75470
75865
|
const onClose = (errorOrCode) => {
|
|
75471
75866
|
cleanup();
|
|
75472
75867
|
reject(new Error([
|
|
@@ -75504,7 +75899,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
75504
75899
|
return;
|
|
75505
75900
|
}
|
|
75506
75901
|
cleanup();
|
|
75507
|
-
|
|
75902
|
+
resolve9(match[1]);
|
|
75508
75903
|
}
|
|
75509
75904
|
});
|
|
75510
75905
|
}
|
|
@@ -76034,7 +76429,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
76034
76429
|
};
|
|
76035
76430
|
const { maxBuffer } = options;
|
|
76036
76431
|
let stream;
|
|
76037
|
-
await new Promise((
|
|
76432
|
+
await new Promise((resolve9, reject) => {
|
|
76038
76433
|
const rejectPromise = (error) => {
|
|
76039
76434
|
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
76040
76435
|
error.bufferedData = stream.getBufferedValue();
|
|
@@ -76046,7 +76441,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
76046
76441
|
rejectPromise(error);
|
|
76047
76442
|
return;
|
|
76048
76443
|
}
|
|
76049
|
-
|
|
76444
|
+
resolve9();
|
|
76050
76445
|
});
|
|
76051
76446
|
stream.on("data", () => {
|
|
76052
76447
|
if (stream.getBufferedLength() > maxBuffer) {
|
|
@@ -77407,7 +77802,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
77407
77802
|
debug4("opening", this.zipPath, "with opts", this.opts);
|
|
77408
77803
|
this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
|
|
77409
77804
|
this.canceled = false;
|
|
77410
|
-
return new Promise((
|
|
77805
|
+
return new Promise((resolve9, reject) => {
|
|
77411
77806
|
this.zipfile.on("error", (err) => {
|
|
77412
77807
|
this.canceled = true;
|
|
77413
77808
|
reject(err);
|
|
@@ -77416,7 +77811,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
77416
77811
|
this.zipfile.on("close", () => {
|
|
77417
77812
|
if (!this.canceled) {
|
|
77418
77813
|
debug4("zip extraction complete");
|
|
77419
|
-
|
|
77814
|
+
resolve9();
|
|
77420
77815
|
}
|
|
77421
77816
|
});
|
|
77422
77817
|
this.zipfile.on("entry", async (entry) => {
|
|
@@ -78758,8 +79153,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
78758
79153
|
return this;
|
|
78759
79154
|
},
|
|
78760
79155
|
next() {
|
|
78761
|
-
return new Promise(function(
|
|
78762
|
-
promiseResolve =
|
|
79156
|
+
return new Promise(function(resolve9, reject) {
|
|
79157
|
+
promiseResolve = resolve9;
|
|
78763
79158
|
promiseReject = reject;
|
|
78764
79159
|
const data = stream.read();
|
|
78765
79160
|
if (data !== null)
|
|
@@ -78796,14 +79191,14 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
78796
79191
|
}
|
|
78797
79192
|
function destroy(err) {
|
|
78798
79193
|
stream.destroy(err);
|
|
78799
|
-
return new Promise((
|
|
79194
|
+
return new Promise((resolve9, reject) => {
|
|
78800
79195
|
if (stream._duplexState & DESTROYED)
|
|
78801
|
-
return
|
|
79196
|
+
return resolve9({ value: undefined, done: true });
|
|
78802
79197
|
stream.once("close", function() {
|
|
78803
79198
|
if (err)
|
|
78804
79199
|
reject(err);
|
|
78805
79200
|
else
|
|
78806
|
-
|
|
79201
|
+
resolve9({ value: undefined, done: true });
|
|
78807
79202
|
});
|
|
78808
79203
|
});
|
|
78809
79204
|
}
|
|
@@ -78855,8 +79250,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
78855
79250
|
return Promise.resolve(true);
|
|
78856
79251
|
if (state.drains === null)
|
|
78857
79252
|
state.drains = [];
|
|
78858
|
-
return new Promise((
|
|
78859
|
-
state.drains.push({ writes, resolve:
|
|
79253
|
+
return new Promise((resolve9) => {
|
|
79254
|
+
state.drains.push({ writes, resolve: resolve9 });
|
|
78860
79255
|
});
|
|
78861
79256
|
}
|
|
78862
79257
|
write(data) {
|
|
@@ -78970,11 +79365,11 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
78970
79365
|
cb(null);
|
|
78971
79366
|
}
|
|
78972
79367
|
function pipelinePromise(...streams) {
|
|
78973
|
-
return new Promise((
|
|
79368
|
+
return new Promise((resolve9, reject) => {
|
|
78974
79369
|
return pipeline(...streams, (err) => {
|
|
78975
79370
|
if (err)
|
|
78976
79371
|
return reject(err);
|
|
78977
|
-
|
|
79372
|
+
resolve9();
|
|
78978
79373
|
});
|
|
78979
79374
|
});
|
|
78980
79375
|
}
|
|
@@ -79688,16 +80083,16 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
79688
80083
|
entryCallback = null;
|
|
79689
80084
|
cb(err);
|
|
79690
80085
|
}
|
|
79691
|
-
function onnext(
|
|
80086
|
+
function onnext(resolve9, reject) {
|
|
79692
80087
|
if (error) {
|
|
79693
80088
|
return reject(error);
|
|
79694
80089
|
}
|
|
79695
80090
|
if (entryStream) {
|
|
79696
|
-
|
|
80091
|
+
resolve9({ value: entryStream, done: false });
|
|
79697
80092
|
entryStream = null;
|
|
79698
80093
|
return;
|
|
79699
80094
|
}
|
|
79700
|
-
promiseResolve =
|
|
80095
|
+
promiseResolve = resolve9;
|
|
79701
80096
|
promiseReject = reject;
|
|
79702
80097
|
consumeCallback(null);
|
|
79703
80098
|
if (extract._finished && promiseResolve) {
|
|
@@ -79728,14 +80123,14 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
79728
80123
|
function destroy(err) {
|
|
79729
80124
|
extract.destroy(err);
|
|
79730
80125
|
consumeCallback(err);
|
|
79731
|
-
return new Promise((
|
|
80126
|
+
return new Promise((resolve9, reject) => {
|
|
79732
80127
|
if (extract.destroyed)
|
|
79733
|
-
return
|
|
80128
|
+
return resolve9({ value: undefined, done: true });
|
|
79734
80129
|
extract.once("close", function() {
|
|
79735
80130
|
if (err)
|
|
79736
80131
|
reject(err);
|
|
79737
80132
|
else
|
|
79738
|
-
|
|
80133
|
+
resolve9({ value: undefined, done: true });
|
|
79739
80134
|
});
|
|
79740
80135
|
});
|
|
79741
80136
|
}
|
|
@@ -80533,7 +80928,7 @@ var init_fileUtil = __esm(() => {
|
|
|
80533
80928
|
// node_modules/@puppeteer/browsers/lib/esm/install.js
|
|
80534
80929
|
import assert2 from "assert";
|
|
80535
80930
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
80536
|
-
import { existsSync as
|
|
80931
|
+
import { existsSync as existsSync35, readFileSync as readFileSync26 } from "fs";
|
|
80537
80932
|
import { mkdir as mkdir2, unlink } from "fs/promises";
|
|
80538
80933
|
import os5 from "os";
|
|
80539
80934
|
import path8 from "path";
|
|
@@ -80586,7 +80981,7 @@ async function installWithProviders(options) {
|
|
|
80586
80981
|
continue;
|
|
80587
80982
|
}
|
|
80588
80983
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
|
|
80589
|
-
if (!
|
|
80984
|
+
if (!existsSync35(browserRoot)) {
|
|
80590
80985
|
await mkdir2(browserRoot, { recursive: true });
|
|
80591
80986
|
}
|
|
80592
80987
|
return await installUrl(url, options, provider);
|
|
@@ -80619,7 +81014,7 @@ async function installDeps(installedBrowser) {
|
|
|
80619
81014
|
return;
|
|
80620
81015
|
}
|
|
80621
81016
|
const depsPath = path8.join(path8.dirname(installedBrowser.executablePath), "deb.deps");
|
|
80622
|
-
if (!
|
|
81017
|
+
if (!existsSync35(depsPath)) {
|
|
80623
81018
|
debugInstall(`deb.deps file was not found at ${depsPath}`);
|
|
80624
81019
|
return;
|
|
80625
81020
|
}
|
|
@@ -80661,11 +81056,11 @@ async function installUrl(url, options, provider) {
|
|
|
80661
81056
|
const cache = new Cache(options.cacheDir);
|
|
80662
81057
|
const browserRoot = cache.browserRoot(options.browser);
|
|
80663
81058
|
const archivePath = path8.join(browserRoot, `${options.buildId}-${fileName}`);
|
|
80664
|
-
if (!
|
|
81059
|
+
if (!existsSync35(browserRoot)) {
|
|
80665
81060
|
await mkdir2(browserRoot, { recursive: true });
|
|
80666
81061
|
}
|
|
80667
81062
|
if (!options.unpack) {
|
|
80668
|
-
if (
|
|
81063
|
+
if (existsSync35(archivePath)) {
|
|
80669
81064
|
return archivePath;
|
|
80670
81065
|
}
|
|
80671
81066
|
debugInstall(`Downloading binary from ${url}`);
|
|
@@ -80686,8 +81081,8 @@ async function installUrl(url, options, provider) {
|
|
|
80686
81081
|
cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath6);
|
|
80687
81082
|
}
|
|
80688
81083
|
try {
|
|
80689
|
-
if (
|
|
80690
|
-
if (!
|
|
81084
|
+
if (existsSync35(outputPath)) {
|
|
81085
|
+
if (!existsSync35(installedBrowser.executablePath)) {
|
|
80691
81086
|
throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
|
|
80692
81087
|
}
|
|
80693
81088
|
await runSetup(installedBrowser);
|
|
@@ -80696,7 +81091,7 @@ async function installUrl(url, options, provider) {
|
|
|
80696
81091
|
}
|
|
80697
81092
|
return installedBrowser;
|
|
80698
81093
|
}
|
|
80699
|
-
if (!
|
|
81094
|
+
if (!existsSync35(archivePath)) {
|
|
80700
81095
|
debugInstall(`Downloading binary from ${url}`);
|
|
80701
81096
|
try {
|
|
80702
81097
|
debugTime("download");
|
|
@@ -80725,7 +81120,7 @@ async function installUrl(url, options, provider) {
|
|
|
80725
81120
|
}
|
|
80726
81121
|
return installedBrowser;
|
|
80727
81122
|
} finally {
|
|
80728
|
-
if (
|
|
81123
|
+
if (existsSync35(archivePath)) {
|
|
80729
81124
|
await unlink(archivePath);
|
|
80730
81125
|
}
|
|
80731
81126
|
}
|
|
@@ -80736,7 +81131,7 @@ async function runSetup(installedBrowser) {
|
|
|
80736
81131
|
debugTime("permissions");
|
|
80737
81132
|
const browserDir = path8.dirname(installedBrowser.executablePath);
|
|
80738
81133
|
const setupExePath = path8.join(browserDir, "setup.exe");
|
|
80739
|
-
if (!
|
|
81134
|
+
if (!existsSync35(setupExePath)) {
|
|
80740
81135
|
return;
|
|
80741
81136
|
}
|
|
80742
81137
|
spawnSync4(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
|
|
@@ -81117,19 +81512,19 @@ var init_cliui = __esm(() => {
|
|
|
81117
81512
|
});
|
|
81118
81513
|
|
|
81119
81514
|
// node_modules/escalade/sync/index.mjs
|
|
81120
|
-
import { dirname as
|
|
81515
|
+
import { dirname as dirname14, resolve as resolve10 } from "path";
|
|
81121
81516
|
import { readdirSync as readdirSync11, statSync as statSync12 } from "fs";
|
|
81122
81517
|
function sync_default(start, callback) {
|
|
81123
|
-
let dir =
|
|
81518
|
+
let dir = resolve10(".", start);
|
|
81124
81519
|
let tmp, stats = statSync12(dir);
|
|
81125
81520
|
if (!stats.isDirectory()) {
|
|
81126
|
-
dir =
|
|
81521
|
+
dir = dirname14(dir);
|
|
81127
81522
|
}
|
|
81128
81523
|
while (true) {
|
|
81129
81524
|
tmp = callback(dir, readdirSync11(dir));
|
|
81130
81525
|
if (tmp)
|
|
81131
|
-
return
|
|
81132
|
-
dir =
|
|
81526
|
+
return resolve10(dir, tmp);
|
|
81527
|
+
dir = dirname14(tmp = dir);
|
|
81133
81528
|
if (tmp === dir)
|
|
81134
81529
|
break;
|
|
81135
81530
|
}
|
|
@@ -82075,7 +82470,7 @@ var init_yargs_parser = __esm(() => {
|
|
|
82075
82470
|
|
|
82076
82471
|
// node_modules/yargs-parser/build/lib/index.js
|
|
82077
82472
|
import { format } from "util";
|
|
82078
|
-
import { normalize as normalize2, resolve as
|
|
82473
|
+
import { normalize as normalize2, resolve as resolve11 } from "path";
|
|
82079
82474
|
var _a3, _b, _c, minNodeVersion, nodeVersion, env, parser, yargsParser = function Parser(args, opts) {
|
|
82080
82475
|
const result = parser.parse(args.slice(), opts);
|
|
82081
82476
|
return result.argv;
|
|
@@ -82098,7 +82493,7 @@ var init_lib2 = __esm(() => {
|
|
|
82098
82493
|
},
|
|
82099
82494
|
format,
|
|
82100
82495
|
normalize: normalize2,
|
|
82101
|
-
resolve:
|
|
82496
|
+
resolve: resolve11,
|
|
82102
82497
|
require: (path9) => {
|
|
82103
82498
|
if (true) {
|
|
82104
82499
|
return __require(path9);
|
|
@@ -82150,7 +82545,7 @@ var init_yerror = __esm(() => {
|
|
|
82150
82545
|
// node_modules/y18n/build/lib/platform-shims/node.js
|
|
82151
82546
|
import { readFileSync as readFileSync27, statSync as statSync13, writeFile } from "fs";
|
|
82152
82547
|
import { format as format2 } from "util";
|
|
82153
|
-
import { resolve as
|
|
82548
|
+
import { resolve as resolve12 } from "path";
|
|
82154
82549
|
var node_default;
|
|
82155
82550
|
var init_node = __esm(() => {
|
|
82156
82551
|
node_default = {
|
|
@@ -82159,7 +82554,7 @@ var init_node = __esm(() => {
|
|
|
82159
82554
|
writeFile
|
|
82160
82555
|
},
|
|
82161
82556
|
format: format2,
|
|
82162
|
-
resolve:
|
|
82557
|
+
resolve: resolve12,
|
|
82163
82558
|
exists: (file) => {
|
|
82164
82559
|
try {
|
|
82165
82560
|
return statSync13(file).isFile();
|
|
@@ -82342,7 +82737,7 @@ import { notStrictEqual, strictEqual } from "assert";
|
|
|
82342
82737
|
import { inspect } from "util";
|
|
82343
82738
|
import { readFileSync as readFileSync28 } from "fs";
|
|
82344
82739
|
import { fileURLToPath } from "url";
|
|
82345
|
-
import { basename as basename8, dirname as
|
|
82740
|
+
import { basename as basename8, dirname as dirname15, extname as extname3, relative as relative8, resolve as resolve13 } from "path";
|
|
82346
82741
|
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;
|
|
82347
82742
|
var init_esm = __esm(() => {
|
|
82348
82743
|
init_cliui();
|
|
@@ -82375,10 +82770,10 @@ var init_esm = __esm(() => {
|
|
|
82375
82770
|
Parser: lib_default,
|
|
82376
82771
|
path: {
|
|
82377
82772
|
basename: basename8,
|
|
82378
|
-
dirname:
|
|
82773
|
+
dirname: dirname15,
|
|
82379
82774
|
extname: extname3,
|
|
82380
82775
|
relative: relative8,
|
|
82381
|
-
resolve:
|
|
82776
|
+
resolve: resolve13
|
|
82382
82777
|
},
|
|
82383
82778
|
process: {
|
|
82384
82779
|
argv: () => process.argv,
|
|
@@ -82400,7 +82795,7 @@ var init_esm = __esm(() => {
|
|
|
82400
82795
|
return [...str].length;
|
|
82401
82796
|
},
|
|
82402
82797
|
y18n: y18n_default({
|
|
82403
|
-
directory:
|
|
82798
|
+
directory: resolve13(__dirname2, "../../../locales"),
|
|
82404
82799
|
updateFiles: false
|
|
82405
82800
|
})
|
|
82406
82801
|
};
|
|
@@ -84648,12 +85043,12 @@ var init_yargs_factory = __esm(() => {
|
|
|
84648
85043
|
async getCompletion(args, done) {
|
|
84649
85044
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
84650
85045
|
if (!done) {
|
|
84651
|
-
return new Promise((
|
|
85046
|
+
return new Promise((resolve14, reject) => {
|
|
84652
85047
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
84653
85048
|
if (err)
|
|
84654
85049
|
reject(err);
|
|
84655
85050
|
else
|
|
84656
|
-
|
|
85051
|
+
resolve14(completions);
|
|
84657
85052
|
});
|
|
84658
85053
|
});
|
|
84659
85054
|
} else {
|
|
@@ -86088,9 +86483,9 @@ async function getConnectionTransport(options) {
|
|
|
86088
86483
|
throw new Error("Could not detect required browser platform");
|
|
86089
86484
|
}
|
|
86090
86485
|
const { convertPuppeteerChannelToBrowsersChannel: convertPuppeteerChannelToBrowsersChannel2 } = await Promise.resolve().then(() => (init_LaunchOptions(), exports_LaunchOptions));
|
|
86091
|
-
const { join:
|
|
86486
|
+
const { join: join32 } = await import("path");
|
|
86092
86487
|
const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform2, convertPuppeteerChannelToBrowsersChannel2(options.channel));
|
|
86093
|
-
const portPath =
|
|
86488
|
+
const portPath = join32(userDataDir, "DevToolsActivePort");
|
|
86094
86489
|
try {
|
|
86095
86490
|
const fileContent = await environment.value.fs.promises.readFile(portPath, "ascii");
|
|
86096
86491
|
const [rawPort, rawPath] = fileContent.split(`
|
|
@@ -86314,9 +86709,9 @@ var init_PipeTransport = __esm(() => {
|
|
|
86314
86709
|
});
|
|
86315
86710
|
|
|
86316
86711
|
// node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js
|
|
86317
|
-
import { existsSync as
|
|
86712
|
+
import { existsSync as existsSync36 } from "fs";
|
|
86318
86713
|
import { tmpdir } from "os";
|
|
86319
|
-
import { join as
|
|
86714
|
+
import { join as join32 } from "path";
|
|
86320
86715
|
|
|
86321
86716
|
class BrowserLauncher {
|
|
86322
86717
|
#browser;
|
|
@@ -86341,7 +86736,7 @@ class BrowserLauncher {
|
|
|
86341
86736
|
...options,
|
|
86342
86737
|
protocol
|
|
86343
86738
|
});
|
|
86344
|
-
if (!
|
|
86739
|
+
if (!existsSync36(launchArgs.executablePath)) {
|
|
86345
86740
|
throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
|
|
86346
86741
|
}
|
|
86347
86742
|
const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
|
|
@@ -86416,7 +86811,7 @@ class BrowserLauncher {
|
|
|
86416
86811
|
browserCloseCallback();
|
|
86417
86812
|
const logs = browserProcess.getRecentLogs().join(`
|
|
86418
86813
|
`);
|
|
86419
|
-
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" &&
|
|
86814
|
+
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync36(join32(launchArgs.userDataDir, "lockfile"))) {
|
|
86420
86815
|
throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
|
|
86421
86816
|
}
|
|
86422
86817
|
if (logs.includes("Missing X server") && options.headless === false) {
|
|
@@ -86506,12 +86901,12 @@ class BrowserLauncher {
|
|
|
86506
86901
|
});
|
|
86507
86902
|
}
|
|
86508
86903
|
getProfilePath() {
|
|
86509
|
-
return
|
|
86904
|
+
return join32(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
|
|
86510
86905
|
}
|
|
86511
86906
|
resolveExecutablePath(headless, validatePath = true) {
|
|
86512
86907
|
let executablePath = this.puppeteer.configuration.executablePath;
|
|
86513
86908
|
if (executablePath) {
|
|
86514
|
-
if (validatePath && !
|
|
86909
|
+
if (validatePath && !existsSync36(executablePath)) {
|
|
86515
86910
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}), but no executable was found.`);
|
|
86516
86911
|
}
|
|
86517
86912
|
return executablePath;
|
|
@@ -86534,7 +86929,7 @@ class BrowserLauncher {
|
|
|
86534
86929
|
browser: browserType,
|
|
86535
86930
|
buildId: this.puppeteer.browserVersion
|
|
86536
86931
|
});
|
|
86537
|
-
if (validatePath && !
|
|
86932
|
+
if (validatePath && !existsSync36(executablePath)) {
|
|
86538
86933
|
const configVersion = this.puppeteer.configuration?.[this.browser]?.version;
|
|
86539
86934
|
if (configVersion) {
|
|
86540
86935
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`);
|
|
@@ -87072,7 +87467,7 @@ var init_PuppeteerNode = __esm(() => {
|
|
|
87072
87467
|
import { spawn as spawn2, spawnSync as spawnSync5 } from "child_process";
|
|
87073
87468
|
import fs5 from "fs";
|
|
87074
87469
|
import os8 from "os";
|
|
87075
|
-
import { dirname as
|
|
87470
|
+
import { dirname as dirname16 } from "path";
|
|
87076
87471
|
import { PassThrough } from "stream";
|
|
87077
87472
|
var import_debug6, __runInitializers22 = function(thisArg, initializers, value) {
|
|
87078
87473
|
var useValue = arguments.length > 2;
|
|
@@ -87146,8 +87541,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
87146
87541
|
static {
|
|
87147
87542
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : undefined;
|
|
87148
87543
|
__esDecorate22(this, _private_writeFrame_descriptor = { value: __setFunctionName5(async function(buffer) {
|
|
87149
|
-
const error = await new Promise((
|
|
87150
|
-
this.#process.stdin.write(buffer,
|
|
87544
|
+
const error = await new Promise((resolve14) => {
|
|
87545
|
+
this.#process.stdin.write(buffer, resolve14);
|
|
87151
87546
|
});
|
|
87152
87547
|
if (error) {
|
|
87153
87548
|
console.log(`ffmpeg failed to write: ${error.message}.`);
|
|
@@ -87196,7 +87591,7 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
87196
87591
|
filters.push(formatArgs.splice(vf, 2).at(-1) ?? "");
|
|
87197
87592
|
}
|
|
87198
87593
|
if (path11) {
|
|
87199
|
-
fs5.mkdirSync(
|
|
87594
|
+
fs5.mkdirSync(dirname16(path11), { recursive: overwrite });
|
|
87200
87595
|
}
|
|
87201
87596
|
this.#process = spawn2(ffmpegPath, [
|
|
87202
87597
|
["-loglevel", "error"],
|
|
@@ -87302,8 +87697,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
87302
87697
|
const [buffer, timestamp] = await this.#lastFrame;
|
|
87303
87698
|
await Promise.all(Array(Math.max(1, Math.round(this.#fps * (performance.now() - timestamp) / 1000))).fill(buffer).map(this.#writeFrame.bind(this)));
|
|
87304
87699
|
this.#process.stdin.end();
|
|
87305
|
-
await new Promise((
|
|
87306
|
-
this.#process.once("close",
|
|
87700
|
+
await new Promise((resolve14) => {
|
|
87701
|
+
this.#process.once("close", resolve14);
|
|
87307
87702
|
});
|
|
87308
87703
|
}
|
|
87309
87704
|
async[(_private_writeFrame_decorators = [guarded()], _stop_decorators = [guarded()], asyncDisposeSymbol)]() {
|
|
@@ -87349,17 +87744,17 @@ var init_puppeteer_core = __esm(() => {
|
|
|
87349
87744
|
});
|
|
87350
87745
|
|
|
87351
87746
|
// src/core/design-eval/capture.ts
|
|
87352
|
-
import { mkdirSync as
|
|
87353
|
-
import { join as
|
|
87747
|
+
import { mkdirSync as mkdirSync16, statSync as statSync14, existsSync as existsSync37 } from "fs";
|
|
87748
|
+
import { join as join33 } from "path";
|
|
87354
87749
|
function findBrowser() {
|
|
87355
87750
|
const platform2 = process.platform;
|
|
87356
87751
|
const paths = CHROME_PATHS[platform2] ?? [];
|
|
87357
87752
|
for (const p of paths) {
|
|
87358
|
-
if (
|
|
87753
|
+
if (existsSync37(p))
|
|
87359
87754
|
return p;
|
|
87360
87755
|
}
|
|
87361
|
-
const minkBrowsers =
|
|
87362
|
-
if (
|
|
87756
|
+
const minkBrowsers = join33(minkRoot(), "browsers");
|
|
87757
|
+
if (existsSync37(minkBrowsers)) {
|
|
87363
87758
|
const found = findChromeInDir(minkBrowsers);
|
|
87364
87759
|
if (found)
|
|
87365
87760
|
return found;
|
|
@@ -87380,7 +87775,7 @@ function findChromeInDir(dir) {
|
|
|
87380
87775
|
try {
|
|
87381
87776
|
const entries = readdirSync12(dir);
|
|
87382
87777
|
for (const entry of entries) {
|
|
87383
|
-
const full =
|
|
87778
|
+
const full = join33(dir, entry);
|
|
87384
87779
|
try {
|
|
87385
87780
|
const stat2 = statSync15(full);
|
|
87386
87781
|
if (stat2.isDirectory()) {
|
|
@@ -87428,7 +87823,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
87428
87823
|
const y = section * viewport.height;
|
|
87429
87824
|
const clipHeight = Math.min(viewport.height, pageHeight - y);
|
|
87430
87825
|
const fileName = `${prefix}-${viewport.name}-${section}.jpg`;
|
|
87431
|
-
const filePath =
|
|
87826
|
+
const filePath = join33(options.outputDir, fileName);
|
|
87432
87827
|
await page.screenshot({
|
|
87433
87828
|
path: filePath,
|
|
87434
87829
|
type: "jpeg",
|
|
@@ -87460,7 +87855,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
87460
87855
|
return results;
|
|
87461
87856
|
}
|
|
87462
87857
|
async function captureAllRoutes(routes, baseUrl, viewports, options, outputDir) {
|
|
87463
|
-
|
|
87858
|
+
mkdirSync16(outputDir, { recursive: true });
|
|
87464
87859
|
const executablePath = findBrowser();
|
|
87465
87860
|
const browser = await puppeteer_core_default.launch({
|
|
87466
87861
|
executablePath,
|
|
@@ -88897,9 +89292,9 @@ var exports_wiki = {};
|
|
|
88897
89292
|
__export(exports_wiki, {
|
|
88898
89293
|
wiki: () => wiki
|
|
88899
89294
|
});
|
|
88900
|
-
import { existsSync as
|
|
88901
|
-
import { resolve as
|
|
88902
|
-
import { homedir as
|
|
89295
|
+
import { existsSync as existsSync38, statSync as statSync15 } from "fs";
|
|
89296
|
+
import { resolve as resolve14 } from "path";
|
|
89297
|
+
import { homedir as homedir5 } from "os";
|
|
88903
89298
|
async function wiki(_cwd, args) {
|
|
88904
89299
|
const sub = args[0];
|
|
88905
89300
|
switch (sub) {
|
|
@@ -88955,7 +89350,7 @@ async function wikiInit(args) {
|
|
|
88955
89350
|
console.log(`[mink] initializing vault at ${targetPath}`);
|
|
88956
89351
|
console.log(" (set a custom path with: mink wiki init /path/to/vault)");
|
|
88957
89352
|
}
|
|
88958
|
-
const isExisting =
|
|
89353
|
+
const isExisting = existsSync38(targetPath) && statSync15(targetPath).isDirectory();
|
|
88959
89354
|
setConfigValue("wiki.path", targetPath);
|
|
88960
89355
|
ensureVaultStructure();
|
|
88961
89356
|
seedTemplates(vaultTemplates());
|
|
@@ -89165,9 +89560,9 @@ function wikiLinks() {
|
|
|
89165
89560
|
}
|
|
89166
89561
|
function expandPath(raw) {
|
|
89167
89562
|
if (raw.startsWith("~/")) {
|
|
89168
|
-
return
|
|
89563
|
+
return resolve14(homedir5(), raw.slice(2));
|
|
89169
89564
|
}
|
|
89170
|
-
return
|
|
89565
|
+
return resolve14(raw);
|
|
89171
89566
|
}
|
|
89172
89567
|
var init_wiki = __esm(() => {
|
|
89173
89568
|
init_vault();
|
|
@@ -89183,8 +89578,8 @@ var exports_note = {};
|
|
|
89183
89578
|
__export(exports_note, {
|
|
89184
89579
|
note: () => note
|
|
89185
89580
|
});
|
|
89186
|
-
import { resolve as
|
|
89187
|
-
import { existsSync as
|
|
89581
|
+
import { resolve as resolve15 } from "path";
|
|
89582
|
+
import { existsSync as existsSync39, readFileSync as readFileSync29 } from "fs";
|
|
89188
89583
|
async function note(cwd, args) {
|
|
89189
89584
|
if (!isWikiEnabled()) {
|
|
89190
89585
|
console.error("[mink] wiki feature is disabled");
|
|
@@ -89214,8 +89609,8 @@ async function note(cwd, args) {
|
|
|
89214
89609
|
return;
|
|
89215
89610
|
}
|
|
89216
89611
|
if (parsed.file) {
|
|
89217
|
-
const sourcePath =
|
|
89218
|
-
if (!
|
|
89612
|
+
const sourcePath = resolve15(cwd, parsed.file);
|
|
89613
|
+
if (!existsSync39(sourcePath)) {
|
|
89219
89614
|
console.error(`[mink] file not found: ${sourcePath}`);
|
|
89220
89615
|
process.exit(1);
|
|
89221
89616
|
}
|
|
@@ -89376,39 +89771,39 @@ var exports_skill = {};
|
|
|
89376
89771
|
__export(exports_skill, {
|
|
89377
89772
|
skill: () => skill
|
|
89378
89773
|
});
|
|
89379
|
-
import { join as
|
|
89380
|
-
import { homedir as
|
|
89774
|
+
import { join as join34, resolve as resolve16, dirname as dirname17 } from "path";
|
|
89775
|
+
import { homedir as homedir6 } from "os";
|
|
89381
89776
|
import {
|
|
89382
|
-
existsSync as
|
|
89383
|
-
mkdirSync as
|
|
89384
|
-
copyFileSync,
|
|
89777
|
+
existsSync as existsSync40,
|
|
89778
|
+
mkdirSync as mkdirSync17,
|
|
89779
|
+
copyFileSync as copyFileSync2,
|
|
89385
89780
|
unlinkSync as unlinkSync6,
|
|
89386
89781
|
readdirSync as readdirSync12,
|
|
89387
|
-
rmSync as
|
|
89782
|
+
rmSync as rmSync3,
|
|
89388
89783
|
symlinkSync as symlinkSync2,
|
|
89389
89784
|
lstatSync as lstatSync2
|
|
89390
89785
|
} from "fs";
|
|
89391
89786
|
function getSkillsSourceDir() {
|
|
89392
|
-
let dir =
|
|
89787
|
+
let dir = dirname17(new URL(import.meta.url).pathname);
|
|
89393
89788
|
while (true) {
|
|
89394
|
-
if (
|
|
89395
|
-
return
|
|
89789
|
+
if (existsSync40(join34(dir, "package.json")) && existsSync40(join34(dir, "skills"))) {
|
|
89790
|
+
return join34(dir, "skills");
|
|
89396
89791
|
}
|
|
89397
|
-
const parent =
|
|
89792
|
+
const parent = dirname17(dir);
|
|
89398
89793
|
if (parent === dir)
|
|
89399
89794
|
break;
|
|
89400
89795
|
dir = parent;
|
|
89401
89796
|
}
|
|
89402
|
-
return
|
|
89797
|
+
return resolve16(dirname17(new URL(import.meta.url).pathname), "../../skills");
|
|
89403
89798
|
}
|
|
89404
89799
|
function getAvailableSkills() {
|
|
89405
89800
|
const dir = getSkillsSourceDir();
|
|
89406
|
-
if (!
|
|
89801
|
+
if (!existsSync40(dir))
|
|
89407
89802
|
return [];
|
|
89408
|
-
return readdirSync12(dir, { withFileTypes: true }).filter((d) => d.isDirectory() &&
|
|
89803
|
+
return readdirSync12(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync40(join34(dir, d.name, "SKILL.md"))).map((d) => d.name);
|
|
89409
89804
|
}
|
|
89410
89805
|
function isInstalled(skillName) {
|
|
89411
|
-
return
|
|
89806
|
+
return existsSync40(join34(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
|
|
89412
89807
|
}
|
|
89413
89808
|
async function skill(args) {
|
|
89414
89809
|
const sub = args[0];
|
|
@@ -89442,28 +89837,28 @@ function skillInstall(name) {
|
|
|
89442
89837
|
console.error(" Expected skills at: " + sourceDir);
|
|
89443
89838
|
return;
|
|
89444
89839
|
}
|
|
89445
|
-
|
|
89840
|
+
mkdirSync17(AGENTS_SKILLS_DIR, { recursive: true });
|
|
89446
89841
|
for (const skillName of skills) {
|
|
89447
|
-
const srcDir =
|
|
89448
|
-
const srcFile =
|
|
89449
|
-
const destDir =
|
|
89450
|
-
if (!
|
|
89842
|
+
const srcDir = join34(sourceDir, skillName);
|
|
89843
|
+
const srcFile = join34(srcDir, "SKILL.md");
|
|
89844
|
+
const destDir = join34(AGENTS_SKILLS_DIR, skillName);
|
|
89845
|
+
if (!existsSync40(srcFile)) {
|
|
89451
89846
|
console.error(`[mink] skill not found: ${skillName}`);
|
|
89452
89847
|
continue;
|
|
89453
89848
|
}
|
|
89454
|
-
|
|
89849
|
+
mkdirSync17(destDir, { recursive: true });
|
|
89455
89850
|
copyDirRecursive2(srcDir, destDir);
|
|
89456
|
-
|
|
89457
|
-
const symlink =
|
|
89851
|
+
mkdirSync17(CLAUDE_SKILLS_DIR, { recursive: true });
|
|
89852
|
+
const symlink = join34(CLAUDE_SKILLS_DIR, skillName);
|
|
89458
89853
|
try {
|
|
89459
|
-
if (
|
|
89854
|
+
if (existsSync40(symlink)) {
|
|
89460
89855
|
if (lstatSync2(symlink).isSymbolicLink() || lstatSync2(symlink).isFile()) {
|
|
89461
89856
|
unlinkSync6(symlink);
|
|
89462
89857
|
} else {
|
|
89463
|
-
|
|
89858
|
+
rmSync3(symlink, { recursive: true, force: true });
|
|
89464
89859
|
}
|
|
89465
89860
|
}
|
|
89466
|
-
const relativeTarget =
|
|
89861
|
+
const relativeTarget = join34("..", "..", ".agents", "skills", skillName);
|
|
89467
89862
|
symlinkSync2(relativeTarget, symlink);
|
|
89468
89863
|
} catch {}
|
|
89469
89864
|
console.log(`[mink] installed: ${skillName} -> ${destDir}`);
|
|
@@ -89474,15 +89869,15 @@ function skillInstall(name) {
|
|
|
89474
89869
|
function skillUninstall(name) {
|
|
89475
89870
|
const skills = name ? [name] : getAvailableSkills();
|
|
89476
89871
|
for (const skillName of skills) {
|
|
89477
|
-
const destDir =
|
|
89478
|
-
if (!
|
|
89872
|
+
const destDir = join34(AGENTS_SKILLS_DIR, skillName);
|
|
89873
|
+
if (!existsSync40(destDir)) {
|
|
89479
89874
|
console.log(`[mink] not installed: ${skillName}`);
|
|
89480
89875
|
continue;
|
|
89481
89876
|
}
|
|
89482
|
-
|
|
89483
|
-
const symlink =
|
|
89877
|
+
rmSync3(destDir, { recursive: true, force: true });
|
|
89878
|
+
const symlink = join34(CLAUDE_SKILLS_DIR, skillName);
|
|
89484
89879
|
try {
|
|
89485
|
-
if (
|
|
89880
|
+
if (existsSync40(symlink))
|
|
89486
89881
|
unlinkSync6(symlink);
|
|
89487
89882
|
} catch {}
|
|
89488
89883
|
console.log(`[mink] uninstalled: ${skillName}`);
|
|
@@ -89497,7 +89892,7 @@ function skillList() {
|
|
|
89497
89892
|
if (installed.length > 0) {
|
|
89498
89893
|
console.log(" Installed:");
|
|
89499
89894
|
for (const s of installed) {
|
|
89500
|
-
console.log(` ${s} (${
|
|
89895
|
+
console.log(` ${s} (${join34(AGENTS_SKILLS_DIR, s)})`);
|
|
89501
89896
|
}
|
|
89502
89897
|
}
|
|
89503
89898
|
if (notInstalled.length > 0) {
|
|
@@ -89516,20 +89911,20 @@ function skillList() {
|
|
|
89516
89911
|
function copyDirRecursive2(src, dest) {
|
|
89517
89912
|
const entries = readdirSync12(src, { withFileTypes: true });
|
|
89518
89913
|
for (const entry of entries) {
|
|
89519
|
-
const srcPath =
|
|
89520
|
-
const destPath =
|
|
89914
|
+
const srcPath = join34(src, entry.name);
|
|
89915
|
+
const destPath = join34(dest, entry.name);
|
|
89521
89916
|
if (entry.isDirectory()) {
|
|
89522
|
-
|
|
89917
|
+
mkdirSync17(destPath, { recursive: true });
|
|
89523
89918
|
copyDirRecursive2(srcPath, destPath);
|
|
89524
89919
|
} else {
|
|
89525
|
-
|
|
89920
|
+
copyFileSync2(srcPath, destPath);
|
|
89526
89921
|
}
|
|
89527
89922
|
}
|
|
89528
89923
|
}
|
|
89529
89924
|
var AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR;
|
|
89530
89925
|
var init_skill = __esm(() => {
|
|
89531
|
-
AGENTS_SKILLS_DIR =
|
|
89532
|
-
CLAUDE_SKILLS_DIR =
|
|
89926
|
+
AGENTS_SKILLS_DIR = join34(homedir6(), ".agents", "skills");
|
|
89927
|
+
CLAUDE_SKILLS_DIR = join34(homedir6(), ".claude", "skills");
|
|
89533
89928
|
});
|
|
89534
89929
|
|
|
89535
89930
|
// src/commands/agent.ts
|
|
@@ -89537,41 +89932,41 @@ var exports_agent = {};
|
|
|
89537
89932
|
__export(exports_agent, {
|
|
89538
89933
|
agent: () => agent
|
|
89539
89934
|
});
|
|
89540
|
-
import { join as
|
|
89541
|
-
import { homedir as
|
|
89935
|
+
import { join as join35, resolve as resolve17, dirname as dirname18 } from "path";
|
|
89936
|
+
import { homedir as homedir7 } from "os";
|
|
89542
89937
|
import {
|
|
89543
|
-
existsSync as
|
|
89544
|
-
mkdirSync as
|
|
89938
|
+
existsSync as existsSync41,
|
|
89939
|
+
mkdirSync as mkdirSync18,
|
|
89545
89940
|
readFileSync as readFileSync30,
|
|
89546
89941
|
writeFileSync as writeFileSync11
|
|
89547
89942
|
} from "fs";
|
|
89548
89943
|
import { createHash as createHash4 } from "crypto";
|
|
89549
89944
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
89550
89945
|
function getAgentTemplatePath() {
|
|
89551
|
-
let dir =
|
|
89946
|
+
let dir = dirname18(new URL(import.meta.url).pathname);
|
|
89552
89947
|
while (true) {
|
|
89553
|
-
if (
|
|
89554
|
-
return
|
|
89948
|
+
if (existsSync41(join35(dir, "package.json")) && existsSync41(join35(dir, "agents", TEMPLATE_FILE))) {
|
|
89949
|
+
return join35(dir, "agents", TEMPLATE_FILE);
|
|
89555
89950
|
}
|
|
89556
|
-
const parent =
|
|
89951
|
+
const parent = dirname18(dir);
|
|
89557
89952
|
if (parent === dir)
|
|
89558
89953
|
break;
|
|
89559
89954
|
dir = parent;
|
|
89560
89955
|
}
|
|
89561
|
-
return
|
|
89956
|
+
return resolve17(dirname18(new URL(import.meta.url).pathname), "../../agents", TEMPLATE_FILE);
|
|
89562
89957
|
}
|
|
89563
89958
|
function getMinkVersion() {
|
|
89564
|
-
let dir =
|
|
89959
|
+
let dir = dirname18(new URL(import.meta.url).pathname);
|
|
89565
89960
|
while (true) {
|
|
89566
|
-
const pkgPath =
|
|
89567
|
-
if (
|
|
89961
|
+
const pkgPath = join35(dir, "package.json");
|
|
89962
|
+
if (existsSync41(pkgPath)) {
|
|
89568
89963
|
try {
|
|
89569
89964
|
const pkg = JSON.parse(readFileSync30(pkgPath, "utf-8"));
|
|
89570
89965
|
if (pkg.name && pkg.version)
|
|
89571
89966
|
return pkg.version;
|
|
89572
89967
|
} catch {}
|
|
89573
89968
|
}
|
|
89574
|
-
const parent =
|
|
89969
|
+
const parent = dirname18(dir);
|
|
89575
89970
|
if (parent === dir)
|
|
89576
89971
|
break;
|
|
89577
89972
|
dir = parent;
|
|
@@ -89589,19 +89984,19 @@ function sha2562(text) {
|
|
|
89589
89984
|
return createHash4("sha256").update(text).digest("hex");
|
|
89590
89985
|
}
|
|
89591
89986
|
function claudeAgentsDir() {
|
|
89592
|
-
return
|
|
89987
|
+
return join35(homedir7(), ".claude", "agents");
|
|
89593
89988
|
}
|
|
89594
89989
|
function installedAgentPath() {
|
|
89595
|
-
return
|
|
89990
|
+
return join35(claudeAgentsDir(), INSTALLED_FILE);
|
|
89596
89991
|
}
|
|
89597
89992
|
function installAgentDefinition(opts) {
|
|
89598
89993
|
const templatePath = getAgentTemplatePath();
|
|
89599
|
-
if (!
|
|
89994
|
+
if (!existsSync41(templatePath)) {
|
|
89600
89995
|
throw new Error(`[mink agent] bundled agent template not found at ${templatePath}
|
|
89601
89996
|
` + " This usually means the package was installed without bundled assets.");
|
|
89602
89997
|
}
|
|
89603
89998
|
const installed = installedAgentPath();
|
|
89604
|
-
if (opts.skip &&
|
|
89999
|
+
if (opts.skip && existsSync41(installed)) {
|
|
89605
90000
|
return { action: "skipped", path: installed };
|
|
89606
90001
|
}
|
|
89607
90002
|
const template = readFileSync30(templatePath, "utf-8");
|
|
@@ -89610,14 +90005,14 @@ function installAgentDefinition(opts) {
|
|
|
89610
90005
|
VAULT_PATH: resolveVaultPath(),
|
|
89611
90006
|
MINK_VERSION: getMinkVersion()
|
|
89612
90007
|
});
|
|
89613
|
-
const exists =
|
|
90008
|
+
const exists = existsSync41(installed);
|
|
89614
90009
|
if (!opts.force && exists) {
|
|
89615
90010
|
const current = readFileSync30(installed, "utf-8");
|
|
89616
90011
|
if (sha2562(current) === sha2562(rendered)) {
|
|
89617
90012
|
return { action: "unchanged", path: installed };
|
|
89618
90013
|
}
|
|
89619
90014
|
}
|
|
89620
|
-
|
|
90015
|
+
mkdirSync18(claudeAgentsDir(), { recursive: true });
|
|
89621
90016
|
writeFileSync11(installed, rendered);
|
|
89622
90017
|
return {
|
|
89623
90018
|
action: exists ? "updated" : "installed",
|
|
@@ -89688,8 +90083,8 @@ async function agent(_cwd, rawArgs) {
|
|
|
89688
90083
|
}
|
|
89689
90084
|
const skipUpdate = args.noUpdate || process.env.MINK_AGENT_NO_UPDATE === "1";
|
|
89690
90085
|
const root = minkRoot();
|
|
89691
|
-
if (!
|
|
89692
|
-
|
|
90086
|
+
if (!existsSync41(root)) {
|
|
90087
|
+
mkdirSync18(root, { recursive: true });
|
|
89693
90088
|
}
|
|
89694
90089
|
let result;
|
|
89695
90090
|
try {
|
|
@@ -89740,13 +90135,13 @@ var init_agent = __esm(() => {
|
|
|
89740
90135
|
});
|
|
89741
90136
|
|
|
89742
90137
|
// src/core/sync-merge-drivers.ts
|
|
89743
|
-
import { readFileSync as readFileSync31, writeFileSync as writeFileSync12, appendFileSync as appendFileSync2, copyFileSync as
|
|
89744
|
-
import { join as
|
|
90138
|
+
import { readFileSync as readFileSync31, writeFileSync as writeFileSync12, appendFileSync as appendFileSync2, copyFileSync as copyFileSync3, renameSync as renameSync4, unlinkSync as unlinkSync7 } from "fs";
|
|
90139
|
+
import { join as join36 } from "path";
|
|
89745
90140
|
function logWarning(driver, args, err) {
|
|
89746
90141
|
try {
|
|
89747
90142
|
const line = `[${new Date().toISOString()}] ${driver} fallback for ${args.filePath}: ${err instanceof Error ? err.message : String(err)}
|
|
89748
90143
|
`;
|
|
89749
|
-
appendFileSync2(
|
|
90144
|
+
appendFileSync2(join36(minkRoot(), "sync-warnings.log"), line);
|
|
89750
90145
|
} catch {}
|
|
89751
90146
|
}
|
|
89752
90147
|
function readJsonOrNull(path12) {
|
|
@@ -89981,7 +90376,7 @@ function mergeDbDriver(args) {
|
|
|
89981
90376
|
const tmp = `${args.oursPath}.merge-${process.pid}-${Date.now()}.tmp`;
|
|
89982
90377
|
let ours = null;
|
|
89983
90378
|
try {
|
|
89984
|
-
|
|
90379
|
+
copyFileSync3(args.oursPath, tmp);
|
|
89985
90380
|
ours = openDriver(tmp);
|
|
89986
90381
|
ours.exec("PRAGMA journal_mode = WAL");
|
|
89987
90382
|
ours.exec("PRAGMA foreign_keys = ON");
|
|
@@ -90497,8 +90892,22 @@ switch (command2) {
|
|
|
90497
90892
|
sessionStop(sessionPath(cwd));
|
|
90498
90893
|
break;
|
|
90499
90894
|
case "init": {
|
|
90500
|
-
const { init: init2 } = await Promise.resolve().then(() => (init_init(), exports_init));
|
|
90501
|
-
|
|
90895
|
+
const { init: init2, resolveTargetsFromFlag: resolveTargetsFromFlag2 } = await Promise.resolve().then(() => (init_init(), exports_init));
|
|
90896
|
+
const args = process.argv.slice(3);
|
|
90897
|
+
const agentFlagIndex = args.findIndex((a) => a === "--agent" || a.startsWith("--agent="));
|
|
90898
|
+
let agentValue;
|
|
90899
|
+
if (agentFlagIndex !== -1) {
|
|
90900
|
+
const a = args[agentFlagIndex];
|
|
90901
|
+
agentValue = a.includes("=") ? a.split("=").slice(1).join("=") : args[agentFlagIndex + 1];
|
|
90902
|
+
}
|
|
90903
|
+
const yes = args.includes("--yes") || args.includes("-y");
|
|
90904
|
+
const targets = agentValue ? resolveTargetsFromFlag2(agentValue) : undefined;
|
|
90905
|
+
if (agentValue && (!targets || targets.length === 0)) {
|
|
90906
|
+
console.error(`[mink] unknown --agent value: ${agentValue}`);
|
|
90907
|
+
console.error(" Valid: claude, pi, all (or a comma-separated list)");
|
|
90908
|
+
process.exit(1);
|
|
90909
|
+
}
|
|
90910
|
+
await init2(cwd, { targets, interactive: !yes });
|
|
90502
90911
|
break;
|
|
90503
90912
|
}
|
|
90504
90913
|
case "status": {
|
|
@@ -90642,12 +91051,12 @@ switch (command2) {
|
|
|
90642
91051
|
case "version":
|
|
90643
91052
|
case "--version":
|
|
90644
91053
|
case "-v": {
|
|
90645
|
-
const { resolve:
|
|
91054
|
+
const { resolve: resolve18, dirname: dirname19, basename: basename9 } = await import("path");
|
|
90646
91055
|
const bundlePath = new URL(import.meta.url).pathname;
|
|
90647
|
-
const cliPath =
|
|
91056
|
+
const cliPath = resolve18(dirname19(bundlePath));
|
|
90648
91057
|
const { readFileSync: readFileSync32 } = await import("fs");
|
|
90649
91058
|
try {
|
|
90650
|
-
const pkg = JSON.parse(readFileSync32(
|
|
91059
|
+
const pkg = JSON.parse(readFileSync32(resolve18(cliPath, "../package.json"), "utf-8"));
|
|
90651
91060
|
console.log(`mink ${pkg.version}`);
|
|
90652
91061
|
} catch {
|
|
90653
91062
|
console.log("mink (unknown version)");
|
|
@@ -90670,7 +91079,8 @@ switch (command2) {
|
|
|
90670
91079
|
console.log("Usage: mink <command> [options]");
|
|
90671
91080
|
console.log();
|
|
90672
91081
|
console.log("Commands:");
|
|
90673
|
-
console.log(" init
|
|
91082
|
+
console.log(" init [--agent X] [--yes] Initialize Mink in the current project");
|
|
91083
|
+
console.log(" --agent claude|pi|all (default: detect & prompt)");
|
|
90674
91084
|
console.log(" status Display project health at a glance");
|
|
90675
91085
|
console.log(" scan [--check] Force a full file index rescan");
|
|
90676
91086
|
console.log(" config [key] [value] Manage global user settings");
|