@slack/radar-mcp 1.18.0 → 1.18.1
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 +7 -3
- package/dist/mcp/index.js +18 -1
- package/dist/shared/android.js +10 -1
- package/dist/shared/dashboard-screen.d.ts +2 -2
- package/dist/shared/screen-artifacts.d.ts +18 -1
- package/dist/shared/screen-artifacts.js +18 -2
- package/dist/shared/screen.d.ts +8 -14
- package/dist/shared/screen.js +26 -45
- package/dist/web/bin.js +13 -9
- package/dist/web/public/index.html +12 -1
- package/dist/web/public/next/app.js +24 -1
- package/dist/web/public/next/screen.js +154 -73
- package/dist/web/public/next/store.js +62 -0
- package/dist/web/server.d.ts +17 -6
- package/dist/web/server.js +180 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,20 +8,24 @@ Gives Claude Code direct access to network calls, RTM events, analytics (clogs),
|
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
|
-
The
|
|
11
|
+
The dashboard and the agent tools are set up separately. `install-app` gives you the dock app (see [Install it to your dock](#install-it-to-your-dock-macos) below); the tools need registering in every client you use.
|
|
12
|
+
|
|
13
|
+
For Claude Code, the recommended path is the marketplace plugin:
|
|
12
14
|
|
|
13
15
|
```bash
|
|
14
16
|
/plugin install slack-radar@slack-android-marketplace
|
|
15
17
|
/slack-radar-setup
|
|
16
18
|
```
|
|
17
19
|
|
|
18
|
-
Or register manually:
|
|
20
|
+
Or register it in Claude Code manually:
|
|
19
21
|
|
|
20
22
|
```bash
|
|
21
23
|
slack claude mcp add -s user slack-radar-mcp -- npx -y @slack/radar-mcp@latest
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
Every other MCP client registers servers its own way, in its own config format, but the entry is the same shape everywhere: a command of `npx`, with the arguments `-y` and `@slack/radar-mcp@latest`. Check your client's own documentation for which file that entry belongs in and what syntax it expects.
|
|
27
|
+
|
|
28
|
+
Restart the client for the tools to appear, whichever one you registered with.
|
|
25
29
|
|
|
26
30
|
## Web Dashboard
|
|
27
31
|
|
package/dist/mcp/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
|
|
|
5
5
|
import { spawn } from "child_process";
|
|
6
6
|
import fs from "fs";
|
|
7
7
|
import http from "http";
|
|
8
|
+
import os from "os";
|
|
8
9
|
import path from "path";
|
|
9
10
|
import { fileURLToPath } from "url";
|
|
10
11
|
import { AndroidTransport } from "../shared/android.js";
|
|
@@ -204,7 +205,23 @@ else if (wantsWeb) {
|
|
|
204
205
|
else {
|
|
205
206
|
await runMcpServer();
|
|
206
207
|
}
|
|
208
|
+
// Same ~/.slack-radar dir + overwrite convention as install-app.ts's writeSelfHealState. What this
|
|
209
|
+
// records is narrower than "the tools are registered": it means an MCP server process booted here
|
|
210
|
+
// at least once, which is all the dashboard's /setup-hint route claims.
|
|
211
|
+
function writeMcpSeenMarker() {
|
|
212
|
+
const file = path.join(os.homedir(), ".slack-radar", "mcp-last-seen.json");
|
|
213
|
+
try {
|
|
214
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
215
|
+
fs.writeFileSync(file, JSON.stringify({ seenAt: new Date().toISOString(), version: RADAR_VERSION }));
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
// Best-effort: the marker only feeds a dashboard hint, never worth failing boot over.
|
|
219
|
+
}
|
|
220
|
+
}
|
|
207
221
|
async function runMcpServer() {
|
|
222
|
+
// Only real MCP server boots write the marker; the install-app and web dispatch branches above
|
|
223
|
+
// never reach this, so the dock launcher and its self-heal child cannot forge it.
|
|
224
|
+
writeMcpSeenMarker();
|
|
208
225
|
// --- Platform selection ---
|
|
209
226
|
//
|
|
210
227
|
// No-flag auto-detect probes, in order: an attached adb device wins (android, exactly like today);
|
|
@@ -793,7 +810,7 @@ async function runMcpServer() {
|
|
|
793
810
|
}
|
|
794
811
|
}
|
|
795
812
|
// --- MCP Server ---
|
|
796
|
-
const server = new Server({ name: "slack-radar", version: "1.18.
|
|
813
|
+
const server = new Server({ name: "slack-radar", version: "1.18.1" }, { capabilities: { tools: {} }, instructions: serverInstructions(device.platform) });
|
|
797
814
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
798
815
|
tools: TOOL_DEFINITIONS,
|
|
799
816
|
}));
|
package/dist/shared/android.js
CHANGED
|
@@ -14,6 +14,15 @@ const ENABLE_ACTION = "slack.debug.ENABLE_RADAR";
|
|
|
14
14
|
* to get a real answer rather than an "unknown".
|
|
15
15
|
*/
|
|
16
16
|
const PS_PROBE_TIMEOUT_MS = 5000;
|
|
17
|
+
/**
|
|
18
|
+
* Ceiling for `adb devices -l`. Overridable because a test that deliberately parks a fake adb
|
|
19
|
+
* inside a listing (to pin what happens when a request lands mid-chain) otherwise races this
|
|
20
|
+
* timeout, and a loaded CI box turns it red for a reason unrelated to what the test asserts.
|
|
21
|
+
* Production never sets the env var and keeps the 5s default.
|
|
22
|
+
*/
|
|
23
|
+
const LIST_DEVICES_TIMEOUT_MS = Number(process.env.SLACK_RADAR_ADB_LIST_TIMEOUT_MS) > 0
|
|
24
|
+
? Number(process.env.SLACK_RADAR_ADB_LIST_TIMEOUT_MS)
|
|
25
|
+
: 5000;
|
|
17
26
|
/**
|
|
18
27
|
* Resolve the adb binary. MCP servers spawned from GUI launchers (Spotlight,
|
|
19
28
|
* Raycast, Dock) do not inherit the user's shell PATH, so a bare `adb` call
|
|
@@ -597,7 +606,7 @@ export class AndroidTransport {
|
|
|
597
606
|
return [];
|
|
598
607
|
try {
|
|
599
608
|
const { stdout } = await execFileAsync(ADB, ["devices", "-l"], {
|
|
600
|
-
timeout:
|
|
609
|
+
timeout: LIST_DEVICES_TIMEOUT_MS,
|
|
601
610
|
encoding: "utf-8",
|
|
602
611
|
});
|
|
603
612
|
const devices = parseAdbDevicesOutput(stdout);
|
|
@@ -25,8 +25,8 @@ export interface DashboardScreenController {
|
|
|
25
25
|
/**
|
|
26
26
|
* The safe subset of reset(): drop cached detection/capability state so the next capture
|
|
27
27
|
* re-detects, WITHOUT stopping recordings or deleting artifacts. This is what a same-device
|
|
28
|
-
* re-arm needs; reset() is reserved for real session boundaries (device swap,
|
|
29
|
-
*
|
|
28
|
+
* re-arm needs; reset() is reserved for real session boundaries (device swap, dashboard boot, a
|
|
29
|
+
* first enable that boot could not reap for, a deliberate re-detect).
|
|
30
30
|
*/
|
|
31
31
|
resetDetection(): void;
|
|
32
32
|
resolveRecording(file: string): string | null;
|
|
@@ -1,10 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one definition of where screen captures live. Exported so screen.ts shares this exact
|
|
3
|
+
* directory rather than rebuilding the same path: two independent joins can be tightened on one
|
|
4
|
+
* side and not the other, and cleanup that scans a different directory than capture writes to
|
|
5
|
+
* deletes nothing.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SCREEN_DIRECTORY: string;
|
|
1
8
|
/** Allocate an owner-only path for a recording containing sensitive screen content. */
|
|
2
9
|
export declare function createRecordingPath(): string;
|
|
3
10
|
/** Restrict a completed recording to its owner. */
|
|
4
11
|
export declare function secureRecording(recording: string): void;
|
|
5
12
|
/** Remove a failed or cancelled recording without surfacing cleanup errors. */
|
|
6
13
|
export declare function removeRecording(recording: string): void;
|
|
7
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Remove every Radar-owned capture at a session boundary: a dashboard boot, a device change, a first
|
|
16
|
+
* enable that boot could not reap for, a deliberate re-detect, or process exit. Recordings and
|
|
17
|
+
* screenshots both hold sensitive live screen content and must not linger across sessions on disk.
|
|
18
|
+
* NOT run on a plain re-arm of the same device, which leaves the user's own clips alone. The name
|
|
19
|
+
* check keeps an unrelated file that landed in the dir out of reach.
|
|
20
|
+
*
|
|
21
|
+
* The one implementation on purpose: screen.ts re-exports this rather than keeping the copy it used
|
|
22
|
+
* to have, so the dir and the name pattern cannot be tightened on one session-boundary cleanup and
|
|
23
|
+
* not the other.
|
|
24
|
+
*/
|
|
8
25
|
export declare function cleanupRecordings(): void;
|
|
9
26
|
/** Resolve a safe recording download without allowing traversal or unrelated files. */
|
|
10
27
|
export declare function recordingPath(file: string): string | null;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The one definition of where screen captures live. Exported so screen.ts shares this exact
|
|
6
|
+
* directory rather than rebuilding the same path: two independent joins can be tightened on one
|
|
7
|
+
* side and not the other, and cleanup that scans a different directory than capture writes to
|
|
8
|
+
* deletes nothing.
|
|
9
|
+
*/
|
|
10
|
+
export const SCREEN_DIRECTORY = path.join(os.homedir(), ".slack-radar", "screen");
|
|
5
11
|
const RECORDING_NAME = /^radar_screen_[\w-]+\.(mp4|png)$/;
|
|
6
12
|
/** Allocate an owner-only path for a recording containing sensitive screen content. */
|
|
7
13
|
export function createRecordingPath() {
|
|
@@ -35,7 +41,17 @@ export function removeRecording(recording) {
|
|
|
35
41
|
// The file may not have been created yet.
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Remove every Radar-owned capture at a session boundary: a dashboard boot, a device change, a first
|
|
46
|
+
* enable that boot could not reap for, a deliberate re-detect, or process exit. Recordings and
|
|
47
|
+
* screenshots both hold sensitive live screen content and must not linger across sessions on disk.
|
|
48
|
+
* NOT run on a plain re-arm of the same device, which leaves the user's own clips alone. The name
|
|
49
|
+
* check keeps an unrelated file that landed in the dir out of reach.
|
|
50
|
+
*
|
|
51
|
+
* The one implementation on purpose: screen.ts re-exports this rather than keeping the copy it used
|
|
52
|
+
* to have, so the dir and the name pattern cannot be tightened on one session-boundary cleanup and
|
|
53
|
+
* not the other.
|
|
54
|
+
*/
|
|
39
55
|
export function cleanupRecordings() {
|
|
40
56
|
try {
|
|
41
57
|
for (const file of fs.readdirSync(SCREEN_DIRECTORY)) {
|
package/dist/shared/screen.d.ts
CHANGED
|
@@ -37,15 +37,8 @@
|
|
|
37
37
|
* explicitly on cleanup.
|
|
38
38
|
*/
|
|
39
39
|
import { type ChildProcess } from "child_process";
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* sensitive live screen content and must not linger across sessions on disk. Called from
|
|
43
|
-
* resetScreenState(), so it runs on a session boundary (a device change, the first enable of
|
|
44
|
-
* the process, or a deliberate re-detect) and on process exit. It is NOT run on every device
|
|
45
|
-
* re-enable: a plain re-arm of the same device leaves the user's clips alone. Scoped to the
|
|
46
|
-
* names this module writes so it never deletes an unrelated file that landed in the dir.
|
|
47
|
-
*/
|
|
48
|
-
export declare function cleanupRecordings(): void;
|
|
40
|
+
import { cleanupRecordings } from "./screen-artifacts.js";
|
|
41
|
+
export { cleanupRecordings };
|
|
49
42
|
/** Resolve an ffmpeg binary, or null if none is installed. Cached. */
|
|
50
43
|
export declare function resolveFfmpeg(): string | null;
|
|
51
44
|
/** Whether scrcpy is installed (the no-ffmpeg fallback hint). Cached. */
|
|
@@ -250,16 +243,17 @@ export declare function saveScreenshot(): Promise<ScreenshotSaveResult>;
|
|
|
250
243
|
export declare function resetScreenDetection(): void;
|
|
251
244
|
/**
|
|
252
245
|
* Reset detection AND tear everything down: this process's live cast, the recorded mp4s, and any
|
|
253
|
-
* orphaned device-side screenrecord radar left behind. Only for a real session boundary (
|
|
254
|
-
* hardware, a
|
|
255
|
-
* user may be in the middle of, so
|
|
246
|
+
* orphaned device-side screenrecord radar left behind. Only for a real session boundary (dashboard
|
|
247
|
+
* boot, different hardware, a first enable that boot could not reap for, a deliberate re-detect, or
|
|
248
|
+
* process exit): the recordings and the live cast are work a user may be in the middle of, so
|
|
249
|
+
* calling this when nothing actually changed destroys it.
|
|
256
250
|
*/
|
|
257
251
|
export declare function resetScreenState(): void;
|
|
258
252
|
/**
|
|
259
253
|
* Kill any live cast (and orphaned device-side screenrecord) on process exit. Mirrors
|
|
260
254
|
* logcat-capture.registerCleanup(); without it, Ctrl-C on an open mirror orphans the
|
|
261
255
|
* screenrecord + ffmpeg children and leaves the device transport congested for the
|
|
262
|
-
* next session. Called
|
|
256
|
+
* next session. Called once the port bind is won (see registerScreenCleanupOnBind), so a launcher
|
|
257
|
+
* that loses the bind never arms a handler that would delete the winner's captures.
|
|
263
258
|
*/
|
|
264
259
|
export declare function registerScreenCleanup(): void;
|
|
265
|
-
export {};
|
package/dist/shared/screen.js
CHANGED
|
@@ -37,45 +37,23 @@
|
|
|
37
37
|
* explicitly on cleanup.
|
|
38
38
|
*/
|
|
39
39
|
import fs from "fs";
|
|
40
|
-
import os from "os";
|
|
41
40
|
import path from "path";
|
|
42
41
|
import { spawn, execFile, execFileSync } from "child_process";
|
|
43
42
|
import { promisify } from "util";
|
|
44
43
|
import { resolveAdbPath } from "./android.js";
|
|
45
|
-
import { createRecordingPath, secureRecording, } from "./screen-artifacts.js";
|
|
46
|
-
const SC_TMP = path.join(os.homedir(), ".slack-radar", "screen");
|
|
44
|
+
import { SCREEN_DIRECTORY, cleanupRecordings, createRecordingPath, secureRecording, } from "./screen-artifacts.js";
|
|
47
45
|
/**
|
|
48
|
-
* The only file names this module writes into the screen tmp dir, and therefore the only
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
46
|
+
* The only file names this module writes into the screen tmp dir, and therefore the only ones it
|
|
47
|
+
* will serve for download. Screenshots (png) joined recordings (mp4) here when screenshots became
|
|
48
|
+
* two-phase: a screenshot has to exist on disk for the outcome to be reportable before the browser
|
|
49
|
+
* is told to download it.
|
|
52
50
|
*/
|
|
53
51
|
const CAPTURE_NAME = /^radar_screen_[\w-]+\.(mp4|png)$/;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
* re-enable: a plain re-arm of the same device leaves the user's clips alone. Scoped to the
|
|
60
|
-
* names this module writes so it never deletes an unrelated file that landed in the dir.
|
|
61
|
-
*/
|
|
62
|
-
export function cleanupRecordings() {
|
|
63
|
-
try {
|
|
64
|
-
for (const f of fs.readdirSync(SC_TMP)) {
|
|
65
|
-
if (CAPTURE_NAME.test(f)) {
|
|
66
|
-
try {
|
|
67
|
-
fs.unlinkSync(path.join(SC_TMP, f));
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
// best-effort per file
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
// dir may not exist yet; nothing to clean
|
|
77
|
-
}
|
|
78
|
-
}
|
|
52
|
+
// Re-exported for the callers that reach the session-boundary cleanup through this module. This file
|
|
53
|
+
// carried a second copy of it, with its own dir and name pattern, until boot started reaching the
|
|
54
|
+
// screen-artifacts copy directly: two cleanups whose constants could be tightened apart with nothing
|
|
55
|
+
// failing.
|
|
56
|
+
export { cleanupRecordings };
|
|
79
57
|
const SC_SIZE = "720x1612";
|
|
80
58
|
const SC_BITRATE = "8000000";
|
|
81
59
|
const SC_BOUNDARY = "radarframe";
|
|
@@ -749,7 +727,7 @@ export function capturePath(file) {
|
|
|
749
727
|
const base = path.basename(file);
|
|
750
728
|
if (!CAPTURE_NAME.test(base))
|
|
751
729
|
return null;
|
|
752
|
-
const p = path.join(
|
|
730
|
+
const p = path.join(SCREEN_DIRECTORY, base);
|
|
753
731
|
return fs.existsSync(p) ? p : null;
|
|
754
732
|
}
|
|
755
733
|
/** The user-facing wording for each way a screenshot save can fail. */
|
|
@@ -776,16 +754,16 @@ export async function saveScreenshot() {
|
|
|
776
754
|
if (!png)
|
|
777
755
|
return { ok: false, reason: "capture-failed" };
|
|
778
756
|
const safe = new Date().toISOString().replace(/[:.]/g, "-");
|
|
779
|
-
const out = path.join(
|
|
757
|
+
const out = path.join(SCREEN_DIRECTORY, `radar_screen_${safe}.png`);
|
|
780
758
|
// Every host-side step is inside one try, so a failure to CREATE the dir is reported the same
|
|
781
759
|
// way as a failure to write the file. Left outside, an unwritable home threw straight out of
|
|
782
760
|
// here, and the route calling it has no catch, so the request hung until the client timed out.
|
|
783
761
|
try {
|
|
784
|
-
fs.mkdirSync(
|
|
762
|
+
fs.mkdirSync(SCREEN_DIRECTORY, { recursive: true, mode: 0o700 });
|
|
785
763
|
// mkdirSync's mode only applies on creation, so a dir from an earlier session keeps its
|
|
786
764
|
// old (world-traversable) perms. Same unconditional chmod startRecording does.
|
|
787
765
|
try {
|
|
788
|
-
fs.chmodSync(
|
|
766
|
+
fs.chmodSync(SCREEN_DIRECTORY, 0o700);
|
|
789
767
|
}
|
|
790
768
|
catch {
|
|
791
769
|
// best-effort; the file mode below is still applied
|
|
@@ -810,9 +788,10 @@ export function resetScreenDetection() {
|
|
|
810
788
|
}
|
|
811
789
|
/**
|
|
812
790
|
* Reset detection AND tear everything down: this process's live cast, the recorded mp4s, and any
|
|
813
|
-
* orphaned device-side screenrecord radar left behind. Only for a real session boundary (
|
|
814
|
-
* hardware, a
|
|
815
|
-
* user may be in the middle of, so
|
|
791
|
+
* orphaned device-side screenrecord radar left behind. Only for a real session boundary (dashboard
|
|
792
|
+
* boot, different hardware, a first enable that boot could not reap for, a deliberate re-detect, or
|
|
793
|
+
* process exit): the recordings and the live cast are work a user may be in the middle of, so
|
|
794
|
+
* calling this when nothing actually changed destroys it.
|
|
816
795
|
*/
|
|
817
796
|
export function resetScreenState() {
|
|
818
797
|
resetScreenDetection();
|
|
@@ -824,10 +803,11 @@ export function resetScreenState() {
|
|
|
824
803
|
// session boundary on disk.
|
|
825
804
|
cleanupRecordings();
|
|
826
805
|
// Best-effort: clean up orphaned device-side screenrecord procs that the host pipe
|
|
827
|
-
// close did not kill (they congest the single adb transport).
|
|
828
|
-
//
|
|
829
|
-
//
|
|
830
|
-
//
|
|
806
|
+
// close did not kill (they congest the single adb transport). The match is by cmdline and
|
|
807
|
+
// device-wide, so it also kills another dashboard's live cast and a hand-run
|
|
808
|
+
// `screenrecord --output-format=h264`; only the plain `screenrecord file.mp4` form falls
|
|
809
|
+
// outside the pattern. Single token deliberately: adb shell rejoins and re-parses the argv,
|
|
810
|
+
// so a pattern containing a space would need device-side quoting.
|
|
831
811
|
try {
|
|
832
812
|
execFile(adb(), ["shell", "pkill", "-9", "-f", "output-format=h264"], { timeout: 5000 }, () => { });
|
|
833
813
|
}
|
|
@@ -840,7 +820,8 @@ let cleanupRegistered = false;
|
|
|
840
820
|
* Kill any live cast (and orphaned device-side screenrecord) on process exit. Mirrors
|
|
841
821
|
* logcat-capture.registerCleanup(); without it, Ctrl-C on an open mirror orphans the
|
|
842
822
|
* screenrecord + ffmpeg children and leaves the device transport congested for the
|
|
843
|
-
* next session. Called
|
|
823
|
+
* next session. Called once the port bind is won (see registerScreenCleanupOnBind), so a launcher
|
|
824
|
+
* that loses the bind never arms a handler that would delete the winner's captures.
|
|
844
825
|
*/
|
|
845
826
|
export function registerScreenCleanup() {
|
|
846
827
|
if (cleanupRegistered)
|
|
@@ -880,7 +861,7 @@ function signalCleanup() {
|
|
|
880
861
|
scLive = null;
|
|
881
862
|
}
|
|
882
863
|
try {
|
|
883
|
-
//
|
|
864
|
+
// Same device-wide cmdline match as resetScreenState; see the note there for what it reaches.
|
|
884
865
|
execFileSync(adb(), ["shell", "pkill", "-9", "-f", "output-format=h264"], {
|
|
885
866
|
timeout: 3000,
|
|
886
867
|
stdio: "ignore",
|
package/dist/web/bin.js
CHANGED
|
@@ -3,7 +3,7 @@ import { execSync } from "child_process";
|
|
|
3
3
|
import { realpathSync } from "fs";
|
|
4
4
|
import http from "http";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
|
-
import { armOnBoot, cleanupOnBind, createServer, seedInitialSpec, shutdownDashboard, startAutoCloseSweep, WEB_PORT, } from "./server.js";
|
|
6
|
+
import { armOnBoot, cleanupOnBind, createServer, registerScreenCleanupOnBind, seedInitialSpec, shutdownDashboard, startAutoCloseSweep, WEB_PORT, } from "./server.js";
|
|
7
7
|
import { RADAR_VERSION } from "../shared/constants.js";
|
|
8
8
|
/**
|
|
9
9
|
* One loopback GET against the dashboard's own port, used by the adopt path. Resolves with the
|
|
@@ -144,6 +144,7 @@ export function startWebServer() {
|
|
|
144
144
|
// so adopting it leaves its view and open DB-browser tab intact.
|
|
145
145
|
seedInitialSpec();
|
|
146
146
|
cleanupOnBind();
|
|
147
|
+
registerScreenCleanupOnBind();
|
|
147
148
|
// Arm the auto-close sweep only now that THIS process owns the port. Doing it post-bind (not
|
|
148
149
|
// in createServer) keeps importing the module — or a second launcher that loses the bind —
|
|
149
150
|
// from arming a timer that could process.exit. The interval is unref'd inside.
|
|
@@ -165,14 +166,17 @@ export function startWebServer() {
|
|
|
165
166
|
});
|
|
166
167
|
// The /shutdown route and the auto-close sweep both funnel through shutdownDashboard, so the
|
|
167
168
|
// server.close + timeout-fallback exit -- and the finalize-a-live-recording safety step --
|
|
168
|
-
// cannot drift between THOSE two paths. Ctrl-C / SIGTERM do
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
//
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
//
|
|
175
|
-
//
|
|
169
|
+
// cannot drift between THOSE two paths. Ctrl-C / SIGTERM mostly do not get that far, because
|
|
170
|
+
// Node runs signal listeners in registration order and two other modules register first:
|
|
171
|
+
// log-session's cleanup (from server.js module load, Android only) and, on the platforms without
|
|
172
|
+
// it, this handler ahead of the platform screen controller's own (which now registers post-bind, from
|
|
173
|
+
// registerScreenCleanupOnBind). Both of those call process.exit() synchronously, so on Android
|
|
174
|
+
// the logcat handler ends the process before this runs at all, and on iOS this one starts and is
|
|
175
|
+
// then cut short by the iOS controller's exit. Either way a live recording is torn down fire-and-forget
|
|
176
|
+
// rather than finalized. Pre-existing gap, not introduced here; closing it means restructuring
|
|
177
|
+
// signal handling across three modules, which is out of scope for a change about reap placement.
|
|
178
|
+
// Registering below still costs nothing and is the load-bearing path IF those handlers ever stop
|
|
179
|
+
// exiting synchronously.
|
|
176
180
|
const shutdown = () => void shutdownDashboard(server);
|
|
177
181
|
process.on("SIGINT", shutdown);
|
|
178
182
|
process.on("SIGTERM", shutdown);
|
|
@@ -58,6 +58,12 @@
|
|
|
58
58
|
.profilewrap { font-size:12px; color:var(--blue-2); } .profilewrap b { color:var(--text); }
|
|
59
59
|
.profilewrap select { background:var(--surface); border:1px solid var(--border-2); border-radius:6px; color:var(--text); padding:3px 6px; font:inherit; font-size:11px; margin-left:4px; cursor:pointer; }
|
|
60
60
|
h1 .version { margin-left:auto; font-size:11px; font-weight:400; color:var(--muted-2); letter-spacing:0; }
|
|
61
|
+
/* Blue, not amber: this is an onboarding suggestion, and amber is what a real fault uses. */
|
|
62
|
+
h1 .setuphint { font-size:11px; font-weight:400; color:var(--blue-2); letter-spacing:0; }
|
|
63
|
+
h1 .setuphint a { color:inherit; }
|
|
64
|
+
/* Sized like .chip .x rather than a bare glyph: dismissal has no undo, so it needs a real target. */
|
|
65
|
+
h1 .setuphint .hintdismiss { background:var(--surface); border:1px solid var(--border-2); border-radius:50%; color:inherit; cursor:pointer; font:inherit; line-height:1; width:16px; height:16px; padding:0; margin-left:6px; }
|
|
66
|
+
h1 .setuphint .hintdismiss:hover { border-color:var(--accent); color:var(--text); }
|
|
61
67
|
.themebtn, .screenbtn { background:var(--surface); border:1px solid var(--border-2); color:var(--muted-2); border-radius:8px; padding:5px 12px; font:inherit; font-size:12.5px; cursor:pointer; }
|
|
62
68
|
.themebtn:hover, .screenbtn:hover { border-color:var(--accent); color:var(--text); } .screenbtn.on { background:var(--accent-bg); border-color:var(--accent); color:var(--accent-text); }
|
|
63
69
|
.killbtn.armed { border-color:var(--error); color:var(--error); } .killbtn.armed:hover { border-color:var(--error-2); color:var(--error-2); }
|
|
@@ -433,6 +439,11 @@
|
|
|
433
439
|
#screenpanel .scbtn { background:var(--surface); border:1px solid var(--border-2); color:var(--muted-2); border-radius:6px; padding:3px 9px; font:inherit; font-size:11.5px; cursor:pointer; } #screenpanel .scbtn:hover:not(:disabled) { border-color:var(--accent); color:var(--text); } #screenpanel .scbtn:disabled { opacity:0.4; cursor:not-allowed; } #screenpanel .scbtn.rec { color:var(--error); border-color:var(--error); }
|
|
434
440
|
#screenimg { width:100%; border:1px solid var(--border); border-radius:8px; background:#000; min-height:120px; transition:opacity 0.3s; } #screenimg.stale { opacity:0.5; }
|
|
435
441
|
#schint { font-size:11.5px; color:var(--muted); margin-bottom:8px; line-height:1.5; }
|
|
442
|
+
/* The save line sits under the status line and outlives it, so it has to read as the standing
|
|
443
|
+
answer rather than another transient note. Full text colour is what carries that at a glance:
|
|
444
|
+
persistence alone only reads over time, and the reveal underline is dock-app only, so in a
|
|
445
|
+
plain browser two muted lines would look like two transient notes. */
|
|
446
|
+
#scsave { font-size:11.5px; color:var(--text); margin:-4px 0 8px; line-height:1.5; }
|
|
436
447
|
/* Floating save confirmation. Lives outside the docked side panel on purpose: the panel is
|
|
437
448
|
only 340px wide and clipped to the right edge, and closing it (which auto-saves a running
|
|
438
449
|
recording) unmounts it entirely, so anything panel-local can be invisible exactly when it
|
|
@@ -447,7 +458,7 @@
|
|
|
447
458
|
#radartoast.on.clickable { pointer-events:auto; cursor:pointer; }
|
|
448
459
|
.scconsent { background:var(--surface); border:1px solid var(--border-3); border-radius:8px; padding:12px; font-size:12px; color:var(--text-2); line-height:1.55; } .scconsent b { color:var(--warn-2); }
|
|
449
460
|
.scconsent .scaccept { background:var(--accent-bg); border:1px solid var(--accent); color:var(--accent-text); border-radius:6px; padding:6px 14px; font:inherit; font-size:12px; cursor:pointer; margin-top:10px; display:block; } .scconsent .scaccept:hover { filter:brightness(1.1); }
|
|
450
|
-
.scinstall { background:var(--surface-2); border:1px solid var(--border); border-radius:6px; padding:8px 10px; margin-top:8px; font-size:11.5px; color:var(--text-2); } .scinstall code { color:var(--copybtn-fg); }
|
|
461
|
+
.scinstall, .scdetect { background:var(--surface-2); border:1px solid var(--border); border-radius:6px; padding:8px 10px; margin-top:8px; font-size:11.5px; color:var(--text-2); } .scinstall code { color:var(--copybtn-fg); }
|
|
451
462
|
.scinstall .sccopy { background:var(--copybtn-bg); border:1px solid var(--copybtn-border); color:var(--copybtn-fg); border-radius:5px; padding:2px 8px; font:inherit; font-size:11px; cursor:pointer; margin-left:6px; }
|
|
452
463
|
</style>
|
|
453
464
|
<!-- No-build Preact: the import map resolves the bare `preact` + `preact/hooks` + `htm`
|
|
@@ -18,6 +18,17 @@ import { DbBrowser } from "./db.js";
|
|
|
18
18
|
import { FlagsBrowser } from "./flags.js";
|
|
19
19
|
import { PrefsBrowser } from "./prefs.js";
|
|
20
20
|
import { ScreenOverlay } from "./screen.js";
|
|
21
|
+
// Dismissal is per-browser on purpose: the marker file is per-machine, so without a local flag
|
|
22
|
+
// the hint would come back on every load for a user who already chose to ignore it.
|
|
23
|
+
const SETUP_HINT_DISMISS_KEY = "radar-setup-hint-dismissed";
|
|
24
|
+
function readSetupHintDismissed() {
|
|
25
|
+
try {
|
|
26
|
+
return localStorage.getItem(SETUP_HINT_DISMISS_KEY) === "1";
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
21
32
|
function readTheme() {
|
|
22
33
|
try {
|
|
23
34
|
return document.documentElement.classList.contains("light") ? "light" : "dark";
|
|
@@ -62,7 +73,18 @@ export function Header({ screenOpen, onScreenToggle }) {
|
|
|
62
73
|
const profile = useStoreValue(store, "profile", () => store.profileLabel);
|
|
63
74
|
const version = useStoreValue(store, "version", () => store.serverVersion);
|
|
64
75
|
const selfHeal = useStoreValue(store, "self-heal", () => store.selfHeal);
|
|
76
|
+
const setupHint = useStoreValue(store, "setup-hint", () => store.setupHint);
|
|
65
77
|
const stopped = useStoreValue(store, "stopped", () => store.stopped);
|
|
78
|
+
const [hintDismissed, setHintDismissed] = useState(readSetupHintDismissed);
|
|
79
|
+
const dismissHint = useCallback(() => {
|
|
80
|
+
try {
|
|
81
|
+
localStorage.setItem(SETUP_HINT_DISMISS_KEY, "1");
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
/* private mode: the hint returns next load */
|
|
85
|
+
}
|
|
86
|
+
setHintDismissed(true);
|
|
87
|
+
}, []);
|
|
66
88
|
const [busy, setBusy] = useState(false);
|
|
67
89
|
const [killing, setKilling] = useState(false);
|
|
68
90
|
// Arm/confirm for the destructive kill button: the FIRST click only arms a "sure?" state
|
|
@@ -132,6 +154,7 @@ export function Header({ screenOpen, onScreenToggle }) {
|
|
|
132
154
|
${version ? html `<span class="version" title="Version of the dashboard process. It can differ from your Claude Code MCP session if a dashboard from an earlier launch still holds the port; restart the dashboard to match.">v${version}</span>` : null}
|
|
133
155
|
${selfHeal?.outcome === "updated" ? html `<span class="version" title="Radar self-healed to a newer version on this launch">↑ updated to v${selfHeal.toVersion}</span>` : null}
|
|
134
156
|
${selfHeal?.outcome === "error" ? html `<span class="conn waiting" title=${"The dock launcher's self-heal check failed: " + (selfHeal.error || "unknown error") + ". Log: ~/Library/Logs/slack-radar-dashboard.log"}>⚠ self-heal check failed</span>` : null}
|
|
157
|
+
${setupHint && !setupHint.mcpSeen && !hintDismissed ? html `<span class="setuphint" title="Radar has not seen an agent client start its MCP server on this machine. The dashboard works without one.">No agent client has connected yet. <a href="https://slack-github.com/slack/slack-radar-mcp#installation" target="_blank" rel="noreferrer">Set up agent tools</a>.<button class="hintdismiss" onClick=${dismissHint} aria-label="Hide the agent tools hint permanently in this browser" title="Hide this hint permanently in this browser">✕</button></span>` : null}
|
|
135
158
|
</h1>
|
|
136
159
|
`;
|
|
137
160
|
}
|
|
@@ -327,7 +350,7 @@ function App() {
|
|
|
327
350
|
<${Header} screenOpen=${screenOpen} onScreenToggle=${() => setScreenOpen((o) => !o)} />
|
|
328
351
|
<${ModeBar} />
|
|
329
352
|
${view}
|
|
330
|
-
<${ScreenOverlay} open=${screenOpen} onClose=${() => setScreenOpen(false)} />
|
|
353
|
+
<${ScreenOverlay} open=${screenOpen} onClose=${() => setScreenOpen(false)} capsSource=${store} />
|
|
331
354
|
`;
|
|
332
355
|
}
|
|
333
356
|
// Both the poll loops and the render are gated on the mount point existing. The render already was;
|