@slack/radar-mcp 1.21.0 → 1.23.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.
- package/README.md +114 -18
- package/dist/mcp/api-paths.d.ts +2 -2
- package/dist/mcp/api-paths.js +4 -19
- package/dist/mcp/dashboard-identity.d.ts +6 -0
- package/dist/mcp/dashboard-identity.js +11 -0
- package/dist/mcp/index.js +210 -145
- package/dist/mcp/logs-result.d.ts +1 -0
- package/dist/mcp/logs-result.js +1 -0
- package/dist/mcp/radar-export-get.d.ts +30 -0
- package/dist/mcp/radar-export-get.js +49 -0
- package/dist/mcp/radar-http.d.ts +22 -0
- package/dist/mcp/radar-http.js +61 -0
- package/dist/mcp/radar-response.d.ts +5 -1
- package/dist/mcp/radar-response.js +8 -3
- package/dist/mcp/session-backfill.js +3 -4
- package/dist/mcp/session-enable.d.ts +15 -0
- package/dist/mcp/session-enable.js +268 -19
- package/dist/mcp/snapshot.js +42 -26
- package/dist/mcp/sources-gate.js +6 -0
- package/dist/mcp/stale-dashboard.d.ts +23 -0
- package/dist/mcp/stale-dashboard.js +122 -0
- package/dist/mcp/switchboard-spool.d.ts +12 -0
- package/dist/mcp/switchboard-spool.js +107 -0
- package/dist/mcp/switchboard-tools.d.ts +9 -0
- package/dist/mcp/switchboard-tools.js +144 -6
- package/dist/mcp/test-cases.d.ts +14 -0
- package/dist/mcp/test-cases.js +77 -0
- package/dist/mcp/test-runs-tools.d.ts +8 -0
- package/dist/mcp/test-runs-tools.js +95 -0
- package/dist/mcp/tools.d.ts +4 -1
- package/dist/mcp/tools.js +101 -21
- package/dist/mcp/web-child-env.d.ts +4 -1
- package/dist/mcp/web-child-env.js +4 -1
- package/dist/shared/android.d.ts +44 -0
- package/dist/shared/android.js +234 -24
- package/dist/shared/constants.d.ts +9 -4
- package/dist/shared/constants.js +9 -4
- package/dist/shared/feature-flags.d.ts +1 -0
- package/dist/shared/feature-flags.js +1 -0
- package/dist/shared/ios-logs.d.ts +10 -0
- package/dist/shared/ios-logs.js +91 -0
- package/dist/shared/ios.d.ts +25 -2
- package/dist/shared/ios.js +157 -3
- package/dist/{web → shared}/log-session.d.ts +45 -31
- package/dist/shared/log-session.js +300 -0
- package/dist/shared/logcat-capture.js +17 -1
- package/dist/shared/radar-request-raw.d.ts +7 -0
- package/dist/shared/radar-request-raw.js +89 -0
- package/dist/shared/radar-token.d.ts +25 -0
- package/dist/shared/radar-token.js +164 -0
- package/dist/shared/stream.d.ts +3 -0
- package/dist/shared/stream.js +107 -15
- package/dist/shared/switchboard-host-store.d.ts +21 -0
- package/dist/shared/switchboard-host-store.js +166 -0
- package/dist/shared/switchboard-note.d.ts +15 -0
- package/dist/shared/switchboard-note.js +92 -0
- package/dist/shared/switchboard-report-file.d.ts +5 -0
- package/dist/shared/switchboard-report-file.js +26 -0
- package/dist/shared/switchboard-report.d.ts +20 -0
- package/dist/shared/switchboard-report.js +406 -0
- package/dist/shared/switchboard.d.ts +111 -2
- package/dist/shared/switchboard.js +436 -3
- package/dist/shared/transport.d.ts +49 -3
- package/dist/shared/version.d.ts +2 -0
- package/dist/shared/version.js +18 -0
- package/dist/shared/wire.d.ts +14 -1
- package/dist/web/install-app.d.ts +75 -8
- package/dist/web/install-app.js +330 -67
- package/dist/web/macapp/RadarApp.swift +487 -23
- package/dist/web/public/index.html +51 -9
- package/dist/web/public/next/app.js +33 -18
- package/dist/web/public/next/feed.js +102 -15
- package/dist/web/public/next/flags.js +3 -0
- package/dist/web/public/next/inspector.js +69 -3
- package/dist/web/public/next/prefs.js +5 -2
- package/dist/web/public/next/registry.js +18 -5
- package/dist/web/public/next/store.js +455 -29
- package/dist/web/public/next/switchboard-note.js +93 -0
- package/dist/web/public/next/toast.js +9 -5
- package/dist/web/public/next/voice-model.js +215 -35
- package/dist/web/public/next/voice.js +173 -18
- package/dist/web/server.d.ts +15 -11
- package/dist/web/server.js +690 -168
- package/dist/web/spec.d.ts +2 -1
- package/dist/web/spec.js +2 -1
- package/package.json +2 -2
- package/dist/web/log-session.js +0 -166
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Opens `http://localhost:8100` automatically. Set `SLACK_RADAR_WEB_PORT` to use a
|
|
|
50
50
|
* **Clogs** — analytics events, click one to see its payload
|
|
51
51
|
* **Traces** — performance trace spans with durations, click one for its timing and tags
|
|
52
52
|
* **Logs** — device logcat, filtered to the Slack app. **app** switches app or shows all apps; **level ≥** sets the lowest level to show (VERBOSE shows everything; the choice follows you between Logs and Live and waits while you visit another tab)
|
|
53
|
-
* **Switchboard** — the Slackbot voice transport's own records: session begin and end, connection, mic and speaking state changes, every websocket frame (← in, → out) with type and size, phase timings,
|
|
53
|
+
* **Switchboard** — the Slackbot voice transport's own records: session begin and end, connection, mic and speaking state changes, every websocket frame (← in, → out) with type and size, phase timings, player diagnostics (re-arms, jitter trims, read stalls, pre-ready drops), mic/playback level meter batches, and timed voice turns (how long Slackbot took to start answering, e.g. `1840 ms, no card`), and whether each spoken turn got saved to the DM (`saved, thread`, `saved (line moved on), thread` for a late save whose line already moved on (a server resend counts again), or `dropped: missing field` with the reason; the session panel counts each of the four outcomes). Click a row for the rest of its fields; no level, so hide noise with the filter box or **exclude**, and the kinds chips on the toolbar (including **levels**) turn one kind of record off at a time. Records arrive once a Slackbot voice session starts. A debug build that declares its sources and lacks the plugin hides the tab; one too old to declare them shows it empty. Above the feed, a session panel draws the newest session: connection, mic and speaking pills, a pill naming the server's own id for the call (reading "pending" once a build known to report one has not sent it yet, and showing nothing at all on a build never known to), the handshake waterfall, model/you tracks with markers for re-arms, tts.stop and focus loss, mic and playback level sparklines once the device reports them, and four stat cards, at a 60 s, 5 min or whole session zoom. **Export** pages the device, then merges in the dashboard's own live stream copy (up to 50000 records per session); it can stop early (for example an old build, the size cap, the page limit, or the device going quiet), and the downloaded report's notes say why anything is missing. The tab's feed shows the same call as the panel, so a new call replaces both. Earlier calls still show on **Live** and in search.
|
|
54
54
|
* **Database** — read-only browser for the on-device SQLite stores (pick a database, then a table, or run a read-only query). See the data-handling note below.
|
|
55
55
|
* **Preferences** — read-only browser for the on-device SharedPreferences files (pick a file, browse its keys, or search across every file at once).
|
|
56
56
|
* **Feature Flags** — live view of every feature flag and experiment the Slack app knows about, with its current effective value (ON/OFF for toggles, group name for experiments), its scope, and whether it is locally overridden; updates as they change on the device. Filter by name.
|
|
@@ -68,9 +68,19 @@ npx @slack/radar-mcp install-app
|
|
|
68
68
|
|
|
69
69
|
That writes `~/Applications/Slack Radar.app`. Open it once, then right-click its dock icon and choose **Options > Keep in Dock**.
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
The dashboard port is baked into the app at install time. To use a port other than `8100`, set it when you install, for example `SLACK_RADAR_WEB_PORT=8101 npx @slack/radar-mcp install-app`, and set the same `SLACK_RADAR_WEB_PORT` in your MCP server config so the tools and the app use the same dashboard. In Claude Code that is `-e` on the add command:
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
```bash
|
|
74
|
+
slack claude mcp add -s user slack-radar-mcp -e SLACK_RADAR_WEB_PORT=8101 -- npx -y @slack/radar-mcp@latest
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
If the server is already added, run `slack claude mcp remove -s user slack-radar-mcp` first, since `add` refuses a name that already exists. In a JSON config the port goes in the server entry's `"env"` object, as `"env": { "SLACK_RADAR_WEB_PORT": "8101" }`.
|
|
78
|
+
|
|
79
|
+
The native app also updates itself: when a newer version of the package is published, a launch rebuilds it in the background, and the update takes effect the next time you open it. That rebuild keeps the port the app was built with, or uses 8100 when that cannot be read. To change the port, run `install-app` again with the new `SLACK_RADAR_WEB_PORT`. Use **Check for Updates…** in the app's menu to check and install right away instead of waiting for the next launch.
|
|
80
|
+
|
|
81
|
+
Clicking it starts the dashboard if it is not already running (the server auto-closes about 6 minutes after the last tab closes, so this is the usual case), waits for the port, then shows it. If an older dashboard is still holding the port and nobody is using it, the app asks that one to stop first, so an upgrade does not leave you looking at the version you replaced. Quitting the app stops the dashboard it started, unless a Claude Code session or another window is still using it; a dashboard that was already running when the app launched is never stopped. If Xcode's command line tools are installed (`xcode-select --install`), `install-app` compiles a small native window for this: its own dock icon, its own process, no browser tab, no tab bar. Without a Swift toolchain it falls back to opening your default browser instead.
|
|
82
|
+
|
|
83
|
+
If the window cannot start the dashboard after a node upgrade, the app is holding a node path that the upgrade moved. Run this, then quit and reopen the app. It keeps the port the app already has; to change it, put `SLACK_RADAR_WEB_PORT=<port>` in front, matching your MCP server config.
|
|
74
84
|
|
|
75
85
|
```bash
|
|
76
86
|
npx -y @slack/radar-mcp@latest install-app
|
|
@@ -96,7 +106,7 @@ All optional. Set them on the process that runs the MCP server or the dashboard.
|
|
|
96
106
|
|
|
97
107
|
| Variable | Effect |
|
|
98
108
|
|---|---|
|
|
99
|
-
| `SLACK_RADAR_WEB_PORT` | Port the dashboard listens on. Default `8100`. |
|
|
109
|
+
| `SLACK_RADAR_WEB_PORT` | Port the dashboard listens on. Default `8100`. The dock app bakes it in at install time, so set it when you run `install-app`. |
|
|
100
110
|
| `SLACK_RADAR_DEVICE_PORT` | Host port forwarded to the device-side server. Default `8099`. |
|
|
101
111
|
| `SLACK_RADAR_NO_AUTO_CLOSE=1` | Keep the dashboard running forever instead of closing it once every tab is gone. |
|
|
102
112
|
| `SLACK_RADAR_ALLOWED_HOSTS` | Extra `Host` values the dashboard will answer, comma-separated (`radar.local,myhost:8100`). Only needed when you reach it by a name other than localhost. See Security. |
|
|
@@ -108,16 +118,16 @@ All optional. Set them on the process that runs the MCP server or the dashboard.
|
|
|
108
118
|
|
|
109
119
|
## Session Management
|
|
110
120
|
|
|
111
|
-
Radar starts **disabled** each session. All tools except `ping` return an error until enabled.
|
|
121
|
+
Radar starts **disabled** each session. All tools except `ping` return an error until enabled. `export_switchboard_session` also works after an auto-disable if this process streamed the call live.
|
|
112
122
|
|
|
113
123
|
| Command | Effect |
|
|
114
124
|
|---|---|
|
|
115
|
-
| `/radar-enable` | Activates ADB forwarding, device broadcast, SSE stream.
|
|
125
|
+
| `/radar-enable` | Activates ADB forwarding, device broadcast, SSE stream. A repeat on a live session checks the device first and runs the full setup again when that check fails or the last activation did not land, the device, token or profile changed, the timeout changes, or Radar is in open mode. For a clean reset run `/radar-disable`, then `/radar-enable`. |
|
|
116
126
|
| `/radar-disable` | Tears down stream, clears local buffers. Tools return "not active" error. |
|
|
117
127
|
|
|
118
|
-
**Auto-enable**: When you ask Claude an obvious device question (clogs, network calls, screenshots, app state, RTM events, logs), Claude
|
|
128
|
+
**Auto-enable**: When you ask Claude an obvious device question (clogs, network calls, screenshots, app state, RTM events, logs), Claude calls the tool first and enables only when a tool says Radar is not active or Session disabled. It enables once without asking and retries. If the enable or the retry fails it tells you and stops. One such answer per fresh session is expected.
|
|
119
129
|
|
|
120
|
-
**Auto-disable**: When the device-side radar shuts down after idle (default 5 min), the next tool call failure flips the session to disabled. Claude
|
|
130
|
+
**Auto-disable**: When the device-side radar shuts down after idle (default 5 min), the next tool call failure flips the session to disabled. Claude re-enables once without asking, then retries. If the enable or the retry fails it tells you and stops. `export_switchboard_session` still works after this: it builds the report from the live stream copy alone, with no device call, as long as this process streamed the call live. An explicit `/radar-disable` or `clear_buffers` wipes that copy.
|
|
121
131
|
|
|
122
132
|
## Tools
|
|
123
133
|
|
|
@@ -133,12 +143,13 @@ Radar starts **disabled** each session. All tools except `ping` return an error
|
|
|
133
143
|
| `get_clog_detail` | Full clog JSON payload for a specific event. |
|
|
134
144
|
| `get_recent_traces` | Performance trace/span summaries: trace name, span name, duration. Filterable by name substring. |
|
|
135
145
|
| `get_trace_detail` | Full trace/span detail for a specific trace, including tags. |
|
|
136
|
-
| `get_switchboard_sessions` | Slackbot voice (switchboard) sessions the device still holds, newest first: `session_id`, `team_id`, `began_at`, `ended_at`, record and frame counts, the newest state and audio levels. Ids restart with the app process. |
|
|
137
|
-
| `get_switchboard_session` | One voice session's summary plus its records, oldest first: `state` transitions, control frames (`frame`) in and out, `player` stutter events, `phase` startup timings, `session` begin and
|
|
146
|
+
| `get_switchboard_sessions` | Slackbot voice (switchboard) sessions the device still holds, newest first: `session_id`, `team_id`, `began_at`, `ended_at`, record and frame counts, the newest state and audio levels, `server_session_id` (the server's own name for the session, null until it names one; absent on an older build), `turns` (turn count, the newest response time and its clock, null before the first turn; absent on an older build), and `saved_turn_counts` (saved turns per outcome; absent on an older build means not counted, not zero). Ids restart with the app process. |
|
|
147
|
+
| `get_switchboard_session` | One voice session's summary plus its records, oldest first: `state` transitions, control frames (`frame`) in and out, `player` stutter events, `phase` startup timings, `session` begin/end/ready (`ready` carries `server_session_id`), `levels` (batched mic/playback meter ticks), `turn` (one timed voice turn: `response_ms` and `clock`), and `saved_turn` (whether a spoken turn got saved to the DM: `outcome` (`applied`, `no_line`, `missing_field`, `other_session`) and `has_thread`; the summary's `saved_turn_counts` counts each outcome, and absent on an older device build means not counted, not zero). Narrow with `kind`; `limit` is how many of the newest records come back (default 50, max 2000 per request; the device may hold more, paged with before_id), filtered by kind first, so a kind page is the newest `limit` records of that kind. |
|
|
148
|
+
| `export_switchboard_session` | Write one voice session's summary and its records to a plain-text report under `~/.slack-radar/exports/`, permissions 0700/0600 like `capture_snapshot`. Pages the device, then merges in the live stream copy; the export can stop early (for example an old build, the 32 MB size cap, the page limit, or the device stopping answering), and the report notes say why anything is missing. An unknown id (404, unreachable, or too large to read) errors unless this process streamed the call live, then the report comes from the live stream copy alone, whichever process ran the export, since this MCP server and the web dashboard each keep their own. Defaults to newest when `id` is omitted; returns the file path and a summary. |
|
|
138
149
|
| `wait_for_events` | Block until matching events arrive via SSE stream. Idle-timeout based, not polling. |
|
|
139
150
|
| `search` | Full-text search across network, RTM, clog, and trace buffers. |
|
|
140
151
|
| `get_app_state` | Current Activity/Fragment state via `dumpsys`. Shows visible screen, parameters, tab state. |
|
|
141
|
-
| `get_recent_logs` | Recent device logs, optionally filtered by tag (omit `tag` for all lines).
|
|
152
|
+
| `get_recent_logs` | Recent device logs, optionally filtered by tag (omit `tag` for all lines). Android reads the app's own debug buffer first, falling back to logcat (`app_buffer` / `logcat_capture` / `logcat_ring`); iOS Simulator reads a bounded live unified-log capture. The result's `source` identifies which one served it. |
|
|
142
153
|
| `list_profiles` | List the Android users and profiles on the device (personal, work, and so on). |
|
|
143
154
|
| `activate_for_user` | Activate radar for a specific Android user or profile. |
|
|
144
155
|
| `capture_snapshot` | Bundle the current network, RTM, clog, and trace buffers, plus an optional screenshot, into one saved snapshot for a bug report or repro. Switchboard voice records are not included. |
|
|
@@ -153,11 +164,53 @@ Radar starts **disabled** each session. All tools except `ping` return an error
|
|
|
153
164
|
| `list_feature_flags` | List every feature flag with its live effective value and override status. Optionally filtered to just the overridden ones. Boolean toggles carry `enabled`; multi-variant experiments carry `type: "experiment"` and a `group_name` string (the effective variant, e.g. `"treatment_a"`) instead. |
|
|
154
165
|
| `search_feature_flags` | Case-insensitive substring search on feature flag names, against the same live list as `list_feature_flags`. Rows carry the same `type`/`group_name` fields for experiments. |
|
|
155
166
|
| `get_feature_flag` | Look up one feature flag by its exact key. Returns one row per scope (authenticated/unauthenticated) and per signed-in org, since each workspace resolves its own value; pass `org_id` to narrow to one workspace. An experiment row carries `type: "experiment"` and its `group_name` variant rather than a boolean `enabled`. |
|
|
156
|
-
| `
|
|
167
|
+
| `run_test_case` | Replay a built-in or hand-written case. Pass `case`, optional `repeat` and `rate_per_second` (null for burst). Requires a debug build serving `test_runs`. |
|
|
168
|
+
| `get_test_run` | Read `run_id`, or list the last ten when omitted. Optional `wait_seconds` (max 45) polls until settled. It bounds when the last read may start; every read then gets 3 seconds. |
|
|
169
|
+
| `stop_test_run` | Stop `run_id`. Its counts stay readable with `get_test_run`. |
|
|
170
|
+
| `clear_buffers` | Clear all captured buffers (network, RTM, clog, trace, settled test runs) on the device and locally, and the switchboard copy `export_switchboard_session` falls back to. The session event spool `query_session` reads is kept. |
|
|
157
171
|
| `open_radar_dashboard` | Author or refine a custom live dashboard tab from a spec (source, filters, widgets, alerts). Suggested when a request is not covered by the pre-built tabs; not auto-invoked. Returns the dashboard URL; debug builds only, local only. |
|
|
158
|
-
| `_radar_session_enable` | Enable radar for the session.
|
|
172
|
+
| `_radar_session_enable` | Enable radar for the session. A repeat on a live session checks the device first. |
|
|
159
173
|
| `_radar_session_disable` | Disable radar for the session. Called by `/radar-disable` skill. |
|
|
160
174
|
|
|
175
|
+
### Test cases
|
|
176
|
+
|
|
177
|
+
Replay frames go into the app's own message handler on the device, not over the socket. Use a quiet workspace and a debug build that serves the `test_runs` source. Open a screen in a signed-in team first.
|
|
178
|
+
|
|
179
|
+
`message_changed` and `message_replied` seed a message, then edit it or update its reply count. Each event carries about 4 KB of made-up text. Both default to `repeat: 100`, `rate_per_second: 10`, so they send 200 frames over about 20 seconds. The rate counts every frame, including the seed. Frames per run = repeat × events.
|
|
180
|
+
|
|
181
|
+
Write custom cases to `~/.slack-radar/test-cases/<name>.json`, then pass the name or name.json. A file named like a built-in replaces it. Names use 1 to 64 letters, digits, underscores or hyphens. The file must be regular, at most 256 KB, and contain an object with an `events` array and a required `rate_per_second` key. Null means burst. Repeat defaults to 1. Call arguments override repeat and rate, including a null rate, but cannot rescue a file missing the rate key.
|
|
182
|
+
|
|
183
|
+
| Placeholder | Device fills it with |
|
|
184
|
+
|---|---|
|
|
185
|
+
| `{{test_channel}}` | The test channel |
|
|
186
|
+
| `{{seq_ts}}` | A run timestamp shared by a seed and its update |
|
|
187
|
+
| `{{frame_ts}}` | A timestamp for each frame |
|
|
188
|
+
| `{{seq_uuid}}` | A client message id shared by a seed and its update |
|
|
189
|
+
| `{{seq}}` | The iteration number |
|
|
190
|
+
|
|
191
|
+
This is a full `message_changed` file with the filler shortened.
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"repeat": 100,
|
|
196
|
+
"rate_per_second": 10,
|
|
197
|
+
"events": [
|
|
198
|
+
{"type":"message","channel":"{{test_channel}}","ts":"{{seq_ts}}","client_msg_id":"{{seq_uuid}}","text":"seed {{seq}}","user":"UZRDR0000001"},
|
|
199
|
+
{"type":"message","subtype":"message_changed","channel":"{{test_channel}}","message":{"ts":"{{seq_ts}}","text":"edit {{seq}}","client_msg_id":"{{seq_uuid}}"}}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The device accepts only message, message_changed and message_replied frames. Every channel must use `{{test_channel}}`. Timestamp fields must use run timestamps, thread_ts must equal ts, and client_msg_id must use `{{seq_uuid}}`. File ids must be test ids. User can be any id except your signed-in user. Leave out event_ts. The device rejects real channel and timestamp values and unresolved placeholders. Caps are 10,000 frames, 1 to 1,000 frames a second (or null burst), two minutes, 64 MB total UTF-8 template text and a 256 KB request body. Lower repeat does not shrink an oversized request body.
|
|
205
|
+
|
|
206
|
+
After `run_test_case`, call `get_test_run(run_id, wait_seconds)` until `settled` is true. A terminal state alone is not settled. The device waits two quiet seconds after the later of the run's end and its last counted event, and while frames are still pending it holds the run unsettled, at most ten seconds after the end; frames still pending at the cap count as `ignored`. A settling 409's `N ms left` is the quiet time left, or the hold time left once quiet. A frame already in its handler when a flush lands (the app backgrounded) gets a flushed span, which resolves it, so it neither holds the run nor reads as `ignored`; a frame still queued at that moment gets no span, so it holds the run to the ten second cap and reads as `ignored`. A capped wait returns a note to call again. List with no run_id if a run was evicted from the last ten (eleven while one is starting) or `clear_buffers` dropped it.
|
|
207
|
+
|
|
208
|
+
Trust summary only after settle. `ok` and `failed` count handler outcomes. `by_type` has per-type sent, ok, failed, p50_ms, p90_ms, p99_ms and max_ms. Percentiles need 100 counted events per type. Max needs one. Read dotted labels with bracket keys, such as `summary.by_type["MESSAGE.MESSAGE_CHANGED"]`.
|
|
209
|
+
|
|
210
|
+
`elapsed_ms`, `achieved_rate`, `drain_ms`, `held_ms` and `late_sends` are null before terminal. Drain is the last counted event minus the last send, null without an event or for a negative gap. Achieved rate includes the test-channel clear, so it can read low on a short burst. `other_events` counts other types and run types past their cap. `other_failed` means another handler threw. `failed_label` names a failed run type, which stops sending. `flushed` counts flush spans. Stop reasons are requested, time_cap, workspace_gone, run_failed, handler_failed or null. Error can be the cause's class name if its message is null. Sweep rates 10, 50, 100 and 1000 with repeat 100 to compare settled summaries.
|
|
211
|
+
|
|
212
|
+
A 400 names the refused frame with frame_index and template_index (0-based) and seq (1-based). A 409 active names active_run_id to wait for or stop. A 409 settling names milliseconds left to wait before retrying. Stop returns 202 while stopping, 200 once terminal, 404 unknown, or 409 while starting. When the start reply is lost (a resend's own listed-id 409, or a start that was sent and got no answer), the tool reads the run back and returns a listed run; a `starting` one carries a note that its frames are still being checked. A 404 on that read means the device holds no retained run: the frame check refused it, the request never arrived, or a run that did start settled and was then evicted or cleared, so the error says to call `run_test_case` again. A failed read-back says the run may have started: read it with `get_test_run` before starting another, and a 404 there most likely means it never started, so call `run_test_case` again. Builds declaring sources without test_runs are gated. Older builds without sources return the device's route error.
|
|
213
|
+
|
|
161
214
|
## Architecture
|
|
162
215
|
|
|
163
216
|
```
|
|
@@ -183,10 +236,19 @@ All device-specific logic lives behind the `DeviceTransport` interface (`src/sha
|
|
|
183
236
|
## Security
|
|
184
237
|
|
|
185
238
|
* **No TCP port on device.** Uses platform-specific local sockets, only reachable via port forwarding. Requires physical USB or explicit debug pairing.
|
|
239
|
+
* **Per-user device token.** The first Radar process that needs the token (MCP or dashboard) mints it at `~/.slack-radar/radar-token`, mode 0600, one per OS user, and every enable hands it to the device in the enable broadcast. Every request then carries it as `X-Radar-Token`. A device build with the token check answers 401 to anything else; older device builds ignore the extra and stay in open mode without saying so.
|
|
240
|
+
* What it stops: a browser page that reaches the forwarded port (DNS rebinding, or any page you visit), and another app on the device connecting to the abstract socket. Neither can read your `~/.slack-radar`.
|
|
241
|
+
* What it does not stop: anything with adb access. The adb server on `127.0.0.1:5037` has no auth, so any local process can send a tokenless enable and put the device back in open mode, read the token from host or device `ps` while the broadcast runs, or read it off the debuggable app with `run-as`. Processes running as you can read the file. The token keeps honest sessions apart; it does not lock out adb.
|
|
242
|
+
* Open mode is deliberate: an enable with no `radar_token` extra (an older Radar MCP or dashboard, or a hand-typed `am broadcast`) turns the check off so older builds keep working. The MCP warns on every enable result and every `ping` that finds the device in open mode. The dashboard does not warn.
|
|
243
|
+
* The token is never logged and never appears in an error. A failed broadcast reports adb's exit code and the first line of its stderr, with any token-shaped text redacted.
|
|
244
|
+
* The file is never replaced on a 401. Delete it only when a message says the file itself is unusable; then re-enable every other Radar session so they pick up the new one.
|
|
245
|
+
* Known limit: the dashboard forwards every device route (`/api`, `/flags`, `/backfill`, `/detail`) to the device with the token attached. Reads need only a local Host header; writes need an `X-Radar-Dashboard: 1` header or a JSON Content-Type. Any local process can send all of these, so while a dashboard runs, any local process reaches the device through it, writes included. Stop the dashboard when you are not using it.
|
|
246
|
+
* After upgrading: restart Claude Code and any open dashboard so every process sends the token, then run `/radar-enable`.
|
|
247
|
+
|
|
186
248
|
* **Debug builds only.** Release builds bind a no-op implementation. Server code is eliminated at compile time.
|
|
187
249
|
* **Lazy activation.** Dormant until explicitly triggered.
|
|
188
250
|
* **Auto-shutdown.** Device-side server shuts down after idle timeout (default 5 minutes). Zero cost when unused.
|
|
189
|
-
* **Dashboard auto-close.** Once a dashboard has been opened in a browser, the process shuts itself down
|
|
251
|
+
* **Dashboard auto-close.** Once a dashboard has been opened in a browser, the process shuts itself down about 6 minutes after the last tab closes, so a dashboard you walked away from does not linger. Opening a dashboard again (`open_radar_dashboard`, which writes a spec) pushes that deadline out by another grace window, but nothing else does: the other MCP tools read the device directly and never touch the dashboard, so a long agent session with no tab open will still close on schedule. Reopen it, or use the opt-out below, if you want it to stay. Two more exceptions: a dashboard that no tab has **ever** opened (one an agent spawned and nobody visited) stays up until you visit it once or stop it, because there is no "last tab closed" moment to measure from; and when you first upgrade to a version that has auto-close, **reload any tab that was already open**, because page code from before this feature does not report itself as present, so it will not keep the process alive even while you are looking at it. Reloading once is enough; later upgrades do not need it. Click **⏻ Stop dashboard** in the header to stop it immediately instead (click twice to confirm, since it kills the process with no undo). Set `SLACK_RADAR_NO_AUTO_CLOSE=1` to turn auto-close off entirely.
|
|
190
252
|
* **Keep-alive is not forgeable from a web page.** Only the dashboard's own client and the MCP can postpone auto-close. A write to `/setspec` or `/enable` has to carry `X-Radar-Dashboard: 1`, or a content-type whose type is exactly `application/json`; the `/health` presence ping requires the header specifically, since a content-type says nothing about a request with no body. A cross-origin request cannot set either one without a CORS preflight it will fail. A request without either still works and still writes, it just does not extend the process lifetime, so `curl -X POST .../setspec -H 'Content-Type: text/plain'` sets the spec but will not stop the dashboard closing on schedule; use `-H 'Content-Type: application/json'` if you want it to count. This is a CSRF guard, not authentication: any local process can send either header, and the port is loopback-only by design.
|
|
191
253
|
* **Loopback `Host` only.** The dashboard answers a request only when its `Host` header names this machine (`localhost`, `127.0.0.1`, `[::1]`, `0.0.0.0`, with or without a port). Anything else gets a 403 whose body names the host it refused and how to allow it. Binding to 127.0.0.1 alone is not enough: a page that resolves its own domain to 127.0.0.1 connects locally, counts as same-origin in the browser, and could otherwise set the header above and stop your dashboard. If you reach the dashboard by some other name — a `/etc/hosts` alias, a container or Codespaces forwarded URL, your machine's LAN hostname — list it in `SLACK_RADAR_ALLOWED_HOSTS` (comma-separated, host or `host:port`). A plain SSH or VS Code port forward needs nothing, because the `Host` stays `localhost`.
|
|
192
254
|
|
|
@@ -198,6 +260,7 @@ What gets captured depends on the in-app server implementation. The MCP server i
|
|
|
198
260
|
* **RTM events**: WebSocket listener. Ring buffer: 2000 events.
|
|
199
261
|
* **Clogs**: Analytics interceptor. Ring buffer: 1000 events. Persists across radar activation cycles.
|
|
200
262
|
* **Traces**: Performance span observer. Ring buffer: 2000 spans. Persists across radar activation cycles.
|
|
263
|
+
* **Test runs**: Made-up RTM replay frames sent to the app's handler. The device keeps the last ten run summaries, with settled counts and per-type timings.
|
|
201
264
|
* **SQLite database** (Database tab, web dashboard only): when you open a database, a read-only **plaintext** copy of that on-device store (message text, request/response bodies, user/channel/team IDs) is pulled to a temp directory **on your own machine** (`os.tmpdir()/slack-radar-db-<port>`, files mode 0600). Auto-deleted when the dashboard process stops.
|
|
202
265
|
* **SharedPreferences** (`list_prefs`/`get_prefs`/`search_prefs`, and the Preferences tab): read directly off the device over `adb`, no local copy written. Files can contain feature flag overrides, cached team/org/channel IDs, and other app state.
|
|
203
266
|
* **Feature flags** (`list_feature_flags`/`search_feature_flags`/`get_feature_flag`): read directly off the device over `adb`, no local copy written. Shows every flag's live effective value and whether it is locally overridden.
|
|
@@ -247,9 +310,32 @@ SLACK_RADAR_PLATFORM=ios npm run start:web
|
|
|
247
310
|
```
|
|
248
311
|
|
|
249
312
|
Within the selected platform, Radar chooses the sole running device or shows the device picker
|
|
250
|
-
when several are available. It never probes the other platform. iOS
|
|
251
|
-
|
|
252
|
-
|
|
313
|
+
when several are available. It never probes the other platform. iOS supports live Simulator
|
|
314
|
+
logs through MCP and the dashboard, screenshots, screen mirroring, and recording via `simctl`.
|
|
315
|
+
After verifying that the shared host port belongs to the selected iOS app, Radar also enables
|
|
316
|
+
the HTTP tools for network calls, RTM events, clogs, traces, and feature flags.
|
|
317
|
+
|
|
318
|
+
### iOS Simulator logs
|
|
319
|
+
|
|
320
|
+
Enable the MCP session before you reproduce the issue, then call `get_recent_logs`. Capture
|
|
321
|
+
starts at enable and covers unified logs from subsystems under `com.tinyspeck`; nothing logged
|
|
322
|
+
before that point can be recovered. Results report `source: "ios_unified_capture"`.
|
|
323
|
+
|
|
324
|
+
* **`tag`** is a case-sensitive substring match on a line's category. Lines logged without a
|
|
325
|
+
category use their subsystem, or failing that the process name. `grep` searches every field
|
|
326
|
+
of the line (message, tag, subsystem, process, level, pid), ignoring case.
|
|
327
|
+
* **Levels** map Debug → DEBUG, Info and Default → INFO, Error → ERROR and Fault → FATAL.
|
|
328
|
+
Unified logging has no warning level, so a WARN filter matches nothing on iOS.
|
|
329
|
+
* **The dashboard** Live and Logs tabs run their own capture, separate from the MCP session's,
|
|
330
|
+
and replay what it has retained when you reconnect.
|
|
331
|
+
|
|
332
|
+
Physical iOS devices are not supported yet.
|
|
333
|
+
|
|
334
|
+
### Log retention
|
|
335
|
+
|
|
336
|
+
Android logcat and iOS unified-log capture share one host ring per process: up to 20,000
|
|
337
|
+
records or about 10 MiB, whichever comes first, with the oldest records dropped first. A single
|
|
338
|
+
record over 1 MiB is discarded.
|
|
253
339
|
|
|
254
340
|
## Troubleshooting
|
|
255
341
|
|
|
@@ -262,6 +348,12 @@ The device-side server may have auto-shut down. Use `/radar-enable` to restart i
|
|
|
262
348
|
**"Session disabled"**
|
|
263
349
|
Two consecutive connection failures disable the session. Use `/radar-enable` to reconnect.
|
|
264
350
|
|
|
351
|
+
**"The device is in open mode"**
|
|
352
|
+
An older Radar MCP or dashboard, or a manual `am broadcast`, enabled the device without a token. If an older Radar MCP or dashboard is still running, stop it, then run `/radar-enable`. After an enable, the warning names this enable's failed broadcast or the profile mismatch instead. The MCP warns on every enable result and every `ping` that finds the device open; the dashboard does not warn.
|
|
353
|
+
|
|
354
|
+
**"The device holds a different token than this session's"** (the dashboard says "This device answered to a different Radar token")
|
|
355
|
+
Another Radar session enabled the device after you did: another machine or OS user, a session using a token file you deleted, or Radar enabled in a different profile. Stop that session, or run `/radar-enable` in it so it picks up the new file, or make sure the Slack debug build runs in the profile you want (`list_profiles` shows which do), then run `/radar-enable` here (on the dashboard, press Reconnect). Deleting `~/.slack-radar/radar-token` never fixes this.
|
|
356
|
+
|
|
265
357
|
**Devices with more than one user (e.g. a work profile)**
|
|
266
358
|
The MCP server auto-detects the Android user ID via `ps` and targets the broadcast accordingly. No manual `--user` flag needed. In the dashboard's Logs tab, the package filter narrows logcat to the Slack app; clear the chip or pick another package to widen it.
|
|
267
359
|
|
|
@@ -274,7 +366,11 @@ If a Radar dashboard is already running on the port, launching again just opens
|
|
|
274
366
|
**The dashboard shows the version you just replaced**
|
|
275
367
|
That badge reports the version of the process serving the port, not the app or package you installed. Installing does not touch a server that is already running, so an older dashboard can keep serving after an upgrade.
|
|
276
368
|
|
|
277
|
-
The
|
|
369
|
+
The `open_radar_dashboard` tool checks this too. `stale_dashboard: true` means the dashboard server is older than this MCP server. A dashboard older than 1.6.0 reports no version, so it also gets `stale_dashboard: true`, just without `dashboard_version`. `stale_mcp: true` means the dashboard server is newer. Both come with `mcp_version`. When either version could not be read, `stale_dashboard` is `null`, `stale_mcp` is absent, and the null covers both directions.
|
|
370
|
+
|
|
371
|
+
The app also leaves an older dashboard alone on purpose when somebody else is using it, either a Claude Code session or another window with it open. A refresh (⌘R in the app window, or Retry on its failure page) tries to take it from a window, or from a dashboard too old to say who is using it, and never from a Claude Code session the dashboard names; taking it costs that window its page, and everyone the server's pulled databases, device pin and logcat ring. `~/Library/Logs/slack-radar-dashboard.log` names which one it found, and what a refresh will do about it.
|
|
372
|
+
|
|
373
|
+
The app window also says so in a strip at the top of the page when a launch or refresh keeps an older dashboard, or takes one from somebody. The strip has a short version of the log line and can be dismissed. If a refresh asked the older one to stop and the new dashboard then does not come up, the failure page says instead that the older one was asked to stop.
|
|
278
374
|
|
|
279
375
|
Ask the two surfaces separately. The installed dock app:
|
|
280
376
|
|
package/dist/mcp/api-paths.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SWITCHBOARD_KINDS, type SwitchboardKind } from "../shared/switchboard.js";
|
|
1
|
+
import { SWITCHBOARD_KINDS, nonNegativeIntArg, type SwitchboardKind } from "../shared/switchboard.js";
|
|
2
2
|
export { SWITCHBOARD_KINDS, type SwitchboardKind };
|
|
3
3
|
export declare const SWITCHBOARD_DEFAULT_LIMIT = 50;
|
|
4
4
|
export declare const SWITCHBOARD_MAX_LIMIT = 2000;
|
|
5
|
-
export
|
|
5
|
+
export { nonNegativeIntArg };
|
|
6
6
|
export declare function switchboardSessionQuery(args: Record<string, unknown>): {
|
|
7
7
|
path: string;
|
|
8
8
|
} | {
|
package/dist/mcp/api-paths.js
CHANGED
|
@@ -6,30 +6,15 @@
|
|
|
6
6
|
//
|
|
7
7
|
// The arg shapes here are the query-param subset each tool sends; they intentionally duplicate
|
|
8
8
|
// the (wider) handler arg interfaces in index.ts rather than couple this pure module to them.
|
|
9
|
-
import { switchboardListPath, switchboardSessionPath, SWITCHBOARD_KINDS } from "../shared/switchboard.js";
|
|
9
|
+
import { switchboardListPath, switchboardSessionPath, SWITCHBOARD_KINDS, nonNegativeIntArg } from "../shared/switchboard.js";
|
|
10
10
|
// The record kinds the device's switchboard page filters on. Lower-case here; the device matches
|
|
11
11
|
// case-insensitively, so the query is sent normalized.
|
|
12
12
|
export { SWITCHBOARD_KINDS };
|
|
13
|
-
// The device pages at 50 without a limit and
|
|
13
|
+
// The device pages at 50 without a limit and answers up to 2000 per request; it may hold more
|
|
14
|
+
// per session, reachable only by paging with before_id.
|
|
14
15
|
export const SWITCHBOARD_DEFAULT_LIMIT = 50;
|
|
15
16
|
export const SWITCHBOARD_MAX_LIMIT = 2000;
|
|
16
|
-
|
|
17
|
-
// a number or as a clean digit string (the SDK casts args without enforcing the schema, so "7"
|
|
18
|
-
// arrives as a string). Whitespace around the digits is trimmed like clampSwitchboardLimit does.
|
|
19
|
-
// Anything else (negative, fractional, 1e21, "7/../x", objects, arrays, booleans) is refused.
|
|
20
|
-
export function nonNegativeIntArg(v) {
|
|
21
|
-
let n;
|
|
22
|
-
if (typeof v === "number") {
|
|
23
|
-
n = v;
|
|
24
|
-
}
|
|
25
|
-
else if (typeof v === "string" && /^\d+$/.test(v.trim())) {
|
|
26
|
-
n = Number(v.trim());
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
return Number.isSafeInteger(n) && n >= 0 ? n : null;
|
|
32
|
-
}
|
|
17
|
+
export { nonNegativeIntArg };
|
|
33
18
|
// What a refused argument looks like in an error: JSON, cut at 80 characters so a huge argument
|
|
34
19
|
// does not become a huge error.
|
|
35
20
|
const ECHO_MAX = 80;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface DashboardHealthIdentity {
|
|
2
|
+
platform?: string;
|
|
3
|
+
device_serial?: string | null;
|
|
4
|
+
}
|
|
5
|
+
/** Whether an existing dashboard process belongs to this MCP transport and selected device. */
|
|
6
|
+
export declare function dashboardMatchesDevice(platform: string, selectedSerial: string | null | undefined, health: DashboardHealthIdentity): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Whether an existing dashboard process belongs to this MCP transport and selected device. */
|
|
2
|
+
export function dashboardMatchesDevice(platform, selectedSerial, health) {
|
|
3
|
+
// A dashboard started before /health carried `platform` (1.21.0 and earlier) is Android-only,
|
|
4
|
+
// so a missing field reads as android rather than as a mismatch.
|
|
5
|
+
if ((health.platform ?? "android") !== platform)
|
|
6
|
+
return false;
|
|
7
|
+
if (selectedSerial && health.device_serial && selectedSerial !== health.device_serial) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return true;
|
|
11
|
+
}
|