-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathmessages.ts
More file actions
792 lines (756 loc) · 26.3 KB
/
Copy pathmessages.ts
File metadata and controls
792 lines (756 loc) · 26.3 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
import type { AccountSnapshot, HistoryItem } from "./models.js";
import type { IdeCapabilities, McpTransportId } from "./constants.js";
import type { PromptDef, PromptsState } from "./prompts.js";
export type IdeTarget =
| "cursor" | "windsurf" | "windsurfNext" | "claudeDesktop" | "claudeCode"
| "cline" | "amp" | "rooCode" | "codexCli"
| "continueDev" | "copilot" | "zed" | "geminiCli"
| "vscode" | "antigravity" | "kiro" | "firebaseStudio"
| "amazonQ" | "goose" | "warp" | "trae"
| "aider" | "augment"
// 2026-05 expansion: file-based MCP clients with first-party docs.
| "vs2022" | "copilotCli" | "openCode" | "factoryDroid" | "qwenCode"
| "kiloCode" | "lmStudio";
/**
* Classification of the `command` field on a stored IDE MCP config entry.
*
* - `ok` — node-shaped binary that exists / resolves via PATH.
* - `missing` — absolute path that no longer exists on disk.
* - `wrong-runtime` — basename matches a known IDE host / Electron binary
* (Code, Cursor, Windsurf, Electron, Claude desktop)
* or sits inside a `*.app/Contents/MacOS/` bundle with
* a non-node basename.
* - `unresolved` — bare `"node"` / `"node.exe"` not found via PATH.
* - `unknown` — exists, but basename isn't node-shaped and isn't on
* the blacklist; surface a light warning so the user
* can verify it's actually a Node-compatible runtime.
*
* Mirrors `CommandHealth` in
* `packages/extension/src/launcher/validate-command.ts` — kept in sync so
* MCP-server-side consumers (the doctor formatter) don't need to import
* extension-only modules.
*/
export type IdeCommandHealth =
| "ok"
| "missing"
| "wrong-runtime"
| "unresolved"
| "unknown";
export interface IdeStatus {
detected: boolean;
configured: boolean;
health: "configured" | "stale" | "missing";
path: string;
lastConfiguredAt?: string;
displayName: string;
autoConfigurable: boolean;
configFormat: "json" | "toml" | "yaml" | "ui-only";
/**
* Raw `command` field extracted from the config (for diagnostics surfacing).
* `undefined` when `configured === false` or the format wasn't parseable.
*/
command?: string;
/**
* Classification of `command`. `undefined` when `configured === false`.
* The doctor demotes a "configured" IDE to `warn` whenever this is set
* to anything other than `"ok"`. See `IdeCommandHealth`.
*/
commandHealth?: IdeCommandHealth;
}
export interface ExtensionSettingsSnapshot {
defaultSearchModel: string;
reasonModel: string;
researchModel: string;
computeModel: string;
/**
* Legacy plain-path override (maps to `Perplexity.chromePath`). Kept for
* back-compat; new users should go through the rich `browserChoice` picker
* in the Settings tab which also handles channel selection + bundled
* Chromium install/remove.
*/
chromePath: string;
/**
* User-selected browser runtime. Persisted to `Perplexity.browserChoice`
* so the pick survives VS Code restarts. `undefined` / `mode: 'auto'`
* means "use the first available probe from browser-detect.ts".
*/
browserChoice?: BrowserChoice;
debugMode: boolean;
autoConfigureCursor: boolean;
autoConfigureWindsurf: boolean;
autoConfigureWindsurfNext: boolean;
autoConfigureClaudeDesktop: boolean;
autoConfigureClaudeCode: boolean;
autoConfigureCline: boolean;
autoConfigureAmp: boolean;
autoConfigureCodexCli: boolean;
autoRefreshIntervalHours: number;
debugVerboseHttp: boolean;
/** Hours a granted OAuth consent is remembered before the user is prompted again. 0 disables the cache (modal every time). */
oauthConsentCacheTtlHours: number;
/** Phase 8.6: per-IDE MCP transport selection. Keys are IDE target names. Missing keys resolve to MCP_TRANSPORT_DEFAULT. */
mcpTransportByIde: Record<string, McpTransportId>;
/** Pinned loopback port for the embedded daemon. 0 = ephemeral (OS-assigned). */
daemonPort: number;
/** Extra regex patterns used to detect cloud-sync folders when generating http-loopback configs. */
syncFolderPatterns: readonly string[];
/**
* v0.8.5: when a configured IDE's mcp.json embeds a stale URL or bearer
* (the extension's daemon port drifted, tunnel rotated, or bearer rotated),
* re-run applyIdeConfig automatically with the current live values. Default
* on - the refresh is not a surprise write because the IDE + transport pair
* was previously approved. Off surfaces the banner and leaves regeneration
* to the user.
*/
autoRegenerateStaleConfigs: boolean;
/**
* v0.8.5: loopback-default posture. When `false` (default), the dashboard
* hides the TunnelManager controls behind an opt-in card and the
* TransportPicker omits the http-tunnel option entirely. Flip to `true` to
* expose remote-access controls (Cloudflare Quick Tunnel, cf-named, ngrok).
* A one-time migration on v0.8.5 activation flips this to `true` for users
* who already have a tunnel-settings.json (they previously opted in by
* configuring a provider), so upgrade-path users aren't surprised.
*/
enableTunnels: boolean;
}
export interface RulesStatus {
ide: IdeTarget;
rulesPath: string;
hasPerplexitySection: boolean;
lastUpdated?: string;
}
export interface DashboardState {
snapshot: AccountSnapshot;
history: HistoryItem[];
/** True total count of all history entries on disk, independent of the paginated `history` array. */
historyTotalCount: number;
ideStatus: Record<string, IdeStatus>;
rulesStatus: RulesStatus[];
settings: ExtensionSettingsSnapshot;
/** User-defined + built-in MCP prompts ("custom commands") for the Prompts tab. */
prompts: PromptsState;
}
export type DaemonTunnelStatus = "disabled" | "starting" | "enabled" | "crashed";
export interface DaemonTunnelState {
status: DaemonTunnelStatus;
url: string | null;
pid?: number | null;
error?: string | null;
}
export interface DaemonStatusState {
running: boolean;
healthy: boolean;
stale: boolean;
configDir: string;
lockPath: string;
tokenPath: string;
pid: number | null;
uuid: string | null;
port: number | null;
url: string | null;
version: string | null;
startedAt: string | null;
uptimeMs: number | null;
heartbeatCount: number | null;
tunnel: DaemonTunnelState;
/** True iff a daemon token exists on disk. The raw bearer is NEVER sent over this channel. */
bearerAvailable: boolean;
}
export interface DaemonAuditEntry {
timestamp: string;
clientId: string;
tool: string;
durationMs: number;
source: "loopback" | "tunnel";
ok: boolean;
error?: string;
}
/**
* v0.8.5: tunnel performance dashboard snapshot. Computed in the extension
* host from a combination of the audit tail (health-check latency, /mcp status
* ratios) and a session-local enable-timing ring buffer maintained by
* `DashboardProvider`. The audit log does not record enable/disable events as
* their own entries, so the extension tracks them as clicks → "tunnel.status
* flipped to enabled" and exposes the results here.
*/
export type TunnelProviderIdShared = "cf-quick" | "ngrok" | "cf-named";
export interface TunnelEnableRecord {
provider: TunnelProviderIdShared;
/** ISO timestamp when the user clicked Enable. */
startedAt: string;
/** Wall-clock ms between click and tunnel.status === "enabled" (or failure). */
durationMs: number;
/** false if the enable timed out, errored, or the user cancelled. */
ok: boolean;
}
export interface TunnelPerformanceMcpBucket {
/** 2xx responses. */
ok: number;
/** HTTP 401 (missing/invalid bearer or OAuth). */
unauthorized: number;
/** HTTP 5xx. */
serverError: number;
/** 4xx non-401, network errors, anything else. */
other: number;
}
export interface TunnelPerformanceSnapshot {
currentProvider: TunnelProviderIdShared | null;
/** Last N enable records across all providers, newest first. */
enableHistory: TunnelEnableRecord[];
/** Rolling average health-check latency over the last N /daemon/health hits (loopback only). */
healthLatencyAvgMs: number | null;
/** Count of samples that fed the average. 0 means "no data yet". */
healthLatencySamples: number;
/**
* /mcp request counts bucketed by the audit `source` field (loopback vs
* tunnel). The extension doesn't record WHICH provider served a given
* tunnel hit, so per-provider ratios are intentionally out of scope for v1
* — that would require a new persistent log.
*/
mcpStatusBySource: Record<"loopback" | "tunnel", TunnelPerformanceMcpBucket>;
/** Total /mcp requests observed across the supplied audit window. */
mcpTotal: number;
/** Newest audit timestamp seen, or null if the window was empty. */
lastAuditTs: string | null;
}
export type TunnelProbeTarget = "/" | "/mcp";
export type TunnelProbeVerdict = "ok" | "security-flag" | "challenge" | "retryable" | "unknown";
export interface TunnelProbeResult {
target: TunnelProbeTarget;
status?: number;
cfMitigated: boolean;
verdict: TunnelProbeVerdict;
checkedAt: string;
error?: "timeout" | "network" | "no-tunnel-url" | "unsupported";
}
export interface CfNamedManagedConfig {
uuid: string;
hostname: string;
configPath: string;
credentialsPresent: boolean;
}
export interface CfNamedTunnelSummary {
uuid: string;
name: string;
connections?: number;
}
export type AuthStatus =
| "unknown" | "checking" | "valid" | "expired" | "error"
| "logging-in" | "awaiting_otp" | "chrome_missing" | "sso_required";
export type BrowserChannel = "chrome" | "msedge" | "chromium";
/**
* Snapshot of a launchable Chromium-family browser runtime available to the
* extension.
*/
export interface BrowserInfo {
/** True when a runtime is actually usable. */
found: boolean;
/** Channel passed to Patchright. */
channel?: BrowserChannel;
/** Absolute path to a launchable executable. */
executablePath?: string;
/** Human-readable name rendered in the dashboard picker. */
label?: string;
/** True when the entry came from a download managed by BrowserDownloadManager. */
downloaded?: boolean;
}
export type BrowserDownloadStatus = "idle" | "downloading" | "done" | "error";
export interface BrowserDownloadState {
status: BrowserDownloadStatus;
/** 0-100 during downloads. */
progress?: number;
error?: string;
}
/**
* Persisted user preference for which browser to use. `mode: 'auto'` means
* "first available in the preferred order"; `mode: 'custom'` pins a specific
* executable path.
*/
export interface BrowserChoice {
mode: "auto" | "custom";
channel?: BrowserChannel;
executablePath?: string;
label?: string;
}
export interface AuthState {
profile: string;
status: AuthStatus;
tier?: "Max" | "Pro" | "Enterprise" | "Authenticated" | "Anonymous";
userId?: string;
email?: string;
lastLogin?: string;
lastChecked?: string;
error?: string;
/** Currently-selected browser runtime, when one was detected. */
browser?: BrowserInfo;
/** Live download state when the user is pulling bundled Chromium. */
browserDownload?: BrowserDownloadState;
/** Every runtime the extension could discover, in preferred order. */
availableBrowsers?: BrowserInfo[];
/** Persisted user pick; defaults to auto when absent. */
browserChoice?: BrowserChoice;
}
export interface Profile {
name: string;
displayName: string;
createdAt: string;
lastLogin?: string;
lastChecked?: string;
loginMode: "auto" | "manual";
tier?: "Max" | "Pro" | "Enterprise" | "Authenticated" | "Anonymous";
}
export type DoctorStatus = "pass" | "warn" | "fail" | "skip";
export type DoctorCategory =
| "runtime" | "config" | "profiles" | "vault" | "browser"
| "native-deps" | "network" | "ide" | "mcp" | "probe";
/**
* Optional one-click remediation for a failing/warning check. The webview
* renders a button labelled `action.label` next to the hint; clicking it
* dispatches `doctor:action` → the extension host runs the VS Code command.
*/
export interface DoctorAction {
label: string;
commandId: string;
args?: unknown[];
}
export interface DoctorCheck {
category: DoctorCategory;
name: string;
status: DoctorStatus;
message: string;
detail?: Record<string, unknown>;
hint?: string;
action?: DoctorAction;
}
export interface DoctorReport {
overall: DoctorStatus;
generatedAt: string;
durationMs: number;
activeProfile: string | null;
probeRan: boolean;
byCategory: Record<DoctorCategory, {
status: DoctorStatus;
checks: DoctorCheck[];
}>;
}
export type ExportFormat = "pdf" | "markdown" | "docx";
export interface ExternalViewer {
id: string;
label: string;
urlTemplate: string;
needsVaultBridge: boolean;
vaultPath?: string;
vaultName?: string;
graphName?: string;
detected: boolean;
enabled: boolean;
}
export interface HistoryEntryDetail extends HistoryItem {
body: string;
mdPath: string;
attachmentsDir: string;
}
export type ExtensionMessage =
| {
type: "dashboard:state";
payload: DashboardState;
}
| {
type: "notice";
payload: {
level: "info" | "warning" | "error";
message: string;
};
}
| { type: "action:result"; id: string; ok: boolean; error?: string }
| {
type: "models:refresh:status";
payload: {
phase: "start" | "success" | "error";
source?: "live" | "cache" | "fallback";
tier?: "got-scraping" | "impit" | "browser";
count?: number;
elapsedMs?: number;
error?: string;
};
}
| {
type: "speed-boost:status";
payload: {
phase: "installing" | "uninstalling" | "idle";
line?: string;
};
}
| { type: "auth:state"; payload: AuthState }
| { type: "auth:otp-prompt"; payload: { profile: string; attempt: number; email: string } }
| { type: "profile:list"; payload: { active: string | null; profiles: Profile[] } }
| { type: "doctor:running"; payload: { probeRan: boolean } }
| { type: "doctor:report"; payload: DoctorReport }
| { type: "daemon:status-updated"; payload: DaemonStatusState }
| { type: "daemon:tunnel-url"; payload: DaemonTunnelState }
| { type: "daemon:token-rotated"; payload: { rotatedAt: string } }
| { type: "daemon:audit-tail"; payload: { items: DaemonAuditEntry[] } }
| {
type: "daemon:bearer:reveal:response";
id: string;
payload: { bearer: string; expiresInMs: number; nonce: string };
}
| {
type: "daemon:oauth-clients";
payload: {
clients: Array<{
clientId: string;
clientName?: string;
registeredAt: number;
lastUsedAt?: string;
consentLastApprovedAt?: string;
activeTokens: number;
}>;
};
}
| {
type: "daemon:oauth-consents";
payload: {
consents: Array<{
clientId: string;
redirectUri: string;
approvedAt: string;
expiresAt: number;
}>;
};
}
| {
type: "daemon:tunnel-providers";
payload: {
activeProvider: "cf-quick" | "ngrok" | "cf-named";
providers: Array<{
id: "cf-quick" | "ngrok" | "cf-named";
displayName: string;
description: string;
isActive: boolean;
setup: {
ready: boolean;
reason?: string;
/** See SetupCheck in mcp-server types.ts for kind semantics. */
action?: {
label: string;
kind: "open-url" | "input-authtoken" | "install-binary" | "run-command";
url?: string;
/** Opaque identifier (e.g. "cf-named-login") for kind: "run-command". */
command?: string;
};
};
}>;
ngrok: { configured: boolean; domain?: string; updatedAt?: string };
cfNamed?: {
config: CfNamedManagedConfig | null;
tunnels?: CfNamedTunnelSummary[];
lastListedAt?: string;
lastListError?: string;
};
};
}
| {
type: "daemon:cf-named-login:result";
id: string;
payload: { ok: true; certPath: string } | { ok: false; error: string };
}
| {
type: "daemon:cf-named-create:result";
id: string;
payload:
| { ok: true; hostname: string; uuid: string; configPath: string }
| { ok: false; error: string };
}
| {
type: "daemon:cf-named-list:result";
id: string;
payload:
| { ok: true; tunnels: CfNamedTunnelSummary[] }
| { ok: false; error: string };
}
| {
type: "daemon:cf-named-unbind-local:result";
id: string;
payload:
| { ok: true; uuid: string; configCleared: boolean }
| { ok: false; error: string };
}
| {
type: "daemon:cf-named-delete-remote:result";
id: string;
payload:
| {
ok: true;
uuid: string;
hostname?: string;
localConfigCleared: boolean;
dnsCleanupUrl: string;
}
| { ok: false; error: string; reason?: "active-connections" | "unknown" };
}
| {
type: "daemon:tunnel-probe:result";
id: string;
payload:
| { ok: true; results: TunnelProbeResult[]; timeoutMs: 5000 }
| { ok: false; results?: TunnelProbeResult[]; timeoutMs: 5000; error: string };
}
| { type: "history:list"; payload: { items: HistoryItem[]; totalCount: number } }
| { type: "history:entry"; payload: HistoryEntryDetail }
| {
type: "history:export:progress";
payload: {
id: string;
phase: "starting" | "downloaded" | "saved" | "error";
bytes?: number;
error?: string;
savedPath?: string;
};
}
| { type: "viewers:list"; payload: { viewers: ExternalViewer[] } }
| {
type: "history:cloud-sync:progress";
payload: {
id: string;
phase: "starting" | "syncing" | "done" | "cancelled" | "error";
fetched?: number;
total?: number;
inserted?: number;
updated?: number;
skipped?: number;
error?: string;
};
}
| {
type: "history:cloud-hydrate:progress";
payload: {
id: string;
historyId: string;
phase: "starting" | "done" | "skipped-local" | "skipped-hydrated" | "error";
error?: string;
};
}
| {
type: "diagnostics:capture:result";
id: string;
ok: true;
outputPath: string;
bytesWritten: number;
sourcesIncluded: string[];
sourcesMissing: string[];
}
| {
type: "diagnostics:capture:result";
id: string;
ok: false;
error: string;
}
// Phase 8.6: transport picker outbound messages.
| { type: "transport:capabilities"; payload: { byIde: Record<string, IdeCapabilities> } }
| { type: "transport:staleness"; payload: { stale: Array<{ ideTag: string; reason: "bearer" | "url" }> } }
// v0.8.5: tunnel performance dashboard. Pushed from the extension host
// whenever `postDaemonState` runs (after staleness). Webview treats null as
// the pre-hydrate state and renders nothing.
| { type: "tunnel:performance"; payload: TunnelPerformanceSnapshot }
// Custom-commands ("Prompts" tab): pushed on initial load and after every
// save/delete/reset so the webview reflects the merged built-in + user list.
| { type: "prompts:state"; payload: PromptsState };
export type WebviewMessage =
| {
type: "ready";
}
| {
type: "log:webview";
payload: { level: "log" | "warn" | "error" | "info" | "debug"; args: unknown[]; ts: string };
}
| {
type: "daemon:restart";
id: string;
}
| {
type: "daemon:kill";
id: string;
}
| {
type: "daemon:list-tunnel-providers";
id: string;
}
| {
type: "daemon:set-tunnel-provider";
id: string;
payload: { providerId: "cf-quick" | "ngrok" | "cf-named" };
}
| {
type: "daemon:install-cloudflared";
id: string;
}
| {
type: "daemon:cf-named-login";
id: string;
}
| {
type: "daemon:cf-named-create";
id: string;
payload:
| {
mode: "create";
/** Human-readable tunnel name, e.g. "perplexity-mcp". */
name: string;
/** Fully qualified hostname, e.g. "mcp.example.com". */
hostname: string;
}
| {
mode: "bind-existing";
/** UUID of an existing tunnel the user created manually. */
uuid: string;
hostname: string;
};
}
| {
type: "daemon:cf-named-list";
id: string;
}
| {
type: "daemon:cf-named-unbind-local";
id: string;
payload: { uuid: string };
}
| {
type: "daemon:cf-named-delete-remote";
id: string;
payload: { uuid: string; name: string; hostname?: string };
}
| {
type: "daemon:tunnel-probe";
id: string;
payload?: { targets?: TunnelProbeTarget[]; timeoutMs?: 5000 };
}
| {
type: "daemon:set-ngrok-authtoken";
id: string;
payload: { authtoken: string };
}
| {
type: "daemon:set-ngrok-domain";
id: string;
payload: { domain: string | null };
}
| {
type: "daemon:clear-ngrok-settings";
id: string;
}
| {
type: "auth:login";
id: string;
}
| {
type: "dashboard:refresh";
}
| {
type: "configs:generate";
id: string;
payload: {
target: "all" | IdeTarget;
};
}
| {
type: "configs:remove";
id: string;
payload: {
target: IdeTarget;
};
}
| {
type: "rules:sync";
id: string;
payload: {
target: "all" | IdeTarget;
};
}
| {
type: "rules:remove";
id: string;
payload: {
target: IdeTarget;
};
}
| {
type: "settings:update";
payload: Partial<ExtensionSettingsSnapshot>;
}
| {
type: "models:refresh";
id: string;
}
| {
type: "speed-boost:install";
id: string;
}
| {
type: "speed-boost:uninstall";
id: string;
}
| { type: "auth:login-start"; id: string; payload: { profile: string; mode: "auto" | "manual"; email?: string } }
| { type: "auth:cancel"; id: string; payload: { profile: string } }
| { type: "auth:otp-submit"; id: string; payload: { profile: string; otp: string } }
| { type: "auth:logout"; id: string; payload: { profile: string; purge?: boolean } }
| { type: "auth:dismiss-expired"; payload: { profile: string; bumpHours: number } }
| { type: "profile:switch"; id: string; payload: { name: string } }
| { type: "profile:add-prompt" }
| { type: "profile:add"; id: string; payload: { name: string; displayName?: string; loginMode: "auto" | "manual" } }
| { type: "profile:delete"; id: string; payload: { name: string } }
| { type: "doctor:run"; id: string; payload: { profile?: string; allProfiles?: boolean } }
| { type: "doctor:probe"; id: string; payload: { profile?: string } }
| { type: "doctor:export"; id: string; payload: { targetPath?: string } }
| { type: "doctor:report-issue"; id: string; payload: { category: DoctorCategory; check: string } }
| { type: "doctor:action"; id: string; payload: { commandId: string; args?: unknown[] } }
| { type: "daemon:status"; id: string }
| { type: "daemon:rotate-token"; id: string }
| { type: "daemon:enable-tunnel"; id: string }
| { type: "daemon:disable-tunnel"; id: string }
| { type: "daemon:oauth-consents-list"; id: string }
| { type: "daemon:oauth-consents-revoke"; id: string; payload: { clientId: string; redirectUri?: string } }
| { type: "daemon:oauth-consents-revoke-all"; id: string }
| { type: "daemon:bearer:copy"; id: string }
| { type: "daemon:bearer:reveal"; id: string }
| { type: "oauth-clients:list"; id: string }
| { type: "oauth-clients:revoke"; id: string; payload: { clientId: string } }
| { type: "oauth-clients:revoke-all"; id: string }
| { type: "history:request-list"; payload?: { filter?: string } }
| { type: "history:request-entry"; id: string; payload: { historyId: string } }
| { type: "history:open-preview"; id: string; payload: { historyId: string } }
| { type: "history:open-rich"; id: string; payload: { historyId: string } }
| { type: "history:open-with"; id: string; payload: { historyId: string; viewerId: string } }
| { type: "history:export"; id: string; payload: { historyId: string; format: ExportFormat } }
| { type: "history:pin"; id: string; payload: { historyId: string; pinned: boolean } }
| { type: "history:tag"; id: string; payload: { historyId: string; tags: string[] } }
| { type: "history:delete"; id: string; payload: { historyId: string } }
| { type: "history:rebuild-index"; id: string }
| { type: "viewers:request-list" }
| { type: "viewers:configure"; id: string; payload: { viewer: ExternalViewer } }
| { type: "history:cloud-sync"; id: string; payload?: { pageSize?: number } }
| { type: "history:cloud-hydrate"; id: string; payload: { historyId: string } }
| { type: "diagnostics:capture"; id: string }
// Phase 8.6: transport picker inbound messages. `ideTag` is `string`, not
// `IdeTarget`, to avoid tight coupling with the hardcoded string-union.
// The 8.6.4 handler will validate `ideTag in IDE_METADATA` at receive-time.
| { type: "transport:select"; id: string; payload: { ideTag: string; transportId: McpTransportId } }
| { type: "transport:regenerate-stale"; id: string }
// Browser picker + runtime-manager actions. Each round-trips through the
// DashboardProvider into AuthManager, which updates the live BrowserProbe
// and emits a fresh auth:state message so the picker re-renders with the
// new selection / download progress.
| { type: "browser:select"; id: string; payload: { mode: "auto" | "custom"; channel?: BrowserChannel; executablePath?: string; label?: string } }
| { type: "browser:refresh-detection"; id: string }
| { type: "browser:pick-custom"; id: string }
| { type: "browser:install-bundled"; id: string }
| { type: "browser:remove-bundled"; id: string }
// Custom-commands ("Prompts" tab). `prompts:save` upserts a custom prompt or
// overrides a built-in; `prompts:delete` removes a custom prompt; `prompts:reset`
// clears a built-in's override. Each round-trips through `action:result` and is
// followed by a fresh `prompts:state` push.
| { type: "prompts:save"; id: string; payload: { prompt: PromptDef } }
| { type: "prompts:delete"; id: string; payload: { name: string } }
| { type: "prompts:reset"; id: string; payload: { name: string } };