@slack/radar-mcp 1.22.0 → 1.24.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 +62 -12
- package/dist/mcp/dashboard-identity.d.ts +10 -0
- package/dist/mcp/dashboard-identity.js +20 -0
- package/dist/mcp/debug-package-reset.d.ts +5 -0
- package/dist/mcp/debug-package-reset.js +28 -0
- package/dist/mcp/flags-tools.d.ts +2 -0
- package/dist/mcp/flags-tools.js +15 -1
- package/dist/mcp/index.js +172 -142
- package/dist/mcp/radar-http.d.ts +22 -0
- package/dist/mcp/radar-http.js +63 -0
- package/dist/mcp/radar-response.d.ts +1 -0
- package/dist/mcp/session-enable.d.ts +15 -0
- package/dist/mcp/session-enable.js +195 -33
- package/dist/mcp/sources-gate.js +5 -0
- package/dist/mcp/switchboard-tools.d.ts +5 -2
- package/dist/mcp/switchboard-tools.js +18 -12
- 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.js +106 -171
- package/dist/mcp/web-child-env.js +2 -1
- package/dist/shared/android.d.ts +75 -10
- package/dist/shared/android.js +352 -109
- package/dist/shared/constants.d.ts +17 -5
- package/dist/shared/constants.js +59 -5
- package/dist/shared/db.d.ts +1 -1
- package/dist/shared/db.js +21 -14
- package/dist/shared/debug-log.js +2 -4
- package/dist/shared/enable-diagnosis.d.ts +27 -1
- package/dist/shared/enable-diagnosis.js +73 -0
- package/dist/shared/log-session.d.ts +2 -1
- package/dist/shared/logcat-capture.js +17 -1
- package/dist/shared/prefs.js +4 -5
- package/dist/shared/radar-request-raw.js +3 -1
- package/dist/shared/switchboard.d.ts +1 -0
- package/dist/shared/switchboard.js +3 -1
- package/dist/shared/transport.d.ts +30 -0
- package/dist/web/install-app.d.ts +18 -0
- package/dist/web/install-app.js +60 -7
- package/dist/web/macapp/RadarApp.swift +147 -1
- package/dist/web/server.d.ts +17 -0
- package/dist/web/server.js +180 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ slack claude mcp add -s user slack-radar-mcp -e SLACK_RADAR_WEB_PORT=8101 -- npx
|
|
|
76
76
|
|
|
77
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
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`.
|
|
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
80
|
|
|
81
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
82
|
|
|
@@ -108,6 +108,7 @@ All optional. Set them on the process that runs the MCP server or the dashboard.
|
|
|
108
108
|
|---|---|
|
|
109
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`. |
|
|
110
110
|
| `SLACK_RADAR_DEVICE_PORT` | Host port forwarded to the device-side server. Default `8099`. |
|
|
111
|
+
| `SLACK_RADAR_DEBUG_PACKAGE` | The Slack debug package to arm, like `com.Slack.intune.debug`. Set it when two Slack debug builds run on one profile; it must be a Slack debug app id, like `com.Slack.intune.debug` or `com.Slack.debug`. Auto-detect knows the four shipped ids (`com.Slack.internal.debug`, `com.Slack.intune.debug`, `com.Slack.prototype.debug`, `com.Slack.debug`); any other debug app id needs this variable. Unset, Radar uses the one shipped debug build running, else `com.Slack.internal.debug`. The build is decided when the session enables or switches profile and held through re-arms; if it has gone by a re-arm, the re-arm sends nothing to another build, and when nothing else answers the session asks you to enable again. |
|
|
111
112
|
| `SLACK_RADAR_NO_AUTO_CLOSE=1` | Keep the dashboard running forever instead of closing it once every tab is gone. |
|
|
112
113
|
| `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. |
|
|
113
114
|
| `SLACK_RADAR_NO_ARM=1` | Never arm the device without a press: skips the arm at launch and turns off a tab's automatic re-enable. A Reconnect press still arms. |
|
|
@@ -122,12 +123,12 @@ Radar starts **disabled** each session. All tools except `ping` return an error
|
|
|
122
123
|
|
|
123
124
|
| Command | Effect |
|
|
124
125
|
|---|---|
|
|
125
|
-
| `/radar-enable` | Activates ADB forwarding, device broadcast, SSE stream.
|
|
126
|
+
| `/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`. |
|
|
126
127
|
| `/radar-disable` | Tears down stream, clears local buffers. Tools return "not active" error. |
|
|
127
128
|
|
|
128
|
-
**Auto-enable**: When you ask Claude an obvious device question (clogs, network calls, screenshots, app state, RTM events, logs), Claude
|
|
129
|
+
**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.
|
|
129
130
|
|
|
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
|
|
131
|
+
**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.
|
|
131
132
|
|
|
132
133
|
## Tools
|
|
133
134
|
|
|
@@ -161,14 +162,56 @@ Radar starts **disabled** each session. All tools except `ping` return an error
|
|
|
161
162
|
| `list_prefs` | List the app's on-device SharedPreferences files. Read-only. |
|
|
162
163
|
| `get_prefs` | Read a preferences file's keys and values, optionally filtered to specific keys. |
|
|
163
164
|
| `search_prefs` | Search preference keys and values across every file by a substring. |
|
|
164
|
-
| `list_feature_flags` | List every feature flag with its
|
|
165
|
+
| `list_feature_flags` | List every feature flag with its latest effective value and override status; toggle rows also carry `session_enabled`, the flag's own value fixed for this session. 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. |
|
|
165
166
|
| `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. |
|
|
166
167
|
| `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`. |
|
|
167
|
-
| `
|
|
168
|
+
| `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`. |
|
|
169
|
+
| `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. |
|
|
170
|
+
| `stop_test_run` | Stop `run_id`. Its counts stay readable with `get_test_run`. |
|
|
171
|
+
| `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. |
|
|
168
172
|
| `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. |
|
|
169
|
-
| `_radar_session_enable` | Enable radar for the session.
|
|
173
|
+
| `_radar_session_enable` | Enable radar for the session. A repeat on a live session checks the device first. |
|
|
170
174
|
| `_radar_session_disable` | Disable radar for the session. Called by `/radar-disable` skill. |
|
|
171
175
|
|
|
176
|
+
### Test cases
|
|
177
|
+
|
|
178
|
+
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.
|
|
179
|
+
|
|
180
|
+
`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.
|
|
181
|
+
|
|
182
|
+
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.
|
|
183
|
+
|
|
184
|
+
| Placeholder | Device fills it with |
|
|
185
|
+
|---|---|
|
|
186
|
+
| `{{test_channel}}` | The test channel |
|
|
187
|
+
| `{{seq_ts}}` | A run timestamp shared by a seed and its update |
|
|
188
|
+
| `{{frame_ts}}` | A timestamp for each frame |
|
|
189
|
+
| `{{seq_uuid}}` | A client message id shared by a seed and its update |
|
|
190
|
+
| `{{seq}}` | The iteration number |
|
|
191
|
+
|
|
192
|
+
This is a full `message_changed` file with the filler shortened.
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"repeat": 100,
|
|
197
|
+
"rate_per_second": 10,
|
|
198
|
+
"events": [
|
|
199
|
+
{"type":"message","channel":"{{test_channel}}","ts":"{{seq_ts}}","client_msg_id":"{{seq_uuid}}","text":"seed {{seq}}","user":"UZRDR0000001"},
|
|
200
|
+
{"type":"message","subtype":"message_changed","channel":"{{test_channel}}","message":{"ts":"{{seq_ts}}","text":"edit {{seq}}","client_msg_id":"{{seq_uuid}}"}}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
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.
|
|
206
|
+
|
|
207
|
+
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.
|
|
208
|
+
|
|
209
|
+
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"]`.
|
|
210
|
+
|
|
211
|
+
`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.
|
|
212
|
+
|
|
213
|
+
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.
|
|
214
|
+
|
|
172
215
|
## Architecture
|
|
173
216
|
|
|
174
217
|
```
|
|
@@ -194,10 +237,16 @@ All device-specific logic lives behind the `DeviceTransport` interface (`src/sha
|
|
|
194
237
|
## Security
|
|
195
238
|
|
|
196
239
|
* **No TCP port on device.** Uses platform-specific local sockets, only reachable via port forwarding. Requires physical USB or explicit debug pairing.
|
|
197
|
-
* **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
|
|
240
|
+
* **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. Every request carries it as `X-Radar-Token`; a device build with the token check answers 401 to anything else. How an enable hands it to the device:
|
|
241
|
+
* First Radar checks `ps` for a debug build running as the target Android user. Nothing running there: nothing is written or sent, and the enable fails with "no debug build of the Slack app is running in Android user N; open it there and retry" (just "...is running; open it and retry" when ps saw no build and no user was asked for), from `/radar-enable`, `activate_for_user` and the dashboard alike. Open Slack in that profile first; `activate_for_user` only picks the profile, it cannot start the app.
|
|
242
|
+
* File path (the default): the token goes over stdin with `run-as` into the app's private `files/slack-radar/enable-token` (mode 0600), then `slack.debug.ENABLE_RADAR_TOKEN_FILE` is sent with no token extra; the app reads and deletes the file inside the broadcast. This path keeps the token off every command line.
|
|
243
|
+
* Argv fallback, the old `ENABLE_RADAR --es radar_token` enable, visible in `ps` and adbd's log while it runs, when a debug build is running (or `ps` could not tell) and one of these holds:
|
|
244
|
+
* the `run-as` write failed, timed out or printed no `written` verdict (the build is not debuggable in that profile, or this adb cannot run `run-as --user`); Radar removes anything that landed first. The device's ping says nothing about this case: `token_file: true` only means the build has the action;
|
|
245
|
+
* the file was still there after the broadcast: the build predates the action, or the app failed to delete it; Radar removes it, checks `ps` once more, and sends nothing if the app has stopped meanwhile. The enable result (`_radar_session_enable`, `activate_for_user`) carries `token_via_argv` with the reason when the token rode argv; the key is absent when it did not.
|
|
246
|
+
* One argv enable exposes the long-lived token. `token_via_argv` covers only the enable that returned it; a background re-arm (any Radar tool call, the dashboard boot arm) or a dashboard enable can fall back too, and an argv broadcast that fails after `am` ran can still have exposed the token. To check from outside, watch `adb shell ps -A | grep radar_token` during the enable.
|
|
198
247
|
* 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`.
|
|
199
|
-
* 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
|
|
200
|
-
* Open mode is deliberate: an
|
|
248
|
+
* 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_RADAR` and put the device back in open mode, read the private token file with `run-as` in the moment before the app consumes it, or see the token in host or device `ps` during an argv fallback. Processes running as you can read the host file. The token keeps honest sessions apart; it does not lock out adb.
|
|
249
|
+
* Open mode is deliberate: an `ENABLE_RADAR` broadcast 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. `ENABLE_RADAR_TOKEN_FILE` never opens a tokenless session: a refused file is logged and the session kept as it was, and a build that predates the action drops the broadcast. The MCP warns on every enable result and every `ping` that finds the device in open mode. The dashboard does not warn.
|
|
201
250
|
* 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.
|
|
202
251
|
* 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.
|
|
203
252
|
* 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.
|
|
@@ -218,9 +267,10 @@ What gets captured depends on the in-app server implementation. The MCP server i
|
|
|
218
267
|
* **RTM events**: WebSocket listener. Ring buffer: 2000 events.
|
|
219
268
|
* **Clogs**: Analytics interceptor. Ring buffer: 1000 events. Persists across radar activation cycles.
|
|
220
269
|
* **Traces**: Performance span observer. Ring buffer: 2000 spans. Persists across radar activation cycles.
|
|
270
|
+
* **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.
|
|
221
271
|
* **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.
|
|
222
272
|
* **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.
|
|
223
|
-
* **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
|
|
273
|
+
* **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 latest effective value, the flag's own value fixed for this session where the build reports it, and whether it is locally overridden.
|
|
224
274
|
|
|
225
275
|
The network, RTM, clog, and trace captures are in-memory ring buffers. The Database tab is the exception: it writes a plaintext copy of the selected on-device database to a temp file on your host for the duration of the session. Review before sharing anything from it.
|
|
226
276
|
|
|
@@ -312,7 +362,7 @@ An older Radar MCP or dashboard, or a manual `am broadcast`, enabled the device
|
|
|
312
362
|
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.
|
|
313
363
|
|
|
314
364
|
**Devices with more than one user (e.g. a work profile)**
|
|
315
|
-
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.
|
|
365
|
+
The MCP server auto-detects the Android user ID via `ps` and targets the broadcast accordingly. No manual `--user` flag needed while `ps` finds the app running in that profile; open it there first, and use `activate_for_user` when `ps` cannot tell. When Slack debug builds run in several profiles, `SLACK_RADAR_DEBUG_PACKAGE` wins in every one. Unset, an enable arms the build the last enable chose (`com.Slack.internal.debug` on the first enable) wherever it runs, a non-zero profile first, and takes another shipped debug build only when that preferred one runs in no profile. Re-arms stay on the build the enable armed, and `activate_for_user` arms another profile. 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.
|
|
316
366
|
|
|
317
367
|
**Tools not appearing after setup**
|
|
318
368
|
Restart your Claude Code session. MCP servers are registered at session start.
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
export interface DashboardHealthIdentity {
|
|
2
2
|
platform?: string;
|
|
3
3
|
device_serial?: string | null;
|
|
4
|
+
log_package?: string;
|
|
5
|
+
device?: boolean;
|
|
4
6
|
}
|
|
5
7
|
/** Whether an existing dashboard process belongs to this MCP transport and selected device. */
|
|
6
8
|
export declare function dashboardMatchesDevice(platform: string, selectedSerial: string | null | undefined, health: DashboardHealthIdentity): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Error text when a running dashboard reads a different Slack debug build than this armed MCP,
|
|
11
|
+
* else null. Unarmed, the MCP has no fresher answer than the dashboard (a human-launched one may
|
|
12
|
+
* have detected its own build), and a dashboard that does not report log_package is older. A dashboard
|
|
13
|
+
* that could not see the socket has no build to be wrong about, and its next poll adopts the owner,
|
|
14
|
+
* but only a shipped id: an override build is never adopted, so that case is refused as before.
|
|
15
|
+
*/
|
|
16
|
+
export declare function dashboardDebugPackageError(armed: boolean, ourPackage: string, health: DashboardHealthIdentity): string | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEBUG_PACKAGE_ENV, SHIPPED_DEBUG_PACKAGES } from "../shared/constants.js";
|
|
1
2
|
/** Whether an existing dashboard process belongs to this MCP transport and selected device. */
|
|
2
3
|
export function dashboardMatchesDevice(platform, selectedSerial, health) {
|
|
3
4
|
// A dashboard started before /health carried `platform` (1.21.0 and earlier) is Android-only,
|
|
@@ -9,3 +10,22 @@ export function dashboardMatchesDevice(platform, selectedSerial, health) {
|
|
|
9
10
|
}
|
|
10
11
|
return true;
|
|
11
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Error text when a running dashboard reads a different Slack debug build than this armed MCP,
|
|
15
|
+
* else null. Unarmed, the MCP has no fresher answer than the dashboard (a human-launched one may
|
|
16
|
+
* have detected its own build), and a dashboard that does not report log_package is older. A dashboard
|
|
17
|
+
* that could not see the socket has no build to be wrong about, and its next poll adopts the owner,
|
|
18
|
+
* but only a shipped id: an override build is never adopted, so that case is refused as before.
|
|
19
|
+
*/
|
|
20
|
+
export function dashboardDebugPackageError(armed, ourPackage, health) {
|
|
21
|
+
if (!armed || !health.log_package || health.log_package === ourPackage)
|
|
22
|
+
return null;
|
|
23
|
+
if (health.device !== true && SHIPPED_DEBUG_PACKAGES.includes(ourPackage))
|
|
24
|
+
return null;
|
|
25
|
+
// A restart adopts the armed build at boot, but only for a shipped id; any other id came from
|
|
26
|
+
// an override, so the restarted dashboard needs it in its own environment.
|
|
27
|
+
const restart = SHIPPED_DEBUG_PACKAGES.includes(ourPackage)
|
|
28
|
+
? "Restart the dashboard or use a separate SLACK_RADAR_WEB_PORT."
|
|
29
|
+
: `Restart the dashboard with ${DEBUG_PACKAGE_ENV}=${ourPackage} in its environment, or use a separate SLACK_RADAR_WEB_PORT.`;
|
|
30
|
+
return `The dashboard reads ${health.log_package} but this session armed ${ourPackage}. ${restart}`;
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Session data (ring buffers, the event spool, cached flags) belongs to one Slack debug build.
|
|
2
|
+
// A re-enable or profile switch on the same device can land on another build, whose event ids restart from zero
|
|
3
|
+
// and would collide with the old ones in the spool's have-set. Kept out of index.ts (which
|
|
4
|
+
// connects stdio at load) so it is testable; the effects are injected. Only the enable and the
|
|
5
|
+
// profile switch check; a re-arm targets the held build and never lands here.
|
|
6
|
+
export function createDebugPackageReset(currentPackage, reset, startSpool) {
|
|
7
|
+
let held = null;
|
|
8
|
+
// Reads the package at call time, never captured, since an arm can change it.
|
|
9
|
+
const check = () => {
|
|
10
|
+
const pkg = currentPackage();
|
|
11
|
+
if (held !== null && held !== pkg)
|
|
12
|
+
reset();
|
|
13
|
+
held = pkg;
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
check,
|
|
17
|
+
// The enable's spool start: reset first, so the spool opens on a fresh file and the backfill
|
|
18
|
+
// that follows builds its have-set from it.
|
|
19
|
+
startSpool() {
|
|
20
|
+
check();
|
|
21
|
+
startSpool();
|
|
22
|
+
},
|
|
23
|
+
// A device switch already resets everything, so the next arm must not reset twice.
|
|
24
|
+
forget() {
|
|
25
|
+
held = null;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
package/dist/mcp/flags-tools.js
CHANGED
|
@@ -54,7 +54,21 @@ function wellFormedRows(response) {
|
|
|
54
54
|
return [];
|
|
55
55
|
return raw
|
|
56
56
|
.filter((f) => typeof f === "object" && f !== null && typeof f.key === "string")
|
|
57
|
-
.map(dropEmptyOrg)
|
|
57
|
+
.map(dropEmptyOrg)
|
|
58
|
+
.map(withRestartNote);
|
|
59
|
+
}
|
|
60
|
+
// A flag the app read once keeps that value until restart, so `enabled` (latest or override) can
|
|
61
|
+
// differ from what the app runs. Only two real booleans that differ earn a note: an absent or
|
|
62
|
+
// non-boolean session_enabled is "not known", and saying nothing there is the honest answer.
|
|
63
|
+
function withRestartNote(f) {
|
|
64
|
+
// Dropped first so a device that sent its own note cannot pass it through: only this function
|
|
65
|
+
// writes it, and only for a real mismatch.
|
|
66
|
+
const { restart_note: _dropped, ...row } = f;
|
|
67
|
+
const { enabled, session_enabled: session } = row;
|
|
68
|
+
if (typeof enabled !== "boolean" || typeof session !== "boolean" || enabled === session)
|
|
69
|
+
return row;
|
|
70
|
+
const source = isOverridden(f) ? "override" : "fetched";
|
|
71
|
+
return { ...row, restart_note: `app uses ${session} until restart, ${source} ${enabled}` };
|
|
58
72
|
}
|
|
59
73
|
// An empty org id means the same thing as no org id, so it is dropped rather than treated as a
|
|
60
74
|
// distinct org a caller could match or that an error message would render as a blank name. Same
|