perplexity-user-mcp 0.8.39 → 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.
Files changed (133) hide show
  1. package/README.md +5 -0
  2. package/dist/attachments.d.ts +10 -20
  3. package/dist/browser-window.d.ts +1 -0
  4. package/dist/cf-warmup.d.ts +32 -0
  5. package/dist/checks/browser.d.ts +12 -100
  6. package/dist/checks/config.d.ts +25 -91
  7. package/dist/checks/ide.d.ts +31 -89
  8. package/dist/checks/mcp.d.ts +12 -61
  9. package/dist/checks/native-deps.d.ts +46 -131
  10. package/dist/checks/network.d.ts +13 -71
  11. package/dist/checks/probe.d.ts +20 -92
  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-T6ARJK2P.mjs → chunk-2B5OQUXR.mjs} +6 -6
  18. package/dist/{chunk-2FPGJKCA.mjs → chunk-2EE7MNP2.mjs} +2 -2
  19. package/dist/{chunk-NJX4RBO6.mjs → chunk-2OVLCZHU.mjs} +28 -3
  20. package/dist/{chunk-WDIW33DA.mjs → chunk-3LUO5ATM.mjs} +1 -1
  21. package/dist/{chunk-B65IJQZJ.mjs → chunk-6E6XTHTG.mjs} +1 -1
  22. package/dist/{chunk-S677V2JU.mjs → chunk-C5I7KXHK.mjs} +32 -2
  23. package/dist/{chunk-TDXETAQT.mjs → chunk-DKEJZ4FI.mjs} +1 -1
  24. package/dist/{chunk-U7QPUNRH.mjs → chunk-DXR6EEZH.mjs} +26 -7
  25. package/dist/{chunk-HJIXH6CL.mjs → chunk-E3GRJXXJ.mjs} +2 -0
  26. package/dist/{chunk-RK4EBZJ3.mjs → chunk-E75J42W5.mjs} +11 -8
  27. package/dist/{chunk-452DK6OS.mjs → chunk-FNHYUE22.mjs} +2 -2
  28. package/dist/{chunk-D254EFYB.mjs → chunk-GBI2U336.mjs} +1 -1
  29. package/dist/chunk-GPUGKWXH.mjs +17 -0
  30. package/dist/{chunk-HNSPNCFH.mjs → chunk-KSNV3ZVY.mjs} +1 -1
  31. package/dist/{chunk-XTRJSV72.mjs → chunk-LGH5BSUY.mjs} +1 -1
  32. package/dist/{chunk-KJFX2ZXR.mjs → chunk-NMKNEEZB.mjs} +1 -1
  33. package/dist/{chunk-FKQ3HP4Q.mjs → chunk-TIWHN4IW.mjs} +1 -1
  34. package/dist/{chunk-V4U3JM4R.mjs → chunk-TSLRTZYR.mjs} +1 -1
  35. package/dist/{chunk-DQQISMYN.mjs → chunk-V4LHDNWJ.mjs} +2 -2
  36. package/dist/{chunk-C3HPFFTD.mjs → chunk-WHVJ724K.mjs} +84 -44
  37. package/dist/cli.d.ts +14 -1298
  38. package/dist/cli.mjs +35 -27
  39. package/dist/client.d.ts +27 -24
  40. package/dist/client.mjs +6 -6
  41. package/dist/cloud-sync.d.ts +65 -42
  42. package/dist/cloud-sync.mjs +8 -8
  43. package/dist/config.d.ts +35 -39
  44. package/dist/config.mjs +3 -3
  45. package/dist/cookie-jar.d.ts +77 -0
  46. package/dist/daemon/attach.d.ts +10 -11
  47. package/dist/daemon/attach.mjs +19 -17
  48. package/dist/daemon/audit.d.ts +5 -7
  49. package/dist/daemon/audit.mjs +2 -2
  50. package/dist/daemon/client-http.d.ts +10 -16
  51. package/dist/daemon/client-http.mjs +17 -17
  52. package/dist/daemon/index.d.ts +17 -14
  53. package/dist/daemon/index.mjs +18 -18
  54. package/dist/daemon/install-tunnel.d.ts +8 -34
  55. package/dist/daemon/install-tunnel.mjs +2 -2
  56. package/dist/daemon/launcher.d.ts +24 -29
  57. package/dist/daemon/launcher.mjs +16 -16
  58. package/dist/daemon/local-tokens.d.ts +23 -0
  59. package/dist/daemon/lockfile.d.ts +10 -12
  60. package/dist/daemon/lockfile.mjs +2 -2
  61. package/dist/daemon/oauth-consent-cache.d.ts +86 -0
  62. package/dist/daemon/oauth-provider.d.ts +132 -0
  63. package/dist/daemon/public-pages.d.ts +9 -0
  64. package/dist/daemon/security.d.ts +52 -0
  65. package/dist/daemon/server.d.ts +12 -83
  66. package/dist/daemon/server.mjs +11 -11
  67. package/dist/daemon/token.d.ts +7 -9
  68. package/dist/daemon/token.mjs +2 -2
  69. package/dist/daemon/tunnel-providers/cloudflared-named-setup.d.ts +140 -0
  70. package/dist/daemon/tunnel-providers/cloudflared-named.d.ts +45 -0
  71. package/dist/daemon/tunnel-providers/cloudflared-quick.d.ts +8 -0
  72. package/dist/daemon/tunnel-providers/index.d.ts +16 -327
  73. package/dist/daemon/tunnel-providers/index.mjs +3 -3
  74. package/dist/daemon/tunnel-providers/ngrok-config.d.ts +18 -0
  75. package/dist/daemon/tunnel-providers/ngrok.d.ts +68 -0
  76. package/dist/daemon/tunnel-providers/types.d.ts +56 -0
  77. package/dist/daemon/tunnel.d.ts +5 -7
  78. package/dist/debug-tracer.d.ts +2 -0
  79. package/dist/doctor-report.d.ts +17 -22
  80. package/dist/doctor.d.ts +12 -44
  81. package/dist/doctor.mjs +2 -2
  82. package/dist/export.d.ts +11 -18
  83. package/dist/export.mjs +4 -4
  84. package/dist/format.d.ts +52 -0
  85. package/dist/fs-utils.d.ts +8 -0
  86. package/dist/health-check.d.ts +1 -108
  87. package/dist/health-check.mjs +3 -3
  88. package/dist/history-store.d.ts +29 -65
  89. package/dist/history-store.mjs +2 -2
  90. package/dist/impit-login-runner.d.ts +1 -469
  91. package/dist/impit-login-runner.mjs +4 -4
  92. package/dist/index.d.ts +25 -149
  93. package/dist/index.mjs +22 -20
  94. package/dist/is-main-module.d.ts +9 -0
  95. package/dist/login-runner.d.ts +1 -333
  96. package/dist/login-runner.mjs +13 -13
  97. package/dist/login.d.ts +5 -0
  98. package/dist/logout.d.ts +2 -28
  99. package/dist/logout.mjs +3 -2
  100. package/dist/manual-login-runner.d.ts +1 -150
  101. package/dist/manual-login-runner.mjs +11 -11
  102. package/dist/{native-deps-IE4B55EL.mjs → native-deps-FCSYDL4W.mjs} +4 -4
  103. package/dist/native-deps.d.ts +36 -0
  104. package/dist/package-version.d.ts +1 -0
  105. package/dist/profiles.d.ts +41 -41
  106. package/dist/profiles.mjs +1 -1
  107. package/dist/prompts.d.ts +2 -0
  108. package/dist/redact.d.ts +14 -142
  109. package/dist/refresh.d.ts +11 -16
  110. package/dist/refresh.mjs +4 -4
  111. package/dist/reinit-watcher.d.ts +15 -24
  112. package/dist/reinit-watcher.mjs +2 -2
  113. package/dist/resources.d.ts +5 -0
  114. package/dist/safe-write.d.ts +16 -0
  115. package/dist/session-metadata.d.ts +45 -0
  116. package/dist/tool-config.d.ts +10 -0
  117. package/dist/tools.d.ts +23 -0
  118. package/dist/tty-prompt.d.ts +18 -34
  119. package/dist/vault.d.ts +114 -34
  120. package/dist/vault.mjs +6 -4
  121. package/dist/viewer-detect.d.ts +2 -4
  122. package/dist/viewers.d.ts +13 -18
  123. package/dist/viewers.mjs +1 -1
  124. package/package.json +3 -3
  125. package/dist/cloud-sync.d-Cqt6y18U.d.ts +0 -42
  126. package/dist/doctor.d-CXmUqOXX.d.ts +0 -43
  127. package/dist/history-store.d-BzjBF2m3.d.ts +0 -65
  128. package/dist/native-deps-BNThFHxa.d.ts +0 -175
  129. package/dist/profiles.d-DqS1oZWr.d.ts +0 -41
  130. package/dist/session-metadata-B9aV_n5g.d.ts +0 -148
  131. package/dist/vault.d-BSJWDLhp.d.ts +0 -37
  132. package/dist/viewer-detect.d-HWGnyFAA.d.ts +0 -4
  133. package/dist/viewers.d-BGCK6sw6.d.ts +0 -10
@@ -1,330 +1,19 @@
1
- import { spawn } from 'node:child_process';
2
- import { TunnelState, StartedTunnel } from '../tunnel.js';
3
-
4
- type TunnelProviderId = "cf-quick" | "ngrok" | "cf-named";
5
- interface TunnelProviderStartOptions {
6
- port: number;
7
- configDir: string;
8
- onStateChange: (state: TunnelState) => void;
9
- }
10
- interface SetupCheck {
11
- ready: boolean;
12
- /** User-facing reason the provider isn't ready (e.g. "ngrok authtoken not set"). */
13
- reason?: string;
14
- /** Optional action hint the dashboard can surface.
15
- *
16
- * Kinds:
17
- * - "open-url": UI opens `url` in the default browser.
18
- * - "input-authtoken": UI surfaces a text input and posts
19
- * `daemon:set-ngrok-authtoken` back.
20
- * - "install-binary": UI runs the known install-binary flow
21
- * (`daemon:install-cloudflared` for cf-named / cf-quick today).
22
- * - "run-command": UI dispatches the webview message type identified
23
- * by `command` (e.g. `"cf-named-login"` → `daemon:cf-named-login`).
24
- * Preferred over "open-url" when the action has no URL and needs
25
- * a modal-confirmed host-side handler.
26
- */
27
- action?: {
28
- label: string;
29
- kind: "open-url" | "input-authtoken" | "install-binary" | "run-command";
30
- url?: string;
31
- /** Opaque identifier for the command to run (used with kind: "run-command"). */
32
- command?: string;
33
- };
34
- }
35
- interface TunnelProvider {
36
- readonly id: TunnelProviderId;
37
- readonly displayName: string;
38
- /** Brief description surfaced next to the provider in the dashboard picker. */
39
- readonly description: string;
40
- /**
41
- * Returns whether the provider has everything it needs to start a tunnel.
42
- * Called before start(); the dashboard also calls this to render a setup widget.
43
- */
44
- isSetupComplete(configDir: string): Promise<SetupCheck>;
45
- /**
46
- * Start the tunnel. Must resolve once the public URL is known OR reject if
47
- * setup is missing / start fails. onStateChange fires on every state
48
- * transition including "starting" and "enabled".
49
- */
50
- start(options: TunnelProviderStartOptions): Promise<StartedTunnel>;
51
- }
52
- interface TunnelProviderStatus {
53
- id: TunnelProviderId;
54
- displayName: string;
55
- description: string;
56
- setup: SetupCheck;
57
- isActive: boolean;
58
- }
59
-
60
- /**
61
- * Cloudflared named-tunnel provider.
62
- *
63
- * Runs a persistent Cloudflare tunnel that routes a user-owned hostname
64
- * (e.g. https://mcp.example.com) to the local daemon HTTP port. Unlike
65
- * cloudflared-quick, the URL is stable across restarts.
66
- *
67
- * Setup (one-time, handled by 8.4.3 UI + 8.4.4 CLI) produces:
68
- * - ~/.cloudflared/cert.pem (origin cert from `cloudflared login`)
69
- * - ~/.cloudflared/<uuid>.json (tunnel credentials, written by create)
70
- * - <configDir>/cloudflared-named.yml (managed ingress config we serialize)
71
- *
72
- * Port-drift rewrite (load-bearing): the managed YAML embeds the daemon's
73
- * loopback port. The daemon picks a fresh OS-assigned port on most restarts,
74
- * so the persisted port is almost always stale by the time start() runs. We
75
- * rewrite the managed YAML with the current port on every start() — idempotent
76
- * atomic writes are cheap, forgetting the rewrite routes cloudflared to a
77
- * dead port.
78
- *
79
- * The managed YAML is treated as provider-owned — hand-edits to add extra
80
- * ingress rules WILL be silently dropped on the next start() because we
81
- * serialize only the four canonical keys (tunnel / credentials-file /
82
- * hostname / service). Warning on drift is deferred to 8.4.3.
83
- */
84
-
85
- type SpawnFn$1 = typeof spawn;
86
- interface ProviderDependencies {
87
- spawn?: SpawnFn$1;
88
- homedir?: () => string;
89
- }
90
- /**
91
- * Build a provider bound to a specific dependency set. The exported
92
- * singleton uses node defaults; tests construct a one-off via
93
- * createCloudflaredNamedProvider({ dependencies: { spawn: fakeSpawn } }).
94
- */
95
- declare function createCloudflaredNamedProvider(options?: {
96
- dependencies?: ProviderDependencies;
97
- }): TunnelProvider;
98
-
99
- /**
100
- * ngrok tunnel provider.
101
- *
102
- * Uses the official `@ngrok/ngrok` NAPI binding — the tunnel runs in-process
103
- * so there's no binary to download and no child process to manage. The ngrok
104
- * account authtoken and (optional) reserved domain live in <configDir>/ngrok.json.
105
- *
106
- * Free-tier ngrok includes one reserved static domain (yourname.ngrok-free.app)
107
- * which persists across daemon restarts; callers who leave `domain` unset get
108
- * an ephemeral URL that changes on each start.
109
- *
110
- * NOTE ON LAZY NATIVE LOADING (0.8.6):
111
- * `@ngrok/ngrok` ships platform-specific NAPI subpackages
112
- * (`@ngrok/ngrok-linux-x64-gnu`, `@ngrok/ngrok-win32-x64-msvc`, …) that are
113
- * resolved at module-load time. If the VSIX was packaged on a different OS
114
- * than the one activating the extension, the required subpackage may be
115
- * missing and `require("@ngrok/ngrok")` throws MODULE_NOT_FOUND. That used to
116
- * crash extension activation because the provider registry statically
117
- * imported this file. We now defer loading the NAPI binding until a caller
118
- * actually needs it (start / kill), and surface a domain-specific
119
- * `NgrokNativeMissingError` so the dashboard can show a useful message.
120
- */
121
-
122
- /**
123
- * Error thrown when the `@ngrok/ngrok` native subpackage for the current
124
- * platform/arch isn't installed. Callers (dashboard / CLI) should surface the
125
- * message to the user instead of letting a raw MODULE_NOT_FOUND propagate.
126
- */
127
- declare class NgrokNativeMissingError extends Error {
128
- readonly platform: string;
129
- readonly arch: string;
130
- readonly cause?: unknown;
131
- constructor(cause: unknown);
132
- }
133
- interface NgrokModule {
134
- forward: (options: Record<string, unknown>) => Promise<NgrokListener>;
135
- kill?: () => Promise<void> | void;
136
- }
137
- interface NgrokListener {
138
- url: () => string | undefined | null;
139
- close: () => Promise<void> | void;
140
- }
141
- /**
142
- * Lazily import `@ngrok/ngrok`. Cached on first success. On
143
- * MODULE_NOT_FOUND for either the umbrella package or its platform subpackage,
144
- * throws `NgrokNativeMissingError`; every other error propagates as-is so we
145
- * don't swallow genuine bugs.
146
- */
147
- declare function loadNgrokNative(): Promise<NgrokModule>;
148
- /**
149
- * Probe whether the native binding would load on this platform, without
150
- * actually keeping it cached. Used by `listTunnelProviderStatuses` so we can
151
- * surface a `native-missing` setup reason without crashing.
152
- */
153
- declare function isNgrokNativeAvailable(): Promise<{
154
- available: true;
155
- } | {
156
- available: false;
157
- error: NgrokNativeMissingError;
158
- }>;
159
-
160
- /**
161
- * Persistence for ngrok credentials.
162
- *
163
- * Stored at `<configDir>/ngrok.json` with file mode 0600 (POSIX) or
164
- * user-only ACL (Windows). Mirrors the token.ts safety pattern.
165
- */
166
- interface NgrokSettings {
167
- authtoken: string;
168
- domain?: string;
169
- updatedAt: string;
170
- }
171
- declare function getNgrokConfigPath(configDir: string): string;
172
- declare function readNgrokSettings(configDir: string): NgrokSettings | null;
173
- declare function writeNgrokSettings(configDir: string, next: {
174
- authtoken?: string;
175
- domain?: string | null;
176
- }): NgrokSettings;
177
- declare function clearNgrokSettings(configDir: string): void;
178
-
179
- /**
180
- * Cloudflared named-tunnel setup helpers.
181
- *
182
- * Wraps the `cloudflared` CLI to drive a persistent (named) tunnel. Named
183
- * tunnels require an origin cert (`~/.cloudflared/cert.pem`), a tunnel UUID
184
- * + credentials file, and a YAML config that maps a hostname -> local port.
185
- *
186
- * This module ships the setup primitives only; provider registration lives in
187
- * cloudflared-named.ts (Phase 8.4.2). The dashboard/CLI call these helpers
188
- * during the one-time setup flow.
189
- */
190
-
191
- /**
192
- * Minimal spawn signature we rely on — matches the three-arg overload of
193
- * `node:child_process.spawn` used for piping stdio and collecting output.
194
- * Declared as a type alias so tests can inject a fake implementation.
195
- */
196
- type SpawnFn = typeof spawn;
197
- interface CloudflaredLoginResult {
198
- ok: boolean;
199
- certPath: string;
200
- stderr?: string;
201
- }
202
- interface NamedTunnelSummary {
203
- /** cloudflared's tunnel UUID. */
204
- uuid: string;
205
- /** Human-readable name. */
206
- name: string;
207
- createdAt?: string;
208
- connections?: number;
209
- }
210
- interface CreatedTunnel extends NamedTunnelSummary {
211
- /** Path to the credentials JSON cloudflared wrote. */
212
- credentialsPath: string;
213
- }
214
- interface NamedTunnelConfig {
215
- uuid: string;
216
- /** e.g. "mcp.example.com" */
217
- hostname: string;
218
- /** Local daemon HTTP port. */
219
- port: number;
220
- /** Full path to the written .yml. */
221
- configPath: string;
222
- credentialsPath: string;
223
- }
224
- interface DeletedNamedTunnel {
225
- uuid: string;
226
- }
227
- type DeleteNamedTunnelFailureReason = "active-connections" | "unknown";
228
- declare class DeleteNamedTunnelError extends Error {
229
- readonly reason: DeleteNamedTunnelFailureReason;
230
- constructor(message: string, reason: DeleteNamedTunnelFailureReason);
231
- }
232
- /**
233
- * Runs `cloudflared tunnel login`. Opens a browser. Blocks until the cert
234
- * lands at `~/.cloudflared/cert.pem` (or throws on timeout / abort). The
235
- * login subprocess is best-effort terminated on resolve/reject.
236
- */
237
- declare function runCloudflaredLogin(options: {
238
- configDir: string;
239
- binaryPath?: string;
240
- signal?: AbortSignal;
241
- timeoutMs?: number;
242
- /** Override the cert watch location (defaults to `$HOME/.cloudflared/cert.pem`). */
243
- certPath?: string;
244
- /**
245
- * When true, pipe the cloudflared child's stderr AND stdout to the parent
246
- * process's stderr so CLI users see the "open this URL in your browser"
247
- * prompt (some cloudflared builds emit it on stdout, others on stderr).
248
- * Never forwards to parent stdout — the CLI reserves stdout for --json
249
- * machine-readable output. Default false (test hermeticity + dashboard
250
- * flow that wraps output in notifications instead).
251
- */
252
- forwardOutput?: boolean;
253
- /** Test-only dependency injection seam. */
254
- dependencies?: {
255
- spawn?: SpawnFn;
256
- };
257
- }): Promise<CloudflaredLoginResult>;
258
- /**
259
- * Runs `cloudflared tunnel list --output=json` and parses. Returns [] on
260
- * "no tunnels" (exit 0 + empty list). Throws on binary/cert problems.
261
- */
262
- declare function listNamedTunnels(options: {
263
- configDir: string;
264
- binaryPath?: string;
265
- dependencies?: {
266
- spawn?: SpawnFn;
267
- };
268
- }): Promise<NamedTunnelSummary[]>;
269
- /**
270
- * Runs `cloudflared tunnel create <name>`, parses the UUID + credentials
271
- * path out of stdout, then runs `cloudflared tunnel route dns <uuid>
272
- * <hostname>` to install the CNAME record.
273
- */
274
- declare function createNamedTunnel(options: {
275
- configDir: string;
276
- name: string;
277
- hostname: string;
278
- binaryPath?: string;
279
- signal?: AbortSignal;
280
- dependencies?: {
281
- spawn?: SpawnFn;
282
- };
283
- }): Promise<CreatedTunnel>;
284
- /**
285
- * Deletes a remote Cloudflare named tunnel. This is intentionally separate
286
- * from clearNamedTunnelConfig(): remote delete can fail even with --force
287
- * when DNS still routes traffic and active connections keep the tunnel alive.
288
- */
289
- declare function deleteNamedTunnel(options: {
290
- configDir: string;
291
- uuid: string;
292
- binaryPath?: string;
293
- signal?: AbortSignal;
294
- dependencies?: {
295
- spawn?: SpawnFn;
296
- };
297
- }): Promise<DeletedNamedTunnel>;
298
- declare function isActiveConnectionDeleteFailure(output: string): boolean;
299
- declare function getNamedTunnelConfigPath(configDir: string): string;
300
- /**
301
- * Writes `<configDir>/cloudflared-named.yml` describing the tunnel ->
302
- * localhost mapping. Uses the temp-file + rename pattern from ngrok-config.ts
303
- * and locks file mode to 0600 (POSIX) / user-only ACL (Windows).
304
- */
305
- declare function writeTunnelConfig(options: {
306
- configDir: string;
307
- uuid: string;
308
- hostname: string;
309
- port: number;
310
- credentialsPath: string;
311
- }): NamedTunnelConfig;
312
- /**
313
- * Reads + validates the config written by writeTunnelConfig. Returns null
314
- * if absent or malformed.
315
- */
316
- declare function readNamedTunnelConfig(configDir: string): NamedTunnelConfig | null;
317
- declare function clearNamedTunnelConfig(configDir: string): boolean;
318
-
319
- declare function getTunnelProvider(id: TunnelProviderId): TunnelProvider;
320
- declare function listTunnelProviders(): TunnelProvider[];
321
- interface TunnelSettings {
1
+ import { createCloudflaredNamedProvider } from "./cloudflared-named.js";
2
+ import type { TunnelProvider, TunnelProviderId, TunnelProviderStatus } from "./types.js";
3
+ export { NgrokNativeMissingError, loadNgrokNative, isNgrokNativeAvailable } from "./ngrok.js";
4
+ export { readNgrokSettings, writeNgrokSettings, clearNgrokSettings, getNgrokConfigPath } from "./ngrok-config.js";
5
+ export type { NgrokSettings } from "./ngrok-config.js";
6
+ export type { TunnelProvider, TunnelProviderId, TunnelProviderStatus, SetupCheck } from "./types.js";
7
+ export { createCloudflaredNamedProvider };
8
+ export { runCloudflaredLogin, listNamedTunnels, createNamedTunnel, deleteNamedTunnel, clearNamedTunnelConfig, writeTunnelConfig, readNamedTunnelConfig, getNamedTunnelConfigPath, isActiveConnectionDeleteFailure, DeleteNamedTunnelError, } from "./cloudflared-named-setup.js";
9
+ export type { CloudflaredLoginResult, NamedTunnelSummary, CreatedTunnel, NamedTunnelConfig, DeletedNamedTunnel, DeleteNamedTunnelFailureReason, } from "./cloudflared-named-setup.js";
10
+ export declare function getTunnelProvider(id: TunnelProviderId): TunnelProvider;
11
+ export declare function listTunnelProviders(): TunnelProvider[];
12
+ export interface TunnelSettings {
322
13
  activeProvider: TunnelProviderId;
323
14
  updatedAt: string;
324
15
  }
325
- declare function getTunnelSettingsPath(configDir: string): string;
326
- declare function readTunnelSettings(configDir: string): TunnelSettings;
327
- declare function writeTunnelSettings(configDir: string, patch: Partial<TunnelSettings>): TunnelSettings;
328
- declare function listTunnelProviderStatuses(configDir: string): Promise<TunnelProviderStatus[]>;
329
-
330
- export { type CloudflaredLoginResult, type CreatedTunnel, DeleteNamedTunnelError, type DeleteNamedTunnelFailureReason, type DeletedNamedTunnel, type NamedTunnelConfig, type NamedTunnelSummary, NgrokNativeMissingError, type NgrokSettings, type SetupCheck, type TunnelProvider, type TunnelProviderId, type TunnelProviderStatus, type TunnelSettings, clearNamedTunnelConfig, clearNgrokSettings, createCloudflaredNamedProvider, createNamedTunnel, deleteNamedTunnel, getNamedTunnelConfigPath, getNgrokConfigPath, getTunnelProvider, getTunnelSettingsPath, isActiveConnectionDeleteFailure, isNgrokNativeAvailable, listNamedTunnels, listTunnelProviderStatuses, listTunnelProviders, loadNgrokNative, readNamedTunnelConfig, readNgrokSettings, readTunnelSettings, runCloudflaredLogin, writeNgrokSettings, writeTunnelConfig, writeTunnelSettings };
16
+ export declare function getTunnelSettingsPath(configDir: string): string;
17
+ export declare function readTunnelSettings(configDir: string): TunnelSettings;
18
+ export declare function writeTunnelSettings(configDir: string, patch: Partial<TunnelSettings>): TunnelSettings;
19
+ export declare function listTunnelProviderStatuses(configDir: string): Promise<TunnelProviderStatus[]>;
@@ -23,11 +23,11 @@ import {
23
23
  writeNgrokSettings,
24
24
  writeTunnelConfig,
25
25
  writeTunnelSettings
26
- } from "../../chunk-XTRJSV72.mjs";
26
+ } from "../../chunk-LGH5BSUY.mjs";
27
27
  import "../../chunk-6YMQVLFX.mjs";
28
- import "../../chunk-FKQ3HP4Q.mjs";
28
+ import "../../chunk-TIWHN4IW.mjs";
29
29
  import "../../chunk-MTDFKNXX.mjs";
30
- import "../../chunk-HJIXH6CL.mjs";
30
+ import "../../chunk-E3GRJXXJ.mjs";
31
31
  import "../../chunk-4UEJOM6W.mjs";
32
32
  export {
33
33
  DeleteNamedTunnelError,
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Persistence for ngrok credentials.
3
+ *
4
+ * Stored at `<configDir>/ngrok.json` with file mode 0600 (POSIX) or
5
+ * user-only ACL (Windows). Mirrors the token.ts safety pattern.
6
+ */
7
+ export interface NgrokSettings {
8
+ authtoken: string;
9
+ domain?: string;
10
+ updatedAt: string;
11
+ }
12
+ export declare function getNgrokConfigPath(configDir: string): string;
13
+ export declare function readNgrokSettings(configDir: string): NgrokSettings | null;
14
+ export declare function writeNgrokSettings(configDir: string, next: {
15
+ authtoken?: string;
16
+ domain?: string | null;
17
+ }): NgrokSettings;
18
+ export declare function clearNgrokSettings(configDir: string): void;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * ngrok tunnel provider.
3
+ *
4
+ * Uses the official `@ngrok/ngrok` NAPI binding — the tunnel runs in-process
5
+ * so there's no binary to download and no child process to manage. The ngrok
6
+ * account authtoken and (optional) reserved domain live in <configDir>/ngrok.json.
7
+ *
8
+ * Free-tier ngrok includes one reserved static domain (yourname.ngrok-free.app)
9
+ * which persists across daemon restarts; callers who leave `domain` unset get
10
+ * an ephemeral URL that changes on each start.
11
+ *
12
+ * NOTE ON LAZY NATIVE LOADING (0.8.6):
13
+ * `@ngrok/ngrok` ships platform-specific NAPI subpackages
14
+ * (`@ngrok/ngrok-linux-x64-gnu`, `@ngrok/ngrok-win32-x64-msvc`, …) that are
15
+ * resolved at module-load time. If the VSIX was packaged on a different OS
16
+ * than the one activating the extension, the required subpackage may be
17
+ * missing and `require("@ngrok/ngrok")` throws MODULE_NOT_FOUND. That used to
18
+ * crash extension activation because the provider registry statically
19
+ * imported this file. We now defer loading the NAPI binding until a caller
20
+ * actually needs it (start / kill), and surface a domain-specific
21
+ * `NgrokNativeMissingError` so the dashboard can show a useful message.
22
+ */
23
+ import type { TunnelProvider } from "./types.js";
24
+ /**
25
+ * Error thrown when the `@ngrok/ngrok` native subpackage for the current
26
+ * platform/arch isn't installed. Callers (dashboard / CLI) should surface the
27
+ * message to the user instead of letting a raw MODULE_NOT_FOUND propagate.
28
+ */
29
+ export declare class NgrokNativeMissingError extends Error {
30
+ readonly platform: string;
31
+ readonly arch: string;
32
+ readonly cause?: unknown;
33
+ constructor(cause: unknown);
34
+ }
35
+ interface NgrokModule {
36
+ forward: (options: Record<string, unknown>) => Promise<NgrokListener>;
37
+ kill?: () => Promise<void> | void;
38
+ }
39
+ interface NgrokListener {
40
+ url: () => string | undefined | null;
41
+ close: () => Promise<void> | void;
42
+ }
43
+ /**
44
+ * Lazily import `@ngrok/ngrok`. Cached on first success. On
45
+ * MODULE_NOT_FOUND for either the umbrella package or its platform subpackage,
46
+ * throws `NgrokNativeMissingError`; every other error propagates as-is so we
47
+ * don't swallow genuine bugs.
48
+ */
49
+ export declare function loadNgrokNative(): Promise<NgrokModule>;
50
+ /**
51
+ * Probe whether the native binding would load on this platform, without
52
+ * actually keeping it cached. Used by `listTunnelProviderStatuses` so we can
53
+ * surface a `native-missing` setup reason without crashing.
54
+ */
55
+ export declare function isNgrokNativeAvailable(): Promise<{
56
+ available: true;
57
+ } | {
58
+ available: false;
59
+ error: NgrokNativeMissingError;
60
+ }>;
61
+ export declare const ngrokProvider: TunnelProvider;
62
+ /**
63
+ * Test-only hook to reset the lazy cache between vitest runs. Exported so the
64
+ * unit tests can reset state without touching module internals via
65
+ * reflection. NOT part of the public runtime API.
66
+ */
67
+ export declare function __resetNgrokNativeCacheForTests(): void;
68
+ export {};
@@ -0,0 +1,56 @@
1
+ import type { StartedTunnel, TunnelState } from "../tunnel.js";
2
+ export type TunnelProviderId = "cf-quick" | "ngrok" | "cf-named";
3
+ export interface TunnelProviderStartOptions {
4
+ port: number;
5
+ configDir: string;
6
+ onStateChange: (state: TunnelState) => void;
7
+ }
8
+ export interface SetupCheck {
9
+ ready: boolean;
10
+ /** User-facing reason the provider isn't ready (e.g. "ngrok authtoken not set"). */
11
+ reason?: string;
12
+ /** Optional action hint the dashboard can surface.
13
+ *
14
+ * Kinds:
15
+ * - "open-url": UI opens `url` in the default browser.
16
+ * - "input-authtoken": UI surfaces a text input and posts
17
+ * `daemon:set-ngrok-authtoken` back.
18
+ * - "install-binary": UI runs the known install-binary flow
19
+ * (`daemon:install-cloudflared` for cf-named / cf-quick today).
20
+ * - "run-command": UI dispatches the webview message type identified
21
+ * by `command` (e.g. `"cf-named-login"` → `daemon:cf-named-login`).
22
+ * Preferred over "open-url" when the action has no URL and needs
23
+ * a modal-confirmed host-side handler.
24
+ */
25
+ action?: {
26
+ label: string;
27
+ kind: "open-url" | "input-authtoken" | "install-binary" | "run-command";
28
+ url?: string;
29
+ /** Opaque identifier for the command to run (used with kind: "run-command"). */
30
+ command?: string;
31
+ };
32
+ }
33
+ export interface TunnelProvider {
34
+ readonly id: TunnelProviderId;
35
+ readonly displayName: string;
36
+ /** Brief description surfaced next to the provider in the dashboard picker. */
37
+ readonly description: string;
38
+ /**
39
+ * Returns whether the provider has everything it needs to start a tunnel.
40
+ * Called before start(); the dashboard also calls this to render a setup widget.
41
+ */
42
+ isSetupComplete(configDir: string): Promise<SetupCheck>;
43
+ /**
44
+ * Start the tunnel. Must resolve once the public URL is known OR reject if
45
+ * setup is missing / start fails. onStateChange fires on every state
46
+ * transition including "starting" and "enabled".
47
+ */
48
+ start(options: TunnelProviderStartOptions): Promise<StartedTunnel>;
49
+ }
50
+ export interface TunnelProviderStatus {
51
+ id: TunnelProviderId;
52
+ displayName: string;
53
+ description: string;
54
+ setup: SetupCheck;
55
+ isActive: boolean;
56
+ }
@@ -1,23 +1,21 @@
1
- interface TunnelState {
1
+ export interface TunnelState {
2
2
  status: "starting" | "enabled" | "disabled" | "crashed";
3
3
  url: string | null;
4
4
  pid: number | null;
5
5
  error?: string | null;
6
6
  }
7
- interface StartTunnelOptions {
7
+ export interface StartTunnelOptions {
8
8
  command: string;
9
9
  args?: string[];
10
10
  port: number;
11
11
  env?: NodeJS.ProcessEnv;
12
12
  onStateChange?: (state: TunnelState) => void;
13
13
  }
14
- interface StartedTunnel {
14
+ export interface StartedTunnel {
15
15
  pid: number;
16
16
  waitUntilReady: Promise<string>;
17
17
  stop: () => Promise<void>;
18
18
  getState: () => TunnelState;
19
19
  }
20
- declare function startTunnel(options: StartTunnelOptions): StartedTunnel;
21
- declare function extractTunnelUrl(line: string): string | null;
22
-
23
- export { type StartTunnelOptions, type StartedTunnel, type TunnelState, extractTunnelUrl, startTunnel };
20
+ export declare function startTunnel(options: StartTunnelOptions): StartedTunnel;
21
+ export declare function extractTunnelUrl(line: string): string | null;
@@ -0,0 +1,2 @@
1
+ export declare function trace(category: string, event: string, data?: Record<string, unknown>, error?: unknown): void;
2
+ export declare function traceToolHandler<TArgs, TResult>(toolName: string, handler: (args: TArgs) => Promise<TResult>): (args: TArgs) => Promise<TResult>;
@@ -1,24 +1,19 @@
1
- import { DoctorReport, DoctorCategory } from './doctor.d-CXmUqOXX.js';
2
-
3
- declare function buildIssueBody(input: {
4
- report: DoctorReport;
5
- stderrTail: string;
6
- extVersion: string;
7
- nodeVersion: string;
8
- os: string;
9
- activeTier?: string | null;
1
+ export function buildIssueBody({ report, stderrTail, extVersion, nodeVersion, os, activeTier }: {
2
+ report: any;
3
+ stderrTail: any;
4
+ extVersion: any;
5
+ nodeVersion: any;
6
+ os: any;
7
+ activeTier: any;
10
8
  }): string;
11
-
12
- declare function redactIssueBody(md: string): string;
13
-
14
- declare function decideTransport(input: { bodyBytes: number }): "inline" | "file";
15
-
16
- declare function buildIssueUrl(input: {
17
- owner: string;
18
- repo: string;
19
- category: DoctorCategory | string;
20
- check: string;
21
- body: string;
9
+ export function redactIssueBody(md: any): any;
10
+ export function decideTransport({ bodyBytes }: {
11
+ bodyBytes: any;
12
+ }): "file" | "inline";
13
+ export function buildIssueUrl({ owner, repo, category, check, body }: {
14
+ owner: any;
15
+ repo: any;
16
+ category: any;
17
+ check: any;
18
+ body: any;
22
19
  }): string;
23
-
24
- export { buildIssueBody, buildIssueUrl, decideTransport, redactIssueBody };
package/dist/doctor.d.ts CHANGED
@@ -1,44 +1,12 @@
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 rollupStatus(statuses: DoctorStatus[]): DoctorStatus;
40
- declare function exitCodeFor(report: { overall: DoctorStatus }): number;
41
- declare function runAll(opts?: RunAllOpts): Promise<DoctorReport>;
42
- declare function formatReportMarkdown(report: DoctorReport): string;
43
-
44
- export { CATEGORIES, type DoctorCategory, type DoctorCheck, type DoctorReport, type DoctorStatus, type RunAllOpts, exitCodeFor, formatReportMarkdown, rollupStatus, runAll };
1
+ export function rollupStatus(statuses: any): string;
2
+ export function exitCodeFor(report: any): 0 | 10;
3
+ export function runAll(opts?: {}): Promise<{
4
+ overall: string;
5
+ generatedAt: string;
6
+ durationMs: number;
7
+ activeProfile: any;
8
+ probeRan: boolean;
9
+ byCategory: {};
10
+ }>;
11
+ export function formatReportMarkdown(report: any): string;
12
+ export const CATEGORIES: string[];
package/dist/doctor.mjs CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  formatReportMarkdown,
5
5
  rollupStatus,
6
6
  runAll
7
- } from "./chunk-HNSPNCFH.mjs";
8
- import "./chunk-HJIXH6CL.mjs";
7
+ } from "./chunk-KSNV3ZVY.mjs";
8
+ import "./chunk-E3GRJXXJ.mjs";
9
9
  import "./chunk-4UEJOM6W.mjs";
10
10
  export {
11
11
  CATEGORIES,