@slack/radar-mcp 1.21.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +68 -15
  2. package/dist/mcp/api-paths.d.ts +2 -2
  3. package/dist/mcp/api-paths.js +4 -19
  4. package/dist/mcp/dashboard-identity.d.ts +6 -0
  5. package/dist/mcp/dashboard-identity.js +11 -0
  6. package/dist/mcp/index.js +117 -32
  7. package/dist/mcp/logs-result.d.ts +1 -0
  8. package/dist/mcp/logs-result.js +1 -0
  9. package/dist/mcp/radar-export-get.d.ts +30 -0
  10. package/dist/mcp/radar-export-get.js +49 -0
  11. package/dist/mcp/radar-response.d.ts +4 -1
  12. package/dist/mcp/radar-response.js +8 -3
  13. package/dist/mcp/session-backfill.js +3 -4
  14. package/dist/mcp/session-enable.d.ts +1 -0
  15. package/dist/mcp/session-enable.js +146 -15
  16. package/dist/mcp/snapshot.js +42 -26
  17. package/dist/mcp/sources-gate.js +1 -0
  18. package/dist/mcp/stale-dashboard.d.ts +23 -0
  19. package/dist/mcp/stale-dashboard.js +122 -0
  20. package/dist/mcp/switchboard-spool.d.ts +12 -0
  21. package/dist/mcp/switchboard-spool.js +107 -0
  22. package/dist/mcp/switchboard-tools.d.ts +9 -0
  23. package/dist/mcp/switchboard-tools.js +144 -6
  24. package/dist/mcp/tools.d.ts +4 -1
  25. package/dist/mcp/tools.js +60 -15
  26. package/dist/mcp/web-child-env.d.ts +4 -1
  27. package/dist/mcp/web-child-env.js +4 -1
  28. package/dist/shared/android.d.ts +43 -0
  29. package/dist/shared/android.js +227 -19
  30. package/dist/shared/constants.d.ts +9 -4
  31. package/dist/shared/constants.js +9 -4
  32. package/dist/shared/feature-flags.d.ts +1 -0
  33. package/dist/shared/feature-flags.js +1 -0
  34. package/dist/shared/ios-logs.d.ts +10 -0
  35. package/dist/shared/ios-logs.js +91 -0
  36. package/dist/shared/ios.d.ts +25 -2
  37. package/dist/shared/ios.js +157 -3
  38. package/dist/{web → shared}/log-session.d.ts +45 -31
  39. package/dist/shared/log-session.js +300 -0
  40. package/dist/shared/radar-request-raw.d.ts +7 -0
  41. package/dist/shared/radar-request-raw.js +89 -0
  42. package/dist/shared/radar-token.d.ts +25 -0
  43. package/dist/shared/radar-token.js +164 -0
  44. package/dist/shared/stream.d.ts +3 -0
  45. package/dist/shared/stream.js +107 -15
  46. package/dist/shared/switchboard-host-store.d.ts +21 -0
  47. package/dist/shared/switchboard-host-store.js +166 -0
  48. package/dist/shared/switchboard-note.d.ts +15 -0
  49. package/dist/shared/switchboard-note.js +92 -0
  50. package/dist/shared/switchboard-report-file.d.ts +5 -0
  51. package/dist/shared/switchboard-report-file.js +26 -0
  52. package/dist/shared/switchboard-report.d.ts +20 -0
  53. package/dist/shared/switchboard-report.js +406 -0
  54. package/dist/shared/switchboard.d.ts +111 -2
  55. package/dist/shared/switchboard.js +436 -3
  56. package/dist/shared/transport.d.ts +43 -3
  57. package/dist/shared/version.d.ts +2 -0
  58. package/dist/shared/version.js +18 -0
  59. package/dist/shared/wire.d.ts +14 -1
  60. package/dist/web/install-app.d.ts +57 -8
  61. package/dist/web/install-app.js +270 -60
  62. package/dist/web/macapp/RadarApp.swift +340 -22
  63. package/dist/web/public/index.html +51 -9
  64. package/dist/web/public/next/app.js +33 -18
  65. package/dist/web/public/next/feed.js +102 -15
  66. package/dist/web/public/next/flags.js +3 -0
  67. package/dist/web/public/next/inspector.js +69 -3
  68. package/dist/web/public/next/prefs.js +5 -2
  69. package/dist/web/public/next/registry.js +18 -5
  70. package/dist/web/public/next/store.js +455 -29
  71. package/dist/web/public/next/switchboard-note.js +93 -0
  72. package/dist/web/public/next/toast.js +9 -5
  73. package/dist/web/public/next/voice-model.js +215 -35
  74. package/dist/web/public/next/voice.js +173 -18
  75. package/dist/web/server.d.ts +15 -11
  76. package/dist/web/server.js +690 -168
  77. package/dist/web/spec.d.ts +2 -1
  78. package/dist/web/spec.js +2 -1
  79. package/package.json +2 -2
  80. package/dist/web/log-session.js +0 -166
@@ -14,7 +14,8 @@
14
14
  * Sources the dashboard can read. The first five plus "switchboard" are live streams; "all" is
15
15
  * their unified timeline. "db", "prefs", and "flags" are read-only point-in-time browsers (not
16
16
  * streams) and are each handled as a distinct view. "switchboard" is the Slackbot voice transport's
17
- * own event stream (session / state / frame / phase / player records), device-produced like rtm.
17
+ * own event stream (session / state / frame / phase / player / levels / turn / saved_turn records),
18
+ * device-produced like rtm.
18
19
  */
19
20
  export declare const SOURCES: readonly ["rtm", "network", "clog", "trace", "log", "switchboard", "all", "db", "prefs", "flags"];
20
21
  export type Source = (typeof SOURCES)[number];
package/dist/web/spec.js CHANGED
@@ -14,7 +14,8 @@
14
14
  * Sources the dashboard can read. The first five plus "switchboard" are live streams; "all" is
15
15
  * their unified timeline. "db", "prefs", and "flags" are read-only point-in-time browsers (not
16
16
  * streams) and are each handled as a distinct view. "switchboard" is the Slackbot voice transport's
17
- * own event stream (session / state / frame / phase / player records), device-produced like rtm.
17
+ * own event stream (session / state / frame / phase / player / levels / turn / saved_turn records),
18
+ * device-produced like rtm.
18
19
  */
19
20
  export const SOURCES = ["rtm", "network", "clog", "trace", "log", "switchboard", "all", "db", "prefs", "flags"];
20
21
  /** Widgets a spec may compose. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slack/radar-mcp",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "description": "MCP server and web dashboard for debugging Slack on Android and iOS Simulator",
5
5
  "type": "module",
6
6
  "main": "dist/mcp/index.js",
@@ -23,7 +23,7 @@
23
23
  "start:web": "node dist/web/bin.js",
24
24
  "watch": "tsc --watch",
25
25
  "test": "npm run build && node tests/run.mjs",
26
- "test:tap": "npm run build && node --test tests/*.test.mjs",
26
+ "test:tap": "npm run build && node --import ./tests/temp-home.mjs --test tests/*.test.mjs",
27
27
  "test:smoke": "npm run build && bash tests/smoke.sh",
28
28
  "test:all": "npm run test && npm run test:smoke",
29
29
  "prepare": "npm run build"
@@ -1,166 +0,0 @@
1
- import { MAX_LOG_SESSION_BUFFER } from "../shared/constants.js";
2
- /**
3
- * A single session-long logcat capture with a bounded ring buffer and listener
4
- * fan-out. One instance is shared across every dashboard stream connection.
5
- */
6
- export class LogSession {
7
- spawnLogcat;
8
- parseLine;
9
- cap;
10
- child = null;
11
- lineBuf = "";
12
- ring = [];
13
- listeners = new Set();
14
- cleanupRegistered = false;
15
- constructor(spawnLogcat, parseLine, cap = MAX_LOG_SESSION_BUFFER) {
16
- this.spawnLogcat = spawnLogcat;
17
- this.parseLine = parseLine;
18
- this.cap = cap > 0 ? cap : MAX_LOG_SESSION_BUFFER;
19
- }
20
- /** True while a logcat child is running. */
21
- isRunning() {
22
- return this.child !== null;
23
- }
24
- /** Number of frames currently retained (for tests / diagnostics). */
25
- bufferSize() {
26
- return this.ring.length;
27
- }
28
- /** Number of attached stream listeners (for tests / diagnostics). */
29
- listenerCount() {
30
- return this.listeners.size;
31
- }
32
- /**
33
- * Start the capture if it is not already running. Idempotent: a second call
34
- * while a child is alive is a no-op, so concurrent tab opens cannot fan out
35
- * duplicate logcat processes. Returns true if a capture is running after the
36
- * call (already-running counts as success), false if the spawn failed.
37
- */
38
- start() {
39
- if (this.child)
40
- return true;
41
- let child;
42
- try {
43
- child = this.spawnLogcat();
44
- }
45
- catch {
46
- return false;
47
- }
48
- this.child = child;
49
- this.lineBuf = "";
50
- // A background diagnostic child must not keep the host process alive on its
51
- // own. The listening dashboard socket is what holds the event loop open in
52
- // production; when that closes (a test, or a clean shutdown) node should be
53
- // free to exit even if a logcat capture is still running. registerCleanup
54
- // still kills the child on exit, so unref only removes the loop-blocking ref.
55
- child.unref?.();
56
- child.stdout?.on("data", (c) => this.onData(c));
57
- // A crashed/killed logcat (device unplugged, adb server restart) clears the
58
- // child so the next connect() can restart it. The retained ring survives so
59
- // history is not lost across a transient device drop.
60
- child.on("error", () => this.onChildGone(child));
61
- child.on("exit", () => this.onChildGone(child));
62
- return true;
63
- }
64
- /** Stop the capture and drop the child. The ring buffer is preserved. */
65
- stop() {
66
- const child = this.child;
67
- this.child = null;
68
- this.lineBuf = "";
69
- if (child) {
70
- try {
71
- child.kill();
72
- }
73
- catch {
74
- // already dead
75
- }
76
- }
77
- }
78
- /**
79
- * Stop the capture AND drop the retained ring, for when the underlying device
80
- * actually changed (PR #94 multi-device switch), not just dropped transiently.
81
- * stop() alone preserves the ring by design (a transient adb-server hiccup or
82
- * device unplug/replug is the SAME device coming back, so its history is still
83
- * valid and should survive) -- but a switch to DIFFERENT hardware means every
84
- * retained frame belongs to the wrong device, and replaying them into a freshly
85
- * opened /stream on the new device would show device A's logs mislabeled as
86
- * device B's. The caller (handleEnable's switched branch) is responsible for
87
- * calling armLogcat() / start() again afterward if a log tab is active; this
88
- * method only tears down, matching stop()'s existing division of labor.
89
- */
90
- restart() {
91
- this.stop();
92
- this.ring.length = 0;
93
- }
94
- /**
95
- * Install process-exit handlers (once) so the persistent `adb logcat` child is
96
- * killed when the server process exits. Without this, the capture orphans when
97
- * the server is terminated by signal — notably when `open_radar_dashboard`
98
- * spawns the dashboard as a child and later kills it by PID — and orphaned adb
99
- * logcat readers accumulate across dashboard open/close cycles, holding the
100
- * device's logcat stream. Mirrors logcat-capture.ts's registerCleanup().
101
- */
102
- registerCleanup() {
103
- if (this.cleanupRegistered)
104
- return;
105
- this.cleanupRegistered = true;
106
- process.on("exit", () => this.stop());
107
- process.on("SIGINT", () => {
108
- this.stop();
109
- process.exit(130);
110
- });
111
- process.on("SIGTERM", () => {
112
- this.stop();
113
- process.exit(143);
114
- });
115
- }
116
- /**
117
- * Subscribe a stream to the session. The listener is FIRST replayed the entire
118
- * retained ring (replay=true) so a freshly opened tab shows full history, then
119
- * receives every subsequent live frame (replay=false). Returns an unsubscribe
120
- * function; call it when the stream closes (this does NOT stop the capture).
121
- */
122
- subscribe(listener) {
123
- // Replay a snapshot of the current ring. Snapshot first so a frame arriving
124
- // mid-replay is not delivered twice (once via replay, once live).
125
- const snapshot = this.ring.slice();
126
- for (const frame of snapshot)
127
- listener(frame, true);
128
- this.listeners.add(listener);
129
- return () => {
130
- this.listeners.delete(listener);
131
- };
132
- }
133
- onChildGone(child) {
134
- // Guard against a late event from an already-replaced child.
135
- if (this.child === child) {
136
- this.child = null;
137
- this.lineBuf = "";
138
- }
139
- }
140
- onData(chunk) {
141
- this.lineBuf += chunk.toString();
142
- let nl;
143
- while ((nl = this.lineBuf.indexOf("\n")) >= 0) {
144
- const line = this.lineBuf.slice(0, nl);
145
- this.lineBuf = this.lineBuf.slice(nl + 1);
146
- const frame = this.parseLine(line);
147
- if (frame)
148
- this.push(frame);
149
- }
150
- }
151
- push(frame) {
152
- this.ring.push(frame);
153
- if (this.ring.length > this.cap)
154
- this.ring.shift();
155
- for (const listener of this.listeners) {
156
- // A throwing listener (e.g. a closed response) must not kill the capture
157
- // or starve the other listeners.
158
- try {
159
- listener(frame, false);
160
- }
161
- catch {
162
- // best-effort fan-out
163
- }
164
- }
165
- }
166
- }