@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.node.js
CHANGED
|
@@ -4897,6 +4897,342 @@ var init_paths2 = __esm(() => {
|
|
|
4897
4897
|
MINK_ROOT2 = resolveMinkRoot2();
|
|
4898
4898
|
});
|
|
4899
4899
|
|
|
4900
|
+
// src/core/agent-detect.ts
|
|
4901
|
+
import { execSync as execSync5 } from "child_process";
|
|
4902
|
+
import { existsSync as existsSync18 } from "fs";
|
|
4903
|
+
import { join as join15 } from "path";
|
|
4904
|
+
import { homedir as homedir4 } from "os";
|
|
4905
|
+
function commandExists(bin) {
|
|
4906
|
+
try {
|
|
4907
|
+
const probe = process.platform === "win32" ? `where ${bin}` : `command -v ${bin}`;
|
|
4908
|
+
execSync5(probe, { stdio: "ignore" });
|
|
4909
|
+
return true;
|
|
4910
|
+
} catch {
|
|
4911
|
+
return false;
|
|
4912
|
+
}
|
|
4913
|
+
}
|
|
4914
|
+
function detectAgent(meta, cwd) {
|
|
4915
|
+
const signals = [];
|
|
4916
|
+
if (existsSync18(join15(cwd, meta.projectDir))) {
|
|
4917
|
+
signals.push(`project config (${meta.projectDir}/)`);
|
|
4918
|
+
}
|
|
4919
|
+
if (existsSync18(meta.globalDir)) {
|
|
4920
|
+
signals.push("global config");
|
|
4921
|
+
}
|
|
4922
|
+
if (commandExists(meta.bin)) {
|
|
4923
|
+
signals.push("on PATH");
|
|
4924
|
+
}
|
|
4925
|
+
return { ...meta, detected: signals.length > 0, signals };
|
|
4926
|
+
}
|
|
4927
|
+
function detectAgents(cwd) {
|
|
4928
|
+
return AGENTS.map((m) => detectAgent(m, cwd));
|
|
4929
|
+
}
|
|
4930
|
+
function resolveTargetsFromFlag(flag) {
|
|
4931
|
+
const normalized = flag.trim().toLowerCase();
|
|
4932
|
+
if (normalized === "all")
|
|
4933
|
+
return AGENTS.map((a) => a.id);
|
|
4934
|
+
const ids = normalized.split(",").map((s) => s.trim()).filter(Boolean);
|
|
4935
|
+
const valid = AGENTS.map((a) => a.id);
|
|
4936
|
+
const resolved = ids.filter((id) => valid.includes(id));
|
|
4937
|
+
return resolved;
|
|
4938
|
+
}
|
|
4939
|
+
var AGENTS;
|
|
4940
|
+
var init_agent_detect = __esm(() => {
|
|
4941
|
+
AGENTS = [
|
|
4942
|
+
{
|
|
4943
|
+
id: "claude",
|
|
4944
|
+
label: "Claude Code",
|
|
4945
|
+
projectDir: ".claude",
|
|
4946
|
+
globalDir: join15(homedir4(), ".claude"),
|
|
4947
|
+
bin: "claude"
|
|
4948
|
+
},
|
|
4949
|
+
{
|
|
4950
|
+
id: "pi",
|
|
4951
|
+
label: "Pi",
|
|
4952
|
+
projectDir: ".pi",
|
|
4953
|
+
globalDir: join15(homedir4(), ".pi"),
|
|
4954
|
+
bin: "pi"
|
|
4955
|
+
}
|
|
4956
|
+
];
|
|
4957
|
+
});
|
|
4958
|
+
|
|
4959
|
+
// src/core/agent-pi.ts
|
|
4960
|
+
import { join as join16, resolve as resolve2, dirname as dirname7 } from "path";
|
|
4961
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync8, copyFileSync, rmSync as rmSync2 } from "fs";
|
|
4962
|
+
function piExtensionPath(cwd) {
|
|
4963
|
+
return join16(cwd, ".pi", "extensions", "mink.ts");
|
|
4964
|
+
}
|
|
4965
|
+
function piGuidanceSkillPath(cwd) {
|
|
4966
|
+
return join16(cwd, ".pi", "skills", "mink", "SKILL.md");
|
|
4967
|
+
}
|
|
4968
|
+
function piNoteSkillPath(cwd) {
|
|
4969
|
+
return join16(cwd, ".pi", "skills", "mink-note", "SKILL.md");
|
|
4970
|
+
}
|
|
4971
|
+
function buildPiExtension(cliPath) {
|
|
4972
|
+
const isTsSource = cliPath.endsWith(".ts");
|
|
4973
|
+
const cmd = isTsSource ? "bun" : "mink";
|
|
4974
|
+
const baseArgs = isTsSource ? JSON.stringify(["run", cliPath]) : "[]";
|
|
4975
|
+
return `// AUTO-GENERATED by \`mink init\`. Do not edit — re-run \`mink init\` to refresh.
|
|
4976
|
+
//
|
|
4977
|
+
// Mink adapter for the Pi coding agent. Routes Pi lifecycle and tool events
|
|
4978
|
+
// into the \`mink\` CLI so Pi shares the same ~/.mink state, file index, ledger,
|
|
4979
|
+
// and wiki as every other assistant wired to this project.
|
|
4980
|
+
//
|
|
4981
|
+
// Field shapes confirmed against pi source (earendil-works/pi,
|
|
4982
|
+
// packages/coding-agent): read params {path, offset, limit}; write {path,
|
|
4983
|
+
// content}; edit {path, edits:[{oldText,newText}]} (with legacy file_path /
|
|
4984
|
+
// top-level oldText,newText). tool_call/tool_result events expose toolName,
|
|
4985
|
+
// toolCallId, input; tool_result also exposes content (a content-block array),
|
|
4986
|
+
// details, isError. Advisories are surfaced by returning a modified result from
|
|
4987
|
+
// the tool_result handler — the documented mechanism. pi.exec has no stdin, so
|
|
4988
|
+
// the canonical payload is piped to \`mink\` via a spawned child process. Every
|
|
4989
|
+
// host-API access is defensive: the adapter never throws into Pi or blocks a
|
|
4990
|
+
// tool — a failure degrades to "no advisory".
|
|
4991
|
+
|
|
4992
|
+
import { spawn } from "node:child_process";
|
|
4993
|
+
|
|
4994
|
+
const MINK_CMD = ${JSON.stringify(cmd)};
|
|
4995
|
+
const MINK_BASE_ARGS = ${baseArgs};
|
|
4996
|
+
const TIMEOUT_MS = 5000;
|
|
4997
|
+
|
|
4998
|
+
function runMink(sub, payload, cwd) {
|
|
4999
|
+
return new Promise((res) => {
|
|
5000
|
+
let done = false;
|
|
5001
|
+
const finish = (out) => {
|
|
5002
|
+
if (done) return;
|
|
5003
|
+
done = true;
|
|
5004
|
+
res(out);
|
|
5005
|
+
};
|
|
5006
|
+
try {
|
|
5007
|
+
const child = spawn(MINK_CMD, [...MINK_BASE_ARGS, sub], {
|
|
5008
|
+
cwd,
|
|
5009
|
+
stdio: ["pipe", "ignore", "pipe"],
|
|
5010
|
+
});
|
|
5011
|
+
let stderr = "";
|
|
5012
|
+
child.stderr?.on("data", (d) => {
|
|
5013
|
+
stderr += d.toString();
|
|
5014
|
+
});
|
|
5015
|
+
child.on("error", () => finish(""));
|
|
5016
|
+
child.on("close", () => finish(stderr.trim()));
|
|
5017
|
+
const timer = setTimeout(() => {
|
|
5018
|
+
try {
|
|
5019
|
+
child.kill();
|
|
5020
|
+
} catch {}
|
|
5021
|
+
finish("");
|
|
5022
|
+
}, TIMEOUT_MS);
|
|
5023
|
+
timer.unref?.();
|
|
5024
|
+
try {
|
|
5025
|
+
child.stdin?.end(payload ? JSON.stringify(payload) : "");
|
|
5026
|
+
} catch {}
|
|
5027
|
+
} catch {
|
|
5028
|
+
finish("");
|
|
5029
|
+
}
|
|
5030
|
+
});
|
|
5031
|
+
}
|
|
5032
|
+
|
|
5033
|
+
// Pi's edit tool takes an array of { oldText, newText } replacements (legacy
|
|
5034
|
+
// inputs may put oldText/newText/new_string at the top level). Concatenate the
|
|
5035
|
+
// replacement text so Mink's write-enforcement sees everything being written.
|
|
5036
|
+
function editNewText(input) {
|
|
5037
|
+
if (Array.isArray(input.edits)) {
|
|
5038
|
+
return input.edits
|
|
5039
|
+
.map((e) => e?.newText ?? e?.new_string ?? "")
|
|
5040
|
+
.filter(Boolean)
|
|
5041
|
+
.join("\\n");
|
|
5042
|
+
}
|
|
5043
|
+
return input.newText ?? input.new_string ?? input.replacement ?? "";
|
|
5044
|
+
}
|
|
5045
|
+
|
|
5046
|
+
// Resolve Pi's tool name + arguments to Mink's canonical operation. Only the
|
|
5047
|
+
// three file operations matter; anything else returns null and is ignored.
|
|
5048
|
+
function toolInfo(event) {
|
|
5049
|
+
const name = String(event?.toolName ?? event?.tool ?? event?.name ?? "").toLowerCase();
|
|
5050
|
+
const input = event?.input ?? event?.arguments ?? {};
|
|
5051
|
+
const filePath = input.path ?? input.file_path ?? input.filePath;
|
|
5052
|
+
if (!filePath) return null;
|
|
5053
|
+
if (name === "read") return { op: "read", filePath };
|
|
5054
|
+
if (name === "write") return { op: "write", filePath, content: input.content ?? input.text ?? "" };
|
|
5055
|
+
if (name === "edit") return { op: "edit", filePath, newString: editNewText(input) };
|
|
5056
|
+
return null;
|
|
5057
|
+
}
|
|
5058
|
+
|
|
5059
|
+
// A tool_result's content is an array of content blocks ({ type, text }); pull
|
|
5060
|
+
// the text out so Mink's post-read can estimate tokens from real content.
|
|
5061
|
+
function resultContent(event) {
|
|
5062
|
+
const c = event?.content;
|
|
5063
|
+
if (typeof c === "string") return c;
|
|
5064
|
+
if (Array.isArray(c)) {
|
|
5065
|
+
const text = c
|
|
5066
|
+
.map((b) => (typeof b === "string" ? b : b?.text ?? ""))
|
|
5067
|
+
.filter(Boolean)
|
|
5068
|
+
.join("\\n");
|
|
5069
|
+
return text || null;
|
|
5070
|
+
}
|
|
5071
|
+
return null;
|
|
5072
|
+
}
|
|
5073
|
+
|
|
5074
|
+
function prePayload(info) {
|
|
5075
|
+
if (info.op === "read")
|
|
5076
|
+
return { sub: "pre-read", payload: { tool_name: "Read", tool_input: { file_path: info.filePath } } };
|
|
5077
|
+
if (info.op === "write")
|
|
5078
|
+
return {
|
|
5079
|
+
sub: "pre-write",
|
|
5080
|
+
payload: { tool_name: "Write", tool_input: { file_path: info.filePath, content: info.content } },
|
|
5081
|
+
};
|
|
5082
|
+
return {
|
|
5083
|
+
sub: "pre-write",
|
|
5084
|
+
payload: { tool_name: "Edit", tool_input: { file_path: info.filePath, new_string: info.newString } },
|
|
5085
|
+
};
|
|
5086
|
+
}
|
|
5087
|
+
|
|
5088
|
+
function postPayload(info, content) {
|
|
5089
|
+
if (info.op === "read")
|
|
5090
|
+
return {
|
|
5091
|
+
sub: "post-read",
|
|
5092
|
+
payload: {
|
|
5093
|
+
tool_name: "Read",
|
|
5094
|
+
tool_input: { file_path: info.filePath },
|
|
5095
|
+
tool_output: content == null ? undefined : { content },
|
|
5096
|
+
},
|
|
5097
|
+
};
|
|
5098
|
+
if (info.op === "write")
|
|
5099
|
+
return {
|
|
5100
|
+
sub: "post-write",
|
|
5101
|
+
payload: { tool_name: "Write", tool_input: { file_path: info.filePath, content: info.content } },
|
|
5102
|
+
};
|
|
5103
|
+
return {
|
|
5104
|
+
sub: "post-write",
|
|
5105
|
+
payload: { tool_name: "Edit", tool_input: { file_path: info.filePath, new_string: info.newString } },
|
|
5106
|
+
};
|
|
5107
|
+
}
|
|
5108
|
+
|
|
5109
|
+
export default function (pi) {
|
|
5110
|
+
const cwd = pi?.ctx?.cwd || process.cwd();
|
|
5111
|
+
const pending = new Map();
|
|
5112
|
+
const keyOf = (event) => event?.toolCallId ?? event?.id ?? event?.callId ?? "";
|
|
5113
|
+
|
|
5114
|
+
pi.on?.("session_start", (event) => {
|
|
5115
|
+
// Skip hot-reloads so an extension reload mid-task doesn't reset the
|
|
5116
|
+
// ephemeral session state; every genuinely new/resumed session starts fresh.
|
|
5117
|
+
if (event?.reason === "reload") return;
|
|
5118
|
+
void runMink("session-start", null, cwd);
|
|
5119
|
+
});
|
|
5120
|
+
pi.on?.("agent_end", () => {
|
|
5121
|
+
void runMink("session-stop", null, cwd);
|
|
5122
|
+
});
|
|
5123
|
+
pi.on?.("session_shutdown", () => {
|
|
5124
|
+
void runMink("session-stop", null, cwd);
|
|
5125
|
+
});
|
|
5126
|
+
|
|
5127
|
+
pi.on?.("tool_call", async (event) => {
|
|
5128
|
+
const info = toolInfo(event);
|
|
5129
|
+
if (!info) return;
|
|
5130
|
+
const { sub, payload } = prePayload(info);
|
|
5131
|
+
const advisory = await runMink(sub, payload, cwd);
|
|
5132
|
+
if (advisory) pending.set(keyOf(event), advisory);
|
|
5133
|
+
});
|
|
5134
|
+
|
|
5135
|
+
pi.on?.("tool_result", async (event) => {
|
|
5136
|
+
const info = toolInfo(event);
|
|
5137
|
+
if (!info) return;
|
|
5138
|
+
const { sub, payload } = postPayload(info, resultContent(event));
|
|
5139
|
+
const post = await runMink(sub, payload, cwd);
|
|
5140
|
+
const pre = pending.get(keyOf(event)) ?? "";
|
|
5141
|
+
pending.delete(keyOf(event));
|
|
5142
|
+
const advisory = [pre, post].filter(Boolean).join("\\n");
|
|
5143
|
+
if (!advisory) return;
|
|
5144
|
+
|
|
5145
|
+
// Surface Mink's advisory into the model's context by appending a text
|
|
5146
|
+
// block to the tool result — the parity of Claude feeding hook stderr back.
|
|
5147
|
+
const base = Array.isArray(event.content)
|
|
5148
|
+
? event.content
|
|
5149
|
+
: typeof event.content === "string"
|
|
5150
|
+
? [{ type: "text", text: event.content }]
|
|
5151
|
+
: [];
|
|
5152
|
+
return {
|
|
5153
|
+
content: [...base, { type: "text", text: advisory }],
|
|
5154
|
+
details: event.details,
|
|
5155
|
+
isError: event.isError,
|
|
5156
|
+
};
|
|
5157
|
+
});
|
|
5158
|
+
}
|
|
5159
|
+
`;
|
|
5160
|
+
}
|
|
5161
|
+
function resolveSkillsSourceDir() {
|
|
5162
|
+
let dir = dirname7(new URL(import.meta.url).pathname);
|
|
5163
|
+
while (true) {
|
|
5164
|
+
if (existsSync19(join16(dir, "package.json")) && existsSync19(join16(dir, "skills"))) {
|
|
5165
|
+
return join16(dir, "skills");
|
|
5166
|
+
}
|
|
5167
|
+
const parent = dirname7(dir);
|
|
5168
|
+
if (parent === dir)
|
|
5169
|
+
break;
|
|
5170
|
+
dir = parent;
|
|
5171
|
+
}
|
|
5172
|
+
return resolve2(dirname7(new URL(import.meta.url).pathname), "../../skills");
|
|
5173
|
+
}
|
|
5174
|
+
function installPi(cwd, cliPath) {
|
|
5175
|
+
const extensionPath = piExtensionPath(cwd);
|
|
5176
|
+
mkdirSync8(dirname7(extensionPath), { recursive: true });
|
|
5177
|
+
atomicWriteText(extensionPath, buildPiExtension(cliPath));
|
|
5178
|
+
const guidancePath = piGuidanceSkillPath(cwd);
|
|
5179
|
+
mkdirSync8(dirname7(guidancePath), { recursive: true });
|
|
5180
|
+
atomicWriteText(guidancePath, PI_GUIDANCE_SKILL);
|
|
5181
|
+
let notePath = null;
|
|
5182
|
+
try {
|
|
5183
|
+
const src = join16(resolveSkillsSourceDir(), "mink-note", "SKILL.md");
|
|
5184
|
+
if (existsSync19(src)) {
|
|
5185
|
+
notePath = piNoteSkillPath(cwd);
|
|
5186
|
+
mkdirSync8(dirname7(notePath), { recursive: true });
|
|
5187
|
+
copyFileSync(src, notePath);
|
|
5188
|
+
}
|
|
5189
|
+
} catch {
|
|
5190
|
+
notePath = null;
|
|
5191
|
+
}
|
|
5192
|
+
return { extensionPath, guidancePath, notePath };
|
|
5193
|
+
}
|
|
5194
|
+
var PI_GUIDANCE_SKILL = `---
|
|
5195
|
+
name: mink
|
|
5196
|
+
description: Mink context management is active in this project. Read this to understand how Mink memory, write enforcement, and note capture work under Pi.
|
|
5197
|
+
---
|
|
5198
|
+
|
|
5199
|
+
# Mink — context management for this project
|
|
5200
|
+
|
|
5201
|
+
This project uses **Mink** (\`@drewpayment/mink\`) for cross-session context management.
|
|
5202
|
+
|
|
5203
|
+
## How it works
|
|
5204
|
+
- Mink runs automatically through a Pi extension at \`.pi/extensions/mink.ts\` that hooks session start/stop and every read/edit/write tool call.
|
|
5205
|
+
- All state lives in \`~/.mink/\` on the user's machine — **not** in this repository. Do not create or write to any in-repo state directory (no \`.wolf/\`, \`.mink/\`, etc.).
|
|
5206
|
+
- 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.
|
|
5207
|
+
- Mink shares one \`~/.mink/\` state across every assistant wired to this project, so history is unified whether the user runs Pi or another assistant.
|
|
5208
|
+
|
|
5209
|
+
## When to act on Mink
|
|
5210
|
+
- 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\`) — it captures into the user's \`~/.mink/\` vault.
|
|
5211
|
+
- If the extension surfaces a learning, past bug, or repeat-read warning in context, treat that as authoritative project memory and follow it.
|
|
5212
|
+
- The \`mink dashboard\` and \`mink agent\` commands are user tools — do not invoke them on the user's behalf.
|
|
5213
|
+
`;
|
|
5214
|
+
var init_agent_pi = __esm(() => {
|
|
5215
|
+
init_fs_utils();
|
|
5216
|
+
});
|
|
5217
|
+
|
|
5218
|
+
// src/core/prompt.ts
|
|
5219
|
+
import { createInterface } from "readline";
|
|
5220
|
+
function stdinIsInteractive() {
|
|
5221
|
+
const stdin = process.stdin;
|
|
5222
|
+
const stdout = process.stdout;
|
|
5223
|
+
return Boolean(stdin.isTTY) && Boolean(stdout.isTTY) && process.env.MINK_NO_PROMPT !== "1" && !process.env.CI;
|
|
5224
|
+
}
|
|
5225
|
+
function ask(question) {
|
|
5226
|
+
return new Promise((resolve3) => {
|
|
5227
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
5228
|
+
rl.question(question, (answer) => {
|
|
5229
|
+
rl.close();
|
|
5230
|
+
resolve3(answer);
|
|
5231
|
+
});
|
|
5232
|
+
});
|
|
5233
|
+
}
|
|
5234
|
+
var init_prompt = () => {};
|
|
5235
|
+
|
|
4900
5236
|
// src/core/backup.ts
|
|
4901
5237
|
var exports_backup = {};
|
|
4902
5238
|
__export(exports_backup, {
|
|
@@ -4905,14 +5241,14 @@ __export(exports_backup, {
|
|
|
4905
5241
|
createBackup: () => createBackup
|
|
4906
5242
|
});
|
|
4907
5243
|
import {
|
|
4908
|
-
mkdirSync as
|
|
5244
|
+
mkdirSync as mkdirSync9,
|
|
4909
5245
|
readdirSync as readdirSync7,
|
|
4910
5246
|
readFileSync as readFileSync12,
|
|
4911
5247
|
writeFileSync as writeFileSync5,
|
|
4912
|
-
existsSync as
|
|
5248
|
+
existsSync as existsSync20,
|
|
4913
5249
|
statSync as statSync7
|
|
4914
5250
|
} from "fs";
|
|
4915
|
-
import { join as
|
|
5251
|
+
import { join as join17 } from "path";
|
|
4916
5252
|
function formatTimestamp(date) {
|
|
4917
5253
|
const y = date.getFullYear();
|
|
4918
5254
|
const mo = String(date.getMonth() + 1).padStart(2, "0");
|
|
@@ -4924,15 +5260,15 @@ function formatTimestamp(date) {
|
|
|
4924
5260
|
return `${y}${mo}${d}-${h}${mi}${s}${ms}`;
|
|
4925
5261
|
}
|
|
4926
5262
|
function copyDirectoryFiles(srcDir, destDir, excludeDirs) {
|
|
4927
|
-
|
|
5263
|
+
mkdirSync9(destDir, { recursive: true });
|
|
4928
5264
|
const entries = readdirSync7(srcDir, { withFileTypes: true });
|
|
4929
5265
|
for (const entry of entries) {
|
|
4930
5266
|
if (entry.isDirectory()) {
|
|
4931
5267
|
if (excludeDirs.includes(entry.name))
|
|
4932
5268
|
continue;
|
|
4933
|
-
copyDirectoryFiles(
|
|
5269
|
+
copyDirectoryFiles(join17(srcDir, entry.name), join17(destDir, entry.name), excludeDirs);
|
|
4934
5270
|
} else if (entry.isFile()) {
|
|
4935
|
-
writeFileSync5(
|
|
5271
|
+
writeFileSync5(join17(destDir, entry.name), readFileSync12(join17(srcDir, entry.name)));
|
|
4936
5272
|
}
|
|
4937
5273
|
}
|
|
4938
5274
|
}
|
|
@@ -4941,25 +5277,25 @@ function createBackup(cwd) {
|
|
|
4941
5277
|
const dir = backupDirPath(cwd);
|
|
4942
5278
|
let name = base;
|
|
4943
5279
|
let suffix = 1;
|
|
4944
|
-
while (
|
|
5280
|
+
while (existsSync20(join17(dir, name))) {
|
|
4945
5281
|
name = `${base}-${suffix}`;
|
|
4946
5282
|
suffix++;
|
|
4947
5283
|
}
|
|
4948
5284
|
const src = projectDir(cwd);
|
|
4949
|
-
const dest =
|
|
5285
|
+
const dest = join17(dir, name);
|
|
4950
5286
|
copyDirectoryFiles(src, dest, ["backups"]);
|
|
4951
5287
|
return name;
|
|
4952
5288
|
}
|
|
4953
5289
|
function listBackups(cwd) {
|
|
4954
5290
|
const dir = backupDirPath(cwd);
|
|
4955
|
-
if (!
|
|
5291
|
+
if (!existsSync20(dir))
|
|
4956
5292
|
return [];
|
|
4957
5293
|
const entries = readdirSync7(dir, { withFileTypes: true });
|
|
4958
5294
|
const backups = [];
|
|
4959
5295
|
for (const entry of entries) {
|
|
4960
5296
|
if (!entry.isDirectory() || !entry.name.startsWith("backup-"))
|
|
4961
5297
|
continue;
|
|
4962
|
-
const backupPath =
|
|
5298
|
+
const backupPath = join17(dir, entry.name);
|
|
4963
5299
|
const match = entry.name.match(/^backup-(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})(\d{3})?(?:-\d+)?$/);
|
|
4964
5300
|
let timestamp;
|
|
4965
5301
|
if (match) {
|
|
@@ -4982,8 +5318,8 @@ function listBackups(cwd) {
|
|
|
4982
5318
|
return backups;
|
|
4983
5319
|
}
|
|
4984
5320
|
function restoreBackup(cwd, backupName) {
|
|
4985
|
-
const backupPath =
|
|
4986
|
-
if (!
|
|
5321
|
+
const backupPath = join17(backupDirPath(cwd), backupName);
|
|
5322
|
+
if (!existsSync20(backupPath)) {
|
|
4987
5323
|
throw new Error(`backup not found: ${backupName}`);
|
|
4988
5324
|
}
|
|
4989
5325
|
createBackup(cwd);
|
|
@@ -4995,7 +5331,7 @@ var init_backup = __esm(() => {
|
|
|
4995
5331
|
|
|
4996
5332
|
// src/core/scanner.ts
|
|
4997
5333
|
import { readdirSync as readdirSync8, statSync as statSync8 } from "fs";
|
|
4998
|
-
import { join as
|
|
5334
|
+
import { join as join18, relative } from "path";
|
|
4999
5335
|
function matchesPattern(name, pattern) {
|
|
5000
5336
|
if (pattern.includes("*")) {
|
|
5001
5337
|
const regex = new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$");
|
|
@@ -5019,14 +5355,14 @@ function walkDirectory(dir, projectRoot, excludes, results) {
|
|
|
5019
5355
|
if (entry.isDirectory()) {
|
|
5020
5356
|
if (isExcluded(entry.name, excludes))
|
|
5021
5357
|
continue;
|
|
5022
|
-
walkDirectory(
|
|
5358
|
+
walkDirectory(join18(dir, entry.name), projectRoot, excludes, results);
|
|
5023
5359
|
continue;
|
|
5024
5360
|
}
|
|
5025
5361
|
if (entry.isFile()) {
|
|
5026
5362
|
if (isExcluded(entry.name, excludes))
|
|
5027
5363
|
continue;
|
|
5028
5364
|
try {
|
|
5029
|
-
const fullPath =
|
|
5365
|
+
const fullPath = join18(dir, entry.name);
|
|
5030
5366
|
const stat = statSync8(fullPath);
|
|
5031
5367
|
results.push({
|
|
5032
5368
|
relativePath: relative(projectRoot, fullPath),
|
|
@@ -5449,7 +5785,7 @@ __export(exports_scan, {
|
|
|
5449
5785
|
});
|
|
5450
5786
|
import { readFileSync as readFileSync13 } from "fs";
|
|
5451
5787
|
import { createHash as createHash2 } from "crypto";
|
|
5452
|
-
import { join as
|
|
5788
|
+
import { join as join19, relative as relative2 } from "path";
|
|
5453
5789
|
function configRelativePath(cfgPath, cwd) {
|
|
5454
5790
|
const rel = relative2(cwd, cfgPath);
|
|
5455
5791
|
return rel.startsWith("..") ? cfgPath : rel;
|
|
@@ -5500,7 +5836,7 @@ function scan(cwd, options) {
|
|
|
5500
5836
|
if (!stalePaths.has(file.relativePath)) {
|
|
5501
5837
|
continue;
|
|
5502
5838
|
}
|
|
5503
|
-
const fullPath =
|
|
5839
|
+
const fullPath = join19(cwd, file.relativePath);
|
|
5504
5840
|
let content;
|
|
5505
5841
|
try {
|
|
5506
5842
|
content = readFileSync13(fullPath, "utf-8");
|
|
@@ -5589,10 +5925,10 @@ __export(exports_seed, {
|
|
|
5589
5925
|
parseGoMod: () => parseGoMod,
|
|
5590
5926
|
parseCargoToml: () => parseCargoToml
|
|
5591
5927
|
});
|
|
5592
|
-
import { basename as basename4, join as
|
|
5593
|
-
import { readFileSync as readFileSync14, existsSync as
|
|
5928
|
+
import { basename as basename4, join as join20 } from "path";
|
|
5929
|
+
import { readFileSync as readFileSync14, existsSync as existsSync21 } from "fs";
|
|
5594
5930
|
function readFile(filePath) {
|
|
5595
|
-
if (!
|
|
5931
|
+
if (!existsSync21(filePath))
|
|
5596
5932
|
return null;
|
|
5597
5933
|
try {
|
|
5598
5934
|
return readFileSync14(filePath, "utf-8");
|
|
@@ -5685,10 +6021,10 @@ function parseGoMod(filePath) {
|
|
|
5685
6021
|
}
|
|
5686
6022
|
function seedLearningMemory(projectRoot) {
|
|
5687
6023
|
const parsers = [
|
|
5688
|
-
() => parsePackageJson(
|
|
5689
|
-
() => parsePyprojectToml(
|
|
5690
|
-
() => parseCargoToml(
|
|
5691
|
-
() => parseGoMod(
|
|
6024
|
+
() => parsePackageJson(join20(projectRoot, "package.json")),
|
|
6025
|
+
() => parsePyprojectToml(join20(projectRoot, "pyproject.toml")),
|
|
6026
|
+
() => parseCargoToml(join20(projectRoot, "Cargo.toml")),
|
|
6027
|
+
() => parseGoMod(join20(projectRoot, "go.mod"))
|
|
5692
6028
|
];
|
|
5693
6029
|
const infos = parsers.map((fn) => fn()).filter((info) => info !== null);
|
|
5694
6030
|
const projectName = infos.find((i) => i.projectName)?.projectName ?? basename4(projectRoot);
|
|
@@ -5766,34 +6102,37 @@ var init_seed = __esm(() => {
|
|
|
5766
6102
|
var exports_init = {};
|
|
5767
6103
|
__export(exports_init, {
|
|
5768
6104
|
writeMinkRule: () => writeMinkRule,
|
|
6105
|
+
resolveTargetsFromFlag: () => resolveTargetsFromFlag,
|
|
6106
|
+
resolveTargets: () => resolveTargets,
|
|
5769
6107
|
resolveCliPathFrom: () => resolveCliPathFrom,
|
|
5770
6108
|
resolveCliPath: () => resolveCliPath,
|
|
5771
6109
|
mergeHooksIntoSettings: () => mergeHooksIntoSettings,
|
|
6110
|
+
installClaude: () => installClaude,
|
|
5772
6111
|
init: () => init,
|
|
5773
6112
|
detectRuntime: () => detectRuntime,
|
|
5774
6113
|
buildHooksConfig: () => buildHooksConfig
|
|
5775
6114
|
});
|
|
5776
|
-
import { execSync as
|
|
5777
|
-
import { mkdirSync as
|
|
5778
|
-
import { resolve as
|
|
6115
|
+
import { execSync as execSync6 } from "child_process";
|
|
6116
|
+
import { mkdirSync as mkdirSync10, existsSync as existsSync22 } from "fs";
|
|
6117
|
+
import { resolve as resolve3, dirname as dirname8, basename as basename5, join as join21 } from "path";
|
|
5779
6118
|
function detectRuntime() {
|
|
5780
6119
|
try {
|
|
5781
|
-
|
|
6120
|
+
execSync6("bun --version", { stdio: "ignore" });
|
|
5782
6121
|
return "bun";
|
|
5783
6122
|
} catch {
|
|
5784
6123
|
return "node";
|
|
5785
6124
|
}
|
|
5786
6125
|
}
|
|
5787
6126
|
function resolveCliPathFrom(selfPath) {
|
|
5788
|
-
const selfDir =
|
|
6127
|
+
const selfDir = dirname8(selfPath);
|
|
5789
6128
|
if (selfPath.endsWith("dist/cli.js") || selfPath.endsWith("dist/cli.bun.js") || selfPath.endsWith("dist/cli.node.js")) {
|
|
5790
|
-
return
|
|
6129
|
+
return join21(selfDir, "cli.js");
|
|
5791
6130
|
}
|
|
5792
|
-
const packageRoot =
|
|
5793
|
-
const distShim =
|
|
5794
|
-
if (
|
|
6131
|
+
const packageRoot = resolve3(selfDir, "..", "..");
|
|
6132
|
+
const distShim = join21(packageRoot, "dist", "cli.js");
|
|
6133
|
+
if (existsSync22(distShim))
|
|
5795
6134
|
return distShim;
|
|
5796
|
-
return
|
|
6135
|
+
return join21(packageRoot, "src", "cli.ts");
|
|
5797
6136
|
}
|
|
5798
6137
|
function resolveCliPath() {
|
|
5799
6138
|
return resolveCliPathFrom(new URL(import.meta.url).pathname);
|
|
@@ -5835,13 +6174,13 @@ function isMinkHook(entry) {
|
|
|
5835
6174
|
return false;
|
|
5836
6175
|
}
|
|
5837
6176
|
function writeMinkRule(cwd) {
|
|
5838
|
-
const rulePath =
|
|
5839
|
-
|
|
6177
|
+
const rulePath = resolve3(cwd, ".claude", "rules", "mink.md");
|
|
6178
|
+
mkdirSync10(dirname8(rulePath), { recursive: true });
|
|
5840
6179
|
atomicWriteText(rulePath, MINK_RULE_CONTENT);
|
|
5841
6180
|
return rulePath;
|
|
5842
6181
|
}
|
|
5843
6182
|
function mergeHooksIntoSettings(settingsPath, newHooks) {
|
|
5844
|
-
|
|
6183
|
+
mkdirSync10(dirname8(settingsPath), { recursive: true });
|
|
5845
6184
|
const existing = safeReadJson(settingsPath) ?? {};
|
|
5846
6185
|
const existingHooks = existing.hooks ?? {};
|
|
5847
6186
|
for (const [event, entries] of Object.entries(newHooks)) {
|
|
@@ -5852,17 +6191,46 @@ function mergeHooksIntoSettings(settingsPath, newHooks) {
|
|
|
5852
6191
|
existing.hooks = existingHooks;
|
|
5853
6192
|
atomicWriteJson(settingsPath, existing);
|
|
5854
6193
|
}
|
|
6194
|
+
function installClaude(cwd, cliPath) {
|
|
6195
|
+
const settingsPath = resolve3(cwd, ".claude", "settings.json");
|
|
6196
|
+
mergeHooksIntoSettings(settingsPath, buildHooksConfig(cliPath));
|
|
6197
|
+
const rulePath = writeMinkRule(cwd);
|
|
6198
|
+
return { settingsPath, rulePath };
|
|
6199
|
+
}
|
|
6200
|
+
async function resolveTargets(cwd, opts) {
|
|
6201
|
+
if (opts.targets && opts.targets.length > 0)
|
|
6202
|
+
return opts.targets;
|
|
6203
|
+
const detected = detectAgents(cwd);
|
|
6204
|
+
const detectedIds = detected.filter((a) => a.detected).map((a) => a.id);
|
|
6205
|
+
if (opts.interactive && stdinIsInteractive()) {
|
|
6206
|
+
return promptForAgents(detected, detectedIds);
|
|
6207
|
+
}
|
|
6208
|
+
return detectedIds.length > 0 ? detectedIds : ["claude"];
|
|
6209
|
+
}
|
|
6210
|
+
async function promptForAgents(detected, defaults) {
|
|
6211
|
+
const fallback = defaults.length > 0 ? defaults : ["claude"];
|
|
6212
|
+
console.log("Which assistant(s) should Mink work with?");
|
|
6213
|
+
detected.forEach((a, i) => {
|
|
6214
|
+
const tag = a.detected ? ` (detected — ${a.signals.join(", ")})` : "";
|
|
6215
|
+
console.log(` ${i + 1}) ${a.label}${tag}`);
|
|
6216
|
+
});
|
|
6217
|
+
const answer = (await ask(`Enter numbers (comma-separated), 'a' for all [default: ${fallback.join(", ")}]: `)).trim().toLowerCase();
|
|
6218
|
+
if (answer === "")
|
|
6219
|
+
return fallback;
|
|
6220
|
+
if (answer === "a" || answer === "all")
|
|
6221
|
+
return AGENTS.map((a) => a.id);
|
|
6222
|
+
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);
|
|
6223
|
+
return picked.length > 0 ? picked : fallback;
|
|
6224
|
+
}
|
|
5855
6225
|
function isExistingInstallation(cwd) {
|
|
5856
6226
|
const dir = projectDir(cwd);
|
|
5857
|
-
if (!
|
|
6227
|
+
if (!existsSync22(dir))
|
|
5858
6228
|
return false;
|
|
5859
|
-
return
|
|
6229
|
+
return existsSync22(join21(dir, "file-index.json"));
|
|
5860
6230
|
}
|
|
5861
|
-
async function init(cwd) {
|
|
6231
|
+
async function init(cwd, opts = {}) {
|
|
5862
6232
|
const runtime = detectRuntime();
|
|
5863
6233
|
const cliPath = resolveCliPath();
|
|
5864
|
-
const hooks = buildHooksConfig(cliPath);
|
|
5865
|
-
const settingsPath = resolve2(cwd, ".claude", "settings.json");
|
|
5866
6234
|
const dir = projectDir(cwd);
|
|
5867
6235
|
const upgrading = isExistingInstallation(cwd);
|
|
5868
6236
|
if (upgrading) {
|
|
@@ -5871,9 +6239,22 @@ async function init(cwd) {
|
|
|
5871
6239
|
const backupName = createBackup2(cwd);
|
|
5872
6240
|
console.log(` backup: ${backupName}`);
|
|
5873
6241
|
}
|
|
5874
|
-
|
|
5875
|
-
const
|
|
5876
|
-
|
|
6242
|
+
const targets = await resolveTargets(cwd, opts);
|
|
6243
|
+
const wired = {};
|
|
6244
|
+
for (const target of targets) {
|
|
6245
|
+
if (target === "claude") {
|
|
6246
|
+
const { settingsPath, rulePath } = installClaude(cwd, cliPath);
|
|
6247
|
+
wired.claude = [`hooks: ${settingsPath}`, `rule: ${rulePath}`];
|
|
6248
|
+
} else if (target === "pi") {
|
|
6249
|
+
const r = installPi(cwd, cliPath);
|
|
6250
|
+
wired.pi = [
|
|
6251
|
+
`extension: ${r.extensionPath}`,
|
|
6252
|
+
`guidance: ${r.guidancePath}`,
|
|
6253
|
+
...r.notePath ? [`note skill: ${r.notePath}`] : []
|
|
6254
|
+
];
|
|
6255
|
+
}
|
|
6256
|
+
}
|
|
6257
|
+
mkdirSync10(dir, { recursive: true });
|
|
5877
6258
|
const identity = resolveProjectIdentity(cwd);
|
|
5878
6259
|
const projectId = identity.id;
|
|
5879
6260
|
const isNotesProject = isWikiEnabled() && isVaultInitialized() && isInsideVault(cwd);
|
|
@@ -5881,6 +6262,8 @@ async function init(cwd) {
|
|
|
5881
6262
|
const existingMeta = safeReadJson(metaPath);
|
|
5882
6263
|
const deviceId = getOrCreateDeviceId();
|
|
5883
6264
|
const existingPathsByDevice = existingMeta?.pathsByDevice && typeof existingMeta.pathsByDevice === "object" && !Array.isArray(existingMeta.pathsByDevice) ? existingMeta.pathsByDevice : {};
|
|
6265
|
+
const priorAgents = Array.isArray(existingMeta?.agents) ? existingMeta.agents : [];
|
|
6266
|
+
const agents = Array.from(new Set([...priorAgents, ...targets]));
|
|
5884
6267
|
atomicWriteJson(metaPath, {
|
|
5885
6268
|
...existingMeta ?? {},
|
|
5886
6269
|
cwd,
|
|
@@ -5888,20 +6271,29 @@ async function init(cwd) {
|
|
|
5888
6271
|
initTimestamp: existingMeta?.initTimestamp ?? new Date().toISOString(),
|
|
5889
6272
|
version: "0.1.0",
|
|
5890
6273
|
pathsByDevice: { ...existingPathsByDevice, [deviceId]: cwd },
|
|
6274
|
+
agents,
|
|
5891
6275
|
...isNotesProject ? { projectType: "notes" } : {}
|
|
5892
6276
|
});
|
|
6277
|
+
const printWiring = () => {
|
|
6278
|
+
for (const id of Object.keys(wired)) {
|
|
6279
|
+
const label = AGENTS.find((a) => a.id === id)?.label ?? id;
|
|
6280
|
+
console.log(` ${label}:`);
|
|
6281
|
+
for (const line of wired[id])
|
|
6282
|
+
console.log(` ${line}`);
|
|
6283
|
+
}
|
|
6284
|
+
};
|
|
5893
6285
|
if (upgrading) {
|
|
5894
6286
|
console.log(`[mink] upgrade complete`);
|
|
5895
6287
|
console.log(` project: ${projectId}`);
|
|
5896
|
-
console.log(`
|
|
5897
|
-
|
|
6288
|
+
console.log(` agents: ${agents.join(", ")}`);
|
|
6289
|
+
printWiring();
|
|
5898
6290
|
} else {
|
|
5899
6291
|
console.log(`[mink] initialized`);
|
|
5900
6292
|
console.log(` project: ${projectId} (${identity.source})`);
|
|
5901
6293
|
console.log(` state: ${dir}`);
|
|
5902
6294
|
console.log(` runtime: ${runtime}`);
|
|
5903
|
-
console.log(`
|
|
5904
|
-
|
|
6295
|
+
console.log(` agents: ${agents.join(", ")}`);
|
|
6296
|
+
printWiring();
|
|
5905
6297
|
}
|
|
5906
6298
|
if (identity.source === "path-derived") {
|
|
5907
6299
|
const root = getRepoRoot(cwd);
|
|
@@ -5913,7 +6305,7 @@ async function init(cwd) {
|
|
|
5913
6305
|
scan2(cwd, { check: false });
|
|
5914
6306
|
const { learningMemoryPath: learningMemoryPath3 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
|
|
5915
6307
|
const memPath = learningMemoryPath3(cwd);
|
|
5916
|
-
if (!
|
|
6308
|
+
if (!existsSync22(memPath)) {
|
|
5917
6309
|
const { seedLearningMemory: seedLearningMemory2 } = await Promise.resolve().then(() => (init_seed(), exports_seed));
|
|
5918
6310
|
const { serializeLearningMemory: serializeLearningMemory2 } = await Promise.resolve().then(() => (init_learning_memory(), exports_learning_memory));
|
|
5919
6311
|
const mem = seedLearningMemory2(cwd);
|
|
@@ -5922,8 +6314,8 @@ async function init(cwd) {
|
|
|
5922
6314
|
if (isWikiEnabled() && isVaultInitialized() && !isNotesProject) {
|
|
5923
6315
|
try {
|
|
5924
6316
|
const projectSlug = basename5(cwd);
|
|
5925
|
-
const overviewPath =
|
|
5926
|
-
if (!
|
|
6317
|
+
const overviewPath = join21(vaultProjects(projectSlug), "overview.md");
|
|
6318
|
+
if (!existsSync22(overviewPath)) {
|
|
5927
6319
|
const now = new Date().toISOString();
|
|
5928
6320
|
const overview = [
|
|
5929
6321
|
`---`,
|
|
@@ -5975,6 +6367,9 @@ var init_init = __esm(() => {
|
|
|
5975
6367
|
init_device();
|
|
5976
6368
|
init_git_identity();
|
|
5977
6369
|
init_vault();
|
|
6370
|
+
init_agent_detect();
|
|
6371
|
+
init_agent_pi();
|
|
6372
|
+
init_prompt();
|
|
5978
6373
|
});
|
|
5979
6374
|
|
|
5980
6375
|
// src/repositories/counters-repo.ts
|
|
@@ -6049,12 +6444,12 @@ var init_state_counters = __esm(() => {
|
|
|
6049
6444
|
});
|
|
6050
6445
|
|
|
6051
6446
|
// src/core/channel-templates.ts
|
|
6052
|
-
import { join as
|
|
6053
|
-
import { existsSync as
|
|
6447
|
+
import { join as join22 } from "path";
|
|
6448
|
+
import { existsSync as existsSync23, writeFileSync as writeFileSync6, mkdirSync as mkdirSync11 } from "fs";
|
|
6054
6449
|
function writeCompanionClaudeMd(vaultPath, overwrite = false) {
|
|
6055
|
-
|
|
6056
|
-
const claudeMdPath =
|
|
6057
|
-
if (
|
|
6450
|
+
mkdirSync11(vaultPath, { recursive: true });
|
|
6451
|
+
const claudeMdPath = join22(vaultPath, "CLAUDE.md");
|
|
6452
|
+
if (existsSync23(claudeMdPath) && !overwrite) {
|
|
6058
6453
|
return false;
|
|
6059
6454
|
}
|
|
6060
6455
|
writeFileSync6(claudeMdPath, COMPANION_CLAUDE_MD);
|
|
@@ -6206,8 +6601,8 @@ mink wiki rebuild-index
|
|
|
6206
6601
|
var init_channel_templates = () => {};
|
|
6207
6602
|
|
|
6208
6603
|
// src/core/channel-process.ts
|
|
6209
|
-
import { readFileSync as readFileSync15, writeFileSync as writeFileSync7, unlinkSync as unlinkSync3, mkdirSync as
|
|
6210
|
-
import { dirname as
|
|
6604
|
+
import { readFileSync as readFileSync15, writeFileSync as writeFileSync7, unlinkSync as unlinkSync3, mkdirSync as mkdirSync12, existsSync as existsSync24 } from "fs";
|
|
6605
|
+
import { dirname as dirname9, join as join23 } from "path";
|
|
6211
6606
|
import { spawnSync } from "child_process";
|
|
6212
6607
|
function readChannelPidFile() {
|
|
6213
6608
|
try {
|
|
@@ -6223,7 +6618,7 @@ function readChannelPidFile() {
|
|
|
6223
6618
|
}
|
|
6224
6619
|
function writeChannelPidFile(data) {
|
|
6225
6620
|
const pidPath = channelPidPath();
|
|
6226
|
-
|
|
6621
|
+
mkdirSync12(dirname9(pidPath), { recursive: true });
|
|
6227
6622
|
writeFileSync7(pidPath, JSON.stringify(data, null, 2));
|
|
6228
6623
|
}
|
|
6229
6624
|
function removeChannelPidFile() {
|
|
@@ -6353,12 +6748,12 @@ function getChannelLogs() {
|
|
|
6353
6748
|
return null;
|
|
6354
6749
|
if (!screenSessionExists(pidData.session))
|
|
6355
6750
|
return null;
|
|
6356
|
-
const tmpPath =
|
|
6751
|
+
const tmpPath = join23(minkRoot(), `.channel-capture-${Date.now()}-${process.pid}.txt`);
|
|
6357
6752
|
const result = spawnSync("screen", ["-S", pidData.session, "-X", "hardcopy", "-h", tmpPath], { stdio: "ignore" });
|
|
6358
6753
|
if (result.status !== 0)
|
|
6359
6754
|
return null;
|
|
6360
6755
|
for (let i = 0;i < 20; i++) {
|
|
6361
|
-
if (
|
|
6756
|
+
if (existsSync24(tmpPath))
|
|
6362
6757
|
break;
|
|
6363
6758
|
const delayUntil = Date.now() + 50;
|
|
6364
6759
|
while (Date.now() < delayUntil) {}
|
|
@@ -6462,7 +6857,7 @@ async function runtimeServe(opts) {
|
|
|
6462
6857
|
}
|
|
6463
6858
|
const { createServer } = await import("node:http");
|
|
6464
6859
|
const { Readable } = await import("node:stream");
|
|
6465
|
-
return new Promise((
|
|
6860
|
+
return new Promise((resolve4) => {
|
|
6466
6861
|
const httpServer = createServer(async (req, res) => {
|
|
6467
6862
|
const url = `http://${opts.hostname}:${opts.port}${req.url ?? "/"}`;
|
|
6468
6863
|
const headers = new Headers;
|
|
@@ -6521,7 +6916,7 @@ async function runtimeServe(opts) {
|
|
|
6521
6916
|
httpServer.listen(opts.port, opts.hostname, () => {
|
|
6522
6917
|
const addr = httpServer.address();
|
|
6523
6918
|
const boundPort = typeof addr === "object" && addr ? addr.port : opts.port;
|
|
6524
|
-
|
|
6919
|
+
resolve4({
|
|
6525
6920
|
port: boundPort,
|
|
6526
6921
|
stop: (close) => {
|
|
6527
6922
|
if (close)
|
|
@@ -6539,8 +6934,8 @@ var init_runtime = __esm(() => {
|
|
|
6539
6934
|
|
|
6540
6935
|
// src/core/daemon.ts
|
|
6541
6936
|
import { readFileSync as readFileSync16, writeFileSync as writeFileSync8, unlinkSync as unlinkSync4, openSync } from "fs";
|
|
6542
|
-
import { mkdirSync as
|
|
6543
|
-
import { dirname as
|
|
6937
|
+
import { mkdirSync as mkdirSync13 } from "fs";
|
|
6938
|
+
import { dirname as dirname10, resolve as resolve4 } from "path";
|
|
6544
6939
|
function readPidFile() {
|
|
6545
6940
|
try {
|
|
6546
6941
|
const raw = readFileSync16(schedulerPidPath(), "utf-8");
|
|
@@ -6555,7 +6950,7 @@ function readPidFile() {
|
|
|
6555
6950
|
}
|
|
6556
6951
|
function writePidFile(data) {
|
|
6557
6952
|
const pidPath = schedulerPidPath();
|
|
6558
|
-
|
|
6953
|
+
mkdirSync13(dirname10(pidPath), { recursive: true });
|
|
6559
6954
|
writeFileSync8(pidPath, JSON.stringify(data, null, 2));
|
|
6560
6955
|
}
|
|
6561
6956
|
function removePidFile() {
|
|
@@ -6580,10 +6975,10 @@ function startDaemon(cwd) {
|
|
|
6580
6975
|
if (existing) {
|
|
6581
6976
|
removePidFile();
|
|
6582
6977
|
}
|
|
6583
|
-
const __dir =
|
|
6584
|
-
const cliPath = process.argv[1] ??
|
|
6978
|
+
const __dir = dirname10(new URL(import.meta.url).pathname);
|
|
6979
|
+
const cliPath = process.argv[1] ?? resolve4(__dir, "../cli.ts");
|
|
6585
6980
|
const logPath = schedulerLogPath();
|
|
6586
|
-
|
|
6981
|
+
mkdirSync13(dirname10(logPath), { recursive: true });
|
|
6587
6982
|
const logFd = openSync(logPath, "a");
|
|
6588
6983
|
const proc = runtimeSpawn(["bun", "run", cliPath, "cron", "__daemon"], {
|
|
6589
6984
|
cwd,
|
|
@@ -6697,9 +7092,9 @@ var exports_status = {};
|
|
|
6697
7092
|
__export(exports_status, {
|
|
6698
7093
|
status: () => status
|
|
6699
7094
|
});
|
|
6700
|
-
import { existsSync as
|
|
7095
|
+
import { existsSync as existsSync26, readFileSync as readFileSync17, statSync as statSync9 } from "fs";
|
|
6701
7096
|
function checkJsonFile(name, filePath, validator) {
|
|
6702
|
-
if (!
|
|
7097
|
+
if (!existsSync26(filePath))
|
|
6703
7098
|
return { name, path: filePath, status: "missing" };
|
|
6704
7099
|
const data = safeReadJson(filePath);
|
|
6705
7100
|
if (data === null)
|
|
@@ -6709,7 +7104,7 @@ function checkJsonFile(name, filePath, validator) {
|
|
|
6709
7104
|
return { name, path: filePath, status: "ok" };
|
|
6710
7105
|
}
|
|
6711
7106
|
function checkDbFile(name, filePath) {
|
|
6712
|
-
if (!
|
|
7107
|
+
if (!existsSync26(filePath))
|
|
6713
7108
|
return { name, path: filePath, status: "missing" };
|
|
6714
7109
|
try {
|
|
6715
7110
|
const header = readFileSync17(filePath).slice(0, 16).toString("utf-8");
|
|
@@ -6724,7 +7119,7 @@ function checkDbFile(name, filePath) {
|
|
|
6724
7119
|
function checkShardedText(name, candidatePaths) {
|
|
6725
7120
|
const canonical = candidatePaths[0];
|
|
6726
7121
|
for (const p of candidatePaths) {
|
|
6727
|
-
if (!
|
|
7122
|
+
if (!existsSync26(p))
|
|
6728
7123
|
continue;
|
|
6729
7124
|
try {
|
|
6730
7125
|
if (statSync9(p).size === 0)
|
|
@@ -6817,7 +7212,7 @@ function status(cwd) {
|
|
|
6817
7212
|
console.log(` Decision Log: ${mem.sections["Decision Log"].length}`);
|
|
6818
7213
|
console.log(` Total entries: ${total}`);
|
|
6819
7214
|
const memPath = learningMemoryPath(cwd);
|
|
6820
|
-
if (
|
|
7215
|
+
if (existsSync26(memPath)) {
|
|
6821
7216
|
const mtime = statSync9(memPath).mtime;
|
|
6822
7217
|
console.log(` Canonical last modified: ${mtime.toISOString()}`);
|
|
6823
7218
|
}
|
|
@@ -6866,7 +7261,7 @@ __export(exports_scan2, {
|
|
|
6866
7261
|
});
|
|
6867
7262
|
import { readFileSync as readFileSync18 } from "fs";
|
|
6868
7263
|
import { createHash as createHash3 } from "crypto";
|
|
6869
|
-
import { join as
|
|
7264
|
+
import { join as join24, relative as relative3 } from "path";
|
|
6870
7265
|
function configRelativePath2(cfgPath, cwd) {
|
|
6871
7266
|
const rel = relative3(cwd, cfgPath);
|
|
6872
7267
|
return rel.startsWith("..") ? cfgPath : rel;
|
|
@@ -6917,7 +7312,7 @@ function scan2(cwd, options) {
|
|
|
6917
7312
|
if (!stalePaths.has(file.relativePath)) {
|
|
6918
7313
|
continue;
|
|
6919
7314
|
}
|
|
6920
|
-
const fullPath =
|
|
7315
|
+
const fullPath = join24(cwd, file.relativePath);
|
|
6921
7316
|
let content;
|
|
6922
7317
|
try {
|
|
6923
7318
|
content = readFileSync18(fullPath, "utf-8");
|
|
@@ -7002,12 +7397,12 @@ var exports_reflect2 = {};
|
|
|
7002
7397
|
__export(exports_reflect2, {
|
|
7003
7398
|
reflect: () => reflect2
|
|
7004
7399
|
});
|
|
7005
|
-
import { existsSync as
|
|
7006
|
-
import { dirname as
|
|
7400
|
+
import { existsSync as existsSync27 } from "fs";
|
|
7401
|
+
import { dirname as dirname11 } from "path";
|
|
7007
7402
|
function reflect2(_cwd, memoryPath, configPath3) {
|
|
7008
|
-
const projDir =
|
|
7403
|
+
const projDir = dirname11(memoryPath);
|
|
7009
7404
|
const mem = aggregateLearningMemoryAt(projDir);
|
|
7010
|
-
if (totalEntryCount(mem) === 0 && !
|
|
7405
|
+
if (totalEntryCount(mem) === 0 && !existsSync27(memoryPath)) {
|
|
7011
7406
|
console.log("[mink] no learning memory found");
|
|
7012
7407
|
return null;
|
|
7013
7408
|
}
|
|
@@ -7878,9 +8273,9 @@ __export(exports_self_update, {
|
|
|
7878
8273
|
PACKAGE_NAME: () => PACKAGE_NAME
|
|
7879
8274
|
});
|
|
7880
8275
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
7881
|
-
import { existsSync as
|
|
7882
|
-
import { dirname as
|
|
7883
|
-
import { join as
|
|
8276
|
+
import { existsSync as existsSync28, readFileSync as readFileSync21 } from "fs";
|
|
8277
|
+
import { dirname as dirname12 } from "path";
|
|
8278
|
+
import { join as join25 } from "path";
|
|
7884
8279
|
function parseSemver(input) {
|
|
7885
8280
|
const trimmed = input.trim().replace(/^v/, "");
|
|
7886
8281
|
if (!trimmed)
|
|
@@ -7927,15 +8322,15 @@ function compareSemver(a, b) {
|
|
|
7927
8322
|
function getInstallInfo() {
|
|
7928
8323
|
const selfPath = new URL(import.meta.url).pathname;
|
|
7929
8324
|
const isDevMode = selfPath.endsWith(".ts");
|
|
7930
|
-
let dir =
|
|
8325
|
+
let dir = dirname12(selfPath);
|
|
7931
8326
|
let packageJsonPath = null;
|
|
7932
8327
|
for (let i = 0;i < 10; i++) {
|
|
7933
|
-
const candidate =
|
|
7934
|
-
if (
|
|
8328
|
+
const candidate = join25(dir, "package.json");
|
|
8329
|
+
if (existsSync28(candidate)) {
|
|
7935
8330
|
packageJsonPath = candidate;
|
|
7936
8331
|
break;
|
|
7937
8332
|
}
|
|
7938
|
-
const parent =
|
|
8333
|
+
const parent = dirname12(dir);
|
|
7939
8334
|
if (parent === dir)
|
|
7940
8335
|
break;
|
|
7941
8336
|
dir = parent;
|
|
@@ -8005,7 +8400,7 @@ function buildInstallCommand(pm, version) {
|
|
|
8005
8400
|
return ["npm", "install", "-g", ref];
|
|
8006
8401
|
}
|
|
8007
8402
|
function selfUpdateLogPath() {
|
|
8008
|
-
return
|
|
8403
|
+
return join25(minkRoot(), "self-update.log");
|
|
8009
8404
|
}
|
|
8010
8405
|
function appendLogEntry(entry) {
|
|
8011
8406
|
const path = selfUpdateLogPath();
|
|
@@ -8794,21 +9189,21 @@ var init_cron = __esm(() => {
|
|
|
8794
9189
|
});
|
|
8795
9190
|
|
|
8796
9191
|
// src/core/vault-templates.ts
|
|
8797
|
-
import { join as
|
|
8798
|
-
import { existsSync as
|
|
9192
|
+
import { join as join26 } from "path";
|
|
9193
|
+
import { existsSync as existsSync29, writeFileSync as writeFileSync9, readFileSync as readFileSync22, mkdirSync as mkdirSync14 } from "fs";
|
|
8799
9194
|
function seedTemplates(templatesDir) {
|
|
8800
|
-
|
|
9195
|
+
mkdirSync14(templatesDir, { recursive: true });
|
|
8801
9196
|
for (const [name, content] of Object.entries(DEFAULT_TEMPLATES)) {
|
|
8802
|
-
const filePath =
|
|
8803
|
-
if (!
|
|
9197
|
+
const filePath = join26(templatesDir, `${name}.md`);
|
|
9198
|
+
if (!existsSync29(filePath)) {
|
|
8804
9199
|
writeFileSync9(filePath, content);
|
|
8805
9200
|
}
|
|
8806
9201
|
}
|
|
8807
9202
|
}
|
|
8808
9203
|
function loadTemplate(templatesDir, templateName, vars) {
|
|
8809
|
-
const filePath =
|
|
9204
|
+
const filePath = join26(templatesDir, `${templateName}.md`);
|
|
8810
9205
|
let content;
|
|
8811
|
-
if (
|
|
9206
|
+
if (existsSync29(filePath)) {
|
|
8812
9207
|
content = readFileSync22(filePath, "utf-8");
|
|
8813
9208
|
} else if (DEFAULT_TEMPLATES[templateName]) {
|
|
8814
9209
|
content = DEFAULT_TEMPLATES[templateName];
|
|
@@ -8962,29 +9357,29 @@ category: resources
|
|
|
8962
9357
|
});
|
|
8963
9358
|
|
|
8964
9359
|
// src/core/note-writer.ts
|
|
8965
|
-
import { join as
|
|
8966
|
-
import { existsSync as
|
|
9360
|
+
import { join as join27 } from "path";
|
|
9361
|
+
import { existsSync as existsSync30, readFileSync as readFileSync23 } from "fs";
|
|
8967
9362
|
import { createHash as createHash4 } from "crypto";
|
|
8968
9363
|
function sha256(content) {
|
|
8969
9364
|
return createHash4("sha256").update(content).digest("hex");
|
|
8970
9365
|
}
|
|
8971
9366
|
function resolveUniqueNotePath(dir, baseSlug, content) {
|
|
8972
9367
|
const targetHash = sha256(content);
|
|
8973
|
-
const primary =
|
|
8974
|
-
if (!
|
|
9368
|
+
const primary = join27(dir, `${baseSlug}.md`);
|
|
9369
|
+
if (!existsSync30(primary))
|
|
8975
9370
|
return primary;
|
|
8976
9371
|
if (sameContent(primary, targetHash))
|
|
8977
9372
|
return primary;
|
|
8978
9373
|
const dev4 = getOrCreateDeviceId().replace(/-/g, "").slice(0, 4);
|
|
8979
9374
|
for (let i = 0;i < MAX_COLLISION_ATTEMPTS; i++) {
|
|
8980
9375
|
const suffix = i === 0 ? dev4 : `${dev4}-${i + 1}`;
|
|
8981
|
-
const candidate =
|
|
8982
|
-
if (!
|
|
9376
|
+
const candidate = join27(dir, `${baseSlug}-${suffix}.md`);
|
|
9377
|
+
if (!existsSync30(candidate))
|
|
8983
9378
|
return candidate;
|
|
8984
9379
|
if (sameContent(candidate, targetHash))
|
|
8985
9380
|
return candidate;
|
|
8986
9381
|
}
|
|
8987
|
-
return
|
|
9382
|
+
return join27(dir, `${baseSlug}-${Date.now()}.md`);
|
|
8988
9383
|
}
|
|
8989
9384
|
function sameContent(filePath, expectedHash) {
|
|
8990
9385
|
try {
|
|
@@ -9059,8 +9454,8 @@ ${meta.body}
|
|
|
9059
9454
|
}
|
|
9060
9455
|
function appendToDaily(date, content) {
|
|
9061
9456
|
const dir = vaultDailyDir();
|
|
9062
|
-
const filePath =
|
|
9063
|
-
if (
|
|
9457
|
+
const filePath = join27(dir, `${date}.md`);
|
|
9458
|
+
if (existsSync30(filePath)) {
|
|
9064
9459
|
const timestamp = new Date().toLocaleTimeString("en-US", {
|
|
9065
9460
|
hour: "2-digit",
|
|
9066
9461
|
minute: "2-digit",
|
|
@@ -9169,10 +9564,10 @@ var init_design_eval = __esm(() => {
|
|
|
9169
9564
|
});
|
|
9170
9565
|
|
|
9171
9566
|
// src/core/dashboard-api.ts
|
|
9172
|
-
import { existsSync as
|
|
9567
|
+
import { existsSync as existsSync31, readFileSync as readFileSync24 } from "fs";
|
|
9173
9568
|
import { readdirSync as readdirSync9, readFileSync as readFileSyncFS, existsSync as fsExistsSync } from "fs";
|
|
9174
|
-
import { join as
|
|
9175
|
-
import { execSync as
|
|
9569
|
+
import { join as join28, resolve as resolve6, normalize, sep } from "path";
|
|
9570
|
+
import { execSync as execSync7 } from "child_process";
|
|
9176
9571
|
function isSecretKey(key) {
|
|
9177
9572
|
return SECRET_KEY_PATTERNS.some((re) => re.test(key));
|
|
9178
9573
|
}
|
|
@@ -9184,7 +9579,7 @@ function maskSecret(value, showLast = 4) {
|
|
|
9184
9579
|
return "••••" + value.slice(-showLast);
|
|
9185
9580
|
}
|
|
9186
9581
|
function checkJsonFile2(name, filePath, validator) {
|
|
9187
|
-
if (!
|
|
9582
|
+
if (!existsSync31(filePath))
|
|
9188
9583
|
return { name, status: "missing" };
|
|
9189
9584
|
const data = safeReadJson(filePath);
|
|
9190
9585
|
if (data === null)
|
|
@@ -9194,7 +9589,7 @@ function checkJsonFile2(name, filePath, validator) {
|
|
|
9194
9589
|
return { name, status: "ok" };
|
|
9195
9590
|
}
|
|
9196
9591
|
function checkTextFile(name, filePath) {
|
|
9197
|
-
if (!
|
|
9592
|
+
if (!existsSync31(filePath))
|
|
9198
9593
|
return { name, status: "missing" };
|
|
9199
9594
|
try {
|
|
9200
9595
|
readFileSync24(filePath, "utf-8");
|
|
@@ -9204,7 +9599,7 @@ function checkTextFile(name, filePath) {
|
|
|
9204
9599
|
}
|
|
9205
9600
|
}
|
|
9206
9601
|
function checkDbFile2(name, filePath) {
|
|
9207
|
-
if (!
|
|
9602
|
+
if (!existsSync31(filePath))
|
|
9208
9603
|
return { name, status: "missing" };
|
|
9209
9604
|
try {
|
|
9210
9605
|
const header = readFileSync24(filePath).slice(0, 16).toString("utf-8");
|
|
@@ -9386,7 +9781,7 @@ function getAheadBehind(branch) {
|
|
|
9386
9781
|
if (!branch)
|
|
9387
9782
|
return { ahead: 0, behind: 0 };
|
|
9388
9783
|
try {
|
|
9389
|
-
const raw =
|
|
9784
|
+
const raw = execSync7(`git rev-list --left-right --count origin/${branch}...${branch}`, { cwd: minkRoot(), timeout: 5000, stdio: ["pipe", "pipe", "pipe"] }).toString().trim();
|
|
9390
9785
|
const [behindStr, aheadStr] = raw.split(/\s+/);
|
|
9391
9786
|
return {
|
|
9392
9787
|
behind: Number(behindStr) || 0,
|
|
@@ -9398,7 +9793,7 @@ function getAheadBehind(branch) {
|
|
|
9398
9793
|
}
|
|
9399
9794
|
function getPendingChanges() {
|
|
9400
9795
|
try {
|
|
9401
|
-
const raw =
|
|
9796
|
+
const raw = execSync7("git status --porcelain", {
|
|
9402
9797
|
cwd: minkRoot(),
|
|
9403
9798
|
timeout: 5000,
|
|
9404
9799
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -9470,7 +9865,7 @@ function countMarkdownIn(dir) {
|
|
|
9470
9865
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
9471
9866
|
if (WIKI_TREE_EXCLUDES.has(entry.name) || entry.name.startsWith("."))
|
|
9472
9867
|
continue;
|
|
9473
|
-
const fullPath =
|
|
9868
|
+
const fullPath = join28(dir, entry.name);
|
|
9474
9869
|
if (entry.isDirectory()) {
|
|
9475
9870
|
count += countMarkdownIn(fullPath);
|
|
9476
9871
|
} else if (entry.name.endsWith(".md") && !entry.name.startsWith("_")) {
|
|
@@ -9499,7 +9894,7 @@ function buildVaultTree(root) {
|
|
|
9499
9894
|
for (const entry of entries) {
|
|
9500
9895
|
if (!entry.isDir)
|
|
9501
9896
|
continue;
|
|
9502
|
-
const fullPath =
|
|
9897
|
+
const fullPath = join28(dir, entry.name);
|
|
9503
9898
|
const relPath = fullPath.slice(root.length + 1);
|
|
9504
9899
|
const count = countMarkdownIn(fullPath);
|
|
9505
9900
|
nodes.push({ name: entry.name, path: relPath, count, depth });
|
|
@@ -9584,7 +9979,7 @@ function resolveVaultRelativePath(relPath) {
|
|
|
9584
9979
|
if (!relPath || relPath.includes("\x00"))
|
|
9585
9980
|
return null;
|
|
9586
9981
|
const root = resolveVaultPath();
|
|
9587
|
-
const absolute =
|
|
9982
|
+
const absolute = resolve6(root, relPath);
|
|
9588
9983
|
const normalizedRoot = normalize(root) + sep;
|
|
9589
9984
|
if (!absolute.startsWith(normalizedRoot) && absolute !== normalize(root)) {
|
|
9590
9985
|
return null;
|
|
@@ -9922,7 +10317,7 @@ async function triggerIngestFile(sourcePath, category, tags, dedupKey) {
|
|
|
9922
10317
|
if (!isValidCategory(category)) {
|
|
9923
10318
|
return { success: false, error: `Invalid category: ${category}` };
|
|
9924
10319
|
}
|
|
9925
|
-
const expanded = sourcePath.startsWith("~/") ?
|
|
10320
|
+
const expanded = sourcePath.startsWith("~/") ? join28(process.env.HOME ?? "", sourcePath.slice(2)) : sourcePath;
|
|
9926
10321
|
if (!fsExistsSync(expanded)) {
|
|
9927
10322
|
return { success: false, error: `Source file not found: ${sourcePath}` };
|
|
9928
10323
|
}
|
|
@@ -10009,8 +10404,8 @@ __export(exports_dashboard_server, {
|
|
|
10009
10404
|
startDashboardServer: () => startDashboardServer
|
|
10010
10405
|
});
|
|
10011
10406
|
import { watch } from "fs";
|
|
10012
|
-
import { existsSync as
|
|
10013
|
-
import { basename as basename7, dirname as
|
|
10407
|
+
import { existsSync as existsSync32 } from "fs";
|
|
10408
|
+
import { basename as basename7, dirname as dirname13, join as join29, extname as extname2 } from "path";
|
|
10014
10409
|
|
|
10015
10410
|
class SSEManager {
|
|
10016
10411
|
clients = new Map;
|
|
@@ -10187,15 +10582,15 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
10187
10582
|
timestamp: new Date().toISOString()
|
|
10188
10583
|
});
|
|
10189
10584
|
});
|
|
10190
|
-
const __dir =
|
|
10585
|
+
const __dir = dirname13(new URL(import.meta.url).pathname);
|
|
10191
10586
|
let pkgRoot = __dir;
|
|
10192
|
-
while (pkgRoot !==
|
|
10193
|
-
if (
|
|
10587
|
+
while (pkgRoot !== dirname13(pkgRoot)) {
|
|
10588
|
+
if (existsSync32(join29(pkgRoot, "package.json")))
|
|
10194
10589
|
break;
|
|
10195
|
-
pkgRoot =
|
|
10590
|
+
pkgRoot = dirname13(pkgRoot);
|
|
10196
10591
|
}
|
|
10197
|
-
const dashboardOutDir =
|
|
10198
|
-
const dashboardBuilt =
|
|
10592
|
+
const dashboardOutDir = join29(pkgRoot, "dashboard", "out");
|
|
10593
|
+
const dashboardBuilt = existsSync32(join29(dashboardOutDir, "index.html"));
|
|
10199
10594
|
let clientIdCounter = 0;
|
|
10200
10595
|
if (!dashboardBuilt) {
|
|
10201
10596
|
console.warn("[mink] dashboard not built. Run: cd dashboard && bun run build");
|
|
@@ -10225,9 +10620,9 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
10225
10620
|
} else {
|
|
10226
10621
|
let filePath;
|
|
10227
10622
|
if (pathname === "/") {
|
|
10228
|
-
filePath =
|
|
10623
|
+
filePath = join29(dashboardOutDir, "index.html");
|
|
10229
10624
|
} else {
|
|
10230
|
-
filePath =
|
|
10625
|
+
filePath = join29(dashboardOutDir, pathname);
|
|
10231
10626
|
}
|
|
10232
10627
|
if (!filePath.startsWith(dashboardOutDir)) {
|
|
10233
10628
|
return jsonResponse({ error: "Forbidden" }, 403);
|
|
@@ -10240,7 +10635,7 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
10240
10635
|
const htmlServed = await serveFile(filePath + ".html", "text/html; charset=utf-8");
|
|
10241
10636
|
if (htmlServed)
|
|
10242
10637
|
return htmlServed;
|
|
10243
|
-
const indexServed = await serveFile(
|
|
10638
|
+
const indexServed = await serveFile(join29(dashboardOutDir, "index.html"), "text/html; charset=utf-8");
|
|
10244
10639
|
if (indexServed)
|
|
10245
10640
|
return indexServed;
|
|
10246
10641
|
}
|
|
@@ -10349,7 +10744,7 @@ retry: 3000
|
|
|
10349
10744
|
if (!filename || filename.includes("..") || filename.includes("/")) {
|
|
10350
10745
|
return jsonResponse({ error: "Invalid filename" }, 400);
|
|
10351
10746
|
}
|
|
10352
|
-
const imgPath =
|
|
10747
|
+
const imgPath = join29(designCapturesDir(resolvedCwd), filename);
|
|
10353
10748
|
const served = await serveFile(imgPath, "image/jpeg");
|
|
10354
10749
|
if (served) {
|
|
10355
10750
|
served.headers.set("Cache-Control", "public, max-age=60");
|
|
@@ -10584,9 +10979,9 @@ __export(exports_dashboard, {
|
|
|
10584
10979
|
resolveStartupCwd: () => resolveStartupCwd,
|
|
10585
10980
|
dashboard: () => dashboard
|
|
10586
10981
|
});
|
|
10587
|
-
import { existsSync as
|
|
10982
|
+
import { existsSync as existsSync33 } from "fs";
|
|
10588
10983
|
function resolveStartupCwd(cwd, registered = listRegisteredProjects()) {
|
|
10589
|
-
if (
|
|
10984
|
+
if (existsSync33(projectDir(cwd))) {
|
|
10590
10985
|
return { kind: "active", cwd };
|
|
10591
10986
|
}
|
|
10592
10987
|
if (registered.length === 0) {
|
|
@@ -10623,18 +11018,18 @@ var init_dashboard = __esm(() => {
|
|
|
10623
11018
|
});
|
|
10624
11019
|
|
|
10625
11020
|
// src/commands/init.ts
|
|
10626
|
-
import { mkdirSync as
|
|
10627
|
-
import { resolve as
|
|
11021
|
+
import { mkdirSync as mkdirSync15, existsSync as existsSync34 } from "fs";
|
|
11022
|
+
import { resolve as resolve7, dirname as dirname14, basename as basename8, join as join30 } from "path";
|
|
10628
11023
|
function resolveCliPathFrom2(selfPath) {
|
|
10629
|
-
const selfDir =
|
|
11024
|
+
const selfDir = dirname14(selfPath);
|
|
10630
11025
|
if (selfPath.endsWith("dist/cli.js") || selfPath.endsWith("dist/cli.bun.js") || selfPath.endsWith("dist/cli.node.js")) {
|
|
10631
|
-
return
|
|
11026
|
+
return join30(selfDir, "cli.js");
|
|
10632
11027
|
}
|
|
10633
|
-
const packageRoot =
|
|
10634
|
-
const distShim =
|
|
10635
|
-
if (
|
|
11028
|
+
const packageRoot = resolve7(selfDir, "..", "..");
|
|
11029
|
+
const distShim = join30(packageRoot, "dist", "cli.js");
|
|
11030
|
+
if (existsSync34(distShim))
|
|
10636
11031
|
return distShim;
|
|
10637
|
-
return
|
|
11032
|
+
return join30(packageRoot, "src", "cli.ts");
|
|
10638
11033
|
}
|
|
10639
11034
|
function resolveCliPath2() {
|
|
10640
11035
|
return resolveCliPathFrom2(new URL(import.meta.url).pathname);
|
|
@@ -10676,7 +11071,7 @@ function isMinkHook2(entry) {
|
|
|
10676
11071
|
return false;
|
|
10677
11072
|
}
|
|
10678
11073
|
function mergeHooksIntoSettings2(settingsPath, newHooks) {
|
|
10679
|
-
|
|
11074
|
+
mkdirSync15(dirname14(settingsPath), { recursive: true });
|
|
10680
11075
|
const existing = safeReadJson(settingsPath) ?? {};
|
|
10681
11076
|
const existingHooks = existing.hooks ?? {};
|
|
10682
11077
|
for (const [event, entries] of Object.entries(newHooks)) {
|
|
@@ -10694,13 +11089,16 @@ var init_init2 = __esm(() => {
|
|
|
10694
11089
|
init_device();
|
|
10695
11090
|
init_git_identity();
|
|
10696
11091
|
init_vault();
|
|
11092
|
+
init_agent_detect();
|
|
11093
|
+
init_agent_pi();
|
|
11094
|
+
init_prompt();
|
|
10697
11095
|
});
|
|
10698
11096
|
|
|
10699
11097
|
// src/core/daemon-service.ts
|
|
10700
|
-
import { execSync as
|
|
10701
|
-
import { existsSync as
|
|
10702
|
-
import { homedir as
|
|
10703
|
-
import { dirname as
|
|
11098
|
+
import { execSync as execSync8 } from "child_process";
|
|
11099
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync16, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "fs";
|
|
11100
|
+
import { homedir as homedir5 } from "os";
|
|
11101
|
+
import { dirname as dirname15, join as join31 } from "path";
|
|
10704
11102
|
function detectPlatform() {
|
|
10705
11103
|
if (process.platform === "linux")
|
|
10706
11104
|
return "systemd";
|
|
@@ -10710,11 +11108,11 @@ function detectPlatform() {
|
|
|
10710
11108
|
}
|
|
10711
11109
|
function resolveServiceInvocation() {
|
|
10712
11110
|
const entry = process.argv[1];
|
|
10713
|
-
if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) &&
|
|
11111
|
+
if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) && existsSync35(entry)) {
|
|
10714
11112
|
return {
|
|
10715
11113
|
executable: entry,
|
|
10716
11114
|
args: ["daemon", "start"],
|
|
10717
|
-
pathDir:
|
|
11115
|
+
pathDir: dirname15(entry)
|
|
10718
11116
|
};
|
|
10719
11117
|
}
|
|
10720
11118
|
const cliPath = resolveCliPath2();
|
|
@@ -10722,17 +11120,17 @@ function resolveServiceInvocation() {
|
|
|
10722
11120
|
return {
|
|
10723
11121
|
executable: interpreter,
|
|
10724
11122
|
args: [cliPath, "daemon", "start"],
|
|
10725
|
-
pathDir:
|
|
11123
|
+
pathDir: dirname15(interpreter)
|
|
10726
11124
|
};
|
|
10727
11125
|
}
|
|
10728
11126
|
function servicePaths(platform2) {
|
|
10729
|
-
const home =
|
|
11127
|
+
const home = homedir5();
|
|
10730
11128
|
if (platform2 === "systemd") {
|
|
10731
|
-
const unitDir2 =
|
|
10732
|
-
return { unitDir: unitDir2, unitFile:
|
|
11129
|
+
const unitDir2 = join31(home, ".config", "systemd", "user");
|
|
11130
|
+
return { unitDir: unitDir2, unitFile: join31(unitDir2, "mink-daemon.service") };
|
|
10733
11131
|
}
|
|
10734
|
-
const unitDir =
|
|
10735
|
-
return { unitDir, unitFile:
|
|
11132
|
+
const unitDir = join31(home, "Library", "LaunchAgents");
|
|
11133
|
+
return { unitDir, unitFile: join31(unitDir, "com.mink.daemon.plist") };
|
|
10736
11134
|
}
|
|
10737
11135
|
function renderSystemdUnit(inv) {
|
|
10738
11136
|
const execStart = [inv.executable, ...inv.args].join(" ");
|
|
@@ -10806,17 +11204,17 @@ function installService(options = {}) {
|
|
|
10806
11204
|
process.exit(1);
|
|
10807
11205
|
}
|
|
10808
11206
|
const paths = servicePaths(platform2);
|
|
10809
|
-
if (
|
|
11207
|
+
if (existsSync35(paths.unitFile) && !options.force) {
|
|
10810
11208
|
console.error(`[mink] unit file already exists: ${paths.unitFile}`);
|
|
10811
11209
|
console.error(" re-run with --force to overwrite, or run `mink daemon uninstall` first");
|
|
10812
11210
|
process.exit(1);
|
|
10813
11211
|
}
|
|
10814
11212
|
const inv = resolveServiceInvocation();
|
|
10815
|
-
|
|
11213
|
+
mkdirSync16(paths.unitDir, { recursive: true });
|
|
10816
11214
|
if (platform2 === "systemd") {
|
|
10817
11215
|
writeFileSync10(paths.unitFile, renderSystemdUnit(inv));
|
|
10818
11216
|
try {
|
|
10819
|
-
|
|
11217
|
+
execSync8("systemctl --user daemon-reload", { stdio: "ignore" });
|
|
10820
11218
|
} catch {}
|
|
10821
11219
|
console.log(`[mink] wrote ${paths.unitFile}`);
|
|
10822
11220
|
console.log("[mink] next steps:");
|
|
@@ -10839,24 +11237,24 @@ function uninstallService() {
|
|
|
10839
11237
|
process.exit(1);
|
|
10840
11238
|
}
|
|
10841
11239
|
const paths = servicePaths(platform2);
|
|
10842
|
-
if (!
|
|
11240
|
+
if (!existsSync35(paths.unitFile)) {
|
|
10843
11241
|
console.log(`[mink] no unit file at ${paths.unitFile} — nothing to uninstall`);
|
|
10844
11242
|
return;
|
|
10845
11243
|
}
|
|
10846
11244
|
if (platform2 === "systemd") {
|
|
10847
11245
|
try {
|
|
10848
|
-
|
|
11246
|
+
execSync8("systemctl --user disable --now mink-daemon.service", {
|
|
10849
11247
|
stdio: "ignore"
|
|
10850
11248
|
});
|
|
10851
11249
|
} catch {}
|
|
10852
11250
|
unlinkSync5(paths.unitFile);
|
|
10853
11251
|
try {
|
|
10854
|
-
|
|
11252
|
+
execSync8("systemctl --user daemon-reload", { stdio: "ignore" });
|
|
10855
11253
|
} catch {}
|
|
10856
11254
|
console.log(`[mink] removed ${paths.unitFile}`);
|
|
10857
11255
|
} else {
|
|
10858
11256
|
try {
|
|
10859
|
-
|
|
11257
|
+
execSync8(`launchctl unload -w ${paths.unitFile}`, { stdio: "ignore" });
|
|
10860
11258
|
} catch {}
|
|
10861
11259
|
unlinkSync5(paths.unitFile);
|
|
10862
11260
|
console.log(`[mink] removed ${paths.unitFile}`);
|
|
@@ -10871,7 +11269,7 @@ var exports_daemon = {};
|
|
|
10871
11269
|
__export(exports_daemon, {
|
|
10872
11270
|
daemon: () => daemon
|
|
10873
11271
|
});
|
|
10874
|
-
import { readFileSync as readFileSync25, existsSync as
|
|
11272
|
+
import { readFileSync as readFileSync25, existsSync as existsSync36 } from "fs";
|
|
10875
11273
|
async function daemon(cwd, args) {
|
|
10876
11274
|
const subcommand = args[0];
|
|
10877
11275
|
switch (subcommand) {
|
|
@@ -10887,7 +11285,7 @@ async function daemon(cwd, args) {
|
|
|
10887
11285
|
break;
|
|
10888
11286
|
case "logs": {
|
|
10889
11287
|
const logPath = schedulerLogPath();
|
|
10890
|
-
if (!
|
|
11288
|
+
if (!existsSync36(logPath)) {
|
|
10891
11289
|
console.log("[mink] no log file found");
|
|
10892
11290
|
return;
|
|
10893
11291
|
}
|
|
@@ -11159,13 +11557,13 @@ function printValidKeys() {
|
|
|
11159
11557
|
}
|
|
11160
11558
|
}
|
|
11161
11559
|
function readLineFromStdin() {
|
|
11162
|
-
return new Promise((
|
|
11560
|
+
return new Promise((resolve9) => {
|
|
11163
11561
|
const chunks = [];
|
|
11164
11562
|
process.stdin.resume();
|
|
11165
11563
|
process.stdin.setEncoding("utf-8");
|
|
11166
11564
|
process.stdin.once("data", (data) => {
|
|
11167
11565
|
process.stdin.pause();
|
|
11168
|
-
|
|
11566
|
+
resolve9(String(data).trim());
|
|
11169
11567
|
});
|
|
11170
11568
|
});
|
|
11171
11569
|
}
|
|
@@ -11240,7 +11638,7 @@ var exports_update = {};
|
|
|
11240
11638
|
__export(exports_update, {
|
|
11241
11639
|
update: () => update
|
|
11242
11640
|
});
|
|
11243
|
-
import { resolve as
|
|
11641
|
+
import { resolve as resolve9 } from "path";
|
|
11244
11642
|
function parseArgs(args) {
|
|
11245
11643
|
let dryRun = false;
|
|
11246
11644
|
let project = null;
|
|
@@ -11298,7 +11696,7 @@ async function update(cwd, args) {
|
|
|
11298
11696
|
}
|
|
11299
11697
|
const backupName = createBackup(target.cwd);
|
|
11300
11698
|
console.log(` backup: ${backupName}`);
|
|
11301
|
-
const settingsPath =
|
|
11699
|
+
const settingsPath = resolve9(target.cwd, ".claude", "settings.json");
|
|
11302
11700
|
mergeHooksIntoSettings2(settingsPath, newHooks);
|
|
11303
11701
|
console.log(" hooks: updated");
|
|
11304
11702
|
const metaPath = projectMetaPath(target.cwd);
|
|
@@ -11474,7 +11872,7 @@ var init_restore = __esm(() => {
|
|
|
11474
11872
|
|
|
11475
11873
|
// src/core/design-eval/server-detect.ts
|
|
11476
11874
|
import { readFileSync as readFileSync26 } from "fs";
|
|
11477
|
-
import { join as
|
|
11875
|
+
import { join as join32 } from "path";
|
|
11478
11876
|
async function probePort(port) {
|
|
11479
11877
|
try {
|
|
11480
11878
|
const controller = new AbortController;
|
|
@@ -11496,7 +11894,7 @@ async function findRunningServer(ports = DEFAULT_PROBE_PORTS) {
|
|
|
11496
11894
|
}
|
|
11497
11895
|
function detectDevCommand(cwd) {
|
|
11498
11896
|
try {
|
|
11499
|
-
const raw = readFileSync26(
|
|
11897
|
+
const raw = readFileSync26(join32(cwd, "package.json"), "utf-8");
|
|
11500
11898
|
const pkg = JSON.parse(raw);
|
|
11501
11899
|
const scripts = pkg.scripts;
|
|
11502
11900
|
if (!scripts || typeof scripts !== "object")
|
|
@@ -11516,10 +11914,10 @@ var init_server_detect = __esm(() => {
|
|
|
11516
11914
|
});
|
|
11517
11915
|
|
|
11518
11916
|
// src/core/design-eval/route-detect.ts
|
|
11519
|
-
import { existsSync as
|
|
11520
|
-
import { join as
|
|
11917
|
+
import { existsSync as existsSync37, readdirSync as readdirSync10, statSync as statSync12 } from "fs";
|
|
11918
|
+
import { join as join33, relative as relative8, sep as sep2 } from "path";
|
|
11521
11919
|
function detectFramework(cwd) {
|
|
11522
|
-
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) =>
|
|
11920
|
+
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync37(join33(cwd, `${name}.${ext}`))) || existsSync37(join33(cwd, name));
|
|
11523
11921
|
if (has("next.config"))
|
|
11524
11922
|
return "nextjs";
|
|
11525
11923
|
if (has("svelte.config"))
|
|
@@ -11544,8 +11942,8 @@ function detectRoutes(cwd) {
|
|
|
11544
11942
|
}
|
|
11545
11943
|
function detectNextRoutes(cwd) {
|
|
11546
11944
|
const routes = [];
|
|
11547
|
-
const appDir =
|
|
11548
|
-
if (
|
|
11945
|
+
const appDir = join33(cwd, "app");
|
|
11946
|
+
if (existsSync37(appDir)) {
|
|
11549
11947
|
const pageFiles = findFiles(appDir, /^page\.(tsx?|jsx?)$/);
|
|
11550
11948
|
for (const file of pageFiles) {
|
|
11551
11949
|
const rel = relative8(appDir, file);
|
|
@@ -11556,8 +11954,8 @@ function detectNextRoutes(cwd) {
|
|
|
11556
11954
|
routes.push(route);
|
|
11557
11955
|
}
|
|
11558
11956
|
}
|
|
11559
|
-
const pagesDir =
|
|
11560
|
-
if (
|
|
11957
|
+
const pagesDir = join33(cwd, "pages");
|
|
11958
|
+
if (existsSync37(pagesDir)) {
|
|
11561
11959
|
const pageFiles = findFiles(pagesDir, /\.(tsx?|jsx?)$/);
|
|
11562
11960
|
for (const file of pageFiles) {
|
|
11563
11961
|
const rel = relative8(pagesDir, file);
|
|
@@ -11576,8 +11974,8 @@ function detectNextRoutes(cwd) {
|
|
|
11576
11974
|
return unique.length > 0 ? unique.sort() : ["/"];
|
|
11577
11975
|
}
|
|
11578
11976
|
function detectSvelteKitRoutes(cwd) {
|
|
11579
|
-
const routesDir =
|
|
11580
|
-
if (!
|
|
11977
|
+
const routesDir = join33(cwd, "src", "routes");
|
|
11978
|
+
if (!existsSync37(routesDir))
|
|
11581
11979
|
return ["/"];
|
|
11582
11980
|
const routes = [];
|
|
11583
11981
|
const pageFiles = findFiles(routesDir, /^\+page\.svelte$/);
|
|
@@ -11592,8 +11990,8 @@ function detectSvelteKitRoutes(cwd) {
|
|
|
11592
11990
|
return routes.length > 0 ? routes.sort() : ["/"];
|
|
11593
11991
|
}
|
|
11594
11992
|
function detectNuxtRoutes(cwd) {
|
|
11595
|
-
const pagesDir =
|
|
11596
|
-
if (!
|
|
11993
|
+
const pagesDir = join33(cwd, "pages");
|
|
11994
|
+
if (!existsSync37(pagesDir))
|
|
11597
11995
|
return ["/"];
|
|
11598
11996
|
const routes = [];
|
|
11599
11997
|
const vueFiles = findFiles(pagesDir, /\.vue$/);
|
|
@@ -11619,7 +12017,7 @@ function findFiles(dir, pattern) {
|
|
|
11619
12017
|
for (const entry of entries) {
|
|
11620
12018
|
if (entry.startsWith(".") || entry === "node_modules")
|
|
11621
12019
|
continue;
|
|
11622
|
-
const full =
|
|
12020
|
+
const full = join33(current, entry);
|
|
11623
12021
|
try {
|
|
11624
12022
|
const stat2 = statSync12(full);
|
|
11625
12023
|
if (stat2.isDirectory()) {
|
|
@@ -11647,11 +12045,11 @@ function __extends(d, b) {
|
|
|
11647
12045
|
}
|
|
11648
12046
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
11649
12047
|
function adopt(value) {
|
|
11650
|
-
return value instanceof P ? value : new P(function(
|
|
11651
|
-
|
|
12048
|
+
return value instanceof P ? value : new P(function(resolve10) {
|
|
12049
|
+
resolve10(value);
|
|
11652
12050
|
});
|
|
11653
12051
|
}
|
|
11654
|
-
return new (P || (P = Promise))(function(
|
|
12052
|
+
return new (P || (P = Promise))(function(resolve10, reject) {
|
|
11655
12053
|
function fulfilled(value) {
|
|
11656
12054
|
try {
|
|
11657
12055
|
step(generator.next(value));
|
|
@@ -11667,7 +12065,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
11667
12065
|
}
|
|
11668
12066
|
}
|
|
11669
12067
|
function step(result) {
|
|
11670
|
-
result.done ?
|
|
12068
|
+
result.done ? resolve10(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
11671
12069
|
}
|
|
11672
12070
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11673
12071
|
});
|
|
@@ -11850,14 +12248,14 @@ function __asyncValues(o) {
|
|
|
11850
12248
|
}, i);
|
|
11851
12249
|
function verb(n) {
|
|
11852
12250
|
i[n] = o[n] && function(v) {
|
|
11853
|
-
return new Promise(function(
|
|
11854
|
-
v = o[n](v), settle(
|
|
12251
|
+
return new Promise(function(resolve10, reject) {
|
|
12252
|
+
v = o[n](v), settle(resolve10, reject, v.done, v.value);
|
|
11855
12253
|
});
|
|
11856
12254
|
};
|
|
11857
12255
|
}
|
|
11858
|
-
function settle(
|
|
12256
|
+
function settle(resolve10, reject, d, v) {
|
|
11859
12257
|
Promise.resolve(v).then(function(v2) {
|
|
11860
|
-
|
|
12258
|
+
resolve10({ value: v2, done: d });
|
|
11861
12259
|
}, reject);
|
|
11862
12260
|
}
|
|
11863
12261
|
}
|
|
@@ -12388,7 +12786,7 @@ function of() {
|
|
|
12388
12786
|
}
|
|
12389
12787
|
function lastValueFrom(source, config22) {
|
|
12390
12788
|
var hasConfig = typeof config22 === "object";
|
|
12391
|
-
return new Promise(function(
|
|
12789
|
+
return new Promise(function(resolve10, reject) {
|
|
12392
12790
|
var _hasValue = false;
|
|
12393
12791
|
var _value;
|
|
12394
12792
|
source.subscribe({
|
|
@@ -12399,9 +12797,9 @@ function lastValueFrom(source, config22) {
|
|
|
12399
12797
|
error: reject,
|
|
12400
12798
|
complete: function() {
|
|
12401
12799
|
if (_hasValue) {
|
|
12402
|
-
|
|
12800
|
+
resolve10(_value);
|
|
12403
12801
|
} else if (hasConfig) {
|
|
12404
|
-
|
|
12802
|
+
resolve10(config22.defaultValue);
|
|
12405
12803
|
} else {
|
|
12406
12804
|
reject(new EmptyError);
|
|
12407
12805
|
}
|
|
@@ -12411,16 +12809,16 @@ function lastValueFrom(source, config22) {
|
|
|
12411
12809
|
}
|
|
12412
12810
|
function firstValueFrom(source, config22) {
|
|
12413
12811
|
var hasConfig = typeof config22 === "object";
|
|
12414
|
-
return new Promise(function(
|
|
12812
|
+
return new Promise(function(resolve10, reject) {
|
|
12415
12813
|
var subscriber = new SafeSubscriber({
|
|
12416
12814
|
next: function(value) {
|
|
12417
|
-
|
|
12815
|
+
resolve10(value);
|
|
12418
12816
|
subscriber.unsubscribe();
|
|
12419
12817
|
},
|
|
12420
12818
|
error: reject,
|
|
12421
12819
|
complete: function() {
|
|
12422
12820
|
if (hasConfig) {
|
|
12423
|
-
|
|
12821
|
+
resolve10(config22.defaultValue);
|
|
12424
12822
|
} else {
|
|
12425
12823
|
reject(new EmptyError);
|
|
12426
12824
|
}
|
|
@@ -13472,7 +13870,7 @@ var init_rxjs = __esm(() => {
|
|
|
13472
13870
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
13473
13871
|
var _this = this;
|
|
13474
13872
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
13475
|
-
return new promiseCtor(function(
|
|
13873
|
+
return new promiseCtor(function(resolve10, reject) {
|
|
13476
13874
|
var subscriber = new SafeSubscriber({
|
|
13477
13875
|
next: function(value) {
|
|
13478
13876
|
try {
|
|
@@ -13483,7 +13881,7 @@ var init_rxjs = __esm(() => {
|
|
|
13483
13881
|
}
|
|
13484
13882
|
},
|
|
13485
13883
|
error: reject,
|
|
13486
|
-
complete:
|
|
13884
|
+
complete: resolve10
|
|
13487
13885
|
});
|
|
13488
13886
|
_this.subscribe(subscriber);
|
|
13489
13887
|
});
|
|
@@ -13505,14 +13903,14 @@ var init_rxjs = __esm(() => {
|
|
|
13505
13903
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
13506
13904
|
var _this = this;
|
|
13507
13905
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
13508
|
-
return new promiseCtor(function(
|
|
13906
|
+
return new promiseCtor(function(resolve10, reject) {
|
|
13509
13907
|
var value;
|
|
13510
13908
|
_this.subscribe(function(x) {
|
|
13511
13909
|
return value = x;
|
|
13512
13910
|
}, function(err) {
|
|
13513
13911
|
return reject(err);
|
|
13514
13912
|
}, function() {
|
|
13515
|
-
return
|
|
13913
|
+
return resolve10(value);
|
|
13516
13914
|
});
|
|
13517
13915
|
});
|
|
13518
13916
|
};
|
|
@@ -15438,8 +15836,8 @@ class Deferred {
|
|
|
15438
15836
|
#isRejected = false;
|
|
15439
15837
|
#value;
|
|
15440
15838
|
#resolve;
|
|
15441
|
-
#taskPromise = new Promise((
|
|
15442
|
-
this.#resolve =
|
|
15839
|
+
#taskPromise = new Promise((resolve10) => {
|
|
15840
|
+
this.#resolve = resolve10;
|
|
15443
15841
|
});
|
|
15444
15842
|
#timeoutId;
|
|
15445
15843
|
#timeoutError;
|
|
@@ -15528,12 +15926,12 @@ var init_Mutex = __esm(() => {
|
|
|
15528
15926
|
return new Mutex.Guard(this, onRelease);
|
|
15529
15927
|
}
|
|
15530
15928
|
release() {
|
|
15531
|
-
const
|
|
15532
|
-
if (!
|
|
15929
|
+
const resolve10 = this.#acquirers.shift();
|
|
15930
|
+
if (!resolve10) {
|
|
15533
15931
|
this.#locked = false;
|
|
15534
15932
|
return;
|
|
15535
15933
|
}
|
|
15536
|
-
|
|
15934
|
+
resolve10();
|
|
15537
15935
|
}
|
|
15538
15936
|
};
|
|
15539
15937
|
});
|
|
@@ -17277,12 +17675,12 @@ var init_locators = __esm(() => {
|
|
|
17277
17675
|
}
|
|
17278
17676
|
return defer(() => {
|
|
17279
17677
|
return from(handle.evaluate((element) => {
|
|
17280
|
-
return new Promise((
|
|
17678
|
+
return new Promise((resolve10) => {
|
|
17281
17679
|
window.requestAnimationFrame(() => {
|
|
17282
17680
|
const rect1 = element.getBoundingClientRect();
|
|
17283
17681
|
window.requestAnimationFrame(() => {
|
|
17284
17682
|
const rect2 = element.getBoundingClientRect();
|
|
17285
|
-
|
|
17683
|
+
resolve10([
|
|
17286
17684
|
{
|
|
17287
17685
|
x: rect1.x,
|
|
17288
17686
|
y: rect1.y,
|
|
@@ -18573,9 +18971,9 @@ var init_ElementHandle = __esm(() => {
|
|
|
18573
18971
|
const handle = await this.#asSVGElementHandle();
|
|
18574
18972
|
const target = __addDisposableResource6(env_5, handle && await handle.#getOwnerSVGElement(), false);
|
|
18575
18973
|
return await (target ?? this).evaluate(async (element, threshold) => {
|
|
18576
|
-
const visibleRatio = await new Promise((
|
|
18974
|
+
const visibleRatio = await new Promise((resolve10) => {
|
|
18577
18975
|
const observer = new IntersectionObserver((entries) => {
|
|
18578
|
-
|
|
18976
|
+
resolve10(entries[0].intersectionRatio);
|
|
18579
18977
|
observer.disconnect();
|
|
18580
18978
|
});
|
|
18581
18979
|
observer.observe(element);
|
|
@@ -18969,7 +19367,7 @@ var init_Frame = __esm(() => {
|
|
|
18969
19367
|
}
|
|
18970
19368
|
type = type ?? "text/javascript";
|
|
18971
19369
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, id, type: type2, content: content2 }) => {
|
|
18972
|
-
return await new Promise((
|
|
19370
|
+
return await new Promise((resolve10, reject) => {
|
|
18973
19371
|
const script = document.createElement("script");
|
|
18974
19372
|
script.type = type2;
|
|
18975
19373
|
script.text = content2;
|
|
@@ -18982,12 +19380,12 @@ var init_Frame = __esm(() => {
|
|
|
18982
19380
|
if (url) {
|
|
18983
19381
|
script.src = url;
|
|
18984
19382
|
script.addEventListener("load", () => {
|
|
18985
|
-
|
|
19383
|
+
resolve10(script);
|
|
18986
19384
|
}, { once: true });
|
|
18987
19385
|
document.head.appendChild(script);
|
|
18988
19386
|
} else {
|
|
18989
19387
|
document.head.appendChild(script);
|
|
18990
|
-
|
|
19388
|
+
resolve10(script);
|
|
18991
19389
|
}
|
|
18992
19390
|
});
|
|
18993
19391
|
}, { ...options, type, content }));
|
|
@@ -19004,7 +19402,7 @@ var init_Frame = __esm(() => {
|
|
|
19004
19402
|
options.content = content;
|
|
19005
19403
|
}
|
|
19006
19404
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, content: content2 }) => {
|
|
19007
|
-
return await new Promise((
|
|
19405
|
+
return await new Promise((resolve10, reject) => {
|
|
19008
19406
|
let element;
|
|
19009
19407
|
if (!url) {
|
|
19010
19408
|
element = document.createElement("style");
|
|
@@ -19016,7 +19414,7 @@ var init_Frame = __esm(() => {
|
|
|
19016
19414
|
element = link;
|
|
19017
19415
|
}
|
|
19018
19416
|
element.addEventListener("load", () => {
|
|
19019
|
-
|
|
19417
|
+
resolve10(element);
|
|
19020
19418
|
}, { once: true });
|
|
19021
19419
|
element.addEventListener("error", (event) => {
|
|
19022
19420
|
reject(new Error(event.message ?? "Could not load style"));
|
|
@@ -19870,9 +20268,9 @@ var init_Page = __esm(() => {
|
|
|
19870
20268
|
++this.#screencastSessionCount;
|
|
19871
20269
|
if (!this.#startScreencastPromise) {
|
|
19872
20270
|
this.#startScreencastPromise = this.mainFrame().client.send("Page.startScreencast", { format: "png" }).then(() => {
|
|
19873
|
-
return new Promise((
|
|
20271
|
+
return new Promise((resolve10) => {
|
|
19874
20272
|
return this.mainFrame().client.once("Page.screencastFrame", () => {
|
|
19875
|
-
return
|
|
20273
|
+
return resolve10();
|
|
19876
20274
|
});
|
|
19877
20275
|
});
|
|
19878
20276
|
});
|
|
@@ -22530,11 +22928,11 @@ function addPageBinding(type, name, prefix) {
|
|
|
22530
22928
|
return value instanceof Node;
|
|
22531
22929
|
})
|
|
22532
22930
|
}));
|
|
22533
|
-
return new Promise((
|
|
22931
|
+
return new Promise((resolve10, reject) => {
|
|
22534
22932
|
callPuppeteer.callbacks.set(seq, {
|
|
22535
22933
|
resolve(value) {
|
|
22536
22934
|
callPuppeteer.args.delete(seq);
|
|
22537
|
-
|
|
22935
|
+
resolve10(value);
|
|
22538
22936
|
},
|
|
22539
22937
|
reject(value) {
|
|
22540
22938
|
callPuppeteer.args.delete(seq);
|
|
@@ -25997,8 +26395,8 @@ var init_Input2 = __esm(() => {
|
|
|
25997
26395
|
if (typeof delay === "number") {
|
|
25998
26396
|
await Promise.all(actions);
|
|
25999
26397
|
actions.length = 0;
|
|
26000
|
-
await new Promise((
|
|
26001
|
-
setTimeout(
|
|
26398
|
+
await new Promise((resolve10) => {
|
|
26399
|
+
setTimeout(resolve10, delay);
|
|
26002
26400
|
});
|
|
26003
26401
|
}
|
|
26004
26402
|
actions.push(this.up({ ...options, clickCount }));
|
|
@@ -26018,9 +26416,9 @@ var init_Input2 = __esm(() => {
|
|
|
26018
26416
|
});
|
|
26019
26417
|
}
|
|
26020
26418
|
async drag(start, target) {
|
|
26021
|
-
const promise = new Promise((
|
|
26419
|
+
const promise = new Promise((resolve10) => {
|
|
26022
26420
|
this.#client.once("Input.dragIntercepted", (event) => {
|
|
26023
|
-
return
|
|
26421
|
+
return resolve10(event.data);
|
|
26024
26422
|
});
|
|
26025
26423
|
});
|
|
26026
26424
|
await this.move(start.x, start.y);
|
|
@@ -26061,8 +26459,8 @@ var init_Input2 = __esm(() => {
|
|
|
26061
26459
|
await this.dragEnter(target, data);
|
|
26062
26460
|
await this.dragOver(target, data);
|
|
26063
26461
|
if (delay) {
|
|
26064
|
-
await new Promise((
|
|
26065
|
-
return setTimeout(
|
|
26462
|
+
await new Promise((resolve10) => {
|
|
26463
|
+
return setTimeout(resolve10, delay);
|
|
26066
26464
|
});
|
|
26067
26465
|
}
|
|
26068
26466
|
await this.drop(target, data);
|
|
@@ -26874,9 +27272,9 @@ var init_Page2 = __esm(() => {
|
|
|
26874
27272
|
async captureHeapSnapshot(options) {
|
|
26875
27273
|
const { createWriteStream } = environment.value.fs;
|
|
26876
27274
|
const stream = createWriteStream(options.path);
|
|
26877
|
-
const streamPromise = new Promise((
|
|
27275
|
+
const streamPromise = new Promise((resolve10, reject) => {
|
|
26878
27276
|
stream.on("error", reject);
|
|
26879
|
-
stream.on("finish",
|
|
27277
|
+
stream.on("finish", resolve10);
|
|
26880
27278
|
});
|
|
26881
27279
|
const client = this.#primaryTargetClient;
|
|
26882
27280
|
await client.send("HeapProfiler.enable");
|
|
@@ -28389,10 +28787,10 @@ __export(exports_BrowserWebSocketTransport, {
|
|
|
28389
28787
|
|
|
28390
28788
|
class BrowserWebSocketTransport {
|
|
28391
28789
|
static create(url) {
|
|
28392
|
-
return new Promise((
|
|
28790
|
+
return new Promise((resolve10, reject) => {
|
|
28393
28791
|
const ws = new WebSocket(url);
|
|
28394
28792
|
ws.addEventListener("open", () => {
|
|
28395
|
-
return
|
|
28793
|
+
return resolve10(new BrowserWebSocketTransport(ws));
|
|
28396
28794
|
});
|
|
28397
28795
|
ws.addEventListener("error", reject);
|
|
28398
28796
|
});
|
|
@@ -31226,11 +31624,11 @@ var require_BrowsingContextProcessor = __commonJS((exports) => {
|
|
|
31226
31624
|
}
|
|
31227
31625
|
const parentCdpClient = context2.cdpTarget.parentCdpClient;
|
|
31228
31626
|
try {
|
|
31229
|
-
const detachedFromTargetPromise = new Promise((
|
|
31627
|
+
const detachedFromTargetPromise = new Promise((resolve10) => {
|
|
31230
31628
|
const onContextDestroyed = (event) => {
|
|
31231
31629
|
if (event.targetId === params.context) {
|
|
31232
31630
|
parentCdpClient.off("Target.detachedFromTarget", onContextDestroyed);
|
|
31233
|
-
|
|
31631
|
+
resolve10();
|
|
31234
31632
|
}
|
|
31235
31633
|
};
|
|
31236
31634
|
parentCdpClient.on("Target.detachedFromTarget", onContextDestroyed);
|
|
@@ -32550,7 +32948,7 @@ var require_ActionDispatcher = __commonJS((exports) => {
|
|
|
32550
32948
|
}
|
|
32551
32949
|
}
|
|
32552
32950
|
const promises = [
|
|
32553
|
-
new Promise((
|
|
32951
|
+
new Promise((resolve10) => setTimeout(resolve10, this.#tickDuration))
|
|
32554
32952
|
];
|
|
32555
32953
|
for (const option of options) {
|
|
32556
32954
|
promises.push(this.#dispatchAction(option));
|
|
@@ -33149,8 +33547,8 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
33149
33547
|
acquire() {
|
|
33150
33548
|
const state = { resolved: false };
|
|
33151
33549
|
if (this.#locked) {
|
|
33152
|
-
return new Promise((
|
|
33153
|
-
this.#acquirers.push(() =>
|
|
33550
|
+
return new Promise((resolve10) => {
|
|
33551
|
+
this.#acquirers.push(() => resolve10(this.#release.bind(this, state)));
|
|
33154
33552
|
});
|
|
33155
33553
|
}
|
|
33156
33554
|
this.#locked = true;
|
|
@@ -33161,12 +33559,12 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
33161
33559
|
throw new Error("Cannot release more than once.");
|
|
33162
33560
|
}
|
|
33163
33561
|
state.resolved = true;
|
|
33164
|
-
const
|
|
33165
|
-
if (!
|
|
33562
|
+
const resolve10 = this.#acquirers.shift();
|
|
33563
|
+
if (!resolve10) {
|
|
33166
33564
|
this.#locked = false;
|
|
33167
33565
|
return;
|
|
33168
33566
|
}
|
|
33169
|
-
|
|
33567
|
+
resolve10();
|
|
33170
33568
|
}
|
|
33171
33569
|
async run(action) {
|
|
33172
33570
|
const release = await this.acquire();
|
|
@@ -34293,8 +34691,8 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
34293
34691
|
let queueNonEmptyResolver = null;
|
|
34294
34692
|
return {
|
|
34295
34693
|
async getMessage() {
|
|
34296
|
-
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((
|
|
34297
|
-
queueNonEmptyResolver =
|
|
34694
|
+
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve10) => {
|
|
34695
|
+
queueNonEmptyResolver = resolve10;
|
|
34298
34696
|
});
|
|
34299
34697
|
await onMessage;
|
|
34300
34698
|
return queue.shift();
|
|
@@ -34380,7 +34778,7 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
34380
34778
|
functionDeclaration: String((id) => {
|
|
34381
34779
|
const w = window;
|
|
34382
34780
|
if (w[id] === undefined) {
|
|
34383
|
-
return new Promise((
|
|
34781
|
+
return new Promise((resolve10) => w[id] = resolve10);
|
|
34384
34782
|
}
|
|
34385
34783
|
const channelProxy = w[id];
|
|
34386
34784
|
delete w[id];
|
|
@@ -35731,8 +36129,8 @@ var require_Deferred = __commonJS((exports) => {
|
|
|
35731
36129
|
return this.#result;
|
|
35732
36130
|
}
|
|
35733
36131
|
constructor() {
|
|
35734
|
-
this.#promise = new Promise((
|
|
35735
|
-
this.#resolve =
|
|
36132
|
+
this.#promise = new Promise((resolve10, reject) => {
|
|
36133
|
+
this.#resolve = resolve10;
|
|
35736
36134
|
this.#reject = reject;
|
|
35737
36135
|
});
|
|
35738
36136
|
this.#promise.catch((_error) => {});
|
|
@@ -40057,11 +40455,11 @@ var require_BrowsingContextStorage = __commonJS((exports) => {
|
|
|
40057
40455
|
if (this.#contexts.has(browsingContextId)) {
|
|
40058
40456
|
return Promise.resolve(this.getContext(browsingContextId));
|
|
40059
40457
|
}
|
|
40060
|
-
return new Promise((
|
|
40458
|
+
return new Promise((resolve10) => {
|
|
40061
40459
|
const listener = (event) => {
|
|
40062
40460
|
if (event.browsingContext.id === browsingContextId) {
|
|
40063
40461
|
this.#eventEmitter.off("added", listener);
|
|
40064
|
-
|
|
40462
|
+
resolve10(event.browsingContext);
|
|
40065
40463
|
}
|
|
40066
40464
|
};
|
|
40067
40465
|
this.#eventEmitter.on("added", listener);
|
|
@@ -43557,8 +43955,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
43557
43955
|
const functionDeclaration = stringifyFunction(interpolateFunction((callback) => {
|
|
43558
43956
|
Object.assign(globalThis, {
|
|
43559
43957
|
[PLACEHOLDER("name")]: function(...args) {
|
|
43560
|
-
return new Promise((
|
|
43561
|
-
callback([
|
|
43958
|
+
return new Promise((resolve10, reject) => {
|
|
43959
|
+
callback([resolve10, reject, args]);
|
|
43562
43960
|
});
|
|
43563
43961
|
}
|
|
43564
43962
|
});
|
|
@@ -43646,8 +44044,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
43646
44044
|
return;
|
|
43647
44045
|
}
|
|
43648
44046
|
try {
|
|
43649
|
-
await dataHandle.evaluate(([
|
|
43650
|
-
|
|
44047
|
+
await dataHandle.evaluate(([resolve10], result2) => {
|
|
44048
|
+
resolve10(result2);
|
|
43651
44049
|
}, result);
|
|
43652
44050
|
} catch (error) {
|
|
43653
44051
|
debugError(error);
|
|
@@ -50939,7 +51337,7 @@ __export(exports_NodeWebSocketTransport, {
|
|
|
50939
51337
|
|
|
50940
51338
|
class NodeWebSocketTransport {
|
|
50941
51339
|
static create(url, headers) {
|
|
50942
|
-
return new Promise((
|
|
51340
|
+
return new Promise((resolve10, reject) => {
|
|
50943
51341
|
const ws = new wrapper_default(url, [], {
|
|
50944
51342
|
followRedirects: true,
|
|
50945
51343
|
perMessageDeflate: false,
|
|
@@ -50951,7 +51349,7 @@ class NodeWebSocketTransport {
|
|
|
50951
51349
|
}
|
|
50952
51350
|
});
|
|
50953
51351
|
ws.addEventListener("open", () => {
|
|
50954
|
-
return
|
|
51352
|
+
return resolve10(new NodeWebSocketTransport(ws));
|
|
50955
51353
|
});
|
|
50956
51354
|
ws.addEventListener("error", reject);
|
|
50957
51355
|
});
|
|
@@ -53843,8 +54241,8 @@ var require_helpers = __commonJS((exports) => {
|
|
|
53843
54241
|
function req(url, opts = {}) {
|
|
53844
54242
|
const href = typeof url === "string" ? url : url.href;
|
|
53845
54243
|
const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
53846
|
-
const promise = new Promise((
|
|
53847
|
-
req2.once("response",
|
|
54244
|
+
const promise = new Promise((resolve10, reject) => {
|
|
54245
|
+
req2.once("response", resolve10).once("error", reject).end();
|
|
53848
54246
|
});
|
|
53849
54247
|
req2.then = promise.then.bind(promise);
|
|
53850
54248
|
return req2;
|
|
@@ -54215,7 +54613,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
54215
54613
|
var debug_1 = __importDefault(require_src());
|
|
54216
54614
|
var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
54217
54615
|
function parseProxyResponse(socket) {
|
|
54218
|
-
return new Promise((
|
|
54616
|
+
return new Promise((resolve10, reject) => {
|
|
54219
54617
|
let buffersLength = 0;
|
|
54220
54618
|
const buffers = [];
|
|
54221
54619
|
function read() {
|
|
@@ -54284,7 +54682,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
54284
54682
|
}
|
|
54285
54683
|
debug2("got proxy server response: %o %o", firstLine, headers);
|
|
54286
54684
|
cleanup();
|
|
54287
|
-
|
|
54685
|
+
resolve10({
|
|
54288
54686
|
connect: {
|
|
54289
54687
|
statusCode,
|
|
54290
54688
|
statusText,
|
|
@@ -56388,11 +56786,11 @@ var require_receivebuffer = __commonJS((exports) => {
|
|
|
56388
56786
|
var require_socksclient = __commonJS((exports) => {
|
|
56389
56787
|
var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
56390
56788
|
function adopt(value) {
|
|
56391
|
-
return value instanceof P ? value : new P(function(
|
|
56392
|
-
|
|
56789
|
+
return value instanceof P ? value : new P(function(resolve10) {
|
|
56790
|
+
resolve10(value);
|
|
56393
56791
|
});
|
|
56394
56792
|
}
|
|
56395
|
-
return new (P || (P = Promise))(function(
|
|
56793
|
+
return new (P || (P = Promise))(function(resolve10, reject) {
|
|
56396
56794
|
function fulfilled(value) {
|
|
56397
56795
|
try {
|
|
56398
56796
|
step(generator.next(value));
|
|
@@ -56408,7 +56806,7 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
56408
56806
|
}
|
|
56409
56807
|
}
|
|
56410
56808
|
function step(result) {
|
|
56411
|
-
result.done ?
|
|
56809
|
+
result.done ? resolve10(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
56412
56810
|
}
|
|
56413
56811
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
56414
56812
|
});
|
|
@@ -56435,13 +56833,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
56435
56833
|
this.setState(constants_1.SocksClientState.Created);
|
|
56436
56834
|
}
|
|
56437
56835
|
static createConnection(options, callback) {
|
|
56438
|
-
return new Promise((
|
|
56836
|
+
return new Promise((resolve10, reject) => {
|
|
56439
56837
|
try {
|
|
56440
56838
|
(0, helpers_1.validateSocksClientOptions)(options, ["connect"]);
|
|
56441
56839
|
} catch (err) {
|
|
56442
56840
|
if (typeof callback === "function") {
|
|
56443
56841
|
callback(err);
|
|
56444
|
-
return
|
|
56842
|
+
return resolve10(err);
|
|
56445
56843
|
} else {
|
|
56446
56844
|
return reject(err);
|
|
56447
56845
|
}
|
|
@@ -56452,16 +56850,16 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
56452
56850
|
client.removeAllListeners();
|
|
56453
56851
|
if (typeof callback === "function") {
|
|
56454
56852
|
callback(null, info);
|
|
56455
|
-
|
|
56853
|
+
resolve10(info);
|
|
56456
56854
|
} else {
|
|
56457
|
-
|
|
56855
|
+
resolve10(info);
|
|
56458
56856
|
}
|
|
56459
56857
|
});
|
|
56460
56858
|
client.once("error", (err) => {
|
|
56461
56859
|
client.removeAllListeners();
|
|
56462
56860
|
if (typeof callback === "function") {
|
|
56463
56861
|
callback(err);
|
|
56464
|
-
|
|
56862
|
+
resolve10(err);
|
|
56465
56863
|
} else {
|
|
56466
56864
|
reject(err);
|
|
56467
56865
|
}
|
|
@@ -56469,13 +56867,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
56469
56867
|
});
|
|
56470
56868
|
}
|
|
56471
56869
|
static createConnectionChain(options, callback) {
|
|
56472
|
-
return new Promise((
|
|
56870
|
+
return new Promise((resolve10, reject) => __awaiter2(this, undefined, undefined, function* () {
|
|
56473
56871
|
try {
|
|
56474
56872
|
(0, helpers_1.validateSocksClientChainOptions)(options);
|
|
56475
56873
|
} catch (err) {
|
|
56476
56874
|
if (typeof callback === "function") {
|
|
56477
56875
|
callback(err);
|
|
56478
|
-
return
|
|
56876
|
+
return resolve10(err);
|
|
56479
56877
|
} else {
|
|
56480
56878
|
return reject(err);
|
|
56481
56879
|
}
|
|
@@ -56501,14 +56899,14 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
56501
56899
|
}
|
|
56502
56900
|
if (typeof callback === "function") {
|
|
56503
56901
|
callback(null, { socket: sock });
|
|
56504
|
-
|
|
56902
|
+
resolve10({ socket: sock });
|
|
56505
56903
|
} else {
|
|
56506
|
-
|
|
56904
|
+
resolve10({ socket: sock });
|
|
56507
56905
|
}
|
|
56508
56906
|
} catch (err) {
|
|
56509
56907
|
if (typeof callback === "function") {
|
|
56510
56908
|
callback(err);
|
|
56511
|
-
|
|
56909
|
+
resolve10(err);
|
|
56512
56910
|
} else {
|
|
56513
56911
|
reject(err);
|
|
56514
56912
|
}
|
|
@@ -57108,12 +57506,12 @@ var require_dist4 = __commonJS((exports) => {
|
|
|
57108
57506
|
let { host } = opts;
|
|
57109
57507
|
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
57110
57508
|
if (shouldLookup) {
|
|
57111
|
-
host = await new Promise((
|
|
57509
|
+
host = await new Promise((resolve10, reject) => {
|
|
57112
57510
|
lookupFn(host, {}, (err, res) => {
|
|
57113
57511
|
if (err) {
|
|
57114
57512
|
reject(err);
|
|
57115
57513
|
} else {
|
|
57116
|
-
|
|
57514
|
+
resolve10(res);
|
|
57117
57515
|
}
|
|
57118
57516
|
});
|
|
57119
57517
|
});
|
|
@@ -58120,7 +58518,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
58120
58518
|
return `${socket.remoteAddress}:${socket.remotePort}`;
|
|
58121
58519
|
}
|
|
58122
58520
|
function upgradeSocket(socket, options) {
|
|
58123
|
-
return new Promise((
|
|
58521
|
+
return new Promise((resolve10, reject) => {
|
|
58124
58522
|
const tlsOptions = Object.assign({}, options, {
|
|
58125
58523
|
socket
|
|
58126
58524
|
});
|
|
@@ -58130,7 +58528,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
58130
58528
|
reject(tlsSocket.authorizationError);
|
|
58131
58529
|
} else {
|
|
58132
58530
|
tlsSocket.removeAllListeners("error");
|
|
58133
|
-
|
|
58531
|
+
resolve10(tlsSocket);
|
|
58134
58532
|
}
|
|
58135
58533
|
}).once("error", (error) => {
|
|
58136
58534
|
reject(error);
|
|
@@ -58222,7 +58620,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
58222
58620
|
};
|
|
58223
58621
|
}
|
|
58224
58622
|
function connectForPassiveTransfer(host, port, ftp) {
|
|
58225
|
-
return new Promise((
|
|
58623
|
+
return new Promise((resolve10, reject) => {
|
|
58226
58624
|
let socket = ftp._newSocket();
|
|
58227
58625
|
const handleConnErr = function(err) {
|
|
58228
58626
|
err.message = "Can't open data connection in passive mode: " + err.message;
|
|
@@ -58245,7 +58643,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
58245
58643
|
socket.removeListener("error", handleConnErr);
|
|
58246
58644
|
socket.removeListener("timeout", handleTimeout);
|
|
58247
58645
|
ftp.dataSocket = socket;
|
|
58248
|
-
|
|
58646
|
+
resolve10();
|
|
58249
58647
|
});
|
|
58250
58648
|
});
|
|
58251
58649
|
}
|
|
@@ -60323,7 +60721,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
60323
60721
|
return path;
|
|
60324
60722
|
}
|
|
60325
60723
|
exports.normalize = normalize2;
|
|
60326
|
-
function
|
|
60724
|
+
function join34(aRoot, aPath) {
|
|
60327
60725
|
if (aRoot === "") {
|
|
60328
60726
|
aRoot = ".";
|
|
60329
60727
|
}
|
|
@@ -60355,7 +60753,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
60355
60753
|
}
|
|
60356
60754
|
return joined;
|
|
60357
60755
|
}
|
|
60358
|
-
exports.join =
|
|
60756
|
+
exports.join = join34;
|
|
60359
60757
|
exports.isAbsolute = function(aPath) {
|
|
60360
60758
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
60361
60759
|
};
|
|
@@ -60528,7 +60926,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
60528
60926
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
60529
60927
|
}
|
|
60530
60928
|
}
|
|
60531
|
-
sourceURL =
|
|
60929
|
+
sourceURL = join34(urlGenerate(parsed), sourceURL);
|
|
60532
60930
|
}
|
|
60533
60931
|
return normalize2(sourceURL);
|
|
60534
60932
|
}
|
|
@@ -62260,7 +62658,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
62260
62658
|
function noEmptySpace() {
|
|
62261
62659
|
return space ? space : " ";
|
|
62262
62660
|
}
|
|
62263
|
-
function
|
|
62661
|
+
function join34(left, right) {
|
|
62264
62662
|
var leftSource, rightSource, leftCharCode, rightCharCode;
|
|
62265
62663
|
leftSource = toSourceNodeWhenNeeded(left).toString();
|
|
62266
62664
|
if (leftSource.length === 0) {
|
|
@@ -62601,8 +62999,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
62601
62999
|
} else {
|
|
62602
63000
|
result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT));
|
|
62603
63001
|
}
|
|
62604
|
-
result =
|
|
62605
|
-
result = [
|
|
63002
|
+
result = join34(result, operator);
|
|
63003
|
+
result = [join34(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
|
|
62606
63004
|
});
|
|
62607
63005
|
result.push(this.maybeBlock(stmt.body, flags));
|
|
62608
63006
|
return result;
|
|
@@ -62740,11 +63138,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
62740
63138
|
var result, fragment;
|
|
62741
63139
|
result = ["class"];
|
|
62742
63140
|
if (stmt.id) {
|
|
62743
|
-
result =
|
|
63141
|
+
result = join34(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
|
|
62744
63142
|
}
|
|
62745
63143
|
if (stmt.superClass) {
|
|
62746
|
-
fragment =
|
|
62747
|
-
result =
|
|
63144
|
+
fragment = join34("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
|
|
63145
|
+
result = join34(result, fragment);
|
|
62748
63146
|
}
|
|
62749
63147
|
result.push(space);
|
|
62750
63148
|
result.push(this.generateStatement(stmt.body, S_TFFT));
|
|
@@ -62757,9 +63155,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
62757
63155
|
return escapeDirective(stmt.directive) + this.semicolon(flags);
|
|
62758
63156
|
},
|
|
62759
63157
|
DoWhileStatement: function(stmt, flags) {
|
|
62760
|
-
var result =
|
|
63158
|
+
var result = join34("do", this.maybeBlock(stmt.body, S_TFFF));
|
|
62761
63159
|
result = this.maybeBlockSuffix(stmt.body, result);
|
|
62762
|
-
return
|
|
63160
|
+
return join34(result, [
|
|
62763
63161
|
"while" + space + "(",
|
|
62764
63162
|
this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
62765
63163
|
")" + this.semicolon(flags)
|
|
@@ -62795,11 +63193,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
62795
63193
|
ExportDefaultDeclaration: function(stmt, flags) {
|
|
62796
63194
|
var result = ["export"], bodyFlags;
|
|
62797
63195
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
62798
|
-
result =
|
|
63196
|
+
result = join34(result, "default");
|
|
62799
63197
|
if (isStatement(stmt.declaration)) {
|
|
62800
|
-
result =
|
|
63198
|
+
result = join34(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
62801
63199
|
} else {
|
|
62802
|
-
result =
|
|
63200
|
+
result = join34(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
|
|
62803
63201
|
}
|
|
62804
63202
|
return result;
|
|
62805
63203
|
},
|
|
@@ -62807,15 +63205,15 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
62807
63205
|
var result = ["export"], bodyFlags, that = this;
|
|
62808
63206
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
62809
63207
|
if (stmt.declaration) {
|
|
62810
|
-
return
|
|
63208
|
+
return join34(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
62811
63209
|
}
|
|
62812
63210
|
if (stmt.specifiers) {
|
|
62813
63211
|
if (stmt.specifiers.length === 0) {
|
|
62814
|
-
result =
|
|
63212
|
+
result = join34(result, "{" + space + "}");
|
|
62815
63213
|
} else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) {
|
|
62816
|
-
result =
|
|
63214
|
+
result = join34(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
|
|
62817
63215
|
} else {
|
|
62818
|
-
result =
|
|
63216
|
+
result = join34(result, "{");
|
|
62819
63217
|
withIndent(function(indent2) {
|
|
62820
63218
|
var i, iz;
|
|
62821
63219
|
result.push(newline);
|
|
@@ -62833,7 +63231,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
62833
63231
|
result.push(base + "}");
|
|
62834
63232
|
}
|
|
62835
63233
|
if (stmt.source) {
|
|
62836
|
-
result =
|
|
63234
|
+
result = join34(result, [
|
|
62837
63235
|
"from" + space,
|
|
62838
63236
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
62839
63237
|
this.semicolon(flags)
|
|
@@ -62917,7 +63315,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
62917
63315
|
];
|
|
62918
63316
|
cursor = 0;
|
|
62919
63317
|
if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) {
|
|
62920
|
-
result =
|
|
63318
|
+
result = join34(result, [
|
|
62921
63319
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
62922
63320
|
]);
|
|
62923
63321
|
++cursor;
|
|
@@ -62927,7 +63325,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
62927
63325
|
result.push(",");
|
|
62928
63326
|
}
|
|
62929
63327
|
if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) {
|
|
62930
|
-
result =
|
|
63328
|
+
result = join34(result, [
|
|
62931
63329
|
space,
|
|
62932
63330
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
62933
63331
|
]);
|
|
@@ -62956,7 +63354,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
62956
63354
|
}
|
|
62957
63355
|
}
|
|
62958
63356
|
}
|
|
62959
|
-
result =
|
|
63357
|
+
result = join34(result, [
|
|
62960
63358
|
"from" + space,
|
|
62961
63359
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
62962
63360
|
this.semicolon(flags)
|
|
@@ -63010,7 +63408,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63010
63408
|
return result;
|
|
63011
63409
|
},
|
|
63012
63410
|
ThrowStatement: function(stmt, flags) {
|
|
63013
|
-
return [
|
|
63411
|
+
return [join34("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
63014
63412
|
},
|
|
63015
63413
|
TryStatement: function(stmt, flags) {
|
|
63016
63414
|
var result, i, iz, guardedHandlers;
|
|
@@ -63018,7 +63416,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63018
63416
|
result = this.maybeBlockSuffix(stmt.block, result);
|
|
63019
63417
|
if (stmt.handlers) {
|
|
63020
63418
|
for (i = 0, iz = stmt.handlers.length;i < iz; ++i) {
|
|
63021
|
-
result =
|
|
63419
|
+
result = join34(result, this.generateStatement(stmt.handlers[i], S_TFFF));
|
|
63022
63420
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
63023
63421
|
result = this.maybeBlockSuffix(stmt.handlers[i].body, result);
|
|
63024
63422
|
}
|
|
@@ -63026,7 +63424,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63026
63424
|
} else {
|
|
63027
63425
|
guardedHandlers = stmt.guardedHandlers || [];
|
|
63028
63426
|
for (i = 0, iz = guardedHandlers.length;i < iz; ++i) {
|
|
63029
|
-
result =
|
|
63427
|
+
result = join34(result, this.generateStatement(guardedHandlers[i], S_TFFF));
|
|
63030
63428
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
63031
63429
|
result = this.maybeBlockSuffix(guardedHandlers[i].body, result);
|
|
63032
63430
|
}
|
|
@@ -63034,13 +63432,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63034
63432
|
if (stmt.handler) {
|
|
63035
63433
|
if (Array.isArray(stmt.handler)) {
|
|
63036
63434
|
for (i = 0, iz = stmt.handler.length;i < iz; ++i) {
|
|
63037
|
-
result =
|
|
63435
|
+
result = join34(result, this.generateStatement(stmt.handler[i], S_TFFF));
|
|
63038
63436
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
63039
63437
|
result = this.maybeBlockSuffix(stmt.handler[i].body, result);
|
|
63040
63438
|
}
|
|
63041
63439
|
}
|
|
63042
63440
|
} else {
|
|
63043
|
-
result =
|
|
63441
|
+
result = join34(result, this.generateStatement(stmt.handler, S_TFFF));
|
|
63044
63442
|
if (stmt.finalizer) {
|
|
63045
63443
|
result = this.maybeBlockSuffix(stmt.handler.body, result);
|
|
63046
63444
|
}
|
|
@@ -63048,7 +63446,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63048
63446
|
}
|
|
63049
63447
|
}
|
|
63050
63448
|
if (stmt.finalizer) {
|
|
63051
|
-
result =
|
|
63449
|
+
result = join34(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
|
|
63052
63450
|
}
|
|
63053
63451
|
return result;
|
|
63054
63452
|
},
|
|
@@ -63082,7 +63480,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63082
63480
|
withIndent(function() {
|
|
63083
63481
|
if (stmt.test) {
|
|
63084
63482
|
result = [
|
|
63085
|
-
|
|
63483
|
+
join34("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
|
|
63086
63484
|
":"
|
|
63087
63485
|
];
|
|
63088
63486
|
} else {
|
|
@@ -63130,9 +63528,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63130
63528
|
result.push(this.maybeBlock(stmt.consequent, S_TFFF));
|
|
63131
63529
|
result = this.maybeBlockSuffix(stmt.consequent, result);
|
|
63132
63530
|
if (stmt.alternate.type === Syntax.IfStatement) {
|
|
63133
|
-
result =
|
|
63531
|
+
result = join34(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
|
|
63134
63532
|
} else {
|
|
63135
|
-
result =
|
|
63533
|
+
result = join34(result, join34("else", this.maybeBlock(stmt.alternate, bodyFlags)));
|
|
63136
63534
|
}
|
|
63137
63535
|
} else {
|
|
63138
63536
|
result.push(this.maybeBlock(stmt.consequent, bodyFlags));
|
|
@@ -63234,7 +63632,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63234
63632
|
},
|
|
63235
63633
|
ReturnStatement: function(stmt, flags) {
|
|
63236
63634
|
if (stmt.argument) {
|
|
63237
|
-
return [
|
|
63635
|
+
return [join34("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
63238
63636
|
}
|
|
63239
63637
|
return ["return" + this.semicolon(flags)];
|
|
63240
63638
|
},
|
|
@@ -63316,14 +63714,14 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63316
63714
|
if (leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) {
|
|
63317
63715
|
result = [fragment, noEmptySpace(), expr.operator];
|
|
63318
63716
|
} else {
|
|
63319
|
-
result =
|
|
63717
|
+
result = join34(fragment, expr.operator);
|
|
63320
63718
|
}
|
|
63321
63719
|
fragment = this.generateExpression(expr.right, rightPrecedence, flags);
|
|
63322
63720
|
if (expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--") {
|
|
63323
63721
|
result.push(noEmptySpace());
|
|
63324
63722
|
result.push(fragment);
|
|
63325
63723
|
} else {
|
|
63326
|
-
result =
|
|
63724
|
+
result = join34(result, fragment);
|
|
63327
63725
|
}
|
|
63328
63726
|
if (expr.operator === "in" && !(flags & F_ALLOW_IN)) {
|
|
63329
63727
|
return ["(", result, ")"];
|
|
@@ -63363,7 +63761,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63363
63761
|
var result, length, i, iz, itemFlags;
|
|
63364
63762
|
length = expr["arguments"].length;
|
|
63365
63763
|
itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF;
|
|
63366
|
-
result =
|
|
63764
|
+
result = join34("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
|
|
63367
63765
|
if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
|
|
63368
63766
|
result.push("(");
|
|
63369
63767
|
for (i = 0, iz = length;i < iz; ++i) {
|
|
@@ -63410,11 +63808,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63410
63808
|
var result, fragment, rightCharCode, leftSource, leftCharCode;
|
|
63411
63809
|
fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT);
|
|
63412
63810
|
if (space === "") {
|
|
63413
|
-
result =
|
|
63811
|
+
result = join34(expr.operator, fragment);
|
|
63414
63812
|
} else {
|
|
63415
63813
|
result = [expr.operator];
|
|
63416
63814
|
if (expr.operator.length > 2) {
|
|
63417
|
-
result =
|
|
63815
|
+
result = join34(result, fragment);
|
|
63418
63816
|
} else {
|
|
63419
63817
|
leftSource = toSourceNodeWhenNeeded(result).toString();
|
|
63420
63818
|
leftCharCode = leftSource.charCodeAt(leftSource.length - 1);
|
|
@@ -63437,12 +63835,12 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63437
63835
|
result = "yield";
|
|
63438
63836
|
}
|
|
63439
63837
|
if (expr.argument) {
|
|
63440
|
-
result =
|
|
63838
|
+
result = join34(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
|
|
63441
63839
|
}
|
|
63442
63840
|
return parenthesize(result, Precedence.Yield, precedence);
|
|
63443
63841
|
},
|
|
63444
63842
|
AwaitExpression: function(expr, precedence, flags) {
|
|
63445
|
-
var result =
|
|
63843
|
+
var result = join34(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
|
|
63446
63844
|
return parenthesize(result, Precedence.Await, precedence);
|
|
63447
63845
|
},
|
|
63448
63846
|
UpdateExpression: function(expr, precedence, flags) {
|
|
@@ -63514,11 +63912,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63514
63912
|
var result, fragment;
|
|
63515
63913
|
result = ["class"];
|
|
63516
63914
|
if (expr.id) {
|
|
63517
|
-
result =
|
|
63915
|
+
result = join34(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
|
|
63518
63916
|
}
|
|
63519
63917
|
if (expr.superClass) {
|
|
63520
|
-
fragment =
|
|
63521
|
-
result =
|
|
63918
|
+
fragment = join34("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
|
|
63919
|
+
result = join34(result, fragment);
|
|
63522
63920
|
}
|
|
63523
63921
|
result.push(space);
|
|
63524
63922
|
result.push(this.generateStatement(expr.body, S_TFFT));
|
|
@@ -63533,7 +63931,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63533
63931
|
}
|
|
63534
63932
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
63535
63933
|
fragment = [
|
|
63536
|
-
|
|
63934
|
+
join34(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
|
|
63537
63935
|
this.generateFunctionBody(expr.value)
|
|
63538
63936
|
];
|
|
63539
63937
|
} else {
|
|
@@ -63543,7 +63941,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63543
63941
|
this.generateFunctionBody(expr.value)
|
|
63544
63942
|
];
|
|
63545
63943
|
}
|
|
63546
|
-
return
|
|
63944
|
+
return join34(result, fragment);
|
|
63547
63945
|
},
|
|
63548
63946
|
Property: function(expr, precedence, flags) {
|
|
63549
63947
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
@@ -63737,7 +64135,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63737
64135
|
for (i = 0, iz = expr.blocks.length;i < iz; ++i) {
|
|
63738
64136
|
fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT);
|
|
63739
64137
|
if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
63740
|
-
result =
|
|
64138
|
+
result = join34(result, fragment);
|
|
63741
64139
|
} else {
|
|
63742
64140
|
result.push(fragment);
|
|
63743
64141
|
}
|
|
@@ -63745,13 +64143,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63745
64143
|
});
|
|
63746
64144
|
}
|
|
63747
64145
|
if (expr.filter) {
|
|
63748
|
-
result =
|
|
64146
|
+
result = join34(result, "if" + space);
|
|
63749
64147
|
fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT);
|
|
63750
|
-
result =
|
|
64148
|
+
result = join34(result, ["(", fragment, ")"]);
|
|
63751
64149
|
}
|
|
63752
64150
|
if (!extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
63753
64151
|
fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
|
|
63754
|
-
result =
|
|
64152
|
+
result = join34(result, fragment);
|
|
63755
64153
|
}
|
|
63756
64154
|
result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]");
|
|
63757
64155
|
return result;
|
|
@@ -63767,8 +64165,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
63767
64165
|
} else {
|
|
63768
64166
|
fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT);
|
|
63769
64167
|
}
|
|
63770
|
-
fragment =
|
|
63771
|
-
fragment =
|
|
64168
|
+
fragment = join34(fragment, expr.of ? "of" : "in");
|
|
64169
|
+
fragment = join34(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
|
|
63772
64170
|
return ["for" + space + "(", fragment, ")"];
|
|
63773
64171
|
},
|
|
63774
64172
|
SpreadElement: function(expr, precedence, flags) {
|
|
@@ -70256,11 +70654,11 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
70256
70654
|
};
|
|
70257
70655
|
__awaiter2 = function(thisArg, _arguments, P, generator) {
|
|
70258
70656
|
function adopt(value) {
|
|
70259
|
-
return value instanceof P ? value : new P(function(
|
|
70260
|
-
|
|
70657
|
+
return value instanceof P ? value : new P(function(resolve10) {
|
|
70658
|
+
resolve10(value);
|
|
70261
70659
|
});
|
|
70262
70660
|
}
|
|
70263
|
-
return new (P || (P = Promise))(function(
|
|
70661
|
+
return new (P || (P = Promise))(function(resolve10, reject) {
|
|
70264
70662
|
function fulfilled(value) {
|
|
70265
70663
|
try {
|
|
70266
70664
|
step(generator.next(value));
|
|
@@ -70276,7 +70674,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
70276
70674
|
}
|
|
70277
70675
|
}
|
|
70278
70676
|
function step(result) {
|
|
70279
|
-
result.done ?
|
|
70677
|
+
result.done ? resolve10(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
70280
70678
|
}
|
|
70281
70679
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
70282
70680
|
});
|
|
@@ -70505,14 +70903,14 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
70505
70903
|
}, i);
|
|
70506
70904
|
function verb(n) {
|
|
70507
70905
|
i[n] = o[n] && function(v) {
|
|
70508
|
-
return new Promise(function(
|
|
70509
|
-
v = o[n](v), settle(
|
|
70906
|
+
return new Promise(function(resolve10, reject) {
|
|
70907
|
+
v = o[n](v), settle(resolve10, reject, v.done, v.value);
|
|
70510
70908
|
});
|
|
70511
70909
|
};
|
|
70512
70910
|
}
|
|
70513
|
-
function settle(
|
|
70911
|
+
function settle(resolve10, reject, d, v) {
|
|
70514
70912
|
Promise.resolve(v).then(function(v2) {
|
|
70515
|
-
|
|
70913
|
+
resolve10({ value: v2, done: d });
|
|
70516
70914
|
}, reject);
|
|
70517
70915
|
}
|
|
70518
70916
|
};
|
|
@@ -73751,12 +74149,12 @@ var require_util3 = __commonJS((exports) => {
|
|
|
73751
74149
|
exports.isGMT = exports.dnsLookup = undefined;
|
|
73752
74150
|
var dns_1 = __require("dns");
|
|
73753
74151
|
function dnsLookup(host, opts) {
|
|
73754
|
-
return new Promise((
|
|
74152
|
+
return new Promise((resolve10, reject) => {
|
|
73755
74153
|
(0, dns_1.lookup)(host, opts, (err, res) => {
|
|
73756
74154
|
if (err) {
|
|
73757
74155
|
reject(err);
|
|
73758
74156
|
} else {
|
|
73759
|
-
|
|
74157
|
+
resolve10(res);
|
|
73760
74158
|
}
|
|
73761
74159
|
});
|
|
73762
74160
|
});
|
|
@@ -74330,10 +74728,10 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
74330
74728
|
var ip_1 = require_ip();
|
|
74331
74729
|
var net_1 = __importDefault(__require("net"));
|
|
74332
74730
|
async function myIpAddress() {
|
|
74333
|
-
return new Promise((
|
|
74731
|
+
return new Promise((resolve10, reject) => {
|
|
74334
74732
|
const socket = net_1.default.connect({ host: "8.8.8.8", port: 53 });
|
|
74335
74733
|
const onError = () => {
|
|
74336
|
-
|
|
74734
|
+
resolve10(ip_1.ip.address());
|
|
74337
74735
|
};
|
|
74338
74736
|
socket.once("error", onError);
|
|
74339
74737
|
socket.once("connect", () => {
|
|
@@ -74341,9 +74739,9 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
74341
74739
|
const addr = socket.address();
|
|
74342
74740
|
socket.destroy();
|
|
74343
74741
|
if (typeof addr === "string") {
|
|
74344
|
-
|
|
74742
|
+
resolve10(addr);
|
|
74345
74743
|
} else if (addr.address) {
|
|
74346
|
-
|
|
74744
|
+
resolve10(addr.address);
|
|
74347
74745
|
} else {
|
|
74348
74746
|
reject(new Error("Expected a `string`"));
|
|
74349
74747
|
}
|
|
@@ -74857,8 +75255,8 @@ var require_deferred_promise = __commonJS((exports) => {
|
|
|
74857
75255
|
this.context = args.context;
|
|
74858
75256
|
this.owner = args.context.runtime;
|
|
74859
75257
|
this.handle = args.promiseHandle;
|
|
74860
|
-
this.settled = new Promise((
|
|
74861
|
-
this.onSettled =
|
|
75258
|
+
this.settled = new Promise((resolve10) => {
|
|
75259
|
+
this.onSettled = resolve10;
|
|
74862
75260
|
});
|
|
74863
75261
|
this.resolveHandle = args.resolveHandle;
|
|
74864
75262
|
this.rejectHandle = args.rejectHandle;
|
|
@@ -75250,13 +75648,13 @@ var require_context = __commonJS((exports) => {
|
|
|
75250
75648
|
if (vmResolveResult.error) {
|
|
75251
75649
|
return Promise.resolve(vmResolveResult);
|
|
75252
75650
|
}
|
|
75253
|
-
return new Promise((
|
|
75651
|
+
return new Promise((resolve10) => {
|
|
75254
75652
|
lifetime_1.Scope.withScope((scope) => {
|
|
75255
75653
|
const resolveHandle = scope.manage(this.newFunction("resolve", (value) => {
|
|
75256
|
-
|
|
75654
|
+
resolve10({ value: value && value.dup() });
|
|
75257
75655
|
}));
|
|
75258
75656
|
const rejectHandle = scope.manage(this.newFunction("reject", (error) => {
|
|
75259
|
-
|
|
75657
|
+
resolve10({ error: error && error.dup() });
|
|
75260
75658
|
}));
|
|
75261
75659
|
const promiseHandle = scope.manage(vmResolveResult.value);
|
|
75262
75660
|
const promiseThenHandle = scope.manage(this.getProp(promiseHandle, "then"));
|
|
@@ -77370,13 +77768,13 @@ import * as http from "node:http";
|
|
|
77370
77768
|
import * as https from "node:https";
|
|
77371
77769
|
import { URL as URL2, urlToHttpOptions } from "node:url";
|
|
77372
77770
|
function headHttpRequest(url) {
|
|
77373
|
-
return new Promise((
|
|
77771
|
+
return new Promise((resolve10) => {
|
|
77374
77772
|
const request3 = httpRequest(url, "HEAD", (response) => {
|
|
77375
77773
|
response.resume();
|
|
77376
|
-
|
|
77774
|
+
resolve10(response.statusCode === 200);
|
|
77377
77775
|
}, false);
|
|
77378
77776
|
request3.on("error", () => {
|
|
77379
|
-
|
|
77777
|
+
resolve10(false);
|
|
77380
77778
|
});
|
|
77381
77779
|
});
|
|
77382
77780
|
}
|
|
@@ -77404,7 +77802,7 @@ function httpRequest(url, method, response, keepAlive = true) {
|
|
|
77404
77802
|
return request3;
|
|
77405
77803
|
}
|
|
77406
77804
|
function downloadFile(url, destinationPath, progressCallback) {
|
|
77407
|
-
return new Promise((
|
|
77805
|
+
return new Promise((resolve10, reject) => {
|
|
77408
77806
|
let downloadedBytes = 0;
|
|
77409
77807
|
let totalBytes = 0;
|
|
77410
77808
|
function onData(chunk) {
|
|
@@ -77420,7 +77818,7 @@ function downloadFile(url, destinationPath, progressCallback) {
|
|
|
77420
77818
|
}
|
|
77421
77819
|
const file = createWriteStream(destinationPath);
|
|
77422
77820
|
file.on("close", () => {
|
|
77423
|
-
return
|
|
77821
|
+
return resolve10();
|
|
77424
77822
|
});
|
|
77425
77823
|
file.on("error", (error) => {
|
|
77426
77824
|
return reject(error);
|
|
@@ -77445,7 +77843,7 @@ async function getJSON(url) {
|
|
|
77445
77843
|
}
|
|
77446
77844
|
}
|
|
77447
77845
|
function getText(url) {
|
|
77448
|
-
return new Promise((
|
|
77846
|
+
return new Promise((resolve10, reject) => {
|
|
77449
77847
|
const request3 = httpRequest(url, "GET", (response) => {
|
|
77450
77848
|
let data = "";
|
|
77451
77849
|
if (response.statusCode && response.statusCode >= 400) {
|
|
@@ -77456,7 +77854,7 @@ function getText(url) {
|
|
|
77456
77854
|
});
|
|
77457
77855
|
response.on("end", () => {
|
|
77458
77856
|
try {
|
|
77459
|
-
return
|
|
77857
|
+
return resolve10(String(data));
|
|
77460
77858
|
} catch {
|
|
77461
77859
|
return reject(new Error(`Failed to read text response from ${url}`));
|
|
77462
77860
|
}
|
|
@@ -77473,7 +77871,7 @@ var init_httpUtil = __esm(() => {
|
|
|
77473
77871
|
});
|
|
77474
77872
|
|
|
77475
77873
|
// node_modules/@puppeteer/browsers/lib/esm/browser-data/chrome.js
|
|
77476
|
-
import { execSync as
|
|
77874
|
+
import { execSync as execSync9 } from "node:child_process";
|
|
77477
77875
|
import os from "node:os";
|
|
77478
77876
|
import path from "node:path";
|
|
77479
77877
|
function folder(platform2) {
|
|
@@ -77563,7 +77961,7 @@ function getChromeWindowsLocation(channel2, locationsPrefixes) {
|
|
|
77563
77961
|
}
|
|
77564
77962
|
function getWslVariable(variable) {
|
|
77565
77963
|
try {
|
|
77566
|
-
const result =
|
|
77964
|
+
const result = execSync9(`cmd.exe /c echo %${variable.toLocaleUpperCase()}%`, {
|
|
77567
77965
|
stdio: ["ignore", "pipe", "ignore"],
|
|
77568
77966
|
encoding: "utf-8"
|
|
77569
77967
|
}).trim();
|
|
@@ -77574,7 +77972,7 @@ function getWslVariable(variable) {
|
|
|
77574
77972
|
return;
|
|
77575
77973
|
}
|
|
77576
77974
|
function getWslLocation(channel2) {
|
|
77577
|
-
const wslVersion =
|
|
77975
|
+
const wslVersion = execSync9("wslinfo --version", {
|
|
77578
77976
|
stdio: ["ignore", "pipe", "ignore"],
|
|
77579
77977
|
encoding: "utf-8"
|
|
77580
77978
|
}).trim();
|
|
@@ -77590,7 +77988,7 @@ function getWslLocation(channel2) {
|
|
|
77590
77988
|
}
|
|
77591
77989
|
const windowsPath = getChromeWindowsLocation(channel2, wslPrefixes);
|
|
77592
77990
|
return windowsPath.map((path2) => {
|
|
77593
|
-
return
|
|
77991
|
+
return execSync9(`wslpath "${path2}"`).toString().trim();
|
|
77594
77992
|
});
|
|
77595
77993
|
}
|
|
77596
77994
|
function getChromeLinuxOrWslLocation(channel2) {
|
|
@@ -78677,7 +79075,7 @@ class Process {
|
|
|
78677
79075
|
if (opts.onExit) {
|
|
78678
79076
|
this.#onExitHook = opts.onExit;
|
|
78679
79077
|
}
|
|
78680
|
-
this.#browserProcessExiting = new Promise((
|
|
79078
|
+
this.#browserProcessExiting = new Promise((resolve10, reject) => {
|
|
78681
79079
|
this.#browserProcess.once("exit", async () => {
|
|
78682
79080
|
debugLaunch(`Browser process ${this.#browserProcess.pid} onExit`);
|
|
78683
79081
|
this.#clearListeners();
|
|
@@ -78688,7 +79086,7 @@ class Process {
|
|
|
78688
79086
|
reject(err);
|
|
78689
79087
|
return;
|
|
78690
79088
|
}
|
|
78691
|
-
|
|
79089
|
+
resolve10();
|
|
78692
79090
|
});
|
|
78693
79091
|
});
|
|
78694
79092
|
}
|
|
@@ -78798,7 +79196,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
78798
79196
|
return [...this.#logs];
|
|
78799
79197
|
}
|
|
78800
79198
|
waitForLineOutput(regex, timeout2 = 0) {
|
|
78801
|
-
return new Promise((
|
|
79199
|
+
return new Promise((resolve10, reject) => {
|
|
78802
79200
|
const onClose = (errorOrCode) => {
|
|
78803
79201
|
cleanup();
|
|
78804
79202
|
reject(new Error([
|
|
@@ -78836,7 +79234,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
78836
79234
|
return;
|
|
78837
79235
|
}
|
|
78838
79236
|
cleanup();
|
|
78839
|
-
|
|
79237
|
+
resolve10(match[1]);
|
|
78840
79238
|
}
|
|
78841
79239
|
});
|
|
78842
79240
|
}
|
|
@@ -79366,7 +79764,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
79366
79764
|
};
|
|
79367
79765
|
const { maxBuffer } = options;
|
|
79368
79766
|
let stream;
|
|
79369
|
-
await new Promise((
|
|
79767
|
+
await new Promise((resolve10, reject) => {
|
|
79370
79768
|
const rejectPromise = (error) => {
|
|
79371
79769
|
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
79372
79770
|
error.bufferedData = stream.getBufferedValue();
|
|
@@ -79378,7 +79776,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
79378
79776
|
rejectPromise(error);
|
|
79379
79777
|
return;
|
|
79380
79778
|
}
|
|
79381
|
-
|
|
79779
|
+
resolve10();
|
|
79382
79780
|
});
|
|
79383
79781
|
stream.on("data", () => {
|
|
79384
79782
|
if (stream.getBufferedLength() > maxBuffer) {
|
|
@@ -80739,7 +81137,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
80739
81137
|
debug4("opening", this.zipPath, "with opts", this.opts);
|
|
80740
81138
|
this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
|
|
80741
81139
|
this.canceled = false;
|
|
80742
|
-
return new Promise((
|
|
81140
|
+
return new Promise((resolve10, reject) => {
|
|
80743
81141
|
this.zipfile.on("error", (err) => {
|
|
80744
81142
|
this.canceled = true;
|
|
80745
81143
|
reject(err);
|
|
@@ -80748,7 +81146,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
80748
81146
|
this.zipfile.on("close", () => {
|
|
80749
81147
|
if (!this.canceled) {
|
|
80750
81148
|
debug4("zip extraction complete");
|
|
80751
|
-
|
|
81149
|
+
resolve10();
|
|
80752
81150
|
}
|
|
80753
81151
|
});
|
|
80754
81152
|
this.zipfile.on("entry", async (entry) => {
|
|
@@ -82090,8 +82488,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
82090
82488
|
return this;
|
|
82091
82489
|
},
|
|
82092
82490
|
next() {
|
|
82093
|
-
return new Promise(function(
|
|
82094
|
-
promiseResolve =
|
|
82491
|
+
return new Promise(function(resolve10, reject) {
|
|
82492
|
+
promiseResolve = resolve10;
|
|
82095
82493
|
promiseReject = reject;
|
|
82096
82494
|
const data = stream.read();
|
|
82097
82495
|
if (data !== null)
|
|
@@ -82128,14 +82526,14 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
82128
82526
|
}
|
|
82129
82527
|
function destroy(err) {
|
|
82130
82528
|
stream.destroy(err);
|
|
82131
|
-
return new Promise((
|
|
82529
|
+
return new Promise((resolve10, reject) => {
|
|
82132
82530
|
if (stream._duplexState & DESTROYED)
|
|
82133
|
-
return
|
|
82531
|
+
return resolve10({ value: undefined, done: true });
|
|
82134
82532
|
stream.once("close", function() {
|
|
82135
82533
|
if (err)
|
|
82136
82534
|
reject(err);
|
|
82137
82535
|
else
|
|
82138
|
-
|
|
82536
|
+
resolve10({ value: undefined, done: true });
|
|
82139
82537
|
});
|
|
82140
82538
|
});
|
|
82141
82539
|
}
|
|
@@ -82187,8 +82585,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
82187
82585
|
return Promise.resolve(true);
|
|
82188
82586
|
if (state.drains === null)
|
|
82189
82587
|
state.drains = [];
|
|
82190
|
-
return new Promise((
|
|
82191
|
-
state.drains.push({ writes, resolve:
|
|
82588
|
+
return new Promise((resolve10) => {
|
|
82589
|
+
state.drains.push({ writes, resolve: resolve10 });
|
|
82192
82590
|
});
|
|
82193
82591
|
}
|
|
82194
82592
|
write(data) {
|
|
@@ -82302,11 +82700,11 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
82302
82700
|
cb(null);
|
|
82303
82701
|
}
|
|
82304
82702
|
function pipelinePromise(...streams) {
|
|
82305
|
-
return new Promise((
|
|
82703
|
+
return new Promise((resolve10, reject) => {
|
|
82306
82704
|
return pipeline(...streams, (err) => {
|
|
82307
82705
|
if (err)
|
|
82308
82706
|
return reject(err);
|
|
82309
|
-
|
|
82707
|
+
resolve10();
|
|
82310
82708
|
});
|
|
82311
82709
|
});
|
|
82312
82710
|
}
|
|
@@ -83020,16 +83418,16 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
83020
83418
|
entryCallback = null;
|
|
83021
83419
|
cb(err);
|
|
83022
83420
|
}
|
|
83023
|
-
function onnext(
|
|
83421
|
+
function onnext(resolve10, reject) {
|
|
83024
83422
|
if (error) {
|
|
83025
83423
|
return reject(error);
|
|
83026
83424
|
}
|
|
83027
83425
|
if (entryStream) {
|
|
83028
|
-
|
|
83426
|
+
resolve10({ value: entryStream, done: false });
|
|
83029
83427
|
entryStream = null;
|
|
83030
83428
|
return;
|
|
83031
83429
|
}
|
|
83032
|
-
promiseResolve =
|
|
83430
|
+
promiseResolve = resolve10;
|
|
83033
83431
|
promiseReject = reject;
|
|
83034
83432
|
consumeCallback(null);
|
|
83035
83433
|
if (extract._finished && promiseResolve) {
|
|
@@ -83060,14 +83458,14 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
83060
83458
|
function destroy(err) {
|
|
83061
83459
|
extract.destroy(err);
|
|
83062
83460
|
consumeCallback(err);
|
|
83063
|
-
return new Promise((
|
|
83461
|
+
return new Promise((resolve10, reject) => {
|
|
83064
83462
|
if (extract.destroyed)
|
|
83065
|
-
return
|
|
83463
|
+
return resolve10({ value: undefined, done: true });
|
|
83066
83464
|
extract.once("close", function() {
|
|
83067
83465
|
if (err)
|
|
83068
83466
|
reject(err);
|
|
83069
83467
|
else
|
|
83070
|
-
|
|
83468
|
+
resolve10({ value: undefined, done: true });
|
|
83071
83469
|
});
|
|
83072
83470
|
});
|
|
83073
83471
|
}
|
|
@@ -83865,7 +84263,7 @@ var init_fileUtil = __esm(() => {
|
|
|
83865
84263
|
// node_modules/@puppeteer/browsers/lib/esm/install.js
|
|
83866
84264
|
import assert2 from "node:assert";
|
|
83867
84265
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
83868
|
-
import { existsSync as
|
|
84266
|
+
import { existsSync as existsSync38, readFileSync as readFileSync27 } from "node:fs";
|
|
83869
84267
|
import { mkdir as mkdir2, unlink } from "node:fs/promises";
|
|
83870
84268
|
import os5 from "node:os";
|
|
83871
84269
|
import path8 from "node:path";
|
|
@@ -83918,7 +84316,7 @@ async function installWithProviders(options) {
|
|
|
83918
84316
|
continue;
|
|
83919
84317
|
}
|
|
83920
84318
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
|
|
83921
|
-
if (!
|
|
84319
|
+
if (!existsSync38(browserRoot)) {
|
|
83922
84320
|
await mkdir2(browserRoot, { recursive: true });
|
|
83923
84321
|
}
|
|
83924
84322
|
return await installUrl(url, options, provider);
|
|
@@ -83951,7 +84349,7 @@ async function installDeps(installedBrowser) {
|
|
|
83951
84349
|
return;
|
|
83952
84350
|
}
|
|
83953
84351
|
const depsPath = path8.join(path8.dirname(installedBrowser.executablePath), "deb.deps");
|
|
83954
|
-
if (!
|
|
84352
|
+
if (!existsSync38(depsPath)) {
|
|
83955
84353
|
debugInstall(`deb.deps file was not found at ${depsPath}`);
|
|
83956
84354
|
return;
|
|
83957
84355
|
}
|
|
@@ -83993,11 +84391,11 @@ async function installUrl(url, options, provider) {
|
|
|
83993
84391
|
const cache = new Cache(options.cacheDir);
|
|
83994
84392
|
const browserRoot = cache.browserRoot(options.browser);
|
|
83995
84393
|
const archivePath = path8.join(browserRoot, `${options.buildId}-${fileName}`);
|
|
83996
|
-
if (!
|
|
84394
|
+
if (!existsSync38(browserRoot)) {
|
|
83997
84395
|
await mkdir2(browserRoot, { recursive: true });
|
|
83998
84396
|
}
|
|
83999
84397
|
if (!options.unpack) {
|
|
84000
|
-
if (
|
|
84398
|
+
if (existsSync38(archivePath)) {
|
|
84001
84399
|
return archivePath;
|
|
84002
84400
|
}
|
|
84003
84401
|
debugInstall(`Downloading binary from ${url}`);
|
|
@@ -84018,8 +84416,8 @@ async function installUrl(url, options, provider) {
|
|
|
84018
84416
|
cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath6);
|
|
84019
84417
|
}
|
|
84020
84418
|
try {
|
|
84021
|
-
if (
|
|
84022
|
-
if (!
|
|
84419
|
+
if (existsSync38(outputPath)) {
|
|
84420
|
+
if (!existsSync38(installedBrowser.executablePath)) {
|
|
84023
84421
|
throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
|
|
84024
84422
|
}
|
|
84025
84423
|
await runSetup(installedBrowser);
|
|
@@ -84028,7 +84426,7 @@ async function installUrl(url, options, provider) {
|
|
|
84028
84426
|
}
|
|
84029
84427
|
return installedBrowser;
|
|
84030
84428
|
}
|
|
84031
|
-
if (!
|
|
84429
|
+
if (!existsSync38(archivePath)) {
|
|
84032
84430
|
debugInstall(`Downloading binary from ${url}`);
|
|
84033
84431
|
try {
|
|
84034
84432
|
debugTime("download");
|
|
@@ -84057,7 +84455,7 @@ async function installUrl(url, options, provider) {
|
|
|
84057
84455
|
}
|
|
84058
84456
|
return installedBrowser;
|
|
84059
84457
|
} finally {
|
|
84060
|
-
if (
|
|
84458
|
+
if (existsSync38(archivePath)) {
|
|
84061
84459
|
await unlink(archivePath);
|
|
84062
84460
|
}
|
|
84063
84461
|
}
|
|
@@ -84068,7 +84466,7 @@ async function runSetup(installedBrowser) {
|
|
|
84068
84466
|
debugTime("permissions");
|
|
84069
84467
|
const browserDir = path8.dirname(installedBrowser.executablePath);
|
|
84070
84468
|
const setupExePath = path8.join(browserDir, "setup.exe");
|
|
84071
|
-
if (!
|
|
84469
|
+
if (!existsSync38(setupExePath)) {
|
|
84072
84470
|
return;
|
|
84073
84471
|
}
|
|
84074
84472
|
spawnSync4(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
|
|
@@ -84449,19 +84847,19 @@ var init_cliui = __esm(() => {
|
|
|
84449
84847
|
});
|
|
84450
84848
|
|
|
84451
84849
|
// node_modules/escalade/sync/index.mjs
|
|
84452
|
-
import { dirname as
|
|
84850
|
+
import { dirname as dirname16, resolve as resolve11 } from "path";
|
|
84453
84851
|
import { readdirSync as readdirSync11, statSync as statSync13 } from "fs";
|
|
84454
84852
|
function sync_default(start, callback) {
|
|
84455
|
-
let dir =
|
|
84853
|
+
let dir = resolve11(".", start);
|
|
84456
84854
|
let tmp, stats = statSync13(dir);
|
|
84457
84855
|
if (!stats.isDirectory()) {
|
|
84458
|
-
dir =
|
|
84856
|
+
dir = dirname16(dir);
|
|
84459
84857
|
}
|
|
84460
84858
|
while (true) {
|
|
84461
84859
|
tmp = callback(dir, readdirSync11(dir));
|
|
84462
84860
|
if (tmp)
|
|
84463
|
-
return
|
|
84464
|
-
dir =
|
|
84861
|
+
return resolve11(dir, tmp);
|
|
84862
|
+
dir = dirname16(tmp = dir);
|
|
84465
84863
|
if (tmp === dir)
|
|
84466
84864
|
break;
|
|
84467
84865
|
}
|
|
@@ -85407,7 +85805,7 @@ var init_yargs_parser = __esm(() => {
|
|
|
85407
85805
|
|
|
85408
85806
|
// node_modules/yargs-parser/build/lib/index.js
|
|
85409
85807
|
import { format } from "util";
|
|
85410
|
-
import { normalize as normalize2, resolve as
|
|
85808
|
+
import { normalize as normalize2, resolve as resolve12 } from "path";
|
|
85411
85809
|
var _a3, _b, _c, minNodeVersion, nodeVersion, env, parser, yargsParser = function Parser(args, opts) {
|
|
85412
85810
|
const result = parser.parse(args.slice(), opts);
|
|
85413
85811
|
return result.argv;
|
|
@@ -85430,7 +85828,7 @@ var init_lib2 = __esm(() => {
|
|
|
85430
85828
|
},
|
|
85431
85829
|
format,
|
|
85432
85830
|
normalize: normalize2,
|
|
85433
|
-
resolve:
|
|
85831
|
+
resolve: resolve12,
|
|
85434
85832
|
require: (path9) => {
|
|
85435
85833
|
if (true) {
|
|
85436
85834
|
return __require(path9);
|
|
@@ -85482,7 +85880,7 @@ var init_yerror = __esm(() => {
|
|
|
85482
85880
|
// node_modules/y18n/build/lib/platform-shims/node.js
|
|
85483
85881
|
import { readFileSync as readFileSync28, statSync as statSync14, writeFile } from "fs";
|
|
85484
85882
|
import { format as format2 } from "util";
|
|
85485
|
-
import { resolve as
|
|
85883
|
+
import { resolve as resolve13 } from "path";
|
|
85486
85884
|
var node_default;
|
|
85487
85885
|
var init_node = __esm(() => {
|
|
85488
85886
|
node_default = {
|
|
@@ -85491,7 +85889,7 @@ var init_node = __esm(() => {
|
|
|
85491
85889
|
writeFile
|
|
85492
85890
|
},
|
|
85493
85891
|
format: format2,
|
|
85494
|
-
resolve:
|
|
85892
|
+
resolve: resolve13,
|
|
85495
85893
|
exists: (file) => {
|
|
85496
85894
|
try {
|
|
85497
85895
|
return statSync14(file).isFile();
|
|
@@ -85674,7 +86072,7 @@ import { notStrictEqual, strictEqual } from "assert";
|
|
|
85674
86072
|
import { inspect } from "util";
|
|
85675
86073
|
import { readFileSync as readFileSync29 } from "fs";
|
|
85676
86074
|
import { fileURLToPath } from "url";
|
|
85677
|
-
import { basename as basename9, dirname as
|
|
86075
|
+
import { basename as basename9, dirname as dirname17, extname as extname3, relative as relative9, resolve as resolve14 } from "path";
|
|
85678
86076
|
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;
|
|
85679
86077
|
var init_esm = __esm(() => {
|
|
85680
86078
|
init_cliui();
|
|
@@ -85707,10 +86105,10 @@ var init_esm = __esm(() => {
|
|
|
85707
86105
|
Parser: lib_default,
|
|
85708
86106
|
path: {
|
|
85709
86107
|
basename: basename9,
|
|
85710
|
-
dirname:
|
|
86108
|
+
dirname: dirname17,
|
|
85711
86109
|
extname: extname3,
|
|
85712
86110
|
relative: relative9,
|
|
85713
|
-
resolve:
|
|
86111
|
+
resolve: resolve14
|
|
85714
86112
|
},
|
|
85715
86113
|
process: {
|
|
85716
86114
|
argv: () => process.argv,
|
|
@@ -85732,7 +86130,7 @@ var init_esm = __esm(() => {
|
|
|
85732
86130
|
return [...str].length;
|
|
85733
86131
|
},
|
|
85734
86132
|
y18n: y18n_default({
|
|
85735
|
-
directory:
|
|
86133
|
+
directory: resolve14(__dirname2, "../../../locales"),
|
|
85736
86134
|
updateFiles: false
|
|
85737
86135
|
})
|
|
85738
86136
|
};
|
|
@@ -87980,12 +88378,12 @@ var init_yargs_factory = __esm(() => {
|
|
|
87980
88378
|
async getCompletion(args, done) {
|
|
87981
88379
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
87982
88380
|
if (!done) {
|
|
87983
|
-
return new Promise((
|
|
88381
|
+
return new Promise((resolve15, reject) => {
|
|
87984
88382
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
87985
88383
|
if (err)
|
|
87986
88384
|
reject(err);
|
|
87987
88385
|
else
|
|
87988
|
-
|
|
88386
|
+
resolve15(completions);
|
|
87989
88387
|
});
|
|
87990
88388
|
});
|
|
87991
88389
|
} else {
|
|
@@ -89420,9 +89818,9 @@ async function getConnectionTransport(options) {
|
|
|
89420
89818
|
throw new Error("Could not detect required browser platform");
|
|
89421
89819
|
}
|
|
89422
89820
|
const { convertPuppeteerChannelToBrowsersChannel: convertPuppeteerChannelToBrowsersChannel2 } = await Promise.resolve().then(() => (init_LaunchOptions(), exports_LaunchOptions));
|
|
89423
|
-
const { join:
|
|
89821
|
+
const { join: join35 } = await import("node:path");
|
|
89424
89822
|
const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform2, convertPuppeteerChannelToBrowsersChannel2(options.channel));
|
|
89425
|
-
const portPath =
|
|
89823
|
+
const portPath = join35(userDataDir, "DevToolsActivePort");
|
|
89426
89824
|
try {
|
|
89427
89825
|
const fileContent = await environment.value.fs.promises.readFile(portPath, "ascii");
|
|
89428
89826
|
const [rawPort, rawPath] = fileContent.split(`
|
|
@@ -89646,9 +90044,9 @@ var init_PipeTransport = __esm(() => {
|
|
|
89646
90044
|
});
|
|
89647
90045
|
|
|
89648
90046
|
// node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js
|
|
89649
|
-
import { existsSync as
|
|
90047
|
+
import { existsSync as existsSync39 } from "node:fs";
|
|
89650
90048
|
import { tmpdir } from "node:os";
|
|
89651
|
-
import { join as
|
|
90049
|
+
import { join as join35 } from "node:path";
|
|
89652
90050
|
|
|
89653
90051
|
class BrowserLauncher {
|
|
89654
90052
|
#browser;
|
|
@@ -89673,7 +90071,7 @@ class BrowserLauncher {
|
|
|
89673
90071
|
...options,
|
|
89674
90072
|
protocol
|
|
89675
90073
|
});
|
|
89676
|
-
if (!
|
|
90074
|
+
if (!existsSync39(launchArgs.executablePath)) {
|
|
89677
90075
|
throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
|
|
89678
90076
|
}
|
|
89679
90077
|
const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
|
|
@@ -89748,7 +90146,7 @@ class BrowserLauncher {
|
|
|
89748
90146
|
browserCloseCallback();
|
|
89749
90147
|
const logs = browserProcess.getRecentLogs().join(`
|
|
89750
90148
|
`);
|
|
89751
|
-
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" &&
|
|
90149
|
+
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync39(join35(launchArgs.userDataDir, "lockfile"))) {
|
|
89752
90150
|
throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
|
|
89753
90151
|
}
|
|
89754
90152
|
if (logs.includes("Missing X server") && options.headless === false) {
|
|
@@ -89838,12 +90236,12 @@ class BrowserLauncher {
|
|
|
89838
90236
|
});
|
|
89839
90237
|
}
|
|
89840
90238
|
getProfilePath() {
|
|
89841
|
-
return
|
|
90239
|
+
return join35(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
|
|
89842
90240
|
}
|
|
89843
90241
|
resolveExecutablePath(headless, validatePath = true) {
|
|
89844
90242
|
let executablePath = this.puppeteer.configuration.executablePath;
|
|
89845
90243
|
if (executablePath) {
|
|
89846
|
-
if (validatePath && !
|
|
90244
|
+
if (validatePath && !existsSync39(executablePath)) {
|
|
89847
90245
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}), but no executable was found.`);
|
|
89848
90246
|
}
|
|
89849
90247
|
return executablePath;
|
|
@@ -89866,7 +90264,7 @@ class BrowserLauncher {
|
|
|
89866
90264
|
browser: browserType,
|
|
89867
90265
|
buildId: this.puppeteer.browserVersion
|
|
89868
90266
|
});
|
|
89869
|
-
if (validatePath && !
|
|
90267
|
+
if (validatePath && !existsSync39(executablePath)) {
|
|
89870
90268
|
const configVersion = this.puppeteer.configuration?.[this.browser]?.version;
|
|
89871
90269
|
if (configVersion) {
|
|
89872
90270
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`);
|
|
@@ -90404,7 +90802,7 @@ var init_PuppeteerNode = __esm(() => {
|
|
|
90404
90802
|
import { spawn as spawn2, spawnSync as spawnSync5 } from "node:child_process";
|
|
90405
90803
|
import fs5 from "node:fs";
|
|
90406
90804
|
import os8 from "node:os";
|
|
90407
|
-
import { dirname as
|
|
90805
|
+
import { dirname as dirname18 } from "node:path";
|
|
90408
90806
|
import { PassThrough } from "node:stream";
|
|
90409
90807
|
var import_debug6, __runInitializers22 = function(thisArg, initializers, value) {
|
|
90410
90808
|
var useValue = arguments.length > 2;
|
|
@@ -90478,8 +90876,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
90478
90876
|
static {
|
|
90479
90877
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : undefined;
|
|
90480
90878
|
__esDecorate22(this, _private_writeFrame_descriptor = { value: __setFunctionName5(async function(buffer) {
|
|
90481
|
-
const error = await new Promise((
|
|
90482
|
-
this.#process.stdin.write(buffer,
|
|
90879
|
+
const error = await new Promise((resolve15) => {
|
|
90880
|
+
this.#process.stdin.write(buffer, resolve15);
|
|
90483
90881
|
});
|
|
90484
90882
|
if (error) {
|
|
90485
90883
|
console.log(`ffmpeg failed to write: ${error.message}.`);
|
|
@@ -90528,7 +90926,7 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
90528
90926
|
filters.push(formatArgs.splice(vf, 2).at(-1) ?? "");
|
|
90529
90927
|
}
|
|
90530
90928
|
if (path11) {
|
|
90531
|
-
fs5.mkdirSync(
|
|
90929
|
+
fs5.mkdirSync(dirname18(path11), { recursive: overwrite });
|
|
90532
90930
|
}
|
|
90533
90931
|
this.#process = spawn2(ffmpegPath, [
|
|
90534
90932
|
["-loglevel", "error"],
|
|
@@ -90634,8 +91032,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
90634
91032
|
const [buffer, timestamp] = await this.#lastFrame;
|
|
90635
91033
|
await Promise.all(Array(Math.max(1, Math.round(this.#fps * (performance.now() - timestamp) / 1000))).fill(buffer).map(this.#writeFrame.bind(this)));
|
|
90636
91034
|
this.#process.stdin.end();
|
|
90637
|
-
await new Promise((
|
|
90638
|
-
this.#process.once("close",
|
|
91035
|
+
await new Promise((resolve15) => {
|
|
91036
|
+
this.#process.once("close", resolve15);
|
|
90639
91037
|
});
|
|
90640
91038
|
}
|
|
90641
91039
|
async[(_private_writeFrame_decorators = [guarded()], _stop_decorators = [guarded()], asyncDisposeSymbol)]() {
|
|
@@ -90681,17 +91079,17 @@ var init_puppeteer_core = __esm(() => {
|
|
|
90681
91079
|
});
|
|
90682
91080
|
|
|
90683
91081
|
// src/core/design-eval/capture.ts
|
|
90684
|
-
import { mkdirSync as
|
|
90685
|
-
import { join as
|
|
91082
|
+
import { mkdirSync as mkdirSync17, statSync as statSync15, existsSync as existsSync40 } from "fs";
|
|
91083
|
+
import { join as join36 } from "path";
|
|
90686
91084
|
function findBrowser() {
|
|
90687
91085
|
const platform2 = process.platform;
|
|
90688
91086
|
const paths = CHROME_PATHS[platform2] ?? [];
|
|
90689
91087
|
for (const p of paths) {
|
|
90690
|
-
if (
|
|
91088
|
+
if (existsSync40(p))
|
|
90691
91089
|
return p;
|
|
90692
91090
|
}
|
|
90693
|
-
const minkBrowsers =
|
|
90694
|
-
if (
|
|
91091
|
+
const minkBrowsers = join36(minkRoot(), "browsers");
|
|
91092
|
+
if (existsSync40(minkBrowsers)) {
|
|
90695
91093
|
const found = findChromeInDir(minkBrowsers);
|
|
90696
91094
|
if (found)
|
|
90697
91095
|
return found;
|
|
@@ -90712,7 +91110,7 @@ function findChromeInDir(dir) {
|
|
|
90712
91110
|
try {
|
|
90713
91111
|
const entries = readdirSync12(dir);
|
|
90714
91112
|
for (const entry of entries) {
|
|
90715
|
-
const full =
|
|
91113
|
+
const full = join36(dir, entry);
|
|
90716
91114
|
try {
|
|
90717
91115
|
const stat2 = statSync16(full);
|
|
90718
91116
|
if (stat2.isDirectory()) {
|
|
@@ -90760,7 +91158,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
90760
91158
|
const y = section * viewport.height;
|
|
90761
91159
|
const clipHeight = Math.min(viewport.height, pageHeight - y);
|
|
90762
91160
|
const fileName = `${prefix}-${viewport.name}-${section}.jpg`;
|
|
90763
|
-
const filePath =
|
|
91161
|
+
const filePath = join36(options.outputDir, fileName);
|
|
90764
91162
|
await page.screenshot({
|
|
90765
91163
|
path: filePath,
|
|
90766
91164
|
type: "jpeg",
|
|
@@ -90792,7 +91190,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
90792
91190
|
return results;
|
|
90793
91191
|
}
|
|
90794
91192
|
async function captureAllRoutes(routes, baseUrl, viewports, options, outputDir) {
|
|
90795
|
-
|
|
91193
|
+
mkdirSync17(outputDir, { recursive: true });
|
|
90796
91194
|
const executablePath = findBrowser();
|
|
90797
91195
|
const browser = await puppeteer_core_default.launch({
|
|
90798
91196
|
executablePath,
|
|
@@ -92229,9 +92627,9 @@ var exports_wiki = {};
|
|
|
92229
92627
|
__export(exports_wiki, {
|
|
92230
92628
|
wiki: () => wiki
|
|
92231
92629
|
});
|
|
92232
|
-
import { existsSync as
|
|
92233
|
-
import { resolve as
|
|
92234
|
-
import { homedir as
|
|
92630
|
+
import { existsSync as existsSync41, statSync as statSync16 } from "fs";
|
|
92631
|
+
import { resolve as resolve15 } from "path";
|
|
92632
|
+
import { homedir as homedir6 } from "os";
|
|
92235
92633
|
async function wiki(_cwd, args) {
|
|
92236
92634
|
const sub = args[0];
|
|
92237
92635
|
switch (sub) {
|
|
@@ -92287,7 +92685,7 @@ async function wikiInit(args) {
|
|
|
92287
92685
|
console.log(`[mink] initializing vault at ${targetPath}`);
|
|
92288
92686
|
console.log(" (set a custom path with: mink wiki init /path/to/vault)");
|
|
92289
92687
|
}
|
|
92290
|
-
const isExisting =
|
|
92688
|
+
const isExisting = existsSync41(targetPath) && statSync16(targetPath).isDirectory();
|
|
92291
92689
|
setConfigValue("wiki.path", targetPath);
|
|
92292
92690
|
ensureVaultStructure();
|
|
92293
92691
|
seedTemplates(vaultTemplates());
|
|
@@ -92497,9 +92895,9 @@ function wikiLinks() {
|
|
|
92497
92895
|
}
|
|
92498
92896
|
function expandPath(raw) {
|
|
92499
92897
|
if (raw.startsWith("~/")) {
|
|
92500
|
-
return
|
|
92898
|
+
return resolve15(homedir6(), raw.slice(2));
|
|
92501
92899
|
}
|
|
92502
|
-
return
|
|
92900
|
+
return resolve15(raw);
|
|
92503
92901
|
}
|
|
92504
92902
|
var init_wiki = __esm(() => {
|
|
92505
92903
|
init_vault();
|
|
@@ -92515,8 +92913,8 @@ var exports_note = {};
|
|
|
92515
92913
|
__export(exports_note, {
|
|
92516
92914
|
note: () => note
|
|
92517
92915
|
});
|
|
92518
|
-
import { resolve as
|
|
92519
|
-
import { existsSync as
|
|
92916
|
+
import { resolve as resolve16 } from "path";
|
|
92917
|
+
import { existsSync as existsSync42, readFileSync as readFileSync30 } from "fs";
|
|
92520
92918
|
async function note(cwd, args) {
|
|
92521
92919
|
if (!isWikiEnabled()) {
|
|
92522
92920
|
console.error("[mink] wiki feature is disabled");
|
|
@@ -92546,8 +92944,8 @@ async function note(cwd, args) {
|
|
|
92546
92944
|
return;
|
|
92547
92945
|
}
|
|
92548
92946
|
if (parsed.file) {
|
|
92549
|
-
const sourcePath =
|
|
92550
|
-
if (!
|
|
92947
|
+
const sourcePath = resolve16(cwd, parsed.file);
|
|
92948
|
+
if (!existsSync42(sourcePath)) {
|
|
92551
92949
|
console.error(`[mink] file not found: ${sourcePath}`);
|
|
92552
92950
|
process.exit(1);
|
|
92553
92951
|
}
|
|
@@ -92708,39 +93106,39 @@ var exports_skill = {};
|
|
|
92708
93106
|
__export(exports_skill, {
|
|
92709
93107
|
skill: () => skill
|
|
92710
93108
|
});
|
|
92711
|
-
import { join as
|
|
92712
|
-
import { homedir as
|
|
93109
|
+
import { join as join37, resolve as resolve17, dirname as dirname19 } from "path";
|
|
93110
|
+
import { homedir as homedir7 } from "os";
|
|
92713
93111
|
import {
|
|
92714
|
-
existsSync as
|
|
92715
|
-
mkdirSync as
|
|
92716
|
-
copyFileSync,
|
|
93112
|
+
existsSync as existsSync43,
|
|
93113
|
+
mkdirSync as mkdirSync18,
|
|
93114
|
+
copyFileSync as copyFileSync2,
|
|
92717
93115
|
unlinkSync as unlinkSync6,
|
|
92718
93116
|
readdirSync as readdirSync12,
|
|
92719
|
-
rmSync as
|
|
93117
|
+
rmSync as rmSync3,
|
|
92720
93118
|
symlinkSync as symlinkSync2,
|
|
92721
93119
|
lstatSync as lstatSync2
|
|
92722
93120
|
} from "fs";
|
|
92723
93121
|
function getSkillsSourceDir() {
|
|
92724
|
-
let dir =
|
|
93122
|
+
let dir = dirname19(new URL(import.meta.url).pathname);
|
|
92725
93123
|
while (true) {
|
|
92726
|
-
if (
|
|
92727
|
-
return
|
|
93124
|
+
if (existsSync43(join37(dir, "package.json")) && existsSync43(join37(dir, "skills"))) {
|
|
93125
|
+
return join37(dir, "skills");
|
|
92728
93126
|
}
|
|
92729
|
-
const parent =
|
|
93127
|
+
const parent = dirname19(dir);
|
|
92730
93128
|
if (parent === dir)
|
|
92731
93129
|
break;
|
|
92732
93130
|
dir = parent;
|
|
92733
93131
|
}
|
|
92734
|
-
return
|
|
93132
|
+
return resolve17(dirname19(new URL(import.meta.url).pathname), "../../skills");
|
|
92735
93133
|
}
|
|
92736
93134
|
function getAvailableSkills() {
|
|
92737
93135
|
const dir = getSkillsSourceDir();
|
|
92738
|
-
if (!
|
|
93136
|
+
if (!existsSync43(dir))
|
|
92739
93137
|
return [];
|
|
92740
|
-
return readdirSync12(dir, { withFileTypes: true }).filter((d) => d.isDirectory() &&
|
|
93138
|
+
return readdirSync12(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync43(join37(dir, d.name, "SKILL.md"))).map((d) => d.name);
|
|
92741
93139
|
}
|
|
92742
93140
|
function isInstalled(skillName) {
|
|
92743
|
-
return
|
|
93141
|
+
return existsSync43(join37(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
|
|
92744
93142
|
}
|
|
92745
93143
|
async function skill(args) {
|
|
92746
93144
|
const sub = args[0];
|
|
@@ -92774,28 +93172,28 @@ function skillInstall(name) {
|
|
|
92774
93172
|
console.error(" Expected skills at: " + sourceDir);
|
|
92775
93173
|
return;
|
|
92776
93174
|
}
|
|
92777
|
-
|
|
93175
|
+
mkdirSync18(AGENTS_SKILLS_DIR, { recursive: true });
|
|
92778
93176
|
for (const skillName of skills) {
|
|
92779
|
-
const srcDir =
|
|
92780
|
-
const srcFile =
|
|
92781
|
-
const destDir =
|
|
92782
|
-
if (!
|
|
93177
|
+
const srcDir = join37(sourceDir, skillName);
|
|
93178
|
+
const srcFile = join37(srcDir, "SKILL.md");
|
|
93179
|
+
const destDir = join37(AGENTS_SKILLS_DIR, skillName);
|
|
93180
|
+
if (!existsSync43(srcFile)) {
|
|
92783
93181
|
console.error(`[mink] skill not found: ${skillName}`);
|
|
92784
93182
|
continue;
|
|
92785
93183
|
}
|
|
92786
|
-
|
|
93184
|
+
mkdirSync18(destDir, { recursive: true });
|
|
92787
93185
|
copyDirRecursive2(srcDir, destDir);
|
|
92788
|
-
|
|
92789
|
-
const symlink =
|
|
93186
|
+
mkdirSync18(CLAUDE_SKILLS_DIR, { recursive: true });
|
|
93187
|
+
const symlink = join37(CLAUDE_SKILLS_DIR, skillName);
|
|
92790
93188
|
try {
|
|
92791
|
-
if (
|
|
93189
|
+
if (existsSync43(symlink)) {
|
|
92792
93190
|
if (lstatSync2(symlink).isSymbolicLink() || lstatSync2(symlink).isFile()) {
|
|
92793
93191
|
unlinkSync6(symlink);
|
|
92794
93192
|
} else {
|
|
92795
|
-
|
|
93193
|
+
rmSync3(symlink, { recursive: true, force: true });
|
|
92796
93194
|
}
|
|
92797
93195
|
}
|
|
92798
|
-
const relativeTarget =
|
|
93196
|
+
const relativeTarget = join37("..", "..", ".agents", "skills", skillName);
|
|
92799
93197
|
symlinkSync2(relativeTarget, symlink);
|
|
92800
93198
|
} catch {}
|
|
92801
93199
|
console.log(`[mink] installed: ${skillName} -> ${destDir}`);
|
|
@@ -92806,15 +93204,15 @@ function skillInstall(name) {
|
|
|
92806
93204
|
function skillUninstall(name) {
|
|
92807
93205
|
const skills = name ? [name] : getAvailableSkills();
|
|
92808
93206
|
for (const skillName of skills) {
|
|
92809
|
-
const destDir =
|
|
92810
|
-
if (!
|
|
93207
|
+
const destDir = join37(AGENTS_SKILLS_DIR, skillName);
|
|
93208
|
+
if (!existsSync43(destDir)) {
|
|
92811
93209
|
console.log(`[mink] not installed: ${skillName}`);
|
|
92812
93210
|
continue;
|
|
92813
93211
|
}
|
|
92814
|
-
|
|
92815
|
-
const symlink =
|
|
93212
|
+
rmSync3(destDir, { recursive: true, force: true });
|
|
93213
|
+
const symlink = join37(CLAUDE_SKILLS_DIR, skillName);
|
|
92816
93214
|
try {
|
|
92817
|
-
if (
|
|
93215
|
+
if (existsSync43(symlink))
|
|
92818
93216
|
unlinkSync6(symlink);
|
|
92819
93217
|
} catch {}
|
|
92820
93218
|
console.log(`[mink] uninstalled: ${skillName}`);
|
|
@@ -92829,7 +93227,7 @@ function skillList() {
|
|
|
92829
93227
|
if (installed.length > 0) {
|
|
92830
93228
|
console.log(" Installed:");
|
|
92831
93229
|
for (const s of installed) {
|
|
92832
|
-
console.log(` ${s} (${
|
|
93230
|
+
console.log(` ${s} (${join37(AGENTS_SKILLS_DIR, s)})`);
|
|
92833
93231
|
}
|
|
92834
93232
|
}
|
|
92835
93233
|
if (notInstalled.length > 0) {
|
|
@@ -92848,20 +93246,20 @@ function skillList() {
|
|
|
92848
93246
|
function copyDirRecursive2(src, dest) {
|
|
92849
93247
|
const entries = readdirSync12(src, { withFileTypes: true });
|
|
92850
93248
|
for (const entry of entries) {
|
|
92851
|
-
const srcPath =
|
|
92852
|
-
const destPath =
|
|
93249
|
+
const srcPath = join37(src, entry.name);
|
|
93250
|
+
const destPath = join37(dest, entry.name);
|
|
92853
93251
|
if (entry.isDirectory()) {
|
|
92854
|
-
|
|
93252
|
+
mkdirSync18(destPath, { recursive: true });
|
|
92855
93253
|
copyDirRecursive2(srcPath, destPath);
|
|
92856
93254
|
} else {
|
|
92857
|
-
|
|
93255
|
+
copyFileSync2(srcPath, destPath);
|
|
92858
93256
|
}
|
|
92859
93257
|
}
|
|
92860
93258
|
}
|
|
92861
93259
|
var AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR;
|
|
92862
93260
|
var init_skill = __esm(() => {
|
|
92863
|
-
AGENTS_SKILLS_DIR =
|
|
92864
|
-
CLAUDE_SKILLS_DIR =
|
|
93261
|
+
AGENTS_SKILLS_DIR = join37(homedir7(), ".agents", "skills");
|
|
93262
|
+
CLAUDE_SKILLS_DIR = join37(homedir7(), ".claude", "skills");
|
|
92865
93263
|
});
|
|
92866
93264
|
|
|
92867
93265
|
// src/commands/agent.ts
|
|
@@ -92869,41 +93267,41 @@ var exports_agent = {};
|
|
|
92869
93267
|
__export(exports_agent, {
|
|
92870
93268
|
agent: () => agent
|
|
92871
93269
|
});
|
|
92872
|
-
import { join as
|
|
92873
|
-
import { homedir as
|
|
93270
|
+
import { join as join38, resolve as resolve18, dirname as dirname20 } from "path";
|
|
93271
|
+
import { homedir as homedir8 } from "os";
|
|
92874
93272
|
import {
|
|
92875
|
-
existsSync as
|
|
92876
|
-
mkdirSync as
|
|
93273
|
+
existsSync as existsSync44,
|
|
93274
|
+
mkdirSync as mkdirSync19,
|
|
92877
93275
|
readFileSync as readFileSync31,
|
|
92878
93276
|
writeFileSync as writeFileSync11
|
|
92879
93277
|
} from "fs";
|
|
92880
93278
|
import { createHash as createHash5 } from "crypto";
|
|
92881
93279
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
92882
93280
|
function getAgentTemplatePath() {
|
|
92883
|
-
let dir =
|
|
93281
|
+
let dir = dirname20(new URL(import.meta.url).pathname);
|
|
92884
93282
|
while (true) {
|
|
92885
|
-
if (
|
|
92886
|
-
return
|
|
93283
|
+
if (existsSync44(join38(dir, "package.json")) && existsSync44(join38(dir, "agents", TEMPLATE_FILE))) {
|
|
93284
|
+
return join38(dir, "agents", TEMPLATE_FILE);
|
|
92887
93285
|
}
|
|
92888
|
-
const parent =
|
|
93286
|
+
const parent = dirname20(dir);
|
|
92889
93287
|
if (parent === dir)
|
|
92890
93288
|
break;
|
|
92891
93289
|
dir = parent;
|
|
92892
93290
|
}
|
|
92893
|
-
return
|
|
93291
|
+
return resolve18(dirname20(new URL(import.meta.url).pathname), "../../agents", TEMPLATE_FILE);
|
|
92894
93292
|
}
|
|
92895
93293
|
function getMinkVersion() {
|
|
92896
|
-
let dir =
|
|
93294
|
+
let dir = dirname20(new URL(import.meta.url).pathname);
|
|
92897
93295
|
while (true) {
|
|
92898
|
-
const pkgPath =
|
|
92899
|
-
if (
|
|
93296
|
+
const pkgPath = join38(dir, "package.json");
|
|
93297
|
+
if (existsSync44(pkgPath)) {
|
|
92900
93298
|
try {
|
|
92901
93299
|
const pkg = JSON.parse(readFileSync31(pkgPath, "utf-8"));
|
|
92902
93300
|
if (pkg.name && pkg.version)
|
|
92903
93301
|
return pkg.version;
|
|
92904
93302
|
} catch {}
|
|
92905
93303
|
}
|
|
92906
|
-
const parent =
|
|
93304
|
+
const parent = dirname20(dir);
|
|
92907
93305
|
if (parent === dir)
|
|
92908
93306
|
break;
|
|
92909
93307
|
dir = parent;
|
|
@@ -92921,19 +93319,19 @@ function sha2562(text) {
|
|
|
92921
93319
|
return createHash5("sha256").update(text).digest("hex");
|
|
92922
93320
|
}
|
|
92923
93321
|
function claudeAgentsDir() {
|
|
92924
|
-
return
|
|
93322
|
+
return join38(homedir8(), ".claude", "agents");
|
|
92925
93323
|
}
|
|
92926
93324
|
function installedAgentPath() {
|
|
92927
|
-
return
|
|
93325
|
+
return join38(claudeAgentsDir(), INSTALLED_FILE);
|
|
92928
93326
|
}
|
|
92929
93327
|
function installAgentDefinition(opts) {
|
|
92930
93328
|
const templatePath = getAgentTemplatePath();
|
|
92931
|
-
if (!
|
|
93329
|
+
if (!existsSync44(templatePath)) {
|
|
92932
93330
|
throw new Error(`[mink agent] bundled agent template not found at ${templatePath}
|
|
92933
93331
|
` + " This usually means the package was installed without bundled assets.");
|
|
92934
93332
|
}
|
|
92935
93333
|
const installed = installedAgentPath();
|
|
92936
|
-
if (opts.skip &&
|
|
93334
|
+
if (opts.skip && existsSync44(installed)) {
|
|
92937
93335
|
return { action: "skipped", path: installed };
|
|
92938
93336
|
}
|
|
92939
93337
|
const template = readFileSync31(templatePath, "utf-8");
|
|
@@ -92942,14 +93340,14 @@ function installAgentDefinition(opts) {
|
|
|
92942
93340
|
VAULT_PATH: resolveVaultPath(),
|
|
92943
93341
|
MINK_VERSION: getMinkVersion()
|
|
92944
93342
|
});
|
|
92945
|
-
const exists =
|
|
93343
|
+
const exists = existsSync44(installed);
|
|
92946
93344
|
if (!opts.force && exists) {
|
|
92947
93345
|
const current = readFileSync31(installed, "utf-8");
|
|
92948
93346
|
if (sha2562(current) === sha2562(rendered)) {
|
|
92949
93347
|
return { action: "unchanged", path: installed };
|
|
92950
93348
|
}
|
|
92951
93349
|
}
|
|
92952
|
-
|
|
93350
|
+
mkdirSync19(claudeAgentsDir(), { recursive: true });
|
|
92953
93351
|
writeFileSync11(installed, rendered);
|
|
92954
93352
|
return {
|
|
92955
93353
|
action: exists ? "updated" : "installed",
|
|
@@ -93020,8 +93418,8 @@ async function agent(_cwd, rawArgs) {
|
|
|
93020
93418
|
}
|
|
93021
93419
|
const skipUpdate = args.noUpdate || process.env.MINK_AGENT_NO_UPDATE === "1";
|
|
93022
93420
|
const root = minkRoot();
|
|
93023
|
-
if (!
|
|
93024
|
-
|
|
93421
|
+
if (!existsSync44(root)) {
|
|
93422
|
+
mkdirSync19(root, { recursive: true });
|
|
93025
93423
|
}
|
|
93026
93424
|
let result;
|
|
93027
93425
|
try {
|
|
@@ -93072,13 +93470,13 @@ var init_agent = __esm(() => {
|
|
|
93072
93470
|
});
|
|
93073
93471
|
|
|
93074
93472
|
// src/core/sync-merge-drivers.ts
|
|
93075
|
-
import { readFileSync as readFileSync32, writeFileSync as writeFileSync12, appendFileSync as appendFileSync2, copyFileSync as
|
|
93076
|
-
import { join as
|
|
93473
|
+
import { readFileSync as readFileSync32, writeFileSync as writeFileSync12, appendFileSync as appendFileSync2, copyFileSync as copyFileSync3, renameSync as renameSync4, unlinkSync as unlinkSync7 } from "fs";
|
|
93474
|
+
import { join as join39 } from "path";
|
|
93077
93475
|
function logWarning(driver, args, err) {
|
|
93078
93476
|
try {
|
|
93079
93477
|
const line = `[${new Date().toISOString()}] ${driver} fallback for ${args.filePath}: ${err instanceof Error ? err.message : String(err)}
|
|
93080
93478
|
`;
|
|
93081
|
-
appendFileSync2(
|
|
93479
|
+
appendFileSync2(join39(minkRoot(), "sync-warnings.log"), line);
|
|
93082
93480
|
} catch {}
|
|
93083
93481
|
}
|
|
93084
93482
|
function readJsonOrNull(path12) {
|
|
@@ -93313,7 +93711,7 @@ function mergeDbDriver(args) {
|
|
|
93313
93711
|
const tmp = `${args.oursPath}.merge-${process.pid}-${Date.now()}.tmp`;
|
|
93314
93712
|
let ours = null;
|
|
93315
93713
|
try {
|
|
93316
|
-
|
|
93714
|
+
copyFileSync3(args.oursPath, tmp);
|
|
93317
93715
|
ours = openDriver(tmp);
|
|
93318
93716
|
ours.exec("PRAGMA journal_mode = WAL");
|
|
93319
93717
|
ours.exec("PRAGMA foreign_keys = ON");
|
|
@@ -93829,8 +94227,22 @@ switch (command2) {
|
|
|
93829
94227
|
sessionStop(sessionPath2(cwd));
|
|
93830
94228
|
break;
|
|
93831
94229
|
case "init": {
|
|
93832
|
-
const { init: init2 } = await Promise.resolve().then(() => (init_init(), exports_init));
|
|
93833
|
-
|
|
94230
|
+
const { init: init2, resolveTargetsFromFlag: resolveTargetsFromFlag2 } = await Promise.resolve().then(() => (init_init(), exports_init));
|
|
94231
|
+
const args = process.argv.slice(3);
|
|
94232
|
+
const agentFlagIndex = args.findIndex((a) => a === "--agent" || a.startsWith("--agent="));
|
|
94233
|
+
let agentValue;
|
|
94234
|
+
if (agentFlagIndex !== -1) {
|
|
94235
|
+
const a = args[agentFlagIndex];
|
|
94236
|
+
agentValue = a.includes("=") ? a.split("=").slice(1).join("=") : args[agentFlagIndex + 1];
|
|
94237
|
+
}
|
|
94238
|
+
const yes = args.includes("--yes") || args.includes("-y");
|
|
94239
|
+
const targets = agentValue ? resolveTargetsFromFlag2(agentValue) : undefined;
|
|
94240
|
+
if (agentValue && (!targets || targets.length === 0)) {
|
|
94241
|
+
console.error(`[mink] unknown --agent value: ${agentValue}`);
|
|
94242
|
+
console.error(" Valid: claude, pi, all (or a comma-separated list)");
|
|
94243
|
+
process.exit(1);
|
|
94244
|
+
}
|
|
94245
|
+
await init2(cwd, { targets, interactive: !yes });
|
|
93834
94246
|
break;
|
|
93835
94247
|
}
|
|
93836
94248
|
case "status": {
|
|
@@ -93974,12 +94386,12 @@ switch (command2) {
|
|
|
93974
94386
|
case "version":
|
|
93975
94387
|
case "--version":
|
|
93976
94388
|
case "-v": {
|
|
93977
|
-
const { resolve:
|
|
94389
|
+
const { resolve: resolve19, dirname: dirname21, basename: basename10 } = await import("path");
|
|
93978
94390
|
const bundlePath = new URL(import.meta.url).pathname;
|
|
93979
|
-
const cliPath =
|
|
94391
|
+
const cliPath = resolve19(dirname21(bundlePath));
|
|
93980
94392
|
const { readFileSync: readFileSync33 } = await import("fs");
|
|
93981
94393
|
try {
|
|
93982
|
-
const pkg = JSON.parse(readFileSync33(
|
|
94394
|
+
const pkg = JSON.parse(readFileSync33(resolve19(cliPath, "../package.json"), "utf-8"));
|
|
93983
94395
|
console.log(`mink ${pkg.version}`);
|
|
93984
94396
|
} catch {
|
|
93985
94397
|
console.log("mink (unknown version)");
|
|
@@ -94002,7 +94414,8 @@ switch (command2) {
|
|
|
94002
94414
|
console.log("Usage: mink <command> [options]");
|
|
94003
94415
|
console.log();
|
|
94004
94416
|
console.log("Commands:");
|
|
94005
|
-
console.log(" init
|
|
94417
|
+
console.log(" init [--agent X] [--yes] Initialize Mink in the current project");
|
|
94418
|
+
console.log(" --agent claude|pi|all (default: detect & prompt)");
|
|
94006
94419
|
console.log(" status Display project health at a glance");
|
|
94007
94420
|
console.log(" scan [--check] Force a full file index rescan");
|
|
94008
94421
|
console.log(" config [key] [value] Manage global user settings");
|