perplexity-user-mcp 0.8.42 → 0.8.44
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/attachments.d.ts +10 -20
- package/dist/browser-window.d.ts +1 -0
- package/dist/cf-warmup.d.ts +32 -0
- package/dist/checks/browser.d.ts +12 -100
- package/dist/checks/config.d.ts +25 -91
- package/dist/checks/ide.d.ts +31 -89
- package/dist/checks/mcp.d.ts +12 -61
- package/dist/checks/native-deps.d.ts +46 -131
- package/dist/checks/network.d.ts +13 -71
- package/dist/checks/probe.d.ts +20 -92
- package/dist/checks/profiles.d.ts +13 -99
- package/dist/checks/profiles.mjs +35 -0
- package/dist/checks/runtime.d.ts +24 -89
- package/dist/checks/vault.d.ts +13 -142
- package/dist/checks/vault.mjs +6 -11
- package/dist/{chunk-T6ARJK2P.mjs → chunk-2B5OQUXR.mjs} +6 -6
- package/dist/{chunk-2FPGJKCA.mjs → chunk-2EE7MNP2.mjs} +2 -2
- package/dist/{chunk-Z4OLYVB2.mjs → chunk-2OVLCZHU.mjs} +1 -1
- package/dist/{chunk-WDIW33DA.mjs → chunk-3LUO5ATM.mjs} +1 -1
- package/dist/{chunk-B65IJQZJ.mjs → chunk-6E6XTHTG.mjs} +1 -1
- package/dist/{chunk-S677V2JU.mjs → chunk-C5I7KXHK.mjs} +32 -2
- package/dist/{chunk-TDXETAQT.mjs → chunk-DKEJZ4FI.mjs} +1 -1
- package/dist/{chunk-U7QPUNRH.mjs → chunk-DXR6EEZH.mjs} +26 -7
- package/dist/{chunk-HJIXH6CL.mjs → chunk-E3GRJXXJ.mjs} +2 -0
- package/dist/{chunk-RK4EBZJ3.mjs → chunk-E75J42W5.mjs} +11 -8
- package/dist/{chunk-452DK6OS.mjs → chunk-FNHYUE22.mjs} +2 -2
- package/dist/{chunk-D254EFYB.mjs → chunk-GBI2U336.mjs} +1 -1
- package/dist/chunk-GPUGKWXH.mjs +17 -0
- package/dist/{chunk-HNSPNCFH.mjs → chunk-KSNV3ZVY.mjs} +1 -1
- package/dist/{chunk-XTRJSV72.mjs → chunk-LGH5BSUY.mjs} +1 -1
- package/dist/{chunk-KJFX2ZXR.mjs → chunk-NMKNEEZB.mjs} +1 -1
- package/dist/{chunk-FKQ3HP4Q.mjs → chunk-TIWHN4IW.mjs} +1 -1
- package/dist/{chunk-V4U3JM4R.mjs → chunk-TSLRTZYR.mjs} +1 -1
- package/dist/{chunk-DQQISMYN.mjs → chunk-V4LHDNWJ.mjs} +2 -2
- package/dist/{chunk-C3HPFFTD.mjs → chunk-WHVJ724K.mjs} +84 -44
- package/dist/cli.d.ts +14 -1317
- package/dist/cli.mjs +14 -21
- package/dist/client.d.ts +27 -24
- package/dist/client.mjs +6 -6
- package/dist/cloud-sync.d.ts +65 -42
- package/dist/cloud-sync.mjs +8 -8
- package/dist/config.d.ts +35 -39
- package/dist/config.mjs +3 -3
- package/dist/cookie-jar.d.ts +77 -0
- package/dist/daemon/attach.d.ts +5 -12
- package/dist/daemon/attach.mjs +17 -17
- package/dist/daemon/audit.d.ts +5 -7
- package/dist/daemon/audit.mjs +2 -2
- package/dist/daemon/client-http.d.ts +10 -16
- package/dist/daemon/client-http.mjs +17 -17
- package/dist/daemon/index.d.ts +17 -14
- package/dist/daemon/index.mjs +18 -18
- package/dist/daemon/install-tunnel.d.ts +8 -34
- package/dist/daemon/install-tunnel.mjs +2 -2
- package/dist/daemon/launcher.d.ts +24 -29
- package/dist/daemon/launcher.mjs +16 -16
- package/dist/daemon/local-tokens.d.ts +23 -0
- package/dist/daemon/lockfile.d.ts +10 -12
- package/dist/daemon/lockfile.mjs +2 -2
- package/dist/daemon/oauth-consent-cache.d.ts +86 -0
- package/dist/daemon/oauth-provider.d.ts +132 -0
- package/dist/daemon/public-pages.d.ts +9 -0
- package/dist/daemon/security.d.ts +52 -0
- package/dist/daemon/server.d.ts +12 -83
- package/dist/daemon/server.mjs +11 -11
- package/dist/daemon/token.d.ts +7 -9
- package/dist/daemon/token.mjs +2 -2
- package/dist/daemon/tunnel-providers/cloudflared-named-setup.d.ts +140 -0
- package/dist/daemon/tunnel-providers/cloudflared-named.d.ts +45 -0
- package/dist/daemon/tunnel-providers/cloudflared-quick.d.ts +8 -0
- package/dist/daemon/tunnel-providers/index.d.ts +16 -327
- package/dist/daemon/tunnel-providers/index.mjs +3 -3
- package/dist/daemon/tunnel-providers/ngrok-config.d.ts +18 -0
- package/dist/daemon/tunnel-providers/ngrok.d.ts +68 -0
- package/dist/daemon/tunnel-providers/types.d.ts +56 -0
- package/dist/daemon/tunnel.d.ts +5 -7
- package/dist/debug-tracer.d.ts +2 -0
- package/dist/doctor-report.d.ts +17 -22
- package/dist/doctor.d.ts +12 -44
- package/dist/doctor.mjs +2 -2
- package/dist/export.d.ts +11 -18
- package/dist/export.mjs +4 -4
- package/dist/format.d.ts +52 -0
- package/dist/fs-utils.d.ts +8 -0
- package/dist/health-check.d.ts +1 -108
- package/dist/health-check.mjs +3 -3
- package/dist/history-store.d.ts +29 -65
- package/dist/history-store.mjs +2 -2
- package/dist/impit-login-runner.d.ts +1 -469
- package/dist/impit-login-runner.mjs +4 -4
- package/dist/index.d.ts +25 -149
- package/dist/index.mjs +22 -20
- package/dist/is-main-module.d.ts +9 -0
- package/dist/login-runner.d.ts +1 -333
- package/dist/login-runner.mjs +13 -13
- package/dist/login.d.ts +5 -0
- package/dist/logout.d.ts +2 -28
- package/dist/logout.mjs +3 -2
- package/dist/manual-login-runner.d.ts +1 -150
- package/dist/manual-login-runner.mjs +11 -11
- package/dist/{native-deps-IE4B55EL.mjs → native-deps-FCSYDL4W.mjs} +4 -4
- package/dist/native-deps.d.ts +36 -0
- package/dist/package-version.d.ts +1 -0
- package/dist/profiles.d.ts +41 -41
- package/dist/profiles.mjs +1 -1
- package/dist/prompts.d.ts +2 -0
- package/dist/redact.d.ts +14 -142
- package/dist/refresh.d.ts +11 -16
- package/dist/refresh.mjs +4 -4
- package/dist/reinit-watcher.d.ts +15 -24
- package/dist/reinit-watcher.mjs +2 -2
- package/dist/resources.d.ts +5 -0
- package/dist/safe-write.d.ts +16 -0
- package/dist/session-metadata.d.ts +45 -0
- package/dist/tool-config.d.ts +10 -0
- package/dist/tools.d.ts +23 -0
- package/dist/tty-prompt.d.ts +18 -34
- package/dist/vault.d.ts +114 -34
- package/dist/vault.mjs +6 -4
- package/dist/viewer-detect.d.ts +2 -4
- package/dist/viewers.d.ts +13 -18
- package/dist/viewers.mjs +1 -1
- package/package.json +2 -2
- package/dist/cloud-sync.d-Cqt6y18U.d.ts +0 -42
- package/dist/doctor.d-CXmUqOXX.d.ts +0 -43
- package/dist/history-store.d-BzjBF2m3.d.ts +0 -65
- package/dist/native-deps-BNThFHxa.d.ts +0 -175
- package/dist/profiles.d-DqS1oZWr.d.ts +0 -41
- package/dist/session-metadata-B9aV_n5g.d.ts +0 -148
- package/dist/vault.d-BSJWDLhp.d.ts +0 -37
- package/dist/viewer-detect.d-HWGnyFAA.d.ts +0 -4
- package/dist/viewers.d-BGCK6sw6.d.ts +0 -10
package/dist/checks/network.d.ts
CHANGED
|
@@ -1,71 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
req.on("error", reject);
|
|
15
|
-
req.end();
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async function run(opts = {}) {
|
|
20
|
-
const results = [];
|
|
21
|
-
const host = opts.host ?? DEFAULT_HOST;
|
|
22
|
-
const dns = opts.dnsLookupOverride ?? lookup;
|
|
23
|
-
const head = opts.httpsHeadOverride ?? ((u) => httpsHead(u));
|
|
24
|
-
|
|
25
|
-
let addr = null;
|
|
26
|
-
try {
|
|
27
|
-
addr = await dns(host);
|
|
28
|
-
results.push({ category: CATEGORY, name: "dns", status: "pass", message: `${host} -> ${addr.address}` });
|
|
29
|
-
} catch (err) {
|
|
30
|
-
results.push({
|
|
31
|
-
category: CATEGORY,
|
|
32
|
-
name: "dns",
|
|
33
|
-
status: "fail",
|
|
34
|
-
message: `DNS lookup failed: ${err.message}`,
|
|
35
|
-
hint: "Check internet connection / proxy / VPN.",
|
|
36
|
-
});
|
|
37
|
-
return results;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let headRes;
|
|
41
|
-
try {
|
|
42
|
-
headRes = await head(`https://${host}${process.env.PERPLEXITY_LOGIN_PATH || "/account"}`);
|
|
43
|
-
results.push({ category: CATEGORY, name: "https", status: "pass", message: `HEAD / status ${headRes.statusCode}` });
|
|
44
|
-
} catch (err) {
|
|
45
|
-
results.push({
|
|
46
|
-
category: CATEGORY,
|
|
47
|
-
name: "https",
|
|
48
|
-
status: "fail",
|
|
49
|
-
message: `HTTPS failed: ${err.message}`,
|
|
50
|
-
hint: "TLS/MITM proxy? Corporate firewall?",
|
|
51
|
-
});
|
|
52
|
-
return results;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const isCf = String(headRes.headers?.server ?? "").toLowerCase().includes("cloudflare") && headRes.statusCode === 503;
|
|
56
|
-
if (isCf) {
|
|
57
|
-
results.push({
|
|
58
|
-
category: CATEGORY,
|
|
59
|
-
name: "cf-challenge",
|
|
60
|
-
status: "warn",
|
|
61
|
-
message: "Cloudflare challenge active — logins may need manual captcha.",
|
|
62
|
-
hint: "Try login --mode manual if auto mode fails.",
|
|
63
|
-
});
|
|
64
|
-
} else {
|
|
65
|
-
results.push({ category: CATEGORY, name: "cf-challenge", status: "pass", message: "no challenge detected" });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return results;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export { run };
|
|
1
|
+
export function run(opts?: {}): Promise<({
|
|
2
|
+
category: string;
|
|
3
|
+
name: string;
|
|
4
|
+
status: string;
|
|
5
|
+
message: string;
|
|
6
|
+
hint?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
category: string;
|
|
9
|
+
name: string;
|
|
10
|
+
status: string;
|
|
11
|
+
message: string;
|
|
12
|
+
hint: string;
|
|
13
|
+
})[]>;
|
package/dist/checks/probe.d.ts
CHANGED
|
@@ -1,93 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// a failed init left both the persistent context AND the freshly-spawned
|
|
21
|
-
// chrome.exe dangling, which is how visible browser windows were piling
|
|
22
|
-
// up across repeated Deep check clicks.
|
|
23
|
-
await client.init();
|
|
24
|
-
const authenticated = client.authenticated;
|
|
25
|
-
const result = await client.search({
|
|
26
|
-
query: "What is the capital of France? Cite at least one web source.",
|
|
27
|
-
modelPreference: "turbo",
|
|
28
|
-
mode: "concise",
|
|
29
|
-
sources: ["web"],
|
|
30
|
-
language: "en-US",
|
|
31
|
-
});
|
|
32
|
-
const elapsedMs = Date.now() - t0;
|
|
33
|
-
return {
|
|
34
|
-
answer: result.answer ?? "",
|
|
35
|
-
sources: result.sources ?? [],
|
|
36
|
-
elapsedMs,
|
|
37
|
-
authenticated,
|
|
38
|
-
threadUrl: result.threadUrl ?? null,
|
|
1
|
+
export function run(opts?: {}): Promise<{
|
|
2
|
+
category: string;
|
|
3
|
+
name: string;
|
|
4
|
+
status: string;
|
|
5
|
+
message: string;
|
|
6
|
+
}[] | {
|
|
7
|
+
category: string;
|
|
8
|
+
name: string;
|
|
9
|
+
status: string;
|
|
10
|
+
message: string;
|
|
11
|
+
hint: string;
|
|
12
|
+
}[] | {
|
|
13
|
+
category: string;
|
|
14
|
+
name: string;
|
|
15
|
+
status: string;
|
|
16
|
+
message: string;
|
|
17
|
+
detail: {
|
|
18
|
+
latencyMs: any;
|
|
19
|
+
sourceCount: any;
|
|
39
20
|
};
|
|
40
|
-
|
|
41
|
-
await client.shutdown().catch(() => {});
|
|
42
|
-
if (prevHeadlessOnly === undefined) delete process.env[HEADLESS_KEY];
|
|
43
|
-
else process.env[HEADLESS_KEY] = prevHeadlessOnly;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function run(opts = {}) {
|
|
48
|
-
if (!opts.probe) {
|
|
49
|
-
return [{ category: CATEGORY, name: "probe-search", status: "skip", message: "skipped (pass --probe to enable)" }];
|
|
50
|
-
}
|
|
51
|
-
const timeoutMs = opts.timeoutMs ?? 10_000;
|
|
52
|
-
const search = opts.searchOverride ?? defaultSearch;
|
|
53
|
-
try {
|
|
54
|
-
const result = await search({ timeoutMs });
|
|
55
|
-
if (!result.sources || result.sources.length === 0) {
|
|
56
|
-
if (result.authenticated && (result.answer?.trim() || result.threadUrl)) {
|
|
57
|
-
return [{
|
|
58
|
-
category: CATEGORY,
|
|
59
|
-
name: "probe-search",
|
|
60
|
-
status: "warn",
|
|
61
|
-
message: `probe search completed without citations (latency ${result.elapsedMs}ms)`,
|
|
62
|
-
hint: "Session appears authenticated, but Perplexity returned no sources for the probe query. Retry once before treating this as an auth failure.",
|
|
63
|
-
}];
|
|
64
|
-
}
|
|
65
|
-
return [{
|
|
66
|
-
category: CATEGORY,
|
|
67
|
-
name: "probe-search",
|
|
68
|
-
status: "fail",
|
|
69
|
-
message: `probe returned no sources (latency ${result.elapsedMs}ms)`,
|
|
70
|
-
hint: result.authenticated
|
|
71
|
-
? "Perplexity returned no citations for the probe query. Retry once; if it persists, inspect the extension logs."
|
|
72
|
-
: "Session may be anonymous — run login, then --probe again.",
|
|
73
|
-
}];
|
|
74
|
-
}
|
|
75
|
-
return [{
|
|
76
|
-
category: CATEGORY,
|
|
77
|
-
name: "probe-search",
|
|
78
|
-
status: "pass",
|
|
79
|
-
message: `live search returned ${result.sources.length} source(s) in ${result.elapsedMs}ms`,
|
|
80
|
-
detail: { latencyMs: result.elapsedMs, sourceCount: result.sources.length },
|
|
81
|
-
}];
|
|
82
|
-
} catch (err) {
|
|
83
|
-
return [{
|
|
84
|
-
category: CATEGORY,
|
|
85
|
-
name: "probe-search",
|
|
86
|
-
status: "fail",
|
|
87
|
-
message: `probe failed: ${err.message}`,
|
|
88
|
-
hint: "Check network / auth — run `doctor` without --probe to see which category regressed.",
|
|
89
|
-
}];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export { run };
|
|
21
|
+
}[]>;
|
|
@@ -1,99 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return results;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const listing = readdirSync(profilesDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
18
|
-
const names = opts.allProfiles
|
|
19
|
-
? listing
|
|
20
|
-
: opts.profile
|
|
21
|
-
? [opts.profile]
|
|
22
|
-
: listing;
|
|
23
|
-
|
|
24
|
-
if (names.length === 0) {
|
|
25
|
-
results.push({
|
|
26
|
-
category: CATEGORY,
|
|
27
|
-
name: "profile-count",
|
|
28
|
-
status: "warn",
|
|
29
|
-
message: "No profiles found. Run `login` to create one.",
|
|
30
|
-
});
|
|
31
|
-
return results;
|
|
32
|
-
}
|
|
33
|
-
results.push({
|
|
34
|
-
category: CATEGORY,
|
|
35
|
-
name: "profile-count",
|
|
36
|
-
status: "pass",
|
|
37
|
-
message: `${names.length} profile(s): ${names.join(", ")}`,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
for (const name of names) {
|
|
41
|
-
const pdir = join(profilesDir, name);
|
|
42
|
-
const meta = join(pdir, "meta.json");
|
|
43
|
-
try {
|
|
44
|
-
JSON.parse(readFileSync(meta, "utf8"));
|
|
45
|
-
results.push({ category: CATEGORY, name: `${name}/meta`, status: "pass", message: "valid" });
|
|
46
|
-
} catch {
|
|
47
|
-
results.push({
|
|
48
|
-
category: CATEGORY,
|
|
49
|
-
name: `${name}/meta`,
|
|
50
|
-
status: "fail",
|
|
51
|
-
message: `${name}/meta.json missing or corrupt`,
|
|
52
|
-
hint: `Delete and re-run login for profile '${name}'.`,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const enc = join(pdir, "vault.enc");
|
|
57
|
-
const plain = join(pdir, "vault.json");
|
|
58
|
-
if (existsSync(enc)) {
|
|
59
|
-
results.push({ category: CATEGORY, name: `${name}/vault`, status: "pass", message: "encrypted" });
|
|
60
|
-
} else if (existsSync(plain)) {
|
|
61
|
-
results.push({
|
|
62
|
-
category: CATEGORY,
|
|
63
|
-
name: `${name}/vault`,
|
|
64
|
-
status: "warn",
|
|
65
|
-
message: "plaintext opt-out (security.encryptCookies=false)",
|
|
66
|
-
hint: "Consider re-running login without --plain-cookies for encrypted storage.",
|
|
67
|
-
});
|
|
68
|
-
} else {
|
|
69
|
-
results.push({
|
|
70
|
-
category: CATEGORY,
|
|
71
|
-
name: `${name}/vault`,
|
|
72
|
-
status: "warn",
|
|
73
|
-
message: "no vault file — profile never logged in",
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const cache = join(pdir, "models-cache.json");
|
|
78
|
-
if (!existsSync(cache)) {
|
|
79
|
-
results.push({ category: CATEGORY, name: `${name}/models-cache`, status: "skip", message: "no cache yet" });
|
|
80
|
-
} else {
|
|
81
|
-
const ageDays = (Date.now() - statSync(cache).mtime.getTime()) / (24 * 3600 * 1000);
|
|
82
|
-
if (ageDays > STALE_CACHE_DAYS) {
|
|
83
|
-
results.push({
|
|
84
|
-
category: CATEGORY,
|
|
85
|
-
name: `${name}/models-cache`,
|
|
86
|
-
status: "warn",
|
|
87
|
-
message: `models cache is ${Math.round(ageDays)} days old`,
|
|
88
|
-
hint: "Open the dashboard and click 'Fetch live' to refresh.",
|
|
89
|
-
});
|
|
90
|
-
} else {
|
|
91
|
-
results.push({ category: CATEGORY, name: `${name}/models-cache`, status: "pass", message: `${Math.round(ageDays)}d old` });
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return results;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export { run };
|
|
1
|
+
export function run(opts?: {}): Promise<({
|
|
2
|
+
category: string;
|
|
3
|
+
name: string;
|
|
4
|
+
status: string;
|
|
5
|
+
message: string;
|
|
6
|
+
hint?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
category: string;
|
|
9
|
+
name: string;
|
|
10
|
+
status: string;
|
|
11
|
+
message: string;
|
|
12
|
+
hint: string;
|
|
13
|
+
})[]>;
|
package/dist/checks/profiles.mjs
CHANGED
|
@@ -82,6 +82,41 @@ async function run(opts = {}) {
|
|
|
82
82
|
results.push({ category: CATEGORY, name: `${name}/models-cache`, status: "pass", message: `${Math.round(ageDays)}d old` });
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
const daemonStatusPath = join(pdir, "daemon-status.json");
|
|
86
|
+
if (!existsSync(daemonStatusPath)) {
|
|
87
|
+
results.push({ category: CATEGORY, name: `${name}/daemon-status`, status: "skip", message: "no daemon status file (stdio-only or not yet started)" });
|
|
88
|
+
} else {
|
|
89
|
+
try {
|
|
90
|
+
const ds = JSON.parse(readFileSync(daemonStatusPath, "utf8"));
|
|
91
|
+
if (!ds.authenticated) {
|
|
92
|
+
results.push({
|
|
93
|
+
category: CATEGORY,
|
|
94
|
+
name: `${name}/daemon-status`,
|
|
95
|
+
status: "warn",
|
|
96
|
+
message: `daemon last init: ${ds.lastInit} \u2014 authenticated: false (tier: ${ds.tier})${ds.error ? `, error: ${ds.error}` : ""}`,
|
|
97
|
+
hint: "Open the extension dashboard and click 'Refresh state' to trigger a daemon reinit."
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
results.push({
|
|
101
|
+
category: CATEGORY,
|
|
102
|
+
name: `${name}/daemon-status`,
|
|
103
|
+
status: "pass",
|
|
104
|
+
message: `authenticated as ${ds.tier}, last init: ${ds.lastInit} (${ds.initDurationMs}ms)`
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
} catch {
|
|
108
|
+
results.push({ category: CATEGORY, name: `${name}/daemon-status`, status: "warn", message: "daemon-status.json is corrupt or unreadable" });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const loginBrowserDataPath = join(pdir, "login-browser-data");
|
|
112
|
+
if (existsSync(loginBrowserDataPath)) {
|
|
113
|
+
results.push({
|
|
114
|
+
category: CATEGORY,
|
|
115
|
+
name: `${name}/login-browser-data`,
|
|
116
|
+
status: "info",
|
|
117
|
+
message: "login-browser-data directory present (leftover from a past login session; safe to ignore)"
|
|
118
|
+
});
|
|
119
|
+
}
|
|
85
120
|
}
|
|
86
121
|
return results;
|
|
87
122
|
}
|
package/dist/checks/runtime.d.ts
CHANGED
|
@@ -1,89 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (baseDir) {
|
|
26
|
-
candidates.push(join(baseDir, "mcp", "package.json"));
|
|
27
|
-
candidates.push(join(baseDir, "package.json"));
|
|
28
|
-
}
|
|
29
|
-
const metaUrl = import.meta.url ?? null;
|
|
30
|
-
if (metaUrl) {
|
|
31
|
-
try {
|
|
32
|
-
candidates.push(fileURLToPath(new URL("../../package.json", metaUrl)));
|
|
33
|
-
} catch {}
|
|
34
|
-
try {
|
|
35
|
-
candidates.push(fileURLToPath(new URL("../package.json", metaUrl)));
|
|
36
|
-
} catch {}
|
|
37
|
-
}
|
|
38
|
-
return candidates;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async function run(opts = {}) {
|
|
42
|
-
const results = [];
|
|
43
|
-
const nodeVersion = opts.nodeVersionOverride ?? process.version;
|
|
44
|
-
const major = parseMajor(nodeVersion);
|
|
45
|
-
results.push({
|
|
46
|
-
category: CATEGORY,
|
|
47
|
-
name: "node-version",
|
|
48
|
-
status: major >= 20 ? "pass" : "fail",
|
|
49
|
-
message: `Node.js ${nodeVersion}`,
|
|
50
|
-
hint: major >= 20 ? undefined : "Upgrade to Node 20 or later (https://nodejs.org).",
|
|
51
|
-
});
|
|
52
|
-
results.push({ category: CATEGORY, name: "platform", status: "pass", message: `${process.platform} ${process.arch}` });
|
|
53
|
-
results.push({ category: CATEGORY, name: "arch", status: "pass", message: process.arch });
|
|
54
|
-
|
|
55
|
-
let version = "0.0.0";
|
|
56
|
-
for (const pkgPath of getPackageJsonCandidates(opts.baseDir)) {
|
|
57
|
-
try {
|
|
58
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
59
|
-
if (pkg.name === "perplexity-user-mcp" && pkg.version) {
|
|
60
|
-
version = pkg.version;
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
} catch {}
|
|
64
|
-
}
|
|
65
|
-
results.push({
|
|
66
|
-
category: CATEGORY,
|
|
67
|
-
name: "package-version",
|
|
68
|
-
status: "pass",
|
|
69
|
-
message: `perplexity-user-mcp ${version}`,
|
|
70
|
-
detail: { version },
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const gitDir = opts.gitDirOverride ?? join(process.cwd(), ".git");
|
|
74
|
-
const resolver = opts.gitShaResolverOverride ?? defaultGitShaResolver;
|
|
75
|
-
if (!existsSync(gitDir)) {
|
|
76
|
-
results.push({ category: CATEGORY, name: "git-sha", status: "skip", message: "not a git checkout" });
|
|
77
|
-
} else {
|
|
78
|
-
const sha = await resolver(process.cwd());
|
|
79
|
-
if (sha) {
|
|
80
|
-
results.push({ category: CATEGORY, name: "git-sha", status: "pass", message: sha });
|
|
81
|
-
} else {
|
|
82
|
-
results.push({ category: CATEGORY, name: "git-sha", status: "skip", message: "git not on PATH" });
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return results;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export { run };
|
|
1
|
+
export function run(opts?: {}): Promise<({
|
|
2
|
+
category: string;
|
|
3
|
+
name: string;
|
|
4
|
+
status: string;
|
|
5
|
+
message: string;
|
|
6
|
+
hint: string | undefined;
|
|
7
|
+
detail?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
category: string;
|
|
10
|
+
name: string;
|
|
11
|
+
status: string;
|
|
12
|
+
message: string;
|
|
13
|
+
detail: {
|
|
14
|
+
version: string;
|
|
15
|
+
};
|
|
16
|
+
hint?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
category: string;
|
|
19
|
+
name: string;
|
|
20
|
+
status: string;
|
|
21
|
+
message: any;
|
|
22
|
+
hint?: undefined;
|
|
23
|
+
detail?: undefined;
|
|
24
|
+
})[]>;
|
package/dist/checks/vault.d.ts
CHANGED
|
@@ -1,142 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function keychainExpected() {
|
|
18
|
-
return process.platform === "win32" || process.platform === "darwin" ||
|
|
19
|
-
(process.platform === "linux" && !process.env.CI);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async function run(opts = {}) {
|
|
23
|
-
const results = [];
|
|
24
|
-
const dir = opts.configDir;
|
|
25
|
-
const profile = opts.profile ?? "default";
|
|
26
|
-
const enc = join(dir, "profiles", profile, "vault.enc");
|
|
27
|
-
const plain = join(dir, "profiles", profile, "vault.json");
|
|
28
|
-
const envPass = process.env.PERPLEXITY_VAULT_PASSPHRASE;
|
|
29
|
-
const kc = await tryKeychain();
|
|
30
|
-
|
|
31
|
-
// Encryption mode (separate from unseal path so plaintext opt-out is always a warn, not a skip).
|
|
32
|
-
if (existsSync(plain)) {
|
|
33
|
-
results.push({
|
|
34
|
-
category: CATEGORY,
|
|
35
|
-
name: "encryption",
|
|
36
|
-
status: "warn",
|
|
37
|
-
message: "plaintext vault.json (security.encryptCookies=false)",
|
|
38
|
-
hint: "Re-run login without --plain-cookies to enable AES-256-GCM at rest.",
|
|
39
|
-
});
|
|
40
|
-
} else if (existsSync(enc)) {
|
|
41
|
-
results.push({ category: CATEGORY, name: "encryption", status: "pass", message: "AES-256-GCM (vault.enc)" });
|
|
42
|
-
} else {
|
|
43
|
-
results.push({ category: CATEGORY, name: "encryption", status: "skip", message: "no vault yet" });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Unseal path resolution, matching vault.js getMasterKey() priority.
|
|
47
|
-
if (kc.hasKey) {
|
|
48
|
-
results.push({ category: CATEGORY, name: "unseal-path", status: "pass", message: "OS keychain holds master key" });
|
|
49
|
-
if (envPass) {
|
|
50
|
-
results.push({
|
|
51
|
-
category: CATEGORY,
|
|
52
|
-
name: "keychain-preferred",
|
|
53
|
-
status: "warn",
|
|
54
|
-
message: "PERPLEXITY_VAULT_PASSPHRASE is also set — keychain wins, but consider removing the env var",
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
} else if (envPass) {
|
|
58
|
-
const hasKc = kc.available;
|
|
59
|
-
results.push({
|
|
60
|
-
category: CATEGORY,
|
|
61
|
-
name: "unseal-path",
|
|
62
|
-
status: "pass",
|
|
63
|
-
message: `env var ${hasKc ? "(keychain available but empty)" : "(keychain unavailable — expected on headless Linux)"}`,
|
|
64
|
-
});
|
|
65
|
-
if (hasKc) {
|
|
66
|
-
results.push({
|
|
67
|
-
category: CATEGORY,
|
|
68
|
-
name: "keychain-preferred",
|
|
69
|
-
status: "warn",
|
|
70
|
-
message: "keychain is available — moving the master key there would remove the passphrase from IDE config files",
|
|
71
|
-
hint: "Run `npx perplexity-user-mcp login` once with the env var unset; the key will be written to keychain.",
|
|
72
|
-
});
|
|
73
|
-
} else {
|
|
74
|
-
results.push({ category: CATEGORY, name: "keychain-preferred", status: "skip", message: "keychain not applicable" });
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
// No keychain, no env var.
|
|
78
|
-
if (!existsSync(enc) && !existsSync(plain)) {
|
|
79
|
-
results.push({ category: CATEGORY, name: "unseal-path", status: "skip", message: "no vault to unseal yet" });
|
|
80
|
-
} else if (existsSync(plain)) {
|
|
81
|
-
results.push({ category: CATEGORY, name: "unseal-path", status: "pass", message: "plaintext — no key required" });
|
|
82
|
-
} else {
|
|
83
|
-
const ttyLikely = process.stdin?.isTTY === true;
|
|
84
|
-
results.push({
|
|
85
|
-
category: CATEGORY,
|
|
86
|
-
name: "unseal-path",
|
|
87
|
-
status: ttyLikely ? "warn" : "fail",
|
|
88
|
-
message: ttyLikely
|
|
89
|
-
? "no keychain, no env var — TTY prompt will be required on next use"
|
|
90
|
-
: "vault locked: no keychain, no env var, no TTY",
|
|
91
|
-
hint: keychainExpected()
|
|
92
|
-
? "Install libsecret+gnome-keyring (Linux), or set PERPLEXITY_VAULT_PASSPHRASE."
|
|
93
|
-
: "Set PERPLEXITY_VAULT_PASSPHRASE in your MCP config env.",
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Active-decrypt verification — only when an encrypted vault.enc actually
|
|
99
|
-
// exists. This catches the "user has both keychain + passphrase set, but
|
|
100
|
-
// vault.enc was written with one and the read path now prefers the other"
|
|
101
|
-
// failure mode that surfaces as "Vault decrypt failed: wrong passphrase
|
|
102
|
-
// or corrupted ciphertext" mid-login. A status check that just reports
|
|
103
|
-
// "OS keychain holds master key" is misleading if the key can't actually
|
|
104
|
-
// open the on-disk blob.
|
|
105
|
-
if (existsSync(enc) && (kc.hasKey || envPass)) {
|
|
106
|
-
try {
|
|
107
|
-
const { Vault, __resetKeyCache } = await import('../vault.d-BSJWDLhp.d.ts');
|
|
108
|
-
// Use a fresh resolution context so the doctor's verification doesn't
|
|
109
|
-
// pollute the cached unseal material for the rest of the process.
|
|
110
|
-
__resetKeyCache();
|
|
111
|
-
// Vault.get returns null for absent keys without throwing; only a
|
|
112
|
-
// genuine decrypt failure throws.
|
|
113
|
-
await new Vault().get(profile, "cookies");
|
|
114
|
-
results.push({
|
|
115
|
-
category: CATEGORY,
|
|
116
|
-
name: "unseal-verify",
|
|
117
|
-
status: "pass",
|
|
118
|
-
message: "vault.enc decrypts cleanly with the active unseal material",
|
|
119
|
-
});
|
|
120
|
-
} catch (err) {
|
|
121
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
122
|
-
const isDecryptFailure = /wrong passphrase or corrupted ciphertext|Vault decrypt failed/.test(msg);
|
|
123
|
-
results.push({
|
|
124
|
-
category: CATEGORY,
|
|
125
|
-
name: "unseal-verify",
|
|
126
|
-
status: "fail",
|
|
127
|
-
message: isDecryptFailure
|
|
128
|
-
? "vault.enc cannot be decrypted with any available unseal material"
|
|
129
|
-
: `vault.enc unreadable: ${msg}`,
|
|
130
|
-
hint: isDecryptFailure
|
|
131
|
-
? (kc.hasKey && envPass
|
|
132
|
-
? "Both keychain and PERPLEXITY_VAULT_PASSPHRASE are set, but neither matches the blob. The blob was likely written under a since-rotated passphrase or a different keychain key. Run 'perplexity-user-mcp logout --purge' on this profile and log in again to write a fresh vault."
|
|
133
|
-
: "The unseal material has changed since this blob was written. Restore the original passphrase, or run 'perplexity-user-mcp logout --purge' on this profile and log in again.")
|
|
134
|
-
: "Inspect the file at the path under 'profiles' check; consider restoring from backup or purging.",
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return results;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export { run };
|
|
1
|
+
export function run(opts?: {}): Promise<({
|
|
2
|
+
category: string;
|
|
3
|
+
name: string;
|
|
4
|
+
status: string;
|
|
5
|
+
message: string;
|
|
6
|
+
hint: string;
|
|
7
|
+
} | {
|
|
8
|
+
category: string;
|
|
9
|
+
name: string;
|
|
10
|
+
status: string;
|
|
11
|
+
message: string;
|
|
12
|
+
hint?: undefined;
|
|
13
|
+
})[]>;
|
package/dist/checks/vault.mjs
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
probeKeychainState
|
|
3
|
+
} from "../chunk-C5I7KXHK.mjs";
|
|
4
|
+
import "../chunk-MTDFKNXX.mjs";
|
|
5
|
+
import "../chunk-E3GRJXXJ.mjs";
|
|
1
6
|
import "../chunk-4UEJOM6W.mjs";
|
|
2
7
|
|
|
3
8
|
// src/checks/vault.js
|
|
4
9
|
import { existsSync } from "fs";
|
|
5
10
|
import { join } from "path";
|
|
6
11
|
var CATEGORY = "vault";
|
|
7
|
-
async function tryKeychain() {
|
|
8
|
-
try {
|
|
9
|
-
const mod = await import("keytar");
|
|
10
|
-
const keytar = mod.default ?? mod;
|
|
11
|
-
const hex = await keytar.getPassword("perplexity-user-mcp", "vault-master-key");
|
|
12
|
-
return { available: true, hasKey: !!hex };
|
|
13
|
-
} catch {
|
|
14
|
-
return { available: false, hasKey: false };
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
12
|
function keychainExpected() {
|
|
18
13
|
return process.platform === "win32" || process.platform === "darwin" || process.platform === "linux" && !process.env.CI;
|
|
19
14
|
}
|
|
@@ -24,7 +19,7 @@ async function run(opts = {}) {
|
|
|
24
19
|
const enc = join(dir, "profiles", profile, "vault.enc");
|
|
25
20
|
const plain = join(dir, "profiles", profile, "vault.json");
|
|
26
21
|
const envPass = process.env.PERPLEXITY_VAULT_PASSPHRASE;
|
|
27
|
-
const kc = await
|
|
22
|
+
const kc = await probeKeychainState();
|
|
28
23
|
if (existsSync(plain)) {
|
|
29
24
|
results.push({
|
|
30
25
|
category: CATEGORY,
|