inkmap-mcp 0.3.17 → 0.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -66,23 +66,83 @@ var init_product = __esm({
66
66
  }
67
67
  });
68
68
 
69
+ // packages/core/dist/images.js
70
+ function sniffImage(bytes) {
71
+ if (startsWith(bytes, "\x89PNG\r\n\n"))
72
+ return "png";
73
+ if (startsWith(bytes, "\xFF\xD8\xFF"))
74
+ return "jpg";
75
+ if (startsWith(bytes, "GIF87a") || startsWith(bytes, "GIF89a"))
76
+ return "gif";
77
+ if (startsWith(bytes, "RIFF") && startsWith(bytes, "WEBP", 8))
78
+ return "webp";
79
+ return void 0;
80
+ }
81
+ function decodeImageDataUrl(dataUrl) {
82
+ const match = typeof dataUrl === "string" ? /^data:[\w.+/-]*;base64,([A-Za-z0-9+/]*={0,2})$/.exec(dataUrl) : null;
83
+ if (!match)
84
+ return { problem: "type" };
85
+ if (match[1].length * 3 / 4 - 2 > MAX_IMAGE_BYTES)
86
+ return { problem: "size" };
87
+ let binary;
88
+ try {
89
+ binary = atob(match[1]);
90
+ } catch {
91
+ return { problem: "type" };
92
+ }
93
+ if (binary.length > MAX_IMAGE_BYTES)
94
+ return { problem: "size" };
95
+ const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
96
+ const extension = sniffImage(bytes);
97
+ return extension ? { bytes, extension } : { problem: "type" };
98
+ }
99
+ function imageFolderName(documentFileName) {
100
+ const stem = documentFileName.replace(/\.(?:md|markdown)$/i, "").trim();
101
+ return `${/^\.*$/.test(stem) ? "images" : stem}.assets`;
102
+ }
103
+ function imageFileName(when, extension, attempt = 1) {
104
+ const two = (n) => String(n).padStart(2, "0");
105
+ const stamp = `${when.getFullYear()}${two(when.getMonth() + 1)}${two(when.getDate())}-${two(when.getHours())}${two(when.getMinutes())}${two(when.getSeconds())}`;
106
+ return `image-${stamp}${attempt > 1 ? `-${attempt}` : ""}.${extension}`;
107
+ }
108
+ function imageLinkPath(folder, file2) {
109
+ const encode3 = (part) => part.replace(/[%\s()<>#?[\]\\"]/g, (char) => encodeURIComponent(char).replace(/\(/g, "%28").replace(/\)/g, "%29"));
110
+ return `${encode3(folder)}/${encode3(file2)}`;
111
+ }
112
+ var MAX_IMAGE_BYTES, startsWith, imageMarkdown;
113
+ var init_images = __esm({
114
+ "packages/core/dist/images.js"() {
115
+ "use strict";
116
+ MAX_IMAGE_BYTES = 10 * 1024 * 1024;
117
+ startsWith = (bytes, signature, offset = 0) => [...signature].every((char, i) => bytes[offset + i] === char.charCodeAt(0));
118
+ imageMarkdown = (path) => `![](${path})`;
119
+ }
120
+ });
121
+
69
122
  // packages/core/dist/index.js
70
123
  var dist_exports = {};
71
124
  __export(dist_exports, {
72
125
  DAY_MS: () => DAY_MS,
126
+ MAX_IMAGE_BYTES: () => MAX_IMAGE_BYTES,
73
127
  PRODUCT: () => PRODUCT,
74
128
  TRIAL_MS: () => TRIAL_MS,
75
129
  YUNFAN_BILLING_ORIGIN: () => YUNFAN_BILLING_ORIGIN,
76
130
  billingFlowUrl: () => billingFlowUrl,
131
+ decodeImageDataUrl: () => decodeImageDataUrl,
77
132
  documentSetting: () => documentSetting,
78
133
  frontMatterTitle: () => frontMatterTitle,
79
134
  hasAccess: () => hasAccess,
135
+ imageFileName: () => imageFileName,
136
+ imageFolderName: () => imageFolderName,
137
+ imageLinkPath: () => imageLinkPath,
138
+ imageMarkdown: () => imageMarkdown,
80
139
  isRich: () => isRich,
81
140
  parse: () => parse,
82
141
  plainText: () => plainText,
83
142
  sanitizeViewState: () => sanitizeViewState,
84
143
  serialize: () => serialize,
85
144
  serializeWithLines: () => serializeWithLines,
145
+ sniffImage: () => sniffImage,
86
146
  trialDaysLeft: () => trialDaysLeft,
87
147
  withDocumentSetting: () => withDocumentSetting,
88
148
  withFrontMatterTitle: () => withFrontMatterTitle
@@ -451,6 +511,7 @@ var init_dist = __esm({
451
511
  "packages/core/dist/index.js"() {
452
512
  "use strict";
453
513
  init_product();
514
+ init_images();
454
515
  THEMATIC_BREAK = /^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/;
455
516
  ITEM = /^(\s*)([-*+]|\d+[.)])(?:([ \t]+)(.*))?$/;
456
517
  YAML_KEY = /^(?:"[^"]*"|'[^']*'|[^\s#"'-].*?)[ \t]*:(?:[ \t]|$)/;
@@ -466,7 +527,7 @@ var INKMAP_VERSION;
466
527
  var init_version = __esm({
467
528
  "packages/cli/dist/version.js"() {
468
529
  "use strict";
469
- INKMAP_VERSION = "0.3.17";
530
+ INKMAP_VERSION = "0.3.19";
470
531
  }
471
532
  });
472
533
 
@@ -549,7 +610,7 @@ function billingOrigin(raw) {
549
610
  }
550
611
  return url2.origin;
551
612
  }
552
- function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHost = "", waitPollMs = WAIT_FAST_MS } = {}) {
613
+ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHost = "", waitPollMs = WAIT_FAST_MS, reviewPrompt = true } = {}) {
553
614
  const listeners = /* @__PURE__ */ new Set();
554
615
  let current = { pro: false };
555
616
  let trial;
@@ -560,6 +621,25 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
560
621
  let sentAppOpen = false;
561
622
  let detectedHost = defaultHost;
562
623
  const pendingEvents = /* @__PURE__ */ new Map();
624
+ let reviewDue = false;
625
+ let reviewCounting = Promise.resolve();
626
+ const countForReview = (event, count) => {
627
+ reviewCounting = reviewCounting.then(async () => {
628
+ if (disposed || reviewDue)
629
+ return;
630
+ const usage = await readReviewUsage();
631
+ if (usage.done)
632
+ return;
633
+ if (event === "doc_open")
634
+ usage.opens += count;
635
+ else
636
+ usage.edits += count;
637
+ await writeReviewUsage(usage);
638
+ if (usage.opens >= REVIEW_MIN_OPENS && usage.edits >= REVIEW_MIN_EDITS)
639
+ reviewDue = true;
640
+ }).catch(() => {
641
+ });
642
+ };
563
643
  let lastCheck = 0;
564
644
  let retryAfter = 0;
565
645
  let fastPollUntil = 0;
@@ -1034,12 +1114,22 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
1034
1114
  });
1035
1115
  }
1036
1116
  return {
1037
- async state() {
1117
+ async state(options) {
1038
1118
  await (trial ??= startTrial());
1039
1119
  const interval = !current.pro && Date.now() < fastPollUntil ? 2e3 : 6e4;
1040
1120
  if (Date.now() - lastCheck >= interval && Date.now() >= retryAfter)
1041
1121
  await refresh();
1042
1122
  await parkUnpaidSession();
1123
+ await reviewCounting;
1124
+ if (options?.forUi && reviewDue && hasAccess(current)) {
1125
+ reviewDue = false;
1126
+ const usage = await readReviewUsage().catch(() => void 0);
1127
+ if (usage && !usage.done) {
1128
+ await writeReviewUsage({ ...usage, done: true }).catch(() => {
1129
+ });
1130
+ return { ...current, reviewPrompt: true };
1131
+ }
1132
+ }
1043
1133
  return current;
1044
1134
  },
1045
1135
  async connect(mode, localeHint) {
@@ -1387,6 +1477,8 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
1387
1477
  if (event !== "app_open") {
1388
1478
  pendingEvents.set(event, Math.min(1e3, (pendingEvents.get(event) ?? 0) + count));
1389
1479
  }
1480
+ if (reviewPrompt && !process.env.CI && (event === "doc_open" || event === "doc_edit"))
1481
+ countForReview(event, count);
1390
1482
  if (telemetryTimer)
1391
1483
  return;
1392
1484
  telemetryTimer = setTimeout(() => {
@@ -1458,6 +1550,22 @@ async function atomicCreateIfMissing(path, initialContent) {
1458
1550
  return await (0, import_promises.readFile)(path, "utf8");
1459
1551
  }
1460
1552
  }
1553
+ async function readReviewUsage() {
1554
+ const count = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : 0;
1555
+ try {
1556
+ const raw = JSON.parse(await (0, import_promises.readFile)(reviewUsagePath(), "utf8"));
1557
+ return { opens: count(raw.opens), edits: count(raw.edits), done: raw.done === true };
1558
+ } catch {
1559
+ return { opens: 0, edits: 0, done: false };
1560
+ }
1561
+ }
1562
+ async function writeReviewUsage(usage) {
1563
+ const path = reviewUsagePath();
1564
+ await (0, import_promises.mkdir)((0, import_node_path.dirname)(path), { recursive: true, mode: 448 });
1565
+ const temporary = path + "." + (0, import_node_crypto.randomUUID)();
1566
+ await (0, import_promises.writeFile)(temporary, JSON.stringify(usage), { mode: 384 });
1567
+ await (0, import_promises.rename)(temporary, path);
1568
+ }
1461
1569
  async function localInstallId() {
1462
1570
  const path = (0, import_node_path.join)(process.env.INKMAP_HOME || (0, import_node_path.join)((0, import_node_os.homedir)(), ".inkmap"), "install-id");
1463
1571
  const generated = "inst_" + (0, import_node_crypto.randomUUID)().replace(/-/g, "").slice(0, 24);
@@ -1487,7 +1595,7 @@ async function localTrialDeadline() {
1487
1595
  const started = Number(value);
1488
1596
  return Number.isSafeInteger(started) && started > 0 && started <= Date.now() ? started + TRIAL_MS : void 0;
1489
1597
  }
1490
- var import_node_child_process, import_promises, import_node_crypto, import_node_os, import_node_path, ZH_LOCALE_RE, EN_LOCALE_RE, cachedOsLocale, WAIT_FAST_MS, WAIT_SLOW_MS, WAIT_FAST_FOR_MS, WAIT_MAX_MS, MAX_WAITING, OFFLINE_PRO_GRACE_MS, PRO_RECHECK_STAMP_MS, DOMESTIC_TIME_ZONE, posixLocale, PASSIVE_TELEMETRY_EVENTS;
1598
+ var import_node_child_process, import_promises, import_node_crypto, import_node_os, import_node_path, ZH_LOCALE_RE, EN_LOCALE_RE, cachedOsLocale, WAIT_FAST_MS, WAIT_SLOW_MS, WAIT_FAST_FOR_MS, WAIT_MAX_MS, MAX_WAITING, OFFLINE_PRO_GRACE_MS, PRO_RECHECK_STAMP_MS, DOMESTIC_TIME_ZONE, posixLocale, PASSIVE_TELEMETRY_EVENTS, REVIEW_MIN_OPENS, REVIEW_MIN_EDITS, reviewUsagePath;
1491
1599
  var init_license = __esm({
1492
1600
  "packages/cli/dist/license.js"() {
1493
1601
  "use strict";
@@ -1510,6 +1618,9 @@ var init_license = __esm({
1510
1618
  DOMESTIC_TIME_ZONE = /^(Asia\/(Shanghai|Chongqing|Chungking|Harbin|Urumqi|Beijing)|PRC)$/i;
1511
1619
  posixLocale = (env) => (env.LC_ALL || env.LC_MESSAGES || env.LANG || "").trim();
1512
1620
  PASSIVE_TELEMETRY_EVENTS = /* @__PURE__ */ new Set(["plugin_activate", "plugin_install", "onboarding_view"]);
1621
+ REVIEW_MIN_OPENS = 5;
1622
+ REVIEW_MIN_EDITS = 3;
1623
+ reviewUsagePath = () => (0, import_node_path.join)(process.env.INKMAP_HOME || (0, import_node_path.join)((0, import_node_os.homedir)(), ".inkmap"), "review-prompt");
1513
1624
  }
1514
1625
  });
1515
1626
 
@@ -1841,52 +1952,83 @@ var init_workspace_fs = __esm({
1841
1952
  }
1842
1953
  });
1843
1954
 
1955
+ // packages/cli/dist/image-assets.js
1956
+ async function saveImageAsset(documentDir, documentFileName, image, when = /* @__PURE__ */ new Date()) {
1957
+ const folder = imageFolderName(documentFileName);
1958
+ const target = (0, import_node_path3.join)(documentDir, folder);
1959
+ await (0, import_promises3.mkdir)(target, { recursive: true });
1960
+ if (!insideOrEqual(await (0, import_promises3.realpath)(documentDir), await (0, import_promises3.realpath)(target))) {
1961
+ throw new Error(say("\u56FE\u7247\u76EE\u5F55\u6307\u5411\u6587\u6863\u76EE\u5F55\u4E4B\u5916\uFF0C\u672A\u4FDD\u5B58\u56FE\u7247\u3002", "The pictures folder leads outside the document's folder, so nothing was saved."));
1962
+ }
1963
+ for (let attempt = 1; attempt <= 100; attempt++) {
1964
+ const name = imageFileName(when, image.extension, attempt);
1965
+ try {
1966
+ await (0, import_promises3.writeFile)((0, import_node_path3.join)(target, name), image.bytes, { flag: "wx" });
1967
+ return imageLinkPath(folder, name);
1968
+ } catch (error62) {
1969
+ if (error62.code !== "EEXIST")
1970
+ throw error62;
1971
+ }
1972
+ }
1973
+ throw new Error(say("\u65E0\u6CD5\u4E3A\u56FE\u7247\u751F\u6210\u65B0\u7684\u6587\u4EF6\u540D\u3002", "Could not find a free file name for the picture."));
1974
+ }
1975
+ var import_promises3, import_node_path3;
1976
+ var init_image_assets = __esm({
1977
+ "packages/cli/dist/image-assets.js"() {
1978
+ "use strict";
1979
+ import_promises3 = require("node:fs/promises");
1980
+ import_node_path3 = require("node:path");
1981
+ init_dist();
1982
+ init_workspace_fs();
1983
+ }
1984
+ });
1985
+
1844
1986
  // packages/cli/dist/server.js
1845
1987
  function docName(path) {
1846
- return (0, import_node_path3.basename)(path).replace(/\.md$/i, "").replace(/\.markmap$/i, "");
1988
+ return (0, import_node_path4.basename)(path).replace(/\.md$/i, "").replace(/\.markmap$/i, "");
1847
1989
  }
1848
1990
  function viewStateFile(key) {
1849
- const base = process.env.INKMAP_HOME || (0, import_node_path3.join)((0, import_node_os3.homedir)(), ".inkmap");
1850
- return (0, import_node_path3.join)(base, "view-state", hash(key) + ".json");
1991
+ const base = process.env.INKMAP_HOME || (0, import_node_path4.join)((0, import_node_os3.homedir)(), ".inkmap");
1992
+ return (0, import_node_path4.join)(base, "view-state", hash(key) + ".json");
1851
1993
  }
1852
1994
  async function readDiskViewState(key) {
1853
1995
  try {
1854
- return sanitizeViewState(JSON.parse(await (0, import_promises3.readFile)(viewStateFile(key), "utf8")));
1996
+ return sanitizeViewState(JSON.parse(await (0, import_promises4.readFile)(viewStateFile(key), "utf8")));
1855
1997
  } catch {
1856
1998
  return void 0;
1857
1999
  }
1858
2000
  }
1859
2001
  async function writeDiskViewState(key, state) {
1860
2002
  const target = viewStateFile(key);
1861
- await (0, import_promises3.mkdir)((0, import_node_path3.dirname)(target), { recursive: true, mode: 448 });
2003
+ await (0, import_promises4.mkdir)((0, import_node_path4.dirname)(target), { recursive: true, mode: 448 });
1862
2004
  const temp = `${target}.${process.pid}.${Date.now()}`;
1863
2005
  try {
1864
- await (0, import_promises3.writeFile)(temp, JSON.stringify(state), { mode: 384 });
1865
- await (0, import_promises3.rename)(temp, target);
2006
+ await (0, import_promises4.writeFile)(temp, JSON.stringify(state), { mode: 384 });
2007
+ await (0, import_promises4.rename)(temp, target);
1866
2008
  } finally {
1867
- await (0, import_promises3.rm)(temp, { force: true }).catch(() => {
2009
+ await (0, import_promises4.rm)(temp, { force: true }).catch(() => {
1868
2010
  });
1869
2011
  }
1870
2012
  }
1871
2013
  async function fileSource(file2, log = () => {
1872
2014
  }) {
1873
- const path = await (0, import_promises3.realpath)((0, import_node_path3.resolve)(file2)).catch(() => (0, import_node_path3.resolve)(file2));
1874
- if (!(await (0, import_promises3.stat)(path)).isFile())
2015
+ const path = await (0, import_promises4.realpath)((0, import_node_path4.resolve)(file2)).catch(() => (0, import_node_path4.resolve)(file2));
2016
+ if (!(await (0, import_promises4.stat)(path)).isFile())
1875
2017
  throw new Error(`\u4E0D\u662F\u6587\u4EF6\uFF1A${path}`);
1876
- const dir = (0, import_node_path3.dirname)(path);
2018
+ const dir = (0, import_node_path4.dirname)(path);
1877
2019
  return {
1878
2020
  name: docName(path),
1879
2021
  key: path,
1880
2022
  dir,
1881
- read: () => (0, import_promises3.readFile)(path, "utf8"),
2023
+ read: () => (0, import_promises4.readFile)(path, "utf8"),
1882
2024
  async write(md) {
1883
- await (0, import_promises3.writeFile)(path, md, "utf8");
2025
+ await (0, import_promises4.writeFile)(path, md, "utf8");
1884
2026
  log(`\u5DF2\u5199\u56DE ${path}`);
1885
2027
  },
1886
2028
  watch(onChange) {
1887
2029
  try {
1888
2030
  const watcher = (0, import_node_fs.watch)(dir, (_2, changed) => {
1889
- if (!changed || changed === (0, import_node_path3.basename)(path))
2031
+ if (!changed || changed === (0, import_node_path4.basename)(path))
1890
2032
  onChange();
1891
2033
  });
1892
2034
  watcher.on("error", () => {
@@ -1908,9 +2050,9 @@ function within(root, rel, allowAbsoluteInRoot = false) {
1908
2050
  } catch {
1909
2051
  return null;
1910
2052
  }
1911
- const resolvedRoot = (0, import_node_path3.resolve)(root);
1912
- const base = resolvedRoot.endsWith(import_node_path3.sep) ? resolvedRoot : resolvedRoot + import_node_path3.sep;
1913
- const full = allowAbsoluteInRoot && /^(?:[\\/]|[A-Za-z]:[\\/])/.test(decoded) ? (0, import_node_path3.normalize)(decoded) : (0, import_node_path3.normalize)((0, import_node_path3.join)(resolvedRoot, decoded));
2053
+ const resolvedRoot = (0, import_node_path4.resolve)(root);
2054
+ const base = resolvedRoot.endsWith(import_node_path4.sep) ? resolvedRoot : resolvedRoot + import_node_path4.sep;
2055
+ const full = allowAbsoluteInRoot && /^(?:[\\/]|[A-Za-z]:[\\/])/.test(decoded) ? (0, import_node_path4.normalize)(decoded) : (0, import_node_path4.normalize)((0, import_node_path4.join)(resolvedRoot, decoded));
1914
2056
  return full.startsWith(base) ? full : null;
1915
2057
  }
1916
2058
  async function serve({ source: initialSource, webRoot, port = 4377, host = "127.0.0.1", log = () => {
@@ -1968,19 +2110,19 @@ data: ${JSON.stringify(data)}
1968
2110
  }), 80);
1969
2111
  };
1970
2112
  let unwatch = activeSource.watch(scheduleRefresh);
1971
- const canonicalActiveKey = async () => activeSource.key ? await (0, import_promises3.realpath)(activeSource.key).catch(() => activeSource.key) : void 0;
2113
+ const canonicalActiveKey = async () => activeSource.key ? await (0, import_promises4.realpath)(activeSource.key).catch(() => activeSource.key) : void 0;
1972
2114
  async function collectWorkspaceFiles() {
1973
2115
  const roots = /* @__PURE__ */ new Map();
1974
2116
  if (activeSource.key && !confineToWorkspaceRoots) {
1975
- const realKey = await (0, import_promises3.realpath)(activeSource.key).catch(() => activeSource.key);
1976
- const projRoot = await (0, import_promises3.realpath)(await findProjectRoot(realKey)).catch(() => (0, import_node_path3.dirname)(realKey));
1977
- roots.set(projRoot, { path: projRoot, name: (0, import_node_path3.basename)(projRoot), active: true });
2117
+ const realKey = await (0, import_promises4.realpath)(activeSource.key).catch(() => activeSource.key);
2118
+ const projRoot = await (0, import_promises4.realpath)(await findProjectRoot(realKey)).catch(() => (0, import_node_path4.dirname)(realKey));
2119
+ roots.set(projRoot, { path: projRoot, name: (0, import_node_path4.basename)(projRoot), active: true });
1978
2120
  }
1979
- const envRoots = [...workspaceRoots, ...(process.env.INKMAP_WORKSPACES || "").split(import_node_path3.delimiter)].filter(Boolean);
2121
+ const envRoots = [...workspaceRoots, ...(process.env.INKMAP_WORKSPACES || "").split(import_node_path4.delimiter)].filter(Boolean);
1980
2122
  for (const raw of envRoots) {
1981
- const real = await (0, import_promises3.realpath)((0, import_node_path3.resolve)(raw)).catch(() => null);
2123
+ const real = await (0, import_promises4.realpath)((0, import_node_path4.resolve)(raw)).catch(() => null);
1982
2124
  if (real && !roots.has(real)) {
1983
- roots.set(real, { path: real, name: (0, import_node_path3.basename)(real), active: roots.size === 0 });
2125
+ roots.set(real, { path: real, name: (0, import_node_path4.basename)(real), active: roots.size === 0 });
1984
2126
  }
1985
2127
  }
1986
2128
  const items = [];
@@ -1991,7 +2133,7 @@ data: ${JSON.stringify(data)}
1991
2133
  if (seen.has(f2))
1992
2134
  continue;
1993
2135
  seen.add(f2);
1994
- const rel = (0, import_node_path3.relative)(root.path, f2);
2136
+ const rel = (0, import_node_path4.relative)(root.path, f2);
1995
2137
  items.push({
1996
2138
  path: f2,
1997
2139
  label: `${root.name} / ${rel}`,
@@ -2003,7 +2145,7 @@ data: ${JSON.stringify(data)}
2003
2145
  if (activeSource.key && activeReal && !seen.has(activeReal)) {
2004
2146
  items.unshift({
2005
2147
  path: activeSource.key,
2006
- label: `${(0, import_node_path3.basename)(activeSource.dir)} / ${(0, import_node_path3.basename)(activeSource.key)}`,
2148
+ label: `${(0, import_node_path4.basename)(activeSource.dir)} / ${(0, import_node_path4.basename)(activeSource.key)}`,
2007
2149
  group: "active"
2008
2150
  });
2009
2151
  }
@@ -2014,10 +2156,10 @@ data: ${JSON.stringify(data)}
2014
2156
  const notMarkdown = () => new HttpError(400, zh() ? "\u8BF7\u9009\u62E9 .md \u6216 .markmap.md \u6587\u4EF6\u3002" : "Choose a .md or .markmap.md file.");
2015
2157
  if (!candidatePath || typeof candidatePath !== "string" || !/\.md$/i.test(candidatePath))
2016
2158
  throw notMarkdown();
2017
- const resolvedCandidate = (0, import_node_path3.resolve)(candidatePath);
2018
- const rawStat = await (0, import_promises3.lstat)(resolvedCandidate).catch(() => null);
2019
- const realTarget = await (0, import_promises3.realpath)(resolvedCandidate).catch(() => null);
2020
- const targetStat = realTarget ? await (0, import_promises3.stat)(realTarget).catch(() => null) : null;
2159
+ const resolvedCandidate = (0, import_node_path4.resolve)(candidatePath);
2160
+ const rawStat = await (0, import_promises4.lstat)(resolvedCandidate).catch(() => null);
2161
+ const realTarget = await (0, import_promises4.realpath)(resolvedCandidate).catch(() => null);
2162
+ const targetStat = realTarget ? await (0, import_promises4.stat)(realTarget).catch(() => null) : null;
2021
2163
  if (!rawStat || rawStat.isSymbolicLink() && !trustCaller || !realTarget || !targetStat?.isFile() || targetStat.size > MAX_MARKDOWN_BYTES) {
2022
2164
  throw new HttpError(403, zh() ? "\u8BF7\u9009\u62E9 5 MiB \u4EE5\u5185\u7684\u666E\u901A Markdown \u6587\u4EF6\u3002" : "Choose a regular Markdown file up to 5 MiB.");
2023
2165
  }
@@ -2069,15 +2211,15 @@ data: ${JSON.stringify(data)}
2069
2211
  if (!full)
2070
2212
  return json2(res, 403, { error: "forbidden" });
2071
2213
  try {
2072
- const ext = (0, import_node_path3.extname)(full).toLowerCase();
2214
+ const ext = (0, import_node_path4.extname)(full).toLowerCase();
2073
2215
  if (ext === ".html") {
2074
2216
  const osLoc = detectOsLocale();
2075
- const htmlText = (await (0, import_promises3.readFile)(full, "utf8")).replace(/<html\b([^>]*)>/i, () => `<html lang="${osLoc === "zh" ? "zh-CN" : "en"}" data-os-locale="${osLoc}">`);
2217
+ const htmlText = (await (0, import_promises4.readFile)(full, "utf8")).replace(/<html\b([^>]*)>/i, () => `<html lang="${osLoc === "zh" ? "zh-CN" : "en"}" data-os-locale="${osLoc}">`);
2076
2218
  res.writeHead(200, { "content-type": TYPES[".html"], "cache-control": "no-store" });
2077
2219
  res.end(htmlText, "utf8");
2078
2220
  return;
2079
2221
  }
2080
- const body = await (0, import_promises3.readFile)(full);
2222
+ const body = await (0, import_promises4.readFile)(full);
2081
2223
  const headers = {
2082
2224
  "content-type": TYPES[ext] ?? "application/octet-stream",
2083
2225
  "cache-control": sidebar ? "no-store" : "no-cache"
@@ -2171,8 +2313,22 @@ data: ${JSON.stringify(data)}
2171
2313
  return json2(res, 200, { version: version2 });
2172
2314
  });
2173
2315
  }
2316
+ if (url2.pathname === "/api/image" && req.method === "POST") {
2317
+ if (!sameOriginWrite())
2318
+ return json2(res, 403, { error: "forbidden" });
2319
+ const image = decodeImageDataUrl(JSON.parse(await readBody(req)).dataUrl);
2320
+ if ("problem" in image) {
2321
+ return json2(res, image.problem === "size" ? 413 : 415, { error: image.problem });
2322
+ }
2323
+ if (!hasAccess(await license?.state() ?? { pro: false }))
2324
+ return json2(res, 403, { error: "Inkmap trial expired" });
2325
+ return await serialized(async () => {
2326
+ const name = activeSource.key ? (0, import_node_path4.basename)(activeSource.key) : activeSource.name;
2327
+ return json2(res, 200, { path: await saveImageAsset(activeSource.dir, name, image) });
2328
+ });
2329
+ }
2174
2330
  if (url2.pathname === "/api/license" && req.method === "GET")
2175
- return json2(res, 200, await license?.state() ?? { pro: false });
2331
+ return json2(res, 200, await license?.state({ forUi: true }) ?? { pro: false });
2176
2332
  if (url2.pathname === "/api/open" && req.method === "POST") {
2177
2333
  if (!sameOriginWrite())
2178
2334
  return json2(res, 403, { error: "forbidden" });
@@ -2286,8 +2442,8 @@ data: ${JSON.stringify(data)}
2286
2442
  if (url2.pathname.startsWith("/doc-assets/")) {
2287
2443
  let asset = within(activeSource.dir, url2.pathname.slice("/doc-assets/".length), true);
2288
2444
  if (asset) {
2289
- const root = await (0, import_promises3.realpath)(activeSource.dir).catch(() => null);
2290
- asset = await (0, import_promises3.realpath)(asset).catch(() => null);
2445
+ const root = await (0, import_promises4.realpath)(activeSource.dir).catch(() => null);
2446
+ asset = await (0, import_promises4.realpath)(asset).catch(() => null);
2291
2447
  const allowedExt = sidebar ? /\.(?:png|jpe?g|gif|webp|avif|bmp|ico)$/i : /\.(?:png|jpe?g|gif|webp|avif|bmp|ico|svg)$/i;
2292
2448
  if (!root || !asset || !insideOrEqual(root, asset) || !allowedExt.test(asset))
2293
2449
  asset = null;
@@ -2343,17 +2499,18 @@ data: ${JSON.stringify(data)}
2343
2499
  })
2344
2500
  };
2345
2501
  }
2346
- var import_node_crypto2, import_node_fs, import_promises3, import_node_http, import_node_os3, import_node_path3, MAX_BODY, TYPES, HttpError, LOOPBACK_HOST, hash;
2502
+ var import_node_crypto2, import_node_fs, import_promises4, import_node_http, import_node_os3, import_node_path4, MAX_BODY, TYPES, HttpError, LOOPBACK_HOST, hash;
2347
2503
  var init_server = __esm({
2348
2504
  "packages/cli/dist/server.js"() {
2349
2505
  "use strict";
2350
2506
  init_dist();
2351
2507
  import_node_crypto2 = require("node:crypto");
2352
2508
  import_node_fs = require("node:fs");
2353
- import_promises3 = require("node:fs/promises");
2509
+ import_promises4 = require("node:fs/promises");
2354
2510
  import_node_http = require("node:http");
2355
2511
  import_node_os3 = require("node:os");
2356
- import_node_path3 = require("node:path");
2512
+ import_node_path4 = require("node:path");
2513
+ init_image_assets();
2357
2514
  init_license();
2358
2515
  init_open_browser();
2359
2516
  init_workspace_fs();
@@ -40342,14 +40499,14 @@ function nextTargetSeq() {
40342
40499
  return lastTargetSeq;
40343
40500
  }
40344
40501
  async function writeTargetSelection(filePath, workspaceDir, extra) {
40345
- const real = await (0, import_promises4.realpath)(filePath);
40346
- const info = await (0, import_promises4.lstat)(real);
40502
+ const real = await (0, import_promises5.realpath)(filePath);
40503
+ const info = await (0, import_promises5.lstat)(real);
40347
40504
  if (!info.isFile() || info.size > MAX_MARKDOWN_BYTES || !/\.md$/i.test(real)) {
40348
40505
  throw new Error(say("\u8BF7\u9009\u62E9 5 MiB \u4EE5\u5185\u7684 .md \u6216 .markmap.md \u6587\u4EF6\u3002", "Choose a .md or .markmap.md file up to 5 MiB."));
40349
40506
  }
40350
- const workspace = workspaceDir ? await (0, import_promises4.realpath)(workspaceDir).catch(() => findProjectRoot(real)) : await findProjectRoot(real);
40507
+ const workspace = workspaceDir ? await (0, import_promises5.realpath)(workspaceDir).catch(() => findProjectRoot(real)) : await findProjectRoot(real);
40351
40508
  const statePath = targetStateFile();
40352
- await (0, import_promises4.mkdir)((0, import_node_path4.dirname)(statePath), { recursive: true, mode: 448 });
40509
+ await (0, import_promises5.mkdir)((0, import_node_path5.dirname)(statePath), { recursive: true, mode: 448 });
40353
40510
  const seq = nextTargetSeq();
40354
40511
  const payload = {
40355
40512
  file: real,
@@ -40362,10 +40519,10 @@ async function writeTargetSelection(filePath, workspaceDir, extra) {
40362
40519
  };
40363
40520
  const tmp = `${statePath}.${process.pid}.${seq}`;
40364
40521
  try {
40365
- await (0, import_promises4.writeFile)(tmp, JSON.stringify(payload, null, 2), { mode: 384 });
40366
- await (0, import_promises4.rename)(tmp, statePath);
40522
+ await (0, import_promises5.writeFile)(tmp, JSON.stringify(payload, null, 2), { mode: 384 });
40523
+ await (0, import_promises5.rename)(tmp, statePath);
40367
40524
  } catch (err) {
40368
- await (0, import_promises4.rm)(tmp, { force: true }).catch(() => {
40525
+ await (0, import_promises5.rm)(tmp, { force: true }).catch(() => {
40369
40526
  });
40370
40527
  throw err;
40371
40528
  }
@@ -40399,7 +40556,7 @@ function createMcpWorkspaceManager() {
40399
40556
  const seen = /* @__PURE__ */ new Set();
40400
40557
  if (target && !seen.has(target.file)) {
40401
40558
  const owner = roots.find((r2) => insideOrEqual(r2.path, target.file));
40402
- const rel = owner ? (0, import_node_path4.relative)(owner.path, target.file) : (0, import_node_path4.basename)(target.file);
40559
+ const rel = owner ? (0, import_node_path5.relative)(owner.path, target.file) : (0, import_node_path5.basename)(target.file);
40403
40560
  items.push({
40404
40561
  path: target.file,
40405
40562
  uri: (0, import_node_url2.pathToFileURL)(target.file).href,
@@ -40414,7 +40571,7 @@ function createMcpWorkspaceManager() {
40414
40571
  if (seen.has(entry.path))
40415
40572
  continue;
40416
40573
  seen.add(entry.path);
40417
- const rel = (0, import_node_path4.relative)(root.path, entry.path);
40574
+ const rel = (0, import_node_path5.relative)(root.path, entry.path);
40418
40575
  items.push({
40419
40576
  path: entry.path,
40420
40577
  uri: (0, import_node_url2.pathToFileURL)(entry.path).href,
@@ -40548,13 +40705,13 @@ function createMcpWorkspaceManager() {
40548
40705
  })
40549
40706
  };
40550
40707
  }
40551
- var import_node_crypto3, import_promises4, import_node_path4, import_node_url2, sha1, lastTargetSeq;
40708
+ var import_node_crypto3, import_promises5, import_node_path5, import_node_url2, sha1, lastTargetSeq;
40552
40709
  var init_mcp_files = __esm({
40553
40710
  "packages/cli/dist/mcp-files.js"() {
40554
40711
  "use strict";
40555
40712
  import_node_crypto3 = require("node:crypto");
40556
- import_promises4 = require("node:fs/promises");
40557
- import_node_path4 = require("node:path");
40713
+ import_promises5 = require("node:fs/promises");
40714
+ import_node_path5 = require("node:path");
40558
40715
  import_node_url2 = require("node:url");
40559
40716
  init_dist();
40560
40717
  init_server();
@@ -40571,17 +40728,17 @@ __export(codex_exports, {
40571
40728
  serveCodex: () => serveCodex
40572
40729
  });
40573
40730
  function resolveWebRoot() {
40574
- return WEB_ROOT_CANDIDATES.find((dir) => (0, import_node_fs2.existsSync)((0, import_node_path5.join)(dir, "index.html"))) ?? null;
40731
+ return WEB_ROOT_CANDIDATES.find((dir) => (0, import_node_fs2.existsSync)((0, import_node_path6.join)(dir, "index.html"))) ?? null;
40575
40732
  }
40576
40733
  async function validatedMarkdownFile(path) {
40577
40734
  if (!path || !/\.md$/i.test(path))
40578
40735
  throw new Error(say("\u8BF7\u9009\u62E9 .md \u6216 .markmap.md \u6587\u4EF6\u3002", "Choose a .md or .markmap.md file."));
40579
- const info = await (0, import_promises5.lstat)(path);
40736
+ const info = await (0, import_promises6.lstat)(path);
40580
40737
  if (info.isSymbolicLink() || !info.isFile() || info.size > MAX_MARKDOWN_BYTES) {
40581
40738
  throw new Error(say("\u8BF7\u9009\u62E9 5 MiB \u4EE5\u5185\u7684\u666E\u901A Markdown \u6587\u4EF6\u3002", "Choose a regular Markdown file up to 5 MiB."));
40582
40739
  }
40583
- const real = await (0, import_promises5.realpath)(path);
40584
- const home = await (0, import_promises5.realpath)((0, import_node_os4.homedir)()).catch(() => (0, import_node_os4.homedir)());
40740
+ const real = await (0, import_promises6.realpath)(path);
40741
+ const home = await (0, import_promises6.realpath)((0, import_node_os4.homedir)()).catch(() => (0, import_node_os4.homedir)());
40585
40742
  if (!/\.md$/i.test(real) || insideOrEqual(home, real) && hasHiddenSegment(home, real)) {
40586
40743
  throw new Error(say("\u4E0D\u652F\u6301\u8BBF\u95EE\u8BE5\u6587\u4EF6\u3002", "This file cannot be opened."));
40587
40744
  }
@@ -40589,7 +40746,7 @@ async function validatedMarkdownFile(path) {
40589
40746
  }
40590
40747
  async function createInkmapMcpServer(options = {}) {
40591
40748
  const loadHtml = async () => {
40592
- const raw = options.html ?? await (0, import_promises5.readFile)(HTML, "utf8").catch((error62) => {
40749
+ const raw = options.html ?? await (0, import_promises6.readFile)(HTML, "utf8").catch((error62) => {
40593
40750
  if (error62.code === "ENOENT") {
40594
40751
  throw new Error("MCP App editor assets are missing. Run npm run build:sidebars.");
40595
40752
  }
@@ -40642,9 +40799,9 @@ async function createInkmapMcpServer(options = {}) {
40642
40799
  const clientName = server.server.getClientVersion()?.name ?? "";
40643
40800
  let extDir = null;
40644
40801
  if (/cursor/i.test(clientName)) {
40645
- extDir = (0, import_node_path5.join)(process.env.INKMAP_CURSOR_CONFIG_DIR || (0, import_node_path5.join)((0, import_node_os4.homedir)(), ".cursor"), "extensions");
40802
+ extDir = (0, import_node_path6.join)(process.env.INKMAP_CURSOR_CONFIG_DIR || (0, import_node_path6.join)((0, import_node_os4.homedir)(), ".cursor"), "extensions");
40646
40803
  } else if (/visual studio code|vscode/i.test(clientName)) {
40647
- extDir = (0, import_node_path5.join)((0, import_node_os4.homedir)(), ".vscode", "extensions");
40804
+ extDir = (0, import_node_path6.join)((0, import_node_os4.homedir)(), ".vscode", "extensions");
40648
40805
  }
40649
40806
  if (!extDir || !(0, import_node_fs2.existsSync)(extDir))
40650
40807
  return false;
@@ -40664,12 +40821,12 @@ async function createInkmapMcpServer(options = {}) {
40664
40821
  async function waitForEditorBridgeAck(seq, timeoutMs = 280) {
40665
40822
  if (!seq)
40666
40823
  return false;
40667
- const inkmapDir = process.env.INKMAP_HOME || (0, import_node_path5.join)((0, import_node_os4.homedir)(), ".inkmap");
40668
- const ackPath = (0, import_node_path5.join)(inkmapDir, "antigravity-target-ack.json");
40824
+ const inkmapDir = process.env.INKMAP_HOME || (0, import_node_path6.join)((0, import_node_os4.homedir)(), ".inkmap");
40825
+ const ackPath = (0, import_node_path6.join)(inkmapDir, "antigravity-target-ack.json");
40669
40826
  const deadline = Date.now() + timeoutMs;
40670
40827
  while (Date.now() < deadline) {
40671
40828
  try {
40672
- const raw = JSON.parse(await (0, import_promises5.readFile)(ackPath, "utf8"));
40829
+ const raw = JSON.parse(await (0, import_promises6.readFile)(ackPath, "utf8"));
40673
40830
  if (raw && raw.ok === true && Number(raw.seq) >= seq) {
40674
40831
  return true;
40675
40832
  }
@@ -40897,7 +41054,7 @@ async function createInkmapMcpServer(options = {}) {
40897
41054
  title: "Check Inkmap access",
40898
41055
  annotations: { readOnlyHint: true },
40899
41056
  _meta: appOnly
40900
- }, async () => ({ content: [], structuredContent: { ...await billing.state() } }));
41057
+ }, async () => ({ content: [], structuredContent: { ...await billing.state({ forUi: true }) } }));
40901
41058
  server.registerTool("inkmap_restore_access", {
40902
41059
  title: "Sign in to Yunfan",
40903
41060
  inputSchema: { locale: external_exports.string().optional() },
@@ -40939,7 +41096,7 @@ async function serveCodex() {
40939
41096
  process.once("SIGINT", shutdown);
40940
41097
  await server.connect(transport);
40941
41098
  }
40942
- var import_node_fs2, import_promises5, import_node_os4, import_node_path5, import_node_url3, UI, HTML, WEB_ROOT_CANDIDATES, INLINE_DOC_LIMIT, appOnly;
41099
+ var import_node_fs2, import_promises6, import_node_os4, import_node_path6, import_node_url3, UI, HTML, WEB_ROOT_CANDIDATES, INLINE_DOC_LIMIT, appOnly;
40943
41100
  var init_codex = __esm({
40944
41101
  "packages/cli/dist/codex.js"() {
40945
41102
  "use strict";
@@ -40947,9 +41104,9 @@ var init_codex = __esm({
40947
41104
  init_stdio2();
40948
41105
  init_server4();
40949
41106
  import_node_fs2 = require("node:fs");
40950
- import_promises5 = require("node:fs/promises");
41107
+ import_promises6 = require("node:fs/promises");
40951
41108
  import_node_os4 = require("node:os");
40952
- import_node_path5 = require("node:path");
41109
+ import_node_path6 = require("node:path");
40953
41110
  import_node_url3 = require("node:url");
40954
41111
  init_zod();
40955
41112
  init_dist();
@@ -41111,33 +41268,33 @@ function isChineseTerminalLocale() {
41111
41268
  return detectOsLocale() === "zh";
41112
41269
  }
41113
41270
  function getInkmapHome() {
41114
- return process.env.INKMAP_HOME || (0, import_node_path6.join)((0, import_node_os5.homedir)(), ".inkmap");
41271
+ return process.env.INKMAP_HOME || (0, import_node_path7.join)((0, import_node_os5.homedir)(), ".inkmap");
41115
41272
  }
41116
41273
  function getClaudeDesktopDir() {
41117
41274
  if (process.env.INKMAP_CLAUDE_CONFIG_DIR)
41118
41275
  return process.env.INKMAP_CLAUDE_CONFIG_DIR;
41119
41276
  if (process.platform === "darwin") {
41120
- return (0, import_node_path6.join)((0, import_node_os5.homedir)(), "Library", "Application Support", "Claude");
41277
+ return (0, import_node_path7.join)((0, import_node_os5.homedir)(), "Library", "Application Support", "Claude");
41121
41278
  }
41122
41279
  if (process.platform === "win32") {
41123
- const appData = process.env.APPDATA || (0, import_node_path6.join)((0, import_node_os5.homedir)(), "AppData", "Roaming");
41124
- return (0, import_node_path6.join)(appData, "Claude");
41280
+ const appData = process.env.APPDATA || (0, import_node_path7.join)((0, import_node_os5.homedir)(), "AppData", "Roaming");
41281
+ return (0, import_node_path7.join)(appData, "Claude");
41125
41282
  }
41126
- const xdg = process.env.XDG_CONFIG_HOME || (0, import_node_path6.join)((0, import_node_os5.homedir)(), ".config");
41127
- return (0, import_node_path6.join)(xdg, "Claude");
41283
+ const xdg = process.env.XDG_CONFIG_HOME || (0, import_node_path7.join)((0, import_node_os5.homedir)(), ".config");
41284
+ return (0, import_node_path7.join)(xdg, "Claude");
41128
41285
  }
41129
41286
  function getCursorDir() {
41130
- return process.env.INKMAP_CURSOR_CONFIG_DIR || (0, import_node_path6.join)((0, import_node_os5.homedir)(), ".cursor");
41287
+ return process.env.INKMAP_CURSOR_CONFIG_DIR || (0, import_node_path7.join)((0, import_node_os5.homedir)(), ".cursor");
41131
41288
  }
41132
41289
  function getEditorDir(editor) {
41133
41290
  const { env, dir } = EXTENSION_EDITORS[editor];
41134
- return process.env[env] || (0, import_node_path6.join)((0, import_node_os5.homedir)(), dir);
41291
+ return process.env[env] || (0, import_node_path7.join)((0, import_node_os5.homedir)(), dir);
41135
41292
  }
41136
41293
  function getClaudeCodeConfigPath() {
41137
- return process.env.INKMAP_CLAUDE_CODE_CONFIG || (0, import_node_path6.join)((0, import_node_os5.homedir)(), ".claude.json");
41294
+ return process.env.INKMAP_CLAUDE_CODE_CONFIG || (0, import_node_path7.join)((0, import_node_os5.homedir)(), ".claude.json");
41138
41295
  }
41139
41296
  function getAntigravityConfigDir() {
41140
- return process.env.ANTIGRAVITY_CONFIG_DIR || (0, import_node_path6.join)((0, import_node_os5.homedir)(), ".gemini", "config");
41297
+ return process.env.ANTIGRAVITY_CONFIG_DIR || (0, import_node_path7.join)((0, import_node_os5.homedir)(), ".gemini", "config");
41141
41298
  }
41142
41299
  function editorPathMarkers(editor) {
41143
41300
  if (editor === "cursor")
@@ -41147,9 +41304,9 @@ function editorPathMarkers(editor) {
41147
41304
  }
41148
41305
  function resolveCommandOnPath(cmd) {
41149
41306
  const exts = process.platform === "win32" ? ["", ".cmd", ".exe", ".bat"] : [""];
41150
- for (const dir of (process.env.PATH || "").split(import_node_path6.delimiter).filter(Boolean)) {
41307
+ for (const dir of (process.env.PATH || "").split(import_node_path7.delimiter).filter(Boolean)) {
41151
41308
  for (const ext of exts) {
41152
- const candidate = (0, import_node_path6.join)(dir, cmd + ext);
41309
+ const candidate = (0, import_node_path7.join)(dir, cmd + ext);
41153
41310
  try {
41154
41311
  if ((0, import_node_fs3.statSync)(candidate).isFile())
41155
41312
  return (0, import_node_fs3.realpathSync)(candidate);
@@ -41173,14 +41330,14 @@ function findCursorCommand() {
41173
41330
  if (process.env.INKMAP_ISOLATED_DETECT)
41174
41331
  return null;
41175
41332
  if (process.platform === "darwin") {
41176
- for (const dir of ["/Applications", (0, import_node_path6.join)((0, import_node_os5.homedir)(), "Applications")]) {
41177
- const cmd = (0, import_node_path6.join)(dir, "Cursor.app/Contents/Resources/app/bin/cursor");
41333
+ for (const dir of ["/Applications", (0, import_node_path7.join)((0, import_node_os5.homedir)(), "Applications")]) {
41334
+ const cmd = (0, import_node_path7.join)(dir, "Cursor.app/Contents/Resources/app/bin/cursor");
41178
41335
  if ((0, import_node_fs3.existsSync)(cmd))
41179
41336
  return cmd;
41180
41337
  }
41181
41338
  } else if (process.platform === "win32") {
41182
- const localApp = process.env.LOCALAPPDATA || (0, import_node_path6.join)((0, import_node_os5.homedir)(), "AppData", "Local");
41183
- const cmd = (0, import_node_path6.join)(localApp, "Programs", "cursor", "resources", "app", "bin", "cursor.cmd");
41339
+ const localApp = process.env.LOCALAPPDATA || (0, import_node_path7.join)((0, import_node_os5.homedir)(), "AppData", "Local");
41340
+ const cmd = (0, import_node_path7.join)(localApp, "Programs", "cursor", "resources", "app", "bin", "cursor.cmd");
41184
41341
  if ((0, import_node_fs3.existsSync)(cmd))
41185
41342
  return cmd;
41186
41343
  }
@@ -41191,14 +41348,14 @@ function findEditorCommand(editor) {
41191
41348
  return null;
41192
41349
  const { cli, macApp, winDir } = EXTENSION_EDITORS[editor];
41193
41350
  if (process.platform === "darwin") {
41194
- for (const dir of ["/Applications", (0, import_node_path6.join)((0, import_node_os5.homedir)(), "Applications")]) {
41195
- const cmd = (0, import_node_path6.join)(dir, macApp, "Contents", "Resources", "app", "bin", cli);
41351
+ for (const dir of ["/Applications", (0, import_node_path7.join)((0, import_node_os5.homedir)(), "Applications")]) {
41352
+ const cmd = (0, import_node_path7.join)(dir, macApp, "Contents", "Resources", "app", "bin", cli);
41196
41353
  if ((0, import_node_fs3.existsSync)(cmd))
41197
41354
  return cmd;
41198
41355
  }
41199
41356
  } else if (process.platform === "win32") {
41200
- const localApp = process.env.LOCALAPPDATA || (0, import_node_path6.join)((0, import_node_os5.homedir)(), "AppData", "Local");
41201
- const cmd = (0, import_node_path6.join)(localApp, "Programs", winDir, "bin", `${cli}.cmd`);
41357
+ const localApp = process.env.LOCALAPPDATA || (0, import_node_path7.join)((0, import_node_os5.homedir)(), "AppData", "Local");
41358
+ const cmd = (0, import_node_path7.join)(localApp, "Programs", winDir, "bin", `${cli}.cmd`);
41202
41359
  if ((0, import_node_fs3.existsSync)(cmd))
41203
41360
  return cmd;
41204
41361
  }
@@ -41218,8 +41375,8 @@ function findCodexCommand() {
41218
41375
  if (probeCliCommand("codex"))
41219
41376
  return "codex";
41220
41377
  if (process.platform === "darwin") {
41221
- for (const dir of ["/Applications", (0, import_node_path6.join)((0, import_node_os5.homedir)(), "Applications")]) {
41222
- const cmd = (0, import_node_path6.join)(dir, "ChatGPT.app/Contents/Resources/codex-cli/bin/codex");
41378
+ for (const dir of ["/Applications", (0, import_node_path7.join)((0, import_node_os5.homedir)(), "Applications")]) {
41379
+ const cmd = (0, import_node_path7.join)(dir, "ChatGPT.app/Contents/Resources/codex-cli/bin/codex");
41223
41380
  if ((0, import_node_fs3.existsSync)(cmd))
41224
41381
  return cmd;
41225
41382
  }
@@ -41227,7 +41384,7 @@ function findCodexCommand() {
41227
41384
  return null;
41228
41385
  }
41229
41386
  function getDshHome() {
41230
- return process.env.DSH_HOME || (0, import_node_path6.join)((0, import_node_os5.homedir)(), ".dsh");
41387
+ return process.env.DSH_HOME || (0, import_node_path7.join)((0, import_node_os5.homedir)(), ".dsh");
41231
41388
  }
41232
41389
  function findDshCommand() {
41233
41390
  if (process.env.INKMAP_DSH_BIN) {
@@ -41238,14 +41395,14 @@ function findDshCommand() {
41238
41395
  if (probeCliCommand("dsh"))
41239
41396
  return "dsh";
41240
41397
  if (process.platform === "darwin") {
41241
- for (const dir of ["/Applications", (0, import_node_path6.join)((0, import_node_os5.homedir)(), "Applications")]) {
41242
- const cmd = (0, import_node_path6.join)(dir, "DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh");
41398
+ for (const dir of ["/Applications", (0, import_node_path7.join)((0, import_node_os5.homedir)(), "Applications")]) {
41399
+ const cmd = (0, import_node_path7.join)(dir, "DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh");
41243
41400
  if ((0, import_node_fs3.existsSync)(cmd))
41244
41401
  return cmd;
41245
41402
  }
41246
41403
  } else if (process.platform === "win32") {
41247
- const localApp = process.env.LOCALAPPDATA || (0, import_node_path6.join)((0, import_node_os5.homedir)(), "AppData", "Local");
41248
- const cmd = (0, import_node_path6.join)(localApp, "Programs", "DeepSeek Harness", "resources", "runtime", "cli", "bin", "dsh.cmd");
41404
+ const localApp = process.env.LOCALAPPDATA || (0, import_node_path7.join)((0, import_node_os5.homedir)(), "AppData", "Local");
41405
+ const cmd = (0, import_node_path7.join)(localApp, "Programs", "DeepSeek Harness", "resources", "runtime", "cli", "bin", "dsh.cmd");
41249
41406
  if ((0, import_node_fs3.existsSync)(cmd))
41250
41407
  return cmd;
41251
41408
  }
@@ -41254,7 +41411,7 @@ function findDshCommand() {
41254
41411
  function detectInstalledTargets() {
41255
41412
  const found = [];
41256
41413
  const claudeDir = getClaudeDesktopDir();
41257
- if ((0, import_node_fs3.existsSync)(claudeDir) || process.platform === "darwin" && ((0, import_node_fs3.existsSync)("/Applications/Claude.app") || (0, import_node_fs3.existsSync)((0, import_node_path6.join)((0, import_node_os5.homedir)(), "Applications", "Claude.app")))) {
41414
+ if ((0, import_node_fs3.existsSync)(claudeDir) || process.platform === "darwin" && ((0, import_node_fs3.existsSync)("/Applications/Claude.app") || (0, import_node_fs3.existsSync)((0, import_node_path7.join)((0, import_node_os5.homedir)(), "Applications", "Claude.app")))) {
41258
41415
  found.push("claude");
41259
41416
  }
41260
41417
  const claudeCodeCfg = getClaudeCodeConfigPath();
@@ -41269,7 +41426,7 @@ function detectInstalledTargets() {
41269
41426
  found.push(editor);
41270
41427
  }
41271
41428
  const agyDir = getAntigravityConfigDir();
41272
- if ((0, import_node_fs3.existsSync)(agyDir) || !process.env.ANTIGRAVITY_CONFIG_DIR && (0, import_node_fs3.existsSync)((0, import_node_path6.join)((0, import_node_os5.homedir)(), ".gemini", "antigravity"))) {
41429
+ if ((0, import_node_fs3.existsSync)(agyDir) || !process.env.ANTIGRAVITY_CONFIG_DIR && (0, import_node_fs3.existsSync)((0, import_node_path7.join)((0, import_node_os5.homedir)(), ".gemini", "antigravity"))) {
41273
41430
  found.push("antigravity");
41274
41431
  }
41275
41432
  if (!process.env.INKMAP_ISOLATED_DETECT && findCodexCommand()) {
@@ -41277,7 +41434,7 @@ function detectInstalledTargets() {
41277
41434
  } else if (process.env.INKMAP_CODEX_BIN && (0, import_node_fs3.existsSync)(process.env.INKMAP_CODEX_BIN)) {
41278
41435
  found.push("codex");
41279
41436
  }
41280
- if (!process.env.INKMAP_ISOLATED_DETECT && (findDshCommand() || (0, import_node_fs3.existsSync)((0, import_node_path6.join)(getDshHome(), "profiles", "desktop"))) || process.env.INKMAP_DSH_BIN && (0, import_node_fs3.existsSync)(process.env.INKMAP_DSH_BIN)) {
41437
+ if (!process.env.INKMAP_ISOLATED_DETECT && (findDshCommand() || (0, import_node_fs3.existsSync)((0, import_node_path7.join)(getDshHome(), "profiles", "desktop"))) || process.env.INKMAP_DSH_BIN && (0, import_node_fs3.existsSync)(process.env.INKMAP_DSH_BIN)) {
41281
41438
  found.push("deepseek");
41282
41439
  }
41283
41440
  return found;
@@ -41300,7 +41457,7 @@ function readJsonObject(filePath) {
41300
41457
  return parsed;
41301
41458
  }
41302
41459
  function writeJsonAtomic(filePath, data) {
41303
- (0, import_node_fs3.mkdirSync)((0, import_node_path6.dirname)(filePath), { recursive: true });
41460
+ (0, import_node_fs3.mkdirSync)((0, import_node_path7.dirname)(filePath), { recursive: true });
41304
41461
  let target = filePath;
41305
41462
  let mode = 384;
41306
41463
  try {
@@ -41313,67 +41470,67 @@ function writeJsonAtomic(filePath, data) {
41313
41470
  (0, import_node_fs3.renameSync)(tmp, target);
41314
41471
  }
41315
41472
  function stageStandaloneMcpApp() {
41316
- const appDir = (0, import_node_path6.join)(getInkmapHome(), "mcp-app");
41473
+ const appDir = (0, import_node_path7.join)(getInkmapHome(), "mcp-app");
41317
41474
  (0, import_node_fs3.mkdirSync)(appDir, { recursive: true });
41318
- const bundledCli = (0, import_node_path6.join)(DIST_DIR, "cli.cjs");
41319
- const bundledHtml = (0, import_node_path6.join)(DIST_DIR, "codex.html");
41320
- const bundledWeb = (0, import_node_path6.join)(DIST_DIR, "web");
41321
- const monorepoAntigravity = (0, import_node_path6.resolve)(PKG_ROOT, "..", "..", "dist", "sidebars", "inkmap-antigravity", "inkmap");
41475
+ const bundledCli = (0, import_node_path7.join)(DIST_DIR, "cli.cjs");
41476
+ const bundledHtml = (0, import_node_path7.join)(DIST_DIR, "codex.html");
41477
+ const bundledWeb = (0, import_node_path7.join)(DIST_DIR, "web");
41478
+ const monorepoAntigravity = (0, import_node_path7.resolve)(PKG_ROOT, "..", "..", "dist", "sidebars", "inkmap-antigravity", "inkmap");
41322
41479
  if ((0, import_node_fs3.existsSync)(bundledCli) && (0, import_node_fs3.existsSync)(bundledHtml)) {
41323
- (0, import_node_fs3.cpSync)(bundledCli, (0, import_node_path6.join)(appDir, "cli.cjs"));
41324
- (0, import_node_fs3.cpSync)(bundledHtml, (0, import_node_path6.join)(appDir, "codex.html"));
41480
+ (0, import_node_fs3.cpSync)(bundledCli, (0, import_node_path7.join)(appDir, "cli.cjs"));
41481
+ (0, import_node_fs3.cpSync)(bundledHtml, (0, import_node_path7.join)(appDir, "codex.html"));
41325
41482
  if ((0, import_node_fs3.existsSync)(bundledWeb)) {
41326
- (0, import_node_fs3.rmSync)((0, import_node_path6.join)(appDir, "web"), { recursive: true, force: true });
41327
- (0, import_node_fs3.cpSync)(bundledWeb, (0, import_node_path6.join)(appDir, "web"), { recursive: true });
41483
+ (0, import_node_fs3.rmSync)((0, import_node_path7.join)(appDir, "web"), { recursive: true, force: true });
41484
+ (0, import_node_fs3.cpSync)(bundledWeb, (0, import_node_path7.join)(appDir, "web"), { recursive: true });
41328
41485
  }
41329
- (0, import_node_fs3.writeFileSync)((0, import_node_path6.join)(appDir, "server.cjs"), SERVER_WRAPPER, { mode: 493 });
41486
+ (0, import_node_fs3.writeFileSync)((0, import_node_path7.join)(appDir, "server.cjs"), SERVER_WRAPPER, { mode: 493 });
41330
41487
  for (const notice of ["LICENSE.md", "THIRD_PARTY_NOTICES.md"]) {
41331
- const src = (0, import_node_path6.join)(PKG_ROOT, notice);
41488
+ const src = (0, import_node_path7.join)(PKG_ROOT, notice);
41332
41489
  if ((0, import_node_fs3.existsSync)(src))
41333
- (0, import_node_fs3.cpSync)(src, (0, import_node_path6.join)(appDir, notice));
41490
+ (0, import_node_fs3.cpSync)(src, (0, import_node_path7.join)(appDir, notice));
41334
41491
  }
41335
- return { serverScript: (0, import_node_path6.join)(appDir, "server.cjs"), appDir };
41492
+ return { serverScript: (0, import_node_path7.join)(appDir, "server.cjs"), appDir };
41336
41493
  }
41337
- if ((0, import_node_fs3.existsSync)((0, import_node_path6.join)(monorepoAntigravity, "server.cjs")) && (0, import_node_fs3.existsSync)((0, import_node_path6.join)(monorepoAntigravity, "codex.html"))) {
41338
- (0, import_node_fs3.cpSync)((0, import_node_path6.join)(monorepoAntigravity, "server.cjs"), (0, import_node_path6.join)(appDir, "server.cjs"));
41339
- (0, import_node_fs3.cpSync)((0, import_node_path6.join)(monorepoAntigravity, "codex.html"), (0, import_node_path6.join)(appDir, "codex.html"));
41340
- const sidecarWeb = (0, import_node_path6.join)(monorepoAntigravity, "sidecars", "inkmap", "web");
41494
+ if ((0, import_node_fs3.existsSync)((0, import_node_path7.join)(monorepoAntigravity, "server.cjs")) && (0, import_node_fs3.existsSync)((0, import_node_path7.join)(monorepoAntigravity, "codex.html"))) {
41495
+ (0, import_node_fs3.cpSync)((0, import_node_path7.join)(monorepoAntigravity, "server.cjs"), (0, import_node_path7.join)(appDir, "server.cjs"));
41496
+ (0, import_node_fs3.cpSync)((0, import_node_path7.join)(monorepoAntigravity, "codex.html"), (0, import_node_path7.join)(appDir, "codex.html"));
41497
+ const sidecarWeb = (0, import_node_path7.join)(monorepoAntigravity, "sidecars", "inkmap", "web");
41341
41498
  if ((0, import_node_fs3.existsSync)(sidecarWeb)) {
41342
- (0, import_node_fs3.rmSync)((0, import_node_path6.join)(appDir, "web"), { recursive: true, force: true });
41343
- (0, import_node_fs3.cpSync)(sidecarWeb, (0, import_node_path6.join)(appDir, "web"), { recursive: true });
41499
+ (0, import_node_fs3.rmSync)((0, import_node_path7.join)(appDir, "web"), { recursive: true, force: true });
41500
+ (0, import_node_fs3.cpSync)(sidecarWeb, (0, import_node_path7.join)(appDir, "web"), { recursive: true });
41344
41501
  }
41345
41502
  for (const notice of ["LICENSE.md", "THIRD_PARTY_NOTICES.md"]) {
41346
- const src = (0, import_node_path6.join)(monorepoAntigravity, notice);
41503
+ const src = (0, import_node_path7.join)(monorepoAntigravity, notice);
41347
41504
  if ((0, import_node_fs3.existsSync)(src))
41348
- (0, import_node_fs3.cpSync)(src, (0, import_node_path6.join)(appDir, notice));
41505
+ (0, import_node_fs3.cpSync)(src, (0, import_node_path7.join)(appDir, notice));
41349
41506
  }
41350
- return { serverScript: (0, import_node_path6.join)(appDir, "server.cjs"), appDir };
41507
+ return { serverScript: (0, import_node_path7.join)(appDir, "server.cjs"), appDir };
41351
41508
  }
41352
- const devBin = (0, import_node_path6.join)(PKG_ROOT, "bin", "inkmap.js");
41509
+ const devBin = (0, import_node_path7.join)(PKG_ROOT, "bin", "inkmap.js");
41353
41510
  if ((0, import_node_fs3.existsSync)(devBin) && (0, import_node_fs3.existsSync)(bundledHtml)) {
41354
41511
  return { serverScript: devBin, appDir };
41355
41512
  }
41356
41513
  throw new Error("\u672A\u627E\u5230\u5DF2\u6784\u5EFA\u7684 MCP App \u8D44\u6E90\uFF08codex.html\uFF09\u3002/ Built MCP App assets are missing.");
41357
41514
  }
41358
41515
  function installIdeExtension(editorDir, cliCmd) {
41359
- const vscodeBundle = (0, import_node_path6.join)(DIST_DIR, "bundles", "vscode");
41360
- const bundledWeb = (0, import_node_path6.join)(DIST_DIR, "web");
41361
- if (!(0, import_node_fs3.existsSync)((0, import_node_path6.join)(vscodeBundle, "package.json")) || !(0, import_node_fs3.existsSync)((0, import_node_path6.join)(vscodeBundle, "dist", "extension.js"))) {
41516
+ const vscodeBundle = (0, import_node_path7.join)(DIST_DIR, "bundles", "vscode");
41517
+ const bundledWeb = (0, import_node_path7.join)(DIST_DIR, "web");
41518
+ if (!(0, import_node_fs3.existsSync)((0, import_node_path7.join)(vscodeBundle, "package.json")) || !(0, import_node_fs3.existsSync)((0, import_node_path7.join)(vscodeBundle, "dist", "extension.js"))) {
41362
41519
  return null;
41363
41520
  }
41364
- const extPkg = JSON.parse((0, import_node_fs3.readFileSync)((0, import_node_path6.join)(vscodeBundle, "package.json"), "utf8"));
41521
+ const extPkg = JSON.parse((0, import_node_fs3.readFileSync)((0, import_node_path7.join)(vscodeBundle, "package.json"), "utf8"));
41365
41522
  const version2 = extPkg.version;
41366
- const staging = (0, import_node_fs3.mkdtempSync)((0, import_node_path6.join)((0, import_node_os5.tmpdir)(), "inkmap-vsix-"));
41523
+ const staging = (0, import_node_fs3.mkdtempSync)((0, import_node_path7.join)((0, import_node_os5.tmpdir)(), "inkmap-vsix-"));
41367
41524
  try {
41368
- const extStaging = (0, import_node_path6.join)(staging, "extension");
41525
+ const extStaging = (0, import_node_path7.join)(staging, "extension");
41369
41526
  (0, import_node_fs3.cpSync)(vscodeBundle, extStaging, { recursive: true });
41370
41527
  if ((0, import_node_fs3.existsSync)(bundledWeb)) {
41371
- (0, import_node_fs3.cpSync)(bundledWeb, (0, import_node_path6.join)(extStaging, "dist", "web"), { recursive: true });
41528
+ (0, import_node_fs3.cpSync)(bundledWeb, (0, import_node_path7.join)(extStaging, "dist", "web"), { recursive: true });
41372
41529
  }
41373
41530
  for (const doc of ["LICENSE.md", "THIRD_PARTY_NOTICES.md", "README.md"]) {
41374
- const src = (0, import_node_path6.join)(PKG_ROOT, doc);
41531
+ const src = (0, import_node_path7.join)(PKG_ROOT, doc);
41375
41532
  if ((0, import_node_fs3.existsSync)(src))
41376
- (0, import_node_fs3.cpSync)(src, (0, import_node_path6.join)(extStaging, doc));
41533
+ (0, import_node_fs3.cpSync)(src, (0, import_node_path7.join)(extStaging, doc));
41377
41534
  }
41378
41535
  if (cliCmd) {
41379
41536
  const contentTypesXml = `<?xml version="1.0" encoding="utf-8"?>
@@ -41386,7 +41543,7 @@ function installIdeExtension(editorDir, cliCmd) {
41386
41543
  ];
41387
41544
  const walk = (dir, prefix) => {
41388
41545
  for (const item of (0, import_node_fs3.readdirSync)(dir, { withFileTypes: true })) {
41389
- const full = (0, import_node_path6.join)(dir, item.name);
41546
+ const full = (0, import_node_path7.join)(dir, item.name);
41390
41547
  const rel = `${prefix}/${item.name}`;
41391
41548
  if (item.isDirectory())
41392
41549
  walk(full, rel);
@@ -41395,28 +41552,28 @@ function installIdeExtension(editorDir, cliCmd) {
41395
41552
  }
41396
41553
  };
41397
41554
  walk(extStaging, "extension");
41398
- const vsixPath = (0, import_node_path6.join)(staging, `inkmap-${version2}.vsix`);
41555
+ const vsixPath = (0, import_node_path7.join)(staging, `inkmap-${version2}.vsix`);
41399
41556
  (0, import_node_fs3.writeFileSync)(vsixPath, buildZipBuffer(entries));
41400
41557
  try {
41401
41558
  execCliSync(cliCmd, ["--install-extension", vsixPath, "--force"], { stdio: "pipe" });
41402
- const installed = (0, import_node_path6.join)(editorDir, "extensions", `inkmap.inkmap-vscode-${version2}`);
41403
- if ((0, import_node_fs3.existsSync)((0, import_node_path6.join)(installed, "package.json")))
41559
+ const installed = (0, import_node_path7.join)(editorDir, "extensions", `inkmap.inkmap-vscode-${version2}`);
41560
+ if ((0, import_node_fs3.existsSync)((0, import_node_path7.join)(installed, "package.json")))
41404
41561
  return installed;
41405
41562
  } catch {
41406
41563
  }
41407
41564
  }
41408
- const extRoot = (0, import_node_path6.join)(editorDir, "extensions");
41565
+ const extRoot = (0, import_node_path7.join)(editorDir, "extensions");
41409
41566
  (0, import_node_fs3.mkdirSync)(extRoot, { recursive: true });
41410
41567
  for (const old of (0, import_node_fs3.readdirSync)(extRoot)) {
41411
41568
  if (old.toLowerCase().startsWith("inkmap.inkmap-vscode")) {
41412
- (0, import_node_fs3.rmSync)((0, import_node_path6.join)(extRoot, old), { recursive: true, force: true });
41569
+ (0, import_node_fs3.rmSync)((0, import_node_path7.join)(extRoot, old), { recursive: true, force: true });
41413
41570
  }
41414
41571
  }
41415
41572
  const folderName = `inkmap.inkmap-vscode-${version2}`;
41416
- const dest = (0, import_node_path6.join)(extRoot, folderName);
41573
+ const dest = (0, import_node_path7.join)(extRoot, folderName);
41417
41574
  (0, import_node_fs3.cpSync)(extStaging, dest, { recursive: true });
41418
41575
  try {
41419
- const obsoletePath = (0, import_node_path6.join)(extRoot, ".obsolete");
41576
+ const obsoletePath = (0, import_node_path7.join)(extRoot, ".obsolete");
41420
41577
  if ((0, import_node_fs3.existsSync)(obsoletePath)) {
41421
41578
  const obs = JSON.parse((0, import_node_fs3.readFileSync)(obsoletePath, "utf8"));
41422
41579
  let changedObs = false;
@@ -41429,7 +41586,7 @@ function installIdeExtension(editorDir, cliCmd) {
41429
41586
  if (changedObs)
41430
41587
  writeJsonAtomic(obsoletePath, obs);
41431
41588
  }
41432
- const registryPath = (0, import_node_path6.join)(extRoot, "extensions.json");
41589
+ const registryPath = (0, import_node_path7.join)(extRoot, "extensions.json");
41433
41590
  const existingList = (0, import_node_fs3.existsSync)(registryPath) ? JSON.parse((0, import_node_fs3.readFileSync)(registryPath, "utf8")) : [];
41434
41591
  if (Array.isArray(existingList)) {
41435
41592
  const filtered = existingList.filter((item) => String(item?.identifier?.id ?? "").toLowerCase() !== "inkmap.inkmap-vscode");
@@ -41470,16 +41627,16 @@ function uninstallIdeExtension(editorDir, cliCmd) {
41470
41627
  } catch {
41471
41628
  }
41472
41629
  }
41473
- const extRoot = (0, import_node_path6.join)(editorDir, "extensions");
41630
+ const extRoot = (0, import_node_path7.join)(editorDir, "extensions");
41474
41631
  if ((0, import_node_fs3.existsSync)(extRoot)) {
41475
41632
  for (const entry of (0, import_node_fs3.readdirSync)(extRoot)) {
41476
41633
  if (entry.toLowerCase().startsWith("inkmap.inkmap-vscode")) {
41477
- (0, import_node_fs3.rmSync)((0, import_node_path6.join)(extRoot, entry), { recursive: true, force: true });
41634
+ (0, import_node_fs3.rmSync)((0, import_node_path7.join)(extRoot, entry), { recursive: true, force: true });
41478
41635
  removed = true;
41479
41636
  }
41480
41637
  }
41481
41638
  try {
41482
- const registryPath = (0, import_node_path6.join)(extRoot, "extensions.json");
41639
+ const registryPath = (0, import_node_path7.join)(extRoot, "extensions.json");
41483
41640
  if ((0, import_node_fs3.existsSync)(registryPath)) {
41484
41641
  const existingList = JSON.parse((0, import_node_fs3.readFileSync)(registryPath, "utf8"));
41485
41642
  if (Array.isArray(existingList)) {
@@ -41501,7 +41658,7 @@ function buildMcpEntry(serverScript, workspaces, existingEntry, withTypeStdio =
41501
41658
  const args = isDirectServer ? [serverScript] : [serverScript, "mcp"];
41502
41659
  const prevEnv = existingEntry && typeof existingEntry === "object" && !Array.isArray(existingEntry) && typeof existingEntry.env === "object" ? { ...existingEntry.env } : {};
41503
41660
  if (workspaces.length > 0) {
41504
- prevEnv.INKMAP_WORKSPACES = workspaces.map((w2) => (0, import_node_path6.resolve)(w2)).join(import_node_path6.delimiter);
41661
+ prevEnv.INKMAP_WORKSPACES = workspaces.map((w2) => (0, import_node_path7.resolve)(w2)).join(import_node_path7.delimiter);
41505
41662
  }
41506
41663
  const entry = {};
41507
41664
  if (withTypeStdio)
@@ -41552,36 +41709,36 @@ async function refreshAntigravityMcp() {
41552
41709
  }
41553
41710
  }
41554
41711
  async function installAntigravityPlugin(workspaces = []) {
41555
- const pluginsDir = (0, import_node_path6.join)(getAntigravityConfigDir(), "plugins");
41556
- const destination = (0, import_node_path6.join)(pluginsDir, "inkmap");
41557
- const bundledAgy = (0, import_node_path6.join)(DIST_DIR, "bundles", "antigravity");
41558
- const bundledCli = (0, import_node_path6.join)(DIST_DIR, "cli.cjs");
41559
- const bundledHtml = (0, import_node_path6.join)(DIST_DIR, "codex.html");
41560
- const bundledWeb = (0, import_node_path6.join)(DIST_DIR, "web");
41561
- const monorepoAgy = (0, import_node_path6.resolve)(PKG_ROOT, "..", "..", "dist", "sidebars", "inkmap-antigravity", "inkmap");
41712
+ const pluginsDir = (0, import_node_path7.join)(getAntigravityConfigDir(), "plugins");
41713
+ const destination = (0, import_node_path7.join)(pluginsDir, "inkmap");
41714
+ const bundledAgy = (0, import_node_path7.join)(DIST_DIR, "bundles", "antigravity");
41715
+ const bundledCli = (0, import_node_path7.join)(DIST_DIR, "cli.cjs");
41716
+ const bundledHtml = (0, import_node_path7.join)(DIST_DIR, "codex.html");
41717
+ const bundledWeb = (0, import_node_path7.join)(DIST_DIR, "web");
41718
+ const monorepoAgy = (0, import_node_path7.resolve)(PKG_ROOT, "..", "..", "dist", "sidebars", "inkmap-antigravity", "inkmap");
41562
41719
  (0, import_node_fs3.mkdirSync)(pluginsDir, { recursive: true });
41563
41720
  (0, import_node_fs3.rmSync)(destination, { recursive: true, force: true });
41564
- if ((0, import_node_fs3.existsSync)((0, import_node_path6.join)(bundledAgy, "plugin.json")) && (0, import_node_fs3.existsSync)(bundledCli) && (0, import_node_fs3.existsSync)(bundledHtml)) {
41721
+ if ((0, import_node_fs3.existsSync)((0, import_node_path7.join)(bundledAgy, "plugin.json")) && (0, import_node_fs3.existsSync)(bundledCli) && (0, import_node_fs3.existsSync)(bundledHtml)) {
41565
41722
  (0, import_node_fs3.cpSync)(bundledAgy, destination, { recursive: true });
41566
- (0, import_node_fs3.cpSync)(bundledCli, (0, import_node_path6.join)(destination, "cli.cjs"));
41567
- (0, import_node_fs3.cpSync)(bundledHtml, (0, import_node_path6.join)(destination, "codex.html"));
41568
- (0, import_node_fs3.writeFileSync)((0, import_node_path6.join)(destination, "server.cjs"), SERVER_WRAPPER, { mode: 493 });
41723
+ (0, import_node_fs3.cpSync)(bundledCli, (0, import_node_path7.join)(destination, "cli.cjs"));
41724
+ (0, import_node_fs3.cpSync)(bundledHtml, (0, import_node_path7.join)(destination, "codex.html"));
41725
+ (0, import_node_fs3.writeFileSync)((0, import_node_path7.join)(destination, "server.cjs"), SERVER_WRAPPER, { mode: 493 });
41569
41726
  if ((0, import_node_fs3.existsSync)(bundledWeb)) {
41570
- (0, import_node_fs3.cpSync)(bundledWeb, (0, import_node_path6.join)(destination, "sidecars", "inkmap", "web"), { recursive: true });
41727
+ (0, import_node_fs3.cpSync)(bundledWeb, (0, import_node_path7.join)(destination, "sidecars", "inkmap", "web"), { recursive: true });
41571
41728
  }
41572
41729
  for (const doc of ["LICENSE.md", "THIRD_PARTY_NOTICES.md", "README.md"]) {
41573
- const src = (0, import_node_path6.join)(PKG_ROOT, doc);
41730
+ const src = (0, import_node_path7.join)(PKG_ROOT, doc);
41574
41731
  if ((0, import_node_fs3.existsSync)(src))
41575
- (0, import_node_fs3.cpSync)(src, (0, import_node_path6.join)(destination, doc));
41732
+ (0, import_node_fs3.cpSync)(src, (0, import_node_path7.join)(destination, doc));
41576
41733
  }
41577
- } else if ((0, import_node_fs3.existsSync)((0, import_node_path6.join)(monorepoAgy, "plugin.json"))) {
41734
+ } else if ((0, import_node_fs3.existsSync)((0, import_node_path7.join)(monorepoAgy, "plugin.json"))) {
41578
41735
  (0, import_node_fs3.cpSync)(monorepoAgy, destination, { recursive: true });
41579
41736
  } else {
41580
41737
  throw new Error("\u672A\u627E\u5230 Antigravity \u63D2\u4EF6\u8D44\u6E90 / Antigravity plugin bundle not found.");
41581
41738
  }
41582
41739
  if (workspaces.length > 0) {
41583
41740
  try {
41584
- const mcpCfgPath = (0, import_node_path6.join)(destination, "mcp_config.json");
41741
+ const mcpCfgPath = (0, import_node_path7.join)(destination, "mcp_config.json");
41585
41742
  if ((0, import_node_fs3.existsSync)(mcpCfgPath)) {
41586
41743
  const cfg = readJsonObject(mcpCfgPath);
41587
41744
  const servers = cfg.mcpServers && typeof cfg.mcpServers === "object" && !Array.isArray(cfg.mcpServers) ? { ...cfg.mcpServers } : {};
@@ -41590,7 +41747,7 @@ async function installAntigravityPlugin(workspaces = []) {
41590
41747
  ...servers.inkmap,
41591
41748
  env: {
41592
41749
  ...servers.inkmap.env && typeof servers.inkmap.env === "object" ? servers.inkmap.env : {},
41593
- INKMAP_WORKSPACES: workspaces.map((w2) => (0, import_node_path6.resolve)(w2)).join(import_node_path6.delimiter)
41750
+ INKMAP_WORKSPACES: workspaces.map((w2) => (0, import_node_path7.resolve)(w2)).join(import_node_path7.delimiter)
41594
41751
  }
41595
41752
  };
41596
41753
  cfg.mcpServers = servers;
@@ -41608,33 +41765,33 @@ function installCodexPlugin(zh) {
41608
41765
  if (!codex) {
41609
41766
  throw new Error("\u672A\u68C0\u6D4B\u5230 codex \u547D\u4EE4\uFF0C\u8BF7\u5148\u5B89\u88C5 ChatGPT Desktop \u6216 Codex CLI / Codex CLI not found.");
41610
41767
  }
41611
- const bundledCodex = (0, import_node_path6.join)(DIST_DIR, "bundles", "codex");
41612
- const bundledCli = (0, import_node_path6.join)(DIST_DIR, "cli.cjs");
41613
- const bundledHtml = (0, import_node_path6.join)(DIST_DIR, "codex.html");
41614
- const monorepoCodexRoot = (0, import_node_path6.resolve)(PKG_ROOT, "..", "..", "dist", "sidebars");
41615
- const destination = (0, import_node_path6.join)(getInkmapHome(), "codex-marketplace");
41768
+ const bundledCodex = (0, import_node_path7.join)(DIST_DIR, "bundles", "codex");
41769
+ const bundledCli = (0, import_node_path7.join)(DIST_DIR, "cli.cjs");
41770
+ const bundledHtml = (0, import_node_path7.join)(DIST_DIR, "codex.html");
41771
+ const monorepoCodexRoot = (0, import_node_path7.resolve)(PKG_ROOT, "..", "..", "dist", "sidebars");
41772
+ const destination = (0, import_node_path7.join)(getInkmapHome(), "codex-marketplace");
41616
41773
  (0, import_node_fs3.mkdirSync)(destination, { recursive: true });
41617
41774
  const marketplaceRoot = (0, import_node_fs3.realpathSync)(destination);
41618
- const fromNpmBundle = (0, import_node_fs3.existsSync)((0, import_node_path6.join)(bundledCodex, ".agents")) && (0, import_node_fs3.existsSync)(bundledCli) && (0, import_node_fs3.existsSync)(bundledHtml);
41619
- const fromMonorepo = (0, import_node_fs3.existsSync)((0, import_node_path6.join)(monorepoCodexRoot, "inkmap-codex")) && (0, import_node_fs3.existsSync)((0, import_node_path6.join)(monorepoCodexRoot, ".agents"));
41775
+ const fromNpmBundle = (0, import_node_fs3.existsSync)((0, import_node_path7.join)(bundledCodex, ".agents")) && (0, import_node_fs3.existsSync)(bundledCli) && (0, import_node_fs3.existsSync)(bundledHtml);
41776
+ const fromMonorepo = (0, import_node_fs3.existsSync)((0, import_node_path7.join)(monorepoCodexRoot, "inkmap-codex")) && (0, import_node_fs3.existsSync)((0, import_node_path7.join)(monorepoCodexRoot, ".agents"));
41620
41777
  if (!fromNpmBundle && !fromMonorepo)
41621
41778
  throw new Error("\u672A\u627E\u5230 Codex \u63D2\u4EF6\u8D44\u6E90 / Codex plugin bundle not found.");
41622
- (0, import_node_fs3.rmSync)((0, import_node_path6.join)(marketplaceRoot, ".agents"), { recursive: true, force: true });
41623
- (0, import_node_fs3.rmSync)((0, import_node_path6.join)(marketplaceRoot, "inkmap-codex"), { recursive: true, force: true });
41779
+ (0, import_node_fs3.rmSync)((0, import_node_path7.join)(marketplaceRoot, ".agents"), { recursive: true, force: true });
41780
+ (0, import_node_fs3.rmSync)((0, import_node_path7.join)(marketplaceRoot, "inkmap-codex"), { recursive: true, force: true });
41624
41781
  if (fromNpmBundle) {
41625
41782
  (0, import_node_fs3.cpSync)(bundledCodex, marketplaceRoot, { recursive: true });
41626
- const pluginDir = (0, import_node_path6.join)(marketplaceRoot, "inkmap-codex");
41627
- (0, import_node_fs3.cpSync)(bundledCli, (0, import_node_path6.join)(pluginDir, "cli.cjs"));
41628
- (0, import_node_fs3.cpSync)(bundledHtml, (0, import_node_path6.join)(pluginDir, "codex.html"));
41629
- (0, import_node_fs3.writeFileSync)((0, import_node_path6.join)(pluginDir, "server.cjs"), SERVER_WRAPPER, { mode: 493 });
41783
+ const pluginDir = (0, import_node_path7.join)(marketplaceRoot, "inkmap-codex");
41784
+ (0, import_node_fs3.cpSync)(bundledCli, (0, import_node_path7.join)(pluginDir, "cli.cjs"));
41785
+ (0, import_node_fs3.cpSync)(bundledHtml, (0, import_node_path7.join)(pluginDir, "codex.html"));
41786
+ (0, import_node_fs3.writeFileSync)((0, import_node_path7.join)(pluginDir, "server.cjs"), SERVER_WRAPPER, { mode: 493 });
41630
41787
  for (const doc of ["LICENSE.md", "THIRD_PARTY_NOTICES.md"]) {
41631
- const src = (0, import_node_path6.join)(PKG_ROOT, doc);
41788
+ const src = (0, import_node_path7.join)(PKG_ROOT, doc);
41632
41789
  if ((0, import_node_fs3.existsSync)(src))
41633
- (0, import_node_fs3.cpSync)(src, (0, import_node_path6.join)(pluginDir, doc));
41790
+ (0, import_node_fs3.cpSync)(src, (0, import_node_path7.join)(pluginDir, doc));
41634
41791
  }
41635
41792
  } else {
41636
- (0, import_node_fs3.cpSync)((0, import_node_path6.join)(monorepoCodexRoot, ".agents"), (0, import_node_path6.join)(marketplaceRoot, ".agents"), { recursive: true });
41637
- (0, import_node_fs3.cpSync)((0, import_node_path6.join)(monorepoCodexRoot, "inkmap-codex"), (0, import_node_path6.join)(marketplaceRoot, "inkmap-codex"), { recursive: true });
41793
+ (0, import_node_fs3.cpSync)((0, import_node_path7.join)(monorepoCodexRoot, ".agents"), (0, import_node_path7.join)(marketplaceRoot, ".agents"), { recursive: true });
41794
+ (0, import_node_fs3.cpSync)((0, import_node_path7.join)(monorepoCodexRoot, "inkmap-codex"), (0, import_node_path7.join)(marketplaceRoot, "inkmap-codex"), { recursive: true });
41638
41795
  }
41639
41796
  const marketplaceName = "inkmap-local";
41640
41797
  const rawList = execCliSync(codex, ["plugin", "marketplace", "list", "--json"], { encoding: "utf8" });
@@ -41650,7 +41807,7 @@ function installCodexPlugin(zh) {
41650
41807
  };
41651
41808
  }
41652
41809
  function configureDshMarketIndex(profileDir) {
41653
- const pkgPath = (0, import_node_path6.join)(profileDir, "package.json");
41810
+ const pkgPath = (0, import_node_path7.join)(profileDir, "package.json");
41654
41811
  if ((0, import_node_fs3.existsSync)(pkgPath)) {
41655
41812
  try {
41656
41813
  const pkg = JSON.parse((0, import_node_fs3.readFileSync)(pkgPath, "utf8"));
@@ -41670,7 +41827,7 @@ function configureDshMarketIndex(profileDir) {
41670
41827
  } catch {
41671
41828
  }
41672
41829
  }
41673
- const patchPath = (0, import_node_path6.join)(profileDir, "cordis.patch.yml");
41830
+ const patchPath = (0, import_node_path7.join)(profileDir, "cordis.patch.yml");
41674
41831
  const indexUrl = "https://zhiyuanv.com/dsh-index.json";
41675
41832
  try {
41676
41833
  const existing = (0, import_node_fs3.existsSync)(patchPath) ? (0, import_node_fs3.readFileSync)(patchPath, "utf8") : "";
@@ -41692,34 +41849,34 @@ function configureDshMarketIndex(profileDir) {
41692
41849
  }
41693
41850
  }
41694
41851
  function installDeepSeekHarnessPlugin(zh) {
41695
- const bundledHarness = (0, import_node_path6.join)(DIST_DIR, "bundles", "harness");
41696
- const bundledWeb = (0, import_node_path6.join)(DIST_DIR, "web");
41697
- const monorepoHarness = (0, import_node_path6.resolve)(PKG_ROOT, "..", "..", "dist", "sidebars", "dsh-inkmap");
41698
- const stagedDir = (0, import_node_path6.join)(getInkmapHome(), "dsh-inkmap");
41852
+ const bundledHarness = (0, import_node_path7.join)(DIST_DIR, "bundles", "harness");
41853
+ const bundledWeb = (0, import_node_path7.join)(DIST_DIR, "web");
41854
+ const monorepoHarness = (0, import_node_path7.resolve)(PKG_ROOT, "..", "..", "dist", "sidebars", "dsh-inkmap");
41855
+ const stagedDir = (0, import_node_path7.join)(getInkmapHome(), "dsh-inkmap");
41699
41856
  (0, import_node_fs3.rmSync)(stagedDir, { recursive: true, force: true });
41700
41857
  (0, import_node_fs3.mkdirSync)(stagedDir, { recursive: true });
41701
- if ((0, import_node_fs3.existsSync)((0, import_node_path6.join)(bundledHarness, "package.json")) && (0, import_node_fs3.existsSync)(bundledWeb)) {
41858
+ if ((0, import_node_fs3.existsSync)((0, import_node_path7.join)(bundledHarness, "package.json")) && (0, import_node_fs3.existsSync)(bundledWeb)) {
41702
41859
  (0, import_node_fs3.cpSync)(bundledHarness, stagedDir, { recursive: true });
41703
- (0, import_node_fs3.cpSync)(bundledWeb, (0, import_node_path6.join)(stagedDir, "web"), { recursive: true });
41860
+ (0, import_node_fs3.cpSync)(bundledWeb, (0, import_node_path7.join)(stagedDir, "web"), { recursive: true });
41704
41861
  for (const doc of ["LICENSE.md", "THIRD_PARTY_NOTICES.md"]) {
41705
- const src = (0, import_node_path6.join)(PKG_ROOT, doc);
41862
+ const src = (0, import_node_path7.join)(PKG_ROOT, doc);
41706
41863
  if ((0, import_node_fs3.existsSync)(src))
41707
- (0, import_node_fs3.cpSync)(src, (0, import_node_path6.join)(stagedDir, doc));
41864
+ (0, import_node_fs3.cpSync)(src, (0, import_node_path7.join)(stagedDir, doc));
41708
41865
  }
41709
- } else if ((0, import_node_fs3.existsSync)((0, import_node_path6.join)(monorepoHarness, "package.json"))) {
41866
+ } else if ((0, import_node_fs3.existsSync)((0, import_node_path7.join)(monorepoHarness, "package.json"))) {
41710
41867
  (0, import_node_fs3.cpSync)(monorepoHarness, stagedDir, { recursive: true });
41711
41868
  } else {
41712
41869
  throw new Error("\u672A\u627E\u5230 DeepSeek Harness \u63D2\u4EF6\u8D44\u6E90 / DeepSeek Harness plugin bundle not found.");
41713
41870
  }
41714
41871
  const realStaged = (0, import_node_fs3.realpathSync)(stagedDir);
41715
41872
  const dshCmd = findDshCommand();
41716
- const profileDir = (0, import_node_path6.join)(getDshHome(), "profiles", "desktop");
41873
+ const profileDir = (0, import_node_path7.join)(getDshHome(), "profiles", "desktop");
41717
41874
  if (dshCmd) {
41718
41875
  execCliSync(dshCmd, ["plugin", "--profile", "desktop", "add", realStaged], { stdio: "pipe" });
41719
41876
  } else if ((0, import_node_fs3.existsSync)(profileDir)) {
41720
- const nodeModulesTarget = (0, import_node_path6.join)(profileDir, "node_modules", "dsh-inkmap");
41877
+ const nodeModulesTarget = (0, import_node_path7.join)(profileDir, "node_modules", "dsh-inkmap");
41721
41878
  (0, import_node_fs3.rmSync)(nodeModulesTarget, { recursive: true, force: true });
41722
- (0, import_node_fs3.mkdirSync)((0, import_node_path6.join)(profileDir, "node_modules"), { recursive: true });
41879
+ (0, import_node_fs3.mkdirSync)((0, import_node_path7.join)(profileDir, "node_modules"), { recursive: true });
41723
41880
  (0, import_node_fs3.cpSync)(realStaged, nodeModulesTarget, { recursive: true });
41724
41881
  } else {
41725
41882
  throw new Error("\u672A\u68C0\u6D4B\u5230 DeepSeek Harness \u5BA2\u6237\u7AEF / DeepSeek Harness not found.");
@@ -41741,7 +41898,7 @@ async function runInstall(options = {}) {
41741
41898
  const toRemove = explicitTargets ?? ["claude", "claude-code", "cursor", ...EXTENSION_EDITOR_KEYS, "antigravity", "codex", "deepseek"];
41742
41899
  for (const target of toRemove) {
41743
41900
  if (target === "claude") {
41744
- const cfg = (0, import_node_path6.join)(getClaudeDesktopDir(), "claude_desktop_config.json");
41901
+ const cfg = (0, import_node_path7.join)(getClaudeDesktopDir(), "claude_desktop_config.json");
41745
41902
  if (removeMcpJsonConfig(cfg))
41746
41903
  result.removed.push({ target, location: cfg });
41747
41904
  } else if (target === "claude-code") {
@@ -41749,17 +41906,17 @@ async function runInstall(options = {}) {
41749
41906
  if (removeMcpJsonConfig(cfg))
41750
41907
  result.removed.push({ target, location: cfg });
41751
41908
  } else if (target === "cursor") {
41752
- const cfg = (0, import_node_path6.join)(getCursorDir(), "mcp.json");
41909
+ const cfg = (0, import_node_path7.join)(getCursorDir(), "mcp.json");
41753
41910
  const removedMcp = removeMcpJsonConfig(cfg);
41754
41911
  const removedExt = uninstallIdeExtension(getCursorDir(), findCursorCommand());
41755
41912
  if (removedMcp || removedExt)
41756
41913
  result.removed.push({ target, location: cfg });
41757
41914
  } else if (isExtensionEditor(target)) {
41758
41915
  if (uninstallIdeExtension(getEditorDir(target), findEditorCommand(target))) {
41759
- result.removed.push({ target, location: (0, import_node_path6.join)(getEditorDir(target), "extensions") });
41916
+ result.removed.push({ target, location: (0, import_node_path7.join)(getEditorDir(target), "extensions") });
41760
41917
  }
41761
41918
  } else if (target === "antigravity") {
41762
- const dir = (0, import_node_path6.join)(getAntigravityConfigDir(), "plugins", "inkmap");
41919
+ const dir = (0, import_node_path7.join)(getAntigravityConfigDir(), "plugins", "inkmap");
41763
41920
  if ((0, import_node_fs3.existsSync)(dir)) {
41764
41921
  (0, import_node_fs3.rmSync)(dir, { recursive: true, force: true });
41765
41922
  await refreshAntigravityMcp();
@@ -41777,21 +41934,21 @@ async function runInstall(options = {}) {
41777
41934
  } catch {
41778
41935
  }
41779
41936
  }
41780
- const dir = (0, import_node_path6.join)(getInkmapHome(), "codex-marketplace");
41937
+ const dir = (0, import_node_path7.join)(getInkmapHome(), "codex-marketplace");
41781
41938
  if ((0, import_node_fs3.existsSync)(dir)) {
41782
41939
  (0, import_node_fs3.rmSync)(dir, { recursive: true, force: true });
41783
41940
  result.removed.push({ target, location: dir });
41784
41941
  }
41785
41942
  } else if (target === "deepseek") {
41786
41943
  const dshCmd = findDshCommand();
41787
- const profileDir = (0, import_node_path6.join)(getDshHome(), "profiles", "desktop");
41944
+ const profileDir = (0, import_node_path7.join)(getDshHome(), "profiles", "desktop");
41788
41945
  if (dshCmd && (0, import_node_fs3.existsSync)(profileDir)) {
41789
41946
  try {
41790
41947
  execCliSync(dshCmd, ["plugin", "--profile", "desktop", "remove", "dsh-inkmap"], { stdio: "pipe" });
41791
41948
  } catch {
41792
41949
  }
41793
41950
  }
41794
- const dir = (0, import_node_path6.join)(getInkmapHome(), "dsh-inkmap");
41951
+ const dir = (0, import_node_path7.join)(getInkmapHome(), "dsh-inkmap");
41795
41952
  if ((0, import_node_fs3.existsSync)(dir)) {
41796
41953
  (0, import_node_fs3.rmSync)(dir, { recursive: true, force: true });
41797
41954
  result.removed.push({ target, location: profileDir });
@@ -41799,7 +41956,7 @@ async function runInstall(options = {}) {
41799
41956
  }
41800
41957
  }
41801
41958
  if (!explicitTargets) {
41802
- (0, import_node_fs3.rmSync)((0, import_node_path6.join)(getInkmapHome(), "mcp-app"), { recursive: true, force: true });
41959
+ (0, import_node_fs3.rmSync)((0, import_node_path7.join)(getInkmapHome(), "mcp-app"), { recursive: true, force: true });
41803
41960
  }
41804
41961
  if (result.removed.length === 0) {
41805
41962
  log("[inkmap] \u672A\u53D1\u73B0\u5DF2\u5B89\u88C5\u7684 Inkmap \u5BA2\u6237\u7AEF\u914D\u7F6E / No installed Inkmap client configs found.");
@@ -41827,7 +41984,7 @@ async function runInstall(options = {}) {
41827
41984
  }
41828
41985
  for (const target of targets) {
41829
41986
  if (target === "claude") {
41830
- const cfg = (0, import_node_path6.join)(getClaudeDesktopDir(), "claude_desktop_config.json");
41987
+ const cfg = (0, import_node_path7.join)(getClaudeDesktopDir(), "claude_desktop_config.json");
41831
41988
  upsertMcpJsonConfig(cfg, serverScript, workspaces, false);
41832
41989
  result.installed.push({
41833
41990
  target,
@@ -41843,10 +42000,10 @@ async function runInstall(options = {}) {
41843
42000
  note: zhLocale ? "\u5728 Claude Code \u4E2D\u5DF2\u6CE8\u518C\u5168\u5C40 inkmap MCP \u670D\u52A1" : "Registered global inkmap MCP server in Claude Code"
41844
42001
  });
41845
42002
  } else if (target === "cursor") {
41846
- const cfg = (0, import_node_path6.join)(getCursorDir(), "mcp.json");
42003
+ const cfg = (0, import_node_path7.join)(getCursorDir(), "mcp.json");
41847
42004
  upsertMcpJsonConfig(cfg, serverScript, workspaces, false);
41848
42005
  const extLoc = installIdeExtension(getCursorDir(), findCursorCommand());
41849
- const cursorServerDir = (0, import_node_path6.join)((0, import_node_os5.homedir)(), ".cursor-server");
42006
+ const cursorServerDir = (0, import_node_path7.join)((0, import_node_os5.homedir)(), ".cursor-server");
41850
42007
  if ((0, import_node_fs3.existsSync)(cursorServerDir)) {
41851
42008
  try {
41852
42009
  installIdeExtension(cursorServerDir, null);
@@ -41983,12 +42140,12 @@ async function runInstallCli(argv, uninstall = false) {
41983
42140
  const val = argv[++i];
41984
42141
  if (!val)
41985
42142
  throw new Error("--workspace \u9700\u8981\u63D0\u4F9B\u76EE\u5F55\u8DEF\u5F84 / --workspace requires a directory path");
41986
- workspaces.push(...val.split(import_node_path6.delimiter).filter(Boolean));
42143
+ workspaces.push(...val.split(import_node_path7.delimiter).filter(Boolean));
41987
42144
  continue;
41988
42145
  }
41989
42146
  if (arg.startsWith("--workspace=")) {
41990
42147
  const val = arg.slice("--workspace=".length);
41991
- workspaces.push(...val.split(import_node_path6.delimiter).filter(Boolean));
42148
+ workspaces.push(...val.split(import_node_path7.delimiter).filter(Boolean));
41992
42149
  continue;
41993
42150
  }
41994
42151
  const normalized = normalizeTarget(arg);
@@ -42007,14 +42164,14 @@ async function runInstallCli(argv, uninstall = false) {
42007
42164
  uninstall
42008
42165
  });
42009
42166
  }
42010
- var import_node_child_process3, import_node_fs3, import_node_os5, import_node_path6, import_node_url4, import_node_zlib, EXTENSION_EDITORS, EXTENSION_EDITOR_KEYS, isExtensionEditor, DIST_DIR, PKG_ROOT, SERVER_WRAPPER, CRC_TABLE;
42167
+ var import_node_child_process3, import_node_fs3, import_node_os5, import_node_path7, import_node_url4, import_node_zlib, EXTENSION_EDITORS, EXTENSION_EDITOR_KEYS, isExtensionEditor, DIST_DIR, PKG_ROOT, SERVER_WRAPPER, CRC_TABLE;
42011
42168
  var init_install = __esm({
42012
42169
  "packages/cli/dist/install.js"() {
42013
42170
  "use strict";
42014
42171
  import_node_child_process3 = require("node:child_process");
42015
42172
  import_node_fs3 = require("node:fs");
42016
42173
  import_node_os5 = require("node:os");
42017
- import_node_path6 = require("node:path");
42174
+ import_node_path7 = require("node:path");
42018
42175
  import_node_url4 = require("node:url");
42019
42176
  import_node_zlib = require("node:zlib");
42020
42177
  init_license();
@@ -42026,8 +42183,8 @@ var init_install = __esm({
42026
42183
  };
42027
42184
  EXTENSION_EDITOR_KEYS = Object.keys(EXTENSION_EDITORS);
42028
42185
  isExtensionEditor = (target) => target in EXTENSION_EDITORS;
42029
- DIST_DIR = (0, import_node_path6.dirname)((0, import_node_url4.fileURLToPath)(inkmapModuleUrl));
42030
- PKG_ROOT = (0, import_node_path6.resolve)(DIST_DIR, "..");
42186
+ DIST_DIR = (0, import_node_path7.dirname)((0, import_node_url4.fileURLToPath)(inkmapModuleUrl));
42187
+ PKG_ROOT = (0, import_node_path7.resolve)(DIST_DIR, "..");
42031
42188
  SERVER_WRAPPER = `#!/usr/bin/env node
42032
42189
  "use strict";
42033
42190
  require("./cli.cjs").main(["mcp", ...process.argv.slice(2)]).catch(err => {
@@ -42055,7 +42212,7 @@ __export(index_exports, {
42055
42212
  main: () => main
42056
42213
  });
42057
42214
  module.exports = __toCommonJS(index_exports);
42058
- var import_node_path7 = require("node:path");
42215
+ var import_node_path8 = require("node:path");
42059
42216
  var import_node_url5 = require("node:url");
42060
42217
  init_dist();
42061
42218
  init_license();
@@ -42077,9 +42234,9 @@ var USAGE = `Inkmap v${INKMAP_VERSION} \u2014 Markdown \u4EA4\u4E92\u601D\u7EF4\
42077
42234
  function appendEnvWorkspaces(dirs) {
42078
42235
  if (dirs.length === 0)
42079
42236
  return;
42080
- const resolved = dirs.map((d2) => (0, import_node_path7.resolve)(d2));
42081
- const current = (process.env.INKMAP_WORKSPACES || "").split(import_node_path7.delimiter).filter(Boolean);
42082
- process.env.INKMAP_WORKSPACES = [.../* @__PURE__ */ new Set([...current, ...resolved])].join(import_node_path7.delimiter);
42237
+ const resolved = dirs.map((d2) => (0, import_node_path8.resolve)(d2));
42238
+ const current = (process.env.INKMAP_WORKSPACES || "").split(import_node_path8.delimiter).filter(Boolean);
42239
+ process.env.INKMAP_WORKSPACES = [.../* @__PURE__ */ new Set([...current, ...resolved])].join(import_node_path8.delimiter);
42083
42240
  }
42084
42241
  async function main(argv) {
42085
42242
  if (argv.length === 0 && !process.stdin.isTTY) {
@@ -42106,9 +42263,9 @@ async function main(argv) {
42106
42263
  const val = argv[++i];
42107
42264
  if (!val)
42108
42265
  throw new Error("--workspace \u9700\u8981\u76EE\u5F55\u8DEF\u5F84");
42109
- extraWorkspaces.push(...val.split(import_node_path7.delimiter).filter(Boolean));
42266
+ extraWorkspaces.push(...val.split(import_node_path8.delimiter).filter(Boolean));
42110
42267
  } else if (arg.startsWith("--workspace=")) {
42111
- extraWorkspaces.push(...arg.slice("--workspace=".length).split(import_node_path7.delimiter).filter(Boolean));
42268
+ extraWorkspaces.push(...arg.slice("--workspace=".length).split(import_node_path8.delimiter).filter(Boolean));
42112
42269
  } else if (arg === "-h" || arg === "--help") {
42113
42270
  console.log(USAGE);
42114
42271
  return;