@slack/radar-mcp 1.20.0 → 1.22.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 (91) hide show
  1. package/README.md +75 -17
  2. package/dist/mcp/api-paths.d.ts +11 -0
  3. package/dist/mcp/api-paths.js +56 -20
  4. package/dist/mcp/dashboard-identity.d.ts +6 -0
  5. package/dist/mcp/dashboard-identity.js +11 -0
  6. package/dist/mcp/index.js +138 -36
  7. package/dist/mcp/logs-result.d.ts +1 -0
  8. package/dist/mcp/logs-result.js +1 -0
  9. package/dist/mcp/network-detail.d.ts +5 -0
  10. package/dist/mcp/network-detail.js +86 -0
  11. package/dist/mcp/radar-export-get.d.ts +30 -0
  12. package/dist/mcp/radar-export-get.js +49 -0
  13. package/dist/mcp/radar-response.d.ts +11 -1
  14. package/dist/mcp/radar-response.js +23 -3
  15. package/dist/mcp/session-backfill.d.ts +9 -3
  16. package/dist/mcp/session-backfill.js +76 -17
  17. package/dist/mcp/session-detail.js +54 -2
  18. package/dist/mcp/session-enable.d.ts +1 -0
  19. package/dist/mcp/session-enable.js +146 -15
  20. package/dist/mcp/session-query.js +53 -11
  21. package/dist/mcp/snapshot.js +42 -26
  22. package/dist/mcp/sources-gate.js +5 -0
  23. package/dist/mcp/stale-dashboard.d.ts +23 -0
  24. package/dist/mcp/stale-dashboard.js +122 -0
  25. package/dist/mcp/switchboard-spool.d.ts +12 -0
  26. package/dist/mcp/switchboard-spool.js +107 -0
  27. package/dist/mcp/switchboard-tools.d.ts +18 -0
  28. package/dist/mcp/switchboard-tools.js +178 -0
  29. package/dist/mcp/tools.d.ts +4 -1
  30. package/dist/mcp/tools.js +114 -23
  31. package/dist/mcp/web-child-env.d.ts +4 -1
  32. package/dist/mcp/web-child-env.js +4 -1
  33. package/dist/shared/android.d.ts +43 -0
  34. package/dist/shared/android.js +227 -19
  35. package/dist/shared/constants.d.ts +19 -4
  36. package/dist/shared/constants.js +19 -4
  37. package/dist/shared/event-spool.js +3 -2
  38. package/dist/shared/feature-flags.d.ts +1 -0
  39. package/dist/shared/feature-flags.js +1 -0
  40. package/dist/shared/form-body.d.ts +18 -0
  41. package/dist/shared/form-body.js +251 -0
  42. package/dist/shared/ios-logs.d.ts +10 -0
  43. package/dist/shared/ios-logs.js +91 -0
  44. package/dist/shared/ios.d.ts +25 -2
  45. package/dist/shared/ios.js +157 -3
  46. package/dist/{web → shared}/log-session.d.ts +45 -31
  47. package/dist/shared/log-session.js +300 -0
  48. package/dist/shared/radar-request-raw.d.ts +7 -0
  49. package/dist/shared/radar-request-raw.js +89 -0
  50. package/dist/shared/radar-token.d.ts +25 -0
  51. package/dist/shared/radar-token.js +164 -0
  52. package/dist/shared/stream.d.ts +4 -1
  53. package/dist/shared/stream.js +107 -15
  54. package/dist/shared/switchboard-host-store.d.ts +21 -0
  55. package/dist/shared/switchboard-host-store.js +166 -0
  56. package/dist/shared/switchboard-note.d.ts +15 -0
  57. package/dist/shared/switchboard-note.js +92 -0
  58. package/dist/shared/switchboard-report-file.d.ts +5 -0
  59. package/dist/shared/switchboard-report-file.js +26 -0
  60. package/dist/shared/switchboard-report.d.ts +20 -0
  61. package/dist/shared/switchboard-report.js +406 -0
  62. package/dist/shared/switchboard.d.ts +118 -0
  63. package/dist/shared/switchboard.js +487 -0
  64. package/dist/shared/transport.d.ts +43 -3
  65. package/dist/shared/version.d.ts +2 -0
  66. package/dist/shared/version.js +18 -0
  67. package/dist/shared/wire.d.ts +46 -1
  68. package/dist/web/install-app.d.ts +57 -8
  69. package/dist/web/install-app.js +270 -60
  70. package/dist/web/macapp/RadarApp.swift +340 -22
  71. package/dist/web/public/index.html +216 -12
  72. package/dist/web/public/next/app.js +43 -22
  73. package/dist/web/public/next/db.js +4 -1
  74. package/dist/web/public/next/feed.js +604 -59
  75. package/dist/web/public/next/filters.js +158 -40
  76. package/dist/web/public/next/flags.js +3 -0
  77. package/dist/web/public/next/form-body.js +252 -0
  78. package/dist/web/public/next/inspector.js +171 -14
  79. package/dist/web/public/next/prefs.js +5 -2
  80. package/dist/web/public/next/registry.js +35 -3
  81. package/dist/web/public/next/store.js +947 -69
  82. package/dist/web/public/next/switchboard-note.js +93 -0
  83. package/dist/web/public/next/toast.js +9 -5
  84. package/dist/web/public/next/voice-model.js +712 -0
  85. package/dist/web/public/next/voice.js +552 -0
  86. package/dist/web/server.d.ts +20 -9
  87. package/dist/web/server.js +834 -174
  88. package/dist/web/spec.d.ts +11 -6
  89. package/dist/web/spec.js +62 -6
  90. package/package.json +4 -4
  91. package/dist/web/log-session.js +0 -166
@@ -6,8 +6,10 @@
6
6
  * device-specific operations. The MCP server and tool handlers
7
7
  * interact only through this interface.
8
8
  */
9
+ import type { LogSession } from "./log-session.js";
10
+ import type { TokenFileError } from "./radar-token.js";
9
11
  /** Which underlying source served a getRecentLogs result. */
10
- export type LogSource = "app_buffer" | "logcat_capture" | "logcat_ring";
12
+ export type LogSource = "app_buffer" | "logcat_capture" | "logcat_ring" | "ios_unified_capture";
11
13
  /**
12
14
  * What a fresh process probe actually established. "unknown" is a real answer, not a
13
15
  * failure to answer: the probe ran and could not tell (no adb, device detached or
@@ -23,6 +25,8 @@ export type ProcessState = "running" | "stopped" | "unknown";
23
25
  export interface LogResult {
24
26
  lines: string[];
25
27
  source: LogSource;
28
+ /** Set when the capture failed but retained lines are still returned. */
29
+ capture_error?: string;
26
30
  }
27
31
  /**
28
32
  * One attached device as reported by the platform's device listing. serial is the
@@ -58,12 +62,28 @@ export type DevicePick = {
58
62
  devices: DeviceInfo[];
59
63
  };
60
64
  export interface DeviceTransport {
65
+ /** Package identifier used by the built-in Slack-app log filter, when logs are supported. */
66
+ readonly logPackage?: string;
67
+ /**
68
+ * Session-long host log capture owned by the transport. The dashboard consumes this
69
+ * capability without knowing whether its child process is adb logcat or simctl log stream.
70
+ */
71
+ readonly logSession?: LogSession;
72
+ /**
73
+ * Whether this transport owns a host-side log stream that can support a session even when
74
+ * the app has no Radar HTTP listener. This is independent of supportsRadarHttpTools: Android
75
+ * and the iOS Simulator have both today, so session-enable's host-logs-only path serves a
76
+ * future transport that has host logs and no app listener.
77
+ */
78
+ readonly supportsHostLogs?: boolean;
79
+ /** Stop any transport-owned host log capture. */
80
+ stopLogCapture?(): void;
61
81
  /**
62
82
  * Human-readable platform name (e.g. "android", "ios").
63
83
  *
64
84
  * For display and error text. Do NOT branch capability decisions on it. An optional member
65
- * being present is the capability check; `platform !== "android"` is a guess that happens to
66
- * be right today and rejects the next platform by construction rather than by an actual gap.
85
+ * being present is the capability check; comparing the platform name is a guess that happens
86
+ * to be right today and rejects the next platform by construction rather than by an actual gap.
67
87
  */
68
88
  readonly platform: string;
69
89
  /**
@@ -84,6 +104,24 @@ export interface DeviceTransport {
84
104
  * must opt in before callRadar can touch the host-global Radar port.
85
105
  */
86
106
  readonly supportsRadarHttpTools?: boolean;
107
+ /**
108
+ * Whether requests to this transport's listener carry X-Radar-Token.
109
+ *
110
+ * Absent means this transport never reads or creates the token file, so a new platform must
111
+ * opt in before a laptop secret rides on its port.
112
+ */
113
+ readonly sendsRadarToken?: boolean;
114
+ /**
115
+ * Optional identity check for transports whose Radar HTTP listener shares a host-global
116
+ * address with another platform. The iOS Simulator uses the Mac's loopback directly, so an
117
+ * Android adb forward can otherwise be mistaken for the selected Simulator app.
118
+ */
119
+ acceptsRadarPeer?(ping: Record<string, unknown>): boolean;
120
+ /**
121
+ * What the user should do when the app's Radar listener does not answer, for transports
122
+ * whose default advice ("check adb devices") does not apply. Absent keeps that default.
123
+ */
124
+ readonly radarListenerHint?: string;
87
125
  /**
88
126
  * Whether this transport has a device dashboard for open_radar_dashboard to open.
89
127
  *
@@ -210,6 +248,8 @@ export interface DeviceTransport {
210
248
  * implementations may omit it.
211
249
  */
212
250
  getLastActivateError?(): string | null;
251
+ /** No broadcast went out, so callers report the file problem without probing the device. */
252
+ getLastActivateTokenFileError?(): TokenFileError | null;
213
253
  /**
214
254
  * State of the target app process on the device, checked fresh (not cached). Lets the
215
255
  * enable flow tell a confirmed "stopped" apart from "the probe could not tell" when the
@@ -0,0 +1,2 @@
1
+ export declare function parseVersion(text: string): [number, number, number] | null;
2
+ export declare function compareVersions(left: string, right: string): number | null;
@@ -0,0 +1,18 @@
1
+ const PLAIN_VERSION = /^(0|[1-9]\d{0,9})\.(0|[1-9]\d{0,9})\.(0|[1-9]\d{0,9})$/;
2
+ export function parseVersion(text) {
3
+ const match = PLAIN_VERSION.exec(text);
4
+ if (match === null)
5
+ return null;
6
+ return [Number(match[1]), Number(match[2]), Number(match[3])];
7
+ }
8
+ export function compareVersions(left, right) {
9
+ const first = parseVersion(left);
10
+ const second = parseVersion(right);
11
+ if (first === null || second === null)
12
+ return null;
13
+ for (let index = 0; index < 3; index++) {
14
+ if (first[index] !== second[index])
15
+ return first[index] - second[index];
16
+ }
17
+ return 0;
18
+ }
@@ -20,5 +20,50 @@ export type EnableRefusal = "self_arm_blocked" | "device_changed";
20
20
  * - undiagnosed: an earlier diagnosis no longer holds (a later probe did not find the session
21
21
  * absent). It is not a diagnosis and carries no cause; a client drops whatever it latched
22
22
  * from the earlier reason. A frame with NO reason says nothing about the diagnosis.
23
+ * - unauthorized: the device answered this process with HTTP 401, final for this response
24
+ * until a health or enable ping sees the device accept this process again (the host reconnects
25
+ * and announces connected) or two health pings in a row come back without a 401 (the host goes
26
+ * back to retrying and first retracts this reason with undiagnosed). msg names the cause; each
27
+ * time the host reconnects is a new attempt, so a refusal after it re-emits this frame; state
28
+ * stays waiting throughout.
23
29
  */
24
- export type StatusReason = "no_session" | "undiagnosed";
30
+ export type StatusReason = "no_session" | "undiagnosed" | "unauthorized";
31
+ /**
32
+ * The Switchboard plugin's session summary, as `GET /api/switchboard` lists it (`{sessions:
33
+ * [...]}`, newest first) and as the envelope of `GET /api/switchboard/<session_id>`, which adds
34
+ * `events: [...]` (the page of records, newest `limit` oldest first). Every record carries an `id`
35
+ * the plugin mints: strictly increasing across sessions, never repeated within a process, reset
36
+ * with it. `total_captured` is the records the plugin still holds for the session; `events` is
37
+ * only ever the page, the count is `total_captured`. `levels` is the newest audio level tick, null
38
+ * before the first one.
39
+ */
40
+ export interface SwitchboardLevels {
41
+ timestamp: number;
42
+ mic_rms: number;
43
+ mic_peak: number;
44
+ playback_rms: number;
45
+ playback_peak: number;
46
+ }
47
+ export interface SwitchboardSessionSummary {
48
+ session_id: number;
49
+ team_id: string | null;
50
+ began_at: number;
51
+ ended_at: number | null;
52
+ last_state?: Record<string, unknown> | null;
53
+ frames: {
54
+ incoming: number;
55
+ outgoing: number;
56
+ };
57
+ total_captured: number;
58
+ levels: SwitchboardLevels | null;
59
+ server_session_id?: string | null;
60
+ turns?: {
61
+ count: number;
62
+ last_response_ms: number;
63
+ last_clock: string;
64
+ } | null;
65
+ saved_turn_counts?: Record<string, number>;
66
+ }
67
+ export interface SwitchboardSessionDetail extends SwitchboardSessionSummary {
68
+ events: Record<string, unknown>[];
69
+ }
@@ -68,7 +68,32 @@ export interface InstallConfigValues {
68
68
  node: string;
69
69
  webBin: string;
70
70
  mcpBin: string;
71
+ port: number;
71
72
  }
73
+ /**
74
+ * The port the installed app was built against, or null when there is no app or the port cannot be
75
+ * read. Info.plist records it from this version on. An app installed before that records it only in
76
+ * its executable: the native binary holds the baked RADAR_URL as a plain string, and the shell
77
+ * launcher has its PORT= line. A key that is present decides on its own, so an unreadable one falls
78
+ * back to the default rather than to whatever the executable happens to contain.
79
+ *
80
+ * Exported for testing.
81
+ */
82
+ export declare function readInstalledPort(app?: string): number | null;
83
+ /**
84
+ * The port this install bakes in. An explicit SLACK_RADAR_WEB_PORT wins, and has to be a real port:
85
+ * anything else would bake a URL the app cannot parse, and the app would crash on every launch until
86
+ * a reinstall, so the install throws instead. Without one, a
87
+ * rebuild keeps the port the installed app already has: the self-heal rebuild of an app installed
88
+ * before the port was passed on runs with no port in its environment, and baking the default there
89
+ * would move a user on 8101 to 8100 while their MCP config still names 8101. The default comes last,
90
+ * and is also what a rebuild bakes when the installed app's port cannot be read or is not a port.
91
+ * The installed app is read only when the environment names no port, since its answer is unused
92
+ * otherwise. `installed` is for tests: a value, including null, stands in for that read.
93
+ *
94
+ * Exported for testing.
95
+ */
96
+ export declare function installPort(env?: NodeJS.ProcessEnv, installed?: number | null): number;
72
97
  /**
73
98
  * Everything the app needs to know about THIS machine.
74
99
  *
@@ -102,9 +127,30 @@ export declare function installMacApp(): {
102
127
  app: string;
103
128
  native: boolean;
104
129
  node: string;
130
+ port: number;
105
131
  };
106
- /** Entry point for the `install-app` subcommand. Prints what to do next, then reveals the app. */
107
- export declare function runInstallApp(): void;
132
+ /**
133
+ * Entry point for the `install-app` subcommand. Prints what to do next, then reveals the app.
134
+ * `install` and `reveal` are for tests, so the printed message can be checked without building an
135
+ * app or opening a Finder window.
136
+ */
137
+ export declare function runInstallApp(install?: () => {
138
+ app: string;
139
+ native: boolean;
140
+ node: string;
141
+ port: number;
142
+ }, reveal?: () => void): void;
143
+ /**
144
+ * What install-app prints once the bundle is in place.
145
+ *
146
+ * Exported for testing.
147
+ */
148
+ export declare function installAppMessage(result: {
149
+ app: string;
150
+ native: boolean;
151
+ node: string;
152
+ port: number;
153
+ }): string;
108
154
  /**
109
155
  * Entry point for `install-app --self-heal-check`, spawned in the background by RadarApp.swift
110
156
  * on every dock launch. install-app bakes the .app's paths and version in ONCE, so a Radar
@@ -112,8 +158,9 @@ export declare function runInstallApp(): void;
112
158
  * pointed at a stale, orphaned npx cache path with no signal to the user. This rebuilds it in
113
159
  * place when this process's own version (itself just resolved via the same `@latest` npx call)
114
160
  * differs from what is installed, so the fix lands invisibly and takes effect on the NEXT
115
- * launch. Never throws out of this function: a launcher-triggered background process failing
116
- * loudly would look like a crash, which is exactly what staying invisible rules out.
161
+ * launch. Never throws out of this function, except when the final state write itself fails: a
162
+ * launcher-triggered background process failing loudly would look like a crash, which is exactly
163
+ * what staying invisible rules out. That one throw exits non-zero, which the precheck counts as a failure.
117
164
  */
118
165
  export declare function runSelfHealCheck(): void;
119
166
  /** Test seam: override the registry URL checkLatestPublishedVersion() reads from. */
@@ -129,6 +176,7 @@ export declare function checkLatestPublishedVersion(): Promise<string | null>;
129
176
  /** Test seam: override the spawn implementation runSelfHealPrecheckAsync() uses to trigger the
130
177
  * conditional npx rebuild. */
131
178
  export declare function _setSelfHealSpawnForTest(fn: typeof spawn): void;
179
+ export declare function _setSelfHealRebuildTimeoutForTest(ms: number): void;
132
180
  /**
133
181
  * Entry point for `install-app --self-heal-precheck`. RadarApp.swift now spawns THIS (the
134
182
  * already-installed, guaranteed self-heal-aware mcp/index.js) instead of going straight to `npx
@@ -139,10 +187,11 @@ export declare function _setSelfHealSpawnForTest(fn: typeof spawn): void;
139
187
  * the normal state, not an edge case, for a locally-built dock app ahead of what is published.
140
188
  *
141
189
  * This checks the registry's plain version metadata first (no package code ever executes) and
142
- * only spawns the npx follow-up once that confirms a real, strictly-newer version exists. At that
143
- * point whatever `npx @latest` resolves to is guaranteed to postdate this build and understand
144
- * `--self-heal-check`, because versions only move forward under this project's manual, sequential
145
- * publish model -- so the old-dispatch bug cannot trigger here.
190
+ * only spawns the npx follow-up once that confirms a real, strictly-newer version exists. Versions
191
+ * only move forward under this project's manual, sequential publish model, so `npx @latest` lands
192
+ * on this build or newer, unless npm config (min-release-age, a lagging mirror) holds it back. The
193
+ * precheck logs that skew. A held-back child from this release on refuses to downgrade, but an older
194
+ * one does not have that check.
146
195
  */
147
196
  export declare function runSelfHealPrecheck(): void;
148
197
  /** The awaitable core of runSelfHealPrecheck(), exported so a test can await its outcome