@drewpayment/mink 0.13.0-beta.1 → 0.13.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +4 -20
  2. package/dashboard/out/404.html +1 -1
  3. package/dashboard/out/action-log.html +1 -1
  4. package/dashboard/out/action-log.txt +1 -1
  5. package/dashboard/out/activity.html +1 -1
  6. package/dashboard/out/activity.txt +1 -1
  7. package/dashboard/out/bugs.html +1 -1
  8. package/dashboard/out/bugs.txt +1 -1
  9. package/dashboard/out/capture.html +1 -1
  10. package/dashboard/out/capture.txt +1 -1
  11. package/dashboard/out/config.html +1 -1
  12. package/dashboard/out/config.txt +1 -1
  13. package/dashboard/out/daemon.html +1 -1
  14. package/dashboard/out/daemon.txt +1 -1
  15. package/dashboard/out/design.html +1 -1
  16. package/dashboard/out/design.txt +1 -1
  17. package/dashboard/out/discord.html +1 -1
  18. package/dashboard/out/discord.txt +1 -1
  19. package/dashboard/out/file-index.html +1 -1
  20. package/dashboard/out/file-index.txt +1 -1
  21. package/dashboard/out/index.html +1 -1
  22. package/dashboard/out/index.txt +1 -1
  23. package/dashboard/out/insights.html +1 -1
  24. package/dashboard/out/insights.txt +1 -1
  25. package/dashboard/out/learning.html +1 -1
  26. package/dashboard/out/learning.txt +1 -1
  27. package/dashboard/out/overview.html +1 -1
  28. package/dashboard/out/overview.txt +1 -1
  29. package/dashboard/out/scheduler.html +1 -1
  30. package/dashboard/out/scheduler.txt +1 -1
  31. package/dashboard/out/sync.html +1 -1
  32. package/dashboard/out/sync.txt +1 -1
  33. package/dashboard/out/tokens.html +1 -1
  34. package/dashboard/out/tokens.txt +1 -1
  35. package/dashboard/out/waste.html +1 -1
  36. package/dashboard/out/waste.txt +1 -1
  37. package/dashboard/out/wiki.html +1 -1
  38. package/dashboard/out/wiki.txt +1 -1
  39. package/dist/cli.bun.js +1232 -904
  40. package/dist/cli.node.js +1251 -924
  41. package/package.json +1 -1
  42. package/src/cli.ts +17 -20
  43. package/src/commands/init.ts +14 -123
  44. package/src/commands/post-read.ts +18 -0
  45. package/src/commands/post-tool.ts +48 -0
  46. package/src/commands/retrieve.ts +32 -0
  47. package/src/core/code-skeleton.ts +108 -0
  48. package/src/core/compress-tool-output.ts +127 -0
  49. package/src/core/compression.ts +81 -0
  50. package/src/core/hook-output.ts +42 -0
  51. package/src/core/output-compression.ts +252 -0
  52. package/src/core/token-estimate.ts +40 -0
  53. package/src/repositories/compression-cache-repo.ts +97 -0
  54. package/src/repositories/token-ledger-repo.ts +87 -0
  55. package/src/storage/schema.ts +50 -1
  56. package/src/types/compression.ts +29 -0
  57. package/src/types/config.ts +40 -0
  58. package/src/types/hook-input.ts +4 -0
  59. package/src/types/token-ledger.ts +33 -0
  60. package/src/core/agent-detect.ts +0 -88
  61. package/src/core/agent-pi.ts +0 -314
  62. package/src/core/prompt.ts +0 -27
  63. /package/dashboard/out/_next/static/{UWfkbJY4zr9fSt7O-CAge → Yl3F-J4CwvYf6yWG-SSmG}/_buildManifest.js +0 -0
  64. /package/dashboard/out/_next/static/{UWfkbJY4zr9fSt7O-CAge → Yl3F-J4CwvYf6yWG-SSmG}/_ssgManifest.js +0 -0
package/dist/cli.node.js CHANGED
@@ -422,6 +422,41 @@ var init_config = __esm(() => {
422
422
  envVar: "MINK_PROJECTS_IDENTITY",
423
423
  description: "Project identity strategy: path-derived (legacy) or git-remote (stable across machines)",
424
424
  scope: "shared"
425
+ },
426
+ {
427
+ key: "compression.enabled",
428
+ default: "false",
429
+ envVar: "MINK_COMPRESSION_ENABLED",
430
+ description: "Enable tool-output compression (spec 21). Off until inline compression ships.",
431
+ scope: "shared"
432
+ },
433
+ {
434
+ key: "compression.threshold-tokens",
435
+ default: "800",
436
+ envVar: "MINK_COMPRESSION_THRESHOLD_TOKENS",
437
+ description: "Minimum estimated token size before a tool output is eligible for compression",
438
+ scope: "shared"
439
+ },
440
+ {
441
+ key: "compression.min-savings-ratio",
442
+ default: "0.25",
443
+ envVar: "MINK_COMPRESSION_MIN_SAVINGS_RATIO",
444
+ description: "Discard a compression attempt unless it saves at least this fraction of tokens",
445
+ scope: "shared"
446
+ },
447
+ {
448
+ key: "compression.holdout-fraction",
449
+ default: "0.1",
450
+ envVar: "MINK_COMPRESSION_HOLDOUT_FRACTION",
451
+ description: "Fraction of eligible outputs left uncompressed as a measured control group",
452
+ scope: "shared"
453
+ },
454
+ {
455
+ key: "compression.retention-hours",
456
+ default: "168",
457
+ envVar: "MINK_COMPRESSION_RETENTION_HOURS",
458
+ description: "How long compressed originals stay retrievable before eviction",
459
+ scope: "shared"
425
460
  }
426
461
  ];
427
462
  VALID_KEYS = new Set(CONFIG_KEYS.map((k) => k.key));
@@ -3096,7 +3131,7 @@ function readMeta(db, key) {
3096
3131
  function writeMeta(db, key, value) {
3097
3132
  db.prepare("INSERT INTO meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value").run(key, value);
3098
3133
  }
3099
- var SCHEMA_VERSION = 1, INITIAL_SCHEMA = `
3134
+ var SCHEMA_VERSION = 3, INITIAL_SCHEMA = `
3100
3135
  CREATE TABLE IF NOT EXISTS meta (
3101
3136
  key TEXT PRIMARY KEY,
3102
3137
  value TEXT NOT NULL
@@ -3258,6 +3293,55 @@ CREATE TABLE IF NOT EXISTS counters (
3258
3293
  file_index_hits INTEGER NOT NULL DEFAULT 0,
3259
3294
  file_index_misses INTEGER NOT NULL DEFAULT 0
3260
3295
  );
3296
+
3297
+ -- Tool-output compression measurement (spec 21). One row per compression
3298
+ -- decision: either a compressed arm (compressed_tokens < original_tokens) or a
3299
+ -- holdout arm (left uncompressed for control, compressed_tokens = original_tokens).
3300
+ -- These are append-only telemetry, independent of session lifecycle, written at
3301
+ -- the moment a tool output is processed. New table → applied to existing DBs via
3302
+ -- IF NOT EXISTS on the next open.
3303
+ CREATE TABLE IF NOT EXISTS ledger_compressions (
3304
+ id TEXT PRIMARY KEY,
3305
+ created_at TEXT NOT NULL,
3306
+ tool_name TEXT NOT NULL,
3307
+ content_kind TEXT NOT NULL,
3308
+ original_tokens INTEGER NOT NULL DEFAULT 0,
3309
+ compressed_tokens INTEGER NOT NULL DEFAULT 0,
3310
+ holdout INTEGER NOT NULL DEFAULT 0,
3311
+ device_id TEXT NOT NULL
3312
+ );
3313
+ CREATE INDEX IF NOT EXISTS idx_ledger_compressions_created ON ledger_compressions(created_at);
3314
+ CREATE INDEX IF NOT EXISTS idx_ledger_compressions_device ON ledger_compressions(device_id);
3315
+
3316
+ -- Per-device compression aggregates, summed across devices like ledger_lifetime.
3317
+ -- measured_savings only credits compressed arms (holdout arms save nothing by
3318
+ -- construction), so the reported figure is a true measured delta, not an estimate.
3319
+ CREATE TABLE IF NOT EXISTS ledger_compression_lifetime (
3320
+ device_id TEXT PRIMARY KEY,
3321
+ total_events INTEGER NOT NULL DEFAULT 0,
3322
+ total_holdout_events INTEGER NOT NULL DEFAULT 0,
3323
+ total_original_tokens INTEGER NOT NULL DEFAULT 0,
3324
+ total_compressed_tokens INTEGER NOT NULL DEFAULT 0,
3325
+ total_measured_savings INTEGER NOT NULL DEFAULT 0
3326
+ );
3327
+
3328
+ -- Reversible-compression cache (spec 21 §Reversibility). When a tool output is
3329
+ -- compressed, the original is stored here keyed by a short retrieval token and
3330
+ -- embedded in the compressed result; "mink retrieve <token>" returns it
3331
+ -- byte-exact. Rows expire after the configured retention window; an expired or
3332
+ -- unknown token is a graceful miss. This is a local cache, not synced state, so
3333
+ -- (unlike other tables) it carries no merge semantics beyond device_id for audit.
3334
+ CREATE TABLE IF NOT EXISTS compression_cache (
3335
+ token TEXT PRIMARY KEY,
3336
+ created_at TEXT NOT NULL,
3337
+ expires_at TEXT NOT NULL,
3338
+ tool_name TEXT NOT NULL,
3339
+ content_kind TEXT NOT NULL,
3340
+ content TEXT NOT NULL,
3341
+ size_bytes INTEGER NOT NULL,
3342
+ device_id TEXT NOT NULL
3343
+ );
3344
+ CREATE INDEX IF NOT EXISTS idx_compression_cache_expires ON compression_cache(expires_at);
3261
3345
  `;
3262
3346
 
3263
3347
  // src/storage/migrate-json.ts
@@ -3675,6 +3759,68 @@ class TokenLedgerRepo {
3675
3759
  }
3676
3760
  });
3677
3761
  }
3762
+ recordCompression(event, deviceId = getOrCreateDeviceId()) {
3763
+ const id = event.id ?? crypto.randomUUID();
3764
+ const createdAt = event.createdAt ?? new Date().toISOString();
3765
+ const holdout = event.holdout ? 1 : 0;
3766
+ const savings = event.holdout ? 0 : Math.max(0, event.originalTokens - event.compressedTokens);
3767
+ this.db.transaction(() => {
3768
+ this.db.prepare(`
3769
+ INSERT OR REPLACE INTO ledger_compressions
3770
+ (id, created_at, tool_name, content_kind,
3771
+ original_tokens, compressed_tokens, holdout, device_id)
3772
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
3773
+ `).run(id, createdAt, event.toolName, event.contentKind, event.originalTokens, event.compressedTokens, holdout, deviceId);
3774
+ this.db.prepare(`
3775
+ INSERT INTO ledger_compression_lifetime
3776
+ (device_id, total_events, total_holdout_events,
3777
+ total_original_tokens, total_compressed_tokens, total_measured_savings)
3778
+ VALUES (?, ?, ?, ?, ?, ?)
3779
+ ON CONFLICT(device_id) DO UPDATE SET
3780
+ total_events = ledger_compression_lifetime.total_events + excluded.total_events,
3781
+ total_holdout_events = ledger_compression_lifetime.total_holdout_events + excluded.total_holdout_events,
3782
+ total_original_tokens = ledger_compression_lifetime.total_original_tokens + excluded.total_original_tokens,
3783
+ total_compressed_tokens = ledger_compression_lifetime.total_compressed_tokens + excluded.total_compressed_tokens,
3784
+ total_measured_savings = ledger_compression_lifetime.total_measured_savings + excluded.total_measured_savings
3785
+ `).run(deviceId, 1, holdout, event.originalTokens, event.compressedTokens, savings);
3786
+ });
3787
+ }
3788
+ compressionLifetime() {
3789
+ const row = this.db.prepare(`
3790
+ SELECT
3791
+ COALESCE(SUM(total_events), 0) AS totalEvents,
3792
+ COALESCE(SUM(total_holdout_events), 0) AS totalHoldoutEvents,
3793
+ COALESCE(SUM(total_original_tokens), 0) AS totalOriginalTokens,
3794
+ COALESCE(SUM(total_compressed_tokens), 0) AS totalCompressedTokens,
3795
+ COALESCE(SUM(total_measured_savings), 0) AS totalMeasuredSavings
3796
+ FROM ledger_compression_lifetime
3797
+ `).get();
3798
+ return {
3799
+ totalEvents: Number(row?.totalEvents ?? 0),
3800
+ totalHoldoutEvents: Number(row?.totalHoldoutEvents ?? 0),
3801
+ totalOriginalTokens: Number(row?.totalOriginalTokens ?? 0),
3802
+ totalCompressedTokens: Number(row?.totalCompressedTokens ?? 0),
3803
+ totalMeasuredSavings: Number(row?.totalMeasuredSavings ?? 0)
3804
+ };
3805
+ }
3806
+ compressionEvents(limit = 100) {
3807
+ const rows = this.db.prepare(`
3808
+ SELECT id, created_at, tool_name, content_kind,
3809
+ original_tokens, compressed_tokens, holdout
3810
+ FROM ledger_compressions
3811
+ ORDER BY created_at DESC
3812
+ LIMIT ?
3813
+ `).all(limit);
3814
+ return rows.map((r) => ({
3815
+ id: String(r.id),
3816
+ createdAt: String(r.created_at),
3817
+ toolName: String(r.tool_name),
3818
+ contentKind: String(r.content_kind),
3819
+ originalTokens: Number(r.original_tokens),
3820
+ compressedTokens: Number(r.compressed_tokens),
3821
+ holdout: Number(r.holdout) === 1
3822
+ }));
3823
+ }
3678
3824
  insertSessionRow(summary, deviceId, archived) {
3679
3825
  this.db.prepare(`
3680
3826
  INSERT OR REPLACE INTO ledger_sessions
@@ -4449,6 +4595,28 @@ function estimateTokens2(content, filePath) {
4449
4595
  }
4450
4596
  return Math.ceil(content.length / ratio);
4451
4597
  }
4598
+ function countTokens(text) {
4599
+ if (!text)
4600
+ return 0;
4601
+ const segments = text.match(/[A-Za-z]+|[0-9]+|[^A-Za-z0-9]/g);
4602
+ if (!segments)
4603
+ return 0;
4604
+ let tokens = 0;
4605
+ for (const seg of segments) {
4606
+ const first = seg.charCodeAt(0);
4607
+ if (first >= 65 && first <= 90 || first >= 97 && first <= 122) {
4608
+ tokens += Math.ceil(seg.length / 4);
4609
+ } else if (first >= 48 && first <= 57) {
4610
+ tokens += Math.ceil(seg.length / 3);
4611
+ } else if (seg === `
4612
+ `) {
4613
+ tokens += 1;
4614
+ } else if (seg === " " || seg === "\t" || seg === "\r") {} else {
4615
+ tokens += 1;
4616
+ }
4617
+ }
4618
+ return tokens;
4619
+ }
4452
4620
  var CODE_EXTENSIONS, PROSE_EXTENSIONS, BINARY_EXTENSIONS;
4453
4621
  var init_token_estimate = __esm(() => {
4454
4622
  CODE_EXTENSIONS = new Set([
@@ -4897,342 +5065,6 @@ var init_paths2 = __esm(() => {
4897
5065
  MINK_ROOT2 = resolveMinkRoot2();
4898
5066
  });
4899
5067
 
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
-
5236
5068
  // src/core/backup.ts
5237
5069
  var exports_backup = {};
5238
5070
  __export(exports_backup, {
@@ -5241,14 +5073,14 @@ __export(exports_backup, {
5241
5073
  createBackup: () => createBackup
5242
5074
  });
5243
5075
  import {
5244
- mkdirSync as mkdirSync9,
5076
+ mkdirSync as mkdirSync8,
5245
5077
  readdirSync as readdirSync7,
5246
5078
  readFileSync as readFileSync12,
5247
5079
  writeFileSync as writeFileSync5,
5248
- existsSync as existsSync20,
5080
+ existsSync as existsSync18,
5249
5081
  statSync as statSync7
5250
5082
  } from "fs";
5251
- import { join as join17 } from "path";
5083
+ import { join as join15 } from "path";
5252
5084
  function formatTimestamp(date) {
5253
5085
  const y = date.getFullYear();
5254
5086
  const mo = String(date.getMonth() + 1).padStart(2, "0");
@@ -5260,15 +5092,15 @@ function formatTimestamp(date) {
5260
5092
  return `${y}${mo}${d}-${h}${mi}${s}${ms}`;
5261
5093
  }
5262
5094
  function copyDirectoryFiles(srcDir, destDir, excludeDirs) {
5263
- mkdirSync9(destDir, { recursive: true });
5095
+ mkdirSync8(destDir, { recursive: true });
5264
5096
  const entries = readdirSync7(srcDir, { withFileTypes: true });
5265
5097
  for (const entry of entries) {
5266
5098
  if (entry.isDirectory()) {
5267
5099
  if (excludeDirs.includes(entry.name))
5268
5100
  continue;
5269
- copyDirectoryFiles(join17(srcDir, entry.name), join17(destDir, entry.name), excludeDirs);
5101
+ copyDirectoryFiles(join15(srcDir, entry.name), join15(destDir, entry.name), excludeDirs);
5270
5102
  } else if (entry.isFile()) {
5271
- writeFileSync5(join17(destDir, entry.name), readFileSync12(join17(srcDir, entry.name)));
5103
+ writeFileSync5(join15(destDir, entry.name), readFileSync12(join15(srcDir, entry.name)));
5272
5104
  }
5273
5105
  }
5274
5106
  }
@@ -5277,25 +5109,25 @@ function createBackup(cwd) {
5277
5109
  const dir = backupDirPath(cwd);
5278
5110
  let name = base;
5279
5111
  let suffix = 1;
5280
- while (existsSync20(join17(dir, name))) {
5112
+ while (existsSync18(join15(dir, name))) {
5281
5113
  name = `${base}-${suffix}`;
5282
5114
  suffix++;
5283
5115
  }
5284
5116
  const src = projectDir(cwd);
5285
- const dest = join17(dir, name);
5117
+ const dest = join15(dir, name);
5286
5118
  copyDirectoryFiles(src, dest, ["backups"]);
5287
5119
  return name;
5288
5120
  }
5289
5121
  function listBackups(cwd) {
5290
5122
  const dir = backupDirPath(cwd);
5291
- if (!existsSync20(dir))
5123
+ if (!existsSync18(dir))
5292
5124
  return [];
5293
5125
  const entries = readdirSync7(dir, { withFileTypes: true });
5294
5126
  const backups = [];
5295
5127
  for (const entry of entries) {
5296
5128
  if (!entry.isDirectory() || !entry.name.startsWith("backup-"))
5297
5129
  continue;
5298
- const backupPath = join17(dir, entry.name);
5130
+ const backupPath = join15(dir, entry.name);
5299
5131
  const match = entry.name.match(/^backup-(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})(\d{3})?(?:-\d+)?$/);
5300
5132
  let timestamp;
5301
5133
  if (match) {
@@ -5318,8 +5150,8 @@ function listBackups(cwd) {
5318
5150
  return backups;
5319
5151
  }
5320
5152
  function restoreBackup(cwd, backupName) {
5321
- const backupPath = join17(backupDirPath(cwd), backupName);
5322
- if (!existsSync20(backupPath)) {
5153
+ const backupPath = join15(backupDirPath(cwd), backupName);
5154
+ if (!existsSync18(backupPath)) {
5323
5155
  throw new Error(`backup not found: ${backupName}`);
5324
5156
  }
5325
5157
  createBackup(cwd);
@@ -5331,7 +5163,7 @@ var init_backup = __esm(() => {
5331
5163
 
5332
5164
  // src/core/scanner.ts
5333
5165
  import { readdirSync as readdirSync8, statSync as statSync8 } from "fs";
5334
- import { join as join18, relative } from "path";
5166
+ import { join as join16, relative } from "path";
5335
5167
  function matchesPattern(name, pattern) {
5336
5168
  if (pattern.includes("*")) {
5337
5169
  const regex = new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$");
@@ -5355,14 +5187,14 @@ function walkDirectory(dir, projectRoot, excludes, results) {
5355
5187
  if (entry.isDirectory()) {
5356
5188
  if (isExcluded(entry.name, excludes))
5357
5189
  continue;
5358
- walkDirectory(join18(dir, entry.name), projectRoot, excludes, results);
5190
+ walkDirectory(join16(dir, entry.name), projectRoot, excludes, results);
5359
5191
  continue;
5360
5192
  }
5361
5193
  if (entry.isFile()) {
5362
5194
  if (isExcluded(entry.name, excludes))
5363
5195
  continue;
5364
5196
  try {
5365
- const fullPath = join18(dir, entry.name);
5197
+ const fullPath = join16(dir, entry.name);
5366
5198
  const stat = statSync8(fullPath);
5367
5199
  results.push({
5368
5200
  relativePath: relative(projectRoot, fullPath),
@@ -5785,7 +5617,7 @@ __export(exports_scan, {
5785
5617
  });
5786
5618
  import { readFileSync as readFileSync13 } from "fs";
5787
5619
  import { createHash as createHash2 } from "crypto";
5788
- import { join as join19, relative as relative2 } from "path";
5620
+ import { join as join17, relative as relative2 } from "path";
5789
5621
  function configRelativePath(cfgPath, cwd) {
5790
5622
  const rel = relative2(cwd, cfgPath);
5791
5623
  return rel.startsWith("..") ? cfgPath : rel;
@@ -5836,7 +5668,7 @@ function scan(cwd, options) {
5836
5668
  if (!stalePaths.has(file.relativePath)) {
5837
5669
  continue;
5838
5670
  }
5839
- const fullPath = join19(cwd, file.relativePath);
5671
+ const fullPath = join17(cwd, file.relativePath);
5840
5672
  let content;
5841
5673
  try {
5842
5674
  content = readFileSync13(fullPath, "utf-8");
@@ -5925,10 +5757,10 @@ __export(exports_seed, {
5925
5757
  parseGoMod: () => parseGoMod,
5926
5758
  parseCargoToml: () => parseCargoToml
5927
5759
  });
5928
- import { basename as basename4, join as join20 } from "path";
5929
- import { readFileSync as readFileSync14, existsSync as existsSync21 } from "fs";
5760
+ import { basename as basename4, join as join18 } from "path";
5761
+ import { readFileSync as readFileSync14, existsSync as existsSync19 } from "fs";
5930
5762
  function readFile(filePath) {
5931
- if (!existsSync21(filePath))
5763
+ if (!existsSync19(filePath))
5932
5764
  return null;
5933
5765
  try {
5934
5766
  return readFileSync14(filePath, "utf-8");
@@ -6021,10 +5853,10 @@ function parseGoMod(filePath) {
6021
5853
  }
6022
5854
  function seedLearningMemory(projectRoot) {
6023
5855
  const parsers = [
6024
- () => parsePackageJson(join20(projectRoot, "package.json")),
6025
- () => parsePyprojectToml(join20(projectRoot, "pyproject.toml")),
6026
- () => parseCargoToml(join20(projectRoot, "Cargo.toml")),
6027
- () => parseGoMod(join20(projectRoot, "go.mod"))
5856
+ () => parsePackageJson(join18(projectRoot, "package.json")),
5857
+ () => parsePyprojectToml(join18(projectRoot, "pyproject.toml")),
5858
+ () => parseCargoToml(join18(projectRoot, "Cargo.toml")),
5859
+ () => parseGoMod(join18(projectRoot, "go.mod"))
6028
5860
  ];
6029
5861
  const infos = parsers.map((fn) => fn()).filter((info) => info !== null);
6030
5862
  const projectName = infos.find((i) => i.projectName)?.projectName ?? basename4(projectRoot);
@@ -6102,37 +5934,34 @@ var init_seed = __esm(() => {
6102
5934
  var exports_init = {};
6103
5935
  __export(exports_init, {
6104
5936
  writeMinkRule: () => writeMinkRule,
6105
- resolveTargetsFromFlag: () => resolveTargetsFromFlag,
6106
- resolveTargets: () => resolveTargets,
6107
5937
  resolveCliPathFrom: () => resolveCliPathFrom,
6108
5938
  resolveCliPath: () => resolveCliPath,
6109
5939
  mergeHooksIntoSettings: () => mergeHooksIntoSettings,
6110
- installClaude: () => installClaude,
6111
5940
  init: () => init,
6112
5941
  detectRuntime: () => detectRuntime,
6113
5942
  buildHooksConfig: () => buildHooksConfig
6114
5943
  });
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";
5944
+ import { execSync as execSync5 } from "child_process";
5945
+ import { mkdirSync as mkdirSync9, existsSync as existsSync20 } from "fs";
5946
+ import { resolve as resolve2, dirname as dirname7, basename as basename5, join as join19 } from "path";
6118
5947
  function detectRuntime() {
6119
5948
  try {
6120
- execSync6("bun --version", { stdio: "ignore" });
5949
+ execSync5("bun --version", { stdio: "ignore" });
6121
5950
  return "bun";
6122
5951
  } catch {
6123
5952
  return "node";
6124
5953
  }
6125
5954
  }
6126
5955
  function resolveCliPathFrom(selfPath) {
6127
- const selfDir = dirname8(selfPath);
5956
+ const selfDir = dirname7(selfPath);
6128
5957
  if (selfPath.endsWith("dist/cli.js") || selfPath.endsWith("dist/cli.bun.js") || selfPath.endsWith("dist/cli.node.js")) {
6129
- return join21(selfDir, "cli.js");
5958
+ return join19(selfDir, "cli.js");
6130
5959
  }
6131
- const packageRoot = resolve3(selfDir, "..", "..");
6132
- const distShim = join21(packageRoot, "dist", "cli.js");
6133
- if (existsSync22(distShim))
5960
+ const packageRoot = resolve2(selfDir, "..", "..");
5961
+ const distShim = join19(packageRoot, "dist", "cli.js");
5962
+ if (existsSync20(distShim))
6134
5963
  return distShim;
6135
- return join21(packageRoot, "src", "cli.ts");
5964
+ return join19(packageRoot, "src", "cli.ts");
6136
5965
  }
6137
5966
  function resolveCliPath() {
6138
5967
  return resolveCliPathFrom(new URL(import.meta.url).pathname);
@@ -6152,12 +5981,14 @@ function buildHooksConfig(cliPath) {
6152
5981
  PostToolUse: [
6153
5982
  { matcher: "Read", hooks: hook(`${prefix} post-read`) },
6154
5983
  { matcher: "Edit", hooks: hook(`${prefix} post-write`) },
6155
- { matcher: "Write", hooks: hook(`${prefix} post-write`) }
5984
+ { matcher: "Write", hooks: hook(`${prefix} post-write`) },
5985
+ { matcher: "Bash", hooks: hook(`${prefix} post-tool`) },
5986
+ { matcher: "Grep", hooks: hook(`${prefix} post-tool`) }
6156
5987
  ]
6157
5988
  };
6158
5989
  }
6159
5990
  function isMinkCommand(cmd) {
6160
- const hasMinkSubcommand = cmd.includes("session-start") || cmd.includes("session-stop") || cmd.includes("pre-read") || cmd.includes("post-read") || cmd.includes("pre-write") || cmd.includes("post-write");
5991
+ const hasMinkSubcommand = cmd.includes("session-start") || cmd.includes("session-stop") || cmd.includes("pre-read") || cmd.includes("post-read") || cmd.includes("pre-write") || cmd.includes("post-write") || cmd.includes("post-tool");
6161
5992
  if (!hasMinkSubcommand)
6162
5993
  return false;
6163
5994
  if (/(^|\/|\s)mink\s/.test(cmd))
@@ -6174,13 +6005,13 @@ function isMinkHook(entry) {
6174
6005
  return false;
6175
6006
  }
6176
6007
  function writeMinkRule(cwd) {
6177
- const rulePath = resolve3(cwd, ".claude", "rules", "mink.md");
6178
- mkdirSync10(dirname8(rulePath), { recursive: true });
6008
+ const rulePath = resolve2(cwd, ".claude", "rules", "mink.md");
6009
+ mkdirSync9(dirname7(rulePath), { recursive: true });
6179
6010
  atomicWriteText(rulePath, MINK_RULE_CONTENT);
6180
6011
  return rulePath;
6181
6012
  }
6182
6013
  function mergeHooksIntoSettings(settingsPath, newHooks) {
6183
- mkdirSync10(dirname8(settingsPath), { recursive: true });
6014
+ mkdirSync9(dirname7(settingsPath), { recursive: true });
6184
6015
  const existing = safeReadJson(settingsPath) ?? {};
6185
6016
  const existingHooks = existing.hooks ?? {};
6186
6017
  for (const [event, entries] of Object.entries(newHooks)) {
@@ -6191,46 +6022,17 @@ function mergeHooksIntoSettings(settingsPath, newHooks) {
6191
6022
  existing.hooks = existingHooks;
6192
6023
  atomicWriteJson(settingsPath, existing);
6193
6024
  }
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
- }
6225
6025
  function isExistingInstallation(cwd) {
6226
6026
  const dir = projectDir(cwd);
6227
- if (!existsSync22(dir))
6027
+ if (!existsSync20(dir))
6228
6028
  return false;
6229
- return existsSync22(join21(dir, "file-index.json"));
6029
+ return existsSync20(join19(dir, "file-index.json"));
6230
6030
  }
6231
- async function init(cwd, opts = {}) {
6031
+ async function init(cwd) {
6232
6032
  const runtime = detectRuntime();
6233
6033
  const cliPath = resolveCliPath();
6034
+ const hooks = buildHooksConfig(cliPath);
6035
+ const settingsPath = resolve2(cwd, ".claude", "settings.json");
6234
6036
  const dir = projectDir(cwd);
6235
6037
  const upgrading = isExistingInstallation(cwd);
6236
6038
  if (upgrading) {
@@ -6239,22 +6041,9 @@ async function init(cwd, opts = {}) {
6239
6041
  const backupName = createBackup2(cwd);
6240
6042
  console.log(` backup: ${backupName}`);
6241
6043
  }
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 });
6044
+ mergeHooksIntoSettings(settingsPath, hooks);
6045
+ const rulePath = writeMinkRule(cwd);
6046
+ mkdirSync9(dir, { recursive: true });
6258
6047
  const identity = resolveProjectIdentity(cwd);
6259
6048
  const projectId = identity.id;
6260
6049
  const isNotesProject = isWikiEnabled() && isVaultInitialized() && isInsideVault(cwd);
@@ -6262,8 +6051,6 @@ async function init(cwd, opts = {}) {
6262
6051
  const existingMeta = safeReadJson(metaPath);
6263
6052
  const deviceId = getOrCreateDeviceId();
6264
6053
  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]));
6267
6054
  atomicWriteJson(metaPath, {
6268
6055
  ...existingMeta ?? {},
6269
6056
  cwd,
@@ -6271,29 +6058,20 @@ async function init(cwd, opts = {}) {
6271
6058
  initTimestamp: existingMeta?.initTimestamp ?? new Date().toISOString(),
6272
6059
  version: "0.1.0",
6273
6060
  pathsByDevice: { ...existingPathsByDevice, [deviceId]: cwd },
6274
- agents,
6275
6061
  ...isNotesProject ? { projectType: "notes" } : {}
6276
6062
  });
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
- };
6285
6063
  if (upgrading) {
6286
6064
  console.log(`[mink] upgrade complete`);
6287
6065
  console.log(` project: ${projectId}`);
6288
- console.log(` agents: ${agents.join(", ")}`);
6289
- printWiring();
6066
+ console.log(` hooks: ${settingsPath}`);
6067
+ console.log(` rule: ${rulePath}`);
6290
6068
  } else {
6291
6069
  console.log(`[mink] initialized`);
6292
6070
  console.log(` project: ${projectId} (${identity.source})`);
6293
6071
  console.log(` state: ${dir}`);
6294
6072
  console.log(` runtime: ${runtime}`);
6295
- console.log(` agents: ${agents.join(", ")}`);
6296
- printWiring();
6073
+ console.log(` hooks: ${settingsPath}`);
6074
+ console.log(` rule: ${rulePath}`);
6297
6075
  }
6298
6076
  if (identity.source === "path-derived") {
6299
6077
  const root = getRepoRoot(cwd);
@@ -6305,7 +6083,7 @@ async function init(cwd, opts = {}) {
6305
6083
  scan2(cwd, { check: false });
6306
6084
  const { learningMemoryPath: learningMemoryPath3 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
6307
6085
  const memPath = learningMemoryPath3(cwd);
6308
- if (!existsSync22(memPath)) {
6086
+ if (!existsSync20(memPath)) {
6309
6087
  const { seedLearningMemory: seedLearningMemory2 } = await Promise.resolve().then(() => (init_seed(), exports_seed));
6310
6088
  const { serializeLearningMemory: serializeLearningMemory2 } = await Promise.resolve().then(() => (init_learning_memory(), exports_learning_memory));
6311
6089
  const mem = seedLearningMemory2(cwd);
@@ -6314,8 +6092,8 @@ async function init(cwd, opts = {}) {
6314
6092
  if (isWikiEnabled() && isVaultInitialized() && !isNotesProject) {
6315
6093
  try {
6316
6094
  const projectSlug = basename5(cwd);
6317
- const overviewPath = join21(vaultProjects(projectSlug), "overview.md");
6318
- if (!existsSync22(overviewPath)) {
6095
+ const overviewPath = join19(vaultProjects(projectSlug), "overview.md");
6096
+ if (!existsSync20(overviewPath)) {
6319
6097
  const now = new Date().toISOString();
6320
6098
  const overview = [
6321
6099
  `---`,
@@ -6367,9 +6145,6 @@ var init_init = __esm(() => {
6367
6145
  init_device();
6368
6146
  init_git_identity();
6369
6147
  init_vault();
6370
- init_agent_detect();
6371
- init_agent_pi();
6372
- init_prompt();
6373
6148
  });
6374
6149
 
6375
6150
  // src/repositories/counters-repo.ts
@@ -6444,12 +6219,12 @@ var init_state_counters = __esm(() => {
6444
6219
  });
6445
6220
 
6446
6221
  // src/core/channel-templates.ts
6447
- import { join as join22 } from "path";
6448
- import { existsSync as existsSync23, writeFileSync as writeFileSync6, mkdirSync as mkdirSync11 } from "fs";
6222
+ import { join as join20 } from "path";
6223
+ import { existsSync as existsSync21, writeFileSync as writeFileSync6, mkdirSync as mkdirSync10 } from "fs";
6449
6224
  function writeCompanionClaudeMd(vaultPath, overwrite = false) {
6450
- mkdirSync11(vaultPath, { recursive: true });
6451
- const claudeMdPath = join22(vaultPath, "CLAUDE.md");
6452
- if (existsSync23(claudeMdPath) && !overwrite) {
6225
+ mkdirSync10(vaultPath, { recursive: true });
6226
+ const claudeMdPath = join20(vaultPath, "CLAUDE.md");
6227
+ if (existsSync21(claudeMdPath) && !overwrite) {
6453
6228
  return false;
6454
6229
  }
6455
6230
  writeFileSync6(claudeMdPath, COMPANION_CLAUDE_MD);
@@ -6601,8 +6376,8 @@ mink wiki rebuild-index
6601
6376
  var init_channel_templates = () => {};
6602
6377
 
6603
6378
  // src/core/channel-process.ts
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";
6379
+ import { readFileSync as readFileSync15, writeFileSync as writeFileSync7, unlinkSync as unlinkSync3, mkdirSync as mkdirSync11, existsSync as existsSync22 } from "fs";
6380
+ import { dirname as dirname8, join as join21 } from "path";
6606
6381
  import { spawnSync } from "child_process";
6607
6382
  function readChannelPidFile() {
6608
6383
  try {
@@ -6618,7 +6393,7 @@ function readChannelPidFile() {
6618
6393
  }
6619
6394
  function writeChannelPidFile(data) {
6620
6395
  const pidPath = channelPidPath();
6621
- mkdirSync12(dirname9(pidPath), { recursive: true });
6396
+ mkdirSync11(dirname8(pidPath), { recursive: true });
6622
6397
  writeFileSync7(pidPath, JSON.stringify(data, null, 2));
6623
6398
  }
6624
6399
  function removeChannelPidFile() {
@@ -6748,12 +6523,12 @@ function getChannelLogs() {
6748
6523
  return null;
6749
6524
  if (!screenSessionExists(pidData.session))
6750
6525
  return null;
6751
- const tmpPath = join23(minkRoot(), `.channel-capture-${Date.now()}-${process.pid}.txt`);
6526
+ const tmpPath = join21(minkRoot(), `.channel-capture-${Date.now()}-${process.pid}.txt`);
6752
6527
  const result = spawnSync("screen", ["-S", pidData.session, "-X", "hardcopy", "-h", tmpPath], { stdio: "ignore" });
6753
6528
  if (result.status !== 0)
6754
6529
  return null;
6755
6530
  for (let i = 0;i < 20; i++) {
6756
- if (existsSync24(tmpPath))
6531
+ if (existsSync22(tmpPath))
6757
6532
  break;
6758
6533
  const delayUntil = Date.now() + 50;
6759
6534
  while (Date.now() < delayUntil) {}
@@ -6857,7 +6632,7 @@ async function runtimeServe(opts) {
6857
6632
  }
6858
6633
  const { createServer } = await import("node:http");
6859
6634
  const { Readable } = await import("node:stream");
6860
- return new Promise((resolve4) => {
6635
+ return new Promise((resolve3) => {
6861
6636
  const httpServer = createServer(async (req, res) => {
6862
6637
  const url = `http://${opts.hostname}:${opts.port}${req.url ?? "/"}`;
6863
6638
  const headers = new Headers;
@@ -6916,7 +6691,7 @@ async function runtimeServe(opts) {
6916
6691
  httpServer.listen(opts.port, opts.hostname, () => {
6917
6692
  const addr = httpServer.address();
6918
6693
  const boundPort = typeof addr === "object" && addr ? addr.port : opts.port;
6919
- resolve4({
6694
+ resolve3({
6920
6695
  port: boundPort,
6921
6696
  stop: (close) => {
6922
6697
  if (close)
@@ -6934,8 +6709,8 @@ var init_runtime = __esm(() => {
6934
6709
 
6935
6710
  // src/core/daemon.ts
6936
6711
  import { readFileSync as readFileSync16, writeFileSync as writeFileSync8, unlinkSync as unlinkSync4, openSync } from "fs";
6937
- import { mkdirSync as mkdirSync13 } from "fs";
6938
- import { dirname as dirname10, resolve as resolve4 } from "path";
6712
+ import { mkdirSync as mkdirSync12 } from "fs";
6713
+ import { dirname as dirname9, resolve as resolve3 } from "path";
6939
6714
  function readPidFile() {
6940
6715
  try {
6941
6716
  const raw = readFileSync16(schedulerPidPath(), "utf-8");
@@ -6950,7 +6725,7 @@ function readPidFile() {
6950
6725
  }
6951
6726
  function writePidFile(data) {
6952
6727
  const pidPath = schedulerPidPath();
6953
- mkdirSync13(dirname10(pidPath), { recursive: true });
6728
+ mkdirSync12(dirname9(pidPath), { recursive: true });
6954
6729
  writeFileSync8(pidPath, JSON.stringify(data, null, 2));
6955
6730
  }
6956
6731
  function removePidFile() {
@@ -6975,10 +6750,10 @@ function startDaemon(cwd) {
6975
6750
  if (existing) {
6976
6751
  removePidFile();
6977
6752
  }
6978
- const __dir = dirname10(new URL(import.meta.url).pathname);
6979
- const cliPath = process.argv[1] ?? resolve4(__dir, "../cli.ts");
6753
+ const __dir = dirname9(new URL(import.meta.url).pathname);
6754
+ const cliPath = process.argv[1] ?? resolve3(__dir, "../cli.ts");
6980
6755
  const logPath = schedulerLogPath();
6981
- mkdirSync13(dirname10(logPath), { recursive: true });
6756
+ mkdirSync12(dirname9(logPath), { recursive: true });
6982
6757
  const logFd = openSync(logPath, "a");
6983
6758
  const proc = runtimeSpawn(["bun", "run", cliPath, "cron", "__daemon"], {
6984
6759
  cwd,
@@ -7092,9 +6867,9 @@ var exports_status = {};
7092
6867
  __export(exports_status, {
7093
6868
  status: () => status
7094
6869
  });
7095
- import { existsSync as existsSync26, readFileSync as readFileSync17, statSync as statSync9 } from "fs";
6870
+ import { existsSync as existsSync24, readFileSync as readFileSync17, statSync as statSync9 } from "fs";
7096
6871
  function checkJsonFile(name, filePath, validator) {
7097
- if (!existsSync26(filePath))
6872
+ if (!existsSync24(filePath))
7098
6873
  return { name, path: filePath, status: "missing" };
7099
6874
  const data = safeReadJson(filePath);
7100
6875
  if (data === null)
@@ -7104,7 +6879,7 @@ function checkJsonFile(name, filePath, validator) {
7104
6879
  return { name, path: filePath, status: "ok" };
7105
6880
  }
7106
6881
  function checkDbFile(name, filePath) {
7107
- if (!existsSync26(filePath))
6882
+ if (!existsSync24(filePath))
7108
6883
  return { name, path: filePath, status: "missing" };
7109
6884
  try {
7110
6885
  const header = readFileSync17(filePath).slice(0, 16).toString("utf-8");
@@ -7119,7 +6894,7 @@ function checkDbFile(name, filePath) {
7119
6894
  function checkShardedText(name, candidatePaths) {
7120
6895
  const canonical = candidatePaths[0];
7121
6896
  for (const p of candidatePaths) {
7122
- if (!existsSync26(p))
6897
+ if (!existsSync24(p))
7123
6898
  continue;
7124
6899
  try {
7125
6900
  if (statSync9(p).size === 0)
@@ -7212,7 +6987,7 @@ function status(cwd) {
7212
6987
  console.log(` Decision Log: ${mem.sections["Decision Log"].length}`);
7213
6988
  console.log(` Total entries: ${total}`);
7214
6989
  const memPath = learningMemoryPath(cwd);
7215
- if (existsSync26(memPath)) {
6990
+ if (existsSync24(memPath)) {
7216
6991
  const mtime = statSync9(memPath).mtime;
7217
6992
  console.log(` Canonical last modified: ${mtime.toISOString()}`);
7218
6993
  }
@@ -7261,7 +7036,7 @@ __export(exports_scan2, {
7261
7036
  });
7262
7037
  import { readFileSync as readFileSync18 } from "fs";
7263
7038
  import { createHash as createHash3 } from "crypto";
7264
- import { join as join24, relative as relative3 } from "path";
7039
+ import { join as join22, relative as relative3 } from "path";
7265
7040
  function configRelativePath2(cfgPath, cwd) {
7266
7041
  const rel = relative3(cwd, cfgPath);
7267
7042
  return rel.startsWith("..") ? cfgPath : rel;
@@ -7312,7 +7087,7 @@ function scan2(cwd, options) {
7312
7087
  if (!stalePaths.has(file.relativePath)) {
7313
7088
  continue;
7314
7089
  }
7315
- const fullPath = join24(cwd, file.relativePath);
7090
+ const fullPath = join22(cwd, file.relativePath);
7316
7091
  let content;
7317
7092
  try {
7318
7093
  content = readFileSync18(fullPath, "utf-8");
@@ -7397,12 +7172,12 @@ var exports_reflect2 = {};
7397
7172
  __export(exports_reflect2, {
7398
7173
  reflect: () => reflect2
7399
7174
  });
7400
- import { existsSync as existsSync27 } from "fs";
7401
- import { dirname as dirname11 } from "path";
7175
+ import { existsSync as existsSync25 } from "fs";
7176
+ import { dirname as dirname10 } from "path";
7402
7177
  function reflect2(_cwd, memoryPath, configPath3) {
7403
- const projDir = dirname11(memoryPath);
7178
+ const projDir = dirname10(memoryPath);
7404
7179
  const mem = aggregateLearningMemoryAt(projDir);
7405
- if (totalEntryCount(mem) === 0 && !existsSync27(memoryPath)) {
7180
+ if (totalEntryCount(mem) === 0 && !existsSync25(memoryPath)) {
7406
7181
  console.log("[mink] no learning memory found");
7407
7182
  return null;
7408
7183
  }
@@ -7516,6 +7291,488 @@ var init_pre_read = __esm(() => {
7516
7291
  init_counters_repo();
7517
7292
  });
7518
7293
 
7294
+ // src/core/compression.ts
7295
+ function numberValue(key, fallback, min, max) {
7296
+ const raw = resolveConfigValue(key).value;
7297
+ const n = Number(raw);
7298
+ if (!Number.isFinite(n))
7299
+ return fallback;
7300
+ return Math.min(max, Math.max(min, n));
7301
+ }
7302
+ function loadCompressionConfig() {
7303
+ return {
7304
+ enabled: resolveConfigValue("compression.enabled").value === "true",
7305
+ thresholdTokens: numberValue("compression.threshold-tokens", 800, 0, Number.MAX_SAFE_INTEGER),
7306
+ minSavingsRatio: numberValue("compression.min-savings-ratio", 0.25, 0, 1),
7307
+ holdoutFraction: numberValue("compression.holdout-fraction", 0.1, 0, 1),
7308
+ retentionHours: numberValue("compression.retention-hours", 168, 0, Number.MAX_SAFE_INTEGER)
7309
+ };
7310
+ }
7311
+ function isEligible(originalTokens, config) {
7312
+ return config.enabled && originalTokens >= config.thresholdTokens;
7313
+ }
7314
+ function meetsMinSavings(originalTokens, compressedTokens, config) {
7315
+ if (originalTokens <= 0)
7316
+ return false;
7317
+ const ratio = (originalTokens - compressedTokens) / originalTokens;
7318
+ return ratio >= config.minSavingsRatio;
7319
+ }
7320
+ function hashUnitInterval(key) {
7321
+ let h = 2166136261;
7322
+ for (let i = 0;i < key.length; i++) {
7323
+ h ^= key.charCodeAt(i);
7324
+ h = Math.imul(h, 16777619);
7325
+ }
7326
+ return (h >>> 0) / 4294967296;
7327
+ }
7328
+ function selectHoldout(eventKey, fraction) {
7329
+ if (fraction <= 0)
7330
+ return false;
7331
+ if (fraction >= 1)
7332
+ return true;
7333
+ return hashUnitInterval(eventKey) < fraction;
7334
+ }
7335
+ var init_compression = __esm(() => {
7336
+ init_global_config();
7337
+ });
7338
+
7339
+ // src/core/code-skeleton.ts
7340
+ function countChar(s, c) {
7341
+ let n = 0;
7342
+ for (let i = 0;i < s.length; i++)
7343
+ if (s[i] === c)
7344
+ n++;
7345
+ return n;
7346
+ }
7347
+ function netBraces(line) {
7348
+ let s = line.replace(/\/\/.*$/, "");
7349
+ s = s.replace(/\/\*.*?\*\//g, "");
7350
+ s = s.replace(/"(?:\\.|[^"\\])*"/g, '""');
7351
+ s = s.replace(/'(?:\\.|[^'\\])*'/g, "''");
7352
+ s = s.replace(/`(?:\\.|[^`\\])*`/g, "``");
7353
+ return countChar(s, "{") - countChar(s, "}");
7354
+ }
7355
+ function stripOpenBrace(sig) {
7356
+ return sig.replace(/\{\s*$/, "").trimEnd();
7357
+ }
7358
+ function extractCodeSkeleton(content, opts = {}) {
7359
+ const rawLines = content.split(`
7360
+ `);
7361
+ const totalLines = rawLines.length > 0 && rawLines[rawLines.length - 1] === "" ? rawLines.length - 1 : rawLines.length;
7362
+ const out = [];
7363
+ let depth = 0;
7364
+ let suppress = Infinity;
7365
+ for (const line of rawLines) {
7366
+ if (out.length >= MAX_SIGNATURES)
7367
+ break;
7368
+ const start = depth;
7369
+ const net = netBraces(line);
7370
+ if (start < suppress) {
7371
+ const isHeading = opts.markdown === true && HEADING.test(line);
7372
+ const captured = isHeading || DECL_ALWAYS.test(line) || DECL_EXPORTED_VAR.test(line) || start >= 1 && MEMBER.test(line);
7373
+ if (captured) {
7374
+ const sig = line.trim();
7375
+ if (net > 0) {
7376
+ if (DESCEND.test(line) && !isHeading) {
7377
+ out.push(INDENT.repeat(start) + stripOpenBrace(sig) + " {");
7378
+ } else {
7379
+ out.push(INDENT.repeat(start) + stripOpenBrace(sig) + " { … }");
7380
+ suppress = start + 1;
7381
+ }
7382
+ } else {
7383
+ out.push(INDENT.repeat(start) + sig);
7384
+ }
7385
+ }
7386
+ }
7387
+ depth = Math.max(0, depth + net);
7388
+ if (depth < suppress)
7389
+ suppress = Infinity;
7390
+ }
7391
+ if (out.length === 0)
7392
+ return null;
7393
+ return { lines: out, totalLines };
7394
+ }
7395
+ var MAX_SIGNATURES = 80, INDENT = " ", DECL_ALWAYS, DECL_EXPORTED_VAR, MEMBER, HEADING, DESCEND;
7396
+ var init_code_skeleton = __esm(() => {
7397
+ DECL_ALWAYS = /^\s*(?:export\s+)?(?:default\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|interface|type|enum|namespace|module|def|fn|func|impl|struct|trait)\b/;
7398
+ DECL_EXPORTED_VAR = /^\s*export\s+(?:default\s+)?(?:const|let|var)\b/;
7399
+ MEMBER = /^\s*(?:public\s+|private\s+|protected\s+|readonly\s+|static\s+|async\s+|get\s+|set\s+|#)*[\w$]+\??\s*(?:\(|:|=)/;
7400
+ HEADING = /^#{1,6}\s+\S/;
7401
+ DESCEND = /\b(?:class|interface|enum|namespace|module|struct|trait|impl)\b/;
7402
+ });
7403
+
7404
+ // src/core/output-compression.ts
7405
+ function stripAnsi(s) {
7406
+ return s.replace(ANSI, "");
7407
+ }
7408
+ function omittedMarker(n) {
7409
+ return ` … ${n} line${n === 1 ? "" : "s"} omitted — mink retrieve …`;
7410
+ }
7411
+ function toLines(content) {
7412
+ const lines = content.split(`
7413
+ `);
7414
+ if (lines.length > 0 && lines[lines.length - 1] === "")
7415
+ lines.pop();
7416
+ return lines;
7417
+ }
7418
+ function compressLog(content) {
7419
+ const lines = toLines(stripAnsi(content));
7420
+ const collapsed = [];
7421
+ let i = 0;
7422
+ while (i < lines.length) {
7423
+ let run = 1;
7424
+ while (i + run < lines.length && lines[i + run] === lines[i])
7425
+ run++;
7426
+ collapsed.push(run > 1 ? `${lines[i]} (×${run})` : lines[i]);
7427
+ i += run;
7428
+ }
7429
+ if (collapsed.length <= LOG_HEAD + LOG_TAIL) {
7430
+ if (collapsed.length === lines.length)
7431
+ return null;
7432
+ return {
7433
+ compressed: collapsed.join(`
7434
+ `),
7435
+ omittedNote: `collapsed ${lines.length - collapsed.length} repeated line(s)`
7436
+ };
7437
+ }
7438
+ const omitted = collapsed.length - LOG_HEAD - LOG_TAIL;
7439
+ const head = collapsed.slice(0, LOG_HEAD);
7440
+ const tail = collapsed.slice(collapsed.length - LOG_TAIL);
7441
+ return {
7442
+ compressed: [...head, omittedMarker(omitted), ...tail].join(`
7443
+ `),
7444
+ omittedNote: `${omitted} of ${collapsed.length} log line(s) omitted (middle)`
7445
+ };
7446
+ }
7447
+ function compressSearch(content) {
7448
+ const lines = toLines(content);
7449
+ const seen = new Set;
7450
+ const perFile = new Map;
7451
+ const omittedByFile = new Map;
7452
+ const out = [];
7453
+ for (const line of lines) {
7454
+ if (seen.has(line))
7455
+ continue;
7456
+ seen.add(line);
7457
+ const colon = line.indexOf(":");
7458
+ const file = colon > 0 ? line.slice(0, colon) : line;
7459
+ const count = perFile.get(file) ?? 0;
7460
+ if (count < SEARCH_MAX_PER_FILE) {
7461
+ perFile.set(file, count + 1);
7462
+ out.push(line);
7463
+ } else {
7464
+ omittedByFile.set(file, (omittedByFile.get(file) ?? 0) + 1);
7465
+ }
7466
+ }
7467
+ let totalOmitted = 0;
7468
+ for (const [file, n] of omittedByFile) {
7469
+ totalOmitted += n;
7470
+ out.push(` … +${n} more match(es) in ${file} — mink retrieve …`);
7471
+ }
7472
+ const dedupRemoved = lines.length - seen.size;
7473
+ if (totalOmitted === 0 && dedupRemoved === 0)
7474
+ return null;
7475
+ const notes = [];
7476
+ if (totalOmitted > 0)
7477
+ notes.push(`${totalOmitted} match(es) capped`);
7478
+ if (dedupRemoved > 0)
7479
+ notes.push(`${dedupRemoved} duplicate(s) removed`);
7480
+ return { compressed: out.join(`
7481
+ `), omittedNote: notes.join("; ") };
7482
+ }
7483
+ function compressFile(filePath, content) {
7484
+ const ext = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
7485
+ const markdown = ext === ".md" || ext === ".mdx" || ext === ".markdown";
7486
+ const skeleton = extractCodeSkeleton(content, { markdown });
7487
+ if (!skeleton) {
7488
+ return compressText(content);
7489
+ }
7490
+ const header = `${filePath} — structural summary ` + `(${skeleton.lines.length} signature(s) of ${skeleton.totalLines} lines)`;
7491
+ return {
7492
+ compressed: [header, ...skeleton.lines].join(`
7493
+ `),
7494
+ omittedNote: `bodies elided; ${skeleton.totalLines} lines available via mink retrieve`
7495
+ };
7496
+ }
7497
+ function crush(value) {
7498
+ if (Array.isArray(value)) {
7499
+ let omitted = 0;
7500
+ const mapEl = (el) => {
7501
+ const r = crush(el);
7502
+ omitted += r.omitted;
7503
+ return r.value;
7504
+ };
7505
+ if (value.length <= JSON_ARRAY_HEAD + JSON_ARRAY_TAIL) {
7506
+ return { value: value.map(mapEl), omitted };
7507
+ }
7508
+ const dropped = value.length - JSON_ARRAY_HEAD - JSON_ARRAY_TAIL;
7509
+ omitted += dropped;
7510
+ const out = [
7511
+ ...value.slice(0, JSON_ARRAY_HEAD).map(mapEl),
7512
+ `… ${dropped} element(s) omitted — mink retrieve …`,
7513
+ ...value.slice(value.length - JSON_ARRAY_TAIL).map(mapEl)
7514
+ ];
7515
+ return { value: out, omitted };
7516
+ }
7517
+ if (value && typeof value === "object") {
7518
+ let omitted = 0;
7519
+ const out = {};
7520
+ for (const [k, v] of Object.entries(value)) {
7521
+ const r = crush(v);
7522
+ omitted += r.omitted;
7523
+ out[k] = r.value;
7524
+ }
7525
+ return { value: out, omitted };
7526
+ }
7527
+ return { value, omitted: 0 };
7528
+ }
7529
+ function compressJson(content) {
7530
+ let parsed;
7531
+ try {
7532
+ parsed = JSON.parse(content);
7533
+ } catch {
7534
+ return null;
7535
+ }
7536
+ const { value, omitted } = crush(parsed);
7537
+ if (omitted === 0)
7538
+ return null;
7539
+ return {
7540
+ compressed: JSON.stringify(value, null, 2),
7541
+ omittedNote: `${omitted} array element(s) sampled out`
7542
+ };
7543
+ }
7544
+ function compressText(content) {
7545
+ const lines = toLines(content);
7546
+ if (lines.length <= TEXT_HEAD + TEXT_TAIL)
7547
+ return null;
7548
+ const omitted = lines.length - TEXT_HEAD - TEXT_TAIL;
7549
+ const head = lines.slice(0, TEXT_HEAD);
7550
+ const tail = lines.slice(lines.length - TEXT_TAIL);
7551
+ return {
7552
+ compressed: [...head, omittedMarker(omitted), ...tail].join(`
7553
+ `),
7554
+ omittedNote: `${omitted} of ${lines.length} line(s) omitted (middle)`
7555
+ };
7556
+ }
7557
+ function detectContentKind(toolName, content, filePath) {
7558
+ const t = toolName.toLowerCase();
7559
+ if (t === "read")
7560
+ return "file";
7561
+ if (t === "grep" || t === "glob")
7562
+ return "search";
7563
+ if (t === "bash")
7564
+ return "log";
7565
+ const head = content.trimStart()[0];
7566
+ if (head === "{" || head === "[") {
7567
+ try {
7568
+ JSON.parse(content);
7569
+ return "json";
7570
+ } catch {}
7571
+ }
7572
+ if (filePath)
7573
+ return "file";
7574
+ return "text";
7575
+ }
7576
+ function compressOutput(toolName, content, filePath) {
7577
+ const kind = detectContentKind(toolName, content, filePath);
7578
+ let result;
7579
+ switch (kind) {
7580
+ case "search":
7581
+ result = compressSearch(content);
7582
+ break;
7583
+ case "log":
7584
+ result = compressLog(content);
7585
+ break;
7586
+ case "file":
7587
+ result = compressFile(filePath ?? "file", content);
7588
+ break;
7589
+ case "json":
7590
+ result = compressJson(content);
7591
+ break;
7592
+ case "text":
7593
+ result = compressText(content);
7594
+ break;
7595
+ }
7596
+ if (!result)
7597
+ return null;
7598
+ return { kind, compressed: result.compressed, omittedNote: result.omittedNote };
7599
+ }
7600
+ var SEARCH_MAX_PER_FILE = 5, LOG_HEAD = 40, LOG_TAIL = 40, TEXT_HEAD = 30, TEXT_TAIL = 20, JSON_ARRAY_HEAD = 20, JSON_ARRAY_TAIL = 5, ANSI;
7601
+ var init_output_compression = __esm(() => {
7602
+ init_code_skeleton();
7603
+ ANSI = /\[[0-9;?]*[ -/]*[@-~]/g;
7604
+ });
7605
+
7606
+ // src/repositories/compression-cache-repo.ts
7607
+ import { randomUUID as randomUUID3 } from "crypto";
7608
+
7609
+ class CompressionCacheRepo {
7610
+ db;
7611
+ constructor(db) {
7612
+ this.db = db;
7613
+ }
7614
+ static for(cwd) {
7615
+ return new CompressionCacheRepo(openProjectDb(cwd));
7616
+ }
7617
+ static newToken() {
7618
+ return `mc-${randomUUID3().slice(0, 8)}`;
7619
+ }
7620
+ store(input, deviceId = getOrCreateDeviceId()) {
7621
+ const token = input.token ?? CompressionCacheRepo.newToken();
7622
+ const now = input.now ?? new Date;
7623
+ const createdAt = now.toISOString();
7624
+ const expiresAt = new Date(now.getTime() + Math.max(0, input.retentionHours) * 3600000).toISOString();
7625
+ this.db.prepare(`
7626
+ INSERT OR REPLACE INTO compression_cache
7627
+ (token, created_at, expires_at, tool_name, content_kind,
7628
+ content, size_bytes, device_id)
7629
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
7630
+ `).run(token, createdAt, expiresAt, input.toolName, input.contentKind, input.content, Buffer.byteLength(input.content, "utf-8"), deviceId);
7631
+ return token;
7632
+ }
7633
+ get(token, now = new Date) {
7634
+ const row = this.db.prepare("SELECT * FROM compression_cache WHERE token = ?").get(token);
7635
+ if (!row)
7636
+ return null;
7637
+ const expiresAt = String(row.expires_at);
7638
+ if (expiresAt <= now.toISOString()) {
7639
+ try {
7640
+ this.db.prepare("DELETE FROM compression_cache WHERE token = ?").run(token);
7641
+ } catch {}
7642
+ return null;
7643
+ }
7644
+ return {
7645
+ token: String(row.token),
7646
+ createdAt: String(row.created_at),
7647
+ expiresAt,
7648
+ toolName: String(row.tool_name),
7649
+ contentKind: String(row.content_kind),
7650
+ content: String(row.content),
7651
+ sizeBytes: Number(row.size_bytes)
7652
+ };
7653
+ }
7654
+ evictExpired(now = new Date) {
7655
+ const r = this.db.prepare("DELETE FROM compression_cache WHERE expires_at <= ?").run(now.toISOString());
7656
+ return Number(r.changes);
7657
+ }
7658
+ count() {
7659
+ const row = this.db.prepare("SELECT COUNT(*) AS n FROM compression_cache").get();
7660
+ return Number(row.n);
7661
+ }
7662
+ }
7663
+ var init_compression_cache_repo = __esm(() => {
7664
+ init_db();
7665
+ init_device();
7666
+ });
7667
+
7668
+ // src/core/compress-tool-output.ts
7669
+ function contentKey(s) {
7670
+ let h = 2166136261;
7671
+ for (let i = 0;i < s.length; i++) {
7672
+ h ^= s.charCodeAt(i);
7673
+ h = Math.imul(h, 16777619);
7674
+ }
7675
+ return (h >>> 0).toString(16);
7676
+ }
7677
+ function render(result, token) {
7678
+ return result.compressed + `
7679
+
7680
+ ` + `— mink: compressed ${result.kind} output (${result.omittedNote}). ` + `Full original: mink retrieve ${token}`;
7681
+ }
7682
+ function safeRecord(cwd, toolName, contentKind, originalTokens, compressedTokens, holdout) {
7683
+ try {
7684
+ TokenLedgerRepo.for(cwd).recordCompression({
7685
+ toolName,
7686
+ contentKind,
7687
+ originalTokens,
7688
+ compressedTokens,
7689
+ holdout
7690
+ });
7691
+ } catch {}
7692
+ }
7693
+ function compressToolOutput(cwd, toolName, output, filePath) {
7694
+ let cfg;
7695
+ try {
7696
+ cfg = loadCompressionConfig();
7697
+ } catch {
7698
+ return null;
7699
+ }
7700
+ if (!cfg.enabled)
7701
+ return null;
7702
+ if (typeof output !== "string" || output.length === 0)
7703
+ return null;
7704
+ const originalTokens = countTokens(output);
7705
+ if (!isEligible(originalTokens, cfg))
7706
+ return null;
7707
+ const eventKey = contentKey(output);
7708
+ if (selectHoldout(eventKey, cfg.holdoutFraction)) {
7709
+ const kind = detectContentKind(toolName, output, filePath);
7710
+ safeRecord(cwd, toolName, kind, originalTokens, originalTokens, true);
7711
+ return null;
7712
+ }
7713
+ const result = compressOutput(toolName, output, filePath);
7714
+ if (!result)
7715
+ return null;
7716
+ const token = CompressionCacheRepo.newToken();
7717
+ const replacement = render(result, token);
7718
+ const compressedTokens = countTokens(replacement);
7719
+ if (!meetsMinSavings(originalTokens, compressedTokens, cfg))
7720
+ return null;
7721
+ try {
7722
+ CompressionCacheRepo.for(cwd).store({
7723
+ toolName,
7724
+ contentKind: result.kind,
7725
+ content: output,
7726
+ retentionHours: cfg.retentionHours,
7727
+ token
7728
+ });
7729
+ } catch {
7730
+ return null;
7731
+ }
7732
+ safeRecord(cwd, toolName, result.kind, originalTokens, compressedTokens, false);
7733
+ return { updatedToolOutput: replacement, token };
7734
+ }
7735
+ var init_compress_tool_output = __esm(() => {
7736
+ init_compression();
7737
+ init_token_estimate();
7738
+ init_output_compression();
7739
+ init_compression_cache_repo();
7740
+ init_token_ledger_repo();
7741
+ });
7742
+
7743
+ // src/core/hook-output.ts
7744
+ function extractToolOutputText(input) {
7745
+ const tr = input.tool_response;
7746
+ if (tr) {
7747
+ if (typeof tr.content === "string")
7748
+ return tr.content;
7749
+ if (Array.isArray(tr.content)) {
7750
+ const parts = tr.content.map((p) => p && typeof p.text === "string" ? p.text : "").filter((s) => s.length > 0);
7751
+ if (parts.length > 0)
7752
+ return parts.join("");
7753
+ }
7754
+ if (typeof tr.stdout === "string" && tr.stdout.length > 0)
7755
+ return tr.stdout;
7756
+ if (typeof tr.text === "string")
7757
+ return tr.text;
7758
+ const file = tr.file;
7759
+ if (file && typeof file.content === "string")
7760
+ return file.content;
7761
+ }
7762
+ const to = input.tool_output;
7763
+ if (to && typeof to.content === "string")
7764
+ return to.content;
7765
+ return null;
7766
+ }
7767
+ function emitUpdatedToolOutput(text) {
7768
+ process.stdout.write(JSON.stringify({
7769
+ hookSpecificOutput: {
7770
+ hookEventName: "PostToolUse",
7771
+ updatedToolOutput: text
7772
+ }
7773
+ }));
7774
+ }
7775
+
7519
7776
  // src/commands/post-read.ts
7520
7777
  var exports_post_read = {};
7521
7778
  __export(exports_post_read, {
@@ -7645,6 +7902,14 @@ async function postRead(cwd) {
7645
7902
  logWriter.appendReadEntry(new Date().toISOString(), filePath, result.indexHit, result.estimatedTokens);
7646
7903
  } catch {}
7647
7904
  atomicWriteJson(sessionPath(cwd), state);
7905
+ const isRanged = input.tool_input.offset != null || input.tool_input.limit != null;
7906
+ if (!isRanged && content && content.length > 0) {
7907
+ try {
7908
+ const outcome = compressToolOutput(cwd, "Read", content, filePath);
7909
+ if (outcome)
7910
+ emitUpdatedToolOutput(outcome.updatedToolOutput);
7911
+ } catch {}
7912
+ }
7648
7913
  } catch {} finally {
7649
7914
  clearTimeout(timer);
7650
7915
  }
@@ -7658,6 +7923,43 @@ var init_post_read = __esm(() => {
7658
7923
  init_description();
7659
7924
  init_action_log();
7660
7925
  init_device();
7926
+ init_compress_tool_output();
7927
+ });
7928
+
7929
+ // src/commands/post-tool.ts
7930
+ var exports_post_tool = {};
7931
+ __export(exports_post_tool, {
7932
+ postTool: () => postTool
7933
+ });
7934
+ function isPostToolUseInput2(value) {
7935
+ if (value === null || typeof value !== "object")
7936
+ return false;
7937
+ const obj = value;
7938
+ return typeof obj.tool_name === "string";
7939
+ }
7940
+ function isCompressibleTool(toolName) {
7941
+ return toolName === "Bash" || toolName === "Grep" || toolName === "Glob" || toolName.startsWith("mcp__");
7942
+ }
7943
+ async function postTool(cwd) {
7944
+ const timer = setTimeout(() => process.exit(0), 5000);
7945
+ try {
7946
+ const input = await readStdinJson();
7947
+ if (!isPostToolUseInput2(input))
7948
+ return;
7949
+ if (!isCompressibleTool(input.tool_name))
7950
+ return;
7951
+ const output = extractToolOutputText(input);
7952
+ if (!output)
7953
+ return;
7954
+ const outcome = compressToolOutput(cwd, input.tool_name, output);
7955
+ if (outcome)
7956
+ emitUpdatedToolOutput(outcome.updatedToolOutput);
7957
+ } catch {} finally {
7958
+ clearTimeout(timer);
7959
+ }
7960
+ }
7961
+ var init_post_tool = __esm(() => {
7962
+ init_compress_tool_output();
7661
7963
  });
7662
7964
 
7663
7965
  // src/core/pattern-engine.ts
@@ -7896,7 +8198,7 @@ function analyzePostWrite(filePath, fileContent, index) {
7896
8198
  indexEntry
7897
8199
  };
7898
8200
  }
7899
- function isPostToolUseInput2(value) {
8201
+ function isPostToolUseInput3(value) {
7900
8202
  if (value === null || typeof value !== "object")
7901
8203
  return false;
7902
8204
  const obj = value;
@@ -7910,7 +8212,7 @@ async function postWrite(cwd) {
7910
8212
  const timer = setTimeout(() => process.exit(0), 1e4);
7911
8213
  try {
7912
8214
  const input = await readStdinJson();
7913
- if (!isPostToolUseInput2(input))
8215
+ if (!isPostToolUseInput3(input))
7914
8216
  return;
7915
8217
  if (input.tool_name !== "Write" && input.tool_name !== "Edit")
7916
8218
  return;
@@ -8139,6 +8441,35 @@ var init_detect_waste = __esm(() => {
8139
8441
  init_device();
8140
8442
  });
8141
8443
 
8444
+ // src/commands/retrieve.ts
8445
+ var exports_retrieve = {};
8446
+ __export(exports_retrieve, {
8447
+ retrieve: () => retrieve
8448
+ });
8449
+ function retrieve(cwd, args) {
8450
+ const token = args[0];
8451
+ if (!token) {
8452
+ process.stderr.write(`[mink] usage: mink retrieve <token>
8453
+ `);
8454
+ return;
8455
+ }
8456
+ let entry = null;
8457
+ try {
8458
+ entry = CompressionCacheRepo.for(cwd).get(token);
8459
+ } catch {
8460
+ entry = null;
8461
+ }
8462
+ if (!entry) {
8463
+ process.stderr.write(`[mink] no retrievable output for token "${token}" (unknown or expired)
8464
+ `);
8465
+ return;
8466
+ }
8467
+ process.stdout.write(entry.content);
8468
+ }
8469
+ var init_retrieve = __esm(() => {
8470
+ init_compression_cache_repo();
8471
+ });
8472
+
8142
8473
  // src/core/cron-parser.ts
8143
8474
  function parseField(field, min, max) {
8144
8475
  const values = new Set;
@@ -8273,9 +8604,9 @@ __export(exports_self_update, {
8273
8604
  PACKAGE_NAME: () => PACKAGE_NAME
8274
8605
  });
8275
8606
  import { spawnSync as spawnSync2 } from "child_process";
8276
- import { existsSync as existsSync28, readFileSync as readFileSync21 } from "fs";
8277
- import { dirname as dirname12 } from "path";
8278
- import { join as join25 } from "path";
8607
+ import { existsSync as existsSync26, readFileSync as readFileSync21 } from "fs";
8608
+ import { dirname as dirname11 } from "path";
8609
+ import { join as join23 } from "path";
8279
8610
  function parseSemver(input) {
8280
8611
  const trimmed = input.trim().replace(/^v/, "");
8281
8612
  if (!trimmed)
@@ -8322,15 +8653,15 @@ function compareSemver(a, b) {
8322
8653
  function getInstallInfo() {
8323
8654
  const selfPath = new URL(import.meta.url).pathname;
8324
8655
  const isDevMode = selfPath.endsWith(".ts");
8325
- let dir = dirname12(selfPath);
8656
+ let dir = dirname11(selfPath);
8326
8657
  let packageJsonPath = null;
8327
8658
  for (let i = 0;i < 10; i++) {
8328
- const candidate = join25(dir, "package.json");
8329
- if (existsSync28(candidate)) {
8659
+ const candidate = join23(dir, "package.json");
8660
+ if (existsSync26(candidate)) {
8330
8661
  packageJsonPath = candidate;
8331
8662
  break;
8332
8663
  }
8333
- const parent = dirname12(dir);
8664
+ const parent = dirname11(dir);
8334
8665
  if (parent === dir)
8335
8666
  break;
8336
8667
  dir = parent;
@@ -8400,7 +8731,7 @@ function buildInstallCommand(pm, version) {
8400
8731
  return ["npm", "install", "-g", ref];
8401
8732
  }
8402
8733
  function selfUpdateLogPath() {
8403
- return join25(minkRoot(), "self-update.log");
8734
+ return join23(minkRoot(), "self-update.log");
8404
8735
  }
8405
8736
  function appendLogEntry(entry) {
8406
8737
  const path = selfUpdateLogPath();
@@ -9189,21 +9520,21 @@ var init_cron = __esm(() => {
9189
9520
  });
9190
9521
 
9191
9522
  // src/core/vault-templates.ts
9192
- import { join as join26 } from "path";
9193
- import { existsSync as existsSync29, writeFileSync as writeFileSync9, readFileSync as readFileSync22, mkdirSync as mkdirSync14 } from "fs";
9523
+ import { join as join24 } from "path";
9524
+ import { existsSync as existsSync27, writeFileSync as writeFileSync9, readFileSync as readFileSync22, mkdirSync as mkdirSync13 } from "fs";
9194
9525
  function seedTemplates(templatesDir) {
9195
- mkdirSync14(templatesDir, { recursive: true });
9526
+ mkdirSync13(templatesDir, { recursive: true });
9196
9527
  for (const [name, content] of Object.entries(DEFAULT_TEMPLATES)) {
9197
- const filePath = join26(templatesDir, `${name}.md`);
9198
- if (!existsSync29(filePath)) {
9528
+ const filePath = join24(templatesDir, `${name}.md`);
9529
+ if (!existsSync27(filePath)) {
9199
9530
  writeFileSync9(filePath, content);
9200
9531
  }
9201
9532
  }
9202
9533
  }
9203
9534
  function loadTemplate(templatesDir, templateName, vars) {
9204
- const filePath = join26(templatesDir, `${templateName}.md`);
9535
+ const filePath = join24(templatesDir, `${templateName}.md`);
9205
9536
  let content;
9206
- if (existsSync29(filePath)) {
9537
+ if (existsSync27(filePath)) {
9207
9538
  content = readFileSync22(filePath, "utf-8");
9208
9539
  } else if (DEFAULT_TEMPLATES[templateName]) {
9209
9540
  content = DEFAULT_TEMPLATES[templateName];
@@ -9357,29 +9688,29 @@ category: resources
9357
9688
  });
9358
9689
 
9359
9690
  // src/core/note-writer.ts
9360
- import { join as join27 } from "path";
9361
- import { existsSync as existsSync30, readFileSync as readFileSync23 } from "fs";
9691
+ import { join as join25 } from "path";
9692
+ import { existsSync as existsSync28, readFileSync as readFileSync23 } from "fs";
9362
9693
  import { createHash as createHash4 } from "crypto";
9363
9694
  function sha256(content) {
9364
9695
  return createHash4("sha256").update(content).digest("hex");
9365
9696
  }
9366
9697
  function resolveUniqueNotePath(dir, baseSlug, content) {
9367
9698
  const targetHash = sha256(content);
9368
- const primary = join27(dir, `${baseSlug}.md`);
9369
- if (!existsSync30(primary))
9699
+ const primary = join25(dir, `${baseSlug}.md`);
9700
+ if (!existsSync28(primary))
9370
9701
  return primary;
9371
9702
  if (sameContent(primary, targetHash))
9372
9703
  return primary;
9373
9704
  const dev4 = getOrCreateDeviceId().replace(/-/g, "").slice(0, 4);
9374
9705
  for (let i = 0;i < MAX_COLLISION_ATTEMPTS; i++) {
9375
9706
  const suffix = i === 0 ? dev4 : `${dev4}-${i + 1}`;
9376
- const candidate = join27(dir, `${baseSlug}-${suffix}.md`);
9377
- if (!existsSync30(candidate))
9707
+ const candidate = join25(dir, `${baseSlug}-${suffix}.md`);
9708
+ if (!existsSync28(candidate))
9378
9709
  return candidate;
9379
9710
  if (sameContent(candidate, targetHash))
9380
9711
  return candidate;
9381
9712
  }
9382
- return join27(dir, `${baseSlug}-${Date.now()}.md`);
9713
+ return join25(dir, `${baseSlug}-${Date.now()}.md`);
9383
9714
  }
9384
9715
  function sameContent(filePath, expectedHash) {
9385
9716
  try {
@@ -9454,8 +9785,8 @@ ${meta.body}
9454
9785
  }
9455
9786
  function appendToDaily(date, content) {
9456
9787
  const dir = vaultDailyDir();
9457
- const filePath = join27(dir, `${date}.md`);
9458
- if (existsSync30(filePath)) {
9788
+ const filePath = join25(dir, `${date}.md`);
9789
+ if (existsSync28(filePath)) {
9459
9790
  const timestamp = new Date().toLocaleTimeString("en-US", {
9460
9791
  hour: "2-digit",
9461
9792
  minute: "2-digit",
@@ -9564,10 +9895,10 @@ var init_design_eval = __esm(() => {
9564
9895
  });
9565
9896
 
9566
9897
  // src/core/dashboard-api.ts
9567
- import { existsSync as existsSync31, readFileSync as readFileSync24 } from "fs";
9898
+ import { existsSync as existsSync29, readFileSync as readFileSync24 } from "fs";
9568
9899
  import { readdirSync as readdirSync9, readFileSync as readFileSyncFS, existsSync as fsExistsSync } from "fs";
9569
- import { join as join28, resolve as resolve6, normalize, sep } from "path";
9570
- import { execSync as execSync7 } from "child_process";
9900
+ import { join as join26, resolve as resolve5, normalize, sep } from "path";
9901
+ import { execSync as execSync6 } from "child_process";
9571
9902
  function isSecretKey(key) {
9572
9903
  return SECRET_KEY_PATTERNS.some((re) => re.test(key));
9573
9904
  }
@@ -9579,7 +9910,7 @@ function maskSecret(value, showLast = 4) {
9579
9910
  return "••••" + value.slice(-showLast);
9580
9911
  }
9581
9912
  function checkJsonFile2(name, filePath, validator) {
9582
- if (!existsSync31(filePath))
9913
+ if (!existsSync29(filePath))
9583
9914
  return { name, status: "missing" };
9584
9915
  const data = safeReadJson(filePath);
9585
9916
  if (data === null)
@@ -9589,7 +9920,7 @@ function checkJsonFile2(name, filePath, validator) {
9589
9920
  return { name, status: "ok" };
9590
9921
  }
9591
9922
  function checkTextFile(name, filePath) {
9592
- if (!existsSync31(filePath))
9923
+ if (!existsSync29(filePath))
9593
9924
  return { name, status: "missing" };
9594
9925
  try {
9595
9926
  readFileSync24(filePath, "utf-8");
@@ -9599,7 +9930,7 @@ function checkTextFile(name, filePath) {
9599
9930
  }
9600
9931
  }
9601
9932
  function checkDbFile2(name, filePath) {
9602
- if (!existsSync31(filePath))
9933
+ if (!existsSync29(filePath))
9603
9934
  return { name, status: "missing" };
9604
9935
  try {
9605
9936
  const header = readFileSync24(filePath).slice(0, 16).toString("utf-8");
@@ -9781,7 +10112,7 @@ function getAheadBehind(branch) {
9781
10112
  if (!branch)
9782
10113
  return { ahead: 0, behind: 0 };
9783
10114
  try {
9784
- const raw = execSync7(`git rev-list --left-right --count origin/${branch}...${branch}`, { cwd: minkRoot(), timeout: 5000, stdio: ["pipe", "pipe", "pipe"] }).toString().trim();
10115
+ const raw = execSync6(`git rev-list --left-right --count origin/${branch}...${branch}`, { cwd: minkRoot(), timeout: 5000, stdio: ["pipe", "pipe", "pipe"] }).toString().trim();
9785
10116
  const [behindStr, aheadStr] = raw.split(/\s+/);
9786
10117
  return {
9787
10118
  behind: Number(behindStr) || 0,
@@ -9793,7 +10124,7 @@ function getAheadBehind(branch) {
9793
10124
  }
9794
10125
  function getPendingChanges() {
9795
10126
  try {
9796
- const raw = execSync7("git status --porcelain", {
10127
+ const raw = execSync6("git status --porcelain", {
9797
10128
  cwd: minkRoot(),
9798
10129
  timeout: 5000,
9799
10130
  stdio: ["pipe", "pipe", "pipe"]
@@ -9865,7 +10196,7 @@ function countMarkdownIn(dir) {
9865
10196
  for (const entry of readdirSync9(dir, { withFileTypes: true })) {
9866
10197
  if (WIKI_TREE_EXCLUDES.has(entry.name) || entry.name.startsWith("."))
9867
10198
  continue;
9868
- const fullPath = join28(dir, entry.name);
10199
+ const fullPath = join26(dir, entry.name);
9869
10200
  if (entry.isDirectory()) {
9870
10201
  count += countMarkdownIn(fullPath);
9871
10202
  } else if (entry.name.endsWith(".md") && !entry.name.startsWith("_")) {
@@ -9894,7 +10225,7 @@ function buildVaultTree(root) {
9894
10225
  for (const entry of entries) {
9895
10226
  if (!entry.isDir)
9896
10227
  continue;
9897
- const fullPath = join28(dir, entry.name);
10228
+ const fullPath = join26(dir, entry.name);
9898
10229
  const relPath = fullPath.slice(root.length + 1);
9899
10230
  const count = countMarkdownIn(fullPath);
9900
10231
  nodes.push({ name: entry.name, path: relPath, count, depth });
@@ -9979,7 +10310,7 @@ function resolveVaultRelativePath(relPath) {
9979
10310
  if (!relPath || relPath.includes("\x00"))
9980
10311
  return null;
9981
10312
  const root = resolveVaultPath();
9982
- const absolute = resolve6(root, relPath);
10313
+ const absolute = resolve5(root, relPath);
9983
10314
  const normalizedRoot = normalize(root) + sep;
9984
10315
  if (!absolute.startsWith(normalizedRoot) && absolute !== normalize(root)) {
9985
10316
  return null;
@@ -10317,7 +10648,7 @@ async function triggerIngestFile(sourcePath, category, tags, dedupKey) {
10317
10648
  if (!isValidCategory(category)) {
10318
10649
  return { success: false, error: `Invalid category: ${category}` };
10319
10650
  }
10320
- const expanded = sourcePath.startsWith("~/") ? join28(process.env.HOME ?? "", sourcePath.slice(2)) : sourcePath;
10651
+ const expanded = sourcePath.startsWith("~/") ? join26(process.env.HOME ?? "", sourcePath.slice(2)) : sourcePath;
10321
10652
  if (!fsExistsSync(expanded)) {
10322
10653
  return { success: false, error: `Source file not found: ${sourcePath}` };
10323
10654
  }
@@ -10404,8 +10735,8 @@ __export(exports_dashboard_server, {
10404
10735
  startDashboardServer: () => startDashboardServer
10405
10736
  });
10406
10737
  import { watch } from "fs";
10407
- import { existsSync as existsSync32 } from "fs";
10408
- import { basename as basename7, dirname as dirname13, join as join29, extname as extname2 } from "path";
10738
+ import { existsSync as existsSync30 } from "fs";
10739
+ import { basename as basename7, dirname as dirname12, join as join27, extname as extname2 } from "path";
10409
10740
 
10410
10741
  class SSEManager {
10411
10742
  clients = new Map;
@@ -10582,15 +10913,15 @@ async function startDashboardServer(cwd, options = {}) {
10582
10913
  timestamp: new Date().toISOString()
10583
10914
  });
10584
10915
  });
10585
- const __dir = dirname13(new URL(import.meta.url).pathname);
10916
+ const __dir = dirname12(new URL(import.meta.url).pathname);
10586
10917
  let pkgRoot = __dir;
10587
- while (pkgRoot !== dirname13(pkgRoot)) {
10588
- if (existsSync32(join29(pkgRoot, "package.json")))
10918
+ while (pkgRoot !== dirname12(pkgRoot)) {
10919
+ if (existsSync30(join27(pkgRoot, "package.json")))
10589
10920
  break;
10590
- pkgRoot = dirname13(pkgRoot);
10921
+ pkgRoot = dirname12(pkgRoot);
10591
10922
  }
10592
- const dashboardOutDir = join29(pkgRoot, "dashboard", "out");
10593
- const dashboardBuilt = existsSync32(join29(dashboardOutDir, "index.html"));
10923
+ const dashboardOutDir = join27(pkgRoot, "dashboard", "out");
10924
+ const dashboardBuilt = existsSync30(join27(dashboardOutDir, "index.html"));
10594
10925
  let clientIdCounter = 0;
10595
10926
  if (!dashboardBuilt) {
10596
10927
  console.warn("[mink] dashboard not built. Run: cd dashboard && bun run build");
@@ -10620,9 +10951,9 @@ async function startDashboardServer(cwd, options = {}) {
10620
10951
  } else {
10621
10952
  let filePath;
10622
10953
  if (pathname === "/") {
10623
- filePath = join29(dashboardOutDir, "index.html");
10954
+ filePath = join27(dashboardOutDir, "index.html");
10624
10955
  } else {
10625
- filePath = join29(dashboardOutDir, pathname);
10956
+ filePath = join27(dashboardOutDir, pathname);
10626
10957
  }
10627
10958
  if (!filePath.startsWith(dashboardOutDir)) {
10628
10959
  return jsonResponse({ error: "Forbidden" }, 403);
@@ -10635,7 +10966,7 @@ async function startDashboardServer(cwd, options = {}) {
10635
10966
  const htmlServed = await serveFile(filePath + ".html", "text/html; charset=utf-8");
10636
10967
  if (htmlServed)
10637
10968
  return htmlServed;
10638
- const indexServed = await serveFile(join29(dashboardOutDir, "index.html"), "text/html; charset=utf-8");
10969
+ const indexServed = await serveFile(join27(dashboardOutDir, "index.html"), "text/html; charset=utf-8");
10639
10970
  if (indexServed)
10640
10971
  return indexServed;
10641
10972
  }
@@ -10744,7 +11075,7 @@ retry: 3000
10744
11075
  if (!filename || filename.includes("..") || filename.includes("/")) {
10745
11076
  return jsonResponse({ error: "Invalid filename" }, 400);
10746
11077
  }
10747
- const imgPath = join29(designCapturesDir(resolvedCwd), filename);
11078
+ const imgPath = join27(designCapturesDir(resolvedCwd), filename);
10748
11079
  const served = await serveFile(imgPath, "image/jpeg");
10749
11080
  if (served) {
10750
11081
  served.headers.set("Cache-Control", "public, max-age=60");
@@ -10979,9 +11310,9 @@ __export(exports_dashboard, {
10979
11310
  resolveStartupCwd: () => resolveStartupCwd,
10980
11311
  dashboard: () => dashboard
10981
11312
  });
10982
- import { existsSync as existsSync33 } from "fs";
11313
+ import { existsSync as existsSync31 } from "fs";
10983
11314
  function resolveStartupCwd(cwd, registered = listRegisteredProjects()) {
10984
- if (existsSync33(projectDir(cwd))) {
11315
+ if (existsSync31(projectDir(cwd))) {
10985
11316
  return { kind: "active", cwd };
10986
11317
  }
10987
11318
  if (registered.length === 0) {
@@ -11018,18 +11349,18 @@ var init_dashboard = __esm(() => {
11018
11349
  });
11019
11350
 
11020
11351
  // src/commands/init.ts
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";
11352
+ import { mkdirSync as mkdirSync14, existsSync as existsSync32 } from "fs";
11353
+ import { resolve as resolve6, dirname as dirname13, basename as basename8, join as join28 } from "path";
11023
11354
  function resolveCliPathFrom2(selfPath) {
11024
- const selfDir = dirname14(selfPath);
11355
+ const selfDir = dirname13(selfPath);
11025
11356
  if (selfPath.endsWith("dist/cli.js") || selfPath.endsWith("dist/cli.bun.js") || selfPath.endsWith("dist/cli.node.js")) {
11026
- return join30(selfDir, "cli.js");
11357
+ return join28(selfDir, "cli.js");
11027
11358
  }
11028
- const packageRoot = resolve7(selfDir, "..", "..");
11029
- const distShim = join30(packageRoot, "dist", "cli.js");
11030
- if (existsSync34(distShim))
11359
+ const packageRoot = resolve6(selfDir, "..", "..");
11360
+ const distShim = join28(packageRoot, "dist", "cli.js");
11361
+ if (existsSync32(distShim))
11031
11362
  return distShim;
11032
- return join30(packageRoot, "src", "cli.ts");
11363
+ return join28(packageRoot, "src", "cli.ts");
11033
11364
  }
11034
11365
  function resolveCliPath2() {
11035
11366
  return resolveCliPathFrom2(new URL(import.meta.url).pathname);
@@ -11049,12 +11380,14 @@ function buildHooksConfig2(cliPath) {
11049
11380
  PostToolUse: [
11050
11381
  { matcher: "Read", hooks: hook(`${prefix} post-read`) },
11051
11382
  { matcher: "Edit", hooks: hook(`${prefix} post-write`) },
11052
- { matcher: "Write", hooks: hook(`${prefix} post-write`) }
11383
+ { matcher: "Write", hooks: hook(`${prefix} post-write`) },
11384
+ { matcher: "Bash", hooks: hook(`${prefix} post-tool`) },
11385
+ { matcher: "Grep", hooks: hook(`${prefix} post-tool`) }
11053
11386
  ]
11054
11387
  };
11055
11388
  }
11056
11389
  function isMinkCommand2(cmd) {
11057
- const hasMinkSubcommand = cmd.includes("session-start") || cmd.includes("session-stop") || cmd.includes("pre-read") || cmd.includes("post-read") || cmd.includes("pre-write") || cmd.includes("post-write");
11390
+ const hasMinkSubcommand = cmd.includes("session-start") || cmd.includes("session-stop") || cmd.includes("pre-read") || cmd.includes("post-read") || cmd.includes("pre-write") || cmd.includes("post-write") || cmd.includes("post-tool");
11058
11391
  if (!hasMinkSubcommand)
11059
11392
  return false;
11060
11393
  if (/(^|\/|\s)mink\s/.test(cmd))
@@ -11071,7 +11404,7 @@ function isMinkHook2(entry) {
11071
11404
  return false;
11072
11405
  }
11073
11406
  function mergeHooksIntoSettings2(settingsPath, newHooks) {
11074
- mkdirSync15(dirname14(settingsPath), { recursive: true });
11407
+ mkdirSync14(dirname13(settingsPath), { recursive: true });
11075
11408
  const existing = safeReadJson(settingsPath) ?? {};
11076
11409
  const existingHooks = existing.hooks ?? {};
11077
11410
  for (const [event, entries] of Object.entries(newHooks)) {
@@ -11089,16 +11422,13 @@ var init_init2 = __esm(() => {
11089
11422
  init_device();
11090
11423
  init_git_identity();
11091
11424
  init_vault();
11092
- init_agent_detect();
11093
- init_agent_pi();
11094
- init_prompt();
11095
11425
  });
11096
11426
 
11097
11427
  // src/core/daemon-service.ts
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";
11428
+ import { execSync as execSync7 } from "child_process";
11429
+ import { existsSync as existsSync33, mkdirSync as mkdirSync15, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "fs";
11430
+ import { homedir as homedir4 } from "os";
11431
+ import { dirname as dirname14, join as join29 } from "path";
11102
11432
  function detectPlatform() {
11103
11433
  if (process.platform === "linux")
11104
11434
  return "systemd";
@@ -11108,11 +11438,11 @@ function detectPlatform() {
11108
11438
  }
11109
11439
  function resolveServiceInvocation() {
11110
11440
  const entry = process.argv[1];
11111
- if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) && existsSync35(entry)) {
11441
+ if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) && existsSync33(entry)) {
11112
11442
  return {
11113
11443
  executable: entry,
11114
11444
  args: ["daemon", "start"],
11115
- pathDir: dirname15(entry)
11445
+ pathDir: dirname14(entry)
11116
11446
  };
11117
11447
  }
11118
11448
  const cliPath = resolveCliPath2();
@@ -11120,17 +11450,17 @@ function resolveServiceInvocation() {
11120
11450
  return {
11121
11451
  executable: interpreter,
11122
11452
  args: [cliPath, "daemon", "start"],
11123
- pathDir: dirname15(interpreter)
11453
+ pathDir: dirname14(interpreter)
11124
11454
  };
11125
11455
  }
11126
11456
  function servicePaths(platform2) {
11127
- const home = homedir5();
11457
+ const home = homedir4();
11128
11458
  if (platform2 === "systemd") {
11129
- const unitDir2 = join31(home, ".config", "systemd", "user");
11130
- return { unitDir: unitDir2, unitFile: join31(unitDir2, "mink-daemon.service") };
11459
+ const unitDir2 = join29(home, ".config", "systemd", "user");
11460
+ return { unitDir: unitDir2, unitFile: join29(unitDir2, "mink-daemon.service") };
11131
11461
  }
11132
- const unitDir = join31(home, "Library", "LaunchAgents");
11133
- return { unitDir, unitFile: join31(unitDir, "com.mink.daemon.plist") };
11462
+ const unitDir = join29(home, "Library", "LaunchAgents");
11463
+ return { unitDir, unitFile: join29(unitDir, "com.mink.daemon.plist") };
11134
11464
  }
11135
11465
  function renderSystemdUnit(inv) {
11136
11466
  const execStart = [inv.executable, ...inv.args].join(" ");
@@ -11204,17 +11534,17 @@ function installService(options = {}) {
11204
11534
  process.exit(1);
11205
11535
  }
11206
11536
  const paths = servicePaths(platform2);
11207
- if (existsSync35(paths.unitFile) && !options.force) {
11537
+ if (existsSync33(paths.unitFile) && !options.force) {
11208
11538
  console.error(`[mink] unit file already exists: ${paths.unitFile}`);
11209
11539
  console.error(" re-run with --force to overwrite, or run `mink daemon uninstall` first");
11210
11540
  process.exit(1);
11211
11541
  }
11212
11542
  const inv = resolveServiceInvocation();
11213
- mkdirSync16(paths.unitDir, { recursive: true });
11543
+ mkdirSync15(paths.unitDir, { recursive: true });
11214
11544
  if (platform2 === "systemd") {
11215
11545
  writeFileSync10(paths.unitFile, renderSystemdUnit(inv));
11216
11546
  try {
11217
- execSync8("systemctl --user daemon-reload", { stdio: "ignore" });
11547
+ execSync7("systemctl --user daemon-reload", { stdio: "ignore" });
11218
11548
  } catch {}
11219
11549
  console.log(`[mink] wrote ${paths.unitFile}`);
11220
11550
  console.log("[mink] next steps:");
@@ -11237,24 +11567,24 @@ function uninstallService() {
11237
11567
  process.exit(1);
11238
11568
  }
11239
11569
  const paths = servicePaths(platform2);
11240
- if (!existsSync35(paths.unitFile)) {
11570
+ if (!existsSync33(paths.unitFile)) {
11241
11571
  console.log(`[mink] no unit file at ${paths.unitFile} — nothing to uninstall`);
11242
11572
  return;
11243
11573
  }
11244
11574
  if (platform2 === "systemd") {
11245
11575
  try {
11246
- execSync8("systemctl --user disable --now mink-daemon.service", {
11576
+ execSync7("systemctl --user disable --now mink-daemon.service", {
11247
11577
  stdio: "ignore"
11248
11578
  });
11249
11579
  } catch {}
11250
11580
  unlinkSync5(paths.unitFile);
11251
11581
  try {
11252
- execSync8("systemctl --user daemon-reload", { stdio: "ignore" });
11582
+ execSync7("systemctl --user daemon-reload", { stdio: "ignore" });
11253
11583
  } catch {}
11254
11584
  console.log(`[mink] removed ${paths.unitFile}`);
11255
11585
  } else {
11256
11586
  try {
11257
- execSync8(`launchctl unload -w ${paths.unitFile}`, { stdio: "ignore" });
11587
+ execSync7(`launchctl unload -w ${paths.unitFile}`, { stdio: "ignore" });
11258
11588
  } catch {}
11259
11589
  unlinkSync5(paths.unitFile);
11260
11590
  console.log(`[mink] removed ${paths.unitFile}`);
@@ -11269,7 +11599,7 @@ var exports_daemon = {};
11269
11599
  __export(exports_daemon, {
11270
11600
  daemon: () => daemon
11271
11601
  });
11272
- import { readFileSync as readFileSync25, existsSync as existsSync36 } from "fs";
11602
+ import { readFileSync as readFileSync25, existsSync as existsSync34 } from "fs";
11273
11603
  async function daemon(cwd, args) {
11274
11604
  const subcommand = args[0];
11275
11605
  switch (subcommand) {
@@ -11285,7 +11615,7 @@ async function daemon(cwd, args) {
11285
11615
  break;
11286
11616
  case "logs": {
11287
11617
  const logPath = schedulerLogPath();
11288
- if (!existsSync36(logPath)) {
11618
+ if (!existsSync34(logPath)) {
11289
11619
  console.log("[mink] no log file found");
11290
11620
  return;
11291
11621
  }
@@ -11557,13 +11887,13 @@ function printValidKeys() {
11557
11887
  }
11558
11888
  }
11559
11889
  function readLineFromStdin() {
11560
- return new Promise((resolve9) => {
11890
+ return new Promise((resolve8) => {
11561
11891
  const chunks = [];
11562
11892
  process.stdin.resume();
11563
11893
  process.stdin.setEncoding("utf-8");
11564
11894
  process.stdin.once("data", (data) => {
11565
11895
  process.stdin.pause();
11566
- resolve9(String(data).trim());
11896
+ resolve8(String(data).trim());
11567
11897
  });
11568
11898
  });
11569
11899
  }
@@ -11638,7 +11968,7 @@ var exports_update = {};
11638
11968
  __export(exports_update, {
11639
11969
  update: () => update
11640
11970
  });
11641
- import { resolve as resolve9 } from "path";
11971
+ import { resolve as resolve8 } from "path";
11642
11972
  function parseArgs(args) {
11643
11973
  let dryRun = false;
11644
11974
  let project = null;
@@ -11696,7 +12026,7 @@ async function update(cwd, args) {
11696
12026
  }
11697
12027
  const backupName = createBackup(target.cwd);
11698
12028
  console.log(` backup: ${backupName}`);
11699
- const settingsPath = resolve9(target.cwd, ".claude", "settings.json");
12029
+ const settingsPath = resolve8(target.cwd, ".claude", "settings.json");
11700
12030
  mergeHooksIntoSettings2(settingsPath, newHooks);
11701
12031
  console.log(" hooks: updated");
11702
12032
  const metaPath = projectMetaPath(target.cwd);
@@ -11872,7 +12202,7 @@ var init_restore = __esm(() => {
11872
12202
 
11873
12203
  // src/core/design-eval/server-detect.ts
11874
12204
  import { readFileSync as readFileSync26 } from "fs";
11875
- import { join as join32 } from "path";
12205
+ import { join as join30 } from "path";
11876
12206
  async function probePort(port) {
11877
12207
  try {
11878
12208
  const controller = new AbortController;
@@ -11894,7 +12224,7 @@ async function findRunningServer(ports = DEFAULT_PROBE_PORTS) {
11894
12224
  }
11895
12225
  function detectDevCommand(cwd) {
11896
12226
  try {
11897
- const raw = readFileSync26(join32(cwd, "package.json"), "utf-8");
12227
+ const raw = readFileSync26(join30(cwd, "package.json"), "utf-8");
11898
12228
  const pkg = JSON.parse(raw);
11899
12229
  const scripts = pkg.scripts;
11900
12230
  if (!scripts || typeof scripts !== "object")
@@ -11914,10 +12244,10 @@ var init_server_detect = __esm(() => {
11914
12244
  });
11915
12245
 
11916
12246
  // src/core/design-eval/route-detect.ts
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";
12247
+ import { existsSync as existsSync35, readdirSync as readdirSync10, statSync as statSync12 } from "fs";
12248
+ import { join as join31, relative as relative8, sep as sep2 } from "path";
11919
12249
  function detectFramework(cwd) {
11920
- const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync37(join33(cwd, `${name}.${ext}`))) || existsSync37(join33(cwd, name));
12250
+ const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync35(join31(cwd, `${name}.${ext}`))) || existsSync35(join31(cwd, name));
11921
12251
  if (has("next.config"))
11922
12252
  return "nextjs";
11923
12253
  if (has("svelte.config"))
@@ -11942,8 +12272,8 @@ function detectRoutes(cwd) {
11942
12272
  }
11943
12273
  function detectNextRoutes(cwd) {
11944
12274
  const routes = [];
11945
- const appDir = join33(cwd, "app");
11946
- if (existsSync37(appDir)) {
12275
+ const appDir = join31(cwd, "app");
12276
+ if (existsSync35(appDir)) {
11947
12277
  const pageFiles = findFiles(appDir, /^page\.(tsx?|jsx?)$/);
11948
12278
  for (const file of pageFiles) {
11949
12279
  const rel = relative8(appDir, file);
@@ -11954,8 +12284,8 @@ function detectNextRoutes(cwd) {
11954
12284
  routes.push(route);
11955
12285
  }
11956
12286
  }
11957
- const pagesDir = join33(cwd, "pages");
11958
- if (existsSync37(pagesDir)) {
12287
+ const pagesDir = join31(cwd, "pages");
12288
+ if (existsSync35(pagesDir)) {
11959
12289
  const pageFiles = findFiles(pagesDir, /\.(tsx?|jsx?)$/);
11960
12290
  for (const file of pageFiles) {
11961
12291
  const rel = relative8(pagesDir, file);
@@ -11974,8 +12304,8 @@ function detectNextRoutes(cwd) {
11974
12304
  return unique.length > 0 ? unique.sort() : ["/"];
11975
12305
  }
11976
12306
  function detectSvelteKitRoutes(cwd) {
11977
- const routesDir = join33(cwd, "src", "routes");
11978
- if (!existsSync37(routesDir))
12307
+ const routesDir = join31(cwd, "src", "routes");
12308
+ if (!existsSync35(routesDir))
11979
12309
  return ["/"];
11980
12310
  const routes = [];
11981
12311
  const pageFiles = findFiles(routesDir, /^\+page\.svelte$/);
@@ -11990,8 +12320,8 @@ function detectSvelteKitRoutes(cwd) {
11990
12320
  return routes.length > 0 ? routes.sort() : ["/"];
11991
12321
  }
11992
12322
  function detectNuxtRoutes(cwd) {
11993
- const pagesDir = join33(cwd, "pages");
11994
- if (!existsSync37(pagesDir))
12323
+ const pagesDir = join31(cwd, "pages");
12324
+ if (!existsSync35(pagesDir))
11995
12325
  return ["/"];
11996
12326
  const routes = [];
11997
12327
  const vueFiles = findFiles(pagesDir, /\.vue$/);
@@ -12017,7 +12347,7 @@ function findFiles(dir, pattern) {
12017
12347
  for (const entry of entries) {
12018
12348
  if (entry.startsWith(".") || entry === "node_modules")
12019
12349
  continue;
12020
- const full = join33(current, entry);
12350
+ const full = join31(current, entry);
12021
12351
  try {
12022
12352
  const stat2 = statSync12(full);
12023
12353
  if (stat2.isDirectory()) {
@@ -12045,11 +12375,11 @@ function __extends(d, b) {
12045
12375
  }
12046
12376
  function __awaiter(thisArg, _arguments, P, generator) {
12047
12377
  function adopt(value) {
12048
- return value instanceof P ? value : new P(function(resolve10) {
12049
- resolve10(value);
12378
+ return value instanceof P ? value : new P(function(resolve9) {
12379
+ resolve9(value);
12050
12380
  });
12051
12381
  }
12052
- return new (P || (P = Promise))(function(resolve10, reject) {
12382
+ return new (P || (P = Promise))(function(resolve9, reject) {
12053
12383
  function fulfilled(value) {
12054
12384
  try {
12055
12385
  step(generator.next(value));
@@ -12065,7 +12395,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
12065
12395
  }
12066
12396
  }
12067
12397
  function step(result) {
12068
- result.done ? resolve10(result.value) : adopt(result.value).then(fulfilled, rejected);
12398
+ result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
12069
12399
  }
12070
12400
  step((generator = generator.apply(thisArg, _arguments || [])).next());
12071
12401
  });
@@ -12248,14 +12578,14 @@ function __asyncValues(o) {
12248
12578
  }, i);
12249
12579
  function verb(n) {
12250
12580
  i[n] = o[n] && function(v) {
12251
- return new Promise(function(resolve10, reject) {
12252
- v = o[n](v), settle(resolve10, reject, v.done, v.value);
12581
+ return new Promise(function(resolve9, reject) {
12582
+ v = o[n](v), settle(resolve9, reject, v.done, v.value);
12253
12583
  });
12254
12584
  };
12255
12585
  }
12256
- function settle(resolve10, reject, d, v) {
12586
+ function settle(resolve9, reject, d, v) {
12257
12587
  Promise.resolve(v).then(function(v2) {
12258
- resolve10({ value: v2, done: d });
12588
+ resolve9({ value: v2, done: d });
12259
12589
  }, reject);
12260
12590
  }
12261
12591
  }
@@ -12786,7 +13116,7 @@ function of() {
12786
13116
  }
12787
13117
  function lastValueFrom(source, config22) {
12788
13118
  var hasConfig = typeof config22 === "object";
12789
- return new Promise(function(resolve10, reject) {
13119
+ return new Promise(function(resolve9, reject) {
12790
13120
  var _hasValue = false;
12791
13121
  var _value;
12792
13122
  source.subscribe({
@@ -12797,9 +13127,9 @@ function lastValueFrom(source, config22) {
12797
13127
  error: reject,
12798
13128
  complete: function() {
12799
13129
  if (_hasValue) {
12800
- resolve10(_value);
13130
+ resolve9(_value);
12801
13131
  } else if (hasConfig) {
12802
- resolve10(config22.defaultValue);
13132
+ resolve9(config22.defaultValue);
12803
13133
  } else {
12804
13134
  reject(new EmptyError);
12805
13135
  }
@@ -12809,16 +13139,16 @@ function lastValueFrom(source, config22) {
12809
13139
  }
12810
13140
  function firstValueFrom(source, config22) {
12811
13141
  var hasConfig = typeof config22 === "object";
12812
- return new Promise(function(resolve10, reject) {
13142
+ return new Promise(function(resolve9, reject) {
12813
13143
  var subscriber = new SafeSubscriber({
12814
13144
  next: function(value) {
12815
- resolve10(value);
13145
+ resolve9(value);
12816
13146
  subscriber.unsubscribe();
12817
13147
  },
12818
13148
  error: reject,
12819
13149
  complete: function() {
12820
13150
  if (hasConfig) {
12821
- resolve10(config22.defaultValue);
13151
+ resolve9(config22.defaultValue);
12822
13152
  } else {
12823
13153
  reject(new EmptyError);
12824
13154
  }
@@ -13870,7 +14200,7 @@ var init_rxjs = __esm(() => {
13870
14200
  Observable2.prototype.forEach = function(next, promiseCtor) {
13871
14201
  var _this = this;
13872
14202
  promiseCtor = getPromiseCtor(promiseCtor);
13873
- return new promiseCtor(function(resolve10, reject) {
14203
+ return new promiseCtor(function(resolve9, reject) {
13874
14204
  var subscriber = new SafeSubscriber({
13875
14205
  next: function(value) {
13876
14206
  try {
@@ -13881,7 +14211,7 @@ var init_rxjs = __esm(() => {
13881
14211
  }
13882
14212
  },
13883
14213
  error: reject,
13884
- complete: resolve10
14214
+ complete: resolve9
13885
14215
  });
13886
14216
  _this.subscribe(subscriber);
13887
14217
  });
@@ -13903,14 +14233,14 @@ var init_rxjs = __esm(() => {
13903
14233
  Observable2.prototype.toPromise = function(promiseCtor) {
13904
14234
  var _this = this;
13905
14235
  promiseCtor = getPromiseCtor(promiseCtor);
13906
- return new promiseCtor(function(resolve10, reject) {
14236
+ return new promiseCtor(function(resolve9, reject) {
13907
14237
  var value;
13908
14238
  _this.subscribe(function(x) {
13909
14239
  return value = x;
13910
14240
  }, function(err) {
13911
14241
  return reject(err);
13912
14242
  }, function() {
13913
- return resolve10(value);
14243
+ return resolve9(value);
13914
14244
  });
13915
14245
  });
13916
14246
  };
@@ -15836,8 +16166,8 @@ class Deferred {
15836
16166
  #isRejected = false;
15837
16167
  #value;
15838
16168
  #resolve;
15839
- #taskPromise = new Promise((resolve10) => {
15840
- this.#resolve = resolve10;
16169
+ #taskPromise = new Promise((resolve9) => {
16170
+ this.#resolve = resolve9;
15841
16171
  });
15842
16172
  #timeoutId;
15843
16173
  #timeoutError;
@@ -15926,12 +16256,12 @@ var init_Mutex = __esm(() => {
15926
16256
  return new Mutex.Guard(this, onRelease);
15927
16257
  }
15928
16258
  release() {
15929
- const resolve10 = this.#acquirers.shift();
15930
- if (!resolve10) {
16259
+ const resolve9 = this.#acquirers.shift();
16260
+ if (!resolve9) {
15931
16261
  this.#locked = false;
15932
16262
  return;
15933
16263
  }
15934
- resolve10();
16264
+ resolve9();
15935
16265
  }
15936
16266
  };
15937
16267
  });
@@ -17675,12 +18005,12 @@ var init_locators = __esm(() => {
17675
18005
  }
17676
18006
  return defer(() => {
17677
18007
  return from(handle.evaluate((element) => {
17678
- return new Promise((resolve10) => {
18008
+ return new Promise((resolve9) => {
17679
18009
  window.requestAnimationFrame(() => {
17680
18010
  const rect1 = element.getBoundingClientRect();
17681
18011
  window.requestAnimationFrame(() => {
17682
18012
  const rect2 = element.getBoundingClientRect();
17683
- resolve10([
18013
+ resolve9([
17684
18014
  {
17685
18015
  x: rect1.x,
17686
18016
  y: rect1.y,
@@ -18971,9 +19301,9 @@ var init_ElementHandle = __esm(() => {
18971
19301
  const handle = await this.#asSVGElementHandle();
18972
19302
  const target = __addDisposableResource6(env_5, handle && await handle.#getOwnerSVGElement(), false);
18973
19303
  return await (target ?? this).evaluate(async (element, threshold) => {
18974
- const visibleRatio = await new Promise((resolve10) => {
19304
+ const visibleRatio = await new Promise((resolve9) => {
18975
19305
  const observer = new IntersectionObserver((entries) => {
18976
- resolve10(entries[0].intersectionRatio);
19306
+ resolve9(entries[0].intersectionRatio);
18977
19307
  observer.disconnect();
18978
19308
  });
18979
19309
  observer.observe(element);
@@ -19367,7 +19697,7 @@ var init_Frame = __esm(() => {
19367
19697
  }
19368
19698
  type = type ?? "text/javascript";
19369
19699
  return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, id, type: type2, content: content2 }) => {
19370
- return await new Promise((resolve10, reject) => {
19700
+ return await new Promise((resolve9, reject) => {
19371
19701
  const script = document.createElement("script");
19372
19702
  script.type = type2;
19373
19703
  script.text = content2;
@@ -19380,12 +19710,12 @@ var init_Frame = __esm(() => {
19380
19710
  if (url) {
19381
19711
  script.src = url;
19382
19712
  script.addEventListener("load", () => {
19383
- resolve10(script);
19713
+ resolve9(script);
19384
19714
  }, { once: true });
19385
19715
  document.head.appendChild(script);
19386
19716
  } else {
19387
19717
  document.head.appendChild(script);
19388
- resolve10(script);
19718
+ resolve9(script);
19389
19719
  }
19390
19720
  });
19391
19721
  }, { ...options, type, content }));
@@ -19402,7 +19732,7 @@ var init_Frame = __esm(() => {
19402
19732
  options.content = content;
19403
19733
  }
19404
19734
  return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, content: content2 }) => {
19405
- return await new Promise((resolve10, reject) => {
19735
+ return await new Promise((resolve9, reject) => {
19406
19736
  let element;
19407
19737
  if (!url) {
19408
19738
  element = document.createElement("style");
@@ -19414,7 +19744,7 @@ var init_Frame = __esm(() => {
19414
19744
  element = link;
19415
19745
  }
19416
19746
  element.addEventListener("load", () => {
19417
- resolve10(element);
19747
+ resolve9(element);
19418
19748
  }, { once: true });
19419
19749
  element.addEventListener("error", (event) => {
19420
19750
  reject(new Error(event.message ?? "Could not load style"));
@@ -20268,9 +20598,9 @@ var init_Page = __esm(() => {
20268
20598
  ++this.#screencastSessionCount;
20269
20599
  if (!this.#startScreencastPromise) {
20270
20600
  this.#startScreencastPromise = this.mainFrame().client.send("Page.startScreencast", { format: "png" }).then(() => {
20271
- return new Promise((resolve10) => {
20601
+ return new Promise((resolve9) => {
20272
20602
  return this.mainFrame().client.once("Page.screencastFrame", () => {
20273
- return resolve10();
20603
+ return resolve9();
20274
20604
  });
20275
20605
  });
20276
20606
  });
@@ -22928,11 +23258,11 @@ function addPageBinding(type, name, prefix) {
22928
23258
  return value instanceof Node;
22929
23259
  })
22930
23260
  }));
22931
- return new Promise((resolve10, reject) => {
23261
+ return new Promise((resolve9, reject) => {
22932
23262
  callPuppeteer.callbacks.set(seq, {
22933
23263
  resolve(value) {
22934
23264
  callPuppeteer.args.delete(seq);
22935
- resolve10(value);
23265
+ resolve9(value);
22936
23266
  },
22937
23267
  reject(value) {
22938
23268
  callPuppeteer.args.delete(seq);
@@ -26395,8 +26725,8 @@ var init_Input2 = __esm(() => {
26395
26725
  if (typeof delay === "number") {
26396
26726
  await Promise.all(actions);
26397
26727
  actions.length = 0;
26398
- await new Promise((resolve10) => {
26399
- setTimeout(resolve10, delay);
26728
+ await new Promise((resolve9) => {
26729
+ setTimeout(resolve9, delay);
26400
26730
  });
26401
26731
  }
26402
26732
  actions.push(this.up({ ...options, clickCount }));
@@ -26416,9 +26746,9 @@ var init_Input2 = __esm(() => {
26416
26746
  });
26417
26747
  }
26418
26748
  async drag(start, target) {
26419
- const promise = new Promise((resolve10) => {
26749
+ const promise = new Promise((resolve9) => {
26420
26750
  this.#client.once("Input.dragIntercepted", (event) => {
26421
- return resolve10(event.data);
26751
+ return resolve9(event.data);
26422
26752
  });
26423
26753
  });
26424
26754
  await this.move(start.x, start.y);
@@ -26459,8 +26789,8 @@ var init_Input2 = __esm(() => {
26459
26789
  await this.dragEnter(target, data);
26460
26790
  await this.dragOver(target, data);
26461
26791
  if (delay) {
26462
- await new Promise((resolve10) => {
26463
- return setTimeout(resolve10, delay);
26792
+ await new Promise((resolve9) => {
26793
+ return setTimeout(resolve9, delay);
26464
26794
  });
26465
26795
  }
26466
26796
  await this.drop(target, data);
@@ -27272,9 +27602,9 @@ var init_Page2 = __esm(() => {
27272
27602
  async captureHeapSnapshot(options) {
27273
27603
  const { createWriteStream } = environment.value.fs;
27274
27604
  const stream = createWriteStream(options.path);
27275
- const streamPromise = new Promise((resolve10, reject) => {
27605
+ const streamPromise = new Promise((resolve9, reject) => {
27276
27606
  stream.on("error", reject);
27277
- stream.on("finish", resolve10);
27607
+ stream.on("finish", resolve9);
27278
27608
  });
27279
27609
  const client = this.#primaryTargetClient;
27280
27610
  await client.send("HeapProfiler.enable");
@@ -28787,10 +29117,10 @@ __export(exports_BrowserWebSocketTransport, {
28787
29117
 
28788
29118
  class BrowserWebSocketTransport {
28789
29119
  static create(url) {
28790
- return new Promise((resolve10, reject) => {
29120
+ return new Promise((resolve9, reject) => {
28791
29121
  const ws = new WebSocket(url);
28792
29122
  ws.addEventListener("open", () => {
28793
- return resolve10(new BrowserWebSocketTransport(ws));
29123
+ return resolve9(new BrowserWebSocketTransport(ws));
28794
29124
  });
28795
29125
  ws.addEventListener("error", reject);
28796
29126
  });
@@ -31624,11 +31954,11 @@ var require_BrowsingContextProcessor = __commonJS((exports) => {
31624
31954
  }
31625
31955
  const parentCdpClient = context2.cdpTarget.parentCdpClient;
31626
31956
  try {
31627
- const detachedFromTargetPromise = new Promise((resolve10) => {
31957
+ const detachedFromTargetPromise = new Promise((resolve9) => {
31628
31958
  const onContextDestroyed = (event) => {
31629
31959
  if (event.targetId === params.context) {
31630
31960
  parentCdpClient.off("Target.detachedFromTarget", onContextDestroyed);
31631
- resolve10();
31961
+ resolve9();
31632
31962
  }
31633
31963
  };
31634
31964
  parentCdpClient.on("Target.detachedFromTarget", onContextDestroyed);
@@ -32948,7 +33278,7 @@ var require_ActionDispatcher = __commonJS((exports) => {
32948
33278
  }
32949
33279
  }
32950
33280
  const promises = [
32951
- new Promise((resolve10) => setTimeout(resolve10, this.#tickDuration))
33281
+ new Promise((resolve9) => setTimeout(resolve9, this.#tickDuration))
32952
33282
  ];
32953
33283
  for (const option of options) {
32954
33284
  promises.push(this.#dispatchAction(option));
@@ -33547,8 +33877,8 @@ var require_Mutex = __commonJS((exports) => {
33547
33877
  acquire() {
33548
33878
  const state = { resolved: false };
33549
33879
  if (this.#locked) {
33550
- return new Promise((resolve10) => {
33551
- this.#acquirers.push(() => resolve10(this.#release.bind(this, state)));
33880
+ return new Promise((resolve9) => {
33881
+ this.#acquirers.push(() => resolve9(this.#release.bind(this, state)));
33552
33882
  });
33553
33883
  }
33554
33884
  this.#locked = true;
@@ -33559,12 +33889,12 @@ var require_Mutex = __commonJS((exports) => {
33559
33889
  throw new Error("Cannot release more than once.");
33560
33890
  }
33561
33891
  state.resolved = true;
33562
- const resolve10 = this.#acquirers.shift();
33563
- if (!resolve10) {
33892
+ const resolve9 = this.#acquirers.shift();
33893
+ if (!resolve9) {
33564
33894
  this.#locked = false;
33565
33895
  return;
33566
33896
  }
33567
- resolve10();
33897
+ resolve9();
33568
33898
  }
33569
33899
  async run(action) {
33570
33900
  const release = await this.acquire();
@@ -34691,8 +35021,8 @@ var require_ChannelProxy = __commonJS((exports) => {
34691
35021
  let queueNonEmptyResolver = null;
34692
35022
  return {
34693
35023
  async getMessage() {
34694
- const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve10) => {
34695
- queueNonEmptyResolver = resolve10;
35024
+ const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve9) => {
35025
+ queueNonEmptyResolver = resolve9;
34696
35026
  });
34697
35027
  await onMessage;
34698
35028
  return queue.shift();
@@ -34778,7 +35108,7 @@ var require_ChannelProxy = __commonJS((exports) => {
34778
35108
  functionDeclaration: String((id) => {
34779
35109
  const w = window;
34780
35110
  if (w[id] === undefined) {
34781
- return new Promise((resolve10) => w[id] = resolve10);
35111
+ return new Promise((resolve9) => w[id] = resolve9);
34782
35112
  }
34783
35113
  const channelProxy = w[id];
34784
35114
  delete w[id];
@@ -36129,8 +36459,8 @@ var require_Deferred = __commonJS((exports) => {
36129
36459
  return this.#result;
36130
36460
  }
36131
36461
  constructor() {
36132
- this.#promise = new Promise((resolve10, reject) => {
36133
- this.#resolve = resolve10;
36462
+ this.#promise = new Promise((resolve9, reject) => {
36463
+ this.#resolve = resolve9;
36134
36464
  this.#reject = reject;
36135
36465
  });
36136
36466
  this.#promise.catch((_error) => {});
@@ -40455,11 +40785,11 @@ var require_BrowsingContextStorage = __commonJS((exports) => {
40455
40785
  if (this.#contexts.has(browsingContextId)) {
40456
40786
  return Promise.resolve(this.getContext(browsingContextId));
40457
40787
  }
40458
- return new Promise((resolve10) => {
40788
+ return new Promise((resolve9) => {
40459
40789
  const listener = (event) => {
40460
40790
  if (event.browsingContext.id === browsingContextId) {
40461
40791
  this.#eventEmitter.off("added", listener);
40462
- resolve10(event.browsingContext);
40792
+ resolve9(event.browsingContext);
40463
40793
  }
40464
40794
  };
40465
40795
  this.#eventEmitter.on("added", listener);
@@ -43955,8 +44285,8 @@ var init_ExposedFunction = __esm(() => {
43955
44285
  const functionDeclaration = stringifyFunction(interpolateFunction((callback) => {
43956
44286
  Object.assign(globalThis, {
43957
44287
  [PLACEHOLDER("name")]: function(...args) {
43958
- return new Promise((resolve10, reject) => {
43959
- callback([resolve10, reject, args]);
44288
+ return new Promise((resolve9, reject) => {
44289
+ callback([resolve9, reject, args]);
43960
44290
  });
43961
44291
  }
43962
44292
  });
@@ -44044,8 +44374,8 @@ var init_ExposedFunction = __esm(() => {
44044
44374
  return;
44045
44375
  }
44046
44376
  try {
44047
- await dataHandle.evaluate(([resolve10], result2) => {
44048
- resolve10(result2);
44377
+ await dataHandle.evaluate(([resolve9], result2) => {
44378
+ resolve9(result2);
44049
44379
  }, result);
44050
44380
  } catch (error) {
44051
44381
  debugError(error);
@@ -51337,7 +51667,7 @@ __export(exports_NodeWebSocketTransport, {
51337
51667
 
51338
51668
  class NodeWebSocketTransport {
51339
51669
  static create(url, headers) {
51340
- return new Promise((resolve10, reject) => {
51670
+ return new Promise((resolve9, reject) => {
51341
51671
  const ws = new wrapper_default(url, [], {
51342
51672
  followRedirects: true,
51343
51673
  perMessageDeflate: false,
@@ -51349,7 +51679,7 @@ class NodeWebSocketTransport {
51349
51679
  }
51350
51680
  });
51351
51681
  ws.addEventListener("open", () => {
51352
- return resolve10(new NodeWebSocketTransport(ws));
51682
+ return resolve9(new NodeWebSocketTransport(ws));
51353
51683
  });
51354
51684
  ws.addEventListener("error", reject);
51355
51685
  });
@@ -54241,8 +54571,8 @@ var require_helpers = __commonJS((exports) => {
54241
54571
  function req(url, opts = {}) {
54242
54572
  const href = typeof url === "string" ? url : url.href;
54243
54573
  const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
54244
- const promise = new Promise((resolve10, reject) => {
54245
- req2.once("response", resolve10).once("error", reject).end();
54574
+ const promise = new Promise((resolve9, reject) => {
54575
+ req2.once("response", resolve9).once("error", reject).end();
54246
54576
  });
54247
54577
  req2.then = promise.then.bind(promise);
54248
54578
  return req2;
@@ -54613,7 +54943,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
54613
54943
  var debug_1 = __importDefault(require_src());
54614
54944
  var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
54615
54945
  function parseProxyResponse(socket) {
54616
- return new Promise((resolve10, reject) => {
54946
+ return new Promise((resolve9, reject) => {
54617
54947
  let buffersLength = 0;
54618
54948
  const buffers = [];
54619
54949
  function read() {
@@ -54682,7 +55012,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
54682
55012
  }
54683
55013
  debug2("got proxy server response: %o %o", firstLine, headers);
54684
55014
  cleanup();
54685
- resolve10({
55015
+ resolve9({
54686
55016
  connect: {
54687
55017
  statusCode,
54688
55018
  statusText,
@@ -56786,11 +57116,11 @@ var require_receivebuffer = __commonJS((exports) => {
56786
57116
  var require_socksclient = __commonJS((exports) => {
56787
57117
  var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
56788
57118
  function adopt(value) {
56789
- return value instanceof P ? value : new P(function(resolve10) {
56790
- resolve10(value);
57119
+ return value instanceof P ? value : new P(function(resolve9) {
57120
+ resolve9(value);
56791
57121
  });
56792
57122
  }
56793
- return new (P || (P = Promise))(function(resolve10, reject) {
57123
+ return new (P || (P = Promise))(function(resolve9, reject) {
56794
57124
  function fulfilled(value) {
56795
57125
  try {
56796
57126
  step(generator.next(value));
@@ -56806,7 +57136,7 @@ var require_socksclient = __commonJS((exports) => {
56806
57136
  }
56807
57137
  }
56808
57138
  function step(result) {
56809
- result.done ? resolve10(result.value) : adopt(result.value).then(fulfilled, rejected);
57139
+ result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
56810
57140
  }
56811
57141
  step((generator = generator.apply(thisArg, _arguments || [])).next());
56812
57142
  });
@@ -56833,13 +57163,13 @@ var require_socksclient = __commonJS((exports) => {
56833
57163
  this.setState(constants_1.SocksClientState.Created);
56834
57164
  }
56835
57165
  static createConnection(options, callback) {
56836
- return new Promise((resolve10, reject) => {
57166
+ return new Promise((resolve9, reject) => {
56837
57167
  try {
56838
57168
  (0, helpers_1.validateSocksClientOptions)(options, ["connect"]);
56839
57169
  } catch (err) {
56840
57170
  if (typeof callback === "function") {
56841
57171
  callback(err);
56842
- return resolve10(err);
57172
+ return resolve9(err);
56843
57173
  } else {
56844
57174
  return reject(err);
56845
57175
  }
@@ -56850,16 +57180,16 @@ var require_socksclient = __commonJS((exports) => {
56850
57180
  client.removeAllListeners();
56851
57181
  if (typeof callback === "function") {
56852
57182
  callback(null, info);
56853
- resolve10(info);
57183
+ resolve9(info);
56854
57184
  } else {
56855
- resolve10(info);
57185
+ resolve9(info);
56856
57186
  }
56857
57187
  });
56858
57188
  client.once("error", (err) => {
56859
57189
  client.removeAllListeners();
56860
57190
  if (typeof callback === "function") {
56861
57191
  callback(err);
56862
- resolve10(err);
57192
+ resolve9(err);
56863
57193
  } else {
56864
57194
  reject(err);
56865
57195
  }
@@ -56867,13 +57197,13 @@ var require_socksclient = __commonJS((exports) => {
56867
57197
  });
56868
57198
  }
56869
57199
  static createConnectionChain(options, callback) {
56870
- return new Promise((resolve10, reject) => __awaiter2(this, undefined, undefined, function* () {
57200
+ return new Promise((resolve9, reject) => __awaiter2(this, undefined, undefined, function* () {
56871
57201
  try {
56872
57202
  (0, helpers_1.validateSocksClientChainOptions)(options);
56873
57203
  } catch (err) {
56874
57204
  if (typeof callback === "function") {
56875
57205
  callback(err);
56876
- return resolve10(err);
57206
+ return resolve9(err);
56877
57207
  } else {
56878
57208
  return reject(err);
56879
57209
  }
@@ -56899,14 +57229,14 @@ var require_socksclient = __commonJS((exports) => {
56899
57229
  }
56900
57230
  if (typeof callback === "function") {
56901
57231
  callback(null, { socket: sock });
56902
- resolve10({ socket: sock });
57232
+ resolve9({ socket: sock });
56903
57233
  } else {
56904
- resolve10({ socket: sock });
57234
+ resolve9({ socket: sock });
56905
57235
  }
56906
57236
  } catch (err) {
56907
57237
  if (typeof callback === "function") {
56908
57238
  callback(err);
56909
- resolve10(err);
57239
+ resolve9(err);
56910
57240
  } else {
56911
57241
  reject(err);
56912
57242
  }
@@ -57506,12 +57836,12 @@ var require_dist4 = __commonJS((exports) => {
57506
57836
  let { host } = opts;
57507
57837
  const { port, lookup: lookupFn = dns.lookup } = opts;
57508
57838
  if (shouldLookup) {
57509
- host = await new Promise((resolve10, reject) => {
57839
+ host = await new Promise((resolve9, reject) => {
57510
57840
  lookupFn(host, {}, (err, res) => {
57511
57841
  if (err) {
57512
57842
  reject(err);
57513
57843
  } else {
57514
- resolve10(res);
57844
+ resolve9(res);
57515
57845
  }
57516
57846
  });
57517
57847
  });
@@ -58518,7 +58848,7 @@ var require_netUtils = __commonJS((exports) => {
58518
58848
  return `${socket.remoteAddress}:${socket.remotePort}`;
58519
58849
  }
58520
58850
  function upgradeSocket(socket, options) {
58521
- return new Promise((resolve10, reject) => {
58851
+ return new Promise((resolve9, reject) => {
58522
58852
  const tlsOptions = Object.assign({}, options, {
58523
58853
  socket
58524
58854
  });
@@ -58528,7 +58858,7 @@ var require_netUtils = __commonJS((exports) => {
58528
58858
  reject(tlsSocket.authorizationError);
58529
58859
  } else {
58530
58860
  tlsSocket.removeAllListeners("error");
58531
- resolve10(tlsSocket);
58861
+ resolve9(tlsSocket);
58532
58862
  }
58533
58863
  }).once("error", (error) => {
58534
58864
  reject(error);
@@ -58620,7 +58950,7 @@ var require_transfer = __commonJS((exports) => {
58620
58950
  };
58621
58951
  }
58622
58952
  function connectForPassiveTransfer(host, port, ftp) {
58623
- return new Promise((resolve10, reject) => {
58953
+ return new Promise((resolve9, reject) => {
58624
58954
  let socket = ftp._newSocket();
58625
58955
  const handleConnErr = function(err) {
58626
58956
  err.message = "Can't open data connection in passive mode: " + err.message;
@@ -58643,7 +58973,7 @@ var require_transfer = __commonJS((exports) => {
58643
58973
  socket.removeListener("error", handleConnErr);
58644
58974
  socket.removeListener("timeout", handleTimeout);
58645
58975
  ftp.dataSocket = socket;
58646
- resolve10();
58976
+ resolve9();
58647
58977
  });
58648
58978
  });
58649
58979
  }
@@ -60721,7 +61051,7 @@ var require_util2 = __commonJS((exports) => {
60721
61051
  return path;
60722
61052
  }
60723
61053
  exports.normalize = normalize2;
60724
- function join34(aRoot, aPath) {
61054
+ function join32(aRoot, aPath) {
60725
61055
  if (aRoot === "") {
60726
61056
  aRoot = ".";
60727
61057
  }
@@ -60753,7 +61083,7 @@ var require_util2 = __commonJS((exports) => {
60753
61083
  }
60754
61084
  return joined;
60755
61085
  }
60756
- exports.join = join34;
61086
+ exports.join = join32;
60757
61087
  exports.isAbsolute = function(aPath) {
60758
61088
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
60759
61089
  };
@@ -60926,7 +61256,7 @@ var require_util2 = __commonJS((exports) => {
60926
61256
  parsed.path = parsed.path.substring(0, index + 1);
60927
61257
  }
60928
61258
  }
60929
- sourceURL = join34(urlGenerate(parsed), sourceURL);
61259
+ sourceURL = join32(urlGenerate(parsed), sourceURL);
60930
61260
  }
60931
61261
  return normalize2(sourceURL);
60932
61262
  }
@@ -62658,7 +62988,7 @@ var require_escodegen = __commonJS((exports) => {
62658
62988
  function noEmptySpace() {
62659
62989
  return space ? space : " ";
62660
62990
  }
62661
- function join34(left, right) {
62991
+ function join32(left, right) {
62662
62992
  var leftSource, rightSource, leftCharCode, rightCharCode;
62663
62993
  leftSource = toSourceNodeWhenNeeded(left).toString();
62664
62994
  if (leftSource.length === 0) {
@@ -62999,8 +63329,8 @@ var require_escodegen = __commonJS((exports) => {
62999
63329
  } else {
63000
63330
  result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT));
63001
63331
  }
63002
- result = join34(result, operator);
63003
- result = [join34(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
63332
+ result = join32(result, operator);
63333
+ result = [join32(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
63004
63334
  });
63005
63335
  result.push(this.maybeBlock(stmt.body, flags));
63006
63336
  return result;
@@ -63138,11 +63468,11 @@ var require_escodegen = __commonJS((exports) => {
63138
63468
  var result, fragment;
63139
63469
  result = ["class"];
63140
63470
  if (stmt.id) {
63141
- result = join34(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
63471
+ result = join32(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
63142
63472
  }
63143
63473
  if (stmt.superClass) {
63144
- fragment = join34("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
63145
- result = join34(result, fragment);
63474
+ fragment = join32("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
63475
+ result = join32(result, fragment);
63146
63476
  }
63147
63477
  result.push(space);
63148
63478
  result.push(this.generateStatement(stmt.body, S_TFFT));
@@ -63155,9 +63485,9 @@ var require_escodegen = __commonJS((exports) => {
63155
63485
  return escapeDirective(stmt.directive) + this.semicolon(flags);
63156
63486
  },
63157
63487
  DoWhileStatement: function(stmt, flags) {
63158
- var result = join34("do", this.maybeBlock(stmt.body, S_TFFF));
63488
+ var result = join32("do", this.maybeBlock(stmt.body, S_TFFF));
63159
63489
  result = this.maybeBlockSuffix(stmt.body, result);
63160
- return join34(result, [
63490
+ return join32(result, [
63161
63491
  "while" + space + "(",
63162
63492
  this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
63163
63493
  ")" + this.semicolon(flags)
@@ -63193,11 +63523,11 @@ var require_escodegen = __commonJS((exports) => {
63193
63523
  ExportDefaultDeclaration: function(stmt, flags) {
63194
63524
  var result = ["export"], bodyFlags;
63195
63525
  bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
63196
- result = join34(result, "default");
63526
+ result = join32(result, "default");
63197
63527
  if (isStatement(stmt.declaration)) {
63198
- result = join34(result, this.generateStatement(stmt.declaration, bodyFlags));
63528
+ result = join32(result, this.generateStatement(stmt.declaration, bodyFlags));
63199
63529
  } else {
63200
- result = join34(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
63530
+ result = join32(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
63201
63531
  }
63202
63532
  return result;
63203
63533
  },
@@ -63205,15 +63535,15 @@ var require_escodegen = __commonJS((exports) => {
63205
63535
  var result = ["export"], bodyFlags, that = this;
63206
63536
  bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
63207
63537
  if (stmt.declaration) {
63208
- return join34(result, this.generateStatement(stmt.declaration, bodyFlags));
63538
+ return join32(result, this.generateStatement(stmt.declaration, bodyFlags));
63209
63539
  }
63210
63540
  if (stmt.specifiers) {
63211
63541
  if (stmt.specifiers.length === 0) {
63212
- result = join34(result, "{" + space + "}");
63542
+ result = join32(result, "{" + space + "}");
63213
63543
  } else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) {
63214
- result = join34(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
63544
+ result = join32(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
63215
63545
  } else {
63216
- result = join34(result, "{");
63546
+ result = join32(result, "{");
63217
63547
  withIndent(function(indent2) {
63218
63548
  var i, iz;
63219
63549
  result.push(newline);
@@ -63231,7 +63561,7 @@ var require_escodegen = __commonJS((exports) => {
63231
63561
  result.push(base + "}");
63232
63562
  }
63233
63563
  if (stmt.source) {
63234
- result = join34(result, [
63564
+ result = join32(result, [
63235
63565
  "from" + space,
63236
63566
  this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
63237
63567
  this.semicolon(flags)
@@ -63315,7 +63645,7 @@ var require_escodegen = __commonJS((exports) => {
63315
63645
  ];
63316
63646
  cursor = 0;
63317
63647
  if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) {
63318
- result = join34(result, [
63648
+ result = join32(result, [
63319
63649
  this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
63320
63650
  ]);
63321
63651
  ++cursor;
@@ -63325,7 +63655,7 @@ var require_escodegen = __commonJS((exports) => {
63325
63655
  result.push(",");
63326
63656
  }
63327
63657
  if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) {
63328
- result = join34(result, [
63658
+ result = join32(result, [
63329
63659
  space,
63330
63660
  this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
63331
63661
  ]);
@@ -63354,7 +63684,7 @@ var require_escodegen = __commonJS((exports) => {
63354
63684
  }
63355
63685
  }
63356
63686
  }
63357
- result = join34(result, [
63687
+ result = join32(result, [
63358
63688
  "from" + space,
63359
63689
  this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
63360
63690
  this.semicolon(flags)
@@ -63408,7 +63738,7 @@ var require_escodegen = __commonJS((exports) => {
63408
63738
  return result;
63409
63739
  },
63410
63740
  ThrowStatement: function(stmt, flags) {
63411
- return [join34("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
63741
+ return [join32("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
63412
63742
  },
63413
63743
  TryStatement: function(stmt, flags) {
63414
63744
  var result, i, iz, guardedHandlers;
@@ -63416,7 +63746,7 @@ var require_escodegen = __commonJS((exports) => {
63416
63746
  result = this.maybeBlockSuffix(stmt.block, result);
63417
63747
  if (stmt.handlers) {
63418
63748
  for (i = 0, iz = stmt.handlers.length;i < iz; ++i) {
63419
- result = join34(result, this.generateStatement(stmt.handlers[i], S_TFFF));
63749
+ result = join32(result, this.generateStatement(stmt.handlers[i], S_TFFF));
63420
63750
  if (stmt.finalizer || i + 1 !== iz) {
63421
63751
  result = this.maybeBlockSuffix(stmt.handlers[i].body, result);
63422
63752
  }
@@ -63424,7 +63754,7 @@ var require_escodegen = __commonJS((exports) => {
63424
63754
  } else {
63425
63755
  guardedHandlers = stmt.guardedHandlers || [];
63426
63756
  for (i = 0, iz = guardedHandlers.length;i < iz; ++i) {
63427
- result = join34(result, this.generateStatement(guardedHandlers[i], S_TFFF));
63757
+ result = join32(result, this.generateStatement(guardedHandlers[i], S_TFFF));
63428
63758
  if (stmt.finalizer || i + 1 !== iz) {
63429
63759
  result = this.maybeBlockSuffix(guardedHandlers[i].body, result);
63430
63760
  }
@@ -63432,13 +63762,13 @@ var require_escodegen = __commonJS((exports) => {
63432
63762
  if (stmt.handler) {
63433
63763
  if (Array.isArray(stmt.handler)) {
63434
63764
  for (i = 0, iz = stmt.handler.length;i < iz; ++i) {
63435
- result = join34(result, this.generateStatement(stmt.handler[i], S_TFFF));
63765
+ result = join32(result, this.generateStatement(stmt.handler[i], S_TFFF));
63436
63766
  if (stmt.finalizer || i + 1 !== iz) {
63437
63767
  result = this.maybeBlockSuffix(stmt.handler[i].body, result);
63438
63768
  }
63439
63769
  }
63440
63770
  } else {
63441
- result = join34(result, this.generateStatement(stmt.handler, S_TFFF));
63771
+ result = join32(result, this.generateStatement(stmt.handler, S_TFFF));
63442
63772
  if (stmt.finalizer) {
63443
63773
  result = this.maybeBlockSuffix(stmt.handler.body, result);
63444
63774
  }
@@ -63446,7 +63776,7 @@ var require_escodegen = __commonJS((exports) => {
63446
63776
  }
63447
63777
  }
63448
63778
  if (stmt.finalizer) {
63449
- result = join34(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
63779
+ result = join32(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
63450
63780
  }
63451
63781
  return result;
63452
63782
  },
@@ -63480,7 +63810,7 @@ var require_escodegen = __commonJS((exports) => {
63480
63810
  withIndent(function() {
63481
63811
  if (stmt.test) {
63482
63812
  result = [
63483
- join34("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
63813
+ join32("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
63484
63814
  ":"
63485
63815
  ];
63486
63816
  } else {
@@ -63528,9 +63858,9 @@ var require_escodegen = __commonJS((exports) => {
63528
63858
  result.push(this.maybeBlock(stmt.consequent, S_TFFF));
63529
63859
  result = this.maybeBlockSuffix(stmt.consequent, result);
63530
63860
  if (stmt.alternate.type === Syntax.IfStatement) {
63531
- result = join34(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
63861
+ result = join32(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
63532
63862
  } else {
63533
- result = join34(result, join34("else", this.maybeBlock(stmt.alternate, bodyFlags)));
63863
+ result = join32(result, join32("else", this.maybeBlock(stmt.alternate, bodyFlags)));
63534
63864
  }
63535
63865
  } else {
63536
63866
  result.push(this.maybeBlock(stmt.consequent, bodyFlags));
@@ -63632,7 +63962,7 @@ var require_escodegen = __commonJS((exports) => {
63632
63962
  },
63633
63963
  ReturnStatement: function(stmt, flags) {
63634
63964
  if (stmt.argument) {
63635
- return [join34("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
63965
+ return [join32("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
63636
63966
  }
63637
63967
  return ["return" + this.semicolon(flags)];
63638
63968
  },
@@ -63714,14 +64044,14 @@ var require_escodegen = __commonJS((exports) => {
63714
64044
  if (leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) {
63715
64045
  result = [fragment, noEmptySpace(), expr.operator];
63716
64046
  } else {
63717
- result = join34(fragment, expr.operator);
64047
+ result = join32(fragment, expr.operator);
63718
64048
  }
63719
64049
  fragment = this.generateExpression(expr.right, rightPrecedence, flags);
63720
64050
  if (expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--") {
63721
64051
  result.push(noEmptySpace());
63722
64052
  result.push(fragment);
63723
64053
  } else {
63724
- result = join34(result, fragment);
64054
+ result = join32(result, fragment);
63725
64055
  }
63726
64056
  if (expr.operator === "in" && !(flags & F_ALLOW_IN)) {
63727
64057
  return ["(", result, ")"];
@@ -63761,7 +64091,7 @@ var require_escodegen = __commonJS((exports) => {
63761
64091
  var result, length, i, iz, itemFlags;
63762
64092
  length = expr["arguments"].length;
63763
64093
  itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF;
63764
- result = join34("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
64094
+ result = join32("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
63765
64095
  if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
63766
64096
  result.push("(");
63767
64097
  for (i = 0, iz = length;i < iz; ++i) {
@@ -63808,11 +64138,11 @@ var require_escodegen = __commonJS((exports) => {
63808
64138
  var result, fragment, rightCharCode, leftSource, leftCharCode;
63809
64139
  fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT);
63810
64140
  if (space === "") {
63811
- result = join34(expr.operator, fragment);
64141
+ result = join32(expr.operator, fragment);
63812
64142
  } else {
63813
64143
  result = [expr.operator];
63814
64144
  if (expr.operator.length > 2) {
63815
- result = join34(result, fragment);
64145
+ result = join32(result, fragment);
63816
64146
  } else {
63817
64147
  leftSource = toSourceNodeWhenNeeded(result).toString();
63818
64148
  leftCharCode = leftSource.charCodeAt(leftSource.length - 1);
@@ -63835,12 +64165,12 @@ var require_escodegen = __commonJS((exports) => {
63835
64165
  result = "yield";
63836
64166
  }
63837
64167
  if (expr.argument) {
63838
- result = join34(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
64168
+ result = join32(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
63839
64169
  }
63840
64170
  return parenthesize(result, Precedence.Yield, precedence);
63841
64171
  },
63842
64172
  AwaitExpression: function(expr, precedence, flags) {
63843
- var result = join34(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
64173
+ var result = join32(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
63844
64174
  return parenthesize(result, Precedence.Await, precedence);
63845
64175
  },
63846
64176
  UpdateExpression: function(expr, precedence, flags) {
@@ -63912,11 +64242,11 @@ var require_escodegen = __commonJS((exports) => {
63912
64242
  var result, fragment;
63913
64243
  result = ["class"];
63914
64244
  if (expr.id) {
63915
- result = join34(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
64245
+ result = join32(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
63916
64246
  }
63917
64247
  if (expr.superClass) {
63918
- fragment = join34("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
63919
- result = join34(result, fragment);
64248
+ fragment = join32("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
64249
+ result = join32(result, fragment);
63920
64250
  }
63921
64251
  result.push(space);
63922
64252
  result.push(this.generateStatement(expr.body, S_TFFT));
@@ -63931,7 +64261,7 @@ var require_escodegen = __commonJS((exports) => {
63931
64261
  }
63932
64262
  if (expr.kind === "get" || expr.kind === "set") {
63933
64263
  fragment = [
63934
- join34(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
64264
+ join32(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
63935
64265
  this.generateFunctionBody(expr.value)
63936
64266
  ];
63937
64267
  } else {
@@ -63941,7 +64271,7 @@ var require_escodegen = __commonJS((exports) => {
63941
64271
  this.generateFunctionBody(expr.value)
63942
64272
  ];
63943
64273
  }
63944
- return join34(result, fragment);
64274
+ return join32(result, fragment);
63945
64275
  },
63946
64276
  Property: function(expr, precedence, flags) {
63947
64277
  if (expr.kind === "get" || expr.kind === "set") {
@@ -64135,7 +64465,7 @@ var require_escodegen = __commonJS((exports) => {
64135
64465
  for (i = 0, iz = expr.blocks.length;i < iz; ++i) {
64136
64466
  fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT);
64137
64467
  if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) {
64138
- result = join34(result, fragment);
64468
+ result = join32(result, fragment);
64139
64469
  } else {
64140
64470
  result.push(fragment);
64141
64471
  }
@@ -64143,13 +64473,13 @@ var require_escodegen = __commonJS((exports) => {
64143
64473
  });
64144
64474
  }
64145
64475
  if (expr.filter) {
64146
- result = join34(result, "if" + space);
64476
+ result = join32(result, "if" + space);
64147
64477
  fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT);
64148
- result = join34(result, ["(", fragment, ")"]);
64478
+ result = join32(result, ["(", fragment, ")"]);
64149
64479
  }
64150
64480
  if (!extra.moz.comprehensionExpressionStartsWithAssignment) {
64151
64481
  fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
64152
- result = join34(result, fragment);
64482
+ result = join32(result, fragment);
64153
64483
  }
64154
64484
  result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]");
64155
64485
  return result;
@@ -64165,8 +64495,8 @@ var require_escodegen = __commonJS((exports) => {
64165
64495
  } else {
64166
64496
  fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT);
64167
64497
  }
64168
- fragment = join34(fragment, expr.of ? "of" : "in");
64169
- fragment = join34(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
64498
+ fragment = join32(fragment, expr.of ? "of" : "in");
64499
+ fragment = join32(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
64170
64500
  return ["for" + space + "(", fragment, ")"];
64171
64501
  },
64172
64502
  SpreadElement: function(expr, precedence, flags) {
@@ -70654,11 +70984,11 @@ var require_tslib = __commonJS((exports, module) => {
70654
70984
  };
70655
70985
  __awaiter2 = function(thisArg, _arguments, P, generator) {
70656
70986
  function adopt(value) {
70657
- return value instanceof P ? value : new P(function(resolve10) {
70658
- resolve10(value);
70987
+ return value instanceof P ? value : new P(function(resolve9) {
70988
+ resolve9(value);
70659
70989
  });
70660
70990
  }
70661
- return new (P || (P = Promise))(function(resolve10, reject) {
70991
+ return new (P || (P = Promise))(function(resolve9, reject) {
70662
70992
  function fulfilled(value) {
70663
70993
  try {
70664
70994
  step(generator.next(value));
@@ -70674,7 +71004,7 @@ var require_tslib = __commonJS((exports, module) => {
70674
71004
  }
70675
71005
  }
70676
71006
  function step(result) {
70677
- result.done ? resolve10(result.value) : adopt(result.value).then(fulfilled, rejected);
71007
+ result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
70678
71008
  }
70679
71009
  step((generator = generator.apply(thisArg, _arguments || [])).next());
70680
71010
  });
@@ -70903,14 +71233,14 @@ var require_tslib = __commonJS((exports, module) => {
70903
71233
  }, i);
70904
71234
  function verb(n) {
70905
71235
  i[n] = o[n] && function(v) {
70906
- return new Promise(function(resolve10, reject) {
70907
- v = o[n](v), settle(resolve10, reject, v.done, v.value);
71236
+ return new Promise(function(resolve9, reject) {
71237
+ v = o[n](v), settle(resolve9, reject, v.done, v.value);
70908
71238
  });
70909
71239
  };
70910
71240
  }
70911
- function settle(resolve10, reject, d, v) {
71241
+ function settle(resolve9, reject, d, v) {
70912
71242
  Promise.resolve(v).then(function(v2) {
70913
- resolve10({ value: v2, done: d });
71243
+ resolve9({ value: v2, done: d });
70914
71244
  }, reject);
70915
71245
  }
70916
71246
  };
@@ -74149,12 +74479,12 @@ var require_util3 = __commonJS((exports) => {
74149
74479
  exports.isGMT = exports.dnsLookup = undefined;
74150
74480
  var dns_1 = __require("dns");
74151
74481
  function dnsLookup(host, opts) {
74152
- return new Promise((resolve10, reject) => {
74482
+ return new Promise((resolve9, reject) => {
74153
74483
  (0, dns_1.lookup)(host, opts, (err, res) => {
74154
74484
  if (err) {
74155
74485
  reject(err);
74156
74486
  } else {
74157
- resolve10(res);
74487
+ resolve9(res);
74158
74488
  }
74159
74489
  });
74160
74490
  });
@@ -74728,10 +75058,10 @@ var require_myIpAddress = __commonJS((exports) => {
74728
75058
  var ip_1 = require_ip();
74729
75059
  var net_1 = __importDefault(__require("net"));
74730
75060
  async function myIpAddress() {
74731
- return new Promise((resolve10, reject) => {
75061
+ return new Promise((resolve9, reject) => {
74732
75062
  const socket = net_1.default.connect({ host: "8.8.8.8", port: 53 });
74733
75063
  const onError = () => {
74734
- resolve10(ip_1.ip.address());
75064
+ resolve9(ip_1.ip.address());
74735
75065
  };
74736
75066
  socket.once("error", onError);
74737
75067
  socket.once("connect", () => {
@@ -74739,9 +75069,9 @@ var require_myIpAddress = __commonJS((exports) => {
74739
75069
  const addr = socket.address();
74740
75070
  socket.destroy();
74741
75071
  if (typeof addr === "string") {
74742
- resolve10(addr);
75072
+ resolve9(addr);
74743
75073
  } else if (addr.address) {
74744
- resolve10(addr.address);
75074
+ resolve9(addr.address);
74745
75075
  } else {
74746
75076
  reject(new Error("Expected a `string`"));
74747
75077
  }
@@ -75255,8 +75585,8 @@ var require_deferred_promise = __commonJS((exports) => {
75255
75585
  this.context = args.context;
75256
75586
  this.owner = args.context.runtime;
75257
75587
  this.handle = args.promiseHandle;
75258
- this.settled = new Promise((resolve10) => {
75259
- this.onSettled = resolve10;
75588
+ this.settled = new Promise((resolve9) => {
75589
+ this.onSettled = resolve9;
75260
75590
  });
75261
75591
  this.resolveHandle = args.resolveHandle;
75262
75592
  this.rejectHandle = args.rejectHandle;
@@ -75648,13 +75978,13 @@ var require_context = __commonJS((exports) => {
75648
75978
  if (vmResolveResult.error) {
75649
75979
  return Promise.resolve(vmResolveResult);
75650
75980
  }
75651
- return new Promise((resolve10) => {
75981
+ return new Promise((resolve9) => {
75652
75982
  lifetime_1.Scope.withScope((scope) => {
75653
75983
  const resolveHandle = scope.manage(this.newFunction("resolve", (value) => {
75654
- resolve10({ value: value && value.dup() });
75984
+ resolve9({ value: value && value.dup() });
75655
75985
  }));
75656
75986
  const rejectHandle = scope.manage(this.newFunction("reject", (error) => {
75657
- resolve10({ error: error && error.dup() });
75987
+ resolve9({ error: error && error.dup() });
75658
75988
  }));
75659
75989
  const promiseHandle = scope.manage(vmResolveResult.value);
75660
75990
  const promiseThenHandle = scope.manage(this.getProp(promiseHandle, "then"));
@@ -77486,7 +77816,7 @@ var require_dist10 = __commonJS((exports) => {
77486
77816
  exports.PacProxyAgent = undefined;
77487
77817
  var net = __importStar(__require("net"));
77488
77818
  var tls = __importStar(__require("tls"));
77489
- var crypto = __importStar(__require("crypto"));
77819
+ var crypto2 = __importStar(__require("crypto"));
77490
77820
  var events_1 = __require("events");
77491
77821
  var debug_1 = __importDefault(require_src());
77492
77822
  var url_1 = __require("url");
@@ -77536,7 +77866,7 @@ var require_dist10 = __commonJS((exports) => {
77536
77866
  (0, quickjs_emscripten_1.getQuickJS)(),
77537
77867
  this.loadPacFile()
77538
77868
  ]);
77539
- const hash = crypto.createHash("sha1").update(code).digest("hex");
77869
+ const hash = crypto2.createHash("sha1").update(code).digest("hex");
77540
77870
  if (this.resolver && this.resolverHash === hash) {
77541
77871
  debug2("Same sha1 hash for code - contents have not changed, reusing previous proxy resolver");
77542
77872
  return this.resolver;
@@ -77768,13 +78098,13 @@ import * as http from "node:http";
77768
78098
  import * as https from "node:https";
77769
78099
  import { URL as URL2, urlToHttpOptions } from "node:url";
77770
78100
  function headHttpRequest(url) {
77771
- return new Promise((resolve10) => {
78101
+ return new Promise((resolve9) => {
77772
78102
  const request3 = httpRequest(url, "HEAD", (response) => {
77773
78103
  response.resume();
77774
- resolve10(response.statusCode === 200);
78104
+ resolve9(response.statusCode === 200);
77775
78105
  }, false);
77776
78106
  request3.on("error", () => {
77777
- resolve10(false);
78107
+ resolve9(false);
77778
78108
  });
77779
78109
  });
77780
78110
  }
@@ -77802,7 +78132,7 @@ function httpRequest(url, method, response, keepAlive = true) {
77802
78132
  return request3;
77803
78133
  }
77804
78134
  function downloadFile(url, destinationPath, progressCallback) {
77805
- return new Promise((resolve10, reject) => {
78135
+ return new Promise((resolve9, reject) => {
77806
78136
  let downloadedBytes = 0;
77807
78137
  let totalBytes = 0;
77808
78138
  function onData(chunk) {
@@ -77818,7 +78148,7 @@ function downloadFile(url, destinationPath, progressCallback) {
77818
78148
  }
77819
78149
  const file = createWriteStream(destinationPath);
77820
78150
  file.on("close", () => {
77821
- return resolve10();
78151
+ return resolve9();
77822
78152
  });
77823
78153
  file.on("error", (error) => {
77824
78154
  return reject(error);
@@ -77843,7 +78173,7 @@ async function getJSON(url) {
77843
78173
  }
77844
78174
  }
77845
78175
  function getText(url) {
77846
- return new Promise((resolve10, reject) => {
78176
+ return new Promise((resolve9, reject) => {
77847
78177
  const request3 = httpRequest(url, "GET", (response) => {
77848
78178
  let data = "";
77849
78179
  if (response.statusCode && response.statusCode >= 400) {
@@ -77854,7 +78184,7 @@ function getText(url) {
77854
78184
  });
77855
78185
  response.on("end", () => {
77856
78186
  try {
77857
- return resolve10(String(data));
78187
+ return resolve9(String(data));
77858
78188
  } catch {
77859
78189
  return reject(new Error(`Failed to read text response from ${url}`));
77860
78190
  }
@@ -77871,7 +78201,7 @@ var init_httpUtil = __esm(() => {
77871
78201
  });
77872
78202
 
77873
78203
  // node_modules/@puppeteer/browsers/lib/esm/browser-data/chrome.js
77874
- import { execSync as execSync9 } from "node:child_process";
78204
+ import { execSync as execSync8 } from "node:child_process";
77875
78205
  import os from "node:os";
77876
78206
  import path from "node:path";
77877
78207
  function folder(platform2) {
@@ -77961,7 +78291,7 @@ function getChromeWindowsLocation(channel2, locationsPrefixes) {
77961
78291
  }
77962
78292
  function getWslVariable(variable) {
77963
78293
  try {
77964
- const result = execSync9(`cmd.exe /c echo %${variable.toLocaleUpperCase()}%`, {
78294
+ const result = execSync8(`cmd.exe /c echo %${variable.toLocaleUpperCase()}%`, {
77965
78295
  stdio: ["ignore", "pipe", "ignore"],
77966
78296
  encoding: "utf-8"
77967
78297
  }).trim();
@@ -77972,7 +78302,7 @@ function getWslVariable(variable) {
77972
78302
  return;
77973
78303
  }
77974
78304
  function getWslLocation(channel2) {
77975
- const wslVersion = execSync9("wslinfo --version", {
78305
+ const wslVersion = execSync8("wslinfo --version", {
77976
78306
  stdio: ["ignore", "pipe", "ignore"],
77977
78307
  encoding: "utf-8"
77978
78308
  }).trim();
@@ -77988,7 +78318,7 @@ function getWslLocation(channel2) {
77988
78318
  }
77989
78319
  const windowsPath = getChromeWindowsLocation(channel2, wslPrefixes);
77990
78320
  return windowsPath.map((path2) => {
77991
- return execSync9(`wslpath "${path2}"`).toString().trim();
78321
+ return execSync8(`wslpath "${path2}"`).toString().trim();
77992
78322
  });
77993
78323
  }
77994
78324
  function getChromeLinuxOrWslLocation(channel2) {
@@ -79075,7 +79405,7 @@ class Process {
79075
79405
  if (opts.onExit) {
79076
79406
  this.#onExitHook = opts.onExit;
79077
79407
  }
79078
- this.#browserProcessExiting = new Promise((resolve10, reject) => {
79408
+ this.#browserProcessExiting = new Promise((resolve9, reject) => {
79079
79409
  this.#browserProcess.once("exit", async () => {
79080
79410
  debugLaunch(`Browser process ${this.#browserProcess.pid} onExit`);
79081
79411
  this.#clearListeners();
@@ -79086,7 +79416,7 @@ class Process {
79086
79416
  reject(err);
79087
79417
  return;
79088
79418
  }
79089
- resolve10();
79419
+ resolve9();
79090
79420
  });
79091
79421
  });
79092
79422
  }
@@ -79196,7 +79526,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
79196
79526
  return [...this.#logs];
79197
79527
  }
79198
79528
  waitForLineOutput(regex, timeout2 = 0) {
79199
- return new Promise((resolve10, reject) => {
79529
+ return new Promise((resolve9, reject) => {
79200
79530
  const onClose = (errorOrCode) => {
79201
79531
  cleanup();
79202
79532
  reject(new Error([
@@ -79234,7 +79564,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
79234
79564
  return;
79235
79565
  }
79236
79566
  cleanup();
79237
- resolve10(match[1]);
79567
+ resolve9(match[1]);
79238
79568
  }
79239
79569
  });
79240
79570
  }
@@ -79764,7 +80094,7 @@ var require_get_stream = __commonJS((exports, module) => {
79764
80094
  };
79765
80095
  const { maxBuffer } = options;
79766
80096
  let stream;
79767
- await new Promise((resolve10, reject) => {
80097
+ await new Promise((resolve9, reject) => {
79768
80098
  const rejectPromise = (error) => {
79769
80099
  if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
79770
80100
  error.bufferedData = stream.getBufferedValue();
@@ -79776,7 +80106,7 @@ var require_get_stream = __commonJS((exports, module) => {
79776
80106
  rejectPromise(error);
79777
80107
  return;
79778
80108
  }
79779
- resolve10();
80109
+ resolve9();
79780
80110
  });
79781
80111
  stream.on("data", () => {
79782
80112
  if (stream.getBufferedLength() > maxBuffer) {
@@ -81137,7 +81467,7 @@ var require_extract_zip = __commonJS((exports, module) => {
81137
81467
  debug4("opening", this.zipPath, "with opts", this.opts);
81138
81468
  this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
81139
81469
  this.canceled = false;
81140
- return new Promise((resolve10, reject) => {
81470
+ return new Promise((resolve9, reject) => {
81141
81471
  this.zipfile.on("error", (err) => {
81142
81472
  this.canceled = true;
81143
81473
  reject(err);
@@ -81146,7 +81476,7 @@ var require_extract_zip = __commonJS((exports, module) => {
81146
81476
  this.zipfile.on("close", () => {
81147
81477
  if (!this.canceled) {
81148
81478
  debug4("zip extraction complete");
81149
- resolve10();
81479
+ resolve9();
81150
81480
  }
81151
81481
  });
81152
81482
  this.zipfile.on("entry", async (entry) => {
@@ -82488,8 +82818,8 @@ var require_streamx = __commonJS((exports, module) => {
82488
82818
  return this;
82489
82819
  },
82490
82820
  next() {
82491
- return new Promise(function(resolve10, reject) {
82492
- promiseResolve = resolve10;
82821
+ return new Promise(function(resolve9, reject) {
82822
+ promiseResolve = resolve9;
82493
82823
  promiseReject = reject;
82494
82824
  const data = stream.read();
82495
82825
  if (data !== null)
@@ -82526,14 +82856,14 @@ var require_streamx = __commonJS((exports, module) => {
82526
82856
  }
82527
82857
  function destroy(err) {
82528
82858
  stream.destroy(err);
82529
- return new Promise((resolve10, reject) => {
82859
+ return new Promise((resolve9, reject) => {
82530
82860
  if (stream._duplexState & DESTROYED)
82531
- return resolve10({ value: undefined, done: true });
82861
+ return resolve9({ value: undefined, done: true });
82532
82862
  stream.once("close", function() {
82533
82863
  if (err)
82534
82864
  reject(err);
82535
82865
  else
82536
- resolve10({ value: undefined, done: true });
82866
+ resolve9({ value: undefined, done: true });
82537
82867
  });
82538
82868
  });
82539
82869
  }
@@ -82585,8 +82915,8 @@ var require_streamx = __commonJS((exports, module) => {
82585
82915
  return Promise.resolve(true);
82586
82916
  if (state.drains === null)
82587
82917
  state.drains = [];
82588
- return new Promise((resolve10) => {
82589
- state.drains.push({ writes, resolve: resolve10 });
82918
+ return new Promise((resolve9) => {
82919
+ state.drains.push({ writes, resolve: resolve9 });
82590
82920
  });
82591
82921
  }
82592
82922
  write(data) {
@@ -82700,11 +83030,11 @@ var require_streamx = __commonJS((exports, module) => {
82700
83030
  cb(null);
82701
83031
  }
82702
83032
  function pipelinePromise(...streams) {
82703
- return new Promise((resolve10, reject) => {
83033
+ return new Promise((resolve9, reject) => {
82704
83034
  return pipeline(...streams, (err) => {
82705
83035
  if (err)
82706
83036
  return reject(err);
82707
- resolve10();
83037
+ resolve9();
82708
83038
  });
82709
83039
  });
82710
83040
  }
@@ -83418,16 +83748,16 @@ var require_extract = __commonJS((exports, module) => {
83418
83748
  entryCallback = null;
83419
83749
  cb(err);
83420
83750
  }
83421
- function onnext(resolve10, reject) {
83751
+ function onnext(resolve9, reject) {
83422
83752
  if (error) {
83423
83753
  return reject(error);
83424
83754
  }
83425
83755
  if (entryStream) {
83426
- resolve10({ value: entryStream, done: false });
83756
+ resolve9({ value: entryStream, done: false });
83427
83757
  entryStream = null;
83428
83758
  return;
83429
83759
  }
83430
- promiseResolve = resolve10;
83760
+ promiseResolve = resolve9;
83431
83761
  promiseReject = reject;
83432
83762
  consumeCallback(null);
83433
83763
  if (extract._finished && promiseResolve) {
@@ -83458,14 +83788,14 @@ var require_extract = __commonJS((exports, module) => {
83458
83788
  function destroy(err) {
83459
83789
  extract.destroy(err);
83460
83790
  consumeCallback(err);
83461
- return new Promise((resolve10, reject) => {
83791
+ return new Promise((resolve9, reject) => {
83462
83792
  if (extract.destroyed)
83463
- return resolve10({ value: undefined, done: true });
83793
+ return resolve9({ value: undefined, done: true });
83464
83794
  extract.once("close", function() {
83465
83795
  if (err)
83466
83796
  reject(err);
83467
83797
  else
83468
- resolve10({ value: undefined, done: true });
83798
+ resolve9({ value: undefined, done: true });
83469
83799
  });
83470
83800
  });
83471
83801
  }
@@ -84263,7 +84593,7 @@ var init_fileUtil = __esm(() => {
84263
84593
  // node_modules/@puppeteer/browsers/lib/esm/install.js
84264
84594
  import assert2 from "node:assert";
84265
84595
  import { spawnSync as spawnSync4 } from "node:child_process";
84266
- import { existsSync as existsSync38, readFileSync as readFileSync27 } from "node:fs";
84596
+ import { existsSync as existsSync36, readFileSync as readFileSync27 } from "node:fs";
84267
84597
  import { mkdir as mkdir2, unlink } from "node:fs/promises";
84268
84598
  import os5 from "node:os";
84269
84599
  import path8 from "node:path";
@@ -84316,7 +84646,7 @@ async function installWithProviders(options) {
84316
84646
  continue;
84317
84647
  }
84318
84648
  debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
84319
- if (!existsSync38(browserRoot)) {
84649
+ if (!existsSync36(browserRoot)) {
84320
84650
  await mkdir2(browserRoot, { recursive: true });
84321
84651
  }
84322
84652
  return await installUrl(url, options, provider);
@@ -84349,7 +84679,7 @@ async function installDeps(installedBrowser) {
84349
84679
  return;
84350
84680
  }
84351
84681
  const depsPath = path8.join(path8.dirname(installedBrowser.executablePath), "deb.deps");
84352
- if (!existsSync38(depsPath)) {
84682
+ if (!existsSync36(depsPath)) {
84353
84683
  debugInstall(`deb.deps file was not found at ${depsPath}`);
84354
84684
  return;
84355
84685
  }
@@ -84391,11 +84721,11 @@ async function installUrl(url, options, provider) {
84391
84721
  const cache = new Cache(options.cacheDir);
84392
84722
  const browserRoot = cache.browserRoot(options.browser);
84393
84723
  const archivePath = path8.join(browserRoot, `${options.buildId}-${fileName}`);
84394
- if (!existsSync38(browserRoot)) {
84724
+ if (!existsSync36(browserRoot)) {
84395
84725
  await mkdir2(browserRoot, { recursive: true });
84396
84726
  }
84397
84727
  if (!options.unpack) {
84398
- if (existsSync38(archivePath)) {
84728
+ if (existsSync36(archivePath)) {
84399
84729
  return archivePath;
84400
84730
  }
84401
84731
  debugInstall(`Downloading binary from ${url}`);
@@ -84416,8 +84746,8 @@ async function installUrl(url, options, provider) {
84416
84746
  cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath6);
84417
84747
  }
84418
84748
  try {
84419
- if (existsSync38(outputPath)) {
84420
- if (!existsSync38(installedBrowser.executablePath)) {
84749
+ if (existsSync36(outputPath)) {
84750
+ if (!existsSync36(installedBrowser.executablePath)) {
84421
84751
  throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
84422
84752
  }
84423
84753
  await runSetup(installedBrowser);
@@ -84426,7 +84756,7 @@ async function installUrl(url, options, provider) {
84426
84756
  }
84427
84757
  return installedBrowser;
84428
84758
  }
84429
- if (!existsSync38(archivePath)) {
84759
+ if (!existsSync36(archivePath)) {
84430
84760
  debugInstall(`Downloading binary from ${url}`);
84431
84761
  try {
84432
84762
  debugTime("download");
@@ -84455,7 +84785,7 @@ async function installUrl(url, options, provider) {
84455
84785
  }
84456
84786
  return installedBrowser;
84457
84787
  } finally {
84458
- if (existsSync38(archivePath)) {
84788
+ if (existsSync36(archivePath)) {
84459
84789
  await unlink(archivePath);
84460
84790
  }
84461
84791
  }
@@ -84466,7 +84796,7 @@ async function runSetup(installedBrowser) {
84466
84796
  debugTime("permissions");
84467
84797
  const browserDir = path8.dirname(installedBrowser.executablePath);
84468
84798
  const setupExePath = path8.join(browserDir, "setup.exe");
84469
- if (!existsSync38(setupExePath)) {
84799
+ if (!existsSync36(setupExePath)) {
84470
84800
  return;
84471
84801
  }
84472
84802
  spawnSync4(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
@@ -84807,12 +85137,12 @@ var init_lib = __esm(() => {
84807
85137
  });
84808
85138
 
84809
85139
  // node_modules/cliui/build/lib/string-utils.js
84810
- function stripAnsi(str) {
85140
+ function stripAnsi2(str) {
84811
85141
  return str.replace(ansi, "");
84812
85142
  }
84813
85143
  function wrap(str, width) {
84814
85144
  const [start, end] = str.match(ansi) || ["", ""];
84815
- str = stripAnsi(str);
85145
+ str = stripAnsi2(str);
84816
85146
  let wrapped = "";
84817
85147
  for (let i = 0;i < str.length; i++) {
84818
85148
  if (i !== 0 && i % width === 0) {
@@ -84837,7 +85167,7 @@ function ui(opts) {
84837
85167
  stringWidth: (str) => {
84838
85168
  return [...str].length;
84839
85169
  },
84840
- stripAnsi,
85170
+ stripAnsi: stripAnsi2,
84841
85171
  wrap
84842
85172
  });
84843
85173
  }
@@ -84847,19 +85177,19 @@ var init_cliui = __esm(() => {
84847
85177
  });
84848
85178
 
84849
85179
  // node_modules/escalade/sync/index.mjs
84850
- import { dirname as dirname16, resolve as resolve11 } from "path";
85180
+ import { dirname as dirname15, resolve as resolve10 } from "path";
84851
85181
  import { readdirSync as readdirSync11, statSync as statSync13 } from "fs";
84852
85182
  function sync_default(start, callback) {
84853
- let dir = resolve11(".", start);
85183
+ let dir = resolve10(".", start);
84854
85184
  let tmp, stats = statSync13(dir);
84855
85185
  if (!stats.isDirectory()) {
84856
- dir = dirname16(dir);
85186
+ dir = dirname15(dir);
84857
85187
  }
84858
85188
  while (true) {
84859
85189
  tmp = callback(dir, readdirSync11(dir));
84860
85190
  if (tmp)
84861
- return resolve11(dir, tmp);
84862
- dir = dirname16(tmp = dir);
85191
+ return resolve10(dir, tmp);
85192
+ dir = dirname15(tmp = dir);
84863
85193
  if (tmp === dir)
84864
85194
  break;
84865
85195
  }
@@ -85805,7 +86135,7 @@ var init_yargs_parser = __esm(() => {
85805
86135
 
85806
86136
  // node_modules/yargs-parser/build/lib/index.js
85807
86137
  import { format } from "util";
85808
- import { normalize as normalize2, resolve as resolve12 } from "path";
86138
+ import { normalize as normalize2, resolve as resolve11 } from "path";
85809
86139
  var _a3, _b, _c, minNodeVersion, nodeVersion, env, parser, yargsParser = function Parser(args, opts) {
85810
86140
  const result = parser.parse(args.slice(), opts);
85811
86141
  return result.argv;
@@ -85828,7 +86158,7 @@ var init_lib2 = __esm(() => {
85828
86158
  },
85829
86159
  format,
85830
86160
  normalize: normalize2,
85831
- resolve: resolve12,
86161
+ resolve: resolve11,
85832
86162
  require: (path9) => {
85833
86163
  if (true) {
85834
86164
  return __require(path9);
@@ -85880,7 +86210,7 @@ var init_yerror = __esm(() => {
85880
86210
  // node_modules/y18n/build/lib/platform-shims/node.js
85881
86211
  import { readFileSync as readFileSync28, statSync as statSync14, writeFile } from "fs";
85882
86212
  import { format as format2 } from "util";
85883
- import { resolve as resolve13 } from "path";
86213
+ import { resolve as resolve12 } from "path";
85884
86214
  var node_default;
85885
86215
  var init_node = __esm(() => {
85886
86216
  node_default = {
@@ -85889,7 +86219,7 @@ var init_node = __esm(() => {
85889
86219
  writeFile
85890
86220
  },
85891
86221
  format: format2,
85892
- resolve: resolve13,
86222
+ resolve: resolve12,
85893
86223
  exists: (file) => {
85894
86224
  try {
85895
86225
  return statSync14(file).isFile();
@@ -86072,7 +86402,7 @@ import { notStrictEqual, strictEqual } from "assert";
86072
86402
  import { inspect } from "util";
86073
86403
  import { readFileSync as readFileSync29 } from "fs";
86074
86404
  import { fileURLToPath } from "url";
86075
- import { basename as basename9, dirname as dirname17, extname as extname3, relative as relative9, resolve as resolve14 } from "path";
86405
+ import { basename as basename9, dirname as dirname16, extname as extname3, relative as relative9, resolve as resolve13 } from "path";
86076
86406
  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;
86077
86407
  var init_esm = __esm(() => {
86078
86408
  init_cliui();
@@ -86105,10 +86435,10 @@ var init_esm = __esm(() => {
86105
86435
  Parser: lib_default,
86106
86436
  path: {
86107
86437
  basename: basename9,
86108
- dirname: dirname17,
86438
+ dirname: dirname16,
86109
86439
  extname: extname3,
86110
86440
  relative: relative9,
86111
- resolve: resolve14
86441
+ resolve: resolve13
86112
86442
  },
86113
86443
  process: {
86114
86444
  argv: () => process.argv,
@@ -86130,7 +86460,7 @@ var init_esm = __esm(() => {
86130
86460
  return [...str].length;
86131
86461
  },
86132
86462
  y18n: y18n_default({
86133
- directory: resolve14(__dirname2, "../../../locales"),
86463
+ directory: resolve13(__dirname2, "../../../locales"),
86134
86464
  updateFiles: false
86135
86465
  })
86136
86466
  };
@@ -88378,12 +88708,12 @@ var init_yargs_factory = __esm(() => {
88378
88708
  async getCompletion(args, done) {
88379
88709
  argsert("<array> [function]", [args, done], arguments.length);
88380
88710
  if (!done) {
88381
- return new Promise((resolve15, reject) => {
88711
+ return new Promise((resolve14, reject) => {
88382
88712
  __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
88383
88713
  if (err)
88384
88714
  reject(err);
88385
88715
  else
88386
- resolve15(completions);
88716
+ resolve14(completions);
88387
88717
  });
88388
88718
  });
88389
88719
  } else {
@@ -89818,9 +90148,9 @@ async function getConnectionTransport(options) {
89818
90148
  throw new Error("Could not detect required browser platform");
89819
90149
  }
89820
90150
  const { convertPuppeteerChannelToBrowsersChannel: convertPuppeteerChannelToBrowsersChannel2 } = await Promise.resolve().then(() => (init_LaunchOptions(), exports_LaunchOptions));
89821
- const { join: join35 } = await import("node:path");
90151
+ const { join: join33 } = await import("node:path");
89822
90152
  const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform2, convertPuppeteerChannelToBrowsersChannel2(options.channel));
89823
- const portPath = join35(userDataDir, "DevToolsActivePort");
90153
+ const portPath = join33(userDataDir, "DevToolsActivePort");
89824
90154
  try {
89825
90155
  const fileContent = await environment.value.fs.promises.readFile(portPath, "ascii");
89826
90156
  const [rawPort, rawPath] = fileContent.split(`
@@ -90044,9 +90374,9 @@ var init_PipeTransport = __esm(() => {
90044
90374
  });
90045
90375
 
90046
90376
  // node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js
90047
- import { existsSync as existsSync39 } from "node:fs";
90377
+ import { existsSync as existsSync37 } from "node:fs";
90048
90378
  import { tmpdir } from "node:os";
90049
- import { join as join35 } from "node:path";
90379
+ import { join as join33 } from "node:path";
90050
90380
 
90051
90381
  class BrowserLauncher {
90052
90382
  #browser;
@@ -90071,7 +90401,7 @@ class BrowserLauncher {
90071
90401
  ...options,
90072
90402
  protocol
90073
90403
  });
90074
- if (!existsSync39(launchArgs.executablePath)) {
90404
+ if (!existsSync37(launchArgs.executablePath)) {
90075
90405
  throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
90076
90406
  }
90077
90407
  const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
@@ -90146,7 +90476,7 @@ class BrowserLauncher {
90146
90476
  browserCloseCallback();
90147
90477
  const logs = browserProcess.getRecentLogs().join(`
90148
90478
  `);
90149
- if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync39(join35(launchArgs.userDataDir, "lockfile"))) {
90479
+ if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync37(join33(launchArgs.userDataDir, "lockfile"))) {
90150
90480
  throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
90151
90481
  }
90152
90482
  if (logs.includes("Missing X server") && options.headless === false) {
@@ -90236,12 +90566,12 @@ class BrowserLauncher {
90236
90566
  });
90237
90567
  }
90238
90568
  getProfilePath() {
90239
- return join35(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
90569
+ return join33(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
90240
90570
  }
90241
90571
  resolveExecutablePath(headless, validatePath = true) {
90242
90572
  let executablePath = this.puppeteer.configuration.executablePath;
90243
90573
  if (executablePath) {
90244
- if (validatePath && !existsSync39(executablePath)) {
90574
+ if (validatePath && !existsSync37(executablePath)) {
90245
90575
  throw new Error(`Tried to find the browser at the configured path (${executablePath}), but no executable was found.`);
90246
90576
  }
90247
90577
  return executablePath;
@@ -90264,7 +90594,7 @@ class BrowserLauncher {
90264
90594
  browser: browserType,
90265
90595
  buildId: this.puppeteer.browserVersion
90266
90596
  });
90267
- if (validatePath && !existsSync39(executablePath)) {
90597
+ if (validatePath && !existsSync37(executablePath)) {
90268
90598
  const configVersion = this.puppeteer.configuration?.[this.browser]?.version;
90269
90599
  if (configVersion) {
90270
90600
  throw new Error(`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`);
@@ -90802,7 +91132,7 @@ var init_PuppeteerNode = __esm(() => {
90802
91132
  import { spawn as spawn2, spawnSync as spawnSync5 } from "node:child_process";
90803
91133
  import fs5 from "node:fs";
90804
91134
  import os8 from "node:os";
90805
- import { dirname as dirname18 } from "node:path";
91135
+ import { dirname as dirname17 } from "node:path";
90806
91136
  import { PassThrough } from "node:stream";
90807
91137
  var import_debug6, __runInitializers22 = function(thisArg, initializers, value) {
90808
91138
  var useValue = arguments.length > 2;
@@ -90876,8 +91206,8 @@ var init_ScreenRecorder = __esm(() => {
90876
91206
  static {
90877
91207
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : undefined;
90878
91208
  __esDecorate22(this, _private_writeFrame_descriptor = { value: __setFunctionName5(async function(buffer) {
90879
- const error = await new Promise((resolve15) => {
90880
- this.#process.stdin.write(buffer, resolve15);
91209
+ const error = await new Promise((resolve14) => {
91210
+ this.#process.stdin.write(buffer, resolve14);
90881
91211
  });
90882
91212
  if (error) {
90883
91213
  console.log(`ffmpeg failed to write: ${error.message}.`);
@@ -90926,7 +91256,7 @@ var init_ScreenRecorder = __esm(() => {
90926
91256
  filters.push(formatArgs.splice(vf, 2).at(-1) ?? "");
90927
91257
  }
90928
91258
  if (path11) {
90929
- fs5.mkdirSync(dirname18(path11), { recursive: overwrite });
91259
+ fs5.mkdirSync(dirname17(path11), { recursive: overwrite });
90930
91260
  }
90931
91261
  this.#process = spawn2(ffmpegPath, [
90932
91262
  ["-loglevel", "error"],
@@ -91032,8 +91362,8 @@ var init_ScreenRecorder = __esm(() => {
91032
91362
  const [buffer, timestamp] = await this.#lastFrame;
91033
91363
  await Promise.all(Array(Math.max(1, Math.round(this.#fps * (performance.now() - timestamp) / 1000))).fill(buffer).map(this.#writeFrame.bind(this)));
91034
91364
  this.#process.stdin.end();
91035
- await new Promise((resolve15) => {
91036
- this.#process.once("close", resolve15);
91365
+ await new Promise((resolve14) => {
91366
+ this.#process.once("close", resolve14);
91037
91367
  });
91038
91368
  }
91039
91369
  async[(_private_writeFrame_decorators = [guarded()], _stop_decorators = [guarded()], asyncDisposeSymbol)]() {
@@ -91079,17 +91409,17 @@ var init_puppeteer_core = __esm(() => {
91079
91409
  });
91080
91410
 
91081
91411
  // src/core/design-eval/capture.ts
91082
- import { mkdirSync as mkdirSync17, statSync as statSync15, existsSync as existsSync40 } from "fs";
91083
- import { join as join36 } from "path";
91412
+ import { mkdirSync as mkdirSync16, statSync as statSync15, existsSync as existsSync38 } from "fs";
91413
+ import { join as join34 } from "path";
91084
91414
  function findBrowser() {
91085
91415
  const platform2 = process.platform;
91086
91416
  const paths = CHROME_PATHS[platform2] ?? [];
91087
91417
  for (const p of paths) {
91088
- if (existsSync40(p))
91418
+ if (existsSync38(p))
91089
91419
  return p;
91090
91420
  }
91091
- const minkBrowsers = join36(minkRoot(), "browsers");
91092
- if (existsSync40(minkBrowsers)) {
91421
+ const minkBrowsers = join34(minkRoot(), "browsers");
91422
+ if (existsSync38(minkBrowsers)) {
91093
91423
  const found = findChromeInDir(minkBrowsers);
91094
91424
  if (found)
91095
91425
  return found;
@@ -91110,7 +91440,7 @@ function findChromeInDir(dir) {
91110
91440
  try {
91111
91441
  const entries = readdirSync12(dir);
91112
91442
  for (const entry of entries) {
91113
- const full = join36(dir, entry);
91443
+ const full = join34(dir, entry);
91114
91444
  try {
91115
91445
  const stat2 = statSync16(full);
91116
91446
  if (stat2.isDirectory()) {
@@ -91158,7 +91488,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
91158
91488
  const y = section * viewport.height;
91159
91489
  const clipHeight = Math.min(viewport.height, pageHeight - y);
91160
91490
  const fileName = `${prefix}-${viewport.name}-${section}.jpg`;
91161
- const filePath = join36(options.outputDir, fileName);
91491
+ const filePath = join34(options.outputDir, fileName);
91162
91492
  await page.screenshot({
91163
91493
  path: filePath,
91164
91494
  type: "jpeg",
@@ -91190,7 +91520,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
91190
91520
  return results;
91191
91521
  }
91192
91522
  async function captureAllRoutes(routes, baseUrl, viewports, options, outputDir) {
91193
- mkdirSync17(outputDir, { recursive: true });
91523
+ mkdirSync16(outputDir, { recursive: true });
91194
91524
  const executablePath = findBrowser();
91195
91525
  const browser = await puppeteer_core_default.launch({
91196
91526
  executablePath,
@@ -92627,9 +92957,9 @@ var exports_wiki = {};
92627
92957
  __export(exports_wiki, {
92628
92958
  wiki: () => wiki
92629
92959
  });
92630
- import { existsSync as existsSync41, statSync as statSync16 } from "fs";
92631
- import { resolve as resolve15 } from "path";
92632
- import { homedir as homedir6 } from "os";
92960
+ import { existsSync as existsSync39, statSync as statSync16 } from "fs";
92961
+ import { resolve as resolve14 } from "path";
92962
+ import { homedir as homedir5 } from "os";
92633
92963
  async function wiki(_cwd, args) {
92634
92964
  const sub = args[0];
92635
92965
  switch (sub) {
@@ -92685,7 +93015,7 @@ async function wikiInit(args) {
92685
93015
  console.log(`[mink] initializing vault at ${targetPath}`);
92686
93016
  console.log(" (set a custom path with: mink wiki init /path/to/vault)");
92687
93017
  }
92688
- const isExisting = existsSync41(targetPath) && statSync16(targetPath).isDirectory();
93018
+ const isExisting = existsSync39(targetPath) && statSync16(targetPath).isDirectory();
92689
93019
  setConfigValue("wiki.path", targetPath);
92690
93020
  ensureVaultStructure();
92691
93021
  seedTemplates(vaultTemplates());
@@ -92895,9 +93225,9 @@ function wikiLinks() {
92895
93225
  }
92896
93226
  function expandPath(raw) {
92897
93227
  if (raw.startsWith("~/")) {
92898
- return resolve15(homedir6(), raw.slice(2));
93228
+ return resolve14(homedir5(), raw.slice(2));
92899
93229
  }
92900
- return resolve15(raw);
93230
+ return resolve14(raw);
92901
93231
  }
92902
93232
  var init_wiki = __esm(() => {
92903
93233
  init_vault();
@@ -92913,8 +93243,8 @@ var exports_note = {};
92913
93243
  __export(exports_note, {
92914
93244
  note: () => note
92915
93245
  });
92916
- import { resolve as resolve16 } from "path";
92917
- import { existsSync as existsSync42, readFileSync as readFileSync30 } from "fs";
93246
+ import { resolve as resolve15 } from "path";
93247
+ import { existsSync as existsSync40, readFileSync as readFileSync30 } from "fs";
92918
93248
  async function note(cwd, args) {
92919
93249
  if (!isWikiEnabled()) {
92920
93250
  console.error("[mink] wiki feature is disabled");
@@ -92944,8 +93274,8 @@ async function note(cwd, args) {
92944
93274
  return;
92945
93275
  }
92946
93276
  if (parsed.file) {
92947
- const sourcePath = resolve16(cwd, parsed.file);
92948
- if (!existsSync42(sourcePath)) {
93277
+ const sourcePath = resolve15(cwd, parsed.file);
93278
+ if (!existsSync40(sourcePath)) {
92949
93279
  console.error(`[mink] file not found: ${sourcePath}`);
92950
93280
  process.exit(1);
92951
93281
  }
@@ -93106,39 +93436,39 @@ var exports_skill = {};
93106
93436
  __export(exports_skill, {
93107
93437
  skill: () => skill
93108
93438
  });
93109
- import { join as join37, resolve as resolve17, dirname as dirname19 } from "path";
93110
- import { homedir as homedir7 } from "os";
93439
+ import { join as join35, resolve as resolve16, dirname as dirname18 } from "path";
93440
+ import { homedir as homedir6 } from "os";
93111
93441
  import {
93112
- existsSync as existsSync43,
93113
- mkdirSync as mkdirSync18,
93114
- copyFileSync as copyFileSync2,
93442
+ existsSync as existsSync41,
93443
+ mkdirSync as mkdirSync17,
93444
+ copyFileSync,
93115
93445
  unlinkSync as unlinkSync6,
93116
93446
  readdirSync as readdirSync12,
93117
- rmSync as rmSync3,
93447
+ rmSync as rmSync2,
93118
93448
  symlinkSync as symlinkSync2,
93119
93449
  lstatSync as lstatSync2
93120
93450
  } from "fs";
93121
93451
  function getSkillsSourceDir() {
93122
- let dir = dirname19(new URL(import.meta.url).pathname);
93452
+ let dir = dirname18(new URL(import.meta.url).pathname);
93123
93453
  while (true) {
93124
- if (existsSync43(join37(dir, "package.json")) && existsSync43(join37(dir, "skills"))) {
93125
- return join37(dir, "skills");
93454
+ if (existsSync41(join35(dir, "package.json")) && existsSync41(join35(dir, "skills"))) {
93455
+ return join35(dir, "skills");
93126
93456
  }
93127
- const parent = dirname19(dir);
93457
+ const parent = dirname18(dir);
93128
93458
  if (parent === dir)
93129
93459
  break;
93130
93460
  dir = parent;
93131
93461
  }
93132
- return resolve17(dirname19(new URL(import.meta.url).pathname), "../../skills");
93462
+ return resolve16(dirname18(new URL(import.meta.url).pathname), "../../skills");
93133
93463
  }
93134
93464
  function getAvailableSkills() {
93135
93465
  const dir = getSkillsSourceDir();
93136
- if (!existsSync43(dir))
93466
+ if (!existsSync41(dir))
93137
93467
  return [];
93138
- return readdirSync12(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync43(join37(dir, d.name, "SKILL.md"))).map((d) => d.name);
93468
+ return readdirSync12(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync41(join35(dir, d.name, "SKILL.md"))).map((d) => d.name);
93139
93469
  }
93140
93470
  function isInstalled(skillName) {
93141
- return existsSync43(join37(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
93471
+ return existsSync41(join35(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
93142
93472
  }
93143
93473
  async function skill(args) {
93144
93474
  const sub = args[0];
@@ -93172,28 +93502,28 @@ function skillInstall(name) {
93172
93502
  console.error(" Expected skills at: " + sourceDir);
93173
93503
  return;
93174
93504
  }
93175
- mkdirSync18(AGENTS_SKILLS_DIR, { recursive: true });
93505
+ mkdirSync17(AGENTS_SKILLS_DIR, { recursive: true });
93176
93506
  for (const skillName of skills) {
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)) {
93507
+ const srcDir = join35(sourceDir, skillName);
93508
+ const srcFile = join35(srcDir, "SKILL.md");
93509
+ const destDir = join35(AGENTS_SKILLS_DIR, skillName);
93510
+ if (!existsSync41(srcFile)) {
93181
93511
  console.error(`[mink] skill not found: ${skillName}`);
93182
93512
  continue;
93183
93513
  }
93184
- mkdirSync18(destDir, { recursive: true });
93514
+ mkdirSync17(destDir, { recursive: true });
93185
93515
  copyDirRecursive2(srcDir, destDir);
93186
- mkdirSync18(CLAUDE_SKILLS_DIR, { recursive: true });
93187
- const symlink = join37(CLAUDE_SKILLS_DIR, skillName);
93516
+ mkdirSync17(CLAUDE_SKILLS_DIR, { recursive: true });
93517
+ const symlink = join35(CLAUDE_SKILLS_DIR, skillName);
93188
93518
  try {
93189
- if (existsSync43(symlink)) {
93519
+ if (existsSync41(symlink)) {
93190
93520
  if (lstatSync2(symlink).isSymbolicLink() || lstatSync2(symlink).isFile()) {
93191
93521
  unlinkSync6(symlink);
93192
93522
  } else {
93193
- rmSync3(symlink, { recursive: true, force: true });
93523
+ rmSync2(symlink, { recursive: true, force: true });
93194
93524
  }
93195
93525
  }
93196
- const relativeTarget = join37("..", "..", ".agents", "skills", skillName);
93526
+ const relativeTarget = join35("..", "..", ".agents", "skills", skillName);
93197
93527
  symlinkSync2(relativeTarget, symlink);
93198
93528
  } catch {}
93199
93529
  console.log(`[mink] installed: ${skillName} -> ${destDir}`);
@@ -93204,15 +93534,15 @@ function skillInstall(name) {
93204
93534
  function skillUninstall(name) {
93205
93535
  const skills = name ? [name] : getAvailableSkills();
93206
93536
  for (const skillName of skills) {
93207
- const destDir = join37(AGENTS_SKILLS_DIR, skillName);
93208
- if (!existsSync43(destDir)) {
93537
+ const destDir = join35(AGENTS_SKILLS_DIR, skillName);
93538
+ if (!existsSync41(destDir)) {
93209
93539
  console.log(`[mink] not installed: ${skillName}`);
93210
93540
  continue;
93211
93541
  }
93212
- rmSync3(destDir, { recursive: true, force: true });
93213
- const symlink = join37(CLAUDE_SKILLS_DIR, skillName);
93542
+ rmSync2(destDir, { recursive: true, force: true });
93543
+ const symlink = join35(CLAUDE_SKILLS_DIR, skillName);
93214
93544
  try {
93215
- if (existsSync43(symlink))
93545
+ if (existsSync41(symlink))
93216
93546
  unlinkSync6(symlink);
93217
93547
  } catch {}
93218
93548
  console.log(`[mink] uninstalled: ${skillName}`);
@@ -93227,7 +93557,7 @@ function skillList() {
93227
93557
  if (installed.length > 0) {
93228
93558
  console.log(" Installed:");
93229
93559
  for (const s of installed) {
93230
- console.log(` ${s} (${join37(AGENTS_SKILLS_DIR, s)})`);
93560
+ console.log(` ${s} (${join35(AGENTS_SKILLS_DIR, s)})`);
93231
93561
  }
93232
93562
  }
93233
93563
  if (notInstalled.length > 0) {
@@ -93246,20 +93576,20 @@ function skillList() {
93246
93576
  function copyDirRecursive2(src, dest) {
93247
93577
  const entries = readdirSync12(src, { withFileTypes: true });
93248
93578
  for (const entry of entries) {
93249
- const srcPath = join37(src, entry.name);
93250
- const destPath = join37(dest, entry.name);
93579
+ const srcPath = join35(src, entry.name);
93580
+ const destPath = join35(dest, entry.name);
93251
93581
  if (entry.isDirectory()) {
93252
- mkdirSync18(destPath, { recursive: true });
93582
+ mkdirSync17(destPath, { recursive: true });
93253
93583
  copyDirRecursive2(srcPath, destPath);
93254
93584
  } else {
93255
- copyFileSync2(srcPath, destPath);
93585
+ copyFileSync(srcPath, destPath);
93256
93586
  }
93257
93587
  }
93258
93588
  }
93259
93589
  var AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR;
93260
93590
  var init_skill = __esm(() => {
93261
- AGENTS_SKILLS_DIR = join37(homedir7(), ".agents", "skills");
93262
- CLAUDE_SKILLS_DIR = join37(homedir7(), ".claude", "skills");
93591
+ AGENTS_SKILLS_DIR = join35(homedir6(), ".agents", "skills");
93592
+ CLAUDE_SKILLS_DIR = join35(homedir6(), ".claude", "skills");
93263
93593
  });
93264
93594
 
93265
93595
  // src/commands/agent.ts
@@ -93267,41 +93597,41 @@ var exports_agent = {};
93267
93597
  __export(exports_agent, {
93268
93598
  agent: () => agent
93269
93599
  });
93270
- import { join as join38, resolve as resolve18, dirname as dirname20 } from "path";
93271
- import { homedir as homedir8 } from "os";
93600
+ import { join as join36, resolve as resolve17, dirname as dirname19 } from "path";
93601
+ import { homedir as homedir7 } from "os";
93272
93602
  import {
93273
- existsSync as existsSync44,
93274
- mkdirSync as mkdirSync19,
93603
+ existsSync as existsSync42,
93604
+ mkdirSync as mkdirSync18,
93275
93605
  readFileSync as readFileSync31,
93276
93606
  writeFileSync as writeFileSync11
93277
93607
  } from "fs";
93278
93608
  import { createHash as createHash5 } from "crypto";
93279
93609
  import { spawnSync as spawnSync6 } from "child_process";
93280
93610
  function getAgentTemplatePath() {
93281
- let dir = dirname20(new URL(import.meta.url).pathname);
93611
+ let dir = dirname19(new URL(import.meta.url).pathname);
93282
93612
  while (true) {
93283
- if (existsSync44(join38(dir, "package.json")) && existsSync44(join38(dir, "agents", TEMPLATE_FILE))) {
93284
- return join38(dir, "agents", TEMPLATE_FILE);
93613
+ if (existsSync42(join36(dir, "package.json")) && existsSync42(join36(dir, "agents", TEMPLATE_FILE))) {
93614
+ return join36(dir, "agents", TEMPLATE_FILE);
93285
93615
  }
93286
- const parent = dirname20(dir);
93616
+ const parent = dirname19(dir);
93287
93617
  if (parent === dir)
93288
93618
  break;
93289
93619
  dir = parent;
93290
93620
  }
93291
- return resolve18(dirname20(new URL(import.meta.url).pathname), "../../agents", TEMPLATE_FILE);
93621
+ return resolve17(dirname19(new URL(import.meta.url).pathname), "../../agents", TEMPLATE_FILE);
93292
93622
  }
93293
93623
  function getMinkVersion() {
93294
- let dir = dirname20(new URL(import.meta.url).pathname);
93624
+ let dir = dirname19(new URL(import.meta.url).pathname);
93295
93625
  while (true) {
93296
- const pkgPath = join38(dir, "package.json");
93297
- if (existsSync44(pkgPath)) {
93626
+ const pkgPath = join36(dir, "package.json");
93627
+ if (existsSync42(pkgPath)) {
93298
93628
  try {
93299
93629
  const pkg = JSON.parse(readFileSync31(pkgPath, "utf-8"));
93300
93630
  if (pkg.name && pkg.version)
93301
93631
  return pkg.version;
93302
93632
  } catch {}
93303
93633
  }
93304
- const parent = dirname20(dir);
93634
+ const parent = dirname19(dir);
93305
93635
  if (parent === dir)
93306
93636
  break;
93307
93637
  dir = parent;
@@ -93319,19 +93649,19 @@ function sha2562(text) {
93319
93649
  return createHash5("sha256").update(text).digest("hex");
93320
93650
  }
93321
93651
  function claudeAgentsDir() {
93322
- return join38(homedir8(), ".claude", "agents");
93652
+ return join36(homedir7(), ".claude", "agents");
93323
93653
  }
93324
93654
  function installedAgentPath() {
93325
- return join38(claudeAgentsDir(), INSTALLED_FILE);
93655
+ return join36(claudeAgentsDir(), INSTALLED_FILE);
93326
93656
  }
93327
93657
  function installAgentDefinition(opts) {
93328
93658
  const templatePath = getAgentTemplatePath();
93329
- if (!existsSync44(templatePath)) {
93659
+ if (!existsSync42(templatePath)) {
93330
93660
  throw new Error(`[mink agent] bundled agent template not found at ${templatePath}
93331
93661
  ` + " This usually means the package was installed without bundled assets.");
93332
93662
  }
93333
93663
  const installed = installedAgentPath();
93334
- if (opts.skip && existsSync44(installed)) {
93664
+ if (opts.skip && existsSync42(installed)) {
93335
93665
  return { action: "skipped", path: installed };
93336
93666
  }
93337
93667
  const template = readFileSync31(templatePath, "utf-8");
@@ -93340,14 +93670,14 @@ function installAgentDefinition(opts) {
93340
93670
  VAULT_PATH: resolveVaultPath(),
93341
93671
  MINK_VERSION: getMinkVersion()
93342
93672
  });
93343
- const exists = existsSync44(installed);
93673
+ const exists = existsSync42(installed);
93344
93674
  if (!opts.force && exists) {
93345
93675
  const current = readFileSync31(installed, "utf-8");
93346
93676
  if (sha2562(current) === sha2562(rendered)) {
93347
93677
  return { action: "unchanged", path: installed };
93348
93678
  }
93349
93679
  }
93350
- mkdirSync19(claudeAgentsDir(), { recursive: true });
93680
+ mkdirSync18(claudeAgentsDir(), { recursive: true });
93351
93681
  writeFileSync11(installed, rendered);
93352
93682
  return {
93353
93683
  action: exists ? "updated" : "installed",
@@ -93418,8 +93748,8 @@ async function agent(_cwd, rawArgs) {
93418
93748
  }
93419
93749
  const skipUpdate = args.noUpdate || process.env.MINK_AGENT_NO_UPDATE === "1";
93420
93750
  const root = minkRoot();
93421
- if (!existsSync44(root)) {
93422
- mkdirSync19(root, { recursive: true });
93751
+ if (!existsSync42(root)) {
93752
+ mkdirSync18(root, { recursive: true });
93423
93753
  }
93424
93754
  let result;
93425
93755
  try {
@@ -93470,13 +93800,13 @@ var init_agent = __esm(() => {
93470
93800
  });
93471
93801
 
93472
93802
  // src/core/sync-merge-drivers.ts
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";
93803
+ import { readFileSync as readFileSync32, writeFileSync as writeFileSync12, appendFileSync as appendFileSync2, copyFileSync as copyFileSync2, renameSync as renameSync4, unlinkSync as unlinkSync7 } from "fs";
93804
+ import { join as join37 } from "path";
93475
93805
  function logWarning(driver, args, err) {
93476
93806
  try {
93477
93807
  const line = `[${new Date().toISOString()}] ${driver} fallback for ${args.filePath}: ${err instanceof Error ? err.message : String(err)}
93478
93808
  `;
93479
- appendFileSync2(join39(minkRoot(), "sync-warnings.log"), line);
93809
+ appendFileSync2(join37(minkRoot(), "sync-warnings.log"), line);
93480
93810
  } catch {}
93481
93811
  }
93482
93812
  function readJsonOrNull(path12) {
@@ -93711,7 +94041,7 @@ function mergeDbDriver(args) {
93711
94041
  const tmp = `${args.oursPath}.merge-${process.pid}-${Date.now()}.tmp`;
93712
94042
  let ours = null;
93713
94043
  try {
93714
- copyFileSync3(args.oursPath, tmp);
94044
+ copyFileSync2(args.oursPath, tmp);
93715
94045
  ours = openDriver(tmp);
93716
94046
  ours.exec("PRAGMA journal_mode = WAL");
93717
94047
  ours.exec("PRAGMA foreign_keys = ON");
@@ -94227,22 +94557,8 @@ switch (command2) {
94227
94557
  sessionStop(sessionPath2(cwd));
94228
94558
  break;
94229
94559
  case "init": {
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 });
94560
+ const { init: init2 } = await Promise.resolve().then(() => (init_init(), exports_init));
94561
+ await init2(cwd);
94246
94562
  break;
94247
94563
  }
94248
94564
  case "status": {
@@ -94272,6 +94588,11 @@ switch (command2) {
94272
94588
  await postRead2(cwd);
94273
94589
  break;
94274
94590
  }
94591
+ case "post-tool": {
94592
+ const { postTool: postTool2 } = await Promise.resolve().then(() => (init_post_tool(), exports_post_tool));
94593
+ await postTool2(cwd);
94594
+ break;
94595
+ }
94275
94596
  case "pre-write": {
94276
94597
  const { preWrite: preWrite2 } = await Promise.resolve().then(() => (init_pre_write(), exports_pre_write));
94277
94598
  await preWrite2(cwd);
@@ -94287,6 +94608,11 @@ switch (command2) {
94287
94608
  detectWaste3(cwd);
94288
94609
  break;
94289
94610
  }
94611
+ case "retrieve": {
94612
+ const { retrieve: retrieve2 } = await Promise.resolve().then(() => (init_retrieve(), exports_retrieve));
94613
+ retrieve2(cwd, process.argv.slice(3));
94614
+ break;
94615
+ }
94290
94616
  case "cron": {
94291
94617
  const { cron: cron2 } = await Promise.resolve().then(() => (init_cron(), exports_cron));
94292
94618
  await cron2(cwd, process.argv.slice(3));
@@ -94386,12 +94712,12 @@ switch (command2) {
94386
94712
  case "version":
94387
94713
  case "--version":
94388
94714
  case "-v": {
94389
- const { resolve: resolve19, dirname: dirname21, basename: basename10 } = await import("path");
94715
+ const { resolve: resolve18, dirname: dirname20, basename: basename10 } = await import("path");
94390
94716
  const bundlePath = new URL(import.meta.url).pathname;
94391
- const cliPath = resolve19(dirname21(bundlePath));
94717
+ const cliPath = resolve18(dirname20(bundlePath));
94392
94718
  const { readFileSync: readFileSync33 } = await import("fs");
94393
94719
  try {
94394
- const pkg = JSON.parse(readFileSync33(resolve19(cliPath, "../package.json"), "utf-8"));
94720
+ const pkg = JSON.parse(readFileSync33(resolve18(cliPath, "../package.json"), "utf-8"));
94395
94721
  console.log(`mink ${pkg.version}`);
94396
94722
  } catch {
94397
94723
  console.log("mink (unknown version)");
@@ -94414,8 +94740,7 @@ switch (command2) {
94414
94740
  console.log("Usage: mink <command> [options]");
94415
94741
  console.log();
94416
94742
  console.log("Commands:");
94417
- console.log(" init [--agent X] [--yes] Initialize Mink in the current project");
94418
- console.log(" --agent claude|pi|all (default: detect & prompt)");
94743
+ console.log(" init Initialize Mink in the current project");
94419
94744
  console.log(" status Display project health at a glance");
94420
94745
  console.log(" scan [--check] Force a full file index rescan");
94421
94746
  console.log(" config [key] [value] Manage global user settings");
@@ -94457,6 +94782,7 @@ switch (command2) {
94457
94782
  console.log(" restore [backup] Restore state from a backup");
94458
94783
  console.log(" bug search <term> Search the bug log");
94459
94784
  console.log(" detect-waste Detect and flag wasteful patterns");
94785
+ console.log(" retrieve <token> Return a compressed tool output's original (spec 21)");
94460
94786
  console.log(" reflect Generate learning memory reflections");
94461
94787
  console.log(" designqc [target] Capture design screenshots (spec 13)");
94462
94788
  console.log(" framework-advisor Generate framework advisor knowledge file (spec 14)");
@@ -94466,6 +94792,7 @@ switch (command2) {
94466
94792
  console.log(" session-stop Finalize session and log data");
94467
94793
  console.log(" pre-read / post-read File read hooks");
94468
94794
  console.log(" pre-write / post-write File write hooks");
94795
+ console.log(" post-tool Tool-output compression hook (Bash/Grep/MCP, spec 21)");
94469
94796
  break;
94470
94797
  default:
94471
94798
  console.error(`[mink] unknown command: ${command2 ?? "(none)"}`);