perplexity-user-mcp 0.8.42 → 0.8.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/attachments.d.ts +10 -20
  2. package/dist/browser-window.d.ts +11 -0
  3. package/dist/cf-warmup.d.ts +32 -0
  4. package/dist/checks/browser.d.ts +12 -100
  5. package/dist/checks/config.d.ts +25 -91
  6. package/dist/checks/ide.d.ts +31 -89
  7. package/dist/checks/mcp.d.ts +12 -61
  8. package/dist/checks/native-deps.d.ts +46 -131
  9. package/dist/checks/network.d.ts +13 -71
  10. package/dist/checks/probe.d.ts +37 -92
  11. package/dist/checks/probe.mjs +29 -0
  12. package/dist/checks/profiles.d.ts +13 -99
  13. package/dist/checks/profiles.mjs +35 -0
  14. package/dist/checks/runtime.d.ts +24 -89
  15. package/dist/checks/vault.d.ts +13 -142
  16. package/dist/checks/vault.mjs +6 -11
  17. package/dist/{chunk-WDIW33DA.mjs → chunk-3LUO5ATM.mjs} +1 -1
  18. package/dist/{chunk-HNSPNCFH.mjs → chunk-6CAXNBDD.mjs} +1 -1
  19. package/dist/{chunk-B65IJQZJ.mjs → chunk-6E6XTHTG.mjs} +1 -1
  20. package/dist/{chunk-S677V2JU.mjs → chunk-C5I7KXHK.mjs} +32 -2
  21. package/dist/{chunk-RK4EBZJ3.mjs → chunk-D2ZQGKHM.mjs} +11 -8
  22. package/dist/{chunk-TDXETAQT.mjs → chunk-DKEJZ4FI.mjs} +1 -1
  23. package/dist/{chunk-U7QPUNRH.mjs → chunk-DXR6EEZH.mjs} +26 -7
  24. package/dist/{chunk-HJIXH6CL.mjs → chunk-E3GRJXXJ.mjs} +2 -0
  25. package/dist/{chunk-C3HPFFTD.mjs → chunk-GBHPJ7I7.mjs} +136 -48
  26. package/dist/{chunk-D254EFYB.mjs → chunk-GBI2U336.mjs} +1 -1
  27. package/dist/chunk-GPUGKWXH.mjs +17 -0
  28. package/dist/chunk-KVV3JBSN.mjs +32 -0
  29. package/dist/{chunk-XTRJSV72.mjs → chunk-LGH5BSUY.mjs} +1 -1
  30. package/dist/{chunk-KJFX2ZXR.mjs → chunk-NMKNEEZB.mjs} +1 -1
  31. package/dist/{chunk-T6ARJK2P.mjs → chunk-P6YOLJ5T.mjs} +6 -6
  32. package/dist/{chunk-452DK6OS.mjs → chunk-QXYMYCHC.mjs} +2 -2
  33. package/dist/{chunk-Z4OLYVB2.mjs → chunk-SCZQCV7M.mjs} +1 -1
  34. package/dist/{chunk-FKQ3HP4Q.mjs → chunk-TIWHN4IW.mjs} +1 -1
  35. package/dist/{chunk-V4U3JM4R.mjs → chunk-TSLRTZYR.mjs} +1 -1
  36. package/dist/{chunk-DQQISMYN.mjs → chunk-V4LHDNWJ.mjs} +2 -2
  37. package/dist/{chunk-2FPGJKCA.mjs → chunk-YD25G5AD.mjs} +2 -2
  38. package/dist/cli.d.ts +14 -1317
  39. package/dist/cli.mjs +14 -21
  40. package/dist/client.d.ts +39 -24
  41. package/dist/client.mjs +9 -6
  42. package/dist/cloud-sync.d.ts +65 -42
  43. package/dist/cloud-sync.mjs +9 -8
  44. package/dist/config.d.ts +35 -39
  45. package/dist/config.mjs +3 -3
  46. package/dist/cookie-jar.d.ts +77 -0
  47. package/dist/daemon/attach.d.ts +5 -12
  48. package/dist/daemon/attach.mjs +18 -17
  49. package/dist/daemon/audit.d.ts +5 -7
  50. package/dist/daemon/audit.mjs +2 -2
  51. package/dist/daemon/client-http.d.ts +10 -16
  52. package/dist/daemon/client-http.mjs +18 -17
  53. package/dist/daemon/index.d.ts +17 -14
  54. package/dist/daemon/index.mjs +19 -18
  55. package/dist/daemon/install-tunnel.d.ts +8 -34
  56. package/dist/daemon/install-tunnel.mjs +2 -2
  57. package/dist/daemon/launcher.d.ts +24 -29
  58. package/dist/daemon/launcher.mjs +17 -16
  59. package/dist/daemon/local-tokens.d.ts +23 -0
  60. package/dist/daemon/lockfile.d.ts +10 -12
  61. package/dist/daemon/lockfile.mjs +2 -2
  62. package/dist/daemon/oauth-consent-cache.d.ts +86 -0
  63. package/dist/daemon/oauth-provider.d.ts +132 -0
  64. package/dist/daemon/public-pages.d.ts +9 -0
  65. package/dist/daemon/security.d.ts +52 -0
  66. package/dist/daemon/server.d.ts +12 -83
  67. package/dist/daemon/server.mjs +12 -11
  68. package/dist/daemon/token.d.ts +7 -9
  69. package/dist/daemon/token.mjs +2 -2
  70. package/dist/daemon/tunnel-providers/cloudflared-named-setup.d.ts +140 -0
  71. package/dist/daemon/tunnel-providers/cloudflared-named.d.ts +45 -0
  72. package/dist/daemon/tunnel-providers/cloudflared-quick.d.ts +8 -0
  73. package/dist/daemon/tunnel-providers/index.d.ts +16 -327
  74. package/dist/daemon/tunnel-providers/index.mjs +3 -3
  75. package/dist/daemon/tunnel-providers/ngrok-config.d.ts +18 -0
  76. package/dist/daemon/tunnel-providers/ngrok.d.ts +68 -0
  77. package/dist/daemon/tunnel-providers/types.d.ts +56 -0
  78. package/dist/daemon/tunnel.d.ts +5 -7
  79. package/dist/debug-tracer.d.ts +2 -0
  80. package/dist/doctor-report.d.ts +17 -22
  81. package/dist/doctor.d.ts +12 -44
  82. package/dist/doctor.mjs +2 -2
  83. package/dist/export.d.ts +11 -18
  84. package/dist/export.mjs +4 -4
  85. package/dist/format.d.ts +52 -0
  86. package/dist/fs-utils.d.ts +44 -0
  87. package/dist/health-check.d.ts +1 -108
  88. package/dist/health-check.mjs +3 -3
  89. package/dist/history-store.d.ts +29 -65
  90. package/dist/history-store.mjs +2 -2
  91. package/dist/impit-login-runner.d.ts +1 -469
  92. package/dist/impit-login-runner.mjs +4 -4
  93. package/dist/index.d.ts +25 -149
  94. package/dist/index.mjs +23 -20
  95. package/dist/is-main-module.d.ts +9 -0
  96. package/dist/login-runner.d.ts +1 -333
  97. package/dist/login-runner.mjs +18 -38
  98. package/dist/login.d.ts +5 -0
  99. package/dist/logout.d.ts +2 -28
  100. package/dist/logout.mjs +3 -2
  101. package/dist/manual-login-runner.d.ts +1 -150
  102. package/dist/manual-login-runner.mjs +11 -11
  103. package/dist/{native-deps-IE4B55EL.mjs → native-deps-FCSYDL4W.mjs} +4 -4
  104. package/dist/native-deps.d.ts +36 -0
  105. package/dist/package-version.d.ts +1 -0
  106. package/dist/profiles.d.ts +41 -41
  107. package/dist/profiles.mjs +1 -1
  108. package/dist/prompts.d.ts +2 -0
  109. package/dist/redact.d.ts +14 -142
  110. package/dist/refresh.d.ts +11 -16
  111. package/dist/refresh.mjs +4 -4
  112. package/dist/reinit-watcher.d.ts +15 -24
  113. package/dist/reinit-watcher.mjs +2 -2
  114. package/dist/resources.d.ts +5 -0
  115. package/dist/safe-write.d.ts +16 -0
  116. package/dist/session-metadata.d.ts +45 -0
  117. package/dist/tool-config.d.ts +10 -0
  118. package/dist/tools.d.ts +23 -0
  119. package/dist/tty-prompt.d.ts +18 -34
  120. package/dist/vault.d.ts +114 -34
  121. package/dist/vault.mjs +6 -4
  122. package/dist/viewer-detect.d.ts +2 -4
  123. package/dist/viewers.d.ts +13 -18
  124. package/dist/viewers.mjs +1 -1
  125. package/package.json +2 -2
  126. package/dist/cloud-sync.d-Cqt6y18U.d.ts +0 -42
  127. package/dist/doctor.d-CXmUqOXX.d.ts +0 -43
  128. package/dist/history-store.d-BzjBF2m3.d.ts +0 -65
  129. package/dist/native-deps-BNThFHxa.d.ts +0 -175
  130. package/dist/profiles.d-DqS1oZWr.d.ts +0 -41
  131. package/dist/session-metadata-B9aV_n5g.d.ts +0 -148
  132. package/dist/vault.d-BSJWDLhp.d.ts +0 -37
  133. package/dist/viewer-detect.d-HWGnyFAA.d.ts +0 -4
  134. package/dist/viewers.d-BGCK6sw6.d.ts +0 -10
@@ -1,26 +1,17 @@
1
- interface ReinitWatcher {
2
- dispose(): void;
3
- }
4
-
5
- interface WatchReinitOptions {
6
- debounceMs?: number;
7
- }
8
-
9
- declare function watchReinit(
10
- profileName: string,
11
- callback: () => void | Promise<void>,
12
- opts?: WatchReinitOptions
13
- ): ReinitWatcher;
14
-
1
+ export function watchReinit(profileName: any, callback: any, opts?: {}): {
2
+ dispose(): void;
3
+ };
15
4
  /**
16
- * Watch the `<configDir>/active` pointer file for profile switches and call
17
- * `callback` whenever it changes. Pass `configDir = undefined` to use the
18
- * resolved default config dir (PERPLEXITY_CONFIG_DIR or ~/.perplexity-mcp).
5
+ * Watch the `<configDir>/active` pointer file for profile switches.
6
+ *
7
+ * The per-profile `watchReinit` is bound to a single profile's `.reinit` file
8
+ * captured at daemon startup; if the user switches the active profile, that
9
+ * watcher will never see anything (the new profile's `.reinit` is in a
10
+ * different directory). This second watcher fires whenever `setActive()`
11
+ * rewrites the active-pointer atomically, letting the daemon call
12
+ * `client.reinit()` on profile switches AND rebind its per-profile watcher
13
+ * to the newly-active profile so subsequent login events propagate.
19
14
  */
20
- declare function watchActiveProfile(
21
- configDir: string | undefined,
22
- callback: () => void | Promise<void>,
23
- opts?: WatchReinitOptions
24
- ): ReinitWatcher;
25
-
26
- export { type ReinitWatcher, type WatchReinitOptions, watchActiveProfile, watchReinit };
15
+ export function watchActiveProfile(configDirOverride: any, callback: any, opts?: {}): {
16
+ dispose(): void;
17
+ };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  watchActiveProfile,
3
3
  watchReinit
4
- } from "./chunk-WDIW33DA.mjs";
5
- import "./chunk-HJIXH6CL.mjs";
4
+ } from "./chunk-3LUO5ATM.mjs";
5
+ import "./chunk-E3GRJXXJ.mjs";
6
6
  import "./chunk-4UEJOM6W.mjs";
7
7
  export {
8
8
  watchActiveProfile,
@@ -0,0 +1,5 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export interface AccountSnapshotProvider {
3
+ (): Record<string, unknown>;
4
+ }
5
+ export declare function registerResources(server: McpServer, getAccountSnapshot?: AccountSnapshotProvider): void;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Atomically write `data` to `path` via a `${path}.tmp` staging file and
3
+ * `renameSync`. On Windows, Node's renameSync uses MoveFileExW with
4
+ * MOVEFILE_REPLACE_EXISTING, so the destination is replaced atomically with
5
+ * no rmSync window. On any failure, best-effort delete the `.tmp` file and
6
+ * re-throw the original error.
7
+ *
8
+ * The caller is responsible for `mkdirSync` of the parent directory and for
9
+ * any post-write `chmod` / permissions hardening; this helper only owns the
10
+ * write+rename pair.
11
+ *
12
+ * @param {string} path Final destination path.
13
+ * @param {string|Buffer|Uint8Array} data Bytes to write.
14
+ * @param {string|object} [opts] Encoding string or fs.writeFileSync options.
15
+ */
16
+ export function safeAtomicWriteFileSync(path: string, data: string | Buffer | Uint8Array, opts?: string | object): void;
@@ -0,0 +1,45 @@
1
+ export function buildRuntimeEndpoints(origin: any): {
2
+ session: string;
3
+ csrf: string;
4
+ signInEmail: string;
5
+ otpRedirectLink: string;
6
+ ssoDetails: string;
7
+ models: string;
8
+ asi: string;
9
+ rateLimits: string;
10
+ experiments: string;
11
+ userInfo: string;
12
+ };
13
+ export function pageRequest(page: any, url: any, init?: {}): Promise<any>;
14
+ export function pollSession(page: any, sessionUrl: any, { timeoutMs, intervalMs }?: {
15
+ timeoutMs?: number | undefined;
16
+ intervalMs?: number | undefined;
17
+ }): Promise<any>;
18
+ export function deriveAccountFlags({ experiments, userInfo, asi }: {
19
+ experiments: any;
20
+ userInfo: any;
21
+ asi: any;
22
+ }): {
23
+ isPro: any;
24
+ isMax: boolean;
25
+ isEnterprise: boolean;
26
+ canUseComputer: any;
27
+ };
28
+ export function deriveTier(payload: any): "Max" | "Pro" | "Enterprise" | "Authenticated";
29
+ export function collectSessionMetadata(page: any, origin: any, opts?: {}): Promise<{
30
+ sessionData: any;
31
+ models: any;
32
+ asi: any;
33
+ rateLimits: any;
34
+ experiments: any;
35
+ userInfo: any;
36
+ tier: string;
37
+ cache: {
38
+ modelsConfig: any;
39
+ rateLimits: any;
40
+ isPro: any;
41
+ isMax: boolean;
42
+ isEnterprise: boolean;
43
+ canUseComputer: any;
44
+ };
45
+ }>;
@@ -0,0 +1,10 @@
1
+ export type ToolProfile = "read-only" | "full" | "custom";
2
+ interface ToolConfig {
3
+ profile: ToolProfile;
4
+ customEnabled?: string[];
5
+ }
6
+ export declare function loadToolConfig(): ToolConfig;
7
+ export declare function getEnabledTools(config: ToolConfig): Set<string>;
8
+ export declare function saveToolConfig(config: ToolConfig): void;
9
+ export declare function watchToolConfig(onChange: (config: ToolConfig) => void): void;
10
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { PerplexityClient } from "./client.js";
3
+ type GetClient = () => Promise<PerplexityClient>;
4
+ export interface ToolAuditEvent {
5
+ tool: string;
6
+ clientId: string;
7
+ source: "loopback" | "tunnel";
8
+ durationMs: number;
9
+ ok: boolean;
10
+ error?: string;
11
+ }
12
+ export interface ToolProgressEvent {
13
+ tool: string;
14
+ clientId: string;
15
+ source: "loopback" | "tunnel";
16
+ progress: Record<string, unknown>;
17
+ }
18
+ export interface ToolHooks {
19
+ onToolSettled?: (event: ToolAuditEvent) => void;
20
+ onToolProgress?: (event: ToolProgressEvent) => void;
21
+ }
22
+ export declare function registerTools(server: McpServer, getClient: GetClient, enabledTools?: Set<string>, hooks?: ToolHooks): void;
23
+ export {};
@@ -1,16 +1,12 @@
1
- import { createInterface } from 'node:readline';
2
-
3
- function promptSecret({ stdin = process.stdin, stderr = process.stderr, prompt = "> " } = {}) {
4
- return new Promise((resolve) => {
5
- stderr.write(prompt);
6
- const rl = createInterface({ input: stdin, output: stderr, terminal: false });
7
- rl.once("line", (line) => {
8
- rl.close();
9
- resolve(String(line).trim());
10
- });
11
- });
12
- }
13
-
1
+ export function promptSecret({ stdin, stderr, prompt }?: {
2
+ stdin?: (NodeJS.ReadStream & {
3
+ fd: 0;
4
+ }) | undefined;
5
+ stderr?: (NodeJS.WriteStream & {
6
+ fd: 2;
7
+ }) | undefined;
8
+ prompt?: string | undefined;
9
+ }): Promise<any>;
14
10
  /**
15
11
  * Minimal y/N confirmation prompt for destructive-ish CLI subcommands.
16
12
  *
@@ -21,24 +17,12 @@ function promptSecret({ stdin = process.stdin, stderr = process.stderr, prompt =
21
17
  * decline. Returns `true` on confirm, `false` on decline.
22
18
  * - Does NOT exit the process; the caller decides whether to exit 130.
23
19
  */
24
- function promptYesNo({ stdin = process.stdin, stderr = process.stderr, prompt = "Continue? [y/N] " } = {}) {
25
- return new Promise((resolve) => {
26
- stderr.write(prompt);
27
- const rl = createInterface({ input: stdin, output: stderr, terminal: false });
28
- let settled = false;
29
- const finish = (value) => {
30
- if (settled) return;
31
- settled = true;
32
- try { rl.close(); } catch { /* ignore */ }
33
- resolve(value);
34
- };
35
- rl.once("line", (line) => {
36
- const answer = String(line).trim().toLowerCase();
37
- finish(answer === "y" || answer === "yes");
38
- });
39
- // EOF / stream close before a line arrives → decline.
40
- rl.once("close", () => finish(false));
41
- });
42
- }
43
-
44
- export { promptSecret, promptYesNo };
20
+ export function promptYesNo({ stdin, stderr, prompt }?: {
21
+ stdin?: (NodeJS.ReadStream & {
22
+ fd: 0;
23
+ }) | undefined;
24
+ stderr?: (NodeJS.WriteStream & {
25
+ fd: 2;
26
+ }) | undefined;
27
+ prompt?: string | undefined;
28
+ }): Promise<any>;
package/dist/vault.d.ts CHANGED
@@ -1,37 +1,117 @@
1
- declare function encryptBlob(plaintext: Buffer, key: Buffer): Buffer;
2
- declare function decryptBlob(blob: Buffer, key: Buffer): Buffer;
3
- declare function __resetKeyCache(): void;
4
- declare function getMasterKey(): Promise<Buffer>;
5
-
6
- /**
7
- * TEST SEAM drop scrypt cost during tests by overriding the (logN, r, p)
8
- * parameters used at write time. Reads always use the params embedded in the
9
- * blob, regardless of any override.
10
- *
11
- * Cleared by `__resetKeyCache()` so tests do not leak state across files.
12
- * MUST NOT be called from production code paths. The decrypt-time floor
13
- * check (logN >= SCRYPT_LOGN_FLOOR) remains enforced unconditionally.
14
- */
15
- declare function __setKdfParamsForTest(params: { logN: number; r: number; p: number }): void;
16
-
17
- /**
18
- * Sibling of `getMasterKey()` introduced with the v2 vault format. Returns
19
- * the unseal context WITHOUT prematurely deriving the HKDF key for v2
20
- * blobs, key derivation needs the salt embedded in each blob, so it can no
21
- * longer happen up front. Cached just like `_keyCache`; cleared by
1
+ /**
2
+ * TEST SEAM — drop scrypt cost during tests by setting (logN, r, p).
3
+ * MUST NOT be called in production code paths. Cleared by `__resetKeyCache()`.
4
+ *
5
+ * Encrypt path uses the override when set (so tests can write blobs with
6
+ * logN=12 in ~5ms instead of logN=17 in ~300ms). Decrypt path always uses the
7
+ * params embedded in the blob, regardless of any override. The decrypt-time
8
+ * floor check (logN >= SCRYPT_LOGN_FLOOR) is enforced unconditionally.
9
+ *
10
+ * @param {{logN:number, r:number, p:number}} params
11
+ */
12
+ export function __setKdfParamsForTest(params: {
13
+ logN: number;
14
+ r: number;
15
+ p: number;
16
+ }): void;
17
+ /**
18
+ * Encrypt `plaintext` with the supplied 32-byte `key` and emit a v3 blob.
19
+ * The embedded salt is fresh per call and the active KDF params are encoded
20
+ * into the header but the KDF itself is NOT invoked here (caller passes a
21
+ * pre-derived 32-byte key). Public signature is stable; internal format
22
+ * always emits the latest version.
23
+ *
24
+ * @param {Buffer} plaintext
25
+ * @param {Buffer} key 32-byte AES-256-GCM key.
26
+ * @returns {Buffer}
27
+ */
28
+ export function encryptBlob(plaintext: Buffer, key: Buffer): Buffer;
29
+ /**
30
+ * Decrypt a vault blob using the supplied 32-byte key. Accepts v1, v2, and v3
31
+ * formats. The embedded salt + KDF params on v2/v3 are *unused* on this code
32
+ * path — the caller is presumed to already have a directly-usable key (e.g.
33
+ * from the OS keychain). For passphrase-derived keys, the higher-level read
34
+ * path derives the key from the embedded salt+params before calling here.
35
+ *
36
+ * @param {Buffer} blob
37
+ * @param {Buffer} key 32-byte AES-256-GCM key.
38
+ * @returns {Buffer}
39
+ */
40
+ export function decryptBlob(blob: Buffer, key: Buffer): Buffer;
41
+ /**
42
+ * Reset the in-memory caches (key, unseal material, and the test-seam KDF
43
+ * params override). Called on profile-state changes (account switch, login,
44
+ * logout) and from tests to ensure isolation.
45
+ */
46
+ export function __resetKeyCache(): void;
47
+ /**
48
+ * Probe the OS keychain for vault unseal capability. Returns whether keytar is
49
+ * available and whether a master key already exists. Caches the keytar
50
+ * availability check per-process so repeated probes do not trigger multiple
51
+ * macOS Keychain permission prompts (issue #6 bug 3). Respects
52
+ * PERPLEXITY_DISABLE_KEYCHAIN=1.
53
+ *
54
+ * @returns {Promise<{available: boolean, hasKey: boolean}>}
55
+ */
56
+ export function probeKeychainState(): Promise<{
57
+ available: boolean;
58
+ hasKey: boolean;
59
+ }>;
60
+ /**
61
+ * Resolve the unseal context for the vault: either a 32-byte key from the OS
62
+ * keychain, or a passphrase string (env var / TTY / SecretStorage-injected).
63
+ * Cached in `_unsealMaterialCache` to mirror `_keyCache`'s UX trade-off — we
64
+ * do not re-prompt or re-hit the keychain on every vault op. Cleared by
22
65
  * `__resetKeyCache()`.
66
+ *
67
+ * Sibling of `getMasterKey()`. Key derivation is per-blob (the salt is read
68
+ * off each blob and, for v3, fed into scrypt with the embedded params), so
69
+ * unseal material can no longer be pre-derived to a single Buffer at unseal
70
+ * time for passphrase users.
71
+ *
72
+ * @returns {Promise<{kind:"key", key:Buffer}|{kind:"passphrase", passphrase:string}>}
73
+ */
74
+ export function getUnsealMaterial(): Promise<{
75
+ kind: "key";
76
+ key: Buffer;
77
+ } | {
78
+ kind: "passphrase";
79
+ passphrase: string;
80
+ }>;
81
+ /**
82
+ * Resolve EVERY available unseal material in preference order. Used by the
83
+ * vault read path so that when a vault.enc was written with one path
84
+ * (e.g. passphrase, when keychain wasn't yet wired) and the user later gains
85
+ * access to a different path (e.g. keytar starts working after a libsecret
86
+ * install or extension upgrade), reads transparently fall back instead of
87
+ * crashing with "Vault decrypt failed: wrong passphrase or corrupted
88
+ * ciphertext".
89
+ *
90
+ * Skips the TTY prompt — that's interactive and only meaningful as a primary
91
+ * unseal path, never as a silent fallback.
92
+ *
93
+ * @returns {Promise<Array<{kind:"key", key:Buffer}|{kind:"passphrase", passphrase:string}>>}
94
+ */
95
+ export function getAllUnsealMaterials(): Promise<Array<{
96
+ kind: "key";
97
+ key: Buffer;
98
+ } | {
99
+ kind: "passphrase";
100
+ passphrase: string;
101
+ }>>;
102
+ /**
103
+ * Return a 32-byte master key. SIGNATURE PRESERVED for back-compat; internal
104
+ * implementation now defers to `getUnsealMaterial()`. For passphrase users,
105
+ * this derives via HKDF + the legacy static salt — which is suitable as a
106
+ * default-derivation entry point but is NOT what the v2/v3 read/write paths
107
+ * use (they derive against the per-blob random salt, with v3 also stretching
108
+ * via scrypt). Prefer `getUnsealMaterial()` in new code that touches
109
+ * encrypted blobs.
23
110
  */
24
- type UnsealMaterial =
25
- | { kind: "key"; key: Buffer }
26
- | { kind: "passphrase"; passphrase: string };
27
-
28
- declare function getUnsealMaterial(): Promise<UnsealMaterial>;
29
-
30
- declare class Vault {
31
- get(profile: string, key: string): Promise<string | null>;
32
- set(profile: string, key: string, value: string): Promise<void>;
33
- delete(profile: string, key: string): Promise<void>;
34
- deleteAll(profile: string): Promise<void>;
111
+ export function getMasterKey(): Promise<any>;
112
+ export class Vault {
113
+ get(profile: any, key: any): Promise<any>;
114
+ set(profile: any, key: any, value: any): Promise<void>;
115
+ delete(profile: any, key: any): Promise<void>;
116
+ deleteAll(profile: any): Promise<void>;
35
117
  }
36
-
37
- export { type UnsealMaterial, Vault, __resetKeyCache, __setKdfParamsForTest, decryptBlob, encryptBlob, getMasterKey, getUnsealMaterial };
package/dist/vault.mjs CHANGED
@@ -6,10 +6,11 @@ import {
6
6
  encryptBlob,
7
7
  getAllUnsealMaterials,
8
8
  getMasterKey,
9
- getUnsealMaterial
10
- } from "./chunk-S677V2JU.mjs";
9
+ getUnsealMaterial,
10
+ probeKeychainState
11
+ } from "./chunk-C5I7KXHK.mjs";
11
12
  import "./chunk-MTDFKNXX.mjs";
12
- import "./chunk-HJIXH6CL.mjs";
13
+ import "./chunk-E3GRJXXJ.mjs";
13
14
  import "./chunk-4UEJOM6W.mjs";
14
15
  export {
15
16
  Vault,
@@ -19,5 +20,6 @@ export {
19
20
  encryptBlob,
20
21
  getAllUnsealMaterials,
21
22
  getMasterKey,
22
- getUnsealMaterial
23
+ getUnsealMaterial,
24
+ probeKeychainState
23
25
  };
@@ -1,4 +1,2 @@
1
- declare function detectViewer(id: string): Promise<boolean>;
2
- declare function detectAllViewers(): Promise<Record<string, boolean>>;
3
-
4
- export { detectAllViewers, detectViewer };
1
+ export function detectViewer(id: any): Promise<boolean>;
2
+ export function detectAllViewers(): Promise<any>;
package/dist/viewers.d.ts CHANGED
@@ -1,18 +1,13 @@
1
- import { ExternalViewer } from '@perplexity-user-mcp/shared';
2
-
3
- declare function listViewers(overrides?: ExternalViewer[]): ExternalViewer[];
4
- declare function loadViewerConfig(): ExternalViewer[];
5
- declare function saveViewerConfig(viewer: ExternalViewer): ExternalViewer;
6
- declare function substituteViewerTemplate(viewer: ExternalViewer, values: Record<string, string>): string;
7
- declare function ensureObsidianBridge(options: {
8
- mdPath: string;
9
- viewer: ExternalViewer;
10
- profile?: string;
11
- }): string;
12
- declare function buildViewerUrl(options: {
13
- viewer: ExternalViewer;
14
- mdPath: string;
15
- profile?: string;
16
- }): string;
17
-
18
- export { buildViewerUrl, ensureObsidianBridge, listViewers, loadViewerConfig, saveViewerConfig, substituteViewerTemplate };
1
+ export function listViewers(overrides?: any[]): {
2
+ detected: boolean;
3
+ enabled: boolean;
4
+ id: string;
5
+ label: string;
6
+ urlTemplate: string;
7
+ needsVaultBridge: boolean;
8
+ }[];
9
+ export function loadViewerConfig(): any;
10
+ export function saveViewerConfig(viewer: any): any;
11
+ export function substituteViewerTemplate(viewer: any, values: any): any;
12
+ export function ensureObsidianBridge(options: any): string;
13
+ export function buildViewerUrl(options: any): any;
package/dist/viewers.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  getActiveName,
3
3
  getConfigDir,
4
4
  getProfilePaths
5
- } from "./chunk-HJIXH6CL.mjs";
5
+ } from "./chunk-E3GRJXXJ.mjs";
6
6
  import "./chunk-4UEJOM6W.mjs";
7
7
 
8
8
  // src/viewers.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perplexity-user-mcp",
3
- "version": "0.8.42",
3
+ "version": "0.8.47",
4
4
  "mcpName": "io.github.Automations-Project/perplexity-user-mcp",
5
5
  "type": "module",
6
6
  "description": "Perplexity AI MCP server — browser automation for search, reasoning, research, and compute. Not affiliated with Perplexity AI, Inc.",
@@ -126,7 +126,7 @@
126
126
  "CHANGELOG.md"
127
127
  ],
128
128
  "scripts": {
129
- "build": "tsup",
129
+ "build": "tsup --no-dts && tsc --allowJs --emitDeclarationOnly && node scripts/post-build-shebang.mjs",
130
130
  "typecheck": "tsc -p tsconfig.json --noEmit",
131
131
  "test": "cd ../.. && npx vitest run packages/mcp-server/test",
132
132
  "test:coverage": "cd ../.. && npx vitest run --coverage packages/mcp-server/test"
@@ -1,42 +0,0 @@
1
- import { PerplexityClient } from './client.js';
2
- import './config.js';
3
- import 'patchright';
4
-
5
- interface CloudSyncProgressEvent {
6
- phase: "starting" | "syncing" | "done" | "cancelled" | "error";
7
- fetched?: number;
8
- total?: number;
9
- inserted?: number;
10
- updated?: number;
11
- skipped?: number;
12
- error?: string;
13
- }
14
-
15
- interface CloudSyncOptions {
16
- client?: PerplexityClient;
17
- getClient?: () => Promise<PerplexityClient>;
18
- onProgress?: (evt: CloudSyncProgressEvent) => void;
19
- pageSize?: number;
20
- signal?: AbortSignal;
21
- }
22
-
23
- interface CloudSyncResult {
24
- fetched: number;
25
- total: number;
26
- inserted: number;
27
- updated: number;
28
- skipped: number;
29
- cancelled: boolean;
30
- }
31
-
32
- declare function syncCloudHistory(opts?: CloudSyncOptions): Promise<CloudSyncResult>;
33
-
34
- declare function hydrateCloudHistoryEntry(
35
- historyId: string,
36
- opts?: {
37
- client?: PerplexityClient;
38
- getClient?: () => Promise<PerplexityClient>;
39
- },
40
- ): Promise<{ action: "skipped-local" | "skipped-hydrated" | "hydrated"; id?: string }>;
41
-
42
- export { type CloudSyncOptions, type CloudSyncProgressEvent, type CloudSyncResult, hydrateCloudHistoryEntry, syncCloudHistory };
@@ -1,43 +0,0 @@
1
- type DoctorStatus = "pass" | "warn" | "fail" | "skip";
2
-
3
- type DoctorCategory =
4
- | "runtime" | "config" | "profiles" | "vault" | "browser"
5
- | "native-deps" | "network" | "ide" | "mcp" | "probe";
6
-
7
- interface DoctorCheck {
8
- category: DoctorCategory;
9
- name: string;
10
- status: DoctorStatus;
11
- message: string;
12
- detail?: Record<string, unknown>;
13
- hint?: string;
14
- }
15
-
16
- interface DoctorReport {
17
- overall: DoctorStatus;
18
- generatedAt: string;
19
- durationMs: number;
20
- activeProfile: string | null;
21
- probeRan: boolean;
22
- byCategory: Record<DoctorCategory, {
23
- status: DoctorStatus;
24
- checks: DoctorCheck[];
25
- }>;
26
- }
27
-
28
- interface RunAllOpts {
29
- configDir?: string;
30
- profile?: string;
31
- probe?: boolean;
32
- allProfiles?: boolean;
33
- ideStatuses?: Record<string, unknown>;
34
- baseDir?: string;
35
- injected?: Partial<Record<DoctorCategory, DoctorCheck[]>>;
36
- }
37
-
38
- declare const CATEGORIES: ReadonlyArray<DoctorCategory>;
39
- declare function exitCodeFor(report: { overall: DoctorStatus }): number;
40
- declare function runAll(opts?: RunAllOpts): Promise<DoctorReport>;
41
- declare function formatReportMarkdown(report: DoctorReport): string;
42
-
43
- export { CATEGORIES, type DoctorCategory, type DoctorCheck, type DoctorReport, type DoctorStatus, type RunAllOpts, exitCodeFor, formatReportMarkdown, runAll };
@@ -1,65 +0,0 @@
1
- import { HistoryItem, HistoryEntryDetail } from '@perplexity-user-mcp/shared';
2
-
3
- interface HistoryStoreEntryInput extends Partial<HistoryItem> {
4
- tool: string;
5
- query: string;
6
- body?: string;
7
- }
8
-
9
- interface RebuildIndexResult {
10
- scanned: number;
11
- recovered: number;
12
- skipped: number;
13
- items: Array<HistoryItem & { filename: string }>;
14
- }
15
-
16
- declare const HISTORY_LIMIT: number;
17
- declare function getHistoryDir(): string;
18
- declare function getAttachmentsRoot(): string;
19
- declare function getIndexPath(): string;
20
- declare function append(entry: HistoryStoreEntryInput): HistoryItem;
21
- declare function update(id: string, patch?: Partial<HistoryStoreEntryInput> & { body?: string }): HistoryItem | null;
22
- declare function list(options?: {
23
- limit?: number;
24
- status?: "completed" | "pending" | "failed";
25
- tool?: string;
26
- tools?: string[];
27
- filter?: string;
28
- }): HistoryItem[];
29
- declare function get(id: string): HistoryEntryDetail | null;
30
- declare function deleteEntry(id: string): boolean;
31
- declare function pin(id: string, pinned: boolean): HistoryItem | null;
32
- declare function tag(id: string, tags: string[]): HistoryItem | null;
33
- declare function rebuildIndex(): RebuildIndexResult;
34
- declare function getMdPath(id: string): string | null;
35
- declare function getAttachmentsDir(id: string): string | null;
36
- declare function findPendingByThread(threadSlug: string): HistoryItem | null;
37
- declare function countAll(): number;
38
- declare function appendHistory(entry: HistoryStoreEntryInput): HistoryItem;
39
- declare function readHistory(limit?: number): HistoryItem[];
40
-
41
- interface CloudUpsertMeta {
42
- backendUuid: string;
43
- query?: string;
44
- answerPreview?: string;
45
- createdAt?: string;
46
- threadUrl?: string;
47
- threadSlug?: string | null;
48
- readWriteToken?: string | null;
49
- mode?: string | null;
50
- model?: string | null;
51
- sourceCount?: number;
52
- status?: "completed" | "pending" | "failed";
53
- tool?: string;
54
- tier?: HistoryItem["tier"];
55
- language?: string | null;
56
- }
57
-
58
- declare function findByBackendUuid(backendUuid: string | null | undefined): (HistoryItem & { filename: string }) | null;
59
- declare function upsertFromCloud(meta: CloudUpsertMeta): { action: "inserted" | "updated" | "skipped-local"; id: string };
60
- declare function hydrateCloudEntry(
61
- id: string,
62
- payload: { body?: string; sources?: HistoryItem["sources"]; attachments?: HistoryItem["attachments"]; answerPreview?: string; sourceCount?: number },
63
- ): HistoryItem | null;
64
-
65
- export { type CloudUpsertMeta, HISTORY_LIMIT, type HistoryStoreEntryInput, type RebuildIndexResult, append, appendHistory, countAll, deleteEntry, findByBackendUuid, findPendingByThread, get, getAttachmentsDir, getAttachmentsRoot, getHistoryDir, getIndexPath, getMdPath, hydrateCloudEntry, list, pin, readHistory, rebuildIndex, tag, update, upsertFromCloud };