inkmap-mcp 0.3.4 → 0.3.6
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/bundles/antigravity/plugin.json +5 -5
- package/dist/bundles/antigravity/sidecars/inkmap/main.mjs +114 -21
- package/dist/bundles/codex/inkmap-codex/.codex-plugin/plugin.json +28 -3
- package/dist/bundles/codex/inkmap-codex/plugin.json +28 -3
- package/dist/bundles/harness/host.js +123 -22
- package/dist/bundles/harness/package.json +9 -1
- package/dist/bundles/vscode/dist/extension.js +203 -139
- package/dist/bundles/vscode/package.json +3 -11
- package/dist/bundles/vscode/package.nls.json +2 -4
- package/dist/bundles/vscode/package.nls.zh-cn.json +2 -4
- package/dist/cli.cjs +158 -69
- package/dist/codex.html +228 -228
- package/dist/web/app.js +7122 -7108
- package/package.json +23 -4
- package/server.json +14 -5
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inkmap",
|
|
3
|
-
"displayName": "Inkmap",
|
|
3
|
+
"displayName": "Inkmap — Markdown Mind Map & Mermaid 思维导图",
|
|
4
4
|
"version": "0.2.0",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Interactive two-way Markdown (.md, .markmap.md) mind map, mindmap, markmap, Mermaid flowchart, diagram, XMind outline & KaTeX editor: auto-opens in the Antigravity side pane with live file write-back. 在右侧面板实时双向编辑 Markdown 思维导图、脑图、流程图、大纲、架构图、组织结构图与鱼骨图。",
|
|
6
6
|
"logo": "assets/logo.svg",
|
|
7
|
-
"homepage": "https://
|
|
7
|
+
"homepage": "https://zhiyuanv.com/software.html",
|
|
8
8
|
"repository": "https://github.com/zhiyuanvision-lang/InkMap",
|
|
9
9
|
"suggestedPrompts": [
|
|
10
10
|
"用 Inkmap 在右侧打开当前项目的 Markdown 思维导图",
|
|
11
|
-
"把这份设计文档整理成 Markdown
|
|
12
|
-
"Open this Markdown outline in Inkmap mind map"
|
|
11
|
+
"把这份设计文档整理成 Markdown 脑图大纲并用 Inkmap 打开",
|
|
12
|
+
"Open this Markdown outline or Mermaid flowchart in Inkmap mind map"
|
|
13
13
|
]
|
|
14
14
|
}
|
|
@@ -57,10 +57,60 @@ function sanitizeViewState(raw) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
// packages/cli/dist/license.js
|
|
60
|
+
import { execFileSync } from "node:child_process";
|
|
60
61
|
import { link, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
61
62
|
import { randomUUID } from "node:crypto";
|
|
62
63
|
import { homedir } from "node:os";
|
|
63
64
|
import { dirname, join } from "node:path";
|
|
65
|
+
var cachedOsLocale;
|
|
66
|
+
function detectOsLocale() {
|
|
67
|
+
const explicit = (process.env.INKMAP_LOCALE || "").trim();
|
|
68
|
+
if (/^zh\b/i.test(explicit))
|
|
69
|
+
return "zh";
|
|
70
|
+
if (/^en\b/i.test(explicit))
|
|
71
|
+
return "en";
|
|
72
|
+
if (cachedOsLocale)
|
|
73
|
+
return cachedOsLocale;
|
|
74
|
+
let domestic = false;
|
|
75
|
+
try {
|
|
76
|
+
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone || "";
|
|
77
|
+
if (/^(Asia\/(Shanghai|Chongqing|Chungking|Harbin|Urumqi|Beijing)|PRC)$/i.test(tz)) {
|
|
78
|
+
domestic = true;
|
|
79
|
+
}
|
|
80
|
+
} catch {
|
|
81
|
+
}
|
|
82
|
+
if (!domestic) {
|
|
83
|
+
if (process.platform === "darwin") {
|
|
84
|
+
try {
|
|
85
|
+
const out = execFileSync("defaults", ["read", "-g", "AppleLanguages"], {
|
|
86
|
+
encoding: "utf8",
|
|
87
|
+
timeout: 800,
|
|
88
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
89
|
+
});
|
|
90
|
+
const firstLang = /"([^"]+)"/.exec(out)?.[1] ?? "";
|
|
91
|
+
if (/^zh\b/i.test(firstLang))
|
|
92
|
+
domestic = true;
|
|
93
|
+
} catch {
|
|
94
|
+
const raw = (process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
|
|
95
|
+
if (/^zh\b/i.test(raw))
|
|
96
|
+
domestic = true;
|
|
97
|
+
}
|
|
98
|
+
} else if (process.platform === "win32") {
|
|
99
|
+
try {
|
|
100
|
+
const loc = Intl.DateTimeFormat().resolvedOptions().locale || "";
|
|
101
|
+
if (/^zh\b/i.test(loc))
|
|
102
|
+
domestic = true;
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
const raw = (process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
|
|
107
|
+
if (/^zh\b/i.test(raw))
|
|
108
|
+
domestic = true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
cachedOsLocale = domestic ? "zh" : "en";
|
|
112
|
+
return cachedOsLocale;
|
|
113
|
+
}
|
|
64
114
|
function billingOrigin(raw) {
|
|
65
115
|
if (!raw)
|
|
66
116
|
throw new Error("Inkmap checkout is not configured.");
|
|
@@ -89,6 +139,13 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
89
139
|
let pendingWrite = Promise.resolve();
|
|
90
140
|
let pendingCheckout;
|
|
91
141
|
let cachedOrder;
|
|
142
|
+
let magicPollTimer;
|
|
143
|
+
let magicSession = 0;
|
|
144
|
+
function stopMagicPoll() {
|
|
145
|
+
++magicSession;
|
|
146
|
+
clearTimeout(magicPollTimer);
|
|
147
|
+
magicPollTimer = void 0;
|
|
148
|
+
}
|
|
92
149
|
function mergeCookies(existing, response) {
|
|
93
150
|
const map = /* @__PURE__ */ new Map();
|
|
94
151
|
if (existing) {
|
|
@@ -124,24 +181,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
124
181
|
return "zh";
|
|
125
182
|
if (/^en\b/i.test(h))
|
|
126
183
|
return "en";
|
|
127
|
-
|
|
128
|
-
if (/^zh\b/i.test(envLocale))
|
|
129
|
-
return "zh";
|
|
130
|
-
if (/^en\b/i.test(envLocale))
|
|
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";
|
|
135
|
-
try {
|
|
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))
|
|
141
|
-
return "zh";
|
|
142
|
-
} catch {
|
|
143
|
-
}
|
|
144
|
-
return "en";
|
|
184
|
+
return detectOsLocale();
|
|
145
185
|
}
|
|
146
186
|
function writeSession(operation) {
|
|
147
187
|
const next = pendingWrite.then(operation);
|
|
@@ -302,7 +342,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
302
342
|
if (version !== generation || disposed)
|
|
303
343
|
return;
|
|
304
344
|
applyEntitlement(state);
|
|
305
|
-
delay = state.active !== true && state.pending === true ?
|
|
345
|
+
delay = state.active !== true && state.pending === true ? 2500 : 6e4;
|
|
306
346
|
} catch {
|
|
307
347
|
if (version === generation && Date.now() - lastCheck > 15 * 6e4)
|
|
308
348
|
update(false);
|
|
@@ -315,6 +355,49 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
315
355
|
});
|
|
316
356
|
return connection;
|
|
317
357
|
}
|
|
358
|
+
function startMagicPoll(origin, pendingToken) {
|
|
359
|
+
stopMagicPoll();
|
|
360
|
+
const id = magicSession;
|
|
361
|
+
const deadline = Date.now() + 10 * 6e4;
|
|
362
|
+
const poll = () => {
|
|
363
|
+
if (disposed || id !== magicSession || Date.now() >= deadline)
|
|
364
|
+
return;
|
|
365
|
+
magicPollTimer = setTimeout(async () => {
|
|
366
|
+
if (disposed || id !== magicSession)
|
|
367
|
+
return;
|
|
368
|
+
try {
|
|
369
|
+
const res = await entitlement(origin, pendingToken);
|
|
370
|
+
if (disposed || id !== magicSession)
|
|
371
|
+
return;
|
|
372
|
+
if (res.status === 401) {
|
|
373
|
+
stopMagicPoll();
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
if (res.ok) {
|
|
377
|
+
const body = await res.json();
|
|
378
|
+
if (body?.connected === true && body.entitlement === PRODUCT.entitlement) {
|
|
379
|
+
stopMagicPoll();
|
|
380
|
+
await writeSession(async () => {
|
|
381
|
+
if (disposed || origin !== billingOrigin(getOrigin()))
|
|
382
|
+
return;
|
|
383
|
+
await storage.write(JSON.stringify({ origin, token: pendingToken }));
|
|
384
|
+
++generation;
|
|
385
|
+
activeOrigin = origin;
|
|
386
|
+
applyEntitlement(body);
|
|
387
|
+
schedule(body.active === true ? 6e4 : 2500);
|
|
388
|
+
});
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
} catch {
|
|
393
|
+
}
|
|
394
|
+
if (!disposed && id === magicSession && Date.now() < deadline)
|
|
395
|
+
poll();
|
|
396
|
+
}, 2e3);
|
|
397
|
+
magicPollTimer.unref();
|
|
398
|
+
};
|
|
399
|
+
poll();
|
|
400
|
+
}
|
|
318
401
|
return {
|
|
319
402
|
async state() {
|
|
320
403
|
await (trial ??= startTrial());
|
|
@@ -477,7 +560,14 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
477
560
|
}
|
|
478
561
|
}
|
|
479
562
|
const response = await phoneRequest(origin, "send", phone, void 0, locale);
|
|
480
|
-
|
|
563
|
+
if (response.status === 204) {
|
|
564
|
+
const pendingToken = response.headers.get("x-inkmap-pending-token")?.trim();
|
|
565
|
+
if (pendingToken && /^[A-Za-z0-9_-]{43}$/.test(pendingToken)) {
|
|
566
|
+
startMagicPoll(origin, pendingToken);
|
|
567
|
+
}
|
|
568
|
+
return { ok: true, value: void 0 };
|
|
569
|
+
}
|
|
570
|
+
return phoneFailure(response.status);
|
|
481
571
|
} catch {
|
|
482
572
|
return phoneFailure();
|
|
483
573
|
}
|
|
@@ -561,6 +651,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
561
651
|
return await writeSession(async () => {
|
|
562
652
|
if (version !== generation || disposed || origin !== billingOrigin(getOrigin()))
|
|
563
653
|
return phoneFailure();
|
|
654
|
+
stopMagicPoll();
|
|
564
655
|
await storage.write(JSON.stringify({ origin, token, ...checkoutUrl && { checkoutUrl }, ...cookie && { cookie } }));
|
|
565
656
|
++generation;
|
|
566
657
|
activeOrigin = origin;
|
|
@@ -575,6 +666,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
575
666
|
}
|
|
576
667
|
},
|
|
577
668
|
async deactivate() {
|
|
669
|
+
stopMagicPoll();
|
|
578
670
|
pendingCheckout = void 0;
|
|
579
671
|
cachedOrder = void 0;
|
|
580
672
|
const saved = await writeSession(async () => {
|
|
@@ -652,7 +744,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
652
744
|
installId: id,
|
|
653
745
|
host: hostName,
|
|
654
746
|
os,
|
|
655
|
-
version: "0.3.
|
|
747
|
+
version: "0.3.6",
|
|
656
748
|
locale: clientLocale(),
|
|
657
749
|
tier,
|
|
658
750
|
events
|
|
@@ -666,6 +758,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
666
758
|
},
|
|
667
759
|
dispose() {
|
|
668
760
|
disposed = true;
|
|
761
|
+
stopMagicPoll();
|
|
669
762
|
clearTimeout(trialTimer);
|
|
670
763
|
clearTimeout(timer);
|
|
671
764
|
clearTimeout(telemetryTimer);
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inkmap-codex",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.6",
|
|
4
|
+
"description": "Interactive two-way Markdown mind map (markmap), Mermaid flowchart & XMind outline editor | 双向编辑 Markdown 思维导图、脑图、流程图与大纲",
|
|
5
|
+
"homepage": "https://zhiyuanv.com/software.html",
|
|
6
|
+
"repository": "https://github.com/zhiyuanvision-lang/InkMap",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Zhiyuan Vision",
|
|
9
|
+
"email": "contact@zhiyuanv.com"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"inkmap",
|
|
13
|
+
"markdown",
|
|
14
|
+
"mindmap",
|
|
15
|
+
"mind-map",
|
|
16
|
+
"mind map",
|
|
17
|
+
"markmap",
|
|
18
|
+
"mermaid",
|
|
19
|
+
"flowchart",
|
|
20
|
+
"diagram",
|
|
21
|
+
"outline",
|
|
22
|
+
"xmind",
|
|
23
|
+
"katex",
|
|
24
|
+
"思维导图",
|
|
25
|
+
"脑图",
|
|
26
|
+
"流程图",
|
|
27
|
+
"大纲",
|
|
28
|
+
"架构图"
|
|
29
|
+
],
|
|
5
30
|
"requires_local_executor": true,
|
|
6
31
|
"interface": {
|
|
7
|
-
"displayName": "Inkmap",
|
|
32
|
+
"displayName": "Inkmap — Mind Map & Mermaid 思维导图",
|
|
8
33
|
"logo": "./assets/icon.png",
|
|
9
34
|
"composerIcon": "./assets/icon.png"
|
|
10
35
|
},
|
|
@@ -1,13 +1,38 @@
|
|
|
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.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "0.3.6",
|
|
5
|
+
"description": "Interactive two-way Markdown mind map (markmap), Mermaid flowchart & XMind outline editor | 双向编辑 Markdown 思维导图、脑图、流程图与大纲",
|
|
6
|
+
"homepage": "https://zhiyuanv.com/software.html",
|
|
7
|
+
"repository": "https://github.com/zhiyuanvision-lang/InkMap",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Zhiyuan Vision",
|
|
10
|
+
"email": "contact@zhiyuanv.com"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"inkmap",
|
|
14
|
+
"markdown",
|
|
15
|
+
"mindmap",
|
|
16
|
+
"mind-map",
|
|
17
|
+
"mind map",
|
|
18
|
+
"markmap",
|
|
19
|
+
"mermaid",
|
|
20
|
+
"flowchart",
|
|
21
|
+
"diagram",
|
|
22
|
+
"outline",
|
|
23
|
+
"xmind",
|
|
24
|
+
"katex",
|
|
25
|
+
"思维导图",
|
|
26
|
+
"脑图",
|
|
27
|
+
"流程图",
|
|
28
|
+
"大纲",
|
|
29
|
+
"架构图"
|
|
30
|
+
],
|
|
6
31
|
"extensions": {
|
|
7
32
|
"com.openai": {
|
|
8
33
|
"requires_local_executor": true,
|
|
9
34
|
"interface": {
|
|
10
|
-
"displayName": "Inkmap",
|
|
35
|
+
"displayName": "Inkmap — Mind Map & Mermaid 思维导图",
|
|
11
36
|
"logo": "./assets/icon.png",
|
|
12
37
|
"composerIcon": "./assets/icon.png"
|
|
13
38
|
}
|
|
@@ -54,10 +54,60 @@ function sanitizeViewState(raw) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// packages/cli/dist/license.js
|
|
57
|
+
import { execFileSync } from "node:child_process";
|
|
57
58
|
import { link, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
58
59
|
import { randomUUID } from "node:crypto";
|
|
59
60
|
import { homedir } from "node:os";
|
|
60
61
|
import { dirname, join } from "node:path";
|
|
62
|
+
var cachedOsLocale;
|
|
63
|
+
function detectOsLocale() {
|
|
64
|
+
const explicit = (process.env.INKMAP_LOCALE || "").trim();
|
|
65
|
+
if (/^zh\b/i.test(explicit))
|
|
66
|
+
return "zh";
|
|
67
|
+
if (/^en\b/i.test(explicit))
|
|
68
|
+
return "en";
|
|
69
|
+
if (cachedOsLocale)
|
|
70
|
+
return cachedOsLocale;
|
|
71
|
+
let domestic = false;
|
|
72
|
+
try {
|
|
73
|
+
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone || "";
|
|
74
|
+
if (/^(Asia\/(Shanghai|Chongqing|Chungking|Harbin|Urumqi|Beijing)|PRC)$/i.test(tz)) {
|
|
75
|
+
domestic = true;
|
|
76
|
+
}
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
if (!domestic) {
|
|
80
|
+
if (process.platform === "darwin") {
|
|
81
|
+
try {
|
|
82
|
+
const out = execFileSync("defaults", ["read", "-g", "AppleLanguages"], {
|
|
83
|
+
encoding: "utf8",
|
|
84
|
+
timeout: 800,
|
|
85
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
86
|
+
});
|
|
87
|
+
const firstLang = /"([^"]+)"/.exec(out)?.[1] ?? "";
|
|
88
|
+
if (/^zh\b/i.test(firstLang))
|
|
89
|
+
domestic = true;
|
|
90
|
+
} catch {
|
|
91
|
+
const raw = (process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
|
|
92
|
+
if (/^zh\b/i.test(raw))
|
|
93
|
+
domestic = true;
|
|
94
|
+
}
|
|
95
|
+
} else if (process.platform === "win32") {
|
|
96
|
+
try {
|
|
97
|
+
const loc = Intl.DateTimeFormat().resolvedOptions().locale || "";
|
|
98
|
+
if (/^zh\b/i.test(loc))
|
|
99
|
+
domestic = true;
|
|
100
|
+
} catch {
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
const raw = (process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "").trim();
|
|
104
|
+
if (/^zh\b/i.test(raw))
|
|
105
|
+
domestic = true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
cachedOsLocale = domestic ? "zh" : "en";
|
|
109
|
+
return cachedOsLocale;
|
|
110
|
+
}
|
|
61
111
|
function billingOrigin(raw) {
|
|
62
112
|
if (!raw)
|
|
63
113
|
throw new Error("Inkmap checkout is not configured.");
|
|
@@ -86,6 +136,13 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
86
136
|
let pendingWrite = Promise.resolve();
|
|
87
137
|
let pendingCheckout;
|
|
88
138
|
let cachedOrder;
|
|
139
|
+
let magicPollTimer;
|
|
140
|
+
let magicSession = 0;
|
|
141
|
+
function stopMagicPoll() {
|
|
142
|
+
++magicSession;
|
|
143
|
+
clearTimeout(magicPollTimer);
|
|
144
|
+
magicPollTimer = void 0;
|
|
145
|
+
}
|
|
89
146
|
function mergeCookies(existing, response) {
|
|
90
147
|
const map = /* @__PURE__ */ new Map();
|
|
91
148
|
if (existing) {
|
|
@@ -121,24 +178,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
121
178
|
return "zh";
|
|
122
179
|
if (/^en\b/i.test(h))
|
|
123
180
|
return "en";
|
|
124
|
-
|
|
125
|
-
if (/^zh\b/i.test(envLocale))
|
|
126
|
-
return "zh";
|
|
127
|
-
if (/^en\b/i.test(envLocale))
|
|
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";
|
|
132
|
-
try {
|
|
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))
|
|
138
|
-
return "zh";
|
|
139
|
-
} catch {
|
|
140
|
-
}
|
|
141
|
-
return "en";
|
|
181
|
+
return detectOsLocale();
|
|
142
182
|
}
|
|
143
183
|
function writeSession(operation) {
|
|
144
184
|
const next = pendingWrite.then(operation);
|
|
@@ -299,7 +339,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
299
339
|
if (version !== generation || disposed)
|
|
300
340
|
return;
|
|
301
341
|
applyEntitlement(state);
|
|
302
|
-
delay = state.active !== true && state.pending === true ?
|
|
342
|
+
delay = state.active !== true && state.pending === true ? 2500 : 6e4;
|
|
303
343
|
} catch {
|
|
304
344
|
if (version === generation && Date.now() - lastCheck > 15 * 6e4)
|
|
305
345
|
update(false);
|
|
@@ -312,6 +352,49 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
312
352
|
});
|
|
313
353
|
return connection;
|
|
314
354
|
}
|
|
355
|
+
function startMagicPoll(origin, pendingToken) {
|
|
356
|
+
stopMagicPoll();
|
|
357
|
+
const id = magicSession;
|
|
358
|
+
const deadline = Date.now() + 10 * 6e4;
|
|
359
|
+
const poll = () => {
|
|
360
|
+
if (disposed || id !== magicSession || Date.now() >= deadline)
|
|
361
|
+
return;
|
|
362
|
+
magicPollTimer = setTimeout(async () => {
|
|
363
|
+
if (disposed || id !== magicSession)
|
|
364
|
+
return;
|
|
365
|
+
try {
|
|
366
|
+
const res = await entitlement(origin, pendingToken);
|
|
367
|
+
if (disposed || id !== magicSession)
|
|
368
|
+
return;
|
|
369
|
+
if (res.status === 401) {
|
|
370
|
+
stopMagicPoll();
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (res.ok) {
|
|
374
|
+
const body = await res.json();
|
|
375
|
+
if (body?.connected === true && body.entitlement === PRODUCT.entitlement) {
|
|
376
|
+
stopMagicPoll();
|
|
377
|
+
await writeSession(async () => {
|
|
378
|
+
if (disposed || origin !== billingOrigin(getOrigin()))
|
|
379
|
+
return;
|
|
380
|
+
await storage.write(JSON.stringify({ origin, token: pendingToken }));
|
|
381
|
+
++generation;
|
|
382
|
+
activeOrigin = origin;
|
|
383
|
+
applyEntitlement(body);
|
|
384
|
+
schedule(body.active === true ? 6e4 : 2500);
|
|
385
|
+
});
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
} catch {
|
|
390
|
+
}
|
|
391
|
+
if (!disposed && id === magicSession && Date.now() < deadline)
|
|
392
|
+
poll();
|
|
393
|
+
}, 2e3);
|
|
394
|
+
magicPollTimer.unref();
|
|
395
|
+
};
|
|
396
|
+
poll();
|
|
397
|
+
}
|
|
315
398
|
return {
|
|
316
399
|
async state() {
|
|
317
400
|
await (trial ??= startTrial());
|
|
@@ -474,7 +557,14 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
474
557
|
}
|
|
475
558
|
}
|
|
476
559
|
const response = await phoneRequest(origin, "send", phone, void 0, locale);
|
|
477
|
-
|
|
560
|
+
if (response.status === 204) {
|
|
561
|
+
const pendingToken = response.headers.get("x-inkmap-pending-token")?.trim();
|
|
562
|
+
if (pendingToken && /^[A-Za-z0-9_-]{43}$/.test(pendingToken)) {
|
|
563
|
+
startMagicPoll(origin, pendingToken);
|
|
564
|
+
}
|
|
565
|
+
return { ok: true, value: void 0 };
|
|
566
|
+
}
|
|
567
|
+
return phoneFailure(response.status);
|
|
478
568
|
} catch {
|
|
479
569
|
return phoneFailure();
|
|
480
570
|
}
|
|
@@ -558,6 +648,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
558
648
|
return await writeSession(async () => {
|
|
559
649
|
if (version !== generation || disposed || origin !== billingOrigin(getOrigin()))
|
|
560
650
|
return phoneFailure();
|
|
651
|
+
stopMagicPoll();
|
|
561
652
|
await storage.write(JSON.stringify({ origin, token, ...checkoutUrl && { checkoutUrl }, ...cookie && { cookie } }));
|
|
562
653
|
++generation;
|
|
563
654
|
activeOrigin = origin;
|
|
@@ -572,6 +663,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
572
663
|
}
|
|
573
664
|
},
|
|
574
665
|
async deactivate() {
|
|
666
|
+
stopMagicPoll();
|
|
575
667
|
pendingCheckout = void 0;
|
|
576
668
|
cachedOrder = void 0;
|
|
577
669
|
const saved = await writeSession(async () => {
|
|
@@ -649,7 +741,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
649
741
|
installId: id,
|
|
650
742
|
host: hostName,
|
|
651
743
|
os,
|
|
652
|
-
version: "0.3.
|
|
744
|
+
version: "0.3.6",
|
|
653
745
|
locale: clientLocale(),
|
|
654
746
|
tier,
|
|
655
747
|
events
|
|
@@ -663,6 +755,7 @@ function licenseService(storage, getOrigin, { loginOnly = false, host: defaultHo
|
|
|
663
755
|
},
|
|
664
756
|
dispose() {
|
|
665
757
|
disposed = true;
|
|
758
|
+
stopMagicPoll();
|
|
666
759
|
clearTimeout(trialTimer);
|
|
667
760
|
clearTimeout(timer);
|
|
668
761
|
clearTimeout(telemetryTimer);
|
|
@@ -1063,8 +1156,16 @@ data: ${JSON.stringify(data)}
|
|
|
1063
1156
|
if (!full)
|
|
1064
1157
|
return json2(res, 403, { error: "forbidden" });
|
|
1065
1158
|
try {
|
|
1159
|
+
const ext = extname(full).toLowerCase();
|
|
1160
|
+
if (ext === ".html") {
|
|
1161
|
+
const osLoc = detectOsLocale();
|
|
1162
|
+
const htmlText = (await readFile2(full, "utf8")).replace(/<html\b([^>]*)>/i, `<html lang="${osLoc === "zh" ? "zh-CN" : "en"}" data-os-locale="${osLoc}">`);
|
|
1163
|
+
res.writeHead(200, { "content-type": TYPES[".html"], "cache-control": "no-store" });
|
|
1164
|
+
res.end(htmlText, "utf8");
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1066
1167
|
const body = await readFile2(full);
|
|
1067
|
-
res.writeHead(200, { "content-type": TYPES[
|
|
1168
|
+
res.writeHead(200, { "content-type": TYPES[ext] ?? "application/octet-stream", "cache-control": sidebar ? "no-store" : "no-cache" });
|
|
1068
1169
|
res.end(body);
|
|
1069
1170
|
} catch {
|
|
1070
1171
|
json2(res, 404, { error: "not found" });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-inkmap",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
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",
|
|
@@ -27,12 +27,20 @@
|
|
|
27
27
|
"outline",
|
|
28
28
|
"flowchart",
|
|
29
29
|
"diagram",
|
|
30
|
+
"xmind",
|
|
31
|
+
"brainstorm",
|
|
30
32
|
"katex",
|
|
31
33
|
"latex",
|
|
32
34
|
"思维导图",
|
|
33
35
|
"脑图",
|
|
34
36
|
"大纲",
|
|
35
37
|
"流程图",
|
|
38
|
+
"架构图",
|
|
39
|
+
"组织结构图",
|
|
40
|
+
"鱼骨图",
|
|
41
|
+
"时间轴",
|
|
42
|
+
"知识库",
|
|
43
|
+
"笔记",
|
|
36
44
|
"双向同步",
|
|
37
45
|
"可视化"
|
|
38
46
|
],
|