inkmap-mcp 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -101,13 +101,9 @@ npx -y inkmap-mcp@latest 你的文档.markmap.md
101
101
  ### 3. 7 天免费试用与 Pro 终身版开通(跨客户端账号同步)
102
102
 
103
103
  - **7 天全功能免费试用**:首次安装后即可免登录使用全部功能 7 天。
104
- - **如何购买与激活 Inkmap Pro 终身版(¥29.90 一次买断 · 永久使用)**:
105
- 1. **前往官网或独立工作台开通**:
106
- - **官方网站直达**:[https://zhiyuanv.com/software.html#inkmap-pricing](https://zhiyuanv.com/software.html#inkmap-pricing)(¥29.90 微信扫码一次买断,免费包含后续全部更新);
107
- - **或本地独立浏览器 / VS Code 扩展内开通**:在终端运行 `npx -y inkmap-mcp@latest 你的文档.md` 或在 VS Code 扩展内点击右上角 **「购买 Pro」**。
108
- 2. **在各 AI 客户端内一键同步权益**:
109
- - 遵循各客户端应用商店规范,Claude / ChatGPT Codex / Cursor / Antigravity 的对话内嵌导图面板仅展示「登录」入口(不展示价格与付款链接)。
110
- - 您在官网或独立工作台开通 Pro 后,只需在任意客户端导图右上角点击 **「登录」** 并验证同一账号,**Pro 终身权益即刻自动跨端同步**!
104
+ - **如何购买与激活 Inkmap Pro 终身版(国内版 ¥29.9 一次买断 · 永久使用)**:
105
+ 1. **插件内直接扫码开通(第一类客户端)**:在 **VS Code / Cursor / DeepSeek Harness / Qoder / 本地浏览器版** 导图右上角点击账号按钮选择 **「立即开通 Pro(¥29.9)」**,输入邮箱验证后直接在面板内微信扫码开通;也可访问官网 [https://zhiyuanv.com/software.html?lang=zh#inkmap-pricing](https://zhiyuanv.com/software.html?lang=zh#inkmap-pricing)。
106
+ 2. **验证码邮件一键开通与全端同步(第二类客户端)**:在 **OpenAI Codex / Claude Desktop / Claude Code / Google Antigravity** 对话内嵌导图右上角点击 **「邮箱验证登录」**,收到的验证码邮件内附专属一键开通入口,验证同一邮箱即可在 **Cursor、VS Code、DeepSeek Harness、Qoder、WorkBuddy、Claude、Codex、Antigravity、Trae** 全平台自动同步 Pro 终身权益!
111
107
 
112
108
  ### 4. 卸载配置
113
109
 
@@ -120,9 +116,9 @@ npx -y inkmap-mcp@latest uninstall
120
116
  ## Free Trial & Lifetime Pro (Cross-Client Sync)
121
117
 
122
118
  - **7-Day Free Trial**: Enjoy full access to all features for 7 days from first use — no credit card or sign-in required.
123
- - **How to Upgrade & Sync Pro Across All Clients (US\$15.00 Lifetime)**:
124
- 1. **Purchase Lifetime Pro on the Official Website**: Visit [https://zhiyuanv.com/software.html#inkmap-pricing](https://zhiyuanv.com/software.html#inkmap-pricing) (**US\$15.00** one-time purchase via international bank card, all future updates included), or run `npx -y inkmap-mcp@latest notes.md` in your browser and click **Buy Pro**.
125
- 2. **Sign In Anywhere to Sync**: Inside embedded MCP App panels (Claude Desktop, OpenAI Codex, Cursor, Google Antigravity), click **Sign in** in the top-right corner with the same account — your Lifetime Pro entitlement syncs automatically across every client and device.
119
+ - **How to Upgrade & Sync Pro Across All Clients (\$15 Lifetime)**:
120
+ 1. **In-Plugin Direct Checkout**: Inside **VS Code, Cursor, DeepSeek Harness, Qoder, or the standalone browser editor**, click the top-right account badge and choose **Buy Pro (\$15)** (or visit [https://zhiyuanv.com/software.html?lang=en#inkmap-pricing](https://zhiyuanv.com/software.html?lang=en#inkmap-pricing)).
121
+ 2. **Email Sign-In & Cross-Client Sync**: Inside embedded MCP App panels (**OpenAI Codex, Claude Desktop, Claude Code, Google Antigravity**), click **Sign in with Email** in the top-right corner — your verification email includes a direct 1-click checkout link, and signing in with the same email syncs Lifetime Pro across **Cursor, VS Code, DeepSeek Harness, Qoder, WorkBuddy, Claude, Codex, Antigravity, and Trae**.
126
122
 
127
123
  ---
128
124
 
@@ -118,15 +118,26 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
118
118
  }
119
119
  return /^1\d{10}$/.test(clean) ? `${clean.slice(0, 3)}****${clean.slice(7)}` : clean.slice(0, 32);
120
120
  }
121
- function clientLocale() {
122
- const raw = (process.env.INKMAP_LOCALE || process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
123
- if (/^zh\b/i.test(raw))
121
+ function clientLocale(hint) {
122
+ const h = (hint || "").trim();
123
+ if (/^zh\b/i.test(h))
124
+ return "zh";
125
+ if (/^en\b/i.test(h))
126
+ return "en";
127
+ const envLocale = (process.env.INKMAP_LOCALE || "").trim();
128
+ if (/^zh\b/i.test(envLocale))
124
129
  return "zh";
125
- if (/^en\b/i.test(process.env.INKMAP_LOCALE || ""))
130
+ if (/^en\b/i.test(envLocale))
126
131
  return "en";
132
+ const raw = (process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
133
+ if (/^zh\b/i.test(raw))
134
+ return "zh";
127
135
  try {
128
- const tz = Intl.DateTimeFormat().resolvedOptions().timeZone || "";
129
- if (/^Asia\/(Shanghai|Chongqing|Harbin|Urumqi)$/i.test(tz))
136
+ const opts = Intl.DateTimeFormat().resolvedOptions();
137
+ if (/^zh\b/i.test(opts.locale || ""))
138
+ return "zh";
139
+ const tz = opts.timeZone || "";
140
+ if (/^(Asia\/(Shanghai|Chongqing|Chungking|Harbin|Urumqi|Beijing)|PRC)$/i.test(tz))
130
141
  return "zh";
131
142
  } catch {
132
143
  }
@@ -139,16 +150,18 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
139
150
  });
140
151
  return next;
141
152
  }
142
- async function createCheckoutFlow(origin, existingToken, existingCookie) {
153
+ async function createCheckoutFlow(origin, existingToken, existingCookie, localeHint) {
154
+ const loc = clientLocale(localeHint);
143
155
  const response = await fetch(origin + "/billing/v1/connections", {
144
156
  method: "POST",
145
157
  headers: {
146
158
  "content-type": "application/json",
159
+ "x-inkmap-locale": loc,
147
160
  ...existingToken && { authorization: "Bearer " + existingToken },
148
161
  ...existingCookie && { cookie: existingCookie }
149
162
  },
150
163
  redirect: "error",
151
- body: JSON.stringify({ product: PRODUCT.id, mode: "buy" }),
164
+ body: JSON.stringify({ product: PRODUCT.id, mode: "buy", locale: loc }),
152
165
  signal: AbortSignal.timeout(8e3)
153
166
  });
154
167
  if (!response.ok)
@@ -161,11 +174,13 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
161
174
  }
162
175
  return { origin, url, token: data.token, ...cookie && { cookie } };
163
176
  }
164
- function checkoutPost(checkoutUrl, action, origin, body, token, cookie) {
177
+ function checkoutPost(checkoutUrl, action, origin, body, token, cookie, localeHint) {
178
+ const loc = clientLocale(localeHint);
165
179
  return fetch(checkoutUrl + "/" + action, {
166
180
  method: "POST",
167
181
  headers: {
168
182
  "content-type": "application/json",
183
+ "x-inkmap-locale": loc,
169
184
  origin,
170
185
  ...token && { authorization: "Bearer " + token },
171
186
  ...cookie && { cookie }
@@ -175,13 +190,14 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
175
190
  signal: AbortSignal.timeout(12e3)
176
191
  });
177
192
  }
178
- function phoneRequest(origin, action, phone, code) {
193
+ function phoneRequest(origin, action, phone, code, localeHint) {
179
194
  const isEmail = phone.includes("@");
180
- const locale = clientLocale();
195
+ const locale = clientLocale(localeHint);
181
196
  return fetch(origin + "/billing/v1/phone-sign-in/" + action, {
182
197
  method: "POST",
183
198
  headers: {
184
199
  "content-type": "application/json",
200
+ "x-inkmap-locale": locale,
185
201
  "accept-language": locale === "zh" ? "zh-CN,zh;q=0.9" : "en-US,en;q=0.9"
186
202
  },
187
203
  redirect: "error",
@@ -306,10 +322,11 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
306
322
  await refresh();
307
323
  return current;
308
324
  },
309
- async connect(mode) {
325
+ async connect(mode, localeHint) {
310
326
  if (loginOnly && mode !== "restore")
311
327
  throw new Error("Only Yunfan account sign-in is available.");
312
328
  const origin = billingOrigin(getOrigin());
329
+ const loc = clientLocale(localeHint);
313
330
  const version = generation;
314
331
  let existingToken;
315
332
  try {
@@ -325,6 +342,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
325
342
  method: "POST",
326
343
  headers: {
327
344
  "content-type": "application/json",
345
+ "x-inkmap-locale": loc,
328
346
  ...existingToken && { authorization: "Bearer " + existingToken }
329
347
  },
330
348
  redirect: "error",
@@ -332,10 +350,10 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
332
350
  signal: AbortSignal.timeout(8e3)
333
351
  });
334
352
  let legacy = false;
335
- let response = await (mode === "restore" ? create("restore-connections", { product: PRODUCT.id }) : create("connections", { product: PRODUCT.id, mode }));
353
+ let response = await (mode === "restore" ? create("restore-connections", { product: PRODUCT.id }) : create("connections", { product: PRODUCT.id, mode, locale: loc }));
336
354
  if (mode === "restore" && !loginOnly && response.status === 404) {
337
355
  legacy = true;
338
- response = await create("connections", { product: PRODUCT.id, mode });
356
+ response = await create("connections", { product: PRODUCT.id, mode, locale: loc });
339
357
  }
340
358
  if (!response.ok)
341
359
  throw new Error("Unable to start the Yunfan account flow.");
@@ -357,7 +375,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
357
375
  });
358
376
  return url;
359
377
  },
360
- async orderPro() {
378
+ async orderPro(localeHint) {
361
379
  if (loginOnly)
362
380
  throw new Error("Only Yunfan account sign-in is available.");
363
381
  const origin = billingOrigin(getOrigin());
@@ -376,7 +394,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
376
394
  } catch {
377
395
  }
378
396
  const requestOrder = async (checkoutUrl, token, cookie, persist) => {
379
- const res = await checkoutPost(checkoutUrl, "order", origin, {}, token, cookie);
397
+ const res = await checkoutPost(checkoutUrl, "order", origin, {}, token, cookie, localeHint);
380
398
  if (res.status === 401 || res.status === 403 || res.status === 404 || res.status === 410)
381
399
  return null;
382
400
  if (!res.ok)
@@ -426,31 +444,31 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
426
444
  return existing;
427
445
  }
428
446
  const existingToken = record?.origin === origin && typeof record.token === "string" ? record.token : void 0;
429
- const flow = await createCheckoutFlow(origin, existingToken, existingCookie);
447
+ const flow = await createCheckoutFlow(origin, existingToken, existingCookie, localeHint);
430
448
  const ordered = await requestOrder(flow.url, flow.token, flow.cookie, true);
431
449
  if (ordered)
432
450
  return ordered;
433
451
  pendingCheckout = flow;
434
452
  return { status: "needsPhone" };
435
453
  },
436
- async sendPhoneCode(phone) {
454
+ async sendPhoneCode(phone, localeHint) {
437
455
  if (typeof phone !== "string" || !phone.trim() || phone.length > 254)
438
456
  return phoneFailure(400);
439
457
  const isEmail = phone.includes("@");
440
- const locale = clientLocale();
458
+ const locale = clientLocale(localeHint);
441
459
  try {
442
460
  const origin = billingOrigin(getOrigin());
443
461
  if (!loginOnly) {
444
462
  try {
445
463
  if (!pendingCheckout || pendingCheckout.origin !== origin) {
446
- pendingCheckout = await createCheckoutFlow(origin);
464
+ pendingCheckout = await createCheckoutFlow(origin, void 0, void 0, locale);
447
465
  }
448
466
  const sendAction = isEmail ? "email/send" : "sms";
449
467
  const sendBody = isEmail ? { email: phone, locale } : { phone };
450
- let smsRes = await checkoutPost(pendingCheckout.url, sendAction, origin, sendBody, pendingCheckout.token, pendingCheckout.cookie);
468
+ let smsRes = await checkoutPost(pendingCheckout.url, sendAction, origin, sendBody, pendingCheckout.token, pendingCheckout.cookie, locale);
451
469
  if (smsRes.status === 410 || smsRes.status === 404) {
452
- pendingCheckout = await createCheckoutFlow(origin);
453
- smsRes = await checkoutPost(pendingCheckout.url, sendAction, origin, sendBody, pendingCheckout.token, pendingCheckout.cookie);
470
+ pendingCheckout = await createCheckoutFlow(origin, void 0, void 0, locale);
471
+ smsRes = await checkoutPost(pendingCheckout.url, sendAction, origin, sendBody, pendingCheckout.token, pendingCheckout.cookie, locale);
454
472
  }
455
473
  pendingCheckout.cookie = mergeCookies(pendingCheckout.cookie, smsRes);
456
474
  return smsRes.status === 204 ? { ok: true, value: void 0 } : phoneFailure(smsRes.status);
@@ -458,7 +476,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
458
476
  pendingCheckout = void 0;
459
477
  }
460
478
  }
461
- const response = await phoneRequest(origin, "send", phone);
479
+ const response = await phoneRequest(origin, "send", phone, void 0, locale);
462
480
  return response.status === 204 ? { ok: true, value: void 0 } : phoneFailure(response.status);
463
481
  } catch {
464
482
  return phoneFailure();
@@ -634,7 +652,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
634
652
  installId: id,
635
653
  host: hostName,
636
654
  os,
637
- version: "0.3.3",
655
+ version: "0.3.4",
638
656
  locale: clientLocale(),
639
657
  tier,
640
658
  events
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inkmap-codex",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Open Markdown as an editable mind map with Inkmap.",
5
5
  "requires_local_executor": true,
6
6
  "interface": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "inkmap-codex",
4
- "version": "0.3.3",
4
+ "version": "0.3.4",
5
5
  "description": "Open Markdown as an editable mind map with Inkmap.",
6
6
  "extensions": {
7
7
  "com.openai": {
@@ -65,7 +65,18 @@ function selectedFile(address) {
65
65
 
66
66
  // packages/harness/src/client.mjs
67
67
  var inject = ["slots", "sidebarRight", "sidebarRightTabs"];
68
- var zh = () => /^zh\b/i.test(document.documentElement.lang || navigator.language);
68
+ var zh = () => {
69
+ const docLang = typeof document !== "undefined" ? document.documentElement?.lang || "" : "";
70
+ const navLang = typeof navigator !== "undefined" ? navigator.language || "" : "";
71
+ if (/^zh\b/i.test(docLang || navLang)) return true;
72
+ try {
73
+ const opts = Intl.DateTimeFormat().resolvedOptions();
74
+ if (/^zh\b/i.test(opts.locale || "")) return true;
75
+ if (/^(Asia\/(Shanghai|Chongqing|Chungking|Harbin|Urumqi|Beijing)|PRC)$/i.test(opts.timeZone || "")) return true;
76
+ } catch {
77
+ }
78
+ return false;
79
+ };
69
80
  var label = () => zh() ? "\u7528 Inkmap \u6253\u5F00" : "Open in Inkmap";
70
81
  var desktop = () => location.protocol === "dsh-app:" && location.hostname === "app";
71
82
  var actionClass = "inkmap-harness-open";
@@ -183,7 +194,7 @@ function apply(ctx) {
183
194
  src: desktop() ? `${view.url}?account-navigation=host` : view.url,
184
195
  title: "Inkmap",
185
196
  referrerPolicy: "no-referrer",
186
- sandbox: "allow-scripts allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox",
197
+ sandbox: "allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox",
187
198
  style: { display: "block", width: "100%", height: "100%", border: 0 }
188
199
  });
189
200
  }
@@ -115,15 +115,26 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
115
115
  }
116
116
  return /^1\d{10}$/.test(clean) ? `${clean.slice(0, 3)}****${clean.slice(7)}` : clean.slice(0, 32);
117
117
  }
118
- function clientLocale() {
119
- const raw = (process.env.INKMAP_LOCALE || process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
120
- if (/^zh\b/i.test(raw))
118
+ function clientLocale(hint) {
119
+ const h = (hint || "").trim();
120
+ if (/^zh\b/i.test(h))
121
+ return "zh";
122
+ if (/^en\b/i.test(h))
123
+ return "en";
124
+ const envLocale = (process.env.INKMAP_LOCALE || "").trim();
125
+ if (/^zh\b/i.test(envLocale))
121
126
  return "zh";
122
- if (/^en\b/i.test(process.env.INKMAP_LOCALE || ""))
127
+ if (/^en\b/i.test(envLocale))
123
128
  return "en";
129
+ const raw = (process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
130
+ if (/^zh\b/i.test(raw))
131
+ return "zh";
124
132
  try {
125
- const tz = Intl.DateTimeFormat().resolvedOptions().timeZone || "";
126
- if (/^Asia\/(Shanghai|Chongqing|Harbin|Urumqi)$/i.test(tz))
133
+ const opts = Intl.DateTimeFormat().resolvedOptions();
134
+ if (/^zh\b/i.test(opts.locale || ""))
135
+ return "zh";
136
+ const tz = opts.timeZone || "";
137
+ if (/^(Asia\/(Shanghai|Chongqing|Chungking|Harbin|Urumqi|Beijing)|PRC)$/i.test(tz))
127
138
  return "zh";
128
139
  } catch {
129
140
  }
@@ -136,16 +147,18 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
136
147
  });
137
148
  return next;
138
149
  }
139
- async function createCheckoutFlow(origin, existingToken, existingCookie) {
150
+ async function createCheckoutFlow(origin, existingToken, existingCookie, localeHint) {
151
+ const loc = clientLocale(localeHint);
140
152
  const response = await fetch(origin + "/billing/v1/connections", {
141
153
  method: "POST",
142
154
  headers: {
143
155
  "content-type": "application/json",
156
+ "x-inkmap-locale": loc,
144
157
  ...existingToken && { authorization: "Bearer " + existingToken },
145
158
  ...existingCookie && { cookie: existingCookie }
146
159
  },
147
160
  redirect: "error",
148
- body: JSON.stringify({ product: PRODUCT.id, mode: "buy" }),
161
+ body: JSON.stringify({ product: PRODUCT.id, mode: "buy", locale: loc }),
149
162
  signal: AbortSignal.timeout(8e3)
150
163
  });
151
164
  if (!response.ok)
@@ -158,11 +171,13 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
158
171
  }
159
172
  return { origin, url, token: data.token, ...cookie && { cookie } };
160
173
  }
161
- function checkoutPost(checkoutUrl, action, origin, body, token, cookie) {
174
+ function checkoutPost(checkoutUrl, action, origin, body, token, cookie, localeHint) {
175
+ const loc = clientLocale(localeHint);
162
176
  return fetch(checkoutUrl + "/" + action, {
163
177
  method: "POST",
164
178
  headers: {
165
179
  "content-type": "application/json",
180
+ "x-inkmap-locale": loc,
166
181
  origin,
167
182
  ...token && { authorization: "Bearer " + token },
168
183
  ...cookie && { cookie }
@@ -172,13 +187,14 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
172
187
  signal: AbortSignal.timeout(12e3)
173
188
  });
174
189
  }
175
- function phoneRequest(origin, action, phone, code) {
190
+ function phoneRequest(origin, action, phone, code, localeHint) {
176
191
  const isEmail = phone.includes("@");
177
- const locale = clientLocale();
192
+ const locale = clientLocale(localeHint);
178
193
  return fetch(origin + "/billing/v1/phone-sign-in/" + action, {
179
194
  method: "POST",
180
195
  headers: {
181
196
  "content-type": "application/json",
197
+ "x-inkmap-locale": locale,
182
198
  "accept-language": locale === "zh" ? "zh-CN,zh;q=0.9" : "en-US,en;q=0.9"
183
199
  },
184
200
  redirect: "error",
@@ -303,10 +319,11 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
303
319
  await refresh();
304
320
  return current;
305
321
  },
306
- async connect(mode) {
322
+ async connect(mode, localeHint) {
307
323
  if (loginOnly && mode !== "restore")
308
324
  throw new Error("Only Yunfan account sign-in is available.");
309
325
  const origin = billingOrigin(getOrigin());
326
+ const loc = clientLocale(localeHint);
310
327
  const version = generation;
311
328
  let existingToken;
312
329
  try {
@@ -322,6 +339,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
322
339
  method: "POST",
323
340
  headers: {
324
341
  "content-type": "application/json",
342
+ "x-inkmap-locale": loc,
325
343
  ...existingToken && { authorization: "Bearer " + existingToken }
326
344
  },
327
345
  redirect: "error",
@@ -329,10 +347,10 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
329
347
  signal: AbortSignal.timeout(8e3)
330
348
  });
331
349
  let legacy = false;
332
- let response = await (mode === "restore" ? create("restore-connections", { product: PRODUCT.id }) : create("connections", { product: PRODUCT.id, mode }));
350
+ let response = await (mode === "restore" ? create("restore-connections", { product: PRODUCT.id }) : create("connections", { product: PRODUCT.id, mode, locale: loc }));
333
351
  if (mode === "restore" && !loginOnly && response.status === 404) {
334
352
  legacy = true;
335
- response = await create("connections", { product: PRODUCT.id, mode });
353
+ response = await create("connections", { product: PRODUCT.id, mode, locale: loc });
336
354
  }
337
355
  if (!response.ok)
338
356
  throw new Error("Unable to start the Yunfan account flow.");
@@ -354,7 +372,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
354
372
  });
355
373
  return url;
356
374
  },
357
- async orderPro() {
375
+ async orderPro(localeHint) {
358
376
  if (loginOnly)
359
377
  throw new Error("Only Yunfan account sign-in is available.");
360
378
  const origin = billingOrigin(getOrigin());
@@ -373,7 +391,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
373
391
  } catch {
374
392
  }
375
393
  const requestOrder = async (checkoutUrl, token, cookie, persist) => {
376
- const res = await checkoutPost(checkoutUrl, "order", origin, {}, token, cookie);
394
+ const res = await checkoutPost(checkoutUrl, "order", origin, {}, token, cookie, localeHint);
377
395
  if (res.status === 401 || res.status === 403 || res.status === 404 || res.status === 410)
378
396
  return null;
379
397
  if (!res.ok)
@@ -423,31 +441,31 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
423
441
  return existing;
424
442
  }
425
443
  const existingToken = record?.origin === origin && typeof record.token === "string" ? record.token : void 0;
426
- const flow = await createCheckoutFlow(origin, existingToken, existingCookie);
444
+ const flow = await createCheckoutFlow(origin, existingToken, existingCookie, localeHint);
427
445
  const ordered = await requestOrder(flow.url, flow.token, flow.cookie, true);
428
446
  if (ordered)
429
447
  return ordered;
430
448
  pendingCheckout = flow;
431
449
  return { status: "needsPhone" };
432
450
  },
433
- async sendPhoneCode(phone) {
451
+ async sendPhoneCode(phone, localeHint) {
434
452
  if (typeof phone !== "string" || !phone.trim() || phone.length > 254)
435
453
  return phoneFailure(400);
436
454
  const isEmail = phone.includes("@");
437
- const locale = clientLocale();
455
+ const locale = clientLocale(localeHint);
438
456
  try {
439
457
  const origin = billingOrigin(getOrigin());
440
458
  if (!loginOnly) {
441
459
  try {
442
460
  if (!pendingCheckout || pendingCheckout.origin !== origin) {
443
- pendingCheckout = await createCheckoutFlow(origin);
461
+ pendingCheckout = await createCheckoutFlow(origin, void 0, void 0, locale);
444
462
  }
445
463
  const sendAction = isEmail ? "email/send" : "sms";
446
464
  const sendBody = isEmail ? { email: phone, locale } : { phone };
447
- let smsRes = await checkoutPost(pendingCheckout.url, sendAction, origin, sendBody, pendingCheckout.token, pendingCheckout.cookie);
465
+ let smsRes = await checkoutPost(pendingCheckout.url, sendAction, origin, sendBody, pendingCheckout.token, pendingCheckout.cookie, locale);
448
466
  if (smsRes.status === 410 || smsRes.status === 404) {
449
- pendingCheckout = await createCheckoutFlow(origin);
450
- smsRes = await checkoutPost(pendingCheckout.url, sendAction, origin, sendBody, pendingCheckout.token, pendingCheckout.cookie);
467
+ pendingCheckout = await createCheckoutFlow(origin, void 0, void 0, locale);
468
+ smsRes = await checkoutPost(pendingCheckout.url, sendAction, origin, sendBody, pendingCheckout.token, pendingCheckout.cookie, locale);
451
469
  }
452
470
  pendingCheckout.cookie = mergeCookies(pendingCheckout.cookie, smsRes);
453
471
  return smsRes.status === 204 ? { ok: true, value: void 0 } : phoneFailure(smsRes.status);
@@ -455,7 +473,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
455
473
  pendingCheckout = void 0;
456
474
  }
457
475
  }
458
- const response = await phoneRequest(origin, "send", phone);
476
+ const response = await phoneRequest(origin, "send", phone, void 0, locale);
459
477
  return response.status === 204 ? { ok: true, value: void 0 } : phoneFailure(response.status);
460
478
  } catch {
461
479
  return phoneFailure();
@@ -631,7 +649,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
631
649
  installId: id,
632
650
  host: hostName,
633
651
  os,
634
- version: "0.3.3",
652
+ version: "0.3.4",
635
653
  locale: clientLocale(),
636
654
  tier,
637
655
  events
@@ -902,7 +920,7 @@ function within(root, rel) {
902
920
  return full.startsWith(base) ? full : null;
903
921
  }
904
922
  async function serve({ source: initialSource, webRoot: webRoot2, port = 4377, host = "127.0.0.1", log = () => {
905
- }, license, ads, sidebar = false, sidebarPurchase = false, sidebarAccountNavigation = false, loginOnly = false, ideWorkspace = false }) {
923
+ }, license, ads, sidebar = false, sidebarPurchase = false, sidebarAccountNavigation = false, loginOnly = false, ideWorkspace = false, workspaceRoots = [] }) {
906
924
  if (sidebar && host !== "127.0.0.1")
907
925
  throw new Error("The sidebar bridge requires loopback.");
908
926
  const prefix2 = sidebar ? `/s/${randomBytes(24).toString("hex")}/` : "/";
@@ -961,7 +979,7 @@ data: ${JSON.stringify(data)}
961
979
  const projRoot = await realpath(await findProjectRoot(realKey)).catch(() => dirname2(realKey));
962
980
  roots.set(projRoot, { path: projRoot, name: basename(projRoot), active: true });
963
981
  }
964
- const envRoots = (process.env.INKMAP_WORKSPACES || "").split(delimiter).filter(Boolean);
982
+ const envRoots = [...workspaceRoots, ...(process.env.INKMAP_WORKSPACES || "").split(delimiter)].filter(Boolean);
965
983
  for (const raw of envRoots) {
966
984
  const real = await realpath(resolve(raw)).catch(() => null);
967
985
  if (real && !roots.has(real)) {
@@ -1147,14 +1165,14 @@ data: ${JSON.stringify(data)}
1147
1165
  if (url.pathname === "/api/checkout" && req.method === "POST") {
1148
1166
  if (!sameOriginPost())
1149
1167
  return json2(res, 403, { error: "forbidden" });
1150
- const { mode } = JSON.parse(await readBody2(req));
1168
+ const { mode, locale } = JSON.parse(await readBody2(req));
1151
1169
  if (mode !== "buy" && mode !== "restore")
1152
1170
  return json2(res, 400, { error: "invalid checkout mode" });
1153
1171
  if (!canPurchase && mode === "buy")
1154
1172
  return json2(res, 403, { error: "forbidden" });
1155
1173
  if (!license)
1156
1174
  return json2(res, 503, { error: "Inkmap checkout is unavailable." });
1157
- return json2(res, 200, { url: await license.connect(mode) });
1175
+ return json2(res, 200, { url: await (typeof locale === "string" ? license.connect(mode, locale) : license.connect(mode)) });
1158
1176
  }
1159
1177
  if (url.pathname === "/api/order-pro" && req.method === "POST") {
1160
1178
  if (!sameOriginPost())
@@ -1165,15 +1183,16 @@ data: ${JSON.stringify(data)}
1165
1183
  return json2(res, 503, { error: "Inkmap checkout is unavailable." });
1166
1184
  if (typeof license.orderPro !== "function")
1167
1185
  return json2(res, 501, { fallback: true });
1168
- return json2(res, 200, { result: await license.orderPro() });
1186
+ const { locale } = JSON.parse(await readBody2(req) || "{}");
1187
+ return json2(res, 200, { result: await (typeof locale === "string" ? license.orderPro(locale) : license.orderPro()) });
1169
1188
  }
1170
1189
  if (url.pathname === "/api/phone-send" && req.method === "POST") {
1171
1190
  if (!sameOriginPost())
1172
1191
  return json2(res, 403, { error: "forbidden" });
1173
1192
  if (!license || typeof license.sendPhoneCode !== "function")
1174
1193
  return json2(res, 501, { fallback: true });
1175
- const { phone } = JSON.parse(await readBody2(req));
1176
- return json2(res, 200, { result: await license.sendPhoneCode(String(phone ?? "")) });
1194
+ const { phone, locale } = JSON.parse(await readBody2(req));
1195
+ return json2(res, 200, { result: await (typeof locale === "string" ? license.sendPhoneCode(String(phone ?? ""), locale) : license.sendPhoneCode(String(phone ?? ""))) });
1177
1196
  }
1178
1197
  if (url.pathname === "/api/phone-verify" && req.method === "POST") {
1179
1198
  if (!sameOriginPost())
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-inkmap",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Inkmap 思维导图 — 在 DeepSeek Harness 中将本地 Markdown 实时渲染为可双向编辑的思维导图 (Markmap) 与 Mermaid 流程图 / Interactive two-way Markdown mind map & Mermaid flowchart editor for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",