@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.
- package/README.md +75 -17
- package/dist/mcp/api-paths.d.ts +11 -0
- package/dist/mcp/api-paths.js +56 -20
- package/dist/mcp/dashboard-identity.d.ts +6 -0
- package/dist/mcp/dashboard-identity.js +11 -0
- package/dist/mcp/index.js +138 -36
- package/dist/mcp/logs-result.d.ts +1 -0
- package/dist/mcp/logs-result.js +1 -0
- package/dist/mcp/network-detail.d.ts +5 -0
- package/dist/mcp/network-detail.js +86 -0
- package/dist/mcp/radar-export-get.d.ts +30 -0
- package/dist/mcp/radar-export-get.js +49 -0
- package/dist/mcp/radar-response.d.ts +11 -1
- package/dist/mcp/radar-response.js +23 -3
- package/dist/mcp/session-backfill.d.ts +9 -3
- package/dist/mcp/session-backfill.js +76 -17
- package/dist/mcp/session-detail.js +54 -2
- package/dist/mcp/session-enable.d.ts +1 -0
- package/dist/mcp/session-enable.js +146 -15
- package/dist/mcp/session-query.js +53 -11
- package/dist/mcp/snapshot.js +42 -26
- package/dist/mcp/sources-gate.js +5 -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 +18 -0
- package/dist/mcp/switchboard-tools.js +178 -0
- package/dist/mcp/tools.d.ts +4 -1
- package/dist/mcp/tools.js +114 -23
- 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 +43 -0
- package/dist/shared/android.js +227 -19
- package/dist/shared/constants.d.ts +19 -4
- package/dist/shared/constants.js +19 -4
- package/dist/shared/event-spool.js +3 -2
- package/dist/shared/feature-flags.d.ts +1 -0
- package/dist/shared/feature-flags.js +1 -0
- package/dist/shared/form-body.d.ts +18 -0
- package/dist/shared/form-body.js +251 -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/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 +4 -1
- 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 +118 -0
- package/dist/shared/switchboard.js +487 -0
- package/dist/shared/transport.d.ts +43 -3
- package/dist/shared/version.d.ts +2 -0
- package/dist/shared/version.js +18 -0
- package/dist/shared/wire.d.ts +46 -1
- package/dist/web/install-app.d.ts +57 -8
- package/dist/web/install-app.js +270 -60
- package/dist/web/macapp/RadarApp.swift +340 -22
- package/dist/web/public/index.html +216 -12
- package/dist/web/public/next/app.js +43 -22
- package/dist/web/public/next/db.js +4 -1
- package/dist/web/public/next/feed.js +604 -59
- package/dist/web/public/next/filters.js +158 -40
- package/dist/web/public/next/flags.js +3 -0
- package/dist/web/public/next/form-body.js +252 -0
- package/dist/web/public/next/inspector.js +171 -14
- package/dist/web/public/next/prefs.js +5 -2
- package/dist/web/public/next/registry.js +35 -3
- package/dist/web/public/next/store.js +947 -69
- 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 +712 -0
- package/dist/web/public/next/voice.js +552 -0
- package/dist/web/server.d.ts +20 -9
- package/dist/web/server.js +834 -174
- package/dist/web/spec.d.ts +11 -6
- package/dist/web/spec.js +62 -6
- package/package.json +4 -4
- package/dist/web/log-session.js +0 -166
package/dist/mcp/tools.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import { FORM_DECODE_LIMIT_LABEL } from "../shared/constants.js";
|
|
1
2
|
import { SOURCES, VIZ, SERIES_METRICS, LOG_LEVELS } from "../web/spec.js";
|
|
2
3
|
export const SERVER_INSTRUCTIONS = [
|
|
3
4
|
"Slack Radar provides on-device debugging tools for the Slack Android app via ADB.",
|
|
4
5
|
"",
|
|
5
6
|
"SESSION STATE:",
|
|
6
|
-
"Radar starts DISABLED each session.
|
|
7
|
+
"Radar starts DISABLED each session. ping, list_profiles, and open_radar_dashboard work before enabling; other tools return an error until enabled.",
|
|
8
|
+
"export_switchboard_session also works after an auto-disable if this process streamed the call",
|
|
9
|
+
"live. It builds the report from the live stream copy, no device call needed.",
|
|
7
10
|
"Use /radar-enable to activate, /radar-disable to deactivate.",
|
|
8
11
|
"",
|
|
9
12
|
"AUTO-ENABLE: When the user asks an obvious device question, invoke the Skill tool with",
|
|
10
13
|
'skill="radar-enable" FIRST, then proceed with the radar tool call. No need to ask.',
|
|
11
14
|
"Obvious device questions include: clogs, network calls, RTM events, screenshots,",
|
|
12
|
-
"app state, device logs, or any reference to what is happening on the connected device.",
|
|
15
|
+
"app state, device logs, Slackbot voice sessions, or any reference to what is happening on the connected device.",
|
|
13
16
|
"",
|
|
14
17
|
"TIMEOUT: The device-side radar auto-shuts down after idle. On tool call failure,",
|
|
15
18
|
"the session flips to disabled. Tell the user and offer to re-enable.",
|
|
@@ -24,7 +27,10 @@ export const SERVER_INSTRUCTIONS = [
|
|
|
24
27
|
'- "what API call was that" -> get_recent_network_calls then get_network_call_detail',
|
|
25
28
|
'- "did I get X" / "did X happen" -> search(query="X") across ALL buffers, not just one',
|
|
26
29
|
'- "everything since I enabled" / "the whole session" / "what did I miss" -> query_session',
|
|
27
|
-
'- "
|
|
30
|
+
'- "what happened in the voice session" / "why did playback stutter" / "did the mic open" -> get_switchboard_sessions then get_switchboard_session(id, kind=...): player for stutter, state for mic and connection, phase for slow start',
|
|
31
|
+
'- "did the turns get saved" / "why is a turn missing from the DM" -> get_switchboard_session(id, kind=saved_turn): outcome is applied, no_line (no subtitle line still held the item, still kept), or why a turn was dropped; the summary\'s saved_turn_counts counts each outcome (absent on an older device build means not counted, not zero). A server resend counts again under applied or no_line, so their sum can run above the finals and is not a lost turn. Every turn other_session with a null server_session_id usually means session.ready named no session (a ready record with a null id) or never arrived (no ready record).',
|
|
32
|
+
'- "export this voice session" / "save the switchboard session" / "hand this voice session to someone else" -> export_switchboard_session(id=...)',
|
|
33
|
+
'- "check the debug logs" -> get_recent_logs (tag is OPTIONAL: pass tag="SlackRadar" to filter, or omit it for all recent lines)',
|
|
28
34
|
'- "is flag X on?" / "what is the effective value of X" / "what feature flags does the app have" -> get_feature_flag(key="X") / search_feature_flags(query="X") / list_feature_flags. This is the LIVE effective state (override if set, else server value), requires a debug build with the feature-flag Radar plugin.',
|
|
29
35
|
'- "what feature-flag overrides are set?" / "check debug_features" -> search_prefs(query="X") or get_prefs(file="debug_features_...xml"). This shows MANUAL OVERRIDES only, not effective flag state: debug_features_*.xml holds only flags the debug menu overrode, and an override is deleted once it matches the server value. A flag missing from this file can still be ON server-side -- absence means "no override," never "disabled." Prefer get_feature_flag/list_feature_flags/search_feature_flags for the actual live value; use this route only when the manual-override history itself is what is being asked about.',
|
|
30
36
|
'- "what did the app remember" / "what is cached in prefs" / "what team_prefs are set" -> list_prefs then get_prefs',
|
|
@@ -52,11 +58,14 @@ export const SERVER_INSTRUCTIONS = [
|
|
|
52
58
|
"- Setup: /slack-radar-setup",
|
|
53
59
|
"- Manual enable (no skill): adb shell am broadcast -a slack.debug.ENABLE_RADAR --ei timeout_minutes 5 -p com.Slack.internal.debug",
|
|
54
60
|
" Then: adb forward tcp:8099 localabstract:slack-radar (prefix adb -s <serial> when multiple devices are attached)",
|
|
61
|
+
" This starts Radar in open mode (no radar_token extra, so the device accepts any caller). Use it only when /radar-enable cannot run; /radar-enable sends the token.",
|
|
55
62
|
"",
|
|
56
63
|
"WEB DASHBOARD (/radar-ui):",
|
|
57
|
-
"A browser-based dashboard (http://localhost:8100) shows the same live device data as",
|
|
58
|
-
"tabs: Live (everything), Network, RTM, Clogs, Traces, and
|
|
59
|
-
"filterable feed
|
|
64
|
+
"A browser-based dashboard (http://localhost:8100, or the port set in SLACK_RADAR_WEB_PORT) shows the same live device data as",
|
|
65
|
+
"tabs: Live (everything), Network, RTM, Clogs, Traces, Logs, and Switchboard, each with a",
|
|
66
|
+
"filterable feed and a payload inspector, a live rate on most, a graph on Network and Traces,",
|
|
67
|
+
"plus the Database/Preferences/Feature Flags browsers.",
|
|
68
|
+
"Launched via the /radar-ui skill, which runs",
|
|
60
69
|
"`npx @slack/radar-mcp web` (a global install also exposes it as `slack-radar`).",
|
|
61
70
|
"",
|
|
62
71
|
"PROACTIVELY offer the dashboard when it would help — do not wait to be asked. The moment a",
|
|
@@ -85,7 +94,8 @@ export const SERVER_INSTRUCTIONS = [
|
|
|
85
94
|
"screen.installHint, so you can check before suggesting.",
|
|
86
95
|
"",
|
|
87
96
|
"CUSTOM DASHBOARD (open_radar_dashboard):",
|
|
88
|
-
"The pre-built tabs (Live/Network/RTM/Clogs/Traces/Logs
|
|
97
|
+
"The pre-built tabs (Live/Network/RTM/Clogs/Traces/Logs/Switchboard, plus the Database/Preferences/Feature Flags",
|
|
98
|
+
"browsers) cover the common cases. When the user",
|
|
89
99
|
"describes a live view the tabs do not show, SUGGEST building it; invoke open_radar_dashboard",
|
|
90
100
|
"only after they agree or explicitly ask for a custom view/dashboard (same discipline as",
|
|
91
101
|
"/radar-ui). To build, translate their words into a spec and call the tool; it renders your",
|
|
@@ -95,15 +105,22 @@ export const SERVER_INSTRUCTIONS = [
|
|
|
95
105
|
'- "count every DM I receive and beep when one arrives"',
|
|
96
106
|
'- "show only RTM events on channel C... and let me click each for its payload"',
|
|
97
107
|
'- "watch network calls whose body contains <substring>"',
|
|
108
|
+
'- "show me only the <Tag> logs, DEBUG and up, without the noisy lines": a constrained log view,',
|
|
109
|
+
" e.g. {source: \"log\", match: {package: \"com.Slack.internal.debug\", tag: \"<Tag>\"}, minLevel: \"DEBUG\",",
|
|
110
|
+
" exclude: [\"noisy term\"]}. It lands as a Custom tab, gone on a page refresh unless pushed again;",
|
|
111
|
+
" exclude terms are remembered in the browser only on the pre-built tabs, not on Custom. One",
|
|
112
|
+
" phrase per exclude term, no commas or line breaks.",
|
|
98
113
|
"Authoring rules:",
|
|
99
|
-
"- source is one of network/rtm/clog/trace/log/all ('all' = one unified timeline).",
|
|
114
|
+
"- source is one of network/rtm/clog/trace/log/switchboard/all ('all' = one unified timeline).",
|
|
100
115
|
"- match filters on SUMMARY fields only, by source: network=url/method/status_code,",
|
|
101
116
|
" rtm=event_type/direction/channel, clog=event_name, trace=trace_name/span_name,",
|
|
102
|
-
" log=tag/level/message/pid/package
|
|
117
|
+
" log=tag/level/message/pid/package (iOS also: subsystem/process),",
|
|
118
|
+
" switchboard=kind/session_id/direction/frame_type/state_kind/phase/event/clock/outcome.",
|
|
103
119
|
" NEVER invent a field; a match on a field the stream does not carry silently matches",
|
|
104
120
|
" nothing. To filter on body text use bodyContains (network/all only), which fetches detail.",
|
|
105
|
-
"- viz composes counter/rate/sparkline/feed/inspector/graph. graph needs a series array",
|
|
121
|
+
"- viz composes counter/rate/sparkline/feed/inspector/graph/voice. graph needs a series array",
|
|
106
122
|
" (1-2 entries; metric ratePerSec/count/avg/errorRate; avg needs a field like duration_ms).",
|
|
123
|
+
" voice is the Switchboard tab's session panel and draws only for source switchboard.",
|
|
107
124
|
"- highlight {field, op, value} flags rows breaching a numeric threshold; alert {sound,flash,",
|
|
108
125
|
" say, at} fires on each live match (or once at the Nth). Author an honest one-line `summary`.",
|
|
109
126
|
"Calling it again replaces/refines the live custom dashboard. The dashboard reads a connected",
|
|
@@ -139,6 +156,24 @@ export const SERVER_INSTRUCTIONS = [
|
|
|
139
156
|
export function serverInstructions(platform) {
|
|
140
157
|
if (platform === "android")
|
|
141
158
|
return SERVER_INSTRUCTIONS;
|
|
159
|
+
if (platform === "ios") {
|
|
160
|
+
return [
|
|
161
|
+
"PLATFORM: iOS Simulator (NOT Android over adb).",
|
|
162
|
+
"This overrides anything below that assumes Android:",
|
|
163
|
+
"- Radar selects a booted iOS Simulator and enables its app listener directly; ignore adb",
|
|
164
|
+
" broadcasts, Android profiles, package names, and work-profile switching advice.",
|
|
165
|
+
"- Available: ping, network calls, RTM events, clogs, traces, search, query_session,",
|
|
166
|
+
" wait_for_events, clear_buffers, feature flags, capture_snapshot, get_recent_logs,",
|
|
167
|
+
" screenshot, record_screen, and open_radar_dashboard.",
|
|
168
|
+
"- Not available: get_app_state, database tools, preferences tools, list_profiles, and",
|
|
169
|
+
" activate_for_user. Treat their supported-platform error as a capability gap.",
|
|
170
|
+
"- Unified-log capture begins when the Radar session is enabled; it cannot backfill logs",
|
|
171
|
+
" emitted before that point. Leave tag unset for all Slack-authored categories.",
|
|
172
|
+
"- Physical iOS devices are not supported yet.",
|
|
173
|
+
"",
|
|
174
|
+
SERVER_INSTRUCTIONS,
|
|
175
|
+
].join("\n");
|
|
176
|
+
}
|
|
142
177
|
if (platform === "webapp") {
|
|
143
178
|
return [
|
|
144
179
|
"PLATFORM: webapp (a local Slack webapp dev server, NOT an Android device over adb).",
|
|
@@ -167,7 +202,7 @@ export function serverInstructions(platform) {
|
|
|
167
202
|
export const TOOL_DEFINITIONS = [
|
|
168
203
|
{
|
|
169
204
|
name: "ping",
|
|
170
|
-
description: "Check if Slack Radar is running. Returns uptime, buffer sizes, remaining session time, stream status, the Radar MCP tool version (mcp_version), and which app/profile is bound: android_user_id (0 = personal, non-zero = a secondary user such as a work profile), profile ('personal'/'secondary'), and package.",
|
|
205
|
+
description: "Check if Slack Radar is running. Returns uptime, buffer sizes, remaining session time, stream status, the Radar MCP tool version (mcp_version), and which app/profile is bound: android_user_id (0 = personal, non-zero = a secondary user such as a work profile), profile ('personal'/'secondary'), and package. If the result has a warning field, show it to the user verbatim.",
|
|
171
206
|
inputSchema: {
|
|
172
207
|
type: "object",
|
|
173
208
|
properties: {
|
|
@@ -194,7 +229,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
194
229
|
},
|
|
195
230
|
{
|
|
196
231
|
name: "get_network_call_detail",
|
|
197
|
-
description:
|
|
232
|
+
description: `Get full details of a specific network call by ID, including request/response headers and bodies. A form-encoded request body also comes back decoded in request_body_decoded, one key per field name (a repeated name becomes an array), JSON-valued fields parsed; request_body is always the raw bytes. When the raw body or its decoded copy is over ${FORM_DECODE_LIMIT_LABEL} the decoded copy is skipped and request_body_decoded_omitted says so; a field whose JSON was left unparsed is named in request_body_decoded_unparsed, with the reason. request_body_truncated: true means the device cap cut the body and request_body shows where it ends (a build that reports the cut itself is believed; otherwise it is read from the body's shape). For a form body, request_body_decoded, when present, holds every field before the cut; the last one may be partial.`,
|
|
198
233
|
inputSchema: {
|
|
199
234
|
type: "object",
|
|
200
235
|
properties: {
|
|
@@ -286,7 +321,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
286
321
|
properties: {
|
|
287
322
|
event_type: { type: "string", description: "RTM event type to wait for" },
|
|
288
323
|
channel: { type: "string", description: "Filter by channel ID" },
|
|
289
|
-
source: { type: "string", description: "Limit to one stream: network, rtm, clog, log, or
|
|
324
|
+
source: { type: "string", description: "Limit to one stream: network, rtm, clog, log, trace, or switchboard (default: all). During a Slackbot voice session switchboard emits several records a second, so an unscoped wait fills with them; scope to the source you want or shorten timeout_ms." },
|
|
290
325
|
timeout_ms: { type: "number", description: "Max time to wait in ms (default: 30000)" },
|
|
291
326
|
idle_timeout_ms: { type: "number", description: "Resolve after this many ms of silence (default: 3000)" },
|
|
292
327
|
},
|
|
@@ -306,6 +341,46 @@ export const TOOL_DEFINITIONS = [
|
|
|
306
341
|
},
|
|
307
342
|
annotations: { readOnlyHint: true },
|
|
308
343
|
},
|
|
344
|
+
{
|
|
345
|
+
name: "get_switchboard_sessions",
|
|
346
|
+
description: "List the Slackbot voice (switchboard) sessions the device still holds, at most 8, newest first. A session is one voice conversation attempt, from the controller starting (before any socket opens) to it ending. Each entry carries session_id, team_id, began_at, ended_at (null live), total_captured, frames {incoming, outgoing}, last_state (newest connection/mic/speaking state, absent before the first state record), levels (newest level tick, or null), server_session_id (null until named), turns ({count, last_response_ms, last_clock}, null before the first timed turn) and saved_turn_counts (per outcome), all absent on an older build. last_response_ms can be a gap between reply chunks when last_clock is resumed_from_server_answer. session_id restarts at 1 with the app process; go by began_at. A session already running when radar was enabled lists from its first seen record, team_id null. get_switchboard_session(id) has the records.",
|
|
347
|
+
inputSchema: { type: "object", properties: {} },
|
|
348
|
+
annotations: { readOnlyHint: true },
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
name: "get_switchboard_session",
|
|
352
|
+
description: "Get one voice session's summary plus the newest `limit` of its records (events), oldest first; events is only the page. Record kinds: state = connection, mic and speaking transitions (state_kind, from, to, cause); frame = control frames in and out (direction, frame_type, bytes), audio frames carry frame_type audio and a byte count, never the audio; player = playback events rearm, jitter_trim, read_stall and pre_ready_drop with gap_ms and bytes_queued; phase = startup phase durations (phase, duration_ms); session = begin and end, plus ready (server_session_id); levels = one meter-tick batch (started_at, sample_count, offsets_ms, mic/playback rms+peak arrays, 0..1); turn = response_ms (end of speech to first reply audio) and clock (no_card, resumed_from_tap, resumed_from_server_answer); saved_turn = outcome (applied, no_line, missing_field, other_session), has_thread. Pass kind to narrow (player for stutter, levels for meter history); the device filters by kind before taking the limit, so the page is the newest limit of that kind, while total_captured still counts every kind. This is a single page, not the whole session; for that use export_switchboard_session or query_session under source switchboard. An unknown id is a device 404.",
|
|
353
|
+
inputSchema: {
|
|
354
|
+
type: "object",
|
|
355
|
+
properties: {
|
|
356
|
+
id: { type: "number", description: "The session_id from get_switchboard_sessions" },
|
|
357
|
+
kind: {
|
|
358
|
+
type: "string",
|
|
359
|
+
enum: ["session", "state", "frame", "phase", "player", "levels", "turn", "saved_turn"],
|
|
360
|
+
description: "Only records of this kind (default: every kind)",
|
|
361
|
+
},
|
|
362
|
+
limit: {
|
|
363
|
+
type: "number",
|
|
364
|
+
description: "How many of the newest records to return (default: 50, max: 2000 per request; the device may hold more than this single request returns; for the whole session use export_switchboard_session or query_session)",
|
|
365
|
+
minimum: 1,
|
|
366
|
+
maximum: 2000,
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
required: ["id"],
|
|
370
|
+
},
|
|
371
|
+
annotations: { readOnlyHint: true },
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: "export_switchboard_session",
|
|
375
|
+
description: "Write one Slackbot voice (switchboard) session's summary and its records to a plain-text file. Pages the device (up to 2000 per request, paged with before_id), then merges in this process's own live stream copy (read from its session event spool), so a call the device ring has since evicted can still show up if this MCP was connected while it happened. The export can stop early (for example an old device build that does not page, the 32 MB size cap, the page limit, or the device stopping answering), and the report notes say why anything is missing; the spool itself rotates at 100 MB across every event kind it captures, not just switchboard, so an unusually long or chatty session could in principle rotate away a call's own early records before the device ring would have evicted them. Writes it as a readable report (server_session_id, summary, then one line per record, oldest first) under ~/.slack-radar/exports/<file>, permissions 0700/0600 like capture_snapshot. Defaults to the newest session when id is omitted. Returns the file path, a short summary, and notes. An unknown id (404, unreachable, or a reply 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. Still works right after Radar auto-disables, from the live stream copy alone with no device call; an explicit /radar-disable or clear_buffers wipes that copy.",
|
|
376
|
+
inputSchema: {
|
|
377
|
+
type: "object",
|
|
378
|
+
properties: {
|
|
379
|
+
id: { type: "number", description: "The session_id from get_switchboard_sessions. Omit to export the newest session." },
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
annotations: { readOnlyHint: false },
|
|
383
|
+
},
|
|
309
384
|
{
|
|
310
385
|
name: "get_app_state",
|
|
311
386
|
description: "Get the current app state from the device.",
|
|
@@ -314,11 +389,11 @@ export const TOOL_DEFINITIONS = [
|
|
|
314
389
|
},
|
|
315
390
|
{
|
|
316
391
|
name: "get_recent_logs",
|
|
317
|
-
description: "Get recent device logs for the Slack debug build.
|
|
392
|
+
description: "Get recent device logs for the Slack debug build. Android reads the app's Timber buffer first and falls back to logcat. iOS returns only Slack-authored unified logs captured since the Radar session was enabled; it cannot backfill earlier lines, and if the capture died it returns what it retained with a `capture_error`. The result's `source` is one of `app_buffer`, `logcat_capture`, `logcat_ring`, or `ios_unified_capture`. Leave `tag` out to get all recent lines. On Android, for native crashes, VERBOSE lines, or non-Slack processes, use adb logcat directly.",
|
|
318
393
|
inputSchema: {
|
|
319
394
|
type: "object",
|
|
320
395
|
properties: {
|
|
321
|
-
tag: { type: "string", description: "Optional substring
|
|
396
|
+
tag: { type: "string", description: "Optional substring filter: Android matches anywhere in the line; iOS matches the category/tag field. Use grep to search message text. Omit to return all recent lines." },
|
|
322
397
|
limit: { type: "number", description: "Max number of lines to return (default: 50, capped at 1000)" },
|
|
323
398
|
grep: { type: "string", description: "Optional text to grep within the filtered output" },
|
|
324
399
|
},
|
|
@@ -352,7 +427,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
352
427
|
},
|
|
353
428
|
{
|
|
354
429
|
name: "capture_snapshot",
|
|
355
|
-
description: "Bundle the current Radar state into a single on-disk artifact for sharing. Writes four files to ~/.slack-radar/snapshots/snapshot-<ts>/: bundle.json (network + RTM + clog + trace buffers, up to 1000 items each — a bulk export, much larger than point queries like get_network_call_detail), logcat.tail.log (last N lines of the active capture), screenshot.png (current screen), and README.txt (receiver-facing explainer). Use when the user says 'save this', 'file this as a bug', 'share this', 'bundle this up', 'attach to a ticket', 'make me a repro', or otherwise wants a shareable reproducible handoff. PRIVACY: bundle.json contains raw API request/response bodies including auth headers, RTM message content, user/team/channel IDs, clog payloads, and performance trace spans — review before sharing externally.",
|
|
430
|
+
description: "Bundle the current Radar state into a single on-disk artifact for sharing. Writes four files to ~/.slack-radar/snapshots/snapshot-<ts>/: bundle.json (network + RTM + clog + trace buffers, up to 1000 items each — a bulk export, much larger than point queries like get_network_call_detail), logcat.tail.log (last N lines of the active capture), screenshot.png (current screen), and README.txt (receiver-facing explainer). Switchboard voice sessions are not bundled; keep them with get_switchboard_session or query_session(source=switchboard). Use when the user says 'save this', 'file this as a bug', 'share this', 'bundle this up', 'attach to a ticket', 'make me a repro', or otherwise wants a shareable reproducible handoff. PRIVACY: bundle.json contains raw API request/response bodies including auth headers, RTM message content, user/team/channel IDs, clog payloads, and performance trace spans — review before sharing externally.",
|
|
356
431
|
inputSchema: {
|
|
357
432
|
type: "object",
|
|
358
433
|
properties: {
|
|
@@ -404,7 +479,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
404
479
|
},
|
|
405
480
|
{
|
|
406
481
|
name: "_radar_session_enable",
|
|
407
|
-
description: "Enable Slack Radar for this session. Sets up ADB forwarding, activates the device-side server, and connects the SSE stream. Called by /radar-enable skill.",
|
|
482
|
+
description: "Enable Slack Radar for this session. Sets up ADB forwarding, activates the device-side server, and connects the SSE stream. Called by /radar-enable skill. If the result has a warning field, show it to the user verbatim.",
|
|
408
483
|
inputSchema: {
|
|
409
484
|
type: "object",
|
|
410
485
|
properties: {
|
|
@@ -426,7 +501,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
426
501
|
{
|
|
427
502
|
name: "open_radar_dashboard",
|
|
428
503
|
description: "Build or refine a custom live dashboard tab in the Slack Radar web UI from a spec YOU author. " +
|
|
429
|
-
"Suggest this when the user describes a live view the pre-built tabs (Live/Network/RTM/Clogs/Traces/Logs) do not cover " +
|
|
504
|
+
"Suggest this when the user describes a live view the pre-built tabs (Live/Network/RTM/Clogs/Traces/Logs/Switchboard, plus the Database, Preferences and Feature Flags browsers) do not cover " +
|
|
430
505
|
"(e.g. 'graph calls per second vs response time and flag slow ones', 'beep when I get a DM'); invoke it once they agree. " +
|
|
431
506
|
"Translate the request into the spec fields below and call this tool; it ensures the web dashboard is " +
|
|
432
507
|
"running (default http://localhost:8100) and renders your spec as a 'Custom' tab, then returns the URL to share. " +
|
|
@@ -443,12 +518,13 @@ export const TOOL_DEFINITIONS = [
|
|
|
443
518
|
source: {
|
|
444
519
|
type: "string",
|
|
445
520
|
enum: [...SOURCES],
|
|
446
|
-
description: "Which device stream to read. 'all' is a unified timeline mixing network, RTM, clog, trace, and
|
|
521
|
+
description: "Which device stream to read. 'all' is a unified timeline mixing network, RTM, clog, trace, log, and switchboard. 'switchboard' is the Slackbot voice transport's own records (kind: session|state|frame|phase|player|levels|turn|saved_turn).",
|
|
447
522
|
},
|
|
448
523
|
match: {
|
|
449
524
|
type: "object",
|
|
450
525
|
description: "Case-insensitive substring filter on SUMMARY fields, keyed by source. network: url/method/status_code; " +
|
|
451
|
-
"rtm: event_type/direction/channel; clog: event_name; trace: trace_name/span_name;
|
|
526
|
+
"rtm: event_type/direction/channel; clog: event_name; trace: trace_name/span_name; " +
|
|
527
|
+
"log: tag/level/message/pid/package (iOS also: subsystem/process); switchboard: kind/session_id/direction/frame_type/state_kind/phase/event/clock/outcome. NEVER invent a field " +
|
|
452
528
|
"(a match on an absent field silently matches nothing). For body text use bodyContains instead; for a log level floor use minLevel, not match.level.",
|
|
453
529
|
},
|
|
454
530
|
bodyContains: {
|
|
@@ -460,6 +536,11 @@ export const TOOL_DEFINITIONS = [
|
|
|
460
536
|
enum: [...LOG_LEVELS],
|
|
461
537
|
description: "log/all only: show log lines at this level or above (WARN keeps WARN, ERROR and FATAL). Rows of other kinds are unaffected. Omit to show every line; VERBOSE means the same and is stored as omitted.",
|
|
462
538
|
},
|
|
539
|
+
exclude: {
|
|
540
|
+
type: "array",
|
|
541
|
+
items: { type: "string" },
|
|
542
|
+
description: "Stream sources only. Hide rows whose summary text (the same text the filter box searches, never bodies) contains any term, case-insensitive; a field:value term (kind:frame, no space after the colon) instead hides rows whose field equals the value, case-insensitive, and a field no row carries hides nothing. Up to 20 terms of 200 characters; trimmed and deduplicated. One phrase per term, no commas or line breaks. Hidden rows also leave the rate and graph counts.",
|
|
543
|
+
},
|
|
463
544
|
viz: {
|
|
464
545
|
type: "array",
|
|
465
546
|
items: { type: "string", enum: [...VIZ] },
|
|
@@ -542,11 +623,11 @@ export const TOOL_DEFINITIONS = [
|
|
|
542
623
|
},
|
|
543
624
|
{
|
|
544
625
|
name: "query_session",
|
|
545
|
-
description: "Read the whole current Radar session from the host event spool (every network/RTM/clog/trace frame captured since radar was enabled), filtered and byte-capped so it cannot flood the model context.
|
|
626
|
+
description: "Read the whole current Radar session from the host event spool (every network/RTM/clog/trace/switchboard frame captured since radar was enabled), filtered and byte-capped so it cannot flood the model context. Device logs are not spooled; use get_recent_logs for those. Use it for 'everything since I enabled', 'the whole session', or 'what did I miss': the get_recent_* tools read the device rings, which drop the oldest events on a long session, while the spool keeps the full session record. A list read (no id) returns SUMMARY fields for network/RTM/trace and full clog and switchboard records inline; it collapses one summary and its pulled detail for an id, while records from two app processes that share an id are kept apart by timestamp; an id read returns the newest record carrying that id, so only the newer of such a pair is reachable by id. An id read returns the FULL record: for network/RTM/trace the body (request/response, headers, full payload) is pulled from the device on first open and cached in the spool, so a later id read of the same record is served from the file with no device round-trip; clog and switchboard are already the full record inline. If the body cannot be pulled (device offline, aged out of the ring, or a single body over the byte budget) the id read falls back to the summary with a note. Frames come back newest-first; when truncated:true the result carries an opaque cursor STRING token, which you pass back verbatim as cursor to page strictly older across all sources. Do not build or change the token. A token from before a spool rotation or a re-enable is rejected with a note, and you start paging from the newest page again. Ids are per-source, so an unsourced id can match more than one ring; pass source to disambiguate, and the returned frame type tells you which ring answered. A list read scoped to a plain source (source network) returns summaries; to list cached full bodies for a source, scope to its detail tag (source network_detail). When id is set, all filters except source are ignored. Returns an empty result with a note when no spool exists (radar not enabled). Switchboard (Slackbot voice transport) frames are spooled raw as source switchboard; filter them with source and text. An id read of a network record adds the same decoded-form fields get_network_call_detail adds; a large record may come back without them, with request_body_decoded_omitted saying so. The spool itself keeps only the raw bytes.",
|
|
546
627
|
inputSchema: {
|
|
547
628
|
type: "object",
|
|
548
629
|
properties: {
|
|
549
|
-
source: { type: "string", description: "Opaque frame type tag to match, e.g. network, rtm, clog, trace
|
|
630
|
+
source: { type: "string", description: "Opaque frame type tag to match, e.g. network, rtm, clog, trace, switchboard. Matched exactly, not enumerated." },
|
|
550
631
|
id: { type: "number", description: "Return the single whole frame with this id, bypassing the newest-first byte budget. Optionally scope with source. id addresses one record and is unrelated to cursor; there is no older-than-id filter, page with cursor instead." },
|
|
551
632
|
cursor: { type: "string", description: "An OPAQUE paging token returned by a prior truncated result; pass it back verbatim to get the next older page across all sources. It is NOT an event id and NOT a count; do not construct or modify it. A token from before a spool rotation or a re-enable is rejected with a note, and you start paging from the newest page again." },
|
|
552
633
|
url_filter: { type: "string", description: "Keep frames whose url contains this substring." },
|
|
@@ -652,8 +733,11 @@ export const TOOL_DEFINITIONS = [
|
|
|
652
733
|
/**
|
|
653
734
|
* Check whether a tool call should be blocked by the session gate.
|
|
654
735
|
* Returns an error response object if blocked, or null if allowed.
|
|
736
|
+
*
|
|
737
|
+
* `allowSwitchboardExportOffline` lets export_switchboard_session through while disabled; the
|
|
738
|
+
* caller sets it only when a host-only report can be built without touching the device.
|
|
655
739
|
*/
|
|
656
|
-
export function sessionGate(toolName, sessionEnabled) {
|
|
740
|
+
export function sessionGate(toolName, sessionEnabled, allowSwitchboardExportOffline = false) {
|
|
657
741
|
// Session enable/disable are always allowed
|
|
658
742
|
if (toolName === "_radar_session_enable" || toolName === "_radar_session_disable") {
|
|
659
743
|
return null;
|
|
@@ -662,11 +746,18 @@ export function sessionGate(toolName, sessionEnabled) {
|
|
|
662
746
|
if (toolName === "ping") {
|
|
663
747
|
return null;
|
|
664
748
|
}
|
|
749
|
+
// Profile discovery is adb-only and is the recovery path named by a refused enable.
|
|
750
|
+
if (toolName === "list_profiles") {
|
|
751
|
+
return null;
|
|
752
|
+
}
|
|
665
753
|
// open_radar_dashboard launches an independent local web process with its own
|
|
666
754
|
// device-enable (Reconnect) button, so it does not require the MCP session enabled.
|
|
667
755
|
if (toolName === "open_radar_dashboard") {
|
|
668
756
|
return null;
|
|
669
757
|
}
|
|
758
|
+
if (toolName === "export_switchboard_session" && allowSwitchboardExportOffline) {
|
|
759
|
+
return null;
|
|
760
|
+
}
|
|
670
761
|
if (!sessionEnabled) {
|
|
671
762
|
return {
|
|
672
763
|
content: [
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
// transport at import time, so a test importing it would hang rather than exit. Keeping the builder
|
|
7
7
|
// here makes the boundary assertable without importing a server.
|
|
8
8
|
import { RADAR_PORT } from "../shared/constants.js";
|
|
9
|
-
export function webChildEnv(initialSpec) {
|
|
9
|
+
export function webChildEnv(initialSpec, target) {
|
|
10
10
|
return {
|
|
11
11
|
...process.env,
|
|
12
|
+
...(target ? { SLACK_RADAR_PLATFORM: target.platform } : {}),
|
|
13
|
+
...(target?.platform === "ios" && target.serial
|
|
14
|
+
? { SLACK_RADAR_IOS_SIMULATOR_UDID: target.serial } : {}),
|
|
12
15
|
// A bridge-spawned dashboard must not pop a window unbidden: the Claude Code session returns the
|
|
13
16
|
// URL instead, which is what the /radar-ui server instructions promise.
|
|
14
17
|
SLACK_RADAR_NO_OPEN: "1",
|
package/dist/shared/android.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { type ChildProcess } from "child_process";
|
|
2
|
+
import { TokenFileError } from "./radar-token.js";
|
|
3
|
+
import { LogSession, type LogFrame } from "./log-session.js";
|
|
1
4
|
import type { DeviceInfo, DeviceTransport, LogResult, ProcessState, DevicePick } from "./transport.js";
|
|
5
|
+
export declare function describeBroadcastFailure(error: Error): string;
|
|
2
6
|
/**
|
|
3
7
|
* Resolve the adb binary. MCP servers spawned from GUI launchers (Spotlight,
|
|
4
8
|
* Raycast, Dock) do not inherit the user's shell PATH, so a bare `adb` call
|
|
@@ -10,6 +14,27 @@ import type { DeviceInfo, DeviceTransport, LogResult, ProcessState, DevicePick }
|
|
|
10
14
|
* surface a clear error instead of a misleading "device not connected".
|
|
11
15
|
*/
|
|
12
16
|
export declare function resolveAdbPath(): string | null;
|
|
17
|
+
type SpawnAndroidProcessList = () => ChildProcess | null;
|
|
18
|
+
/**
|
|
19
|
+
* A device-scoped PID -> package snapshot for dashboard log rows.
|
|
20
|
+
*
|
|
21
|
+
* Android reuses PIDs, and a dashboard can switch between devices without restarting its
|
|
22
|
+
* process. Replacing the whole snapshot on refresh, rather than appending to a module-global
|
|
23
|
+
* map, prevents a PID on the new process/device from inheriting the old package label.
|
|
24
|
+
*/
|
|
25
|
+
export declare class AndroidPidPackageMap {
|
|
26
|
+
private readonly spawnProcessList;
|
|
27
|
+
private packages;
|
|
28
|
+
private refreshVersion;
|
|
29
|
+
private activeRefresh;
|
|
30
|
+
private lastRefresh;
|
|
31
|
+
constructor(spawnProcessList?: SpawnAndroidProcessList);
|
|
32
|
+
resolve(pid: number): string | undefined;
|
|
33
|
+
refresh(): void;
|
|
34
|
+
reset(): void;
|
|
35
|
+
}
|
|
36
|
+
/** Parse one adb logcat threadtime line into the dashboard's normalized log frame. */
|
|
37
|
+
export declare function parseAndroidLogcat(line: string, resolvePackage?: (pid: number) => string | undefined): LogFrame | null;
|
|
13
38
|
/**
|
|
14
39
|
* Parse the output of `ps -A -o USER,NAME` to extract the Android user ID
|
|
15
40
|
* for the debug build process. When multiple profiles are running, prefers
|
|
@@ -31,9 +56,20 @@ export declare function parseAdbDevicesOutput(raw: string): {
|
|
|
31
56
|
label: string;
|
|
32
57
|
state: string;
|
|
33
58
|
}[];
|
|
59
|
+
/** Seams for AndroidTransport's host log capture, shaped like IosSimulatorTransportDependencies. */
|
|
60
|
+
export interface AndroidTransportDependencies {
|
|
61
|
+
/** Start the dashboard's `adb logcat` child. Defaults to the resolved adb binary. */
|
|
62
|
+
spawnLogcat?: () => ChildProcess;
|
|
63
|
+
/** Start the `ps` listing that labels log rows with their package. */
|
|
64
|
+
spawnProcessList?: SpawnAndroidProcessList;
|
|
65
|
+
}
|
|
34
66
|
export declare class AndroidTransport implements DeviceTransport {
|
|
35
67
|
readonly platform = "android";
|
|
68
|
+
readonly logPackage = "com.Slack.internal.debug";
|
|
69
|
+
readonly supportsHostLogs = true;
|
|
70
|
+
readonly logSession: LogSession;
|
|
36
71
|
readonly supportsRadarHttpTools = true;
|
|
72
|
+
readonly sendsRadarToken = true;
|
|
37
73
|
readonly supportsLocalFileAccess = true;
|
|
38
74
|
readonly supportsDeviceDashboard = true;
|
|
39
75
|
private portForwarded;
|
|
@@ -42,7 +78,10 @@ export declare class AndroidTransport implements DeviceTransport {
|
|
|
42
78
|
private radarEnabled;
|
|
43
79
|
private lastForwardError;
|
|
44
80
|
private lastActivateError;
|
|
81
|
+
private lastActivateTokenFileError;
|
|
45
82
|
private selectedDevice;
|
|
83
|
+
private readonly dashboardPidPackages;
|
|
84
|
+
constructor(dependencies?: AndroidTransportDependencies);
|
|
46
85
|
ensureForward(): boolean;
|
|
47
86
|
private rebuildForward;
|
|
48
87
|
reassertForward(): boolean;
|
|
@@ -76,7 +115,9 @@ export declare class AndroidTransport implements DeviceTransport {
|
|
|
76
115
|
radarSocketPresentAsync(): Promise<"present" | "absent" | "unknown">;
|
|
77
116
|
private recordActivateSuccess;
|
|
78
117
|
private recordActivateFailure;
|
|
118
|
+
private readArmToken;
|
|
79
119
|
getLastActivateError(): string | null;
|
|
120
|
+
getLastActivateTokenFileError(): TokenFileError | null;
|
|
80
121
|
resetState(): void;
|
|
81
122
|
dropForward(): void;
|
|
82
123
|
isForwarded(): boolean;
|
|
@@ -95,6 +136,7 @@ export declare class AndroidTransport implements DeviceTransport {
|
|
|
95
136
|
recordScreen(durationS: number): string;
|
|
96
137
|
getAppState(): string;
|
|
97
138
|
getRecentLogs(tag: string, limit: number, grep?: string): LogResult;
|
|
139
|
+
stopLogCapture(): void;
|
|
98
140
|
listProfiles(): {
|
|
99
141
|
userId: string;
|
|
100
142
|
label: string;
|
|
@@ -165,3 +207,4 @@ export declare class AndroidTransport implements DeviceTransport {
|
|
|
165
207
|
*/
|
|
166
208
|
processState(timeoutMs?: number): ProcessState;
|
|
167
209
|
}
|
|
210
|
+
export {};
|