@slack/radar-mcp 1.23.0 → 1.25.0

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 (55) hide show
  1. package/README.md +14 -7
  2. package/dist/mcp/dashboard-identity.d.ts +10 -0
  3. package/dist/mcp/dashboard-identity.js +20 -0
  4. package/dist/mcp/debug-package-reset.d.ts +5 -0
  5. package/dist/mcp/debug-package-reset.js +28 -0
  6. package/dist/mcp/flags-tools.d.ts +2 -0
  7. package/dist/mcp/flags-tools.js +10 -2
  8. package/dist/mcp/index.js +74 -54
  9. package/dist/mcp/radar-http.js +3 -1
  10. package/dist/mcp/session-enable.d.ts +1 -0
  11. package/dist/mcp/session-enable.js +52 -8
  12. package/dist/mcp/switchboard-tools.d.ts +5 -2
  13. package/dist/mcp/switchboard-tools.js +18 -12
  14. package/dist/mcp/tools.js +69 -169
  15. package/dist/mcp/web-child-env.js +2 -1
  16. package/dist/shared/android.d.ts +74 -10
  17. package/dist/shared/android.js +344 -103
  18. package/dist/shared/constants.d.ts +17 -5
  19. package/dist/shared/constants.js +59 -5
  20. package/dist/shared/db.d.ts +1 -1
  21. package/dist/shared/db.js +21 -14
  22. package/dist/shared/debug-log.js +2 -4
  23. package/dist/shared/enable-diagnosis.d.ts +27 -1
  24. package/dist/shared/enable-diagnosis.js +73 -0
  25. package/dist/shared/feature-flags.d.ts +11 -0
  26. package/dist/shared/feature-flags.js +18 -4
  27. package/dist/shared/log-session.d.ts +2 -1
  28. package/dist/shared/prefs.js +4 -5
  29. package/dist/shared/radar-request-raw.js +3 -1
  30. package/dist/shared/switchboard-note.d.ts +19 -0
  31. package/dist/shared/switchboard-note.js +76 -0
  32. package/dist/shared/switchboard-report.js +40 -4
  33. package/dist/shared/switchboard.d.ts +2 -1
  34. package/dist/shared/switchboard.js +17 -3
  35. package/dist/shared/transport.d.ts +24 -0
  36. package/dist/shared/wire.d.ts +2 -0
  37. package/dist/web/install-app-cli.d.ts +2 -0
  38. package/dist/web/install-app-cli.js +60 -0
  39. package/dist/web/install-app.d.ts +16 -7
  40. package/dist/web/install-app.js +92 -39
  41. package/dist/web/macapp/RadarApp.swift +12 -11
  42. package/dist/web/public/index.html +4 -2
  43. package/dist/web/public/next/feature-flags.js +33 -0
  44. package/dist/web/public/next/feed.js +13 -2
  45. package/dist/web/public/next/flags.js +15 -3
  46. package/dist/web/public/next/registry.js +4 -4
  47. package/dist/web/public/next/store.js +89 -3
  48. package/dist/web/public/next/switchboard-note.js +76 -0
  49. package/dist/web/public/next/voice-model.js +196 -14
  50. package/dist/web/public/next/voice.js +68 -10
  51. package/dist/web/server.d.ts +17 -0
  52. package/dist/web/server.js +180 -35
  53. package/dist/web/spec.d.ts +1 -1
  54. package/dist/web/spec.js +1 -1
  55. package/package.json +1 -1
@@ -1,5 +1,7 @@
1
1
  import { type ChildProcess } from "child_process";
2
2
  import { TokenFileError } from "./radar-token.js";
3
+ import { BareEnableError, type PinReason } from "./enable-diagnosis.js";
4
+ import type { ArgvReason } from "./transport.js";
3
5
  import { LogSession, type LogFrame } from "./log-session.js";
4
6
  import type { DeviceInfo, DeviceTransport, LogResult, ProcessState, DevicePick } from "./transport.js";
5
7
  export declare function describeBroadcastFailure(error: Error): string;
@@ -35,6 +37,50 @@ export declare class AndroidPidPackageMap {
35
37
  }
36
38
  /** Parse one adb logcat threadtime line into the dashboard's normalized log frame. */
37
39
  export declare function parseAndroidLogcat(line: string, resolvePackage?: (pid: number) => string | undefined): LogFrame | null;
40
+ export declare function adbNotFoundError(): string;
41
+ export declare function tokenFileWriteArgs(userId: string, pkg?: string): string[];
42
+ export declare function tokenFileCheckArgs(userId: string, pkg?: string): string[];
43
+ export declare function tokenFileWritten(stdout: string): boolean;
44
+ export declare function tokenFileLeftover(stdout: string): boolean | null;
45
+ export type PsProbe = {
46
+ state: ProcessState;
47
+ lines: string;
48
+ };
49
+ export declare function classifyPsDebugBuild(stdout: string): PsProbe;
50
+ export type PsRow = {
51
+ user: string;
52
+ pkg: string | null;
53
+ };
54
+ /**
55
+ * The rows the probe lines carry: the Android user and the debug package behind the process name.
56
+ * A `:process` suffix folds into its package, and a name that breaks the package rule gets a null
57
+ * pkg (never trusted into a shell string) but its row still counts for its user. Lines that are
58
+ * not an app process of a user, such as root's, are skipped.
59
+ */
60
+ export declare function parsePsRows(lines: string): PsRow[];
61
+ /** The distinct valid debug packages ps shows for one Android user. */
62
+ export declare function debugPackagesForUser(lines: string, userId: string): string[];
63
+ export type DebugPackagePick = {
64
+ kind: "use";
65
+ pkg: string;
66
+ detected: boolean;
67
+ } | {
68
+ kind: "stopped";
69
+ pkg?: string;
70
+ reason?: PinReason;
71
+ } | {
72
+ kind: "ambiguous";
73
+ packages: string[];
74
+ } | {
75
+ kind: "unknown_flavour";
76
+ packages: string[];
77
+ };
78
+ /**
79
+ * Which package to arm for one user. `unknown` keeps the current package and never blocks,
80
+ * the same as the process gate always did. A pinned package (the override, else the build this
81
+ * session already armed) is only checked, never replaced.
82
+ */
83
+ export declare function pickDebugPackage(probe: PsProbe, userId: string, override: string | null, current: string, held?: string | null): DebugPackagePick;
38
84
  /**
39
85
  * Parse the output of `ps -A -o USER,NAME` to extract the Android user ID
40
86
  * for the debug build process. When multiple profiles are running, prefers
@@ -43,6 +89,15 @@ export declare function parseAndroidLogcat(line: string, resolvePackage?: (pid:
43
89
  * "10", which is often a work profile, but the id alone cannot prove that).
44
90
  */
45
91
  export declare function parseUserFromPsOutput(psOutput: string): string;
92
+ /**
93
+ * Same pick as parseUserFromPsOutput, plus whether a line of a target package decided it.
94
+ * With targets, only their lines count; when none match the user still comes from all lines
95
+ * (so errors can name a real user) and `matched` is false.
96
+ */
97
+ export declare function pickUserFromPs(psOutput: string, targetPackages?: readonly string[]): {
98
+ userId: string;
99
+ matched: boolean;
100
+ };
46
101
  /**
47
102
  * Parse `adb devices -l` output into a list of attached devices. Skips the
48
103
  * "List of devices attached" header and the daemon-restart preamble adb sometimes
@@ -65,7 +120,9 @@ export interface AndroidTransportDependencies {
65
120
  }
66
121
  export declare class AndroidTransport implements DeviceTransport {
67
122
  readonly platform = "android";
68
- readonly logPackage = "com.Slack.internal.debug";
123
+ get logPackage(): string;
124
+ adoptRadarOwner(ping: Record<string, unknown>): void;
125
+ foreignRadarOwner(ping: Record<string, unknown>): string | null;
69
126
  readonly supportsHostLogs = true;
70
127
  readonly logSession: LogSession;
71
128
  readonly supportsRadarHttpTools = true;
@@ -74,11 +131,16 @@ export declare class AndroidTransport implements DeviceTransport {
74
131
  readonly supportsDeviceDashboard = true;
75
132
  private portForwarded;
76
133
  private detectedUserId;
134
+ private psSawUser;
135
+ private armedBuild;
136
+ private commitBuild;
77
137
  private currentTimeoutMinutes;
78
138
  private radarEnabled;
79
139
  private lastForwardError;
80
140
  private lastActivateError;
81
141
  private lastActivateTokenFileError;
142
+ private lastActivateBareError;
143
+ private lastTokenViaArgv;
82
144
  private selectedDevice;
83
145
  private readonly dashboardPidPackages;
84
146
  constructor(dependencies?: AndroidTransportDependencies);
@@ -97,12 +159,7 @@ export declare class AndroidTransport implements DeviceTransport {
97
159
  private rebuildForwardAsync;
98
160
  getLastForwardError(): string | null;
99
161
  activate(timeoutMinutes: number): void;
100
- /**
101
- * activate, off the event loop. Same skip guard, the same broadcast argv, and the same
102
- * state recording as the sync twin, but the `ps` user detection and the broadcast run
103
- * through execFileAsync so a caller serving HTTP (the dashboard's boot-arm chain) keeps
104
- * answering while adb runs.
105
- */
162
+ /** Keep adb off the event loop so HTTP requests still get answers during an arm. */
106
163
  activateAsync(timeoutMinutes: number): Promise<void>;
107
164
  /**
108
165
  * Whether the device-side Radar server's abstract socket exists right now, read from the
@@ -113,12 +170,20 @@ export declare class AndroidTransport implements DeviceTransport {
113
170
  * can. "unknown" (adb missing, or the table could not be read) leaves the caller its safe branch.
114
171
  */
115
172
  radarSocketPresentAsync(): Promise<"present" | "absent" | "unknown">;
173
+ private runEnableSteps;
174
+ private runEnableStepsAsync;
175
+ private applyArmOutcome;
176
+ private clearArmOutcome;
116
177
  private recordActivateSuccess;
117
178
  private recordActivateFailure;
118
179
  private readArmToken;
119
180
  getLastActivateError(): string | null;
120
181
  ensureLogCapture(): void;
121
182
  getLastActivateTokenFileError(): TokenFileError | null;
183
+ getLastActivateBareError(): BareEnableError | null;
184
+ getLastTokenViaArgv(): ArgvReason | null;
185
+ /** Forget the held build so the next arm detects one afresh. */
186
+ releaseDebugBuild(): void;
122
187
  resetState(): void;
123
188
  dropForward(): void;
124
189
  isForwarded(): boolean;
@@ -189,10 +254,9 @@ export declare class AndroidTransport implements DeviceTransport {
189
254
  */
190
255
  private psDebugBuildProbe;
191
256
  private psDebugBuildProbeAsync;
192
- /** Raw `ps` lines for running debug-build Slack processes, or null if there are none. */
193
- private psDebugBuildLine;
194
257
  private detectDebugBuildUser;
195
- private detectDebugBuildUserAsync;
258
+ private detectDebugBuildUserProbe;
259
+ private detectDebugBuildUserProbeAsync;
196
260
  private cacheUserFromPs;
197
261
  /**
198
262
  * State of the debug-build Slack process, checked fresh via `ps` (independent of